text: "use strict";define("composer/categoryList",["categorySelector"],function(e){var t={};t.init=function(t,c){var a=t.find(".category-list-container");if(!a.length){return}t.on("action:composer.resize",function(){r(t)});socket.emit("categories.getCategoriesByPrivilege","topics:create",function(o,s){if(o){return app.alertError(o.message)}var l=[];s=s.filter(function(e){return e&&!e.link});var d={};s.forEach(function(e){e.children=[];d[e.cid]=e});s.forEach(function(e){if(e.parent){var t=e.parent.cid;if(!d[t]){d[t]=e.parent;d[t].disabledClass=true}d[t].children=d[t].children||[];d[t].children.push(e)}});var f=[];Object.keys(d).forEach(function(e){if(!d[e].parent){f.push(d[e])}});f=f.sort(function(e,t){return e.order-t.order});f.forEach(function(e){n(e,l,"")});app.parseAndTranslate("partials/category-selector",{categories:l,pullRight:true},function(n){a.append(n);e.init(a.find('[component="category-selector"]'),function(e){if(c.hasOwnProperty("cid")){i(t,c,e.cid)}$("[tabindex="+(parseInt($(this).attr("tabindex"),10)+1)+"]").trigger("focus")});if(c.cid){e.selectCategory(c.cid)}var o=e.getSelectedCategory();$(".category-name").translateText(o?o.name:"[[modules:composer.select_category]]");$(".category-selector").find('li[data-cid="'+c.cid+'"]').addClass("active");r(t)})});$(".category-selector").on("click","li",function(){$(".category-name").text($(this).text());$(".category-selector").removeClass("open");$(".category-selector li").removeClass("active");$(this).addClass("active");var r=$(this).attr("data-cid");e.selectCategory(r);if(c.hasOwnProperty("cid")){i(t,c,r)}})};function r(e){e.find('.category-list-container [component="category-selector"]').toggleClass("dropup",e.outerHeight()<$(window).height()/2)}t.getSelectedCid=function(){var t=e.getSelectedCategory();return t?t.cid:0};function i(e,t,r){t.cid=r;require(["composer/tags"],function(i){i.onChangeCategory(e,t,r)})}function n(e,t,r){if(e.link){return}var i=r?"&bull; ":"";e.value=e.cid;e.level=r;e.text=r+i+e.name;t.push(e);$('<li data-cid="'+e.cid+'">'+e.name+"</li>").appendTo($(".category-selector"));e.children.forEach(function(e){n(e,t,"&nbsp;&nbsp;&nbsp;&nbsp;"+r)})}return t});
  //# sourceMappingURL=node_modules/nodebb-plugin-composer-default/static/lib/composer/categoryList.js.map