import{d as T,b as j,o,c as u,i as r,w as C,g as y,W as E,j as D,t as q,a as p,a2 as v,y as F,F as G,v as H,_ as L,__tla as W}from"./index-2c56227b.js";import{V as N,__tla as z}from"./vuedraggable.umd-d9f59d40.js";let U,B=Promise.all([(()=>{try{return W}catch{}})(),(()=>{try{return z}catch{}})()]).then(async()=>{let k,I,g,x,b,f;k={class:"menu_bottom"},I=["onClick"],g={key:0,class:"submenu"},x={class:"menu_bottom subtitle"},b=["onClick"],f=["onClick"],U=L(T({__name:"MenuPreviewer",props:{modelValue:{type:Array,required:!0},activeIndex:{type:String,required:!0},parentIndex:{type:Number,required:!0},accountId:{type:Number,required:!0}},emits:["update:modelValue","menu-clicked","submenu-clicked"],setup(P,{emit:A}){const d=P,s=A,i=j({get:()=>d.modelValue,set:n=>s("update:modelValue",n)}),M=()=>{const n=i.value.length,l={name:"\u83DC\u5355\u540D\u79F0",children:[],reply:{type:"text",accountId:d.accountId}};i.value[n]=l,V(l,n-1)},V=(n,l)=>{s("menu-clicked",n,l)},w=(n,l,a)=>{s("submenu-clicked",n,l,a)},O=({oldIndex:n,newIndex:l})=>{if(d.activeIndex==="__MENU_NOT_SELECTED__")return;let a=new Array(i.value.length).fill(!1);a[d.parentIndex]=!0;const[e]=a.splice(n,1);a.splice(l,0,e);const t=a.indexOf(!0),c=i.value[t];s("menu-clicked",c,t)},$=({newIndex:n})=>{var t;const l=d.parentIndex,a=n,e=(t=i.value[l])==null?void 0:t.children;if(e&&(e==null?void 0:e.length)>0){const c=e[a];s("submenu-clicked",c,l,a)}};return(n,l)=>{const a=H;return o(),u(G,null,[r(p(N),{modelValue:p(i),"onUpdate:modelValue":l[0]||(l[0]=e=>F(i)?i.value=e:null),"item-key":"id","ghost-class":"draggable-ghost",animation:400,onEnd:O},{item:C(({element:e,index:t})=>[y("div",k,[y("div",{onClick:c=>V(e,t),class:E(["menu_item",{active:d.activeIndex===`${t}`}])},[r(a,{icon:"ep:fold",color:"black"}),D(q(e.name),1)],10,I),d.parentIndex===t&&e.children?(o(),u("div",g,[r(p(N),{modelValue:e.children,"onUpdate:modelValue":c=>e.children=c,"item-key":"id","ghost-class":"draggable-ghost",animation:400,onEnd:$},{item:C(({element:c,index:m})=>[y("div",x,[e.children?(o(),u("div",{key:0,class:E(["menu_subItem",{active:d.activeIndex===`${t}-${m}`}]),onClick:_=>w(c,t,m)},q(c.name),11,b)):v("",!0)])]),_:2},1032,["modelValue","onUpdate:modelValue"]),!e.children||e.children.length<5?(o(),u("div",{key:0,class:"menu_bottom menu_addicon",onClick:c=>((m,_)=>{const h=_.children.length,S={name:"\u5B50\u83DC\u5355\u540D\u79F0",reply:{type:"text",accountId:d.accountId}};_.children[h]=S,w(_.children[h],m,h)})(t,e)},[r(a,{icon:"ep:plus",class:"plus"})],8,f)):v("",!0)])):v("",!0)])]),_:1},8,["modelValue"]),p(i).length<3?(o(),u("div",{key:0,class:"menu_bottom menu_addicon",onClick:M},[r(a,{icon:"ep:plus",class:"plus"})])):v("",!0)],64)}}}),[["__scopeId","data-v-733d6a82"],["__file","E:/GAOHP_2023/mall/newfeifan-front/yudao-ui-admin-vue3/src/views/mp/menu/components/MenuPreviewer.vue"]])});export{B as __tla,U as default};
