import{createVNode as O}from"vue";import{filterEmpty as P}from"../../_util/props-util/index.mjs";import C from"../TreeNode.mjs";import{camelize as j}from"../../_util/util.mjs";function L(e){return e&&e.type&&e.type.isTreeSelectNode}function S(e){function r(u=[]){return P(u).map(c=>{if(!L(c))return null;const p=c.children||{},m=c.key,o={};for(const[f,x]of Object.entries(c.props))o[j(f)]=x;const{isLeaf:n,checkable:a,selectable:i,disabled:s,disableCheckbox:l}=o,d={isLeaf:n||n===""||void 0,checkable:a||a===""||void 0,selectable:i||i===""||void 0,disabled:s||s===""||void 0,disableCheckbox:l||l===""||void 0},t={...o,...d},{title:v=p.title?.(t),switcherIcon:g=p.switcherIcon?.(t),...y}=o,k=p.default?.(),h={...y,title:v,switcherIcon:g,key:m,isLeaf:n,...d},b=r(k);return b.length&&(h.children=b),h})}return r(e)}function $(e){if(!e)return e;const r={...e};return"props"in r||Object.defineProperty(r,"props",{get(){return r}}),r}function z(e,r,u,c,p,m){let o=null,n=null;function a(){function i(s,l="0",d=!1){return s.map((t,v)=>{const g=`${l}-${v}`,y=t[m.value],k=u.includes(y),h=i(t[m.children]||[],g,k),b=O(C,t,{default:()=>[h.map(f=>f.node)]});if(r===y&&(o=b),k){const f={pos:g,node:b,children:h};return d||n.push(f),f}return null}).filter(t=>t)}n||(n=[],i(c),n.sort(({node:{props:{value:s}}},{node:{props:{value:l}}})=>{const d=u.indexOf(s),t=u.indexOf(l);return d-t}))}Object.defineProperty(e,"triggerNode",{get(){return a(),o}}),Object.defineProperty(e,"allCheckedNodes",{get(){return a(),p?n:n.map(({node:i})=>i)}})}export{S as convertChildrenToData,z as fillAdditionalInfo,$ as fillLegacyProps};
