1class VoitedPdpMedia extends HTMLElement{constructor(){super(),this.productModal=document.createElement("div"),this.translationData=new Array,this.translationBaseURL=window.tmsAbsLinkData||!1,this.init()}buildArrows(){this.innerHTML+='<button class="voited-arrow voited-arrow-prev arrow-hidden" aria-label="previous" aria-hidden="true"></button><button class="voited-arrow voited-arrow-next" aria-label="next"></button>'}buildButtonHolder(){const e=document.createElement("div");e.classList.add("voited-pdp-media--btn-container"),this.appendChild(e)}buildButtons(){const e=this.querySelector(".voited-pdp-media--btn-container"),t=this.querySelectorAll("ul.voited-scroller .voited-product-carousel--item").length;this.querySelector(".voited-pdp-media--btn-container").innerHTML="";for(let i=0;i<t;i++){const t=document.createElement("button");t.classList.add("voited-pdp-media--btn"),t.dataset.slideto=i,0===i&&t.classList.add("active"),t.ariaLabel="Slide "+(i+1),e.appendChild(t),t.addEventListener("click",e=>this.handleButtonClick(e.target))}}buildListener(){const e=this.querySelector("ul.voited-scroller"),t=this.querySelector(".voited-arrow-prev"),i=this.querySelector(".voited-arrow-next"),o=(t,i)=>{const o=Array.from(this.querySelectorAll(".voited-pdp-media--btn")),d=Array.from(this.querySelectorAll("[data-preview-btn]")),r=Math.round(t/i*o.length);o.forEach((e,t)=>{if(t!=r)return e.classList.remove("active");e.classList.add("active")}),d.forEach((e,t)=>{if(t!=r)return e.classList.remove("active");e.classList.add("active")}),Array.from(e.querySelectorAll("li.voited-product-carousel--item")).forEach((e,t)=>{const i=e.querySelector("img");if(i&&(t===r?e.classList.add("active"):e.classList.remove("active"),t===r+1&&!i.complete)){const e=new Image;e.loading="eager",e.sizes=i.sizes,e.srcset=i.srcset}})};e.addEventListener("scroll",()=>{const d=e.scrollLeft,r=e.scrollWidth-e.clientWidth;var s,a;a=r,(s=d)<=100?(t.setAttribute("aria-hidden",!0),t.classList.add("arrow-hidden")):s>=a-100?(i.setAttribute("aria-hidden",!0),i.classList.add("arrow-hidden")):(t.removeAttribute("aria-hidden"),t.classList.remove("arrow-hidden"),i.removeAttribute("aria-hidden"),i.classList.remove("arrow-hidden")),o(d,e.scrollWidth)});const d=t=>{const i=t.target.classList.contains("voited-arrow-next")?e.scrollLeft+e.clientWidth:e.scrollLeft-e.clientWidth,o=Math.max(0,Math.min(e.scrollWidth,i));e.scrollTo({top:0,left:o,behavior:"smooth"}),document.activeElement.blur()};this.querySelectorAll(".voited-arrow").forEach(e=>{e.addEventListener("click",d)}),this.querySelectorAll("[data-preview-btn]").forEach(e=>{e.addEventListener("click",e=>this.handleButtonClick(e.target))})}buildTranslationArr(){if(!window.tmsFileTranslationData)return;window.tmsFileTranslationData.map(e=>{Function("return "+e)().map(e=>this.translationData.push(e))})}buildZoom(){if(!this.parentNode.classList.contains("voited-pdp--desktop-media"))return;this.productModal.classList.add("voited-pdp-media--modal"),this.productModal.innerHTML='<div class="voited-pdp-media--modal-content"></div><button class="voited-modal--close" aria-label="Close"></button>',this.productModal.ariaHidden=!0,document.body.appendChild(this.productModal);const e=this.productModal.querySelector(".voited-pdp-media--modal-content");Array.from(this.querySelectorAll(".voited-product-carousel--item > img")).forEach(t=>{e.appendChild(t.cloneNode(!0)),t.addEventListener("click",()=>this.handleZoom(t.dataset.mediaIndex))}),this.productModal.addEventListener("click",()=>this.productModal.ariaHidden=!0)}handleButtonClick(e){const t=this.querySelector("ul.voited-scroller");Array.from(e.classList.contains("voited-pdp-media--btn")?this.querySelectorAll(".voited-pdp-media--btn"):this.querySelectorAll("[data-preview-btn]")).forEach(i=>{if(i!=e)return;const o=Number(i.dataset.slideto)*t.clientWidth;t.scrollTo({top:0,left:o,behavior:"smooth"}),document.activeElement.blur()})}handleZoom(e){const t=({key:e})=>{"Escape"==e&&(this.productModal.ariaHidden=!0,document.removeEventListener("keydown",e=>t(e)))};if(this.productModal.ariaHidden=!1,document.addEventListener("keydown",t),!e)return;const i=this.productModal.querySelector(`img[data-media-index="${e}"]`);this.productModal.scrollTo({top:i.offsetTop})}init(){this.preloadInitImg(),this.buildButtonHolder(),this.buildArrows(),this.buildButtons(),this.buildListener(),this.buildZoom(),this.buildTranslationArr(),this.querySelector("ul.voited-scroller").scrollTo({top:0,left:0}),window.addEventListener("VOITED::productchange",e=>{this.querySelector("ul.voited-scroller img")&&this.querySelector("ul.voited-scroller img").src.includes(e.arguments.images[0])||this.switchContent(e.arguments.images)}),window.onload=()=>{void 0!==window.initVideowiseBulk&&window.initVideowiseBulk()},window.addEventListener("videowiseDataReady",()=>{setTimeout(()=>{const e=document.querySelector(".reeview-app-widget-pdp #vw-root");
1if(window.vwVideoPdp)return this.insertVideo();window.vwVideoPdp=e,this.insertVideo()},400)})}insertVideo(){const e=this.querySelector("ul.voited-scroller > li"),t=document.createElement("li");t.classList.add("voited-product-carousel--item","voited-product-carousel--item-video"),this.checkVisibility()&&(t.appendChild(window.vwVideoPdp),e.after(t))}preloadInitImg(){const e=this.querySelectorAll(".voited-scroller > li > img")[1];if(e&&!e.complete){const t=new Image;t.loading="eager",t.sizes=e.sizes,t.srcset=e.srcset}}switchContent(e){const t=this.querySelector("ul.voited-scroller"),i=this.querySelector(".voited-arrow-next"),o=this.translationData.length>0&&"string"==typeof this.translationBaseURL&&tmsShopBaseLocaleCodeData!=Shopify.locale,d=(e,t)=>`<img src="${e}?width=1200" alt="" srcset="${e}?width=375 375w, ${e}?width=550 550w, ${e}?width=750 750w, ${e}?width=1000 1000w, ${e}?width=1200 1200w" width="1200" height="1200" loading="${0===t?"eager":"lazy"}" sizes="(max-width: 989px) 100vw, 50vw" class="voited-pdp-media--img" data-media-index="${t}">`;t.innerHTML="",t.querySelectorAll(".voited-product-carousel--item").forEach(e=>e.classList.add("loading")),this.querySelector(".voited-pdp-media--btn-container").innerHTML="",e.map((e,i)=>{const r=document.createElement("li");if(r.classList.add("voited-product-carousel--item"),o){let t=e;const o=e.split("/").pop();this.translationData.map(e=>{e.base_file.includes(o)&&(t=`${this.translationBaseURL}${e.trans_file[Shopify.locale]}`)}),r.innerHTML=d(t,i)}else r.innerHTML=d(e,i);t.appendChild(r),0===i&&(r.querySelector("img").onload=()=>t.querySelectorAll(".voited-product-carousel--item").forEach(e=>e.classList.remove("loading")))}),this.buildZoom(),this.preloadInitImg(),this.buildButtons(),t.scrollTo({top:0,left:0}),i.removeAttribute("aria-hidden"),i.classList.remove("arrow-hidden"),window.vwVideoPdp&&this.insertVideo()}}customElements.define("voited-pdp-media",VoitedPdpMedia);
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.