function mediaLibraryOrganizerSelectizeInit(e){var i=void 0!==e?e:"body",$;($=jQuery)(media_categories_module_selectize.selectors.simple.join(", "),$(i)).each((function(){var e=",";void 0!==$(this).data("delimiter")&&(e=$(this).data("delimiter")),$(this).selectize({delimiter:e})})),$(media_categories_module_selectize.selectors.multiple.join(", "),$(i)).each((function(){var e=void 0!==$(this).data("delimiter")?$(this).data("delimiter"):",";$(this).selectize({plugins:["drag_drop","remove_button"],delimiter:e,persist:!1,create:function(e){return{value:e,text:e}}})})),$(media_categories_module_selectize.selectors.ajax.join(", "),$(i)).each((function(){var e=$(this).data("action"),i=$(this).data("nonce"),t=$(this).data("args"),a=$(this).attr("name"),r=$(this).data("name-field"),n=$(this).data("value-field"),s=$(this).data("method"),l=$(this).data("output-fields").split(","),o=$(this).data("plugins").split(",");$(this).selectize({plugins:o,delimiter:",",valueField:n,labelField:r,searchField:r,options:[],create:!1,render:{option:function(e,i){for(var t=[],a=l.length,r=0;r<a;r++)t.push(e[l[r]]);return"<div>"+t.join(", ")+"</div>"}},load:function(a,r){if(!a.length||a.length<3)return r();$.ajax({url:ajaxurl,type:s,dataType:"json",data:{action:e,nonce:i,query:a,args:t},error:function(){r()},success:function(e){e.success||alert(e.data),r(e.data)}})},onChange:function(e){$("input[type=hidden]",this.$input.parent()).length&&(null!==e&&e.length?$("input[type=hidden]",this.$input.parent()).val(e.join()):$("input[type=hidden]",this.$input.parent()).val(""))}})}))}function mediaLibraryOrganizerSelectizeDestroy(e){var i=void 0!==e?e:"body",$;($=jQuery)(media_categories_module_selectize.selectors.simple.join(", "),$(i)).each((function(){void 0!==this.selectize&&this.selectize.destroy()})),$(media_categories_module_selectize.selectors.multiple.join(", "),$(i)).each((function(){void 0!==this.selectize&&this.selectize.destroy()})),$(media_categories_module_selectize.selectors.ajax.join(", "),$(i)).each((function(){void 0!==this.selectize&&this.selectize.destroy()}))}