1customElements.get("products-bundle")||customElements.define("products-bundle",class extends HTMLElement{constructor(){super(),this.cartDrawerElement=document.querySelector("cart-drawer"),this.addToCartButtonElement=this.querySelector(".products-bundle__button button"),this.addToCartButtonElement&&this.addToCartButtonElement.addEventListener("click",this.handleButtonClick.bind(this))}handleButtonClick(event){event.preventDefault(),this.lastClickedElement=event.submitter||event.currentTarget;const items={items:[...this.querySelectorAll("product-bundle-variant-selector")].map(product=>({id:product.querySelector("[name=id]").value,quantity:product.querySelector("quantity-input")?Number(product.querySelector("quantity-input").input.value):1}))};if(document.body.classList.contains("cart-template")||FoxTheme.settings.cartType!="drawer"){FoxTheme.utils.postLink(FoxTheme.routes.cart_add_url,{parameters:{...items}});return}this.showErrorMessage(),this.toggleButtonLoading(!0);let sectionsToBundle=[];document.documentElement.dispatchEvent(new CustomEvent("cart:grouped-sections",{bubbles:!0,detail:{sections:sectionsToBundle}}));const body=JSON.stringify({...items,sections:sectionsToBundle,section_url:window.pathname});fetch(`${FoxTheme.routes.cart_add_url}`,{...FoxTheme.utils.fetchConfig("javascript"),body}).then(response=>response.json()).then(async parsedState=>{if(parsedState.status){this.showErrorMessage(parsedState.description);return}if(parsedState.status===422)document.dispatchEvent(new CustomEvent("product-ajax:error",{detail:{errorMessage:parsedState.description}}));else{const cartJson=await(await fetch(`${FoxTheme.routes.cart_url}`,{...FoxTheme.utils.fetchConfig()})).json();cartJson.sections=parsedState.sections,FoxTheme.pubsub.publish(FoxTheme.pubsub.PUB_SUB_EVENTS.cartUpdate,{cart:cartJson}),document.dispatchEvent(new CustomEvent("product-ajax:added",{detail:{product:parsedState}})),this.cartDrawerElement&&this.cartDrawerElement.show(this.lastClickedElement)}}).catch(e=>{console.error(e)}).finally(()=>{this.toggleButtonLoading(!1)})}showErrorMessage(errorMessage=!1){this.errorMessageElement=this.errorMessageElement||this.querySelector(".product-form__error-message"),this.errorMessageElement?(this.errorMessageElement.hidden=!errorMessage,errorMessage&&(this.errorMessageElement.textContent=errorMessage)):errorMessage&&alert(errorMessage)}toggleButtonLoading(status){status?(this.addToCartButtonElement.classList.add("btn--loading"),this.addToCartButtonElement.setAttribute("disabled",!0)):(this.addToCartButtonElement.classList.remove("btn--loading"),this.addToCartButtonElement.removeAttribute("disabled"))}}),customElements.get("product-bundle-variant-selector")||customElements.define("product-bundle-variant-selector",class extends HTMLElement{constructor(){super()}get priceElement(){return this.querySelector(".f-price")}get variantSelect(){return this.querySelector("select")}get productId(){return this.dataset.productId}get productHandle(){return this.dataset.productHandle}get quantityInput(){return this.querySelector("quantity-input input")}get rootUrl(){return window.Shopify.routes.root}get sectionId(){return this.dataset.sectionId}get blockId(){return this.dataset.blockId}connectedCallback(){this.selectors={mainImg:".product-card__image--main",soldOut:"f-price--sold-out",onSale:"f-price--on-sale",noCompare:"f-price--no-compare"},this.mainImage=this.querySelector(this.selectors.mainImg),this.currentOptionIds=this.variantSelect?this.variantSelect.options[this.variantSelect.selectedIndex].dataset.optionsId:null,this.currentVariantId=this.variantSelect?this.variantSelect.value:null,this.variantSelect&&this.variantSelect.addEventListener("change",this.handleVariantChange.bind(this))}handleVariantChange(event){const variantSelect=event.target;this.currentOptionIds=variantSelect.options[variantSelect.selectedIndex].dataset.optionsId,this.currentVariantId=variantSelect.value,this.updatePrice(variantSelect),fetch(`${this.rootUrl}products/${this.productHandle}/?section_id=${this.sectionId}&option_values=${this.currentOptionIds}`).then(response=>response.text()).then(responseText=>{const html=new DOMParser().parseFromString(responseText,"text/html");((id,shouldHide=source=>!1)=>{const source=html.getElementById(`${id}-${this.blockId}`),destination=this.querySelector(`#${id}-${this.dataset.blockId}`);source&&destination&&(destination.innerHTML=source.innerHTML,destination.classList.toggle("hidden",shouldHide(source)))})("QuantityRule",({classList})=>classList.contains("hidden")),this.updateQuantityRules(this.blockId,this.productId,html);const selectedVariantMedia=html.querySelector(`.product-bundle-card[data-block-id=${this.blockId}] .selected-variant-media`);selectedVariantMedia&&this.mainImage&&(this.mainImage.innerHTML=selectedVariantMedia.innerHTML)}).catch(error=>{console.error(error)})}updatePrice(variantSelect){const selectedVariant=variantSelect.options[variantSelect.selectedIndex],compareAtPrice=parseInt(selectedVariant.dataset.compare_at_price||0),price=parseInt(selectedVariant.dataset.price||0),available=selectedVariant.dataset.available==="true",priceVaries=variantSelect.dataset.price_varies==="true",compareAtPriceVaries=variantSelect.dataset.compare_at_price_varies==="true";this.priceElement.classList.remove(this.selectors.soldOut),this.priceElement.classList.remove(this.selectors.onSale),this.priceElement.classList.remove(this.selectors.noCompare),available?compareAtPrice>price&&available&&this.priceElement.classList.add(this.selectors.onSale):this.priceElement.classList.add(this.selectors.soldOut),!priceVaries&&compareAtPriceVaries&&this.priceElement.classList.add(this.selectors.noCompare);const regularPriceElement=this.querySelector(".f-price__regular");regularPriceElement.querySelector(".f-price-item--regular").innerHTML=`${FoxTheme.Currency.formatMoney(price,FoxTheme.settings.moneyFormat)}`;const salePriceElement=this.querySelector(".f-price__sale");salePriceElement.querySelector(".f-price-item--regular").innerHTML=`<s>${FoxTheme.Currency.formatMoney(compareAtPrice,FoxTheme.settings.moneyFormat)}</s>`,salePriceElement.querySelector(".f-price-item--sale").innerHTML=`${FoxTheme.Currency.formatMoney(price,FoxTheme.settings.moneyFormat)}`}updateQuantityRules(sectionId,productId,parsedHTML){this.quantityInput&&(FoxTheme.pubsub.publish(FoxTheme.pubsub.PUB_SUB_EVENTS.quantityRules,{data:{sectionId,productId,parsedHTML}}),this.setQuantityBoundries())}setQuantityBoundries(){FoxTheme.pubsub.publish(FoxTheme.pubsub.PUB_SUB_EVENTS.quantityBoundries,{data:{sectionId:this.blockId,productId:this.productId}})}}),customElements.get("products-bundle-slider")||customElements.define("products-bundle-slider",class extends HTMLElement{constructor(){super()}connectedCallback(){this.selectors={sliderWrapper:".products-bundle__items",nextEl:".swiper-button-next",prevEl:".swiper-button-prev",controls:".swiper-control
1s"},this.classes={grid:"f-grid",swiper:"swiper",swiperWrapper:"swiper-wrapper"},this.sectionId=this.dataset.sectionId,this.productsBundle=this.closest("products-bundle"),this.sliderWrapper=this.querySelector(this.selectors.sliderWrapper),this.enableSlider=this.dataset.enableSlider==="true",this.enableSwipeMobile=this.dataset.enableSwipeMobile==="true",this.total=parseInt(this.dataset.total),this.items=parseInt(this.dataset.items),this.laptopItems=parseInt(this.dataset.laptopItems),this.tabletItems=parseInt(this.dataset.tabletItems),this.mobileItems=parseInt(this.dataset.mobileItems),this.sliderInstance=!1,this.init(),Array.from([FoxTheme.config.mediaQueryMobile,FoxTheme.config.mediaQueryTablet,FoxTheme.config.mediaQueryLaptop]).forEach(mediaQuery=>{const mql=window.matchMedia(mediaQuery);mql.onchange=this.init.bind(this)})}get columnEls(){return this.querySelectorAll(".f-column")}get columnGap(){const columnGap=window.getComputedStyle(this.sliderWrapper).getPropertyValue("--f-column-gap");return parseFloat(columnGap.replace("rem",""))*10}init(){FoxTheme.config.mqlMobile?this.enableSlider=this.total>this.mobileItems&&!this.enableSwipeMobile:FoxTheme.config.mqlTablet?this.enableSlider=this.total>this.tabletItems:FoxTheme.config.mqlLaptop?this.enableSlider=this.total>this.laptopItems:this.enableSlider=this.dataset.enableSlider==="true",this.enableSlider?this.initSlider():this.destroySlider()}initSlider(){typeof this.sliderInstance!="object"&&(this.sliderOptions={slidesPerView:this.mobileItems,spaceBetween:this.columnGap,navigation:{nextEl:this.productsBundle.querySelector(this.selectors.nextEl),prevEl:this.productsBundle.querySelector(this.selectors.prevEl)},pagination:!1,breakpoints:{768:{slidesPerView:this.tabletItems},1024:{slidesPerView:this.laptopItems},1280:{slidesPerView:this.items}},loop:!1,threshold:2},this.classList.add(this.classes.swiper),this.sliderWrapper.classList.remove(this.classes.grid),this.sliderWrapper.classList.add(this.classes.swiperWrapper),this.productsBundle.querySelector(this.selectors.controls)?.classList.remove("hidden"),this.sliderInstance=new window.FoxTheme.Carousel(this,this.sliderOptions),this.sliderInstance.init(),Shopify.designMode&&typeof this.sliderInstance=="object"&&document.addEventListener("shopify:block:select",e=>{if(e.detail.sectionId!=this.sectionId)return;let{target}=e;const index=Number(target.dataset.index);this.sliderInstance.slider.slideTo(index)}))}destroySlider(){this.classList.remove(this.classes.swiper),this.sliderWrapper.classList.remove(this.classes.swiperWrapper),this.sliderWrapper.classList.add(this.classes.grid),this.productsBundle.querySelector(this.selectors.controls)?.classList.add("hidden"),typeof this.sliderInstance=="object"&&(this.sliderInstance.slider.destroy(),this.sliderInstance=!1)}}),customElements.get("products-bundle-hotspot")||customElements.define("products-bundle-hotspot",class extends HTMLElement{constructor(){super(),this.cssClasses={hover:"is-hover",active:"is-active"}}connectedCallback(){this.init(),Array.from([FoxTheme.config.mediaQueryMobile,FoxTheme.config.mediaQuerySmallDesktop]).forEach(mediaQuery=>{const mql=window.matchMedia(mediaQuery);mql.onchange=this.init.bind(this)})}disconnectedCallback(){this.removeEventListener("mouseover",this.handleHover.bind(this)),this.removeEventListener("mouseleave",this.handleHover.bind(this))}init(){this.sliderInstance=this.bundleSlider.sliderInstance,this.addEventListener("mouseover",this.handleHover.bind(this,"enter")),this.addEventListener("mouseleave",this.handleHover.bind(this,"leave")),Shopify.designMode&&(document.addEventListener("shopify:block:select",e=>{if(e.detail.sectionId!=this.sectionId)return;let{target}=e;this.toggleActive(target)}),document.addEventListener("shopify:block:deselect",()=>{this.toggleActive(null)}))}handleHover(type,event){this.section.classList.toggle(this.cssClasses.hover,type==="enter");const selectedItem=this.bundleSlider.columnEls[this.index];if(type==="enter"){if(this.toggleActive(event.target),selectedItem.classList.add("is-selected"),typeof this.sliderInstance=="object"&&this.sliderInstance.slider.slideTo(this.index),FoxTheme.config.mqlMobile&&(this.scrollToTop(selectedItem),this.bundleSlider.enableSwipeMobile)){const totalWidth=this.bundleSlider.columnEls[0].offsetWidth*parseInt(this.index),totalGap=this.bundleSlider.columnGap*parseInt(this.index),offset=totalWidth+totalGap;this.bundleSlider.scrollTo({behavior:"smooth",left:offset})}}else this.toggleActive(null),Array.from(this.bundleSlider.columnEls).forEac
1h(col=>col.classList.remove("is-selected"))}toggleActive(target){target?this.dataset.blockId===target.dataset.blockId?this.classList.add(this.cssClasses.active):this.classList.remove(this.cssClasses.active):this.classList.remove(this.cssClasses.active)}scrollToTop(target,offset=80){((selector,offset2)=>{window.scrollTo({behavior:"smooth",top:selector.getBoundingClientRect().top-document.body.getBoundingClientRect().top-offset2})})(target,offset)}get sectionId(){return this.dataset.sectionId}get section(){return this.closest(`.section-${this.sectionId}`)}get bundleSlider(){return this.section.querySelector("products-bundle-slider")}get index(){return this.dataset.index}}); 2//# sourceMappingURL=/cdn/shop/t/41/assets/products-bundle.js.map?v=54370151440204702351782888260
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.