1void 0===TCB_Front.js_modules["post-list-filter"]&&TCB_Front.setModuleLoadedStatus("post-list-filter",!1),(t=>{if(!TCB_Front.isModuleLoaded("post-list-filter")){t(window).on("tcb_after_dom_ready",(()=>{"undefined"!=typeof tcb_post_lists&&tcb_post_lists.length&&t(".tcb-post-list-filter").each(((s,i)=>{new e(t(i))}))}));class e{static getActiveClass(t){return"button"===t||"list"===t?"tve-state-active":"tve-state-expanded"}static get optionIdentifier(){return".tcb-filter-option"}constructor(e){const s=t(".tcb-post-list:not(.tcb-featured-list)[data-dynamic_filter]");this.$filterElement=e,s.length&&(this.postListInstance=new TCB_Front.PostList(s)),this.selectedFilters=[],tve_frontend_options.is_editor_page||this.frontendInit()}shouldFilter(){let t=!1;return this.postListInstance&&this.postListInstance.$element.length&&JSON.parse(this.postListInstance.$element.attr("data-dynamic_filter"))[this.getAttr("url-query-key")]&&(t=!0),t}frontendInit(){this.markDefaultAsSelected(),this.markQueryStringsAsSelected(),this.bindEvents()}bindEvents(){const e=`.tcb-post-list-filter[data-css=${this.getAttr("css")}] .tcb-filter-option`;t("body").off("mousedown",e).on("mousedown",e,this.clickOption.bind(this)),t(window).on("tcb_search_overlay_show",((t,e)=>{this.$filterElement.find(e).length&&this.addSearchEvents(e.data("$$clone"))})),this.addSearchEvents()}clickOption(s){const i="true"===this.getAttr("multiple-selection"),r=this.getAttr("filter-type"),n=t(s.currentTarget);i||(this.$filterElement.find(e.optionIdentifier).removeClass(e.getActiveClass(r)),this.selectedFilters[this.getAttr("filter-option")]=[]),"all"!==n.attr("data-id")?this.$filterElement.find('[data-id="all"]').removeClass(e.getActiveClass(r)):(this.$filterElement.find(`.${e.getActiveClass(r)}:not([data-id="all"])`).removeClass(e.getActiveClass(r)),this.selectedFilters=[]),n.hasClass(e.getActiveClass(r))?(n.removeClass(e.getActiveClass(r)),void 0===this.selectedFilters[this.getAttr("filter-option")]&&(this.selectedFilters[this.getAttr("filter-option")]=[]),this.selectedFilters[this.getAttr("filter-option")]=this.selectedFilters[this.getAttr("filter-option")].filter((function(t){return t!==n.attr("data-id")}))):(n.addClass(e.getActiveClass(r)),this.selectedFilters[this.getAttr("filter-option")]?this.selectedFilters[this.getAttr("filter-option")].push(n.attr("data-id")):this.selectedFilters[this.getAttr("filter-option")]=[n.attr("data-id")]);const l=[...new Set([...this.selectedFilters[this.getAttr("filter-option")],...this.getQueryStringFilters(!0)])],o=[];l.forEach((t=>{o.push({filter:this.getAttr("filter-option"),id:t,origin:this.getAttr("url-query-key")})})),this.setQueryStringUrl(this.getOptionNames(l).join(",")),this.filter(o)}getOtherSelectedFilters(){const s=[],i=JSON.parse(this.postListInstance.$element.attr("data-dynamic_filter"));
1return Object.keys(i).forEach((i=>{if(i&&i!==this.getAttr("url-query-key")){const r=t(`.tcb-post-list-filter[data-url-query-key=${i}]`),n=[];r.find(`.${e.getActiveClass(r.attr("data-filter-type"))}:not([data-id=all])`).each(((t,e)=>{e&&n.push(e.getAttribute("data-id"))})),n.forEach((t=>{t&&s.push({filter:r.attr("data-filter-option"),id:t,origin:i})}))}})),s}filter(e){if(this.shouldFilter()){this.postListInstance.listArgs&&(this.postListInstance.listArgs.query&&(this.postListInstance.listArgs.query.paged=1),this.postListInstance.listArgs.filters=[]);const s=[...new Set(this.selectedFilters[this.getAttr("filter-option")])],i=this.getOtherSelectedFilters();("search"===this.getAttr("filter-option")||i.length||s.length&&(!s.includes("all")||s.length>1))&&(this.postListInstance.listArgs.filters=[...e,...i]),this.postListInstance.enableLoading(),t.ajax({url:tve_frontend_options.routes.posts+"/html",method:"POST",headers:{"X-WP-Nonce":tve_frontend_options.nonce},data:{content:this.postListInstance.content,args:this.postListInstance.listArgs},success:t=>{this.restorePostListInstance(),0===t.count?this.postListInstance.$element.addClass("empty-list"):(this.postListInstance.$element.removeClass("empty-list"),this.postListInstance.$element.find("article").remove(),this.postListInstance.insertItems(t),this.postListInstance.initItems()),TCB_Front.event_triggers(this.postListInstance.$element),this.postListInstance.disableLoading(),this.postListInstance.listArgs.attr.total_post_count=t.total_post_count,this.postListInstance.renderPagination()},error:()=>{console.warn("There was an error and the post list could not be filtered.")}})}}getAttr(t){return this.$filterElement.attr(`data-${t}`)}getSelectedElements(){const t=[];return this.$filterElement.find(e.getActiveClass(this.getAttr("filter-option"))).each(((e,s)=>{t.push(s.getAttribute("data-id"))})),t}setQueryStringUrl(t){const e=this.getAttr("url-query-key"),s=TCB_Front.queryString.setUrlParam(window.location.href,e,t).replace(/%2C/g,",");window.history.pushState("","",s)}getQueryStringFilters(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const s=(TCB_Front.queryString.get(this.getAttr("url-query-key"))||"").split(","),i=[];return s.forEach((s=>{let r=`[data-name="${s}"]`;t&&(r=`.${e.getActiveClass(this.getAttr("filter-type"))}`+r);const n=this.$filterElement.find(r).attr("data-id");s&&n&&i.push(n)})),i}markDefaultAsSelected(){if(0===this.getQueryStringFilters().length){const t=this.getAttr("default-value"),s=this.getAttr("filter-option"),i=this.$filterElement.find(`${e.optionIdentifier}[data-id=${t}]`),r=[{id:t,filter:s,origin:this.getAttr("url-query-key")}];i.addClass(e.getActiveClass(this.getAttr("filter-type"))),["all","none"].includes(t)||(this.selectedFilters[s]=[t],this.filter(r))}}markQueryStringsAsSelected(){const t=this.getAttr("url-query-key"),s=TCB_Front.queryString.get(t);s&&s.split(",").forEach((t=>{this.$filterElement.find(`[data-name="${t}"]`).addClass(e.getActiveClass(this.getAttr("filter-type")))}))}getOptionNames(t){const s=[];return t.filter((t=>{t&&"all"!==t&&s.push(this.$filterElement.find(`${e.optionIdentifier}[data-id=${t}]`).attr("data-name"))})),s}addSearchEvents(){const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.$filterElement).find("form");t.submit((e=>{e.preventDefault();const s=t.find('input[type="search"]').val(),i=[{filter:"search",name:s}];this.setQueryStringUrl(s),this.filter(i)}))}restorePostListInstance(){this.postListInstance.identifier.includes("tve-u-")?this.postListInstance.$element=t(`.tcb-post-list[data-css=${this.postListInstance.identifier}]`):this.postListInstance.$element=t(this.postListInstance.identifier)}}window.TCB_Front.PostListFilter=e,TCB_Front.setModuleLoadedStatus("post-list-filter",!0)}})(ThriveGlobal.$j);
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.