!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var c in r)e.o(r,c)&&!e.o(t,c)&&Object.defineProperty(t,c,{enumerable:!0,get:r[c]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.ctEvents,r=e.n(t),c=window.ctFrontend;let o=!1;const n=function(e,t){e.closest(".ct-filter-widget-wrapper").id;const c=e.closest(".ct-filter-widget-wrapper").querySelector(".ct-filter-widget"),n=c.parentNode.querySelector(".ct-filter-search-results");if(n&&n.remove(),!t)return e.closest(".ct-filter-widget-wrapper").classList.remove("ct-active"),void r().trigger("blocksy:frontend:init");e.closest(".ct-filter-widget-wrapper").classList.add("ct-active");const i=function(e,t){const r=[];return t.querySelectorAll(".ct-filter-label").forEach(function(e){const t=e.cloneNode(!0);t.querySelector(".ct-filter-count")?.remove(),r.push(t.textContent.trim().toLowerCase())}),t.querySelectorAll(".ct-filter-item-inner a").forEach(function(e){const t=e.cloneNode(!0);t.querySelector(".ct-expandable-trigger")?.remove(),r.push(t.ariaLabel.trim().toLowerCase())}),Array.from(new Set(r))}(0,c),l=[];c.querySelectorAll(".ct-filter-item").forEach(function(e){const r=e.querySelector("a").ariaLabel;if(!r)return;const c=r.trim().toLowerCase();if(i.includes(c)&&c.includes(t)){const t=e.cloneNode(!0);t.querySelector(".ct-expandable-trigger")?.remove(),t.querySelector(".ct-filter-children")?.remove(),l.push(t)}});const s=c.cloneNode(!0);s.classList.add("ct-filter-search-results"),s.innerHTML="",0===l.length?s.innerHTML=`<li class="ct-filter-item ct-no-results">${ct_localizations.search_live_no_results}</li>`:l.forEach(function(e){s.appendChild(e)}),c.parentNode.insertBefore(s,c.nextSibling),o||(e.closest(".ct-filter-search").querySelector(".ct-filter-search-icon").addEventListener("click",function(t){e.closest(".ct-filter-search").classList.remove("ct-active"),e.value="",r().trigger("blocksy:filters:search",{el:e,value:""}),r().trigger("blocksy:frontend:init")}),o=!0),r().trigger("blocksy:frontend:init")};(0,c.registerDynamicChunk)("blocksy_ext_woo_extra_filters_search",{mount:function(e,{event:t}){n(e,t.target.value.trim().toLowerCase())}}),r().on("blocksy:filters:search",function({el:e,value:t}){t&&(o=!1),n(e,t)})}();