import { a as Y, b as O, d as Ee, e as q, c as K, f as Ke, g as fe, h as Xe, j as jn, k as He, s as Mn, o as Rn, l as $n, m as de, n as Fn, p as se, r as Bn, q as ze, t as Gn, u as Dn, v as Yn, U as Te, S as Pe, w as ce, x as U, y as le, z as Je, A as Ze, B as Un, C as N, D as Vn, E as Wn, F as qn, H as Le, I as Kn, J as Qe, K as C, L as Xn, M as Hn, N as B, O as en, P as nn, Q as zn, R as he, T as rn, V as Jn, W as tn, X as Zn, Y as Qn, Z as c, G as E, _ as er, i as x, $ as R, a0 as I, a1 as X } from "./graph-DB2UxkYH.js";
var nr = /\s/;
function rr(e) {
  for (var n = e.length; n-- && nr.test(e.charAt(n)); )
    ;
  return n;
}
var tr = /^\s+/;
function ir(e) {
  return e && e.slice(0, rr(e) + 1).replace(tr, "");
}
var Ne = NaN, ar = /^[-+]0x[0-9a-f]+$/i, or = /^0b[01]+$/i, ur = /^0o[0-7]+$/i, fr = parseInt;
function dr(e) {
  if (typeof e == "number")
    return e;
  if (Y(e))
    return Ne;
  if (O(e)) {
    var n = typeof e.valueOf == "function" ? e.valueOf() : e;
    e = O(n) ? n + "" : n;
  }
  if (typeof e != "string")
    return e === 0 ? e : +e;
  e = ir(e);
  var r = or.test(e);
  return r || ur.test(e) ? fr(e.slice(2), r ? 2 : 8) : ar.test(e) ? Ne : +e;
}
var Ie = 1 / 0, sr = 17976931348623157e292;
function G(e) {
  if (!e)
    return e === 0 ? e : 0;
  if (e = dr(e), e === Ie || e === -Ie) {
    var n = e < 0 ? -1 : 1;
    return n * sr;
  }
  return e === e ? e : 0;
}
function cr(e) {
  var n = G(e), r = n % 1;
  return n === n ? r ? n - r : n : 0;
}
var _e = Object.create, lr = /* @__PURE__ */ function() {
  function e() {
  }
  return function(n) {
    if (!O(n))
      return {};
    if (_e)
      return _e(n);
    e.prototype = n;
    var r = new e();
    return e.prototype = void 0, r;
  };
}();
function an(e, n) {
  var r = -1, t = e.length;
  for (n || (n = Array(t)); ++r < t; )
    n[r] = e[r];
  return n;
}
function H(e, n, r) {
  n == "__proto__" && Ee ? Ee(e, n, {
    configurable: !0,
    enumerable: !0,
    value: r,
    writable: !0
  }) : e[n] = r;
}
var hr = Object.prototype, vr = hr.hasOwnProperty;
function z(e, n, r) {
  var t = e[n];
  (!(vr.call(e, n) && q(t, r)) || r === void 0 && !(n in e)) && H(e, n, r);
}
function $(e, n, r, t) {
  var i = !r;
  r || (r = {});
  for (var o = -1, a = n.length; ++o < a; ) {
    var u = n[o], f = void 0;
    f === void 0 && (f = e[u]), i ? H(r, u, f) : z(r, u, f);
  }
  return r;
}
function S(e, n, r) {
  if (!O(r))
    return !1;
  var t = typeof n;
  return (t == "number" ? K(r) && Ke(n, r.length) : t == "string" && n in r) ? q(r[n], e) : !1;
}
function pr(e) {
  return fe(function(n, r) {
    var t = -1, i = r.length, o = i > 1 ? r[i - 1] : void 0, a = i > 2 ? r[2] : void 0;
    for (o = e.length > 3 && typeof o == "function" ? (i--, o) : void 0, a && S(r[0], r[1], a) && (o = i < 3 ? void 0 : o, i = 1), n = Object(n); ++t < i; ) {
      var u = r[t];
      u && e(n, u, t, o);
    }
    return n;
  });
}
function br(e) {
  var n = [];
  if (e != null)
    for (var r in Object(e))
      n.push(r);
  return n;
}
var wr = Object.prototype, gr = wr.hasOwnProperty;
function mr(e) {
  if (!O(e))
    return br(e);
  var n = Xe(e), r = [];
  for (var t in e)
    t == "constructor" && (n || !gr.call(e, t)) || r.push(t);
  return r;
}
function P(e) {
  return K(e) ? jn(e, !0) : mr(e);
}
function A(e) {
  var n = e == null ? 0 : e.length;
  return n ? He(e) : [];
}
function yr(e) {
  return Mn(Rn(e, void 0, A), e + "");
}
var ve = $n(Object.getPrototypeOf, Object), xr = "[object Object]", Or = Function.prototype, Er = Object.prototype, on = Or.toString, Tr = Er.hasOwnProperty, Pr = on.call(Object);
function Lr(e) {
  if (!de(e) || Fn(e) != xr)
    return !1;
  var n = ve(e);
  if (n === null)
    return !0;
  var r = Tr.call(n, "constructor") && n.constructor;
  return typeof r == "function" && r instanceof r && on.call(r) == Pr;
}
function Nr(e, n) {
  return e && $(n, se(n), e);
}
function Ir(e, n) {
  return e && $(n, P(n), e);
}
var un = typeof exports == "object" && exports && !exports.nodeType && exports, Ce = un && typeof module == "object" && module && !module.nodeType && module, _r = Ce && Ce.exports === un, Ae = _r ? Bn.Buffer : void 0, ke = Ae ? Ae.allocUnsafe : void 0;
function fn(e, n) {
  if (n)
    return e.slice();
  var r = e.length, t = ke ? ke(r) : new e.constructor(r);
  return e.copy(t), t;
}
function Cr(e, n) {
  return $(e, ze(e), n);
}
var Ar = Object.getOwnPropertySymbols, dn = Ar ? function(e) {
  for (var n = []; e; )
    Dn(n, ze(e)), e = ve(e);
  return n;
} : Gn;
function kr(e, n) {
  return $(e, dn(e), n);
}
function Sr(e) {
  return Yn(e, P, dn);
}
var jr = Object.prototype, Mr = jr.hasOwnProperty;
function Rr(e) {
  var n = e.length, r = new e.constructor(n);
  return n && typeof e[0] == "string" && Mr.call(e, "index") && (r.index = e.index, r.input = e.input), r;
}
function pe(e) {
  var n = new e.constructor(e.byteLength);
  return new Te(n).set(new Te(e)), n;
}
function $r(e, n) {
  var r = n ? pe(e.buffer) : e.buffer;
  return new e.constructor(r, e.byteOffset, e.byteLength);
}
var Fr = /\w*$/;
function Br(e) {
  var n = new e.constructor(e.source, Fr.exec(e));
  return n.lastIndex = e.lastIndex, n;
}
var Se = Pe ? Pe.prototype : void 0, je = Se ? Se.valueOf : void 0;
function Gr(e) {
  return je ? Object(je.call(e)) : {};
}
function sn(e, n) {
  var r = n ? pe(e.buffer) : e.buffer;
  return new e.constructor(r, e.byteOffset, e.length);
}
var Dr = "[object Boolean]", Yr = "[object Date]", Ur = "[object Map]", Vr = "[object Number]", Wr = "[object RegExp]", qr = "[object Set]", Kr = "[object String]", Xr = "[object Symbol]", Hr = "[object ArrayBuffer]", zr = "[object DataView]", Jr = "[object Float32Array]", Zr = "[object Float64Array]", Qr = "[object Int8Array]", et = "[object Int16Array]", nt = "[object Int32Array]", rt = "[object Uint8Array]", tt = "[object Uint8ClampedArray]", it = "[object Uint16Array]", at = "[object Uint32Array]";
function ot(e, n, r) {
  var t = e.constructor;
  switch (n) {
    case Hr:
      return pe(e);
    case Dr:
    case Yr:
      return new t(+e);
    case zr:
      return $r(e, r);
    case Jr:
    case Zr:
    case Qr:
    case et:
    case nt:
    case rt:
    case tt:
    case it:
    case at:
      return sn(e, r);
    case Ur:
      return new t();
    case Vr:
    case Kr:
      return new t(e);
    case Wr:
      return Br(e);
    case qr:
      return new t();
    case Xr:
      return Gr(e);
  }
}
function cn(e) {
  return typeof e.constructor == "function" && !Xe(e) ? lr(ve(e)) : {};
}
var ut = "[object Map]";
function ft(e) {
  return de(e) && ce(e) == ut;
}
var Me = U && U.isMap, dt = Me ? le(Me) : ft, st = "[object Set]";
function ct(e) {
  return de(e) && ce(e) == st;
}
var Re = U && U.isSet, lt = Re ? le(Re) : ct, ht = 1, vt = 2, pt = 4, ln = "[object Arguments]", bt = "[object Array]", wt = "[object Boolean]", gt = "[object Date]", mt = "[object Error]", hn = "[object Function]", yt = "[object GeneratorFunction]", xt = "[object Map]", Ot = "[object Number]", vn = "[object Object]", Et = "[object RegExp]", Tt = "[object Set]", Pt = "[object String]", Lt = "[object Symbol]", Nt = "[object WeakMap]", It = "[object ArrayBuffer]", _t = "[object DataView]", Ct = "[object Float32Array]", At = "[object Float64Array]", kt = "[object Int8Array]", St = "[object Int16Array]", jt = "[object Int32Array]", Mt = "[object Uint8Array]", Rt = "[object Uint8ClampedArray]", $t = "[object Uint16Array]", Ft = "[object Uint32Array]", b = {};
b[ln] = b[bt] = b[It] = b[_t] = b[wt] = b[gt] = b[Ct] = b[At] = b[kt] = b[St] = b[jt] = b[xt] = b[Ot] = b[vn] = b[Et] = b[Tt] = b[Pt] = b[Lt] = b[Mt] = b[Rt] = b[$t] = b[Ft] = !0;
b[mt] = b[hn] = b[Nt] = !1;
function D(e, n, r, t, i, o) {
  var a, u = n & ht, f = n & vt, d = n & pt;
  if (a !== void 0)
    return a;
  if (!O(e))
    return e;
  var s = N(e);
  if (s) {
    if (a = Rr(e), !u)
      return an(e, a);
  } else {
    var l = ce(e), h = l == hn || l == yt;
    if (Je(e))
      return fn(e, u);
    if (l == vn || l == ln || h && !i) {
      if (a = f || h ? {} : cn(e), !u)
        return f ? kr(e, Ir(a, e)) : Cr(e, Nr(a, e));
    } else {
      if (!b[l])
        return i ? e : {};
      a = ot(e, l, u);
    }
  }
  o || (o = new Ze());
  var v = o.get(e);
  if (v)
    return v;
  o.set(e, a), lt(e) ? e.forEach(function(m) {
    a.add(D(m, n, r, m, e, o));
  }) : dt(e) && e.forEach(function(m, y) {
    a.set(y, D(m, n, r, y, e, o));
  });
  var p = d ? f ? Sr : Vn : f ? P : se, w = s ? void 0 : p(e);
  return Un(w || e, function(m, y) {
    w && (y = m, m = e[y]), z(a, y, D(m, n, r, y, e, o));
  }), a;
}
var Bt = 1, Gt = 4;
function Dt(e) {
  return D(e, Bt | Gt);
}
var pn = Object.prototype, Yt = pn.hasOwnProperty, Ut = fe(function(e, n) {
  e = Object(e);
  var r = -1, t = n.length, i = t > 2 ? n[2] : void 0;
  for (i && S(n[0], n[1], i) && (t = 1); ++r < t; )
    for (var o = n[r], a = P(o), u = -1, f = a.length; ++u < f; ) {
      var d = a[u], s = e[d];
      (s === void 0 || q(s, pn[d]) && !Yt.call(e, d)) && (e[d] = o[d]);
    }
  return e;
});
function ie(e, n, r) {
  (r !== void 0 && !q(e[n], r) || r === void 0 && !(n in e)) && H(e, n, r);
}
function ae(e, n) {
  if (!(n === "constructor" && typeof e[n] == "function") && n != "__proto__")
    return e[n];
}
function Vt(e) {
  return $(e, P(e));
}
function Wt(e, n, r, t, i, o, a) {
  var u = ae(e, r), f = ae(n, r), d = a.get(f);
  if (d) {
    ie(e, r, d);
    return;
  }
  var s = o ? o(u, f, r + "", e, n, a) : void 0, l = s === void 0;
  if (l) {
    var h = N(f), v = !h && Je(f), p = !h && !v && Wn(f);
    s = f, h || v || p ? N(u) ? s = u : qn(u) ? s = an(u) : v ? (l = !1, s = fn(f, !0)) : p ? (l = !1, s = sn(f, !0)) : s = [] : Lr(f) || Le(f) ? (s = u, Le(u) ? s = Vt(u) : (!O(u) || Kn(u)) && (s = cn(f))) : l = !1;
  }
  l && (a.set(f, s), i(s, f, t, o, a), a.delete(f)), ie(e, r, s);
}
function bn(e, n, r, t, i) {
  e !== n && Qe(n, function(o, a) {
    if (i || (i = new Ze()), O(o))
      Wt(e, n, a, r, bn, t, i);
    else {
      var u = t ? t(ae(e, a), o, a + "", e, n, i) : void 0;
      u === void 0 && (u = o), ie(e, a, u);
    }
  }, P);
}
function V(e) {
  var n = e == null ? 0 : e.length;
  return n ? e[n - 1] : void 0;
}
function qt(e) {
  return function(n, r, t) {
    var i = Object(n);
    if (!K(n)) {
      var o = C(r);
      n = se(n), r = function(u) {
        return o(i[u], u, i);
      };
    }
    var a = e(n, r, t);
    return a > -1 ? i[o ? n[a] : a] : void 0;
  };
}
var Kt = Math.max;
function Xt(e, n, r) {
  var t = e == null ? 0 : e.length;
  if (!t)
    return -1;
  var i = r == null ? 0 : cr(r);
  return i < 0 && (i = Kt(t + i, 0)), Xn(e, C(n), i);
}
var be = qt(Xt);
function wn(e, n) {
  var r = -1, t = K(e) ? Array(e.length) : [];
  return Hn(e, function(i, o, a) {
    t[++r] = n(i, o, a);
  }), t;
}
function g(e, n) {
  var r = N(e) ? B : wn;
  return r(e, C(n));
}
function Ht(e, n) {
  return e == null ? e : Qe(e, en(n), P);
}
function zt(e, n) {
  return e && nn(e, en(n));
}
function Jt(e, n) {
  return e > n;
}
var Zt = Object.prototype, Qt = Zt.hasOwnProperty;
function ei(e, n) {
  return e != null && Qt.call(e, n);
}
function gn(e, n) {
  return e != null && zn(e, n, ei);
}
function mn(e, n) {
  return e < n;
}
function J(e, n) {
  var r = {};
  return n = C(n), nn(e, function(t, i, o) {
    H(r, i, n(t, i, o));
  }), r;
}
function we(e, n, r) {
  for (var t = -1, i = e.length; ++t < i; ) {
    var o = e[t], a = n(o);
    if (a != null && (u === void 0 ? a === a && !Y(a) : r(a, u)))
      var u = a, f = o;
  }
  return f;
}
function T(e) {
  return e && e.length ? we(e, he, Jt) : void 0;
}
var oe = pr(function(e, n, r) {
  bn(e, n, r);
});
function j(e) {
  return e && e.length ? we(e, he, mn) : void 0;
}
function ge(e, n) {
  return e && e.length ? we(e, C(n), mn) : void 0;
}
function ni(e, n, r, t) {
  if (!O(e))
    return e;
  n = rn(n, e);
  for (var i = -1, o = n.length, a = o - 1, u = e; u != null && ++i < o; ) {
    var f = Jn(n[i]), d = r;
    if (f === "__proto__" || f === "constructor" || f === "prototype")
      return e;
    if (i != a) {
      var s = u[f];
      d = void 0, d === void 0 && (d = O(s) ? s : Ke(n[i + 1]) ? [] : {});
    }
    z(u, f, d), u = u[f];
  }
  return e;
}
function ri(e, n, r) {
  for (var t = -1, i = n.length, o = {}; ++t < i; ) {
    var a = n[t], u = tn(e, a);
    r(u, a) && ni(o, rn(a, e), u);
  }
  return o;
}
function ti(e, n) {
  var r = e.length;
  for (e.sort(n); r--; )
    e[r] = e[r].value;
  return e;
}
function ii(e, n) {
  if (e !== n) {
    var r = e !== void 0, t = e === null, i = e === e, o = Y(e), a = n !== void 0, u = n === null, f = n === n, d = Y(n);
    if (!u && !d && !o && e > n || o && a && f && !u && !d || t && a && f || !r && f || !i)
      return 1;
    if (!t && !o && !d && e < n || d && r && i && !t && !o || u && r && i || !a && i || !f)
      return -1;
  }
  return 0;
}
function ai(e, n, r) {
  for (var t = -1, i = e.criteria, o = n.criteria, a = i.length, u = r.length; ++t < a; ) {
    var f = ii(i[t], o[t]);
    if (f) {
      if (t >= u)
        return f;
      var d = r[t];
      return f * (d == "desc" ? -1 : 1);
    }
  }
  return e.index - n.index;
}
function oi(e, n, r) {
  n.length ? n = B(n, function(o) {
    return N(o) ? function(a) {
      return tn(a, o.length === 1 ? o[0] : o);
    } : o;
  }) : n = [he];
  var t = -1;
  n = B(n, le(C));
  var i = wn(e, function(o, a, u) {
    var f = B(n, function(d) {
      return d(o);
    });
    return { criteria: f, index: ++t, value: o };
  });
  return ti(i, function(o, a) {
    return ai(o, a, r);
  });
}
function ui(e, n) {
  return ri(e, n, function(r, t) {
    return Zn(e, t);
  });
}
var W = yr(function(e, n) {
  return e == null ? {} : ui(e, n);
}), fi = Math.ceil, di = Math.max;
function si(e, n, r, t) {
  for (var i = -1, o = di(fi((n - e) / (r || 1)), 0), a = Array(o); o--; )
    a[++i] = e, e += r;
  return a;
}
function ci(e) {
  return function(n, r, t) {
    return t && typeof t != "number" && S(n, r, t) && (r = t = void 0), n = G(n), r === void 0 ? (r = n, n = 0) : r = G(r), t = t === void 0 ? n < r ? 1 : -1 : G(t), si(n, r, t);
  };
}
var _ = ci(), F = fe(function(e, n) {
  if (e == null)
    return [];
  var r = n.length;
  return r > 1 && S(e, n[0], n[1]) ? n = [] : r > 2 && S(n[0], n[1], n[2]) && (n = [n[0]]), oi(e, He(n), []);
}), li = 0;
function me(e) {
  var n = ++li;
  return Qn(e) + n;
}
function hi(e, n, r) {
  for (var t = -1, i = e.length, o = n.length, a = {}; ++t < i; ) {
    var u = t < o ? n[t] : void 0;
    r(a, e[t], u);
  }
  return a;
}
function vi(e, n) {
  return hi(e || [], n || [], z);
}
class pi {
  constructor() {
    var n = {};
    n._next = n._prev = n, this._sentinel = n;
  }
  dequeue() {
    var n = this._sentinel, r = n._prev;
    if (r !== n)
      return $e(r), r;
  }
  enqueue(n) {
    var r = this._sentinel;
    n._prev && n._next && $e(n), n._next = r._next, r._next._prev = n, r._next = n, n._prev = r;
  }
  toString() {
    for (var n = [], r = this._sentinel, t = r._prev; t !== r; )
      n.push(JSON.stringify(t, bi)), t = t._prev;
    return "[" + n.join(", ") + "]";
  }
}
function $e(e) {
  e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
}
function bi(e, n) {
  if (e !== "_next" && e !== "_prev")
    return n;
}
var wi = er(1);
function gi(e, n) {
  if (e.nodeCount() <= 1)
    return [];
  var r = yi(e, n || wi), t = mi(r.graph, r.buckets, r.zeroIdx);
  return A(
    g(t, function(i) {
      return e.outEdges(i.v, i.w);
    })
  );
}
function mi(e, n, r) {
  for (var t = [], i = n[n.length - 1], o = n[0], a; e.nodeCount(); ) {
    for (; a = o.dequeue(); )
      Q(e, n, r, a);
    for (; a = i.dequeue(); )
      Q(e, n, r, a);
    if (e.nodeCount()) {
      for (var u = n.length - 2; u > 0; --u)
        if (a = n[u].dequeue(), a) {
          t = t.concat(Q(e, n, r, a, !0));
          break;
        }
    }
  }
  return t;
}
function Q(e, n, r, t, i) {
  var o = i ? [] : void 0;
  return c(e.inEdges(t.v), function(a) {
    var u = e.edge(a), f = e.node(a.v);
    i && o.push({ v: a.v, w: a.w }), f.out -= u, ue(n, r, f);
  }), c(e.outEdges(t.v), function(a) {
    var u = e.edge(a), f = a.w, d = e.node(f);
    d.in -= u, ue(n, r, d);
  }), e.removeNode(t.v), o;
}
function yi(e, n) {
  var r = new E(), t = 0, i = 0;
  c(e.nodes(), function(u) {
    r.setNode(u, { v: u, in: 0, out: 0 });
  }), c(e.edges(), function(u) {
    var f = r.edge(u.v, u.w) || 0, d = n(u), s = f + d;
    r.setEdge(u.v, u.w, s), i = Math.max(i, r.node(u.v).out += d), t = Math.max(t, r.node(u.w).in += d);
  });
  var o = _(i + t + 3).map(function() {
    return new pi();
  }), a = t + 1;
  return c(r.nodes(), function(u) {
    ue(o, a, r.node(u));
  }), { graph: r, buckets: o, zeroIdx: a };
}
function ue(e, n, r) {
  r.out ? r.in ? e[r.out - r.in + n].enqueue(r) : e[e.length - 1].enqueue(r) : e[0].enqueue(r);
}
function xi(e) {
  var n = e.graph().acyclicer === "greedy" ? gi(e, r(e)) : Oi(e);
  c(n, function(t) {
    var i = e.edge(t);
    e.removeEdge(t), i.forwardName = t.name, i.reversed = !0, e.setEdge(t.w, t.v, i, me("rev"));
  });
  function r(t) {
    return function(i) {
      return t.edge(i).weight;
    };
  }
}
function Oi(e) {
  var n = [], r = {}, t = {};
  function i(o) {
    Object.prototype.hasOwnProperty.call(t, o) || (t[o] = !0, r[o] = !0, c(e.outEdges(o), function(a) {
      Object.prototype.hasOwnProperty.call(r, a.w) ? n.push(a) : i(a.w);
    }), delete r[o]);
  }
  return c(e.nodes(), i), n;
}
function Ei(e) {
  c(e.edges(), function(n) {
    var r = e.edge(n);
    if (r.reversed) {
      e.removeEdge(n);
      var t = r.forwardName;
      delete r.reversed, delete r.forwardName, e.setEdge(n.w, n.v, r, t);
    }
  });
}
function k(e, n, r, t) {
  var i;
  do
    i = me(t);
  while (e.hasNode(i));
  return r.dummy = n, e.setNode(i, r), i;
}
function Ti(e) {
  var n = new E().setGraph(e.graph());
  return c(e.nodes(), function(r) {
    n.setNode(r, e.node(r));
  }), c(e.edges(), function(r) {
    var t = n.edge(r.v, r.w) || { weight: 0, minlen: 1 }, i = e.edge(r);
    n.setEdge(r.v, r.w, {
      weight: t.weight + i.weight,
      minlen: Math.max(t.minlen, i.minlen)
    });
  }), n;
}
function yn(e) {
  var n = new E({ multigraph: e.isMultigraph() }).setGraph(e.graph());
  return c(e.nodes(), function(r) {
    e.children(r).length || n.setNode(r, e.node(r));
  }), c(e.edges(), function(r) {
    n.setEdge(r, e.edge(r));
  }), n;
}
function Fe(e, n) {
  var r = e.x, t = e.y, i = n.x - r, o = n.y - t, a = e.width / 2, u = e.height / 2;
  if (!i && !o)
    throw new Error("Not possible to find intersection inside of the rectangle");
  var f, d;
  return Math.abs(o) * a > Math.abs(i) * u ? (o < 0 && (u = -u), f = u * i / o, d = u) : (i < 0 && (a = -a), f = a, d = a * o / i), { x: r + f, y: t + d };
}
function Z(e) {
  var n = g(_(xn(e) + 1), function() {
    return [];
  });
  return c(e.nodes(), function(r) {
    var t = e.node(r), i = t.rank;
    x(i) || (n[i][t.order] = r);
  }), n;
}
function Pi(e) {
  var n = j(
    g(e.nodes(), function(r) {
      return e.node(r).rank;
    })
  );
  c(e.nodes(), function(r) {
    var t = e.node(r);
    gn(t, "rank") && (t.rank -= n);
  });
}
function Li(e) {
  var n = j(
    g(e.nodes(), function(o) {
      return e.node(o).rank;
    })
  ), r = [];
  c(e.nodes(), function(o) {
    var a = e.node(o).rank - n;
    r[a] || (r[a] = []), r[a].push(o);
  });
  var t = 0, i = e.graph().nodeRankFactor;
  c(r, function(o, a) {
    x(o) && a % i !== 0 ? --t : t && c(o, function(u) {
      e.node(u).rank += t;
    });
  });
}
function Be(e, n, r, t) {
  var i = {
    width: 0,
    height: 0
  };
  return arguments.length >= 4 && (i.rank = r, i.order = t), k(e, "border", i, n);
}
function xn(e) {
  return T(
    g(e.nodes(), function(n) {
      var r = e.node(n).rank;
      if (!x(r))
        return r;
    })
  );
}
function Ni(e, n) {
  var r = { lhs: [], rhs: [] };
  return c(e, function(t) {
    n(t) ? r.lhs.push(t) : r.rhs.push(t);
  }), r;
}
function Ii(e, n) {
  return n();
}
function _i(e) {
  function n(r) {
    var t = e.children(r), i = e.node(r);
    if (t.length && c(t, n), Object.prototype.hasOwnProperty.call(i, "minRank")) {
      i.borderLeft = [], i.borderRight = [];
      for (var o = i.minRank, a = i.maxRank + 1; o < a; ++o)
        Ge(e, "borderLeft", "_bl", r, i, o), Ge(e, "borderRight", "_br", r, i, o);
    }
  }
  c(e.children(), n);
}
function Ge(e, n, r, t, i, o) {
  var a = { width: 0, height: 0, rank: o, borderType: n }, u = i[n][o - 1], f = k(e, "border", a, r);
  i[n][o] = f, e.setParent(f, t), u && e.setEdge(u, f, { weight: 1 });
}
function Ci(e) {
  var n = e.graph().rankdir.toLowerCase();
  (n === "lr" || n === "rl") && On(e);
}
function Ai(e) {
  var n = e.graph().rankdir.toLowerCase();
  (n === "bt" || n === "rl") && ki(e), (n === "lr" || n === "rl") && (Si(e), On(e));
}
function On(e) {
  c(e.nodes(), function(n) {
    De(e.node(n));
  }), c(e.edges(), function(n) {
    De(e.edge(n));
  });
}
function De(e) {
  var n = e.width;
  e.width = e.height, e.height = n;
}
function ki(e) {
  c(e.nodes(), function(n) {
    ee(e.node(n));
  }), c(e.edges(), function(n) {
    var r = e.edge(n);
    c(r.points, ee), Object.prototype.hasOwnProperty.call(r, "y") && ee(r);
  });
}
function ee(e) {
  e.y = -e.y;
}
function Si(e) {
  c(e.nodes(), function(n) {
    ne(e.node(n));
  }), c(e.edges(), function(n) {
    var r = e.edge(n);
    c(r.points, ne), Object.prototype.hasOwnProperty.call(r, "x") && ne(r);
  });
}
function ne(e) {
  var n = e.x;
  e.x = e.y, e.y = n;
}
function ji(e) {
  e.graph().dummyChains = [], c(e.edges(), function(n) {
    Mi(e, n);
  });
}
function Mi(e, n) {
  var r = n.v, t = e.node(r).rank, i = n.w, o = e.node(i).rank, a = n.name, u = e.edge(n), f = u.labelRank;
  if (o !== t + 1) {
    e.removeEdge(n);
    var d = void 0, s, l;
    for (l = 0, ++t; t < o; ++l, ++t)
      u.points = [], d = {
        width: 0,
        height: 0,
        edgeLabel: u,
        edgeObj: n,
        rank: t
      }, s = k(e, "edge", d, "_d"), t === f && (d.width = u.width, d.height = u.height, d.dummy = "edge-label", d.labelpos = u.labelpos), e.setEdge(r, s, { weight: u.weight }, a), l === 0 && e.graph().dummyChains.push(s), r = s;
    e.setEdge(r, i, { weight: u.weight }, a);
  }
}
function Ri(e) {
  c(e.graph().dummyChains, function(n) {
    var r = e.node(n), t = r.edgeLabel, i;
    for (e.setEdge(r.edgeObj, t); r.dummy; )
      i = e.successors(n)[0], e.removeNode(n), t.points.push({ x: r.x, y: r.y }), r.dummy === "edge-label" && (t.x = r.x, t.y = r.y, t.width = r.width, t.height = r.height), n = i, r = e.node(n);
  });
}
function ye(e) {
  var n = {};
  function r(t) {
    var i = e.node(t);
    if (Object.prototype.hasOwnProperty.call(n, t))
      return i.rank;
    n[t] = !0;
    var o = j(
      g(e.outEdges(t), function(a) {
        return r(a.w) - e.edge(a).minlen;
      })
    );
    return (o === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
    o === void 0 || // return value of _.map([]) for Lodash 4
    o === null) && (o = 0), i.rank = o;
  }
  c(e.sources(), r);
}
function M(e, n) {
  return e.node(n.w).rank - e.node(n.v).rank - e.edge(n).minlen;
}
function En(e) {
  var n = new E({ directed: !1 }), r = e.nodes()[0], t = e.nodeCount();
  n.setNode(r, {});
  for (var i, o; $i(n, e) < t; )
    i = Fi(n, e), o = n.hasNode(i.v) ? M(e, i) : -M(e, i), Bi(n, e, o);
  return n;
}
function $i(e, n) {
  function r(t) {
    c(n.nodeEdges(t), function(i) {
      var o = i.v, a = t === o ? i.w : o;
      !e.hasNode(a) && !M(n, i) && (e.setNode(a, {}), e.setEdge(t, a, {}), r(a));
    });
  }
  return c(e.nodes(), r), e.nodeCount();
}
function Fi(e, n) {
  return ge(n.edges(), function(r) {
    if (e.hasNode(r.v) !== e.hasNode(r.w))
      return M(n, r);
  });
}
function Bi(e, n, r) {
  c(e.nodes(), function(t) {
    n.node(t).rank += r;
  });
}
function Gi() {
}
Gi.prototype = new Error();
function Tn(e, n, r) {
  N(n) || (n = [n]);
  var t = (e.isDirected() ? e.successors : e.neighbors).bind(e), i = [], o = {};
  return c(n, function(a) {
    if (!e.hasNode(a))
      throw new Error("Graph does not have node: " + a);
    Pn(e, a, r === "post", o, t, i);
  }), i;
}
function Pn(e, n, r, t, i, o) {
  Object.prototype.hasOwnProperty.call(t, n) || (t[n] = !0, r || o.push(n), c(i(n), function(a) {
    Pn(e, a, r, t, i, o);
  }), r && o.push(n));
}
function Di(e, n) {
  return Tn(e, n, "post");
}
function Yi(e, n) {
  return Tn(e, n, "pre");
}
L.initLowLimValues = Oe;
L.initCutValues = xe;
L.calcCutValue = Ln;
L.leaveEdge = In;
L.enterEdge = _n;
L.exchangeEdges = Cn;
function L(e) {
  e = Ti(e), ye(e);
  var n = En(e);
  Oe(n), xe(n, e);
  for (var r, t; r = In(n); )
    t = _n(n, e, r), Cn(n, e, r, t);
}
function xe(e, n) {
  var r = Di(e, e.nodes());
  r = r.slice(0, r.length - 1), c(r, function(t) {
    Ui(e, n, t);
  });
}
function Ui(e, n, r) {
  var t = e.node(r), i = t.parent;
  e.edge(r, i).cutvalue = Ln(e, n, r);
}
function Ln(e, n, r) {
  var t = e.node(r), i = t.parent, o = !0, a = n.edge(r, i), u = 0;
  return a || (o = !1, a = n.edge(i, r)), u = a.weight, c(n.nodeEdges(r), function(f) {
    var d = f.v === r, s = d ? f.w : f.v;
    if (s !== i) {
      var l = d === o, h = n.edge(f).weight;
      if (u += l ? h : -h, Wi(e, r, s)) {
        var v = e.edge(r, s).cutvalue;
        u += l ? -v : v;
      }
    }
  }), u;
}
function Oe(e, n) {
  arguments.length < 2 && (n = e.nodes()[0]), Nn(e, {}, 1, n);
}
function Nn(e, n, r, t, i) {
  var o = r, a = e.node(t);
  return n[t] = !0, c(e.neighbors(t), function(u) {
    Object.prototype.hasOwnProperty.call(n, u) || (r = Nn(e, n, r, u, t));
  }), a.low = o, a.lim = r++, i ? a.parent = i : delete a.parent, r;
}
function In(e) {
  return be(e.edges(), function(n) {
    return e.edge(n).cutvalue < 0;
  });
}
function _n(e, n, r) {
  var t = r.v, i = r.w;
  n.hasEdge(t, i) || (t = r.w, i = r.v);
  var o = e.node(t), a = e.node(i), u = o, f = !1;
  o.lim > a.lim && (u = a, f = !0);
  var d = R(n.edges(), function(s) {
    return f === Ye(e, e.node(s.v), u) && f !== Ye(e, e.node(s.w), u);
  });
  return ge(d, function(s) {
    return M(n, s);
  });
}
function Cn(e, n, r, t) {
  var i = r.v, o = r.w;
  e.removeEdge(i, o), e.setEdge(t.v, t.w, {}), Oe(e), xe(e, n), Vi(e, n);
}
function Vi(e, n) {
  var r = be(e.nodes(), function(i) {
    return !n.node(i).parent;
  }), t = Yi(e, r);
  t = t.slice(1), c(t, function(i) {
    var o = e.node(i).parent, a = n.edge(i, o), u = !1;
    a || (a = n.edge(o, i), u = !0), n.node(i).rank = n.node(o).rank + (u ? a.minlen : -a.minlen);
  });
}
function Wi(e, n, r) {
  return e.hasEdge(n, r);
}
function Ye(e, n, r) {
  return r.low <= n.lim && n.lim <= r.lim;
}
function qi(e) {
  switch (e.graph().ranker) {
    case "network-simplex":
      Ue(e);
      break;
    case "tight-tree":
      Xi(e);
      break;
    case "longest-path":
      Ki(e);
      break;
    default:
      Ue(e);
  }
}
var Ki = ye;
function Xi(e) {
  ye(e), En(e);
}
function Ue(e) {
  L(e);
}
function Hi(e) {
  var n = k(e, "root", {}, "_root"), r = zi(e), t = T(I(r)) - 1, i = 2 * t + 1;
  e.graph().nestingRoot = n, c(e.edges(), function(a) {
    e.edge(a).minlen *= i;
  });
  var o = Ji(e) + 1;
  c(e.children(), function(a) {
    An(e, n, i, o, t, r, a);
  }), e.graph().nodeRankFactor = i;
}
function An(e, n, r, t, i, o, a) {
  var u = e.children(a);
  if (!u.length) {
    a !== n && e.setEdge(n, a, { weight: 0, minlen: r });
    return;
  }
  var f = Be(e, "_bt"), d = Be(e, "_bb"), s = e.node(a);
  e.setParent(f, a), s.borderTop = f, e.setParent(d, a), s.borderBottom = d, c(u, function(l) {
    An(e, n, r, t, i, o, l);
    var h = e.node(l), v = h.borderTop ? h.borderTop : l, p = h.borderBottom ? h.borderBottom : l, w = h.borderTop ? t : 2 * t, m = v !== p ? 1 : i - o[a] + 1;
    e.setEdge(f, v, {
      weight: w,
      minlen: m,
      nestingEdge: !0
    }), e.setEdge(p, d, {
      weight: w,
      minlen: m,
      nestingEdge: !0
    });
  }), e.parent(a) || e.setEdge(n, f, { weight: 0, minlen: i + o[a] });
}
function zi(e) {
  var n = {};
  function r(t, i) {
    var o = e.children(t);
    o && o.length && c(o, function(a) {
      r(a, i + 1);
    }), n[t] = i;
  }
  return c(e.children(), function(t) {
    r(t, 1);
  }), n;
}
function Ji(e) {
  return X(
    e.edges(),
    function(n, r) {
      return n + e.edge(r).weight;
    },
    0
  );
}
function Zi(e) {
  var n = e.graph();
  e.removeNode(n.nestingRoot), delete n.nestingRoot, c(e.edges(), function(r) {
    var t = e.edge(r);
    t.nestingEdge && e.removeEdge(r);
  });
}
function Qi(e, n, r) {
  var t = {}, i;
  c(r, function(o) {
    for (var a = e.parent(o), u, f; a; ) {
      if (u = e.parent(a), u ? (f = t[u], t[u] = a) : (f = i, i = a), f && f !== a) {
        n.setEdge(f, a);
        return;
      }
      a = u;
    }
  });
}
function ea(e, n, r) {
  var t = na(e), i = new E({ compound: !0 }).setGraph({ root: t }).setDefaultNodeLabel(function(o) {
    return e.node(o);
  });
  return c(e.nodes(), function(o) {
    var a = e.node(o), u = e.parent(o);
    (a.rank === n || a.minRank <= n && n <= a.maxRank) && (i.setNode(o), i.setParent(o, u || t), c(e[r](o), function(f) {
      var d = f.v === o ? f.w : f.v, s = i.edge(d, o), l = x(s) ? 0 : s.weight;
      i.setEdge(d, o, { weight: e.edge(f).weight + l });
    }), Object.prototype.hasOwnProperty.call(a, "minRank") && i.setNode(o, {
      borderLeft: a.borderLeft[n],
      borderRight: a.borderRight[n]
    }));
  }), i;
}
function na(e) {
  for (var n; e.hasNode(n = me("_root")); )
    ;
  return n;
}
function ra(e, n) {
  for (var r = 0, t = 1; t < n.length; ++t)
    r += ta(e, n[t - 1], n[t]);
  return r;
}
function ta(e, n, r) {
  for (var t = vi(
    r,
    g(r, function(d, s) {
      return s;
    })
  ), i = A(
    g(n, function(d) {
      return F(
        g(e.outEdges(d), function(s) {
          return { pos: t[s.w], weight: e.edge(s).weight };
        }),
        "pos"
      );
    })
  ), o = 1; o < r.length; )
    o <<= 1;
  var a = 2 * o - 1;
  o -= 1;
  var u = g(new Array(a), function() {
    return 0;
  }), f = 0;
  return c(
    // @ts-expect-error
    i.forEach(function(d) {
      var s = d.pos + o;
      u[s] += d.weight;
      for (var l = 0; s > 0; )
        s % 2 && (l += u[s + 1]), s = s - 1 >> 1, u[s] += d.weight;
      f += d.weight * l;
    })
  ), f;
}
function ia(e) {
  var n = {}, r = R(e.nodes(), function(u) {
    return !e.children(u).length;
  }), t = T(
    g(r, function(u) {
      return e.node(u).rank;
    })
  ), i = g(_(t + 1), function() {
    return [];
  });
  function o(u) {
    if (!gn(n, u)) {
      n[u] = !0;
      var f = e.node(u);
      i[f.rank].push(u), c(e.successors(u), o);
    }
  }
  var a = F(r, function(u) {
    return e.node(u).rank;
  });
  return c(a, o), i;
}
function aa(e, n) {
  return g(n, function(r) {
    var t = e.inEdges(r);
    if (t.length) {
      var i = X(
        t,
        function(o, a) {
          var u = e.edge(a), f = e.node(a.v);
          return {
            sum: o.sum + u.weight * f.order,
            weight: o.weight + u.weight
          };
        },
        { sum: 0, weight: 0 }
      );
      return {
        v: r,
        barycenter: i.sum / i.weight,
        weight: i.weight
      };
    } else
      return { v: r };
  });
}
function oa(e, n) {
  var r = {};
  c(e, function(i, o) {
    var a = r[i.v] = {
      indegree: 0,
      in: [],
      out: [],
      vs: [i.v],
      i: o
    };
    x(i.barycenter) || (a.barycenter = i.barycenter, a.weight = i.weight);
  }), c(n.edges(), function(i) {
    var o = r[i.v], a = r[i.w];
    !x(o) && !x(a) && (a.indegree++, o.out.push(r[i.w]));
  });
  var t = R(r, function(i) {
    return !i.indegree;
  });
  return ua(t);
}
function ua(e) {
  var n = [];
  function r(o) {
    return function(a) {
      a.merged || (x(a.barycenter) || x(o.barycenter) || a.barycenter >= o.barycenter) && fa(o, a);
    };
  }
  function t(o) {
    return function(a) {
      a.in.push(o), --a.indegree === 0 && e.push(a);
    };
  }
  for (; e.length; ) {
    var i = e.pop();
    n.push(i), c(i.in.reverse(), r(i)), c(i.out, t(i));
  }
  return g(
    R(n, function(o) {
      return !o.merged;
    }),
    function(o) {
      return W(o, ["vs", "i", "barycenter", "weight"]);
    }
  );
}
function fa(e, n) {
  var r = 0, t = 0;
  e.weight && (r += e.barycenter * e.weight, t += e.weight), n.weight && (r += n.barycenter * n.weight, t += n.weight), e.vs = n.vs.concat(e.vs), e.barycenter = r / t, e.weight = t, e.i = Math.min(n.i, e.i), n.merged = !0;
}
function da(e, n) {
  var r = Ni(e, function(s) {
    return Object.prototype.hasOwnProperty.call(s, "barycenter");
  }), t = r.lhs, i = F(r.rhs, function(s) {
    return -s.i;
  }), o = [], a = 0, u = 0, f = 0;
  t.sort(sa(!!n)), f = Ve(o, i, f), c(t, function(s) {
    f += s.vs.length, o.push(s.vs), a += s.barycenter * s.weight, u += s.weight, f = Ve(o, i, f);
  });
  var d = { vs: A(o) };
  return u && (d.barycenter = a / u, d.weight = u), d;
}
function Ve(e, n, r) {
  for (var t; n.length && (t = V(n)).i <= r; )
    n.pop(), e.push(t.vs), r++;
  return r;
}
function sa(e) {
  return function(n, r) {
    return n.barycenter < r.barycenter ? -1 : n.barycenter > r.barycenter ? 1 : e ? r.i - n.i : n.i - r.i;
  };
}
function kn(e, n, r, t) {
  var i = e.children(n), o = e.node(n), a = o ? o.borderLeft : void 0, u = o ? o.borderRight : void 0, f = {};
  a && (i = R(i, function(p) {
    return p !== a && p !== u;
  }));
  var d = aa(e, i);
  c(d, function(p) {
    if (e.children(p.v).length) {
      var w = kn(e, p.v, r, t);
      f[p.v] = w, Object.prototype.hasOwnProperty.call(w, "barycenter") && la(p, w);
    }
  });
  var s = oa(d, r);
  ca(s, f);
  var l = da(s, t);
  if (a && (l.vs = A([a, l.vs, u]), e.predecessors(a).length)) {
    var h = e.node(e.predecessors(a)[0]), v = e.node(e.predecessors(u)[0]);
    Object.prototype.hasOwnProperty.call(l, "barycenter") || (l.barycenter = 0, l.weight = 0), l.barycenter = (l.barycenter * l.weight + h.order + v.order) / (l.weight + 2), l.weight += 2;
  }
  return l;
}
function ca(e, n) {
  c(e, function(r) {
    r.vs = A(
      r.vs.map(function(t) {
        return n[t] ? n[t].vs : t;
      })
    );
  });
}
function la(e, n) {
  x(e.barycenter) ? (e.barycenter = n.barycenter, e.weight = n.weight) : (e.barycenter = (e.barycenter * e.weight + n.barycenter * n.weight) / (e.weight + n.weight), e.weight += n.weight);
}
function ha(e) {
  var n = xn(e), r = We(e, _(1, n + 1), "inEdges"), t = We(e, _(n - 1, -1, -1), "outEdges"), i = ia(e);
  qe(e, i);
  for (var o = Number.POSITIVE_INFINITY, a, u = 0, f = 0; f < 4; ++u, ++f) {
    va(u % 2 ? r : t, u % 4 >= 2), i = Z(e);
    var d = ra(e, i);
    d < o && (f = 0, a = Dt(i), o = d);
  }
  qe(e, a);
}
function We(e, n, r) {
  return g(n, function(t) {
    return ea(e, t, r);
  });
}
function va(e, n) {
  var r = new E();
  c(e, function(t) {
    var i = t.graph().root, o = kn(t, i, r, n);
    c(o.vs, function(a, u) {
      t.node(a).order = u;
    }), Qi(t, r, o.vs);
  });
}
function qe(e, n) {
  c(n, function(r) {
    c(r, function(t, i) {
      e.node(t).order = i;
    });
  });
}
function pa(e) {
  var n = wa(e);
  c(e.graph().dummyChains, function(r) {
    for (var t = e.node(r), i = t.edgeObj, o = ba(e, n, i.v, i.w), a = o.path, u = o.lca, f = 0, d = a[f], s = !0; r !== i.w; ) {
      if (t = e.node(r), s) {
        for (; (d = a[f]) !== u && e.node(d).maxRank < t.rank; )
          f++;
        d === u && (s = !1);
      }
      if (!s) {
        for (; f < a.length - 1 && e.node(d = a[f + 1]).minRank <= t.rank; )
          f++;
        d = a[f];
      }
      e.setParent(r, d), r = e.successors(r)[0];
    }
  });
}
function ba(e, n, r, t) {
  var i = [], o = [], a = Math.min(n[r].low, n[t].low), u = Math.max(n[r].lim, n[t].lim), f, d;
  f = r;
  do
    f = e.parent(f), i.push(f);
  while (f && (n[f].low > a || u > n[f].lim));
  for (d = f, f = t; (f = e.parent(f)) !== d; )
    o.push(f);
  return { path: i.concat(o.reverse()), lca: d };
}
function wa(e) {
  var n = {}, r = 0;
  function t(i) {
    var o = r;
    c(e.children(i), t), n[i] = { low: o, lim: r++ };
  }
  return c(e.children(), t), n;
}
function ga(e, n) {
  var r = {};
  function t(i, o) {
    var a = 0, u = 0, f = i.length, d = V(o);
    return c(o, function(s, l) {
      var h = ya(e, s), v = h ? e.node(h).order : f;
      (h || s === d) && (c(o.slice(u, l + 1), function(p) {
        c(e.predecessors(p), function(w) {
          var m = e.node(w), y = m.order;
          (y < a || v < y) && !(m.dummy && e.node(p).dummy) && Sn(r, w, p);
        });
      }), u = l + 1, a = v);
    }), o;
  }
  return X(n, t), r;
}
function ma(e, n) {
  var r = {};
  function t(o, a, u, f, d) {
    var s;
    c(_(a, u), function(l) {
      s = o[l], e.node(s).dummy && c(e.predecessors(s), function(h) {
        var v = e.node(h);
        v.dummy && (v.order < f || v.order > d) && Sn(r, h, s);
      });
    });
  }
  function i(o, a) {
    var u = -1, f, d = 0;
    return c(a, function(s, l) {
      if (e.node(s).dummy === "border") {
        var h = e.predecessors(s);
        h.length && (f = e.node(h[0]).order, t(a, d, l, u, f), d = l, u = f);
      }
      t(a, d, a.length, f, o.length);
    }), a;
  }
  return X(n, i), r;
}
function ya(e, n) {
  if (e.node(n).dummy)
    return be(e.predecessors(n), function(r) {
      return e.node(r).dummy;
    });
}
function Sn(e, n, r) {
  if (n > r) {
    var t = n;
    n = r, r = t;
  }
  Object.prototype.hasOwnProperty.call(e, n) || Object.defineProperty(e, n, {
    enumerable: !0,
    configurable: !0,
    value: {},
    writable: !0
  });
  var i = e[n];
  Object.defineProperty(i, r, {
    enumerable: !0,
    configurable: !0,
    value: !0,
    writable: !0
  });
}
function xa(e, n, r) {
  if (n > r) {
    var t = n;
    n = r, r = t;
  }
  return !!e[n] && Object.prototype.hasOwnProperty.call(e[n], r);
}
function Oa(e, n, r, t) {
  var i = {}, o = {}, a = {};
  return c(n, function(u) {
    c(u, function(f, d) {
      i[f] = f, o[f] = f, a[f] = d;
    });
  }), c(n, function(u) {
    var f = -1;
    c(u, function(d) {
      var s = t(d);
      if (s.length) {
        s = F(s, function(w) {
          return a[w];
        });
        for (var l = (s.length - 1) / 2, h = Math.floor(l), v = Math.ceil(l); h <= v; ++h) {
          var p = s[h];
          o[d] === d && f < a[p] && !xa(r, d, p) && (o[p] = d, o[d] = i[d] = i[p], f = a[p]);
        }
      }
    });
  }), { root: i, align: o };
}
function Ea(e, n, r, t, i) {
  var o = {}, a = Ta(e, n, r, i), u = i ? "borderLeft" : "borderRight";
  function f(l, h) {
    for (var v = a.nodes(), p = v.pop(), w = {}; p; )
      w[p] ? l(p) : (w[p] = !0, v.push(p), v = v.concat(h(p))), p = v.pop();
  }
  function d(l) {
    o[l] = a.inEdges(l).reduce(function(h, v) {
      return Math.max(h, o[v.v] + a.edge(v));
    }, 0);
  }
  function s(l) {
    var h = a.outEdges(l).reduce(function(p, w) {
      return Math.min(p, o[w.w] - a.edge(w));
    }, Number.POSITIVE_INFINITY), v = e.node(l);
    h !== Number.POSITIVE_INFINITY && v.borderType !== u && (o[l] = Math.max(o[l], h));
  }
  return f(d, a.predecessors.bind(a)), f(s, a.successors.bind(a)), c(t, function(l) {
    o[l] = o[r[l]];
  }), o;
}
function Ta(e, n, r, t) {
  var i = new E(), o = e.graph(), a = _a(o.nodesep, o.edgesep, t);
  return c(n, function(u) {
    var f;
    c(u, function(d) {
      var s = r[d];
      if (i.setNode(s), f) {
        var l = r[f], h = i.edge(l, s);
        i.setEdge(l, s, Math.max(a(e, d, f), h || 0));
      }
      f = d;
    });
  }), i;
}
function Pa(e, n) {
  return ge(I(n), function(r) {
    var t = Number.NEGATIVE_INFINITY, i = Number.POSITIVE_INFINITY;
    return Ht(r, function(o, a) {
      var u = Ca(e, a) / 2;
      t = Math.max(o + u, t), i = Math.min(o - u, i);
    }), t - i;
  });
}
function La(e, n) {
  var r = I(n), t = j(r), i = T(r);
  c(["u", "d"], function(o) {
    c(["l", "r"], function(a) {
      var u = o + a, f = e[u], d;
      if (f !== n) {
        var s = I(f);
        d = a === "l" ? t - j(s) : i - T(s), d && (e[u] = J(f, function(l) {
          return l + d;
        }));
      }
    });
  });
}
function Na(e, n) {
  return J(e.ul, function(r, t) {
    if (n)
      return e[n.toLowerCase()][t];
    var i = F(g(e, t));
    return (i[1] + i[2]) / 2;
  });
}
function Ia(e) {
  var n = Z(e), r = oe(ga(e, n), ma(e, n)), t = {}, i;
  c(["u", "d"], function(a) {
    i = a === "u" ? n : I(n).reverse(), c(["l", "r"], function(u) {
      u === "r" && (i = g(i, function(l) {
        return I(l).reverse();
      }));
      var f = (a === "u" ? e.predecessors : e.successors).bind(e), d = Oa(e, i, r, f), s = Ea(e, i, d.root, d.align, u === "r");
      u === "r" && (s = J(s, function(l) {
        return -l;
      })), t[a + u] = s;
    });
  });
  var o = Pa(e, t);
  return La(t, o), Na(t, e.graph().align);
}
function _a(e, n, r) {
  return function(t, i, o) {
    var a = t.node(i), u = t.node(o), f = 0, d;
    if (f += a.width / 2, Object.prototype.hasOwnProperty.call(a, "labelpos"))
      switch (a.labelpos.toLowerCase()) {
        case "l":
          d = -a.width / 2;
          break;
        case "r":
          d = a.width / 2;
          break;
      }
    if (d && (f += r ? d : -d), d = 0, f += (a.dummy ? n : e) / 2, f += (u.dummy ? n : e) / 2, f += u.width / 2, Object.prototype.hasOwnProperty.call(u, "labelpos"))
      switch (u.labelpos.toLowerCase()) {
        case "l":
          d = u.width / 2;
          break;
        case "r":
          d = -u.width / 2;
          break;
      }
    return d && (f += r ? d : -d), d = 0, f;
  };
}
function Ca(e, n) {
  return e.node(n).width;
}
function Aa(e) {
  e = yn(e), ka(e), zt(Ia(e), function(n, r) {
    e.node(r).x = n;
  });
}
function ka(e) {
  var n = Z(e), r = e.graph().ranksep, t = 0;
  c(n, function(i) {
    var o = T(
      g(i, function(a) {
        return e.node(a).height;
      })
    );
    c(i, function(a) {
      e.node(a).y = t + o / 2;
    }), t += o + r;
  });
}
function to(e, n) {
  var r = Ii;
  r("layout", () => {
    var t = r("  buildLayoutGraph", () => Ua(e));
    r("  runLayout", () => Sa(t, r)), r("  updateInputGraph", () => ja(e, t));
  });
}
function Sa(e, n) {
  n("    makeSpaceForEdgeLabels", () => Va(e)), n("    removeSelfEdges", () => Qa(e)), n("    acyclic", () => xi(e)), n("    nestingGraph.run", () => Hi(e)), n("    rank", () => qi(yn(e))), n("    injectEdgeLabelProxies", () => Wa(e)), n("    removeEmptyRanks", () => Li(e)), n("    nestingGraph.cleanup", () => Zi(e)), n("    normalizeRanks", () => Pi(e)), n("    assignRankMinMax", () => qa(e)), n("    removeEdgeLabelProxies", () => Ka(e)), n("    normalize.run", () => ji(e)), n("    parentDummyChains", () => pa(e)), n("    addBorderSegments", () => _i(e)), n("    order", () => ha(e)), n("    insertSelfEdges", () => eo(e)), n("    adjustCoordinateSystem", () => Ci(e)), n("    position", () => Aa(e)), n("    positionSelfEdges", () => no(e)), n("    removeBorderNodes", () => Za(e)), n("    normalize.undo", () => Ri(e)), n("    fixupEdgeLabelCoords", () => za(e)), n("    undoCoordinateSystem", () => Ai(e)), n("    translateGraph", () => Xa(e)), n("    assignNodeIntersects", () => Ha(e)), n("    reversePoints", () => Ja(e)), n("    acyclic.undo", () => Ei(e));
}
function ja(e, n) {
  c(e.nodes(), function(r) {
    var t = e.node(r), i = n.node(r);
    t && (t.x = i.x, t.y = i.y, n.children(r).length && (t.width = i.width, t.height = i.height));
  }), c(e.edges(), function(r) {
    var t = e.edge(r), i = n.edge(r);
    t.points = i.points, Object.prototype.hasOwnProperty.call(i, "x") && (t.x = i.x, t.y = i.y);
  }), e.graph().width = n.graph().width, e.graph().height = n.graph().height;
}
var Ma = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], Ra = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, $a = ["acyclicer", "ranker", "rankdir", "align"], Fa = ["width", "height"], Ba = { width: 0, height: 0 }, Ga = ["minlen", "weight", "width", "height", "labeloffset"], Da = {
  minlen: 1,
  weight: 1,
  width: 0,
  height: 0,
  labeloffset: 10,
  labelpos: "r"
}, Ya = ["labelpos"];
function Ua(e) {
  var n = new E({ multigraph: !0, compound: !0 }), r = te(e.graph());
  return n.setGraph(
    oe({}, Ra, re(r, Ma), W(r, $a))
  ), c(e.nodes(), function(t) {
    var i = te(e.node(t));
    n.setNode(t, Ut(re(i, Fa), Ba)), n.setParent(t, e.parent(t));
  }), c(e.edges(), function(t) {
    var i = te(e.edge(t));
    n.setEdge(
      t,
      oe({}, Da, re(i, Ga), W(i, Ya))
    );
  }), n;
}
function Va(e) {
  var n = e.graph();
  n.ranksep /= 2, c(e.edges(), function(r) {
    var t = e.edge(r);
    t.minlen *= 2, t.labelpos.toLowerCase() !== "c" && (n.rankdir === "TB" || n.rankdir === "BT" ? t.width += t.labeloffset : t.height += t.labeloffset);
  });
}
function Wa(e) {
  c(e.edges(), function(n) {
    var r = e.edge(n);
    if (r.width && r.height) {
      var t = e.node(n.v), i = e.node(n.w), o = { rank: (i.rank - t.rank) / 2 + t.rank, e: n };
      k(e, "edge-proxy", o, "_ep");
    }
  });
}
function qa(e) {
  var n = 0;
  c(e.nodes(), function(r) {
    var t = e.node(r);
    t.borderTop && (t.minRank = e.node(t.borderTop).rank, t.maxRank = e.node(t.borderBottom).rank, n = T(n, t.maxRank));
  }), e.graph().maxRank = n;
}
function Ka(e) {
  c(e.nodes(), function(n) {
    var r = e.node(n);
    r.dummy === "edge-proxy" && (e.edge(r.e).labelRank = r.rank, e.removeNode(n));
  });
}
function Xa(e) {
  var n = Number.POSITIVE_INFINITY, r = 0, t = Number.POSITIVE_INFINITY, i = 0, o = e.graph(), a = o.marginx || 0, u = o.marginy || 0;
  function f(d) {
    var s = d.x, l = d.y, h = d.width, v = d.height;
    n = Math.min(n, s - h / 2), r = Math.max(r, s + h / 2), t = Math.min(t, l - v / 2), i = Math.max(i, l + v / 2);
  }
  c(e.nodes(), function(d) {
    f(e.node(d));
  }), c(e.edges(), function(d) {
    var s = e.edge(d);
    Object.prototype.hasOwnProperty.call(s, "x") && f(s);
  }), n -= a, t -= u, c(e.nodes(), function(d) {
    var s = e.node(d);
    s.x -= n, s.y -= t;
  }), c(e.edges(), function(d) {
    var s = e.edge(d);
    c(s.points, function(l) {
      l.x -= n, l.y -= t;
    }), Object.prototype.hasOwnProperty.call(s, "x") && (s.x -= n), Object.prototype.hasOwnProperty.call(s, "y") && (s.y -= t);
  }), o.width = r - n + a, o.height = i - t + u;
}
function Ha(e) {
  c(e.edges(), function(n) {
    var r = e.edge(n), t = e.node(n.v), i = e.node(n.w), o, a;
    r.points ? (o = r.points[0], a = r.points[r.points.length - 1]) : (r.points = [], o = i, a = t), r.points.unshift(Fe(t, o)), r.points.push(Fe(i, a));
  });
}
function za(e) {
  c(e.edges(), function(n) {
    var r = e.edge(n);
    if (Object.prototype.hasOwnProperty.call(r, "x"))
      switch ((r.labelpos === "l" || r.labelpos === "r") && (r.width -= r.labeloffset), r.labelpos) {
        case "l":
          r.x -= r.width / 2 + r.labeloffset;
          break;
        case "r":
          r.x += r.width / 2 + r.labeloffset;
          break;
      }
  });
}
function Ja(e) {
  c(e.edges(), function(n) {
    var r = e.edge(n);
    r.reversed && r.points.reverse();
  });
}
function Za(e) {
  c(e.nodes(), function(n) {
    if (e.children(n).length) {
      var r = e.node(n), t = e.node(r.borderTop), i = e.node(r.borderBottom), o = e.node(V(r.borderLeft)), a = e.node(V(r.borderRight));
      r.width = Math.abs(a.x - o.x), r.height = Math.abs(i.y - t.y), r.x = o.x + r.width / 2, r.y = t.y + r.height / 2;
    }
  }), c(e.nodes(), function(n) {
    e.node(n).dummy === "border" && e.removeNode(n);
  });
}
function Qa(e) {
  c(e.edges(), function(n) {
    if (n.v === n.w) {
      var r = e.node(n.v);
      r.selfEdges || (r.selfEdges = []), r.selfEdges.push({ e: n, label: e.edge(n) }), e.removeEdge(n);
    }
  });
}
function eo(e) {
  var n = Z(e);
  c(n, function(r) {
    var t = 0;
    c(r, function(i, o) {
      var a = e.node(i);
      a.order = o + t, c(a.selfEdges, function(u) {
        k(
          e,
          "selfedge",
          {
            width: u.label.width,
            height: u.label.height,
            rank: a.rank,
            order: o + ++t,
            e: u.e,
            label: u.label
          },
          "_se"
        );
      }), delete a.selfEdges;
    });
  });
}
function no(e) {
  c(e.nodes(), function(n) {
    var r = e.node(n);
    if (r.dummy === "selfedge") {
      var t = e.node(r.e.v), i = t.x + t.width / 2, o = t.y, a = r.x - i, u = t.height / 2;
      e.setEdge(r.e, r.label), e.removeNode(n), r.label.points = [
        { x: i + 2 * a / 3, y: o - u },
        { x: i + 5 * a / 6, y: o - u },
        { x: i + a, y: o },
        { x: i + 5 * a / 6, y: o + u },
        { x: i + 2 * a / 3, y: o + u }
      ], r.label.x = r.x, r.label.y = r.y;
    }
  });
}
function re(e, n) {
  return J(W(e, n), Number);
}
function te(e) {
  var n = {};
  return c(e, function(r, t) {
    n[t.toLowerCase()] = r;
  }), n;
}
export {
  D as b,
  to as l,
  g as m
};
