1class FilterValue extends HTMLElement{constructor(){super()}updateDeepLinking(url){const currentURL=new URL(location.href),newURL=new URL(url,location.origin);currentURL.searchParams.forEach((value,key)=>{key.includes("filter")||newURL.searchParams.set(key,value)}),history.replaceState(null,"",newURL.href)}updateDOM(url){this.updateDeepLinking(url);const section=this.closest("[data-section-id]");if(section){const section_id=section.dataset.sectionId;if(section_id&&url){section.classList.add("loading");const fetch_url=new URL(url,location.origin);fetch_url.searchParams.set("section_id",section_id),fetch(fetch_url.href,{credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest"},method:"GET"}).then(response=>response.text()).then(data=>{const template=document.createElement("template");template.innerHTML=data.trim();const old_collection_grid=section.querySelector("#collection-grid"),new_collection_grid=template.content.querySelector("#collection-grid");old_collection_grid&&new_collection_grid&&old_collection_grid.replaceWith(new_collection_grid);const old_collection_filter=section.querySelector("#collection-filter"),new_collection_filter=template.content.querySelector("#collection-filter");old_collection_filter&&new_collection_filter&&(old_collection_filter.innerHTML=new_collection_filter.innerHTML);const old_collection_pagination=section.querySelector("#collection-pagination"),new_collection_pagination=template.content.querySelector("#collection-pagination");old_collection_pagination&&new_collection_pagination&&old_collection_pagination.replaceWith(new_collection_pagination);const old_collection_count=section.querySelector("#collection-count"),new_collection_count=template.content.querySelector("#collection-count");old_collection_count&&new_collection_count&&old_collection_count.replaceWith(new_collection_count),window.dispatchEvent(new CustomEvent("collection::updated")),section&§ion.classList.remove("loading")}).catch(function(err){section&§ion.classList.remove("loading"),console.error(err)})}}}}class FilterValuePriceRange extends FilterValue{constructor(){super()}connectedCallback(){this.updateUrl=this.getAttribute("update-url"),this.fromSlider=this.querySelector("#fromRange"),this.toSlider=this.querySelector("#toRange"),this.fromInput=this.querySelector("#fromValue"),this.toInput=this.querySelector("#toValue"),this.fillSlider(this.fromSlider,this.toSlider,"rgba(25,10,0, 0.15)","var(--color-primary, #000)",this.toSlider),this.setToggleAccessible(this.toSlider),this.fromSlider.addEventListener("input",this.controlFromSlider.bind(this)),this.toSlider.addEventListener("input",this.controlToSlider.bind(this)),this.fromInput.addEventListener("input",this.controlFromInput.bind(this)),this.toInput.addEventListener("input",this.controlToInput.bind(this)),this.fromSlider.addEventListener("input",this.debounce(this.handleInput.bind(this),500)),this.toSlider.addEventListener("input",this.debounce(this.handleInput.bind(this),500)),this.fromInput.addEventListener("input",this.debounce(this.handleInput.bind(this),500)),this.toInput.addEventListener("input",this.debounce(this.handleInput.bind(this),500))}debounce(fn,wait){const that=this;let t;return(...args)=>{clearTimeout(t),t=setTimeout(()=>fn.apply(that,args),wait)}}handleInput(){const that=this;let url=that.updateUrl;const range_min=0,range_max=Number(that.toInput.max)?Number(that.toInput.max):1e6,min=that.fromInput.value,max=that.toInput.value;url.includes("?")?min&&min>range_min&&(url+=`&filter.v.price.gte=${min}`):min&&min>range_min&&(url+=`?filter.v.price.gte=${that.fromInput.value}`),url.includes("?")?max&&max<range_max&&(url+=`&filter.v.price.lte=${max}`):max&&max<range_max&&(url+=`?filter.v.price.lte=${max}`),super.updateDOM(url)}controlFromInput(){const that=this,[from,to]=that.getParsed(that.fromInput,that.toInput);that.fillSlider(that.fromInput,that.toInput,"rgba(25,10,0, 0.15)","var(--color-primary, #000)",that.toSlider),from>to?(that.fromSlider.value=to,that.fromInput.value=to):that.fromSlider.value=from}controlToInput(){const that=this,[from,to]=that.getParsed(that.fromInput,that.toInput);that.fillSlider(that.fromInput,that.toInput,"rgba(25,10,0, 0.15)","var(--color-primary, #000)",that.toSlider),that.setToggleAccessible(that.toInput),from<=to?(that.toSlider.value=to,that.toInput.value=to):that.toInput.value=from}controlFromSlider(){const that=this,[from,to]=that.getParsed(that.fromSlider,that.toSlider);that.fillSlider(that.fromSlider,that.toSlider,"rgba(25,10,0, 0.15)","var(--color-primary, #000)",that.toSlider),from>to?(that.fromSlider.value=to,that.fromInput.value=to):that.fromInput.value=from}controlToSlider(){const that=this,[from,to]=that.getParsed(that.fromSlider,that.toSlider);that.fillSlider(that.fromSlider,that.toSlider,"rgba(25,10,0, 0.15)","var(--color-primary, #000)",that.toSlider),that.setToggleAccessible(that.toSlider),from<=to?(that.toSlider.value=to,that.toInput.value=to):(that.toInput.value=from,that.toSlider.value=from)}getParsed(currentFrom,currentTo){const from=parseInt(currentFrom.value,10),to=parseInt(currentTo.value,10);return[from,to]}fillSlider(from,to,sliderColor,rangeColor,controlSlider){const rangeDistance=to.max-to.min,fromPosition=from.value-to.min,toPosition=to.value-to.min;controlSlider.style.background=`linear-gradient( 2 to right, 3 ${sliderColor} 0%, 4 ${sliderColor} ${fromPosition/rangeDistance*100}%, 5 ${rangeColor} ${fromPosition/rangeDistance*100}%, 6 ${rangeColor} ${toPosition/rangeDistance*100}%, 7 ${sliderColor} ${toPosition/rangeDistance*100}%, 8 ${sliderColor} 100%)`}setToggleAccessible(currentTarget){const toSlider=this.querySelector("#toRange");Number(currentTarget.value)<=0?toSlider.style.zIndex=2:toSlider.style.zIndex=0}}customElements.define("filter-value-price-range",FilterValuePriceRange);class FilterValueBoolean extends FilterValue{constructor(){super()}connectedCallback(){this.addEventListener("click",()=>{const url=this.getAttribute("update-url");url&&super.updateDOM(url)})}}customElements.define("filter-value-boolean",FilterValueBoolean);class FilterValueList extends FilterValue{constructor(){super()}connectedCallback(){this.addEventListener("click",()=>{const url=this.getAttribute("update-url");url&&super.updateDOM(url)})}}customElements.define("filter-value-list",FilterValueList);class FilterValueRemove extends FilterValue{constructor(){super()}connectedCallback(){this.addEventListener("click",()=>{const url=this.getAttribute("update-url");url&&super.updateDOM(url)})}}customElements.define("filter-value-remove",FilterValueRemove);class FilterValueType extends FilterValue{constructor(){super()}updateDeepLinking(url){const currentURL=new URL(location.href),newURL=new URL(url,location.origin);
8currentURL.searchParams.forEach((value,key)=>{key.includes("type")||newURL.searchParams.set(key,value),key.includes("filter")&&newURL.searchParams.delete(key)}),history.replaceState(null,"",newURL.href)}connectedCallback(){const that=this;this.addEventListener("click",()=>{const type=that.getAttribute("update-type"),currentURL=new URL(location.href),newUrl=new URL(location.href);currentURL.searchParams.forEach((value,key)=>{key.includes("filter")&&newUrl.searchParams.delete(key)}),newUrl.searchParams.set("type",type);const url=newUrl.pathname+newUrl.search;super.updateDOM(url)})}}customElements.define("filter-value-type",FilterValueType);class PaginationNext extends HTMLElement{constructor(){super()}updateDOM(url){const section=this.closest("[data-section-id]"),loadingText=this.getAttribute("loading-text");if(this.innerHTML=loadingText,section){section.classList.add("loading");const section_id=section.dataset.sectionId;if(section_id&&url){const fetch_url=new URL(url,location.origin);fetch_url.searchParams.set("section_id",section_id),fetch(fetch_url.href,{credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest"},method:"GET"}).then(response=>response.text()).then(data=>{const template=document.createElement("template");template.innerHTML=data.trim();const old_collection_grid=section.querySelector("#collection-grid"),new_collection_grid_items=template.content.querySelectorAll("#collection-grid .product-grid-item, #collection-grid .page-grid-item, #collection-grid .article-grid-item");for(const new_item of new_collection_grid_items)old_collection_grid.append(new_item);const old_collection_pagination=section.querySelector("#collection-pagination"),new_collection_pagination=template.content.querySelector("#collection-pagination");old_collection_pagination&&new_collection_pagination&&old_collection_pagination.replaceWith(new_collection_pagination),window.dispatchEvent(new CustomEvent("collection::updated")),section&§ion.classList.remove("loading")}).catch(function(err){section&§ion.classList.remove("loading"),console.error(err)})}}}validateItems(){const pageSize=Number(this.getAttribute("paginate-page-size")),currentPage=Number(this.getAttribute("paginate-current-page")),lastPage=Number(this.getAttribute("paginate-last-page")),limit=currentPage*pageSize,section=this.closest("[data-section-id]"),old_grid_items=section.querySelectorAll(".product-grid-item, .page-grid-item, .article-grid-item, .promotion-grid-item");for(const item of old_grid_items)Number(item.style.getPropertyValue("--order"))>limit&¤tPage<lastPage?item.classList.add("hidden"):item.classList.remove("hidden");const visiblePromotions=section.querySelectorAll(".promotion-grid-item:not(.hidden)");if(window.innerWidth<600&&(limit+visiblePromotions.length)%2==1){const hiddenProducts=section.querySelectorAll(".product-grid-item.hidden");console.log(hiddenProducts),hiddenProducts.length>0&&hiddenProducts[0].classList.remove("hidden")}}connectedCallback(){this.validateItems(),this.addEventListener("click",()=>{const url=this.getAttribute("paginate-next");url&&this.updateDOM(url)})}}customElements.define("pagination-next",PaginationNext); 9//# sourceMappingURL=/cdn/shop/t/676/assets/collection.js.map?v=105378567443458414701727795670
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.