import{B as W,s as G,d as H,f as L,bj as J,m as l,R as X,p as P,q as Y,o as c,u as v,v as x,c as h,W as K,X as Q,y as p,x as $,A as S,z as ee,C as b,O as F,T as N,Z as C,a3 as y,aF as te,af as A,ak as E,Y as ne,$ as ie,ah as _,a5 as se,aj as D,a7 as re,K as k,j as z,E as ae,H as oe,G as ue,F as ce,J as T,S as R,b as de,L as g,M as le}from"./CVN9mXi8.js";import{U as B,C as me}from"./Cnr6hwyY.js";import{O as he}from"./2PnuRw05.js";import{s as fe}from"./oLVS05MJ.js";import{s as Ie}from"./BuPR-zpu.js";import{u as be}from"./-gLlQWsu.js";var pe=function(e){var t=e.dt;return`
.p-tieredmenu {
    background: `.concat(t("tieredmenu.background"),`;
    color: `).concat(t("tieredmenu.color"),`;
    border: 1px solid `).concat(t("tieredmenu.border.color"),`;
    border-radius: `).concat(t("tieredmenu.border.radius"),`;
    min-width: 12.5rem;
}

.p-tieredmenu-root-list,
.p-tieredmenu-submenu {
    margin: 0;
    padding: `).concat(t("tieredmenu.list.padding"),`;
    list-style: none;
    outline: 0 none;
    display: flex;
    flex-direction: column;
    gap: `).concat(t("tieredmenu.list.gap"),`;
}

.p-tieredmenu-submenu {
    position: absolute;
    min-width: 100%;
    z-index: 1;
    background: `).concat(t("tieredmenu.background"),`;
    color: `).concat(t("tieredmenu.color"),`;
    border: 1px solid `).concat(t("tieredmenu.border.color"),`;
    border-radius: `).concat(t("tieredmenu.border.radius"),`;
    box-shadow: `).concat(t("tieredmenu.shadow"),`;
}

.p-tieredmenu-item {
    position: relative;
}

.p-tieredmenu-item-content {
    transition: background `).concat(t("tieredmenu.transition.duration"),", color ").concat(t("tieredmenu.transition.duration"),`;
    border-radius: `).concat(t("tieredmenu.item.border.radius"),`;
    color: `).concat(t("tieredmenu.item.color"),`;
}

.p-tieredmenu-item-link {
    cursor: pointer;
    display: flex;
    align-items: center;
    text-decoration: none;
    overflow: hidden;
    position: relative;
    color: inherit;
    padding: `).concat(t("tieredmenu.item.padding"),`;
    gap: `).concat(t("tieredmenu.item.gap"),`;
    user-select: none;
    outline: 0 none;
}

.p-tieredmenu-item-label {
    line-height: 1;
}

.p-tieredmenu-item-icon {
    color: `).concat(t("tieredmenu.item.icon.color"),`;
}

.p-tieredmenu-submenu-icon {
    color: `).concat(t("tieredmenu.submenu.icon.color"),`;
    margin-left: auto;
    font-size: `).concat(t("tieredmenu.submenu.icon.size"),`;
    width: `).concat(t("tieredmenu.submenu.icon.size"),`;
    height: `).concat(t("tieredmenu.submenu.icon.size"),`;
}

.p-tieredmenu-submenu-icon:dir(rtl) {
    margin-left: 0;
    margin-right: auto;
}

.p-tieredmenu-item.p-focus > .p-tieredmenu-item-content {
    color: `).concat(t("tieredmenu.item.focus.color"),`;
    background: `).concat(t("tieredmenu.item.focus.background"),`;
}

.p-tieredmenu-item.p-focus > .p-tieredmenu-item-content .p-tieredmenu-item-icon {
    color: `).concat(t("tieredmenu.item.icon.focus.color"),`;
}

.p-tieredmenu-item.p-focus > .p-tieredmenu-item-content .p-tieredmenu-submenu-icon {
    color: `).concat(t("tieredmenu.submenu.icon.focus.color"),`;
}

.p-tieredmenu-item:not(.p-disabled) > .p-tieredmenu-item-content:hover {
    color: `).concat(t("tieredmenu.item.focus.color"),`;
    background: `).concat(t("tieredmenu.item.focus.background"),`;
}

.p-tieredmenu-item:not(.p-disabled) > .p-tieredmenu-item-content:hover .p-tieredmenu-item-icon {
    color: `).concat(t("tieredmenu.item.icon.focus.color"),`;
}

.p-tieredmenu-item:not(.p-disabled) > .p-tieredmenu-item-content:hover .p-tieredmenu-submenu-icon {
    color: `).concat(t("tieredmenu.submenu.icon.focus.color"),`;
}

.p-tieredmenu-item-active > .p-tieredmenu-item-content {
    color: `).concat(t("tieredmenu.item.active.color"),`;
    background: `).concat(t("tieredmenu.item.active.background"),`;
}

.p-tieredmenu-item-active > .p-tieredmenu-item-content .p-tieredmenu-item-icon {
    color: `).concat(t("tieredmenu.item.icon.active.color"),`;
}

.p-tieredmenu-item-active > .p-tieredmenu-item-content .p-tieredmenu-submenu-icon {
    color: `).concat(t("tieredmenu.submenu.icon.active.color"),`;
}

.p-tieredmenu-separator {
    border-block-start: 1px solid `).concat(t("tieredmenu.separator.border.color"),`;
}

.p-tieredmenu-overlay {
    box-shadow: `).concat(t("tieredmenu.shadow"),`;
}

.p-tieredmenu-enter-from,
.p-tieredmenu-leave-active {
    opacity: 0;
}

.p-tieredmenu-enter-active {
    transition: opacity 250ms;
}

.p-tieredmenu-mobile .p-tieredmenu-submenu {
    position: static;
    box-shadow: none;
    border: 0 none;
    padding-inline-start: `).concat(t("tieredmenu.submenu.mobile.indent"),`;
    padding-inline-end: 0;
}

.p-tieredmenu-mobile .p-tieredmenu-submenu:dir(rtl) {
    padding-inline-start: 0;
    padding-inline-end: `).concat(t("tieredmenu.submenu.mobile.indent"),`;
}

.p-tieredmenu-mobile .p-tieredmenu-submenu-icon {
    transition: transform 0.2s;
    transform: rotate(90deg);
}

.p-tieredmenu-mobile .p-tieredmenu-item-active > .p-tieredmenu-item-content .p-tieredmenu-submenu-icon {
    transform: rotate(-90deg);
}
`)},ve={submenu:function(e){var t=e.instance,s=e.processedItem;return{display:t.isItemActive(s)?"flex":"none"}}},ge={root:function(e){var t=e.props,s=e.instance;return["p-tieredmenu p-component",{"p-tieredmenu-overlay":t.popup,"p-tieredmenu-mobile":s.queryMatches}]},start:"p-tieredmenu-start",rootList:"p-tieredmenu-root-list",item:function(e){var t=e.instance,s=e.processedItem;return["p-tieredmenu-item",{"p-tieredmenu-item-active":t.isItemActive(s),"p-focus":t.isItemFocused(s),"p-disabled":t.isItemDisabled(s)}]},itemContent:"p-tieredmenu-item-content",itemLink:"p-tieredmenu-item-link",itemIcon:"p-tieredmenu-item-icon",itemLabel:"p-tieredmenu-item-label",submenuIcon:"p-tieredmenu-submenu-icon",submenu:"p-tieredmenu-submenu",separator:"p-tieredmenu-separator",end:"p-tieredmenu-end"},ye=W.extend({name:"tieredmenu",theme:pe,classes:ge,inlineStyles:ve}),ke={name:"BaseTieredMenu",extends:G,props:{popup:{type:Boolean,default:!1},model:{type:Array,default:null},appendTo:{type:[String,Object],default:"body"},breakpoint:{type:String,default:"960px"},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},disabled:{type:Boolean,default:!1},tabindex:{type:Number,default:0},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:ye,provide:function(){return{$pcTieredMenu:this,$parentInstance:this}}},U={name:"TieredMenuSub",hostName:"TieredMenu",extends:G,emits:["item-click","item-mouseenter","item-mousemove"],container:null,props:{menuId:{type:String,default:null},focusedItemId:{type:String,default:null},items:{type:Array,default:null},visible:{type:Boolean,default:!1},level:{type:Number,default:0},templates:{type:Object,default:null},activeItemPath:{type:Object,default:null},tabindex:{type:Number,default:0}},methods:{getItemId:function(e){return"".concat(this.menuId,"_").concat(e.key)},getItemKey:function(e){return this.getItemId(e)},getItemProp:function(e,t,s){return e&&e.item?H(e.item[t],s):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},getItemLabelId:function(e){return"".concat(this.menuId,"_").concat(e.key,"_label")},getPTOptions:function(e,t,s){return this.ptm(s,{context:{item:e.item,index:t,active:this.isItemActive(e),focused:this.isItemFocused(e),disabled:this.isItemDisabled(e)}})},isItemActive:function(e){return this.activeItemPath.some(function(t){return t.key===e.key})},isItemVisible:function(e){return this.getItemProp(e,"visible")!==!1},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemFocused:function(e){return this.focusedItemId===this.getItemId(e)},isItemGroup:function(e){return L(e.items)},onEnter:function(){J(this.container,this.level)},onItemClick:function(e,t){this.getItemProp(t,"command",{originalEvent:e,item:t.item}),this.$emit("item-click",{originalEvent:e,processedItem:t,isFocus:!0})},onItemMouseEnter:function(e,t){this.$emit("item-mouseenter",{originalEvent:e,processedItem:t})},onItemMouseMove:function(e,t){this.$emit("item-mousemove",{originalEvent:e,processedItem:t})},getAriaSetSize:function(){var e=this;return this.items.filter(function(t){return e.isItemVisible(t)&&!e.getItemProp(t,"separator")}).length},getAriaPosInset:function(e){var t=this;return e-this.items.slice(0,e).filter(function(s){return t.isItemVisible(s)&&t.getItemProp(s,"separator")}).length+1},getMenuItemProps:function(e,t){return{action:l({class:this.cx("itemLink"),tabindex:-1},this.getPTOptions(e,t,"itemLink")),icon:l({class:[this.cx("itemIcon"),this.getItemProp(e,"icon")]},this.getPTOptions(e,t,"itemIcon")),label:l({class:this.cx("itemLabel")},this.getPTOptions(e,t,"itemLabel")),submenuicon:l({class:this.cx("submenuIcon")},this.getPTOptions(e,t,"submenuIcon"))}},containerRef:function(e){this.container=e}},components:{AngleRightIcon:fe},directives:{ripple:X}},Le=["tabindex"],xe=["id","aria-label","aria-disabled","aria-expanded","aria-haspopup","aria-level","aria-setsize","aria-posinset","data-p-active","data-p-focused","data-p-disabled"],Pe=["onClick","onMouseenter","onMousemove"],Me=["href","target"],we=["id"],Ke=["id"];function Se(n,e,t,s,a,i){var o=P("AngleRightIcon"),f=P("TieredMenuSub",!0),I=Y("ripple");return c(),v(N,l({name:"p-tieredmenu",onEnter:i.onEnter},n.ptm("menu.transition")),{default:x(function(){return[t.level===0||t.visible?(c(),h("ul",{key:0,ref:i.containerRef,tabindex:t.tabindex},[(c(!0),h(K,null,Q(t.items,function(r,u){return c(),h(K,{key:i.getItemKey(r)},[i.isItemVisible(r)&&!i.getItemProp(r,"separator")?(c(),h("li",l({key:0,id:i.getItemId(r),style:i.getItemProp(r,"style"),class:[n.cx("item",{processedItem:r}),i.getItemProp(r,"class")],role:"menuitem","aria-label":i.getItemLabel(r),"aria-disabled":i.isItemDisabled(r)||void 0,"aria-expanded":i.isItemGroup(r)?i.isItemActive(r):void 0,"aria-haspopup":i.isItemGroup(r)&&!i.getItemProp(r,"to")?"menu":void 0,"aria-level":t.level+1,"aria-setsize":i.getAriaSetSize(),"aria-posinset":i.getAriaPosInset(u),ref_for:!0},i.getPTOptions(r,u,"item"),{"data-p-active":i.isItemActive(r),"data-p-focused":i.isItemFocused(r),"data-p-disabled":i.isItemDisabled(r)}),[p("div",l({class:n.cx("itemContent"),onClick:function(m){return i.onItemClick(m,r)},onMouseenter:function(m){return i.onItemMouseEnter(m,r)},onMousemove:function(m){return i.onItemMouseMove(m,r)},ref_for:!0},i.getPTOptions(r,u,"itemContent")),[t.templates.item?(c(),v(S(t.templates.item),{key:1,item:r.item,hasSubmenu:i.getItemProp(r,"items"),label:i.getItemLabel(r),props:i.getMenuItemProps(r,u)},null,8,["item","hasSubmenu","label","props"])):$((c(),h("a",l({key:0,href:i.getItemProp(r,"url"),class:n.cx("itemLink"),target:i.getItemProp(r,"target"),tabindex:"-1",ref_for:!0},i.getPTOptions(r,u,"itemLink")),[t.templates.itemicon?(c(),v(S(t.templates.itemicon),{key:0,item:r.item,class:ee(n.cx("itemIcon"))},null,8,["item","class"])):i.getItemProp(r,"icon")?(c(),h("span",l({key:1,class:[n.cx("itemIcon"),i.getItemProp(r,"icon")],ref_for:!0},i.getPTOptions(r,u,"itemIcon")),null,16)):b("",!0),p("span",l({id:i.getItemLabelId(r),class:n.cx("itemLabel"),ref_for:!0},i.getPTOptions(r,u,"itemLabel")),F(i.getItemLabel(r)),17,we),i.getItemProp(r,"items")?(c(),h(K,{key:2},[t.templates.submenuicon?(c(),v(S(t.templates.submenuicon),l({key:0,class:n.cx("submenuIcon"),active:i.isItemActive(r),ref_for:!0},i.getPTOptions(r,u,"submenuIcon")),null,16,["class","active"])):(c(),v(o,l({key:1,class:n.cx("submenuIcon"),ref_for:!0},i.getPTOptions(r,u,"submenuIcon")),null,16,["class"]))],64)):b("",!0)],16,Me)),[[I]])],16,Pe),i.isItemVisible(r)&&i.isItemGroup(r)?(c(),v(f,l({key:0,id:i.getItemId(r)+"_list",class:n.cx("submenu"),style:n.sx("submenu",!0,{processedItem:r}),"aria-labelledby":i.getItemLabelId(r),role:"menu",menuId:t.menuId,focusedItemId:t.focusedItemId,items:r.items,templates:t.templates,activeItemPath:t.activeItemPath,level:t.level+1,visible:i.isItemActive(r)&&i.isItemGroup(r),pt:n.pt,unstyled:n.unstyled,onItemClick:e[0]||(e[0]=function(d){return n.$emit("item-click",d)}),onItemMouseenter:e[1]||(e[1]=function(d){return n.$emit("item-mouseenter",d)}),onItemMousemove:e[2]||(e[2]=function(d){return n.$emit("item-mousemove",d)}),ref_for:!0},n.ptm("submenu")),null,16,["id","class","style","aria-labelledby","menuId","focusedItemId","items","templates","activeItemPath","level","visible","pt","unstyled"])):b("",!0)],16,xe)):b("",!0),i.isItemVisible(r)&&i.getItemProp(r,"separator")?(c(),h("li",l({key:1,id:i.getItemId(r),style:i.getItemProp(r,"style"),class:[n.cx("separator"),i.getItemProp(r,"class")],role:"separator",ref_for:!0},n.ptm("separator")),null,16,Ke)):b("",!0)],64)}),128))],8,Le)):b("",!0)]}),_:1},16,["onEnter"])}U.render=Se;var j={name:"TieredMenu",extends:ke,inheritAttrs:!1,emits:["focus","blur","before-show","before-hide","hide","show"],outsideClickListener:null,matchMediaListener:null,scrollHandler:null,resizeListener:null,target:null,container:null,menubar:null,searchTimeout:null,searchValue:null,data:function(){return{id:this.$attrs.id,focused:!1,focusedItemInfo:{index:-1,level:0,parentKey:""},activeItemPath:[],visible:!this.popup,submenuVisible:!1,dirty:!1,query:null,queryMatches:!1}},watch:{"$attrs.id":function(e){this.id=e||B()},activeItemPath:function(e){this.popup||(L(e)?(this.bindOutsideClickListener(),this.bindResizeListener()):(this.unbindOutsideClickListener(),this.unbindResizeListener()))}},mounted:function(){this.id=this.id||B(),this.bindMatchMediaListener()},beforeUnmount:function(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindMatchMediaListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.container&&this.autoZIndex&&C.clear(this.container),this.target=null,this.container=null},methods:{getItemProp:function(e,t){return e?H(e[t]):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemVisible:function(e){return this.getItemProp(e,"visible")!==!1},isItemGroup:function(e){return L(this.getItemProp(e,"items"))},isItemSeparator:function(e){return this.getItemProp(e,"separator")},getProccessedItemLabel:function(e){return e?this.getItemLabel(e.item):void 0},isProccessedItemGroup:function(e){return e&&L(e.items)},toggle:function(e){this.visible?this.hide(e,!0):this.show(e)},show:function(e,t){this.popup&&(this.$emit("before-show"),this.visible=!0,this.target=this.target||e.currentTarget,this.relatedTarget=e.relatedTarget||null),t&&y(this.menubar)},hide:function(e,t){this.popup&&(this.$emit("before-hide"),this.visible=!1),this.activeItemPath=[],this.focusedItemInfo={index:-1,level:0,parentKey:""},t&&y(this.relatedTarget||this.target||this.menubar),this.dirty=!1},onFocus:function(e){this.focused=!0,this.popup||(this.focusedItemInfo=this.focusedItemInfo.index!==-1?this.focusedItemInfo:{index:this.findFirstFocusedItemIndex(),level:0,parentKey:""}),this.$emit("focus",e)},onBlur:function(e){this.focused=!1,this.focusedItemInfo={index:-1,level:0,parentKey:""},this.searchValue="",this.dirty=!1,this.$emit("blur",e)},onKeyDown:function(e){if(this.disabled){e.preventDefault();return}var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"Space":this.onSpaceKey(e);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!t&&te(e.key)&&this.searchItems(e,e.key);break}},onItemChange:function(e,t){var s=e.processedItem,a=e.isFocus;if(!A(s)){var i=s.index,o=s.key,f=s.level,I=s.parentKey,r=s.items,u=L(r),d=this.activeItemPath.filter(function(m){return m.parentKey!==I&&m.parentKey!==o});u&&(d.push(s),this.submenuVisible=!0),this.focusedItemInfo={index:i,level:f,parentKey:I},u&&(this.dirty=!0),a&&y(this.menubar),!(t==="hover"&&this.queryMatches)&&(this.activeItemPath=d)}},onOverlayClick:function(e){he.emit("overlay-click",{originalEvent:e,target:this.target})},onItemClick:function(e){var t=e.originalEvent,s=e.processedItem,a=this.isProccessedItemGroup(s),i=A(s.parent),o=this.isSelected(s);if(o){var f=s.index,I=s.key,r=s.level,u=s.parentKey;this.activeItemPath=this.activeItemPath.filter(function(m){return I!==m.key&&I.startsWith(m.key)}),this.focusedItemInfo={index:f,level:r,parentKey:u},this.dirty=!i,y(this.menubar)}else if(a)this.onItemChange(e);else{var d=i?s:this.activeItemPath.find(function(m){return m.parentKey===""});this.hide(t),this.changeFocusedItemIndex(t,d?d.index:-1),y(this.menubar)}},onItemMouseEnter:function(e){this.dirty&&this.onItemChange(e,"hover")},onItemMouseMove:function(e){this.focused&&this.changeFocusedItemIndex(e,e.processedItem.index)},onArrowDownKey:function(e){var t=this.focusedItemInfo.index!==-1?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemIndex(e,t),e.preventDefault()},onArrowUpKey:function(e){if(e.altKey){if(this.focusedItemInfo.index!==-1){var t=this.visibleItems[this.focusedItemInfo.index],s=this.isProccessedItemGroup(t);!s&&this.onItemChange({originalEvent:e,processedItem:t})}this.popup&&this.hide(e,!0),e.preventDefault()}else{var a=this.focusedItemInfo.index!==-1?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemIndex(e,a),e.preventDefault()}},onArrowLeftKey:function(e){var t=this,s=this.visibleItems[this.focusedItemInfo.index],a=this.activeItemPath.find(function(o){return o.key===s.parentKey}),i=A(s.parent);i||(this.focusedItemInfo={index:-1,parentKey:a?a.parentKey:""},this.searchValue="",this.onArrowDownKey(e)),this.activeItemPath=this.activeItemPath.filter(function(o){return o.parentKey!==t.focusedItemInfo.parentKey}),e.preventDefault()},onArrowRightKey:function(e){var t=this.visibleItems[this.focusedItemInfo.index],s=this.isProccessedItemGroup(t);s&&(this.onItemChange({originalEvent:e,processedItem:t}),this.focusedItemInfo={index:-1,parentKey:t.key},this.searchValue="",this.onArrowDownKey(e)),e.preventDefault()},onHomeKey:function(e){this.changeFocusedItemIndex(e,this.findFirstItemIndex()),e.preventDefault()},onEndKey:function(e){this.changeFocusedItemIndex(e,this.findLastItemIndex()),e.preventDefault()},onEnterKey:function(e){if(this.focusedItemInfo.index!==-1){var t=E(this.menubar,'li[id="'.concat("".concat(this.focusedItemId),'"]')),s=t&&E(t,'[data-pc-section="itemlink"]');if(s?s.click():t&&t.click(),!this.popup){var a=this.visibleItems[this.focusedItemInfo.index],i=this.isProccessedItemGroup(a);!i&&(this.focusedItemInfo.index=this.findFirstFocusedItemIndex())}}e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onEscapeKey:function(e){if(this.popup||this.focusedItemInfo.level!==0){var t=this.focusedItemInfo;this.hide(e,!1),this.focusedItemInfo={index:Number(t.parentKey.split("_")[0]),level:0,parentKey:""},this.popup&&y(this.target)}e.preventDefault()},onTabKey:function(e){if(this.focusedItemInfo.index!==-1){var t=this.visibleItems[this.focusedItemInfo.index],s=this.isProccessedItemGroup(t);!s&&this.onItemChange({originalEvent:e,processedItem:t})}this.hide()},onEnter:function(e){this.autoZIndex&&C.set("menu",e,this.baseZIndex+this.$primevue.config.zIndex.menu),ne(e,{position:"absolute",top:"0",left:"0"}),this.alignOverlay(),y(this.menubar),this.scrollInView()},onAfterEnter:function(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onLeave:function(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.container=null,this.dirty=!1},onAfterLeave:function(e){this.autoZIndex&&C.clear(e)},alignOverlay:function(){ie(this.container,this.target);var e=_(this.target);e>_(this.container)&&(this.container.style.minWidth=_(this.target)+"px")},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){var s=e.container&&!e.container.contains(t.target),a=e.popup?!(e.target&&(e.target===t.target||e.target.contains(t.target))):!0;s&&a&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new me(this.target,function(t){e.hide(t,!0)})),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(t){se()||e.hide(t,!0)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindMatchMediaListener:function(){var e=this;if(!this.matchMediaListener){var t=matchMedia("(max-width: ".concat(this.breakpoint,")"));this.query=t,this.queryMatches=t.matches,this.matchMediaListener=function(){e.queryMatches=t.matches},this.query.addEventListener("change",this.matchMediaListener)}},unbindMatchMediaListener:function(){this.matchMediaListener&&(this.query.removeEventListener("change",this.matchMediaListener),this.matchMediaListener=null)},isItemMatched:function(e){var t;return this.isValidItem(e)&&((t=this.getProccessedItemLabel(e))===null||t===void 0?void 0:t.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()))},isValidItem:function(e){return!!e&&!this.isItemDisabled(e.item)&&!this.isItemSeparator(e.item)&&this.isItemVisible(e.item)},isValidSelectedItem:function(e){return this.isValidItem(e)&&this.isSelected(e)},isSelected:function(e){return this.activeItemPath.some(function(t){return t.key===e.key})},findFirstItemIndex:function(){var e=this;return this.visibleItems.findIndex(function(t){return e.isValidItem(t)})},findLastItemIndex:function(){var e=this;return D(this.visibleItems,function(t){return e.isValidItem(t)})},findNextItemIndex:function(e){var t=this,s=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex(function(a){return t.isValidItem(a)}):-1;return s>-1?s+e+1:e},findPrevItemIndex:function(e){var t=this,s=e>0?D(this.visibleItems.slice(0,e),function(a){return t.isValidItem(a)}):-1;return s>-1?s:e},findSelectedItemIndex:function(){var e=this;return this.visibleItems.findIndex(function(t){return e.isValidSelectedItem(t)})},findFirstFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findFirstItemIndex():e},findLastFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findLastItemIndex():e},searchItems:function(e,t){var s=this;this.searchValue=(this.searchValue||"")+t;var a=-1,i=!1;return this.focusedItemInfo.index!==-1?(a=this.visibleItems.slice(this.focusedItemInfo.index).findIndex(function(o){return s.isItemMatched(o)}),a=a===-1?this.visibleItems.slice(0,this.focusedItemInfo.index).findIndex(function(o){return s.isItemMatched(o)}):a+this.focusedItemInfo.index):a=this.visibleItems.findIndex(function(o){return s.isItemMatched(o)}),a!==-1&&(i=!0),a===-1&&this.focusedItemInfo.index===-1&&(a=this.findFirstFocusedItemIndex()),a!==-1&&this.changeFocusedItemIndex(e,a),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout(function(){s.searchValue="",s.searchTimeout=null},500),i},changeFocusedItemIndex:function(e,t){this.focusedItemInfo.index!==t&&(this.focusedItemInfo.index=t,this.scrollInView())},scrollInView:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:-1,t=e!==-1?"".concat(this.id,"_").concat(e):this.focusedItemId,s=E(this.menubar,'li[id="'.concat(t,'"]'));s&&s.scrollIntoView&&s.scrollIntoView({block:"nearest",inline:"start"})},createProcessedItems:function(e){var t=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"",o=[];return e&&e.forEach(function(f,I){var r=(i!==""?i+"_":"")+I,u={item:f,index:I,level:s,key:r,parent:a,parentKey:i};u.items=t.createProcessedItems(f.items,s+1,u,r),o.push(u)}),o},containerRef:function(e){this.container=e},menubarRef:function(e){this.menubar=e?e.$el:void 0}},computed:{processedItems:function(){return this.createProcessedItems(this.model||[])},visibleItems:function(){var e=this,t=this.activeItemPath.find(function(s){return s.key===e.focusedItemInfo.parentKey});return t?t.items:this.processedItems},focusedItemId:function(){return this.focusedItemInfo.index!==-1?"".concat(this.id).concat(L(this.focusedItemInfo.parentKey)?"_"+this.focusedItemInfo.parentKey:"","_").concat(this.focusedItemInfo.index):null}},components:{TieredMenuSub:U,Portal:re}},Ce=["id"];function Ae(n,e,t,s,a,i){var o=P("TieredMenuSub"),f=P("Portal");return c(),v(f,{appendTo:n.appendTo,disabled:!n.popup},{default:x(function(){return[k(N,l({name:"p-connected-overlay",onEnter:i.onEnter,onAfterEnter:i.onAfterEnter,onLeave:i.onLeave,onAfterLeave:i.onAfterLeave},n.ptm("transition")),{default:x(function(){return[a.visible?(c(),h("div",l({key:0,ref:i.containerRef,id:a.id,class:n.cx("root"),onClick:e[0]||(e[0]=function(){return i.onOverlayClick&&i.onOverlayClick.apply(i,arguments)})},n.ptmi("root")),[n.$slots.start?(c(),h("div",l({key:0,class:n.cx("start")},n.ptm("start")),[z(n.$slots,"start")],16)):b("",!0),k(o,l({ref:i.menubarRef,id:a.id+"_list",class:n.cx("rootList"),tabindex:n.disabled?-1:n.tabindex,role:"menubar","aria-label":n.ariaLabel,"aria-labelledby":n.ariaLabelledby,"aria-disabled":n.disabled||void 0,"aria-orientation":"vertical","aria-activedescendant":a.focused?i.focusedItemId:void 0,menuId:a.id,focusedItemId:a.focused?i.focusedItemId:void 0,items:i.processedItems,templates:n.$slots,activeItemPath:a.activeItemPath,level:0,visible:a.submenuVisible,pt:n.pt,unstyled:n.unstyled,onFocus:i.onFocus,onBlur:i.onBlur,onKeydown:i.onKeyDown,onItemClick:i.onItemClick,onItemMouseenter:i.onItemMouseEnter,onItemMousemove:i.onItemMouseMove},n.ptm("rootList")),null,16,["id","class","tabindex","aria-label","aria-labelledby","aria-disabled","aria-activedescendant","menuId","focusedItemId","items","templates","activeItemPath","visible","pt","unstyled","onFocus","onBlur","onKeydown","onItemClick","onItemMouseenter","onItemMousemove"]),n.$slots.end?(c(),h("div",l({key:1,class:n.cx("end")},n.ptm("end")),[z(n.$slots,"end")],16)):b("",!0)],16,Ce)):b("",!0)]}),_:3},16,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]}),_:3},8,["appendTo","disabled"])}j.render=Ae;const Ee={class:"grid grid-cols-3 bg-white-700 p-4 shadow-md rounded-md w-full h-24 z-50"},_e={class:"flex justify-start items-center text-white"},Te={key:0,class:"pi pi-list"},Fe={key:1,class:"pi pi-ellipsis-v"},Ve={class:"flex justify-center"},Oe=["src"],De={class:"flex justify-end items-center"},ze={class:"ml-1 hidden md:inline"},je=ae({__name:"AppTopbar",setup(n){const{signOut:e}=oe(),t=ue(),s=ce(),a=be(),i=T(),o=T(""),f=T([{label:"Administração",icon:"pi pi-inbox",command(){R("/administracao")}},{label:"Alterar Senha",icon:"pi pi-key",command(){R("/alterarSenha")}},{label:"Logout",icon:"pi pi-sign-out",command(){e({callbackUrl:"/logout"})}}]);function I(){var d;if(!t.empresaAtual)return;const u=(d=s.logomarcas.find(m=>{var M;return m.empresa===((M=t.empresaAtual)==null?void 0:M.sigla)}))==null?void 0:d.imagem;o.value=u?"data:image/png;base64,"+u:""}de(()=>{I()});function r(u){i.value.toggle(u)}return(u,d)=>{var O;const m=Ie,M=P("fa-icon"),V=P("router-link"),q=le,Z=j;return c(),h("nav",Ee,[p("div",_e,[g(a).modulo?(c(),v(m,{key:0,severity:"primary",onClick:d[0]||(d[0]=w=>g(a).togglePin())},{default:x(()=>[g(a).pinned?(c(),h("i",Te)):(c(),h("i",Fe))]),_:1})):b("",!0),k(V,{to:"/selecaoEmpresa",class:"text-surface-700 hover:text-surface-500 ml-5"},{default:x(()=>{var w;return[k(M,{icon:["fas","building"],class:"mr-1"}),p("span",null,F((w=g(t).empresaAtual)==null?void 0:w.nomeFantasia),1)]}),_:1})]),p("div",Ve,[k(V,{to:"/",class:"flex items-center"},{default:x(()=>[g(o)?(c(),h("img",{key:0,src:g(o),alt:"logo",width:"64",height:"64"},null,8,Oe)):(c(),v(q,{key:1,src:"/logo-antt.png",alt:"logo",class:"max-h-16 max-w-full object-contain"}))]),_:1})]),p("div",De,[p("div",null,[p("button",{class:"text-surface-700 hover:text-surface-500 ml-10","aria-haspopup":"true","aria-controls":"overlay_tmenu",onClick:r},[k(M,{icon:["fas","user"]}),p("span",ze,F((O=g(t).usuario)==null?void 0:O.nomeUsuario),1)]),k(Z,{id:"overlay_tmenu",ref_key:"topbarMenu",ref:i,model:g(f),popup:""},null,8,["model"])])])])}}});export{je as _};
