1(function(){const sectionCache=Object.create(null),HITS_CONTAINER_SELECTOR=".ais-hits-container.ais-results-as-block",HIT_ITEM_SELECTOR=".ais-Hits-item, .ais-InfiniteHits-item",MOUNTED_CARD_SELECTOR=".algolia-product-card-mounted",PENDING_CARD_SELECTOR="[data-algolia-product-card-pending]";let placeholderIndex=0,hitsVisibilityFrame=null;document.addEventListener("DOMContentLoaded",syncHitsContainersVisibility),syncHitsContainersVisibility(),window.MutationObserver&&document.documentElement&&new MutationObserver(scheduleHitsContainersVisibilitySync).observe(document.documentElement,{childList:!0,subtree:!0}),document.addEventListener("algolia.hooks.initialize",function(){hideHitsContainers(),algoliaShopify.hooks.registerHook("beforeInstantSearchProductTemplate",beforeInstantSearchProductTemplate)});function cacheKey(handle){return`${window.T4SThemeSP?.cacheNameFirst||window.T4Sconfigs?.cacheName||""}algolia-card-${handle}`}function normalizeProductUrl(url){if(!url)return null;try{return new URL(url,window.location.origin).href}catch{return null}}function getHandleFromLink(itemLink){if(!itemLink)return null;const match=/\/products\/([^/?#]+)/.exec(itemLink);return match?decodeURIComponent(match[1]):null}function getAutocompleteHandle(item,itemLink){return item.handle||item.product_handle||item.productHandle||getHandleFromLink(itemLink)}function getInstantSearchLink(hit){return algoliaShopify.helpers?.instantsearchLink?algoliaShopify.helpers.instantsearchLink(hit):hit.onlineStoreUrl||hit.url||hit.product_url||hit.productUrl||(hit.handle?`/products/${hit.handle}`:null)}function getInstantSearchHandle(hit,itemLink){return hit.handle||hit.product_handle||hit.productHandle||getHandleFromLink(itemLink)}function beforeAutocompleteProductTemplate(defaultTemplate,templateOptions,distinct,itemLink,trackSearchAttribution){const{html,item}=templateOptions,handle=getAutocompleteHandle(item,itemLink);if(!handle)return typeof defaultTemplate=="function"?defaultTemplate(templateOptions,distinct,itemLink,trackSearchAttribution):defaultTemplate;const placeholderId=createPlaceholderId(item.objectID||item.id||handle);return getCardHtml(handle).then(function(cardHtml){cardHtml&&mountCard(placeholderId,cardHtml,itemLink)}),html` 2 <div 3 id="${placeholderId}" 4 class="algolia-product-card-placeholder" 5 data-algolia-product-card-placeholder 6 > 7 ${typeof defaultTemplate=="function"?defaultTemplate(templateOptions,distinct,itemLink,trackSearchAttribution):defaultTemplate} 8 </div> 9 `}function beforeInstantSearchProductTemplate(defaultTemplate,hit,html,components,trackSearchAttribution){const itemLink=getInstantSearchLink(hit),handle=getInstantSearchHandle(hit,itemLink);if(!handle)return hideHitsContainers(),html` 10 <div 11 class="algolia-product-card-placeholder ais-hit ais-product" 12 data-algolia-product-card-placeholder 13 ></div> 14 `;const placeholderId=createPlaceholderId(hit.objectID||hit.id||handle);return hideHitsContainers(),getCardHtml(handle).then(function(cardHtml){cardHtml?mountCard(placeholderId,cardHtml,itemLink,{hit,trackSearchAttribution}):releaseProductCardPlaceholder(placeholderId)}),html` 15 <div 16 id="${placeholderId}" 17 class="algolia-product-card-placeholder ais-hit ais-product" 18 data-algolia-product-card-placeholder 19 data-algolia-product-card-pending 20 data-algolia-index="${hit.index}" 21 data-algolia-position="${hit.productPosition}" 22 data-algolia-queryid="${hit.queryID}" 23 data-algolia-objectid="${hit.objectID}" 24 data-handle="${handle}" 25 data-variant-id="${hit.objectID}" 26 data-distinct="${hit._distinct}" 27 data-product-id="${hit.id}" 28 onClick="${()=>{typeof trackSearchAttribution=="function"&&trackSearchAttribution(hit)}}" 29 ></div> 30 `}function createPlaceholderId(value){return`algolia-product-card-${String(value).replace(/[^a-zA-Z0-9_-]/g,"-")}-${++placeholderIndex}`}function getCardHtml(handle){const key=cacheKey(handle);if(sectionCache[key])return Promise.resolve(sectionCache[key]);const root=T4Sroutes?.root_url||Shopify?.routes?.root_url||"/",base=root.endsWith("/")?root:`${root}/`,url=`${window.location.origin}${base}products/${encodeURIComponent(handle)}?view=algolia-card`;return fetchSectionText(url).then(function(rawHtml){const cardHtml=extractCardHtml(rawHtml);return cardHtml&&(sectionCache[key]=cardHtml),cardHtml})}function fetchSectionText(url){const theme=window.T4SThemeSP;return theme?.getToFetchSection?theme.getToFetchSection(null,"text",url).then(function(html){return html&&html!=="NVT_94"?html:fetchWithRedirect(url)}):fetchWithRedirect(url)}function fetchWithRedirect(url){return fetch(url,{headers:{"Cache-Control":"no-cache"}}).then(function(res){return res.redirected?fetch(res.url,{headers:{"Cache-Control":"no-cache"}}):res}).then(function(res){return res.ok?res.text():null}).then(function(html){return html&&html!=="NVT_94"?html:null}).catch(function(){return null})}function extractCardHtml(html){if(!html)return null;const card=new DOMParser().parseFromString(html,"text/html").querySelector(".main-product-card");return card?card.outerHTML:html.trim()}function mountCard(placeholderId,cardHtml,itemLink,options,attempts=30){typeof options=="number"&&(attempts=options,options={}),options=options||{};const placeholder=document.getElementById(placeholderId);if(!placeholder){attempts>0&&requestAnimationFrame(function(){mountCard(placeholderId,cardHtml,itemLink,options,attempts-1)});return}const tpl=document.createElement("template");tpl.innerHTML=cardHtml.trim();const href=normalizeProductUrl(itemLink);href&&tpl.content.querySelectorAll("a[data-pr-href], a.t4s-full-width-link, .t4s-product-title a").forEach(function(a){a.setAttribute("href",href)});const wrapper=document.createElement("div");wrapper.className="algolia-product-card-grid algolia-product-card-mounted t4s_box_pr_grid t4s-products t4s-text-default t4s_rationt t4s_position_8 t4s_cover t4s-row t4s-justify-content-center t4s-row-cols-1 t4s-gx-0 t4s-gy-0",wrapper.setAttribute("data-algolia-product-card-pending",""),copyAlgoliaTrackingAttributes(placeholder,wrapper),options.hit&&typeof options.trackSearchAttribution=="function"&&wrapper.addEventListener("click",function(){options.trackSearchAttribution(options.hit)}),wrapper.appendChild(tpl.content);const cards=wrapper.querySelectorAll(".main-product-card");cards.forEach(function(card){copyAlgoliaTrackingAttributes(wrapper,card)}),placeholder.replaceWith(wrapper),whenThemeReady(function(){initThemeProductCard(wrapper),cards.forEach(function(card){card.dispatchEvent(new CustomEvent("algolia:product-card:rendered",{bubbles:!0}))}),requestAnimationFrame(function(){wrapper.removeAttribute("data-algolia-product-card-pending"),scheduleHitsContainersVisibilitySync()})})}function releaseProductCardPlaceholder(placeholderId){const placeholder=document.getElementById(placeholderId);if(placeholder){const hitItem=placeholder.closest(HIT_ITEM_SELECTOR);hitItem?hitItem.remove():placeholder.remove()}scheduleHitsContainersVisibilitySync()}function hideHitsContainers(){document.querySelectorAll(HITS_CONTAINER_SELECTOR).forEac
30h(function(el){setHitsContainerLoading(el)})}function scheduleHitsContainersVisibilitySync(){hitsVisibilityFrame&&cancelAnimationFrame(hitsVisibilityFrame),hitsVisibilityFrame=requestAnimationFrame(function(){hitsVisibilityFrame=null,syncHitsContainersVisibility()})}function syncHitsContainersVisibility(){document.querySelectorAll(HITS_CONTAINER_SELECTOR).forEach(function(el){const hasPendingCards=el.querySelector(PENDING_CARD_SELECTOR),hasDefaultCards=Array.prototype.some.call(el.querySelectorAll(HIT_ITEM_SELECTOR),function(item){return!item.querySelector(MOUNTED_CARD_SELECTOR)&&!item.querySelector("[data-algolia-product-card-placeholder]")&&item.innerHTML.trim()});if(hasPendingCards||hasDefaultCards){setHitsContainerLoading(el);return}setHitsContainerReady(el)})}function setHitsContainerLoading(el){el.classList.remove("algolia-product-cards-ready"),el.classList.add("algolia-product-cards-loading"),el.style.setProperty("opacity","0","important"),el.style.setProperty("visibility","hidden","important"),el.style.setProperty("pointer-events","none","important")}function setHitsContainerReady(el){el.classList.remove("algolia-product-cards-loading"),el.classList.add("algolia-product-cards-ready"),el.style.removeProperty("opacity"),el.style.removeProperty("visibility"),el.style.removeProperty("pointer-events"),recalculateAlgoliaSwatches(el)}function recalculateAlgoliaSwatches(container){const productItem=window.T4SThemeSP?.ProductItem;productItem?.recalculateSwatches&&requestAnimationFrame(function(){productItem.recalculateSwatches(!0)})}function copyAlgoliaTrackingAttributes(source,target){!source||!target||["data-algolia-index","data-algolia-position","data-algolia-queryid","data-algolia-objectid","data-handle","data-variant-id","data-distinct","data-product-id"].forEach(function(attr){const value=source.getAttribute(attr);value!==null&&target.setAttribute(attr,value)})}function whenThemeReady(fn,attempts=30){if(window.T4SThemeSP?.ProductItem||attempts<=0){requestAnimationFrame(fn);return}setTimeout(function(){whenThemeReady(fn,attempts-1)},100)}function initThemeProductCard(wrapper){const theme=window.T4SThemeSP,$=window.jQuery_T4NT||window.jQuery;$&&$(wrapper).find(".t4s-products").length&&theme?.reinitProductGridItem?.(),theme?.RenderRefresh?.(),theme?.Reveal?.(),theme?.ProductItem?.init?.(),theme?.ProductItem?.loadjsRevew?.(),theme?.ProductItem?.clickMoreSwatches?.(),theme?.ProductItem?.swatchesClickHover?.(),theme?.ProductItem?.resizeObserver?.(),theme?.ProductItem?.recalculateSwatches?.(!0),theme?.ProductItem?.initQuickVS?.(),theme?.Wishlist?.init?.(),theme?.Compare?.init?.(),theme?.Tooltip?.(),theme?.Countdown?.(),wrapper?.querySelectorAll("img.lazyloadt4s").forEach(function(img){window.lazySizesT4?.loader?.unveil?.(img)}),window.lazySizesT4?.autoSizer?.checkElems?.(),$&&$("body").trigger("currency:update")}})(); 31//# sourceMappingURL=/cdn/shop/t/143/assets/algolia_custom_hooks_collection_product_card.js.map?v=32966388109998723171788354304
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.