import{_ as D,V as E,r as h,W as V,K as W,H as j,c as m,t as x,G as s,A as r,y as c,e as d,a as g,d as M,X as F,g as A,o as i,b as L,j as R,Y as T,F as z,f as G}from"./entry.126c240b.js";import{u as H,I as b}from"./iconify.f8f64a59.js";const O={key:0,class:"layout-menuitem-root-text"},X=["href","target"],Y={class:"layout-menuitem-texttext-sm font-medium sm:text-lg"},q={key:0,class:"pi pi-fw pi-angle-down layout-submenu-toggler"},J={class:"layout-submenu"},P={__name:"AppMenuItem",props:{item:{type:Object,default:()=>({})},index:{type:Number,default:0},root:{type:Boolean,default:!0},parentItemKey:{type:String,default:null}},setup(e){const v=E(),{layoutConfig:K,layoutState:k,setActiveMenuItem:C,onMenuToggle:w}=H(),u=e,o=h(!1),n=h(null);V(()=>{n.value=u.parentItemKey?u.parentItemKey+"-"+u.index:String(u.index);const t=k.activeMenuItem;o.value=t===n.value||t?t.startsWith(n.value+"-"):!1}),W(()=>K.activeMenuItem.value,t=>{o.value=t===n.value||t.startsWith(n.value+"-")});const I=(t,a)=>{if(a.disabled){t.preventDefault();return}const{overlayMenuActive:y,staticMenuMobileActive:f}=k;(a.to||a.url)&&(f.value||y.value)&&w(),a.command&&a.command({originalEvent:t,item:a});const l=a.items?o.value?u.parentItemKey:n:n.value;C(l)},B=t=>v.path===t.to||v.path.includes(t.to),S=j(()=>{let t=!1;return u.item.items&&u.item.items.forEach(a=>{a.to==v.path&&(t=!0)}),t});return(t,a)=>{const y=A("router-link"),f=A("app-menu-item",!0);return i(),m("li",{class:r(["cursor-pointer",{"layout-root-menuitem":e.root,"active-menuitem":o.value}])},[e.root&&e.item.visible!==!1?(i(),m("div",O,x(e.item.label),1)):s("",!0),(!e.item.to||e.item.items)&&e.item.visible!==!1?(i(),m("a",{key:1,href:e.item.url,onClick:a[0]||(a[0]=l=>I(l,e.item,e.index)),class:r(e.item.class),target:e.item.target,tabindex:"0"},[e.item.items?(i(),c(d(b),{key:0,class:"text-2xl layout-menuitem-icon",icon:e.item.icon},null,8,["icon"])):s("",!0),g("span",{class:r([{"active-route":d(S)},"layout-menuitem-text font-medium text-lg"])},x(e.item.label),3),e.item.items?(i(),c(d(b),{key:1,class:"layout-submenu-toggler",icon:"pepicons-pop:angle-down"})):s("",!0)],10,X)):s("",!0),e.item.to&&!e.item.items&&e.item.visible!==!1?(i(),c(y,{key:2,onClick:a[1]||(a[1]=l=>I(l,e.item,e.index)),class:r([e.item.class,{"active-route":B(e.item)}]),tabindex:"0",to:e.item.to},{default:M(()=>[L(d(b),{class:"text-2xl layout-menuitem-icon",icon:e.item.icon},null,8,["icon"]),g("span",Y,x(e.item.label),1),e.item.items?(i(),m("i",q)):s("",!0)]),_:1},8,["class","to"])):s("",!0),e.item.items&&e.item.visible!==!1?(i(),c(F,{key:3,name:"layout-submenu"},{default:M(()=>[R(g("ul",J,[(i(!0),m(z,null,G(e.item.items,(l,N)=>(i(),c(f,{key:l,index:N,item:l,parentItemKey:n.value,root:!1},null,8,["index","item","parentItemKey"]))),128))],512),[[T,e.root?!0:o.value]])]),_:1})):s("",!0)],2)}}},Z=D(P,[["__scopeId","data-v-15210471"]]);export{Z as default};
