1const STARS=".yotpo-review .yotpo-review-star-rating",PAGINATION=".yotpo-pagination-item, .yotpo-pagination-number, .yotpo-pagination-icon",ITEM=".yotpo-review, .yotpo-question",SCROLLER=".yotpo-reviews-container, .yotpo-questions-container",PAGE_WAIT_MS=4e3;class IaReviews extends HTMLElement{connectedCallback(){this.onClick=this.handleClick.bind(this),this.addEventListener("click",this.onClick,!0),this.observer=new MutationObserver(()=>this.queue()),this.observer.observe(this,{childList:!0,subtree:!0}),this.queue()}disconnectedCallback(){this.removeEventListener("click",this.onClick,!0),this.observer?.disconnect(),clearTimeout(this.timer),clearTimeout(this.pageTimer)}handleClick(event){const control=event.target.closest(PAGINATION);control&&(this.pageScope=control.closest(SCROLLER)||this,this.pageFrom=this.pageScope.querySelector(ITEM),clearTimeout(this.pageTimer),this.pageTimer=setTimeout(()=>{this.pageFrom=null},4e3))}settlePage(){if(!this.pageFrom)return;const first=(this.pageScope?.isConnected?this.pageScope:this).querySelector(ITEM);if(!first||first===this.pageFrom)return;this.pageFrom=null,clearTimeout(this.pageTimer);const behavior=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth",scroller=first.closest(SCROLLER);scroller&&scroller.scrollHeight>scroller.clientHeight&&scroller.scrollTo({top:0,behavior});const top=first.getBoundingClientRect().top;(top<0||top>window.innerHeight)&&(first.style.scrollMarginTop="calc(var(--ia-header-height, 0px) + 16px)",first.scrollIntoView({behavior,block:"start"}))}queue(){clearTimeout(this.timer),this.timer=setTimeout(()=>this.dress(),50)}dress(){this.querySelectorAll(STARS).forEach(stars=>this.numberStars(stars)),this.settlePage()}numberStars(stars){if(stars.previousElementSibling?.classList.contains("ia-reviews__score"))return;const match=/(\d+(?:\.\d+)?)\s+out of\s+(\d+)/.exec(stars.getAttribute("aria-label")||stars.title||"");if(!match)return;const score=document.createElement("span");score.className="ia-reviews__score",score.setAttribute("aria-hidden","true"),score.textContent=`${match[1]}/${match[2]}`,stars.before(score)}}customElements.get("ia-reviews")||customElements.define("ia-reviews",IaReviews); 2//# sourceMappingURL=/cdn/shop/t/562/assets/ia-reviews.js.map?v=105594874944695538171788865706
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.