1(()=>{var __webpack_exports__={};class ProductSwatch extends HTMLElement{constructor(){super(),this.onSwatchChangeBound=this.onSwatchChange.bind(this),this.onColorSwatchMouseEnterBound=this.onColorSwatchMouseEnter.bind(this),this.onSwatchMouseLeaveBound=this.onSwatchMouseLeave.bind(this)}connectedCallback(){this.colorLabel=this.querySelector("[data-color-swatch-name]"),this.colorLabelState=this.querySelector("[data-color-swatch-state]"),this.soldOutString=this.getAttribute("data-swatch-sold-out-string"),this.colorSwatches=this.querySelectorAll(".swatch-element.color"),this.sectionId=this.getAttribute("data-section-id"),this.setEventListeners(),this.setColorLabelState()}setEventListeners(){this.colorSwatches.forEach(swatch=>{swatch.addEventListener("mouseenter",this.onColorSwatchMouseEnterBound),swatch.addEventListener("mouseleave",this.onSwatchMouseLeaveBound)}),this.addEventListener("change",this.onSwatchChangeBound)}setColorLabelState(){const activeSwatch=this.querySelector(".swatch-element.color.active");if(!activeSwatch)return;const activeSwatchAvailable=activeSwatch.getAttribute("data-swatch-option-available");!this.soldOutString||!this.colorLabelState||this.updateColorLabelState(activeSwatchAvailable)}updateColorLabelState(available){this.colorLabelState&&(this.colorLabelState.innerText=available==="false"?`(${this.soldOutString})`:"")}onSwatchChange(event){const input=event.target,currentVariant=this.getVariantData(input.id),productUrl=input.getAttribute("data-product-url"),productFetchUrl=input.getAttribute("data-product-fetch-url"),isCombinedListing=input.getAttribute("data-is-combined-listing")==="true";this.swapMediaBasedOnSku(currentVariant.sku),this.emitVariantChangeEvent(currentVariant,productFetchUrl,productUrl,isCombinedListing)}swapMediaBasedOnSku(variantSKU){const matchingClass="sku_"+variantSKU;document.querySelectorAll(".thumbnail-media.swiper-thumbs .swiper-slide").forEach(thumb=>{thumb.classList.contains(matchingClass)?thumb.classList.remove("thumb__hidden"):thumb.classList.add("thumb__hidden")})}emitVariantChangeEvent(variant,productFetchUrl,productUrl,isCombinedListing=!1){eventBus.emit("variant:change",{sectionId:this.sectionId,variant,fetchURL:productFetchUrl,productURL:productUrl,isCombinedListing})}onColorSwatchMouseEnter(event){this.updateColorLabel(event.currentTarget);const activeSwatch=this.querySelector(".swatch-element.color.active");activeSwatch&&!event.currentTarget.classList.contains("active")&&activeSwatch.classList.add("sibling-hover-active")}onSwatchMouseLeave(){const siblingHoverActiveSwatch=this.querySelector(".swatch-element.sibling-hover-active");siblingHoverActiveSwatch&&siblingHoverActiveSwatch.classList.remove("sibling-hover-active"),this.resetColorLabel()}updateColorLabel=swatch=>{if(!swatch)return;const label=swatch.getAttribute("data-value"),swatchAvailable=swatch.getAttribute("data-swatch-option-available");!label||!this.colorLabel||(this.colorLabel.textContent=label,this.updateColorLabelState(swatchAvailable))};resetColorLabel=()=>{const activeSwatch=this.querySelector(".swatch-element.color.active");if(!activeSwatch||!this.colorLabel)return;const activeSwatchValue=activeSwatch.getAttribute("data-value"),swatchAvailable=activeSwatch.getAttribute("data-swatch-option-available");activeSwatchValue&&(this.colorLabel.textContent=activeSwatchValue,this.updateColorLabelState(swatchAvailable))};removeEventListeners(){this.colorSwatches.forEach(swatch=>{swatch.removeEventListener("mouseenter",this.onColorSwatchMouseEnterBound),swatch.removeEventListener("mouseleave",this.onSwatchMouseLeaveBound)}),this.removeEventListener("change",this.onSwatchChangeBound)}getVariantData(inputId){return JSON.parse(this.getVariantDataElement(inputId).textContent)}getVariantDataElement(inputId){return this.querySelector(`script[type="application/json"][data-resource="${inputId}"]`)}disconnectedCallback(){this.removeEventListeners()}}window.customElements.get("product-swatch")||window.customElements.define("product-swatch",ProductSwatch)})(); 2//# sourceMappingURL=/cdn/shop/t/3/assets/component-product-swatch.js.map?v=144852394744481645361746620679
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.