!function(t){"use strict";function e(t,s){var r=t.find(".tm-product-filter"),o=s(".tm-product-filter__form",r);r.on("click",".term-link",function(t){t.preventDefault();var t=s(this),e=t.closest(".tm-product-filter__filter"),i=t.data("term"),n=t.siblings(".filter-attribute-input"),l=n.val(),r=-1;e.hasClass("tm-product-filter__multiple")?(l=l?l.split(","):[],-1!==(r=-1!==(r=l.indexOf(i))?r:l.indexOf(i.toString()))?l.splice(r,1):l.push(i),n.val(l.join(",")),t.toggleClass("selected"),n.prop("disabled",l.length<=0),e.hasClass("tm-product-filter__attribute")&&(r=n.next("input[name^=query_type_]")).length&&r.prop("disabled",l.length<=1)):t.hasClass("selected")?(t.removeClass("selected"),n.val("").prop("disabled",!0)):(t.addClass("selected").siblings(".selected").removeClass("selected"),n.val(i).prop("disabled",!1));s(document.body).trigger("minimog_products_filter_change")}),r.on("submit",o,function(t){var e=r.find("input[type=hidden]"),i=o.attr("action"),n=-1!==i.indexOf("?")?"&":"?",l={};e.each(function(t){var e=s(this).attr("name"),i=s(this).val();i&&(l[e]=i)}),1<Object.keys(l).length&&(i+=n+s.param(l,!0));"?"===i.slice(-1)&&(i=i.slice(0,-1));return i=i.replace(/%2C/g,","),window.location.href=i,!1}),r.on("click",".tm-button",function(t){t.preventDefault(),o.trigger("submit")})}t(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/tm-product-filter.default",e)})}(jQuery);