require("../../vc-util/warning.js");const e=require("../../_util/util.js"),t=require("../../_util/omit.js"),n=require("../../_util/props-util/index.js"),r=require("../util.js");function i(e,t){return e??t}function a(e){let{title:t,_title:n,key:r,children:i}=e||{},a=t||`title`;return{title:a,_title:n||[a],key:r||`key`,children:i||`children`}}function o(t){function i(t=[]){return n.filterEmpty(t).map(t=>{if(!r.isTreeNode(t))return null;let n=t.children||{},a=t.key,o={};for(let[n,r]of Object.entries(t.props))o[e.camelize(n)]=r;let{isLeaf:s,checkable:c,selectable:l,disabled:u,disableCheckbox:d}=o,f={isLeaf:s||s===``||void 0,checkable:c||c===``||void 0,selectable:l||l===``||void 0,disabled:u||u===``||void 0,disableCheckbox:d||d===``||void 0},p={...o,...f},{title:m=n.title?.(p),icon:h=n.icon?.(p),switcherIcon:g=n.switcherIcon?.(p),..._}=o,v=n.default?.(),y={..._,title:m,icon:h,switcherIcon:g,key:a,isLeaf:s,...f},b=i(v);return b.length&&(y.children=b),y})}return i(t)}function s(e,n,o){let{_title:s,key:c,children:l}=a(o),u=new Set(n===!0?[]:n),d=[];function f(e,a=null){return e.map((o,p)=>{let m=r.getPosition(a?a.pos:`0`,p),h=i(o[c],m),g;for(let e=0;e<s.length;e+=1){let t=s[e];if(o[t]!==void 0){g=o[t];break}}let _={...t.default(o,[...s,c,l]),title:g,key:h,parent:a,pos:m,children:null,data:o,isStart:[...a?a.isStart:[],p===0],isEnd:[...a?a.isEnd:[],p===e.length-1]};return d.push(_),n===!0||u.has(h)?_.children=f(o[l]||[],_):_.children=[],_})}return f(e),d}function c(e,t,n){let o={};o=typeof n==`object`?n:{externalGetKey:n},o=o||{};let{childrenPropName:s,externalGetKey:c,fieldNames:l}=o,{key:u,children:d}=a(l),f=s||d,p;c?typeof c==`string`?p=e=>e[c]:typeof c==`function`&&(p=e=>c(e)):p=(e,t)=>i(e[u],t);function m(n,i,a,o){let s=n?n[f]:e,c=n?r.getPosition(a.pos,i):`0`,l=n?[...o,n]:[];n&&t({node:n,index:i,pos:c,key:p(n,c),parentPos:a.node?a.pos:null,level:a.level+1,nodes:l}),s&&s.forEach((e,t)=>{m(e,t,{node:n,pos:c,level:a?a.level+1:-1},l)})}m(null)}function l(e,{initWrapper:t,processEntity:n,onProcessFinished:r,externalGetKey:a,childrenPropName:o,fieldNames:s}={},l){let u=a||l,d={},f={},p={posEntities:d,keyEntities:f};return t&&(p=t(p)||p),c(e,e=>{let{node:t,index:r,pos:a,key:o,parentPos:s,level:c,nodes:l}=e,u={node:t,nodes:l,index:r,key:o,pos:a,level:c},m=i(o,a);d[a]=u,f[m]=u,u.parent=d[s],u.parent&&(u.parent.children=u.parent.children||[],u.parent.children.push(u)),n&&n(u,p)},{externalGetKey:u,childrenPropName:o,fieldNames:s}),r&&r(p),p}function u(e,{expandedKeysSet:t,selectedKeysSet:n,loadedKeysSet:r,loadingKeysSet:i,checkedKeysSet:a,halfCheckedKeysSet:o,dragOverNodeKey:s,dropPosition:c,keyEntities:l}){let u=l[e];return{eventKey:e,expanded:t.has(e),selected:n.has(e),loaded:r.has(e),loading:i.has(e),checked:a.has(e),halfChecked:o.has(e),pos:String(u?u.pos:``),parent:u.parent,dragOver:s===e&&c===0,dragOverGapTop:s===e&&c===-1,dragOverGapBottom:s===e&&c===1}}function d(e){let{data:t,expanded:n,selected:r,checked:i,loaded:a,loading:o,halfChecked:s,dragOver:c,dragOverGapTop:l,dragOverGapBottom:u,pos:d,active:f,eventKey:p}=e,m={dataRef:t,...t,expanded:n,selected:r,checked:i,loaded:a,loading:o,halfChecked:s,dragOver:c,dragOverGapTop:l,dragOverGapBottom:u,pos:d,active:f,eventKey:p,key:p};return`props`in m||Object.defineProperty(m,"props",{get(){return e}}),m}exports.convertDataToEntities=l,exports.convertNodePropsToEventData=d,exports.convertTreeToData=o,exports.fillFieldNames=a,exports.flattenTreeData=s,exports.getKey=i,exports.getTreeNodeProps=u,exports.traverseDataNodes=c;