this.primereact=this.primereact||{},this.primereact.contextmenu=function(e,t,n,i,r,o,s){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(t),a=u(s);function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;ni.width-n.DomHandler.calculateScrollbarWidth()?-1*r+"px":o+"px"}},{key:"onEnter",value:function(){this.position()}},{key:"isActive",value:function(){return this.props.root||!this.props.resetMenu}},{key:"componentDidUpdate",value:function(){this.isActive()&&this.position()}},{key:"renderSeparator",value:function(e){return l.default.createElement("li",{key:"separator_"+e,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(e){return e.items?l.default.createElement(o,{model:e.items,resetMenu:e!==this.state.activeItem,onLeafClick:this.props.onLeafClick}):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),u=n.classNames("p-menuitem-link",{"p-disabled":e.disabled}),a=n.classNames("p-menuitem-icon",e.icon),c="p-submenu-icon pi pi-angle-right",m=e.icon&&l.default.createElement("span",{className:a}),f=e.label&&l.default.createElement("span",{className:"p-menuitem-text"},e.label),d=e.items&&l.default.createElement("span",{className:c}),p=this.renderSubmenu(e),h=l.default.createElement("a",{href:e.url||"#",className:u,target:e.target,onClick:function(n){return i.onItemClick(n,e,t)},role:"menuitem","aria-haspopup":null!=e.items,"aria-disabled":e.disabled},m,f,d,l.default.createElement(r.Ripple,null));e.template&&(h=n.ObjectUtils.getJSXElement(e.template,e,{onClick:function(n){return i.onItemClick(n,e,t)},className:u,labelClassName:"p-menuitem-text",iconClassName:a,submenuIconClassName:c,element:h,props:this.props,active:o}));return l.default.createElement("li",{key:e.label+"_"+t,role:"none",className:s,style:e.style,onMouseEnter:function(t){return i.onItemMouseEnter(t,e)}},h,p)}},{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=n.classNames({"p-submenu-list":!this.props.root}),t=this.renderMenu(),r=this.isActive();return l.default.createElement(i.CSSTransition,{nodeRef:this.submenuRef,classNames:"p-contextmenusub",in:r,timeout:{enter:0,exit:0},unmountOnExit:!0,onEnter:this.onEnter},l.default.createElement("ul",{ref:this.submenuRef,className:e},t))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!0===e.resetMenu?{activeItem:null}:null}}]),o}(t.Component);E(C,"defaultProps",{model:null,root:!1,className:null,resetMenu:!1,onLeafClick:null});var x=function(e){h(r,e);var t=k(r);function r(e){var n;return c(this,r),(n=t.call(this,e)).state={visible:!1,reshow:!1,resetMenu:!1},n.onMenuClick=n.onMenuClick.bind(d(n)),n.onLeafClick=n.onLeafClick.bind(d(n)),n.onMenuMouseEnter=n.onMenuMouseEnter.bind(d(n)),n.onEnter=n.onEnter.bind(d(n)),n.onEntered=n.onEntered.bind(d(n)),n.onExit=n.onExit.bind(d(n)),n.onExited=n.onExited.bind(d(n)),n.menuRef=l.default.createRef(),n}return f(r,[{key:"onMenuClick",value:function(){this.setState({resetMenu:!1})}},{key:"onMenuMouseEnter",value:function(){this.setState({resetMenu:!1})}},{key:"show",value:function(e){var t=this;e instanceof Event||e.persist(),e.stopPropagation(),e.preventDefault(),this.currentEvent=e,this.state.visible?this.setState({reshow:!0}):this.setState({visible:!0},(function(){t.props.onShow&&t.props.onShow(t.currentEvent)}))}},{key:"hide",value:function(e){var t=this;e instanceof Event||e.persist(),this.currentEvent=e,this.setState({visible:!1,reshow:!1},(function(){t.props.onHide&&t.props.onHide(t.currentEvent)}))}},{key:"onEnter",value:function(){this.props.autoZIndex&&n.ZIndexUtils.set("menu",this.menuRef.current,a.default.autoZIndex,this.props.baseZIndex||a.default.zIndex.menu),this.position(this.currentEvent)}},{key:"onEntered",value:function(){this.bindDocumentListeners()}},{key:"onExit",value:function(){this.currentEvent=null,this.unbindDocumentListeners()}},{key:"onExited",value:function(){n.ZIndexUtils.clear(this.menuRef.current)}},{key:"position",value:function(e){if(e){var t=e.pageX+1,i=e.pageY+1,r=this.menuRef.current.offsetParent?this.menuRef.current.offsetWidth:n.DomHandler.getHiddenElementOuterWidth(this.menuRef.current),o=this.menuRef.current.offsetParent?this.menuRef.current.offsetHeight:n.DomHandler.getHiddenElementOuterHeight(this.menuRef.current),s=n.DomHandler.getViewport();t+r-document.body.scrollLeft>s.width&&(t-=r),i+o-document.body.scrollTop>s.height&&(i-=o),t