@skydesign/tf 0.2.2 → 0.3.2

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.
@@ -0,0 +1,3586 @@
1
+ function Wa(t) {
2
+ return JSON.stringify(JSON.stringify(t)).slice(1, -1);
3
+ }
4
+ function Mt(t) {
5
+ try {
6
+ return JSON.parse(t);
7
+ } catch {
8
+ const e = JSON.parse(`"${t}"`);
9
+ return JSON.parse(e);
10
+ }
11
+ }
12
+ var pn = { value: () => {
13
+ } };
14
+ function re() {
15
+ for (var t = 0, e = arguments.length, n = {}, r; t < e; ++t) {
16
+ if (!(r = arguments[t] + "") || r in n || /[\s.]/.test(r)) throw new Error("illegal type: " + r);
17
+ n[r] = [];
18
+ }
19
+ return new $t(n);
20
+ }
21
+ function $t(t) {
22
+ this._ = t;
23
+ }
24
+ function mn(t, e) {
25
+ return t.trim().split(/^|\s+/).map(function(n) {
26
+ var r = "", i = n.indexOf(".");
27
+ if (i >= 0 && (r = n.slice(i + 1), n = n.slice(0, i)), n && !e.hasOwnProperty(n)) throw new Error("unknown type: " + n);
28
+ return { type: n, name: r };
29
+ });
30
+ }
31
+ $t.prototype = re.prototype = {
32
+ constructor: $t,
33
+ on: function(t, e) {
34
+ var n = this._, r = mn(t + "", n), i, a = -1, o = r.length;
35
+ if (arguments.length < 2) {
36
+ for (; ++a < o; ) if ((i = (t = r[a]).type) && (i = yn(n[i], t.name))) return i;
37
+ return;
38
+ }
39
+ if (e != null && typeof e != "function") throw new Error("invalid callback: " + e);
40
+ for (; ++a < o; )
41
+ if (i = (t = r[a]).type) n[i] = fe(n[i], t.name, e);
42
+ else if (e == null) for (i in n) n[i] = fe(n[i], t.name, null);
43
+ return this;
44
+ },
45
+ copy: function() {
46
+ var t = {}, e = this._;
47
+ for (var n in e) t[n] = e[n].slice();
48
+ return new $t(t);
49
+ },
50
+ call: function(t, e) {
51
+ if ((i = arguments.length - 2) > 0) for (var n = new Array(i), r = 0, i, a; r < i; ++r) n[r] = arguments[r + 2];
52
+ if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
53
+ for (a = this._[t], r = 0, i = a.length; r < i; ++r) a[r].value.apply(e, n);
54
+ },
55
+ apply: function(t, e, n) {
56
+ if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
57
+ for (var r = this._[t], i = 0, a = r.length; i < a; ++i) r[i].value.apply(e, n);
58
+ }
59
+ };
60
+ function yn(t, e) {
61
+ for (var n = 0, r = t.length, i; n < r; ++n)
62
+ if ((i = t[n]).name === e)
63
+ return i.value;
64
+ }
65
+ function fe(t, e, n) {
66
+ for (var r = 0, i = t.length; r < i; ++r)
67
+ if (t[r].name === e) {
68
+ t[r] = pn, t = t.slice(0, r).concat(t.slice(r + 1));
69
+ break;
70
+ }
71
+ return n != null && t.push({ name: e, value: n }), t;
72
+ }
73
+ var Vt = "http://www.w3.org/1999/xhtml";
74
+ const he = {
75
+ svg: "http://www.w3.org/2000/svg",
76
+ xhtml: Vt,
77
+ xlink: "http://www.w3.org/1999/xlink",
78
+ xml: "http://www.w3.org/XML/1998/namespace",
79
+ xmlns: "http://www.w3.org/2000/xmlns/"
80
+ };
81
+ function Rt(t) {
82
+ var e = t += "", n = e.indexOf(":");
83
+ return n >= 0 && (e = t.slice(0, n)) !== "xmlns" && (t = t.slice(n + 1)), he.hasOwnProperty(e) ? { space: he[e], local: t } : t;
84
+ }
85
+ function xn(t) {
86
+ return function() {
87
+ var e = this.ownerDocument, n = this.namespaceURI;
88
+ return n === Vt && e.documentElement.namespaceURI === Vt ? e.createElement(t) : e.createElementNS(n, t);
89
+ };
90
+ }
91
+ function _n(t) {
92
+ return function() {
93
+ return this.ownerDocument.createElementNS(t.space, t.local);
94
+ };
95
+ }
96
+ function Pe(t) {
97
+ var e = Rt(t);
98
+ return (e.local ? _n : xn)(e);
99
+ }
100
+ function wn() {
101
+ }
102
+ function ie(t) {
103
+ return t == null ? wn : function() {
104
+ return this.querySelector(t);
105
+ };
106
+ }
107
+ function vn(t) {
108
+ typeof t != "function" && (t = ie(t));
109
+ for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
110
+ for (var a = e[i], o = a.length, c = r[i] = new Array(o), s, l, u = 0; u < o; ++u)
111
+ (s = a[u]) && (l = t.call(s, s.__data__, u, a)) && ("__data__" in s && (l.__data__ = s.__data__), c[u] = l);
112
+ return new F(r, this._parents);
113
+ }
114
+ function bn(t) {
115
+ return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
116
+ }
117
+ function En() {
118
+ return [];
119
+ }
120
+ function De(t) {
121
+ return t == null ? En : function() {
122
+ return this.querySelectorAll(t);
123
+ };
124
+ }
125
+ function Nn(t) {
126
+ return function() {
127
+ return bn(t.apply(this, arguments));
128
+ };
129
+ }
130
+ function $n(t) {
131
+ typeof t == "function" ? t = Nn(t) : t = De(t);
132
+ for (var e = this._groups, n = e.length, r = [], i = [], a = 0; a < n; ++a)
133
+ for (var o = e[a], c = o.length, s, l = 0; l < c; ++l)
134
+ (s = o[l]) && (r.push(t.call(s, s.__data__, l, o)), i.push(s));
135
+ return new F(r, i);
136
+ }
137
+ function ze(t) {
138
+ return function() {
139
+ return this.matches(t);
140
+ };
141
+ }
142
+ function Ye(t) {
143
+ return function(e) {
144
+ return e.matches(t);
145
+ };
146
+ }
147
+ var Sn = Array.prototype.find;
148
+ function kn(t) {
149
+ return function() {
150
+ return Sn.call(this.children, t);
151
+ };
152
+ }
153
+ function An() {
154
+ return this.firstElementChild;
155
+ }
156
+ function Tn(t) {
157
+ return this.select(t == null ? An : kn(typeof t == "function" ? t : Ye(t)));
158
+ }
159
+ var Mn = Array.prototype.filter;
160
+ function Cn() {
161
+ return Array.from(this.children);
162
+ }
163
+ function In(t) {
164
+ return function() {
165
+ return Mn.call(this.children, t);
166
+ };
167
+ }
168
+ function Pn(t) {
169
+ return this.selectAll(t == null ? Cn : In(typeof t == "function" ? t : Ye(t)));
170
+ }
171
+ function Dn(t) {
172
+ typeof t != "function" && (t = ze(t));
173
+ for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
174
+ for (var a = e[i], o = a.length, c = r[i] = [], s, l = 0; l < o; ++l)
175
+ (s = a[l]) && t.call(s, s.__data__, l, a) && c.push(s);
176
+ return new F(r, this._parents);
177
+ }
178
+ function Re(t) {
179
+ return new Array(t.length);
180
+ }
181
+ function zn() {
182
+ return new F(this._enter || this._groups.map(Re), this._parents);
183
+ }
184
+ function Ct(t, e) {
185
+ this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
186
+ }
187
+ Ct.prototype = {
188
+ constructor: Ct,
189
+ appendChild: function(t) {
190
+ return this._parent.insertBefore(t, this._next);
191
+ },
192
+ insertBefore: function(t, e) {
193
+ return this._parent.insertBefore(t, e);
194
+ },
195
+ querySelector: function(t) {
196
+ return this._parent.querySelector(t);
197
+ },
198
+ querySelectorAll: function(t) {
199
+ return this._parent.querySelectorAll(t);
200
+ }
201
+ };
202
+ function Yn(t) {
203
+ return function() {
204
+ return t;
205
+ };
206
+ }
207
+ function Rn(t, e, n, r, i, a) {
208
+ for (var o = 0, c, s = e.length, l = a.length; o < l; ++o)
209
+ (c = e[o]) ? (c.__data__ = a[o], r[o] = c) : n[o] = new Ct(t, a[o]);
210
+ for (; o < s; ++o)
211
+ (c = e[o]) && (i[o] = c);
212
+ }
213
+ function Ln(t, e, n, r, i, a, o) {
214
+ var c, s, l = /* @__PURE__ */ new Map(), u = e.length, f = a.length, h = new Array(u), g;
215
+ for (c = 0; c < u; ++c)
216
+ (s = e[c]) && (h[c] = g = o.call(s, s.__data__, c, e) + "", l.has(g) ? i[c] = s : l.set(g, s));
217
+ for (c = 0; c < f; ++c)
218
+ g = o.call(t, a[c], c, a) + "", (s = l.get(g)) ? (r[c] = s, s.__data__ = a[c], l.delete(g)) : n[c] = new Ct(t, a[c]);
219
+ for (c = 0; c < u; ++c)
220
+ (s = e[c]) && l.get(h[c]) === s && (i[c] = s);
221
+ }
222
+ function Bn(t) {
223
+ return t.__data__;
224
+ }
225
+ function Hn(t, e) {
226
+ if (!arguments.length) return Array.from(this, Bn);
227
+ var n = e ? Ln : Rn, r = this._parents, i = this._groups;
228
+ typeof t != "function" && (t = Yn(t));
229
+ for (var a = i.length, o = new Array(a), c = new Array(a), s = new Array(a), l = 0; l < a; ++l) {
230
+ var u = r[l], f = i[l], h = f.length, g = On(t.call(u, u && u.__data__, l, r)), m = g.length, x = c[l] = new Array(m), y = o[l] = new Array(m), p = s[l] = new Array(h);
231
+ n(u, f, x, y, p, g, e);
232
+ for (var w = 0, b = 0, E, S; w < m; ++w)
233
+ if (E = x[w]) {
234
+ for (w >= b && (b = w + 1); !(S = y[b]) && ++b < m; ) ;
235
+ E._next = S || null;
236
+ }
237
+ }
238
+ return o = new F(o, r), o._enter = c, o._exit = s, o;
239
+ }
240
+ function On(t) {
241
+ return typeof t == "object" && "length" in t ? t : Array.from(t);
242
+ }
243
+ function Fn() {
244
+ return new F(this._exit || this._groups.map(Re), this._parents);
245
+ }
246
+ function Wn(t, e, n) {
247
+ var r = this.enter(), i = this, a = this.exit();
248
+ return typeof t == "function" ? (r = t(r), r && (r = r.selection())) : r = r.append(t + ""), e != null && (i = e(i), i && (i = i.selection())), n == null ? a.remove() : n(a), r && i ? r.merge(i).order() : i;
249
+ }
250
+ function Gn(t) {
251
+ for (var e = t.selection ? t.selection() : t, n = this._groups, r = e._groups, i = n.length, a = r.length, o = Math.min(i, a), c = new Array(i), s = 0; s < o; ++s)
252
+ for (var l = n[s], u = r[s], f = l.length, h = c[s] = new Array(f), g, m = 0; m < f; ++m)
253
+ (g = l[m] || u[m]) && (h[m] = g);
254
+ for (; s < i; ++s)
255
+ c[s] = n[s];
256
+ return new F(c, this._parents);
257
+ }
258
+ function Vn() {
259
+ for (var t = this._groups, e = -1, n = t.length; ++e < n; )
260
+ for (var r = t[e], i = r.length - 1, a = r[i], o; --i >= 0; )
261
+ (o = r[i]) && (a && o.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(o, a), a = o);
262
+ return this;
263
+ }
264
+ function Xn(t) {
265
+ t || (t = qn);
266
+ function e(f, h) {
267
+ return f && h ? t(f.__data__, h.__data__) : !f - !h;
268
+ }
269
+ for (var n = this._groups, r = n.length, i = new Array(r), a = 0; a < r; ++a) {
270
+ for (var o = n[a], c = o.length, s = i[a] = new Array(c), l, u = 0; u < c; ++u)
271
+ (l = o[u]) && (s[u] = l);
272
+ s.sort(e);
273
+ }
274
+ return new F(i, this._parents).order();
275
+ }
276
+ function qn(t, e) {
277
+ return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
278
+ }
279
+ function Un() {
280
+ var t = arguments[0];
281
+ return arguments[0] = this, t.apply(null, arguments), this;
282
+ }
283
+ function Zn() {
284
+ return Array.from(this);
285
+ }
286
+ function Kn() {
287
+ for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
288
+ for (var r = t[e], i = 0, a = r.length; i < a; ++i) {
289
+ var o = r[i];
290
+ if (o) return o;
291
+ }
292
+ return null;
293
+ }
294
+ function Qn() {
295
+ let t = 0;
296
+ for (const e of this) ++t;
297
+ return t;
298
+ }
299
+ function Jn() {
300
+ return !this.node();
301
+ }
302
+ function jn(t) {
303
+ for (var e = this._groups, n = 0, r = e.length; n < r; ++n)
304
+ for (var i = e[n], a = 0, o = i.length, c; a < o; ++a)
305
+ (c = i[a]) && t.call(c, c.__data__, a, i);
306
+ return this;
307
+ }
308
+ function tr(t) {
309
+ return function() {
310
+ this.removeAttribute(t);
311
+ };
312
+ }
313
+ function er(t) {
314
+ return function() {
315
+ this.removeAttributeNS(t.space, t.local);
316
+ };
317
+ }
318
+ function nr(t, e) {
319
+ return function() {
320
+ this.setAttribute(t, e);
321
+ };
322
+ }
323
+ function rr(t, e) {
324
+ return function() {
325
+ this.setAttributeNS(t.space, t.local, e);
326
+ };
327
+ }
328
+ function ir(t, e) {
329
+ return function() {
330
+ var n = e.apply(this, arguments);
331
+ n == null ? this.removeAttribute(t) : this.setAttribute(t, n);
332
+ };
333
+ }
334
+ function or(t, e) {
335
+ return function() {
336
+ var n = e.apply(this, arguments);
337
+ n == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, n);
338
+ };
339
+ }
340
+ function ar(t, e) {
341
+ var n = Rt(t);
342
+ if (arguments.length < 2) {
343
+ var r = this.node();
344
+ return n.local ? r.getAttributeNS(n.space, n.local) : r.getAttribute(n);
345
+ }
346
+ return this.each((e == null ? n.local ? er : tr : typeof e == "function" ? n.local ? or : ir : n.local ? rr : nr)(n, e));
347
+ }
348
+ function Le(t) {
349
+ return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
350
+ }
351
+ function sr(t) {
352
+ return function() {
353
+ this.style.removeProperty(t);
354
+ };
355
+ }
356
+ function cr(t, e, n) {
357
+ return function() {
358
+ this.style.setProperty(t, e, n);
359
+ };
360
+ }
361
+ function lr(t, e, n) {
362
+ return function() {
363
+ var r = e.apply(this, arguments);
364
+ r == null ? this.style.removeProperty(t) : this.style.setProperty(t, r, n);
365
+ };
366
+ }
367
+ function ur(t, e, n) {
368
+ return arguments.length > 1 ? this.each((e == null ? sr : typeof e == "function" ? lr : cr)(t, e, n ?? "")) : lt(this.node(), t);
369
+ }
370
+ function lt(t, e) {
371
+ return t.style.getPropertyValue(e) || Le(t).getComputedStyle(t, null).getPropertyValue(e);
372
+ }
373
+ function fr(t) {
374
+ return function() {
375
+ delete this[t];
376
+ };
377
+ }
378
+ function hr(t, e) {
379
+ return function() {
380
+ this[t] = e;
381
+ };
382
+ }
383
+ function dr(t, e) {
384
+ return function() {
385
+ var n = e.apply(this, arguments);
386
+ n == null ? delete this[t] : this[t] = n;
387
+ };
388
+ }
389
+ function gr(t, e) {
390
+ return arguments.length > 1 ? this.each((e == null ? fr : typeof e == "function" ? dr : hr)(t, e)) : this.node()[t];
391
+ }
392
+ function Be(t) {
393
+ return t.trim().split(/^|\s+/);
394
+ }
395
+ function oe(t) {
396
+ return t.classList || new He(t);
397
+ }
398
+ function He(t) {
399
+ this._node = t, this._names = Be(t.getAttribute("class") || "");
400
+ }
401
+ He.prototype = {
402
+ add: function(t) {
403
+ var e = this._names.indexOf(t);
404
+ e < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" ")));
405
+ },
406
+ remove: function(t) {
407
+ var e = this._names.indexOf(t);
408
+ e >= 0 && (this._names.splice(e, 1), this._node.setAttribute("class", this._names.join(" ")));
409
+ },
410
+ contains: function(t) {
411
+ return this._names.indexOf(t) >= 0;
412
+ }
413
+ };
414
+ function Oe(t, e) {
415
+ for (var n = oe(t), r = -1, i = e.length; ++r < i; ) n.add(e[r]);
416
+ }
417
+ function Fe(t, e) {
418
+ for (var n = oe(t), r = -1, i = e.length; ++r < i; ) n.remove(e[r]);
419
+ }
420
+ function pr(t) {
421
+ return function() {
422
+ Oe(this, t);
423
+ };
424
+ }
425
+ function mr(t) {
426
+ return function() {
427
+ Fe(this, t);
428
+ };
429
+ }
430
+ function yr(t, e) {
431
+ return function() {
432
+ (e.apply(this, arguments) ? Oe : Fe)(this, t);
433
+ };
434
+ }
435
+ function xr(t, e) {
436
+ var n = Be(t + "");
437
+ if (arguments.length < 2) {
438
+ for (var r = oe(this.node()), i = -1, a = n.length; ++i < a; ) if (!r.contains(n[i])) return !1;
439
+ return !0;
440
+ }
441
+ return this.each((typeof e == "function" ? yr : e ? pr : mr)(n, e));
442
+ }
443
+ function _r() {
444
+ this.textContent = "";
445
+ }
446
+ function wr(t) {
447
+ return function() {
448
+ this.textContent = t;
449
+ };
450
+ }
451
+ function vr(t) {
452
+ return function() {
453
+ var e = t.apply(this, arguments);
454
+ this.textContent = e ?? "";
455
+ };
456
+ }
457
+ function br(t) {
458
+ return arguments.length ? this.each(t == null ? _r : (typeof t == "function" ? vr : wr)(t)) : this.node().textContent;
459
+ }
460
+ function Er() {
461
+ this.innerHTML = "";
462
+ }
463
+ function Nr(t) {
464
+ return function() {
465
+ this.innerHTML = t;
466
+ };
467
+ }
468
+ function $r(t) {
469
+ return function() {
470
+ var e = t.apply(this, arguments);
471
+ this.innerHTML = e ?? "";
472
+ };
473
+ }
474
+ function Sr(t) {
475
+ return arguments.length ? this.each(t == null ? Er : (typeof t == "function" ? $r : Nr)(t)) : this.node().innerHTML;
476
+ }
477
+ function kr() {
478
+ this.nextSibling && this.parentNode.appendChild(this);
479
+ }
480
+ function Ar() {
481
+ return this.each(kr);
482
+ }
483
+ function Tr() {
484
+ this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
485
+ }
486
+ function Mr() {
487
+ return this.each(Tr);
488
+ }
489
+ function Cr(t) {
490
+ var e = typeof t == "function" ? t : Pe(t);
491
+ return this.select(function() {
492
+ return this.appendChild(e.apply(this, arguments));
493
+ });
494
+ }
495
+ function Ir() {
496
+ return null;
497
+ }
498
+ function Pr(t, e) {
499
+ var n = typeof t == "function" ? t : Pe(t), r = e == null ? Ir : typeof e == "function" ? e : ie(e);
500
+ return this.select(function() {
501
+ return this.insertBefore(n.apply(this, arguments), r.apply(this, arguments) || null);
502
+ });
503
+ }
504
+ function Dr() {
505
+ var t = this.parentNode;
506
+ t && t.removeChild(this);
507
+ }
508
+ function zr() {
509
+ return this.each(Dr);
510
+ }
511
+ function Yr() {
512
+ var t = this.cloneNode(!1), e = this.parentNode;
513
+ return e ? e.insertBefore(t, this.nextSibling) : t;
514
+ }
515
+ function Rr() {
516
+ var t = this.cloneNode(!0), e = this.parentNode;
517
+ return e ? e.insertBefore(t, this.nextSibling) : t;
518
+ }
519
+ function Lr(t) {
520
+ return this.select(t ? Rr : Yr);
521
+ }
522
+ function Br(t) {
523
+ return arguments.length ? this.property("__data__", t) : this.node().__data__;
524
+ }
525
+ function Hr(t) {
526
+ return function(e) {
527
+ t.call(this, e, this.__data__);
528
+ };
529
+ }
530
+ function Or(t) {
531
+ return t.trim().split(/^|\s+/).map(function(e) {
532
+ var n = "", r = e.indexOf(".");
533
+ return r >= 0 && (n = e.slice(r + 1), e = e.slice(0, r)), { type: e, name: n };
534
+ });
535
+ }
536
+ function Fr(t) {
537
+ return function() {
538
+ var e = this.__on;
539
+ if (e) {
540
+ for (var n = 0, r = -1, i = e.length, a; n < i; ++n)
541
+ a = e[n], (!t.type || a.type === t.type) && a.name === t.name ? this.removeEventListener(a.type, a.listener, a.options) : e[++r] = a;
542
+ ++r ? e.length = r : delete this.__on;
543
+ }
544
+ };
545
+ }
546
+ function Wr(t, e, n) {
547
+ return function() {
548
+ var r = this.__on, i, a = Hr(e);
549
+ if (r) {
550
+ for (var o = 0, c = r.length; o < c; ++o)
551
+ if ((i = r[o]).type === t.type && i.name === t.name) {
552
+ this.removeEventListener(i.type, i.listener, i.options), this.addEventListener(i.type, i.listener = a, i.options = n), i.value = e;
553
+ return;
554
+ }
555
+ }
556
+ this.addEventListener(t.type, a, n), i = { type: t.type, name: t.name, value: e, listener: a, options: n }, r ? r.push(i) : this.__on = [i];
557
+ };
558
+ }
559
+ function Gr(t, e, n) {
560
+ var r = Or(t + ""), i, a = r.length, o;
561
+ if (arguments.length < 2) {
562
+ var c = this.node().__on;
563
+ if (c) {
564
+ for (var s = 0, l = c.length, u; s < l; ++s)
565
+ for (i = 0, u = c[s]; i < a; ++i)
566
+ if ((o = r[i]).type === u.type && o.name === u.name)
567
+ return u.value;
568
+ }
569
+ return;
570
+ }
571
+ for (c = e ? Wr : Fr, i = 0; i < a; ++i) this.each(c(r[i], e, n));
572
+ return this;
573
+ }
574
+ function We(t, e, n) {
575
+ var r = Le(t), i = r.CustomEvent;
576
+ typeof i == "function" ? i = new i(e, n) : (i = r.document.createEvent("Event"), n ? (i.initEvent(e, n.bubbles, n.cancelable), i.detail = n.detail) : i.initEvent(e, !1, !1)), t.dispatchEvent(i);
577
+ }
578
+ function Vr(t, e) {
579
+ return function() {
580
+ return We(this, t, e);
581
+ };
582
+ }
583
+ function Xr(t, e) {
584
+ return function() {
585
+ return We(this, t, e.apply(this, arguments));
586
+ };
587
+ }
588
+ function qr(t, e) {
589
+ return this.each((typeof e == "function" ? Xr : Vr)(t, e));
590
+ }
591
+ function* Ur() {
592
+ for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
593
+ for (var r = t[e], i = 0, a = r.length, o; i < a; ++i)
594
+ (o = r[i]) && (yield o);
595
+ }
596
+ var Ge = [null];
597
+ function F(t, e) {
598
+ this._groups = t, this._parents = e;
599
+ }
600
+ function _t() {
601
+ return new F([[document.documentElement]], Ge);
602
+ }
603
+ function Zr() {
604
+ return this;
605
+ }
606
+ F.prototype = _t.prototype = {
607
+ constructor: F,
608
+ select: vn,
609
+ selectAll: $n,
610
+ selectChild: Tn,
611
+ selectChildren: Pn,
612
+ filter: Dn,
613
+ data: Hn,
614
+ enter: zn,
615
+ exit: Fn,
616
+ join: Wn,
617
+ merge: Gn,
618
+ selection: Zr,
619
+ order: Vn,
620
+ sort: Xn,
621
+ call: Un,
622
+ nodes: Zn,
623
+ node: Kn,
624
+ size: Qn,
625
+ empty: Jn,
626
+ each: jn,
627
+ attr: ar,
628
+ style: ur,
629
+ property: gr,
630
+ classed: xr,
631
+ text: br,
632
+ html: Sr,
633
+ raise: Ar,
634
+ lower: Mr,
635
+ append: Cr,
636
+ insert: Pr,
637
+ remove: zr,
638
+ clone: Lr,
639
+ datum: Br,
640
+ on: Gr,
641
+ dispatch: qr,
642
+ [Symbol.iterator]: Ur
643
+ };
644
+ function z(t) {
645
+ return typeof t == "string" ? new F([[document.querySelector(t)]], [document.documentElement]) : new F([[t]], Ge);
646
+ }
647
+ function Kr(t) {
648
+ let e;
649
+ for (; e = t.sourceEvent; ) t = e;
650
+ return t;
651
+ }
652
+ function nt(t, e) {
653
+ if (t = Kr(t), e === void 0 && (e = t.currentTarget), e) {
654
+ var n = e.ownerSVGElement || e;
655
+ if (n.createSVGPoint) {
656
+ var r = n.createSVGPoint();
657
+ return r.x = t.clientX, r.y = t.clientY, r = r.matrixTransform(e.getScreenCTM().inverse()), [r.x, r.y];
658
+ }
659
+ if (e.getBoundingClientRect) {
660
+ var i = e.getBoundingClientRect();
661
+ return [t.clientX - i.left - e.clientLeft, t.clientY - i.top - e.clientTop];
662
+ }
663
+ }
664
+ return [t.pageX, t.pageY];
665
+ }
666
+ const Xt = { capture: !0, passive: !1 };
667
+ function qt(t) {
668
+ t.preventDefault(), t.stopImmediatePropagation();
669
+ }
670
+ function Qr(t) {
671
+ var e = t.document.documentElement, n = z(t).on("dragstart.drag", qt, Xt);
672
+ "onselectstart" in e ? n.on("selectstart.drag", qt, Xt) : (e.__noselect = e.style.MozUserSelect, e.style.MozUserSelect = "none");
673
+ }
674
+ function Jr(t, e) {
675
+ var n = t.document.documentElement, r = z(t).on("dragstart.drag", null);
676
+ e && (r.on("click.drag", qt, Xt), setTimeout(function() {
677
+ r.on("click.drag", null);
678
+ }, 0)), "onselectstart" in n ? r.on("selectstart.drag", null) : (n.style.MozUserSelect = n.__noselect, delete n.__noselect);
679
+ }
680
+ function ae(t, e, n) {
681
+ t.prototype = e.prototype = n, n.constructor = t;
682
+ }
683
+ function Ve(t, e) {
684
+ var n = Object.create(t.prototype);
685
+ for (var r in e) n[r] = e[r];
686
+ return n;
687
+ }
688
+ function wt() {
689
+ }
690
+ var pt = 0.7, It = 1 / pt, ct = "\\s*([+-]?\\d+)\\s*", mt = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", q = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", jr = /^#([0-9a-f]{3,8})$/, ti = new RegExp(`^rgb\\(${ct},${ct},${ct}\\)$`), ei = new RegExp(`^rgb\\(${q},${q},${q}\\)$`), ni = new RegExp(`^rgba\\(${ct},${ct},${ct},${mt}\\)$`), ri = new RegExp(`^rgba\\(${q},${q},${q},${mt}\\)$`), ii = new RegExp(`^hsl\\(${mt},${q},${q}\\)$`), oi = new RegExp(`^hsla\\(${mt},${q},${q},${mt}\\)$`), de = {
691
+ aliceblue: 15792383,
692
+ antiquewhite: 16444375,
693
+ aqua: 65535,
694
+ aquamarine: 8388564,
695
+ azure: 15794175,
696
+ beige: 16119260,
697
+ bisque: 16770244,
698
+ black: 0,
699
+ blanchedalmond: 16772045,
700
+ blue: 255,
701
+ blueviolet: 9055202,
702
+ brown: 10824234,
703
+ burlywood: 14596231,
704
+ cadetblue: 6266528,
705
+ chartreuse: 8388352,
706
+ chocolate: 13789470,
707
+ coral: 16744272,
708
+ cornflowerblue: 6591981,
709
+ cornsilk: 16775388,
710
+ crimson: 14423100,
711
+ cyan: 65535,
712
+ darkblue: 139,
713
+ darkcyan: 35723,
714
+ darkgoldenrod: 12092939,
715
+ darkgray: 11119017,
716
+ darkgreen: 25600,
717
+ darkgrey: 11119017,
718
+ darkkhaki: 12433259,
719
+ darkmagenta: 9109643,
720
+ darkolivegreen: 5597999,
721
+ darkorange: 16747520,
722
+ darkorchid: 10040012,
723
+ darkred: 9109504,
724
+ darksalmon: 15308410,
725
+ darkseagreen: 9419919,
726
+ darkslateblue: 4734347,
727
+ darkslategray: 3100495,
728
+ darkslategrey: 3100495,
729
+ darkturquoise: 52945,
730
+ darkviolet: 9699539,
731
+ deeppink: 16716947,
732
+ deepskyblue: 49151,
733
+ dimgray: 6908265,
734
+ dimgrey: 6908265,
735
+ dodgerblue: 2003199,
736
+ firebrick: 11674146,
737
+ floralwhite: 16775920,
738
+ forestgreen: 2263842,
739
+ fuchsia: 16711935,
740
+ gainsboro: 14474460,
741
+ ghostwhite: 16316671,
742
+ gold: 16766720,
743
+ goldenrod: 14329120,
744
+ gray: 8421504,
745
+ green: 32768,
746
+ greenyellow: 11403055,
747
+ grey: 8421504,
748
+ honeydew: 15794160,
749
+ hotpink: 16738740,
750
+ indianred: 13458524,
751
+ indigo: 4915330,
752
+ ivory: 16777200,
753
+ khaki: 15787660,
754
+ lavender: 15132410,
755
+ lavenderblush: 16773365,
756
+ lawngreen: 8190976,
757
+ lemonchiffon: 16775885,
758
+ lightblue: 11393254,
759
+ lightcoral: 15761536,
760
+ lightcyan: 14745599,
761
+ lightgoldenrodyellow: 16448210,
762
+ lightgray: 13882323,
763
+ lightgreen: 9498256,
764
+ lightgrey: 13882323,
765
+ lightpink: 16758465,
766
+ lightsalmon: 16752762,
767
+ lightseagreen: 2142890,
768
+ lightskyblue: 8900346,
769
+ lightslategray: 7833753,
770
+ lightslategrey: 7833753,
771
+ lightsteelblue: 11584734,
772
+ lightyellow: 16777184,
773
+ lime: 65280,
774
+ limegreen: 3329330,
775
+ linen: 16445670,
776
+ magenta: 16711935,
777
+ maroon: 8388608,
778
+ mediumaquamarine: 6737322,
779
+ mediumblue: 205,
780
+ mediumorchid: 12211667,
781
+ mediumpurple: 9662683,
782
+ mediumseagreen: 3978097,
783
+ mediumslateblue: 8087790,
784
+ mediumspringgreen: 64154,
785
+ mediumturquoise: 4772300,
786
+ mediumvioletred: 13047173,
787
+ midnightblue: 1644912,
788
+ mintcream: 16121850,
789
+ mistyrose: 16770273,
790
+ moccasin: 16770229,
791
+ navajowhite: 16768685,
792
+ navy: 128,
793
+ oldlace: 16643558,
794
+ olive: 8421376,
795
+ olivedrab: 7048739,
796
+ orange: 16753920,
797
+ orangered: 16729344,
798
+ orchid: 14315734,
799
+ palegoldenrod: 15657130,
800
+ palegreen: 10025880,
801
+ paleturquoise: 11529966,
802
+ palevioletred: 14381203,
803
+ papayawhip: 16773077,
804
+ peachpuff: 16767673,
805
+ peru: 13468991,
806
+ pink: 16761035,
807
+ plum: 14524637,
808
+ powderblue: 11591910,
809
+ purple: 8388736,
810
+ rebeccapurple: 6697881,
811
+ red: 16711680,
812
+ rosybrown: 12357519,
813
+ royalblue: 4286945,
814
+ saddlebrown: 9127187,
815
+ salmon: 16416882,
816
+ sandybrown: 16032864,
817
+ seagreen: 3050327,
818
+ seashell: 16774638,
819
+ sienna: 10506797,
820
+ silver: 12632256,
821
+ skyblue: 8900331,
822
+ slateblue: 6970061,
823
+ slategray: 7372944,
824
+ slategrey: 7372944,
825
+ snow: 16775930,
826
+ springgreen: 65407,
827
+ steelblue: 4620980,
828
+ tan: 13808780,
829
+ teal: 32896,
830
+ thistle: 14204888,
831
+ tomato: 16737095,
832
+ turquoise: 4251856,
833
+ violet: 15631086,
834
+ wheat: 16113331,
835
+ white: 16777215,
836
+ whitesmoke: 16119285,
837
+ yellow: 16776960,
838
+ yellowgreen: 10145074
839
+ };
840
+ ae(wt, yt, {
841
+ copy(t) {
842
+ return Object.assign(new this.constructor(), this, t);
843
+ },
844
+ displayable() {
845
+ return this.rgb().displayable();
846
+ },
847
+ hex: ge,
848
+ // Deprecated! Use color.formatHex.
849
+ formatHex: ge,
850
+ formatHex8: ai,
851
+ formatHsl: si,
852
+ formatRgb: pe,
853
+ toString: pe
854
+ });
855
+ function ge() {
856
+ return this.rgb().formatHex();
857
+ }
858
+ function ai() {
859
+ return this.rgb().formatHex8();
860
+ }
861
+ function si() {
862
+ return Xe(this).formatHsl();
863
+ }
864
+ function pe() {
865
+ return this.rgb().formatRgb();
866
+ }
867
+ function yt(t) {
868
+ var e, n;
869
+ return t = (t + "").trim().toLowerCase(), (e = jr.exec(t)) ? (n = e[1].length, e = parseInt(e[1], 16), n === 6 ? me(e) : n === 3 ? new H(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : n === 8 ? vt(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : n === 4 ? vt(e >> 12 & 15 | e >> 8 & 240, e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, ((e & 15) << 4 | e & 15) / 255) : null) : (e = ti.exec(t)) ? new H(e[1], e[2], e[3], 1) : (e = ei.exec(t)) ? new H(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = ni.exec(t)) ? vt(e[1], e[2], e[3], e[4]) : (e = ri.exec(t)) ? vt(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = ii.exec(t)) ? _e(e[1], e[2] / 100, e[3] / 100, 1) : (e = oi.exec(t)) ? _e(e[1], e[2] / 100, e[3] / 100, e[4]) : de.hasOwnProperty(t) ? me(de[t]) : t === "transparent" ? new H(NaN, NaN, NaN, 0) : null;
870
+ }
871
+ function me(t) {
872
+ return new H(t >> 16 & 255, t >> 8 & 255, t & 255, 1);
873
+ }
874
+ function vt(t, e, n, r) {
875
+ return r <= 0 && (t = e = n = NaN), new H(t, e, n, r);
876
+ }
877
+ function ci(t) {
878
+ return t instanceof wt || (t = yt(t)), t ? (t = t.rgb(), new H(t.r, t.g, t.b, t.opacity)) : new H();
879
+ }
880
+ function Ut(t, e, n, r) {
881
+ return arguments.length === 1 ? ci(t) : new H(t, e, n, r ?? 1);
882
+ }
883
+ function H(t, e, n, r) {
884
+ this.r = +t, this.g = +e, this.b = +n, this.opacity = +r;
885
+ }
886
+ ae(H, Ut, Ve(wt, {
887
+ brighter(t) {
888
+ return t = t == null ? It : Math.pow(It, t), new H(this.r * t, this.g * t, this.b * t, this.opacity);
889
+ },
890
+ darker(t) {
891
+ return t = t == null ? pt : Math.pow(pt, t), new H(this.r * t, this.g * t, this.b * t, this.opacity);
892
+ },
893
+ rgb() {
894
+ return this;
895
+ },
896
+ clamp() {
897
+ return new H(ot(this.r), ot(this.g), ot(this.b), Pt(this.opacity));
898
+ },
899
+ displayable() {
900
+ return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
901
+ },
902
+ hex: ye,
903
+ // Deprecated! Use color.formatHex.
904
+ formatHex: ye,
905
+ formatHex8: li,
906
+ formatRgb: xe,
907
+ toString: xe
908
+ }));
909
+ function ye() {
910
+ return `#${it(this.r)}${it(this.g)}${it(this.b)}`;
911
+ }
912
+ function li() {
913
+ return `#${it(this.r)}${it(this.g)}${it(this.b)}${it((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
914
+ }
915
+ function xe() {
916
+ const t = Pt(this.opacity);
917
+ return `${t === 1 ? "rgb(" : "rgba("}${ot(this.r)}, ${ot(this.g)}, ${ot(this.b)}${t === 1 ? ")" : `, ${t})`}`;
918
+ }
919
+ function Pt(t) {
920
+ return isNaN(t) ? 1 : Math.max(0, Math.min(1, t));
921
+ }
922
+ function ot(t) {
923
+ return Math.max(0, Math.min(255, Math.round(t) || 0));
924
+ }
925
+ function it(t) {
926
+ return t = ot(t), (t < 16 ? "0" : "") + t.toString(16);
927
+ }
928
+ function _e(t, e, n, r) {
929
+ return r <= 0 ? t = e = n = NaN : n <= 0 || n >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new V(t, e, n, r);
930
+ }
931
+ function Xe(t) {
932
+ if (t instanceof V) return new V(t.h, t.s, t.l, t.opacity);
933
+ if (t instanceof wt || (t = yt(t)), !t) return new V();
934
+ if (t instanceof V) return t;
935
+ t = t.rgb();
936
+ var e = t.r / 255, n = t.g / 255, r = t.b / 255, i = Math.min(e, n, r), a = Math.max(e, n, r), o = NaN, c = a - i, s = (a + i) / 2;
937
+ return c ? (e === a ? o = (n - r) / c + (n < r) * 6 : n === a ? o = (r - e) / c + 2 : o = (e - n) / c + 4, c /= s < 0.5 ? a + i : 2 - a - i, o *= 60) : c = s > 0 && s < 1 ? 0 : o, new V(o, c, s, t.opacity);
938
+ }
939
+ function ui(t, e, n, r) {
940
+ return arguments.length === 1 ? Xe(t) : new V(t, e, n, r ?? 1);
941
+ }
942
+ function V(t, e, n, r) {
943
+ this.h = +t, this.s = +e, this.l = +n, this.opacity = +r;
944
+ }
945
+ ae(V, ui, Ve(wt, {
946
+ brighter(t) {
947
+ return t = t == null ? It : Math.pow(It, t), new V(this.h, this.s, this.l * t, this.opacity);
948
+ },
949
+ darker(t) {
950
+ return t = t == null ? pt : Math.pow(pt, t), new V(this.h, this.s, this.l * t, this.opacity);
951
+ },
952
+ rgb() {
953
+ var t = this.h % 360 + (this.h < 0) * 360, e = isNaN(t) || isNaN(this.s) ? 0 : this.s, n = this.l, r = n + (n < 0.5 ? n : 1 - n) * e, i = 2 * n - r;
954
+ return new H(
955
+ Ft(t >= 240 ? t - 240 : t + 120, i, r),
956
+ Ft(t, i, r),
957
+ Ft(t < 120 ? t + 240 : t - 120, i, r),
958
+ this.opacity
959
+ );
960
+ },
961
+ clamp() {
962
+ return new V(we(this.h), bt(this.s), bt(this.l), Pt(this.opacity));
963
+ },
964
+ displayable() {
965
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
966
+ },
967
+ formatHsl() {
968
+ const t = Pt(this.opacity);
969
+ return `${t === 1 ? "hsl(" : "hsla("}${we(this.h)}, ${bt(this.s) * 100}%, ${bt(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`;
970
+ }
971
+ }));
972
+ function we(t) {
973
+ return t = (t || 0) % 360, t < 0 ? t + 360 : t;
974
+ }
975
+ function bt(t) {
976
+ return Math.max(0, Math.min(1, t || 0));
977
+ }
978
+ function Ft(t, e, n) {
979
+ return (t < 60 ? e + (n - e) * t / 60 : t < 180 ? n : t < 240 ? e + (n - e) * (240 - t) / 60 : e) * 255;
980
+ }
981
+ const qe = (t) => () => t;
982
+ function fi(t, e) {
983
+ return function(n) {
984
+ return t + n * e;
985
+ };
986
+ }
987
+ function hi(t, e, n) {
988
+ return t = Math.pow(t, n), e = Math.pow(e, n) - t, n = 1 / n, function(r) {
989
+ return Math.pow(t + r * e, n);
990
+ };
991
+ }
992
+ function di(t) {
993
+ return (t = +t) == 1 ? Ue : function(e, n) {
994
+ return n - e ? hi(e, n, t) : qe(isNaN(e) ? n : e);
995
+ };
996
+ }
997
+ function Ue(t, e) {
998
+ var n = e - t;
999
+ return n ? fi(t, n) : qe(isNaN(t) ? e : t);
1000
+ }
1001
+ const ve = (function t(e) {
1002
+ var n = di(e);
1003
+ function r(i, a) {
1004
+ var o = n((i = Ut(i)).r, (a = Ut(a)).r), c = n(i.g, a.g), s = n(i.b, a.b), l = Ue(i.opacity, a.opacity);
1005
+ return function(u) {
1006
+ return i.r = o(u), i.g = c(u), i.b = s(u), i.opacity = l(u), i + "";
1007
+ };
1008
+ }
1009
+ return r.gamma = t, r;
1010
+ })(1);
1011
+ function tt(t, e) {
1012
+ return t = +t, e = +e, function(n) {
1013
+ return t * (1 - n) + e * n;
1014
+ };
1015
+ }
1016
+ var Zt = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, Wt = new RegExp(Zt.source, "g");
1017
+ function gi(t) {
1018
+ return function() {
1019
+ return t;
1020
+ };
1021
+ }
1022
+ function pi(t) {
1023
+ return function(e) {
1024
+ return t(e) + "";
1025
+ };
1026
+ }
1027
+ function mi(t, e) {
1028
+ var n = Zt.lastIndex = Wt.lastIndex = 0, r, i, a, o = -1, c = [], s = [];
1029
+ for (t = t + "", e = e + ""; (r = Zt.exec(t)) && (i = Wt.exec(e)); )
1030
+ (a = i.index) > n && (a = e.slice(n, a), c[o] ? c[o] += a : c[++o] = a), (r = r[0]) === (i = i[0]) ? c[o] ? c[o] += i : c[++o] = i : (c[++o] = null, s.push({ i: o, x: tt(r, i) })), n = Wt.lastIndex;
1031
+ return n < e.length && (a = e.slice(n), c[o] ? c[o] += a : c[++o] = a), c.length < 2 ? s[0] ? pi(s[0].x) : gi(e) : (e = s.length, function(l) {
1032
+ for (var u = 0, f; u < e; ++u) c[(f = s[u]).i] = f.x(l);
1033
+ return c.join("");
1034
+ });
1035
+ }
1036
+ var be = 180 / Math.PI, Kt = {
1037
+ translateX: 0,
1038
+ translateY: 0,
1039
+ rotate: 0,
1040
+ skewX: 0,
1041
+ scaleX: 1,
1042
+ scaleY: 1
1043
+ };
1044
+ function Ze(t, e, n, r, i, a) {
1045
+ var o, c, s;
1046
+ return (o = Math.sqrt(t * t + e * e)) && (t /= o, e /= o), (s = t * n + e * r) && (n -= t * s, r -= e * s), (c = Math.sqrt(n * n + r * r)) && (n /= c, r /= c, s /= c), t * r < e * n && (t = -t, e = -e, s = -s, o = -o), {
1047
+ translateX: i,
1048
+ translateY: a,
1049
+ rotate: Math.atan2(e, t) * be,
1050
+ skewX: Math.atan(s) * be,
1051
+ scaleX: o,
1052
+ scaleY: c
1053
+ };
1054
+ }
1055
+ var Et;
1056
+ function yi(t) {
1057
+ const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + "");
1058
+ return e.isIdentity ? Kt : Ze(e.a, e.b, e.c, e.d, e.e, e.f);
1059
+ }
1060
+ function xi(t) {
1061
+ return t == null || (Et || (Et = document.createElementNS("http://www.w3.org/2000/svg", "g")), Et.setAttribute("transform", t), !(t = Et.transform.baseVal.consolidate())) ? Kt : (t = t.matrix, Ze(t.a, t.b, t.c, t.d, t.e, t.f));
1062
+ }
1063
+ function Ke(t, e, n, r) {
1064
+ function i(l) {
1065
+ return l.length ? l.pop() + " " : "";
1066
+ }
1067
+ function a(l, u, f, h, g, m) {
1068
+ if (l !== f || u !== h) {
1069
+ var x = g.push("translate(", null, e, null, n);
1070
+ m.push({ i: x - 4, x: tt(l, f) }, { i: x - 2, x: tt(u, h) });
1071
+ } else (f || h) && g.push("translate(" + f + e + h + n);
1072
+ }
1073
+ function o(l, u, f, h) {
1074
+ l !== u ? (l - u > 180 ? u += 360 : u - l > 180 && (l += 360), h.push({ i: f.push(i(f) + "rotate(", null, r) - 2, x: tt(l, u) })) : u && f.push(i(f) + "rotate(" + u + r);
1075
+ }
1076
+ function c(l, u, f, h) {
1077
+ l !== u ? h.push({ i: f.push(i(f) + "skewX(", null, r) - 2, x: tt(l, u) }) : u && f.push(i(f) + "skewX(" + u + r);
1078
+ }
1079
+ function s(l, u, f, h, g, m) {
1080
+ if (l !== f || u !== h) {
1081
+ var x = g.push(i(g) + "scale(", null, ",", null, ")");
1082
+ m.push({ i: x - 4, x: tt(l, f) }, { i: x - 2, x: tt(u, h) });
1083
+ } else (f !== 1 || h !== 1) && g.push(i(g) + "scale(" + f + "," + h + ")");
1084
+ }
1085
+ return function(l, u) {
1086
+ var f = [], h = [];
1087
+ return l = t(l), u = t(u), a(l.translateX, l.translateY, u.translateX, u.translateY, f, h), o(l.rotate, u.rotate, f, h), c(l.skewX, u.skewX, f, h), s(l.scaleX, l.scaleY, u.scaleX, u.scaleY, f, h), l = u = null, function(g) {
1088
+ for (var m = -1, x = h.length, y; ++m < x; ) f[(y = h[m]).i] = y.x(g);
1089
+ return f.join("");
1090
+ };
1091
+ };
1092
+ }
1093
+ var _i = Ke(yi, "px, ", "px)", "deg)"), wi = Ke(xi, ", ", ")", ")"), vi = 1e-12;
1094
+ function Ee(t) {
1095
+ return ((t = Math.exp(t)) + 1 / t) / 2;
1096
+ }
1097
+ function bi(t) {
1098
+ return ((t = Math.exp(t)) - 1 / t) / 2;
1099
+ }
1100
+ function Ei(t) {
1101
+ return ((t = Math.exp(2 * t)) - 1) / (t + 1);
1102
+ }
1103
+ const Ni = (function t(e, n, r) {
1104
+ function i(a, o) {
1105
+ var c = a[0], s = a[1], l = a[2], u = o[0], f = o[1], h = o[2], g = u - c, m = f - s, x = g * g + m * m, y, p;
1106
+ if (x < vi)
1107
+ p = Math.log(h / l) / e, y = function(A) {
1108
+ return [
1109
+ c + A * g,
1110
+ s + A * m,
1111
+ l * Math.exp(e * A * p)
1112
+ ];
1113
+ };
1114
+ else {
1115
+ var w = Math.sqrt(x), b = (h * h - l * l + r * x) / (2 * l * n * w), E = (h * h - l * l - r * x) / (2 * h * n * w), S = Math.log(Math.sqrt(b * b + 1) - b), N = Math.log(Math.sqrt(E * E + 1) - E);
1116
+ p = (N - S) / e, y = function(A) {
1117
+ var P = A * p, D = Ee(S), C = l / (n * w) * (D * Ei(e * P + S) - bi(S));
1118
+ return [
1119
+ c + C * g,
1120
+ s + C * m,
1121
+ l * D / Ee(e * P + S)
1122
+ ];
1123
+ };
1124
+ }
1125
+ return y.duration = p * 1e3 * e / Math.SQRT2, y;
1126
+ }
1127
+ return i.rho = function(a) {
1128
+ var o = Math.max(1e-3, +a), c = o * o, s = c * c;
1129
+ return t(o, c, s);
1130
+ }, i;
1131
+ })(Math.SQRT2, 2, 4);
1132
+ var ut = 0, dt = 0, ft = 0, Qe = 1e3, Dt, gt, zt = 0, at = 0, Lt = 0, xt = typeof performance == "object" && performance.now ? performance : Date, Je = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) {
1133
+ setTimeout(t, 17);
1134
+ };
1135
+ function se() {
1136
+ return at || (Je($i), at = xt.now() + Lt);
1137
+ }
1138
+ function $i() {
1139
+ at = 0;
1140
+ }
1141
+ function Yt() {
1142
+ this._call = this._time = this._next = null;
1143
+ }
1144
+ Yt.prototype = je.prototype = {
1145
+ constructor: Yt,
1146
+ restart: function(t, e, n) {
1147
+ if (typeof t != "function") throw new TypeError("callback is not a function");
1148
+ n = (n == null ? se() : +n) + (e == null ? 0 : +e), !this._next && gt !== this && (gt ? gt._next = this : Dt = this, gt = this), this._call = t, this._time = n, Qt();
1149
+ },
1150
+ stop: function() {
1151
+ this._call && (this._call = null, this._time = 1 / 0, Qt());
1152
+ }
1153
+ };
1154
+ function je(t, e, n) {
1155
+ var r = new Yt();
1156
+ return r.restart(t, e, n), r;
1157
+ }
1158
+ function Si() {
1159
+ se(), ++ut;
1160
+ for (var t = Dt, e; t; )
1161
+ (e = at - t._time) >= 0 && t._call.call(void 0, e), t = t._next;
1162
+ --ut;
1163
+ }
1164
+ function Ne() {
1165
+ at = (zt = xt.now()) + Lt, ut = dt = 0;
1166
+ try {
1167
+ Si();
1168
+ } finally {
1169
+ ut = 0, Ai(), at = 0;
1170
+ }
1171
+ }
1172
+ function ki() {
1173
+ var t = xt.now(), e = t - zt;
1174
+ e > Qe && (Lt -= e, zt = t);
1175
+ }
1176
+ function Ai() {
1177
+ for (var t, e = Dt, n, r = 1 / 0; e; )
1178
+ e._call ? (r > e._time && (r = e._time), t = e, e = e._next) : (n = e._next, e._next = null, e = t ? t._next = n : Dt = n);
1179
+ gt = t, Qt(r);
1180
+ }
1181
+ function Qt(t) {
1182
+ if (!ut) {
1183
+ dt && (dt = clearTimeout(dt));
1184
+ var e = t - at;
1185
+ e > 24 ? (t < 1 / 0 && (dt = setTimeout(Ne, t - xt.now() - Lt)), ft && (ft = clearInterval(ft))) : (ft || (zt = xt.now(), ft = setInterval(ki, Qe)), ut = 1, Je(Ne));
1186
+ }
1187
+ }
1188
+ function $e(t, e, n) {
1189
+ var r = new Yt();
1190
+ return e = e == null ? 0 : +e, r.restart((i) => {
1191
+ r.stop(), t(i + e);
1192
+ }, e, n), r;
1193
+ }
1194
+ var Ti = re("start", "end", "cancel", "interrupt"), Mi = [], tn = 0, Se = 1, Jt = 2, St = 3, ke = 4, jt = 5, kt = 6;
1195
+ function Bt(t, e, n, r, i, a) {
1196
+ var o = t.__transition;
1197
+ if (!o) t.__transition = {};
1198
+ else if (n in o) return;
1199
+ Ci(t, n, {
1200
+ name: e,
1201
+ index: r,
1202
+ // For context during callback.
1203
+ group: i,
1204
+ // For context during callback.
1205
+ on: Ti,
1206
+ tween: Mi,
1207
+ time: a.time,
1208
+ delay: a.delay,
1209
+ duration: a.duration,
1210
+ ease: a.ease,
1211
+ timer: null,
1212
+ state: tn
1213
+ });
1214
+ }
1215
+ function ce(t, e) {
1216
+ var n = X(t, e);
1217
+ if (n.state > tn) throw new Error("too late; already scheduled");
1218
+ return n;
1219
+ }
1220
+ function U(t, e) {
1221
+ var n = X(t, e);
1222
+ if (n.state > St) throw new Error("too late; already running");
1223
+ return n;
1224
+ }
1225
+ function X(t, e) {
1226
+ var n = t.__transition;
1227
+ if (!n || !(n = n[e])) throw new Error("transition not found");
1228
+ return n;
1229
+ }
1230
+ function Ci(t, e, n) {
1231
+ var r = t.__transition, i;
1232
+ r[e] = n, n.timer = je(a, 0, n.time);
1233
+ function a(l) {
1234
+ n.state = Se, n.timer.restart(o, n.delay, n.time), n.delay <= l && o(l - n.delay);
1235
+ }
1236
+ function o(l) {
1237
+ var u, f, h, g;
1238
+ if (n.state !== Se) return s();
1239
+ for (u in r)
1240
+ if (g = r[u], g.name === n.name) {
1241
+ if (g.state === St) return $e(o);
1242
+ g.state === ke ? (g.state = kt, g.timer.stop(), g.on.call("interrupt", t, t.__data__, g.index, g.group), delete r[u]) : +u < e && (g.state = kt, g.timer.stop(), g.on.call("cancel", t, t.__data__, g.index, g.group), delete r[u]);
1243
+ }
1244
+ if ($e(function() {
1245
+ n.state === St && (n.state = ke, n.timer.restart(c, n.delay, n.time), c(l));
1246
+ }), n.state = Jt, n.on.call("start", t, t.__data__, n.index, n.group), n.state === Jt) {
1247
+ for (n.state = St, i = new Array(h = n.tween.length), u = 0, f = -1; u < h; ++u)
1248
+ (g = n.tween[u].value.call(t, t.__data__, n.index, n.group)) && (i[++f] = g);
1249
+ i.length = f + 1;
1250
+ }
1251
+ }
1252
+ function c(l) {
1253
+ for (var u = l < n.duration ? n.ease.call(null, l / n.duration) : (n.timer.restart(s), n.state = jt, 1), f = -1, h = i.length; ++f < h; )
1254
+ i[f].call(t, u);
1255
+ n.state === jt && (n.on.call("end", t, t.__data__, n.index, n.group), s());
1256
+ }
1257
+ function s() {
1258
+ n.state = kt, n.timer.stop(), delete r[e];
1259
+ for (var l in r) return;
1260
+ delete t.__transition;
1261
+ }
1262
+ }
1263
+ function At(t, e) {
1264
+ var n = t.__transition, r, i, a = !0, o;
1265
+ if (n) {
1266
+ e = e == null ? null : e + "";
1267
+ for (o in n) {
1268
+ if ((r = n[o]).name !== e) {
1269
+ a = !1;
1270
+ continue;
1271
+ }
1272
+ i = r.state > Jt && r.state < jt, r.state = kt, r.timer.stop(), r.on.call(i ? "interrupt" : "cancel", t, t.__data__, r.index, r.group), delete n[o];
1273
+ }
1274
+ a && delete t.__transition;
1275
+ }
1276
+ }
1277
+ function Ii(t) {
1278
+ return this.each(function() {
1279
+ At(this, t);
1280
+ });
1281
+ }
1282
+ function Pi(t, e) {
1283
+ var n, r;
1284
+ return function() {
1285
+ var i = U(this, t), a = i.tween;
1286
+ if (a !== n) {
1287
+ r = n = a;
1288
+ for (var o = 0, c = r.length; o < c; ++o)
1289
+ if (r[o].name === e) {
1290
+ r = r.slice(), r.splice(o, 1);
1291
+ break;
1292
+ }
1293
+ }
1294
+ i.tween = r;
1295
+ };
1296
+ }
1297
+ function Di(t, e, n) {
1298
+ var r, i;
1299
+ if (typeof n != "function") throw new Error();
1300
+ return function() {
1301
+ var a = U(this, t), o = a.tween;
1302
+ if (o !== r) {
1303
+ i = (r = o).slice();
1304
+ for (var c = { name: e, value: n }, s = 0, l = i.length; s < l; ++s)
1305
+ if (i[s].name === e) {
1306
+ i[s] = c;
1307
+ break;
1308
+ }
1309
+ s === l && i.push(c);
1310
+ }
1311
+ a.tween = i;
1312
+ };
1313
+ }
1314
+ function zi(t, e) {
1315
+ var n = this._id;
1316
+ if (t += "", arguments.length < 2) {
1317
+ for (var r = X(this.node(), n).tween, i = 0, a = r.length, o; i < a; ++i)
1318
+ if ((o = r[i]).name === t)
1319
+ return o.value;
1320
+ return null;
1321
+ }
1322
+ return this.each((e == null ? Pi : Di)(n, t, e));
1323
+ }
1324
+ function le(t, e, n) {
1325
+ var r = t._id;
1326
+ return t.each(function() {
1327
+ var i = U(this, r);
1328
+ (i.value || (i.value = {}))[e] = n.apply(this, arguments);
1329
+ }), function(i) {
1330
+ return X(i, r).value[e];
1331
+ };
1332
+ }
1333
+ function en(t, e) {
1334
+ var n;
1335
+ return (typeof e == "number" ? tt : e instanceof yt ? ve : (n = yt(e)) ? (e = n, ve) : mi)(t, e);
1336
+ }
1337
+ function Yi(t) {
1338
+ return function() {
1339
+ this.removeAttribute(t);
1340
+ };
1341
+ }
1342
+ function Ri(t) {
1343
+ return function() {
1344
+ this.removeAttributeNS(t.space, t.local);
1345
+ };
1346
+ }
1347
+ function Li(t, e, n) {
1348
+ var r, i = n + "", a;
1349
+ return function() {
1350
+ var o = this.getAttribute(t);
1351
+ return o === i ? null : o === r ? a : a = e(r = o, n);
1352
+ };
1353
+ }
1354
+ function Bi(t, e, n) {
1355
+ var r, i = n + "", a;
1356
+ return function() {
1357
+ var o = this.getAttributeNS(t.space, t.local);
1358
+ return o === i ? null : o === r ? a : a = e(r = o, n);
1359
+ };
1360
+ }
1361
+ function Hi(t, e, n) {
1362
+ var r, i, a;
1363
+ return function() {
1364
+ var o, c = n(this), s;
1365
+ return c == null ? void this.removeAttribute(t) : (o = this.getAttribute(t), s = c + "", o === s ? null : o === r && s === i ? a : (i = s, a = e(r = o, c)));
1366
+ };
1367
+ }
1368
+ function Oi(t, e, n) {
1369
+ var r, i, a;
1370
+ return function() {
1371
+ var o, c = n(this), s;
1372
+ return c == null ? void this.removeAttributeNS(t.space, t.local) : (o = this.getAttributeNS(t.space, t.local), s = c + "", o === s ? null : o === r && s === i ? a : (i = s, a = e(r = o, c)));
1373
+ };
1374
+ }
1375
+ function Fi(t, e) {
1376
+ var n = Rt(t), r = n === "transform" ? wi : en;
1377
+ return this.attrTween(t, typeof e == "function" ? (n.local ? Oi : Hi)(n, r, le(this, "attr." + t, e)) : e == null ? (n.local ? Ri : Yi)(n) : (n.local ? Bi : Li)(n, r, e));
1378
+ }
1379
+ function Wi(t, e) {
1380
+ return function(n) {
1381
+ this.setAttribute(t, e.call(this, n));
1382
+ };
1383
+ }
1384
+ function Gi(t, e) {
1385
+ return function(n) {
1386
+ this.setAttributeNS(t.space, t.local, e.call(this, n));
1387
+ };
1388
+ }
1389
+ function Vi(t, e) {
1390
+ var n, r;
1391
+ function i() {
1392
+ var a = e.apply(this, arguments);
1393
+ return a !== r && (n = (r = a) && Gi(t, a)), n;
1394
+ }
1395
+ return i._value = e, i;
1396
+ }
1397
+ function Xi(t, e) {
1398
+ var n, r;
1399
+ function i() {
1400
+ var a = e.apply(this, arguments);
1401
+ return a !== r && (n = (r = a) && Wi(t, a)), n;
1402
+ }
1403
+ return i._value = e, i;
1404
+ }
1405
+ function qi(t, e) {
1406
+ var n = "attr." + t;
1407
+ if (arguments.length < 2) return (n = this.tween(n)) && n._value;
1408
+ if (e == null) return this.tween(n, null);
1409
+ if (typeof e != "function") throw new Error();
1410
+ var r = Rt(t);
1411
+ return this.tween(n, (r.local ? Vi : Xi)(r, e));
1412
+ }
1413
+ function Ui(t, e) {
1414
+ return function() {
1415
+ ce(this, t).delay = +e.apply(this, arguments);
1416
+ };
1417
+ }
1418
+ function Zi(t, e) {
1419
+ return e = +e, function() {
1420
+ ce(this, t).delay = e;
1421
+ };
1422
+ }
1423
+ function Ki(t) {
1424
+ var e = this._id;
1425
+ return arguments.length ? this.each((typeof t == "function" ? Ui : Zi)(e, t)) : X(this.node(), e).delay;
1426
+ }
1427
+ function Qi(t, e) {
1428
+ return function() {
1429
+ U(this, t).duration = +e.apply(this, arguments);
1430
+ };
1431
+ }
1432
+ function Ji(t, e) {
1433
+ return e = +e, function() {
1434
+ U(this, t).duration = e;
1435
+ };
1436
+ }
1437
+ function ji(t) {
1438
+ var e = this._id;
1439
+ return arguments.length ? this.each((typeof t == "function" ? Qi : Ji)(e, t)) : X(this.node(), e).duration;
1440
+ }
1441
+ function to(t, e) {
1442
+ if (typeof e != "function") throw new Error();
1443
+ return function() {
1444
+ U(this, t).ease = e;
1445
+ };
1446
+ }
1447
+ function eo(t) {
1448
+ var e = this._id;
1449
+ return arguments.length ? this.each(to(e, t)) : X(this.node(), e).ease;
1450
+ }
1451
+ function no(t, e) {
1452
+ return function() {
1453
+ var n = e.apply(this, arguments);
1454
+ if (typeof n != "function") throw new Error();
1455
+ U(this, t).ease = n;
1456
+ };
1457
+ }
1458
+ function ro(t) {
1459
+ if (typeof t != "function") throw new Error();
1460
+ return this.each(no(this._id, t));
1461
+ }
1462
+ function io(t) {
1463
+ typeof t != "function" && (t = ze(t));
1464
+ for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
1465
+ for (var a = e[i], o = a.length, c = r[i] = [], s, l = 0; l < o; ++l)
1466
+ (s = a[l]) && t.call(s, s.__data__, l, a) && c.push(s);
1467
+ return new j(r, this._parents, this._name, this._id);
1468
+ }
1469
+ function oo(t) {
1470
+ if (t._id !== this._id) throw new Error();
1471
+ for (var e = this._groups, n = t._groups, r = e.length, i = n.length, a = Math.min(r, i), o = new Array(r), c = 0; c < a; ++c)
1472
+ for (var s = e[c], l = n[c], u = s.length, f = o[c] = new Array(u), h, g = 0; g < u; ++g)
1473
+ (h = s[g] || l[g]) && (f[g] = h);
1474
+ for (; c < r; ++c)
1475
+ o[c] = e[c];
1476
+ return new j(o, this._parents, this._name, this._id);
1477
+ }
1478
+ function ao(t) {
1479
+ return (t + "").trim().split(/^|\s+/).every(function(e) {
1480
+ var n = e.indexOf(".");
1481
+ return n >= 0 && (e = e.slice(0, n)), !e || e === "start";
1482
+ });
1483
+ }
1484
+ function so(t, e, n) {
1485
+ var r, i, a = ao(e) ? ce : U;
1486
+ return function() {
1487
+ var o = a(this, t), c = o.on;
1488
+ c !== r && (i = (r = c).copy()).on(e, n), o.on = i;
1489
+ };
1490
+ }
1491
+ function co(t, e) {
1492
+ var n = this._id;
1493
+ return arguments.length < 2 ? X(this.node(), n).on.on(t) : this.each(so(n, t, e));
1494
+ }
1495
+ function lo(t) {
1496
+ return function() {
1497
+ var e = this.parentNode;
1498
+ for (var n in this.__transition) if (+n !== t) return;
1499
+ e && e.removeChild(this);
1500
+ };
1501
+ }
1502
+ function uo() {
1503
+ return this.on("end.remove", lo(this._id));
1504
+ }
1505
+ function fo(t) {
1506
+ var e = this._name, n = this._id;
1507
+ typeof t != "function" && (t = ie(t));
1508
+ for (var r = this._groups, i = r.length, a = new Array(i), o = 0; o < i; ++o)
1509
+ for (var c = r[o], s = c.length, l = a[o] = new Array(s), u, f, h = 0; h < s; ++h)
1510
+ (u = c[h]) && (f = t.call(u, u.__data__, h, c)) && ("__data__" in u && (f.__data__ = u.__data__), l[h] = f, Bt(l[h], e, n, h, l, X(u, n)));
1511
+ return new j(a, this._parents, e, n);
1512
+ }
1513
+ function ho(t) {
1514
+ var e = this._name, n = this._id;
1515
+ typeof t != "function" && (t = De(t));
1516
+ for (var r = this._groups, i = r.length, a = [], o = [], c = 0; c < i; ++c)
1517
+ for (var s = r[c], l = s.length, u, f = 0; f < l; ++f)
1518
+ if (u = s[f]) {
1519
+ for (var h = t.call(u, u.__data__, f, s), g, m = X(u, n), x = 0, y = h.length; x < y; ++x)
1520
+ (g = h[x]) && Bt(g, e, n, x, h, m);
1521
+ a.push(h), o.push(u);
1522
+ }
1523
+ return new j(a, o, e, n);
1524
+ }
1525
+ var go = _t.prototype.constructor;
1526
+ function po() {
1527
+ return new go(this._groups, this._parents);
1528
+ }
1529
+ function mo(t, e) {
1530
+ var n, r, i;
1531
+ return function() {
1532
+ var a = lt(this, t), o = (this.style.removeProperty(t), lt(this, t));
1533
+ return a === o ? null : a === n && o === r ? i : i = e(n = a, r = o);
1534
+ };
1535
+ }
1536
+ function nn(t) {
1537
+ return function() {
1538
+ this.style.removeProperty(t);
1539
+ };
1540
+ }
1541
+ function yo(t, e, n) {
1542
+ var r, i = n + "", a;
1543
+ return function() {
1544
+ var o = lt(this, t);
1545
+ return o === i ? null : o === r ? a : a = e(r = o, n);
1546
+ };
1547
+ }
1548
+ function xo(t, e, n) {
1549
+ var r, i, a;
1550
+ return function() {
1551
+ var o = lt(this, t), c = n(this), s = c + "";
1552
+ return c == null && (s = c = (this.style.removeProperty(t), lt(this, t))), o === s ? null : o === r && s === i ? a : (i = s, a = e(r = o, c));
1553
+ };
1554
+ }
1555
+ function _o(t, e) {
1556
+ var n, r, i, a = "style." + e, o = "end." + a, c;
1557
+ return function() {
1558
+ var s = U(this, t), l = s.on, u = s.value[a] == null ? c || (c = nn(e)) : void 0;
1559
+ (l !== n || i !== u) && (r = (n = l).copy()).on(o, i = u), s.on = r;
1560
+ };
1561
+ }
1562
+ function wo(t, e, n) {
1563
+ var r = (t += "") == "transform" ? _i : en;
1564
+ return e == null ? this.styleTween(t, mo(t, r)).on("end.style." + t, nn(t)) : typeof e == "function" ? this.styleTween(t, xo(t, r, le(this, "style." + t, e))).each(_o(this._id, t)) : this.styleTween(t, yo(t, r, e), n).on("end.style." + t, null);
1565
+ }
1566
+ function vo(t, e, n) {
1567
+ return function(r) {
1568
+ this.style.setProperty(t, e.call(this, r), n);
1569
+ };
1570
+ }
1571
+ function bo(t, e, n) {
1572
+ var r, i;
1573
+ function a() {
1574
+ var o = e.apply(this, arguments);
1575
+ return o !== i && (r = (i = o) && vo(t, o, n)), r;
1576
+ }
1577
+ return a._value = e, a;
1578
+ }
1579
+ function Eo(t, e, n) {
1580
+ var r = "style." + (t += "");
1581
+ if (arguments.length < 2) return (r = this.tween(r)) && r._value;
1582
+ if (e == null) return this.tween(r, null);
1583
+ if (typeof e != "function") throw new Error();
1584
+ return this.tween(r, bo(t, e, n ?? ""));
1585
+ }
1586
+ function No(t) {
1587
+ return function() {
1588
+ this.textContent = t;
1589
+ };
1590
+ }
1591
+ function $o(t) {
1592
+ return function() {
1593
+ var e = t(this);
1594
+ this.textContent = e ?? "";
1595
+ };
1596
+ }
1597
+ function So(t) {
1598
+ return this.tween("text", typeof t == "function" ? $o(le(this, "text", t)) : No(t == null ? "" : t + ""));
1599
+ }
1600
+ function ko(t) {
1601
+ return function(e) {
1602
+ this.textContent = t.call(this, e);
1603
+ };
1604
+ }
1605
+ function Ao(t) {
1606
+ var e, n;
1607
+ function r() {
1608
+ var i = t.apply(this, arguments);
1609
+ return i !== n && (e = (n = i) && ko(i)), e;
1610
+ }
1611
+ return r._value = t, r;
1612
+ }
1613
+ function To(t) {
1614
+ var e = "text";
1615
+ if (arguments.length < 1) return (e = this.tween(e)) && e._value;
1616
+ if (t == null) return this.tween(e, null);
1617
+ if (typeof t != "function") throw new Error();
1618
+ return this.tween(e, Ao(t));
1619
+ }
1620
+ function Mo() {
1621
+ for (var t = this._name, e = this._id, n = rn(), r = this._groups, i = r.length, a = 0; a < i; ++a)
1622
+ for (var o = r[a], c = o.length, s, l = 0; l < c; ++l)
1623
+ if (s = o[l]) {
1624
+ var u = X(s, e);
1625
+ Bt(s, t, n, l, o, {
1626
+ time: u.time + u.delay + u.duration,
1627
+ delay: 0,
1628
+ duration: u.duration,
1629
+ ease: u.ease
1630
+ });
1631
+ }
1632
+ return new j(r, this._parents, t, n);
1633
+ }
1634
+ function Co() {
1635
+ var t, e, n = this, r = n._id, i = n.size();
1636
+ return new Promise(function(a, o) {
1637
+ var c = { value: o }, s = { value: function() {
1638
+ --i === 0 && a();
1639
+ } };
1640
+ n.each(function() {
1641
+ var l = U(this, r), u = l.on;
1642
+ u !== t && (e = (t = u).copy(), e._.cancel.push(c), e._.interrupt.push(c), e._.end.push(s)), l.on = e;
1643
+ }), i === 0 && a();
1644
+ });
1645
+ }
1646
+ var Io = 0;
1647
+ function j(t, e, n, r) {
1648
+ this._groups = t, this._parents = e, this._name = n, this._id = r;
1649
+ }
1650
+ function rn() {
1651
+ return ++Io;
1652
+ }
1653
+ var Q = _t.prototype;
1654
+ j.prototype = {
1655
+ constructor: j,
1656
+ select: fo,
1657
+ selectAll: ho,
1658
+ selectChild: Q.selectChild,
1659
+ selectChildren: Q.selectChildren,
1660
+ filter: io,
1661
+ merge: oo,
1662
+ selection: po,
1663
+ transition: Mo,
1664
+ call: Q.call,
1665
+ nodes: Q.nodes,
1666
+ node: Q.node,
1667
+ size: Q.size,
1668
+ empty: Q.empty,
1669
+ each: Q.each,
1670
+ on: co,
1671
+ attr: Fi,
1672
+ attrTween: qi,
1673
+ style: wo,
1674
+ styleTween: Eo,
1675
+ text: So,
1676
+ textTween: To,
1677
+ remove: uo,
1678
+ tween: zi,
1679
+ delay: Ki,
1680
+ duration: ji,
1681
+ ease: eo,
1682
+ easeVarying: ro,
1683
+ end: Co,
1684
+ [Symbol.iterator]: Q[Symbol.iterator]
1685
+ };
1686
+ function Po(t) {
1687
+ return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
1688
+ }
1689
+ var Do = {
1690
+ time: null,
1691
+ // Set on use.
1692
+ delay: 0,
1693
+ duration: 250,
1694
+ ease: Po
1695
+ };
1696
+ function zo(t, e) {
1697
+ for (var n; !(n = t.__transition) || !(n = n[e]); )
1698
+ if (!(t = t.parentNode))
1699
+ throw new Error(`transition ${e} not found`);
1700
+ return n;
1701
+ }
1702
+ function Yo(t) {
1703
+ var e, n;
1704
+ t instanceof j ? (e = t._id, t = t._name) : (e = rn(), (n = Do).time = se(), t = t == null ? null : t + "");
1705
+ for (var r = this._groups, i = r.length, a = 0; a < i; ++a)
1706
+ for (var o = r[a], c = o.length, s, l = 0; l < c; ++l)
1707
+ (s = o[l]) && Bt(s, t, e, l, o, n || zo(s, e));
1708
+ return new j(r, this._parents, t, e);
1709
+ }
1710
+ _t.prototype.interrupt = Ii;
1711
+ _t.prototype.transition = Yo;
1712
+ const Nt = (t) => () => t;
1713
+ function Ro(t, {
1714
+ sourceEvent: e,
1715
+ target: n,
1716
+ transform: r,
1717
+ dispatch: i
1718
+ }) {
1719
+ Object.defineProperties(this, {
1720
+ type: { value: t, enumerable: !0, configurable: !0 },
1721
+ sourceEvent: { value: e, enumerable: !0, configurable: !0 },
1722
+ target: { value: n, enumerable: !0, configurable: !0 },
1723
+ transform: { value: r, enumerable: !0, configurable: !0 },
1724
+ _: { value: i }
1725
+ });
1726
+ }
1727
+ function J(t, e, n) {
1728
+ this.k = t, this.x = e, this.y = n;
1729
+ }
1730
+ J.prototype = {
1731
+ constructor: J,
1732
+ scale: function(t) {
1733
+ return t === 1 ? this : new J(this.k * t, this.x, this.y);
1734
+ },
1735
+ translate: function(t, e) {
1736
+ return t === 0 & e === 0 ? this : new J(this.k, this.x + this.k * t, this.y + this.k * e);
1737
+ },
1738
+ apply: function(t) {
1739
+ return [t[0] * this.k + this.x, t[1] * this.k + this.y];
1740
+ },
1741
+ applyX: function(t) {
1742
+ return t * this.k + this.x;
1743
+ },
1744
+ applyY: function(t) {
1745
+ return t * this.k + this.y;
1746
+ },
1747
+ invert: function(t) {
1748
+ return [(t[0] - this.x) / this.k, (t[1] - this.y) / this.k];
1749
+ },
1750
+ invertX: function(t) {
1751
+ return (t - this.x) / this.k;
1752
+ },
1753
+ invertY: function(t) {
1754
+ return (t - this.y) / this.k;
1755
+ },
1756
+ rescaleX: function(t) {
1757
+ return t.copy().domain(t.range().map(this.invertX, this).map(t.invert, t));
1758
+ },
1759
+ rescaleY: function(t) {
1760
+ return t.copy().domain(t.range().map(this.invertY, this).map(t.invert, t));
1761
+ },
1762
+ toString: function() {
1763
+ return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
1764
+ }
1765
+ };
1766
+ var Ht = new J(1, 0, 0);
1767
+ Lo.prototype = J.prototype;
1768
+ function Lo(t) {
1769
+ for (; !t.__zoom; ) if (!(t = t.parentNode)) return Ht;
1770
+ return t.__zoom;
1771
+ }
1772
+ function Gt(t) {
1773
+ t.stopImmediatePropagation();
1774
+ }
1775
+ function ht(t) {
1776
+ t.preventDefault(), t.stopImmediatePropagation();
1777
+ }
1778
+ function Bo(t) {
1779
+ return (!t.ctrlKey || t.type === "wheel") && !t.button;
1780
+ }
1781
+ function Ho() {
1782
+ var t = this;
1783
+ return t instanceof SVGElement ? (t = t.ownerSVGElement || t, t.hasAttribute("viewBox") ? (t = t.viewBox.baseVal, [[t.x, t.y], [t.x + t.width, t.y + t.height]]) : [[0, 0], [t.width.baseVal.value, t.height.baseVal.value]]) : [[0, 0], [t.clientWidth, t.clientHeight]];
1784
+ }
1785
+ function Ae() {
1786
+ return this.__zoom || Ht;
1787
+ }
1788
+ function Oo(t) {
1789
+ return -t.deltaY * (t.deltaMode === 1 ? 0.05 : t.deltaMode ? 1 : 2e-3) * (t.ctrlKey ? 10 : 1);
1790
+ }
1791
+ function Fo() {
1792
+ return navigator.maxTouchPoints || "ontouchstart" in this;
1793
+ }
1794
+ function Wo(t, e, n) {
1795
+ var r = t.invertX(e[0][0]) - n[0][0], i = t.invertX(e[1][0]) - n[1][0], a = t.invertY(e[0][1]) - n[0][1], o = t.invertY(e[1][1]) - n[1][1];
1796
+ return t.translate(
1797
+ i > r ? (r + i) / 2 : Math.min(0, r) || Math.max(0, i),
1798
+ o > a ? (a + o) / 2 : Math.min(0, a) || Math.max(0, o)
1799
+ );
1800
+ }
1801
+ function on() {
1802
+ var t = Bo, e = Ho, n = Wo, r = Oo, i = Fo, a = [0, 1 / 0], o = [[-1 / 0, -1 / 0], [1 / 0, 1 / 0]], c = 250, s = Ni, l = re("start", "zoom", "end"), u, f, h, g = 500, m = 150, x = 0, y = 10;
1803
+ function p(d) {
1804
+ d.property("__zoom", Ae).on("wheel.zoom", P, { passive: !1 }).on("mousedown.zoom", D).on("dblclick.zoom", C).filter(i).on("touchstart.zoom", R).on("touchmove.zoom", B).on("touchend.zoom touchcancel.zoom", st).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
1805
+ }
1806
+ p.transform = function(d, v, _, $) {
1807
+ var k = d.selection ? d.selection() : d;
1808
+ k.property("__zoom", Ae), d !== k ? S(d, v, _, $) : k.interrupt().each(function() {
1809
+ N(this, arguments).event($).start().zoom(null, typeof v == "function" ? v.apply(this, arguments) : v).end();
1810
+ });
1811
+ }, p.scaleBy = function(d, v, _, $) {
1812
+ p.scaleTo(d, function() {
1813
+ var k = this.__zoom.k, M = typeof v == "function" ? v.apply(this, arguments) : v;
1814
+ return k * M;
1815
+ }, _, $);
1816
+ }, p.scaleTo = function(d, v, _, $) {
1817
+ p.transform(d, function() {
1818
+ var k = e.apply(this, arguments), M = this.__zoom, I = _ == null ? E(k) : typeof _ == "function" ? _.apply(this, arguments) : _, T = M.invert(I), Y = typeof v == "function" ? v.apply(this, arguments) : v;
1819
+ return n(b(w(M, Y), I, T), k, o);
1820
+ }, _, $);
1821
+ }, p.translateBy = function(d, v, _, $) {
1822
+ p.transform(d, function() {
1823
+ return n(this.__zoom.translate(
1824
+ typeof v == "function" ? v.apply(this, arguments) : v,
1825
+ typeof _ == "function" ? _.apply(this, arguments) : _
1826
+ ), e.apply(this, arguments), o);
1827
+ }, null, $);
1828
+ }, p.translateTo = function(d, v, _, $, k) {
1829
+ p.transform(d, function() {
1830
+ var M = e.apply(this, arguments), I = this.__zoom, T = $ == null ? E(M) : typeof $ == "function" ? $.apply(this, arguments) : $;
1831
+ return n(Ht.translate(T[0], T[1]).scale(I.k).translate(
1832
+ typeof v == "function" ? -v.apply(this, arguments) : -v,
1833
+ typeof _ == "function" ? -_.apply(this, arguments) : -_
1834
+ ), M, o);
1835
+ }, $, k);
1836
+ };
1837
+ function w(d, v) {
1838
+ return v = Math.max(a[0], Math.min(a[1], v)), v === d.k ? d : new J(v, d.x, d.y);
1839
+ }
1840
+ function b(d, v, _) {
1841
+ var $ = v[0] - _[0] * d.k, k = v[1] - _[1] * d.k;
1842
+ return $ === d.x && k === d.y ? d : new J(d.k, $, k);
1843
+ }
1844
+ function E(d) {
1845
+ return [(+d[0][0] + +d[1][0]) / 2, (+d[0][1] + +d[1][1]) / 2];
1846
+ }
1847
+ function S(d, v, _, $) {
1848
+ d.on("start.zoom", function() {
1849
+ N(this, arguments).event($).start();
1850
+ }).on("interrupt.zoom end.zoom", function() {
1851
+ N(this, arguments).event($).end();
1852
+ }).tween("zoom", function() {
1853
+ var k = this, M = arguments, I = N(k, M).event($), T = e.apply(k, M), Y = _ == null ? E(T) : typeof _ == "function" ? _.apply(k, M) : _, O = Math.max(T[1][0] - T[0][0], T[1][1] - T[0][1]), L = k.__zoom, W = typeof v == "function" ? v.apply(k, M) : v, Z = s(L.invert(Y).concat(O / L.k), W.invert(Y).concat(O / W.k));
1854
+ return function(G) {
1855
+ if (G === 1) G = W;
1856
+ else {
1857
+ var K = Z(G), Ot = O / K[2];
1858
+ G = new J(Ot, Y[0] - K[0] * Ot, Y[1] - K[1] * Ot);
1859
+ }
1860
+ I.zoom(null, G);
1861
+ };
1862
+ });
1863
+ }
1864
+ function N(d, v, _) {
1865
+ return !_ && d.__zooming || new A(d, v);
1866
+ }
1867
+ function A(d, v) {
1868
+ this.that = d, this.args = v, this.active = 0, this.sourceEvent = null, this.extent = e.apply(d, v), this.taps = 0;
1869
+ }
1870
+ A.prototype = {
1871
+ event: function(d) {
1872
+ return d && (this.sourceEvent = d), this;
1873
+ },
1874
+ start: function() {
1875
+ return ++this.active === 1 && (this.that.__zooming = this, this.emit("start")), this;
1876
+ },
1877
+ zoom: function(d, v) {
1878
+ return this.mouse && d !== "mouse" && (this.mouse[1] = v.invert(this.mouse[0])), this.touch0 && d !== "touch" && (this.touch0[1] = v.invert(this.touch0[0])), this.touch1 && d !== "touch" && (this.touch1[1] = v.invert(this.touch1[0])), this.that.__zoom = v, this.emit("zoom"), this;
1879
+ },
1880
+ end: function() {
1881
+ return --this.active === 0 && (delete this.that.__zooming, this.emit("end")), this;
1882
+ },
1883
+ emit: function(d) {
1884
+ var v = z(this.that).datum();
1885
+ l.call(
1886
+ d,
1887
+ this.that,
1888
+ new Ro(d, {
1889
+ sourceEvent: this.sourceEvent,
1890
+ target: p,
1891
+ transform: this.that.__zoom,
1892
+ dispatch: l
1893
+ }),
1894
+ v
1895
+ );
1896
+ }
1897
+ };
1898
+ function P(d, ...v) {
1899
+ if (!t.apply(this, arguments)) return;
1900
+ var _ = N(this, v).event(d), $ = this.__zoom, k = Math.max(a[0], Math.min(a[1], $.k * Math.pow(2, r.apply(this, arguments)))), M = nt(d);
1901
+ if (_.wheel)
1902
+ (_.mouse[0][0] !== M[0] || _.mouse[0][1] !== M[1]) && (_.mouse[1] = $.invert(_.mouse[0] = M)), clearTimeout(_.wheel);
1903
+ else {
1904
+ if ($.k === k) return;
1905
+ _.mouse = [M, $.invert(M)], At(this), _.start();
1906
+ }
1907
+ ht(d), _.wheel = setTimeout(I, m), _.zoom("mouse", n(b(w($, k), _.mouse[0], _.mouse[1]), _.extent, o));
1908
+ function I() {
1909
+ _.wheel = null, _.end();
1910
+ }
1911
+ }
1912
+ function D(d, ...v) {
1913
+ if (h || !t.apply(this, arguments)) return;
1914
+ var _ = d.currentTarget, $ = N(this, v, !0).event(d), k = z(d.view).on("mousemove.zoom", Y, !0).on("mouseup.zoom", O, !0), M = nt(d, _), I = d.clientX, T = d.clientY;
1915
+ Qr(d.view), Gt(d), $.mouse = [M, this.__zoom.invert(M)], At(this), $.start();
1916
+ function Y(L) {
1917
+ if (ht(L), !$.moved) {
1918
+ var W = L.clientX - I, Z = L.clientY - T;
1919
+ $.moved = W * W + Z * Z > x;
1920
+ }
1921
+ $.event(L).zoom("mouse", n(b($.that.__zoom, $.mouse[0] = nt(L, _), $.mouse[1]), $.extent, o));
1922
+ }
1923
+ function O(L) {
1924
+ k.on("mousemove.zoom mouseup.zoom", null), Jr(L.view, $.moved), ht(L), $.event(L).end();
1925
+ }
1926
+ }
1927
+ function C(d, ...v) {
1928
+ if (t.apply(this, arguments)) {
1929
+ var _ = this.__zoom, $ = nt(d.changedTouches ? d.changedTouches[0] : d, this), k = _.invert($), M = _.k * (d.shiftKey ? 0.5 : 2), I = n(b(w(_, M), $, k), e.apply(this, v), o);
1930
+ ht(d), c > 0 ? z(this).transition().duration(c).call(S, I, $, d) : z(this).call(p.transform, I, $, d);
1931
+ }
1932
+ }
1933
+ function R(d, ...v) {
1934
+ if (t.apply(this, arguments)) {
1935
+ var _ = d.touches, $ = _.length, k = N(this, v, d.changedTouches.length === $).event(d), M, I, T, Y;
1936
+ for (Gt(d), I = 0; I < $; ++I)
1937
+ T = _[I], Y = nt(T, this), Y = [Y, this.__zoom.invert(Y), T.identifier], k.touch0 ? !k.touch1 && k.touch0[2] !== Y[2] && (k.touch1 = Y, k.taps = 0) : (k.touch0 = Y, M = !0, k.taps = 1 + !!u);
1938
+ u && (u = clearTimeout(u)), M && (k.taps < 2 && (f = Y[0], u = setTimeout(function() {
1939
+ u = null;
1940
+ }, g)), At(this), k.start());
1941
+ }
1942
+ }
1943
+ function B(d, ...v) {
1944
+ if (this.__zooming) {
1945
+ var _ = N(this, v).event(d), $ = d.changedTouches, k = $.length, M, I, T, Y;
1946
+ for (ht(d), M = 0; M < k; ++M)
1947
+ I = $[M], T = nt(I, this), _.touch0 && _.touch0[2] === I.identifier ? _.touch0[0] = T : _.touch1 && _.touch1[2] === I.identifier && (_.touch1[0] = T);
1948
+ if (I = _.that.__zoom, _.touch1) {
1949
+ var O = _.touch0[0], L = _.touch0[1], W = _.touch1[0], Z = _.touch1[1], G = (G = W[0] - O[0]) * G + (G = W[1] - O[1]) * G, K = (K = Z[0] - L[0]) * K + (K = Z[1] - L[1]) * K;
1950
+ I = w(I, Math.sqrt(G / K)), T = [(O[0] + W[0]) / 2, (O[1] + W[1]) / 2], Y = [(L[0] + Z[0]) / 2, (L[1] + Z[1]) / 2];
1951
+ } else if (_.touch0) T = _.touch0[0], Y = _.touch0[1];
1952
+ else return;
1953
+ _.zoom("touch", n(b(I, T, Y), _.extent, o));
1954
+ }
1955
+ }
1956
+ function st(d, ...v) {
1957
+ if (this.__zooming) {
1958
+ var _ = N(this, v).event(d), $ = d.changedTouches, k = $.length, M, I;
1959
+ for (Gt(d), h && clearTimeout(h), h = setTimeout(function() {
1960
+ h = null;
1961
+ }, g), M = 0; M < k; ++M)
1962
+ I = $[M], _.touch0 && _.touch0[2] === I.identifier ? delete _.touch0 : _.touch1 && _.touch1[2] === I.identifier && delete _.touch1;
1963
+ if (_.touch1 && !_.touch0 && (_.touch0 = _.touch1, delete _.touch1), _.touch0) _.touch0[1] = this.__zoom.invert(_.touch0[0]);
1964
+ else if (_.end(), _.taps === 2 && (I = nt(I, this), Math.hypot(f[0] - I[0], f[1] - I[1]) < y)) {
1965
+ var T = z(this).on("dblclick.zoom");
1966
+ T && T.apply(this, arguments);
1967
+ }
1968
+ }
1969
+ }
1970
+ return p.wheelDelta = function(d) {
1971
+ return arguments.length ? (r = typeof d == "function" ? d : Nt(+d), p) : r;
1972
+ }, p.filter = function(d) {
1973
+ return arguments.length ? (t = typeof d == "function" ? d : Nt(!!d), p) : t;
1974
+ }, p.touchable = function(d) {
1975
+ return arguments.length ? (i = typeof d == "function" ? d : Nt(!!d), p) : i;
1976
+ }, p.extent = function(d) {
1977
+ return arguments.length ? (e = typeof d == "function" ? d : Nt([[+d[0][0], +d[0][1]], [+d[1][0], +d[1][1]]]), p) : e;
1978
+ }, p.scaleExtent = function(d) {
1979
+ return arguments.length ? (a[0] = +d[0], a[1] = +d[1], p) : [a[0], a[1]];
1980
+ }, p.translateExtent = function(d) {
1981
+ return arguments.length ? (o[0][0] = +d[0][0], o[1][0] = +d[1][0], o[0][1] = +d[0][1], o[1][1] = +d[1][1], p) : [[o[0][0], o[0][1]], [o[1][0], o[1][1]]];
1982
+ }, p.constrain = function(d) {
1983
+ return arguments.length ? (n = d, p) : n;
1984
+ }, p.duration = function(d) {
1985
+ return arguments.length ? (c = +d, p) : c;
1986
+ }, p.interpolate = function(d) {
1987
+ return arguments.length ? (s = d, p) : s;
1988
+ }, p.on = function() {
1989
+ var d = l.on.apply(l, arguments);
1990
+ return d === l ? p : d;
1991
+ }, p.clickDistance = function(d) {
1992
+ return arguments.length ? (x = (d = +d) * d, p) : Math.sqrt(x);
1993
+ }, p.tapDistance = function(d) {
1994
+ return arguments.length ? (y = +d, p) : y;
1995
+ }, p;
1996
+ }
1997
+ const et = 72, Go = 240, Vo = 64, an = 50, Xo = 80, qo = 20, Uo = 20, te = 0.9, Zo = 16, Ko = 32, Qo = 3, sn = 800, cn = [
1998
+ 0,
1999
+ 0,
2000
+ 1e3,
2001
+ 800
2002
+ ], ue = 40;
2003
+ class ln {
2004
+ constructor(e, n, r, i, a) {
2005
+ this.type = e, this._gvid = n, this.name = r, this._draw_ = i, this._ldraw_ = a;
2006
+ }
2007
+ }
2008
+ class un extends ln {
2009
+ // Reference to the edge this virtual node represents
2010
+ constructor({
2011
+ _gvid: e,
2012
+ name: n,
2013
+ _draw_: r,
2014
+ _ldraw_: i,
2015
+ bb: a,
2016
+ pos: o,
2017
+ width: c,
2018
+ height: s,
2019
+ label: l
2020
+ }) {
2021
+ super("node", e, n, r, i), this.virtualNode = !1, this.bb = a, this.pos = o, this.width = c, this.height = s, this.label = l;
2022
+ }
2023
+ /**
2024
+ * Get parsed position as [x, y] coordinates
2025
+ */
2026
+ getPosition() {
2027
+ if (!this.pos) return null;
2028
+ const [e, n] = this.pos.split(",").map(Number);
2029
+ return [e, n];
2030
+ }
2031
+ /**
2032
+ * Get width in points (1 inch = 72 points)
2033
+ */
2034
+ getWidthPoints() {
2035
+ return parseFloat(this.width || "1") * et;
2036
+ }
2037
+ /**
2038
+ * Get height in points (1 inch = 72 points)
2039
+ */
2040
+ getHeightPoints() {
2041
+ return parseFloat(this.height || "0.5") * et;
2042
+ }
2043
+ /**
2044
+ * Get bounding box coordinates (x, y is top-left corner)
2045
+ * Note: Graphviz pos is center, so we calculate top-left
2046
+ */
2047
+ getBounds() {
2048
+ const e = this.getPosition();
2049
+ if (!e) return null;
2050
+ const [n, r] = e, i = this.getWidthPoints(), a = this.getHeightPoints();
2051
+ return {
2052
+ x: n - i / 2,
2053
+ y: r - a / 2,
2054
+ width: i,
2055
+ height: a
2056
+ };
2057
+ }
2058
+ /**
2059
+ * Left side input point (1/4 from top)
2060
+ */
2061
+ leftIn() {
2062
+ const e = this.getBounds();
2063
+ return e ? {
2064
+ x: e.x,
2065
+ y: Math.trunc(e.y + e.height / 4)
2066
+ } : null;
2067
+ }
2068
+ /**
2069
+ * Left side output point (3/4 from top)
2070
+ */
2071
+ leftOut() {
2072
+ const e = this.getBounds();
2073
+ return e ? {
2074
+ x: e.x,
2075
+ y: Math.trunc(e.y + e.height / 4 * 3)
2076
+ } : null;
2077
+ }
2078
+ /**
2079
+ * Right side output point (1/4 from top)
2080
+ */
2081
+ rightOut() {
2082
+ const e = this.getBounds();
2083
+ return e ? {
2084
+ x: e.x + e.width,
2085
+ y: Math.trunc(e.y + e.height / 4)
2086
+ } : null;
2087
+ }
2088
+ /**
2089
+ * Right side input point (3/4 from top)
2090
+ */
2091
+ rightIn() {
2092
+ const e = this.getBounds();
2093
+ return e ? {
2094
+ x: e.x + e.width,
2095
+ y: Math.trunc(e.y + e.height / 4 * 3)
2096
+ } : null;
2097
+ }
2098
+ }
2099
+ class Jo extends ln {
2100
+ constructor({
2101
+ _gvid: e,
2102
+ name: n,
2103
+ _draw_: r,
2104
+ _ldraw_: i,
2105
+ _hdraw_: a,
2106
+ _tdraw_: o,
2107
+ head: c,
2108
+ tail: s,
2109
+ label: l
2110
+ }) {
2111
+ if (super("edge", e, n, r, i), this.isBaseEdge = !1, this.depth = 0, this.baseOffset = 0, this.midY = 0, this._hdraw_ = a, this._tdraw_ = o, this.head = c, this.tail = s, this.label = l, l)
2112
+ try {
2113
+ this.edgeContent = Mt(l), this.edgeIndex = this.edgeContent.index, this.edgeColor = this.edgeContent.color;
2114
+ } catch (u) {
2115
+ /^\s*</.test(l) || console.warn(`Failed to decode edge label for ${n}:`, u);
2116
+ }
2117
+ }
2118
+ /**
2119
+ * Set the source and target node references
2120
+ */
2121
+ setNodes(e, n) {
2122
+ this.sourceNode = e, this.targetNode = n;
2123
+ }
2124
+ /**
2125
+ * Determine edge direction based on source/target node positions
2126
+ * - "right": source is left of target (edge goes left → right)
2127
+ * - "left": source is right of target (edge goes right → left)
2128
+ * - "self": source and target are the same node
2129
+ */
2130
+ getDirection() {
2131
+ if (!this.sourceNode || !this.targetNode) return null;
2132
+ const e = this.sourceNode.getPosition(), n = this.targetNode.getPosition();
2133
+ return !e || !n ? null : this.sourceNode._gvid === this.targetNode._gvid ? "self" : e[0] < n[0] ? "right" : "left";
2134
+ }
2135
+ /**
2136
+ * Get the start point (source port) based on edge direction
2137
+ * - Right edge: source node's rightOut
2138
+ * - Left edge: source node's leftOut
2139
+ * - Self-loop: source node's leftOut
2140
+ */
2141
+ getStartPoint() {
2142
+ if (!this.sourceNode) return null;
2143
+ const e = this.getDirection();
2144
+ if (!e) return null;
2145
+ switch (e) {
2146
+ case "right":
2147
+ return this.sourceNode.rightOut();
2148
+ case "left":
2149
+ return this.sourceNode.leftOut();
2150
+ case "self":
2151
+ return this.sourceNode.leftOut();
2152
+ }
2153
+ }
2154
+ /**
2155
+ * Get the end point (target port) based on edge direction
2156
+ * - Right edge: target node's leftIn
2157
+ * - Left edge: target node's rightIn
2158
+ * - Self-loop: target node's rightIn
2159
+ */
2160
+ getEndPoint() {
2161
+ if (!this.targetNode) return null;
2162
+ const e = this.getDirection();
2163
+ if (!e) return null;
2164
+ switch (e) {
2165
+ case "right":
2166
+ return this.targetNode.leftIn();
2167
+ case "left":
2168
+ return this.targetNode.rightIn();
2169
+ case "self":
2170
+ return this.targetNode.rightIn();
2171
+ }
2172
+ }
2173
+ /**
2174
+ * Get the label text for this edge
2175
+ * Priority: edgeContent.text > parsed label > _ldraw_ operations
2176
+ * @returns The label text or null if no label
2177
+ */
2178
+ getLabelText() {
2179
+ var e;
2180
+ if ((e = this.edgeContent) != null && e.elems && this.edgeContent.elems.length > 0)
2181
+ return this.edgeContent.elems.map((n) => n.text).join(" ");
2182
+ if (this.label)
2183
+ return this.label.replace(/<[^>]*>/g, " ").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim() || null;
2184
+ if (this._ldraw_) {
2185
+ const n = [];
2186
+ if (this._ldraw_.forEach((r) => {
2187
+ r.op === "T" && r.text && n.push(r.text);
2188
+ }), n.length > 0)
2189
+ return n.join(" ");
2190
+ }
2191
+ return null;
2192
+ }
2193
+ /**
2194
+ * Get the stroke color for this edge
2195
+ * Priority: edgeColor from EdgeContent > _draw_ operations > default
2196
+ * @returns The color string or default gray if not found
2197
+ */
2198
+ getColor() {
2199
+ const e = "#9AA4B2";
2200
+ if (this.edgeColor)
2201
+ return this.edgeColor;
2202
+ if (this._draw_) {
2203
+ for (const n of this._draw_)
2204
+ if (n.op === "c" && n.color)
2205
+ return n.color;
2206
+ }
2207
+ if (this._hdraw_) {
2208
+ for (const n of this._hdraw_)
2209
+ if (n.op === "c" && n.color)
2210
+ return n.color;
2211
+ }
2212
+ return e;
2213
+ }
2214
+ }
2215
+ class fn {
2216
+ constructor(e, n = 0) {
2217
+ this.index = e, this.aboveY = n, this.belowY = n;
2218
+ }
2219
+ /** Allocate space above current aboveY, returns the new Y position */
2220
+ allocateAbove(e) {
2221
+ return this.aboveY -= e, this.aboveY;
2222
+ }
2223
+ /** Allocate space below current belowY, returns the new Y position */
2224
+ allocateBelow(e) {
2225
+ const n = this.belowY;
2226
+ return this.belowY += e, n;
2227
+ }
2228
+ /** Get the current range of allocated Y coordinates */
2229
+ getRange() {
2230
+ return { above: this.aboveY, below: this.belowY };
2231
+ }
2232
+ }
2233
+ class jo extends fn {
2234
+ constructor(e, n = 0) {
2235
+ super(e, n), this.nodes = [];
2236
+ }
2237
+ addNode(e, n = !0) {
2238
+ if (this.nodes.push(e), !n) return;
2239
+ const r = e.getPosition();
2240
+ if (r) {
2241
+ const i = e.height ? parseFloat(e.height) * et : ue, a = r[1] - i / 2, o = r[1] + i / 2;
2242
+ this.aboveY = Math.min(this.aboveY, a), this.belowY = Math.max(this.belowY, o);
2243
+ }
2244
+ }
2245
+ }
2246
+ class ta extends fn {
2247
+ constructor(e, n, r = 0) {
2248
+ super(Math.min(e, n), r), this.edges = [], this.baseEdgeIndex = -1, this.sourceColIndex = e, this.targetColIndex = n;
2249
+ }
2250
+ addEdge(e) {
2251
+ this.edges.push(e);
2252
+ }
2253
+ /** Set the base edge for this column */
2254
+ setBaseEdge(e, n) {
2255
+ this.baseEdge = e, this.baseEdgeIndex = n ?? this.edges.indexOf(e);
2256
+ }
2257
+ /** Get the key for this edge column */
2258
+ getKey() {
2259
+ const e = Math.min(this.sourceColIndex, this.targetColIndex), n = Math.max(this.sourceColIndex, this.targetColIndex);
2260
+ return `${e}-${n}`;
2261
+ }
2262
+ }
2263
+ const ea = 0.6, na = /mono|fira|consolas|courier|menlo|roboto mono|ui-monospace/i, Te = {
2264
+ i: 0.27,
2265
+ l: 0.27,
2266
+ j: 0.27,
2267
+ I: 0.29,
2268
+ ".": 0.28,
2269
+ ",": 0.28,
2270
+ ":": 0.28,
2271
+ ";": 0.28,
2272
+ "'": 0.2,
2273
+ "|": 0.26,
2274
+ "!": 0.3,
2275
+ f: 0.32,
2276
+ t: 0.34,
2277
+ r: 0.38,
2278
+ "(": 0.34,
2279
+ ")": 0.34,
2280
+ "[": 0.34,
2281
+ "]": 0.34,
2282
+ " ": 0.28
2283
+ }, Me = {
2284
+ m: 0.85,
2285
+ w: 0.74,
2286
+ M: 0.83,
2287
+ W: 0.86,
2288
+ "@": 0.92
2289
+ };
2290
+ function ra(t) {
2291
+ if (t in Te) return Te[t];
2292
+ if (t in Me) return Me[t];
2293
+ const e = t.charCodeAt(0);
2294
+ return e >= 48 && e <= 57 ? 0.57 : e >= 65 && e <= 90 ? 0.66 : e >= 97 && e <= 122 ? 0.53 : e >= 33 && e <= 126 ? 0.5 : e > 11904 ? 1 : 0.55;
2295
+ }
2296
+ function ia(t) {
2297
+ return !!t && na.test(t);
2298
+ }
2299
+ function oa(t, e, n) {
2300
+ if (!t) return 0;
2301
+ if (ia(e))
2302
+ return t.length * n * ea;
2303
+ let r = 0;
2304
+ for (const i of t) r += ra(i);
2305
+ return r * n;
2306
+ }
2307
+ function ee(t, e, n) {
2308
+ const r = t.attr("font-family") || void 0, i = parseFloat(t.attr("font-size") || "12") || 12, a = (l) => oa(l, r, i);
2309
+ if (t.text(n), a(n) <= e) return;
2310
+ const o = "...";
2311
+ let c = 0, s = n.length;
2312
+ for (; c < s; ) {
2313
+ const l = Math.floor((c + s + 1) / 2);
2314
+ a(n.slice(0, l) + o) <= e ? c = l : s = l - 1;
2315
+ }
2316
+ c > 0 ? t.text(n.slice(0, c) + o) : t.text(o);
2317
+ }
2318
+ function aa(t) {
2319
+ if (!t) return [];
2320
+ const e = [], n = /<TD[^>]*>(.*?)<\/TD>/gi;
2321
+ let r;
2322
+ for (; (r = n.exec(t)) !== null; ) {
2323
+ let i = r[1];
2324
+ i = i.replace(/<[^>]+>/g, "").trim(), i && e.push(i);
2325
+ }
2326
+ if (e.length === 0) {
2327
+ const i = t.replace(/<[^>]+>/g, "").trim();
2328
+ i && e.push(i);
2329
+ }
2330
+ return e;
2331
+ }
2332
+ function sa(t) {
2333
+ var a;
2334
+ if (!t || !/<TABLE/i.test(t)) return null;
2335
+ const e = /<B>([\s\S]*?)<\/B>/i.exec(t), n = e ? e[1].replace(/<[^>]+>/g, "").trim() : "", r = t.replace(/<[^>]+>/g, " "), i = ((a = /0x[0-9a-fA-F]{8,}/.exec(r)) == null ? void 0 : a[0]) ?? "";
2336
+ return !n && !i ? null : { tags: [], label: n, text: i };
2337
+ }
2338
+ function hn(t, e) {
2339
+ const n = /^\[(\d+)\]$/.exec(t);
2340
+ return n ? `[${n[1]}/${e}]` : t;
2341
+ }
2342
+ function ca(t, e) {
2343
+ return !t || t.length === 0 ? t : t.map(
2344
+ (n, r) => r === 0 ? { ...n, text: hn(n.text, e) } : n
2345
+ );
2346
+ }
2347
+ function dn(t, e, n) {
2348
+ var l;
2349
+ const r = ca((l = t.edgeContent) == null ? void 0 : l.elems, n);
2350
+ let i = "";
2351
+ r && r.length > 0 && (i = r.map((u) => u.text).join(" ")), i || (i = aa(t.label ?? "").map((f, h) => h === 0 ? hn(f, n) : f).map((f) => f.length > 20 ? f.slice(0, 20) + "..." : f).join(" "));
2352
+ const a = i.length > 60 ? i.slice(0, 60) + "..." : i, o = e.labelFontSize, c = o * 0.6, s = e.labelPadding;
2353
+ return {
2354
+ displayElems: r,
2355
+ finalText: a,
2356
+ boxWidth: a.length * c + s * 2,
2357
+ boxHeight: o + s * 2
2358
+ };
2359
+ }
2360
+ const gn = {
2361
+ // Edge Routing
2362
+ horizontalExtension: 50,
2363
+ minEdgeDistance: 50,
2364
+ minVerticalSegment: 20,
2365
+ loopRadius: 40,
2366
+ edgeSpacing: 80,
2367
+ cornerRadius: 4,
2368
+ // Arrow
2369
+ arrowWidth: 10,
2370
+ arrowHeight: 6,
2371
+ // Label
2372
+ labelHeight: 15,
2373
+ labelFontSize: 10,
2374
+ labelPadding: 6,
2375
+ labelCornerRadius: 4,
2376
+ // Node
2377
+ nodeSpacing: 50,
2378
+ // Path Selection
2379
+ nearlyHorizontalThreshold: 5,
2380
+ nearlyAlignedThreshold: 30
2381
+ };
2382
+ function la(t) {
2383
+ return {
2384
+ ...gn,
2385
+ ...t
2386
+ };
2387
+ }
2388
+ function ua(t) {
2389
+ if (t.length < 2) return t;
2390
+ const e = [t[0]];
2391
+ for (let n = 1; n < t.length; n++) {
2392
+ const r = e[e.length - 1];
2393
+ (Math.abs(t[n].x - r.x) > 0.1 || Math.abs(t[n].y - r.y) > 0.1) && e.push(t[n]);
2394
+ }
2395
+ return e;
2396
+ }
2397
+ function Ce(t, e, n) {
2398
+ const { start: r, pathEnd: i, isNearlyHorizontal: a, startExtensionX: o, endExtensionX: c } = n, s = n.minVerticalSegment, l = Math.abs(r.y - e), u = Math.abs(e - i.y);
2399
+ let f = [], h = e;
2400
+ switch (t) {
2401
+ case "straight":
2402
+ if (a) {
2403
+ const m = (r.y + i.y) / 2;
2404
+ Math.abs(e - m) < s ? (f = [r, i], h = m) : (f = [
2405
+ r,
2406
+ { x: o, y: r.y },
2407
+ // H: horizontal extension
2408
+ { x: o, y: e },
2409
+ // V: vertical to midY
2410
+ { x: c, y: e },
2411
+ // H: horizontal at midY
2412
+ { x: c, y: i.y },
2413
+ // V: vertical to end
2414
+ i
2415
+ // H: horizontal to end
2416
+ ], h = e);
2417
+ } else
2418
+ return null;
2419
+ break;
2420
+ case "2seg":
2421
+ l < u ? Math.abs(e - r.y) < s ? (f = [r, { x: i.x, y: r.y }, i], h = r.y) : (f = [
2422
+ r,
2423
+ { x: o, y: r.y },
2424
+ // H: horizontal extension
2425
+ { x: o, y: e },
2426
+ // V: vertical to midY
2427
+ { x: c, y: e },
2428
+ // H: horizontal at midY
2429
+ { x: c, y: i.y },
2430
+ // V: vertical to end
2431
+ i
2432
+ // H: horizontal to end
2433
+ ], h = e) : Math.abs(e - i.y) < s ? (f = [
2434
+ r,
2435
+ { x: o, y: r.y },
2436
+ // H: horizontal extension
2437
+ { x: o, y: i.y },
2438
+ // V: vertical to end.y
2439
+ i
2440
+ // H: horizontal to end
2441
+ ], h = i.y) : (f = [
2442
+ r,
2443
+ { x: o, y: r.y },
2444
+ // H: horizontal extension
2445
+ { x: o, y: e },
2446
+ // V: vertical to midY
2447
+ { x: c, y: e },
2448
+ // H: horizontal at midY
2449
+ { x: c, y: i.y },
2450
+ // V: vertical to end
2451
+ i
2452
+ // H: horizontal to end
2453
+ ], h = e);
2454
+ break;
2455
+ case "3seg": {
2456
+ const m = e;
2457
+ f = [
2458
+ r,
2459
+ { x: o, y: r.y },
2460
+ { x: o, y: m },
2461
+ { x: c, y: m },
2462
+ { x: c, y: i.y },
2463
+ i
2464
+ ], h = m;
2465
+ break;
2466
+ }
2467
+ case "4seg":
2468
+ f = [
2469
+ r,
2470
+ { x: o, y: r.y },
2471
+ // H: horizontal extension from start
2472
+ { x: o, y: e },
2473
+ // V: vertical to midY
2474
+ { x: c, y: e },
2475
+ // H: horizontal at midY to end extension
2476
+ i
2477
+ // Final segment (may be H or V depending on pathEnd.y vs testMidY)
2478
+ ], h = e;
2479
+ break;
2480
+ case "5seg":
2481
+ if (l < s)
2482
+ f = [
2483
+ r,
2484
+ { x: o, y: r.y },
2485
+ // H: horizontal extension
2486
+ { x: c, y: e },
2487
+ // H: horizontal at midY (skip V since start.y ≈ testMidY)
2488
+ { x: c, y: i.y },
2489
+ // V: vertical to end Y
2490
+ i
2491
+ // H: horizontal to end
2492
+ ], h = e;
2493
+ else if (u < s)
2494
+ f = [
2495
+ r,
2496
+ { x: o, y: r.y },
2497
+ // H: horizontal extension
2498
+ { x: o, y: e },
2499
+ // V: vertical to midY
2500
+ { x: c, y: e },
2501
+ // H: horizontal at midY
2502
+ i
2503
+ // H: horizontal to end (skip V since testMidY ≈ pathEnd.y)
2504
+ ], h = e;
2505
+ else
2506
+ return null;
2507
+ break;
2508
+ case "6seg":
2509
+ f = [
2510
+ r,
2511
+ { x: o, y: r.y },
2512
+ { x: o, y: e },
2513
+ { x: c, y: e },
2514
+ { x: c, y: i.y },
2515
+ i
2516
+ ], h = e;
2517
+ break;
2518
+ }
2519
+ const g = ua(f);
2520
+ return g.length > 0 ? { points: g, actualMidY: h } : null;
2521
+ }
2522
+ function Tt(t, e, n, r = gn) {
2523
+ const i = t.getStartPoint(), a = t.getEndPoint(), o = t.getDirection();
2524
+ if (!i || !a || !o || o === "self")
2525
+ return;
2526
+ const c = { x: i.x, y: e - i.y }, s = { x: a.x, y: e - a.y };
2527
+ let l = { x: s.x, y: s.y };
2528
+ o === "right" ? l = { x: s.x - r.arrowWidth, y: s.y } : o === "left" && (l = { x: s.x + r.arrowWidth, y: s.y });
2529
+ const u = r.minEdgeDistance, f = t.baseDirection === void 0;
2530
+ let g = (c.y + l.y) / 2;
2531
+ if (!f && n && n.midY !== void 0) {
2532
+ if (t.baseDirection === "above") {
2533
+ const w = n.midY - u;
2534
+ g > w && (g = w);
2535
+ } else if (t.baseDirection === "below") {
2536
+ const w = n.midY + u;
2537
+ g < w && (g = w);
2538
+ }
2539
+ }
2540
+ const m = r.horizontalExtension - r.arrowWidth, x = {
2541
+ start: c,
2542
+ pathEnd: l,
2543
+ // Check if start and end are nearly horizontal
2544
+ isNearlyHorizontal: Math.abs(c.y - l.y) < 5,
2545
+ startExtensionX: o === "right" ? c.x + r.horizontalExtension : c.x - r.horizontalExtension,
2546
+ endExtensionX: o === "right" ? l.x - m : l.x + m,
2547
+ minVerticalSegment: r.minVerticalSegment
2548
+ };
2549
+ let y;
2550
+ f ? y = x.isNearlyHorizontal ? ["straight", "3seg"] : ["3seg"] : y = x.isNearlyHorizontal ? ["straight", "3seg", "4seg", "5seg", "6seg"] : ["3seg", "4seg", "5seg", "6seg"];
2551
+ for (const w of y) {
2552
+ const b = Ce(w, g, x);
2553
+ if (b)
2554
+ return { midY: b.actualMidY, points: b.points };
2555
+ }
2556
+ const p = Ce("6seg", g, x);
2557
+ return p ? { midY: p.actualMidY, points: p.points } : void 0;
2558
+ }
2559
+ function Ie(t, e) {
2560
+ if (t.length < 2) return "";
2561
+ if (e === 0 || t.length === 2)
2562
+ return `M${t[0].x},${t[0].y} ${t.slice(1).map((i) => `L${i.x},${i.y}`).join(" ")}`;
2563
+ const n = [];
2564
+ n.push(`M${t[0].x},${t[0].y}`);
2565
+ for (let i = 1; i < t.length - 1; i++) {
2566
+ const a = t[i - 1], o = t[i], c = t[i + 1], s = Math.sqrt((o.x - a.x) ** 2 + (o.y - a.y) ** 2), l = Math.sqrt((c.x - o.x) ** 2 + (c.y - o.y) ** 2), u = Math.min(s, l) / 2, f = Math.min(e, u);
2567
+ if (f > 0) {
2568
+ const h = f / s, g = f / l, m = {
2569
+ x: o.x - (o.x - a.x) * h,
2570
+ y: o.y - (o.y - a.y) * h
2571
+ }, x = {
2572
+ x: o.x + (c.x - o.x) * g,
2573
+ y: o.y + (c.y - o.y) * g
2574
+ };
2575
+ n.push(`L${m.x},${m.y}`), n.push(`Q${o.x},${o.y} ${x.x},${x.y}`);
2576
+ } else
2577
+ n.push(`L${o.x},${o.y}`);
2578
+ }
2579
+ const r = t[t.length - 1];
2580
+ return n.push(`L${r.x},${r.y}`), n.join(" ");
2581
+ }
2582
+ function ne(t, e, n, r, i) {
2583
+ const a = i.topLeft || 0, o = i.topRight || 0, c = i.bottomRight || 0, s = i.bottomLeft || 0;
2584
+ return `
2585
+ M ${t + a} ${e}
2586
+ L ${t + n - o} ${e}
2587
+ ${o ? `Q ${t + n} ${e} ${t + n} ${e + o}` : ""}
2588
+ L ${t + n} ${e + r - c}
2589
+ ${c ? `Q ${t + n} ${e + r} ${t + n - c} ${e + r}` : ""}
2590
+ L ${t + s} ${e + r}
2591
+ ${s ? `Q ${t} ${e + r} ${t} ${e + r - s}` : ""}
2592
+ L ${t} ${e + a}
2593
+ ${a ? `Q ${t} ${e} ${t + a} ${e}` : ""}
2594
+ Z
2595
+ `.trim().replace(/\s+/g, " ");
2596
+ }
2597
+ function fa(t, e, n, r, i, a, o) {
2598
+ const c = a.loopRadius, s = a.horizontalExtension, l = a.cornerRadius, u = () => {
2599
+ const g = n.x - c, m = n.y - c, x = r.x + c, y = r.y - c;
2600
+ return `M${n.x},${n.y} C${g},${m} ${x},${y} ${r.x},${r.y}`;
2601
+ };
2602
+ if (!o) {
2603
+ if (e === "self")
2604
+ return u();
2605
+ const g = r.x - n.x, m = 0.4, x = n.x + g * m, y = n.y, p = r.x - g * m, w = r.y;
2606
+ return `M${n.x},${n.y} C${x},${y} ${p},${w} ${r.x},${r.y}`;
2607
+ }
2608
+ const f = s - a.arrowWidth;
2609
+ if (e === "self") {
2610
+ if (t.virtualNode) {
2611
+ const g = t.virtualNode.getPosition();
2612
+ if (g) {
2613
+ const m = i - g[1];
2614
+ t.midY = m;
2615
+ const x = [
2616
+ n,
2617
+ // leftOut of source node
2618
+ { x: n.x - s, y: n.y },
2619
+ // Extend left
2620
+ { x: n.x - s, y: m },
2621
+ // Go to virtual node height
2622
+ { x: r.x + f, y: m },
2623
+ // Horizontal segment through virtual node
2624
+ { x: r.x + f, y: r.y },
2625
+ // Go down to rightIn
2626
+ r
2627
+ // rightIn of source node
2628
+ ];
2629
+ return Ie(x, l);
2630
+ }
2631
+ return u();
2632
+ }
2633
+ return u();
2634
+ }
2635
+ let h;
2636
+ if (t.orthogonalPathPoints && t.orthogonalPathPoints.length > 0)
2637
+ h = t.orthogonalPathPoints;
2638
+ else {
2639
+ const g = Math.abs(n.y - t.midY), m = Math.abs(t.midY - r.y), x = 20, y = g >= x, p = m >= x, w = e === "right" ? n.x + s : n.x - s, b = e === "right" ? r.x - f : r.x + f;
2640
+ if (h = [], !y && !p) {
2641
+ const E = (n.y + r.y) / 2;
2642
+ h.push(
2643
+ n,
2644
+ { x: w, y: E },
2645
+ { x: b, y: E },
2646
+ r
2647
+ );
2648
+ } else y ? p ? h.push(
2649
+ n,
2650
+ { x: w, y: n.y },
2651
+ { x: w, y: t.midY },
2652
+ { x: b, y: t.midY },
2653
+ { x: b, y: r.y },
2654
+ r
2655
+ ) : h.push(
2656
+ n,
2657
+ { x: w, y: n.y },
2658
+ { x: w, y: t.midY },
2659
+ { x: b, y: t.midY },
2660
+ r
2661
+ ) : h.push(
2662
+ n,
2663
+ { x: w, y: t.midY },
2664
+ { x: b, y: t.midY },
2665
+ { x: b, y: r.y },
2666
+ r
2667
+ );
2668
+ }
2669
+ return Ie(h, l);
2670
+ }
2671
+ function ha(t, e, n, r, i) {
2672
+ da(t, r, i), ga(t, e, n, r, i);
2673
+ }
2674
+ function da(t, e, n) {
2675
+ const r = n.loopRadius, i = n.edgeSpacing, a = n.labelHeight;
2676
+ t.forEach((o) => {
2677
+ const c = o.edges;
2678
+ if (c.length === 0) return;
2679
+ const s = o.baseEdge, l = o.baseEdgeIndex;
2680
+ if (!s || l < 0) return;
2681
+ const u = s.getStartPoint(), f = s.getEndPoint();
2682
+ if (!u || !f) return;
2683
+ const h = e - u.y, g = e - f.y;
2684
+ s.midY = (h + g) / 2;
2685
+ const m = Tt(
2686
+ s,
2687
+ e,
2688
+ void 0,
2689
+ n
2690
+ );
2691
+ m && (s.midY = m.midY, s.orthogonalPathPoints = m.points), o.aboveY = s.midY, o.belowY = s.midY;
2692
+ for (let x = l - 1; x >= 0; x--) {
2693
+ const y = c[x];
2694
+ if (y.depth !== 0) continue;
2695
+ if (y.getDirection() === "self") {
2696
+ const S = y.getStartPoint();
2697
+ S && (y.midY = e - S.y - r);
2698
+ continue;
2699
+ }
2700
+ const w = y.label ? i + a : i;
2701
+ y.midY = o.aboveY - w, o.aboveY = y.midY, y.baseDirection = "above", y.baseOffset = -(l - x);
2702
+ const b = x < c.length - 1 ? c[x + 1] : void 0, E = Tt(
2703
+ y,
2704
+ e,
2705
+ b,
2706
+ n
2707
+ );
2708
+ E && (y.midY = E.midY, y.orthogonalPathPoints = E.points, o.aboveY = y.midY);
2709
+ }
2710
+ for (let x = l + 1; x < c.length; x++) {
2711
+ const y = c[x];
2712
+ if (y.depth !== 0) continue;
2713
+ if (y.getDirection() === "self") {
2714
+ const S = y.getStartPoint();
2715
+ S && (y.midY = e - S.y - r);
2716
+ continue;
2717
+ }
2718
+ const w = y.label ? i + a : i;
2719
+ y.midY = o.belowY + w, o.belowY = y.midY, y.baseDirection = "below", y.baseOffset = x - l;
2720
+ const b = x > 0 ? c[x - 1] : void 0, E = Tt(
2721
+ y,
2722
+ e,
2723
+ b,
2724
+ n
2725
+ );
2726
+ E && (y.midY = E.midY, y.orthogonalPathPoints = E.points, o.belowY = y.midY);
2727
+ }
2728
+ });
2729
+ }
2730
+ function ga(t, e, n, r, i) {
2731
+ const a = i.loopRadius, o = i.edgeSpacing, c = i.labelHeight, s = [];
2732
+ t.forEach((f) => {
2733
+ const h = f.edges;
2734
+ h.length === 0 || f.baseEdge || !h.every((m) => m.depth > 0) || h.forEach((m) => {
2735
+ if (m.getDirection() !== "self")
2736
+ s.push(m);
2737
+ else {
2738
+ const x = m.getStartPoint();
2739
+ x && (m.midY = r - x.y - a);
2740
+ }
2741
+ });
2742
+ }), s.sort((f, h) => f.depth - h.depth);
2743
+ let l = 1 / 0, u = -1 / 0;
2744
+ t.forEach((f) => {
2745
+ f.aboveY !== 0 && (l = Math.min(l, f.aboveY)), f.belowY !== 0 && (u = Math.max(u, f.belowY));
2746
+ }), e.forEach((f) => {
2747
+ f.aboveY !== 0 && (l = Math.min(l, f.aboveY)), f.belowY !== 0 && (u = Math.max(u, f.belowY));
2748
+ }), s.forEach((f) => {
2749
+ if (!f.sourceNode || !f.targetNode) return;
2750
+ const h = n.get(f.sourceNode._gvid), g = n.get(f.targetNode._gvid);
2751
+ if (h === void 0 || g === void 0) return;
2752
+ const m = Math.min(h, g), x = Math.max(h, g), y = [];
2753
+ for (let C = m; C <= x; C++) {
2754
+ const R = e.get(C);
2755
+ R && y.push(...R.nodes);
2756
+ }
2757
+ const p = y.map((C) => {
2758
+ const R = C.getPosition();
2759
+ if (!R) return null;
2760
+ const B = r - R[1], st = C.height ? parseFloat(C.height) * et : ue;
2761
+ return { y: B, height: st, bottomY: B + st / 2 };
2762
+ }).filter(
2763
+ (C) => C !== null
2764
+ ).sort((C, R) => C.y - R.y);
2765
+ let w;
2766
+ if (p.length === 0)
2767
+ w = (l + u) / 2;
2768
+ else if (p.length % 2 === 1)
2769
+ w = p[Math.floor(p.length / 2)].bottomY;
2770
+ else {
2771
+ const C = p.length / 2;
2772
+ w = (p[C - 1].bottomY + p[C].bottomY) / 2;
2773
+ }
2774
+ const b = f.getStartPoint(), E = f.getEndPoint(), N = (b && E ? r - (b.y + E.y) / 2 : w) < w ? "above" : "below";
2775
+ f.baseDirection = N;
2776
+ const A = f.label ? o + c : o;
2777
+ let P;
2778
+ N === "above" ? (f.midY = l - A, P = l, l = f.midY) : (f.midY = u + A, P = u, u = f.midY);
2779
+ const D = Tt(
2780
+ f,
2781
+ r,
2782
+ { midY: P },
2783
+ i
2784
+ );
2785
+ D && (f.midY = D.midY, f.orthogonalPathPoints = D.points, N === "above" ? l = Math.min(l, D.midY) : u = Math.max(u, D.midY));
2786
+ });
2787
+ }
2788
+ function pa(t) {
2789
+ if (!t.sourceNode) return null;
2790
+ const e = t.sourceNode.getPosition();
2791
+ if (!e) return null;
2792
+ const n = an / et, r = new un({
2793
+ _gvid: -1e3 - t._gvid,
2794
+ // Negative ID to distinguish from real nodes
2795
+ name: `virtual_edge_${t._gvid}`,
2796
+ label: t.label,
2797
+ pos: `${e[0]},${e[1]}`,
2798
+ // Same position as source node
2799
+ width: "0.5",
2800
+ // Small width
2801
+ height: n.toString()
2802
+ // Height matches node spacing
2803
+ });
2804
+ return r.virtualNode = !0, r.edge = t, t.virtualNode = r, r;
2805
+ }
2806
+ function ma(t, e, n) {
2807
+ const r = e.nodes, i = r.findIndex((a) => a._gvid === n._gvid);
2808
+ if (i === -1) {
2809
+ r.push(t);
2810
+ return;
2811
+ }
2812
+ r.splice(i, 0, t);
2813
+ }
2814
+ function ya(t, e) {
2815
+ const n = qo, r = [], i = /* @__PURE__ */ new Map();
2816
+ t.forEach((l) => {
2817
+ const u = l.getPosition();
2818
+ if (!u) return;
2819
+ const f = u[0];
2820
+ let h = r.findIndex(
2821
+ (g) => Math.abs(f - g) <= n
2822
+ );
2823
+ h === -1 && (h = r.length, r.push(f)), i.set(l._gvid, h);
2824
+ });
2825
+ const a = r.map((l, u) => ({ x: l, i: u })).sort((l, u) => l.x - u.x).map((l, u) => ({ oldIndex: l.i, newIndex: u })), o = /* @__PURE__ */ new Map();
2826
+ a.forEach(({ oldIndex: l, newIndex: u }) => {
2827
+ o.set(l, u);
2828
+ });
2829
+ for (const [l, u] of i)
2830
+ i.set(l, o.get(u) ?? u);
2831
+ const c = /* @__PURE__ */ new Map();
2832
+ t.forEach((l) => {
2833
+ const u = i.get(l._gvid);
2834
+ u !== void 0 && (c.has(u) || c.set(u, new jo(u, 0)), c.get(u).addNode(l, !1));
2835
+ }), e.forEach((l) => {
2836
+ if (!l.sourceNode || !l.targetNode || l.sourceNode._gvid !== l.targetNode._gvid) return;
2837
+ const u = i.get(l.sourceNode._gvid);
2838
+ if (u === void 0) return;
2839
+ const f = c.get(u);
2840
+ if (!f) return;
2841
+ const h = pa(l);
2842
+ h && ma(h, f, l.sourceNode);
2843
+ });
2844
+ const s = /* @__PURE__ */ new Map();
2845
+ return e.forEach((l) => {
2846
+ if (!l.sourceNode || !l.targetNode) return;
2847
+ const u = i.get(l.sourceNode._gvid), f = i.get(l.targetNode._gvid);
2848
+ if (u === void 0 || f === void 0) return;
2849
+ l.depth = Math.abs(f - u) - 1, l.depth < 0 && (l.depth = 0);
2850
+ const h = Math.min(u, f), g = Math.max(u, f), m = `${h}-${g}`;
2851
+ s.has(m) || s.set(m, new ta(u, f, 0)), s.get(m).addEdge(l);
2852
+ }), s.forEach((l) => {
2853
+ l.edges.sort((u, f) => {
2854
+ const h = u.getStartPoint(), g = u.getEndPoint(), m = h && g ? (h.y + g.y) / 2 : 0, x = f.getStartPoint(), y = f.getEndPoint();
2855
+ return (x && y ? (x.y + y.y) / 2 : 0) - m;
2856
+ });
2857
+ }), { nodeColumnMap: i, nodeColumns: c, edgeColumns: s };
2858
+ }
2859
+ function xa(t, e) {
2860
+ t.forEach((n) => {
2861
+ if (n.nodes.length === 0) return;
2862
+ let r = !0;
2863
+ n.nodes.forEach((i) => {
2864
+ const a = i.getPosition();
2865
+ if (!a) return;
2866
+ const o = i.height ? parseFloat(i.height) * et : ue, c = e - a[1], s = c - o / 2, l = c + o / 2;
2867
+ r ? (n.aboveY = s, n.belowY = l, r = !1) : (n.aboveY = Math.min(n.aboveY, s), n.belowY = Math.max(n.belowY, l));
2868
+ });
2869
+ });
2870
+ }
2871
+ function _a(t, e) {
2872
+ t.length !== 0 && e.forEach((n) => {
2873
+ const r = n.edges;
2874
+ if (r.length === 0) return;
2875
+ const i = r.filter((f) => f.depth === 0);
2876
+ if (i.length === 0) return;
2877
+ const a = Math.floor(i.length / 2), o = i[a];
2878
+ o.isBaseEdge = !0, o.baseDirection = void 0;
2879
+ const c = r.indexOf(o);
2880
+ n.setBaseEdge(o, c);
2881
+ const s = o.getStartPoint(), l = o.getEndPoint(), u = s && l ? (s.y + l.y) / 2 : 0;
2882
+ i.forEach((f) => {
2883
+ if (f === o) return;
2884
+ const h = f.getStartPoint(), g = f.getEndPoint();
2885
+ (h && g ? (h.y + g.y) / 2 : 0) > u ? f.baseDirection = "above" : f.baseDirection = "below";
2886
+ });
2887
+ });
2888
+ }
2889
+ function wa(t, e, n) {
2890
+ const i = (t.objects || []).map(
2891
+ (s) => new un({
2892
+ _gvid: s._gvid,
2893
+ name: s.name,
2894
+ _draw_: s._draw_,
2895
+ _ldraw_: s._ldraw_,
2896
+ bb: s.bb,
2897
+ pos: s.pos,
2898
+ // Apply custom node dimensions if provided (convert points to inches)
2899
+ width: e !== null ? String(e / et) : s.width,
2900
+ height: n !== null ? String(n / et) : s.height,
2901
+ label: s.label
2902
+ })
2903
+ ), a = /* @__PURE__ */ new Map();
2904
+ i.forEach((s) => {
2905
+ a.set(s._gvid, s);
2906
+ });
2907
+ const c = (t.edges || []).map((s) => {
2908
+ const l = new Jo({
2909
+ _gvid: s._gvid,
2910
+ name: s.name,
2911
+ _draw_: s._draw_,
2912
+ _ldraw_: s._ldraw_,
2913
+ _hdraw_: s._hdraw_,
2914
+ _tdraw_: s._tdraw_,
2915
+ head: s.head,
2916
+ tail: s.tail,
2917
+ label: s.label
2918
+ }), u = s.tail !== void 0 ? a.get(s.tail) : void 0, f = s.head !== void 0 ? a.get(s.head) : void 0;
2919
+ return u && f && l.setNodes(u, f), l;
2920
+ });
2921
+ return { nodes: i, edges: c };
2922
+ }
2923
+ function va(t, e, n, r) {
2924
+ let i = 0;
2925
+ t.forEach((o) => {
2926
+ i = Math.max(i, o.getWidthPoints());
2927
+ });
2928
+ let a = 0;
2929
+ return e.forEach((o) => {
2930
+ if (o.depth !== 0 || !o.label || o.getDirection() === "self") return;
2931
+ const { boxWidth: c } = dn(o, n, r);
2932
+ a = Math.max(a, c);
2933
+ }), i + 2 * n.horizontalExtension + a + 2 * Uo;
2934
+ }
2935
+ function ba(t, e, n) {
2936
+ const r = Array.from(t.keys()).sort((l, u) => l - u), i = r.length, a = Xo, o = n, s = (i > 1 ? (i - 1) * o : 0) + 2 * a;
2937
+ return r.forEach((l, u) => {
2938
+ const f = t.get(l);
2939
+ if (!f) return;
2940
+ const h = f.nodes;
2941
+ if (h.length === 0) return;
2942
+ const g = i > 1 ? a + u * o : s / 2;
2943
+ h.sort((N, A) => {
2944
+ const P = N.getPosition(), D = A.getPosition();
2945
+ return !P || !D ? 0 : D[1] - P[1];
2946
+ });
2947
+ const m = an, x = h.filter((N) => !N.virtualNode), y = x.length;
2948
+ if (y === 0) {
2949
+ let N = (e + h.reduce((A, P) => A + P.getHeightPoints(), 0)) / 2;
2950
+ h.forEach((A) => {
2951
+ const P = A.getHeightPoints();
2952
+ N -= P / 2, A.pos = `${g},${N}`, N -= P / 2;
2953
+ });
2954
+ return;
2955
+ }
2956
+ let p, w;
2957
+ if (y % 2 === 1) {
2958
+ const N = Math.floor(y / 2), A = x[N];
2959
+ w = h.indexOf(A), p = e / 2;
2960
+ } else {
2961
+ const N = y / 2 - 1, A = x[N];
2962
+ w = h.indexOf(A), p = e / 2;
2963
+ }
2964
+ const b = h[w], E = b.getHeightPoints();
2965
+ b.pos = `${g},${p}`;
2966
+ let S = p + E / 2;
2967
+ for (let N = w - 1; N >= 0; N--) {
2968
+ const A = h[N], P = h[N + 1], D = A.getHeightPoints(), C = A.virtualNode || P.virtualNode ? 0 : m;
2969
+ S += C + D / 2, A.pos = `${g},${S}`, S += D / 2;
2970
+ }
2971
+ S = p - E / 2;
2972
+ for (let N = w + 1; N < h.length; N++) {
2973
+ const A = h[N], P = h[N - 1], D = A.getHeightPoints(), C = A.virtualNode || P.virtualNode ? 0 : m;
2974
+ S -= C + D / 2, A.pos = `${g},${S}`, S -= D / 2;
2975
+ }
2976
+ }), s;
2977
+ }
2978
+ function Ea(t, e, n) {
2979
+ t.style("cursor", "pointer").on("mouseenter", function() {
2980
+ if (e.attr("opacity", 1), n.select(".edge.selected").size() > 0)
2981
+ return;
2982
+ const i = z(this).attr("data-node-id"), a = /* @__PURE__ */ new Set([i]);
2983
+ n.selectAll(".edge").each(function() {
2984
+ const o = z(this).attr("data-source-node-id"), c = z(this).attr("data-target-node-id");
2985
+ o === i || c === i ? o === i ? a.add(c) : a.add(o) : z(this).classed("dimmed", !0);
2986
+ }), n.selectAll(".node").each(function() {
2987
+ const o = z(this).attr("data-node-id");
2988
+ a.has(o) || z(this).classed("dimmed", !0);
2989
+ });
2990
+ }).on("mouseleave", function() {
2991
+ e.attr("opacity", 0), n.selectAll(".edge.dimmed").classed("dimmed", !1), n.selectAll(".node.dimmed").classed("dimmed", !1);
2992
+ });
2993
+ }
2994
+ function Na(t) {
2995
+ const {
2996
+ nodeGroup: e,
2997
+ g: n,
2998
+ x: r,
2999
+ y: i,
3000
+ w: a,
3001
+ h: o,
3002
+ height: c,
3003
+ badges: s,
3004
+ labelText: l,
3005
+ addressText: u,
3006
+ nodeTextColor: f,
3007
+ nodeBackground: h,
3008
+ hasCustomBackground: g
3009
+ } = t, m = o / 2, x = o / 2, y = c - i - o / 2, p = 4, w = "var(--border-primary, #CDCFD5)";
3010
+ e.append("path").attr("d", ne(
3011
+ r - a / 2,
3012
+ y,
3013
+ a,
3014
+ m,
3015
+ { topLeft: p, topRight: p }
3016
+ )).attr("fill", g ? h : "var(--bg-quaternary, #E1E2E5)").attr("stroke", w).attr("stroke-width", 1), g && e.append("line").attr("x1", r - a / 2).attr("y1", y + m).attr("x2", r + a / 2).attr("y2", y + m).attr("stroke", f).attr("stroke-width", 1), e.append("path").attr("d", ne(
3017
+ r - a / 2,
3018
+ y + m,
3019
+ a,
3020
+ x,
3021
+ { bottomLeft: p, bottomRight: p }
3022
+ )).attr("fill", g ? h : "var(--bg-primary, #fff)").attr("stroke", w).attr("stroke-width", 1);
3023
+ const b = e.append("rect").attr("x", r - a / 2 - 4).attr("y", y - 4).attr("width", a + 8).attr("height", o + 8).attr("rx", 5).attr("ry", 5).attr("fill", "none").attr("stroke", "var(--gray-700, #43444C)").attr("stroke-width", 2).attr("opacity", 0).style("pointer-events", "none");
3024
+ Ea(e, b, n);
3025
+ let E = r - a / 2 + 8;
3026
+ const S = y + m / 2, N = 7.2, A = 6, P = 18, D = 4;
3027
+ if (s.forEach((C) => {
3028
+ const B = C.length * N + A * 2;
3029
+ e.append("rect").attr("x", E).attr("y", S - P / 2).attr("width", B).attr("height", P).attr("rx", 5).attr("ry", 5).attr("fill", "var(--bg-warning-primary, #FFF8E1)").attr("stroke", "var(--border-warning-light, #FFD66D)").attr("stroke-width", 1), e.append("text").attr("x", E + A).attr("y", S).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", "var(--font-inter), Inter, Helvetica, Arial").attr("font-size", "12px").attr("font-weight", "500").attr("fill", "var(--text-warning-primary, #CD7004)").text(C), E += B + D;
3030
+ }), l) {
3031
+ const C = r + a / 2 - 8 - E, R = e.append("text").attr("x", E).attr("y", S).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", "var(--font-inter), Inter, Helvetica, Arial").attr("font-size", "12px").attr("font-weight", "600").attr("fill", f);
3032
+ ee(R, C, l);
3033
+ }
3034
+ if (u) {
3035
+ const C = a - 16, R = e.append("text").attr("x", r - a / 2 + 8).attr("y", y + m + x / 2).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", "var(--font-fira-code), Fira Code, monospace").attr("font-size", "12px").attr("font-weight", "400").attr("fill", f);
3036
+ ee(R, C, u);
3037
+ }
3038
+ }
3039
+ function $a(t) {
3040
+ const {
3041
+ nodeGroup: e,
3042
+ x: n,
3043
+ y: r,
3044
+ w: i,
3045
+ h: a,
3046
+ height: o,
3047
+ isVirtual: c,
3048
+ showVirtualStyle: s,
3049
+ nodeContent: l,
3050
+ labelText: u,
3051
+ addressText: f,
3052
+ nodeTextColor: h,
3053
+ nodeBackground: g,
3054
+ hasCustomBackground: m
3055
+ } = t, x = 4, y = s ? "#EF4444" : "var(--border-primary, #CDCFD5)", p = e.append("path").attr("d", ne(
3056
+ n - i / 2,
3057
+ o - r - a / 2,
3058
+ i,
3059
+ a,
3060
+ { topLeft: x, topRight: x, bottomLeft: x, bottomRight: x }
3061
+ )).attr("fill", m ? g : "var(--bg-primary, #fff)").attr("stroke", y).attr("stroke-width", s ? 2 : 1);
3062
+ if (!c) {
3063
+ const w = e.append("rect").attr("x", n - i / 2 - 4).attr("y", o - r - a / 2 - 4).attr("width", i + 8).attr("height", a + 8).attr("rx", 5).attr("ry", 5).attr("fill", "none").attr("stroke", "#000000").attr("stroke-width", 2).attr("opacity", 0).style("pointer-events", "none");
3064
+ p.style("cursor", "pointer").on("mouseenter", function() {
3065
+ w.attr("opacity", 1);
3066
+ }).on("mouseleave", function() {
3067
+ w.attr("opacity", 0);
3068
+ });
3069
+ }
3070
+ if (l)
3071
+ if (c) {
3072
+ const w = u || f;
3073
+ e.append("text").attr("x", n).attr("y", o - r).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("font-family", "Inter, Helvetica, Arial").attr("font-size", "10px").attr("fill", "#991B1B").text(
3074
+ w.length > 20 ? w.slice(0, 20) + "..." : w
3075
+ );
3076
+ } else {
3077
+ const w = f || u, b = i - 16, E = e.append("text").attr("x", n - i / 2 + 8).attr("y", o - r).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", "var(--font-fira-code), Fira Code, monospace").attr("font-size", "12px").attr("font-weight", "400").attr("fill", h);
3078
+ ee(E, b, w);
3079
+ }
3080
+ }
3081
+ function Sa(t, e, n, r) {
3082
+ const i = t.getPosition();
3083
+ if (!i) return;
3084
+ const [a, o] = i, c = t.getWidthPoints(), s = t.getHeightPoints(), l = t.virtualNode;
3085
+ if (l && !r) return;
3086
+ const u = e.append("g").attr("class", l ? "node virtual-node" : "node").attr("id", t.name).attr("data-node-id", t.name);
3087
+ let f = null;
3088
+ try {
3089
+ t.label && (f = Mt(t.label));
3090
+ } catch (S) {
3091
+ f = sa(t.label), f || console.warn(`Failed to decode node label for ${t.name}:`, S);
3092
+ }
3093
+ f != null && f.key && u.attr("data-key", f.key);
3094
+ const h = r && l, g = (f == null ? void 0 : f.tags) || [], m = (f == null ? void 0 : f.label) || "", x = (f == null ? void 0 : f.text) || "", y = (f == null ? void 0 : f.color) || "var(--text-primary, #171921)", p = (f == null ? void 0 : f.background) || "white", w = p !== "white", b = g.length > 0 || m.length > 0, E = {
3095
+ nodeGroup: u,
3096
+ g: e,
3097
+ x: a,
3098
+ y: o,
3099
+ w: c,
3100
+ h: s,
3101
+ height: n,
3102
+ isVirtual: l,
3103
+ showVirtualStyle: h,
3104
+ nodeContent: f,
3105
+ badges: g,
3106
+ labelText: m,
3107
+ addressText: x,
3108
+ nodeTextColor: y,
3109
+ nodeBackground: p,
3110
+ hasCustomBackground: w
3111
+ };
3112
+ b && !l ? Na(E) : $a(E), !t.label && t._ldraw_ && t._ldraw_.length > 0 && !l && t._ldraw_.forEach((S) => {
3113
+ S.op === "T" && S.text && u.append("text").attr("x", a - c / 2 + 8).attr("y", n - o).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", S.face || "Inter, Helvetica, Arial").attr("font-size", `${S.size || 11}px`).attr("fill", S.color || "#334155").text(S.text);
3114
+ });
3115
+ }
3116
+ function ka(t, e, n, r) {
3117
+ e.forEach((i) => {
3118
+ i.nodes.forEach((a) => {
3119
+ Sa(a, t, n, r);
3120
+ });
3121
+ });
3122
+ }
3123
+ const Aa = `
3124
+ <style>
3125
+ @keyframes selected-pulse {
3126
+ 0%, 100% {
3127
+ stroke-opacity: 1;
3128
+ }
3129
+ 50% {
3130
+ stroke-opacity: 0.7;
3131
+ }
3132
+ }
3133
+ .edge {
3134
+ cursor: pointer;
3135
+ }
3136
+ .edge path {
3137
+ /* No transition on dash properties to avoid conflict with animation */
3138
+ }
3139
+ .edge use {
3140
+ transition: transform 0.2s ease;
3141
+ }
3142
+ .edge text {
3143
+ transition: font-weight 0.2s ease;
3144
+ }
3145
+ /* Marching ants animation keyframe */
3146
+ @keyframes marching-ants {
3147
+ 0% { stroke-dashoffset: 0; }
3148
+ 100% { stroke-dashoffset: -12; }
3149
+ }
3150
+ /* Arrow group scaling transition (JS handles actual transform) */
3151
+ .edge .arrow-group {
3152
+ transition: transform 0.15s ease;
3153
+ }
3154
+ /* Hover effect: marching ants dashed line */
3155
+ .edge:hover:not(.selected) path.edge-path {
3156
+ stroke-dasharray: 6 6;
3157
+ stroke-width: 4px;
3158
+ animation: marching-ants 0.6s linear infinite;
3159
+ }
3160
+ /* Selected effect: marching ants dashed line */
3161
+ .edge.selected path.edge-path {
3162
+ stroke-dasharray: 6 6;
3163
+ stroke-width: 4px;
3164
+ animation: marching-ants 0.6s linear infinite;
3165
+ }
3166
+ /* Dimmed state for edge hover focus effect */
3167
+ .edge.dimmed,
3168
+ .node.dimmed {
3169
+ opacity: 0.3;
3170
+ transition: opacity 0.2s ease;
3171
+ }
3172
+ .edge:not(.dimmed),
3173
+ .node:not(.dimmed) {
3174
+ transition: opacity 0.2s ease;
3175
+ }
3176
+ /* Selection-based dimming - unrelated elements when edge is selected */
3177
+ .edge.selection-dimmed,
3178
+ .node.selection-dimmed {
3179
+ opacity: 0.3;
3180
+ transition: opacity 0.2s ease;
3181
+ }
3182
+ /* Hover highlight overrides selection-dimmed to restore visibility */
3183
+ .edge.hover-highlight,
3184
+ .node.hover-highlight {
3185
+ opacity: 1 !important;
3186
+ transition: opacity 0.2s ease;
3187
+ }
3188
+ /* Selected edge should always be at full opacity */
3189
+ .edge.selected {
3190
+ opacity: 1 !important;
3191
+ }
3192
+ </style>
3193
+ <symbol id="arrow-right" viewBox="0 0 12 12">
3194
+ <path d="M11.53 5.46967C11.8229 5.76256 11.8229 6.23744 11.53 6.53033L6.75736 11.303C6.46447 11.5959 5.98959 11.5959 5.6967 11.303C5.40381 11.0101 5.40381 10.5352 5.6967 10.2423L9.93934 6L5.6967 1.75736C5.40381 1.46447 5.40381 0.989593 5.6967 0.696699C5.98959 0.403806 6.46447 0.403806 6.75736 0.696699L11.53 5.46967ZM0 5.25H11V6.75H0V5.25Z"/>
3195
+ </symbol>
3196
+ `, Ta = `
3197
+ <style>
3198
+ .node rect, .node ellipse, .node polygon {
3199
+ cursor: pointer;
3200
+ }
3201
+ .edge {
3202
+ cursor: pointer;
3203
+ }
3204
+ </style>
3205
+ `;
3206
+ function rt(t, e, n) {
3207
+ let r = "#000000", i = "#000000", a = "#000000";
3208
+ e.forEach((o) => {
3209
+ switch (o.op) {
3210
+ case "c":
3211
+ o.color && (r = o.color);
3212
+ break;
3213
+ case "C":
3214
+ o.color && (i = o.color);
3215
+ break;
3216
+ case "F":
3217
+ o.color && (a = o.color);
3218
+ break;
3219
+ case "T":
3220
+ o.pt && o.text && t.append("text").attr("x", o.pt[0]).attr("y", n - o.pt[1]).attr(
3221
+ "text-anchor",
3222
+ o.align === "l" ? "start" : o.align === "r" ? "end" : "middle"
3223
+ ).attr("font-family", o.face || "Inter, Helvetica, Arial").attr("font-size", `${o.size || 12}px`).attr("fill", o.color || a).text(o.text);
3224
+ break;
3225
+ case "p":
3226
+ if (o.points) {
3227
+ const c = o.points.map(([s, l]) => [s, n - l]);
3228
+ t.append("polygon").attr("points", c.map((s) => s.join(",")).join(" ")).attr("fill", i).attr("stroke", r);
3229
+ }
3230
+ break;
3231
+ case "P":
3232
+ if (o.points) {
3233
+ const c = o.points.map(([s, l]) => [s, n - l]);
3234
+ t.append("polygon").attr("points", c.map((s) => s.join(",")).join(" ")).attr("fill", "none").attr("stroke", r);
3235
+ }
3236
+ break;
3237
+ case "e":
3238
+ if (o.rect) {
3239
+ const [c, s, l, u] = o.rect;
3240
+ t.append("ellipse").attr("cx", c).attr("cy", n - s).attr("rx", l).attr("ry", u).attr("fill", i).attr("stroke", r);
3241
+ }
3242
+ break;
3243
+ case "E":
3244
+ if (o.rect) {
3245
+ const [c, s, l, u] = o.rect;
3246
+ t.append("ellipse").attr("cx", c).attr("cy", n - s).attr("rx", l).attr("ry", u).attr("fill", "none").attr("stroke", r);
3247
+ }
3248
+ break;
3249
+ case "b":
3250
+ if (o.points) {
3251
+ const c = o.points.map(([l, u]) => [l, n - u]), s = `M${c[0][0]},${c[0][1]} C${c.slice(1).map((l) => `${l[0]},${l[1]}`).join(" ")}`;
3252
+ t.append("path").attr("d", s).attr("fill", "none").attr("stroke", r).attr("stroke-width", 1);
3253
+ }
3254
+ break;
3255
+ case "B":
3256
+ if (o.points) {
3257
+ const c = o.points.map(([l, u]) => [l, n - u]), s = `M${c[0][0]},${c[0][1]} C${c.slice(1).map((l) => `${l[0]},${l[1]}`).join(" ")}`;
3258
+ t.append("path").attr("d", s).attr("fill", i).attr("stroke", r).attr("stroke-width", 1);
3259
+ }
3260
+ break;
3261
+ case "L":
3262
+ if (o.points) {
3263
+ const s = `M${o.points.map(([l, u]) => [l, n - u]).map((l) => `${l[0]},${l[1]}`).join(" L")}`;
3264
+ t.append("path").attr("d", s).attr("fill", "none").attr("stroke", r).attr("stroke-width", 1);
3265
+ }
3266
+ break;
3267
+ }
3268
+ });
3269
+ }
3270
+ function Ga(t, e, n = 14) {
3271
+ var y;
3272
+ t.innerHTML = "";
3273
+ const r = ((y = e.bb) == null ? void 0 : y.split(",").map(Number)) || cn, [, , i, a] = r, o = z(t).append("svg").attr("width", "100%").attr("height", "100%").attr("viewBox", `0 0 ${i} ${a}`);
3274
+ o.append("defs").html(Ta);
3275
+ const c = o.append("g").attr("id", "graph0");
3276
+ (e.objects || []).forEach((p) => {
3277
+ const w = c.append("g").attr("class", "node").attr("id", p.name);
3278
+ p._draw_ && rt(w, p._draw_, a), p._ldraw_ && rt(w, p._ldraw_, a);
3279
+ });
3280
+ const l = e.edges || [];
3281
+ l.forEach((p) => {
3282
+ const w = c.append("g").attr("class", "edge").attr("id", `edge_${p._gvid}`);
3283
+ p._draw_ && rt(w, p._draw_, a), p._hdraw_ && rt(w, p._hdraw_, a), p._tdraw_ && rt(w, p._tdraw_, a), p._ldraw_ && rt(w, p._ldraw_, a);
3284
+ });
3285
+ const u = on().scaleExtent([0.1, 10]).on("zoom", (p) => {
3286
+ c.attr("transform", p.transform.toString());
3287
+ });
3288
+ o.call(u);
3289
+ const f = t.clientWidth || sn, h = n * (f / i), g = l.filter((p) => {
3290
+ if (!p.label) return !1;
3291
+ try {
3292
+ const w = Mt(p.label);
3293
+ return (w == null ? void 0 : w.index) !== void 0;
3294
+ } catch {
3295
+ return !1;
3296
+ }
3297
+ }).map((p) => {
3298
+ var b;
3299
+ const w = Mt(p.label);
3300
+ return {
3301
+ id: p._gvid,
3302
+ index: w.index,
3303
+ sourceNodeId: String(p.tail ?? ""),
3304
+ targetNodeId: String(p.head ?? ""),
3305
+ label: ((b = w.elems) == null ? void 0 : b.map((E) => E.text).join(" ")) || null
3306
+ };
3307
+ }).sort((p, w) => p.index - w.index), m = o.node(), x = c.node();
3308
+ if (!m || !x)
3309
+ throw new Error("Failed to construct SVG elements");
3310
+ return {
3311
+ zoomBehavior: u,
3312
+ svgElement: m,
3313
+ gElement: x,
3314
+ baseFontSize: h,
3315
+ viewBoxWidth: i,
3316
+ edges: g
3317
+ };
3318
+ }
3319
+ const Ma = "data-label-center-x", Ca = "data-label-center-y";
3320
+ function Ia(t, e, n) {
3321
+ const i = (t.clientWidth || sn) / e, a = Ko / (n * i);
3322
+ return Math.max(Qo, a);
3323
+ }
3324
+ function Pa(t, e, n, r) {
3325
+ if (e.initialTransform)
3326
+ return e.initialTransform;
3327
+ if (e.headless) {
3328
+ const l = te;
3329
+ return {
3330
+ x: n / 2 - n / 2 * l,
3331
+ y: r / 2 - r / 2 * l,
3332
+ k: l
3333
+ };
3334
+ }
3335
+ const i = t.node(), a = i ? i.getBBox() : { x: 0, y: 0, width: n, height: r }, o = te * n / a.width, c = a.x + a.width / 2, s = a.y + a.height / 2;
3336
+ return {
3337
+ x: n / 2 - c * o,
3338
+ y: r / 2 - s * o,
3339
+ k: o
3340
+ };
3341
+ }
3342
+ function Va(t, e) {
3343
+ return te * t / e;
3344
+ }
3345
+ function Xa(t, e, n) {
3346
+ const r = e / n;
3347
+ return Zo / (t * r);
3348
+ }
3349
+ function Da(t, e, n, r) {
3350
+ return on().scaleExtent([0.1, Ia(e, n, r)]).on("zoom", (i) => {
3351
+ const a = i.transform;
3352
+ !isNaN(a.x) && !isNaN(a.y) && !isNaN(a.k) && t.attr("transform", a.toString());
3353
+ });
3354
+ }
3355
+ function za(t, e) {
3356
+ t.on("mouseenter", function() {
3357
+ z(this).raise();
3358
+ const n = z(this).select(".arrow-group");
3359
+ if (!n.empty()) {
3360
+ const s = n.attr("data-base-transform") || "";
3361
+ n.attr("transform", s + " scale(1.3)");
3362
+ }
3363
+ const r = e.select(".edge.selected").size() > 0, i = z(this).classed("selected"), a = z(this).attr("data-source-node-id"), o = z(this).attr("data-target-node-id"), c = z(this).attr("id");
3364
+ r && !i ? (z(this).classed("hover-highlight", !0), e.selectAll(".node").each(function() {
3365
+ const s = z(this).attr("data-node-id");
3366
+ (s === a || s === o) && z(this).classed("hover-highlight", !0);
3367
+ })) : (e.selectAll(".edge").each(function() {
3368
+ z(this).attr("id") !== c && z(this).classed("dimmed", !0);
3369
+ }), e.selectAll(".node").each(function() {
3370
+ const s = z(this).attr("data-node-id");
3371
+ s !== a && s !== o && z(this).classed("dimmed", !0);
3372
+ }));
3373
+ }).on("mouseleave", function() {
3374
+ const n = z(this).select(".arrow-group");
3375
+ if (!n.empty()) {
3376
+ const r = n.attr("data-base-transform") || "";
3377
+ n.attr("transform", r);
3378
+ }
3379
+ e.selectAll(".edge.hover-highlight").classed("hover-highlight", !1), e.selectAll(".node.hover-highlight").classed("hover-highlight", !1), e.selectAll(".edge.dimmed").classed("dimmed", !1), e.selectAll(".node.dimmed").classed("dimmed", !1);
3380
+ });
3381
+ }
3382
+ function Ya(t, e, n, r, i, a) {
3383
+ if (e && e.length > 0) {
3384
+ const f = e.map((m) => {
3385
+ const x = m.text.length * 6.2, y = m.background && m.background !== "transparent", p = x + 2;
3386
+ return { textWidth: x, hasBackground: y, totalWidth: p };
3387
+ }), h = f.reduce((m, x, y) => m + x.totalWidth + (y > 0, 0), 0);
3388
+ let g = n - h / 2;
3389
+ e.forEach((m, x) => {
3390
+ const y = f[x];
3391
+ x > 0 && (g += 0), y.hasBackground && t.append("rect").attr("x", g).attr("y", r - 10 / 2 - 2).attr("width", y.totalWidth).attr("height", 14).attr("rx", 2).attr("ry", 2).attr("fill", m.background).style("pointer-events", "none"), t.append("text").attr("class", "label-text-elem").attr("x", g + 1).attr("y", r).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", "Inter, Helvetica, Arial").attr("font-size", "10px").attr("font-weight", "500").attr("fill", m.color && m.color.length > 0 ? m.color : i).style("pointer-events", "none").text(m.text), g += y.totalWidth;
3392
+ });
3393
+ } else
3394
+ t.append("text").attr("class", "label-text").attr("x", n).attr("y", r).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("font-family", "Inter, Helvetica, Arial").attr("font-size", "10px").attr("fill", i).style("pointer-events", "none").text(a);
3395
+ }
3396
+ function Ra(t) {
3397
+ const { edge: e, edgeGroup: n, labelMidpoint: r, edgeColor: i, isSelected: a, ctx: o } = t, { config: c, onEdgeSelect: s, debug: l } = o, { displayElems: u, finalText: f, boxWidth: h, boxHeight: g } = dn(e, c, o.edgeCount), m = e.edgeIndex !== void 0, x = h, y = g, p = r.y, w = r.x, b = n.append("g").attr("class", "label-area");
3398
+ b.append("rect").attr("class", "label-bg").attr("x", w - x / 2).attr("y", p - y / 2).attr("width", x).attr("height", y).attr("rx", 5).attr("ry", 5).attr("fill", "var(--bg-primary, #fff)").attr("stroke", "var(--border-primary, #CDCFD5)").attr("stroke-width", 1.5);
3399
+ const E = w;
3400
+ m && s && n.style("cursor", "pointer").on("click", function(S) {
3401
+ S.stopPropagation(), !a && s(e.edgeIndex);
3402
+ }), Ya(b, u, E, p, i, f), l && n.append("circle").attr("cx", r.x).attr("cy", r.y).attr("r", 4).attr("fill", "blue").attr("opacity", 0.8).style("pointer-events", "none").attr("class", "debug-label-center");
3403
+ }
3404
+ function La(t, e, n) {
3405
+ e._ldraw_.forEach((r) => {
3406
+ if (r.op === "T" && r.text) {
3407
+ const i = r.size || 10, a = i * 0.6, o = r.text.length * a, c = i, s = 6, l = o + s * 2, u = c + s * 2, f = 4, h = n.y;
3408
+ t.append("rect").attr("x", n.x - l / 2).attr("y", h - u / 2).attr("width", l).attr("height", u).attr("rx", f).attr("ry", f).attr("fill", "white").attr("stroke", "#d0d0d0").attr("stroke-width", 0.5), t.append("text").attr("x", n.x).attr("y", h).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("font-family", r.face || "Inter, Helvetica, Arial").attr("font-size", `${i}px`).attr("fill", r.color || "#666").text(r.text);
3409
+ }
3410
+ });
3411
+ }
3412
+ function Ba(t, e, n) {
3413
+ e._draw_ && e._draw_.forEach((r) => {
3414
+ if (r.op === "b" && r.points) {
3415
+ const i = r.points.map(([o, c]) => [o, n - c]), a = `M${i[0][0]},${i[0][1]} C${i.slice(1).map((o) => `${o[0]},${o[1]}`).join(" ")}`;
3416
+ t.append("path").attr("d", a).attr("fill", "none").attr("stroke", r.color || "#9AA4B2").attr("stroke-width", 2);
3417
+ }
3418
+ }), e._hdraw_ && e._hdraw_.forEach((r) => {
3419
+ if (r.op === "P" && r.points) {
3420
+ const i = r.points.map(([a, o]) => [a, n - o]);
3421
+ t.append("polygon").attr("points", i.map((a) => a.join(",")).join(" ")).attr("fill", r.color || "#9AA4B2");
3422
+ }
3423
+ }), e._ldraw_ && rt(t, e._ldraw_, n);
3424
+ }
3425
+ function Ha(t, e) {
3426
+ var C, R;
3427
+ const { g: n, height: r, config: i, useOrthogonalRendering: a, selectedEdgeId: o, debug: c } = e, s = o != null && t.edgeIndex === o, l = t.getColor(), u = n.append("g").attr("class", s ? "edge selected" : "edge").attr("id", `edge_${t._gvid}`).attr("data-edge-id", t.edgeIndex !== void 0 ? String(t.edgeIndex) : "").attr("data-is-base", t.isBaseEdge ? "true" : "false").attr("data-color", l).attr("data-source-node-id", ((C = t.sourceNode) == null ? void 0 : C.name) || "").attr("data-target-node-id", ((R = t.targetNode) == null ? void 0 : R.name) || ""), f = t.getStartPoint(), h = t.getEndPoint(), g = t.getDirection(), m = i.arrowWidth;
3428
+ if (!(f && h && g)) {
3429
+ Ba(u, t, r);
3430
+ return;
3431
+ }
3432
+ const x = { x: f.x, y: r - f.y }, y = { x: h.x, y: r - h.y }, p = { x: y.x, y: y.y };
3433
+ let w = { x: y.x, y: y.y };
3434
+ g === "right" ? w = { x: y.x - m, y: y.y } : g === "left" ? w = { x: y.x + m, y: y.y } : g === "self" && (w = { x: y.x + m, y: y.y });
3435
+ const b = fa(
3436
+ t,
3437
+ g,
3438
+ x,
3439
+ w,
3440
+ r,
3441
+ i,
3442
+ a
3443
+ ), E = c && t.isBaseEdge ? "#000000" : t.getColor(), S = c && t.isBaseEdge ? 4 : 1.5;
3444
+ u.append("path").attr("d", b).attr("fill", "none").attr("stroke", "transparent").attr("stroke-width", 10).attr("class", "edge-hit-area").style("cursor", "pointer"), u.append("path").attr("d", b).attr("fill", "none").attr("stroke", E).attr("stroke-width", S).attr("class", "edge-path").style("pointer-events", "none"), za(u, n);
3445
+ const N = 12;
3446
+ let A = "";
3447
+ g === "right" ? A = `translate(${p.x - N / 2}, ${p.y})` : g === "left" ? A = `translate(${p.x + N / 2}, ${p.y}) rotate(180)` : g === "self" && (A = `translate(${p.x + N / 2}, ${p.y}) rotate(180)`), u.append("g").attr("class", "arrow-group").attr("transform", A).attr("data-base-transform", A).append("use").attr("class", "edge-arrow").attr("href", "#arrow-right").attr("width", N).attr("height", N).attr("x", -N / 2).attr("y", -N / 2).attr("fill", E).attr("stroke", E).style("stroke-width", 0);
3448
+ const D = {
3449
+ x: (x.x + y.x) / 2,
3450
+ y: t.midY
3451
+ };
3452
+ if (u.attr(Ma, D.x).attr(Ca, D.y), t.label ? Ra({
3453
+ edge: t,
3454
+ edgeGroup: u,
3455
+ labelMidpoint: D,
3456
+ edgeColor: E,
3457
+ isSelected: s,
3458
+ ctx: e
3459
+ }) : t._ldraw_ && La(u, t, D), c) {
3460
+ let B;
3461
+ t.depth === 0 ? B = `d:0 dir:${t.baseDirection || "base"} off:${t.baseOffset} id:${t._gvid}` : B = `d:${t.depth} dir:${t.baseDirection || "?"} midY:${Math.round(t.midY)} id:${t._gvid}`, u.append("text").attr("x", D.x).attr("y", D.y + 15).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("font-family", "monospace").attr("font-size", "9px").attr("fill", "#999").text(B);
3462
+ }
3463
+ }
3464
+ function Oa(t) {
3465
+ const e = t.node();
3466
+ if (!e) return;
3467
+ const n = e.getBBox(), r = n.x + n.width / 2, i = n.y + n.height / 2;
3468
+ t.append("rect").attr("x", n.x).attr("y", n.y).attr("width", n.width).attr("height", n.height).attr("fill", "none").attr("stroke", "yellow").attr("stroke-width", 3).attr("opacity", 0.8).style("pointer-events", "none").attr("class", "debug-root-border"), t.append("circle").attr("cx", r).attr("cy", i).attr("r", 10).attr("fill", "yellow").attr("stroke", "orange").attr("stroke-width", 2).attr("opacity", 0.9).style("pointer-events", "none").attr("class", "debug-geometric-center");
3469
+ }
3470
+ function Fa(t, e, n) {
3471
+ const r = Math.max(e, n) * 3e-3;
3472
+ t.append("circle").attr("cx", e / 2).attr("cy", n / 2).attr("r", r).attr("fill", "red").attr("opacity", 0.9).style("pointer-events", "none").attr("class", "debug-center-marker");
3473
+ }
3474
+ function qa(t = {}) {
3475
+ return {
3476
+ nodeMapping: {},
3477
+ maxDepth: null,
3478
+ includeLesserDepths: !0,
3479
+ config: la(),
3480
+ useOrthogonalRendering: !0,
3481
+ svgFontSize: 14,
3482
+ debug: !1,
3483
+ selectedEdgeId: null,
3484
+ onEdgeSelect: void 0,
3485
+ nodeWidth: Go,
3486
+ nodeHeight: Vo,
3487
+ nodeColumnSpacing: null,
3488
+ enableWheelZoom: !0,
3489
+ headless: !1,
3490
+ initialTransform: void 0,
3491
+ ...t
3492
+ };
3493
+ }
3494
+ function Ua(t, e, n) {
3495
+ var I;
3496
+ const {
3497
+ maxDepth: r,
3498
+ includeLesserDepths: i,
3499
+ config: a,
3500
+ useOrthogonalRendering: o,
3501
+ svgFontSize: c,
3502
+ debug: s,
3503
+ selectedEdgeId: l,
3504
+ onEdgeSelect: u,
3505
+ nodeWidth: f,
3506
+ nodeHeight: h,
3507
+ nodeColumnSpacing: g,
3508
+ enableWheelZoom: m,
3509
+ headless: x
3510
+ } = n;
3511
+ t.innerHTML = "";
3512
+ const y = ((I = e.bb) == null ? void 0 : I.split(",").map(Number)) || cn, [, , p, w] = y;
3513
+ let b = p;
3514
+ const E = w, S = z(t).append("svg").attr("width", "100%").attr("height", "100%").attr("viewBox", `0 0 ${b} ${E}`);
3515
+ S.append("defs").html(Aa);
3516
+ const N = S.append("g").attr("id", "graph0"), { nodes: A, edges: P } = wa(e, f, h), { nodeColumnMap: D, nodeColumns: C, edgeColumns: R } = ya(
3517
+ A,
3518
+ P
3519
+ ), B = P.length, st = g ?? va(A, P, a, B);
3520
+ b = ba(C, E, st), S.attr("viewBox", `0 0 ${b} ${E}`), ka(N, C, E, s), o && (xa(C, E), _a(P, R), ha(R, C, D, E, a));
3521
+ const d = Da(N, t, b, c);
3522
+ x || S.call(d), !x && !m && (S.on("wheel.zoom", null), S.on("dblclick.zoom", null)), P.forEach((T) => {
3523
+ if (r !== null) {
3524
+ if (i) {
3525
+ if (T.depth > r) return;
3526
+ } else if (T.depth !== r) return;
3527
+ }
3528
+ Ha(T, {
3529
+ g: N,
3530
+ height: E,
3531
+ config: a,
3532
+ useOrthogonalRendering: o,
3533
+ zoomBehavior: d,
3534
+ svgSelection: S,
3535
+ container: t,
3536
+ svgWidth: b,
3537
+ svgHeight: E,
3538
+ selectedEdgeId: l,
3539
+ onEdgeSelect: u,
3540
+ debug: s,
3541
+ edgeCount: B
3542
+ });
3543
+ }), s && Oa(N);
3544
+ const v = Pa(N, n, b, E), _ = `translate(${v.x},${v.y}) scale(${v.k})`;
3545
+ x ? N.attr("transform", _) : S.call(
3546
+ d.transform,
3547
+ Ht.translate(v.x, v.y).scale(v.k)
3548
+ ), s && Fa(S, b, E);
3549
+ const $ = P.filter((T) => T.edgeIndex !== void 0).map((T) => {
3550
+ var Y, O;
3551
+ return {
3552
+ id: T._gvid,
3553
+ index: T.edgeIndex,
3554
+ sourceNodeId: ((Y = T.sourceNode) == null ? void 0 : Y.name) || "",
3555
+ targetNodeId: ((O = T.targetNode) == null ? void 0 : O.name) || "",
3556
+ label: T.getLabelText()
3557
+ };
3558
+ }).sort((T, Y) => T.index - Y.index), k = S.node(), M = N.node();
3559
+ if (!k || !M)
3560
+ throw new Error("Failed to construct SVG elements");
3561
+ return {
3562
+ zoomBehavior: d,
3563
+ svgElement: k,
3564
+ gElement: M,
3565
+ baseFontSize: c,
3566
+ viewBoxWidth: b,
3567
+ edges: $,
3568
+ initialTransform: v
3569
+ };
3570
+ }
3571
+ export {
3572
+ Go as D,
3573
+ Va as a,
3574
+ Ua as b,
3575
+ Xa as c,
3576
+ qa as d,
3577
+ Vo as e,
3578
+ Wa as f,
3579
+ Mt as g,
3580
+ la as h,
3581
+ Ht as i,
3582
+ gn as j,
3583
+ Ga as r,
3584
+ z as s,
3585
+ Lo as t
3586
+ };