"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("vue");require("./contextTypes.js");require("./props.js");function S(e,r){if(!e)return[];const n=e.slice(),d=n.indexOf(r);return d>=0&&n.splice(d,1),n}function q(e,r){const n=(e||[]).slice();return n.includes(r)||n.push(r),n}function g(e){return e.split("-")}function E(e,r){return`${e}-${r}`}function I(e){return e&&e.type&&e.type.isTreeNode}function M(e,r){const n=[],d=r[e];function i(o=[]){o.forEach(({key:c,children:a})=>{n.push(c),i(a)})}return i(d.children),n}function k(e){if(e.parent){const r=g(e.pos);return Number(r[r.length-1])===e.parent.children.length-1}return!1}function A(e){const r=g(e.pos);return Number(r[r.length-1])===0}function j(e,r,n,d,i,o,c,a,y,D){const{clientX:v,clientY:N}=e,{top:P,height:C}=e.target.getBoundingClientRect(),K=((D==="rtl"?-1:1)*((i?.x||0)-v)-12)/d;let t=a[n.eventKey];if(N<P+C/2){const p=c.findIndex(L=>L.key===t.key),T=p<=0?0:p-1,m=c[T].key;t=a[m]}const x=t.key,O=t,b=t.key;let s=0,h=0;if(!y.has(x))for(let p=0;p<K&&k(t);p+=1)t=t.parent,h+=1;const l=r.eventData,f=t.node;let u=!0;return A(t)&&t.level===0&&N<P+C/2&&o({dragNode:l,dropNode:f,dropPosition:-1})&&t.key===n.eventKey?s=-1:(O.children||[]).length&&y.has(b)?o({dragNode:l,dropNode:f,dropPosition:0})?s=0:u=!1:h===0?K>-1.5?o({dragNode:l,dropNode:f,dropPosition:1})?s=1:u=!1:o({dragNode:l,dropNode:f,dropPosition:0})?s=0:o({dragNode:l,dropNode:f,dropPosition:1})?s=1:u=!1:o({dragNode:l,dropNode:f,dropPosition:1})?s=1:u=!1,{dropPosition:s,dropLevelOffset:h,dropTargetKey:t.key,dropTargetPos:t.pos,dragOverNodeKey:b,dropContainerKey:s===0?null:t.parent?.key||null,dropAllowed:u}}function z(e,r){if(!e)return;const{multiple:n}=r;return n?e.slice():e.length?[e[0]]:e}function F(e){if(!e)return null;let r;if(Array.isArray(e))r={checkedKeys:e,halfCheckedKeys:void 0};else if(typeof e=="object")r={checkedKeys:e.checked||void 0,halfCheckedKeys:e.halfChecked||void 0};else return null;return r}function $(e,r){const n=new Set;function d(i){if(n.has(i))return;const o=r[i];if(!o)return;n.add(i);const{parent:c,node:a}=o;a.disabled||c&&d(c.key)}return(e||[]).forEach(i=>{d(i)}),[...n]}exports.arrAdd=q;exports.arrDel=S;exports.calcDropPosition=j;exports.calcSelectedKeys=z;exports.conductExpandParent=$;exports.getDragChildrenKeys=M;exports.getPosition=E;exports.isFirstChild=A;exports.isLastChild=k;exports.isTreeNode=I;exports.parseCheckedKeys=F;exports.posToArr=g;
