PageSourceSearch

https://www.epicfits.com/cdn/shop/t/83/assets/v2-pdp.js?v=113543405152984963331784844547

js epicfits.com collected 2026-10-04 04:35:51 UTC 47,433 bytes, 7 lines download raw bytes

1if(!customElements.get("product-style")){class ProductStyles extends HTMLElement{constructor(){super()}connectedCallback(){this.addEventListener("change",event=>{const target=event.target,label=target.parentNode;target.classList.contains("js-is-clearance")?document.querySelector("product-info").dataset.productClearance="true":document.querySelector("product-info").dataset.productClearance="false",label&&(label.classList.add("loading"),label.querySelector(".loading__spinner")?.classList.remove("hidden")),publish(PUB_SUB_EVENTS.onStyleChange,{data:{event,target}})})}}customElements.define("product-style",ProductStyles)}if(!customElements.get("product-type-selector")){class ProductTypeSelector extends HTMLElement{constructor(){super()}connectedCallback(){this.addEventListener("change",event=>{const target=event.target;target.classList.contains("js-is-clearance")?document.querySelector("product-info").dataset.productClearance="true":document.querySelector("product-info").dataset.productClearance="false";const label=target.parentNode;label&&(label.classList.add("loading"),label.querySelector(".loading__spinner")?.classList.remove("hidden")),publish(PUB_SUB_EVENTS.onTypeChange,{data:{event,target}})})}}customElements.define("product-type-selector",ProductTypeSelector)}if(!customElements.get("product-pack-selector")){class ProductPackSelector extends HTMLElement{constructor(){super()}connectedCallback(){this.addEventListener("change",event=>{const target=event.target;target.classList.contains("js-is-clearance")?document.querySelector("product-info").dataset.productClearance="true":document.querySelector("product-info").dataset.productClearance="false";const label=target.parentNode;label&&(label.classList.add("loading"),label.querySelector(".loading__spinner")?.classList.remove("hidden")),publish(PUB_SUB_EVENTS.onPackSizeChange,{data:{event,target}})})}}customElements.define("product-pack-selector",ProductPackSelector)}if(!customElements.get("product-info")){class ProductInfo extends HTMLElement{onVariantChangeUnsubscriber=void 0;onStyleChangeUnsubscriber=void 0;onPackColorsChangeUnsubscriber=void 0;onPackChangeUnsubscriber=void 0;onTypeChangeUnsubscriber=void 0;abortController=null;responseCache=new Map;preProcessHtmlCallbacks=[];postProcessHtmlCallbacks=[];constructor(){super()}connectedCallback(){this.onVariantChangeUnsubscriber=subscribe(PUB_SUB_EVENTS.optionValueSelectionChange,this.handleOptionValueChange.bind(this)),this.onStyleChangeUnsubscriber=subscribe(PUB_SUB_EVENTS.onStyleChange,this.handleStyleChange.bind(this)),this.onPackColorsChangeUnsubscriber=subscribe(PUB_SUB_EVENTS.onPackColorsChange,this.handleProductChange.bind(this)),this.onPackChangeUnsubscriber=subscribe(PUB_SUB_EVENTS.onPackSizeChange,this.handlePackSizeChange.bind(this)),this.onTypeChangeUnsubscriber=subscribe(PUB_SUB_EVENTS.onTypeChange,this.handleTypeChange.bind(this))}handleOptionValueChange({data:{event,target,selectedOptionValues}}){if(!this.contains(event.target))return;const optionGroup=target.closest(".pdp__variant-selector-buttons");if(optionGroup){const header=optionGroup.previousElementSibling;if(header){const sizeDisplay=header.querySelector(".js-selected-size-display");sizeDisplay&&(target.value==="S"?sizeDisplay.textContent="Small":target.value==="M"?sizeDisplay.textContent="Medium":target.value==="L"?sizeDisplay.textContent="Large":target.value==="XL"?sizeDisplay.textContent="X-Large":target.value==="2XL"?sizeDisplay.textContent="2X-Large":target.value==="3XL"?sizeDisplay.textContent="3X-Large":target.value==="4XL"?sizeDisplay.textContent="4X-Large":sizeDisplay.textContent=target.value)}}this.updateFormState(),this.dataset.isVarietyPacks}handleStyleChange({data:{event,target}}){if(!this.contains(event.target))return;const productUrl=target.value,variantId=this.keepSize(productUrl);this.renderProductInfo({requestUrl:this.buildRequestUrlWithParams(productUrl,[],!1,variantId),callback:this.handleUpdateFullProductInfo(productUrl,"style")})}handleTypeChange({data:{event,target}}){if(!this.contains(event.target))return;const productUrl=target.value,variantId=this.keepSize(productUrl,target.dataset.size);this.renderProductInfo({requestUrl:this.buildRequestUrlWithParams(productUrl,[],!1,variantId),callback:this.handleUpdateFullProductInfo(productUrl)})}handleProductChange({data:{event,target}}){if(!this.contains(event.target))return;const productId=Number(target.dataset.productId),selectedSize=this.dataset.selectedSize;let productFound=this.jsonData.packs_data_json.find(product=>product.id===productId);if(productFound||(productFound=this.jsonData.singles_data_json.find(product=>product.id===productId)),!productFound)return;this.dataset.productId=Number(target.dataset.productId),this.dataset.productHandle=target.value,this.dataset.colorPack=target.dataset.colorPack,target.classList.contains("js-is-clearance")?this.dataset.productClearance=!0:this.dataset.productClearance=!1,this.dataset.isVarietyPacks=="true"&&this.updateProductTitleFromJsonData(productFound),this.updateProductPriceFromInputData(target),this.updateColorList(target.dataset.colorList),this.updateGallery(productFound),this.updateProductVariantsFromJsonData(productFound,selectedSize);const productUrl=target.value,variantId=this.keepSize(productUrl);this.renderProductInfo({requestUrl:this.buildRequestUrlWithParams(productUrl,[],!1,variantId),callback:this.handleDataUpdate()}),this.updateFormState(productFound),this.sendDataLayerInfo()}handlePackSizeChange({data:{event,target}}){if(!this.contains(event.target))return;const productUrl=target.value;this.dataset.productPackSize=target.dataset.size;const variantId=this.keepSize(productUrl);this.renderProductInfo({requestUrl:this.buildRequestUrlWithParams(productUrl,[],!1,variantId),callback:this.handleUpdateFullProductInfo(productUrl)})}renderProductInfo({requestUrl,callback}){if(this.abortController?.abort(),this.abortController=new AbortController,this.responseCac
1he.has(requestUrl)){const cachedHtml=this.responseCache.get(requestUrl);callback(cachedHtml);return}fetch(requestUrl,{signal:this.abortController.signal}).then(response=>response.text()).then(responseText=>{const html=new DOMParser().parseFromString(responseText,"text/html");this.responseCache.set(requestUrl,html),callback(html)}).catch(error=>{error.name==="AbortError"?(console.log("Fetch aborted by user"),this.querySelectorAll("label").forEach(label=>{label.classList.remove("loading")}),this.querySelectorAll(".loading__spinner").forEach(spinner=>{spinner.classList.add("hidden")})):console.error(error)})}handleDataUpdate(){return html=>{[()=>this.dataset.isVarietyPacks=="false"?this.updateProductTitle(html):null,()=>this.dataset.isVarietyPacks=="true"?this.updateProductPrice(html):null,()=>this.dataset.isVarietyPacks=="true"?this.updateProductStarRating(html):null,()=>this.dataset.isVarietyPacks=="true"?this.updateProductDescription(html):null,()=>this.updatePdpProductContext(html),()=>this.updateProductInfoData(html),()=>this.updateSizeChartButton(html),()=>this.updateSizeChartModal(html)].forEach(update=>update());const viewFullDetails=document.querySelector(".js-quick-modal-view-full-details");if(viewFullDetails&&(viewFullDetails.href=this.dataset.url),this.dataset.productPackSize==="Single"){const carouselVideo=this.querySelector("product-gallery .js-carousel-video video");this.jsonData.carousel_videos.carousel_video&&carouselVideo?(this.querySelector("product-gallery .js-carousel-video").style.display="block",carouselVideo.src=this.jsonData.carousel_videos.carousel_video.sources[0].url,carouselVideo.load()):this.querySelector("product-gallery .js-carousel-video").style.display="none"}}}handleUpdateFullProductInfo(productUrl,updateType=""){return this.querySelector("product-form-v2").classList.add("loading"),html=>{const variant=this.getSelectedVariant(html);[()=>this.updateURL(productUrl,variant?.id),()=>this.updateProductTitle(html),()=>this.updateProductPrice(html),()=>updateType==="style"?this.updateProductStarRating(html):null,()=>this.updateMonocleProductPrice(html),()=>this.updateTypeSelector(html),()=>this.updateOptionValues(html),()=>this.updateVariantInputs(variant?.id),()=>this.updateTallEquivalent(html),()=>this.updateStyleSelector(html),()=>this.updateColors(html),()=>this.updateProductForm(html),()=>this.updateProductCustomPack(html),()=>this.updatePackSelectors(html),()=>this.updateProductGalleryFromHtml(html),()=>this.updateUiFooter(html),()=>this.updateBxgy(html),()=>this.updateBelowPdpAppContent(html),()=>this.updatePdpProductContext(html),()=>this.updateProductInfoData(html),()=>this.sendDataLayerInfo(),()=>this.updateSizeChartButton(html),()=>this.updateSizeChartModal(html),()=>updateType==="style"?this.updateOkendoReviews():null].forEach(update=>update()),this.querySelector("product-form-v2").classList.remove("loading");const viewFullDetails=document.querySelector(".js-quick-modal-view-full-details");viewFullDetails&&(viewFullDetails.href=this.dataset.url)}}findVariantFromOptions(selectedValues){const productId=Number(this.dataset.productId);let productFound=this?.jsonData?.packs_data_json.find(product=>product.id===productId);return productFound||(productFound=this?.jsonData?.singles_data_json.find(product=>product.id===productId)),productFound?productFound.variants.find(variant=>selectedValues.every((value,index)=>variant[`option${index+1}`]===value)):null}updateProductVariantsFromJsonData(productFound,selectedSize){const variantSelects=this.querySelector("variant-selects");if(variantSelects&&productFound.options&&productFound.variants){const existingContent=variantSelects.innerHTML,tempContainer=document.createElement("div");tempContainer.innerHTML=existingContent;let variantSelectorHeaders=tempContainer.querySelectorAll(".pdp__variant-selector-header"),variantSelectorGroups=tempContainer.querySelectorAll(".pdp__variant-selector-buttons");if(productFound.options.length>variantSelectorHeaders.length){const templateHeader=variantSelectorHeaders[0],templateGroup=variantSelectorGroups[0];if(templateHeader&&templateGroup)for(let i=variantSelectorHeaders.length;i<productFound.options.length;i++){const newHeader=templateHeader.cloneNode(!0),headerTitle=newHeader.querySelector("h3 strong");headerTitle&&(headerTitle.textContent=`${productFound.options[i]}:`);const sizeDisplay=newHeader.querySelector(".js-selected-size-display");if(sizeDisplay&&(sizeDisplay.textContent="Choose your size."),i>0){const sizeOptionsWrapper=newHeader.querySelector(".size-options-wrapper");sizeOptionsWrapper&&sizeOptionsWrapper.remove()}const newGroup=templateGroup.cloneNode(!0);newGroup.innerHTML="",templateHeader.parentNode.appendChild(newHeader),templateGroup.parentNode.appendChild(newGroup)}}else for(let i=productFound.options.length;i<variantSelectorHeaders.length;i++)variantSelectorHeaders[i].remove(),variantSelectorGroups[i]&&variantSelectorGroups[i].remove();variantSelectorGroups=tempContainer.querySelectorAll(".pdp__variant-selector-buttons");const selectedValues=Array.from(variantSelects.querySelectorAll("input:checked")).map(input=>input.value),optionValues=productFound.options.map((option,index)=>{const optionNumber=index+1,values=new Set;
1return productFound.variants.forEach(variant=>{variant[`option${optionNumber}`]&&values.add(variant[`option${optionNumber}`])}),{name:option,position:index+1,values:Array.from(values)}});variantSelectorGroups.length===productFound.options.length&&optionValues.forEach((option,optionIndex)=>{const selectorGroup=variantSelectorGroups[optionIndex];selectorGroup&&(selectorGroup.innerHTML="",option.values.forEach((value,valueIndex)=>{const inputId=`${this.dataset.section}-${option.position}-${valueIndex}`,inputName=`${option.name}-${option.position}`,variantAvailable=productFound.variants.some(variant=>{const matchesOption=variant[`option${option.position}`]===value;if(option.position===1)return matchesOption&&variant.available;const previousOptionsMatch=optionValues.slice(0,optionIndex).every((prevOption,prevIndex)=>{const selectedValue=variantSelects.querySelector(`input[name="${prevOption.name}-${prevOption.position}"]:checked`)?.value;return selectedValue&&variant[`option${prevIndex+1}`]===selectedValue});return matchesOption&&previousOptionsMatch&&variant.available}),label=document.createElement("label");label.setAttribute("for",inputId),label.textContent=value;const input=document.createElement("input");input.classList.add("visually-hidden"),variantAvailable||(input.classList.add("disabled"),input.disabled=!0),input.type="radio",input.id=inputId,input.name=inputName,input.value=value,input.setAttribute("form",`product-form-v2-${this.dataset.section}`),input.dataset.productHandle=productFound.handle,input.dataset.productId=productFound.id,selectedValues[optionIndex]===value&&(input.checked=!0),label.appendChild(input),selectorGroup.appendChild(label)}))}),variantSelects.innerHTML=tempContainer.innerHTML;const variantGroups=this.querySelectorAll(".pdp__variant-selector-buttons"),selectedOptions=selectedSize.split(" / ");if(selectedSize===""){this.updateURL(this.dataset.productHandle,"");return}selectedOptions.forEach((option,index)=>{const variantGroup=variantGroups[index];if(!variantGroup)return;const optionInput=variantGroup.querySelector(`input[value="${option}"]`);if(optionInput&&!optionInput.disabled){optionInput.checked=!0;return}const sizeDisplay=variantGroup.previousElementSibling?.querySelector(".js-selected-size-display");sizeDisplay&&(sizeDisplay.textContent="Choose your size.")})}}updateFormState(productFound){const variantSelects=this.querySelector("variant-selects");if(!variantSelects)return;const optionGroups=variantSelects.querySelectorAll("variant-selects .pdp__variant-selector-buttons"),selectedInputs=Array.from(optionGroups).map(group=>group.querySelector("input:checked")).filter(input=>input!==null).map(input=>input.value);if(this.dataset.selectedSize=selectedInputs.join(" / "),this.dataset.productPackSize==="Single")if(this.dataset.productClearance==="true"){const form=this.querySelector("product-form-v2 form");form.querySelectorAll('input[name^="properties[_"]').forEach(input=>input.remove());const clearanceInput=document.createElement("input");clearanceInput.type="hidden",clearanceInput.name="properties[_clearance]",clearanceInput.value="true";const typeInput=document.createElement("input");typeInput.type="hidden",typeInput.name="properties[_type]",typeInput.value="PDP";const preClearanceInput=document.createElement("input");preClearanceInput.type="hidden",preClearanceInput.name="properties[_pre_clearance_price]",preClearanceInput.value=this.dataset.compareAtPrice||"",form.appendChild(clearanceInput),form.appendChild(typeInput),form.appendChild(preClearanceInput)}else{const form=this.querySelector("product-form-v2 form");form.querySelectorAll('input[name^="properties[_"]').forEach(input=>input.remove());const valueBuilderInput=document.createElement("input");valueBuilderInput.type="hidden",valueBuilderInput.name="properties[_value_builder]",valueBuilderInput.value="true";const typeInput=document.createElement("input");typeInput.type="hidden",typeInput.name="properties[_type]",typeInput.value="PDP",form.appendChild(valueBuilderInput),form.appendChild(typeInput)}else{const form=this.querySelector("product-form-v2 form");form&&form.querySelectorAll('input[name^="properties[_"]').forEach(input=>input.remove())}const allOptionsSelected=selectedInputs.length===optionGroups.length,submitButton=this.querySelector('product-form-v2 form button[type="submit"]'),submitButtonText=submitButton.querySelector(".js-button-text");if(!allOptionsSelected){submitButton.disabled=!0,submitButtonText.innerHTML=submitButton.dataset.selectSizeText,this.updateURL(this.dataset.productHandle,"");return}const selectedVariant=this.findVariantFromOptions(selectedInputs);if(!selectedVariant){submitButton.disabled=!0,submitButtonText.innerHTML=submitButton.dataset.unavailableText,this.dataset.productAvailable=!1;return}this.dataset.variantId=selectedVariant.id;const formInput=this.querySelector('product-form-v2 form input[name="id"]');if(formInput.value=selectedVariant.id,formInput.disabled=!selectedVariant.available,this.updateURL(this.dataset.productHandle,selectedVariant.id),this.updateProductInfoDataFromJsonData(productFound,selectedVariant),!selectedVariant.available){submitButton.disabled=!0,submitButtonText.innerHTML=submitButton.dataset.soldOutText,this.dataset.productAvailable=!1;const klaviyoForm=this.querySelector("klaviyo-notify-me");
1if(klaviyoForm){const variantIdInput=klaviyoForm.querySelector('input[name="variant_id"]');variantIdInput&&(variantIdInput.value=selectedVariant.id);const formButton=klaviyoForm.querySelector('button[type="submit"]');formButton&&(formButton.dataset.productId=this.dataset.productId,formButton.dataset.variantId=selectedVariant.id,formButton.dataset.productTitle=this.dataset.productTitle,formButton.dataset.productUrl=this.dataset.url)}this.dataset.isVarietyPacks=="false"&&this.updateProductAvailableState();return}submitButton.disabled=!1,submitButtonText.innerHTML=submitButton.dataset.addToCartText,this.dataset.productAvailable=!0,this.dataset.isVarietyPacks=="false"&&this.updateProductAvailableState()}updateProductAvailableState(){const variantSelects=this.querySelector("variant-selects");if(!variantSelects)return;const selectedOptions={};variantSelects.querySelectorAll("input:checked").forEach(input=>{selectedOptions[input.name]=input.value}),this.querySelectorAll("product-colors input").forEach(input=>{const colorProductId=Number(input.dataset.productId);let productFound=this.jsonData.packs_data_json.find(product=>product.id===colorProductId);if(productFound||(productFound=this.jsonData.singles_data_json.find(product=>product.id===colorProductId)),!productFound)return;const variantFound=productFound.variants.find(variant=>variant.title===this.dataset.selectedSize);if(!variantFound){input.classList.add("disabled"),input.dataset.disabled="true";return}variantFound.available?(input.classList.remove("disabled"),input.dataset.disabled="false"):(input.classList.add("disabled"),input.dataset.disabled="true")});const productColors=this.querySelector("product-colors");productColors&&productColors.querySelectorAll(".pdp__product-color-swatches-wrapper").forEach(wrapper=>{const labels=Array.from(wrapper.querySelectorAll("label"));labels.sort((a,b)=>{const aDisabled=a.querySelector("input").classList.contains("disabled"),bDisabled=b.querySelector("input").classList.contains("disabled");return Number(aDisabled)-Number(bDisabled)}),labels.forEach(label=>wrapper.appendChild(label))}),handleNotReturningSwatches()}updateColorList(colorList){console.log({colorList});const colorDisplay=this.querySelector("#color-display");if(colorDisplay){colorDisplay.dataset.colorList=colorList;const productColors=this.querySelector("product-colors");productColors&&productColors.setupToggleColors()}}updateGallery(productFound){const gallery=this.querySelector("product-gallery");gallery&&productFound.media&&productFound.media.length>0&&gallery.updateGalleryMedia(productFound.media)}getSelectedVariant(productInfoNode){const selectedVariant=productInfoNode.querySelector("variant-selects [data-selected-variant]")?.innerHTML;return selectedVariant?JSON.parse(selectedVariant):null}updateOptionValues(html){const variantSelects=html.querySelector("variant-selects");if(variantSelects&&this.variantSelectors){const existingSizeOptions=this.variantSelectors.querySelector(".size-options-wrapper");if(HTMLUpdateUtility.viewTransition(this.variantSelectors,variantSelects,[]),existingSizeOptions){const newSizeOptionsWrapper=this.variantSelectors.querySelector(".size-options-wrapper");newSizeOptionsWrapper&&newSizeOptionsWrapper.replaceWith(existingSizeOptions)}}}updateColors(html){if(this.dataset.isVarietyPacks=="true")return;const productColors=html.querySelector("product-colors");productColors&&this.productColors&&HTMLUpdateUtility.viewTransition(this.productColors,productColors,[])}updateStyleSelector(html){const productStyle=html.querySelector("product-style");productStyle&&this.productStyle&&HTMLUpdateUtility.viewTransition(this.productStyle,productStyle,[])}updateTypeSelector(html){const productType=html.querySelector("product-type-selector");productType&&this.productType&&HTMLUpdateUtility.viewTransition(this.productType,productType,[])}updatePackSelectors(html){const packSelectors=html.querySelector("product-pack-selector");packSelectors&&this.packSelectors&&HTMLUpdateUtility.viewTransition(this.packSelectors,packSelectors,[])}updateProductTitle(html){const productTitle=html.querySelector(".js-product-title");productTitle&&this.productTitle&&HTMLUpdateUtility.viewTransition(this.productTitle,productTitle,[])}updateProductTitleFromJsonData(productFound){const productTitle=this.querySelector(".js-product-title");productTitle&&(productTitle.innerHTML=productFound.title)}
1updateProductInfoDataFromJsonData(productFound=null,selectedVariant=null){productFound&&(this.dataset.productId=productFound.id,this.dataset.url=`/products/${productFound.handle}`,this.dataset.productHandle=productFound.handle,this.dataset.productTitle=productFound.title),selectedVariant&&(this.dataset.variantId=selectedVariant.id)}updateProductInfoData(html){const productInfo=html.querySelector("product-info");if(productInfo){this.dataset.productAvailable=productInfo.dataset.productAvailable,this.dataset.productPackSize=productInfo.dataset.productPackSize,this.dataset.membershipStatus=productInfo.dataset.membershipStatus,this.dataset.customerId=productInfo.dataset.customerId,this.dataset.colorPack=productInfo.dataset.colorPack,this.dataset.loginStatus=productInfo.dataset.loginStatus,this.dataset.packQuantity=productInfo.dataset.packQuantity,this.dataset.ecommerceCurrency=productInfo.dataset.ecommerceCurrency,this.dataset.productPrice=productInfo.dataset.productPrice,this.dataset.productId=productInfo.dataset.productId,this.dataset.productTitle=productInfo.dataset.productTitle,this.dataset.productDiscount=productInfo.dataset.productDiscount,this.dataset.productBrand=productInfo.dataset.productBrand,this.dataset.productCategory=productInfo.dataset.productCategory,this.dataset.productCategory2=productInfo.dataset.productCategory2,this.dataset.productCategory3=productInfo.dataset.productCategory3,this.dataset.productCategory4=productInfo.dataset.productCategory4,this.dataset.productCategory5=productInfo.dataset.productCategory5;const currencySymbol=productInfo.dataset.currencySymbol;this.insidersPrice&&(this.insidersPrice.innerHTML=`
2            <span class="desktop">Reg <s>${currencySymbol} ${Number(productInfo.dataset.productPrice).toFixed(2)}</s></span>
3            <span class="mobile"><s>${currencySymbol} ${Number(productInfo.dataset.productPrice).toFixed(2)}</s></span>
4            <strong class="pdp__insider-discount-price desktop">Insiders ${currencySymbol}${productInfo.dataset.membershipPrice}</strong>
5            <strong class="pdp__insider-discount-price mobile">${currencySymbol}${productInfo.dataset.membershipPrice}</strong>
6          `),this.bxgyPrice&&(this.bxgyPrice.textContent=`${productInfo.dataset.productPriceFormatted}`)}}updateProductStarRating(html){const productStarRating=html.querySelector(".js-product-star-rating");productStarRating&&this.productStarRating&&HTMLUpdateUtility.viewTransition(this.productStarRating,productStarRating,[])}updateProductPrice(html){const productPrice=html.querySelector(".js-product-price");productPrice&&this.productPrice&&HTMLUpdateUtility.viewTransition(this.productPrice,productPrice,[])}updateMonocleProductPrice(html){const productPrice=Number(html.querySelector("product-info").dataset.productPrice),monocleDiscount=this.querySelector("discount-bar");if(!productPrice||!monocleDiscount)return;const symbol=monocleDiscount.dataset.currencySymbol,couponValue=Number(monocleDiscount.dataset.couponValue),newPrice=Math.round(productPrice*couponValue);this.monocleProductPrice&&(this.monocleProductPrice.innerHTML=`${symbol}${newPrice}`)}updateProductForm(html){const productForm=html.querySelector("product-form-v2");productForm&&this.productForm&&HTMLUpdateUtility.viewTransition(this.productForm,productForm,[])}updatePdpProductContext(html){const pdpProductContext=html.querySelector("pdp-product-context");pdpProductContext&&this.pdpProductContext&&HTMLUpdateUtility.viewTransition(this.pdpProductContext,pdpProductContext,[])}updateProductGalleryFromHtml(html){const productGallery=html.querySelector("product-gallery");productGallery&&this.productGallery&&this.productGallery.updateGallery(productGallery)}updateTallEquivalent(html){const tallEquivalent=html.querySelector(".js-tall-equivalent");tallEquivalent&&this.tallEquivalent&&HTMLUpdateUtility.viewTransition(this.tallEquivalent,tallEquivalent,[])}updateBelowPdpAppContent(html){const belowPdpAppContent=html.querySelector("below-pdp-app-content");belowPdpAppContent&&this.belowPdpAppContent&&HTMLUpdateUtility.viewTransition(this.belowPdpAppContent,belowPdpAppContent,[])}updateVariantInputs(variantId){this.querySelectorAll(`#product-form-v2-${this.dataset.section}`).forEach(productForm=>{const input=productForm.querySelector('input[name="id"]');input.value=variantId??"",input.dispatchEvent(new Event("change",{bubbles:!0}))})}updateURL(url,variantId){this.dataset.updateUrl!=="false"&&(this.dataset.url=url,window.history.replaceState({},"",`${url}${variantId?`?variant=${variantId}`:""}`))}updateUiFooter(html){const uiFooter=html.querySelector(".js-pdp__ui-footer");uiFooter&&this.uiFooter&&HTMLUpdateUtility.viewTransition(this.uiFooter,uiFooter,[])}updateProductCustomPack(html){const productCustomPack=html.querySelector("product-custom-pack");productCustomPack&&this.productCustomPack&&HTMLUpdateUtility.viewTransition(this.productCustomPack,productCustomPack,[])}updateBxgy(html){const bxgyWrapper=html.querySelector(".js-bxgy-wrapper");
6bxgyWrapper&&this.bxgyWrapper&&HTMLUpdateUtility.viewTransition(this.bxgyWrapper,bxgyWrapper,[])}updateSizeChartButton(html){const sizeChartButton=html.querySelector(".js-size-chart-button-wrapper");sizeChartButton&&this.sizeChartButton&&HTMLUpdateUtility.viewTransition(this.sizeChartButton,sizeChartButton,[])}updateSizeChartModal(html){const sizeChartModal=html.querySelector("size-chart-modal");sizeChartModal&&this.sizeChartModal&&HTMLUpdateUtility.viewTransition(this.sizeChartModal,sizeChartModal,[])}updateOkendoReviews(){const okendoReviews=document.querySelector("okendo-reviews");okendoReviews&&okendoReviews.updateReviews()}updateProductDescription(html){const productDescription=html.querySelector(".js-product-description");productDescription&&this.productDescription&&HTMLUpdateUtility.viewTransition(this.productDescription,productDescription,[])}buildRequestUrlWithParams(url,optionValues,shouldFetchFullPage=!1,variantId){const params=[];let finalUrl=url;return!url.includes("/products/")&&!window.location.pathname.includes("/products/")&&(finalUrl=`/products/${url}`),!shouldFetchFullPage&&params.push(`section_id=${this.sectionId}`),optionValues.length&&params.push(`option_values=${optionValues.join(",")}`),variantId&&params.push(`variant=${variantId}`),`${finalUrl}?${params.join("&")}`}keepSize(productUrl,packSize=this.dataset.productPackSize){let size=this.dataset.selectedSize;if(!size)return;let searchKey=`${productUrl}|${size}|${packSize}|`;this.dataset.isVarietyPacks=="true"&&(size=size.split(" / ")[0],searchKey=`${productUrl}|${size}`);let elementFound;return this.jsonData.curated_packs_data&&(elementFound=this.jsonData.curated_packs_data.find(variantData=>variantData.startsWith(searchKey))),!elementFound&&this.jsonData.singles_data&&(elementFound=this.jsonData.singles_data.find(single_product=>single_product.startsWith(searchKey))),!elementFound&&this.jsonData.families_data&&(elementFound=this.jsonData.families_data.find(variantData=>variantData.startsWith(searchKey))),elementFound?.split("|")[3]}updateProductPriceFromInputData(target){}calculateDiscount(price,compareAtPrice){const priceValue=this.extractPrice(price),compareAtPriceValue=this.extractPrice(compareAtPrice);return Math.round((compareAtPriceValue-priceValue)/compareAtPriceValue*100)}extractPrice(priceString){return parseFloat(priceString.replace(/[^0-9.]/g,""))}showFreeShippingBadge(price){const freeShippingThreshold=parseFloat(this.dataset.freeShippingThreshold||0);return this.dataset.country==="US"&&price>=freeShippingThreshold}sendDataLayerInfo(){const packSize=this.dataset.productPackSize;window.dataLayer=window.dataLayer||[],dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"view_item",cart_source:packSize==="Single"?"PDP Singles":"PDP Curated Pack",intelligems_meta:window.intelligemsMeta||[],membership_status:this.dataset.membershipStatus,userId:this.dataset.customerId||null,page_type:"Product Detail Page",color_pack:this.dataset.colorPack,login_status:this.dataset.loginStatus,pdp_type:this.dataset.pdpType,pack_quantity:this.dataset.packQuantity,ecommerce:{currency:this.dataset.ecommerceCurrency,value:Number(this.dataset.productPrice),items:[{item_id:Number(this.dataset.productId),cart_source:packSize==="Single"?"PDP Singles":"PDP Curated Pack",item_name:this.dataset.productTitle,coupon:"",discount:Number(this.dataset.productDiscount),index:1,item_brand:this.dataset.productBrand,item_category:this.dataset.productCategory,item_category2:this.dataset.productCategory2,item_category3:Number(this.dataset.productCategory3),item_category4:this.dataset.selectedSize,item_category5:this.dataset.productCategory5,item_list_id:"",item_list_name:"",item_variant:this.dataset.colorPack,price:Number(this.dataset.productPrice),quantity:1}]}})}get sectionId(){return this.dataset.originalSection||this.dataset.section}get variantSelectors(){return this.querySelector("variant-selects")}get productColors(){return this.querySelector("product-colors")}get productStyle(){return this.querySelector("product-style")}get productType(){return this.querySelector("product-type-selector")}get packSelectors(){return this.querySelector("product-pack-selector")}get productTitle(){return this.querySelector(".js-product-title")}get productStarRating(){return this.querySelector(".js-product-star-rating")}get productPrice(){return this.querySelector(".js-product-price")}get tallEquivalent(){return this.querySelector(".js-tall-equivalent")}
6get productForm(){return this.querySelector("product-form-v2")}get productGallery(){return this.querySelector("product-gallery")}get jsonData(){const jsonDataContext=this.querySelector(".js-pdp-product-context-json");return jsonDataContext?JSON.parse(jsonDataContext.textContent):null}get selectedSize(){return Array.from(this.querySelectorAll("variant-selects input:checked")).map(input=>input.value).join(" / ")||null}get selectedPackSize(){return this.querySelector("product-pack-selector input:checked")?.dataset.size||null}get insidersPrice(){return this.querySelector(".js-insiders-price")}get belowPdpAppContent(){return document.querySelector("below-pdp-app-content")}get sizeChart(){return document.querySelector("#modal-size-chart")}get monocleProductPrice(){const price=this.querySelector("discount-bar .js-monocle-discount-price");return price||null}get pdpProductContext(){return this.querySelector("pdp-product-context")}get uiFooter(){return this.querySelector(".js-pdp__ui-footer")}get bxgyPrice(){return this.querySelector(".js-bxgy-price")}get bxgyWrapper(){return this.querySelector(".js-bxgy-wrapper")}get productCustomPack(){return this.querySelector("product-custom-pack")}get sizeChartButton(){return this.querySelector(".js-size-chart-button-wrapper")}get sizeChartModal(){return this.querySelector("size-chart-modal")}get productDescription(){return this.querySelector(".js-product-description")}}customElements.define("product-info",ProductInfo)}if(!customElements.get("discount-bar")){class DiscountBar extends HTMLElement{constructor(){super()}connectedCallback(){this.init(),this.setupMoncoleCouponAutoApplier()}init(){this.text=this.querySelector(".js-monocle-discount-text"),this.symbol=this.dataset.currencySymbol,this.button=this.querySelector(".js-monocle-discount-button"),this.useMetaobjectPromo=this.dataset.useMetaobjectPromo;const checkMonocleSDK=setInterval(()=>{if(document.querySelector("discount-bar").dataset.useMetaobjectPromo){clearInterval(checkMonocleSDK);return}if(window.monocleSDK&&window.monocleSDK.getOnsiteWidgets()[0]){clearInterval(checkMonocleSDK);const couponValue=window.monocleSDK.getOnsiteWidgets()[0].incentiveData.couponValue,couponType=window.monocleSDK.getOnsiteWidgets()[0].incentiveData.couponType,description=window.monocleSDK.getOnsiteWidgets()[0].description,productPrice=Number(document.querySelector("product-info").dataset.productPrice),cashback=Math.round(productPrice*couponValue);couponType==="cashback"?this.text.innerHTML=`${description} (<span class="js-monocle-discount-price">${this.symbol}${cashback}</span>)`:this.text.innerHTML=`${description} (<span class="js-monocle-discount-price">${this.symbol}${cashback}</span>)`,this.dataset.couponValue=couponValue,this.classList.remove("hidden"),this.button&&this.button.addEventListener("click",()=>{const popUp=window.monocleSDK.getOnsiteWidgets()[0];popUp&&popUp.open()})}},100);window.addEventListener("monocleSDK:incentiveAssigned",this.checkForIncentive.bind(this))}setupCopyableElements(){document.addEventListener("click",e=>{if(e.target.classList.contains("js-monocle-discount-code-copyable")){const text=e.target.textContent;navigator.clipboard.writeText(text).then(()=>{const originalText=e.target.innerHTML;e.target.innerHTML="Copied!",setTimeout(()=>{e.target.innerHTML=originalText},1500)}).catch(err=>{console.error("Failed to copy text: ",err)})}})}async setupMoncoleCouponAutoApplier(){function resetPromoButton(button,code){setTimeout(()=>{button.textContent=code},1500)}document.addEventListener("click",async e=>{const button=e.target.closest(".js-monocle-discount-code-autoapplyable");if(button){const code=button.textContent;navigator.clipboard.writeText(code),button.textContent="Applying...";try{(await fetch(`${window.Shopify.routes.root}discount/${code}`,{method:"GET",headers:{"Content-Type":"application/json"}})).ok?(button.textContent="Applied!",resetPromoButton(button,code)):(button.textContent="Could not apply code.",resetPromoButton(button,code))}catch(error){console.error("ERR:",error),button.textContent="Could not apply code.",resetPromoButton(button,code)}}})}async checkForIncentive(){const newIncentives=await window.monocleSDK.getIncentives();if(newIncentives.length>0){const incentive=newIncentives[0];if(incentive){this.classList.remove("hidden");const couponValue=incentive.couponValue,couponCode=incentive.couponCode,percentage=couponValue*100,productPrice
6=Number(document.querySelector("product-info").dataset.productPrice),cashback=Math.round(productPrice*couponValue),descriptionLong=incentive.descriptionLong;incentive.couponType==="cashback"?this.text.innerHTML=`${percentage}% Cashback (<span class="js-monocle-discount-price">${this.symbol}${cashback}</span>) Applied`:incentive.couponType==="basic"&&(this.text.innerHTML=`Get ${descriptionLong} w/ code: <button class="js-monocle-discount-code-autoapplyable js-monocle-discount-button">${couponCode}</button>`),this.button.textContent=incentive.couponCode,this.button.style.display="none",this.dataset.couponValue=couponValue}}else this.classList.remove("hidden")}}customElements.define("discount-bar",DiscountBar)}if(!customElements.get("klaviyo-notify-me")){class KlaviyoNotifyMe extends HTMLElement{constructor(){super()}connectedCallback(){this.init()}init(){this.form=this.querySelector("form"),this.button=this.querySelector("button"),this.emailInput=this.querySelector("input"),this.successMessage=this.querySelector(".js-success-message"),this.form.addEventListener("submit",async event=>{event.preventDefault(),this.button.classList.add("loading"),this.emailInput.setAttribute("disabled",!0),this.querySelector(".loading__spinner").classList.remove("hidden");const email=this.emailInput.value.trim();if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)){this.emailInput.setCustomValidity("Please enter a valid email address"),this.emailInput.reportValidity();return}this.emailInput.setCustomValidity("");const variantId=this.form.querySelector('input[name="variant_id"]').value,options={method:"POST",headers:{accept:"application/json",revision:"2024-06-15","content-type":"application/json"},body:JSON.stringify({data:{type:"back-in-stock-subscription",attributes:{profile:{data:{type:"profile",attributes:{email:`${email}`}}},channels:["EMAIL"]},relationships:{variant:{data:{type:"catalog-variant",id:`$shopify:::$default:::${variantId}`}}}}})};await fetch("https://a.klaviyo.com/client/back-in-stock-subscriptions/?company_id=Lj2344",options)&&(this.successMessage.classList.remove("visually-hidden"),this.form.classList.add("visually-hidden")),this.button.classList.remove("loading"),this.emailInput.removeAttribute("disabled"),this.querySelector(".loading__spinner").classList.add("hidden")}),this.emailInput.addEventListener("input",()=>{const email=this.emailInput.value.trim();/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)?(this.button.removeAttribute("disabled"),this.emailInput.setCustomValidity("")):(this.button.setAttribute("disabled",!0),this.emailInput.setCustomValidity("Please enter a valid email address"))})}}customElements.define("klaviyo-notify-me",KlaviyoNotifyMe)}if(!customElements.get("sticky-add-to-cart")){class StickyAddToCart extends HTMLElement{constructor(){super(),this.observer=null,this.mutationObserver=null,this.productForm=null}connectedCallback(){this.init(),this.setupMutationObserver()}setupMutationObserver(){this.mutationObserver=new MutationObserver(mutations=>{document.querySelector("product-form-v2")!==this.productForm&&(this.cleanupObserver(),this.init())}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0})}cleanupObserver(){this.observer&&(this.observer.disconnect(),this.observer=null)}init(){this.productForm=document.querySelector("product-form-v2"),this.productForm&&(this.button=this.querySelector("button"),this.button.addEventListener("click",()=>{const targetElement=document.querySelector("product-type-selector"),selectedVariant=document.querySelector("variant-selects input:checked");if(targetElement){const offsetTop=targetElement.getBoundingClientRect().top+window.scrollY-87;targetElement.scrollIntoView({top:offsetTop,behavior:"smooth"}),selectedVariant&&document.querySelector('product-form-v2 button[type="submit"]').click()}}),this.observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting?this.classList.add("hidden"):this.classList.remove("hidden")})},{root:null,rootMargin:"0px",threshold:0}),this.observer.observe(this.productForm))}disconnectedCallback(){this.cleanupObserver(),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}}customElements.define("sticky-add-to-cart",StickyAddToCart)}if(!customElements.get("product-custom-pack")){class ProductCustomPack extends HTMLElement{constructor(){super()}connectedCallback(){this.addToBundle=this.querySelector('[name="add-item-to-bundle"]'),this.addBundleToCart=this.querySelector('[name="add-bundle-to-cart"]'),this.addToBundle!==null&&this.addToBundle.addEventListener("click",event=>{const selectedCheckbox=this.querySelector("input:checked"),featuredImage=selectedCheckbox.dataset.featuredImage,variantId=selectedCheckbox.dataset.variantId;console.log(`Add item ${variantId} to bundle`);const cartItem=this.querySelector(".pdp__custom-pack-cart-item:not(.selected)");cartItem.setAttribute("data-variant-id",variantId),cartItem.style.backgroundImage=`url(${featuredImage})`,cartItem.classList.add("selected")}),this.addBundleToCart!==null&&this.addBundleToCart.addEventListener("click",event=>{console.log("Add bundle to cart");let formData={items:[{id:40592815030344,quantity:1,properties:{_variantIds:"29275989082184x7<>29275946877000x5"}}]};fetch(window.Shopify.routes.root+"cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(formData)}).then(response=>response.json()).catch(error=>{console.error("Error:",error)})})}}customElements.define("product-custom-pack",ProductCustomPack)}if(!customElements.get("open-size-chart")){class OpenSizeChart extends HTMLElement{constructor(){super()}connectedCallback(){this.init()}init(){this.addEventListener("click",()=>{const sizeChartModal=document.querySelector("size-chart-modal");sizeChartModal&&sizeChartModal.open()})}}customElements.define("open-size-chart",OpenSizeChart)}if(!customElements.get("open-compare-modal")){class OpenCompareModal extends HTMLElement{constructor(){super()}connectedCallback(){this.init()}init(){this.addEventListener("click",()=>{const compareModal=document.querySelector("compare-modal");compareModal&&compareModal.open()})}}customElements.define("open-compare-modal",OpenCompareModal)}function fetchConfig(type="json"){return{method:"POST",headers:{"Content-Type":"application/json",Accept:`application/${type}`}}}function handleNotReturningSwatches(){const first_color=document.querySelector("product-colors input"),product_color=document.querySelector("product-colors input:checked");!first_color||!product_color||product_color.dataset.notReturning==="true"&&product_color.dataset.disabled==="true"&&first_color.click()}class HTMLUpdateUtility{static viewTransition(oldNode,newContent,preProcessCallbacks=[],postProcessCallbacks=[]){preProcessCallbacks?.forEach(callback=>callback(newContent));const newNodeWrapper=document.createElement("div");HTMLUpdateUtility.setInnerHTML(newNodeWrapper,newContent.outerHTML);const newNode=newNodeWrapper.firstChild,uniqueKey=Date.now();oldNode.querySelectorAll("[id], [form]").forEach(element=>
6{element.id&&element.setAttribute("id",`${element.id}-${uniqueKey}`),element.form&&element.setAttribute("form",`${element.form.getAttribute("id")}-${uniqueKey}`)}),oldNode.parentNode.insertBefore(newNode,oldNode),oldNode.style.display="none",postProcessCallbacks?.forEach(callback=>callback(newNode)),setTimeout(()=>oldNode.remove(),50)}static setInnerHTML(element,html){element.innerHTML=html,element.querySelectorAll("script").forEach(oldScriptTag=>{const newScriptTag=document.createElement("script");Array.from(oldScriptTag.attributes).forEach(attribute=>{newScriptTag.setAttribute(attribute.name,attribute.value)}),newScriptTag.appendChild(document.createTextNode(oldScriptTag.innerHTML)),oldScriptTag.parentNode.replaceChild(newScriptTag,oldScriptTag)})}}window.addEventListener("DOMContentLoaded",()=>{handleNotReturningSwatches();function dataLayerPageView(){const productInfo=document.querySelector("product-info");if(!productInfo)return;const packSize=productInfo.dataset.productPackSize;window.dataLayer=window.dataLayer||[],dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"view_item",cart_source:packSize==="Single"?"PDP Singles":"PDP Curated Pack",membership_status:productInfo.dataset.membershipStatus,intelligems_meta:window.intelligemsMeta||{},userId:productInfo.dataset.customerId||null,page_type:"Product Detail Page",color_pack:productInfo.dataset.colorPack,login_status:productInfo.dataset.loginStatus,pdp_type:productInfo.dataset.pdpType,pack_quantity:productInfo.dataset.packQuantity,ecommerce:{currency:productInfo.dataset.ecommerceCurrency,value:Number(productInfo.dataset.productPrice),items:[{item_id:Number(productInfo.dataset.productId),cart_source:packSize==="Single"?"PDP Singles":"PDP Curated Pack",item_name:productInfo.dataset.productTitle,coupon:"",discount:Number(productInfo.dataset.productDiscount),index:1,item_brand:productInfo.dataset.productBrand,item_category:productInfo.dataset.productCategory,item_category2:productInfo.dataset.productCategory2,item_category3:Number(productInfo.dataset.productCategory3),item_category4:productInfo.dataset.selectedSize,item_category5:productInfo.dataset.productCategory5,item_list_id:"",item_list_name:"",item_variant:productInfo.dataset.colorPack,price:Number(productInfo.dataset.productPrice),quantity:1}]}})}document.addEventListener("cartaddsuccess",handleCartUpdate),document.addEventListener("cartremovesuccess",handleCartUpdate),document.addEventListener("cartupdatesuccess",handleCartUpdate),document.addEventListener("cartmembershipaddsuccess",handleCartUpdate);async function handleCartUpdate(){const productInfo=document.querySelector("product-info");if(!productInfo)return;const sectionId=productInfo.dataset.section;if(sectionId)try{const htmlSection=await(await fetch(`${window.location.pathname}?section_id=${sectionId}&view=pdp-liquid`)).text(),html=new DOMParser().parseFromString(htmlSection,"text/html");updateInsiderClubUpsell(html),updateBxgy(html)}catch(e){console.error(e)}}function updateInsiderClubUpsell(html){const insiderUpsell=html.querySelector(".js-insider-club-upsell"),current=document.querySelector(".js-insider-club-upsell");insiderUpsell&&current&&HTMLUpdateUtility.viewTransition(current,insiderUpsell,[])}function updateBxgy(html){const bxgy=html.querySelector(".js-bxgy-wrapper"),current=document.querySelector(".js-bxgy-wrapper");bxgy&&current&&HTMLUpdateUtility.viewTransition(current,bxgy,[])}}),window.addEventListener("DOMContentLoaded",async()=>{const globalContextId="global-context-json";let previousCart=await fetchCart();document.addEventListener("cartaddsuccess",async()=>{await updateGlobalContextOnCartChange();const newCart=await fetchCart();!newCart||!newCart.items.length||(previousCart=newCart)}),document.addEventListener("cartremovesuccess",async()=>{await updateGlobalContextOnCartChange();const newCart=await fetchCart();newCart&&(previousCart=newCart)}),document.addEventListener("cartupdatesuccess",async()=>{await updateGlobalContextOnCartChange();const newCart=await fetchCart();newCart&&(previousCart=newCart)}),getGlobalContext();async function fetchCart(){try{const cart=await(await fetch("/cart.js")).json(),cartDataElement=document.querySelector(".js-mini-cart #cart
6-data");if(cartDataElement){const cartData=JSON.parse(cartDataElement.textContent);cart.items.forEach((item,index)=>{cartData.items[index]&&(item.metafields=cartData.items[index].metafields)})}return cart}catch(error){return console.error("Error fetching cart:",error),null}}async function updateGlobalContextOnCartChange(){const jsonData=await fetchGlobalContextJSON();updateGlobalContextJSON(jsonData)}async function fetchGlobalContextJSON(){const htmlSection=await(await fetch(`${Shopify.routes}?section_id=${globalContextId}`)).text(),scriptContent=new DOMParser().parseFromString(htmlSection,"text/html").querySelector(`script#${globalContextId}`)?.textContent;if(scriptContent)return JSON.parse(scriptContent);console.error("cannot find global context")}function updateGlobalContextJSON(jsonData){const globalJSONParent=document.querySelector(`#shopify-section-${globalContextId}`);if(globalJSONParent){const script=globalJSONParent.querySelector(`script#${globalContextId}`);script.textContent=JSON.stringify(jsonData)}}function getGlobalContext(){const globalContext=document.querySelector(`script#${globalContextId}`)?.textContent;return globalContext?JSON.parse(globalContext):null}});
7//# sourceMappingURL=/cdn/shop/t/83/assets/v2-pdp.js.map?v=113543405152984963331784844547

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.