PageSourceSearch

https://www.speedo.in/cdn/shop/t/459/assets/custom-neo-product-card-1.js?v=11298474504803856131787572446

js speedo.in collected 2026-10-07 22:17:33 UTC 32,229 bytes, 125 lines download raw bytes

1(()=>{if(typeof globalThis<"u"&&!globalThis.AtcPriceBlock){const formatRupees=amount=>{const value=Number(amount)||0;return"\u20B9 "+new Intl.NumberFormat("en-IN",{minimumFractionDigits:0,maximumFractionDigits:0}).format(Math.floor(value))},discountPercent=(price,compareAt)=>{const sale=Number(price)||0,compare=Number(compareAt)||0;return!(compare>sale)||sale<=0?0:Math.round((compare-sale)/compare*100)},html=(price,compareAt)=>{const percent=discountPercent(price,compareAt),saleHtml=`<span class="atc-price-block__sale">${formatRupees(price)}</span>`;return percent<=0?`<span class="atc-price-block">${saleHtml}</span>`:`<span class="atc-price-block"><span class="atc-price-block__compare">${formatRupees(compareAt)}</span>${saleHtml}<span class="atc-price-block__badge">${percent}% OFF</span></span>`};globalThis.AtcPriceBlock={formatRupees,discountPercent,html,htmlFromCents:(priceCents,compareCents)=>html((Number(priceCents)||0)/100,(Number(compareCents)||0)/100)}}const PRODUCT_FIELDS=`
2    title
3    handle
4    id
5    tags
6    availableForSale
7    productType
8    priceRange {
9      maxVariantPrice { amount }
10      minVariantPrice { amount }
11    }
12    compareAtPriceRange {
13      minVariantPrice { amount }
14    }
15    selectedOrFirstAvailableVariant {
16      price { amount }
17      compareAtPrice { amount }
18    }
19    media(first: 20) {
20      edges {
21        node {
22          mediaContentType
23          ... on MediaImage {
24            image {
25              url
26              altText
27              width
28              height
29            }
30          }
31          ... on Video {
32            sources {
33              url
34              mimeType
35            }
36            previewImage {
37              url
38            }
39          }
40        }
41      }
42    }
43    metafield_tag: metafield(namespace: "neo", key: "usage_tag") {
44      value
45    }
46    metafield_highlights: metafield(namespace: "neo", key: "highlights") {
47      value
48    }
49    metafield_watch_gif: metafield(namespace: "neo", key: "watch_gif") {
50      reference {
51        ... on MediaImage {
52          image { url }
53        }
54      }
55    }
56    metafield_color_swatch_image: metafield(namespace: "custom", key: "color_swatch_image") {
57      reference {
58        ... on MediaImage {
59          image { url }
60        }
61      }
62    }
63  `,FINAL_ALL_PRODUCT_FIELDS=`
64    ${PRODUCT_FIELDS}
65    metafield_color_variants: metafield(namespace: "custom", key: "color_variants") {
66      references(first: 25) {
67        nodes {
68          ... on Product {
69            ${PRODUCT_FIELDS}
70          }
71        }
72      }
73    }
74  `;typeof globalThis<"u"&&!globalThis.neoProductCardCache&&(globalThis.neoProductCardCache={});class NeoProductCard1 extends HTMLElement{constructor(){super(),this._productId="",this._currentProductId="",this._swiper=null,this._swiperInitialized=!1,this._swiperIntersectionObserver=null,this._colorVariantSwatches=[],this._boundOnColorClick=this._onColorSwatchClick.bind(this),this._boundOnWatchGifClick=this._onWatchGifClick.bind(this),this._watchGifOriginalHTML=null,this._watchOverlay=null,this._watchOverlayVideo=null,this._showWatchGif=!0,this._showWatchGifVideo=!0}static get observedAttributes(){return["data-product-id"]}isSwiperEnabled(){return this.getAttribute("data-enable-swiper")?.toLowerCase()==="true"}getProductIdGid(productId){if(!productId)return"";const num=String(productId).replace(/\D/g,"");return num?`gid://shopify/Product/${num}`:""}getProductIdNumeric(productId){if(!productId)return"";if(/^\d+$/.test(String(productId).trim()))return String(productId).trim();const m=String(productId).match(/gid:\/\/shopify\/Product\/(\d+)/);return m?m[1]:""}_sameProductId(a,b){const left=this.getProductIdNumeric(a),right=this.getProductIdNumeric(b);return!!(left&&right&&left===right)}getHighlightsString(product){const raw=product.metafield_highlights?.value;if(raw==null)return"";try{const parsed=typeof raw=="string"?JSON.parse(raw):raw;return Array.isArray(parsed)?parsed.join(" | "):String(parsed)}catch{return String(raw)}}getWatchGifAndHasVideo(product){if(!this.isSwiperEnabled())return{watchGifSrc:"",hasVideo:!1};const mediaEdges=product.media?.edges||[];let watchGifSrc="";const watchGifRef=product.metafield_watch_gif?.reference?.image?.url;watchGifRef&&(watchGifSrc=watchGifRef);let hasVideo=!1;for(let i=0;i<mediaEdges.length;i++){const node=mediaEdges[i]?.node;if(i<=2||!node)continue;if(node.mediaContentType==="VIDEO"||node.sources&&!node.image){hasVideo=!0,!watchGifSrc&&node.previewImage?.url&&(watchGifSrc=node.previewImage.url);break}}
74return{watchGifSrc,hasVideo}}getMediaSlides(product){const edges=product.media?.edges||[],imageSlides=[],videoSlides=[];for(const edge of edges){const node=edge?.node;if(node){if(node.mediaContentType==="IMAGE"&&node.image){const url=node.image.url,alt=node.image.altText||product.title||"",sep=url.includes("?")?"&":"?";imageSlides.push({type:"image",url:`${url}${sep}width=700`,alt})}else if(this.isSwiperEnabled()&&node.mediaContentType==="VIDEO"&&node.sources?.length){const src=node.sources.find(s=>s.mimeType?.includes("mp4"))||node.sources[0],poster=node.previewImage?.url;src?.url&&videoSlides.push({type:"video",url:src.url,mimeType:src.mimeType||"video/mp4",poster:poster?poster+(poster.includes("?")?"&":"?")+"width=700":""})}}}return[...imageSlides,...videoSlides]}getPrimaryImage(product){const edges=product.media?.edges||[];for(const edge of edges){const node=edge?.node;if(node&&node.mediaContentType==="IMAGE"&&node.image?.url){const url=node.image.url,alt=node.image.altText||product.title||"",sep=url.includes("?")?"&":"?";return{url:`${url}${sep}width=700`,alt}}}return null}getColorSwatches(product){const nodes=product.metafield_color_variants?.references?.nodes||[],out=[],currentId=this.getProductIdNumeric(product.id),currentSwatch=product.metafield_color_swatch_image?.reference?.image?.url;currentSwatch&&out.push({id:currentId,url:currentSwatch,product});for(const node of nodes){if(!node)continue;const id=this.getProductIdNumeric(node.id);if(id===currentId)continue;const imgUrl=node.metafield_color_swatch_image?.reference?.image?.url;imgUrl&&out.push({id,url:imgUrl,product:node})}return out}getColorVariantIds(product){return(product.metafield_color_variants?.references?.nodes||[]).map(n=>this.getProductIdNumeric(n?.id)).filter(Boolean).join(",")}async fetchProduct(productId){const gid=this.getProductIdGid(productId);if(!gid)return null;const query=`query Product($id: ID!) {
75          product(id: $id) {
76            ${FINAL_ALL_PRODUCT_FIELDS}
77          }
78        }`,token=typeof window<"u"&&window.storefrontAccessToken;if(!token)return console.warn("neo-product-card-1: window.storefrontAccessToken not set"),null;const res=await fetch("/api/2023-04/graphql.json",{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":token},body:JSON.stringify({query,variables:{id:gid}})});if(!res.ok)return null;const json=await res.json();if(json.errors||!json.data?.product)return null;const product=json.data.product,numId=this.getProductIdNumeric(product.id);return numId&&globalThis.neoProductCardCache&&(globalThis.neoProductCardCache[numId]=product,this._cacheColorVariantNodes(product)),product}_isFullyCachedProduct(product){return!!(product&&Object.prototype.hasOwnProperty.call(product,"metafield_color_variants"))}async _resolveFullProduct(productId){const id=this.getProductIdNumeric(productId);if(!id)return null;const cached=globalThis.neoProductCardCache?.[id];return this._isFullyCachedProduct(cached)?cached:this.fetchProduct(id)}_cacheColorVariantNodes(product){if(!product||!globalThis.neoProductCardCache)return;const nodes=product.metafield_color_variants?.references?.nodes||[];for(const node of nodes){const nid=this.getProductIdNumeric(node?.id);nid&&(this._isFullyCachedProduct(globalThis.neoProductCardCache[nid])||(globalThis.neoProductCardCache[nid]=node))}}connectedCallback(){this._productId=(this.getAttribute("data-product-id")||"").trim(),this._productId&&(this._currentProductId=this._productId,this.isSwiperEnabled()||(this._showWatchGif=!1,this._showWatchGifVideo=!1),this._attachColorSwatchDelegation(),this._loadAndRender())}disconnectedCallback(){this._swiperIntersectionObserver&&(this._swiperIntersectionObserver.disconnect(),this._swiperIntersectionObserver=null),this._swiper&&this._swiper.destroy&&(this._swiper.destroy(!0,!0),this._swiper=null),this.removeEventListener("click",this._boundOnColorClick,!0),this.removeAttribute("data-swatch-delegation")}_attachColorSwatchDelegation(){this.hasAttribute("data-swatch-delegation")||(this.setAttribute("data-swatch-delegation","1"),this.addEventListener("click",this._boundOnColorClick,!0))}_attachWishlistClickToSyncCart(){let wishlistButton=this.querySelector(".smartwishlist");if(wishlistButton){if(wishlistButton.dataset.wishlistBound==="1")return;wishlistButton.dataset.wishlistBound="1",wishlistButton.addEventListener("click",e=>{const productId=e.target.closest("[data-product]").getAttribute("data-product"),product=globalThis.neoProductCardCache&&globalThis.neoProductCardCache[productId];if(!product){console.warn("product not found in cache for id",productId);return}const firstImage=product.media?.edges?.[0]?.node?.image?.url||null,minPrice=product.priceRange?.minVariantPrice?.amount?parseFloat(product.priceRange.minVariantPrice.amount):null,maxPrice=product.priceRange?.maxVariantPrice?.amount?parseFloat(product.priceRange.maxVariantPrice.amount):null,payload={title:product.title||null,handle:product.handle||null,vendor:product.vendor||null,variant_id:wishlistButton.dataset.variant||null,is_true_variant:null,variant_count:null,variant_title:null,variant_price:minPrice,variant_compare_at_price:maxPrice,variant_sku:null,variant_out_of_stock:product.availableForSale===!1?!0:null,variant_inventory_policy:null,variant_inventory_quantity:null,tags:Array.isArray(product.tags)?product.tags.join(","):null,image:firstImage};typeof handleWishlistStateAndUpdateCart=="function"?handleWishlistStateAndUpdateCart(e,payload):console.warn("handleWishlistStateAndUpdateCart is not defined")})}else console.warn("wishlist button not found")}async _loadAndRender(){const product=await this._resolveFullProduct(this._productId);if(!product)return;const canonicalId=this.getProductIdNumeric(product.id);canonicalId&&(this._productId=canonicalId,this._currentProductId=canonicalId,this.setAttribute("data-product-id",canonicalId)),this._cacheColor
78VariantNodes(product);const swatches=this.getColorSwatches(product);swatches.length>this._colorVariantSwatches.length&&(this._colorVariantSwatches=swatches),this._updateCardUI(product,product,{renderSwatches:!0}),this._attachColorSwatchDelegation(),this._attachWatchGifClick(),this._attachWishlistClickToSyncCart()}_attachWatchGifClick(){const w=this.querySelector(".neo-product-card-1-watch-gif-container");w&&!w.hasAttribute("data-watch-click-bound")&&(w.setAttribute("data-watch-click-bound","1"),w.addEventListener("click",this._boundOnWatchGifClick))}_renderColorSwatches(product,invoker="initial"){const productId=this.getProductIdNumeric(product.id),container=this.querySelector(".color-variant-images");if(!container)return;let swatches=this.getColorSwatches(product);this._colorVariantSwatches.length>swatches.length&&(swatches=this._colorVariantSwatches);const currentId=this._currentProductId,fragment=document.createDocumentFragment();let count=0,circleCon=null;for(const sw of swatches){if(count++,count<=3){const img=document.createElement("img"),url=sw.url+(sw.url.includes("?")?"&":"?")+"width=100";img.src=url,img.alt=product.title||"",img.className="neo-product-card-color-variant-image",img.loading="lazy",img.setAttribute("data-product-id",sw.id),this._sameProductId(sw.id,currentId)&&img.classList.add("active"),fragment.appendChild(img)}count===4&&(circleCon=document.createElement("div"),circleCon.style.cssText='width:24px;height:24px;background:#2A2928;border-radius:50%;color:#fff;font-size:11px;display:flex;justify-content:center;align-items:center;font-family : "Athletics-Bold";',circleCon.classList.add("uniqueSwatchCon"),circleCon.setAttribute("onclick",`ATBModalOpen(event, '${productId}')`),fragment.appendChild(circleCon))}circleCon&&count>3&&(circleCon.innerHTML=`
79          <span class="loader-color-swatch-count">+${count-3}</span>
80          <span class="loader-color-swatch">
81            <svg class="loading-svg" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><style>.spinner_aj0A{transform-origin:center;animation:spinner_KYSC .75s infinite linear}@keyframes spinner_KYSC{100%{transform:rotate(360deg)}}</style><path d="M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z" class="spinner_aj0A"></path></svg>
82          </span>
83        `);const isHidden=count===0;requestAnimationFrame(()=>{container.innerHTML="",container.appendChild(fragment),container.hidden=isHidden})}_updateActiveColorSwatch(){const currentId=this._currentProductId;this.querySelectorAll(".neo-product-card-color-variant-image").forEach(img=>{const swatchId=this.getProductIdNumeric(img.getAttribute("data-product-id")||"");img.classList.toggle("active",this._sameProductId(swatchId,currentId))})}_renderSwiper(product,change="render"){const productUrl=`/products/${product.handle}`,wrapper=this.querySelector(".swiper .swiper-wrapper");if(!wrapper)return;const enableSwiper=this.isSwiperEnabled();let slides=this.getMediaSlides(product);if(slides.length===0){const featured=product.media?.edges?.[0]?.node,url=featured?.image?.url||featured?.previewImage?.url;if(url){const sep=url.includes("?")?"&":"?";slides.push({url:`${url}${sep}width=700`,alt:product.title||""})}}!enableSwiper&&slides.length>0&&(slides=slides.slice(0,1));let slidesHTML=slides.map((s,i)=>{if(change!=="update"&&i===0)return"";if(s.type==="video"&&this._showWatchGifVideo){const posterAttr=s.poster?` poster="${s.poster.replace(/"/g,"&quot;")}"`:"";return`<div class="swiper-slide">
84            <a href="${productUrl}" class="neo-product-card-1__image-link">
85              <video class="neo-product-card-swiper__video neo-product-card-1__video"
86                    width="700"
87                    height="1000"
88                    ${posterAttr}
89                    muted="true"
90                    playsinline
91                    loop
92                    preload="metadata">
93                <source src="${s.url.replace(/"/g,"&quot;")}"
94                        type="${(s.mimeType||"video/mp4").replace(/"/g,"&quot;")}">
95              </video>
96            </a>
97          </div>`}return`<div class="swiper-slide">
98          <a href="${productUrl}" class="neo-product-card-1__image-link">
99            <img src="${s.url.replace(/"/g,"&quot;")}&width=520"
100              alt="${(s.alt||"").replace(/"/g,"&quot;")}"
101              class="neo-product-card-1__image-img"
102              width="700"
103              height="503">
104          </a>
105        </div>`}).join("");change==="update"?wrapper.innerHTML=slidesHTML:wrapper.innerHTML+=slidesHTML}_scheduleSwiperInit(product,change="render"){if(!(this._swiperInitialized||this._swiperIntersectionObserver)){if(typeof IntersectionObserver>"u"){this._initSwiper(product,change),this._swiperInitialized=!0;return}this._swiperIntersectionObserver=new IntersectionObserver(entries=>{entries.some(entry=>entry.isIntersecting)&&(this._swiperIntersectionObserver.disconnect(),this._swiperIntersectionObserver=null,this._initSwiper(product,change),this._swiperInitialized=!0)},{rootMargin:"400px 0px",threshold:0}),this._swiperIntersectionObserver.observe(this)}}_initSwiper(product,change="render"){const swiperEl=this.querySelector(".swiper");if(!swiperEl)return;const enableSwiper=this.isSwiperEnabled();if(this._swiper&&this._swiper.destroy&&(this._swiper.destroy(!0,!0),this._swiper=null),!enableSwiper||typeof Swiper>"u")return;product&&this._renderSwiper(product,change);const wrapper=swiperEl.querySelector(".swiper-wrapper"),slideCount=wrapper?.querySelectorAll(".swiper-slide").length||0,enablePagination=this.getAttribute("data-enable-pagination")?.toLowerCase()==="true",showPagination=slideCount>1&&enablePagination;let paginationEl=null;const existingPagination=swiperEl.querySelector(".swiper-pagination");existingPagination&&existingPagination.remove(),showPagination&&(paginationEl=document.createElement("div"),paginationEl.className="swiper-pagination",swiperEl.appendChild(paginationEl));const syncVideoToActiveSlide=()=>{if(!wrapper)return;wrapper.querySelectorAll(".neo-product-card-1__video").forEach(v=>{try{v.pause()}catch{}});const activeVideo=wrapper.querySelector(".swiper-slide-active")?.querySelector(".neo-product-card-1__video");activeVideo&&activeVideo instanceof HTMLVideoElement&&activeVideo.play().catch(()=>{})},swiperConfig={slidesPerView:"auto",spaceBetween:0,on:{init:syncVideoToActiveSlide,slideChangeTransitionEnd:syncVideoToActiveSlide}};showPagination&&paginationEl&&(swiperConfig.pagination={el:paginationEl,clickable:!0}),this._swiper=new Swiper(swiperEl,swiperConfig)}_dismissWatchOverlayForSwatchChange(){const container=this.querySelector(".neo-product-card-1-watch-gif-container");if(container?.classList.contains("animatation-watch-gif")){if(this._watchOverlay){this._revertWatchGifState();return}this._watchGifOriginalHTML&&(container.innerHTML=this._watchGifOriginalHTML,this._watchGifOriginalHTML=null),container.classList.remove("animatation-watch-gif"),container.classList.add("animation-watch-gif-close"),this.querySelector(".neo-product-card-media")?.classList.remove("neo-product-card-media--watch-overlay-active")}}
105_onColorSwatchClick(e){const img=e.target.closest(".neo-product-card-color-variant-image");if(!img||!this.contains(img))return;const colorVariantId=this.getProductIdNumeric(img.getAttribute("data-product-id")||"");if(!colorVariantId||this._sameProductId(colorVariantId,this._currentProductId))return;e.preventDefault(),e.stopPropagation(),this._currentProductId=colorVariantId,this._updateActiveColorSwatch();const rootId=this._productId;setTimeout(()=>{this._sameProductId(colorVariantId,this._currentProductId)&&(this._dismissWatchOverlayForSwatchChange(),this._switchToProduct(rootId,colorVariantId))},0)}_updateNewTag(product){const mediaContainer=this.querySelector(".neo-product-card-media-container");if(!mediaContainer)return;let newTagEl=this.querySelector(".neo-product-card-new-tag");(product?.tags||[]).join(" ").toLowerCase().includes("new 2026")?newTagEl||(newTagEl=document.createElement("p"),newTagEl.className="neo-product-card-new-tag",newTagEl.textContent="New",mediaContainer.appendChild(newTagEl)):newTagEl&&newTagEl.remove()}_updateSaleTag(product){const mediaContainer=this.querySelector(".neo-product-card-media-container");if(!mediaContainer)return;let saleTagEl=this.querySelector(".neo-product-card-sale-tag");if((product?.tags||[]).join(" ").toLowerCase().includes("sale 2026")){if(!saleTagEl){saleTagEl=document.createElement("p"),saleTagEl.className="neo-product-card-sale-tag",saleTagEl.textContent="Sale";const newTagEl=this.querySelector(".neo-product-card-new-tag");newTagEl?newTagEl.after(saleTagEl):mediaContainer.appendChild(saleTagEl)}}else saleTagEl&&saleTagEl.remove()}_onWatchGifClick(e){if(!this.isSwiperEnabled())return;const container=e.target.closest(".neo-product-card-1-watch-gif-container");if(!container)return;if(e.preventDefault(),e.stopPropagation(),container.querySelector(".neo-product-card-1-watch-close-icon")){this._revertWatchGifState();return}const mediaEl=this.querySelector(".neo-product-card-media"),wrapper=this.querySelector(".swiper .swiper-wrapper");if(!mediaEl||!wrapper)return;const slides=wrapper.querySelectorAll(".swiper-slide");let videoSlide=null,firstImageSlide=null;for(let i=0;i<slides.length;i++){const slide=slides[i];slide&&(slide.querySelector(".neo-product-card-1__video")&&(videoSlide=slide),!firstImageSlide&&slide.querySelector(".neo-product-card-1__image-img")&&(firstImageSlide=slide))}if(!videoSlide)return;const activeSlide=wrapper.querySelector(".swiper-slide-active"),imageElement=(activeSlide?.querySelector(".neo-product-card-1__image-img")?activeSlide:firstImageSlide)?.querySelector(".neo-product-card-1__image-img")||firstImageSlide?.querySelector(".neo-product-card-1__image-img"),videoElement=videoSlide.querySelector(".neo-product-card-1__video");if(!imageElement||!(videoElement instanceof HTMLVideoElement))return;const videoSrc=videoElement.currentSrc||videoElement.querySelector("source")?.getAttribute("src")||"",videoPoster=videoElement.getAttribute("poster")||"",videoMime=videoElement.querySelector("source")?.getAttribute("type")||"video/mp4";if(!videoSrc)return;this._watchGifOriginalHTML=container.innerHTML,container.classList.remove("animatation-watch-gif"),container.classList.add("animation-watch-gif-close");const closeIconHTML=`<div class="relative neo-product-card-1-watch-close-btn">
106          <svg class="neo-product-card-1-watch-close-icon" width="7" height="8" viewBox="0 0 7 8" fill="none" xmlns="http://www.w3.org/2000/svg">
107        <path d="M1 1L6 7M6 1L1 7" stroke="white" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
108      </svg>
109        </div>
110        <p class="neo-product-card-1-watch-gif-text">Watch</p>`;container.innerHTML=closeIconHTML,container.classList.add("animatation-watch-gif"),container.classList.remove("animation-watch-gif-close");const overlay=document.createElement("div");overlay.className="neo-product-card-1-watch-overlay";const clonedImage=imageElement.cloneNode(!0);if(!(clonedImage instanceof HTMLElement))return;clonedImage.classList.add("neo-product-card-1-watch-overlay__image"),overlay.appendChild(clonedImage);const overlayVideo=document.createElement("video");overlayVideo.className="neo-product-card-swiper__video neo-product-card-1__video neo-product-card-1-watch-overlay__video",overlayVideo.setAttribute("muted","true"),overlayVideo.setAttribute("playsinline",""),overlayVideo.setAttribute("loop",""),overlayVideo.setAttribute("preload","metadata"),videoPoster&&overlayVideo.setAttribute("poster",videoPoster);const source=document.createElement("source");source.src=videoSrc,source.muted=!0,source.type=videoMime,overlayVideo.appendChild(source),overlay.appendChild(overlayVideo),mediaEl.classList.add("neo-product-card-media--watch-overlay-active"),mediaEl.appendChild(overlay),this._watchOverlay=overlay,this._watchOverlayVideo=overlayVideo,requestAnimationFrame(()=>{clonedImage.classList.add("neo-product-card-1-anim-image-zoom-out"),overlayVideo.classList.add("neo-product-card-1-anim-video-zoom-in"),overlayVideo.muted=!0,overlayVideo.play().catch(()=>{})})}_revertWatchGifState(){const container=this.querySelector(".neo-product-card-1-watch-gif-container"),overlay=this._watchOverlay,overlayVideo=this._watchOverlayVideo;if(!container||!this._watchGifOriginalHTML||!overlay)return;const clonedImage=overlay.querySelector("img");if(clonedImage instanceof HTMLElement&&overlayVideo){if(overlayVideo instanceof HTMLVideoElement)try{overlayVideo.pause(),overlayVideo.currentTime=0,overlayVideo.muted=!0}
110catch{}clonedImage.classList.add("neo-product-card-1-anim-image-zoom-in"),overlayVideo.classList.add("neo-product-card-1-anim-video-zoom-out"),setTimeout(()=>{overlay.remove(),this._watchOverlay=null,this._watchOverlayVideo=null;const media2=this.querySelector(".neo-product-card-media");media2&&media2.classList.remove("neo-product-card-media--watch-overlay-active"),container.innerHTML=this._watchGifOriginalHTML,container.classList.remove("animatation-watch-gif"),container.classList.add("animation-watch-gif-close"),this._watchGifOriginalHTML=null},400);return}overlay.remove(),this._watchOverlay=null,this._watchOverlayVideo=null;const media=this.querySelector(".neo-product-card-media");media&&media.classList.remove("neo-product-card-media--watch-overlay-active"),container.innerHTML=this._watchGifOriginalHTML,container.classList.remove("animatation-watch-gif"),container.classList.add("animation-watch-gif-close"),this._watchGifOriginalHTML=null}async _switchToProduct(productId=this._productId,colorVariantId){const rootId=this.getProductIdNumeric(productId),variantId=this.getProductIdNumeric(colorVariantId);if(!rootId||!variantId)return;const product=await this._resolveFullProduct(rootId);if(!product)return;const swatches=this.getColorSwatches(product);swatches.length>this._colorVariantSwatches.length&&(this._colorVariantSwatches=swatches);let variantProduct=swatches.find(s=>this._sameProductId(s.id,variantId))?.product;variantProduct||(variantProduct=globalThis.neoProductCardCache?.[variantId]),variantProduct||(variantProduct=await this.fetchProduct(variantId)),variantProduct&&(this._currentProductId=variantId,this._updateCardUI(variantProduct,product))}_updatePrice(product){const atb=this.querySelector(".add-to-cart-button-gql");if(!atb)return;const amount=parseFloat(product.selectedOrFirstAvailableVariant?.price?.amount||product.priceRange?.minVariantPrice?.amount||0);if(!amount)return;const compareAmount=parseFloat(product.selectedOrFirstAvailableVariant?.compareAtPrice?.amount||product.compareAtPriceRange?.minVariantPrice?.amount||0),html=globalThis.AtcPriceBlock?globalThis.AtcPriceBlock.html(amount,compareAmount):"";html&&requestAnimationFrame(()=>{let block=atb.querySelector(".atc-price-block");if(block){const wrap2=document.createElement("div");wrap2.innerHTML=html;const next2=wrap2.firstElementChild;next2&&block.replaceWith(next2);return}const priceSpan=[...atb.children].find(el=>el.tagName==="SPAN"&&!el.classList.contains("atc-link-button__corner")&&!el.classList.contains("add-to-cart-button-gql-plus"));if(!priceSpan)return;const wrap=document.createElement("div");wrap.innerHTML=html;const next=wrap.firstElementChild;next&&priceSpan.replaceWith(next)})}_updateCardUI(colorVariant,product,options={}){const renderSwatches=options.renderSwatches===!0,productUrl=`/products/${colorVariant.handle}`,title=colorVariant.title||"",highlights=this.getHighlightsString(colorVariant),tag=colorVariant.metafield_tag?.value??"",enableSwiper=this.isSwiperEnabled(),{watchGifSrc,hasVideo}=enableSwiper?this.getWatchGifAndHasVideo(colorVariant):{watchGifSrc:"",hasVideo:!1},colorVariantIds=this.getColorVariantIds(product);if(!renderSwatches){const titleContainer=this.querySelector(".title-container"),titleLink=titleContainer?.querySelector(".title-link-wrapper")||this.querySelector(".title-link-wrapper")||titleContainer;if(titleLink&&titleLink instanceof HTMLAnchorElement){const titleEl=titleLink.querySelector(".neo-product-card-title"),subEl=titleLink.querySelector(".neo-product-card-sub-title"),hrefChanged=titleLink.getAttribute("href")!==productUrl,titleChanged=titleEl&&titleEl.textContent!==title,highlightsChanged=subEl&&subEl.textContent!==highlights;(hrefChanged||titleChanged||highlightsChanged)&&requestAnimationFrame(()=>{hrefChanged&&(titleLink.href=productUrl),titleChanged&&(titleEl.textContent=title),highlightsChanged&&(subEl.textContent=highlights)})}const tagEl=this.querySelector(".neo-product-card-1-tag");if(tag)if(tagEl)tagEl.textContent!==tag&&(tagEl.textContent=tag),tagEl.classList.remove("neo-product-card-1-tag--hidden");else{const p=document.createElement("p");p.className="neo-product-card-1-tag",p.textContent=tag,this.querySelector(".neo-product-card-media")?.appendChild(p)}else tagEl&&tagEl instanceof HTMLElement&&tagEl.classList.add("neo-product-card-1-tag--hidden");this._updateNewTag(colorVariant),this._updateSaleTag(colorVariant)}this._updatePrice(colorVariant);const mainImg=this.querySelector(".neo-product-card-1__image-img"),imgLink=mainImg?mainImg.closest("a"):null;imgLink&&imgLink instanceof HTMLAnchorElement&&imgLink.getAttribute("href")!==productUrl&&requestAnimationFrame(()=>{imgLink.href=productUrl});const watchContainer=this.querySelector(".neo-product-card-1-watch-gif-container");if(enableSwiper)if(hasVideo&&watchGifSrc)if(watchContainer){watchContainer.classList.remove("neo-product-card-1-watch-gif-container--hidden");const img=watchContainer.querySelector(".neo-product-card-1-watch-gif");img&&img instanceof HTMLImageElement&&(img.src=watchGifSrc+(watchGifSrc.includes("?")?"&":"?")+"width=100")}else{const wrap=document.createElement("div");wrap.className="neo-product-card-1-watch-gif-container",wrap.innerHTML=`
111                <div class="relative">
112                  <img src="${watchGifSrc+(watchGifSrc.includes("?")?"&":"?")}width=100" alt="${(title||"").replace(/"/g,"&quot;")}" class="neo-product-card-1-watch-gif" loading="lazy">
113                  <svg class="neo-product-card-1-watch-play-icon" width="7" height="8" viewBox="0 0 7 8" fill="none" xmlns="http://www.w3.org/2000/svg">
114                    <foreignObject x="-9.14844" y="-9.14844" width="24.5459" height="26.1479"><div xmlns="http://www.w3.org/1999/xhtml" style="backdrop-filter:blur(4.57px);clip-path:url(#bgblur_0_6163_3766_clip_path);height:100%;width:100%"></div></foreignObject>
115                    <path data-figma-bg-blur-radius="9.14844" d="M0 7.08734V0.735669C0 0.149096 0.653735 -0.200773 1.14179 0.124599L5.90983 3.30329C6.36248 3.60505 6.36248 4.27019 5.90983 4.57195L1.18526 7.72167C0.67862 8.05943 0 7.69624 0 7.08734Z" fill="white"></path>
116                    <defs>
117                      <clipPath id="bgblur_0_6163_3766_clip_path" transform="translate(9.14844 9.14844)">
118                        <path d="M0 7.08734V0.735669C0 0.149096 0.653735 -0.200773 1.14179 0.124599L5.90983 3.30329C6.36248 3.60505 6.36248 4.27019 5.90983 4.57195L1.18526 7.72167C0.67862 8.05943 0 7.69624 0 7.08734Z"></path>
119                      </clipPath>
120                    </defs>
121                  </svg>
122                </div>
123                <p class="neo-product-card-1-watch-gif-text">Watch</p>
124              `,wrap.addEventListener("click",this._boundOnWatchGifClick);
124const details=this.querySelector(".neo-product-card-details"),swatchContainer=this.querySelector(".color-variant-images"),mediaContainer=this.querySelector(".neo-product-card-media-container"),insertBeforeEl=swatchContainer||mediaContainer||details?.nextSibling;details?.parentNode&&insertBeforeEl?details.parentNode.insertBefore(wrap,insertBeforeEl):mediaContainer?.parentNode?mediaContainer.parentNode.insertBefore(wrap,mediaContainer):this.insertBefore(wrap,this.firstChild)}else watchContainer&&watchContainer instanceof HTMLElement&&watchContainer.classList.add("neo-product-card-1-watch-gif-container--hidden");else watchContainer&&watchContainer instanceof HTMLElement&&watchContainer.classList.add("neo-product-card-1-watch-gif-container--hidden");if(enableSwiper){const change=renderSwatches?"render":"update";renderSwatches?this._scheduleSwiperInit(colorVariant,change):(this._swiperIntersectionObserver&&(this._swiperIntersectionObserver.disconnect(),this._swiperIntersectionObserver=null),setTimeout(()=>{this._initSwiper(colorVariant,change)},5),this._swiperInitialized=!0)}else{const primary=this.getPrimaryImage(colorVariant),imgEl=this.querySelector(".neo-product-card-media")?.querySelector(".neo-product-card-1__image-img");if(primary&&imgEl){imgEl.src=primary.url,imgEl.alt=primary.alt;const baseUrl=primary.url.split("?")[0],urlParams=primary.url.includes("?")?primary.url.split("?")[1].replace(/(^|&)width=\d+/,"").replace(/^&/,""):"",paramConnector=urlParams?"&":"",widths=[352,520];imgEl.srcset=widths.map(w=>`${baseUrl}?${urlParams}${paramConnector}width=${w} ${w}w`).join(", ")}}const atb=this.querySelector(".add-to-cart-button-gql");if(renderSwatches)this._renderColorSwatches(product,"initial");else if(atb){atb.setAttribute("data-product-id",this._currentProductId),atb.setAttribute("data-color-variants-ids",colorVariantIds||""),atb.setAttribute("onclick",`ATBModalOpen(event, '${this._currentProductId}')`);const smartwishlist=this.querySelector(".smartwishlist");smartwishlist&&smartwishlist.setAttribute("data-product",this._currentProductId)}}}customElements.get("neo-product-card-1")||customElements.define("neo-product-card-1",NeoProductCard1)})();
125//# sourceMappingURL=/cdn/shop/t/459/assets/custom-neo-product-card-1.js.map?v=11298474504803856131787572446

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.