1if(!customElements.get("recently-viewed-products")){class RecentlyViewedProducts extends HTMLElement{constructor(){if(super(),this.template_url=this.dataset.templateUrl||"recently-viewed",this.url=theme.routes.search_url+`?view=${this.template_url}&type=product&q=`,this.container=this.querySelector(".products"),this.currentId=this.dataset.productHandle,this.max=this.dataset.max||8,this.products="",window.localStorage){let recentIds=window.localStorage.getItem("recently-viewed");recentIds&&typeof recentIds!==void 0&&(window.recentlyViewedIds=JSON.parse(recentIds))}this.recentCarousel=null,Flickity.prototype._createResizeClass=function(){this.element.classList.add("flickity-resize")},Flickity.createMethods.push("_createResizeClass");var resize=Flickity.prototype.resize;Flickity.prototype.resize=function(){this.element.classList.remove("flickity-resize"),resize.call(this),this.element.classList.add("flickity-resize")}}connectedCallback(){this.buildUrl(),document.addEventListener("cartChanged",()=>{this.recentCarousel&&setTimeout(()=>{this.recentCarousel.resize()},300)}),document.addEventListener("cart-drawer:open",()=>{this.recentCarousel&&setTimeout(()=>{this.recentCarousel.resize()},300)})}buildUrl(){let i=0;window.recentlyViewedIds.forEach(val=>{val!==this.currentId&&(i>=this.max||(this.products+="handle:"+val+" OR ",i++))}),this.url=this.url+encodeURIComponent(this.products),this.fetchProducts()}fetchProducts(){fetch(this.url).then(response=>response.text()).then(text=>{const html=document.createElement("div");html.innerHTML=text;const recommendations=html.querySelector(".products");if(recommendations&&recommendations.innerHTML.trim().length){this.container.innerHTML=recommendations.innerHTML,this.classList.add("product-recommendations--loaded"),window.Currency?.convertAll?.(),this.cartCarousel=this.querySelector(".recommendations-carousel"),this.cartCarousel&&(this.recentCarousel=new Flickity(this.cartCarousel,{imagesLoaded:!0,contain:!0,prevNextButtons:!1,pageDots:!1,watchCSS:!0,cellAlign:"left"}),setTimeout(()=>{this.recentCarousel.resize()},300));let _this=this;if(this.fetchedCarousel=this.querySelector(".fetched-carousel"),this.fetchedCarousel){let slideshow_slides=Array.from(this.fetchedCarousel.querySelectorAll(".carousel__slide")),autoplay=this.fetchedCarousel.dataset.autoplay=="false"?!1:parseInt(this.fetchedCarousel.dataset.autoplay,10),al
1ign=this.fetchedCarousel.dataset.align=="center"?"center":"left",fade=this.fetchedCarousel.dataset.fade=="true",prev_button=this.fetchedCarousel.querySelector(".flickity-prev:not(.product-card-swatches__button)"),next_button=this.fetchedCarousel.querySelector(".flickity-next:not(.product-card-swatches__button)"),progress_bar=this.fetchedCarousel.parentNode.querySelector(".flickity-progress--bar"),rightToLeft=document.dir==="rtl",selectedIndex=0,args={wrapAround:!1,cellAlign:align,pageDots:!1,contain:!0,fade,autoPlay:autoplay,rightToLeft,prevNextButtons:!1,imagesLoaded:!0,cellSelector:"li.carousel__slide",on:{ready(){prev_button&&prev_button.classList.add("disabled")},change(){const slideWidth=this.slides[0].outerWidth,carouselWidth=this.element.offsetWidth,visibleSlides=Math.floor(carouselWidth/slideWidth);this.selectedIndex===0?(prev_button.classList.add("disabled"),next_button.classList.remove("disabled")):this.selectedIndex>=this.slides.length-visibleSlides?(prev_button.classList.remove("disabled"),next_button.classList.add("disabled")):(prev_button.classList.remove("disabled"),next_button.classList.remove("disabled"))}}};if(slideshow_slides.length<1)return;progress_bar&&(args.wrapAround=!1,args.on.scroll=function(progress){progress=Math.max(0,Math.min(1,progress)),progress_bar.style.width=progress*100+"%"});const flkty=new Flickity(this.fetchedCarousel,args),originalResize=flkty.resize.bind(flkty);flkty.resize=function(){const tab=flkty.element.closest(".section-tab");tab&&!tab.classList.contains("active")||originalResize()},this.flkty=flkty,selectedIndex=flkty.selectedIndex,this.fetchedCarousel.dataset.initiated=!0,prev_button&&(prev_button.addEventListener("click",event=>{flkty.previous()}),prev_button.addEventListener("keyup",event=>{flkty.previous()}),next_button.addEventListener("click",event=>{flkty.next()}),next_button.addEventListener("keyup",event=>{flkty.next()})),Shopify.designMode&&this.fetchedCarousel.addEventListener("shopify:block:select",event=>{let index=slideshow_slides.indexOf(event.target);flkty.select(index)})}}}).catch(e=>{console.error(e)})}}customElements.define("recently-viewed-products",RecentlyViewedProducts)} 2//# sourceMappingURL=/cdn/shop/t/731/assets/recently-viewed-products.js.map?v=28288725957360991371789090818
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.