1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6105],{486(e,t,i){i.r(t),i.d(t,{default:()=>r});var s=i(701),l=i(156),o=i.n(l);class n extends s.A{static #e=this.options=o()(s.A.options,{checkboxSelector:".filter-multi-select-checkbox",countSelector:".filter-multi-select-count",listItemSelector:".filter-multi-select-list-item",snippets:{disabledFilterText:"Filter not active",ariaLabel:"",ariaLabelCount:""},mainFilterButtonSelector:".filter-panel-item-toggle"});init(){this.selection=[],this.counter=this.el.querySelector(this.options.countSelector),this.mainFilterButton=this.el.querySelector(this.options.mainFilterButtonSelector),this._registerEvents()}_registerEvents(){this.el.querySelectorAll(this.options.checkboxSelector).forEach(e=>{e.addEventListener("change",this._onChangeFilter.bind(this))})}getValues(){let e=this.el.querySelectorAll(`${this.options.checkboxSelector}:checked`),t=[];e?e.forEach(e=>{t.push(e.id)}):t=[],this.selection=t,this._updateCount();let i={};return i[this.options.name]=t,i}getLabels(){let e=this.el.querySelectorAll(`${this.options.checkboxSelector}:checked`),t=[];return e?e.forEach(e=>{t.push({label:e.dataset.label,id:e.id})}):t=[],t}setValuesFromUrl(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!1,i=e[this.options.name],s=i?i.split("|"):[],l=this.selection.filter(e=>!s.includes(e)),o=s.filter(e=>!this.selection.includes(e));return(l.length>0||o.length>0)&&(t=!0),o.forEach(e=>{let t=this.el.querySelector(`[id="${e}"]`);t&&(t.checked=!0,this.selection.push(t.id))}),l.forEach(e=>{this.reset(e),this.selection=this.selection.filter(t=>t!==e)}),this._updateCount(),t}_onChangeFilter(){this.listing.changeListing(!0,{p:1})}reset(e){let t=this.el.querySelector(`[id="${e}"]`);t&&(t.checked=!1)}resetAll(){this.selection.filter=[];let e=this.el.querySelectorAll(`${this.options.checkboxSelector}:checked`);e&&e.forEach(e=>{e.checked=!1})}refreshDisabledState(e){let t=e[this.options.name];if(!t.entities||t.entities.length<1){this.disableFilter();return}this.enableFilter(),this._disableInactiveFilterOptions(t.entities.map(e=>e.id))}_disableInactiveFilterOptions(e){this.el.querySelectorAll(this.options.checkboxSelector).forEach(t=>{!0!==t.checked&&(e.includes(t.id)?this.enableOption(t):this.disableOption(t))})}disableOption(e){let t=e.closest(this.options.listItemSelector);t.classList.add("disabled"),t.setAttribute("title",this.options.snippets.disabledFilterText),e.disabled=!0}enableOption(e){let t=e.closest(this.options.listItemSelector);t.removeAttribute("title"),t.classList.remove("disabled"),e.disabled=!1}enableAllOptions(){this.el.querySelectorAll(this.options.checkboxSelector).forEach(e=>{this.enableOption(e)})}disableFilter(){let e=this.el.querySelector(this.options.mainFilterButtonSelector);e.classList.add("disabled"),e.setAttribute("disabled","disabled"),e.setAttribute("title",this.options.snippets.disabledFilterText)}enableFilter(){let e=this.el.querySelector(this.options.mainFilterButtonSelector);e.classList.remove("disabled"),e.removeAttribute("disabled"),e.removeAttribute("title")}_updateCount(){this.counter.textContent=this.selection.length?`(${this.selection.length})`:"",this._updateAriaLabel()}_updateAriaLabel(){if(this.options.snippets.ariaLabel){if(0===this.selection.length){this.mainFilterButton.setAttribute("aria-label",this.options.snippets.ariaLabel);return}this.mainFilterButton.setAttribute("aria-label",`${this.options.snippets.ariaLabel} (${this.options.snippets.ariaLabelCount.replace("%count%",this.selection.length.toString())})`)}}}class r extends n{init(){super.init()}_updateCount(){this.counter.innerText=this.selection.length?`${this.selection.length}`:""}}},701(e,t,i){i.d(t,{A:()=>l});var s=i(335);class l extends s.A{static #e=this.options={parentFilterPanelSelector:".cms-element-product-listing-wrapper",dropdownSelector:".filter-panel-item-dropdown"};_init(){super._init(),this._validateMethods();let e=document.querySelector(this.options.parentFilterPanelSelector);this.listing=window.PluginManager.getPluginInstanceFromElement(e,"Listing"),this.listing.registerFilter(this),this._preventDropdownClose()}_preventDropdownClose(){let e=this.el.querySelector(this.options.dropdownSelector);e&&e.addEventListener("click",e=>{e.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"'`)}}}}]);
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.