Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.170/page_editor/app/hooks/app_hooks/useProductMenuHandler",["module","exports","require","liferay!frontend-js-react-web$react","../../actions/index","../../contexts/StoreContext","../../selectors/selectSidebarIsOpened","../../utils/hideProductMenuIfPresent"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function useProductMenuHandler(){const e=(0,i.useDispatch)(),t=(0,r.useRef)(!0),n=(0,i.useSelector)(u.default),d=(0,i.useSelector)((e=>e.sidebar.hidden));(0,r.useEffect)((()=>{(0,a.default)({onHide:()=>{e((0,o.switchSidebarPanel)({sidebarOpen:!0}))}})}),[e]),(0,r.useEffect)((()=>{var r;const i=null===(r=Liferay.SideNavigation)||void 0===r?void 0:r.instance(document.querySelector(".product-menu-toggle")),onProductMenuChange=({open:r})=>{d||(r?(t.current=n,e((0,o.switchSidebarPanel)({itemConfigurationOpen:!1,sidebarOpen:!1}))):e((0,o.switchSidebarPanel)({itemConfigurationOpen:!0,sidebarOpen:t.current})))},u=null==i?void 0:i.on("closed.lexicon.sidenav",(()=>onProductMenuChange({open:!1}))),a=null==i?void 0:i.on("openStart.lexicon.sidenav",(()=>onProductMenuChange({open:!0})));return()=>{null==u||u.removeListener(),null==a||a.removeListener()}}),[e,n,d])};var r=n("liferay!frontend-js-react-web$react"),o=n("../../actions/index"),i=n("../../contexts/StoreContext"),u=_interopRequireDefault(n("../../selectors/selectSidebarIsOpened")),a=_interopRequireDefault(n("../../utils/hideProductMenuIfPresent"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=useProductMenuHandler.js.map