Liferay.Loader.define("asset-categories-admin-web@5.0.56/js/ItemSelectorAddCategory",["module","exports","require","frontend-js-web"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({currentURL:t,namespace:a,redirect:o}){document.querySelector(".lfr-form-content .sheet").classList.add("border-0");const c=(0,n.getOpener)(),d=c.document.querySelector(".modal-title"),r=d.textContent;d.textContent="".concat(d.textContent," - ").concat(Liferay.Language.get("add-new"));const l=c.document.querySelectorAll(".liferay-modal .modal-footer .btn-group-item");l.forEach((e=>{e.classList.add("hide")}));const s=c.document.querySelector(".modal-footer .btn-group"),i=s.querySelectorAll(".add-category-toolbar-button");if(i.length)i.forEach((e=>{e.parentElement.classList.remove("hide")}));else{[e({action:"cancel",buttonClass:"btn-link",label:Liferay.Language.get("cancel"),type:"button"}),e({action:"saveAndAddNew",buttonClass:"btn-secondary",label:Liferay.Language.get("save-and-add-a-new-one")}),e({action:"save",buttonClass:"btn-primary",label:Liferay.Language.get("save")})].forEach((e=>s.appendChild(e)))}const u=(0,n.delegate)(s,"click",".add-category-toolbar-button",(e=>{const c=e.delegateTarget.dataset.action;"cancel"===c?(0,n.navigate)(o):"saveAndAddNew"===c?(document.getElementById("".concat(a,"redirect")).value=t,submitForm(document.getElementById("".concat(a,"fm")))):"save"===c&&submitForm(document.getElementById("".concat(a,"fm")))}));return{dispose:()=>{l.forEach((e=>{e.classList.remove("hide")})),s.querySelectorAll(".add-category-toolbar-button").forEach((e=>e.parentElement.classList.add("hide"))),d.textContent=r,u.dispose()}}};var n=a("frontend-js-web");const e=({action:e,buttonClass:t,label:a,type:n="submit"})=>{const o=document.createElement("div");o.classList.add("btn-group-item");const c=document.createElement("button");return c.classList.add("add-category-toolbar-button","btn",t),c.dataset.action=e,c.textContent=a,c.type=n,o.appendChild(c),o}}}));
//# sourceMappingURL=ItemSelectorAddCategory.js.map