1import{$ as c}from"./vendor-34b46c5c.js";import{c as o}from"../index-2c20db78.js";import{r as l}from"./ResizeHandler-443f1dd8.js";import{i as f}from"./SearchRequestHelper-0d8467aa.js";var u=".outer-container",p=".btn-more .btn",$=".item",d=".subcomponent-search-results-filter-list";function g(n){var t=this;this.$target=c(n),this.$container=this.$target.find(u),this.$morebutton=this.$target.find(p),this.$teaser=this.$target.find($),this.classScopes=["h-s","h-m","h-l","h-xl","is-hidden"],this.$filter=c(d,n),this.$hasFilter=this.$filter.length,this.$isNewsroom=f(),this.initialListCount=Array.from(this.$teaser).filter(e=>!e.classList.contains("is-hidden")).length,this.$hasFilter&&(this.$filterList=[],this.$filterOptions=this.$filter.find("input[name='filter']"),this.$filterOptions.on("change",function(){t.onFilter()}),this.$filterOptions.on("reset",function(){t.onFilter(!0)}),this.$resetButton=this.$target.find(".filter-list-pulldown__reset"),this.$resetButton.length&&this.$resetButton.on("click",function(){t.$isNewsroom?t.reloadWithFilters([]):t.onFilter(!0)})),Array.prototype.diff=function(e){var s=[];this.sort(),e.sort();for(var i=0;i<this.length;i+=1)e.indexOf(this[i])>-1&&s.push(this[i]);return s},this.init=function(){this.$morebutton.on("click",function(e){e.preventDefault&&e.preventDefault(),t.showMore(e)}),this.setCountedValueIntoDom(),this.initHeight(),this.checkMoreTeaser()},this.reloadWithFilters=function(e){var s=new URL(window.location.href),i=s.searchParams;if(i.set("size","12"),i.set("from","0"),e&&e.length){var r=e.join(",");i.set("filter",r)}else i.delete("filter");window.location.assign(s.toString())},this.onFilter=function(e){if(t.$filterList=[],t.$filterOptions&&t.$filterOptions.length&&t.$filterOptions.each(function(){this.checked&&t.$filterList.push(c(this).attr("id"))}),t.$isNewsroom){t.reloadWithFilters(t.$filterList);return}var s=t.$target[0].querySelectorAll('input[name="filter"]:checked').length===0,i=l.getDeviceState(),r=t.getPageSize(i);t.$target.find(".item").each(function(){var a=(c(this).attr("data-tags")||"").split(","),h=a.diff(t.$filterList).length;this.classList.remove(t.classScopes[0],t.classScopes[1],t.classScopes[2],t.classScopes[3],t.classScopes[4]),h||s?(r<=0&&this.classList.add("is-hidden"),r--):this.classList.add("is-hidden")}),t.setCountedValueIntoDom(e),t.checkMoreTeaser()},this.setCountedValueIntoDom=function(e){var s,i=t.$target.find("#js-count-text"),r="resultText";e?s=t.initialListCount:s=Array.from(t.$teaser).filter(a=>!a.classList.contains("is-hidden")).length,r+=s===1?"Singular":"Plural",t.$target.find("#js-filtered-count").text(s),i.text(i.data(r))},this.initHeight=function(){},this.showMore=function(){var e=l.getDeviceState(),s=t.getPageSize(e);Array.prototype.forEach.call(t.$teaser,function(i){if(!t.$hasFilter)i.classList.contains(t.classScopes[e-1])&&s>0&&(i.classList.remove(t.classScopes[0],t.classScopes[1],t.classScopes[2],t.classScopes[3],t.classScopes[4]),s--);else{var r=(i.getAttribute("data-tags")||"").split(","),a=r.diff(t.$filterList).length>0;(t.$filterList.length===0||a)&&t.checkHiddenClass(i,e)&&s>0&&(i.classList.remove(t.classScopes[0],t.classScopes[1],t.classScopes[2],t.classScopes[3],t.classScopes[4]),s--)}}),t.setCountedValueIntoDom(),t.checkMoreTeaser()},this.getPageSize=function(e){var s;switch(e){case o.DEVICE_SMALL:s=3;break;case o.DEVICE_MEDIUM:s=6;break;case o.DEVICE_LARGE:s=8;break;case o.DEVICE_XLARGE:s=8;break}return s},this.checkHiddenClass=function(e,s){return e.classList.contains(t.classScopes[s-1])||e.classList.contains(t.classScopes[4])},this.checkMoreTeaser=function(){var e=l.getDeviceState(),s=!1;t.$hasFilter&&t.$filterList.length?Array.prototype.forEach.call(t.$teaser,function(i){var r=(i.getAttribute("data-tags")||"").split(","),a=r.diff(t.$filterList).length>0;a&&t.checkHiddenClass(i,e)&&(s=!0)}):(t.$teaser.hasClass(t.classScopes[e-1])||t.$teaser.hasClass(t.classScopes[4]))&&(s=!0),t.$morebutton.toggleClass(o.class.disabled,!s)},this.init()}function w(n){return new g(n)}export{w as Factory};
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.