1var t=Object.defineProperty;import{B as e}from"./BaseElement.DY9JFAhm.min.js";import{d as a,O as i}from"./debounce.7obvWBYM.min.js";import{H as n}from"./HTMLUpdateUtility.D9m4RNh_.min.js";import"./vendor-lit.DPhFYw_F.min.js";import"./WithApiClient.CLZvm1QW.min.js";import"./vendor.MggefUiv.min.js";import"./firstFocusableElement.CXP_yyKj.min.js";window.customElements.define("facet-filters-form",class extends e{constructor(){var e,r,s;super(),e=this,r="$htmlUpdateUtility",s=new n(this),((e,a,i)=>{a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[a]=i})(e,"symbol"!=typeof r?r+"":r,s),this.sectionId="",this.params="",this.loading=!1,this.onChangeHandler=this.onChangeHandler.bind(this),this.onSubmitHandler=this.onSubmitHandler.bind(this),this.onClickHandler=this.onClickHandler.bind(this),this.onDesktopSortChange=this.onDesktopSortChange.bind(this),this._handleDebounceChange=a(this.onChangeHandler,i)}static get properties(){return{sectionId:{type:String,attribute:"section-id"},params:{type:String},loading:{type:Boolean,reflect:!0}}}connectedCallback(){var t;super.connectedCallback(),this.facetForm=this.querySelector("form"),this.desktopSortInput=document.querySelector("select[data-sort-desktop]"),this.addEventListener("click",this.onClickHandler),this.facetForm.addEventListener("change",this._handleDebounceChange),null==(t=this.desktopSortInput)||t.addEventListener("change",this.onDesktopSortChange),this.facetForm.addEventListener("submit",this.onSubmitHandler),this.$htmlUpdateUtility.addPostProcessCallback(()=>{this.loading=!1})}disconnectedCallback(){var t;this.removeEventListener("click",this.onClickHandler),this.facetForm.removeEventListener("change",this._handleDebounceChange),null==(t=this.desktopSortInput)||t.removeEventListener("change",this.onDesktopSortChange),this.facetForm.removeEventListener("submit",this.onSubmitHandler)}updateURLHash(t){history.pushState({searchParams:t},"",`${window.location.pathname}${t&&"?".concat(t)}`)}get paramsObjectFromString(){return[...new URLSearchParams(this.params).entries()].reduce((t,[e,a])=>({...t,[e]:[...t[e]||[],a]}),{})}createSearchParams(t){const e=new FormData(t);return new URLSearchParams(e).toString()}onChange(t){this.params=t,this.loading=!0,this.$htmlUpdateUtility.fetchAndReplaceSectionId({renderRoot:this,sectionId:this.sectionId,baseUrl:window.location.pathname,params:this.paramsObjectFromString,includeExistingParams:!1,withCache:!0}).catch(t=>{if(t instanceof Error)throw t}),this.updateSelectedFiltersCount()}onChangeHandler(t){t.preventDefault(),this.onChange(this.createSearchParams(this.facetForm))}onSubmit(){this.params=this.createSearchParams(this.facetForm),this.updateURLHash(this.params);const t=document.getElementById("collection");this.$htmlUpdateUtility.fetchAndReplaceSectionId({renderRoot:t,sectionId:null==t?void 0:t.dataset.sectionId,baseUrl:window.location.pathname,params:this.paramsObjectFromString,includeExistingParams:!1,withCache:!0}).catch(t=>{if(t instanceof Error)throw t})}onSubmitHandler(t){t.preventDefault(),this.onSubmit(),this.$emit("modal-dialog::close","filter-drawer-dialog")}onClickHandler(t){t.target.hasAttribute("data-filters-reset")&&this.resetForm()}resetForm(){this.facetForm.querySelectorAll('input[type="checkbox"][data-filter-checkbox]').forEach(t=>{t.checked=!1}),this.onChange(this.createSearchParams(this.facetForm))}onDesktopSortChange(t){const e=this.querySelector(`input[name="sort_by"][value="${t.target.value}"]`);e&&(e.checked=!0),this.onSubmit()}updateSelectedFiltersCount(){const t=this.facetForm.querySelectorAll('input[type="checkbox"][data-filter-checkbox]:checked').length,e=document.querySelector("[data-selected-filters-count]");e&&(e.textContent=t)}});
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.