@liquidcommerce/elements-sdk 2.6.0-beta.5 → 2.6.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +9846 -10432
- package/dist/types/core/api/api-client.service.d.ts +3 -4
- package/dist/types/core/command/common-command.service.d.ts +1 -1
- package/dist/types/core/google-tag-manager.service.d.ts +2 -0
- package/dist/types/core/pubsub/interfaces/cart.interface.d.ts +2 -14
- package/dist/types/core/pubsub/interfaces/checkout.interface.d.ts +2 -1
- package/dist/types/core/pubsub/interfaces/product.interface.d.ts +0 -1
- package/dist/types/core/store/interfaces/cart.interface.d.ts +16 -55
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +2 -2
- package/dist/types/core/store/interfaces/core.interface.d.ts +3 -2
- package/dist/types/enums/cloud.enum.d.ts +3 -300
- package/dist/types/interfaces/api/cart.interface.d.ts +91 -0
- package/dist/types/interfaces/cloud/catalog.interface.d.ts +2 -3
- package/dist/types/interfaces/cloud/checkout.interface.d.ts +9 -2
- package/dist/types/interfaces/cloud/index.d.ts +0 -1
- package/dist/types/modules/cart/cart.commands.d.ts +0 -1
- package/dist/types/modules/cart/cart.commands.helper.d.ts +1 -6
- package/dist/types/modules/cart/components/cart-footer.component.d.ts +0 -1
- package/dist/types/modules/cart/components/cart-fulfillment.component.d.ts +0 -2
- package/dist/types/modules/product-list/components/product-list-card.component.d.ts +3 -3
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +1 -1
- package/dist/types/modules/product-list/product-list.component.d.ts +2 -3
- package/dist/types/modules/product-list/product-list.interface.d.ts +2 -2
- package/dist/types/modules/ui-components/purchase-min-alert/index.d.ts +0 -1
- package/dist/types/utils/helper.d.ts +2 -1
- package/package.json +3 -3
- package/umd/elements.js +1 -1
- package/dist/types/interfaces/cloud/cart.interface.d.ts +0 -132
- package/dist/types/modules/ui-components/purchase-min-alert/helpers.d.ts +0 -7
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(ht){console.warn("DOM polyfills initialization failed:",ht)}}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),s=String((null==t?void 0:t.stack)||""),a=(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/],m=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],g=[/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],v=isSDKSource(a),y=d.some(t=>t.test(s)),b=u.some(t=>t.test(s)),x=m.some(t=>t.test(s)),w=g.some(t=>t.test(s));return o||v||y||b||x||w}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))}var t,n,i,o,s,a,d,u,m,g,v;(function(t){t.ALE="BEER > ALE",t.LAGER="BEER > LAGER",t.BASE="BEER",t.NON_ALCOHOLIC="BEER > NON-ALCOHOLIC",t.OTHER_BEER="BEER > OTHER",t.OTHER_BEER_SOUR_BEER="BEER > SOUR BEER",t.OTHER_BEER_FLAVORED_BEER="BEER > FLAVORED BEER",t.OTHER_BEER_FRUIT_BEER="BEER > FRUIT BEER"})(t||(t={})),function(t){t.BASE="FOOD",t.PANTRY_OTHER="FOOD > PANTRY > OTHER",t.CANDY="FOOD > CANDY",t.CANDY_OTHER="FOOD > CANDY > OTHER",t.CBD="FOOD > CBD",t.CBD_OTHER="FOOD > CBD > OTHER",t.CHEESE="FOOD > CHEESE",t.CHEESE_OTHER="FOOD > CHEESE > OTHER",t.HOUSEHOLD="FOOD > HOUSEHOLD",t.HOUSEHOLD_SNACKS="FOOD > HOUSEHOLD > SNACKS",t.HOUSEHOLD_OTHER="FOOD > HOUSEHOLD > OTHER",t.PANTRY="FOOD > PANTRY",t.FRUIT="FOOD > FRUIT",t.OTHER="FOOD > OTHER",t.ICE="FOOD > ICE",t.ICE_CREAM="FOOD > ICE CREAM",t.PARTY_SUPPLIES="FOOD > PARTY SUPPLIES",t.PARTY_SUPPLIES_OTHER="FOOD > PARTY SUPPLIES > OTHER",t.SPIRITS_BASED="FOOD > SPIRITS BASED",t.GARNISHES="FOOD > GARNISHES"}(n||(n={})),function(t){t.BASE="MERCHANDISE",t.GLASSWARE="MERCHANDISE > GLASSWARE",t.GLASSWARE_OTHER="MERCHANDISE > GLASSWARE > OTHER",t.HUMIDOR="MERCHANDISE > HUMIDOR",t.ACCESSORY="MERCHANDISE > ACCESSORY",t.ACCESSORY_OTHER="MERCHANDISE > ACCESSORY > OTHER",t.GIFT_SET="MERCHANDISE > GIFT SET",t.GIFT_SET_GIFT_BAG="MERCHANDISE > GIFT SET > GIFT BAG",t.GIFT_SET_GIFT_CARD="MERCHANDISE > GIFT SET > GIFT CARD",t.BAR_TOOLS="MERCHANDISE > BAR TOOLS",t.BAR_TOOLS_ICE_BUCKET="MERCHANDISE > BAR TOOLS > ICE BUCKET",t.BAR_TOOLS_OTHER="MERCHANDISE > BAR TOOLS > OTHER"}(i||(i={})),function(t){t.BASE="MISCELLANEOUS",t.GIFT_CARD="MISCELLANEOUS > GIFT CARDS",t.PROMOTIONAL="MISCELLANEOUS > PROMOTIONAL",t.MEMBERSHIP="MISCELLANEOUS > MEMBERSHIP"}(o||(o={})),function(t){t.BASE="NON ALCOHOLIC",t.BITTERS="NON ALCOHOLIC > BITTERS",t.COCKTAIL_MIX="NON ALCOHOLIC > COCKTAIL MIX",t.COFFEE="NON ALCOHOLIC > COFFEE",t.ENERGY_DRINKS="NON ALCOHOLIC > ENERGY DRINKS",t.JUICE="NON ALCOHOLIC > JUICE",t.SODA="NON ALCOHOLIC > SODA",t.SPECIALTY_ITEM="NON ALCOHOLIC > SPECIALTY ITEM",t.SPECIALTY_ITEM_OTHER="NON ALCOHOLIC > SPECIALTY ITEM > OTHER",t.SPIRITS="NON ALCOHOLIC > SPIRITS",t.TEA="NON ALCOHOLIC > TEA",t.WATER="NON ALCOHOLIC > WATER",t.WINE="NON ALCOHOLIC > WINE",t.SPORTS_DRINKS="NON ALCOHOLIC > SPORTS DRINKS",t.SLURPEES="NON ALCOHOLIC > SLURPEES",t.GINGER_BEER="NON ALCOHOLIC > GINGER BEER",t.DAIRY="NON ALCOHOLIC > DAIRY",t.DAIRY_OTHER="NON ALCOHOLIC > DAIRY > OTHER",t.OTHER="NON ALCOHOLIC > OTHER"}(s||(s={})),function(t){t.BASE="READY TO DRINK",t.HARD_CIDER="READY TO DRINK > HARD CIDER",t.HARD_CIDER_PERRY_PEAR_CIDER="READY TO DRINK > HARD CIDER > PERRY (PEAR CIDER)",t.HARD_CIDER_APPLE_CIDER="READY TO DRINK > HARD CIDER > APPLE CIDER",t.HARD_CIDER_OTHER_FRUIT_CIDER="READY TO DRINK > HARD CIDER > FRUIT CIDER",t.HARD_TEA="READY TO DRINK > HARD TEA",t.HARD_SELTZER="READY TO DRINK > HARD SELTZER",t.MALT_BASED="READY TO DRINK > MALT BASED",t.SPIRITS_BASED_RTDS="READY TO DRINK > SPIRITS-BASED RTDS",t.SPIRITS_BASED_RTDS_AGAVE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > AGAVE COCKTAILS",t.SPIRITS_BASED_RTDS_GIN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > GIN COCKTAILS",t.SPIRITS_BASED_RTDS_RUM_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > RUM COCKTAILS",t.SPIRITS_BASED_RTDS_TEQUILA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEQUILA COCKTAILS",t.SPIRITS_BASED_RTDS_VODKA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > VODKA COCKTAILS",t.SPIRITS_BASED_RTDS_WHISKEY_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > WHISKEY COCKTAILS",t.SPIRITS_BASED_RTDS_OTHER="READY TO DRINK > SPIRITS-BASED RTDS > OTHER",t.SPIRITS_BASED_RTDS_FROZEN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > FROZEN COCKTAILS",t.SPIRITS_BASED_RTDS_APERITIF_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > APERITIF COCKTAILS",t.SPIRITS_BASED_RTDS_DESSERT_COFFEE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > DESSERT & COFFEE COCKTAILS",t.SPIRITS_BASED_RTDS_TEA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEA COCKTAILS",t.WINE_COCKTAILS="READY TO DRINK > WINE COCKTAILS",t.OTHER="READY TO DRINK > OTHER"}(a||(a={})),function(t){t.BASE="SPIRITS",t.AMARO_APERITIF_VERMOUTH="SPIRITS > AMARO APERITIF & VERMOUTH",t.AMARO_APERITIF_VERMOUTH_OTHER="SPIRITS > AMARO APERITIF & VERMOUTH > OTHER",t.BAIJIU="SPIRITS > BAIJIU",t.BITTERS="SPIRITS > BITTERS",t.BRANDY="SPIRITS > BRANDY",t.BRANDY_COGNAC="SPIRITS > BRANDY > COGNAC",t.CACHACA="SPIRITS > CACHACA",t.GIN="SPIRITS > GIN",t.GIN_DRY_GIN="SPIRITS > GIN > DRY GIN",t.GIN_FLAVORED_GIN="SPIRITS > GIN > FLAVORED GIN",t.GIN_OLD_TOM_GIN="SPIRITS > GIN > OLD TOM GIN",t.GIN_OTHER="SPIRITS > GIN > OTHER",t.GRAIN_ALCOHOL="SPIRITS > GRAIN ALCOHOL",t.LIQUEUR="SPIRITS > LIQUEUR",t.MEZCAL="SPIRITS > MEZCAL",t.OTHER_SPIRITS="SPIRITS > OTHER SPIRITS",t.RUM="SPIRITS > RUM",t.RUM_AGED_RUM="SPIRITS > RUM > AGED RUM",t.RUM_DARK_RUM="SPIRITS > RUM > DARK RUM",t.RUM_FLAVORED_RUM="SPIRITS > RUM > FLAVORED RUM",t.RUM_GOLD_RUM="SPIRITS > RUM > GOLD RUM",t.RUM_OTHER="SPIRITS > RUM > OTHER",t.RUM_SPICED="SPIRITS > RUM > SPICED",t.RUM_WHITE_RUM="SPIRITS > RUM > WHITE RUM",t.SHOCHU="SPIRITS > SHOCHU",t.SOJU="SPIRITS > SOJU",t.SOTOL="SPIRITS > SOTOL",t.TEQUILA="SPIRITS > TEQUILA",t.TEQUILA_ANEJO="SPIRITS > TEQUILA > AÑEJO",t.TEQUILA_BLANCO="SPIRITS > TEQUILA > BLANCO",t.TEQUILA_CRISTALINO="SPIRITS > TEQUILA > CRISTALINO",t.TEQUILA_EXTRA_ANEJO="SPIRITS > TEQUILA > EXTRA AÑEJO",t.TEQUILA_OTHER="SPIRITS > TEQUILA > OTHER",t.TEQUILA_REPOSADO="SPIRITS > TEQUILA > REPOSADO",t.VODKA="SPIRITS > VODKA",t.VODKA_FLAVORED_VODKA="SPIRITS > VODKA > FLAVORED VODKA",t.VODKA_OTHER="SPIRITS > VODKA > OTHER",t.VODKA_REGULAR_VODKA="SPIRITS > VODKA > REGULAR VODKA",t.WHISKEY="SPIRITS > WHISKEY",t.WHISKEY_AMERICAN_WHISKEY="SPIRITS > WHISKEY > AMERICAN WHISKEY",t.WHISKEY_BOURBON="SPIRITS > WHISKEY > BOURBON",t.WHISKEY_CANADIAN_WHISKEY="SPIRITS > WHISKEY > CANADIAN WHISKEY",t.WHISKEY_IRISH_WHISKEY="SPIRITS > WHISKEY > IRISH WHISKEY",t.WHISKEY_MOONSHINE="SPIRITS > WHISKEY > MOONSHINE",t.WHISKEY_FLAVORED="SPIRITS > WHISKEY > FLAVORED WHISKEY",t.WHISKEY_OTHER="SPIRITS > WHISKEY > OTHER",t.WHISKEY_SCOTCH="SPIRITS > WHISKEY > SCOTCH"}(d||(d={})),function(t){t.BASE="WINE",t.CHAMPAGNE_SPARKLING="WINE > CHAMPAGNE & SPARKLING",t.CHAMPAGNE_SPARKLING_CAVA="WINE > CHAMPAGNE & SPARKLING > CAVA",t.CHAMPAGNE_SPARKLING_CHAMPAGNE="WINE > CHAMPAGNE & SPARKLING > CHAMPAGNE",t.CHAMPAGNE_SPARKLING_PROSECCO="WINE > CHAMPAGNE & SPARKLING > PROSECCO",t.CHAMPAGNE_SPARKLING_SPARKLING_WINE="WINE > CHAMPAGNE & SPARKLING > SPARKLING WINE",t.CHAMPAGNE_SPARKLING_OTHER="WINE > CHAMPAGNE & SPARKLING > OTHER",t.COOKING="WINE > COOKING",t.DESSERT_FORTIFIED_WINE="WINE > DESSERT & FORTIFIED WINE",t.DESSERT_FORTIFIED_WINE_MEAD="WINE > DESSERT & FORTIFIED WINE > MEAD",t.DESSERT_FORTIFIED_WINE_PORT="WINE > DESSERT & FORTIFIED WINE > PORT",t.DESSERT_FORTIFIED_WINE_SHERRY="WINE > DESSERT & FORTIFIED WINE > SHERRY",t.DESSERT_FORTIFIED_WINE_OTHER="WINE > DESSERT & FORTIFIED WINE > OTHER",t.RED_WINE="WINE > RED WINE",t.RED_WINE_AGIORGITIKO="WINE > RED WINE > AGIORGITIKO",t.RED_WINE_AGLIANICO="WINE > RED WINE > AGLIANICO",t.RED_WINE_ALICANTE_BOUSCHET="WINE > RED WINE > ALICANTE BOUSCHET",t.RED_WINE_BARBERA="WINE > RED WINE > BARBERA",t.RED_WINE_BARBARESCO="WINE > RED WINE > BARBARESCO",t.RED_WINE_BAROLO="WINE > RED WINE > BAROLO",t.RED_WINE_BEAUJOLAIS="WINE > RED WINE > BEAUJOLAIS",t.RED_WINE_BLAUER_ZWEIGELT="WINE > RED WINE > BLAUER ZWEIGELT",t.RED_WINE_BOBAL="WINE > RED WINE > BOBAL",t.RED_WINE_BONARDA="WINE > RED WINE > BONARDA",t.RED_WINE_BORDEAUX="WINE > RED WINE > BORDEAUX",t.RED_WINE_BORDEAUX_BLEND="WINE > RED WINE > BORDEAUX BLEND",t.RED_WINE_BURGUNDY="WINE > RED WINE > BURGUNDY",t.RED_WINE_CABERNET_FRANC="WINE > RED WINE > CABERNET FRANC",t.RED_WINE_CABERNET_SAUVIGNON="WINE > RED WINE > CABERNET SAUVIGNON",t.RED_WINE_CANNONAU="WINE > RED WINE > CANNONAU",t.RED_WINE_CARMENERE="WINE > RED WINE > CARMENERE",t.RED_WINE_CHAMBOURCIN="WINE > RED WINE > CHAMBOURCIN",t.RED_WINE_CHIANTI="WINE > RED WINE > CHIANTI",t.RED_WINE_CINSAULT="WINE > RED WINE > CINSAULT",t.RED_WINE_CORVINA="WINE > RED WINE > CORVINA",t.RED_WINE_DOLCETTO="WINE > RED WINE > DOLCETTO",t.RED_WINE_DORNFELDER="WINE > RED WINE > DORNFELDER",t.RED_WINE_FETEASCA_NEAGRA="WINE > RED WINE > FETEASCA NEAGRA",t.RED_WINE_GAMAY="WINE > RED WINE > GAMAY",t.RED_WINE_GRACIANO="WINE > RED WINE > GRACIANO",t.RED_WINE_GRENACHE="WINE > RED WINE > GRENACHE",t.RED_WINE_LIMNIO="WINE > RED WINE > LIMNIO",t.RED_WINE_MACABEO="WINE > RED WINE > MACABEO",t.RED_WINE_MALBEC="WINE > RED WINE > MALBEC",t.RED_WINE_MENCIA="WINE > RED WINE > MENCIA",t.RED_WINE_MERLOT="WINE > RED WINE > MERLOT",t.RED_WINE_MONICA="WINE > RED WINE > MONICA",t.RED_WINE_MONTEPULCIANO="WINE > RED WINE > MONTEPULCIANO",t.RED_WINE_MOURVEDRE_MONASTRELL="WINE > RED WINE > MOURVEDRE/MONASTRELL",t.RED_WINE_NEBBIOLO="WINE > RED WINE > NEBBIOLO",t.RED_WINE_NEGROAMARO="WINE > RED WINE > NEGROAMARO",t.RED_WINE_NERELLO_MASCALESE="WINE > RED WINE > NERELLO MASCALESE",t.RED_WINE_NERO_DAVOLA="WINE > RED WINE > NERO D'AVOLA",t.RED_WINE_PETIT_VERDOT="WINE > RED WINE > PETIT VERDOT",t.RED_WINE_PETITE_SIRAH="WINE > RED WINE > PETITE SIRAH",t.RED_WINE_PINOT_NOIR="WINE > RED WINE > PINOT NOIR",t.RED_WINE_PINOTAGE="WINE > RED WINE > PINOTAGE",t.RED_WINE_PRIMITIVO="WINE > RED WINE > PRIMITIVO",t.RED_WINE_RED_BLEND="WINE > RED WINE > RED BLEND",t.RED_WINE_RHONE_BLEND="WINE > RED WINE > RHONE BLEND",t.RED_WINE_RIOJA="WINE > RED WINE > RIOJA",t.RED_WINE_SAGRANTINO="WINE > RED WINE > SAGRANTINO",t.RED_WINE_SANGIOVESE="WINE > RED WINE > SANGIOVESE",t.RED_WINE_SAPERAVI="WINE > RED WINE > SAPERAVI",t.RED_WINE_SCHIAVA_TROLLINGER="WINE > RED WINE > SCHIAVA/TROLLINGER",t.RED_WINE_SYRAH_SHIRAZ="WINE > RED WINE > SYRAH/SHIRAZ",t.RED_WINE_TANNAT="WINE > RED WINE > TANNAT",t.RED_WINE_TEMPRANILLO="WINE > RED WINE > TEMPRANILLO",t.RED_WINE_TEROLDEGO="WINE > RED WINE > TEROLDEGO",t.RED_WINE_TINTA_DEL_TORO="WINE > RED WINE > TINTA DEL TORO",t.RED_WINE_TOURIGA_NACIONAL="WINE > RED WINE > TOURIGA NACIONAL",t.RED_WINE_VALPOLICELLA="WINE > RED WINE > VALPOLICELLA",t.RED_WINE_XINOMAVRO="WINE > RED WINE > XINOMAVRO",t.RED_WINE_ZINFANDEL="WINE > RED WINE > ZINFANDEL",t.RED_WINE_ZWEIGELT="WINE > RED WINE > ZWEIGELT",t.RED_WINE_OTHER="WINE > RED WINE > OTHER",t.ROSE_WINE="WINE > ROSE WINE",t.SAKE="WINE > SAKE",t.WHITE_WINE="WINE > WHITE WINE",t.WHITE_WINE_ALBARINO_ALVARINHO="WINE > WHITE WINE > ALBARINO/ALVARINHO",t.WHITE_WINE_ARNEIS="WINE > WHITE WINE > ARNEIS",t.WHITE_WINE_ASTI="WINE > WHITE WINE > ASTI",t.WHITE_WINE_ASSYRTIKO="WINE > WHITE WINE > ASSYRTIKO",t.WHITE_WINE_BURGUNDY="WINE > WHITE WINE > BURGUNDY",t.WHITE_WINE_CARRICANTE="WINE > WHITE WINE > CARRICANTE",t.WHITE_WINE_CATARRATTO="WINE > WHITE WINE > CATARRATTO",t.WHITE_WINE_CHABLIS="WINE > WHITE WINE > CHABLIS",t.WHITE_WINE_CHARDONNAY="WINE > WHITE WINE > CHARDONNAY",t.WHITE_WINE_CHENIN_BLANC="WINE > WHITE WINE > CHENIN BLANC",t.WHITE_WINE_CORTESE="WINE > WHITE WINE > CORTESE",t.WHITE_WINE_FALANGHINA="WINE > WHITE WINE > FALANGHINA",t.WHITE_WINE_FIANO="WINE > WHITE WINE > FIANO",t.WHITE_WINE_FRIULANO="WINE > WHITE WINE > FRIULANO",t.WHITE_WINE_FURMINT="WINE > WHITE WINE > FURMINT",t.WHITE_WINE_GARGANEGA="WINE > WHITE WINE > GARGANEGA",t.WHITE_WINE_GAVI="WINE > WHITE WINE > GAVI",t.WHITE_WINE_GEWURZTRAMINER="WINE > WHITE WINE > GEWURZTRAMINER",t.WHITE_WINE_GRECO_DI_TUFO="WINE > WHITE WINE > GRECO DI TUFO",t.WHITE_WINE_GRENACHE_BLANC="WINE > WHITE WINE > GRENACHE BLANC",t.WHITE_WINE_GRUNER_VELTLINER="WINE > WHITE WINE > GRUNER VELTLINER",t.WHITE_WINE_HUXELREBE="WINE > WHITE WINE > HUXELREBE",t.WHITE_WINE_INZOLIA="WINE > WHITE WINE > INZOLIA",t.WHITE_WINE_MALVASIA="WINE > WHITE WINE > MALVASIA",t.WHITE_WINE_MELON_DE_BOURGOGNE="WINE > WHITE WINE > MELON DE BOURGOGNE",t.WHITE_WINE_MOSCATO_BIANCO="WINE > WHITE WINE > MOSCATO BIANCO",t.WHITE_WINE_MOSCHOFILERO_FILERI="WINE > WHITE WINE > MOSCHOFILERO/FILERI",t.WHITE_WINE_MULLER_THURGAU_RIVANER="WINE > WHITE WINE > MULLER-THURGAU/RIVANER",t.WHITE_WINE_MUSCAT_MOSCATO="WINE > WHITE WINE > MUSCAT/MOSCATO",t.WHITE_WINE_PECORINO="WINE > WHITE WINE > PECORINO",t.WHITE_WINE_PICPOUL="WINE > WHITE WINE > PICPOUL",t.WHITE_WINE_PINOT_BLANC="WINE > WHITE WINE > PINOT BLANC",t.WHITE_WINE_PINOT_GRIGIO_PINOT_GRIS="WINE > WHITE WINE > PINOT GRIGIO/PINOT GRIS",t.WHITE_WINE_POUILLY_FUISSE="WINE > WHITE WINE > POUILLY-FUISSE",t.WHITE_WINE_POUILLY_FUME="WINE > WHITE WINE > POUILLY-FUME",t.WHITE_WINE_RIESLING="WINE > WHITE WINE > RIESLING",t.WHITE_WINE_RIOJA="WINE > WHITE WINE > RIOJA",t.WHITE_WINE_RODITIS="WINE > WHITE WINE > RODITIS",t.WHITE_WINE_SANCERRE="WINE > WHITE WINE > SANCERRE",t.WHITE_WINE_SAUVIGNON_BLANC="WINE > WHITE WINE > SAUVIGNON BLANC",t.WHITE_WINE_SEMILLON="WINE > WHITE WINE > SEMILLON",t.WHITE_WINE_SOAVE="WINE > WHITE WINE > SOAVE",t.WHITE_WINE_SYLVANER="WINE > WHITE WINE > SYLVANER",t.WHITE_WINE_TORRONTES="WINE > WHITE WINE > TORRONTES",t.WHITE_WINE_TREBBIANO_UGNI_BLANC="WINE > WHITE WINE > TREBBIANO/UGNI BLANC",t.WHITE_WINE_TURBIANA="WINE > WHITE WINE > TURBIANA",t.WHITE_WINE_TXAKOLINA="WINE > WHITE WINE > TXAKOLINA",t.WHITE_WINE_VERDEJO="WINE > WHITE WINE > VERDEJO",t.WHITE_WINE_VERDICCHIO="WINE > WHITE WINE > VERDICCHIO",t.WHITE_WINE_VERMENTINO="WINE > WHITE WINE > VERMENTINO",t.WHITE_WINE_VERNACCIA="WINE > WHITE WINE > VERNACCIA",t.WHITE_WINE_VIDIANO="WINE > WHITE WINE > VIDIANO",t.WHITE_WINE_VINHO_VERDE="WINE > WHITE WINE > VINHO VERDE",t.WHITE_WINE_VIOGNIER="WINE > WHITE WINE > VIOGNIER",t.WHITE_WINE_VIURA="WINE > WHITE WINE > VIURA",t.WHITE_WINE_OTHER="WINE > WHITE WINE > OTHER",t.WINE_OTHER="WINE > OTHER"}(u||(u={})),function(t){t.BRANDS="brands",t.FLAVOR="flavor",t.FULFILLMENT="fulfillment",t.TAGS="tags",t.REGION="region",t.VARIETY="variety",t.ENGRAVING="engraving",t.PRICE="price",t.PRESALE="presale",t.AVAILABILITY="availability",t.CATEGORIES="categories",t.SIZES="sizes",t.COLORS="colors",t.APPELLATION="appellation",t.COUNTRY="country",t.VINTAGE="vintage",t.MATERIALS="materials",t.COLLECTION_TAGS="collectionTags"}(m||(m={})),function(t){t.UNSPECIFIED="AVAILABILITY_UNSPECIFIED",t.IN_STOCK="IN_STOCK",t.OUT_OF_STOCK="OUT_OF_STOCK",t.PREORDER="PREORDER",t.BACKORDER="BACKORDER"}(g||(g={})),function(t){t.YES="YES",t.NO="NO"}(v||(v={}));const y={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},b={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"},x={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},w={DRAWER:"drawer",INPUT:"input",BIRTHDATE_INPUT:"birthdate-input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},C={ON_DEMAND:"onDemand",SHIPPING:"shipping"},k={NONE:"none",CONSOLE:"console",PANEL:"panel"},S={[y.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[y.STAGING]:"https://staging-elements.liquidcommerce.us",[y.PRODUCTION]:"https://elements.liquidcommerce.us"},I={STANDARD:"standard"},A={PERSONALIZATION:"personalization",PRE_ORDER:"pre-order",DELIVERY_OPTIONS:"delivery-options",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},P={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 s=new SingletonManager.clientConstructor(t);return await s.prepare(),o.set(i,s),s}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const _="lce",N={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},R={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:C.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},O={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:[]},L={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:[]},M={drawer:{isOpen:![],contentConfig:null}},B={products:{},cart:O,address:N,checkout:L,ui:M};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})}isDevelopment(){return this.get("env")===y.DEVELOPMENT}isStaging(){return this.get("env")===y.STAGING}isProduction(){return this.get("env")===y.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const t=this.get("debugMode");return t===k.CONSOLE||t===k.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===k.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===k.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}getProxyConfig(){return this.get("proxy")}validateInputs(t,n){if(!(null==t?void 0:t.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(n.env&&!Object.values(y).includes(n.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+n.env+'". Using default environment.'),n.env=void 0),void 0!==n.isBuilder&&"boolean"!=typeof n.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),n.isBuilder=void 0),void 0===n.debugMode||Object.values(k).includes(n.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+n.debugMode+'". Must be one of: '+Object.values(k).join(", ")+". Using default value."),n.debugMode=void 0),n.promoTicker&&"object"!=typeof n.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),n.promoTicker=void 0),n.promoTicker)if(Array.isArray(n.promoTicker)){const t=n.promoTicker.filter((t,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."),![])});n.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),n.promoTicker=void 0;n.proxy&&("object"!=typeof n.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),n.proxy=void 0):n.proxy.baseUrl&&"string"==typeof n.proxy.baseUrl?n.proxy.headers&&"object"!=typeof n.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),n.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),n.proxy=void 0))}buildConfiguration(t,n){var i,o,s,a;const d=n.env||y.PRODUCTION;let u=S[d];const m=d===y.PRODUCTION,g=n.isBuilder||![],v=_+(m?"":"_"+d)+(g?"builder":"");return(null===(i=n.development)||void 0===i?void 0:i.customApiUrl)&&(u=n.development.customApiUrl),{apiKey:t.trim(),env:d,isBuilder:g,debugMode:n.debugMode||k.NONE,baseUrl:u,partnerCode:void 0,partnerName:void 0,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:v,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null,paymentMethodId:(null===(o=n.development)||void 0===o?void 0:o.paymentMethodId)||void 0,openShadowDom:m?![]:(null===(s=n.development)||void 0===s?void 0:s.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(a=n.development)||void 0===a?void 0:a.customApiUrl)}}detectDeviceType(){var t,n;if("undefined"==typeof navigator)return"desktop";const i=navigator.userAgent.toLowerCase(),o="ontouchstart"in window||navigator.maxTouchPoints>0,s=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,a=(null===(n=window.screen)||void 0===n?void 0:n.height)||0,d=Math.max(s,a),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/],m=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return u.some(t=>t.test(i))?"tablet":m.some(t=>t.test(i))||o&&d<768?"mobile":o&&d>=768&&d<=1200||o&&/macintosh/i.test(i)&&navigator.maxTouchPoints>1||/android/i.test(i)&&o&&d>=768||/windows nt/i.test(i)&&o&&d>=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,s=!i&&n?n:void 0;if(this.sendToTelemetry("error",t,o,s),!this.enableLogging)return;const[a,...d]=this.getPrefix("error");void 0!==n?console.error(a,...d,t,n):console.error(a,...d,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(s){}}}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"}),s=document.createElement("style");s.textContent='\n div {\n padding: 10px;\n background-color: #1d4ed81a;\n border-radius: 6px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: #d63031;\n line-height: 1.4;\n margin-bottom: 5px;\n }\n\n p {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n color: #18181B;\n line-height: 1.5;\n max-width: 350px;\n }\n ';const a=document.createElement("div"),d=document.createElement("h3");d.textContent="Component </"+t+">";const u=document.createElement("p");return u.textContent=n,a.appendChild(s),a.appendChild(d),a.appendChild(u),o.appendChild(a),i}function productionComponentError({title:t,message:n,componentType:i}){const o=document.createElement("div");o.setAttribute("data-component-type",i);const s=o.attachShadow({mode:"closed"}),a=document.createElement("style");a.textContent="\n div {\n padding: 20px;\n background-color: #1d4ed81a;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: Poppins, sans-serif;\n max-width: 512px;\n display: block;\n }\n\n h2 {\n color: #18181B;\n margin: 0 0 8px 0;\n font-size: 18px;\n font-style: normal;\n font-weight: 600;\n line-height: 18px;\n text-transform: lowercase;\n }\n\n h2::first-letter {\n text-transform: uppercase;\n }\n\n p {\n color: #18181B;\n font-size: 14px;\n font-style: italic;\n font-weight: 400;\n line-height: 20px;\n margin: 0;\n }\n ";const d=document.createElement("div"),u=document.createElement("h2");u.textContent=t;const m=document.createElement("p");return m.textContent=n,d.appendChild(a),d.appendChild(u),d.appendChild(m),s.appendChild(d),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 o=document.createElement(i);if(o.initialize){const{type:n,useShadowDom:s,wrapInLceElement:a,...d}=t,u={type:n,tagName:i,useShadowDom:s&&a!==!![]};o.initialize({data:d,config:u})}if(t.wrapInLceElement){const n=ComponentFactoryService.getComponentRegistry().get(w.LCE_ELEMENT),i=ComponentFactoryService.getComponentTagName(w.LCE_ELEMENT);window.customElements.get(i)||window.customElements.define(i,n);const s=document.createElement(i);return s.initialize(t.type,o),s}return o}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={[w.DRAWER]:"drawer-lc",[w.INPUT]:"input-lc",[w.BIRTHDATE_INPUT]:"birthdate-input-lc",[w.ENGRAVING_FORM]:"engraving-form-lc",[w.ENGRAVING_VIEW]:"engraving-view-lc",[w.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[w.POWERED_BY]:"powered-by-lc",[w.LCE_ELEMENT]:"lce-element",[w.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[w.ALERT]:"alert-lc",[w.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[w.ADDRESS]:"address-lc",[w.ADDRESS_INPUT]:"address-input-lc",[w.ADDRESS_DISPLAY]:"address-display-lc",[w.PRODUCT]:"product-lc",[w.PRODUCT_OPTIONS]:"product-options-lc",[w.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[w.PRODUCT_INTERACTIONS]:"product-interactions-lc",[w.PRODUCT_DESCRIPTION]:"product-description-lc",[w.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[w.PRODUCT_RETAILERS]:"product-retailers-lc",[w.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[w.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[w.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[w.PRODUCT_PRICE]:"product-price-lc",[w.PRODUCT_DRAWER]:"product-drawer-lc",[w.PRODUCT_LOADING]:"product-loading-lc",[w.PRODUCT_LIST]:"product-list-lc",[w.PRODUCT_LIST_CARD]:"product-list-card-lc",[w.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[w.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[w.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[w.CART]:"cart-lc",[w.CART_RETAILER]:"cart-retailer-lc",[w.CART_ITEM]:"cart-item-lc",[w.CART_FOOTER]:"cart-footer-lc",[w.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[w.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[w.CART_PROMO_CODE]:"cart-promo-code-lc",[w.CART_HEADER]:"cart-header-lc",[w.CART_BODY]:"cart-body-lc",[w.CART_FULFILLMENT]:"cart-fulfillment-lc",[w.CHECKOUT]:"checkout-lc",[w.CHECKOUT_INFORMATION]:"checkout-information-lc",[w.CHECKOUT_PAYMENT]:"checkout-payment-lc",[w.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[w.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[w.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[w.CHECKOUT_BILLING]:"checkout-billing-lc",[w.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[w.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[w.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[w.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[w.CHECKOUT_ITEMS]:"checkout-items-lc",[w.CHECKOUT_COMPLETED]:"checkout-completed-lc",[w.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[w.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[w.CHECKOUT_BUYER]:"checkout-buyer-lc",[w.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[w.CHECKOUT_TIPS]:"checkout-tips-lc",[w.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[w.CHECKOUT_ITEM]:"checkout-item-lc",[w.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[w.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[w.CHECKOUT_HEADER]:"checkout-header-lc",[w.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[w.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[w.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 s=o.split("_")[0];["product","cart","address","checkout"].includes(s)||(s="other");const a=Date.now(),d={eventId:"evt_"+a+"_"+Math.random().toString(36).slice(2,9),namespace:i,event:o,originalEvent:t,actionNamespace:"actions"===i?s:void 0,timestamp:a},u={data:n,metadata:d};this.dispatchNativeEvents(t,u)}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 s=new CustomEvent(this.eventPrefix+":"+i,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(s)}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,s)=>{if(i!==n)return t.call(window,i,o,s);if(!this.clientReadyEvent)return t.call(window,i,o,s);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(a){this.logger.error("Error replaying CLIENT_READY event",a)}return t.call(window,i,o,s)}}}function centToDollar(t){return t/100}function formatCentToDollarText(t,n=!![]){const i=Math.floor(t/100),o=t%100;let s="$"+i.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(n||o>0)&&(s+=".",s+=o<10?"0"+o:o.toString()),s}function htmlStringToElement(t){const n=document.createElement("template");return n.innerHTML=t.trim(),n.content.firstElementChild}function format24TimeTo12(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 s=i>=12?"PM":"AM",a=i%12||12;return a+":"+o.toString().padStart(2,"0")+" "+s}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"),s=n.getFullYear().toString();return i+"/"+o+"/"+s}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{const t=await this.client.get("/configs");return t.data}catch(t){throw this.logger.error("Error fetching configs",t),new SDKError("Failed to fetch all configs: "+(null==t?void 0:t.message))}}async setPersistedStore(t,n){try{if(!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;await this.client.post("/configs/store/"+t,{body:n})}catch(i){this.logger.error("Error setting persisted store",i)}}async getPersistedStore(t){try{if(!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 n.data}catch(n){return this.logger.error("Error fetching persisted store",n),null}}async deletePersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+t+"/delete")}catch(n){this.logger.error("Error deleting persisted store",n)}}async getAddressSuggestions(t){try{if(!t||0===t.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const n=await this.client.post("/address/autocomplete",{body:{input:t}});return n.data}catch(n){return this.logger.error("Error fetching address suggestions",n),[]}}async getAddressDetails(t){try{if(!t||0===t.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const n=await this.client.post("/address/details",{body:{id:t}});return n.data}catch(n){throw this.logger.error("Error fetching address details",n),new SDKError("Failed to fetch address details: "+(null==n?void 0:n.message))}}async getProductsData(t,n){try{if(0===t.length)return this.logger.error("No product identifiers provided"),null;const i={identifiers:t,location:n},o=await this.client.post("/product/availability",{body:i});return o.data}catch(i){return this.logger.error("Error fetching product data",i),null}}async catalogSearch(t){var n;try{const n=await this.client.post("/product/search",{body:t});return n.data}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}}}async getCartData(t){try{const n=await this.client.post("/cart/get",{body:{id:t}});return n.data}catch(n){throw this.logger.error("Error fetching cart data",n),new SDKError("Failed to fetch cart data: "+n.message)}}async updateCart(t){try{const n=await this.client.post("/cart/update",{body:t});return n.data}catch(n){throw this.logger.error("Error updating cart",n),new SDKError("Failed to update cart: "+(null==n?void 0:n.message))}}async prepareCheckout(t){var n;try{const n=await this.client.post("/checkout/prepare",{body:t});return n.data}catch(i){throw this.logger.error("Error fetching prepare checkout data:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),new SDKError("Failed to fetch prepare checkout data: "+(null==i?void 0:i.message))}}async getPaymentSession(t){var n;try{const n=await this.client.post("/checkout/payment/session",{body:t});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),new SDKError("Failed to get payment session: "+(null==i?void 0:i.message))}}async confirmPaymentSession(t,n){try{const i=await this.client.post("/checkout/payment/confirm",{body:{confirmationTokenId:t,setupIntentId:n}});return i.data}catch(i){throw this.logger.error("Error confirming payment session",i),new SDKError("Failed to confirm payment session: "+(null==i?void 0:i.message))}}async checkoutComplete(t){var n;try{const n=await this.client.post("/checkout/complete",{body:t});return n.data}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("Failed to complete checkout: "+(null==i?void 0:i.message));throw i}}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(t,n)=>t||n&&n.status>=500&&n.status<600?!![]:![],this.xhrFetch=(t,n)=>new Promise((i,o)=>{const s=new XMLHttpRequest;s.open(n.method||"GET",t);for(const[t,a]of Object.entries(n.headers))s.setRequestHeader(t,a);s.onload=()=>{const t={ok:s.status>=200&&s.status<300,status:s.status,statusText:s.statusText,headers:s.getAllResponseHeaders().split("\r\n").reduce((t,n)=>{const[i,o]=n.split(": ");return i&&o&&(t[i]=o),t},{}),o:s.responseText,json:()=>Promise.resolve(JSON.parse(s.responseText)),text:()=>Promise.resolve(s.responseText)};i(t)},s.onerror=()=>{o(new TypeError("Network request failed"))},s.ontimeout=()=>{o(new TypeError("Network request timed out"))},s.timeout=3e4,s.send(n.body)}),this.fetchImpl=this.getFetchImplementation()}async request(t){var n,i,o;const{url:s,options:a,retryConfig:d}=t,u=null!==(n=null==d?void 0:d.maxRetries)&&void 0!==n?n:3,m=null!==(i=null==d?void 0:d.retryDelay)&&void 0!==i?i:1e3,g=null!==(o=null==d?void 0:d.shouldRetry)&&void 0!==o?o:this.defaultShouldRetry;let v;const y=Date.now();for(let x=0;x<=u;x++){let t=Date.now();try{t=Date.now();const n=await this.fetchImpl(s,a),i=Date.now()-t;if(n.ok)return n;if(await this.logFailedResponse(s,a,n,i,x,u),x<u&&g(null,n)){await this.delay(m*2**x);continue}return n}catch(b){const n=Date.now()-t;if(v=b,this.logNetworkError(s,a,b,n,x,u),x<u&&g(b,void 0)){await this.delay(m*2**x);continue}throw this.enhanceError(b,s,a,Date.now()-y)}}throw this.enhanceError(v,s,a,Date.now()-y)}async logFailedResponse(t,n,i,o,s,a){const d=s<a;let u,m;try{i.o||(i.o=await i.text());try{u=JSON.parse(i.o)}catch(g){u=i.o}}catch(v){u="[Unable to read response body]"}if(n.body)try{m=JSON.parse(n.body)}catch(y){m=n.body}this.logger.error("HTTP request failed",{method:n.method,url:t,status:i.status,statusText:i.statusText,duration:o+"ms",attempt:s+1+"/"+(a+1),willRetry:d,requestHeaders:this.sanitizeHeaders(n.headers),requestBody:m,responseHeaders:this.sanitizeHeaders(i.headers),responseBody:u})}logNetworkError(t,n,i,o,s,a){var d;const u=s<a;this.logger.error("Network request failed",{method:n.method,url:t,error:(null==i?void 0:i.message)||"Unknown error",errorType:(null===(d=null==i?void 0:i.constructor)||void 0===d?void 0:d.name)||typeof i,duration:o+"ms",attempt:s+1+"/"+(a+1),willRetry:u,possibleCauses:this.diagnosePossibleCauses(i)})}diagnosePossibleCauses(t){var n,i,o,s,a;const d=[];return((null===(n=null==t?void 0:t.message)||void 0===n?void 0:n.includes("timeout"))||(null===(i=null==t?void 0:t.message)||void 0===i?void 0:i.includes("timed out")))&&d.push("Request timeout - server took too long to respond"),((null===(o=null==t?void 0:t.message)||void 0===o?void 0:o.includes("Failed to fetch"))||(null===(s=null==t?void 0:t.message)||void 0===s?void 0:s.includes("Network request failed")))&&(d.push("Network connectivity issue"),d.push("CORS policy blocking the request"),d.push("Server is not responding"),d.push("Request was blocked by browser or firewall")),(null===(a=null==t?void 0:t.message)||void 0===a?void 0:a.includes("aborted"))&&d.push("Request was aborted"),0===d.length&&d.push("Unknown network error"),d}enhanceError(t,n,i,o){const s=new Error((null==t?void 0:t.message)||"Network request failed - no response from server");return s.url=n,s.method=i.method,s.totalDuration=o+"ms",s.isNetworkError=!![],s.originalError=t,s.possibleCauses=this.diagnosePossibleCauses(t),s}sanitizeHeaders(t){const n={...t},i=["authorization","x-liquid-api-key","cookie","set-cookie"];for(const o of Object.keys(n))i.includes(o.toLowerCase())&&(n[o]="[REDACTED]");return n}delay(t){return new Promise(n=>setTimeout(n,t))}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):window.fetch?this.fetchAdapter(window.fetch):this.xhrFetch}fetchAdapter(t){return async(n,i)=>{var o;const s=await t(n,i);let a;if("function"==typeof(null===(o=s.headers)||void 0===o?void 0:o.entries))a=Object.fromEntries(s.headers.entries());else{a={};for(const[t,n]of s.headers)a[t]=n}const d={ok:s.ok,status:s.status,statusText:s.statusText,headers:a,json:async()=>(d.o||(d.o=await s.text()),JSON.parse(d.o)),text:async()=>(d.o||(d.o=await s.text()),d.o)};return d}}}class AuthClientService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(t))}async authenticate(){var t,n;if(this.isAuthenticating)return await new Promise(t=>{const p=()=>{this.isAuthenticating?setTimeout(p,100):t(void 0)};p()}),!!this.accessToken;this.isAuthenticating=!![];try{const i=await this.request("/auth",{method:"GET"},!![]),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=![]){var o;i||this.accessToken&&!this.isTokenExpired()||await this.authenticate();const s=this.buildUrl(t),a={"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};i?a["X-Liquid-Api-Key"]=this.apiKey:a.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(a["X-Liquid-Api-Builder"]=!![]);const d={method:n.method,headers:a,body:n.body?JSON.stringify(n.body):void 0},l=(t,n)=>{if(t)return!![];if(!i&&n){const t=n.status;if(401===t||403===t)return this.logger.warn("Authorization error detected, will retry with new token"),this.accessToken=null,this.tokenExpiration=null,!![]}return n&&n.status>=500&&n.status<600?!![]:![]};let u,m;try{u=await this.httpClient.request({url:s,options:d,retryConfig:{maxRetries:2,retryDelay:1e3,shouldRetry:l}})}catch(v){throw this.logger.error("Request failed after all retries",{path:t,method:n.method,authType:i?"API Key":"Bearer Token",error:null==v?void 0:v.message,possibleCauses:null==v?void 0:v.possibleCauses}),{status:0,message:(null==v?void 0:v.message)||"Network error: Unable to connect to the API",url:s,method:n.method,isNetworkError:!![],originalError:v}}if(u.ok)try{return await u.json()}catch(y){const o=await u.text().catch(()=>"Success");return this.logger.error("Failed to parse successful response JSON",{path:t,method:n.method,status:u.status,authType:i?"API Key":"Bearer Token",responsePreview:o,error:null==y?void 0:y.message}),{message:o}}let g="";try{m=await u.json(),g=JSON.stringify(m)}catch(b){g=await u.text().catch(()=>"HTTP error status: "+u.status),m={message:g||"Unknown error"}}throw this.logger.error("API request failed",{path:t,method:n.method,authType:i?"API Key":"Bearer Token",status:u.status,statusText:u.statusText,message:null==m?void 0:m.message,requestId:null===(o=null==m?void 0:m.metadata)||void 0===o?void 0:o.requestId,responseBody:g}),{...m,status:u.status,message:(null==m?void 0:m.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})}}const W="@liquidcommerce/elements-sdk",q="LiquidCommerce Elements SDK",j="UNLICENSED",U="LiquidCommerce Team",G="2.6.0-beta.5",V="https://docs.liquidcommerce.co/elements-sdk",K={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},Q={url:"https://github.com/liquidcommerce/elements-sdk/issues"},X="./dist/index.esm.js",J="./umd/elements.js",$="./dist/types/index.d.ts",tt="pnpm@10.0.0",et={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},nt=["dist","umd","docs","README.md","LICENSE"],it={access:"public",registry:"https://registry.npmjs.org/"},ot="module",rt=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],st={build:"rollup -c","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build:dev",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},at=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],ct={"@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.2","@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.3","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},lt={node:">=22"},dt={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},ht={name:W,description:q,license:j,author:U,version:G,homepage:V,repository:K,bugs:Q,module:X,browser:J,types:$,packageManager:tt,exports:et,files:nt,publishConfig:it,type:ot,sideEffects:rt,scripts:st,keywords:at,devDependencies:ct,engines:lt,pnpm:dt};class GoogleTagManagerService{constructor(){this.enablePartnerGTM=![],this.enableLiquidCommerceGTM=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(t){const 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){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(t)?window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event)):![]}async loadGTMScript(t){try{if(this.isContainerInitialized(t))return{success:!![],usingExistingGTM:!![],message:"Container "+t+" already loaded"};if(this.isContainerLoaded(t)){const n=await this.waitForContainerInit(t,1e4);return n?{success:!![],usingExistingGTM:!![],message:"Container "+t+" initialized"}:this.checkFallbackGTM(t)}return await this.injectGTMScript(t),{success:!![],usingExistingGTM:![],message:"Container "+t+" loaded successfully"}}catch(n){return this.checkFallbackGTM(t)}}waitForContainerInit(t,n){return new Promise(i=>{let o;const s=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(s),clearTimeout(o),i(!![]))},100);o=setTimeout(()=>{clearInterval(s),i(![])},n)})}injectGTMScript(t){return new Promise((n,i)=>{const o=document.createElement("script");o.src="https://www.googletagmanager.com/gtm.js?id="+t,o.async=!![],o.crossOrigin="anonymous";let s=![];const a=setTimeout(()=>{s||(s=!![],this.isContainerInitialized(t)?n():i(new Error("GTM script timeout")))},15e3);o.onload=()=>{s||setTimeout(()=>{s||(s=!![],clearTimeout(a),this.isContainerInitialized(t)||window.dataLayer&&Array.isArray(window.dataLayer)?n():i(new Error("GTM script loaded but failed to initialize")))},500)},o.onerror=()=>{setTimeout(()=>{s||(s=!![],clearTimeout(a),this.isContainerLoaded(t)&&this.isContainerInitialized(t)?n():i(new Error("GTM script failed to load")))},100)},document.head.appendChild(o)})}checkFallbackGTM(t){if(this.isGTMAlreadyLoaded()&&window.dataLayer&&Array.isArray(window.dataLayer)){if(this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId))return{success:!![],usingExistingGTM:!![],message:"Using partner GTM container"};const t=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));if(t)return{success:!![],usingExistingGTM:!![],message:"Using existing GTM container"}}return window.dataLayer&&Array.isArray(window.dataLayer)?{success:!![],usingExistingGTM:!![],message:"Using basic dataLayer for event tracking"}:{success:![],usingExistingGTM:![],message:"Failed to load container "+t+" and no fallback available"}}processEventQueue(){const t=Date.now(),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)}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.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&t.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&t.push(this.partnerGTMId),t}async initialize(t){try{if(this.isInitialized)return Promise.resolve();if(this.isInitializing&&this.initializationPromise)return this.initializationPromise;if(0,this.clientConfigService.isBuilder())return;this.isInitializing=!![],this.initializationPromise=this.doInitialize(t),await this.initializationPromise}catch(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))return;if(!t.enableLiquidCommerceGTM&&!t.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerGTMId=t.partnerGTMId,this.liquidCommerceGTMId=t.liquidCommerceGTMId,this.enablePartnerGTM=t.enablePartnerGTM,this.enableLiquidCommerceGTM=t.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...t)=>window.dataLayer.push(t));const n=t.enableLiquidCommerceGTM?await this.loadGTMScript(t.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!n.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+n.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(n.message),this.processEventQueue()}executeEvent(t,n,i){try{if(this.clientConfigService.isBuilder())return;const o=this.getSendToTargets(),s={...i,...o.length>0&&{send_to:o},tenant_source:ht.description+" v"+ht.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:n,eventData:s,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const a={event:n,...s};window.dataLayer.push(a)}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 s=i(),a=performance.now()-o;return this.logger.info("🏪 Store "+t+" ✓ "+a.toFixed(3)+"ms",n),s}catch(s){const i=performance.now()-o;throw this.logger.error("🏪 Store "+t+" ✗ "+i.toFixed(3)+"ms",{payload:n,error:s}),s}},this.performanceMiddleware=({action:t,next:n})=>{const i=performance.now(),o=n(),s=performance.now()-i;return s>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+s.toFixed(2)+"ms"),o},this.state=B,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable: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 s=i.pop();for(const a of i){if(void 0===o[a])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];o=o[a]}if(Array.isArray(o))o=o.filter((t,n)=>n!==Number.parseInt(s,10));else{if("object"!=typeof o||null===o)return this.logger.warn('Cannot remove property "'+s+'" from non-object type at path "'+t+'".'),![];{const{[s]: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 s=t.map(t=>this.watch(t,(s,a)=>{i.push({path:t,value:s,oldValue:a}),clearTimeout(o),o=setTimeout(()=>{i.length>0&&(n([...i]),i.length=0)},0)}));return()=>{for(const t of s)t()}}createProductInstance(t){const n="products."+t,i=this.get(n);return i?!![]:this.set(n,R)}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 Z=()=>{if(o>=this.middleware.length)return i();const s=this.middleware[o++];return s({action:t,payload:n,state:this.getState(),next:Z})};return Z()}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[s,...a]=o,d=t[s],u=Array.isArray(d)?[]:{};if(Array.isArray(t)){const n=[...t];return n[s]=this.immutableSet(d||u,a.join("."),i),n}return{...t,[s]:this.immutableSet(d||u,a.join("."),i)}}notifyListeners(t,n,i){const o=this.listeners.get(t);if(o)for(const u of o)try{u(n,i)}catch(a){this.logger.error('Error in store listener for path "'+t+'"',a)}const s=t.split(".");for(let u=s.length-1;u>0;u--){const t=s.slice(0,u).join("."),n=this.listeners.get(t);if(n){const o=this.get(t),a=s.slice(u).join("."),m=this.immutableSet(o,a,i);for(const i of n)try{i(o,m)}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")||"",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(ht){this.logger.error("Failed to clear localStorage entry",ht)}}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 N;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:{latitude:n.coordinates.latitude,longitude:n.coordinates.longitude}}:{...N,id:t}}catch(n){return{...N,id:t}}}}const ut=[w.PRODUCT,w.PRODUCT_IMAGE_CAROUSEL,w.PRODUCT_OPTIONS,w.PRODUCT_INTERACTIONS,w.PRODUCT_DESCRIPTION,w.PRODUCT_RETAILERS,w.PRODUCT_RETAILERS_CAROUSEL,w.PRODUCT_RETAILERS_POPUP,w.PRODUCT_RETAILERS_POPUP_LIST,w.PRODUCT_PRICE,w.PRODUCT_ADD_TO_CART_SECTION,w.PRODUCT_DRAWER,w.PRODUCT_LOADING,w.ENGRAVING_FORM,w.ENGRAVING_VIEW,w.PRODUCT_LIST,w.PRODUCT_LIST_CARD,w.PRODUCT_LIST_CARD_LOADING,w.PRODUCT_LIST_FILTERS],pt=[w.ADDRESS_INPUT,w.ADDRESS_DISPLAY],mt=[w.CART,w.CART_RETAILER,w.CART_ITEM,w.CART_FOOTER,w.CART_ITEM_QUANTITY_PRICE,w.CART_RETAILER_SUBTOTAL,w.CART_PROMO_CODE,w.CART_HEADER,w.CART_BODY,w.CART_FULFILLMENT,w.BUTTONS_CART_OPEN],ft=[w.CHECKOUT,w.CHECKOUT_INFORMATION,w.CHECKOUT_STRIPE_HANDLER,w.CHECKOUT_STRIPE_FORM,w.CHECKOUT_PAYMENT,w.CHECKOUT_BILLING,w.CHECKOUT_ORDER_SUMMARY,w.CHECKOUT_PROMO_CODE,w.CHECKOUT_GIFT_CARDS,w.CHECKOUT_AMOUNTS,w.CHECKOUT_ITEMS,w.CHECKOUT_COMPLETED,w.CHECKOUT_DELIVER_TO,w.CHECKOUT_DELIVER_TO_SUMMARY,w.CHECKOUT_BUYER,w.CHECKOUT_TIPS,w.CHECKOUT_PC_GC,w.CHECKOUT_ITEM,w.CHECKOUT_ITEM_QUANTITY,w.CHECKOUT_PLACE_ORDER_BUTTON,w.CHECKOUT_HEADER,w.CHECKOUT_PRESALE_COUNTDOWN,w.CHECKOUT_PRESALE_EXPIRED,w.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("&"),s="display="+n;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+o+"&"+s,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 align-items: center;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-search__control-container {\n max-width: 500px;\n width: 100%;\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-icon:hover svg {\n cursor: pointer;\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n }\n\n /* Filters in Drawer */\n .product-list-filters-drawer-content {\n padding: 20px;\n overflow-y: auto;\n max-height: 100%;\n }\n\n .product-list-filters-drawer-content .product-list-filters-container {\n position: static;\n width: 100%;\n top: 0;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n /* Filters Container */\n .product-list-filters-container {\n width: 20%;\n height: fit-content;\n position: sticky;\n top: 24px;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 24px 24px;\n position: static;\n height: 100%;\n overflow-y: auto;\n padding-bottom: 80px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #e5e7eb);\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .product-list-filters-personalized > *:not(:last-child),\n .product-list-filters-pre-order > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-personalized-label,\n .product-list-filters-pre-order-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-delivery-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-delivery-options-header:hover .product-list-filters-delivery-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-personalized:hover .product-list-filters-personalized-label, \n .product-list-filters-pre-order:hover .product-list-filters-pre-order-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n }\n\n .product-list-filters-delivery-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-delivery-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-delivery-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-delivery-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-delivery-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-delivery-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-delivery-option {\n display: flex;\n align-items: center;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n \n .product-list-filters-delivery-option > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-delivery-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-delivery-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-delivery-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:focus,\n .product-list-filters-delivery-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-delivery-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-delivery-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:disabled + .product-list-filters-delivery-radio-label {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+P.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.18s ease-out;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Inputs */\n .product-list-filters-delivery-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n /* Price Range Slider */\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n /* Range Slider */\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--default-text-color, #111827);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n /* Text Inputs Container */\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n /* Checkbox Filter Header */\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-toggle-icon.collapsed {\n transform: rotate(0deg);\n }\n\n .checkbox-filter-toggle-icon.expanded {\n transform: rotate(0deg);\n }\n\n /* Checkbox Filter Content */\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n /* Search Input */\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n /* Checkbox List */\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n /* Custom Scrollbar */\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n /* Checkbox Items */\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 12px 24px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n /* No Results */\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n cursor: pointer;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Product List Card Styles */\n .product-list-card.standard {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #f3f4f6);\n border-radius: var(--card-border-radius, 0.375rem);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.fill {\n background-color: #ffffff;\n }\n\n .product-list-card.standard.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card.standard.not-available:hover {\n cursor: not-allowed;\n }\n\n .product-list-card.standard .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n padding-bottom: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .product-list-card.standard .plc__content {\n width: 100%;\n padding: 0 10px;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .product-list-card.standard .plc__content .plc__title {\n width: 100%;\n height: 4.6875rem;\n font-size: 1.125rem;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n margin-bottom: 10px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n line-height: 1.38;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n .product-list-card.standard .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__image-link:hover {\n text-decoration: none;\n }\n\n .product-list-card.standard .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .product-list-card.standard .plc__title-link .plc__title {\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n font-family: var(--paragraph-font-family, Poppins);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 1rem;\n font-weight: 600;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: auto;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n padding: 0.5rem 0.375rem;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #3b82f6);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n .product-list-sentinel-container > *:not(:last-child) {\n margin-top: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-error-container > *:not(:last-child) {\n margin-top: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Responsive Styles */\n\n /* Mobile and Tablet - Below 1024px */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n /* Hide filters in main product list on mobile */\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n /* Show filters in drawer on mobile */\n .product-list-filters-drawer-wrapper .product-list-filters-container {\n display: block;\n position: static;\n width: 100%;\n padding: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n /* Mobile - 1 column (up to 639px) */\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card.standard {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n /* Small tablets - 2 columns (640px to 767px) */\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card.standard {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n /* Tablets - 3 columns (768px to 1023px) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card.standard {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n /* Desktop - Use configured columns (1024px and up) */\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card.standard {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+P.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: "+P.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: "+P.ADDRESS_ACTIONS+";\n }\n\n .address-input-container .action-buttons > button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n transition: all 0.2s ease;\n width: 50%;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .address-input-container .action-buttons > button:not(:first-child) {\n margin-left: 8px;\n }\n\n .address-input-container .action-buttons .secondary-button {\n color: var(--default-text-color, #18181B);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .action-buttons .primary-button {\n color: var(--selected-text-color, #18181B);\n background-color: var(--primary-color, #E4E4E7);\n border: 1px solid transparent;\n }\n\n .privacy-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\n color: var(--default-text-color, #18181B);\n text-align: left;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .address-input-container .suggestion-item > span {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .address-display-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .address-display-container > span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .address-display-container > button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n text-align: left;\n }\n",getCartStyles=()=>"\n .cart-container {\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .cart-container.no-header .cart-body {\n padding: 0 0 16px 0;\n }\n\n .cart-container.no-header .cart-footer {\n padding: 16px 0 0 0;\n }\n\n .cart-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n position: sticky;\n top: 0;\n background-color: var(--drawer-background-color, #FFFFFF);\n z-index: "+P.CART_HEADER+";\n }\n\n .cart-header-content {\n width: 100%;\n height: 48px;\n display: flex;\n align-items: center;\n align-self: stretch;\n justify-content: space-between;\n padding: 16px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .cart-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-header-close-btn {\n font-size: 1.4rem;\n font-weight: 300;\n border: none;\n background: none;\n }\n\n .cart-header-close-btn:hover {\n cursor: pointer;\n }\n\n .cart-body {\n position: relative;\n flex: 1;\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-self: stretch;\n }\n\n .cart-body > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .empty-cart-container {\n display: flex;\n align-self: center;\n margin: auto;\n }\n\n .retailer-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .section-header-label {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n }\n\n .cart-fulfillment-subtotal {\n color: var(--default-text-color, #18181B);\n }\n\n .section-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-retailer-header {\n display: flex;\n flex-direction: column;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-info {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .retailer-body-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n flex-direction: column;\n max-height: 2000px;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .retailer-subtotal-container {\n display: flex;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailer-subtotal-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-subtotal-amount {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-fulfillment-container {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n max-height: 2000px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-fulfillment-container > .cart-item-container {\n margin-top: 16px;\n }\n\n .cart-item-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item-container > *:not(:first-child) {\n margin-top: 12px;\n }\n\n .cart-item {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .item-image {\n display: flex;\n width: 56px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .item-details {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-details > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .quantity-price {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .item-title {\n font-weight: 500;\n font-size: 0.95rem;\n word-break: break-word;\n margin: 0;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-specs {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-shipping-container {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .cart-add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .item-shipping {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-quantity {\n display: flex;\n width: 106px;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .quantity-btn-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-decrease {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease:disabled,\n .quantity-btn-increase:disabled,\n .quantity-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .quantity-value {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-quantity.outlined .quantity-value {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .item-price-container {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n align-content: center;\n flex: 1 0 0;\n flex-wrap: wrap;\n }\n\n .item-price-container > *:not(:first-child) {\n margin-left: 6px;\n }\n\n .item-price {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .item-price-per-unit {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .item-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n align-self: stretch;\n }\n\n .cart-footer {\n margin-top: auto;\n display: flex;\n min-height: 146px;\n padding: 16px;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n align-self: stretch;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n flex-shrink: 0;\n }\n\n .cart-footer > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .cart-footer-header {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n }\n\n .cart-footer-header > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .cart-footer-header .cart-footer-items-price {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n\n .cart-footer-header .subtotal-text {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .subtotal-price {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .taxes-fees-info {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n max-width: 85%;\n }\n\n .promo-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n width: 100%;\n border-radius: var(--button-border-radius, 6px);\n }\n\n .promo-input.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .promo-input.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .checkout-button {\n display: flex;\n position: relative;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border: none;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #F1F5F9);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+P.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: "+P.CART_LOADING+";\n }\n\n /* Modern browsers with backdrop-filter support */\n @supports (backdrop-filter: blur(1px)) {\n .cart-loading-backdrop {\n background-color: var(--drawer-background-color-30, #E4E4E7);\n backdrop-filter: blur(1px);\n }\n }\n\n .cart-loading-spinner-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .cart-loading-spinner {\n margin-bottom: 16px;\n }\n\n .cart-spinner {\n animation: cart-spinner-rotate 2s linear infinite;\n color: var(--primary-color, #1D4ED8);\n }\n\n .cart-spinner-path {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: 0;\n stroke-linecap: round;\n animation: cart-spinner-dash 1.5s ease-in-out infinite;\n }\n\n @keyframes cart-spinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n @keyframes cart-spinner-dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n }\n\n /*PROMO CODE */\n .promo-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-self: stretch;\n flex: 1;\n }\n\n .promo-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .promo-container-wrapper {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-code-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-input-wrapper {\n flex: 1;\n }\n\n /* Style the InputComponent container */\n .promo-input-wrapper .custom-input {\n margin: 0;\n width: 100%;\n }\n\n /* Hide label in promo context since we have placeholder */\n .promo-input-wrapper .custom-input label {\n display: none;\n }\n\n /* Style the actual input inside the InputComponent */\n .promo-input-wrapper .promo-input {\n width: 100%;\n padding: 12px 16px;\n border: 1px solid #ddd;\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n box-sizing: border-box;\n }\n\n .promo-input-wrapper .promo-input:focus {\n outline: none;\n border-color: var(--primary-color, #1D4ED8);\n }\n\n .promo-input-wrapper .promo-input:disabled {\n background-color: #f8f9fa;\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n .promo-input-wrapper .promo-input.input-error {\n border-color: #dc3545; }\n\n /* Error container styling from InputComponent */\n .promo-input-wrapper .error-container {\n margin-top: 4px;\n min-height: 20px;\n }\n\n .promo-input-wrapper .error-message {\n color: #dc3545;\n font-size: 12px;\n margin: 2px 0;\n display: block;\n }\n\n /* Apply button styling */\n .apply-button {\n display: flex;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .apply-button:hover:not(:disabled) {\n opacity: 0.9;\n }\n\n .apply-button:disabled {\n cursor: not-allowed;\n opacity: 0.7;\n }\n\n /* Applied promo code display - matches the design */\n .promo-applied-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n align-items: center;\n flex: 1;\n }\n\n .promo-code-pill {\n display: flex;\n height: var(--height-h-9, 36px);\n padding: 4px 12px;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px\n }\n\n .promo-remove-btn {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.2s ease;\n text-decoration: underline;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n }\n\n .error-banner {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px) 0 0 var(--card-border-radius, 6px);\n }\n\n .error-banner > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .close-btn {\n border: none;\n font-size: 16px;\n cursor: pointer;\n color: #fff;\n border-radius: 0 var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0;\n padding: 8px 16px;\n\n background: var(--error-color, #DC2626);\n }\n\n /* Mobile responsive */\n .promo-code-pill {\n align-self: flex-start;\n }\n\n .promo-remove-btn {\n align-self: flex-end;\n padding: 4px 8px;\n }\n }\n\n /* Optional: Add loading indicator styles if needed */\n .promo-input-wrapper.loading::after {\n content: '';\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+P.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: "+P.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .checkout-tips-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tips-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-tip-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-distribution-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-distribution-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-tips-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list.show {\n display: flex;\n }\n\n .checkout-tip-distribution-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-fulfillment-input-wrapper {\n display: flex;\n align-items: center;\n }\n\n .checkout-tip-fulfillment-input-wrapper > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-tip-remove-button {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .checkout-tip-distribution-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-sub-header {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-tip-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-tip-config-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-config-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-tip-selection-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-selection-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-tip-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-tip-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-tip-button > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-tip-input-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-input-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-sections-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-sections-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-pc-gc-sub-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-pc-gc-sub-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-pc-gc-applied {\n display: flex;\n width: 100%;\n flex-direction: row;\n align-self: stretch;\n display: flex;\n padding: 0px 12px;\n justify-content: space-between;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-pc-gc-applied span {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .checkout-pc-gc-applied button {\n display: flex;\n height: 36px;\n padding: 8px 0px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+P.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: "+P.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-align: center;\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child, .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+P.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: "+P.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--primary-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 8px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+P.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 500;\n }\n\n .engraving-view-container .engraving-body {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-view-container .engraving-lines {\n display: flex;\n min-width: 136px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .engraving-view-container .engraving-lines .engraving-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-transform: uppercase;\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-lines .engraving-line:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-actions {\n display: flex;\n align-items: center;\n }\n\n .engraving-view-container .engraving-actions .edit-button {\n margin-left: 16px;\n }\n\n .engraving-view-container .engraving-actions button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n',getImageCarouselStyle=()=>"\n .product-image-carousel {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 100%;\n height: auto;\n min-height: 350px;\n overflow: hidden;\n }\n\n .product-image-carousel.popup {\n max-height: 474px;\n }\n\n .product-image-carousel.carousel {\n max-height: 594px;\n }\n\n .main-image {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n border-radius: var(--card-border-radius, 6px);\n overflow: hidden;\n flex: 1;\n background-image: var(--bg-image, none);\n background-position: center center;\n background-size: contain;\n background-repeat: no-repeat;\n }\n\n .carousel-dots {\n position: absolute;\n bottom: 16px;\n left: 50%;\n transform: translateX(-50%);\n z-index: "+P.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n }\n\n .gallery-image {\n width: 60px;\n height: 60px;\n object-fit: cover;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n background: var(--accent-color, #3b82f6);\n opacity: 0.5;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n }\n\n .gallery-image-wrapper.selected .gallery-image {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+P.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .add-to-cart-container .add-to-cart-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .add-to-cart-container .add-to-cart-button.disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .product-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-title.hide {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .main-product-price {\n display: inline-block;\n width: fit-content;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 30px;\n font-style: normal;\n font-weight: 600;\n line-height: 36px;\n }\n\n .product-presale-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n text-align: left;\n }\n\n .product-description {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-description > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .product-description .title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .product-description .content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n align-self: stretch;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .product-description .content.collapsed {\n /* Modern browsers with line-clamp support */\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n\n /* Fallback for older browsers */\n max-height: 4.5em; /* 3 lines * 1.5 line-height */\n line-height: 1.5;\n word-wrap: break-word;\n\n /* Additional fallback properties */\n text-overflow: ellipsis;\n white-space: normal;\n }\n\n /* Fallback for browsers without line-clamp support */\n @supports not (-webkit-line-clamp: 3) {\n .product-description .content.collapsed {\n display: block;\n max-height: 4.5em;\n overflow: hidden;\n position: relative;\n }\n\n .product-description .content.collapsed::after {\n content: '...';\n position: absolute;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, transparent, var(--default-background-color, white) 50%);\n padding-left: 20px;\n }\n }\n\n .product-description .collapse-button {\n border-radius: var(--button-border-radius, 6px);\n cursor: pointer;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+P.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n max-height: 350px;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+P.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: "+P.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: "+P.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: "+P.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: "+P.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const gt={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",linkTextColor:"--link-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},vt={backgroundColor:"--product-background-color"},yt={backgroundColor:"--cart-background-color"},bt={backgroundColor:"--address-background-color"},xt={backgroundColor:"--checkout-background-color"},wt={global:gt,product:vt,cart:yt,address:bt,checkout:xt};function getCSSVariableMapping(t){return wt[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[s,a]of Object.entries(o)){const n=this.getValueByPath(t,s);void 0!==n&&this.isCSSValue(n)&&(i[a]=n,this.isColorVariable(a,n)&&this.generateOpacityVariants(i,a,n))}return i}extractVariablesFromPartialTheme(t,n){const i={},o=getCSSVariableMapping(n);for(const[s,a]of Object.entries(o))if(this.hasValueAtPath(t,s)){const n=this.getValueByPath(t,s);void 0!==n&&this.isCSSValue(n)&&(i[a]=n,this.isColorVariable(a,n)&&this.generateOpacityVariants(i,a,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 s of i){if(null==o||!(s in o))return![];o=o[s]}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 s=n+"-"+o.suffix,a=this.addOpacityToHexColor(i,o.value);a&&(t[s]=a)}}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),s=o.toString(16).padStart(2,"0");return"#"+i+s}}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),s=this.getStylesheetStyles(t).join("\n\n"),a=0===o.length?"":":host { "+o+" }",d=("\n "+a+"\n\n "+s+"\n ").trim();this.createStylesheet(t,d)}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(ht){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!==ut.indexOf(t)?this.getConfigs("product"):-1!==pt.indexOf(t)?this.getConfigs("address"):-1!==mt.indexOf(t)?this.getConfigs("cart"):-1!==ft.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const n=this.getBaseStylesheets();if(t===w.DRAWER){const t=[...n],i=this.stylesheetGenerator.getStylesheet("product"),o=this.stylesheetGenerator.getStylesheet("cart"),s=this.stylesheetGenerator.getStylesheet("checkout"),a=this.stylesheetGenerator.getStylesheet("address");return i&&t.push(i),o&&t.push(o),s&&t.push(s),a&&t.push(a),t}let i;if(pt.includes(t)||t===w.ADDRESS)i="address";else if(ut.includes(t)||t===w.PRODUCT)i="product";else if(mt.includes(t)||t===w.CART)i="cart";else{if(!ft.includes(t)&&t!==w.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),n;i="checkout"}const o=this.stylesheetGenerator.getStylesheet(i);return o?[...n,o]: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.longitude&&t.coordinates.latitude)return{coordinates: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))},Ct={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"},kt={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:Ct[t.type]||"error"})),transformCheckoutEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:kt[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:N,s={};for(const a in t.items||{}){const n=t.items[a];s[a]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,salsifyGrouping:n.salsifyGrouping,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price||0,quantity:n.quantity||0,maxQuantity:n.maxQuantity||0,unitPrice:n.unitPrice||0,mainImage:n.mainImage||"",attributes:n.attributes||{}}}return{id:t.id,promoCode:(null===(i=t.promoCode)||void 0===i?void 0:i.code)||"",items:s,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.latitude,longitude:o.coordinates.longitude}},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(s||{}).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,n=![]){var i,o,s,a,d,u;const m=this.store.get("cart");for(const v of Object.keys(m.items||{}))this.store.remove("cart.items."+v);for(const v of Object.keys(m.retailers||{}))this.store.remove("cart.retailers."+v);for(const v of Object.keys(m.fulfillments||{}))this.store.remove("cart.fulfillments."+v);const g={"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===(o=null===(i=t.attributes)||void 0===i?void 0:i.promoCode)||void 0===o?void 0:o.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 v of t.items)g["cart.items."+v.id]=buildCartItemStore(v);if((null===(a=t.retailers)||void 0===a?void 0:a.length)>0)for(const v of t.retailers)if(g["cart.retailers."+v.id]=buildRetailerStore(v),(null===(d=v.fulfillments)||void 0===d?void 0:d.length)>0)for(const t of v.fulfillments)g["cart.fulfillments."+t.id]=buildFulfillmentStore(t,v);if((null===(u=t.events)||void 0===u?void 0:u.length)>0&&(g["cart.events"]=transformEventsForCart(t.events||[])),this.store.batch(g),n){const t=this.store.get("cart"),n=this.store.get("address");this.pubSub.publishAction(b.CART_LOADED,cartDataForEventFromStore(t,n))}}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 n=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",n),this.pubSub.publishAction(b.CART_FAILED,{message:n}),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,n){const i={type:t,data:n||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:i}),t===w.CART&&this.pubSub.publishAction(b.CART_OPENED,!![]),t===w.CHECKOUT&&this.pubSub.publishAction(b.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===w.CART&&this.pubSub.publishAction(b.CART_CLOSED,!![]),(null==t?void 0:t.type)===w.CHECKOUT&&this.pubSub.publishAction(b.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 n,i,o,s,a,d,u,m,g,v,y,x;try{this.store.set("checkout.loading",!![]);const w=t||this.store.get("cart.id"),k=this.store.get("cart");if(0===(null===(n=Object.values(k.items||{}))||void 0===n?void 0:n.length)&&!t)return;const S=this.themeProvider.getConfigs("checkout"),I={canEmail:S.layout.emailOptIn.checked,canSms:S.layout.smsOptIn.checked};if(!w)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const A={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.presale":null,"checkout.updating":![]},P=await this.api.prepareCheckout({cartId:w,marketingPreferences:I});if((null===(i=P.retailers)||void 0===i?void 0:i.length)>0)for(const t of P.retailers)for(const n of t.fulfillments)n.type===C.ON_DEMAND&&(A["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal});if((null===(o=P.items)||void 0===o?void 0:o.length)>0){this.store.remove("checkout.items");for(const t of P.items){const n=P.retailers.find(n=>n.id===t.retailerId),i=n.fulfillments.find(n=>n.id===t.fulfillmentId);A["checkout.items."+t.cartItemId]=this.buildCheckoutItemStore(t,n,i)}}P.isPresaleLocked&&P.presaleExpiresAt&&(A["checkout.presale"]={isLocked:P.isPresaleLocked,expiresAt:P.presaleExpiresAt}),A["checkout.token"]=P.token,A["checkout.cartId"]=P.cartId,A["checkout.isGift"]=P.isGift,A["checkout.giftRecipientForm.data"]={firstName:((null===(a=null===(s=P.giftOptions)||void 0===s?void 0:s.recipient)||void 0===a?void 0:a.name)||"").split(" ")[0],lastName:((null===(u=null===(d=P.giftOptions)||void 0===d?void 0:d.recipient)||void 0===u?void 0:u.name)||"").split(" ")[1],email:(null===(g=null===(m=P.giftOptions)||void 0===m?void 0:m.recipient)||void 0===g?void 0:g.email)||"",phone:(null===(y=null===(v=P.giftOptions)||void 0===v?void 0:v.recipient)||void 0===y?void 0:y.phone)||"",message:(null===(x=P.giftOptions)||void 0===x?void 0:x.message)||""},A["checkout.paymentForm.billingSameAsShipping"]=P.billingSameAsShipping,A["checkout.marketingPreferences"]=P.marketingPreferences,A["checkout.giftCards"]=P.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),A["checkout.promoCode"]=P.promoCode.value?{code:P.promoCode.value,discountAmount:P.promoCode.discount}:null,A["checkout.amounts"]=P.amounts,A["checkout.events"]=P.events||[],this.store.batch(A),this.pubSub.publishAction(b.CHECKOUT_LOADED,{cartId:P.cartId})}catch(w){this.store.set("checkout.error",w.message),this.pubSub.publishAction(b.CHECKOUT_FAILED,{message:w.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const n=this.store.get("checkout.isGift"),i=null!=t?t:!n,o={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":i,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":o}),this.pubSub.publishAction(b.CHECKOUT_IS_GIFT_TOGGLED,{isActive:i})}async toggleBillingSameAsShipping(t){const n=this.store.get("checkout.paymentForm.billingSameAsShipping"),i=null!=t?t:!n;this.store.set("checkout.paymentForm.billingSameAsShipping",i),this.pubSub.publishAction(b.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:i})}async toggleMarketingPreferences(t,n){const i=this.store.get("checkout.marketingPreferences."+t),o=null!=n?n:!i,s=this.store.get("checkout.marketingPreferences"),a=this.dataForCheckoutPrepare({marketingPreferences:{...s,[t]:o}}),d=await this.api.prepareCheckout(a);this.store.set("checkout.marketingPreferences",d.marketingPreferences),this.pubSub.publishAction(b.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:t,isActive:o})}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,s,a;try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"2035"}};const d=await this.api.confirmPaymentSession(t,n);return d&&d.id&&d.card&&d.card.brand&&d.card.last4&&d.card.expMonth&&d.card.expYear?{id:d.id,card:{brand:null===(i=d.card)||void 0===i?void 0:i.brand,last4:null===(o=d.card)||void 0===o?void 0:o.last4.toString(),expMonth:null===(s=d.card)||void 0===s?void 0:s.expMonth.toString(),expYear:null===(a=d.card)||void 0===a?void 0:a.expYear.toString()}}:(this.store.set("checkout.error","Invalid payment method information received."),null)}catch(d){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){var n;try{this.googleTagManager.promoCodeAttempt(t);const i=this.dataForCheckoutPrepare({}),o=await this.api.prepareCheckout({...i,promoCode:t}),s=0!==o.amounts.discounts,a=null===(n=transformPromoCodeCheckoutEvents(o.events||[]))||void 0===n?void 0:n[0];if(!s)return this.store.set("checkout.promoCodeError",a?a.message:'Code "'+t+'" does not exist'),this.pubSub.publishAction(b.CHECKOUT_PROMO_CODE_FAILED,{error:(null==a?void 0:a.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==a?void 0:a.message)||"not_applied"),void 0;this.pubSub.publishAction(b.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:o.amounts.discounts,newTotal:o.amounts.total}),this.googleTagManager.promoCodeApplied(t,o.amounts.discounts),await this.partialLoadCheckout({response:o})}catch(i){const n=(null==i?void 0:i.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",n),this.pubSub.publishAction(b.CHECKOUT_PROMO_CODE_FAILED,{error:n}),this.googleTagManager.promoCodeFailed(t,n),i}}async removePromoCode(){var t,n;try{const i=this.dataForCheckoutPrepare({}),o=(null===(n=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===n?void 0:n.code)||"",s=await this.api.prepareCheckout({...i,promoCode:""});if(0!==s.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.pubSub.publishAction(b.CHECKOUT_PROMO_CODE_REMOVED,{newTotal:s.amounts.total}),this.googleTagManager.promoCodeApplied(o,0),await this.partialLoadCheckout({response:s})}catch(i){const t=(null==i?void 0:i.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const n=this.store.get("checkout.promoCode.code")||"";throw this.pubSub.publishAction(b.CHECKOUT_PROMO_CODE_FAILED,{error:t}),n&&this.googleTagManager.promoCodeFailed(n,t),i}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(ht){const n=ht.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",n),ht}}async applyGiftCard(t){var n;const i=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(i);const t=this.dataForCheckoutPrepare({}),o=t.giftCards||[],s=await this.api.prepareCheckout({...t,giftCards:[...o,i]}),a=null===(n=transformGiftCardCheckoutEvents(s.events||[]))||void 0===n?void 0:n[0],d=hasAnyRetailerGiftCardRestriction(s.events||[]);if(a&&(this.store.set("checkout.giftCardError",a.message),!d))return;const u=s.giftCards.find(t=>t.code.toLowerCase()===i.toLowerCase());if(!u)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.pubSub.publishAction(b.CHECKOUT_GIFT_CARD_FAILED,{error:(null==a?void 0:a.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(i,(null==a?void 0:a.message)||"not_applied"),void 0;this.pubSub.publishAction(b.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:s.amounts.total}),this.googleTagManager.giftCardApplied(i,u.applied),await this.partialLoadCheckout({response:s})}catch(o){const t=(null==o?void 0:o.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(b.CHECKOUT_GIFT_CARD_FAILED,{error:t}),this.googleTagManager.giftCardFailed(i,t),o}}async removeGiftCard(t){var n;const i=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),o=(null===(n=t.giftCards)||void 0===n?void 0:n.filter(t=>t.toLowerCase()!==i.toLowerCase()))||[],s=await this.api.prepareCheckout({...t,giftCards:o}),a=s.giftCards.find(t=>t.code.toLowerCase()===i.toLowerCase());if(a)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+i),void 0;this.pubSub.publishAction(b.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:s.amounts.total}),this.googleTagManager.giftCardApplied(i,0),await this.partialLoadCheckout({response:s})}catch(o){const t=(null==o?void 0:o.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(b.CHECKOUT_GIFT_CARD_FAILED,{error:t}),this.googleTagManager.giftCardFailed(i,t),o}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(ht){throw this.store.set("checkout.error",(null==ht?void 0:ht.message)||"Failed to clear gift card error. Please try again."),ht}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(w.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,n){var i,o,s;try{this.store.set("checkout.items."+t+".updating",!![]);const a=this.store.get("checkout.cartId"),d=this.store.get("checkout.items."+t);if(!d)throw new SDKError("Item not found");const u=d.quantity,m=d.quantity+n;if(m<1)return this.removeItem(t,!![]);const g={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:m},v=(null===(s=null===(o=null===(i=d.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];v.length>0&&(g.engravingLines=v);const y=await this.api.updateCart({id:a,items:[g],loc:this.getLocation()});this.pubSub.publishAction(n>0?b.CHECKOUT_ITEM_QUANTITY_INCREASE:b.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:d.cartItemId,quantity:m,previousQuantity:u});const x=splitCategoryPath(d.catPath),w={item_id:d.liquidId,item_name:d.name,item_brand:d.brand,item_size:d.size,item_category:x.category,item_category2:x.category2,item_category3:x.category3,quantity:Math.abs(n),price:centToDollar(d.unitPrice||0),upc:d.upc,grouping_id:d.salsifyGrouping,product_id:d.liquidId};n<0?this.googleTagManager.removeFromCart(w):n>0&&this.googleTagManager.addToCart(w),await this.partialLoadCheckout({cartResponse:y})}catch(a){throw this.store.set("checkout.items."+t+".error",a.message),a}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var n,i,o;try{const s=this.store.get("checkout.items."+t);if(!s)throw new SDKError("Item not found in checkout");if(!(null===(n=s.attributes)||void 0===n?void 0:n.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const a=(null===(o=null===(i=s.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],d={id:s.cartItemId,fulfillmentId:s.fulfillmentId,partNumber:s.partNumber,quantity:s.quantity,engravingLines:[]},u=this.store.get("checkout.cartId"),m=await this.api.updateCart({id:u,items:[d],loc:this.getLocation()});this.pubSub.publishAction(b.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:s.cartItemId,engravingLines:[],previousEngravingLines:a}),await this.partialLoadCheckout({cartResponse:m})}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,n){var i,o,s;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;n||this.store.set("checkout.items."+t+".updating",!![]);const a=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},m=(null===(s=null===(o=null===(i=d.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];m.length>0&&(u.engravingLines=m);const g=await this.api.updateCart({id:a,items:[u],loc:this.getLocation()});this.store.remove("checkout.items."+t),this.pubSub.publishAction(b.CHECKOUT_ITEM_REMOVED,{cartItemId:d.cartItemId}),await this.partialLoadCheckout({cartResponse:g})}catch(a){throw this.store.set("checkout.items."+t+".error",a.message),a}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const n=this.store.get("checkout.onDemandFulfillmentTipInfo"),i=Object.values(n||{}).map(n=>{const i=Math.round(n.subtotal*t/100);return{fulfillmentId:n.fulfillmentId,tip:i}}),o=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:i}));this.updateStoreFromCheckoutResponse(o),this.pubSub.publishAction(b.CHECKOUT_TIP_UPDATED,{deliveryTips:i})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to update tips. Please try again."),n}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,n){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.onDemandFulfillmentTipInfo"),o=Object.values(i||{}).map(i=>({fulfillmentId:i.fulfillmentId,tip:i.fulfillmentId===t?n:i.tip})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:o}));this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(b.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const n=this.store.get("checkout.onDemandFulfillmentTipInfo"),i=Object.values(n||{}).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===t?0:n.tip})),o=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:i}));this.updateStoreFromCheckoutResponse(o),this.pubSub.publishAction(b.CHECKOUT_TIP_UPDATED,{deliveryTips:i})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to remove fulfillment tip. Please try again."),n}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:t,deliveryInstructions:n,customerData:i}){var o,s,a,d,u,m,g,v,y;try{this.store.set("checkout.customerForm.isSaving",!![]);const x=this.store.get("checkout.customerForm.data"),w=this.store.get("checkout.isGift"),C=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:n||void 0,customer:{...x,...i},isGift:w}),k=await this.api.prepareCheckout(C),S={id:(null===(o=k.customer)||void 0===o?void 0:o.id)||"",firstName:(null===(s=k.customer)||void 0===s?void 0:s.firstName)||"",lastName:(null===(a=k.customer)||void 0===a?void 0:a.lastName)||"",email:(null===(d=k.customer)||void 0===d?void 0:d.email)||"",phone:(null===(u=k.customer)||void 0===u?void 0:u.phone)||"",birthDate:(null===(g=null===(m=k.customer)||void 0===m?void 0:m.birthDate)||void 0===g?void 0:g.slice(0,10))||"",company:(null===(v=k.customer)||void 0===v?void 0:v.company)||""};this.store.batch({"checkout.customerForm.data":S,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddressTwo":k.shippingAddress.two,"checkout.deliveryInstructions":n}),this.pubSub.publishAction(b.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,!![]);const I=this.store.get("checkout");this.googleTagManager.addShippingInfo([...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}})],(null===(y=I.promoCode)||void 0===y?void 0:y.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:n,...i}){var o,s,a,d,u,m;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const g=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:n||void 0,isGift:!![],giftRecipient:i}),v=await this.api.prepareCheckout(g),y={firstName:(null==i?void 0:i.firstName)||"",lastName:(null==i?void 0:i.lastName)||"",email:(null===(s=null===(o=v.giftOptions)||void 0===o?void 0:o.recipient)||void 0===s?void 0:s.email)||"",phone:(null===(d=null===(a=v.giftOptions)||void 0===a?void 0:a.recipient)||void 0===d?void 0:d.phone)||"",message:(null===(u=v.giftOptions)||void 0===u?void 0:u.message)||""};this.store.batch({"checkout.giftRecipientForm.data":y,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddressTwo":v.shippingAddress.two,"checkout.deliveryInstructions":n}),this.pubSub.publishAction(b.CHECKOUT_GIFT_INFORMATION_UPDATED,!![]);const x=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(x.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=x.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:n}){var i,o,s;try{this.store.set("checkout.paymentForm.isSaving",!![]);const a=this.store.get("checkout"),d={},u=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let m=null,g=null;if(u||n){const t=await this.confirmPaymentSession((null==n?void 0:n.confirmationTokenId)||"",(null==n?void 0:n.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");m=t.card,g=t.id}const v=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:g||void 0}),y=await this.api.prepareCheckout(v);y.payment&&m&&(d["checkout.paymentForm.paymentMethod"]={id:y.payment,card:m}),t&&y.billingAddress&&(d["checkout.paymentForm.data"]={firstName:y.billingAddress.firstName||"",lastName:y.billingAddress.lastName||"",email:y.billingAddress.email||"",phone:y.billingAddress.phone||"",company:y.billingAddress.company||"",addressOne:y.billingAddress.one||"",addressTwo:y.billingAddress.two||"",city:y.billingAddress.city||"",state:y.billingAddress.state||"",zipCode:y.billingAddress.zip||""},this.pubSub.publishAction(b.CHECKOUT_BILLING_INFORMATION_UPDATED,!![])),d["checkout.paymentForm.isEditing"]=![],d["checkout.paymentForm.isValid"]=!![],this.store.batch(d);const x=d["checkout.paymentForm.paymentMethod"]||(null===(i=a.paymentForm)||void 0===i?void 0:i.paymentMethod),w=(null===(o=null==x?void 0:x.card)||void 0===o?void 0:o.brand)?x.card.brand+" ****"+x.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(a.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}}),w,(null===(s=a.promoCode)||void 0===s?void 0:s.code)||void 0)}catch(a){throw this.logger.error("Failed to save payment form",a),this.store.set("checkout.error",a.message),a}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var t,n,i,o,s,a;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(b.CHECKOUT_SUBMIT_STARTED,{started:!![]});const d=this.store.get("checkout"),u=await this.api.checkoutComplete({token:d.token}),m=u.legacyOrderNumber||u.referenceId||"N/A";d.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(w.CHECKOUT_COMPLETED,{orderNumber:m,orderTotal:d.amounts.total,cardLast4:null===(i=null===(n=null===(t=null==d?void 0:d.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===n?void 0:n.card)||void 0===i?void 0:i.last4,customerEmail:d.customerForm.data.email,giftRecipientEmail:(null===(s=null===(o=null==d?void 0:d.giftRecipientForm)||void 0===o?void 0:o.data)||void 0===s?void 0:s.email)||null}),this.pubSub.publishAction(b.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:m,orderTotal:d.amounts.total}),this.googleTagManager.purchase({transaction_id:m,tax:centToDollar(d.amounts.tax||0),shipping:centToDollar(d.amounts.shipping||0),coupon:(null===(a=d.promoCode)||void 0===a?void 0:a.code)||void 0,items:[...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}})],value:centToDollar(d.amounts.total),subtotal:centToDollar(d.amounts.subtotal),total_before_discounts:centToDollar(d.amounts.subtotal+d.amounts.tax+d.amounts.shipping+d.amounts.delivery+d.amounts.platform+d.amounts.service),discounts:centToDollar(d.amounts.discounts),gift_cards:centToDollar(d.amounts.giftCards||0),net_total:centToDollar(d.amounts.total)})}catch(d){const t=(null==d?void 0:d.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(b.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===C.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 n,i,o,s,a;try{let d;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)d=t.response;else{const i=null!==(n=null==t?void 0:t.cartId)&&void 0!==n?n:this.store.get("checkout.cartId");if(!i)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const o=this.dataForCheckoutPrepare({});d=await this.api.prepareCheckout({...o,cartId:i})}const u={"checkout.token":d.token,"checkout.events":transformEventsForCheckout(d.events||[]),"checkout.amounts":d.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":d.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),"checkout.promoCode":(null===(o=null===(i=null==d?void 0:d.promoCode)||void 0===i?void 0:i.value)||void 0===o?void 0:o.trim())?{code:d.promoCode.value,discountAmount:d.promoCode.discount}:null};if((null===(s=d.retailers)||void 0===s?void 0:s.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const t of d.retailers)for(const n of t.fulfillments)n.type===C.ON_DEMAND&&(u["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal})}if((null===(a=d.items)||void 0===a?void 0:a.length)>0){this.store.remove("checkout.items");for(const t of d.items){const n=d.retailers.find(n=>n.id===t.retailerId),i=n.fulfillments.find(n=>n.id===t.fulfillmentId);u["checkout.items."+t.cartItemId]=this.buildCheckoutItemStore(t,n,i)}}this.store.batch(u)}catch(d){const t=(null==d?void 0:d.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(b.CHECKOUT_FAILED,{message:t}),d}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:n,billingData:i,marketingPreferences:o,shippingAddressTwo:s,deliveryInstructions:a,deliveryTips:d,paymentMethodId:u,isGift:m}){var g,v,y,b,x,w,C,k,S,I,A,P,_,N,R,O,L,M,B,W,q,j,U,G,V,K;const Q=this.store.get("checkout"),X=null!==(v=null===(g=Q.paymentForm)||void 0===g?void 0:g.billingSameAsShipping)&&void 0!==v?v:!![],J=void 0!==m?m:Q.isGift,$=n?!![]:null!==(b=null===(y=Q.giftRecipientForm)||void 0===y?void 0:y.isValid)&&void 0!==b?b:![],tt=J&&$,et={cartId:Q.cartId,acceptedAccountCreation:![],hasSubstitutionPolicy:![],hasAgeVerify:!![],shippingAddressTwo:s,billingSameAsShipping:X,marketingPreferences:o||Q.marketingPreferences,promoCode:(null===(x=Q.promoCode)||void 0===x?void 0:x.code)||void 0,isGift:tt,giftCards:(null===(w=null==Q?void 0:Q.giftCards)||void 0===w?void 0:w.map(t=>t.code))||[],deliveryTips:d||Object.values(Q.onDemandFulfillmentTipInfo||{}).map(t=>({fulfillmentId:t.fulfillmentId,tip:t.tip}))};u?et.payment=u:(null===(k=null===(C=Q.paymentForm)||void 0===C?void 0:C.paymentMethod)||void 0===k?void 0:k.id)&&(et.payment=Q.paymentForm.paymentMethod.id);const nt=a||Q.deliveryInstructions;if(nt&&(et.deliveryInstructions=Object.values(Q.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:nt}))),et.customer=t?{...t,id:(null==t?void 0:t.id)||void 0}:(null===(I=null===(S=null==Q?void 0:Q.customerForm)||void 0===S?void 0:S.data)||void 0===I?void 0:I.email)?{id:(null===(P=null===(A=Q.customerForm)||void 0===A?void 0:A.data)||void 0===P?void 0:P.id)||void 0,firstName:null===(N=null===(_=Q.customerForm)||void 0===_?void 0:_.data)||void 0===N?void 0:N.firstName,lastName:null===(O=null===(R=Q.customerForm)||void 0===R?void 0:R.data)||void 0===O?void 0:O.lastName,email:null===(M=null===(L=Q.customerForm)||void 0===L?void 0:L.data)||void 0===M?void 0:M.email,phone:null===(W=null===(B=Q.customerForm)||void 0===B?void 0:B.data)||void 0===W?void 0:W.phone,birthDate:null===(j=null===(q=Q.customerForm)||void 0===q?void 0:q.data)||void 0===j?void 0:j.birthDate,company:null===(G=null===(U=Q.customerForm)||void 0===U?void 0:U.data)||void 0===G?void 0:G.company}:void 0,tt){const t=n||(null===(V=Q.giftRecipientForm)||void 0===V?void 0:V.data);t&&(et.giftOptions={recipient:{name:(t.firstName||"")+" "+(t.lastName||""),email:t.email||"",phone:t.phone||""},message:t.message||""})}if(!X)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===(K=Q.paymentForm)||void 0===K?void 0:K.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,n){try{this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+n),new SDKError("Item not found");const s=o.quantity+n;if(s<1)return this.removeItem(t,!![]);const a=this.buildItemUpdate(o,s),d=await this.api.updateCart({id:i,items:[a],loc:this.getLocation()});this.syncItemsFromApiResponse(d,[t]),this.updateFulfillment(o.fulfillmentId,d),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d),this.pubSub.publishAction(n<0?b.CART_ITEM_QUANTITY_DECREASE:b.CART_ITEM_QUANTITY_INCREASE,{id:o.id,quantity:s,previousQuantity:o.quantity});const u=splitCategoryPath(o.catPath),m={item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_size:o.size,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:Math.abs(n),price:centToDollar(o.unitPrice||0),upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId};n<0?this.googleTagManager.removeFromCart(m):n>0&&this.googleTagManager.addToCart(m)}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to update item quantity",i),i}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,n){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;n||this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw new SDKError("Item not found");const s={itemId:o.id,fulfillmentId:o.fulfillmentId,retailerId:o.retailerId},a=this.buildItemUpdate(o,0),d=await this.api.updateCart({id:i,items:[a],loc:this.getLocation()});this.syncItemsFromApiResponse(d,[]),this.cleanupAfterItemRemoval(s,d),this.syncCartMetaFromApiResponse(d),this.pubSub.publishAction(b.CART_ITEM_REMOVED,{id:o.id});const u=splitCategoryPath(o.catPath);this.googleTagManager.removeFromCart({item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_size:o.size,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:o.quantity,price:centToDollar(o.unitPrice||0),upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId})}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to remove item",i),i}}async updateItemEngraving(t,n){var i,o,s;try{const a=this.store.get("cart"),d=null===(i=a.items)||void 0===i?void 0:i[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:n},m=await this.api.updateCart({id:a.id||"",items:[u],loc:this.getLocation()});this.syncItemsFromApiResponse(m,[t]),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const g=this.store.get("cart"),v=this.store.get("address");this.pubSub.publishAction(b.CART_UPDATED,{previous:cartDataForEventFromStore(a,v),current:cartDataForEventFromStore(g,v)}),this.pubSub.publishAction(b.CART_ITEM_ENGRAVING_UPDATED,{id:d.id,engravingLines:n,previousEngravingLines:(null===(s=null===(o=d.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||[]})}catch(a){throw this.store.set("cart.items."+t+".error",a.message),this.logger.error("Failed to update item engraving",a),a}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var n,i;try{this.store.set("cart.loading",!![]);const o=this.store.get("cart"),s={...o},a=(null===(n=t.engravingLines)||void 0===n?void 0:n.filter(t=>""!==t.trim()))||[],d=a.length>0,u=Object.values(o.items||{}).find(n=>{var i,o,s,u,m;const g=n.fulfillmentId===t.fulfillmentId&&n.partNumber===t.partNumber;if(!g)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 a.join(",")===t.join(",")}return!(null===(m=null===(u=null===(s=n.attributes)||void 0===s?void 0:s.engraving)||void 0===u?void 0:u.lines)||void 0===m?void 0:m.length)}),m={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:u?t.quantity+u.quantity:t.quantity};d&&(m.engravingLines=a);const g=await this.api.updateCart({id:o.id||"",items:[m],loc:this.getLocation()}),v=null===(i=g.items)||void 0===i?void 0:i.find(t=>t.fulfillmentId===m.fulfillmentId&&t.partNumber===m.partNumber&&t.upc===m.upc);if(!v)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(g,[]);const y=this.store.get("cart.fulfillments."+t.fulfillmentId);y?this.updateFulfillment(t.fulfillmentId,g):this.addNewFulfillmentAndRetailer(t.fulfillmentId,g),this.syncRetailersFromApiResponse(g),this.syncCartMetaFromApiResponse(g);const x=this.store.get("cart"),w=this.store.get("address");this.pubSub.publishAction(b.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(b.CART_ITEM_ADDED,{id:v.id,upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(b.CART_UPDATED,{previous:cartDataForEventFromStore(s,w),current:cartDataForEventFromStore(x,w)});const C=splitCategoryPath(v.catPath);this.googleTagManager.addToCart({item_id:v.liquidId,item_name:v.name,item_brand:v.brand,item_size:v.size,item_category:C.category,item_category2:C.category2,item_category3:C.category3,item_type:v.type,item_subtype:v.subType,quantity:v.quantity,price:centToDollar(v.unitPrice||0),upc:v.upc,grouping_id:v.salsifyGrouping,product_id:v.liquidId})}catch(o){this.store.set("cart.error",o.message),this.logger.error("Failed to add item to cart",o)}finally{this.store.set("cart.loading",![])}}async addPresaleItem(t){var 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(w.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 n,i,o;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 a=await this.api.updateCart({id:t,items:[],promoCode:s,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(a)),this.store.set("cart.events",transformEventsForCart(a.events||[]));const d=(null===(o=null===(i=null===(n=a.attributes)||void 0===n?void 0:n.promoCode)||void 0===i?void 0:i.value)||void 0===o?void 0:o.toLowerCase())===s.toLowerCase();d?(this.store.set("cart.promoCode",{code:s,discountAmount:a.discounts||0}),this.pubSub.publishAction(b.CART_PROMO_CODE_APPLIED,{discountAmount:a.discounts||0,newTotal:a.total||0}),this.googleTagManager.promoCodeApplied(s,a.discounts||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(b.CART_PROMO_CODE_FAILED,{error:'Code "'+s+'" does not exist'}),this.googleTagManager.promoCodeFailed(s,'Code "'+s+'" does not exist'))}catch(a){const t=(null==a?void 0:a.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",t),this.pubSub.publishAction(b.CART_PROMO_CODE_FAILED,{error:t}),this.googleTagManager.promoCodeFailed(s,t),this.logger.error("Failed to apply promo code",a),a}}async removePromoCode(){try{const t=this.store.get("cart.id"),n=await this.api.updateCart({id:t,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(n),"cart.promoCode":null}),this.pubSub.publishAction(b.CART_PROMO_CODE_REMOVED,{newTotal:n.total||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const n=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",n);const i=this.store.get("cart.promoCode");throw this.pubSub.publishAction(b.CART_PROMO_CODE_FAILED,{error:n}),(null==i?void 0:i.code)&&this.googleTagManager.promoCodeFailed(i.code,n),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...L,rerender:!![]}),this.store.set("cart",{...O,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSub.publishAction(b.CART_RESET,!![])}getDetails(){var t;const n=this.store.get("cart"),i=this.store.get("address"),o=i.id?i:N,s={};for(const a in n.items||{}){const t=n.items[a];s[a]={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:s,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.latitude,longitude:o.coordinates.longitude}},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(s||{}).reduce((t,n)=>t+(n.quantity||0),0),updatedAt:n.updatedAt,createdAt:n.createdAt}}buildItemUpdate(t,n){var i,o,s;const a={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:n},d=(null===(s=null===(o=null===(i=t.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];return d.length>0&&(a.engravingLines=d),a}syncItemsFromApiResponse(t,n=[]){var i;const o=this.store.get("cart.items")||{},s=new Set((null===(i=t.items)||void 0===i?void 0:i.map(t=>t.id))||[]);for(const d of Object.keys(o))s.has(d)||this.store.remove("cart.items."+d);const a={};for(const d of t.items)0!==n.length&&!n.includes(d.id)&&o[d.id]||(a["cart.items."+d.id]=buildCartItemStore(d));Object.keys(a).length>0&&this.store.batch(a)}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||[])},s=null===(i=null===(n=t.attributes)||void 0===n?void 0:n.promoCode)||void 0===i?void 0:i.value;if(s)o["cart.promoCode"]={code:s.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 s=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)}),a=null===(o=null==s?void 0:s.fulfillments)||void 0===o?void 0:o.find(n=>n.id===t);a&&s&&this.store.set("cart.fulfillments."+t,buildFulfillmentStore(a,s))}addNewFulfillmentAndRetailer(t,n){var i,o;const s=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)}),a=null===(o=null==s?void 0:s.fulfillments)||void 0===o?void 0:o.find(n=>n.id===t);if(a&&s){const n={["cart.fulfillments."+t]:buildFulfillmentStore(a,s),["cart.retailers."+s.id]:buildRetailerStore(s)};this.store.batch(n)}}cleanupAfterItemRemoval(t,n){var i,o,s,a;const d=this.store.get("cart.fulfillments."+t.fulfillmentId),u=this.store.get("cart.retailers."+t.retailerId);if(!d||!u)return;const m=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)}),g=null===(o=n.retailers)||void 0===o?void 0:o.some(n=>n.id===t.retailerId);if(m){this.updateFulfillment(t.fulfillmentId,n);const i=null===(a=n.retailers)||void 0===a?void 0:a.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),g){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 this.store.remove("cart.retailers."+t.retailerId)}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,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 a of i.products){const s=Object.values(a.sizes).filter(n=>t.some(t=>t===(n.upc||n.id||a.salsifyGrouping))),d=t.find(t=>s.some(n=>t===n.upc||t===n.id)||t===a.salsifyGrouping),u=d||(null===(n=null==s?void 0:s[0])||void 0===n?void 0:n.upc);await this.loadProduct(u,{products:[a],retailers:i.retailers}),o.push(u)}const s=t.filter(t=>-1===o.indexOf(t));this.store.batch(s.reduce((t,n)=>(t["products."+n+".loading"]=![],t["products."+n+".error"]="Product data not found",t),{}))}async loadProduct(t,n=null){var i;try{const o=this.store.get("products."+t);o.loading||this.store.set("products."+t+".loading",!![]);let s=null;if(n&&(s=n),n||(s=await this.api.getProductsData([t],this.getLocation())),!s||!(null===(i=null==s?void 0:s.products)||void 0===i?void 0:i[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const a=this.loadProductStoreUpdate(s);if(!a)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...a,identifier:t}),this.pubSub.publishAction(b.PRODUCT_LOADED,this.productDataForEventFromStore(t));const d=s.products[0],u=a.sizes[a.selectedSizeId||""],m=Boolean(this.getLocation()),g=a.selectedFulfillment,v=m&&(null==g?void 0:g.variant.price)?g.variant.price:a.noAvailabilityPrice,y=splitCategoryPath(d.catPath);this.googleTagManager.viewItem({item_id:null==u?void 0:u.id,item_name:d.name,item_brand:d.brand,item_size:null==u?void 0:u.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar(v),item_type:d.type,item_subtype:d.subType,upc:null==u?void 0:u.upc,grouping_id:d.salsifyGrouping,product_id:null==u?void 0:u.id})}catch(o){this.store.set("products."+t+".error",o.message),this.logger.error("Failed to load product data for ID "+t,o)}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,n){var i,o;const s=this.store.get("products."+t);let a=s.selectedFulfillmentType;const d=s.sizes[n];let u=null,m=null;if(a!==C.SHIPPING||Object.values(d.shippingFulfillments).length)if(a!==C.ON_DEMAND||Object.values(d.onDemandFulfillments).length){const t=a===C.SHIPPING?d.shippingFulfillments:d.onDemandFulfillments,n=Object.values(t);u=n[0]||null,m=(null==u?void 0:u.id)||null}else{a=C.SHIPPING;const t=Object.values(d.shippingFulfillments);u=t[0]||null,m=(null==u?void 0:u.id)||null}else{a=C.ON_DEMAND;const t=Object.values(d.onDemandFulfillments);u=t[0]||null,m=(null==u?void 0:u.id)||null}const g=a===C.SHIPPING?d.shippingFulfillments:d.onDemandFulfillments,v=splitCategoryPath(s.catPath);this.googleTagManager.viewItem({item_id:null==d?void 0:d.id,item_name:s.name,item_brand:s.brand,item_size:null==d?void 0:d.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar((null==u?void 0:u.variant.price)||s.noAvailabilityPrice),item_type:s.type,item_subtype:s.subType,upc:null==d?void 0:d.upc,grouping_id:s.salsifyGrouping,product_id:null==d?void 0:d.id});const y=Object.keys(d.shippingFulfillments).length>0,x=Object.keys(d.onDemandFulfillments).length>0;y||x||this.googleTagManager.productSizeNoAvailability({productId:null==d?void 0:d.id,productName:s.name,productBrand:s.brand,productCategory:v.category,productCategory2:v.category2,productCategory3:v.category3,productType:s.type,productSubtype:s.subType,productPrice:s.noAvailabilityPrice,sizeId:n,sizeName:null==d?void 0:d.size,upc:null==d?void 0:d.upc,groupingId:s.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(b.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:n,size:(null===(i=s.sizes[n])||void 0===i?void 0:i.size)||"",previousSizeId:s.selectedSizeId||"",previousSize:(null===(o=s.sizes[s.selectedSizeId])||void 0===o?void 0:o.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:n,["products."+t+".productHasAvailability"]:Object.keys(d.shippingFulfillments).length+Object.keys(d.onDemandFulfillments).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(g).length),["products."+t+".selectedFulfillmentType"]:a,["products."+t+".selectedFulfillment"]:u,["products."+t+".selectedFulfillmentId"]:m})}async selectFulfillment(t,n){const i=this.store.get("products."+t),o=i.sizes[i.selectedSizeId],s=i.selectedFulfillmentType===C.SHIPPING?o.shippingFulfillments:o.onDemandFulfillments,a=s[n];this.pubSub.publishAction(b.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:n,selectedFulfillmentType:i.selectedFulfillmentType,previousFulfillmentId:i.selectedFulfillmentId||"",previousFulfillmentType:i.selectedFulfillmentType});const d=splitCategoryPath(i.catPath);this.googleTagManager.viewItem({item_id:null==o?void 0:o.id,item_name:i.name,item_brand:i.brand,item_size:null==o?void 0:o.size,item_category:d.category,item_category2:d.category2,item_category3:d.category3,price:centToDollar((null==a?void 0:a.variant.price)||i.noAvailabilityPrice),item_type:i.type,item_subtype:i.subType,upc:null==o?void 0:o.upc,grouping_id:i.salsifyGrouping,product_id:null==o?void 0:o.id}),this.store.batch({["products."+t+".selectedFulfillment"]:a,["products."+t+".selectedFulfillmentId"]:n,["products."+t+".quantity"]:1})}async updateQuantity(t,n){var i;const o=this.store.get("products."+t),s=o.quantity,a=s+n,d=1,u=(null===(i=null==o?void 0:o.selectedFulfillment)||void 0===i?void 0:i.variant.stock)||5,m=Math.max(d,Math.min(u,a));this.pubSub.publishAction(n<0?b.PRODUCT_QUANTITY_DECREASE:b.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:m,previousQuantity:s}),this.store.set("products."+t+".quantity",m)}async changeFulfillmentType(t,n){var i;const o=this.store.get("products."+t),s=o.sizes[o.selectedSizeId],a=n===C.SHIPPING?s.shippingFulfillments:s.onDemandFulfillments,d=Object.values(a);if(0===d.length){const t=splitCategoryPath(o.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==s?void 0:s.id,productName:o.name,productBrand:o.brand,productCategory:t.category,productCategory2:t.category2,productCategory3:t.category3,productType:o.type,productSubtype:o.subType,productPrice:o.noAvailabilityPrice,sizeId:null!==(i=o.selectedSizeId)&&void 0!==i?i:void 0,sizeName:null==s?void 0:s.size,fulfillmentType:n,upc:null==s?void 0:s.upc,groupingId:o.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+n+" fulfillments available for selected size"}),void 0}const u=d[0]||null,m=(null==u?void 0:u.id)||null;this.pubSub.publishAction(b.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:n,selectedFulfillmentId:m,previousFulfillmentType:o.selectedFulfillmentType,previousFulfillmentId:o.selectedFulfillmentId,fulfillmentHasAvailability:d.length>0});const g=splitCategoryPath(o.catPath);this.googleTagManager.viewItem({item_id:null==s?void 0:s.id,item_name:o.name,item_brand:o.brand,item_size:null==s?void 0:s.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar((null==u?void 0:u.variant.price)||o.noAvailabilityPrice),item_type:o.type,item_subtype:o.subType,upc:null==s?void 0:s.upc,grouping_id:o.salsifyGrouping,product_id:null==s?void 0:s.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:n,["products."+t+".selectedFulfillment"]:u,["products."+t+".selectedFulfillmentId"]:m,["products."+t+".fulfillmentHasAvailability"]:d.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(w.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(w.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.variant.retailerId,retailerName:o.retailerName,retailerAddress:o.retailerAddress,retailerTimezone:o.timezone,price:o.variant.price,partNumber:o.variant.partNumber,stock:o.variant.stock,isEngravable:o.variant.isEngravable,fulfillmentId:o.id,fulfillmentType:o.type}}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.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:t.attributes,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,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,noAvailabilityPrice:n.noAvailabilityPrice,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,s=Object.values(n).length;if(o+s>0)return i.id}return null}loadProductStoreUpdate({products:[t,...n],retailers:i}){var o,s,a,d,u;try{const n=this.themeProvider.getConfigs("product"),m={id:t.id,brand:t.brand,category:t.category,catPath:t.catPath,classification:t.classification,type:t.type,subType:t.subType,salsifyGrouping:t.salsifyGrouping,name:t.name,description:t.description,htmlDescription:t.htmlDescription,images:t.images,region:t.region,country:t.country,material:t.material,abv:t.abv,proof:t.proof,age:t.age,color:t.color,flavor:t.flavor,variety:t.variety,appellation:t.appellation,vintage:t.vintage,tastingNotes:t.tastingNotes,noAvailabilityPrice:t.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:n.layout.enableShippingFulfillment?C.SHIPPING:C.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(t.sizes&&Object.values(t.sizes).length>0)for(const{shippingVariants:o,onDemandVariants:s,...a}of Object.values(t.sizes)){m.sizes[a.id]={...a,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const t of Object.values(o)){const n=i[t.retailerId];(null==n?void 0:n.shippingFulfillment)&&(m.sizes[a.id].shippingFulfillments[n.shippingFulfillment.id]={...n.shippingFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:t})}for(const t of Object.values(s)){const n=i[t.retailerId];(null==n?void 0:n.onDemandFulfillment)&&(m.sizes[a.id].onDemandFulfillments[n.onDemandFulfillment.id]={...n.onDemandFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:t})}}const g=Object.values(m.sizes),v=this.findFirstAvailableSize(m.sizes);m.selectedSizeId=v||(null===(o=g[0])||void 0===o?void 0:o.id)||"";const y=(null===(s=m.sizes[m.selectedSizeId])||void 0===s?void 0:s.shippingFulfillments)||{},b=(null===(a=m.sizes[m.selectedSizeId])||void 0===a?void 0:a.onDemandFulfillments)||{};m.productHasAvailability=Object.values(y).length+Object.values(b).length>0;const x=m.selectedFulfillmentType===C.SHIPPING?Object.values(y):Object.values(b);if(m.fulfillmentHasAvailability=x.length>0,m.selectedFulfillment=x[0]||null,m.selectedFulfillmentId=(null===(d=m.selectedFulfillment)||void 0===d?void 0:d.id)||null,!m.fulfillmentHasAvailability){const t=m.selectedFulfillmentType===C.SHIPPING?C.ON_DEMAND:C.SHIPPING,n=t===C.SHIPPING?Object.values(y):Object.values(b);n.length>0&&(m.selectedFulfillmentType=t,m.selectedFulfillment=n[0],m.selectedFulfillmentId=(null===(u=m.selectedFulfillment)||void 0===u?void 0:u.id)||null,m.fulfillmentHasAvailability=!![])}if(!m.productHasAvailability){const n=splitCategoryPath(t.catPath),i=m.sizes[m.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==i?void 0:i.id,productName:t.name,productBrand:t.brand,productCategory:n.category,productCategory2:n.category2,productCategory3:n.category3,productType:t.type,productSubtype:t.subType,productPrice:t.noAvailabilityPrice,upc:null==i?void 0:i.upc,groupingId:t.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for any size"})}return m}catch(m){throw this.logger.error("Product data processing error",m),m}}}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(n){throw this.googleTagManager.addressFailed({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},error:(null==n?void 0:n.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(b.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==n?void 0:n.message)||"Failed to update downstream state after address change"}),n}this.googleTagManager.addressUpdated({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates}),this.pubSub.publishAction(b.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,n){try{const i=buildFormattedAddressString(t),o={id:"",formattedAddress:i,address:t,coordinates:n};await this.setSelectedAddress(o)}catch(i){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==i?void 0:i.message)||"Failed to set manual address"}),this.pubSub.publishAction(b.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:t,coordinates:n,error:(null==i?void 0:i.message)||"Failed to set manual address"}),i}}async clearSelectedAddress(){this.store.set("address",N),this.pubSub.publishAction(b.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,s=this.clientConfig.getConfigs();o.entity=null!==(i=null!==(n=window.location.hostname)&&void 0!==n?n:s.partnerName)&&void 0!==i?i:void 0,o.visitorId=s.userDeviceId,o.loc=this.getLocation(),o.isLegacy=!![];const a=await this.api.catalogSearch(o);return a.products&&a.products.length>0&&this.trackViewItemList(a.products),a}async addToCart(t){try{this.uiCommands.openDrawer(w.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(w.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;const i=null===(n=t.sizes)||void 0===n?void 0:n[0],o=null==i?void 0:i.shippingVariants[Object.keys(i.shippingVariants)[0]],s=splitCategoryPath(t.catPath);return{item_id:null==i?void 0:i.id,item_name:t.name,item_brand:t.brand,item_size:null==i?void 0:i.size,item_category:s.category,item_category2:s.category2,item_category3:s.category3,price:(null==o?void 0:o.price)?centToDollar(o.price):t.noAvailabilityPrice?centToDollar(t.noAvailabilityPrice):void 0,item_type:t.type,item_subtype:t.subType,upc:null==i?void 0:i.upc,grouping_id:t.salsifyGrouping,product_id:null==i?void 0:i.id,item_list_id:"product_list",item_list_name:"Product List"}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}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.coordinates,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.latitude||"number"!=typeof n.longitude)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof n.latitude+", long: "+typeof n.longitude,!![]);if(n.latitude<-90||n.latitude>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+n.latitude,!![]);if(n.longitude<-180||n.longitude>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+n.longitude,!![]);await this.command.address.setAddressManually(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(w.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(w.CART)},addProduct:async(t,n)=>{var i,o;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;const s=this.getLocation();if(void 0===s)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=n?n:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(w.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;n===!![]&&this.command.ui.openDrawer(w.CART);const a=[...new Set(t.map(t=>t.identifier))],d=await this.api.getProductsData(a,s);if(!d||!d.products||0===d.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(b.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const n of t){let t=null;for(let i=0;i<d.products.length;i++){const o=d.products[i];let s=![];for(let t=0;t<Object.values(o.sizes).length;t++){const i=o.sizes[t];if(i.upc===n.identifier||i.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 s=t.sizes[0];if(!s){this.logger.warn("No sizes found for product: "+n.identifier);continue}if((null===(o=null===(i=null==s?void 0:s.attributes)||void 0===i?void 0:i.presale)||void 0===o?void 0:o.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 a=null;const u=n.fulfillmentType===C.SHIPPING?s.shippingVariants:s.onDemandVariants;for(let n=0;n<Object.values(u).length;n++)if(u[n]){a=u[n];break}if(!a){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 m=n.fulfillmentType===C.ON_DEMAND?a.onDemandFulfillmentId:a.shippingFulfillmentId;await this.command.cart.addItem({upc:s.upc,fulfillmentId:m,partNumber:a.partNumber,quantity:n.quantity,identifier:n.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(b.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:a}),this.logger.info("Products added to cart successfully:",a)}catch(s){throw this.logger.error("Error adding products to cart:",s),this.clearPendingCartOperation(),this.pubSub.publishAction(b.CART_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:s.message||"Failed to add products to cart"}),s}},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 n=t.trim().toUpperCase(),i=this.themeProvider.getConfigs("global"),o=i.layout.allowPromoCodes;if(!o)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const s=this.store.get("cart.promoCode");if(s&&s.code===n)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(n);const a=this.command.cart.getDetails();this.pubSub.publishAction(b.CART_PROMO_CODE_APPLIED,{discountAmount:a.amounts.discounts,newTotal:a.amounts.total}),this.logger.info("Promo code applied successfully")}catch(n){throw this.logger.error("Failed to apply promo code:",n),this.pubSub.publishAction(b.CART_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),n}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),n=t.layout.allowPromoCodes;if(!n)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const i=this.command.cart.getDetails();this.pubSub.publishAction(b.CART_PROMO_CODE_REMOVED,{newTotal:i.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(b.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(w.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(w.CHECKOUT)},addProduct:async(t,n)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;n===!![]&&this.command.ui.openDrawer(w.CHECKOUT);const i=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(b.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:i}),this.logger.info("Products added to checkout successfully:",i)}catch(i){throw this.logger.error("Error adding products to checkout:",i),this.pubSub.publishAction(b.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:i.message||"Failed to add products to checkout"}),i}},addPresaleProduct:async t=>{var n,i;try{if(!t||"object"!=typeof t||!t.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;const o=this.getLocation();if(void 0===o)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(w.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const s=await this.api.getProductsData([t.identifier],o);if(!s||!s.products||0===s.products.length)return this.logger.warn("No product data found for the provided presale identifier"),this.pubSub.publishAction(b.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No product found",isPresale:!![]}),void 0;const a=s.products[0],d=a.sizes[0];if(!d)return this.logger.warn("No sizes found for presale product: "+t.identifier),this.pubSub.publishAction(b.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No sizes found for product",isPresale:!![]}),void 0;if((null===(i=null===(n=null==d?void 0:d.attributes)||void 0===n?void 0:n.presale)||void 0===i?void 0:i.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(b.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0;let u=null;const m=t.fulfillmentType===C.SHIPPING?d.shippingVariants:d.onDemandVariants;for(let t=0;t<Object.values(m).length;t++)if(m[t]){u=m[t];break}if(!u)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(b.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0;const g=t.fulfillmentType===C.ON_DEMAND?u.onDemandFulfillmentId:u.shippingFulfillmentId;await this.command.cart.addPresaleItem({upc:d.upc,fulfillmentId:g,partNumber:u.partNumber,quantity:t.quantity,engravingLines:[],identifier:t.identifier}),this.command.ui.openDrawer(w.CHECKOUT),this.pubSub.publishAction(b.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:1,identifiers:[t.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+t.identifier)}catch(o){throw this.logger.error("Error adding presale product to checkout:",o),this.pubSub.publishAction(b.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:o.message||"Failed to add presale product to checkout",isPresale:!![]}),o}},applyPromoCode:async t=>{var n;try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const i=t.trim().toUpperCase(),o=this.themeProvider.getConfigs("global"),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;const a=this.store.get("checkout.promoCode");if(a&&a.code===i)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(b.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:(null==u?void 0:u.discountAmount)||0,newTotal:(null===(n=null==d?void 0:d.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(i){throw this.logger.error("Failed to apply checkout promo code:",i),this.pubSub.publishAction(b.CHECKOUT_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),i}},removePromoCode:async()=>{var t;try{const n=this.themeProvider.getConfigs("global"),i=n.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const o=this.store.get("checkout");this.pubSub.publishAction(b.CHECKOUT_PROMO_CODE_REMOVED,{newTotal:(null===(t=null==o?void 0:o.amounts)||void 0===t?void 0:t.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(n){throw this.logger.error("Failed to remove checkout promo code:",n),n}},applyGiftCard:async t=>{var n;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const s=this.store.get("checkout");this.pubSub.publishAction(b.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:(null===(n=null==s?void 0:s.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card applied successfully")}catch(i){throw this.logger.error("Failed to apply gift card:",i),this.pubSub.publishAction(b.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be applied"}),i}},removeGiftCard:async t=>{var n;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t);const s=this.store.get("checkout");this.pubSub.publishAction(b.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:(null===(n=null==s?void 0:s.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card removed successfully")}catch(i){throw this.logger.error("Failed to remove gift card:",i),this.pubSub.publishAction(b.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be removed"}),i}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:async(t,n)=>{await this.command.checkout.toggleMarketingPreferences(t,n)},updateCustomerInfo:t=>{for(const[n,i]of Object.entries(t));},updateBillingInfo:t=>{for(const[n,i]of Object.entries(t));},updateGiftInfo:t=>{for(const[n,i]of Object.entries(t));},getDetails:()=>{var t,n,i;const o=this.store.get("checkout"),s=o.items||{},a={};for(const[d,u]of Object.entries(s))a[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: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(a||{}).reduce((t,n)=>t+(n.quantity||0),0),amounts:o.amounts,items:a}}},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 e=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+b.ADDRESS_UPDATED,e)}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.latitude&&t.coordinates.longitude)return{coordinates:t.coordinates,address:t.address}}}const Et="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",St="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,s]of n)this.interceptLoggerInstance(s,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.l)return;const i=t.debug.bind(t),o=t.info.bind(t),s=t.warn.bind(t),a=t.error.bind(t),Y=(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(Y("debug",t,n))},t.info=(t,n)=>{o(t,n),this.addLogEntry(Y("info",t,n))},t.warn=(t,n)=>{s(t,n),this.addLogEntry(Y("warn",t,n))},t.error=(t,n)=>{a(t,n),this.addLogEntry(Y("error",t,n))},t.l=!![]}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(St);t&&t.remove(),this.panelElement=document.createElement(St);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=Et,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 s=this.createResizeHandle();this.panelContainer.appendChild(s),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 s=document.createElement("div");s.className="subtitle",s.textContent="Live SDK logs, events & GTM tracking",i.appendChild(o),i.appendChild(s);const a=document.createElement("button");return a.className="minimize",a.innerHTML="−",a.title="Minimize debug panel",a.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(n),t.appendChild(i),t.appendChild(a),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:s})=>{const a=document.createElement("label");a.className="toggle",a.title=o;const d=document.createElement("input");d.type="checkbox",d.checked="showLogs"!==n,d.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 u=document.createElement("span");u.textContent=i,u.style.color=s,a.appendChild(d),a.appendChild(u),t.appendChild(a)});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,s=0,a=0;t.addEventListener("mousedown",t=>{n=!![],i=t.clientX,o=t.clientY,s=Number.parseInt(this.panelElement.style.width,10)||500,a=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",l),document.addEventListener("mouseup",E),t.preventDefault()});const l=t=>{if(!n||!this.panelElement)return;const d=t.clientX-i,u=t.clientY-o,m=window.innerWidth<=768,g=window.innerWidth<=480;let v,y,b,x;g?(v=280,y=window.innerWidth-20,b=200,x=.4*window.innerHeight):m?(v=300,y=window.innerWidth-30,b=200,x=.4*window.innerHeight):(v=300,y=800,b=200,x=600);const w=Math.max(v,Math.min(y,s+d)),C=Math.max(b,Math.min(x,a+u));this.panelElement.style.width=w+"px",this.panelElement.style.height=C+"px"},E=()=>{n=![],document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",E)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const n=t.querySelector(".header");if(n){let t=![],i=0,o=0,s=0,a=0;n.addEventListener("mousedown",n=>{if(n.target.classList.contains("minimize"))return;t=!![],i=n.clientX,o=n.clientY;const d=this.panelElement.getBoundingClientRect();s=d.left,a=d.top,document.addEventListener("mousemove",l),document.addEventListener("mouseup",E),n.preventDefault()});const l=n=>{if(!t||!this.panelElement)return;const d=n.clientX-i,u=n.clientY-o;this.panelElement.style.left=s+d+"px",this.panelElement.style.top=a+u+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},E=()=>{t=![],document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",E)}}}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.h()){const n=this.u(t);if(n)return this.m(t,n)}return this.cachedFingerprint||(this.cachedFingerprint=this.v()),this.m(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.C(),browser:this.k(),timezone:this.S()}}isLocalStorageWebApiAvailable(){return this.h()}m(t,n){return(t+"_"+n).toLowerCase()}h(){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.I()&&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.I()?"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}}v(){const t=this.getFingerprintData(),n=Object.keys(t).sort().map(n=>n+":"+t[n]).join("|");return this.T(n)}C(){try{const t=screen,n=t.colorDepth||24,i=t.pixelDepth||n,o=this.D(),s=Math.round(100*(window.devicePixelRatio||1));return n+"|"+i+"|"+o+"|"+s}catch(t){return"24|24|srgb|100"}}D(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(ht){}return"srgb"}k(){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 s=(n.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);i.push(s),i.push(n.cookieEnabled?"1":"0"),i.push(n.maxTouchPoints||0),i.push(n.deviceMemory||0),i.push(this.A()),i.push(this.I()?"webview":"browser");const a=["bluetooth"in n?"1":"0","usb"in n?"1":"0","mediaDevices"in n?"1":"0","permissions"in n?"1":"0","credentials"in n?"1":"0","storage"in n?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return i.push(a.join("")),i.join("|")}catch(n){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}A(){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"}}I(){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![]}}S(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}T(t){const n=16777619;let i=2166136261,o=2166136261,s=2166136261,a=2166136261;for(let d=0;d<t.length;d++){const u=t.charCodeAt(d);i^=u,i=Math.imul(i,n),o^=u<<1,o=Math.imul(o,n),s^=u<<2,s=Math.imul(s,n),a^=u<<3,a=Math.imul(a,n)}return i=Math.abs(i),o=Math.abs(o),s=Math.abs(s),a=Math.abs(a),i.toString(16)+o.toString(16)+s.toString(16)+a.toString(16)}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance();const t=this.clientConfig.get("env"),n=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:n,batchSize:t===y.PRODUCTION?5:10,batchInterval:t===y.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 s={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(s)}catch(s){this.handleInternalError(s)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const t=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:t||void 0}}buildBrowserContext(){return{userAgent:navigator.userAgent,deviceType:this.clientConfig.get("deviceType"),url:window.location.href,referrer:document.referrer||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}shouldCapture(t){switch(t){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(t){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(t),this.stats.totalEvents++,this.stats.eventsByLevel[t.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var t;if(0===this.eventQueue.length||!(null===(t=this.config)||void 0===t?void 0:t.endpoint))return;const 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._=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._.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(i){this.logger.error("Component connectedCallback error in "+((null===(n=this._)||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._)||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._)||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._.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+"]",s=null===(n=this.onStoreChanged)||void 0===n?void 0:n.call(this,t);s!==![]&&this.triggerRender(o)}catch(o){this.logger.error("Store watcher callback error in "+((null===(i=this._)||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._)||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._)||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._)||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 s=performance.now()-i;this.logRenderInfo(s);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(o){this.logger.error("❌ afterRender hook error in "+this._.tagName,o),o instanceof Error&&this.captureComponentError(o,"afterRender")}}catch(s){const t=performance.now()-i;this.logger.error("❌ Component render error in "+this._.tagName,s),this.captureComponentError(s,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this._.type,message:s instanceof Error?s.message:String(s)}));try{null===(n=this.onError)||void 0===n?void 0:n.call(this,s,"render")}catch(a){this.logger.error("❌ onError hook error in "+this._.tagName,a)}}}logRenderInfo(t){const n=this._.type,i=this._.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._.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._.tagName+":"+n,component:{type:this._.type,tagName:this._.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:i,useShadowDom:this._.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._.type)}get elementConfig(){return this._}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:w.ADDRESS_DISPLAY,isIndependentComponent:!![],options:n})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,n,i,o;const s=this.getStoreValue("address"),a=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:{},m=null!==(o=u.showLabel)&&void 0!==o?o:!![],g=[];if(m){const t=document.createElement("span");t.textContent="Delivers to:",g.push(t)}const v=document.createElement("button");v.type="button",v.textContent=s.formattedAddress||"Select an address";const y=s.formattedAddress?"Change delivery address, currently set to "+s.formattedAddress:"Select delivery address";return v.setAttribute("aria-label",y),v.addEventListener("click",async()=>{if(a)return this.commands.ui.openDrawer(w.ADDRESS_INPUT,{productId:d,isIndependentComponent:!![]}),void 0;!a&&d&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(w.ADDRESS_INPUT,{productId:d}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(d,w.ADDRESS_INPUT,{productId:d}))}),g.push(v),g}}const ArrowRightIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:t=24,height:n=24,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckboxIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},ChevronUpIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 10.4712C3.78862 10.7316 4.21073 10.7316 4.47108 10.4712L7.99967 6.94265L11.5283 10.4712C11.7886 10.7316 12.2107 10.7316 12.4711 10.4712C12.7314 10.2109 12.7314 9.78878 12.4711 9.52843L8.47108 5.52843C8.21073 5.26808 7.78862 5.26808 7.52827 5.52843L3.52827 9.52843C3.26792 9.78878 3.26792 10.2109 3.52827 10.4712Z" fill="#18181B"/>\n </svg>\n '},CloseIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" 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 s=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="'+s+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=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="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const n=t.target,i=n.value.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");n.value=i;const o=i.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(),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(ht){this.logger.error("Address edit cancellation failed",ht)}},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.latitude)!==this.selectedAddress.coordinates.latitude||(null==t?void 0:t.coordinates.longitude)!==this.selectedAddress.coordinates.longitude;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.coordinates,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"),s=null!==(t=this.params.options)&&void 0!==t?t:{},a=null!==(n=s.showLabel)&&void 0!==n?n:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),a){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const d=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),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 m=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),g=[this.inputContainer,m,this.errorContainer],v=this.createElement("div",{className:"action-buttons"}),y=this.createCancelButton();v.appendChild(y);const b=this.createCheckButton();return v.appendChild(b),g.push(v),document.addEventListener("click",this.handleDocumentClick),g}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:w.CART_HEADER});t.push(n)}const i=ComponentFactoryService.createElement({type:w.CART_BODY});t.push(i);const o=ComponentFactoryService.createElement({type:w.CART_FOOTER});return t.push(o),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=document.createElement("div");t.className="empty-cart-container";const 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:w.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),s=this.getValidRetailerIds(n.value),a=o.size,d=s.size,u=this.getValidRetailers(this.getStoreValue("cart.retailers")),m=Object.keys(u).length;if(d>0&&0===m)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===a&&d>0){this.container.innerHTML="";for(const[t,n]of Object.entries(i))this.addRetailerElement(t,n)}else if(a>0&&0===d)this.showEmptyCartState();else if(d>0){for(const t of o)s.has(t)||this.removeRetailerElement(t);for(const n of s){const s=i[n],a=t[n];o.has(n)?this.hasRetailerDataChanged(a,s)&&this.updateRetailerElement(n,s):this.addRetailerElement(n,s)}}else 0===a&&0===d&&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")),s=t.some(t=>"cart.loading"===t.path),a=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||s||n||a)&&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")||{},s=Object.values(o).some(t=>t.updating);if(s)return!![];const a=this.getStoreValue("cart.retailers")||{},d=Object.values(a).some(t=>t.updating);return d?!![]:![]}hasUnmetMinimum(t){var n;const i=t.subtotal;if(t.type===C.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===C.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=[],o=document.createElement("div");o.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 a=document.createElement("p");if(a.textContent="Taxes & fees will be calculated at checkout",a.className="taxes-fees-info",o.appendChild(s),o.appendChild(a),i.push(o),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:w.CART_PROMO_CODE});i.push(t)}const d=ComponentFactoryService.createElement({type:w.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:w.POWERED_BY,context:"general"});i.push(t)}return i}}const shouldShowMinimumPurchaseAlert=(t,n=![])=>{var i,o;if(!t)return![];const s=t.subtotal;if(t.type===C.SHIPPING){const a=t.fees;if(n&&(null===(i=a.pack)||void 0===i?void 0:i.active)&&a.pack.min>0&&s<a.pack.min)return!![];if(!n&&(null===(o=a.individual)||void 0===o?void 0:o.active)&&a.individual.min>0&&s<a.individual.min)return!![]}else if(t.type===C.ON_DEMAND){const n=t.fees;if(n.min>0&&s<n.min)return!![]}return![]},getMinimumPurchaseMessage=(t,n=![])=>{var i,o;if(!t)return{message:"",type:"warning"};const s=t.subtotal;if(t.type===C.SHIPPING){const a=t.fees;let d=0;if(n&&(null===(i=a.pack)||void 0===i?void 0:i.active)&&a.pack.min>0?d=a.pack.min:(null===(o=a.individual)||void 0===o?void 0:o.active)&&a.individual.min>0&&(d=a.individual.min),d>0&&s<d)return{message:"+"+formatCentToDollarText(d-s)+" needed for order minimum",type:"warning"}}if(t.type===C.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;if(!t)return![];const s=t.subtotal;if(t.type===C.SHIPPING){const a=t.fees;if(n&&(null===(i=a.pack)||void 0===i?void 0:i.active)&&a.pack.min>0&&s<a.pack.min)return!![];if(!n&&(null===(o=a.individual)||void 0===o?void 0:o.active)&&a.individual.min>0&&s<a.individual.min)return!![]}if(t.type===C.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",s=document.createElement("div");return s.className="alert-icon alert-icon-"+this.params.messageType,s.appendChild(htmlStringToElement(i[o]({width:16,height:16,className:"alert-icon-svg"}))),s}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||[]),o=new Set(n||[]);for(const s of i)if(!o.has(s)){const t=this.container.querySelector('[data-item-id="'+s+'"]');t&&t.remove()}for(const s of o)if(!i.has(s)){const t=ComponentFactoryService.createElement({type:w.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 o of n){const t=ComponentFactoryService.createElement({type:w.CART_ITEM,itemId:o});t.setAttribute("data-item-id",o),this.container.appendChild(t)}}setupMinimumPurchaseAlert(){var t;const n=this.getFulfillmentId(),i=(null===(t=this.getProductStore())||void 0===t?void 0:t.pack)||![],o=this.getStoreValue("cart.fulfillments."+n),s=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(s&&s.remove(),o&&shouldShowMinimumPurchaseAlert(o,i)){const t=getMinimumPurchaseMessage(o,i),n=ComponentFactoryService.createElement({type:w.PURCHASE_MIN_ALERT,message:t.message,messageType:t.type,currentTotal:o.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),s=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(s.length>0&&this.checkAndUpdateLoadingState(),o){const t=o.oldValue,n=o.value,i=(null==t?void 0:t.items)||[],s=(null==n?void 0:n.items)||[],a=JSON.stringify(i)!==JSON.stringify(s);a&&(this.handleItemsUpdate(i,s),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,i=[]){if(!t)return!![];const o=["type","canEngrave","retailerId"];for(const s of o)if(!i.includes(s)&&t[s]!==n[s])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const It={CT:"America/New_York",DE:"America/New_York",FL:"America/New_York",GA:"America/New_York",IN:"America/New_York",KY:"America/New_York",ME:"America/New_York",MD:"America/New_York",MA:"America/New_York",MI:"America/New_York",NH:"America/New_York",NJ:"America/New_York",NY:"America/New_York",NC:"America/New_York",OH:"America/New_York",PA:"America/New_York",RI:"America/New_York",SC:"America/New_York",TN:"America/New_York",VT:"America/New_York",VA:"America/New_York",WV:"America/New_York",AL:"America/Chicago",AR:"America/Chicago",IL:"America/Chicago",IA:"America/Chicago",KS:"America/Chicago",LA:"America/Chicago",MN:"America/Chicago",MS:"America/Chicago",MO:"America/Chicago",NE:"America/Chicago",ND:"America/Chicago",OK:"America/Chicago",SD:"America/Chicago",TX:"America/Chicago",WI:"America/Chicago",AZ:"America/Phoenix",CO:"America/Denver",ID:"America/Denver",MT:"America/Denver",NV:"America/Los_Angeles",NM:"America/Denver",UT:"America/Denver",WY:"America/Denver",CA:"America/Los_Angeles",OR:"America/Los_Angeles",WA:"America/Los_Angeles",AK:"America/Anchorage",HI:"Pacific/Honolulu"},Tt="America/New_York";function detectUserTimezone(t){try{if(t){const n=t.toUpperCase(),i=It[n];return i||Tt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){return Tt}}function getCurrentTimeInTimezone(t){try{const n=new Date,i=n.getTime(),o=6e4*n.getTimezoneOffset(),s=new Date(i+o),a=new Date(s.toLocaleString("en-US",{timeZone:t})),d=s.getTime()-a.getTime();return new Date(i+d)}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),s=!n||t>=new Date(n),a=!i||t<=new Date(i);return s&&a}catch(s){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 o=this.config.layout.drawerHeaderText,s=this.getConfigs("global"),a=document.createElement("div");a.className="cart-header-content";const d=document.createElement("h2");d.className="cart-title",d.textContent=o,a.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()}),a.appendChild(u);const m=this.clientConfig.get("promoTicker"),g=null!==(n=null===(t=null==s?void 0:s.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==n?n:[],v=null!=m?m:g,y=this.store.get("address"),b=hasActiveItems(v,null===(i=null==y?void 0:y.address)||void 0===i?void 0:i.state);if(!v.length||!b)return[a];const x=ComponentFactoryService.createElement({context:"cart",type:w.PROMO_CODE_TICKER,tickers:v});return[a,x]}}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,o,s,a,d,u,m,g,v,y;this.commands.ui.openDrawer(w.ENGRAVING_FORM,{identifier:t,context:"cart",lines:(null===(o=null===(i=n.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],maxLines:(null===(a=null===(s=n.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.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===(g=null===(m=n.attributes)||void 0===m?void 0:m.engraving)||void 0===g?void 0:g.fee)||0,location:null===(y=null===(v=n.attributes)||void 0===v?void 0:v.engraving)||void 0===y?void 0:y.location})}template(){var t,n,i,o,s,a,d,u,m;const g=this.params.itemId,v=this.getStoreValue("cart.items."+g),y=this.getConfigs("global"),b=this.getStoreValue("cart.fulfillments."+v.fulfillmentId),x=v.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(t=null==b?void 0:b.expectation)||void 0===t?void 0:t.detail)||"",C=document.createElement("article");C.className="cart-item";const k=document.createElement("div");k.className="item-image";const S=document.createElement("img");S.src=v.mainImage,S.alt=v.name,k.appendChild(S);const I=document.createElement("div");I.className="item-details";const A=document.createElement("div");A.className="item-header";const P=document.createElement("h3");P.className="item-title",P.textContent=v.name;const _=document.createElement("button");_.className="item-delete",_.innerHTML=TrashIcon({}),_.setAttribute("role","button"),_.setAttribute("tabindex","0"),_.setAttribute("aria-label","Remove "+v.name+" from cart"),_.setAttribute("aria-expanded","true"),_.addEventListener("click",async()=>{await this.commands.cart.removeItem(g)}),_.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(g))}),A.appendChild(P),A.appendChild(_);const N=document.createElement("div");N.className="item-specs",N.textContent=v.size+", "+v.container;const R=document.createElement("div");R.className="item-shipping-container";const O=document.createElement("div");if(O.className="item-shipping",O.textContent=x,R.appendChild(O),y.layout.enablePersonalization&&(null===(i=null===(n=null==v?void 0:v.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.isEngravable)&&(null===(s=null===(o=null==v?void 0:v.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.hasEngraving)===![]&&b.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=y.layout.personalizationText+" +"+formatCentToDollarText((null===(d=null===(a=v.attributes)||void 0===a?void 0:a.engraving)||void 0===d?void 0:d.fee)||0,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+v.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(g,v)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(g,v))}),R.appendChild(t)}I.appendChild(A),I.appendChild(N),I.appendChild(R),C.appendChild(k),C.appendChild(I);const L=[C],M=ComponentFactoryService.createElement({type:w.CART_ITEM_QUANTITY_PRICE,itemId:g});if((null===(m=null===(u=null==v?void 0:v.attributes)||void 0===u?void 0:u.engraving)||void 0===m?void 0:m.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:w.ENGRAVING_VIEW,identifier:g,context:"cart"});L.push(t)}return L.push(M),L}}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;const i=this.getItemStore();if(!i)return 0;const o=i.partNumber,s=i.fulfillmentId,a=this.getStoreValue("cart.items")||{},d=Object.values(a).filter(t=>t.partNumber===o&&t.fulfillmentId===s),u=d.reduce((t,n)=>t+n.quantity,0),m=this.getStoreValue("products."+i.upc)||this.getStoreValue("products."+i.salsifyGrouping);if(!m)return i.maxQuantity-u;const g=(null===(n=null===(t=null==m?void 0:m.sizes)||void 0===t?void 0:t[i.liquidId])||void 0===n?void 0:n.maxQuantityPerOrder)||0;return!g||g<=0?i.maxQuantity-u:g-u}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),s=Boolean(null==t?void 0:t.code);if(!o&&s)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(o&&!s)return this.container.innerHTML="",this.createInputContainer(),void 0;if(s&&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"),s=this.getStoreValue("cart.events")||[],a=hasCartAnyPromoCodeEvents(s);this.applyButton.disabled=!n||i||Boolean(null==o?void 0:o.discountAmount)||this.isApplying||a}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:w.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 e=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",e),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e())}),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:w.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 s of i)o.has(s)||this.removeFulfillmentElement(s);for(const s of o)i.has(s)||this.addFulfillmentElement(s)}setupFulfillmentElements(){const t=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],i=this.container.querySelectorAll("[data-fulfillment-id]");for(const s of i)s.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 s of n)this.addFulfillmentElement(s)}setupSubtotalElement(){const t=this.getRetailerId(),n=this.container.querySelector("#retailer-subtotal-container");if(n){const i=ComponentFactoryService.createElement({type:w.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)||[],s=(null==n?void 0:n.fulfillments)||[];JSON.stringify(i)!==JSON.stringify(s)&&this.handleFulfillmentsUpdate(i,s)}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 F=()=>{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"),F()}),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())}),t.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),F()}}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 s=document.createElement("div");s.className="retailer-info";const a=document.createElement("h2");a.className="section-title",a.textContent=n.name,s.appendChild(a);const d=document.createElement("input");d.type="checkbox",d.id=n.id,d.className="section-toggle",s.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 m=document.createElement("span");m.className="chevron",m.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),u.appendChild(m),s.appendChild(u),o.appendChild(s),i.appendChild(o);const g=document.createElement("div");g.className="retailer-body-container";const v=document.createElement("div");v.id="retailer-fulfillment-container",g.appendChild(v);const y=document.createElement("div");return y.id="retailer-subtotal-container",g.appendChild(y),i.appendChild(g),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 s of i)o+=s.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"),s=this.getRetailerItemCount(o,t),a=1===s?"item":"items",d=document.createElement("h3");d.className="retailer-subtotal-header",d.textContent="Subtotal ("+s+" "+a+"):";const u=document.createElement("span");return u.className="retailer-subtotal-amount",u.textContent=formatCentToDollarText(n+i),[d,u]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var t,n,i;const o=this.store.get("checkout.presale"),s=this.getConfigs("global"),a=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!=a?a:d,m=this.store.get("address"),g=hasActiveItems(u,null===(i=null==m?void 0:m.address)||void 0===i?void 0:i.state),v=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),y=document.createElement("div");y.classList.add("checkout-container"),v&&y.classList.add("no-header"),this.params.isIndependentComponent&&y.classList.add("independent");const b=ComponentFactoryService.createElement({type:w.CHECKOUT_INFORMATION});y.appendChild(b);const x=ComponentFactoryService.createElement({type:w.CHECKOUT_ORDER_SUMMARY});if(y.appendChild(x),!o&&(!u.length||!g)&&v)return[y];const C=document.createElement("div");if(C.classList.add("checkout-header-wrapper"),!v){const t=ComponentFactoryService.createElement({type:w.CHECKOUT_HEADER});C.appendChild(t)}if(u.length&&g&&!o){const t=ComponentFactoryService.createElement({context:"checkout",type:w.PROMO_CODE_TICKER,tickers:u});C.appendChild(t)}if(o){const t=ComponentFactoryService.createElement({type:w.CHECKOUT_PRESALE_COUNTDOWN});C.appendChild(t)}return[C,y]}}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"),s=Boolean(o.promoCode),a=Boolean(null===(t=o.giftCards)||void 0===t?void 0:t.length),d=this.getConfigs("global"),u=Object.keys(o.onDemandFulfillmentTipInfo||{}).length>0,m=Object.values(o.items||{}),g=[],v=document.createElement("div");v.classList.add("checkout-amount-line");const y=document.createElement("span");y.textContent="Subtotal ("+m.length+" item"+(m.length>1?"s":"")+")",v.appendChild(y);const b=document.createElement("span");b.textContent=formatCentToDollarText(o.amounts.subtotal),v.appendChild(b),g.push(v);const x=document.createElement("div");x.classList.add("checkout-amount-line");const w=document.createElement("span");w.textContent="Shipping",x.appendChild(w);const C=document.createElement("span");C.textContent=formatCentToDollarText(o.amounts.shipping),x.appendChild(C),g.push(x);const k=document.createElement("div");k.classList.add("checkout-amount-line");const S=document.createElement("span");S.textContent="Delivery",k.appendChild(S);const I=document.createElement("span");if(I.textContent=formatCentToDollarText(o.amounts.delivery),k.appendChild(I),g.push(k),(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),g.push(t)}const A=document.createElement("div");A.classList.add("checkout-amount-line");const P=document.createElement("span");P.textContent="Taxes & Fees",A.appendChild(P);const _=document.createElement("span");if(_.textContent=formatCentToDollarText(o.amounts.tax+o.amounts.service+o.amounts.platform),A.appendChild(_),g.push(A),s){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 s=document.createElement("span");s.textContent="-"+formatCentToDollarText(o.amounts.discounts),t.appendChild(s),g.push(t)}if(a){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),g.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 i=document.createElement("span");i.textContent=formatCentToDollarText(o.amounts.tip),t.appendChild(i),g.push(t)}const N=document.createElement("div");N.classList.add("checkout-separator"),g.push(N);const R=document.createElement("div");R.classList.add("checkout-amount-total");const O=document.createElement("span");O.textContent="Total",R.appendChild(O);const L=document.createElement("span");if(L.textContent=formatCentToDollarText(o.amounts.total),R.appendChild(L),g.push(R),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),g.push(t);const o=document.createElement("div");o.classList.add("checkout-presale-locked-message");const s=htmlStringToElement(InfoIcon({color:d.theme.defaultTextColor}));o.appendChild(s);const a=document.createElement("p");a.textContent="Pre-ordered items will be charged when shipped.",o.appendChild(a),g.push(o)}return g}}const Dt="lce-checkout-stripe-slot",At={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},Pt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},_t={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 s=document.createElement("label");return s.textContent="Billing address same as shipping address",s.setAttribute("for","billingSameAsShipping"),s.classList.add("billing-checkbox-label"),i.appendChild(o),i.appendChild(s),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=[],i=this.billingSameAsShippingToggle();if(n.push(i),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 o=document.createElement("div");o.classList.add("section-title-container");const s=document.createElement("h3");s.textContent="Your billing info",s.classList.add("section-title"),o.appendChild(s);const a=document.createElement("p");a.textContent="Provide the info relevant to your payment method",a.classList.add("section-subtitle"),o.appendChild(a),n.push(o);const d=document.createElement("div");d.classList.add("section-form-container");const u=document.createElement("div");u.classList.add("checkout-two-col-container");const m=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(x.BILLING,{fieldName:_t.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});m.setAttribute("aria-label","First name input"),u.appendChild(m);const g=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(x.BILLING,{fieldName:_t.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});g.setAttribute("aria-label","Last name input"),u.appendChild(g),d.appendChild(u);const v=ComponentFactoryService.createElement({type:w.INPUT,inputType:"email",name:_t.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(x.BILLING,{fieldName:_t.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});v.setAttribute("aria-label","Email input"),d.appendChild(v);const y=document.createElement("div");y.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:w.INPUT,inputType:"tel",name:_t.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(x.BILLING,{fieldName:_t.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});b.setAttribute("aria-label","Phone input"),y.appendChild(b);const C=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(x.BILLING,{fieldName:_t.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});C.setAttribute("aria-label","Company input"),y.appendChild(C),d.appendChild(y);const k=document.createElement("div");k.classList.add("checkout-two-col-container");const S=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(x.BILLING,{fieldName:_t.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});S.setAttribute("aria-label","Street address input"),k.appendChild(S);const I=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(x.BILLING,{fieldName:_t.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});I.setAttribute("aria-label","Apt, suite, etc. (optional) input"),k.appendChild(I),d.appendChild(k);const A=document.createElement("div");A.classList.add("checkout-three-col-container");const P=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(x.BILLING,{fieldName:_t.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});P.setAttribute("aria-label","City input"),A.appendChild(P);const _=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.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(x.BILLING,{fieldName:_t.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","State input"),A.appendChild(_);const N=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:_t.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(x.BILLING,{fieldName:_t.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return N.setAttribute("aria-label","Zip Code input"),A.appendChild(N),d.appendChild(A),n.push(d),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=[],i=document.createElement("div");i.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Buyer Information",o.classList.add("section-title"),i.appendChild(o);const s=document.createElement("p");s.textContent="Buyer information is used to process your order and for delivery purposes.",s.classList.add("section-subtitle"),i.appendChild(s),n.push(i);const a=document.createElement("div");a.classList.add("section-form-container");const d=document.createElement("div");d.classList.add("checkout-two-col-container");const u=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:At.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});d.appendChild(u);const m=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:At.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});d.appendChild(m),a.appendChild(d);const g=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:At.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});a.appendChild(g);const v=ComponentFactoryService.createElement({type:w.INPUT,inputType:"email",name:At.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});a.appendChild(v);const y=ComponentFactoryService.createElement({type:w.INPUT,inputType:"tel",name:At.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});a.appendChild(y);const b=ComponentFactoryService.createElement({type:w.BIRTHDATE_INPUT,inputType:"date",name:At.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return a.appendChild(b),n.push(a),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),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 s=document.createElement("span");if(s.textContent="Edit",s.setAttribute("aria-label","Edit Buyer Information"),s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),s.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editCustomerForm())}),i.appendChild(s),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 a=document.createElement("p");a.classList.add("checkout-summary-form-line"),a.textContent=n.email,t.push(a);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 Nt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],Ft={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(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(Nt.includes(i)){const t=document.createElement(i),o=Ft[i]||[];for(const i of Array.from(n.attributes)){const n=i.name.toLowerCase();if(o.includes(n)){const o=sanitizeAttributeValue(n,i.value);null!==o&&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 s=document.createDocumentFragment();for(const t of Array.from(i.body.childNodes)){const n=cleanNode(t);n&&s.appendChild(n)}const a=document.createElement("div");return a.appendChild(s),a.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,o,s,a;const d=[],u=this.getConfigs("configurations"),m=this.getConfigs("global"),g=this.getConfigs("checkout"),v=this.config.layout.exitUrl||window.location.host,y=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===(o=null===(i=this.config.layout)||void 0===i?void 0:i.checkoutCompleted)||void 0===o?void 0:o.customLogo,n.alt=u.partnerName+" Logo",t.appendChild(n),d.push(t)}const b=document.createElement("div");b.classList.add("checkout-completed-section-container");const x=document.createElement("div");x.classList.add("checkout-completed-title-container");const C=document.createElement("div");C.classList.add("checkout-completed-title-section");const k=document.createElement("h3");k.innerHTML=(null===(a=null===(s=this.config.layout)||void 0===s?void 0:s.checkoutCompleted)||void 0===a?void 0:a.customText)||"Thank You for Your Order!",C.appendChild(k);const S=document.createElement("p");S.textContent="Your payment has been successfully processed.",C.appendChild(S),x.appendChild(C),b.appendChild(x);const I=document.createElement("div");I.classList.add("checkout-completed-sub-section");const A=document.createElement("div");A.classList.add("checkout-completed-line");const P=document.createElement("h3");P.textContent="Order Number",A.appendChild(P);const _=document.createElement("span");_.textContent=this.params.orderNumber,A.appendChild(_),I.appendChild(A);const N=document.createElement("div");N.classList.add("checkout-completed-line");const R=document.createElement("h3");R.textContent="Order Amount",N.appendChild(R);const O=document.createElement("span");O.textContent=""+formatCentToDollarText(this.params.orderTotal),N.appendChild(O),I.appendChild(N);const L=document.createElement("div");L.classList.add("checkout-completed-line");const M=document.createElement("h3");M.textContent="Payment Method",L.appendChild(M);const B=document.createElement("span");B.textContent="** "+this.params.cardLast4,L.appendChild(B),I.appendChild(L),b.appendChild(I);const W=document.createElement("div");W.classList.add("checkout-completed-sub-section");const q=document.createElement("p");q.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>.",W.appendChild(q),b.appendChild(W),d.push(b);const j=document.createElement("div");j.classList.add("checkout-completed-section-container");const U=document.createElement("button");U.type="button";const G=document.createElement("span");G.textContent=y,U.setAttribute("tabindex","0"),U.setAttribute("role","button"),U.setAttribute("aria-label",y),U.appendChild(G);const V=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:m.theme.selectedTextColor}));U.appendChild(V),U.addEventListener("click",()=>{window.location.href=v}),U.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=v)}),j.appendChild(U),d.push(j);const K=document.createElement("div");K.classList.add("checkout-completed-section-container");const Q=document.createElement("div");Q.classList.add("checkout-completed-help-section"),K.appendChild(Q);const X=document.createElement("p");X.textContent="Questions about your order? Contact us at ";const J=document.createElement("a");J.href="mailto:"+u.supportEmail,J.textContent=u.supportEmail,X.appendChild(J),Q.appendChild(X);const $=document.createElement("p"),tt=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if($.textContent="Order placed on "+tt,Q.appendChild($),d.push(K),g.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(g.layout.legalMessage.text);const i=document.createElement("div");i.classList.add("checkout-separator"),d.push(t),d.push(n),d.push(i)}if(m.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:w.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"),i=this.store.get("checkout.giftRecipientForm.data"),o=this.store.get("checkout.customerForm.data"),s=this.store.get("address.formattedAddress"),a=n?i:o,d=this.store.get("checkout.shippingAddressTwo"),u=this.store.get("checkout.deliveryInstructions");o.firstName&&(this.customerData.firstName={isValid:!![],value:o.firstName}),o.lastName&&(this.customerData.lastName={isValid:!![],value:o.lastName}),o.email&&(this.customerData.email={isValid:!![],value:o.email}),o.phone&&(this.customerData.phone={isValid:!![],value:o.phone}),o.company&&(this.customerData.company={isValid:!![],value:o.company}),o.birthDate&&(this.customerData.birthDate={isValid:!![],value:o.birthDate}),i.firstName&&(this.giftData.firstName={isValid:!![],value:i.firstName}),i.lastName&&(this.giftData.lastName={isValid:!![],value:i.lastName}),i.email&&(this.giftData.email={isValid:!![],value:i.email}),i.phone&&(this.giftData.phone={isValid:!![],value:i.phone}),i.message&&(this.giftData.message={isValid:!![],value:i.message}),d&&(this.customerData.addressTwo={isValid:!![],value:d},this.giftData.addressTwo={isValid:!![],value:d}),u&&(this.customerData.deliveryInstructions={isValid:!![],value:u},this.giftData.deliveryInstructions={isValid:!![],value:u});const m=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 C=document.createElement("h3");C.textContent="Deliver to",C.classList.add("delivery-title");const k=document.createElement("p");k.textContent="Package recipient must be 21+",k.classList.add("delivery-subtitle"),b.appendChild(C),b.appendChild(k),v.appendChild(b),g.push(v);const S=document.createElement("div");S.classList.add("section-form-container");const I=document.createElement("div");I.classList.add("checkout-two-col-container");const A=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:n?Pt.firstName:At.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:a.firstName,onChange:t=>{n?(this.giftData.firstName.value=t,this.pubSub.publishForm(x.GIFT,{fieldName:Pt.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.firstName}))},onValidation:t=>{n?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});A.setAttribute("aria-label","First Name Input"),I.appendChild(A);const P=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:n?Pt.lastName:At.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:a.lastName,onChange:t=>{n?(this.giftData.lastName.value=t,this.pubSub.publishForm(x.GIFT,{fieldName:Pt.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.lastName}))},onValidation:t=>{n?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(P.setAttribute("aria-label","Last Name Input"),I.appendChild(P),S.appendChild(I),!n){const t=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:At.company,label:"Company (optional)",autocomplete:!![],value:a.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),S.appendChild(t)}const _=ComponentFactoryService.createElement({type:w.INPUT,inputType:"email",name:n?Pt.email:At.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:a.email,onChange:t=>{n?(this.giftData.email.value=t,this.pubSub.publishForm(x.GIFT,{fieldName:Pt.email})):(this.customerData.email.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.email}))},onValidation:t=>{n?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","Email Input"),S.appendChild(_);const N=ComponentFactoryService.createElement({type:w.INPUT,inputType:"tel",name:n?Pt.phone:At.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:a.phone,onChange:t=>{n?(this.giftData.phone.value=t,this.pubSub.publishForm(x.GIFT,{fieldName:Pt.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.phone}))},onValidation:t=>{n?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(N.setAttribute("aria-label","Phone Input"),S.appendChild(N),!n){const t=ComponentFactoryService.createElement({type:w.BIRTHDATE_INPUT,inputType:"date",name:At.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:a.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),S.appendChild(t)}const R=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:s,disabled:!![],className:"disabled-input"});R.setAttribute("aria-label","Delivery Address Input"),S.appendChild(R);const O=ComponentFactoryService.createElement({type:w.INPUT,inputType:"text",name:n?Pt.addressTwo:At.addressTwo,label:"Apt, suite, etc. (optional)",value:d,onChange:t=>{n?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(x.GIFT,{fieldName:Pt.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(x.CUSTOMER,{fieldName:At.addressTwo}))},onValidation:t=>{n?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(O.setAttribute("aria-label","Address Line 2 Input"),S.appendChild(O),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",Pt.message);const s=document.createElement("textarea");s.name=Pt.message,s.id=Pt.message,s.rows=4,s.value=i.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(x.GIFT,{fieldName:Pt.message}),this.updateSaveButtonState()});const a=document.createElement("p");a.textContent="Your gift message will be emailed to the recipient along with delivery details.",a.classList.add("textarea-message-disclaimer"),n.appendChild(o),n.appendChild(s),n.appendChild(a),S.appendChild(n)}if(m){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 s=document.createElement("textarea");s.id="delivery_instructions",s.name="delivery_instructions",s.rows=4,s.setAttribute("aria-label","Delivery Instructions Textarea"),s.value=u,s.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 a=document.createElement("p");a.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",a.classList.add("textarea-message-disclaimer"),i.appendChild(o),i.appendChild(s),i.appendChild(a),S.appendChild(i)}g.push(S),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const H=async()=>{n?await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}):await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:this.customerData.deliveryInstructions.value})};return this.saveButton.addEventListener("click",H),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await H())}),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"),i=this.getStoreValue("checkout.customerForm.data"),o=this.getStoreValue("checkout.giftRecipientForm.data"),s=this.getStoreValue("address"),a=this.getStoreValue("checkout.deliveryInstructions"),d=this.getStoreValue("checkout.shippingAddressTwo"),u=document.createElement("div");u.classList.add("checkout-summary-form-header");const m=document.createElement("h2");m.textContent=n?"Delivering to "+o.firstName+" "+o.lastName:"Delivering to "+i.firstName+" "+i.lastName,u.appendChild(m);const g=document.createElement("span");g.textContent="Edit",g.setAttribute("aria-label","Edit Delivery Information"),g.setAttribute("role","button"),g.setAttribute("tabindex","0");const Y=async()=>{n?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(g.addEventListener("click",Y),g.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await Y())}),u.appendChild(g),t.push(u),!n&&i.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=i.company,t.push(n)}const v=document.createElement("p");v.classList.add("checkout-summary-form-line"),v.textContent=s.address.one+(d?", "+d:"")+", "+s.address.city+", "+s.address.state+", "+s.address.zip,t.push(v);const y=document.createElement("p");y.classList.add("checkout-summary-form-line"),y.textContent=n?o.email:i.email,t.push(y);const b=document.createElement("p");if(b.classList.add("checkout-summary-form-line"),b.textContent=n?o.phone:i.phone,t.push(b),!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 s=document.createElement("span");s.classList.add("checkout-summary-form-line"),s.textContent=o.message||"No message provided.",n.appendChild(s),t.push(n)}if(a){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=a||"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:w.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 e=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",e),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e())}),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(w.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),i.appendChild(t)}const o=document.createElement("h1");o.textContent=(null==n?void 0:n.layout.drawerHeaderText)||"Checkout",o.classList.add("checkout-header-title"),o.setAttribute("aria-label","Checkout Page");const 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,o,s]:[o,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"),o=this.getStoreValue("checkout.giftRecipientForm"),s=this.getStoreValue("checkout.paymentForm"),a=ComponentFactoryService.createElement({type:w.CHECKOUT_SEND_AS_GIFT});return t.push(a),this.deliveryToForm=ComponentFactoryService.createElement({type:w.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=n?o.isEditing?"block":"none":i.isEditing?"block":"none",t.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:w.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=n?o.isEditing?"none":"block":i.isEditing?"none":"block",t.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:w.CHECKOUT_BUYER}),this.buyerForm.style.display=n&&i.isEditing?"block":"none",t.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:w.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=n&&!i.isEditing?"block":"none",t.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:w.CHECKOUT_PAYMENT}),this.paymentForm.style.display=s.isEditing?"block":"none",t.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:w.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,s;const a=t.find(t=>"checkout.items"===t.path);a&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const d=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(d){const t=d.oldValue,a=d.value;if(a.updating)return![];const u=(null==t?void 0:t.quantity)!==(null==a?void 0:a.quantity),m=(null===(i=null===(n=null==t?void 0:t.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[],g=(null===(s=null===(o=null==a?void 0:a.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||[],v=JSON.stringify(m)!==JSON.stringify(g);(u||v)&&this.updateEngravingElement(a)}return![]}updateEngravingElement(t){var n,i;const o=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)===!![]&&o.layout.enablePersonalization){const n=ComponentFactoryService.createElement({type:w.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 o=this.getStoreValue("cart.fulfillments."+n),s=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(s&&s.remove(),o&&shouldShowMinimumPurchaseAlert(o,t.pack)){const n=getMinimumPurchaseMessage(o,t.pack),s=ComponentFactoryService.createElement({type:w.PURCHASE_MIN_ALERT,message:n.message,messageType:n.type,currentTotal:o.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 o=this.getConfigs("global"),s=this.getStoreValue("checkout.items."+this.params.itemId),a=null===(t=null==s?void 0:s.attributes)||void 0===t?void 0:t.presale,d=(null==a?void 0:a.isActive)&&(null==a?void 0:a.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(a.estimatedShipBy):"";if(!s)return[];const u=document.createElement("div");u.classList.add("checkout-item-card-header");const m=document.createElement("div");m.classList.add("checkout-item-image");const g=document.createElement("img");g.src=s.mainImage,g.alt=s.name,g.loading="lazy",m.appendChild(g),u.appendChild(m);const v=document.createElement("div");v.classList.add("checkout-item-details-container");const y=document.createElement("h4");y.classList.add("checkout-item-title"),y.textContent=s.name,v.appendChild(y);const b=document.createElement("div");b.classList.add("checkout-item-subtitle");const x=document.createElement("span");x.textContent=a.isActive?""+d:((null==s?void 0:s.expectationDetail)||"")+",",b.appendChild(x);const C=document.createElement("span");C.textContent="From "+((null==s?void 0:s.retailerName)||""),b.appendChild(C),v.appendChild(b),u.appendChild(v),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 k=ComponentFactoryService.createElement({type:w.CHECKOUT_ITEM_QUANTITY,itemId:s.cartItemId}),S=[];if(S.push(u),o.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:w.ENGRAVING_VIEW,identifier:s.cartItemId,context:"checkout"});S.push(t)}return S.push(k),S}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(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 s=this.getStoreValue("products");if(!s)return 0;const a=o.partNumber,d=o.fulfillmentId,u=null===(i=null===(n=null===(t=Object.values(s).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.maxQuantityPerOrder;if(!u)return 0;const m=this.getStoreValue("checkout.items")||{},g=Object.values(m).filter(t=>t.partNumber===a&&t.fulfillmentId===d),v=g.reduce((t,n)=>t+n.quantity,0);return u-v}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),s=n.quantity,a=this.getAvailableQuantity(),d=a>0,u=!(o&&1===s);return{currentQuantity:s,availableQuantity:a,isTheOnlyItem:o,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(),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:w.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 s of i){const t=s.getAttribute("data-item-id");t&&o.add(t)}for(const s of i){const t=s.getAttribute("data-item-id");t&&!n.has(t)&&s.remove()}for(const[s]of n)if(!o.has(s)){const n=this.createItemElement(s);n.setAttribute("data-item-id",s),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 s=document.createElement("button");s.type="button",s.classList.add("checkout-items-toggler-button"),s.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),i.appendChild(s);const a=document.createElement("div");a.classList.add("checkout-items-list","show");for(const d of n){const t=this.createItemElement(d.cartItemId);t.setAttribute("data-item-id",d.cartItemId),a.appendChild(t)}return[i,a]}}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 s=document.createElement("span");s.id="emailOptIn",s.classList.add("checkout-checkbox-visual"),o&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),s.setAttribute("role","checkbox"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Email opt-in checkbox"),s.setAttribute("aria-checked",o?"true":"false"),s.addEventListener("click",()=>this.handleEmailToggle(s)),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(s))});const a=document.createElement("label");a.setAttribute("for","emailOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(t.text),a.addEventListener("click",t=>{const n=t.target,i="A"===n.tagName||n.closest("a");i||(this.commands.checkout.toggleMarketingPreferences("canEmail"),s.classList.toggle("checked"))}),n.appendChild(s),n.appendChild(a),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 s=document.createElement("span");s.classList.add("checkout-checkbox-visual"),s.id="smsOptIn",o&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),s.setAttribute("role","checkbox"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","SMS opt-in checkbox"),s.setAttribute("aria-checked",o?"true":"false"),s.addEventListener("click",()=>this.handleSmsToggle(s)),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(s))});const a=document.createElement("label");a.setAttribute("for","smsOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(n.text),a.addEventListener("click",t=>{const n=t.target,i="A"===n.tagName||n.closest("a");i||(this.commands.checkout.toggleMarketingPreferences("canSms"),s.classList.toggle("checked"))}),t.appendChild(s),t.appendChild(a),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"),o=this.getConfigs("checkout"),s=this.getConfigs("global"),a=o.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 m=document.createElement("h3");m.textContent="Order Summary",m.classList.add("section-title"),u.appendChild(m),n.push(u);const g=ComponentFactoryService.createElement({type:w.CHECKOUT_ITEMS});n.push(g);const v=document.createElement("div");v.classList.add("checkout-separator");const y=document.createElement("div");if(y.classList.add("checkout-separator"),n.push(v),a||d){const t=ComponentFactoryService.createElement({type:w.CHECKOUT_PC_GC});n.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:w.CHECKOUT_TIPS});n.push(t),n.push(y)}const b=document.createElement("div");b.classList.add("section-title-container");const x=document.createElement("h3");x.textContent="100% Secure Payments",x.classList.add("disclaimer-header"),b.appendChild(x);const C=document.createElement("p");C.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.",C.classList.add("disclaimer-description"),b.appendChild(C),n.push(b);const k=ComponentFactoryService.createElement({type:w.CHECKOUT_AMOUNTS});n.push(k);const S=ComponentFactoryService.createElement({type:w.CHECKOUT_PLACE_ORDER_BUTTON});n.push(S);const I=this.marketingOptInsContainer();if(I&&n.push(I),o.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(o.layout.legalMessage.text),n.push(t),n.push(i)}const A=document.createElement("div");if(A.classList.add("checkout-separator"),n.push(A),i.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:w.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.hardcodedPaymentElement=null,this.billingFormData=null,this.isValidBillingForm=![],this.isBillingSameAsShipping=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.savedCardInfo=null,this.showingStripeSummary=![],this.isSavingPayment=![]}onStoreWatch(t){for(const 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:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(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 o=document.createElement("p");if(o.textContent="All transactions are secure and encrypted.",o.classList.add("section-subtitle"),n.appendChild(o),t.push(n),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const n=document.createElement("p");n.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(n),t.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:w.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 s=ComponentFactoryService.createElement({type:w.CHECKOUT_BILLING,isFormValid:(t,n)=>{this.billingFormData=n,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return t.push(s),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleSaveButtonClick())}),t.push(this.saveButton),t}async handleSaveButtonClick(){var t;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(n){this.logger.error("Failed to save payment form in edit mode",n),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const 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 beta mode",i),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,s,a,d,u,m,g;const v=[],y=this.getStoreValue("checkout.paymentForm"),b=document.createElement("div");b.classList.add("checkout-summary-form-header");const x=document.createElement("h2");x.textContent="Paying with "+capitalizeFirstLetter(null!==(i=null===(n=null===(t=y.paymentMethod)||void 0===t?void 0:t.card)||void 0===n?void 0:n.brand)&&void 0!==i?i:"")+" "+(null===(s=null===(o=y.paymentMethod)||void 0===o?void 0:o.card)||void 0===s?void 0:s.last4),b.appendChild(x);const w=document.createElement("span");w.textContent="Edit",w.setAttribute("aria-label","Edit Payment Information"),w.setAttribute("role","button"),w.setAttribute("tabindex","0"),w.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),w.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editPaymentForm())}),b.appendChild(w),v.push(b);const C=document.createElement("p");return C.classList.add("checkout-summary-form-line"),C.textContent="Exp. "+(null===(d=null===(a=y.paymentMethod)||void 0===a?void 0:a.card)||void 0===d?void 0:d.expMonth)+"/"+(null===(g=null===(m=null===(u=y.paymentMethod)||void 0===u?void 0:u.card)||void 0===m?void 0:m.expYear)||void 0===g?void 0:g.slice(-2)),v.push(C),v}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.error","checkout.customerForm.isValid","checkout.giftRecipientForm.isValid","checkout.paymentForm.isValid"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreWatch(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 s=![];if(!o){const t=this.getStoreValue("cart.fulfillments")||{};s=Object.values(t).some(t=>hasUnmetMinimum(t))}const a=this.store.get("checkout.isGift"),d=this.store.get("checkout.customerForm.isValid"),u=this.store.get("checkout.giftRecipientForm.isValid"),m=this.store.get("checkout.paymentForm.isValid");return s||a&&!u||!d||!m?{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 o=document.createElement("span");o.classList.add("icon-error"),o.innerHTML=ErrorInfoIcon({});const s=document.createElement("span");s.classList.add("error-text"),i.appendChild(o),i.appendChild(s),n.appendChild(i);const a=ComponentFactoryService.createElement({type:w.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[n,a,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 s of i){const n=null===(t=this.rootElement)||void 0===t?void 0:t.closest(s);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,s=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<s&&(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,s=Math.max(0,Math.min(100,o/this.totalDuration*100)),a=i<60;if(a!==this.isUnderOneMinute){this.isUnderOneMinute=a;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=s+"%"),0===n&&this.handleExpire()}formatTime(t){const n=Math.floor(t/1e3),i=Math.floor(n/60),o=n%60,s=Math.floor(t%1e3/10);return i.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")+":"+s.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 s=document.createElement("div");s.classList.add("checkout-presale-timer"),s.setAttribute("data-timer",""),s.textContent="00:00:00",i.appendChild(o),i.appendChild(s);const a=document.createElement("p");a.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",a.classList.add("checkout-presale-subtitle"),n.appendChild(i),n.appendChild(a);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"),i=document.createElement("div");i.classList.add("checkout-completed-section-container");const o=document.createElement("div");o.classList.add("checkout-completed-title-section");const s=document.createElement("div");s.classList.add("checkout-completed-title-section");const a=document.createElement("p");a.classList.add("presale-expired-title"),a.textContent="Session Expired",s.appendChild(a);const d=document.createElement("p");d.textContent="Your reservation time has ended. The item has been released for other customers.",s.appendChild(d),o.appendChild(s),i.appendChild(o);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 m=document.createElement("div");m.classList.add("checkout-completed-section-container");const g=document.createElement("button");g.setAttribute("aria-label","Continue shopping"),g.type="button";const v=document.createElement("span");v.textContent="Continue Shopping",g.setAttribute("tabindex","0"),g.setAttribute("role","button"),g.setAttribute("aria-label","Continue Shopping"),g.appendChild(v);const y=htmlStringToElement(ArrowRightIcon({width:16,height:16}));g.appendChild(y),g.addEventListener("click",()=>this.handleExit()),g.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),m.appendChild(g),t.push(m);const b=document.createElement("div");b.classList.add("checkout-completed-section-container");const x=document.createElement("p");x.classList.add("checkout-completed-auto-close-text"),x.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 C=document.createElement("span");if(C.classList.add("checkout-completed-auto-close-text"),C.textContent="seconds",b.appendChild(x),b.appendChild(this.autoCloseElement),b.appendChild(C),t.push(b),n.layout.showPoweredBy){const n=document.createElement("div");n.classList.add("checkout-completed-powered-by-container");const i=ComponentFactoryService.createElement({type:w.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),s=Boolean(t);if(!o&&s)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(o&&!s)return this.container.innerHTML="",this.createInputContainer(),void 0;s&&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"),s=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!n||i||Boolean(o)||Boolean(s)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:w.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 e=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",e),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e())}),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 s=document.createElement("div");s.classList.add("toggle-switch"),s.classList.toggle("active",t);const a=document.createElement("div");return a.classList.add("toggle-slider"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Toggle Gift Option"),s.setAttribute("role","switch"),s.setAttribute("aria-checked",t?"true":"false"),s.appendChild(a),s.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),s.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),[n,s]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.N=![],this.F=null,this.R=null,this.O=null,this.L=![],this.M=![],this.B=![],this.W=null}async initialize({data:t}){if(this.N)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.N=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.F=window.Stripe(t.publishableKey),this.R=this.F.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.O=this.R.create("payment",t.elementOptions),this.O.mount(this),this.O.on("change",async t=>{const n=!!t.error,i=t.complete,o=n?t.error.message:null;this.M=i,this.L||await this.updateStripeFormStatus({isFormComplete:i,isProcessing:![],hasCompletedPayment:![],errorMessage:o,hasError:n})}),this.O.on("focus",async()=>{this.L||await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.B=![]}catch(t){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(t){const{stripeConfig:n}=t.detail;n&&(this.q=n,await this.refreshPaymentSession())}async handleSubmit(){var t,n;if(this.L)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.M)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.L=!![],await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.B&&(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.B=!![],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.B=!![],await this.updateStripeFormStatus({isFormComplete:this.M,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.L=![]}}async requestSessionRefresh(){return this.W||(this.W=new Promise((t,n)=>{const i=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",D),this.W=null,n(new Error("Session refresh timeout"))},1e4),D=()=>{clearTimeout(i),this.removeEventListener("lce:s:refreshSession",D),this.W=null,t()};this.addEventListener("lce:s:refreshSession",D,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.W}async refreshPaymentSession(){try{this.R&&this.R.update({clientSecret:this.q.clientSecret}),this.B=![],await this.updateStripeFormStatus({isFormComplete:this.M,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(ht){console.error("Failed to refresh payment session:",ht),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.O&&this.O.clear(),this.M=![],this.B=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(ht){console.error("Failed to reset form:",ht)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.R)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.R.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const n={elements:this.R,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.F.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.W=null,this.O&&(this.O.unmount(),this.O=null),this.R&&(null===(n=(t=this.R).destroy)||void 0===n?void 0:n.call(t),this.R=null),this.F=null,this.L=![],this.M=![],this.B=![],this.N=![],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,s;(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===(s=(o=this.callbacks).onSavedCardInfoChanged)||void 0===s||s.call(o,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(t){this.isInEditMode=t,this.updateDisplayState()}updateDisplayState(){var t,n,i,o,s,a;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===(a=(s=this.callbacks).onEditModeVisibilityChanged)||void 0===a||a.call(s,![]))}async afterRender(){var t,n,i,o;this.isInEditMode=null!==(t=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==t?t:![];const s=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(n=null==s?void 0:s.card)||void 0===n?void 0:n.brand)&&s.card.last4&&(this.savedCardInfo={brand:s.card.brand,last4:s.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,s,a;try{const{confirmationTokenId:o,setupIntentId:s}=t.detail;await(null===(i=(n=this.callbacks).onPaymentSessionConfirmed)||void 0===i?void 0:i.call(n,o,s)),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===(s=(o=this.callbacks).onStripeFormStatusChanged)||void 0===s||s.call(o,this.stripeFormStatus),null===(a=this.stripeFormElement)||void 0===a||a.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.setAttribute("aria-label","Change Payment Method"),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.addEventListener("click",()=>this.handleChangePayment()),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),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;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(n=(t=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(t,this.stripeFormStatus),this.updateDisplayState()}template(){const t=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",t.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const n=document.createElement("slot");return n.setAttribute("name",Dt),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"),o=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(w.LCE_ELEMENT),s=t.hasAttribute("drawer"),a=(null==n?void 0:n.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(w.DRAWER),d="checkout"===(null==n?void 0:n.getAttribute("data-target"));if(i||o&&s&&a&&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");!this.isChangingPayment&&(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 o=this.findRootComponent();if(!o)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const s=o.querySelectorAll('[slot="'+Dt+'"]');if(s.length>0)for(const d of s)d.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:w.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",Dt),o.appendChild(this.stripeFormElement)}catch(a){this.logger.error("Stripe form element creation failed",a),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 s=Math.round(100*n);try{await this.commands.checkout.updateFulfillmentTip(t,s)}catch(a){this.logger.error("Checkout fulfillment tip update failed",a)}}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 s of n){const n=document.createElement("button");n.type="button",n.textContent=s+"%",n.classList.add("checkout-tip-button"),n.disabled=i,o===s&&n.classList.add("selected"),n.addEventListener("click",()=>this.handlePercentageSelect(s)),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 s=document.createElement("button");s.type="button",s.classList.add("checkout-items-toggler-button"),s.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),i.appendChild(s),t.appendChild(i);const a=document.createElement("div");a.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 i=document.createElement("div");i.classList.add("checkout-tip-fulfillment-input-wrapper");const o=document.createElement("div");o.classList.add("dollar-input-container");const s=document.createElement("span");s.classList.add("dollar-sign"),s.textContent="$";const u=document.createElement("input");let m;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 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))}}),u.addEventListener("input",t=>{const n=t.target,i=Number.parseFloat(n.value)||0;m&&clearTimeout(m),m=setTimeout(()=>{this.handleFulfillmentTipInput(d.fulfillmentId,i)},500)}),o.appendChild(s),o.appendChild(u),i.appendChild(o);const g=document.createElement("button");g.type="button",g.textContent="Remove",g.classList.add("checkout-tip-remove-button"),g.disabled=this.getStoreValue("checkout.updating")||![],g.addEventListener("click",()=>this.removeTipFromFulfillment(d.fulfillmentId)),i.appendChild(g),t.appendChild(i),a.appendChild(t)}return t.appendChild(a),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 s=document.createElement("div");s.classList.add("checkout-tip-config-container");const a=this.createTipSelectionButtons();s.appendChild(a),i.appendChild(s);const d=document.createElement("p");d.classList.add("checkout-tip-disclaimer"),d.textContent="Tips will be split proportionally between retailers.",i.appendChild(d);const u=this.createTipDistribution();return t.push(i,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,i;const o=t.find(t=>"checkout.giftCardError"===t.path),s=t.find(t=>"checkout.promoCodeError"===t.path),a=t.find(t=>"checkout.giftCards"===t.path);if(a&&this.updateAppliedGiftCards(a.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 s=t.querySelector(".apply-button");s&&(s.disabled=Boolean(o.value))}}if(s){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()),s.value){const n=this.createErrorElement(s.value);t.after(n)}const o=t.querySelector(".apply-button");o&&(o.disabled=Boolean(s.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:w.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return t}gcInputContainer(){const t=ComponentFactoryService.createElement({type:w.CHECKOUT_GIFT_CARDS});return t}inputContainer(){var t;const n=this.getConfigs("checkout"),i=this.getConfigs("global"),o=n.layout.allowGiftCards,s=null===(t=null==i?void 0:i.layout)||void 0===t?void 0:t.allowPromoCodes,a=document.createElement("div");a.classList.add("checkout-pc-gc-sub-container");const d=this.pcInputContainer(),u=this.gcInputContainer();s&&a.appendChild(d);const m=this.getStoreValue("checkout.promoCodeError");if(m){const t=this.createErrorElement(m);t.classList.add("promo-code-error-wrapper"),a.appendChild(t)}o&&a.appendChild(u);const g=this.getStoreValue("checkout.giftCardError");if(g){const t=this.createErrorElement(g);a.appendChild(t)}return a}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 renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:n,isSelected:i,selectedSizeAttributes:o}){var s,a,d,u,m,g,v,y;const b=n===C.ON_DEMAND;let x=null;b&&t.hourStatus.openTime&&(null===(s=t.hourStatus)||void 0===s?void 0:s.closeTime)&&(x=t.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(a=t.hourStatus)||void 0===a?void 0:a.closeTime):"Opens at "+format24TimeTo12(null===(d=t.hourStatus)||void 0===d?void 0:d.openTime));const w=b&&t.hourStatus.isClosed?"closed":"",k=document.createElement("div");k.className="popup-retailer-card "+(i?"selected":"")+" "+w,k.setAttribute("data-fulfillment-id",t.id),k.setAttribute("role","button"),k.setAttribute("tabindex","0"),k.setAttribute("aria-pressed",i?"true":"false");const S=n===C.SHIPPING?"Shipping":"Same-day delivery";k.setAttribute("aria-label",S+" from "+t.retailerName+", "+formatCentToDollarText(null!==(u=t.variant.price)&&void 0!==u?u:0));const I=document.createElement("div");I.className="row";const A=document.createElement("span");A.className="name",A.textContent=t.retailerName,I.appendChild(A);const P=document.createElement("span");P.className="price",P.textContent=formatCentToDollarText(null!==(m=t.variant.price)&&void 0!==m?m:0),I.appendChild(P),k.appendChild(I);const _=document.createElement("div");_.className="row";const N=document.createElement("span");N.className="expectation",N.textContent=t.hourStatus.isClosed?x:(null===(g=null==o?void 0:o.presale)||void 0===g?void 0:g.isActive)?(null===(v=null==o?void 0:o.presale)||void 0===v?void 0:v.isActive)&&(null===(y=null==o?void 0:o.presale)||void 0===y?void 0:y.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==o?void 0:o.presale.estimatedShipBy):"":null==t?void 0:t.expectationText,_.appendChild(N);const R=document.createElement("span");if(R.className="fee",R.textContent=t.fee>0?formatCentToDollarText(t.fee):"Free Delivery",_.appendChild(R),k.appendChild(_),b){const n=document.createElement("div");n.className="row";const i=document.createElement("span");i.className="address",i.textContent=t.retailerAddressFormatted,n.appendChild(i),k.appendChild(n)}return k}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:n,shippingSelected:i,onDemandSelected:o,onTabClick:s,enableShippingFulfillment:a,enableOnDemandFulfillment:d}){const u=n.length>0,m=document.createElement("div");if(m.className="fulfillment-tabs-container",m.setAttribute("role","tablist"),m.setAttribute("aria-label","Delivery method options"),a){const n=document.createElement("div");n.className="fulfillment-tab "+(i?"selected":""),n.setAttribute("data-fulfillment-type",C.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),m.appendChild(n)}if(d){const t=document.createElement("div");t.className="fulfillment-tab "+(o?"selected":"")+" "+(u?"":"disabled"),t.setAttribute("data-fulfillment-type",C.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),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(),i=this.getStoreValue("products."+n);if(!i.selectedFulfillment||!i.selectedSizeId)return 0;const o=i.selectedFulfillment.variant.partNumber,s=i.selectedFulfillment.id,a=null===(t=i.sizes[i.selectedSizeId])||void 0===t?void 0:t.maxQuantityPerOrder;if(!a)return 0;const d=this.getStoreValue("cart.items")||{},u=Object.values(d).filter(t=>t.partNumber===o&&t.fulfillmentId===s),m=u.reduce((t,n)=>t+n.quantity,0);return a-m}isFulfillmentClosed(){const t=this.getProductId(),n=this.getStoreValue("products."+t);return n.selectedFulfillment?n.selectedFulfillmentType===C.ON_DEMAND&&n.selectedFulfillment.hourStatus.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(),s=this.getStoreValue("products."+o);if(!s.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:o,selectedSizeId:s.selectedSizeId}),void 0;const a=this.getSizeAttributes(),d=(null===(t=null==a?void 0:a.presale)||void 0===t?void 0:t.isActive)===!![],u=this.isPresaleActive(a);d&&u?await this.commands.product.addPresaleToCart(o,{upc:s.sizes[s.selectedSizeId].upc,fulfillmentId:s.selectedFulfillment.id,partNumber:null===(n=s.selectedFulfillment)||void 0===n?void 0:n.variant.partNumber,quantity:s.quantity,identifier:o}):await this.commands.product.addToCart(o,{upc:s.sizes[s.selectedSizeId].upc,fulfillmentId:s.selectedFulfillment.id,partNumber:null===(i=s.selectedFulfillment)||void 0===i?void 0:i.variant.partNumber,quantity:s.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.variant.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(),s=(null===(t=null==i?void 0:i.presale)||void 0===t?void 0:t.isActive)===!![],a=this.isPresaleActive(i),d=s?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?d+" - "+formatCentToDollarText(n):d;const u=s&&!a||0===o.availableQuantity||this.isFulfillmentClosed(),m=this.isButtonLoading(),g=this.config.layout.addToCartButtonShowTotalPrice?d+" for "+formatCentToDollarText(n):d;return this.addToCartButton.setAttribute("aria-label",g),this.addToCartButton.setAttribute("aria-busy",m.toString()),this.addToCartButton.setAttribute("aria-disabled",u.toString()),u&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),m&&(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 s=this.createAddToCartButton();return o.push(s),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:",s="See More",a="See Less",d=document.createElement("h3");d.className="title",d.textContent=o;const u=document.createElement("div");u.className="content collapsed",u.innerHTML=""===(null==i?void 0:i.trim())?n:sanitizeHTML(i);const m=document.createElement("span");m.className="collapse-button",m.textContent=s,m.setAttribute("role","button"),m.setAttribute("tabindex","0"),m.setAttribute("aria-label","Show more product information"),m.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,u.classList.toggle("collapsed"),m.textContent=this.isCollapsed?s:a,m.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),m.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return m.addEventListener("click",toggleContent),m.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[d,u,m]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(t){var n;const i=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!i)return![];const o=i.value,s=o.isOpen,a=null===(n=o.contentConfig)||void 0===n?void 0:n.type,d=a!==this.currentContentType;return s&&!this.isOpen?(this.currentContentType=a,this.openWithContent(o),![]):s&&this.isOpen&&!d?![]:s&&this.isOpen&&d?(this.currentContentType=a,this.openWithContent(o),![]):!s&&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||{},s=ComponentFactoryService.createElement({type:i,...o});this.contentContainer&&this.contentContainer.appendChild(s),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}.selectedSizeId"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){var n;const i=this.params.productId,o=t.find(t=>t.path==="products."+i+".selectedSizeId");if(null==o?void 0:o.value){const t=this.getStoreValue("products."+i),s=null===(n=null==t?void 0:t.sizes)||void 0===n?void 0:n[o.value],a=null==s?void 0:s.image;if(a){const t=this.params.images.indexOf(a);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+a+"')")}}}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 s=0;s<o.length;s++){const n=o[s];n.classList.toggle("active",s===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,s=i/2,a=s-o,d=0,u=-(this.galleryContainer.scrollWidth-i);this.translateX=Math.max(u,Math.min(d,a)),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,s=t.changedTouches[0].clientY-o;Math.abs(n)>Math.abs(s)&&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,s=0,a=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(a,Math.min(s,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 s=document.createElement("div");s.className="gallery-container";for(let a=0;a<this.params.images.length;a++){const t=this.params.images[a],n=document.createElement("div");n.className="gallery-image-wrapper "+(0===a?"selected":"");const i=document.createElement("img");i.src=t,i.className="gallery-image",i.alt="Product thumbnail "+(a+1),i.loading="lazy",n.appendChild(i),s.appendChild(n)}return o.appendChild(s),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;const i=this.getProductId();if(!t.some(t=>t.path==="products."+i+".selectedFulfillmentType"))return;const o=this.getStoreValue("products."+i),s=this.getConfigs("global");this.addPersonalizationSpan&&(o.selectedFulfillmentType===C.SHIPPING&&s.layout.enablePersonalization&&o.productHasAvailability&&(null===(n=null==o?void 0:o.selectedFulfillment)||void 0===n?void 0:n.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),n=this.container.querySelectorAll("[select-size]");for(const i of n){const o=i.textContent||"",s=i.classList.contains("selected");i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label","Select "+o),i.setAttribute("aria-pressed",s?"true":"false"),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}),i.addEventListener("click",async()=>{var o;const s=i.dataset.sizeId;if(!s)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,s);for(const t of n)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");i.classList.add("selected"),i.setAttribute("aria-pressed","true");const a=this.getStoreValue("products."+t),d=this.getConfigs("global");this.addPersonalizationSpan&&(d.layout.enablePersonalization&&a.productHasAvailability&&(null===(o=a.selectedFulfillment)||void 0===o?void 0:o.variant.isEngravable)===!![]?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 s=document.createElement("div");s.className="size-buttons-container",s.setAttribute("role","group"),s.setAttribute("aria-labelledby","size-label");for(const a of Object.values(n)){const n=document.createElement("span");n.setAttribute("data-size-id",a.id),n.setAttribute("select-size",""),n.className="size-button "+(a.id===t?"selected":"");const i=a.packDesc?" ("+a.packDesc+")":"";n.textContent=""+a.size+i,s.appendChild(n)}return i.appendChild(s),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;const i=this.getProductId(),o=this.getStoreValue("products."+i),s=o.sizes[o.selectedSizeId],a=this.getConfigs("global"),d=[],u=document.createElement("div");u.className="price-personalization-container";const m=ComponentFactoryService.createElement({type:w.PRODUCT_PRICE,productId:i});if(u.appendChild(m),a.layout.enablePersonalization&&o.productHasAvailability&&(null===(t=null==o?void 0:o.selectedFulfillment)||void 0===t?void 0:t.variant.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="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,s,a,d,u,m,g;const v=o.sizes[o.selectedSizeId];await this.commands.product.openProductDrawer(i,w.ENGRAVING_FORM,{identifier:i,context:"product",lines:[],maxLines:(null===(n=null===(t=v.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.maxLines)||1,maxCharsPerLine:(null===(a=null===(s=v.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.maxCharsPerLine)||16,fee:(null===(u=null===(d=v.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.fee)||0,location:null===(g=null===(m=v.attributes)||void 0===m?void 0:m.engraving)||void 0===g?void 0:g.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),u.appendChild(this.addPersonalizationSpan)}d.push(u);const g=this.renderProductSizes(o.selectedSizeId,o.sizes);if(d.push(g),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:w.ADDRESS_DISPLAY,productId:i});d.push(t)}const v=ComponentFactoryService.createElement({type:w.PRODUCT_RETAILERS,productId:i});d.push(v);const y=ComponentFactoryService.createElement({type:w.PRODUCT_ADD_TO_CART_SECTION,productId:i});d.push(y);const b=null===(n=null==s?void 0:s.attributes)||void 0===n?void 0:n.presale;if((null==b?void 0:b.isActive)===!![]&&(null==b?void 0:b.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==b?void 0:b.language)||""),d.push(t)}if(this.config.layout.showDescription&&(o.description.trim().length>0||o.htmlDescription.trim().length>0)){const t=ComponentFactoryService.createElement({type:w.PRODUCT_DESCRIPTION,productId:i});d.push(t)}return d}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:n,showDescription:i,showQuantityCounter:o,fulfillmentDisplay:s,showImages:a}=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 m=document.createElement("div");m.classList.add("wave","sc-price"),u.appendChild(m);const g=document.createElement("div");g.classList.add("sc-sizes");const v=document.createElement("div");v.classList.add("wave","sc-size-button"),g.appendChild(v);const y=document.createElement("div");y.classList.add("wave","sc-size-button"),g.appendChild(y);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),g.appendChild(b);const x=document.createElement("div");x.classList.add("wave","sc-size-button"),g.appendChild(x);const w=document.createElement("div");w.classList.add("wave","sc-size-button"),g.appendChild(w),u.appendChild(g);const C=document.createElement("div");C.classList.add("sc-row");const k=document.createElement("div");k.classList.add("wave","sc-price"),C.appendChild(k);const S=document.createElement("div");S.classList.add("wave","sc-personalization"),C.appendChild(S),u.appendChild(C);const I=document.createElement("div");I.classList.add("wave","sc-deliver-to"),u.appendChild(I);const A=document.createElement("div");A.classList.add("wave","sc-address"),u.appendChild(A);const P=document.createElement("div");P.classList.add("wave","sc-retailers",s),u.appendChild(P);const _=document.createElement("div");if(_.classList.add("sc-row"),o){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),_.appendChild(t)}const N=document.createElement("div");if(N.classList.add("wave","sc-add-to-cart"),_.appendChild(N),u.appendChild(_),i){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 i=document.createElement("div");i.classList.add("wave","sc-description-line"),u.appendChild(i);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-more"),u.appendChild(s)}const R=document.createElement("div");if(R.classList.add("product-content"),R.appendChild(u),d.appendChild(R),a){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 i=document.createElement("div");i.classList.add("carousel-dots");for(let a=0;a<3;a++){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 s=document.createElement("div");s.classList.add("gallery-container");for(let a=0;a<4;a++){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),s.appendChild(t)}return o.appendChild(s),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:w.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(w.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,w.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(){const t=this.getProductId(),n=this.getStoreValue("products."+t);let i=n.noAvailabilityPrice;return n.selectedFulfillment&&(i=n.selectedFulfillment.variant.price),formatCentToDollarText(i)}}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"),o=[],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),o.push(t),o}const a="carousel"===i.layout.fulfillmentDisplay?w.PRODUCT_RETAILERS_CAROUSEL:w.PRODUCT_RETAILERS_POPUP,d=ComponentFactoryService.createElement({type:a,productId:t});return o.push(d),o}}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,s=i/2,a=s-o,d=0,u=-(this.listContainer.scrollWidth-i);this.translateX=Math.max(u,Math.min(d,a)),this.updateTransform(!![])}setupDrag(){this.listContainer&&(this.listContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.listContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this)))}handleDragStart(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,s=0,a=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(a,Math.min(s,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.id===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,selectedSizeAttributes:o}){var s,a,d,u,m,g,v,y;const b=n===C.ON_DEMAND;let x=null;b&&t.hourStatus.openTime&&(null===(s=t.hourStatus)||void 0===s?void 0:s.closeTime)&&(x=t.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(a=t.hourStatus)||void 0===a?void 0:a.closeTime):"Opens at "+format24TimeTo12(null===(d=t.hourStatus)||void 0===d?void 0:d.openTime));const w=b&&t.hourStatus&&t.hourStatus.isClosed?"closed":"",k=document.createElement("div");k.className="carousel-retailer-card "+(i?"selected":"")+" "+w,k.setAttribute("data-fulfillment-id",t.id),k.setAttribute("role","button"),k.setAttribute("tabindex","0"),k.setAttribute("aria-pressed",i?"true":"false");const S=n===C.SHIPPING?"Shipping":"Same-day delivery";k.setAttribute("aria-label",S+" from "+t.retailerName+", "+formatCentToDollarText(null!==(u=t.variant.price)&&void 0!==u?u:0));const I=document.createElement("div");I.className="retailer-header";const A=document.createElement("h3");if(A.className="name",A.textContent=t.retailerName,I.appendChild(A),b){const n=document.createElement("h3");n.className="address",n.textContent=t.retailerAddressFormatted,I.appendChild(n)}const P=document.createElement("div");P.className="retailer-body";const _=document.createElement("span");_.className="product-price",_.textContent=formatCentToDollarText(null!==(m=t.variant.price)&&void 0!==m?m:0);const N=document.createElement("span");N.className="shipping-price",N.textContent=t.fee>0?"+ "+formatCentToDollarText(t.fee):"FREE Delivery";const R=document.createElement("span");return R.className="expectation",R.textContent=t.hourStatus.isClosed?x:(null===(g=null==o?void 0:o.presale)||void 0===g?void 0:g.isActive)?(null===(v=null==o?void 0:o.presale)||void 0===v?void 0:v.isActive)&&(null===(y=null==o?void 0:o.presale)||void 0===y?void 0:y.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==o?void 0:o.presale.estimatedShipBy):"":null==t?void 0:t.expectationText,P.append(_,N,R),k.append(I,P),k}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 v in i.shippingFulfillments)Object.prototype.hasOwnProperty.call(i.shippingFulfillments,v)&&s.push(i.shippingFulfillments[v]);const a=[];for(const v in i.onDemandFulfillments)Object.prototype.hasOwnProperty.call(i.onDemandFulfillments,v)&&a.push(i.onDemandFulfillments[v]);const d=n.selectedFulfillmentType===C.SHIPPING,u=n.selectedFulfillmentType===C.ON_DEMAND,m=d?s:a,g=renderFulfillmentTabsContainer({shippingFulfillments:s,onDemandFulfillments:a,shippingSelected:d,onDemandSelected:u,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),[g,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 v of m){const t=this.generateRetailerCard({fulfillment:v,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:v.id===n.selectedFulfillmentId,selectedSizeAttributes:o}),i=n.selectedFulfillmentType===C.ON_DEMAND&&v.hourStatus.isClosed;i?t.setAttribute("aria-disabled","true"):(t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())})),this.listContainer.appendChild(t)}return this.listViewport.appendChild(this.listContainer),[g,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),o=(null==i?void 0:i.attributes)||null,s=this.config.layout.enableShippingFulfillment,a=this.config.layout.enableOnDemandFulfillment,d=Object.values(i.shippingFulfillments),u=Object.values(i.onDemandFulfillments),m=(s?d.length:0)+(a?u.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 ("+m+")",y.setAttribute("aria-label","View all "+m+" delivery options"),y.addEventListener("click",async()=>{0!==m&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(w.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,w.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=renderPopupRetailerCard({fulfillment:n.selectedFulfillment,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:o});return b.appendChild(x),[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(),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 F=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.id===i)return await F(),void 0;await this.commands.product.selectFulfillment(n,i),await F()}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 b in i.shippingFulfillments)Object.prototype.hasOwnProperty.call(i.shippingFulfillments,b)&&s.push(i.shippingFulfillments[b]);const a=[];for(const b in i.onDemandFulfillments)Object.prototype.hasOwnProperty.call(i.onDemandFulfillments,b)&&a.push(i.onDemandFulfillments[b]);const d=n.selectedFulfillmentType===C.SHIPPING,u=n.selectedFulfillmentType===C.ON_DEMAND,m=d?s:a,g=document.createElement("h5");g.className="popup-retailers-section-title",g.textContent="Delivery Options";const v=renderFulfillmentTabsContainer({shippingFulfillments:s,onDemandFulfillments:a,shippingSelected:d,onDemandSelected:u,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),[g,v,t]}const y=document.createElement("div");y.className="popup-fulfillment-list-container";for(const b of m){const t=renderPopupRetailerCard({fulfillment:b,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:b.id===n.selectedFulfillmentId,selectedSizeAttributes:o});t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())}),y.appendChild(t)}return[g,v,y]}}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:w.PRODUCT_LOADING});if(i.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:w.PRODUCT});if(i.loading)return ComponentFactoryService.createElement({type:w.PRODUCT_LOADING});const o=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 a=document.createElement("div");if(a.classList.add("product-content"),a.setAttribute("role","region"),a.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,a.appendChild(t)}const d=ComponentFactoryService.createElement({type:w.PRODUCT_OPTIONS,productId:n});a.appendChild(d);const u=ComponentFactoryService.createElement({type:w.PRODUCT_DRAWER,productId:n});if(a.appendChild(u),s.appendChild(a),!this.config.layout.showImages||!(null===(t=i.images)||void 0===t?void 0:t.length))return s;s.classList.add("has-images");const m=ComponentFactoryService.createElement({type:w.PRODUCT_IMAGE_CAROUSEL,images:i.images,mainImage:o.image,productId:n});return s.prepend(m),m.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;const n=this.params.product,i=this.getStoreValue("address.address"),o={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==i?void 0:i.state)||"",isPresale:![],isPresaleActive:![]},s=n.sizes[0];if(!s)return o;const a=Object.values(s.shippingVariants)[0];if(!a)return o;o.upc=s.upc;const d=s.attributes||{};o.isPresale=(null===(t=d.presale)||void 0===t?void 0:t.isActive)===!![],o.isPresaleActive=this.isPresaleActive(d);for(const u of this.params.fulfillments){const t=a.shippingFulfillmentId===u.id||a.shippingFulfillmentId===u.id;if(t){const t="shipping"===u.type&&a.shippingFulfillmentId||"onDemand"===u.type&&a.onDemandFulfillmentId;if(t&&a.stock>0){o.hasAvailability=!![],o.fulfillmentId=u.id,o.partNumber=a.partNumber;break}}}return o}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;const o=this.params.product,s=o.sizes[0],a=s?s.image:o.images[0],d=o.name,u=s?s.size:null,m=null!==(i=null===(n=null===(t=null==s?void 0:s.shippingVariants)||void 0===t?void 0:t[0])||void 0===n?void 0:n.price)&&void 0!==i?i:o.noAvailabilityPrice,g=this.getAvailabilityData();return this.createVariantStandard({image:a,name:d,size:u,price:m,availability:g})}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:s,availability:a}=t,d=[],u=this.generateProductUrl(),m=document.createElement("div");m.className="plc__image-content";const g=document.createElement("div");g.className="plc__image-wrapper";const v=document.createElement("img");if(v.className="plc__image",v.src=n,v.alt=i,v.loading="lazy",g.appendChild(v),m.appendChild(g),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(m),d.push(t)}else d.push(m);const y=document.createElement("div");y.className="plc__content";const b=document.createElement("h3");if(b.className="plc__title",b.textContent=i,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(b),y.appendChild(t)}else y.appendChild(b);const x=document.createElement("div");x.className="plc__size-price-wrapper";const w=document.createElement("div");w.className="plc__price",w.textContent=formatCentToDollarText(s),x.appendChild(w);const C=document.createElement("div");C.className="plc__size",C.textContent=o||"",x.appendChild(C),y.appendChild(x),d.push(y);const k=document.createElement("button");return k.type="button",k.className="plc__button",k.disabled=!a.hasAvailability,a.isPresale?k.textContent="Pre Order":a.hasAvailability?k.textContent="Add to Cart":(k.textContent="Not Available In "+a.state.toUpperCase(),this.addHostClasses("not-available")),k.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleAddToCart(a)}),d.push(k),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 i=document.createElement("div");i.className="slc__image-content";const o=document.createElement("div");o.className="slc__image-wrapper";const s=document.createElement("div");s.classList.add("wave","slc__image"),o.appendChild(s),i.appendChild(o);const a=document.createElement("div");a.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 m=document.createElement("div");m.classList.add("wave","slc__title","slc__title-line-2"),d.appendChild(m),a.appendChild(d);const g=document.createElement("div");g.className="slc__size-price-wrapper";const v=document.createElement("div");v.classList.add("wave","slc__price"),g.appendChild(v);const y=document.createElement("div");y.classList.add("wave","slc__size"),g.appendChild(y),a.appendChild(g);const b=document.createElement("div");return b.classList.add("wave","slc__button"),n.appendChild(i),n.appendChild(a),n.appendChild(b),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}}function createApplyFiltersButton(t){const n=document.createElement("div");n.className="product-list-filters-apply-container";const i=document.createElement("button");return i.className="product-list-filters-apply-btn",i.textContent="Apply Filters",i.addEventListener("click",()=>t()),n.appendChild(i),n}function createCheckboxItem(t){const{filter:n,state:i,item:o,onChange:s}=t,a=document.createElement("div");a.className="checkbox-filter-item";const d=document.createElement("input");d.type="checkbox",d.id=n.bucket+"-"+o.value,d.value=o.value.toString(),d.className="checkbox-filter-checkbox",d.checked=i.selectedValues.has(o.value.toString()),d.addEventListener("change",s);const u=document.createElement("label");u.htmlFor=d.id,u.className="checkbox-filter-item-label";const m=o.formattedValue||o.value.toString(),g=o.count||0,v=document.createElement("span");v.className="checkbox-filter-item-text",v.textContent=m;const y=document.createElement("span");return y.className="checkbox-filter-item-count",y.textContent="("+g+")",u.appendChild(v),u.appendChild(y),a.appendChild(d),a.appendChild(u),a}function handleCheckboxFilterSearch(t){const{filter:n,state:i,searchTerm:o,renderCheckboxItems:s}=t,a=o.toLowerCase().trim();i.filteredItems=a?n.values.filter(t=>{const n=(t.formattedValue||t.value.toString()).toLowerCase();return n.includes(a)}):[...n.values],s()}function createCheckboxFilterHeader(t){const{filter:n,state:i,onToggle:o}=t,s=document.createElement("div");s.className="checkbox-filter-header";const a=document.createElement("button");a.className="checkbox-filter-label",a.type="button";const d=document.createElement("span");d.textContent=formatFilterLabel(n.bucket);const u=document.createElement("span");return u.className="checkbox-filter-toggle-icon "+(i.isExpanded?"expanded":"collapsed"),u.innerHTML=i.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),i.iconElement=u,a.appendChild(d),a.appendChild(u),a.addEventListener("click",()=>o(n.bucket)),s.appendChild(a),s}function createCheckboxFilterSearchContainer(t){const{state:n,onSearch:i}=t,o=document.createElement("div");o.className="checkbox-filter-search-wrapper",n.searchInput=document.createElement("input"),n.searchInput.type="text",n.searchInput.className="checkbox-filter-search",n.searchInput.placeholder="Search";const s=document.createElement("span");return s.className="checkbox-filter-search-icon",s.innerHTML=SearchIcon({}),n.searchInput.addEventListener("input",t=>{const n=t.target;i(n.value)}),o.appendChild(n.searchInput),o.appendChild(s),o}function renderCheckboxItems(t){const{filter:n,state:i,onCheckboxChange:o}=t;if(i.checkboxList&&(i.checkboxList.innerHTML="",i.filteredItems.forEach(t=>{const s=createCheckboxItem({filter:n,state:i,item:t,onChange:()=>{const n=s.querySelector("input");o(t.value.toString(),n.checked)}});i.checkboxList.appendChild(s)}),0===i.filteredItems.length)){const t=document.createElement("div");t.className="checkbox-filter-no-results",t.textContent="No results found",i.checkboxList.appendChild(t)}}function updateFilterExpandState(t){t.contentElement&&(t.contentElement.className="checkbox-filter-content "+(t.isExpanded?"expanded":"collapsed")),t.iconElement&&(t.iconElement.className="checkbox-filter-toggle-icon "+(t.isExpanded?"expanded":"collapsed"),t.iconElement.innerHTML=t.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}))}function formatFilterLabel(t){return t.charAt(0).toUpperCase()+t.slice(1).replace(/_/g," ")}function createDeliveryOptionsFilter(t){const{currentFilters:n,deliveryCollapsed:i,isSameDayDeliveryDisabled:o,onDeliveryOptionsChange:s,onToggleCollapse:a}=t,d=[],u=document.createElement("div");u.className="product-list-filters-delivery-options";const m=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],g=document.createElement("div");g.className="product-list-filters-delivery-options-header",g.style.cursor="pointer";const v=document.createElement("h3");v.className="product-list-filters-delivery-options-label",v.textContent="Delivery Options";const y=document.createElement("div");y.className="product-list-filters-chevron",y.innerHTML=i?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),g.appendChild(v),g.appendChild(y),u.appendChild(g);const b=document.createElement("div");b.className="product-list-filters-delivery-options-list",i&&b.classList.add("collapsed");for(const x of m){const t=document.createElement("div");t.className="product-list-filters-delivery-option";const i=document.createElement("input");i.type="radio",i.id="delivery-"+x.value,i.name="delivery-options",i.value=x.value,i.className="product-list-filters-delivery-radio";const a="onDemand"===x.value&&o;i.disabled=a,i.checked=x.value===(null==n?void 0:n.deliveryOptions),i.addEventListener("change",t=>{const n=t.target;null==s?void 0:s(n.value)});const d=document.createElement("label");d.htmlFor="delivery-"+x.value,d.className="product-list-filters-delivery-radio-label "+(a?"disabled":""),d.textContent=x.label,t.appendChild(i),t.appendChild(d),b.appendChild(t)}return u.appendChild(b),g.addEventListener("click",()=>{a()}),d.push(u),{elements:d,chevronContainer:y,deliveryOptionsList:b}}function createPriceFilter(t){var n,i,o,s,a,d,u,m;const{priceConfig:g,currentFilters:v,priceCollapsed:y,onPriceChange:b,onToggleCollapse:x,DEFAULT_MIN:w,DEFAULT_MAX:C}=t,k=[],S=document.createElement("div");S.className="product-list-filters-price";const I=Number.parseInt(null!==(n=null==g?void 0:g.min)&&void 0!==n?n:w,10),A=Number.parseInt(null!==(i=null==g?void 0:g.max)&&void 0!==i?i:C,10),P=Number.parseInt(null!==(a=null!==(s=null===(o=null==v?void 0:v.price)||void 0===o?void 0:o.min)&&void 0!==s?s:null==g?void 0:g.min)&&void 0!==a?a:w,10),_=Number.parseInt(null!==(m=null!==(u=null===(d=null==v?void 0:v.price)||void 0===d?void 0:d.max)&&void 0!==u?u:null==g?void 0:g.max)&&void 0!==m?m:C,10),N=document.createElement("div");N.className="product-list-filters-price-header",N.style.cursor="pointer";const R=document.createElement("h3");R.className="product-list-filters-price-title",R.textContent="Price Range",N.appendChild(R);const O=document.createElement("div");O.className="product-list-filters-chevron",O.innerHTML=y?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),N.appendChild(O),S.appendChild(N);const L=document.createElement("div");L.className="product-list-filters-price-slider-container",y&&L.classList.add("collapsed");const M=document.createElement("div");M.className="product-list-filters-price-range-wrapper";const B=document.createElement("div");B.className="product-list-filters-price-track";const W=document.createElement("div");W.className="product-list-filters-price-track-active",B.appendChild(W),M.appendChild(B);const q=document.createElement("input");q.type="range",q.min=I.toString(),q.max=A.toString(),q.value=P.toString(),q.step="1",q.className="product-list-filters-price-range product-list-filters-price-range-min",M.appendChild(q);const j=document.createElement("input");j.type="range",j.min=I.toString(),j.max=A.toString(),j.value=_.toString(),j.step="1",j.className="product-list-filters-price-range product-list-filters-price-range-max",M.appendChild(j),L.appendChild(M);const U=document.createElement("div");U.className="product-list-filters-price-inputs-container";const G=document.createElement("div");G.className="product-list-filters-price-input-wrapper";const V=document.createElement("span");V.className="product-list-filters-price-input-prefix",V.textContent="$";const K=document.createElement("input");K.type="number",K.min=I.toString(),K.max=A.toString(),K.value=P.toString(),K.className="product-list-filters-price-input",K.placeholder=I.toString(),G.appendChild(V),G.appendChild(K);const Q=document.createElement("span");Q.className="product-list-filters-price-separator",Q.textContent="to";const X=document.createElement("div");X.className="product-list-filters-price-input-wrapper";const J=document.createElement("span");J.className="product-list-filters-price-input-prefix",J.textContent="$";const $=document.createElement("input");$.type="number",$.min=I.toString(),$.max=A.toString(),$.value=_.toString(),$.className="product-list-filters-price-input",$.placeholder=A+"+",X.appendChild(J),X.appendChild($),U.appendChild(G),U.appendChild(Q),U.appendChild(X),L.appendChild(U),S.appendChild(L);const c=()=>{const t=Number.parseInt(q.value,10),n=Number.parseInt(j.value,10),i=A-I,o=(t-I)/i*100,s=(n-I)/i*100;W.style.left=o+"%",W.style.width=s-o+"%"},T=(t,n)=>{q.value=t.toString(),j.value=n.toString(),K.value=t.toString(),$.value=n.toString(),c()};return q.addEventListener("input",()=>{let t=Number.parseInt(q.value,10);const n=Number.parseInt(j.value,10);t>n&&(t=n),T(t,n)}),q.addEventListener("change",()=>{const t=Number.parseInt(q.value,10),n=Number.parseInt(j.value,10);null==b?void 0:b(t.toString(),n.toString())}),j.addEventListener("input",()=>{const t=Number.parseInt(q.value,10);let n=Number.parseInt(j.value,10);n<t&&(n=t),T(t,n)}),j.addEventListener("change",()=>{const t=Number.parseInt(q.value,10),n=Number.parseInt(j.value,10);null==b?void 0:b(t.toString(),n.toString())}),K.addEventListener("input",()=>{let t=Number.parseInt(K.value,10)||I;const n=Number.parseInt($.value,10)||A;t=Math.max(I,Math.min(t,A)),t>n&&(t=n),T(t,n),null==b||b(t.toString(),n.toString())}),$.addEventListener("input",()=>{const t=Number.parseInt(K.value,10)||I;let n=Number.parseInt($.value,10)||A;n=Math.max(I,Math.min(n,A)),n<t&&(n=t),T(t,n),null==b||b(t.toString(),n.toString())}),c(),N.addEventListener("click",()=>{x()}),k.push(S),{elements:k,chevronContainer:O,sliderContainer:L}}class ProductListSearchComponent extends BaseComponent{constructor(){super(...arguments),this.ALLOWED_CHARACTERS=/[^a-zA-Z0-9\s\-_'.,&()]/g,this.MAX_LENGTH=100}get hostClasses(){return["product-list-search-container"]}template(){const t=[],n=document.createElement("div");n.className="product-list-search-box";const i=document.createElement("span");return i.className="product-list-search-icon",i.innerHTML=SearchIcon({}),i.setAttribute("aria-hidden","true"),this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="product-list-search-input",this.searchInput.placeholder="Search",this.searchInput.setAttribute("aria-label","Search products"),this.searchInput.setAttribute("maxlength",this.MAX_LENGTH.toString()),this.params.searchTerm&&(this.searchInput.value=this.sanitizeInput(this.params.searchTerm)),this.searchInput.addEventListener("input",t=>{const n=t.target,i=n.value,o=this.sanitizeInput(i);o!==i&&(n.value=o),this.updateClearButtonVisibility(o),this.params.handleInputChange&&this.params.handleInputChange(o)}),this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="product-list-search-clear-btn",this.clearButton.innerHTML=CloseIcon({}),this.clearButton.setAttribute("aria-label","Clear search"),this.clearButton.style.display=this.params.searchTerm?"flex":"none",this.clearButton.addEventListener("click",()=>{this.searchInput&&(this.searchInput.value="",this.searchInput.focus()),this.updateClearButtonVisibility(""),this.params.clearSearch&&this.params.clearSearch(),this.params.handleInputChange&&this.params.handleInputChange("")}),n.appendChild(i),n.appendChild(this.searchInput),n.appendChild(this.clearButton),t.push(n),t}sanitizeInput(t){if(!t)return"";let n=t.replace(this.ALLOWED_CHARACTERS,"");return n=n.trim(),n=n.replace(/\s+/g," "),n.length>this.MAX_LENGTH&&(n=n.substring(0,this.MAX_LENGTH)),n}updateClearButtonVisibility(t){this.clearButton&&(this.clearButton.style.display=t?"flex":"none")}}function createPersonalizedFilter(t){const{currentFilters:n,isPersonalizationDisabled:i,onPersonalizedChange:o}=t,s=[],a=document.createElement("div");a.className="product-list-filters-personalized";const d=document.createElement("label");d.className="product-list-filters-personalized-label",d.setAttribute("for","personalized-switch"),d.textContent="Personalized Bottles",a.appendChild(d);const u=document.createElement("div");u.classList.add("toggle-switch");const m=!!(null==n?void 0:n.personalized);m&&u.classList.add("active");const g=document.createElement("div");g.classList.add("toggle-slider"),u.id="personalized-switch",u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Toggle Personalized Bottles"),u.setAttribute("role","switch"),u.setAttribute("aria-checked",m?"true":"false"),u.appendChild(g);const h=t=>{u.classList.toggle("active",t),u.setAttribute("aria-checked",t?"true":"false")},f=()=>{const t=u.classList.contains("active"),n=!t;h(n),null==o||o(n)};if(u.addEventListener("click",()=>{i||f()}),u.addEventListener("keydown",t=>{i||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),f())}),a.appendChild(u),i){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",a.appendChild(t)}return s.push(a),s}function createPreOrderFilter(t){const{currentFilters:n,isPreOrderDisabled:i,onPreOrderChange:o}=t,s=[],a=document.createElement("div");a.className="product-list-filters-pre-order";const d=document.createElement("label");d.className="product-list-filters-pre-order-label",d.setAttribute("for","pre-order-switch"),d.textContent="Pre-Order",a.appendChild(d);const u=document.createElement("div");u.classList.add("toggle-switch");const m=!!(null==n?void 0:n.preOrder);m&&u.classList.add("active"),i&&u.classList.add("disabled");const g=document.createElement("div");g.classList.add("toggle-slider"),u.id="pre-order-switch",u.setAttribute("tabindex",i?"-1":"0"),u.setAttribute("aria-label","Toggle Pre-Order"),u.setAttribute("role","switch"),u.setAttribute("aria-checked",m?"true":"false"),u.setAttribute("aria-disabled",i?"true":"false"),u.appendChild(g);const h=t=>{u.classList.toggle("active",t),u.setAttribute("aria-checked",t?"true":"false")},f=()=>{const t=u.classList.contains("active"),n=!t;h(n),null==o||o(n)};if(u.addEventListener("click",()=>{i||f()}),u.addEventListener("keydown",t=>{i||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),f())}),a.appendChild(u),i){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",a.appendChild(t)}return s.push(a),s}class ProductListFiltersComponent extends BaseComponent{constructor(){super(...arguments),this.priceCollapsed=![],this.deliveryCollapsed=![],this.checkboxFilterStates=new Map,this.DEFAULT_MIN="0",this.DEFAULT_MAX="1000"}get hostClasses(){const t=["product-list-filters-container"];return this.params.isDrawerMode&&t.push("drawer-mode"),t}isSameDayDeliveryDisabled(){var t,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)}createPersonalizedFilterWrapper(){return createPersonalizedFilter({currentFilters:this.params.currentFilters,isPersonalizationDisabled:this.isPersonalizationDisabled(),onPersonalizedChange:this.params.onPersonalizedChange})}createPreOrderFilterWrapper(){return createPreOrderFilter({currentFilters:this.params.currentFilters,isPreOrderDisabled:this.isPreOrderDisabled(),onPreOrderChange:this.params.onPreOrderChange})}createDeliveryOptionsFilterWrapper(){const t=createDeliveryOptionsFilter({currentFilters:this.params.currentFilters,deliveryCollapsed:this.deliveryCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryDisabled(),onDeliveryOptionsChange:this.params.onDeliveryOptionsChange,onToggleCollapse:()=>this.toggleDeliveryCollapse()});return this.deliveryChevronContainer=t.chevronContainer,this.deliveryOptionsList=t.deliveryOptionsList,t.elements}toggleDeliveryCollapse(){this.deliveryCollapsed=!this.deliveryCollapsed,this.deliveryOptionsList&&this.deliveryOptionsList.classList.toggle("collapsed"),this.deliveryChevronContainer&&(this.deliveryChevronContainer.innerHTML=this.deliveryCollapsed?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}))}createPriceFilterWrapper(){const t=createPriceFilter({priceConfig:this.params.priceConfig,currentFilters:this.params.currentFilters,priceCollapsed:this.priceCollapsed,onPriceChange:this.params.onPriceChange,onToggleCollapse:()=>this.togglePriceCollapse(),DEFAULT_MIN:this.DEFAULT_MIN,DEFAULT_MAX:this.DEFAULT_MAX});return this.priceChevronContainer=t.chevronContainer,this.priceSliderContainer=t.sliderContainer,t.elements}togglePriceCollapse(){this.priceCollapsed=!this.priceCollapsed,this.priceSliderContainer&&this.priceSliderContainer.classList.toggle("collapsed"),this.priceChevronContainer&&(this.priceChevronContainer.innerHTML=this.priceCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}createCheckboxFilter(t){var n;const i=[];if(!this.checkboxFilterStates.has(t.bucket)){const i=null===(n=this.params.currentFilters)||void 0===n?void 0:n[t.bucket],o=Array.isArray(i)?new Set(i):new Set;this.checkboxFilterStates.set(t.bucket,{isExpanded:o.size>0,selectedValues:o,searchInput:null,checkboxList:null,filteredItems:[...t.values],contentElement:null,iconElement:null,hasUserInteraction:o.size>0})}const o=this.checkboxFilterStates.get(t.bucket),s=document.createElement("div");s.className="product-list-checkbox-filter",s.setAttribute("data-filter-bucket",t.bucket);const a=document.createElement("div");a.className="checkbox-filter-container";const d=createCheckboxFilterHeader({filter:t,state:o,onToggle:t=>this.toggleCheckboxFilter(t)});a.appendChild(d);const u=document.createElement("div");u.className="checkbox-filter-content "+(o.isExpanded?"expanded":"collapsed"),o.contentElement=u;const m=createCheckboxFilterSearchContainer({state:o,onSearch:n=>{handleCheckboxFilterSearch({filter:t,state:o,searchTerm:n,renderCheckboxItems:()=>this.renderCheckboxItemsWrapper(t,o)})}});return u.appendChild(m),o.checkboxList=document.createElement("div"),o.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsWrapper(t,o),u.appendChild(o.checkboxList),a.appendChild(u),s.appendChild(a),i.push(s),i}renderCheckboxItemsWrapper(t,n){renderCheckboxItems({filter:t,state:n,onCheckboxChange:(i,o)=>this.handleCheckboxChange(t.bucket,n,i,o)})}handleCheckboxChange(t,n,i,o){o?n.selectedValues.add(i):n.selectedValues.delete(i),n.hasUserInteraction=!![],n.isExpanded||(n.isExpanded=!![],updateFilterExpandState(n)),this.params.onCheckboxFilterChange&&this.params.onCheckboxFilterChange(t,Array.from(n.selectedValues))}toggleCheckboxFilter(t){const n=this.checkboxFilterStates.get(t);n&&(n.isExpanded=!n.isExpanded,n.hasUserInteraction=!![],updateFilterExpandState(n))}template(){var t;const n=[],i=document.createElement("div");i.className="product-list-filters-header",this.params.isDrawerMode&&i.classList.add("drawer-mode");const o=document.createElement("h3");if(o.className="product-list-filters-title",o.textContent="Filters",i.appendChild(o),this.params.isDrawerMode){const t=document.createElement("button");t.className="product-list-filters-close-btn",t.innerHTML=CloseIcon({}),t.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),i.appendChild(t)}return n.push(i),this.params.enablePersonalized&&n.push(...this.createPersonalizedFilterWrapper()),this.params.enablePreOrder&&n.push(...this.createPreOrderFilterWrapper()),this.params.enableDeliveryOptions&&n.push(...this.createDeliveryOptionsFilterWrapper()),this.params.priceConfig&&n.push(...this.createPriceFilterWrapper()),null===(t=this.params.sanitizedFilters)||void 0===t||t.forEach(t=>{n.push(...this.createCheckboxFilter(t))}),this.params.isDrawerMode&&n.push(createApplyFiltersButton(()=>{var t,n;null===(n=(t=this.params).onApplyFilters)||void 0===n?void 0:n.call(t),this.commands.ui.closeDrawer()})),n}}const FilterIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 24 24" class="filter-icon '+i+'" style="'+s+'" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M20 7h-9"></path>\n <path d="M14 17H5"></path>\n <circle cx="17" cy="17" r="3"></circle>\n <circle cx="7" cy="7" r="3"></circle>\n </svg>\n '};var Rt;(function(t){t.IDLE="idle",t.LOADING_INITIAL="loading_initial",t.LOADING_MORE="loading_more",t.ERROR="error"})(Rt||(Rt={}));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.sanitizedFilters=[],this.searchFilter={searchTerm:""},this.currentFilters={personalized:![],preOrder:![],deliveryOptions:"all",price:{min:"0",max:"1000"}},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.sentinelElement=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels=new Map,this.loadingState=Rt.IDLE,this.scrollObserver=null,this.initializationPromise=null,this.filterDebounceTimer=null,this.FILTER_DEBOUNCE_MS=500,this.filterButton=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise}disconnectedCallback(){super.disconnectedCallback(),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(Rt.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(Rt.IDLE)}catch(ht){this.logger.error("Error initializing product list:",ht),this.setLoadingState(Rt.ERROR),this.showErrorState("Failed to load products")}}template(){const t=[],n=document.createElement("div");n.className="product-list-search__control-container",n.appendChild(this.createSearchContainer()),t.push(n),this.params.filters.length>0&&(this.filterButton=this.createFilterButton(),t.push(this.filterButton));const i=document.createElement("div");return i.className="product-list-controls",this.params.filters.length>0&&i.appendChild(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),i.appendChild(this.cardsContainer),t.push(i),this.renderCurrentState(),t}setLoadingState(t){this.loadingState=t,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case Rt.LOADING_INITIAL:this.renderLoadingState();break;case Rt.ERROR:break;case Rt.IDLE:case Rt.LOADING_MORE:this.updateSentinel()}}sanitizeFilterValues(t){return t.map(t=>({...t,formattedValue:t.value}))}processResponseFilters(t){var n;return(null===(n=null==t?void 0:t.navigation)||void 0===n?void 0:n.filters)?t.navigation.filters.filter(t=>t.bucket!==m.AVAILABILITY).filter(t=>t.bucket!==m.PRICE).filter(t=>t.bucket!==m.ENGRAVING).filter(t=>t.bucket!==m.PRESALE).filter(t=>t.bucket!==m.TAGS).map(t=>{var n,i;if(t.bucket===m.CATEGORIES){const o=new Set;return{...t,values:null!==(i=null===(n=t.values)||void 0===n?void 0:n.map(t=>{const n=t.value.split(">").map(t=>t.trim()),i=n.pop()||"";let s=i;return o.has(i)&&(s=n.slice(-1).concat(i).join(" > ")),o.add(s),{...t,formattedValue:s}}).slice(1))&&void 0!==i?i:[]}}return{...t,values:this.sanitizeFilterValues(t.values)}}).filter(t=>{var n;return(null===(n=t.values)||void 0===n?void 0:n.length)>0}):[]}async loadInitialProducts(){var t;try{const n=this.buildApiParams(0),i=await this.commands.productList.getProductList(n);this.sanitizedFilters=this.processResponseFilters(i),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)||[]),this.updateFiltersComponent()}catch(n){throw this.products=[],this.retailers=[],this.pagination.hasMorePages=![],n}}updateFiltersComponent(){if(!this.filtersContainer||0===this.params.filters.length)return;const t=this.filtersContainer.parentElement;if(!t)return;const n=this.filtersContainer;this.filtersContainer=this.createFiltersContainer(),t.replaceChild(this.filtersContainer,n)}async loadMoreProducts(){if(this.loadingState!==Rt.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(Rt.LOADING_MORE);const t=this.pagination.currentPage+1,n=this.buildApiParams(t),i=await this.commands.productList.getProductList(n);this.sanitizedFilters=this.processResponseFilters(i),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(Rt.IDLE)}catch(t){this.logger.error("Error loading more products:",t),this.setLoadingState(Rt.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,s;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!==(s=t.totalPages)&&void 0!==s?s:1)-1})}buildApiParams(t){const n={page:t,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()};return this.searchFilter.searchTerm&&this.searchFilter.searchTerm.trim().length>0&&(n.search=this.searchFilter.searchTerm.trim()),n}buildFiltersFromState(){const t=[{key:"availability",values:"IN_STOCK"}];if(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]}),this.currentFilters.price){const n={};"0"!==this.currentFilters.price.min&&(n.min=this.currentFilters.price.min),"1000"!==this.currentFilters.price.max&&(n.max=this.currentFilters.price.max),Object.keys(n).length>0&&t.push({key:"price",values:n})}const n=Object.keys(this.currentFilters).filter(t=>!["personalized","preOrder","deliveryOptions","price"].includes(t));for(const i of n){const n=this.currentFilters[i];Array.isArray(n)&&n.length>0&&t.push({key:i,values:n})}return 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(Rt.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(Rt.IDLE)}catch(ht){this.logger.error("Error handling filter change:",ht),this.setLoadingState(Rt.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:w.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 o=new Map(this.retailers.flatMap(t=>t.fulfillments.map(t=>[t.id,t]))),s=new Set(Object.values(i.shippingVariants).flatMap(t=>t.shippingFulfillmentId)),a=Array.from(s).map(t=>o.get(t)).filter(t=>Boolean(t));return ComponentFactoryService.createElement({type:w.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:t,fulfillments:a,productUrl:this.params.productUrl})}catch(i){return this.logger.error("Error creating product card for product "+t.id+":",i),null}}filterSanitizedFilters(){if(!this.params.filters||0===this.params.filters.length)return[];const t={[m.BRANDS]:A.BRANDS,[m.CATEGORIES]:A.CATEGORIES,[m.FLAVOR]:A.FLAVOR,[m.REGION]:A.REGION,[m.VARIETY]:A.VARIETY,[m.VINTAGE]:A.VINTAGE,[m.COUNTRY]:A.COUNTRY,[m.APPELLATION]:A.APPELLATION,[m.MATERIALS]:A.MATERIALS,[m.SIZES]:A.SIZES};return this.sanitizedFilters.filter(n=>{const i=t[n.bucket];return i&&this.params.filters.includes(i)})}buildFiltersParams(t=![]){const D=async()=>{this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()};return{enablePersonalized:this.params.filters.includes(A.PERSONALIZATION),enablePreOrder:this.params.filters.includes(A.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(A.DELIVERY_OPTIONS),currentFilters:this.currentFilters,sanitizedFilters:this.filterSanitizedFilters(),priceConfig:this.params.filters.includes(A.PRICE)?{min:"0",max:"1000"}:void 0,onPersonalizedChange:async n=>{this.currentFilters.personalized=n,t||await this.onFilterChange()},onPreOrderChange:async n=>{this.currentFilters.preOrder=n,t||await this.onFilterChange()},onDeliveryOptionsChange:async n=>{this.currentFilters.deliveryOptions=n,"onDemand"===n&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),t||await this.onFilterChange()},onPriceChange:async(n,i)=>{this.currentFilters.price||(this.currentFilters.price={}),"0"!==n?this.currentFilters.price.min=n:delete this.currentFilters.price.min,"1000"!==i?this.currentFilters.price.max=i:delete this.currentFilters.price.max,t||(this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS))},onCheckboxFilterChange:async(n,i)=>{i.length>0?this.currentFilters[n]=i:delete this.currentFilters[n],t||await this.onFilterChange()},isDrawerMode:t,onApplyFilters:async()=>{await D()}}}createSearchContainer(){return this.searchContainer=ComponentFactoryService.createElement({type:w.PRODUCT_LIST_SEARCH,searchTerm:this.searchFilter.searchTerm,handleInputChange:async t=>{this.searchFilter.searchTerm=t,this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS)},clearSearch:async()=>{this.searchFilter.searchTerm="",this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()}}),this.searchContainer}createFiltersContainer(t={}){const{isDrawerMode:n=![]}=t;return this.filtersContainer=ComponentFactoryService.createElement({type:w.PRODUCT_LIST_FILTERS,...this.buildFiltersParams(n)}),this.storeFilterElementReferences(),this.filtersContainer}storeFilterElementReferences(){if(!this.filtersContainer)return;this.personalizedSwitch=this.filtersContainer.querySelector("#personalized-switch"),this.preOrderSwitch=this.filtersContainer.querySelector("#pre-order-switch");const 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)})}openFiltersDrawer(){this.commands.ui.openDrawer(w.PRODUCT_LIST_FILTERS,this.buildFiltersParams(!![]))}createFilterButton(){const t=document.createElement("div");t.className="product-list-filter-container";const n=document.createElement("div");n.className="product-list-filter-icon",n.innerHTML=FilterIcon({}),n.addEventListener("click",()=>{this.openFiltersDrawer()});const i=document.createElement("span");return i.className="product-list-filter-text",i.textContent="Filter",t.appendChild(n),t.appendChild(i),t}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===Rt.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===Rt.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(Rt.ERROR),this.cardsContainer&&this.showErrorState("Failed to reload products")}}doCleanup(){this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),this.cleanupScrollObserver(),this.products=[],this.retailers=[],this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.filterButton=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels.clear(),this.initializationPromise=null}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,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 s=this.store.get(this.params.errorStorePath);return s?[{message:s,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(w.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,s=o.isOpen,a=null===(n=o.contentConfig)||void 0===n?void 0:n.type,d=a!==this.currentContentType;return s&&!this.isOpen?(this.currentContentType=a,this.openWithContent(o),![]):s&&this.isOpen&&!d?![]:s&&this.isOpen&&d?(this.currentContentType=a,this.openWithContent(o),![]):!s&&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.variant.partNumber)||null}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,n;if("product"===this.params.context){const i=this.store.get("products."+this.params.identifier),o=i.sizes[i.selectedSizeId],s=o.shippingFulfillments[this.fulfillmentId],a=s.variant.price,d=(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 a+d}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.sizes[o.selectedSizeId].image?t.push(o.sizes[o.selectedSizeId].image):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 s=document.createElement("img");s.src=t[0],s.alt=n,s.loading="lazy",s.className="product-image",i.appendChild(s),o.appendChild(i)}const s=document.createElement("div");s.className="product-details-container";const a=document.createElement("div");a.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()),a.appendChild(d),a.appendChild(this.productPriceSpan),s.appendChild(a);const u=document.createElement("p");u.className="product-size-text",u.textContent=i,s.appendChild(u);const m=document.createElement("p");return m.className="engraving-fees-disclaimer",m.textContent="Personalization fees included in total, varies by retailer.",s.appendChild(m),o.appendChild(s),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,s,a,d;const u=this.store.get("products."+this.params.identifier),m=u.sizes[u.selectedSizeId],g=Object.values(m.shippingFulfillments).filter(t=>t.variant.isEngravable),v=document.createElement("div");v.className="fulfillment-section";const y=document.createElement("p");if(y.className="shipping-from-text",y.innerHTML="Shipping from: <b>"+(null===(t=u.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",v.appendChild(y),1===g.length)return v;const b=document.createElement("div");b.className="fulfillment-options-container",v.appendChild(b);const x=document.createElement("span");x.className="see-more-fulfillments",x.textContent="See More Delivery Options ("+g.length+")",x.setAttribute("role","button"),x.setAttribute("tabindex","0"),x.setAttribute("aria-label","See More Delivery Options ("+g.length+")"),x.setAttribute("aria-expanded","false");const r=()=>{const t=b.classList.contains("expanded");b.classList.toggle("expanded"),t?(x.textContent="See More Delivery Options ("+g.length+")",x.setAttribute("aria-label","See More Delivery Options ("+g.length+")"),x.setAttribute("aria-expanded","false")):(x.textContent="See Less Delivery Options",x.setAttribute("aria-label","See Less Delivery Options"),x.setAttribute("aria-expanded","true"))};x.addEventListener("click",r),x.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),r())}),v.appendChild(x);for(const w of g){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",w.id),w.id===(null===(n=u.selectedFulfillment)||void 0===n?void 0:n.id)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+w.retailerName+", "+formatCentToDollarText(w.variant.price+((null===(o=null===(i=u.sizes[u.selectedSizeId].attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.fee)||0))+", "+w.engravingExpectationText),t.setAttribute("aria-pressed",w.id===(null===(s=u.selectedFulfillment)||void 0===s?void 0:s.id)?"true":"false");const z=()=>{this.fulfillmentId=w.id,this.partNumber=w.variant.partNumber;const n=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(n),this.productPriceSpan.textContent=formatCentToDollarText(n);const i=b.querySelector(".fulfillment-option.selected");i&&(i.classList.remove("selected"),i.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),y.innerHTML="Shipping from: <b>"+w.retailerName+"</b>"};t.addEventListener("click",z),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),z())});const m=w.variant.price+((null===(d=null===(a=u.sizes[u.selectedSizeId].attributes)||void 0===a?void 0:a.engraving)||void 0===d?void 0:d.fee)||0),g=document.createElement("div");g.className="option-row row-1",t.appendChild(g);const v=document.createElement("span");v.className="retailer-name",v.textContent=w.retailerName,g.appendChild(v);const x=document.createElement("span");x.className="fulfillment-price",x.textContent=formatCentToDollarText(m),g.appendChild(x),t.appendChild(g);const C=document.createElement("div");C.className="option-row row-2",t.appendChild(C);const k=document.createElement("span");k.className="estimated-time",k.textContent=""+w.engravingExpectationText,C.appendChild(k),t.appendChild(C),b.appendChild(t)}return v}engravingLinesSection(){var t;const{lines:n,maxLines:i,location:o,maxCharsPerLine:s}=this.params,a=document.createElement("div");a.className="engraving-section";const d=document.createElement("p");if(d.className="engraving-title",d.textContent="Personalize Your Bottle",a.appendChild(d),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()+".",a.appendChild(t)}const u=Array.from({length:i},(t,i)=>{const o=i+1,a=document.createElement("div");a.className="engraving-input-wrapper",a.setAttribute("data-line-number",o.toString());const d=document.createElement("input");d.type="text",d.id="engraving-line-"+o,d.dataset.lineNumber=o.toString(),d.maxLength=s,d.value=n[i]||"",d.placeholder=o>1?"Line "+o+" (optional)":"Line "+o,d.className="engraving-input",d.autocomplete="off",d.setAttribute("aria-label",o>1?"Engraving line "+o+", optional, maximum "+s+" characters":"Engraving line "+o+", maximum "+s+" characters");const u=document.createElement("span");return u.className="engraving-char-count",u.textContent=d.value.length+"/"+s,u.setAttribute("aria-live","polite"),u.setAttribute("aria-atomic","true"),d.addEventListener("input",()=>{u.textContent=d.value.length+"/"+s,this.engravingLines[i]=d.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),a.appendChild(d),a.appendChild(u),a}),m=document.createElement("div");return m.className="engraving-inputs-container",m.append(...u),a.appendChild(m),a}actionButtonsSection(){const{identifier:t,context:n}=this.params,i=document.createElement("div");i.className="action-buttons-container";const o=document.createElement("button");o.type="button",o.className="cancel-action-button",o.textContent="Cancel",o.setAttribute("aria-label","Cancel personalization and close");const Z=async()=>{"product"===n&&await this.commands.product.closeProductDrawer(t),"cart"===n&&this.commands.ui.openDrawer(w.CART)};o.addEventListener("click",Z),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Z())}),i.appendChild(o),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===n?"Add personalized item to cart":"Update personalization and return to cart");const Y=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(w.CART))};return this.addToCartButton.addEventListener("click",Y),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Y())}),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 s=document.createElement("p");return s.className="engraving-disclaimer",s.innerHTML="Personalized orders require up to 10 business days to be processed and then shipped. Tracking information will be provided once processed. <b>Personalized bottle orders cannot be cancelled.</b>",t.push(s),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,o,s,a,d,u,m,g,v,y,b,x,C,k,S,I,A,P;const _=this.params.identifier,N={identifier:_,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const v=this.getStoreValue("cart.items."+_);N.lines=(null===(n=null===(t=null==v?void 0:v.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.lines)||[],N.maxLines=(null===(o=null===(i=null==v?void 0:v.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.maxLines)||1,N.maxCharsPerLine=(null===(a=null===(s=null==v?void 0:v.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.maxCharsPerLine)||16,N.fee=(null===(u=null===(d=null==v?void 0:v.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.fee)||0,N.location=(null===(g=null===(m=null==v?void 0:v.attributes)||void 0===m?void 0:m.engraving)||void 0===g?void 0:g.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+_);N.lines=(null===(y=null===(v=null==t?void 0:t.attributes)||void 0===v?void 0:v.engraving)||void 0===y?void 0:y.lines)||[],N.maxLines=(null===(x=null===(b=null==t?void 0:t.attributes)||void 0===b?void 0:b.engraving)||void 0===x?void 0:x.maxLines)||1,N.maxCharsPerLine=(null===(k=null===(C=null==t?void 0:t.attributes)||void 0===C?void 0:C.engraving)||void 0===k?void 0:k.maxCharsPerLine)||16,N.fee=(null===(I=null===(S=null==t?void 0:t.attributes)||void 0===S?void 0:S.engraving)||void 0===I?void 0:I.fee)||0,N.location=(null===(P=null===(A=null==t?void 0:t.attributes)||void 0===A?void 0:A.engraving)||void 0===P?void 0:P.location)||""}this.commands.ui.openDrawer(w.ENGRAVING_FORM,N)}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 s=document.createElement("span");if(s.className="engraving-fee",1===t.quantity&&(s.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){s.textContent=formatCentToDollarText(t.total,![]);const n=document.createElement("span");n.className="engraving-fee-each",n.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",s.appendChild(n)}i.appendChild(o),i.appendChild(s);const a=document.createElement("div");a.className="engraving-body";const d=document.createElement("div");d.className="engraving-lines";for(const g of n){const t=document.createElement("span");t.className="engraving-line",t.textContent=g,d.appendChild(t)}const u=document.createElement("div");u.className="engraving-actions";const m=document.createElement("button");m.type="button",m.classList.add("remove-button"),m.textContent="Remove",m.setAttribute("aria-label","Remove engraving");const h=async()=>{await this.handleRemove()};if(m.addEventListener("click",h),m.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await h())}),u.appendChild(m),"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 a.appendChild(d),a.appendChild(u),[i,a]}}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 i=n.value.replace(/\D/g,"");if(i.length>2&&(i=i.substring(0,2)),1===i.length){const t=Number.parseInt(i,10);t>=2&&t<=9&&(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){const t=Number.parseInt(i,10);t>=4&&t<=9&&(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}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 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),s=Number.parseInt(n,10),a=Number.parseInt(i,10);if(o<1||o>12||s<1||s>31||a<1e3)return![];const d=new Date(a,o-1,s);return d.getFullYear()===a&&d.getMonth()===o-1&&d.getDate()===s}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=[],s=this.params.validation;if(!s)return this.showErrors([]),!![];const a=2===t.length&&2===n.length&&4===i.length,d=t||n||i;if(s.required&&!d)o.push("Please enter a complete date (MM/DD/YYYY)");else if(d&&!a)o.push("Please enter a complete date (MM/DD/YYYY)");else if(a)if(this.validateDate(t,n,i)){const a=Number.parseInt(t,10),d=Number.parseInt(n,10),u=Number.parseInt(i,10),m=new Date(u,a-1,d);if(void 0!==s.minYear&&u<s.minYear&&o.push("Year must be "+s.minYear+" or later"),void 0!==s.maxYear&&u>s.maxYear&&o.push("Year must be "+s.maxYear+" or earlier"),void 0!==s.minAge||void 0!==s.maxAge){const t=this.calculateAge(m);void 0!==s.minAge&&t<s.minAge&&o.push("Must be at least "+s.minAge+" years old"),void 0!==s.maxAge&&t>s.maxAge&&o.push("Must be no more than "+s.maxAge+" years old")}if(s.customValidator){const t=s.customValidator(this.getFormattedValue());t&&o.push(t)}}else o.push("Please enter a valid date");this.showErrors(o);const u=0===o.length;return this.params.onValidation&&this.params.onValidation(u,o),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 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 s=document.createElement("span");s.className="date-separator",s.textContent="/";const a=document.createElement("input");a.type="text",a.placeholder="DD",a.name=this.params.name+"-day",a.id=this.params.name+"-day",a.maxLength=2,a.className="date-field day-field",a.setAttribute("data-field","day"),a.inputMode="numeric";const 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&&(o.disabled=!![],a.disabled=!![],u.disabled=!![]),this.params.className&&(i.className+=" "+this.params.className),i.appendChild(o),i.appendChild(s),i.appendChild(a),i.appendChild(d),i.appendChild(u);const m=document.createElement("div");return m.className="error-container",n.push(i),n.push(m),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,s]=t.split("/").map(Number),a=new Date(s,i-1,o);return a.getFullYear()===s&&a.getMonth()===i-1&&a.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.N=![],this.H=null;const t=ClientConfigService.getInstance();this.j=this.attachShadow({mode:t.get("openShadowDom")?"open":"closed"})}initialize(t,n){if(this.N)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.j)throw new SDKError("LceElementComponent: Shadow DOM container is not available");n&&"function"==typeof n.rerender&&(this.H=t=>{n.rerender(t||"LceElementRerender")}),this.j.appendChild(n),this.applyBasicStyles();const i=ThemeProviderService.getInstance(),o=i.getStylesheet(t);this.applyThemeStyles(o),this.N=!![],this.j=null}rerender(t){this.H&&this.H(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.j.adoptedStyleSheets=[n,...this.j.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(ht){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.j.adoptedStyleSheets=[...this.j.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const n=document.createElement("style");n.textContent=t,this.j&&this.j.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 s=document.createElement("span");s.classList.add("promo-ticker__text-item"),s.textContent=i,n.appendChild(s);const a=document.createElement("span");a.classList.add("promo-ticker__separator"),a.textContent=t.separator,n.appendChild(a)}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 s=0;s<5;s++)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 Ot=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 s in n){const a=n[s],d=i[s];if(!(s in t)){o.push('Property "'+s+'" does not exist in target schema, skipping merge.');continue}const u=getType(a),m=getType(d);u===m?isObject(a)&&isObject(d)?i[s]=deepMergeConfigs(d,a):i[s]=a:o.push('Type mismatch for key "'+s+'": source is '+u+", target is "+m+". Skipping merge.")}return o.length>0&&Ot.warn("Merging configurations with warnings:",o),i}const Lt=new Map([["global.layout.enablePersonalization",[w.PRODUCT,w.CART,w.CHECKOUT,w.ENGRAVING_FORM,w.ENGRAVING_VIEW,w.PRODUCT_INTERACTIONS,w.CART_ITEM,w.CHECKOUT_ITEM]],["global.layout.personalizationText",[w.PRODUCT,w.CART,w.CHECKOUT,w.ENGRAVING_FORM,w.ENGRAVING_VIEW,w.CART_ITEM]],["global.layout.personalizationCardStyle",[w.PRODUCT,w.CART,w.CHECKOUT,w.ENGRAVING_FORM,w.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[w.CART,w.CART_PROMO_CODE,w.CART_FOOTER,w.CHECKOUT_ORDER_SUMMARY,w.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[w.CART,w.CHECKOUT,w.ADDRESS,w.INPUT,w.BIRTHDATE_INPUT,w.ADDRESS_INPUT,w.CHECKOUT_DELIVER_TO,w.CHECKOUT_BUYER,w.CHECKOUT_BILLING,w.CHECKOUT_PAYMENT,w.CART_PROMO_CODE]],["global.layout.showPoweredBy",[w.CART,w.CHECKOUT,w.CHECKOUT_COMPLETED,w.POWERED_BY,w.CART_FOOTER,w.CHECKOUT_ORDER_SUMMARY,w.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[w.POWERED_BY]],["product.layout.showImages",[w.PRODUCT,w.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[w.PRODUCT]],["product.layout.showDescription",[w.PRODUCT,w.PRODUCT_DESCRIPTION,w.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[w.PRODUCT,w.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[w.PRODUCT,w.PRODUCT_RETAILERS,w.PRODUCT_RETAILERS_CAROUSEL,w.PRODUCT_RETAILERS_POPUP,w.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[w.PRODUCT,w.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[w.PRODUCT,w.PRODUCT_IMAGE_CAROUSEL,w.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[w.PRODUCT,w.PRODUCT_RETAILERS,w.PRODUCT_RETAILERS_CAROUSEL,w.PRODUCT_RETAILERS_POPUP,w.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[w.PRODUCT,w.PRODUCT_RETAILERS,w.PRODUCT_RETAILERS_CAROUSEL,w.PRODUCT_RETAILERS_POPUP,w.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[w.PRODUCT,w.PRODUCT_ADD_TO_CART_SECTION,w.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[w.PRODUCT,w.PRODUCT_ADD_TO_CART_SECTION,w.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[w.PRODUCT,w.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[w.PRODUCT,w.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[w.CART,w.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[w.CART,w.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[w.CART,w.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[w.CART,w.CART_FOOTER]],["checkout.layout.emailOptIn",[w.CHECKOUT,w.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[w.CHECKOUT,w.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[w.CHECKOUT,w.CHECKOUT_GIFT_CARDS,w.CHECKOUT_ORDER_SUMMARY,w.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[w.CHECKOUT,w.CHECKOUT_ORDER_SUMMARY,w.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[w.CHECKOUT,w.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[w.CHECKOUT,w.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[w.CHECKOUT,w.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[w.CHECKOUT,w.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[w.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,n){const i=new Set;for(const o of Object.keys(n)){const n=Lt.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.injectedComponents=new Map,this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authClient=AuthClientService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Failed to prepare client",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",ht.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),this.logger.info("🔐 Starting authentication...");const t=await this.authClient.authenticate();if(!t)throw this.clientPrepared=![],new SDKError("Authentication failed. Please try again.",!![]);this.logger.info("✅ Authentication completed"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed"),this.logger.info("⚙️ Loading configurations...");let 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 s=o?null:await this.apiClient.getPersistedStore(i);if(await this.store.initialize({userDeviceId:i,isLocalStorageAvailable:o,persistedStore:s}),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");await this.googleTagManager.initialize({partnerName:t.partnerName,enablePartnerGTM:t.enablePartnerGTM,partnerGTMId:t.partnerGTMId||void 0,enableLiquidCommerceGTM:t.enableLiquidCommerceGTM,liquidCommerceGTMId:t.liquidCommerceGTMId}),this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t||"object"!=typeof t)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof t,!![]);const{type:n,containerId:i,...o}=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("#",""),a=document.getElementById(s);if(!a)return console.warn("Container with ID '"+s+"' not found"),null;a.innerHTML="";const d={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...o},u=ComponentFactoryService.createElement(d);return safeReplaceChildren(a,u),t.type===w.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=[],o=[];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 o=i.every(n=>n.containerId!==t);if(!o){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 a=i.every(t=>t.identifier!==s.identifier);a?i.push({containerId:t,identifier:s.identifier}):this.logger.warn("Duplicate product identifier '"+s.identifier+"' found, skipping")}for(const s of i){const t=ComponentFactoryService.createElement({type:w.PRODUCT,useShadowDom:!![],productId:s.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),n=document.getElementById(s.containerId);n?(n.innerHTML="",n.appendChild(t),o.push(this.createInjectedComponentWrapper(s.containerId,w.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)),o}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,w.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(I).includes(t.cardVariant))throw new SDKError('Invalid card variant "'+t.cardVariant+'". Valid options: '+Object.values(I).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(A);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:w.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:t.cardVariant||I.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:w.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(w.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(w.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(w.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(w.CART,AddressInputComponent),ComponentFactoryService.registerComponent(w.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_SEARCH,ProductListSearchComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(w.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(w.INPUT,InputComponent),ComponentFactoryService.registerComponent(w.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(w.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(w.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(w.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(w.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(w.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(w.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(w.ALERT,AlertComponent),ComponentFactoryService.registerComponent(w.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(w.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(w.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(w.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(w.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(w.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(w.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(w.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(w.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(w.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(w.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(w.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(w.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(w.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(w.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(w.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(w.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(w.CART,CartComponent),ComponentFactoryService.registerComponent(w.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(w.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(w.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(w.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(w.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(w.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(w.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(w.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(w.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(w.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(w.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(w.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(w.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 o=ComponentFactoryService.createElement({type:w.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:n});i.innerHTML="",safeReplaceChildren(i,o)},floatingCartButton:t=>{this.ensureCartDrawerExists();const n=ComponentFactoryService.createElement({type:w.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 p=t=>{n.textContent=formatCentToDollarText(t)},i=this.store.get("cart.totals.subtotal")||0;p(i),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.subtotal")||0;p(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 Z=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"))},s=this.store.get("cart.totals.quantity")||0;Z(s),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.quantity")||0;Z(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,w.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:w.ADDRESS,containerId:t,options:n}):(this.injectDisabledElementsError(t,w.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:w.CART,containerId:t}):(this.injectDisabledElementsError(t,w.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:w.CHECKOUT,containerId:t}):(this.injectDisabledElementsError(t,w.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,n){try{SingletonManager.setContext({isBuilder:![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:n.env,isBuilder:![],debugMode:n.debugMode,customTheme:n.customTheme,promoTicker:n.promoTicker,proxy:n.proxy,development:n.development});const o=i.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const s=await SingletonManager.getClient(o);if(!s.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const a={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=a;const d=PubSubService.getInstance();return d.publishAction(b.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:i.get("version")}),a}catch(i){try{const t=LoggerFactory.get("ElementsClientInit");t.error("Elements Client Initialization failed",i)}catch(o){console.error("[LiquidCommerce Elements] Client initialization failed:",null==i?void 0:i.message)}try{const t=ClientConfigService.getInstance(),n=PubSubService.getInstance();n.publishAction(b.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==i?void 0:i.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 zt={CORE:{MAIN_SCRIPT:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode"},PROMO_TICKER:{CODE:"data-promo-code",TEXT:"data-promo-text",SEPARATOR:"data-promo-separator",ACTIVE_FROM:"data-promo-active-from",ACTIVE_UNTIL:"data-promo-active-until",CODE_PARAM:"data-promo-code-param"},PRODUCT:{PRODUCT:"data-product",CONTAINER:"data-container",PARAM:"data-product-param",FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",LCE_PRODUCT:"data-lce-product"},PRODUCT_LIST:{LIST:"data-liquid-commerce-elements-products-list",SCRIPT:"data-liquid-commerce-elements-products",CARD:"data-card",CARD_FILL:"data-card-fill",ROWS:"data-rows",COLUMNS:"data-columns",FILTERS:"data-filters",PRODUCT_URL:"data-product-url"},CART:{BUTTON:"data-cart-button",BADGE_BUTTON:"data-cart-badge-button",MOBILE_BUTTON:"data-cart-mobile-button",MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",BUTTON_HIDDEN:"data-cart-button-hidden",TOGGLE_BUTTON:"data-lce-cart-toggle-button",ITEMS_COUNT:"data-lce-cart-items-count"},DEVELOPMENT:"data-liquid-commerce-elements-development"};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function generateElementId({prefix:t,index:n}){const i=Math.random().toString(36).substring(2,7),o=void 0!==t?t:"",s=void 0!==n?n:"",a=o&&s?"-":"";return""+o+a+s+i}function pairsFromMainScript(t){const n=[];try{const o=t.getAttributeNames().filter(t=>t.substring(0,12)===zt.PRODUCT.PRODUCT);for(const s of o)try{const i=s.match(/^data-product(-(.+))?$/),o=(null==i?void 0:i[2])?"-"+i[2]:"",a=""+zt.PRODUCT.CONTAINER+o;if(t.hasAttribute(a)){const i=t.getAttribute(a),o=t.getAttribute(s);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["+zt.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["+zt.PRODUCT.LCE_PRODUCT+"]");let o=0;for(const s of i)try{const n=generateElementId({prefix:"lce-p",index:o});s.setAttribute("id",n);const i=s.getAttribute(zt.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(zt.PRODUCT.PARAM),s=n.getAttribute(zt.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 a=new URLSearchParams(window.location.search),d=a.get(o);if(!d)return;let u=C.SHIPPING;if(s)if(startsWithLcePrefix(s)){const t=a.get(s);t!==C.ON_DEMAND&&t!==C.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(zt.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 s=new URLSearchParams(window.location.search),a=s.get(o);if(!a)return;try{await t.actions.cart.applyPromoCode(a)}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 s,a,d;try{const u=i.includes("mobile"),m=u?"mobile":"desktop",g=!u,v=n.getAttribute(i),y=n.getAttribute(o);if(!n.hasAttribute(i)&&!n.hasAttribute(o))return;if(g){if(n.hasAttribute(i)&&!v)return t.ui.floatingCartButton(![]),void 0;if(n.hasAttribute(o)&&!y)return t.ui.floatingCartButton(!![]),void 0}const b=v||y,x=!!y;if(!b)return g&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(x)),void 0;const w=["above","below","replace","inside"],C=b.match(/^(\w+):(.+)$/),k=C&&w.includes(C[1])?C[1]:"inside";let S=C?C[2]:b;/^[#.]/.test(S)||/\s/.test(S)||(S="#"+S);const I=document.querySelector(S);if(!I)return g&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+S+'" not found. Using floating button.'),t.ui.floatingCartButton(x)),void 0;const A=document.createElement("div");switch(A.classList.add("lce-cart-"+m+"-button-container"),A.id=generateElementId({prefix:"lce-cart-"+m+"-btn"}),k){case"above":null===(s=I.parentNode)||void 0===s?void 0:s.insertBefore(A,I);break;case"below":null===(a=I.parentNode)||void 0===a?void 0:a.insertBefore(A,I.nextSibling);break;case"replace":null===(d=I.parentNode)||void 0===d?void 0:d.replaceChild(A,I);break;default:I.appendChild(A)}t.ui.cartButton(A.id,x)}catch(u){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",u)}}async function setupCartButtons(t,n){n.hasAttribute(zt.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(t,n,zt.CART.BUTTON,zt.CART.BADGE_BUTTON),await setupCartButtonWithPosition(t,n,zt.CART.MOBILE_BUTTON,zt.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(t){try{const n=document.querySelector("div["+zt.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(zt.PRODUCT_LIST.CARD)||"standard",s=n.hasAttribute(zt.PRODUCT_LIST.CARD_FILL),a=Number.parseInt(n.getAttribute(zt.PRODUCT_LIST.ROWS)||"3",10)||3,d=Number.parseInt(n.getAttribute(zt.PRODUCT_LIST.COLUMNS)||"4",10)||4,u=n.getAttribute(zt.PRODUCT_LIST.FILTERS),m=n.getAttribute(zt.PRODUCT_LIST.PRODUCT_URL)||void 0;let g=[];u&&(g=u.split(",").map(t=>t.trim()).filter(t=>t.length>0)),await t.injectProductList({containerId:i,rows:a,columns:d,cardVariant:o,fillCard:s,filters:g,productUrl:m})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",n)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async t=>{const n=t.detail;if(!n.data.isReady)return;const i=window.elements,o=document.querySelectorAll("["+zt.CART.TOGGLE_BUTTON+"]");if(o.length>0)for(const a of o)a.addEventListener("click",async t=>{t.stopPropagation(),t.preventDefault(),i.actions.cart.toggleCart()});const s=document.querySelectorAll("["+zt.CART.ITEMS_COUNT+"]");if(s.length>0){let t=0;for(const n of s){const o=n.getAttribute(zt.CART.ITEMS_COUNT),s=!(o&&"keep-zero"===o),a=Boolean(null==n?void 0:n.id);let d;a?d=n.id:(d=generateElementId({prefix:"lce-cart-items-count",index:t}),n.id=d),i.ui.cartItemsCount(d,{hideZero:s}),t+=1}}})}catch(ht){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",ht)}}function getDevelopmentConfigs(){const t=document.querySelector("script["+zt.DEVELOPMENT+"]");if(t)try{return JSON.parse(t.textContent||"{}")}catch(n){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",n),void 0}}async function ElementsAutoInitialize(){var t,n,i,o,s,a;try{const a=document.querySelector("script["+zt.CORE.MAIN_SCRIPT+"]");if(!a)return;const d=a.getAttribute(zt.CORE.TOKEN),u=a.getAttribute(zt.CORE.ENV)||y.PRODUCTION,m=a.getAttribute(zt.CORE.DEBUG_MODE);if(!d)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const g=a.getAttribute(zt.PROMO_TICKER.CODE),v=a.getAttribute(zt.PROMO_TICKER.TEXT),b=null!==(t=a.getAttribute(zt.PROMO_TICKER.SEPARATOR))&&void 0!==t?t:"•",x=null!==(n=a.getAttribute(zt.PROMO_TICKER.ACTIVE_FROM))&&void 0!==n?n:void 0,w=null!==(i=a.getAttribute(zt.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==i?i:void 0,C=pairsFromMainScript(a),S=pairsFromProductsScript(),I=pairsFromAttributedElements(),A=[...C,...S,...I],P=g&&v&&x&&w?{promoCode:g,text:v.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:b,activeFrom:null===(o=new Date(x))||void 0===o?void 0:o.toISOString(),activeUntil:null===(s=new Date(w))||void 0===s?void 0:s.toISOString()}:void 0;let _=k.NONE;m&&u!==y.PRODUCTION&&(_=m),setupEventListeners();const N=await Elements(d,{env:u,debugMode:_,promoTicker:P?[P]:void 0,development:getDevelopmentConfigs()});if(!N)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);setupCartButtons(N,a),0!==A.length&&N.injectProductElement(A).catch(t=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",t)}),initializeProductsList(N),addProductToCartViaQueryParam(N,a),addPromoCodeToCartViaQueryParam(N,a)}catch(d){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(a=null==d?void 0:d.message)&&void 0!==a?a:String(d))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(ht){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",ht)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(ht){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",ht)}},50)}catch(ht){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",ht)}}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:w.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:w.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:w.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,n){try{SingletonManager.setContext({isBuilder:!![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:n.env,isBuilder:!![],debugMode:n.debugMode,customTheme:n.customTheme,promoTicker:n.promoTicker,proxy:void 0,development:void 0});const o=i.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const s=await SingletonManager.getClient(o);if(!s.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const a={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=a;const d=PubSubService.getInstance();return d.publishAction(b.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:i.get("version")}),a}catch(i){try{const t=LoggerFactory.get("ElementsBuilderClientInit");t.error("Elements Builder Client Initialization failed",i)}catch(o){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==i?void 0:i.message)}try{const t=ClientConfigService.getInstance(),n=PubSubService.getInstance();n.publishAction(b.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==i?void 0:i.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,s,a)=>isSDKError(a,i)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:n,source:i,lineno:o,colno:s,error:a}),!![]):t?t(n,i,o,s,a):![];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(Mt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Mt)}try{triggerElementsAutoInit()}catch(Bt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Bt)}}catch(Wt){console.error("[LiquidCommerce Elements] SDK initialization failed:",Wt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...t){for(;this.firstChild;)this.removeChild(this.firstChild);for(const e of t)"string"==typeof e?this.appendChild(document.createTextNode(e)):this.appendChild(e)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const e=document.createDocumentFragment();for(const n of t)"string"==typeof n?e.appendChild(document.createTextNode(n)):e.appendChild(n);this.insertBefore(e,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.replaceChild(n,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.insertBefore(n,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.insertBefore(n,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const e={};for(const[n,i]of t)e[n]=i;return e})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(et){console.warn("DOM polyfills initialization failed:",et)}}function safeReplaceChildren(t,...e){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...e);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const n of e)"string"==typeof n?t.appendChild(document.createTextNode(n)):t.appendChild(n)}}catch(n){console.error("replaceChildren operation failed:",n),1===e.length&&"string"==typeof e[0]&&(t.innerHTML=e[0])}}class SDKError extends Error{constructor(t,e=![]){super(t),this.name="SDKError",this.isSdk=!![],this.reThrow=e,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(t,e){if((null==t?void 0:t.isSdk)===!![])return t instanceof SDKError&&t.reThrow?![]:!![];if(!t||"object"!=typeof t)return e?isSDKSource(e):![];const n=String((null==t?void 0:t.message)||""),i=/liquidcommerce\s+elements/i.test(n),r=String((null==t?void 0:t.stack)||""),s=(null==t?void 0:t.source)||e||"",a=[/@[/\\](?: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],c=[/\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/],l=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],d=[/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],h=isSDKSource(s),u=a.some(t=>t.test(r)),m=c.some(t=>t.test(r)),f=l.some(t=>t.test(r)),g=d.some(t=>t.test(r));return i||h||u||m||f||g}function isSDKSource(t){if(!t||"string"!=typeof t)return![];const e=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return e.some(e=>e.test(t))}var t;(function(t){t.BRANDS="brands",t.FLAVOR="flavor",t.FULFILLMENT="fulfillment",t.TAGS="tags",t.REGION="region",t.VARIETY="variety",t.ENGRAVING="engraving",t.PRICE="price",t.PRESALE="presale",t.AVAILABILITY="availability",t.CATEGORIES="categories",t.SIZES="sizes",t.COLORS="colors",t.APPELLATION="appellation",t.COUNTRY="country",t.VINTAGE="vintage",t.MATERIALS="materials",t.COLLECTION_TAGS="collectionTags"})(t||(t={}));const e={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},i={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},r={DRAWER:"drawer",INPUT:"input",BIRTHDATE_INPUT:"birthdate-input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},s={ON_DEMAND:"onDemand",SHIPPING:"shipping"},a={NONE:"none",CONSOLE:"console",PANEL:"panel"},c={[e.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[e.STAGING]:"https://staging-elements.liquidcommerce.us",[e.PRODUCTION]:"https://elements.liquidcommerce.us"},l={STANDARD:"standard"},d={PERSONALIZATION:"personalization",PRE_ORDER:"pre-order",DELIVERY_OPTIONS:"delivery-options",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},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,e){const n=SingletonManager.getInstances();n.has(t)||n.set(t,e());const i=n.get(t);if(!i)throw new SDKError("ElementsSdk: Instance for class "+t+" could not be created.");return i}static async getClient(t){const e=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),n="LiquidCommerceElementsClient_"+e,i=SingletonManager.getInstances();if(i.has(n))return i.get(n);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const r=new SingletonManager.clientConstructor(t);return await r.prepare(),i.set(n,r),r}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const u="lce",m={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},f={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:s.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},g={id:null,subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},v={token:"",cartId:"",loading:![],updating:![],error:null,warning:[],presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddressTwo:"",promoCode:null,giftCards:[],orderNumber:null,items:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,platform:0,tax:0,engraving:0,giftCards:0,service:0,tip:0,details:{taxes:{bag:0,bottleDeposits:0,retailDelivery:0,products:0,delivery:0,shipping:0},discounts:{products:0,delivery:0,shipping:0,service:0,engraving:0}}},rerender:![],onDemandFulfillmentTipInfo:{},tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},y={drawer:{isOpen:![],contentConfig:null}},b={products:{},cart:g,address:m,checkout:v,ui:y};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,e={}){this.validateInputs(t,e),this.config=Object.freeze(this.buildConfiguration(t,e))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,e){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[t]:e})}isDevelopment(){return this.get("env")===e.DEVELOPMENT}isStaging(){return this.get("env")===e.STAGING}isProduction(){return this.get("env")===e.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const t=this.get("debugMode");return t===a.CONSOLE||t===a.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===a.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===a.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}getProxyConfig(){return this.get("proxy")}validateInputs(t,n){if(!(null==t?void 0:t.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(n.env&&!Object.values(e).includes(n.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+n.env+'". Using default environment.'),n.env=void 0),void 0!==n.isBuilder&&"boolean"!=typeof n.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),n.isBuilder=void 0),void 0===n.debugMode||Object.values(a).includes(n.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+n.debugMode+'". Must be one of: '+Object.values(a).join(", ")+". Using default value."),n.debugMode=void 0),n.promoTicker&&"object"!=typeof n.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),n.promoTicker=void 0),n.promoTicker)if(Array.isArray(n.promoTicker)){const t=n.promoTicker.filter((t,e)=>{if("string"!=typeof t.promoCode||!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof t.separator||!t.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom is required. Skipping this promo."),![];const n="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(n instanceof Date)||Number.isNaN(n.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil is required. Skipping this promo."),![];const i="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return i instanceof Date&&!Number.isNaN(i.getTime())?n>=i?(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});n.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),n.promoTicker=void 0;n.proxy&&("object"!=typeof n.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),n.proxy=void 0):n.proxy.baseUrl&&"string"==typeof n.proxy.baseUrl?n.proxy.headers&&"object"!=typeof n.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),n.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),n.proxy=void 0))}buildConfiguration(t,n){var i,r,s,l;const d=n.env||e.PRODUCTION;let h=c[d];const m=d===e.PRODUCTION,f=n.isBuilder||![],g=u+(m?"":"_"+d)+(f?"builder":"");return(null===(i=n.development)||void 0===i?void 0:i.customApiUrl)&&(h=n.development.customApiUrl),{apiKey:t.trim(),env:d,isBuilder:f,debugMode:n.debugMode||a.NONE,baseUrl:h,partnerCode:void 0,partnerName:void 0,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:g,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null,paymentMethodId:(null===(r=n.development)||void 0===r?void 0:r.paymentMethodId)||void 0,openShadowDom:m?![]:(null===(s=n.development)||void 0===s?void 0:s.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(l=n.development)||void 0===l?void 0:l.customApiUrl)}}detectDeviceType(){var t,e;if("undefined"==typeof navigator)return"desktop";const n=navigator.userAgent.toLowerCase(),i="ontouchstart"in window||navigator.maxTouchPoints>0,r=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,s=(null===(e=window.screen)||void 0===e?void 0:e.height)||0,a=Math.max(r,s),c=[/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/],l=[/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 c.some(t=>t.test(n))?"tablet":l.some(t=>t.test(n))||i&&a<768?"mobile":i&&a>=768&&a<=1200||i&&/macintosh/i.test(n)&&navigator.maxTouchPoints>1||/android/i.test(n)&&i&&a>=768||/windows nt/i.test(n)&&i&&a>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(n),"desktop")}}class LoggerService{constructor(t){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.telemetryService=null,this.context=t}static getInstance(t){return SingletonManager.getClassInstance("LoggerService_"+t,()=>new LoggerService(t))}setEnableLogging(t){this.enableLogging=t}setTelemetryService(t){this.telemetryService=t}getPrefix(t){if(!this.enableLogging)return[];const e=(new Date).toISOString().slice(11,23);return["%c["+e+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[t],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[t],"color: "+this.colors[t]]}debug(t,e){if(this.sendToTelemetry("debug",t,void 0,e),!this.enableLogging)return;const[n,...i]=this.getPrefix("debug");void 0!==e?console.debug(n,...i,t,e):console.debug(n,...i,t)}info(t,e){if(!this.enableLogging)return;const[n,...i]=this.getPrefix("info");void 0!==e?console.info(n,...i,t,e):console.info(n,...i,t)}warn(t,e){if(this.sendToTelemetry("warn",t,void 0,e),!this.enableLogging)return;const[n,...i]=this.getPrefix("warn");void 0!==e?console.warn(n,...i,t,e):console.warn(n,...i,t)}error(t,e){const n=e instanceof Error,i=n?e:void 0,r=!n&&e?e:void 0;if(this.sendToTelemetry("error",t,i,r),!this.enableLogging)return;const[s,...a]=this.getPrefix("error");void 0!==e?console.error(s,...a,t,e):console.error(s,...a,t)}sendToTelemetry(t,e,n,i){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,e,{context:this.context,error:n,data:i})}catch(r){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const e=this.getInstances();if(!e.has(t)){const n=LoggerService.getInstance(t);n.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&n.setTelemetryService(this.telemetryService),e.set(t,n)}return e.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const e=this.getInstances();for(const[,n]of e)n.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const e=this.getInstances();for(const[,n]of e)n.setTelemetryService(t)}}function componentError({componentType:t,message:e}){const n=document.createElement("div");n.className=t;const i=n.attachShadow({mode:"closed"}),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"),a=document.createElement("h3");a.textContent="Component </"+t+">";const c=document.createElement("p");return c.textContent=e,s.appendChild(r),s.appendChild(a),s.appendChild(c),i.appendChild(s),n}function productionComponentError({title:t,message:e,componentType:n}){const i=document.createElement("div");i.setAttribute("data-component-type",n);const r=i.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 a=document.createElement("div"),c=document.createElement("h2");c.textContent=t;const l=document.createElement("p");return l.textContent=e,a.appendChild(s),a.appendChild(c),a.appendChild(l),r.appendChild(a),i}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null;class ComponentFactoryService{static get logger(){return ComponentFactoryService.t||(ComponentFactoryService.t=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.t}static get clientConfig(){return ComponentFactoryService.i||(ComponentFactoryService.i=ClientConfigService.getInstance()),ComponentFactoryService.i}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(t,e){ComponentFactoryService.getComponentRegistry().set(t,e)}static createElement(t){try{const e=ComponentFactoryService.getComponentRegistry().get(t.type);if(!e)throw new SDKError("Component type ["+t.type+"] is not registered");const n=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(n)||window.customElements.define(n,e);const i=document.createElement(n);if(i.initialize){const{type:e,useShadowDom:r,wrapInLceElement:s,...a}=t,c={type:e,tagName:n,useShadowDom:r&&s!==!![]};i.initialize({data:a,config:c})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(r.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const s=document.createElement(n);return s.initialize(t.type,i),s}return i}catch(e){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t.type}):componentError({componentType:t.type,message:(null==e?void 0:e.message)||e})}}static componentError({componentType:t,message:e}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t}):componentError({componentType:t,message:e})}static getComponentTagName(t){const e={[r.DRAWER]:"drawer-lc",[r.INPUT]:"input-lc",[r.BIRTHDATE_INPUT]:"birthdate-input-lc",[r.ENGRAVING_FORM]:"engraving-form-lc",[r.ENGRAVING_VIEW]:"engraving-view-lc",[r.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[r.POWERED_BY]:"powered-by-lc",[r.LCE_ELEMENT]:"lce-element",[r.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[r.ALERT]:"alert-lc",[r.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[r.ADDRESS]:"address-lc",[r.ADDRESS_INPUT]:"address-input-lc",[r.ADDRESS_DISPLAY]:"address-display-lc",[r.PRODUCT]:"product-lc",[r.PRODUCT_OPTIONS]:"product-options-lc",[r.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[r.PRODUCT_INTERACTIONS]:"product-interactions-lc",[r.PRODUCT_DESCRIPTION]:"product-description-lc",[r.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[r.PRODUCT_RETAILERS]:"product-retailers-lc",[r.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[r.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[r.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[r.PRODUCT_PRICE]:"product-price-lc",[r.PRODUCT_DRAWER]:"product-drawer-lc",[r.PRODUCT_LOADING]:"product-loading-lc",[r.PRODUCT_LIST]:"product-list-lc",[r.PRODUCT_LIST_CARD]:"product-list-card-lc",[r.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[r.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[r.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[r.CART]:"cart-lc",[r.CART_RETAILER]:"cart-retailer-lc",[r.CART_ITEM]:"cart-item-lc",[r.CART_FOOTER]:"cart-footer-lc",[r.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[r.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[r.CART_PROMO_CODE]:"cart-promo-code-lc",[r.CART_HEADER]:"cart-header-lc",[r.CART_BODY]:"cart-body-lc",[r.CART_FULFILLMENT]:"cart-fulfillment-lc",[r.CHECKOUT]:"checkout-lc",[r.CHECKOUT_INFORMATION]:"checkout-information-lc",[r.CHECKOUT_PAYMENT]:"checkout-payment-lc",[r.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[r.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[r.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[r.CHECKOUT_BILLING]:"checkout-billing-lc",[r.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[r.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[r.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[r.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[r.CHECKOUT_ITEMS]:"checkout-items-lc",[r.CHECKOUT_COMPLETED]:"checkout-completed-lc",[r.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[r.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[r.CHECKOUT_BUYER]:"checkout-buyer-lc",[r.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[r.CHECKOUT_TIPS]:"checkout-tips-lc",[r.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[r.CHECKOUT_ITEM]:"checkout-item-lc",[r.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[r.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[r.CHECKOUT_HEADER]:"checkout-header-lc",[r.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[r.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[r.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return e[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;class PubSubService{constructor(){this.clientReadyEvent=null,this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub"),this.setupClientReadyBuffering()}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,e){this.publishSpecific("actions."+t,e)}publishForm(t,e){this.publishSpecific("forms."+t,e)}publishSpecific(t,e){const[n,i]=t.includes(".")?t.split(".",2):["actions",t];let r=i.split("_")[0];["product","cart","address","checkout"].includes(r)||(r="other");const s=Date.now(),a={eventId:"evt_"+s+"_"+Math.random().toString(36).slice(2,9),namespace:n,event:i,originalEvent:t,actionNamespace:"actions"===n?r:void 0,timestamp:s},c={data:e,metadata:a};this.dispatchNativeEvents(t,c)}dispatchNativeEvents(t,e){const[n]=t.split(".",2);try{"actions.client_ready"===t&&(this.clientReadyEvent=e);const i=new CustomEvent(this.eventPrefix+":"+t,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(i);const r=new CustomEvent(this.eventPrefix+":"+n,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(r)}catch(i){this.logger.error("Error dispatching native events for "+t,i)}}setupClientReadyBuffering(){const t=window.addEventListener,e=this.eventPrefix+":actions.client_ready";window.addEventListener=(n,i,r)=>{if(n!==e)return t.call(window,n,i,r);if(!this.clientReadyEvent)return t.call(window,n,i,r);try{const t=new CustomEvent(e,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof i?i(t):i&&"function"==typeof i.handleEvent&&i.handleEvent(t)}catch(s){this.logger.error("Error replaying CLIENT_READY event",s)}return t.call(window,n,i,r)}}}function centToDollar(t){return t/100}function formatCentToDollarText(t,e=!![]){const n=Math.floor(t/100),i=t%100;let r="$"+n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(e||i>0)&&(r+=".",r+=i<10?"0"+i:i.toString()),r}function htmlStringToElement(t){const e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstElementChild}function format24TimeTo12(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new SDKError("Invalid time format: "+t);const n=Number.parseInt(e[1],10),i=Number.parseInt(e[2],10);if(n<0||n>23||i<0||i>59)throw new SDKError("Invalid time values: "+t);const r=n>=12?"PM":"AM",s=n%12||12;return s+":"+i.toString().padStart(2,"0")+" "+r}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const e=new Date(t);if(Number.isNaN(e.getTime()))return"";const n=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),r=e.getFullYear().toString();return n+"/"+i+"/"+r}catch(e){return""}}function buildFormattedAddressString(t){const e=[],n=[];t.one&&t.one.trim()&&n.push(t.one.trim()),t.two&&t.two.trim()&&n.push(t.two.trim()),n.length>0&&e.push(n.join(" ")),t.city&&t.city.trim()&&e.push(t.city.trim());const i=[];return t.state&&t.state.trim()&&i.push(t.state.trim()),t.zip&&t.zip.trim()&&i.push(t.zip.trim()),i.length>0&&e.push(i.join(" ")),t.country&&t.country.trim()&&e.push(t.country.trim()),e.join(", ")}function capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const e=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:e[0]||"",category2:e[1]||"",category3:e[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async getAllConfigs(){try{const t=await this.client.get("/configs");return t.data}catch(t){throw this.logger.error("Error fetching configs",t),new SDKError("Failed to fetch all configs: "+(null==t?void 0:t.message))}}async setPersistedStore(t,e){try{if(!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!e||0===Object.keys(e).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+t,{body:e})}catch(n){this.logger.error("Error setting persisted store",n)}}async getPersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to get persisted store"),null;const e=await this.client.get("/configs/store/"+t);return e.data}catch(e){return this.logger.error("Error fetching persisted store",e),null}}async deletePersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+t+"/delete")}catch(e){this.logger.error("Error deleting persisted store",e)}}async getAddressSuggestions(t){try{if(!t||0===t.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const e=await this.client.post("/address/autocomplete",{body:{input:t}});return e.data}catch(e){return this.logger.error("Error fetching address suggestions",e),[]}}async getAddressDetails(t){try{if(!t||0===t.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const e=await this.client.post("/address/details",{body:{id:t}});return e.data}catch(e){throw this.logger.error("Error fetching address details",e),new SDKError("Failed to fetch address details: "+(null==e?void 0:e.message))}}async getProductsData(t,e){try{if(0===t.length)return this.logger.error("No product identifiers provided"),null;const n={identifiers:t,location:e},i=await this.client.post("/product/availability",{body:n});return i.data}catch(n){return this.logger.error("Error fetching product data",n),null}}async catalogSearch(t){var e;try{const e=await this.client.post("/product/search",{body:t});return e.data}catch(n){return this.logger.error("Error fetching catalog search data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),{products:[],retailers:{},navigation:void 0}}}async getCartData(t){try{const e=await this.client.post("/cart/get",{body:{id:t||void 0}});return e.data}catch(e){throw this.logger.error("Error fetching cart data",e),new SDKError("Failed to fetch cart data: "+e.message)}}async updateCart(t){try{const e=await this.client.post("/cart/update",{body:t});return e.data}catch(e){throw this.logger.error("Error updating cart",e),new SDKError("Failed to update cart: "+(null==e?void 0:e.message))}}async prepareCheckout(t){var e;try{const e=await this.client.post("/checkout/prepare",{body:t});return e.data}catch(n){throw this.logger.error("Error fetching prepare checkout data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),new SDKError("Failed to fetch prepare checkout data: "+(null==n?void 0:n.message))}}async getPaymentSession(t){var e;try{const e=await this.client.post("/checkout/payment/session",{body:t});return e.data}catch(n){throw this.logger.error("Error fetching payment session:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),new SDKError("Failed to get payment session: "+(null==n?void 0:n.message))}}async confirmPaymentSession(t,e){try{const n=await this.client.post("/checkout/payment/confirm",{body:{confirmationTokenId:t,setupIntentId:e}});return n.data}catch(n){throw this.logger.error("Error confirming payment session",n),new SDKError("Failed to confirm payment session: "+(null==n?void 0:n.message))}}async checkoutComplete(t){var e;try{const e=await this.client.post("/checkout/complete",{body:t});return e.data}catch(n){if(this.logger.error("Error completing checkout:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),null==n?void 0:n.error)throw new SDKError("Failed to complete checkout: "+(null==n?void 0:n.message));throw n}}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(t,e)=>t||e&&e.status>=500&&e.status<600?!![]:![],this.xhrFetch=(t,e)=>new Promise((n,i)=>{const r=new XMLHttpRequest;r.open(e.method||"GET",t);for(const[t,s]of Object.entries(e.headers))r.setRequestHeader(t,s);r.onload=()=>{const t={ok:r.status>=200&&r.status<300,status:r.status,statusText:r.statusText,headers:r.getAllResponseHeaders().split("\r\n").reduce((t,e)=>{const[n,i]=e.split(": ");return n&&i&&(t[n]=i),t},{}),o:r.responseText,json:()=>Promise.resolve(JSON.parse(r.responseText)),text:()=>Promise.resolve(r.responseText)};n(t)},r.onerror=()=>{i(new TypeError("Network request failed"))},r.ontimeout=()=>{i(new TypeError("Network request timed out"))},r.timeout=3e4,r.send(e.body)}),this.fetchImpl=this.getFetchImplementation()}async request(t){var e,n,i;const{url:r,options:s,retryConfig:a}=t,c=null!==(e=null==a?void 0:a.maxRetries)&&void 0!==e?e:3,l=null!==(n=null==a?void 0:a.retryDelay)&&void 0!==n?n:1e3,d=null!==(i=null==a?void 0:a.shouldRetry)&&void 0!==i?i:this.defaultShouldRetry;let h;const u=Date.now();for(let f=0;f<=c;f++){let t=Date.now();try{t=Date.now();const e=await this.fetchImpl(r,s),n=Date.now()-t;if(e.ok)return e;if(await this.logFailedResponse(r,s,e,n,f,c),f<c&&d(null,e)){await this.delay(l*2**f);continue}return e}catch(m){const e=Date.now()-t;if(h=m,this.logNetworkError(r,s,m,e,f,c),f<c&&d(m,void 0)){await this.delay(l*2**f);continue}throw this.enhanceError(m,r,s,Date.now()-u)}}throw this.enhanceError(h,r,s,Date.now()-u)}async logFailedResponse(t,e,n,i,r,s){const a=r<s;let c,l;try{n.o||(n.o=await n.text());try{c=JSON.parse(n.o)}catch(d){c=n.o}}catch(h){c="[Unable to read response body]"}if(e.body)try{l=JSON.parse(e.body)}catch(u){l=e.body}this.logger.error("HTTP request failed",{method:e.method,url:t,status:n.status,statusText:n.statusText,duration:i+"ms",attempt:r+1+"/"+(s+1),willRetry:a,requestHeaders:this.sanitizeHeaders(e.headers),requestBody:l,responseHeaders:this.sanitizeHeaders(n.headers),responseBody:c})}logNetworkError(t,e,n,i,r,s){var a;const c=r<s;this.logger.error("Network request failed",{method:e.method,url:t,error:(null==n?void 0:n.message)||"Unknown error",errorType:(null===(a=null==n?void 0:n.constructor)||void 0===a?void 0:a.name)||typeof n,duration:i+"ms",attempt:r+1+"/"+(s+1),willRetry:c,possibleCauses:this.diagnosePossibleCauses(n)})}diagnosePossibleCauses(t){var e,n,i,r,s;const a=[];return((null===(e=null==t?void 0:t.message)||void 0===e?void 0:e.includes("timeout"))||(null===(n=null==t?void 0:t.message)||void 0===n?void 0:n.includes("timed out")))&&a.push("Request timeout - server took too long to respond"),((null===(i=null==t?void 0:t.message)||void 0===i?void 0:i.includes("Failed to fetch"))||(null===(r=null==t?void 0:t.message)||void 0===r?void 0:r.includes("Network request failed")))&&(a.push("Network connectivity issue"),a.push("CORS policy blocking the request"),a.push("Server is not responding"),a.push("Request was blocked by browser or firewall")),(null===(s=null==t?void 0:t.message)||void 0===s?void 0:s.includes("aborted"))&&a.push("Request was aborted"),0===a.length&&a.push("Unknown network error"),a}enhanceError(t,e,n,i){const r=new Error((null==t?void 0:t.message)||"Network request failed - no response from server");return r.url=e,r.method=n.method,r.totalDuration=i+"ms",r.isNetworkError=!![],r.originalError=t,r.possibleCauses=this.diagnosePossibleCauses(t),r}sanitizeHeaders(t){const e={...t},n=["authorization","x-liquid-api-key","cookie","set-cookie"];for(const i of Object.keys(e))n.includes(i.toLowerCase())&&(e[i]="[REDACTED]");return e}delay(t){return new Promise(e=>setTimeout(e,t))}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):window.fetch?this.fetchAdapter(window.fetch):this.xhrFetch}fetchAdapter(t){return async(e,n)=>{var i;const r=await t(e,n);let s;if("function"==typeof(null===(i=r.headers)||void 0===i?void 0:i.entries))s=Object.fromEntries(r.headers.entries());else{s={};for(const[t,e]of r.headers)s[t]=e}const a={ok:r.ok,status:r.status,statusText:r.statusText,headers:s,json:async()=>(a.o||(a.o=await r.text()),JSON.parse(a.o)),text:async()=>(a.o||(a.o=await r.text()),a.o)};return a}}}class AuthClientService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(t))}async authenticate(){var t,e;if(this.isAuthenticating)return await new Promise(t=>{const k=()=>{this.isAuthenticating?setTimeout(k,100):t(void 0)};k()}),!!this.accessToken;this.isAuthenticating=!![];try{const n=await this.request("/auth",{method:"GET"},!![]),i=3e5;return this.accessToken=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.token,this.tokenExpiration=(null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.exp)-i,!![]}catch(n){return this.logger.error("Authentication failed",n),![]}finally{this.isAuthenticating=![]}}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(t,e,n=![]){var i;n||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(),...e.headers};n?s["X-Liquid-Api-Key"]=this.apiKey:s.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(s["X-Liquid-Api-Builder"]=!![]);const a={method:e.method,headers:s,body:e.body?JSON.stringify(e.body):void 0},Z=(t,e)=>{if(t)return!![];if(!n&&e){const t=e.status;if(401===t||403===t)return this.logger.warn("Authorization error detected, will retry with new token"),this.accessToken=null,this.tokenExpiration=null,!![]}return e&&e.status>=500&&e.status<600?!![]:![]};let c,l;try{c=await this.httpClient.request({url:r,options:a,retryConfig:{maxRetries:2,retryDelay:1e3,shouldRetry:Z}})}catch(h){throw this.logger.error("Request failed after all retries",{path:t,method:e.method,authType:n?"API Key":"Bearer Token",error:null==h?void 0:h.message,possibleCauses:null==h?void 0:h.possibleCauses}),{status:0,message:(null==h?void 0:h.message)||"Network error: Unable to connect to the API",url:r,method:e.method,isNetworkError:!![],originalError:h}}if(c.ok)try{return await c.json()}catch(u){const i=await c.text().catch(()=>"Success");return this.logger.error("Failed to parse successful response JSON",{path:t,method:e.method,status:c.status,authType:n?"API Key":"Bearer Token",responsePreview:i,error:null==u?void 0:u.message}),{message:i}}let d="";try{l=await c.json(),d=JSON.stringify(l)}catch(m){d=await c.text().catch(()=>"HTTP error status: "+c.status),l={message:d||"Unknown error"}}throw this.logger.error("API request failed",{path:t,method:e.method,authType:n?"API Key":"Bearer Token",status:c.status,statusText:c.statusText,message:null==l?void 0:l.message,requestId:null===(i=null==l?void 0:l.metadata)||void 0===i?void 0:i.requestId,responseBody:d}),{...l,status:c.status,message:(null==l?void 0:l.message)||"Request failed"}}buildUrl(t){const e=this.clientConfig.getProxyConfig();return new URL("api"+t,e?e.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}async get(t,e){return this.request(t,{method:"GET",headers:null==e?void 0:e.headers})}async post(t,e){return this.request(t,{method:"POST",body:null==e?void 0:e.body,headers:null==e?void 0:e.headers})}}const x="@liquidcommerce/elements-sdk",w="LiquidCommerce Elements SDK",S="UNLICENSED",E="LiquidCommerce Team",_="2.6.0-beta.7",D="https://docs.liquidcommerce.co/elements-sdk",T={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},I={url:"https://github.com/liquidcommerce/elements-sdk/issues"},F="./dist/index.esm.js",A="./umd/elements.js",O="./dist/types/index.d.ts",N="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"},L=["dist","umd","docs","README.md","LICENSE"],B={access:"public",registry:"https://registry.npmjs.org/"},j="module",q=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],H={build:"rollup -c","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build:dev",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},W=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],X={"@biomejs/biome":"2.3.5","@commitlint/cli":"^20.2.0","@commitlint/config-conventional":"^20.2.0","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.2","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.10.1","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.53.3","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},$={node:">=22"},tt={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},et={name:x,description:w,license:S,author:E,version:_,homepage:D,repository:T,bugs:I,module:F,browser:A,types:O,packageManager:N,exports:M,files:L,publishConfig:B,type:j,sideEffects:q,scripts:H,keywords:W,devDependencies:X,engines:$,pnpm:tt};class GoogleTagManagerService{constructor(){this.enablePartnerGTM=![],this.enableLiquidCommerceGTM=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(t){const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.some(e=>{const n=e.src;return n.includes("id="+t)})}isContainerInitialized(t){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(t)?window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event)):![]}async loadGTMScript(t){try{if(this.isContainerInitialized(t))return{success:!![],usingExistingGTM:!![],message:"Container "+t+" already loaded"};if(this.isContainerLoaded(t)){const e=await this.waitForContainerInit(t,1e4);return e?{success:!![],usingExistingGTM:!![],message:"Container "+t+" initialized"}:this.checkFallbackGTM(t)}return await this.injectGTMScript(t),{success:!![],usingExistingGTM:![],message:"Container "+t+" loaded successfully"}}catch(e){return this.checkFallbackGTM(t)}}waitForContainerInit(t,e){return new Promise(n=>{let i;const r=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(r),clearTimeout(i),n(!![]))},100);i=setTimeout(()=>{clearInterval(r),n(![])},e)})}injectGTMScript(t){return new Promise((e,n)=>{const i=document.createElement("script");i.src="https://www.googletagmanager.com/gtm.js?id="+t,i.async=!![],i.crossOrigin="anonymous";let r=![];const s=setTimeout(()=>{r||(r=!![],this.isContainerInitialized(t)?e():n(new Error("GTM script timeout")))},15e3);i.onload=()=>{r||setTimeout(()=>{r||(r=!![],clearTimeout(s),this.isContainerInitialized(t)||window.dataLayer&&Array.isArray(window.dataLayer)?e():n(new Error("GTM script loaded but failed to initialize")))},500)},i.onerror=()=>{setTimeout(()=>{r||(r=!![],clearTimeout(s),this.isContainerLoaded(t)&&this.isContainerInitialized(t)?e():n(new Error("GTM script failed to load")))},100)},document.head.appendChild(i)})}checkFallbackGTM(t){if(this.isGTMAlreadyLoaded()&&window.dataLayer&&Array.isArray(window.dataLayer)){if(this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId))return{success:!![],usingExistingGTM:!![],message:"Using partner GTM container"};const t=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));if(t)return{success:!![],usingExistingGTM:!![],message:"Using existing GTM container"}}return window.dataLayer&&Array.isArray(window.dataLayer)?{success:!![],usingExistingGTM:!![],message:"Using basic dataLayer for event tracking"}:{success:![],usingExistingGTM:![],message:"Failed to load container "+t+" and no fallback available"}}processEventQueue(){const t=Date.now(),e=this.eventQueue.filter(e=>t-e.timestamp<3e4);for(const i of e)try{const t={event:i.eventName,...i.eventData};window.dataLayer.push(t)}catch(n){this.logger.error("Error processing queued event "+i.methodName,n)}this.eventQueue=[],e.length>0&&this.logger.info("Processed "+e.length+" queued GTM events")}getSendToTargets(){const t=[];return this.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&t.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&t.push(this.partnerGTMId),t}async initialize(t){try{if(this.isInitialized)return Promise.resolve();if(this.isInitializing&&this.initializationPromise)return this.initializationPromise;if(0,this.clientConfigService.isBuilder())return;this.isInitializing=!![],this.initializationPromise=this.doInitialize(t),await this.initializationPromise}catch(e){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",e)}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGTMId))return;if(!t.enableLiquidCommerceGTM&&!t.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerCode=t.partnerCode,this.partnerGTMId=t.partnerGTMId,this.liquidCommerceGTMId=t.liquidCommerceGTMId,this.enablePartnerGTM=t.enablePartnerGTM,this.enableLiquidCommerceGTM=t.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...t)=>window.dataLayer.push(t));const e=t.enableLiquidCommerceGTM?await this.loadGTMScript(t.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!e.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+e.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(e.message),this.processEventQueue()}executeEvent(t,e,n){try{if(this.clientConfigService.isBuilder())return;const i=this.getSendToTargets(),r={...n,...i.length>0&&{send_to:i},tenant_name:this.partnerName,tenant_code:this.partnerCode,tenant_source:et.description+" v"+et.version};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:e,eventData:r,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const s={event:e,...r};window.dataLayer.push(s)}catch(i){this.logger.error("GTM "+t+" error",i)}}calculateValue(t){const e=t.reduce((t,e)=>t+(e.price||0)*(e.quantity||1),0);return Number.parseFloat(e.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,e,n){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:e,item_list_name:n,items:t})}selectItem(t,e,n){this.executeEvent("selectItem","select_item",{item_list_id:e,item_list_name:n,items:[t]})}addToCart(t){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),quantity:t.quantity||1,items:[t]})}viewCart(t){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(t),items:t})}removeFromCart(t){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}beginCheckout(t,e){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfo(t,e){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addPaymentInfo(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:e,coupon:n,items:t})}purchase(t){this.executeEvent("purchase","purchase",{transaction_id:t.transaction_id,value:t.value,currency:this.currency,tax:t.tax,shipping:t.shipping,coupon:t.coupon,items:t.items,subtotal:t.subtotal,total:t.total_before_discounts,discounts:t.discounts,gift_cards:t.gift_cards,net_total:t.net_total})}promoCodeAttempt(t){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:t})}promoCodeApplied(t,e){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:e})}promoCodeFailed(t,e){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:e})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,e){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:e})}giftCardFailed(t,e){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:e})}addressUpdated(t){this.executeEvent("addressUpdated","address_updated",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,coordinates:t.coordinates})}addressFailed(t){this.executeEvent("addressFailed","address_failed",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,address_error_message:t.error})}productNoAvailability(t){this.executeEvent("productNoAvailability","product_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productSizeNoAvailability(t){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productFulfillmentNoAvailability(t){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,fulfillment_type:t.fulfillmentType,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:e,next:n})=>{const i=performance.now();try{const r=n(),s=performance.now()-i;return this.logger.info("🏪 Store "+t+" ✓ "+s.toFixed(3)+"ms",e),r}catch(r){const n=performance.now()-i;throw this.logger.error("🏪 Store "+t+" ✗ "+n.toFixed(3)+"ms",{payload:e,error:r}),r}},this.performanceMiddleware=({action:t,next:e})=>{const n=performance.now(),i=e(),r=performance.now()-n;return r>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+r.toFixed(2)+"ms"),i},this.state=b,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable:e,persistedStore:n}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+t,this.isLocalStorageAvailable=e,e?await this.loadPersistedState():n&&await this.loadFromDBPersistence(n),this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:e,hasPersistedState:null!==n,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const e=t.split(".");let n=this.state;for(const i of e){if(null==n)return;n=n[i]}return void 0!==n?Array.isArray(n)?[...n]:"object"==typeof n&&null!==n?{...n}:n:void 0}set(t,e){return this.runWithMiddleware("set",{path:t,value:e},()=>{const n=this.get(t);return this.state=this.immutableSet(this.state,t,e),this.notifyListeners(t,e,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,e){const n=this.get(t),i=e(n);return this.set(t,i)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const e=this.get(t);if(void 0===e)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const n=t.split(".");let i=this.state;const r=n.pop();for(const s of n){if(void 0===i[s])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];i=i[s]}if(Array.isArray(i))i=i.filter((t,e)=>e!==Number.parseInt(r,10));else{if("object"!=typeof i||null===i)return this.logger.warn('Cannot remove property "'+r+'" from non-object type at path "'+t+'".'),![];{const{[r]:t,...e}=i;i=e}}return this.state=this.immutableSet(this.state,n.join("."),i),this.notifyListeners(t,void 0,e),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const e=[];if("function"==typeof t){const n=t(this.state);for(const[t,i]of Object.entries(n)){const n=this.get(t);e.push({path:t,oldValue:n,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,i)}}else for(const[n,i]of Object.entries(t)){const t=this.get(n);e.push({path:n,oldValue:t,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,i)}for(const{path:t,oldValue:n,newValue:i}of e)this.notifyListeners(t,i,n);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,e){const n=t;return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),()=>{var t;null===(t=this.listeners.get(n))||void 0===t?void 0:t.delete(e)}}watchMany(t,e){const n=[];let i;const r=t.map(t=>this.watch(t,(r,s)=>{n.push({path:t,value:r,oldValue:s}),clearTimeout(i),i=setTimeout(()=>{n.length>0&&(e([...n]),n.length=0)},0)}));return()=>{for(const t of r)t()}}createProductInstance(t){const e="products."+t,n=this.get(e);return n?!![]:this.set(e,f)}removeProductInstance(t){const e=this.get("products"),{[t]:n,...i}=e;return this.set("products",i)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(t,e,n){let i=0;const z=()=>{if(i>=this.middleware.length)return n();const r=this.middleware[i++];return r({action:t,payload:e,state:this.getState(),next:z})};return z()}immutableSet(t,e,n){const i=e.split(".");if(1===i.length){if(Array.isArray(t)){const e=[...t];return e[i[0]]=n,e}return{...t,[i[0]]:n}}const[r,...s]=i,a=t[r],c=Array.isArray(a)?[]:{};if(Array.isArray(t)){const e=[...t];return e[r]=this.immutableSet(a||c,s.join("."),n),e}return{...t,[r]:this.immutableSet(a||c,s.join("."),n)}}notifyListeners(t,e,n){const i=this.listeners.get(t);if(i)for(const c of i)try{c(e,n)}catch(s){this.logger.error('Error in store listener for path "'+t+'"',s)}const r=t.split(".");for(let c=r.length-1;c>0;c--){const t=r.slice(0,c).join("."),e=this.listeners.get(t);if(e){const i=this.get(t),s=r.slice(c).join("."),l=this.immutableSet(i,s,n);for(const n of e)try{n(i,l)}catch(a){this.logger.error('Error in store listener for parent path "'+t+'"',a)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var t;const e=this.get("address.id")||"",n=this.get("cart.id")||"";if(!e&&!n)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:e,cartId:n}),void 0;try{const i=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(i,{p:e,c:n}),this.logger.info("Session data persisted to DB",{userDeviceId:i,addressId:e,cartId:n})}catch(i){this.logger.error("Failed to persist session data to DB",i)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.info("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.info("localStorage entry completely removed",{key:this.localStorageKey})}catch(et){this.logger.error("Failed to clear localStorage entry",et)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const e=this.get("address.id")||"",n=this.get("cart.id")||"";(e||n)&&(t=e+":"+n)}else t=this.getState();t&&localStorage.setItem(this.localStorageKey,"string"!=typeof t?JSON.stringify(t):t)}catch(t){this.logger.error("Failed to persist store state",t)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const e=localStorage.getItem(this.localStorageKey);if(!e)return;try{const t=JSON.parse(e);for(const[e,n]of Object.entries(t))this.set(e,n);return}catch(t){if(e.includes(":")){const[t,n]=e.split(":");if(void 0!==t){const e=await this.getAddressDataFromId(t);this.set("address",e)}return void 0!==n&&this.set("cart.id",n||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:e})}}catch(e){this.logger.error("Failed to load persisted state",e),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const e=await this.getAddressDataFromId(t.p);this.set("address",e)}void 0!==t.c&&this.set("cart.id",t.c||null),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(e){this.logger.error("Failed to load session data from DB persistence",e)}}async getAddressDataFromId(t){if(!t||""===t.trim())return m;try{const e=await this.api.getAddressDetails(t);return e&&0!==Object.keys(e).length?{id:t,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},coordinates:{latitude:e.coordinates.latitude,longitude:e.coordinates.longitude}}:{...m,id:t}}catch(e){return{...m,id:t}}}}const nt=[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL,r.PRODUCT_OPTIONS,r.PRODUCT_INTERACTIONS,r.PRODUCT_DESCRIPTION,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST,r.PRODUCT_PRICE,r.PRODUCT_ADD_TO_CART_SECTION,r.PRODUCT_DRAWER,r.PRODUCT_LOADING,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.PRODUCT_LIST,r.PRODUCT_LIST_CARD,r.PRODUCT_LIST_CARD_LOADING,r.PRODUCT_LIST_FILTERS],it=[r.ADDRESS_INPUT,r.ADDRESS_DISPLAY],ot=[r.CART,r.CART_RETAILER,r.CART_ITEM,r.CART_FOOTER,r.CART_ITEM_QUANTITY_PRICE,r.CART_RETAILER_SUBTOTAL,r.CART_PROMO_CODE,r.CART_HEADER,r.CART_BODY,r.CART_FULFILLMENT,r.BUTTONS_CART_OPEN],rt=[r.CHECKOUT,r.CHECKOUT_INFORMATION,r.CHECKOUT_STRIPE_HANDLER,r.CHECKOUT_STRIPE_FORM,r.CHECKOUT_PAYMENT,r.CHECKOUT_BILLING,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_PROMO_CODE,r.CHECKOUT_GIFT_CARDS,r.CHECKOUT_AMOUNTS,r.CHECKOUT_ITEMS,r.CHECKOUT_COMPLETED,r.CHECKOUT_DELIVER_TO,r.CHECKOUT_DELIVER_TO_SUMMARY,r.CHECKOUT_BUYER,r.CHECKOUT_TIPS,r.CHECKOUT_PC_GC,r.CHECKOUT_ITEM,r.CHECKOUT_ITEM_QUANTITY,r.CHECKOUT_PLACE_ORDER_BUTTON,r.CHECKOUT_HEADER,r.CHECKOUT_PRESALE_COUNTDOWN,r.CHECKOUT_PRESALE_EXPIRED,r.CHECKOUT_SEND_AS_GIFT];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,e="swap"){if(!t||0===t.length)return;const n=[...this.defaultFontFamilies,...t],i=n.map(t=>{const e=encodeURIComponent(t.name);return"family="+e+":wght@"+t.weights.join(";")}).join("&"),r="display="+e;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+i+"&"+r,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,e="swap"){const n=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,e),n&&n.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),e=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!t){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",document.head.appendChild(t)}if(!e){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="",document.head.appendChild(t)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const t=document.createElement("link");t.rel="stylesheet",t.href=this.googleFontsUrl,t.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(t)}}const getProductListStyles=()=>"\n .product-list {\n width: 100%;\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-search__control-container {\n max-width: 500px;\n width: 100%;\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-icon:hover svg {\n cursor: pointer;\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n }\n\n /* Filters in Drawer */\n .product-list-filters-drawer-content {\n padding: 20px;\n overflow-y: auto;\n max-height: 100%;\n }\n\n .product-list-filters-drawer-content .product-list-filters-container {\n position: static;\n width: 100%;\n top: 0;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n /* Filters Container */\n .product-list-filters-container {\n width: 20%;\n height: fit-content;\n position: sticky;\n top: 24px;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 24px 24px;\n position: static;\n height: 100%;\n overflow-y: auto;\n padding-bottom: 80px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #e5e7eb);\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .product-list-filters-personalized > *:not(:last-child),\n .product-list-filters-pre-order > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-personalized-label,\n .product-list-filters-pre-order-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-delivery-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-delivery-options-header:hover .product-list-filters-delivery-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-personalized:hover .product-list-filters-personalized-label, \n .product-list-filters-pre-order:hover .product-list-filters-pre-order-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n }\n\n .product-list-filters-delivery-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-delivery-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-delivery-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-delivery-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-delivery-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-delivery-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-delivery-option {\n display: flex;\n align-items: center;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n \n .product-list-filters-delivery-option > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-delivery-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-delivery-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-delivery-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:focus,\n .product-list-filters-delivery-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-delivery-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-delivery-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:disabled + .product-list-filters-delivery-radio-label {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+h.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.18s ease-out;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Inputs */\n .product-list-filters-delivery-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n /* Price Range Slider */\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n /* Range Slider */\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--default-text-color, #111827);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n /* Text Inputs Container */\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n /* Checkbox Filter Header */\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-toggle-icon.collapsed {\n transform: rotate(0deg);\n }\n\n .checkbox-filter-toggle-icon.expanded {\n transform: rotate(0deg);\n }\n\n /* Checkbox Filter Content */\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n /* Search Input */\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n /* Checkbox List */\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n /* Custom Scrollbar */\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n /* Checkbox Items */\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 12px 24px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n /* No Results */\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n cursor: pointer;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Product List Card Styles */\n .product-list-card.standard {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #f3f4f6);\n border-radius: var(--card-border-radius, 0.375rem);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.fill {\n background-color: #ffffff;\n }\n\n .product-list-card.standard.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card.standard.not-available:hover {\n cursor: not-allowed;\n }\n\n .product-list-card.standard .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n padding-bottom: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .product-list-card.standard .plc__content {\n width: 100%;\n padding: 0 10px;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .product-list-card.standard .plc__content .plc__title {\n width: 100%;\n height: 4.6875rem;\n font-size: 1.125rem;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n margin-bottom: 10px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n line-height: 1.38;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n .product-list-card.standard .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__image-link:hover {\n text-decoration: none;\n }\n\n .product-list-card.standard .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .product-list-card.standard .plc__title-link .plc__title {\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n font-family: var(--paragraph-font-family, Poppins);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 1rem;\n font-weight: 600;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: auto;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n padding: 0.5rem 0.375rem;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #3b82f6);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n .product-list-sentinel-container > *:not(:last-child) {\n margin-top: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-error-container > *:not(:last-child) {\n margin-top: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Responsive Styles */\n\n /* Mobile and Tablet - Below 1024px */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n /* Hide filters in main product list on mobile */\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n /* Show filters in drawer on mobile */\n .product-list-filters-drawer-wrapper .product-list-filters-container {\n display: block;\n position: static;\n width: 100%;\n padding: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n /* Mobile - 1 column (up to 639px) */\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card.standard {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n /* Small tablets - 2 columns (640px to 767px) */\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card.standard {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n /* Tablets - 3 columns (768px to 1023px) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card.standard {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n /* Desktop - Use configured columns (1024px and up) */\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card.standard {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+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(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n text-align: left;\n }\n",getCartStyles=()=>"\n .cart-container {\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .cart-container.no-header .cart-body {\n padding: 0 0 16px 0;\n }\n\n .cart-container.no-header .cart-footer {\n padding: 16px 0 0 0;\n }\n\n .cart-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n position: sticky;\n top: 0;\n background-color: var(--drawer-background-color, #FFFFFF);\n z-index: "+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(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .item-shipping {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-quantity {\n display: flex;\n width: 106px;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .quantity-btn-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-decrease {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease:disabled,\n .quantity-btn-increase:disabled,\n .quantity-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .quantity-value {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-quantity.outlined .quantity-value {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .item-price-container {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n align-content: center;\n flex: 1 0 0;\n flex-wrap: wrap;\n }\n\n .item-price-container > *:not(:first-child) {\n margin-left: 6px;\n }\n\n .item-price {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .item-price-per-unit {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .item-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n align-self: stretch;\n }\n\n .cart-footer {\n margin-top: auto;\n display: flex;\n min-height: 146px;\n padding: 16px;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n align-self: stretch;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n flex-shrink: 0;\n }\n\n .cart-footer > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .cart-footer-header {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n }\n\n .cart-footer-header > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .cart-footer-header .cart-footer-items-price {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n\n .cart-footer-header .subtotal-text {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .subtotal-price {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .taxes-fees-info {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n max-width: 85%;\n }\n\n .promo-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n width: 100%;\n border-radius: var(--button-border-radius, 6px);\n }\n\n .promo-input.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .promo-input.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .checkout-button {\n display: flex;\n position: relative;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border: none;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #F1F5F9);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+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(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n }\n\n .error-banner {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px) 0 0 var(--card-border-radius, 6px);\n }\n\n .error-banner > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .close-btn {\n border: none;\n font-size: 16px;\n cursor: pointer;\n color: #fff;\n border-radius: 0 var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0;\n padding: 8px 16px;\n\n background: var(--error-color, #DC2626);\n }\n\n /* Mobile responsive */\n .promo-code-pill {\n align-self: flex-start;\n }\n\n .promo-remove-btn {\n align-self: flex-end;\n padding: 4px 8px;\n }\n }\n\n /* Optional: Add loading indicator styles if needed */\n .promo-input-wrapper.loading::after {\n content: '';\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+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(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+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(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+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(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 8px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+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(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n',getImageCarouselStyle=()=>"\n .product-image-carousel {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 100%;\n height: auto;\n min-height: 350px;\n overflow: hidden;\n }\n\n .product-image-carousel.popup {\n max-height: 474px;\n }\n\n .product-image-carousel.carousel {\n max-height: 594px;\n }\n\n .main-image {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n border-radius: var(--card-border-radius, 6px);\n overflow: hidden;\n flex: 1;\n background-image: var(--bg-image, none);\n background-position: center center;\n background-size: contain;\n background-repeat: no-repeat;\n }\n\n .carousel-dots {\n position: absolute;\n bottom: 16px;\n left: 50%;\n transform: translateX(-50%);\n z-index: "+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(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+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 text-align: left;\n }\n\n .product-description {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-description > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .product-description .title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .product-description .content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n align-self: stretch;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .product-description .content.collapsed {\n /* Modern browsers with line-clamp support */\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n\n /* Fallback for older browsers */\n max-height: 4.5em; /* 3 lines * 1.5 line-height */\n line-height: 1.5;\n word-wrap: break-word;\n\n /* Additional fallback properties */\n text-overflow: ellipsis;\n white-space: normal;\n }\n\n /* Fallback for browsers without line-clamp support */\n @supports not (-webkit-line-clamp: 3) {\n .product-description .content.collapsed {\n display: block;\n max-height: 4.5em;\n overflow: hidden;\n position: relative;\n }\n\n .product-description .content.collapsed::after {\n content: '...';\n position: absolute;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, transparent, var(--default-background-color, white) 50%);\n padding-left: 20px;\n }\n }\n\n .product-description .collapse-button {\n border-radius: var(--button-border-radius, 6px);\n cursor: pointer;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+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(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n max-height: 350px;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+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 margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const st={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",linkTextColor:"--link-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},at={backgroundColor:"--product-background-color"},ct={backgroundColor:"--cart-background-color"},lt={backgroundColor:"--address-background-color"},dt={backgroundColor:"--checkout-background-color"},ht={global:st,product:at,cart:ct,address:lt,checkout:dt};function getCSSVariableMapping(t){return ht[t]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(t,e){const n={},i=getCSSVariableMapping(e);for(const[r,s]of Object.entries(i)){const e=this.getValueByPath(t,r);void 0!==e&&this.isCSSValue(e)&&(n[s]=e,this.isColorVariable(s,e)&&this.generateOpacityVariants(n,s,e))}return n}extractVariablesFromPartialTheme(t,e){const n={},i=getCSSVariableMapping(e);for(const[r,s]of Object.entries(i))if(this.hasValueAtPath(t,r)){const e=this.getValueByPath(t,r);void 0!==e&&this.isCSSValue(e)&&(n[s]=e,this.isColorVariable(s,e)&&this.generateOpacityVariants(n,s,e))}return n}generateCSSVariablesString(t){return Object.entries(t).map(([t,e])=>" "+t+": "+e+";").join("\n")}updateCSSVariablesInStylesheet(t,e){if(0!==Object.keys(e).length)try{const n=this.findOrCreateRule(t);for(const[t,i]of Object.entries(e))n.style.setProperty(t,String(i))}catch(n){this.logger.warn("Failed to update CSS variables")}}getValueByPath(t,e){return e.split(".").reduce((t,e)=>t&&void 0!==t[e]?t[e]:void 0,t)}hasValueAtPath(t,e){const n=e.split(".");let i=t;for(const r of n){if(null==i||!(r in i))return![];i=i[r]}return!![]}findOrCreateRule(t){const e=":host";for(const i of Array.from(t.cssRules))if(i instanceof CSSStyleRule&&i.selectorText===e)return i;const n=t.insertRule(e+" {}");return t.cssRules[n]}isCSSValue(t){if("string"==typeof t){if(""===t.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(t.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(t))return!![];if(/^[a-z-]+$/.test(t))return!![]}return"number"==typeof t}generateOpacityVariants(t,e,n){for(const i of this.opacityLevels){const r=e+"-"+i.suffix,s=this.addOpacityToHexColor(n,i.value);s&&(t[r]=s)}}isColorVariable(t,e){if("string"!=typeof e)return![];const n=t.toLowerCase().includes("color"),i=/^#[0-9a-f]{3,8}$/i.test(e);return n&&i}addOpacityToHexColor(t,e){if(!t.startsWith("#"))return null;let n=t.slice(1);if(3===n.length&&(n=n.split("").map(t=>t+t).join("")),6!==n.length)return null;const i=Math.round(255*e),r=i.toString(16).padStart(2,"0");return"#"+n+r}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,e){const n=this.cssProcessor.extractVariablesFromTheme(e,t),i=this.cssProcessor.generateCSSVariablesString(n),r=this.getStylesheetStyles(t).join("\n\n"),s=0===i.length?"":":host { "+i+" }",a=("\n "+s+"\n\n "+r+"\n ").trim();this.createStylesheet(t,a)}createStylesheet(t,e){try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(e),this.styleSheets.set(t,n)}else this.styleSheets.set(t,e)}catch(et){this.styleSheets.set(t,e)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}updateVariablesInStylesheet(t,e,n){const i=this.styleSheets.get(t);if(i&&"string"!=typeof i){const t=this.cssProcessor.extractVariablesFromPartialTheme(e,n);this.cssProcessor.updateCSSVariablesInStylesheet(i,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles(),getProductListStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme)}updateComponentGlobalConfigs(t){var e,n;const i=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=i,((null===(e=t.theme)||void 0===e?void 0:e.headingFont)||(null===(n=t.theme)||void 0===n?void 0:n.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==nt.indexOf(t)?this.getConfigs("product"):-1!==it.indexOf(t)?this.getConfigs("address"):-1!==ot.indexOf(t)?this.getConfigs("cart"):-1!==rt.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===r.DRAWER){const t=[...e],n=this.stylesheetGenerator.getStylesheet("product"),i=this.stylesheetGenerator.getStylesheet("cart"),r=this.stylesheetGenerator.getStylesheet("checkout"),s=this.stylesheetGenerator.getStylesheet("address");return n&&t.push(n),i&&t.push(i),r&&t.push(r),s&&t.push(s),t}let n;if(it.includes(t)||t===r.ADDRESS)n="address";else if(nt.includes(t)||t===r.PRODUCT)n="product";else if(ot.includes(t)||t===r.CART)n="cart";else{if(!rt.includes(t)&&t!==r.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;n="checkout"}const i=this.stylesheetGenerator.getStylesheet(n);return i?[...e,i]:e}getBaseStylesheets(){const t=[],e=this.stylesheetGenerator.getStylesheet("global"),n=this.stylesheetGenerator.getStylesheet("ui");return e&&t.push(e),n&&t.push(n),t}deepMerge(t,e){const n={...t};for(const i in e)null!==e[i]&&void 0!==e[i]&&("object"!=typeof e[i]||Array.isArray(e[i])||"object"!=typeof t[i]||Array.isArray(t[i])?n[i]=e[i]:n[i]=this.deepMerge(t[i],e[i]));return n}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.longitude&&t.coordinates.latitude)return{coordinates:t.coordinates,address:t.address}}}const includeCartEvents=(t,e)=>t.filter(t=>e.includes(t.type)),excludeCartEvents=(t,e)=>t.filter(t=>!e.includes(t.type)),eventsForCart=t=>excludeCartEvents(t,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=t=>{const e=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],n=includeCartEvents(t,e);return n.length>0},includeCheckoutEvents=(t,e)=>t.filter(t=>e.includes(t.type)),eventsForCheckout=t=>includeCheckoutEvents(t,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=t=>includeCheckoutEvents(t,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=t=>includeCheckoutEvents(t,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=t=>{const e=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return t.some(t=>e.includes(t.type))},ut={OutOfStock:"error",ItemsNotAdded:"warning",ItemsRequestedNotAdded:"warning",ItemEngravingError:"error",AddressChange:"warning",LocationAvailability:"warning",PartnerProductConfigs:"warning",RemovedExistingCartItems:"warning",RetailerMinNotMet:"warning",NoItemsInCart:"warning",InvalidId:"warning",NoId:"warning",CartCheckoutProcessed:"success",NewCart:"warning",CartError:"error",ItemQuantityChange:"warning",ItemIdNotFound:"error",ItemsRemoved:"warning",CouponProcessingError:"error",CouponNotFound:"error",CouponExpired:"error",NoApplicableDiscount:"warning",CouponNotStarted:"error",MinimumOrderValueNotMet:"warning",MinimumOrderUnitsNotMet:"warning",MinimumDistinctItemsNotMet:"warning",QuotaExceeded:"error",UserLimitExceeded:"error",NotFirstPurchase:"warning",InvalidCoupon:"error",InvalidMembership:"error",InvalidDomain:"error",InvalidRequirements:"error",InvalidOrganization:"error",ProductNotEligible:"warning",NotEnoughPreviousOrders:"warning",PresaleItemsNotAllowed:"error",PresaleLimitExceeded:"error",PresaleNotStarted:"error",PresaleExpired:"error",PresaleMixedCart:"error",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning"},pt={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:ut[t.type]||"error"})),transformCheckoutEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:pt[t.type]||"error"})),transformEventsForCart=t=>{const e=eventsForCart(t);return transformCartEventsRaw(e)},transformEventsForCheckout=t=>{const e=eventsForCheckout(t);return transformCheckoutEventsRaw(e)},transformPromoCodeCheckoutEvents=t=>{const e=promoCodeCheckoutEvents(t);return transformCheckoutEventsRaw(e)},transformGiftCardCheckoutEvents=t=>{const e=giftCardCheckoutEvents(t);return transformCheckoutEventsRaw(e)};class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,e=![]){var i,r,s,a,c;const l=this.store.get("cart");for(const n of Object.keys(l.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(l.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(l.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const d={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.events":[],"cart.promoCode":(null===(i=t.promoCode)||void 0===i?void 0:i.code)?{code:t.promoCode.code.toUpperCase(),discountAmount:t.promoCode.discountAmount||0,error:null}:null};if((null===(r=Object.values(t.items))||void 0===r?void 0:r.length)>0)for(const n of Object.values(t.items))d["cart.items."+n.id]=n;if((null===(s=Object.values(t.retailers))||void 0===s?void 0:s.length)>0)for(const n of Object.values(t.retailers))if(d["cart.retailers."+n.id]=n,(null===(a=Object.values(n.fulfillments))||void 0===a?void 0:a.length)>0)for(const t of Object.values(n.fulfillments))d["cart.fulfillments."+t.id]=t;if((null===(c=t.events)||void 0===c?void 0:c.length)>0&&(d["cart.events"]=transformEventsForCart(t.events||[])),this.store.batch(d),e){const t=this.store.get("cart");this.pubSub.publishAction(n.CART_LOADED,t)}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartFromResponse(e,!![]),e.id!==t.id&&await this.store.persist()}catch(t){const e=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",e),this.pubSub.publishAction(n.CART_FAILED,{message:e}),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,e){const i={type:t,data:e||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:i}),t===r.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),t===r.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)===r.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==t?void 0:t.type)===r.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(t){var e,i,r,a,c,l,d,h,u,m,f,g;try{this.store.set("checkout.loading",!![]);const v=t||this.store.get("cart.id"),y=this.store.get("cart");if(0===(null===(e=Object.values(y.items||{}))||void 0===e?void 0:e.length)&&!t)return;const b=this.themeProvider.getConfigs("checkout"),x={canEmail:b.layout.emailOptIn.checked,canSms:b.layout.smsOptIn.checked};if(!v)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const w={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.presale":null,"checkout.updating":![]},S=await this.api.prepareCheckout({cartId:v,marketingPreferences:x});if((null===(i=S.retailers)||void 0===i?void 0:i.length)>0)for(const t of S.retailers)for(const e of t.fulfillments)e.type===s.ON_DEMAND&&(w["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});if((null===(r=S.items)||void 0===r?void 0:r.length)>0){this.store.remove("checkout.items");for(const t of S.items){const e=S.retailers.find(e=>e.id===t.retailerId),n=e.fulfillments.find(e=>e.id===t.fulfillmentId);w["checkout.items."+t.cartItemId]=this.buildCheckoutItemStore(t,e,n)}}S.isPresaleLocked&&S.presaleExpiresAt&&(w["checkout.presale"]={isLocked:S.isPresaleLocked,expiresAt:S.presaleExpiresAt}),w["checkout.token"]=S.token,w["checkout.cartId"]=S.cartId,w["checkout.isGift"]=S.isGift,w["checkout.giftRecipientForm.data"]={firstName:((null===(c=null===(a=S.giftOptions)||void 0===a?void 0:a.recipient)||void 0===c?void 0:c.name)||"").split(" ")[0],lastName:((null===(d=null===(l=S.giftOptions)||void 0===l?void 0:l.recipient)||void 0===d?void 0:d.name)||"").split(" ")[1],email:(null===(u=null===(h=S.giftOptions)||void 0===h?void 0:h.recipient)||void 0===u?void 0:u.email)||"",phone:(null===(f=null===(m=S.giftOptions)||void 0===m?void 0:m.recipient)||void 0===f?void 0:f.phone)||"",message:(null===(g=S.giftOptions)||void 0===g?void 0:g.message)||""},w["checkout.paymentForm.billingSameAsShipping"]=S.billingSameAsShipping,w["checkout.marketingPreferences"]=S.marketingPreferences,w["checkout.giftCards"]=S.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),w["checkout.promoCode"]=S.promoCode.value?{code:S.promoCode.value,discountAmount:S.promoCode.discount}:null,w["checkout.amounts"]=S.amounts,w["checkout.events"]=S.events||[],this.store.batch(w),this.pubSub.publishAction(n.CHECKOUT_LOADED,{cartId:S.cartId})}catch(v){this.store.set("checkout.error",v.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:v.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const e=this.store.get("checkout.isGift"),i=null!=t?t:!e,r={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":i,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":r}),this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{isActive:i})}async toggleBillingSameAsShipping(t){const e=this.store.get("checkout.paymentForm.billingSameAsShipping"),i=null!=t?t:!e;this.store.set("checkout.paymentForm.billingSameAsShipping",i),this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:i})}async toggleMarketingPreferences(t,e){const i=this.store.get("checkout.marketingPreferences."+t),r=null!=e?e:!i,s=this.store.get("checkout.marketingPreferences"),a=this.dataForCheckoutPrepare({marketingPreferences:{...s,[t]:r}}),c=await this.api.prepareCheckout(a);this.store.set("checkout.marketingPreferences",c.marketingPreferences),this.pubSub.publishAction(n.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:t,isActive:r})}async getPaymentSession(){try{const t=this.store.get("cart.id"),e=await this.api.getPaymentSession({cartId:t});this.store.batch({"checkout.paymentForm.paymentSession":{key:e.key,secret:e.secret},"checkout.paymentForm.paymentMethod":null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){var n,i,r,s;try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"2035"}};const a=await this.api.confirmPaymentSession(t,e);return a&&a.id&&a.card&&a.card.brand&&a.card.last4&&a.card.expMonth&&a.card.expYear?{id:a.id,card:{brand:null===(n=a.card)||void 0===n?void 0:n.brand,last4:null===(i=a.card)||void 0===i?void 0:i.last4.toString(),expMonth:null===(r=a.card)||void 0===r?void 0:r.expMonth.toString(),expYear:null===(s=a.card)||void 0===s?void 0:s.expYear.toString()}}:(this.store.set("checkout.error","Invalid payment method information received."),null)}catch(a){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){var e;try{this.googleTagManager.promoCodeAttempt(t);const i=this.dataForCheckoutPrepare({}),r=await this.api.prepareCheckout({...i,promoCode:t}),s=0!==r.amounts.discounts,a=null===(e=transformPromoCodeCheckoutEvents(r.events||[]))||void 0===e?void 0:e[0];if(!s)return this.store.set("checkout.promoCodeError",a?a.message:'Code "'+t+'" does not exist'),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:(null==a?void 0:a.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==a?void 0:a.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(i){const e=(null==i?void 0:i.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",e),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:e}),this.googleTagManager.promoCodeFailed(t,e),i}}async removePromoCode(){var t,e;try{const i=this.dataForCheckoutPrepare({}),r=(null===(e=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===e?void 0:e.code)||"",s=await this.api.prepareCheckout({...i,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(i){const t=(null==i?void 0:i.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.promoCode.code")||"";throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:t}),e&&this.googleTagManager.promoCodeFailed(e,t),i}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(et){const e=et.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),et}}async applyGiftCard(t){var e;const i=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(i);const t=this.dataForCheckoutPrepare({}),r=t.giftCards||[],s=await this.api.prepareCheckout({...t,giftCards:[...r,i]}),a=null===(e=transformGiftCardCheckoutEvents(s.events||[]))||void 0===e?void 0:e[0],c=hasAnyRetailerGiftCardRestriction(s.events||[]);if(a&&(this.store.set("checkout.giftCardError",a.message),!c))return;const l=s.giftCards.find(t=>t.code.toLowerCase()===i.toLowerCase());if(!l)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:(null==a?void 0:a.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(i,(null==a?void 0:a.message)||"not_applied"),void 0;this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:s.amounts.total}),this.googleTagManager.giftCardApplied(i,l.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(i,t),r}}async removeGiftCard(t){var e;const i=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),r=(null===(e=t.giftCards)||void 0===e?void 0:e.filter(t=>t.toLowerCase()!==i.toLowerCase()))||[],s=await this.api.prepareCheckout({...t,giftCards:r}),a=s.giftCards.find(t=>t.code.toLowerCase()===i.toLowerCase());if(a)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+i),void 0;this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:s.amounts.total}),this.googleTagManager.giftCardApplied(i,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(i,t),r}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(et){throw this.store.set("checkout.error",(null==et?void 0:et.message)||"Failed to clear gift card error. Please try again."),et}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(r.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,e){var i,r,s;try{this.store.set("checkout.items."+t+".updating",!![]);const a=this.store.get("checkout.cartId"),c=this.store.get("checkout.items."+t);if(!c)throw new SDKError("Item not found");const l=c.quantity,d=c.quantity+e;if(d<1)return this.removeItem(t,!![]);const h={id:c.cartItemId,fulfillmentId:c.fulfillmentId,partNumber:c.partNumber,quantity:d},u=(null===(s=null===(r=null===(i=c.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];u.length>0&&(h.engravingLines=u);const m=await this.api.updateCart({id:a,items:[h],location:this.getLocation()});this.pubSub.publishAction(e>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:c.cartItemId,quantity:d,previousQuantity:l});const f=splitCategoryPath(c.catPath),g={item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:f.category,item_category2:f.category2,item_category3:f.category3,quantity:Math.abs(e),price:centToDollar(c.unitPrice||0),upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId};e<0?this.googleTagManager.removeFromCart(g):e>0&&this.googleTagManager.addToCart(g),await this.partialLoadCheckout({cartResponse:m})}catch(a){throw this.store.set("checkout.items."+t+".error",a.message),a}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var e,i,r;try{const s=this.store.get("checkout.items."+t);if(!s)throw new SDKError("Item not found in checkout");if(!(null===(e=s.attributes)||void 0===e?void 0:e.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const a=(null===(r=null===(i=s.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.lines)||[],c={id:s.cartItemId,fulfillmentId:s.fulfillmentId,partNumber:s.partNumber,quantity:s.quantity,engravingLines:[]},l=this.store.get("checkout.cartId"),d=await this.api.updateCart({id:l,items:[c],location:this.getLocation()});this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:s.cartItemId,engravingLines:[],previousEngravingLines:a}),await this.partialLoadCheckout({cartResponse:d})}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,e){var i,r,s;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("checkout.items."+t+".updating",!![]);const a=this.store.get("checkout.cartId"),c=this.store.get("checkout.items."+t);if(!c)throw new SDKError("Item not found");const l={id:c.cartItemId,fulfillmentId:c.fulfillmentId,partNumber:c.partNumber,quantity:0},d=(null===(s=null===(r=null===(i=c.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];d.length>0&&(l.engravingLines=d);const h=await this.api.updateCart({id:a,items:[l],location:this.getLocation()});this.store.remove("checkout.items."+t),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartItemId:c.cartItemId}),await this.partialLoadCheckout({cartResponse:h})}catch(a){throw this.store.set("checkout.items."+t+".error",a.message),a}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const e=this.store.get("checkout.onDemandFulfillmentTipInfo"),i=Object.values(e||{}).map(e=>{const n=Math.round(e.subtotal*t/100);return{fulfillmentId:e.fulfillmentId,tip:n}}),r=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:i}));this.updateStoreFromCheckoutResponse(r),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:i})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to update tips. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,e){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.onDemandFulfillmentTipInfo"),r=Object.values(i||{}).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===t?e:n.tip})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const e=this.store.get("checkout.onDemandFulfillmentTipInfo"),i=Object.values(e||{}).map(e=>({fulfillmentId:e.fulfillmentId,tip:e.fulfillmentId===t?0:e.tip})),r=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:i}));this.updateStoreFromCheckoutResponse(r),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:i})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to remove fulfillment tip. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:t,deliveryInstructions:e,customerData:i}){var r,s,a,c,l,d,h,u,m;try{this.store.set("checkout.customerForm.isSaving",!![]);const f=this.store.get("checkout.customerForm.data"),g=this.store.get("checkout.isGift"),v=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,customer:{...f,...i},isGift:g}),y=await this.api.prepareCheckout(v),b={id:(null===(r=y.customer)||void 0===r?void 0:r.id)||"",firstName:(null===(s=y.customer)||void 0===s?void 0:s.firstName)||"",lastName:(null===(a=y.customer)||void 0===a?void 0:a.lastName)||"",email:(null===(c=y.customer)||void 0===c?void 0:c.email)||"",phone:(null===(l=y.customer)||void 0===l?void 0:l.phone)||"",birthDate:(null===(h=null===(d=y.customer)||void 0===d?void 0:d.birthDate)||void 0===h?void 0:h.slice(0,10))||"",company:(null===(u=y.customer)||void 0===u?void 0:u.company)||""};this.store.batch({"checkout.customerForm.data":b,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddressTwo":y.shippingAddress.two,"checkout.deliveryInstructions":e}),this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,!![]);const x=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(x.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(m=x.promoCode)||void 0===m?void 0:m.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:e,...i}){var r,s,a,c,l,d;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const h=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,isGift:!![],giftRecipient:i}),u=await this.api.prepareCheckout(h),m={firstName:(null==i?void 0:i.firstName)||"",lastName:(null==i?void 0:i.lastName)||"",email:(null===(s=null===(r=u.giftOptions)||void 0===r?void 0:r.recipient)||void 0===s?void 0:s.email)||"",phone:(null===(c=null===(a=u.giftOptions)||void 0===a?void 0:a.recipient)||void 0===c?void 0:c.phone)||"",message:(null===(l=u.giftOptions)||void 0===l?void 0:l.message)||""};this.store.batch({"checkout.giftRecipientForm.data":m,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddressTwo":u.shippingAddress.two,"checkout.deliveryInstructions":e}),this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,!![]);const f=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(f.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(d=f.promoCode)||void 0===d?void 0:d.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:t,paymentSession:e}){var i,r,s;try{this.store.set("checkout.paymentForm.isSaving",!![]);const a=this.store.get("checkout"),c={},l=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let d=null,h=null;if(l||e){const t=await this.confirmPaymentSession((null==e?void 0:e.confirmationTokenId)||"",(null==e?void 0:e.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");d=t.card,h=t.id}const u=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:h||void 0}),m=await this.api.prepareCheckout(u);m.payment&&d&&(c["checkout.paymentForm.paymentMethod"]={id:m.payment,card:d}),t&&m.billingAddress&&(c["checkout.paymentForm.data"]={firstName:m.billingAddress.firstName||"",lastName:m.billingAddress.lastName||"",email:m.billingAddress.email||"",phone:m.billingAddress.phone||"",company:m.billingAddress.company||"",addressOne:m.billingAddress.one||"",addressTwo:m.billingAddress.two||"",city:m.billingAddress.city||"",state:m.billingAddress.state||"",zipCode:m.billingAddress.zip||""},this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,!![])),c["checkout.paymentForm.isEditing"]=![],c["checkout.paymentForm.isValid"]=!![],this.store.batch(c);const f=c["checkout.paymentForm.paymentMethod"]||(null===(i=a.paymentForm)||void 0===i?void 0:i.paymentMethod),g=(null===(r=null==f?void 0:f.card)||void 0===r?void 0:r.brand)?f.card.brand+" ****"+f.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(a.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}}),g,(null===(s=a.promoCode)||void 0===s?void 0:s.code)||void 0)}catch(a){throw this.logger.error("Failed to save payment form",a),this.store.set("checkout.error",a.message),a}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var t,e,i,s,a,c;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const l=this.store.get("checkout"),d=await this.api.checkoutComplete({token:l.token}),h=d.legacyOrderNumber||d.referenceId||"N/A";l.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(r.CHECKOUT_COMPLETED,{orderNumber:h,orderTotal:l.amounts.total,cardLast4:null===(i=null===(e=null===(t=null==l?void 0:l.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===e?void 0:e.card)||void 0===i?void 0:i.last4,customerEmail:l.customerForm.data.email,giftRecipientEmail:(null===(a=null===(s=null==l?void 0:l.giftRecipientForm)||void 0===s?void 0:s.data)||void 0===a?void 0:a.email)||null}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:h,orderTotal:l.amounts.total}),this.googleTagManager.purchase({transaction_id:h,tax:centToDollar(l.amounts.tax||0),shipping:centToDollar(l.amounts.shipping||0),coupon:(null===(c=l.promoCode)||void 0===c?void 0:c.code)||void 0,items:[...Object.values(l.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(l.amounts.total),subtotal:centToDollar(l.amounts.subtotal),total_before_discounts:centToDollar(l.amounts.subtotal+l.amounts.tax+l.amounts.shipping+l.amounts.delivery+l.amounts.platform+l.amounts.service),discounts:centToDollar(l.amounts.discounts),gift_cards:centToDollar(l.amounts.giftCards||0),net_total:centToDollar(l.amounts.total)})}catch(l){const t=(null==l?void 0:l.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(t){var e;const n={"checkout.amounts":t.amounts,"checkout.warning":t.warning,"checkout.events":transformEventsForCheckout(t.events||[]),"checkout.error":null};if((null===(e=t.retailers)||void 0===e?void 0:e.length)>0)for(const i of t.retailers)for(const t of i.fulfillments)t.type===s.ON_DEMAND&&(n["checkout.onDemandFulfillmentTipInfo."+t.id]={retailerId:i.id,retailerName:i.name,fulfillmentId:t.id,tip:t.tip,subtotal:t.subtotal});this.store.batch(n)}async partialLoadCheckout(t){var e,i,r,a,c;try{let n;if(this.store.set("checkout.updating",!![]),(null==t?void 0:t.cartResponse)?this.commonCommands.syncCartFromResponse(t.cartResponse):await this.commonCommands.loadCart(),null==t?void 0:t.response)n=t.response;else{const i=null!==(e=null==t?void 0:t.cartId)&&void 0!==e?e:this.store.get("checkout.cartId");if(!i)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const r=this.dataForCheckoutPrepare({});n=await this.api.prepareCheckout({...r,cartId:i})}const l={"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===(r=null===(i=null==n?void 0:n.promoCode)||void 0===i?void 0:i.value)||void 0===r?void 0:r.trim())?{code:n.promoCode.value,discountAmount:n.promoCode.discount}:null};if((null===(a=n.retailers)||void 0===a?void 0:a.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const t of n.retailers)for(const e of t.fulfillments)e.type===s.ON_DEMAND&&(l["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal})}if((null===(c=n.items)||void 0===c?void 0:c.length)>0){this.store.remove("checkout.items");for(const t of n.items){const e=n.retailers.find(e=>e.id===t.retailerId),i=e.fulfillments.find(e=>e.id===t.fulfillmentId);l["checkout.items."+t.cartItemId]=this.buildCheckoutItemStore(t,e,i)}}this.store.batch(l)}catch(l){const t=(null==l?void 0:l.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:t}),l}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:e,billingData:n,marketingPreferences:i,shippingAddressTwo:r,deliveryInstructions:s,deliveryTips:a,paymentMethodId:c,isGift:l}){var d,h,u,m,f,g,v,y,b,x,w,S,E,_,D,T,I,F,A,O,N,M,L,B,j,q;const H=this.store.get("checkout"),W=null!==(h=null===(d=H.paymentForm)||void 0===d?void 0:d.billingSameAsShipping)&&void 0!==h?h:!![],X=void 0!==l?l:H.isGift,$=e?!![]:null!==(m=null===(u=H.giftRecipientForm)||void 0===u?void 0:u.isValid)&&void 0!==m?m:![],tt=X&&$,et={cartId:H.cartId,acceptedAccountCreation:![],hasSubstitutionPolicy:![],hasAgeVerify:!![],shippingAddressTwo:r,billingSameAsShipping:W,marketingPreferences:i||H.marketingPreferences,promoCode:(null===(f=H.promoCode)||void 0===f?void 0:f.code)||void 0,isGift:tt,giftCards:(null===(g=null==H?void 0:H.giftCards)||void 0===g?void 0:g.map(t=>t.code))||[],deliveryTips:a||Object.values(H.onDemandFulfillmentTipInfo||{}).map(t=>({fulfillmentId:t.fulfillmentId,tip:t.tip}))};c?et.payment=c:(null===(y=null===(v=H.paymentForm)||void 0===v?void 0:v.paymentMethod)||void 0===y?void 0:y.id)&&(et.payment=H.paymentForm.paymentMethod.id);const nt=s||H.deliveryInstructions;if(nt&&(et.deliveryInstructions=Object.values(H.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:nt}))),et.customer=t?{...t,id:(null==t?void 0:t.id)||void 0}:(null===(x=null===(b=null==H?void 0:H.customerForm)||void 0===b?void 0:b.data)||void 0===x?void 0:x.email)?{id:(null===(S=null===(w=H.customerForm)||void 0===w?void 0:w.data)||void 0===S?void 0:S.id)||void 0,firstName:null===(_=null===(E=H.customerForm)||void 0===E?void 0:E.data)||void 0===_?void 0:_.firstName,lastName:null===(T=null===(D=H.customerForm)||void 0===D?void 0:D.data)||void 0===T?void 0:T.lastName,email:null===(F=null===(I=H.customerForm)||void 0===I?void 0:I.data)||void 0===F?void 0:F.email,phone:null===(O=null===(A=H.customerForm)||void 0===A?void 0:A.data)||void 0===O?void 0:O.phone,birthDate:null===(M=null===(N=H.customerForm)||void 0===N?void 0:N.data)||void 0===M?void 0:M.birthDate,company:null===(B=null===(L=H.customerForm)||void 0===L?void 0:L.data)||void 0===B?void 0:B.company}:void 0,tt){const t=e||(null===(j=H.giftRecipientForm)||void 0===j?void 0:j.data);t&&(et.giftOptions={recipient:{name:(t.firstName||"")+" "+(t.lastName||""),email:t.email||"",phone:t.phone||""},message:t.message||""})}if(!W)if(n)et.billingAddress={firstName:n.firstName,lastName:n.lastName,email:n.email,phone:n.phone,company:n.company,one:n.addressOne,two:n.addressTwo,city:n.city,state:n.state,zip:n.zipCode,country:"US"};else{const t=null===(q=H.paymentForm)||void 0===q?void 0:q.data;et.billingAddress={firstName:null==t?void 0:t.firstName,lastName:null==t?void 0:t.lastName,email:null==t?void 0:t.email,phone:null==t?void 0:t.phone,company:null==t?void 0:t.company,one:null==t?void 0:t.addressOne,two:null==t?void 0:t.addressTwo,city:null==t?void 0:t.city,state:null==t?void 0:t.state,zip:null==t?void 0:t.zipCode,country:"US"}}return et}buildCheckoutItemStore(t,e,n){return{liquidId:t.liquidId,variantId:t.variantId,cartItemId:t.cartItemId,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes,retailerName:e.name,expectationDetail:n.expectation.detail,loading:![],updating:![],error:null}}}function cartDataForEventFromStore(t,e){var n;const i=e.formattedAddress?e:m,r={};for(const s in t.items||{}){const e=t.items[s];r[s]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,salsifyGrouping:e.salsifyGrouping,catPath:e.catPath,volume:e.volume,uom:e.uom,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,name:e.name,brand:e.brand,size:e.size,price:e.price||0,quantity:e.quantity||0,maxQuantity:e.maxQuantity||0,unitPrice:e.unitPrice||0,mainImage:e.mainImage||"",attributes:e.attributes||{}}}return{id:t.id,promoCode:(null===(n=t.promoCode)||void 0===n?void 0:n.code)||"",items:r,location:{placesId:i.id,address:{one:i.address.one,two:i.address.two,city:i.address.city,state:i.address.state,zip:i.address.zip,country:i.address.country},coordinates:{latitude:i.coordinates.latitude,longitude:i.coordinates.longitude}},subtotal:t.subtotal,itemCount:t.itemsQuantity}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.commonCommands=CommonCommands.getInstance(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,e){try{this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),r=this.store.get("cart.items."+t);if(!r)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+e),new SDKError("Item not found");const s=r.quantity+e;if(s<1)return this.removeItem(t,!![]);const a=this.buildItemUpdate(r,s),c=await this.api.updateCart({id:i,items:[a],location:this.getLocation()});this.syncItemsFromApiResponse(c,[t]),this.updateFulfillment(r.fulfillmentId,c),this.syncRetailersFromApiResponse(c),this.syncCartMetaFromApiResponse(c),this.pubSub.publishAction(e<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{id:r.id,quantity:s,previousQuantity:r.quantity});const l=splitCategoryPath(r.catPath),d={item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_size:r.size,item_category:l.category,item_category2:l.category2,item_category3:l.category3,quantity:Math.abs(e),price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId};e<0?this.googleTagManager.removeFromCart(d):e>0&&this.googleTagManager.addToCart(d)}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to update item quantity",i),i}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,e){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),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},a=this.buildItemUpdate(r,0),c=await this.api.updateCart({id:i,items:[a],location:this.getLocation()});this.syncItemsFromApiResponse(c,[]),this.cleanupAfterItemRemoval(s,c),this.syncCartMetaFromApiResponse(c),this.pubSub.publishAction(n.CART_ITEM_REMOVED,{id:r.id});const l=splitCategoryPath(r.catPath);this.googleTagManager.removeFromCart({item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_size:r.size,item_category:l.category,item_category2:l.category2,item_category3:l.category3,quantity:r.quantity,price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId})}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to remove item",i),i}}async updateItemEngraving(t,e){var i,r,s;try{const a=this.store.get("cart"),c=null===(i=a.items)||void 0===i?void 0:i[t];if(!c)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const l={id:c.id,fulfillmentId:c.fulfillmentId,partNumber:c.partNumber,quantity:c.quantity,engravingLines:e},d=await this.api.updateCart({id:a.id||"",items:[l],location:this.getLocation()});this.syncItemsFromApiResponse(d,[t]),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d);const h=this.store.get("cart"),u=this.store.get("address");this.pubSub.publishAction(n.CART_UPDATED,{previous:cartDataForEventFromStore(a,u),current:cartDataForEventFromStore(h,u)}),this.pubSub.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{id:c.id,engravingLines:e,previousEngravingLines:(null===(s=null===(r=c.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[]})}catch(a){throw this.store.set("cart.items."+t+".error",a.message),this.logger.error("Failed to update item engraving",a),a}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var e,i;try{this.store.set("cart.loading",!![]);const r=this.store.get("cart"),s={...r},a=(null===(e=t.engravingLines)||void 0===e?void 0:e.filter(t=>""!==t.trim()))||[],c=a.length>0,l=Object.values(r.items||{}).find(e=>{var n,i,r,s,l;const d=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!d)return![];if(c){const t=(null===(i=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[];return a.join(",")===t.join(",")}return!(null===(l=null===(s=null===(r=e.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||void 0===l?void 0:l.length)}),d={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:l?t.quantity+l.quantity:t.quantity};c&&(d.engravingLines=a);const h=await this.api.updateCart({id:r.id||"",items:[d],location:this.getLocation()}),u=null===(i=Object.values(h.items))||void 0===i?void 0:i.find(t=>t.fulfillmentId===d.fulfillmentId&&t.partNumber===d.partNumber);if(!u)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(h,[]);const m=this.store.get("cart.fulfillments."+t.fulfillmentId);m?this.updateFulfillment(t.fulfillmentId,h):this.addNewFulfillmentAndRetailer(t.fulfillmentId,h),this.syncRetailersFromApiResponse(h),this.syncCartMetaFromApiResponse(h);const f=this.store.get("cart"),g=this.store.get("address");this.pubSub.publishAction(n.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(n.CART_ITEM_ADDED,{id:u.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(n.CART_UPDATED,{previous:cartDataForEventFromStore(s,g),current:cartDataForEventFromStore(f,g)});const v=splitCategoryPath(u.catPath);this.googleTagManager.addToCart({item_id:u.liquidId,item_name:u.name,item_brand:u.brand,item_size:u.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,quantity:u.quantity,price:centToDollar(u.unitPrice||0),upc:u.upc,grouping_id:u.salsifyGrouping,product_id:u.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 e;try{const n={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity};(null==t?void 0:t.engravingLines)&&(null===(e=null==t?void 0:t.engravingLines)||void 0===e?void 0:e.length)>0&&(n.engravingLines=t.engravingLines);const i=await this.api.updateCart({id:"",items:[n],location:this.getLocation()});await this.checkoutCommands.loadCheckout(i.id)}catch(n){throw this.store.set("cart.error",n.message),this.logger.error("Failed to add presale item to cart",n),n}}async handleGoToCheckout(){var t;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(r.CHECKOUT);const e=this.store.get("cart"),n=(null===(t=e.promoCode)||void 0===t?void 0:t.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(e.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],n)}catch(e){throw this.store.set("cart.error",e.message),this.logger.error("Failed to proceed to checkout",e),e}finally{this.store.set("cart.loading",![])}}async applyPromoCode(t){var e,i,r,s,a;if(!(null==t?void 0:t.trim()))throw new SDKError("Promo code is required");const c=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(c);const l=await this.api.updateCart({id:t,items:[],promoCode:c,location:this.getLocation()});this.store.set("cart.subtotal",l.subtotal),this.store.set("cart.events",transformEventsForCart(l.events||[]));const d=(null===(i=null===(e=l.promoCode)||void 0===e?void 0:e.code)||void 0===i?void 0:i.toLowerCase())===c.toLowerCase();d?(this.store.set("cart.promoCode",{code:c,discountAmount:(null===(r=l.promoCode)||void 0===r?void 0:r.discountAmount)||0}),this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{discountAmount:(null===(s=l.promoCode)||void 0===s?void 0:s.discountAmount)||0,newTotal:l.subtotal||0}),this.googleTagManager.promoCodeApplied(c,(null===(a=l.promoCode)||void 0===a?void 0:a.discountAmount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:'Code "'+c+'" does not exist'}),this.googleTagManager.promoCodeFailed(c,'Code "'+c+'" does not exist'))}catch(l){const t=(null==l?void 0:l.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(c,t),this.logger.error("Failed to apply promo code",l),l}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":e.subtotal,"cart.promoCode":null}),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{newTotal:e.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const e=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",e);const i=this.store.get("cart.promoCode");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:e}),(null==i?void 0:i.code)&&this.googleTagManager.promoCodeFailed(i.code,e),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...v,rerender:!![]}),this.store.set("cart",{...g,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSub.publishAction(n.CART_RESET,!![])}getDetails(){var t;const e=this.store.get("cart"),n=this.store.get("address"),i=n.id?n:m,r={};for(const s in e.items||{}){const t=e.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:e.id,promoCode:(null===(t=e.promoCode)||void 0===t?void 0:t.code)||"",items:r,location:{placesId:i.id,address:{one:i.address.one,two:i.address.two,city:i.address.city,state:i.address.state,zip:i.address.zip,country:i.address.country},coordinates:{latitude:i.coordinates.latitude,longitude:i.coordinates.longitude}},subtotal:e.subtotal,itemCount:Object.values(r||{}).reduce((t,e)=>t+(e.quantity||0),0)}}buildItemUpdate(t,e){var n,i,r;const s={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},a=(null===(r=null===(i=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||void 0===r?void 0:r.filter(t=>""!==t.trim()))||[];return a.length>0&&(s.engravingLines=a),s}syncItemsFromApiResponse(t,e=[]){const n=this.store.get("cart.items")||{},i=new Set(Object.keys(t.items));for(const s of Object.keys(n))i.has(s)||this.store.remove("cart.items."+s);const r={};for(const s of Object.values(t.items))0!==e.length&&!e.includes(s.id)&&n[s.id]||(r["cart.items."+s.id]=s);Object.keys(r).length>0&&this.store.batch(r)}syncCartMetaFromApiResponse(t){var e,n;const i={"cart.subtotal":t.subtotal,"cart.error":null,"cart.events":transformEventsForCart(t.events||[])},r=null===(e=null==t?void 0:t.promoCode)||void 0===e?void 0:e.code;if(r)i["cart.promoCode"]={code:r.toUpperCase(),discountAmount:(null===(n=t.promoCode)||void 0===n?void 0:n.discountAmount)||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(i["cart.promoCode"]=null)}this.store.batch(i)}syncRetailersFromApiResponse(t){var e;if((null===(e=Object.values(t.retailers))||void 0===e?void 0:e.length)>0){const e={};for(const n of Object.values(t.retailers))e["cart.retailers."+n.id]=n;this.store.batch(e)}}updateFulfillment(t,e){var n;const i=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.find(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t)}),r=null==i?void 0:i.fulfillments[t];r&&i&&this.store.set("cart.fulfillments."+t,r)}addNewFulfillmentAndRetailer(t,e){var n;const i=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.find(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t)}),r=null==i?void 0:i.fulfillments[t];if(r&&i){const e={["cart.fulfillments."+t]:r,["cart.retailers."+i.id]:i};this.store.batch(e)}}cleanupAfterItemRemoval(t,e){var n,i,r,s;const a=this.store.get("cart.fulfillments."+t.fulfillmentId),c=this.store.get("cart.retailers."+t.retailerId);if(!a||!c)return;const l=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.some(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t.fulfillmentId)}),d=null===(i=Object.keys(e.retailers))||void 0===i?void 0:i.some(e=>e===t.retailerId);if(l){this.updateFulfillment(t.fulfillmentId,e);const n=null===(s=Object.keys(e.retailers))||void 0===s?void 0:s.find(e=>e===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,n)}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),d){const n=null===(r=Object.keys(e.retailers))||void 0===r?void 0:r.find(e=>e===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,n)}else this.store.remove("cart.retailers."+t.retailerId)}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,e=![]){this.store.createProductInstance(t),e&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var e;if(!Array.isArray(t)||0===t.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=!![],t["products."+e+".error"]=null,t),{}));const n=await this.api.getProductsData(t,this.getLocation());if(!n||!n.products||0===n.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]=!![],t),{})),void 0;const i=[];for(const s of n.products){const r=Object.values(s.sizes).filter(e=>t.some(t=>t===(e.upc||e.id||s.salsifyGrouping))),a=t.find(t=>r.some(e=>t===e.upc||t===e.id)||t===s.salsifyGrouping),c=a||(null===(e=null==r?void 0:r[0])||void 0===e?void 0:e.upc);await this.loadProduct(c,{products:[s],retailers:n.retailers}),i.push(c)}const r=t.filter(t=>-1===i.indexOf(t));this.store.batch(r.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]="Product data not found",t),{}))}async loadProduct(t,e=null){var i;try{const r=this.store.get("products."+t);r.loading||this.store.set("products."+t+".loading",!![]);let s=null;if(e&&(s=e),e||(s=await this.api.getProductsData([t],this.getLocation())),!s||!(null===(i=null==s?void 0:s.products)||void 0===i?void 0:i[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const a=this.loadProductStoreUpdate(s);if(!a)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...a,identifier:t}),this.pubSub.publishAction(n.PRODUCT_LOADED,this.productDataForEventFromStore(t));const c=s.products[0],l=a.sizes[a.selectedSizeId||""],d=Boolean(this.getLocation()),h=a.selectedFulfillment,u=d&&(null==h?void 0:h.variant.price)?h.variant.price:a.noAvailabilityPrice,m=splitCategoryPath(c.catPath);this.googleTagManager.viewItem({item_id:null==l?void 0:l.id,item_name:c.name,item_brand:c.brand,item_size:null==l?void 0:l.size,item_category:m.category,item_category2:m.category2,item_category3:m.category3,price:centToDollar(u),item_type:c.type,item_subtype:c.subType,upc:null==l?void 0:l.upc,grouping_id:c.salsifyGrouping,product_id:null==l?void 0:l.id})}catch(r){this.store.set("products."+t+".error",r.message),this.logger.error("Failed to load product data for ID "+t,r)}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,e){var i,r;const a=this.store.get("products."+t);let c=a.selectedFulfillmentType;const l=a.sizes[e];let d=null,h=null;if(c!==s.SHIPPING||Object.values(l.shippingFulfillments).length)if(c!==s.ON_DEMAND||Object.values(l.onDemandFulfillments).length){const t=c===s.SHIPPING?l.shippingFulfillments:l.onDemandFulfillments,e=Object.values(t);d=e[0]||null,h=(null==d?void 0:d.id)||null}else{c=s.SHIPPING;const t=Object.values(l.shippingFulfillments);d=t[0]||null,h=(null==d?void 0:d.id)||null}else{c=s.ON_DEMAND;const t=Object.values(l.onDemandFulfillments);d=t[0]||null,h=(null==d?void 0:d.id)||null}const u=c===s.SHIPPING?l.shippingFulfillments:l.onDemandFulfillments,m=splitCategoryPath(a.catPath);this.googleTagManager.viewItem({item_id:null==l?void 0:l.id,item_name:a.name,item_brand:a.brand,item_size:null==l?void 0:l.size,item_category:m.category,item_category2:m.category2,item_category3:m.category3,price:centToDollar((null==d?void 0:d.variant.price)||a.noAvailabilityPrice),item_type:a.type,item_subtype:a.subType,upc:null==l?void 0:l.upc,grouping_id:a.salsifyGrouping,product_id:null==l?void 0:l.id});const f=Object.keys(l.shippingFulfillments).length>0,g=Object.keys(l.onDemandFulfillments).length>0;f||g||this.googleTagManager.productSizeNoAvailability({productId:null==l?void 0:l.id,productName:a.name,productBrand:a.brand,productCategory:m.category,productCategory2:m.category2,productCategory3:m.category3,productType:a.type,productSubtype:a.subType,productPrice:a.noAvailabilityPrice,sizeId:e,sizeName:null==l?void 0:l.size,upc:null==l?void 0:l.upc,groupingId:a.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:e,size:(null===(i=a.sizes[e])||void 0===i?void 0:i.size)||"",previousSizeId:a.selectedSizeId||"",previousSize:(null===(r=a.sizes[a.selectedSizeId])||void 0===r?void 0:r.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:e,["products."+t+".productHasAvailability"]:Object.keys(l.shippingFulfillments).length+Object.keys(l.onDemandFulfillments).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(u).length),["products."+t+".selectedFulfillmentType"]:c,["products."+t+".selectedFulfillment"]:d,["products."+t+".selectedFulfillmentId"]:h})}async selectFulfillment(t,e){const i=this.store.get("products."+t),r=i.sizes[i.selectedSizeId],a=i.selectedFulfillmentType===s.SHIPPING?r.shippingFulfillments:r.onDemandFulfillments,c=a[e];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:e,selectedFulfillmentType:i.selectedFulfillmentType,previousFulfillmentId:i.selectedFulfillmentId||"",previousFulfillmentType:i.selectedFulfillmentType});const l=splitCategoryPath(i.catPath);this.googleTagManager.viewItem({item_id:null==r?void 0:r.id,item_name:i.name,item_brand:i.brand,item_size:null==r?void 0:r.size,item_category:l.category,item_category2:l.category2,item_category3:l.category3,price:centToDollar((null==c?void 0:c.variant.price)||i.noAvailabilityPrice),item_type:i.type,item_subtype:i.subType,upc:null==r?void 0:r.upc,grouping_id:i.salsifyGrouping,product_id:null==r?void 0:r.id}),this.store.batch({["products."+t+".selectedFulfillment"]:c,["products."+t+".selectedFulfillmentId"]:e,["products."+t+".quantity"]:1})}async updateQuantity(t,e){var i;const r=this.store.get("products."+t),s=r.quantity,a=s+e,c=1,l=(null===(i=null==r?void 0:r.selectedFulfillment)||void 0===i?void 0:i.variant.stock)||5,d=Math.max(c,Math.min(l,a));this.pubSub.publishAction(e<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:d,previousQuantity:s}),this.store.set("products."+t+".quantity",d)}async changeFulfillmentType(t,e){var i;const r=this.store.get("products."+t),a=r.sizes[r.selectedSizeId],c=e===s.SHIPPING?a.shippingFulfillments:a.onDemandFulfillments,l=Object.values(c);if(0===l.length){const t=splitCategoryPath(r.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==a?void 0:a.id,productName:r.name,productBrand:r.brand,productCategory:t.category,productCategory2:t.category2,productCategory3:t.category3,productType:r.type,productSubtype:r.subType,productPrice:r.noAvailabilityPrice,sizeId:null!==(i=r.selectedSizeId)&&void 0!==i?i:void 0,sizeName:null==a?void 0:a.size,fulfillmentType:e,upc:null==a?void 0:a.upc,groupingId:r.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+e+" fulfillments available for selected size"}),void 0}const d=l[0]||null,h=(null==d?void 0:d.id)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:e,selectedFulfillmentId:h,previousFulfillmentType:r.selectedFulfillmentType,previousFulfillmentId:r.selectedFulfillmentId,fulfillmentHasAvailability:l.length>0});const u=splitCategoryPath(r.catPath);this.googleTagManager.viewItem({item_id:null==a?void 0:a.id,item_name:r.name,item_brand:r.brand,item_size:null==a?void 0:a.size,item_category:u.category,item_category2:u.category2,item_category3:u.category3,price:centToDollar((null==d?void 0:d.variant.price)||r.noAvailabilityPrice),item_type:r.type,item_subtype:r.subType,upc:null==a?void 0:a.upc,grouping_id:r.salsifyGrouping,product_id:null==a?void 0:a.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:e,["products."+t+".selectedFulfillment"]:d,["products."+t+".selectedFulfillmentId"]:h,["products."+t+".fulfillmentHasAvailability"]:l.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,e,n){const i={type:e,data:n||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:i})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),e=Object.keys(t);for(const n of e)this.store.set("products."+n+".rerender",!![])}async addToCart(t,e){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(r.CART),await this.cartCommands.addItem(e),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const n=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(n.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,e){try{this.store.set("products."+t+".updating",!![]),await this.cartCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(r.CHECKOUT),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const e=this.store.get("products."+t),n={},fulfillmentEventData=t=>{const e={};for(const n in t){const i=t[n];e[n]={retailerId:i.variant.retailerId,retailerName:i.retailerName,retailerAddress:i.retailerAddress,retailerTimezone:i.timezone,price:i.variant.price,partNumber:i.variant.partNumber,stock:i.variant.stock,isEngravable:i.variant.isEngravable,fulfillmentId:i.id,fulfillmentType:i.type}}return e};for(const i in e.sizes||{}){const t=e.sizes[i];n[i]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc||"",container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:t.attributes,shippingFulfillments:fulfillmentEventData(t.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(t.onDemandFulfillments||{})}}return{identifier:t,selectedSizeId:e.selectedSizeId||null,selectedFulfillmentId:e.selectedFulfillmentId||null,selectedFulfillmentType:e.selectedFulfillmentType,id:e.id,name:e.name,brand:e.brand,catPath:e.catPath,category:e.category,classification:e.classification,type:e.type,salsifyGrouping:e.salsifyGrouping,subType:e.subType,images:e.images||[],region:e.region,country:e.country,material:e.material,abv:e.abv,proof:e.proof,age:e.age,color:e.color,flavor:e.flavor,variety:e.variety,appellation:e.appellation,vintage:e.vintage,description:e.description,htmlDescription:e.htmlDescription,tastingNotes:e.tastingNotes,noAvailabilityPrice:e.noAvailabilityPrice,sizes:n}}findFirstAvailableSize(t){const e=Object.values(t);for(const n of e){const t=n.shippingFulfillments||{},e=n.onDemandFulfillments||{},i=Object.values(t).length,r=Object.values(e).length;if(i+r>0)return n.id}return null}loadProductStoreUpdate({products:[t,...e],retailers:n}){var i,r,a,c,l;try{const e=this.themeProvider.getConfigs("product"),d={id:t.id,brand:t.brand,category:t.category,catPath:t.catPath,classification:t.classification,type:t.type,subType:t.subType,salsifyGrouping:t.salsifyGrouping,name:t.name,description:t.description,htmlDescription:t.htmlDescription,images:t.images,region:t.region,country:t.country,material:t.material,abv:t.abv,proof:t.proof,age:t.age,color:t.color,flavor:t.flavor,variety:t.variety,appellation:t.appellation,vintage:t.vintage,tastingNotes:t.tastingNotes,noAvailabilityPrice:t.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:e.layout.enableShippingFulfillment?s.SHIPPING:s.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(t.sizes&&Object.values(t.sizes).length>0)for(const{shippingVariants:i,onDemandVariants:r,...s}of Object.values(t.sizes)){d.sizes[s.id]={...s,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const t of Object.values(i)){const e=n[t.retailerId];(null==e?void 0:e.shippingFulfillment)&&(d.sizes[s.id].shippingFulfillments[e.shippingFulfillment.id]={...e.shippingFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}for(const t of Object.values(r)){const e=n[t.retailerId];(null==e?void 0:e.onDemandFulfillment)&&(d.sizes[s.id].onDemandFulfillments[e.onDemandFulfillment.id]={...e.onDemandFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}}const h=Object.values(d.sizes),u=this.findFirstAvailableSize(d.sizes);d.selectedSizeId=u||(null===(i=h[0])||void 0===i?void 0:i.id)||"";const m=(null===(r=d.sizes[d.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments)||{},f=(null===(a=d.sizes[d.selectedSizeId])||void 0===a?void 0:a.onDemandFulfillments)||{};d.productHasAvailability=Object.values(m).length+Object.values(f).length>0;const g=d.selectedFulfillmentType===s.SHIPPING?Object.values(m):Object.values(f);if(d.fulfillmentHasAvailability=g.length>0,d.selectedFulfillment=g[0]||null,d.selectedFulfillmentId=(null===(c=d.selectedFulfillment)||void 0===c?void 0:c.id)||null,!d.fulfillmentHasAvailability){const t=d.selectedFulfillmentType===s.SHIPPING?s.ON_DEMAND:s.SHIPPING,e=t===s.SHIPPING?Object.values(m):Object.values(f);e.length>0&&(d.selectedFulfillmentType=t,d.selectedFulfillment=e[0],d.selectedFulfillmentId=(null===(l=d.selectedFulfillment)||void 0===l?void 0:l.id)||null,d.fulfillmentHasAvailability=!![])}if(!d.productHasAvailability){const e=splitCategoryPath(t.catPath),n=d.sizes[d.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==n?void 0:n.id,productName:t.name,productBrand:t.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:t.type,productSubtype:t.subType,productPrice:t.noAvailabilityPrice,upc:null==n?void 0:n.upc,groupingId:t.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for any size"})}return d}catch(d){throw this.logger.error("Product data processing error",d),d}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(t){return!t||t.length<3?[]:await this.api.getAddressSuggestions(t)}async getAddressDetails(t){return await this.api.getAddressDetails(t)}async setSelectedAddress(t){try{this.store.batch({"address.id":t.id,"address.formattedAddress":t.formattedAddress,"address.address":t.address,"address.coordinates":t.coordinates});const e=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(e)),await this.cartCommands.resetCart(),await this.store.persist()}catch(e){throw this.googleTagManager.addressFailed({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),e}this.googleTagManager.addressUpdated({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates}),this.pubSub.publishAction(n.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,e){try{const n=buildFormattedAddressString(t),i={id:"",formattedAddress:n,address:t,coordinates:e};await this.setSelectedAddress(i)}catch(i){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==i?void 0:i.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:t,coordinates:e,error:(null==i?void 0:i.message)||"Failed to set manual address"}),i}}async clearSelectedAddress(){this.store.set("address",m),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 e,n;const i=t,r=this.clientConfig.getConfigs();i.entity=null!==(n=null!==(e=window.location.hostname)&&void 0!==e?e:r.partnerName)&&void 0!==n?n:void 0,i.visitorId=r.userDeviceId,i.loc=this.getLocation();const s=await this.api.catalogSearch(i);return s.products&&s.products.length>0&&this.trackViewItemList(s.products),s}async addToCart(t){try{this.uiCommands.openDrawer(r.CART),await this.cartCommands.addItem(t)}catch(e){throw this.logger.error("Error adding product to cart from product list",e),e}}async addPresaleToCart(t){try{await this.cartCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(r.CHECKOUT)}catch(e){throw this.logger.error("Error adding presale product to cart from product list",e),e}}trackViewItemList(t){if(0!==t.length)try{const e=t.map((t,e)=>({...this.convertProductToBaseItem(t),index:e+1}));this.googleTagManager.viewItemList(e,"product_list","Product List")}catch(e){this.logger.error("Error tracking view_item_list event",e)}}trackSelectItem(t){try{const e=this.convertProductToBaseItem(t);this.googleTagManager.selectItem(e,"product_list","Product List")}catch(e){this.logger.error("Error tracking select_item event",e)}}convertProductToBaseItem(t){var e;const n=null===(e=t.sizes)||void 0===e?void 0:e[0],i=null==n?void 0:n.shippingVariants[Object.keys(n.shippingVariants)[0]],r=splitCategoryPath(t.catPath);return{item_id:null==n?void 0:n.id,item_name:t.name,item_brand:t.brand,item_size:null==n?void 0:n.size,item_category:r.category,item_category2:r.category2,item_category3:r.category3,price:(null==i?void 0:i.price)?centToDollar(i.price):t.noAvailabilityPrice?centToDollar(t.noAvailabilityPrice):void 0,item_type:t.type,item_subtype:t.subType,upc:null==n?void 0:n.upc,grouping_id:t.salsifyGrouping,product_id:null==n?void 0:n.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 e=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:e.address,coordinates:e.coordinates,formattedAddress:e.formattedAddress})}catch(e){throw this.logger.error("Error setting address by placesId:",e),e}},setAddressManually:async(t,e)=>{try{if(!t||!e)throw new SDKError("Both address and coordinates are required.",!![]);if(!(t.one&&t.city&&t.state&&t.zip))throw new SDKError("Address must include street, city, state, and zip code.",!![]);if("number"!=typeof e.latitude||"number"!=typeof e.longitude)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof e.latitude+", long: "+typeof e.longitude,!![]);if(e.latitude<-90||e.latitude>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+e.latitude,!![]);if(e.longitude<-180||e.longitude>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+e.longitude,!![]);await this.command.address.setAddressManually(t,e)}catch(n){throw this.logger.error("Error setting manual address:",n),n}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(r.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CART)},addProduct:async(t,e)=>{var i,a;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;const c=this.getLocation();if(void 0===c)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=e?e:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(r.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;e===!![]&&this.command.ui.openDrawer(r.CART);const l=[...new Set(t.map(t=>t.identifier))],d=await this.api.getProductsData(l,c);if(!d||!d.products||0===d.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 e of t){let t=null;for(let i=0;i<d.products.length;i++){const n=d.products[i];let r=![];for(let t=0;t<Object.values(n.sizes).length;t++){const i=n.sizes[t];if(i.upc===e.identifier||i.id===e.identifier||n.salsifyGrouping===e.identifier){r=!![];break}}if(r){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=t.sizes[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(a=null===(i=null==n?void 0:n.attributes)||void 0===i?void 0:i.presale)||void 0===a?void 0:a.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+e.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let r=null;const c=e.fulfillmentType===s.SHIPPING?n.shippingVariants:n.onDemandVariants;for(let e=0;e<Object.values(c).length;e++)if(c[e]){r=c[e];break}if(!r){this.logger.warn("No supported variant found for product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const l=e.fulfillmentType===s.ON_DEMAND?r.onDemandFulfillmentId:r.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:l,partNumber:r.partNumber,quantity:e.quantity,identifier:e.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(n.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:l}),this.logger.info("Products added to cart successfully:",l)}catch(c){throw this.logger.error("Error adding products to cart:",c),this.clearPendingCartOperation(),this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:c.message||"Failed to add products to cart"}),c}},applyPromoCode:async t=>{try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const e=t.trim().toUpperCase(),i=this.themeProvider.getConfigs("global"),r=i.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===e)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(e);const a=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{discountAmount:0,newTotal:a.subtotal}),this.logger.info("Promo code applied successfully")}catch(e){throw this.logger.error("Failed to apply promo code:",e),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),e}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),e=t.layout.allowPromoCodes;if(!e)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const i=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{newTotal:i.subtotal}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(n.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(r.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CHECKOUT)},addProduct:async(t,e)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;e===!![]&&this.command.ui.openDrawer(r.CHECKOUT);const i=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:i}),this.logger.info("Products added to checkout successfully:",i)}catch(i){throw this.logger.error("Error adding products to checkout:",i),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:i.message||"Failed to add products to checkout"}),i}},addPresaleProduct:async t=>{var e,i;try{if(!t||"object"!=typeof t||!t.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;const a=this.getLocation();if(void 0===a)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(r.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const c=await this.api.getProductsData([t.identifier],a);if(!c||!c.products||0===c.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 l=c.products[0],d=l.sizes[0];if(!d)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===(i=null===(e=null==d?void 0:d.attributes)||void 0===e?void 0:e.presale)||void 0===i?void 0:i.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 h=null;const u=t.fulfillmentType===s.SHIPPING?d.shippingVariants:d.onDemandVariants;for(let t=0;t<Object.values(u).length;t++)if(u[t]){h=u[t];break}if(!h)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 m=t.fulfillmentType===s.ON_DEMAND?h.onDemandFulfillmentId:h.shippingFulfillmentId;await this.command.cart.addPresaleItem({fulfillmentId:m,partNumber:h.partNumber,quantity:t.quantity,engravingLines:[],identifier:t.identifier}),this.command.ui.openDrawer(r.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(a){throw this.logger.error("Error adding presale product to checkout:",a),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:a.message||"Failed to add presale product to checkout",isPresale:!![]}),a}},applyPromoCode:async t=>{var e;try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const i=t.trim().toUpperCase(),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 a=this.store.get("checkout.promoCode");if(a&&a.code===i)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const c=this.store.get("checkout"),l=null==c?void 0:c.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:(null==l?void 0:l.discountAmount)||0,newTotal:(null===(e=null==c?void 0:c.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(i){throw this.logger.error("Failed to apply checkout promo code:",i),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),i}},removePromoCode:async()=>{var t;try{const e=this.themeProvider.getConfigs("global"),i=e.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const 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(e){throw this.logger.error("Failed to remove checkout promo code:",e),e}},applyGiftCard:async t=>{var e;try{const i=this.themeProvider.getConfigs("checkout"),r=i.layout.allowGiftCards;if(!r)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const s=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:(null===(e=null==s?void 0:s.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card applied successfully")}catch(i){throw this.logger.error("Failed to apply gift card:",i),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be applied"}),i}},removeGiftCard:async t=>{var e;try{const i=this.themeProvider.getConfigs("checkout"),r=i.layout.allowGiftCards;if(!r)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t);const s=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:(null===(e=null==s?void 0:s.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card removed successfully")}catch(i){throw this.logger.error("Failed to remove gift card:",i),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be removed"}),i}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:async(t,e)=>{await this.command.checkout.toggleMarketingPreferences(t,e)},updateCustomerInfo:t=>{for(const[e,n]of Object.entries(t));},updateBillingInfo:t=>{for(const[e,n]of Object.entries(t));},updateGiftInfo:t=>{for(const[e,n]of Object.entries(t));},getDetails:()=>{var t,e,n;const i=this.store.get("checkout"),r=i.items||{},s={};for(const[a,c]of Object.entries(r))s[a]={liquidId:c.liquidId,variantId:c.variantId,cartItemId:a,retailerId:c.retailerId,fulfillmentId:c.fulfillmentId,salsifyGrouping:c.salsifyGrouping,name:c.name,catPath:c.catPath,volume:c.volume,uom:c.uom,proof:c.proof,abv:c.abv,containerType:c.containerType,container:c.container,size:c.size,pack:c.pack,packDesc:c.packDesc,mainImage:c.mainImage,brand:c.brand,partNumber:c.partNumber,upc:c.upc,sku:c.sku,price:c.price,unitPrice:c.unitPrice,quantity:c.quantity,unitTax:c.unitTax,bottleDeposits:c.bottleDeposits,attributes:c.attributes,retailerName:c.retailerName,expectationDetail:c.expectationDetail};return{cartId:i.cartId||"",isGift:i.isGift||![],billingSameAsShipping:i.paymentForm.billingSameAsShipping,marketingPreferences:{canEmail:(null===(t=i.marketingPreferences)||void 0===t?void 0:t.canEmail)||![],canSms:(null===(e=i.marketingPreferences)||void 0===e?void 0:e.canSms)||![]},hasPromoCode:!!(null===(n=i.promoCode)||void 0===n?void 0:n.code),hasGiftCards:Array.isArray(i.giftCards)&&i.giftCards.length>0,itemCount:Object.values(s||{}).reduce((t,e)=>t+(e.quantity||0),0),amounts:i.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 K=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+n.ADDRESS_UPDATED,K)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,e=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(t,e)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.latitude&&t.coordinates.longitude)return{coordinates:t.coordinates,address:t.address}}}const mt="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",ft="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const t=LoggerFactory,e=t.instances;if(e)for(const[i,r]of e)this.interceptLoggerInstance(r,i);const n=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const e=n(t);return this.interceptLoggerInstance(e,t),e}}interceptLoggerInstance(t,e){if(t.l)return;const n=t.debug.bind(t),i=t.info.bind(t),r=t.warn.bind(t),s=t.error.bind(t),J=(t,n,i)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:n,data:i,context:e});t.debug=(t,e)=>{n(t,e),this.addLogEntry(J("debug",t,e))},t.info=(t,e)=>{i(t,e),this.addLogEntry(J("info",t,e))},t.warn=(t,e)=>{r(t,e),this.addLogEntry(J("warn",t,e))},t.error=(t,e)=>{s(t,e),this.addLogEntry(J("error",t,e))},t.l=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),e=t.publishAction.bind(t);t.publishAction=(t,n)=>{e(t,n),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:n,context:"PubSub"})};const n=t.publishForm.bind(t);t.publishForm=(t,e)=>{n(t,e),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+t,data:e,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),e=t.executeEvent.bind(t);t.executeEvent=(t,n,i)=>{e(t,n,i),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+n,data:i,context:"GTM."+t})}}addLogEntry(t){this.logs.push(t),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const t=this.logs.filter(t=>{switch(t.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",t.forEach(t=>{const e=this.createLogElement(t);this.logContainer.appendChild(e)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(ft);t&&t.remove(),this.panelElement=document.createElement(ft);const e=window.innerWidth<=768,n=window.innerWidth<=480;n?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):e?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const t=this.panelElement.attachShadow({mode:"closed"}),e=document.createElement("style");e.textContent=mt,t.appendChild(e),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const n=this.createHeader();this.panelContainer.appendChild(n);const i=this.createToggles();this.panelContainer.appendChild(i),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const 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 e=document.createElement("div");e.className="icon",e.innerHTML="🔍",e.title="Elements Debug Console",e.style.cursor="help";const n=document.createElement("div");n.className="title-container";const i=document.createElement("div");i.className="title",i.textContent="Elements Debug Console";const r=document.createElement("div");r.className="subtitle",r.textContent="Live SDK logs, events & GTM tracking",n.appendChild(i),n.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(e),t.appendChild(n),t.appendChild(s),t}createToggles(){const t=document.createElement("div");t.className="toggles";const e=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];e.forEach(({key:e,label:n,description:i,color:r})=>{const s=document.createElement("label");s.className="toggle",s.title=i;const a=document.createElement("input");a.type="checkbox",a.checked="showLogs"!==e,a.addEventListener("change",t=>{const n=t.target;"showEvents"===e&&(this.showEvents=n.checked),"showGtmEvents"===e&&(this.showGtmEvents=n.checked),"showLogs"===e&&(this.showLogs=n.checked),this.renderLogs()});const c=document.createElement("span");c.textContent=n,c.style.color=r,s.appendChild(a),s.appendChild(c),t.appendChild(s)});const n=document.createElement("button");return n.className="clear-btn",n.innerHTML="🗑️",n.title="Clear all logs",n.addEventListener("click",()=>this.clearLogs()),t.appendChild(n),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let e=![],n=0,i=0,r=0,s=0;t.addEventListener("mousedown",t=>{e=!![],n=t.clientX,i=t.clientY,r=Number.parseInt(this.panelElement.style.width,10)||500,s=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",Z),document.addEventListener("mouseup",V),t.preventDefault()});const Z=t=>{if(!e||!this.panelElement)return;const a=t.clientX-n,c=t.clientY-i,l=window.innerWidth<=768,d=window.innerWidth<=480;let h,u,m,f;d?(h=280,u=window.innerWidth-20,m=200,f=.4*window.innerHeight):l?(h=300,u=window.innerWidth-30,m=200,f=.4*window.innerHeight):(h=300,u=800,m=200,f=600);const g=Math.max(h,Math.min(u,r+a)),v=Math.max(m,Math.min(f,s+c));this.panelElement.style.width=g+"px",this.panelElement.style.height=v+"px"},V=()=>{e=![],document.removeEventListener("mousemove",Z),document.removeEventListener("mouseup",V)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const e=t.querySelector(".header");if(e){let t=![],n=0,i=0,r=0,s=0;e.addEventListener("mousedown",e=>{if(e.target.classList.contains("minimize"))return;t=!![],n=e.clientX,i=e.clientY;const a=this.panelElement.getBoundingClientRect();r=a.left,s=a.top,document.addEventListener("mousemove",Z),document.addEventListener("mouseup",V),e.preventDefault()});const Z=e=>{if(!t||!this.panelElement)return;const a=e.clientX-n,c=e.clientY-i;this.panelElement.style.left=r+a+"px",this.panelElement.style.top=s+c+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},V=()=>{t=![],document.removeEventListener("mousemove",Z),document.removeEventListener("mouseup",V)}}}createFloatingButton(){const t=document.createElement("div");return t.className="floating-btn",t.innerHTML="⚙️",t.title="Open Elements Debug Console",t.style.display="none",t.addEventListener("click",()=>{this.toggleVisibility()}),t}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(t){const e=document.createElement("div");e.className="log-entry "+t.type+" "+t.level;const n=new Date(t.timestamp).toLocaleTimeString();return e.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+n+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(t.message)+"\n "+(t.context?'<div class="log-context">'+this.escapeHtml(t.context)+"</div>":"")+"\n "+(t.data?'<div class="log-data"><pre>'+this.formatJsonData(t.data)+"</pre></div>":"")+"\n </div>\n ",e}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(e){return String(t)}}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.h()){const e=this.u(t);if(e)return this.m(t,e)}return this.cachedFingerprint||(this.cachedFingerprint=this.v()),this.m(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.C(),browser:this.k(),timezone:this.S()}}isLocalStorageWebApiAvailable(){return this.h()}m(t,e){return(t+"_"+e).toLowerCase()}h(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const t=window.localStorage,e="__localStorage_test_"+Date.now()+"__",n="test";t.setItem(e,n);const i=t.getItem(e);return i!==n?(this.isLocalStorageAvailable=![],![]):(t.removeItem(e),this.isLocalStorageAvailable=!![],!![])}catch(t){const n=t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name);if(n)try{const t=window.localStorage;return t&&t.length>0?(this._()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(e){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],t instanceof DOMException){const e={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},n=e[t.name]||"Storage error: "+t.name,i=this._()?"webview":"browser";console.warn("localStorage unavailable in "+i+": "+n)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}u(t){try{const e=this.clientConfig.get("localStorageKeyPrefix")+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(null==n?void 0:n.startsWith(e)){const t=n.substring(e.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(e){return null}}v(){const t=this.getFingerprintData(),e=Object.keys(t).sort().map(e=>e+":"+t[e]).join("|");return this.P(e)}C(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,i=this.D(),r=Math.round(100*(window.devicePixelRatio||1));return e+"|"+n+"|"+i+"|"+r}catch(t){return"24|24|srgb|100"}}D(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(et){}return"srgb"}k(){var t;try{const e=navigator,n=[],i=((null===(t=e.languages)||void 0===t?void 0:t[0])||e.language||"en").substring(0,2);n.push(i),n.push(e.hardwareConcurrency||4);const r=(e.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);n.push(r),n.push(e.cookieEnabled?"1":"0"),n.push(e.maxTouchPoints||0),n.push(e.deviceMemory||0),n.push(this.T()),n.push(this._()?"webview":"browser");const s=["bluetooth"in e?"1":"0","usb"in e?"1":"0","mediaDevices"in e?"1":"0","permissions"in e?"1":"0","credentials"in e?"1":"0","storage"in e?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return n.push(s.join("")),n.join("|")}catch(e){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}T(){try{const t=navigator.userAgent.toLowerCase();return t.includes("instagram")?"ig_webview":t.includes("fban")||t.includes("fbav")?"fb_webview":t.includes("tiktok")?"tiktok_webview":t.includes("linkedin")?"linkedin_webview":t.includes("snapchat")?"snapchat_webview":t.includes("twitter")?"twitter_webview":t.includes("line/")?"line_webview":t.includes("micromessenger")?"wechat_webview":t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}_(){try{const t=navigator.userAgent.toLowerCase(),e=navigator,n=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return n.some(e=>t.includes(e))?!![]:void 0===e.standalone||e.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}S(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}P(t){const e=16777619;let n=2166136261,i=2166136261,r=2166136261,s=2166136261;for(let a=0;a<t.length;a++){const c=t.charCodeAt(a);n^=c,n=Math.imul(n,e),i^=c<<1,i=Math.imul(i,e),r^=c<<2,r=Math.imul(r,e),s^=c<<3,s=Math.imul(s,e)}return n=Math.abs(n),i=Math.abs(i),r=Math.abs(r),s=Math.abs(s),n.toString(16)+i.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 t=this.clientConfig.get("env"),n=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:n,batchSize:t===e.PRODUCTION?5:10,batchInterval:t===e.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(t,e,n={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const i=Date.now();try{const r={eventId:"event_"+i,timestamp:i,level:t,message:e,context:n.context,error:n.error?this.buildErrorContext(n.error):void 0,component:n.component,data:n.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(r)}catch(r){this.handleInternalError(r)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const t=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:t||void 0}}buildBrowserContext(){return{userAgent:navigator.userAgent,deviceType:this.clientConfig.get("deviceType"),url:window.location.href,referrer:document.referrer||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}shouldCapture(t){switch(t){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(t){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(t),this.stats.totalEvents++,this.stats.eventsByLevel[t.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var t;if(0===this.eventQueue.length||!(null===(t=this.config)||void 0===t?void 0:t.endpoint))return;const e=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const n=this.createBatch(e);try{this.sendBatch(n),this.stats.batchesSent++}catch(i){this.stats.failedBatches++,this.handleInternalError(i),this.eventQueue.unshift(...e),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const e=Date.now();return{batchId:"batch_"+e,timestamp:e,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const e=new Blob([JSON.stringify(t)],{type:"text/plain"}),n=navigator.sendBeacon(this.config.endpoint,e);if(n)return}catch(e){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const e=new XMLHttpRequest;if(e.open("POST",this.config.endpoint,![]),e.setRequestHeader("Content-Type","text/plain"),e.send(JSON.stringify(t)),e.status<200||e.status>=300)throw new SDKError("XHR request failed with status: "+e.status)}catch(e){throw new SDKError("Both sendBeacon and XHR failed: "+e.message)}}truncateStackTrace(t){if(t)return t.split("\n").slice(0,10).join("\n")}handleInternalError(t){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",t)}shutdown(){var t;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(t=this.config)||void 0===t?void 0:t.endpoint))){const t=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(t),this.stats.batchesSent++}catch(e){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:e}){var n;this.I=Object.freeze(t),this.F=Object.freeze({type:e.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(n=null==e?void 0:e.useShadowDom)&&void 0!==n?n:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(t){return t.map(t=>this.interpolatePath(t))}interpolatePath(t){if("string"!=typeof t)return t;const e=/\{([^}]+)}/g;return t.replace(e,(e,n)=>{const i=this.I[n];return null==i?(this.logger.warn('Parameter "'+n+'" not found in component params for path "'+t+'"'),e):String(i)})}connectedCallback(){var t,e;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.F.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component connectedCallback error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"connectedCallback")}}disconnectedCallback(){var t,e;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component disconnectedCallback error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"disconnectedCallback")}}setup(){var t,e,n;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(e=this.beforeConnected)||void 0===e||e.call(this)}catch(i){this.logger.error("Component setup error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const e of this.unsubscribers)try{e()}catch(t){this.logger.error("Cleanup error during component destruction",t),t instanceof Error&&this.captureComponentError(t,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var t;if(!this.reactiveOptions.autoDestroy)return;let e=this.reactiveOptions.autoDestroyPath;if(!e&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(e=this.reactiveOptions.watchStorePaths[0]),!e)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const n=this.interpolatePath(e),i=this.store.watch(n,(t,e)=>{this.isDestroyed||void 0===t&&void 0!==e&&this.handleAutoDestroy(n)});this.unsubscribers.push(i)}handleAutoDestroy(t){var e;if(this.isDestroyed)return;null===(e=this.beforeAutoDestroy)||void 0===e?void 0:e.call(this,t);const n=this.reactiveOptions.autoDestroyDelay||0;n>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},n):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(e){this.logger.error("Error during auto-destroy of "+this.F.tagName,e),e instanceof Error&&this.captureComponentError(e,"auto-destroy")}}setupStoreWatchers(){var t;try{let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.I)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;const n=t.map(t=>t.path).join(", "),i="store:["+n+"]",r=null===(e=this.onStoreChanged)||void 0===e?void 0:e.call(this,t);r!==![]&&this.triggerRender(i)}catch(i){this.logger.error("Store watcher callback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"storeWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Store watchers setup error in "+((null===(t=this.F)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"setupStoreWatchers")}}setupNonRenderingWatchers(){var t;try{let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.I)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;null===(e=this.onStoreWatch)||void 0===e?void 0:e.call(this,t)}catch(i){this.logger.error("Non-rendering watcher callback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"nonRenderingWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.F)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"setupNonRenderingWatchers")}}triggerRender(t){this.lastRenderTrigger=t,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var t,e;if(!this.initialized||this.isDestroyed)return;const n=performance.now();this.renderCount++;try{const e=this.template();"string"==typeof e&&(this.container.innerHTML=e),e instanceof HTMLElement&&safeReplaceChildren(this.container,e),Array.isArray(e)&&safeReplaceChildren(this.container,...e);const r=performance.now()-n;this.logRenderInfo(r);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(i){this.logger.error("❌ afterRender hook error in "+this.F.tagName,i),i instanceof Error&&this.captureComponentError(i,"afterRender")}}catch(r){const t=performance.now()-n;this.logger.error("❌ Component render error in "+this.F.tagName,r),this.captureComponentError(r,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.F.type,message:r instanceof Error?r.message:String(r)}));try{null===(e=this.onError)||void 0===e?void 0:e.call(this,r,"render")}catch(s){this.logger.error("❌ onError hook error in "+this.F.tagName,s)}}}logRenderInfo(t){const e=this.F.type,n=this.F.tagName,i=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+i+" "+e+" </"+n+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&(this.logger.warn("⚠️ Slow render in "+e+"("+n+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:t,threshold:16,componentType:e,tagName:n,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+n+":performance",component:{type:e,tagName:n,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.F.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,e,n){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.F.tagName+":"+e,component:{type:this.F.type,tagName:this.F.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this.F.useShadowDom}})}catch(i){}}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}}addHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}removeHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.remove(...e)}toggleHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const n of e)this.classList.toggle(n)}addHostAttribute(t,e){t&&"string"==typeof t&&e&&"string"==typeof e&&(this.setAttribute(t,String(e)),this.hostAttributes[t]=String(e))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[e,n]of Object.entries(t))e&&"string"==typeof e&&n&&"string"==typeof n&&this.setAttribute(e,String(n))}get params(){return this.I}get config(){return this.themeProvider.getComponentConfig(this.F.type)}get elementConfig(){return this.F}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,e){return this.store.set(t,e)}watchStore(t,e){const n=this.store.watch(t,e);return this.unsubscribers.push(n),n}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const e=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:r.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,i;const s=this.getStoreValue("address"),a=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],c=null!==(e=this.params.productId)&&void 0!==e?e:"",l=null!==(n=this.params.options)&&void 0!==n?n:{},d=null!==(i=l.showLabel)&&void 0!==i?i:!![],h=[];if(d){const t=document.createElement("span");t.textContent="Delivers to:",h.push(t)}const u=document.createElement("button");u.type="button",u.textContent=s.formattedAddress||"Select an address";const m=s.formattedAddress?"Change delivery address, currently set to "+s.formattedAddress:"Select delivery address";return u.setAttribute("aria-label",m),u.addEventListener("click",async()=>{if(a)return this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:c,isIndependentComponent:!![]}),void 0;!a&&c&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:c}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(c,r.ADDRESS_INPUT,{productId:c}))}),h.push(u),h}}const ArrowRightIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="arrow-right-icon '+n+'" style="'+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:e=24,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 489 489" class="bag-icon '+n+'" style="'+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:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="checkbox-icon '+n+'" style="'+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:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+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:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="chevron-left-icon '+n+'" style="'+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 '},ChevronUpIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 10.4712C3.78862 10.7316 4.21073 10.7316 4.47108 10.4712L7.99967 6.94265L11.5283 10.4712C11.7886 10.7316 12.2107 10.7316 12.4711 10.4712C12.7314 10.2109 12.7314 9.78878 12.4711 9.52843L8.47108 5.52843C8.21073 5.26808 7.78862 5.26808 7.52827 5.52843L3.52827 9.52843C3.26792 9.78878 3.26792 10.2109 3.52827 10.4712Z" fill="#18181B"/>\n </svg>\n '},CloseIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="close-icon '+n+'" style="'+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:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="error-info-icon '+n+'" style="'+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:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="info-icon '+n+'" style="'+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:e=16,className:n="",color:i=null})=>{const r=i||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="search-icon '+n+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+r+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="success-icon '+n+'" style="'+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:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="trash-icon '+n+'" style="'+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:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="warning-icon '+n+'" style="'+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 e=t.target,n=e.value.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");e.value=n;const i=n.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const r=/^\d/.test(i);if(i.length<this.minSearchLength||!r)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(i)},300)},this.closeDrawer=async()=>{const t=this.params.productId,e=this.clientConfig.isMobile(),n=this.isIndependentComponent();(e||n)&&this.commands.ui.closeDrawer(),!e&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(et){this.logger.error("Address edit cancellation failed",et)}},this.handleCheckAvailability=async()=>{if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const t=this.getStoreValue("address"),e=(null==t?void 0:t.coordinates.latitude)!==this.selectedAddress.coordinates.latitude||(null==t?void 0:t.coordinates.longitude)!==this.selectedAddress.coordinates.longitude;e&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(t){this.logger.error("Address selection and availability check failed",t),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async t=>{const e=t.currentTarget.dataset.suggestionId;if(e)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(e);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:e,address:t.address,coordinates:t.coordinates,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(n){this.logger.error("Address details retrieval failed",n),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=t=>{this.container.contains(t.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const t=this.getStoreValue("address");(null==t?void 0:t.formattedAddress)&&(this.selectedAddress=t)}async searchAddresses(t){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const e=await this.commands.address.searchAddresses(t);this.suggestions=e.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(e){this.logger.error("Address search operation failed",e),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const t=this.errorContainer.querySelector(".error-text");t&&(t.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const t=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(t),void 0}for(const t of this.suggestions){const e=this.createElement("li",{className:"suggestion-item"}),n=this.createElement("span",{textContent:t.description});e.appendChild(n),e.setAttribute("data-suggestion-id",t.id),e.setAttribute("role","option"),e.setAttribute("aria-label","Select address: "+t.description),e.setAttribute("tabindex","0"),e.addEventListener("click",this.handleSuggestionClick),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())}),this.suggestionsContainer.appendChild(e)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,e){const n=document.createElement(t);return e&&Object.assign(n,e),n}createErrorContainer(){const t=this.createElement("div",{className:"error-message"});t.style.display="none",t.setAttribute("role","alert"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true");const e=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),n=this.createElement("span",{className:"error-text"});return t.appendChild(e),t.appendChild(n),t}createCheckButton(){const t=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return t.setAttribute("aria-label","Save and check address availability"),t.addEventListener("click",this.handleCheckAvailability),t}createCancelButton(){const t=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return t.setAttribute("aria-label","Cancel address selection"),t.addEventListener("click",this.handleCancel),t}template(){var t,e,n;const i=this.getConfigs("global"),r=null!==(t=this.params.options)&&void 0!==t?t:{},s=null!==(e=r.showLabel)&&void 0!==e?e:!![];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 a=this.createElement("div",{className:"input-wrapper "+i.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(n=this.selectedAddress)||void 0===n?void 0:n.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),a.appendChild(this.inputElement);const c=this.createElement("span");c.className="input-icon",c.innerHTML=SearchIcon({width:16,height:16,className:""}),a.appendChild(c),this.inputContainer.appendChild(a),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 l=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),d=[this.inputContainer,l,this.errorContainer],h=this.createElement("div",{className:"action-buttons"}),u=this.createCancelButton();h.appendChild(u);const m=this.createCheckButton();return h.appendChild(m),d.push(h),document.addEventListener("click",this.handleDocumentClick),d}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const t=[],e=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!e){const e=ComponentFactoryService.createElement({type:r.CART_HEADER});t.push(e)}const n=ComponentFactoryService.createElement({type:r.CART_BODY});t.push(n);const i=ComponentFactoryService.createElement({type:r.CART_FOOTER});return t.push(i),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=document.createElement("div");t.className="empty-cart-container";const e=document.createElement("h3");return e.className="empty-cart-content",e.textContent="Your cart is empty",t.appendChild(e),t}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:r.CART_RETAILER,retailerId:t.id})}catch(e){return this.logger.error("Cart retailer component creation failed",e),document.createElement("div")}}getRetailerElementById(t){return this.container.querySelector('[data-retailer-id="'+t+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const t=this.createEmptyCartElement();this.container.appendChild(t),this.setupEmptyCartListeners()}addLoadingOverlay(){const t=this.getLoadingElement();if(!t){const t=this.createLoadingElement();this.container.appendChild(t)}}removeLoadingOverlay(){const t=this.getLoadingElement();t&&t.remove()}setupEmptyCartListeners(){const t=this.container.querySelector('[data-action="continue-shopping"]');t&&t.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(t,e){const n=this.createRetailerElement(e);n.setAttribute("data-retailer-id",t),this.container.appendChild(n)}removeRetailerElement(t){const e=this.getRetailerElementById(t);e&&e.remove()}updateRetailerElement(t,e){const n=this.getRetailerElementById(t);if(n){const i=this.createRetailerElement(e);i.setAttribute("data-retailer-id",t),n.replaceWith(i)}}hasRetailerDataChanged(t,e){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const e={};for(const[n,i]of Object.entries(t))i&&"object"==typeof i&&i.id&&(e[n]=i);return e}getValidRetailerIds(t){const e=this.getValidRetailers(t);return new Set(Object.keys(e))}onStoreChanged(t){const e=t.find(t=>"cart.retailers"===t.path),n=t.find(t=>"cart.loading"===t.path);if(e){const t=this.getValidRetailers(e.oldValue),n=this.getValidRetailers(e.value),i=this.getValidRetailerIds(e.oldValue),r=this.getValidRetailerIds(e.value),s=i.size,a=r.size,c=this.getValidRetailers(this.getStoreValue("cart.retailers")),l=Object.keys(c).length;if(a>0&&0===l)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===s&&a>0){this.container.innerHTML="";for(const[t,e]of Object.entries(n))this.addRetailerElement(t,e)}else if(s>0&&0===a)this.showEmptyCartState();else if(a>0){for(const t of i)r.has(t)||this.removeRetailerElement(t);for(const e of r){const r=n[e],s=t[e];i.has(e)?this.hasRetailerDataChanged(s,r)&&this.updateRetailerElement(e,r):this.addRetailerElement(e,r)}}else 0===s&&0===a&&this.showEmptyCartState()}if(n){const t=n.value,e=n.oldValue;t!==e&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return n||e,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},e=Object.values(t);if(0===e.length)return this.createEmptyCartElement();const n=[];for(const i of e){const t=this.createRetailerElement(i);t.setAttribute("data-retailer-id",i.id),n.push(t)}return n}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.subtotal","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const e=t.some(t=>t.path.includes("cart.items")),n=t.some(t=>t.path.includes("cart.subtotal")),i=t.some(t=>t.path.includes("cart.fulfillments")),r=t.some(t=>"cart.loading"===t.path),s=t.some(t=>t.path.includes("cart.retailers"));e&&this.updateSubtotalItemsCount(),n&&this.subtotalPrice&&(this.subtotalPrice.textContent=formatCentToDollarText(this.getStoreValue("cart.subtotal"))),(i||n||r||e||s)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const e=this.getStoreValue("cart.items")||{},n=Object.values(e).some(t=>t.updating);if(n)return!![];const i=this.getStoreValue("cart.fulfillments")||{},r=Object.values(i).some(t=>t.updating);if(r)return!![];const s=this.getStoreValue("cart.retailers")||{},a=Object.values(s).some(t=>t.updating);return a?!![]:![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments");return Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},e=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),n=this.shouldDisableCheckout(),i=t||n||!e;this.checkoutButton.disabled=i,this.checkoutButton.classList.toggle("checkout-btn-disabled",i),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),e=Object.values(t).reduce((t,e)=>t+e.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+e+" item"+(1!==e?"s":"")+"):")}async handleCheckout(t){return this.clientConfig.isBuilder()?(t.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(t.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const t=this.getConfigs("global"),e=this.getStoreValue("cart.subtotal"),n=[],i=document.createElement("div");i.className="cart-footer-header";const 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(e),s.appendChild(this.subtotalPrice);const a=document.createElement("p");if(a.textContent="Taxes & fees will be calculated at checkout",a.className="taxes-fees-info",i.appendChild(s),i.appendChild(a),n.push(i),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:r.CART_PROMO_CODE});n.push(t)}const c=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(n.push(c),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleCheckout(t)}),this.checkoutButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleCheckout(t))}),n.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});n.push(t)}return n}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}handleItemsUpdate(t,e){const n=new Set(t||[]),i=new Set(e||[]);for(const r of n)if(!i.has(r)){const t=this.container.querySelector('[data-item-id="'+r+'"]');t&&t.remove()}for(const s of i)if(!n.has(s)){const t=ComponentFactoryService.createElement({type:r.CART_ITEM,itemId:s});t.setAttribute("data-item-id",s),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".itemIds"),n=this.container.querySelectorAll("[data-item-id]");for(const i of n)i.remove();for(const i of e){const t=ComponentFactoryService.createElement({type:r.CART_ITEM,itemId:i});this.container.appendChild(t)}}setupMinimumPurchaseAlert(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t),n=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(n&&n.remove(),null==e?void 0:e.hasUnmetMinimumPurchaseAmount){const t=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(e.minimumPurchaseAmount-e.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:e.subtotal,config:{showIcon:!![],alertType:"minimal"}});t.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(t)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var t;const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e);return(null===(t=null==n?void 0:n.itemIds)||void 0===t?void 0:t.length)?n.itemIds.some(t=>this.getStoreValue("cart.items."+t+".updating")):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}onStoreChanged(t){const e=this.getFulfillmentId(),n="cart.fulfillments."+e,i=t.find(t=>t.path===n),r=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(r.length>0&&this.checkAndUpdateLoadingState(),i){const t=i.oldValue,e=i.value,n=(null==t?void 0:t.itemIds)||[],r=(null==e?void 0:e.itemIds)||[],s=JSON.stringify(n)!==JSON.stringify(r);s&&(this.handleItemsUpdate(n,r),this.checkAndUpdateLoadingState());const a=(null==t?void 0:t.subtotal)!==(null==e?void 0:e.subtotal),c=this.hasFulfillmentDataChanged(t,e,["itemIds","updating"]);if(a&&!c&&this.setupMinimumPurchaseAlert(),!c)return![]}return![]}hasFulfillmentDataChanged(t,e,n=[]){if(!t)return!![];const i=["type","canEngrave"];for(const r of i)if(!n.includes(r)&&t[r]!==e[r])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const gt={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"},vt="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=gt[e];return n||vt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return vt}}function getCurrentTimeInTimezone(t){try{const e=new Date,n=e.getTime(),i=6e4*e.getTimezoneOffset(),r=new Date(n+i),s=new Date(r.toLocaleString("en-US",{timeZone:t})),a=r.getTime()-s.getTime();return new Date(n+a)}catch(e){return new Date}}function getCurrentTimeInUserTimezone(t){const e=detectUserTimezone(t);return getCurrentTimeInTimezone(e)}function isDateTimeInRange(t){const{startDate:e,endDate:n,addressState:i}=t;try{const t=getCurrentTimeInUserTimezone(i),r=!e||t>=new Date(e),s=!n||t<=new Date(n);return r&&s}catch(r){return![]}}function filterActiveItems(t,e){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:e}))}function hasActiveItems(t,e){return filterActiveItems(t,e).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,e,n;const i=this.config.layout.drawerHeaderText,s=this.getConfigs("global"),a=document.createElement("div");a.className="cart-header-content";const c=document.createElement("h2");c.className="cart-title",c.textContent=i,a.appendChild(c);const l=document.createElement("button");l.type="button",l.className="cart-header-close-btn",l.innerHTML=CloseIcon({width:16,height:16}),l.setAttribute("aria-label","Close cart drawer"),l.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),a.appendChild(l);const d=this.clientConfig.get("promoTicker"),h=null!==(e=null===(t=null==s?void 0:s.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],u=null!=d?d:h,m=this.store.get("address"),f=hasActiveItems(u,null===(n=null==m?void 0:m.address)||void 0===n?void 0:n.state);if(!u.length||!f)return[a];const g=ComponentFactoryService.createElement({context:"cart",type:r.PROMO_CODE_TICKER,tickers:u});return[a,g]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.params.itemId}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}handleOpenEngravingForm(t,e){var n,i,s,a,c,l,d,h,u,m;this.commands.ui.openDrawer(r.ENGRAVING_FORM,{identifier:t,context:"cart",lines:(null===(i=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[],maxLines:(null===(a=null===(s=e.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.maxLines)||1,maxCharsPerLine:(null===(l=null===(c=e.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.maxCharsPerLine)||16,fee:(null===(h=null===(d=e.attributes)||void 0===d?void 0:d.engraving)||void 0===h?void 0:h.fee)||0,location:null===(m=null===(u=e.attributes)||void 0===u?void 0:u.engraving)||void 0===m?void 0:m.location})}template(){var t,e,n,i,s,a,c,l;const d=this.params.itemId,h=this.getStoreValue("cart.items."+d),u=this.getConfigs("global"),m=this.getStoreValue("cart.fulfillments."+h.fulfillmentId),f=h.attributes.engraving.hasEngraving?"Ships in 10 days":null==m?void 0:m.expectation,g=document.createElement("article");g.className="cart-item";const v=document.createElement("div");v.className="item-image";const y=document.createElement("img");y.src=h.mainImage,y.alt=h.name,v.appendChild(y);const b=document.createElement("div");b.className="item-details";const x=document.createElement("div");x.className="item-header";const w=document.createElement("h3");w.className="item-title",w.textContent=h.name;const S=document.createElement("button");S.className="item-delete",S.innerHTML=TrashIcon({}),S.setAttribute("role","button"),S.setAttribute("tabindex","0"),S.setAttribute("aria-label","Remove "+h.name+" from cart"),S.setAttribute("aria-expanded","true"),S.addEventListener("click",async()=>{await this.commands.cart.removeItem(d)}),S.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(d))}),x.appendChild(w),x.appendChild(S);const E=document.createElement("div");E.className="item-specs",E.textContent=h.size+", "+h.container;const _=document.createElement("div");_.className="item-shipping-container";const D=document.createElement("div");if(D.className="item-shipping",D.textContent=f,_.appendChild(D),u.layout.enablePersonalization&&(null===(e=null===(t=null==h?void 0:h.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.isEngravable)&&(null===(i=null===(n=null==h?void 0:h.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.hasEngraving)===![]&&m.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=u.layout.personalizationText+" +"+formatCentToDollarText((null===(a=null===(s=h.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.fee)||0,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+h.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(d,h)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(d,h))}),_.appendChild(t)}b.appendChild(x),b.appendChild(E),b.appendChild(_),g.appendChild(v),g.appendChild(b);const T=[g],I=ComponentFactoryService.createElement({type:r.CART_ITEM_QUANTITY_PRICE,itemId:d});if((null===(l=null===(c=null==h?void 0:h.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:d,context:"cart"});T.push(t)}return T.push(I),T}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const e=t.find(t=>"cart.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,e=this.getStoreValue("cart.items."+t);return e||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const e=t.quantity,n=this.getAvailableQuantity(),i=n>0;return{currentQuantity:e,availableQuantity:n,canIncrease:i,canDecrease:!![]}}getAvailableQuantity(){var t,e;const n=this.getItemStore();if(!n)return 0;const i=n.partNumber,r=n.fulfillmentId,s=this.getStoreValue("cart.items")||{},a=Object.values(s).filter(t=>t.partNumber===i&&t.fulfillmentId===r),c=a.reduce((t,e)=>t+e.quantity,0),l=this.getStoreValue("products."+n.upc)||this.getStoreValue("products."+n.salsifyGrouping);if(!l)return n.maxQuantity-c;const d=(null===(e=null===(t=null==l?void 0:l.sizes)||void 0===t?void 0:t[n.liquidId])||void 0===e?void 0:e.maxQuantityPerOrder)||0;return!d||d<=0?n.maxQuantity-c:d-c}updateButtonStates(t){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!t.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!t.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!t.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!t.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits();t>0&&!e.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),e=this.getItemStore();if(!e)return document.createElement("div");const n=document.createElement("div");return n.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),this.quantitySpan=document.createElement("span"),this.quantitySpan.className="quantity-value",this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-btn-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(t),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantitySpan),n.appendChild(this.qtyIncreaseButton),n}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const e=document.createElement("div");e.className="item-price-container";const n=document.createElement("span");if(n.className="item-price",n.textContent=formatCentToDollarText(t.price),e.appendChild(n),t.quantity>1){const n=document.createElement("span");n.className="item-price-per-unit",n.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",e.appendChild(n)}return e}template(){const t=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer();t.push(e)}const e=this.createPriceContainer();return t.push(e),t}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path);if(e){const{value:t,oldValue:n}=e,i=Boolean(null==n?void 0:n.code),r=Boolean(null==t?void 0:t.code);if(!i&&r)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!r)return this.container.innerHTML="",this.createInputContainer(),void 0;if(r&&this.promoCodePill&&t.discountAmount!==(null==n?void 0:n.discountAmount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",void 0}}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+(null==t?void 0:t.code)),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const e=document.createElement("div");e.classList.add("promo-container"),e.appendChild(this.createPromoInput()),e.appendChild(this.createApplyButton()),t.appendChild(e),this.container.appendChild(t),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("cart.loading"),i=this.getStoreValue("cart.promoCode"),r=this.getStoreValue("cart.events")||[],s=hasCartAnyPromoCodeEvents(r);this.applyButton.disabled=!e||n||Boolean(null==i?void 0:i.discountAmount)||this.isApplying||s}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const K=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(t),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(e){this.logger.error("Cart promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}};return this.applyButton.addEventListener("click",K),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),K())}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==t?void 0:t.code){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+t.code),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),e}const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");return n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:r.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const e=this.container.querySelectorAll("[data-fulfillment-id]");if(e.length>0){const t=e[e.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const e=this.getFulfillmentInsertionPoint();if(e){const n=this.createFulfillmentElement(t);n.setAttribute("data-fulfillment-id",t);const i=this.getFulfillmentContainer();i&&i.remove(),e.nextSibling?e.parent.insertBefore(n,e.nextSibling):e.parent.appendChild(n)}}removeFulfillmentElement(t){const e=this.getFulfillmentElementById(t);if(e){const t=e.parentElement,n=e.nextElementSibling;e.remove();const i=this.container.querySelectorAll("[data-fulfillment-id]");if(0===i.length){const e=document.createElement("div");e.id="retailer-fulfillment-container",n?t.insertBefore(e,n):t.appendChild(e)}}}handleFulfillmentsUpdate(t,e){const n=new Set(t||[]),i=new Set(e||[]);for(const r of n)i.has(r)||this.removeFulfillmentElement(r);for(const r of i)n.has(r)||this.addFulfillmentElement(r)}setupFulfillmentElements(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],n=this.container.querySelectorAll("[data-fulfillment-id]");for(const r of n)r.remove();let i=this.getFulfillmentContainer();if(!i){const t=this.container.querySelector(".retailer-body-container"),e=this.container.querySelector("#retailer-subtotal-container");i=document.createElement("div"),i.id="retailer-fulfillment-container",t&&e&&t.insertBefore(i,e)}for(const r of Object.keys(e))this.addFulfillmentElement(r)}setupSubtotalElement(){const t=this.getRetailerId(),e=this.container.querySelector("#retailer-subtotal-container");if(e){const n=ComponentFactoryService.createElement({type:r.CART_RETAILER_SUBTOTAL,retailerId:t});e.replaceWith(n)}}onStoreChanged(t){const e=this.getRetailerId(),n="cart.retailers."+e,i=t.find(t=>t.path===n);if(i){const t=i.oldValue,e=i.value,n=Object.keys((null==t?void 0:t.fulfillments)||{}),r=Object.keys(e.fulfillments||{});JSON.stringify(n)!==JSON.stringify(r)&&this.handleFulfillmentsUpdate(n,r)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),e=this.container.querySelector(".retailer-section"),n=this.container.querySelector(".section-header-label");if(t&&e&&n){const U=()=>{const e=t.checked;n.setAttribute("aria-label",e?"Expand retailer section":"Collapse retailer section"),n.setAttribute("aria-expanded",e?"false":"true")};t.addEventListener("change",()=>{t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),U()}),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),U()}}template(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t),n=document.createElement("section");n.className="retailer-section";const i=document.createElement("div");i.className="cart-retailer-header";const r=document.createElement("div");r.className="retailer-info";const s=document.createElement("h2");s.className="section-title",s.textContent=e.name,r.appendChild(s);const a=document.createElement("input");a.type="checkbox",a.id=e.id,a.className="section-toggle",r.appendChild(a);const c=document.createElement("label");c.htmlFor=e.id,c.className="section-header-label",c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","Collapse retailer section"),c.setAttribute("aria-expanded","true");const l=document.createElement("span");l.className="chevron",l.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),c.appendChild(l),r.appendChild(c),i.appendChild(r),n.appendChild(i);const d=document.createElement("div");d.className="retailer-body-container";const h=document.createElement("div");h.id="retailer-fulfillment-container",d.appendChild(h);const u=document.createElement("div");return u.id="retailer-subtotal-container",d.appendChild(u),n.appendChild(d),n}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,e){const n=Object.values(t||{}).filter(t=>t.retailerId===e);let i=0;for(const r of n)i+=r.quantity;return i}template(){const t=this.params.retailerId,e=this.getStoreValue("cart.retailers."+t+".subtotal")||0,n=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,i=this.getStoreValue("cart.items"),r=this.getRetailerItemCount(i,t),s=1===r?"item":"items",a=document.createElement("h3");a.className="retailer-subtotal-header",a.textContent="Subtotal ("+r+" "+s+"):";const c=document.createElement("span");return c.className="retailer-subtotal-amount",c.textContent=formatCentToDollarText(e+n),[a,c]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var t,e,n;const i=this.store.get("checkout.presale"),s=this.getConfigs("global"),a=this.clientConfig.get("promoTicker"),c=null!==(e=null===(t=null==s?void 0:s.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],l=null!=a?a:c,d=this.store.get("address"),h=hasActiveItems(l,null===(n=null==d?void 0:d.address)||void 0===n?void 0:n.state),u=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),m=document.createElement("div");m.classList.add("checkout-container"),u&&m.classList.add("no-header"),this.params.isIndependentComponent&&m.classList.add("independent");const f=ComponentFactoryService.createElement({type:r.CHECKOUT_INFORMATION});m.appendChild(f);const g=ComponentFactoryService.createElement({type:r.CHECKOUT_ORDER_SUMMARY});if(m.appendChild(g),!i&&(!l.length||!h)&&u)return[m];const v=document.createElement("div");if(v.classList.add("checkout-header-wrapper"),!u){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_HEADER});v.appendChild(t)}if(l.length&&h&&!i){const t=ComponentFactoryService.createElement({context:"checkout",type:r.PROMO_CODE_TICKER,tickers:l});v.appendChild(t)}if(i){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_PRESALE_COUNTDOWN});v.appendChild(t)}return[v,m]}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,e,n;const i=this.getStoreValue("checkout"),r=Boolean(i.promoCode),s=Boolean(null===(t=i.giftCards)||void 0===t?void 0:t.length),a=this.getConfigs("global"),c=Object.keys(i.onDemandFulfillmentTipInfo||{}).length>0,l=Object.values(i.items||{}),d=[],h=document.createElement("div");h.classList.add("checkout-amount-line");const u=document.createElement("span");u.textContent="Subtotal ("+l.length+" item"+(l.length>1?"s":"")+")",h.appendChild(u);const m=document.createElement("span");m.textContent=formatCentToDollarText(i.amounts.subtotal),h.appendChild(m),d.push(h);const f=document.createElement("div");f.classList.add("checkout-amount-line");const g=document.createElement("span");g.textContent="Shipping",f.appendChild(g);const v=document.createElement("span");v.textContent=formatCentToDollarText(i.amounts.shipping),f.appendChild(v),d.push(f);const y=document.createElement("div");y.classList.add("checkout-amount-line");const b=document.createElement("span");b.textContent="Delivery",y.appendChild(b);const x=document.createElement("span");if(x.textContent=formatCentToDollarText(i.amounts.delivery),y.appendChild(x),d.push(y),(null===(e=null==i?void 0:i.amounts)||void 0===e?void 0:e.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Engraving",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.engraving),t.appendChild(n),d.push(t)}const w=document.createElement("div");w.classList.add("checkout-amount-line");const S=document.createElement("span");S.textContent="Taxes & Fees",w.appendChild(S);const E=document.createElement("span");if(E.textContent=formatCentToDollarText(i.amounts.tax+i.amounts.service+i.amounts.platform),w.appendChild(E),d.push(w),r){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Promo Code ("+(null===(n=i.promoCode)||void 0===n?void 0:n.code.toUpperCase())+")",t.appendChild(e);const r=document.createElement("span");r.textContent="-"+formatCentToDollarText(i.amounts.discounts),t.appendChild(r),d.push(t)}if(s){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Gift Cards Applied",t.appendChild(e);const n=document.createElement("span");n.textContent="-"+formatCentToDollarText(i.amounts.giftCards),t.appendChild(n),d.push(t)}if(c){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Tips",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.tip),t.appendChild(n),d.push(t)}const _=document.createElement("div");_.classList.add("checkout-separator"),d.push(_);const D=document.createElement("div");D.classList.add("checkout-amount-total");const T=document.createElement("span");T.textContent="Total",D.appendChild(T);const I=document.createElement("span");if(I.textContent=formatCentToDollarText(i.amounts.total),D.appendChild(I),d.push(D),i.presale){const t=document.createElement("div");t.classList.add("checkout-amount-due");const e=document.createElement("span");e.textContent="Amount due today",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(0),t.appendChild(n),d.push(t);const i=document.createElement("div");i.classList.add("checkout-presale-locked-message");const r=htmlStringToElement(InfoIcon({color:a.theme.defaultTextColor}));i.appendChild(r);const s=document.createElement("p");s.textContent="Pre-ordered items will be charged when shipped.",i.appendChild(s),d.push(i)}return d}}const yt="lce-checkout-stripe-slot",bt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},xt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},wt={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"),e=document.createElement("div");e.classList.add("checkout-billing-same-as-shipping-toggle-container");const n=document.createElement("div");n.classList.add("checkout-checkbox-container");const i=document.createElement("span");i.id="billingSameAsShipping",i.classList.add("checkout-checkbox-visual"),i.setAttribute("role","checkbox"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label","Billing same as shipping checkbox"),i.setAttribute("aria-checked",t?"true":"false"),t&&i.classList.add("checked"),i.innerHTML=CheckboxIcon({width:16,height:16}),e.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),e.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const r=document.createElement("label");return r.textContent="Billing address same as shipping address",r.setAttribute("for","billingSameAsShipping"),r.classList.add("billing-checkbox-label"),n.appendChild(i),n.appendChild(r),e.appendChild(n),e}updateSaveButtonState(){const t=!Object.values(this.billingData).every(t=>t.isValid),e={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,addressOne:this.billingData.addressOne.value,addressTwo:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zipCode:this.billingData.zipCode.value};this.params.isFormValid(!t,e)}template(){const t=this.getStoreValue("checkout.paymentForm"),e=[],n=this.billingSameAsShippingToggle();if(e.push(n),t.billingSameAsShipping)return e;t.data&&(t.data.firstName&&(this.billingData.firstName={isValid:!![],value:t.data.firstName}),t.data.lastName&&(this.billingData.lastName={isValid:!![],value:t.data.lastName}),t.data.email&&(this.billingData.email={isValid:!![],value:t.data.email}),t.data.phone&&(this.billingData.phone={isValid:!![],value:t.data.phone}),t.data.company&&(this.billingData.company={isValid:!![],value:t.data.company}),t.data.addressOne&&(this.billingData.addressOne={isValid:!![],value:t.data.addressOne}),t.data.addressTwo&&(this.billingData.addressTwo={isValid:!![],value:t.data.addressTwo}),t.data.city&&(this.billingData.city={isValid:!![],value:t.data.city}),t.data.state&&(this.billingData.state={isValid:!![],value:t.data.state}),t.data.zipCode&&(this.billingData.zipCode={isValid:!![],value:t.data.zipCode})),this.updateSaveButtonState();const s=document.createElement("div");s.classList.add("section-title-container");const a=document.createElement("h3");a.textContent="Your billing info",a.classList.add("section-title"),s.appendChild(a);const c=document.createElement("p");c.textContent="Provide the info relevant to your payment method",c.classList.add("section-subtitle"),s.appendChild(c),e.push(s);const l=document.createElement("div");l.classList.add("section-form-container");const d=document.createElement("div");d.classList.add("checkout-two-col-container");const h=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:wt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:wt.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});h.setAttribute("aria-label","First name input"),d.appendChild(h);const u=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:wt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:wt.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});u.setAttribute("aria-label","Last name input"),d.appendChild(u),l.appendChild(d);const m=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:wt.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:wt.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});m.setAttribute("aria-label","Email input"),l.appendChild(m);const f=document.createElement("div");f.classList.add("checkout-two-col-container");const g=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:wt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:wt.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});g.setAttribute("aria-label","Phone input"),f.appendChild(g);const v=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:wt.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:wt.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});v.setAttribute("aria-label","Company input"),f.appendChild(v),l.appendChild(f);const y=document.createElement("div");y.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:wt.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:wt.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});b.setAttribute("aria-label","Street address input"),y.appendChild(b);const x=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:wt.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:wt.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});x.setAttribute("aria-label","Apt, suite, etc. (optional) input"),y.appendChild(x),l.appendChild(y);const w=document.createElement("div");w.classList.add("checkout-three-col-container");const S=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:wt.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:wt.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});S.setAttribute("aria-label","City input"),w.appendChild(S);const E=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:wt.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:wt.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});E.setAttribute("aria-label","State input"),w.appendChild(E);const _=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:wt.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:wt.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return _.setAttribute("aria-label","Zip Code input"),w.appendChild(_),l.appendChild(w),e.push(l),e}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(t){const e=t.find(t=>"checkout.customerForm.isSaving"===t.path);e&&(e.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const t=this.store.get("checkout.customerForm.data");t.firstName&&(this.customerData.firstName={isValid:!![],value:t.firstName}),t.lastName&&(this.customerData.lastName={isValid:!![],value:t.lastName}),t.email&&(this.customerData.email={isValid:!![],value:t.email}),t.phone&&(this.customerData.phone={isValid:!![],value:t.phone}),t.company&&(this.customerData.company={isValid:!![],value:t.company}),t.birthDate&&(this.customerData.birthDate={isValid:!![],value:t.birthDate});const e=[],n=document.createElement("div");n.classList.add("section-title-container");const s=document.createElement("h3");s.textContent="Buyer Information",s.classList.add("section-title"),n.appendChild(s);const a=document.createElement("p");a.textContent="Buyer information is used to process your order and for delivery purposes.",a.classList.add("section-subtitle"),n.appendChild(a),e.push(n);const c=document.createElement("div");c.classList.add("section-form-container");const l=document.createElement("div");l.classList.add("checkout-two-col-container");const d=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:bt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});l.appendChild(d);const h=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:bt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});l.appendChild(h),c.appendChild(l);const u=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:bt.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});c.appendChild(u);const m=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:bt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});c.appendChild(m);const f=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:bt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});c.appendChild(f);const g=ComponentFactoryService.createElement({type:r.BIRTHDATE_INPUT,inputType:"date",name:bt.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:bt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return c.appendChild(g),e.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()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),e.push(this.saveButton),this.updateSaveButtonState(),e}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const t=[],e=this.getStoreValue("checkout.customerForm.data"),n=document.createElement("div");n.classList.add("checkout-summary-form-header");const i=document.createElement("h2");i.textContent="Buyer: "+e.firstName+" "+e.lastName,n.appendChild(i);const r=document.createElement("span");if(r.textContent="Edit",r.setAttribute("aria-label","Edit Buyer Information"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),r.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editCustomerForm())}),n.appendChild(r),t.push(n),e.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=e.company,t.push(n)}const s=document.createElement("p");s.classList.add("checkout-summary-form-line"),s.textContent=e.email,t.push(s);const a=document.createElement("p");a.classList.add("checkout-summary-form-line"),a.textContent=e.phone,t.push(a);const c=document.createElement("p");return c.classList.add("checkout-summary-form-line"),c.textContent=formatISODateToMMDDYYYY(e.birthDate),t.push(c),t}}const Ct=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],kt={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(t,e){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(e)?e:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(e)?e:null:"class"===t?e.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():e.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const e=t.textContent||"",n=e.replace(/<[^>]*>/g,"");if(n.trim()){const t=document.createTextNode(n);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const e=t,n=e.tagName.toLowerCase();if(Ct.includes(n)){const t=document.createElement(n),i=kt[n]||[];for(const n of Array.from(e.attributes)){const e=n.name.toLowerCase();if(i.includes(e)){const i=sanitizeAttributeValue(e,n.value);null!==i&&t.setAttribute(e,i)}}"a"===n&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const n of Array.from(e.childNodes)){const e=cleanNode(n);e&&t.appendChild(e)}return t}const i=document.createDocumentFragment();for(const t of Array.from(e.childNodes)){const e=cleanNode(t);e&&i.appendChild(e)}return i.childNodes.length>0?i:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const e=new DOMParser,n=e.parseFromString(t,"text/html"),i=n.querySelector("parsererror");if(i)return console.warn("HTML parsing error detected"),"";const r=document.createDocumentFragment();for(const t of Array.from(n.body.childNodes)){const e=cleanNode(t);e&&r.appendChild(e)}const s=document.createElement("div");return s.appendChild(r),s.innerHTML}catch(e){return console.error("HTML sanitization error:",e),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,e,n,i,s,a;const c=[],l=this.getConfigs("configurations"),d=this.getConfigs("global"),h=this.getConfigs("checkout"),u=this.config.layout.exitUrl||window.location.host,m=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(e=null===(t=this.config.layout)||void 0===t?void 0:t.checkoutCompleted)||void 0===e?void 0:e.customLogo){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const e=document.createElement("img");e.src=null===(i=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===i?void 0:i.customLogo,e.alt=l.partnerName+" Logo",t.appendChild(e),c.push(t)}const f=document.createElement("div");f.classList.add("checkout-completed-section-container");const g=document.createElement("div");g.classList.add("checkout-completed-title-container");const v=document.createElement("div");v.classList.add("checkout-completed-title-section");const y=document.createElement("h3");y.innerHTML=(null===(a=null===(s=this.config.layout)||void 0===s?void 0:s.checkoutCompleted)||void 0===a?void 0:a.customText)||"Thank You for Your Order!",v.appendChild(y);const b=document.createElement("p");b.textContent="Your payment has been successfully processed.",v.appendChild(b),g.appendChild(v),f.appendChild(g);const x=document.createElement("div");x.classList.add("checkout-completed-sub-section");const w=document.createElement("div");w.classList.add("checkout-completed-line");const S=document.createElement("h3");S.textContent="Order Number",w.appendChild(S);const E=document.createElement("span");E.textContent=this.params.orderNumber,w.appendChild(E),x.appendChild(w);const _=document.createElement("div");_.classList.add("checkout-completed-line");const D=document.createElement("h3");D.textContent="Order Amount",_.appendChild(D);const T=document.createElement("span");T.textContent=""+formatCentToDollarText(this.params.orderTotal),_.appendChild(T),x.appendChild(_);const I=document.createElement("div");I.classList.add("checkout-completed-line");const F=document.createElement("h3");F.textContent="Payment Method",I.appendChild(F);const A=document.createElement("span");A.textContent="** "+this.params.cardLast4,I.appendChild(A),x.appendChild(I),f.appendChild(x);const O=document.createElement("div");O.classList.add("checkout-completed-sub-section");const N=document.createElement("p");N.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(N),f.appendChild(O),c.push(f);const M=document.createElement("div");M.classList.add("checkout-completed-section-container");const L=document.createElement("button");L.type="button";const B=document.createElement("span");B.textContent=m,L.setAttribute("tabindex","0"),L.setAttribute("role","button"),L.setAttribute("aria-label",m),L.appendChild(B);const j=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:d.theme.selectedTextColor}));L.appendChild(j),L.addEventListener("click",()=>{window.location.href=u}),L.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=u)}),M.appendChild(L),c.push(M);const q=document.createElement("div");q.classList.add("checkout-completed-section-container");const H=document.createElement("div");H.classList.add("checkout-completed-help-section"),q.appendChild(H);const W=document.createElement("p");W.textContent="Questions about your order? Contact us at ";const X=document.createElement("a");X.href="mailto:"+l.supportEmail,X.textContent=l.supportEmail,W.appendChild(X),H.appendChild(W);const $=document.createElement("p"),tt=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if($.textContent="Order placed on "+tt,H.appendChild($),c.push(q),h.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const e=document.createElement("div");e.classList.add("checkout-legal-message"),e.innerHTML=sanitizeHTML(h.layout.legalMessage.text);const n=document.createElement("div");n.classList.add("checkout-separator"),c.push(t),c.push(e),c.push(n)}if(d.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});c.push(t)}return c}}class CheckoutDeliverToComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift"],watchOnlyStorePaths:["checkout.customerForm.isSaving","checkout.giftRecipientForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},birthDate:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.giftData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},message:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.saveButtonText="Save Delivery Information"}onStoreWatch(t){const e=t.find(t=>"checkout.customerForm.isSaving"===t.path),n=t.find(t=>"checkout.giftRecipientForm.isSaving"===t.path);(null==e?void 0:e.value)||(null==n?void 0:n.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const t=this.getStoreValue("checkout.isGift")||![];let e;e=t?!(this.giftData.firstName.isValid&&this.giftData.lastName.isValid&&this.giftData.email.isValid&&this.giftData.phone.isValid&&this.giftData.message.isValid&&this.giftData.addressTwo.isValid):!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid),this.saveButton.disabled=e}template(){const t=this.getConfigs("global"),e=this.getStoreValue("checkout.isGift"),n=this.store.get("checkout.giftRecipientForm.data"),s=this.store.get("checkout.customerForm.data"),a=this.store.get("address.formattedAddress"),c=e?n:s,l=this.store.get("checkout.shippingAddressTwo"),d=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}),n.firstName&&(this.giftData.firstName={isValid:!![],value:n.firstName}),n.lastName&&(this.giftData.lastName={isValid:!![],value:n.lastName}),n.email&&(this.giftData.email={isValid:!![],value:n.email}),n.phone&&(this.giftData.phone={isValid:!![],value:n.phone}),n.message&&(this.giftData.message={isValid:!![],value:n.message}),l&&(this.customerData.addressTwo={isValid:!![],value:l},this.giftData.addressTwo={isValid:!![],value:l}),d&&(this.customerData.deliveryInstructions={isValid:!![],value:d},this.giftData.deliveryInstructions={isValid:!![],value:d});const h=Object.keys(this.store.get("checkout.onDemandFulfillmentTipInfo")||{}).length>0,u=[],m=document.createElement("div");m.classList.add("delivery-header-container");const f=document.createElement("div");f.classList.add("delivery-header-content");const g=document.createElement("div");g.classList.add("delivery-title-container");const v=document.createElement("h3");v.textContent="Deliver to",v.classList.add("delivery-title");const y=document.createElement("p");y.textContent="Package recipient must be 21+",y.classList.add("delivery-subtitle"),g.appendChild(v),g.appendChild(y),m.appendChild(g),u.push(m);const b=document.createElement("div");b.classList.add("section-form-container");const x=document.createElement("div");x.classList.add("checkout-two-col-container");const w=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:e?xt.firstName:bt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:c.firstName,onChange:t=>{e?(this.giftData.firstName.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:xt.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.firstName}))},onValidation:t=>{e?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});w.setAttribute("aria-label","First Name Input"),x.appendChild(w);const S=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:e?xt.lastName:bt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:c.lastName,onChange:t=>{e?(this.giftData.lastName.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:xt.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.lastName}))},onValidation:t=>{e?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(S.setAttribute("aria-label","Last Name Input"),x.appendChild(S),b.appendChild(x),!e){const t=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:bt.company,label:"Company (optional)",autocomplete:!![],value:c.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),b.appendChild(t)}const E=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:e?xt.email:bt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:c.email,onChange:t=>{e?(this.giftData.email.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:xt.email})):(this.customerData.email.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.email}))},onValidation:t=>{e?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});E.setAttribute("aria-label","Email Input"),b.appendChild(E);const _=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:e?xt.phone:bt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:c.phone,onChange:t=>{e?(this.giftData.phone.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:xt.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.phone}))},onValidation:t=>{e?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(_.setAttribute("aria-label","Phone Input"),b.appendChild(_),!e){const t=ComponentFactoryService.createElement({type:r.BIRTHDATE_INPUT,inputType:"date",name:bt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:c.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),b.appendChild(t)}const D=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:a,disabled:!![],className:"disabled-input"});D.setAttribute("aria-label","Delivery Address Input"),b.appendChild(D);const T=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:e?xt.addressTwo:bt.addressTwo,label:"Apt, suite, etc. (optional)",value:l,onChange:t=>{e?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:xt.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:bt.addressTwo}))},onValidation:t=>{e?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(T.setAttribute("aria-label","Address Line 2 Input"),b.appendChild(T),e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const r=document.createElement("label");r.textContent="Gift Message*",r.setAttribute("for",xt.message);const s=document.createElement("textarea");s.name=xt.message,s.id=xt.message,s.rows=4,s.value=n.message||"",s.setAttribute("aria-label","Gift Message Textarea"),s.addEventListener("input",async t=>{const e=t.target.value;this.giftData.message.value=e,this.giftData.message.isValid=e.length>0,this.pubSub.publishForm(i.GIFT,{fieldName:xt.message}),this.updateSaveButtonState()});const a=document.createElement("p");a.textContent="Your gift message will be emailed to the recipient along with delivery details.",a.classList.add("textarea-message-disclaimer"),e.appendChild(r),e.appendChild(s),e.appendChild(a),b.appendChild(e)}if(h){const n=document.createElement("div");n.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Delivery Instructions",i.setAttribute("for","delivery_instructions");const r=document.createElement("textarea");r.id="delivery_instructions",r.name="delivery_instructions",r.rows=4,r.setAttribute("aria-label","Delivery Instructions Textarea"),r.value=d,r.addEventListener("input",async t=>{const n=t.target.value;e?(this.giftData.deliveryInstructions.value=n,this.giftData.deliveryInstructions.isValid=n.length>0):(this.customerData.deliveryInstructions.value=n,this.customerData.deliveryInstructions.isValid=n.length>0)});const 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"),n.appendChild(i),n.appendChild(r),n.appendChild(s),b.appendChild(n)}u.push(b),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const G=async()=>{e?await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}):await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:this.customerData.deliveryInstructions.value})};return this.saveButton.addEventListener("click",G),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await G())}),u.push(this.saveButton),this.updateSaveButtonState(),u}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const t=[],e=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm.data"),i=this.getStoreValue("checkout.giftRecipientForm.data"),r=this.getStoreValue("address"),s=this.getStoreValue("checkout.deliveryInstructions"),a=this.getStoreValue("checkout.shippingAddressTwo"),c=document.createElement("div");c.classList.add("checkout-summary-form-header");const l=document.createElement("h2");l.textContent=e?"Delivering to "+i.firstName+" "+i.lastName:"Delivering to "+n.firstName+" "+n.lastName,c.appendChild(l);const d=document.createElement("span");d.textContent="Edit",d.setAttribute("aria-label","Edit Delivery Information"),d.setAttribute("role","button"),d.setAttribute("tabindex","0");const J=async()=>{e?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(d.addEventListener("click",J),d.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await J())}),c.appendChild(d),t.push(c),!e&&n.company){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=n.company,t.push(e)}const h=document.createElement("p");h.classList.add("checkout-summary-form-line"),h.textContent=r.address.one+(a?", "+a:"")+", "+r.address.city+", "+r.address.state+", "+r.address.zip,t.push(h);const u=document.createElement("p");u.classList.add("checkout-summary-form-line"),u.textContent=e?i.email:n.email,t.push(u);const m=document.createElement("p");if(m.classList.add("checkout-summary-form-line"),m.textContent=e?i.phone:n.phone,t.push(m),!e&&n.birthDate){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=formatISODateToMMDDYYYY(n.birthDate),t.push(e)}if(e){const e=document.createElement("div");e.classList.add("checkout-summary-form-line-container");const n=document.createElement("span");n.classList.add("checkout-summary-form-line-container-label"),n.textContent="Gift Message:",e.appendChild(n);const r=document.createElement("span");r.classList.add("checkout-summary-form-line"),r.textContent=i.message||"No message provided.",e.appendChild(r),t.push(e)}if(s){const e=document.createElement("div");e.classList.add("checkout-summary-form-line-container");const n=document.createElement("span");n.classList.add("checkout-summary-form-line-container-label"),n.textContent="Delivery Instructions:",e.appendChild(n);const i=document.createElement("span");i.classList.add("checkout-summary-form-line"),i.textContent=s||"No instructions provided.",e.appendChild(i),t.push(e)}return t}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(t){var e;const n=t.find(t=>"checkout.giftCards"===t.path),i=t.find(t=>"checkout.loading"===t.path);n&&n.value.length>((null===(e=n.oldValue)||void 0===e?void 0:e.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),i&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!e||n||Boolean(i)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.giftCardInput;n.setValue(e),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const K=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(e){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",K),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),K())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const t=[];return t.push(this.createGiftCardInput()),t.push(this.createApplyButton()),t}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.presale"),e=this.getConfigs("checkout");let n=null;if(!t){n=document.createElement("button"),n.classList.add("checkout-header-button"),n.setAttribute("aria-label","Back to Cart"),n.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(r.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),n.appendChild(t)}const i=document.createElement("h1");i.textContent=(null==e?void 0:e.layout.drawerHeaderText)||"Checkout",i.classList.add("checkout-header-title"),i.setAttribute("aria-label","Checkout Page");const 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()}),n?[n,i,s]:[i,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"),e=this.getStoreValue("checkout.customerForm.isEditing"),n=this.getStoreValue("checkout.giftRecipientForm.isEditing"),i=this.getStoreValue("checkout.paymentForm.isEditing");t?(this.buyerForm.style.display=e?"block":"none",this.buyerSummary.style.display=e?"none":"block",this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block"):(this.deliveryToForm.style.display=e?"block":"none",this.deliverToSummary.style.display=e?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=i?"block":"none",this.paymentSummary.style.display=i?"none":"block"}template(){const t=[],e=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm"),i=this.getStoreValue("checkout.giftRecipientForm"),s=this.getStoreValue("checkout.paymentForm"),a=ComponentFactoryService.createElement({type:r.CHECKOUT_SEND_AS_GIFT});return t.push(a),this.deliveryToForm=ComponentFactoryService.createElement({type:r.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=e?i.isEditing?"block":"none":n.isEditing?"block":"none",t.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:r.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=e?i.isEditing?"none":"block":n.isEditing?"none":"block",t.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:r.CHECKOUT_BUYER}),this.buyerForm.style.display=e&&n.isEditing?"block":"none",t.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:r.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=e&&!n.isEditing?"block":"none",t.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:r.CHECKOUT_PAYMENT}),this.paymentForm.style.display=s.isEditing?"block":"none",t.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:r.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 e,n,i,r;const s=t.find(t=>"checkout.items"===t.path);s&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const a=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(a){const t=a.oldValue,s=a.value;if(s.updating)return![];const c=(null==t?void 0:t.quantity)!==(null==s?void 0:s.quantity),l=(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],d=(null===(r=null===(i=null==s?void 0:s.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.lines)||[],h=JSON.stringify(l)!==JSON.stringify(d);(c||h)&&this.updateEngravingElement(s)}return![]}updateEngravingElement(t){var e,n;const i=this.getConfigs("global"),s=this.container.querySelector(".engraving-view-container");if(s&&s.remove(),(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]&&i.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),n=this.container.querySelector(".checkout-item-card-footer");n&&n.before(e)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const e=t.fulfillmentId;if(!e)return;if(!this.container)return;const n=this.container.querySelector(".checkout-item-card-header");if(n){const t=this.getStoreValue("cart.fulfillments."+e),i=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(i&&i.remove(),t.hasUnmetMinimumPurchaseAmount){const e=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(t.minimumPurchaseAmount-t.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:t.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","checkout-retailer-alert"),n.before(e)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),e=Object.keys(t.items).length,n=1===e;this.trashButton.disabled=n,n?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","item-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="item-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const t=this.getStoreValue("checkout.items."+this.params.itemId);return t?t.updating===!![]:![]}checkAndUpdateLoadingState(){const t=this.isItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,e,n;const i=this.getConfigs("global"),s=this.getStoreValue("checkout.items."+this.params.itemId),a=null===(t=null==s?void 0:s.attributes)||void 0===t?void 0:t.presale,c=(null==a?void 0:a.isActive)&&(null==a?void 0:a.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(a.estimatedShipBy):"";if(!s)return[];const l=document.createElement("div");l.classList.add("checkout-item-card-header");const d=document.createElement("div");d.classList.add("checkout-item-image");const h=document.createElement("img");h.src=s.mainImage,h.alt=s.name,h.loading="lazy",d.appendChild(h),l.appendChild(d);const u=document.createElement("div");u.classList.add("checkout-item-details-container");const m=document.createElement("h4");m.classList.add("checkout-item-title"),m.textContent=s.name,u.appendChild(m);const f=document.createElement("div");f.classList.add("checkout-item-subtitle");const g=document.createElement("span");g.textContent=a.isActive?""+c:((null==s?void 0:s.expectationDetail)||"")+",",f.appendChild(g);const v=document.createElement("span");v.textContent="From "+((null==s?void 0:s.retailerName)||""),f.appendChild(v),u.appendChild(f),l.appendChild(u),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var e;if(t.preventDefault(),t.stopPropagation(),!(null===(e=this.trashButton)||void 0===e?void 0:e.disabled))try{await this.commands.checkout.removeItem(s.cartItemId)}catch(n){this.logger.error("Checkout item removal failed",n)}}),l.appendChild(this.trashButton);const y=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM_QUANTITY,itemId:s.cartItemId}),b=[];if(b.push(l),i.layout.enablePersonalization&&(null===(n=null===(e=null==s?void 0:s.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:s.cartItemId,context:"checkout"});b.push(t)}return b.push(y),b}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(t){const e=t.find(t=>"checkout.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,e,n;const i=this.getStoreValue("checkout.items."+this.params.itemId);if(!i)return 0;const r=this.getStoreValue("products");if(!r)return 0;const s=i.partNumber,a=i.fulfillmentId,c=null===(n=null===(e=null===(t=Object.values(r).find(t=>t.sizes[i.liquidId]))||void 0===t?void 0:t.sizes)||void 0===e?void 0:e[i.liquidId])||void 0===n?void 0:n.maxQuantityPerOrder;if(!c)return 0;const l=this.getStoreValue("checkout.items")||{},d=Object.values(l).filter(t=>t.partNumber===s&&t.fulfillmentId===a),h=d.reduce((t,e)=>t+e.quantity,0);return c-h}calculateQuantityLimits(){var t;const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const n=this.getStoreValue("checkout"),i=1===(null===(t=Object.values(n.items))||void 0===t?void 0:t.length),r=e.quantity,s=this.getAvailableQuantity(),a=s>0,c=!(i&&1===r);return{currentQuantity:r,availableQuantity:s,isTheOnlyItem:i,canIncrease:a,canDecrease:c}}updateButtonStates(t){this.decreaseButton&&(this.decreaseButton.disabled=!t.canDecrease,this.decreaseButton.classList.toggle("disabled",!t.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!t.canIncrease,this.increaseButton.classList.toggle("disabled",!t.canIncrease),t.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits(),n=this.params.itemId;if((!(t<0)||e.canDecrease)&&(!(t>0)||e.canIncrease)){if(!n)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:t}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(n,t)}catch(i){this.logger.error("Checkout item quantity change operation failed",i)}}}template(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const e=this.calculateQuantityLimits(),n=document.createElement("div");n.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),n.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),n.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),n.appendChild(this.increaseButton),this.updateButtonStates(e);const i=document.createElement("span");if(i.classList.add("checkout-item-price-text"),i.textContent=formatCentToDollarText(t.price),t.quantity>1){const e=document.createElement("span");e.classList.add("checkout-item-price-each-text"),e.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",i.appendChild(e)}return[n,i]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(t){return ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM,itemId:t})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},e=new Map;for(const n of Object.values(t))n&&n.cartItemId&&e.set(n.cartItemId,n);return e}syncItemsWithStore(){const t=this.getItemsListContainer();if(!t)return;const e=this.getCurrentItemsMap(),n=t.querySelectorAll("[data-item-id]"),i=new Set;for(const r of n){const t=r.getAttribute("data-item-id");t&&i.add(t)}for(const r of n){const t=r.getAttribute("data-item-id");t&&!e.has(t)&&r.remove()}for(const[r]of e)if(!i.has(r)){const e=this.createItemElement(r);e.setAttribute("data-item-id",r),t.appendChild(e)}this.updateItemCount()}updateItemCount(){const t=this.getTogglerLabel();if(!t)return;const e=this.getCurrentItemsMap(),n=e.size;t.textContent=n+" item"+(1!==n?"s":"")}onStoreChanged(t){let e;for(let n=0;n<t.length;n++){const i=t[n];if("checkout"===i.path||"checkout.items"===i.path||"checkout.items."===i.path.substring(0,15)){e=i;break}}return e?(this.syncItemsWithStore(),![]):![]}handleToggle(){const t=this.container.querySelector(".checkout-items-toggler-button"),e=this.container.querySelector(".checkout-items-list");if(t&&e){const n=e.classList.contains("show");e.classList.toggle("show"),t.classList.toggle("expanded"),n?(t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label","Expand checkout items")):(t.setAttribute("aria-expanded","true"),t.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const t=this.container.querySelector(".checkout-items-toggler"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");if(t&&e&&n){const i=n.classList.contains("show");e.setAttribute("tabindex","0"),e.setAttribute("aria-expanded",i?"true":"false"),e.setAttribute("aria-label",i?"Collapse checkout items":"Expand checkout items"),t.addEventListener("click",()=>this.handleToggle()),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.items"),e=Object.values(t||{}),n=document.createElement("div");n.classList.add("checkout-items-toggler");const i=document.createElement("span");i.classList.add("checkout-items-toggler-label"),i.textContent=e.length+" item"+(1!==e.length?"s":""),n.appendChild(i);const r=document.createElement("button");r.type="button",r.classList.add("checkout-items-toggler-button"),r.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(r);const s=document.createElement("div");s.classList.add("checkout-items-list","show");for(const a of e){const t=this.createItemElement(a.cartItemId);t.setAttribute("data-item-id",a.cartItemId),s.appendChild(t)}return[n,s]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const e=t.find(t=>"checkout.amounts"===t.path);if(e){const t=this.getStoreValue("checkout"),e=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&e>0)}}updateZeroAmountElement(t){const e=this.container.querySelector(".checkout-zero-amount-container");if(t&&!e){const t=document.createElement("div");t.classList.add("checkout-zero-amount-container"),t.textContent="Credit card required to complete order (even when fully covered by gift card)";const e=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");e&&e.after(t)}else!t&&e&&e.remove()}afterRender(){const t=this.getStoreValue("checkout.amounts");t&&this.updateZeroAmountElement(0===t.total)}handleEmailToggle(t){this.commands.checkout.toggleMarketingPreferences("canEmail"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,e=this.config.layout.smsOptIn;if(!t.show&&!e.show)return null;const n=document.createElement("div");if(n.classList.add("checkout-marketing-opt-ins-container"),t.show){const e=document.createElement("div");let i;e.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const r=document.createElement("span");r.id="emailOptIn",r.classList.add("checkout-checkbox-visual"),i&&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",i?"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 e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canEmail"),r.classList.toggle("checked"))}),e.appendChild(r),e.appendChild(s),n.appendChild(e)}if(e.show){const t=document.createElement("div");let i;t.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canSms");const r=document.createElement("span");r.classList.add("checkout-checkbox-visual"),r.id="smsOptIn",i&&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",i?"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(e.text),s.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canSms"),r.classList.toggle("checked"))}),t.appendChild(r),t.appendChild(s),n.appendChild(t)}return n}hasOnDemandOrder(){const t=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}template(){var t;const e=[],n=this.getConfigs("global"),i=this.getConfigs("checkout"),s=this.getConfigs("global"),a=i.layout.allowGiftCards,c=null===(t=null==s?void 0:s.layout)||void 0===t?void 0:t.allowPromoCodes,l=document.createElement("div");l.classList.add("section-title-container");const d=document.createElement("h3");d.textContent="Order Summary",d.classList.add("section-title"),l.appendChild(d),e.push(l);const h=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEMS});e.push(h);const u=document.createElement("div");u.classList.add("checkout-separator");const m=document.createElement("div");if(m.classList.add("checkout-separator"),e.push(u),a||c){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_PC_GC});e.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_TIPS});e.push(t),e.push(m)}const f=document.createElement("div");f.classList.add("section-title-container");const g=document.createElement("h3");g.textContent="100% Secure Payments",g.classList.add("disclaimer-header"),f.appendChild(g);const v=document.createElement("p");v.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",v.classList.add("disclaimer-description"),f.appendChild(v),e.push(f);const y=ComponentFactoryService.createElement({type:r.CHECKOUT_AMOUNTS});e.push(y);const b=ComponentFactoryService.createElement({type:r.CHECKOUT_PLACE_ORDER_BUTTON});e.push(b);const x=this.marketingOptInsContainer();if(x&&e.push(x),i.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(i.layout.legalMessage.text),e.push(t),e.push(n)}const w=document.createElement("div");if(w.classList.add("checkout-separator"),e.push(w),n.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});e.push(t)}return e}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.hardcodedPaymentElement=null,this.billingFormData=null,this.isValidBillingForm=![],this.isBillingSameAsShipping=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.savedCardInfo=null,this.showingStripeSummary=![],this.isSavingPayment=![]}onStoreWatch(t){for(const e of t)switch(e.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=e.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(e.value)}}handleBillingSameAsShippingChange(t){this.isBillingSameAsShipping=t,t&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var t;this.isBillingSameAsShipping=null!==(t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==t?t:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let t=!![],e="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)e="Saving...",t=!![];else if(this.stripeFormStatus.hasError)e="Fix Errors and Retry",t=![];else if(this.showingStripeSummary&&this.savedCardInfo){const e=this.isBillingSameAsShipping||this.isValidBillingForm;t=!e}else{const e=this.stripeFormStatus.isFormComplete,n=this.isBillingSameAsShipping||this.isValidBillingForm;t=!(e&&n)}this.saveButton.disabled=t,this.saveButton.textContent=e,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let t="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?t=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(t="Please complete the billing address form"),t?(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(t){this.errorMessageElement&&(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===t&&(this.errorMessageElement.style.display="none")},5e3))}template(){const t=[],e=document.createElement("div");e.classList.add("section-title-container");const n=document.createElement("h3");n.textContent="Payment",n.classList.add("section-title"),e.appendChild(n);const i=document.createElement("p");if(i.textContent="All transactions are secure and encrypted.",i.classList.add("section-subtitle"),e.appendChild(i),t.push(e),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const e=document.createElement("p");e.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(e),t.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:r.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:t=>{this.stripeFormStatus=t,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:t=>{this.savedCardInfo=t},onEditModeVisibilityChanged:t=>{this.showingStripeSummary=t,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(t,e)=>{const n={paymentSession:{confirmationTokenId:t,setupIntentId:e}};!this.isBillingSameAsShipping&&this.billingFormData&&(n.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(n)}}}),t.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),t.push(this.errorMessageElement);const s=ComponentFactoryService.createElement({type:r.CHECKOUT_BILLING,isFormValid:(t,e)=>{this.billingFormData=e,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return t.push(s),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleSaveButtonClick())}),t.push(this.saveButton),t}async handleSaveButtonClick(){var t;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(e){this.logger.error("Failed to save payment form in edit mode",e),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(n){this.logger.error("Failed to save payment form in beta mode",n),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(t=this.stripeHandlerElement)||void 0===t||t.submitStripeForm())}validatePrerequisites(){return this.isBillingSameAsShipping||this.isValidBillingForm?this.stripeFormStatus.isFormComplete?!![]:(this.showError("Please complete all required payment fields."),![]):(this.showError("Please complete the billing address form before saving."),![])}disconnected(){var t;this.isSavingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var t,e,n,i,r,s,a,c,l,d;const h=[],u=this.getStoreValue("checkout.paymentForm"),m=document.createElement("div");m.classList.add("checkout-summary-form-header");const f=document.createElement("h2");f.textContent="Paying with "+capitalizeFirstLetter(null!==(n=null===(e=null===(t=u.paymentMethod)||void 0===t?void 0:t.card)||void 0===e?void 0:e.brand)&&void 0!==n?n:"")+" "+(null===(r=null===(i=u.paymentMethod)||void 0===i?void 0:i.card)||void 0===r?void 0:r.last4),m.appendChild(f);const g=document.createElement("span");g.textContent="Edit",g.setAttribute("aria-label","Edit Payment Information"),g.setAttribute("role","button"),g.setAttribute("tabindex","0"),g.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),g.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editPaymentForm())}),m.appendChild(g),h.push(m);const v=document.createElement("p");return v.classList.add("checkout-summary-form-line"),v.textContent="Exp. "+(null===(a=null===(s=u.paymentMethod)||void 0===s?void 0:s.card)||void 0===a?void 0:a.expMonth)+"/"+(null===(d=null===(l=null===(c=u.paymentMethod)||void 0===c?void 0:c.card)||void 0===l?void 0:l.expYear)||void 0===d?void 0:d.slice(-2)),h.push(v),h}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.error","checkout.customerForm.isValid","checkout.giftRecipientForm.isValid","checkout.paymentForm.isValid"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreWatch(t){const e=t.some(t=>"checkout.loading"===t.path||"checkout.error"===t.path||"checkout.customerForm.isValid"===t.path||"checkout.giftRecipientForm.isValid"===t.path||"checkout.paymentForm.isValid"===t.path);e&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.loading")||![],e=this.store.get("checkout.error")||null;this.updateErrorDisplay(e);const n=this.determineButtonState({isCheckoutLoading:t,hasCheckoutError:!!e});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(n.state),this.placeOrderButton.disabled=n.disabled,this.placeOrderButton.textContent=n.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const e=this.errorContainer.querySelector(".error-text");e&&(this.clearErrorTimeout(),t?(e.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(e.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:t,hasCheckoutError:e}){const n=this.config.layout.placeOrderButtonText,i=this.store.get("checkout.presale");let r=![];if(!i){const t=this.getStoreValue("cart.fulfillments")||{};r=Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}const s=this.store.get("checkout.isGift"),a=this.store.get("checkout.customerForm.isValid"),c=this.store.get("checkout.giftRecipientForm.isValid"),l=this.store.get("checkout.paymentForm.isValid");return r||s&&!c||!a||!l?{state:"disabled",text:n,disabled:!![]}:t?{state:"processing",text:"Placing Order...",disabled:!![]}:e?{state:"disabled",text:n,disabled:!![]}:{state:"ready",text:n,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const t=this.store.get("checkout.loading");if(t)return;await this.commands.checkout.checkoutComplete()}catch(t){this.logger.error("Error handling place order click",t)}}template(){const t=document.createElement("button");t.type="button",t.textContent=this.config.layout.placeOrderButtonText,t.classList.add("checkout-place-order-button"),t.disabled=!![],t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label","Place Order"),t.addEventListener("click",this.handlePlaceOrderClick.bind(this)),t.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handlePlaceOrderClick())});const e=document.createElement("div");e.classList.add("checkout-error-wrapper"),e.setAttribute("role","alert"),e.style.display="none";const n=document.createElement("div");n.classList.add("checkout-error");const i=document.createElement("span");i.classList.add("icon-error"),i.innerHTML=ErrorInfoIcon({});const s=document.createElement("span");s.classList.add("error-text"),n.appendChild(i),n.appendChild(s),e.appendChild(n);const a=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,a,t]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var e;const n=t.find(t=>"checkout.presale"===t.path);if(null==n?void 0:n.value)return this.updateExpiresAt(n.value.expiresAt),!![];const i=t.find(t=>"ui.drawer"===t.path);return(null===(e=null==i?void 0:i.value)||void 0===e?void 0:e.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const t=this.store.get("checkout.presale");(null==t?void 0:t.expiresAt)&&this.updateExpiresAt(t.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var t,e;const n=[".drawer-content"];for(const r of n){const e=null===(t=this.rootElement)||void 0===t?void 0:t.closest(r);if(e&&this.isScrollable(e))return e}let i=null===(e=this.rootElement)||void 0===e?void 0:e.parentElement;for(;i&&i!==document.body;){if(this.isScrollable(i))return i;i=i.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var t,e;if(!this.scrollContainer)return;const n=this.scrollContainer.scrollTop,i=70,r=10;!this.isCurrentlyScrolled&&n>i?(this.isCurrentlyScrolled=!![],null===(t=this.rootElement)||void 0===t||t.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&n<r&&(this.isCurrentlyScrolled=![],null===(e=this.rootElement)||void 0===e||e.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(t){const e=window.getComputedStyle(t),n=e.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===n||"scroll"===n||"overlay"===n)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(t){this.stopCountdown();try{if(this.expiresAt=new Date(t),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:t}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const e=new Date,n=Math.floor((this.expiresAt.getTime()-e.getTime())/1e3);n<this.totalDuration&&(this.totalDuration=Math.max(n,240)),this.startCountdown()}catch(e){this.logger.error("Failed to parse presale expiration date",e),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const t=new Date,e=Math.max(0,this.expiresAt.getTime()-t.getTime()),n=e/1e3,i=this.totalDuration-n,r=Math.max(0,Math.min(100,i/this.totalDuration*100)),s=n<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 a=this.rootElement.querySelector("[data-timer]");a&&(a.textContent=this.formatTime(e));const c=this.rootElement.querySelector("[data-progress-fill]");c&&(c.style.width=r+"%"),0===e&&this.handleExpire()}formatTime(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),i=e%60,r=Math.floor(t%1e3/10);return n.toString().padStart(2,"0")+":"+i.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 e=document.createElement("div");e.classList.add("checkout-presale-text-container");const n=document.createElement("div");n.classList.add("checkout-presale-heading");const i=document.createElement("h2");i.textContent="LIMITED PRE-ORDER:";const r=document.createElement("div");r.classList.add("checkout-presale-timer"),r.setAttribute("data-timer",""),r.textContent="00:00:00",n.appendChild(i),n.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"),e.appendChild(n),e.appendChild(s);const a=document.createElement("div");a.className="checkout-presale-progress-bar",a.setAttribute("data-progress","");const c=document.createElement("div");return c.className="checkout-presale-progress-fill",c.setAttribute("data-progress-fill",""),c.style.width="0%",a.appendChild(c),t.appendChild(e),t.appendChild(a),t}}class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const t=[],e=this.getConfigs("global"),n=document.createElement("div");n.classList.add("checkout-completed-section-container");const i=document.createElement("div");i.classList.add("checkout-completed-title-section");const s=document.createElement("div");s.classList.add("checkout-completed-title-section");const a=document.createElement("p");a.classList.add("presale-expired-title"),a.textContent="Session Expired",s.appendChild(a);const c=document.createElement("p");c.textContent="Your reservation time has ended. The item has been released for other customers.",s.appendChild(c),i.appendChild(s),n.appendChild(i);const l=document.createElement("div");l.classList.add("checkout-completed-help-section"),l.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available.",n.appendChild(l),t.push(n);const d=document.createElement("div");d.classList.add("checkout-completed-section-container");const h=document.createElement("button");h.setAttribute("aria-label","Continue shopping"),h.type="button";const u=document.createElement("span");u.textContent="Continue Shopping",h.setAttribute("tabindex","0"),h.setAttribute("role","button"),h.setAttribute("aria-label","Continue Shopping"),h.appendChild(u);const m=htmlStringToElement(ArrowRightIcon({width:16,height:16}));h.appendChild(m),h.addEventListener("click",()=>this.handleExit()),h.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),d.appendChild(h),t.push(d);const f=document.createElement("div");f.classList.add("checkout-completed-section-container");const g=document.createElement("p");g.classList.add("checkout-completed-auto-close-text"),g.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const v=document.createElement("span");if(v.classList.add("checkout-completed-auto-close-text"),v.textContent="seconds",f.appendChild(g),f.appendChild(this.autoCloseElement),f.appendChild(v),t.push(f),e.layout.showPoweredBy){const e=document.createElement("div");e.classList.add("checkout-completed-powered-by-container");const n=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});e.appendChild(n),t.push(e)}return t}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(t){const e=t.find(t=>"checkout.promoCode"===t.path),n=t.find(t=>"checkout.loading"===t.path);if(e){const{value:t,oldValue:n}=e,i=Boolean(n),r=Boolean(t);if(!i&&r)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!r)return this.container.innerHTML="",this.createInputContainer(),void 0;r&&this.promoCodeText&&t.discountAmount!==(null==n?void 0:n.discountAmount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")")}n&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.promoCode"),r=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!e||n||Boolean(i)||Boolean(r)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const K=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(e){this.logger.error("Checkout promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",K),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),K())}),this.applyButton}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const t=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),e}const e=[];return e.push(this.createPromoInput()),e.push(this.createApplyButton()),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const t=this.getStoreValue("checkout.isGift"),e=document.createElement("div");e.classList.add("gift-label-wrapper");const n=document.createElement("span");n.textContent="Send as Gift? (Free)",n.classList.add("gift-toggle-label"),e.appendChild(n);const i=document.createElement("span");i.textContent="With personalized note & gift receipt.",i.classList.add("gift-toggle-description"),e.appendChild(i);const 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())}),[e,r]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this.O=null,this.N=null,this.M=null,this.R=![],this.L=![],this.B=![],this.j=null}async initialize({data:t}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.O=window.Stripe(t.publishableKey),this.N=this.O.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.M=this.N.create("payment",t.elementOptions),this.M.mount(this),this.M.on("change",async t=>{const e=!!t.error,n=t.complete,i=e?t.error.message:null;this.L=n,this.R||await this.updateStripeFormStatus({isFormComplete:n,isProcessing:![],hasCompletedPayment:![],errorMessage:i,hasError:e})}),this.M.on("focus",async()=>{this.R||await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.B=![]}catch(t){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(t){const{stripeConfig:e}=t.detail;e&&(this.q=e,await this.refreshPaymentSession())}async handleSubmit(){var t,e;if(this.R)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.R=!![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.B&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const t=await this.createConfirmationTokenId(),e=this.q.clientSecret,n=e.split("_secret_")[0];this.B=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:t,setupIntentId:n},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(n){console.error("Payment submission error:",n),this.B=!![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==n?void 0:n.message)||"Payment processing failed. Please try again."}),((null===(t=null==n?void 0:n.message)||void 0===t?void 0:t.includes("expired"))||(null===(e=null==n?void 0:n.message)||void 0===e?void 0:e.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.R=![]}}async requestSessionRefresh(){return this.j||(this.j=new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",C),this.j=null,e(new Error("Session refresh timeout"))},1e4),C=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",C),this.j=null,t()};this.addEventListener("lce:s:refreshSession",C,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.j}async refreshPaymentSession(){try{this.N&&this.N.update({clientSecret:this.q.clientSecret}),this.B=![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(et){console.error("Failed to refresh payment session:",et),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.M&&this.M.clear(),this.L=![],this.B=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(et){console.error("Failed to reset form:",et)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.N)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.N.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const e={elements:this.N,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:n,confirmationToken:i}=await this.O.createConfirmationToken(e);if(n)throw new SDKError(n.message||"Failed to create confirmation token");if(!i||!i.id)throw new SDKError("Invalid confirmation token received");return i.id}catch(t){if(t instanceof SDKError)throw t;throw new SDKError("Payment processing error: "+(t.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,e;try{this.j=null,this.M&&(this.M.unmount(),this.M=null),this.N&&(null===(e=(t=this.N).destroy)||void 0===e?void 0:e.call(t),this.N=null),this.O=null,this.R=![],this.L=![],this.B=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(n){console.warn("Error during Stripe form cleanup:",n)}}loadStripeJS(){return new Promise((t,e)=>{const n=document.querySelector('script[src*="stripe.com"]');if(n)return n.addEventListener("load",()=>t()),n.addEventListener("error",()=>e(new Error("Failed to load Stripe.js"))),void 0;const i=document.createElement("script");i.src="https://js.stripe.com/basil/stripe.js",i.async=!![],i.onload=()=>t(),i.onerror=()=>e(new Error("Failed to load Stripe.js")),document.head.appendChild(i)})}}class CheckoutStripeHandlerComponent extends BaseComponent{get hostClasses(){return["checkout-stripe-handler"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.paymentMethod","checkout.paymentForm.isEditing"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.isInEditMode=![],this.savedCardInfo=null,this.isChangingPayment=![],this.callbacks={}}beforeConnected(){this.callbacks=this.params.callbacks||{}}onStoreWatch(t){for(const e of t)switch(e.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(e.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(e.value)}}handleSavedCardChange(t){var e,n,i,r;(null===(e=null==t?void 0:t.card)||void 0===e?void 0:e.brand)&&(null===(n=null==t?void 0:t.card)||void 0===n?void 0:n.last4)?this.savedCardInfo={brand:t.card.brand,last4:t.card.last4}:this.savedCardInfo=null,null===(r=(i=this.callbacks).onSavedCardInfoChanged)||void 0===r||r.call(i,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(t){this.isInEditMode=t,this.updateDisplayState()}updateDisplayState(){var t,e,n,i,r,s;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(e=(t=this.callbacks).onEditModeVisibilityChanged)||void 0===e||e.call(t,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(i=(n=this.callbacks).onEditModeVisibilityChanged)||void 0===i||i.call(n,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(t=>{this.logger.error("Failed to create stripe form in updateDisplayState",t)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(s=(r=this.callbacks).onEditModeVisibilityChanged)||void 0===s||s.call(r,![]))}async afterRender(){var t,e,n,i;this.isInEditMode=null!==(t=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==t?t:![];const r=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(e=null==r?void 0:r.card)||void 0===e?void 0:e.brand)&&r.card.last4&&(this.savedCardInfo={brand:r.card.brand,last4:r.card.last4}),null===(i=(n=this.callbacks).onSavedCardInfoChanged)||void 0===i||i.call(n,this.savedCardInfo),this.updateDisplayState(),(this.isInEditMode&&!this.savedCardInfo||this.isChangingPayment)&&await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",t=>{var e,n;this.stripeFormStatus=t.detail.status,null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async t=>{var e,n,i,r,s;try{const{confirmationTokenId:i,setupIntentId:r}=t.detail;await(null===(n=(e=this.callbacks).onPaymentSessionConfirmed)||void 0===n?void 0:n.call(e,i,r)),this.isChangingPayment=![]}catch(a){this.logger.error("Failed to save payment form",a),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==a?void 0:a.message)||"Failed to save payment information. Please try again."},null===(r=(i=this.callbacks).onStripeFormStatusChanged)||void 0===r||r.call(i,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 e=await this.doStripeConfig();null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:e}}))}catch(e){this.logger.error("Failed to refresh payment session",e)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const t=document.createElement("span");t.classList.add("stripe-summary-text"),t.textContent=capitalizeFirstLetter(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const e=document.createElement("button");e.type="button",e.classList.add("change-payment-link"),e.textContent="Change",e.setAttribute("aria-label","Change Payment Method"),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.addEventListener("click",()=>this.handleChangePayment()),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(t,e),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var t,e;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(e=(t=this.callbacks).onStripeFormStatusChanged)||void 0===e||e.call(t,this.stripeFormStatus),this.updateDisplayState()}template(){const t=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",t.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const e=document.createElement("slot");return e.setAttribute("name",yt),this.stripeFormContainer.appendChild(e),t.push(this.stripeFormContainer),t}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,e=null;for(;t&&t!==document.body;){const n=t.hasAttribute("checkout"),i=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT),s=t.hasAttribute("drawer"),a=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(r.DRAWER),c="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||i&&s&&a&&c)return this.rootComponent=t,t;e=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){const t=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==t?void 0:t.key)&&(null==t?void 0:t.secret)||await this.commands.checkout.getPaymentSession();const e=this.store.get("checkout.paymentForm.paymentSession"),n=this.getConfigs("global");return{publishableKey:e.key,clientSecret:e.secret,appearance:{theme:"stripe",variables:{fontFamily:n.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:n.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===n.layout.inputFieldStyle?"none":"1px solid "+n.theme.accentColor,backgroundColor:"filled"===n.layout.inputFieldStyle?n.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t,e,n;if(this.isCreatingStripeForm)return this.logger.info("Stripe form creation already in progress, skipping"),void 0;if(this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment)return this.logger.info("In edit mode with saved card, skipping stripe form creation"),void 0;const i=this.findRootComponent();if(!i)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const s=i.querySelectorAll('[slot="'+yt+'"]');if(s.length>0)for(const r of s)r.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:r.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",yt),i.appendChild(this.stripeFormElement)}catch(a){this.logger.error("Stripe form element creation failed",a),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(t){const e=this.getStoreValue("checkout.updating")||![];if(!e)try{await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Checkout tips update failed",n)}}async handleFulfillmentTipInput(t,e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const i=this.getOnDemandFulfillmentTipInfo();if(!i[t])return;const r=Math.round(100*e);try{await this.commands.checkout.updateFulfillmentTip(t,r)}catch(s){this.logger.error("Checkout fulfillment tip update failed",s)}}async removeTipFromFulfillment(t){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const n=this.getOnDemandFulfillmentTipInfo();if(n[t])try{await this.commands.checkout.removeFulfillmentTip(t)}catch(i){this.logger.error("Checkout fulfillment tip removal failed",i)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const e=[10,18,20],n=this.getStoreValue("checkout.updating")||![],i=this.getTipSelection();for(const r of e){const e=document.createElement("button");e.type="button",e.textContent=r+"%",e.classList.add("checkout-tip-button"),e.disabled=n,i===r&&e.classList.add("selected"),e.addEventListener("click",()=>this.handlePercentageSelect(r)),t.appendChild(e)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".retailers-tips-list");t&&e&&n&&t.addEventListener("click",()=>{const t=n.classList.contains("show");n.classList.toggle("show"),t?(e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand tips section")):(e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse tips section")),e.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;const n=document.createElement("div");n.classList.add("checkout-tip-distribution-header");const i=document.createElement("h3");i.textContent="View Tip Distribution",i.classList.add("checkout-sub-header"),n.appendChild(i);const r=document.createElement("button");r.type="button",r.classList.add("checkout-items-toggler-button"),r.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(r),t.appendChild(n);const s=document.createElement("div");s.classList.add("retailers-tips-list","show");for(const a of e){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const e=document.createElement("h4");e.textContent=a.retailerName,e.classList.add("checkout-sub-header"),t.appendChild(e);const n=document.createElement("div");n.classList.add("checkout-tip-fulfillment-input-wrapper");const i=document.createElement("div");i.classList.add("dollar-input-container");const r=document.createElement("span");r.classList.add("dollar-sign"),r.textContent="$";const c=document.createElement("input");let l;c.type="number",c.id="tip-input-"+a.fulfillmentId,c.name="tip-"+a.fulfillmentId,c.min="0",c.step="0.01",c.placeholder="0.00",c.classList.add("dollar-input"),c.value=a.tip>0?(a.tip/100).toFixed(2):"",c.disabled=this.getStoreValue("checkout.updating")||![],c.addEventListener("wheel",t=>{t.preventDefault()}),c.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),c.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),c.addEventListener("paste",t=>{t.preventDefault()}),c.addEventListener("contextmenu",t=>{t.preventDefault()}),c.addEventListener("input",t=>{const e=t.target;let n=e.value;if(Number.parseFloat(n)<0&&(e.value=Math.abs(Number.parseFloat(n)).toString(),n=e.value),n.includes(".")){const t=n.split(".");t.length>1&&t[1].length>2&&(e.value=t[0]+"."+t[1].substring(0,2))}}),c.addEventListener("input",t=>{const e=t.target,n=Number.parseFloat(e.value)||0;l&&clearTimeout(l),l=setTimeout(()=>{this.handleFulfillmentTipInput(a.fulfillmentId,n)},500)}),i.appendChild(r),i.appendChild(c),n.appendChild(i);const d=document.createElement("button");d.type="button",d.textContent="Remove",d.classList.add("checkout-tip-remove-button"),d.disabled=this.getStoreValue("checkout.updating")||![],d.addEventListener("click",()=>this.removeTipFromFulfillment(a.fulfillmentId)),n.appendChild(d),t.appendChild(n),s.appendChild(t)}return t.appendChild(s),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),e=this.getFulfillmentTipInfoArray();if(t&&e.length>0){const t=e.some(t=>t.tip>0);if(t)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(n){this.logger.error("Default tip initialization failed",n),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(i){this.logger.error("Default tip initialization failed during fallback",i),this.isInitialized=![]}}template(){const t=[],e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;e.length>0&&this.initializeDefaultTip();const n=document.createElement("section");n.classList.add("checkout-tip-container");const i=document.createElement("h3");i.classList.add("checkout-sub-header"),i.textContent="Add a tip",n.appendChild(i);const r=document.createElement("div");r.classList.add("checkout-tip-config-container");const s=this.createTipSelectionButtons();r.appendChild(s),n.appendChild(r);const a=document.createElement("p");a.classList.add("checkout-tip-disclaimer"),a.textContent="Tips will be split proportionally between retailers.",n.appendChild(a);const c=this.createTipDistribution();return t.push(n,c),t}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(t){var e,n;const i=t.find(t=>"checkout.giftCardError"===t.path),r=t.find(t=>"checkout.promoCodeError"===t.path),s=t.find(t=>"checkout.giftCards"===t.path);if(s&&this.updateAppliedGiftCards(s.value),i){const t=this.container.querySelector(".input-gift-card-container");if(t){const n=t.nextElementSibling;if((null===(e=null==n?void 0:n.classList)||void 0===e?void 0:e.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),i.value){const e=this.createErrorElement(i.value);t.after(e)}const r=t.querySelector(".apply-button");r&&(r.disabled=Boolean(i.value))}}if(r){const t=this.container.querySelector(".input-promo-code-container");if(t){const e=t.nextElementSibling;if((null===(n=null==e?void 0:e.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==e?void 0:e.remove()),r.value){const e=this.createErrorElement(r.value);t.after(e)}const i=t.querySelector(".apply-button");i&&(i.disabled=Boolean(r.value))}}}updateAppliedGiftCards(t){const e=t&&t.length>0;if(!e)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)})}createAppliedGiftCardElement(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),e.setAttribute("data-gift-card-code",t.code);const n=document.createElement("span");n.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",e.appendChild(n);const i=document.createElement("button");return i.type="button",i.textContent="Remove",i.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),e.appendChild(i),e}pcInputContainer(){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return t}gcInputContainer(){const t=ComponentFactoryService.createElement({type:r.CHECKOUT_GIFT_CARDS});return t}inputContainer(){var t;const e=this.getConfigs("checkout"),n=this.getConfigs("global"),i=e.layout.allowGiftCards,r=null===(t=null==n?void 0:n.layout)||void 0===t?void 0:t.allowPromoCodes,s=document.createElement("div");s.classList.add("checkout-pc-gc-sub-container");const a=this.pcInputContainer(),c=this.gcInputContainer();r&&s.appendChild(a);const l=this.getStoreValue("checkout.promoCodeError");if(l){const t=this.createErrorElement(l);t.classList.add("promo-code-error-wrapper"),s.appendChild(t)}i&&s.appendChild(c);const d=this.getStoreValue("checkout.giftCardError");if(d){const t=this.createErrorElement(d);s.appendChild(t)}return s}createErrorElement(t){const e=document.createElement("div");e.classList.add("error-banner-checkout");const n=document.createElement("div");n.innerHTML=ErrorInfoIcon({});const i=document.createElement("p");return i.textContent=t.toString(),e.appendChild(n),e.appendChild(i),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),e.remove()},3e3),e}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const e=[];return e.push(this.inputContainer()),t&&t.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)}),e.push(this.appliedGiftCardsContainer)),e}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,selectedSizeAttributes:i}){var r,a,c,l,d,h,u,m;const f=e===s.ON_DEMAND;let g=null;f&&t.hourStatus.openTime&&(null===(r=t.hourStatus)||void 0===r?void 0:r.closeTime)&&(g=t.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(a=t.hourStatus)||void 0===a?void 0:a.closeTime):"Opens at "+format24TimeTo12(null===(c=t.hourStatus)||void 0===c?void 0:c.openTime));const v=f&&t.hourStatus.isClosed?"closed":"",y=document.createElement("div");y.className="popup-retailer-card "+(n?"selected":"")+" "+v,y.setAttribute("data-fulfillment-id",t.id),y.setAttribute("role","button"),y.setAttribute("tabindex","0"),y.setAttribute("aria-pressed",n?"true":"false");const b=e===s.SHIPPING?"Shipping":"Same-day delivery";y.setAttribute("aria-label",b+" from "+t.retailerName+", "+formatCentToDollarText(null!==(l=t.variant.price)&&void 0!==l?l:0));const x=document.createElement("div");x.className="row";const w=document.createElement("span");w.className="name",w.textContent=t.retailerName,x.appendChild(w);const S=document.createElement("span");S.className="price",S.textContent=formatCentToDollarText(null!==(d=t.variant.price)&&void 0!==d?d:0),x.appendChild(S),y.appendChild(x);const E=document.createElement("div");E.className="row";const _=document.createElement("span");_.className="expectation",_.textContent=t.hourStatus.isClosed?g:(null===(h=null==i?void 0:i.presale)||void 0===h?void 0:h.isActive)?(null===(u=null==i?void 0:i.presale)||void 0===u?void 0:u.isActive)&&(null===(m=null==i?void 0:i.presale)||void 0===m?void 0:m.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==i?void 0:i.presale.estimatedShipBy):"":null==t?void 0:t.expectationText,E.appendChild(_);const D=document.createElement("span");if(D.className="fee",D.textContent=t.fee>0?formatCentToDollarText(t.fee):"Free Delivery",E.appendChild(D),y.appendChild(E),f){const e=document.createElement("div");e.className="row";const n=document.createElement("span");n.className="address",n.textContent=t.retailerAddressFormatted,e.appendChild(n),y.appendChild(e)}return y}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:e,shippingSelected:n,onDemandSelected:i,onTabClick:r,enableShippingFulfillment:a,enableOnDemandFulfillment:c}){const l=e.length>0,d=document.createElement("div");if(d.className="fulfillment-tabs-container",d.setAttribute("role","tablist"),d.setAttribute("aria-label","Delivery method options"),a){const e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",s.SHIPPING),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",n?"true":"false"),e.setAttribute("aria-label","Shipping, "+t.length+" options"),e.addEventListener("click",r),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())});const i=document.createElement("span");i.className="fulfillment-tab-label "+(n?"selected":""),i.textContent="Shipping ("+t.length+")",e.appendChild(i),d.appendChild(e)}if(c){const t=document.createElement("div");t.className="fulfillment-tab "+(i?"selected":"")+" "+(l?"":"disabled"),t.setAttribute("data-fulfillment-type",s.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",i?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+e.length+" options"),l||t.setAttribute("aria-disabled","true"),t.addEventListener("click",r),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())});const n=document.createElement("span");n.className="fulfillment-tab-label "+(i?"selected":""),n.textContent="Same-Day Delivery ("+e.length+")",t.appendChild(n),d.appendChild(t)}return d}class ProductAddToCartSectionComponent extends BaseComponent{get hostClasses(){return["add-to-cart-container"]}get hostAttributes(){return{role:"region","aria-live":"polite","aria-atomic":"false","aria-label":"Add to cart section"}}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment||!n.selectedSizeId)return 0;const i=n.selectedFulfillment.variant.partNumber,r=n.selectedFulfillment.id,s=null===(t=n.sizes[n.selectedSizeId])||void 0===t?void 0:t.maxQuantityPerOrder;if(!s)return 0;const a=this.getStoreValue("cart.items")||{},c=Object.values(a).filter(t=>t.partNumber===i&&t.fulfillmentId===r),l=c.reduce((t,e)=>t+e.quantity,0);return s-l}isFulfillmentClosed(){const t=this.getProductId(),e=this.getStoreValue("products."+t);return e.selectedFulfillment?e.selectedFulfillmentType===s.ON_DEMAND&&e.selectedFulfillment.hourStatus.isClosed:![]}isButtonLoading(){const t=this.getProductId();return this.getStoreValue("products."+t+".updating")}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),e=this.getAvailableQuantity(),n=t<e;return{currentQuantity:t,availableQuantity:e,canIncrease:n,canDecrease:t>1}}async handleAddToCart(){var t,e,n;const i=this.getProductId(),r=this.getStoreValue("products."+i);if(!r.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:i,selectedSizeId:r.selectedSizeId}),void 0;const s=this.getSizeAttributes(),a=(null===(t=null==s?void 0:s.presale)||void 0===t?void 0:t.isActive)===!![],c=this.isPresaleActive(s);a&&c?await this.commands.product.addPresaleToCart(i,{fulfillmentId:r.selectedFulfillment.id,partNumber:null===(e=r.selectedFulfillment)||void 0===e?void 0:e.variant.partNumber,quantity:r.quantity,identifier:i}):await this.commands.product.addToCart(i,{fulfillmentId:r.selectedFulfillment.id,partNumber:null===(n=r.selectedFulfillment)||void 0===n?void 0:n.variant.partNumber,quantity:r.quantity,identifier:i})}async handleQuantityChange(t){const e=this.getProductId();await this.commands.product.updateQuantity(e,t)}calculateTotalPrice(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=e.selectedFulfillment,i=n.variant.price*e.quantity;return{quantity:e.quantity,totalPrice:i}}createQuantityContainer(t){const e=this.calculateQuantityLimits(),n=document.createElement("div");return n.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!e.canDecrease).toString()),e.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=e.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+e.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!e.canIncrease).toString()),e.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantityText),n.appendChild(this.qtyIncreaseButton),n}getSizeAttributes(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".selectedSizeId"),n=this.getStoreValue("products."+t+".sizes."+e);return(null==n?void 0:n.attributes)||{}}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:e}=this.calculateTotalPrice(),n=this.getSizeAttributes(),i=this.calculateQuantityLimits(),r=(null===(t=null==n?void 0:n.presale)||void 0===t?void 0:t.isActive)===!![],s=this.isPresaleActive(n),a=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?a+" - "+formatCentToDollarText(e):a;const c=r&&!s||0===i.availableQuantity||this.isFulfillmentClosed(),l=this.isButtonLoading(),d=this.config.layout.addToCartButtonShowTotalPrice?a+" for "+formatCentToDollarText(e):a;return this.addToCartButton.setAttribute("aria-label",d),this.addToCartButton.setAttribute("aria-busy",l.toString()),this.addToCartButton.setAttribute("aria-disabled",c.toString()),c&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),l&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async t=>{if(t.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),n=this.getConfigs("configurations");if(!e||!n.isElementsEnabled)return[];const i=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer(this.config.layout.quantityCounterStyle);i.push(t)}const r=this.createAddToCartButton();return i.push(r),i}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const t=this.params.productId,e=this.getStoreValue("products."+t+".description"),n=this.getStoreValue("products."+t+".htmlDescription"),i="About this product:",r="See More",s="See Less",a=document.createElement("h3");a.className="title",a.textContent=i;const c=document.createElement("div");c.className="content collapsed",c.innerHTML=""===(null==n?void 0:n.trim())?e:sanitizeHTML(n);const l=document.createElement("span");l.className="collapse-button",l.textContent=r,l.setAttribute("role","button"),l.setAttribute("tabindex","0"),l.setAttribute("aria-label","Show more product information"),l.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,c.classList.toggle("collapsed"),l.textContent=this.isCollapsed?r:s,l.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),l.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return l.addEventListener("click",toggleContent),l.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[a,c,l]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(t){var e;const n=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!n)return![];const i=n.value,r=i.isOpen,s=null===(e=i.contentConfig)||void 0===e?void 0:e.type,a=s!==this.currentContentType;return r&&!this.isOpen?(this.currentContentType=s,this.openWithContent(i),![]):r&&this.isOpen&&!a?![]:r&&this.isOpen&&a?(this.currentContentType=s,this.openWithContent(i),![]):!r&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const e=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:e}),void 0;const{type:n,data:i}=t||{},r=ComponentFactoryService.createElement({type:n,...i});this.contentContainer&&this.contentContainer.appendChild(r),this.open()}catch(n){this.logger.error("Failed to open product drawer",n),this.commands.product.closeProductDrawer(e)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay;return["product-image-carousel",t]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedSizeId"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){var e;const n=this.params.productId,i=t.find(t=>t.path==="products."+n+".selectedSizeId");if(null==i?void 0:i.value){const t=this.getStoreValue("products."+n),r=null===(e=null==t?void 0:t.sizes)||void 0===e?void 0:e[i.value],s=null==r?void 0:r.image;if(s){const t=this.params.images.indexOf(s);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+s+"')")}}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let e=0;e<this.thumbnails.length;e++){const t=this.thumbnails[e];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(e)})}const t=this.container.querySelectorAll(".carousel-dot");for(let e=0;e<t.length;e++){const n=t[e];n.addEventListener("click",()=>this.selectImage(e))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var e,n;if(t<0||t>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[t]+"')",this.mainImageElement.title="Product image "+(t+1)),null===(e=this.thumbnails[this.currentImageIndex])||void 0===e||e.classList.remove("selected"),null===(n=this.thumbnails[t])||void 0===n||n.classList.add("selected");const i=this.container.querySelectorAll(".carousel-dot");for(let r=0;r<i.length;r++){const e=i[r];e.classList.toggle("active",r===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const e=this.thumbnails[t],n=this.galleryViewport.offsetWidth,i=e.offsetLeft+e.offsetWidth/2,r=n/2,s=r-i,a=0,c=-(this.galleryContainer.scrollWidth-n);this.translateX=Math.max(c,Math.min(a,s)),this.updateTransform(!![])}setupMainImageSwipe(){var t,e;let n=0,i=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{n=t.touches[0].clientX,i=t.touches[0].clientY},{passive:!![]}),null===(e=this.mainImageElement)||void 0===e||e.addEventListener("touchend",t=>{const e=t.changedTouches[0].clientX-n,r=t.changedTouches[0].clientY-i;Math.abs(e)>Math.abs(r)&&Math.abs(e)>50&&(e>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const t of this.galleryContainer.querySelectorAll("img"))t.addEventListener("dragstart",t=>t.preventDefault())}}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const i=this.currentTranslateX+n,r=0,s=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(s,Math.min(r,i)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const t=[],e=this.params.images.length>1,n=document.createElement("div");if(n.className="main-image",n.title="Product main image",n.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",e){const t=document.createElement("div");t.className="carousel-dots";for(let e=0;e<this.params.images.length;e++){const n=document.createElement("button");n.type="button",n.className="carousel-dot "+(0===e?"active":""),n.setAttribute("data-index",e.toString()),t.appendChild(n)}n.appendChild(t)}this.mainImageElement=n,t.push(n);const i=document.createElement("div");i.className="gallery-viewport";const r=document.createElement("div");r.className="gallery-container";for(let s=0;s<this.params.images.length;s++){const t=this.params.images[s],e=document.createElement("div");e.className="gallery-image-wrapper "+(0===s?"selected":"");const n=document.createElement("img");n.src=t,n.className="gallery-image",n.alt="Product thumbnail "+(s+1),n.loading="lazy",e.appendChild(n),r.appendChild(e)}return i.appendChild(r),t.push(i),t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var e;const n=this.getProductId();if(!t.some(t=>t.path==="products."+n+".selectedFulfillmentType"))return;const i=this.getStoreValue("products."+n),r=this.getConfigs("global");this.addPersonalizationSpan&&(i.selectedFulfillmentType===s.SHIPPING&&r.layout.enablePersonalization&&i.productHasAvailability&&(null===(e=null==i?void 0:i.selectedFulfillment)||void 0===e?void 0:e.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),e=this.container.querySelectorAll("[select-size]");for(const n of e){const i=n.textContent||"",r=n.classList.contains("selected");n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select "+i),n.setAttribute("aria-pressed",r?"true":"false"),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),n.addEventListener("click",async()=>{var i;const r=n.dataset.sizeId;if(!r)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:n.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,r);for(const t of e)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");n.classList.add("selected"),n.setAttribute("aria-pressed","true");const s=this.getStoreValue("products."+t),a=this.getConfigs("global");this.addPersonalizationSpan&&(a.layout.enablePersonalization&&s.productHasAvailability&&(null===(i=s.selectedFulfillment)||void 0===i?void 0:i.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,e){const n=document.createElement("div");n.className="size-container";const i=document.createElement("h3");i.className="size-label",i.textContent="Size",i.id="size-label",n.appendChild(i);const 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(e)){const e=document.createElement("span");e.setAttribute("data-size-id",s.id),e.setAttribute("select-size",""),e.className="size-button "+(s.id===t?"selected":"");const n=s.packDesc?" ("+s.packDesc+")":"";e.textContent=""+s.size+n,r.appendChild(e)}return n.appendChild(r),n}hasIndependentAddressComponent(){var t;return(null===(t=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===t?void 0:t.length)>0}template(){var t,e;const n=this.getProductId(),i=this.getStoreValue("products."+n),s=i.sizes[i.selectedSizeId],a=this.getConfigs("global"),c=[],l=document.createElement("div");l.className="price-personalization-container";const d=ComponentFactoryService.createElement({type:r.PRODUCT_PRICE,productId:n});if(l.appendChild(d),a.layout.enablePersonalization&&i.productHasAvailability&&(null===(t=null==i?void 0:i.selectedFulfillment)||void 0===t?void 0:t.variant.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var t,e,s,a,c,l,d,h;const u=i.sizes[i.selectedSizeId];await this.commands.product.openProductDrawer(n,r.ENGRAVING_FORM,{identifier:n,context:"product",lines:[],maxLines:(null===(e=null===(t=u.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.maxLines)||1,maxCharsPerLine:(null===(a=null===(s=u.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.maxCharsPerLine)||16,fee:(null===(l=null===(c=u.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.fee)||0,location:null===(h=null===(d=u.attributes)||void 0===d?void 0:d.engraving)||void 0===h?void 0:h.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),l.appendChild(this.addPersonalizationSpan)}c.push(l);const h=this.renderProductSizes(i.selectedSizeId,i.sizes);if(c.push(h),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:r.ADDRESS_DISPLAY,productId:n});c.push(t)}const u=ComponentFactoryService.createElement({type:r.PRODUCT_RETAILERS,productId:n});c.push(u);const m=ComponentFactoryService.createElement({type:r.PRODUCT_ADD_TO_CART_SECTION,productId:n});c.push(m);const f=null===(e=null==s?void 0:s.attributes)||void 0===e?void 0:e.presale;if((null==f?void 0:f.isActive)===!![]&&(null==f?void 0:f.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==f?void 0:f.language)||""),c.push(t)}if(this.config.layout.showDescription&&(i.description.trim().length>0||i.htmlDescription.trim().length>0)){const t=ComponentFactoryService.createElement({type:r.PRODUCT_DESCRIPTION,productId:n});c.push(t)}return c}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:e,showDescription:n,showQuantityCounter:i,fulfillmentDisplay:r,showImages:s}=this.config.layout,a=document.createElement("div");a.classList.add("product-content-wrapper");const c=document.createElement("div");if(c.classList.add("skeleton-container"),e){const t=document.createElement("div");t.classList.add("wave","sc-title"),c.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),c.appendChild(t),c}const l=document.createElement("div");l.classList.add("wave","sc-price"),c.appendChild(l);const d=document.createElement("div");d.classList.add("sc-sizes");const h=document.createElement("div");h.classList.add("wave","sc-size-button"),d.appendChild(h);const u=document.createElement("div");u.classList.add("wave","sc-size-button"),d.appendChild(u);const m=document.createElement("div");m.classList.add("wave","sc-size-button"),d.appendChild(m);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),d.appendChild(f);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),d.appendChild(g),c.appendChild(d);const v=document.createElement("div");v.classList.add("sc-row");const y=document.createElement("div");y.classList.add("wave","sc-price"),v.appendChild(y);const b=document.createElement("div");b.classList.add("wave","sc-personalization"),v.appendChild(b),c.appendChild(v);const x=document.createElement("div");x.classList.add("wave","sc-deliver-to"),c.appendChild(x);const w=document.createElement("div");w.classList.add("wave","sc-address"),c.appendChild(w);const S=document.createElement("div");S.classList.add("wave","sc-retailers",r),c.appendChild(S);const E=document.createElement("div");if(E.classList.add("sc-row"),i){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),E.appendChild(t)}const _=document.createElement("div");if(_.classList.add("wave","sc-add-to-cart"),E.appendChild(_),c.appendChild(E),n){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),c.appendChild(t);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),c.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),c.appendChild(n);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),c.appendChild(i);const r=document.createElement("div");r.classList.add("wave","sc-description-more"),c.appendChild(r)}const D=document.createElement("div");if(D.classList.add("product-content"),D.appendChild(c),a.appendChild(D),s){a.classList.add("has-images");const t=this.createImageSkeletons();a.prepend(t)}return a}createImageSkeletons(){const t=document.createElement("div");t.classList.add("product-image-carousel","skeleton");const e=document.createElement("div");e.classList.add("wave","sc-main-image"),e.title="Product main image loading";const n=document.createElement("div");n.classList.add("carousel-dots");for(let s=0;s<3;s++){const t=document.createElement("div");t.classList.add("wave","sc-carousel-dot"),n.appendChild(t)}e.appendChild(n),t.appendChild(e);const i=document.createElement("div");i.classList.add("gallery-viewport");const 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 e=document.createElement("div");e.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(e),r.appendChild(t)}return i.appendChild(r),t.appendChild(i),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 e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen");if(n){const t=n.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),e=this.getStoreValue("address.formattedAddress");if(e)return ComponentFactoryService.createElement({type:r.PRODUCT_INTERACTIONS,productId:this.getProductId()});const n=document.createElement("button");return n.type="button",n.className="product-options-open-address-button",n.textContent=this.config.layout.buyNowButtonText,n.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,r.ADDRESS_INPUT,{productId:t})}),n}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t);let n=e.noAvailabilityPrice;return e.selectedFulfillment&&(n=e.selectedFulfillment.variant.price),formatCentToDollarText(n)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getConfigs("product"),i=[],s=this.getConfigs("configurations");if(!e.productHasAvailability||!s.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),i.push(t),i}const a="carousel"===n.layout.fulfillmentDisplay?r.PRODUCT_RETAILERS_CAROUSEL:r.PRODUCT_RETAILERS_POPUP,c=ComponentFactoryService.createElement({type:a,productId:t});return i.push(c),i}}class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const t=this.retailerCards.findIndex(t=>t.classList.contains("selected"));-1!==t&&this.scrollToIndex(t)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".selectedFulfillmentId");(null==n?void 0:n.value)&&this.updateSelectedCard(n.value)}updateSelectedCard(t){for(const n of this.retailerCards)n.classList.remove("selected"),n.setAttribute("aria-pressed","false");const e=this.retailerCards.findIndex(e=>e.dataset.fulfillmentId===t);-1!==e&&(this.retailerCards[e].classList.add("selected"),this.retailerCards[e].setAttribute("aria-pressed","true"),this.scrollToIndex(e))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const e=this.retailerCards[t],n=this.listViewport.offsetWidth,i=e.offsetLeft+e.offsetWidth/2,r=n/2,s=r-i,a=0,c=-(this.listContainer.scrollWidth-n);this.translateX=Math.max(c,Math.min(a,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 e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const i=this.currentTranslateX+n,r=0,s=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(s,Math.min(r,i)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.listContainer&&(this.listContainer.style.transition=t?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){if(this.hasMoved)return;const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const i=this.getStoreValue("products."+e+".selectedFulfillment");if(i&&i.id===n)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:e,fulfillmentId:n}),void 0;await this.commands.product.selectFulfillment(e,n)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,selectedSizeAttributes:i}){var r,a,c,l,d,h,u,m;const f=e===s.ON_DEMAND;let g=null;f&&t.hourStatus.openTime&&(null===(r=t.hourStatus)||void 0===r?void 0:r.closeTime)&&(g=t.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(a=t.hourStatus)||void 0===a?void 0:a.closeTime):"Opens at "+format24TimeTo12(null===(c=t.hourStatus)||void 0===c?void 0:c.openTime));const v=f&&t.hourStatus&&t.hourStatus.isClosed?"closed":"",y=document.createElement("div");y.className="carousel-retailer-card "+(n?"selected":"")+" "+v,y.setAttribute("data-fulfillment-id",t.id),y.setAttribute("role","button"),y.setAttribute("tabindex","0"),y.setAttribute("aria-pressed",n?"true":"false");const b=e===s.SHIPPING?"Shipping":"Same-day delivery";y.setAttribute("aria-label",b+" from "+t.retailerName+", "+formatCentToDollarText(null!==(l=t.variant.price)&&void 0!==l?l:0));const x=document.createElement("div");x.className="retailer-header";const w=document.createElement("h3");if(w.className="name",w.textContent=t.retailerName,x.appendChild(w),f){const e=document.createElement("h3");e.className="address",e.textContent=t.retailerAddressFormatted,x.appendChild(e)}const S=document.createElement("div");S.className="retailer-body";const E=document.createElement("span");E.className="product-price",E.textContent=formatCentToDollarText(null!==(d=t.variant.price)&&void 0!==d?d:0);const _=document.createElement("span");_.className="shipping-price",_.textContent=t.fee>0?"+ "+formatCentToDollarText(t.fee):"FREE Delivery";const D=document.createElement("span");return D.className="expectation",D.textContent=t.hourStatus.isClosed?g:(null===(h=null==i?void 0:i.presale)||void 0===h?void 0:h.isActive)?(null===(u=null==i?void 0:i.presale)||void 0===u?void 0:u.isActive)&&(null===(m=null==i?void 0:i.presale)||void 0===m?void 0:m.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==i?void 0:i.presale.estimatedShipBy):"":null==t?void 0:t.expectationText,S.append(E,_,D),y.append(x,S),y}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,r=[];for(const s in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,s)&&r.push(n.shippingFulfillments[s]);const a=[];for(const s in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,s)&&a.push(n.onDemandFulfillments[s]);const c=e.selectedFulfillmentType===s.SHIPPING,l=e.selectedFulfillmentType===s.ON_DEMAND,d=c?r:a,h=renderFulfillmentTabsContainer({shippingFulfillments:r,onDemandFulfillments:a,shippingSelected:c,onDemandSelected:l,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===d.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[h,t]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const u of d){const t=this.generateRetailerCard({fulfillment:u,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:u.id===e.selectedFulfillmentId,selectedSizeAttributes:i}),n=e.selectedFulfillmentType===s.ON_DEMAND&&u.hourStatus.isClosed;n?t.setAttribute("aria-disabled","true"):(t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())})),this.listContainer.appendChild(t)}return this.listViewport.appendChild(this.listContainer),[h,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,a=this.config.layout.enableShippingFulfillment,c=this.config.layout.enableOnDemandFulfillment,l=Object.values(n.shippingFulfillments),d=Object.values(n.onDemandFulfillments),h=(a?l.length:0)+(c?d.length:0),u=document.createElement("div");u.className="header";const m=document.createElement("span");m.className="header-label",m.textContent=e.selectedFulfillmentType===s.SHIPPING?"Shipping From:":"Delivering From:";const f=document.createElement("button");if(f.className="delivery-options",f.type="button",f.textContent="See Delivery Options ("+h+")",f.setAttribute("aria-label","View all "+h+" delivery options"),f.addEventListener("click",async()=>{0!==h&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,r.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),u.appendChild(m),u.appendChild(f),!e.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[u,t]}const g=document.createElement("div");g.className="popup-fulfillment-list-container";const v=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:i});return g.appendChild(v),[u,g]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const U=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(e),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},i=this.getStoreValue("products."+e+".selectedFulfillment");if(i&&i.id===n)return await U(),void 0;await this.commands.product.selectFulfillment(e,n),await U()}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,r=[];for(const s in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,s)&&r.push(n.shippingFulfillments[s]);const a=[];for(const s in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,s)&&a.push(n.onDemandFulfillments[s]);const c=e.selectedFulfillmentType===s.SHIPPING,l=e.selectedFulfillmentType===s.ON_DEMAND,d=c?r:a,h=document.createElement("h5");h.className="popup-retailers-section-title",h.textContent="Delivery Options";const u=renderFulfillmentTabsContainer({shippingFulfillments:r,onDemandFulfillments:a,shippingSelected:c,onDemandSelected:l,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===d.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[h,u,t]}const m=document.createElement("div");m.className="popup-fulfillment-list-container";for(const s of d){const t=renderPopupRetailerCard({fulfillment:s,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:s.id===e.selectedFulfillmentId,selectedSizeAttributes:i});t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),m.appendChild(t)}return[h,u,m]}}class ProductComponent extends BaseComponent{constructor(){super({watchStorePaths:["products.{productId}.loading","products.{productId}.error"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen","products.{productId}.rerender"]}),this.titleElement=null}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen"),i=t.find(t=>t.path==="products."+e+".rerender");n&&this.titleElement&&this.titleElement.classList.toggle("hide",n.value),(null==i?void 0:i.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n)return ComponentFactoryService.createElement({type:r.PRODUCT_LOADING});if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:r.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:r.PRODUCT_LOADING});const i=n.sizes[n.selectedSizeId],s=document.createElement("div");s.classList.add("product-content-wrapper"),s.setAttribute("role","region"),s.setAttribute("aria-label",""+n.name);const a=document.createElement("div");if(a.classList.add("product-content"),a.setAttribute("role","region"),a.setAttribute("aria-label",""+n.name),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=n.name,this.titleElement=t,a.appendChild(t)}const c=ComponentFactoryService.createElement({type:r.PRODUCT_OPTIONS,productId:e});a.appendChild(c);const l=ComponentFactoryService.createElement({type:r.PRODUCT_DRAWER,productId:e});if(a.appendChild(l),s.appendChild(a),!this.config.layout.showImages||!(null===(t=n.images)||void 0===t?void 0:t.length))return s;s.classList.add("has-images");const d=ComponentFactoryService.createElement({type:r.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:i.image,productId:e});return s.prepend(d),d.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;const e=this.params.product,n=this.getStoreValue("address.address"),i={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==n?void 0:n.state)||"",isPresale:![],isPresaleActive:![]},r=e.sizes[0];if(!r)return i;const s=Object.values(r.shippingVariants)[0];if(!s)return i;i.upc=r.upc;const a=r.attributes||{};return i.isPresale=(null===(t=a.presale)||void 0===t?void 0:t.isActive)===!![],i.isPresaleActive=this.isPresaleActive(a),this.params.shippingFulfillment&&s.shippingFulfillmentId===this.params.shippingFulfillment.id&&s.stock>0?(i.hasAvailability=!![],i.fulfillmentId=this.params.shippingFulfillment.id,i.partNumber=s.partNumber):this.params.onDemandFulfillment&&s.onDemandFulfillmentId===this.params.onDemandFulfillment.id&&s.stock>0&&(i.hasAvailability=!![],i.fulfillmentId=this.params.onDemandFulfillment.id,i.partNumber=s.partNumber),i}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}async handleAddToCart(t){if(!t.hasAvailability)return;const e=this.params.product.salsifyGrouping||this.params.product.id||"";t.isPresale&&t.isPresaleActive?await this.commands.productList.addPresaleToCart({fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:e}):await this.commands.productList.addToCart({fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:e})}template(){var t,e,n;const i=this.params.product,r=i.sizes[0],s=r?r.image:i.images[0],a=i.name,c=r?r.size:null,l=null!==(n=null===(e=null===(t=null==r?void 0:r.shippingVariants)||void 0===t?void 0:t[0])||void 0===e?void 0:e.price)&&void 0!==n?n:i.noAvailabilityPrice,d=this.getAvailabilityData();return this.createVariantStandard({image:s,name:a,size:c,price:l,availability:d})}generateProductUrl(){var t;if(!this.params.productUrl)return null;const e=this.params.product,n=null===(t=e.sizes)||void 0===t?void 0:t[0],i=this.params.productUrl;if(i.includes("{upc}")){const t=(null==n?void 0:n.upc)||"";return t?i.replace("{upc}",t):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(i.includes("{grouping}")){const t=e.salsifyGrouping||"";return t?i.replace("{grouping}",t):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(t){const{image:e,name:n,size:i,price:r,availability:s}=t,a=[],c=this.generateProductUrl(),l=document.createElement("div");l.className="plc__image-content";const d=document.createElement("div");d.className="plc__image-wrapper";const h=document.createElement("img");if(h.className="plc__image",h.src=e,h.alt=n,h.loading="lazy",d.appendChild(h),l.appendChild(d),c){const t=document.createElement("a");t.href=c,t.className="plc__image-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(l),a.push(t)}else a.push(l);const u=document.createElement("div");u.className="plc__content";const m=document.createElement("h3");if(m.className="plc__title",m.textContent=n,c){const t=document.createElement("a");t.href=c,t.className="plc__title-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(m),u.appendChild(t)}else u.appendChild(m);const f=document.createElement("div");f.className="plc__size-price-wrapper";const g=document.createElement("div");g.className="plc__price",g.textContent=formatCentToDollarText(r),f.appendChild(g);const v=document.createElement("div");v.className="plc__size",v.textContent=i||"",f.appendChild(v),u.appendChild(f),a.push(u);const y=document.createElement("button");return y.type="button",y.className="plc__button",y.disabled=!s.hasAvailability,s.isPresale?y.textContent="Pre Order":s.hasAvailability?y.textContent="Add to Cart":(y.textContent="Not Available In "+s.state.toUpperCase(),this.addHostClasses("not-available")),y.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleAddToCart(s)}),a.push(y),a}}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(t){const e=document.createElement("div");e.classList.add("slc__card");const n=document.createElement("div");n.className="slc__image-content";const i=document.createElement("div");i.className="slc__image-wrapper";const r=document.createElement("div");r.classList.add("wave","slc__image"),i.appendChild(r),n.appendChild(i);const s=document.createElement("div");s.className="slc__content";const a=document.createElement("div");a.className="slc__title-container";const c=document.createElement("div");c.classList.add("wave","slc__title","slc__title-line-1"),a.appendChild(c);const l=document.createElement("div");l.classList.add("wave","slc__title","slc__title-line-2"),a.appendChild(l),s.appendChild(a);const d=document.createElement("div");d.className="slc__size-price-wrapper";const h=document.createElement("div");h.classList.add("wave","slc__price"),d.appendChild(h);const u=document.createElement("div");u.classList.add("wave","slc__size"),d.appendChild(u),s.appendChild(d);const m=document.createElement("div");return m.classList.add("wave","slc__button"),e.appendChild(n),e.appendChild(s),e.appendChild(m),e}template(){const t=[],e=100/this.params.columns;this.container.style.setProperty("--card-width",e+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const n=this.params.rows*this.params.columns;for(let i=0;i<n;i++){const e=this.createSkeletonCard(i);t.push(e)}return t}}function createApplyFiltersButton(t){const e=document.createElement("div");e.className="product-list-filters-apply-container";const n=document.createElement("button");return n.className="product-list-filters-apply-btn",n.textContent="Apply Filters",n.addEventListener("click",()=>t()),e.appendChild(n),e}function createCheckboxItem(t){const{filter:e,state:n,item:i,onChange:r}=t,s=document.createElement("div");s.className="checkbox-filter-item";const a=document.createElement("input");a.type="checkbox",a.id=e.filterCategory+"-"+i.value,a.value=i.value.toString(),a.className="checkbox-filter-checkbox",a.checked=n.selectedValues.has(i.value.toString()),a.addEventListener("change",r);const c=document.createElement("label");c.htmlFor=a.id,c.className="checkbox-filter-item-label";const l=i.formattedValue||i.value.toString(),d=i.count||0,h=document.createElement("span");h.className="checkbox-filter-item-text",h.textContent=l;const u=document.createElement("span");return u.className="checkbox-filter-item-count",u.textContent="("+d+")",c.appendChild(h),c.appendChild(u),s.appendChild(a),s.appendChild(c),s}function handleCheckboxFilterSearch(t){const{filter:e,state:n,searchTerm:i,renderCheckboxItems:r}=t,s=i.toLowerCase().trim();n.filteredItems=s?e.filterValues.filter(t=>{const e=(t.formattedValue||t.value.toString()).toLowerCase();return e.includes(s)}):[...e.filterValues],r()}function createCheckboxFilterHeader(t){const{filter:e,state:n,onToggle:i}=t,r=document.createElement("div");r.className="checkbox-filter-header";const s=document.createElement("button");s.className="checkbox-filter-label",s.type="button";const a=document.createElement("span");a.textContent=formatFilterLabel(e.filterCategory);const c=document.createElement("span");return c.className="checkbox-filter-toggle-icon "+(n.isExpanded?"expanded":"collapsed"),c.innerHTML=n.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),n.iconElement=c,s.appendChild(a),s.appendChild(c),s.addEventListener("click",()=>i(e.filterCategory)),r.appendChild(s),r}function createCheckboxFilterSearchContainer(t){const{state:e,onSearch:n}=t,i=document.createElement("div");i.className="checkbox-filter-search-wrapper",e.searchInput=document.createElement("input"),e.searchInput.type="text",e.searchInput.className="checkbox-filter-search",e.searchInput.placeholder="Search";const r=document.createElement("span");return r.className="checkbox-filter-search-icon",r.innerHTML=SearchIcon({}),e.searchInput.addEventListener("input",t=>{const e=t.target;n(e.value)}),i.appendChild(e.searchInput),i.appendChild(r),i}function renderCheckboxItems(t){const{filter:e,state:n,onCheckboxChange:i}=t;if(n.checkboxList&&(n.checkboxList.innerHTML="",n.filteredItems.forEach(t=>{const r=createCheckboxItem({filter:e,state:n,item:t,onChange:()=>{const e=r.querySelector("input");i(t.value.toString(),e.checked)}});n.checkboxList.appendChild(r)}),0===n.filteredItems.length)){const t=document.createElement("div");t.className="checkbox-filter-no-results",t.textContent="No results found",n.checkboxList.appendChild(t)}}function updateFilterExpandState(t){t.contentElement&&(t.contentElement.className="checkbox-filter-content "+(t.isExpanded?"expanded":"collapsed")),t.iconElement&&(t.iconElement.className="checkbox-filter-toggle-icon "+(t.isExpanded?"expanded":"collapsed"),t.iconElement.innerHTML=t.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}))}function formatFilterLabel(t){return t.charAt(0).toUpperCase()+t.slice(1).replace(/_/g," ")}function createDeliveryOptionsFilter(t){const{currentFilters:e,deliveryCollapsed:n,isSameDayDeliveryDisabled:i,onDeliveryOptionsChange:r,onToggleCollapse:s}=t,a=[],c=document.createElement("div");c.className="product-list-filters-delivery-options";const l=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],d=document.createElement("div");d.className="product-list-filters-delivery-options-header",d.style.cursor="pointer";const h=document.createElement("h3");h.className="product-list-filters-delivery-options-label",h.textContent="Delivery Options";const u=document.createElement("div");u.className="product-list-filters-chevron",u.innerHTML=n?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),d.appendChild(h),d.appendChild(u),c.appendChild(d);const m=document.createElement("div");m.className="product-list-filters-delivery-options-list",n&&m.classList.add("collapsed");for(const f of l){const t=document.createElement("div");t.className="product-list-filters-delivery-option";const n=document.createElement("input");n.type="radio",n.id="delivery-"+f.value,n.name="delivery-options",n.value=f.value,n.className="product-list-filters-delivery-radio";const s="onDemand"===f.value&&i;n.disabled=s,n.checked=f.value===(null==e?void 0:e.deliveryOptions),n.addEventListener("change",t=>{const e=t.target;null==r?void 0:r(e.value)});const a=document.createElement("label");a.htmlFor="delivery-"+f.value,a.className="product-list-filters-delivery-radio-label "+(s?"disabled":""),a.textContent=f.label,t.appendChild(n),t.appendChild(a),m.appendChild(t)}return c.appendChild(m),d.addEventListener("click",()=>{s()}),a.push(c),{elements:a,chevronContainer:u,deliveryOptionsList:m}}function createPriceFilter(t){var e,n,i,r,s,a,c,l;const{priceConfig:d,currentFilters:h,priceCollapsed:u,onPriceChange:m,onToggleCollapse:f,DEFAULT_MIN:g,DEFAULT_MAX:v}=t,y=[],b=document.createElement("div");b.className="product-list-filters-price";const x=Number.parseInt(null!==(e=null==d?void 0:d.min)&&void 0!==e?e:g,10),w=Number.parseInt(null!==(n=null==d?void 0:d.max)&&void 0!==n?n:v,10),S=Number.parseInt(null!==(s=null!==(r=null===(i=null==h?void 0:h.price)||void 0===i?void 0:i.min)&&void 0!==r?r:null==d?void 0:d.min)&&void 0!==s?s:g,10),E=Number.parseInt(null!==(l=null!==(c=null===(a=null==h?void 0:h.price)||void 0===a?void 0:a.max)&&void 0!==c?c:null==d?void 0:d.max)&&void 0!==l?l:v,10),_=document.createElement("div");_.className="product-list-filters-price-header",_.style.cursor="pointer";const D=document.createElement("h3");D.className="product-list-filters-price-title",D.textContent="Price Range",_.appendChild(D);const T=document.createElement("div");T.className="product-list-filters-chevron",T.innerHTML=u?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),_.appendChild(T),b.appendChild(_);const I=document.createElement("div");I.className="product-list-filters-price-slider-container",u&&I.classList.add("collapsed");const F=document.createElement("div");F.className="product-list-filters-price-range-wrapper";const A=document.createElement("div");A.className="product-list-filters-price-track";const O=document.createElement("div");O.className="product-list-filters-price-track-active",A.appendChild(O),F.appendChild(A);const N=document.createElement("input");N.type="range",N.min=x.toString(),N.max=w.toString(),N.value=S.toString(),N.step="1",N.className="product-list-filters-price-range product-list-filters-price-range-min",F.appendChild(N);const M=document.createElement("input");M.type="range",M.min=x.toString(),M.max=w.toString(),M.value=E.toString(),M.step="1",M.className="product-list-filters-price-range product-list-filters-price-range-max",F.appendChild(M),I.appendChild(F);const L=document.createElement("div");L.className="product-list-filters-price-inputs-container";const B=document.createElement("div");B.className="product-list-filters-price-input-wrapper";const j=document.createElement("span");j.className="product-list-filters-price-input-prefix",j.textContent="$";const q=document.createElement("input");q.type="number",q.min=x.toString(),q.max=w.toString(),q.value=S.toString(),q.className="product-list-filters-price-input",q.placeholder=x.toString(),B.appendChild(j),B.appendChild(q);const H=document.createElement("span");H.className="product-list-filters-price-separator",H.textContent="to";const W=document.createElement("div");W.className="product-list-filters-price-input-wrapper";const X=document.createElement("span");X.className="product-list-filters-price-input-prefix",X.textContent="$";const $=document.createElement("input");$.type="number",$.min=x.toString(),$.max=w.toString(),$.value=E.toString(),$.className="product-list-filters-price-input",$.placeholder=w+"+",W.appendChild(X),W.appendChild($),L.appendChild(B),L.appendChild(H),L.appendChild(W),I.appendChild(L),b.appendChild(I);const o=()=>{const t=Number.parseInt(N.value,10),e=Number.parseInt(M.value,10),n=w-x,i=(t-x)/n*100,r=(e-x)/n*100;O.style.left=i+"%",O.style.width=r-i+"%"},Q=(t,e)=>{N.value=t.toString(),M.value=e.toString(),q.value=t.toString(),$.value=e.toString(),o()};return N.addEventListener("input",()=>{let t=Number.parseInt(N.value,10);const e=Number.parseInt(M.value,10);t>e&&(t=e),Q(t,e)}),N.addEventListener("change",()=>{const t=Number.parseInt(N.value,10),e=Number.parseInt(M.value,10);null==m?void 0:m(t.toString(),e.toString())}),M.addEventListener("input",()=>{const t=Number.parseInt(N.value,10);let e=Number.parseInt(M.value,10);e<t&&(e=t),Q(t,e)}),M.addEventListener("change",()=>{const t=Number.parseInt(N.value,10),e=Number.parseInt(M.value,10);null==m?void 0:m(t.toString(),e.toString())}),q.addEventListener("input",()=>{let t=Number.parseInt(q.value,10)||x;const e=Number.parseInt($.value,10)||w;t=Math.max(x,Math.min(t,w)),t>e&&(t=e),Q(t,e),null==m||m(t.toString(),e.toString())}),$.addEventListener("input",()=>{const t=Number.parseInt(q.value,10)||x;let e=Number.parseInt($.value,10)||w;e=Math.max(x,Math.min(e,w)),e<t&&(e=t),Q(t,e),null==m||m(t.toString(),e.toString())}),o(),_.addEventListener("click",()=>{f()}),y.push(b),{elements:y,chevronContainer:T,sliderContainer:I}}class ProductListSearchComponent extends BaseComponent{constructor(){super(...arguments),this.ALLOWED_CHARACTERS=/[^a-zA-Z0-9\s\-_'.,&()]/g,this.MAX_LENGTH=100}get hostClasses(){return["product-list-search-container"]}template(){const t=[],e=document.createElement("div");e.className="product-list-search-box";const n=document.createElement("span");return n.className="product-list-search-icon",n.innerHTML=SearchIcon({}),n.setAttribute("aria-hidden","true"),this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="product-list-search-input",this.searchInput.placeholder="Search",this.searchInput.setAttribute("aria-label","Search products"),this.searchInput.setAttribute("maxlength",this.MAX_LENGTH.toString()),this.params.searchTerm&&(this.searchInput.value=this.sanitizeInput(this.params.searchTerm)),this.searchInput.addEventListener("input",t=>{const e=t.target,n=e.value,i=this.sanitizeInput(n);i!==n&&(e.value=i),this.updateClearButtonVisibility(i),this.params.handleInputChange&&this.params.handleInputChange(i)}),this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="product-list-search-clear-btn",this.clearButton.innerHTML=CloseIcon({}),this.clearButton.setAttribute("aria-label","Clear search"),this.clearButton.style.display=this.params.searchTerm?"flex":"none",this.clearButton.addEventListener("click",()=>{this.searchInput&&(this.searchInput.value="",this.searchInput.focus()),this.updateClearButtonVisibility(""),this.params.clearSearch&&this.params.clearSearch(),this.params.handleInputChange&&this.params.handleInputChange("")}),e.appendChild(n),e.appendChild(this.searchInput),e.appendChild(this.clearButton),t.push(e),t}sanitizeInput(t){if(!t)return"";let e=t.replace(this.ALLOWED_CHARACTERS,"");return e=e.trim(),e=e.replace(/\s+/g," "),e.length>this.MAX_LENGTH&&(e=e.substring(0,this.MAX_LENGTH)),e}updateClearButtonVisibility(t){this.clearButton&&(this.clearButton.style.display=t?"flex":"none")}}function createPersonalizedFilter(t){const{currentFilters:e,isPersonalizationDisabled:n,onPersonalizedChange:i}=t,r=[],s=document.createElement("div");s.className="product-list-filters-personalized";const a=document.createElement("label");a.className="product-list-filters-personalized-label",a.setAttribute("for","personalized-switch"),a.textContent="Personalized Bottles",s.appendChild(a);const c=document.createElement("div");c.classList.add("toggle-switch");const l=!!(null==e?void 0:e.personalized);l&&c.classList.add("active");const d=document.createElement("div");d.classList.add("toggle-slider"),c.id="personalized-switch",c.setAttribute("tabindex","0"),c.setAttribute("aria-label","Toggle Personalized Bottles"),c.setAttribute("role","switch"),c.setAttribute("aria-checked",l?"true":"false"),c.appendChild(d);const P=t=>{c.classList.toggle("active",t),c.setAttribute("aria-checked",t?"true":"false")},p=()=>{const t=c.classList.contains("active"),e=!t;P(e),null==i||i(e)};if(c.addEventListener("click",()=>{n||p()}),c.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p())}),s.appendChild(c),n){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",s.appendChild(t)}return r.push(s),r}function createPreOrderFilter(t){const{currentFilters:e,isPreOrderDisabled:n,onPreOrderChange:i}=t,r=[],s=document.createElement("div");s.className="product-list-filters-pre-order";const a=document.createElement("label");a.className="product-list-filters-pre-order-label",a.setAttribute("for","pre-order-switch"),a.textContent="Pre-Order",s.appendChild(a);const c=document.createElement("div");c.classList.add("toggle-switch");const l=!!(null==e?void 0:e.preOrder);l&&c.classList.add("active"),n&&c.classList.add("disabled");const d=document.createElement("div");d.classList.add("toggle-slider"),c.id="pre-order-switch",c.setAttribute("tabindex",n?"-1":"0"),c.setAttribute("aria-label","Toggle Pre-Order"),c.setAttribute("role","switch"),c.setAttribute("aria-checked",l?"true":"false"),c.setAttribute("aria-disabled",n?"true":"false"),c.appendChild(d);const P=t=>{c.classList.toggle("active",t),c.setAttribute("aria-checked",t?"true":"false")},p=()=>{const t=c.classList.contains("active"),e=!t;P(e),null==i||i(e)};if(c.addEventListener("click",()=>{n||p()}),c.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p())}),s.appendChild(c),n){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",s.appendChild(t)}return r.push(s),r}class ProductListFiltersComponent extends BaseComponent{constructor(){super(...arguments),this.priceCollapsed=![],this.deliveryCollapsed=![],this.checkboxFilterStates=new Map,this.DEFAULT_MIN="0",this.DEFAULT_MAX="1000"}get hostClasses(){const t=["product-list-filters-container"];return this.params.isDrawerMode&&t.push("drawer-mode"),t}isSameDayDeliveryDisabled(){var t,e;return!(!(null===(t=this.params.currentFilters)||void 0===t?void 0:t.personalized)&&!(null===(e=this.params.currentFilters)||void 0===e?void 0:e.preOrder))}isPersonalizationDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}isPreOrderDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}createPersonalizedFilterWrapper(){return createPersonalizedFilter({currentFilters:this.params.currentFilters,isPersonalizationDisabled:this.isPersonalizationDisabled(),onPersonalizedChange:this.params.onPersonalizedChange})}createPreOrderFilterWrapper(){return createPreOrderFilter({currentFilters:this.params.currentFilters,isPreOrderDisabled:this.isPreOrderDisabled(),onPreOrderChange:this.params.onPreOrderChange})}createDeliveryOptionsFilterWrapper(){const t=createDeliveryOptionsFilter({currentFilters:this.params.currentFilters,deliveryCollapsed:this.deliveryCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryDisabled(),onDeliveryOptionsChange:this.params.onDeliveryOptionsChange,onToggleCollapse:()=>this.toggleDeliveryCollapse()});return this.deliveryChevronContainer=t.chevronContainer,this.deliveryOptionsList=t.deliveryOptionsList,t.elements}toggleDeliveryCollapse(){this.deliveryCollapsed=!this.deliveryCollapsed,this.deliveryOptionsList&&this.deliveryOptionsList.classList.toggle("collapsed"),this.deliveryChevronContainer&&(this.deliveryChevronContainer.innerHTML=this.deliveryCollapsed?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}))}createPriceFilterWrapper(){const t=createPriceFilter({priceConfig:this.params.priceConfig,currentFilters:this.params.currentFilters,priceCollapsed:this.priceCollapsed,onPriceChange:this.params.onPriceChange,onToggleCollapse:()=>this.togglePriceCollapse(),DEFAULT_MIN:this.DEFAULT_MIN,DEFAULT_MAX:this.DEFAULT_MAX});return this.priceChevronContainer=t.chevronContainer,this.priceSliderContainer=t.sliderContainer,t.elements}togglePriceCollapse(){this.priceCollapsed=!this.priceCollapsed,this.priceSliderContainer&&this.priceSliderContainer.classList.toggle("collapsed"),this.priceChevronContainer&&(this.priceChevronContainer.innerHTML=this.priceCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}createCheckboxFilter(t){var e;const n=[];if(!this.checkboxFilterStates.has(t.filterCategory)){const n=null===(e=this.params.currentFilters)||void 0===e?void 0:e[t.filterCategory],i=Array.isArray(n)?new Set(n):new Set;this.checkboxFilterStates.set(t.filterCategory,{isExpanded:i.size>0,selectedValues:i,searchInput:null,checkboxList:null,filteredItems:[...t.filterValues],contentElement:null,iconElement:null,hasUserInteraction:i.size>0})}const i=this.checkboxFilterStates.get(t.filterCategory),r=document.createElement("div");r.className="product-list-checkbox-filter",r.setAttribute("data-filter-bucket",t.filterCategory);const s=document.createElement("div");s.className="checkbox-filter-container";const a=createCheckboxFilterHeader({filter:t,state:i,onToggle:t=>this.toggleCheckboxFilter(t)});s.appendChild(a);const c=document.createElement("div");c.className="checkbox-filter-content "+(i.isExpanded?"expanded":"collapsed"),i.contentElement=c;const l=createCheckboxFilterSearchContainer({state:i,onSearch:e=>{handleCheckboxFilterSearch({filter:t,state:i,searchTerm:e,renderCheckboxItems:()=>this.renderCheckboxItemsWrapper(t,i)})}});return c.appendChild(l),i.checkboxList=document.createElement("div"),i.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsWrapper(t,i),c.appendChild(i.checkboxList),s.appendChild(c),r.appendChild(s),n.push(r),n}renderCheckboxItemsWrapper(t,e){renderCheckboxItems({filter:t,state:e,onCheckboxChange:(n,i)=>this.handleCheckboxChange(t.filterCategory,e,n,i)})}handleCheckboxChange(t,e,n,i){i?e.selectedValues.add(n):e.selectedValues.delete(n),e.hasUserInteraction=!![],e.isExpanded||(e.isExpanded=!![],updateFilterExpandState(e)),this.params.onCheckboxFilterChange&&this.params.onCheckboxFilterChange(t,Array.from(e.selectedValues))}toggleCheckboxFilter(t){const e=this.checkboxFilterStates.get(t);e&&(e.isExpanded=!e.isExpanded,e.hasUserInteraction=!![],updateFilterExpandState(e))}template(){var t;const e=[],n=document.createElement("div");n.className="product-list-filters-header",this.params.isDrawerMode&&n.classList.add("drawer-mode");const i=document.createElement("h3");if(i.className="product-list-filters-title",i.textContent="Filters",n.appendChild(i),this.params.isDrawerMode){const t=document.createElement("button");t.className="product-list-filters-close-btn",t.innerHTML=CloseIcon({}),t.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),n.appendChild(t)}return e.push(n),this.params.enablePersonalized&&e.push(...this.createPersonalizedFilterWrapper()),this.params.enablePreOrder&&e.push(...this.createPreOrderFilterWrapper()),this.params.enableDeliveryOptions&&e.push(...this.createDeliveryOptionsFilterWrapper()),this.params.priceConfig&&e.push(...this.createPriceFilterWrapper()),null===(t=this.params.sanitizedFilters)||void 0===t||t.forEach(t=>{e.push(...this.createCheckboxFilter(t))}),this.params.isDrawerMode&&e.push(createApplyFiltersButton(()=>{var t,e;null===(e=(t=this.params).onApplyFilters)||void 0===e?void 0:e.call(t),this.commands.ui.closeDrawer()})),e}}const FilterIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const r=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 24 24" class="filter-icon '+n+'" style="'+r+'" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M20 7h-9"></path>\n <path d="M14 17H5"></path>\n <circle cx="17" cy="17" r="3"></circle>\n <circle cx="7" cy="7" r="3"></circle>\n </svg>\n '};var St;(function(t){t.IDLE="idle",t.LOADING_INITIAL="loading_initial",t.LOADING_MORE="loading_more",t.ERROR="error"})(St||(St={}));class ProductListComponent extends BaseComponent{get hostClasses(){const t=["product-list"];return this.params.filters.length>0&&t.push("has-filters"),t}constructor(){super({watchOnlyStorePaths:["address"]}),this.products=[],this.retailers={},this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.filters=[],this.searchFilter={searchTerm:""},this.currentFilters={personalized:![],preOrder:![],deliveryOptions:"all",price:{min:"0",max:"1000"}},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.sentinelElement=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels=new Map,this.loadingState=St.IDLE,this.scrollObserver=null,this.initializationPromise=null,this.filterDebounceTimer=null,this.FILTER_DEBOUNCE_MS=500,this.filterButton=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise}disconnectedCallback(){super.disconnectedCallback(),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(St.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(St.IDLE)}catch(et){this.logger.error("Error initializing product list:",et),this.setLoadingState(St.ERROR),this.showErrorState("Failed to load products")}}template(){const t=[],e=document.createElement("div");e.className="product-list-search__control-container",e.appendChild(this.createSearchContainer()),t.push(e),this.params.filters.length>0&&(this.filterButton=this.createFilterButton(),t.push(this.filterButton));const n=document.createElement("div");return n.className="product-list-controls",this.params.filters.length>0&&n.appendChild(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),n.appendChild(this.cardsContainer),t.push(n),this.renderCurrentState(),t}setLoadingState(t){this.loadingState=t,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case St.LOADING_INITIAL:this.renderLoadingState();break;case St.ERROR:break;case St.IDLE:case St.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){var t,e;try{const n=this.buildApiParams(0),i=await this.commands.productList.getProductList(n);this.filters=(null===(t=i.navigation)||void 0===t?void 0:t.filters)||[],this.products=i.products||[],this.retailers=i.retailers||{},this.updatePagination(i.navigation),this.syncFiltersFromResponse((null===(e=i.navigation)||void 0===e?void 0:e.filters)||[]),this.updateFiltersComponent()}catch(n){throw this.products=[],this.retailers={},this.pagination.hasMorePages=![],n}}updateFiltersComponent(){if(!this.filtersContainer||0===this.params.filters.length)return;const t=this.filtersContainer.parentElement;if(!t)return;const e=this.filtersContainer;this.filtersContainer=this.createFiltersContainer(),t.replaceChild(this.filtersContainer,e)}async loadMoreProducts(){var t;if(this.loadingState!==St.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(St.LOADING_MORE);const e=this.pagination.currentPage+1,n=this.buildApiParams(e),i=await this.commands.productList.getProductList(n);this.filters=(null===(t=i.navigation)||void 0===t?void 0:t.filters)||[],i.products&&i.products.length>0?(this.products.push(...i.products),this.mergeRetailers(i.retailers||{}),this.updatePagination(i.navigation),this.appendNewProducts(i.products)):(this.pagination.hasMorePages=![],this.updatePagination(i.navigation)),this.setLoadingState(St.IDLE)}catch(e){this.logger.error("Error loading more products:",e),this.setLoadingState(St.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(t){for(const[e,n]of Object.entries(t))this.retailers[e]||(this.retailers[e]=n)}updatePagination(t){var e,n,i,r;t&&(this.pagination={currentPage:null!==(e=t.currentPage)&&void 0!==e?e:0,totalPages:null!==(n=t.totalPages)&&void 0!==n?n:0,hasMorePages:(null!==(i=t.currentPage)&&void 0!==i?i:0)<(null!==(r=t.totalPages)&&void 0!==r?r:1)-1})}buildApiParams(t){const e={page:t,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()};return this.searchFilter.searchTerm&&this.searchFilter.searchTerm.trim().length>0&&(e.search=this.searchFilter.searchTerm.trim()),e}buildFiltersFromState(){const t=[{key:"availability",values:"IN_STOCK"}];if(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]}),this.currentFilters.price){const e={};"0"!==this.currentFilters.price.min&&(e.min=this.currentFilters.price.min),"1000"!==this.currentFilters.price.max&&(e.max=this.currentFilters.price.max),Object.keys(e).length>0&&t.push({key:"price",values:e})}const e=Object.keys(this.currentFilters).filter(t=>!["personalized","preOrder","deliveryOptions","price"].includes(t));for(const n of e){const e=this.currentFilters[n];Array.isArray(e)&&e.length>0&&t.push({key:n,values:e})}return t}syncFiltersFromResponse(t){if(t)for(const e of t)switch(e.key){case"engraving":this.currentFilters.personalized="YES"===e.values;break;case"presale":this.currentFilters.preOrder="YES"===e.values;break;case"fulfillment":Array.isArray(e.values)&&(e.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":e.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(St.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(St.IDLE)}catch(et){this.logger.error("Error handling filter change:",et),this.setLoadingState(St.ERROR),this.showErrorState("Error updating filters")}}resetPagination(){this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]}}updateFiltersUI(){this.filtersContainer&&(this.updatePersonalizedSwitch(),this.updatePreOrderSwitch(),this.updateDeliveryOptions())}updatePersonalizedSwitch(){this.personalizedSwitch&&(this.personalizedSwitch.checked=this.currentFilters.personalized,this.personalizedSwitch.disabled=this.isPersonalizationDisabled())}updatePreOrderSwitch(){this.preOrderSwitch&&(this.preOrderSwitch.checked=this.currentFilters.preOrder,this.preOrderSwitch.disabled=this.isPreOrderDisabled())}updateDeliveryOptions(){0!==this.deliveryRadios.length&&this.deliveryRadios.forEach(t=>{const e="onDemand"===t.value&&this.isSameDayDeliveryDisabled();t.disabled=e,e&&"onDemand"===t.value||(t.checked=t.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(t,e)})}updateRadioLabel(t,e){const n=this.deliveryRadioLabels.get(t.id);n&&(n.className="product-list-filters-delivery-radio-label "+(e?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}createCardsContainer(){const t=document.createElement("div");t.className="product-list-cards__container";const e=100/this.params.columns;return t.style.setProperty("--card-width",e+"%"),t.style.setProperty("--columns",""+this.params.columns),t}getResponsiveColumns(){const t=window.innerWidth;return t<=639?1:t<=767?Math.min(this.params.columns,2):t<=1023?Math.min(this.params.columns,3):this.params.columns}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const t=ComponentFactoryService.createElement({type:r.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.getResponsiveColumns(),fillCard:this.params.fillCard,filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(t)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const t=this.createInfoElement("No products found");return this.cardsContainer.appendChild(t),void 0}for(const t of this.products){const e=this.createProductCard(t);e&&this.cardsContainer.appendChild(e)}}}appendNewProducts(t){if(this.cardsContainer&&0!==t.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const e of t){const t=this.createProductCard(e);t&&this.cardsContainer.appendChild(t)}this.sentinelElement?(this.cardsContainer.appendChild(this.sentinelElement),this.updateSentinel(),this.scrollObserver&&this.pagination.hasMorePages&&this.scrollObserver.observe(this.sentinelElement)):this.pagination.hasMorePages&&this.setupInfiniteScroll()}}createProductCard(t){try{const e=Object.values(t.sizes)[0];if(!e)return this.logger.warn("Product "+t.id+" has no sizes"),null;const n=Object.values(e.shippingVariants)[0];if(!n)return this.logger.warn("Product "+t.id+" has no variants"),null;const i=this.retailers[n.retailerId];return i?ComponentFactoryService.createElement({type:r.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:t,shippingFulfillment:i.shippingFulfillment,onDemandFulfillment:i.onDemandFulfillment,productUrl:this.params.productUrl}):(this.logger.warn("Retailer "+n.retailerId+" not found for product "+t.id),null)}catch(e){return this.logger.error("Error creating product card for product "+t.id+":",e),null}}filterSanitizedFilters(){if(!this.params.filters||0===this.params.filters.length)return[];const e={[t.BRANDS]:d.BRANDS,[t.CATEGORIES]:d.CATEGORIES,[t.FLAVOR]:d.FLAVOR,[t.REGION]:d.REGION,[t.VARIETY]:d.VARIETY,[t.VINTAGE]:d.VINTAGE,[t.COUNTRY]:d.COUNTRY,[t.APPELLATION]:d.APPELLATION,[t.MATERIALS]:d.MATERIALS,[t.SIZES]:d.SIZES};return this.filters.filter(t=>{const n=e[t.filterCategory];return n&&this.params.filters.includes(n)})}buildFiltersParams(t=![]){const C=async()=>{this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()};return{enablePersonalized:this.params.filters.includes(d.PERSONALIZATION),enablePreOrder:this.params.filters.includes(d.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(d.DELIVERY_OPTIONS),currentFilters:this.currentFilters,sanitizedFilters:this.filterSanitizedFilters(),priceConfig:this.params.filters.includes(d.PRICE)?{min:"0",max:"1000"}:void 0,onPersonalizedChange:async e=>{this.currentFilters.personalized=e,t||await this.onFilterChange()},onPreOrderChange:async e=>{this.currentFilters.preOrder=e,t||await this.onFilterChange()},onDeliveryOptionsChange:async e=>{this.currentFilters.deliveryOptions=e,"onDemand"===e&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),t||await this.onFilterChange()},onPriceChange:async(e,n)=>{this.currentFilters.price||(this.currentFilters.price={}),"0"!==e?this.currentFilters.price.min=e:delete this.currentFilters.price.min,"1000"!==n?this.currentFilters.price.max=n:delete this.currentFilters.price.max,t||(this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS))},onCheckboxFilterChange:async(e,n)=>{n.length>0?this.currentFilters[e]=n:delete this.currentFilters[e],t||await this.onFilterChange()},isDrawerMode:t,onApplyFilters:async()=>{await C()}}}createSearchContainer(){return this.searchContainer=ComponentFactoryService.createElement({type:r.PRODUCT_LIST_SEARCH,searchTerm:this.searchFilter.searchTerm,handleInputChange:async t=>{this.searchFilter.searchTerm=t,this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS)},clearSearch:async()=>{this.searchFilter.searchTerm="",this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()}}),this.searchContainer}createFiltersContainer(t={}){const{isDrawerMode:e=![]}=t;return this.filtersContainer=ComponentFactoryService.createElement({type:r.PRODUCT_LIST_FILTERS,...this.buildFiltersParams(e)}),this.storeFilterElementReferences(),this.filtersContainer}storeFilterElementReferences(){if(!this.filtersContainer)return;this.personalizedSwitch=this.filtersContainer.querySelector("#personalized-switch"),this.preOrderSwitch=this.filtersContainer.querySelector("#pre-order-switch");const t=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(t),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(t=>{var e;const n=null===(e=this.filtersContainer)||void 0===e?void 0:e.querySelector('label[for="'+t.id+'"]');n&&this.deliveryRadioLabels.set(t.id,n)})}openFiltersDrawer(){this.commands.ui.openDrawer(r.PRODUCT_LIST_FILTERS,this.buildFiltersParams(!![]))}createFilterButton(){const t=document.createElement("div");t.className="product-list-filter-container";const e=document.createElement("div");e.className="product-list-filter-icon",e.innerHTML=FilterIcon({}),e.addEventListener("click",()=>{this.openFiltersDrawer()});const n=document.createElement("span");return n.className="product-list-filter-text",n.textContent="Filter",t.appendChild(e),t.appendChild(n),t}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(t=>{const e=t[0];e.isIntersecting&&this.loadingState===St.IDLE&&this.pagination.hasMorePages&&void this.loadMoreProducts()},{root:null,rootMargin:"100px",threshold:.1}),this.scrollObserver.observe(this.sentinelElement))}createScrollSentinel(){const t=document.createElement("div");return t.className="product-list-scroll-sentinel",this.updateSentinelContent(t),t}updateSentinel(){this.sentinelElement&&this.updateSentinelContent(this.sentinelElement)}updateSentinelContent(t){let e;t.innerHTML="",e=this.loadingState===St.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),t.appendChild(e)}showSentinelError(t){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const e=this.createErrorElement(t);this.sentinelElement.appendChild(e)}createLoadingElement(t){const e=document.createElement("div");e.className="product-list-sentinel-container";const n=document.createElement("div");n.className="product-list-sentinel-spinner";const i=document.createElement("div");return i.className="product-list-sentinel-text",i.textContent=t,e.appendChild(n),e.appendChild(i),e}createErrorElement(t){const e=document.createElement("div");e.className="product-list-sentinel-error-container";const n=document.createElement("div");n.className="product-list-sentinel-error-icon",n.innerHTML="⚠";const i=document.createElement("div");return i.className="product-list-sentinel-error-text",i.textContent=t,e.appendChild(n),e.appendChild(i),e}createInfoElement(t,e=![]){const n=document.createElement("div");if(n.className="product-list-sentinel-info-container",!e&&t.includes("Scroll")){const t=document.createElement("div");t.className="product-list-sentinel-icon",t.innerHTML="↓",n.appendChild(t)}else if(e){const t=document.createElement("div");t.className="product-list-sentinel-divider",n.appendChild(t)}const i=document.createElement("div");return i.className=e?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",i.textContent=t,n.appendChild(i),n}showErrorState(t){if(!this.cardsContainer)return;this.clearCardsContainer();const e=this.createErrorElement(t);this.cardsContainer.appendChild(e)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}async onStoreWatch(t){const e=t.find(t=>"address"===t.path);if(e&&void 0!==e.value&&this.cardsContainer)try{this.resetPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(n){this.logger.error("Error reloading products after address change:",n),this.setLoadingState(St.ERROR),this.cardsContainer&&this.showErrorState("Failed to reload products")}}doCleanup(){this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),this.cleanupScrollObserver(),this.products=[],this.retailers={},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.filterButton=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels.clear(),this.initializationPromise=null}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,e;const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],i=null!==(e=this.params.showFirstEvent)&&void 0!==e?e:!![];if(n){const t=this.store.get(this.params.errorStorePath)||[],e=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return i?e.slice(0,1):e}const r=this.store.get(this.params.errorStorePath);return r?[{message:r,level:"error"}]:[]}createErrorElement(t){const e=document.createElement("div");e.classList.add("alert-container","alert-"+t.level);const n=document.createElement("span");n.classList.add("alert-icon"),n.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const i=document.createElement("span");return i.classList.add("alert-text"),i.textContent=t.message,e.appendChild(n),e.appendChild(i),e}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const e=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},e)}hideAllErrors(){var t;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[];const e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];e?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(r.CART)});const e=document.createElement("span");if(e.className="lce-cart-button-icon",e.innerHTML=BagIcon({color:t.theme.primaryColor}),this.params.showItemsCount){const t=document.createElement("span");return t.className="lce-cart-button-badge",t.style.visibility="hidden",[e,t]}return[e]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const e=this.getStoreValue("cart.itemsQuantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden",this.store.watch("cart.itemsQuantity",()=>{const e=this.getStoreValue("cart.itemsQuantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var e;const n=t.find(t=>"ui.drawer"===t.path);if(!n)return![];const i=n.value,r=i.isOpen,s=null===(e=i.contentConfig)||void 0===e?void 0:e.type,a=s!==this.currentContentType;return r&&!this.isOpen?(this.currentContentType=s,this.openWithContent(i),![]):r&&this.isOpen&&!a?![]:r&&this.isOpen&&a?(this.currentContentType=s,this.openWithContent(i),![]):!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:e,data:n}=t||{};let i;i=this.isElementsEnabled()?ComponentFactoryService.createElement({type:e,...n}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(i,e):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(i),this.updateDrawerContentTypeClass(e),this.open()),this.addHostAttribute("data-target",e.toString().toLowerCase())}catch(e){this.logger.error("Drawer content loading failed",e),this.commands.ui.closeDrawer()}}animateContentSwap(t,e){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const n=this.contentContainer.firstElementChild;n.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{n.classList.add("fading")}),setTimeout(()=>{n.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(e),requestAnimationFrame(()=>{t.classList.add("visible"),setTimeout(()=>{t.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(t){if(!this.drawerElement)return;const e=["drawer"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.drawerElement.className=e.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",e),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["engraving-form"]}beforeConnected(){var t;if(this.engravingLines=this.params.lines,"product"===this.params.context){const e=this.store.get("products."+this.params.identifier);this.fulfillmentId=e.selectedFulfillmentId,this.partNumber=(null===(t=e.selectedFulfillment)||void 0===t?void 0:t.variant.partNumber)||null}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,e;if("product"===this.params.context){const n=this.store.get("products."+this.params.identifier),i=n.sizes[n.selectedSizeId],r=i.shippingFulfillments[this.fulfillmentId],s=r.variant.price,a=(null===(e=null===(t=null==i?void 0:i.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.fee)||0;return s+a}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier),e=t.unitPrice,n=t.attributes.engraving.fee||0;return e+n}return 0}productInformationSection(){const t=[];let e="",n="";if("product"===this.params.context){const i=this.store.get("products."+this.params.identifier);i.sizes[i.selectedSizeId].image?t.push(i.sizes[i.selectedSizeId].image):t.push(...i.images||[]),e=i.name,n=i.sizes[i.selectedSizeId].size}if("cart"===this.params.context){const i=this.store.get("cart.items."+this.params.identifier);i.mainImage&&t.push(i.mainImage),e=i.name,n=i.size}const i=document.createElement("div");if(i.className="product-info-section",t.length>0){const n=document.createElement("div");n.className="product-image-container";const r=document.createElement("img");r.src=t[0],r.alt=e,r.loading="lazy",r.className="product-image",n.appendChild(r),i.appendChild(n)}const r=document.createElement("div");r.className="product-details-container";const s=document.createElement("div");s.className="product-header";const a=document.createElement("h4");a.className="product-title",a.textContent=e,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),s.appendChild(a),s.appendChild(this.productPriceSpan),r.appendChild(s);const c=document.createElement("p");c.className="product-size-text",c.textContent=n,r.appendChild(c);const l=document.createElement("p");return l.className="engraving-fees-disclaimer",l.textContent="Personalization fees included in total, varies by retailer.",r.appendChild(l),i.appendChild(r),i}addToCartButtonText(t){if("product"!==this.params.context)return"Save";const e=this.getConfigs("product"),n=e.layout.addToCartButtonText;return e.layout.addToCartButtonShowTotalPrice?n+" - "+formatCentToDollarText(t):n}retailersSection(){var t,e,n,i,r,s,a;const c=this.store.get("products."+this.params.identifier),l=c.sizes[c.selectedSizeId],d=Object.values(l.shippingFulfillments).filter(t=>t.variant.isEngravable),h=document.createElement("div");h.className="fulfillment-section";const u=document.createElement("p");if(u.className="shipping-from-text",u.innerHTML="Shipping from: <b>"+(null===(t=c.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",h.appendChild(u),1===d.length)return h;const m=document.createElement("div");m.className="fulfillment-options-container",h.appendChild(m);const f=document.createElement("span");f.className="see-more-fulfillments",f.textContent="See More Delivery Options ("+d.length+")",f.setAttribute("role","button"),f.setAttribute("tabindex","0"),f.setAttribute("aria-label","See More Delivery Options ("+d.length+")"),f.setAttribute("aria-expanded","false");const Y=()=>{const t=m.classList.contains("expanded");m.classList.toggle("expanded"),t?(f.textContent="See More Delivery Options ("+d.length+")",f.setAttribute("aria-label","See More Delivery Options ("+d.length+")"),f.setAttribute("aria-expanded","false")):(f.textContent="See Less Delivery Options",f.setAttribute("aria-label","See Less Delivery Options"),f.setAttribute("aria-expanded","true"))};f.addEventListener("click",Y),f.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Y())}),h.appendChild(f);for(const g of d){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",g.id),g.id===(null===(e=c.selectedFulfillment)||void 0===e?void 0:e.id)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+g.retailerName+", "+formatCentToDollarText(g.variant.price+((null===(i=null===(n=c.sizes[c.selectedSizeId].attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.fee)||0))+", "+g.engravingExpectationText),t.setAttribute("aria-pressed",g.id===(null===(r=c.selectedFulfillment)||void 0===r?void 0:r.id)?"true":"false");const R=()=>{this.fulfillmentId=g.id,this.partNumber=g.variant.partNumber;const e=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(e),this.productPriceSpan.textContent=formatCentToDollarText(e);const n=m.querySelector(".fulfillment-option.selected");n&&(n.classList.remove("selected"),n.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),u.innerHTML="Shipping from: <b>"+g.retailerName+"</b>"};t.addEventListener("click",R),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),R())});const l=g.variant.price+((null===(a=null===(s=c.sizes[c.selectedSizeId].attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.fee)||0),d=document.createElement("div");d.className="option-row row-1",t.appendChild(d);const h=document.createElement("span");h.className="retailer-name",h.textContent=g.retailerName,d.appendChild(h);const f=document.createElement("span");f.className="fulfillment-price",f.textContent=formatCentToDollarText(l),d.appendChild(f),t.appendChild(d);const v=document.createElement("div");v.className="option-row row-2",t.appendChild(v);const y=document.createElement("span");y.className="estimated-time",y.textContent=""+g.engravingExpectationText,v.appendChild(y),t.appendChild(v),m.appendChild(t)}return h}engravingLinesSection(){var t;const{lines:e,maxLines:n,location:i,maxCharsPerLine:r}=this.params,s=document.createElement("div");s.className="engraving-section";const a=document.createElement("p");if(a.className="engraving-title",a.textContent="Personalize Your Bottle",s.appendChild(a),i&&(null===(t=null==i?void 0:i.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-location-text",t.textContent="Your message will appear "+i.toLowerCase()+".",s.appendChild(t)}const c=Array.from({length:n},(t,n)=>{const i=n+1,s=document.createElement("div");s.className="engraving-input-wrapper",s.setAttribute("data-line-number",i.toString());const a=document.createElement("input");a.type="text",a.id="engraving-line-"+i,a.dataset.lineNumber=i.toString(),a.maxLength=r,a.value=e[n]||"",a.placeholder=i>1?"Line "+i+" (optional)":"Line "+i,a.className="engraving-input",a.autocomplete="off",a.setAttribute("aria-label",i>1?"Engraving line "+i+", optional, maximum "+r+" characters":"Engraving line "+i+", maximum "+r+" characters");const c=document.createElement("span");return c.className="engraving-char-count",c.textContent=a.value.length+"/"+r,c.setAttribute("aria-live","polite"),c.setAttribute("aria-atomic","true"),a.addEventListener("input",()=>{c.textContent=a.value.length+"/"+r,this.engravingLines[n]=a.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),s.appendChild(a),s.appendChild(c),s}),l=document.createElement("div");return l.className="engraving-inputs-container",l.append(...c),s.appendChild(l),s}actionButtonsSection(){const{identifier:t,context:e}=this.params,n=document.createElement("div");n.className="action-buttons-container";const i=document.createElement("button");i.type="button",i.className="cancel-action-button",i.textContent="Cancel",i.setAttribute("aria-label","Cancel personalization and close");const z=async()=>{"product"===e&&await this.commands.product.closeProductDrawer(t),"cart"===e&&this.commands.ui.openDrawer(r.CART)};i.addEventListener("click",z),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),z())}),n.appendChild(i),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===e?"Add personalized item to cart":"Update personalization and return to cart");const J=async()=>{const n=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);"product"===e&&this.fulfillmentId&&this.partNumber&&(await this.commands.product.addToCart(t,{fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:n,identifier:t}),await this.commands.product.closeProductDrawer(t)),"cart"===e&&(await this.commands.cart.updateItemEngraving(t,n),this.commands.ui.openDrawer(r.CART))};return this.addToCartButton.addEventListener("click",J),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),J())}),n.appendChild(this.addToCartButton),n}template(){const t=[],e=this.productInformationSection();if(t.push(e),"product"===this.params.context){const e=this.retailersSection();t.push(e)}const n=this.engravingLinesSection();t.push(n);const i=this.actionButtonsSection();t.push(i);const 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 e=this.getStoreValue("cart.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,i=(null==e?void 0:e.quantity)||1;return{quantity:i,fee:n,total:n*i}}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,i=(null==e?void 0:e.quantity)||1;return{quantity:i,fee:n,total:n*i}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,e,n,i,s,a,c,l,d,h,u,m,f,g,v,y,b,x,w,S;const E=this.params.identifier,_={identifier:E,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const r=this.getStoreValue("cart.items."+E);_.lines=(null===(e=null===(t=null==r?void 0:r.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.lines)||[],_.maxLines=(null===(i=null===(n=null==r?void 0:r.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.maxLines)||1,_.maxCharsPerLine=(null===(a=null===(s=null==r?void 0:r.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.maxCharsPerLine)||16,_.fee=(null===(l=null===(c=null==r?void 0:r.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.fee)||0,_.location=(null===(h=null===(d=null==r?void 0:r.attributes)||void 0===d?void 0:d.engraving)||void 0===h?void 0:h.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+E);_.lines=(null===(m=null===(u=null==t?void 0:t.attributes)||void 0===u?void 0:u.engraving)||void 0===m?void 0:m.lines)||[],_.maxLines=(null===(g=null===(f=null==t?void 0:t.attributes)||void 0===f?void 0:f.engraving)||void 0===g?void 0:g.maxLines)||1,_.maxCharsPerLine=(null===(y=null===(v=null==t?void 0:t.attributes)||void 0===v?void 0:v.engraving)||void 0===y?void 0:y.maxCharsPerLine)||16,_.fee=(null===(x=null===(b=null==t?void 0:t.attributes)||void 0===b?void 0:b.engraving)||void 0===x?void 0:x.fee)||0,_.location=(null===(S=null===(w=null==t?void 0:t.attributes)||void 0===w?void 0:w.engraving)||void 0===S?void 0:S.location)||""}this.commands.ui.openDrawer(r.ENGRAVING_FORM,_)}async handleRemove(){const t=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(t,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(t)}template(){const t=this.engravingQuantityFee(),e=this.engravingLines();if(0===e.length)return"";const n=document.createElement("div");n.className="engraving-header";const i=document.createElement("h3");i.textContent="Personalization";const 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 e=document.createElement("span");e.className="engraving-fee-each",e.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",r.appendChild(e)}n.appendChild(i),n.appendChild(r);const s=document.createElement("div");s.className="engraving-body";const a=document.createElement("div");a.className="engraving-lines";for(const d of e){const t=document.createElement("span");t.className="engraving-line",t.textContent=d,a.appendChild(t)}const c=document.createElement("div");c.className="engraving-actions";const l=document.createElement("button");l.type="button",l.classList.add("remove-button"),l.textContent="Remove",l.setAttribute("aria-label","Remove engraving");const P=async()=>{await this.handleRemove()};if(l.addEventListener("click",P),l.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await P())}),c.appendChild(l),"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())}),c.appendChild(t)}return s.appendChild(a),s.appendChild(c),[n,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()}),this.monthInput.addEventListener("blur",()=>{this.padMonthOnBlur(),this.validateInput()}),this.dayInput.addEventListener("blur",()=>{this.padDayOnBlur(),this.validateInput()}),this.yearInput.addEventListener("blur",()=>{this.validateInput()});const t=[this.monthInput,this.dayInput,this.yearInput];for(const e of t)e.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length){const t=Number.parseInt(n,10);t>=2&&t<=9&&(n="0"+n)}else if(2===n.length){const t=Number.parseInt(n,10);t>12?n="12":t<1&&"00"!==n&&(n="01")}e.value=n}formatDay(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length){const t=Number.parseInt(n,10);t>=4&&t<=9&&(n="0"+n)}else if(2===n.length){const t=Number.parseInt(n,10);t>31?n="31":t<1&&"00"!==n&&(n="01")}e.value=n}formatYear(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>4&&(n=n.substring(0,4)),e.value=n}padMonthOnBlur(){const t=this.monthInput.value;if(1===t.length){const e=Number.parseInt(t,10);if(e>=0&&e<=9&&(this.monthInput.value="0"+t,this.params.onChange)){const t=this.getFormattedValue();this.params.onChange(t)}}}padDayOnBlur(){const t=this.dayInput.value;if(1===t.length){const e=Number.parseInt(t,10);if(e>=0&&e<=9&&(this.dayInput.value="0"+t,this.params.onChange)){const t=this.getFormattedValue();this.params.onChange(t)}}}handleNavigation(t,e){const n=t.target,i=n===this.yearInput?4:2;n.value.length===i&&e&&e.focus()}handleChange(){if(this.clearErrors(),this.scheduleValidation(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}isFieldsComplete(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value;return 2===t.length&&2===e.length&&4===n.length}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldsComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}getFormattedValue(){const t=this.monthInput.value.padStart(2,"0"),e=this.dayInput.value.padStart(2,"0"),n=this.yearInput.value;return t&&e&&n&&4===n.length?n+"-"+t+"-"+e:""}validateDate(t,e,n){if(!t||!e||!n||4!==n.length)return![];const i=Number.parseInt(t,10),r=Number.parseInt(e,10),s=Number.parseInt(n,10);if(i<1||i>12||r<1||r>31||s<1e3)return![];const a=new Date(s,i-1,r);return a.getFullYear()===s&&a.getMonth()===i-1&&a.getDate()===r}calculateAge(t){const e=new Date;let n=e.getFullYear()-t.getFullYear();const i=e.getMonth()-t.getMonth();return(i<0||0===i&&e.getDate()<t.getDate())&&n--,n}validateInput(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value,i=[],r=this.params.validation;if(!r)return this.showErrors([]),!![];const s=2===t.length&&2===e.length&&4===n.length,a=t||e||n;if(r.required&&!a)i.push("Please enter a complete date (MM/DD/YYYY)");else if(a&&!s)i.push("Please enter a complete date (MM/DD/YYYY)");else if(s)if(this.validateDate(t,e,n)){const s=Number.parseInt(t,10),a=Number.parseInt(e,10),c=Number.parseInt(n,10),l=new Date(c,s-1,a);if(void 0!==r.minYear&&c<r.minYear&&i.push("Year must be "+r.minYear+" or later"),void 0!==r.maxYear&&c>r.maxYear&&i.push("Year must be "+r.maxYear+" or earlier"),void 0!==r.minAge||void 0!==r.maxAge){const t=this.calculateAge(l);void 0!==r.minAge&&t<r.minAge&&i.push("Must be at least "+r.minAge+" years old"),void 0!==r.maxAge&&t>r.maxAge&&i.push("Must be no more than "+r.maxAge+" years old")}if(r.customValidator){const t=r.customValidator(this.getFormattedValue());t&&i.push(t)}}else i.push("Please enter a valid date");this.showErrors(i);const c=0===i.length;return this.params.onValidation&&this.params.onValidation(c,i),c}showErrors(t){this.errorContainer.innerHTML="";const e=[this.monthInput,this.dayInput,this.yearInput];if(t.length>0){this.errorContainer.classList.add("show");for(const t of e)t.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else for(const n of e)n.classList.remove("input-error")}clearErrors(){const t=[this.monthInput,this.dayInput,this.yearInput],e=t.some(t=>t.classList.contains("input-error"));if(e){for(const e of t)e.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(t){if(t){const e=t.split("/");3===e.length&&(this.monthInput.value=e[0],this.dayInput.value=e[1],this.yearInput.value=e[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name+"-month"),e.push(n)}const n=document.createElement("div");n.className="date-input-container";const i=document.createElement("input");i.type="text",i.placeholder="MM",i.name=this.params.name+"-month",i.id=this.params.name+"-month",i.maxLength=2,i.className="date-field month-field",i.setAttribute("data-field","month"),i.inputMode="numeric";const 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 a=document.createElement("span");a.className="date-separator",a.textContent="/";const c=document.createElement("input");c.type="text",c.placeholder="YYYY",c.name=this.params.name+"-year",c.id=this.params.name+"-year",c.maxLength=4,c.className="date-field year-field",c.setAttribute("data-field","year"),c.inputMode="numeric",this.params.disabled&&(i.disabled=!![],s.disabled=!![],c.disabled=!![]),this.params.className&&(n.className+=" "+this.params.className),n.appendChild(i),n.appendChild(r),n.appendChild(s),n.appendChild(a),n.appendChild(c);const l=document.createElement("div");return l.className="error-container",e.push(n),e.push(l),e}}class InputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}handlePhoneKeydown(t){if("Backspace"===t.key){const e=t.target,n=e.selectionStart||0,i=e.value;n>0&&/\D/.test(i[n-1])&&setTimeout(()=>{const t=Math.max(0,n-2);e.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>10&&(n=n.substring(0,10)),n.length>=6?n="("+n.substring(0,3)+") "+n.substring(3,6)+"-"+n.substring(6):n.length>=3&&(n="("+n.substring(0,3)+") "+n.substring(3)),e.value=n}formatDate(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>8&&(n=n.substring(0,8)),n.length>=5?n=n.substring(0,2)+"/"+n.substring(2,4)+"/"+n.substring(4):n.length>=3&&(n=n.substring(0,2)+"/"+n.substring(2)),e.value=n}validateEmail(t){const e=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return e.test(t)}validateTel(t){const e=/^\(\d{3}\) \d{3}-\d{4}$/;return e.test(t)}validateDate(t){const e=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!e.test(t))return![];const[n,i,r]=t.split("/").map(Number),s=new Date(r,n-1,i);return s.getFullYear()===r&&s.getMonth()===n-1&&s.getDate()===i}isFieldComplete(){var t,e,n;const i=this.inputElement.value.trim();if(!i)return![];switch(this.params.inputType){case"tel":return this.validateTel(i);case"date":return this.validateDate(i);case"email":return i.includes("@")&&(null===(t=i.split("@")[1])||void 0===t?void 0:t.includes("."));case"number":return!Number.isNaN(Number.parseFloat(i));default:return(null===(e=this.params.validation)||void 0===e?void 0:e.max)&&i.length>=this.params.validation.max||(null===(n=this.params.validation)||void 0===n?void 0:n.min)&&i.length>=this.params.validation.min?!![]:i.length>=3}}validateInput(){const t=this.inputElement.value,e=[],n=this.params.validation;if(!n)return this.showErrors([]),!![];if(n.required&&!t.trim()&&e.push("This field is required"),!n.required&&!t.trim())return this.showErrors([]),!![];if(t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||e.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||e.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(t)||e.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const i=Number.parseFloat(t);Number.isNaN(i)?t.trim()&&e.push("Please enter a valid number"):(void 0!==n.min&&i<n.min&&e.push("Value must be at least "+n.min),void 0!==n.max&&i>n.max&&e.push("Value must be no more than "+n.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==n.min&&t.length<n.min&&e.push("Must be at least "+n.min+" characters"),void 0!==n.max&&t.length>n.max&&e.push("Must be no more than "+n.max+" characters")),n.pattern){const i=new RegExp(n.pattern);i.test(t)||e.push("Invalid format")}if(n.customValidator){const i=n.customValidator(t);i&&e.push(i)}}this.showErrors(e);const i=0===e.length;return this.params.onValidation&&this.params.onValidation(i,e),i}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===this.params.inputType&&this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name),e.push(n)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"===this.params.inputType&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",e.push(this.inputElement),e.push(this.errorContainer),e}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.U=null;const t=ClientConfigService.getInstance();this.V=this.attachShadow({mode:t.get("openShadowDom")?"open":"closed"})}initialize(t,e){if(this.A)return;if(!t||"string"!=typeof t)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(e&&e instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.V)throw new SDKError("LceElementComponent: Shadow DOM container is not available");e&&"function"==typeof e.rerender&&(this.U=t=>{e.rerender(t||"LceElementRerender")}),this.V.appendChild(e),this.applyBasicStyles();const n=ThemeProviderService.getInstance(),i=n.getStylesheet(t);this.applyThemeStyles(i),this.A=!![],this.V=null}rerender(t){this.U&&this.U(t)}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n width: 100%;\n height: auto;\n }\n\n :host([drawer]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const e=new CSSStyleSheet;e.replaceSync(t),this.V.adoptedStyleSheets=[e,...this.V.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(et){this.createFallbackStylesheet(t)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}applyThemeStyles(t){t.forEach(t=>{"string"==typeof t?this.createFallbackStylesheet(t):this.V.adoptedStyleSheets=[...this.V.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const e=document.createElement("style");e.textContent=t,this.V&&this.V.appendChild(e)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const t=document.createElement("div");t.className="pb-title-container";const e=document.createElement("span");e.className="pb-text",e.textContent="Powered by",t.appendChild(e);const n=document.createElement("span");n.className="pb-lc",n.textContent="LiquidCommerce",t.appendChild(n);const i=document.createElement("span");return i.className="pb-dot",i.textContent=".",t.appendChild(i),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const e=this.getDisclaimerConfig();return e.parts.forEach(e=>{"text"===e.type?t.appendChild(document.createTextNode(e.content)):"link"===e.type&&t.appendChild(this.createLink(e.href,e.text))}),t}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(t,e){const n=document.createElement("a");return n.href=t,n.target="_blank",n.rel="noopener noreferrer",n.className="pb-link",n.textContent=e,n.setAttribute("role","link"),n.setAttribute("aria-label","Read "+e),n}template(){const t=this.createPoweredBySection(),e=this.createDisclaimerSection();return[t,e]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!e||!this.applyButton||!this.currentActiveTicker)return;const n=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);n&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!n&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const e=this.store.get("cart.promoCode"),n=this.store.get("checkout.promoCode");return(null==e?void 0:e.code)===t||(null==n?void 0:n.code)===t}getActiveTickers(){var t;const e=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var n;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const e=document.createElement("div");e.classList.add("promo-ticker__text-group");const n=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const i of n){const n=i.trim();if(!n)continue;const r=document.createElement("span");r.classList.add("promo-ticker__text-item"),r.textContent=n,e.appendChild(r);const s=document.createElement("span");s.classList.add("promo-ticker__separator"),s.textContent=t.separator,e.appendChild(s)}return e}async handlePromoClick(){var t;(null===(t=this.currentActiveTicker)||void 0===t?void 0:t.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const t=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(t),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const e=document.createElement("div");e.classList.add("promo-ticker__content");const n=document.createElement("div");n.classList.add("promo-ticker__track");for(let r=0;r<5;r++)n.appendChild(this.generateTextContent(this.currentActiveTicker));e.appendChild(n);const i=document.createElement("button");return i.type="button",i.classList.add("promo-ticker__cta"),i.textContent="APPLY",i.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(i.disabled=!![],i.textContent="APPLIED"),i.addEventListener("click",()=>this.handlePromoClick()),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=i,[e,i]}}class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const e={warning:"warning",success:"success",info:"info"},n={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},i=e[this.params.messageType]||"warning",r=document.createElement("div");return r.className="alert-icon alert-icon-"+this.params.messageType,r.appendChild(htmlStringToElement(n[i]({width:16,height:16,className:"alert-icon-svg"}))),r}template(){var t;const e=[],n=this.getIconElement();n&&e.push(n);const i=document.createElement("span");if(i.className="alert-message",i.textContent=this.params.message,e.push(i),"detailed"===(null===(t=this.config)||void 0===t?void 0:t.alertType)&&this.params.currentTotal){const t=document.createElement("div");t.className="alert-details";const n=document.createElement("small");n.className="alert-details-text",n.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(n),e.push(t)}return e}}const Et=LoggerFactory.get("ElementsClientHelper"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,e){if(!t||!e)return t;const n={...t},i=[];for(const r in e){const s=e[r],a=n[r];if(!(r in t)){i.push('Property "'+r+'" does not exist in target schema, skipping merge.');continue}const c=getType(s),l=getType(a);c===l?isObject(s)&&isObject(a)?n[r]=deepMergeConfigs(a,s):n[r]=s:i.push('Type mismatch for key "'+r+'": source is '+c+", target is "+l+". Skipping merge.")}return i.length>0&&Et.warn("Merging configurations with warnings:",i),n}const _t=new Map([["global.layout.enablePersonalization",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.PRODUCT_INTERACTIONS,r.CART_ITEM,r.CHECKOUT_ITEM]],["global.layout.personalizationText",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW,r.CART_ITEM]],["global.layout.personalizationCardStyle",[r.PRODUCT,r.CART,r.CHECKOUT,r.ENGRAVING_FORM,r.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[r.CART,r.CART_PROMO_CODE,r.CART_FOOTER,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[r.CART,r.CHECKOUT,r.ADDRESS,r.INPUT,r.BIRTHDATE_INPUT,r.ADDRESS_INPUT,r.CHECKOUT_DELIVER_TO,r.CHECKOUT_BUYER,r.CHECKOUT_BILLING,r.CHECKOUT_PAYMENT,r.CART_PROMO_CODE]],["global.layout.showPoweredBy",[r.CART,r.CHECKOUT,r.CHECKOUT_COMPLETED,r.POWERED_BY,r.CART_FOOTER,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[r.POWERED_BY]],["product.layout.showImages",[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[r.PRODUCT]],["product.layout.showDescription",[r.PRODUCT,r.PRODUCT_DESCRIPTION,r.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL,r.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[r.PRODUCT,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION,r.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION,r.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[r.PRODUCT,r.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[r.PRODUCT,r.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[r.CART,r.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[r.CART,r.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[r.CART,r.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[r.CART,r.CART_FOOTER]],["checkout.layout.emailOptIn",[r.CHECKOUT,r.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[r.CHECKOUT,r.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[r.CHECKOUT,r.CHECKOUT_GIFT_CARDS,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[r.CHECKOUT,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[r.CHECKOUT,r.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[r.CHECKOUT,r.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[r.CHECKOUT,r.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[r.CHECKOUT,r.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[r.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,e){const n=new Set;for(const i of Object.keys(e)){const e=_t.get(t+"."+i);if(e)for(const t of e)n.add(t)}return Array.from(n)}class ElementsBaseClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.injectedComponents=new Map,this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authClient=AuthClientService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Failed to prepare client",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",et.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),this.logger.info("🔐 Starting authentication...");const t=await this.authClient.authenticate();if(!t)throw this.clientPrepared=![],new SDKError("Authentication failed. Please try again.",!![]);this.logger.info("✅ Authentication completed"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed"),this.logger.info("⚙️ Loading configurations...");let e=await this.apiClient.getAllConfigs();this.logger.info("✅ Configurations loaded"),this.clientConfig.set("partnerCode",e.configurations.partnerCode),this.clientConfig.set("partnerName",e.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const n=await this.fingerPrintService.getId(e.configurations.partnerCode),i=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",n),this.clientConfig.set("isLocalStorageAvailable",i);const r=i?null:await this.apiClient.getPersistedStore(n);if(await this.store.initialize({userDeviceId:n,isLocalStorageAvailable:i,persistedStore:r}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),n=e.global.layout.showPoweredBy;e=deepMergeConfigs(e,t),e.global.layout.showPoweredBy=n}await this.themeProvider.initialize(e),this.logger.info("✅ Theme provider initialized"),this.logger.info("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.info("✅ Essential components registered"),this.logger.info("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(t){this.logger.error("Heavy initialization failed",t)}},0)}async initializeHeavyServices(){const t=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:t.partnerName,partnerCode:t.partnerCode,enablePartnerGTM:t.enablePartnerGTM,partnerGTMId:t.partnerGTMId||void 0,enableLiquidCommerceGTM:t.enableLiquidCommerceGTM,liquidCommerceGTMId:t.liquidCommerceGTMId}),this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t||"object"!=typeof t)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof t,!![]);const{type:e,containerId:n,...i}=t;if(!n||"string"!=typeof n)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);if(!e)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const s=n.replace("#",""),a=document.getElementById(s);if(!a)return console.warn("Container with ID '"+s+"' not found"),null;a.innerHTML="";const c={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...i},l=ComponentFactoryService.createElement(c);return safeReplaceChildren(a,l),t.type===r.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(s,t.type,l)}async processInjectProduct(t){if(this.ensureAllComponentsRegistered(),0===t.length)throw new SDKError("At least one product is required. Received empty array.",!![]);t.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const e=t.slice(0,20),n=[],i=[];for(const r of e){if(!r||"object"!=typeof r){this.logger.warn("Invalid product parameter: must be an object");continue}if(!r.containerId||"string"!=typeof r.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+r.identifier+"'");continue}const t=r.containerId.replace("#","").trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+r.identifier+"'");continue}const e=document.getElementById(t);if(!e){this.logger.warn("Container with ID '"+t+"' not found for product '"+r.identifier+"'");continue}const i=n.every(e=>e.containerId!==t);if(!i){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!r.identifier||"string"!=typeof r.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+t+"'");continue}const s=n.every(t=>t.identifier!==r.identifier);s?n.push({containerId:t,identifier:r.identifier}):this.logger.warn("Duplicate product identifier '"+r.identifier+"' found, skipping")}for(const s of n){const t=ComponentFactoryService.createElement({type:r.PRODUCT,useShadowDom:!![],productId:s.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(s.containerId);e?(e.innerHTML="",e.appendChild(t),i.push(this.createInjectedComponentWrapper(s.containerId,r.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(n.map(t=>t.identifier)),i}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,r.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(l).includes(t.cardVariant))throw new SDKError('Invalid card variant "'+t.cardVariant+'". Valid options: '+Object.values(l).join(", "),!![]);if(t.filters&&!Array.isArray(t.filters))throw new SDKError("Filters must be an array. Received: "+typeof t.filters,!![]);if(t.filters&&t.filters.length>0){const e=Object.values(d);for(const n of t.filters)if(!e.includes(n))throw new SDKError('Invalid filter "'+n+'". Valid options: '+e.join(", "),!![])}if(t.productUrl&&"string"==typeof t.productUrl&&!t.productUrl.includes("{upc}")&&!t.productUrl.includes("{grouping}"))throw new SDKError('Product URL must include either {upc} or {grouping} placeholder. Received: "'+t.productUrl+'"',!![]);const e=document.getElementById(t.containerId.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list.',!![]);const n=ComponentFactoryService.createElement({type:r.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:t.cardVariant||l.STANDARD,fillCard:t.fillCard||![],rows:t.rows||4,columns:t.columns||4,filters:t.filters||[],productUrl:t.productUrl});safeReplaceChildren(e,n)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:r.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(t,e,n){const i={getType:()=>e,getElement:()=>document.getElementById(t),rerender:()=>{try{n&&"function"==typeof n.rerender?n.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+t+"' does not support rerender")}catch(e){this.logger.warn("Failed to rerender component in container '"+t+"'")}}};return this.injectedComponents.set(t,i),i}rerenderInjectedComponentsByType(t){for(const[e,n]of this.injectedComponents)n.getType()===t&&n.rerender()}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",e),!![]}}injectDisabledElementsError(t,e){const n=document.getElementById(t.replace("#",""));if(!n)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let i;i=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),n.innerHTML="",safeReplaceChildren(n,i)}registerEssentialComponents(){ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(r.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(r.CART,AddressInputComponent),ComponentFactoryService.registerComponent(r.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_SEARCH,ProductListSearchComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(r.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(r.INPUT,InputComponent),ComponentFactoryService.registerComponent(r.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(r.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(r.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(r.ALERT,AlertComponent),ComponentFactoryService.registerComponent(r.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(r.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(r.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(r.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(r.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(r.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(r.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(r.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(r.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(r.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(r.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(r.CART,CartComponent),ComponentFactoryService.registerComponent(r.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(r.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(r.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(r.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(r.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(r.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(r.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(r.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(r.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(r.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(r.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(t,e)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);this.ensureCartDrawerExists();const n=document.getElementById(t.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before adding the cart button.',!![]);const i=ComponentFactoryService.createElement({type:r.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});n.innerHTML="",safeReplaceChildren(n,i)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:r.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(e)},cartSubtotal:t=>{if(!t||"string"!=typeof t)throw new SDKError("Cart subtotal display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const e=document.getElementById(t.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart subtotal.',!![]);e.innerHTML="",e.classList.add("lce-cart-subtotal");const k=t=>{e.textContent=formatCentToDollarText(t)},n=this.store.get("cart.subtotal")||0;k(n),this.store.watch("cart.subtotal",()=>{const t=this.store.get("cart.subtotal")||0;k(t)})},cartItemsCount:(t,e)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);let n=!![];e&&"boolean"==typeof e.hideZero&&(n=e.hideZero);const i=document.getElementById(t.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart items count.',!![]);i.innerHTML="",i.classList.add("lce-cart-items-count");const z=t=>{i.textContent=t.toString(),0===t?(n&&(i.style.visibility="hidden"),i.classList.add("no-items")):(n&&(i.style.visibility="visible"),i.classList.remove("no-items"))},r=this.store.get("cart.itemsQuantity")||0;z(r),this.store.watch("cart.itemsQuantity",()=>{const t=this.store.get("cart.itemsQuantity")||0;z(t)})}}}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);if(!this.isElementsEnabled()){for(const e of t)this.injectDisabledElementsError(e.containerId,r.PRODUCT);return[]}return await this.processInjectProduct(t)}async injectAddressElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:r.ADDRESS,containerId:t,options:e}):(this.injectDisabledElementsError(t,r.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:r.CART,containerId:t}):(this.injectDisabledElementsError(t,r.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:r.CHECKOUT,containerId:t}):(this.injectDisabledElementsError(t,r.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,e){try{SingletonManager.setContext({isBuilder:![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:e.env,isBuilder:![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:e.promoTicker,proxy:e.proxy,development:e.development});const r=i.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 a={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=a;const c=PubSubService.getInstance();return c.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:i.get("version")}),a}catch(i){try{const t=LoggerFactory.get("ElementsClientInit");t.error("Elements Client Initialization failed",i)}catch(r){console.error("[LiquidCommerce Elements] Client initialization failed:",null==i?void 0:i.message)}try{const t=ClientConfigService.getInstance(),e=PubSubService.getInstance();e.publishAction(n.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==i?void 0:i.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(s){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}const Pt={CORE:{MAIN_SCRIPT:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode"},PROMO_TICKER:{CODE:"data-promo-code",TEXT:"data-promo-text",SEPARATOR:"data-promo-separator",ACTIVE_FROM:"data-promo-active-from",ACTIVE_UNTIL:"data-promo-active-until",CODE_PARAM:"data-promo-code-param"},PRODUCT:{PRODUCT:"data-product",CONTAINER:"data-container",PARAM:"data-product-param",FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",LCE_PRODUCT:"data-lce-product"},PRODUCT_LIST:{LIST:"data-liquid-commerce-elements-products-list",SCRIPT:"data-liquid-commerce-elements-products",CARD:"data-card",CARD_FILL:"data-card-fill",ROWS:"data-rows",COLUMNS:"data-columns",FILTERS:"data-filters",PRODUCT_URL:"data-product-url"},CART:{BUTTON:"data-cart-button",BADGE_BUTTON:"data-cart-badge-button",MOBILE_BUTTON:"data-cart-mobile-button",MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",BUTTON_HIDDEN:"data-cart-button-hidden",TOGGLE_BUTTON:"data-lce-cart-toggle-button",ITEMS_COUNT:"data-lce-cart-items-count"},DEVELOPMENT:"data-liquid-commerce-elements-development"};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function generateElementId({prefix:t,index:e}){const n=Math.random().toString(36).substring(2,7),i=void 0!==t?t:"",r=void 0!==e?e:"",s=i&&r?"-":"";return""+i+s+r+n}function pairsFromMainScript(t){const e=[];try{const i=t.getAttributeNames().filter(t=>t.substring(0,12)===Pt.PRODUCT.PRODUCT);for(const r of i)try{const n=r.match(/^data-product(-(.+))?$/),i=(null==n?void 0:n[2])?"-"+n[2]:"",s=""+Pt.PRODUCT.CONTAINER+i;if(t.hasAttribute(s)){const n=t.getAttribute(s),i=t.getAttribute(r);n&&i&&e.push({containerId:n,identifier:i})}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",i)}return e}function pairsFromProductsScript(){const t=[];try{const n=document.querySelectorAll("script["+Pt.PRODUCT_LIST.SCRIPT+"]");for(const i of n)try{const e=JSON.parse(i.textContent||"[]");if(!Array.isArray(e))continue;for(const n of e)n.containerId&&n.identifier&&t.push({containerId:n.containerId,identifier:n.identifier})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",n)}return t}function pairsFromAttributedElements(){const t=[];try{const n=document.querySelectorAll("div["+Pt.PRODUCT.LCE_PRODUCT+"]");let i=0;for(const r of n)try{const e=generateElementId({prefix:"lce-p",index:i});r.setAttribute("id",e);const n=r.getAttribute(Pt.PRODUCT.LCE_PRODUCT);e&&n&&t.push({containerId:e,identifier:n}),i+=1}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",n)}return t}async function addProductToCartViaQueryParam(t,e){try{const i=e.getAttribute(Pt.PRODUCT.PARAM),r=e.getAttribute(Pt.PRODUCT.FULFILLMENT_TYPE_PARAM);if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const a=new URLSearchParams(window.location.search),c=a.get(i);if(!c)return;let l=s.SHIPPING;if(r)if(startsWithLcePrefix(r)){const t=a.get(r);t!==s.ON_DEMAND&&t!==s.SHIPPING||(l=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+r+'" because it does not start with "lce_" prefix.');try{await t.actions.cart.addProduct([{identifier:c,fulfillmentType:l,quantity:1}],!![])}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",i)}}async function addPromoCodeToCartViaQueryParam(t,e){try{const i=e.getAttribute(Pt.PROMO_TICKER.CODE_PARAM);if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const r=new URLSearchParams(window.location.search),s=r.get(i);if(!s)return;try{await t.actions.cart.applyPromoCode(s)}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",i)}}async function setupCartButtonWithPosition(t,e,n,i){var r,s,a;try{const c=n.includes("mobile"),l=c?"mobile":"desktop",d=!c,h=e.getAttribute(n),u=e.getAttribute(i);if(!e.hasAttribute(n)&&!e.hasAttribute(i))return;if(d){if(e.hasAttribute(n)&&!h)return t.ui.floatingCartButton(![]),void 0;if(e.hasAttribute(i)&&!u)return t.ui.floatingCartButton(!![]),void 0}const m=h||u,f=!!u;if(!m)return d&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(f)),void 0;const g=["above","below","replace","inside"],v=m.match(/^(\w+):(.+)$/),y=v&&g.includes(v[1])?v[1]:"inside";let b=v?v[2]:m;/^[#.]/.test(b)||/\s/.test(b)||(b="#"+b);const x=document.querySelector(b);if(!x)return d&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+b+'" not found. Using floating button.'),t.ui.floatingCartButton(f)),void 0;const w=document.createElement("div");switch(w.classList.add("lce-cart-"+l+"-button-container"),w.id=generateElementId({prefix:"lce-cart-"+l+"-btn"}),y){case"above":null===(r=x.parentNode)||void 0===r?void 0:r.insertBefore(w,x);break;case"below":null===(s=x.parentNode)||void 0===s?void 0:s.insertBefore(w,x.nextSibling);break;case"replace":null===(a=x.parentNode)||void 0===a?void 0:a.replaceChild(w,x);break;default:x.appendChild(w)}t.ui.cartButton(w.id,f)}catch(c){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",c)}}async function setupCartButtons(t,e){e.hasAttribute(Pt.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(t,e,Pt.CART.BUTTON,Pt.CART.BADGE_BUTTON),await setupCartButtonWithPosition(t,e,Pt.CART.MOBILE_BUTTON,Pt.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(t){try{const e=document.querySelector("div["+Pt.PRODUCT_LIST.LIST+"]");if(!e)return;const n="lce-products-list-container";e.className="lce-products-list-container",e.id=n;const i=e.getAttribute(Pt.PRODUCT_LIST.CARD)||"standard",r=e.hasAttribute(Pt.PRODUCT_LIST.CARD_FILL),s=Number.parseInt(e.getAttribute(Pt.PRODUCT_LIST.ROWS)||"3",10)||3,a=Number.parseInt(e.getAttribute(Pt.PRODUCT_LIST.COLUMNS)||"4",10)||4,c=e.getAttribute(Pt.PRODUCT_LIST.FILTERS),l=e.getAttribute(Pt.PRODUCT_LIST.PRODUCT_URL)||void 0;let d=[];c&&(d=c.split(",").map(t=>t.trim()).filter(t=>t.length>0)),await t.injectProductList({containerId:n,rows:s,columns:a,cardVariant:i,fillCard:r,filters:d,productUrl:l})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",e)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async t=>{const e=t.detail;if(!e.data.isReady)return;const n=window.elements,i=document.querySelectorAll("["+Pt.CART.TOGGLE_BUTTON+"]");if(i.length>0)for(const s of i)s.addEventListener("click",async t=>{t.stopPropagation(),t.preventDefault(),n.actions.cart.toggleCart()});const r=document.querySelectorAll("["+Pt.CART.ITEMS_COUNT+"]");if(r.length>0){let t=0;for(const e of r){const i=e.getAttribute(Pt.CART.ITEMS_COUNT),r=!(i&&"keep-zero"===i),s=Boolean(null==e?void 0:e.id);let a;s?a=e.id:(a=generateElementId({prefix:"lce-cart-items-count",index:t}),e.id=a),n.ui.cartItemsCount(a,{hideZero:r}),t+=1}}})}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",et)}}function getDevelopmentConfigs(){const t=document.querySelector("script["+Pt.DEVELOPMENT+"]");if(t)try{return JSON.parse(t.textContent||"{}")}catch(e){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",e),void 0}}async function ElementsAutoInitialize(){var t,n,i,r,s,c;try{const c=document.querySelector("script["+Pt.CORE.MAIN_SCRIPT+"]");if(!c)return;const l=c.getAttribute(Pt.CORE.TOKEN),d=c.getAttribute(Pt.CORE.ENV)||e.PRODUCTION,h=c.getAttribute(Pt.CORE.DEBUG_MODE);if(!l)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const u=c.getAttribute(Pt.PROMO_TICKER.CODE),m=c.getAttribute(Pt.PROMO_TICKER.TEXT),f=null!==(t=c.getAttribute(Pt.PROMO_TICKER.SEPARATOR))&&void 0!==t?t:"•",g=null!==(n=c.getAttribute(Pt.PROMO_TICKER.ACTIVE_FROM))&&void 0!==n?n:void 0,v=null!==(i=c.getAttribute(Pt.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==i?i:void 0,y=pairsFromMainScript(c),b=pairsFromProductsScript(),x=pairsFromAttributedElements(),w=[...y,...b,...x],S=u&&m&&g&&v?{promoCode:u,text:m.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:f,activeFrom:null===(r=new Date(g))||void 0===r?void 0:r.toISOString(),activeUntil:null===(s=new Date(v))||void 0===s?void 0:s.toISOString()}:void 0;let E=a.NONE;h&&d!==e.PRODUCTION&&(E=h),setupEventListeners();const _=await Elements(l,{env:d,debugMode:E,promoTicker:S?[S]:void 0,development:getDevelopmentConfigs()});if(!_)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);setupCartButtons(_,c),0!==w.length&&_.injectProductElement(w).catch(t=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",t)}),initializeProductsList(_),addProductToCartViaQueryParam(_,c),addPromoCodeToCartViaQueryParam(_,c)}catch(l){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(c=null==l?void 0:l.message)&&void 0!==c?c:String(l))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",et)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",et)}},50)}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",et)}}class ElementsBuilderClient extends ElementsBaseClient{async updateComponentGlobalConfigs(t){try{if(!t)throw new SDKError("Global configuration object is required.",!![]);if(this.themeProvider.updateComponentGlobalConfigs(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("global.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(e){throw this.logger.error("❌ Failed to update global theme configuration",e),new SDKError("Failed to update global configuration: "+e.message,!![])}}async updateProductComponent(t){try{if(!t)throw new SDKError("Product configuration object is required.",!![]);if(this.themeProvider.updateProductComponent(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts();for(const e of getComponentTypesForLayoutFields("product.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(e){throw this.logger.error("❌ Failed to update product component theme",e),new SDKError("Failed to update product configuration: "+e.message,!![])}}updateCartComponent(t){try{if(!t)throw new SDKError("Cart configuration object is required.",!![]);if(this.themeProvider.updateCartComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.cart.rerenderCart();for(const e of getComponentTypesForLayoutFields("cart.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(e){throw this.logger.error("❌ Failed to update cart component theme",e),new SDKError("Failed to update cart configuration: "+e.message,!![])}}updateCheckoutComponent(t){try{if(!t)throw new SDKError("Checkout configuration object is required.",!![]);if(this.themeProvider.updateCheckoutComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("checkout.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(e){throw this.logger.error("❌ Failed to update checkout component theme",e),new SDKError("Failed to update checkout configuration: "+e.message,!![])}}updateAddressComponent(t){try{if(!t)throw new SDKError("Address configuration object is required.",!![]);this.themeProvider.updateAddressComponent(t),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(e){throw this.logger.error("❌ Failed to update address component theme",e),new SDKError("Failed to update address configuration: "+e.message,!![])}}async injectElement(t){if(!t)throw new SDKError("Element injection requires container ID and type parameters.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(!t.type)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);return await this.processInjectElement(t)}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);return await this.processInjectProduct(t)}async injectAddressElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:r.ADDRESS,containerId:t,options:e})}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:r.CART,containerId:t})}async injectCheckoutElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const n=await this.processInjectElement({type:r.CHECKOUT,containerId:t});if(null==e?void 0:e.simulatePresale){const t=e.presaleExpiresInMinutes||15,n=new Date;n.setMinutes(n.getMinutes()+t),this.store.set("checkout.presale",{isLocked:!![],expiresAt:n.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+t+" minutes")}return n}}async function ElementsBuilder(t,e){try{SingletonManager.setContext({isBuilder:!![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:e.env,isBuilder:!![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:e.promoTicker,proxy:void 0,development:void 0});const r=i.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 a={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=a;const c=PubSubService.getInstance();return c.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:i.get("version")}),a}catch(i){try{const t=LoggerFactory.get("ElementsBuilderClientInit");t.error("Elements Builder Client Initialization failed",i)}catch(r){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==i?void 0:i.message)}try{const t=ClientConfigService.getInstance(),e=PubSubService.getInstance();e.publishAction(n.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==i?void 0:i.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(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=(e,n,i,r,s)=>isSDKError(s,n)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:e,source:n,lineno:i,colno:r,error:s}),!![]):t?t(e,n,i,r,s):![];const e=window.onunhandledrejection;window.onunhandledrejection=t=>{if(t.reason&&isSDKError(t.reason))return console.error("[LiquidCommerce Elements] Unhandled SDK promise rejection:",t.reason),t.preventDefault(),void 0;e&&e.call(window,t)};try{initializeDOMPolyfills()}catch(Dt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Dt)}try{triggerElementsAutoInit()}catch(Tt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Tt)}}catch(It){console.error("[LiquidCommerce Elements] SDK initialization failed:",It)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|