1if(!customElements.get("product-compare-table")){class ProductCompareTable extends HTMLElement{constructor(){super()}connectedCallback(){this.container=this.querySelector(".compare-lightbox--data"),this.addEventListeners()}addEventListeners(){this.addEventListener("render-product-compare-modal",this.renderTable.bind(this))}renderTable(){this.classList.add("loading"),this.handles=this.getCompareHandles(),this.fetchProducts()}getSelectedProducts(){return JSON.parse(window.localStorage.getItem("compare-products"))||[]}getCompareHandles(){const{searchParams}=new URL(window.location),handles=searchParams.get("compare");return typeof handles=="string"&&handles!==""?handles.split(","):[]}async fetchProducts(){let compareProducts=this.getSelectedProducts(),returnHtml="",returnArray=[];await Promise.all(compareProducts.map(async product=>{await fetch(`${product.url}?view=compare`,{method:"GET"}).then(response=>response.text()).then(response=>{returnArray[product.id]=this.getSectionInnerHTML(response,".compare-lightbox--data")})})).finally(()=>{this.classList.remove("loading")}),compareProducts.forEach((product,i)=>{returnHtml+=returnArray[product.id]}),this.container.style.setProperty("--columns",compareProducts.length),this.container.innerHTML=returnHtml,this.equalHeights()}getSectionInnerHTML(html,selector){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}equalHeights(){for(let i=0;i<10;i++)this.equalizeTableRowHeightAcrossTables(i)}equalizeTableRowHeightAcrossTables(rowPosition){const tables=this.container.querySelectorAll(".compare-lightbox--table"),heights=[];tables.forEach(table=>{const rows=table.querySelectorAll(".compare-lightbox--row");if(rows.length>rowPosition){const rowHeight=rows[rowPosition].clientHeight;(heights.length===0||rowHeight>heights[rowPosition])&&(heights[rowPosition]=rowHeight)}}),tables.forEach(table=>{const rows=table.querySelectorAll(".compare-lightbox--row");rows.length>rowPosition&&(rows[rowPosition].style.height=heights[rowPosition]+"px")})}}customElements.define("product-compare-table",ProductCompareTable)} 2//# sourceMappingURL=/cdn/shop/t/4/assets/product-compare-table.js.map?v=49777086275525384861756941137
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.