"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function w(u,i){const d=new Set;return u.forEach(e=>{i.has(e)||d.add(e)}),d}function K(u){const{disabled:i,disableCheckbox:d,checkable:e}=u||{};return!!(i||d)||e===!1}function p(u,i,d,e){const t=new Set(u),c=new Set;for(let o=0;o<=d;o+=1)(i.get(o)||new Set).forEach(h=>{const{key:r,node:s,children:k=[]}=h;t.has(r)&&!e(s)&&k.filter(a=>!e(a.node)).forEach(a=>{t.add(a.key)})});const n=new Set;for(let o=d;o>=0;o-=1)(i.get(o)||new Set).forEach(h=>{const{parent:r,node:s}=h;if(e(s)||!h.parent||n.has(h.parent.key))return;if(e(h.parent.node)){n.add(r.key);return}let k=!0,a=!1;(r.children||[]).filter(l=>!e(l.node)).forEach(({key:l})=>{const y=t.has(l);k&&!y&&(k=!1),!a&&(y||c.has(l))&&(a=!0)}),k&&t.add(r.key),a&&c.add(r.key),n.add(r.key)});return{checkedKeys:Array.from(t),halfCheckedKeys:Array.from(w(c,t))}}function C(u,i,d,e,t){const c=new Set(u);let n=new Set(i);for(let f=0;f<=e;f+=1)(d.get(f)||new Set).forEach(r=>{const{key:s,node:k,children:a=[]}=r;!c.has(s)&&!n.has(s)&&!t(k)&&a.filter(l=>!t(l.node)).forEach(l=>{c.delete(l.key)})});n=new Set;const o=new Set;for(let f=e;f>=0;f-=1)(d.get(f)||new Set).forEach(r=>{const{parent:s,node:k}=r;if(t(k)||!r.parent||o.has(r.parent.key))return;if(t(r.parent.node)){o.add(s.key);return}let a=!0,l=!1;(s.children||[]).filter(y=>!t(y.node)).forEach(({key:y})=>{const S=c.has(y);a&&!S&&(a=!1),!l&&(S||n.has(y))&&(l=!0)}),a||c.delete(s.key),l&&n.add(s.key),o.add(s.key)});return{checkedKeys:Array.from(c),halfCheckedKeys:Array.from(w(n,c))}}function E(u,i,d,e,t,c){let n;c?n=c:n=K;const o=new Set(u.filter(h=>!!d[h]));let f;return i===!0?f=p(o,t,e,n):f=C(o,i.halfCheckedKeys,t,e,n),f}exports.conductCheck=E;exports.isCheckDisabled=K;
