var tdbFiltersDropdown={};jQuery().ready(function(){tdbFiltersDropdown.init()});
(function(){tdbFiltersDropdown={items:[],item:function(){this.type=this.dropdownObj=this.blockObj=this.dropdownUid=this.uid="";this.isMultiSelect=!1;this.filter_singular_name=this.taxonomy_name=this.taxonomy=this.prefix=this.dropdownSearchTxt=this.dropdownTxt="";this._is_initialized=this.inComposer=!1},init:function(){tdbFiltersDropdown.items=[];this._is_running=!1},_initialize_item:function(a){if(!0!==a._is_initialized){if("dropdown_search"===a.type)jQuery("."+a.dropdownUid+" .tdb-s-form-group select").select2({placeholder:"-- "+
a.dropdownSearchTxt+" "+(a.taxonomy_name.charAt(0).toLowerCase()+a.taxonomy_name.slice(1))+" --",minimumInputLength:2,ajax:{url:td_ajax_url,dataType:"json",delay:250,data:function(c){return{action:"tdb_get_search_query_tax_terms",taxonomy:a.taxonomy,search_query:c.term}},processResults:function(a){var c=[];a&&jQuery.each(a,function(a,b){c.push({id:b.term_id,text:b.name,slug:b.slug})});return{results:c}},cache:!0},dropdownCssClass:"tdb-s-select2 tdb-s-select2-"+a.dropdownUid,templateSelection:function(a){jQuery(a.element).attr("data-term-slug",
a.slug);return a.text}});else{var b=jQuery("."+a.dropdownUid+" .tdb-s-form-group select"),d={dropdownCssClass:"tdb-s-select2 tdb-s-select2-"+a.dropdownUid+" tdb-select2-multi",templateSelection:function(a){return jQuery(a.element).text().replace(/ *\([^)]*\) */g,"")}};a.isMultiSelect?(d.dropdownCssClass="tdb-s-select2 tdb-s-select2-"+a.dropdownUid+" tdb-select2-multi",d.placeholder="-- "+a.dropdownTxt+" "+a.filter_singular_name.toLowerCase()+" --"):d.dropdownCssClass="tdb-s-select2 tdb-s-select2-"+
a.dropdownUid;b.select2(d).on("select2:open",function(b){jQuery(".tdb-s-select2-"+a.dropdownUid+" .select2-search__field").focus()})}a._is_initialized=!0}},addItem:function(a){if("undefined"===typeof a.uid)throw"item.uid is not defined";tdbFiltersDropdown.items.push(a);tdbFiltersDropdown._initialize_item(a)},deleteItem:function(a){for(var b=0;b<tdbFiltersDropdown.items.length;b++)if(tdbFiltersDropdown.items[b].uid===a)return tdbFiltersDropdown.items.splice(b,1),!0;return!1},resetItems:function(){tdbFiltersDropdown.items=
[]}}})();
