@html-graph/html-graph 8.9.0 → 8.10.0

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.
@@ -52,7 +52,7 @@ class Ee {
52
52
  this.clear(), this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
53
53
  }
54
54
  updateNodePosition(e) {
55
- const t = this.graphStore.getNode(e), { width: o, height: s } = t.element.getBoundingClientRect(), a = this.viewportStore.getViewportMatrix().scale, { payload: n } = t, h = n.centerFn(o, s), d = n.x - a * h.x, c = n.y - a * h.y;
55
+ const t = this.graphStore.getNode(e), { width: o, height: s } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(o, s), d = a.x - n * h.x, c = a.y - n * h.y;
56
56
  t.element.style.transform = `translate(${d}px, ${c}px)`;
57
57
  }
58
58
  updateNodePriority(e) {
@@ -66,27 +66,27 @@ class Ee {
66
66
  this.edgeIdToElementMap.set(e, s), this.container.appendChild(s);
67
67
  }
68
68
  renderEdge(e) {
69
- const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from), s = this.graphStore.getPort(t.to), a = o.element.getBoundingClientRect(), n = s.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
69
+ const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from), s = this.graphStore.getPort(t.to), n = o.element.getBoundingClientRect(), a = s.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
70
70
  o,
71
- a,
71
+ n,
72
72
  h,
73
73
  d
74
- ), u = this.createEdgeRenderPort(s, n, h, d);
75
- let g = L.Line;
76
- o.element === s.element ? g = L.PortCycle : o.nodeId === s.nodeId && (g = L.NodeCycle), t.payload.shape.render({ from: c, to: u, category: g });
74
+ ), g = this.createEdgeRenderPort(s, a, h, d);
75
+ let u = L.Line;
76
+ o.element === s.element ? u = L.PortCycle : o.nodeId === s.nodeId && (u = L.NodeCycle), t.payload.shape.render({ from: c, to: g, category: u });
77
77
  }
78
78
  updateEdgePriority(e) {
79
79
  const t = this.graphStore.getEdge(e);
80
80
  t.payload.shape.svg.style.zIndex = `${t.payload.priority}`;
81
81
  }
82
82
  createEdgeRenderPort(e, t, o, s) {
83
- const a = this.viewportStore.createContentCoords({
83
+ const n = this.viewportStore.createContentCoords({
84
84
  x: t.left - o.left,
85
85
  y: t.top - o.top
86
86
  });
87
87
  return {
88
- x: a.x,
89
- y: a.y,
88
+ x: n.x,
89
+ y: n.y,
90
90
  width: t.width * s,
91
91
  height: t.height * s,
92
92
  direction: e.payload.direction
@@ -109,8 +109,8 @@ class et {
109
109
  return o >= this.xFrom && o <= this.xTo && s >= this.yFrom && s <= this.yTo;
110
110
  }
111
111
  hasEdge(e) {
112
- const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, a = this.graphStore.getNode(o).payload, n = this.graphStore.getNode(s).payload, h = Math.min(a.x, n.x), d = Math.max(a.x, n.x), c = Math.min(a.y, n.y), u = Math.max(a.y, n.y);
113
- return h <= this.xTo && d >= this.xFrom && c <= this.yTo && u >= this.yFrom;
112
+ const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(o).payload, a = this.graphStore.getNode(s).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), g = Math.max(n.y, a.y);
113
+ return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
114
114
  }
115
115
  }
116
116
  class tt {
@@ -120,21 +120,21 @@ class tt {
120
120
  i(this, "renderingBox");
121
121
  i(this, "updateViewport", (e) => {
122
122
  this.renderingBox.setRenderingBox(e);
123
- const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
124
- this.graphStore.getAllNodeIds().forEach((n) => {
125
- const h = this.renderingBox.hasNode(n), d = this.attachedNodes.has(n);
126
- h && !d ? t.add(n) : !h && d && o.add(n);
127
- }), this.graphStore.getAllEdgeIds().forEach((n) => {
128
- const h = this.renderingBox.hasEdge(n), d = this.attachedEdges.has(n), c = this.graphStore.getEdge(n), u = this.graphStore.getPort(c.from).nodeId, g = this.graphStore.getPort(c.to).nodeId;
129
- h && (this.renderingBox.hasNode(u) || (t.add(u), o.delete(u)), this.renderingBox.hasNode(g) || (t.add(g), o.delete(g))), h && !d ? s.add(n) : !h && d && a.add(n);
130
- }), a.forEach((n) => {
131
- this.handleDetachEdge(n);
132
- }), o.forEach((n) => {
133
- this.handleDetachNode(n);
134
- }), t.forEach((n) => {
135
- this.attachedNodes.has(n) || this.handleAttachNode(n);
136
- }), s.forEach((n) => {
137
- this.handleAttachEdge(n);
123
+ const t = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
124
+ this.graphStore.getAllNodeIds().forEach((a) => {
125
+ const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
126
+ h && !d ? t.add(a) : !h && d && o.add(a);
127
+ }), this.graphStore.getAllEdgeIds().forEach((a) => {
128
+ const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), g = this.graphStore.getPort(c.from).nodeId, u = this.graphStore.getPort(c.to).nodeId;
129
+ h && (this.renderingBox.hasNode(g) || (t.add(g), o.delete(g)), this.renderingBox.hasNode(u) || (t.add(u), o.delete(u))), h && !d ? s.add(a) : !h && d && n.add(a);
130
+ }), n.forEach((a) => {
131
+ this.handleDetachEdge(a);
132
+ }), o.forEach((a) => {
133
+ this.handleDetachNode(a);
134
+ }), t.forEach((a) => {
135
+ this.attachedNodes.has(a) || this.handleAttachNode(a);
136
+ }), s.forEach((a) => {
137
+ this.handleAttachEdge(a);
138
138
  });
139
139
  });
140
140
  this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new et(this.graphStore), this.trigger.subscribe(this.updateViewport);
@@ -556,13 +556,13 @@ class be {
556
556
  throw new S(
557
557
  b.updateNonexistentEdgeTarget(e, t.to)
558
558
  );
559
- const s = this.getEdge(e), a = s.payload;
559
+ const s = this.getEdge(e), n = s.payload;
560
560
  this.removeEdgeInternal(e), this.addEdgeInternal({
561
561
  id: e,
562
562
  from: t.from ?? s.from,
563
563
  to: t.to ?? s.to,
564
- shape: a.shape,
565
- priority: a.priority
564
+ shape: n.shape,
565
+ priority: n.priority
566
566
  });
567
567
  }
568
568
  const o = this.edges.get(e);
@@ -613,47 +613,47 @@ class be {
613
613
  getNodeIncomingEdgeIds(e) {
614
614
  const t = Array.from(this.getNode(e).ports.keys()), o = [];
615
615
  return t.forEach((s) => {
616
- this.getPortIncomingEdgeIds(s).filter((a) => {
617
- const n = this.getEdge(a);
618
- return this.getPort(n.from).nodeId !== e;
619
- }).forEach((a) => {
620
- o.push(a);
616
+ this.getPortIncomingEdgeIds(s).filter((n) => {
617
+ const a = this.getEdge(n);
618
+ return this.getPort(a.from).nodeId !== e;
619
+ }).forEach((n) => {
620
+ o.push(n);
621
621
  });
622
622
  }), o;
623
623
  }
624
624
  getNodeOutgoingEdgeIds(e) {
625
625
  const t = Array.from(this.getNode(e).ports.keys()), o = [];
626
626
  return t.forEach((s) => {
627
- this.getPortOutgoingEdgeIds(s).filter((a) => {
628
- const n = this.getEdge(a);
629
- return this.getPort(n.to).nodeId !== e;
630
- }).forEach((a) => {
631
- o.push(a);
627
+ this.getPortOutgoingEdgeIds(s).filter((n) => {
628
+ const a = this.getEdge(n);
629
+ return this.getPort(a.to).nodeId !== e;
630
+ }).forEach((n) => {
631
+ o.push(n);
632
632
  });
633
633
  }), o;
634
634
  }
635
635
  getNodeCycleEdgeIds(e) {
636
636
  const t = Array.from(this.getNode(e).ports.keys()), o = [];
637
637
  return t.forEach((s) => {
638
- this.getPortCycleEdgeIds(s).forEach((a) => {
639
- o.push(a);
640
- }), this.getPortIncomingEdgeIds(s).filter((a) => {
641
- const n = this.getEdge(a);
642
- return this.getPort(n.to).nodeId === e;
643
- }).forEach((a) => {
644
- o.push(a);
638
+ this.getPortCycleEdgeIds(s).forEach((n) => {
639
+ o.push(n);
640
+ }), this.getPortIncomingEdgeIds(s).filter((n) => {
641
+ const a = this.getEdge(n);
642
+ return this.getPort(a.to).nodeId === e;
643
+ }).forEach((n) => {
644
+ o.push(n);
645
645
  });
646
646
  }), o;
647
647
  }
648
648
  getNodeAdjacentEdgeIds(e) {
649
649
  const t = Array.from(this.getNode(e).ports.keys()), o = [];
650
650
  return t.forEach((s) => {
651
- this.getPortIncomingEdgeIds(s).forEach((a) => {
652
- o.push(a);
653
- }), this.getPortOutgoingEdgeIds(s).forEach((a) => {
654
- o.push(a);
655
- }), this.getPortCycleEdgeIds(s).forEach((a) => {
656
- o.push(a);
651
+ this.getPortIncomingEdgeIds(s).forEach((n) => {
652
+ o.push(n);
653
+ }), this.getPortOutgoingEdgeIds(s).forEach((n) => {
654
+ o.push(n);
655
+ }), this.getPortCycleEdgeIds(s).forEach((n) => {
656
+ o.push(n);
657
657
  });
658
658
  }), o;
659
659
  }
@@ -767,8 +767,8 @@ class q {
767
767
  }
768
768
  }
769
769
  const it = (r, e, t) => {
770
- const { x: o, y: s, width: a, height: n } = r.getBoundingClientRect();
771
- return e >= o && e <= o + a && t >= s && t <= s + n;
770
+ const { x: o, y: s, width: n, height: a } = r.getBoundingClientRect();
771
+ return e >= o && e <= o + n && t >= s && t <= s + a;
772
772
  }, nt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, F = (r, e, t, o) => it(e, t, o) && nt(r, t, o), k = (r, e) => {
773
773
  e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
774
774
  }, H = (r) => {
@@ -810,8 +810,8 @@ function* Ne(r, e) {
810
810
  for (const o of t) {
811
811
  if (o.shadowRoot !== null) {
812
812
  const s = Ne(o.shadowRoot, e);
813
- for (const a of s)
814
- yield a;
813
+ for (const n of s)
814
+ yield n;
815
815
  }
816
816
  yield o;
817
817
  }
@@ -841,14 +841,14 @@ const Ce = (r, e) => ({
841
841
  }, s = {
842
842
  x: e.x + e.width / 2,
843
843
  y: e.y + e.height / 2
844
- }, a = Math.min(o.x, s.x) - t, n = Math.min(o.y, s.y) - t, h = 2 * t, d = Math.abs(s.x - o.x) + h, c = Math.abs(s.y - o.y) + h;
844
+ }, n = Math.min(o.x, s.x) - t, a = Math.min(o.y, s.y) - t, h = 2 * t, d = Math.abs(s.x - o.x) + h, c = Math.abs(s.y - o.y) + h;
845
845
  return {
846
- x: a,
847
- y: n,
846
+ x: n,
847
+ y: a,
848
848
  width: d,
849
849
  height: c,
850
- from: { x: o.x - a, y: o.y - n },
851
- to: { x: s.x - a, y: s.y - n }
850
+ from: { x: o.x - n, y: o.y - a },
851
+ to: { x: s.x - n, y: s.y - a }
852
852
  };
853
853
  };
854
854
  class ht {
@@ -859,27 +859,27 @@ class ht {
859
859
  from: t,
860
860
  to: o,
861
861
  arrowLength: s,
862
- fromDir: a,
863
- toDir: n,
862
+ fromDir: n,
863
+ toDir: a,
864
864
  curvature: h,
865
865
  hasSourceArrow: d,
866
866
  hasTargetArrow: c
867
- } = e, u = (t.x + o.x) / 2, g = (t.y + o.y) / 2;
868
- this.midpoint = { x: u, y: g };
867
+ } = e, g = (t.x + o.x) / 2, u = (t.y + o.y) / 2;
868
+ this.midpoint = { x: g, y: u };
869
869
  const l = x(
870
870
  { x: t.x + s, y: t.y },
871
- a,
871
+ n,
872
872
  t
873
873
  ), p = x(
874
874
  { x: o.x - s, y: o.y },
875
- n,
875
+ a,
876
876
  o
877
877
  ), y = {
878
- x: l.x + a.x * h,
879
- y: l.y + a.y * h
878
+ x: l.x + n.x * h,
879
+ y: l.y + n.y * h
880
880
  }, w = {
881
- x: p.x - n.x * h,
882
- y: p.y - n.y * h
881
+ x: p.x - a.x * h,
882
+ y: p.y - a.y * h
883
883
  }, f = `M ${l.x} ${l.y} C ${y.x} ${y.y}, ${w.x} ${w.y}, ${p.x} ${p.y}`, m = d ? "" : `M ${t.x} ${t.y} L ${l.x} ${l.y} `, A = c ? "" : ` M ${p.x} ${p.y} L ${o.x} ${o.y}`;
884
884
  this.path = `${m}${f}${A}`;
885
885
  }
@@ -892,34 +892,34 @@ class dt {
892
892
  hasSourceArrow: t,
893
893
  hasTargetArrow: o,
894
894
  curvature: s,
895
- fromDir: a,
896
- toDir: n,
895
+ fromDir: n,
896
+ toDir: a,
897
897
  detourDir: h,
898
898
  from: d,
899
899
  to: c,
900
- arrowLength: u,
901
- detourDistance: g
900
+ arrowLength: g,
901
+ detourDistance: u
902
902
  } = e, l = t ? x(
903
- { x: d.x + u, y: d.y },
904
- a,
903
+ { x: d.x + g, y: d.y },
904
+ n,
905
905
  d
906
906
  ) : d, p = o ? x(
907
907
  {
908
- x: c.x - u,
908
+ x: c.x - g,
909
909
  y: c.y
910
910
  },
911
- n,
912
- c
913
- ) : c, y = Math.cos(h) * g, w = Math.sin(h) * g, f = x(
914
- { x: d.x + u, y: d.y },
915
911
  a,
912
+ c
913
+ ) : c, y = Math.cos(h) * u, w = Math.sin(h) * u, f = x(
914
+ { x: d.x + g, y: d.y },
915
+ n,
916
916
  d
917
917
  ), m = {
918
918
  x: f.x + y,
919
919
  y: f.y + w
920
920
  }, A = x(
921
- { x: c.x - u, y: c.y },
922
- n,
921
+ { x: c.x - g, y: c.y },
922
+ a,
923
923
  c
924
924
  ), N = {
925
925
  x: A.x + y,
@@ -928,12 +928,12 @@ class dt {
928
928
  x: (m.x + N.x) / 2,
929
929
  y: (m.y + N.y) / 2
930
930
  }, T = {
931
- x: f.x + s * a.x,
932
- y: f.y + s * a.y
933
- }, V = {
934
- x: A.x - s * n.x,
935
- y: A.y - s * n.y
931
+ x: f.x + s * n.x,
932
+ y: f.y + s * n.y
936
933
  }, I = {
934
+ x: A.x - s * a.x,
935
+ y: A.y - s * a.y
936
+ }, V = {
937
937
  x: f.x + y,
938
938
  y: f.y + w
939
939
  }, $ = {
@@ -943,8 +943,8 @@ class dt {
943
943
  this.path = [
944
944
  `M ${l.x} ${l.y}`,
945
945
  `L ${f.x} ${f.y}`,
946
- `C ${T.x} ${T.y} ${I.x} ${I.y} ${C.x} ${C.y}`,
947
- `C ${$.x} ${$.y} ${V.x} ${V.y} ${A.x} ${A.y}`,
946
+ `C ${T.x} ${T.y} ${V.x} ${V.y} ${C.x} ${C.y}`,
947
+ `C ${$.x} ${$.y} ${I.x} ${I.y} ${A.x} ${A.y}`,
948
948
  `L ${p.x} ${p.y}`
949
949
  ].join(" "), this.midpoint = C;
950
950
  }
@@ -966,15 +966,15 @@ const ee = Object.freeze({
966
966
  const t = [];
967
967
  if (r.length > 0 && t.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && t.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
968
968
  const o = r.length - 1;
969
- let s = 0, a = 0, n = 0;
969
+ let s = 0, n = 0, a = 0;
970
970
  r.forEach((h, d) => {
971
- let c = 0, u = 0, g = 0;
971
+ let c = 0, g = 0, u = 0;
972
972
  const l = d > 0, p = d < o, y = l && p;
973
- if (l && (c = -s, u = -a, g = n), p) {
973
+ if (l && (c = -s, g = -n, u = a), p) {
974
974
  const T = r[d + 1];
975
- s = T.x - h.x, a = T.y - h.y, n = Math.sqrt(s * s + a * a);
975
+ s = T.x - h.x, n = T.y - h.y, a = Math.sqrt(s * s + n * n);
976
976
  }
977
- const f = n !== 0 ? Math.min((y ? e : 0) / n, d < o - 1 ? 0.5 : 1) : 0, m = y ? { x: h.x + s * f, y: h.y + a * f } : h, N = g !== 0 ? Math.min((y ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, C = y ? { x: h.x + c * N, y: h.y + u * N } : h;
977
+ const f = a !== 0 ? Math.min((y ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, m = y ? { x: h.x + s * f, y: h.y + n * f } : h, N = u !== 0 ? Math.min((y ? e : 0) / u, d > 1 ? 0.5 : 1) : 0, C = y ? { x: h.x + c * N, y: h.y + g * N } : h;
978
978
  d > 0 && t.push(`L ${C.x} ${C.y}`), y && t.push(
979
979
  `C ${h.x} ${h.y} ${h.x} ${h.y} ${m.x} ${m.y}`
980
980
  );
@@ -984,7 +984,7 @@ const ee = Object.freeze({
984
984
  }, ct = (r, e) => {
985
985
  const t = e.x - r.x >= 0, o = r.dirX >= 0, s = e.dirX >= 0;
986
986
  if (o === s) {
987
- const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
987
+ const c = o === t, g = (r.x + e.x) / 2, u = (r.y + e.y) / 2, l = { x: g, y: u };
988
988
  return c ? {
989
989
  points: [
990
990
  { x: r.x, y: r.y },
@@ -1003,8 +1003,8 @@ const ee = Object.freeze({
1003
1003
  midpoint: l
1004
1004
  };
1005
1005
  }
1006
- const n = o === t, h = (r.y + e.y) / 2;
1007
- if (n) {
1006
+ const a = o === t, h = (r.y + e.y) / 2;
1007
+ if (a) {
1008
1008
  const c = { x: e.x, y: r.y };
1009
1009
  return {
1010
1010
  points: [{ x: r.x, y: r.y }, c, { x: e.x, y: e.y }],
@@ -1025,28 +1025,28 @@ class lt {
1025
1025
  from: t,
1026
1026
  to: o,
1027
1027
  fromDir: s,
1028
- toDir: a,
1029
- arrowLength: n,
1028
+ toDir: n,
1029
+ arrowLength: a,
1030
1030
  arrowOffset: h,
1031
1031
  roundness: d,
1032
1032
  hasSourceArrow: c,
1033
- hasTargetArrow: u
1034
- } = e, g = c ? x(
1035
- { x: t.x + n, y: t.y },
1033
+ hasTargetArrow: g
1034
+ } = e, u = c ? x(
1035
+ { x: t.x + a, y: t.y },
1036
1036
  s,
1037
1037
  t
1038
- ) : t, l = u ? x(
1038
+ ) : t, l = g ? x(
1039
1039
  {
1040
- x: o.x - n,
1040
+ x: o.x - a,
1041
1041
  y: o.y
1042
1042
  },
1043
- a,
1043
+ n,
1044
1044
  o
1045
- ) : o, p = n + h, y = x(
1045
+ ) : o, p = a + h, y = x(
1046
1046
  { x: t.x + p, y: t.y },
1047
1047
  s,
1048
1048
  t
1049
- ), w = x({ x: o.x - p, y: o.y }, a, o), f = ct(
1049
+ ), w = x({ x: o.x - p, y: o.y }, n, o), f = ct(
1050
1050
  {
1051
1051
  x: y.x,
1052
1052
  y: y.y,
@@ -1055,11 +1055,11 @@ class lt {
1055
1055
  {
1056
1056
  x: w.x,
1057
1057
  y: w.y,
1058
- dirX: a.x
1058
+ dirX: n.x
1059
1059
  }
1060
1060
  );
1061
1061
  this.path = R(
1062
- [g, ...f.points, l],
1062
+ [u, ...f.points, l],
1063
1063
  d
1064
1064
  ), this.midpoint = f.midpoint;
1065
1065
  }
@@ -1072,26 +1072,26 @@ class gt {
1072
1072
  hasSourceArrow: t,
1073
1073
  hasTargetArrow: o,
1074
1074
  from: s,
1075
- to: a,
1076
- arrowLength: n,
1075
+ to: n,
1076
+ arrowLength: a,
1077
1077
  fromDir: h,
1078
1078
  toDir: d,
1079
1079
  arrowOffset: c,
1080
- detourDir: u,
1081
- detourDistance: g,
1080
+ detourDir: g,
1081
+ detourDistance: u,
1082
1082
  roundness: l
1083
1083
  } = e, p = t ? x(
1084
- { x: s.x + n, y: s.y },
1084
+ { x: s.x + a, y: s.y },
1085
1085
  h,
1086
1086
  s
1087
1087
  ) : s, y = o ? x(
1088
1088
  {
1089
- x: a.x - n,
1090
- y: a.y
1089
+ x: n.x - a,
1090
+ y: n.y
1091
1091
  },
1092
1092
  d,
1093
- a
1094
- ) : a, w = n + c, f = Math.cos(u) * g, m = Math.sin(u) * g, A = x(
1093
+ n
1094
+ ) : n, w = a + c, f = Math.cos(g) * u, m = Math.sin(g) * u, A = x(
1095
1095
  { x: s.x + w, y: s.y },
1096
1096
  h,
1097
1097
  s
@@ -1099,9 +1099,9 @@ class gt {
1099
1099
  x: A.x + f,
1100
1100
  y: A.y + m
1101
1101
  }, C = x(
1102
- { x: a.x - w, y: a.y },
1102
+ { x: n.x - w, y: n.y },
1103
1103
  d,
1104
- a
1104
+ n
1105
1105
  ), T = {
1106
1106
  x: C.x + f,
1107
1107
  y: C.y + m
@@ -1123,26 +1123,26 @@ class ut {
1123
1123
  from: t,
1124
1124
  to: o,
1125
1125
  hasSourceArrow: s,
1126
- hasTargetArrow: a,
1127
- arrowLength: n,
1126
+ hasTargetArrow: n,
1127
+ arrowLength: a,
1128
1128
  fromDir: h,
1129
1129
  toDir: d,
1130
1130
  arrowOffset: c,
1131
- roundness: u
1132
- } = e, g = this.createArrowPoint(
1131
+ roundness: g
1132
+ } = e, u = this.createArrowPoint(
1133
1133
  s,
1134
1134
  h,
1135
1135
  t,
1136
- n
1136
+ a
1137
1137
  ), l = this.createArrowPoint(
1138
- a,
1138
+ n,
1139
1139
  d,
1140
1140
  o,
1141
- -n
1142
- ), p = n + c, y = { x: t.x + p, y: t.y }, w = x(y, h, t), f = { x: o.x - p, y: o.y }, m = x(f, d, o);
1141
+ -a
1142
+ ), p = a + c, y = { x: t.x + p, y: t.y }, w = x(y, h, t), f = { x: o.x - p, y: o.y }, m = x(f, d, o);
1143
1143
  this.path = R(
1144
- [g, w, m, l],
1145
- u
1144
+ [u, w, m, l],
1145
+ g
1146
1146
  );
1147
1147
  const A = (w.x + m.x) / 2, N = (w.y + m.y) / 2;
1148
1148
  this.midpoint = { x: A, y: N };
@@ -1150,17 +1150,17 @@ class ut {
1150
1150
  createArrowPoint(e, t, o, s) {
1151
1151
  if (!e)
1152
1152
  return o;
1153
- const a = {
1153
+ const n = {
1154
1154
  x: o.x + s,
1155
1155
  y: o.y
1156
1156
  };
1157
- return x(a, t, o);
1157
+ return x(n, t, o);
1158
1158
  }
1159
1159
  }
1160
1160
  const pt = (r, e) => {
1161
1161
  const t = e.y - r.y >= 0, o = r.dirY >= 0, s = e.dirY >= 0;
1162
1162
  if (o === s) {
1163
- const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
1163
+ const c = o === t, g = (r.x + e.x) / 2, u = (r.y + e.y) / 2, l = { x: g, y: u };
1164
1164
  return c ? {
1165
1165
  points: [
1166
1166
  { x: r.x, y: r.y },
@@ -1179,8 +1179,8 @@ const pt = (r, e) => {
1179
1179
  midpoint: l
1180
1180
  };
1181
1181
  }
1182
- const n = o === t, h = (r.x + e.x) / 2;
1183
- if (n) {
1182
+ const a = o === t, h = (r.x + e.x) / 2;
1183
+ if (a) {
1184
1184
  const c = { x: r.x, y: e.y };
1185
1185
  return {
1186
1186
  points: [{ x: r.x, y: r.y }, c, { x: e.x, y: e.y }],
@@ -1201,24 +1201,24 @@ class yt {
1201
1201
  from: t,
1202
1202
  to: o,
1203
1203
  hasSourceArrow: s,
1204
- hasTargetArrow: a,
1205
- arrowLength: n,
1204
+ hasTargetArrow: n,
1205
+ arrowLength: a,
1206
1206
  arrowOffset: h,
1207
1207
  fromDir: d,
1208
1208
  toDir: c,
1209
- roundness: u
1210
- } = e, g = s ? x(
1211
- { x: t.x + n, y: t.y },
1209
+ roundness: g
1210
+ } = e, u = s ? x(
1211
+ { x: t.x + a, y: t.y },
1212
1212
  d,
1213
1213
  t
1214
- ) : t, l = a ? x(
1214
+ ) : t, l = n ? x(
1215
1215
  {
1216
- x: o.x - n,
1216
+ x: o.x - a,
1217
1217
  y: o.y
1218
1218
  },
1219
1219
  c,
1220
1220
  o
1221
- ) : o, p = n + h, y = x(
1221
+ ) : o, p = a + h, y = x(
1222
1222
  { x: t.x + p, y: t.y },
1223
1223
  d,
1224
1224
  t
@@ -1235,8 +1235,8 @@ class yt {
1235
1235
  }
1236
1236
  );
1237
1237
  this.path = R(
1238
- [g, ...f.points, l],
1239
- u
1238
+ [u, ...f.points, l],
1239
+ g
1240
1240
  ), this.midpoint = f.midpoint;
1241
1241
  }
1242
1242
  }
@@ -1244,7 +1244,7 @@ class te {
1244
1244
  constructor(e) {
1245
1245
  i(this, "path");
1246
1246
  i(this, "midpoint");
1247
- const { side: t, arrowLength: o, arrowOffset: s, dir: a, origin: n, hasArrow: h } = e, d = o + s, c = d + 2 * t, g = [
1247
+ const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t, u = [
1248
1248
  { x: o, y: 0 },
1249
1249
  { x: d, y: 0 },
1250
1250
  { x: d, y: t },
@@ -1253,25 +1253,25 @@ class te {
1253
1253
  { x: d, y: -t },
1254
1254
  { x: d, y: 0 },
1255
1255
  { x: o, y: 0 }
1256
- ].map((p) => x(p, a, { x: 0, y: 0 })).map((p) => ({ x: p.x + n.x, y: p.y + n.y })), l = `M ${n.x} ${n.y} L ${g[0].x} ${g[0].y} `;
1257
- this.path = `${h ? "" : l}${R(g, e.roundness)}`, this.midpoint = { x: (g[3].x + g[4].x) / 2, y: (g[3].y + g[4].y) / 2 };
1256
+ ].map((p) => x(p, n, { x: 0, y: 0 })).map((p) => ({ x: p.x + a.x, y: p.y + a.y })), l = `M ${a.x} ${a.y} L ${u[0].x} ${u[0].y} `;
1257
+ this.path = `${h ? "" : l}${R(u, e.roundness)}`, this.midpoint = { x: (u[3].x + u[4].x) / 2, y: (u[3].y + u[4].y) / 2 };
1258
1258
  }
1259
1259
  }
1260
1260
  class wt {
1261
1261
  constructor(e) {
1262
1262
  i(this, "path");
1263
1263
  i(this, "midpoint");
1264
- const { arrowLength: t, radius: o, smallRadius: s, dir: a, origin: n, hasArrow: h } = e, d = s + o, c = s * o / d, u = Math.sqrt(d * d - s * s), g = u * s / d, l = u + o + t, p = t + g, w = [
1264
+ const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d, g = Math.sqrt(d * d - s * s), u = g * s / d, l = g + o + t, p = t + u, w = [
1265
1265
  { x: t, y: 0 },
1266
1266
  { x: p, y: c },
1267
1267
  { x: p, y: -c },
1268
1268
  { x: l, y: 0 }
1269
- ].map((A) => x(A, a, { x: 0, y: 0 })).map((A) => ({ x: A.x + n.x, y: A.y + n.y })), f = [
1269
+ ].map((A) => x(A, n, { x: 0, y: 0 })).map((A) => ({ x: A.x + a.x, y: A.y + a.y })), f = [
1270
1270
  `M ${w[0].x} ${w[0].y}`,
1271
1271
  `A ${s} ${s} 0 0 1 ${w[1].x} ${w[1].y}`,
1272
1272
  `A ${o} ${o} 0 1 0 ${w[2].x} ${w[2].y}`,
1273
1273
  `A ${s} ${s} 0 0 1 ${w[0].x} ${w[0].y}`
1274
- ].join(" "), m = `M ${n.x} ${n.y} L ${w[0].x} ${w[0].y} `;
1274
+ ].join(" "), m = `M ${a.x} ${a.y} L ${w[0].x} ${w[0].y} `;
1275
1275
  this.path = `${h ? "" : m}${f}`, this.midpoint = w[3];
1276
1276
  }
1277
1277
  }
@@ -1284,39 +1284,39 @@ class ft {
1284
1284
  from: t,
1285
1285
  to: o,
1286
1286
  sourceOffset: s,
1287
- targetOffset: a,
1288
- hasSourceArrow: n,
1287
+ targetOffset: n,
1288
+ hasSourceArrow: a,
1289
1289
  hasTargetArrow: h,
1290
1290
  arrowLength: d
1291
1291
  } = e;
1292
1292
  this.midpoint = { x: (t.x + o.x) / 2, y: (t.y + o.y) / 2 };
1293
- const c = o.x - t.x, u = o.y - t.y;
1294
- if (this.diagonalDistance = Math.sqrt(c * c + u * u), this.diagonalDistance === 0) {
1293
+ const c = o.x - t.x, g = o.y - t.y;
1294
+ if (this.diagonalDistance = Math.sqrt(c * c + g * g), this.diagonalDistance === 0) {
1295
1295
  this.path = "";
1296
1296
  return;
1297
1297
  }
1298
- const g = { x: c, y: u }, l = this.createDirectLinePoint({
1298
+ const u = { x: c, y: g }, l = this.createDirectLinePoint({
1299
1299
  offset: s,
1300
- hasArrow: n,
1300
+ hasArrow: a,
1301
1301
  flip: 1,
1302
1302
  shift: t,
1303
1303
  arrowLength: d,
1304
- dir: g
1304
+ dir: u
1305
1305
  }), p = this.createDirectLinePoint({
1306
- offset: a,
1306
+ offset: n,
1307
1307
  hasArrow: h,
1308
1308
  flip: -1,
1309
1309
  shift: o,
1310
1310
  arrowLength: d,
1311
- dir: g
1311
+ dir: u
1312
1312
  });
1313
1313
  this.path = `M ${l.x} ${l.y} L ${p.x} ${p.y}`;
1314
1314
  }
1315
1315
  createDirectLinePoint(e) {
1316
- const t = e.hasArrow ? e.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance, { dir: a, shift: n } = e;
1316
+ const t = e.hasArrow ? e.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance, { dir: n, shift: a } = e;
1317
1317
  return {
1318
- x: a.x * s + n.x,
1319
- y: a.y * s + n.y
1318
+ x: n.x * s + a.x,
1319
+ y: n.y * s + a.y
1320
1320
  };
1321
1321
  }
1322
1322
  }
@@ -1332,33 +1332,33 @@ class xt {
1332
1332
  hasSourceArrow: t,
1333
1333
  hasTargetArrow: o,
1334
1334
  arrowLength: s,
1335
- from: a,
1336
- to: n,
1335
+ from: n,
1336
+ to: a,
1337
1337
  fromDir: h,
1338
1338
  toDir: d,
1339
1339
  arrowOffset: c,
1340
- roundness: u,
1341
- detourDistance: g
1340
+ roundness: g,
1341
+ detourDistance: u
1342
1342
  } = e, l = t ? x(
1343
- { x: a.x + s, y: a.y },
1343
+ { x: n.x + s, y: n.y },
1344
1344
  h,
1345
- a
1346
- ) : a, p = o ? x(
1345
+ n
1346
+ ) : n, p = o ? x(
1347
1347
  {
1348
- x: n.x - s,
1349
- y: n.y
1348
+ x: a.x - s,
1349
+ y: a.y
1350
1350
  },
1351
1351
  d,
1352
- n
1353
- ) : n, y = s + c, w = x(
1354
- { x: a.x + y, y: a.y },
1355
- h,
1356
1352
  a
1353
+ ) : a, y = s + c, w = x(
1354
+ { x: n.x + y, y: n.y },
1355
+ h,
1356
+ n
1357
1357
  ), f = x(
1358
- { x: n.x - y, y: n.y },
1358
+ { x: a.x - y, y: a.y },
1359
1359
  d,
1360
- n
1361
- ), m = vt(w, f, g);
1360
+ a
1361
+ ), m = vt(w, f, u);
1362
1362
  this.midpoint = {
1363
1363
  x: (w.x + f.x) / 2,
1364
1364
  y: m
@@ -1371,7 +1371,7 @@ class xt {
1371
1371
  f,
1372
1372
  p
1373
1373
  ],
1374
- u
1374
+ g
1375
1375
  );
1376
1376
  }
1377
1377
  }
@@ -1387,33 +1387,33 @@ class At {
1387
1387
  hasSourceArrow: t,
1388
1388
  hasTargetArrow: o,
1389
1389
  arrowLength: s,
1390
- fromDir: a,
1391
- toDir: n,
1390
+ fromDir: n,
1391
+ toDir: a,
1392
1392
  from: h,
1393
1393
  to: d,
1394
1394
  arrowOffset: c,
1395
- detourDistance: u,
1396
- roundness: g
1395
+ detourDistance: g,
1396
+ roundness: u
1397
1397
  } = e, l = t ? x(
1398
1398
  { x: h.x + s, y: h.y },
1399
- a,
1399
+ n,
1400
1400
  h
1401
1401
  ) : h, p = o ? x(
1402
1402
  {
1403
1403
  x: d.x - s,
1404
1404
  y: d.y
1405
1405
  },
1406
- n,
1406
+ a,
1407
1407
  d
1408
1408
  ) : d, y = s + c, w = x(
1409
1409
  { x: h.x + y, y: h.y },
1410
- a,
1410
+ n,
1411
1411
  h
1412
1412
  ), f = x(
1413
1413
  { x: d.x - y, y: d.y },
1414
- n,
1414
+ a,
1415
1415
  d
1416
- ), m = mt(w, f, u);
1416
+ ), m = mt(w, f, g);
1417
1417
  this.midpoint = {
1418
1418
  x: m,
1419
1419
  y: (w.y + f.y) / 2
@@ -1426,7 +1426,7 @@ class At {
1426
1426
  f,
1427
1427
  p
1428
1428
  ],
1429
- g
1429
+ u
1430
1430
  );
1431
1431
  }
1432
1432
  }
@@ -1469,26 +1469,26 @@ class X {
1469
1469
  this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Me(e.color), this.svg.appendChild(this.group), this.line = De(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = Y(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = Y(), this.group.appendChild(this.targetArrow));
1470
1470
  }
1471
1471
  render(e) {
1472
- const { x: t, y: o, width: s, height: a, from: n, to: h } = Te(
1472
+ const { x: t, y: o, width: s, height: n, from: a, to: h } = Te(
1473
1473
  e.from,
1474
1474
  e.to,
1475
1475
  this.params.padding
1476
1476
  );
1477
- Re(this.svg, { x: t, y: o, width: s, height: a });
1477
+ Re(this.svg, { x: t, y: o, width: s, height: n });
1478
1478
  const d = we(e.from.direction), c = we(e.to.direction);
1479
- let u = { x: -c.x, y: -c.y }, g;
1480
- e.category === L.PortCycle ? (g = this.params.createCyclePath, u = d) : e.category === L.NodeCycle ? g = this.params.createDetourPath : g = this.params.createLinePath;
1481
- const l = g(n, h, d, c);
1479
+ let g = { x: -c.x, y: -c.y }, u;
1480
+ e.category === L.PortCycle ? (u = this.params.createCyclePath, g = d) : e.category === L.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
1481
+ const l = u(a, h, d, c);
1482
1482
  this.line.setAttribute("d", l.path);
1483
1483
  let p = null;
1484
1484
  this.sourceArrow && (p = this.arrowRenderer({
1485
1485
  direction: d,
1486
- shift: n,
1486
+ shift: a,
1487
1487
  arrowLength: this.params.arrowLength
1488
1488
  }), this.sourceArrow.setAttribute("d", p));
1489
1489
  let y = null;
1490
1490
  this.targetArrow && (y = this.arrowRenderer({
1491
- direction: u,
1491
+ direction: g,
1492
1492
  shift: h,
1493
1493
  arrowLength: this.params.arrowLength
1494
1494
  }), this.targetArrow.setAttribute("d", y)), this.afterRenderEmitter.emit({
@@ -1508,20 +1508,20 @@ const Et = (r) => (e) => {
1508
1508
  ).map((h) => ({
1509
1509
  x: h.x + e.shift.x,
1510
1510
  y: h.y + e.shift.y
1511
- })), s = `M ${o[0].x} ${o[0].y}`, a = `L ${o[1].x} ${o[1].y}`, n = `L ${o[2].x} ${o[2].y}`;
1512
- return `${s} ${a} ${n} Z`;
1511
+ })), s = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
1512
+ return `${s} ${n} ${a} Z`;
1513
1513
  }, St = (r) => (e) => {
1514
- const t = r.radius, o = e.arrowLength, s = (o * o + 2 * o * t) / (2 * t), a = s + t, n = o + t - t * (o + t) / a, h = t * s / a, c = [
1514
+ const t = r.radius, o = e.arrowLength, s = (o * o + 2 * o * t) / (2 * t), n = s + t, a = o + t - t * (o + t) / n, h = t * s / n, c = [
1515
1515
  { x: 0, y: 0 },
1516
- { x: n, y: -h },
1517
- { x: n, y: h }
1516
+ { x: a, y: -h },
1517
+ { x: a, y: h }
1518
1518
  ].map(
1519
1519
  (y) => x(y, e.direction, { x: 0, y: 0 })
1520
1520
  ).map((y) => ({
1521
1521
  x: y.x + e.shift.x,
1522
1522
  y: y.y + e.shift.y
1523
- })), u = `M ${c[0].x} ${c[0].y}`, g = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, l = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
1524
- return `${u} ${g} ${l} ${p}`;
1523
+ })), g = `M ${c[0].x} ${c[0].y}`, u = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, l = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
1524
+ return `${g} ${u} ${l} ${p}`;
1525
1525
  }, bt = (r) => (e) => {
1526
1526
  const t = r.smallRadius, o = r.radius, s = x(
1527
1527
  {
@@ -1536,13 +1536,13 @@ const Et = (r) => (e) => {
1536
1536
  x: e.arrowLength + r.smallRadius,
1537
1537
  y: 0
1538
1538
  }
1539
- ), n = [{ x: 0, y: 0 }, { x: s.x, y: -s.y }, s].map(
1540
- (g) => x(g, e.direction, { x: 0, y: 0 })
1541
- ).map((g) => ({
1542
- x: g.x + e.shift.x,
1543
- y: g.y + e.shift.y
1544
- })), h = `M ${n[0].x} ${n[0].y}`, d = `A ${o} ${o} 0 0 1 ${n[1].x} ${n[1].y}`, c = `A ${t} ${t} 0 0 1 ${n[2].x} ${n[2].y}`, u = `A ${o} ${o} 0 0 1 ${n[0].x} ${n[0].y}`;
1545
- return `${h} ${d} ${c} ${u}`;
1539
+ ), a = [{ x: 0, y: 0 }, { x: s.x, y: -s.y }, s].map(
1540
+ (u) => x(u, e.direction, { x: 0, y: 0 })
1541
+ ).map((u) => ({
1542
+ x: u.x + e.shift.x,
1543
+ y: u.y + e.shift.y
1544
+ })), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, g = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
1545
+ return `${h} ${d} ${c} ${g}`;
1546
1546
  }, U = (r) => {
1547
1547
  if (typeof r == "function")
1548
1548
  return r;
@@ -1863,14 +1863,14 @@ class Le {
1863
1863
  [this.afterRenderEmitter, this.onAfterRender] = P(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = U((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? v.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? v.preOffset, this.svg = Me(this.color), this.svg.appendChild(this.group), this.line = De(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = Y(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = Y(), this.group.appendChild(this.targetArrow));
1864
1864
  }
1865
1865
  render(e) {
1866
- const { x: t, y: o, width: s, height: a, from: n, to: h } = Te(
1866
+ const { x: t, y: o, width: s, height: n, from: a, to: h } = Te(
1867
1867
  e.from,
1868
1868
  e.to,
1869
1869
  O
1870
1870
  );
1871
- Re(this.svg, { x: t, y: o, width: s, height: a });
1871
+ Re(this.svg, { x: t, y: o, width: s, height: n });
1872
1872
  const d = new ft({
1873
- from: n,
1873
+ from: a,
1874
1874
  to: h,
1875
1875
  sourceOffset: this.sourceOffset,
1876
1876
  targetOffset: this.targetOffset,
@@ -1879,14 +1879,14 @@ class Le {
1879
1879
  arrowLength: this.arrowLength
1880
1880
  });
1881
1881
  this.line.setAttribute("d", d.path);
1882
- let c = null, u = null;
1883
- const g = d.diagonalDistance;
1884
- if (g === 0)
1885
- this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (u = "", this.targetArrow.setAttribute("d", u));
1882
+ let c = null, g = null;
1883
+ const u = d.diagonalDistance;
1884
+ if (u === 0)
1885
+ this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (g = "", this.targetArrow.setAttribute("d", g));
1886
1886
  else {
1887
1887
  const l = {
1888
- x: (h.x - n.x) / g,
1889
- y: (h.y - n.y) / g
1888
+ x: (h.x - a.x) / u,
1889
+ y: (h.y - a.y) / u
1890
1890
  };
1891
1891
  if (this.sourceArrow) {
1892
1892
  const p = {
@@ -1904,20 +1904,20 @@ class Le {
1904
1904
  x: l.x * this.targetOffset,
1905
1905
  y: l.y * this.targetOffset
1906
1906
  };
1907
- u = this.arrowRenderer({
1907
+ g = this.arrowRenderer({
1908
1908
  direction: { x: -l.x, y: -l.y },
1909
1909
  shift: {
1910
1910
  x: h.x - p.x,
1911
1911
  y: h.y - p.y
1912
1912
  },
1913
1913
  arrowLength: this.arrowLength
1914
- }), this.targetArrow.setAttribute("d", u);
1914
+ }), this.targetArrow.setAttribute("d", g);
1915
1915
  }
1916
1916
  }
1917
1917
  this.afterRenderEmitter.emit({
1918
1918
  edgePath: d,
1919
1919
  sourceArrowPath: c,
1920
- targetArrowPath: u
1920
+ targetArrowPath: g
1921
1921
  });
1922
1922
  }
1923
1923
  }
@@ -1971,15 +1971,15 @@ class Mr {
1971
1971
  i(this, "onAfterRender");
1972
1972
  i(this, "svg");
1973
1973
  this.baseShape = e, this.midpointElement = t, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((o) => {
1974
- const s = o.edgePath.midpoint, a = `translate(${s.x}px, ${s.y}px)`;
1975
- this.midpointElement.style.setProperty("transform", a);
1974
+ const s = o.edgePath.midpoint, n = `translate(${s.x}px, ${s.y}px)`;
1975
+ this.midpointElement.style.setProperty("transform", n);
1976
1976
  });
1977
1977
  }
1978
1978
  render(e) {
1979
1979
  this.baseShape.render(e);
1980
1980
  }
1981
1981
  }
1982
- class Ve {
1982
+ class Ie {
1983
1983
  constructor(e) {
1984
1984
  i(this, "onAfterNodeAdded");
1985
1985
  i(this, "onAfterNodeUpdated");
@@ -2091,7 +2091,7 @@ class J {
2091
2091
  this.counter = 0;
2092
2092
  }
2093
2093
  }
2094
- class Ie {
2094
+ class Ve {
2095
2095
  constructor(e, t, o) {
2096
2096
  i(this, "nodeIdGenerator", new J(
2097
2097
  (e) => this.graphStore.hasNode(e)
@@ -2256,14 +2256,16 @@ class $e {
2256
2256
  return this.viewportStore.createViewportCoords(e);
2257
2257
  }
2258
2258
  }
2259
- const Vt = (r, e) => Symbol.iterator in r ? {
2259
+ const It = (r, e) => Symbol.iterator in r ? {
2260
2260
  minContentScale: e.focus.minContentScale,
2261
2261
  nodes: r,
2262
- contentOffset: e.focus.contentOffset
2262
+ contentOffset: e.focus.contentOffset,
2263
+ animationDuration: e.focus.animationDuration
2263
2264
  } : {
2264
2265
  minContentScale: r.minContentScale ?? e.focus.minContentScale,
2265
2266
  nodes: r.nodes ?? [],
2266
- contentOffset: r.contentOffset ?? e.focus.contentOffset
2267
+ contentOffset: r.contentOffset ?? e.focus.contentOffset,
2268
+ animationDuration: r.animationDuration ?? e.focus.animationDuration
2267
2269
  }, Be = (r, e, t) => ({
2268
2270
  scale: r.scale,
2269
2271
  x: r.x + r.scale * e,
@@ -2274,8 +2276,8 @@ const Vt = (r, e) => Symbol.iterator in r ? {
2274
2276
  y: r.scale * (1 - e) * o + r.y
2275
2277
  });
2276
2278
  class Oe {
2277
- constructor(e, t, o) {
2278
- this.graphStore = e, this.viewportStore = t, this.params = o;
2279
+ constructor(e, t, o, s) {
2280
+ this.graphStore = e, this.viewportStore = t, this.params = o, this.win = s;
2279
2281
  }
2280
2282
  patchViewportMatrix(e) {
2281
2283
  this.viewportStore.patchViewportMatrix(e);
@@ -2284,22 +2286,23 @@ class Oe {
2284
2286
  this.viewportStore.patchContentMatrix(e);
2285
2287
  }
2286
2288
  center(e, t) {
2287
- const { width: o, height: s } = this.viewportStore.getDimensions(), a = { x: o / 2, y: s / 2 }, n = this.viewportStore.getViewportMatrix(), h = this.viewportStore.createViewportCoords(e), d = h.x - a.x, c = h.y - a.y;
2288
- let u = Be(n, d, c);
2289
- const g = t == null ? void 0 : t.contentScale;
2290
- if (g !== void 0) {
2291
- const l = 1 / g;
2292
- u = Ue(
2293
- u,
2294
- l / n.scale,
2295
- a.x,
2296
- a.y
2289
+ const { width: o, height: s } = this.viewportStore.getDimensions(), n = { x: o / 2, y: s / 2 }, a = this.viewportStore.getViewportMatrix(), h = this.viewportStore.createViewportCoords(e), d = h.x - n.x, c = h.y - n.y;
2290
+ let g = Be(a, d, c);
2291
+ const u = t == null ? void 0 : t.contentScale;
2292
+ if (u !== void 0) {
2293
+ const p = 1 / u;
2294
+ g = Ue(
2295
+ g,
2296
+ p / a.scale,
2297
+ n.x,
2298
+ n.y
2297
2299
  );
2298
2300
  }
2299
- this.viewportStore.patchViewportMatrix(u);
2301
+ const l = (t == null ? void 0 : t.animationDuration) ?? 0;
2302
+ l > 0 ? this.animateNavigation(a, g, l) : this.viewportStore.patchViewportMatrix(g);
2300
2303
  }
2301
2304
  focus(e) {
2302
- const t = Vt(e ?? {}, this.params);
2305
+ const t = It(e ?? {}, this.params);
2303
2306
  this.params.focus.schedule(() => {
2304
2307
  this.navigate(t);
2305
2308
  });
@@ -2308,28 +2311,48 @@ class Oe {
2308
2311
  this.viewportStore.destroy();
2309
2312
  }
2310
2313
  navigate(e) {
2311
- let t = 1 / 0, o = -1 / 0, s = 1 / 0, a = -1 / 0, n = 0;
2314
+ let t = 1 / 0, o = -1 / 0, s = 1 / 0, n = -1 / 0, a = 0;
2312
2315
  const h = /* @__PURE__ */ new Set();
2313
2316
  for (const d of e.nodes)
2314
2317
  h.add(d);
2315
2318
  if (this.graphStore.getAllNodeIds().forEach((d) => {
2316
2319
  const { payload: c } = this.graphStore.getNode(d);
2317
- c.x !== null && c.y !== null && (h.size === 0 || h.has(d)) && (t = Math.min(c.x, t), o = Math.max(c.x, o), s = Math.min(c.y, s), a = Math.max(c.y, a), n++);
2318
- }), n > 0) {
2319
- t -= e.contentOffset, s -= e.contentOffset, o += e.contentOffset, a += e.contentOffset;
2320
+ c.x !== null && c.y !== null && (h.size === 0 || h.has(d)) && (t = Math.min(c.x, t), o = Math.max(c.x, o), s = Math.min(c.y, s), n = Math.max(c.y, n), a++);
2321
+ }), a > 0) {
2322
+ t -= e.contentOffset, s -= e.contentOffset, o += e.contentOffset, n += e.contentOffset;
2320
2323
  const d = {
2321
2324
  x: (t + o) / 2,
2322
- y: (s + a) / 2
2323
- }, { scale: c } = this.viewportStore.getContentMatrix(), u = (a - s) * c, g = (o - t) * c, { width: l, height: p } = this.viewportStore.getDimensions(), y = Math.max(
2324
- g / l,
2325
- u / p
2325
+ y: (s + n) / 2
2326
+ }, { scale: c } = this.viewportStore.getContentMatrix(), g = (n - s) * c, u = (o - t) * c, { width: l, height: p } = this.viewportStore.getDimensions(), y = Math.max(
2327
+ u / l,
2328
+ g / p
2326
2329
  ), w = y > 1 ? c / y : c, f = Math.max(w, e.minContentScale);
2327
- this.center(d, { contentScale: f });
2330
+ this.center(d, {
2331
+ contentScale: f,
2332
+ animationDuration: e.animationDuration
2333
+ });
2328
2334
  }
2329
2335
  }
2336
+ animateNavigation(e, t, o) {
2337
+ let s;
2338
+ const n = {
2339
+ scale: t.scale - e.scale,
2340
+ x: t.x - e.x,
2341
+ y: t.y - e.y
2342
+ }, a = (h) => {
2343
+ s === void 0 && (s = h);
2344
+ const d = Math.min((h - s) / o, 1);
2345
+ d <= 1 && this.viewportStore.patchViewportMatrix({
2346
+ scale: e.scale + d * n.scale,
2347
+ x: e.x + d * n.x,
2348
+ y: e.y + d * n.y
2349
+ }), d < 1 && this.win.requestAnimationFrame(a);
2350
+ };
2351
+ this.win.requestAnimationFrame(a);
2352
+ }
2330
2353
  }
2331
- const We = (r, e) => {
2332
- const t = new be(), o = new Ve(t), s = new $e(e), a = new Ee(t, e, r), n = {
2354
+ const We = (r, e, t) => {
2355
+ const o = new be(), s = new Ie(o), n = new $e(e), a = new Ee(o, e, r), h = {
2333
2356
  nodes: {
2334
2357
  centerFn: Ce,
2335
2358
  priorityFn: () => 0
@@ -2341,22 +2364,24 @@ const We = (r, e) => {
2341
2364
  ports: {
2342
2365
  direction: 0
2343
2366
  }
2344
- }, h = new Ie(
2345
- t,
2367
+ }, d = new Ve(
2368
+ o,
2346
2369
  a,
2347
- n
2348
- ), d = {
2370
+ h
2371
+ ), c = {
2349
2372
  focus: {
2350
2373
  contentOffset: 0,
2351
2374
  minContentScale: 0,
2352
- schedule: re
2375
+ schedule: re,
2376
+ animationDuration: 0
2353
2377
  }
2354
- }, c = new Oe(
2355
- t,
2378
+ }, g = new Oe(
2379
+ o,
2356
2380
  e,
2357
- d
2381
+ c,
2382
+ t
2358
2383
  );
2359
- return new Se(o, s, h, c);
2384
+ return new Se(s, n, d, g);
2360
2385
  };
2361
2386
  class G {
2362
2387
  constructor(e, t, o, s) {
@@ -2401,8 +2426,8 @@ class G {
2401
2426
  const t = e;
2402
2427
  if (t.touches.length !== 1)
2403
2428
  return;
2404
- const o = t.touches[0], s = e.currentTarget, a = this.canvas.graph.findPortIdsByElement(s)[0];
2405
- this.params.onPortPointerDown(a, {
2429
+ const o = t.touches[0], s = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(s)[0];
2430
+ this.params.onPortPointerDown(n, {
2406
2431
  x: o.clientX,
2407
2432
  y: o.clientY
2408
2433
  }) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
@@ -2467,7 +2492,7 @@ class G {
2467
2492
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2468
2493
  }
2469
2494
  }
2470
- class It {
2495
+ class Vt {
2471
2496
  constructor(e, t, o) {
2472
2497
  this.canvas = e, this.layoutAlgorithm = t, this.params = o;
2473
2498
  }
@@ -2521,7 +2546,7 @@ class oe {
2521
2546
  const t = e;
2522
2547
  if (!this.params.mouseDownEventVerifier(t))
2523
2548
  return;
2524
- const o = e.currentTarget, s = this.graph.findNodeIdByElement(o), a = this.graph.getNode(s);
2549
+ const o = e.currentTarget, s = this.graph.findNodeIdByElement(o), n = this.graph.getNode(s);
2525
2550
  if (!this.params.nodeDragVerifier(s))
2526
2551
  return;
2527
2552
  this.params.onNodeDragStarted(s), e.stopPropagation();
@@ -2531,8 +2556,8 @@ class oe {
2531
2556
  });
2532
2557
  this.grabbedNode = {
2533
2558
  nodeId: s,
2534
- dx: h.x - a.x,
2535
- dy: h.y - a.y
2559
+ dx: h.x - n.x,
2560
+ dy: h.y - n.y
2536
2561
  }, k(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
2537
2562
  passive: !0
2538
2563
  }), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
@@ -2544,12 +2569,12 @@ class oe {
2544
2569
  if (t.touches.length !== 1)
2545
2570
  return;
2546
2571
  e.stopPropagation();
2547
- const o = t.touches[0], s = e.currentTarget, a = this.canvas.graph.findNodeIdByElement(s), n = this.graph.getNode(a);
2572
+ const o = t.touches[0], s = e.currentTarget, n = this.canvas.graph.findNodeIdByElement(s), a = this.graph.getNode(n);
2548
2573
  if (!this.params.nodeDragVerifier({
2549
- nodeId: a,
2550
- element: n.element,
2551
- x: n.x,
2552
- y: n.y
2574
+ nodeId: n,
2575
+ element: a.element,
2576
+ x: a.x,
2577
+ y: a.y
2553
2578
  }))
2554
2579
  return;
2555
2580
  const d = this.calculateContentPoint({
@@ -2557,10 +2582,10 @@ class oe {
2557
2582
  y: o.clientY
2558
2583
  });
2559
2584
  this.grabbedNode = {
2560
- nodeId: a,
2561
- dx: d.x - n.x,
2562
- dy: d.y - n.y
2563
- }, this.moveNodeOnTop(a), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2585
+ nodeId: n,
2586
+ dx: d.x - a.x,
2587
+ dy: d.y - a.y
2588
+ }, this.moveNodeOnTop(n), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
2564
2589
  passive: !0
2565
2590
  }), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
2566
2591
  passive: !0
@@ -2627,10 +2652,10 @@ class oe {
2627
2652
  const o = this.calculateContentPoint(t), s = {
2628
2653
  x: o.x - e.dx,
2629
2654
  y: o.y - e.dy
2630
- }, a = this.adjustNodeCoords(s);
2655
+ }, n = this.adjustNodeCoords(s);
2631
2656
  this.canvas.updateNode(e.nodeId, {
2632
- x: a.x,
2633
- y: a.y
2657
+ x: n.x,
2658
+ y: n.y
2634
2659
  }), this.params.onNodeDrag(e.nodeId);
2635
2660
  }
2636
2661
  moveNodeOnTop(e) {
@@ -2695,14 +2720,14 @@ const W = (r) => {
2695
2720
  const o = e.reduce(
2696
2721
  (h, d) => [h[0] + d[0], h[1] + d[1]],
2697
2722
  [0, 0]
2698
- ), s = [o[0] / t, o[1] / t], n = e.map((h) => [h[0] - s[0], h[1] - s[1]]).reduce(
2723
+ ), s = [o[0] / t, o[1] / t], a = e.map((h) => [h[0] - s[0], h[1] - s[1]]).reduce(
2699
2724
  (h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
2700
2725
  0
2701
2726
  );
2702
2727
  return {
2703
2728
  x: s[0],
2704
2729
  y: s[1],
2705
- scale: n / t,
2730
+ scale: a / t,
2706
2731
  touchesCnt: t,
2707
2732
  touches: e
2708
2733
  };
@@ -2743,8 +2768,8 @@ class j {
2743
2768
  i(this, "onWheelScroll", (e) => {
2744
2769
  if (!this.params.mouseWheelEventVerifier(e))
2745
2770
  return;
2746
- const { left: t, top: o } = this.element.getBoundingClientRect(), s = e.clientX - t, a = e.clientY - o, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2747
- this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, s, a), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2771
+ const { left: t, top: o } = this.element.getBoundingClientRect(), s = e.clientX - t, n = e.clientY - o, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
2772
+ this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, s, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
2748
2773
  this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
2749
2774
  }, this.params.scaleWheelFinishTimeout);
2750
2775
  });
@@ -2773,8 +2798,8 @@ class j {
2773
2798
  -(t.x - this.prevTouches.x),
2774
2799
  -(t.y - this.prevTouches.y)
2775
2800
  ), t.touchesCnt === 2) {
2776
- const { left: s, top: a } = this.element.getBoundingClientRect(), n = this.prevTouches.x - s, h = this.prevTouches.y - a, c = 1 / (t.scale / this.prevTouches.scale);
2777
- this.scaleViewport(c, n, h);
2801
+ const { left: s, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - s, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
2802
+ this.scaleViewport(c, a, h);
2778
2803
  }
2779
2804
  this.prevTouches = t;
2780
2805
  });
@@ -2800,19 +2825,19 @@ class j {
2800
2825
  new j(e, t, o, s);
2801
2826
  }
2802
2827
  moveViewport(e, t) {
2803
- const o = this.viewport.getViewportMatrix(), s = Be(o, e, t), { width: a, height: n } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2828
+ const o = this.viewport.getViewportMatrix(), s = Be(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
2804
2829
  prevTransform: o,
2805
2830
  nextTransform: s,
2806
- canvasWidth: a,
2807
- canvasHeight: n
2831
+ canvasWidth: n,
2832
+ canvasHeight: a
2808
2833
  });
2809
2834
  this.performTransform(h);
2810
2835
  }
2811
2836
  scaleViewport(e, t, o) {
2812
- const s = this.canvas.viewport.getViewportMatrix(), a = Ue(s, e, t, o), { width: n, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2837
+ const s = this.canvas.viewport.getViewportMatrix(), n = Ue(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
2813
2838
  prevTransform: s,
2814
- nextTransform: a,
2815
- canvasWidth: n,
2839
+ nextTransform: n,
2840
+ canvasWidth: a,
2816
2841
  canvasHeight: h
2817
2842
  });
2818
2843
  this.performTransform(d);
@@ -2849,7 +2874,7 @@ class j {
2849
2874
  }
2850
2875
  }
2851
2876
  class se {
2852
- constructor(e, t, o, s, a, n) {
2877
+ constructor(e, t, o, s, n, a) {
2853
2878
  i(this, "nodeHorizontal");
2854
2879
  i(this, "nodeVertical");
2855
2880
  i(this, "viewport");
@@ -2872,7 +2897,7 @@ class se {
2872
2897
  this.userTransformInProgress || this.loadAreaAroundViewport();
2873
2898
  });
2874
2899
  i(this, "userTransformInProgress", !1);
2875
- this.canvas = e, this.element = t, this.window = o, this.trigger = a, this.params = n, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.viewport = e.viewport, this.currentScale = this.viewport.getViewportMatrix().scale, this.scheduleLoadAreaAroundViewport(), this.viewport.onAfterResize.subscribe(() => {
2900
+ this.canvas = e, this.element = t, this.window = o, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.viewport = e.viewport, this.currentScale = this.viewport.getViewportMatrix().scale, this.scheduleLoadAreaAroundViewport(), this.viewport.onAfterResize.subscribe(() => {
2876
2901
  this.scheduleLoadAreaAroundViewport();
2877
2902
  });
2878
2903
  const h = {
@@ -2902,14 +2927,14 @@ class se {
2902
2927
  h
2903
2928
  ), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2904
2929
  }
2905
- static configure(e, t, o, s, a, n) {
2930
+ static configure(e, t, o, s, n, a) {
2906
2931
  new se(
2907
2932
  e,
2908
2933
  t,
2909
2934
  o,
2910
2935
  s,
2911
- a,
2912
- n
2936
+ n,
2937
+ a
2913
2938
  );
2914
2939
  }
2915
2940
  scheduleLoadAreaAroundViewport() {
@@ -2919,17 +2944,17 @@ class se {
2919
2944
  }
2920
2945
  scheduleEnsureViewportAreaLoaded() {
2921
2946
  setTimeout(() => {
2922
- const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: a } = this.viewport.getViewportMatrix(), n = e * o, h = t * o, d = s - this.nodeHorizontal, c = a - this.nodeVertical, u = s + n + this.nodeHorizontal, g = a + h + this.nodeVertical;
2923
- this.loadedArea.xFrom < d && this.loadedArea.xTo > u && this.loadedArea.yFrom < c && this.loadedArea.yTo > g || this.loadAreaAroundViewport();
2947
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - this.nodeHorizontal, c = n - this.nodeVertical, g = s + a + this.nodeHorizontal, u = n + h + this.nodeVertical;
2948
+ this.loadedArea.xFrom < d && this.loadedArea.xTo > g && this.loadedArea.yFrom < c && this.loadedArea.yTo > u || this.loadAreaAroundViewport();
2924
2949
  });
2925
2950
  }
2926
2951
  loadAreaAroundViewport() {
2927
- const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: a } = this.viewport.getViewportMatrix(), n = e * o, h = t * o, d = s - n - this.nodeHorizontal, c = a - h - this.nodeVertical, u = 3 * n + 2 * this.nodeHorizontal, g = 3 * h + 2 * this.nodeVertical;
2952
+ const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - a - this.nodeHorizontal, c = n - h - this.nodeVertical, g = 3 * a + 2 * this.nodeHorizontal, u = 3 * h + 2 * this.nodeVertical;
2928
2953
  this.trigger.emit({
2929
2954
  x: d,
2930
2955
  y: c,
2931
- width: u,
2932
- height: g
2956
+ width: g,
2957
+ height: u
2933
2958
  });
2934
2959
  }
2935
2960
  }
@@ -2965,8 +2990,8 @@ class ie {
2965
2990
  this.canvas = e, this.backgroundHost = o, this.tileWidth = t.tileWidth, this.tileHeight = t.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = t.renderer, this.maxViewportScale = t.maxViewportScale;
2966
2991
  const s = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
2967
2992
  this.patternContent.setAttribute("transform", s), this.pattern.appendChild(this.patternContent);
2968
- const a = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2969
- a.appendChild(this.pattern), this.svg.appendChild(a), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
2993
+ const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
2994
+ n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
2970
2995
  this.updateDimensions();
2971
2996
  }), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
2972
2997
  }
@@ -2985,16 +3010,17 @@ class ie {
2985
3010
  }
2986
3011
  }
2987
3012
  class ne {
2988
- constructor(e, t, o, s, a) {
3013
+ constructor(e, t, o, s, n) {
2989
3014
  i(this, "overlayCanvas");
2990
3015
  i(this, "staticPortId", null);
2991
3016
  i(this, "isTargetDragging", !0);
2992
3017
  i(this, "onEdgeCreated", (e) => {
2993
3018
  this.params.onAfterEdgeCreated(e);
2994
3019
  });
2995
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = a, this.overlayCanvas = We(
3020
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = We(
2996
3021
  this.overlayLayer,
2997
- this.viewportStore
3022
+ this.viewportStore,
3023
+ this.window
2998
3024
  ), G.configure(
2999
3025
  this.canvas,
3000
3026
  this.overlayLayer,
@@ -3005,48 +3031,48 @@ class ne {
3005
3031
  onStopDrag: () => {
3006
3032
  this.resetDragState();
3007
3033
  },
3008
- onPortPointerDown: (n, h) => {
3009
- const d = this.params.connectionTypeResolver(n);
3010
- return d === null ? !1 : (this.grabPort(n, h, d), !0);
3034
+ onPortPointerDown: (a, h) => {
3035
+ const d = this.params.connectionTypeResolver(a);
3036
+ return d === null ? !1 : (this.grabPort(a, h, d), !0);
3011
3037
  },
3012
- onPointerMove: (n) => {
3013
- this.moveDraggingPort(n);
3038
+ onPointerMove: (a) => {
3039
+ this.moveDraggingPort(a);
3014
3040
  },
3015
- onPointerUp: (n) => {
3016
- this.tryCreateConnection(n);
3041
+ onPointerUp: (a) => {
3042
+ this.tryCreateConnection(a);
3017
3043
  }
3018
3044
  }
3019
3045
  );
3020
3046
  }
3021
- static configure(e, t, o, s, a) {
3047
+ static configure(e, t, o, s, n) {
3022
3048
  new ne(
3023
3049
  e,
3024
3050
  t,
3025
3051
  o,
3026
3052
  s,
3027
- a
3053
+ n
3028
3054
  );
3029
3055
  }
3030
3056
  grabPort(e, t, o) {
3031
3057
  const s = this.canvas.graph.getPort(e);
3032
3058
  this.staticPortId = e;
3033
- const a = s.element.getBoundingClientRect(), n = a.x + a.width / 2, h = a.y + a.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
3034
- x: n - d.x,
3059
+ const n = s.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
3060
+ x: a - d.x,
3035
3061
  y: h - d.y
3036
- }), u = this.canvas.viewport.createContentCoords({
3062
+ }), g = this.canvas.viewport.createContentCoords({
3037
3063
  x: t.x - d.x,
3038
3064
  y: t.y - d.y
3039
- }), g = {
3065
+ }), u = {
3040
3066
  overlayNodeId: M.StaticNodeId,
3041
3067
  portCoords: c,
3042
3068
  portDirection: s.direction
3043
3069
  }, l = {
3044
3070
  overlayNodeId: M.DraggingNodeId,
3045
- portCoords: u,
3071
+ portCoords: g,
3046
3072
  portDirection: this.params.dragPortDirection
3047
3073
  };
3048
3074
  this.isTargetDragging = o === "direct";
3049
- const [p, y] = this.isTargetDragging ? [g, l] : [l, g];
3075
+ const [p, y] = this.isTargetDragging ? [u, l] : [l, u];
3050
3076
  this.overlayCanvas.addNode(H(p)), this.overlayCanvas.addNode(H(y)), this.overlayCanvas.addEdge({
3051
3077
  from: p.overlayNodeId,
3052
3078
  to: y.overlayNodeId,
@@ -3065,8 +3091,8 @@ class ne {
3065
3091
  });
3066
3092
  return;
3067
3093
  }
3068
- const s = this.isTargetDragging ? o : t, a = this.isTargetDragging ? t : o, n = { from: s, to: a }, h = this.params.connectionPreprocessor(n);
3069
- h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(n);
3094
+ const s = this.isTargetDragging ? o : t, n = this.isTargetDragging ? t : o, a = { from: s, to: n }, h = this.params.connectionPreprocessor(a);
3095
+ h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
3070
3096
  }
3071
3097
  moveDraggingPort(e) {
3072
3098
  const t = this.overlayLayer.getBoundingClientRect(), o = this.canvas.viewport.createContentCoords({
@@ -3080,7 +3106,7 @@ class ne {
3080
3106
  }
3081
3107
  }
3082
3108
  class ae {
3083
- constructor(e, t, o, s, a) {
3109
+ constructor(e, t, o, s, n) {
3084
3110
  i(this, "overlayCanvas");
3085
3111
  i(this, "staticPortId", null);
3086
3112
  i(this, "isTargetDragging", !0);
@@ -3088,9 +3114,10 @@ class ae {
3088
3114
  i(this, "onEdgeReattached", (e) => {
3089
3115
  this.params.onAfterEdgeReattached(e);
3090
3116
  });
3091
- this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = a, this.overlayCanvas = We(
3117
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.params = n, this.overlayCanvas = We(
3092
3118
  this.overlayLayer,
3093
- this.viewportStore
3119
+ this.viewportStore,
3120
+ this.window
3094
3121
  ), G.configure(
3095
3122
  this.canvas,
3096
3123
  this.overlayLayer,
@@ -3101,37 +3128,37 @@ class ae {
3101
3128
  onStopDrag: () => {
3102
3129
  this.resetDragState();
3103
3130
  },
3104
- onPortPointerDown: (n, h) => this.tryStartEdgeDragging(n, h),
3105
- onPointerMove: (n) => {
3106
- this.moveDraggingPort(n);
3131
+ onPortPointerDown: (a, h) => this.tryStartEdgeDragging(a, h),
3132
+ onPointerMove: (a) => {
3133
+ this.moveDraggingPort(a);
3107
3134
  },
3108
- onPointerUp: (n) => {
3109
- this.tryCreateConnection(n);
3135
+ onPointerUp: (a) => {
3136
+ this.tryCreateConnection(a);
3110
3137
  }
3111
3138
  }
3112
3139
  );
3113
3140
  }
3114
- static configure(e, t, o, s, a) {
3141
+ static configure(e, t, o, s, n) {
3115
3142
  new ae(
3116
3143
  e,
3117
3144
  t,
3118
3145
  o,
3119
3146
  s,
3120
- a
3147
+ n
3121
3148
  );
3122
3149
  }
3123
3150
  tryStartEdgeDragging(e, t) {
3124
3151
  const o = this.params.draggingEdgeResolver(e);
3125
3152
  if (o === null || !this.canvas.graph.hasEdge(o))
3126
3153
  return !1;
3127
- const s = this.canvas.graph.getEdge(o), a = e === s.from, n = e === s.to, h = a ? s.to : s.from;
3128
- this.staticPortId = h, this.isTargetDragging = n;
3129
- const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), u = c.element.getBoundingClientRect(), g = {
3130
- x: u.x + u.width / 2,
3131
- y: u.y + u.height / 2
3154
+ const s = this.canvas.graph.getEdge(o), n = e === s.from, a = e === s.to, h = n ? s.to : s.from;
3155
+ this.staticPortId = h, this.isTargetDragging = a;
3156
+ const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), u = {
3157
+ x: g.x + g.width / 2,
3158
+ y: g.y + g.height / 2
3132
3159
  }, l = this.overlayLayer.getBoundingClientRect(), p = this.canvas.viewport.createContentCoords({
3133
- x: g.x - l.x,
3134
- y: g.y - l.y
3160
+ x: u.x - l.x,
3161
+ y: u.y - l.y
3135
3162
  }), y = this.canvas.viewport.createContentCoords({
3136
3163
  x: t.x - l.x,
3137
3164
  y: t.y - l.y
@@ -3187,13 +3214,13 @@ class ae {
3187
3214
  });
3188
3215
  return;
3189
3216
  }
3190
- const [o, s] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], a = this.draggingEdgePayload, n = {
3191
- id: a.id,
3217
+ const [o, s] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
3218
+ id: n.id,
3192
3219
  from: o,
3193
3220
  to: s,
3194
- shape: a.shape,
3195
- priority: a.priority
3196
- }, h = this.params.connectionPreprocessor(n);
3221
+ shape: n.shape,
3222
+ priority: n.priority
3223
+ }, h = this.params.connectionPreprocessor(a);
3197
3224
  if (h !== null)
3198
3225
  this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeReattached), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeReattached);
3199
3226
  else {
@@ -3247,7 +3274,7 @@ class de {
3247
3274
  }
3248
3275
  class Wt {
3249
3276
  static configure(e, t) {
3250
- const o = t.applyOn, s = new It(e, t.algorithm, {
3277
+ const o = t.applyOn, s = new Vt(e, t.algorithm, {
3251
3278
  staticNodeResolver: t.staticNodeResolver,
3252
3279
  onBeforeApplied: t.onBeforeApplied,
3253
3280
  onAfterApplied: t.onAfterApplied
@@ -3330,13 +3357,13 @@ const Yt = (r) => {
3330
3357
  const e = ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? (() => {
3331
3358
  }), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
3332
3359
  }), o = r.nodeDragVerifier ?? (() => !0), s = ((w = r.events) == null ? void 0 : w.onNodeDragFinished) ?? (() => {
3333
- }), a = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && a, h = (f = r.mouse) == null ? void 0 : f.dragCursor, d = h !== void 0 ? h : "grab", c = (m = r.mouse) == null ? void 0 : m.mouseDownEventVerifier, u = c !== void 0 ? c : (N) => N.button === 0, g = (A = r.mouse) == null ? void 0 : A.mouseUpEventVerifier, l = g !== void 0 ? g : (N) => N.button === 0;
3360
+ }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (f = r.mouse) == null ? void 0 : f.dragCursor, d = h !== void 0 ? h : "grab", c = (m = r.mouse) == null ? void 0 : m.mouseDownEventVerifier, g = c !== void 0 ? c : (N) => N.button === 0, u = (A = r.mouse) == null ? void 0 : A.mouseUpEventVerifier, l = u !== void 0 ? u : (N) => N.button === 0;
3334
3361
  return {
3335
- moveOnTop: a,
3336
- moveEdgesOnTop: n,
3362
+ moveOnTop: n,
3363
+ moveEdgesOnTop: a,
3337
3364
  dragCursor: d,
3338
3365
  gridSize: r.gridSize ?? null,
3339
- mouseDownEventVerifier: u,
3366
+ mouseDownEventVerifier: g,
3340
3367
  mouseUpEventVerifier: l,
3341
3368
  onNodeDragStarted: e,
3342
3369
  onNodeDrag: t,
@@ -3345,33 +3372,33 @@ const Yt = (r) => {
3345
3372
  };
3346
3373
  }, Xt = (r) => {
3347
3374
  const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, o = r.minY !== null ? r.minY : -1 / 0, s = r.maxY !== null ? r.maxY : 1 / 0;
3348
- return (a) => {
3349
- let n = a.nextTransform.x, h = a.nextTransform.y;
3350
- n < e && n < a.prevTransform.x && (n = Math.min(a.prevTransform.x, e));
3351
- const d = a.canvasWidth * a.prevTransform.scale, c = t - d;
3352
- n > c && n > a.prevTransform.x && (n = Math.max(a.prevTransform.x, c)), h < o && h < a.prevTransform.y && (h = Math.min(a.prevTransform.y, o));
3353
- const u = a.canvasHeight * a.prevTransform.scale, g = s - u;
3354
- return h > g && h > a.prevTransform.y && (h = Math.max(a.prevTransform.y, g)), { scale: a.nextTransform.scale, x: n, y: h };
3375
+ return (n) => {
3376
+ let a = n.nextTransform.x, h = n.nextTransform.y;
3377
+ a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
3378
+ const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
3379
+ a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < o && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, o));
3380
+ const g = n.canvasHeight * n.prevTransform.scale, u = s - g;
3381
+ return h > u && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, u)), { scale: n.nextTransform.scale, x: a, y: h };
3355
3382
  };
3356
3383
  }, Gt = (r) => {
3357
3384
  const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
3358
- return (a) => {
3359
- const n = a.prevTransform, h = a.nextTransform;
3360
- let d = h.scale, c = h.x, u = h.y;
3361
- if (h.scale > s && h.scale > n.scale) {
3362
- d = Math.max(n.scale, s), c = n.x, u = n.y;
3363
- const g = (d - n.scale) / (h.scale - n.scale);
3364
- c = n.x + (h.x - n.x) * g, u = n.y + (h.y - n.y) * g;
3385
+ return (n) => {
3386
+ const a = n.prevTransform, h = n.nextTransform;
3387
+ let d = h.scale, c = h.x, g = h.y;
3388
+ if (h.scale > s && h.scale > a.scale) {
3389
+ d = Math.max(a.scale, s), c = a.x, g = a.y;
3390
+ const u = (d - a.scale) / (h.scale - a.scale);
3391
+ c = a.x + (h.x - a.x) * u, g = a.y + (h.y - a.y) * u;
3365
3392
  }
3366
- if (h.scale < o && h.scale < n.scale) {
3367
- d = Math.min(n.scale, o), c = n.x, u = n.y;
3368
- const g = (d - n.scale) / (h.scale - n.scale);
3369
- c = n.x + (h.x - n.x) * g, u = n.y + (h.y - n.y) * g;
3393
+ if (h.scale < o && h.scale < a.scale) {
3394
+ d = Math.min(a.scale, o), c = a.x, g = a.y;
3395
+ const u = (d - a.scale) / (h.scale - a.scale);
3396
+ c = a.x + (h.x - a.x) * u, g = a.y + (h.y - a.y) * u;
3370
3397
  }
3371
3398
  return {
3372
3399
  scale: d,
3373
3400
  x: c,
3374
- y: u
3401
+ y: g
3375
3402
  };
3376
3403
  };
3377
3404
  }, jt = (r) => (e) => r.reduce(
@@ -3400,7 +3427,7 @@ const Yt = (r) => {
3400
3427
  });
3401
3428
  }
3402
3429
  }, me = (r) => {
3403
- var y, w, f, m, A, N, C, T, V, I, $, ge;
3430
+ var y, w, f, m, A, N, C, T, I, V, $, ge;
3404
3431
  const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
3405
3432
  let s;
3406
3433
  o !== void 0 ? Array.isArray(o) ? s = jt(
@@ -3408,23 +3435,23 @@ const Yt = (r) => {
3408
3435
  (D) => xe(D)
3409
3436
  )
3410
3437
  ) : s = xe(o) : s = (D) => D.nextTransform;
3411
- const a = ((w = r == null ? void 0 : r.shift) == null ? void 0 : w.cursor) !== void 0 ? r.shift.cursor : "grab", n = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeTransformChange) ?? (() => {
3438
+ const n = ((w = r == null ? void 0 : r.shift) == null ? void 0 : w.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeTransformChange) ?? (() => {
3412
3439
  }), h = ((m = r == null ? void 0 : r.events) == null ? void 0 : m.onTransformChange) ?? (() => {
3413
- }), d = (A = r == null ? void 0 : r.shift) == null ? void 0 : A.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, u = (N = r == null ? void 0 : r.shift) == null ? void 0 : N.mouseUpEventVerifier, g = u !== void 0 ? u : (D) => D.button === 0, l = (C = r == null ? void 0 : r.scale) == null ? void 0 : C.mouseWheelEventVerifier, p = l !== void 0 ? l : () => !0;
3440
+ }), d = (A = r == null ? void 0 : r.shift) == null ? void 0 : A.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, g = (N = r == null ? void 0 : r.shift) == null ? void 0 : N.mouseUpEventVerifier, u = g !== void 0 ? g : (D) => D.button === 0, l = (C = r == null ? void 0 : r.scale) == null ? void 0 : C.mouseWheelEventVerifier, p = l !== void 0 ? l : () => !0;
3414
3441
  return {
3415
3442
  wheelSensitivity: t,
3416
3443
  onTransformStarted: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformStarted) ?? (() => {
3417
3444
  }),
3418
- onTransformFinished: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformFinished) ?? (() => {
3445
+ onTransformFinished: ((I = r == null ? void 0 : r.events) == null ? void 0 : I.onTransformFinished) ?? (() => {
3419
3446
  }),
3420
- onBeforeTransformChange: n,
3447
+ onBeforeTransformChange: a,
3421
3448
  onTransformChange: h,
3422
3449
  transformPreprocessor: s,
3423
- shiftCursor: a,
3450
+ shiftCursor: n,
3424
3451
  mouseDownEventVerifier: c,
3425
- mouseUpEventVerifier: g,
3452
+ mouseUpEventVerifier: u,
3426
3453
  mouseWheelEventVerifier: p,
3427
- scaleWheelFinishTimeout: ((I = r == null ? void 0 : r.scale) == null ? void 0 : I.wheelFinishTimeout) ?? 500,
3454
+ scaleWheelFinishTimeout: ((V = r == null ? void 0 : r.scale) == null ? void 0 : V.wheelFinishTimeout) ?? 500,
3428
3455
  onResizeTransformStarted: (($ = r == null ? void 0 : r.events) == null ? void 0 : $.onResizeTransformStarted) ?? (() => {
3429
3456
  }),
3430
3457
  onResizeTransformFinished: ((ge = r == null ? void 0 : r.events) == null ? void 0 : ge.onResizeTransformFinished) ?? (() => {
@@ -3518,28 +3545,28 @@ const Yt = (r) => {
3518
3545
  });
3519
3546
  }
3520
3547
  }, Zt = (r, e, t) => {
3521
- var c, u, g;
3522
- const o = () => "direct", s = (l) => l, a = (l) => l.button === 0, n = () => {
3548
+ var c, g, u;
3549
+ const o = () => "direct", s = (l) => l, n = (l) => l.button === 0, a = () => {
3523
3550
  }, h = () => {
3524
3551
  }, d = () => {
3525
3552
  };
3526
3553
  return {
3527
3554
  connectionTypeResolver: r.connectionTypeResolver ?? o,
3528
3555
  connectionPreprocessor: r.connectionPreprocessor ?? s,
3529
- mouseDownEventVerifier: r.mouseDownEventVerifier ?? a,
3530
- mouseUpEventVerifier: r.mouseUpEventVerifier ?? a,
3531
- onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? n,
3532
- onEdgeCreationInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeCreationInterrupted) ?? d,
3533
- onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? h,
3556
+ mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
3557
+ mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
3558
+ onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
3559
+ onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
3560
+ onEdgeCreationPrevented: ((u = r.events) == null ? void 0 : u.onEdgeCreationPrevented) ?? h,
3534
3561
  dragPortDirection: r.dragPortDirection ?? t,
3535
3562
  edgeShapeFactory: r.edgeShape !== void 0 ? le(r.edgeShape) : e
3536
3563
  };
3537
3564
  }, _t = (r, e) => {
3538
- var c, u, g;
3539
- const t = (l) => l, o = (l) => l.button === 0 && l.ctrlKey, s = (l) => l.button === 0, a = (l) => {
3565
+ var c, g, u;
3566
+ const t = (l) => l, o = (l) => l.button === 0 && l.ctrlKey, s = (l) => l.button === 0, n = (l) => {
3540
3567
  const p = e.getPortAdjacentEdgeIds(l);
3541
3568
  return p.length > 0 ? p[p.length - 1] : null;
3542
- }, n = () => {
3569
+ }, a = () => {
3543
3570
  }, h = () => {
3544
3571
  }, d = () => {
3545
3572
  };
@@ -3547,11 +3574,11 @@ const Yt = (r) => {
3547
3574
  connectionPreprocessor: r.connectionPreprocessor ?? t,
3548
3575
  mouseDownEventVerifier: r.mouseDownEventVerifier ?? o,
3549
3576
  mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
3550
- draggingEdgeResolver: r.draggingEdgeResolver ?? a,
3577
+ draggingEdgeResolver: r.draggingEdgeResolver ?? n,
3551
3578
  draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? le(r.draggingEdgeShape) : null,
3552
- onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? n,
3553
- onEdgeReattachInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeReattachInterrupted) ?? d,
3554
- onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? h
3579
+ onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
3580
+ onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3581
+ onEdgeReattachPrevented: ((u = r.events) == null ? void 0 : u.onEdgeReattachPrevented) ?? h
3555
3582
  };
3556
3583
  }, qt = (r) => ({
3557
3584
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
@@ -3586,10 +3613,10 @@ class ze {
3586
3613
  const t = /* @__PURE__ */ new Map();
3587
3614
  return this.graph.getAllNodeIds().forEach((s) => {
3588
3615
  t.set(s, { x: 0, y: 0 });
3589
- }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((s, a) => {
3590
- const n = t.get(a), h = {
3591
- x: n.x / this.nodeMass * this.dt,
3592
- y: n.y / this.nodeMass * this.dt
3616
+ }), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((s, n) => {
3617
+ const a = t.get(n), h = {
3618
+ x: a.x / this.nodeMass * this.dt,
3619
+ y: a.y / this.nodeMass * this.dt
3593
3620
  };
3594
3621
  e = Math.max(
3595
3622
  e,
@@ -3601,11 +3628,11 @@ class ze {
3601
3628
  }
3602
3629
  applyEdgeForces(e) {
3603
3630
  this.graph.getAllEdgeIds().forEach((t) => {
3604
- const o = this.graph.getEdge(t), s = this.graph.getPort(o.from), a = this.graph.getPort(o.to), n = this.currentCoords.get(s.nodeId), h = this.currentCoords.get(a.nodeId), d = this.distanceVectorGenerator.create(
3605
- n,
3631
+ const o = this.graph.getEdge(t), s = this.graph.getPort(o.from), n = this.graph.getPort(o.to), a = this.currentCoords.get(s.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
3632
+ a,
3606
3633
  h
3607
- ), u = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, g = d.ex * u, l = d.ey * u, p = e.get(s.nodeId), y = e.get(a.nodeId);
3608
- p.x += g, p.y += l, y.x -= g, y.y -= l;
3634
+ ), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, u = d.ex * g, l = d.ey * g, p = e.get(s.nodeId), y = e.get(n.nodeId);
3635
+ p.x += u, p.y += l, y.x -= u, y.y -= l;
3609
3636
  });
3610
3637
  }
3611
3638
  }
@@ -3615,8 +3642,8 @@ class ke {
3615
3642
  this.rand = e;
3616
3643
  }
3617
3644
  create(e, t) {
3618
- const o = t.x - e.x, s = t.y - e.y, a = o * o + s * s;
3619
- if (a === 0) {
3645
+ const o = t.x - e.x, s = t.y - e.y, n = o * o + s * s;
3646
+ if (n === 0) {
3620
3647
  const c = this.PI2 * this.rand();
3621
3648
  return {
3622
3649
  ex: Math.cos(c),
@@ -3624,8 +3651,8 @@ class ke {
3624
3651
  d: 0
3625
3652
  };
3626
3653
  }
3627
- const n = Math.sqrt(a), h = o / n, d = s / n;
3628
- return { ex: h, ey: d, d: n };
3654
+ const a = Math.sqrt(n), h = o / a, d = s / a;
3655
+ return { ex: h, ey: d, d: a };
3629
3656
  }
3630
3657
  }
3631
3658
  const He = (r) => {
@@ -3643,19 +3670,19 @@ class rr {
3643
3670
  }
3644
3671
  apply(e, t) {
3645
3672
  const o = Array.from(t.keys()), s = o.length;
3646
- for (let a = 0; a < s; a++) {
3647
- const n = o[a];
3648
- for (let h = a + 1; h < s; h++) {
3649
- const d = o[h], c = e.get(n), u = e.get(d), g = this.distanceVectorGenerator.create(
3673
+ for (let n = 0; n < s; n++) {
3674
+ const a = o[n];
3675
+ for (let h = n + 1; h < s; h++) {
3676
+ const d = o[h], c = e.get(a), g = e.get(d), u = this.distanceVectorGenerator.create(
3650
3677
  c,
3651
- u
3678
+ g
3652
3679
  ), l = He({
3653
3680
  coefficient: 1,
3654
3681
  sourceCharge: this.nodeCharge,
3655
3682
  targetCharge: this.nodeCharge,
3656
- distance: g.d,
3683
+ distance: u.d,
3657
3684
  maxForce: this.maxForce
3658
- }), p = l * g.ex, y = l * g.ey, w = t.get(n), f = t.get(d);
3685
+ }), p = l * u.ex, y = l * u.ey, w = t.get(a), f = t.get(d);
3659
3686
  w.x -= p, w.y -= y, f.x += p, f.y += y;
3660
3687
  }
3661
3688
  }
@@ -3672,7 +3699,7 @@ const or = (r) => {
3672
3699
  r.forEach((d) => {
3673
3700
  e = Math.min(e, d.x), t = Math.max(t, d.x), o = Math.min(o, d.y), s = Math.max(s, d.y);
3674
3701
  });
3675
- const a = t - e, n = s - o, h = Math.max(a, n);
3702
+ const n = t - e, a = s - o, h = Math.max(n, a);
3676
3703
  return {
3677
3704
  centerX: (e + t) / 2,
3678
3705
  centerY: (o + s) / 2,
@@ -3708,15 +3735,15 @@ class sr {
3708
3735
  const o = [];
3709
3736
  for (; t.length > 0; ) {
3710
3737
  const s = t.pop();
3711
- this.processNode(s).forEach((n) => {
3712
- o.push(n);
3738
+ this.processNode(s).forEach((a) => {
3739
+ o.push(a);
3713
3740
  });
3714
3741
  }
3715
3742
  t = o;
3716
3743
  }
3717
3744
  this.sortedParentNodes.reverse().forEach((o) => {
3718
- let s = 0, a = 0, n = 0, h = 0;
3719
- o.lb !== null && (n += o.lb.totalMass, h += o.lb.totalCharge, s += o.lb.chargeCenter.x * o.lb.totalCharge, a += o.lb.chargeCenter.y * o.lb.totalCharge), o.lt !== null && (n += o.lt.totalMass, h += o.lt.totalCharge, s += o.lt.chargeCenter.x * o.lt.totalCharge, a += o.lt.chargeCenter.y * o.lt.totalCharge), o.rb !== null && (n += o.rb.totalMass, h += o.rb.totalCharge, s += o.rb.chargeCenter.x * o.rb.totalCharge, a += o.rb.chargeCenter.y * o.rb.totalCharge), o.rt !== null && (n += o.rt.totalMass, h += o.rt.totalCharge, s += o.rt.chargeCenter.x * o.rt.totalCharge, a += o.rt.chargeCenter.y * o.rt.totalCharge), o.totalMass = n, o.totalCharge = h, o.chargeCenter.x = s / h, o.chargeCenter.y = a / h;
3745
+ let s = 0, n = 0, a = 0, h = 0;
3746
+ o.lb !== null && (a += o.lb.totalMass, h += o.lb.totalCharge, s += o.lb.chargeCenter.x * o.lb.totalCharge, n += o.lb.chargeCenter.y * o.lb.totalCharge), o.lt !== null && (a += o.lt.totalMass, h += o.lt.totalCharge, s += o.lt.chargeCenter.x * o.lt.totalCharge, n += o.lt.chargeCenter.y * o.lt.totalCharge), o.rb !== null && (a += o.rb.totalMass, h += o.rb.totalCharge, s += o.rb.chargeCenter.x * o.rb.totalCharge, n += o.rb.chargeCenter.y * o.rb.totalCharge), o.rt !== null && (a += o.rt.totalMass, h += o.rt.totalCharge, s += o.rt.chargeCenter.x * o.rt.totalCharge, n += o.rt.chargeCenter.y * o.rt.totalCharge), o.totalMass = a, o.totalCharge = h, o.chargeCenter.x = s / h, o.chargeCenter.y = n / h;
3720
3747
  });
3721
3748
  }
3722
3749
  getRoot() {
@@ -3732,21 +3759,21 @@ class sr {
3732
3759
  if (s < this.areaRadiusThreshold)
3733
3760
  return this.setLeaf(e), [];
3734
3761
  this.sortedParentNodes.push(e);
3735
- const a = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = s / 2;
3762
+ const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = s / 2;
3736
3763
  e.nodeIds.forEach((l) => {
3737
3764
  const { x: p, y } = this.coords.get(l);
3738
- p < t ? y < o ? d.add(l) : h.add(l) : y < o ? n.add(l) : a.add(l), e.nodeIds.delete(l);
3765
+ p < t ? y < o ? d.add(l) : h.add(l) : y < o ? a.add(l) : n.add(l), e.nodeIds.delete(l);
3739
3766
  });
3740
- const u = {
3767
+ const g = {
3741
3768
  parent: e,
3742
3769
  lb: null,
3743
3770
  lt: null,
3744
3771
  rb: null,
3745
3772
  rt: null
3746
- }, g = [];
3747
- if (a.size > 0) {
3773
+ }, u = [];
3774
+ if (n.size > 0) {
3748
3775
  const l = {
3749
- nodeIds: a,
3776
+ nodeIds: n,
3750
3777
  totalMass: 0,
3751
3778
  totalCharge: 0,
3752
3779
  chargeCenter: {
@@ -3758,13 +3785,13 @@ class sr {
3758
3785
  centerY: o + c,
3759
3786
  radius: c
3760
3787
  },
3761
- ...u
3788
+ ...g
3762
3789
  };
3763
- e.rt = l, g.push(l);
3790
+ e.rt = l, u.push(l);
3764
3791
  }
3765
- if (n.size > 0) {
3792
+ if (a.size > 0) {
3766
3793
  const l = {
3767
- nodeIds: n,
3794
+ nodeIds: a,
3768
3795
  totalMass: 0,
3769
3796
  totalCharge: 0,
3770
3797
  chargeCenter: {
@@ -3776,9 +3803,9 @@ class sr {
3776
3803
  centerY: o - c,
3777
3804
  radius: c
3778
3805
  },
3779
- ...u
3806
+ ...g
3780
3807
  };
3781
- e.rb = l, g.push(l);
3808
+ e.rb = l, u.push(l);
3782
3809
  }
3783
3810
  if (h.size > 0) {
3784
3811
  const l = {
@@ -3794,9 +3821,9 @@ class sr {
3794
3821
  centerY: o + c,
3795
3822
  radius: c
3796
3823
  },
3797
- ...u
3824
+ ...g
3798
3825
  };
3799
- e.lt = l, g.push(l);
3826
+ e.lt = l, u.push(l);
3800
3827
  }
3801
3828
  if (d.size > 0) {
3802
3829
  const l = {
@@ -3812,11 +3839,11 @@ class sr {
3812
3839
  centerY: o - c,
3813
3840
  radius: c
3814
3841
  },
3815
- ...u
3842
+ ...g
3816
3843
  };
3817
- e.lb = l, g.push(l);
3844
+ e.lb = l, u.push(l);
3818
3845
  }
3819
- return g;
3846
+ return u;
3820
3847
  }
3821
3848
  setLeaf(e) {
3822
3849
  e.totalMass = this.nodeMass * e.nodeIds.size, e.totalCharge = this.nodeCharge * e.nodeIds.size, e.chargeCenter = this.calculateLeafChargeCenter(e.nodeIds), e.nodeIds.forEach((t) => {
@@ -3831,8 +3858,8 @@ class sr {
3831
3858
  };
3832
3859
  let t = 0, o = 0;
3833
3860
  return e.forEach((s) => {
3834
- const a = this.coords.get(s);
3835
- t += a.x, o += a.y;
3861
+ const n = this.coords.get(s);
3862
+ t += n.x, o += n.y;
3836
3863
  }), { x: t / e.size, y: o / e.size };
3837
3864
  }
3838
3865
  }
@@ -3855,17 +3882,17 @@ class ir {
3855
3882
  nodeMass: this.nodeMass,
3856
3883
  nodeCharge: this.nodeCharge
3857
3884
  });
3858
- e.forEach((a, n) => {
3885
+ e.forEach((n, a) => {
3859
3886
  const h = this.calculateForceForNode(
3860
- s.getLeaf(n),
3861
- n,
3887
+ s.getLeaf(a),
3888
+ a,
3862
3889
  e
3863
- ), d = t.get(n);
3890
+ ), d = t.get(a);
3864
3891
  this.applyForce(d, h);
3865
3892
  });
3866
3893
  }
3867
3894
  calculateForceForNode(e, t, o) {
3868
- const s = o.get(t), a = { x: 0, y: 0 };
3895
+ const s = o.get(t), n = { x: 0, y: 0 };
3869
3896
  e.nodeIds.forEach((h) => {
3870
3897
  if (h !== t) {
3871
3898
  const d = o.get(h), c = this.calculateNodeRepulsiveForce({
@@ -3874,72 +3901,72 @@ class ir {
3874
3901
  sourceCoords: d,
3875
3902
  targetCoords: s
3876
3903
  });
3877
- this.applyForce(a, c);
3904
+ this.applyForce(n, c);
3878
3905
  }
3879
3906
  });
3880
- let n = e;
3881
- for (; n !== null; ) {
3882
- const h = n.parent;
3907
+ let a = e;
3908
+ for (; a !== null; ) {
3909
+ const h = a.parent;
3883
3910
  if (h !== null) {
3884
3911
  const d = this.distanceVectorGenerator.create(
3885
3912
  h.chargeCenter,
3886
3913
  s
3887
3914
  );
3888
3915
  h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
3889
- totalForce: a,
3916
+ totalForce: n,
3890
3917
  targetCoords: s,
3891
3918
  target: h.lb,
3892
- current: n
3919
+ current: a
3893
3920
  }), this.tryApplyFarForce({
3894
- totalForce: a,
3921
+ totalForce: n,
3895
3922
  targetCoords: s,
3896
3923
  target: h.rb,
3897
- current: n
3924
+ current: a
3898
3925
  }), this.tryApplyFarForce({
3899
- totalForce: a,
3926
+ totalForce: n,
3900
3927
  targetCoords: s,
3901
3928
  target: h.rt,
3902
- current: n
3929
+ current: a
3903
3930
  }), this.tryApplyFarForce({
3904
- totalForce: a,
3931
+ totalForce: n,
3905
3932
  targetCoords: s,
3906
3933
  target: h.lt,
3907
- current: n
3934
+ current: a
3908
3935
  })) : (this.tryApplyNearForce({
3909
- totalForce: a,
3936
+ totalForce: n,
3910
3937
  targetCoords: s,
3911
3938
  target: h.lb,
3912
- current: n,
3939
+ current: a,
3913
3940
  nodesCoords: o
3914
3941
  }), this.tryApplyNearForce({
3915
- totalForce: a,
3942
+ totalForce: n,
3916
3943
  targetCoords: s,
3917
3944
  target: h.rb,
3918
- current: n,
3945
+ current: a,
3919
3946
  nodesCoords: o
3920
3947
  }), this.tryApplyNearForce({
3921
- totalForce: a,
3948
+ totalForce: n,
3922
3949
  targetCoords: s,
3923
3950
  target: h.rt,
3924
- current: n,
3951
+ current: a,
3925
3952
  nodesCoords: o
3926
3953
  }), this.tryApplyNearForce({
3927
- totalForce: a,
3954
+ totalForce: n,
3928
3955
  targetCoords: s,
3929
3956
  target: h.lt,
3930
- current: n,
3957
+ current: a,
3931
3958
  nodesCoords: o
3932
3959
  }));
3933
3960
  }
3934
- n = n.parent;
3961
+ a = a.parent;
3935
3962
  }
3936
- return a;
3963
+ return n;
3937
3964
  }
3938
3965
  calculateExactForce(e, t, o) {
3939
- const s = { x: 0, y: 0 }, a = [e];
3940
- for (; a.length > 0; ) {
3941
- const n = a.pop();
3942
- n.nodeIds.forEach((h) => {
3966
+ const s = { x: 0, y: 0 }, n = [e];
3967
+ for (; n.length > 0; ) {
3968
+ const a = n.pop();
3969
+ a.nodeIds.forEach((h) => {
3943
3970
  const d = o.get(h), c = this.calculateNodeRepulsiveForce({
3944
3971
  sourceCharge: this.nodeCharge,
3945
3972
  targetCharge: this.nodeCharge,
@@ -3947,7 +3974,7 @@ class ir {
3947
3974
  targetCoords: t
3948
3975
  });
3949
3976
  this.applyForce(s, c);
3950
- }), n.lb !== null && a.push(n.lb), n.rb !== null && a.push(n.rb), n.lt !== null && a.push(n.lt), n.rt !== null && a.push(n.rt);
3977
+ }), a.lb !== null && n.push(a.lb), a.rb !== null && n.push(a.rb), a.lt !== null && n.push(a.lt), a.rt !== null && n.push(a.rt);
3951
3978
  }
3952
3979
  return s;
3953
3980
  }
@@ -4019,18 +4046,18 @@ class Xe {
4019
4046
  this.rand = e.rand, this.sparsity = e.sparsity;
4020
4047
  }
4021
4048
  calculateCoordinates(e) {
4022
- const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), a = t.getAllNodeIds().filter((y) => {
4049
+ const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((y) => {
4023
4050
  const w = t.getNode(y);
4024
4051
  return w.x === null || w.y === null;
4025
- }), n = Math.sqrt(a.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, u = o.createContentCoords(c), g = n / 2, l = {
4026
- x: u.x - g,
4027
- y: u.y - g
4052
+ }), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, g = o.createContentCoords(c), u = a / 2, l = {
4053
+ x: g.x - u,
4054
+ y: g.y - u
4028
4055
  };
4029
4056
  return t.getAllNodeIds().forEach((y) => {
4030
4057
  const w = t.getNode(y);
4031
4058
  s.set(y, {
4032
- x: w.x ?? l.x + n * this.rand(),
4033
- y: w.y ?? l.y + n * this.rand()
4059
+ x: w.x ?? l.x + a * this.rand(),
4060
+ y: w.y ?? l.y + a * this.rand()
4034
4061
  });
4035
4062
  }), s;
4036
4063
  }
@@ -4064,7 +4091,7 @@ class nr {
4064
4091
  graph: t,
4065
4092
  viewport: o
4066
4093
  });
4067
- for (let a = 0; a < this.maxIterations && !(new ze(
4094
+ for (let n = 0; n < this.maxIterations && !(new ze(
4068
4095
  t,
4069
4096
  s,
4070
4097
  {
@@ -4075,7 +4102,7 @@ class nr {
4075
4102
  edgeEquilibriumLength: this.edgeEquilibriumLength,
4076
4103
  edgeStiffness: this.edgeStiffness
4077
4104
  }
4078
- ).apply() < this.convergenceVelocity); a++)
4105
+ ).apply() < this.convergenceVelocity); n++)
4079
4106
  ;
4080
4107
  return s;
4081
4108
  }
@@ -4100,30 +4127,30 @@ class ar {
4100
4127
  this.forest.add({ root: t, sequence: o });
4101
4128
  let s = [t];
4102
4129
  for (this.remainingNodeIds.delete(t.nodeId); s.length > 0; ) {
4103
- const a = [];
4104
- s.forEach((n) => {
4105
- o.push(n);
4106
- const h = this.graph.getNodeOutgoingEdgeIds(n.nodeId).map((u) => {
4107
- const g = this.graph.getEdge(u);
4108
- return this.graph.getPort(g.to).nodeId;
4109
- }), d = this.graph.getNodeIncomingEdgeIds(n.nodeId).map((u) => {
4110
- const g = this.graph.getEdge(u);
4111
- return this.graph.getPort(g.from).nodeId;
4130
+ const n = [];
4131
+ s.forEach((a) => {
4132
+ o.push(a);
4133
+ const h = this.graph.getNodeOutgoingEdgeIds(a.nodeId).map((g) => {
4134
+ const u = this.graph.getEdge(g);
4135
+ return this.graph.getPort(u.to).nodeId;
4136
+ }), d = this.graph.getNodeIncomingEdgeIds(a.nodeId).map((g) => {
4137
+ const u = this.graph.getEdge(g);
4138
+ return this.graph.getPort(u.from).nodeId;
4112
4139
  });
4113
4140
  (/* @__PURE__ */ new Set([
4114
4141
  ...h,
4115
4142
  ...d
4116
- ])).forEach((u) => {
4117
- if (!this.remainingNodeIds.has(u))
4143
+ ])).forEach((g) => {
4144
+ if (!this.remainingNodeIds.has(g))
4118
4145
  return;
4119
- this.remainingNodeIds.delete(u);
4120
- const g = {
4121
- nodeId: u,
4146
+ this.remainingNodeIds.delete(g);
4147
+ const u = {
4148
+ nodeId: g,
4122
4149
  children: /* @__PURE__ */ new Set()
4123
4150
  };
4124
- n.children.add(g), a.push(g);
4151
+ a.children.add(u), n.push(u);
4125
4152
  });
4126
- }), s = a;
4153
+ }), s = n;
4127
4154
  }
4128
4155
  }
4129
4156
  }
@@ -4133,37 +4160,37 @@ class hr {
4133
4160
  }
4134
4161
  generate(e) {
4135
4162
  let t = 0;
4136
- const o = [], s = e.length - 1, a = [];
4163
+ const o = [], s = e.length - 1, n = [];
4137
4164
  e.forEach((h, d) => {
4138
- if (t += this.params.spaceAroundRadius, h.forEach((c, u) => {
4139
- a[u] === void 0 ? a[u] = {
4165
+ if (t += this.params.spaceAroundRadius, h.forEach((c, g) => {
4166
+ n[g] === void 0 ? n[g] = {
4140
4167
  start: t + c.start,
4141
4168
  end: t + c.end
4142
- } : a[u].end = t + c.end;
4169
+ } : n[g].end = t + c.end;
4143
4170
  }), o.push(t), d !== s) {
4144
- const c = e[d + 1], u = a.map((g) => ({
4145
- start: g.start - t,
4146
- end: g.end - t
4171
+ const c = e[d + 1], g = n.map((u) => ({
4172
+ start: u.start - t,
4173
+ end: u.end - t
4147
4174
  }));
4148
- t += this.calculateMaxDiff(u, c);
4175
+ t += this.calculateMaxDiff(g, c);
4149
4176
  }
4150
4177
  t += this.params.spaceAroundRadius;
4151
4178
  });
4152
- const n = t / 2;
4179
+ const a = t / 2;
4153
4180
  return {
4154
- childOffsets: o.map((h) => h - n),
4155
- subtreeSpans: a.map((h) => ({
4156
- start: h.start - n,
4157
- end: h.end - n
4181
+ childOffsets: o.map((h) => h - a),
4182
+ subtreeSpans: n.map((h) => ({
4183
+ start: h.start - a,
4184
+ end: h.end - a
4158
4185
  }))
4159
4186
  };
4160
4187
  }
4161
4188
  calculateMaxDiff(e, t) {
4162
4189
  let o = 0;
4163
4190
  const s = Math.min(e.length, t.length);
4164
- for (let a = 0; a < s; a++) {
4165
- const n = e[a].end - t[a].start;
4166
- o = Math.max(o, n);
4191
+ for (let n = 0; n < s; n++) {
4192
+ const a = e[n].end - t[n].start;
4193
+ o = Math.max(o, a);
4167
4194
  }
4168
4195
  return o - 2 * this.params.spaceAroundRadius;
4169
4196
  }
@@ -4176,17 +4203,17 @@ class dr {
4176
4203
  const o = t.spaceAroundRadius, s = new hr({
4177
4204
  spaceAroundRadius: o
4178
4205
  });
4179
- [...this.tree.sequence].reverse().forEach((a) => {
4180
- const n = Array.from(a.children).map(
4206
+ [...this.tree.sequence].reverse().forEach((n) => {
4207
+ const a = Array.from(n.children).map(
4181
4208
  (c) => this.treeSpans.get(c.nodeId)
4182
- ), h = s.generate(n);
4209
+ ), h = s.generate(a);
4183
4210
  let d = 0;
4184
- a.children.forEach((c) => {
4211
+ n.children.forEach((c) => {
4185
4212
  this.offsets.set(c.nodeId, h.childOffsets[d]), d++;
4186
- }), this.treeSpans.set(a.nodeId, [
4213
+ }), this.treeSpans.set(n.nodeId, [
4187
4214
  { start: -o, end: o },
4188
4215
  ...h.subtreeSpans
4189
- ]), a.children.forEach((c) => {
4216
+ ]), n.children.forEach((c) => {
4190
4217
  this.treeSpans.delete(c.nodeId);
4191
4218
  });
4192
4219
  }), this.offsets.set(this.tree.root.nodeId, 0);
@@ -4201,27 +4228,27 @@ class cr {
4201
4228
  }
4202
4229
  calculateCoordinates(e) {
4203
4230
  const t = /* @__PURE__ */ new Map(), s = new ar(e.graph).generate();
4204
- let a = 0;
4205
- return s.forEach((n) => {
4206
- t.set(n.root.nodeId, { x: a, y: 0 });
4207
- const d = new dr(n, {
4231
+ let n = 0;
4232
+ return s.forEach((a) => {
4233
+ t.set(a.root.nodeId, { x: n, y: 0 });
4234
+ const d = new dr(a, {
4208
4235
  spaceAroundRadius: this.params.layerSpace / 2
4209
4236
  }).generate();
4210
- let c = [n.root];
4237
+ let c = [a.root];
4211
4238
  for (; c.length > 0; ) {
4212
- const u = [];
4213
- a += this.params.layerWidth, c.forEach((g) => {
4214
- g.children.forEach((l) => {
4215
- const p = t.get(g.nodeId).y;
4239
+ const g = [];
4240
+ n += this.params.layerWidth, c.forEach((u) => {
4241
+ u.children.forEach((l) => {
4242
+ const p = t.get(u.nodeId).y;
4216
4243
  t.set(l.nodeId, {
4217
4244
  y: p + d.get(l.nodeId),
4218
- x: a
4219
- }), u.push(l);
4245
+ x: n
4246
+ }), g.push(l);
4220
4247
  });
4221
- }), c = u;
4248
+ }), c = g;
4222
4249
  }
4223
- }), t.forEach((n, h) => {
4224
- t.set(h, this.params.transform(n));
4250
+ }), t.forEach((a, h) => {
4251
+ t.set(h, this.params.transform(a));
4225
4252
  }), t;
4226
4253
  }
4227
4254
  }
@@ -4249,13 +4276,13 @@ class lr {
4249
4276
  });
4250
4277
  }
4251
4278
  calculateNextCoordinates(e) {
4252
- const { graph: t, viewport: o, dt: s } = e, a = this.fillerLayoutAlgorithm.calculateCoordinates({
4279
+ const { graph: t, viewport: o, dt: s } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
4253
4280
  graph: t,
4254
4281
  viewport: o
4255
4282
  });
4256
4283
  return new ze(
4257
4284
  t,
4258
- a,
4285
+ n,
4259
4286
  {
4260
4287
  distanceVectorGenerator: this.distanceVectorGenerator,
4261
4288
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
@@ -4265,15 +4292,15 @@ class lr {
4265
4292
  edgeStiffness: this.edgeStiffness
4266
4293
  }
4267
4294
  ).apply() < this.convergenceVelocity && !t.getAllNodeIds().some((c) => {
4268
- const u = t.getNode(c);
4269
- return u.x === null || u.y === null;
4270
- }) ? /* @__PURE__ */ new Map() : a;
4295
+ const g = t.getNode(c);
4296
+ return g.x === null || g.y === null;
4297
+ }) ? /* @__PURE__ */ new Map() : n;
4271
4298
  }
4272
4299
  }
4273
4300
  const Ge = (r) => {
4274
4301
  let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
4275
- for (let a = 0, n; a < r.length; a++)
4276
- n = r.charCodeAt(a), e = t ^ Math.imul(e ^ n, 597399067), t = o ^ Math.imul(t ^ n, 2869860233), o = s ^ Math.imul(o ^ n, 951274213), s = e ^ Math.imul(s ^ n, 2716044179);
4302
+ for (let n = 0, a; n < r.length; n++)
4303
+ a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = o ^ Math.imul(t ^ a, 2869860233), o = s ^ Math.imul(o ^ a, 951274213), s = e ^ Math.imul(s ^ a, 2716044179);
4277
4304
  return e = Math.imul(o ^ e >>> 18, 597399067), t = Math.imul(s ^ t >>> 22, 2869860233), o = Math.imul(e ^ o >>> 17, 951274213), s = Math.imul(t ^ s >>> 19, 2716044179), e ^= t ^ o ^ s, t ^= e, o ^= e, s ^= e, [e >>> 0, t >>> 0, o >>> 0, s >>> 0];
4278
4305
  }, je = (r, e, t, o) => function() {
4279
4306
  r |= 0, e |= 0, t |= 0, o |= 0;
@@ -4356,14 +4383,14 @@ const Ge = (r) => {
4356
4383
  e: r.d * e.b + r.e * e.e,
4357
4384
  f: r.d * e.c + r.e * e.f + r.f
4358
4385
  }), yr = (r) => {
4359
- const { a: e, b: t, c: o, d: s, e: a, f: n } = r, h = e * a - t * s;
4386
+ const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
4360
4387
  return {
4361
- a: a / h,
4388
+ a: n / h,
4362
4389
  b: -t / h,
4363
- c: (t * n - o * a) / h,
4390
+ c: (t * a - o * n) / h,
4364
4391
  d: -s / h,
4365
4392
  e: e / h,
4366
- f: (o * s - e * n) / h
4393
+ f: (o * s - e * a) / h
4367
4394
  };
4368
4395
  };
4369
4396
  class wr {
@@ -4471,13 +4498,13 @@ const fr = (r) => {
4471
4498
  };
4472
4499
  const o = new wr();
4473
4500
  return e.forEach((s) => {
4474
- const a = o.resolve(s);
4475
- t = z(t, a);
4501
+ const n = o.resolve(s);
4502
+ t = z(t, n);
4476
4503
  }), (s) => {
4477
- const { x: a, y: n } = s;
4504
+ const { x: n, y: a } = s;
4478
4505
  return {
4479
- x: t.a * a + t.b * n + t.c,
4480
- y: t.d * a + t.e * n + t.f
4506
+ x: t.a * n + t.b * a + t.c,
4507
+ y: t.d * n + t.e * a + t.f
4481
4508
  };
4482
4509
  };
4483
4510
  }, vr = (r) => {
@@ -4548,7 +4575,7 @@ const fr = (r) => {
4548
4575
  edgesPriorityFn: o
4549
4576
  };
4550
4577
  }, Nr = (r) => {
4551
- var t, o, s, a, n;
4578
+ var t, o, s, n, a;
4552
4579
  const e = br(
4553
4580
  (t = r.nodes) == null ? void 0 : t.priority,
4554
4581
  (o = r.edges) == null ? void 0 : o.priority
@@ -4559,21 +4586,22 @@ const fr = (r) => {
4559
4586
  priorityFn: e.nodesPriorityFn
4560
4587
  },
4561
4588
  ports: {
4562
- direction: ((a = r.ports) == null ? void 0 : a.direction) ?? 0
4589
+ direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
4563
4590
  },
4564
4591
  edges: {
4565
- shapeFactory: le(((n = r.edges) == null ? void 0 : n.shape) ?? {}),
4592
+ shapeFactory: le(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
4566
4593
  priorityFn: e.edgesPriorityFn
4567
4594
  }
4568
4595
  };
4569
4596
  }, Pr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : re, Cr = (r) => {
4570
- var o, s;
4597
+ var o, s, n;
4571
4598
  const { canvasDefaults: e } = r, t = r.hasLayout ? Pr(r.layoutParams) : re;
4572
4599
  return {
4573
4600
  focus: {
4574
4601
  contentOffset: ((o = e.focus) == null ? void 0 : o.contentOffset) ?? 100,
4575
4602
  minContentScale: ((s = e.focus) == null ? void 0 : s.minContentScale) ?? 0,
4576
- schedule: t
4603
+ schedule: t,
4604
+ animationDuration: ((n = e.focus) == null ? void 0 : n.animationDuration) ?? 0
4577
4605
  }
4578
4606
  };
4579
4607
  };
@@ -4642,12 +4670,12 @@ class Dr {
4642
4670
  o.main,
4643
4671
  t,
4644
4672
  e
4645
- ), a = Nr(
4673
+ ), n = Nr(
4646
4674
  this.canvasDefaults
4647
- ), n = new Ie(
4675
+ ), a = new Ve(
4648
4676
  t,
4649
4677
  s,
4650
- a
4678
+ n
4651
4679
  ), h = xr(this.layoutConfig), d = Cr({
4652
4680
  canvasDefaults: this.canvasDefaults,
4653
4681
  hasLayout: this.hasLayout,
@@ -4655,11 +4683,12 @@ class Dr {
4655
4683
  }), c = new Oe(
4656
4684
  t,
4657
4685
  e,
4658
- d
4659
- ), u = new $e(e), g = new Ve(t), l = new Se(
4660
- g,
4686
+ d,
4687
+ this.window
4688
+ ), g = new $e(e), u = new Ie(t), l = new Se(
4661
4689
  u,
4662
- n,
4690
+ g,
4691
+ a,
4663
4692
  c
4664
4693
  );
4665
4694
  if (this.hasBackground && ie.configure(
@@ -4681,8 +4710,8 @@ class Dr {
4681
4710
  if (this.hasUserConnectablePorts) {
4682
4711
  const y = Zt(
4683
4712
  this.connectablePortsConfig,
4684
- a.edges.shapeFactory,
4685
- a.ports.direction
4713
+ n.edges.shapeFactory,
4714
+ n.ports.direction
4686
4715
  );
4687
4716
  ne.configure(
4688
4717
  l,