markdown-flow-ui
Version:
A React UI library for rendering markdown with interactive flow components, typewriter effects, and plugin support
956 lines • 254 kB
JavaScript
import { aH as ke, _ as dt, H as Ze, V as qe, l as Se, b as Qe, a as Je, p as Ke, q as je, g as _e, s as tr, y as er, D as rr, E as ir, F as ar, c as Ee, ak as me, aI as pe, i as nr, d as or, aJ as sr, aK as hr } from "./index-pooOtYuy.mjs";
import { p as lr } from "./chunk-ANTBXLJU-Cyirg13h.mjs";
import { p as fr } from "./mermaid-parser.core-Dv8CVbK7.mjs";
import { c as Fe } from "./cytoscape.esm-DfdJODL8.mjs";
var he = { exports: {} }, le = { exports: {} }, fe = { exports: {} }, cr = fe.exports, we;
function gr() {
return we || (we = 1, (function(I, x) {
(function(P, N) {
I.exports = N();
})(cr, function() {
return (
/******/
(function(A) {
var P = {};
function N(u) {
if (P[u])
return P[u].exports;
var h = P[u] = {
/******/
i: u,
/******/
l: !1,
/******/
exports: {}
/******/
};
return A[u].call(h.exports, h, h.exports, N), h.l = !0, h.exports;
}
return N.m = A, N.c = P, N.i = function(u) {
return u;
}, N.d = function(u, h, a) {
N.o(u, h) || Object.defineProperty(u, h, {
/******/
configurable: !1,
/******/
enumerable: !0,
/******/
get: a
/******/
});
}, N.n = function(u) {
var h = u && u.__esModule ? (
/******/
function() {
return u.default;
}
) : (
/******/
function() {
return u;
}
);
return N.d(h, "a", h), h;
}, N.o = function(u, h) {
return Object.prototype.hasOwnProperty.call(u, h);
}, N.p = "", N(N.s = 28);
})([
/* 0 */
/***/
(function(A, P, N) {
function u() {
}
u.QUALITY = 1, u.DEFAULT_CREATE_BENDS_AS_NEEDED = !1, u.DEFAULT_INCREMENTAL = !1, u.DEFAULT_ANIMATION_ON_LAYOUT = !0, u.DEFAULT_ANIMATION_DURING_LAYOUT = !1, u.DEFAULT_ANIMATION_PERIOD = 50, u.DEFAULT_UNIFORM_LEAF_NODE_SIZES = !1, u.DEFAULT_GRAPH_MARGIN = 15, u.NODE_DIMENSIONS_INCLUDE_LABELS = !1, u.SIMPLE_NODE_SIZE = 40, u.SIMPLE_NODE_HALF_SIZE = u.SIMPLE_NODE_SIZE / 2, u.EMPTY_COMPOUND_NODE_SIZE = 40, u.MIN_EDGE_LENGTH = 1, u.WORLD_BOUNDARY = 1e6, u.INITIAL_WORLD_BOUNDARY = u.WORLD_BOUNDARY / 1e3, u.WORLD_CENTER_X = 1200, u.WORLD_CENTER_Y = 900, A.exports = u;
}),
/* 1 */
/***/
(function(A, P, N) {
var u = N(2), h = N(8), a = N(9);
function e(f, i, g) {
u.call(this, g), this.isOverlapingSourceAndTarget = !1, this.vGraphObject = g, this.bendpoints = [], this.source = f, this.target = i;
}
e.prototype = Object.create(u.prototype);
for (var r in u)
e[r] = u[r];
e.prototype.getSource = function() {
return this.source;
}, e.prototype.getTarget = function() {
return this.target;
}, e.prototype.isInterGraph = function() {
return this.isInterGraph;
}, e.prototype.getLength = function() {
return this.length;
}, e.prototype.isOverlapingSourceAndTarget = function() {
return this.isOverlapingSourceAndTarget;
}, e.prototype.getBendpoints = function() {
return this.bendpoints;
}, e.prototype.getLca = function() {
return this.lca;
}, e.prototype.getSourceInLca = function() {
return this.sourceInLca;
}, e.prototype.getTargetInLca = function() {
return this.targetInLca;
}, e.prototype.getOtherEnd = function(f) {
if (this.source === f)
return this.target;
if (this.target === f)
return this.source;
throw "Node is not incident with this edge";
}, e.prototype.getOtherEndInGraph = function(f, i) {
for (var g = this.getOtherEnd(f), t = i.getGraphManager().getRoot(); ; ) {
if (g.getOwner() == i)
return g;
if (g.getOwner() == t)
break;
g = g.getOwner().getParent();
}
return null;
}, e.prototype.updateLength = function() {
var f = new Array(4);
this.isOverlapingSourceAndTarget = h.getIntersection(this.target.getRect(), this.source.getRect(), f), this.isOverlapingSourceAndTarget || (this.lengthX = f[0] - f[2], this.lengthY = f[1] - f[3], Math.abs(this.lengthX) < 1 && (this.lengthX = a.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = a.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY));
}, e.prototype.updateLengthSimple = function() {
this.lengthX = this.target.getCenterX() - this.source.getCenterX(), this.lengthY = this.target.getCenterY() - this.source.getCenterY(), Math.abs(this.lengthX) < 1 && (this.lengthX = a.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = a.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
}, A.exports = e;
}),
/* 2 */
/***/
(function(A, P, N) {
function u(h) {
this.vGraphObject = h;
}
A.exports = u;
}),
/* 3 */
/***/
(function(A, P, N) {
var u = N(2), h = N(10), a = N(13), e = N(0), r = N(16), f = N(5);
function i(t, o, s, c) {
s == null && c == null && (c = o), u.call(this, c), t.graphManager != null && (t = t.graphManager), this.estimatedSize = h.MIN_VALUE, this.inclusionTreeDepth = h.MAX_VALUE, this.vGraphObject = c, this.edges = [], this.graphManager = t, s != null && o != null ? this.rect = new a(o.x, o.y, s.width, s.height) : this.rect = new a();
}
i.prototype = Object.create(u.prototype);
for (var g in u)
i[g] = u[g];
i.prototype.getEdges = function() {
return this.edges;
}, i.prototype.getChild = function() {
return this.child;
}, i.prototype.getOwner = function() {
return this.owner;
}, i.prototype.getWidth = function() {
return this.rect.width;
}, i.prototype.setWidth = function(t) {
this.rect.width = t;
}, i.prototype.getHeight = function() {
return this.rect.height;
}, i.prototype.setHeight = function(t) {
this.rect.height = t;
}, i.prototype.getCenterX = function() {
return this.rect.x + this.rect.width / 2;
}, i.prototype.getCenterY = function() {
return this.rect.y + this.rect.height / 2;
}, i.prototype.getCenter = function() {
return new f(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2);
}, i.prototype.getLocation = function() {
return new f(this.rect.x, this.rect.y);
}, i.prototype.getRect = function() {
return this.rect;
}, i.prototype.getDiagonal = function() {
return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height);
}, i.prototype.getHalfTheDiagonal = function() {
return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2;
}, i.prototype.setRect = function(t, o) {
this.rect.x = t.x, this.rect.y = t.y, this.rect.width = o.width, this.rect.height = o.height;
}, i.prototype.setCenter = function(t, o) {
this.rect.x = t - this.rect.width / 2, this.rect.y = o - this.rect.height / 2;
}, i.prototype.setLocation = function(t, o) {
this.rect.x = t, this.rect.y = o;
}, i.prototype.moveBy = function(t, o) {
this.rect.x += t, this.rect.y += o;
}, i.prototype.getEdgeListToNode = function(t) {
var o = [], s = this;
return s.edges.forEach(function(c) {
if (c.target == t) {
if (c.source != s) throw "Incorrect edge source!";
o.push(c);
}
}), o;
}, i.prototype.getEdgesBetween = function(t) {
var o = [], s = this;
return s.edges.forEach(function(c) {
if (!(c.source == s || c.target == s)) throw "Incorrect edge source and/or target";
(c.target == t || c.source == t) && o.push(c);
}), o;
}, i.prototype.getNeighborsList = function() {
var t = /* @__PURE__ */ new Set(), o = this;
return o.edges.forEach(function(s) {
if (s.source == o)
t.add(s.target);
else {
if (s.target != o)
throw "Incorrect incidency!";
t.add(s.source);
}
}), t;
}, i.prototype.withChildren = function() {
var t = /* @__PURE__ */ new Set(), o, s;
if (t.add(this), this.child != null)
for (var c = this.child.getNodes(), l = 0; l < c.length; l++)
o = c[l], s = o.withChildren(), s.forEach(function(T) {
t.add(T);
});
return t;
}, i.prototype.getNoOfChildren = function() {
var t = 0, o;
if (this.child == null)
t = 1;
else
for (var s = this.child.getNodes(), c = 0; c < s.length; c++)
o = s[c], t += o.getNoOfChildren();
return t == 0 && (t = 1), t;
}, i.prototype.getEstimatedSize = function() {
if (this.estimatedSize == h.MIN_VALUE)
throw "assert failed";
return this.estimatedSize;
}, i.prototype.calcEstimatedSize = function() {
return this.child == null ? this.estimatedSize = (this.rect.width + this.rect.height) / 2 : (this.estimatedSize = this.child.calcEstimatedSize(), this.rect.width = this.estimatedSize, this.rect.height = this.estimatedSize, this.estimatedSize);
}, i.prototype.scatter = function() {
var t, o, s = -e.INITIAL_WORLD_BOUNDARY, c = e.INITIAL_WORLD_BOUNDARY;
t = e.WORLD_CENTER_X + r.nextDouble() * (c - s) + s;
var l = -e.INITIAL_WORLD_BOUNDARY, T = e.INITIAL_WORLD_BOUNDARY;
o = e.WORLD_CENTER_Y + r.nextDouble() * (T - l) + l, this.rect.x = t, this.rect.y = o;
}, i.prototype.updateBounds = function() {
if (this.getChild() == null)
throw "assert failed";
if (this.getChild().getNodes().length != 0) {
var t = this.getChild();
if (t.updateBounds(!0), this.rect.x = t.getLeft(), this.rect.y = t.getTop(), this.setWidth(t.getRight() - t.getLeft()), this.setHeight(t.getBottom() - t.getTop()), e.NODE_DIMENSIONS_INCLUDE_LABELS) {
var o = t.getRight() - t.getLeft(), s = t.getBottom() - t.getTop();
this.labelWidth && (this.labelPosHorizontal == "left" ? (this.rect.x -= this.labelWidth, this.setWidth(o + this.labelWidth)) : this.labelPosHorizontal == "center" && this.labelWidth > o ? (this.rect.x -= (this.labelWidth - o) / 2, this.setWidth(this.labelWidth)) : this.labelPosHorizontal == "right" && this.setWidth(o + this.labelWidth)), this.labelHeight && (this.labelPosVertical == "top" ? (this.rect.y -= this.labelHeight, this.setHeight(s + this.labelHeight)) : this.labelPosVertical == "center" && this.labelHeight > s ? (this.rect.y -= (this.labelHeight - s) / 2, this.setHeight(this.labelHeight)) : this.labelPosVertical == "bottom" && this.setHeight(s + this.labelHeight));
}
}
}, i.prototype.getInclusionTreeDepth = function() {
if (this.inclusionTreeDepth == h.MAX_VALUE)
throw "assert failed";
return this.inclusionTreeDepth;
}, i.prototype.transform = function(t) {
var o = this.rect.x;
o > e.WORLD_BOUNDARY ? o = e.WORLD_BOUNDARY : o < -e.WORLD_BOUNDARY && (o = -e.WORLD_BOUNDARY);
var s = this.rect.y;
s > e.WORLD_BOUNDARY ? s = e.WORLD_BOUNDARY : s < -e.WORLD_BOUNDARY && (s = -e.WORLD_BOUNDARY);
var c = new f(o, s), l = t.inverseTransformPoint(c);
this.setLocation(l.x, l.y);
}, i.prototype.getLeft = function() {
return this.rect.x;
}, i.prototype.getRight = function() {
return this.rect.x + this.rect.width;
}, i.prototype.getTop = function() {
return this.rect.y;
}, i.prototype.getBottom = function() {
return this.rect.y + this.rect.height;
}, i.prototype.getParent = function() {
return this.owner == null ? null : this.owner.getParent();
}, A.exports = i;
}),
/* 4 */
/***/
(function(A, P, N) {
var u = N(0);
function h() {
}
for (var a in u)
h[a] = u[a];
h.MAX_ITERATIONS = 2500, h.DEFAULT_EDGE_LENGTH = 50, h.DEFAULT_SPRING_STRENGTH = 0.45, h.DEFAULT_REPULSION_STRENGTH = 4500, h.DEFAULT_GRAVITY_STRENGTH = 0.4, h.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1, h.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8, h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5, h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = !0, h.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = !0, h.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3, h.COOLING_ADAPTATION_FACTOR = 0.33, h.ADAPTATION_LOWER_NODE_LIMIT = 1e3, h.ADAPTATION_UPPER_NODE_LIMIT = 5e3, h.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100, h.MAX_NODE_DISPLACEMENT = h.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3, h.MIN_REPULSION_DIST = h.DEFAULT_EDGE_LENGTH / 10, h.CONVERGENCE_CHECK_PERIOD = 100, h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1, h.MIN_EDGE_LENGTH = 1, h.GRID_CALCULATION_CHECK_PERIOD = 10, A.exports = h;
}),
/* 5 */
/***/
(function(A, P, N) {
function u(h, a) {
h == null && a == null ? (this.x = 0, this.y = 0) : (this.x = h, this.y = a);
}
u.prototype.getX = function() {
return this.x;
}, u.prototype.getY = function() {
return this.y;
}, u.prototype.setX = function(h) {
this.x = h;
}, u.prototype.setY = function(h) {
this.y = h;
}, u.prototype.getDifference = function(h) {
return new DimensionD(this.x - h.x, this.y - h.y);
}, u.prototype.getCopy = function() {
return new u(this.x, this.y);
}, u.prototype.translate = function(h) {
return this.x += h.width, this.y += h.height, this;
}, A.exports = u;
}),
/* 6 */
/***/
(function(A, P, N) {
var u = N(2), h = N(10), a = N(0), e = N(7), r = N(3), f = N(1), i = N(13), g = N(12), t = N(11);
function o(c, l, T) {
u.call(this, T), this.estimatedSize = h.MIN_VALUE, this.margin = a.DEFAULT_GRAPH_MARGIN, this.edges = [], this.nodes = [], this.isConnected = !1, this.parent = c, l != null && l instanceof e ? this.graphManager = l : l != null && l instanceof Layout && (this.graphManager = l.graphManager);
}
o.prototype = Object.create(u.prototype);
for (var s in u)
o[s] = u[s];
o.prototype.getNodes = function() {
return this.nodes;
}, o.prototype.getEdges = function() {
return this.edges;
}, o.prototype.getGraphManager = function() {
return this.graphManager;
}, o.prototype.getParent = function() {
return this.parent;
}, o.prototype.getLeft = function() {
return this.left;
}, o.prototype.getRight = function() {
return this.right;
}, o.prototype.getTop = function() {
return this.top;
}, o.prototype.getBottom = function() {
return this.bottom;
}, o.prototype.isConnected = function() {
return this.isConnected;
}, o.prototype.add = function(c, l, T) {
if (l == null && T == null) {
var d = c;
if (this.graphManager == null)
throw "Graph has no graph mgr!";
if (this.getNodes().indexOf(d) > -1)
throw "Node already in graph!";
return d.owner = this, this.getNodes().push(d), d;
} else {
var v = c;
if (!(this.getNodes().indexOf(l) > -1 && this.getNodes().indexOf(T) > -1))
throw "Source or target not in graph!";
if (!(l.owner == T.owner && l.owner == this))
throw "Both owners must be this graph!";
return l.owner != T.owner ? null : (v.source = l, v.target = T, v.isInterGraph = !1, this.getEdges().push(v), l.edges.push(v), T != l && T.edges.push(v), v);
}
}, o.prototype.remove = function(c) {
var l = c;
if (c instanceof r) {
if (l == null)
throw "Node is null!";
if (!(l.owner != null && l.owner == this))
throw "Owner graph is invalid!";
if (this.graphManager == null)
throw "Owner graph manager is invalid!";
for (var T = l.edges.slice(), d, v = T.length, L = 0; L < v; L++)
d = T[L], d.isInterGraph ? this.graphManager.remove(d) : d.source.owner.remove(d);
var b = this.nodes.indexOf(l);
if (b == -1)
throw "Node not in owner node list!";
this.nodes.splice(b, 1);
} else if (c instanceof f) {
var d = c;
if (d == null)
throw "Edge is null!";
if (!(d.source != null && d.target != null))
throw "Source and/or target is null!";
if (!(d.source.owner != null && d.target.owner != null && d.source.owner == this && d.target.owner == this))
throw "Source and/or target owner is invalid!";
var C = d.source.edges.indexOf(d), G = d.target.edges.indexOf(d);
if (!(C > -1 && G > -1))
throw "Source and/or target doesn't know this edge!";
d.source.edges.splice(C, 1), d.target != d.source && d.target.edges.splice(G, 1);
var b = d.source.owner.getEdges().indexOf(d);
if (b == -1)
throw "Not in owner's edge list!";
d.source.owner.getEdges().splice(b, 1);
}
}, o.prototype.updateLeftTop = function() {
for (var c = h.MAX_VALUE, l = h.MAX_VALUE, T, d, v, L = this.getNodes(), b = L.length, C = 0; C < b; C++) {
var G = L[C];
T = G.getTop(), d = G.getLeft(), c > T && (c = T), l > d && (l = d);
}
return c == h.MAX_VALUE ? null : (L[0].getParent().paddingLeft != null ? v = L[0].getParent().paddingLeft : v = this.margin, this.left = l - v, this.top = c - v, new g(this.left, this.top));
}, o.prototype.updateBounds = function(c) {
for (var l = h.MAX_VALUE, T = -h.MAX_VALUE, d = h.MAX_VALUE, v = -h.MAX_VALUE, L, b, C, G, Z, Y = this.nodes, K = Y.length, O = 0; O < K; O++) {
var it = Y[O];
c && it.child != null && it.updateBounds(), L = it.getLeft(), b = it.getRight(), C = it.getTop(), G = it.getBottom(), l > L && (l = L), T < b && (T = b), d > C && (d = C), v < G && (v = G);
}
var n = new i(l, d, T - l, v - d);
l == h.MAX_VALUE && (this.left = this.parent.getLeft(), this.right = this.parent.getRight(), this.top = this.parent.getTop(), this.bottom = this.parent.getBottom()), Y[0].getParent().paddingLeft != null ? Z = Y[0].getParent().paddingLeft : Z = this.margin, this.left = n.x - Z, this.right = n.x + n.width + Z, this.top = n.y - Z, this.bottom = n.y + n.height + Z;
}, o.calculateBounds = function(c) {
for (var l = h.MAX_VALUE, T = -h.MAX_VALUE, d = h.MAX_VALUE, v = -h.MAX_VALUE, L, b, C, G, Z = c.length, Y = 0; Y < Z; Y++) {
var K = c[Y];
L = K.getLeft(), b = K.getRight(), C = K.getTop(), G = K.getBottom(), l > L && (l = L), T < b && (T = b), d > C && (d = C), v < G && (v = G);
}
var O = new i(l, d, T - l, v - d);
return O;
}, o.prototype.getInclusionTreeDepth = function() {
return this == this.graphManager.getRoot() ? 1 : this.parent.getInclusionTreeDepth();
}, o.prototype.getEstimatedSize = function() {
if (this.estimatedSize == h.MIN_VALUE)
throw "assert failed";
return this.estimatedSize;
}, o.prototype.calcEstimatedSize = function() {
for (var c = 0, l = this.nodes, T = l.length, d = 0; d < T; d++) {
var v = l[d];
c += v.calcEstimatedSize();
}
return c == 0 ? this.estimatedSize = a.EMPTY_COMPOUND_NODE_SIZE : this.estimatedSize = c / Math.sqrt(this.nodes.length), this.estimatedSize;
}, o.prototype.updateConnected = function() {
var c = this;
if (this.nodes.length == 0) {
this.isConnected = !0;
return;
}
var l = new t(), T = /* @__PURE__ */ new Set(), d = this.nodes[0], v, L, b = d.withChildren();
for (b.forEach(function(O) {
l.push(O), T.add(O);
}); l.length !== 0; ) {
d = l.shift(), v = d.getEdges();
for (var C = v.length, G = 0; G < C; G++) {
var Z = v[G];
if (L = Z.getOtherEndInGraph(d, this), L != null && !T.has(L)) {
var Y = L.withChildren();
Y.forEach(function(O) {
l.push(O), T.add(O);
});
}
}
}
if (this.isConnected = !1, T.size >= this.nodes.length) {
var K = 0;
T.forEach(function(O) {
O.owner == c && K++;
}), K == this.nodes.length && (this.isConnected = !0);
}
}, A.exports = o;
}),
/* 7 */
/***/
(function(A, P, N) {
var u, h = N(1);
function a(e) {
u = N(6), this.layout = e, this.graphs = [], this.edges = [];
}
a.prototype.addRoot = function() {
var e = this.layout.newGraph(), r = this.layout.newNode(null), f = this.add(e, r);
return this.setRootGraph(f), this.rootGraph;
}, a.prototype.add = function(e, r, f, i, g) {
if (f == null && i == null && g == null) {
if (e == null)
throw "Graph is null!";
if (r == null)
throw "Parent node is null!";
if (this.graphs.indexOf(e) > -1)
throw "Graph already in this graph mgr!";
if (this.graphs.push(e), e.parent != null)
throw "Already has a parent!";
if (r.child != null)
throw "Already has a child!";
return e.parent = r, r.child = e, e;
} else {
g = f, i = r, f = e;
var t = i.getOwner(), o = g.getOwner();
if (!(t != null && t.getGraphManager() == this))
throw "Source not in this graph mgr!";
if (!(o != null && o.getGraphManager() == this))
throw "Target not in this graph mgr!";
if (t == o)
return f.isInterGraph = !1, t.add(f, i, g);
if (f.isInterGraph = !0, f.source = i, f.target = g, this.edges.indexOf(f) > -1)
throw "Edge already in inter-graph edge list!";
if (this.edges.push(f), !(f.source != null && f.target != null))
throw "Edge source and/or target is null!";
if (!(f.source.edges.indexOf(f) == -1 && f.target.edges.indexOf(f) == -1))
throw "Edge already in source and/or target incidency list!";
return f.source.edges.push(f), f.target.edges.push(f), f;
}
}, a.prototype.remove = function(e) {
if (e instanceof u) {
var r = e;
if (r.getGraphManager() != this)
throw "Graph not in this graph mgr";
if (!(r == this.rootGraph || r.parent != null && r.parent.graphManager == this))
throw "Invalid parent node!";
var f = [];
f = f.concat(r.getEdges());
for (var i, g = f.length, t = 0; t < g; t++)
i = f[t], r.remove(i);
var o = [];
o = o.concat(r.getNodes());
var s;
g = o.length;
for (var t = 0; t < g; t++)
s = o[t], r.remove(s);
r == this.rootGraph && this.setRootGraph(null);
var c = this.graphs.indexOf(r);
this.graphs.splice(c, 1), r.parent = null;
} else if (e instanceof h) {
if (i = e, i == null)
throw "Edge is null!";
if (!i.isInterGraph)
throw "Not an inter-graph edge!";
if (!(i.source != null && i.target != null))
throw "Source and/or target is null!";
if (!(i.source.edges.indexOf(i) != -1 && i.target.edges.indexOf(i) != -1))
throw "Source and/or target doesn't know this edge!";
var c = i.source.edges.indexOf(i);
if (i.source.edges.splice(c, 1), c = i.target.edges.indexOf(i), i.target.edges.splice(c, 1), !(i.source.owner != null && i.source.owner.getGraphManager() != null))
throw "Edge owner graph or owner graph manager is null!";
if (i.source.owner.getGraphManager().edges.indexOf(i) == -1)
throw "Not in owner graph manager's edge list!";
var c = i.source.owner.getGraphManager().edges.indexOf(i);
i.source.owner.getGraphManager().edges.splice(c, 1);
}
}, a.prototype.updateBounds = function() {
this.rootGraph.updateBounds(!0);
}, a.prototype.getGraphs = function() {
return this.graphs;
}, a.prototype.getAllNodes = function() {
if (this.allNodes == null) {
for (var e = [], r = this.getGraphs(), f = r.length, i = 0; i < f; i++)
e = e.concat(r[i].getNodes());
this.allNodes = e;
}
return this.allNodes;
}, a.prototype.resetAllNodes = function() {
this.allNodes = null;
}, a.prototype.resetAllEdges = function() {
this.allEdges = null;
}, a.prototype.resetAllNodesToApplyGravitation = function() {
this.allNodesToApplyGravitation = null;
}, a.prototype.getAllEdges = function() {
if (this.allEdges == null) {
var e = [], r = this.getGraphs();
r.length;
for (var f = 0; f < r.length; f++)
e = e.concat(r[f].getEdges());
e = e.concat(this.edges), this.allEdges = e;
}
return this.allEdges;
}, a.prototype.getAllNodesToApplyGravitation = function() {
return this.allNodesToApplyGravitation;
}, a.prototype.setAllNodesToApplyGravitation = function(e) {
if (this.allNodesToApplyGravitation != null)
throw "assert failed";
this.allNodesToApplyGravitation = e;
}, a.prototype.getRoot = function() {
return this.rootGraph;
}, a.prototype.setRootGraph = function(e) {
if (e.getGraphManager() != this)
throw "Root not in this graph mgr!";
this.rootGraph = e, e.parent == null && (e.parent = this.layout.newNode("Root node"));
}, a.prototype.getLayout = function() {
return this.layout;
}, a.prototype.isOneAncestorOfOther = function(e, r) {
if (!(e != null && r != null))
throw "assert failed";
if (e == r)
return !0;
var f = e.getOwner(), i;
do {
if (i = f.getParent(), i == null)
break;
if (i == r)
return !0;
if (f = i.getOwner(), f == null)
break;
} while (!0);
f = r.getOwner();
do {
if (i = f.getParent(), i == null)
break;
if (i == e)
return !0;
if (f = i.getOwner(), f == null)
break;
} while (!0);
return !1;
}, a.prototype.calcLowestCommonAncestors = function() {
for (var e, r, f, i, g, t = this.getAllEdges(), o = t.length, s = 0; s < o; s++) {
if (e = t[s], r = e.source, f = e.target, e.lca = null, e.sourceInLca = r, e.targetInLca = f, r == f) {
e.lca = r.getOwner();
continue;
}
for (i = r.getOwner(); e.lca == null; ) {
for (e.targetInLca = f, g = f.getOwner(); e.lca == null; ) {
if (g == i) {
e.lca = g;
break;
}
if (g == this.rootGraph)
break;
if (e.lca != null)
throw "assert failed";
e.targetInLca = g.getParent(), g = e.targetInLca.getOwner();
}
if (i == this.rootGraph)
break;
e.lca == null && (e.sourceInLca = i.getParent(), i = e.sourceInLca.getOwner());
}
if (e.lca == null)
throw "assert failed";
}
}, a.prototype.calcLowestCommonAncestor = function(e, r) {
if (e == r)
return e.getOwner();
var f = e.getOwner();
do {
if (f == null)
break;
var i = r.getOwner();
do {
if (i == null)
break;
if (i == f)
return i;
i = i.getParent().getOwner();
} while (!0);
f = f.getParent().getOwner();
} while (!0);
return f;
}, a.prototype.calcInclusionTreeDepths = function(e, r) {
e == null && r == null && (e = this.rootGraph, r = 1);
for (var f, i = e.getNodes(), g = i.length, t = 0; t < g; t++)
f = i[t], f.inclusionTreeDepth = r, f.child != null && this.calcInclusionTreeDepths(f.child, r + 1);
}, a.prototype.includesInvalidEdge = function() {
for (var e, r = [], f = this.edges.length, i = 0; i < f; i++)
e = this.edges[i], this.isOneAncestorOfOther(e.source, e.target) && r.push(e);
for (var i = 0; i < r.length; i++)
this.remove(r[i]);
return !1;
}, A.exports = a;
}),
/* 8 */
/***/
(function(A, P, N) {
var u = N(12);
function h() {
}
h.calcSeparationAmount = function(a, e, r, f) {
if (!a.intersects(e))
throw "assert failed";
var i = new Array(2);
this.decideDirectionsForOverlappingNodes(a, e, i), r[0] = Math.min(a.getRight(), e.getRight()) - Math.max(a.x, e.x), r[1] = Math.min(a.getBottom(), e.getBottom()) - Math.max(a.y, e.y), a.getX() <= e.getX() && a.getRight() >= e.getRight() ? r[0] += Math.min(e.getX() - a.getX(), a.getRight() - e.getRight()) : e.getX() <= a.getX() && e.getRight() >= a.getRight() && (r[0] += Math.min(a.getX() - e.getX(), e.getRight() - a.getRight())), a.getY() <= e.getY() && a.getBottom() >= e.getBottom() ? r[1] += Math.min(e.getY() - a.getY(), a.getBottom() - e.getBottom()) : e.getY() <= a.getY() && e.getBottom() >= a.getBottom() && (r[1] += Math.min(a.getY() - e.getY(), e.getBottom() - a.getBottom()));
var g = Math.abs((e.getCenterY() - a.getCenterY()) / (e.getCenterX() - a.getCenterX()));
e.getCenterY() === a.getCenterY() && e.getCenterX() === a.getCenterX() && (g = 1);
var t = g * r[0], o = r[1] / g;
r[0] < o ? o = r[0] : t = r[1], r[0] = -1 * i[0] * (o / 2 + f), r[1] = -1 * i[1] * (t / 2 + f);
}, h.decideDirectionsForOverlappingNodes = function(a, e, r) {
a.getCenterX() < e.getCenterX() ? r[0] = -1 : r[0] = 1, a.getCenterY() < e.getCenterY() ? r[1] = -1 : r[1] = 1;
}, h.getIntersection2 = function(a, e, r) {
var f = a.getCenterX(), i = a.getCenterY(), g = e.getCenterX(), t = e.getCenterY();
if (a.intersects(e))
return r[0] = f, r[1] = i, r[2] = g, r[3] = t, !0;
var o = a.getX(), s = a.getY(), c = a.getRight(), l = a.getX(), T = a.getBottom(), d = a.getRight(), v = a.getWidthHalf(), L = a.getHeightHalf(), b = e.getX(), C = e.getY(), G = e.getRight(), Z = e.getX(), Y = e.getBottom(), K = e.getRight(), O = e.getWidthHalf(), it = e.getHeightHalf(), n = !1, m = !1;
if (f === g) {
if (i > t)
return r[0] = f, r[1] = s, r[2] = g, r[3] = Y, !1;
if (i < t)
return r[0] = f, r[1] = T, r[2] = g, r[3] = C, !1;
} else if (i === t) {
if (f > g)
return r[0] = o, r[1] = i, r[2] = G, r[3] = t, !1;
if (f < g)
return r[0] = c, r[1] = i, r[2] = b, r[3] = t, !1;
} else {
var p = a.height / a.width, E = e.height / e.width, y = (t - i) / (g - f), R = void 0, M = void 0, S = void 0, W = void 0, D = void 0, q = void 0;
if (-p === y ? f > g ? (r[0] = l, r[1] = T, n = !0) : (r[0] = c, r[1] = s, n = !0) : p === y && (f > g ? (r[0] = o, r[1] = s, n = !0) : (r[0] = d, r[1] = T, n = !0)), -E === y ? g > f ? (r[2] = Z, r[3] = Y, m = !0) : (r[2] = G, r[3] = C, m = !0) : E === y && (g > f ? (r[2] = b, r[3] = C, m = !0) : (r[2] = K, r[3] = Y, m = !0)), n && m)
return !1;
if (f > g ? i > t ? (R = this.getCardinalDirection(p, y, 4), M = this.getCardinalDirection(E, y, 2)) : (R = this.getCardinalDirection(-p, y, 3), M = this.getCardinalDirection(-E, y, 1)) : i > t ? (R = this.getCardinalDirection(-p, y, 1), M = this.getCardinalDirection(-E, y, 3)) : (R = this.getCardinalDirection(p, y, 2), M = this.getCardinalDirection(E, y, 4)), !n)
switch (R) {
case 1:
W = s, S = f + -L / y, r[0] = S, r[1] = W;
break;
case 2:
S = d, W = i + v * y, r[0] = S, r[1] = W;
break;
case 3:
W = T, S = f + L / y, r[0] = S, r[1] = W;
break;
case 4:
S = l, W = i + -v * y, r[0] = S, r[1] = W;
break;
}
if (!m)
switch (M) {
case 1:
q = C, D = g + -it / y, r[2] = D, r[3] = q;
break;
case 2:
D = K, q = t + O * y, r[2] = D, r[3] = q;
break;
case 3:
q = Y, D = g + it / y, r[2] = D, r[3] = q;
break;
case 4:
D = Z, q = t + -O * y, r[2] = D, r[3] = q;
break;
}
}
return !1;
}, h.getCardinalDirection = function(a, e, r) {
return a > e ? r : 1 + r % 4;
}, h.getIntersection = function(a, e, r, f) {
if (f == null)
return this.getIntersection2(a, e, r);
var i = a.x, g = a.y, t = e.x, o = e.y, s = r.x, c = r.y, l = f.x, T = f.y, d = void 0, v = void 0, L = void 0, b = void 0, C = void 0, G = void 0, Z = void 0, Y = void 0, K = void 0;
return L = o - g, C = i - t, Z = t * g - i * o, b = T - c, G = s - l, Y = l * c - s * T, K = L * G - b * C, K === 0 ? null : (d = (C * Y - G * Z) / K, v = (b * Z - L * Y) / K, new u(d, v));
}, h.angleOfVector = function(a, e, r, f) {
var i = void 0;
return a !== r ? (i = Math.atan((f - e) / (r - a)), r < a ? i += Math.PI : f < e && (i += this.TWO_PI)) : f < e ? i = this.ONE_AND_HALF_PI : i = this.HALF_PI, i;
}, h.doIntersect = function(a, e, r, f) {
var i = a.x, g = a.y, t = e.x, o = e.y, s = r.x, c = r.y, l = f.x, T = f.y, d = (t - i) * (T - c) - (l - s) * (o - g);
if (d === 0)
return !1;
var v = ((T - c) * (l - i) + (s - l) * (T - g)) / d, L = ((g - o) * (l - i) + (t - i) * (T - g)) / d;
return 0 < v && v < 1 && 0 < L && L < 1;
}, h.findCircleLineIntersections = function(a, e, r, f, i, g, t) {
var o = (r - a) * (r - a) + (f - e) * (f - e), s = 2 * ((a - i) * (r - a) + (e - g) * (f - e)), c = (a - i) * (a - i) + (e - g) * (e - g) - t * t, l = s * s - 4 * o * c;
if (l >= 0) {
var T = (-s + Math.sqrt(s * s - 4 * o * c)) / (2 * o), d = (-s - Math.sqrt(s * s - 4 * o * c)) / (2 * o), v = null;
return T >= 0 && T <= 1 ? [T] : d >= 0 && d <= 1 ? [d] : v;
} else return null;
}, h.HALF_PI = 0.5 * Math.PI, h.ONE_AND_HALF_PI = 1.5 * Math.PI, h.TWO_PI = 2 * Math.PI, h.THREE_PI = 3 * Math.PI, A.exports = h;
}),
/* 9 */
/***/
(function(A, P, N) {
function u() {
}
u.sign = function(h) {
return h > 0 ? 1 : h < 0 ? -1 : 0;
}, u.floor = function(h) {
return h < 0 ? Math.ceil(h) : Math.floor(h);
}, u.ceil = function(h) {
return h < 0 ? Math.floor(h) : Math.ceil(h);
}, A.exports = u;
}),
/* 10 */
/***/
(function(A, P, N) {
function u() {
}
u.MAX_VALUE = 2147483647, u.MIN_VALUE = -2147483648, A.exports = u;
}),
/* 11 */
/***/
(function(A, P, N) {
var u = /* @__PURE__ */ (function() {
function i(g, t) {
for (var o = 0; o < t.length; o++) {
var s = t[o];
s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(g, s.key, s);
}
}
return function(g, t, o) {
return t && i(g.prototype, t), o && i(g, o), g;
};
})();
function h(i, g) {
if (!(i instanceof g))
throw new TypeError("Cannot call a class as a function");
}
var a = function(g) {
return { value: g, next: null, prev: null };
}, e = function(g, t, o, s) {
return g !== null ? g.next = t : s.head = t, o !== null ? o.prev = t : s.tail = t, t.prev = g, t.next = o, s.length++, t;
}, r = function(g, t) {
var o = g.prev, s = g.next;
return o !== null ? o.next = s : t.head = s, s !== null ? s.prev = o : t.tail = o, g.prev = g.next = null, t.length--, g;
}, f = (function() {
function i(g) {
var t = this;
h(this, i), this.length = 0, this.head = null, this.tail = null, g?.forEach(function(o) {
return t.push(o);
});
}
return u(i, [{
key: "size",
value: function() {
return this.length;
}
}, {
key: "insertBefore",
value: function(t, o) {
return e(o.prev, a(t), o, this);
}
}, {
key: "insertAfter",
value: function(t, o) {
return e(o, a(t), o.next, this);
}
}, {
key: "insertNodeBefore",
value: function(t, o) {
return e(o.prev, t, o, this);
}
}, {
key: "insertNodeAfter",
value: function(t, o) {
return e(o, t, o.next, this);
}
}, {
key: "push",
value: function(t) {
return e(this.tail, a(t), null, this);
}
}, {
key: "unshift",
value: function(t) {
return e(null, a(t), this.head, this);
}
}, {
key: "remove",
value: function(t) {
return r(t, this);
}
}, {
key: "pop",
value: function() {
return r(this.tail, this).value;
}
}, {
key: "popNode",
value: function() {
return r(this.tail, this);
}
}, {
key: "shift",
value: function() {
return r(this.head, this).value;
}
}, {
key: "shiftNode",
value: function() {
return r(this.head, this);
}
}, {
key: "get_object_at",
value: function(t) {
if (t <= this.length()) {
for (var o = 1, s = this.head; o < t; )
s = s.next, o++;
return s.value;
}
}
}, {
key: "set_object_at",
value: function(t, o) {
if (t <= this.length()) {
for (var s = 1, c = this.head; s < t; )
c = c.next, s++;
c.value = o;
}
}
}]), i;
})();
A.exports = f;
}),
/* 12 */
/***/
(function(A, P, N) {
function u(h, a, e) {
this.x = null, this.y = null, h == null && a == null && e == null ? (this.x = 0, this.y = 0) : typeof h == "number" && typeof a == "number" && e == null ? (this.x = h, this.y = a) : h.constructor.name == "Point" && a == null && e == null && (e = h, this.x = e.x, this.y = e.y);
}
u.prototype.getX = function() {
return this.x;
}, u.prototype.getY = function() {
return this.y;
}, u.prototype.getLocation = function() {
return new u(this.x, this.y);
}, u.prototype.setLocation = function(h, a, e) {
h.constructor.name == "Point" && a == null && e == null ? (e = h, this.setLocation(e.x, e.y)) : typeof h == "number" && typeof a == "number" && e == null && (parseInt(h) == h && parseInt(a) == a ? this.move(h, a) : (this.x = Math.floor(h + 0.5), this.y = Math.floor(a + 0.5)));
}, u.prototype.move = function(h, a) {
this.x = h, this.y = a;
}, u.prototype.translate = function(h, a) {
this.x += h, this.y += a;
}, u.prototype.equals = function(h) {
if (h.constructor.name == "Point") {
var a = h;
return this.x == a.x && this.y == a.y;
}
return this == h;
}, u.prototype.toString = function() {
return new u().constructor.name + "[x=" + this.x + ",y=" + this.y + "]";
}, A.exports = u;
}),
/* 13 */
/***/
(function(A, P, N) {
function u(h, a, e, r) {
this.x = 0, this.y = 0, this.width = 0, this.height = 0, h != null && a != null && e != null && r != null && (this.x = h, this.y = a, this.width = e, this.height = r);
}
u.prototype.getX = function() {
return this.x;
}, u.prototype.setX = function(h) {
this.x = h;
}, u.prototype.getY = function() {
return this.y;
}, u.prototype.setY = function(h) {
this.y = h;
}, u.prototype.getWidth = function() {
return this.width;
}, u.prototype.setWidth = function(h) {
this.width = h;
}, u.prototype.getHeight = function() {
return this.height;
}, u.prototype.setHeight = function(h) {
this.height = h;
}, u.prototype.getRight = function() {
return this.x + this.width;
}, u.prototype.getBottom = function() {
return this.y + this.height;
}, u.prototype.intersects = function(h) {
return !(this.getRight() < h.x || this.getBottom() < h.y || h.getRight() < this.x || h.getBottom() < this.y);
}, u.prototype.getCenterX = function() {
return this.x + this.width / 2;
}, u.prototype.getMinX = function() {
return this.getX();
}, u.prototype.getMaxX = function() {
return this.getX() + this.width;
}, u.prototype.getCenterY = function() {
return this.y + this.height / 2;
}, u.prototype.getMinY = function() {
return this.getY();
}, u.prototype.getMaxY = function() {
return this.getY() + this.height;
}, u.prototype.getWidthHalf = function() {
return this.width / 2;
}, u.prototype.getHeightHalf = function() {
return this.height / 2;
}, A.exports = u;
}),
/* 14 */
/***/
(function(A, P, N) {
var u = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(a) {
return typeof a;
} : function(a) {
return a && typeof Symbol == "function" && a.constructor === Symbol && a !== Symbol.prototype ? "symbol" : typeof a;
};
function h() {
}
h.lastID = 0, h.createID = function(a) {
return h.isPrimitive(a) ? a : (a.uniqueID != null || (a.uniqueID = h.getString(), h.lastID++), a.uniqueID);
}, h.getString = function(a) {
return a == null && (a = h.lastID), "Object#" + a;
}, h.isPrimitive = function(a) {
var e = typeof a > "u" ? "undefined" : u(a);
return a == null || e != "object" && e != "function";
}, A.exports = h;
}),
/* 15 */
/***/
(function(A, P, N) {
function u(s) {
if (Array.isArray(s)) {
for (var c = 0, l = Array(s.length); c < s.length; c++)
l[c] = s[c];
return l;
} else
return Array.from(s);
}
var h = N(0), a = N(7), e = N(3), r = N(1), f = N(6), i = N(5), g = N(17), t = N(29);
function o(s) {
t.call(this), this.layoutQuality = h.QUALITY, this.createBendsAsNeeded = h.DEFAULT_CREATE_BENDS_AS_NEEDED, this.incremental = h.DEFAULT_INCREMENTAL, this.animationOnLayout = h.DEFAULT_ANIMATION_ON_LAYOUT, this.animationDuringLayout = h.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = h.DEFAULT_ANIMATION_PERIOD, this.uniformLeafNodeSizes = h.DEFAULT_UNIFORM_LEAF_NODE_SIZES, this.edgeToDummyNodes = /* @__PURE__ */ new Map(), this.graphManager = new a(this), this.isLayoutFinished = !1, this.isSubLayout = !1, this.isRemoteUse = !1, s != null && (this.isRemoteUse = s);
}
o.RANDOM_SEED = 1, o.prototype = Object.create(t.prototype), o.prototype.getGraphManager = function() {
return this.graphManager;
}, o.prototype.getAllNodes = function() {
return this.graphManager.getAllNodes()