"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[93030],{30(t,e,i){i.r(e),i.d(e,{default:()=>l});var s=i(373);class n extends s.A{static #t=this.options={parentFilterPanelSelector:".cms-element-product-listing-wrapper",dropdownSelector:".filter-panel-item-dropdown"};_init(){super._init(),this._validateMethods();let t=document.querySelector(this.options.parentFilterPanelSelector);this.listing=window.PluginManager.getPluginInstanceFromElement(t,"Listing"),this.listing.registerFilter(this),this._preventDropdownClose()}_preventDropdownClose(){let t=this.el.querySelector(this.options.dropdownSelector);t&&t.addEventListener("click",t=>{t.stopPropagation()})}_validateMethods(){if("function"!=typeof this.getValues)throw Error(`[${this._pluginName}] Needs the method "getValues"'`);if("function"!=typeof this.getLabels)throw Error(`[${this._pluginName}] Needs the method "getLabels"'`);if("function"!=typeof this.reset)throw Error(`[${this._pluginName}] Needs the method "reset"'`);if("function"!=typeof this.resetAll)throw Error(`[${this._pluginName}] Needs the method "resetAll"'`)}}var a=i(156),o=i.n(a);class r extends n{static #t=this.options=o()(n.options,{page:1,paginationItemSelector:".pagination .page-link",paginationNavSelector:".pagination-nav"});init(){this._initButtons(),this.tempValue=null,this._pageChanged=!1}_initButtons(){this.buttons=this.el.querySelectorAll(this.options.paginationItemSelector),this.buttons&&this._registerButtonEvents()}_registerButtonEvents(){this.buttons.forEach(t=>{t.addEventListener("click",this.onChangePage.bind(this))})}onChangePage(t){t.preventDefault(),this.tempValue=t.currentTarget.dataset.page,this._saveFocusState(t.currentTarget),this._pageChanged=!0,this.listing.changeListing(),this.tempValue=null}_saveFocusState(t){let e=t.closest(this.options.paginationNavSelector).dataset.paginationLocation;this.listing.options.scrollTopListingWrapper&&(e="top"),window.focusHandler.saveFocusState("listing-pagination",`[data-pagination-location="${e}"] [data-focus-id="${t.dataset.focusId}"]`)}_resumeFocusState(){window.focusHandler.resumeFocusState("listing-pagination",{preventScroll:!0})}reset(){}resetAll(){}getValues(){return null!==this.tempValue?{p:this.tempValue}:{p:1}}afterContentChange(){this._initButtons(),this.buttons&&this._pageChanged&&this._resumeFocusState(),this._pageChanged=!1}getLabels(){return[]}setValuesFromUrl(t){let e=!1;return this.tempValue=1,t.p&&parseInt(t.p)!==parseInt(this.tempValue)&&(this.tempValue=parseInt(t.p),e=!0),e}}class l extends r{getValues(){let t={p:this.tempValue??1},e=new URLSearchParams(window.location.search).get("boxLayout");return e&&(t.boxLayout=e),t}}}}]);