1(function(){var globalKey="__productRecommendationsSwiper";if(window[globalKey]){window[globalKey].initAll(document);return}var swiperScriptPromise;function ensureSwiper(){return window.Swiper?Promise.resolve(window.Swiper):swiperScriptPromise||(swiperScriptPromise=new Promise(function(resolve,reject){var existingScript=document.getElementById("product-recommendations-swiper-script");function resolveSwiper(){if(window.Swiper){resolve(window.Swiper);return}reject(new Error("Swiper did not initialize."))}function rejectSwiper(){reject(new Error("Failed to load Swiper."))}if(existingScript){if(existingScript.dataset.loaded==="true"){resolveSwiper();return}existingScript.addEventListener("load",resolveSwiper,{once:!0}),existingScript.addEventListener("error",rejectSwiper,{once:!0});return}var script=document.createElement("script");script.id="product-recommendations-swiper-script",script.src="https://cdn.jsdelivr.net/npm/swiper@12/swiper-bundle.min.js",script.async=!0,script.addEventListener("load",function(){script.dataset.loaded="true",resolveSwiper()},{once:!0}),script.addEventListener("error",rejectSwiper,{once:!0}),document.head.appendChild(script)}),swiperScriptPromise)}function escapeHtml(value){return String(value).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function formatMoney(cents){if(window.Shopify&&typeof window.Shopify.formatMoney=="function"){const moneyFormat=window.Shopify.money_format||window.Shopify.moneyFormat;if(moneyFormat)return window.Shopify.formatMoney(cents,moneyFormat)}return"$"+((Number(cents)||0)/100).toFixed(2)}function getProductImage(product){return product&&product.featured_image?product.featured_image:""}function getDesktopSlidesPerView(productCount){return productCount>4?4:productCount>1?productCount-1:1}function normalizeImageSrc(src){return src?String(src).replace(/^https?:/,"").split("?")[0]:""}function getCardVariant(product){var variants=product&&product.variants||[],shown=normalizeImageSrc(getProductImage(product)),i;if(shown)for(i=0;i<variants.length;i++){var variantImage=variants[i].featured_image;if(variantImage&&normalizeImageSrc(variantImage.src)===shown)return variants[i]}for(i=0;i<variants.length;i++)if(variants[i].available)return variants[i];return variants[0]||product}function createRecommendationCard(product){var item=document.createElement("article");item.className="product-recommendations__item swiper-slide";var imageUrl=getProductImage(product),productTitle=escapeHtml(product.title),productUrl=product.url,cardVariant=getCardVariant(product),comparePriceHtml="";return cardVariant.compare_at_price&&cardVariant.compare_at_price>cardVariant.price&&(comparePriceHtml='<span class="product-recommendations__compare-price">'+formatMoney(cardVariant.compare_at_price)+"</span>"),item.innerHTML='<a class="product-recommendations__card" href="'+productUrl+'"><div class="product-recommendations__image-wrap">'+(imageUrl?'<img class="product-recommendations__image" src="'+imageUrl+'" alt="'+productTitle+'" loading="lazy" width="400" height="400">':"")+'</div><div class="product-recommendations__content"><h3 class="product-recommendations__product-title">'+productTitle+'</h3><div class="product-recommendations__price-row"><span class="product-recommendations__price">'+formatMoney(cardVariant.price)+"</span>"+comparePriceHtml+"</div></div></a>",item}function renderRecommendations(section,products){var track=section.querySelector(".product-recommendations__track");return track?(track.innerHTML="",!Array.isArray(products)||products.length===0?(section.style.display="none",!1):(products.forEach(function(product){track.appendChild(createRecommendationCard(product))}),!0)):!1}function initializeSwiper(section,productCount){var viewport=section.querySelector(".product-recommendations__viewport"),prevButton=section.querySelector(".product-recommendations__nav--prev"),nextButton=section.querySelector(".product-recommendations__nav--next");!viewport||!prevButton||!nextButton||!window.Swiper||(section.productRecommendationsSwiper&§ion.productRecommendationsSwiper.destroy(!0,!0),prevButton.classList.remove("is-hidden"),nextButton.classList.remove("is-hidden"),section.productRecommendationsSwiper=new window.Swiper(viewport,{loop:productCount>1,speed:500,spaceBetween:12,slidesPerView:1,slidesPerGroup:1,watchOverflow:!0,observer:!0,observeParents:!0,watchSlidesProgress:!0,keyboard:{enabled:!0,onlyInViewport:!0,pageUpDown:!0},navigation:{prevEl:prevButton,nextEl:nextButton,lockClass:"is-hidden"},a11y:{enabled:!0,prevSlideMessage:"Show previous recommended products",nextSlideMessage:"Show next recommended products",slideLabelMessage:"{{index}} of {{slidesLength}}",itemRoleDescriptionMessage:"slide"},breakpoints:{750:{slidesPerView:getDesktopSlidesPerView(productCount),slidesPerGroup:4}}}),updateSlidesAccessibility(section.productRecommendationsSwiper),section.productRecommendationsSwiper.on("realIndexChange",()=>{updateSlidesAccessibility(section.productRecommendationsSwiper)}))}function updateSlidesAccessibility(swiper){let swiperSlides=swiper.slides,activeIndex=swiper.activeIndex,slidesPerView=Math.ceil(swiper.params.slidesPerView),visibleSlides=[];for(let i=0;i<slidesPerView;i++){let slide=swiperSlides[activeIndex+i];slide&&visibleSlides.push(slide)}
1swiperSlides.forEach(slide=>{let isSlideVisible=visibleSlides.includes(slide);slide.querySelectorAll("a").forEach(link=>{isSlideVisible?(link.removeAttribute("tabindex"),link.removeAttribute("aria-hidden")):(link.setAttribute("tabindex","-1"),link.setAttribute("aria-hidden","true"))})})}function fetchRecommendations(productId,limit,intent){var endpoint="/recommendations/products.json?product_id="+encodeURIComponent(productId)+"&limit="+encodeURIComponent(limit)+"&intent="+encodeURIComponent(intent);return fetch(endpoint).then(function(response){if(!response.ok)throw new Error("Failed to fetch recommendations.");return response.json()}).then(function(data){return data.products||[]})}function initializeRecommendationSection(section){if(!(!section||section.dataset.initialized==="true")){var productId=section.dataset.productId;if(productId){var limit=parseInt(section.dataset.limit,10)||8,intent=section.dataset.intent||"related";section.dataset.initialized="true",Promise.all([ensureSwiper(),fetchRecommendations(productId,limit,intent)]).then(function(results){var products=results[1];section.removeAttribute("aria-busy"),renderRecommendations(section,products)&&initializeSwiper(section,products.length)}).catch(function(error){console.error("Recommendation slider error:",error),section.removeAttribute("aria-busy"),section.style.display="none"})}}}function getSections(root){return root?root.nodeType===1&&root.matches(".product-recommendations[data-product-id]")?[root]:root.querySelectorAll?root.querySelectorAll(".product-recommendations[data-product-id]"):[]:[]}function initializeAllRecommendationSections(root){var sections=getSections(root||document);Array.prototype.forEach.call(sections,function(section){initializeRecommendationSection(section)})}window[globalKey]={initAll:initializeAllRecommendationSections},document.readyState==="loading"?document.addEventListener("DOMContentLoaded",function(){initializeAllRecommendationSections(document)},{once:!0}):initializeAllRecommendationSections(document),document.addEventListener("shopify:section:load",function(event){initializeAllRecommendationSections(event.target)})})(); 2//# sourceMappingURL=/cdn/shop/t/283/assets/product-recommendations.js.map?v=98240188657776392121787240985
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.