@ucap-llm/ai-ui 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/_basePickBy-7d00d05e.mjs +153 -0
  2. package/_baseUniq-1876be04.mjs +440 -0
  3. package/ai-ui.es.js +11 -78207
  4. package/ai-ui.umd.js +2701 -143
  5. package/arc-bb1e7b28.mjs +85 -0
  6. package/architecture-4AB2E3PP-26f07d27.mjs +10 -0
  7. package/architectureDiagram-IEHRJDOE-535e4958.mjs +4640 -0
  8. package/blockDiagram-JOT3LUYC-e5536854.mjs +2251 -0
  9. package/c4Diagram-VJAJSXHY-311741c3.mjs +1583 -0
  10. package/channel-5d097975.mjs +5 -0
  11. package/chunk-4BMEZGHF-55420838.mjs +9 -0
  12. package/chunk-A2AXSNBT-5f9de039.mjs +1373 -0
  13. package/chunk-AEK57VVT-bd6e836f.mjs +1416 -0
  14. package/chunk-D6G4REZN-69cf348a.mjs +64 -0
  15. package/chunk-RZ5BOZE2-ebe3985e.mjs +24 -0
  16. package/chunk-XZIHB7SX-ed9a9d65.mjs +15 -0
  17. package/classDiagram-GIVACNV2-4d61f06d.mjs +18 -0
  18. package/classDiagram-v2-COTLJTTW-4d61f06d.mjs +18 -0
  19. package/clone-44064c55.mjs +8 -0
  20. package/cytoscape.esm-bb479f88.mjs +18232 -0
  21. package/dagre-OKDRZEBW-0574359b.mjs +448 -0
  22. package/diagram-SSKATNLV-f4dd04b2.mjs +225 -0
  23. package/diagram-VNBRO52H-f77f925a.mjs +130 -0
  24. package/erDiagram-Q7BY3M3F-8213684f.mjs +843 -0
  25. package/flowDiagram-4HSFHLVR-1decdff6.mjs +1624 -0
  26. package/ganttDiagram-APWFNJXF-461381a5.mjs +2521 -0
  27. package/gitGraph-O2Q2CXLX-d961db16.mjs +10 -0
  28. package/gitGraphDiagram-7IBYFJ6S-be6c39c3.mjs +716 -0
  29. package/graph-7ba79f74.mjs +249 -0
  30. package/index-f5aac161.mjs +93487 -0
  31. package/info-4N47QTOZ-615527c9.mjs +10 -0
  32. package/infoDiagram-PH2N3AL5-064df479.mjs +26 -0
  33. package/init-f9637058.mjs +16 -0
  34. package/journeyDiagram-U35MCT3I-94c54b39.mjs +811 -0
  35. package/kanban-definition-NDS4AKOZ-58a05db1.mjs +720 -0
  36. package/katex-2e45926a.mjs +11700 -0
  37. package/layout-c953b0e7.mjs +1344 -0
  38. package/linear-3c81794f.mjs +447 -0
  39. package/mermaid-parser.core-7afd2b2f.mjs +12845 -0
  40. package/mindmap-definition-ALO5MXBD-60e68e28.mjs +3222 -0
  41. package/ordinal-980380c7.mjs +65 -0
  42. package/package.json +1 -1
  43. package/packet-KVYON367-4b5a305e.mjs +10 -0
  44. package/pie-R6RNRRYF-0f27d16d.mjs +10 -0
  45. package/pieDiagram-IB7DONF6-66cebf11.mjs +167 -0
  46. package/quadrantDiagram-7GDLP6J5-f2cbfc79.mjs +1027 -0
  47. package/radar-MK3ICKWK-9e1913d7.mjs +10 -0
  48. package/requirementDiagram-KVF5MWMF-36d316c2.mjs +853 -0
  49. package/sankeyDiagram-QLVOVGJD-76245efb.mjs +826 -0
  50. package/sequenceDiagram-X6HHIX6F-a0ec0021.mjs +2283 -0
  51. package/stateDiagram-DGXRK772-e6387816.mjs +274 -0
  52. package/stateDiagram-v2-YXO3MK2T-f011ada4.mjs +18 -0
  53. package/style.css +1 -1
  54. package/timeline-definition-BDJGKUSR-a62514a7.mjs +806 -0
  55. package/xychartDiagram-VJFVF3MP-1b807048.mjs +1306 -0
@@ -0,0 +1,1344 @@
1
+ import { G as g } from "./graph-7ba79f74.mjs";
2
+ import { b as Ie, o as le, p as he, g as z, e as ee, k as j, n as Me, q as Se, c as Fe, s as je, d as f, i as m, f as _, v as x, r as M } from "./_baseUniq-1876be04.mjs";
3
+ import { f as O, b as ve, a as Be, c as Ve, d as Ae, t as B, m as w, e as P, h as pe, g as U, l as T, i as Ge } from "./_basePickBy-7d00d05e.mjs";
4
+ import { b6 as Ye, b7 as $e, b8 as De, b9 as qe, aO as We, ba as ze, aS as we, aR as be, bb as Ue, aN as D, az as Xe, aU as He, aB as Je, bc as q } from "./index-f5aac161.mjs";
5
+ function Ze(e) {
6
+ return Ye($e(e, void 0, O), e + "");
7
+ }
8
+ var Ke = 1, Qe = 4;
9
+ function en(e) {
10
+ return Ie(e, Ke | Qe);
11
+ }
12
+ var nn = function() {
13
+ return De.Date.now();
14
+ };
15
+ const ne = nn;
16
+ function rn(e, n) {
17
+ return e == null ? e : qe(e, le(n), We);
18
+ }
19
+ function tn(e, n) {
20
+ return e && he(e, le(n));
21
+ }
22
+ function an(e, n) {
23
+ return e > n;
24
+ }
25
+ function S(e, n) {
26
+ var r = {};
27
+ return n = z(n), he(e, function(t, a, i) {
28
+ ze(r, a, n(t, a, i));
29
+ }), r;
30
+ }
31
+ function y(e) {
32
+ return e && e.length ? ve(e, we, an) : void 0;
33
+ }
34
+ function X(e, n) {
35
+ return e && e.length ? ve(e, z(n), Be) : void 0;
36
+ }
37
+ function on(e, n) {
38
+ var r = e.length;
39
+ for (e.sort(n); r--; )
40
+ e[r] = e[r].value;
41
+ return e;
42
+ }
43
+ function un(e, n) {
44
+ if (e !== n) {
45
+ var r = e !== void 0, t = e === null, a = e === e, i = ee(e), o = n !== void 0, u = n === null, d = n === n, s = ee(n);
46
+ if (!u && !s && !i && e > n || i && o && d && !u && !s || t && o && d || !r && d || !a)
47
+ return 1;
48
+ if (!t && !i && !s && e < n || s && r && a && !t && !i || u && r && a || !o && a || !d)
49
+ return -1;
50
+ }
51
+ return 0;
52
+ }
53
+ function dn(e, n, r) {
54
+ for (var t = -1, a = e.criteria, i = n.criteria, o = a.length, u = r.length; ++t < o; ) {
55
+ var d = un(a[t], i[t]);
56
+ if (d) {
57
+ if (t >= u)
58
+ return d;
59
+ var s = r[t];
60
+ return d * (s == "desc" ? -1 : 1);
61
+ }
62
+ }
63
+ return e.index - n.index;
64
+ }
65
+ function sn(e, n, r) {
66
+ n.length ? n = j(n, function(i) {
67
+ return be(i) ? function(o) {
68
+ return Me(o, i.length === 1 ? i[0] : i);
69
+ } : i;
70
+ }) : n = [we];
71
+ var t = -1;
72
+ n = j(n, Ue(z));
73
+ var a = Ve(e, function(i, o, u) {
74
+ var d = j(n, function(s) {
75
+ return s(i);
76
+ });
77
+ return { criteria: d, index: ++t, value: i };
78
+ });
79
+ return on(a, function(i, o) {
80
+ return dn(i, o, r);
81
+ });
82
+ }
83
+ function fn(e, n) {
84
+ return Ae(e, n, function(r, t) {
85
+ return Se(e, t);
86
+ });
87
+ }
88
+ var cn = Ze(function(e, n) {
89
+ return e == null ? {} : fn(e, n);
90
+ });
91
+ const I = cn;
92
+ var ln = Math.ceil, hn = Math.max;
93
+ function vn(e, n, r, t) {
94
+ for (var a = -1, i = hn(ln((n - e) / (r || 1)), 0), o = Array(i); i--; )
95
+ o[t ? i : ++a] = e, e += r;
96
+ return o;
97
+ }
98
+ function pn(e) {
99
+ return function(n, r, t) {
100
+ return t && typeof t != "number" && D(n, r, t) && (r = t = void 0), n = B(n), r === void 0 ? (r = n, n = 0) : r = B(r), t = t === void 0 ? n < r ? 1 : -1 : B(t), vn(n, r, t, e);
101
+ };
102
+ }
103
+ var wn = pn();
104
+ const E = wn;
105
+ var bn = Xe(function(e, n) {
106
+ if (e == null)
107
+ return [];
108
+ var r = n.length;
109
+ return r > 1 && D(e, n[0], n[1]) ? n = [] : r > 2 && D(n[0], n[1], n[2]) && (n = [n[0]]), sn(e, Fe(n, 1), []);
110
+ });
111
+ const R = bn;
112
+ var mn = 0;
113
+ function H(e) {
114
+ var n = ++mn;
115
+ return je(e) + n;
116
+ }
117
+ function gn(e, n, r) {
118
+ for (var t = -1, a = e.length, i = n.length, o = {}; ++t < a; ) {
119
+ var u = t < i ? n[t] : void 0;
120
+ r(o, e[t], u);
121
+ }
122
+ return o;
123
+ }
124
+ function yn(e, n) {
125
+ return gn(e || [], n || [], He);
126
+ }
127
+ class kn {
128
+ constructor() {
129
+ var n = {};
130
+ n._next = n._prev = n, this._sentinel = n;
131
+ }
132
+ dequeue() {
133
+ var n = this._sentinel, r = n._prev;
134
+ if (r !== n)
135
+ return re(r), r;
136
+ }
137
+ enqueue(n) {
138
+ var r = this._sentinel;
139
+ n._prev && n._next && re(n), n._next = r._next, r._next._prev = n, r._next = n, n._prev = r;
140
+ }
141
+ toString() {
142
+ for (var n = [], r = this._sentinel, t = r._prev; t !== r; )
143
+ n.push(JSON.stringify(t, xn)), t = t._prev;
144
+ return "[" + n.join(", ") + "]";
145
+ }
146
+ }
147
+ function re(e) {
148
+ e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
149
+ }
150
+ function xn(e, n) {
151
+ if (e !== "_next" && e !== "_prev")
152
+ return n;
153
+ }
154
+ var En = Je(1);
155
+ function On(e, n) {
156
+ if (e.nodeCount() <= 1)
157
+ return [];
158
+ var r = Nn(e, n || En), t = Ln(r.graph, r.buckets, r.zeroIdx);
159
+ return O(
160
+ w(t, function(a) {
161
+ return e.outEdges(a.v, a.w);
162
+ })
163
+ );
164
+ }
165
+ function Ln(e, n, r) {
166
+ for (var t = [], a = n[n.length - 1], i = n[0], o; e.nodeCount(); ) {
167
+ for (; o = i.dequeue(); )
168
+ V(e, n, r, o);
169
+ for (; o = a.dequeue(); )
170
+ V(e, n, r, o);
171
+ if (e.nodeCount()) {
172
+ for (var u = n.length - 2; u > 0; --u)
173
+ if (o = n[u].dequeue(), o) {
174
+ t = t.concat(V(e, n, r, o, !0));
175
+ break;
176
+ }
177
+ }
178
+ }
179
+ return t;
180
+ }
181
+ function V(e, n, r, t, a) {
182
+ var i = a ? [] : void 0;
183
+ return f(e.inEdges(t.v), function(o) {
184
+ var u = e.edge(o), d = e.node(o.v);
185
+ a && i.push({ v: o.v, w: o.w }), d.out -= u, W(n, r, d);
186
+ }), f(e.outEdges(t.v), function(o) {
187
+ var u = e.edge(o), d = o.w, s = e.node(d);
188
+ s.in -= u, W(n, r, s);
189
+ }), e.removeNode(t.v), i;
190
+ }
191
+ function Nn(e, n) {
192
+ var r = new g(), t = 0, a = 0;
193
+ f(e.nodes(), function(u) {
194
+ r.setNode(u, { v: u, in: 0, out: 0 });
195
+ }), f(e.edges(), function(u) {
196
+ var d = r.edge(u.v, u.w) || 0, s = n(u), c = d + s;
197
+ r.setEdge(u.v, u.w, c), a = Math.max(a, r.node(u.v).out += s), t = Math.max(t, r.node(u.w).in += s);
198
+ });
199
+ var i = E(a + t + 3).map(function() {
200
+ return new kn();
201
+ }), o = t + 1;
202
+ return f(r.nodes(), function(u) {
203
+ W(i, o, r.node(u));
204
+ }), { graph: r, buckets: i, zeroIdx: o };
205
+ }
206
+ function W(e, n, r) {
207
+ r.out ? r.in ? e[r.out - r.in + n].enqueue(r) : e[e.length - 1].enqueue(r) : e[0].enqueue(r);
208
+ }
209
+ function Pn(e) {
210
+ var n = e.graph().acyclicer === "greedy" ? On(e, r(e)) : Cn(e);
211
+ f(n, function(t) {
212
+ var a = e.edge(t);
213
+ e.removeEdge(t), a.forwardName = t.name, a.reversed = !0, e.setEdge(t.w, t.v, a, H("rev"));
214
+ });
215
+ function r(t) {
216
+ return function(a) {
217
+ return t.edge(a).weight;
218
+ };
219
+ }
220
+ }
221
+ function Cn(e) {
222
+ var n = [], r = {}, t = {};
223
+ function a(i) {
224
+ Object.prototype.hasOwnProperty.call(t, i) || (t[i] = !0, r[i] = !0, f(e.outEdges(i), function(o) {
225
+ Object.prototype.hasOwnProperty.call(r, o.w) ? n.push(o) : a(o.w);
226
+ }), delete r[i]);
227
+ }
228
+ return f(e.nodes(), a), n;
229
+ }
230
+ function _n(e) {
231
+ f(e.edges(), function(n) {
232
+ var r = e.edge(n);
233
+ if (r.reversed) {
234
+ e.removeEdge(n);
235
+ var t = r.forwardName;
236
+ delete r.reversed, delete r.forwardName, e.setEdge(n.w, n.v, r, t);
237
+ }
238
+ });
239
+ }
240
+ function L(e, n, r, t) {
241
+ var a;
242
+ do
243
+ a = H(t);
244
+ while (e.hasNode(a));
245
+ return r.dummy = n, e.setNode(a, r), a;
246
+ }
247
+ function Rn(e) {
248
+ var n = new g().setGraph(e.graph());
249
+ return f(e.nodes(), function(r) {
250
+ n.setNode(r, e.node(r));
251
+ }), f(e.edges(), function(r) {
252
+ var t = n.edge(r.v, r.w) || { weight: 0, minlen: 1 }, a = e.edge(r);
253
+ n.setEdge(r.v, r.w, {
254
+ weight: t.weight + a.weight,
255
+ minlen: Math.max(t.minlen, a.minlen)
256
+ });
257
+ }), n;
258
+ }
259
+ function me(e) {
260
+ var n = new g({ multigraph: e.isMultigraph() }).setGraph(e.graph());
261
+ return f(e.nodes(), function(r) {
262
+ e.children(r).length || n.setNode(r, e.node(r));
263
+ }), f(e.edges(), function(r) {
264
+ n.setEdge(r, e.edge(r));
265
+ }), n;
266
+ }
267
+ function te(e, n) {
268
+ var r = e.x, t = e.y, a = n.x - r, i = n.y - t, o = e.width / 2, u = e.height / 2;
269
+ if (!a && !i)
270
+ throw new Error("Not possible to find intersection inside of the rectangle");
271
+ var d, s;
272
+ return Math.abs(i) * o > Math.abs(a) * u ? (i < 0 && (u = -u), d = u * a / i, s = u) : (a < 0 && (o = -o), d = o, s = o * i / a), { x: r + d, y: t + s };
273
+ }
274
+ function F(e) {
275
+ var n = w(E(ge(e) + 1), function() {
276
+ return [];
277
+ });
278
+ return f(e.nodes(), function(r) {
279
+ var t = e.node(r), a = t.rank;
280
+ m(a) || (n[a][t.order] = r);
281
+ }), n;
282
+ }
283
+ function Tn(e) {
284
+ var n = P(
285
+ w(e.nodes(), function(r) {
286
+ return e.node(r).rank;
287
+ })
288
+ );
289
+ f(e.nodes(), function(r) {
290
+ var t = e.node(r);
291
+ pe(t, "rank") && (t.rank -= n);
292
+ });
293
+ }
294
+ function In(e) {
295
+ var n = P(
296
+ w(e.nodes(), function(i) {
297
+ return e.node(i).rank;
298
+ })
299
+ ), r = [];
300
+ f(e.nodes(), function(i) {
301
+ var o = e.node(i).rank - n;
302
+ r[o] || (r[o] = []), r[o].push(i);
303
+ });
304
+ var t = 0, a = e.graph().nodeRankFactor;
305
+ f(r, function(i, o) {
306
+ m(i) && o % a !== 0 ? --t : t && f(i, function(u) {
307
+ e.node(u).rank += t;
308
+ });
309
+ });
310
+ }
311
+ function ae(e, n, r, t) {
312
+ var a = {
313
+ width: 0,
314
+ height: 0
315
+ };
316
+ return arguments.length >= 4 && (a.rank = r, a.order = t), L(e, "border", a, n);
317
+ }
318
+ function ge(e) {
319
+ return y(
320
+ w(e.nodes(), function(n) {
321
+ var r = e.node(n).rank;
322
+ if (!m(r))
323
+ return r;
324
+ })
325
+ );
326
+ }
327
+ function Mn(e, n) {
328
+ var r = { lhs: [], rhs: [] };
329
+ return f(e, function(t) {
330
+ n(t) ? r.lhs.push(t) : r.rhs.push(t);
331
+ }), r;
332
+ }
333
+ function Sn(e, n) {
334
+ var r = ne();
335
+ try {
336
+ return n();
337
+ } finally {
338
+ console.log(e + " time: " + (ne() - r) + "ms");
339
+ }
340
+ }
341
+ function Fn(e, n) {
342
+ return n();
343
+ }
344
+ function jn(e) {
345
+ function n(r) {
346
+ var t = e.children(r), a = e.node(r);
347
+ if (t.length && f(t, n), Object.prototype.hasOwnProperty.call(a, "minRank")) {
348
+ a.borderLeft = [], a.borderRight = [];
349
+ for (var i = a.minRank, o = a.maxRank + 1; i < o; ++i)
350
+ ie(e, "borderLeft", "_bl", r, a, i), ie(e, "borderRight", "_br", r, a, i);
351
+ }
352
+ }
353
+ f(e.children(), n);
354
+ }
355
+ function ie(e, n, r, t, a, i) {
356
+ var o = { width: 0, height: 0, rank: i, borderType: n }, u = a[n][i - 1], d = L(e, "border", o, r);
357
+ a[n][i] = d, e.setParent(d, t), u && e.setEdge(u, d, { weight: 1 });
358
+ }
359
+ function Bn(e) {
360
+ var n = e.graph().rankdir.toLowerCase();
361
+ (n === "lr" || n === "rl") && ye(e);
362
+ }
363
+ function Vn(e) {
364
+ var n = e.graph().rankdir.toLowerCase();
365
+ (n === "bt" || n === "rl") && An(e), (n === "lr" || n === "rl") && (Gn(e), ye(e));
366
+ }
367
+ function ye(e) {
368
+ f(e.nodes(), function(n) {
369
+ oe(e.node(n));
370
+ }), f(e.edges(), function(n) {
371
+ oe(e.edge(n));
372
+ });
373
+ }
374
+ function oe(e) {
375
+ var n = e.width;
376
+ e.width = e.height, e.height = n;
377
+ }
378
+ function An(e) {
379
+ f(e.nodes(), function(n) {
380
+ A(e.node(n));
381
+ }), f(e.edges(), function(n) {
382
+ var r = e.edge(n);
383
+ f(r.points, A), Object.prototype.hasOwnProperty.call(r, "y") && A(r);
384
+ });
385
+ }
386
+ function A(e) {
387
+ e.y = -e.y;
388
+ }
389
+ function Gn(e) {
390
+ f(e.nodes(), function(n) {
391
+ G(e.node(n));
392
+ }), f(e.edges(), function(n) {
393
+ var r = e.edge(n);
394
+ f(r.points, G), Object.prototype.hasOwnProperty.call(r, "x") && G(r);
395
+ });
396
+ }
397
+ function G(e) {
398
+ var n = e.x;
399
+ e.x = e.y, e.y = n;
400
+ }
401
+ function Yn(e) {
402
+ e.graph().dummyChains = [], f(e.edges(), function(n) {
403
+ $n(e, n);
404
+ });
405
+ }
406
+ function $n(e, n) {
407
+ var r = n.v, t = e.node(r).rank, a = n.w, i = e.node(a).rank, o = n.name, u = e.edge(n), d = u.labelRank;
408
+ if (i !== t + 1) {
409
+ e.removeEdge(n);
410
+ var s = void 0, c, l;
411
+ for (l = 0, ++t; t < i; ++l, ++t)
412
+ u.points = [], s = {
413
+ width: 0,
414
+ height: 0,
415
+ edgeLabel: u,
416
+ edgeObj: n,
417
+ rank: t
418
+ }, c = L(e, "edge", s, "_d"), t === d && (s.width = u.width, s.height = u.height, s.dummy = "edge-label", s.labelpos = u.labelpos), e.setEdge(r, c, { weight: u.weight }, o), l === 0 && e.graph().dummyChains.push(c), r = c;
419
+ e.setEdge(r, a, { weight: u.weight }, o);
420
+ }
421
+ }
422
+ function Dn(e) {
423
+ f(e.graph().dummyChains, function(n) {
424
+ var r = e.node(n), t = r.edgeLabel, a;
425
+ for (e.setEdge(r.edgeObj, t); r.dummy; )
426
+ a = 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 = a, r = e.node(n);
427
+ });
428
+ }
429
+ function J(e) {
430
+ var n = {};
431
+ function r(t) {
432
+ var a = e.node(t);
433
+ if (Object.prototype.hasOwnProperty.call(n, t))
434
+ return a.rank;
435
+ n[t] = !0;
436
+ var i = P(
437
+ w(e.outEdges(t), function(o) {
438
+ return r(o.w) - e.edge(o).minlen;
439
+ })
440
+ );
441
+ return (i === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
442
+ i === void 0 || // return value of _.map([]) for Lodash 4
443
+ i === null) && (i = 0), a.rank = i;
444
+ }
445
+ f(e.sources(), r);
446
+ }
447
+ function C(e, n) {
448
+ return e.node(n.w).rank - e.node(n.v).rank - e.edge(n).minlen;
449
+ }
450
+ function ke(e) {
451
+ var n = new g({ directed: !1 }), r = e.nodes()[0], t = e.nodeCount();
452
+ n.setNode(r, {});
453
+ for (var a, i; qn(n, e) < t; )
454
+ a = Wn(n, e), i = n.hasNode(a.v) ? C(e, a) : -C(e, a), zn(n, e, i);
455
+ return n;
456
+ }
457
+ function qn(e, n) {
458
+ function r(t) {
459
+ f(n.nodeEdges(t), function(a) {
460
+ var i = a.v, o = t === i ? a.w : i;
461
+ !e.hasNode(o) && !C(n, a) && (e.setNode(o, {}), e.setEdge(t, o, {}), r(o));
462
+ });
463
+ }
464
+ return f(e.nodes(), r), e.nodeCount();
465
+ }
466
+ function Wn(e, n) {
467
+ return X(n.edges(), function(r) {
468
+ if (e.hasNode(r.v) !== e.hasNode(r.w))
469
+ return C(n, r);
470
+ });
471
+ }
472
+ function zn(e, n, r) {
473
+ f(e.nodes(), function(t) {
474
+ n.node(t).rank += r;
475
+ });
476
+ }
477
+ function Un() {
478
+ }
479
+ Un.prototype = new Error();
480
+ function xe(e, n, r) {
481
+ be(n) || (n = [n]);
482
+ var t = (e.isDirected() ? e.successors : e.neighbors).bind(e), a = [], i = {};
483
+ return f(n, function(o) {
484
+ if (!e.hasNode(o))
485
+ throw new Error("Graph does not have node: " + o);
486
+ Ee(e, o, r === "post", i, t, a);
487
+ }), a;
488
+ }
489
+ function Ee(e, n, r, t, a, i) {
490
+ Object.prototype.hasOwnProperty.call(t, n) || (t[n] = !0, r || i.push(n), f(a(n), function(o) {
491
+ Ee(e, o, r, t, a, i);
492
+ }), r && i.push(n));
493
+ }
494
+ function Xn(e, n) {
495
+ return xe(e, n, "post");
496
+ }
497
+ function Hn(e, n) {
498
+ return xe(e, n, "pre");
499
+ }
500
+ k.initLowLimValues = K;
501
+ k.initCutValues = Z;
502
+ k.calcCutValue = Oe;
503
+ k.leaveEdge = Ne;
504
+ k.enterEdge = Pe;
505
+ k.exchangeEdges = Ce;
506
+ function k(e) {
507
+ e = Rn(e), J(e);
508
+ var n = ke(e);
509
+ K(n), Z(n, e);
510
+ for (var r, t; r = Ne(n); )
511
+ t = Pe(n, e, r), Ce(n, e, r, t);
512
+ }
513
+ function Z(e, n) {
514
+ var r = Xn(e, e.nodes());
515
+ r = r.slice(0, r.length - 1), f(r, function(t) {
516
+ Jn(e, n, t);
517
+ });
518
+ }
519
+ function Jn(e, n, r) {
520
+ var t = e.node(r), a = t.parent;
521
+ e.edge(r, a).cutvalue = Oe(e, n, r);
522
+ }
523
+ function Oe(e, n, r) {
524
+ var t = e.node(r), a = t.parent, i = !0, o = n.edge(r, a), u = 0;
525
+ return o || (i = !1, o = n.edge(a, r)), u = o.weight, f(n.nodeEdges(r), function(d) {
526
+ var s = d.v === r, c = s ? d.w : d.v;
527
+ if (c !== a) {
528
+ var l = s === i, h = n.edge(d).weight;
529
+ if (u += l ? h : -h, Kn(e, r, c)) {
530
+ var v = e.edge(r, c).cutvalue;
531
+ u += l ? -v : v;
532
+ }
533
+ }
534
+ }), u;
535
+ }
536
+ function K(e, n) {
537
+ arguments.length < 2 && (n = e.nodes()[0]), Le(e, {}, 1, n);
538
+ }
539
+ function Le(e, n, r, t, a) {
540
+ var i = r, o = e.node(t);
541
+ return n[t] = !0, f(e.neighbors(t), function(u) {
542
+ Object.prototype.hasOwnProperty.call(n, u) || (r = Le(e, n, r, u, t));
543
+ }), o.low = i, o.lim = r++, a ? o.parent = a : delete o.parent, r;
544
+ }
545
+ function Ne(e) {
546
+ return U(e.edges(), function(n) {
547
+ return e.edge(n).cutvalue < 0;
548
+ });
549
+ }
550
+ function Pe(e, n, r) {
551
+ var t = r.v, a = r.w;
552
+ n.hasEdge(t, a) || (t = r.w, a = r.v);
553
+ var i = e.node(t), o = e.node(a), u = i, d = !1;
554
+ i.lim > o.lim && (u = o, d = !0);
555
+ var s = _(n.edges(), function(c) {
556
+ return d === ue(e, e.node(c.v), u) && d !== ue(e, e.node(c.w), u);
557
+ });
558
+ return X(s, function(c) {
559
+ return C(n, c);
560
+ });
561
+ }
562
+ function Ce(e, n, r, t) {
563
+ var a = r.v, i = r.w;
564
+ e.removeEdge(a, i), e.setEdge(t.v, t.w, {}), K(e), Z(e, n), Zn(e, n);
565
+ }
566
+ function Zn(e, n) {
567
+ var r = U(e.nodes(), function(a) {
568
+ return !n.node(a).parent;
569
+ }), t = Hn(e, r);
570
+ t = t.slice(1), f(t, function(a) {
571
+ var i = e.node(a).parent, o = n.edge(a, i), u = !1;
572
+ o || (o = n.edge(i, a), u = !0), n.node(a).rank = n.node(i).rank + (u ? o.minlen : -o.minlen);
573
+ });
574
+ }
575
+ function Kn(e, n, r) {
576
+ return e.hasEdge(n, r);
577
+ }
578
+ function ue(e, n, r) {
579
+ return r.low <= n.lim && n.lim <= r.lim;
580
+ }
581
+ function Qn(e) {
582
+ switch (e.graph().ranker) {
583
+ case "network-simplex":
584
+ de(e);
585
+ break;
586
+ case "tight-tree":
587
+ nr(e);
588
+ break;
589
+ case "longest-path":
590
+ er(e);
591
+ break;
592
+ default:
593
+ de(e);
594
+ }
595
+ }
596
+ var er = J;
597
+ function nr(e) {
598
+ J(e), ke(e);
599
+ }
600
+ function de(e) {
601
+ k(e);
602
+ }
603
+ function rr(e) {
604
+ var n = L(e, "root", {}, "_root"), r = tr(e), t = y(x(r)) - 1, a = 2 * t + 1;
605
+ e.graph().nestingRoot = n, f(e.edges(), function(o) {
606
+ e.edge(o).minlen *= a;
607
+ });
608
+ var i = ar(e) + 1;
609
+ f(e.children(), function(o) {
610
+ _e(e, n, a, i, t, r, o);
611
+ }), e.graph().nodeRankFactor = a;
612
+ }
613
+ function _e(e, n, r, t, a, i, o) {
614
+ var u = e.children(o);
615
+ if (!u.length) {
616
+ o !== n && e.setEdge(n, o, { weight: 0, minlen: r });
617
+ return;
618
+ }
619
+ var d = ae(e, "_bt"), s = ae(e, "_bb"), c = e.node(o);
620
+ e.setParent(d, o), c.borderTop = d, e.setParent(s, o), c.borderBottom = s, f(u, function(l) {
621
+ _e(e, n, r, t, a, i, l);
622
+ var h = e.node(l), v = h.borderTop ? h.borderTop : l, p = h.borderBottom ? h.borderBottom : l, b = h.borderTop ? t : 2 * t, N = v !== p ? 1 : a - i[o] + 1;
623
+ e.setEdge(d, v, {
624
+ weight: b,
625
+ minlen: N,
626
+ nestingEdge: !0
627
+ }), e.setEdge(p, s, {
628
+ weight: b,
629
+ minlen: N,
630
+ nestingEdge: !0
631
+ });
632
+ }), e.parent(o) || e.setEdge(n, d, { weight: 0, minlen: a + i[o] });
633
+ }
634
+ function tr(e) {
635
+ var n = {};
636
+ function r(t, a) {
637
+ var i = e.children(t);
638
+ i && i.length && f(i, function(o) {
639
+ r(o, a + 1);
640
+ }), n[t] = a;
641
+ }
642
+ return f(e.children(), function(t) {
643
+ r(t, 1);
644
+ }), n;
645
+ }
646
+ function ar(e) {
647
+ return M(
648
+ e.edges(),
649
+ function(n, r) {
650
+ return n + e.edge(r).weight;
651
+ },
652
+ 0
653
+ );
654
+ }
655
+ function ir(e) {
656
+ var n = e.graph();
657
+ e.removeNode(n.nestingRoot), delete n.nestingRoot, f(e.edges(), function(r) {
658
+ var t = e.edge(r);
659
+ t.nestingEdge && e.removeEdge(r);
660
+ });
661
+ }
662
+ function or(e, n, r) {
663
+ var t = {}, a;
664
+ f(r, function(i) {
665
+ for (var o = e.parent(i), u, d; o; ) {
666
+ if (u = e.parent(o), u ? (d = t[u], t[u] = o) : (d = a, a = o), d && d !== o) {
667
+ n.setEdge(d, o);
668
+ return;
669
+ }
670
+ o = u;
671
+ }
672
+ });
673
+ }
674
+ function ur(e, n, r) {
675
+ var t = dr(e), a = new g({ compound: !0 }).setGraph({ root: t }).setDefaultNodeLabel(function(i) {
676
+ return e.node(i);
677
+ });
678
+ return f(e.nodes(), function(i) {
679
+ var o = e.node(i), u = e.parent(i);
680
+ (o.rank === n || o.minRank <= n && n <= o.maxRank) && (a.setNode(i), a.setParent(i, u || t), f(e[r](i), function(d) {
681
+ var s = d.v === i ? d.w : d.v, c = a.edge(s, i), l = m(c) ? 0 : c.weight;
682
+ a.setEdge(s, i, { weight: e.edge(d).weight + l });
683
+ }), Object.prototype.hasOwnProperty.call(o, "minRank") && a.setNode(i, {
684
+ borderLeft: o.borderLeft[n],
685
+ borderRight: o.borderRight[n]
686
+ }));
687
+ }), a;
688
+ }
689
+ function dr(e) {
690
+ for (var n; e.hasNode(n = H("_root")); )
691
+ ;
692
+ return n;
693
+ }
694
+ function sr(e, n) {
695
+ for (var r = 0, t = 1; t < n.length; ++t)
696
+ r += fr(e, n[t - 1], n[t]);
697
+ return r;
698
+ }
699
+ function fr(e, n, r) {
700
+ for (var t = yn(
701
+ r,
702
+ w(r, function(s, c) {
703
+ return c;
704
+ })
705
+ ), a = O(
706
+ w(n, function(s) {
707
+ return R(
708
+ w(e.outEdges(s), function(c) {
709
+ return { pos: t[c.w], weight: e.edge(c).weight };
710
+ }),
711
+ "pos"
712
+ );
713
+ })
714
+ ), i = 1; i < r.length; )
715
+ i <<= 1;
716
+ var o = 2 * i - 1;
717
+ i -= 1;
718
+ var u = w(new Array(o), function() {
719
+ return 0;
720
+ }), d = 0;
721
+ return f(
722
+ // @ts-expect-error
723
+ a.forEach(function(s) {
724
+ var c = s.pos + i;
725
+ u[c] += s.weight;
726
+ for (var l = 0; c > 0; )
727
+ c % 2 && (l += u[c + 1]), c = c - 1 >> 1, u[c] += s.weight;
728
+ d += s.weight * l;
729
+ })
730
+ ), d;
731
+ }
732
+ function cr(e) {
733
+ var n = {}, r = _(e.nodes(), function(u) {
734
+ return !e.children(u).length;
735
+ }), t = y(
736
+ w(r, function(u) {
737
+ return e.node(u).rank;
738
+ })
739
+ ), a = w(E(t + 1), function() {
740
+ return [];
741
+ });
742
+ function i(u) {
743
+ if (!pe(n, u)) {
744
+ n[u] = !0;
745
+ var d = e.node(u);
746
+ a[d.rank].push(u), f(e.successors(u), i);
747
+ }
748
+ }
749
+ var o = R(r, function(u) {
750
+ return e.node(u).rank;
751
+ });
752
+ return f(o, i), a;
753
+ }
754
+ function lr(e, n) {
755
+ return w(n, function(r) {
756
+ var t = e.inEdges(r);
757
+ if (t.length) {
758
+ var a = M(
759
+ t,
760
+ function(i, o) {
761
+ var u = e.edge(o), d = e.node(o.v);
762
+ return {
763
+ sum: i.sum + u.weight * d.order,
764
+ weight: i.weight + u.weight
765
+ };
766
+ },
767
+ { sum: 0, weight: 0 }
768
+ );
769
+ return {
770
+ v: r,
771
+ barycenter: a.sum / a.weight,
772
+ weight: a.weight
773
+ };
774
+ } else
775
+ return { v: r };
776
+ });
777
+ }
778
+ function hr(e, n) {
779
+ var r = {};
780
+ f(e, function(a, i) {
781
+ var o = r[a.v] = {
782
+ indegree: 0,
783
+ in: [],
784
+ out: [],
785
+ vs: [a.v],
786
+ i
787
+ };
788
+ m(a.barycenter) || (o.barycenter = a.barycenter, o.weight = a.weight);
789
+ }), f(n.edges(), function(a) {
790
+ var i = r[a.v], o = r[a.w];
791
+ !m(i) && !m(o) && (o.indegree++, i.out.push(r[a.w]));
792
+ });
793
+ var t = _(r, function(a) {
794
+ return !a.indegree;
795
+ });
796
+ return vr(t);
797
+ }
798
+ function vr(e) {
799
+ var n = [];
800
+ function r(i) {
801
+ return function(o) {
802
+ o.merged || (m(o.barycenter) || m(i.barycenter) || o.barycenter >= i.barycenter) && pr(i, o);
803
+ };
804
+ }
805
+ function t(i) {
806
+ return function(o) {
807
+ o.in.push(i), --o.indegree === 0 && e.push(o);
808
+ };
809
+ }
810
+ for (; e.length; ) {
811
+ var a = e.pop();
812
+ n.push(a), f(a.in.reverse(), r(a)), f(a.out, t(a));
813
+ }
814
+ return w(
815
+ _(n, function(i) {
816
+ return !i.merged;
817
+ }),
818
+ function(i) {
819
+ return I(i, ["vs", "i", "barycenter", "weight"]);
820
+ }
821
+ );
822
+ }
823
+ function pr(e, n) {
824
+ var r = 0, t = 0;
825
+ 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;
826
+ }
827
+ function wr(e, n) {
828
+ var r = Mn(e, function(c) {
829
+ return Object.prototype.hasOwnProperty.call(c, "barycenter");
830
+ }), t = r.lhs, a = R(r.rhs, function(c) {
831
+ return -c.i;
832
+ }), i = [], o = 0, u = 0, d = 0;
833
+ t.sort(br(!!n)), d = se(i, a, d), f(t, function(c) {
834
+ d += c.vs.length, i.push(c.vs), o += c.barycenter * c.weight, u += c.weight, d = se(i, a, d);
835
+ });
836
+ var s = { vs: O(i) };
837
+ return u && (s.barycenter = o / u, s.weight = u), s;
838
+ }
839
+ function se(e, n, r) {
840
+ for (var t; n.length && (t = T(n)).i <= r; )
841
+ n.pop(), e.push(t.vs), r++;
842
+ return r;
843
+ }
844
+ function br(e) {
845
+ return function(n, r) {
846
+ return n.barycenter < r.barycenter ? -1 : n.barycenter > r.barycenter ? 1 : e ? r.i - n.i : n.i - r.i;
847
+ };
848
+ }
849
+ function Re(e, n, r, t) {
850
+ var a = e.children(n), i = e.node(n), o = i ? i.borderLeft : void 0, u = i ? i.borderRight : void 0, d = {};
851
+ o && (a = _(a, function(p) {
852
+ return p !== o && p !== u;
853
+ }));
854
+ var s = lr(e, a);
855
+ f(s, function(p) {
856
+ if (e.children(p.v).length) {
857
+ var b = Re(e, p.v, r, t);
858
+ d[p.v] = b, Object.prototype.hasOwnProperty.call(b, "barycenter") && gr(p, b);
859
+ }
860
+ });
861
+ var c = hr(s, r);
862
+ mr(c, d);
863
+ var l = wr(c, t);
864
+ if (o && (l.vs = O([o, l.vs, u]), e.predecessors(o).length)) {
865
+ var h = e.node(e.predecessors(o)[0]), v = e.node(e.predecessors(u)[0]);
866
+ 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;
867
+ }
868
+ return l;
869
+ }
870
+ function mr(e, n) {
871
+ f(e, function(r) {
872
+ r.vs = O(
873
+ r.vs.map(function(t) {
874
+ return n[t] ? n[t].vs : t;
875
+ })
876
+ );
877
+ });
878
+ }
879
+ function gr(e, n) {
880
+ m(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);
881
+ }
882
+ function yr(e) {
883
+ var n = ge(e), r = fe(e, E(1, n + 1), "inEdges"), t = fe(e, E(n - 1, -1, -1), "outEdges"), a = cr(e);
884
+ ce(e, a);
885
+ for (var i = Number.POSITIVE_INFINITY, o, u = 0, d = 0; d < 4; ++u, ++d) {
886
+ kr(u % 2 ? r : t, u % 4 >= 2), a = F(e);
887
+ var s = sr(e, a);
888
+ s < i && (d = 0, o = en(a), i = s);
889
+ }
890
+ ce(e, o);
891
+ }
892
+ function fe(e, n, r) {
893
+ return w(n, function(t) {
894
+ return ur(e, t, r);
895
+ });
896
+ }
897
+ function kr(e, n) {
898
+ var r = new g();
899
+ f(e, function(t) {
900
+ var a = t.graph().root, i = Re(t, a, r, n);
901
+ f(i.vs, function(o, u) {
902
+ t.node(o).order = u;
903
+ }), or(t, r, i.vs);
904
+ });
905
+ }
906
+ function ce(e, n) {
907
+ f(n, function(r) {
908
+ f(r, function(t, a) {
909
+ e.node(t).order = a;
910
+ });
911
+ });
912
+ }
913
+ function xr(e) {
914
+ var n = Or(e);
915
+ f(e.graph().dummyChains, function(r) {
916
+ for (var t = e.node(r), a = t.edgeObj, i = Er(e, n, a.v, a.w), o = i.path, u = i.lca, d = 0, s = o[d], c = !0; r !== a.w; ) {
917
+ if (t = e.node(r), c) {
918
+ for (; (s = o[d]) !== u && e.node(s).maxRank < t.rank; )
919
+ d++;
920
+ s === u && (c = !1);
921
+ }
922
+ if (!c) {
923
+ for (; d < o.length - 1 && e.node(s = o[d + 1]).minRank <= t.rank; )
924
+ d++;
925
+ s = o[d];
926
+ }
927
+ e.setParent(r, s), r = e.successors(r)[0];
928
+ }
929
+ });
930
+ }
931
+ function Er(e, n, r, t) {
932
+ var a = [], i = [], o = Math.min(n[r].low, n[t].low), u = Math.max(n[r].lim, n[t].lim), d, s;
933
+ d = r;
934
+ do
935
+ d = e.parent(d), a.push(d);
936
+ while (d && (n[d].low > o || u > n[d].lim));
937
+ for (s = d, d = t; (d = e.parent(d)) !== s; )
938
+ i.push(d);
939
+ return { path: a.concat(i.reverse()), lca: s };
940
+ }
941
+ function Or(e) {
942
+ var n = {}, r = 0;
943
+ function t(a) {
944
+ var i = r;
945
+ f(e.children(a), t), n[a] = { low: i, lim: r++ };
946
+ }
947
+ return f(e.children(), t), n;
948
+ }
949
+ function Lr(e, n) {
950
+ var r = {};
951
+ function t(a, i) {
952
+ var o = 0, u = 0, d = a.length, s = T(i);
953
+ return f(i, function(c, l) {
954
+ var h = Pr(e, c), v = h ? e.node(h).order : d;
955
+ (h || c === s) && (f(i.slice(u, l + 1), function(p) {
956
+ f(e.predecessors(p), function(b) {
957
+ var N = e.node(b), Q = N.order;
958
+ (Q < o || v < Q) && !(N.dummy && e.node(p).dummy) && Te(r, b, p);
959
+ });
960
+ }), u = l + 1, o = v);
961
+ }), i;
962
+ }
963
+ return M(n, t), r;
964
+ }
965
+ function Nr(e, n) {
966
+ var r = {};
967
+ function t(i, o, u, d, s) {
968
+ var c;
969
+ f(E(o, u), function(l) {
970
+ c = i[l], e.node(c).dummy && f(e.predecessors(c), function(h) {
971
+ var v = e.node(h);
972
+ v.dummy && (v.order < d || v.order > s) && Te(r, h, c);
973
+ });
974
+ });
975
+ }
976
+ function a(i, o) {
977
+ var u = -1, d, s = 0;
978
+ return f(o, function(c, l) {
979
+ if (e.node(c).dummy === "border") {
980
+ var h = e.predecessors(c);
981
+ h.length && (d = e.node(h[0]).order, t(o, s, l, u, d), s = l, u = d);
982
+ }
983
+ t(o, s, o.length, d, i.length);
984
+ }), o;
985
+ }
986
+ return M(n, a), r;
987
+ }
988
+ function Pr(e, n) {
989
+ if (e.node(n).dummy)
990
+ return U(e.predecessors(n), function(r) {
991
+ return e.node(r).dummy;
992
+ });
993
+ }
994
+ function Te(e, n, r) {
995
+ if (n > r) {
996
+ var t = n;
997
+ n = r, r = t;
998
+ }
999
+ var a = e[n];
1000
+ a || (e[n] = a = {}), a[r] = !0;
1001
+ }
1002
+ function Cr(e, n, r) {
1003
+ if (n > r) {
1004
+ var t = n;
1005
+ n = r, r = t;
1006
+ }
1007
+ return !!e[n] && Object.prototype.hasOwnProperty.call(e[n], r);
1008
+ }
1009
+ function _r(e, n, r, t) {
1010
+ var a = {}, i = {}, o = {};
1011
+ return f(n, function(u) {
1012
+ f(u, function(d, s) {
1013
+ a[d] = d, i[d] = d, o[d] = s;
1014
+ });
1015
+ }), f(n, function(u) {
1016
+ var d = -1;
1017
+ f(u, function(s) {
1018
+ var c = t(s);
1019
+ if (c.length) {
1020
+ c = R(c, function(b) {
1021
+ return o[b];
1022
+ });
1023
+ for (var l = (c.length - 1) / 2, h = Math.floor(l), v = Math.ceil(l); h <= v; ++h) {
1024
+ var p = c[h];
1025
+ i[s] === s && d < o[p] && !Cr(r, s, p) && (i[p] = s, i[s] = a[s] = a[p], d = o[p]);
1026
+ }
1027
+ }
1028
+ });
1029
+ }), { root: a, align: i };
1030
+ }
1031
+ function Rr(e, n, r, t, a) {
1032
+ var i = {}, o = Tr(e, n, r, a), u = a ? "borderLeft" : "borderRight";
1033
+ function d(l, h) {
1034
+ for (var v = o.nodes(), p = v.pop(), b = {}; p; )
1035
+ b[p] ? l(p) : (b[p] = !0, v.push(p), v = v.concat(h(p))), p = v.pop();
1036
+ }
1037
+ function s(l) {
1038
+ i[l] = o.inEdges(l).reduce(function(h, v) {
1039
+ return Math.max(h, i[v.v] + o.edge(v));
1040
+ }, 0);
1041
+ }
1042
+ function c(l) {
1043
+ var h = o.outEdges(l).reduce(function(p, b) {
1044
+ return Math.min(p, i[b.w] - o.edge(b));
1045
+ }, Number.POSITIVE_INFINITY), v = e.node(l);
1046
+ h !== Number.POSITIVE_INFINITY && v.borderType !== u && (i[l] = Math.max(i[l], h));
1047
+ }
1048
+ return d(s, o.predecessors.bind(o)), d(c, o.successors.bind(o)), f(t, function(l) {
1049
+ i[l] = i[r[l]];
1050
+ }), i;
1051
+ }
1052
+ function Tr(e, n, r, t) {
1053
+ var a = new g(), i = e.graph(), o = jr(i.nodesep, i.edgesep, t);
1054
+ return f(n, function(u) {
1055
+ var d;
1056
+ f(u, function(s) {
1057
+ var c = r[s];
1058
+ if (a.setNode(c), d) {
1059
+ var l = r[d], h = a.edge(l, c);
1060
+ a.setEdge(l, c, Math.max(o(e, s, d), h || 0));
1061
+ }
1062
+ d = s;
1063
+ });
1064
+ }), a;
1065
+ }
1066
+ function Ir(e, n) {
1067
+ return X(x(n), function(r) {
1068
+ var t = Number.NEGATIVE_INFINITY, a = Number.POSITIVE_INFINITY;
1069
+ return rn(r, function(i, o) {
1070
+ var u = Br(e, o) / 2;
1071
+ t = Math.max(i + u, t), a = Math.min(i - u, a);
1072
+ }), t - a;
1073
+ });
1074
+ }
1075
+ function Mr(e, n) {
1076
+ var r = x(n), t = P(r), a = y(r);
1077
+ f(["u", "d"], function(i) {
1078
+ f(["l", "r"], function(o) {
1079
+ var u = i + o, d = e[u], s;
1080
+ if (d !== n) {
1081
+ var c = x(d);
1082
+ s = o === "l" ? t - P(c) : a - y(c), s && (e[u] = S(d, function(l) {
1083
+ return l + s;
1084
+ }));
1085
+ }
1086
+ });
1087
+ });
1088
+ }
1089
+ function Sr(e, n) {
1090
+ return S(e.ul, function(r, t) {
1091
+ if (n)
1092
+ return e[n.toLowerCase()][t];
1093
+ var a = R(w(e, t));
1094
+ return (a[1] + a[2]) / 2;
1095
+ });
1096
+ }
1097
+ function Fr(e) {
1098
+ var n = F(e), r = q(Lr(e, n), Nr(e, n)), t = {}, a;
1099
+ f(["u", "d"], function(o) {
1100
+ a = o === "u" ? n : x(n).reverse(), f(["l", "r"], function(u) {
1101
+ u === "r" && (a = w(a, function(l) {
1102
+ return x(l).reverse();
1103
+ }));
1104
+ var d = (o === "u" ? e.predecessors : e.successors).bind(e), s = _r(e, a, r, d), c = Rr(e, a, s.root, s.align, u === "r");
1105
+ u === "r" && (c = S(c, function(l) {
1106
+ return -l;
1107
+ })), t[o + u] = c;
1108
+ });
1109
+ });
1110
+ var i = Ir(e, t);
1111
+ return Mr(t, i), Sr(t, e.graph().align);
1112
+ }
1113
+ function jr(e, n, r) {
1114
+ return function(t, a, i) {
1115
+ var o = t.node(a), u = t.node(i), d = 0, s;
1116
+ if (d += o.width / 2, Object.prototype.hasOwnProperty.call(o, "labelpos"))
1117
+ switch (o.labelpos.toLowerCase()) {
1118
+ case "l":
1119
+ s = -o.width / 2;
1120
+ break;
1121
+ case "r":
1122
+ s = o.width / 2;
1123
+ break;
1124
+ }
1125
+ if (s && (d += r ? s : -s), s = 0, d += (o.dummy ? n : e) / 2, d += (u.dummy ? n : e) / 2, d += u.width / 2, Object.prototype.hasOwnProperty.call(u, "labelpos"))
1126
+ switch (u.labelpos.toLowerCase()) {
1127
+ case "l":
1128
+ s = u.width / 2;
1129
+ break;
1130
+ case "r":
1131
+ s = -u.width / 2;
1132
+ break;
1133
+ }
1134
+ return s && (d += r ? s : -s), s = 0, d;
1135
+ };
1136
+ }
1137
+ function Br(e, n) {
1138
+ return e.node(n).width;
1139
+ }
1140
+ function Vr(e) {
1141
+ e = me(e), Ar(e), tn(Fr(e), function(n, r) {
1142
+ e.node(r).x = n;
1143
+ });
1144
+ }
1145
+ function Ar(e) {
1146
+ var n = F(e), r = e.graph().ranksep, t = 0;
1147
+ f(n, function(a) {
1148
+ var i = y(
1149
+ w(a, function(o) {
1150
+ return e.node(o).height;
1151
+ })
1152
+ );
1153
+ f(a, function(o) {
1154
+ e.node(o).y = t + i / 2;
1155
+ }), t += i + r;
1156
+ });
1157
+ }
1158
+ function ht(e, n) {
1159
+ var r = n && n.debugTiming ? Sn : Fn;
1160
+ r("layout", () => {
1161
+ var t = r(" buildLayoutGraph", () => Jr(e));
1162
+ r(" runLayout", () => Gr(t, r)), r(" updateInputGraph", () => Yr(e, t));
1163
+ });
1164
+ }
1165
+ function Gr(e, n) {
1166
+ n(" makeSpaceForEdgeLabels", () => Zr(e)), n(" removeSelfEdges", () => ot(e)), n(" acyclic", () => Pn(e)), n(" nestingGraph.run", () => rr(e)), n(" rank", () => Qn(me(e))), n(" injectEdgeLabelProxies", () => Kr(e)), n(" removeEmptyRanks", () => In(e)), n(" nestingGraph.cleanup", () => ir(e)), n(" normalizeRanks", () => Tn(e)), n(" assignRankMinMax", () => Qr(e)), n(" removeEdgeLabelProxies", () => et(e)), n(" normalize.run", () => Yn(e)), n(" parentDummyChains", () => xr(e)), n(" addBorderSegments", () => jn(e)), n(" order", () => yr(e)), n(" insertSelfEdges", () => ut(e)), n(" adjustCoordinateSystem", () => Bn(e)), n(" position", () => Vr(e)), n(" positionSelfEdges", () => dt(e)), n(" removeBorderNodes", () => it(e)), n(" normalize.undo", () => Dn(e)), n(" fixupEdgeLabelCoords", () => tt(e)), n(" undoCoordinateSystem", () => Vn(e)), n(" translateGraph", () => nt(e)), n(" assignNodeIntersects", () => rt(e)), n(" reversePoints", () => at(e)), n(" acyclic.undo", () => _n(e));
1167
+ }
1168
+ function Yr(e, n) {
1169
+ f(e.nodes(), function(r) {
1170
+ var t = e.node(r), a = n.node(r);
1171
+ t && (t.x = a.x, t.y = a.y, n.children(r).length && (t.width = a.width, t.height = a.height));
1172
+ }), f(e.edges(), function(r) {
1173
+ var t = e.edge(r), a = n.edge(r);
1174
+ t.points = a.points, Object.prototype.hasOwnProperty.call(a, "x") && (t.x = a.x, t.y = a.y);
1175
+ }), e.graph().width = n.graph().width, e.graph().height = n.graph().height;
1176
+ }
1177
+ var $r = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], Dr = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, qr = ["acyclicer", "ranker", "rankdir", "align"], Wr = ["width", "height"], zr = { width: 0, height: 0 }, Ur = ["minlen", "weight", "width", "height", "labeloffset"], Xr = {
1178
+ minlen: 1,
1179
+ weight: 1,
1180
+ width: 0,
1181
+ height: 0,
1182
+ labeloffset: 10,
1183
+ labelpos: "r"
1184
+ }, Hr = ["labelpos"];
1185
+ function Jr(e) {
1186
+ var n = new g({ multigraph: !0, compound: !0 }), r = $(e.graph());
1187
+ return n.setGraph(
1188
+ q({}, Dr, Y(r, $r), I(r, qr))
1189
+ ), f(e.nodes(), function(t) {
1190
+ var a = $(e.node(t));
1191
+ n.setNode(t, Ge(Y(a, Wr), zr)), n.setParent(t, e.parent(t));
1192
+ }), f(e.edges(), function(t) {
1193
+ var a = $(e.edge(t));
1194
+ n.setEdge(
1195
+ t,
1196
+ q({}, Xr, Y(a, Ur), I(a, Hr))
1197
+ );
1198
+ }), n;
1199
+ }
1200
+ function Zr(e) {
1201
+ var n = e.graph();
1202
+ n.ranksep /= 2, f(e.edges(), function(r) {
1203
+ var t = e.edge(r);
1204
+ t.minlen *= 2, t.labelpos.toLowerCase() !== "c" && (n.rankdir === "TB" || n.rankdir === "BT" ? t.width += t.labeloffset : t.height += t.labeloffset);
1205
+ });
1206
+ }
1207
+ function Kr(e) {
1208
+ f(e.edges(), function(n) {
1209
+ var r = e.edge(n);
1210
+ if (r.width && r.height) {
1211
+ var t = e.node(n.v), a = e.node(n.w), i = { rank: (a.rank - t.rank) / 2 + t.rank, e: n };
1212
+ L(e, "edge-proxy", i, "_ep");
1213
+ }
1214
+ });
1215
+ }
1216
+ function Qr(e) {
1217
+ var n = 0;
1218
+ f(e.nodes(), function(r) {
1219
+ var t = e.node(r);
1220
+ t.borderTop && (t.minRank = e.node(t.borderTop).rank, t.maxRank = e.node(t.borderBottom).rank, n = y(n, t.maxRank));
1221
+ }), e.graph().maxRank = n;
1222
+ }
1223
+ function et(e) {
1224
+ f(e.nodes(), function(n) {
1225
+ var r = e.node(n);
1226
+ r.dummy === "edge-proxy" && (e.edge(r.e).labelRank = r.rank, e.removeNode(n));
1227
+ });
1228
+ }
1229
+ function nt(e) {
1230
+ var n = Number.POSITIVE_INFINITY, r = 0, t = Number.POSITIVE_INFINITY, a = 0, i = e.graph(), o = i.marginx || 0, u = i.marginy || 0;
1231
+ function d(s) {
1232
+ var c = s.x, l = s.y, h = s.width, v = s.height;
1233
+ n = Math.min(n, c - h / 2), r = Math.max(r, c + h / 2), t = Math.min(t, l - v / 2), a = Math.max(a, l + v / 2);
1234
+ }
1235
+ f(e.nodes(), function(s) {
1236
+ d(e.node(s));
1237
+ }), f(e.edges(), function(s) {
1238
+ var c = e.edge(s);
1239
+ Object.prototype.hasOwnProperty.call(c, "x") && d(c);
1240
+ }), n -= o, t -= u, f(e.nodes(), function(s) {
1241
+ var c = e.node(s);
1242
+ c.x -= n, c.y -= t;
1243
+ }), f(e.edges(), function(s) {
1244
+ var c = e.edge(s);
1245
+ f(c.points, function(l) {
1246
+ l.x -= n, l.y -= t;
1247
+ }), Object.prototype.hasOwnProperty.call(c, "x") && (c.x -= n), Object.prototype.hasOwnProperty.call(c, "y") && (c.y -= t);
1248
+ }), i.width = r - n + o, i.height = a - t + u;
1249
+ }
1250
+ function rt(e) {
1251
+ f(e.edges(), function(n) {
1252
+ var r = e.edge(n), t = e.node(n.v), a = e.node(n.w), i, o;
1253
+ r.points ? (i = r.points[0], o = r.points[r.points.length - 1]) : (r.points = [], i = a, o = t), r.points.unshift(te(t, i)), r.points.push(te(a, o));
1254
+ });
1255
+ }
1256
+ function tt(e) {
1257
+ f(e.edges(), function(n) {
1258
+ var r = e.edge(n);
1259
+ if (Object.prototype.hasOwnProperty.call(r, "x"))
1260
+ switch ((r.labelpos === "l" || r.labelpos === "r") && (r.width -= r.labeloffset), r.labelpos) {
1261
+ case "l":
1262
+ r.x -= r.width / 2 + r.labeloffset;
1263
+ break;
1264
+ case "r":
1265
+ r.x += r.width / 2 + r.labeloffset;
1266
+ break;
1267
+ }
1268
+ });
1269
+ }
1270
+ function at(e) {
1271
+ f(e.edges(), function(n) {
1272
+ var r = e.edge(n);
1273
+ r.reversed && r.points.reverse();
1274
+ });
1275
+ }
1276
+ function it(e) {
1277
+ f(e.nodes(), function(n) {
1278
+ if (e.children(n).length) {
1279
+ var r = e.node(n), t = e.node(r.borderTop), a = e.node(r.borderBottom), i = e.node(T(r.borderLeft)), o = e.node(T(r.borderRight));
1280
+ r.width = Math.abs(o.x - i.x), r.height = Math.abs(a.y - t.y), r.x = i.x + r.width / 2, r.y = t.y + r.height / 2;
1281
+ }
1282
+ }), f(e.nodes(), function(n) {
1283
+ e.node(n).dummy === "border" && e.removeNode(n);
1284
+ });
1285
+ }
1286
+ function ot(e) {
1287
+ f(e.edges(), function(n) {
1288
+ if (n.v === n.w) {
1289
+ var r = e.node(n.v);
1290
+ r.selfEdges || (r.selfEdges = []), r.selfEdges.push({ e: n, label: e.edge(n) }), e.removeEdge(n);
1291
+ }
1292
+ });
1293
+ }
1294
+ function ut(e) {
1295
+ var n = F(e);
1296
+ f(n, function(r) {
1297
+ var t = 0;
1298
+ f(r, function(a, i) {
1299
+ var o = e.node(a);
1300
+ o.order = i + t, f(o.selfEdges, function(u) {
1301
+ L(
1302
+ e,
1303
+ "selfedge",
1304
+ {
1305
+ width: u.label.width,
1306
+ height: u.label.height,
1307
+ rank: o.rank,
1308
+ order: i + ++t,
1309
+ e: u.e,
1310
+ label: u.label
1311
+ },
1312
+ "_se"
1313
+ );
1314
+ }), delete o.selfEdges;
1315
+ });
1316
+ });
1317
+ }
1318
+ function dt(e) {
1319
+ f(e.nodes(), function(n) {
1320
+ var r = e.node(n);
1321
+ if (r.dummy === "selfedge") {
1322
+ var t = e.node(r.e.v), a = t.x + t.width / 2, i = t.y, o = r.x - a, u = t.height / 2;
1323
+ e.setEdge(r.e, r.label), e.removeNode(n), r.label.points = [
1324
+ { x: a + 2 * o / 3, y: i - u },
1325
+ { x: a + 5 * o / 6, y: i - u },
1326
+ { x: a + o, y: i },
1327
+ { x: a + 5 * o / 6, y: i + u },
1328
+ { x: a + 2 * o / 3, y: i + u }
1329
+ ], r.label.x = r.x, r.label.y = r.y;
1330
+ }
1331
+ });
1332
+ }
1333
+ function Y(e, n) {
1334
+ return S(I(e, n), Number);
1335
+ }
1336
+ function $(e) {
1337
+ var n = {};
1338
+ return f(e, function(r, t) {
1339
+ n[t.toLowerCase()] = r;
1340
+ }), n;
1341
+ }
1342
+ export {
1343
+ ht as l
1344
+ };