PageSourceSearch

https://www.eileenfisherrenew.com/cdn/shop/t/221/assets/product-la…?v=57271764386473572971788891150

js eileenfisherrenew.com collected 2026-09-25 04:24:16 UTC 20,244 bytes, 2 lines download raw bytes

1class Variants{constructor(){this.data=[],this.variants=Object.create(null),this.properties=[],this.selectors=[],this.filters=[],this.product=null,window.addEventListener("register-variant-property",this.registerVariantProperty.bind(this)),window.dispatchEvent(new Event("get-variant-properties"))}registerVariantProperty(event){this.properties.includes(event.detail.property)==!1&&this.properties.push(event.detail.property),this.selectors.includes(event.detail.element)==!1&&this.selectors.push(event.detail.element)}getSelector(property){const selector=this.selectors.find(element=>element.property==property);return selector||!1}getSelectors(){return this.selectors}setData(data,unavailableVariants=[]){if(!data||!data?.availableVariants?.length&&!unavailableVariants?.length)return;this.data=data.availableVariants||[],this.variants=Object.create(null),this.data.forEach(element=>{const remainingProperties=new Set(this.properties);for(let parent in element.variant_data)this.setVariantData(parent,element.variant_data),remainingProperties.delete(parent);const parentOptionProps=new Map(Object.keys(element.parent_options).map(parent=>{const prop=parent.replace("Display","");return remainingProperties.delete(prop),[prop,parent]}));remainingProperties.forEach(prop=>{parentOptionProps.set(prop,null)}
1),parentOptionProps.forEach((originalProp,prop)=>{const value=(originalProp===null?null:element.parent_options[originalProp])||"NA",propertyData={[prop]:{code:value,display:value,thumbnail:element.thumbnailImageUrl,rank:0}};element.handle&&(propertyData[prop].staticHandle=element.handle,propertyData[prop].dynamicHandle=element.handle),this.setVariantData(prop,propertyData),element.variant_data[prop]=propertyData[prop]})}),(unavailableVariants||[]).forEach(colorway=>{this.setVariantData("color",{color:{code:colorway.colorDisplay,display:colorway.colorDisplay,thumbnail:colorway.thumbnailImageUrl,rank:colorway.rank,dynamicHandle:colorway.handle,staticHandle:colorway.handle}})}),this.properties.filter(property=>this.variants[property]&&Object.keys(this.variants[property]).every(value=>value.toUpperCase()==="NA")).forEach(property=>{delete this.variants[property]}),this.properties=this.properties.filter(property=>this.variants[property]),this.selectors=this.selectors.filter(element=>this.variants[element.property]);const event=new CustomEvent("variants-ready");
1window.dispatchEvent(event)}setProduct(product,extraProperties){this.product={...product,...extraProperties}}setCurrentVariant(id){const params=new URLSearchParams(window.location.search),sizeParam=params.get("size"),variantParam=params.get("variant"),isSizePreSelected=!!(variantParam||sizeParam),filteredVariants=this.data.filter(({productId})=>productId.includes(id)),sortedVariants=this.sortVariants(filteredVariants);let variant;if(variantParam&&(variant=sortedVariants.find(({variantId})=>variantId.includes(variantParam))),!variant){const parameterFilters=[];this.properties.forEach(property=>{const value=params.get(property);value&&parameterFilters.push({property,value})});let variants=[];for(;parameterFilters.length!=0&&variants.length==0;){if(variants=sortedVariants.filter(({variant_data})=>parameterFilters.every(({property,value})=>property==="color"?this.hyphenate(variant_data[property].display)===value:variant_data[property].code===value)),variants.length){variant=variants[0];break}parameterFilters.pop()}}variant||(variant=sortedVariants.find(({productId})=>productId.includes(id)));const propertyList=Object.create(null);this.properties.forEach(property=>{propertyList[property]=variant?variant.variant_data[property].code:!1});for(let property in propertyList)if(propertyList[property]&&this.hasVariantData(property,propertyList[property])){if((property==="size"||property==="condition")&&!isSizePreSelected)continue;this.getSelector(property).setValue(propertyList[property]),this.setVariantOption(property,propertyList[property],!1)}window.dispatchEvent(new CustomEvent("price-update"))}getCurrentVariant(){if(this.filters.length!=this.selectors.length)return null;const[currentVariant]=this.getAvailableVariants(this.filters);return currentVariant}getVariantData(property,filters=!1,enabledOnly=!1){filters==!1&&(filters=this.filters);let selectable=this.getAvailableVariants(filters,property);Object.entries(this.variants).forEach(([key,value])=>{Object.entries(value).forEach(([key2,value2])=>{value2.enabled=!1})}),selectable.map(element=>{Object.entries(this.variants).forEach(([key,value])=>{const variant=element.variant_data[key];!variant||!variant.code||(this.variants[key][variant.code].enabled=!0,variant.dynamicHandle&&(this.variants[key][variant.code].dynamicHandle=variant.dynamicHandle))})});const variantData=this.variants[property]!==void 0?this.variants[property]:!1;let sortedData=[];return variantData&&(Object.entries(variantData).forEach(([key,value])=>{sortedData.push(value)}),sortedData.sort((a,b)=>a.rank<b.rank?-1:a.rank>b.rank?1:0)),enabledOnly===!0&&(sortedData=sortedData.filter(element=>element.enabled===!0)),sortedData}sortVariants(variants=[]){return variants.sort((a,b)=>{const aSizeRank=a.variant_data.size.rank,aConditionRank=a.variant_data.condition.rank,bSizeRank=b.variant_data.size.rank,bConditionRank=b.variant_data.condition.rank;return aSizeRank===bSizeRank?aConditionRank===bConditionRank?0:aConditionRank<bConditionRank?-1:1:aSizeRank<bSizeRank?-1:1})}hasVariantData(property,value){return this.variants[property]&&this.variants[property][value]}hyphenate(text){return text.trim().toLowerCase().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")}setVariantData(property,data){if(!this.properties.includes(property))return;const{code,display,thumbnail,rank,dynamicHandle,staticHandle}=data[property];if(this.variants[property]?.[code])return;const variant={value:code,label:display,thumbnail:thumbnail??!1,rank,enabled:!0};dynamicHandle&&(variant.dynamicHandle=dynamicHandle),staticHandle&&(variant.staticHandle=staticHandle),this.variants[property]=this.variants[property]||Object.create(null),this.variants[property][code]=variant}setVariantOption(property,value,redirect=!0){const currentVariant=this.getCurrentVariant();this.setFilter(property,value);let selectable=this.getAvailableVariants(this.filters);if(property=="color"){const color=this.getVariantData("color").find(element=>element.value==value);color&&(value=this.hyphenate(color.label))}if(value&&value.trim()!=""){let url=new URL(window.location);url.searchParams.set(property,value),window.history.replaceState(null,"",url.toString())}if(!selectable.length)return this.handleSelectableVariants(property,value,redirect,currentVariant);window.dispatchEvent(new CustomEvent("variants-updated",{detail:{property}})),window.dispatchEvent(new CustomEvent("price-update"))}getAvailableVariants(filters,property=!1){return this.data.filter(element=>{let match=!0;
1return filters.forEach(filter=>{if(property!=!1&&filter.property==property)return!0;if(!element.variant_data[filter.property])match=!1;else if(element.variant_data[filter.property].code?.toLowerCase()!==filter.value?.toLowerCase()){const filterLabel=this.variants[filter.property]?.[filter.value]?.label;(!filterLabel||element.variant_data[filter.property].display?.toLowerCase()!==filterLabel.toLowerCase())&&(match=!1)}}),match})}setFilter(property,value){let index=this.getFilterIndex(property);index!=-1&&this.filters.splice(index,1),this.filters.push({property,value})}getFilterIndex(property){return this.filters.findIndex(element=>element.property==property)}getFilter(property){let filter=this.filters.find(element=>element.property==property);return filter||!1}hasVariantOptionSelected(property){return!!this.filters.find(element=>element.property==property)}removeFilter(property){const index=this.getFilterIndex(property);index!==-1&&this.filters.splice(index,1);const url=new URL(window.location);url.searchParams.delete(property),window.history.replaceState(null,"",url.toString())}resolveConflict(property,value){this.setFilter(property,value);let selectable=this.getAvailableVariants(this.filters);const deselected=[];if(selectable.length===0){const candidates=this.filters.slice(0,-1).reverse();for(const filter of candidates)if(filter.property!==property){if(filter.property==="color"){const hsResult=this.handleSelectableVariants(property,value,!0,null);return hsResult?.adjusted&&deselected.push(...hsResult.adjusted),{deselected}}if(this.removeFilter(filter.property),deselected.push({property:filter.property,previousValue:filter.value}),selectable=this.getAvailableVariants(this.filters),selectable.length>0)break}}if(deselected.forEach(({property:prop})=>{const selector=this.getSelector(prop);selector?.deselect&&selector.deselect()}),property==="color"){const color=this.getVariantData("color").find(element=>element.value===value);if(color){const url=new URL(window.location);url.searchParams.set(property,this.hyphenate(color.label)),window.history.replaceState(null,"",url.toString())}}else if(value&&value.trim()!==""){const url=new URL(window.location);url.searchParams.set(property,value),window.history.replaceState(null,"",url.toString())}return window.dispatchEvent(new CustomEvent("variants-updated",{detail:{property}})),window.dispatchEvent(new CustomEvent("price-update")),{deselected}}handleVariantsRedirect(variants=[],variant){const filters=Array.from(this.filters);let validVariants=Array.from(variants);filters.shift();let validVariant=variant?JSON.parse(JSON.stringify(variant)):null;for(;filters.length!=0&&validVariants.length==0;){if(validVariants=this.getAvailableVariants(filters),validVariants.length>0){validVariant=validVariants[0];break}filters.shift()}if(!validVariant)return;let url=window.location.href.split("/");url[url.length-1]=validVariant.handle,url=url.join("/");const params=new URLSearchParams;filters.forEach(filter=>{params.set(filter.property,filter.value)}),url=`${url}?${params.toString()}`,history.replaceState(history.state,"",url),window.location.assign(url)}handleSelectableVariants(property,value,redirect,currentVariant){const currentColor=this.getFilter("color").value,validVariants=this.data.filter(({variant_data})=>{const propertyCode=variant_data[property].code,colorCode=variant_data.color.code;return propertyCode===value&&colorCode===currentColor}),sortedVariants=this.sortVariants(validVariants);if(!sortedVariants.length&&redirect)return this.handleVariantsRedirect();const[firstValidVariant]=sortedVariants,adjusted=[];return this.properties.forEach(property2=>{if(property2==="color")return;const propertyCode=firstValidVariant.variant_data[property2].code,prevFilter=this.getFilter(property2);prevFilter&&prevFilter.value!==propertyCode&&adjusted.push({property:property2,previousValue:prevFilter.value}),this.setFilter(property2,propertyCode),this.getSelector(property2).setValue(propertyCode)}),currentVariant&&currentVariant.handle!==firstValidVariant.handle&&redirect?this.handleVariantsRedirect(sortedVariants,firstValidVariant):(window.dispatchEvent(new CustomEvent("variants-updated",{detail:{property:"*"}})),window.dispatchEvent(new CustomEvent("price-update")),{adjusted})}}class VariantSelector extends HTMLElement{constructor(){super(),this.value=void 0,this.property="",this.unavailableTooltip=this.getAttribute("unavailable-tooltip")||null,this.unavailableTooltipMobile=this.getAttribute("unavailable-tooltip-mobile")||null,this.inlineMsg=null,window.addEventListener("variants-ready",this.render.bind(this)),window.addEventListener("variants-updated",this.updateOptions.bind(this)),window.addEventListener("variant-selected",this.updateSelected.bind(this)),window.addEventListener("price-update",this.updatePrice.bind(this)),window.addEventListener("get-variant-properties",()=>{const event=new CustomEvent("register-variant-property",{detail:{property:this.property,element:this}});window.dispatchEvent(event)})}render(event){}updateOptions(event){}updatePrice(event){const variant=window.variants.getCurrentVariant();if(!variant)return;const id=variant.variantId.split("/").slice(-1),productId=variant.productId.split("/").slice(-1);fetch(`${window.Shopify.routes.root}variants/${id}.js`).then(response=>{if(!response.ok)throw new Error(response);return response.json()}).then(response=>{const{price,compare_at_price:compareAtPrice}=response,formattedPrice=formatMoney(price);document.querySelectorAll(`.product__info-container .product__price #price-item-${productId}`).forEach(el=>{el.textContent=formattedPrice}),document.querySelectorAll(`.product__info-container .product__price #price-item-${productId}-screen-reader`).forEach(el=>{el.textContent=formattedPrice});let adjustedCompareAtPrice=window.variants.product.product_msrp_price??0;compareAtPrice&&(adjustedCompareAtPrice=compareAtPrice);const compareAtPriceElements=document.querySelectorAll(`.product__info-container .product__price #compare-at-price-item-${productId}`),formattedCompareAtPrice=formatMoney(adjustedCompareAtPrice),shouldShowCompareAtPrice=adjustedCompareAtPrice>price&&compareAtPriceElements.length;
1compareAtPriceElements.forEach(el=>{el.textContent=formattedCompareAtPrice}),document.querySelectorAll(`.product__info-container .product__price #compare-at-price-container-${productId}`).forEach(el=>el.classList.toggle("hidden",!shouldShowCompareAtPrice)),document.querySelectorAll(`.product__info-container .product__price #compare-at-price-tooltip-${productId}`).forEach(el=>el.classList.toggle("hidden",!shouldShowCompareAtPrice))}).catch(error=>{const{price_max,price_min}=window.variants.product;document.querySelectorAll(`.product__info-container .product__price #price-item-${productId}`).forEach(el=>{el.textContent=`${formatMoney(price_min)} - ${formatMoney(price_max)}`})})}updateSelected(event){}getProperty(){return this.property}getValue(){return this.value}setValue(value){this.value=value}deselect(){this.value=!1,this.displayValue=!1;const checked=this.querySelector(`[name*="${this.property}"]:checked`);checked&&(checked.checked=!1)}getOptionState(value){const option=window.variants.getVariantData(this.property).find(o=>o.value===value);return option?{available:option.enabled,softUnavailable:!option.enabled}:null}handleSoftUnavailableClick(value){window.variants.resolveConflict(this.property,value),this.setValue(value)}getSingleEnabledOption(){const enabled=window.variants.getVariantData(this.property).filter(o=>o.enabled);return enabled.length===1?enabled[0]:null}_varPickerGetDisplayValue(prop){if(prop===this.property&&this.displayValue)return this.displayValue;const selector=document.querySelector("color-variant-selector, size-variant-selector, condition-variant-selector, option-variant-selector, split-size-variant-selector"),selectors=document.querySelectorAll("color-variant-selector, size-variant-selector, condition-variant-selector, option-variant-selector, split-size-variant-selector");for(const sel of selectors)if(sel.property===prop&&sel.displayValue)return sel.displayValue;return null}buildComboUnavailableMessage(){const template=window.innerWidth<750&&this.unavailableTooltipMobile?this.unavailableTooltipMobile:this.unavailableTooltip||null;if(template){let msg=template;return["color","size","condition"].forEach(prop=>{const placeholder=`{${prop}}`;if(!msg.includes(placeholder))return;const val=this._varPickerGetDisplayValue(prop);val?msg=msg.replace(placeholder,`<strong>${val}</strong>`):msg=msg.replace(` + ${placeholder}`,"").replace(`${placeholder} + `,"").replace(placeholder,"")}),msg.trim()}const parts=["color","size","condition"].filter(p=>p!==this.property).map(p=>{const val=this._varPickerGetDisplayValue(p);return val?`<strong>${val}</strong>`:null}).filter(Boolean);return parts.length?`Not available in ${parts.join(" + ")}`:""}_showSnackbarWithMessage(msg,duration){let snackbar=document.getElementById("varpicker-snackbar");snackbar||(snackbar=document.createElement("div"),snackbar.id="varpicker-snackbar",snackbar.className="varpicker-snackbar",snackbar.setAttribute("role","status"),snackbar.setAttribute("aria-live","polite"),document.body.appendChild(snackbar)),snackbar._dismissTimer&&clearTimeout(snackbar._dismissTimer),snackbar.classList.remove("varpicker-snackbar--dismissing");const cfg=window.varPickerSnackbarSettings||{},align=cfg.verticalAlign||"center";snackbar.dataset.align=align,snackbar.style.width=cfg.width||"80%",snackbar.style.maxWidth=cfg.width||"80%",snackbar.style.height=cfg.height||"auto",snackbar.style.backgroundColor=cfg.bgColor||"#1a1a1a",snackbar.style.color=cfg.textColor||"#ffffff",snackbar.style.borderColor=cfg.borderColor||"transparent",snackbar.style.borderStyle=cfg.borderColor&&cfg.borderColor!=="transparent"?"solid":"none",snackbar.style.borderWidth="1px",snackbar.style.borderRadius=cfg.borderRadius||"8px",snackbar.innerHTML=msg,snackbar.classList.remove("varpicker-snackbar--visible"),snackbar.offsetWidth,snackbar.classList.add("varpicker-snackbar--visible"),snackbar._dismissTimer=setTimeout(()=>{snackbar.classList.add("varpicker-snackbar--dismissing"),snackbar.classList.remove("varpicker-snackbar--visible"),sessionStorage.removeItem("varpicker-snackbar-state"),setTimeout(()=>snackbar.classList.remove("varpicker-snackbar--dismissing"),700)},duration)}showVarPickerSnackbar(deferToPageLoad=!1){if(!this.enableSnackbar)return;const msg=this.buildComboUnavailableMessage();if(!msg)return;const duration=3500;sessionStorage.setItem("varpicker-snackbar-state",JSON.stringify({message:msg,shownAt:Date.now(),duration})),deferToPageLoad||this._showSnackbarWithMessage(msg,duration)}setupVarPickerHover(){if(!this.enableTooltip||this._varPickerHoverAttached)return;this._varPickerHoverAttached=!0;const getHoverTarget=e=>{const directLabel=e.target.closest("label");if(directLabel)return{label:directLabel,input:directLabel.previousElementSibling};const wrapper=e.target.closest(".product-form__input-wrapper");if(!wrapper)return null;const label=wrapper.querySelector("label"),input=wrapper.querySelector('input[type="radio"]');return!label||!input?null:{label,input}};this.wrapper.addEventListener("mouseover",e=>{const target=getHoverTarget(e);if(!target)return;const{label,input}=target;if(!input.classList.contains("soft-unavailable"))return;const msg=this.buildComboUnavailableMessage();if(!msg)return;let tip=document.querySelector(".varpicker-tooltip");tip||(tip=document.createElement("div"),tip.className="varpicker-tooltip",document.body.appendChild(tip)),tip.innerHTML=msg,tip.style.display="block";const rect=label.getBoundingClientRect();tip.style.left=`${rect.left+rect.width/2}px`,tip.style.top=`${rect.top-tip.offsetHeight-8}px`}),this.wrapper.addEventListener("mouseout",e=>{const target=getHoverTarget(e);if(!target||!target.input.classList.contains("soft-unavailable"))return;const tip=document.querySelector(".varpicker-tooltip");tip&&(tip.style.display="none")})}setupVarPickerTapMessage(){this.wrapper.addEventListener("click",e=>{const label=e.target.closest("label");if(!label)return;const clickedInput=document.getElementById(label.htmlFor);if(!clickedInput||!clickedInput.classList.contains("soft-unavailable"))return;const msg=this.buildComboUnavailableMessage();
1this.inlineMsg&&(this.inlineMsg.innerHTML=msg);const isColor=this.property==="color";this.showVarPickerSnackbar(isColor)}),this.wrapper.addEventListener("change",()=>{!this.wrapper.querySelector('input[type="radio"].soft-unavailable:checked')&&this.inlineMsg&&(this.inlineMsg.innerHTML="")})}getVariants(){window.variants.getData(this.property)}replaceHistoryEntryOnClick(event){history.replaceState(history.state,"",event.currentTarget.href)}}customElements.define("variant-selector",VariantSelector),document.addEventListener("DOMContentLoaded",()=>{const raw=sessionStorage.getItem("varpicker-snackbar-state");if(!raw)return;let state;try{state=JSON.parse(raw)}catch{sessionStorage.removeItem("varpicker-snackbar-state");return}const elapsed=Date.now()-state.shownAt,remaining=state.duration-elapsed;if(remaining<=0){sessionStorage.removeItem("varpicker-snackbar-state");return}VariantSelector.prototype._showSnackbarWithMessage(state.message,remaining)});
2//# sourceMappingURL=/cdn/shop/t/221/assets/product-landing-page.js.map?v=57271764386473572971788891150

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.