let DEFAULT_addToCartBtnSelectorsApp7Ext='input[name="add"], button[name="add"], form[action*="/cart/add"] .gfg__add-to-cart,form[action*="/cart/add"] button[type="submit"], form[action*="/cart/add"] input[type="submit"], .product-form__buttons, .productView-group, .prd-Benefits, .product__submit__buttons, .t4s-product-form__buttons, .product-form__buy-buttons, .product__description, .v-stack.gap-4, .groups-btn, #MainContent product-form gp-button button[aria-label="Add to cart"], #MainContent product-form .shopify-payment-button__button',DEFAULT_checkoutBtnSelectorsApp7Ext='button[name="checkout"], input[name="checkout"], form[action*="/cart"] a[href="/checkout"], a[href="/checkout"], form[action="/cart"] input[type="submit"][name="checkout"], form[action="/cart"] button[type="submit"][name="checkout"], .previewCartInfo, .cart__ctas, .cart__items, .buy-buttons--compact, .drawer__footer, .ajax-cart__buttons, .taxes-discounts, .button-container, cart-drawer .line-item__content-wrapper, .mini-cart__actions, .cart__checkout-wrapper, .cart__footer-message, .js-contents, .cart--footer',DEFAULT_quantityBtnSelectorsApp7Ext='.ajaxcart__qty,quantity-input .quantity,.quantity-input,.quantity__input,.quantity_input,.quantity,.quantity__container,.quantity_container, .quantity-selector, input[name="quantity"], .cart-item__quantity, .quantity-selector__input, .product-form__qty-input, .product__quantity, .product-quantity, .js-qty__num, .product-details input, .product-form__info-item--quantity, .product__quantity--button .js-qty__num, .product-form__quantity, .quantity__container, .QuantitySelector.QuantitySelector--large, .prd-quantity, .t4s-quantity-wrapper.t4s-product-form__qty, .qty-actual__input, .js-qty__wrapper, .t4s-quantity-wrapper, .t4s-product-form__buttons .t4s-quantity-input, .ProductForm__QuantitySelector, #quantity',DEFAULT_sideCartSelectorsApp7Ext=".cart-notification,cart-notification,.cart-notification-wrapper,#cart-notification, #CartDrawer, .drawer, .drawer-cover, .Drawer",DEFAULT_buyNowBtnApp7Ext=".shopify-payment-button__button, .shopify-payment-button__button--unbranded",DEFAULT_cartFormApp7Ext='form[action="/cart"], form[action="/cart/"], form[action="cart"]';const DEFAULT_sideCartWidgetShowAboveSelectorsApp7Ext=".quick-cart__main-content, #main-cart-items, .cart-item-list, #cart ul, .cart-drawer__line-items, .cart-drawer__items, .cart-drawer__body, .side-panel-content, .minicart__entry, #cart, .cart-drawer-content-item, #CartDrawerForm, #CartDrawer .drawer__content, cart-drawer-items, .cart__items, #cart-drawer-form, .drawer__items-title, #mini-cart-form, .mini-cart__line-item-list, .sidebar__body, .cart--body, .previewCartList, .cart-items__wrapper, .rebuy-cart__flyout-body, .items, .spurit-occ3__product-cards, .qsc2-drawer-body";let DEFAULT_cartItemSelectorApp7Ext=".cart-item",DEFAULT_cartItemRemoveParentSelectorApp7Ext="cart-remove-button",DEFAULT_cartItemRemoveSelectorApp7Ext="",DEFAULT_cartItemQuantityBtnSelectorsApp7Ext="";const DEFAULT_PDP_SELECTORS_NOV25='.product-form__buttons, .product-form-buttons, buy-buttons, .payment-buttons, .product__submit__buttons, .product__form, #MainContent product-form gp-button button[aria-label="Add to cart"], form[action="/cart/add"], [data-block-type="buy-buttons"], .container-buy-quant, .productView-subtotal, .main-product__form-buttons--addtocart, .product-add-to-cart-container, .product-form__submit, .add-to-cart, .product-info__add-to-cart, #main-product-content .link-btn',DEFAULT_SIDE_CART_BOTTOM_SELECTORS_NOV25='.cart__ctas, .cart-drawer__footer, .drawer__footer:not([hidden]), .drawer__footer,.mini-cart__actions, .mini-cart__footer, .cart__buttons, .drawer__bottom, .quick-cart__footer-inner, .quick-cart__footer, button[name="checkout"], input[name="checkout"],input[type="submit"][name="checkout"],button[type="submit"][name="checkout"], a[href="/checkout"], form[action="/cart"], .mini-cart-btns, .rebuy-cart__checkout-button, .mm-action_buttons, .buy-buttons, .cart-drawer__action-buttons, .AOV-CartDrawer-Footer, #checkout-button, .f-drawer__footer, .side_cart .actions, .cart-drawer__checkout-buttons, aside .link-btn, .easc-checkoutBtn, #mini-cart .cart__total-container',DEFAULT_SIDE_CART_TOP_SELECTORS_NOV25=".cart-drawer__items, table.cart-items, .cart__items, .cart-item-list__body, cart-items, .drawer__items, .product-cart-item--container",DEFAULT_CART_PAGE_SELECTORS_NOV25='.cart__ctas, .cart__buttons-container, .cart__checkout-wrapper, .checkout-buttons, .cart__buttons, .checkout-button, button[name="checkout"], input[name="checkout"], cart-checkout, .checkout-wrapper .cart__checkout, .cart__checkout-button, .mini-cart-footer-actions, .proceed-to-checkout, .cart__summary-button, .ajax-cart__button-submit, #yt-checkout-button, #cart-summary [name="checkout"]',CONSTANT_LOADING_SPINNER_SVG='
',CONSTANT_ARROW_SVG_APP7EXT='',SVG_ICONS={DISCOUNT_TAG_ICON_FILL:'',DISCOUNT_TAG_ICON_STROKE:'',DISCOUNT_ICON_CIRCULAR_FILL:'',DISCOUNT_ICON_CIRCULAR_STROKE:'',CHECK_MARK_ICON:'',LOCK_ICON:'',CHECK_ICON:'',ARROW_ICON:'',SHIPPING_ICON:'',GIFT_ICON:'',DISCOUNT_ICON:''},CURRENCY_SYMBOL_OVERRIDES={AED:"د.إ",ALL:"L",ANG:"ƒ",AWG:"ƒ",BGN:"лв",BHD:".د.ب",BIF:"FBu",BTC:"₿",BTN:"Nu.",BYN:"Br",BYR:"Br",CDF:"FC",CNH:"¥",CVE:"$",DJF:"Fdj",DOP:"RD$",DZD:"دج",EEK:"kr",EGP:"£",ERN:"Nfk",ETB:"Br",ETH:"Ξ",GGP:"£",GHC:"₵",GMD:"D",HTG:"G",IMP:"£",IQD:"ع.د",IRR:"﷼",JEP:"£",JMD:"J$",JOD:"JD",KES:"KSh",KGS:"лв",KWD:"KD",LBP:"£",LKR:"₨",LSL:"M",LTC:"Ł",LYD:"LD",MDL:"lei",MKD:"ден",MOP:"MOP$",MRO:"UM",MRU:"UM",MUR:"₨",MVR:"Rf",MWK:"MK",MZN:"MT",NPR:"₨",OMR:"﷼",PAB:"B/.",PEN:"S/.",PGK:"K",PKR:"₨",PYG:"Gs",QAR:"﷼",RMB:"¥",RSD:"Дин.",RWF:"R₣",SAR:"﷼",SCR:"₨",SDG:"ج.س.",SLL:"Le",SOS:"S",STD:"Db",SVC:"$",SZL:"E",TJS:"SM",TMT:"T",TND:"د.ت",TRL:"₤",TTD:"TT$",TVD:"$",TZS:"TSh",UGX:"USh",UYU:"$U",UZS:"лв",VES:"Bs.S",VUV:"VT",WST:"WS$",XBT:"Ƀ",XOF:"CFA",XSU:"Sucre",YER:"﷼",ZWD:"Z$",ZWL:"$"},getCurrencySymbolByCode=t=>{if(CURRENCY_SYMBOL_OVERRIDES[t])return CURRENCY_SYMBOL_OVERRIDES[t];try{return new Intl.NumberFormat("en",{style:"currency",currency:t,currencyDisplay:"narrowSymbol"}).formatToParts(0).find(t=>"currency"===t.type).value}catch(e){return t}},INVALID_LANG_CODES={TW:"ZH_TW"},normalizeLangCode=t=>INVALID_LANG_CODES[t]?INVALID_LANG_CODES[t]:t.includes("-")?t.split("-")[0]:t,PRODUCT_PAGE_APP_BLOCK_SELECTOR=".gfgProductPageAppBlock",CART_PAGE_APP_BLOCK_SELECTOR=".gfgCartPageAppBlock",FREE_GIFT_APP_BLOCK_SELECTOR=".gfgFreeGiftWrapperV3",VOLUME_DISCOUNT_APP_BLOCK_SELECTOR=".gfgVolDiscountWrapperV3",BOGO_APP_BLOCK_SELECTOR=".gfgBogoDiscountWrapperV3",UNIFIED_APP_BLOCK_SELECTOR=".gfgUnifiedDiscountWrapperV3",CUSTOM_DISCOUNT_APP_BLOCK_SELECTOR=".gfgCustomDiscountWrapperV2",CONSOLIDATED_PROGRESS_BAR_APP_BLOCK_SELECTOR=".gfgConsolidatedProgressBarWrapperV2",SHIPPING_DISCOUNT_APP_BLOCK_SELECTOR=".gfgShippingDiscountWrapperV2",FREEGIFT_SIDE_CART_WRAPPER=document.createElement("div");FREEGIFT_SIDE_CART_WRAPPER.className="gfgFreeGiftSideCartWrapperV4";const VOLUME_DISCOUNT_SIDE_CART_WRAPPER=document.createElement("div");VOLUME_DISCOUNT_SIDE_CART_WRAPPER.className="gfgVolumeDiscountSideCartWrapperV4";const UNIFIED_SIDE_CART_WRAPPER=document.createElement("div");UNIFIED_SIDE_CART_WRAPPER.className="gfgUnifiedSideCartWrapperV4";const CUSTOM_DISCOUNT_SIDE_CART_WRAPPER=document.createElement("div");CUSTOM_DISCOUNT_SIDE_CART_WRAPPER.className="gfgCustomDiscountSideCartWrapperV4";const CONSOLIDATED_PROGRESS_BAR_SIDE_CART_WRAPPER=document.createElement("div");CONSOLIDATED_PROGRESS_BAR_SIDE_CART_WRAPPER.className="gfgConsolidatedProgressBarSideCartWrapperV4";const SHIPPING_DISCOUNT_SIDE_CART_WRAPPER=document.createElement("div");SHIPPING_DISCOUNT_SIDE_CART_WRAPPER.className="gfgShippingDiscountSideCartWrapperV4";const GLOBAL_WIDGETS_SIDE_CART_WRAPPER=document.createElement("div");GLOBAL_WIDGETS_SIDE_CART_WRAPPER.className="gfgGlobalWidgetsSideCartWrapperV4";const FREEGIFT_SIDE_CART_WRAPPER_SELECTOR=".gfgFreeGiftSideCartWrapperV4",VOLUME_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR=".gfgVolumeDiscountSideCartWrapperV4",UNIFIED_SIDE_CART_WRAPPER_SELECTOR=".gfgUnifiedSideCartWrapperV4",CUSTOM_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR=".gfgCustomDiscountSideCartWrapperV4",CONSOLIDATED_PROGRESS_BAR_SIDE_CART_WRAPPER_SELECTOR=".gfgConsolidatedProgressBarSideCartWrapperV4",SHIPPING_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR=".gfgShippingDiscountSideCartWrapperV4",GLOBAL_WIDGETS_SIDE_CART_WRAPPER_SELECTOR=".gfgGlobalWidgetsSideCartWrapperV4",GFG_CART_DRAWER_OBSERVER_CSS="\n/* Space reservation for side cart wrappers to prevent FOUC/layout shift */\n.gfgFreeGiftSideCartWrapperV4,\n.gfgVolumeDiscountSideCartWrapperV4,\n.gfgUnifiedSideCartWrapperV4,\n.gfgCustomDiscountSideCartWrapperV4,\n.gfgConsolidatedProgressBarSideCartWrapperV4,\n.gfgShippingDiscountSideCartWrapperV4,\n.gfgGlobalWidgetsSideCartWrapperV4 {\n /* Reserve minimum space to prevent layout collapse */\n min-height: var(--gfg-widget-min-height, 0px);\n /* Use contain to optimize rendering */\n contain: layout style;\n /* Smooth transitions for height changes */\n transition: min-height 0.15s ease-out;\n}\n\n/* When widget has content, allow natural sizing */\n.gfgFreeGiftSideCartWrapperV4:not(:empty),\n.gfgVolumeDiscountSideCartWrapperV4:not(:empty),\n.gfgUnifiedSideCartWrapperV4:not(:empty),\n.gfgCustomDiscountSideCartWrapperV4:not(:empty),\n.gfgConsolidatedProgressBarSideCartWrapperV4:not(:empty),\n.gfgShippingDiscountSideCartWrapperV4:not(:empty),\n.gfgGlobalWidgetsSideCartWrapperV4:not(:empty) {\n min-height: auto;\n}\n\n/* Placeholder styling while widget loads */\n.gfg-widget-placeholder {\n min-height: var(--gfg-widget-min-height, 50px);\n background: transparent;\n}\n",GFG_CART_DRAWER_SELECTORS={DAWN:"cart-drawer",FALLBACK:["#CartDrawer",".cart-drawer","[data-cart-drawer]",'.drawer[data-drawer="cart"]',".mini-cart",".ajax-cart",".side-cart"]},FREE_GIFT_PAGINATION_ITEMS_PER_PAGE=2,SHADOW_ROOTS_SELECTORS="#upCart, #opus-shadow-container, #recharge-storefront-experiences__cart-drawer, dna-mini-cart",gfgUtils={f:{}};window.gfgUtils=gfgUtils;var gfg={env:"PRODUCTION",svgIcons:SVG_ICONS,excludeErrors:["error in getSettings R2 fetch","gfg-utility-getCartV2","Error inside getSettingsFromR2. Trying S3","Error inside gfgCustomDiscount initialize fn","Error inside gfgCustomDiscount makeGraphQLApiCall fn","Unexpected error in fetching settings: ","error in applyImpFileCssStyling fn","error in getSettings R2 fetch =>","error in getSettings s3 fetch =>","error in getVisitingFromCountry","Error inside getProductsDataByIdWithAjaxResponse fn","error in addDiscountedSubtotalToCartAttributes","validateAndParseCartData","Error inside gfgShippingDiscountV2 getLatestCartItemsProductData fn","gfgRemoveAllFreeGiftProductsExceptGiven","Error inside gfgUnifiedWidget prepareUI fn"],errorLogs:null,debug:[],version:1.35,state:{submitted:"",product_added:"",page_type:"",lastClickTimestamps:new Map,insertWrapperOnPage:[],cartData:void 0,isOverWriteBuyNowBtnTriggered:!1,timer:void 0,freeGiftcardPopupModalTriggered:!1,atleastOneProduct:{},checkForFreeGift:!1,isCheckForFreeGiftTriggered:!1,gfgFreeGiftMsgRowButton:!1,CONSTANT_DEBUG_FLAG:void 0,freeGiftsCartDataMap_productId:{},freeGiftsCartDataMap_variantId:{},freeGiftsCartData:{},gfgFreeGiftCartData:{},activeCampaignName:"EMPTY",activeCustomerData:"EMPTY",formatPriceViaCustomScript:!1,shouldInitShippingDiscountAgain:!1,shouldInitUnifiedDiscountAgain:!1,featuresWrapperMap:{},cartCache:{data:null,timestamp:null,isLoading:!1,pendingPromises:[]},shadowRoot:{isDetected:!1,reference:null,pendingEventCampaignIndices:[]},bootstrapComplete:!1},constants:{themesIds:{DAWN_THEME:887,VENTURE_THEME:775,EXPRESS_THEME:885,CRAVE_THEME:1363,SENSE_THEME:1356,CRAFT_THEME:1368}},trace:{_instances:[],_unloadRegistered:!1,_outcomePriority:{pending:0,no_valid_tiers:1,gifts_removed:2,gifts_added:3,error:4},createInstance(t){if(!0!==gfg.settings?.app?.storefrontTracingEnabled)return this._createNoopInstance();const e={_buffer:[],_sentKeys:new Set,_repeatCounts:{},_traceKey:null,_shopName:null,_cartToken:null,_campaignType:t,_customerId:null,_outcome:"pending",_needsFlush:!1,_initialized:!1,_MAX_BUFFER:500,_MAX_REPEATABLE:10,init({shopName:t,cartToken:e,customerId:r}){t&&e&&(this._shopName=t,this._cartToken=e,this._customerId=r||null,this._traceKey=`${t}:${e}:${this._campaignType}`,this._initialized=!0)},add(t,e={},r,n){try{const a=r||t;if(this._sentKeys.has(a))return;this._sentKeys.add(a),this._pushTrace(t,e),n&&this.markForFlush()}catch(t){}},addRepeatable(t,e={},r){try{const n=this._repeatCounts[t]||0;if(n>=this._MAX_REPEATABLE)return;this._repeatCounts[t]=n+1,this._pushTrace(t,e),r&&this.markForFlush()}catch(t){}},_pushTrace(t,e){this._buffer.length>=this._MAX_BUFFER&&this._buffer.shift();const r=(window.location.origin+window.location.pathname).slice(0,500);this._buffer.push({event:t,timestamp:Date.now(),data:e,cart:gfg.trace.getCartSnapshot(),pageUrl:r})},setOutcome(t){const e=gfg.trace._outcomePriority;(e[t]??0)>=(e[this._outcome]??0)&&(this._outcome=t)},markForFlush(){this._needsFlush=!0,this.flush()},flush(){try{if(!this._needsFlush||0===this._buffer.length||!this._initialized)return;const t=this._buildPayload(),e=new Blob([JSON.stringify(t)],{type:"application/json"});navigator.sendBeacon("/apps/kite/tracingUpdate",e),this._buffer=[],this._needsFlush=!1}catch(t){}},destroy(){try{if(0===this._buffer.length||!this._initialized)return;this._needsFlush=!0,this.flush()}catch(t){}},_buildPayload(){return{traceKey:this._traceKey,shopName:this._shopName,campaignType:this._campaignType,cartToken:this._cartToken,customerId:this._customerId,traces:this._buffer.slice(),outcome:this._outcome}}};return this._instances.push(e),this._registerUnloadListeners(),e},_createNoopInstance:()=>({init(){},add(){},addRepeatable(){},setOutcome(){},markForFlush(){},flush(){},destroy(){},getCartSnapshot:()=>null,_initialized:!1}),getCartSnapshot(){try{const t=gfg.state?.cartData;return t?{itemCount:t.item_count,totalPrice:t.total_price,subtotal:t.items_subtotal_price,currency:t.currency,discountCodes:(t.cart_level_discount_applications||[]).map(t=>({code:t.title,amount:t.total_allocated_amount})),items:(t.items||[]).slice(0,30).map(t=>({variantId:t.variant_id,productId:t.product_id,qty:t.quantity,price:t.price,discountedPrice:t.discounted_price,isFreeGift:"true"===t.properties?._free_product,ruleId:t.properties?._rule_id||null,promoName:t.properties?._kite_promo_name||null}))}:null}catch(t){return null}},_registerUnloadListeners(){if(this._unloadRegistered)return;this._unloadRegistered=!0;const t=()=>{gfg.trace._instances.forEach(t=>t.destroy())};window.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&t()}),window.addEventListener("pagehide",t)}},cartDrawerObserver:{state:{isObserving:!1,drawerObserver:null,bodyObserver:null,cssInjected:!1,lastInjectionTime:0,observedDrawer:null,widgetSnapshots:{},hasActiveSnapshot:!1,snapshotTimeoutId:null,pendingWidgetCheck:null,_lastRerenderTime:0},init:function(){try{gfg.utility.debugConsole("cartDrawerObserver: Initializing..."),this.injectSpaceReservationCSS();this.observeCartDrawer()||this.observeBodyForDrawer(),gfg.utility.debugConsole("cartDrawerObserver: Initialized successfully")}catch(t){gfg.utility.debugError("cartDrawerObserver: Error in init",t)}},injectSpaceReservationCSS:function(){try{if(this.state.cssInjected)return;const t="gfg-cart-drawer-observer-css";if(document.getElementById(t))return void(this.state.cssInjected=!0);const e=document.createElement("style");e.id=t,e.setAttribute("data-source-name","gfgCartDrawerObserver"),e.textContent=GFG_CART_DRAWER_OBSERVER_CSS,document.head.appendChild(e),this.state.cssInjected=!0,gfg.utility.debugConsole("cartDrawerObserver: CSS injected")}catch(t){gfg.utility.debugError("cartDrawerObserver: Error injecting CSS",t)}},findCartDrawer:function(){try{let t=document.querySelector(GFG_CART_DRAWER_SELECTORS.DAWN);if(t)return t;for(const e of GFG_CART_DRAWER_SELECTORS.FALLBACK)if(t=document.querySelector(e),t)return t;if(gfg.settings?.app?.sideCartSectionSelector&&(t=document.querySelector(gfg.settings.app.sideCartSectionSelector),t))return t;if(void 0!==DEFAULT_sideCartSelectorsApp7Ext){const e=DEFAULT_sideCartSelectorsApp7Ext.split(",").map(t=>t.trim());for(const r of e)if(t=document.querySelector(r),t)return t}return null}catch(t){return gfg.utility.debugError("cartDrawerObserver: Error finding cart drawer",t),null}},widgetsExist:function(t,e=!1){const r=t||document,n=[FREEGIFT_SIDE_CART_WRAPPER_SELECTOR,VOLUME_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR,UNIFIED_SIDE_CART_WRAPPER_SELECTOR,CUSTOM_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR,CONSOLIDATED_PROGRESS_BAR_SIDE_CART_WRAPPER_SELECTOR,SHIPPING_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR,".gfgFGv2-injected-wrapper-sidecart"];for(const t of n){const n=r.querySelector(t);if(n){if(!e)return!0;if(n.children.length>0||n.textContent.trim().length>0)return!0}}return!1},widgetContentExists:function(t){return this.widgetsExist(t,!0)},reinjectWidgets:function(t=!1){try{if(this.widgetsExist(this.state.observedDrawer)&&!t)return void gfg.utility.debugConsole("cartDrawerObserver: Widgets exist, skipping injection");if(gfg.utility.debugConsole("cartDrawerObserver: Re-injecting widget wrappers..."+(t?" (full re-render after hydration)":"")),this.state.lastInjectionTime=Date.now(),gfg.cartPage&&gfg.cartPage.f&&"function"==typeof gfg.cartPage.f.insertSideCartWrappersIntoPage&&gfg.cartPage.f.insertSideCartWrappersIntoPage(gfg.settings),this.state.hasActiveSnapshot){if(this.restoreWidgetSnapshot())return void gfg.utility.debugConsole("cartDrawerObserver: Restored widgets from snapshot, skipping full re-render")}t&&(gfg.utility.debugConsole("cartDrawerObserver: Triggering widget content re-render..."),this.rerenderWidgetContent())}catch(t){gfg.utility.debugError("cartDrawerObserver: Error re-injecting widgets",t)}},rerenderWidgetContent:function(){try{var t=Date.now();if(t-(this.state._lastRerenderTime||0)<2e3)return void gfg.utility.debugConsole("cartDrawerObserver: Skipping re-render (debounced, "+(t-this.state._lastRerenderTime)+"ms since last)");this.state._lastRerenderTime=t,gfg.gfgFreeGift&&!gfg.gfgFreeGift._isStub&&gfg.gfgFreeGift.init(gfg.settings,"CART_PAGE"),gfg.gfgFreeGiftV2&&!gfg.gfgFreeGiftV2._isStub&&gfg.settings.freeGiftsV2?.length>0&&gfg.gfgFreeGiftV2.init(gfg.settings.freeGiftsV2),gfg.gfgVolDiscount&&!gfg.gfgVolDiscount._isStub&&gfg.gfgVolDiscount.init(gfg.settings,"CART_PAGE"),gfg.gfgVolumeDiscountV2&&!gfg.gfgVolumeDiscountV2._isStub&&gfg.gfgVolumeDiscountV2.init(gfg.settings,"PRODUCT_PAGE"),gfg.gfgBogoFeature&&!gfg.gfgBogoFeature._isStub&&gfg.gfgBogoFeature.init(gfg.settings,"CART_PAGE"),gfg.gfgUnifiedWidget&&!gfg.gfgUnifiedWidget._isStub&&gfg.gfgUnifiedWidget.init(gfg.settings,"CART_PAGE"),"undefined"!=typeof gfgConsolidatedCustomDiscount&&gfgConsolidatedCustomDiscount.init&&(gfg.utility.debugConsole("cartDrawerObserver: Re-initializing gfgConsolidatedCustomDiscount..."),gfgConsolidatedCustomDiscount.init()),"undefined"!=typeof gfgCustomDiscount&&gfgCustomDiscount.gfgShippingDiscountV2&&gfgCustomDiscount.gfgShippingDiscountV2.init&&(gfg.utility.debugConsole("cartDrawerObserver: Re-initializing shipping discount..."),gfgCustomDiscount.gfgShippingDiscountV2.init(),gfgCustomDiscount.init())}catch(t){gfg.utility.debugError("cartDrawerObserver: Error re-rendering widget content",t)}},observeCartDrawer:function(){try{const t=this.findCartDrawer();if(!t)return gfg.utility.debugConsole("cartDrawerObserver: Cart drawer not found"),!1;if(this.state.observedDrawer===t&&this.state.drawerObserver)return gfg.utility.debugConsole("cartDrawerObserver: Already observing this drawer"),!0;this.disconnect(),this.state.observedDrawer=t;const e=this,r=[FREEGIFT_SIDE_CART_WRAPPER_SELECTOR,VOLUME_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR,UNIFIED_SIDE_CART_WRAPPER_SELECTOR,CUSTOM_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR,CONSOLIDATED_PROGRESS_BAR_SIDE_CART_WRAPPER_SELECTOR,SHIPPING_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR,".gfgFGv2-injected-wrapper-sidecart"].join(",");return this.state.drawerObserver=new MutationObserver(function(n){if(n.length>0&&n.every(function(t){return t.target?.closest?.(r)}))return;let a=!1;for(const t of n)if("attributes"===t.type&&"data-hydrated"===t.attributeName){const e=t.target;if(e&&"true"===e.getAttribute("data-hydrated")){a=!0,gfg.utility.debugConsole("cartDrawerObserver: Hydration event detected!");break}}if(a)return gfg.utility.debugConsole("cartDrawerObserver: Triggering full re-render after hydration..."),void setTimeout(function(){e.reinjectWidgets(!0)},100);e.state.pendingWidgetCheck&&clearTimeout(e.state.pendingWidgetCheck),e.state.pendingWidgetCheck=setTimeout(function(){if(e.state.pendingWidgetCheck=null,Date.now()-e.state.lastInjectionTime<30)return;const r=e.widgetsExist(t),n=e.widgetContentExists(t);r?n||(gfg.utility.debugConsole("cartDrawerObserver: Content missing, triggering full re-render..."),e.reinjectWidgets(!0)):(gfg.utility.debugConsole("cartDrawerObserver: Wrapper missing, re-injecting with full re-render..."),e.reinjectWidgets(!0))},20)}),this.state.drawerObserver.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-hydrated"]}),this.state.isObserving=!0,gfg.utility.debugConsole("cartDrawerObserver: Now observing cart drawer"),this.widgetsExist(t)||this.reinjectWidgets(),!0}catch(t){return gfg.utility.debugError("cartDrawerObserver: Error setting up drawer observer",t),!1}},observeBodyForDrawer:function(){try{if(this.state.bodyObserver)return void gfg.utility.debugConsole("cartDrawerObserver: Body observer already active");gfg.utility.debugConsole("cartDrawerObserver: Setting up body observer for drawer detection");const t=this;let e=0;this.state.bodyObserver=new MutationObserver(function(r){const n=Date.now();if(n-e<300)return;e=n;t.findCartDrawer()&&(gfg.utility.debugConsole("cartDrawerObserver: Cart drawer detected, switching to drawer observer"),t.state.bodyObserver.disconnect(),t.state.bodyObserver=null,t.observeCartDrawer())}),this.state.bodyObserver.observe(document.body,{childList:!0,subtree:!1})}catch(t){gfg.utility.debugError("cartDrawerObserver: Error setting up body observer",t)}},disconnect:function(){try{this.state.drawerObserver&&(this.state.drawerObserver.disconnect(),this.state.drawerObserver=null),this.state.bodyObserver&&(this.state.bodyObserver.disconnect(),this.state.bodyObserver=null),this.state.isObserving=!1,this.state.observedDrawer=null,gfg.utility.debugConsole("cartDrawerObserver: Disconnected all observers")}catch(t){gfg.utility.debugError("cartDrawerObserver: Error disconnecting",t)}},reobserve:function(){try{gfg.utility.debugConsole("cartDrawerObserver: Re-observing..."),this.disconnect();this.observeCartDrawer()||this.observeBodyForDrawer()}catch(t){gfg.utility.debugError("cartDrawerObserver: Error re-observing",t)}},takeWidgetSnapshot:function(){try{const t=this.findCartDrawer();if(!t)return gfg.utility.debugConsole("cartDrawerObserver: No drawer found for snapshot"),!1;this.state.widgetSnapshots={};const e=[".gfgFreeGiftSideCartWrapperV4",".gfgVolumeDiscountSideCartWrapperV4",".gfgUnifiedSideCartWrapperV4",".gfgCustomDiscountSideCartWrapperV4",".gfgConsolidatedProgressBarSideCartWrapperV4",".gfgShippingDiscountSideCartWrapperV4"];for(const r of e){const e=t.querySelector(r);e&&e.children.length>0&&(this.state.widgetSnapshots[r]=Array.from(e.childNodes))}return this.state.hasActiveSnapshot=Object.keys(this.state.widgetSnapshots).length>0,this.state.snapshotTimeoutId&&clearTimeout(this.state.snapshotTimeoutId),this.state.snapshotTimeoutId=setTimeout(()=>{this.clearWidgetSnapshot()},5e3),gfg.utility.debugConsole("cartDrawerObserver: Snapshot taken, hasActiveSnapshot:",this.state.hasActiveSnapshot),this.state.hasActiveSnapshot}catch(t){return gfg.utility.debugError("cartDrawerObserver: Error taking snapshot",t),!1}},restoreWidgetSnapshot:function(){try{if(!this.state.hasActiveSnapshot)return gfg.utility.debugConsole("cartDrawerObserver: No active snapshot to restore"),!1;const t=this.findCartDrawer();if(!t)return gfg.utility.debugConsole("cartDrawerObserver: No drawer found for restoration"),!1;let e=!1;for(const r in this.state.widgetSnapshots){const n=t.querySelector(r),a=this.state.widgetSnapshots[r];if(n&&a&&a.length>0&&0===n.children.length){for(const t of a)n.appendChild(t);e=!0,gfg.utility.debugConsole("cartDrawerObserver: Restored snapshot for",r)}}return this.clearWidgetSnapshot(),gfg.utility.debugConsole("cartDrawerObserver: Snapshot restoration complete, restored:",e),e}catch(t){return gfg.utility.debugError("cartDrawerObserver: Error restoring snapshot",t),!1}},clearWidgetSnapshot:function(){this.state.widgetSnapshots={},this.state.hasActiveSnapshot=!1,this.state.snapshotTimeoutId&&(clearTimeout(this.state.snapshotTimeoutId),this.state.snapshotTimeoutId=null),gfg.utility.debugConsole("cartDrawerObserver: Snapshot cleared")}},settings:{},selectors:{},cartInterval:"",productinterval:"",f:{bootstrap:function(t){try{if(gfg.state.bootstrapComplete)return void gfg.utility.debugConsole("Bootstrap already completed, skipping...");gfg.state.bootstrapComplete=!0,gfg.f.initThemeCSS(),gfg.f.globalListener(t),gfg.f.executeCustomScriptOnLoadFn(),gfg.f.handleShadowRootDetection()}catch(t){gfg.utility.debugConsole("Error in bootstrap:",t)}},initThemeCSS:function(){},_updateCartStateInProgress:!1,_lastUpdateCartStateTime:0,_UPDATE_CART_STATE_DEBOUNCE_MS:500,updateCartState:async function(t,e,r,cartData){if(gfg.f._updateCartStateInProgress)return void gfg.utility.debugConsole("updateCartState: Skipped - already in progress");const now=Date.now();if(now-gfg.f._lastUpdateCartStateTimecutoffDateForOldCustomers)return void eval(executeCustomScriptAfterFreeGiftAddition);const DECEMBER_04_2025=new Date("2025-12-04"),useDecember2025CartRefresh=gfg.settings.merchantInfo?.customSettings?.useDecember2025CartRefresh;let runNewCartRefreshCode=userCreatedAt>DECEMBER_04_2025||!0===useDecember2025CartRefresh;if(!1===useDecember2025CartRefresh&&(runNewCartRefreshCode=!1),runNewCartRefreshCode)return void gfg.gfgCartRefreshHelper.init();if(window.gfgKiteV0Features&&window.gfgKiteV0Features.updateCartState)return await window.gfgKiteV0Features.updateCartState(t,e,r,cartData);if(gfg.gfgCartRefreshHelper&&gfg.gfgCartRefreshHelper.init)return await gfg.gfgCartRefreshHelper.init();gfg.utility.debugConsole("No cart refresh method available, reloading page"),window.location.reload()}catch(t){gfg.utility.debugError("Error in updateCartState:",t),window.location.reload()}finally{gfg.f._updateCartStateInProgress=!1}}},getSettings:async function(){try{gfg.utility.debugConsole("fetching from s3 or r2 based on localStorage flag");const t="gfg.useS3ForSettings";if("true"===localStorage.getItem(t))try{return await gfg.f.getSettingsFromS3()}catch(t){throw gfg.utility.debugError("error in getSettings s3 fetch when useS3Directly is true =>",t),t}else try{const t=new Promise((t,e)=>{setTimeout(()=>{e(new Error("R2 fetch timed out after 3 seconds"))},3e3)}),e=await Promise.race([gfg.f.getSettingsFromR2(),t]);return gfg.utility.debugConsole("benchmark s3 start"),e}catch(e){gfg.utility.debugError("error in getSettings R2 fetch =>",e);try{const e=await gfg.f.getSettingsFromS3();return localStorage.setItem(t,"true"),e}catch(t){throw gfg.utility.debugError("error in getSettings s3 fetch =>",t),t}}}catch(t){throw gfg.utility.debugError("Unexpected error in fetching settings: ",t),t}},getSettingsFromR2:async function(){const t=window.Shopify.shop;gfg.utility.debugConsole("GET setting from r2 of gfg fired");const e=`https://kite.giftkartcdn.app/tempCartSettings/${t}.json?nocache=${Date.now()}`;try{const t=await fetch(e),r=await t.json();if(!r.userData){gfg.utility.debugError("Error inside getSettingsFromR2 -R2 returned invalid data. Trying S3");return await gfg.f.getSettingsFromS3()}return gfg.utility.debugConsole("success-data",r),r}catch(t){gfg.utility.debugError("Error inside getSettingsFromR2. Trying S3",t);return await gfg.f.getSettingsFromS3()}},getSettingsFromS3:async function(){try{let t=window.Shopify.shop;return gfg.utility.debugConsole("GET setting of giftlab pro fired"),new Promise(function(e,r){fetch(`https://free-gift-app7.s3.us-east-2.amazonaws.com/tempCartSettings/${t}.json?nocache=${(new Date).getTime()}`,{method:"GET"}).then(t=>t.json()).then(t=>{200==t.responseCode&&gfg.utility.debugConsole("success-data",t),e(t)}).catch(t=>{gfg.utility.debugConsole(t),r(t)})})}catch(t){gfg.utility.debugConsole("Error in getSettingsFromS3:",t)}},setSettings:function(t){try{var e={SERVER_URL:t.SERVER_URL,app:{disableApp:t.userData.customSettings.disableApp||!1,disableSideCart:t.userData.customSettings.disableSideCart||!1,refreshProductPageOnGiftWrap:t.userData.customSettings.refreshProductPageOnGiftWrap||!1,addToCartBtnSelectors:t.userData.customSettings.addToCartBtnSelectors||DEFAULT_addToCartBtnSelectorsApp7Ext,checkoutBtnSelectors:t.userData.customSettings.checkoutBtnSelectors||DEFAULT_checkoutBtnSelectorsApp7Ext,sideCartCheckoutBtnSelectors:t.userData.customSettings.sideCartCheckoutBtnSelectors||DEFAULT_checkoutBtnSelectorsApp7Ext,overWriteCheckoutBtn:t.userData.customSettings.overWriteCheckoutBtn||!1,quantityBtnSelectors:t.userData.customSettings.quantityBtnSelectors||DEFAULT_quantityBtnSelectorsApp7Ext,sideCartSelectors:t.userData.customSettings.sideCartSelectors||DEFAULT_sideCartSelectorsApp7Ext,isCartIntegrationEnabled:t.userData.customSettings.isCartIntegrationEnabled||!1,cartItemSelectors:t.userData.customSettings.cartItemSelectors||DEFAULT_cartItemSelectorApp7Ext,cartItemRemoveParentSelectors:t.userData.customSettings.cartItemRemoveParentSelectors||DEFAULT_cartItemRemoveParentSelectorApp7Ext,cartItemRemoveSelectors:t.userData.customSettings.cartItemRemoveSelectors||DEFAULT_cartItemRemoveSelectorApp7Ext,cartItemQuantityBtnSelectors:t.userData.customSettings.cartItemQuantityBtnSelectors||DEFAULT_cartItemQuantityBtnSelectorsApp7Ext,customCartIntegrationScript:t.userData.customSettings.customCartIntegrationScript||null,activeVariantCodes:t.userData.customSettings.activeVariantCodes||"123456789",showBranding:t.userData.customSettings.showBranding,buyNowBtn:t.userData.customSettings.buyNowBtn||DEFAULT_buyNowBtnApp7Ext,customStyle:t.userData.customSettings.customStyle||null,enablingApiFromSetInterval:t.userData.customSettings.enablingApiFromSetInterval||!1,isMultipleFreeGiftAllowed:t.userData.customSettings.isMultipleFreeGiftAllowed||!1,addAfterAddTocartBtn:t.userData.customSettings.addAfterAddTocartBtn||!1,addAftercheckoutBtn:t.userData.customSettings.addAftercheckoutBtn||!1,sideCartSectionId:t.userData.customSettings.sideCartSectionId||"cart-drawer",sideCartSectionSelector:t.userData.customSettings.sideCartSectionSelector||null,cartPageItemsSectionId:t.userData.customSettings.cartPageItemsSectionId||t.userData.customSettings.cartPageItemsId||"cart-items",cartPageItemsSelector:t.userData.customSettings.cartPageItemsSelector||".cart__row",disableApiCallListen:t.userData.customSettings.disableApiCallListen||!1,executeScriptAfterAddToCart:t.userData.customSettings.executeScriptAfterAddToCart||"",executeCustomScriptAfterFreeGiftAddition:t.userData.customSettings.executeCustomScriptAfterFreeGiftAddition||"",executeCustomScriptAfterDynamicBogoAddition:t.userData.customSettings.executeCustomScriptAfterDynamicBogoAddition||"",executeCustomScriptAfterBogoAddition:t.userData.customSettings.executeCustomScriptAfterBogoAddition||"",redirectToCartAfterBogoAddition:t.userData.customSettings?.redirectToCartAfterBogoAddition||null,redirectToCheckoutAfterBogoAddition:t.userData.customSettings?.redirectToCheckoutAfterBogoAddition||null,executeCustomScriptOnLoad:t.userData.customSettings.executeCustomScriptOnLoad||null,productHandlesAreTranslated:!!t.userData?.customSettings?.productHandlesAreTranslated&&t.userData.customSettings.productHandlesAreTranslated,isWidgetAccordionExpandedByDefault_FREE_GIFT:!!t.userData?.customSettings?.isWidgetAccordionExpandedByDefault_FREE_GIFT&&t.userData.customSettings.isWidgetAccordionExpandedByDefault_FREE_GIFT,skipDefaultSideCartCheck:!!t.userData?.customSettings?.skipDefaultSideCartCheck&&t.userData.customSettings.skipDefaultSideCartCheck,isRegionalLocaleUrlRequiredForHref:!!t.userData?.customSettings?.isRegionalLocaleUrlRequiredForHref&&t.userData.customSettings.isRegionalLocaleUrlRequiredForHref,hideAccordionOnClaim_FREE_GIFT:!!t.userData?.customSettings?.hideAccordionOnClaim_FREE_GIFT&&t.userData.customSettings.hideAccordionOnClaim_FREE_GIFT,global_afterAddToCartScript:t.userData?.customSettings?.global_afterAddToCartScript?t.userData.customSettings.global_afterAddToCartScript:"",AddMultipleFreeGiftsInOneAPICall:!!t.userData?.customSettings?.AddMultipleFreeGiftsInOneAPICall&&t.userData.customSettings.AddMultipleFreeGiftsInOneAPICall,freeGiftSideCartSelector:t.userData?.customSettings?.freeGiftSideCartSelector||null,freeGiftSideCartWrapperAboveSelector:!1!==t.userData?.customSettings?.freeGiftSideCartWrapperAboveSelector,volumeDiscountSideCartSelector:t.userData?.customSettings?.volumeDiscountSideCartSelector||null,volumeDiscountSideCartWrapperAboveSelector:!1!==t.userData?.customSettings?.volumeDiscountSideCartWrapperAboveSelector,unifiedSideCartSelector:t.userData?.customSettings?.unifiedSideCartSelector||null,unifiedSideCartWrapperAboveSelector:!1!==t.userData?.customSettings?.unifiedSideCartWrapperAboveSelector,customDiscountSideCartSelector:t.userData?.customSettings?.customDiscountSideCartSelector||null,customDiscountSideCartWrapperAboveSelector:!1!==t.userData?.customSettings?.customDiscountSideCartWrapperAboveSelector,shippingDiscountSideCartSelector:t.userData?.customSettings?.shippingDiscountSideCartSelector||null,shippingDiscountSideCartWrapperAboveSelector:!1!==t.userData?.customSettings?.shippingDiscountSideCartWrapperAboveSelector,consolidatedProgressBarSideCartSelector:t.userData?.customSettings?.consolidatedProgressBarSideCartSelector||null,consolidatedProgressBarSideCartWrapperAboveSelector:!1!==t.userData?.customSettings?.consolidatedProgressBarSideCartWrapperAboveSelector,announcementBarSelector:t.userData?.customSettings?.announcementBarSelector||null,bannerSideCartSelector:t.userData?.customSettings?.bannerSideCartSelector||null,bannerSideCartWrapperAboveSelector:!1!==t.userData?.customSettings?.bannerSideCartWrapperAboveSelector,fireNewSideCartRefreshCodeFirst:!!t.userData?.customSettings?.fireNewSideCartRefreshCodeFirst&&t.userData.customSettings.fireNewSideCartRefreshCodeFirst,considerRequestListenerData:!!t.userData?.customSettings?.considerRequestListenerData&&t.userData.customSettings.considerRequestListenerData,showConsoleAdvertisement:!1!==t.userData?.customSettings?.showConsoleAdvertisement,fetchDataForFirstRenderInFreeGiftOnCartPage:!!t.userData?.customSettings?.fetchDataForFirstRenderInFreeGiftOnCartPage&&t.userData.customSettings.fetchDataForFirstRenderInFreeGiftOnCartPage,isKiteUniqueIdRequired:!!t.userData?.customSettings?.isKiteUniqueIdRequired&&t.userData.customSettings.isKiteUniqueIdRequired,enableFreeGiftWidgetPagination:!!t.userData?.customSettings?.enableFreeGiftWidgetPagination&&t.userData.customSettings.enableFreeGiftWidgetPagination,metafieldNameSpaceAndKeys:t.userData?.customSettings?.metafieldNameSpaceAndKeys?t.userData.customSettings.metafieldNameSpaceAndKeys:[],useListenForXmlHttpApiCallsV2:!!t.userData?.customSettings?.useListenForXmlHttpApiCallsV2&&t.userData.customSettings.useListenForXmlHttpApiCallsV2,delayInCallChecksAfterApiCalls:!!t.userData?.customSettings?.delayInCallChecksAfterApiCalls&&t.userData.customSettings.delayInCallChecksAfterApiCalls,enablePerformanceObserver:!!t.userData?.customSettings?.enablePerformanceObserver&&t.userData.customSettings.enablePerformanceObserver,collectionsFetchLimit:t.userData?.customSettings?.collectionsFetchLimit||250,runShadowRootDetection:!!t.userData?.customSettings?.runShadowRootDetection,shadowRootSelector:t.userData?.customSettings?.shadowRootSelector||null,storefrontTracingEnabled:!0===t.userData?.customSettings?.storefrontTracingEnabled},merchantInfo:t.userData,languageData:t.languageData||{},freeGifts:t.promotionCampaigns,freeGiftsV2:t.freeGiftV2Campaigns,discounts:t.discounts,urlSearchString:window.location.search?window.location.search:"",boGoFeature:t.boGo,shippingDiscount:t.shippingDiscount,customDiscount:t.customDiscount,unifiedWidgets:t.unifiedWidget,consolidatedCustomDiscount:t.consolidatedCustomDiscount,consolidatedCombinedDiscount:t.consolidatedCombinedDiscount,storefrontConfig:t.storefrontConfig||{theme:{},widgetTypeDesign:{},widgetPriority:{}}};gfg.settings=e,gfg.utility.debugConsole("settings assigned"),window.kite_app_data=void 0}catch(t){gfg.utility.debugError("Error in setSettings:",t)}},checkIfCartItemIsPartOfValidCollectionList:(t,e)=>{try{const r=t=>{if(!t)return null;const e=String(t).match(/(\d+)$/);return e?e[1]:null},n=e.map(t=>r("string"==typeof t?t:t.id||t.collectionId)).filter(Boolean),a=window?.Shopify?.shop,i=JSON.parse(sessionStorage.getItem(`customFunctionProductData-${a}`))||{},o=i[t.product_id];return!!o?.collections&&o.collections.some(t=>{const e=r(t.id);return e&&n.includes(e)})}catch(t){return gfg.utility.debugError("error in checkIfCartItemIsPartOfValidCollectionList fn",t),!1}},setSelectors:function(){try{let t=gfg.settings;gfg.selectors={addToCart:t.app.addToCartBtnSelectors,checkoutBtn:t.app.checkoutBtnSelectors,sideCartCheckoutBtn:t.app.sideCartCheckoutBtnSelectors,sideCartSelectors:t.app.sideCartSelectors,buyNowBtn:t.app.buyNowBtn,cartForm:t.app.cartForm,productPageWrapperV2:".gfgProductPageWrapperV2",cartPageWrapperV2:".gfgCartPageWrapperV2",freeGiftAppBlock:FREE_GIFT_APP_BLOCK_SELECTOR,quantityBtnSelectors:t.app.quantityBtnSelectors,cartItemSelectors:t.app.cartItemSelectors,cartItemRemoveSelectors:t.app.cartItemRemoveSelectors,cartItemRemoveParentSelectors:t.app.cartItemRemoveParentSelectors,customCartIntegrationScript:t.app.customCartIntegrationScript,cartItemQuantityBtnSelectors:t.app.cartItemQuantityBtnSelectors}}catch(t){gfg.utility.debugError("Error in setSelectors:",t)}},setCustomStyling:function(){try{let e=gfg.settings.app.customStyle;if(e){var t=document.createElement("style");t.innerText=e,t.id="custom-css",t.setAttribute("data-source-name","gfgFreeGift"),document.body.appendChild(t)}}catch(t){gfg.utility.debugError("Error in setCustomStyling:",t)}},getPageType:function(){try{return window.location.pathname.includes("/cart")&&!window.location.pathname.includes("/products")?"cart":window.location.pathname.includes("/products")?"product":window.location.pathname.includes("/collections")?"COLLECTION":window.location.pathname.includes("/")?"HOME":"undefined"!=typeof Shopify&&void 0!==Shopify.Checkout?"CHECKOUT":"PAGE_NOT_FOUND"}catch(t){gfg.utility.debugError("Error in getPageType:",t)}},getProductPageHandle:function(){try{if("product"===gfg.state.page_type&&window.shopifyLiquidValuesApp7Ext&&window.shopifyLiquidValuesApp7Ext.product.handle)return gfg.state.productPageHandle=shopifyLiquidValuesApp7Ext.product.handle,shopifyLiquidValuesApp7Ext.product.handle;if("product"===gfg.state.page_type&&window.location.pathname.includes("/products/")){let t=Object.fromEntries(new URLSearchParams(window.location)).pathname.split("/products/")[1];return t&&t.includes("?")&&(t=t.split("?")[0]),gfg.state.productPageHandle=t,t}return}catch(t){gfg.utility.debugError("Error in getProductPageHandle:",t)}},getProductPageId:function(){try{return window.shopifyLiquidValuesApp7Ext&&window.shopifyLiquidValuesApp7Ext.product.productId?(gfg.state.productId=shopifyLiquidValuesApp7Ext.product.productId,shopifyLiquidValuesApp7Ext.product.productId):window?.meta&&window?.meta?.product&&window?.meta?.product?.id?(gfg.state.productPageId=window?.meta?.product?.id,window?.meta?.product?.id):void 0}catch(t){gfg.utility.debugError("Error in getProductPageId:",t)}},getElements:function(t){try{return{addToCartBtn:document.querySelector(gfg.selectors.addToCart),addToCartButtonCloned:void 0,checkoutBtn:document.querySelectorAll(gfg.selectors.checkoutBtn),cartForm:document.querySelectorAll(gfg.selectors.cartForm),productPageWrapperV2:gfg.utility.getWrapperSkeleton("PRODUCT_PAGE"),cartPageWrapperV2:gfg.utility.getWrapperSkeleton("CART_PAGE"),buyNowBtn:document.querySelector(gfg.selectors.buyNowBtn),quantityBtn:gfg.selectors.quantityBtnSelectors,cartDrawer:document.querySelector(gfg.selectors.sideCartSelectors)}}catch(t){gfg.utility.debugError("Error in getElements:",t)}},initialize:async function(){try{let t;return t=window&&window?.kite_app_data&&window?.kite_app_data?.userData?window.kite_app_data:await gfg.f.getSettings(),gfg.utility.updateCache(window?.shopifyLiquidValuesApp7Ext?.cartData),gfg.f.consoleAdvertisement(),gfg.f.setSettings(t),gfg.f.setSelectors(),gfg.f.applyImpFileCssStyling(),gfg.f.setCustomStyling(),gfg.state.page_type=gfg.f.getPageType(),gfg.elements=gfg.f.getElements(gfg.settings),""===gfg.state.page_type?!1:(gfg.utility.setLanguageLocale(),gfg.f.bootstrap(gfg.settings))}catch(t){gfg.utility.debugError("Error in initialize:",t)}},globalListener:async function(t){gfg.f.revalidateCache();let e=!1;gfg.state&&"EMPTY"==gfg.state.activeCampaignName&&gfg.utility.getUrlRewardCampaignName(),gfg.state&&"EMPTY"==gfg.state.activeCustomerData&&(await gfg.utility.setCustomerSpecificData(),gfg.utility.updateCartAttributeWithCustomerData());try{if(t.app.disableApp)return;if(gfg.utility.debugConsole("inside else of global listener"),0==gfg.settings.app.disableApiCallListen)try{gfg.settings.app?.enablePerformanceObserver?gfg.utility.listenForCartChangesViaPerformance(t):(gfg.utility.listenForApiCalls(t),!0===gfg.settings.app?.useListenForXmlHttpApiCallsV2?gfg.utility.listenForXmlHttpApiCallsV2(t):gfg.utility.listenForXmlHttpApiCalls(t))}catch(t){gfg.utility.debugConsole("Error initializing listeners",t)}gfg.utility.checkGfgDebugMode(),"product"===gfg.state.page_type&&gfg.productPage.init(t),t.app.disableSideCart?"cart"===gfg.state.page_type&&gfg.cartPage.init(t):gfg.cartPage.init(t),gfg.gfgGlobalWidgets&&!gfg.gfgGlobalWidgets._isStub&&gfg.gfgGlobalWidgets.init(t);let r=0;setInterval(async()=>{if(!e){e=!0,gfg.gfgVolDiscount&&!gfg.gfgVolDiscount._isStub&&(gfg.gfgVolDiscount.actions.listenQuantityUpdates(),gfg.gfgVolDiscount.f.listenVariantChangeForVolDiscountProductPage()),(t.app.enablingApiFromSetInterval||t.app.disableApiCallListen)&&await gfg.utility.callchecksAfterApiCalls(),await gfg.utility.syncRewardCampaignName();let n=!1,a=!1;"product"===gfg.state.page_type&&gfg.elements.addToCartBtn&&0==document.querySelectorAll(gfg.selectors.productPageWrapperV2).length&&(gfg.utility.debugConsole("productPage-insertWrapperIntoPage1"),gfg.productPage.f.insertWrapperIntoPage(t),n=!0);let i=document.querySelectorAll(gfg.selectors.checkoutBtn);i.length>0&&0==document.querySelectorAll(gfg.selectors.cartPageWrapperV2).length&&(gfg.utility.debugConsole("cartPage-insertWrapperIntoPage"),gfg.cartPage.f.insertWrapperIntoPage(t),a=!0),gfg.cartPage.f.insertSideCartWrappersIntoPage(t),(n||a)&&gfg.state?.shouldInitShippingDiscountAgain&&gfgCustomDiscount&&gfgCustomDiscount.gfgShippingDiscountV2&&(gfg.state.shouldInitShippingDiscountAgain=!1,gfgCustomDiscount.gfgShippingDiscountV2.init()),(n||a)&&gfg.state?.shouldInitUnifiedDiscountAgain&&(gfg.state.shouldInitUnifiedDiscountAgain=!1,gfg.gfgUnifiedWidget&&(gfg.gfgUnifiedWidget.init(gfg.settings,"PRODUCT_PAGE"),gfg.gfgUnifiedWidget.init(gfg.settings,"CART_PAGE")));let o=document.querySelector(gfg.selectors.cartPageWrapperV2),c=o?.querySelector(".gftFreeGiftWrapper");c?.hasChildNodes()&&i.length>0&&0==r&&(r=1,gfg.utility.debugConsole("running process free gift"),gfg.utility.debugConsole("runProcessFreeGiftCount"),gfg.gfgFreeGift&&!gfg.gfgFreeGift._isStub&&await gfg.gfgFreeGift.f.checkForFreeGift());let s=document.querySelectorAll(".gfgFreeGiftMsgRowButton");s&&1==s.length&&!1===gfg.state.gfgFreeGiftMsgRowButton&&(gfg.state.gfgFreeGiftMsgRowButton=truncate,gfg.utility.debugConsole("gfgFreeGiftMsgRowButton click behavior"),document.querySelector(".gfgFreeGiftMsgRowButton").addEventListener("click",function(t){gfg.utility.debugConsole("button clicked");let e=document.querySelector(".gfgFreeGiftMsgRow");e&&(e.style.display="none"===e.style.display?"block":"none")})),e=!1}},1e3)}catch(t){gfg.utility.debugError("globalListenerError",t)}},executeCustomScriptOnLoadFn:function(){try{const customScript=gfg.settings.app.executeCustomScriptOnLoad;customScript&&eval(customScript)}catch(t){gfg.utility.debugError("error in executeCustomScriptOnLoadFn",t)}},checkIfVisitingFromCountryRequired:function(){try{const t=t=>t?.some(t=>"countrySelects"===t?.ruleType||"shippingCountry"===t?.ruleType),e=gfg.settings.freeGifts||[];for(const r of e)if(t(r?.conditionsData?.conditionsList))return!0;const r=gfg.settings.discounts||[];for(const e of r)if(t(e?.conditionsData?.conditionsList))return!0;const n=gfg.settings.unifiedWidgets||[];for(const e of n)if(t(e?.customerRulesData?.rulesGlobalList?.[0]?.rulesList))return!0;const a=gfg.settings.shippingDiscount||[];for(const e of a)if(t(e?.rulesData?.rulesGlobalList?.[0]?.rulesList))return!0;const i=gfg.settings.customDiscount||[];for(const e of i)if(t(e?.rulesData?.rulesGlobalList?.[0]?.rulesList))return!0;return!1}catch(t){gfg.utility.debugError("error in checkIfVisitingFromCountryRequired fn",t)}},applyImpFileCssStyling:function(){try{const t=10;let e=0;const r=setInterval(()=>{if(e>t)return void clearInterval(r);e++;const n=document.querySelectorAll("#slidecarthq, .slidecarthq").length>1,a=window&&!window?.location?.pathname?.includes("/cart");if(!n||!a)return;fetch("https://free-gift-app7.s3.us-east-2.amazonaws.com/Storefront/freeGiftLogicv1Imp.css").then(t=>t.text()).then(t=>{const e=document.createElement("style");e.type="text/css",e.id="freeGiftLogicv1Imp",e.setAttribute("data-source-name","gfgFreeGift"),e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t)),document.head.appendChild(e),gfg.f.setCustomStyling(),clearInterval(r)}).catch(t=>{gfg.utility.debugError("error in applyImpFileCssStyling fn",t)})},1e3)}catch(t){gfg.utility.debugError("error in applyImpFileCssStyling fn",t)}},consoleAdvertisement:function(){try{setTimeout(()=>{const t=gfg?.settings?.app?.showConsoleAdvertisement;if(t){let t="https://r.skailama.com/kite-install-CM/",e="Kite - All-in-one discount & free gift app:",r="font-weight: 600; color: black; font-size: 14px;",n="font-weight: normal; color: #007BFF; text-decoration: underline; cursor: pointer; font-size: 14px;";console.log(`%c${e} %c${t}`,r,n)}},4e3)}catch(t){gfg.utility.debugConsole("error in consoleAdvertisement",t)}},revalidateCache:function(){try{const t=sessionStorage.getItem("gfgPrevLocale")??null,e=sessionStorage.getItem("gfgPrevActiveCurrency")??null,r=window.Shopify.locale,n=window.Shopify.currency.active;(t&&t!==r||e&&e!==n)&&(sessionStorage.removeItem("gfgFreeGiftsShopifyData"),gfg.gfgFreeGift&&!gfg.gfgFreeGift._isStub&&gfg.gfgFreeGift.f.gfgGetAllFreeGiftData()),sessionStorage.setItem("gfgPrevLocale",r),sessionStorage.setItem("gfgPrevActiveCurrency",n)}catch(t){gfg.utility.debugError("error in revalidateCache => ",t)}},handleShadowRootDetection:function(){try{if(gfg.settings.app.runShadowRootDetection){let t=0;const e=10,r=1e3,n=function(){try{let e;return e=gfg.settings.app.shadowRootSelector?document.querySelector(gfg.settings.app.shadowRootSelector):document.querySelector(SHADOW_ROOTS_SELECTORS),!(!e||!e.shadowRoot)&&(gfg.state.shadowRoot.isDetected=!0,gfg.state.shadowRoot.reference=e.shadowRoot,gfg.utility.injectCssIntoShadowRoot(gfg.state.shadowRoot.reference),clearInterval(a),gfg.utility.debugError("Shadow root detected on attempt "+(t+1)),gfg.state.shadowRoot.pendingEventCampaignIndices&&gfg.state.shadowRoot.pendingEventCampaignIndices.length>0&&(gfg.state.shadowRoot.pendingEventCampaignIndices.forEach(function(t){gfg.gfgFreeGift&&!gfg.gfgFreeGift._isStub&&gfg.gfgFreeGift.f.registerShadowRootEvents(t)}),gfg.state.shadowRoot.pendingEventCampaignIndices=[]),gfgCustomDiscount?.gfgBXGY?.actions?.registerGlobalClickListener&&gfgCustomDiscount.gfgBXGY.actions.registerGlobalClickListener(),!0)}catch(t){return gfg.utility.debugError("error in detectShadowRoot attempt",t),!1}};if(n())return;const a=setInterval(function(){t++,(n()||t>=e)&&(clearInterval(a),t>=e&&!gfg.state.shadowRoot.isDetected&&gfg.utility.debugError("Shadow root detection stopped after "+e+" attempts"))},r)}}catch(t){gfg.utility.debugError("error in handleShadowRootDetection",t)}}},utility:{convertCollectionIdToGidFormat:function(t){return`gid://shopify/Collection/${t}`},hasCartChanged:function(t,e){try{if(!t||!e)return!0;if(t.item_count!==e.item_count)return!0;if(t.total_price!==e.total_price)return!0;if((t.items||[]).length!==(e.items||[]).length)return!0;const r=new Map;(t.items||[]).forEach(t=>{r.set(t.variant_id,t.quantity)});for(const t of e.items||[]){if((r.get(t.variant_id)||0)!==t.quantity)return!0}return!1}catch(t){return gfg.utility.debugError("Error in hasCartChanged:",t),!0}},getLocale:function(){try{return window.Shopify&&window.Shopify.locale?window.Shopify.locale:"en"}catch(t){gfg.utility.debugError("Error in getLocale:",t)}},setLanguageLocale:function(){try{let t=gfg.utility.getLocale();(gfg.settings.languageData&&"SINGLE"==gfg.settings.languageData.languageMode||!gfg.settings.languageData[t])&&(t="en"),gfg.settings.languageData=gfg.settings.languageData[t]}catch(t){gfg.utility.debugError("Error in setLanguageLocale:",t)}},getUrlRewardCampaignName:function(){try{let t="";if("EMPTY"!=gfg.state.activeCampaignName)return gfg.state.activeCampaignName;let e=gfg.settings?.urlSearchString.split("kite_campaign=");if(e&&e.length>1){let t=e[1].split("&")[0];return t?(gfg.state.activeCampaignName=t,sessionStorage.setItem("kite_campaign",t),t):""}return sessionStorage.getItem("kite_campaign")?(t=sessionStorage.getItem("kite_campaign"),gfg.state.activeCampaignName=t,t):""}catch(t){gfg.utility.debugError("Error in getUrlRewardCampaignName:",t)}},syncRewardCampaignName:async function(){try{if(""!=gfg.state.activeCampaignName&&"EMPTY"!=gfg.state.activeCampaignName&&!gfg.state.setCampaignUrlattribute){gfg.state.setCampaignUrlattribute=!0;const t=await gfg.utility.getCartV2();if(!t)return void(gfg.state.setCampaignUrlattribute=!1);let e={};try{const r=t?.attributes?._kite_ccdData;e=r?JSON.parse(r):{}}catch(t){e={}}const r=t?.attributes?.kite_campaign===gfg.state.activeCampaignName,n=e.kite_campaign===gfg.state.activeCampaignName;if(r&&n)return;e.kite_campaign=gfg.state.activeCampaignName,await gfg.utility.updateCart({attributes:{kite_campaign:gfg.state.activeCampaignName,_kite_ccdData:JSON.stringify(e)}})}return}catch(t){gfg.utility.debugError("Error in syncRewardCampaignName:",t)}},isCampaignUrlActive:function(t){const e=t?.value;if(!e)return!0;const r=t.id||"kite_campaign",n="kite_campaign",a=t=>{gfg.state.activeCampaignName=t;try{sessionStorage.setItem(n,t)}catch(t){}};try{const t=new URLSearchParams(window.location.search).get(r);if(t&&(a(t),t===e))return!0}catch(t){}const i=gfg.settings?.urlSearchString||"";if(i)try{const t=new URLSearchParams(i.startsWith("?")?i:`?${i}`).get(r);if(t&&(a(t),t===e))return!0}catch(t){}try{if(sessionStorage.getItem(n)===e)return!0}catch(t){gfg.utility.debugError("Error reading sessionStorage in isCampaignUrlActive",t)}return!1},getCampaignScheduleStatus:function(t){try{const e=String(t?.campaignSchedule||"").trim().toUpperCase();if(!t||"SCHEDULED"!==e)return{scheduled:!1,notStarted:!1,expired:!1,active:!0};const r=new Date,n=new Date(t.startDateTime_UTC||t.startDateTime),a=new Date(t.endDateTime_UTC||t.endDateTime),i=!isNaN(n.getTime())&&ra;return{scheduled:!0,notStarted:i,expired:o,active:!i&&!o}}catch(t){return gfg.utility.debugError("Error inside gfg.utility.getCampaignScheduleStatus fn",t),{scheduled:!1,notStarted:!1,expired:!1,active:!0}}},checkForActiveCampaign:function(t){try{return!((t?.isCampaignUrlEnabled||t?.isTestMode)&&!gfg.utility.isCampaignUrlActive(t?.urlBasedCampaign))&&gfg.utility.getCampaignScheduleStatus(t?.campaignScheduleData).active}catch(t){return gfg.utility.debugError("Error inside gfg.utility.checkForActiveCampaign fn",t),!0}},addToCart:async function(t){try{const e="/cart/add.js?app=gfgfreegift",r={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},n=await fetch(e,r);if(!n.ok)throw new Error("Network response was not ok");await n.json();return!0}catch(t){return gfg.utility.debugError("error in gfg-utility-addToCart fn=>",t),!1}},changeCart:async function(t){try{const e="/cart/change.js?app=gfgfreegift",r={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},n=await fetch(e,r);if(!n.ok)throw new Error("Network response was not ok");await n.json();return!0}catch(t){return gfg.utility.debugError("error in gfg-utility-changeCart fn=>",t),!1}},getProductDataV2:function(t){try{let e=window?.Shopify?.routes?.root?window.Shopify.routes.root:"/";return new Promise(async(r,n)=>{if(gfg.settings.app?.productHandlesAreTranslated){const r=await gfg.utility.getProductTranslatedHandle(t,e);r&&""!=r&&(t=r)}fetch(e+"products/"+t+".js?app=gfgfreegift").then(t=>t.json()).then(e=>{gfg.utility.debugConsole("success-productName: ",t),r(e)}).catch(e=>{gfg.utility.debugConsole("fail-productName: ",t),r(!1)})})}catch(t){return gfg.utility.debugError("error in gfg-utility-getProductDataV2 fn=>",t),!1}},addToCartV2:function(t){try{const e=gfg.settings.app?.isKiteUniqueIdRequired;if(e){const e=gfg.utility.appendKiteUniqueIdToItemsProperty(t.items);t={items:e}}return new Promise((e,r)=>{fetch("/cart/add.js?app=gfgfreegift",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>{gfg.utility.debugConsole("success-/cart/add.js"),e(!0)}).catch(t=>{gfg.utility.debugConsole("fail-/cart/add.js"),e(!1)})})}catch(t){return gfg.utility.debugError("error in gfg-utility-addToCartV2 fn=>",t),!1}},getCart:async function(t){try{const t="/cart.js?app=gfgfreegift",e=await fetch(t),r=await e.json();return gfg.utility.refreshFreeGiftCartData(r),r}catch(t){return gfg.utility.debugConsole("error in gfg-utility-getCart fn=>",t),!1}},updateCart:async function(t){try{const e="/cart/update.js?app=gfgfreegift",r={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},n=await fetch(e,r),a=await n.json();return gfg.utility.updateCache(a),a}catch(t){return gfg.utility.debugConsole("error in shopifyUtility.updateCart",t),!1}},getCurrencySymbol:function(){try{if(window&&window.Shopify&&window.Shopify.currency&&window.Shopify.currency.active){return gfg.settings.merchantInfo.multipleCurrenciesInfo[window.Shopify.currency.active]?.symbol||getCurrencySymbolByCode(window.Shopify.currency.active)}}catch(t){gfg.utility.debugError("error in getCurrencySymbol",t)}},getActiveCurrencyRate:function(){try{let t=1;return window.Shopify&&window.Shopify.currency&&window.Shopify.currency.rate&&(t=window.Shopify.currency.rate),t}catch(t){gfg.utility.debugError("error in getActiveCurrencyRate",t)}},formatPrice:function(t){try{if(window&&window.Shopify&&window.Shopify.currency&&window.Shopify.currency.active){return gfg.utility.getCurrencySymbol()+""+parseFloat(t/100).toFixed(2)}}catch(t){gfg.utility.debugError("error in utility.formatPrice",t)}},formatPriceWithoutSymbol:function(t){try{return window&&window.Shopify&&window.Shopify.currency&&window.Shopify.currency.active,parseFloat(t/100).toFixed(2)}catch(t){gfg.utility.debugError("error in utility.formatPriceWithoutSymbol",t)}},refreshFreeGiftCartData:function(t){try{let e=[];if(t&&t.items&&t.items.length>0)for(let r=0;r",t),!1}},createMapForVariantId:function(t,e=void 0){try{let r={};for(let[n,a]of Object.entries(t)){let t=a;if(t.variants.length>0)for(let n=0;n",t),{}}},convertFromStoreCurrencyToCustomer:function(t){try{let e=gfg.utility.getActiveCurrencyRate();return parseFloat(t*e).toFixed(2)}catch(t){gfg.utility.debugError("error in gfg-utility-convertFromStoreCurrencyToCustomer fn=>",t)}},convertArrayToObject:function(t,e){try{let r={};for(let n=0;n{try{return"string"==typeof t?await gfg.utility.callchecksAfterApiCalls(e,t):t.clone().text().then(async t=>{await gfg.utility.callchecksAfterApiCalls(e,t)}),t}catch(e){return gfg.utility.debugConsole("Error in listenForApiCalls fn=>",e),t}}):t.apply(this,arguments)}}catch(t){gfg.utility.debugConsole("Error in listenForApiCalls fn=>",t)}},listenForCartChangesViaPerformance:function(t){try{const t=new Set,e=new PerformanceObserver(e=>{for(const r of e.getEntries()){const e=r.name,n=`${e}-${r.startTime}`;if(!t.has(n)){if(t.add(n),t.size>100){const e=t.values().next().value;t.delete(e)}e&&"string"==typeof e&&(e.includes("/cart/change")||e.includes("/cart/add")||e.includes("/cart/update")||e.includes("/cart/clear")||e.includes("graphql.json")&&!e.includes("skipListener=true"))&&(gfg.utility.debugConsole("PerformanceObserver: Cart operation detected - "+e),setTimeout(async()=>{try{await gfg.utility.callchecksAfterApiCalls(e)}catch(t){gfg.utility.debugConsole("PerformanceObserver: Error fetching cart - ",t)}},150))}}});e.observe({type:"resource",buffered:!1}),gfg.performanceObserver=e}catch(t){gfg.utility.debugConsole("Error in listenForCartChangesViaPerformance: ",t)}},listenForAjaxApiCalls:function(){try{var t=gfg.$.ajax;gfg.$.ajax=function(e,r){let n=e.url;return gfg.utility.debugConsole("gfg Request URL: "+n),n&&"string"==typeof n&&(n.includes("/cart/change")||n.includes("graphql.json")||n.includes("/cart/add")||n.includes("/cart/update")||n.includes("/cart/clear"))?t.apply(this,arguments).then(async function(t){try{return"string"==typeof t?await gfg.utility.callchecksAfterApiCalls(n,t):t.clone().text().then(async t=>{await gfg.utility.callchecksAfterApiCalls(n,t)}),t}catch(e){return gfg.utility.debugConsole("Error in ajax response data: ",e),t}}):t.apply(this,arguments)}}catch(t){gfg.utility.debugConsole("Error in listenForAjaxApiCalls: ",t)}},listenForXmlHttpApiCalls:function(){try{gfg.utility.debugConsole("inside xml http api call");const t=window.XMLHttpRequest;window.XMLHttpRequest=function(){const e=new t,r=e.open,n=e.send;return e.open=function(t,n){return e._url=n,gfg.utility.debugConsole("XMLHttpRequest Request URL: "+n),r.apply(this,arguments)},e.send=function(t){if(e._url&&"string"==typeof e._url&&(e._url.includes("/cart/change")||e._url.includes("graphql.json")||e._url.includes("/cart/add")||e._url.includes("/cart/update")||e._url.includes("/cart/clear"))){const t=e.onreadystatechange;e.onreadystatechange=async function(){if(e.readyState==XMLHttpRequest.DONE||4==e.readyState){const t=e.responseText;try{if("string"!=typeof t)return t.clone().text().then(async t=>{await gfg.utility.callchecksAfterApiCalls(e._url,t)}),t;gfg.utility.debugConsole(" callchecksAfterApiCalls for",e._url),await gfg.utility.callchecksAfterApiCalls(e._url,t)}catch(e){return gfg.utility.debugConsole("Error in XMLHttpRequest response data: ",e),t}}"function"==typeof t&&t.apply(e,arguments)}}return n.apply(this,arguments)},e}}catch(t){gfg.utility.debugConsole("Error in listenForXmlHttpApiCalls: ",t)}},listenForXmlHttpApiCallsV2:function(){try{gfg.utility.debugConsole("inside xml http api call");const t=window.XMLHttpRequest,e=t.prototype.open,r=t.prototype.send;t.prototype.open=function(t,r,...n){return this._url=r,gfg.utility.debugConsole("XMLHttpRequest Request URL: "+r),e.apply(this,[t,r,...n])},t.prototype.send=function(t){const e=this.onreadystatechange||function(){};return this.onreadystatechange=async function(...t){if((this.readyState===XMLHttpRequest.DONE||4===this.readyState)&&this._url&&"string"==typeof this._url&&(this._url.includes("/cart/change")||this._url.includes("/cart/add")||this._url.includes("/cart/update")||this._url.includes("/cart/clear")||this._url.includes("graphql.json")))try{const t=this.responseText;await gfg.utility.callchecksAfterApiCalls(this._url,t)}catch(t){gfg.utility.debugConsole("Error in XMLHttpRequest response data: ",t)}e.apply(this,t)},r.apply(this,[t])}}catch(t){gfg.utility.debugConsole("Error in listenForXmlHttpApiCallsV2: ",t)}},callchecksAfterApiCalls:async function(t,e){try{if(t&&"string"==typeof t&&t.includes("app=gfgfreegift"))return e;const r=async function(){let t;const r=gfg.state.cartData;if(gfg?.settings?.app?.considerRequestListenerData&&(t=gfg.utility.validateAndParseCartData(e)),t?(gfg.utility.updateCache(t),gfg.state.cartData=t):(gfg.state.cartData=await gfg.utility.getCartV2({forceRefresh:!0}),t=gfg.state.cartData,gfg.gfgVolDiscount&&!gfg.gfgVolDiscount._isStub&&gfg.gfgVolDiscount.actions.handleQuantityUpdate()),gfg.utility.hasCartChanged(r,t)){gfg.gfgFreeGift&&!gfg.gfgFreeGift._isStub&&gfg.gfgFreeGift.f.checkForFreeGift(t),gfg.gfgFreeGiftV2&&!gfg.gfgFreeGiftV2._isStub&&gfg.gfgFreeGiftV2.onCartChange(t),gfg.gfgGlobalWidgets&&!gfg.gfgGlobalWidgets._isStub&&gfg.gfgGlobalWidgets.onCartChange(t),gfg.gfgVolDiscount&&!gfg.gfgVolDiscount._isStub&&(gfg.gfgVolDiscount.init(gfg.settings,"CART_PAGE"),gfg.gfgVolDiscount.actions.handleQuantityUpdate()),gfg.gfgVolumeDiscountV2&&!gfg.gfgVolumeDiscountV2._isStub&&gfg.gfgVolumeDiscountV2.onCartChange(t),gfg.gfgUnifiedWidget&&!gfg.gfgUnifiedWidget._isStub&&(gfg.gfgUnifiedWidget.init(gfg.settings,"PRODUCT_PAGE"),gfg.gfgUnifiedWidget.init(gfg.settings,"CART_PAGE"));try{"undefined"!=typeof gfgConsolidatedCustomDiscount&&gfgConsolidatedCustomDiscount.init&&gfgConsolidatedCustomDiscount.init()}catch(t){gfg.utility.debugConsole("error in gfgConsolidatedCustomDiscount.init",t)}try{"undefined"!=typeof gfgDiscountAllocationSync&&gfgDiscountAllocationSync.onCartChange&&gfgDiscountAllocationSync.onCartChange()}catch(t){gfg.utility.debugConsole("error in gfgDiscountAllocationSync.onCartChange",t)}try{"undefined"!=typeof gfgStrikethroughEngine&&gfgStrikethroughEngine.handleCartChange&&gfgStrikethroughEngine.handleCartChange(t),"undefined"!=typeof gfgStrikethroughEngine&&gfgStrikethroughEngine.handleCollectionCartChange&&gfgStrikethroughEngine.handleCollectionCartChange(t)}catch(t){gfg.utility.debugConsole("error in gfgStrikethroughEngine.handleCartChange",t)}try{"undefined"!=typeof gfgCustomDiscount&&gfgCustomDiscount.gfgShippingDiscountV2&&gfgCustomDiscount.gfgShippingDiscountV2.init&&gfgCustomDiscount.gfgShippingDiscountV2.init()}catch(t){gfg.utility.debugConsole("error in gfgShippingDiscountV2.init",t)}try{"undefined"!=typeof gfgCustomDiscount&&gfgCustomDiscount.init&&gfgCustomDiscount.init()}catch(t){gfg.utility.debugConsole("error in gfgCustomDiscount.init",t)}}else gfg.utility.debugConsole("Cart data unchanged, skipping re-render")};gfg?.settings?.app?.delayInCallChecksAfterApiCalls&&"cart"!==gfg.state.page_type?(gfg.state.executeMainLogicTimeoutId&&clearTimeout(gfg.state.executeMainLogicTimeoutId),gfg.state.executeMainLogicTimeoutId=setTimeout(r,1e3)):r()}catch(t){gfg.utility.debugConsole("gfg Response data: ",e)}},isDebugEnabled:function(){try{return!!gfg.state.CONSTANT_DEBUG_FLAG||("true"==localStorage.getItem("debug")||"1"===new URLSearchParams(window.location.search).get("kite_debug"))}catch(t){return!1}},debugConsole:function(...t){try{gfg.utility.isDebugEnabled()&&console.log(...t)}catch(t){console.error("error inside debugConsole ->",t)}},debugError:function(...t){try{gfg.env,gfg.utility.isDebugEnabled()&&console.error(...t)}catch(t){console.error("error inside the debugError function ->",t)}},debugTrace:function(t,e,r,n){try{if(!gfg.utility.isDebugEnabled())return;const a="function"==typeof n?n():n,i=Object.assign({t:(new Date).toISOString(),label:r},a||{});Array.isArray(e)&&(e.push(i),e.length>200&&e.splice(0,e.length-200)),gfg.utility.debugConsole(`[${t}]`,r,a||"")}catch(t){}},setCustomerSpecificData:async function(){try{let t,e,r=!1,n=[],a={};window.shopifyLiquidValuesApp7Ext&&window.shopifyLiquidValuesApp7Ext.customer&&(a=shopifyLiquidValuesApp7Ext.customer),null!=a.email&&(t=a.id,n=a?.customerTags||[],r=!0);gfg.f.checkIfVisitingFromCountryRequired()&&(e=await gfg.utility.getVisitingFromCountry()),gfg.state.activeCustomerData={customerId:t,customerTags:n,isCustomerLoggedInBool:r,visitingFromCountry:e,markets:window.shopifyLiquidValuesApp7Ext?.markets}}catch(t){gfg.utility.debugError("error in setCustomerSpecificData",t)}},updateCartAttributeWithCustomerData:async function(){try{gfg.gfgVolDiscount&&!gfg.gfgVolDiscount._isStub&&gfg.gfgVolDiscount.f.removeInactiveCampaigns();let t=gfg.state.activeCustomerData;const e={};if(t?.customerId&&(e._loggedInId=t.customerId),t?.customerTags&&Array.isArray(t.customerTags)&&t.customerTags.length>0&&(e._customerTags=t.customerTags),t?.visitingFromCountry&&(e._visitingFromCountry=t.visitingFromCountry),Object.keys(e).length>0){const t={attributes:e};await gfg.utility.updateCart(t)}}catch(t){gfg.utility.debugError("error in updateCartAttributeWithCustomerData",t)}},redirectToPage:async function(t){window.location.href=t},checkIfTwoArrayHasCommonElement:(t,e)=>t.some(t=>e.includes(t)),formatPriceWithSeparator:function(t){try{t=(t=parseFloat(t/100))%1==0?t.toString():t.toFixed(2);const e=gfg.utility.getActiveCurrencyCode(),r=gfg.settings.merchantInfo.multipleCurrenciesInfo[e]?.thousandsSeparator||gfg.settings?.merchantInfo?.currencyInfo?.thousandsSeparator||",",n=gfg.settings.merchantInfo.multipleCurrenciesInfo[e]?.decimalSeparator||gfg.settings?.merchantInfo?.currencyInfo?.decimalSeparator||".";let[a,i]=t.toString().split(".");a=a.replace(/\B(?=(\d{3})+(?!\d))/g,r);return i?a+n+i:a}catch(e){return gfg.utility.debugError("error in formatPriceWithSeparator",e),t}},getActiveCurrencyCode:function(){try{return window.Shopify.currency.active?window.Shopify.currency.active:gfg.settings.merchantInfo.currencyInfo.code}catch(t){gfg.utility.debugError("error in getActiveCurrencyCode",t)}},getProductTranslatedHandle:function(t,e){return new Promise(async(r,n)=>{try{const n=e+"products/"+t,a=await fetch(n);if(!a.ok)throw new Error("Network response was not ok");let i=a.url;"/"===i[i.length-1]&&(i=i.substring(0,i.length-1)),gfg.utility.debugConsole("urlReturned",i);let o=i.split("/").pop().split(".")[0];gfg.utility.debugConsole("newHandle",o),r(o)}catch(t){gfg.utility.debugError("error in getProductTranslatedHandle",t),r(!1)}})},checkGfgDebugMode:function(){try{if("true"===new URLSearchParams(window.location.search).get("_gfgDebugMode")){var t=new FormData;t.append("attributes[_gfgDebugMode]",!0),fetch(window.Shopify.routes.root+"cart/update.js",{method:"POST",body:t}).then(t=>t.json()).then(t=>{gfg.utility.debugConsole(`Cart update successful: ${t}`)}).catch(t=>{gfg.utility.debugConsole(`Error updating cart: ${t}`)})}}catch(t){gfg.utility.debugConsole(`Error in checkGfgDebugMode: ${t}`)}},getFontWeightValue:function(t){try{return{bold:"700",medium:"600",regular:"400"}[t]||t}catch(e){return gfg.utility.debugConsole("error in getFontWeightValue",e),t}},getFontSizeValue:function(t){try{return"string"!=typeof t||t?.includes("px")?t:t+"px"}catch(t){gfg.utility.debugConsole("error in getFontSizeValue",t)}},getVisitingFromCountry:async function(){let t;try{const e=!(!window||!window.localStorage);if(e&&(t=localStorage.getItem("visitingFromCountry"),t))return t;const r="https://get.geojs.io/v1/ip/geo.json",n=await fetch(r);if(!n.ok)throw new Error("Error while fetching the visiting from country");const a=await n.json();t=a?.country_code,e&&localStorage.setItem("visitingFromCountry",t)}catch(t){gfg.utility.debugError("error in getVisitingFromCountry",t)}finally{return t}},getRegionalLocaleUrl:function(){let t="";try{let e=window.location.pathname.split("/")||"",r=Shopify.locale||"";r&&""!==r&&e&&(r===e[1]?t=`/${r}`:e[1].includes(r)&&(t=`/${e[1]}`))}catch(t){gfg.utility.debugError("error in getRegionalLocaleUrl",t)}finally{return t}},getHrefForProductCollectionHandle:function(t,e){let r=("product"==t?"/products/":"/collections/")+e;try{const t=gfg.settings.app?.isRegionalLocaleUrlRequiredForHref;t&&(r=gfg.utility.getRegionalLocaleUrl()+r)}catch(t){gfg.utility.debugError("getHrefForProductCollectionHandle",t)}finally{return r}},findWrapperElement:function(t,e,r,n="JS"){let a=[];try{const n=gfg.state.featuresWrapperMap,i="cart"!==gfg.state.page_type&&("CART_PAGE"===e||"SIDE_CART"===e);let o,c,s,u,g,l=gfg.productPage.f.insertWrapperIntoPage,d=PRODUCT_PAGE_APP_BLOCK_SELECTOR,f=".gfgProductPageWrapperV2",p=i?`${t}-SIDE_CART-${r}`:`${t}-${e}-${r}`;switch("CART_PAGE"!==e&&"SIDE_CART"!==e||(f=".gfgCartPageWrapperV2",d=CART_PAGE_APP_BLOCK_SELECTOR,l=gfg.cartPage.f.insertWrapperIntoPage),t){case"FREE_GIFT":c=FREE_GIFT_APP_BLOCK_SELECTOR,o=".gftFreeGiftWrapper",s=FREEGIFT_SIDE_CART_WRAPPER_SELECTOR,u=FREEGIFT_SIDE_CART_WRAPPER,g=gfg.settings.app?.freeGiftSideCartSelector;break;case"VOLUME_DISCOUNT":c=VOLUME_DISCOUNT_APP_BLOCK_SELECTOR,o=".gfgVolDiscountWrapper",s=VOLUME_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR,u=VOLUME_DISCOUNT_SIDE_CART_WRAPPER,g=gfg.settings.app?.volumeDiscountSideCartSelector;break;case"BOGO":c=BOGO_APP_BLOCK_SELECTOR,o=".gfgBogoWrapper",s="",g=!1;break;case"UNIFIED":c=UNIFIED_APP_BLOCK_SELECTOR,o=".gfgUnifiedDiscountWrapper",s=UNIFIED_SIDE_CART_WRAPPER_SELECTOR,u=UNIFIED_SIDE_CART_WRAPPER,g=gfg.settings.app?.unifiedSideCartSelector;break;case"CUSTOM_DISCOUNT":c=CUSTOM_DISCOUNT_APP_BLOCK_SELECTOR,o=".gfgCustomDiscountWrapper",s=CUSTOM_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR,u=CUSTOM_DISCOUNT_SIDE_CART_WRAPPER,g=gfg.settings.app?.customDiscountSideCartSelector;break;case"CONSOLIDATED_PROGRESS_BAR":c=CONSOLIDATED_PROGRESS_BAR_APP_BLOCK_SELECTOR,o=".gfgConsolidatedProgressBarWrapper",s=CONSOLIDATED_PROGRESS_BAR_SIDE_CART_WRAPPER_SELECTOR,u=CONSOLIDATED_PROGRESS_BAR_SIDE_CART_WRAPPER,g=gfg.settings.app?.consolidatedProgressBarSideCartSelector;break;case"SHIPPING_DISCOUNT":c=SHIPPING_DISCOUNT_APP_BLOCK_SELECTOR,o=".gfgShippingDiscountWrapper",s=SHIPPING_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR,u=SHIPPING_DISCOUNT_SIDE_CART_WRAPPER,g=gfg.settings.app?.shippingDiscountSideCartSelector}const m=Array.from(document.querySelectorAll(c));if(m.length>0&&!i){let t=!1;m.forEach(e=>{const n=JSON.parse(e.getAttribute("data-setting"))?.blockId;n&&n==r&&(a=e,t=!0)}),t||(a=m),n[p]="V3(feature specific block)"}else if((g||"CONSOLIDATED_PROGRESS_BAR"===t)&&i){let t;t=gfg.state.shadowRoot.isDetected?gfg.state.shadowRoot.reference.querySelector(s):document.querySelector(s),t||(gfg.cartPage.f.insertSideCartWrappersIntoPage(),t=document.querySelector(s)),t||(t=u),a=t?[t]:a,n[p]="V4(feature specific side cart wrapper)"}else if(document.querySelector(d)){const t=document.querySelector(`${d}${f}`),e=t?.querySelector(o);a=e?[e]:[],n[p]="V2(archived app block)"}else if("product"===gfg.state.page_type||"cart"===gfg.state.page_type||i){l();const t=document.querySelector(`${f}`);let e=t?.querySelector(o);!e&&i&&(e=gfg.elements.cartPageWrapperV2?.querySelector(o)),a=e?[e]:[],n[p]="V1(default selector)"}gfg.state.featuresWrapperMap=n}catch(t){gfg.utility.debugError("error in findWrapperElement",t)}finally{return a}},BXGYActionsAfterAddToCart:function(){try{const global_afterAddToCartScript=gfg.settings.app?.global_afterAddToCartScript,executeCustomScriptAfterDynamicBogoAddition=gfg.settings.app?.executeCustomScriptAfterDynamicBogoAddition;if(global_afterAddToCartScript?eval(global_afterAddToCartScript):gfg.f.updateCartState(),executeCustomScriptAfterDynamicBogoAddition&&""!==executeCustomScriptAfterDynamicBogoAddition.trim())try{const t=new Function(executeCustomScriptAfterDynamicBogoAddition);t()}catch(t){gfg.utility.debugConsole("error in executeCustomScriptAfterDynamicBogoAddition",t)}}catch(t){gfg.utility.debugError("error in BXGYActionsAfterAddToCart",t)}},injectWrapperRelativeToSelector:function(t,e,r=!0,n=null){try{let a;if(a=gfg.state.shadowRoot.isDetected?gfg.state.shadowRoot.reference.querySelector(e):document.querySelector(e),a){const e=r?"beforebegin":"afterend";if(n){if(document.querySelector(n))return void gfg.utility.debugConsole("Wrapper element is already in the DOM, skipping injection.");const t=document.createElement("div");t.className=n.replace(/^\./,""),a.insertAdjacentElement(e,t),gfg.utility.debugConsole("Created fresh wrapper element for injection: "+t.className)}else document.body.contains(t)?gfg.utility.debugConsole("Wrapper element is already in the DOM, skipping injection."):a.insertAdjacentElement(e,t)}}catch(t){gfg.utility.debugError("error in injectWrapperRelativeToSelector",t)}},validateAndParseCartData:function(t){let e=null;try{e="string"==typeof t?JSON.parse(t):t,"object"==typeof e&&null!==e&&"token"in e&&Array.isArray(e.items)||(e=null)}catch(t){gfg.utility.debugError("validateAndParseCartData:",t),e=null}finally{return e}},getWrapperSkeleton:function(t){try{const e=document.createElement("div"),r='';return"PRODUCT_PAGE"===t?e.classList.add("gfgPageWrapper","gfgProductPageWrapperV2","gfgUnifiedDiscountWrapper"):"CART_PAGE"===t&&e.classList.add("gfgPageWrapper","gfgCartPageWrapperV2","gfgUnifiedDiscountWrapper"),e.innerHTML=r,e}catch(t){gfg.utility.debugError("error in getWrapperSkeleton",t)}},dataMappingFromGraphql:function(t){try{const e=t=>{const e=[];return Object.keys(t).forEach(r=>{r.startsWith("metafield_")&&t?.[r]&&e.push(t[r])}),e};let r=JSON.parse(JSON.stringify(t)),n=[];for(let a=0;agfg.utility.trimHttps(t?.originalSrc)),i.media=t?.images?.map((t,e)=>({alt:t.alt,computedPosition:e+1,gid:t.id,id:t.id?.split("/").pop(),src:t?.originalSrc})),i.compare_at_price=100*(t?.compareAtPriceRange?.maxVariantPrice?.amount||t?.compareAtPriceRange?.minVariantPrice?.amount)||null,i.price=100*(t?.priceRange?.maxVariantPrice?.amount||t?.priceRange?.minVariantPrice?.amount),i.selling_plan_groups=[],i.variants=[],i.metafields=e(t);const s=t.variants;for(let t=0;tt.value),option1:e[0]?.value||null,option2:e[1]?.value||null,option3:e[2]?.value||null,public_title:e.map(t=>t.value).join(" / "),name:"Default Title"===s[t].title?i.title:i.title+" - "+s[t].title,featured_image:{id:s[t]?.image?.id?.split("/").pop(),src:s[t]?.image?.originalSrc,transformed_src:s[t]?.image?.transformedSrc},compare_at_price:s[t].compareAtPrice?100*parseFloat(s[t].compareAtPrice.amount):null,selling_plan_allocations:[]};i.variants.push(r)}i._isPresentmentPrice=!0,n.push(i)}return n}catch(t){gfg.utility.debugError("error in dataMappingFromGraphQL ",t)}},trimHttps:function(t){try{return t.startsWith("https:")?t.substring(6):t}catch(t){gfg.utility.debugError("error in trimHttps",t)}},escapeHtml:function(t){return String(null==t?"":t).replace(/[&<>"']/g,function(t){return"&"===t?"&":"<"===t?"<":">"===t?">":'"'===t?""":"'"})},appendKiteUniqueIdToItemsProperty:function(t=[]){try{return t=t.map(t=>(t?.hasOwnProperty("_kite_uid")&&delete t._kite_uid,t.properties._kite_uid=gfg.utility.randomIdGenerator(20),t))}catch(t){gfg.utility.debugError("error in appendKiteUniqueIdToItemsProperty",t)}},randomIdGenerator:function(t){try{let e="";const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;for(let a=0;a{const{key:e,namespace:r}=t;return`metafield_${r}_${e}: metafield(key:"${e}", namespace:"${r}"){ \n id \n key\n value\n description\n }`}).join(" ")}catch(t){gfg.utility.debugError("error in generateMetafieldQueries",t)}},getCartV2:async function(t={}){try{const{forceRefresh:e=!1,maxAge:r=5e3}=t,n=Date.now(),a=gfg.state.cartCache;if(!e&&a.data&&a.timestamp&&n-a.timestamp{a.pendingPromises.push({resolve:t,reject:e})});a.isLoading=!0;const i="/cart.js?app=gfgfreegift&source=getCartV2",o=await fetch(i),c=await o.json();gfg.state.cartData=JSON.parse(JSON.stringify(c)),gfg.utility.updateCache(c);const s=a.pendingPromises;return a.pendingPromises=[],s.forEach(({resolve:t})=>t(c)),c}catch(t){const e=gfg.state.cartCache;e.isLoading=!1;const r=e.pendingPromises;return e.pendingPromises=[],r.forEach(({reject:e})=>e(t)),gfg.utility.debugError("gfg-utility-getCartV2",t),!1}},updateCache:function(t){try{if(!t)return;const e=gfg.state.cartCache;e.data=t,e.timestamp=Date.now(),e.isLoading=!1;const r=JSON.parse(JSON.stringify(t));return gfg.state.cartData=r,gfg.utility.refreshFreeGiftCartData(r),!0}catch(t){return gfg.utility.debugError("error in updateCache",t),!1}},sendErrorLogAlerts:async function(t=[]){try{const[e,r]=t;if(gfg.excludeErrors.some(t=>t.startsWith(r?.message??e)))return;const n="gfgErrorLogsMap";if(!gfg.errorLogs){const t=sessionStorage.getItem(n);gfg.errorLogs=t?JSON.parse(t):{}}if(!gfg.errorLogs?.[e]?.[r?.message]){gfg.errorLogs[e]={...gfg.errorLogs?.[e]??{},[r?.message]:!0};const t={shopName:gfg?.settings?.merchantInfo?.shopName,currentUrl:window.location.href,browserDetails:window?.navigator?.userAgent,origin:"kite-storefront-extension-files",logMessage:e},a={fields:t,error:{message:r?.message,stack:r?.stack}};sessionStorage.setItem(n,JSON.stringify(gfg.errorLogs));try{const t=await fetch("/apps/kite/triggerErrorSlackNotification",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});t?.ok||gfg.utility.debugConsole("Error Log Notification Sent Failed",t?.status),gfg.utility.debugConsole("Error Log Notification Sent Successfully",t?.status)}catch(t){gfg.utility.debugConsole("Error Log Notification Sent Failed",t)}}}catch(t){gfg.utility.debugConsole("error inside sendErrorLogAlerts",t)}},injectCssIntoShadowRoot:function(t){try{const e=document.querySelector('link[href*="freeGiftLogicv1"]');if(e?.href){const r=document.createElement("link");r.rel="stylesheet",r.href=e.href,t.appendChild(r)}}catch(t){gfg.utility.debugError("error in injectCssIntoShadowRoot",t)}},isPageRelevantForWidget:function(t,e){try{const r="PRODUCT_PAGE"===e&&t?.productPages,n="PRODUCT_PAGE"===e&&t?.specificProductPages,a="PRODUCT_PAGE"===e&&t?.specificCollectionPages;if("CART_PAGE"===e&&t?.cartPage||"SIDE_CART"===e&&t?.sideCart||r)return!0;if(n){const e=t.specificProducts,r=gfg.f.getProductPageHandle(),n=gfg.f.getProductPageId();for(const t of e)if(r===t.handle||n==t.productId)return!0}if(a){const e=t.specificCollections,r=window.shopifyLiquidValuesApp7Ext.product?.collections||[];if(0===r.length)return!1;for(const t of e){const e=t.id.replace("gid://shopify/Collection/","");if(r.find(r=>r.handle==t.handle||r.id==e))return!0}}return!1}catch(t){return gfg.utility.debugError("error in isPageRelevantForWidget",t),!1}}},productPage:{init:async function(t){gfg.utility.debugConsole("productPage-init"),gfg.productPage.f.insertWrapperIntoPage(t),gfg.gfgFreeGift&&!gfg.gfgFreeGift._isStub&&gfg.gfgFreeGift.init(t,"PRODUCT_PAGE"),gfg.gfgFreeGiftV2&&!gfg.gfgFreeGiftV2._isStub&&t.freeGiftsV2?.length>0&&gfg.gfgFreeGiftV2.init(t.freeGiftsV2),gfg.gfgVolDiscount&&!gfg.gfgVolDiscount._isStub&&gfg.gfgVolDiscount.init(t,"PRODUCT_PAGE"),gfg.gfgVolumeDiscountV2&&!gfg.gfgVolumeDiscountV2._isStub&&gfg.gfgVolumeDiscountV2.init(t,"PRODUCT_PAGE"),gfg.gfgBogoFeature&&!gfg.gfgBogoFeature._isStub&&gfg.gfgBogoFeature.init(t,"PRODUCT_PAGE"),gfg.gfgUnifiedWidget&&!gfg.gfgUnifiedWidget._isStub&&gfg.gfgUnifiedWidget.init(t,"PRODUCT_PAGE"),"undefined"!=typeof gfgCustomDiscount&&gfgCustomDiscount.init&&gfgCustomDiscount.init(),"undefined"!=typeof gfgConsolidatedCustomDiscount&&gfgConsolidatedCustomDiscount.init&&gfgConsolidatedCustomDiscount.init()},f:{insertWrapperIntoPage:function(t){if(document.querySelector(".gfgProductPageAppBlock"))return void gfg.utility.debugConsole("product page app block present");const e="product"===gfg.state.page_type,r=gfg.elements.addToCartBtn,n=document.querySelector(gfg.selectors.productPageWrapperV2);if(e&&r&&!n){const t=r;if(t.offsetParent){const e=t.parentNode,r=gfg.elements.productPageWrapperV2;e.insertBefore(r,gfg.settings.app.addAfterAddTocartBtn?t.nextSibling:t)}}}},actions:{}},cartPage:{init:async function(t){gfg.utility.debugConsole("cartPage-init"),gfg.cartPage.f.insertSideCartWrappersIntoPage(t),gfg.cartPage.f.insertWrapperIntoPage(t),gfg.gfgFreeGift&&!gfg.gfgFreeGift._isStub&&gfg.gfgFreeGift.init(t,"CART_PAGE"),gfg.gfgFreeGiftV2&&!gfg.gfgFreeGiftV2._isStub&&t.freeGiftsV2?.length>0&&gfg.gfgFreeGiftV2.init(t.freeGiftsV2),gfg.gfgVolDiscount&&!gfg.gfgVolDiscount._isStub&&gfg.gfgVolDiscount.init(t,"CART_PAGE"),gfg.gfgBogoFeature&&!gfg.gfgBogoFeature._isStub&&gfg.gfgBogoFeature.init(t,"CART_PAGE"),gfg.gfgUnifiedWidget&&!gfg.gfgUnifiedWidget._isStub&&gfg.gfgUnifiedWidget.init(t,"CART_PAGE"),"undefined"!=typeof gfgCustomDiscount&&gfgCustomDiscount.init&&gfgCustomDiscount.init(),"undefined"!=typeof gfgConsolidatedCustomDiscount&&gfgConsolidatedCustomDiscount.init&&gfgConsolidatedCustomDiscount.init(),"cart"!==gfg.state.page_type&&gfg.cartDrawerObserver.init()},f:{insertWrapperIntoPage:function(t){if(document.querySelector(".gfgCartPageAppBlock"))return void gfg.utility.debugConsole("Cart page app block present");const e=document.querySelectorAll(gfg.selectors.checkoutBtn),r=document.querySelector(gfg.selectors.cartPageWrapperV2);return e.length&&!r?new Promise(t=>{e.forEach(t=>{if(!t.offsetParent)return;const{theme_store_id:e}=window.Shopify?.theme||{},r=e===gfg.constants.themesIds.DAWN_THEME,n=gfg.elements.cartPageWrapperV2;r?t.parentNode.parentNode.insertBefore(n,t.parentNode):gfg.settings.app.addAftercheckoutBtn?t.parentNode.insertBefore(n,t.nextSibling):t.parentNode.insertBefore(n,t)}),t()}):void 0},insertSideCartWrappersIntoPage:function(t){try{if("cart"===gfg.state.page_type)return;const t=[{selector:gfg.settings.app?.freeGiftSideCartSelector,insertAbove:gfg.settings.app?.freeGiftSideCartWrapperAboveSelector,wrapper:FREEGIFT_SIDE_CART_WRAPPER,wrapperSelector:FREEGIFT_SIDE_CART_WRAPPER_SELECTOR},{selector:gfg.settings.app?.volumeDiscountSideCartSelector,insertAbove:gfg.settings.app?.volumeDiscountSideCartWrapperAboveSelector,wrapper:VOLUME_DISCOUNT_SIDE_CART_WRAPPER,wrapperSelector:VOLUME_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR},{selector:gfg.settings.app?.unifiedSideCartSelector,insertAbove:gfg.settings.app?.unifiedSideCartWrapperAboveSelector,wrapper:UNIFIED_SIDE_CART_WRAPPER,wrapperSelector:UNIFIED_SIDE_CART_WRAPPER_SELECTOR},{selector:gfg.settings.app?.customDiscountSideCartSelector,insertAbove:gfg.settings.app?.customDiscountSideCartWrapperAboveSelector,wrapper:CUSTOM_DISCOUNT_SIDE_CART_WRAPPER,wrapperSelector:CUSTOM_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR},{selector:gfg.settings.app?.consolidatedProgressBarSideCartSelector||DEFAULT_sideCartWidgetShowAboveSelectorsApp7Ext,insertAbove:gfg.settings.app?.consolidatedProgressBarSideCartWrapperAboveSelector,wrapper:CONSOLIDATED_PROGRESS_BAR_SIDE_CART_WRAPPER,wrapperSelector:CONSOLIDATED_PROGRESS_BAR_SIDE_CART_WRAPPER_SELECTOR},{selector:gfg.settings.app?.shippingDiscountSideCartSelector,insertAbove:gfg.settings.app?.shippingDiscountSideCartWrapperAboveSelector,wrapper:SHIPPING_DISCOUNT_SIDE_CART_WRAPPER,wrapperSelector:SHIPPING_DISCOUNT_SIDE_CART_WRAPPER_SELECTOR},{selector:gfg.settings.app?.bannerSideCartSelector||DEFAULT_sideCartWidgetShowAboveSelectorsApp7Ext,insertAbove:!1!==gfg.settings.app?.bannerSideCartWrapperAboveSelector,wrapper:GLOBAL_WIDGETS_SIDE_CART_WRAPPER,wrapperSelector:GLOBAL_WIDGETS_SIDE_CART_WRAPPER_SELECTOR}];let e=document;gfg.state.shadowRoot.isDetected&&(e=gfg.state.shadowRoot.reference),t.forEach(t=>{t.selector&&!e.querySelector(t.wrapperSelector)&&gfg.utility.injectWrapperRelativeToSelector(t.wrapper,t.selector,t.insertAbove,t.wrapperSelector)})}catch(t){gfg.utility.debugConsole("error in insertSideCartWrappersIntoPage",t)}}},events:{}},customDiscountValidationFunctions:{updateCartAttributesWithTotalAmountWithoutFreeGift:async function(t){try{const e=t.attributes,r=Number(gfg.customDiscountValidationFunctions.getAmountOfGivenProductsWithoutFreeGift(t.items))/Number(gfg.utility.getActiveCurrencyRate());if(e&&e._kite_cfAdditionalData){let t=JSON.parse(e._kite_cfAdditionalData);if(r===t.totalAmountWithoutFreeGift)return}const n={totalAmountWithoutFreeGift:r},a={attributes:{_kite_cfAdditionalData:JSON.stringify(n)}};await gfg.utility.updateCart(a)}catch(t){gfg.utility.debugError("Error inside gfgShippingDiscountV2 updateCartAttributesWithTotalAmountWithoutFreeGift fn",t)}},getAmountOfGivenProductsWithoutFreeGift:function(t){try{let e=0;for(let r=0;r{const{product_id:n,handle:a,line_price:i,quantity:o}=t;e.push(n),r.push(a)});const o=e.map((t,e)=>{if(i[t])return Promise.resolve(i[t]);return a?gfg.customDiscountStorefrontApis.getProductsDataById([`gid://shopify/Product/${t}`]):gfg.utility.getProductDataV2(r[e])}),c=await Promise.all(o);t.items.forEach((t,e)=>{const r=t.product_id,n=c[e];i[r]||(i[r]=n),t.latestShopifyData=n}),sessionStorage.setItem(`customFunctionProductData-${n}`,JSON.stringify(i))}catch(t){gfg.utility.debugError("Error inside gfgShippingDiscountV2 getLatestCartItemsProductData fn",t)}}},customDiscountStorefrontApis:{flattenGraphQLResponseV2:function(t){try{return gfg.utility.debugConsole("response",t),function t(e){if(Array.isArray(e))return e.map(t);if("object"==typeof e&&null!==e){if("edges"in e)return t(e.edges);if("node"in e)return t(e.node);if("nodes"in e)return t(e.nodes);const r={};for(const[n,a]of Object.entries(e))r[n]=t(a);return r}return e}(t)}catch(t){gfg.utility.debugError("Error inside gfgCustomDiscount flattenGraphQLResponseV2 fn",t)}},makeGraphQLApiCall:async function(t,e){try{e.languageCode=normalizeLangCode(e.languageCode);const{shopName:r,storefrontAccessToken:n}=gfg.settings.merchantInfo,a=r,i=n,o=await fetch(`https://${a}/api/2023-04/graphql.json?skipListener=true`,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":i},body:JSON.stringify({query:t,variables:e})});if(!o.ok)throw new Error(`HTTP error! Status: ${o.status}`);const c=await o.json();return gfg.customDiscountStorefrontApis.flattenGraphQLResponseV2(c)}catch(t){gfg.utility.debugError("Error inside gfgCustomDiscount makeGraphQLApiCall fn",t)}},getProductsDataById:async function(t){try{const e=`query test($ids: [ID!]!, $countryCode: CountryCode!, $languageCode: LanguageCode!) @inContext(country: $countryCode, language: $languageCode) { \n nodes(ids: $ids) {\n ... on Product{\n id\n availableForSale\n title\n handle\n productType\n collections(first: ${gfg.settings.app.collectionsFetchLimit||250}) {\n edges {\n node {\n id\n }\n }\n }\n featuredImage{\n originalSrc\n }\n tags\n vendor\n compareAtPriceRange{\n maxVariantPrice{\n amount\n currencyCode\n }\n minVariantPrice{\n amount\n currencyCode\n }\n }\n priceRange{\n maxVariantPrice{\n amount\n currencyCode\n }\n minVariantPrice{\n amount\n currencyCode\n }\n }\n variants(first: 100) {\n edges {\n node {\n id\n title\n price{\n amount\n currencyCode\n }\n currentlyNotInStock \n compareAtPrice{\n amount\n currencyCode\n }\n image {\n originalSrc\n }\n selectedOptions{\n name\n value\n }\n availableForSale\n }\n }\n }\n }\n }\n }`,r={ids:t,countryCode:window?.Shopify?.country||"IN",languageCode:window?.Shopify?.locale?.toUpperCase()||"EN"};r.languageCode=normalizeLangCode(r.languageCode);try{const{shopName:t,storefrontAccessToken:n}=gfg.settings.merchantInfo,a=t,i=n,o=await fetch(`https://${a}/api/2023-04/graphql.json?skipListener=true`,{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":i},body:JSON.stringify({query:e,variables:r})});if(!o.ok)throw new Error(`HTTP error! Status: ${o.status}`);const c=await o.json();let s=gfg.customDiscountStorefrontApis.flattenGraphQLResponseV2(c);return s?.data?.[0]}catch(t){gfg.utility.debugConsole("Error:",t)}}catch(t){gfg.utility.debugError("Error inside gfgCustomDiscount getProductsDataById fn",t)}},getCollectionsDataById:async function(t){try{const e=`query test($ids: [ID!]!, $countryCode: CountryCode!, $languageCode: LanguageCode!) @inContext(country: $countryCode, language: $languageCode) { \n nodes(ids: $ids) {\n ... on Collection{\n title\n id\n products(first: 50) {\n edges {\n node {\n id\n availableForSale\n title\n handle\n productType\n collections(first: ${gfg.settings.app.collectionsFetchLimit||250}) {\n edges {\n node {\n id\n }\n }\n }\n featuredImage {\n originalSrc\n }\n tags\n vendor\n compareAtPriceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n variants(first: 100) {\n edges {\n node {\n id\n title\n price {\n amount\n currencyCode\n }\n currentlyNotInStock\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n originalSrc\n }\n selectedOptions {\n name\n value\n }\n availableForSale\n }\n }\n }\n }\n }\n }\n }\n }\n }`,r={ids:t,countryCode:window?.Shopify?.country||"IN",languageCode:window?.Shopify?.locale?.toUpperCase()||"EN"},n=await gfg.customDiscountStorefrontApis.makeGraphQLApiCall(e,r);return n?.data}catch(t){gfg.utility.debugError("Error inside gfgCustomDiscount getCollectionsDataById fn",t)}},getProductsDataByTagName:async function(t){try{const e=`query GetProductsByTags($tag: String!) {\n products(first: 50, query: $tag) {\n edges {\n node {\n id\n availableForSale\n title\n handle\n productType\n collections(first: ${gfg.settings.app.collectionsFetchLimit||250}) {\n edges {\n node {\n id\n }\n }\n }\n featuredImage {\n originalSrc\n }\n tags\n vendor\n compareAtPriceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n variants(first: 100) {\n edges {\n node {\n id\n title\n price {\n amount\n currencyCode\n }\n currentlyNotInStock\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n originalSrc\n }\n selectedOptions {\n name\n value\n }\n availableForSale\n }\n }\n }\n }\n }\n }\n }`,r={tag:t,countryCode:window?.Shopify?.country||"IN",languageCode:window?.Shopify?.locale?.toUpperCase()||"EN"},n=await gfg.customDiscountStorefrontApis.makeGraphQLApiCall(e,r);return n?.data}catch(t){gfg.utility.debugError("Error inside gfgCustomDiscount getProductsDataByTagName fn",t)}},getProductsDataByProductType:async function(t){try{const e=`query GetProductsByTypes($product_type: String!) {\n products(first: 50, query: $product_type) {\n edges {\n node {\n id\n availableForSale\n title\n handle\n productType\n collections(first: ${gfg.settings.app.collectionsFetchLimit||250}) {\n edges {\n node {\n id\n }\n }\n }\n featuredImage {\n originalSrc\n }\n tags\n vendor\n compareAtPriceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n variants(first: 100) {\n edges {\n node {\n id\n title\n price {\n amount\n currencyCode\n }\n currentlyNotInStock\n compareAtPrice {\n amount\n currencyCode\n }\n image {\n originalSrc\n }\n selectedOptions {\n name\n value\n }\n availableForSale\n }\n }\n }\n }\n }\n }\n }`,r={product_type:t,countryCode:window?.Shopify?.country||"IN",languageCode:window?.Shopify?.locale?.toUpperCase()||"EN"},n=await gfg.customDiscountStorefrontApis.makeGraphQLApiCall(e,r);return n?.data}catch(t){gfg.utility.debugError("Error inside gfgCustomDiscount getProductsDataByProductType fn",t)}},getProductsDataByIdWithAjaxResponse:async function(t){try{const e=gfg.settings.app?.metafieldNameSpaceAndKeys||[],r=e.length>0?gfg.utility.generateMetafieldQueries(e):"",n=`query test($ids: [ID!]!, $countryCode: CountryCode!, $languageCode: LanguageCode!) @inContext(country: $countryCode, language: $languageCode) { \n nodes(ids: $ids) {\n ... on Product{\n id\n availableForSale\n title\n handle\n createdAt\n description\n ${r||""}\n descriptionHtml\n productType\n onlineStoreUrl\n options{\n id\n name\n values\n }\n featuredImage{\n id\n originalSrc\n transformedSrc(maxWidth: 200, maxHeight: 200, crop: CENTER)\n }\n updatedAt\n tags\n totalInventory\n vendor\n requiresSellingPlan\n compareAtPriceRange{\n maxVariantPrice{\n amount\n currencyCode\n }\n minVariantPrice{\n amount\n currencyCode\n }\n }\n priceRange{\n maxVariantPrice{\n amount\n currencyCode\n }\n minVariantPrice{\n amount\n currencyCode\n }\n }\n media(first:100){\n edges{\n node{\n id\n alt\n previewImage{\n url\n id\n } \n \n }\n }\n \n }\n images(first:100){\n edges{\n node{\n id\n originalSrc\n transformedSrc(maxWidth: 200, maxHeight: 200, crop: CENTER)\n }\n }\n }\n \n variants(first: 100) {\n edges {\n node {\n id\n sku\n title\n price{\n amount\n currencyCode\n }\n weight\n weightUnit\n requiresShipping\n currentlyNotInStock \n compareAtPrice{\n amount\n currencyCode\n }\n quantityAvailable\n selectedOptions{\n name\n value\n }\n \n availableForSale\n image {\n id\n originalSrc\n transformedSrc(maxWidth: 200, maxHeight: 200, crop: CENTER)\n }\n }\n }\n }\n }\n }\n }`,a={ids:t,countryCode:window?.Shopify?.country||"IN",languageCode:window?.Shopify?.locale?.toUpperCase()?.split("-")[0]||"EN"},i=(await gfg.customDiscountStorefrontApis.makeGraphQLApiCall(n,a)).data.filter(t=>null!=t&&null!=t);return gfg.utility.dataMappingFromGraphql(i)}catch(t){gfg.utility.debugError("Error inside getProductsDataByIdWithAjaxResponse fn",t)}}},gfgCartRefreshHelper:{_widgetRestorationTimeouts:[],THEME_NAMES:{GENERATED_DATA:"Generated Data Theme",TEST_DATA:"test-data",DEBUT:"Debut",DAWN:"Dawn",SENSE:"Sense",CRAFT:"Craft",REFRESH:"Refresh",STUDIO:"Studio",PUBLISHER:"Publisher",COLORBLOCK:"Colorblock",CRAVE:"Crave",ORIGIN:"Origin",SPOTLIGHT:"Spotlight",MINION:"Minion",SHRINE:"Shrine",SHRINE_PRO:"Shrine Pro",SHRINE_LITE:"Shrine Lite",BE_YOURS:"Be Yours",DISTRICT:"District",PRESTIGE:"Prestige",COMBINE:"Combine",ZALIFY:"Zalify",SYMMETRY:"Symmetry",BLOCKSHOP:"Blockshop",IMPACT:"Impact",WAREHOUSE:"Warehouse",FOCAL:"Focal",YUVA:"Yuva",PARALLAX:"Parallax",SHOPIWEB_PREMIUM:"Shopiweb Premium",BROADCAST:"Broadcast",IMPULSE:"Impulse",WOODSTOCK:"Woodstock",PALO_ALTO:"Palo Alto",CONCEPT:"Concept",DEBUTIFY:"Debutify",LOCAL:"Local",PRESTIGE_V10_2_0_O:"prestige-v10-2-0-O",VISION:"Vision",MOTION:"Motion",BIRKENSTOCK:"Birkenstock",KALLES:"Kalles",FLOW:"Flow",XTRA:"Xtra",JORDAN_LIBRARY:"Jordan's Library",SUMAMAO:"Sumamao",STORY_THEME:"Story Thème",MINIMOG_OS_2:"Minimog - OS 2.0",KRUUT_2020:"Kruut 2020",SHRINE_PRO_CAPS:"Shrine PRO",ELLA:"Ella",FASTOR:"Fastor",TURBO:"Turbo",BEAUTY:"Beauty",REFORMATION:"Reformation",GLOZIN:"Glozin",PIPELINE:"Pipeline",TOYO:"Toyo",SHRINE_LITE_CAPS:"Shrine LITE",ATLAS:"Atlas",BLUM:"Blum",ZENDROP:"Zendrop",STORY_THEME_2:"Story Theme",TRADE:"Trade",STILETTO:"Stiletto",ZEST:"Zest",ANHSTEINMMO_THEME:"AnhsteinMMO Theme",ECOMUS:"Ecomus",ANTHONY_WEBDEV:"@anthony.webdev",HORIZON:"Horizon",EURUS:"Eurus",LAUNCH_YOUR_STORE_BLOCKY:"LaunchYour.Store Blocky",NORTH:"North",SAVOR:"Savor",VESSEL:"Vessel",PITCH:"Pitch",DWELL:"Dwell",RITUAL:"Ritual",ATIELLER:"Atelier",TINKER:"Tinker",FABRIC:"Fabric",HERITAGE:"Heritage",HABITAT:"Habitat",DISTINCTIVE:"Distinctive",TASTE:"Taste",HIGHLEVEL_ECOM_BEAUTY:"HighLevel-eCom-Beauty",UMINO:"Umino",GECKO:"Gecko",STARTER:"2.0 Starter theme",ENTERPRISE:"Enterprise",PARADISE:"Paradise",AARAU:"Aarau",WONDER:"Wonder",ACENO_FASHION_HOME01:"aceno-fashion-home01",GALLERIA:"Galleria",SHOWTIME:"ShowTime",VIOLA:"Viola",REVIVE:"Revive",CANOPY:"Canopy",HYPER:"Hyper",APOLLO:"Apollo",BLUBOLT_THEME:"Blubolt Theme",ASCENT:"Ascent",AOLIE:"Aolie",SLEEK:"Sleek",HONGO:"Hongo",STRETCH:"Stretch",GLOOW:"Gloow",A_IMPACT:"A Impact",RISE:"Rise",RIDE:"Ride",SHRINE_PRO_R:"Shrine Pro®",SAVYO_X_VM_0_1:"Savyo x VM 0.1",CADIANT:"Cadiant",ROASELL:"Roasell",TINYBABIES:"Tinybabies",SHAPES:"Shapes",WHISK:"Whisk",MOLDING:"Molding",DROPMETA_SPEED:"DropmetaSPEED",EXPANSE:"Expanse",EMPIRE:"Empire",GRID:"Grid",OUTSIDERS:"Outsiders",VENUE:"Venue"},get IMPACT_THEMES(){return[this.THEME_NAMES.IMPACT]},get DAWN_LIKE_THEMES(){return[this.THEME_NAMES.DAWN,this.THEME_NAMES.FLOW,this.THEME_NAMES.XTRA,this.THEME_NAMES.GENERATED_DATA,this.THEME_NAMES.TEST_DATA]},get SPECIAL_HANDLING_THEMES(){return[this.THEME_NAMES.BE_YOURS,this.THEME_NAMES.DISTRICT,this.THEME_NAMES.COMBINE,this.THEME_NAMES.BLOCKSHOP,this.THEME_NAMES.SYMMETRY,this.THEME_NAMES.WAREHOUSE,this.THEME_NAMES.YUVA,this.THEME_NAMES.PARALLAX,this.THEME_NAMES.MINION,this.THEME_NAMES.SHOPIWEB_PREMIUM,this.THEME_NAMES.BROADCAST,this.THEME_NAMES.WOODSTOCK,this.THEME_NAMES.REFORMATION,this.THEME_NAMES.GLOZIN,this.THEME_NAMES.FOCAL]},get MODERN_THEMES(){return[this.THEME_NAMES.HORIZON,this.THEME_NAMES.SAVOR,this.THEME_NAMES.VESSEL,this.THEME_NAMES.PITCH,this.THEME_NAMES.DWELL,this.THEME_NAMES.RITUAL,this.THEME_NAMES.ATIELLER,this.THEME_NAMES.TINKER,this.THEME_NAMES.FABRIC,this.THEME_NAMES.HERITAGE]},refreshAjaxCart:function(){return!!window.theme?.ajaxCart?.update&&(window.theme.ajaxCart.update(),!0)},refreshCartGlobal:function(){return!!window.refreshCart&&(window.refreshCart(),!0)},CART_ICON:"icon",CART_DRAWER:"cartDrawer",CART_LINE_ITEM:"cartLineItem",CART_SUBTOTAL:"cartSubtotal",CART_MINI:"cartMini",replacePriceInHtml:function(t="",e=""){if(!t||!e)return"";const r=t.match(/\d+[\.,]?\d*/)?.[0];return r?e.replace(/\d+[\.,]?\d*/,r):e},replaceAllElements:function(t,e){(document.querySelectorAll(t)||[]).forEach(t=>{t.replaceWith(e.cloneNode(!0))})},refreshCartContents:function(){return!!window.updateCartContents&&(window.updateCartContents(),!0)},dispatchCartReloadEvent:function(){if("function"!=typeof window.CustomEvent||"function"!=typeof document.dispatchEvent)return!1;const t=new CustomEvent("theme:cart:reload");return document.dispatchEvent(t),!0},forceUpdateCartStatus:function(){return!!window.SHTHelper?.forceUpdateCartStatus&&(window.SHTHelper.forceUpdateCartStatus(),!0)},CART_LINK_SELECTOR:"a[href='/cart']",CART_SECTION_SELECTOR:".cart-section",QUICK_CART_CONTAINER_SELECTOR:".quick-cart__container",get SHOPIFY_ROOT(){return window.Shopify?.routes?.root},SHOPIFY_SECTION_PREFIX:"shopify-section-",getCurrentSectionId:function(){const t=document.querySelector("cart-items-component");return t?.dataset?.sectionId||"header"},reloadAlpineMiniCart:function(){const t=Alpine.store("xMiniCart");if(t)return t.reLoad(),!0},CART_CONTENT_SELECTOR:"#cartContent",HEADER_CART_COUNT_SELECTOR:".header__cart-count",CART_DRAWER_SELECTOR:"#Cart-Drawer",CART_COUNT_BUBBLE_SELECTOR:".cart-count-bubble",parseCartElement:function(t,e){return(new DOMParser).parseFromString(t[e],"text/html").querySelector("cart-drawer"===e?this.CART_DRAWER_SELECTOR:this.CART_COUNT_BUBBLE_SELECTOR)},refreshBluboltCart:function(){return!!window.blubolt?.cart?.getCartState&&(window.blubolt.cart.getCartState(),!0)},refreshShopifyCart:function(){return!!window?.Shopify?.getCart&&(window.Shopify.getCart(),!0)},WHISK_SECTIONS:[{id:"cart-items",section:"cart-items",selector:".js-cart-contents"},{id:"cart-icon-bubble",section:"cart-icon-bubble",selector:".shopify-section"},{id:"cart-live-region-text",section:"cart-live-region-text",selector:".shopify-section"},{id:"cart-footer",section:"cart-footer",selector:".js-cart-footer-contents"},{id:"cart-drawer-icon-bubble",section:"cart-drawer-icon-bubble",selector:".shopify-section"}],isCartPage:function(){return["/cart",this.SHOPIFY_ROOT+"/cart"].includes(window.location.pathname)},DEFAULT_THEME_CONFIG:{allSections:"main-cart-items,cart-live-region-text,cart-drawer,cart-icon-bubble",cartDrawer:"cart-drawer",cartItems:"main-cart-items",cartSubTotal:"cart-live-region-text",cartIcon:"cart-icon-bubble",cartDrawerReplaceElem:".drawer__inner",cartItemsReplaceElem:"#main-cart-items",cartSubtotalReplaceElem:".cart__footer .totals__total-value",cartIconReplaceElem:".cart-count-bubble"},get THEME_CONFIGS(){const t=this.THEME_NAMES,e=this.DEFAULT_THEME_CONFIG;return{[t.DAWN]:e,[t.GENERATED_DATA]:e,[t.TEST_DATA]:e,[t.SENSE]:e,[t.CRAFT]:e,[t.REFRESH]:e,[t.STUDIO]:e,[t.PUBLISHER]:e,[t.COLORBLOCK]:e,[t.CRAVE]:e,[t.ORIGIN]:e,[t.SPOTLIGHT]:e,[t.MINION]:e,[t.SHRINE]:e,[t.SHRINE_PRO]:e,[t.SHRINE_LITE]:e,[t.JORDAN_LIBRARY]:e,[t.BEAUTY]:e,[t.ROASELL]:e,[t.RIDE]:e,[t.TRADE]:e,[t.TASTE]:e,[t.EXPANSE]:e,[t.EMPIRE]:e,[t.GRID]:e,[t.OUTSIDERS]:{allSections:"main-cart,cart-drawer,cart-icon-bubble",cartDrawer:"cart-drawer",cartItems:"main-cart",cartSubTotal:null,cartIcon:"cart-icon-bubble",cartDrawerReplaceElem:".drawer__inner",cartItemsReplaceElem:"form#cart",cartSubtotalReplaceElem:null,cartIconReplaceElem:".cart-count-bubble"},[t.VENUE]:{allSections:"cart-drawer,cart-icon-bubble,header",cartDrawer:"cart-drawer",cartItems:"cart-drawer",cartSubTotal:null,cartIcon:"cart-icon-bubble",cartDrawerReplaceElem:".drawer__inner",cartItemsReplaceElem:".cart-drawer__items",cartSubtotalReplaceElem:null,cartIconReplaceElem:".cart-count-bubble"},[t.BE_YOURS]:{allSections:"mini-cart,cart-icon-bubble,main-cart-items,cart-live-region-text",cartDrawer:"mini-cart",cartItems:"main-cart-items",cartSubTotal:"cart-live-region-text",cartIcon:"cart-icon-bubble",cartDrawerReplaceElem:"form#cart",cartItemsReplaceElem:"#main-cart-items",cartSubtotalReplaceElem:".cart__footer .totals__subtotal-value",cartIconReplaceElem:"#cart-icon-bubble"},[t.DISTRICT]:{allSections:"cart-button,main-cart-items",cartDrawer:null,cartItems:"main-cart-items",cartSubTotal:"cart-button",cartIcon:"cart-button",cartDrawerReplaceElem:null,cartItemsReplaceElem:"form.cart-items__form",cartSubtotalReplaceElem:".subtotal .subtotal__price",cartIconReplaceElem:"#cart-button"},[t.PRESTIGE]:{allSections:"cart-drawer,main-cart,mini-cart",cartDrawer:"cart-drawer",cartItems:"main-cart",cartMini:"mini-cart",cartSubTotal:null,cartIcon:null,cartDrawerReplaceElem:"cart-drawer#cart-drawer",cartMiniReplaceElem:"#sidebar-cart",cartItemsReplaceElem:".shopify-section--main-cart",cartSubtotalReplaceElem:null,cartIconReplaceElem:null},[t.COMBINE]:{allSections:"header,main-cart,helper-cart",cartDrawer:"helper-cart",cartItems:"helper-cart",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:"#AjaxCartForm",cartItemsReplaceElem:"cart-form#AjaxCartForm",cartSubtotalReplaceElem:null,cartIconReplaceElem:".icon-button__label"},[t.PARALLAX]:{allSections:"cart-template,header",cartDrawer:"header",cartItems:"cart-template",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:"#cart ul",cartItemsReplaceElem:".shopify-section--cart-template",cartSubtotalReplaceElem:null,cartIconReplaceElem:"li.cart"},[t.ZALIFY]:{allSections:"main-cart,mini-cart,header",cartDrawer:"mini-cart",cartItems:"main-cart",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:".shopify-section--mini-cart",cartItemsReplaceElem:".shopify-section--main-cart",cartSubtotalReplaceElem:null,cartIconReplaceElem:"cart-count"},[t.SYMMETRY]:{allSections:"cart-drawer,main-cart,header",cartDrawer:"cart-drawer",cartItems:"main-cart",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:"cart-form",cartItemsReplaceElem:".page-section-spacing",cartSubtotalReplaceElem:null,cartIconReplaceElem:".cart-link__count"},[t.BLOCKSHOP]:{allSections:"cart-desktop,cart-drawer,cart,header",cartDrawer:"cart-drawer",cartItems:"cart",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:".cart--root",cartItemsReplaceElem:".section--cart",cartSubtotalReplaceElem:null,cartIconReplaceElem:"a.header--cart"},[t.IMPACT]:{allSections:"main-cart,cart-drawer,header",cartDrawer:"cart-drawer",cartItems:"main-cart",cartSubTotal:"cart-drawer",cartIcon:"header",cartDrawerReplaceElem:"cart-drawer",cartItemsReplaceElem:".shopify-section--main-cart .cart-order__summary",cartSubtotalReplaceElem:".cart-form__totals",cartIconReplaceElem:".header__cart-count"},[t.WAREHOUSE]:{allSections:"header,mini-cart,main-cart",cartDrawer:"header",cartItems:"main-cart",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:".mini-cart",cartItemsReplaceElem:'section[data-section-type="cart"]',cartSubtotalReplaceElem:null,cartIconReplaceElem:".header__cart-count"},[t.FOCAL]:{allSections:"main-cart,mini-cart,header",cartDrawer:"mini-cart",cartItems:"main-cart",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:".shopify-section--mini-cart",cartItemsReplaceElem:"section .container--medium",cartSubtotalReplaceElem:null,cartIconReplaceElem:".header__linklist .header__cart-count"},[t.YUVA]:{allSections:"main-cart,header",cartDrawer:"main-cart",cartItems:"main-cart",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:"body",cartItemsReplaceElem:".cart-section",cartSubtotalReplaceElem:null,cartIconReplaceElem:".cartCount"},[t.SHOPIWEB_PREMIUM]:{allSections:"template-cart",cartDrawer:"template-cart",cartItems:"template-cart",cartSubTotal:null,cartIcon:null,cartDrawerReplaceElem:"ul.product-listing",cartItemsReplaceElem:"#cart",cartSubtotalReplaceElem:null,cartIconReplaceElem:null},[t.BROADCAST]:{allSections:"cart-drawer,cart,header",cartDrawer:"cart-drawer",cartItems:"cart",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:"#cart-drawer cart-items",cartItemsReplaceElem:"#cartForm",cartSubtotalReplaceElem:null,cartIconReplaceElem:".header__cart__status__holder cart-count"},[t.IMPULSE]:{allSections:"main-cart,header",cartDrawer:"main-cart",cartItems:"main-cart",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:"div[data-products]",cartItemsReplaceElem:"#CartPageForm",cartSubtotalReplaceElem:null,cartIconReplaceElem:".cart-link"},[t.WOODSTOCK]:{allSections:"cart-drawer,cart-icon-bubble"},[t.PALO_ALTO]:{allSections:"cart-drawer,header"},[t.PRESTIGE_V10_2_0_O]:{allSections:"cart-drawer,main-cart",cartDrawer:null,cartItems:"main-cart",cartSubTotal:null,cartIcon:null,cartDrawerReplaceElem:"cart-drawer#cart-drawer",cartItemsReplaceElem:".shopify-section--main-cart",cartSubtotalReplaceElem:null,cartIconReplaceElem:null},[t.BIRKENSTOCK]:{allSections:"main-cart-items,cart-notification-product,cart-icon-bubble,header",cartDrawer:"header",cartItems:"main-cart-items",cartSubTotal:null,cartIcon:"cart-icon-bubble",cartDrawerReplaceElem:"#cart-notification .mini-cart-content",cartItemsReplaceElem:"#main-cart-items",cartSubtotalReplaceElem:null,cartIconReplaceElem:".cart-count-bubble"},[t.FLOW]:{allSections:"cart-drawer,template--cart,header",cartDrawer:"cart-drawer",cartItems:"template--cart",cartSubTotal:null,cartIcon:"header",cartDrawerReplaceElem:"cart-drawer .global-drawer__content",cartItemsReplaceElem:".wrapper-spacing--v--template .width--content",cartSubtotalReplaceElem:null,cartIconReplaceElem:".cart-item-count-bubble.cart-item-count-header.cart-item-count-header--quantity"},[t.XTRA]:{allSections:"side-cart,main-cart",cartIcon:null,cartDrawer:"side-cart",cartItems:"main-cart",cartSubTotal:null,cartIconReplaceElem:null,cartDrawerReplaceElem:"#cart",cartSubtotalReplaceElem:null,cartItemsReplaceElem:"#content"},[t.SUMAMAO]:{allSections:"main-cart,cart-drawer,header-inline",cartIcon:"header-inline",cartDrawer:"cart-drawer",cartItems:"main-cart",cartSubTotal:null,cartIconReplaceElem:"hdt-cart-count",cartDrawerReplaceElem:"hdt-cart-drawer",cartItemsReplaceElem:"#hdt-page-cart",cartSubtotalReplaceElem:null},[t.SHRINE_PRO_CAPS]:{allSections:"main-cart-items,cart-live-region-text,cart-drawer,cart-icon-bubble",cartDrawer:"cart-drawer",cartItems:"main-cart-items",cartSubTotal:"cart-live-region-text",cartIcon:"cart-icon-bubble",cartDrawerReplaceElem:".drawer__inner",cartItemsReplaceElem:"#main-cart-items",cartSubtotalReplaceElem:".cart__footer .totals__total-value",cartIconReplaceElem:".cart-count-bubble"},[t.TURBO]:{allSections:"header,cart-template",cartIcon:"header",cartIconReplaceElem:".cart-container .cart_count",cartItems:"cart-template",cartItemsReplaceElem:"section .container.content"},[t.REFORMATION]:{allSections:"cart-drawer,cart-bubble",cartDrawer:"cart-drawer",cartIcon:"cart-bubble",cartDrawerReplaceElem:"#Cart-Drawer",cartIconReplaceElem:"#cart-drawer-toggle"},[t.GLOZIN]:{allSections:"minicart-form,header",cartIcon:"header",cartDrawer:"minicart-form",cartIconReplaceElem:"#header__minicart .cart-count",cartDrawerReplaceElem:".minicart__wrapper"},[t.TOYO]:{allSections:"cart-drawer,cart-icon-bubble,cart-icon-bubble-sticky"},[t.SHRINE_LITE_CAPS]:{allSections:"cart-drawer,cart-icon-bubble"},[t.SHRINE_PRO_R]:{allSections:"main-cart-items,cart-live-region-text,cart-drawer,cart-icon-bubble"},[t.MINIMOG_OS_2]:{allSections:"cart-drawer"},[t.ATLAS]:{allSections:"cart-drawer,cart-icon-bubble"},[t.ZENDROP]:{allSections:"cart-drawer,cart-icon-bubble"},[t.STORY_THEME_2]:{allSections:"cart-drawer,cart-icon-bubble"},[t.STILETTO]:{allSections:"header,main-cart,quick-cart",cartDrawer:"quick-cart",cartItems:"main-cart",cartIcon:"header",cartDrawerReplaceElem:".quick-cart__container",cartItemsReplaceElem:".cart-section",cartIconReplaceElem:"a[href='/cart']"},[t.ZEST]:{allSections:"cart-drawer,header"},[t.ANHSTEINMMO_THEME]:{allSections:"cart-drawer,cart-icon-bubble"},[t.ANTHONY_WEBDEV]:{allSections:"cart-icon-bubble,mobile-cart-icon-bubble,mini-cart"},[t.LAUNCH_YOUR_STORE_BLOCKY]:{allSections:"cart-drawer,cart-icon-bubble"},[t.NORTH]:{allSections:"cart-bubble,cart-side,main-cart",cartDrawer:"cart-side",cartDrawerReplaceElem:"#side-cart .side-panel-content",cartItems:"main-cart",cartItemsReplaceElem:".thb-cart-form-container",cartIcon:"cart-bubble",cartIconReplaceElem:".float_count"},[t.HABITAT]:{allSections:"main-cart,cart-drawer,cart-bubble"},[t.DISTINCTIVE]:{allSections:"main-cart,cart-drawer,cart-bubble"},[t.HIGHLEVEL_ECOM_BEAUTY]:{allSections:"cart-drawer,cart-icon-bubble"},[t.UMINO]:{allSections:"form-mini-cart"},[t.STARTER]:{allSections:"cart-content,header-link-cart"},[t.PARADISE]:{allSections:"cart-drawer,cart-icon-bubble"},[t.WONDER]:{allSections:"cart-drawer,cart-icon-bubble"},[t.SHOWTIME]:{allSections:"g_cart-drawer"},[t.VIOLA]:{allSections:"cart-drawer,cart-icon-bubble"},[t.REVIVE]:{allSections:"cart-drawer,cart-icon-bubble"},[t.APOLLO]:{allSections:"cart-drawer,cart-icon-bubble,main-cart-items,cart-icon-bubble-pc"},[t.ASCENT]:{allSections:"cart-drawer,cart-icon-bubble"},[t.GLOOW]:{allSections:"cart-drawer,cart-icon-bubble"},[t.RISE]:{allSections:"cart-notification-product,cart-notification-button,cart-icon-bubble"},[t.SAVYO_X_VM_0_1]:{allSections:"minicart-form"},[t.CADIANT]:{allSections:"cart-template"},[t.WHISK]:{allSections:"cart-items,cart-icon-bubble,cart-live-region-text,cart-footer,cart-drawer-icon-bubble"}}},handleThemeSpecificUpdate:function(t){const{themeName:e}=t,r=this.THEME_NAMES,n=this.CART_DRAWER,a=this.CART_ICON,i=this.CART_LINE_ITEM,o=this.CART_SUBTOTAL,c=this.CART_MINI,s=this.replaceAllElements.bind(this),u=this.replacePriceInHtml.bind(this);switch(e){case r.COMBINE:return(({type:t,newHtmlDOM:e})=>{if(t===n){const t=e.querySelector("#AjaxCartSubtotal"),r=document.querySelector("#AjaxCartSubtotal");r&&t&&(r.innerHTML=t.innerHTML);const n=e.querySelector("#AjaxCartForm .cart__count"),a=document.querySelector("#site-cart-sidebar [data-header-cart-count]");a&&n&&(a.innerHTML=n.innerHTML)}return!1})(t);case r.SYMMETRY:return(({type:t,newNode:e})=>(t===n&&e.querySelectorAll(".cart-item__column.cart-item__image a").forEach(t=>{const e=t.querySelector("img"),r=t.querySelector("noscript");if(r){const t=r.innerHTML.trim(),n=document.createElement("div");n.innerHTML=t;const a=n.querySelector("img");if(a){const t=a.getAttribute("src");e.setAttribute("src",t)}}}),!1))(t);case r.BLOCKSHOP:return(({type:t,newNode:e})=>{if(t===a){const t=e.getAttribute("data-cart-count");return document.querySelector("a.header--cart").setAttribute("data-cart-count",t),!0}return t===i&&e.querySelectorAll(".cart--item").forEach(t=>{t.style.opacity="1",t.style.visibility="visible"}),t===n&&e.querySelectorAll(".cart--item").length&&document.querySelector(".layout--viewport")?.setAttribute("data-cart-empty",!1),!1})(t);case r.IMPACT:return(({type:t,newNode:e,currentNode:r})=>t===o&&(e=e.querySelectorAll(".h5")?.[1]||e,r.querySelectorAll(".h-stack.gap-4.justify-between").forEach((t,r)=>{let n;n=0===r?t.querySelectorAll(".text-subdued")[1]:t.querySelectorAll(".h5")[1],n.innerHTML=u(e.innerHTML||"",n.innerHTML)}),!0))(t);case r.DISTRICT:return(({type:t,newNode:e,currentNode:r})=>{if(t===a){const t=e.innerHTML;return r.innerHTML=t,!0}return!1})(t);case r.YUVA:return(({type:t,currentNode:e})=>t===n&&(e.classList.contains("side_Drawer_open")&&e.classList.remove("side_Drawer_open"),!0))(t);case r.PARALLAX:return(({type:t,newNode:e})=>(t===n&&(e.classList.add("mm-listview"),e.querySelectorAll("li").forEach(t=>{t.classList.add("mm-listitem");const e=t.querySelector("a");e&&e.classList.add("mm-listitem__text")})),!1))(t);case r.MINION:return(({type:t,targetCurrentElem:e,newNode:r})=>t===a&&(s(e,r),!0))(t);case r.BROADCAST:return(({type:t,targetCurrentElem:e,currentNode:r,newNode:i})=>{if(t===a)return s(e,i),!0;if(t===n){const t=i.querySelector("cart-count");if(t&&(document.querySelectorAll("cart-count")||[]).forEach(e=>{e.replaceWith(t.cloneNode(!0))}),i.classList.contains("is-empty")){const t=document.querySelector("cart-drawer");return void(t&&t.classList.add("is-empty"))}{const t=document.querySelector("cart-drawer");t&&t.classList.contains("is-empty")&&t.classList.remove("is-empty")}const e=i.querySelector(".cart__total__price");if(e){const t=document.querySelector(".cart__total__price");t&&t.replaceWith(e)}const n=i.querySelector("cart-items");n.querySelectorAll(".cart__item").forEach(t=>{t.classList.add("is-animated")}),r.replaceWith(n);const a=document.querySelector(".free-shipping__progress-bar");if(a){const t=a.getAttribute("max")||"100";a.setAttribute("value",t)}return!0}return!1})(t);case r.IMPULSE:return(({type:t,newNode:e,currentNode:r})=>{if(t===a)return!1;let n="CartPageForm";if(e.querySelectorAll(".cart__image image-element").forEach(t=>{t.classList.add("aos","init","aos-animate")}),"cartDrawer"===t){n="CartDrawerForm";const t=e.querySelector("div[data-subtotal]")||document.createElement("div");document.querySelector("div[data-subtotal]").replaceWith(t),(e=e.querySelector("div[data-products]"))||(e=document.createElement("div")),e.classList.remove("cart__page-col");const r=e.querySelectorAll(".cart__item");if(console.log("Number of cart__item elements:",r.length),r){const t=document.querySelector("#CartDrawer");t&&t.classList.contains("is-empty")&&t.classList.remove("is-empty")}}r.replaceWith(e);const i=document.getElementById(n);return i&&new theme.CartForm(i),!0})(t);case r.DAWN:case r.GENERATED_DATA:case r.TEST_DATA:return(({type:t,newNode:e,newHtmlDOM:r})=>{if(t===n){const t=e.querySelector("cart-drawer-items");if(t&&t.classList.contains("is-empty"))return!1;const r=e.querySelector(".cart-recommendations-wrapper");r&&(r.style.display="block")}if(t===a){if(r.querySelector(".cart-count-bubble"))return!1;const t=r.querySelector(".icon.icon-cart");t&&s(".header__icon.header__icon--cart .icon.icon-cart",t)}return!1})(t);case r.BIRKENSTOCK:return(({type:t,targetCurrentElem:e,newNode:r})=>t===a&&(s(e,r),!0))(t);case r.PRESTIGE:return(({type:t,newNode:e,currentNode:r})=>{if(t===c&&e)return r.innerHTML=e.innerHTML,!0;if(t===n&&e){r.innerHTML=e.innerHTML;const t=document.querySelector("cart-dot");return t&&t.classList.add("is-visible"),!0}return!1})(t);case r.XTRA:return(({type:t,dataToParse:e})=>{if(!window.ajaxCart)return window.location.reload();if(t===n&&window.ajaxCart.load({sections:{"side-cart":e}}),t===i){if(!window.cartPageContainer)return window.location.reload();window.cartPageContainer.innerHTML=newNode.innerHTML,window.ajaxCart.init()}return!0})(t);case r.BE_YOURS:return(({type:t,newNode:e,currentNode:r})=>t===a&&(r.innerHTML=e.innerHTML,!0))(t);case r.SUMAMAO:return(({type:t,newNode:e,currentNode:r})=>{const a=document.querySelector("hdt-loading-bar");return a&&(a.style.transform=""),t===n&&(r.innerHTML=e.innerHTML),!1})(t);case r.TURBO:return(({type:t,targetCurrentElem:e,newNode:r})=>t===a&&(s(e,r),!0))(t);case r.REFORMATION:return(({type:t,newNode:e,currentNode:r})=>{if(t===n&&e)return r.innerHTML=e.innerHTML,!0;if(t===a&&e){const t=e.querySelector(".thb-item-count"),n=r.querySelector(".thb-item-count");if(t&&n)return n.innerText=t.innerText,!0}return!1})(t);case r.GLOZIN:return(({type:t,newNode:e,currentNode:r})=>{if(t===n&&e&&r)try{const t=r.querySelector("free-ship-progress-bar"),n=r.querySelector("#minicart-form"),a=e.querySelector("free-ship-progress-bar"),i=e.querySelector("#minicart-form");let o=!1;if(t&&a&&(t.replaceWith(a),o=!0),n&&i){n.replaceWith(i);const t=r.querySelectorAll("#minicart .items .cart-item")?.length,e=r.querySelector(".minicart__wrapper .minicart__header .minicart-heading .cart-count");e&&(e.innerText=`(${t})`),o=!0}return o}catch(t){return!1}if(t===a&&e){const t=r.querySelector(".cart-count"),n=e.querySelector(".cart-count");if(n&&t)return t.innerText=n.innerText,!0}return!1})(t);case r.WAREHOUSE:return(({type:t,newNode:e,currentNode:r})=>!!(e&&r&&[n,a].includes(t))&&(r.innerHTML=e.innerHTML,!0))(t);case r.FOCAL:return(({type:t,newNode:e,currentNode:r})=>{if(!e||!r)return!1;if(t===n){const t=r.querySelector("cart-drawer"),n=t?.hasAttribute("open");if(r.innerHTML=e.innerHTML,n){const t=r.querySelector("cart-drawer");t&&t.setAttribute("open","")}return!0}return t===a&&(r.innerHTML=e.innerHTML,!0)})(t);case r.ROASELL:return(()=>{const t=document.querySelector("cart-drawer");t&&t.open()})();default:return!1}},replaceCartHtmlNode:function({type:t,dataToParse:e,targetCurrentElem:r,themeName:n=""}){try{const a=this.THEME_NAMES,i=this.CART_SUBTOTAL,o=this.CART_ICON,c=this.CART_DRAWER,s=this.CART_LINE_ITEM,u=this.SPECIAL_HANDLING_THEMES,g=this.IMPACT_THEMES,l=this.replacePriceInHtml.bind(this),d=this.handleThemeSpecificUpdate.bind(this),f=(new DOMParser).parseFromString(e,"text/html");let p,m;const C=({themeName:t,type:e,targetCurrentElem:r})=>{if(t===a.IMPACT&&e===i)return".h-stack.gap-4.justify-between";if(t===a.DISTRICT){if(e===o)return"#shopify-section-cart-button";if(e===i)return".cart-button__total.money"}return t===a.IMPULSE&&e===c?"#CartPageForm":t===a.BROADCAST&&e===c?"#cart-drawer":t===a.BE_YOURS&&e===o?"#shopify-section-cart-icon-bubble":t===a.XTRA&&e===s?"#shopify-section-main-cart":e===i?"#shopify-section-cart-live-region-text":t===a.GLOZIN&&e===c?"#shopify-section-minicart-form":r},S=C({themeName:n,type:t,targetCurrentElem:r}),h=t===i,E=t===o;if(m=f.querySelector(S),m){const r=document.querySelector(".drawer");if(r&&t===c){const t=r.classList.contains("is-empty"),n=e.includes("Continue shopping")||!!m.querySelector(".cart__empty-text");t&&!n?r.classList.remove("is-empty"):!t&&n&&r.classList.add("is-empty")}}if(m)if(E&&!u.includes(n)){const t=document.querySelectorAll(r);if(p=Array.from(t).find(t=>t.parentElement?.matches('a[href*="/cart"]')),!p){const t=document.querySelector("#cart-icon-bubble"),e=f.querySelector("#shopify-section-cart-icon-bubble");t&&e&&(t.innerHTML=e.innerHTML)}}else p=document.querySelector(r);if(!p)return;if(m||(m=document.createElement("div")),h&&!g.includes(n))return void(m.innerHTML&&""!==m.innerHTML.trim()&&(p.innerHTML=l(m.innerHTML,p.innerHTML)));if(d({themeName:n,type:t,newNode:m,newHtmlDOM:f,currentNode:p,targetCurrentElem:r,dataToParse:e}))return;p.replaceWith(m)}catch(t){return void console.error("Error in replaceCartHtmlNode",t)}},AMP_CART:"amp",REBUY_CART:"rebuy",UPCART_CART:"upcart",VANGA_CART:"vanga",OPUS_CART:"opus",XB_CART:"xb",AOV_AI_CART:"aov_ai",QIKIFY_STICKY_CART:"qikify_sticky",SALE_MAX_CART_UPSELL:"sale_max_cart_upsell",SLIDE_CARTY:"slide_carty",I_CART:"i_cart",get CART_APP_REFRESH_FUNCTIONS(){const t=this.REBUY_CART,e=this.AMP_CART,r=this.UPCART_CART,n=this.VANGA_CART,a=this.OPUS_CART,i=this.XB_CART,o=this.AOV_AI_CART,c=this.QIKIFY_STICKY_CART,s=this.SALE_MAX_CART_UPSELL,u=this.SLIDE_CARTY,g=this.I_CART;return{[t]:()=>{const t=window?.Rebuy?.SmartCart;return t?.show&&t.show(),"function"==typeof t?.initializeSmartCartExperiments&&t.initializeSmartCartExperiments(),!0},[e]:async()=>("function"==typeof window?.SLIDECART_UPDATE&&await window.SLIDECART_UPDATE(),"function"==typeof window?.SLIDECART_OPEN&&await window.SLIDECART_OPEN(),!0),[r]:async()=>"function"==typeof window?.upcartRefreshCart&&(await window.upcartRefreshCart(),!0),[n]:async()=>"function"==typeof window?.Vanga?.refresh&&(await window.Vanga.refresh(),!0),[a]:async()=>("function"==typeof window?.opusRefreshCart&&await window.opusRefreshCart(),"function"==typeof window?.opusOpen&&window.opusOpen(),!0),[i]:()=>!(!window?.XBOOST_CART&&"function"!=typeof window?.xbcFetch)&&(document.dispatchEvent(new CustomEvent("xboost-need-refresh-and-open-cart",{bubbles:!0})),!0),[o]:()=>"function"==typeof window?.aovCartDrawerUpdateAndOpen&&(window.aovCartDrawerUpdateAndOpen(),!0),[c]:async()=>("function"==typeof window?.STICKY_CART_UPDATE&&await window.STICKY_CART_UPDATE(),"function"==typeof window?.STICKY_CART_OPEN&&window.STICKY_CART_OPEN(),!0),[s]:async()=>("function"==typeof window?.smeCartCall&&await window.smeCartCall(),"function"==typeof window?.openSmeCart&&window.openSmeCart(),!0),[u]:async()=>!!window.EasySlideCart.enabled&&(window.dispatchEvent(new CustomEvent("SLIDECARTY:refresh")),window.dispatchEvent(new CustomEvent("SLIDECARTY:open")),!0),[g]:async()=>("function"==typeof window?.prepareDataForDisplayWidgetByRule&&await window.prepareDataForDisplayWidgetByRule(),!0)}},refreshCartForTheme:function(t,e){const r=this,n=this.isCartPage(),a=t=>t?t():window.location.reload();if(this.MODERN_THEMES.includes(t))return a(()=>(t=>{const e=r.getCurrentSectionId();if(!e)return!1;const a=new DOMParser,i=t[e],o=a.parseFromString(i,"text/html");if("header"===e){const t=o.querySelector("cart-icon"),e=document.querySelector("cart-icon");return!(!t||!e||(e.innerHTML=t.innerHTML,0))}const c=o.querySelector(`#${r.SHOPIFY_SECTION_PREFIX}${e}`);if(!c)return!1;const s=document.querySelector(`#${r.SHOPIFY_SECTION_PREFIX}${e} cart-items-component`),u=c.querySelector("cart-items-component");if(!u||!s)return!1;if(n){const t=s.querySelector(".cart-items__wrapper"),e=u.querySelector(".cart-items__wrapper");t&&e&&(t.innerHTML=e.innerHTML);const r=document.querySelector(".cart__summary"),n=c.querySelector(".cart__summary");r&&n&&(r.innerHTML=n.innerHTML)}else{const t=s.querySelector("scroll-hint.cart-drawer__items"),e=u.querySelector("scroll-hint.cart-drawer__items");t&&e&&(t.innerHTML=e.innerHTML);const r=s.querySelector(".cart-drawer__summary"),n=u.querySelector(".cart-drawer__summary");r&&n&&(r.innerHTML=n.innerHTML);let a=document.querySelector("cart-drawer-component");a&&a.open()}const g="[ref='cartBubble']",l=u.querySelector(g);l&&r.replaceAllElements(g,l);const d=o.querySelector("cart-icon");if(d&&!d.classList.contains("header-actions__cart-icon--has-cart")){const t=document.querySelector("cart-icon");t&&t.classList.remove("header-actions__cart-icon--has-cart")}return!0})(e));const i=this.THEME_NAMES;switch(t){case i.DEBUT:case i.DEBUTIFY:return a(()=>this.refreshAjaxCart());case i.LOCAL:return a(()=>this.refreshCartGlobal());case i.VISION:return a(()=>{n&&"undefined"!=typeof Cart&&(new Cart).refresh();const t=document.querySelector("#Cart-Drawer");return!!t?.refresh&&(t.refresh(),!0)});case i.MOTION:return a(()=>{const t=n?"CartPageForm":"CartDrawer";if(!n&&theme?.CartDrawer&&new theme.CartDrawer,window.cartFormMotion?.typeCart===t)return window.cartFormMotion.cartForm.buildCart(),!0;const e=document.getElementById(t);if(e){const r=new theme.CartForm(e);if(r?.buildCart)return r.buildCart(),window.cartFormMotion={cartForm:r,typeCart:t},!0}return!1});case i.KALLES:return a(()=>window.T4SThemeSP?.Cart?.getToFetch?(window.T4SThemeSP.Cart.getToFetch(),!0):(document.dispatchEvent(new CustomEvent("cart:reload")),!0));case i.SHOPIWEB_PREMIUM:return a(()=>r.refreshCartContents());case i.STORY_THEME:return a(()=>!(n||!window?.ajaxCart?.load)&&(window.ajaxCart.load(),!0));case i.MINIMOG_OS_2:return a(()=>((t,e)=>{if(window.Shopify?.onCartUpdate)return window.Shopify.onCartUpdate(),!0;const r=document.querySelector("m-cart-drawer");if(!r)return!1;if(e&&r.renderContents)return r.renderContents({sections:e}),r.onCartDrawerUpdate(!0),!0;if(r.onCartRefresh)return r.onCartRefresh({detail:{open:!0}}),!0;const n=document.querySelector("m-cart-items");return!(!n||!n.onCartRefresh||(n.onCartRefresh({detail:{open:!1}}),0))})(0,e));case i.KRUUT_2020:return a(()=>!(n||!window.ajaxCart?.load||(window.ajaxCart.load(),0)));case i.ELLA:return a(()=>!(n||!window.Shopify?.getCart||!window.sharedFunctions.updateSidebarCart||(window.Shopify.getCart(t=>{window.sharedFunctions.updateSidebarCart(t)}),0)));case i.FASTOR:return a(()=>!(n&&!window.Fastor.updateCart||(window.Fastor.updateCart(),0)));case i.PIPELINE:return a(()=>r.dispatchCartReloadEvent());case i.TOYO:return a(()=>((t,e)=>{const r=document.querySelector("cart-drawer");return!(!r||t||(r.renderContents({sections:e}),0))})(n,e));case i.SHRINE_PRO_R:case i.SHRINE_LITE_CAPS:return a(()=>((t,e)=>{const r=document.querySelector("cart-drawer");return!(!r||t||(r?.renderContents({sections:e}),0))})(n,e));case i.ATLAS:return a(()=>((t,e)=>{if(e){const r=document.querySelector("cart-drawer");return!(!r||t||(r?.renderContents({sections:e}),r?.classList?.remove("is-empty"),0))}return!1})(n,e));case i.BLUM:return a(()=>r.forceUpdateCartStatus());case i.ZENDROP:return a(()=>((t,e)=>{if(e){const r=document.querySelector("cart-drawer");if(!r||t)return!1;r?.renderContents({sections:e});const n=document.querySelector("#cart-icon-bubble"),a=(new DOMParser).parseFromString(e["cart-icon-bubble"],"text/html");return n.innerHTML=a.querySelector(".shopify-section").innerHTML,!0}return!1})(n,e));case i.STORY_THEME_2:return a(()=>((t,e)=>{if(e){const r=document.querySelector("cart-drawer"),n=document.querySelector("#cart-icon-bubble");if(!r||t)return!1;const a=new DOMParser,i=a.parseFromString(e["cart-drawer"],"text/html"),o=a.parseFromString(e["cart-icon-bubble"],"text/html");return r.innerHTML=i.querySelector("cart-drawer").innerHTML,n.innerHTML=o.querySelector("#shopify-section-cart-icon-bubble").innerHTML,r.classList.remove("is-empty"),!0}return!1})(n,e));case i.TRADE:return a(()=>((t,e)=>{if(e){const r=document.querySelector("cart-drawer");if(!r||t)return!1;r?.renderContents({sections:e});const n=document.querySelector("#cart-icon-bubble"),a=(new DOMParser).parseFromString(e["cart-icon-bubble"],"text/html");return n.innerHTML=a.querySelector(".shopify-section").innerHTML,!0}return!1})(n,e));case i.STILETTO:return a(()=>(t=>{if(t){const e=document.querySelector(r.CART_LINK_SELECTOR),n=new DOMParser,a=n.parseFromString(t.header,"text/html"),i=n.parseFromString(t["main-cart"],"text/html"),o=document.querySelector(r.CART_SECTION_SELECTOR);o&&(o.innerHTML=i.querySelector(r.CART_SECTION_SELECTOR).innerHTML),e.innerHTML=a.querySelector(r.CART_LINK_SELECTOR).innerHTML;const c=n.parseFromString(t["quick-cart"],"text/html"),s=document.querySelector(r.QUICK_CART_CONTAINER_SELECTOR);return s&&(s.innerHTML=c.querySelector(r.QUICK_CART_CONTAINER_SELECTOR).innerHTML),!0}return!1})(e));case i.ZEST:return a(()=>((t,e)=>{if(e){const r=document.querySelector("cart-drawer");if(!r||t)return!1;r?.renderContents({sections:e});const n=document.querySelector(".cart-link--icon"),a=new DOMParser,i=a.parseFromString(e.header,"text/html"),o=a.parseFromString(e["cart-drawer"],"text/html");return n.innerHTML=i.querySelector(".cart-link--icon").innerHTML,document.querySelector(".f-drawer__header").innerHTML=o.querySelector(".f-drawer__header").innerHTML,!0}return!1})(n,e));case i.CONCEPT:return a(()=>(t=>{const e=document.querySelector("cart-items"),r=document.querySelector("cart-count");return!(!e?.onCartUpdate||!r?.onCartUpdate||(window.fetch("/cart.js").then(t=>t.json()).then(n=>{const a={cart:{...n,sections:t}};e.onCartUpdate(a),r.onCartUpdate(a)}),0))})(e));case i.WOODSTOCK:return a(()=>((t,e)=>{if(!t){const t=document.querySelector("cart-drawer");return!!t?.renderContents&&(t.renderContents({sections:e}),!0)}return!1})(n,e));case i.ANHSTEINMMO_THEME:return a(()=>((t,e)=>{if(!t){const t=document.querySelector("cart-drawer");return!!t?.renderContents&&(t.renderContents({sections:e}),!0)}return!1})(n,e));case i.ECOMUS:return a(()=>((t,e)=>{if(!document.dispatchEvent(new CustomEvent("cart:refresh")))return!1;if(document.querySelector("hdt-cart-drawer"))return document.dispatchEvent(new CustomEvent("cart:refresh"));if(!t)return!1;const n=document.querySelector("#MainContent .hdt-section-main-cart");if(!n?.id)return!1;const a=n.id.replace(r.SHOPIFY_SECTION_PREFIX,"");try{const t=(new DOMParser).parseFromString(e[a],"text/html").querySelector(`#${r.SHOPIFY_SECTION_PREFIX}${a}`);return!!t&&(n.innerHTML=t.innerHTML,!0)}catch(t){return console.error("Error updating cart content:",t),!1}})(n,e));case i.ANTHONY_WEBDEV:return a(()=>((t,e)=>{if(!t){const t=document.querySelector("mini-cart");return!!t?.renderContents&&(t.renderContents({sections:e}),!0)}return!1})(n,e));case i.EURUS:return a(()=>r.reloadAlpineMiniCart());case i.LAUNCH_YOUR_STORE_BLOCKY:return a(()=>((t,e)=>{if(t)return!1;const r=document.querySelector("cart-drawer");return!!r?.renderContents&&(r.renderContents({sections:e}),!0)})(n,e));case i.HABITAT:case i.DISTINCTIVE:return a(()=>(t=>{const e=document.querySelector("product-card");return!(!e||!e.renderContents||(e.renderContents({sections:t}),0))})(e));case i.TASTE:return a(()=>((t,e)=>{if(t)return!1;const r=document.querySelector("cart-drawer");return!!r?.renderContents&&(r.renderContents({sections:e}),!0)})(n,e));case i.HIGHLEVEL_ECOM_BEAUTY:return a(()=>((t,e)=>{if(t)return!1;const r=document.querySelector("cart-drawer");return!!r?.renderContents&&(r.renderContents({sections:e}),!0)})(n,e));case i.UMINO:return a(()=>((t,e)=>{if(e){const r=document.querySelector("#form-mini-cart");if(!r||t)return!1;const n=e["form-mini-cart"];if(n){const t=(new DOMParser).parseFromString(n,"text/html").getElementById("form-mini-cart");t&&(t.querySelectorAll(".bls-minicart-product__image .bls__responsive-image").forEach(t=>t.classList.remove("bls-loading-image")),r.innerHTML=t.innerHTML)}return fetch("/cart.json").then(t=>t.json()).then(t=>{document.querySelectorAll(".cart-count").forEach(e=>{e.innerHTML=t.item_count});const e=document.querySelector("header-total-price");e&&e.updateTotal(t)}).catch(t=>{throw t}),!0}return!1})(n,e));case i.GECKO:return a(()=>!!window.T4SThemeSP?.Cart?.getToFetch&&(window.T4SThemeSP.Cart.getToFetch(),!0));case i.STARTER:return a(()=>(t=>{const e=new DOMParser,n=e.parseFromString(t["cart-content"],"text/html"),a=e.parseFromString(t["header-link-cart"],"text/html"),i=document.querySelector(r.CART_CONTENT_SELECTOR);i&&(i.innerHTML=n.querySelector(r.CART_CONTENT_SELECTOR).innerHTML);const o=document.querySelector(r.HEADER_CART_COUNT_SELECTOR);return o&&(o.innerHTML=a.querySelector(r.HEADER_CART_COUNT_SELECTOR).innerHTML),!0})(e));case i.ENTERPRISE:return a(()=>(t=>{const e=document.querySelector("cart-drawer");if(!t&&e?.refresh)return e.refresh(!0).then(()=>!0).catch(()=>!1);if(t){const t=document.querySelector("cart-items");return!(!t||!t.refresh)&&t.refresh().then(()=>!0).catch(()=>!1)}return!1})(n));case i.PARADISE:return a(()=>((t,e)=>{if(t)return!1;const r=document.querySelector("cart-drawer");return!!r?.renderContents&&(r?.classList?.remove("is-empty"),r.renderContents({sections:e}),!0)})(n,e));case i.AARAU:return a(()=>!!window?.theme?.miniCart&&(window?.theme?.miniCart?.updateElements(),window?.theme?.miniCart?.generateCart(),!0));case i.WONDER:return a(()=>((t,e)=>{if(t)return!1;const r=document.querySelector("cart-drawer");return!!r?.renderContents&&(r.renderContents({sections:e},!1),!0)})(n,e));case i.ACENO_FASHION_HOME01:return a(()=>!n&&!!window?.ajaxCart?.load&&(window.ajaxCart.load(),!0));case i.GALLERIA:return a(()=>!n&&(document.querySelector('a[href="/cart"]').click(),document.querySelector("main-cart")?.update(),document.querySelectorAll("cart-counter")?.forEach(t=>t?._fetchCart()),!0));case i.SHOWTIME:return a(()=>((t,e)=>{if(t)return!1;const r=e?.["g_cart-drawer"],n=document.querySelector("cart-drawer");return n?._update({drawer:{section:r},meta:{count:1}}),fetch("/cart.js").then(t=>t.json()).then(t=>{document.querySelectorAll("cart-counter").forEach(e=>e?._cartUpdateHandler({meta:{count:t.item_count}}))}),!0})(n,e));case i.VIOLA:return a(()=>((t,e)=>{if(t)return!1;const r=document.querySelector("cart-drawer");if(!r?.renderContents||!r)return!1;r.classList.contains("is-empty")&&r.classList.remove("is-empty");try{return r.renderContents({sections:e,isOpenCartDrawer:!1}),!0}catch(t){return console.error("Viola theme renderContents error:",t),!1}})(n,e));case i.REVIVE:return a(()=>((t,e)=>{if(t)return!1;const r=document.querySelector("cart-drawer");return!!r?.renderContents&&(r.classList.contains("is-empty")&&r.classList.remove("is-empty"),r.renderContents({sections:e}),!0)})(n,e));case i.PRESTIGE:return a(()=>!n&&(window.fetch("/cart.js").then(t=>t.json()).then(t=>{const e=t?.item_count||1;document.dispatchEvent(new CustomEvent("product:added",{bubbles:!0,detail:{quantity:e}}))}).catch(t=>{console.error("Prestige theme V2 error:",t)}),!0));case i.CANOPY:return a(()=>(()=>{const t=document.querySelector("cart-drawer");return t&&"function"==typeof t.refreshCartDrawer?(t.refreshCartDrawer(),!0):(document.documentElement.dispatchEvent(new CustomEvent("theme:cartchanged",{bubbles:!0,cancelable:!1})),!0)})());case i.EXPANSE:return a(()=>(document.dispatchEvent(new CustomEvent("cart:build")),!0));case i.PALO_ALTO:return a(()=>(async t=>{try{if(t&&t.header){const e=new DOMParser,r=e.parseFromString(t.header,"text/html").querySelector(".cart-link"),n=document.querySelector(".cart-link");r&&n&&n.replaceWith(r)}const e=document.querySelector("cart-element");return e&&("function"==typeof e.getCart&&await e.getCart(),"function"==typeof e.renderCartDrawer&&e.renderCartDrawer(),"function"==typeof e.openCartDrawer&&e.openCartDrawer()),!0}catch(t){return console.error("PALO_ALTO cart refresh error:",t),!1}})(e));case i.HYPER:return a(()=>!n&&document.dispatchEvent(new Event("cart:refresh")));case i.APOLLO:return a(()=>((t,e)=>{if(t){const t=(new DOMParser).parseFromString(e["main-cart-items"],"text/html"),r=document.querySelector("cart-items"),n=t.querySelector("cart-items");return!(!r||!n||(r.innerHTML=n.innerHTML,0))}const r=document.querySelector("cart-drawer");return!!r&&(r.renderContents({sections:e}),!0)})(n,e));case i.BLUBOLT_THEME:return a(()=>r.refreshBluboltCart());case i.ASCENT:return a(()=>((t,e)=>{if(t)return!1;const n={cartDrawer:document.querySelector(r.CART_DRAWER_SELECTOR),cartIcon:document.querySelector(r.CART_COUNT_BUBBLE_SELECTOR)},a={cartDrawer:r.parseCartElement(e,"cart-drawer"),cartIcon:r.parseCartElement(e,"cart-icon-bubble")};return Object.entries(n).forEach(([t,e])=>{e&&a[t]&&(e.innerHTML=a[t].innerHTML)}),!0})(n,e));case i.AOLIE:return a(()=>r.refreshShopifyCart());case i.SLEEK:return a(()=>(({isCartView:t})=>{if(t)return!1;const e=document.querySelector("cart-drawer");return!!e?.onCartRefresh&&(e.onCartRefresh({detail:{open:!0}}),fetch("/cart.js").then(t=>t.json()).then(t=>{document.querySelectorAll(".cart-count").forEach(e=>{e.textContent=t.item_count,e.removeAttribute("hidden")})}),!0)})({isCartView:n}));case i.HONGO:return a(()=>!n&&"function"==typeof window?.handleFloCartBtn&&(window.handleFloCartBtn(),!0));case i.STRETCH:return a(()=>!n&&document.documentElement.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})));case i.GLOOW:return a(()=>((t,e)=>{if(t)return!1;const r=document.querySelector("cart-drawer");return!(!r?.renderContents||!r||(r.renderContents({sections:e}),0))})(n,e));case i.A_IMPACT:return a(()=>(t=>{if(t)return!1;const e=document.querySelector("cart-drawer");return!!e&&(e._onVariantAdded({}),e._onCartRefresh(),!0)})(n));case i.SAVYO_X_VM_0_1:return a(()=>((t,e)=>{if(t)return!1;const r=(new DOMParser).parseFromString(e["minicart-form"],"text/html"),n=document.querySelector("#minicart-form"),a=r.querySelector("#minicart-form");return a&&n&&(n.innerHTML=a.innerHTML),fetch("/cart.js").then(t=>t.json()).then(t=>{if(void 0!==t.item_count){const e=t.item_count;document.querySelectorAll(".cart-count").forEach(t=>{t.innerHTML=t.classList.contains("cart-count-drawer")?`(${e})`:e>100?"~":e});const n=document.querySelector("header-total-price");n&&n.updateTotal(t);const a=document.querySelector("free-ship-progress-bar");a&&a.init(t.items_subtotal_price);const i=document.querySelector(".cart-countdown-time"),o=r.querySelector(".cart-countdown-time");o&&(i?i.innerHTML=o.innerHTML:a.insertAdjacentElement("afterend",o))}}).catch(t=>{console.error("Error fetching cart data:",t)}),!0})(n,e));case i.CADIANT:return a(()=>((t,e)=>{if(!window.theme?.miniCart)return!1;if(!t)return window.theme.miniCart.updateElements(),window.theme.miniCart.generateCart(),!0;const r='[data-section-type="cart"]';try{const t=(new DOMParser).parseFromString(e["cart-template"],"text/html").querySelector(r),n=document.querySelector(r);return!(!t||!n||(n.innerHTML=t.innerHTML,window.theme?.Cart&&new theme.Cart(document.querySelector(r)),window.theme.miniCart.updateElements(),window.theme.miniCart.generateCart(),0))}catch(t){return console.error("🚀 ~ cadiantTheme ~ error:",t),!1}})(n,e));case i.BROADCAST:return!!window.cart?.getCart&&(window.cart.getCart(),!0);case i.TINYBABIES:return a(()=>!n&&!!theme.miniCart&&(theme.miniCart.updateElements(),window.theme.miniCart.generateCart(),!0));case i.SHAPES:return a(()=>!n&&(document.dispatchEvent(new CustomEvent("shapes:cart:lock")),fetch(`${window.location.pathname}?sections=cart-items,cart-footer,cart-item-count,cart-live-region`).then(t=>t.json()).then(t=>{t&&Object.keys(t).length>0&&document.dispatchEvent(new CustomEvent("shapes:cart:update",{bubbles:!0,detail:{response:{sections:{...t}}}}))}).catch(t=>{console.error("Error updating cart:",t)}).finally(()=>{document.dispatchEvent(new CustomEvent("shapes:cart:unlock"))}),!0));case i.WHISK:return a(()=>(t=>{try{return r.WHISK_SECTIONS.forEach(({id:e,section:r,selector:n})=>{document.getElementById(e).innerHTML=((t,e=".shopify-section")=>(new DOMParser).parseFromString(t,"text/html").querySelector(e).innerHTML)(t[r],n)}),!0}catch(t){return console.error("Error updating cart content:",t),!1}})(e));case i.MOLDING:return a(()=>(t=>{if(t)return!1;if(!theme)return!1;try{return theme.miniCart.updateElements(),theme.miniCart.generateCart(),!0}catch(t){return console.error("🚀 ~ moldingTheme ~ error:",t),!1}})(n));case i.DROPMETA_SPEED:return a(()=>!n&&(document.documentElement.dispatchEvent(new CustomEvent("product:added",{detail:{quantity:1},bubbles:!0})),!0));default:return a()}},updateSections:function({themeName:t,newHtmlSection:e}){if(!e)return window.location.reload();const r=this,n=this.isCartPage(),a=this.THEME_CONFIGS[t],i=(({isCartView:t,htmlSections:e,themeName:n})=>[{sectionKey:"cartIcon",type:r.CART_ICON,targetElem:e?.cartIconReplaceElem},{sectionKey:"cartDrawer",type:r.CART_DRAWER,targetElem:e?.cartDrawerReplaceElem,condition:!t||r.DAWN_LIKE_THEMES.includes(n)},{sectionKey:"cartItems",type:r.CART_LINE_ITEM,targetElem:e?.cartItemsReplaceElem,condition:t},{sectionKey:"cartSubTotal",type:r.CART_SUBTOTAL,targetElem:e?.cartSubtotalReplaceElem,condition:t},{sectionKey:"cartMini",type:r.CART_MINI,targetElem:e?.cartMiniReplaceElem,condition:!t||r.DAWN_LIKE_THEMES.includes(n)}])({isCartView:n,htmlSections:a,themeName:t});for(const n of i){const{sectionKey:i,type:o,targetElem:c,condition:s=!0}=n,u=a?.[i];s&&(u&&e?.[u])&&r.replaceCartHtmlNode({type:o,dataToParse:e[u],targetCurrentElem:c,themeName:t})}},getThemeName:function(){return window.BOOMR?.themeName||window.Shopify?.theme?.schema_name||window.Shopify?.theme?.name},getAllSectionsByTheme:function(t){const e=this.THEME_NAMES;if(t===e.CONCEPT&&window.theme?.utils?.sectionId){const t=document.querySelector("cart-items");if(t)return window.theme.utils.sectionId(t)}if(t===e.ECOMUS){const t=document.querySelector("#MainContent .hdt-section-main-cart")?.id?.replace("shopify-section-","");if(t)return t}return this.MODERN_THEMES.includes(t)?this.getCurrentSectionId():this.THEME_CONFIGS[t]?.allSections||""},isThemeReloadAble:function(t){return!Object.values(this.THEME_NAMES).includes(t)},getThirdPartyCartAppName:function(){let t="";switch(!0){case!!window.Rebuy?.SmartCart:t=this.REBUY_CART;break;case!!window.SLIDECART:t=this.AMP_CART;break;case!!window?.upcartSettings:t=this.UPCART_CART;break;case!!window?.Vanga?.refresh:t=this.VANGA_CART;break;case!!window?.opusActive:t=this.OPUS_CART;break;case!!window?.XBOOST_CART||"function"==typeof window?.xbcFetch:t=this.XB_CART;break;case!!window?.aovCartDrawerUpdateAndOpen:t=this.AOV_AI_CART;break;case!!window?.STICKY_CART_UPDATE||"function"==typeof window?.STICKY_CART_OPEN:t=this.QIKIFY_STICKY_CART;break;case!!window?.sme_cart_data:t=this.SALE_MAX_CART_UPSELL;break;case!!window?.EasySlideCart?.enabled:t=this.SLIDE_CARTY;break;case!!window?.icart_cart_arr:t=this.I_CART;break;default:t=""}return t},integrateCartApp:function(t){t&&this.CART_APP_REFRESH_FUNCTIONS[t]&&this.CART_APP_REFRESH_FUNCTIONS[t]()},init:async function(t={useUpdateSections:!0,preferThirdParty:!0}){let e;try{const r=this.getThirdPartyCartAppName(),n=!1!==t.useThirdPartyCart&&r;if(n&&!1!==t.preferThirdParty)return console.log("Using third-party cart app:",r),this.integrateCartApp(r),{usingThirdParty:!0,cartApp:r};if(e=this.getThemeName(),!e)throw console.error("Theme name not found"),new Error("Theme name not found");const a=this.getAllSectionsByTheme(e);a||console.log("No sections needed for theme:",e,"- using theme-specific refresh method");const i=await fetch(window.Shopify.routes.root+`?sections=${a}`),o=await i.json(),c=Object.values(o).every(t=>!t),s=this.THEME_CONFIGS[e],u=s&&(void 0!==s.cartDrawer||void 0!==s.cartItems||void 0!==s.cartIcon);return a&&t.useUpdateSections&&u&&!c?this.updateSections({themeName:e,newHtmlSection:o}):this.refreshCartForTheme(e,o),n&&!t.preferThirdParty&&this.integrateCartApp(r),this._scheduleWidgetRestoration(),{success:!0,theme:e,cartApp:r,sections:o}}catch(t){throw console.error("Cart refresh error:",t),this.isThemeReloadAble(e)&&(console.warn("Theme not fully supported, reloading page..."),window.location.reload()),t}},_scheduleWidgetRestoration:function(){this._widgetRestorationTimeouts&&this._widgetRestorationTimeouts.forEach(t=>clearTimeout(t)),this._widgetRestorationTimeouts=[];[100,500,1500].forEach((t,e)=>{const r=setTimeout(()=>(t=>{if(gfg.cartDrawerObserver){1===t&&(gfg.utility.debugConsole("Widget restoration: Re-attaching observer after cart refresh"),gfg.cartDrawerObserver.observeCartDrawer());const e=gfg.cartDrawerObserver.state.observedDrawer;if("function"==typeof gfg.cartDrawerObserver.widgetsExist){const r=gfg.cartDrawerObserver.widgetsExist(e),n=gfg.cartDrawerObserver.widgetContentExists(e);r?n?gfg.utility.debugConsole(`Widget restoration attempt ${t}: wrapper and content exist, skipping`):(gfg.utility.debugConsole(`Widget restoration attempt ${t}: wrapper exists but content missing, triggering full re-render`),gfg.cartDrawerObserver.reinjectWidgets(!0)):(gfg.utility.debugConsole(`Widget restoration attempt ${t}: wrapper missing, re-injecting`),gfg.cartDrawerObserver.reinjectWidgets(!0))}}})(e+1),t);this._widgetRestorationTimeouts.push(r)})},refreshSections:async function(t,e={}){const r=t||this.getThemeName();if(!r)throw console.error("Theme name not found"),new Error("Theme name not found");if(!this.THEME_CONFIGS[r])return console.warn("Theme config not found, falling back to full refresh"),await this.init(e);const n=this.getAllSectionsByTheme(r);try{const t=await fetch(window.Shopify.routes.root+`?sections=${n}`),e=await t.json();return this.updateSections({themeName:r,newHtmlSection:e}),{success:!0,theme:r,sections:e}}catch(t){throw console.error("Section refresh error:",t),t}},checkAndIntegrateThirdPartyCart:function(){const t=this.getThirdPartyCartAppName();return t?(console.log("Third-party cart detected:",t),this.integrateCartApp(t),{integrated:!0,cartApp:t}):{integrated:!1}}},gfgFreeGift:{_isStub:!0,state:{},init:function(){},initialize:function(){},f:{},utility:{},actions:{}},gfgBogoFeature:{_isStub:!0,state:{},init:function(){},initialize:function(){},f:{},utility:{},actions:{}},gfgUnifiedWidget:{_isStub:!0,state:{},init:function(){},initialize:function(){},f:{},utility:{},actions:{}},gfgVolDiscount:{_isStub:!0,state:{},init:function(){},initialize:function(){},f:{},utility:{},actions:{}},gfgVolumeDiscountV2:{_isStub:!0,state:{debugTrace:[]},init:function(){},initialize:function(){},onCartChange:function(){},_trace:function(){},f:{},utility:{},actions:{}},gfgFreeGiftV2:{_isStub:!0,state:{},init:function(){},onCartChange:function(){},destroy:function(){}},gfgGlobalWidgets:{_isStub:!0,state:{debugTrace:[]},constants:{},init:function(){},onCartChange:function(){},destroy:function(){},_trace:function(){},f:{},render:{},actions:{}}};window.gfg=gfg;const gfgRuleEngine={PRODUCT_DISPLAY_RULE_TYPES:["products","productVariants","collections","productTags","productTypes"],HIDE_ON_PRESENCE_RULE_TYPES:["lineAttributes","productHasSubscription"],CART_RULE_TYPES:["cartQuantity","cartSubtotal","cartAttributes"],CUSTOMER_RULE_TYPES:["customerTags","market","isCustomerLoggedIn"],getPdpProductContext:function(t,e){try{const r=window&&window.shopifyLiquidValuesApp7Ext&&window.shopifyLiquidValuesApp7Ext.product||{},n=(r.collections||[]).map(function(t){return{id:t.id,handle:t.handle,gid:t.gid}});return{id:t&&null!=t.id?t.id:r.productId,selected_variant:{id:e},collections:n,tags:t&&t.tags||[],type:t&&t.type||""}}catch(t){return gfg.utility.debugError("error in gfgRuleEngine getPdpProductContext",t),{id:void 0,selected_variant:{id:e},collections:[],tags:[],type:""}}},_stripGid:function(t){return String(null==t?"":t).replace(/^gid:\/\/shopify\/[A-Za-z]+\//,"")},_rv:function(t){return t&&t.ruleValue||{}},_productMatchers:{products:function(t,e){const r=(e.value||[]).map(function(t){return gfgRuleEngine._stripGid(t.productId||t.graphqlId||t.id)}),n=gfgRuleEngine._stripGid(t&&t.id);return r.some(function(t){return t===n})},productVariants:function(t,e){const r=(e.value||[]).flatMap(function(t){return(t.variants||[]).map(function(t){return gfgRuleEngine._stripGid(t.variantId||t.variantGraphqlId||t.id)})}),n=gfgRuleEngine._stripGid(t&&t.selected_variant&&t.selected_variant.id);return r.some(function(t){return t===n})},collections:function(t,e){const r=(e.value||[]).map(function(t){return gfgRuleEngine._stripGid(t.id||t.collectionId||t.gid)}),n=(t&&t.collections||[]).map(function(t){return gfgRuleEngine._stripGid(t.id||t.gid)});return r.some(function(t){return n.indexOf(t)>=0})},productTags:function(t,e){const r=e.value||[],n=t&&t.tags||[];return r.some(function(t){return n.some(function(e){return String(e).toLowerCase()===String(t).toLowerCase()})})},productTypes:function(t,e){const r=e.value||[],n=String(t&&t.type||"");return r.some(function(t){return String(t).toLowerCase()===n.toLowerCase()})}},_qualifierCompare:function(t,e,r){const n=Number(e);switch(r||"greaterThanOrEqualTo"){case"greaterThanOrEqualTo":default:return t>=n;case"lessThanOrEqualTo":return t<=n;case"equalTo":return t===n;case"greaterThan":return t>n;case"lessThan":return t=0)return gfgRuleEngine.matchCartAgainstRule(e&&e.cart,t);const a=gfgRuleEngine._rv(t),i=gfgRuleEngine._getQualifiedItems(e&&e.cart,t);if(r.simulateCurrentProduct&&gfgRuleEngine.matchProductAgainstRule(e&&e.product,t)){const t=Number(e&&e.product&&e.product.selected_variant&&e.product.selected_variant.price||0)/100;i.overallQty+=1,i.overallSubtotal+=t,i.individualQty=(i.individualQty===Number.MAX_SAFE_INTEGER?0:i.individualQty)+1,i.individualSubtotal=(i.individualSubtotal===Number.MAX_SAFE_INTEGER?0:i.individualSubtotal)+t;const r=String(e.product.selected_variant&&e.product.selected_variant.id||"");i.variantIds.has(r)||(i.differentQty+=1)}const o=i.overallQty>0;if(!a.qualifierType||"none"===a.qualifierType)return o;if(!o)return!1;let c;switch(a.qualifierType){case"overallQty":c=i.overallQty;break;case"overallSubtotal":c=i.overallSubtotal;break;case"differentQty":c=i.differentQty;break;case"individualQty":c=i.individualQty===Number.MAX_SAFE_INTEGER?0:i.individualQty;break;case"individualSubtotal":c=i.individualSubtotal===Number.MAX_SAFE_INTEGER?0:i.individualSubtotal;break;default:return!1}const s="overallSubtotal"===a.qualifierType||"individualSubtotal"===a.qualifierType,u=gfgRuleEngine._resolveMarketValue(a,s);return gfgRuleEngine._qualifierCompare(c,u,a.qualifierOperatorType)}catch(t){return gfg.utility.debugError("error in gfgRuleEngine evaluateQualifier",t),!0}},_evaluateRule:function(t,e,r){const n=t&&t.ruleType;let a;return a=gfgRuleEngine.CUSTOMER_RULE_TYPES.indexOf(n)>=0?gfgRuleEngine.matchCustomerAgainstRule(t):"qualifier"===r.mode?gfgRuleEngine.evaluateQualifier(t,e,{simulateCurrentProduct:!!r.simulateCurrentProduct}):gfgRuleEngine.CART_RULE_TYPES.indexOf(n)>=0||gfgRuleEngine.matchProductAgainstRule(e&&e.product,t),r.trace&&r.trace.push({ruleId:t&&t.ruleId,ruleType:n,type:t&&t.type,mode:r.mode||"applicability",passed:!!a}),a},evaluateRulesList:function(t,e,r,n){if(n=n||{},!t||0===t.length)return!0;if(n.hideOnPresence){const e=t.find(function(t){return gfgRuleEngine.HIDE_ON_PRESENCE_RULE_TYPES.indexOf(t&&t.ruleType)>=0});if(e)return n.trace&&n.trace.push({ruleId:e.ruleId,ruleType:e.ruleType,hideOnPresence:!0,passed:!1}),!1}const a=t.map(function(t){return gfgRuleEngine._evaluateRule(t,r,n)});return"OR"===(e||"AND")?a.some(Boolean):a.every(Boolean)},evaluateNestedRuleGroups:function(t,e,r){try{const n=t&&t.rulesGlobalList;if(!n||0===n.length)return!0;const a=n.map(function(t){return gfgRuleEngine.evaluateRulesList(t&&t.rulesList,t&&t.rulesOperator,e,r||{})});return"OR"===(t.rulesGlobalOperator||"AND")?a.some(Boolean):a.every(Boolean)}catch(t){return gfg.utility.debugError("error in gfgRuleEngine evaluateNestedRuleGroups",t),!0}},isCustomerEligible:function(t){try{if(!t||!t.rulesList||!t.rulesList.length)return!0;const e=t.rulesOperator||"OR",r=[];let n=null;for(const e of t.rulesList)"market"===e.ruleType?n=e:r.push(e);const a=r.length?r.map(function(t){return gfgRuleEngine.matchCustomerAgainstRule(t)}):[!0],i=!n||gfgRuleEngine.matchCustomerAgainstRule(n);return("AND"===e?a.every(Boolean):a.some(Boolean))&&i}catch(t){return gfg.utility.debugError("error in gfgRuleEngine isCustomerEligible",t),!0}},evaluateWidgetVisibility:function(t,e,r){const n=[],a=function(t,e,r){return n.push(Object.assign({name:t,passed:!!e},r||{})),!!e};try{const i=e&&e.targeting||{},o=i.discountableProductPages,c=null==o?i.specificProductPages:o;a("discountableProductPages",!0===c,{flag:c}),a("campaign",gfg.utility.checkForActiveCampaign(t)),a("customerEligibility",gfgRuleEngine.isCustomerEligible(t&&t.customerEligibilityRules));const s=[];a("discountTriggeredRules",gfgRuleEngine.evaluateNestedRuleGroups(t&&t.discountTriggeredRulesData,r,{mode:"qualifier",trace:s}),{rules:s});const u=t&&t.segmentsData&&t.segmentsData.segmentsList&&t.segmentsData.segmentsList[0],g=u&&u.getYRulesData,l=[];a("getYRules",gfgRuleEngine.evaluateRulesList(g&&g.rulesList,g&&g.rulesOperator,r,{hideOnPresence:!0,trace:l}),{rules:l});const d=n.find(function(t){return!t.passed});return{shouldRender:!d,reason:d?d.name:null,checkpoints:n}}catch(t){return gfg.utility.debugError("error in gfgRuleEngine evaluateWidgetVisibility",t),{shouldRender:!0,reason:"error_fail_open",checkpoints:n}}}};gfg.ruleEngine=gfgRuleEngine,gfg.rules=gfgRuleEngine,window.gfgRuleEngine=gfgRuleEngine,window.gfgFileStatus&&(window.gfgFileStatus.base="LOADED"),document.dispatchEvent(new CustomEvent("gfg:module:base"));var GFG_DEPENDENCIES=[{module:"freeGiftV1",event:"gfg:module:loaded"},{module:"freeGiftV2",event:"gfg:module:loaded"},{module:"kiteV0Features",event:"gfg:module:loaded"},{module:"customDiscountLogic",event:"gfg:module:loaded"},{module:"globalWidgets",event:"gfg:module:loaded"}];function checkAllDependenciesLoaded(t,e){for(var r=0;r