1(()=>{var l=class extends HTMLElement{constructor(){super(),this.swiper=null,this._isMoving=!1,this.source=this.getAttribute("data-source")||"cart"}connectedCallback(){this._isMoving||this.init()}disconnectedCallback(){this._isMoving||(this.destroySwiper(),window.removeEventListener("resize",this.handleResize))}init(){this.initSwiper(),this.bindEvents(),this.setupCartListener(),this.filterByCartVariants(),this.checkFinalVisibility(),this.adjustMobileLayout(),this.handleResize=this.handleResize.bind(this),window.addEventListener("resize",this.handleResize)}initSwiper(t=0){if(window.innerWidth<=989)return;if(typeof Swiper>"u"){if(t>50){let e=this.querySelector(".swiper-wrapper");e&&(e.style.overflowX="auto");return}setTimeout(()=>this.initSwiper(t+1),100);return}let i=this.querySelector(".dl-cart-maylike-ll-swiper");i&&typeof this.swiper?.update!="function"&&(this.swiper=new Swiper(i,{observer:!0,observeParents:!0,observeSlideChildren:!0,spaceBetween:0,slidesPerView:"auto",slidesPerGroup:1,breakpoints:{990:{slidesPerGroup:3},1920:{slidesPerGroup:4}},loop:!1,resistance:!0,resistanceRatio:.85,navigation:{nextEl:this.querySelector(".dl-cart-maylike-ll-next"),prevEl:this.querySelector(".dl-cart-maylike-ll-prev")},pagination:{el:this.querySelector(".dl-cart-maylike-ll-pagination"),clickable:!0,type:"bullets"}}))}hasSwiper(){return typeof this.swiper?.update=="function"}destroySwiper(){typeof this.swiper?.destroy=="function"&&this.swiper.destroy(!0,!0),this.swiper=null}bindEvents(){this.addEventListener("click",t=>{let i=t.target.closest(".dl-cart-maylike-ll-img");if(i){t.preventDefault();let e=i.closest(".dl-cart-maylike-ll-slide");if(!e)return;if(e.getAttribute("data-dl-variant-id")){let r=e.querySelector("dl-gallery-data-x");r&&r.click()}}})}filterRecommendationsByCondition(t){this.querySelectorAll(".dl-cart-maylike-ll-slide").forEach(e=>{let s=e.getAttribute("data-dl-variant-id"),r=t(s);e.style.display=r?"none":"",e.style.pointerEvents=r?"none":"auto"}),setTimeout(()=>{this.hasSwiper()&&this.swiper.update()},50)}filterByCartVariants(){let t=this.getCartVariantIds();this.filterRecommendationsByCondition(i=>t.has(i)),this.updateVisibleItems(),setTimeout(()=>{this.checkFinalVisibility()},100)}getCartVariantIds(){let t=new Set,i=document.querySelector("#cart-item-json")?.textContent;if(!i)return t;try{let e=JSON.parse(i);Array.isArray(e)&&e.forEach(s=>{s?.variant_id!=null&&t.add(s.variant_id.toString())})}catch(e){console.warn("[dl-cart-maylike-ll] Failed to parse cart-item-json:",e)}return t}checkFinalVisibility(){let t=this.querySelectorAll(".dl-cart-maylike-ll-slide");Array.from(t).filter(e=>e.style.display!=="none"&&getComputedStyle(e).display!=="none").length===0?this.style.display="none":this.style.display=""}updateVisibleItems(){let t=this.querySelectorAll(".dl-cart-maylike-ll-slide"),i=Array.from(t).filter(e=>e.style.display!=="none"&&getComputedStyle(e).display!=="none");t.forEach(e=>e.classList.remove("last-visible")),i.length>0&&i[i.length-1].classList.add("last-visible")}setupCartListener(){typeof subscribe<"u"&&subscribe(PUB_SUB_EVENTS.cartUpdate,t=>{setTimeout(()=>{this.filterByCartVariants()},200)})}handleResize(){let t=this.hasSwiper()&&this.swiper.activeIndex||0,i=!this.hasSwiper(),e=window.innerWidth<=989;i&&!e?this.initSwiper():!i&&e&&this.destroySwiper(),this.adjustMobileLayout(),setTimeout(()=>{this.hasSwiper()&&this.swiper.slides?.length&&t<this.swiper.slides.length&&this.swiper.slideTo(t,0)},100)}adjustMobileLayout(){if(this.source!=="cart")return;let t=this.hasSwiper()&&this.swiper.activeIndex||0,i=window.innerWidth<=989?document.querySelector(".dl-cart-content"):document.querySelector(".dl-cart-main-content");!i||this.parentElement===i||(this._isMoving=!0,i.appendChild(this),this._isMoving=!1,setTimeout(()=>{this.hasSwiper()&&(this.swiper.update(),this.swiper.slides?.length&&t<this.swiper.slides.length&&this.swiper.slideTo(t,0))},100))}insertApiRecommendations(t){console.log("[insertApiRecommendations] Called with HTML length:",t?.length),console.log("[insertApiRecommendations] Swiper instance:",this.swiper),this.querySelectorAll(".dl-recommendation-api-slide").forEach(n=>
1{n.remove()});let i=document.createElement("div");i.innerHTML=t;let e=i.querySelectorAll(".dl-cart-maylike-ll-slide");if(e.length===0)return;let s=this.querySelector(".dl-cart-maylike-ll-swiper-wrapper");if(!s)return;let r=document.createDocumentFragment();e.forEach(n=>r.appendChild(n)),s.prepend(r),setTimeout(()=>{this.hasSwiper()&&this.swiper.update()},100),this.updateVisibleItems(),this.checkFinalVisibility()}};customElements.get("dl-cart-maylike-ll")||customElements.define("dl-cart-maylike-ll",l);})();
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.