text: this.hassanreact=this.hassanreact||{},this.hassanreact.tieredmenu=function(e,t,n){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(t);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function l(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),e}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var v=function(e){c(u,e);var t,i,s=(t=u,i=h(),function(){var e,n=d(t);if(i){var r=d(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return p(this,e)});function u(e){var t;return o(this,u),(t=s.call(this,e)).state={activeItem:null},t.onLeafClick=t.onLeafClick.bind(a(t)),t.onChildItemKeyDown=t.onChildItemKeyDown.bind(a(t)),t}return l(u,[{key:"componentDidUpdate",value:function(e){e.parentActive&&!this.props.parentActive&&this.setState({activeItem:null}),this.props.parentActive&&!this.props.root&&this.position()}},{key:"componentDidMount",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.element&&!e.element.contains(t.target)&&e.setState({activeItem:null})},document.addEventListener("click",this.documentClickListener))}},{key:"componentWillUnmount",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"position",value:function(){if(this.element){var e=this.element.parentElement,t=n.DomHandler.getOffset(e),i=n.DomHandler.getViewport(),r=this.element.offsetParent?this.element.offsetWidth:n.DomHandler.getHiddenElementOuterWidth(this.element),o=n.DomHandler.getOuterWidth(e.children[0]);parseInt(t.left,10)+o+r>i.width-n.DomHandler.calculateScrollbarWidth()&&n.DomHandler.addClass(this.element,"p-submenu-list-flipped")}}},{key:"onItemMouseEnter",value:function(e,t){t.disabled?e.preventDefault():this.props.root?(this.state.activeItem||this.props.popup)&&this.setState({activeItem:t}):this.setState({activeItem:t})}},{key:"onItemClick",value:function(e,t){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),this.props.root&&t.items&&this.setState(this.state.activeItem&&t===this.state.activeItem?{activeItem:null}:{activeItem:t}),t.items||this.onLeafClick())}},{key:"onItemKeyDown",value:function(e,t){var n=e.currentTarget.parentElement;switch(e.which){case 40:var i=this.findNextItem(n);i&&i.children[0].focus(),e.preventDefault();break;case 38:var r=this.findPrevItem(n);r&&r.children[0].focus(),e.preventDefault();break;case 39:t.items&&(this.setState({activeItem:t}),setTimeout((function(){n.children[1].children[0].children[0].focus()}),50)),e.preventDefault()}this.props.onKeyDown&&this.props.onKeyDown(e,n)}},{key:"onChildItemKeyDown",value:function(e,t){37===e.which&&(this.setState({activeItem:null}),t.parentElement.previousElementSibling.focus())}},{key:"findNextItem",value:function(e){var t=e.nextElementSibling;return t?n.DomHandler.hasClass(t,"p-disabled")||!n.DomHandler.hasClass(t,"p-menuitem")?this.findNextItem(t):t:null}},{key:"findPrevItem",value:function(e){var t=e.previousElementSibling;return t?n.DomHandler.hasClass(t,"p-disabled")||!n.DomHandler.hasClass(t,"p-menuitem")?this.findPrevItem(t):t:null}},{key:"onLeafClick",value:function(){this.setState({activeItem:null}),this.props.onLeafClick&&this.props.onLeafClick()}},{key:"renderSeparator",value:function(e){return r.default.createElement("li",{key:"separator_"+e,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(e){return e.items?r.default.createElement(u,{model:e.items,onLeafClick:this.onLeafClick,popup:this.props.popup,onKeyDown:this.onChildItemKeyDown,parentActive:e===this.state.activeItem}):null}},{key:"renderMenuitem",value:function(e,t){var i=this,o=this.state.activeItem===e,s=n.classNames("p-menuitem",{"p-menuitem-active":o},e.className),l=n.classNames("p-menuitem-link",{"p-disabled":e.disabled}),a=n.classNames("p-menuitem-icon",e.icon),u="p-submenu-icon pi pi-angle-right",c=e.icon&&r.default.createElement("span",{className:a}),m=e.label&&r.default.createElement("span",{className:"p-menuitem-text"},e.label),p=e.items&&r.default.createElement("span",{className:u}),d=this.renderSubmenu(e),f=r.default.createElement("a",{href:e.url||"#",className:l,target:e.target,role:"menuitem","aria-haspopup":null!=e.items,onClick:function(t){return i.onItemClick(t,e)},onKeyDown:function(t){return i.onItemKeyDown(t,e)},"aria-disabled":e.disabled},c,m,p,r.default.createElement(n.Ripple,null));e.template&&(f=n.ObjectUtils.getJSXElement(e.template,e,{onClick:function(t){return i.onItemClick(t,e)},onKeyDown:function(t){return i.onItemKeyDown(t,e)},className:l,labelClassName:"p-menuitem-text",iconClassName:a,submenuIconClassName:u,element:f,props:this.props,active:o}));return r.default.createElement("li",{key:e.label+"_"+t,className:s,style:e.style,onMouseEnter:function(t){return i.onItemMouseEnter(t,e)},role:"none"},f,d)}},{key:"renderItem",value:function(e,t){return e.separator?this.renderSeparator(t):this.renderMenuitem(e,t)}},{key:"renderMenu",value:function(){var e=this;return this.props.model?this.props.model.map((function(t,n){return e.renderItem(t,n)})):null}},{key:"render",value:function(){var e=this,t=n.classNames({"p-submenu-list":!this.props.root}),i=this.renderMenu();return r.default.createElement("ul",{ref:function(t){return e.element=t},className:t,role:this.props.root?"menubar":"menu","aria-orientation":"horizontal"},i)}}]),u}(t.Component);function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}f(v,"defaultProps",{model:null,root:!1,className:null,popup:!1,onLeafClick:null,onKeyDown:null,parentActive:!1});var b=function(e){c(u,e);var t,i,s=(t=u,i=y(),function(){var e,n=d(t);if(i){var r=d(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return p(this,e)});function u(e){var t;return o(this,u),(t=s.call(this,e)).state={visible:!e.popup},t.onEnter=t.onEnter.bind(a(t)),t.onEntered=t.onEntered.bind(a(t)),t.onExit=t.onExit.bind(a(t)),t.onExited=t.onExited.bind(a(t)),t.onPanelClick=t.onPanelClick.bind(a(t)),t.menuRef=r.default.createRef(),t}return l(u,[{key:"onPanelClick",value:function(e){this.props.popup&&n.OverlayService.emit("overlay-click",{originalEvent:e,target:this.target})}},{key:"toggle",value:function(e){this.props.popup&&(this.state.visible?this.hide(e):this.show(e))}},{key:"show",value:function(e){var t=this;this.target=e.currentTarget;var n=e;this.setState({visible:!0},(function(){t.props.onShow&&t.props.onShow(n)}))}},{key:"hide",value:function(e){var t=this,n=e;this.setState({visible:!1},(function(){t.props.onHide&&t.props.onHide(n)}))}},{key:"onEnter",value:function(){this.props.autoZIndex&&n.ZIndexUtils.set("menu",this.menuRef.current,this.props.baseZIndex),n.DomHandler.absolutePosition(this.menuRef.current,this.target)}},{key:"onEntered",value:function(){this.bindDocumentListeners(),this.bindScrollListener()}},{key:"onExit",value:function(){this.target=null,this.unbindDocumentListeners(),this.unbindScrollListener()}},{key:"onExited",value:function(){n.ZIndexUtils.clear(this.menuRef.current)}},{key:"bindDocumentListeners",value:function(){this.bindDocumentClickListener(),this.bindDocumentResizeListener()}},{key:"unbindDocumentListeners",value:function(){this.unbindDocumentClickListener(),this.unbindDocumentResizeListener()}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.props.popup&&e.state.visible&&e.menuRef.current&&!e.menuRef.current.contains(t.target)&&e.hide(t)},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindDocumentResizeListener",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(t){e.state.visible&&!n.DomHandler.isAndroid()&&e.hide(t)},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new n.ConnectedOverlayScrollHandler(this.target,(function(t){e.state.visible&&e.hide(t)}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"componentWillUnmount",value:function(){this.unbindDocumentListeners(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),n.ZIndexUtils.clear(this.menuRef.current)}},{key:"renderElement",value:function(){var e=n.classNames("p-tieredmenu p-component",{"p-tieredmenu-overlay":this.props.popup},this.props.className);return r.default.createElement(n.CSSTransition,{nodeRef:this.menuRef,classNames:"p-connected-overlay",in:this.state.visible,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},r.default.createElement("div",{ref:this.menuRef,id:this.props.id,className:e,style:this.props.style,onClick:this.onPanelClick},r.default.createElement(v,{model:this.props.model,root:!0,popup:this.props.popup})))}},{key:"render",value:function(){var e=this.renderElement();return this.props.popup?r.default.createElement(n.Portal,{element:e,appendTo:this.props.appendTo}):e}}]),u}(t.Component);return f(b,"defaultProps",{id:null,model:null,popup:!1,style:null,className:null,autoZIndex:!0,baseZIndex:0,appendTo:null,transitionOptions:null,onShow:null,onHide:null}),e.TieredMenu=b,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,hassanreact.core);
  