import { Z as m, A as k, _ as b, O as Gn } from "./graph-WBvyJJXo-BBnBDARn.js";
import { K as Bn, q as f, b as q, n as ln, e as j, C as pn, F as Yn, Y as F, T as Dn, Z as R, D as wn, j as bn, I as zn, x as Z, M as Zn, f as Kn, g as Un } from "./_baseUniq-BM5nBlUE-Bqq-876b.js";
import { L as O, v as Jn, k as I, M as p, A as mn, x as Qn } from "./min-hEQogXjh-DyJPZJjb.js";
import { o as yn, L, A as xn, M as Hn, N as K, O as Wn, P as Xn, y as kn, Q as En, D as nr, R as rr, q as C, T as tr, I as On, k as er, U as or, V as ir } from "./index-Bh-wTBlD.js";
var ur = /\s/;
function ar(n) {
  for (var r = n.length; r-- && ur.test(n.charAt(r)); )
    ;
  return r;
}
var cr = /^\s+/;
function dr(n) {
  return n && n.slice(0, ar(n) + 1).replace(cr, "");
}
var tn = NaN, fr = /^[-+]0x[0-9a-f]+$/i, sr = /^0b[01]+$/i, hr = /^0o[0-7]+$/i, vr = parseInt;
function gr(n) {
  if (typeof n == "number")
    return n;
  if (Z(n))
    return tn;
  if (C(n)) {
    var r = typeof n.valueOf == "function" ? n.valueOf() : n;
    n = C(r) ? r + "" : r;
  }
  if (typeof n != "string")
    return n === 0 ? n : +n;
  n = dr(n);
  var t = sr.test(n);
  return t || hr.test(n) ? vr(n.slice(2), t ? 2 : 8) : fr.test(n) ? tn : +n;
}
var en = 1 / 0, lr = 17976931348623157e292;
function M(n) {
  if (!n)
    return n === 0 ? n : 0;
  if (n = gr(n), n === en || n === -en) {
    var r = n < 0 ? -1 : 1;
    return r * lr;
  }
  return n === n ? n : 0;
}
function pr(n) {
  var r = M(n), t = r % 1;
  return r === r ? t ? r - t : r : 0;
}
function wr(n) {
  return Wn(Xn(n, void 0, O), n + "");
}
var br = 1, mr = 4;
function yr(n) {
  return Gn(n, br | mr);
}
var Nn = Object.prototype, xr = Nn.hasOwnProperty, kr = yn(function(n, r) {
  n = Object(n);
  var t = -1, e = r.length, o = e > 2 ? r[2] : void 0;
  for (o && L(r[0], r[1], o) && (e = 1); ++t < e; )
    for (var u = r[t], i = xn(u), a = -1, c = i.length; ++a < c; ) {
      var d = i[a], s = n[d];
      (s === void 0 || Hn(s, Nn[d]) && !xr.call(n, d)) && (n[d] = u[d]);
    }
  return n;
});
function $(n) {
  var r = n == null ? 0 : n.length;
  return r ? n[r - 1] : void 0;
}
function Er(n) {
  return function(r, t, e) {
    var o = Object(r);
    if (!or(r)) {
      var u = j(t);
      r = Zn(r), t = function(a) {
        return u(o[a], a, o);
      };
    }
    var i = n(r, t, e);
    return i > -1 ? o[u ? r[i] : i] : void 0;
  };
}
var Or = Math.max;
function Nr(n, r, t) {
  var e = n == null ? 0 : n.length;
  if (!e)
    return -1;
  var o = t == null ? 0 : pr(t);
  return o < 0 && (o = Or(e + o, 0)), Un(n, j(r), o);
}
var J = Er(Nr);
function _r(n, r) {
  return n == null ? n : ir(n, wn(r), xn);
}
function Ir(n, r) {
  return n && pn(n, wn(r));
}
function Pr(n, r) {
  return n > r;
}
var jr = Object.prototype, Rr = jr.hasOwnProperty;
function Tr(n, r) {
  return n != null && Rr.call(n, r);
}
function _n(n, r) {
  return n != null && Dn(n, r, Tr);
}
function A(n, r) {
  var t = {};
  return r = j(r), pn(n, function(e, o, u) {
    rr(t, o, r(e, o, u));
  }), t;
}
function y(n) {
  return n && n.length ? mn(n, En, Pr) : void 0;
}
function Q(n, r) {
  return n && n.length ? mn(n, j(r), Qn) : void 0;
}
function Mr(n, r, t, e) {
  if (!C(n))
    return n;
  r = bn(r, n);
  for (var o = -1, u = r.length, i = u - 1, a = n; a != null && ++o < u; ) {
    var c = zn(r[o]), d = t;
    if (c === "__proto__" || c === "constructor" || c === "prototype")
      return n;
    if (o != i) {
      var s = a[c];
      d = void 0, d === void 0 && (d = C(s) ? s : tr(r[o + 1]) ? [] : {});
    }
    On(a, c, d), a = a[c];
  }
  return n;
}
function Lr(n, r, t) {
  for (var e = -1, o = r.length, u = {}; ++e < o; ) {
    var i = r[e], a = ln(n, i);
    t(a, i) && Mr(u, bn(i, n), a);
  }
  return u;
}
function Cr(n, r) {
  var t = n.length;
  for (n.sort(r); t--; )
    n[t] = n[t].value;
  return n;
}
function $r(n, r) {
  if (n !== r) {
    var t = n !== void 0, e = n === null, o = n === n, u = Z(n), i = r !== void 0, a = r === null, c = r === r, d = Z(r);
    if (!a && !d && !u && n > r || u && i && c && !a && !d || e && i && c || !t && c || !o)
      return 1;
    if (!e && !u && !d && n < r || d && t && o && !e && !u || a && t && o || !i && o || !c)
      return -1;
  }
  return 0;
}
function Sr(n, r, t) {
  for (var e = -1, o = n.criteria, u = r.criteria, i = o.length, a = t.length; ++e < i; ) {
    var c = $r(o[e], u[e]);
    if (c) {
      if (e >= a)
        return c;
      var d = t[e];
      return c * (d == "desc" ? -1 : 1);
    }
  }
  return n.index - r.index;
}
function Fr(n, r, t) {
  r.length ? r = q(r, function(u) {
    return kn(u) ? function(i) {
      return ln(i, u.length === 1 ? u[0] : u);
    } : u;
  }) : r = [En];
  var e = -1;
  r = q(r, nr(j));
  var o = Jn(n, function(u, i, a) {
    var c = q(r, function(d) {
      return d(u);
    });
    return { criteria: c, index: ++e, value: u };
  });
  return Cr(o, function(u, i) {
    return Sr(u, i, t);
  });
}
function Ar(n, r) {
  return Lr(n, r, function(t, e) {
    return Kn(n, e);
  });
}
var S = wr(function(n, r) {
  return n == null ? {} : Ar(n, r);
}), Vr = Math.ceil, qr = Math.max;
function Gr(n, r, t, e) {
  for (var o = -1, u = qr(Vr((r - n) / (t || 1)), 0), i = Array(u); u--; )
    i[++o] = n, n += t;
  return i;
}
function Br(n) {
  return function(r, t, e) {
    return e && typeof e != "number" && L(r, t, e) && (t = e = void 0), r = M(r), t === void 0 ? (t = r, r = 0) : t = M(t), e = e === void 0 ? r < t ? 1 : -1 : M(e), Gr(r, t, e);
  };
}
var E = Br(), T = yn(function(n, r) {
  if (n == null)
    return [];
  var t = r.length;
  return t > 1 && L(n, r[0], r[1]) ? r = [] : t > 2 && L(r[0], r[1], r[2]) && (r = [r[0]]), Fr(n, Bn(r), []);
}), Yr = 0;
function H(n) {
  var r = ++Yr;
  return Yn(n) + r;
}
function Dr(n, r, t) {
  for (var e = -1, o = n.length, u = r.length, i = {}; ++e < o; ) {
    var a = e < u ? r[e] : void 0;
    t(i, n[e], a);
  }
  return i;
}
function zr(n, r) {
  return Dr(n || [], r || [], On);
}
class Zr {
  constructor() {
    var r = {};
    r._next = r._prev = r, this._sentinel = r;
  }
  dequeue() {
    var r = this._sentinel, t = r._prev;
    if (t !== r)
      return on(t), t;
  }
  enqueue(r) {
    var t = this._sentinel;
    r._prev && r._next && on(r), r._next = t._next, t._next._prev = r, t._next = r, r._prev = t;
  }
  toString() {
    for (var r = [], t = this._sentinel, e = t._prev; e !== t; )
      r.push(JSON.stringify(e, Kr)), e = e._prev;
    return "[" + r.join(", ") + "]";
  }
}
function on(n) {
  n._prev._next = n._next, n._next._prev = n._prev, delete n._next, delete n._prev;
}
function Kr(n, r) {
  if (n !== "_next" && n !== "_prev")
    return r;
}
var Ur = er(1);
function Jr(n, r) {
  if (n.nodeCount() <= 1)
    return [];
  var t = Hr(n, r || Ur), e = Qr(t.graph, t.buckets, t.zeroIdx);
  return O(
    p(e, function(o) {
      return n.outEdges(o.v, o.w);
    })
  );
}
function Qr(n, r, t) {
  for (var e = [], o = r[r.length - 1], u = r[0], i; n.nodeCount(); ) {
    for (; i = u.dequeue(); )
      G(n, r, t, i);
    for (; i = o.dequeue(); )
      G(n, r, t, i);
    if (n.nodeCount()) {
      for (var a = r.length - 2; a > 0; --a)
        if (i = r[a].dequeue(), i) {
          e = e.concat(G(n, r, t, i, !0));
          break;
        }
    }
  }
  return e;
}
function G(n, r, t, e, o) {
  var u = o ? [] : void 0;
  return f(n.inEdges(e.v), function(i) {
    var a = n.edge(i), c = n.node(i.v);
    o && u.push({ v: i.v, w: i.w }), c.out -= a, U(r, t, c);
  }), f(n.outEdges(e.v), function(i) {
    var a = n.edge(i), c = i.w, d = n.node(c);
    d.in -= a, U(r, t, d);
  }), n.removeNode(e.v), u;
}
function Hr(n, r) {
  var t = new m(), e = 0, o = 0;
  f(n.nodes(), function(a) {
    t.setNode(a, { v: a, in: 0, out: 0 });
  }), f(n.edges(), function(a) {
    var c = t.edge(a.v, a.w) || 0, d = r(a), s = c + d;
    t.setEdge(a.v, a.w, s), o = Math.max(o, t.node(a.v).out += d), e = Math.max(e, t.node(a.w).in += d);
  });
  var u = E(o + e + 3).map(function() {
    return new Zr();
  }), i = e + 1;
  return f(t.nodes(), function(a) {
    U(u, i, t.node(a));
  }), { graph: t, buckets: u, zeroIdx: i };
}
function U(n, r, t) {
  t.out ? t.in ? n[t.out - t.in + r].enqueue(t) : n[n.length - 1].enqueue(t) : n[0].enqueue(t);
}
function Wr(n) {
  var r = n.graph().acyclicer === "greedy" ? Jr(n, t(n)) : Xr(n);
  f(r, function(e) {
    var o = n.edge(e);
    n.removeEdge(e), o.forwardName = e.name, o.reversed = !0, n.setEdge(e.w, e.v, o, H("rev"));
  });
  function t(e) {
    return function(o) {
      return e.edge(o).weight;
    };
  }
}
function Xr(n) {
  var r = [], t = {}, e = {};
  function o(u) {
    Object.prototype.hasOwnProperty.call(e, u) || (e[u] = !0, t[u] = !0, f(n.outEdges(u), function(i) {
      Object.prototype.hasOwnProperty.call(t, i.w) ? r.push(i) : o(i.w);
    }), delete t[u]);
  }
  return f(n.nodes(), o), r;
}
function nt(n) {
  f(n.edges(), function(r) {
    var t = n.edge(r);
    if (t.reversed) {
      n.removeEdge(r);
      var e = t.forwardName;
      delete t.reversed, delete t.forwardName, n.setEdge(r.w, r.v, t, e);
    }
  });
}
function N(n, r, t, e) {
  var o;
  do
    o = H(e);
  while (n.hasNode(o));
  return t.dummy = r, n.setNode(o, t), o;
}
function rt(n) {
  var r = new m().setGraph(n.graph());
  return f(n.nodes(), function(t) {
    r.setNode(t, n.node(t));
  }), f(n.edges(), function(t) {
    var e = r.edge(t.v, t.w) || { weight: 0, minlen: 1 }, o = n.edge(t);
    r.setEdge(t.v, t.w, {
      weight: e.weight + o.weight,
      minlen: Math.max(e.minlen, o.minlen)
    });
  }), r;
}
function In(n) {
  var r = new m({ multigraph: n.isMultigraph() }).setGraph(n.graph());
  return f(n.nodes(), function(t) {
    n.children(t).length || r.setNode(t, n.node(t));
  }), f(n.edges(), function(t) {
    r.setEdge(t, n.edge(t));
  }), r;
}
function un(n, r) {
  var t = n.x, e = n.y, o = r.x - t, u = r.y - e, i = n.width / 2, a = n.height / 2;
  if (!o && !u)
    throw new Error("Not possible to find intersection inside of the rectangle");
  var c, d;
  return Math.abs(u) * i > Math.abs(o) * a ? (u < 0 && (a = -a), c = a * o / u, d = a) : (o < 0 && (i = -i), c = i, d = i * u / o), { x: t + c, y: e + d };
}
function V(n) {
  var r = p(E(Pn(n) + 1), function() {
    return [];
  });
  return f(n.nodes(), function(t) {
    var e = n.node(t), o = e.rank;
    b(o) || (r[o][e.order] = t);
  }), r;
}
function tt(n) {
  var r = I(
    p(n.nodes(), function(t) {
      return n.node(t).rank;
    })
  );
  f(n.nodes(), function(t) {
    var e = n.node(t);
    _n(e, "rank") && (e.rank -= r);
  });
}
function et(n) {
  var r = I(
    p(n.nodes(), function(u) {
      return n.node(u).rank;
    })
  ), t = [];
  f(n.nodes(), function(u) {
    var i = n.node(u).rank - r;
    t[i] || (t[i] = []), t[i].push(u);
  });
  var e = 0, o = n.graph().nodeRankFactor;
  f(t, function(u, i) {
    b(u) && i % o !== 0 ? --e : e && f(u, function(a) {
      n.node(a).rank += e;
    });
  });
}
function an(n, r, t, e) {
  var o = {
    width: 0,
    height: 0
  };
  return arguments.length >= 4 && (o.rank = t, o.order = e), N(n, "border", o, r);
}
function Pn(n) {
  return y(
    p(n.nodes(), function(r) {
      var t = n.node(r).rank;
      if (!b(t))
        return t;
    })
  );
}
function ot(n, r) {
  var t = { lhs: [], rhs: [] };
  return f(n, function(e) {
    r(e) ? t.lhs.push(e) : t.rhs.push(e);
  }), t;
}
function it(n, r) {
  return r();
}
function ut(n) {
  function r(t) {
    var e = n.children(t), o = n.node(t);
    if (e.length && f(e, r), Object.prototype.hasOwnProperty.call(o, "minRank")) {
      o.borderLeft = [], o.borderRight = [];
      for (var u = o.minRank, i = o.maxRank + 1; u < i; ++u)
        cn(n, "borderLeft", "_bl", t, o, u), cn(n, "borderRight", "_br", t, o, u);
    }
  }
  f(n.children(), r);
}
function cn(n, r, t, e, o, u) {
  var i = { width: 0, height: 0, rank: u, borderType: r }, a = o[r][u - 1], c = N(n, "border", i, t);
  o[r][u] = c, n.setParent(c, e), a && n.setEdge(a, c, { weight: 1 });
}
function at(n) {
  var r = n.graph().rankdir.toLowerCase();
  (r === "lr" || r === "rl") && jn(n);
}
function ct(n) {
  var r = n.graph().rankdir.toLowerCase();
  (r === "bt" || r === "rl") && dt(n), (r === "lr" || r === "rl") && (ft(n), jn(n));
}
function jn(n) {
  f(n.nodes(), function(r) {
    dn(n.node(r));
  }), f(n.edges(), function(r) {
    dn(n.edge(r));
  });
}
function dn(n) {
  var r = n.width;
  n.width = n.height, n.height = r;
}
function dt(n) {
  f(n.nodes(), function(r) {
    B(n.node(r));
  }), f(n.edges(), function(r) {
    var t = n.edge(r);
    f(t.points, B), Object.prototype.hasOwnProperty.call(t, "y") && B(t);
  });
}
function B(n) {
  n.y = -n.y;
}
function ft(n) {
  f(n.nodes(), function(r) {
    Y(n.node(r));
  }), f(n.edges(), function(r) {
    var t = n.edge(r);
    f(t.points, Y), Object.prototype.hasOwnProperty.call(t, "x") && Y(t);
  });
}
function Y(n) {
  var r = n.x;
  n.x = n.y, n.y = r;
}
function st(n) {
  n.graph().dummyChains = [], f(n.edges(), function(r) {
    ht(n, r);
  });
}
function ht(n, r) {
  var t = r.v, e = n.node(t).rank, o = r.w, u = n.node(o).rank, i = r.name, a = n.edge(r), c = a.labelRank;
  if (u !== e + 1) {
    n.removeEdge(r);
    var d = void 0, s, h;
    for (h = 0, ++e; e < u; ++h, ++e)
      a.points = [], d = {
        width: 0,
        height: 0,
        edgeLabel: a,
        edgeObj: r,
        rank: e
      }, s = N(n, "edge", d, "_d"), e === c && (d.width = a.width, d.height = a.height, d.dummy = "edge-label", d.labelpos = a.labelpos), n.setEdge(t, s, { weight: a.weight }, i), h === 0 && n.graph().dummyChains.push(s), t = s;
    n.setEdge(t, o, { weight: a.weight }, i);
  }
}
function vt(n) {
  f(n.graph().dummyChains, function(r) {
    var t = n.node(r), e = t.edgeLabel, o;
    for (n.setEdge(t.edgeObj, e); t.dummy; )
      o = n.successors(r)[0], n.removeNode(r), e.points.push({ x: t.x, y: t.y }), t.dummy === "edge-label" && (e.x = t.x, e.y = t.y, e.width = t.width, e.height = t.height), r = o, t = n.node(r);
  });
}
function W(n) {
  var r = {};
  function t(e) {
    var o = n.node(e);
    if (Object.prototype.hasOwnProperty.call(r, e))
      return o.rank;
    r[e] = !0;
    var u = I(
      p(n.outEdges(e), function(i) {
        return t(i.w) - n.edge(i).minlen;
      })
    );
    return (u === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
    u === void 0 || // return value of _.map([]) for Lodash 4
    u === null) && (u = 0), o.rank = u;
  }
  f(n.sources(), t);
}
function P(n, r) {
  return n.node(r.w).rank - n.node(r.v).rank - n.edge(r).minlen;
}
function Rn(n) {
  var r = new m({ directed: !1 }), t = n.nodes()[0], e = n.nodeCount();
  r.setNode(t, {});
  for (var o, u; gt(r, n) < e; )
    o = lt(r, n), u = r.hasNode(o.v) ? P(n, o) : -P(n, o), pt(r, n, u);
  return r;
}
function gt(n, r) {
  function t(e) {
    f(r.nodeEdges(e), function(o) {
      var u = o.v, i = e === u ? o.w : u;
      !n.hasNode(i) && !P(r, o) && (n.setNode(i, {}), n.setEdge(e, i, {}), t(i));
    });
  }
  return f(n.nodes(), t), n.nodeCount();
}
function lt(n, r) {
  return Q(r.edges(), function(t) {
    if (n.hasNode(t.v) !== n.hasNode(t.w))
      return P(r, t);
  });
}
function pt(n, r, t) {
  f(n.nodes(), function(e) {
    r.node(e).rank += t;
  });
}
function Tn(n, r, t) {
  kn(r) || (r = [r]);
  var e = (n.isDirected() ? n.successors : n.neighbors).bind(n), o = [], u = {};
  return f(r, function(i) {
    if (!n.hasNode(i))
      throw new Error("Graph does not have node: " + i);
    Mn(n, i, t === "post", u, e, o);
  }), o;
}
function Mn(n, r, t, e, o, u) {
  Object.prototype.hasOwnProperty.call(e, r) || (e[r] = !0, t || u.push(r), f(o(r), function(i) {
    Mn(n, i, t, e, o, u);
  }), t && u.push(r));
}
function wt(n, r) {
  return Tn(n, r, "post");
}
function bt(n, r) {
  return Tn(n, r, "pre");
}
x.initLowLimValues = nn;
x.initCutValues = X;
x.calcCutValue = Ln;
x.leaveEdge = $n;
x.enterEdge = Sn;
x.exchangeEdges = Fn;
function x(n) {
  n = rt(n), W(n);
  var r = Rn(n);
  nn(r), X(r, n);
  for (var t, e; t = $n(r); )
    e = Sn(r, n, t), Fn(r, n, t, e);
}
function X(n, r) {
  var t = wt(n, n.nodes());
  t = t.slice(0, t.length - 1), f(t, function(e) {
    mt(n, r, e);
  });
}
function mt(n, r, t) {
  var e = n.node(t), o = e.parent;
  n.edge(t, o).cutvalue = Ln(n, r, t);
}
function Ln(n, r, t) {
  var e = n.node(t), o = e.parent, u = !0, i = r.edge(t, o), a = 0;
  return i || (u = !1, i = r.edge(o, t)), a = i.weight, f(r.nodeEdges(t), function(c) {
    var d = c.v === t, s = d ? c.w : c.v;
    if (s !== o) {
      var h = d === u, v = r.edge(c).weight;
      if (a += h ? v : -v, xt(n, t, s)) {
        var g = n.edge(t, s).cutvalue;
        a += h ? -g : g;
      }
    }
  }), a;
}
function nn(n, r) {
  arguments.length < 2 && (r = n.nodes()[0]), Cn(n, {}, 1, r);
}
function Cn(n, r, t, e, o) {
  var u = t, i = n.node(e);
  return r[e] = !0, f(n.neighbors(e), function(a) {
    Object.prototype.hasOwnProperty.call(r, a) || (t = Cn(n, r, t, a, e));
  }), i.low = u, i.lim = t++, o ? i.parent = o : delete i.parent, t;
}
function $n(n) {
  return J(n.edges(), function(r) {
    return n.edge(r).cutvalue < 0;
  });
}
function Sn(n, r, t) {
  var e = t.v, o = t.w;
  r.hasEdge(e, o) || (e = t.w, o = t.v);
  var u = n.node(e), i = n.node(o), a = u, c = !1;
  u.lim > i.lim && (a = i, c = !0);
  var d = R(r.edges(), function(s) {
    return c === fn(n, n.node(s.v), a) && c !== fn(n, n.node(s.w), a);
  });
  return Q(d, function(s) {
    return P(r, s);
  });
}
function Fn(n, r, t, e) {
  var o = t.v, u = t.w;
  n.removeEdge(o, u), n.setEdge(e.v, e.w, {}), nn(n), X(n, r), yt(n, r);
}
function yt(n, r) {
  var t = J(n.nodes(), function(o) {
    return !r.node(o).parent;
  }), e = bt(n, t);
  e = e.slice(1), f(e, function(o) {
    var u = n.node(o).parent, i = r.edge(o, u), a = !1;
    i || (i = r.edge(u, o), a = !0), r.node(o).rank = r.node(u).rank + (a ? i.minlen : -i.minlen);
  });
}
function xt(n, r, t) {
  return n.hasEdge(r, t);
}
function fn(n, r, t) {
  return t.low <= r.lim && r.lim <= t.lim;
}
function kt(n) {
  switch (n.graph().ranker) {
    case "network-simplex":
      sn(n);
      break;
    case "tight-tree":
      Ot(n);
      break;
    case "longest-path":
      Et(n);
      break;
    default:
      sn(n);
  }
}
var Et = W;
function Ot(n) {
  W(n), Rn(n);
}
function sn(n) {
  x(n);
}
function Nt(n) {
  var r = N(n, "root", {}, "_root"), t = _t(n), e = y(k(t)) - 1, o = 2 * e + 1;
  n.graph().nestingRoot = r, f(n.edges(), function(i) {
    n.edge(i).minlen *= o;
  });
  var u = It(n) + 1;
  f(n.children(), function(i) {
    An(n, r, o, u, e, t, i);
  }), n.graph().nodeRankFactor = o;
}
function An(n, r, t, e, o, u, i) {
  var a = n.children(i);
  if (!a.length) {
    i !== r && n.setEdge(r, i, { weight: 0, minlen: t });
    return;
  }
  var c = an(n, "_bt"), d = an(n, "_bb"), s = n.node(i);
  n.setParent(c, i), s.borderTop = c, n.setParent(d, i), s.borderBottom = d, f(a, function(h) {
    An(n, r, t, e, o, u, h);
    var v = n.node(h), g = v.borderTop ? v.borderTop : h, l = v.borderBottom ? v.borderBottom : h, w = v.borderTop ? e : 2 * e, _ = g !== l ? 1 : o - u[i] + 1;
    n.setEdge(c, g, {
      weight: w,
      minlen: _,
      nestingEdge: !0
    }), n.setEdge(l, d, {
      weight: w,
      minlen: _,
      nestingEdge: !0
    });
  }), n.parent(i) || n.setEdge(r, c, { weight: 0, minlen: o + u[i] });
}
function _t(n) {
  var r = {};
  function t(e, o) {
    var u = n.children(e);
    u && u.length && f(u, function(i) {
      t(i, o + 1);
    }), r[e] = o;
  }
  return f(n.children(), function(e) {
    t(e, 1);
  }), r;
}
function It(n) {
  return F(
    n.edges(),
    function(r, t) {
      return r + n.edge(t).weight;
    },
    0
  );
}
function Pt(n) {
  var r = n.graph();
  n.removeNode(r.nestingRoot), delete r.nestingRoot, f(n.edges(), function(t) {
    var e = n.edge(t);
    e.nestingEdge && n.removeEdge(t);
  });
}
function jt(n, r, t) {
  var e = {}, o;
  f(t, function(u) {
    for (var i = n.parent(u), a, c; i; ) {
      if (a = n.parent(i), a ? (c = e[a], e[a] = i) : (c = o, o = i), c && c !== i) {
        r.setEdge(c, i);
        return;
      }
      i = a;
    }
  });
}
function Rt(n, r, t) {
  var e = Tt(n), o = new m({ compound: !0 }).setGraph({ root: e }).setDefaultNodeLabel(function(u) {
    return n.node(u);
  });
  return f(n.nodes(), function(u) {
    var i = n.node(u), a = n.parent(u);
    (i.rank === r || i.minRank <= r && r <= i.maxRank) && (o.setNode(u), o.setParent(u, a || e), f(n[t](u), function(c) {
      var d = c.v === u ? c.w : c.v, s = o.edge(d, u), h = b(s) ? 0 : s.weight;
      o.setEdge(d, u, { weight: n.edge(c).weight + h });
    }), Object.prototype.hasOwnProperty.call(i, "minRank") && o.setNode(u, {
      borderLeft: i.borderLeft[r],
      borderRight: i.borderRight[r]
    }));
  }), o;
}
function Tt(n) {
  for (var r; n.hasNode(r = H("_root")); ) ;
  return r;
}
function Mt(n, r) {
  for (var t = 0, e = 1; e < r.length; ++e)
    t += Lt(n, r[e - 1], r[e]);
  return t;
}
function Lt(n, r, t) {
  for (var e = zr(
    t,
    p(t, function(d, s) {
      return s;
    })
  ), o = O(
    p(r, function(d) {
      return T(
        p(n.outEdges(d), function(s) {
          return { pos: e[s.w], weight: n.edge(s).weight };
        }),
        "pos"
      );
    })
  ), u = 1; u < t.length; ) u <<= 1;
  var i = 2 * u - 1;
  u -= 1;
  var a = p(new Array(i), function() {
    return 0;
  }), c = 0;
  return f(
    // @ts-expect-error
    o.forEach(function(d) {
      var s = d.pos + u;
      a[s] += d.weight;
      for (var h = 0; s > 0; )
        s % 2 && (h += a[s + 1]), s = s - 1 >> 1, a[s] += d.weight;
      c += d.weight * h;
    })
  ), c;
}
function Ct(n) {
  var r = {}, t = R(n.nodes(), function(a) {
    return !n.children(a).length;
  }), e = y(
    p(t, function(a) {
      return n.node(a).rank;
    })
  ), o = p(E(e + 1), function() {
    return [];
  });
  function u(a) {
    if (!_n(r, a)) {
      r[a] = !0;
      var c = n.node(a);
      o[c.rank].push(a), f(n.successors(a), u);
    }
  }
  var i = T(t, function(a) {
    return n.node(a).rank;
  });
  return f(i, u), o;
}
function $t(n, r) {
  return p(r, function(t) {
    var e = n.inEdges(t);
    if (e.length) {
      var o = F(
        e,
        function(u, i) {
          var a = n.edge(i), c = n.node(i.v);
          return {
            sum: u.sum + a.weight * c.order,
            weight: u.weight + a.weight
          };
        },
        { sum: 0, weight: 0 }
      );
      return {
        v: t,
        barycenter: o.sum / o.weight,
        weight: o.weight
      };
    } else
      return { v: t };
  });
}
function St(n, r) {
  var t = {};
  f(n, function(o, u) {
    var i = t[o.v] = {
      indegree: 0,
      in: [],
      out: [],
      vs: [o.v],
      i: u
    };
    b(o.barycenter) || (i.barycenter = o.barycenter, i.weight = o.weight);
  }), f(r.edges(), function(o) {
    var u = t[o.v], i = t[o.w];
    !b(u) && !b(i) && (i.indegree++, u.out.push(t[o.w]));
  });
  var e = R(t, function(o) {
    return !o.indegree;
  });
  return Ft(e);
}
function Ft(n) {
  var r = [];
  function t(u) {
    return function(i) {
      i.merged || (b(i.barycenter) || b(u.barycenter) || i.barycenter >= u.barycenter) && At(u, i);
    };
  }
  function e(u) {
    return function(i) {
      i.in.push(u), --i.indegree === 0 && n.push(i);
    };
  }
  for (; n.length; ) {
    var o = n.pop();
    r.push(o), f(o.in.reverse(), t(o)), f(o.out, e(o));
  }
  return p(
    R(r, function(u) {
      return !u.merged;
    }),
    function(u) {
      return S(u, ["vs", "i", "barycenter", "weight"]);
    }
  );
}
function At(n, r) {
  var t = 0, e = 0;
  n.weight && (t += n.barycenter * n.weight, e += n.weight), r.weight && (t += r.barycenter * r.weight, e += r.weight), n.vs = r.vs.concat(n.vs), n.barycenter = t / e, n.weight = e, n.i = Math.min(r.i, n.i), r.merged = !0;
}
function Vt(n, r) {
  var t = ot(n, function(s) {
    return Object.prototype.hasOwnProperty.call(s, "barycenter");
  }), e = t.lhs, o = T(t.rhs, function(s) {
    return -s.i;
  }), u = [], i = 0, a = 0, c = 0;
  e.sort(qt(!!r)), c = hn(u, o, c), f(e, function(s) {
    c += s.vs.length, u.push(s.vs), i += s.barycenter * s.weight, a += s.weight, c = hn(u, o, c);
  });
  var d = { vs: O(u) };
  return a && (d.barycenter = i / a, d.weight = a), d;
}
function hn(n, r, t) {
  for (var e; r.length && (e = $(r)).i <= t; )
    r.pop(), n.push(e.vs), t++;
  return t;
}
function qt(n) {
  return function(r, t) {
    return r.barycenter < t.barycenter ? -1 : r.barycenter > t.barycenter ? 1 : n ? t.i - r.i : r.i - t.i;
  };
}
function Vn(n, r, t, e) {
  var o = n.children(r), u = n.node(r), i = u ? u.borderLeft : void 0, a = u ? u.borderRight : void 0, c = {};
  i && (o = R(o, function(l) {
    return l !== i && l !== a;
  }));
  var d = $t(n, o);
  f(d, function(l) {
    if (n.children(l.v).length) {
      var w = Vn(n, l.v, t, e);
      c[l.v] = w, Object.prototype.hasOwnProperty.call(w, "barycenter") && Bt(l, w);
    }
  });
  var s = St(d, t);
  Gt(s, c);
  var h = Vt(s, e);
  if (i && (h.vs = O([i, h.vs, a]), n.predecessors(i).length)) {
    var v = n.node(n.predecessors(i)[0]), g = n.node(n.predecessors(a)[0]);
    Object.prototype.hasOwnProperty.call(h, "barycenter") || (h.barycenter = 0, h.weight = 0), h.barycenter = (h.barycenter * h.weight + v.order + g.order) / (h.weight + 2), h.weight += 2;
  }
  return h;
}
function Gt(n, r) {
  f(n, function(t) {
    t.vs = O(
      t.vs.map(function(e) {
        return r[e] ? r[e].vs : e;
      })
    );
  });
}
function Bt(n, r) {
  b(n.barycenter) ? (n.barycenter = r.barycenter, n.weight = r.weight) : (n.barycenter = (n.barycenter * n.weight + r.barycenter * r.weight) / (n.weight + r.weight), n.weight += r.weight);
}
function Yt(n) {
  var r = Pn(n), t = vn(n, E(1, r + 1), "inEdges"), e = vn(n, E(r - 1, -1, -1), "outEdges"), o = Ct(n);
  gn(n, o);
  for (var u = Number.POSITIVE_INFINITY, i, a = 0, c = 0; c < 4; ++a, ++c) {
    Dt(a % 2 ? t : e, a % 4 >= 2), o = V(n);
    var d = Mt(n, o);
    d < u && (c = 0, i = yr(o), u = d);
  }
  gn(n, i);
}
function vn(n, r, t) {
  return p(r, function(e) {
    return Rt(n, e, t);
  });
}
function Dt(n, r) {
  var t = new m();
  f(n, function(e) {
    var o = e.graph().root, u = Vn(e, o, t, r);
    f(u.vs, function(i, a) {
      e.node(i).order = a;
    }), jt(e, t, u.vs);
  });
}
function gn(n, r) {
  f(r, function(t) {
    f(t, function(e, o) {
      n.node(e).order = o;
    });
  });
}
function zt(n) {
  var r = Kt(n);
  f(n.graph().dummyChains, function(t) {
    for (var e = n.node(t), o = e.edgeObj, u = Zt(n, r, o.v, o.w), i = u.path, a = u.lca, c = 0, d = i[c], s = !0; t !== o.w; ) {
      if (e = n.node(t), s) {
        for (; (d = i[c]) !== a && n.node(d).maxRank < e.rank; )
          c++;
        d === a && (s = !1);
      }
      if (!s) {
        for (; c < i.length - 1 && n.node(d = i[c + 1]).minRank <= e.rank; )
          c++;
        d = i[c];
      }
      n.setParent(t, d), t = n.successors(t)[0];
    }
  });
}
function Zt(n, r, t, e) {
  var o = [], u = [], i = Math.min(r[t].low, r[e].low), a = Math.max(r[t].lim, r[e].lim), c, d;
  c = t;
  do
    c = n.parent(c), o.push(c);
  while (c && (r[c].low > i || a > r[c].lim));
  for (d = c, c = e; (c = n.parent(c)) !== d; )
    u.push(c);
  return { path: o.concat(u.reverse()), lca: d };
}
function Kt(n) {
  var r = {}, t = 0;
  function e(o) {
    var u = t;
    f(n.children(o), e), r[o] = { low: u, lim: t++ };
  }
  return f(n.children(), e), r;
}
function Ut(n, r) {
  var t = {};
  function e(o, u) {
    var i = 0, a = 0, c = o.length, d = $(u);
    return f(u, function(s, h) {
      var v = Qt(n, s), g = v ? n.node(v).order : c;
      (v || s === d) && (f(u.slice(a, h + 1), function(l) {
        f(n.predecessors(l), function(w) {
          var _ = n.node(w), rn = _.order;
          (rn < i || g < rn) && !(_.dummy && n.node(l).dummy) && qn(t, w, l);
        });
      }), a = h + 1, i = g);
    }), u;
  }
  return F(r, e), t;
}
function Jt(n, r) {
  var t = {};
  function e(u, i, a, c, d) {
    var s;
    f(E(i, a), function(h) {
      s = u[h], n.node(s).dummy && f(n.predecessors(s), function(v) {
        var g = n.node(v);
        g.dummy && (g.order < c || g.order > d) && qn(t, v, s);
      });
    });
  }
  function o(u, i) {
    var a = -1, c, d = 0;
    return f(i, function(s, h) {
      if (n.node(s).dummy === "border") {
        var v = n.predecessors(s);
        v.length && (c = n.node(v[0]).order, e(i, d, h, a, c), d = h, a = c);
      }
      e(i, d, i.length, c, u.length);
    }), i;
  }
  return F(r, o), t;
}
function Qt(n, r) {
  if (n.node(r).dummy)
    return J(n.predecessors(r), function(t) {
      return n.node(t).dummy;
    });
}
function qn(n, r, t) {
  if (r > t) {
    var e = r;
    r = t, t = e;
  }
  Object.prototype.hasOwnProperty.call(n, r) || Object.defineProperty(n, r, {
    enumerable: !0,
    configurable: !0,
    value: {},
    writable: !0
  });
  var o = n[r];
  Object.defineProperty(o, t, {
    enumerable: !0,
    configurable: !0,
    value: !0,
    writable: !0
  });
}
function Ht(n, r, t) {
  if (r > t) {
    var e = r;
    r = t, t = e;
  }
  return !!n[r] && Object.prototype.hasOwnProperty.call(n[r], t);
}
function Wt(n, r, t, e) {
  var o = {}, u = {}, i = {};
  return f(r, function(a) {
    f(a, function(c, d) {
      o[c] = c, u[c] = c, i[c] = d;
    });
  }), f(r, function(a) {
    var c = -1;
    f(a, function(d) {
      var s = e(d);
      if (s.length) {
        s = T(s, function(w) {
          return i[w];
        });
        for (var h = (s.length - 1) / 2, v = Math.floor(h), g = Math.ceil(h); v <= g; ++v) {
          var l = s[v];
          u[d] === d && c < i[l] && !Ht(t, d, l) && (u[l] = d, u[d] = o[d] = o[l], c = i[l]);
        }
      }
    });
  }), { root: o, align: u };
}
function Xt(n, r, t, e, o) {
  var u = {}, i = ne(n, r, t, o), a = o ? "borderLeft" : "borderRight";
  function c(h, v) {
    for (var g = i.nodes(), l = g.pop(), w = {}; l; )
      w[l] ? h(l) : (w[l] = !0, g.push(l), g = g.concat(v(l))), l = g.pop();
  }
  function d(h) {
    u[h] = i.inEdges(h).reduce(function(v, g) {
      return Math.max(v, u[g.v] + i.edge(g));
    }, 0);
  }
  function s(h) {
    var v = i.outEdges(h).reduce(function(l, w) {
      return Math.min(l, u[w.w] - i.edge(w));
    }, Number.POSITIVE_INFINITY), g = n.node(h);
    v !== Number.POSITIVE_INFINITY && g.borderType !== a && (u[h] = Math.max(u[h], v));
  }
  return c(d, i.predecessors.bind(i)), c(s, i.successors.bind(i)), f(e, function(h) {
    u[h] = u[t[h]];
  }), u;
}
function ne(n, r, t, e) {
  var o = new m(), u = n.graph(), i = ie(u.nodesep, u.edgesep, e);
  return f(r, function(a) {
    var c;
    f(a, function(d) {
      var s = t[d];
      if (o.setNode(s), c) {
        var h = t[c], v = o.edge(h, s);
        o.setEdge(h, s, Math.max(i(n, d, c), v || 0));
      }
      c = d;
    });
  }), o;
}
function re(n, r) {
  return Q(k(r), function(t) {
    var e = Number.NEGATIVE_INFINITY, o = Number.POSITIVE_INFINITY;
    return _r(t, function(u, i) {
      var a = ue(n, i) / 2;
      e = Math.max(u + a, e), o = Math.min(u - a, o);
    }), e - o;
  });
}
function te(n, r) {
  var t = k(r), e = I(t), o = y(t);
  f(["u", "d"], function(u) {
    f(["l", "r"], function(i) {
      var a = u + i, c = n[a], d;
      if (c !== r) {
        var s = k(c);
        d = i === "l" ? e - I(s) : o - y(s), d && (n[a] = A(c, function(h) {
          return h + d;
        }));
      }
    });
  });
}
function ee(n, r) {
  return A(n.ul, function(t, e) {
    if (r)
      return n[r.toLowerCase()][e];
    var o = T(p(n, e));
    return (o[1] + o[2]) / 2;
  });
}
function oe(n) {
  var r = V(n), t = K(Ut(n, r), Jt(n, r)), e = {}, o;
  f(["u", "d"], function(i) {
    o = i === "u" ? r : k(r).reverse(), f(["l", "r"], function(a) {
      a === "r" && (o = p(o, function(h) {
        return k(h).reverse();
      }));
      var c = (i === "u" ? n.predecessors : n.successors).bind(n), d = Wt(n, o, t, c), s = Xt(n, o, d.root, d.align, a === "r");
      a === "r" && (s = A(s, function(h) {
        return -h;
      })), e[i + a] = s;
    });
  });
  var u = re(n, e);
  return te(e, u), ee(e, n.graph().align);
}
function ie(n, r, t) {
  return function(e, o, u) {
    var i = e.node(o), a = e.node(u), c = 0, d;
    if (c += i.width / 2, Object.prototype.hasOwnProperty.call(i, "labelpos"))
      switch (i.labelpos.toLowerCase()) {
        case "l":
          d = -i.width / 2;
          break;
        case "r":
          d = i.width / 2;
          break;
      }
    if (d && (c += t ? d : -d), d = 0, c += (i.dummy ? r : n) / 2, c += (a.dummy ? r : n) / 2, c += 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;
      }
    return d && (c += t ? d : -d), d = 0, c;
  };
}
function ue(n, r) {
  return n.node(r).width;
}
function ae(n) {
  n = In(n), ce(n), Ir(oe(n), function(r, t) {
    n.node(t).x = r;
  });
}
function ce(n) {
  var r = V(n), t = n.graph().ranksep, e = 0;
  f(r, function(o) {
    var u = y(
      p(o, function(i) {
        return n.node(i).height;
      })
    );
    f(o, function(i) {
      n.node(i).y = e + u / 2;
    }), e += u + t;
  });
}
function Se(n, r) {
  var t = it;
  t("layout", () => {
    var e = t("  buildLayoutGraph", () => me(n));
    t("  runLayout", () => de(e, t)), t("  updateInputGraph", () => fe(n, e));
  });
}
function de(n, r) {
  r("    makeSpaceForEdgeLabels", () => ye(n)), r("    removeSelfEdges", () => je(n)), r("    acyclic", () => Wr(n)), r("    nestingGraph.run", () => Nt(n)), r("    rank", () => kt(In(n))), r("    injectEdgeLabelProxies", () => xe(n)), r("    removeEmptyRanks", () => et(n)), r("    nestingGraph.cleanup", () => Pt(n)), r("    normalizeRanks", () => tt(n)), r("    assignRankMinMax", () => ke(n)), r("    removeEdgeLabelProxies", () => Ee(n)), r("    normalize.run", () => st(n)), r("    parentDummyChains", () => zt(n)), r("    addBorderSegments", () => ut(n)), r("    order", () => Yt(n)), r("    insertSelfEdges", () => Re(n)), r("    adjustCoordinateSystem", () => at(n)), r("    position", () => ae(n)), r("    positionSelfEdges", () => Te(n)), r("    removeBorderNodes", () => Pe(n)), r("    normalize.undo", () => vt(n)), r("    fixupEdgeLabelCoords", () => _e(n)), r("    undoCoordinateSystem", () => ct(n)), r("    translateGraph", () => Oe(n)), r("    assignNodeIntersects", () => Ne(n)), r("    reversePoints", () => Ie(n)), r("    acyclic.undo", () => nt(n));
}
function fe(n, r) {
  f(n.nodes(), function(t) {
    var e = n.node(t), o = r.node(t);
    e && (e.x = o.x, e.y = o.y, r.children(t).length && (e.width = o.width, e.height = o.height));
  }), f(n.edges(), function(t) {
    var e = n.edge(t), o = r.edge(t);
    e.points = o.points, Object.prototype.hasOwnProperty.call(o, "x") && (e.x = o.x, e.y = o.y);
  }), n.graph().width = r.graph().width, n.graph().height = r.graph().height;
}
var se = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], he = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, ve = ["acyclicer", "ranker", "rankdir", "align"], ge = ["width", "height"], le = { width: 0, height: 0 }, pe = ["minlen", "weight", "width", "height", "labeloffset"], we = {
  minlen: 1,
  weight: 1,
  width: 0,
  height: 0,
  labeloffset: 10,
  labelpos: "r"
}, be = ["labelpos"];
function me(n) {
  var r = new m({ multigraph: !0, compound: !0 }), t = z(n.graph());
  return r.setGraph(
    K({}, he, D(t, se), S(t, ve))
  ), f(n.nodes(), function(e) {
    var o = z(n.node(e));
    r.setNode(e, kr(D(o, ge), le)), r.setParent(e, n.parent(e));
  }), f(n.edges(), function(e) {
    var o = z(n.edge(e));
    r.setEdge(
      e,
      K({}, we, D(o, pe), S(o, be))
    );
  }), r;
}
function ye(n) {
  var r = n.graph();
  r.ranksep /= 2, f(n.edges(), function(t) {
    var e = n.edge(t);
    e.minlen *= 2, e.labelpos.toLowerCase() !== "c" && (r.rankdir === "TB" || r.rankdir === "BT" ? e.width += e.labeloffset : e.height += e.labeloffset);
  });
}
function xe(n) {
  f(n.edges(), function(r) {
    var t = n.edge(r);
    if (t.width && t.height) {
      var e = n.node(r.v), o = n.node(r.w), u = { rank: (o.rank - e.rank) / 2 + e.rank, e: r };
      N(n, "edge-proxy", u, "_ep");
    }
  });
}
function ke(n) {
  var r = 0;
  f(n.nodes(), function(t) {
    var e = n.node(t);
    e.borderTop && (e.minRank = n.node(e.borderTop).rank, e.maxRank = n.node(e.borderBottom).rank, r = y(r, e.maxRank));
  }), n.graph().maxRank = r;
}
function Ee(n) {
  f(n.nodes(), function(r) {
    var t = n.node(r);
    t.dummy === "edge-proxy" && (n.edge(t.e).labelRank = t.rank, n.removeNode(r));
  });
}
function Oe(n) {
  var r = Number.POSITIVE_INFINITY, t = 0, e = Number.POSITIVE_INFINITY, o = 0, u = n.graph(), i = u.marginx || 0, a = u.marginy || 0;
  function c(d) {
    var s = d.x, h = d.y, v = d.width, g = d.height;
    r = Math.min(r, s - v / 2), t = Math.max(t, s + v / 2), e = Math.min(e, h - g / 2), o = Math.max(o, h + g / 2);
  }
  f(n.nodes(), function(d) {
    c(n.node(d));
  }), f(n.edges(), function(d) {
    var s = n.edge(d);
    Object.prototype.hasOwnProperty.call(s, "x") && c(s);
  }), r -= i, e -= a, f(n.nodes(), function(d) {
    var s = n.node(d);
    s.x -= r, s.y -= e;
  }), f(n.edges(), function(d) {
    var s = n.edge(d);
    f(s.points, function(h) {
      h.x -= r, h.y -= e;
    }), Object.prototype.hasOwnProperty.call(s, "x") && (s.x -= r), Object.prototype.hasOwnProperty.call(s, "y") && (s.y -= e);
  }), u.width = t - r + i, u.height = o - e + a;
}
function Ne(n) {
  f(n.edges(), function(r) {
    var t = n.edge(r), e = n.node(r.v), o = n.node(r.w), u, i;
    t.points ? (u = t.points[0], i = t.points[t.points.length - 1]) : (t.points = [], u = o, i = e), t.points.unshift(un(e, u)), t.points.push(un(o, i));
  });
}
function _e(n) {
  f(n.edges(), function(r) {
    var t = n.edge(r);
    if (Object.prototype.hasOwnProperty.call(t, "x"))
      switch ((t.labelpos === "l" || t.labelpos === "r") && (t.width -= t.labeloffset), t.labelpos) {
        case "l":
          t.x -= t.width / 2 + t.labeloffset;
          break;
        case "r":
          t.x += t.width / 2 + t.labeloffset;
          break;
      }
  });
}
function Ie(n) {
  f(n.edges(), function(r) {
    var t = n.edge(r);
    t.reversed && t.points.reverse();
  });
}
function Pe(n) {
  f(n.nodes(), function(r) {
    if (n.children(r).length) {
      var t = n.node(r), e = n.node(t.borderTop), o = n.node(t.borderBottom), u = n.node($(t.borderLeft)), i = n.node($(t.borderRight));
      t.width = Math.abs(i.x - u.x), t.height = Math.abs(o.y - e.y), t.x = u.x + t.width / 2, t.y = e.y + t.height / 2;
    }
  }), f(n.nodes(), function(r) {
    n.node(r).dummy === "border" && n.removeNode(r);
  });
}
function je(n) {
  f(n.edges(), function(r) {
    if (r.v === r.w) {
      var t = n.node(r.v);
      t.selfEdges || (t.selfEdges = []), t.selfEdges.push({ e: r, label: n.edge(r) }), n.removeEdge(r);
    }
  });
}
function Re(n) {
  var r = V(n);
  f(r, function(t) {
    var e = 0;
    f(t, function(o, u) {
      var i = n.node(o);
      i.order = u + e, f(i.selfEdges, function(a) {
        N(
          n,
          "selfedge",
          {
            width: a.label.width,
            height: a.label.height,
            rank: i.rank,
            order: u + ++e,
            e: a.e,
            label: a.label
          },
          "_se"
        );
      }), delete i.selfEdges;
    });
  });
}
function Te(n) {
  f(n.nodes(), function(r) {
    var t = n.node(r);
    if (t.dummy === "selfedge") {
      var e = n.node(t.e.v), o = e.x + e.width / 2, u = e.y, i = t.x - o, a = e.height / 2;
      n.setEdge(t.e, t.label), n.removeNode(r), t.label.points = [
        { x: o + 2 * i / 3, y: u - a },
        { x: o + 5 * i / 6, y: u - a },
        { x: o + i, y: u },
        { x: o + 5 * i / 6, y: u + a },
        { x: o + 2 * i / 3, y: u + a }
      ], t.label.x = t.x, t.label.y = t.y;
    }
  });
}
function D(n, r) {
  return A(S(n, r), Number);
}
function z(n) {
  var r = {};
  return f(n, function(t, e) {
    r[e.toLowerCase()] = t;
  }), r;
}
export {
  Se as B
};
