"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),g=require("../Divider.js"),N=require("../ItemGroup.js"),w=require("../MenuItem.js"),V=require("../SubMenu.js");function m(u,n,s){return(u||[]).map((e,l)=>{if(e&&typeof e=="object"){const{label:a,children:c,key:v,type:o,...i}=e,r=v??`tmp-${l}`,d=s?s.parentKeys.slice():[],y=[],f={eventKey:r,key:r,parentEventKeys:t.ref(d),parentKeys:t.ref(d),childrenEventKeys:t.ref(y),isLeaf:!1};if(c||o==="group"){if(o==="group"){const K=m(c,n,s);return t.createVNode(N.default,{key:r,...i,title:a,originItemValue:e},{default:()=>[K]})}n.set(r,f),s&&s.childrenEventKeys.push(r);const h=m(c,n,{childrenEventKeys:y,parentKeys:[].concat(d,r)});return t.createVNode(V.default,{key:r,...i,title:a,originItemValue:e},{default:()=>[h]})}return o==="divider"?t.createVNode(g.default,{key:r,...i},null):(f.isLeaf=!0,n.set(r,f),t.createVNode(w.default,{key:r,...i,originItemValue:e},{default:()=>[a]}))}return null}).filter(e=>e)}function k(u){const n=t.shallowRef([]),s=t.shallowRef(!1),e=t.shallowRef(new Map);return t.watch(()=>u.items,()=>{const l=new Map;s.value=!1,u.items?(s.value=!0,n.value=m(u.items,l)):n.value=void 0,e.value=l},{immediate:!0,deep:!0}),{itemsNodes:n,store:e,hasItmes:s}}exports.default=k;
