Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.150/admin/js/components/ManagementToolbar.es",["module","exports","require","@liferay/frontend-js-react-web","data-engine-js-components-web","liferay!frontend-js-react-web$react"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.ManagementToolbar=function ManagementToolbar({onPlusClick:e,onPreviewClick:t,onPublishClick:n,onSaveClick:c,onSettingsClick:d,onShareClick:l,portletNamespace:i,variant:a="builder"}){const{published:u,showPublishAlert:m}=(0,o.useConfig)();return(0,s.useEffect)((()=>{const e=document.querySelector("#".concat(i,"managementToolbar"));return("builder"===a?toggleFormBuilder:toggleRules)(e)}),[]),(0,s.useEffect)((()=>{const t=document.getElementById("addFieldButton");e?t.classList.remove("hide"):t.classList.add("hide")}),[e]),(0,s.useEffect)((()=>{const e=document.querySelector(".lfr-ddm-share-url-button");m&&u&&e.removeAttribute("title")}),[m,u]),(0,r.useEventListener)("click",e,!0,document.getElementById("addFieldButton")),(0,r.useEventListener)("click",t,!0,document.querySelector(".lfr-ddm-preview-button")),(0,r.useEventListener)("click",n,!0,document.querySelector(".lfr-ddm-publish-button")),(0,r.useEventListener)("click",c,!0,document.querySelector(".lfr-ddm-save-button")),(0,r.useEventListener)("click",l,!0,document.querySelector(".lfr-ddm-share-url-button")),(0,r.useEventListener)("click",d,!0,document.querySelector(".lfr-ddm-settings-button")),null};var r=n("@liferay/frontend-js-react-web"),o=n("data-engine-js-components-web"),s=n("liferay!frontend-js-react-web$react");const toggleFormBuilder=e=>{const t=document.querySelectorAll(".toolbar-group-field .nav-item .lfr-ddm-button"),n=document.querySelector(".publish-icon");return e&&e.classList.remove("hide"),t.forEach((e=>{e.classList.remove("hide")})),n&&n.classList.remove("hide"),()=>{e&&e.classList.add("hide"),t.forEach((e=>{e.classList.add("hide")})),n&&n.classList.add("hide")}},toggleRules=e=>{const t=document.querySelectorAll(".toolbar-group-field .nav-item .lfr-ddm-button");return e.classList.remove("hide"),t.forEach((e=>{e.classList.add("hide")})),()=>{e.classList.add("hide")}}}}));
//# sourceMappingURL=ManagementToolbar.es.js.map