const e=require("../utils/legacyUtil.js");let t=require("vue");function n(e,{id:t,pId:n,rootPId:r}){let i={},a=[];return e.map(e=>{let n={...e},r=n[t];return i[r]=n,n.key=n.key||r,n}).forEach(e=>{let t=e[n],o=i[t];o&&(o.children=o.children||[],o.children.push(e)),(t===r||!o&&r===null)&&a.push(e)}),a}function r(r,i,a){let o=(0,t.shallowRef)();return(0,t.watch)([a,r,i],()=>{let s=a.value;r.value?o.value=a.value?n((0,t.toRaw)(r.value),{id:`id`,pId:`pId`,rootPId:null,...s===!0?{}:s}):(0,t.toRaw)(r.value).slice():o.value=e.convertChildrenToData((0,t.toRaw)(i.value))},{immediate:!0,deep:!0}),o}exports.default=r;