vue3-network-graph 0.1.3 → 0.1.4

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.
package/dist/index.mjs CHANGED
@@ -219,7 +219,7 @@ var b = {
219
219
  "font-size",
220
220
  "font-weight"
221
221
  ], xt = ["dy"], St = {
222
- key: 5,
222
+ key: 6,
223
223
  class: "node-handles"
224
224
  }, Ct = [
225
225
  "cx",
@@ -238,7 +238,7 @@ var b = {
238
238
  "y",
239
239
  "width",
240
240
  "height"
241
- ], Dt = 6, Ot = 14, kt = 3, x = 60, At = .2, jt = 5, Mt = 160, Nt = 140, Pt = 12, Ft = 4e3, It = 12, Lt = 4e3, Rt = {
241
+ ], Dt = 6, Ot = 14, kt = 3, At = 60, jt = .2, Mt = 5, Nt = 160, Pt = 140, Ft = 12, It = 4e3, Lt = 12, Rt = 4e3, zt = {
242
242
  __name: "Topology",
243
243
  props: {
244
244
  nodes: {
@@ -296,9 +296,9 @@ var b = {
296
296
  "node-resize-end"
297
297
  ],
298
298
  setup(_, { expose: te, emit: ne }) {
299
- let v = _, y = ne, Rt = 0, zt = () => {
300
- Rt++;
301
- }, S = (e) => e && typeof e == "object" ? {
299
+ let v = _, y = ne, zt = 0, Bt = () => {
300
+ zt++;
301
+ }, x = (e) => e && typeof e == "object" ? {
302
302
  text: e.text,
303
303
  rotation: e.rotation || 0,
304
304
  fontSize: e.fontSize,
@@ -308,28 +308,28 @@ var b = {
308
308
  rotation: 0,
309
309
  fontSize: void 0,
310
310
  color: void 0
311
- }, Bt = (e, t = 11) => e.fontSize || t, Vt = (e) => e.fontColor || "#000000", Ht = (e, t = 500) => e.fontWeight || t, C = (e, t) => e.fontSize || S(t).fontSize || 8, w = (e, t) => e.fontColor || S(t).color || "#000000", T = d(v.nodes.map((e) => ({ ...e }))), Ut = null, E = () => {
312
- Ut = T.value, y("update:nodes", T.value);
311
+ }, Vt = (e, t = 11) => e.fontSize || t, Ht = (e) => e.fontColor || "#000000", Ut = (e, t = 500) => e.fontWeight || t, S = (e, t) => e.fontSize || x(t).fontSize || 8, C = (e, t) => e.fontColor || x(t).color || "#000000", w = d(v.nodes.map((e) => ({ ...e }))), Wt = null, T = () => {
312
+ Wt = w.value, y("update:nodes", w.value);
313
313
  };
314
314
  h(() => v.nodes, (e) => {
315
315
  let t = Array.isArray(e) ? e : [];
316
- if (t === Ut) return;
316
+ if (t === Wt) return;
317
317
  let n = null, r = null;
318
318
  try {
319
- n = JSON.stringify(t), r = JSON.stringify(T.value);
319
+ n = JSON.stringify(t), r = JSON.stringify(w.value);
320
320
  } catch {
321
321
  n = null;
322
322
  }
323
- (n === null || n !== r) && (zt(), T.value = t.map((e) => ({ ...e })));
323
+ (n === null || n !== r) && (Bt(), w.value = t.map((e) => ({ ...e })));
324
324
  }, { deep: !0 });
325
- let Wt = d(v.lineMode);
325
+ let Gt = d(v.lineMode);
326
326
  h(() => v.lineMode, (e) => {
327
- Wt.value = e;
327
+ Gt.value = e;
328
328
  });
329
- let Gt = t({
330
- get: () => Wt.value,
329
+ let E = t({
330
+ get: () => Gt.value,
331
331
  set: (e) => {
332
- Wt.value = e, y("update:lineMode", e);
332
+ Gt.value = e, y("update:lineMode", e);
333
333
  }
334
334
  }), D = d(null), O = d(null), Kt = d({
335
335
  x: 0,
@@ -345,13 +345,13 @@ var b = {
345
345
  ...e,
346
346
  ...r.get(e.id)
347
347
  } : e));
348
- let i = new Set(T.value.map((e) => e.id)), a = j.value;
348
+ let i = new Set(w.value.map((e) => e.id)), a = j.value;
349
349
  return n.filter((e) => !a.has(e.id) && i.has(e.from) && i.has(e.to));
350
350
  }), Zt = t(() => v.config.watchDataChanges === !0), Qt = d({
351
351
  nodes: [],
352
352
  edges: []
353
353
  }), $t = "", N = null, en = () => JSON.parse(JSON.stringify({
354
- nodes: T.value,
354
+ nodes: w.value,
355
355
  edges: M.value
356
356
  })), tn = (e, t) => {
357
357
  let n = new Map(e.map((e) => [e.id, e])), r = new Map(t.map((e) => [e.id, e]));
@@ -379,7 +379,7 @@ var b = {
379
379
  N &&= (clearTimeout(N), null), Qt.value = en(), $t = "";
380
380
  };
381
381
  h([
382
- T,
382
+ w,
383
383
  k,
384
384
  j,
385
385
  A
@@ -389,23 +389,23 @@ var b = {
389
389
  Zt.value && on();
390
390
  });
391
391
  let sn = () => en(), cn = () => {
392
- let e = new Set(z.value), t = new Set(B.value), n = T.value.filter((t) => e.has(t.id)), r = M.value.filter((n) => t.has(n.id) || e.has(n.from) || e.has(n.to));
392
+ let e = new Set(z.value), t = new Set(B.value), n = w.value.filter((t) => e.has(t.id)), r = M.value.filter((n) => t.has(n.id) || e.has(n.from) || e.has(n.to));
393
393
  return !n.length && !r.length ? {
394
394
  nodes: [],
395
395
  edges: []
396
- } : (n.length && (T.value = T.value.filter((t) => !e.has(t.id)), E()), r.length && (j.value = /* @__PURE__ */ new Set([...j.value, ...r.map((e) => e.id)]), k.value = k.value.filter((e) => !j.value.has(e.id)), y("edge-remove", r.map((e) => JSON.parse(JSON.stringify(e))))), z.value = [], B.value = [], y("node-select", null), y("edge-select", null), V(), JSON.parse(JSON.stringify({
396
+ } : (n.length && (w.value = w.value.filter((t) => !e.has(t.id)), T()), r.length && (j.value = /* @__PURE__ */ new Set([...j.value, ...r.map((e) => e.id)]), k.value = k.value.filter((e) => !j.value.has(e.id)), y("edge-remove", r.map((e) => JSON.parse(JSON.stringify(e))))), z.value = [], B.value = [], y("node-select", null), y("edge-select", null), V(), JSON.parse(JSON.stringify({
397
397
  nodes: n,
398
398
  edges: r
399
399
  })));
400
400
  }, ln = (e) => {
401
- let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(T.value.map((e) => e.id)), r = [];
401
+ let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(w.value.map((e) => e.id)), r = [];
402
402
  for (let e of t) {
403
403
  let t = JSON.parse(JSON.stringify(e));
404
404
  if (t.id == null) t.id = re();
405
405
  else if (n.has(t.id)) continue;
406
406
  n.add(t.id), r.push(t);
407
407
  }
408
- return r.length ? (T.value = [...T.value, ...r], E(), JSON.parse(JSON.stringify(r))) : [];
408
+ return r.length ? (w.value = [...w.value, ...r], T(), JSON.parse(JSON.stringify(r))) : [];
409
409
  }, un = (e) => {
410
410
  let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(M.value.map((e) => e.id)), r = [];
411
411
  for (let e of t) {
@@ -436,7 +436,7 @@ var b = {
436
436
  });
437
437
  }
438
438
  let r = [];
439
- return T.value = T.value.map((e) => {
439
+ return w.value = w.value.map((e) => {
440
440
  let t = n.get(e.id);
441
441
  if (!t) return e;
442
442
  let i = {
@@ -444,7 +444,7 @@ var b = {
444
444
  ...t
445
445
  };
446
446
  return r.push(i), i;
447
- }), r.length ? (E(), JSON.parse(JSON.stringify(r))) : [];
447
+ }), r.length ? (T(), JSON.parse(JSON.stringify(r))) : [];
448
448
  }, fn = (e) => {
449
449
  let t = (Array.isArray(e) ? e : [e]).filter((e) => e && e.id != null);
450
450
  if (!t.length) return [];
@@ -468,10 +468,10 @@ var b = {
468
468
  return i.length ? (A.value = r, y("edge-update", JSON.parse(JSON.stringify(i))), JSON.parse(JSON.stringify(i))) : [];
469
469
  }, pn = (e) => {
470
470
  let t = e && typeof e == "object" ? e : null;
471
- return k.value = [], j.value = /* @__PURE__ */ new Set(), A.value = /* @__PURE__ */ new Map(), t && Array.isArray(t.nodes) ? (T.value = JSON.parse(JSON.stringify(t.nodes)), E()) : (T.value = (Array.isArray(v.nodes) ? v.nodes : []).map((e) => ({ ...e })), Ut = T.value), z.value = [], B.value = [], y("node-select", null), y("edge-select", null), V(), on(), en();
471
+ return k.value = [], j.value = /* @__PURE__ */ new Set(), A.value = /* @__PURE__ */ new Map(), t && Array.isArray(t.nodes) ? (w.value = JSON.parse(JSON.stringify(t.nodes)), T()) : (w.value = (Array.isArray(v.nodes) ? v.nodes : []).map((e) => ({ ...e })), Wt = w.value), z.value = [], B.value = [], y("node-select", null), y("edge-select", null), V(), on(), en();
472
472
  };
473
473
  h(() => v.edges, (e) => {
474
- zt();
474
+ Bt();
475
475
  let t = Array.isArray(e) ? e : [], n = new Set(t.map((e) => e.id));
476
476
  if (k.value.length) {
477
477
  let e = k.value.filter((e) => !n.has(e.id));
@@ -526,34 +526,34 @@ var b = {
526
526
  }), t;
527
527
  }), mn = t(() => {
528
528
  let e = /* @__PURE__ */ new Map();
529
- for (let t of T.value) e.set(t.id, t);
529
+ for (let t of w.value) e.set(t.id, t);
530
530
  return e;
531
- }), F = (e) => mn.value.get(e), I = (e) => e.state != "none" && b[e.state] && b[e.state].color || "#00f0ff", hn = (e) => b[e.state] || b.normal, gn = (e) => e.type === "text", _n = (e, t) => {
531
+ }), F = (e) => mn.value.get(e), I = (e) => e.state != "none" && b[e.state] && b[e.state].color || "#00f0ff", hn = (e) => b[e.state] || b.normal, gn = (e) => e.nodeType === "text", _n = (e) => e.nodeType === "border-only", vn = (e, t) => {
532
532
  let n = Number(e);
533
533
  return Number.isFinite(n) && n > 0 ? n : t;
534
- }, vn = (e) => {
535
- let t = _n(e.width, x), n = _n(e.height, x);
534
+ }, yn = (e) => {
535
+ let t = vn(e.width, At), n = vn(e.height, At);
536
536
  return {
537
- sx: t / x,
538
- sy: n / x
537
+ sx: t / At,
538
+ sy: n / At
539
539
  };
540
- }, yn = (e) => {
541
- let { sx: t, sy: n } = vn(e);
542
- return t === 1 && n === 1 ? "" : `scale(${t}, ${n})`;
543
540
  }, bn = (e) => {
541
+ let { sx: t, sy: n } = yn(e);
542
+ return t === 1 && n === 1 ? "" : `scale(${t}, ${n})`;
543
+ }, xn = (e) => {
544
544
  let { w: t, h: n } = L(e), r = Math.min(10, t * .3), i = Math.min(10, n * .3);
545
545
  return `translate(${t / 2 - r}, ${-(n / 2 - i)})`;
546
- }, xn = t(() => {
546
+ }, Sn = t(() => {
547
547
  let e = Number(v.config.labelGap);
548
548
  return Number.isFinite(e) && e >= 0 ? e : 18;
549
- }), Sn = (e) => {
549
+ }), Cn = (e) => {
550
550
  if (gn(e)) return 4;
551
551
  let { h: t } = L(e);
552
- return e.labelPosition === "top" ? -(t / 2 + xn.value) : e.labelPosition === "center" ? 0 : t / 2 + xn.value;
553
- }, Cn = (e) => {
552
+ return e.labelPosition === "top" ? -(t / 2 + Sn.value) : e.labelPosition === "center" ? 0 : t / 2 + Sn.value;
553
+ }, wn = (e) => {
554
554
  let t = R(e);
555
555
  if (gn(e) || !e.label) return t;
556
- let n = Bt(e), r = Sn(e);
556
+ let n = Vt(e), r = Cn(e);
557
557
  if (e.labelPosition === "top") {
558
558
  let e = r - n - 4;
559
559
  e < t.y && (t.height += t.y - e, t.y = e);
@@ -562,11 +562,11 @@ var b = {
562
562
  i > t.y + t.height && (t.height = i - t.y);
563
563
  }
564
564
  return t;
565
- }, wn = (e) => e.borderColor !== void 0 || e.borderWidth !== void 0 || e.borderStyle !== void 0, L = (e) => {
566
- let t = gn(e);
565
+ }, Tn = (e) => e.borderColor !== void 0 || e.borderWidth !== void 0 || e.borderStyle !== void 0, L = (e) => {
566
+ let t = gn(e), n = _n(e);
567
567
  return {
568
- w: _n(e.width, t ? Math.max(60, String(e.label).length * 7 + 16) : x),
569
- h: _n(e.height, t ? 26 : x)
568
+ w: vn(e.width, t ? Math.max(60, String(e.label).length * 7 + 16) : n ? Math.max(80, String(e.label).length * 8 + 24) : At),
569
+ h: vn(e.height, t ? 26 : n ? 40 : At)
570
570
  };
571
571
  }, R = (e) => {
572
572
  let { w: t, h: n } = L(e);
@@ -576,37 +576,61 @@ var b = {
576
576
  width: t,
577
577
  height: n
578
578
  };
579
- }, Tn = (e) => wn(e) ? R(e) : null, En = (e) => e.background && e.background !== "none" ? e.background : null, z = d([]), B = d([]);
579
+ }, En = (e) => Tn(e) ? R(e) : null, Dn = (e) => e.background && e.background !== "none" ? e.background : null, z = d([]), B = d([]);
580
580
  t(() => z.value.length === 1 ? z.value[0] : null), t(() => B.value.length === 1 ? B.value[0] : null);
581
- let Dn = (e) => z.value.includes(e.id), On = (e) => B.value.includes(e.id), V = () => {
581
+ let On = (e) => z.value.includes(e.id), kn = (e) => B.value.includes(e.id), V = () => {
582
582
  y("selection-change", {
583
- nodes: T.value.filter((e) => z.value.includes(e.id)),
583
+ nodes: w.value.filter((e) => z.value.includes(e.id)),
584
584
  edges: M.value.filter((e) => B.value.includes(e.id))
585
585
  });
586
- }, kn = (e) => typeof e == "number" ? Number.isFinite(e) && e >= 0 ? Math.floor(e) : Infinity : typeof e == "string" && /^\d+$/.test(e.trim()) ? parseInt(e.trim(), 10) : Infinity, An = t(() => kn(v.config.maxSelectNodes)), jn = t(() => kn(v.config.maxSelectEdges)), H = (e, t, n) => {
586
+ }, An = (e) => typeof e == "number" ? Number.isFinite(e) && e >= 0 ? Math.floor(e) : Infinity : typeof e == "string" && /^\d+$/.test(e.trim()) ? parseInt(e.trim(), 10) : Infinity, jn = t(() => An(v.config.maxSelectNodes)), Mn = t(() => An(v.config.maxSelectEdges)), H = (e, t, n) => {
587
587
  let r = new Set(e), i = [];
588
588
  for (let e of t) r.has(e) || (r.add(e), i.push(e));
589
589
  if (n === Infinity) return [...e, ...i];
590
590
  let a = Math.max(0, n - e.length);
591
591
  return [...e, ...i.slice(0, a)];
592
592
  };
593
- h([An, jn], ([e, t]) => {
593
+ h([jn, Mn], ([e, t]) => {
594
594
  let n = !1;
595
595
  z.value.length > e && (z.value = z.value.slice(0, e), n = !0), B.value.length > t && (B.value = B.value.slice(0, t), n = !0), n && V();
596
596
  });
597
- let Mn = t(() => v.config.selectedBorderColor || "#fbbf24"), Nn = (e, t) => {
598
- if (!Rn()) {
597
+ let Nn = t(() => v.config.selectedBorderColor || "#fbbf24"), Pn = (e, t) => {
598
+ if (!Wn()) {
599
599
  if (t && (t.ctrlKey || t.metaKey)) {
600
600
  let t = z.value.indexOf(e.id);
601
- t >= 0 ? z.value.splice(t, 1) : z.value = H(z.value, [e.id], An.value);
601
+ t >= 0 ? z.value.splice(t, 1) : z.value = H(z.value, [e.id], jn.value);
602
602
  } else {
603
603
  let t = z.value.length === 1 && z.value[0] === e.id;
604
- z.value = t ? [] : H([], [e.id], An.value), B.value = [];
604
+ z.value = t ? [] : H([], [e.id], jn.value), B.value = [];
605
605
  }
606
- y("node-click", e), y("node-select", Dn(e) ? e : null), V();
606
+ y("node-click", e), y("node-select", On(e) ? e : null), V();
607
607
  }
608
- }, Pn = t(() => v.config.selectedLineColor || "#fbbf24"), Fn = (e, t) => {
609
- if (Rn()) return;
608
+ }, Fn = (e) => {
609
+ let t = w.value.find((t) => t.id === e);
610
+ if (!t || v.config.enableZOrder === !1) return !1;
611
+ let n = t.zIndex ?? 0, r = w.value.filter((e) => (e.zIndex ?? 0) > n);
612
+ return r.length !== 0 && (t.zIndex = Math.min(...r.map((e) => e.zIndex ?? 0)), !0);
613
+ }, In = (e) => {
614
+ let t = w.value.find((t) => t.id === e);
615
+ if (!t || v.config.enableZOrder === !1) return !1;
616
+ let n = t.zIndex ?? 0, r = w.value.filter((e) => (e.zIndex ?? 0) < n);
617
+ return r.length !== 0 && (t.zIndex = Math.max(...r.map((e) => e.zIndex ?? 0)), !0);
618
+ }, Ln = (e) => {
619
+ let t = w.value.find((t) => t.id === e);
620
+ return !t || v.config.enableZOrder === !1 ? !1 : (t.zIndex = Math.max(...w.value.map((e) => e.zIndex ?? 0), 0) + 1, !0);
621
+ }, Rn = (e) => {
622
+ let t = w.value.find((t) => t.id === e);
623
+ return !t || v.config.enableZOrder === !1 ? !1 : (t.zIndex = Math.min(...w.value.map((e) => e.zIndex ?? 0), 0) - 1, !0);
624
+ }, zn = () => {
625
+ if (!O.value) return;
626
+ let e = O.value.cloneNode(!0);
627
+ e.querySelectorAll("animate, animateMotion, animateTransform, set").forEach((e) => e.remove()), e.querySelectorAll(".center-crosshair").forEach((e) => e.remove()), e.setAttribute("width", U.value || "800"), e.setAttribute("height", W.value || "600");
628
+ let t = new XMLSerializer().serializeToString(e);
629
+ t = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + t;
630
+ let n = new Blob([t], { type: "image/svg+xml;charset=utf-8" }), r = URL.createObjectURL(n), i = document.createElement("a");
631
+ i.href = r, i.download = `topology-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.svg`, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r);
632
+ }, Bn = t(() => v.config.selectedLineColor || "#fbbf24"), Vn = (e, t) => {
633
+ if (Wn()) return;
610
634
  let n = P.value[e.id], r = !!(n && n.merged && n.representative), i = r ? M.value.filter((e) => {
611
635
  let t = P.value[e.id];
612
636
  return t && t.key === n.key;
@@ -614,69 +638,69 @@ var b = {
614
638
  ...e,
615
639
  bundleEdges: i
616
640
  } : e;
617
- if (t && (t.ctrlKey || t.metaKey)) a.every((e) => B.value.includes(e)) ? B.value = B.value.filter((e) => !a.includes(e)) : B.value = H(B.value, a, jn.value);
641
+ if (t && (t.ctrlKey || t.metaKey)) a.every((e) => B.value.includes(e)) ? B.value = B.value.filter((e) => !a.includes(e)) : B.value = H(B.value, a, Mn.value);
618
642
  else {
619
643
  let e = a.length === B.value.length && a.every((e) => B.value.includes(e));
620
- B.value = e ? [] : H([], a, jn.value), z.value = [];
644
+ B.value = e ? [] : H([], a, Mn.value), z.value = [];
621
645
  }
622
- y("edge-select", On(e) ? o : null), V();
623
- }, In = 0, Ln = (e = 200) => {
624
- In = performance.now() + e;
625
- }, Rn = () => performance.now() < In, zn = () => {
646
+ y("edge-select", kn(e) ? o : null), V();
647
+ }, Hn = 0, Un = (e = 200) => {
648
+ Hn = performance.now() + e;
649
+ }, Wn = () => performance.now() < Hn, Gn = () => {
626
650
  z.value = [], B.value = [], y("node-select", null), y("edge-select", null), V();
627
- }, Bn = (e) => {
628
- if (Rn()) return;
651
+ }, Kn = (e) => {
652
+ if (Wn()) return;
629
653
  let t = e.target;
630
- t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || zn();
631
- }, Vn = d({
654
+ t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || Gn();
655
+ }, qn = d({
632
656
  width: 1e3,
633
657
  height: 650
634
- }), Hn = d(1), Un = d(0), Wn = d(0), Gn = t(() => -qn.value / 2 + Un.value), Kn = t(() => -Jn.value / 2 + Wn.value), qn = t(() => v.width ?? Vn.value.width), Jn = t(() => v.height ?? Vn.value.height), Yn = null;
658
+ }), Jn = d(1), Yn = d(0), Xn = d(0), Zn = t(() => -$n.value / 2 + Yn.value), Qn = t(() => -er.value / 2 + Xn.value), $n = t(() => v.width ?? qn.value.width), er = t(() => v.height ?? qn.value.height), tr = null;
635
659
  l(() => {
636
660
  let e = O.value;
637
661
  if (e) {
638
662
  let t = e.getBoundingClientRect();
639
- t.width > 0 && t.height > 0 && (Vn.value = {
663
+ t.width > 0 && t.height > 0 && (qn.value = {
640
664
  width: t.width,
641
665
  height: t.height
642
666
  });
643
667
  }
644
- e && typeof ResizeObserver < "u" && (Yn = new ResizeObserver(() => {
668
+ e && typeof ResizeObserver < "u" && (tr = new ResizeObserver(() => {
645
669
  let t = e.getBoundingClientRect();
646
- t.width > 0 && t.height > 0 && (Vn.value = {
670
+ t.width > 0 && t.height > 0 && (qn.value = {
647
671
  width: t.width,
648
672
  height: t.height
649
673
  });
650
- }), Yn.observe(e));
674
+ }), tr.observe(e));
651
675
  }), c(() => {
652
- Yn &&= (Yn.disconnect(), null), Lr &&= (cancelAnimationFrame(Lr), 0), J &&= (cancelAnimationFrame(J), 0), ti &&= (cancelAnimationFrame(ti), 0), ci(), mr();
676
+ tr &&= (tr.disconnect(), null), Wr &&= (cancelAnimationFrame(Wr), 0), hr &&= (cancelAnimationFrame(hr), 0), Z &&= (cancelAnimationFrame(Z), 0), mi(), xr();
653
677
  });
654
- let U = t(() => qn.value / Hn.value), W = t(() => Jn.value / Hn.value), Xn = t(() => ({
655
- x0: Gn.value - Mt,
656
- y0: Kn.value - Mt,
657
- x1: Gn.value + U.value + Mt,
658
- y1: Kn.value + W.value + Mt
659
- })), Zn = t(() => {
660
- let e = Xn.value;
661
- return T.value.filter((t) => {
678
+ let U = t(() => $n.value / Jn.value), W = t(() => er.value / Jn.value), nr = t(() => ({
679
+ x0: Zn.value - Nt,
680
+ y0: Qn.value - Nt,
681
+ x1: Zn.value + U.value + Nt,
682
+ y1: Qn.value + W.value + Nt
683
+ })), rr = t(() => {
684
+ let e = nr.value, t = w.value.filter((t) => {
662
685
  let { w: n, h: r } = L(t);
663
686
  return t.x + n / 2 >= e.x0 && t.x - n / 2 <= e.x1 && t.y + r / 2 >= e.y0 && t.y - r / 2 <= e.y1;
664
687
  });
688
+ return v.config.enableZOrder !== !1 && t.sort((e, t) => (e.zIndex ?? 0) - (t.zIndex ?? 0)), t;
665
689
  }), G = t(() => {
666
- let e = Xn.value;
690
+ let e = nr.value;
667
691
  return M.value.filter((t) => {
668
- if (!wi(t)) return !1;
692
+ if (!Ai(t)) return !1;
669
693
  let n = F(t.from), r = F(t.to);
670
694
  if (!n || !r) return !1;
671
695
  let i = L(n).w / 2, a = L(n).h / 2, o = L(r).w / 2, s = L(r).h / 2;
672
- return Math.min(n.x - i, r.x - o) - Nt <= e.x1 && Math.max(n.x + i, r.x + o) + Nt >= e.x0 && Math.min(n.y - a, r.y - s) - Nt <= e.y1 && Math.max(n.y + a, r.y + s) + Nt >= e.y0;
696
+ return Math.min(n.x - i, r.x - o) - Pt <= e.x1 && Math.max(n.x + i, r.x + o) + Pt >= e.x0 && Math.min(n.y - a, r.y - s) - Pt <= e.y1 && Math.max(n.y + a, r.y + s) + Pt >= e.y0;
673
697
  });
674
- }), Qn = (e) => {
698
+ }), ir = (e) => {
675
699
  if (v.config.enableZoom === !1) return;
676
700
  e.preventDefault();
677
- let t = O.value.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, i = n / t.width, a = r / t.height, o = U.value, s = W.value, c = e.deltaY > 0 ? .9 : 1.1, l = Math.min(jt, Math.max(At, Hn.value * c)), u = qn.value / l, d = Jn.value / l;
678
- Un.value += (o - u) * i, Wn.value += (s - d) * a, Hn.value = l;
679
- }, K = d(null), q = d(null), $n = (e) => {
701
+ let t = O.value.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, i = n / t.width, a = r / t.height, o = U.value, s = W.value, c = e.deltaY > 0 ? .9 : 1.1, l = Math.min(Mt, Math.max(jt, Jn.value * c)), u = $n.value / l, d = er.value / l;
702
+ Yn.value += (o - u) * i, Xn.value += (s - d) * a, Jn.value = l;
703
+ }, K = d(null), q = d(null), ar = (e) => {
680
704
  let t = O.value, n = t ? t.getBoundingClientRect() : null;
681
705
  K.value = {
682
706
  startX: e.clientX,
@@ -686,8 +710,8 @@ var b = {
686
710
  moved: !1,
687
711
  rectWidth: n && n.width ? n.width : 0,
688
712
  rectHeight: n && n.height ? n.height : 0
689
- }, pr();
690
- }, er = (e) => {
713
+ }, br();
714
+ }, or = (e) => {
691
715
  let t = K.value, n = O.value;
692
716
  if (!t || !n) return;
693
717
  let r = t.rectWidth, i = t.rectHeight;
@@ -698,12 +722,12 @@ var b = {
698
722
  return;
699
723
  }
700
724
  let a = e.clientX - t.lastX, o = e.clientY - t.lastY;
701
- t.lastX = e.clientX, t.lastY = e.clientY, Un.value -= a * (U.value / r), Wn.value -= o * (W.value / i);
702
- }, tr = () => {
725
+ t.lastX = e.clientX, t.lastY = e.clientY, Yn.value -= a * (U.value / r), Xn.value -= o * (W.value / i);
726
+ }, sr = () => {
703
727
  let e = K.value;
704
- K.value = null, e && e.moved && Ln(), hr();
705
- }, nr = (e) => {
706
- let t = Z(e);
728
+ K.value = null, e && e.moved && Un(), Sr();
729
+ }, cr = (e) => {
730
+ let t = X(e);
707
731
  q.value = {
708
732
  start: {
709
733
  x: t.x,
@@ -716,16 +740,16 @@ var b = {
716
740
  startClientX: e.clientX,
717
741
  startClientY: e.clientY,
718
742
  moved: !1
719
- }, pr();
720
- }, rr = (e) => {
743
+ }, br();
744
+ }, lr = (e) => {
721
745
  let t = q.value;
722
746
  if (!t) return;
723
- let n = Z(e);
747
+ let n = X(e);
724
748
  t.current = {
725
749
  x: n.x,
726
750
  y: n.y
727
751
  }, !t.moved && Math.hypot(e.clientX - t.startClientX, e.clientY - t.startClientY) > 3 && (t.moved = !0);
728
- }, ir = t(() => {
752
+ }, ur = t(() => {
729
753
  let e = q.value;
730
754
  return e ? {
731
755
  x: Math.min(e.start.x, e.current.x),
@@ -738,7 +762,7 @@ var b = {
738
762
  width: 0,
739
763
  height: 0
740
764
  };
741
- }), ar = () => {
765
+ }), dr = () => {
742
766
  let e = q.value;
743
767
  if (q.value = null, e && e.moved) {
744
768
  let t = {
@@ -746,54 +770,54 @@ var b = {
746
770
  y: Math.min(e.start.y, e.current.y),
747
771
  w: Math.abs(e.current.x - e.start.x),
748
772
  h: Math.abs(e.current.y - e.start.y)
749
- }, n = T.value.filter((e) => {
773
+ }, n = w.value.filter((e) => {
750
774
  let n = R(e), r = e.x + n.x, i = e.y + n.y;
751
775
  return !(r + n.width < t.x || r > t.x + t.w || i + n.height < t.y || i > t.y + t.h);
752
776
  });
753
- n.length && (z.value = H(z.value, n.map((e) => e.id), An.value), V()), Ln();
777
+ n.length && (z.value = H(z.value, n.map((e) => e.id), jn.value), V()), Un();
754
778
  }
755
- hr();
756
- }, or = (e) => !e || typeof e.closest != "function" ? !1 : !!(e.closest(".topology-node") || e.closest(".node-handles") || e.closest(".node-resize-layer")), sr = (e) => {
779
+ Sr();
780
+ }, fr = (e) => !e || typeof e.closest != "function" ? !1 : !!(e.closest(".topology-node") || e.closest(".node-handles") || e.closest(".node-resize-layer")), pr = (e) => {
757
781
  if (O.value) {
758
782
  if (e.button === 1) {
759
783
  if (v.config.enablePan === !1) return;
760
- e.preventDefault(), $n(e);
784
+ e.preventDefault(), ar(e);
761
785
  return;
762
786
  }
763
- if (e.button === 0 && !or(e.target)) {
787
+ if (e.button === 0 && !fr(e.target)) {
764
788
  if (e.ctrlKey || e.metaKey) {
765
789
  if (v.config.enableMarquee === !1) return;
766
- e.preventDefault(), nr(e);
790
+ e.preventDefault(), cr(e);
767
791
  return;
768
792
  }
769
- v.config.enablePan !== !1 && (e.preventDefault(), $n(e));
793
+ v.config.enablePan !== !1 && (e.preventDefault(), ar(e));
770
794
  }
771
795
  }
772
- }, cr = !1, J = 0, lr = null, ur = () => {
773
- J = 0;
774
- let e = lr;
775
- lr = null, e && (K.value ? er(e) : q.value && rr(e));
776
- }, dr = (e) => {
777
- lr = e, J ||= requestAnimationFrame(ur);
778
- }, fr = () => {
779
- J && (cancelAnimationFrame(J), ur()), K.value && tr(), q.value && ar();
780
- }, pr = () => {
781
- cr || (cr = !0, window.addEventListener("mousemove", dr, !0), window.addEventListener("mouseup", fr, !0));
782
- }, mr = () => {
783
- cr && (cr = !1, window.removeEventListener("mousemove", dr, !0), window.removeEventListener("mouseup", fr, !0));
784
- }, hr = () => {
785
- !K.value && !q.value && mr();
786
- }, gr = t(() => {
787
- if (Y.value && Y.value.side) return { cursor: Gr(Y.value.side) };
796
+ }, mr = !1, hr = 0, gr = null, _r = () => {
797
+ hr = 0;
798
+ let e = gr;
799
+ gr = null, e && (K.value ? or(e) : q.value && lr(e));
800
+ }, vr = (e) => {
801
+ gr = e, hr ||= requestAnimationFrame(_r);
802
+ }, yr = () => {
803
+ hr && (cancelAnimationFrame(hr), _r()), K.value && sr(), q.value && dr();
804
+ }, br = () => {
805
+ mr || (mr = !0, window.addEventListener("mousemove", vr, !0), window.addEventListener("mouseup", yr, !0));
806
+ }, xr = () => {
807
+ mr && (mr = !1, window.removeEventListener("mousemove", vr, !0), window.removeEventListener("mouseup", yr, !0));
808
+ }, Sr = () => {
809
+ !K.value && !q.value && xr();
810
+ }, Cr = t(() => {
811
+ if (J.value && J.value.side) return { cursor: Qr(J.value.side) };
788
812
  if (q.value) return { cursor: "crosshair" };
789
813
  if (K.value && K.value.moved) return { cursor: "grabbing" };
790
- }), _r = t(() => v.config.showGrid !== !1), vr = t(() => v.config.gridColor || "#1a2240"), yr = t(() => {
814
+ }), wr = t(() => v.config.showGrid !== !1), Tr = t(() => v.config.gridColor || "#1a2240"), Er = t(() => {
791
815
  let e = Number(v.config.gridStep);
792
- return (Number.isFinite(e) && e > 0 ? e : 40) / Hn.value;
793
- }), br = t(() => {
816
+ return (Number.isFinite(e) && e > 0 ? e : 40) / Jn.value;
817
+ }), Dr = t(() => {
794
818
  let e = Number(v.config.gridOpacity);
795
819
  return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : .5;
796
- }), xr = t(() => {
820
+ }), Or = t(() => {
797
821
  let e = v.config.radialGradient && typeof v.config.radialGradient == "object" ? v.config.radialGradient : {}, t = Array.isArray(e.stops) && e.stops.length ? e.stops.filter((e) => e && e.color).map((e, t) => ({
798
822
  offset: e.offset == null ? t === 0 ? "0%" : "100%" : e.offset,
799
823
  color: e.color,
@@ -813,27 +837,38 @@ var b = {
813
837
  r: e.r || "60%",
814
838
  stops: n
815
839
  };
816
- }), Sr = t(() => v.config.showCenterPoint === !0), Cr = t(() => v.config.showEdgeTextBg === !0), wr = t(() => v.config.edgeTextBgColor || "#0a0e1a"), Tr = t(() => v.config.showNodeHandles === !0), Er = t(() => v.config.showStatusDot !== !1), Dr = (e, t) => {
840
+ }), kr = t(() => v.config.showCenterPoint === !0), Ar = t(() => v.config.showEdgeTextBg === !0), jr = t(() => v.config.edgeTextBgColor || "#0a0e1a"), Mr = t(() => v.config.showNodeHandles === !0), Nr = t(() => v.config.showStatusDot !== !1), Pr = (e, t) => {
817
841
  let n = Number(e);
818
842
  return Number.isFinite(n) && n >= 0 ? n : t;
819
- }, Or = t(() => {
843
+ }, Fr = t(() => {
820
844
  let e = v.config.motionFx ?? v.config.fx;
821
- return typeof e == "boolean" ? e : M.value.length <= Dr(v.config.fxMotionMaxEdges, 200);
822
- }), kr = t(() => {
845
+ return typeof e == "boolean" ? e ? "all" : "none" : [
846
+ "none",
847
+ "flow",
848
+ "particle",
849
+ "all"
850
+ ].includes(e) ? e : M.value.length <= Pr(v.config.fxMotionMaxEdges, 200) ? "all" : "none";
851
+ }), Ir = t(() => {
823
852
  let e = v.config.glowFx ?? v.config.fx;
824
- return typeof e == "boolean" ? e : M.value.length <= Dr(v.config.fxGlowMaxEdges, 500);
825
- }), Ar = t(() => {
853
+ return typeof e == "boolean" ? e : M.value.length <= Pr(v.config.fxGlowMaxEdges, 500);
854
+ }), Lr = t(() => {
826
855
  let e = v.config.breatheFx ?? v.config.fx;
827
- return typeof e == "boolean" ? e : T.value.length <= Dr(v.config.fxBreatheMaxNodes, 300);
828
- }), jr = (e) => e.animated !== !1, Mr = (e) => e.borderColor || I(e) || "#94a3b8", Nr = (e) => e.borderWidth || 0, Pr = (e) => e.borderStyle === "dashed" ? "8 5" : void 0, Fr = (e) => {
856
+ return typeof e == "boolean" ? e : w.value.length <= Pr(v.config.fxBreatheMaxNodes, 300);
857
+ }), Rr = (e) => {
858
+ if (e.animatedMode !== void 0) {
859
+ let t = e.animatedMode;
860
+ return !t || t === "all" ? Fr.value : t === "none" ? "none" : t;
861
+ }
862
+ return e.animated === void 0 || e.animated ? Fr.value : "none";
863
+ }, zr = (e) => e.borderColor || I(e) || "#94a3b8", Br = (e) => e.borderWidth || 0, Vr = (e) => e.borderStyle === "dashed" ? "8 5" : void 0, Hr = (e) => {
829
864
  let t = e.borderRadius;
830
865
  if (t == null || t === "") return 6;
831
866
  let n = Number(t);
832
867
  return Number.isFinite(n) && n >= 0 ? n : 6;
833
- }, Ir = (e, t) => {
868
+ }, Ur = (e, t) => {
834
869
  if (e.button !== 0 || !v.editable || v.config.nodeDraggable === !1) return;
835
870
  e.stopPropagation();
836
- let n = F(t), r = Z(e);
871
+ let n = F(t), r = X(e);
837
872
  if (Kt.value = {
838
873
  x: r.x - n.x,
839
874
  y: r.y - n.y
@@ -857,44 +892,44 @@ var b = {
857
892
  };
858
893
  } else qt.value = null;
859
894
  D.value = t, y("node-drag-start", n);
860
- }, Lr = 0, Rr = null, zr = () => {
861
- Lr = 0;
862
- let e = Rr;
863
- Rr = null, e && Vr(e);
864
- }, Br = (e) => {
865
- (Y.value || D.value) && (Rr = {
895
+ }, Wr = 0, Gr = null, Kr = () => {
896
+ Wr = 0;
897
+ let e = Gr;
898
+ Gr = null, e && Jr(e);
899
+ }, qr = (e) => {
900
+ (J.value || D.value) && (Gr = {
866
901
  clientX: e.clientX,
867
902
  clientY: e.clientY
868
- }, Lr ||= requestAnimationFrame(zr));
869
- }, Vr = (e) => {
870
- if (Y.value) {
871
- qr(e);
903
+ }, Wr ||= requestAnimationFrame(Kr));
904
+ }, Jr = (e) => {
905
+ if (J.value) {
906
+ ei(e);
872
907
  return;
873
908
  }
874
909
  if (!D.value) return;
875
- let t = Z(e);
876
- !Yt && Jt && Math.hypot(e.clientX - Jt.x, e.clientY - Jt.y) > kt && (Yt = !0, !Xt && !z.value.includes(D.value) && (z.value = H([], [D.value], An.value), B.value = [], y("node-select", z.value.includes(D.value) ? F(D.value) : null), V()));
910
+ let t = X(e);
911
+ !Yt && Jt && Math.hypot(e.clientX - Jt.x, e.clientY - Jt.y) > kt && (Yt = !0, !Xt && !z.value.includes(D.value) && (z.value = H([], [D.value], jn.value), B.value = [], y("node-select", z.value.includes(D.value) ? F(D.value) : null), V()));
877
912
  let n = qt.value;
878
913
  if (n) {
879
914
  let e = t.x - n.start.x, r = t.y - n.start.y;
880
- T.value = T.value.map((t) => n.origins[t.id] ? {
915
+ w.value = w.value.map((t) => n.origins[t.id] ? {
881
916
  ...t,
882
917
  x: n.origins[t.id].x + e,
883
918
  y: n.origins[t.id].y + r
884
919
  } : t);
885
- } else T.value = T.value.map((e) => e.id === D.value ? {
920
+ } else w.value = w.value.map((e) => e.id === D.value ? {
886
921
  ...e,
887
922
  x: t.x - Kt.value.x,
888
923
  y: t.y - Kt.value.y
889
924
  } : e);
890
- E();
891
- }, Hr = () => {
892
- if (Lr && (cancelAnimationFrame(Lr), zr()), Y.value) {
893
- Jr();
925
+ T();
926
+ }, Yr = () => {
927
+ if (Wr && (cancelAnimationFrame(Wr), Kr()), J.value) {
928
+ ti();
894
929
  return;
895
930
  }
896
- D.value && (Yt && Ln(), D.value = null, qt.value = null, Jt = null, Yt = !1, y("node-drag-end"));
897
- }, Y = d(null), Ur = (e, t, n) => Math.min(n, Math.max(t, e)), Wr = (e) => {
931
+ D.value && (Yt && Un(), D.value = null, qt.value = null, Jt = null, Yt = !1, y("node-drag-end"));
932
+ }, J = d(null), Xr = (e, t, n) => Math.min(n, Math.max(t, e)), Zr = (e) => {
898
933
  let t = R(e), n = t.x, r = t.y, i = t.x + t.width, a = t.y + t.height;
899
934
  return [
900
935
  {
@@ -938,10 +973,10 @@ var b = {
938
973
  y: 0
939
974
  }
940
975
  ];
941
- }, Gr = (e) => e === "nw" || e === "se" ? "nwse-resize" : e === "ne" || e === "sw" ? "nesw-resize" : e === "n" || e === "s" ? "ns-resize" : "ew-resize", Kr = (e, t, n) => {
976
+ }, Qr = (e) => e === "nw" || e === "se" ? "nwse-resize" : e === "ne" || e === "sw" ? "nesw-resize" : e === "n" || e === "s" ? "ns-resize" : "ew-resize", $r = (e, t, n) => {
942
977
  if (!v.editable || v.config.nodeResizable === !1 || !t) return;
943
978
  let { w: r, h: i } = L(t);
944
- Y.value = {
979
+ J.value = {
945
980
  id: t.id,
946
981
  side: n,
947
982
  anchorX: n.includes("e") ? t.x - r / 2 : n.includes("w") ? t.x + r / 2 : null,
@@ -949,35 +984,35 @@ var b = {
949
984
  startW: r,
950
985
  startH: i
951
986
  }, y("node-resize-start", t);
952
- }, qr = (e) => {
953
- let t = Y.value;
987
+ }, ei = (e) => {
988
+ let t = J.value;
954
989
  if (!t) return;
955
990
  let n = F(t.id);
956
991
  if (!n) return;
957
- let r = Z(e), i = t.startW, a = t.startH, o = n.x, s = n.y;
992
+ let r = X(e), i = t.startW, a = t.startH, o = n.x, s = n.y;
958
993
  if (t.anchorX !== null) {
959
994
  let e = t.side.includes("e");
960
- i = Ur(e ? r.x - t.anchorX : t.anchorX - r.x, Pt, Ft), o = e ? t.anchorX + i / 2 : t.anchorX - i / 2;
995
+ i = Xr(e ? r.x - t.anchorX : t.anchorX - r.x, Ft, It), o = e ? t.anchorX + i / 2 : t.anchorX - i / 2;
961
996
  }
962
997
  if (t.anchorY !== null) {
963
998
  let e = t.side.includes("s");
964
- a = Ur(e ? r.y - t.anchorY : t.anchorY - r.y, It, Lt), s = e ? t.anchorY + a / 2 : t.anchorY - a / 2;
999
+ a = Xr(e ? r.y - t.anchorY : t.anchorY - r.y, Lt, Rt), s = e ? t.anchorY + a / 2 : t.anchorY - a / 2;
965
1000
  }
966
- T.value = T.value.map((e) => e.id === t.id ? {
1001
+ w.value = w.value.map((e) => e.id === t.id ? {
967
1002
  ...e,
968
1003
  x: o,
969
1004
  y: s,
970
1005
  width: i,
971
1006
  height: a
972
- } : e), E();
973
- }, Jr = () => {
974
- let e = Y.value;
975
- Y.value = null, e && (Ln(), y("node-resize-end", F(e.id) || null));
976
- }, Yr = t(() => v.editable && v.config.nodeResizable !== !1), Xr = t(() => {
977
- if (!Yr.value) return null;
1007
+ } : e), T();
1008
+ }, ti = () => {
1009
+ let e = J.value;
1010
+ J.value = null, e && (Un(), y("node-resize-end", F(e.id) || null));
1011
+ }, ni = t(() => v.editable && v.config.nodeResizable !== !1), ri = t(() => {
1012
+ if (!ni.value) return null;
978
1013
  let e = z.value;
979
1014
  return e.length === 1 && F(e[0]) || null;
980
- }), X = d(null), Zr = (e) => {
1015
+ }), Y = d(null), ii = (e) => {
981
1016
  let t = R(e);
982
1017
  return [
983
1018
  {
@@ -1001,7 +1036,7 @@ var b = {
1001
1036
  y: 0
1002
1037
  }
1003
1038
  ];
1004
- }, Qr = (e, t) => {
1039
+ }, ai = (e, t) => {
1005
1040
  let n = O.value;
1006
1041
  if (!n) return null;
1007
1042
  let r = e, i = t;
@@ -1015,7 +1050,7 @@ var b = {
1015
1050
  x: s.x,
1016
1051
  y: s.y
1017
1052
  };
1018
- }, $r = (e, t) => {
1053
+ }, oi = (e, t) => {
1019
1054
  let n = O.value;
1020
1055
  if (!n) return null;
1021
1056
  let r = n.createSVGPoint();
@@ -1027,14 +1062,14 @@ var b = {
1027
1062
  x: a.x,
1028
1063
  y: a.y
1029
1064
  };
1030
- }, Z = (e) => Qr(e) ?? {
1065
+ }, X = (e) => ai(e) ?? {
1031
1066
  x: 0,
1032
1067
  y: 0
1033
- }, ei = (e, t, n) => {
1068
+ }, si = (e, t, n) => {
1034
1069
  let r = F(t);
1035
1070
  if (!r || !O.value) return;
1036
- let i = Z(e);
1037
- X.value = {
1071
+ let i = X(e);
1072
+ Y.value = {
1038
1073
  fromId: t,
1039
1074
  side: n.side,
1040
1075
  ax: r.x + n.x,
@@ -1046,24 +1081,24 @@ var b = {
1046
1081
  try {
1047
1082
  e.target.setPointerCapture?.(e.pointerId);
1048
1083
  } catch {}
1049
- si();
1050
- }, ti = 0, ni = null, ri = () => {
1051
- ti = 0;
1052
- let e = ni;
1053
- ni = null, e && X.value && ui(e);
1054
- }, ii = (e) => {
1055
- X.value && (ni = {
1084
+ pi();
1085
+ }, Z = 0, ci = null, li = () => {
1086
+ Z = 0;
1087
+ let e = ci;
1088
+ ci = null, e && Y.value && gi(e);
1089
+ }, ui = (e) => {
1090
+ Y.value && (ci = {
1056
1091
  clientX: e.clientX,
1057
1092
  clientY: e.clientY
1058
- }, ti ||= requestAnimationFrame(ri));
1059
- }, ai = () => {
1060
- ti && (cancelAnimationFrame(ti), ri()), X.value && di();
1061
- }, oi = !1, si = () => {
1062
- oi || (oi = !0, window.addEventListener("mousemove", ii, !0), window.addEventListener("mouseup", ai, !0));
1063
- }, ci = () => {
1064
- oi && (oi = !1, window.removeEventListener("mousemove", ii, !0), window.removeEventListener("mouseup", ai, !0));
1065
- }, li = (e, t, n) => {
1066
- let r = T.value;
1093
+ }, Z ||= requestAnimationFrame(li));
1094
+ }, di = () => {
1095
+ Z && (cancelAnimationFrame(Z), li()), Y.value && _i();
1096
+ }, fi = !1, pi = () => {
1097
+ fi || (fi = !0, window.addEventListener("mousemove", ui, !0), window.addEventListener("mouseup", di, !0));
1098
+ }, mi = () => {
1099
+ fi && (fi = !1, window.removeEventListener("mousemove", ui, !0), window.removeEventListener("mouseup", di, !0));
1100
+ }, hi = (e, t, n) => {
1101
+ let r = w.value;
1067
1102
  for (let i = r.length - 1; i >= 0; i--) {
1068
1103
  let a = r[i];
1069
1104
  if (a.id === n) continue;
@@ -1071,17 +1106,17 @@ var b = {
1071
1106
  if (e >= a.x + o.x - 2 && e <= a.x + o.x + o.width + 2 && t >= a.y + o.y - 2 && t <= a.y + o.y + o.height + 2) return a;
1072
1107
  }
1073
1108
  return null;
1074
- }, ui = (e) => {
1075
- let t = X.value;
1109
+ }, gi = (e) => {
1110
+ let t = Y.value;
1076
1111
  if (!t) return;
1077
- let n = Z(e);
1112
+ let n = X(e);
1078
1113
  t.px = n.x, t.py = n.y;
1079
- let r = li(n.x, n.y, t.fromId);
1114
+ let r = hi(n.x, n.y, t.fromId);
1080
1115
  t.overId = r ? r.id : null;
1081
- }, di = () => {
1082
- ci();
1083
- let e = X.value;
1084
- if (X.value = null, !e || !e.overId || e.overId === e.fromId) return;
1116
+ }, _i = () => {
1117
+ mi();
1118
+ let e = Y.value;
1119
+ if (Y.value = null, !e || !e.overId || e.overId === e.fromId) return;
1085
1120
  let t = {
1086
1121
  id: `${re()}`,
1087
1122
  from: e.fromId,
@@ -1091,7 +1126,7 @@ var b = {
1091
1126
  toAnchor: "edge"
1092
1127
  };
1093
1128
  k.value.push(t), y("edge-create", t);
1094
- }, fi = (e, t, n) => {
1129
+ }, vi = (e, t, n) => {
1095
1130
  let r = e.x, i = e.y, a = t.x - r, o = t.y - i, { w: s, h: c } = L(e);
1096
1131
  if (!n || n === "center" || a === 0 && o === 0) return {
1097
1132
  x: r,
@@ -1102,7 +1137,7 @@ var b = {
1102
1137
  x: r + a * p,
1103
1138
  y: i + o * p
1104
1139
  };
1105
- }, pi = t(() => {
1140
+ }, yi = t(() => {
1106
1141
  let e = /* @__PURE__ */ new Map();
1107
1142
  M.value.forEach((t) => {
1108
1143
  let n = P.value[t.id];
@@ -1134,12 +1169,12 @@ var b = {
1134
1169
  bulge: Math.min(l * .15, 50)
1135
1170
  };
1136
1171
  }), t;
1137
- }), mi = (e) => {
1138
- let t = P.value[e.id], n = t && pi.value[t.key];
1172
+ }), bi = (e) => {
1173
+ let t = P.value[e.id], n = t && yi.value[t.key];
1139
1174
  if (!n) return null;
1140
1175
  let r = F(e.from), i = F(e.to);
1141
1176
  if (!r || !i) return null;
1142
- let a = n.slots[e.id] || 0, o = a * n.gap, s = fi(r, i, e.fromAnchor), c = fi(i, r, e.toAnchor);
1177
+ let a = n.slots[e.id] || 0, o = a * n.gap, s = vi(r, i, e.fromAnchor), c = vi(i, r, e.toAnchor);
1143
1178
  return {
1144
1179
  frame: n,
1145
1180
  slot: a,
@@ -1152,12 +1187,12 @@ var b = {
1152
1187
  y: c.y + n.ny * o
1153
1188
  }
1154
1189
  };
1155
- }, hi = (e) => {
1156
- let t = mi(e);
1190
+ }, xi = (e) => {
1191
+ let t = bi(e);
1157
1192
  if (!t) return "";
1158
1193
  let { from: n, to: r, frame: i, slot: a } = t, o = a * i.gap;
1159
- if (Gt.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
1160
- if (Gt.value === "polyline") {
1194
+ if (E.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
1195
+ if (E.value === "polyline") {
1161
1196
  if (i.dominant === "v") {
1162
1197
  let e = (n.y + r.y) / 2 + o;
1163
1198
  return `M ${n.x} ${n.y} L ${n.x} ${e} L ${r.x} ${e} L ${r.x} ${r.y}`;
@@ -1167,18 +1202,18 @@ var b = {
1167
1202
  }
1168
1203
  let s = (n.x + r.x) / 2 + i.nx * i.bulge, c = (n.y + r.y) / 2 + i.ny * i.bulge;
1169
1204
  return `M ${n.x} ${n.y} Q ${s} ${c} ${r.x} ${r.y}`;
1170
- }, gi = (e, t) => {
1171
- let n = mi(e);
1205
+ }, Si = (e, t) => {
1206
+ let n = bi(e);
1172
1207
  if (!n) return {
1173
1208
  x: 0,
1174
1209
  y: 0
1175
1210
  };
1176
1211
  let { from: r, to: i, frame: a, slot: o } = n, s = o * a.gap;
1177
- if (Gt.value === "straight") return {
1212
+ if (E.value === "straight") return {
1178
1213
  x: r.x + (i.x - r.x) * t,
1179
1214
  y: r.y + (i.y - r.y) * t
1180
1215
  };
1181
- if (Gt.value === "polyline") {
1216
+ if (E.value === "polyline") {
1182
1217
  if (a.dominant === "v") {
1183
1218
  let e = (r.y + i.y) / 2 + s, n = Math.abs(e - r.y), a = Math.abs(i.x - r.x), o = Math.abs(i.y - e), c = t * (n + a + o || 1);
1184
1219
  return c <= n ? {
@@ -1209,19 +1244,19 @@ var b = {
1209
1244
  x: (1 - t) * (1 - t) * r.x + 2 * (1 - t) * t * c + t * t * i.x,
1210
1245
  y: (1 - t) * (1 - t) * r.y + 2 * (1 - t) * t * l + t * t * i.y
1211
1246
  };
1212
- }, _i = t(() => X.value ? F(X.value.fromId) : null), vi = t(() => X.value && X.value.overId ? F(X.value.overId) : null), yi = t(() => _i.value ? I(_i.value) : "#00f0ff"), bi = t(() => {
1213
- let e = X.value;
1247
+ }, Ci = t(() => Y.value ? F(Y.value.fromId) : null), wi = t(() => Y.value && Y.value.overId ? F(Y.value.overId) : null), Ti = t(() => Ci.value ? I(Ci.value) : "#00f0ff"), Ei = t(() => {
1248
+ let e = Y.value;
1214
1249
  if (!e) return {
1215
1250
  x: 0,
1216
1251
  y: 0
1217
1252
  };
1218
- let t = vi.value;
1219
- return t && _i.value ? fi(t, _i.value, "edge") : {
1253
+ let t = wi.value;
1254
+ return t && Ci.value ? vi(t, Ci.value, "edge") : {
1220
1255
  x: e.px,
1221
1256
  y: e.py
1222
1257
  };
1223
- }), xi = t(() => {
1224
- let e = vi.value;
1258
+ }), Di = t(() => {
1259
+ let e = wi.value;
1225
1260
  if (!e) return null;
1226
1261
  let t = R(e);
1227
1262
  return {
@@ -1230,7 +1265,7 @@ var b = {
1230
1265
  w: t.width + 8,
1231
1266
  h: t.height + 8
1232
1267
  };
1233
- }), Si = (e) => {
1268
+ }), Oi = (e) => {
1234
1269
  let t = e.nodeIds.map((e) => F(e)).filter(Boolean);
1235
1270
  if (t.length === 0) return null;
1236
1271
  let n = e.padding, r = Math.min(...t.map((e) => e.x)) - n, i = Math.min(...t.map((e) => e.y)) - n, a = Math.max(...t.map((e) => e.x)) + n, o = Math.max(...t.map((e) => e.y)) + n;
@@ -1240,52 +1275,58 @@ var b = {
1240
1275
  width: a - r,
1241
1276
  height: o - i
1242
1277
  };
1243
- }, Ci = t(() => v.groups.map((e) => ({
1278
+ }, ki = t(() => v.groups.map((e) => ({
1244
1279
  ...e,
1245
- rect: Si(e)
1246
- })).filter((e) => e.rect)), Q = (e) => On(e) ? Pn.value : (F(e.from), e.centerText && e.centerText.color || "#00f0ff"), wi = (e) => {
1280
+ rect: Oi(e)
1281
+ })).filter((e) => e.rect)), Q = (e) => kn(e) ? Bn.value : (F(e.from), e.centerText && e.centerText.color || "#00f0ff"), Ai = (e) => {
1247
1282
  let t = P.value[e.id];
1248
1283
  return !!t && !t.hidden;
1249
- }, Ti = t(() => [...new Set(M.value.map(Q))].map((e) => ({
1284
+ }, ji = t(() => [...new Set(M.value.map(Q))].map((e) => ({
1250
1285
  key: String(e).replace("#", ""),
1251
1286
  color: e
1252
- }))), Ei = (e) => {
1287
+ }))), Mi = (e) => {
1253
1288
  let t = e.endMarker;
1254
1289
  if (!t || t === "none") return "";
1255
1290
  let n = Q(e) || "#00f0ff", r = String(n).replace("#", "");
1256
1291
  return `url(#${t === "dot" ? "edge-dot" : "edge-arrow"}-${r})`;
1257
- }, Di = /* @__PURE__ */ new Map(), Oi = {
1292
+ }, Ni = /* @__PURE__ */ new Map(), Pi = {
1258
1293
  nodes: null,
1259
1294
  edges: null,
1260
1295
  mode: null,
1261
1296
  epoch: -1
1262
- }, ki = () => {
1263
- let e = Oi;
1264
- (e.nodes !== T.value || e.edges !== M.value || e.mode !== Gt.value || e.epoch !== Rt) && (Oi = {
1265
- nodes: T.value,
1297
+ }, Fi = () => {
1298
+ let e = Pi;
1299
+ (e.nodes !== w.value || e.edges !== M.value || e.mode !== E.value || e.epoch !== zt) && (Pi = {
1300
+ nodes: w.value,
1266
1301
  edges: M.value,
1267
- mode: Gt.value,
1268
- epoch: Rt
1269
- }, Di = /* @__PURE__ */ new Map());
1302
+ mode: E.value,
1303
+ epoch: zt
1304
+ }, Ni = /* @__PURE__ */ new Map());
1270
1305
  }, $ = (e) => {
1271
- ki();
1272
- let t = Di.get(e.id);
1273
- return t === void 0 && (t = hi(e), Di.set(e.id, t)), t;
1274
- }, Ai = (e, t = 1) => `${2 / e.speed * t}s`, ji = (e) => `${3 / e.speed}s`, Mi = (e) => S(e).text, Ni = (e) => !!e && String(S(e).text ?? "").trim() !== "", Pi = (e, t) => {
1306
+ Fi();
1307
+ let t = Ni.get(e.id);
1308
+ return t === void 0 && (t = xi(e), Ni.set(e.id, t)), t;
1309
+ }, Ii = (e, t = 1) => `${2 / e.speed * t}s`, Li = (e) => `${3 / e.speed}s`, Ri = (e) => {
1310
+ let t = Rr(e);
1311
+ return t === "flow" || t === "all";
1312
+ }, zi = (e) => {
1313
+ let t = Rr(e);
1314
+ return t === "particle" || t === "all";
1315
+ }, Bi = (e) => x(e).text, Vi = (e) => !!e && String(x(e).text ?? "").trim() !== "", Hi = (e, t) => {
1275
1316
  if (!e) return null;
1276
- let n = S(e), r = Number(t.fontSize) || Number(n.fontSize) || 8, i = String(n.text ?? ""), a = 0;
1317
+ let n = x(e), r = Number(t.fontSize) || Number(n.fontSize) || 8, i = String(n.text ?? ""), a = 0;
1277
1318
  for (let e of i) a += e.charCodeAt(0) > 11904 ? 1 : .62;
1278
1319
  return {
1279
1320
  w: Math.max(14, a * r + 8),
1280
1321
  h: Math.max(12, r + 6)
1281
1322
  };
1282
- }, Fi = (e, t) => {
1283
- let n = gi(e, Math.max(0, t - .005)), r = gi(e, Math.min(1, t + .005));
1323
+ }, Ui = (e, t) => {
1324
+ let n = Si(e, Math.max(0, t - .005)), r = Si(e, Math.min(1, t + .005));
1284
1325
  return Math.atan2(r.y - n.y, r.x - n.x) * 180 / Math.PI;
1285
- }, Ii = (e) => {
1326
+ }, Wi = (e) => {
1286
1327
  let t = e % 180;
1287
1328
  return t > 90 && (t -= 180), t < -90 && (t += 180), t;
1288
- }, Li = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(S(e).rotation || 0) + (n || 0)})`, Ri = t(() => {
1329
+ }, Gi = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(x(e).rotation || 0) + (n || 0)})`, Ki = t(() => {
1289
1330
  let e = [];
1290
1331
  for (let t of G.value) {
1291
1332
  let n = P.value[t.id];
@@ -1297,16 +1338,16 @@ var b = {
1297
1338
  id: t.id,
1298
1339
  edge: t,
1299
1340
  info: n,
1300
- color: a && ie[a.type] || "#00f0ff",
1301
- start: gi(t, .28),
1302
- center: gi(t, .5),
1303
- end: gi(t, .72),
1304
- startAngle: Ii(Fi(t, .28)),
1305
- centerAngle: Ii(Fi(t, .5)),
1306
- endAngle: Ii(Fi(t, .72)),
1307
- fromBox: Pi(t.fromText, t),
1308
- centerBox: Pi(t.centerText, t),
1309
- toBox: Pi(t.toText, t)
1341
+ color: a && ie[a.nodeType] || "#00f0ff",
1342
+ start: Si(t, .28),
1343
+ center: Si(t, .5),
1344
+ end: Si(t, .72),
1345
+ startAngle: Wi(Ui(t, .28)),
1346
+ centerAngle: Wi(Ui(t, .5)),
1347
+ endAngle: Wi(Ui(t, .72)),
1348
+ fromBox: Hi(t.fromText, t),
1349
+ centerBox: Hi(t.centerText, t),
1350
+ toBox: Hi(t.toText, t)
1310
1351
  });
1311
1352
  }
1312
1353
  return e;
@@ -1320,29 +1361,34 @@ var b = {
1320
1361
  addEdges: un,
1321
1362
  updateNodes: dn,
1322
1363
  updateEdges: fn,
1323
- clientToSvg: Qr,
1324
- svgToClient: $r
1364
+ clientToSvg: ai,
1365
+ svgToClient: oi,
1366
+ moveLayerUp: Fn,
1367
+ moveLayerDown: In,
1368
+ moveToFront: Ln,
1369
+ moveToBack: Rn,
1370
+ downloadSVG: zn
1325
1371
  }), (t, c) => (u(), r("svg", {
1326
1372
  ref_key: "svgRef",
1327
1373
  ref: O,
1328
1374
  class: "topology-svg",
1329
- style: s(gr.value),
1330
- viewBox: `${Gn.value} ${Kn.value} ${U.value} ${W.value}`,
1331
- onMousedown: sr,
1332
- onMousemove: Br,
1333
- onMouseup: Hr,
1334
- onMouseleave: Hr,
1335
- onClick: Bn,
1336
- onWheel: g(Qn, ["prevent"])
1375
+ style: s(Cr.value),
1376
+ viewBox: `${Zn.value} ${Qn.value} ${U.value} ${W.value}`,
1377
+ onMousedown: pr,
1378
+ onMousemove: qr,
1379
+ onMouseup: Yr,
1380
+ onMouseleave: Yr,
1381
+ onClick: Kn,
1382
+ onWheel: g(ir, ["prevent"])
1337
1383
  }, [
1338
1384
  i("defs", null, [
1339
1385
  c[3] ||= a("<filter id=\"glow-core\" x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"3\" result=\"blur\"></feGaussianBlur><feMerge><feMergeNode in=\"blur\"></feMergeNode><feMergeNode in=\"SourceGraphic\"></feMergeNode></feMerge></filter><filter id=\"glow-strong\" x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"6\" result=\"blur\"></feGaussianBlur><feMerge><feMergeNode in=\"blur\"></feMergeNode><feMergeNode in=\"blur\"></feMergeNode><feMergeNode in=\"SourceGraphic\"></feMergeNode></feMerge></filter>", 2),
1340
1386
  i("radialGradient", {
1341
1387
  id: "bg-grid",
1342
- cx: xr.value.cx,
1343
- cy: xr.value.cy,
1344
- r: xr.value.r
1345
- }, [(u(!0), r(e, null, f(xr.value.stops, (e, t) => (u(), r("stop", {
1388
+ cx: Or.value.cx,
1389
+ cy: Or.value.cy,
1390
+ r: Or.value.r
1391
+ }, [(u(!0), r(e, null, f(Or.value.stops, (e, t) => (u(), r("stop", {
1346
1392
  key: `bg-stop-${t}`,
1347
1393
  offset: e.offset,
1348
1394
  "stop-color": e.color,
@@ -1369,7 +1415,7 @@ var b = {
1369
1415
  }, null, 8, de)
1370
1416
  ], 8, ce))), 128)),
1371
1417
  c[4] ||= a("<linearGradient id=\"flow-grad-1\" gradientUnits=\"userSpaceOnUse\"><stop offset=\"0%\" stop-color=\"#00f0ff\" stop-opacity=\"0\"></stop><stop offset=\"40%\" stop-color=\"#00f0ff\" stop-opacity=\"1\"></stop><stop offset=\"60%\" stop-color=\"#00f0ff\" stop-opacity=\"1\"></stop><stop offset=\"100%\" stop-color=\"#00f0ff\" stop-opacity=\"0\"></stop></linearGradient>", 1),
1372
- (u(!0), r(e, null, f(Ti.value, (e) => (u(), r("marker", {
1418
+ (u(!0), r(e, null, f(ji.value, (e) => (u(), r("marker", {
1373
1419
  key: `m-arrow-${e.key}`,
1374
1420
  id: `edge-arrow-${e.key}`,
1375
1421
  viewBox: "0 0 10 10",
@@ -1383,7 +1429,7 @@ var b = {
1383
1429
  d: "M1,2.5 L9,5 L1,7.5 Z",
1384
1430
  fill: e.color
1385
1431
  }, null, 8, pe)], 8, fe))), 128)),
1386
- (u(!0), r(e, null, f(Ti.value, (e) => (u(), r("marker", {
1432
+ (u(!0), r(e, null, f(ji.value, (e) => (u(), r("marker", {
1387
1433
  key: `m-dot-${e.key}`,
1388
1434
  id: `edge-dot-${e.key}`,
1389
1435
  viewBox: "0 0 10 10",
@@ -1403,29 +1449,29 @@ var b = {
1403
1449
  i("rect", {
1404
1450
  width: U.value,
1405
1451
  height: W.value,
1406
- x: Gn.value,
1407
- y: Kn.value,
1452
+ x: Zn.value,
1453
+ y: Qn.value,
1408
1454
  fill: "url(#bg-grid)"
1409
1455
  }, null, 8, ge),
1410
- _r.value ? (u(), r(e, { key: 0 }, [i("pattern", {
1456
+ wr.value ? (u(), r(e, { key: 0 }, [i("pattern", {
1411
1457
  id: "grid",
1412
- width: yr.value,
1413
- height: yr.value,
1458
+ width: Er.value,
1459
+ height: Er.value,
1414
1460
  patternUnits: "userSpaceOnUse"
1415
1461
  }, [i("path", {
1416
- d: `M ${yr.value} 0 L 0 0 0 ${yr.value}`,
1462
+ d: `M ${Er.value} 0 L 0 0 0 ${Er.value}`,
1417
1463
  fill: "none",
1418
- stroke: vr.value,
1464
+ stroke: Tr.value,
1419
1465
  "stroke-width": "0.5"
1420
1466
  }, null, 8, ve)], 8, _e), i("rect", {
1421
1467
  width: U.value,
1422
1468
  height: W.value,
1423
- x: Gn.value,
1424
- y: Kn.value,
1469
+ x: Zn.value,
1470
+ y: Qn.value,
1425
1471
  fill: "url(#grid)",
1426
- opacity: br.value
1472
+ opacity: Dr.value
1427
1473
  }, null, 8, ye)], 64)) : n("", !0),
1428
- Sr.value ? (u(), r("g", be, [...c[5] ||= [
1474
+ kr.value ? (u(), r("g", be, [...c[5] ||= [
1429
1475
  i("line", {
1430
1476
  x1: "-22",
1431
1477
  y1: "0",
@@ -1457,7 +1503,7 @@ var b = {
1457
1503
  opacity: "0.8"
1458
1504
  }, null, -1)
1459
1505
  ]])) : n("", !0),
1460
- (u(!0), r(e, null, f(Ci.value, (e) => (u(), r("g", { key: e.id }, [
1506
+ (u(!0), r(e, null, f(ki.value, (e) => (u(), r("g", { key: e.id }, [
1461
1507
  i("rect", {
1462
1508
  x: e.rect.x,
1463
1509
  y: e.rect.y,
@@ -1526,9 +1572,9 @@ var b = {
1526
1572
  stroke: "#1a2744",
1527
1573
  "stroke-width": "2",
1528
1574
  "stroke-linecap": "round",
1529
- "marker-end": Ei(e)
1575
+ "marker-end": Mi(e)
1530
1576
  }, null, 8, Oe))), 128)),
1531
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `glow-${t.id}` }, [kr.value ? (u(), r("path", {
1577
+ (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `glow-${t.id}` }, [Ir.value ? (u(), r("path", {
1532
1578
  key: 0,
1533
1579
  d: $(t),
1534
1580
  fill: "none",
@@ -1538,16 +1584,16 @@ var b = {
1538
1584
  opacity: "0.15",
1539
1585
  filter: "url(#glow-strong)"
1540
1586
  }, null, 8, ke)) : n("", !0)], 64))), 128)),
1541
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `sel-${t.id}` }, [On(t) ? (u(), r("path", {
1587
+ (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `sel-${t.id}` }, [kn(t) ? (u(), r("path", {
1542
1588
  key: 0,
1543
1589
  d: $(t),
1544
1590
  fill: "none",
1545
- stroke: Pn.value,
1591
+ stroke: Bn.value,
1546
1592
  "stroke-width": "4",
1547
1593
  opacity: "0.35",
1548
1594
  filter: "url(#glow-strong)"
1549
1595
  }, null, 8, Ae)) : n("", !0)], 64))), 128)),
1550
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `flow-${t.id}` }, [Or.value && jr(t) ? (u(), r("g", je, [
1596
+ (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `flow-${t.id}` }, [Ri(t) ? (u(), r("g", je, [
1551
1597
  i("path", {
1552
1598
  d: $(t),
1553
1599
  fill: "none",
@@ -1560,7 +1606,7 @@ var b = {
1560
1606
  attributeName: "stroke-dashoffset",
1561
1607
  from: "0",
1562
1608
  to: "-52",
1563
- dur: Ai(t),
1609
+ dur: Ii(t),
1564
1610
  repeatCount: "indefinite"
1565
1611
  }, null, 8, Ne)], 8, Me),
1566
1612
  i("path", {
@@ -1575,7 +1621,7 @@ var b = {
1575
1621
  attributeName: "stroke-dashoffset",
1576
1622
  from: "-30",
1577
1623
  to: "-82",
1578
- dur: Ai(t, 1.3),
1624
+ dur: Ii(t, 1.3),
1579
1625
  repeatCount: "indefinite"
1580
1626
  }, null, 8, Fe)], 8, Pe),
1581
1627
  i("path", {
@@ -1591,18 +1637,18 @@ var b = {
1591
1637
  attributeName: "stroke-dashoffset",
1592
1638
  from: "0",
1593
1639
  to: "-84",
1594
- dur: Ai(t, .8),
1640
+ dur: Ii(t, .8),
1595
1641
  repeatCount: "indefinite"
1596
1642
  }, null, 8, Le)], 8, Ie)
1597
1643
  ])) : n("", !0)], 64))), 128)),
1598
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `particle-${t.id}` }, [Or.value && jr(t) ? (u(), r("g", Re, [i("circle", {
1644
+ (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `particle-${t.id}` }, [zi(t) ? (u(), r("g", Re, [i("circle", {
1599
1645
  r: "3",
1600
1646
  fill: Q(t),
1601
1647
  opacity: "0.9",
1602
1648
  filter: "url(#glow-core)"
1603
1649
  }, [i("animateMotion", {
1604
1650
  path: $(t),
1605
- dur: ji(t),
1651
+ dur: Li(t),
1606
1652
  repeatCount: "indefinite"
1607
1653
  }, null, 8, Be)], 8, ze), i("circle", {
1608
1654
  r: "8",
@@ -1611,17 +1657,17 @@ var b = {
1611
1657
  filter: "url(#glow-strong)"
1612
1658
  }, [i("animateMotion", {
1613
1659
  path: $(t),
1614
- dur: ji(t),
1660
+ dur: Li(t),
1615
1661
  repeatCount: "indefinite"
1616
1662
  }, null, 8, He)], 8, Ve)])) : n("", !0)], 64))), 128)),
1617
- (u(!0), r(e, null, f(Ri.value, (t) => (u(), r(e, { key: `text-${t.id}` }, [t.info.merged && t.info.representative ? (u(), r("g", {
1663
+ (u(!0), r(e, null, f(Ki.value, (t) => (u(), r(e, { key: `text-${t.id}` }, [t.info.merged && t.info.representative ? (u(), r("g", {
1618
1664
  key: 0,
1619
1665
  transform: `translate(${t.center.x}, ${t.center.y}) rotate(${t.centerAngle})`
1620
1666
  }, [i("rect", {
1621
1667
  x: "-7",
1622
- y: -C(t.edge, null) / 2,
1668
+ y: -S(t.edge, null) / 2,
1623
1669
  width: 14,
1624
- height: C(t.edge, null),
1670
+ height: S(t.edge, null),
1625
1671
  rx: "2",
1626
1672
  fill: "#FFFFFF",
1627
1673
  opacity: "0.9",
@@ -1631,115 +1677,115 @@ var b = {
1631
1677
  y: "0",
1632
1678
  "dominant-baseline": "central",
1633
1679
  "text-anchor": "middle",
1634
- "font-size": C(t.edge, null),
1635
- fill: w(t.edge, null),
1680
+ "font-size": S(t.edge, null),
1681
+ fill: C(t.edge, null),
1636
1682
  "font-family": "'SF Mono', monospace",
1637
1683
  opacity: "1"
1638
1684
  }, m(t.info.count), 9, Ge)], 8, Ue)) : t.info.merged ? n("", !0) : (u(), r("g", Ke, [
1639
- Ni(t.edge.fromText) ? (u(), r("g", {
1685
+ Vi(t.edge.fromText) ? (u(), r("g", {
1640
1686
  key: 0,
1641
- transform: Li(t.edge.fromText, t.start, t.startAngle)
1642
- }, [Cr.value ? (u(), r("rect", {
1687
+ transform: Gi(t.edge.fromText, t.start, t.startAngle)
1688
+ }, [Ar.value ? (u(), r("rect", {
1643
1689
  key: 0,
1644
1690
  x: -t.fromBox.w / 2,
1645
1691
  y: -t.fromBox.h / 2,
1646
1692
  width: t.fromBox.w,
1647
1693
  height: t.fromBox.h,
1648
1694
  rx: "3",
1649
- fill: wr.value,
1695
+ fill: jr.value,
1650
1696
  opacity: "0.92",
1651
- stroke: w(t.edge, t.edge.fromText),
1697
+ stroke: C(t.edge, t.edge.fromText),
1652
1698
  "stroke-opacity": "0.35",
1653
1699
  "stroke-width": "0.6"
1654
1700
  }, null, 8, Je)) : n("", !0), i("text", {
1655
1701
  y: "0",
1656
1702
  "dominant-baseline": "central",
1657
1703
  "text-anchor": "middle",
1658
- "font-size": C(t.edge, t.edge.fromText),
1659
- fill: w(t.edge, t.edge.fromText),
1704
+ "font-size": S(t.edge, t.edge.fromText),
1705
+ fill: C(t.edge, t.edge.fromText),
1660
1706
  "font-family": "'SF Mono', monospace",
1661
1707
  "font-weight": "500",
1662
1708
  opacity: "0.9"
1663
- }, m(Mi(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
1664
- Ni(t.edge.centerText) ? (u(), r("g", {
1709
+ }, m(Bi(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
1710
+ Vi(t.edge.centerText) ? (u(), r("g", {
1665
1711
  key: 1,
1666
- transform: Li(t.edge.centerText, t.center, t.centerAngle)
1667
- }, [Cr.value ? (u(), r("rect", {
1712
+ transform: Gi(t.edge.centerText, t.center, t.centerAngle)
1713
+ }, [Ar.value ? (u(), r("rect", {
1668
1714
  key: 0,
1669
1715
  x: -t.centerBox.w / 2,
1670
1716
  y: -t.centerBox.h / 2,
1671
1717
  width: t.centerBox.w,
1672
1718
  height: t.centerBox.h,
1673
1719
  rx: "3",
1674
- fill: wr.value,
1720
+ fill: jr.value,
1675
1721
  opacity: "0.92",
1676
- stroke: w(t.edge, t.edge.centerText),
1722
+ stroke: C(t.edge, t.edge.centerText),
1677
1723
  "stroke-opacity": "0.35",
1678
1724
  "stroke-width": "0.6"
1679
1725
  }, null, 8, Ze)) : n("", !0), i("text", {
1680
1726
  y: "0",
1681
1727
  "dominant-baseline": "central",
1682
1728
  "text-anchor": "middle",
1683
- "font-size": C(t.edge, t.edge.centerText),
1684
- fill: w(t.edge, t.edge.centerText),
1729
+ "font-size": S(t.edge, t.edge.centerText),
1730
+ fill: C(t.edge, t.edge.centerText),
1685
1731
  "font-family": "'SF Mono', monospace",
1686
1732
  "font-weight": "600",
1687
1733
  opacity: "1"
1688
- }, m(Mi(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
1689
- Ni(t.edge.toText) ? (u(), r("g", {
1734
+ }, m(Bi(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
1735
+ Vi(t.edge.toText) ? (u(), r("g", {
1690
1736
  key: 2,
1691
- transform: Li(t.edge.toText, t.end, t.endAngle)
1692
- }, [Cr.value ? (u(), r("rect", {
1737
+ transform: Gi(t.edge.toText, t.end, t.endAngle)
1738
+ }, [Ar.value ? (u(), r("rect", {
1693
1739
  key: 0,
1694
1740
  x: -t.toBox.w / 2,
1695
1741
  y: -t.toBox.h / 2,
1696
1742
  width: t.toBox.w,
1697
1743
  height: t.toBox.h,
1698
1744
  rx: "3",
1699
- fill: wr.value,
1745
+ fill: jr.value,
1700
1746
  opacity: "0.92",
1701
- stroke: w(t.edge, t.edge.toText),
1747
+ stroke: C(t.edge, t.edge.toText),
1702
1748
  "stroke-opacity": "0.35",
1703
1749
  "stroke-width": "0.6"
1704
1750
  }, null, 8, et)) : n("", !0), i("text", {
1705
1751
  y: "0",
1706
1752
  "dominant-baseline": "central",
1707
1753
  "text-anchor": "middle",
1708
- "font-size": C(t.edge, t.edge.toText),
1709
- fill: w(t.edge, t.edge.toText),
1754
+ "font-size": S(t.edge, t.edge.toText),
1755
+ fill: C(t.edge, t.edge.toText),
1710
1756
  "font-family": "'SF Mono', monospace",
1711
1757
  "font-weight": "500",
1712
1758
  opacity: "0.9"
1713
- }, m(Mi(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
1759
+ }, m(Bi(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
1714
1760
  ]))], 64))), 128)),
1715
- X.value ? (u(), r("g", nt, [
1761
+ Y.value ? (u(), r("g", nt, [
1716
1762
  i("line", {
1717
- x1: X.value.ax,
1718
- y1: X.value.ay,
1719
- x2: bi.value.x,
1720
- y2: bi.value.y,
1721
- stroke: yi.value,
1763
+ x1: Y.value.ax,
1764
+ y1: Y.value.ay,
1765
+ x2: Ei.value.x,
1766
+ y2: Ei.value.y,
1767
+ stroke: Ti.value,
1722
1768
  "stroke-width": "2",
1723
1769
  "stroke-dasharray": "6 6",
1724
1770
  "stroke-linecap": "round",
1725
1771
  opacity: "0.9"
1726
1772
  }, null, 8, rt),
1727
1773
  i("circle", {
1728
- cx: X.value.px,
1729
- cy: X.value.py,
1774
+ cx: Y.value.px,
1775
+ cy: Y.value.py,
1730
1776
  r: "3.5",
1731
- fill: yi.value,
1777
+ fill: Ti.value,
1732
1778
  opacity: "0.9"
1733
1779
  }, null, 8, it),
1734
- X.value.overId && xi.value ? (u(), r("rect", {
1780
+ Y.value.overId && Di.value ? (u(), r("rect", {
1735
1781
  key: 0,
1736
- x: xi.value.x,
1737
- y: xi.value.y,
1738
- width: xi.value.w,
1739
- height: xi.value.h,
1782
+ x: Di.value.x,
1783
+ y: Di.value.y,
1784
+ width: Di.value.w,
1785
+ height: Di.value.h,
1740
1786
  rx: "6",
1741
1787
  fill: "none",
1742
- stroke: yi.value,
1788
+ stroke: Ti.value,
1743
1789
  "stroke-width": "1.5",
1744
1790
  "stroke-dasharray": "6 4",
1745
1791
  opacity: "0.9"
@@ -1755,14 +1801,14 @@ var b = {
1755
1801
  "pointer-events": "stroke",
1756
1802
  cursor: "pointer"
1757
1803
  },
1758
- onClick: g((t) => Fn(e, t), ["stop"])
1804
+ onClick: g((t) => Vn(e, t), ["stop"])
1759
1805
  }, null, 8, ot))), 128)),
1760
- (u(!0), r(e, null, f(Zn.value, (a) => (u(), r("g", {
1806
+ (u(!0), r(e, null, f(rr.value, (a) => (u(), r("g", {
1761
1807
  key: a.id,
1762
1808
  transform: `translate(${a.x}, ${a.y})`,
1763
1809
  class: o(["topology-node", D.value === a.id ? "dragging" : ""]),
1764
- onMousedown: (e) => Ir(e, a.id),
1765
- onClick: (e) => Nn(a, e),
1810
+ onMousedown: (e) => Ur(e, a.id),
1811
+ onClick: (e) => Pn(a, e),
1766
1812
  style: s({
1767
1813
  cursor: v.editable && v.config.nodeDraggable !== !1 ? "grab" : "default",
1768
1814
  color: I(a)
@@ -1770,45 +1816,45 @@ var b = {
1770
1816
  }, [
1771
1817
  i("rect", {
1772
1818
  class: "node-hit-area",
1773
- x: Cn(a).x,
1774
- y: Cn(a).y,
1775
- width: Cn(a).width,
1776
- height: Cn(a).height,
1819
+ x: wn(a).x,
1820
+ y: wn(a).y,
1821
+ width: wn(a).width,
1822
+ height: wn(a).height,
1777
1823
  fill: "transparent",
1778
1824
  "pointer-events": "all"
1779
1825
  }, null, 8, ct),
1780
- En(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1826
+ Dn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1781
1827
  key: 0,
1782
1828
  x: R(a).x,
1783
1829
  y: R(a).y,
1784
1830
  width: R(a).width,
1785
1831
  height: R(a).height,
1786
- rx: Fr(a),
1787
- fill: En(a),
1832
+ rx: Hr(a),
1833
+ fill: Dn(a),
1788
1834
  opacity: "0.15"
1789
1835
  }, null, 8, lt)) : n("", !0),
1790
- Tn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1836
+ En(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1791
1837
  key: 1,
1792
- x: Tn(a).x,
1793
- y: Tn(a).y,
1794
- width: Tn(a).width,
1795
- height: Tn(a).height,
1796
- rx: Fr(a),
1838
+ x: En(a).x,
1839
+ y: En(a).y,
1840
+ width: En(a).width,
1841
+ height: En(a).height,
1842
+ rx: Hr(a),
1797
1843
  fill: "none",
1798
- stroke: Mr(a),
1799
- "stroke-width": Nr(a),
1800
- "stroke-dasharray": Pr(a),
1844
+ stroke: zr(a),
1845
+ "stroke-width": Br(a),
1846
+ "stroke-dasharray": Vr(a),
1801
1847
  opacity: "0.8"
1802
1848
  }, null, 8, ut)) : n("", !0),
1803
- Dn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1849
+ On(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1804
1850
  key: 2,
1805
1851
  x: R(a).x,
1806
1852
  y: R(a).y,
1807
1853
  width: R(a).width,
1808
1854
  height: R(a).height,
1809
- rx: Fr(a),
1855
+ rx: Hr(a),
1810
1856
  fill: "none",
1811
- stroke: Mn.value,
1857
+ stroke: Nn.value,
1812
1858
  "stroke-width": "2.5",
1813
1859
  transform: "scale(1.1)",
1814
1860
  style: { "pointer-events": "none" }
@@ -1824,12 +1870,12 @@ var b = {
1824
1870
  y: "4",
1825
1871
  transform: `rotate(${a.rotation || 0} 0 4)`,
1826
1872
  "text-anchor": "middle",
1827
- fill: Vt(a) || I(a) || hn(a).color,
1828
- "font-size": Bt(a, 12),
1873
+ fill: Ht(a) || I(a) || hn(a).color,
1874
+ "font-size": Vt(a, 12),
1829
1875
  "font-family": "'SF Mono', 'Cascadia Code', 'Consolas', monospace",
1830
1876
  "font-weight": "600"
1831
- }, m(a.label), 9, pt)], 64)) : (u(), r(e, { key: 4 }, [
1832
- i("g", { transform: yn(a) }, [a.state !== "none" && Ar.value ? (u(), r("circle", {
1877
+ }, m(a.label), 9, pt)], 64)) : _n(a) ? (u(), r(e, { key: 4 }, [], 64)) : (u(), r(e, { key: 5 }, [
1878
+ i("g", { transform: bn(a) }, [a.state !== "none" && Lr.value ? (u(), r("circle", {
1833
1879
  key: 0,
1834
1880
  r: "30",
1835
1881
  fill: "none",
@@ -1859,9 +1905,9 @@ var b = {
1859
1905
  fill: I(a),
1860
1906
  opacity: "0.9"
1861
1907
  }, null, 8, _t)])])], 8, mt),
1862
- Er.value ? (u(), r("g", {
1908
+ Nr.value ? (u(), r("g", {
1863
1909
  key: 0,
1864
- transform: bn(a)
1910
+ transform: xn(a)
1865
1911
  }, [i("circle", {
1866
1912
  r: "4",
1867
1913
  fill: hn(a).color,
@@ -1869,12 +1915,12 @@ var b = {
1869
1915
  "stroke-width": "2"
1870
1916
  }, null, 8, yt)], 8, vt)) : n("", !0),
1871
1917
  i("text", {
1872
- y: Sn(a),
1873
- transform: `rotate(${a.rotation || 0} 0 ${Sn(a)})`,
1918
+ y: Cn(a),
1919
+ transform: `rotate(${a.rotation || 0} 0 ${Cn(a)})`,
1874
1920
  "text-anchor": "middle",
1875
- fill: Vt(a),
1876
- "font-size": Bt(a),
1877
- "font-weight": Ht(a),
1921
+ fill: Ht(a),
1922
+ "font-size": Vt(a),
1923
+ "font-weight": Ut(a),
1878
1924
  "font-family": "'Segoe UI', system-ui, sans-serif",
1879
1925
  opacity: "0.9"
1880
1926
  }, [(u(!0), r(e, null, f(String(a.label ?? "").split("\n"), (e, t) => (u(), r("tspan", {
@@ -1883,7 +1929,7 @@ var b = {
1883
1929
  dy: t === 0 ? 0 : "1.2em"
1884
1930
  }, m(e), 9, xt))), 128))], 8, bt)
1885
1931
  ], 64)),
1886
- Tr.value ? (u(), r("g", St, [(u(!0), r(e, null, f(Zr(a), (e) => (u(), r("circle", {
1932
+ Mr.value ? (u(), r("g", St, [(u(!0), r(e, null, f(ii(a), (e) => (u(), r("circle", {
1887
1933
  key: e.side,
1888
1934
  cx: e.x,
1889
1935
  cy: e.y,
@@ -1892,40 +1938,40 @@ var b = {
1892
1938
  fill: "#0a0e1a",
1893
1939
  stroke: I(a),
1894
1940
  "stroke-width": "1.5",
1895
- onPointerdown: g((t) => ei(t, a.id, e), ["stop", "prevent"]),
1896
- onPointermove: g(ui, ["stop"]),
1897
- onPointerup: g(di, ["stop"]),
1898
- onPointercancel: g(di, ["stop"]),
1899
- onLostpointercapture: di,
1941
+ onPointerdown: g((t) => si(t, a.id, e), ["stop", "prevent"]),
1942
+ onPointermove: g(gi, ["stop"]),
1943
+ onPointerup: g(_i, ["stop"]),
1944
+ onPointercancel: g(_i, ["stop"]),
1945
+ onLostpointercapture: _i,
1900
1946
  onMousedown: c[0] ||= g(() => {}, ["stop", "prevent"]),
1901
1947
  onClick: c[1] ||= g(() => {}, ["stop"])
1902
1948
  }, null, 40, Ct))), 128))])) : n("", !0)
1903
1949
  ], 46, st))), 128)),
1904
- Xr.value ? (u(), r("g", wt, [(u(!0), r(e, null, f(Wr(Xr.value), (e) => (u(), r("rect", {
1950
+ ri.value ? (u(), r("g", wt, [(u(!0), r(e, null, f(Zr(ri.value), (e) => (u(), r("rect", {
1905
1951
  key: e.side,
1906
- x: Xr.value.x + e.x - 4.5,
1907
- y: Xr.value.y + e.y - 4.5,
1952
+ x: ri.value.x + e.x - 4.5,
1953
+ y: ri.value.y + e.y - 4.5,
1908
1954
  width: "9",
1909
1955
  height: "9",
1910
1956
  rx: "2",
1911
1957
  class: o(["node-resize-handle", `rt-${e.side}`]),
1912
- onMousedown: g((t) => Kr(t, Xr.value, e.side), ["stop", "prevent"]),
1958
+ onMousedown: g((t) => $r(t, ri.value, e.side), ["stop", "prevent"]),
1913
1959
  onClick: c[2] ||= g(() => {}, ["stop"])
1914
1960
  }, null, 42, Tt))), 128))])) : n("", !0),
1915
1961
  q.value ? (u(), r("rect", {
1916
1962
  key: 4,
1917
1963
  class: "marquee-box",
1918
- x: ir.value.x,
1919
- y: ir.value.y,
1920
- width: ir.value.width,
1921
- height: ir.value.height,
1964
+ x: ur.value.x,
1965
+ y: ur.value.y,
1966
+ width: ur.value.width,
1967
+ height: ur.value.height,
1922
1968
  rx: "2",
1923
1969
  "vector-effect": "non-scaling-stroke"
1924
1970
  }, null, 8, Et)) : n("", !0)
1925
1971
  ], 44, ae));
1926
1972
  }
1927
- }, zt = { install(e) {
1928
- e.component("Topology", Rt);
1973
+ }, Bt = { install(e) {
1974
+ e.component("Topology", zt);
1929
1975
  } };
1930
1976
  //#endregion
1931
- export { Rt as Topology, zt as default, ie as nodeColors, b as nodeStates };
1977
+ export { zt as Topology, Bt as default, ie as nodeColors, b as nodeStates };