1"use strict";function _taggedTemplateLiteral(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _asyncToGenerator(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,i){function r(n,o){try{var a=t[n](o),s=a.value}catch(e){return void i(e)}return a.done?void e(s):Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)})}return r("next")})}}function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}function handleize(e){return e?e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-"):""}function initSubscriberTracking(){window.addEventListener("klaviyoForms",function(t){if("embedOpen"===t.detail.type)return e(void 0,t.detail.formId);if("submit"!==t.detail.type);else{var i=(new TextEncoder).encode(t.detail.metaData.$email);crypto.subtle.digest("SHA-256",i).then(function(e){return Array.from(new Uint8Array(e))}).then(function(e){return e&&e.map(function(e){return e.toString(16).padStart(2,"0")}).join("")}).then(function(e){var i=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),r=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),n=r.menu_navigation_state||{};window.pushEvent({event:"form_interaction",menu_navigation_state:n,ecommerce:i,interaction_type:"Submit",form_state:{type:"marketingSignup",name:t.detail.metaData.$source||"footerSignup",app_name:"Klaviyo"},subscriber_details:{email:e}},"form_state")})}});var e=function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),o=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),a=o.menu_navigation_state||{},s=t&&!!t.closest(".footer__newsletter");if(!r&&i){var c=document.querySelector("div.klaviyo-form-"+i);return void window.theme.observeElement(c,function(){return e(c,i,!0)})}window.pushEvent({event:"form_interaction",menu_navigation_state:a,ecommerce:n,interaction_type:"View",form_state:{type:"marketingSignup",name:s&&"footerSignup"||i||"pageSignup",app_name:"Klaviyo"}},"form_state")},t=document.querySelector("#subscribe_form_footer");t&&window.theme.observeElement(t,function(){return e(t,void 0,!0)})}function productsQuery(e,t){var i=e&&t?', after: "'+t+'"':"";return"\n query getProducts @inContext(country: "+Shopify.country+") {\n products(first:250"+i+', query: "available_for_sale:true", reverse: true, sortKey: UPDATED_AT) {\n edges {\n node {\n handle\n id\n title\n onlineStoreUrl\n productType\n tags\n variants(first: 250) {\n edges {\n node {\n id\n title\n sku\n availableForSale\n price {\n amount\n }\n compareAtPrice {\n amount\n }\n offers: metafield(namespace: "multi_custom", key: "sp_discount") {\n value\n }\n }\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n startCursor\n endCursor\n }\n }\n }\n '}function fetchAllProducts(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i="https://"+window.Shopify.shop+"/api/2024-04/graphql.json",r={method:"POST",headers:{"Content-Type":"application/graphql","X-Shopify-Storefront-Access-Token":window.theme.storefrontAPIToken},body:productsQuery(e,t)};fetch(i,r).then(function(e){return e.json()}).then(function(i){var r=i.data.products,n=r.pageInfo,o=r.edges.map(function(e){var t=e.node,i=t.id,r=t.handle,n=t.title,o=t.onlineStoreUrl,a=t.productType,s=t.tags,c=t.variants,u=i.split("/");return{id:u[u.length-1],handle:r,title:n,productType:a,tags:s||[],url:o,sku:c.edges[0].node.sku,variants:c.edges.map(function(e){var t=e.node;return{id:t.id,title:t.title,available:t.availableForSale,price:t.price?t.price.amount:null,compareAtPrice:t.compareAtPrice?t.compareAtPrice.amount:null}})}});e=n.hasNextPage,t=n.endCursor;var a=JSON.parse(sessionStorage.getItem(PRODUCTS_STORAGE_KEY)||"[]");return a=a.concat(o),sessionStorage.setItem(PRODUCTS_STORAGE_KEY,JSON.stringify(a)),e?(sessionStorage.removeItem(PRODUCTS_STORAGE_KEY_LOADED),fetchAllProducts(e,t)):void sessionStorage.setItem(PRODUCTS_STORAGE_KEY_LOADED,"true")}).catch(function(e){window.console.error(e)})}function getAllProducts(){var e=JSON.parse(sessionStorage.getItem(PRODUCTS_STORAGE_KEY)||"[]");return e.length||(sessionStorage.removeItem(PRODUCTS_STORAGE_KEY_LOADED),fetchAllProducts()),e}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_methods,_slicedToArray=function(){function e(e,t){var i=[],r=!0,n=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(i.push(a.value),!t||i.length!==t);r=!0);}catch(e){n=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}return i}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,i);
1throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_templateObject=_taggedTemplateLiteral(['<span class="currency-switched">','<em class="currency-symbol">',"</em>","","</span>"],['<span class="currency-switched">','<em class="currency-symbol">',"</em>","","</span>"]),PRODUCTS_STORAGE_KEY="graphql_all_products_"+Shopify.country,PRODUCTS_STORAGE_KEY_LOADED="graphql_all_products_loaded_"+Shopify.country;window.slate=window.slate||{},window.theme=window.theme||{},window.theme.checkPageReload=function(){localStorage.getItem("ga-select-item")&&!window.location.pathname.includes("/products/")&&window.addEventListener("load",function(){var e=performance.getEntriesByType("navigation");e.forEach(function(e){"reload"!==e.type&&localStorage.removeItem("ga-select-item")})})},window.theme.checkPageReload(),window.theme.isElementVisibleInViewport=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.getBoundingClientRect(),r=i.top,n=i.left,o=i.bottom,a=i.right,s=window,c=s.innerHeight,u=s.innerWidth;return t?(r>0&&r<c||o>0&&o<c)&&(n>0&&n<u||a>0&&a<u):r>=0&&n>=0&&o<=c&&a<=u},window.theme.observeElement=function(e,t){var i=function(e,i){e.forEach(function(e){0!==e.intersectionRatio&&(i.unobserve(e.target),t&&t())})},r=new IntersectionObserver(i);r.observe(e)},// Slate 2/** 3 * A11y Helpers 4 * ----------------------------------------------------------------------------- 5 * A collection of useful functions that help make your theme more accessible 6 * to users with visual impairments. 7 * 8 * 9 * @namespace a11y 10 */ 11slate.a11y={pageLinkFocus:function(e){function t(){e.first().removeClass(i).removeAttr("tabindex")}var i="js-focus-hidden";e.first().attr("tabIndex","-1").focus().addClass(i).one("blur",t)},focusHash:function(){var e=window.location.hash;e&&document.getElementById(e.slice(1))&&this.pageLinkFocus($(e))},bindInPageLinks:function(){$("a[href*=#]").on("click",function(e){this.pageLinkFocus($(e.currentTarget.hash))}.bind(this))},trapFocus:function(e){var t=e.namespace?"focusin."+e.namespace:"focusin";e.$elementToFocus||(e.$elementToFocus=e.$container),e.$container.attr("tabindex","-1"),e.$elementToFocus.focus(),$(document).on(t,function(t){e.$container[0]===t.target||e.$container.has(t.target).length||e.$container.focus()})},removeTrapFocus:function(e){var t=e.namespace?"focusin."+e.namespace:"focusin";e.$container&&e.$container.length&&e.$container.removeAttr("tabindex"),$(document).off(t)}},slate.cart={cookiesEnabled:function(){var e=navigator.cookieEnabled;return e||(document.cookie="testcookie",e=document.cookie.indexOf("testcookie")!==-1),e}},slate.utils={findInstance:function(e,t,i){for(var r=0;r<e.length;r++)if(e[r][t]===i)return e[r]},removeInstance:function(e,t,i){for(var r=e.length;r--;)if(e[r][t]===i){e.splice(r,1);break}return e},compact:function(e){for(var t=-1,i=null==e?0:e.length,r=0,n=[];++t<i;){var o=e[t];o&&(n[r++]=o)}return n},defaultTo:function(e,t){return null==e||e!==e?t:e}},slate.rte={wrapTable:function(){$(".rte table").wrap('<div class="rte__table-wrapper"></div>')}
11,iframeReset:function(){var e=$('.rte iframe[src*="youtube.com/embed"], .rte iframe[src*="player.vimeo"]'),t=e.add(".rte iframe#admin_bar_iframe");e.each(function(){$(this).wrap('<div class="rte__video-wrapper"></div>')}),t.each(function(){this.src=this.src})}},slate.Sections=function(){this.constructors={},this.instances=[],$(document).on("shopify:section:load",this._onSectionLoad.bind(this)).on("shopify:section:unload",this._onSectionUnload.bind(this)).on("shopify:section:select",this._onSelect.bind(this)).on("shopify:section:deselect",this._onDeselect.bind(this)).on("shopify:section:reorder",this._onReorder.bind(this)).on("shopify:block:select",this._onBlockSelect.bind(this)).on("shopify:block:deselect",this._onBlockDeselect.bind(this))},slate.Sections.prototype=$.extend({},slate.Sections.prototype,{_createInstance:function(e,t){var i=$(e),r=i.attr("data-section-id"),n=i.attr("data-section-type");if(t=t||this.constructors[n],"undefined"!=typeof t){var o=$.extend(new t(e),{id:r,type:n,container:e});this.instances.push(o)}},_onSectionLoad:function(e){var t=$("[data-section-id]",e.target)[0];t&&this._createInstance(t)},_onSectionUnload:function(e){var t=slate.utils.findInstance(this.instances,"id",e.detail.sectionId);t&&("function"==typeof t.onUnload&&t.onUnload(e),this.instances=slate.utils.removeInstance(this.instances,"id",e.detail.sectionId))},_onSelect:function(e){var t=slate.utils.findInstance(this.instances,"id",e.detail.sectionId);t&&"function"==typeof t.onSelect&&t.onSelect(e)},_onDeselect:function(e){var t=slate.utils.findInstance(this.instances,"id",e.detail.sectionId);t&&"function"==typeof t.onDeselect&&t.onDeselect(e)},_onReorder:function(e){var t=slate.utils.findInstance(this.instances,"id",e.detail.sectionId);t&&"function"==typeof t.onReorder&&t.onReorder(e)},_onBlockSelect:function(e){var t=slate.utils.findInstance(this.instances,"id",e.detail.sectionId);t&&"function"==typeof t.onBlockSelect&&t.onBlockSelect(e)},_onBlockDeselect:function(e){var t=slate.utils.findInstance(this.instances,"id",e.detail.sectionId);t&&"function"==typeof t.onBlockDeselect&&t.onBlockDeselect(e)},register:function(e,t){this.constructors[e]=t,$("[data-section-type="+e+"]").each(function(e,i){this._createInstance(i,t)}.bind(this))}}),slate.Currency=function(){function e(e,t){function r(e,t,i,r){if(t=slate.utils.defaultTo(t,2),i=slate.utils.defaultTo(i,","),r=slate.utils.defaultTo(r,"."),isNaN(e)||null==e)return 0;e=(e/100).toFixed(t);var n=e.split("."),o=n[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+i),a=n[1]?r+n[1]:"";return o+a}"string"==typeof e&&(e=e.replace(".",""));var n="",o=/\{\{\s*(\w+)\s*\}\}/,a=t||i;switch(a.match(o)[1]){case"amount":n=r(e,2);break;case"amount_no_decimals":n=r(e,0);break;case"amount_with_space_separator":n=r(e,2," ",".");break;case"amount_no_decimals_with_comma_separator":n=r(e,0,",",".");break;case"amount_no_decimals_with_space_separator":n=r(e,0," ");break;case"amount_with_comma_separator":n=r(e,2,".",",")}return a.replace(o,n)}function t(e){return e?e.replace(/[^0-9.,-]+/g,""):""}var i="${{amount}}";return{formatMoney:e,removeCurrencySymbol:t}}(),slate.Image=function(){function e(e,t){"string"==typeof e&&(e=[e]);for(var i=0;i<e.length;i++){var r=e[i];this.loadImage(this.getSizedImageUrl(r,t))}}function t(e){(new Image).src=e}function i(e){var t=e.match(/.+_((?:pico|icon|thumb|small|compact|medium|large|grande)|\d{1,4}x\d{0,4}|x\d{1,4})[_\.@]/);return t?t[1]:null}function r(e,t){if(!e||null===t)return e;if("master"===t)return this.removeProtocol(e);var i=e.match(/\.(webp|jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?$/i);if(i){var r=e.split(i[0]),n=i[0];return this.removeProtocol(r[0]+"_"+t+n)}return null}function n(e){return e.replace(/http(s)?:/,"")}return{preload:e,loadImage:t,imageSize:i,getSizedImageUrl:r,removeProtocol:n}}(),slate.Variants=function(){function e(e){this.$container=e.$container,this.product=e.product,this.singleOptionSelector=e.singleOptionSelector,this.originalSelectorId=e.originalSelectorId,this.enableHistoryState=e.enableHistoryState,this.currentVariant=this._getVariantFromOptions(),$(this.singleOptionSelector,this.$container).on("change",this._onSelectChange.bind(this))}return e.prototype=$.extend({},e.prototype,{_getCurrentOptions:function(){var e=$.map($(this.singleOptionSelector,this.$container),function(e){var t=$(e),i=t.attr("type"),r={};return"radio"===i||"checkbox"===i?!!t[0].checked&&(r.value=t.val(),r.index=t.data("index"),r):(r.value=t.val(),r.index=t.data("index"),r)});return e=slate.utils.compact(e)},_getVariantFromOptions:function(){var e=this._getCurrentOptions(),t=this.product.variants,i=!1;return t&&t.forEach(function(t){var r=!0;e.forEach(function(e){r&&(r=e.value===t[e.index])}),r&&(i=t)}),i||null},_onSelectChange:function(){var e=this._getVariantFromOptions();this.$container.trigger({type:"variantChange",variant:e}),e&&(this._updateMasterSelect(e),this._updateImages(e),this._updatePrice(e),this.currentVariant=e,this.enableHistoryState&&this._updateHistoryState(e))},_updateImages:function(e){var t=e.featured_image||{},i=this.currentVariant.featured_image||{};e.featured_image&&t.src!==i.src&&this.$container.trigger({type:"variantImageChange",variant:e})},_updatePrice:function(e){e.price===this.currentVariant.price&&e.compare_at_price===this.currentVariant.compare_at_price||this.$container.trigger({type:"variantPriceChange",variant:e})},_updateHistoryState:function(e){if(history.replaceState&&e){var t=window.location.protocol+"//"+window.location.host+window.location.pathname+"?variant="+e.id;window.history.replaceState({path:t},"",t)}},_updateMasterSelect:function(e){$(this.originalSelectorId,this.$container)[0].value=e.id}}),e}(),theme.AccordionList=function(){function e(e){var t=this;if(!e.dataset.inited){this.container=e,this.showingId=null;var i=this.container.querySelectorAll(".accordion__label button");
11i.forEach(function(e){return e.addEventListener("click",t.toggleBody.bind(t))}),e.dataset.inited=!0}}return e.prototype.toggleBody=function(e){var t=e.currentTarget,i=e.currentTarget.dataset.toggle,r=this.container.querySelector('[data-body-id="'.concat(i,'"]'));if(r.parentElement.classList.contains("is-expanded"))window.theme.lastActiveElement=document.activeElement,r.parentElement.classList.remove("is-expanded"),t.setAttribute("aria-expanded","false"),window.theme.lastActiveElement&&(window.theme.lastActiveElement.focus(),window.theme.lastActiveElement=null),$(document).off("keydown:escape",this.toggleBody.bind(this));else{window.theme.lastActiveElement=document.activeElement,r.parentElement.classList.add("is-expanded"),t.setAttribute("aria-expanded","true");var n=r.querySelector('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])');n&&n.focus(),$(document).on("keydown:escape",this.toggleBody.bind(this))}},e.prototype.showBody=function(e){e.parentElement.classList.add("is-expanded"),this.showingId=e.id},e.prototype.hideBody=function(e){e.parentElement.classList.remove("is-expanded"),this.showingId=null},e}(),theme.ParentAccordionList=function(){function e(e){var t=this;if(!e.dataset.inited){this.container=e,this.showingId=null;var i=this.container.querySelectorAll(".parent__label button");i.forEach(function(e){return e.addEventListener("click",t.toggleBody.bind(t))}),e.dataset.inited=!0}}return e.prototype.toggleBody=function(e){var t=e.currentTarget.dataset.toggle,i=this.container.querySelector('[data-body-id="'.concat(t,'"]'));if(i.parentElement.classList.contains("is-expanded"))window.theme.lastActiveElement=document.activeElement,i.parentElement.classList.remove("is-expanded"),window.theme.lastActiveElement&&(window.theme.lastActiveElement.focus(),window.theme.lastActiveElement=null),$(document).off("keydown:escape",this.toggleBody.bind(this));else{window.theme.lastActiveElement=document.activeElement,i.parentElement.classList.add("is-expanded");var r=i.querySelector('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])');r&&r.focus(),$(document).on("keydown:escape",this.toggleBody.bind(this))}},e.prototype.showBody=function(e){e.parentElement.classList.add("is-expanded"),this.showingId=e.id},e.prototype.hideBody=function(e){e.parentElement.classList.remove("is-expanded"),this.showingId=null},e}(),theme.QuantitySelector=function(){function e(e){if(!e.dataset.inited){this.container=e,this.input=e.querySelector("input"),this.minus=e.querySelector(".quantity-selector__control--minus"),this.plus=e.querySelector(".quantity-selector__control--plus"),this.min=0,this.max=0,this.input&&(this.min=parseInt(this.input.getAttribute("min"),10),this.max=parseInt(this.input.getAttribute("max"),10)),this.boundDecrement=this.decrement.bind(this),this.boundIncrement=this.increment.bind(this),this.minus&&this.minus.addEventListener("click",this.boundDecrement),this.plus&&this.plus.addEventListener("click",this.boundIncrement);var t=void 0;this.input&&(t=parseInt(this.input.value,10)),t<=this.min&&this.minus&&this.minus.setAttribute("disabled","disabled"),t>=this.max&&this.plus&&this.plus.setAttribute("disabled","disabled"),this.input&&this.minus&&this.plus&&this.onInputUpdated(),e.dataset.inited=!0,e._quantitySelector=this}}return e.prototype.decrement=function(){var e=parseInt(this.input.value,10)-1;this.input.value=e,this.onInputUpdated()},e.prototype.increment=function(){var e=parseInt(this.input.value,10)+1;this.input.value=e,this.onInputUpdated()},e.prototype.onInputUpdated=function(){var e=parseInt(this.input.value,10);e>=this.max?this.plus.setAttribute("disabled","disabled"):this.plus.removeAttribute("disabled"),e<=this.min?this.minus.setAttribute("disabled","disabled"):this.minus.removeAttribute("disabled");var t=document.createEvent("HTMLEvents");t.initEvent("input",!1,!0),this.input.dispatchEvent(t)},e.prototype.destroy=function(){this.minus&&this.minus.removeEventListener("click",this.boundDecrement),this.plus&&this.plus.removeEventListener("click",this.boundIncrement),this.container&&this.container.removeAttribute("data-inited")},e}(),theme.sideCart=new Vue({el:".side-cart",data:{cart:null,multibuy:null,multibuyOffer:"",upsellsActive:!1,upsellProducts:[],gwpAutoCollapse:!1,giftWithPurchase:window.theme&&window.theme.giftW
11ithPurchase,giftWithPurchaseEnabled:window.theme&&window.theme.giftWithPurchase&&window.theme.giftWithPurchase.enabled||!1,giftWithPurchaseActive:!0,giftWithPurchaseProducts:[],giftWithPurchaseHeading:"",expandedAccordions:[],upsell:null,timeout:null,isVisible:!1,isReady:!1,difference:0,errorMessage:"",quantitySelectors:[],totalPrice:null,totalDiscount:null,isFreeShipping:!1,progressBarStatus:0,freeShippingText:"",shippingPrice:0},created:function(){var e=document.querySelector(".side-cart__upsell-container"),t=document.querySelector(".side-cart__upsell-toggler");if(e&&t&&window.innerHeight<700&&(e.classList.remove("side-cart__upsell--active"),t.classList.add("upsell-toggler--closed")),"EU"===window.theme.store){if(window.Shopify&&window.Shopify.currency){var i=window.Shopify.currency;i.moneyFormat=window.theme.moneyFormat;try{localStorage.setItem("ShopifyCurrencyObj",JSON.stringify(i))}catch(e){console.warn("Error setting ShopifyCurrencyObj local storage",e)}}var r=$("[data-free-shipping-element] span"),n=this.getFreeShippingAmount();n*=Number(Shopify.currency.rate),$.each(r,function(e,t){var i=$(t);if(i&&i.text().includes("{amount}")){var r=slate.Currency.formatMoney(n,window.theme.moneyFormat);i.text(i.text().replace("{amount}",r))}})}},mounted:function(){var e=this,t=new Date;$.ajax({method:"GET",url:window.Shopify.routes.root+"cart.js?"+t.getTime(),dataType:"JSON",success:function(t){var i=t.items.filter(function(e){return e.properties&&e.properties._offer});i.length>0&&e.calculateMultibuy(t),e.multibuyCheck(t),window.theme.settings.enable_bopis||e.getUpsellProducts(t),e.waitForGwpStatusAndRun(t),e.freeShippingCheck(),window.innerWidth<990?window.theme.upsells.autoOpenMobile&&t.items.length<2&&(e.upsellsActive=!0):window.theme.upsells.autoOpenDesktop&&(e.upsellsActive=!0);var r=document.querySelectorAll("[data-toggle-cart]");r.forEach(function(t){t.addEventListener("click",e.toggleDrawer.bind(e)),t.addEventListener("keydown",function(t){"Enter"!==t.key&&" "!==t.key&&"Spacebar"!==t.key||(t.preventDefault(),e.toggleDrawer(t))})}),$(document).on("keydown:escape",e.closeDrawer.bind(e)),e.cartOfferCheck(),e.checkNoFreeShippingCountry(),e.cart=t,e.isReady=!0,e.updateCartItemsEvent(),e.onCartUpdated()}}),window.theme.glbeHelpers&&window.theme.glbeHelpers.convertUpsellTogglePrices(),document.dispatchEvent(new CustomEvent("side-cart:rendered"))},computed:{isCartOverLimit:function(){return!!window.theme.enableMaximumOrderValue&&this.cart.total_price>window.theme.maximumOrderValue}},updated:function(){var e=this;this.quantitySelectors.length>0&&(this.quantitySelectors.forEach(function(e){return e.destroy()}),this.quantitySelectors=[]),document.querySelectorAll("[data-component=QuantitySelector]").length>0&&document.querySelectorAll("[data-component=QuantitySelector]").forEach(function(t){e.quantitySelectors.push(new theme[t.dataset.component](t))}),theme.currencyConverter===!0&&window.Currency.convertAll&&"true"===theme.currencyConverter&&window.Currency.convertAll(theme.currency,window.Currency.currentCurrency),("EU"===window.theme.store||"US"===window.theme.store&&"USD"!==window.Shopify.currency.active)&&this.multibuyOfferPriceUpdate(),window.theme.glbeHelpers&&window.theme.glbeHelpers.convertUpsellTogglePrices(),document.dispatchEvent(new CustomEvent("side-cart:rendered"))}
11,methods:(_methods={multibuyOfferPriceUpdate:function(){var e=$(".cart-item__multibuy > p");$.each(e,function(e,t){var i=$(t).attr("data-multibuy-totalitems"),r=$(t).attr("data-multibuy-offerprice");r=r*Number(Shopify.currency.rate)*100;var n=slate.Currency.formatMoney(r,window.theme.moneyFormat),o=i+" for "+n;$(t).text(o)}),window.theme.glbeHelpers&&window.theme.glbeHelpers.convertMultibuyOfferPrices()},isFreeItem:function(e){if(!e||!e.properties||!Object.keys(e.properties).length)return!1;var t=["_cartoffer","_giftWithPurchase"];return t.some(function(t){return Object.keys(e.properties).some(function(e){return e===t})})},toggleGWPTab:function(e){if(this.gwpAutoCollapse=!1,this.giftWithPurchaseActive=e,this.giftWithPurchaseActive){var t=this.giftWithPurchaseProducts.slice(0,20).map(function(e,t){return{index:t,item_id:e.variants[0].sku,item_name:e.title.replace(/["']/g,""),item_brand:"Lovisa",item_category:e.type,item_list_id:"mini-cart-upsell",item_list_name:"Mini-Cart Upsell Feed",price:e.price/100,quantity:1}});window.theme.giftWithPurchaseProductsData={items:t,itemListId:"mini-cart-upsell",itemListName:"Mini-Cart Upsell Feed",itemListType:"Mini-Cart Upsell Feed"};var i=void 0,r=function(){var e=window.theme.giftWithPurchaseProductsData;if(e){var t=e.items,r=e.itemListId,n=e.itemListName,o=e.itemListType,a=[],s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.length&&(i&&clearTimeout(i),i=setTimeout(function(){var i=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),s=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),c=s.menu_navigation_state||{};window.pushEvent({event:"view_item_list",menu_navigation_state:c,ecommerce:Object.assign(i,{items:e,item_list_id:r,item_list_name:n,item_list_type:o,item_total_count:t.length,item_visible_count:window.theme.giftWithPurchaseProductsData.itemsVisible.length})},"ecommerce"),a=[]},1e3))},c=document.querySelectorAll(".side-cart__gwp-items .gwp-item");c.length&&c.forEach(function(i){var r=window.theme.isElementVisibleInViewport(i);i.setAttribute("data-visible-by-default",r),r&&a.push(i.getAttribute("data-sku"));var n=function(n,o){n.forEach(function(n){var c=i.getAttribute("data-visible-by-default")||!1;if(r=window.theme.isElementVisibleInViewport(i),n.intersectionRatio>0&&(o.unobserve(n.target),i.setAttribute("data-visible-in-viewport",r),r)){a.push(i.getAttribute("data-sku"));var u=t.filter(function(e){return a.includes(e.item_id)});e.itemsVisible=e.itemsVisible||[];var l=u.map(function(t){var i=e.itemsVisible.find(function(e){return e.item_id===t.item_id}),r=t;return r.visible_by_default=c,i||window.theme.giftWithPurchaseProductsData.itemsVisible.push(r),r});s(l)}})},o=new IntersectionObserver(n);o.observe(i)})}};r();var n=document.querySelectorAll(".side-cart__gwp-items .gwp-item");n.forEach(function(e){var i=e.dataset.sku,r=t.find(function(e){return e.item_id===i});if(r){var n=function(){var e=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),t=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),n=t.menu_navigation_state||{};window.pushEvent({event:"select_item",item_list_id:"mini-cart-upsell",item_list_name:"Mini-Cart Upsell Feed",item_list_type:"Mini-Cart Upsell Feed",menu_navigation_state:n,ecommerce:Object.assign(e,{impressions:[r]})},"ecommerce");var o=JSON.stringify({itemListId:"mini-cart-upsell",itemListName:"Mini-Cart Upsell Feed",itemListType:"Mini-Cart Upsell Feed",index:r.index,itemCategory:r.item_category}),a=JSON.parse(localStorage.getItem("ga4-itemListImpressions")||"{}");a[i]=r;try{localStorage.setItem("ga-select-item",o),localStorage.setItem("ga4-itemListImpressions",JSON.stringify(a))}catch(e){console.warn("Error setting ga-select-item or ga4-itemListImpressions local storage",e)}};e.removeEventListener("click",n),e.addEventListener("click",n)}})}},clearGwpStatusTimers:function(){this._gwpStatusTimer&&(clearInterval(this._gwpStatusTimer),this._gwpStatusTimer=null),this._gwpStatusTimeout&&(clearTimeout(this._gwpStatusTimeout),this._gwpStatusTimeout=null)},waitForGwpStatusAndRun:function(e){var t=this;return t.clearGwpStatusTimers(),new Promise(function(i){var r=function(){t.clearGwpStatusTimers(),i()},n=function(){t.giftWithPurchase=window.theme&&window.theme.giftW
11ithPurchase,t.giftWithPurchaseEnabled=window.theme&&window.theme.giftWithPurchase&&window.theme.giftWithPurchase.enabled||!1,t.giftWithPurchaseEnabled?Promise.resolve(t.gwpCheck(e)).catch(function(e){console.error("gwpCheck error:",e)}).finally(r):("loaded"===window.theme.gwp_status&&window.theme.giftWithPurchase&&window.theme.giftWithPurchase.enabled===!1&&t.gwpCleanUp(e),r())};return"loaded"===window.theme.gwp_status?void n():(t._gwpStatusTimer=setInterval(function(){"loaded"===window.theme.gwp_status&&n()},300),void(t._gwpStatusTimeout=setTimeout(function(){"loaded"===window.theme.gwp_status?n():r()},1e4)))})},checkForEligibleProduct:function(e,t){return e.some(function(e){var i=e.handle;return t.includes(i)})},gwpCheck:function(e){var t=this,i=(arguments.length>1&&void 0!==arguments[1]&&arguments[1],!(arguments.length>2&&void 0!==arguments[2])||arguments[2],this);i.toggleLoaderOverlay(!0);var r=e.items,n=e.attributes,o=this.giftWithPurchase,a=o.offers,s=o.heading,c=o.multiEnabled,u=o.multiQualificationEnabled,l=o.productsExcluded,d=a.map(function(e){return e.gwpBlockId}),p=r.filter(function(e){return e.properties&&e.properties._giftWithPurchase&&"true"===e.properties._giftWithPurchase&&d.includes(e.properties._gwpBlockId)}),m=function(e){return!(!l||!l.length)&&l.includes(e)},h=a.filter(function(e){if(p[0]){var t=p[0].properties._gwpBlockId,n=p.filter(function(t){return t===e.gwpBlockId});if(!c&&n.length>1)return!1;if(!u&&e.gwpBlockId!==t)return!1}var o=function(t){var n=e[t].thresholdType;if("amount"===n){var o=!e[t].collection||i.isCollectionMatched(e[t].collection,r),a=e[t].tieThresholdToCollection,s=r.reduce(function(r,n){return m(n.handle)||a&&!i.checkForEligibleProduct(e[t].collection,n)||Boolean(n.properties&&n.properties._giftWithPurchase)?r:r+n.line_price},0,0),u=e[t].threshold,d=e[t].maxThreshold;window.Shopify.currency.rate&&"1"!==window.Shopify.currency.rate&&(u=100*Math.ceil(u/100*window.Shopify.currency.rate),d&&(d=100*Math.ceil(d/100*window.Shopify.currency.rate)));var p=s>=u,h=!d||s<d,f=r.filter(function(t){return e.gwpProducts.includes(t.handle)&&t.properties&&t.properties._giftWithPurchase&&"true"===t.properties._giftWithPurchase}),g=p&&h&&o;return!(!g||0!==f.length&&!c)}var v=r.filter(function(e){return!e.properties||!e.properties._giftWithPurchase});e[t].collection&&(v=v.filter(function(r){return i.checkForEligibleProduct(e[t].collection,r)})),l&&l.length&&(v=v.filter(function(e){var t=e.handle;return!m(t)}));var y=v.reduce(function(e,t){return e+t.quantity},0),w=y>=e[t].threshold,_=!e[t].maxThreshold||y<e[t].maxThreshold,S=r.filter(function(t){return e.gwpProducts.includes(t.handle)&&t.properties&&t.properties._giftWithPurchase&&"true"===t.properties._giftWithPurchase}),b=w&&_&&v.length;return!(!b||0!==S.length&&!c)},a=o("rule1"),s=!e.enableRule2||o("rule2"),d=!e.enableRule3||o("rule3");return a&&s&&d}),f=[],g=r.filter(function(e){var t=e.properties&&e.properties._giftWithPurchase&&"true"===e.properties._giftWithPurchase;if(!t)return!1;var n=a.some(function(t){return t.gwpProducts.includes(e.handle)});if(!n)return!0;f.push(e.properties._gwpBlockId);var o=f.filter(function(t){return t===e.properties._gwpBlockId});if(!c&&o.length>1)return!0;if(!u&&e.properties._gwpBlockId!==f[0])return!0;var s=a.some(function(t){var n=function(n){var o=t[n].thresholdType;if("amount"===o){var a=t.gwpProducts.includes(e.handle),s=!t[n].collection||i.isCollectionMatched(t[n].collection,r);console.log("eligibleProductInCart",s);var c=t[n].tieThresholdToCollection;console.log("tieThresholdToCollection",c);var u=r.reduce(function(e,r){return m(r.handle)||c&&!i.checkForEligibleProduct(t[n].collection,r)||Boolean(r.properties&&r.properties._giftWithPurchase)?e:e+r.line_price},0);console.log("eligibleItemsTotal",u);var d=t[n].threshold,p=t[n].maxThreshold;window.Shopify.currency.rate&&"1"!==window.Shopify.currency.rate&&(d=100*Math.ceil(d/100*window.Shopify.currency.rate),p&&(p=100*Math.ceil(p/100*window.Shopify.currency.rate)));var h=u>=d,f=!p||u<p;console.log("totalAboveThreshold",h,"totalBelowMaxThreshold",f,"minThreshold",d,"maxThreshold",p);var g=a&&h&&f&&s;return console.log("isEligible",g),!!g}var v=t.gwpProducts.includes(e.handle),y=r.filter(function(e){return!e.properties||!e.properties._giftWithPurchase});t[n].collection&&(y=y.filter(function(e){return i.checkForEligibleProduct(t[n].collection,e)})),l&&l.length&&(y=y.filter(function(e){var t=e.handle;return!m(t)}));var w=y.reduce(function(e,t){return e+t.quantity},0),_=w>=t[n].threshold,S=!t[n].maxThreshold||w<t[n].maxThreshold,b=v&&_&&S&&y.length;return!!b},o=n("rule1"),a=!t.enableRule2||n("rule2"),s=!t.enableRule3||n("rule3");return o&&a&&s});return!s});c&&a.forEach(function(e){var t=r.filter(function(t){if(e.maxProducts&&!isNaN(e.maxProducts))return t.properties&&"true"===t.properties._giftWithPurchase&&t.properties._gwpBlockId===e.gwpBlockId&&e.gwpProducts.includes(t.handle)});if(t.length>e.maxProducts){var i=t.length-e.maxProducts,n=t.slice(0,i);
11n.forEach(function(e){var t=g.some(function(t){return t.id===e.id});t||g.push(e)})}}),console.log("offerProductsToRemove",g),g.length>0&&this.removeItems(g);var v=1===h.length?h[0].heading:s,y=[].concat(_toConsumableArray(new Set(h.map(function(e){return e.gwpProducts}).flat()))),w=[];h.forEach(function(e){e.gwpProducts.forEach(function(t){w.find(function(e){var i=e.gwp;return i===t})||w.push({gwpOfferId:e.gwpOfferId,gwpBlockId:e.gwpBlockId,autoAddGwp:e.autoAddGwp,gwpAutoCollapse:e.gwpAutoCollapse,gwpOfferName:e.gwpOfferName,gwp:t})})});var _=[],S=function(){var i=_asyncToGenerator(regeneratorRuntime.mark(function i(){var o,a,s,c,u,l,d;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:o=r.filter(function(e){var t=e.properties&&e.properties._giftWithPurchase&&"true"===e.properties._giftWithPurchase;return!!t}),a=!0,s=!1,c=void 0,i.prev=4,u=o[Symbol.iterator]();case 6:if(a=(l=u.next()).done){i.next=15;break}if(d=l.value,d.properties._gwpBlockId&&_.push(d.properties._gwpBlockId),window.sessionStorage.getItem("removedGWP:"+d.variant_id)&&window.sessionStorage.removeItem("removedGWP:"+d.variant_id),!n["Removed GWP "+d.variant_id]){i.next=12;break}return i.delegateYield(regeneratorRuntime.mark(function i(){var r,n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=Object.assign(e.attributes,_defineProperty({},"Removed GWP "+d.variant_id,null)),n=function(){return new Promise(function(e){$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{attributes:r},dataType:"JSON",success:function(){return e()}})})},t.next=4,n();case 4:case"end":return t.stop()}},i,t)})(),"t0",12);case 12:a=!0,i.next=6;break;case 15:i.next=21;break;case 17:i.prev=17,i.t1=i.catch(4),s=!0,c=i.t1;case 21:i.prev=21,i.prev=22,!a&&u.return&&u.return();case 24:if(i.prev=24,!s){i.next=27;break}throw c;case 27:return i.finish(24);case 28:return i.finish(21);case 29:case"end":return i.stop()}},i,t,[[4,17,21,29],[22,,24,28]])}));return function(){return i.apply(this,arguments)}}();S().then(function(){if(y.length>0){var e=y.map(function(e){return new Promise(function(t,i){var r=sessionStorage.getItem("__offer:"+e),n=w.find(function(t){var i=t.gwp;return i===e}),o=n.autoAddGwp,a=n.gwpBlockId,s=n.gwpAutoCollapse,c=n.gwpOfferName,u=n.gwpOfferId;if(r)return void t([JSON.parse(r),o,a,s,c,u]);var l=window.location.origin+"/products/"+e+".js",d={headers:{"Content-Type":"application/json"}};fetch(l,d).then(function(e){return e.ok?e.json():null}).then(function(i){i&&sessionStorage.setItem("__offer:"+e,JSON.stringify(i)),t([i,o,a,s,c,u])}).catch(function(){t([null,o,a,s,c,u])})})});Promise.all(e).then(function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(o){var a,s,c,u,l,d,p,m,h,f,g,y,w,S,b,k,C,I,O,P,E,A,L,q,T,x,M,N,j;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(a=o.map(function(e){return e[0]}),s=o.map(function(e){return e[1]}),c=o.map(function(e){return e[2]}),u=o.map(function(e){return e[3]}),l=o.map(function(e){return e[4]}),d=o.map(function(e){return e[5]}),p=[],m=[],h=[],f=[],g=[],y=[],a.forEach(function(e,t){e&&e.available&&(p.push(e),m.push(s[t]),h.push(c[t]),f.push(u[t]),g.push(l[t]),y.push(d[t]))}),w=r.filter(function(e){return e.properties&&e.properties._giftWithPurchase}),S=[],p=p.filter(function(e,t){var i=w.every(function(t){var i=e.variants.map(function(e){return e.id});return!i.includes(t.id)});return i||S.push(t),i}),S.length&&(b=function(e,t){return!S.includes(t)},m=m.filter(b),h=h.filter(b),f=f.filter(b),g=g.filter(b),y=y.filter(b)),k=!1,C=[],I=[],O=[],P=0;P<p.length;P++)E=p[P],A=m[P],L=h[P],q=f[P],T=g[P],x=y[P],E.properties=E.properties||{},E.properties._gwpBlockId=L,E.properties._gwpOfferId=x,E.properties._gwpAutoCollapse=q||!1,T&&T.length&&(E.properties._gwpOfferName=T),C.push({gwpItem:E,autoAddGwp:A,blockId:L}),I.push(E),M=n["Removed GWP "+E.variants[0].id]||window.sessionStorage.getItem("removedGWP:"+E.variants[0].id),M&&O.push(L);if(C=C.filter(function(e){var t=e.blockId;return!O.includes(t)||_.includes(t)}),!C.length){e.next=32;break}i.toggleLoaderOverlay(!0),N=regeneratorRuntime.mark(function e(i){var r,n,o,a,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=C[i],n=r.autoAddGwp,o=r.gwpItem,a=r.blockId,s=w.filter(function(e){return e.properties._gwpBlockId===a}),k||!n||s.length){e.next=6;break}return e.next=5,t.handleGWPAddToCartPromise(o);case 5:k=!0;case 6:case"end":return e.stop()}},e,t)}),j=0;case 27:if(!(j<C.length)){e.next=32;break}return e.delegateYield(N(j),"t0",29);case 29:j++,e.next=27;break;
11case 32:k?t.giftWithPurchaseProducts=[]:(t.giftWithPurchaseProducts=I,t.gwpAutoCollapse=!(!t.giftWithPurchaseProducts[0]||!t.giftWithPurchaseProducts[0].properties)&&t.giftWithPurchaseProducts[0].properties._gwpAutoCollapse,t.giftWithPurchaseHeading=v),i.toggleLoaderOverlay(!1);case 34:case"end":return e.stop()}},e,t)}));return function(t){return e.apply(this,arguments)}}())}else i.toggleLoaderOverlay(!1),t.giftWithPurchaseProducts=[]})},gwpCleanUp:function(e){var t=e.items,i=t.filter(function(e){return e.properties&&e.properties._giftWithPurchase});i&&i.length&&this.removeItems(i)},handleGWPAddToCart:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{resolve:null,reject:null};if(!e||0==e.available)return window.console.log("No item"),void(r.resolve&&r.resolve());var n=e.variants.find(function(e){return e.id===t})||e.variants.find(function(e){return 1==e.available})||e.variants[0];if(window.gwpAddError=window.gwpAddError||[],!n||!n.available||window.gwpAddError.includes(n.id))return void(r.resolve&&r.resolve());this.addItem({id:n.id,product_id:e.id,quantity:1,properties:{_giftWithPurchase:!0,_gwpBlockId:e.properties._gwpBlockId,_gwpOfferId:e.properties._gwpOfferId,_gwpOfferName:e.properties._gwpOfferName},title:e.title,url:e.url,image:e.featured_image,vendor:e.vendor,price:Number(n.price),compare_price:Number(n.compare_at_price),collections:e.collections?e.collections:[],sku:n.sku},0,"","",r);var o={event:"cartOffersAddToCart",productTitle:n.sku+" - "+e.title,value:e.price/100};i&&(o.type=i),window.pushEvent(o)},handleGWPAddToCartPromise:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new Promise(function(r,n){t.handleGWPAddToCart(e,i,null,{resolve:r,reject:function(t){window.gwpAddError=window.gwpAddError||[];var r=e.variants.find(function(e){return e.id===i})||e.variants.find(function(e){return 1==e.available})||e.variants[0];r&&window.gwpAddError.push(r.id),n(t)}})})},freeShippingCheck:function(){var e=this.getActiveCurrency();if(e){var t=Object.entries(window.theme.settings).filter(function(e){var t=_slicedToArray(e,2),i=t[0],r=t[1];return r&&(i.includes("free_shipping_currency_")||i.includes("free_shipping_amount_"))}),i=t.find(function(t){var i=_slicedToArray(t,2),r=(i[0],i[1]);return r===e});if(i){var r=i[0].replace("free_shipping_currency_",""),n="free_shipping_amount_"+r,o=t.find(function(e){var t=_slicedToArray(e,1),i=t[0];return i===n});o&&(this.isFreeShipping=!0,this.getFreeShippingMessage())}}},checkNoFreeShippingCountry:function(){var e=window.sessionStorage.getItem("country"),t=window.theme&&window.theme.settings&&window.theme.settings.hide_free_shipping_countries&&window.theme.settings.hide_free_shipping_countries.split(",");if(t&&t.length){var i=t.includes(e);this.isFreeShipping=!i}},getActiveCurrency:function(){var e=window.Shopify&&window.Shopify.currency&&window.Shopify.currency.active,t=window.Cookies.get("cart_currency"); 12return e||t||null},getFreeShippingAmount:function(){var e=this.getActiveCurrency();if(e){var t="EU"===window.theme.store?"free_shipping_currency_1":"free_shipping_currency_",i="EU"===window.theme.store?"free_shipping_amount_1":"free_shipping_amount_",r=Object.entries(window.theme.settings).filter(function(e){var r=_slicedToArray(e,2),n=r[0],o=r[1];return o&&(n.includes(t)||n.includes(i))}),n="EU"===window.theme.store?r.find(function(e){var t=_slicedToArray(e,2),i=(t[0],t[1]);return i}):r.find(function(t){var i=_slicedToArray(t,2),r=(i[0],i[1]);return r===e});if(n){var o=n[0].replace("free_shipping_currency_",""),a="free_shipping_amount_"+o,s=r.find(function(e){var t=_slicedToArray(e,1),i=t[0];return i===a});if(s)return s[1]}}},getUniqueOffer:function(e){function t(e){return e.includes(o)}var i=this,r=localStorage.getItem("multibuy"),n=Math.floor(100*Math.random()+1),o="",a=1,s=[],c="",u=!1;if(r){s=r.split(",");var l=s.filter(function(t){return t.includes(e)});l?l.forEach(function(e){if(a=parseInt(e.split(":")[1],10),a<i.offerItems){a++,o=e.split(":")[0],c=o+":"+a;var t=s.indexOf(e);s[t]=c,u=!0}}):(a=1,o=e+"-"+n,c=o+":"+a,s.push(c),u=!0)}else a=1,o=e+"-"+n,c=o+":"+a,s.push(c),u=!0;if(!u){var d=!0;for(a=1,s=r.split(",");d;){n=Math.floor(100*Math.random()+1),o=e+"-"+n,c=o+":"+a;var p=s.filter(t);0===p.length&&(d=!1,s.push(c))}}try{localStorage.setItem("multibuy",s.join(","))}catch(e){console.warn("Error setting multibuy local storage",e)}return o},handleUpsellAddToCart:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return void window.console.log("No item");var r=e.tags.find(function(e){return e.includes("offer:")}),n={};if(r){var o=r.split("-"),a=/([^\d-.]|)|/g,s=o[0].replace(a,""),c=o[o.length-1].replace(a,""),u=parseInt(s,10),l=c,d=u+"-"+l,p=this.getUniqueOffer(d);n._offer=p}var m=e.variants.find(function(e){return e.id===t})||e.variants[0];this.addItem({id:m.id,product_id:e.id,quantity:1,title:e.title,url:e.url,image:e.featured_image,vendor:e.vend
12or,price:Number(m.price),compare_price:Number(m.compare_at_price),collections:e.collections?e.collections:[],properties:n,sku:m.sku});var h={event:"cartUpsellsAddToCart",productTitle:m.sku+" - "+e.title,value:e.price/100};i&&(h.type=i),window.dataLayer.push(h)},getUpsellProducts:function(e){if(window.theme.upsells.enable){var t=this,i=e.items;if(null!==window.theme.upsells.defaultUpsellCollection)return void(window.theme.settings.enable_bopis||t.getDefaultUpsellCollectionProducts(e));if(!(i.length<=0)){var r=15;if("xgen"===window.theme.upsells.type)window.xgenCommon.recommend({ids:[window.xgen_vars.xgen_upsells_id]}).then(function(i){var n=i[window.xgen_vars.xgen_upsells_id],o=n.items;if(o.length){var a=o.map(function(e){return window.xgenCommon.unifyProduct(e)}),s=a.filter(function(e){return e.variants.some(function(e){return e.available})}),c=s.filter(function(t){return e.items.every(function(e){return e.product_id!==t.id})});t.upsellProducts=[].concat(_toConsumableArray(new Set(c.slice(0,r)))),t.isVisible&&t.upsellsActive&&t.trackCartUpsellsImpressions()}});else{var n=i.reduce(function(e,t){return e.final_price>t.final_price?e:t});if(!n)return;var o=n.product_id,a=window.location.origin+"/products/"+n.handle+".js";fetch(a).then(function(e){return e.json()}).then(function(i){var n=i.tags.filter(function(e){return e.includes("upsell:")}).map(function(e){return e.split(":")[1]}),a=n.map(function(e){return new Promise(function(t,i){var r=window.location.origin+"/products/"+e+".js",n={headers:{"Content-Type":"application/json"}};fetch(r,n).then(function(e){return e.ok?e.json():t()}).then(function(e){var i=Object.assign(e,{_type:"manual"});t(i)}).catch(function(e){i(e)})})});Promise.all(a).then(function(i){var a=i.filter(function(e){return void 0!==e}),s=new URL(""+window.location.origin+window.Shopify.routes.root+"recommendations/products.json");s.searchParams.set("product_id",o),s.searchParams.set("limit",10),fetch(s).then(function(e){return e.json()}).then(function(i){if(i.products){var o=i.products.map(function(e){return Object.assign(e,{_type:"api"})});r-=n.length;var s=a.concat(o).filter(function(t){return e.items.every(function(e){return e.product_id!==t.id})});t.upsellProducts=[].concat(_toConsumableArray(new Set(s.slice(0,r))))}}).catch(function(e){console.error(e)}),t.isVisible&&t.upsellsActive&&t.trackCartUpsellsImpressions()}).catch(function(e){console.error(e)})}).catch(function(e){console.error(e)})}}}},getDefaultUpsellCollectionProducts:function(e){var t=this,i=15;if("xgen"===window.theme.upsells.type)window.xgenCommon.recommend({ids:[window.xgen_vars.xgen_upsells_id]}).then(function(r){var n=r[window.xgen_vars.xgen_upsells_id],o=n.items;if(o.length){var a=o.map(function(e){return window.xgenCommon.unifyProduct(e)}),s=a.filter(function(e){return e.variants.some(function(e){return e.available})}),c=s.filter(function(t){return e.items.every(function(e){return e.product_id!==t.id})});t.upsellProducts=[].concat(_toConsumableArray(new Set(c.slice(0,i)))),t.isVisible&&t.upsellsActive&&t.trackCartUpsellsImpressions()}});else{var r=window.theme.upsells.defaultUpsellCollectionProductHandles,n=window.theme.upsells.defaultUpsellCollectionFirstProductId,o=r.map(function(e){return new Promise(function(t,i){var r=window.location.origin+"/products/"+e+".js",n={headers:{"Content-Type":"application/json"}};fetch(r,n).then(function(e){return e.ok?e.json():t()}).then(function(e){var i=Object.assign(e,{_type:"manual"});t(i)}).catch(function(e){i(e)})})});Promise.all(o).then(function(o){var a=o.filter(function(e){return void 0!==e}),s=new URL(""+window.location.origin+window.Shopify.routes.root+"recommendations/products.json");s.searchParams.set("product_id",n),s.searchParams.set("limit",10),fetch(s).then(function(e){return e.json()}).then(function(n){if(n.products){var o=n.products.map(function(e){return Object.assign(e,{_type:"api"})});i-=r.length;var s=a.concat(o).filter(function(t){return e.items.every(function(e){return e.product_id!==t.id})});t.upsellProducts=[].concat(_toConsumableArray(new Set(s.slice(0,i))))}}).catch(function(e){console.error(e)}),t.isVisible&&t.upsellsActive&&t.trackCartUpsellsImpressions()}).catch(function(e){console.error(e)})}},isProductOnlyInStore:function(e){var t=e.tags,i=t.filter(function(e){return"in-store"===e});return i.length>0},toggleUpsellsColumn:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.upsellsActive=null===e?!this.upsellsActive:e,this.upsellsActive?(document.querySelector(".side-cart__upsells-toggle").setAttribute("aria-expanded","true"),document.getElementById("cart-upsell-items").setAttribute("aria-hidden","false"),this.trackCartUpsellsImpressions()):(document.querySelector(".side-cart__upsells-toggle").setAttribute("aria-expanded","fal
12se"),document.getElementById("cart-upsell-items").setAttribute("aria-hidden","true"))},trackCartUpsellsImpressions:function(){var e=this.upsellProducts.slice(0,20).map(function(e,t){return{index:t,item_id:e.variants[0].sku,item_name:e.title.replace(/["']/g,""),item_brand:"Lovisa",item_category:e.type,item_list_id:"mini-cart-upsell",item_list_name:"Mini-Cart Upsell Feed",price:e.price/100,quantity:1}});window.theme.upsellProductsData={items:e,itemListId:"mini-cart-upsell",itemListName:"Mini-Cart Upsell Feed",itemListType:"Mini-Cart Upsell Feed"};var t=void 0,i=function(){var e=window.theme.upsellProductsData;if(e){var i=e.items,r=e.itemListId,n=e.itemListName,o=e.itemListType,a=[],s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.length&&(t&&clearTimeout(t),t=setTimeout(function(){var t=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),s=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),c=s.menu_navigation_state||{};window.pushEvent({event:"view_item_list",menu_navigation_state:c,ecommerce:Object.assign(t,{items:e,item_list_id:r,item_list_name:n,item_list_type:o,item_total_count:i.length,item_visible_count:window.theme.upsellProductsData.itemsVisible.length})},"ecommerce"),a=[]},1e3))},c=document.querySelectorAll(".side-cart__upsells-items .upsell-item");c.length&&c.forEach(function(t){var r=window.theme.isElementVisibleInViewport(t);t.setAttribute("data-visible-by-default",r),r&&a.push(t.getAttribute("data-sku"));var n=function(n,o){n.forEach(function(n){var c=t.getAttribute("data-visible-by-default")||!1;if(r=window.theme.isElementVisibleInViewport(t),n.intersectionRatio>0&&(o.unobserve(n.target),t.setAttribute("data-visible-in-viewport",r),r)){a.push(t.getAttribute("data-sku"));var u=i.filter(function(e){return a.includes(e.item_id)});e.itemsVisible=e.itemsVisible||[];var l=u.map(function(t){var i=e.itemsVisible.find(function(e){return e.item_id===t.item_id}),r=t;return r.visible_by_default=c,i||window.theme.upsellProductsData.itemsVisible.push(r),r});s(l)}})},o=new IntersectionObserver(n);o.observe(t)})}};i();var r=document.querySelectorAll(".side-cart__upsells-items .upsell-item");r.forEach(function(t){var i=t.dataset.sku,r=e.find(function(e){return e.item_id===i});if(r){var n=function(){var e=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),t=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),n=t.menu_navigation_state||{};window.pushEvent({event:"select_item",item_list_id:"mini-cart-upsell",item_list_name:"Mini-Cart Upsell Feed",item_list_type:"Mini-Cart Upsell Feed",menu_navigation_state:n,ecommerce:Object.assign(e,{impressions:[r]})},"ecommerce");var o=JSON.stringify({itemListId:"mini-cart-upsell",itemListName:"Mini-Cart Upsell Feed",itemListType:"Mini-Cart Upsell Feed",index:r.index,itemCategory:r.item_category}),a=JSON.parse(localStorage.getItem("ga4-itemListImpressions")||"{}");a[i]=r;try{localStorage.setItem("ga-select-item",o),localStorage.setItem("ga4-itemListImpressions",JSON.stringify(a))}catch(e){console.warn("Error setting ga-select-item or ga4-itemListImpressions local storage",e)}};t.removeEventListener("click",n),t.addEventListener("click",n)}})},handleAccordionClick:function(e){this.expandedAccordions=this.expandedAccordions.includes(e)?this.expandedAccordions.filter(function(t){return t!==e}):[].concat(_toConsumableArray(this.expandedAccordions),[e])},reloadCart:function(){for(var e=this.cart.items,t=e.length,i=0,r=0,n=0;n<t;n++)i+=Number(e[n].quantity),r+=e[n].quantity*e[n].price;this.cart.item_count=i,this.cart.total_price=r,clearTimeout(this.timeout),this.timeout=setTimeout(this.updateCart.bind(this),500)},updateCartItemsEvent:function(){var e=this;this.quantitySelectors.length>0&&(this.quantitySelectors.forEach(function(e){return e.destroy()}),this.quantitySelectors=[]),document.querySelectorAll("[data-component=QuantitySelector]").length>0&&document.querySelectorAll("[data-component=QuantitySelector]").forEach(function(t){e.quantitySelectors.push(new theme[t.dataset.component](t))}),theme.currencyConverter===!0&&window.Currency.convertAll&&"true"===theme.currencyConverter&&window.Currency.convertAll(theme.currency,window.Currency.currentCurrency)},toggleDrawer:function(e){if(e&&e.preventDefault(),this.isVisible)this.closeDrawer(e);else{if("cart"===theme.template.template)return;this.openDrawer(e),this.viewCartEvent()}},focusToDialog:function(e){var t=this.$el.querySelector(".side-cart__close"),i=this.$el.querySelector("[name=checkout]");9===e.keyCode&&(e.shiftKey&&document.activeElement===t?(e.preventDefault(),i.focus()):e.shiftKey||document.activeElement!==i||(e.preventDefault(),t.focus()))},openDrawer:function(e){if("cart"===theme.template.template||0===window.location.pathname.indexOf("/cart"))return window.theme&&window.theme.cartPage&&("function"==typeof window.theme.cartPage.updateCartItemsEvent&&window.theme.cartPage.updateCartItemsEvent(),"function"==typeof window.theme.cartPage.refreshCart&&window.theme.cartPage.refreshCart()),void setTimeout(function(){window.scrollTo({top:0,behavior:"smooth"})},500);window.theme.lastActiveElement=document.activeElement,e&&e.preventDefault();var t=document.querySelectorAll("[data-toggle-cart]");t.forEach(function(e){return e.getAttribute("aria-expanded")&&e.setAttribute("aria-expanded","true")}),document.body.classList.add("cart-is-visible"),this.isVisible=!0,this.$el.setAttribute("aria-hidden","false"),this.$el.querySelector(".side-cart__close")&&this.$el.querySelector(".side-cart__close").focus(),document.addEventListener("keydown",this.focusToDialog.bind(this),!0),$(document).on("keydown:escape",this.closeDrawer.bind(this)),this.hiddens=[];for(var i,r=0;i=document.body.children[r];r++)if(i!=document.querySelector(".side-cart")){var n={};i.hasAttribute("aria-hidden")&&(n.ariaHidden=i.getAttribute("aria-hidden")),i.setAttribute("aria-hidden","true"),n.el=i,this.hiddens.push(n)}this.upsellsActive&&this.trackCartUpsellsImpressions()},viewCartEvent:function(){var e=0,t=[],i=this.cart.items.map(function(i,r){return e+=Number(i.price)/100,t.push(i.product_id),{item_id:i.sku,item_name:i.title,index:r+1,item_brand:"Lovisa",item_category:i.type,price:Number(i.price)/100,quantity:i.quantity}}),r=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),n=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),o=n.menu_navigation_state||{};window.pushEvent({event:"view_cart",menu_navigation_state:o,ecommerce:Object.assign(r,{items:i,value:Number(e.toFixed(2))})},"ecommerce");var a=window.rtbhEvents||[];a.push({eventType:"basketstatus",offerIds:t},{eventType:"uid",id:"unknown"})},closeDrawer:function(e){e&&e.preventDefault();var t=document.querySelectorAll("[data-toggle-cart]");if(t.forEach(function(e){return e.getAttribute("aria-expanded")&&e.setAttribute("aria-expanded","fal
12se")}),document.body.classList.remove("cart-is-visible"),this.isVisible=!1,this.errorMessage="",this.$el&&this.$el.setAttribute&&this.$el.setAttribute("aria-hidden","true"),this.destroyUpsellSlider(),document.removeEventListener("keydown",this.focusToDialog.bind(this),!0),$(document).off("keydown:escape",this.closeDrawer.bind(this)),window.theme.lastActiveElement&&(window.theme.lastActiveElement.focus(),window.theme.lastActiveElement=null),this.hiddens)for(var i,r=0;i=this.hiddens[r];r++)i.ariaHidden?i.el.setAttribute("aria-hidden",i.ariaHidden):i.el.removeAttribute("aria-hidden")},updateCart:function(){var e=this,t=this,i=this.cart.items.slice(0),r=i.length,n={},o=0,a=[],s=[];i.forEach(function(e){s.push(e.variant_id)});var c=[],u=[].concat(_toConsumableArray(new Set(s))),l=!1,d=0;if(u.forEach(function(t){for(var a=0;a<r;a++)parseInt(t,10)===i[a].variant_id&&(o+=i[a].quantity,0===i[a].quantity&&(l=!0,d=a));c.push(o),n[t]=o,l&&e.cart.items.splice(d,1),o=0,l=!1,d=0}),i.forEach(function(e){a.push(e.quantity)}),!this.cache){this.cache=n;var p=localStorage.getItem("multibuy"),m=[],h=0;if(p){var f=p.split(",");f.forEach(function(t){e.cart.items.forEach(function(e){e.properties&&e.properties._offer&&e.properties._offer===t.split(":")[0]&&(h+=e.quantity)}),h>0&&m.push(t.split(":")[0]+":"+h),h=0});try{localStorage.setItem("multibuy",m.join(","))}catch(e){console.warn("Error setting multibuy local storage",e)}}t.multibuyCheck(this.cart),t.cartOfferCheck()}JSON.stringify(n)!==JSON.stringify(this.cache)&&(this.cache=n,$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:a},dataType:"JSON",success:function(e){t.errorMessage="";var i=localStorage.getItem("multibuy"),r=[],n=0;if(i){var o=i.split(",");o.forEach(function(t){e.items.forEach(function(e){e.properties&&e.properties._offer&&e.properties._offer===t.split(":")[0]&&(n+=e.quantity)}),n>0&&r.push(t.split(":")[0]+":"+n),n=0});try{localStorage.setItem("multibuy",r.join(","))}catch(e){console.warn("Error setting multibuy local storage",e)}}t.multibuyCheck(e),t.cartOfferCheck()},complete:function(){e.onCartUpdated()},error:function(e){window.console.error("Error updating",e),t.refreshCart()}}))},onCartUpdated:function(){var e=document.querySelectorAll(".header__cart-count"),t=document.querySelector(".bag-icon-empty"),i=document.querySelector(".bag-icon-full");if(this.cart.item_count>0){if(e.length>0)for(var r=0;r<e.length;r++)e[r].classList.remove("hide");t&&t.classList.add("hide"),i&&i.classList.remove("hide")}else{if(e.length>0)for(var n=0;n<e.length;n++)e[n].classList.contains("always-show")||e[n].classList.add("hide");t&&t.classList.remove("hide"),i&&i.classList.add("hide"),this.closeDrawer()}if(e.length>0)for(var o=0;o<e.length;o++)e[o].innerHTML=this.cart.item_count;this.toggleLoaderOverlay(!1);var a=document.querySelectorAll('.quantity-selector[data-component="QuantitySelector"]');Array.from(a).forEach(function(e){e.dispatchEvent(new CustomEvent("updateQuantity",{bubbles:!0,cancelable:!1}))})},addItems:function(e){function t(){var i=r.pop();n.cart.items?n.cart.items.unshift(i):n.cart.items=[i],$.ajax({url:window.Shopify.routes.root+"cart/add.js",type:"POST",data:{id:i.id,quantity:i.quantity,properties:i.properties},dataType:"JSON",success:function(o){var a=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),s=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),c=s.menu_navigation_state||{};window.pushEvent({event:"add_to_cart",menu_navigation_state:c,ecommerce:Object.assign(a,{value:Number(i.price)/100,items:[{item_id:i.sku,item_name:i.title,index:e.findIndex(function(e){return e.sku===i.sku}),item_brand:"Lovisa",item_category:i.type,price:Number(i.price)/100,quantity:i.quantity}]})},"ecommerce"),window._learnq=window._learnq||[];var u="string"==typeof i.image?i.image:i.image&&"string"==typeof i.image.src?i.image.src:"",l=u?"https:"+u.replace(/(\.[^.]*)$/,"_grande$1"):"",d={Name:i.title,ProductID:i.product_id?i.product_id:"",Categories:i.collections?i.collections:[],ImageURL:l,URL:""+window.theme.shopSecureUrl+(i.url?i.url.split("?")[0]:""),Brand:i.vendor?i.vendor:"",Price
12:slate.Currency.formatMoney(i.price),$value:parseFloat(slate.Currency.formatMoney(i.price,"{{amount}}")),CompareAtPrice:i.compare_price?slate.Currency.formatMoney(i.compare_price):""};window._learnq.push(["track","Added to Cart",d]),window.theme.checkPageReload(),r.length?t():n.refreshCart()},error:function(e){return console.error("Error updating cart: ",e)}})}var i=this,r=[];e.forEach(function(e){var t=!1;void 0!==e.properties&&e.properties._offer&&(t=!0);var n=-1;if(n=t?i.cart.items.findIndex(function(t){return t.id===e.id&&t.properties._offer===e.properties._offer}):i.cart.items.findIndex(function(t){return t.id===e.id}),n>-1)if(t){if(i.cart.items[n].properties&&i.cart.items[n].properties._offer===e.properties._offer&&i.cart.items[n].id===e.id&&i.cart.items[n].quantity+e.quantity>e.max)return void(i.errorMessage="There is no more stock for that item.")}else if(i.cart.items[n].quantity+e.quantity>e.max)return void(i.errorMessage="There is no more stock available for that item");return e.quantity>e.max?void(i.errorMessage="There is no more stock for that item."):(i.errorMessage="",void r.push(e))});var n=this;this.toggleLoaderOverlay(!0),r.length&&t()},addItem:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{resolve:null,reject:null},o=!1,a=!1;void 0!==e.properties&&e.properties._offer&&(o=!0),void 0!==e.properties&&e.properties._greeting&&e.properties._receiving_email&&(a=!0);for(var s=0,c=this.cart.items.length;s<c;s++)if(o){if(this.cart.items[s].properties&&this.cart.items[s].properties._offer===e.properties._offer&&this.cart.items[s].id===e.id&&this.cart.items[s].quantity+e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1)}else if(a){if(this.cart.items[s].properties&&this.cart.items[s].properties._greeting===e.properties._greeting&&this.cart.items[s].properties._receiving_email===e.properties._receiving_email&&this.cart.items[s].id===e.id&&this.cart.items[s].quantity+e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1)}else if(this.cart.items[s].id===e.id&&this.cart.items[s].quantity+e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1);if(e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1);this.toggleLoaderOverlay(!0),this.cart.items?this.cart.items.unshift(e):this.cart.items=[e],this.errorMessage="";var u=this;$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/add.js",data:{id:e.id,quantity:e.quantity,properties:e.properties},dataType:"JSON",error:function(e){if(console.error("Error updating cart:",e),n.reject)return n.reject("Error updating cart")},complete:function(o){u.updateCartItemsEvent(),u.refreshCart();var a=void 0;if(localStorage.getItem("ga-select-item")){var s=JSON.parse(localStorage.getItem("ga-select-item"));i=s.itemListId,r=s.itemListName,t=s.index,a=s.itemCategory}var c={item_id:e.sku,item_name:e.title,index:t,item_brand:"Lovisa",item_category:e.type||a,price:Number(e.price)/100,quantity:e.quantity};i&&(c.item_list_id=i),r&&(c.item_list_name=r);var l=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),d=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),p=d.menu_navigation_state||{};window.pushEvent({event:"add_to_cart",menu_navigation_state:p,ecommerce:Object.assign(l,{value:Number(e.price)/100,items:[c]})},"ecommerce");var m=JSON.parse(localStorage.getItem("ga4-itemListImpressions")||"{}");m[e.sku]=c;try{localStorage.setItem("ga4-itemListImpressions",JSON.stringify(m))}catch(e){console.warn("Error setting ga4-itemListImpressions local storage",e)}window.theme.checkPageReload(),window._learnq=window._learnq||[];var h=o&&o.responseJSON?o.responseJSON:{},f=h.image||e.image&&e.image.src||e.image&&e.image.url||e.image||"";"string"!=typeof f&&(f="");var g="";f&&(g=f.replace(/(\.[^.]*)$/,"_grande$1"),0===g.indexOf("//")?g="https:"+g:0!==g.indexOf("http")&&(g="https://"+g.replace(/^\/?/,"")));var v={Name:h.title||e.title,ProductID:h.product_id||e.product_id||"",Categories:e.collections?e.collections:[],ImageURL:g,URL:""+window.theme.shopSecureUrl+e.url.split("?")[0],Brand:h.vendor||e.vendor||"",Price:slate.Currency.formatMoney(e.price),$value:parseFloat(slate.Currency.formatMoney(e.price,"{{amount}}")),CompareAtPrice:e.compare_price?slate.Currency.formatMoney(e.compare_price):""};window.lovisaKlaviyoTrack?window.lovisaKlaviyoTrack(["track","Added to Cart",v]):(window._learnq=window._learnq||[],window._learnq.push(["track","Added to Cart",v]));var y=window.rtbhEvents||[];
12if(y.push({eventType:"basketadd",offerId:e.product_id?e.product_id:""},{eventType:"uid",id:"unknown"}),n.resolve)return n.resolve(1)}})},addItemFrmMybag:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{resolve:null,reject:null},o=!1,a=!1;void 0!==e.properties&&e.properties._offer&&(o=!0),void 0!==e.properties&&e.properties._greeting&&e.properties._receiving_email&&(a=!0);for(var s=0,c=this.cart.items.length;s<c;s++)if(o){if(this.cart.items[s].properties&&this.cart.items[s].properties._offer===e.properties._offer&&this.cart.items[s].id===e.id&&this.cart.items[s].quantity+e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1)}else if(a){if(this.cart.items[s].properties&&this.cart.items[s].properties._greeting===e.properties._greeting&&this.cart.items[s].properties._receiving_email===e.properties._receiving_email&&this.cart.items[s].id===e.id&&this.cart.items[s].quantity+e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1)}else if(this.cart.items[s].id===e.id&&this.cart.items[s].quantity+e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1);if(e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1);this.toggleLoaderOverlay(!0),this.cart.items?this.cart.items.unshift(e):this.cart.items=[e],this.errorMessage="";var u=this;$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/add.js",data:{id:e.id,quantity:e.quantity,properties:e.properties},dataType:"JSON",error:function(e){if(console.error("Error updating cart:",e),n.reject)return n.reject("Error updating cart")},complete:function(o){u.updateCartItemsEvent(),u.refreshCart();var a=void 0;if(localStorage.getItem("ga-select-item")){var s=JSON.parse(localStorage.getItem("ga-select-item"));i=s.itemListId,r=s.itemListName,t=s.index,a=s.itemCategory}var c={item_id:e.sku,item_name:e.title,index:t,item_brand:"Lovisa",item_category:e.type||a,price:Number(e.price)/100,quantity:e.quantity};i&&(c.item_list_id=i),r&&(c.item_list_name=r);var l=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),d=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),p=d.menu_navigation_state||{};window.pushEvent({event:"add_to_cart",menu_navigation_state:p,ecommerce:Object.assign(l,{item_list_type:"Bag Product Multi-buy uUpsell Carousel",item_total_count:16,item_visible_count:4,value:Number(e.price)/100,items:[c]})},"ecommerce");var m=JSON.parse(localStorage.getItem("ga4-itemListImpressions")||"{}");m[e.sku]=c;try{localStorage.setItem("ga4-itemListImpressions",JSON.stringify(m))}catch(e){console.warn("Error setting ga4-itemListImpressions local storage",e)}window.theme.checkPageReload(),window._learnq=window._learnq||[];var h=o&&o.responseJSON?o.responseJSON:{},f=h.image||e.image&&e.image.src||e.image&&e.image.url||e.image||"";"string"!=typeof f&&(f="");var g="";f&&(g=f.replace(/(\.[^.]*)$/,"_grande$1"),0===g.indexOf("//")?g="https:"+g:0!==g.indexOf("http")&&(g="https://"+g.replace(/^\/?/,"")));var v={Name:h.title||e.title,ProductID:h.product_id||e.product_id||"",Categories:e.collections?e.collections:[],ImageURL:g,URL:""+window.theme.shopSecureUrl+e.url.split("?")[0],Brand:h.vendor||e.vendor||"",Price:slate.Currency.formatMoney(e.price),$value:parseFloat(slate.Currency.formatMoney(e.price,"{{amount}}")),CompareAtPrice:e.compare_price?slate.Currency.formatMoney(e.compare_price):""};if(window.lovisaKlaviyoTrack?window.lovisaKlaviyoTrack(["track","Added to Cart",v]):(window._learnq=window._learnq||[],window._learnq.push(["track","Added to Cart",v])),(window.rtbhEvents||[]).push({eventType:"basketadd",offerId:e.product_id?e.product_id:""},{eventType:"uid",id:"unknown"}),n.resolve)return n.resolve(1)}})},removeItem:function(e){var t=this;$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/change.js",data:{id:e.id,quantity:0},dataType:"JSON",error:function(e){console.error("Error updating cart:",e)},complete:function(){var i=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),r=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),n=r.menu_navigation_state||{};window.pushEvent({event:"remove_from_cart",menu_navigation_state:n,ecommerce:Object.assign(i,{value:Number(e.price)/100,items:[{item_id:e.sku,item_name:e.title,index:"1",item_brand:"Lovisa",item_category:e.type,price:Number(e.price)/100,quantity:e.quantity}]})},"ecommerce"),t.updateCartItemsEvent(),t.refreshCart()}})},removeItems:function(e){if(e.length){var t=e.reduce(function(e,t){var i=Object.assign(e,_defineProperty({},t.key,0));return i},{}),i=this;$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:t},dataType:"JSON",error:function(e){console.error("Error updating cart:",e)},complete:function(){var t=0,r=e.map(function(e,i){return t+=Number(e.price)/100,{item_id:e.sku,item_name:e.title,index:i+1,item_brand:"Lovisa",item_category:e.type,price:Number(e.price)/100,quantity:e.quantity}}),n=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),o=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),a=o.menu_navigation_state||{};window.pushEvent({event:"remove_from_cart",menu_navigation_state:a,ecommerce:Object.assign(n,{value:t,items:r})},"ecommerce"),i.updateCartItemsEvent(),i.refreshCart()}})}},removeCartItem:function(e){this.updateCartStatus(e.title+" removed from cart");for(var t=this,i=[],r=0,n=0;n<this.cart.items.length;n++)e.properties&&e.properties._offer?this.cart.items[n].properties&&e.properties._offer===this.cart.items[n].properties._offer&&e.key===this.cart.items[n].key?i.push(0):(i.push(this.cart.items[n].quantity),r+=this.cart.items[n].quantity):e.key===this.cart.items[n].key?i.push(0):(i.push(this.cart.items[n].quantity),r+=this.cart.items[n].quantity);this.toggleLoaderOverlay(!0),$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:i},dataType:"JSON",success:function(n){var o=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),a=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),s=a.menu_navigation_state||{};if(window.pushEvent({event:"remove_from_cart",menu_navigation_state:s,ecommerce:Object.assign(o,{value:Number(e.price)/100,items:[{item_id:e.sku,item_name:e.title,index:"1",item_brand:"Lovisa",item_category:e.type,price:Number(e.price)/100,quantity:e.quantity}]})},"ecommerce"),e.properties._cartoffer){window.sessionStorage.setItem("removedOffer",Date.now());var c=Object.assign(n.attributes,{"Removed Cart Offer":!0});$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{attributes:c},dataType:"JSON"})}if(e.properties&&e.properties._giftWithPurchase){window.sessionStorage.setItem("removedGWP:"+e.id,"true");var u=Object.assign(n.attributes,_defineProperty({},"Removed GWP "+e.id,!0));$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{attributes:u},dataType:"JSON"})}n.item_count>r?$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:i},dataType:"JSON",success:function(){t.refreshCart()}}):t.refreshCart()}})},refreshCart:function(){var e=this,t=new Date;$.ajax({method:"GET",url:window.Shopify.routes.root+"cart.js?"+t.getTime(),dataType:"JSON",success:function(t){e.multibuyCheck(t),e.giftW
12ithPurchaseEnabled&&e.gwpCheck(t),window.theme.settings.enable_bopis||e.getUpsellProducts(t),e.cartOfferCheck(),e.onCartUpdated(),e.viewCartEvent()}})},cartOfferCheck:function(){var e=this,t=Number(100*theme.settings.auto_gift_threshold),i=Math.round(t-this.cart.total_price)/100,r=this.cart.items.find(function(e){return e.properties&&e.properties._cartoffer}),n=window.sessionStorage.getItem("removedOffer");if(n&&i>0&&(window.sessionStorage.removeItem("removedOffer"),e.cart.attributes["Removed Cart Offer"])){var o=Object.assign({},e.cart.attributes,{"Removed Cart Offer":null});$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{attributes:o},dataType:"JSON"})}return theme.settings.auto_gift_enable?(r&&i>0?e.removeItem(r):!r&&i<=0&&!n&&$.getJSON("/products/"+theme.settings.auto_gift_product+".js",function(t){t.available?e.addItem({id:t.variants[0].id,product_id:t.id,quantity:1,price:0,title:t.title,url:t.url,vendor:t.vendor,image:t.featured_image,properties:{_cartoffer:!0},min:1,max:1,sku:t.variants[0].sku}):console.error("Cart error: The offer item",t.title,"is unavailable.")}),void(this.difference=i)):void(r&&e.removeItem(r))},destroyUpsellSlider:function(){var e=document.querySelector(".side-cart__upsell-container");e&&$(".side-cart__upsell").hasClass("slick-initialized")&&$(".side-cart__upsell").slick("unslick")},closeUpsell:function(){var e=document.querySelector(".side-cart__upsell-container"),t=document.querySelector(".side-cart__upsell-toggler");e&&e.classList.contains("side-cart__upsell--active")&&(e.classList.remove("side-cart__upsell--active"),t.classList.add("upsell-toggler--closed"))},itemImage:function(e){var t=theme.assetUrl+"placeholder-portrait.svg";return e&&(t=e.src?e.src:e), 13slate.Image.getSizedImageUrl(t,"120x")},formatMoney:function(e){return slate.Currency.formatMoney(e,theme.moneyFormat)},productImageSrc:function(e){return e.featured_image?slate.Image.getSizedImageUrl(e.featured_image,"600x750_crop_center"):theme.assetUrl+"placeholder-portrait.svg"},productImageSrcset:function(e){if(!e.featured_image)return"placeholder-portrait.svg";var t=5/4,i=theme.settings.grid_small,r=i+"x"+Math.floor(i*t),n=slate.Image.getSizedImageUrl(e.featured_image,r+"_crop_center"),o=theme.settings.grid_medium,a=o+"x"+Math.floor(o*t),s=slate.Image.getSizedImageUrl(e.featured_image,a+"_crop_center"),c=theme.settings.grid_large,u=c+"x"+Math.floor(c*t),l=slate.Image.getSizedImageUrl(e.featured_image,u+"_crop_center");return n+" "+i+"w, "+s+" "+o+"w, "+l+" "+c+"w"},buttonText:function(e){return e?theme.strings.addToCart:theme.strings.soldOut},multibuyCheck:function(e){try{this.checkMultibuyLocalStorage(e)}catch(e){console.log("Error checking multibuy local storage",e)}var t=localStorage.getItem("multibuy"),i=[],r=[];if(t){var n=e.items.filter(function(e){return e.properties&&void 0!==e.properties._offer}),o=t.split(",");o.forEach(function(t){var o=t.split(":")[0],a=parseInt(t.split(":")[1],10),s=parseInt(o.split("-")[0],10),c=parseInt(o.split("-")[1],10);if(a===s){var u=n.filter(function(e){return e.properties._offer===o});u.forEach(function(t){var i=0;e&&e.items.forEach(function(e){i++,e.properties&&e.properties._offer&&e.properties._offer===t.properties._offer&&e.id===t.id&&(t.position=i)})});var l={totalItems:s,offerPrice:c,items:u};i.push(l)}else r.push(t)})}i.length>0&&e.items.forEach(function(e){var t=!1;e.showProduct=!0,i.forEach(function(i){t=i.items.findIndex(function(t){return t.id===e.id})}),t&&(e.showProduct=!1)});var a=this;this.cart=e,this.multibuy=i,this.totalPrice=e.total_price,this.totalDiscount=e.total_discount,this.getFreeShippingMessage(),r.length>1?setTimeout(function(){a.checkNotCompletedOffers(r)},500):this.toggleLoaderOverlay(!1),setTimeout(function(){var e=".cart-item__multibuy > p";console.log("DSP-1286::multibuyOfferTitleElements",e),theme.CurrencySwitcher.switchCurrency(e)},1e3)},checkNotCompletedOffers:function(e){var t=[];e.forEach(function(i){var r=!1,n=i.split(":")[0],o=parseInt(n.split("-")[0],10),a=parseInt(n.split("-")[1],10);if(t.length>0)for(var s=0;s<t.length;
13s++)t[s].forEach(function(e){e.totalItems===o&&e.offerPrice===a&&(r=!0)});if(!r){var c=e.filter(function(e){var t=e.split(":")[0],i=parseInt(t.split("-")[0],10),r=parseInt(t.split("-")[1],10);if(o===i&&a===r)return e});if(c.length>0){var u=[];c.forEach(function(e){var t=e.split(":")[0],i=parseInt(e.split(":")[1],10),r=parseInt(t.split("-")[0],10),n=parseInt(t.split("-")[1],10);u.push({property:e,offer:t,totalItems:r,offerPrice:n,addedItems:i})}),t.push(u)}}});for(var i=this,r=function(e){for(var r=t[e].sort(function(e,t){return parseInt(e.addedItems,10)<parseInt(t.addedItems,10)}),n=r[0].offer,o=parseInt(r[0].totalItems,10)-parseInt(r[0].addedItems,10),a=function(e){e>0&&i.cart.items.length>0&&!function(){var t=i.cart.items.filter(function(t){return r[e].offer===t.properties._offer});if(t)for(var a=function(e){var r=0,a=0;i.cart.items.forEach(function(i){r++,i.variant_id===t[e].variant_id&&i.properties._offer===t[e].properties._offer&&(a=r)}),o>0&&o>=t[e].quantity?$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/change.js",data:{line:a,quantity:t[e].quantity,properties:{_offer:n}},dataType:"JSON",success:function(){o-=t[e].quantity,i.refreshCart()}}):o>0&&o<t[e].quantity&&$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/change.js",data:{line:a,quantity:0},dataType:"JSON",success:function(){},complete:function(){setTimeout(function(){$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/add.js",data:{id:t[e].variant_id,quantity:o,properties:{_offer:n}},dataType:"JSON",success:function(){},complete:function(){var r=t[e].quantity-o;setTimeout(function(){$.ajax({type:"POST",url:window.Shopify.routes.root+"/cart/add.js",data:{id:t[e].variant_id,quantity:r,properties:{_offer:t[e].properties._offer}},dataType:"JSON",success:function(){},complete:function(){o-=t[e].quantity,i.refreshCart()}})},500)}})},500)}})},s=0;s<t.length;s++)a(s)}()},s=0;s<r.length;s++)a(s)},n=0;n<t.length;n++)r(n)},showProduct:function e(t,i){if(!i)return!0;var e=!0,r=!1;return this.multibuy.length>0&&(this.multibuy.forEach(function(e){e.items.forEach(function(e){e.id===t&&i._offer===e.properties._offer&&(r=!0)})}),r&&(e=!1)),e},removeMultibuyItem:function(e){var t=[],i=void 0;this.cart.items.forEach(function(r){var n=e.findIndex(function(e){return e.id===r.id});return n>-1&&r.properties&&r.properties._offer&&e[n].properties._offer&&r.properties._offer===e[n].properties._offer?(i=r.properties._offer,void t.push(0)):void t.push(r.quantity)});var r=localStorage.getItem("multibuy"),n=r.split(","),o=[];if(n.forEach(function(e){e.includes(i)||o.push(e)}),o.length>0)try{localStorage.setItem("multibuy",o.join(","))}catch(e){console.warn("Error setting multibuy local storage",e)}else localStorage.removeItem("multibuy");var a=this;$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:t},dataType:"JSON",success:function(){a.refreshCart()},error:function(e){return console.error(e)}})},checkMultibuyLocalStorage:function(e){var t=this,i=localStorage.getItem("multibuy"),r=[],n=0;if(i){var o=i.split(",");o.forEach(function(i){var o=i.split(":")[0].split("-")[0]+"-"+i.split(":")[0].split("-")[1],a=parseInt(i.split(":")[0].split("-")[0],10);if(e.items.forEach(function(e){e.properties&&e.properties._offer&&e.properties._offer===i.split(":")[0]&&(n+=e.quantity)}),n>0&&n<=a)r.push(i.split(":")[0]+":"+n);else if(n>0&&n>a){r.push(i.split(":")[0]+":"+a);for(var s=n-a;s>0;)if(s>a){var c=t.getUniqueOffer(o,a);r.push(c+":"+a),s-=a}else{var u=t.getUniqueOffer(o,s);r.push(u+":"+s),s=0}}n=0});try{localStorage.setItem("multibuy",r.join(","))}catch(e){console.warn("Error setting multibuy local storage",e)}}},getFreeShippingMessage:function(){var e=theme.strings.freeShippingDefault.split("{amount}"),t=theme.strings.freeShippingLeft.split("{amount}"),i=theme.strings.freeShippingUnlocked,r=this.getFreeShippingAmount();if("EU"===window.theme.store&&(r*=Number(Shopify.currency.rate)),0===this.totalPrice||null===this.totalPrice?(this.freeShippingText=e[0]+" "+slate.Currency.formatMoney(r,window.theme.moneyFormat)+e[1],this.progressBarStatus=0,this.shippingPrice=this.formatMoney(theme.settings.cart_shipping_price)):this.totalPrice>0&&this.totalPrice<r?(this.freeShippingText=t[0]+" "+slate.Currency.formatMoney(r-this.totalPrice,window.theme.moneyFormat)+" "+t[1],this.progressBarStatus=this.totalPrice/r*100,this.shippingPrice=this.formatMoney(theme.settings.cart_shipping_price)):(this.freeShippingText=i,this.progressBarStatus=100,this.shippingPrice=this.formatMoney("0")),document.getElementById("free-shipping-text").innerHTML=theme.sideCart.freeShippingText,jQuery("#cart-popup").length>0){var n=theme.sideCart.progressBarStatus+"%";jQuery(".progress-fill").css("width",n),"100%"==n?(jQuery(".progress-icon").addClass("full"),jQuery(".progress-icon").css("left","inherit"),jQuery(".icon-lock").hide(),jQuery(".icon-unlock").show()):(jQuery(".progress-icon").css("left",n),jQuery(".progress-icon").removeClass("full"),jQuery(".icon-lock").show(),jQuery(".icon-unlock").hide()),document.getElementById("cart-count").innerText=this.cart.item_count}},updateItemQuantity:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=this,n=!0,o=0,a=0,s=parseInt(t.target.value,10);if(e.quantity!==s){var c=e.quantity>s?"decreased":"increased";this.updateCartStatus(e.title+" quantity "+c+" to "+s);var u=Math.abs(e.quantity-s),l="Add",d="add_to_cart";e.quantity>s&&(l="Remove",d="remove_from_cart");var p=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),m=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),h=m.menu_navigation_state||{};window.pushEvent({event:d,menu_navigation_state:h,ecommerce:Object.assign(p,{value:Number(e.price)/100*u,items:[{item_id:e.sku,item_name:e.title,index:i,item_brand:"Lovisa",item_category:e.type,price:Number(e.price)/100,quantity:u}]})},"ecommerce");var f=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),g=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),v=g.menu_navigation_state||{};if(window.pushEvent({event:"cart_quantity_change",menu_navigation_state:v,ecommerce:f,interaction_type:l,cart_quantity_state:{count_initial:"1",count_start:""+e.quantity,count_change:""+u,count_final:""+s}},"cart_quantity_state"),e.properties&&e.properties._offer){var y=localStorage.getItem("multibuy");if(y){var w=y.split(","),_=w.filter(function(t){return t.includes(e.properties._offer)});_.length>0&&(o=parseInt(_[0].split(":")[1],10),a=parseInt(_[0].split("-")[0],10))}$.ajax({type:"GET",url:window.Shopify.routes.root+"cart.js",dataType:"JSON",success:function(i){var c=i.items.filter(function(t){return e.id===t.id&&e.properties._offer===t.properties._offer});if(c.length>0&&(s-=c[0].quantity),a>0&&s+o>a){var u=r.checkMultibuyQty(s,e.properties._offer);if(u.length>1){for(var l=[],d=0;d<u.length;d++)if(0===d){var p=JSON.parse(JSON.stringify(e));p.quantity=u[d],p.properties._offer=e.properties._offer,l.push(p),p={}}else{var m=JSON.parse(JSON.stringify(e)),h=r.getUniqueOffer(m.properties._offer.split("-")[0]+"-"+m.properties._offer.split("-")[1],u[d]);m.quantity=u[d],m.properties._offer=h,l.push(m),m={}}r.addItems(l),n=!1}}if(n){var f=parseInt(t.target.value,10);r.toggleLoaderOverlay(!0);var g=r.cart&&r.cart.items?r.cart.items.find(function(t){return t.key===e.key}):null,v=g?g.quantity:e.quantity,y=Math.max(0,v+(f-e.quantity)),w={};w[e.key]=y,$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:w},dataType:"JSON",success:function(){r.refreshCart()}})}}})}else if(n){var S=parseInt(t.target.value,10);this.toggleLoaderOverlay(!0);var b=this.cart&&this.cart.items?this.cart.items.find(function(t){return t.key===e.key}):null,k=b?b.quantity:e.quantity,C=Math.max(0,k+(S-e.quantity)),I={};I[e.key]=C,$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:I},dataType:"JSON",success:function(){r.refreshCart()}})}}},checkIfIsGiftCard:function(e){return!e.properties||!(e.properties&&e.properties._greeting&&e.properties._receiving_email)}},_defineProperty(_methods,"getUniqueOffer",function(e,t){function i(e){return e.includes(n)}
13var r=localStorage.getItem("multibuy"),n="",o=1,a=[],s="",c=!1;if(r){a=r.split(","),o=t;for(var u=!0;u;){var l=Math.floor(100*Math.random()+1);n=e+"-"+l,s=n+":"+o;var d=a.filter(i);0===d.length&&(u=!1,a.push(s))}c=!0}else{var p=Math.floor(100*Math.random()+1);o=t,n=e+"-"+p,s=n+":"+o,a.push(s),c=!0}if(!c){var m=!0;for(o=t,a=r.split(",");m;){var h=Math.floor(100*Math.random()+1);n=e+"-"+h,s=n+":"+o;var f=a.filter(i);0===f.length&&(m=!1,a.push(s))}}try{localStorage.setItem("multibuy",a.join(","))}catch(e){console.warn("Error setting multibuy local storage",e)}return n}),_defineProperty(_methods,"checkMultibuyQty",function(e,t){var i=localStorage.getItem("multibuy"),r=t.split("-")[0]+"-"+t.split("-")[1],n=parseInt(t.split("-")[0],10),o=e/n,a=[],s=void 0;if(i){var c=i.split(","),u=c.filter(function(e){return e.includes(r)});if(u)u.forEach(function(t){var i=parseInt(t.split(":")[1],10);if(i!==n)if(i+e>n){s=e;for(var r=0;r<o;r++)0===r?(a.push(n-i),s-=n-i):r>0&&s>n?(a.push(n),s-=n):(a.push(s),s-=s)}else a.push(e)});else if(e>n){s=e;for(var l=0;l<o;l++)s>n?(a.push(n),s-=n):(a.push(s),s-=s)}else a.push(e)}else if(e>n){s=e;for(var d=0;d<o;d++)s>n?(a.push(n),s-=n):(a.push(s),s-=s)}else a.push(e);if(0===a.length)if(e>n){s=e;for(var p=0;p<o;p++)s>n?(a.push(n),s-=n):(a.push(s),s-=s)}else a.push(e);return s>0&&a.push(s),a}),_defineProperty(_methods,"toggleLoaderOverlay",function(e){var t=document.querySelector(".overlay__loader"),i=document.getElementById("side-cart");e&&t?(i&&i.setAttribute("aria-busy",!0),t.classList.add("show-overlay"),setTimeout(function(){t.classList.add("fade-overlay")},200)):t&&(i&&i.setAttribute("aria-busy",!1),t.classList.remove("fade-overlay"),setTimeout(function(){t.classList.remove("show-overlay")},200))}),_defineProperty(_methods,"getTotalPriceWithShipping",function(){var e=window.theme.settings.cart_shipping_price_in_sum,t=void 0,i=this.getFreeShippingAmount();return t=this.totalPrice>=0&&this.totalPrice<i&&e?theme.settings.cart_shipping_price:0,this.formatMoney(Number(this.totalPrice)+Number(t))}),_defineProperty(_methods,"getTotalDiscount",function(){var e=this;fetch("/cart?view=json").then(function(e){return e.json()}).then(function(t){e.totalDiscount=t.total_cart_discount;var i=t.items,r=i.length;r&&i.forEach(function(t){var i=document.querySelectorAll('[data-liid="'+t.id+'"]');t.compare_at_price>t.price?i.forEach(function(i){var r=t.compare_at_price*t.quantity,n='<s class="cart-item__price">'+e.formatMoney(Number(r))+"</s>";i.innerHTML=t.price>0?n:""}):i.forEach(function(e){e.innerHTML=""})})}).catch(function(e){console.error(e)});var t=this.totalDiscount>0?this.formatMoney(Number(this.totalDiscount)):0;return t}),_defineProperty(_methods,"calculateMultibuy",function(e){var t=e.items,i=t.map(function(e){return!(!e.properties||!e.properties._offer)&&e.properties._offer}),r=[],n=[].concat(_toConsumableArray(new Set(i)));n.forEach(function(e){var t=i.filter(function(t){return t===e});
13r.push(e+":"+t.length)});try{window.localStorage.setItem("multibuy",r.join(","))}catch(e){console.warn("Error setting multibuy local storage",e)}}),_defineProperty(_methods,"transformedMaxOrderValueNotice",function(){var e=""+window.theme.currencySymbol+window.theme.maximumOrderValue/100,t=this.cart.total_price-window.theme.maximumOrderValue,i=""+window.theme.currencySymbol+t/100;return window.theme.strings.maximumOrderValueNotice.replace("maxOrderValue",e).replace("exceededBy",i)}),_defineProperty(_methods,"isTagDiscountedProduct",function(e){var t=e.properties;if(t){var i=e.properties._tagDiscount;return i}}),_defineProperty(_methods,"isDiscountedItem",function(e){return this.isTagDiscountedProduct(e)?this.isTagDiscountedProduct(e):e.discounted_price<e.original_price}),_defineProperty(_methods,"addItemToBag",function(){function e(e){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var i,r,n,o,a,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i=!1,r=!1,void 0!==t.properties&&t.properties._offer&&(i=!0),void 0!==t.properties&&t.properties._greeting&&t.properties._receiving_email&&(r=!0),n=0,o=this.cart.items.length;case 5:if(!(n<o)){e.next=30;break}if(!i){e.next=14;break}if(!this.cart.items[n].properties||this.cart.items[n].properties._offer!==t.properties._offer||this.cart.items[n].id!==t.id){e.next=12;break}if(!(this.cart.items[n].quantity+t.quantity>t.max)){e.next=12;break}return this.errorMessage="There is no more stock for that item.",this.toggleLoaderOverlay(!1),e.abrupt("return");case 12:e.next=27;break;case 14:if(!r){e.next=22;break}if(!this.cart.items[n].properties||this.cart.items[n].properties._greeting!==t.properties._greeting||this.cart.items[n].properties._receiving_email!==t.properties._receiving_email||this.cart.items[n].id!==t.id){e.next=20;break}if(!(this.cart.items[n].quantity+t.quantity>t.max)){e.next=20;break}return this.errorMessage="There is no more stock for that item.",this.toggleLoaderOverlay(!1),e.abrupt("return");case 20:e.next=27;break;case 22:if(this.cart.items[n].id!==t.id){e.next=27;break}if(!(this.cart.items[n].quantity+t.quantity>t.max)){e.next=27;break}return this.errorMessage="There is no more stock for that item.",this.toggleLoaderOverlay(!1),e.abrupt("return");case 27:n++,e.next=5;break;case 30:if(!(t.quantity>t.max)){e.next=34;break}return this.errorMessage="There is no more stock for that item.",this.toggleLoaderOverlay(!1),e.abrupt("return");case 34:return this.toggleLoaderOverlay(!0),this.cart.items?this.cart.items.unshift(t):this.cart.items=[t],this.errorMessage="",a=this,e.abrupt("return",new Promise(function(e,i){$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/add.js",data:{id:t.id,quantity:t.quantity,properties:t.properties},dataType:"JSON",success:function(t){e(t)},error:function(e){console.error("Error updating cart:",e),i(e)},complete:function(e){a.updateCartItemsEvent(),a.refreshCart();var i=void 0;if(localStorage.getItem("ga-select-item")){var r=JSON.parse(localStorage.getItem("ga-select-item"));c=r.itemListId,u=r.itemListName,s=r.index,i=r.itemCategory}var n={item_id:t.sku,item_name:t.title,index:s,item_brand:"Lovisa",item_category:t.type||i,price:Number(t.price)/100,quantity:t.quantity};c&&(n.item_list_id=c),u&&(n.item_list_name=u);var o=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),l=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),d=l.menu_navigation_state||{};window.pushEvent({event:"add_to_cart",menu_navigation_state:d,ecommerce:Object.assign(o,{value:Number(t.price)/100,items:[n]})},"ecommerce");var p=JSON.parse(localStorage.getItem("ga4-itemListImpressions")||"{}");p[t.sku]=n;try{localStorage.setItem("ga4-itemListImpressions",JSON.stringify(p))}catch(e){console.warn("Error setting ga4-itemListImpressions local storage",e)}window.theme.checkPageReload(),window._learnq=window._learnq||[];var m=e&&e.responseJSON?e.responseJSON:{},h=m.image||t.image&&t.image.src||t.image&&t.image.url||t.image||"";"string"!=typeof h&&(h="");var f="";h&&(f=h.replace(/(\.[^.]*)$/,"_grande$1"),0===f.indexOf("//")?f="https:"+f:0!==f.indexOf("http")&&(f="https://"+f.replace(/^\/?/,"")));var g={Name:m.title||t.title,ProductID:m.product_id||t.product_id||"",Categories:t.collections?t.collections:[],ImageURL:f,URL:""+window.theme.shopSecureUrl+t.url.
13split("?")[0],Brand:m.vendor||t.vendor||"",Price:slate.Currency.formatMoney(t.price),$value:parseFloat(slate.Currency.formatMoney(t.price,"{{amount}}")),CompareAtPrice:t.compare_price?slate.Currency.formatMoney(t.compare_price):""};window.lovisaKlaviyoTrack?window.lovisaKlaviyoTrack(["track","Added to Cart",g]):(window._learnq=window._learnq||[],window._learnq.push(["track","Added to Cart",g])),(window.rtbhEvents||[]).push({eventType:"basketadd",offerId:t.product_id?t.product_id:""},{eventType:"uid",id:"unknown"})}})}));case 39:case"end":return e.stop()}},e,this)}));return e}()),_defineProperty(_methods,"updateCartStatus",function(e){var t=document.getElementById("cart-status");t&&(t.textContent=e,setTimeout(function(){t.textContent=""},1e3))}),_methods)}),theme.ProductCard=function(){function e(e){function t(e,t){var i=!0,r=!1,n=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var s=o.value;if("attributes"===s.type&&"class"===s.attributeName){var c=s.target;c.classList.contains("bookmarked")?c.setAttribute("aria-label","Remove "+(c.dataset.productTitle?c.dataset.productTitle+" ":"")+"from wishlist"):c.classList.contains("unbookmarked")&&c.setAttribute("aria-label","Add "+(c.dataset.productTitle?c.dataset.productTitle+" ":"")+"to wishlist")}if("attributes"===s.type&&"role"===s.attributeName){var u=s.target;"button"===u.getAttribute("role")&&u.removeAttribute("role")}}}catch(e){r=!0,n=e}finally{try{!i&&a.return&&a.return()}finally{if(r)throw n}}}var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.container=e,this.renderedBy=n,this.$container=$(e),this.offer=this.container.dataset.offer,this.boundClickHandler=this.addClickHandler.bind(this),this.variantAddHandler=this.addVariantHandler.bind(this),this.hasVariants=!1,this.toggleVariantsButtons=this.container.querySelectorAll(".product__add--show-variants"),this.variantsMessage=this.container.querySelector(".variant-picker__message"),this.variantsWrapper=this.container.querySelector(".product-card__variant-picker"),this.imgContainer=this.container.querySelector(".product-card__image"),this.closestCollection=e.closest(".collection-listing #product-grid"),this.closestCollection){var o=this.closestCollection.dataset.id;this.collectionData=window.theme.collectionData&&window.theme.collectionData[o]}if(this.closestFeaturedCollection=e.closest('[data-section-id][data-section-type="featured-collection"]'),this.closestFeaturedCollection){var a=this.closestFeaturedCollection.dataset.sectionId;this.featuredCollectionData=window.theme.featuredCollectionData&&window.theme.featuredCollectionData[a]}if(this.closestRelatedProducts=e.closest(".related-products"),this.closestRelatedProducts&&(this.relatedProductsData=window.theme.relatedProductsData),this.closestProductRecommendations=e.closest(".product-recommendations"),this.closestProductRecommendations&&(this.productRecommendationData=window.theme.productRecommendationData),this.imgContainer){var s=this.imgContainer.querySelector("img"),c=s.getAttribute("data-product-handle");s.setAttribute("data-original-image-url",s.src),this.imgContainer.addEventListener("mouseenter",function(){s.getAttribute("data-second-image-url")?s.src=s.getAttribute("data-second-image-url"):fetch("https://"+window.Shopify.shop+"/api/2025-10/graphql.json",{method:"POST",headers:{"Content-Type":"application/graphql","X-Shopify-Storefront-Access-Token":window.theme.storefrontAPIToken},body:'query {\n product(handle: "'+c+'") {\n images(first: 2) {\n nodes {\n url(transform: { maxWidth: 640 })\n }\n }\n }\n }'}).then(function(e){return e.json()}).then(function(e){console.log(e),e&&e.data&&e.data.product&&e.data.product.images&&e.data.product.images.nodes[1]&&e.data.product.images.nodes[1].url&&(s.src=e.data.product.images.nodes[1].url,s.setAttribute("data-second-image-url",e.data.product.images.nodes[1].url))})}),this.imgContainer.addEventListener("mouseleave",function(){s.getAttribute("data-original-image-url")&&(s.src=s.getAttribute("data-original-image-url"))})}var u=e.dataset.sku;if(e.addEventListener("click",function(){var e=void 0,t=void 0,r=void 0,n=void 0;if(i.collectionData&&(e=i.collectionData.itemListId,t=i.collectionData.itemListName,r=i.collectionData.itemListType,n=i.collectionData.items.find(function(e){return e.item_id===u})),i.featuredCollectionData&&(e=i.featuredCollectionData.itemListId,t=i.featuredCollectionData.itemListName,r=i.featuredCollectionData.itemListType,n=i.featuredCollectionData.items.find(function(e){return e.item_id===u})),i.relatedProductsData&&(e=i.relatedProductsData.itemListId,t=i.relatedProductsData.itemListName,r=i.relatedProductsData.itemListType,n=i.relatedProductsData.items.find(function(e){return e.item_id===u})),i.productRecommendationData&&(e=i.productRecommendationData.itemListId,t=i.productRecommendationData.itemListName,r=i.productRecommendationData.itemListType,n=i.productRecommendationData.items.find(function(e){return e.item_id===u})),e&&t&&r&&n){var o=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),a=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),s=a.menu_navigation_state||{};window.pushEvent({event:"select_item",item_list_id:e,item_list_name:t,item_list_type:r,menu_navigation_state:s,ecommerce:Object.assign(o,{impressions:[n]})},"ecommerce");var c=JSON.stringify({itemListId:e,itemListName:t,itemListType:r,index:n.index,itemCategory:n.item_category});localStorage.setItem("ga-select-item",c);var l=JSON.parse(localStorage.getItem("ga4-itemListImpressions")||"{}");l[u]=n,localStorage.setItem("ga4-itemListImpressions",JSON.stringify(l))}}
13),this.toggleVariantsButtons&&this.toggleVariantsButtons.length>0){this.hasVariants=!0;var l=this;this.toggleVariantsButtons.forEach(function(e){e.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),l.variantsMessage&&l.variantsMessage.focus();var t=document.querySelectorAll(".product-card__variants--show");if(t.forEach(function(e){e.classList.remove("product-card__variants--show")}),this.classList.contains("product__add--mobile")){var i=l.container.querySelector(".product-card__mobile-variants");i&&i.classList.add("product-card__mobile-variants--show")}else{var r=l.container.querySelector(".product-card__variants");r&&r.classList.add("product-card__variants--show")}})})}if(this.addButton=this.container.querySelector(".product__add"),this.mobileAddButton=this.container.querySelector(".product__add--mobile"),this.addButton&&!this.hasVariants&&this.addButton.addEventListener("click",this.boundClickHandler),this.mobileAddButton&&this.toggleVariantsButtons&&0===this.toggleVariantsButtons.length&&this.mobileAddButton.addEventListener("click",this.boundClickHandler),this.addVariantButtons=this.container.querySelectorAll(".add-product-variant"),this.addVariantButtons.length){var d=this;this.addVariantButtons.forEach(function(e){return e.addEventListener("click",d.variantAddHandler.bind(d))})}this.data={};var p=this.container.querySelector("[data-product-json]");if(p&&p.innerText.trim().length>0)try{this.data=JSON.parse(p.innerText)}catch(e){console.error("Error parsing product JSON",e)}var m={$container:this.$container,enableHistoryState:!1,singleOptionSelector:"[data-single-option-selector] [type=radio]",originalSelectorId:"[data-product-select]",product:this.data};if(this.variants=new slate.Variants(m),this.$container.on("variantChange",this.onVariantChanged.bind(this)),e.dataset.inited=!0,this.offer){this.offerPopup=document.querySelector(".multibuy-offer__popup"),this.offerPopupClose=document.querySelector(".multibuy-offer__popup--close"),this.offerPopupMessage=document.querySelector(".multibuy-offer__popup-message"),this.offerPopupLink=document.querySelector(".multibuy-offer__popup-btn"),this.offerPopupClose&&this.offerPopupClose.addEventListener("click",this.toggleOfferPopup.bind(this));var h=this.offer.split("-"),f=/([^\d-.]|)|/g,g=h[0].replace(f,""),v=h[h.length-1].replace(f,"");this.offerItems=parseInt(g,10),this.offerMoney=v}var y=this.container.querySelector(".product-card__wishlist-icon");if(y){var w={attributes:!0},_=new MutationObserver(t);_.observe(y,w)}this.closeVariantsButton=this.container.querySelector(".close-show-variants"),this.closeVariantsButton&&this.closeVariantsButton.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var t=i.container.querySelector(".product-card__variants"),r=i.container.querySelector(".product-card__mobile-variants");t&&t.classList.remove("product-card__variants--show"),r&&r.classList.remove("product-card__mobile-variants--show")}),this.container[r]=this}function t(e){return"number"!=typeof e?0:e%1!==0?Math.round(100*e):e>0&&e<1e3?100*e:e}function i(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t){var n=t[r];return n&&n.destroy(),new e(t,i)}}var r="productCardInstance";return e.prototype.onVariantChanged=function(e){var t=e.variant;this.addButton&&(t.available?(this.addButton.removeAttribute("disabled"),this.addButton.querySelector("span").innerText=theme.strings.addToCart):(this.addButton.setAttribute("disabled","disabled"),this.addButton.querySelector("span").innerText=theme.strings.soldOut))},e.prototype.addVariantHandler=function(e){if(!this.variants||!this.variants.product||!this.variants.product.variants)return void console.warn("Quick add: product data unavailable, falling back to native form submit");e.preventDefault();var t=e.currentTarget,i=parseInt(t.dataset.variantId,10),r=this.variants.product;t.classList.add("btn--loading");var n=r.variants.find(function(e){return e.id===i||e.id+""==i+""}),o={};console.log("AddVariantHandler",r),r.options.forEach(function(e,t){o[e]=n["option"+(t+1)]});var a={},s=[];if(r.collections){s=r.collections.map(function(e){return e.title?e.title:e});var c=r.collections.map(function(e){return e.handle});a._collections=c.sort().toString()}var u=Number(n.price),l=Number(n.price),d=Number(n.compare_at_price);"tagalys"===this.renderedBy&&(u=Math.round(100*u),l=Math.round(100*l),d=Math.round(100*d));var p=this.data.images[0],m="";"string"==typeof p?m=p:p&&"string"==typeof p.src&&(m=p.src);var h={id:i,variant_id:i,product_id:Number(r.id),quantity:1,title:r.title,vendor:r.vendor,collections:s,price:u,line_price:l,compare_price:d,url:"/products/"+r.handle+"?variant="+i,image:m,options:o,show:!0,min:0,max:999,sku:n.sku,type:r.type};if(this.offer){var f=this.offerItems+"-"+this.offerMoney,g=this.getUniqueOffer(f);a._offer=g}var v=r.tags.map(function(e){return e.toLowerCase()});v.includes("preorder")&&(a.type="Preorder Item");var y=v.find(function(e){return e.includes("discount:")});y&&(a._tagDiscount=y);var w=v.find(function(e){return e.includes("discountbuyget:")});if(w&&(a._tagDiscountBuyGet=w),h.properties=a,"popup"==window.theme.cartType){var _="";o.Size&&(_=o.Size)}else theme.sideCart.openDrawer();if(this.featuredCollectionData){var S=this.featuredCollectionData.items.findIndex(function(e){return e.item_id===h.sku});"popup"==window.theme.cartType?theme.sideCart.addItemToBag(h,S,this.featuredCollectionData.itemListId,this.featuredCollectionData.itemListName).then(function(e){var i=theme.sideCart.cart&&theme.sideCart.cart.items?theme.sideCart.cart.items.find(function(e){return e.id===h.id}
13):null,r=i&&i.compare_price?i.compare_price:e.compare_price;updateCartPopup({title:h.title,image:e.image,price:e.price,compare_price:r,quantity:e.quantity,size:_,vId:e.id}),t.classList.remove("btn--loading")}):(theme.sideCart.addItem(h,S,this.featuredCollectionData.itemListId,this.featuredCollectionData.itemListName),t.classList.remove("btn--loading"))}else"popup"==window.theme.cartType?(theme.sideCart.addItemToBag(h).then(function(e){var t=theme.sideCart.cart&&theme.sideCart.cart.items?theme.sideCart.cart.items.find(function(e){return e.id===h.id}):null,i=t&&t.compare_price?t.compare_price:e.compare_price;updateCartPopup({title:h.title,image:e.image,price:e.price,compare_price:i,quantity:e.quantity,size:_,vId:e.id})}),t.classList.remove("btn--loading")):(theme.sideCart.addItem(h),t.classList.remove("btn--loading"))},e.prototype.addClickHandler=function(e){var i=this,r=this.variants&&this.variants.product;if(!r||!r.variants)return void console.warn("Card add: product data unavailable, falling back to native form submit");e.preventDefault(),this.addButton&&this.addButton.classList.add("btn--loading");var n=this.container.querySelector("form"),o=this.variants.currentVariant,a=this.variants.product,s=a.options.indexOf("Size"),c=o["option"+(s+1)],u="";c&&(u="Size: "+c);var l=999;"shopify"===o.inventory_management&&"deny"===o.inventory_policy&&(l=o.inventory_quantity);var d={},p=[];if(a.collections){p=a.collections.map(function(e){return e.title?e.title:e});var m=a.collections.map(function(e){return e.handle});d._collections=m.sort().toString()}var h=Number(o.price),f=Number(o.price),g=Number(o.compare_at_price);"tagalys"===this.renderedBy&&(h*=100,f*=100,g*=100);var v=o.featured_image||this.data.images[0],y="";"string"==typeof v?y=v:v&&"string"==typeof v.src&&(y=v.src);var w={id:Number(n.id.value),variant_id:Number(o.id),product_id:Number(a.id),quantity:Number(n.quantity.value),price:h,line_price:f,compare_price:g,title:a.title,vendor:a.vendor,collections:p,description:u,url:"/products/"+this.data.handle+"?variant="+o.id,image:y,min:0,max:l,show:!0,options:{},sku:o.sku,type:a.type};if(this.offer){var _=this.offerItems+"-"+this.offerMoney,S=this.getUniqueOffer(_);d._offer=S}var b=a.tags.map(function(e){return e.toLowerCase()});b.includes("preorder")&&(d.type="Preorder Item");var k=b.find(function(e){return e.includes("discount:")});k&&(d._tagDiscount=k);var C=b.find(function(e){return e.includes("discountbuyget:")});if(C&&(d._tagDiscountBuyGet=C),w.properties=d,this.featuredCollectionData){var I=this.featuredCollectionData.items.findIndex(function(e){return e.item_id===w.sku});"popup"==window.theme.cartType?theme.sideCart.addItemToBag(w,I,this.featuredCollectionData.itemListId,this.featuredCollectionData.itemListName).then(function(e){ 14var t=theme.sideCart.cart&&theme.sideCart.cart.items?theme.sideCart.cart.items.find(function(e){return e.id===w.id}):null,r=t&&t.compare_price?t.compare_price:e.compare_price;updateCartPopup({title:w.title,image:e.image,price:e.price,compare_price:r,quantity:e.quantity,size:c,vId:e.id}),i.addButton&&i.addButton.classList.remove("btn--loading")}):(theme.sideCart.addItem(w,I,this.featuredCollectionData.itemListId,this.featuredCollectionData.itemListName),this.addButton&&this.addButton.classList.remove("btn--loading"))}else"popup"==window.theme.cartType?theme.sideCart.addItemToBag(w).then(function(e){var r=theme.sideCart.cart&&theme.sideCart.cart.items?theme.sideCart.cart.items.find(function(e){return e.id===w.id}):null,n=r&&null!=r.compare_price?r.compare_price:e.compare_price,o=e.price,a=t(n);t(o);updateCartPopup({title:w.title,image:e.image,price:e.price,compare_price:a,quantity:e.quantity,size:c,vId:e.id}),i.addButton&&i.addButton.classList.remove("btn--loading")}):(theme.sideCart.addItem(w),this.addButton&&this.addButton.classList.remove("btn--loading"));var O=this;if(document.body.classList.contains("quick__add--test__variant")||window.innerWidth>=parseInt(window.theme.settings.grid_medium,10))"drawer"==window.theme.cartType&&theme.sideCart.openDrawer(),O.showDesktopVariants=!1;else{var P=e.currentTarget;P.classList.add("product__added"),setTimeout(function(){P.classList.remove("product__added"),O.showVariants=!1},3e3)}if(this.offer){var E=1;theme.sideCart.cart.item_count>
14=1&&theme.sideCart.cart.items.forEach(function(e){e.properties&&e.properties.hasOwnProperty("_offer")&&e.properties._offer===i.offer&&(E+=e.quantity)});var A=this.offerItems-E;this.offerPopupMessage&&(E>=this.offerItems?this.offerPopupMessage.innerHTML="Congratulations you have met the requirements for this offer":this.offerPopupMessage.innerHTML="This product is part of an offer: "+this.offerItems+" for $"+this.offerMoney+" add "+A+" more items to receive this offer."),this.offerPopupLink&&(this.offerPopupLink.attributes.href="/collections/"+this.offer,this.openOfferPopup())}},e.prototype.getUniqueOffer=function(e){function t(e){return e.includes(o)}var i=this,r=localStorage.getItem("multibuy"),n=Math.floor(100*Math.random()+1),o="",a=1,s=[],c="",u=!1;if(r){s=r.split(",");var l=s.filter(function(t){return t.includes(e)});l?l.forEach(function(e){if(a=parseInt(e.split(":")[1],10),a<i.offerItems){a++,o=e.split(":")[0],c=o+":"+a;var t=s.indexOf(e);s[t]=c,u=!0}}):(a=1,o=e+"-"+n,c=o+":"+a,s.push(c),u=!0)}else a=1,o=e+"-"+n,c=o+":"+a,s.push(c),u=!0;if(!u){var d=!0;for(a=1,s=r.split(",");d;){n=Math.floor(100*Math.random()+1),o=e+"-"+n,c=o+":"+a;var p=s.filter(t);0===p.length&&(d=!1,s.push(c))}}try{localStorage.setItem("multibuy",s.join(","))}catch(e){console.error("Failed to save multibuy to localStorage:",e)}return o},e.prototype.destroy=function(){this.addButton&&this.addButton.removeEventListener("click",this.boundClickHandler),this.variants=null,this.$container&&this.$container.off("variantChange"),this.container&&this.container.removeAttribute("data-inited"),this.container&&delete this.container[r]},e.prototype.openOfferPopup=function(){if(this.offerPopup){window.theme.lastActiveElement=document.activeElement,this.offerPopup.classList.add("multibuy-offer__popup--expanded"),this.offerPopup.setAttribute("aria-hidden","false");var e=this.offerPopup.querySelector(".multibuy-offer__popup--close");e&&e.focus(),$(document).on("keydown:escape",this.toggleOfferPopup.bind(this))}},e.prototype.toggleOfferPopup=function(e){if(e&&"keydown:escape"!==e.type&&e.preventDefault(),this.offerPopup)if(this.offerPopup.classList.contains("multibuy-offer__popup--expanded"))window.theme.lastActiveElement&&(window.theme.lastActiveElement.focus(),window.theme.lastActiveElement=null),this.offerPopup.classList.remove("multibuy-offer__popup--expanded"),this.offerPopup.setAttribute("aria-hidden","true"),$(document).off("keydown:escape",this.toggleOfferPopup.bind(this));else{window.theme.lastActiveElement=document.activeElement,this.offerPopup.classList.add("multibuy-offer__popup--expanded"),this.offerPopup.setAttribute("aria-hidden","false");var t=this.offerPopup.querySelector(".multibuy-offer__popup--close");t&&t.focus(),$(document).on("keydown:escape",this.toggleOfferPopup.bind(this))}},i.ProductCard=e,i}(),theme.dobSelector=function(){function e(e){this.container=e,this.$container=e;for(var t=(new Date).getFullYear(),i=t-18,r=["January","February","March","April","May","June","July","August","September","October","November","December"],n=this.container.querySelector("[data-day-selector]"),o=this.container.querySelector("[data-month-selector]"),a=this.container.querySelector("[data-year-selector]"),s=this.container.querySelector("[data-dob-field]"),c='<option value="Day">Day</option>',u='<option value="Month">Month</option>',l='<option value="Year">Year</option>',d=1;d<=31;d++)c+='<option value="'+d+'">'+d+"</option>";r.forEach(function(e,t){u+='<option value="'+(t+1)+'">'+e+"</option>"});for(var p=i-100;p<=i;p++)l+='<option value="'+p+'">'+p+"</option>";n.innerHTML=c,o.innerHTML=u,a.innerHTML=l;var m="Day",h="Month",f="Year";n.addEventListener("change",function(e){m=e.target.value,"Month"!==h&&"Year"!==f&&(s.value=m+"/"+h+"/"+f)}),o.addEventListener("change",function(e){h=e.target.value,"Day"!==m&&"Year"!==f&&(s.value=m+"/"+h+"/"+f)}),a.addEventListener("change",function(e){f=e.target.value,"Month"!==h&&"Day"!==m&&(s.value=m+"/"+h+"/"+f)})}return e}(),theme.mobileTrustIndicators=function(){function e(){$(".features-notification--med").each(function(e,t){t=$(t),t.on("init",function(){var e=t.find('.slick-slide:not([aria-hidden="true"]) a')[0],i=t.find('.slick-slide[aria-hidden="true"] a');
14e.setAttribute("tabindex","0"),i.each(function(e,t){var i=$(t),r=i[0];r.setAttribute("tabindex","-1")})}),t.on("afterChange",function(){var e=t.find('.slick-slide:not([aria-hidden="true"]) a')[0],i=t.find('.slick-slide[aria-hidden="true"] a');e.setAttribute("tabindex","0"),i.each(function(e,t){var i=$(t),r=i[0];r.setAttribute("tabindex","-1")})}),t.slick({accessibility:!1,arrows:!1,dots:!1,infinite:!0,lazyLoad:"progressive",swipeToSlide:!0,rows:0,responsive:[{breakpoint:Number(theme.settings.grid_medium),settings:{arrows:!0,dots:!1,slidesToShow:1,slidesToScroll:1,autoplay:!0,autoplaySpeed:4e3}}]})})}return e}(),theme.BalanceChecker=function(){function e(e){var t=document.getElementById("balance-check-status");t&&(t.textContent=e,setTimeout(function(){t.textContent=""},1e3))}function t(t){this.form=t,this.number=this.form.querySelector('[data-balance-checker="number"]'),this.pin=this.form.querySelector('[data-balance-checker="pin"]'),this.result=this.form.querySelector('[data-balance-checker="result"]');var o=this;this.form.addEventListener("submit",function(t){return t.preventDefault(),o.number.value.length!==i||o.pin.value.length!==r?(o.result.innerHTML="invalid length or missing pin",void e("invalid length or missing pin")):void n.ajax({method:"GET",url:theme.givex_api_url+"balance.json",data:{shop:theme.permanent_domain,voucher_number:o.number.value,security_code:o.pin.value},success:function(t){o.result.innerHTML=t.response.message,e(t.response.message)},error:function(){o.result.innerHTML="there was an error retrieving your balance",e("There was an error retrieving your balance")}})})}var i=20,r=4,n=window.jQuery;return t}(),theme.cartPage=new Vue({el:".cart-page",clone:!1,data:{cart:null,multibuy:null,multibuyOffer:"",multibuyNotReadyArray:[],upsell:null,timeout:null,isVisible:!1,isReady:!1,difference:0,errorMessage:"",quantitySelectors:[],totalPrice:null,totalDiscount:null,isFreeShipping:!1,progressBarStatus:0,freeShippingText:"",shippingPrice:0,cartOfferCurrencySwitcherTriggered:!1,upsellsActive:!1,upsellProducts:[],gwpAutoCollapse:!1,giftWithPurchase:window.theme&&window.theme.giftWithPurchase,giftWithPurchaseEnabled:window.theme&&window.theme.giftWithPurchase&&window.theme.giftWithPurchase.enabled||!1,giftWithPurchaseActive:!0,giftWithPurchaseProducts:[],giftWithPurchaseRules:null,giftWithPurchaseHeading:"",expandedAccordions:[],stockBySkuMap:{},shippingStockBySkuMap:{},cartItemSkuMapping:{},isStockReady:!1,isShippingStockReady:!1,selectedDeliveryMethod:"shipping",warehouseLocationId:window.theme&&window.theme.settings.shipping_warehouse_location_id?window.theme.settings.shipping_warehouse_location_id:null,selectedLocationId:null,isPopupVisible:!1,shippingPolicyHtml:null,outStockQty:0,outOfStockItemsGroup:[],shippingOutStockItemsGroup:[],showStockPopup:!1,isPopupRightBtnLoading:!1,rawStockResult:[],combinedCartItemsStock:[],discountCartItems:[],activeSfsValueMapping:{},selectedClickAndCollectLocation:null,lowStockBuffer:2,notCheckStockDeliveryMethods:["shipping"],showSummaryPanel:!0,stockStatus:{summary:{outOfStock:0,inStock:0,lowStock:0,shippingOnly:0,stockNotEnough:0},shippingStockSum:{outOfStock:0,inStock:0,lowStock:0},promotionGroups:[],promotionGroupsMap:{},shippingPromotionGroupsMap:{},outOfStockItems:[],inStockItems:[],lowStockItems:[],shippingOnlyItems:[],stockNotEnoughItems:[],removeBeforeCheckoutItems:[],lastUpdated:null},enableBopis:!1,freeShippingAmountData:null,defaultStoreBranch:window.theme.bopis&&window.theme.bopis.defaultStore?window.theme.bopis.defaultStore:null,defaultSfsStoreBranch:window.theme.bopis&&window.theme.bopis.defaultShippingBranch?window.theme.bopis.defaultShippingBranch:null,enableLocationInventoryCheck:!1,selectedCountryCode:window.theme.bopis&&window.theme.bopis.selectedCountryCode?window.theme.bopis.selectedCountryCode:null,customGoogleApiLink:"https://lovisa-autocomplete-aa163eff905d.herokuapp.com/app/google-autocomplete",addressInput:"",foundAddress:"",isFoundLocation:!1,searchResults:[],deliveryDate:"",isMobile:window.innerWidth<=989,stockBuffer:window.theme.settings.bopis_onestock_buffer?window.theme.settings.bopis_onestock_buffer:-1,pickupShortDesc:window.theme.settings.bopis_usp_short_description?window.theme.settings.bopis_usp_short_description:"",pickupDesc:window.theme.settings.bopis_usp_description?window.theme.settings.bopis_usp_description:"",pickupUnavailableShortDesc:window.theme.settings.bopis_usp_unavailable_short_desc?window.theme.settings.bopis_usp_unavailable_short_desc:"",pickupUnavailableDesc:window.theme.settings.bopis_usp_unavailable_desc?window.theme.settings.bopis_usp_unavailable_desc:"",uspShippingDesc:window.theme.settings.usp_type_1_description?window.theme.settings.usp_type_1_description:"",hasSearchResults:!1,outStockPopupDesc:window.theme.bopis.outStockPopupDesc?window.theme.bopis.outStockPopupDesc:"",shippingSavedStockResult:[],shippingOut
14StockQty:0,shippingOutStockQtyNotice:window.theme.bopis.shippingOutStockQtyNotice?window.theme.bopis.shippingOutStockQtyNotice:"",bopisStockUrl:window.theme.bopis.stockApiURL?window.theme.bopis.stockApiURL:"",shippingStockUrl:window.theme.bopis.shippingStockApiURL?window.theme.bopis.shippingStockApiURL:"",shippingOutStockPopupDesc:window.theme.bopis.shippingOutStockPopupDesc?window.theme.bopis.shippingOutStockPopupDesc:"",multibuyOfferArray:[],wishlistObserver:null,wishedHandles:[],giftlabProductList:window.theme.settings.giftlab_product_list?window.theme.settings.giftlab_product_list:[],giftlabExcludedProductIds:[],_gwpRunning:!1,_gwpPending:!1,_gwpPendingCart:null,_gwpPendingOverlayStatus:!1,_gwpStatusTimer:null,_gwpStatusTimeout:null,_stepperTimer:null},created:function(){var e=document.querySelector(".side-cart__upsell-container"),t=document.querySelector(".side-cart__upsell-toggler");if(e&&t&&window.innerHeight<700&&(e.classList.remove("side-cart__upsell--active"),t.classList.add("upsell-toggler--closed")),"EU"===window.theme.store){if(window.Shopify&&window.Shopify.currency){var i=window.Shopify.currency;i.moneyFormat=window.theme.moneyFormat;try{localStorage.setItem("ShopifyCurrencyObj",JSON.stringify(i))}catch(e){console.warn("Failed to set ShopifyCurrencyObj in localStorage:",e)}}var r=$("[data-free-shipping-element] span"),n=this.getFreeShippingAmount();n*=Number(Shopify.currency.rate),$.each(r,function(e,t){var i=$(t);if(i&&i.text().includes("{amount}")){var r=slate.Currency.formatMoney(n,window.theme.moneyFormat);i.text(i.text().replace("{amount}",r))}})}},watch:{selectedDeliveryMethod:function(e,t){e!==t&&this.refreshStockData(e,!1)}},computed:{isCartOverLimit:function(){return!!window.theme.enableMaximumOrderValue&&this.cart.total_price>window.theme.maximumOrderValue}},mounted:function(){var e=this,t=this,i=(new Date,document.querySelector("[data-side-cart-json]"));this.abortController=new AbortController,this.shopifyCartUrl=window.Shopify.routes.root+"cart?view=json",this.freeShippingCheck(),document.addEventListener("click",this.handleShippingMethodClick),window.addEventListener("resize",this.handleResize),document.addEventListener("keydown",this.handleEnterKey),window.theme.settings.enable_bopis&&document.addEventListener("DOMContentLoaded",function(){var e=document.querySelector(".cart-page");e&&(e.style.paddingTop="0px"),t.setRecommendationsWidth()}),this.enableBopis=window.theme.settings.enable_bopis,this.freeShippingAmountData=this.getFreeShippingAmount(),this.apiRequest(this.shopifyCartUrl,{},"application/json").then(function(r){var n=t.parseCartResponse(r);console.log("cart mounted",n),t.cart=n,t.activeSfsValueMapping=t.getProductMetafieldsInfo(),t.cartItemSkuMapping=new Map,n.items.forEach(function(t){t.variant_id&&t.sku&&e.cartItemSkuMapping.set(t.variant_id,t.sku)});for(var o="",a="pdp_addresss=",s=decodeURIComponent(document.cookie),c=s.split(";"),u=0;u<c.length;u++){for(var l=c[u];" "==l.charAt(0);)l=l.substring(1);0==l.indexOf(a)&&(o=l.substring(a.length,l.length))}o&&""!==o.trim()?(t.foundAddress=o,t.isFoundLocation=!0,t.searchResults=[]):(t.isFoundLocation=!1,t.foundAddress="",t.addressInput="");var d=JSON.parse(i.innerHTML);e.multibuyCheck(d),e.gwpPreCheck(d,!1);var p=window.theme.settings.shipping_warehouse_location_id?window.theme.settings.shipping_warehouse_location_id:null;t.selectedLocationId=p;t.isReady=!0;var m=d.items.filter(function(e){return e.properties&&e.properties._offer});m.length>0&&t.calculateMultibuy(d),d.items.length&&window.theme.settings.enable_wishlist&&t.setupWishlistObserver(),t.cartOfferCheck(),t.checkNoFreeShippingCountry(),t.updateCartItemsEvent(),t.onCartUpdated()}).catch(function(e){console.error("Error at request shopify cart info",e)}),window.theme.glbeHelpers&&window.theme.glbeHelpers.convertUpsellTogglePrices(),this.selectedDeliveryMethod="shipping";try{localStorage.removeItem("_bopisSelectedDeliveryMethod")}catch(e){}this.enableBopis&&this.defaultStoreBranch?this.refreshStockData("click-and-collect",!0):this.enableBopis&&!this.defaultStoreBranch?(this.refreshStockData("shipping",!0),this.selectedDeliveryMethod="shipping"):this.selectedDeliveryMethod="shipping";var r=document.getElementById("giftlab-product-exclusion-data");if(r){var n=r.dataset.excludedIds;t.giftlabExcludedProductIds=n?n.split(",").filter(function(e){return e}):[],console.log("giftlab-check",t.giftlabExcludedProductIds)}setTimeout(function(){t.loadUpsellProducts()},3e3),document.dispatchEvent(new CustomEvent("cart:rendered"))},beforeDestroy:function(){document.removeEventListener("click",this.handleShippingMethodClick),window.removeEventListener("resize",this.handleResize),document.removeEventListener("keydown",this.handleEnterKey)},updated:function(){var e=this;this.quantitySelectors.length>
140&&(this.quantitySelectors.forEach(function(e){return e.destroy()}),this.quantitySelectors=[]),document.querySelectorAll("[data-component=QuantitySelector]").length>0&&document.querySelectorAll("[data-component=QuantitySelector]").forEach(function(t){e.quantitySelectors.push(new theme[t.dataset.component](t))}),theme.currencyConverter===!0&&Currency.convertAll&&"true"===theme.currencyConverter&&Currency.convertAll(theme.currency,Currency.currentCurrency),("EU"===window.theme.store||"US"===window.theme.store&&"USD"!==window.Shopify.currency.active)&&this.multibuyOfferPriceUpdate();var t=".cart-item__title > span";theme.CurrencySwitcher.switchCurrency(t),document.dispatchEvent(new CustomEvent("cart:rendered"))},methods:{isFreeItem:function(e){if(!e||!e.properties||!Object.keys(e.properties).length)return!1;var t=["_cartoffer","_giftWithPurchase"];return t.some(function(t){return Object.keys(e.properties).some(function(e){return e===t})})},toggleGWPTab:function(e){if(this.gwpAutoCollapse=!1,this.giftWithPurchaseActive=e,this.giftWithPurchaseActive){var t=this.giftWithPurchaseProducts.slice(0,20).map(function(e,t){return{index:t,item_id:e.variants[0].sku,item_name:e.title.replace(/["']/g,""),item_brand:"Lovisa",item_category:e.type,item_list_id:"mini-cart-upsell",item_list_name:"Mini-Cart Upsell Feed",price:e.price/100,quantity:1}});window.theme.giftWithPurchaseProductsData={items:t,itemListId:"mini-cart-upsell",itemListName:"Mini-Cart Upsell Feed",itemListType:"Mini-Cart Upsell Feed"};var i=void 0,r=function(){var e=window.theme.giftWithPurchaseProductsData;if(e){var t=e.items,r=e.itemListId,n=e.itemListName,o=e.itemListType,a=[],s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.length&&(i&&clearTimeout(i),i=setTimeout(function(){var i=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),s=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),c=s.menu_navigation_state||{};window.pushEvent({event:"view_item_list",menu_navigation_state:c,ecommerce:Object.assign(i,{items:e,item_list_id:r,item_list_name:n,item_list_type:o,item_total_count:t.length,item_visible_count:window.theme.giftWithPurchaseProductsData.itemsVisible.length})},"ecommerce"),a=[]},1e3))},c=document.querySelectorAll(".side-cart__gwp-items .gwp-item");c.length&&c.forEach(function(i){var r=window.theme.isElementVisibleInViewport(i);i.setAttribute("data-visible-by-default",r),r&&a.push(i.getAttribute("data-sku"));var n=function(n,o){n.forEach(function(n){var c=i.getAttribute("data-visible-by-default")||!1;if(r=window.theme.isElementVisibleInViewport(i),n.intersectionRatio>0&&(o.unobserve(n.target),i.setAttribute("data-visible-in-viewport",r),r)){a.push(i.getAttribute("data-sku"));var u=t.filter(function(e){return a.includes(e.item_id)});e.itemsVisible=e.itemsVisible||[];var l=u.map(function(t){var i=e.itemsVisible.find(function(e){return e.item_id===t.item_id}),r=t;return r.visible_by_default=c,i||window.theme.giftWithPurchaseProductsData.itemsVisible.push(r),r});s(l)}})},o=new IntersectionObserver(n);o.observe(i)})}};r();var n=document.querySelectorAll(".side-cart__gwp-items .gwp-item");n.forEach(function(e){var i=e.dataset.sku,r=t.find(function(e){return e.item_id===i});if(r){var n=function(){var e=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),t=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),n=t.menu_navigation_state||{};window.pushEvent({event:"select_item",item_list_id:"mini-cart-upsell",item_list_name:"Mini-Cart Upsell Feed",item_list_type:"Mini-Cart Upsell Feed",menu_navigation_state:n,ecommerce:Object.assign(e,{impressions:[r]})},"ecommerce");var o=JSON.stringify({itemListId:"mini-cart-upsell",itemListName:"Mini-Cart Upsell Feed",itemListType:"Mini-Cart Upsell Feed",index:r.index,itemCategory:r.item_category}),a=JSON.parse(localStorage.getItem("ga4-itemListImpressions")||"{}");a[i]=r;try{localStorage.setItem("ga-select-item",o),localStorage.setItem("ga4-itemListImpressions",JSON.stringify(a))}catch(e){console.warn("Failed to set ga-select-item or ga4-itemListImpressions in localStorage:",e)}};e.removeEventListener("click",n),e.addEventListener("click",n)}})}},checkForEligibleProduct:function(e,t){var i=t.properties._collections;if("string"!=typeof e||!i||void 0==i)return!1;var r=i.split(",").map(function(e){return e.trim()}
14).filter(Boolean);return r.includes(e)},isCollectionMatched:function(e,t){return!("string"!=typeof e||!Array.isArray(t))&&t.some(function(t){var i=t.properties._collections;if(!i||void 0==i)return!1;var r=i.split(",").map(function(e){return e.trim()}).filter(Boolean);return r.includes(e)})},clearGwpStatusTimers:function(){this._gwpStatusTimer&&(clearInterval(this._gwpStatusTimer),this._gwpStatusTimer=null),this._gwpStatusTimeout&&(clearTimeout(this._gwpStatusTimeout),this._gwpStatusTimeout=null)},waitForGwpStatusAndRun:function(e,t){var i=this;return i.clearGwpStatusTimers(),new Promise(function(r){var n=function(){i.clearGwpStatusTimers(),r()},o=function(){i.giftWithPurchase=window.theme&&window.theme.giftWithPurchase,i.giftWithPurchaseEnabled=window.theme&&window.theme.giftWithPurchase&&window.theme.giftWithPurchase.enabled||!1,i.giftWithPurchaseEnabled?Promise.resolve(i.gwpCheck(e,t)).catch(function(e){console.error("gwpCheck error:",e)}).finally(n):(i.gwpCleanUp(e),n())};return"loaded"===window.theme.gwp_status?void o():(i._gwpStatusTimer=setInterval(function(){"loaded"===window.theme.gwp_status&&o()},500),void(i._gwpStatusTimeout=setTimeout(function(){"loading"!==window.theme.gwp_status&&void 0!==window.theme.gwp_status||(i.gwpCleanUp(e),n())},6e4)))})},finishGwpPreCheck:function(){if(this._gwpRunning=!1,this._gwpPending){var e=this._gwpPendingCart||this.cart,t=this._gwpPendingOverlayStatus||!1;this._gwpPending=!1,this._gwpPendingCart=null,this._gwpPendingOverlayStatus=!1,this.gwpPreCheck(e,t)}},gwpPreCheck:function(e,t){var i=this,r=new Date;if(!e||!Array.isArray(e.items))return void i.toggleLoaderOverlay(!1);if(i._gwpRunning)return i._gwpPending=!0,i._gwpPendingCart=e,void(i._gwpPendingOverlayStatus=t);i._gwpRunning=!0,window.gwpAddError=[];var n=e.items.filter(function(e){return!e.properties||!e.properties._collections});n.length>0?fetch(window.Shopify.routes.root+"cart?sections=cart-json&"+r.getTime()).then(function(e){return e.json()}).then(function(t){var i=t["cart-json"],n=document.createElement("div");n.innerHTML=i;var o=n.querySelector("#cart-collections-json");if(!o)return e;var a=void 0;try{a=JSON.parse(o.textContent)}catch(t){return console.error("JSON parse error",t,o),e}var s=function(e){var t=Promise.resolve();return e.forEach(function(e){t=t.then(function(){var t=Object.assign({},e.properties||{},{_collections:e.collections});return fetch(window.Shopify.routes.root+"cart/change.js?"+r.getTime(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e.key,quantity:e.quantity,properties:t})})})}),t};return s(a).then(function(){return fetch(window.Shopify.routes.root+"cart.js?"+r.getTime())}).then(function(e){return e.json()})}).then(function(r){return i.waitForGwpStatusAndRun(r||e,t)}).catch(function(e){console.error("Error at GWP pre-check:",e),i.toggleLoaderOverlay(!1)}).finally(function(){i.finishGwpPreCheck()}):i.waitForGwpStatusAndRun(e,t).catch(function(e){console.error("Error at GWP status check:",e),i.toggleLoaderOverlay(!1)}).finally(function(){i.finishGwpPreCheck()})},gwpCheck:function(e){var t=this,i=(arguments.length>1&&void 0!==arguments[1]&&arguments[1],!(arguments.length>2&&void 0!==arguments[2])||arguments[2],this);if(i.toggleLoaderOverlay(!0),!e||!Array.isArray(e.items)||!i.giftWithPurchase)return i.toggleLoaderOverlay(!1),Promise.resolve();var r=e.items,n=e.attributes,o=this.giftWithPurchase,a=o.offers,s=void 0===a?[]:a,c=o.heading,u=o.multiEnabled,l=o.multiQualificationEnabled,d=o.productsExcluded,p=void 0===d?[]:d,m=s.map(function(e){return e.gwpBlockId}),h=r.filter(function(e){return e.properties&&e.properties._giftWithPurchase&&"true"===e.properties._giftWithPurchase&&m.includes(e.properties._gwpBlockId)}),f=function(e){return!(!p||!p.length)&&p.includes(e)},g=s.filter(function(e){if(h[0]){var t=h[0].properties._gwpBlockId,n=h.filter(function(t){return t===e.gwpBlockId});if(!u&&n.length>1)return!1;if(!l&&e.gwpBlockId!==t)return!1}var o=function(t){var n=e[t].thresholdType;if("amount"===n){var o=!e[t].collection||i.isCollectionMatched(e[t].collection,r),a=e[t].tieThresholdToCollection,s=r.reduce(function(r,n){return f(n.handle)||a&&!i.checkForEligibleProduct(e[t].collection,n)||Boolean(n.properties&&n.properties._giftWithPurchase)?r:r+n.line_price},0,0),c=e[t].threshold,l=e[t].maxThreshold;window.Shopify.currency.rate&&"1"!==window.Shopify.currency.rate&&(c=100*Math.ceil(c/100*window.Shopify.currency.rate),l&&(l=100*Math.ceil(l/100*window.Shopify.currency.rate)));var d=s>=c,m=!l||s<l,h=r.filter(function(t){return e.gwpProducts.includes(t.handle)&&t.properties&&t.properties._giftWithPurchase&&"true"===t.properties._giftWithPurchase}),g=d&&m&&o;return!(!g||0!==h.length&&!u)}var v=r.filter(function(e){return!e.properties||!e.properties._giftWithPurchase});e[t].collection&&(v=v.filter(function(r){return i.checkForEligibleProduct(e[t].collection,r)})),p&&p.length&&(v=v.filter(function(e){var t=e.handle;return!f(t)}));var y=v.reduce(function(e,t){return e+t.quantity},0),w=y>=e[t].threshold,_=!e[t].maxThreshold||y<e[t].maxThreshold,S=r.filter(function(t){return e.gwpProducts.includes(t.handle)&&t.properties&&t.properties._giftWithPurchase&&"true"===t.properties._giftWithPurchase}),b=w&&_&&v.length;return!(!b||0!==S.length&&!u)},a=o("rule1"),s=!e.enableRule2||o("rule2"),c=!e.enableRule3||o("rule3");return a&&s&&c});this.gwpProgressBar(e);var v=[],y=r.filter(function(e){var t=e.properties&&e.properties._giftWithPurchase&&"true"===e.properties._giftWithPurchase;if(!t)return!1;var n=s.some(function(t){return t.gwpProducts.includes(e.handle)});if(!n)return!0;v.push(e.properties._gwpBlockId);var o=v.filter(function(t){return t===e.properties._gwpBlockId});if(!u&&o.length>1)return!0;
14if(!l&&e.properties._gwpBlockId!==v[0])return!0;var a=s.some(function(t){var n=function(n){var o=t[n].thresholdType;if("amount"===o){var a=t.gwpProducts.includes(e.handle),s=!t[n].collection||i.isCollectionMatched(t[n].collection,r),c=t[n].tieThresholdToCollection,u=r.reduce(function(e,r){return f(r.handle)||c&&!i.checkForEligibleProduct(t[n].collection,r)||Boolean(r.properties&&r.properties._giftWithPurchase)?e:e+r.line_price},0),l=t[n].threshold,d=t[n].maxThreshold;window.Shopify.currency.rate&&"1"!==window.Shopify.currency.rate&&(l=100*Math.ceil(l/100*window.Shopify.currency.rate),d&&(d=100*Math.ceil(d/100*window.Shopify.currency.rate)));var m=u>=l,h=!d||u<d,g=a&&m&&h&&s;return!!g}var v=t.gwpProducts.includes(e.handle),y=r.filter(function(e){return!(e.properties&&e.properties._giftWithPurchase)});t[n].collection&&(y=y.filter(function(e){return i.checkForEligibleProduct(t[n].collection,e)})),p&&p.length&&(y=y.filter(function(e){var t=e.handle;return!f(t)}));var w=y.reduce(function(e,t){return e+t.quantity},0),_=w>=t[n].threshold,S=!t[n].maxThreshold||w<t[n].maxThreshold,b=v&&_&&S&&y.length;return!!b},o=n("rule1"),a=!t.enableRule2||n("rule2"),s=!t.enableRule3||n("rule3");return o&&a&&s});return!a});
14if(u&&s.forEach(function(e){var t=r.filter(function(t){if(e.maxProducts&&!isNaN(e.maxProducts))return t.properties&&"true"===t.properties._giftWithPurchase&&t.properties._gwpBlockId===e.gwpBlockId&&e.gwpProducts.includes(t.handle)});if(t.length>e.maxProducts){var i=t.length-e.maxProducts,n=t.slice(0,i);n.forEach(function(e){var t=y.some(function(t){return t.id===e.id});t||y.push(e)})}}),y.length>0)return this.removeItems(y),Promise.resolve();var w=1===g.length?g[0].heading:c,_=[].concat(_toConsumableArray(new Set(g.map(function(e){return e.gwpProducts}).flat()))),S=[];g.forEach(function(e){e.gwpProducts.forEach(function(t){S.find(function(e){var i=e.gwp;return i===t})||S.push({gwpOfferId:e.gwpOfferId,gwpBlockId:e.gwpBlockId,autoAddGwp:e.autoAddGwp,gwpAutoCollapse:e.gwpAutoCollapse,gwpOfferName:e.gwpOfferName,gwp:t})})});var b=[],k=function(){var i=_asyncToGenerator(regeneratorRuntime.mark(function i(){var o,a,s,c,u,l,d;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:o=r.filter(function(e){var t=e.properties&&e.properties._giftWithPurchase&&"true"===e.properties._giftWithPurchase;return!!t}),a=!0,s=!1,c=void 0,i.prev=4,u=o[Symbol.iterator]();case 6:if(a=(l=u.next()).done){i.next=15;break}if(d=l.value,d.properties._gwpBlockId&&b.push(d.properties._gwpBlockId),window.sessionStorage.getItem("removedGWP:"+d.variant_id)&&window.sessionStorage.removeItem("removedGWP:"+d.variant_id),!n["Removed GWP "+d.variant_id]){i.next=12;break}return i.delegateYield(regeneratorRuntime.mark(function i(){var r,n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=Object.assign(e.attributes,_defineProperty({},"Removed GWP "+d.variant_id,null)),n=function(){return new Promise(function(e){$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{attributes:r},dataType:"JSON",success:function(){return e()}})})},t.next=4,n();case 4:case"end":return t.stop()}},i,t)})(),"t0",12);case 12:a=!0,i.next=6;break;case 15:i.next=21;break;case 17:i.prev=17,i.t1=i.catch(4),s=!0,c=i.t1;case 21:i.prev=21,i.prev=22,!a&&u.return&&u.return();case 24:if(i.prev=24,!s){i.next=27;break}throw c;case 27:return i.finish(24);case 28:return i.finish(21);case 29:case"end":return i.stop()}},i,t,[[4,17,21,29],[22,,24,28]])}));return function(){return i.apply(this,arguments)}}();return k().then(function(){if(_.length>0){var e=_.map(function(e){return new Promise(function(t,i){var r=sessionStorage.getItem("__offer:"+e),n=S.find(function(t){var i=t.gwp;return i===e}),o=n.autoAddGwp,a=n.gwpBlockId,s=n.gwpAutoCollapse,c=n.gwpOfferName,u=n.gwpOfferId;if(r)return void t([JSON.parse(r),o,a,s,c,u]);var l=window.location.origin+"/products/"+e+".js",d={headers:{"Content-Type":"application/json"}};fetch(l,d).then(function(e){return e.ok?e.json():null}).then(function(i){i&&sessionStorage.setItem("__offer:"+e,JSON.stringify(i)),t([i,o,a,s,c,u])}).catch(function(){t([null,o,a,s,c,u])})})});return Promise.all(e).then(function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(o){var a,s,c,u,l,d,p,m,h,f,g,v,y,_,S,k,C,I,O,P,E,A,L,q,T,x,M,N,j;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(a=o.map(function(e){return e[0]}),s=o.map(function(e){return e[1]}),c=o.map(function(e){return e[2]}),u=o.map(function(e){return e[3]}),l=o.map(function(e){return e[4]}),d=o.map(function(e){return e[5]}),p=[],m=[],h=[],f=[],g=[],v=[],a.forEach(function(e,t){e&&e.available&&(p.push(e),m.push(s[t]),h.push(c[t]),f.push(u[t]),g.push(l[t]),v.push(d[t]))}),y=r.filter(function(e){return e.properties&&e.properties._giftWithPurchase}),_=[],p=p.filter(function(e,t){var i=y.every(function(t){var i=e.variants.map(function(e){return e.id});return!i.includes(t.id)});return i||_.push(t),i}),_.length&&(S=function(e,t){return!_.includes(t)},m=m.filter(S),h=h.filter(S),f=f.filter(S),g=g.filter(S),v=v.filter(S)),k=!1,C=[],I=[],O=[],P=0;P<p.length;P++)E=p[P],A=m[P],L=h[P],q=f[P],T=g[P],x=v[P],E.properties=E.properties||{},E.properties._gwpBlockId=L,E.properties._gwpOfferId=x,E.properties._gwpAutoCollapse=q||!1,T&&T.length&&(E.properties._gwpOfferName=T),C.push({gwpItem:E,autoAddGwp:A,blockId:L}),I.push(E),M=n["Removed GWP "+E.variants[0].id]||window.sessionStorage.getItem("removedGWP:"+E.variants[0].id),M&&O.push(L);if(C=C.filter(function(e){var t=e.blockId;return!O.includes(t)||b.includes(t)}),!C.length){e.next=32;break}i.toggleLoaderOverlay(!0),N=regeneratorRuntime.mark(function e(i){var r,n,o,a,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=C[i],n=r.autoAddGwp,o=r.gwpItem,a=r.blockId,s=y.filter(function(e){return e.properties._gwpBlockId===a}),k||!n||s.length){e.next=6;break}return e.next=5,t.handleGWPAddToCartPromise(o);case 5:k=!0;case 6:case"end":return e.stop()}},e,t)}),j=0;case 27:if(!(j<C.length)){e.next=32;break}return e.delegateYield(N(j),"t0",29);case 29:j++,e.next=27;break;
14case 32:k?t.giftWithPurchaseProducts=[]:(t.giftWithPurchaseProducts=I.filter(function(e){return e.variants&&e.variants.length>0}),t.gwpAutoCollapse=!(!t.giftWithPurchaseProducts[0]||!t.giftWithPurchaseProducts[0].properties)&&t.giftWithPurchaseProducts[0].properties._gwpAutoCollapse,t.giftWithPurchaseHeading=w); 15case 33:case"end":return e.stop()}},e,t)}));return function(t){return e.apply(this,arguments)}}())}t.giftWithPurchaseProducts=[]}).catch(function(e){console.error("GWP check failed:",e)}).finally(function(){i.toggleLoaderOverlay(!1)})},gwpCleanUp:function(e){var t=e.items,i=t.filter(function(e){return e.properties&&e.properties._giftWithPurchase});return i&&i.length?void this.removeItems(i):void this.toggleLoaderOverlay(!1)},handleGWPAddToCart:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{resolve:null,reject:null};if(!e||0==e.available)return window.console.log("No item"),void(r.resolve&&r.resolve());var n=e.variants.find(function(e){return e.id===t})||e.variants.find(function(e){return 1==e.available})||e.variants[0];if(window.gwpAddError=window.gwpAddError||[],!n||!n.available||window.gwpAddError.includes(n.id))return void(r.resolve&&r.resolve());this.addItem({id:n.id,product_id:e.id,quantity:1,properties:{_giftWithPurchase:!0,_gwpBlockId:e.properties._gwpBlockId,_gwpOfferId:e.properties._gwpOfferId,_gwpOfferName:e.properties._gwpOfferName},title:e.title,url:e.url,image:e.featured_image,vendor:e.vendor,price:Number(n.price),compare_price:Number(n.compare_at_price),collections:e.collections?e.collections:[],sku:n.sku},0,"","",r);var o={event:"cartOffersAddToCart",productTitle:n.sku+" - "+e.title,value:e.price/100};i&&(o.type=i),window.dataLayer.push(o)},handleGWPAddToCartPromise:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new Promise(function(r,n){t.handleGWPAddToCart(e,i,null,{resolve:r,reject:function(t){window.gwpAddError=window.gwpAddError||[];var r=e.variants.find(function(e){return e.id===i})||e.variants.find(function(e){return 1==e.available})||e.variants[0];r&&window.gwpAddError.push(r.id),n(t)}})})},gwpProgressBar:function(e){function t(e){return(s.giftWithPurchase&&s.giftWithPurchase.productsExcluded||[]).indexOf(e)!==-1}function i(e){return e&&e.properties&&"string"==typeof e.properties._collections?e.properties._collections.split(",").map(function(e){return e.trim()}):[]}function r(e,t){for(var r=i(t),n=0;n<e.length;n++)if(r.indexOf(e[n])!==-1)return!0;return!1}function n(e,i){for(var n=0,o=0;o<e.length;o++){var a=e[o];t(a.handle)||i&&i.length&&!r(i,a)||(n+=a.line_price)}return n}function o(e,i){for(var n=0,o=0;o<e.length;o++){var a=e[o];t(a.handle)||i&&i.length&&!r(i,a)||(n+=a.quantity)}return n}function a(e){for(var t=["rule1","rule2","rule3"],i=null,r=null,n=null,o=null,a=0;a<t.length;a++){var s=e[t[a]];s&&("amount"===s.thresholdType&&(isNaN(s.threshold)||(null===i||s.threshold<i)&&(i=s.threshold),isNaN(s.maxThreshold)||""===s.maxThreshold||(null===r||s.maxThreshold>r)&&(r=s.maxThreshold)),"quantity"===s.thresholdType&&(isNaN(s.threshold)||(null===n||s.threshold<n)&&(n=s.threshold),isNaN(s.maxThreshold)||""===s.maxThreshold||(null===o||s.maxThreshold>o)&&(o=s.maxThreshold)))}return{minAmount:i,maxAmount:r,minQty:n,maxQty:o}}for(var s=this,c=this.giftWithPurchase.offers,u=window.theme.currentCurrencySymbol?window.theme.currentCurrencySymbol:"$",l=c.map(function(e){var t=a(e);return e.minAmount=t.minAmount,null!==e.minAmount&&window.Shopify.currency.rate&&"1"!==window.Shopify.currency.rate&&(e.minAmount=Math.ceil(t.minAmount*window.Shopify.currency.rate)),e.maxAmount=t.maxAmount,null!==e.maxAmount&&window.Shopify.currency.rate&&"1"!==window.Shopify.currency.rate&&(e.maxAmount=Math.ceil(t.maxAmount*window.Shopify.currency.rate)),e.minQty=t.minQty,e.maxQty=t.maxQty,e.maxThreshold=e.maxAmount||t.maxQty||0,e}),d=l.sort(function(e,t){var i=null!=e.minAmount?e.minAmount:e.minQty,r=null!=t.minAmount?t.minAmount:t.minQty;return i-r}),p=d.filter(function(e){return e.gwpProductsDetailed.length>0}),m=[],h=!0,f=0,g=0;g<p.length;g++){for(var v=p[g],y=["rule1","rule2","rule3"],w=!1,_=0,S=null,b=!1,k=0;k<y.length;k++){var C=v[y[k]];if(C&&C.tieThresholdToCollection&&C.collection&&C.collection.length>0){b=!0,S=C.collection;break}}var I=n(e.items,b?S:null),O=o(e.items,b?S:null),P=!1,E=!1;null!==v.minAmount&&(P=I>=v.minAmount),null!==v.maxAmount&&(P=P&&I<=v.maxAmount),null===v.minAmount&&null===v.maxAmount&&(P=!0),null!==v.minQty&&(E=O>=v.minQty),null!==v.maxQty&&(E=E&&O<=v.maxQty),null===v.minQty&&null===v.maxQty&&(E=!0),w=P&&E;var A=I-f,L=v.minAmount-f;h?v.minAmount>0?(_=A/L*100,_=Math.max(0,Math.min(100,_))):_=100:_=0,v.offerUnlocked=w,v.barCompleted=_,v.cartTotal=s.removeCurrencySymbol(s.formatMoney(I)),h=100===v.barCompleted,v.productInCartExist=!1;var q=0;v.enableAtcButton=!0,v.gwpProductsDetailed.forEach(function(t){t.productInCart=!1,t.variants=t.variants.filter(function(e){return 1==e.available}
15),t.variants.forEach(function(i){e.items.forEach(function(e){i.id===e.id&&e.properties&&e.properties._gwpBlockId==v.gwpBlockId&&(t.productInCart=!0,q+=1,t.cartItem=e,v.productInCartExist=!0)})})}),0==this.giftWithPurchase.multiEnabled&&1==v.productInCartExist?v.enableAtcButton=!1:0==v.autoAddGwp&&1==this.giftWithPurchase.multiEnabled&&q>=v.maxProducts&&(v.enableAtcButton=!1),1==v.autoAddGwp&&v.gwpProductsDetailed.length>1&&(v.gwpProductsDetailed.length=1),f=v.minAmount||0,v.thresholdAmountFormatted='<em class="currency-symbol">'+u+"</em>"+s.removeCurrencySymbol(s.formatMoney(v.minAmount||0))+(v.maxAmount?' - <em class="currency-symbol">'+u+"</em>"+s.removeCurrencySymbol(s.formatMoney(v.maxAmount)):""),v.thresholdFormatted='<em class="currency-symbol">'+u+"</em>"+v.cartTotal+" / "+v.thresholdAmountFormatted,m.push(v)}!s.giftWithPurchase.multiQualificationEnabled&&m.length>1&&(m.length=1),1==m.length&&0==m[0].offerUnlocked&&(m.length=0),this.giftWithPurchaseRules=m},addGWPItemToCart:function(e,t){if(e){var i=t.gwpBlockId,r=t.gwpOfferName;e.properties=e.properties||{},e.properties._gwpBlockId=i,e.properties._gwpOfferId=t.gwpOfferId,r&&r.length&&(e.properties._gwpOfferName=r);var n=e.variants[0];this.addItem({id:n.id,product_id:e.id,quantity:1,properties:{_giftWithPurchase:!0,_gwpBlockId:e.properties._gwpBlockId,_gwpOfferId:e.properties._gwpOfferId,_gwpOfferName:e.properties._gwpOfferName},title:e.title,url:e.url,image:e.featured_image,vendor:e.vendor,price:Number(n.price),compare_price:Number(n.compare_at_price),collections:e.collections?e.collections:[],sku:n.sku},0,"",""),window.dataLayer=window.dataLayer||[];var o={event:"cartOffersAddToCart",productTitle:n.sku+" - "+e.title,value:e.price/100};window.dataLayer.push(o)}},freeShippingCheck:function(){var e=this.getActiveCurrency();if(e){var t=Object.entries(window.theme.settings).filter(function(e){var t=_slicedToArray(e,2),i=t[0],r=t[1];return r&&(i.includes("free_shipping_currency_")||i.includes("free_shipping_amount_"))}),i=t.find(function(t){var i=_slicedToArray(t,2),r=(i[0],i[1]);return r===e});if(i){var r=i[0].replace("free_shipping_currency_",""),n="free_shipping_amount_"+r,o=t.find(function(e){var t=_slicedToArray(e,1),i=t[0];return i===n});o&&(this.isFreeShipping=!0,this.getFreeShippingMessage())}}},checkNoFreeShippingCountry:function(){var e=window.sessionStorage.getItem("country"),t=window.theme&&window.theme.settings&&window.theme.settings.hide_free_shipping_countries&&window.theme.settings.hide_free_shipping_countries.split(",");if(t&&t.length){var i=t.includes(e);this.isFreeShipping=!i}},getActiveCurrency:function(){var e=window.Shopify&&window.Shopify.currency&&window.Shopify.currency.active,t=window.Cookies.get("cart_currency");return e||t||null},getFreeShippingAmount:function(){var e=this.getActiveCurrency();if(e){var t=Object.entries(window.theme.settings).filter(function(e){var t=_slicedToArray(e,2),i=t[0],r=t[1];return r&&(i.includes("free_shipping_currency_")||i.includes("free_shipping_amount_"))}),i=t.find(function(t){var i=_slicedToArray(t,2),r=(i[0],i[1]);return r===e});if(i){var r=i[0].replace("free_shipping_currency_",""),n="free_shipping_amount_"+r,o=t.find(function(e){var t=_slicedToArray(e,1),i=t[0];return i===n});if(o)return o[1]}}},loadUpsellProducts:function(){if("xgen"!==window.theme.upsells.type){var e=document.querySelector(".cart-product-recommendations");
15if(null!==e){var t=Number(e.dataset.limit);if(!(t<=0)){var i=e.dataset.productId,r=""+window.location.origin+window.Shopify.routes.root+"recommendations/products?section_id=cart-product-recommendations&limit="+t+"&product_id="+i;fetch(r).then(function(e){return e.text()}).then(function(t){var i=document.createElement("div");i.innerHTML=t,e.querySelector(".grid").insertAdjacentHTML("beforeend",i.querySelector(".grid").innerHTML),$(".cart-recommended-products").slick({accessibility:!1,arrows:!0,infinite:!1,slidesToShow:5,slidesToScroll:5,swipeToSlide:!0,rows:0,responsive:[{breakpoint:Number(theme.settings.grid_large),settings:{arrows:!1,slidesToShow:1,slidesToScroll:1,variableWidth:!0}}]});var r=".product-card__badge";theme.CurrencySwitcher.switchCurrency(r)}).catch(function(e){console.error(e)})}}}},reloadCart:function(){for(var e=this.cart.items,t=e.length,i=0,r=0,n=0;n<t;n++)i+=Number(e[n].quantity),r+=e[n].quantity*e[n].price;this.cart.item_count=i,this.cart.total_price=r,clearTimeout(this.timeout),this.timeout=setTimeout(this.updateCart.bind(this),500)},updateCartItemsEvent:function(){var e=this;this.quantitySelectors.length>0&&(this.quantitySelectors.forEach(function(e){return e.destroy()}),this.quantitySelectors=[]),document.querySelectorAll("[data-component=QuantitySelector]").length>0&&document.querySelectorAll("[data-component=QuantitySelector]").forEach(function(t){e.quantitySelectors.push(new theme[t.dataset.component](t))}),theme.currencyConverter===!0&&Currency.convertAll&&"true"===theme.currencyConverter&&Currency.convertAll(theme.currency,Currency.currentCurrency)},getProductMetafieldsInfo:function(){function e(e){return"true"===e||"false"!==e&&""!==e&&e}try{var t=document.querySelector("#active-sfs-container").dataset.activeSfsValue,i=t.split(","),r=i.map(function(e){return e.trim()}),n=r.reduce(function(t,i){var r=i.split(":").map(function(e){return e.trim().replace(/"/g,"")}),n=_slicedToArray(r,2),o=n[0],a=n[1];return t[o]=e(a),t},{});return n}catch(e){return{}}},getProductInventoryInfo:function(){try{var e=[],t=document.querySelector("#variant-inventory-quantity-container");if(t){var i=t.dataset.variantInventoryQuantityValue;if(i){var r=i.replace(/,+$/,""),n=r.split(",");n.forEach(function(t){var i=t.split(":");if(2===i.length){var r={item_id:i[0].trim(),quantity:parseInt(i[1].trim(),10)};e.push(r)}})}}return e}catch(e){return[]}},toggleDrawer:function(e){if(e&&e.preventDefault(),this.isVisible)this.closeDrawer(e);else{if("cart"===theme.template.template)return;this.openDrawer(e),this.viewCartEvent()}},openDrawer:function(e){"cart"!==theme.template.template&&(window.theme.lastActiveElement=document.activeElement,e&&e.preventDefault(),document.body.classList.add("cart-is-visible"),this.isVisible=!0,this.$el.setAttribute("aria-hidden","false"),this.$el.querySelector(".side-cart__close")&&this.$el.querySelector(".side-cart__close").focus(),$(document).on("keydown:escape",this.closeDrawer.bind(this)))},viewCartEvent:function(){var e=0,t=this.cart.items.map(function(t,i){return e+=Number(t.price)/100,{item_id:t.sku,item_name:t.title,index:i+1,item_brand:"Lovisa",item_category:t.type,price:Number(t.price)/100,quantity:t.quantity}}),i=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),r=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),n=r.menu_navigation_state||{};window.pushEvent({event:"view_cart",menu_navigation_state:n,ecommerce:Object.assign(i,{items:t,value:Number(e.toFixed(2))})},"ecommerce")},closeDrawer:function(e){e&&e.preventDefault(),document.body.classList.remove("cart-is-visible"),this.isVisible=!1,this.errorMessage="",this.$el&&this.$el.setAttribute&&this.$el.setAttribute("aria-hidden","true"),this.destroyUpsellSlider(),$(document).off("keydown:escape",this.closeDrawer.bind(this)),window.theme.lastActiveElement&&(window.theme.lastActiveElement.focus(),window.theme.lastActiveElement=null)},updateCart:function(){var e=this,t=this,i=this.cart.items.slice(0),r=i.length,n={},o=0,a=[],s=[];i.forEach(function(e){s.push(e.variant_id)});var c=[],u=[].concat(_toConsumableArray(new Set(s))),l=!1,d=0;if(u.forEach(function(t){for(var a=0;a<r;a++)parseInt(t,10)===i[a].variant_id&&(o+=i[a].quantity,0===i[a].quantity&&(l=!0,d=a));c.push(o),n[t]=o,l&&e.cart.items.splice(d,1),o=0,l=!1,d=0}
15),i.forEach(function(e){a.push(e.quantity)}),!this.cache){this.cache=n;var p=localStorage.getItem("multibuy"),m=[],h=0;if(p){var f=p.split(",");f.forEach(function(t){e.cart.items.forEach(function(e){e.properties&&e.properties._offer&&e.properties._offer===t.split(":")[0]&&(h+=e.quantity)}),h>0&&m.push(t.split(":")[0]+":"+h),h=0});try{localStorage.setItem("multibuy",m.join(","))}catch(e){console.warn("Failed to set multibuy in localStorage:",e)}}t.multibuyCheck(this.cart),t.cartOfferCheck()}JSON.stringify(n)!==JSON.stringify(this.cache)&&(this.cache=n,$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:a},dataType:"JSON",success:function(e){t.errorMessage="";var i=localStorage.getItem("multibuy"),r=[],n=0;if(i){var o=i.split(",");o.forEach(function(t){e.items.forEach(function(e){e.properties&&e.properties._offer&&e.properties._offer===t.split(":")[0]&&(n+=e.quantity)}),n>0&&r.push(t.split(":")[0]+":"+n),n=0});try{localStorage.setItem("multibuy",r.join(","))}catch(e){console.warn("Failed to set multibuy in localStorage:",e)}}t.multibuyCheck(e),t.cartOfferCheck()},complete:function(){e.onCartUpdated()},error:function(e){console.error("Error updating",e),t.refreshCart()}}))},onCartUpdated:function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.enableBopis&&"click-and-collect"===this.selectedDeliveryMethod?this.refreshStockData("click-and-collect",!0):this.enableBopis&&"shipping"===this.selectedDeliveryMethod&&this.refreshStockData("shipping",!1);var e=document.querySelectorAll(".header__cart-count"),t=document.querySelector(".bag-icon-empty"),i=document.querySelector(".bag-icon-full");if(this.cart.item_count>0){if(e.length>0)for(var r=0;r<e.length;r++)e[r].classList.remove("hide");t&&t.classList.add("hide"),i&&i.classList.remove("hide")}else{if(e.length>0)for(var n=0;n<e.length;n++)e[n].classList.contains("always-show")||e[n].classList.add("hide");t&&t.classList.remove("hide"),i&&i.classList.add("hide"),this.closeDrawer()}if(e.length>0)for(var o=0;o<e.length;o++)e[o].innerHTML=this.cart.item_count;this.updateDiscountedItems(),this.updateCartItemCount(),this.toggleLoaderOverlay(!1)},updateDiscountedItems:function(e){function t(e,t,i){var r=document.querySelectorAll(t);e.compare_at_price>e.price?r.forEach(function(t){var r=e.compare_at_price*e.quantity;"cp_only"==i&&(r=e.compare_at_price);var o=window.theme.currentCurrencySymbol?window.theme.currentCurrencySymbol:"$",a=n.enableBopis?'<s class="cart-item__price"><em class="currency-symbol">'+o+"</em>"+n.displayItemPriceOnlyNum(Number(r))+"</s>":'<s class="cart-item__price">'+n.formatMoney(Number(r))+"</s>";t.innerHTML=a}):e.original_price>e.price&&!e.compare_at_price?r.forEach(function(t){var i=e.original_price*e.quantity,r=window.theme.currentCurrencySymbol?window.theme.currentCurrencySymbol:"$",o=n.enableBopis?'<s class="cart-item__price"><em class="currency-symbol">'+r+"</em>"+n.displayItemPriceOnlyNum(Number(i))+"</s>":'<s class="cart-item__price">'+n.formatMoney(Number(i))+"</s>";t.innerHTML=o}):r.forEach(function(e){e.innerHTML=""})}function i(e,t){var i=document.querySelectorAll(t);n.enableBopis&&e.compare_at_price>e.price?i.forEach(function(t){var i=Math.round(100*(1-e.price/e.compare_at_price));t.innerHTML="(-"+i+"%)"}):i.forEach(function(e){e.innerHTML=""})}var r=this,n=this;this.abortController.abort("script"),this.abortController=new AbortController,fetch("/cart?view=json",{signal:this.abortController.signal}).then(function(e){return e.json()}).then(function(e){n.totalDiscount=e.total_cart_discount;var o=e.items;r.discountCartItems=e.items;var a=o.length;a&&o.forEach(function(e){var r=document.querySelector('[data-promoItem="'+e.key+'"]');if(r)if(e.promo_status&&1==e.promo_status){var o=e.promo_text||"";r.innerHTML='<a href="'+e.promo_collection_url+'" style="color:'+e.promo_text_color+'" class="promo_callout" data-text="'+o.replace(/\"|\'/g,"").replace(/\s/g,"")+'" data-currency="'+window.theme.currentCurrency+'">\n <svg class="plp-promo-img" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">\n <path d="M3.65389 9.52002L2.72989 6.95802C2.61322 7.00469 2.30709 7.10922 1.73589 7.32202C1.0079 7.61602 1.03359 8.13402 1.06389 8.28802C1.1059 8.66602 1.4979 9.59059 1.67989 9.75802C1.92337 9.98202 2.45922 9.94002 2.67389 9.87002L3.65389 9.52002Z" fill="currentColor"/>\n <path d="M4.0879 9.35202L3.1639 6.79002C4.4855 6.29722 5.92657 4.87669 6.4819 4.22802C6.94857 5.52535 7.9631 8.33282 8.2879 9.18402C6.585
155 8.87042 4.77857 9.16535 4.0879 9.35202Z" fill="currentColor"/>\n <path d="M4.3679 9.73002L3.0799 10.192C3.4719 10.57 4.3063 11.3792 4.5079 11.592C4.7179 11.858 4.9979 11.886 5.1799 11.774C5.3927 11.6172 5.34324 11.3634 5.2919 11.256L4.3679 9.73002Z" fill="currentColor"/>\n <path d="M7.0839 3.24802C6.7591 3.36002 6.7619 3.68669 6.8039 3.83602C7.42924 5.54869 8.7023 9.04122 8.7919 9.31002C8.8899 9.52002 9.1979 9.63202 9.4079 9.53402C9.6543 9.42202 9.6879 9.15135 9.6739 9.03002C9.06724 7.36869 7.8147 3.93962 7.6579 3.51402C7.5739 3.30402 7.3219 3.16402 7.0839 3.24802Z" fill="currentColor"/>\n <path d="M11.0422 2.24694C11.1472 2.02294 11.0492 1.74994 10.8322 1.64494C10.6152 1.53994 10.3352 1.64494 10.2302 1.86194L9.64217 3.09394C9.53717 3.31794 9.63517 3.58394 9.85217 3.69594C10.0692 3.80794 10.3492 3.70994 10.4542 3.48594L11.0422 2.25394V2.24694Z" fill="currentColor"/>\n <path d="M11.4761 4.613C11.2451 4.697 11.1261 4.95599 11.2031 5.18699C11.2801 5.41799 11.5461 5.544 11.7771 5.46L13.0441 5.005C13.2751 4.928 13.4011 4.66199 13.3171 4.43099C13.2331 4.20699 12.9741 4.08099 12.7431 4.15799L11.4691 4.60599L11.4761 4.613Z" fill="currentColor"/>\n <path d="M12.5401 8.38602C12.7641 8.49102 13.0371 8.39302 13.1421 8.17602C13.2471 7.95902 13.1421 7.67902 12.9251 7.57402L11.6931 6.98602C11.4691 6.88102 11.1961 6.97202 11.0911 7.19602C10.9861 7.42002 11.0841 7.69302 11.3011 7.79802L12.5331 8.38602H12.5401Z" fill="currentColor"/>\n </svg>\n <span>'+theme.CurrencySwitcher.getCurrencyHTML(o)+"</span>\n </a>"}else r.innerHTML="";t(e,'[data-litcp="'+e.key+'"]',"total_cp"),n.enableBopis&&i(e,'[data-li-discount-percent="'+e.key+'"]',"discount_percent")})}).catch(function(e){"script"==e||"AbortError"===e.name||console.error(e)});var o=this.totalDiscount>0?this.formatMoney(Number(this.totalDiscount)):0;return o},addItems:function(e){function t(){var i=this,o=r.pop();n.cart.items?n.cart.items.unshift(o):n.cart.items=[o],$.ajax({url:window.Shopify.routes.root+"cart/add.js",type:"POST",data:{id:o.id,quantity:o.quantity,properties:o.properties},dataType:"JSON",success:function(){var i=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),a=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),s=a.menu_navigation_state||{};window.pushEvent({event:"add_to_cart",menu_navigation_state:s,ecommerce:Object.assign(i,{value:Number(o.price)/100,items:[{item_id:o.sku,item_name:o.title,index:e.findIndex(function(e){return e.sku===o.sku}),item_brand:"Lovisa",item_category:o.type,price:Number(o.price)/100,quantity:o.quantity}]})},"ecommerce"),window.theme.checkPageReload(),r.length?t():n.refreshCart()},error:function(e){console.error("Error updating cart when add item: ",e),i.toggleLoaderOverlay(!1),"development"===window.theme.env&&e.status&&200!==e.status&&alert("[DEV Alert] Cart error: "+JSON.stringify(e.responseText))}})}var i=this,r=[];e.forEach(function(e){var t=!1;void 0!==e.properties&&e.properties._offer&&(t=!0);var n=-1;if(n=t?i.cart.items.findIndex(function(t){return t.id===e.id&&t.properties._offer===e.properties._offer}):i.cart.items.findIndex(function(t){return t.id===e.id}),n>-1)if(t){if(i.cart.items[n].properties&&i.cart.items[n].properties._offer===e.properties._offer&&i.cart.items[n].id===e.id&&i.cart.items[n].quantity+e.quantity>e.max)return void(i.errorMessage="There is no more stock for that item.")}else if(i.cart.items[n].quantity+e.quantity>e.max)return void(i.errorMessage="There is no more stock available for that item");return e.quantity>e.max?void(i.errorMessage="There is no more stock for that item."):(i.errorMessage="",void r.push(e))});var n=this;this.toggleLoaderOverlay(!0),r.length&&t()},addItem:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{resolve:null,reject:null},o=!1,a=!1;if(void 0!==e.properties&&e.properties._offer&&(o=!0),void 0!==e.properties&&e.properties._greeting&&e.properties._receiving_email&&(a=!0),this.cart.items)for(var s=0,c=this.cart.items.length;s<c;s++)if(o){if(this.cart.items[s].properties&&this.cart.items[s].properties._offer===e.properties._offer&&this.cart.items[s].id===e.id&&this.cart.items[s].quantity+e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1)}else if(a){if(this.cart.items[s].properties&&this.cart.items[s].properties._greeting===e.properties._greeting&&this.cart.items[s].properties._receiving_email===e.properties._receiving_email&&this.cart.items[s].id===e.id&&this.cart.items[s].quantity+e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1)}else if(this.cart.items[s].id===e.id&&this.cart.items[s].quantity+e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1);if(e.quantity>e.max)return this.errorMessage="There is no more stock for that item.",void this.toggleLoaderOverlay(!1);this.toggleLoaderOverlay(!0),this.cart.items?this.cart.items.unshift(e):this.cart.items=[e],this.errorMessage="";var u=this;$.ajax({type:"POST",url:"/cart/add.js",data:{id:e.id,quantity:e.quantity,properties:e.properties},dataType:"JSON",error:function(e){console.error("Error updating cart:",e),n.reject&&n.reject(e),"development"===window.theme.env&&e.status&&200!==e.status&&alert("[DEV Alert] Cart error: "+JSON.stringify(e.responseText))},complete:function(){var o=void 0;if(localStorage.getItem("ga-select-item")){var a=JSON.parse(localStorage.getItem("ga-select-item"));i=a.itemListId,r=a.itemListName,t=a.index,o=a.itemCategory}var s={item_id:e.sku,item_name:e.title,index:t,item_brand:"Lovisa",item_category:e.type||o,price:Number(e.price)/100,quantity:e.quantity};i&&(s.item_list_id=i),r&&(s.item_list_name=r);var c=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),l=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),d=l.menu_navigation_state||{};window.pushEvent({event:"add_to_cart",menu_navigation_state:d,ecommerce:Object.assign(c,{value:Number(e.price)/100,items:[s]})},"ecommerce");var p=JSON.parse(localStorage.getItem("ga4-itemListImpressions")||"{}");p[e.sku]=s;try{localStorage.setItem("ga4-itemListImpressions",JSON.stringify(p))}catch(e){console.warn("Failed to set ga4-itemListImpressions in localStorage:",e)}window.theme.checkPageReload(),u.updateCartItemsEvent(),u.refreshCart(),n.resolve&&n.resolve()}})},removeItems:function(e){if(!e.length)return void this.toggleLoaderOverlay(!1);var t=e.reduce(function(e,t){var i=Object.assign(e,_defineProperty({},t.key,0));return i},{}),i=this;i.toggleLoaderOverlay(!0),$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:t},dataType:"JSON",error:function(e){console.error("Error updating cart:",e),i.toggleLoaderOverlay(!1)},complete:function(){var t=0,r=e.map(function(e,i){return t+=Number(e.price)/100,{item_id:e.sku,item_name:e.title,index:i+1,item_brand:"Lovisa",item_category:e.type,price:Number(e.price)/100,quantity:e.quantity}}),n=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),o=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),a=o.menu_navigation_state||{};window.pushEvent({event:"remove_from_cart",menu_navigation_state:a,ecommerce:Object.assign(n,{value:t,items:r})},"ecommerce"),i.updateCartItemsEvent(),i.refreshCart()}})},removeItem:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this,r=e.id;t&&(r=e.key),$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/change.js",data:{id:t?e.key:e.id,quantity:0},dataType:"JSON",error:function(e){console.error("Error updating cart:",e)},complete:function(){var t=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),r=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),n=r.menu_navigation_state||{};window.pushEvent({event:"remove_from_cart",menu_navigation_state:n,ecommerce:Object.assign(t,{value:Number(e.price)/100,items:[{item_id:e.sku,item_name:e.title,index:"1",item_brand:"Lovisa",item_category:e.type,price:Number(e.price)/100,quantity:e.quantity}]})},"ecommerce"),i.updateCartItemsEvent(),i.refreshCart()}})},removeCartItem:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];i&&i.preventDefault();var n=this,o=e&&e.key;if(!o)return void n.refreshCart(!1);var a={id:o,quantity:0},s=r?null:$.ajax({method:"GET",url:window.Shopify.routes.root+"cart.js",dataType:"json"});this.toggleLoaderOverlay(!0),$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/change.js",data:a,dataType:"JSON",success:function(t){var i=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),r=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),s=r.menu_navigation_state||{};e.variant_id&&n.giftlabExcludedProductIds.includes(e.variant_id.toString())&&location.reload(),0===t.item_count&&location.reload(),window.pushEvent({event:"remove_from_cart",menu_navigation_state:s,ecommerce:Object.assign(i,{value:Number(e.price)/100,items:[{item_id:e.sku,item_name:e.title,index:"1",item_brand:"Lovisa",item_category:e.type,price:Number(e.price)/100,quantity:e.quantity}]})},"ecommerce");var c=Array.isArray(t.items)&&t.items.some(function(e){return e.key===o});c?$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/change.js",data:a,dataType:"JSON",success:function(e){n.refreshCart(!1)}
15,error:function(e){n.handleUpdateCartError(e)}}):n.refreshCart(!1)},error:function(i){var a=i&&i.status;return r||400!==a&&404!==a||!s?void n.handleUpdateCartError(i):void s.then(function(r){var a=r&&Array.isArray(r.items)?r.items:[],s=a.filter(function(t){return String(t.variant_id)===String(e.variant_id)});1===s.length&&s[0].key!==o?n.removeCartItem(Object.assign({},e,{key:s[0].key}),t,null,!0):n.handleUpdateCartError(i)},function(){n.handleUpdateCartError(i)})}})},rerenderCart:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this,r=i.parseCartResponse(e);return r&&Array.isArray(r.items)?(i.cart=r,i.gwpProgressBar(r),i.multibuyCheck(r,t),i.getUpsellProducts(r),i.cartOfferCheck(),i.giftWithPurchaseEnabled?i.gwpPreCheck(r,t):i.giftWithPurchase&&i.gwpCleanUp(r),i.onCartUpdated(t),i.viewCartEvent(),void(i.isReady=!0)):void i.toggleLoaderOverlay(!1)},parseCartResponse:function(e){if(e.responseText&&(e=e.responseText),"object"===("undefined"==typeof e?"undefined":_typeof(e)))return e;if("string"!=typeof e&&console.warn("cartResponse is not a string",e),e.indexOf("data-side-cart-json")>-1){var t=document.createElement("div");t.innerHTML=e;var i=JSON.parse(t.querySelector("[data-side-cart-json]").innerHTML);return i}var r=JSON.parse(e);return r},refreshCart:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this;i.toggleLoaderOverlay(!0);var r=new Date;$.ajax({method:"GET",url:i.shopifyCartUrl+"&t="+r.getTime(),dataType:"application/json",complete:function(e){i.rerenderCart(e,t)},error:function(t){e.toggleLoaderOverlay(!1)}})},checkAndRefreshStockData:function(){function e(e){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var i,r,n,o,a,s,c,u=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.cart&&Array.isArray(this.cart.items)){e.next=3;break}return console.warn("Cart items not ready yet."),e.abrupt("return",t);case 3:if(i=new Set(t.map(function(e){return e.item_id})),r=this.cart.items.some(function(e){return e.sku&&!i.has(e.sku)})){e.next=7;break}return e.abrupt("return",t);case 7:return e.prev=7,n=new Map(this.cart.items.map(function(e){return[e.variant_id,e.sku]})),e.next=11,fetch(window.Shopify.routes.root+"cart?view=json");case 11:if(o=e.sent,o.ok){e.next=14;break}throw new Error("Network response was not ok");case 14:return e.next=16,o.json();case 16:return a=e.sent,s={},a.items.forEach(function(e){var t=e.variant_id,i=n.get(t);s[t]=e.max,t&&i&&u.cartItemSkuMapping.set(t,i),i&&(u.shippingStockBySkuMap[i]=e.max)}),c=this.cart.items.map(function(e){return{item_id:e.sku,quantity:s[e.variant_id]||0}}),e.abrupt("return",c);case 23:return e.prev=23,e.t0=e.catch(7),console.error(" Error fetching cart stock:",e.t0),e.abrupt("return",t);case 27:case"end":return e.stop()}},e,this,[[7,23]])}));return e}(),cartOfferCheck:function(){var e=this,t=Number(100*theme.settings.auto_gift_threshold),i=Math.round(t-this.cart.total_price)/100,r=this.cart.items.find(function(e){return e.properties&&e.properties._cartoffer}),n=this.cart.items.findIndex(function(e){return e.properties&&e.properties._cartoffer});return theme.settings.auto_gift_enable?(r&&i>0?e.removeItem(r):!r&&i<=0&&$.getJSON("/products/"+theme.settings.auto_gift_product+".js",function(t){t.available?e.addItem({id:t.variants[0].id,product_id:t.id,quantity:1,price:0,title:t.title,url:t.url,image:t.featured_image,vendor:t.vendor,properties:{_cartoffer:!0},min:1,max:1,sku:t.variants[0].sku},n):console.error("Cart error: The offer item",t.title,"is unavailable.")}),void(this.difference=i)):void(r&&e.removeItem(r))},destroyUpsellSlider:function(){var e=document.querySelector(".side-cart__upsell-container");e&&$(".side-cart__upsell").slick("unslick")},itemImage:function(e){var t=theme.assetUrl+"placeholder-portrait.svg";return e&&(t=e.src?e.src:e),slate.Image.getSizedImageUrl(t,"120x")},formatMoney:function(e){return slate.Currency.formatMoney(e,theme.moneyFormat)},productImageSrc:function(e){return e.featured_image?slate.Image.getSizedImageUrl(e.featured_image,"600x750_crop_center"):theme.assetUrl+"placeholder-portrait.svg"},productImageSrcset:function(e){if(!e.featured_image)return"placeholder-portrait.svg";var t=5/4,i=theme.settings.grid_small,r=i+"x"+Math.floor(i*t),n=slate.Image.getSizedImageUrl(e.featured_image,r+"_crop_center"),o=theme.settings.grid_medium,a=o+"x"+Math.floor(o*t),s=slate.Image.getSizedImageUrl(e.featured_image,a+"_crop_center"),c=theme.settings.grid_large,u=c+"x"+Math.floor(c*t),l=slate.Image.getSizedImageUrl(e.featured_image,u+"_crop_center");return n+" "+i+"w, "+s+" "+o+"w, "+l+" "+c+"w"},buttonText:function(e){return e?theme.strings.addToCart:theme.strings.soldOut},extractCollectionText:function(e){var t="",i="ZA"===window.theme.store,r=i?/for|[€£$¥₹]|\bR(?=\d)|[\d.]/gi:/for|[€£$¥₹]|[\d.]/gi,n=i?/\bR\d|[€£$¥₹]/.test(e):/[€£$¥₹]/.test(e);
15if(e&&(e.includes("for")||n)){var o=e.replace(r,"").trim();t=o}return""===t?null:t},multibuyCheck:function(e){ 16var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=window.theme&&window.theme.multibuy_offer_discounts||[],n=[],o=[],a=[],s=[],c={};e.items.forEach(function(e){e.offers&&e.offers.length>0&&(e.offers=e.offers.filter(function(e){if(r.length>0){var t=r.find(function(t){return e.discount_key&&t.discount_key===e.discount_key||e.collection_handle&&t.collectionHandle===e.collection_handle||e.collectionHandle&&t.collectionHandle===e.collectionHandle||e.title&&t.title===e.title});if(t&&(t.active===!1||"false"===t.active))return!1}return!0}))}),e.items.forEach(function(e){var t=0===e.final_price||e.properties&&(e.properties._giftWithPurchase||e.properties._cartoffer||e.properties._gwpOfferId),i=!t&&e.offers&&e.offers[0],r=i&&i.active!==!1&&"false"!==i.active?i:null;r&&(c[r.key]||(c[r.key]={key:r.key,offerQuantity:r.quantity,totalItemQuantity:0,items:[]}),c[r.key].totalItemQuantity+=e.quantity,c[r.key].items.push(e))}),Object.values(c).forEach(function(e){var t=Math.floor(e.totalItemQuantity/e.offerQuantity)*e.offerQuantity,i=t;e.items.sort(function(e,t){return t.original_price-e.original_price}).forEach(function(e){var t=Math.min(e.quantity,i);e._recalculatedDiscountedQty=t,i-=t})}),e.items.forEach(function(e){var t=0===e.final_price||e.properties&&(e.properties._giftWithPurchase||e.properties._cartoffer||e.properties._gwpOfferId),i=!t&&e.offers&&e.offers[0],r=i&&i.active!==!1&&"false"!==i.active?i:null;if(r){var a="undefined"!=typeof e._recalculatedDiscountedQty?e._recalculatedDiscountedQty:r.discountedQuantity;if(a==e.quantity)o.push(e);else{if(a>0){var s=Object.assign({},e,{quantity:a,original_line_price:a*e.original_price,price:r.discountedPricePerPiece,final_price:r.discountedPricePerPiece,final_line_price:a*r.discountedPricePerPiece,line_price:a*r.discountedPricePerPiece,total_cp_discount:e.compare_at_price*a-a*r.discountedPricePerPiece});o.push(s)}var c=e.quantity-a;if(c>0){var u=Object.assign({},e,{quantity:c,original_line_price:c*e.original_price,price:e.original_price,final_price:e.original_price,final_line_price:c*e.original_price,line_price:c*e.original_price,total_cp_discount:e.compare_at_price-c*e.original_price});n.push(u)}}}else n.push(e)});var u=o.reduce(function(e,t){if(t.offers&&t.offers.length>0){var i=t.offers[0];e.some(function(e){return e.key===i.key})||e.push(i)}return e},[]);u.forEach(function(e){var i=o.filter(function(t){return t.offers[0].key===e.key});i.sort(function(e,t){return t.original_price-e.original_price});for(var s=i.reduce(function(e,t){return e+t.quantity},0),c=Math.floor(s/e.quantity),u=i.map(function(e){return e.quantity}),l=0;l<c;l++){for(var d=[],p=e.quantity,m=0;m<i.length&&p>0;m++)if(!(u[m]<=0)){var h=Math.min(u[m],p),f=h/i[m].quantity,g=e.key+"_"+l;d.push(Object.assign({},i[m],{quantity:h,line_price:Math.round(f*i[m].line_price),final_line_price:Math.round(f*i[m].final_line_price),original_line_price:Math.round(f*i[m].original_line_price),_groupOfferRecordString:g})),u[m]-=h,p-=h}var v=d.reduce(function(e,i){return i.stockInfo?i.stockInfo<=t.lowStockBuffer?e.lowStock++:e.inStock++:e.outOfStock++,e},{inStock:0,lowStock:0,outOfStock:0}),y=e.collectionUrl||(e&&e.collection_handle?"/collections/"+e.collection_handle:""),w=y||(e.discount_key?"/collections/"+handleize(e.discount_key.indexOf("(")>-1?e.discount_key.substring(0,e.discount_key.indexOf("(")).replace(")",""):e.discount_key):"/collections/all"),_=r.find(function(t){return e.discount_key&&t.discount_key===e.discount_key||e.collection_handle&&t.collectionHandle===e.collection_handle||e.collectionHandle&&t.collectionHandle===e.collectionHandle||e.title&&t.title===e.title}),S=e.description&&"string"==typeof e.description&&e.description.trim()||_&&_.description&&"string"==typeof _.description&&_.description.trim()||"",b=S||e.title&&"string"==typeof e.title&&e.title.trim()||(e.discount_key?e.discount_key.indexOf("(")>-1?e.discount_key.substring(0,e.discount_key.indexOf("(")).trim():e.discount_key.trim():"")||(e.quantity&&(e.offerPrice||e.subtotal)?e.quantity+" for "+(e.offerPrice||e.subtotal):"");a.push({collectionUrl:w,collectionName:b.replace(/\$/g,'<em class="currency-symbol">$</em>').replace(/€/g,'<em class="currency-symbol">€</em>'),currencyCode:e.currencyCode,offerRecordString:e.key+"_"+l,offerPrice:e.subtotal,items:d,totalItems:e.quantity,bundleNeededQty:0,multiBuyItemStockStatus:v})}i.forEach(function(e,t){u[t]>0&&n.push(Object.assign({},e,{quantity:u[t],price:e.original_price,final_price:e.original_price,line_price:u[t]*e.original_price,final_line_price:u[t]*e.original_price,original_line_price:u[t]*e.original_price}))})});var l={};
16n.forEach(function(e){var t=0===e.final_price||e.properties&&(e.properties._giftWithPurchase||e.properties._cartoffer||e.properties._gwpOfferId);if(!t&&e.offers&&e.offers.length>0){var i=e.offers[0];l[i.key]||(l[i.key]={offer:i,items:[]}),l[i.key].items.push(Object.assign({},e,{_groupOfferRecordString:i.key}))}}),Object.keys(l).forEach(function(e){var i=l[e],n=i.items.reduce(function(e,t){return e+t.quantity},0);if(n>=i.offer.quantity)return void console.warn('[multibuy] Offer "'+(i.offer.title||e)+'" has '+n+" undiscounted unit(s) but requires "+i.offer.quantity+"; discount was not applied, skipping not-ready group.");var o=n%i.offer.quantity;if(o>0){var a=i.offer.quantity-o,c=i.items.reduce(function(e,i){return i.stockInfo?i.stockInfo<=t.lowStockBuffer?e.lowStock++:e.inStock++:e.outOfStock++,e},{inStock:0,lowStock:0,outOfStock:0}),u=i.offer.collectionUrl||(i.offer&&i.offer.collection_handle?"/collections/"+i.offer.collection_handle:""),d=u||(i.offer.discount_key?"/collections/"+handleize(i.offer.discount_key.indexOf("(")>-1?i.offer.discount_key.substring(0,i.offer.discount_key.indexOf("(")).replace(")",""):i.offer.discount_key):"/collections/all"),p=r.find(function(e){return i.offer.discount_key&&e.discount_key===i.offer.discount_key||i.offer.collection_handle&&e.collectionHandle===i.offer.collection_handle||i.offer.collectionHandle&&e.collectionHandle===i.offer.collectionHandle||i.offer.title&&e.title===i.offer.title}),m=i.offer.description&&"string"==typeof i.offer.description&&i.offer.description.trim()||p&&p.description&&"string"==typeof p.description&&p.description.trim()||"",h=m||i.offer.title&&"string"==typeof i.offer.title&&i.offer.title.trim()||(i.offer.discount_key?i.offer.discount_key.indexOf("(")>-1?i.offer.discount_key.substring(0,i.offer.discount_key.indexOf("(")).trim():i.offer.discount_key.trim():"")||(i.offer.quantity&&(i.offer.offerPrice||i.offer.subtotal)?i.offer.quantity+" for "+(i.offer.offerPrice||i.offer.subtotal):"");s.push({collectionUrl:d,collectionName:h.replace(/\$/g,'<em class="currency-symbol">$</em>').replace(/€/g,'<em class="currency-symbol">€</em>'),currencyCode:i.offer.currencyCode,offerRecordString:i.offer.key,offerPrice:i.offer.subtotal,items:i.items,totalItems:i.offer.quantity,bundleNeededQty:a,multiBuyItemStockStatus:c})}});var d=s.reduce(function(e,t){return t.items.forEach(function(t){return e.push(t.position)}),e},[]);e.renderItems=n.filter(function(e){return!d.includes(e.position)}),this.multibuy=a,this.multibuyNotReadyArray=s,this.multibuyOfferArray=a,this.totalPrice=e.total_price,this.totalDiscount=e.total_cart_discount,this.cart=e,this.getFreeShippingMessage(),this.toggleLoaderOverlay(i)},checkNotCompletedOffers:function(e){var t=[];e.forEach(function(i){var r=!1,n=i.split(":")[0],o=(parseInt(i.split(":")[1],10),parseInt(n.split("-")[0],10)),a=parseInt(n.split("-")[1],10);if(t.length>0)for(var s=0;s<t.length;s++)t[s].forEach(function(e){e.totalItems===o&&e.offerPrice===a&&(r=!0)});if(!r){var c=e.filter(function(e){var t=e.split(":")[0],i=parseInt(t.split("-")[0],10),r=parseInt(t.split("-")[1],10);if(o===i&&a===r)return e});if(c.length>0){var u=[];c.forEach(function(e){var t=e.split(":")[0],i=parseInt(e.split(":")[1],10),r=parseInt(t.split("-")[0],10),n=parseInt(t.split("-")[1],10);u.push({property:e,offer:t,totalItems:r,offerPrice:n,addedItems:i})}),t.push(u)}}});for(var i=this,r=function(e){for(var r=t[e].sort(function(e,t){return parseInt(e.addedItems,10)<parseInt(t.addedItems,10)}),n=r[0].offer,o=parseInt(r[0].totalItems,10)-parseInt(r[0].addedItems,10),a=function(e){e>0&&i.cart.items.length>0&&!function(){var t=i.cart.items.filter(function(t){return r[e].offer===t.properties._offer});if(t)for(var a=function(e){var r=0,a=0;i.cart.items.forEach(function(i){r++,i.variant_id===t[e].variant_id&&i.properties._offer===t[e].properties._offer&&(a=r)}),o>0&&o>=t[e].quantity?$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/change.js",data:{line:a,quantity:t[e].quantity,properties:{_offer:n}},dataType:"JSON",success:function(){o-=t[e].quantity,i.refreshCart()}}):o>0&&o<t[e].quantity&&$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/change.js",data:{line:a,quantity:0},dataType:"JSON",success:function(){},complete:function(){setTimeout(function(){$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/add.js",data:{id:t[e].variant_id,quantity:o,properties:{_offer:n}},dataType:"JSON",success:function(){},complete:function(){var r=t[e].quantity-o;setTimeout(function(){$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/add.js",data:{id:t[e].variant_id,quantity:r,properties:{_offer:t[e].properties._offer}},dataType:"JSON",success:function(){},complete:function(){o-=t[e].quantity,i.refreshCart()}})},500)}})},500)}})},s=0;s<t.length;s++)a(s)}()},s=0;s<r.length;s++)a(s)},n=0;n<t.length;n++)r(n)},showProduct:function e(t,i){if(!i)return!0;var e=!0,r=!1;return this.multibuy.length>
160&&(this.multibuy.forEach(function(e){e.items.forEach(function(e){e.id===t&&i._offer===e.properties._offer&&(r=!0)})}),r&&(e=!1)),e},removeMultibuyItem:function(e){var t=[],i=void 0;this.cart.items.forEach(function(r){var n=e.findIndex(function(e){return e.id===r.id});return n>-1&&r.properties&&r.properties._offer&&e[n].properties._offer&&r.properties._offer===e[n].properties._offer?(i=r.properties._offer,void t.push(0)):void t.push(r.quantity)});var r=localStorage.getItem("multibuy"),n=r.split(","),o=[];if(n.forEach(function(e){e.includes(i)||o.push(e)}),o.length>0)try{localStorage.setItem("multibuy",o.join(","))}catch(e){console.warn("Failed to set multibuy in localStorage:",e)}else localStorage.removeItem("multibuy");var a=this;$.ajax({type:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:t},dataType:"JSON",success:function(){a.refreshCart()},error:function(e){return console.error(e)}})},checkMultibuyLocalStorage:function(e){var t=this,i=localStorage.getItem("multibuy"),r=[],n=0;if(i){var o=i.split(",");o.forEach(function(i){var o=i.split(":")[0].split("-")[0]+"-"+i.split(":")[0].split("-")[1],a=parseInt(i.split(":")[0].split("-")[0],10);if(e.items.forEach(function(e){e.properties&&e.properties._offer&&e.properties._offer===i.split(":")[0]&&(n+=e.quantity)}),n>0&&n<=a)r.push(i.split(":")[0]+":"+n);else if(n>0&&n>a){r.push(i.split(":")[0]+":"+a);for(var s=n-a;s>0;)if(s>a){var c=t.getUniqueOffer(o,a);r.push(c+":"+a),s-=a}else{var u=t.getUniqueOffer(o,s);r.push(u+":"+s),s=0}}n=0});try{localStorage.setItem("multibuy",r.join(","))}catch(e){console.warn("Failed to set multibuy in localStorage:",e)}}},getFreeShippingMessage:function(){var e=theme.strings.freeShippingDefault.split("{amount}"),t=theme.strings.freeShippingLeft.split("{amount}"),i=theme.strings.freeShippingUnlocked,r=document.createElement("textarea");r.innerHTML=i;var n=r.value,o=this.getFreeShippingAmount();"EU"===window.theme.store&&(o*=Number(Shopify.currency.rate)),0===this.totalPrice||null===this.totalPrice?(this.freeShippingText=e[0]+" "+slate.Currency.formatMoney(o,window.theme.moneyFormat)+e[1],this.progressBarStatus=0,this.shippingPrice=this.formatMoney(theme.settings.cart_shipping_price)):this.totalPrice>0&&this.totalPrice<o?(this.freeShippingText=t[0]+" "+slate.Currency.formatMoney(o-this.totalPrice,window.theme.moneyFormat)+" "+t[1],this.progressBarStatus=this.totalPrice/o*100,this.shippingPrice=this.formatMoney(theme.settings.cart_shipping_price)):(this.freeShippingText=n,this.progressBarStatus=100,this.shippingPrice=this.formatMoney("0"))},updateItemQuantity:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=this,n=!0,o=0,a=0,s=parseInt(t.target.value,10);if(e.quantity!==s){var c=Math.abs(e.quantity-s),u="Add",l="add_to_cart";e.quantity>s&&(u="Remove",l="remove_from_cart");var d=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),p=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),m=p.menu_navigation_state||{};window.pushEvent({event:l,menu_navigation_state:m,ecommerce:Object.assign(d,{value:Number(e.price)/100*c,items:[{item_id:e.sku,item_name:e.title,index:i,item_brand:"Lovisa",item_category:e.type,price:Number(e.price)/100,quantity:c}]})},"ecommerce");var h=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),f=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),g=f.menu_navigation_state||{};if(window.pushEvent({event:"cart_quantity_change",menu_navigation_state:g,ecommerce:h,interaction_type:u,cart_quantity_state:{count_initial:"1",count_start:""+e.quantity,count_change:""+c,count_final:""+s}},"cart_quantity_state"),e.properties&&e.properties._offer){var v=localStorage.getItem("multibuy");if(v){var y=v.split(","),w=y.filter(function(t){return t.includes(e.properties._offer)});w.length>0&&(o=parseInt(w[0].split(":")[1],10),a=parseInt(w[0].split("-")[0],10))}$.ajax({type:"GET",url:""+r.shopifyCartUrl,dataType:"application/json",success:function(i){var c=r.parseCartResponse(i),u=c.items.filter(function(t){return e.id===t.id&&e.offers[0].key===t.offers[0].key});if(u.length>0&&(s-=u[0].quantity),a>0&&s+o>a){var l=r.checkMultibuyQty(s,e.properties._offer);if(l.length>1){for(var d=[],p=0;p<l.length;p++)if(0===p){var m=JSON.parse(JSON.stringify(e));m.quantity=l[p],m.properties._offer=e.properties._offer,d.push(m),m={}}else{var h=JSON.parse(JSON.stringify(e)),f=r.getUniqueOffer(h.properties._offer.split("-")[0]+"-"+h.properties._offer.split("-")[1],l[p]);h.quantity=l[p],h.properties._offer=f,d.push(h),h={}}r.addItems(d),n=!1}}if(n){var g=parseInt(t.target.value,10);r.toggleLoaderOverlay(!0);var v=r.cart&&r.cart.items?r.cart.items.find(function(t){return t.key===e.key}):null,y=v?v.quantity:e.quantity,w=Math.max(0,y+(g-e.quantity)),_={};_[e.key]=w,$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:_},dataType:"JSON",success:function(e){r.multibuyCheck(e),r.cartOfferCheck(),r.onCartUpdated()}})}}})}else if(n){var _=parseInt(t.target.value,10);this.toggleLoaderOverlay(!0);var S=this.cart&&this.cart.items?this.cart.items.find(function(t){return t.key===e.key}):null,b=S?S.quantity:e.quantity,k=Math.max(0,b+(_-e.quantity)),C={};C[e.key]=k,$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:C},dataType:"JSON",success:function(e){r.multibuyCheck(e),r.cartOfferCheck(),r.onCartUpdated()}})}}},checkIfIsGiftCard:function(e){return!e.properties||!(e.properties&&e.properties._greeting&&e.properties._receiving_email)},getUniqueOffer:function(e,t){function i(e){return e.includes(a)}var r=this,n=localStorage.getItem("multibuy"),o=Math.floor(100*Math.random()+1),a="",s=1,c=[],u="",l=!1;if(n){c=n.split(",");var d=c.filter(function(t){return t.includes(e)});d?d.forEach(function(e){if(s=parseInt(e.split(":")[1],10),s<r.offerItems){s++,a=e.split(":")[0],u=a+":"+s;var t=c.indexOf(e);c[t]=u,l=!0}}):(s=1,a=e+"-"+o,u=a+":"+s,c.push(u),l=!0)}else s=1,a=e+"-"+o,u=a+":"+s,c.push(u),l=!0;if(!l){var p=!0;for(s=1,c=n.split(",");p;){o=Math.floor(100*Math.random()+1),a=e+"-"+o,u=a+":"+s;var m=c.filter(i);0===m.length&&(p=!1,c.push(u))}}try{localStorage.setItem("multibuy",c.join(","))}catch(e){console.warn("Failed to set multibuy in localStorage:",e)}return a},checkMultibuyQty:function(e,t){var i=localStorage.getItem("multibuy"),r=t.split("-")[0]+"-"+t.split("-")[1],n=parseInt(t.split("-")[0],10),o=e/n,a=[],s=void 0;if(i){var c=i.split(","),u=c.filter(function(e){return e.includes(r)});if(u)u.forEach(function(t){var i=parseInt(t.split(":")[1],10);if(i!==n)if(i+e>n){s=e;for(var r=0;r<o;r++)0===r?(a.push(n-i),s-=n-i):r>0&&s>n?(a.push(n),s-=n):(a.push(s),s-=s)}else a.push(e)});else if(e>n){s=e;for(var l=0;l<o;l++)s>n?(a.push(n),s-=n):(a.push(s),s-=s)}else a.push(e)}else if(e>n){s=e;for(var d=0;d<o;d++)s>n?(a.push(n),s-=n):(a.push(s),s-=s)}else a.push(e);if(0===a.length)if(e>n){s=e;for(var p=0;p<o;p++)s>n?(a.push(n),s-=n):(a.push(s),s-=s)}else a.push(e);return s>0&&a.push(s),a},toggleLoaderOverlay:function(e){var t=document.querySelector(".overlay__loader");this._overlayToggleTimer&&clearTimeout(this._overlayToggleTimer),e&&t?(t.classList.add("show-overlay"),this._overlayToggleTimer=setTimeout(function(){t.classList.add("fade-overlay")},200)):t&&(t.classList.remove("fade-overlay"),this._overlayToggleTimer=setTimeout(function(){t.classList.remove("show-overlay")},200))},toggleBopisLoaderOverlay:function(e){var t=window.theme.settings.enable_bopis,i=t?document.querySelector(".logo-progress-overlay__loader"):document.querySelector("#overlay__loader");e&&i?(i.classList.add("show-overlay"),document.getElementById("my-bag-cart-popup-overlay").style.display="block",setTimeout(function(){i.classList.add("fade-overlay")},200)):i&&(document.getElementById("my-bag-cart-popup-overlay").style.display="none",i.classList.remove("fade-overlay"),setTimeout(function(){i.classList.remove("show-overlay")},200))},getMultibuyPrice:function(e){var t=0;
16return e.items.forEach(function(e){t+=e.line_price}),this.formatMoney(t)},transformedMaxOrderValueNotice:function(){var e=""+window.theme.currencySymbol+window.theme.maximumOrderValue/100,t=this.cart.total_price-window.theme.maximumOrderValue,i=""+window.theme.currencySymbol+t/100;return window.theme.strings.maximumOrderValueNotice.replace("maxOrderValue",e).replace("exceededBy",i)},multibuyOfferPriceUpdate:function(){var e=$(".my-bag-cart-item__multibuy > p");$.each(e,function(e,t){var i=$(t).attr("data-multibuy-totalitems"),r=$(t).attr("data-multibuy-offerprice");r=r*Number(Shopify.currency.rate)*100;var n=slate.Currency.formatMoney(r,window.theme.moneyFormat),o=i+" for "+n;$(t).text(o)}),window.theme.glbeHelpers&&window.theme.glbeHelpers.convertMultibuyOfferPrices()},calculateMultibuy:function(e){var t=e.items,i=t.map(function(e){return!(!e.properties||!e.properties._offer)&&e.properties._offer}).filter(function(e){return e}),r=[],n=[].concat(_toConsumableArray(new Set(i)));n.forEach(function(e){var t=i.filter(function(t){return t===e});
16r.push(e+":"+t.length)});try{window.localStorage.setItem("multibuy",r.join(","))}catch(e){console.warn("Failed to set multibuy in localStorage:",e)}},getMultibuyOfferCollection:function(e){if(window.theme.promo_callout_metaobject&&window.theme.promo_callout_metaobject.length){var t=window.theme.promo_callout_metaobject.filter(function(e){return e.promo_text}),i=t.map(function(e){var t="";e&&e.promo_text||(t=null);var i=e.promo_text,r=/(\d+)\s*for\s*[R€$£¥₹]?\s*(\d+)/i,n=/(\d+)\s*for\s*[€$£¥₹]?\s*(\d+)/i,o="ZA"===window.theme.store?i.match(r):i.match(n);if(o){var a=o[1],s=o[2];t=a+"-"+s}else t=null;return{collection_url:e.collection_url,id:e.id,promo_text:e.promo_text,text_colour:e.text_colour,offer_key:t}});this.multibuyOfferArray=i}else this.multibuyOfferArray=[];var r=this.multibuyOfferArray.find(function(t){return t.offer_key===e});return r&&r.collection_url?r:""},updateCartAttributes:function(e){var t=localStorage.getItem("_bopisSearchInfo")?JSON.parse(localStorage.getItem("_bopisSearchInfo")):null,i=t?t.selected:null,r={attributes:{bopisShipping:"SHIPPING"}};switch(e){case"ship-to-store":r.attributes={bopisShipping:"SHIP_TO_STORE"},this.selectedLocationId=i?i:"23133";break;case"shipping":r.attributes={bopisShipping:"SHIPPING"},this.selectedLocationId=this.warehouseLocationId?this.warehouseLocationId:null;break;case"click-and-collect":r.attributes={bopisShipping:"CLICK_AND_COLLECT"},this.selectedLocationId=i?i:"23133";break;default:r.attributes={bopisShipping:"SHIPPING"},this.selectedLocationId=this.warehouseLocationId?this.warehouseLocationId:null}[this.selectedLocationId]?[this.selectedLocationId]:[];this.toggleLoaderOverlay(!0);var n=this;$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:r,dataType:"JSON",success:function(){n.refreshCart(),this.selectedDeliveryMethod=e}})},apiRequest:function(){function e(e){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var i,r,n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i={method:"GET",mode:"cors",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}},r=Object.assign({},i,a),e.prev=2,e.next=5,fetch(t,r);case 5:return n=e.sent,e.next=8,n.json();case 8:return o=e.sent,e.abrupt("return",o);case 12:throw e.prev=12,e.t0=e.catch(2),console.error("Error for apiRequest:",e.t0),e.t0;case 16:case"end":return e.stop()}},e,this,[[2,12]])}));return e}(),removeMultibuyItemErrorNotice:function(){var e=this,t=localStorage.getItem("multibuy"),i=this.cart.items.filter(function(e){return e.properties&&void 0!==e.properties._offer});t&&i&&i.length>0&&(this.multibuyNotReadyArray.forEach(function(t,i){t.items&&t.items.length&&t.items.forEach(function(t,r){t.quantityError&&e.$set(e.multibuyNotReadyArray[i].items[r],"quantityError",!1)})}),this.multibuy.forEach(function(t,i){t.items&&t.items.length&&t.items.forEach(function(t,r){t.quantityError&&e.$set(e.multibuy[i].items[r],"quantityError",!1)})}))},checkItemOfferMembership:function(e,t,i){var r=function(t){return e.position&&t.position?e.position===t.position:e.id===t.id&&e.variant_id===t.variant_id},n=t&&t.some(function(e){return!!(e&&e.items&&Array.isArray(e.items))&&e.items.some(r)});if(n)return"multibuyNotReadyArray";var o=i&&i.some(function(e){return!!(e&&e.items&&Array.isArray(e.items))&&e.items.some(r)});return!!o&&"multibuy"},updateMyBagItemQuantity:function(e,t,i,r,n){var o=this;if(!n||"decrease"!==n||1!==e.quantity){if("lineItemArray"===r&&n&&"increase"===n){if(t+=1,this.removeMultibuyItemErrorNotice(),!this.checkShippingOutStockAtQtySelector(e,this.cart.items))return this.$set(this.cart.items[i],"quantityError",!0),void(e.quantityError=!0);this.cart.items[i].quantityError=!1}else"lineItemArray"===r&&n&&"decrease"===n&&(t-=1);var a=e.properties&&e.properties._offer&&"multibuyItemArray"===r?e.properties._offer:null,s=a?e.properties._offer.split("-"):[];s.length?Number(s[0]):null,s[1]||null;if(0===t)return void this.toggleLoaderOverlay(!1);if("multibuyItemArray"===r&&n&&"increase"===n){if(!this.checkShippingOut
16StockAtQtySelector(e,this.cart.items)){var c=e._groupOfferRecordString,u=function(t){Array.isArray(o[t])&&o[t].forEach(function(i,r){var n=c?i.offerRecordString===c:i.items&&i.items.some(function(t){return e.position&&t.position?e.position===t.position:t.id===e.id&&t.variant_id===e.variant_id});if(n&&i.items){var a=i.items.map(function(t,i){var r=!1;return r=e.position&&t.position?e.position===t.position:t.id===e.id&&t.variant_id===e.variant_id,r?Object.assign({},t,{quantityError:!0}):t});o.$set(o[t],r,Object.assign({},i,{items:a}))}})};return u("multibuyNotReadyArray"),u("multibuy"),void this.cart.items.forEach(function(e,t){o.$set(o.cart.items[t],"quantityError",!1)})}this.cart.items.forEach(function(e,t){o.$set(o.cart.items[t],"quantityError",!1)});var l=Object.assign({},e,{quantity:e.quantity+1});this.handleAddItemToCart(l,e.variant_id,"multibuy")}else"multibuyItemArray"===r&&n&&"decrease"===n?this.updateItemQuantityByStepper(e,t-1,i+1):this.updateItemQuantityByStepper(e,t,i+1)}},checkCartItemOffer:function(e,t,i){e.map(function(e){return!(!e.properties||!e.properties._offer)&&e.properties._offer})},handleQuantityInput:function(e,t,i){t.target?t.target.value:t;this.updateItemQuantity(e,t,i+1)},handleAddItemToCart:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(e){var r={id:i?i:e.id,product_id:e.id,quantity:1,title:e.title,url:e.url,price:Number(e.price),properties:e.properties};$.ajax({type:"POST",url:"/cart/add.js",data:{id:r.id,quantity:r.quantity,properties:r.properties},dataType:"JSON",error:function(e){t.handleUpdateCartError(e),"development"===window.theme.env&&e.status&&200!==e.status&&alert("[DEV Alert] Cart error: "+JSON.stringify(e.responseText))},complete:function(){window.theme.checkPageReload(),t.updateCartItemsEvent(),t.refreshCart()}})}},updateItemQuantityByStepper:function(e,t){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this,o=!0,a=0,s=0,c=parseInt(t,10);if(e.quantity===c)return void n.toggleLoaderOverlay(!1);var u=Math.abs(e.quantity-c),l="Add",d="add_to_cart";e.quantity>c&&(l="Remove",d="remove_from_cart");var p=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),m=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),h=m.menu_navigation_state||{};window.pushEvent({event:d,menu_navigation_state:h,ecommerce:Object.assign(p,{value:Number(e.price)/100*u,items:[{item_id:e.sku,item_name:e.title,index:r,item_brand:"Lovisa",item_category:e.type,price:Number(e.price)/100,quantity:u}]})},"ecommerce");var f=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),g=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),v=g.menu_navigation_state||{};if(window.pushEvent({event:"cart_quantity_change",menu_navigation_state:v,ecommerce:f,interaction_type:l,cart_quantity_state:{count_initial:"1",count_start:""+e.quantity,count_change:""+u,count_final:""+c}},"cart_quantity_state"),e.properties&&e.properties._offer){var y=localStorage.getItem("multibuy");if(y){var w=y.split(","),_=w.filter(function(t){return t.includes(e.properties._offer)});_.length>0&&(a=parseInt(_[0].split(":")[1],10),s=parseInt(_[0].split("-")[0],10))}$.ajax({type:"GET",url:window.Shopify.routes.root+"cart.js",dataType:"JSON",success:function(i){var r=i.items.filter(function(t){return e.id===t.id&&e.properties._offer===t.properties._offer});if(r.length>0&&(c-=r[0].quantity),s>0&&c+a>s){var u=n.checkMultibuyQty(c,e.properties._offer);if(u.length>1){for(var l=[],d=0;d<u.length;d++)if(0===d){var p=JSON.parse(JSON.stringify(e));p.quantity=u[d],p.properties._offer=e.properties._offer,l.push(p),p={}}else{var m=JSON.parse(JSON.stringify(e)),h=n.getUniqueOffer(m.properties._offer.split("-")[0]+"-"+m.properties._offer.split("-")[1],u[d]);m.quantity=u[d],m.properties._offer=h,l.push(m),m={}}n.addItems(l),o=!1}}if(o){var f=parseInt(t,10);n.toggleLoaderOverlay(!0);var g=n.cart&&n.cart.items?n.cart.items.find(function(t){return t.key===e.key}):null,v=g?g.quantity:e.quantity,y=Math.max(0,v+(f-e.quantity)),w={};w[e.key]=y,$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:w},dataType:"JSON",success:function(){n.refreshCart(!0)},error:function(e){n.toggleLoaderOverlay(!1)}})}}})}else if(o){var S=parseInt(t,10);this.toggleLoaderOverlay(!0);var b=this.cart&&this.cart.items?this.cart.items.find(function(t){return t.key===e.key}):null,k=b?b.quantity:e.quantity,C=Math.max(0,k+(S-e.quantity)),I={};I[e.key]=C,$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{updates:I},dataType:"JSON",success:function(){n.refreshCart(!0)},error:function(e){i.toggleLoaderOverlay(!1)}})}},getItemStockStatus:function(e){var t={in_stock:{text:"",icon:""},out_of_stock:{text:"Out of Stock",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8" fill="none"><circle cx="4" cy="4" r="4" fill="#D2140A"/></svg>'},low_stock:{text:"Low Stock",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8" fill="none"><circle cx="4" cy="4" r="4" fill="#FFC107"/></svg>'}};if(this.notCheckStockDeliveryMethods.includes(this.selectedDeliveryMethod))return t.in_stock;if(e&&e.sku&&this.isStockReady&&this.stockBySkuMap!={}){var i=Object.keys(this.stockBySkuMap).includes(e.sku),r=i?this.stockBySkuMap[e.sku]:null;return r<=this.lowStockBuffer?t.low_stock:t.in_stock}return t.in_stock},getItemShippingStockStatus:function(e){var t={in_stock:{text:"",icon:""},out_of_stock:{text:"Out of Stock",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8" fill="none"><circle cx="4" cy="4" r="4" fill="#D2140A"/></svg>'},low_stock:{text:"Low Stock",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8" fill="none"><circle cx="4" cy="4" r="4" fill="#FFC107"/></svg>'}},i=this.cartItemSkuMapping&&this.cartItemSkuMapping!={}?this.cartItemSkuMapping.get(e.variant_id):"";if(e&&i&&this.isStockReady&&this.shippingStockBySkuMap!={}&&"Digital Gift Card"!==e.product_type){var r=Object.keys(this.shippingStockBySkuMap).includes(i),n=r?this.shippingStockBySkuMap[i]:null;return n<=this.lowStockBuffer?t.low_stock:t.in_stock}return t.in_stock},displayForOverStock:function(e){if(e&&e.sku&&this.isStockReady&&this.stockBySkuMap!={}){var t=Object.keys(this.stockBySkuMap).includes(e.sku),i=t?this.stockBySkuMap[e.sku]:null,r=e.quantity;
16return i<=0?"Not Enough and Out of Stock":i<r?"Not Enough Stock, Need reduce quantity":"Enough Stock"}return"Enough Stock"},getUpsellProducts:function(e){if(window.theme.upsells.enable){var t=this,i=e.items;return null!==window.theme.upsells.defaultUpsellCollection?void t.getDefaultUpsellCollectionProducts(e):void(i.length<=0)}},checkArray:function(e){return e&&e.length?e.filter(function(e){return e&&"undefined"!==e&&"null"!==e}).map(String):[]},getCartStockBySku:function(e,t){var i=this;if(t=this.checkArray(t),!e||!e.items||e.items.length<=0||!t||t.length<=0)return[];var r=e.items.map(function(e){return e.sku}),n=this.checkArray(r),o=[].concat(_toConsumableArray(new Set(n))),a=window.Shopify.routes.root+"apps/lovisa-custom-stock",s={aggregates:{"*":{endpoint_filter:{ids:t},item_filter:{ids:o}}},request_name:"in_stock"};this.apiRequest(a,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"},body:JSON.stringify(s)}).then(function(e){var t=i.addStockBuffer(e.stocks,i.stockBuffer),r=t.reduce(function(e,t){return e[t.item_id.toString()]=t.quantity,e},{});i.rawStockResult=t,i.stockBySkuMap=r,i.isStockReady=!0}).catch(function(e){console.error("Error at request shopify cart info",e)})},getDefaultUpsellCollectionProducts:function(e){var t=this,i=15,r=window.theme.upsells.defaultUpsellCollectionProductHandles,n=window.theme.upsells.defaultUpsellCollectionFirstProductId,o=r.map(function(e){return new Promise(function(t,i){var r=window.location.origin+"/products/"+e+".js",n={headers:{"Content-Type":"application/json"}};fetch(r,n).then(function(e){return e.ok?e.json():t()}).then(function(e){var i=Object.assign(e,{_type:"manual"});t(i)}).catch(function(e){i(e)})})});Promise.all(o).then(function(o){var a=o.filter(function(e){return void 0!==e}),s=new URL(""+window.location.origin+window.Shopify.routes.root+"recommendations/products.json");s.searchParams.set("product_id",n),s.searchParams.set("limit",10),fetch(s).then(function(e){return e.json()}).then(function(n){if(n.products){var o=n.products.map(function(e){return Object.assign(e,{_type:"api"})});i-=r.length;var s=a.concat(o).filter(function(t){return e.items.every(function(e){return e.product_id!==t.id})});t.upsellProducts=[].concat(_toConsumableArray(new Set(s.filter(function(e){return e.variants&&e.variants.length>0}).slice(0,i))))}}).catch(function(e){console.error(e)}),t.isVisible&&t.upsellsActive&&t.trackCartUpsellsImpressions()}).catch(function(e){console.error(e)})},upsellProductsHtml:function(){return this.upsellProducts.length?'\n <div class="side-cart__upsells">\n <div class="side-cart__upsells-items">\n <h2 id="carousel-heading">Splide Upsell Example</h2>\n <div class="splide__track">\n <ul class="list-none">\n '+this.upsellProducts.map(function(e){ 17return'\n <li class="splide__slide" data-sku="'+e.variants[0].sku+'">\n <div class="upsell-image">\n <a href="'+e.url+'">\n <img width="1006" height="1294" loading="lazy" src="'+e.featured_image+'" alt="'+e.title+'" />\n </a>\n </div>\n </li>'}).join("")+"\n \n \n </ul>\n </div>\n </div>\n </div>":""},handleAccordionClick:function(e){this.expandedAccordions=this.expandedAccordions.includes(e)?this.expandedAccordions.filter(function(t){return t!==e}):[].concat(_toConsumableArray(this.expandedAccordions),[e])},getSourceElement:function(){try{return document.querySelector(".cart__shipping-policy")}catch(e){return null}},compareCartWithStock:function(e,t){var i=[];return e.forEach(function(e){var r=t.stocks.find(function(t){return t.item_id===e.sku});if(r){var n=Math.min(e.qty,r.quantity);i.push({sku:e.sku,validqty:n})}else i.push({sku:e.sku,validqty:0})}),i},getMissingStockItems:function(e,t){var i=[];return e.forEach(function(e){var r=t.stocks.find(function(t){return t.item_id===e.sku});r||i.push(e.sku)}),i},handleBack:function(){this.isPopupVisible=!1,document.getElementById("my-bag-cart-popup-overlay").style.display="none"},handleProceed:function(){this.isPopupVisible=!1,document.getElementById("my-bag-cart-popup-overlay").style.display="none"},combineStockWithCartItems:function(e,t){var i=this,r=0;e.reduce(function(e,t){var i=e.find(function(e){return e.id===t.id});return i?i.combineQty+=t.quantity:e.push(Object.assign({},t)),e},[]);return{combineStockItems:e.map(function(e){var n=t.find(function(t){return t.item_id===e.sku}),o=i.discountCartItems.find(function(t){return t.id===e.id}),a=e.properties&&e.properties._offer?e.properties._offer.split("-")[0]:null,s=e.properties&&e.properties._offer?e.properties._offer.split("-")[1]:null,c=!(!a||!s)&&a===e.quantity,u=Object.assign({},e);if(n){u.stockQuantity=n.quantity,u.isOutOfStock=n.quantity<=0;var l=Math.max(0,e.quantity),d=Math.max(0,n.quantity),p=l>d?l-d:0;u.missingStockQuantity=p,u.updateItemQuantity=p>0?d:l,r+=p}else u.stockQuantity=0,u.isOutOfStock=!0,u.missingStockQuantity=e.quantity,u.updateItemQuantity=0,r+=e.quantity;return o?u.discountInfo=o:u.discountInfo={},u.isMultibuyItemActive=c,u.missingStockComparePrice=u.discountInfo.compare_at_price?i.formatMoney(u.discountInfo.compare_at_price):"",u.missingStockOriginalPrice=u.discountInfo.price?i.formatMoney(u.discountInfo.price):"",u.missingStockDisplayPrice=u.missingStockComparePrice?u.missingStockComparePrice:u.missingStockOriginalPrice,u.stockStatusInfo=i.getItemStockStatus(u),u.displayVariant=i.displayVariantValue(u),u}),missingStockCount:r}},handleRemoveOutOfStock:function(){var e=this;this.removeOutOfStockItems().then(function(t){e.refreshCart(),e.processToCheckout()}).catch(function(t){console.error("Error at request shopify cart info"),e.showStockPopup=!1,e.isPopupVisible=!1,e.isPopupRightBtnLoading=!1,document.getElementById("my-bag-cart-popup-overlay").style.display="none"})},processToCheckout:function(){this.showStockPopup=!1,this.isPopupVisible=!1,this.isPopupRightBtnLoading=!1,document.getElementById("my-bag-cart-popup-overlay").style.display="none",window.location.href="/checkout"},removeOutOfStockItems:function(){function e(){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,i,r,n,o,a,s,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.notCheckStockDeliveryMethods.includes(this.selectedDeliveryMethod),i=t?this.shippingOut
17StockItemsGroup[0].outStockItems.map(function(e){return{id:e.variant_id,quantity:e.updateItemQuantity}}):this.outOfStockItemsGroup[0].outStockItems.map(function(e){return{id:e.variant_id,quantity:e.updateItemQuantity}}),r=i.reduce(function(e,t){return e[t.id]=t.quantity,e},{}),n=r,o=this,a={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:n})},s=window.Shopify.routes.root+"cart/update.js",this.isPopupRightBtnLoading=!0,e.prev=8,e.next=11,fetch(s,a);case 11:c=e.sent,this.isPopupRightBtnLoading=!1,e.next=20;break;case 15:throw e.prev=15,e.t0=e.catch(8),console.error("Error for apiRequest:",e.t0),this.isPopupRightBtnLoading=!1,e.t0;case 20:case"end":return e.stop()}},e,this,[[8,15]])}));return e}(),createOutStockItemsGroup:function(){var e=this;this.activeSfsValueMapping;this.getCartStockBySku(this.cart,[this.selectedLocationId]);var t=0,i=[];this.cart.items.forEach(function(r){r&&r.variant_id&&!e.activeSfsValueMapping[r.variant_id]&&(t+=r.quantity,r.stockQuantity=0,r.isOutOfStock=!0,r.missingStockQuantity=r.quantity,r.updateItemQuantity=0,r.isShippingOnly=!0,r.displayVariant=e.displayVariantValue(r),i.push(r))});var r=this.cart.items.filter(function(t){return!(t&&t.variant_id&&!e.activeSfsValueMapping[t.variant_id])}),n=this.combineStockWithCartItems(r,this.rawStockResult);n.combineStockItems=n.combineStockItems.concat(i);var o=n.combineStockItems.filter(function(e){return e.missingStockQuantity>0}),a={outStockItems:o,total:o.length,isMultibuy:!1,title:"",outStockQtyCount:n.missingStockCount+t};return a},checkShippingOutStockAtQtySelector:function(e,t){if("development"===window.theme.env)return!0;var i=this.cartItemSkuMapping&&this.cartItemSkuMapping!={}?this.cartItemSkuMapping.get(e.variant_id):"";if(e&&i&&this.isStockReady&&this.shippingStockBySkuMap!={}&&"Digital Gift Card"!==e.product_type){var r=Object.keys(this.shippingStockBySkuMap).includes(i),n=r?this.shippingStockBySkuMap[i]:null,o={};return t.forEach(function(e){e&&e.sku&&"number"==typeof e.quantity?o[e.sku]=(o[e.sku]||0)+e.quantity:console.warn("Invalid item found in cart:",e)}),!(!n||"number"!=typeof o[i])&&n>o[i]}return"Digital Gift Card"===e.product_type},createShippingOutStockItemsGroup:function(){var e=this.cart.items,t=e.map(function(e){return e.sku}),i=([].concat(_toConsumableArray(new Set(t))).filter(function(e){return null!==e}),this.shippingSavedStockResult&&this.shippingSavedStockResult.length?this.shippingSavedStockResult:[]),r=this.combineStockWithCartItems(e,i),n=r.combineStockItems.filter(function(e){return e.missingStockQuantity>0}),o={outStockItems:n,total:n.length,isMultibuy:!1,title:"",outStockQtyCount:r.missingStockCount};return o},checkStockAndCheckout:function(){var e=this.createOutStockItemsGroup();this.outStockQty=e.outStockQtyCount,this.outOfStockItemsGroup=[],this.outOfStockItemsGroup.push(e);var t=this.notCheckStockDeliveryMethods.includes(this.selectedDeliveryMethod),i=this.createShippingOutStockItemsGroup();if(this.shippingOutStockItemsGroup=[],this.shippingOutStockQty=i.outStockQtyCount,t&&i.outStockItems&&i.outStockItems.forEach(function(e){e.isShippingOnly=!1}),this.shippingOutStockItemsGroup.push(i),this.outStockQty>0&&!t){var r=PopupManager.getInstance();r.render(this.outOfStockItemsGroup),r.outstockdesc(this.outStockPopupDesc),r.show()}else if(this.shippingOutStockQty>0&&t&&this.enableLocationInventoryCheck){var n=PopupManager.getInstance();n.render(this.shippingOutStockItemsGroup),n.outstockdesc(this.shippingOutStockPopupDesc),n.show()}else this.processToCheckout()},calculateStockSummary:function(e,t){var i=this,r=(this.activeSfsValueMapping,localStorage.getItem("multibuy"));if(r){var n=this.multibuy&&this.multibuy.length?this.multibuy:[],o=this.multibuyNotReadyArray,a=r.split(",").filter(function(e){return!e.includes("false")}),s=n.concat(o);s.length===a.length;a.forEach(function(e){var r=0,n=0,o=0,a=0;if(s.length)for(var c=0;c<s.length;c++){var u=s[c].offerRecordString===e?s[c].items:[],l=u.filter(function(e){return e&&e.variant_id&&!i.activeSfsValueMapping[e.variant_id]}),d=l.reduce(function(e,t){return e+t.quantity},0);a+=d;var p=u.filter(function(e){return e&&e.variant_id&&i.activeSfsValueMapping[e.variant_id]});p.forEach(function(e){var a=t.stocks.find(function(t){return t.item_id===e.sku});if(!a)return void(n+=e.quantity);if(a){var s=a+i.stockBuffer;return void(s<=0?n+=e.quantity:s<=i.lowStockBuffer?r+=e.quantity:o+=e.quantity)}})}var m={outOfStock:n,inStock:o,lowStock:r,shippingOnly:a};i.stockStatus.promotionGroupsMap[e]=m})}var c={outOfStock:0,inStock:0,lowStock:0,shippingOnly:0,stockNotEnough:0},u={outOfStock:[],inStock:[],lowStock:[],shippingOnly:[],stockNotEnough:[]};return e.forEach(function(e){var r=t.stocks.find(function(t){return t.item_id===e.sku});if(e&&e.variant_id&&!i.activeSfsValueMapping[e.variant_id])return c.shippingOnly+=e.quantity,void u.shippingOnly.push(e);if(!r)return c.outOfStock+=1,void u.outOfStock.push(e);if(r){var n=Math.max(0,r.quantity);return void(0===n?(c.outOfStock+=e.quantity,u.outOfStock.push(e)):n<=i.lowStockBuffer?(c.lowStock+=e.quantity,u.lowStock.push(e)):(c.inStock+=e.quantity,u.inStock.push(e)))}}),{summary:c,stockSummaryObject:u}}
17,setStockStatusSummary:function(e,t){var i=new Date;"click-and-collect"===t&&(this.stockStatus.summary=e.summary,this.stockStatus.lastUpdated=i.getTime(),this.stockStatus.promotionGroups=e.promotionGroups,this.stockStatus.outOfStockItems=e.stockSummaryObject.outOfStock,this.stockStatus.inStockItems=e.stockSummaryObject.inStock,this.stockStatus.lowStockItems=e.stockSummaryObject.lowStock,this.stockStatus.shippingOnlyItems=e.stockSummaryObject.shippingOnly,this.stockStatus.stockNotEnoughItems=e.stockSummaryObject.stockNotEnough,this.stockStatus.removeBeforeCheckoutItems=[],this.stockStatus.stockNotEnough=e.summary.stockNotEnough)},removeCurrencySymbol:function(e){return e?e.replace(/[^0-9.,-]+/g,""):""},toggleSummaryPanel:function(){this.showSummaryPanel=!this.showSummaryPanel},handleChangeStore:function(){var e=document.querySelector(".bopis-change-store-cta.detail.ecomm-only");e?e.click():console.error("Search button not found.")},displayVariantValue:function e(t){for(var i=t.variant_options&&"Default Title"!==t.variant_options[0]?t.variant_options:[],e="",r=0;r<i.length;r++)if("Default Title"!==i[r]&&"Digital Gift Card"!==t.product_type)e="Size: "+i[r];else if("Digital Gift Card"===t.product_type){var n=window.theme&&window.theme.giftcard_send_on_property,o=n&&t.properties?t.properties[n]:"",a=o?" <p>Sending on: "+o+"</p>":"",s=t.properties&&t.properties._receiving_name?" <p>To: "+t.properties._receiving_name+"</p>":"",c=t.properties&&t.properties._greeting?" <p>Message: "+t.properties._greeting.slice(0,50)+"</p>":"";e="<p>Amount: "+i[r]+"</p>"+s+c+a}return e?e:""},refreshStockData:function(){function e(e){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var i,r,n,o,a,s,c,u,l,d,p,m,h,f,g,v,y,w,_,S,b,k,C,I,O,P,E,A=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=new Date,r="click-and-collect",n={summary:{outOfStock:0,deliverable:0,lowStock:0,shippingOnly:0},promotionGroups:[],promotionGroupsMap:{},shippingOptions:{shipping:{},clickAndCollect:{}},lastUpdated:null},e.prev=3,e.next=6,this.apiRequest(this.shopifyCartUrl,{},"application/json");case 6:if(o=e.sent,a=this.parseCartResponse(o),s=localStorage.getItem("_bopisSearchInfo")?JSON.parse(localStorage.getItem("_bopisSearchInfo")):null,c=s&&s.stores&&s.selected?s.stores.filter(function(e){return e.id===s.selected.toString()}):[],this.selectedClickAndCollectLocation=c[0]?c[0]:null,s&&s.selected||!this.defaultStoreBranch){e.next=20;break}return u=window.Shopify.routes.root+"apps/lovisa-custom-location",l=this.defaultStoreBranch.toString(),d={classification:[{endpoint_type:[["store"]]}],endpoint_ids:[l],pagination:{start:0,limit:1}},e.next=17,this.apiRequest(u,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"},body:JSON.stringify(d)});case 17:p=e.sent,m=p&&p.endpoints?p.endpoints[0]:null,this.selectedClickAndCollectLocation=m?m:null;case 20:if(h=s&&s.selected?s.selected:this.defaultStoreBranch?this.defaultStoreBranch:null,f=window.theme.settings.shipping_warehouse_location_id?window.theme.settings.shipping_warehouse_location_id:null,g={shipping:f?f:"","click-and-collect":h?h:""},a&&a.items&&!(a.items.length<=0)){e.next=25;break}return e.abrupt("return");case 25:if(v=a.items.map(function(e){return e.sku}),y=[].concat(_toConsumableArray(new Set(v))).filter(function(e){return null!==e}),!this.defaultSfsStoreBranch){e.next=33;break}
17return e.next=30,this.getShippingStockData(y,a.items,!0);case 30:e.t0=e.sent,e.next=36;break;case 33:return e.next=35,this.getShippingStockData(y,a.items,!1);case 35:e.t0=e.sent;case 36:if(w=e.t0,this.stockStatus.shippingStockSum=w.shippingStockSum,this.shippingStockBySkuMap=w.shippingStockMapping,_=A?[g["click-and-collect"].toString()]:[g[t].toString()],A||t&&g[t]){e.next=42;break}return e.abrupt("return");case 42:if(console.log("minicart api test 2",_),S=function(e){return e.filter(function(e){return e&&e.length>0&&""!==e[0]})},b=window.Shopify.routes.root+"apps/lovisa-custom-stock",k={aggregates:{"*":{endpoint_filter:{ids:_},item_filter:{ids:y}}},request_name:"in_stock"},C=S(_),!C||!C.length){e.next=53;break}return e.next=50,this.apiRequest(b,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"},body:JSON.stringify(k)});case 50:e.t1=e.sent,e.next=54;break;case 53:e.t1={stocks:[]};case 54:I=e.t1,this.multibuyCheck(a),O=this.addStockBuffer(I.stocks,this.stockBuffer),P=O.reduce(function(e,t){return e[t.item_id.toString()]=t.quantity,e},{}),this.rawStockResult=O,this.stockBySkuMap=P,this.isStockReady=!0,E=this.selectedDeliveryMethod===r||A?this.calculateStockSummary(a.items,I):{},this.setStockStatusSummary(E,this.selectedDeliveryMethod),e.next=68;break;case 65:e.prev=65,e.t2=e.catch(3),console.error("get stock error",e.t2);case 68:case"end":return e.stop()}},e,this,[[3,65]])}));return e}(),getShippingFromBranchStockApi:function(){function e(e){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",[]);case 1:case"end":return e.stop()}},e,this)}));return e}(),getShippingInventoryStockApi:function(){function e(e){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var i,r,n,o,a,s,c,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&0!==t.length){e.next=2;break}return e.abrupt("return",[]);case 2:if(!this.enableLocationInventoryCheck){e.next=15;break}return i=this.selectedCountryCode,r=this.shippingStockUrl.startsWith("/")?this.shippingStockUrl:"/"+this.shippingStockUrl,n=window.Shopify.routes.root.endsWith("/")?window.Shopify.routes.root.slice(0,-1):window.Shopify.routes.root,o=""+n+r,a={skus:t,countryCode:i},e.next=10,this.apiRequest(o,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"},body:JSON.stringify(a)});case 10:return s=e.sent,c=s.processData.map(function(e){return{item_id:e.sku,quantity:e.inventoryLevels.reduce(function(e,t){var i=t.quantities||[],r=i.reduce(function(e,t){return e+("number"==typeof t.quantity?t.quantity:0)},0);return e+r},0)}}),e.abrupt("return",c);case 15:return u=this.getProductInventoryInfo(),e.abrupt("return",this.checkAndRefreshStockData(u));case 17:case"end":return e.stop()}},e,this)}));return e}(),getShippingStockData:function(){function e(e,i){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function e(t,i){var r,n,o,a,s,c,u,l,d,p,m,h,f=this,g=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=new Date,n="shipping",!g){e.next=8;break}
17return e.next=5,this.getShippingFromBranchStockApi(t);case 5:e.t0=e.sent,e.next=11;break;case 8:return e.next=10,this.getShippingInventoryStockApi(t);case 10:e.t0=e.sent;case 11:return o=e.t0,this.shippingSavedStockResult=o,a=o,s=localStorage.getItem("multibuy"),s&&(c=this.multibuy&&this.multibuy.length?this.multibuy:[],u=this.multibuyNotReadyArray,l=s.split(",").filter(function(e){return!e.includes("false")}),d=c.concat(u),l.forEach(function(e){var t=0,i=0,r=0;if(d.length)for(var n=0;n<d.length;n++){var o=d[n].offerRecordString===e?d[n].items:[],s=o.filter(function(e){return e&&e.variant_id&&"Digital Gift Card"!==e.product_type});s.forEach(function(e){var t=a.find(function(t){return t.item_id===e.sku});if(!t)return void(outOfStockSummary+=e.quantity);if(t){var i=t;return void(i<=0?outOfStockSummary+=e.quantity:i<=f.lowStockBuffer?lowStockSummary+=e.quantity:r+=e.quantity)}})}var c={outOfStock:i,inStock:r,lowStock:t};f.stockStatus.shippingPromotionGroupsMap[e]=c})),p={outOfStock:0,inStock:0,lowStock:0,stockNotEnough:0},m={outOfStock:[],inStock:[],lowStock:[],shippingOnly:[],stockNotEnough:[]},this.isShippingStockReady=!0,i.forEach(function(e){if(!e.product_type||"Digital Gift Card"!==e.product_type){var t=a.find(function(t){return t.item_id===e.sku});if(!t)return void(p.outOfStock+=1);if(t){var i=Math.max(0,t.quantity);return void(0===i?p.outOfStock+=e.quantity:i<=f.lowStockBuffer?p.lowStock+=e.quantity:p.inStock+=e.quantity)}}}),h=a.reduce(function(e,t){return e[t.item_id.toString()]=t.quantity,e},{}),e.abrupt("return",{shippingStockSum:p,shippingStockMapping:h});case 22:case"end":return e.stop()}},e,this)}));return e}(),handleInput:function(){var e=this;this.addressInput&&"function"==typeof this.addressInput.trim&&this.addressInput.trim()&&this.addressInput.length>3?this.searchAddressFromApi(this.addressInput,this.selectedCountryCode).then(function(t){t&&t.data&&t.data.length>0?(e.searchResults=t.data,e.hasSearchResults=!0):(e.searchResults=[],e.hasSearchResults=!1)}):(this.searchResults=[],this.hasSearchResults=!1)},handleEnterKey:function(e){document.querySelector(".location-form-cart:focus-within")&&"Enter"===e.key&&(this.hasSearchResults?this.searchResults.length>0&&this.selectAddress(this.searchResults[0]):e.preventDefault())},selectAddress:function(e){var t=this,i=new google.maps.places.PlacesService(document.createElement("div")),r=0,n="";i.getDetails({placeId:e.object.place_id},function(e,t){if(r++,t===google.maps.places.PlacesServiceStatus.OK){var i={label:e.formatted_address,suburb:"",city:"",state:"",postalCode:"",country:""};e.address_components.forEach(function(e){e.types.includes("locality")?i.city=e.long_name:e.types.includes("administrative_area_level_2")?i.city=e.long_name:e.types.includes("administrative_area_level_1")?i.state=e.long_name:e.types.includes("postal_code")?i.postalCode=e.long_name:e.types.includes("country")?i.country=e.long_name:(e.types.includes("sublocality")||e.types.includes("neighborhood"))&&(i.suburb=e.long_name)}),n=""+i.label+(i.suburb?", "+i.suburb:"")+(i.city?", "+i.city:"")+(i.state?", "+i.state:"")+(i.postalCode?", "+i.postalCode:"")+(i.country?", "+i.country:"")}else console.error("Google Maps API Error (Place Details):",t)}),this.foundAddress=n?n:e.label,this.isFoundLocation=!0,this.hanldeAddressSetCookies("pdp_addresss",this.foundAddress,365),this.searchResults=[];for(var o=new Date,a="",s=window.theme.settings.usp_type_1_days?window.theme.settings.usp_type_1_days:6,c=0;c<s;)a=new Date(o.setDate(o.getDate()+1)),0!=a.getDay()&&6!=a.getDay()&&c++;var u=["January","February","March","April","May","June","July","August","September","October","November","December"];this.deliveryDate=a.getDate()+" "+u[a.getMonth()],setTimeout(function(){var e=document.getElementById("delivery_date");e?e.textContent=t.deliveryDate:console.error("can not find delivery_date")},200)},handleShippingMethodClick:function(e){e.target.matches("#change-location.change-location")&&this.changeLocation()},changeLocation:function(){this.isFoundLocation=!1,this.foundAddress="",this.addressInput=""},handleAddressSubmit:function(){var e=this;this.selectedCountryCode&&this.searchAddressFromApi(this.addressInput,this.selectedCountryCode).then(function(t){t&&t.data&&t.data.length>
170?e.isFoundLocation=!1:e.isFoundLocation=!1})},searchAddressFromApi:function(){function e(e,i){return t.apply(this,arguments)}var t=_asyncToGenerator(regeneratorRuntime.mark(function e(t,i){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,r){var n=new google.maps.places.AutocompleteService;n.getPlacePredictions({input:t,componentRestrictions:{country:i},types:["geocode"]},function(t,i){return i!==google.maps.places.PlacesServiceStatus.OK?(console.error("Google Maps API Error:",i),void r({data:[]})):void e({data:t.map(function(e){return{label:e.description,object:e}})})})}));case 1:case"end":return e.stop()}},e,this)}));return e}(),hanldeAddressSetCookies:function(e,t,i){var r=new Date;r.setTime(r.getTime()+24*i*60*60*1e3);var n="expires="+r.toUTCString();document.cookie=e+"="+t+";"+n+";path=/"},handleResize:function(){this.isMobile=window.innerWidth<=989,this.setRecommendationsWidth()},setRecommendationsWidth:function(){var e=0,t=5,i=function i(){var r=document.querySelector("#my-bag-page1 .left-block"),n=document.querySelector(".home-recommendations.my-bag-recommendations.cart-recommendations.my-cart-recommendations");
17if(r&&n)if(window.innerWidth>=990){var o=r.offsetWidth,a=window.innerWidth,s=o/a*100;n.style.width=s+"vw"}else n.style.width="";else e<t&&(e++,setTimeout(i,200))};i()},addStockBuffer:function(e,t){return e.map(function(e){return e.quantity+=t,e})},handleUpdateCartError:function(e){this.refreshCart(),this.toggleLoaderOverlay(!1)},updateCartItemCount:function(){var e=this.cart.item_count,t=document.querySelector(".my-bag-cartcount-desktop");t&&(t.textContent="("+e+")");var i=document.querySelector(".my-bag-cartcount-mobile");i&&(i.textContent=e+" products in your bag")},displayItemPriceOnlyNum:function(e){var t=this.formatMoney(e);return t?t.replace(/[^\d.,-]/g,""):""},displayItemPriceAtPopup:function(e){var t=this.discountCartItems.find(function(t){return t.id===e.id}),i=Object.assign({},e);t?i.discountInfo=t:i.discountInfo={},i.missingStockComparePrice=i.discountInfo.compare_at_price?this.formatMoney(i.discountInfo.compare_at_price*i.missingStockQuantity):"",i.missingStockOriginalPrice=i.discountInfo.price?this.formatMoney(i.discountInfo.price*i.missingStockQuantity):"";var r=i.missingStockComparePrice?i.missingStockComparePrice:i.missingStockOriginalPrice;return r?r.replace(/[^\d.,-]/g,""):""},displayMultibuyPriceAtNotGlobaleStore:function(e){var t=window.Shopify&&window.Shopify.currency&&window.Shopify.currency.rate,i=e;return t&&1!==t&&(i=(e*t).toFixed(2)),i},toggleWishlist:function(e,t,i){function r(e){if(!e)return null;var t=e.split("?")[0],i=t.split("/");return i[i.length-1]}function n(e){if(!e)return!1;var t=e.querySelector("svg path");if(t){var i=t.getAttribute("fill");return"none"!==i}return!1}var o=this,a=(e.currentTarget,t.handle);a||(console.warn("productCardWrapper 2 current handle missing",t),a=t.url?r(t.url):null);var s='.swym-wishlist-collections-v2[data-product-id*="'+a+'"]',c=document.querySelector(s);c?c.click():console.warn("productCardWrapper 3 can not find btn",t);var u=new Set;this.cart.items.forEach(function(e){if(e.url){var t=r(e.url);u.add(t)}}),setTimeout(function(){var e=new Set;u.forEach(function(t){var i='.swym-wishlist-collections-v2[data-product-id*="'+t+'"]',r=document.querySelector(i);if(r){var o=n(r);o&&e.add(t)}else console.warn("productCardWrapper 4 can not find "+t+" from")}),console.warn("productCardWrapper 5 set is "+o.wishedHandles),o.wishedHandles=Array.from(e)},1e3)},initializeWishlistStates:function(){function e(e){if(!e)return null;var t=e.split("/");return t[t.length-1]}function t(e){if(!e)return null;var t=e.split("?")[0],i=t.split("/");return i[i.length-1]}var i=document.querySelectorAll(".swym-wishlist-collections-v2"),r=new Set;i.forEach(function(t){var i=t.getAttribute("data-product-id"),n=e(i),o="true"===t.getAttribute("aria-pressed");n&&o&&r.add(n)}),this.wishedHandles=Array.from(r);var n=new Set(this.wishedHandles);this.cart.items.forEach(function(e,i){var r=t(e.url);r&&n.has(r)})},cleanupObserver:function(){this.wishlistObserver&&(this.wishlistObserver.disconnect(),this.wishlistObserver=null)},setupWishlistObserver:function(){var e=this,t=window.location.pathname.includes("/cart");if(!t)return void console.log("not cart page, skip MutationObserver。");var i=document.querySelector(".main-content");if(!i)return void console.error("document.body can not use");var r={childList:!0,subtree:!0},n=function(t,i){var r=document.querySelector(".shopify-section .product-card-wrapper"),n=!0,o=!1,a=void 0;try{for(var s,c=t[Symbol.iterator]();!(n=(s=c.next()).done);n=!0){var u=s.value;if("childList"===u.type){var l=r.querySelector(".swym-wishlist-collections-v2");if(r&&l)return e.initializeWishlistStates(),i.disconnect(),void(e.wishlistObserver=null)}}}catch(e){o=!0,a=e}finally{try{!n&&c.return&&c.return()}finally{if(o)throw a}}};this.wishlistObserver=new MutationObserver(n),this.wishlistObserver.observe(i,r);var o=i.querySelector(".swym-wishlist-collections-v2");o&&(this.initializeWishlistStates(),this.cleanupObserver())},isItemInWishlist:function(e){var t=new Set(this.wishedHandles);if(!e)return!1;var i=e.split("?")[0],r=i.split("/"),n=r[r.length-1];return t.has(n)},announceCartStatus:function(e){var t=document.getElementById("cart-popup-status");t&&(t.textContent=e,setTimeout(function(){t.textContent=""},1e3))},announceMainCartStatus:function(e){var t=document.getElementById("main-cart-status");t&&(t.textContent=e,setTimeout(function(){t.textContent=""},1e3))},giftLabPopupTrigger:function(){var e=document.getElementById("glpro-gift-wrapping");if(e){e.click();var t=300;setTimeout(function(){var e=document.querySelector(".giftAddonsButtonsWrapper .giftAddonsNextButton");e?e.click():console.warn("can not find .giftAddonsNextButton")},t)}else console.error("can not find popup ")},giftLabPopupRemoveAttribute:function(){var e,t=Object.assign(this.cart.attributes,(e={},_defineProperty(e,"senderName",""),_defineProperty(e,"glproGiftMessage",""),_defineProperty(e,"recipientName",""),_defineProperty(e,"RecipientEmail",""),_defineProperty(e,"internalGlproApp",""),e)),i=function(){return new Promise(function(e){$.ajax({method:"POST",url:window.Shopify.routes.root+"cart/update.js",data:{attributes:t},dataType:"JSON",success:function(){return e()}})})};i().then(function(){console.log("removed giftlab attributes.")})}}}),theme.ContactForm=function(){function e(e){if(!e.dataset.inited){if(this.container=e,this.form=this.container.querySelector(".form"),this.button=this.container.querySelector(".btn-submit"),this.button.addEventListener("click",this.validateForm.bind(this)),this.requiredFields=this.container.querySelectorAll(".form__field-required"),this.requiredFields){var t=this;this.requiredFields.forEach(function(e){e.addEventListener("keyup",t.checkInput.bind(t))})}e.dataset.inited=!0}}return e.prototype.checkInput=function(e){var t=void 0;t=e.target?e.target:e;var i=!0,r=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;i="email"===t.type?r.test(t.value.toLowerCase()):""!==t.value,i?(t.setAttribute("aria-invalid",!1),t.parentNode.querySelector(".field__error-alert").style.display="none"):(t.setAttribute("aria-invalid",!0),t.parentNode.querySelector(".field__error-alert").style.display="block")},e.prototype.validateForm=function(e){if(this.form.classList.contains("form--needs-validation")&&(this.requiredFields.forEach(this.checkInput),this.form.classList.remove("form--needs-validation")),this.validatedFields=this.container.querySelectorAll('.form__field-required[aria-invalid="false"]'),this.validatedFields.length<this.requiredFields.length)return!1},e}(),theme.a11y=function(){window.addEventListener("load",function(){function e(e,t){var i=e.querySelectorAll(".fs-entry-container");i.length<1||(i.forEach(function(e){e.setAttribute("role","listitem");var t=e.querySelector(".fs-text-container");t&&t.removeAttribute("tabIndex")}),t&&t.disconnect())}var t=document.querySelectorAll("[id^=fs-timeline-]:not([id^=fs-timeline-detail])");if(!(t.length<1)){var i={childList:!0};
17t.forEach(function(t){function r(i){i.forEach(function(i){"childList"===i.type&&e(t,n)})}t.setAttribute("role","list");var n=new MutationObserver(r),o=t.querySelectorAll(".fs-entry-container");o.length?e(t,n):n.observe(t,i)})}}),window.addEventListener("load",function(){var e=document.querySelector(".wishlistpage .wishlistbodycontainer");if(null!==e){var t=document.querySelector(".sharebutton");t&&t.setAttribute("aria-label","Share Wishlist");var i=document.querySelectorAll("#variant_selection_modal");i.length>0&&i.forEach(function(e){e.setAttribute("aria-label","Select variant"),e.removeAttribute("aria-labelledby")});var r=document.querySelectorAll("#message_modal");r.length>0&&r.forEach(function(e){e.setAttribute("aria-label","Wishlist message"),e.removeAttribute("aria-labelledby")});var n=e.querySelector("#bookmarks .row:not(.text-center)");if(null!==n){n.setAttribute("role","list");var o=n.querySelectorAll("[id^=product_]");o.length<1||o.forEach(function(e){e.setAttribute("aria-label","wishlist product card"),e.setAttribute("tabindex","0"),e.setAttribute("role","listitem")})}}}),window.addEventListener("load",function(){var e=document.querySelectorAll("h1, h2, h3, h4, h5, h6");e.forEach(function(e){e.textContent.trim()||e.getAttribute("aria-label")||e.getAttribute("aria-labelledby")||e.querySelector("img[alt]")||e.setAttribute("aria-hidden","true")})})}(),theme.CurrencySelector=function(){document.addEventListener("DOMContentLoaded",function(){function e(e){var t=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),i=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),r=i.menu_navigation_state||{};window.pushEvent({event:"region_selector_action",menu_navigation_state:r,ecommerce:t,interaction_type:"Submit",region_selector_state:{currency:e.currentTarget.value,region:window.theme.store,is_globale_currency:"US"===window.theme.store&&"USD"===e.currentTarget.value}},"region_selector_state"),e.currentTarget.closest("[data-currency-picker]").submit()}var t=Array.from(document.querySelectorAll("[data-currency-picker] .currency-picker"));t.forEach(function(t){t.addEventListener("change",e)})})}(),theme.CurrencySwitcher=function(){function e(e){for(var t=arguments.length,i=Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];var n=[];return e.forEach(function(e,t){n.push(e),i[t]&&n.push(i[t])}),n.join("")}function t(t,i,u){if(i||(i=e),!o||!t.includes(r)&&!t.includes(n))return t;var l=t.match(s);if(l)l=t.match(s)[0];else{if(l=t.match(c),!l)return t;l=t.match(c)[0]}var d=l.replace(r,"").replace(n,""),p=d.trim();p=p.match(/,\d{2}$/)?p.replace(/\./g,"").replace(",","."):p.replace(/,/g,"");var m=Number(p)*Number(o)*100,h=t.split(l);return u?i(_templateObject,h[0],window.theme.currentCurrencySymbol,slate.Currency.removeCurrencySymbol(l),h[1]):i(_templateObject,h[0],window.theme.currentCurrencySymbol,slate.Currency.removeCurrencySymbol(slate.Currency.formatMoney(m,a)),h[1])}function i(e,i){var a=$(e);a.length&&o&&$.each(a,function(e,o){if(!o.classList.contains("currency-switched")){var a=o.innerText;(a.includes(r)||a.includes(n))&&(o.innerHTML=t(a,"",i),o.classList.add("currency-switched"))}})}var r=theme.currencySymbol,n=theme.currentCurrencySymbol,o=window.Shopify&&window.Shopify.currency&&window.Shopify.currency.rate,a=window.theme.moneyFormat,s="\\"+r+"\\s*\\d+(?:[.,]\\d+)*",c="\\"+n+"\\s*\\d+(?:[.,]\\d+)*";return{switchCurrency:i,getCurrencyHTML:t}}(),theme.switchBadgeCurrency=function(){function e(e){if("EU"==window.theme.store){var t=$(e),i="\\d+$",r=window.Shopify&&window.Shopify.currency&&window.Shopify.currency.rate,n=window.theme.moneyFormat;t.length&&r&&$.each(t,function(e,t){ 18var o=t.dataset.badgestr;if(o){var a=o.match(i);if(a){a=o.match(i)[0];var s=a.replace(theme.currencySymbol,""),c=s*Number(r)*100,u=slate.Currency.formatMoney(c,n),l=o.replace(a,u);t.innerHTML=l}}})}}return{updateProductCardBadges:e}}(),theme.MultilanguageBlocks=function(){function e(e,t){var i=this;if(this.container=e,this.$content=this.container.querySelector(".blocks-list"),this.$slider=$(e).find(".blocks-slider"),this.settings=e.dataset.sectionSettings||"{}",this.sectionType=this.container.dataset.sectionType,this.sectionName=this.container.dataset.sectionName,this.sectionId=this.container.dataset.sectionId,this.multilangMatchingIndex=this.container.dataset.multilangMatchingIndex,this.lang=t,this.allLangContent=[],"hero-slider--"!=this.sectionName){"hero-links-banner"===this.sectionName&&(this.banner=this.container.querySelector(".hero-links-banner__image-wrapper"));var r=JSON.parse(this.settings),n={infinite:!1,autoplaySpeed:r.slide_speed,speed:r.slide_speed/2,arrows:!1,dots:!0,responsive:[{breakpoint:window.theme.settings.grid_medium||768,settings:{slidesToShow:1,slidesToScroll:1}}]};this.sliderSettings=$.extend(n,r);var o=!1;if("omnipresent-hero-slider"===this.sectionName||"hero-slider"===this.sectionName||"homepage-hero-slider"===this.sectionName||"image-cards"===this.sectionName||"featured-blocks"===this.sectionName){o=!0,this.$slider.hasClass("slick-initialized")&&this.$slider.slick("unslick");var a=Array.from(this.$content.querySelectorAll("[data-block-language]"));this.allLangContent=a,this.showCurrentLangContent()}window.Weglot&&window.Weglot.on("languageChanged",function(e){i.lang=e,0===i.allLangContent.length?o||(o=!0,i.getAllLangContent()):i.showCurrentLangContent()})}}return e.prototype.getAllLangContent=function(){var e=this,t="hero-slider"===this.sectionType?"hero-slider-multilang-0"+this.multilangMatchingIndex:this.sectionName,i=window.location.origin+"?section_id="+this.sectionId,r=window.location.origin+"/pages/"+window.theme.homeMultilangPage+"?section_id="+t,n=this,o=function(t){return new Promise(function(i,r){fetch(t).then(function(e){return e.text()}).then(function(t){var r=new DOMParser,n=r.parseFromString(t,"text/html"),o=Array.from(n.querySelectorAll("[data-block-language]"));e.allLangContent=o,i(o)}).catch(function(e){console.error("Error:",e),r(e)})})},a=o(i),s=o(r);Promise.all([a,s]).then(function(e){n.allLangContent=e.flat(),n.showCurrentLangContent()})},e.prototype.showCurrentLangContent=function(){var e=this,t=this,i=t.allLangContent.filter(function(e){return e.dataset.blockLanguage===t.lang||"all"==e.dataset.blockLanguage});
18i.forEach(function(e){e.classList.contains("featured-block")&&e.setAttribute("style","display: flex;")});var r=i.length;0===r&&(i=t.allLangContent.filter(function(e){return"en"===e.dataset.blockLanguage}));var n="",o="";if("image-cards"===this.sectionName)switch(i.length){case 2:n="medium-up--one-half";break;case 3:n="medium-up--one-third";break;default:n="medium-up--one-quarter"}i.forEach(function(t){"image-cards"===e.sectionName&&t.classList.add(n),"hero-links-banner"===e.sectionName?"LI"===t.tagName?o+=t.outerHTML:e.banner.innerHTML=t.outerHTML:o+=t.outerHTML}),t.$slider&&t.$slider.hasClass("slick-initialized")&&t.$slider.slick("unslick"),t.$content&&(t.$content.innerHTML=o),t.$slider&&t.$slider.slick(t.sliderSettings)},e}(),theme.MultilanguageSections=function(){function e(e,t){var i=this;this.container=e,this.sectionId=this.container.dataset.sectionId,this.lang=t,this.parentContainer=this.container.parentNode,window.Weglot&&window.Weglot.on("languageChanged",function(e){i.showCurrentLangSection(e)})}return e.prototype.showCurrentLangSection=function(e){var t=this,i="en"===e?this.sectionId:"template-ear-piercing-guide-alt-lang-"+e,r=window.location.origin+"/pages/"+window.theme.piercingMultilangPage+"?section_id="+i;fetch(r).then(function(e){return e.text()}).then(function(e){var i=new DOMParser,r=i.parseFromString(e,"text/html");t.parentContainer.innerHTML=r.querySelector("[data-section-lang]").outerHTML;var n=new CustomEvent("sectionChanged");document.dispatchEvent(n);var o=t.parentContainer.querySelector('[data-component="ParentAccordionList"]');o&&new theme.ParentAccordionList(o);var a=t.parentContainer.querySelector('[data-component="AccordionList"]');a&&new theme.AccordionList(a)}).catch(function(e){console.error("Error:",e)})},e}(),theme.glbeHelpers=function(){function e(e){if(e){if(!u)return window.console.warn("glbeApp priceInfo module not loaded. Returning default price."),e;if(!window.Currency||!window.GLBE_PARAMS.PriceInfo)return window.glbeApp.modules.priceInfo.convertPrice(parseFloat(e));var t=window.GLBE_PARAMS.PriceInfo.currencyConversionRate;return parseFloat(e)*t}}function t(e){if(e){if(!u)return window.console.warn("glbeApp priceInfo module not loaded. Returning default money format."),l+" "+e;if(!window.Currency||!window.GLBE_PARAMS.PriceInfo)return p+" "+e;var t=100*e,i=window.Currency.moneyFormats[window.Shopify.currency.active].money_format;return window.Currency.formatMoney(t,i)}}function i(i){return i?t(e(i)):null}function r(){var e=document.querySelectorAll("#bookmarks .price");e.length&&e.forEach(function(e){var t=e.getAttribute("data-amount");if(void 0!==("undefined"==typeof t?"undefined":_typeof(t))){var r=parseFloat(t);e.innerHTML=i(r)}})}function n(){var e=document.querySelectorAll("[data-multibuy-offerprice]");e.length&&e.forEach(function(e){var t=e.getAttribute("data-multibuy-totalitems"),r=e.getAttribute("data-multibuy-offerprice"),n=e.classList.contains("currency-switched");if(!n&&t&&r){var o=i(r);e.innerHTML=t+" for "+o}})}function o(){var e=document.querySelectorAll(".side-cart__upsells .toggle-text");e.length&&e.forEach(function(e){var t=e.innerHTML;if(t.match(d)){var r=t.match(d)[0],n=r.replace(l,""),o=i(n);e.innerHTML=t.replace(r,o)}})}function a(){var e=document.querySelectorAll(".nav__level-three .nav__item a");e.length&&e.forEach(function(e){var t=e.innerHTML;if(t.match(d)){var r=t.match(d)[0],n=r.replace(l,""),o=i(n);e.innerHTML=t.replace(r,o)}})}function s(){var e=[".product-card__badge",".product__badge--offer",".collection-specific-banner__heading",".collection-specific-breadcrumb"];e.forEach(function(e){var t=document.querySelectorAll(e);t.length&&t.forEach(function(e){var t=e.innerHTML,r=e.classList.contains("currency-switched");if(!r&&t.match(d)){var n=t.match(d)[0],o=n.replace(l,""),a=i(o);e.innerHTML=t.replace(n,a)}})}),a(),r(),n(),o()}function c(){var e=100,t=setInterval(function(){return e<=0&&console.error("Error loading Global-E and Global-E Custom Helpers"),window.GLBE_PARAMS&&window.glbeApp&&window.glbeApp.modules&&window.glbeApp.modules.priceInfo?(window.glbeApp.modules.priceInfo.load(),window.GLBE_PARAMS.PriceInfo?(u=!0,clearInterval(t),void s()):void e--):void e--},250)}if("US"!==window.theme.store||"US"===window.theme.store&&"USD"===window.Shopify.currency.active)return!1;var u=!1,l=theme.currencySymbol,d="\\"+l+"\\s*\\d+(\\.|,\\d+)?",p=window.theme.currentCurrencySymbol;return c(),{convertPrice:e,formatMoney:t,convertPriceAndFormatMoney:i,convertMultibuyOfferPrices:n,convertUpsellTogglePrices:o}}(),theme.PLPDataLayerEvents=function(){function e(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(n){case"filter":var a=document.querySelector(".sort-options"),s="Trending";a&&(s=a[a.selectedIndex].text),t({event:"item_list_filter",interaction_type:"Add Filter",list_sort_order:s,list_filter_state:{colour:r(e,"colour"),feature:r(e,"feature"),looking_for:r(e,"_product_type"),material:r(e,"material"),plating:r(e,"plating"),price:i(e,"sale_price"),style:r(e,"style"),products_per_page:o.perPage}},"list_filter_state")}}function t(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";""!=t&&window.dataLayerPLPInterfaceObj.push({key:null}),window.dataLayerPLPInterfaceObj.push(e)}function i(e,t){var i="",r=e.filter(function(e){return e.id===t});return r.forEach(function(e){i=e.selected_min+" - "+e.selected_max}),i?i:null}function r(e,t){var i=[],r=e.filter(function(e){return e.id===t});return r.forEach(function(e){var t=e.items;t.forEach(function(e){i.push(e.name)})}),i.length?i.join(" | "):null}var n="dataLayer";return window.dataLayerPLPInterfaceObj=window[n]=window[n]||[],{trackEvent:e,setPLPDataLayerEvent:t}}(),Vue.component("quantity-selector",{props:["item","index","position","hasError"],template:'\n <div class="my-bag-quantity-selector" >\n <div class="my-bag-quantity-stepper" :class="{\'error-border\': hasError, \'normal-border\': !hasError}" >\n <button @click="decreaseQuantity" type="button" class="my-bag-quantity-selector__control my-bag-quantity-selector__control--minus" aria-label="Decrease quantity">\n \n <svg xmlns="http://www.w3.org/2000/svg" width="12" height="2" viewBox="0 0 12 2" fill="none">\n <path d="M0.68687 0.420401C0.366762 0.420398 0.107266 0.679894 0.107269 1C0.107272 1.32011 0.366763 1.5796 0.686871 1.57961L5.42031 1.57961L5.42031 1.58109L5.99992 1.58109L6.57952 1.58109V1.57961L11.3129 1.57962C11.633 1.57962 11.8925 1.32012 11.8925 1.00001C11.8925 0.679906 11.633 0.420414 11.3129 0.420411L6.57952 0.420406C6.57952 0.420406 6.25837 0.418932 5.93826 0.418928C5.61815 0.418925 5.4203 0.420416 5.4203 0.420416L0.68687 0.420401Z" fill="#333333"/>\n </svg>\n \n </button>\n <input type="number" class="my-bag-quantity-selector__quantity" :value="item.quantity" v-bind:min="item.min" v-bind:max="item.max" @input
18="inputQuantity" readonly>\n <button @click="increaseQuantity" type="button" class="my-bag-quantity-selector__control my-bag-quantity-selector__control--plus" aria-label="Increase quantity" >\n <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none">\n <path d="M1.44575 5.5032C1.17137 5.5032 0.948946 5.72562 0.948946 6C0.948946 6.27438 1.17137 6.4968 1.44575 6.4968L5.50298 6.4968L5.50298 10.554C5.50298 10.8284 5.7254 11.0508 5.99978 11.0508C6.27415 11.0508 6.49658 10.8284 6.49658 10.554L6.49658 6.4968L10.5538 6.4968C10.8281 6.4968 11.0506 6.27438 11.0506 6C11.0506 5.72562 10.8281 5.5032 10.5538 5.5032L6.49658 5.5032L6.49658 1.44597C6.49658 1.17159 6.27415 0.949168 5.99978 0.949168C5.7254 0.949168 5.50298 1.17159 5.50298 1.44597L5.50298 5.5032L1.44575 5.5032Z" fill="#333333"/>\n </svg>\n </button>\n </div>\n </div>\n ',methods:{decreaseQuantity:function(){this.$emit("update-quantity",this.item,this.item.quantity,this.index,this.position,"decrease")},increaseQuantity:function(){this.$emit("update-quantity",this.item,this.item.quantity,this.index,this.position,"increase")},inputQuantity:function(e){this.$emit("input-quantity",this.item,e,this.index)},setQuantityError:function(e){this.hasError=e}}}),Vue.component("my-bag-item-info",{props:["item","index"],template:'\n <div class="cart-item__content-header">\n <div class="cart-item__title">\n <span v-bind:data-promoItem="item.key" class="cart-item_promo-text"></span>\n <a v-bind:href="item.url" v-if="item.product_title" v-html="item.product_title"></a>\n <a v-bind:href="item.url" v-else v-html="item.title"></a>\n <span class="cart-item__preorder-note" v-if="item.properties && item.properties.type">\n {{ item.properties.type }}\n </span>\n </div>\n </div>\n ',methods:{}}),Vue.component("multibuy-qty-needed",{props:["group"],template:'\n <div class="multibuy-qty-needed" v-if="needQty > 0">\n <div class="add-more-multibuy-btn" @click="navigateToItem(item.url)">\n <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none">\n <path d="M0.927988 6.3376C0.562154 6.3376 0.265587 6.63417 0.265587 7C0.265587 7.36583 0.562154 7.6624 0.927988 7.6624L6.33763 7.6624L6.33763 13.072C6.33763 13.4378 6.63419 13.7344 7.00003 13.7344C7.36586 13.7344 7.66243 13.4378 7.66243 13.072L7.66243 7.6624H13.072C13.4378 7.6624 13.7344 7.36583 13.7344 7C13.7344 6.63417 13.4378 6.3376 13.072 6.3376L7.66243 6.3376L7.66243 0.92796C7.66243 0.562125 7.36586 0.265558 7.00003 0.265558C6.63419 0.265558 6.33763 0.562125 6.33763 0.927959L6.33763 6.3376L0.927988 6.3376Z" fill="#333333"/>\n </svg>\n </div>\n \n <div class="image-wrapper" v-for="n in needQty" :key="n">\n <div class="image-wrapper" @click="navigateToItem(group.collectionUrl)">\n <div class="inner-border">\n <svg xmlns="http://www.w3.org/2000/svg" width="14" height="23" viewBox="0 0 14 23" fill="none">\n <g clip-path="url(#clip0_3680_81277)">\n <path d="M4.90186 16.7728H9.09766V20.9686H4.90186V16.7728Z" fill="#333333"/>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.99991 3.76576C4.99431 3.76576 3.64326 5.58842 3.64326 7.12241H0.286621C0.286621 4.09807 2.79739 0.409119 6.99991 0.409119C11.189 0.409119 13.7132 4.00408 13.7132 7.12241C13.7132 9.7708 11.8536 11.1135 10.7023 11.9442L10.5076 12.0852C9.24047 13.0116 8.67823 13.5386 8.67823 14.6749H5.32159C5.32159 11.7177 7.27012 10.2944 8.52215 9.37975L8.52718 9.37639C9.92354 8.35429 10.3566 7.9666 10.3566 7.12241C10.3566 5.528 9.02061 3.76576 6.99991 3.76576Z" fill="#333333"/>\n </g>\n <defs>\n <clipPath id="clip0_3680_81277">\n <rect width="13.4266" height="21.8182" fill="white" transform="translate(0.286621 0.409119)"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n </div>\n </div>\n \n </div>\n ',methods:{navigateToItem:function(e){window.location.href=e}},computed:{needQty:function(){console.log("needQty",this.group);var e=this.group.bundleNeededQty;return e>0?e:0}}}),Vue.component("free-shipping-progress-bar",{template:'\n <div class="my-bag-free-shipping__container">\n <div class="free-shipping__indicator" data-free-shipping-element>\n <div class="free-shipping__indicator-text" >\n <div class="free-shipping__indicator-locked" v-if="progressBarStatus < 100">\n <svg xmlns="http://www.w3.org/2000/svg" width="10" height="12" viewBox="0 0 10 12" fill="none">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.05882 4.73685V4.05191C7.05882 2.59247 6.07122 1.40936 4.85294 1.40936C3.63467 1.40936 2.64706 2.59247 2.64706 4.05191V4.73685H7.05882ZM1.47059 4.73685V4.05191C1.47059 1.8141 2.98492 0 4.85294 0C6.72096 0 8.23529 1.8141 8.23529 4.05191V4.73685H8.52941C9.3416 4.73685 10 5.44376 10 6.31579V10.4211C10 11.2931 9.3416 12 8.52941 12H1.47059C0.658405 12 0 11.2931 0 10.4211V6.31579C0 5.44376 0.658405 4.73685 1.47059 4.73685ZM8.52941 6H1.47059C1.30815 6 1.17647 6.14139 1.17647 6.31579V10.4211C1.17647 10.5955 1.30815 10.7368
181.47059 10.7368H8.52941C8.69185 10.7368 8.82353 10.5955 8.82353 10.4211V6.31579C8.82353 6.14139 8.69185 6 8.52941 6ZM5.00004 7.10524C5.2437 7.10524 5.44122 7.31732 5.44122 7.57893V8.84209C5.44122 9.10369 5.2437 9.31577 5.00004 9.31577C4.75639 9.31577 4.55887 9.10369 4.55887 8.84209V7.57893C4.55887 7.31732 4.75639 7.10524 5.00004 7.10524Z" fill="#333333"/>\n </svg>\n </div>\n <div class="free-shipping__indicator-unlocked" v-if="progressBarStatus == 100">\n <svg xmlns="http://www.w3.org/2000/svg" width="10" height="12" viewBox="0 0 10 12" fill="none">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M8.07098 1.58398C7.93652 1.87234 7.59375 1.9971 7.30539 1.86263L6.37112 1.42697C5.1646 0.864368 3.77776 1.2849 3.27352 2.36625C2.76927 3.4476 3.33858 4.7803 4.54509 5.3429L4.61356 5.37483H8.35345C9.14888 5.37483 9.7937 6.01965 9.7937 6.81508V10.5597C9.7937 11.3552 9.14888 12 8.35345 12H1.44025C0.644822 12 0 11.3552 0 10.5597V6.81508C0 6.01965 0.644822 5.37483 1.44025 5.37483H2.70969C1.83991 4.36979 1.55983 2.99937 2.1084 1.82295C2.88158 0.164872 5.00807 -0.479936 6.85806 0.382727L7.79233 0.818384C8.08069 0.952848 8.20545 1.29562 8.07098 1.58398ZM8.35345 6.52703H1.44025C1.28116 6.52703 1.1522 6.65599 1.1522 6.81508V10.5597C1.1522 10.7188 1.28116 10.8478 1.44025 10.8478H8.35345C8.51253 10.8478 8.6415 10.7188 8.6415 10.5597V6.81508C8.6415 6.65599 8.51253 6.52703 8.35345 6.52703ZM5.32892 7.96731C5.32892 7.72868 5.13548 7.53523 4.89685 7.53523C4.65822 7.53523 4.46477 7.72868 4.46477 7.96731V9.11951C4.46477 9.35814 4.65822 9.55158 4.89685 9.55158C5.13548 9.55158 5.32892 9.35814 5.32892 9.11951V7.96731Z" fill="#333333"/>\n </svg>\n </div>\n\n <span class="free-shipping__indicator-content" v-html="freeShippingText" ></span>\n </div>\n\n <div class="my-bag-bar-progress">\n \n <div class="bar" id="progress-bar" v-bind:style="{ width: progressBarStatus + \'%\' }">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 18" fill="none" style="position: relative;left: 96%;bottom: 7px;">\n <path d="M23.9057 8.73988C23.971 8.90423 24.003 9.07995 23.9998 9.2568L23.9037 14.5294C23.8905 15.2562 23.2975 15.8384 22.5706 15.8384H21.3133C20.6036 17.0006 19.3107 17.7778 17.8458 17.7778C16.3865 17.7778 15.1093 17.0049 14.4253 15.8384H10.5946C9.88485 17.0006 8.59192 17.7778 7.12709 17.7778C5.66778 17.7778 4.39055 17.0049 3.70652 15.8384H2.47297C2.11514 15.8384 1.77233 15.6946 1.52162 15.4393C1.27091 15.1839 1.13334 14.8386 1.13986 14.4808L1.2223 9.95554C1.22657 9.72084 1.29123 9.50146 1.40119 9.3119C1.29615 9.11395 1.24169 8.8908 1.24585 8.66261L1.2694 7.36968C1.27015 7.32879 1.27273 7.28836 1.27706 7.24848C1.17828 7.19002 1.08663 7.11856 1.00479 7.03522C0.754082 6.7799 0.616519 6.43452 0.623036 6.07675L0.64659 4.78382C0.647334 4.74293 0.649913 4.70251 0.654245 4.66262C0.555463 4.60416 0.463813 4.5327 0.381977 4.44936C0.131267 4.19404 -0.00629601 3.84866 0.000221474 3.49089L0.0237748 2.19796C0.0370147 1.47117 0.629974 0.888916 1.35689 0.888916H15.4252C15.7831 0.888916 16.1259 1.03275 16.3766 1.28806C16.6273 1.54338 16.7649 1.88876 16.7583 2.24653L16.736 3.47477H21.2198C21.8045 3.47477 22.321 3.85572 22.4937 4.41433L22.6278 4.84799L23.8806 8.67691L23.9057 8.73988Z" fill="white"/>\n <path d="M1.35656 2.22223L1.33301 3.51516H14.0615L13.8849 13.2121H9.76083C9.48229 12.1009 8.46167 11.2727 7.22098 11.2727C5.98029 11.2727 4.9295 12.1009 4.61047 13.2121H3.83604L3.89493 9.9798H2.55508L2.47265 14.5051H4.58692C4.86546 15.6163 5.88607 16.4445 7.12677 16.4445C8.36746 16.4445 9.41825 15.6163 9.73727 14.5051H15.3057C15.5842 15.6163 16.6048 16.4445 17.8455 16.4445C19.0862 16.4445 20.137 15.6163 20.456 14.5051H22.5703L22.6663 9.23249L22.626 9.131L21.3568 5.25221L21.2195 4.80809H15.3778L15.4249 2.22223H1.35656ZM1.97938 4.80809L1.95582 6.10102H7.98511L8.00867 4.80809H1.97938ZM15.3542 6.10102H20.2319L21.3232 9.41415L21.254 13.2121H20.4796C20.201 12.1009 19.1804 11.2727 17.9397 11.2727C16.699 11.2727 15.6482 12.1009 15.3292 13.2121H15.2247L15.3542 6.10102ZM2.60219 7.39395L2.57864 8.68688H6.59817L6.62172 7.39395H2.60219ZM7.19743 12.5657C7.94573 12.5657 8.52687 13.1365 8.51372 13.8586C8.50056 14.5807 7.89862 15.1515 7.15032 15.1515C6.40202 15.1515 5.82088 14.5807 5.83403 13.8586C5.84719 13.1365 6.44912 12.5657 7.19743 12.5657ZM17.9162 12.5657C18.6645 12.5657 19.2456 13.1365 19.2325 13.8586C19.2193 14.5807 18.6174 15.1515 17.8691 15.1515C17.1208 15.1515 16.5396 14.5807 16.5528 13.8586C16.5659 13.1365 17.1679 12.5657 17.9162 12.5657Z" fill="#333333"/>\n <path d="M1.35656 2.12223C1.30204 2.12223 1.25757 2.1659 1.25658 2.22041L1.23302 3.51334C1.23254 3.54017 1.24285 3.56607 1.26166 3.58522C1.28046 3.60437 1.30617 3.61516 1.33301 3.61516H13.9597L13.7867 13.1121H9.83764C9.52138 11.9945 8.47899 11.1727 7.22098 11.1727C5.96245 11.1727 4.89154 11.9949 4.53626 13.1121H3.93788L3.99491 9.98163C3.9954 9.95479 3.98508 9.92889 3.96628 9.90974C3.94748 9.89059 3.92176 9.8798 3.89493 9.8798H2.55508C2.50057 9.8798 2.45609 9.92347 2.4551 9.97798L2.37266 14.5032C2.37218 14.5301 2.38249 14.556 2.4013 14.5751C2.4201 14.5943 2.44581 14.6051 2.47265 14.6051H4.51011C4.82637 15.7227 5.86876 16.5445 7.12677 16.5445C8.3853 16.5445 9.4562 15.7222 9.81149 14.6051H15.2289C15.5451 15.7227 16.5875 16.5445 17.845
185 16.5445C19.104 16.5445 20.1749 15.7222 20.5302 14.6051H22.5703C22.6248 14.6051 22.6693 14.5614 22.6703 14.5069L22.7663 9.23431C22.7666 9.22105 22.7642 9.20787 22.7593 9.19554L22.7201 9.09694L21.4523 5.22268L21.4518 5.22111L21.3151 4.77855C21.3021 4.73666 21.2634 4.70809 21.2195 4.70809H15.4796L15.5249 2.22405C15.5254 2.19722 15.5151 2.17131 15.4963 2.15217C15.4775 2.13302 15.4517 2.12223 15.4249 2.12223H1.35656ZM1.97938 4.70809C1.92486 4.70809 1.88039 4.75176 1.87939 4.80627L1.85584 6.0992C1.85535 6.12603 1.86567 6.15193 1.88447 6.17108C1.90327 6.19023 1.92899 6.20102 1.95582 6.20102H7.98511C8.03963 6.20102 8.0841 6.15735 8.0851 6.10284L8.10865 4.80991C8.10914 4.78308 8.09882 4.75717 8.08002 4.73802C8.06122 4.71887 8.03551 4.70809 8.00867 4.70809H1.97938ZM2.60219 7.29395C2.54767 7.29395 2.5032 7.33762 2.50221 7.39212L2.47865 8.68505C2.47817 8.71189 2.48848 8.73779 2.50729 8.75694C2.52609 8.77609 2.5518 8.78688 2.57864 8.78688H6.59817C6.65268 8.78688 6.69716 8.74321 6.69815 8.6887L6.7217 7.39577C6.72219 7.36893 6.71187 7.34303 6.69307 7.32388C6.67427 7.30473 6.64856 7.29395 6.62172 7.29395H2.60219ZM15.3303 12.9052L15.4524 6.20102H20.1596L21.2229 9.4293L21.1558 13.1121H20.5564C20.2401 11.9945 19.1977 11.1727 17.9397 11.1727C16.7603 11.1727 15.7456 11.8949 15.3303 12.9052ZM7.19743 12.6657C7.89325 12.6657 8.42581 13.194 8.41373 13.8568C8.40163 14.5211 7.84739 15.0515 7.15032 15.0515C6.45449 15.0515 5.92194 14.5232 5.93401 13.8604C5.94612 13.196 6.50036 12.6657 7.19743 12.6657ZM17.9162 12.6657C18.612 12.6657 19.1445 13.194 19.1325 13.8568C19.1204 14.5211 18.5661 15.0515 17.8691 15.0515C17.1732 15.0515 16.6407 14.5232 16.6528 13.8604C16.6649 13.196 17.2191 12.6657 17.9162 12.6657Z" stroke="#333333" stroke-width="0.2" stroke-linejoin="round"/>\n </svg>\n </div>\n\n </div>\n \n </div>\n </div>\n ',props:["freeShippingText","progressBarStatus"]}),Vue.component("my-bag-cart-item-option",{props:["item"],template:'\n <div class="my-bag-cart-item-option" v-if="hasVariantOptions">\n <p v-for="(option, index) in filteredOptions" :key="index">
18\n <span v-if="isGiftCard">Amount: {{ option }}</span>\n <span v-else>Size: {{ option }}</span>\n </p>\n <p v-if="isGiftCard && recipientName" class="gidtcard-details">To: {{ recipientName }}</p>\n <p v-if="isGiftCard && truncatedGreeting" class="gidtcard-details">\n Message: {{ truncatedGreeting }}<span v-if="hasMoreGreeting">...</span>\n </p>\n <p v-if="isGiftCard && sendOnDate" class="gidtcard-details">Sending on: {{ sendOnDate }}</p>\n </div>\n ',computed:{hasVariantOptions:function(){return this.item.variant_options&&"Default Title"!==this.item.variant_options[0]},filteredOptions:function(){return this.item.variant_options.filter(function(e){return"Default Title"!==e})},isGiftCard:function(){return"Digital Gift Card"===this.item.product_type},recipientName:function(){return this.item.properties&&this.item.properties._receiving_name?this.item.properties._receiving_name:""},truncatedGreeting:function(){return this.item.properties&&this.item.properties._greeting?this.item.properties._greeting.slice(0,50):""},hasMoreGreeting:function(){return this.item.properties&&this.item.properties._greeting&&this.item.properties._greeting.length>50},sendOnDate:function(){var e=window.theme&&window.theme.giftcard_send_on_property;return e&&this.item.properties?this.item.properties[e]||"":""}}}),Vue.component("my-bag-shared-popup",{template:'\n <div class="cart-shared-popup" v-if="visible">\n <div class="cart-shared-popup-close-btn">\n <button v-if="showCloseButton" @click="closePopup" class="close-shared-button">\n <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none">\n <path d="M1.369 0.234883C1.05582 -0.0782944 0.548061 -0.0782944 0.234883 0.234883C-0.0782944 0.548061 -0.0782944 1.05582 0.234883 1.369L4.86588 6L0.234931 10.631C-0.0782463 10.9441 -0.0782466 11.4519 0.234931 11.7651C0.548109 12.0782 1.05587 12.0782 1.36905 11.7651L6 7.13412L10.631 11.7651C10.9441 12.0782 11.4519 12.0782 11.7651 11.7651C12.0782 11.4519 12.0782 10.9441 11.7651 10.631L7.13412 6L11.7651 1.369C12.0783 1.05582 12.0783 0.548061 11.7651 0.234883C11.4519 -0.0782944 10.9442 -0.0782944 10.631 0.234883L6 4.86588L1.369 0.234883Z" fill="#333333"/>\n </svg>\n </button>\n </div>\n <div class="cart-shared-popup-header">\n <slot name="header"></slot>\n </div>\n <div class="cart-shared-popup-body">\n <slot name="content"></slot>\n \n </div>\n <div class="cart-shared-popup-footer" v-if="showFooter">\n <div class="cart-shared-popup-footer-buttons">\n \n <a \n href="#" \n class="cart-shared-popup-btn cart-shared-popup-btn-left"\n @click.prevent="handleLeftClick"\n >\n {{ leftButtonText }}\n </a>\n \n \n <a \n href="#" \n class="cart-shared-popup-btn cart-shared-popup-btn-right"\n @click.prevent="handleRightClick"\n :disabled="rightButtonLoading"\n >\n <span v-if="!rightButtonLoading">{{ rightButtonText }}</span>\n <span v-if="rightButtonLoading" class="cart-shared-popup-btn-loader"></span>\n </a>\n \n </div>\n </div>\n </div>\n ',props:{visible:{type:Boolean,default:!1},showCloseButton:{type:Boolean,default:!0},showFooter:{type:Boolean,default:!0},leftButtonText:{type:String,default:"More details"},rightButtonText:{type:String,default:"Continue"},rightButtonLoading:{type:Boolean,default:!1}},data:function(){return{countries:[],currentTab:0}},methods:{closePopup:function(){this.$emit("close"),document.getElementById("my-bag-cart-popup-overlay").style.display="none"},handleLeftClick:function(){this.$emit("close"),document.getElementById("my-bag-cart-popup-overlay").style.display="none"}
18,handleRightClick:function(){this.$emit("right-button-click")}}}),Vue.component("out-stock-items-display",{props:["group","index"],template:'\n <div class="out-stock-items-display">\n <div class="out-stock-items-header" v-if="group.isMultibuy">\n <span class="out-stock-multibuy-title">{{group.title}}</span>\n </div>\n <div class="out-stock-items-display-body">\n <div class="out-stock-items-display-wrapper" v-for="item in group.outStockItems" :key="item.id">\n \n <div class="out-stock-items__image-container">\n <a v-bind:href="item.url">\n <img width="120" height="154" v-bind:src="getItemImage(item.image)" v-bind:alt="escape(item.title)">\n </a>\n </div>\n <div class="out-stock-items__info-container">\n <div class="out-stock-items-display-item-title">\n <a v-bind:href="item.url" v-if="item.product_title" v-html="item.product_title"></a>\n <a v-bind:href="item.url" v-else v-html="item.title"></a>\n <span class="cart-item__preorder-note" v-if="item.properties && item.properties.type">\n {{ item.properties.type }}\n </span>\n <div class="out-stock-items-display-item-status-stock">\n <div v-if="item.isShippingOnly" class="cart-item__stock">\n <div class="cart-item__stock-status-icon" >\n <svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8" fill="none"><circle cx="4" cy="4" r="4" fill="#CCCCCC"/></svg>\n </div>\n <span>Unavailable for Click & Collect</span>\n </div>\n <div v-if="item.stockStatusInfo && !item.isShippingOnly" class="cart-item__stock"> \n <div class="cart-item__stock-status-icon" v-html="item.stockStatusInfo.icon"></div>\n <span v-html="item.stockStatusInfo.text"></span>\n </div>\n </div>\n </div>\n <my-bag-cart-item-option :item="item" ></my-bag-cart-item-option>\n <div class="out-stock-items-display-item-status-actions">\n <div class="out-stock-items-display-item-status">\n <span class="out-stock-items-display-item-status-qty">Qty: {{ item.missingStockQuantity }}</span>\n <div class="out-stock-items-display-item-status-price">Price: \n <span class="li-cp-item" >\n <div class="cart-item__price" v-html="item.missingStockDisplayPrice"></div>\n </span>\n </div>\n </div>\n <div class="out-stock-items-display-item-actions">\n \n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n ',methods:{getItemImage:function(e){var t=theme.assetUrl+"placeholder-portrait.svg";return e&&(t=e.src?e.src:e),slate.Image.getSizedImageUrl(t,"120x")}}}),Vue.component("stock-summary-display",{props:["stockStatusSummary"],template:'\n <div class="my-bag-cc-delivery-summary"> \n <div class="cart-item__stock-status-container" v-if="stockStatusSummary && stockStatusSummary.lowStock > 0">\n <div class="cart-item__stock-status-icon" >\n <svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8" fill="none"><circle cx="4" cy="4" r="4" fill="#FFC107"/></svg>\n </div>\n <span class="cart-item__stock-status-number" v-text="stockStatusSummary.lowStock"></span>\n <span class="cart-item__stock-status-string" >Low stock</span>\n </div>\n \n <div class="cart-item__stock-status-container" v-if="stockStatusSummary && stockStatusSummary.shippingOnly > 0">\n <div class="cart-item__stock-status-icon" >\n <svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8" fill="none"><circle cx="4" cy="4" r="4" fill="#CCCCCC"/></svg>\n </div>
18\n <span class="cart-item__stock-status-number" v-text="stockStatusSummary.shippingOnly"></span>\n <span class="cart-item__stock-status-string" >Unavailable for Click & Collect</span>\n </div>\n </div>\n '}),window.theme.sections=window.theme.sections||new slate.Sections,window.theme._registeredSections=window.theme._registeredSections||{},$(document).ready(function(){function e(){if(window.Weglot&&window.Weglot.initialized){var t=window.Weglot.getCurrentLang();document.querySelectorAll("[data-multilang-section]").forEach(function(e){theme.MultilanguageBlocks&&new theme.MultilanguageBlocks(e,t)});var i=document.querySelector("[data-section-lang]");i&&theme.MultilanguageSections&&new theme.MultilanguageSections(i,t)}else setTimeout(function(){ 19e()},500)}window.theme.sections.register("footer",theme.footer),window.theme._registeredSections.footer=!0,getAllProducts(),function(){if("US"===window.theme.store&&window.location.pathname.includes("a/wishlist")){var e=function(){var e=document.querySelectorAll("#bookmarks .price");e.length&&e.forEach(function(e){return e.style.display="none"})};window.setTimeout(function(){return e()},1e3)}}();var t=new URL(window.location.href),i=t.searchParams.get("via-feature"),r=t.searchParams.get("campaign-name");if(t.searchParams.has("campaign-name")&&!r){var n=window.theme.template.name,o=window.theme.currentPageHandle;n&&o&&(r=n+" - "+o.replace(/-/," "))}i&&r&&window.pushEvent({event:"contentClick",campaignName:r,contentType:i}),$(".in-page-link").on("click",function(e){slate.a11y.pageLinkFocus($(e.currentTarget.hash))}),slate.rte.wrapTable(),slate.rte.iframeReset(),slate.cart.cookiesEnabled()&&(document.documentElement.className=document.documentElement.className.replace("supports-no-cookies","supports-cookies")),document.querySelectorAll("[data-component]").forEach(function(e){theme[e.dataset.component]?new theme[e.dataset.component](e):console.error(e.dataset.component,"component is not defined.")});var a=!!window.theme.enableWeglot&&window.theme.enableWeglot;a&&e(),document.querySelectorAll("[data-template]").forEach(function(e){theme[e.dataset.template]?new theme[e.dataset.template](e):console.error(e.dataset.template,"template is not defined.")});var s=document.querySelector("#MainContent");document.querySelectorAll("[data-dialog]").forEach(function(e){var t=new window.A11yDialog(e,s);t.container.classList.remove("hidden")}),new ScrollTrigger({toggle:{visible:"animate-finish",hidden:"animate-start"},offset:{x:0,y:window.innerHeight/4},once:!0}),$(document).on("click",".smooth-scroll",function(e){if(location.pathname.replace(/^\//,"")===this.pathname.replace(/^\//,"")&&location.hostname===this.hostname){var t,i=$(this.hash);t=document.querySelector("body").classList.contains("header-is-scrolled")?50:150,i=i.length?i:$("[name="+this.hash.slice(1)+"]"),i.length&&(e.preventDefault(),$("html, body").animate({scrollTop:i.offset().top-t}
19,500,function(){var e=$(i);return e.focus(),!e.is(":focus")&&(e.attr("tabindex","-1"),void e.focus())}))}}),window.pintrk&&($(".product__add").click(function(){pintrk("track","addtocart")}),$(".product__add--mobile").click(function(){pintrk("track","addtocart")}));var c=$("[data-accordion-trigger]");c.on("click",function(){c.find(".icon").toggle(),c.siblings(".collection-description__content").slideToggle()})}),function(){var e=document.getElementById("SitewideBanner");e&&(Cookies.get("vosn_password")?e.style.display="block":e.remove())}(),function(){var e=document.getElementById("message_modal_label");e&&""===e.innerText&&e.remove()}(),function(){function e(){window.theme.lastActiveElement&&(window.theme.lastActiveElement.focus(),window.theme.lastActiveElement=null),document.querySelector("body").classList.remove("stopScrolling"),t.classList.remove("region-currency-modal--visible"),t.setAttribute("aria-hidden","true"),$(document).off("keydown:escape",e)}var t=document.querySelector("[data-region-currency-modal]"),i=document.querySelectorAll("[data-region-currency-trigger]"),r=document.querySelectorAll("[data-close-region-currency]");t&&i.length&&(i.forEach(function(i){i.addEventListener("click",function(){window.theme.lastActiveElement=document.activeElement,t.classList.add("region-currency-modal--visible"),t.setAttribute("aria-hidden","false"),t.focus(),document.querySelector("body").classList.add("stopScrolling"),$(document).on("keydown:escape",e);var i=JSON.parse(localStorage.getItem("ga4-promotionView")||"{}"),r=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),n=r.menu_navigation_state||{};window.pushEvent({event:"region_selector_action",menu_navigation_state:n,ecommerce:i,interaction_type:"View",region_selector_state:{currency:window.theme.currentCurrency,region:window.theme.store,is_globale_currency:"US"===window.theme.store&&"USD"===window.theme.currentCurrency}},"region_selector_state")})}),r.length&&r.forEach(function(t){t.addEventListener("click",e)}))}(),function(){var e=".collection-specific-banner__heading";theme.CurrencySwitcher.switchCurrency(e);var t=".collection-specific-breadcrumb";theme.CurrencySwitcher.switchCurrency(t)}(),$(document).ready(function(){$(".show-password-form-btn").click(function(){$(".password-form").toggle(400)})}),initSubscriberTracking(),window.addEventListener("pageshow",function(e){if(e.persisted){var t=[].concat(_toConsumableArray(document.querySelectorAll(".header__cart-count")));fetch(window.Shopify.routes.root+"cart.js").then(function(e){return e.json()}).then(function(e){return t.forEach(function(t){return t.innerText=e.item_count}),e})}}),function(){for(var e=document.links,t=0,i=e.length;t<i;t++)"_blank"==e[t].target&&(e[t].rel="noreferrer noopener")}();var safeParseGAConfig=function(e){try{return JSON.parse(e||"{}")}catch(e){return console.warn("GA tracking config skipped (invalid JSON):",e.message),{}}},ecommerceWithCreatives=function(e,t,i){var r=window.matchMedia("(max-width: "+window.theme.settings.grid_medium+"px)"),n=safeParseGAConfig(t),o=Object.assign(i,{creative_name:r.matches?n.creative_name_mobile:n.creative_name_desktop,creative_path:r.matches?n.creative_path_mobile:n.creative_path_desktop,promotion_slot_position:e});return o.promotion_name&&(o.promotion_name=i.promotion_name.toUpperCase()),void 0===o.creative_name&&delete o.creative_name,void 0===o.creative_path&&delete o.creative_path,o.creative_path_desktop&&delete o.creative_path_desktop,o.creative_path_mobile&&delete o.creative_path_mobile,o.creative_name_desktop&&delete o.creative_name_desktop,o.creative_name_mobile&&delete o.creative_name_mobile,o};window.gaTrackingContentName=function(e,t,i,r){var n=function(){window.theme.observeElement(e,function(){var n=e.dataset.gaTrackingConfig,o=safeParseGAConfig(n);if(n&&Object.keys(o).length){var a=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),s=a.menu_navigation_state||{},c=ecommerceWithCreatives(t,n,o);window.pushEvent({event:"view_promotion",menu_navigation_state:s,ecommerce:c},"ecommerce"),localStorage.setItem("ga4-promotionView",JSON.stringify(c));var u=e.querySelectorAll(i);u.length&&u.forEach(function(e){e.addEventListener("click",function(){var e=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),i=e.menu_navigation_state||{},r=Object.assign(o,{creative_action_registered:!0});window.pushEvent({event:"select_promotion",menu_navigation_state:i,ecommerce:ecommerceWithCreatives(t,n,r)},"ecommerce")})});var l=e.querySelectorAll(r);l.length&&l.forEach(function(e,i){e.addEventListener("click",function(){var r=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),a=r.menu_navigation_state||{},s=function(t){return"true"===e.dataset.gaTrackingArticleTileBtn||i===t},c=o.buttons.map(function(e,t){return e.action_registered=s(t),e}),u=Object.assign(o,{creative_action_registered:!0,buttons:c});window.pushEvent({event:"select_promotion",menu_navigation_state:a,ecommerce:ecommerceWithCreatives(t,n,u)},"ecommerce")})})}})};n(e)};var trackGAUpsellConfig=function(e,t){if(e){var i=e.dataset.gaTrackingConfig,r=JSON.parse(i||"{}"),n=ecommerceWithCreatives(t,i,r),o=new MutationObserver(function(){var a=e.querySelectorAll("[data-apz-upsell-product-handle]"),s=sessionStorage.getItem(PRODUCTS_STORAGE_KEY_LOADED);if(a.length&&s){o.disconnect();var c=JSON.parse(sessionStorage.getItem(PRODUCTS_STORAGE_KEY)||"[]"),u=[].concat(_toConsumableArray(a)).slice(0,20).map(function(e,t){var i=e.dataset.apzUpsellProductHandle,r=c.find(function(e){return e.handle===i}),n=e.querySelector(".am_rec_item_price").innerHTML.replace("$","");return e.setAttribute("data-sku",r.sku),{index:t+1,item_id:r.sku,item_name:r.t
19itle,item_brand:"Lovisa",item_category:r.productType,item_list_id:"home-recommendations",item_list_name:"Product Upsell Feed",price:Number(n),quantity:1}}),l={items:u,itemListId:"home-recommendations",itemListName:"Home Recommendations",itemListType:"Product Upsell Feed"},d=void 0,p=function(){var o=l.items,a=l.itemListId,s=l.itemListName,c=l.itemListType,u=[],p=function(){var p=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];p.length&&(d&&clearTimeout(d),d=setTimeout(function(){var d=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),h=d.menu_navigation_state||{},f=Object.assign(n,{items:p,item_list_id:a,item_list_name:s,item_list_type:c,item_total_count:o.length,item_visible_count:l.itemsVisible.length,creative_action_registered:!1});window.pushEvent({event:"view_promotion",menu_navigation_state:h,ecommerce:f},"ecommerce"),localStorage.setItem("ga4-promotionView",JSON.stringify(f)),m.forEach(function(e){e.addEventListener("click",function(){var t=e.dataset.sku,i=p.find(function(e){return e.item_id===t});i&&window.pushEvent({event:"select_promotion",menu_navigation_state:h,ecommerce:Object.assign(f,{creative_action_registered:!0,items:[i]})},"ecommerce")})});var g=e.querySelectorAll("[data-ga-tracking-btn]");g.length&&g.forEach(function(e,n){e.addEventListener("click",function(){var o=JSON.parse(localStorage.getItem("ga4-navigationClick")||"{}"),a=o.menu_navigation_state||{},s=function(t){return"true"===e.dataset.gaTrackingArticleTileBtn||n===t},c=r.buttons.map(function(e,t){return e.action_registered=s(t),e}),u=Object.assign(f,{creative_action_registered:!0,buttons:c});window.pushEvent({event:"select_promotion",menu_navigation_state:a,ecommerce:ecommerceWithCreatives(t,i,u)},"ecommerce")})}),u=[]},1e3))},m=e.querySelectorAll("[data-apz-upsell-product-handle]");m.length&&m.forEach(function(e){var t=window.theme.isElementVisibleInViewport(e);e.setAttribute("data-visible-by-default",t),t&&u.push(e.getAttribute("data-sku"));var i=function(i,r){i.forEach(function(i){var n=e.getAttribute("data-visible-by-default")||!1;if(t=window.theme.isElementVisibleInViewport(e,!0),i.intersectionRatio>0&&(r.unobserve(i.target),e.setAttribute("data-visible-in-viewport",t),t)){u.push(e.getAttribute("data-sku"));var a=o.filter(function(e){return u.includes(e.item_id)});l.itemsVisible=l.itemsVisible||[];var s=a.map(function(e){var t=l.itemsVisible.find(function(t){return t.item_id===e.item_id}),i=e;return i.visible_by_default=n,t||l.itemsVisible.push(i),i});p(s)}})},r=new IntersectionObserver(i);r.observe(e)})},m={threshold:1},h=function(e,t){e.forEach(function(e){e.intersectionRatio>0&&(p(),t.unobserve(e.target))})},f=new IntersectionObserver(h,m);f.observe(e)}}),a={attributes:!0,childList:!0,subtree:!0};o.observe(e,a)}},trackGAConfigs=function(){var e=document.querySelectorAll("[data-ga-tracking-config]");e.length&&e.forEach(function(e,t){"true"===e.dataset.articleTile?window.gaTrackingContentName(e,t+1,"[data-ga-tracking-article-tile-link-overlay]","[data-ga-tracking-article-tile-btn]"):"true"===e.dataset.gaTrackingUpsellConfig?trackGAUpsellConfig(e,t+1):window.gaTrackingContentName(e,t+1,"[data-ga-tracking-link-overlay]","[data-ga-tracking-btn]")})};document.addEventListener("DOMContentLoaded",function(){window.theme.observeElement&&window.gaTrackingContentName&&trackGAConfigs()}),$(document).on("keydown",'[role="button"], .js-key-activatable, [tabindex="0"]',function(e){"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),$(this).trigger("click"))}),$(document).on("keydown",function(e){"Escape"===e.key?$(document).trigger("keydown:escape"):" "===e.key||"Spacebar"===e.key||"Space"===e.code?$(document).trigger("keydown:space"):"Enter"===e.key?$(document).trigger("keydown:enter"):"Tab"===e.key?$(document).trigger("keydown:tab"):"ArrowUp"===e.key?$(document).trigger("keydown:up"):"ArrowDown"===e.key?$(document).trigger("keydown:down"):"ArrowLeft"===e.key?$(document).trigger("keydown:left"):"ArrowRight"===e.key&&$(document).trigger("keydown:right")}),function(){function e(){try{return JSON.parse(sessionStorage.getItem(o))||{}}catch(e){return{}}}function t(e){sessionStorage.setItem(o,JSON.stringify(e))}function i(e,t){var i=document.querySelectorAll('[data-match-collection-url="'+e+'"]');
19i.forEach(function(e){return e.setAttribute("href",t)})}function r(e){return fetch("https://"+window.Shopify.shop+"/api/2025-10/graphql.json",{method:"POST",headers:{"Content-Type":"application/graphql","X-Shopify-Storefront-Access-Token":window.theme.storefrontAPIToken},body:'query {\n collections(query: "title:'+e+'", first: 10) {\n edges {\n node {\n title\n onlineStoreUrl\n }\n }\n }\n }'}).then(function(e){return e.json()}).then(function(r){if(r&&r.data&&r.data.collections&&r.data.collections.edges){var n=r.data.collections.edges.find(function(t){return t.node.title===e});if(n){var o=n.node.onlineStoreUrl;a[e]=o,t(a),i(e,o)}}}).catch(function(){})}function n(){var e=Array.from(document.querySelectorAll("[data-match-collection-url]")).map(function(e){return e.dataset.matchCollectionUrl}),t=[].concat(_toConsumableArray(new Set(e)));t.forEach(function(e){a[e]?i(e,a[e]):r(e)})}var o="collectionTitlesMap",a=e();n(),document.addEventListener("cart:rendered",n),document.addEventListener("side-cart:rendered",n)}(),function(){function e(){if(window.matchMedia("(max-width: 989px)").matches){var e=document.querySelector("[data-shm-chrome]");if(e)return Math.round(e.getBoundingClientRect().height)}var t=document.querySelector(".site-header-section");return t&&t.offsetHeight>0?Math.round(t.getBoundingClientRect().height):0}function t(){var t=document.body,i=document.querySelector(".collection__container .collection-sorting"),r=document.querySelector(".plp-header");t.style.setProperty("--headerHeight",e()+"px"),i&&t.style.setProperty("--sortingHeight",i.offsetHeight+"px"),r&&t.style.setProperty("--plpHeaderHeight",r.offsetHeight+"px")}window.theme=window.theme||{},window.theme.getStickyHeaderHeight=e,t(),window.addEventListener("load",t),window.addEventListener("resize",t),window.addEventListener("collection:rendered",t),document.addEventListener("header:metrics-updated",t)}();var debounce=function(e,t){var i=null;return function(){for(var r=arguments.length,n=Array(r),o=0;o<r;o++)n[o]=arguments[o];window.clearTimeout(i),i=window.setTimeout(function(){e.apply(void 0,n)},t)}};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.