Liferay.Loader.define("knowledge-base-web@5.0.98/admin/js/components/VerticalBar",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/core","@frontend-taglib-clay$clayui/loading-indicator","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=_interopRequireDefault(a("@frontend-taglib-clay$clayui/loading-indicator")),i=a("frontend-js-web"),o=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(a("liferay!frontend-js-react-web$react")));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();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]}return a.default=e,t&&t.set(e,a),a}const e=o.default.lazy((()=>Promise.resolve().then((()=>_interopRequireWildcard(a("./NavigationPanel")))))),d=o.default.lazy((()=>Promise.resolve().then((()=>_interopRequireWildcard(a("./SuggestionsPanel")))))),c=o.default.lazy((()=>Promise.resolve().then((()=>_interopRequireWildcard(a("./TemplatesPanel")))))),u="expanded",s=300,f="suggestion";var _default=({items:t,moveKBObjectURL:a,parentContainerId:p,portletNamespace:y,productMenuOpen:m})=>{var g;const v=document.getElementById(p),[b,_]=(0,o.useState)(m),[h,j]=(0,o.useState)(null===(g=t.find((({active:e})=>e)))||void 0===g?void 0:g.key),[P,E]=(0,o.useState)(!m&&h!==f),q=Liferay.SideNavigation.instance(document.querySelector(".product-menu-toggle"));(0,o.useEffect)((()=>{const onProductMenuChange=({open:e})=>{_(e),e?E(!1):h!==f&&setTimeout((()=>{E(!0)}),s)},e=null==q?void 0:q.on("closed.lexicon.sidenav",(()=>onProductMenuChange({open:!1}))),t=null==q?void 0:q.on("openStart.lexicon.sidenav",(()=>onProductMenuChange({open:!0})));return m&&setTimeout((()=>{q.hide()}),s),()=>{null==e||e.removeListener(),null==t||t.removeListener(),null==q||q.destroy()}}),[h,m,q]),(0,o.useEffect)((()=>{v.classList.toggle(u,Boolean(h!==f&&P&&h)),h===f&&v.classList.add("not-expandable")}),[h,v,P]);const w={article:e,suggestion:d,template:c};return o.default.createElement(r.VerticalBar,{absolute:!0,active:P&&h?h:null,onActiveChange:e=>{if(E(e!==f&&(t=>Boolean(e)&&!(e===h&&t))),e){if(e!==h){var a;j(e);const n=null===(a=t.find((({key:t})=>t===e)))||void 0===a?void 0:a.href;if(b&&e!==f){const e=q.on("closed.lexicon.sidenav",(()=>{e.removeListener(),(0,i.navigate)(n)}))}else(0,i.navigate)(n)}b&&e!==f&&q.hide()}},position:"left"},o.default.createElement(r.VerticalBar.Bar,{displayType:"light",items:t},(e=>o.default.createElement(r.VerticalBar.Item,{key:e.key},o.default.createElement(n.ClayButtonWithIcon,{"aria-label":Liferay.Language.get(e.title),"data-tooltip-align":"right",displayType:"unstyled",symbol:e.icon,title:Liferay.Language.get(e.title)})))),o.default.createElement(r.VerticalBar.Content,{items:t},(e=>{const t=w[e.key];return o.default.createElement(r.VerticalBar.Panel,{key:e.key},o.default.createElement("div",{className:"sidebar-header"},o.default.createElement("div",{className:"component-title"},e.title)),o.default.createElement("div",{className:"sidebar-body"},o.default.createElement(o.Suspense,{fallback:o.default.createElement(l.default,null)},o.default.createElement(t,{items:e.navigationItems,moveKBObjectURL:a,portletNamespace:y,selectedItemId:e.selectedItemId}))))})))};t.default=_default}}));
//# sourceMappingURL=VerticalBar.js.map