PageSourceSearch

https://twillory.com/cdn/shop/t/1072/assets/product-info.js?v=8431554815024105161789034711

js twillory.com collected 2026-10-03 19:32:09 UTC 27,922 bytes, 2 lines download raw bytes

1customElements.get("product-info")||customElements.define("product-info",class extends HTMLElement{abortController=void 0;onVariantChangeUnsubscriber=void 0;pendingRequestUrl=null;preProcessHtmlCallbacks=[];postProcessHtmlCallbacks=[];cartUpdateUnsubscriber=void 0;constructor(){super(),this.hasUserInteracted=!1}get variantSelectors(){return this.querySelector("variant-selects")}get productId(){return this.getAttribute("data-product-id")}get sectionId(){return this.dataset.originalSection||this.dataset.section}get pickupAvailability(){return this.querySelector("pickup-availability")}get productForm(){return this.querySelector('form[is="product-form"]')}get quantityInput(){return this.querySelector("quantity-input input")}get productOptions(){if(!this._productOptions){const optionsScript=this.querySelector("[data-product-options]");if(optionsScript)try{const data=JSON.parse(optionsScript.textContent);this._productOptions=data.product}catch(e){console.error("Error parsing product options:",e),this._productOptions=null}else this._productOptions=null}return this._productOptions}connectedCallback(){this.initializeProductSwapUtility(),this.onVariantChangeUnsubscriber=FoxTheme.pubsub.subscribe(FoxTheme.pubsub.PUB_SUB_EVENTS.optionValueSelectionChange,this.handleOptionValueChange.bind(this)),this.initQuantityHandlers(),this.makeAllVariantsAvailable(),this.currentVariant=this.getSelectedVariant(this),this.currentVariant&&this.updateMedia(this.currentVariant),requestAnimationFrame(()=>{this.updateAllSwatchValueDisplays(),this.checkIfAllOptionsSelected()?this.toggleAddButton(!1,FoxTheme.variantStrings.addToCart):this.toggleAddButton(!0,this.getMissingOptionMessage())})}disconnectedCallback(){this.onVariantChangeUnsubscriber(),this.cartUpdateUnsubscriber?.()}initializeProductSwapUtility(){this.postProcessHtmlCallbacks.push(newNode=>{window?.Shopify?.PaymentButton?.init(),window?.ProductModel?.loadShopifyXR()})}handleOptionValueChange({data:{event,target,selectedOptionValue}}){if(!this.contains(event.target))return;this.hasUserInteracted=!0;const productUrl=target.dataset.productUrl||this.pendingRequestUrl||this.dataset.url,shouldSwapProduct=this.dataset.url!==productUrl;this.renderProductInfoDynamic(selectedOptionValue)}handleSwapProduct(updateFullPage,viewMode){return html=>{const quickView=html.querySelector("#MainProduct-quick-view__content");quickView&&viewMode==="quick-view"&&(html=quickView.content.cloneNode(!0));const selector=updateFullPage?"product-info[id^='MainProduct']":"product-info",variant=this.getSelectedVariant(html.querySelector(selector));if(updateFullPage){if(document.querySelector("head title").innerHTML=html.querySelector("head title").innerHTML,HTMLUpdateUtility.viewTransition(document.querySelector("main"),html.querySelector("main"),this.preProcessHtmlCallbacks,this.postProcessHtmlCallbacks),HTMLUpdateUtility.viewTransition(document.getElementById("shopify-section-sticky-atc-bar"),html.getElementById("shopify-section-sticky-atc-bar"),this.preProcessHtmlCallbacks,this.postProcessHtmlCallbacks),!variant){this.checkIfAllOptionsSelected()?this.setUnavailable():this.toggleAddButton(!0,this.getMissingOptionMessage());return}}else HTMLUpdateUtility.viewTransition(this,html.querySelector("product-info"),this.preProcessHtmlCallbacks,this.postProcessHtmlCallbacks);this.currentVariant=variant}}handleUpdateProductInfo(viewMode){return html=>{const quickView=html.querySelector("#MainProduct-quick-view__content");quickView&&viewMode==="quick-view"&&(html=quickView.content.cloneNode(!0));const variant=this.getSelectedVariant(html);if(this.pickupAvailability?.update(variant),this.updateOptionValues(html),this.updateShareUrl(variant?.id),this.updateVariantInputs(variant?.id),!variant){this.checkIfAllOptionsSelected()?this.setUnavailable():this.toggleAddButton(!0,this.getMissingOptionMessage());return}this.updateMedia(variant);const updateSourceFromDestination=(id,shouldHide=source=>!1)=>{const source=html.getElementById(`${id}-${this.sectionId}`),destination=this.querySelector(`#${id}-${this.dataset.section}`);source&&destination&&(destination.innerHTML=source.innerHTML,destination.classList.toggle("hidden",shouldHide(source)))};updateSourceFromDestination("price"),updateSourceFromDestination("price-mobile"),updateSourceFromDestination("Sku"),updateSourceFromDestination("Inventory"),updateSourceFromDestination("Badges"),updateSourceFromDestination("PricePerItem"),updateSourceFromDestination("Volume"),this.updateQuantityRules(this.sectionId,this.productId,html),updateSourceFromDestination("QuantityRules"),updateSourceFromDestination("VolumeNote"),HTMLUpdateUtility.viewTransition(document.querySelector(`#SizeChart-${this.sectionId}`),html.querySelector(`#SizeChart-${this.sectionId}`),this.preProcessHtmlCallbacks,this.postProcessHtmlCallbacks);const addButtonUpdated=html.getElementById(`ProductSubmitButton-${this.sectionId}`);this.checkIfAllOptionsSelected()?variant.available?this.toggleAddButton(!1,FoxTheme.variantStrings.addToCart):this.toggleAddButton(!0,FoxTheme.variantStrings.soldOut):this.toggleAddButton(!0,this.getMissingOptionMessage());const stickyAtcBar=document.getElementById("shopify-section-sticky-atc-bar");stickyAtcBar&&stickyAtcBar.classList.remove("hidden"),FoxTheme.pubsub.publish(FoxTheme.pubsub.PUB_SUB_EVENTS.variantChange,{data:{sectionId:this.sectionId,html,variant}}
1),document.dispatchEvent(new CustomEvent("variant:changed",{detail:{variant}}))}}buildRequestUrlWithParams(url,optionValues,shouldFetchFullPage=!1){const params=[];return!shouldFetchFullPage&&params.push(`section_id=${this.sectionId}`),optionValues.length&&params.push(`option_values=${optionValues.join(",")}`),`${url}?${params.join("&")}`}getSelectedVariant(productInfoNode){const selectedVariant=productInfoNode.querySelector("variant-selects [data-selected-variant]")?.innerHTML;if(!selectedVariant||selectedVariant.trim()===""||selectedVariant.trim()==="null")return null;try{const parsed=JSON.parse(selectedVariant);return parsed&&typeof parsed=="object"?parsed:null}catch(e){return console.error("Error parsing variant:",e),null}}renderProductInfoDynamic(selectedOptionValue){const productOptions=this.productOptions,selectedInputs=this.checkIfAnyInputSelected();selectedInputs.some(input=>input.value!==null)?this.updateInputAvailability(selectedInputs):(this.cleanAllSelectedElements(),this.makeAllVariantsDisabled())}cleanAllSelectedElements(){this.variantSelectors.querySelectorAll('input[type="radio"].disabled:not([id*="nested"])').forEach(input=>{input.checked=!1,input.classList.remove("disabled")}),this.variantSelectors.querySelectorAll('[data-selected-swatch-value]:not([data-selected-swatch-value="Color"])').forEach(span=>{span.innerHTML=""})}updateInputAvailability(selectedInputs){if(!this.productOptions||!this.productOptions.variants)return;const availableValuesByPosition={};[1,2,3].forEach(targetPosition=>{availableValuesByPosition[targetPosition]=new Set,this.productOptions.variants.filter(variant=>selectedInputs.every(selected=>selected.value===null||selected.position===targetPosition?!0:variant[`option${selected.position}`]===selected.value)).forEach(variant=>{const optionKey=`option${targetPosition}`,value=variant[optionKey];value&&variant.available&&availableValuesByPosition[targetPosition].add(value)})}),selectedInputs.forEach(selected=>{const option=this.productOptions.options.find(o=>o.position===selected.position);if(option){const swatchValueSpan=this.variantSelectors.querySelector(`[data-selected-swatch-value="${option.name}"]`);swatchValueSpan&&(selected.value!==null?swatchValueSpan.textContent=selected.value:swatchValueSpan.textContent="")}}),this.variantSelectors.querySelectorAll('input[type="radio"]:not([id*="nested"])').forEach(radio=>{const optionPosition=this.getOptionPositionForInput(radio);if(optionPosition){const availableValues=availableValuesByPosition[optionPosition],isAvailable=availableValues&&availableValues.has(radio.value);isAvailable?radio.classList.remove("disabled"):radio.classList.add("disabled");const label=radio.closest("label");label&&(isAvailable?(label.classList.remove("unavailable","disabled"),label.removeAttribute("data-sold-out")):(label.classList.add("unavailable","disabled"),label.setAttribute("data-sold-out","true")))}}),this.variantSelectors.querySelectorAll("select").forEach(select=>{const optionPosition=this.getOptionPositionForInput(select);if(optionPosition){const availableValues=availableValuesByPosition[optionPosition];Array.from(select.options).forEach(option=>{option.value&&(availableValues&&availableValues.has(option.value)?option.classList.remove("unavailable","disabled"):option.classList.add("unavailable","disabled"))})}}),this.updateAddToCartButton(selectedInputs)}updateAddToCartButton(selectedInputs){const allOptionsSelected=selectedInputs.every(input=>input.value!==null),partialMatchingVariant=this.productOptions.variants.find(variant=>selectedInputs.every(selected=>selected.value===null?!0:variant[`option${selected.position}`]===selected.value));if(partialMatchingVariant&&(this.updateMedia(partialMatchingVariant),this.updateShareUrl(partialMatchingVariant.id)),!allOptionsSelected){this.updateVariantIdInput(null,!0),this.toggleAddButton(!0,this.getMissingOptionMessage()),this.currentVariant=null;return}const matchingVariant=this.productOptions.variants.find(variant=>selectedInputs.every(selected=>variant[`option${selected.position}`]===selected.value));
1if(!matchingVariant){this.updateVariantIdInput(null,!0),this.toggleAddButton(!0,FoxTheme.variantStrings.unavailable||"Unavailable"),this.currentVariant=null;return}if(this.currentVariant=matchingVariant,this.updateMedia(matchingVariant),this.updateShareUrl(matchingVariant.id),this.pickupAvailability?.update(matchingVariant),!matchingVariant.available){this.updateVariantIdInput(matchingVariant.id,!0),this.toggleAddButton(!0,FoxTheme.variantStrings.soldOut||"Sold out");return}this.updateVariantIdInput(matchingVariant.id,!1),this.toggleAddButton(!1),FoxTheme.pubsub.publish(FoxTheme.pubsub.PUB_SUB_EVENTS.variantChange,{data:{sectionId:this.sectionId,html:null,variant:matchingVariant}}),document.dispatchEvent(new CustomEvent("variant:changed",{detail:{variant:matchingVariant}}))}updateVariantIdInput(variantId,disabled){this.querySelectorAll("input.product-variant-id").forEach(input=>{variantId?input.value=variantId:input.value="",disabled?input.setAttribute("disabled","disabled"):input.removeAttribute("disabled")})}getOptionPositionForInput(input){if(!this.productOptions||!this.productOptions.options)return null;for(let i=0;i<this.productOptions.options.length;i++){const option=this.productOptions.options[i];if(input.type==="radio"&&option.values.includes(input.value)||input.tagName==="SELECT"&&Array.from(input.options).some(opt=>option.values.includes(opt.value)))return option.position}return null}checkIfAnyInputSelected(){if(!this.variantSelectors)return{hasSelection:!1,selected:[]};const selectedInputs=[];return this.variantSelectors.querySelectorAll('input[type="radio"]:checked:not([id*="nested"])').forEach(radio=>{selectedInputs.push({type:"radio",name:radio.name,value:radio.value,element:radio})}),this.variantSelectors.querySelectorAll("select").forEach(select=>{select.value&&select.value!==""&&selectedInputs.push({type:"select",name:select.name,value:select.value,selectedOption:select.selectedOptions[0]?.textContent,element:select})}),this.variantSelectors.querySelectorAll('input[type="checkbox"]:checked').forEach(checkbox=>{selectedInputs.push({type:"checkbox",name:checkbox.name,value:checkbox.value,element:checkbox})}),this.productOptions.options.map((o,i)=>{const matched=o.values.find(v=>selectedInputs.some(s=>s.value===v));return{position:i+1,name:o.name,value:matched||null}})}renderProductInfo({requestUrl,targetId,callback}){this.abortController?.abort(),this.abortController=new AbortController,fetch(requestUrl,{signal:this.abortController.signal}).then(response=>response.text()).then(responseText=>{this.pendingRequestUrl=null;const html=new DOMParser().parseFromString(responseText,"text/html");callback(html)}).then(()=>{const option=document.querySelector(`#${targetId}`);option?.tagName==="OPTION"?option.parentElement?.focus():document.querySelector(`#${targetId}`)?.focus()}).catch(error=>{error.name==="AbortError"||console.error(error)})}checkIfAllOptionsSelected(){const allSelects=this.variantSelectors.querySelectorAll("select"),allFieldsets=this.variantSelectors.querySelectorAll("fieldset");for(const select of allSelects)if(!select.selectedOptions[0]||select.selectedOptions[0].value==="")return!1;for(const fieldset of allFieldsets)if(!fieldset.querySelector("input:checked"))return!1;return!0}checkIfAnyOptionsSelected(){const allSelects=this.variantSelectors.querySelectorAll("select"),allFieldsets=this.variantSelectors.querySelectorAll("fieldset");for(const select of allSelects)if(select.selectedOptions[0]&&select.selectedOptions[0].value!=="")return!0;for(const fieldset of allFieldsets)if(fieldset.querySelector("input:checked"))return!0;return!1}getMissingOptionMessage(){const selects=this.variantSelectors.querySelectorAll("select");for(const select of selects)if(!select.selectedOptions[0]||select.selectedOptions[0].value===""){let optionName=select.name||select.closest(".product-form__input")?.querySelector("label, .form__label")?.childNodes[0]?.textContent?.trim();return optionName=optionName?.replace(/[-_]\d+/g,"").trim(),`Choose ${optionName||"Options"}`}const fieldsets=this.variantSelectors.querySelectorAll("fieldset");for(const fieldset of fieldsets)if(!fieldset.querySelector("input:checked")){let optionName=fieldset.querySelector("input")?.name||fieldset.querySelector("legend")?.childNodes[0]?.textContent?.trim()?.replace("*","").trim();return optionName=optionName?.replace(/[-_]\d+/g,"").trim(),`Choose ${optionName||"Options"}`}return"Choose Options"}updateSelectedSwatchValue({target}){const{value,tagName}=target;if(tagName==="SELECT"&&target.selectedOptions.length){Array.from(target.options).find(option=>option.getAttribute("selected"))?.removeAttribute("selected"),target.selectedOptions[0].setAttribute("selected","selected");const swatchValue=target.selectedOptions[0].dataset.optionSwatchValue,selectedDropdownSwatchValue=target.closest(".product-form__input").querySelector("[data-selected-value] > .swatch");if(!selectedDropdownSwatchValue)return;swatchValue?(selectedDropdownSwatchValue.style.setProperty("--swatch--background",swatchValue),selectedDropdownSwatchValue.classList.remove("swatch--unavailable")):(selectedDropdownSwatchValue.style.setProperty("--swatch--background","unset"),selectedDropdownSwatchValue.classList.add("swatch--unavailable")),selectedDropdownSwatchValue.style.setProperty("--swatch-focal-point",target.selectedOptions[0].dataset.optionSwatchFocalPoint||"unset");const selectedValueDisplay=target.closest(".product-form__input").querySelector("[data-selected-value]");if(selectedValueDisplay){const selectedOption=target.selectedOptions[0],colorName=this.getColorDisplayValue(selectedOption);selectedValueDisplay.textContent=colorName||selectedOption.textContent}}else if(tagName==="INPUT"&&target.type==="radio"){const selectedSwatchValue=target.closest(".product-form__input").querySelector("[data-selected-swatch-value]");if(selectedSwatchValue){const colorName=this.getColorDisplayValue(target);selectedSwatchValue.innerHTML=colorName||value}}}getColorDisplayValue(element){if(!element)return null;if(element.hasAttribute("data-product-value"))return element.getAttribute("data-product-value");const label=element.closest("label")||element.closest(".product-form__input")?.querySelector(`label[for="${element.i
1d}"]`);return element.hasAttribute("data-option-swatch-value")||label?.querySelector(".swatch, .swatch-color, .tooltip")||label?.hasAttribute("data-swatch-type")||element.closest("fieldset")?.hasAttribute("data-color")||element.name?.toLowerCase().includes("color")?element.getAttribute("data-color-name")||label?.querySelector(".tooltip")?.textContent?.trim()||label?.getAttribute("data-value")||this.getCleanLabelText(label)||(this.isValidColorName(element.value)?element.value:null):null}getCleanLabelText(label){if(!label)return null;const text=label.textContent.trim(),swatch=label.querySelector(".swatch, .swatch-color");return swatch?text.replace(swatch.textContent||"","").trim()||null:text}isValidColorName(text){return text&&!/^\d+$/.test(text.trim())&&text.trim().length<50}makeAllVariantsAvailable(){if(!this.productOptions?.options||this.productOptions.options.length<=1)return;const currentSelections=this.getCurrentUserSelections();(this.variantSelectors?.querySelectorAll("select")||[]).forEach(select=>{Array.from(select.options).forEach(option=>{option.disabled=!1,option.setAttribute("data-available","true"),option.classList.remove("disabled","sold-out","unavailable")})}),(this.variantSelectors?.querySelectorAll('input[type="radio"]')||[]).forEach(input=>{input.disabled=!1,input.setAttribute("data-available","true"),input.classList.remove("disabled","sold-out","unavailable");const label=input.closest("label")||input.closest(".product-form__input")?.querySelector(`label[for="${input.id}"]`);label&&(label.classList.remove("disabled","sold-out","unavailable"),label.removeAttribute("data-sold-out"))}),this.restoreUserSelections(currentSelections),this.preservePreSelectedOptions()}makeAllVariantsDisabled(){if(!this.productOptions?.options||this.productOptions.options.length!==1||!this.productOptions.variants.every(variant=>!variant.available))return;(this.variantSelectors?.querySelectorAll("select")||[]).forEach(select=>{select.closest("[data-swatch-type]")||select.closest('[data-color="true"]')||Array.from(select.options).forEach(option=>{option.disabled=!0,option.setAttribute("data-available","false"),option.classList.add("disabled","unavailable")})}),(this.variantSelectors?.querySelectorAll('input[type="radio"]')||[]).forEach(input=>{if(input.closest("[data-swatch-type]")||input.closest('[data-color="true"]')||input.classList.contains("swatch-input__input"))return;input.disabled=!0,input.setAttribute("data-available","false"),input.classList.add("disabled","unavailable");const label=input.closest("label")||input.closest(".product-form__input")?.querySelector(`label[for="${input.id}"]`);label&&label.classList.add("disabled","unavailable")})}preservePreSelectedOptions(){(this.variantSelectors?.querySelectorAll("option[selected]")||[]).forEach(option=>{option.parentElement&&option.parentElement.tagName==="SELECT"&&(option.parentElement.value=option.value)}),(this.variantSelectors?.querySelectorAll('input[type="radio"][checked]')||[]).forEach(radio=>{radio.checked=!0}),this.updateAllSwatchValueDisplays()}updateOptionValues(html,skipAvailabilityUpdate=!1){const variantSelects=html.querySelector("variant-selects");if(variantSelects){const newSelectedVariantScript=html.querySelector("variant-selects [data-selected-variant]"),currentSelectedVariantScript=this.variantSelectors.querySelector("[data-selected-variant]");newSelectedVariantScript&&currentSelectedVariantScript&&(currentSelectedVariantScript.innerHTML=newSelectedVariantScript.innerHTML),skipAvailabilityUpdate||this.updateOptionAvailability(variantSelects)}}updateOptionAvailability(newVariantSelects){if(!this.hasUserInteracted)return;const currentSelections=this.getCurrentUserSelections(),currentSelects=this.variantSelectors.querySelectorAll("select"),newSelects=newVariantSelects.querySelectorAll("select");currentSelects.forEach((currentSelect,index)=>{const newSelect=newSelects[index];newSelect&&Array.from(currentSelect.options).forEach((currentOption,optionIndex)=>{const newOption=newSelect.options[optionIndex];newOption&&(currentOption.disabled=newOption.disabled,["data-available","data-option-swatch-value","data-option-swatch-focal-point"].forEach(attr=>{newOption.hasAttribute(attr)?currentOption.setAttribute(attr,newOption.getAttribute(attr)):currentOption.removeAttribute(attr)}),currentOption.className=newOption.className)})});const currentFieldsets=this.variantSelectors.querySelectorAll("fieldset"),newFieldsets=newVariantSelects.querySelectorAll("fieldset");
1currentFieldsets.forEach((currentFieldset,index)=>{const newFieldset=newFieldsets[index];if(!newFieldset)return;const currentInputs=currentFieldset.querySelectorAll('input[type="radio"]'),newInputs=newFieldset.querySelectorAll('input[type="radio"]');currentInputs.forEach((currentInput,inputIndex)=>{const newInput=newInputs[inputIndex];if(newInput){currentInput.disabled=newInput.disabled,["data-available","data-option-swatch-value","data-option-swatch-focal-point"].forEach(attr=>{newInput.hasAttribute(attr)?currentInput.setAttribute(attr,newInput.getAttribute(attr)):currentInput.removeAttribute(attr)}),currentInput.className=newInput.className;const currentLabel=currentInput.closest("label")||currentFieldset.querySelector(`label[for="${currentInput.id}"]`),newLabel=newInput.closest("label")||newFieldset.querySelector(`label[for="${newInput.id}"]`);if(currentLabel&&newLabel){currentLabel.className=newLabel.className;const currentSwatch=currentLabel.querySelector(".swatch"),newSwatch=newLabel.querySelector(".swatch");currentSwatch&&newSwatch&&(currentSwatch.className=newSwatch.className,currentSwatch.style.cssText=newSwatch.style.cssText,Array.from(newSwatch.attributes).forEach(attr=>{attr.name.startsWith("data-")&&currentSwatch.setAttribute(attr.name,attr.value)}));const currentSpans=currentLabel.querySelectorAll("span:not(.swatch)"),newSpans=newLabel.querySelectorAll("span:not(.swatch)");currentSpans.forEach((currentSpan,spanIndex)=>{const newSpan=newSpans[spanIndex];newSpan&&(currentSpan.className=newSpan.className,currentSpan.textContent=newSpan.textContent)})}}})}),this.restoreUserSelections(currentSelections),this.updateAllSwatchValueDisplays()}getCurrentUserSelections(){const selections={};return this.variantSelectors.querySelectorAll("select").forEach((select,index)=>{select.value&&select.value!==""&&(selections[`select_${index}`]=select.value)}),this.variantSelectors.querySelectorAll("fieldset").forEach((fieldset,index)=>{const checkedInput=fieldset.querySelector("input:checked");checkedInput&&(selections[`fieldset_${index}`]=checkedInput.value)}),selections}restoreUserSelections(selections){this.variantSelectors.querySelectorAll("select").forEach((select,index)=>{const savedValue=selections[`select_${index}`];if(savedValue){const targetOption=select.querySelector(`option[value="${savedValue}"]`);targetOption&&!targetOption.disabled&&(select.value=savedValue,targetOption.setAttribute("selected","selected"),this.updateSelectedSwatchValue({target:select}))}}),this.variantSelectors.querySelectorAll("fieldset").forEach((fieldset,index)=>{const savedValue=selections[`fieldset_${index}`];if(savedValue){const targetInput=fieldset.querySelector(`input[value="${savedValue}"]`);targetInput&&!targetInput.disabled&&(targetInput.checked=!0,this.updateSelectedSwatchValue({target:targetInput}))}})}updateAllSwatchValueDisplays(){this.variantSelectors.querySelectorAll("select").forEach(select=>{select.value&&select.value!==""&&this.updateSelectedSwatchValue({target:select})}),this.variantSelectors.querySelectorAll('input[type="radio"]:checked').forEach(radio=>{this.updateSelectedSwatchValue({target:radio})}),this.variantSelectors.querySelectorAll("[data-selected-swatch-value]").forEach(element=>{const parentInput=element.closest(".product-form__input");if(parentInput){const checkedRadio=parentInput.querySelector('input[type="radio"]:checked');if(checkedRadio){const colorName=this.getColorDisplayValue(checkedRadio);element.innerHTML=colorName||checkedRadio.value}}}),this.variantSelectors.querySelectorAll("[data-selected-value]").forEach(element=>{const parentInput=element.closest(".product-form__input");if(parentInput){const select=parentInput.querySelector("select");if(select&&select.selectedOptions.length){const selectedOption=select.selectedOptions[0],colorName=this.getColorDisplayValue(selectedOption);element.textContent=colorName||selectedOption.textContent}}})}updateVariantInputs(variantId){document.querySelectorAll(`#product-form-${this.dataset.section}, #product-form-installment-${this.dataset.section}`).forEach(productForm=>{const input=productForm.querySelector('input[name="id"]');input.value=variantId??"",input.dispatchEvent(new Event("change",{bubbles:!0}))})}updateMedia(variant){if(!variant)return;const productMedia=this.querySelector(`[id^="MediaGallery-${this.dataset.section}"]`)||document.querySelector(`[id^="MediaGallery-${this.dataset.section}"]`)||document.querySelector('[id^="MediaGallery"]');if(!productMedia)return;const setActiveMedia=()=>
1{if(typeof productMedia.setActiveMedia=="function")try{return productMedia.init(),productMedia.setActiveMedia(variant),!0}catch(error){return console.error("Error setting active media:",error),!1}return!1};setActiveMedia()||(this.timer&&clearInterval(this.timer),this.timer=setInterval(()=>{setActiveMedia()&&clearInterval(this.timer)},100))}updateShareUrl(variantId){if(!variantId)return;const shareButton=document.getElementById(`ProductShare-${this.dataset.section}`);!shareButton||!shareButton.updateUrl||shareButton.updateUrl(`${window.shopUrl}${this.dataset.url}?variant=${variantId}`)}toggleAddButton(disable=!0,text,modifyClass=!0){const productForm=document.getElementById(`product-form-${this.dataset.section}`);if(!productForm)return;const addButton=productForm.querySelector('[name="add"]'),addButtonText=productForm.querySelector('[name="add"] > span');addButton&&(disable?(addButton.setAttribute("disabled","disabled"),text&&(addButtonText.textContent=this.decoded(text))):(addButton.removeAttribute("disabled"),addButtonText.textContent=this.decoded(FoxTheme.variantStrings.addToCart)))}decoded(text){const tempDiv=document.createElement("div");return tempDiv.innerHTML=text,tempDiv.textContent}setUnavailable(){this.toggleAddButton(!0,FoxTheme.variantStrings.unavailable);const price=document.getElementById(`price-${this.dataset.section}`),inventory=document.getElementById(`Inventory-${this.dataset.section}`),sku=document.getElementById(`Sku-${this.dataset.section}`),volumePricing=document.getElementById(`Volume-${this.dataset.section}`),stickyAtcBar=document.getElementById("shopify-section-sticky-atc-bar");price&&price.classList.add("hidden"),inventory&&inventory.classList.add("hidden"),sku&&sku.classList.add("hidden"),volumePricing&&volumePricing.classList.add("hidden"),stickyAtcBar&&stickyAtcBar.classList.add("hidden")}initQuantityHandlers(){this.quantityInput&&(this.setQuantityBoundries(),this.hasAttribute("data-original-section")||(this.cartUpdateUnsubscriber=FoxTheme.pubsub.subscribe(FoxTheme.pubsub.PUB_SUB_EVENTS.cartUpdate,this.fetchQuantityRules.bind(this))))}setQuantityBoundries(){FoxTheme.pubsub.publish(FoxTheme.pubsub.PUB_SUB_EVENTS.quantityBoundries,{data:{sectionId:this.sectionId,productId:this.productId}})}fetchQuantityRules(){const currentVariantId=this.productForm?.productIdInput?.value;currentVariantId&&(this.querySelector(".quantity__rules-cart")?.classList.add("btn--loading"),fetch(`${this.getAttribute("data-url")}?variant=${currentVariantId}&section_id=${this.sectionId}`).then(response=>response.text()).then(responseText=>{const parsedHTML=new DOMParser().parseFromString(responseText,"text/html");this.updateQuantityRules(this.sectionId,this.productId,parsedHTML)}).catch(error=>{console.error(error)}).finally(()=>{this.querySelector(".quantity__rules-cart")?.classList.remove("btn--loading")}))}updateQuantityRules(sectionId,productId,parsedHTML){this.quantityInput&&(FoxTheme.pubsub.publish(FoxTheme.pubsub.PUB_SUB_EVENTS.quantityRules,{data:{sectionId,productId,parsedHTML}}),this.setQuantityBoundries())}});
2//# sourceMappingURL=/cdn/shop/t/1072/assets/product-info.js.map?v=8431554815024105161789034711

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.