1class SassListing extends HTMLElement{constructor(){super(),this.productItem=this.querySelectorAll(".sass-item"),this.addToCart=document.querySelector(".sass-checkout"),this.variantButton=this.querySelector(".variant-slider button"),this.footer=document.querySelector(".sass-footer"),this.gifts=document.querySelectorAll(".page-sass__gifts-product"),new ResizeObserver(entries=>this.resize()).observe(this),this.addListeners(),window.innerWidth>=768&&this.equalizeWrapperHeights()}getSavedUpsellRedirectUrl(firstUpsellPageUrl){const redirectStateApi=window.sassUpsellRedirectState;if(!redirectStateApi?.readForEntry||!redirectStateApi?.readForCurrentPage||!redirectStateApi?.normalizeUrl)return"";const currentUrl=redirectStateApi.normalizeUrl(window.location.href),normalizedFirstUpsellPageUrl=redirectStateApi.normalizeUrl(firstUpsellPageUrl);if(!currentUrl||!normalizedFirstUpsellPageUrl)return"";const savedRedirectState=redirectStateApi.readForEntry(currentUrl,normalizedFirstUpsellPageUrl);if(!savedRedirectState?.redirectUrl){const fallbackState=redirectStateApi.readForCurrentPage(currentUrl);return!fallbackState?.redirectUrl||currentUrl===fallbackState.redirectUrl?"":fallbackState.redirectUrl}return currentUrl===savedRedirectState.redirectUrl?"":savedRedirectState.redirectUrl}resize(){window.innerWidth>=768&&(this.querySelector(".sass-item").classList.remove("checked"),this.querySelector(".sass-item").classList.add("checked"),this.querySelectorAll(".page-sass__product-wrapper").forEach(w=>w.style.minHeight=""))}equalizeWrapperHeights(){setTimeout(()=>{console.log("SassListing: Equalizing wrapper heights...");const wrappers=this.querySelectorAll(".page-sass__product-wrapper");if(console.log("SassListing: Found wrappers:",wrappers.length),wrappers.length>0){wrappers.forEach(wrapper=>{wrapper.style.minHeight="",wrapper.style.maxHeight=""}),wrappers[0].offsetHeight;let maxHeight=0;wrappers.forEach((wrapper,index)=>{const height=wrapper.offsetHeight;console.log(`SassListing: Wrapper ${index} height:`,height),maxHeight=Math.max(maxHeight,height)}),console.log("SassListing: Max height:",maxHeight),wrappers.forEach((wrapper,index)=>{wrapper.style.minHeight=maxHeight+"px",console.log(`SassListing: Applied minHeight ${maxHeight}px to wrapper ${index}`)}),wrappers.length>1&&(wrappers[1].style.maxHeight=maxHeight+"px",console.log(`SassListing: Applied maxHeight ${maxHeight}px to wrapper 1`))}},100)}addListeners(){this.addToCart.addEventListener("click",e=>this.onAddToCart(e)),window.addEventListener("onProductSelected",e=>this.updateFooter(e),!1),this.productItem.forEach(item=>{item.addEventListener("keydown",e=>{const interactiveElement=e.target.closest("button, a, input, select, textarea");interactiveElement&&interactiveElement!==item||(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),item.click())})}),this.productItem[0].click()}async onAddToCart(e){e.preventDefault(),e.stopPropagation(),this.addToCart.setAttribute("aria-busy","true"),this.addToCart.disabled=!0;var selectedProduct=this.querySelector(".sass-item.checked"),handle=selectedProduct.getAttribute("data-handle");const paywhirlAvailable=selectedProduct.querySelectorAll(".paywhirl-group-available");paywhirlAvailable.length>1&&(paywhirlAvailable[0].classList.remove("paywhirl-group-selected"),paywhirlAvailable[1].classList.add("paywhirl-group-selected"));const data=[{id:selectedProduct.getAttribute("data-product-id"),quantity:1,selling_plan:selectedProduct.querySelector('[name="selling_plan"]')?.value,properties:{"_product-discount":selectedProduct.querySelector('[name="discount"]')?.value,_pricebook:selectedProduct.querySelector('[name="_pricebook"]')?.value,_subscription_terms:selectedProduct.querySelector('[name="_subscription_terms"]')?.value,"_product-discount-label":selectedProduct.querySelector('[name="_discount_label"]')?.value}}];await postData(`${routes.cart_clear_url}.js?hsfastcart=false`),this.gifts.forEach(gift=>{gift.getAttribute("data-product-id")!==null&&data.push({id:gift.getAttribute("data-product-id"),quantity:1,selling_plan:gift.querySelector('[name="selling_plan"]').value,properties:{_pricebook:selectedProduct.querySelector('[name="_pricebook"]').value}})}),postData(`${routes.cart_add_url}.js?hsfastcart=false`,{items:data}).then(()=>{const firstUpsellPageUrl=selectedProduct.getAttribute("data-upsell"),savedUpsellRedirectUrl=this.getSavedUpsellRedirectUrl(firstUpsellPageUrl);if(savedUpsellRedirectUrl){window.location=savedUpsellRedirectUrl;return}if(firstUpsellPageUrl!=""){const currentPageUrl=window.location.href;window.sassUpsellRedirectState?.write?.({sourcePageUrl:currentPageUrl,firstUpsellPageUrl,redirectUrl:firstUpsellPageUrl,ttlMs:1440*60*1e3}),window.location=firstUpsellPageUrl}else window.location=`/checkout?${(Math.random()+1).toString(36).substring(2)}`}).catch(e2=>{console.error(e2),this.addToCart.removeAttribute("aria-busy"),this.addToCart.disabled=!1})}onVariantSelected(e){e.preventDefault();const $target=e.currentTarget;this.productItem.forEach(element=>element.dispatchEvent(new CustomEvent("variant:changed",[$target.getAttribute("index")]
1)))}updateFooter(e){this.footer.querySelector(".sass-footer-title").innerHTML=e.detail.title,this.footer.querySelector(".sass-footer-price").innerHTML=e.detail.price;const image=this.footer.querySelector(".sass-footer-image");image.src=e.detail.image,image.alt=e.detail.imageAlt||e.detail.title}getSelectedProducts=items=>Array.from(items).map(item=>({id:item.getAttribute("data-product-id"),quantity:1}))}async function postData(url="",data={}){const config=fetchConfig("javascript");return config.headers["X-Requested-With"]="XMLHttpRequest",delete config.headers["Content-Type"],(await fetch(url,{method:"POST",body:JSON.stringify(data),headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"}})).json()}customElements.define("sass-listing",SassListing);class SassSliderComponent extends HTMLElement{constructor(){if(super(),this.slider=this.querySelector('[id^="Slider-"]'),this.getAttribute("data-slider-enabled-mobile")!=="false"){if(this.config=JSON.parse(this.getAttribute("data-slider-config")),!this.slider||typeof $.fn.slick>"u"){console.warn("No slider found");return}$(this.slider).not(".slick-initialized").slick(this.config),this.mobile=this.desktop=!1,this.onResize(),$(this.slider).on("breakpoint",()=>this.onResize()),$(this.slider).on("beforeChange",(event,slick,currentSlide,nextSlide)=>this.querySelector(`sass-product[data-slick-index="${nextSlide}"]`).click()),$(this.slider).on("init",()=>{this.equalizeWrapperHeights()}),$(this.slider).on("setPosition",()=>{this.equalizeWrapperHeights()})}}onResize(){const width=window.innerWidth;if(width<640&&!this.mobile){this.mobile=!0,this.desktop=!1,$(".page-sass__product").removeClass("disable-selection"),$(this.slider).slick("slickUnfilter"),$(this.slider).slick("slickFilter",".page-sass__product--mobile-only, .page-sass__product--both");const mobileItems=$(".page-sass__product").filter(".page-sass__product--mobile-only, .page-sass__product--both");this.checkItemsSelection(mobileItems);const dots=$(this.slider).find(".slick-dots");dots.find("li").length>1?dots.show():dots.hide(),this.equalizeWrapperHeights(),this.equalizeWrapperHeights()}else if(width>=640&&!this.desktop){this.mobile=!1,this.desktop=!0,$(".page-sass__product").removeClass("disable-selection"),$(this.slider).slick("slickUnfilter"),$(this.slider).slick("slickFilter",".page-sass__product--desktop-only, .page-sass__product--both");const desktopItems=$(".page-sass__product").filter(".page-sass__product--desktop-only, .page-sass__product--both");this.checkItemsSelection(desktopItems),this.equalizeWrapperHeights()}}equalizeWrapperHeights(){setTimeout(()=>{console.log("Equalizing wrapper heights...");const wrappers=this.querySelectorAll(".page-sass__product-wrapper");if(console.log("Found wrappers:",wrappers.length),wrappers.length>0){wrappers.forEach(wrapper=>wrapper.style.minHeight=""),wrappers[0].offsetHeight;let maxHeight=0;wrappers.forEach((wrapper,index)=>{const height=wrapper.offsetHeight;console.log(`Wrapper ${index} height:`,height),maxHeight=Math.max(maxHeight,height)}),console.log("Max height:",maxHeight),wrappers.forEach((wrapper,index)=>{wrapper.style.minHeight=maxHeight+"px",console.log(`Applied minHeight ${maxHeight}px to wrapper ${index}`)})}},200)}checkItemsSelection(items){items.filter(".checked").length==0?items.first().click():items.filter(".checked").length>1&&items.first().removeClass("checked"),items.length==1&&items.first().addClass("disable-selection")}}customElements.define("sass-slider-component",SassSliderComponent);function throttle(f,delay){let timer=0;return function(...args){clearTimeout(timer),timer=setTimeout(()=>f.apply(this,args),delay)}} 2//# sourceMappingURL=/cdn/shop/t/23/assets/sass-listing.js.map?v=15719414515240883631786640939
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.