import { an as t0, aj as ye$1, aJ as Rg, aK as AC, aL as Nn$1, aM as $g, aN as Hg, aO as Re$1, ah as Mm, aP as Ga, ak as Za, af as rr$1, aQ as ir$1, aR as Pm, aa as Ja, aS as Ng, aT as Dg, aU as us, aV as _i, aW as Ua, aX as Um, aY as _C, ai as vr$1, aZ as tr$1, a_ as yi, a$ as Ne$1, al as Rm, b0 as _n$1, a8 as h0, j as In$1, b1 as Kg, b2 as ne, ag as tl, b3 as Rn$1, ab as br$1, b4 as ss, ao as Mg, b5 as Gr$1 } from './index.esm2.js';

function _class_call_check(instance, Constructor) {
    if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
    }
}
function _defineProperties(target, props) {
    for(var i = 0; i < props.length; i++){
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
    }
}
function _create_class(Constructor, protoProps, staticProps) {
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
    return Constructor;
}
function _instanceof(left, right) {
    if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
        return !!right[Symbol.hasInstance](left);
    } else {
        return left instanceof right;
    }
}
function _type_of(obj) {
    "@swc/helpers - typeof";
    return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
}
var hn = "[object Symbol]";
function Q(e) {
    return (typeof e === "undefined" ? "undefined" : _type_of(e)) == "symbol" || _i(e) && Ne$1(e) == hn;
}
function ve(e, n) {
    for(var r = -1, t = e == null ? 0 : e.length, i = Array(t); ++r < t;)i[r] = n(e[r], r, e);
    return i;
}
var se = tr$1 ? tr$1.prototype : void 0, ae = se ? se.toString : void 0;
function Pe(e) {
    if (typeof e == "string") return e;
    if (rr$1(e)) return ve(e, Pe) + "";
    if (Q(e)) return ae ? ae.call(e) : "";
    var n = e + "";
    return n == "0" && 1 / e == -Infinity ? "-0" : n;
}
function gn() {}
function Le(e, n) {
    for(var r = -1, t = e == null ? 0 : e.length; ++r < t && n(e[r], r, e) !== false;);
    return e;
}
function cn(e, n, r, t) {
    for(var i = e.length, s = r + (-1); ++s < i;)if (n(e[s], s, e)) return s;
    return -1;
}
function _n(e) {
    return e !== e;
}
function pn(e, n, r) {
    for(var t = r - 1, i = e.length; ++t < i;)if (e[t] === n) return t;
    return -1;
}
function bn(e, n, r) {
    return n === n ? pn(e, n, r) : cn(e, _n, r);
}
function yn(e, n) {
    var r = e == null ? 0 : e.length;
    return !!r && bn(e, n, 0) > -1;
}
function T(e) {
    return vr$1(e) ? Um(e) : _C(e);
}
var An = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Tn = /^\w*$/;
function W(e, n) {
    if (rr$1(e)) return false;
    var r = typeof e === "undefined" ? "undefined" : _type_of(e);
    return r == "number" || r == "symbol" || r == "boolean" || e == null || Q(e) ? true : Tn.test(e) || !An.test(e) || n != null && e in Object(n);
}
var En = 500;
function On(e) {
    var n = yi(e, function(t) {
        return r.size === En && r.clear(), t;
    }), r = n.cache;
    return n;
}
var $n = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, mn = /\\(\\)?/g, wn = On(function(e) {
    var n = [];
    return e.charCodeAt(0) === 46 && n.push(""), e.replace($n, function(r, t, i, s) {
        n.push(i ? s.replace(mn, "$1") : t || r);
    }), n;
});
var vn = wn;
function Pn(e) {
    return e == null ? "" : Pe(e);
}
function Ie(e, n) {
    return rr$1(e) ? e : W(e, n) ? [
        e
    ] : vn(Pn(e));
}
function U(e) {
    if (typeof e == "string" || Q(e)) return e;
    var n = e + "";
    return n == "0" && 1 / e == -Infinity ? "-0" : n;
}
function Ce(e, n) {
    n = Ie(n, e);
    for(var r = 0, t = n.length; e != null && r < t;)e = e[U(n[r++])];
    return r && r == t ? e : void 0;
}
function In(e, n, r) {
    var t = e == null ? void 0 : Ce(e, n);
    return t === void 0 ? r : t;
}
function J(e, n) {
    for(var r = -1, t = n.length, i = e.length; ++r < t;)e[i + r] = n[r];
    return e;
}
var ue = tr$1 ? tr$1.isConcatSpreadable : void 0;
function Cn(e) {
    return rr$1(e) || ir$1(e) || !!(ue && e && e[ue]);
}
function Se(e, n, r, t, i) {
    var s = -1, a = e.length;
    for(r || (r = Cn), i || (i = []); ++s < a;){
        var u = e[s];
        r(u) ? J(i, u) : t || (i[i.length] = u);
    }
    return i;
}
function Sn(e, n, r, t) {
    var i = -1, s = e == null ? 0 : e.length;
    for(t && s && (r = e[++i]); ++i < s;)r = n(r, e[i], i, e);
    return r;
}
function Nn(e, n) {
    return e && Pm(n, T(n), e);
}
function Fn(e, n) {
    return e && Pm(n, Ja(n), e);
}
function Ne(e, n) {
    for(var r = -1, t = e == null ? 0 : e.length, i = 0, s = []; ++r < t;){
        var a = e[r];
        n(a, r, e) && (s[i++] = a);
    }
    return s;
}
function Fe() {
    return [];
}
var Mn = Object.prototype, xn = Mn.propertyIsEnumerable, fe = Object.getOwnPropertySymbols, Dn = fe ? function Dn(e) {
    return e == null ? [] : (e = Object(e), Ne(fe(e), function(n) {
        return xn.call(e, n);
    }));
} : Fe;
var z = Dn;
function Rn(e, n) {
    return Pm(e, z(e), n);
}
var Gn = Object.getOwnPropertySymbols, Un = Gn ? function Un(e) {
    for(var n = []; e;)J(n, z(e)), e = Ua(e);
    return n;
} : Fe;
var Me = Un;
function Bn(e, n) {
    return Pm(e, Me(e), n);
}
function xe(e, n, r) {
    var t = n(e);
    return rr$1(e) ? t : J(t, r(e));
}
function q(e) {
    return xe(e, T, z);
}
function jn(e) {
    return xe(e, Ja, Me);
}
var Kn = Object.prototype, Hn = Kn.hasOwnProperty;
function Yn(e) {
    var n = e.length, r = new e.constructor(n);
    return n && typeof e[0] == "string" && Hn.call(e, "index") && (r.index = e.index, r.input = e.input), r;
}
function Zn(e, n) {
    var r = n ? Dg(e.buffer) : e.buffer;
    return new e.constructor(r, e.byteOffset, e.byteLength);
}
var qn = /\w*$/;
function Xn(e) {
    var n = new e.constructor(e.source, qn.exec(e));
    return n.lastIndex = e.lastIndex, n;
}
var oe = tr$1 ? tr$1.prototype : void 0, de = oe ? oe.valueOf : void 0;
function Qn(e) {
    return de ? Object(de.call(e)) : {};
}
var Wn = "[object Boolean]", Jn = "[object Date]", zn = "[object Map]", Vn = "[object Number]", kn = "[object RegExp]", er = "[object Set]", nr = "[object String]", rr = "[object Symbol]", tr = "[object ArrayBuffer]", ir = "[object DataView]", sr = "[object Float32Array]", ar = "[object Float64Array]", ur = "[object Int8Array]", fr = "[object Int16Array]", or = "[object Int32Array]", dr = "[object Uint8Array]", hr = "[object Uint8ClampedArray]", lr = "[object Uint16Array]", gr = "[object Uint32Array]";
function cr(e, n, r) {
    var t = e.constructor;
    switch(n){
        case tr:
            return Dg(e);
        case Wn:
        case Jn:
            return new t(+e);
        case ir:
            return Zn(e, r);
        case sr:
        case ar:
        case ur:
        case fr:
        case or:
        case dr:
        case hr:
        case lr:
        case gr:
            return Ng(e, r);
        case zn:
            return new t();
        case Vn:
        case nr:
            return new t(e);
        case kn:
            return Xn(e);
        case er:
            return new t();
        case rr:
            return Qn(e);
    }
}
var _r = "[object Map]";
function pr(e) {
    return _i(e) && AC(e) == _r;
}
var he = us && us.isMap, br = he ? Mm(he) : pr;
var yr = br;
var Ar = "[object Set]";
function Tr(e) {
    return _i(e) && AC(e) == Ar;
}
var le = us && us.isSet, Er = le ? Mm(le) : Tr;
var Or = Er;
var $r = 1, mr = 2, wr = 4, De = "[object Arguments]", vr = "[object Array]", Pr = "[object Boolean]", Lr = "[object Date]", Ir = "[object Error]", Re = "[object Function]", Cr = "[object GeneratorFunction]", Sr = "[object Map]", Nr = "[object Number]", Ge = "[object Object]", Fr = "[object RegExp]", Mr = "[object Set]", xr = "[object String]", Dr = "[object Symbol]", Rr = "[object WeakMap]", Gr = "[object ArrayBuffer]", Ur = "[object DataView]", Br = "[object Float32Array]", jr = "[object Float64Array]", Kr = "[object Int8Array]", Hr = "[object Int16Array]", Yr = "[object Int32Array]", Zr = "[object Uint8Array]", qr = "[object Uint8ClampedArray]", Xr = "[object Uint16Array]", Qr = "[object Uint32Array]", h = {};
h[De] = h[vr] = h[Gr] = h[Ur] = h[Pr] = h[Lr] = h[Br] = h[jr] = h[Kr] = h[Hr] = h[Yr] = h[Sr] = h[Nr] = h[Ge] = h[Fr] = h[Mr] = h[xr] = h[Dr] = h[Zr] = h[qr] = h[Xr] = h[Qr] = true;
h[Ir] = h[Re] = h[Rr] = false;
function j(e, n, r, t, i, s) {
    var a, u = n & $r, f = n & mr, g = n & wr;
    if (a !== void 0) return a;
    if (!ye$1(e)) return e;
    var l = rr$1(e);
    if (l) {
        if (a = Yn(e), !u) return Rg(e, a);
    } else {
        var o = AC(e), d = o == Re || o == Cr;
        if (Nn$1(e)) return $g(e, u);
        if (o == Ge || o == De || d && !i) {
            if (a = f || d ? {} : Hg(e), !u) return f ? Bn(e, Fn(a, e)) : Rn(e, Nn(a, e));
        } else {
            if (!h[o]) return i ? e : {};
            a = cr(e, o, u);
        }
    }
    s || (s = new Re$1());
    var A = s.get(e);
    if (A) return A;
    s.set(e, a), Or(e) ? e.forEach(function(c) {
        a.add(j(c, n, r, c, e, s));
    }) : yr(e) && e.forEach(function(c, _) {
        a.set(_, j(c, n, r, _, e, s));
    });
    var p = g ? f ? jn : q : f ? Ja : T, b = l ? void 0 : p(e);
    return Le(b || e, function(c, _) {
        b && (_ = c, c = e[_]), Rm(a, _, j(c, n, r, _, e, s));
    }), a;
}
var Wr = "__lodash_hash_undefined__";
function Jr(e) {
    return this.__data__.set(e, Wr), this;
}
function zr(e) {
    return this.__data__.has(e);
}
function S(e) {
    var n = -1, r = e == null ? 0 : e.length;
    for(this.__data__ = new ne(); ++n < r;)this.add(e[n]);
}
S.prototype.add = S.prototype.push = Jr;
S.prototype.has = zr;
function Vr(e, n) {
    for(var r = -1, t = e == null ? 0 : e.length; ++r < t;)if (n(e[r], r, e)) return true;
    return false;
}
function Ue(e, n) {
    return e.has(n);
}
var kr = 1, et = 2;
function Be(e, n, r, t, i, s) {
    var a = r & kr, u = e.length, f = n.length;
    if (u != f && !(a && f > u)) return false;
    var g = s.get(e), l = s.get(n);
    if (g && l) return g == n && l == e;
    var o = -1, d = true, A = r & et ? new S() : void 0;
    for(s.set(e, n), s.set(n, e); ++o < u;){
        var p = e[o], b = n[o];
        if (t) var c = a ? t(b, p, o, n, e, s) : t(p, b, o, e, n, s);
        if (c !== void 0) {
            if (c) continue;
            d = false;
            break;
        }
        if (A) {
            if (!Vr(n, function(_, $) {
                if (!Ue(A, $) && (p === _ || i(p, _, r, t, s))) return A.push($);
            })) {
                d = false;
                break;
            }
        } else if (!(p === b || i(p, b, r, t, s))) {
            d = false;
            break;
        }
    }
    return s.delete(e), s.delete(n), d;
}
function nt(e) {
    var n = -1, r = Array(e.size);
    return e.forEach(function(t, i) {
        r[++n] = [
            i,
            t
        ];
    }), r;
}
function V(e) {
    var n = -1, r = Array(e.size);
    return e.forEach(function(t) {
        r[++n] = t;
    }), r;
}
var rt = 1, tt = 2, it = "[object Boolean]", st = "[object Date]", at = "[object Error]", ut = "[object Map]", ft = "[object Number]", ot = "[object RegExp]", dt = "[object Set]", ht = "[object String]", lt = "[object Symbol]", gt = "[object ArrayBuffer]", ct = "[object DataView]", ge = tr$1 ? tr$1.prototype : void 0, K = ge ? ge.valueOf : void 0;
function _t(e, n, r, t, i, s, a) {
    switch(r){
        case ct:
            if (e.byteLength != n.byteLength || e.byteOffset != n.byteOffset) return false;
            e = e.buffer, n = n.buffer;
        case gt:
            return !(e.byteLength != n.byteLength || !s(new ss(e), new ss(n)));
        case it:
        case st:
        case ft:
            return br$1(+e, +n);
        case at:
            return e.name == n.name && e.message == n.message;
        case ot:
        case ht:
            return e == n + "";
        case ut:
            var u = nt;
        case dt:
            var f = t & rt;
            if (u || (u = V), e.size != n.size && !f) return false;
            var g = a.get(e);
            if (g) return g == n;
            t |= tt, a.set(e, n);
            var l = Be(u(e), u(n), t, i, s, a);
            return a.delete(e), l;
        case lt:
            if (K) return K.call(e) == K.call(n);
    }
    return false;
}
var pt = 1, bt = Object.prototype, yt = bt.hasOwnProperty;
function At(e, n, r, t, i, s) {
    var a = r & pt, u = q(e), f = u.length, g = q(n), l = g.length;
    if (f != l && !a) return false;
    for(var o = f; o--;){
        var d = u[o];
        if (!(a ? d in n : yt.call(n, d))) return false;
    }
    var A = s.get(e), p = s.get(n);
    if (A && p) return A == n && p == e;
    var b = true;
    s.set(e, n), s.set(n, e);
    for(var c = a; ++o < f;){
        d = u[o];
        var _ = e[d], $ = n[d];
        if (t) var ne = a ? t($, _, d, n, e, s) : t(_, $, d, e, n, s);
        if (!(ne === void 0 ? _ === $ || i(_, $, r, t, s) : ne)) {
            b = false;
            break;
        }
        c || (c = d == "constructor");
    }
    if (b && !c) {
        var N = e.constructor, F = n.constructor;
        N != F && "constructor" in e && "constructor" in n && !(typeof N == "function" && _instanceof(N, N) && typeof F == "function" && _instanceof(F, F)) && (b = false);
    }
    return s.delete(e), s.delete(n), b;
}
var Tt = 1, ce = "[object Arguments]", _e = "[object Array]", x = "[object Object]", Et = Object.prototype, pe = Et.hasOwnProperty;
function Ot(e, n, r, t, i, s) {
    var a = rr$1(e), u = rr$1(n), f = a ? _e : AC(e), g = u ? _e : AC(n);
    f = f == ce ? x : f, g = g == ce ? x : g;
    var l = f == x, o = g == x, d = f == g;
    if (d && Nn$1(e)) {
        if (!Nn$1(n)) return false;
        a = true, l = false;
    }
    if (d && !l) return s || (s = new Re$1()), a || Rn$1(e) ? Be(e, n, r, t, i, s) : _t(e, n, f, r, t, i, s);
    if (!(r & Tt)) {
        var A = l && pe.call(e, "__wrapped__"), p = o && pe.call(n, "__wrapped__");
        if (A || p) {
            var b = A ? e.value() : e, c = p ? n.value() : n;
            return s || (s = new Re$1()), i(b, c, r, t, s);
        }
    }
    return d ? (s || (s = new Re$1()), At(e, n, r, t, i, s)) : false;
}
function k(e, n, r, t, i) {
    return e === n ? true : e == null || n == null || !_i(e) && !_i(n) ? e !== e && n !== n : Ot(e, n, r, t, k, i);
}
var $t = 1, mt = 2;
function wt(e, n, r, t) {
    var i = r.length, s = i;
    if (e == null) return !s;
    for(e = Object(e); i--;){
        var u = r[i];
        if (u[2] ? u[1] !== e[u[0]] : !(u[0] in e)) return false;
    }
    for(; ++i < s;){
        u = r[i];
        var f = u[0], g = e[f], l = u[1];
        if (u[2]) {
            if (g === void 0 && !(f in e)) return false;
        } else {
            var o = new Re$1();
            var d; 
            if (!(d === void 0 ? k(l, g, $t | mt, t, o) : d)) return false;
        }
    }
    return true;
}
function je(e) {
    return e === e && !ye$1(e);
}
function vt(e) {
    for(var n = T(e), r = n.length; r--;){
        var t = n[r], i = e[t];
        n[r] = [
            t,
            i,
            je(i)
        ];
    }
    return n;
}
function Ke(e, n) {
    return function(r) {
        return r == null ? false : r[e] === n && (n !== void 0 || e in Object(r));
    };
}
function Pt(e) {
    var n = vt(e);
    return n.length == 1 && n[0][2] ? Ke(n[0][0], n[0][1]) : function(r) {
        return r === e || wt(r, e, n);
    };
}
function Lt(e, n) {
    return e != null && n in Object(e);
}
function He(e, n, r) {
    n = Ie(n, e);
    for(var t = -1, i = n.length, s = false; ++t < i;){
        var a = U(n[t]);
        if (!(s = e != null && r(e, a))) break;
        e = e[a];
    }
    return s || ++t != i ? s : (i = e == null ? 0 : e.length, !!i && Ga(i) && Za(a, i) && (rr$1(e) || ir$1(e)));
}
function It(e, n) {
    return e != null && He(e, n, Lt);
}
var Ct = 1, St = 2;
function Nt(e, n) {
    return W(e) && je(n) ? Ke(U(e), n) : function(r) {
        var t = In(r, e);
        return t === void 0 && t === n ? It(r, e) : k(n, t, Ct | St);
    };
}
function Ft(e) {
    return function(n) {
        return n == null ? void 0 : n[e];
    };
}
function Mt(e) {
    return function(n) {
        return Ce(n, e);
    };
}
function xt(e) {
    return W(e) ? Ft(U(e)) : Mt(e);
}
function Ye(e) {
    return typeof e == "function" ? e : e == null ? tl : (typeof e === "undefined" ? "undefined" : _type_of(e)) == "object" ? rr$1(e) ? Nt(e[0], e[1]) : Pt(e) : xt(e);
}
function Dt(e, n) {
    return e && Mg(e, n, T);
}
function Rt(e, n) {
    return function(r, t) {
        if (r == null) return r;
        if (!vr$1(r)) return e(r, t);
        for(var i = r.length, s = -1, a = Object(r); (++s < i) && t(a[s], s, a) !== false;);
        return r;
    };
}
var Gt = Rt(Dt);
var ee = Gt;
function Bt(e) {
    return typeof e == "function" ? e : tl;
}
function m(e, n) {
    var r = rr$1(e) ? Le : ee;
    return r(e, Bt(n));
}
function jt(e, n) {
    var r = [];
    return ee(e, function(t, i, s) {
        n(t, i, s) && r.push(t);
    }), r;
}
function D(e, n) {
    var r = rr$1(e) ? Ne : jt;
    return r(e, Ye(n));
}
var Kt = Object.prototype, Ht = Kt.hasOwnProperty;
function Yt(e, n) {
    return e != null && Ht.call(e, n);
}
function E(e, n) {
    return e != null && He(e, n, Yt);
}
function Zt(e, n) {
    return ve(n, function(r) {
        return e[r];
    });
}
function H(e) {
    return e == null ? [] : Zt(e, T(e));
}
function v(e) {
    return e === void 0;
}
function qt(e, n, r, t, i) {
    return i(e, function(s, a, u) {
        r = t ? (t = false, s) : n(r, s, a, u);
    }), r;
}
function Xt(e, n, r) {
    var t = rr$1(e) ? Sn : qt, i = arguments.length < 3;
    return t(e, Ye(n), r, i, ee);
}
var Qt = 1 / 0, Wt = _n$1 && 1 / V(new _n$1([
    ,
    -0
]))[1] == Qt ? function Wt(e) {
    return new _n$1(e);
} : gn;
var Jt = Wt;
var zt = 200;
function Vt(e, n, r) {
    var t = -1, i = yn, s = e.length, a = true, u = [], f = u;
    if (s >= zt) {
        var g = Jt(e);
        if (g) return V(g);
        a = false, i = Ue, f = new S();
    } else f = u;
    e: for(; ++t < s;){
        var l = e[t], o = l;
        if (l = l !== 0 ? l : 0, a && o === o) {
            for(var d = f.length; d--;)if (f[d] === o) continue e;
            u.push(l);
        } else i(f, o, r) || (f !== u && f.push(o), u.push(l));
    }
    return u;
}
var kt = h0(function(e) {
    return Vt(Se(e, 1, Kg, true));
});
var ei = kt;
var ni = "\0", w = "\0", be = "";
var Ze = /*#__PURE__*/ function() {
    function Ze() {
        var n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
        _class_call_check(this, Ze);
        this._isDirected = E(n, "directed") ? n.directed : true, this._isMultigraph = E(n, "multigraph") ? n.multigraph : false, this._isCompound = E(n, "compound") ? n.compound : false, this._label = void 0, this._defaultNodeLabelFn = t0(void 0), this._defaultEdgeLabelFn = t0(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[w] = {}), this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {};
    }
    _create_class(Ze, [
        {
            /* === Graph functions ========= */ key: "isDirected",
            value: function isDirected() {
                return this._isDirected;
            }
        },
        {
            key: "isMultigraph",
            value: function isMultigraph() {
                return this._isMultigraph;
            }
        },
        {
            key: "isCompound",
            value: function isCompound() {
                return this._isCompound;
            }
        },
        {
            key: "setGraph",
            value: function setGraph(n) {
                return this._label = n, this;
            }
        },
        {
            key: "graph",
            value: function graph() {
                return this._label;
            }
        },
        {
            /* === Node functions ========== */ key: "setDefaultNodeLabel",
            value: function setDefaultNodeLabel(n) {
                return In$1(n) || (n = t0(n)), this._defaultNodeLabelFn = n, this;
            }
        },
        {
            key: "nodeCount",
            value: function nodeCount() {
                return this._nodeCount;
            }
        },
        {
            key: "nodes",
            value: function nodes() {
                return T(this._nodes);
            }
        },
        {
            key: "sources",
            value: function sources() {
                var n = this;
                return D(this.nodes(), function(r) {
                    return Gr$1(n._in[r]);
                });
            }
        },
        {
            key: "sinks",
            value: function sinks() {
                var n = this;
                return D(this.nodes(), function(r) {
                    return Gr$1(n._out[r]);
                });
            }
        },
        {
            key: "setNodes",
            value: function setNodes(n, r) {
                var t = arguments, i = this;
                return m(n, function(s) {
                    t.length > 1 ? i.setNode(s, r) : i.setNode(s);
                }), this;
            }
        },
        {
            key: "setNode",
            value: function setNode(n, r) {
                return E(this._nodes, n) ? (arguments.length > 1 && (this._nodes[n] = r), this) : (this._nodes[n] = arguments.length > 1 ? r : this._defaultNodeLabelFn(n), this._isCompound && (this._parent[n] = w, this._children[n] = {}, this._children[w][n] = true), this._in[n] = {}, this._preds[n] = {}, this._out[n] = {}, this._sucs[n] = {}, ++this._nodeCount, this);
            }
        },
        {
            key: "node",
            value: function node(n) {
                return this._nodes[n];
            }
        },
        {
            key: "hasNode",
            value: function hasNode(n) {
                return E(this._nodes, n);
            }
        },
        {
            key: "removeNode",
            value: function removeNode(n) {
                var r = this;
                if (E(this._nodes, n)) {
                    var t = function t(i) {
                        r.removeEdge(r._edgeObjs[i]);
                    };
                    delete this._nodes[n], this._isCompound && (this._removeFromParentsChildList(n), delete this._parent[n], m(this.children(n), function(i) {
                        r.setParent(i);
                    }), delete this._children[n]), m(T(this._in[n]), t), delete this._in[n], delete this._preds[n], m(T(this._out[n]), t), delete this._out[n], delete this._sucs[n], --this._nodeCount;
                }
                return this;
            }
        },
        {
            key: "setParent",
            value: function setParent(n, r) {
                if (!this._isCompound) throw new Error("Cannot set parent in a non-compound graph");
                if (v(r)) r = w;
                else {
                    r += "";
                    for(var t = r; !v(t); t = this.parent(t))if (t === n) throw new Error("Setting " + r + " as parent of " + n + " would create a cycle");
                    this.setNode(r);
                }
                return this.setNode(n), this._removeFromParentsChildList(n), this._parent[n] = r, this._children[r][n] = true, this;
            }
        },
        {
            key: "_removeFromParentsChildList",
            value: function _removeFromParentsChildList(n) {
                delete this._children[this._parent[n]][n];
            }
        },
        {
            key: "parent",
            value: function parent(n) {
                if (this._isCompound) {
                    var r = this._parent[n];
                    if (r !== w) return r;
                }
            }
        },
        {
            key: "children",
            value: function children(n) {
                if (v(n) && (n = w), this._isCompound) {
                    var r = this._children[n];
                    if (r) return T(r);
                } else {
                    if (n === w) return this.nodes();
                    if (this.hasNode(n)) return [];
                }
            }
        },
        {
            key: "predecessors",
            value: function predecessors(n) {
                var r = this._preds[n];
                if (r) return T(r);
            }
        },
        {
            key: "successors",
            value: function successors(n) {
                var r = this._sucs[n];
                if (r) return T(r);
            }
        },
        {
            key: "neighbors",
            value: function neighbors(n) {
                var r = this.predecessors(n);
                if (r) return ei(r, this.successors(n));
            }
        },
        {
            key: "isLeaf",
            value: function isLeaf(n) {
                var r;
                return this.isDirected() ? r = this.successors(n) : r = this.neighbors(n), r.length === 0;
            }
        },
        {
            key: "filterNodes",
            value: function filterNodes(n) {
                var r = new this.constructor({
                    directed: this._isDirected,
                    multigraph: this._isMultigraph,
                    compound: this._isCompound
                });
                r.setGraph(this.graph());
                var t = this;
                m(this._nodes, function(a, u) {
                    n(u) && r.setNode(u, a);
                }), m(this._edgeObjs, function(a) {
                    r.hasNode(a.v) && r.hasNode(a.w) && r.setEdge(a, t.edge(a));
                });
                var i = {};
                function s(a) {
                    var u = t.parent(a);
                    return u === void 0 || r.hasNode(u) ? (i[a] = u, u) : u in i ? i[u] : s(u);
                }
                return this._isCompound && m(r.nodes(), function(a) {
                    r.setParent(a, s(a));
                }), r;
            }
        },
        {
            /* === Edge functions ========== */ key: "setDefaultEdgeLabel",
            value: function setDefaultEdgeLabel(n) {
                return In$1(n) || (n = t0(n)), this._defaultEdgeLabelFn = n, this;
            }
        },
        {
            key: "edgeCount",
            value: function edgeCount() {
                return this._edgeCount;
            }
        },
        {
            key: "edges",
            value: function edges() {
                return H(this._edgeObjs);
            }
        },
        {
            key: "setPath",
            value: function setPath(n, r) {
                var t = this, i = arguments;
                return Xt(n, function(s, a) {
                    return i.length > 1 ? t.setEdge(s, a, r) : t.setEdge(s, a), a;
                }), this;
            }
        },
        {
            /*
   * setEdge(v, w, [value, [name]])
   * setEdge({ v, w, [name] }, [value])
   */ key: "setEdge",
            value: function setEdge() {
                var n, r, t, i, s = false, a = arguments[0];
                (typeof a === "undefined" ? "undefined" : _type_of(a)) == "object" && a !== null && "v" in a ? (n = a.v, r = a.w, t = a.name, arguments.length === 2 && (i = arguments[1], s = true)) : (n = a, r = arguments[1], t = arguments[3], arguments.length > 2 && (i = arguments[2], s = true)), n = "" + n, r = "" + r, v(t) || (t = "" + t);
                var u = P(this._isDirected, n, r, t);
                if (E(this._edgeLabels, u)) return s && (this._edgeLabels[u] = i), this;
                if (!v(t) && !this._isMultigraph) throw new Error("Cannot set a named edge when isMultigraph = false");
                this.setNode(n), this.setNode(r), this._edgeLabels[u] = s ? i : this._defaultEdgeLabelFn(n, r, t);
                var f = ri(this._isDirected, n, r, t);
                return n = f.v, r = f.w, Object.freeze(f), this._edgeObjs[u] = f, ye(this._preds[r], n), ye(this._sucs[n], r), this._in[r][u] = f, this._out[n][u] = f, this._edgeCount++, this;
            }
        },
        {
            key: "edge",
            value: function edge(n, r, t) {
                var i = arguments.length === 1 ? Y(this._isDirected, arguments[0]) : P(this._isDirected, n, r, t);
                return this._edgeLabels[i];
            }
        },
        {
            key: "hasEdge",
            value: function hasEdge(n, r, t) {
                var i = arguments.length === 1 ? Y(this._isDirected, arguments[0]) : P(this._isDirected, n, r, t);
                return E(this._edgeLabels, i);
            }
        },
        {
            key: "removeEdge",
            value: function removeEdge(n, r, t) {
                var i = arguments.length === 1 ? Y(this._isDirected, arguments[0]) : P(this._isDirected, n, r, t), s = this._edgeObjs[i];
                return s && (n = s.v, r = s.w, delete this._edgeLabels[i], delete this._edgeObjs[i], Ae(this._preds[r], n), Ae(this._sucs[n], r), delete this._in[r][i], delete this._out[n][i], this._edgeCount--), this;
            }
        },
        {
            key: "inEdges",
            value: function inEdges(n, r) {
                var t = this._in[n];
                if (t) {
                    var i = H(t);
                    return r ? D(i, function(s) {
                        return s.v === r;
                    }) : i;
                }
            }
        },
        {
            key: "outEdges",
            value: function outEdges(n, r) {
                var t = this._out[n];
                if (t) {
                    var i = H(t);
                    return r ? D(i, function(s) {
                        return s.w === r;
                    }) : i;
                }
            }
        },
        {
            key: "nodeEdges",
            value: function nodeEdges(n, r) {
                var t = this.inEdges(n, r);
                if (t) return t.concat(this.outEdges(n, r));
            }
        }
    ]);
    return Ze;
}();
Ze.prototype._nodeCount = 0;
Ze.prototype._edgeCount = 0;
function ye(e, n) {
    e[n] ? e[n]++ : e[n] = 1;
}
function Ae(e, n) {
    --e[n] || delete e[n];
}
function P(e, n, r, t) {
    var i = "" + n, s = "" + r;
    if (!e && i > s) {
        var a = i;
        i = s, s = a;
    }
    return i + be + s + be + (v(t) ? ni : t);
}
function ri(e, n, r, t) {
    var i = "" + n, s = "" + r;
    if (!e && i > s) {
        var a = i;
        i = s, s = a;
    }
    var u = {
        v: i,
        w: s
    };
    return t && (u.name = t), u;
}
function Y(e, n) {
    return P(e, n.v, n.w, n.name);
}

export { Bt as B, Ce as C, Dt as D, E, H, Ie as I, Pn as P, Q, Se as S, T, U, Xt as X, Ye as Y, Ze as Z, ve as a, D as b, It as c, cn as d, ee as e, j, m, v };
