const u=e=>(e.forEach(r=>{r.children=e.filter(n=>n.parentId===r.id?(n.root=!1,!0):!1),r.children.length<=0&&(r.leaf=!0)}),e.filter(r=>r.root!==!1)),c=(e,r,n)=>{r.forEach(l=>{const i={...l,depth:n};e.push(i),i.children&&(c(e,i.children,n+1),i.children=void 0)})},d=e=>{const r=new Array;return c(r,e,0),r},t=(e,r)=>{for(let n=0,l=e.length;n<l;n+=1){let i;if(e[n].children&&(i=t(e[n].children,r),i)||(i=e.find(r),i))return i}},s=(e,r,n)=>(e.forEach(l=>{(n||l.id===r)&&(l.disabled=!0),s(l.children,r,l.disabled)}),e),h=(e,r)=>r?s(e,r,!1):e,f=(e,r)=>(e.forEach(n=>{r.includes(n.id)||(n.disabled=!0),f(n.children,r)}),e),a=(e,r)=>r?f(e,r):e,o=(e,r)=>{let n=!0;return e.forEach(l=>{!(l.children&&l.children.length>0)&&!r.includes(l.key)&&!r.includes("*")?l.disabled=!0:n=!1,l.children&&(l.disabled=o(l.children,r))}),n};export{a,t as b,o as c,h as d,d as f,u as t};
