Liferay.Loader.define("knowledge-base-web@5.0.60/admin/js/components/VerticalBar",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/core","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./NavigationPanel","./SuggestionsPanel","./TemplatesPanel"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a("@frontend-taglib-clay$clayui/button"),r=a("@frontend-taglib-clay$clayui/core"),l=a("frontend-js-web"),i=(u(a("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"))),o=u(a("./NavigationPanel")),c=u(a("./SuggestionsPanel")),d=u(a("./TemplatesPanel"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function u(e){return e&&e.__esModule?e:{default:e}}const e="expanded",y="suggestion";var f=({items:t,parentContainerId:a,productMenuOpen:s})=>{var u;const f=document.getElementById(a),[p,m]=(0,i.useState)(s),[g,v]=(0,i.useState)(null===(u=t.find((({active:e})=>e)))||void 0===u?void 0:u.key),[b,j]=(0,i.useState)(!s&&g!==y),w=Liferay.SideNavigation.instance(document.querySelector(".product-menu-toggle"));(0,i.useEffect)((()=>{if(w&&g!==y){const e=w.on("openStart.lexicon.sidenav",(()=>{m(!0),j(!1)})),t=w.on("closedStart.lexicon.sidenav",(()=>{m(!1)}));return()=>{e.removeListener(),t.removeListener()}}}),[g,w]),(0,i.useEffect)((()=>{f.classList.toggle(e,Boolean(g!==y&&b&&g)),g===y&&f.classList.add("not-expandable")}),[g,f,b]);const E={article:o.default,suggestion:c.default,template:d.default};return i.default.createElement(r.VerticalBar,{absolute:!0,active:b&&g?g:null,onActiveChange:e=>{if(j(e!==y&&(t=>Boolean(e)&&!(e===g&&t))),e){if(e!==g){var a;v(e);const n=null===(a=t.find((({key:t})=>t===e)))||void 0===a?void 0:a.href;if(p&&e!==y){const e=w.on("closed.lexicon.sidenav",(()=>{e.removeListener(),(0,l.navigate)(n)}))}else(0,l.navigate)(n)}p&&e!==y&&w.hide()}},position:"left"},i.default.createElement(r.VerticalBar.Bar,{displayType:"light",items:t},(e=>i.default.createElement(r.VerticalBar.Item,{key:e.key},i.default.createElement(n.ClayButtonWithIcon,{"data-tooltip-align":"right",displayType:"unstyled",symbol:e.icon,title:Liferay.Language.get(e.title)})))),i.default.createElement(r.VerticalBar.Content,{items:t},(e=>{const t=E[e.key];return i.default.createElement(r.VerticalBar.Panel,{key:e.key},i.default.createElement("div",{className:"sidebar-header"},i.default.createElement("div",{className:"component-title"},e.title)),i.default.createElement("div",{className:"sidebar-body"},i.default.createElement(t,{items:e.navigationItems,selectedItemId:e.selectedItemId})))})))};t.default=f}}));
//# sourceMappingURL=VerticalBar.js.map