{"ast":null,"code":"import _slicedToArray from \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/slicedToArray\";\n\nvar _this = this,\n _jsxFileName = \"/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/src/AppMenu.js\";\n\nimport React, { useState } from 'react';\nimport { NavLink } from 'react-router-dom';\nimport { CSSTransition } from 'react-transition-group';\nimport classNames from 'classnames';\nimport { Ripple } from \"primereact/ripple\";\nimport { Badge } from 'primereact/badge';\n\nvar AppSubmenu = function AppSubmenu(props) {\n var _useState = useState(null),\n _useState2 = _slicedToArray(_useState, 2),\n activeIndex = _useState2[0],\n setActiveIndex = _useState2[1];\n\n var onMenuItemClick = function onMenuItemClick(event, item, index) {\n //avoid processing disabled items\n if (item.disabled) {\n event.preventDefault();\n return true;\n } //execute command\n\n\n if (item.command) {\n item.command({\n originalEvent: event,\n item: item\n });\n }\n\n if (index === activeIndex) setActiveIndex(null);else setActiveIndex(index);\n\n if (props.onMenuItemClick) {\n props.onMenuItemClick({\n originalEvent: event,\n item: item\n });\n }\n };\n\n var onKeyDown = function onKeyDown(event) {\n if (event.code === 'Enter' || event.code === 'Space') {\n event.preventDefault();\n event.target.click();\n }\n };\n\n var renderLinkContent = function renderLinkContent(item) {\n var submenuIcon = item.items && /*#__PURE__*/React.createElement(\"i\", {\n className: \"pi pi-fw pi-angle-down menuitem-toggle-icon\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 45,\n columnNumber: 41\n }\n });\n var badge = item.badge && /*#__PURE__*/React.createElement(Badge, {\n value: item.badge,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 46,\n columnNumber: 35\n }\n });\n return /*#__PURE__*/React.createElement(React.Fragment, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 49,\n columnNumber: 13\n }\n }, /*#__PURE__*/React.createElement(\"i\", {\n className: item.icon,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 50,\n columnNumber: 17\n }\n }), /*#__PURE__*/React.createElement(\"span\", {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 51,\n columnNumber: 17\n }\n }, item.label), submenuIcon, badge, /*#__PURE__*/React.createElement(Ripple, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 54,\n columnNumber: 17\n }\n }));\n };\n\n var renderLink = function renderLink(item, i) {\n var content = renderLinkContent(item);\n\n if (item.to) {\n return /*#__PURE__*/React.createElement(NavLink, {\n \"aria-label\": item.label,\n onKeyDown: onKeyDown,\n role: \"menuitem\",\n className: \"p-ripple\",\n activeClassName: \"router-link-active router-link-exact-active\",\n to: item.to,\n onClick: function onClick(e) {\n return onMenuItemClick(e, item, i);\n },\n exact: true,\n target: item.target,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 64,\n columnNumber: 17\n }\n }, content);\n } else {\n return /*#__PURE__*/React.createElement(\"a\", {\n tabIndex: \"0\",\n \"aria-label\": item.label,\n onKeyDown: onKeyDown,\n role: \"menuitem\",\n href: item.url,\n className: \"p-ripple\",\n onClick: function onClick(e) {\n return onMenuItemClick(e, item, i);\n },\n target: item.target,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 71,\n columnNumber: 17\n }\n }, content);\n }\n };\n\n var items = props.items && props.items.map(function (item, i) {\n var active = activeIndex === i;\n var styleClass = classNames(item.badgeStyleClass, {\n 'layout-menuitem-category': props.root,\n 'active-menuitem': active && !item.to\n });\n\n if (props.root) {\n return /*#__PURE__*/React.createElement(\"li\", {\n className: styleClass,\n key: i,\n role: \"none\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 84,\n columnNumber: 17\n }\n }, props.root === true && /*#__PURE__*/React.createElement(React.Fragment, {\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 85,\n columnNumber: 45\n }\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"layout-menuitem-root-text\",\n \"aria-label\": item.label,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 86,\n columnNumber: 25\n }\n }, item.label), /*#__PURE__*/React.createElement(AppSubmenu, {\n items: item.items,\n onMenuItemClick: props.onMenuItemClick,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 87,\n columnNumber: 25\n }\n })));\n } else {\n return /*#__PURE__*/React.createElement(\"li\", {\n className: styleClass,\n key: i,\n role: \"none\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 94,\n columnNumber: 17\n }\n }, renderLink(item, i), /*#__PURE__*/React.createElement(CSSTransition, {\n classNames: \"layout-submenu-wrapper\",\n timeout: {\n enter: 1000,\n exit: 450\n },\n in: active,\n unmountOnExit: true,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 96,\n columnNumber: 21\n }\n }, /*#__PURE__*/React.createElement(AppSubmenu, {\n items: item.items,\n onMenuItemClick: props.onMenuItemClick,\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 97,\n columnNumber: 25\n }\n })));\n }\n });\n return items ? /*#__PURE__*/React.createElement(\"ul\", {\n className: props.className,\n role: \"menu\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 104,\n columnNumber: 20\n }\n }, items) : null;\n};\n\nexport var AppMenu = function AppMenu(props) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"layout-menu-container\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 110,\n columnNumber: 9\n }\n }, /*#__PURE__*/React.createElement(AppSubmenu, {\n items: props.model,\n className: \"layout-menu\",\n onMenuItemClick: props.onMenuItemClick,\n root: true,\n role: \"menu\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 111,\n columnNumber: 13\n }\n }), /*#__PURE__*/React.createElement(\"a\", {\n href: \"https://www.primefaces.org/primeblocks-react\",\n className: \"block mt-3\",\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 112,\n columnNumber: 13\n }\n }, /*#__PURE__*/React.createElement(\"img\", {\n alt: \"primeblocks\",\n className: \"w-full\",\n src: props.layoutColorMode === 'light' ? 'assets/layout/images/banner-primeblocks.png' : 'assets/layout/images/banner-primeblocks-dark.png',\n __self: _this,\n __source: {\n fileName: _jsxFileName,\n lineNumber: 113,\n columnNumber: 17\n }\n })));\n};","map":{"version":3,"names":["React","useState","NavLink","CSSTransition","classNames","Ripple","Badge","AppSubmenu","props","activeIndex","setActiveIndex","onMenuItemClick","event","item","index","disabled","preventDefault","command","originalEvent","onKeyDown","code","target","click","renderLinkContent","submenuIcon","items","badge","icon","label","renderLink","i","content","to","e","url","map","active","styleClass","badgeStyleClass","root","enter","exit","className","AppMenu","model","layoutColorMode"],"sources":["/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/src/AppMenu.js"],"sourcesContent":["import React, { useState } from 'react';\nimport { NavLink } from 'react-router-dom';\nimport { CSSTransition } from 'react-transition-group';\nimport classNames from 'classnames';\nimport {Ripple} from \"primereact/ripple\";\nimport { Badge } from 'primereact/badge';\n\nconst AppSubmenu = (props) => {\n\n const [activeIndex, setActiveIndex] = useState(null)\n\n const onMenuItemClick = (event, item, index) => {\n //avoid processing disabled items\n if (item.disabled) {\n event.preventDefault();\n return true;\n }\n\n //execute command\n if (item.command) {\n item.command({ originalEvent: event, item: item });\n }\n\n if (index === activeIndex)\n setActiveIndex(null);\n else\n setActiveIndex(index);\n\n if (props.onMenuItemClick) {\n props.onMenuItemClick({\n originalEvent: event,\n item: item\n });\n }\n }\n\n const onKeyDown = (event) => {\n if (event.code === 'Enter' || event.code === 'Space'){\n event.preventDefault();\n event.target.click();\n }\n }\n\n const renderLinkContent = (item) => {\n let submenuIcon = item.items && ;\n let badge = item.badge &&