!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,i=!1,n=function(e,t){e.closest(".ct-filter-widget-wrapper").id;var 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");var o=function(e,t){var r=[];return t.querySelectorAll(".ct-filter-label").forEach((function(e){var t,c=e.cloneNode(!0);null===(t=c.querySelector(".ct-filter-count"))||void 0===t||t.remove(),r.push(c.textContent.trim().toLowerCase())})),r}(0,c),l=[];c.querySelectorAll(".ct-filter-item").forEach((function(e){var r=e.querySelector("a").ariaLabel;if(r){var c=r.trim().toLowerCase();if(o.includes(c)&&c.includes(t)){var i,n,a=e.cloneNode(!0);null===(i=a.querySelector(".ct-expandable-trigger"))||void 0===i||i.remove(),null===(n=a.querySelector(".ct-filter-children"))||void 0===n||n.remove(),l.push(a)}}}));var a=c.cloneNode(!0);a.classList.add("ct-filter-search-results"),a.innerHTML="",0===l.length?a.innerHTML='<li class="ct-filter-item ct-no-results">'.concat(ct_localizations.search_live_results,"</li>"):l.forEach((function(e){a.appendChild(e)})),c.parentNode.insertBefore(a,c.nextSibling),i||(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")})),i=!0),r().trigger("blocksy:frontend:init")};(0,c.registerDynamicChunk)("blocksy_ext_woo_extra_filters_search",{mount:function(e,t){var r=t.event;n(e,r.target.value.trim().toLowerCase())}}),r().on("blocksy:filters:search",(function(e){var t=e.el,r=e.value;r&&(i=!1),n(t,r)}))}();