PageSourceSearch

https://shadyrays.com/cdn/shop/t/1063/assets/variant-picker.js?v=111512481629511167721790017067

js shadyrays.com collected 2026-09-25 02:35:22 UTC 26,586 bytes, 13 lines download raw bytes

1if(!customElements.get("variant-picker")){class VariantPicker extends HTMLElement{constructor(){super(),this.section=this.closest(".js-product"),this.productForm=this.section.querySelector(".js-product-form"),this.optionSelectors=this.querySelectorAll(".option-selector:not(.option-selector--custom)"),this.nativeSelector=document.getElementById(`variants-${this.section.dataset.section}`),this.data=this.getVariantData(),this.selectedOptions=this.getSelectedOptions(),this.variant=this.getSelectedVariant(),this.product_images_container=document.querySelector("media-gallery"),this.product_images_desktop=this.product_images_container.querySelectorAll(".product-media-collage img"),this.querySelectorAll('input[type="radio"]').forEach(radio=>{radio.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("variant:change",{bubbles:!0})),this.checkTierSelected(radio);function applyGlobalBasePriceAdjustments(){document.querySelectorAll(".product-form [data-product-collections] .money").forEach(element=>{const productWrapper=element.closest("[data-product-collections]");if(!productWrapper||productWrapper.dataset.discountedPrice!==void 0||element.closest('[data-markdown-discounted="true"]')||element.getAttribute("data-markdown-discounted")==="true"||element.closest("[data-current]")&&!["original","default-title","original-standard","original-small"].includes(element.closest("[data-current]").dataset.current.toLowerCase()))return;const collections=productWrapper.dataset.productCollections?productWrapper.dataset.productCollections.split(" "):[],variantTitle=productWrapper.dataset.current?productWrapper.dataset.current.toLowerCase():"",priceText=element.textContent,curr=theme.globals.userCurrency==="GBP"?"\xA3":"$";let prices=priceText.match(/[-+]?[0-9]*\.?[0-9]+/g);prices||(prices=[]);let price_value=parseFloat(prices[0]||0)})}setTimeout(()=>{applyGlobalBasePriceAdjustments(),MarkdownPricePro&&MarkdownPricePro.run()},1e3)})}),this.updateAvailability(),this.updateAddToCartButton(),this.addEventListener("change",this.handleVariantChange.bind(this)),this.applySearchParams(),this.selectDefaultTier(),this.updateSettings(),this.updateSelectedOptionLabels(),this.setAttribute("loaded",""),this.updatePrice()}getActiveMarkdownConfig(){MarkdownPricePro.run()}handleVariantChange(evt){this.selectedOptions=this.getSelectedOptions(),this.variant=this.getSelectedVariant(),this.preSelection=!this.variant&&this.selectedOptions.find(o=>o===null)===null,this.updateUrl(evt),this.updateVariantInput(),this.updateAddToCartButton(),this.updateAvailability(),this.updatePrice(),this.updateBackorderText(),this.updatePickupAvailability(),this.updateSku(),this.updateBarcode(),this.updateGallery(),this.updateSettings(),this.updateSelectedOptionLabels(),evt.target.dataset.optionName==="style"&&this.checkTierSelected(evt.target),VariantPicker.updateLabelText(evt),this.dispatchEvent(new CustomEvent("on:variant:change",{bubbles:!0,detail:{form:this.productForm,variant:this.variant,allVariants:this.data.variants,selectedOptions:this.selectedOptions}})),MarkdownPricePro.run()}reinitialize(){this.section=this.closest(".js-product"),this.productForm=this.section.querySelector(".js-product-form"),this.optionSelectors=this.querySelectorAll(".option-selector:not(.option-selector--custom)"),this.nativeSelector=document.getElementById(`variants-${this.section.dataset.section}`),this.data=this.getVariantData(),this.selectedOptions=this.getSelectedOptions(),this.variant=this.getSelectedVariant(),this.updateAvailability(),this.updateAddToCartButton(),this.updatePrice(),this.setAttribute("loaded","")}updateAddToCartButton(){if(!this.productForm||this.optionSelectors.length>0&&this.selectedOptions.indexOf(null)>-1)return;this.addBtn=this.addBtn||this.productForm.querySelector('[name="add"]');const addToCartBtn=document.querySelector("product-form .add-to-cart"),variantAvailable=this.variant&&this.variant.available,unavailableStr=this.variant?theme.strings.noStock:theme.strings.noVariant;
1if(addToCartBtn.dataset.initialState||(addToCartBtn.dataset.initialState="true",addToCartBtn.disabled=!0),variantAvailable){addToCartBtn.removeAttribute("disabled"),addToCartBtn.disabled=!1,addToCartBtn.style.display="block";const existingNotify=this.productForm.querySelector(".custom-swym-notify");existingNotify&&existingNotify.remove()}else addToCartBtn.disabled=!0,addToCartBtn.style.display="none",setTimeout(initCustomSwymNotifyButton,2500);addToCartBtn.textContent=variantAvailable?addToCartBtn.dataset.addToCartText:unavailableStr;const styleOption=this.selectedOptions?.[0]?.toLowerCase()||"",title=(this.variant?.title||styleOption).toLowerCase(),colorush=document.querySelector(".sr-colorush"),pro=document.querySelector(".sr-pro"),isColorush=title.includes("colorush")||styleOption.includes("colorush"),isPro=title.includes("pro")||styleOption.includes("pro");colorush&&colorush.classList.add("hidden"),pro&&pro.classList.add("hidden"),isColorush&&(colorush&&colorush.classList.remove("hidden"),pro&&pro.classList.add("hidden")),isPro&&(pro&&pro.classList.remove("hidden"),colorush&&colorush.classList.add("hidden"));let isOriginal=title.includes("original");document.querySelectorAll(".view-cart-link").forEach(el=>{el.style.setProperty("display","none")})}static updateOptionAvailability(optionEl,exists,available){const el=optionEl,unavailableText=exists?theme.strings.noStock:theme.strings.noVariant,variantItem=el.closest(".variant-item");if(el.classList.toggle("is-unavailable",!available),el.classList.toggle("is-nonexistent",!exists),variantItem&&variantItem.classList.toggle("is-hidden-variant-item",!exists),optionEl.classList.contains("custom-select__option")){const em=el.querySelector("em");em&&(em.hidden=available),available||(em?em.textContent=unavailableText:el.innerHTML=`${el.innerHTML} <em class="pointer-events-none">${unavailableText}</em>`)}else available?el.nextElementSibling.removeAttribute("title"):el.nextElementSibling.title=unavailableText}updateAvailability(){if(this.dataset.availability==="off")return;const{availabilityMode}=this.dataset;let currVariant=this.variant;this.variant||(currVariant={options:this.selectedOptions}),availabilityMode==="selection"?(this.querySelectorAll(".js-option").forEach(optionEl=>{VariantPicker.updateOptionAvailability(optionEl,!1,!1)}),this.optionSelectors.forEach((selector,selectorIndex)=>
1{this.data.variants.forEach(variant=>{let matchCount=0;if(variant.options.forEach((option,optionIndex)=>{option===currVariant.options[optionIndex]&&optionIndex!==selectorIndex&&(matchCount+=1)}),matchCount===currVariant.options.length-1){const options=selector.querySelectorAll(".js-option"),optionEl=Array.from(options).find(opt=>selector.dataset.selectorType==="dropdown"?opt.dataset.value===variant.options[selectorIndex]:opt.value===variant.options[selectorIndex]);optionEl&&VariantPicker.updateOptionAvailability(optionEl,!0,variant.available)}})})):this.optionSelectors.forEach((selector,selectorIndex)=>{if(selector.querySelectorAll('.js-option:not([data-value=""])').forEach(option=>{const optionValue=selector.dataset.selectorType==="dropdown"?option.dataset.value:option.value;let variantsExist=!1,variantsAvailable=!1;this.data.variants.forEach(v=>{let matches=0;for(let i=0;i<selectorIndex;i+=1)(v.options[i]===this.selectedOptions[i]||this.selectedOptions[i]===null)&&(matches+=1);v.options[selectorIndex]===optionValue&&matches===selectorIndex&&(variantsExist=!0,v.available&&(variantsAvailable=!0))}),VariantPicker.updateOptionAvailability(option,variantsExist,variantsAvailable)}),selector.dataset.selectorType!=="dropdown"){const checked=selector.querySelector("input:checked");if(checked){const checkedItem=checked.closest(".variant-item");if(checkedItem&&checkedItem.classList.contains("is-hidden-variant-item")){const fallback=Array.from(selector.querySelectorAll("input.js-option")).find(input=>{const item=input.closest(".variant-item");return item&&!item.classList.contains("is-hidden-variant-item")&&!input.disabled});if(fallback&&fallback!==checked){fallback.checked=!0,fallback.dispatchEvent(new Event("change",{bubbles:!0}));return}}}}})}updateBackorderText(){if(this.backorder=this.backorder||this.section.querySelector(".backorder"),!this.backorder)return;let hideBackorder=!0;if(this.variant&&this.variant.available){const{inventory}=this.data.formatted[this.variant.id];if(this.variant.inventory_management&&inventory==="none"){const backorderProdEl=this.backorder.querySelector(".backorder__product"),prodTitleEl=this.section.querySelector(".product-title"),variantTitle=this.variant.title.includes("Default")?"":` - ${this.variant.title}`;backorderProdEl.textContent=`${prodTitleEl.textContent}${variantTitle}`,hideBackorder=!1}}this.backorder.hidden=hideBackorder}static updateLabelText(evt){const selector=evt.target.closest(".option-selector");if(selector.dataset.selectorType==="dropdown")return;const colorText=selector.querySelector(".js-color-text");colorText&&(colorText.textContent=evt.target.nextElementSibling.querySelector(".js-value").textContent)}updatePickupAvailability(){this.pickUpAvailability=this.pickUpAvailability||this.section.querySelector("pickup-availability"),this.pickUpAvailability&&(this.variant&&this.variant.available?this.pickUpAvailability.getAvailability(this.variant.id):(this.pickUpAvailability.removeAttribute("available"),this.pickUpAvailability.innerHTML=""))}_updatePriceElements(){if(this.price=this.price||this.section.querySelector(".price"),!this.price)return;const metadataWrapper=this.price.querySelector("[data-product-collections]")||this.section.querySelector("[data-product-collections]")||this.price.querySelector(".price__default");if(!metadataWrapper)return;const collections=metadataWrapper.dataset.productCollections||"",mainDisplayVariant=this.variant||this.data.variants[0],mainPriceData=this.data.formatted[mainDisplayVariant.id],currentContainer=this.price.querySelector(".price__current");currentContainer&&(mainDisplayVariant.compare_at_price>mainDisplayVariant.price?currentContainer.innerHTML=`
2                <span class="price--on-sale" data-target="price-element">
3                  <span class="price-label money">${mainPriceData.price}</span>
4                  <span class="price-label original-price price__was">${mainPriceData.compareAtPrice} --</span>
5                </span>`:currentContainer.innerHTML=`<span data-target="price-element">${mainPriceData.price}</span>`),metadataWrapper.dataset.productSelectedVariant=mainDisplayVariant.title,metadataWrapper.dataset.realPrice=mainDisplayVariant.price,metadataWrapper.dataset.current=mainDisplayVariant.title.toLowerCase().trim();const firstOptionSelector=this.optionSelectors[0];firstOptionSelector&&(firstOptionSelector.classList.contains("style__selector")||firstOptionSelector.dataset.optionName==="style")&&this._updateTierPrices(firstOptionSelector,collections),typeof window.MarkdownPricePro<"u"&&typeof window.MarkdownPricePro.run=="function"&&window.MarkdownPricePro.run({is_product_page:!0,skipReset:!0})}updateSelectedOptionLabels(){const lensTitle=this.section.querySelector(".sr-pdp-tier-title"),frameTitle=this.section.querySelector(".sr-pdp-frame-title"),selectedStyle=this.querySelector('input[data-option-name="style"]:checked'),selectedSize=this.querySelector('input[data-option-name="size"]:checked');if(lensTitle){const lensValue=selectedStyle?.dataset.optionValue||selectedStyle?.value||"";lensTitle.textContent=`Lens: ${lensValue}`}if(frameTitle){const sizeValue=selectedSize?.dataset.optionValue||selectedSize?.value||"";frameTitle.textContent=`Size: ${sizeValue}`}}updatePrice(){if(typeof window.MarkdownPricePro<"u"&&window.MarkdownPricePro.init){const config=this.getActiveMarkdownConfig();config&&config.id&&config.collections&&config.multiplier&&window.MarkdownPricePro.init({id:config.id,collections:config.collections,multiplier:config.multiplier,discount_code:config.discount_code})}this._updatePriceElements()}_updateTierPrices(selector,collections){const currentSizeValue=this.selectedOptions[1];selector.querySelectorAll('input[type="radio"]').forEach(tierInput=>
5{const tierValue=tierInput.value;let vToPrice=this.data.variants.find(v=>v.options[0]===tierValue&&v.options[1]===currentSizeValue);vToPrice||(vToPrice=this.data.variants.find(v=>v.options[0]===tierValue));const labelSpan=tierInput.nextElementSibling?.querySelector("span[data-current]"),moneyFormat=window.theme?.moneyFormat||window.Shopify?.money_format||"${{amount_no_decimals}}",formatMoney=cents=>{const currencyCode=window.Shopify?.currency?.active||"USD",symbol={USD:"$",CAD:"$",AUD:"$",GBP:"\xA3",EUR:"\u20AC"}[currencyCode]||"$",amount=Math.round(Number(cents)/100);return`${symbol}${amount}`};if(vToPrice&&labelSpan){const isOnSale=vToPrice.compare_at_price>vToPrice.price,formattedPrice=formatMoney(vToPrice.price),formattedCompare=vToPrice.compare_at_price?formatMoney(vToPrice.compare_at_price):null;isOnSale?labelSpan.innerHTML=`
6            <span class="price--on-sale" data-target="price-element">
7              <span class="js-value value-price">${formattedPrice}</span>
8              <span class="price__was mini-price">${formattedCompare}</span>
9            </span>`:labelSpan.innerHTML=`
10            <span class="js-value value-price" data-target="price-element">
11              ${formattedPrice}
12            </span>`,labelSpan.dataset.realPrice=vToPrice.price,labelSpan.dataset.productCollections=collections,labelSpan.dataset.current=tierValue.toLowerCase()}})}updateSku(){if(this.sku=this.sku||this.section.querySelector(".product-sku__value"),!this.sku)return;const skuAvailable=this.variant&&this.variant.sku;this.sku.textContent=skuAvailable?this.variant.sku:"",this.sku.parentNode.hidden=!skuAvailable}updateBarcode(){if(this.barcode=this.barcode||this.section.querySelector(".product-barcode__value"),!this.barcode)return;const barcodeAvailable=this.variant&&this.variant.barcode;this.barcode.textContent=barcodeAvailable?this.variant.barcode:"",this.barcode.parentNode.hidden=!barcodeAvailable}updateUrl(evt){if(!evt||evt.type!=="change"||this.dataset.updateUrl==="false"||document.body.classList.contains("template-collection"))return;const url=this.variant?`${this.dataset.url}?variant=${this.variant.id}`:this.dataset.url;window.history.replaceState({},"",url)}updateVariantInput(){this.forms=this.forms||this.section.querySelectorAll(".js-product-form, .js-instalments-form"),this.forms.forEach(form=>{const input=form.querySelector('[name="id"]');input.value=this.variant?this.variant.id:"",input.dispatchEvent(new Event("change",{bubbles:!0}))})}getVariantData(){const dataEl=this.querySelector('[type="application/json"]');return JSON.parse(dataEl.textContent)}getSelectedOptions(){const selectedOptions=[];return this.optionSelectors.forEach(selector=>{if(selector.dataset.selectorType==="dropdown"){const selected=selector.querySelector('.custom-select__option[aria-selected="true"]');selectedOptions.push(selected&&selected.dataset.value!==""?selected.dataset.value:null)}else{const firstInput=selector.querySelector('input[type="radio"]');if(firstInput){const nameAttr=firstInput.name,selected=document.querySelector(`input[name="${nameAttr}"]:checked`);selectedOptions.push(selected?selected.value:null)}else{const selected=selector.querySelector("input:checked");selectedOptions.push(selected?selected.value:null)}}}),selectedOptions}getSelectedVariant(){return this.data.variants.find(v=>v.options.every((val,index)=>val===this.selectedOptions[index]))}applySearchParams(){const searchParams=new URLSearchParams(window.location.search);Array.from(searchParams.keys()).forEach(key=>{const value=searchParams.get(key),matchingOptionSelector=Array.from(this.optionSelectors).find(x=>x.dataset.option===key);if(matchingOptionSelector)if(matchingOptionSelector.dataset.selectorType==="dropdown"){const colorOptionDropdown=matchingOptionSelector.querySelector(`.custom-select__option[data-value="${value}"]`);colorOptionDropdown&&colorOptionDropdown.closest("custom-select").selectOption(colorOptionDropdown)}else{const matchingInput=matchingOptionSelector.querySelector(`input[value="${value}"]`);matchingInput&&(matchingOptionSelector.querySelector(".option-selector__label-value")&&(matchingOptionSelector.querySelector(".option-selector__label-value").textContent=value),matchingInput.checked=!0,matchingInput.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1})))}})}updateGallery(evt){}checkTierSelected(evt){const p_original=document.querySelector(".prod-default-content"),p_pro=document.querySelector(".ascend-standard"),p_colorush=document.querySelector(".colorush-standard"),section_colorush=document.querySelectorAll(".tier_colorush"),section_srpro=document.querySelectorAll(".tier_srpro");if(p_original&&p_original.classList.add("hidden"),p_pro&&p_pro.classList.add("hidden"),p_colorush&&p_colorush.classList.add("hidden"),section_colorush&&section_colorush.forEac
12h(section=>{section.classList.add("hidden")}),section_srpro&&section_srpro.forEach(section=>{section.classList.add("hidden")}),evt.dataset.tier){const productHandle=this.dataset.url?this.dataset.url.replace("/products/","").split("?")[0]:window.location.pathname.split("/products/")[1]?.split("?")[0];switch(evt.dataset.tier){case"original":p_original&&p_original.classList.remove("hidden"),this.swapImages(evt,evt.dataset.imgs);break;case"pro-polarized":p_pro&&p_pro.classList.remove("hidden"),section_srpro&&section_srpro.forEach(section=>{section.classList.remove("hidden")}),this.swapImages(evt,evt.dataset.proImgs);break;case"colorush":p_colorush&&p_colorush.classList.remove("hidden"),section_colorush&&section_colorush.forEach(section=>{section.classList.remove("hidden")}),evt.dataset.skipSwapimage==="false"&&this.swapImages(evt,evt.dataset.colorushImgs);break}}}getVariantsByHandle(handle){return handle?window.curProdroduct&&window.curProdroduct.handle===handle?Promise.resolve(window.curProdroduct):fetch("/products/"+handle+".js").then(response=>response.json()).then(product=>(window.curProdroduct={product_id:product.id,handle:product.handle,title:product.title,selected_variant_id:product.variants[0]?.id,variants:{original:0,pro:0,colorush:0}}
12,product.variants.forEach(variant=>{const title=variant.title.toLowerCase();title.includes("colorush")&&!window.curProdroduct.variants.colorush?window.curProdroduct.variants.colorush=variant.price/100:title.includes("pro")&&!window.curProdroduct.variants.pro?window.curProdroduct.variants.pro=variant.price/100:title.includes("original")&&!window.curProdroduct.variants.original&&(window.curProdroduct.variants.original=variant.price/100)}),window.curProdroduct)).catch(error=>(console.error("getVariantsByHandle error:",error),null)):Promise.resolve(null)}getCookieValue(name){return document.cookie.split("; ").find(row=>row.startsWith(name+"="))?.split("=")[1]||""}updateTierPricing(target){const tier_container=this.getItemKeyContainer(target.dataset.tier),tier_name=this.getItemKey(target.dataset.tier);if(this.getCookie?.("markdown_discount_code")||this.getCookieValue?.("markdown_discount_code"))return;let selectedPrice=0;curProdroduct&&curProdroduct.variants&&Object.keys(curProdroduct.variants).length>1&&Object.entries(curProdroduct.variants).forEach(([key,price])=>{key===tier_name&&(selectedPrice=parseFloat(price)||0)}),setTimeout(()=>{this.querySelectorAll(".variant-item").forEach(optionEl=>{const priceContainer=optionEl.querySelector('[data-target="price-element"]');if(!priceContainer||priceContainer.classList.contains("price--on-sale"))return;const moneyEl=priceContainer.querySelector(".money"),variantPrice=priceContainer.querySelector(".variant-price");let diffEl=priceContainer.querySelector(".price-diff");diffEl||(diffEl=document.createElement("span"),diffEl.className="price-diff",priceContainer.appendChild(diffEl)),optionEl.classList.contains(tier_container)||(moneyEl&&(moneyEl.style.display="none"),variantPrice&&(variantPrice.style.display="none")),optionEl.classList.contains("item-original")?diffEl.innerHTML=this.formatDiff(parseFloat(curProdroduct.variants.original||0),selectedPrice):optionEl.classList.contains("item-pro-polarized")?diffEl.innerHTML=this.formatDiff(parseFloat(curProdroduct.variants.pro||0),selectedPrice):optionEl.classList.contains("item-colorush")&&(diffEl.innerHTML=this.formatDiff(parseFloat(curProdroduct.variants.colorush||0),selectedPrice))}),this.querySelectorAll(".variant-item").forEach(optionEl=>{const priceContainer=optionEl.querySelector('[data-target="price-element"]'),priceDiff=priceContainer?.querySelector(".price-diff"),radio=optionEl.querySelector('input[type="radio"]');!priceContainer||!priceDiff||radio?.checked||(priceContainer.innerHTML="",priceContainer.appendChild(priceDiff))});const selectedItem=this.querySelector(".variant-item."+tier_container);if(selectedItem){const priceContainer=selectedItem.querySelector('[data-target="price-element"]');if(!priceContainer)return;const moneyEl=priceContainer.querySelector(".money"),variantPrice=priceContainer.querySelector(".variant-price"),diffEl=priceContainer.querySelector(".price-diff");moneyEl&&(moneyEl.style.display="inline"),variantPrice&&(variantPrice.style.display="inline"),diffEl&&(diffEl.innerHTML="")}},100)}formatDiff(price,selectedPrice){const diff=price-selectedPrice,currencySymbol=this.getCurrencySymbol(),roundedDiff=Math.round(Math.abs(diff));return diff>0?`+${currencySymbol}${roundedDiff}`:diff<0?`-${currencySymbol}${roundedDiff}`:""}getCurrencySymbol(){const code=Shopify.currency.active||"USD";return{USD:"$",CAD:"$",AUD:"$",GBP:"\xA3"}[code]||"$"}getItemKeyContainer(item){return item.includes("original")?"item-original":item.includes("pro")?"item-pro-polarized":item.includes("colorush")?"item-colorush":null}getItemKey(item){return item.includes("original")?"original":item.includes("pro")?"pro":item.includes("colorush")?"colorush":null}swapImages(selected_tier,imgs){const imgs_arr=imgs.split(",").map(s=>s.trim()).filter(Boolean);if(selected_tier){const pdp_thumb_imgs=document.querySelectorAll('[data-pdp-gallery="original"]'),pdp_slider_gallery=document.querySelectorAll('[data-pdp-slider="original"]'),pdp_all_thumbs=document.querySelectorAll("ul.slider__grid .slider__item"),hideSlide=el=>{el.classList.add("hidden"),el.setAttribute("hidden","")},showSlide=el=>{el.classList.remove("hidden"),el.removeAttribute("hidden")},setImageWithFallback=(el,img,src)=>{if(!src){hideSlide(el);return}showSlide(el),img.onerror=null,img.onerror=()=>{hideSlide(el)}
12,img.onload=()=>{showSlide(el)},img.src=src,img.setAttribute("srcset",src)};pdp_thumb_imgs.forEach((el,index)=>{const img=el.querySelector("img"),a=el.querySelector("a"),src=imgs_arr[index];img&&(setImageWithFallback(el,img,src),a&&(src?a.href=src:a.removeAttribute("href")))}),pdp_slider_gallery.forEach((el,index)=>{const img=el.querySelector("img"),src=imgs_arr[index];img&&setImageWithFallback(el,img,src)}),pdp_all_thumbs.forEach((el,index)=>{const img=el.querySelector("img"),a=el.querySelector("a")}),new MutationObserver((mutations,obs)=>{document.querySelector(".gallery-viewer__thumbs")&&(console.log("Gallery thumbs updated"),obs.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}}selectDefaultTier(){if(new URLSearchParams(window.location.search).has("variant"))return;const referrer=document.referrer.toLowerCase();let tier="original";referrer.includes("/collections/men-colorush")||referrer.includes("/collections/women-colorush")||referrer.includes("/collections/colorush")?tier="colorush":referrer.includes("/collections/pro-polarized")&&(tier="pro-polarized");const input=this.querySelector(`input[data-tier="${tier}"]`);input&&!input.checked&&(input.checked=!0,input.dispatchEvent(new Event("change",{bubbles:!0})))}updateSettings(){const fit_guides_all=document.querySelectorAll(".fit-guide__wrapper .fgs-size"),fit_images_all=document.querySelectorAll(".sr-size-imgs"),selected_style=document.querySelector('input[data-option-name="style"]:checked'),prescriptions=document.querySelectorAll("a.available-pres"),selected_size=document.querySelector('input[data-option-name="size"]:checked');fit_guides_all.forEach(fitOption=>{fitOption.classList.add("hide")}),fit_images_all.forEach(fitOption=>{fitOption.classList.add("hide")}),prescriptions.forEach(fitOption=>{fitOption.dataset.oneSize!=="true"&&fitOption.classList.add("hidden")}),selected_size&&document.querySelectorAll(`[data-product-size="${selected_size.dataset.optionValue}"]`).forEach(fitOption=>{fitOption.classList.remove("hide"),fitOption.classList.remove("hidden")}),selected_style&&(this.checkTierSelected(selected_style),this.updateSelectedOptionLabels())}}customElements.define("variant-picker",VariantPicker)}function initCustomSwymNotifyButton(){try{const form=document.querySelector("product-form"),soldOutBtn=form.querySelector('button[name="add"][disabled]'),swymInjectedBtn=form.querySelector(".swym-button.swym-notify-btn, .swym-added-to-waitlist, .swym-button-bar button");if(swymInjectedBtn){const style=window.getComputedStyle(swymInjectedBtn);if(style.display!=="none"&&style.visibility!=="hidden"&&swymInjectedBtn.offsetParent!==null){const existingCustom=form.querySelector(".custom-swym-notify");existingCustom&&existingCustom.remove();return}}if(soldOutBtn){if(form.querySelector(".custom-swym-notify"))return;const container=form.querySelector(".quantity-submit-row")||soldOutBtn.parentElement;if(!container)return;const btn=document.createElement("button");btn.type="button",btn.className="btn btn--large custom-swym-notify",btn.innerText="Notify Me When Available",btn.style.marginTop="10px",container.appendChild(btn),btn.addEventListener("click",function(){try{if(typeof _swat>"u"){console.warn("SWYM not loaded");return}const variantId=form.querySelector('input[name="id"]')?.value,productId=form.querySelector('input[name="product-id"]')?.value,productUrl=window.location.href,productImg=document.querySelector(".product-media img")?.src||"",priceText=document.querySelector(".price .money")?.textContent||"0",priceValue=parseFloat(priceText.replace(/[^0-9.]/g,""))||0;let product={epi:Number(variantId),empi:Number(productId),du:productUrl,iu:productImg,pr:priceValue,et:8},topic="comingsoon",onSuccess=function(response){console.log("SWYM popup opened",response)};_swat.addToWatchList(null,product,onSuccess,null,topic)}catch(e){console.error("SWYM notify error",e)}})}}catch(e){console.error("Notify button init failed",e)}}
13//# sourceMappingURL=/cdn/shop/t/1063/assets/variant-picker.js.map?v=111512481629511167721790017067

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.