import{mediaQueryLarge,requestIdleCallback,startViewTransition}from"@theme/utilities";import PaginatedList from"@theme/paginated-list";export default class ResultsList extends PaginatedList{connectedCallback(){super.connectedCallback(),mediaQueryLarge.addEventListener("change",this.#handleMediaQueryChange),this.setAttribute("initialized","")}disconnectedCallback(){mediaQueryLarge.removeEventListener("change",this.#handleMediaQueryChange)}updateLayout({target}){target instanceof HTMLInputElement&&this.#animateLayoutChange(target.value)}#animateLayoutChange=async value=>{const{grid}=this.refs;grid&&(await startViewTransition(()=>this.#setLayout(value),["product-grid"]),requestIdleCallback(()=>{const viewport=mediaQueryLarge.matches?"desktop":"mobile";sessionStorage.setItem(`product-grid-view-${viewport}`,value)}))};#setLayout(value){const{grid}=this.refs;grid&&grid.setAttribute("product-grid-view",value)}#handleMediaQueryChange=event=>{const targetElement=event.matches?this.querySelector('[data-grid-layout="desktop-default-option"]'):this.querySelector('[data-grid-layout="mobile-option"]');targetElement instanceof HTMLInputElement&&(targetElement.checked=!0,this.#setLayout("default"))}}customElements.get("results-list")||customElements.define("results-list",ResultsList);
//# sourceMappingURL=/s/files/1/0677/1399/0759/t/1/assets/results-list.js.map?v=1783078800
