@html-graph/html-graph 8.22.0 → 8.24.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.
@@ -35,7 +35,7 @@ var e = /* @__PURE__ */ function(e) {
35
35
  i(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
36
36
  }
37
37
  attachEdge(e) {
38
- let t = this.graphStore.getEdge(e).payload.shape.svg;
38
+ let t = this.graphStore.getEdge(e).payload.shape.element;
39
39
  this.edgeIdToElementMap.set(e, t), this.container.appendChild(t), this.renderEdge(e), this.updateEdgePriority(e);
40
40
  }
41
41
  detachEdge(e) {
@@ -63,7 +63,7 @@ var e = /* @__PURE__ */ function(e) {
63
63
  updateEdgeShape(e) {
64
64
  let t = this.edgeIdToElementMap.get(e);
65
65
  this.container.removeChild(t);
66
- let n = this.graphStore.getEdge(e).payload.shape.svg;
66
+ let n = this.graphStore.getEdge(e).payload.shape.element;
67
67
  this.edgeIdToElementMap.set(e, n), this.container.appendChild(n);
68
68
  }
69
69
  renderEdge(t) {
@@ -76,7 +76,7 @@ var e = /* @__PURE__ */ function(e) {
76
76
  }
77
77
  updateEdgePriority(e) {
78
78
  let t = this.graphStore.getEdge(e);
79
- t.payload.shape.svg.style.zIndex = `${t.payload.priority}`;
79
+ t.payload.shape.element.style.zIndex = `${t.payload.priority}`;
80
80
  }
81
81
  createEdgeRenderPort(e, t, n, r) {
82
82
  let i = this.viewportStore.createContentCoords({
@@ -513,7 +513,7 @@ var e = /* @__PURE__ */ function(e) {
513
513
  if (this.hasEdge(e.id)) throw new p(m.addEdgeWithExistingId(e.id));
514
514
  if (!this.hasPort(e.from)) throw new p(m.addEdgeFromNonexistentPort(e.id, e.from));
515
515
  if (!this.hasPort(e.to)) throw new p(m.addEdgeToNonexistentPort(e.id, e.to));
516
- let t = this.findEdgeIdByElement(e.shape.svg);
516
+ let t = this.findEdgeIdByElement(e.shape.element);
517
517
  if (t !== void 0) throw new p(m.addEdgeWithElementInUse(e.id, t));
518
518
  this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
519
519
  }
@@ -621,11 +621,11 @@ var e = /* @__PURE__ */ function(e) {
621
621
  shape: e.shape,
622
622
  priority: e.priority
623
623
  }
624
- }), this.edgesElementsMap.set(e.shape.svg, e.id), e.from === e.to ? this.portCycleEdges.get(e.from).add(e.id) : (this.portOutgoingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id));
624
+ }), this.edgesElementsMap.set(e.shape.element, e.id), e.from === e.to ? this.portCycleEdges.get(e.from).add(e.id) : (this.portOutgoingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id));
625
625
  }
626
626
  removeEdgeInternal(e) {
627
627
  let { from: t, to: n, payload: r } = this.getEdge(e);
628
- this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(n).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(n).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(n).delete(e), this.edges.delete(e), this.edgesElementsMap.delete(r.shape.svg);
628
+ this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(n).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(n).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(n).delete(e), this.edges.delete(e), this.edgesElementsMap.delete(r.shape.element);
629
629
  }
630
630
  }, g = (e) => ({
631
631
  scale: 1 / e.scale,
@@ -726,7 +726,7 @@ var e = /* @__PURE__ */ function(e) {
726
726
  }, x = (e, t, n) => {
727
727
  let { x: r, y: i, width: a, height: o } = e.getBoundingClientRect();
728
728
  return t >= r && t <= r + a && n >= i && n <= i + o;
729
- }, S = (e, t, n) => t >= 0 && t <= e.innerWidth && n >= 0 && n <= e.innerHeight, C = class {
729
+ }, S = (e, t, n) => t >= 0 && t <= e.innerWidth && n >= 0 && n <= e.innerHeight, ee = class {
730
730
  element;
731
731
  win;
732
732
  constructor(e, t) {
@@ -735,9 +735,9 @@ var e = /* @__PURE__ */ function(e) {
735
735
  verify(e, t) {
736
736
  return x(this.element, e, t) && S(this.win, e, t);
737
737
  }
738
- }, w = (e, t) => {
738
+ }, C = (e, t) => {
739
739
  t === null ? e.style.removeProperty("cursor") : e.style.cursor = t;
740
- }, T = (e) => {
740
+ }, w = (e) => {
741
741
  let t = document.createElement("div");
742
742
  return {
743
743
  id: e.overlayNodeId,
@@ -750,7 +750,7 @@ var e = /* @__PURE__ */ function(e) {
750
750
  direction: e.portDirection
751
751
  }]
752
752
  };
753
- }, ee = (e, t) => {
753
+ }, te = (e, t) => {
754
754
  let n = t;
755
755
  for (; n !== null;) {
756
756
  let t = e.findPortIdsByElement(n)[0] ?? null;
@@ -765,11 +765,11 @@ var e = /* @__PURE__ */ function(e) {
765
765
  };
766
766
  //#endregion
767
767
  //#region src/configurators/shared/find-port-at-point/get-elements-at-point/get-elements-at-point.ts
768
- function* te(e, t) {
768
+ function* ne(e, t) {
769
769
  let n = e.elementsFromPoint(t.x, t.y);
770
770
  for (let e of n) {
771
771
  if (e.shadowRoot !== null) {
772
- let n = te(e.shadowRoot, t);
772
+ let n = ne(e.shadowRoot, t);
773
773
  for (let e of n) yield e;
774
774
  }
775
775
  yield e;
@@ -777,23 +777,23 @@ function* te(e, t) {
777
777
  }
778
778
  //#endregion
779
779
  //#region src/configurators/shared/find-port-at-point/find-port-at-point.ts
780
- var ne = (e, t) => {
781
- let n = te(document, t);
780
+ var re = (e, t) => {
781
+ let n = ne(document, t);
782
782
  for (let t of n) {
783
- let n = ee(e, t);
783
+ let n = te(e, t);
784
784
  if (n.status === "portFound") return n.portId;
785
785
  if (n.status === "nodeEncountered") return null;
786
786
  }
787
787
  return null;
788
- }, E = /* @__PURE__ */ function(e) {
788
+ }, T = /* @__PURE__ */ function(e) {
789
789
  return e.StaticNodeId = "static", e.DraggingNodeId = "dragging", e.EdgeId = "edge", e;
790
- }({}), re = (e, t) => ({
790
+ }({}), ie = (e, t) => ({
791
791
  x: e / 2,
792
792
  y: t / 2
793
- }), D = (e, t, n) => ({
793
+ }), E = (e, t, n) => ({
794
794
  x: t.x * e.x - t.y * e.y + ((1 - t.x) * n.x + t.y * n.y),
795
795
  y: t.y * e.x + t.x * e.y + ((1 - t.x) * n.y - t.y * n.x)
796
- }), ie = (e, t, n) => {
796
+ }), ae = (e, t, n) => {
797
797
  let r = {
798
798
  x: e.x + e.width / 2,
799
799
  y: e.y + e.height / 2
@@ -815,14 +815,14 @@ var ne = (e, t) => {
815
815
  y: i.y - o
816
816
  }
817
817
  };
818
- }, O = .5 * .5 * .5, k = 3 * O, ae = class {
818
+ }, D = .5 * .5 * .5, O = 3 * D, oe = class {
819
819
  path;
820
820
  midpoint;
821
821
  constructor(e) {
822
- let { from: t, to: n, arrowLength: r, fromDir: i, toDir: a, curvature: o, hasSourceArrow: s, hasTargetArrow: c } = e, l = D({
822
+ let { from: t, to: n, arrowLength: r, fromDir: i, toDir: a, curvature: o, hasSourceArrow: s, hasTargetArrow: c } = e, l = E({
823
823
  x: t.x + r,
824
824
  y: t.y
825
- }, i, t), u = D({
825
+ }, i, t), u = E({
826
826
  x: n.x - r,
827
827
  y: n.y
828
828
  }, a, n), d = {
@@ -831,7 +831,7 @@ var ne = (e, t) => {
831
831
  }, f = {
832
832
  x: u.x - a.x * o,
833
833
  y: u.y - a.y * o
834
- }, p = O * l.x + k * d.x + k * f.x + O * u.x, m = O * l.y + k * d.y + k * f.y + O * u.y;
834
+ }, p = D * l.x + O * d.x + O * f.x + D * u.x, m = D * l.y + O * d.y + O * f.y + D * u.y;
835
835
  this.midpoint = {
836
836
  x: p,
837
837
  y: m
@@ -839,23 +839,23 @@ var ne = (e, t) => {
839
839
  let h = `M ${l.x} ${l.y} C ${d.x} ${d.y}, ${f.x} ${f.y}, ${u.x} ${u.y}`, g = s ? "" : `M ${t.x} ${t.y} L ${l.x} ${l.y} `, _ = c ? "" : ` M ${u.x} ${u.y} L ${n.x} ${n.y}`;
840
840
  this.path = `${g}${h}${_}`;
841
841
  }
842
- }, oe = class {
842
+ }, se = class {
843
843
  path;
844
844
  midpoint;
845
845
  constructor(e) {
846
- let { hasSourceArrow: t, hasTargetArrow: n, curvature: r, fromDir: i, toDir: a, detourDir: o, from: s, to: c, arrowLength: l, detourDistance: u } = e, d = t ? D({
846
+ let { hasSourceArrow: t, hasTargetArrow: n, curvature: r, fromDir: i, toDir: a, detourDir: o, from: s, to: c, arrowLength: l, detourDistance: u } = e, d = t ? E({
847
847
  x: s.x + l,
848
848
  y: s.y
849
- }, i, s) : s, f = n ? D({
849
+ }, i, s) : s, f = n ? E({
850
850
  x: c.x - l,
851
851
  y: c.y
852
- }, a, c) : c, p = Math.cos(o) * u, m = Math.sin(o) * u, h = D({
852
+ }, a, c) : c, p = Math.cos(o) * u, m = Math.sin(o) * u, h = E({
853
853
  x: s.x + l,
854
854
  y: s.y
855
855
  }, i, s), g = {
856
856
  x: h.x + p,
857
857
  y: h.y + m
858
- }, _ = D({
858
+ }, _ = E({
859
859
  x: c.x - l,
860
860
  y: c.y
861
861
  }, a, c), v = {
@@ -873,7 +873,7 @@ var ne = (e, t) => {
873
873
  }, S = {
874
874
  x: h.x + p,
875
875
  y: h.y + m
876
- }, C = {
876
+ }, ee = {
877
877
  x: _.x + p,
878
878
  y: _.y + m
879
879
  };
@@ -881,22 +881,22 @@ var ne = (e, t) => {
881
881
  `M ${d.x} ${d.y}`,
882
882
  `L ${h.x} ${h.y}`,
883
883
  `C ${b.x} ${b.y} ${S.x} ${S.y} ${y.x} ${y.y}`,
884
- `C ${C.x} ${C.y} ${x.x} ${x.y} ${_.x} ${_.y}`,
884
+ `C ${ee.x} ${ee.y} ${x.x} ${x.y} ${_.x} ${_.y}`,
885
885
  `L ${f.x} ${f.y}`
886
886
  ].join(" "), this.midpoint = y;
887
887
  }
888
- }, A = Object.freeze({ edgeColor: "--edge-color" }), se = (e) => {
888
+ }, k = Object.freeze({ edgeColor: "--edge-color" }), ce = (e) => {
889
889
  let t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
890
- return t.style.pointerEvents = "none", t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.overflow = "visible", t.style.setProperty(A.edgeColor, e), t;
891
- }, ce = (e) => {
890
+ return t.style.pointerEvents = "none", t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.overflow = "visible", t.style.setProperty(k.edgeColor, e), t;
891
+ }, le = (e) => {
892
892
  let t = document.createElementNS("http://www.w3.org/2000/svg", "path");
893
- return t.setAttribute("stroke", `var(${A.edgeColor})`), t.setAttribute("stroke-width", `${e}`), t.setAttribute("fill", "none"), t;
894
- }, j = () => {
893
+ return t.setAttribute("stroke", `var(${k.edgeColor})`), t.setAttribute("stroke-width", `${e}`), t.setAttribute("fill", "none"), t;
894
+ }, A = () => {
895
895
  let e = document.createElementNS("http://www.w3.org/2000/svg", "path");
896
- return e.setAttribute("fill", `var(${A.edgeColor})`), e;
897
- }, le = (e, t) => {
896
+ return e.setAttribute("fill", `var(${k.edgeColor})`), e;
897
+ }, ue = (e, t) => {
898
898
  e.style.transform = `translate(${t.x}px, ${t.y}px)`, e.style.width = `${t.width}px`, e.style.height = `${t.height}px`;
899
- }, M = (e, t) => {
899
+ }, j = (e, t) => {
900
900
  let n = [];
901
901
  if (e.length > 0 && n.push(`M ${e[0].x} ${e[0].y}`), e.length === 2 && n.push(`L ${e[1].x} ${e[1].y}`), e.length > 2) {
902
902
  let r = e.length - 1, i = 0, a = 0, o = 0;
@@ -917,9 +917,9 @@ var ne = (e, t) => {
917
917
  });
918
918
  }
919
919
  return n.join(" ");
920
- }, ue = (e, t) => {
921
- let n = e.linePoint, r = t.linePoint, i = r.x - n.x >= 0, a = e.dirX >= 0;
922
- if (a === t.dirX >= 0) {
920
+ }, de = (e, t) => {
921
+ let n = e.linePoint, r = t.linePoint, i = r.x - n.x >= 0, a = e.dir.x >= 0;
922
+ if (a === t.dir.x >= 0) {
923
923
  let o = a === i, s = {
924
924
  x: (n.x + r.x) / 2,
925
925
  y: (n.y + r.y) / 2
@@ -991,50 +991,196 @@ var ne = (e, t) => {
991
991
  y: s
992
992
  }
993
993
  };
994
- }, de = class {
994
+ }, M = (e) => ({
995
+ x: e.y,
996
+ y: e.x
997
+ }), fe = (e, t) => {
998
+ let n = de({
999
+ arrowPoint: M(e.arrowPoint),
1000
+ linePoint: M(e.linePoint),
1001
+ dir: M(e.dir)
1002
+ }, {
1003
+ arrowPoint: M(t.arrowPoint),
1004
+ linePoint: M(t.linePoint),
1005
+ dir: M(t.dir)
1006
+ });
1007
+ return {
1008
+ points: n.points.map((e) => M(e)),
1009
+ midpoint: M(n.midpoint)
1010
+ };
1011
+ }, N = (e) => {
1012
+ let t = [];
1013
+ for (let n = 1; n < e.length; n++) {
1014
+ let r = e[n - 1], i = e[n], a = i.x - r.x, o = i.y - r.y, s = Math.sqrt(a * a + o * o);
1015
+ t.push({
1016
+ start: r,
1017
+ end: i,
1018
+ distance: s
1019
+ });
1020
+ }
1021
+ let n = t.reduce((e, t) => e + t.distance, 0) / 2, r = 0;
1022
+ for (let e of t) {
1023
+ let t = r + e.distance;
1024
+ if (t >= n) {
1025
+ let t = n - r, { start: i, end: a, distance: o } = e;
1026
+ if (o === 0) continue;
1027
+ let s = t / o, c = a.x - i.x, l = a.y - i.y;
1028
+ return {
1029
+ x: i.x + c * s,
1030
+ y: i.y + l * s
1031
+ };
1032
+ }
1033
+ r = t;
1034
+ }
1035
+ if (r === 0 && e.length > 0) return e[0];
1036
+ throw Error("Failed to calculate midpoint");
1037
+ }, pe = (e, t) => {
1038
+ let n = e.linePoint, r = e.arrowPoint, i = t.linePoint, a = t.arrowPoint, o = t.dir.y >= 0, s = e.dir.x >= 0, c = i.y - n.y >= 0, l = s === i.x - n.x >= 0, u = o === c;
1039
+ if (l) {
1040
+ if (u) {
1041
+ let e = {
1042
+ x: a.x,
1043
+ y: r.y
1044
+ };
1045
+ return {
1046
+ points: [
1047
+ r,
1048
+ e,
1049
+ a
1050
+ ],
1051
+ midpoint: N([
1052
+ n,
1053
+ e,
1054
+ i
1055
+ ])
1056
+ };
1057
+ }
1058
+ let e = (n.x + i.x) / 2, t = {
1059
+ x: e,
1060
+ y: n.y
1061
+ }, o = {
1062
+ x: e,
1063
+ y: i.y
1064
+ };
1065
+ return {
1066
+ points: [
1067
+ r,
1068
+ t,
1069
+ o,
1070
+ i,
1071
+ a
1072
+ ],
1073
+ midpoint: N([
1074
+ n,
1075
+ t,
1076
+ o,
1077
+ i
1078
+ ])
1079
+ };
1080
+ }
1081
+ if (u) {
1082
+ let e = (n.y + i.y) / 2, t = {
1083
+ x: n.x,
1084
+ y: e
1085
+ }, o = {
1086
+ x: i.x,
1087
+ y: e
1088
+ };
1089
+ return {
1090
+ points: [
1091
+ r,
1092
+ n,
1093
+ t,
1094
+ o,
1095
+ a
1096
+ ],
1097
+ midpoint: N([
1098
+ n,
1099
+ t,
1100
+ o,
1101
+ i
1102
+ ])
1103
+ };
1104
+ }
1105
+ let d = {
1106
+ x: n.x,
1107
+ y: i.y
1108
+ };
1109
+ return {
1110
+ points: [
1111
+ r,
1112
+ n,
1113
+ d,
1114
+ i,
1115
+ a
1116
+ ],
1117
+ midpoint: N([
1118
+ n,
1119
+ d,
1120
+ i
1121
+ ])
1122
+ };
1123
+ }, me = (e, t) => {
1124
+ let n = pe({
1125
+ arrowPoint: M(e.arrowPoint),
1126
+ linePoint: M(e.linePoint),
1127
+ dir: M(e.dir)
1128
+ }, {
1129
+ arrowPoint: M(t.arrowPoint),
1130
+ linePoint: M(t.linePoint),
1131
+ dir: M(t.dir)
1132
+ });
1133
+ return {
1134
+ points: n.points.map((e) => M(e)),
1135
+ midpoint: M(n.midpoint)
1136
+ };
1137
+ }, he = (e, t) => {
1138
+ let n = Math.abs(e.dir.y) < 1e-10, r = Math.abs(t.dir.y) < 1e-10;
1139
+ return n ? r ? de(e, t) : pe(e, t) : r ? me(e, t) : fe(e, t);
1140
+ }, ge = class {
995
1141
  path;
996
1142
  midpoint;
997
1143
  constructor(e) {
998
- let { from: t, to: n, fromDir: r, toDir: i, arrowLength: a, arrowOffset: o, roundness: s, hasSourceArrow: c, hasTargetArrow: l } = e, u = c ? D({
1144
+ let { from: t, to: n, fromDir: r, toDir: i, arrowLength: a, arrowOffset: o, roundness: s, hasSourceArrow: c, hasTargetArrow: l } = e, u = c ? E({
999
1145
  x: t.x + a,
1000
1146
  y: t.y
1001
- }, r, t) : t, d = l ? D({
1147
+ }, r, t) : t, d = l ? E({
1002
1148
  x: n.x - a,
1003
1149
  y: n.y
1004
- }, i, n) : n, f = a + o, p = D({
1150
+ }, i, n) : n, f = a + o, p = E({
1005
1151
  x: t.x + f,
1006
1152
  y: t.y
1007
- }, r, t), m = D({
1153
+ }, r, t), m = E({
1008
1154
  x: n.x - f,
1009
1155
  y: n.y
1010
- }, i, n), h = ue({
1156
+ }, i, n), h = de({
1011
1157
  arrowPoint: u,
1012
1158
  linePoint: p,
1013
- dirX: r.x
1159
+ dir: r
1014
1160
  }, {
1015
1161
  arrowPoint: d,
1016
1162
  linePoint: m,
1017
- dirX: i.x
1163
+ dir: i
1018
1164
  });
1019
- this.path = M(h.points, s), this.midpoint = h.midpoint;
1165
+ this.path = j(h.points, s), this.midpoint = h.midpoint;
1020
1166
  }
1021
- }, fe = class {
1167
+ }, _e = class {
1022
1168
  path;
1023
1169
  midpoint;
1024
1170
  constructor(e) {
1025
- let { hasSourceArrow: t, hasTargetArrow: n, from: r, to: i, arrowLength: a, fromDir: o, toDir: s, arrowOffset: c, detourDir: l, detourDistance: u, roundness: d } = e, f = t ? D({
1171
+ let { hasSourceArrow: t, hasTargetArrow: n, from: r, to: i, arrowLength: a, fromDir: o, toDir: s, arrowOffset: c, detourDir: l, detourDistance: u, roundness: d } = e, f = t ? E({
1026
1172
  x: r.x + a,
1027
1173
  y: r.y
1028
- }, o, r) : r, p = n ? D({
1174
+ }, o, r) : r, p = n ? E({
1029
1175
  x: i.x - a,
1030
1176
  y: i.y
1031
- }, s, i) : i, m = a + c, h = Math.cos(l) * u, g = Math.sin(l) * u, _ = D({
1177
+ }, s, i) : i, m = a + c, h = Math.cos(l) * u, g = Math.sin(l) * u, _ = E({
1032
1178
  x: r.x + m,
1033
1179
  y: r.y
1034
1180
  }, o, r), v = {
1035
1181
  x: _.x + h,
1036
1182
  y: _.y + g
1037
- }, y = D({
1183
+ }, y = E({
1038
1184
  x: i.x - m,
1039
1185
  y: i.y
1040
1186
  }, s, i), b = {
@@ -1044,7 +1190,7 @@ var ne = (e, t) => {
1044
1190
  this.midpoint = {
1045
1191
  x: (v.x + b.x) / 2,
1046
1192
  y: (v.y + b.y) / 2
1047
- }, this.path = M([
1193
+ }, this.path = j([
1048
1194
  f,
1049
1195
  _,
1050
1196
  v,
@@ -1053,18 +1199,18 @@ var ne = (e, t) => {
1053
1199
  p
1054
1200
  ], d);
1055
1201
  }
1056
- }, pe = class {
1202
+ }, ve = class {
1057
1203
  path;
1058
1204
  midpoint;
1059
1205
  constructor(e) {
1060
- let { from: t, to: n, hasSourceArrow: r, hasTargetArrow: i, arrowLength: a, fromDir: o, toDir: s, arrowOffset: c, roundness: l } = e, u = this.createArrowPoint(r, o, t, a), d = this.createArrowPoint(i, s, n, -a), f = a + c, p = D({
1206
+ let { from: t, to: n, hasSourceArrow: r, hasTargetArrow: i, arrowLength: a, fromDir: o, toDir: s, arrowOffset: c, roundness: l } = e, u = this.createArrowPoint(r, o, t, a), d = this.createArrowPoint(i, s, n, -a), f = a + c, p = E({
1061
1207
  x: t.x + f,
1062
1208
  y: t.y
1063
- }, o, t), m = D({
1209
+ }, o, t), m = E({
1064
1210
  x: n.x - f,
1065
1211
  y: n.y
1066
1212
  }, s, n);
1067
- this.path = M([
1213
+ this.path = j([
1068
1214
  u,
1069
1215
  p,
1070
1216
  m,
@@ -1077,113 +1223,66 @@ var ne = (e, t) => {
1077
1223
  };
1078
1224
  }
1079
1225
  createArrowPoint(e, t, n, r) {
1080
- return e ? D({
1226
+ return e ? E({
1081
1227
  x: n.x + r,
1082
1228
  y: n.y
1083
1229
  }, t, n) : n;
1084
1230
  }
1085
- }, me = (e, t) => {
1086
- let n = e.linePoint, r = t.linePoint, i = r.y - n.y >= 0, a = e.dirY >= 0;
1087
- if (a === t.dirY >= 0) {
1088
- let o = a === i, s = {
1089
- x: (n.x + r.x) / 2,
1090
- y: (n.y + r.y) / 2
1091
- };
1092
- return o ? {
1093
- points: [
1094
- e.arrowPoint,
1095
- {
1096
- x: n.x,
1097
- y: s.y
1098
- },
1099
- {
1100
- x: r.x,
1101
- y: s.y
1102
- },
1103
- t.arrowPoint
1104
- ],
1105
- midpoint: s
1106
- } : {
1107
- points: [
1108
- e.arrowPoint,
1109
- n,
1110
- {
1111
- x: s.x,
1112
- y: n.y
1113
- },
1114
- {
1115
- x: s.x,
1116
- y: r.y
1117
- },
1118
- r,
1119
- t.arrowPoint
1120
- ],
1121
- midpoint: s
1122
- };
1123
- }
1124
- let o = a === i, s = (n.x + r.x) / 2;
1125
- if (o) {
1126
- let i = {
1127
- x: n.x,
1128
- y: r.y
1129
- };
1130
- return {
1131
- points: [
1132
- e.arrowPoint,
1133
- i,
1134
- r,
1135
- t.arrowPoint
1136
- ],
1137
- midpoint: {
1138
- x: s,
1139
- y: i.y
1140
- }
1141
- };
1231
+ }, ye = class {
1232
+ path;
1233
+ midpoint;
1234
+ constructor(e) {
1235
+ let { from: t, to: n, hasSourceArrow: r, hasTargetArrow: i, arrowLength: a, arrowOffset: o, fromDir: s, toDir: c, roundness: l } = e, u = r ? E({
1236
+ x: t.x + a,
1237
+ y: t.y
1238
+ }, s, t) : t, d = i ? E({
1239
+ x: n.x - a,
1240
+ y: n.y
1241
+ }, c, n) : n, f = a + o, p = E({
1242
+ x: t.x + f,
1243
+ y: t.y
1244
+ }, s, t), m = E({
1245
+ x: n.x - f,
1246
+ y: n.y
1247
+ }, c, n), h = fe({
1248
+ arrowPoint: u,
1249
+ linePoint: p,
1250
+ dir: s
1251
+ }, {
1252
+ arrowPoint: d,
1253
+ linePoint: m,
1254
+ dir: c
1255
+ });
1256
+ this.path = j(h.points, l), this.midpoint = h.midpoint;
1142
1257
  }
1143
- let c = {
1144
- x: r.x,
1145
- y: n.y
1146
- };
1147
- return {
1148
- points: [
1149
- e.arrowPoint,
1150
- n,
1151
- c,
1152
- t.arrowPoint
1153
- ],
1154
- midpoint: {
1155
- x: s,
1156
- y: c.y
1157
- }
1158
- };
1159
- }, he = class {
1258
+ }, be = class {
1160
1259
  path;
1161
1260
  midpoint;
1162
1261
  constructor(e) {
1163
- let { from: t, to: n, hasSourceArrow: r, hasTargetArrow: i, arrowLength: a, arrowOffset: o, fromDir: s, toDir: c, roundness: l } = e, u = r ? D({
1262
+ let { from: t, to: n, fromDir: r, toDir: i, arrowLength: a, arrowOffset: o, roundness: s, hasSourceArrow: c, hasTargetArrow: l } = e, u = c ? E({
1164
1263
  x: t.x + a,
1165
1264
  y: t.y
1166
- }, s, t) : t, d = i ? D({
1265
+ }, r, t) : t, d = l ? E({
1167
1266
  x: n.x - a,
1168
1267
  y: n.y
1169
- }, c, n) : n, f = a + o, p = D({
1268
+ }, i, n) : n, f = a + o, p = E({
1170
1269
  x: t.x + f,
1171
1270
  y: t.y
1172
- }, s, t), m = D({
1271
+ }, r, t), m = E({
1173
1272
  x: n.x - f,
1174
1273
  y: n.y
1175
- }, c, n), h = me({
1274
+ }, i, n), h = he({
1176
1275
  arrowPoint: u,
1177
1276
  linePoint: p,
1178
- dirY: s.y
1277
+ dir: r
1179
1278
  }, {
1180
1279
  arrowPoint: d,
1181
1280
  linePoint: m,
1182
- dirY: c.y
1281
+ dir: i
1183
1282
  });
1184
- this.path = M(h.points, l), this.midpoint = h.midpoint;
1283
+ this.path = j(h.points, s), this.midpoint = h.midpoint;
1185
1284
  }
1186
- }, ge = class {
1285
+ }, P = class {
1187
1286
  path;
1188
1287
  midpoint;
1189
1288
  constructor(e) {
@@ -1220,19 +1319,19 @@ var ne = (e, t) => {
1220
1319
  x: n,
1221
1320
  y: 0
1222
1321
  }
1223
- ].map((e) => D(e, i, {
1322
+ ].map((e) => E(e, i, {
1224
1323
  x: 0,
1225
1324
  y: 0
1226
1325
  })).map((e) => ({
1227
1326
  x: e.x + a.x,
1228
1327
  y: e.y + a.y
1229
1328
  })), u = `M ${a.x} ${a.y} L ${l[0].x} ${l[0].y} `;
1230
- this.path = `${o ? "" : u}${M(l, e.roundness)}`, this.midpoint = {
1329
+ this.path = `${o ? "" : u}${j(l, e.roundness)}`, this.midpoint = {
1231
1330
  x: (l[3].x + l[4].x) / 2,
1232
1331
  y: (l[3].y + l[4].y) / 2
1233
1332
  };
1234
1333
  }
1235
- }, _e = class {
1334
+ }, xe = class {
1236
1335
  path;
1237
1336
  midpoint;
1238
1337
  constructor(e) {
@@ -1253,7 +1352,7 @@ var ne = (e, t) => {
1253
1352
  x: d,
1254
1353
  y: 0
1255
1354
  }
1256
- ].map((e) => D(e, i, {
1355
+ ].map((e) => E(e, i, {
1257
1356
  x: 0,
1258
1357
  y: 0
1259
1358
  })).map((e) => ({
@@ -1267,30 +1366,30 @@ var ne = (e, t) => {
1267
1366
  ].join(" "), h = `M ${a.x} ${a.y} L ${p[0].x} ${p[0].y} `;
1268
1367
  this.path = `${o ? "" : h}${m}`, this.midpoint = p[3];
1269
1368
  }
1270
- }, ve = (e, t, n) => {
1369
+ }, Se = (e, t, n) => {
1271
1370
  let r = Math.max(e.y, t.y), i = Math.min(e.y, t.y);
1272
1371
  return (n >= 0 ? r : i) + n;
1273
- }, ye = class {
1372
+ }, Ce = class {
1274
1373
  path;
1275
1374
  midpoint;
1276
1375
  constructor(e) {
1277
- let { hasSourceArrow: t, hasTargetArrow: n, arrowLength: r, from: i, to: a, fromDir: o, toDir: s, arrowOffset: c, roundness: l, detourDistance: u } = e, d = t ? D({
1376
+ let { hasSourceArrow: t, hasTargetArrow: n, arrowLength: r, from: i, to: a, fromDir: o, toDir: s, arrowOffset: c, roundness: l, detourDistance: u } = e, d = t ? E({
1278
1377
  x: i.x + r,
1279
1378
  y: i.y
1280
- }, o, i) : i, f = n ? D({
1379
+ }, o, i) : i, f = n ? E({
1281
1380
  x: a.x - r,
1282
1381
  y: a.y
1283
- }, s, a) : a, p = r + c, m = D({
1382
+ }, s, a) : a, p = r + c, m = E({
1284
1383
  x: i.x + p,
1285
1384
  y: i.y
1286
- }, o, i), h = D({
1385
+ }, o, i), h = E({
1287
1386
  x: a.x - p,
1288
1387
  y: a.y
1289
- }, s, a), g = ve(m, h, u);
1388
+ }, s, a), g = Se(m, h, u);
1290
1389
  this.midpoint = {
1291
1390
  x: (m.x + h.x) / 2,
1292
1391
  y: g
1293
- }, this.path = M([
1392
+ }, this.path = j([
1294
1393
  d,
1295
1394
  m,
1296
1395
  {
@@ -1305,30 +1404,30 @@ var ne = (e, t) => {
1305
1404
  f
1306
1405
  ], l);
1307
1406
  }
1308
- }, be = (e, t, n) => {
1407
+ }, we = (e, t, n) => {
1309
1408
  let r = Math.max(e.x, t.x), i = Math.min(e.x, t.x);
1310
1409
  return (n >= 0 ? r : i) + n;
1311
- }, xe = class {
1410
+ }, Te = class {
1312
1411
  path;
1313
1412
  midpoint;
1314
1413
  constructor(e) {
1315
- let { hasSourceArrow: t, hasTargetArrow: n, arrowLength: r, fromDir: i, toDir: a, from: o, to: s, arrowOffset: c, detourDistance: l, roundness: u } = e, d = t ? D({
1414
+ let { hasSourceArrow: t, hasTargetArrow: n, arrowLength: r, fromDir: i, toDir: a, from: o, to: s, arrowOffset: c, detourDistance: l, roundness: u } = e, d = t ? E({
1316
1415
  x: o.x + r,
1317
1416
  y: o.y
1318
- }, i, o) : o, f = n ? D({
1417
+ }, i, o) : o, f = n ? E({
1319
1418
  x: s.x - r,
1320
1419
  y: s.y
1321
- }, a, s) : s, p = r + c, m = D({
1420
+ }, a, s) : s, p = r + c, m = E({
1322
1421
  x: o.x + p,
1323
1422
  y: o.y
1324
- }, i, o), h = D({
1423
+ }, i, o), h = E({
1325
1424
  x: s.x - p,
1326
1425
  y: s.y
1327
- }, a, s), g = be(m, h, l);
1426
+ }, a, s), g = we(m, h, l);
1328
1427
  this.midpoint = {
1329
1428
  x: g,
1330
1429
  y: (m.y + h.y) / 2
1331
- }, this.path = M([
1430
+ }, this.path = j([
1332
1431
  d,
1333
1432
  m,
1334
1433
  {
@@ -1343,7 +1442,25 @@ var ne = (e, t) => {
1343
1442
  f
1344
1443
  ], u);
1345
1444
  }
1346
- }, N = Object.freeze({
1445
+ }, Ee = class {
1446
+ path;
1447
+ midpoint;
1448
+ constructor(e) {
1449
+ let t = Math.abs(e.fromDir.y) < 1e-10, n = Math.abs(e.toDir.y) < 1e-10;
1450
+ if (t && n) {
1451
+ let t = new Ce(e);
1452
+ this.path = t.path, this.midpoint = t.midpoint;
1453
+ return;
1454
+ }
1455
+ if (!t && !n) {
1456
+ let t = new Te(e);
1457
+ this.path = t.path, this.midpoint = t.midpoint;
1458
+ return;
1459
+ }
1460
+ let r = new be(e);
1461
+ this.path = r.path, this.midpoint = r.midpoint;
1462
+ }
1463
+ }, F = Object.freeze({
1347
1464
  color: "#777777",
1348
1465
  width: 1,
1349
1466
  arrowLength: 20,
@@ -1365,11 +1482,12 @@ var ne = (e, t) => {
1365
1482
  curvature: 90,
1366
1483
  interactiveWidth: 10,
1367
1484
  portOffset: 0
1368
- }), Se = (e) => ({
1485
+ }), De = (e) => ({
1369
1486
  x: Math.cos(e),
1370
1487
  y: Math.sin(e)
1371
- }), P = class {
1488
+ }), I = class {
1372
1489
  params;
1490
+ element;
1373
1491
  svg;
1374
1492
  group = document.createElementNS("http://www.w3.org/2000/svg", "g");
1375
1493
  line;
@@ -1379,17 +1497,17 @@ var ne = (e, t) => {
1379
1497
  afterRenderEmitter;
1380
1498
  arrowRenderer;
1381
1499
  constructor(e) {
1382
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = u(), this.arrowRenderer = this.params.arrowRenderer, this.svg = se(e.color), this.svg.appendChild(this.group), this.line = ce(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = j(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = j(), this.group.appendChild(this.targetArrow));
1500
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = u(), this.arrowRenderer = this.params.arrowRenderer, this.element = ce(e.color), this.svg = this.element, this.element.appendChild(this.group), this.line = le(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = A(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = A(), this.group.appendChild(this.targetArrow));
1383
1501
  }
1384
1502
  render(t) {
1385
- let { x: n, y: r, width: i, height: a, from: o, to: s } = ie(t.from, t.to, this.params.padding);
1386
- le(this.svg, {
1503
+ let { x: n, y: r, width: i, height: a, from: o, to: s } = ae(t.from, t.to, this.params.padding);
1504
+ ue(this.element, {
1387
1505
  x: n,
1388
1506
  y: r,
1389
1507
  width: i,
1390
1508
  height: a
1391
1509
  });
1392
- let c = Se(t.from.direction), l = Se(t.to.direction), u = {
1510
+ let c = De(t.from.direction), l = De(t.to.direction), u = {
1393
1511
  x: -l.x,
1394
1512
  y: -l.y
1395
1513
  }, d;
@@ -1413,7 +1531,7 @@ var ne = (e, t) => {
1413
1531
  targetArrowPath: m
1414
1532
  });
1415
1533
  }
1416
- }, Ce = (e) => (t) => {
1534
+ }, Oe = (e) => (t) => {
1417
1535
  let n = [
1418
1536
  {
1419
1537
  x: 0,
@@ -1427,7 +1545,7 @@ var ne = (e, t) => {
1427
1545
  x: t.arrowLength,
1428
1546
  y: -e.radius
1429
1547
  }
1430
- ].map((e) => D(e, t.direction, {
1548
+ ].map((e) => E(e, t.direction, {
1431
1549
  x: 0,
1432
1550
  y: 0
1433
1551
  })).map((e) => ({
@@ -1435,7 +1553,7 @@ var ne = (e, t) => {
1435
1553
  y: e.y + t.shift.y
1436
1554
  }));
1437
1555
  return `${`M ${n[0].x} ${n[0].y}`} ${`L ${n[1].x} ${n[1].y}`} ${`L ${n[2].x} ${n[2].y}`} Z`;
1438
- }, we = (e) => (t) => {
1556
+ }, ke = (e) => (t) => {
1439
1557
  let n = e.radius, r = t.arrowLength, i = (r * r + 2 * r * n) / (2 * n), a = i + n, o = r + n - n * (r + n) / a, s = n * i / a, c = [
1440
1558
  {
1441
1559
  x: 0,
@@ -1449,7 +1567,7 @@ var ne = (e, t) => {
1449
1567
  x: o,
1450
1568
  y: s
1451
1569
  }
1452
- ].map((e) => D(e, t.direction, {
1570
+ ].map((e) => E(e, t.direction, {
1453
1571
  x: 0,
1454
1572
  y: 0
1455
1573
  })).map((e) => ({
@@ -1457,8 +1575,8 @@ var ne = (e, t) => {
1457
1575
  y: e.y + t.shift.y
1458
1576
  }));
1459
1577
  return `${`M ${c[0].x} ${c[0].y}`} ${`A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`} ${`A ${n} ${n} 0 0 0 ${c[2].x} ${c[2].y}`} ${`A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`}`;
1460
- }, Te = (e) => (t) => {
1461
- let n = e.smallRadius, r = e.radius, i = D({
1578
+ }, Ae = (e) => (t) => {
1579
+ let n = e.smallRadius, r = e.radius, i = E({
1462
1580
  x: t.arrowLength,
1463
1581
  y: 0
1464
1582
  }, {
@@ -1477,7 +1595,7 @@ var ne = (e, t) => {
1477
1595
  y: -i.y
1478
1596
  },
1479
1597
  i
1480
- ].map((e) => D(e, t.direction, {
1598
+ ].map((e) => E(e, t.direction, {
1481
1599
  x: 0,
1482
1600
  y: 0
1483
1601
  })).map((e) => ({
@@ -1485,18 +1603,19 @@ var ne = (e, t) => {
1485
1603
  y: e.y + t.shift.y
1486
1604
  }));
1487
1605
  return `${`M ${a[0].x} ${a[0].y}`} ${`A ${r} ${r} 0 0 1 ${a[1].x} ${a[1].y}`} ${`A ${n} ${n} 0 0 1 ${a[2].x} ${a[2].y}`} ${`A ${r} ${r} 0 0 1 ${a[0].x} ${a[0].y}`}`;
1488
- }, F = (e) => {
1606
+ }, L = (e) => {
1489
1607
  if (typeof e == "function") return e;
1490
1608
  switch (e.type) {
1491
- case "triangle": return Ce({ radius: e.radius ?? N.polygonArrowRadius });
1492
- case "arc": return we({ radius: e.radius ?? N.circleArrowRadius });
1493
- default: return Te({
1494
- smallRadius: e.smallRadius ?? N.wedgeArrowSmallRadius,
1495
- angle: e.angle ?? N.wedgeArrowAngle,
1496
- radius: e.radius ?? N.wedgeArrowRadius
1609
+ case "triangle": return Oe({ radius: e.radius ?? F.polygonArrowRadius });
1610
+ case "arc": return ke({ radius: e.radius ?? F.circleArrowRadius });
1611
+ default: return Ae({
1612
+ smallRadius: e.smallRadius ?? F.wedgeArrowSmallRadius,
1613
+ angle: e.angle ?? F.wedgeArrowAngle,
1614
+ radius: e.radius ?? F.wedgeArrowRadius
1497
1615
  });
1498
1616
  }
1499
- }, Ee = class {
1617
+ }, je = class {
1618
+ element;
1500
1619
  svg;
1501
1620
  group;
1502
1621
  line;
@@ -1512,7 +1631,7 @@ var ne = (e, t) => {
1512
1631
  hasSourceArrow;
1513
1632
  hasTargetArrow;
1514
1633
  pathShape;
1515
- createCyclePath = (e, t, n) => new _e({
1634
+ createCyclePath = (e, t, n) => new xe({
1516
1635
  origin: e,
1517
1636
  dir: n,
1518
1637
  radius: this.portCycleRadius,
@@ -1520,7 +1639,7 @@ var ne = (e, t) => {
1520
1639
  arrowLength: this.arrowLength,
1521
1640
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1522
1641
  });
1523
- createDetourPath = (e, t, n, r) => new oe({
1642
+ createDetourPath = (e, t, n, r) => new se({
1524
1643
  from: e,
1525
1644
  to: t,
1526
1645
  fromDir: n,
@@ -1532,7 +1651,7 @@ var ne = (e, t) => {
1532
1651
  hasSourceArrow: this.hasSourceArrow,
1533
1652
  hasTargetArrow: this.hasTargetArrow
1534
1653
  });
1535
- createLinePath = (e, t, n, r) => new ae({
1654
+ createLinePath = (e, t, n, r) => new oe({
1536
1655
  from: e,
1537
1656
  to: t,
1538
1657
  fromDir: n,
@@ -1543,10 +1662,10 @@ var ne = (e, t) => {
1543
1662
  hasTargetArrow: this.hasTargetArrow
1544
1663
  });
1545
1664
  constructor(e) {
1546
- this.arrowLength = e?.arrowLength ?? N.arrowLength, this.curvature = e?.curvature ?? N.curvature, this.portCycleRadius = e?.cycleRadius ?? N.cycleRadius, this.portCycleSmallRadius = e?.smallCycleRadius ?? N.smallCycleRadius, this.detourDirection = e?.detourDirection ?? N.detourDirection, this.detourDistance = e?.detourDistance ?? N.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? N.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? N.hasTargetArrow, this.pathShape = new P({
1547
- color: e?.color ?? N.color,
1548
- width: e?.width ?? N.width,
1549
- arrowRenderer: F(e?.arrowRenderer ?? {}),
1665
+ this.arrowLength = e?.arrowLength ?? F.arrowLength, this.curvature = e?.curvature ?? F.curvature, this.portCycleRadius = e?.cycleRadius ?? F.cycleRadius, this.portCycleSmallRadius = e?.smallCycleRadius ?? F.smallCycleRadius, this.detourDirection = e?.detourDirection ?? F.detourDirection, this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
1666
+ color: e?.color ?? F.color,
1667
+ width: e?.width ?? F.width,
1668
+ arrowRenderer: L(e?.arrowRenderer ?? {}),
1550
1669
  arrowLength: this.arrowLength,
1551
1670
  hasSourceArrow: this.hasSourceArrow,
1552
1671
  hasTargetArrow: this.hasTargetArrow,
@@ -1554,12 +1673,13 @@ var ne = (e, t) => {
1554
1673
  createDetourPath: this.createDetourPath,
1555
1674
  createLinePath: this.createLinePath,
1556
1675
  padding: 50
1557
- }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1676
+ }), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1558
1677
  }
1559
1678
  render(e) {
1560
1679
  this.pathShape.render(e);
1561
1680
  }
1562
- }, De = (e) => Math.cos(e) > 0 ? 0 : Math.PI, Oe = class {
1681
+ }, Me = (e) => Math.cos(e) > 0 ? 0 : Math.PI, Ne = class {
1682
+ element;
1563
1683
  svg;
1564
1684
  group;
1565
1685
  line;
@@ -1574,7 +1694,7 @@ var ne = (e, t) => {
1574
1694
  hasSourceArrow;
1575
1695
  hasTargetArrow;
1576
1696
  pathShape;
1577
- createCyclePath = (e, t, n) => new ge({
1697
+ createCyclePath = (e, t, n) => new P({
1578
1698
  origin: e,
1579
1699
  dir: n,
1580
1700
  arrowLength: this.arrowLength,
@@ -1583,7 +1703,7 @@ var ne = (e, t) => {
1583
1703
  roundness: this.roundness,
1584
1704
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1585
1705
  });
1586
- createDetourPath = (e, t, n, r) => new ye({
1706
+ createDetourPath = (e, t, n, r) => new Ce({
1587
1707
  from: e,
1588
1708
  to: t,
1589
1709
  fromDir: n,
@@ -1595,7 +1715,7 @@ var ne = (e, t) => {
1595
1715
  hasSourceArrow: this.hasSourceArrow,
1596
1716
  hasTargetArrow: this.hasTargetArrow
1597
1717
  });
1598
- createLinePath = (e, t, n, r) => new de({
1718
+ createLinePath = (e, t, n, r) => new ge({
1599
1719
  from: e,
1600
1720
  to: t,
1601
1721
  fromDir: n,
@@ -1607,12 +1727,12 @@ var ne = (e, t) => {
1607
1727
  hasTargetArrow: this.hasTargetArrow
1608
1728
  });
1609
1729
  constructor(e) {
1610
- this.arrowLength = e?.arrowLength ?? N.arrowLength, this.arrowOffset = e?.arrowOffset ?? N.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? N.cycleSquareSide;
1611
- let t = e?.roundness ?? N.roundness;
1612
- this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? N.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? N.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? N.hasTargetArrow, this.pathShape = new P({
1613
- color: e?.color ?? N.color,
1614
- width: e?.width ?? N.width,
1615
- arrowRenderer: F(e?.arrowRenderer ?? {}),
1730
+ this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowOffset = e?.arrowOffset ?? F.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? F.cycleSquareSide;
1731
+ let t = e?.roundness ?? F.roundness;
1732
+ this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
1733
+ color: e?.color ?? F.color,
1734
+ width: e?.width ?? F.width,
1735
+ arrowRenderer: L(e?.arrowRenderer ?? {}),
1616
1736
  arrowLength: this.arrowLength,
1617
1737
  hasSourceArrow: this.hasSourceArrow,
1618
1738
  hasTargetArrow: this.hasTargetArrow,
@@ -1620,7 +1740,7 @@ var ne = (e, t) => {
1620
1740
  createDetourPath: this.createDetourPath,
1621
1741
  createLinePath: this.createLinePath,
1622
1742
  padding: 50
1623
- }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1743
+ }), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1624
1744
  }
1625
1745
  render(e) {
1626
1746
  let { from: t, to: n, category: r } = e;
@@ -1628,15 +1748,16 @@ var ne = (e, t) => {
1628
1748
  category: r,
1629
1749
  from: {
1630
1750
  ...t,
1631
- direction: De(t.direction)
1751
+ direction: Me(t.direction)
1632
1752
  },
1633
1753
  to: {
1634
1754
  ...n,
1635
- direction: De(n.direction)
1755
+ direction: Me(n.direction)
1636
1756
  }
1637
1757
  });
1638
1758
  }
1639
- }, ke = class {
1759
+ }, Pe = class {
1760
+ element;
1640
1761
  svg;
1641
1762
  group;
1642
1763
  line;
@@ -1652,7 +1773,7 @@ var ne = (e, t) => {
1652
1773
  hasSourceArrow;
1653
1774
  hasTargetArrow;
1654
1775
  pathShape;
1655
- createCyclePath = (e, t, n) => new ge({
1776
+ createCyclePath = (e, t, n) => new P({
1656
1777
  origin: e,
1657
1778
  dir: n,
1658
1779
  arrowLength: this.arrowLength,
@@ -1661,7 +1782,7 @@ var ne = (e, t) => {
1661
1782
  roundness: this.roundness,
1662
1783
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1663
1784
  });
1664
- createDetourPath = (e, t, n, r) => new fe({
1785
+ createDetourPath = (e, t, n, r) => new _e({
1665
1786
  from: e,
1666
1787
  to: t,
1667
1788
  fromDir: n,
@@ -1674,7 +1795,7 @@ var ne = (e, t) => {
1674
1795
  hasSourceArrow: this.hasSourceArrow,
1675
1796
  hasTargetArrow: this.hasTargetArrow
1676
1797
  });
1677
- createLinePath = (e, t, n, r) => new pe({
1798
+ createLinePath = (e, t, n, r) => new ve({
1678
1799
  from: e,
1679
1800
  to: t,
1680
1801
  fromDir: n,
@@ -1686,12 +1807,12 @@ var ne = (e, t) => {
1686
1807
  hasTargetArrow: this.hasTargetArrow
1687
1808
  });
1688
1809
  constructor(e) {
1689
- this.arrowLength = e?.arrowLength ?? N.arrowLength, this.arrowOffset = e?.arrowOffset ?? N.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? N.cycleSquareSide;
1690
- let t = e?.roundness ?? N.roundness;
1691
- this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDirection = e?.detourDirection ?? N.detourDirection, this.detourDistance = e?.detourDistance ?? N.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? N.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? N.hasTargetArrow, this.pathShape = new P({
1692
- color: e?.color ?? N.color,
1693
- width: e?.width ?? N.width,
1694
- arrowRenderer: F(e?.arrowRenderer ?? {}),
1810
+ this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowOffset = e?.arrowOffset ?? F.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? F.cycleSquareSide;
1811
+ let t = e?.roundness ?? F.roundness;
1812
+ this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDirection = e?.detourDirection ?? F.detourDirection, this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
1813
+ color: e?.color ?? F.color,
1814
+ width: e?.width ?? F.width,
1815
+ arrowRenderer: L(e?.arrowRenderer ?? {}),
1695
1816
  arrowLength: this.arrowLength,
1696
1817
  hasSourceArrow: this.hasSourceArrow,
1697
1818
  hasTargetArrow: this.hasTargetArrow,
@@ -1699,12 +1820,13 @@ var ne = (e, t) => {
1699
1820
  createDetourPath: this.createDetourPath,
1700
1821
  createLinePath: this.createLinePath,
1701
1822
  padding: 50
1702
- }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1823
+ }), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1703
1824
  }
1704
1825
  render(e) {
1705
1826
  this.pathShape.render(e);
1706
1827
  }
1707
- }, Ae = Math.PI / 2, je = (e) => Math.sin(e) > 0 ? Ae : -Ae, Me = class {
1828
+ }, Fe = Math.PI / 2, Ie = (e) => Math.sin(e) > 0 ? Fe : -Fe, Le = class {
1829
+ element;
1708
1830
  svg;
1709
1831
  group;
1710
1832
  line;
@@ -1719,7 +1841,7 @@ var ne = (e, t) => {
1719
1841
  hasSourceArrow;
1720
1842
  hasTargetArrow;
1721
1843
  pathShape;
1722
- createCyclePath = (e, t, n) => new ge({
1844
+ createCyclePath = (e, t, n) => new P({
1723
1845
  origin: e,
1724
1846
  dir: n,
1725
1847
  arrowLength: this.arrowLength,
@@ -1728,7 +1850,7 @@ var ne = (e, t) => {
1728
1850
  roundness: this.roundness,
1729
1851
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1730
1852
  });
1731
- createDetourPath = (e, t, n, r) => new xe({
1853
+ createDetourPath = (e, t, n, r) => new Te({
1732
1854
  from: e,
1733
1855
  to: t,
1734
1856
  fromDir: n,
@@ -1740,7 +1862,7 @@ var ne = (e, t) => {
1740
1862
  hasSourceArrow: this.hasSourceArrow,
1741
1863
  hasTargetArrow: this.hasTargetArrow
1742
1864
  });
1743
- createLinePath = (e, t, n, r) => new he({
1865
+ createLinePath = (e, t, n, r) => new ye({
1744
1866
  from: e,
1745
1867
  to: t,
1746
1868
  fromDir: n,
@@ -1752,12 +1874,12 @@ var ne = (e, t) => {
1752
1874
  hasTargetArrow: this.hasTargetArrow
1753
1875
  });
1754
1876
  constructor(e) {
1755
- this.arrowLength = e?.arrowLength ?? N.arrowLength, this.arrowOffset = e?.arrowOffset ?? N.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? N.cycleSquareSide;
1756
- let t = e?.roundness ?? N.roundness;
1757
- this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? N.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? N.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? N.hasTargetArrow, this.pathShape = new P({
1758
- color: e?.color ?? N.color,
1759
- width: e?.width ?? N.width,
1760
- arrowRenderer: F(e?.arrowRenderer ?? {}),
1877
+ this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowOffset = e?.arrowOffset ?? F.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? F.cycleSquareSide;
1878
+ let t = e?.roundness ?? F.roundness;
1879
+ this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
1880
+ color: e?.color ?? F.color,
1881
+ width: e?.width ?? F.width,
1882
+ arrowRenderer: L(e?.arrowRenderer ?? {}),
1761
1883
  arrowLength: this.arrowLength,
1762
1884
  hasSourceArrow: this.hasSourceArrow,
1763
1885
  hasTargetArrow: this.hasTargetArrow,
@@ -1765,7 +1887,7 @@ var ne = (e, t) => {
1765
1887
  createDetourPath: this.createDetourPath,
1766
1888
  createLinePath: this.createLinePath,
1767
1889
  padding: 50
1768
- }), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1890
+ }), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1769
1891
  }
1770
1892
  render(e) {
1771
1893
  let { from: t, to: n, category: r } = e;
@@ -1773,18 +1895,100 @@ var ne = (e, t) => {
1773
1895
  category: r,
1774
1896
  from: {
1775
1897
  ...t,
1776
- direction: je(t.direction)
1898
+ direction: Ie(t.direction)
1777
1899
  },
1778
1900
  to: {
1779
1901
  ...n,
1780
- direction: je(n.direction)
1902
+ direction: Ie(n.direction)
1781
1903
  }
1782
1904
  });
1783
1905
  }
1784
- }, Ne = (e) => {
1906
+ }, Re = (e) => {
1907
+ let t = e + Math.PI / 4, n = Math.cos(t), r = Math.sin(t);
1908
+ return n > 0 ? r > 0 ? 0 : -Math.PI / 2 : r > 0 ? Math.PI / 2 : Math.PI;
1909
+ }, ze = class {
1910
+ element;
1911
+ svg;
1912
+ group;
1913
+ line;
1914
+ sourceArrow;
1915
+ targetArrow;
1916
+ onAfterRender;
1917
+ arrowLength;
1918
+ arrowOffset;
1919
+ roundness;
1920
+ cycleSquareSide;
1921
+ detourDistance;
1922
+ hasSourceArrow;
1923
+ hasTargetArrow;
1924
+ pathShape;
1925
+ createCyclePath = (e, t, n) => new P({
1926
+ origin: e,
1927
+ dir: n,
1928
+ arrowLength: this.arrowLength,
1929
+ side: this.cycleSquareSide,
1930
+ arrowOffset: this.arrowOffset,
1931
+ roundness: this.roundness,
1932
+ hasArrow: this.hasSourceArrow || this.hasTargetArrow
1933
+ });
1934
+ createDetourPath = (e, t, n, r) => new Ee({
1935
+ from: e,
1936
+ to: t,
1937
+ fromDir: n,
1938
+ toDir: r,
1939
+ arrowLength: this.arrowLength,
1940
+ arrowOffset: this.arrowOffset,
1941
+ roundness: this.roundness,
1942
+ detourDistance: this.detourDistance,
1943
+ hasSourceArrow: this.hasSourceArrow,
1944
+ hasTargetArrow: this.hasTargetArrow
1945
+ });
1946
+ createLinePath = (e, t, n, r) => new be({
1947
+ from: e,
1948
+ to: t,
1949
+ fromDir: n,
1950
+ toDir: r,
1951
+ arrowLength: this.arrowLength,
1952
+ arrowOffset: this.arrowOffset,
1953
+ roundness: this.roundness,
1954
+ hasSourceArrow: this.hasSourceArrow,
1955
+ hasTargetArrow: this.hasTargetArrow
1956
+ });
1957
+ constructor(e) {
1958
+ this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowOffset = e?.arrowOffset ?? F.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? F.cycleSquareSide;
1959
+ let t = e?.roundness ?? F.roundness;
1960
+ this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
1961
+ color: e?.color ?? F.color,
1962
+ width: e?.width ?? F.width,
1963
+ arrowRenderer: L(e?.arrowRenderer ?? {}),
1964
+ arrowLength: this.arrowLength,
1965
+ hasSourceArrow: this.hasSourceArrow,
1966
+ hasTargetArrow: this.hasTargetArrow,
1967
+ createCyclePath: this.createCyclePath,
1968
+ createDetourPath: this.createDetourPath,
1969
+ createLinePath: this.createLinePath,
1970
+ padding: 50
1971
+ }), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1972
+ }
1973
+ render(e) {
1974
+ let { from: t, to: n, category: r } = e;
1975
+ this.pathShape.render({
1976
+ category: r,
1977
+ from: {
1978
+ ...t,
1979
+ direction: Re(t.direction)
1980
+ },
1981
+ to: {
1982
+ ...n,
1983
+ direction: Re(n.direction)
1984
+ }
1985
+ });
1986
+ }
1987
+ }, Be = (e) => {
1785
1988
  let { direction: t, radius: n } = e, { x: r, y: i } = t, { horizontal: a, vertical: o } = n, s = i / r, c = Math.abs(o / s), l = Math.abs(a * s), u = Math.min(a, c), d = Math.min(o, l);
1786
1989
  return Math.sqrt(u * u + d * d);
1787
- }, Pe = (e) => typeof e == "number" ? () => e : e === "box" ? Ne : e, Fe = N.portOffset, I = class {
1990
+ }, Ve = (e) => typeof e == "number" ? () => e : e === "box" ? Be : e, He = F.portOffset, R = class {
1991
+ element;
1788
1992
  svg;
1789
1993
  group = document.createElementNS("http://www.w3.org/2000/svg", "g");
1790
1994
  line;
@@ -1799,11 +2003,11 @@ var ne = (e, t) => {
1799
2003
  afterRenderEmitter;
1800
2004
  arrowRenderer;
1801
2005
  constructor(e) {
1802
- [this.afterRenderEmitter, this.onAfterRender] = u(), this.color = e?.color ?? N.color, this.width = e?.width ?? N.width, this.arrowLength = e?.arrowLength ?? N.arrowLength, this.arrowRenderer = F(e?.arrowRenderer ?? {}), this.sourceOffsetFn = Pe(e?.sourceOffset ?? Fe), this.targetOffsetFn = Pe(e?.targetOffset ?? Fe), this.svg = se(this.color), this.svg.appendChild(this.group), this.line = ce(this.width), this.group.appendChild(this.line), e?.hasSourceArrow && (this.sourceArrow = j(), this.group.appendChild(this.sourceArrow)), e?.hasTargetArrow && (this.targetArrow = j(), this.group.appendChild(this.targetArrow));
2006
+ [this.afterRenderEmitter, this.onAfterRender] = u(), this.color = e?.color ?? F.color, this.width = e?.width ?? F.width, this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowRenderer = L(e?.arrowRenderer ?? {}), this.sourceOffsetFn = Ve(e?.sourceOffset ?? He), this.targetOffsetFn = Ve(e?.targetOffset ?? He), this.element = ce(this.color), this.svg = this.element, this.element.appendChild(this.group), this.line = le(this.width), this.group.appendChild(this.line), e?.hasSourceArrow && (this.sourceArrow = A(), this.group.appendChild(this.sourceArrow)), e?.hasTargetArrow && (this.targetArrow = A(), this.group.appendChild(this.targetArrow));
1803
2007
  }
1804
2008
  render(e) {
1805
- let { x: t, y: n, width: r, height: i, from: a, to: o } = ie(e.from, e.to, 50);
1806
- le(this.svg, {
2009
+ let { x: t, y: n, width: r, height: i, from: a, to: o } = ae(e.from, e.to, 50);
2010
+ ue(this.element, {
1807
2011
  x: t,
1808
2012
  y: n,
1809
2013
  width: r,
@@ -1901,43 +2105,44 @@ var ne = (e, t) => {
1901
2105
  targetArrowPath: n
1902
2106
  });
1903
2107
  }
1904
- }, Ie = () => {
2108
+ }, Ue = () => {
1905
2109
  let e = document.createElementNS("http://www.w3.org/2000/svg", "g");
1906
2110
  return e.style.pointerEvents = "auto", e.style.cursor = "pointer", e;
1907
- }, Le = (e) => {
2111
+ }, We = (e) => {
1908
2112
  let t = document.createElementNS("http://www.w3.org/2000/svg", "path");
1909
2113
  return t.setAttribute("stroke", "transparent"), t.setAttribute("stroke-width", `${e}`), t.setAttribute("fill", "none"), t.setAttribute("stroke-linecap", "round"), t;
1910
- }, Re = (e) => {
2114
+ }, Ge = (e) => {
1911
2115
  let t = document.createElementNS("http://www.w3.org/2000/svg", "path");
1912
2116
  return t.setAttribute("stroke-linejoin", "round"), t.setAttribute("stroke-width", `${e}`), t.setAttribute("fill", "transparent"), t.setAttribute("stroke", "transparent"), t;
1913
- }, ze = class extends Error {
2117
+ }, Ke = class extends Error {
1914
2118
  constructor(e) {
1915
2119
  super(e), this.name = "InteractiveEdgeError";
1916
2120
  }
1917
- }, Be = class e {
2121
+ }, qe = class e {
1918
2122
  baseEdge;
2123
+ element;
1919
2124
  svg;
1920
2125
  group;
1921
2126
  line;
1922
2127
  sourceArrow;
1923
2128
  targetArrow;
1924
- handle = Ie();
2129
+ handle = Ue();
1925
2130
  onAfterRender;
1926
2131
  interactiveLine;
1927
2132
  interactiveSourceArrow = null;
1928
2133
  interactiveTargetArrow = null;
1929
2134
  constructor(t, n) {
1930
- if (this.baseEdge = t, t instanceof e) throw new ze("interactive edge can be configured only once");
1931
- this.svg = this.baseEdge.svg, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
1932
- let r = n?.distance ?? N.interactiveWidth;
1933
- this.interactiveLine = Le(r), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Re(r), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Re(r), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((e) => {
2135
+ if (this.baseEdge = t, t instanceof e) throw new Ke("interactive edge can be configured only once");
2136
+ this.element = this.baseEdge.element, this.svg = this.element, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
2137
+ let r = n?.distance ?? F.interactiveWidth;
2138
+ this.interactiveLine = We(r), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Ge(r), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Ge(r), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((e) => {
1934
2139
  this.interactiveLine.setAttribute("d", e.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", e.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", e.targetArrowPath);
1935
2140
  });
1936
2141
  }
1937
2142
  render(e) {
1938
2143
  this.baseEdge.render(e);
1939
2144
  }
1940
- }, Ve = class {
2145
+ }, Je = class {
1941
2146
  baseShape;
1942
2147
  midpointElement;
1943
2148
  group;
@@ -1945,9 +2150,10 @@ var ne = (e, t) => {
1945
2150
  sourceArrow;
1946
2151
  targetArrow;
1947
2152
  onAfterRender;
2153
+ element;
1948
2154
  svg;
1949
2155
  constructor(e, t) {
1950
- 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((e) => {
2156
+ this.baseShape = e, this.midpointElement = t, this.element = this.baseShape.element, this.svg = this.element, 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.element.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((e) => {
1951
2157
  let t = e.edgePath.midpoint, n = `translate(${t.x}px, ${t.y}px)`;
1952
2158
  this.midpointElement.style.setProperty("transform", n);
1953
2159
  });
@@ -1955,7 +2161,7 @@ var ne = (e, t) => {
1955
2161
  render(e) {
1956
2162
  this.baseShape.render(e);
1957
2163
  }
1958
- }, He = class {
2164
+ }, Ye = class {
1959
2165
  graphStore;
1960
2166
  onAfterNodeAdded;
1961
2167
  onAfterNodeUpdated;
@@ -2054,7 +2260,7 @@ var ne = (e, t) => {
2054
2260
  getNodeAdjacentEdgeIds(e) {
2055
2261
  return this.graphStore.getNodeAdjacentEdgeIds(e);
2056
2262
  }
2057
- }, L = class {
2263
+ }, z = class {
2058
2264
  checkExists;
2059
2265
  counter = 0;
2060
2266
  constructor(e) {
@@ -2068,13 +2274,13 @@ var ne = (e, t) => {
2068
2274
  reset() {
2069
2275
  this.counter = 0;
2070
2276
  }
2071
- }, Ue = class {
2277
+ }, Xe = class {
2072
2278
  graphStore;
2073
2279
  htmlView;
2074
2280
  params;
2075
- nodeIdGenerator = new L((e) => this.graphStore.hasNode(e));
2076
- portIdGenerator = new L((e) => this.graphStore.hasPort(e));
2077
- edgeIdGenerator = new L((e) => this.graphStore.hasEdge(e));
2281
+ nodeIdGenerator = new z((e) => this.graphStore.hasNode(e));
2282
+ portIdGenerator = new z((e) => this.graphStore.hasPort(e));
2283
+ edgeIdGenerator = new z((e) => this.graphStore.hasEdge(e));
2078
2284
  onAfterNodeAdded = (e) => {
2079
2285
  this.htmlView.attachNode(e);
2080
2286
  };
@@ -2181,17 +2387,17 @@ var ne = (e, t) => {
2181
2387
  destroy() {
2182
2388
  this.graphStore.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.unsubscribe(this.onAfterNodePriorityUpdated), this.graphStore.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.unsubscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.unsubscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.unsubscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.unsubscribe(this.onAfterEdgeShapeUpdated), this.graphStore.onAfterEdgeUpdated.unsubscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.unsubscribe(this.onAfterEdgePriorityUpdated), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
2183
2389
  }
2184
- }, We = (e) => {
2390
+ }, Ze = (e) => {
2185
2391
  setTimeout(() => {
2186
2392
  e();
2187
2393
  });
2188
- }, Ge = (e) => {
2394
+ }, Qe = (e) => {
2189
2395
  queueMicrotask(() => {
2190
2396
  e();
2191
2397
  });
2192
- }, R = (e) => {
2398
+ }, B = (e) => {
2193
2399
  e();
2194
- }, Ke = class {
2400
+ }, $e = class {
2195
2401
  viewportStore;
2196
2402
  onBeforeUpdated;
2197
2403
  onAfterUpdated;
@@ -2214,7 +2420,7 @@ var ne = (e, t) => {
2214
2420
  createViewportCoords(e) {
2215
2421
  return this.viewportStore.createViewportCoords(e);
2216
2422
  }
2217
- }, qe = (e, t) => Symbol.iterator in e ? {
2423
+ }, et = (e, t) => Symbol.iterator in e ? {
2218
2424
  minContentScale: t.focus.minContentScale,
2219
2425
  nodes: e,
2220
2426
  contentPadding: t.focus.contentPadding,
@@ -2224,15 +2430,15 @@ var ne = (e, t) => {
2224
2430
  nodes: e.nodes ?? [],
2225
2431
  contentPadding: e.contentPadding ?? e.contentOffset ?? t.focus.contentPadding,
2226
2432
  animationDuration: e.animationDuration ?? t.focus.animationDuration
2227
- }, Je = (e, t, n) => ({
2433
+ }, tt = (e, t, n) => ({
2228
2434
  scale: e.scale,
2229
2435
  x: e.x + e.scale * t,
2230
2436
  y: e.y + e.scale * n
2231
- }), Ye = (e, t, n, r) => ({
2437
+ }), nt = (e, t, n, r) => ({
2232
2438
  scale: e.scale * t,
2233
2439
  x: e.scale * (1 - t) * n + e.x,
2234
2440
  y: e.scale * (1 - t) * r + e.y
2235
- }), Xe = class {
2441
+ }), rt = class {
2236
2442
  graphStore;
2237
2443
  viewportStore;
2238
2444
  params;
@@ -2250,16 +2456,16 @@ var ne = (e, t) => {
2250
2456
  let { width: n, height: r } = this.viewportStore.getDimensions(), i = {
2251
2457
  x: n / 2,
2252
2458
  y: r / 2
2253
- }, a = this.viewportStore.getViewportMatrix(), o = this.viewportStore.createViewportCoords(e), s = Je(a, o.x - i.x, o.y - i.y), c = t?.contentScale;
2459
+ }, a = this.viewportStore.getViewportMatrix(), o = this.viewportStore.createViewportCoords(e), s = tt(a, o.x - i.x, o.y - i.y), c = t?.contentScale;
2254
2460
  if (c !== void 0) {
2255
2461
  let e = 1 / c;
2256
- s = Ye(s, e / a.scale, i.x, i.y);
2462
+ s = nt(s, e / a.scale, i.x, i.y);
2257
2463
  }
2258
2464
  let l = t?.animationDuration ?? 0;
2259
2465
  l > 0 ? this.animateNavigation(a, s, l) : this.viewportStore.patchViewportMatrix(s);
2260
2466
  }
2261
2467
  focus(e) {
2262
- let t = qe(e ?? {}, this.params);
2468
+ let t = et(e ?? {}, this.params);
2263
2469
  this.params.focus.schedule(() => {
2264
2470
  this.navigate(t);
2265
2471
  });
@@ -2301,25 +2507,25 @@ var ne = (e, t) => {
2301
2507
  };
2302
2508
  this.win.requestAnimationFrame(a);
2303
2509
  }
2304
- }, Ze = (e, t, n) => {
2510
+ }, it = (e, t, n) => {
2305
2511
  let r = new h();
2306
- return new d(new He(r), new Ke(t), new Ue(r, new a(r, t, e), {
2512
+ return new d(new Ye(r), new $e(t), new Xe(r, new a(r, t, e), {
2307
2513
  nodes: {
2308
- centerFn: re,
2514
+ centerFn: ie,
2309
2515
  priorityFn: () => 0
2310
2516
  },
2311
2517
  edges: {
2312
- shapeFactory: () => new I(),
2518
+ shapeFactory: () => new R(),
2313
2519
  priorityFn: () => 0
2314
2520
  },
2315
2521
  ports: { direction: 0 }
2316
- }), new Xe(r, t, { focus: {
2522
+ }), new rt(r, t, { focus: {
2317
2523
  contentPadding: 0,
2318
2524
  minContentScale: 0,
2319
- schedule: R,
2525
+ schedule: B,
2320
2526
  animationDuration: 0
2321
2527
  } }, n));
2322
- }, z = Symbol(), Qe = class e {
2528
+ }, V = Symbol(), at = class e {
2323
2529
  canvas;
2324
2530
  window;
2325
2531
  pointInsideVerifier;
@@ -2340,7 +2546,7 @@ var ne = (e, t) => {
2340
2546
  this.params.onPointerDownVerifier(r, {
2341
2547
  x: t.clientX,
2342
2548
  y: t.clientY
2343
- }) && (this.eventTagger.tag(e, z), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }));
2549
+ }) && (this.eventTagger.tag(e, V), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }));
2344
2550
  };
2345
2551
  onWindowMouseMove = (e) => {
2346
2552
  if (!this.pointInsideVerifier.verify(e.clientX, e.clientY)) {
@@ -2365,7 +2571,7 @@ var ne = (e, t) => {
2365
2571
  this.params.onPointerDownVerifier(i, {
2366
2572
  x: n.clientX,
2367
2573
  y: n.clientY
2368
- }) && (this.eventTagger.tag(e, z), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }));
2574
+ }) && (this.eventTagger.tag(e, V), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }));
2369
2575
  };
2370
2576
  onWindowTouchMove = (e) => {
2371
2577
  let t = e.touches[0];
@@ -2413,16 +2619,16 @@ var ne = (e, t) => {
2413
2619
  removeWindowTouchListeners() {
2414
2620
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2415
2621
  }
2416
- }, B = Symbol(), $e = class {
2622
+ }, H = Symbol(), ot = class {
2417
2623
  has(e, t) {
2418
- let n = e[B];
2624
+ let n = e[H];
2419
2625
  return n !== void 0 && n.has(t);
2420
2626
  }
2421
2627
  tag(e, t) {
2422
- let n = e, r = n[B];
2423
- r === void 0 ? n[B] = /* @__PURE__ */ new Set([t]) : r.add(t);
2628
+ let n = e, r = n[H];
2629
+ r === void 0 ? n[H] = /* @__PURE__ */ new Set([t]) : r.add(t);
2424
2630
  }
2425
- }, V = Symbol(), H = class {
2631
+ }, U = Symbol(), W = class {
2426
2632
  window;
2427
2633
  pointInsideVerifier;
2428
2634
  onSelected;
@@ -2503,10 +2709,10 @@ var ne = (e, t) => {
2503
2709
  let r = Math.sqrt(e * e + t * t);
2504
2710
  this.movedDistance += r, this.movedDistance > this.movementThreshold && n();
2505
2711
  }
2506
- }, U = (e, t) => ({
2712
+ }, st = (e, t) => ({
2507
2713
  from: e.isDirect ? e.staticPortId : t,
2508
2714
  to: e.isDirect ? t : e.staticPortId
2509
- }), et = class {
2715
+ }), ct = class {
2510
2716
  graph;
2511
2717
  connectionAllowedVerifier;
2512
2718
  constructor(e, t) {
@@ -2517,7 +2723,7 @@ var ne = (e, t) => {
2517
2723
  return this.graph.getAllPortIds().forEach((i) => {
2518
2724
  let { element: a, direction: o, nodeId: s } = this.graph.getPort(i), { x: c, y: l } = this.graph.getNode(s);
2519
2725
  if (c === null || l === null) return;
2520
- let u = U(e, i);
2726
+ let u = st(e, i);
2521
2727
  if (!this.connectionAllowedVerifier(u)) return;
2522
2728
  let { top: d, left: f, width: p, height: m } = a.getBoundingClientRect(), h = {
2523
2729
  x: f + p / 2,
@@ -2526,7 +2732,7 @@ var ne = (e, t) => {
2526
2732
  v < n && (n = v, t = o);
2527
2733
  }), t;
2528
2734
  }
2529
- }, tt = class {
2735
+ }, lt = class {
2530
2736
  direction;
2531
2737
  constructor(e) {
2532
2738
  this.direction = e;
@@ -2534,7 +2740,7 @@ var ne = (e, t) => {
2534
2740
  resolve() {
2535
2741
  return this.direction;
2536
2742
  }
2537
- }, nt = class e {
2743
+ }, ut = class e {
2538
2744
  canvas;
2539
2745
  element;
2540
2746
  window;
@@ -2557,12 +2763,12 @@ var ne = (e, t) => {
2557
2763
  t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
2558
2764
  };
2559
2765
  onMouseDown = (e) => {
2560
- if (this.eventTagger.has(e, z)) return;
2766
+ if (this.eventTagger.has(e, V)) return;
2561
2767
  let t = e;
2562
2768
  if (!this.params.mouseDownEventVerifier(t)) return;
2563
2769
  let n = e.currentTarget, r = this.graph.findNodeIdByElement(n), i = this.graph.getNode(r);
2564
2770
  if (!this.params.nodeDragVerifier(r)) return;
2565
- this.eventTagger.tag(e, z), this.params.onNodeDragStarted(r);
2771
+ this.eventTagger.tag(e, V), this.params.onNodeDragStarted(r);
2566
2772
  let a = this.calculateContentPoint({
2567
2773
  x: t.clientX,
2568
2774
  y: t.clientY
@@ -2571,10 +2777,10 @@ var ne = (e, t) => {
2571
2777
  nodeId: r,
2572
2778
  dx: a.x - i.x,
2573
2779
  dy: a.y - i.y
2574
- }, w(this.element, this.params.dragCursor), this.moveNodeOnTop(r), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 });
2780
+ }, C(this.element, this.params.dragCursor), this.moveNodeOnTop(r), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 });
2575
2781
  };
2576
2782
  onTouchStart = (e) => {
2577
- if (this.eventTagger.has(e, z)) return;
2783
+ if (this.eventTagger.has(e, V)) return;
2578
2784
  let t = e;
2579
2785
  if (t.touches.length !== 1) return;
2580
2786
  let n = t.touches[0], r = e.currentTarget, i = this.canvas.graph.findNodeIdByElement(r), a = this.graph.getNode(i);
@@ -2584,7 +2790,7 @@ var ne = (e, t) => {
2584
2790
  x: a.x,
2585
2791
  y: a.y
2586
2792
  })) return;
2587
- this.eventTagger.tag(e, z);
2793
+ this.eventTagger.tag(e, V);
2588
2794
  let o = this.calculateContentPoint({
2589
2795
  x: n.clientX,
2590
2796
  y: n.clientY
@@ -2661,7 +2867,7 @@ var ne = (e, t) => {
2661
2867
  }
2662
2868
  }
2663
2869
  stopMouseDrag() {
2664
- this.finishDrag(), w(this.element, null), this.removeMouseDragListeners();
2870
+ this.finishDrag(), C(this.element, null), this.removeMouseDragListeners();
2665
2871
  }
2666
2872
  removeMouseDragListeners() {
2667
2873
  this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
@@ -2698,7 +2904,7 @@ var ne = (e, t) => {
2698
2904
  let e = this.grabbedNodeState.nodeId;
2699
2905
  this.graph.hasNode(e) && this.params.onNodeDragFinished(e), this.grabbedNodeState = null;
2700
2906
  }
2701
- }, W = (e) => {
2907
+ }, G = (e) => {
2702
2908
  let t = [], n = e.touches.length;
2703
2909
  for (let r = 0; r < n; r++) t.push([e.touches[r].clientX, e.touches[r].clientY]);
2704
2910
  let r = t.reduce((e, t) => [e[0] + t[0], e[1] + t[1]], [0, 0]), i = [r[0] / n, r[1] / n], a = t.map((e) => [e[0] - i[0], e[1] - i[1]]).reduce((e, t) => e + Math.sqrt(t[0] * t[0] + t[1] * t[1]), 0);
@@ -2709,7 +2915,7 @@ var ne = (e, t) => {
2709
2915
  touchesCnt: n,
2710
2916
  touches: t
2711
2917
  };
2712
- }, rt = class e {
2918
+ }, dt = class e {
2713
2919
  canvas;
2714
2920
  element;
2715
2921
  window;
@@ -2724,7 +2930,7 @@ var ne = (e, t) => {
2724
2930
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2725
2931
  };
2726
2932
  onMouseDown = (e) => {
2727
- this.eventTagger.has(e, z) || this.params.mouseDownEventVerifier(e) && (w(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }), this.startRegisteredTransform());
2933
+ this.eventTagger.has(e, V) || this.params.mouseDownEventVerifier(e) && (C(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }), this.startRegisteredTransform());
2728
2934
  };
2729
2935
  onWindowMouseMove = (e) => {
2730
2936
  let t = this.pointInsideVerifier.verify(e.clientX, e.clientY);
@@ -2746,16 +2952,16 @@ var ne = (e, t) => {
2746
2952
  }, this.params.scaleWheelFinishTimeout);
2747
2953
  };
2748
2954
  onTouchStart = (e) => {
2749
- if (!this.eventTagger.has(e, z)) {
2955
+ if (!this.eventTagger.has(e, V)) {
2750
2956
  if (this.prevTouches !== null) {
2751
- this.prevTouches = W(e);
2957
+ this.prevTouches = G(e);
2752
2958
  return;
2753
2959
  }
2754
- this.prevTouches = W(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }), this.startRegisteredTransform();
2960
+ this.prevTouches = G(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }), this.startRegisteredTransform();
2755
2961
  }
2756
2962
  };
2757
2963
  onWindowTouchMove = (e) => {
2758
- let t = W(e);
2964
+ let t = G(e);
2759
2965
  if (!t.touches.every((e) => this.pointInsideVerifier.verify(e[0], e[1]))) {
2760
2966
  this.stopTouchDrag();
2761
2967
  return;
@@ -2771,7 +2977,7 @@ var ne = (e, t) => {
2771
2977
  this.prevTouches = t;
2772
2978
  };
2773
2979
  onWindowTouchFinish = (e) => {
2774
- e.touches.length > 0 ? this.prevTouches = W(e) : this.stopTouchDrag();
2980
+ e.touches.length > 0 ? this.prevTouches = G(e) : this.stopTouchDrag();
2775
2981
  };
2776
2982
  preventWheelScaleListener = (e) => {
2777
2983
  e.preventDefault();
@@ -2785,7 +2991,7 @@ var ne = (e, t) => {
2785
2991
  new e(t, n, r, i, a, o);
2786
2992
  }
2787
2993
  moveViewport(e, t) {
2788
- let n = this.viewport.getViewportMatrix(), r = Je(n, e, t), { width: i, height: a } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
2994
+ let n = this.viewport.getViewportMatrix(), r = tt(n, e, t), { width: i, height: a } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
2789
2995
  prevTransform: n,
2790
2996
  nextTransform: r,
2791
2997
  canvasWidth: i,
@@ -2794,7 +3000,7 @@ var ne = (e, t) => {
2794
3000
  this.performTransform(o);
2795
3001
  }
2796
3002
  scaleViewport(e, t, n) {
2797
- let r = this.canvas.viewport.getViewportMatrix(), i = Ye(r, e, t, n), { width: a, height: o } = this.viewport.getDimensions(), s = this.params.transformPreprocessor({
3003
+ let r = this.canvas.viewport.getViewportMatrix(), i = nt(r, e, t, n), { width: a, height: o } = this.viewport.getDimensions(), s = this.params.transformPreprocessor({
2798
3004
  prevTransform: r,
2799
3005
  nextTransform: i,
2800
3006
  canvasWidth: a,
@@ -2803,7 +3009,7 @@ var ne = (e, t) => {
2803
3009
  this.performTransform(s);
2804
3010
  }
2805
3011
  stopMouseDrag() {
2806
- w(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
3012
+ C(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
2807
3013
  }
2808
3014
  removeMouseDragListeners() {
2809
3015
  this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
@@ -2832,7 +3038,7 @@ var ne = (e, t) => {
2832
3038
  });
2833
3039
  this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(r), this.params.onResizeTransformFinished();
2834
3040
  }
2835
- }, it = class e {
3041
+ }, ft = class e {
2836
3042
  canvas;
2837
3043
  element;
2838
3044
  window;
@@ -2885,7 +3091,7 @@ var ne = (e, t) => {
2885
3091
  this.scheduleLoadAreaAroundViewport(), r.onTransformFinished();
2886
3092
  }
2887
3093
  };
2888
- rt.configure(e, this.element, this.window, this.pointInsideVerifier, o, c), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
3094
+ dt.configure(e, this.element, this.window, this.pointInsideVerifier, o, c), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2889
3095
  }
2890
3096
  static configure(t, n, r, i, a, o, s, c) {
2891
3097
  new e(t, n, r, i, a, o, s, c);
@@ -2910,21 +3116,21 @@ var ne = (e, t) => {
2910
3116
  height: u
2911
3117
  });
2912
3118
  }
2913
- }, at = () => {
3119
+ }, pt = () => {
2914
3120
  let e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
2915
3121
  return e.style.position = "absolute", e.style.inset = "0", e;
2916
- }, ot = () => {
3122
+ }, mt = () => {
2917
3123
  let e = document.createElementNS("http://www.w3.org/2000/svg", "rect");
2918
3124
  return e.setAttribute("fill", "url(#pattern)"), e;
2919
- }, st = () => {
3125
+ }, ht = () => {
2920
3126
  let e = document.createElementNS("http://www.w3.org/2000/svg", "pattern");
2921
3127
  return e.setAttribute("id", "pattern"), e;
2922
- }, ct = class e {
3128
+ }, gt = class e {
2923
3129
  canvas;
2924
3130
  backgroundHost;
2925
- svg = at();
2926
- patternRenderingRectangle = ot();
2927
- pattern = st();
3131
+ svg = pt();
3132
+ patternRenderingRectangle = mt();
3133
+ pattern = ht();
2928
3134
  patternContent;
2929
3135
  tileWidth;
2930
3136
  tileHeight;
@@ -2959,7 +3165,7 @@ var ne = (e, t) => {
2959
3165
  this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${r}`);
2960
3166
  }
2961
3167
  }
2962
- }, lt = class e {
3168
+ }, _t = class e {
2963
3169
  canvas;
2964
3170
  overlayLayer;
2965
3171
  viewportStore;
@@ -2973,7 +3179,7 @@ var ne = (e, t) => {
2973
3179
  this.params.onAfterEdgeCreated(e);
2974
3180
  };
2975
3181
  constructor(e, t, n, r, i, a, o) {
2976
- this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = Ze(this.overlayLayer, this.viewportStore, this.window);
3182
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = it(this.overlayLayer, this.viewportStore, this.window);
2977
3183
  let s = {
2978
3184
  mouseDownEventVerifier: this.params.mouseDownEventVerifier,
2979
3185
  mouseUpEventVerifier: this.params.mouseUpEventVerifier,
@@ -2992,7 +3198,7 @@ var ne = (e, t) => {
2992
3198
  this.resetDragState(), this.params.onEdgeCreationInterrupted(e);
2993
3199
  }
2994
3200
  };
2995
- Qe.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
3201
+ at.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
2996
3202
  }
2997
3203
  static configure(t, n, r, i, a, o, s) {
2998
3204
  new e(t, n, r, i, a, o, s);
@@ -3005,7 +3211,7 @@ var ne = (e, t) => {
3005
3211
  x: t.x - s.x,
3006
3212
  y: t.y - s.y
3007
3213
  }), u = {
3008
- overlayNodeId: E.StaticNodeId,
3214
+ overlayNodeId: T.StaticNodeId,
3009
3215
  portCoords: c,
3010
3216
  portDirection: r.direction
3011
3217
  }, d = n === "direct";
@@ -3017,26 +3223,26 @@ var ne = (e, t) => {
3017
3223
  cursor: t,
3018
3224
  ...this.edgeInProgress
3019
3225
  }), p = {
3020
- overlayNodeId: E.DraggingNodeId,
3226
+ overlayNodeId: T.DraggingNodeId,
3021
3227
  portCoords: l,
3022
3228
  portDirection: f ?? r.direction
3023
3229
  }, [m, h] = d ? [u, p] : [p, u];
3024
- this.overlayCanvas.addNode(T(m)), this.overlayCanvas.addNode(T(h)), this.overlayCanvas.addEdge({
3230
+ this.overlayCanvas.addNode(w(m)), this.overlayCanvas.addNode(w(h)), this.overlayCanvas.addEdge({
3025
3231
  from: m.overlayNodeId,
3026
3232
  to: h.overlayNodeId,
3027
- shape: this.params.edgeShapeFactory(E.EdgeId)
3233
+ shape: this.params.edgeShapeFactory(T.EdgeId)
3028
3234
  });
3029
3235
  }
3030
3236
  resetDragState() {
3031
3237
  this.edgeInProgress = null, this.overlayCanvas.clear();
3032
3238
  }
3033
3239
  tryCreateConnection(e) {
3034
- let t = ne(this.canvas.graph, e);
3240
+ let t = re(this.canvas.graph, e);
3035
3241
  if (t === null) {
3036
3242
  this.params.onEdgeCreationInterrupted(this.edgeInProgress);
3037
3243
  return;
3038
3244
  }
3039
- let n = U(this.edgeInProgress, t), r = this.params.connectionAllowedVerifier(n), i = this.params.connectionPreprocessor({
3245
+ let n = st(this.edgeInProgress, t), r = this.params.connectionAllowedVerifier(n), i = this.params.connectionPreprocessor({
3040
3246
  from: n.from,
3041
3247
  to: n.to
3042
3248
  });
@@ -3050,12 +3256,12 @@ var ne = (e, t) => {
3050
3256
  cursor: e,
3051
3257
  ...this.edgeInProgress
3052
3258
  });
3053
- this.overlayCanvas.updateNode(E.DraggingNodeId, {
3259
+ this.overlayCanvas.updateNode(T.DraggingNodeId, {
3054
3260
  x: n.x,
3055
3261
  y: n.y
3056
- }).updatePort(E.DraggingNodeId, { direction: r });
3262
+ }).updatePort(T.DraggingNodeId, { direction: r });
3057
3263
  }
3058
- }, ut = class e {
3264
+ }, vt = class e {
3059
3265
  canvas;
3060
3266
  overlayLayer;
3061
3267
  viewportStore;
@@ -3070,7 +3276,7 @@ var ne = (e, t) => {
3070
3276
  this.params.onAfterEdgeReattached(e);
3071
3277
  };
3072
3278
  constructor(e, t, n, r, i, a, o) {
3073
- this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = Ze(this.overlayLayer, this.viewportStore, this.window);
3279
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = it(this.overlayLayer, this.viewportStore, this.window);
3074
3280
  let s = {
3075
3281
  mouseDownEventVerifier: this.params.mouseDownEventVerifier,
3076
3282
  mouseUpEventVerifier: this.params.mouseUpEventVerifier,
@@ -3092,7 +3298,7 @@ var ne = (e, t) => {
3092
3298
  });
3093
3299
  }
3094
3300
  };
3095
- Qe.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
3301
+ at.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
3096
3302
  }
3097
3303
  static configure(t, n, r, i, a, o, s) {
3098
3304
  new e(t, n, r, i, a, o, s);
@@ -3123,21 +3329,21 @@ var ne = (e, t) => {
3123
3329
  priority: r.priority
3124
3330
  }, this.canvas.removeEdge(n);
3125
3331
  let m = {
3126
- overlayNodeId: E.StaticNodeId,
3332
+ overlayNodeId: T.StaticNodeId,
3127
3333
  portCoords: f,
3128
3334
  portDirection: c.direction
3129
3335
  }, h = this.params.draggingPortDirectionResolver.resolve({
3130
3336
  cursor: t,
3131
3337
  ...this.edgeInProgress
3132
3338
  }), g = {
3133
- overlayNodeId: E.DraggingNodeId,
3339
+ overlayNodeId: T.DraggingNodeId,
3134
3340
  portCoords: p,
3135
3341
  portDirection: h ?? s.direction
3136
3342
  }, [_, v] = a ? [m, g] : [g, m];
3137
- this.overlayCanvas.addNode(T(_)), this.overlayCanvas.addNode(T(v));
3138
- let y = this.params.draggingEdgeShapeFactory === null ? r.shape : this.params.draggingEdgeShapeFactory(E.EdgeId);
3343
+ this.overlayCanvas.addNode(w(_)), this.overlayCanvas.addNode(w(v));
3344
+ let y = this.params.draggingEdgeShapeFactory === null ? r.shape : this.params.draggingEdgeShapeFactory(T.EdgeId);
3139
3345
  return this.overlayCanvas.addEdge({
3140
- id: E.EdgeId,
3346
+ id: T.EdgeId,
3141
3347
  from: _.overlayNodeId,
3142
3348
  to: v.overlayNodeId,
3143
3349
  shape: y
@@ -3154,14 +3360,14 @@ var ne = (e, t) => {
3154
3360
  cursor: e,
3155
3361
  ...this.edgeInProgress
3156
3362
  });
3157
- this.overlayCanvas.updateNode(E.DraggingNodeId, {
3363
+ this.overlayCanvas.updateNode(T.DraggingNodeId, {
3158
3364
  x: r.x,
3159
3365
  y: r.y
3160
- }).updatePort(E.DraggingNodeId, { direction: i });
3366
+ }).updatePort(T.DraggingNodeId, { direction: i });
3161
3367
  }
3162
3368
  tryCreateConnection(e) {
3163
- let t = ne(this.canvas.graph, e);
3164
- if (this.overlayCanvas.removeEdge(E.EdgeId), t === null) {
3369
+ let t = re(this.canvas.graph, e);
3370
+ if (this.overlayCanvas.removeEdge(T.EdgeId), t === null) {
3165
3371
  let e = this.draggingEdgePayload;
3166
3372
  this.params.onEdgeReattachInterrupted({
3167
3373
  id: e.id,
@@ -3172,7 +3378,7 @@ var ne = (e, t) => {
3172
3378
  });
3173
3379
  return;
3174
3380
  }
3175
- let { from: n, to: r } = U(this.edgeInProgress, t), i = this.draggingEdgePayload, a = {
3381
+ let { from: n, to: r } = st(this.edgeInProgress, t), i = this.draggingEdgePayload, a = {
3176
3382
  id: i.id,
3177
3383
  from: n,
3178
3384
  to: r,
@@ -3194,7 +3400,7 @@ var ne = (e, t) => {
3194
3400
  });
3195
3401
  }
3196
3402
  }
3197
- }, dt = class e {
3403
+ }, yt = class e {
3198
3404
  applier;
3199
3405
  trigger;
3200
3406
  constructor(e, t) {
@@ -3205,7 +3411,7 @@ var ne = (e, t) => {
3205
3411
  static configure(t, n) {
3206
3412
  new e(t, n);
3207
3413
  }
3208
- }, ft = class e {
3414
+ }, bt = class e {
3209
3415
  graph;
3210
3416
  applier;
3211
3417
  defererFn;
@@ -3230,7 +3436,7 @@ var ne = (e, t) => {
3230
3436
  scheduleApply() {
3231
3437
  this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
3232
3438
  }
3233
- }, pt = class {
3439
+ }, xt = class {
3234
3440
  canvas;
3235
3441
  layoutAlgorithm;
3236
3442
  params;
@@ -3246,23 +3452,23 @@ var ne = (e, t) => {
3246
3452
  this.params.staticNodeResolver(t) || this.canvas.updateNode(t, e);
3247
3453
  }), this.params.onAfterApplied();
3248
3454
  }
3249
- }, mt = class {
3455
+ }, St = class {
3250
3456
  static configure(e, t) {
3251
- let n = t.applyOn, r = new pt(e, t.algorithm, {
3457
+ let n = t.applyOn, r = new xt(e, t.algorithm, {
3252
3458
  staticNodeResolver: t.staticNodeResolver,
3253
3459
  onBeforeApplied: t.onBeforeApplied,
3254
3460
  onAfterApplied: t.onAfterApplied
3255
3461
  });
3256
3462
  switch (n.type) {
3257
3463
  case "trigger":
3258
- dt.configure(r, n.trigger);
3464
+ yt.configure(r, n.trigger);
3259
3465
  break;
3260
3466
  case "topologyChangeSchedule":
3261
- ft.configure(e.graph, r, n.schedule);
3467
+ bt.configure(e.graph, r, n.schedule);
3262
3468
  break;
3263
3469
  }
3264
3470
  }
3265
- }, ht = class {
3471
+ }, Ct = class {
3266
3472
  win;
3267
3473
  callback;
3268
3474
  previousTimeStamp = void 0;
@@ -3277,7 +3483,7 @@ var ne = (e, t) => {
3277
3483
  constructor(e, t) {
3278
3484
  this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
3279
3485
  }
3280
- }, gt = class {
3486
+ }, wt = class {
3281
3487
  canvas;
3282
3488
  layoutAlgorithm;
3283
3489
  params;
@@ -3294,30 +3500,30 @@ var ne = (e, t) => {
3294
3500
  this.params.staticNodeResolver(t) || this.canvas.updateNode(t, e);
3295
3501
  }), this.params.onAfterApplied();
3296
3502
  }
3297
- }, _t = class e {
3503
+ }, Tt = class e {
3298
3504
  win;
3299
3505
  applier;
3300
3506
  step = (e) => {
3301
3507
  this.applier.apply(e);
3302
3508
  };
3303
3509
  constructor(e, t, n) {
3304
- this.win = n, this.applier = new gt(e, t.algorithm, {
3510
+ this.win = n, this.applier = new wt(e, t.algorithm, {
3305
3511
  staticNodeResolver: t.staticNodeResolver,
3306
3512
  onBeforeApplied: t.onBeforeApplied,
3307
3513
  onAfterApplied: t.onAfterApplied
3308
- }), new ht(this.win, this.step);
3514
+ }), new Ct(this.win, this.step);
3309
3515
  }
3310
3516
  static configure(t, n, r) {
3311
3517
  new e(t, n, r);
3312
3518
  }
3313
- }, vt = class e {
3519
+ }, Et = class e {
3314
3520
  canvas;
3315
3521
  window;
3316
3522
  pointInsideVerifier;
3317
3523
  eventTagger;
3318
3524
  configurator;
3319
3525
  onNodeSelected;
3320
- eventHandledTag = V;
3526
+ eventHandledTag = U;
3321
3527
  onAfterNodeAdded = (e) => {
3322
3528
  let { element: t } = this.canvas.graph.getNode(e);
3323
3529
  this.configurator.enable(t);
@@ -3333,7 +3539,7 @@ var ne = (e, t) => {
3333
3539
  });
3334
3540
  };
3335
3541
  constructor(e, t, n, r, i) {
3336
- this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onNodeSelected = i.onNodeSelected, this.configurator = new H(this.window, this.pointInsideVerifier, {
3542
+ this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onNodeSelected = i.onNodeSelected, this.configurator = new W(this.window, this.pointInsideVerifier, {
3337
3543
  onSelected: (e, t) => {
3338
3544
  let n = this.canvas.graph.findNodeIdByElement(e);
3339
3545
  this.eventTagger.tag(t, this.eventHandledTag), this.onNodeSelected(n);
@@ -3346,30 +3552,30 @@ var ne = (e, t) => {
3346
3552
  static configure(t, n, r, i, a) {
3347
3553
  new e(t, n, r, i, a);
3348
3554
  }
3349
- }, yt = class e {
3555
+ }, Dt = class e {
3350
3556
  canvas;
3351
3557
  window;
3352
3558
  pointInsideVerifier;
3353
3559
  eventTagger;
3354
3560
  configurator;
3355
- eventHandledTag = V;
3561
+ eventHandledTag = U;
3356
3562
  onEdgeSelected;
3357
3563
  onAfterEdgeAdded = (e) => {
3358
3564
  let { shape: t } = this.canvas.graph.getEdge(e);
3359
- this.configurator.enable(t.svg);
3565
+ this.configurator.enable(t.element);
3360
3566
  };
3361
3567
  onBeforeEdgeRemoved = (e) => {
3362
3568
  let { shape: t } = this.canvas.graph.getEdge(e);
3363
- this.configurator.disable(t.svg);
3569
+ this.configurator.disable(t.element);
3364
3570
  };
3365
3571
  reset = () => {
3366
3572
  this.canvas.graph.getAllEdgeIds().forEach((e) => {
3367
3573
  let { shape: t } = this.canvas.graph.getEdge(e);
3368
- this.configurator.disable(t.svg);
3574
+ this.configurator.disable(t.element);
3369
3575
  });
3370
3576
  };
3371
3577
  constructor(e, t, n, r, i) {
3372
- this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onEdgeSelected = i.onEdgeSelected, this.configurator = new H(this.window, this.pointInsideVerifier, {
3578
+ this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onEdgeSelected = i.onEdgeSelected, this.configurator = new W(this.window, this.pointInsideVerifier, {
3373
3579
  onSelected: (e, t) => {
3374
3580
  let n = this.canvas.graph.findEdgeIdByElement(e);
3375
3581
  this.eventTagger.tag(t, this.eventHandledTag), this.onEdgeSelected(n);
@@ -3382,7 +3588,7 @@ var ne = (e, t) => {
3382
3588
  static configure(t, n, r, i, a) {
3383
3589
  new e(t, n, r, i, a);
3384
3590
  }
3385
- }, bt = class e {
3591
+ }, Ot = class e {
3386
3592
  canvas;
3387
3593
  element;
3388
3594
  window;
@@ -3390,9 +3596,9 @@ var ne = (e, t) => {
3390
3596
  eventTagger;
3391
3597
  configurator;
3392
3598
  onCanvasSelected;
3393
- eventHandledTag = V;
3599
+ eventHandledTag = U;
3394
3600
  constructor(e, t, n, r, i, a) {
3395
- this.canvas = e, this.element = t, this.window = n, this.pointInsideVerifier = r, this.eventTagger = i, this.onCanvasSelected = a.onCanvasSelected, this.configurator = new H(this.window, this.pointInsideVerifier, {
3601
+ this.canvas = e, this.element = t, this.window = n, this.pointInsideVerifier = r, this.eventTagger = i, this.onCanvasSelected = a.onCanvasSelected, this.configurator = new W(this.window, this.pointInsideVerifier, {
3396
3602
  onSelected: (e, t) => {
3397
3603
  this.eventTagger.has(t, this.eventHandledTag) || this.onCanvasSelected();
3398
3604
  },
@@ -3406,22 +3612,22 @@ var ne = (e, t) => {
3406
3612
  static configure(t, n, r, i, a, o) {
3407
3613
  new e(t, n, r, i, a, o);
3408
3614
  }
3409
- }, xt = () => {
3615
+ }, kt = () => {
3410
3616
  let e = document.createElement("div");
3411
3617
  return e.style.width = "100%", e.style.height = "100%", e.style.position = "relative", e;
3412
- }, G = () => {
3618
+ }, At = () => {
3413
3619
  let e = document.createElement("div");
3414
3620
  return e.style.position = "absolute", e.style.inset = "0", e;
3415
- }, St = () => {
3416
- let e = G();
3621
+ }, jt = () => {
3622
+ let e = At();
3417
3623
  return e.style.pointerEvents = "none", e;
3418
- }, Ct = class {
3624
+ }, Mt = class {
3419
3625
  element;
3420
- background = G();
3421
- main = G();
3422
- overlayConnectablePorts = St();
3423
- overlayDraggableEdges = St();
3424
- host = xt();
3626
+ background = At();
3627
+ main = At();
3628
+ overlayConnectablePorts = jt();
3629
+ overlayDraggableEdges = jt();
3630
+ host = kt();
3425
3631
  constructor(e) {
3426
3632
  this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
3427
3633
  }
@@ -3446,10 +3652,10 @@ var ne = (e, t) => {
3446
3652
  mouseDownEventVerifier: (e) => e.button === 0,
3447
3653
  mouseUpEventVerifier: (e) => e.button === 0,
3448
3654
  movementThreshold: 10
3449
- }), J = () => {}, wt = (e, t, n) => e === "closest-connectable-port" || e === "nearest-connectable-port" ? new et(t, n) : new tt(e), Y = (e) => {
3655
+ }), J = () => {}, Nt = (e, t, n) => e === "closest-connectable-port" || e === "nearest-connectable-port" ? new ct(t, n) : new lt(e), Y = (e) => {
3450
3656
  if (typeof e == "function") return e;
3451
3657
  switch (e.type) {
3452
- case "straight": return () => new ke({
3658
+ case "straight": return () => new Pe({
3453
3659
  color: e.color,
3454
3660
  width: e.width,
3455
3661
  arrowLength: e.arrowLength,
@@ -3462,7 +3668,7 @@ var ne = (e, t) => {
3462
3668
  detourDistance: e.detourDistance,
3463
3669
  detourDirection: e.detourDirection
3464
3670
  });
3465
- case "horizontal": return () => new Oe({
3671
+ case "horizontal": return () => new Ne({
3466
3672
  color: e.color,
3467
3673
  width: e.width,
3468
3674
  arrowLength: e.arrowLength,
@@ -3474,7 +3680,7 @@ var ne = (e, t) => {
3474
3680
  roundness: e.roundness,
3475
3681
  detourDistance: e.detourDistance
3476
3682
  });
3477
- case "vertical": return () => new Me({
3683
+ case "vertical": return () => new Le({
3478
3684
  color: e.color,
3479
3685
  width: e.width,
3480
3686
  arrowLength: e.arrowLength,
@@ -3486,7 +3692,19 @@ var ne = (e, t) => {
3486
3692
  roundness: e.roundness,
3487
3693
  detourDistance: e.detourDistance
3488
3694
  });
3489
- case "direct": return () => new I({
3695
+ case "orthogonal": return () => new ze({
3696
+ color: e.color,
3697
+ width: e.width,
3698
+ arrowLength: e.arrowLength,
3699
+ arrowOffset: e.arrowOffset,
3700
+ arrowRenderer: e.arrowRenderer,
3701
+ hasSourceArrow: e.hasSourceArrow,
3702
+ hasTargetArrow: e.hasTargetArrow,
3703
+ cycleSquareSide: e.cycleSquareSide,
3704
+ roundness: e.roundness,
3705
+ detourDistance: e.detourDistance
3706
+ });
3707
+ case "direct": return () => new R({
3490
3708
  color: e.color,
3491
3709
  width: e.width,
3492
3710
  arrowLength: e.arrowLength,
@@ -3496,7 +3714,7 @@ var ne = (e, t) => {
3496
3714
  sourceOffset: e.sourceOffset,
3497
3715
  targetOffset: e.targetOffset
3498
3716
  });
3499
- default: return () => new Ee({
3717
+ default: return () => new je({
3500
3718
  color: e.color,
3501
3719
  width: e.width,
3502
3720
  arrowLength: e.arrowLength,
@@ -3510,7 +3728,7 @@ var ne = (e, t) => {
3510
3728
  detourDirection: e.detourDirection
3511
3729
  });
3512
3730
  }
3513
- }, Tt = (e) => {
3731
+ }, Pt = (e) => {
3514
3732
  let t = e.nodeDragVerifier ?? (() => !0), n = e.moveOnTop !== !1, r = e.moveEdgesOnTop !== !1 && n, i = e.mouse?.dragCursor, a = i === void 0 ? "grab" : i, o = e.mouse?.mouseDownEventVerifier, s = o === void 0 ? (e) => e.button === 0 : o, c = e.mouse?.mouseUpEventVerifier, l = c === void 0 ? (e) => e.button === 0 : c;
3515
3733
  return {
3516
3734
  moveOnTop: n,
@@ -3524,7 +3742,7 @@ var ne = (e, t) => {
3524
3742
  nodeDragVerifier: t,
3525
3743
  onNodeDragFinished: e.events?.onNodeDragFinished ?? J
3526
3744
  };
3527
- }, Et = (e) => {
3745
+ }, Ft = (e) => {
3528
3746
  let t = e.minX === null ? -Infinity : e.minX, n = e.maxX === null ? Infinity : e.maxX, r = e.minY === null ? -Infinity : e.minY, i = e.maxY === null ? Infinity : e.maxY;
3529
3747
  return (e) => {
3530
3748
  let a = e.nextTransform.x, o = e.nextTransform.y;
@@ -3538,17 +3756,17 @@ var ne = (e, t) => {
3538
3756
  y: o
3539
3757
  };
3540
3758
  };
3541
- }, Dt = (e) => {
3759
+ }, It = (e) => {
3542
3760
  let t = e.maxContentScale, n = e.minContentScale, r = t === null ? 0 : 1 / t, i = n === null ? Infinity : 1 / n;
3543
3761
  return (e) => {
3544
3762
  let t = e.prevTransform, n = e.nextTransform, a = n.scale, o = n.x, s = n.y;
3545
3763
  if (n.scale > i && n.scale > t.scale) {
3546
- a = Math.max(t.scale, i), o = t.x, s = t.y;
3764
+ a = Math.max(t.scale, i);
3547
3765
  let e = (a - t.scale) / (n.scale - t.scale);
3548
3766
  o = t.x + (n.x - t.x) * e, s = t.y + (n.y - t.y) * e;
3549
3767
  }
3550
3768
  if (n.scale < r && n.scale < t.scale) {
3551
- a = Math.min(t.scale, r), o = t.x, s = t.y;
3769
+ a = Math.min(t.scale, r);
3552
3770
  let e = (a - t.scale) / (n.scale - t.scale);
3553
3771
  o = t.x + (n.x - t.x) * e, s = t.y + (n.y - t.y) * e;
3554
3772
  }
@@ -3558,28 +3776,28 @@ var ne = (e, t) => {
3558
3776
  y: s
3559
3777
  };
3560
3778
  };
3561
- }, Ot = (e) => (t) => e.reduce((e, n) => n({
3779
+ }, Lt = (e) => (t) => e.reduce((e, n) => n({
3562
3780
  prevTransform: t.prevTransform,
3563
3781
  nextTransform: e,
3564
3782
  canvasWidth: t.canvasWidth,
3565
3783
  canvasHeight: t.canvasHeight
3566
- }), t.nextTransform), kt = (e) => {
3784
+ }), t.nextTransform), Rt = (e) => {
3567
3785
  if (typeof e == "function") return e;
3568
3786
  switch (e.type) {
3569
- case "scale-limit": return Dt({
3787
+ case "scale-limit": return It({
3570
3788
  minContentScale: e.minContentScale ?? 0,
3571
3789
  maxContentScale: e.maxContentScale ?? Infinity
3572
3790
  });
3573
- case "shift-limit": return Et({
3791
+ case "shift-limit": return Ft({
3574
3792
  minX: e.minX ?? -Infinity,
3575
3793
  maxX: e.maxX ?? Infinity,
3576
3794
  minY: e.minY ?? -Infinity,
3577
3795
  maxY: e.maxY ?? Infinity
3578
3796
  });
3579
3797
  }
3580
- }, At = (e) => {
3798
+ }, zt = (e) => {
3581
3799
  let t = e?.scale?.mouseWheelSensitivity, n = t === void 0 ? 1.2 : t, r = e?.transformPreprocessor, i;
3582
- i = r === void 0 ? (e) => e.nextTransform : Array.isArray(r) ? Ot(r.map((e) => kt(e))) : kt(r);
3800
+ i = r === void 0 ? (e) => e.nextTransform : Array.isArray(r) ? Lt(r.map((e) => Rt(e))) : Rt(r);
3583
3801
  let a = e?.shift?.cursor === void 0 ? "grab" : e.shift.cursor, o = e?.shift?.mouseDownEventVerifier, s = o === void 0 ? (e) => e.button === 0 : o, c = e?.shift?.mouseUpEventVerifier, l = c === void 0 ? (e) => e.button === 0 : c, u = e?.scale?.mouseWheelEventVerifier, d = u === void 0 ? () => !0 : u;
3584
3802
  return {
3585
3803
  wheelSensitivity: n,
@@ -3596,15 +3814,15 @@ var ne = (e, t) => {
3596
3814
  onResizeTransformStarted: e?.events?.onResizeTransformStarted ?? J,
3597
3815
  onResizeTransformFinished: e?.events?.onResizeTransformFinished ?? J
3598
3816
  };
3599
- }, jt = (e, t) => {
3817
+ }, Bt = (e, t) => {
3600
3818
  let n = document.createElementNS("http://www.w3.org/2000/svg", "circle");
3601
3819
  return n.setAttribute("cx", "0"), n.setAttribute("cy", "0"), n.setAttribute("r", `${e}`), n.setAttribute("fill", `${t}`), n;
3602
- }, Mt = (e) => e instanceof SVGElement ? e : jt(e?.radius ?? 1.5, e?.color ?? "#d8d8d8"), Nt = (e) => {
3820
+ }, Vt = (e) => e instanceof SVGElement ? e : Bt(e?.radius ?? 1.5, e?.color ?? "#d8d8d8"), Ht = (e) => {
3603
3821
  let t = e.tileDimensions;
3604
3822
  return {
3605
3823
  tileWidth: t?.width ?? 25,
3606
3824
  tileHeight: t?.height ?? 25,
3607
- renderer: Mt(e.renderer ?? {}),
3825
+ renderer: Vt(e.renderer ?? {}),
3608
3826
  maxViewportScale: e.maxViewportScale ?? 10
3609
3827
  };
3610
3828
  }, X = Object.freeze({
@@ -3612,12 +3830,12 @@ var ne = (e, t) => {
3612
3830
  connectionPreprocessor: (e) => e,
3613
3831
  connectionAllowedVerifier: () => !0,
3614
3832
  mouseEventVerifier: (e) => e.button === 0
3615
- }), Pt = (e, t, n) => {
3833
+ }), Ut = (e, t, n) => {
3616
3834
  let r = e.connectionAllowedVerifier ?? X.connectionAllowedVerifier;
3617
3835
  return {
3618
3836
  connectionTypeResolver: e.connectionTypeResolver ?? X.connectionTypeResolver,
3619
3837
  connectionAllowedVerifier: r,
3620
- draggingPortDirectionResolver: wt(e.dragPortDirection, n, r),
3838
+ draggingPortDirectionResolver: Nt(e.dragPortDirection, n, r),
3621
3839
  edgeShapeFactory: e.edgeShape === void 0 ? t : Y(e.edgeShape),
3622
3840
  connectionPreprocessor: e.connectionPreprocessor ?? X.connectionPreprocessor,
3623
3841
  mouseDownEventVerifier: e.mouseDownEventVerifier ?? X.mouseEventVerifier,
@@ -3631,7 +3849,7 @@ var ne = (e, t) => {
3631
3849
  connectionPreprocessor: (e) => e,
3632
3850
  mouseDownEventVerifier: (e) => e.button === 0 && e.ctrlKey,
3633
3851
  mouseUpEventVerifier: (e) => e.button === 0
3634
- }), Ft = (e, t) => {
3852
+ }), Wt = (e, t) => {
3635
3853
  let n = (e) => {
3636
3854
  let n = t.getPortAdjacentEdgeIds(e);
3637
3855
  return n.length > 0 ? n[n.length - 1] : null;
@@ -3646,17 +3864,17 @@ var ne = (e, t) => {
3646
3864
  onAfterEdgeReattached: e.events?.onAfterEdgeReattached ?? J,
3647
3865
  onEdgeReattachInterrupted: e.events?.onEdgeReattachInterrupted ?? J,
3648
3866
  onEdgeReattachPrevented: e.events?.onEdgeReattachPrevented ?? J,
3649
- draggingPortDirectionResolver: wt(e.dragPortDirection, t, r)
3867
+ draggingPortDirectionResolver: Nt(e.dragPortDirection, t, r)
3650
3868
  };
3651
- }, It = (e) => ({
3869
+ }, Gt = (e) => ({
3652
3870
  nodeVerticalRadius: e.nodeContainingRadius.vertical,
3653
3871
  nodeHorizontalRadius: e.nodeContainingRadius.horizontal
3654
- }), Lt = (e) => ({
3872
+ }), Kt = (e) => ({
3655
3873
  onAfterNodeDetached: e?.events?.onAfterNodeDetached ?? J,
3656
3874
  onBeforeNodeAttached: e?.events?.onBeforeNodeAttached ?? J
3657
- }), Rt = class extends Error {
3875
+ }), qt = class extends Error {
3658
3876
  name = "CanvasBuilderError";
3659
- }, zt = class {
3877
+ }, Jt = class {
3660
3878
  graph;
3661
3879
  currentCoords;
3662
3880
  dt;
@@ -3691,7 +3909,7 @@ var ne = (e, t) => {
3691
3909
  d.x += l, d.y += u, f.x -= l, f.y -= u;
3692
3910
  });
3693
3911
  }
3694
- }, Bt = class {
3912
+ }, Yt = class {
3695
3913
  rand;
3696
3914
  PI2 = 2 * Math.PI;
3697
3915
  constructor(e) {
@@ -3714,11 +3932,11 @@ var ne = (e, t) => {
3714
3932
  d: a
3715
3933
  };
3716
3934
  }
3717
- }, Vt = (e) => {
3935
+ }, Xt = (e) => {
3718
3936
  if (e.distance === 0) return e.maxForce;
3719
3937
  let t = e.coefficient * (e.sourceCharge * e.targetCharge / (e.distance * e.distance));
3720
3938
  return Math.min(t, e.maxForce);
3721
- }, Ht = class {
3939
+ }, Zt = class {
3722
3940
  nodeCharge;
3723
3941
  distanceVectorGenerator;
3724
3942
  maxForce;
@@ -3730,7 +3948,7 @@ var ne = (e, t) => {
3730
3948
  for (let i = 0; i < r; i++) {
3731
3949
  let a = n[i];
3732
3950
  for (let o = i + 1; o < r; o++) {
3733
- let r = n[o], i = e.get(a), s = e.get(r), c = this.distanceVectorGenerator.create(i, s), l = Vt({
3951
+ let r = n[o], i = e.get(a), s = e.get(r), c = this.distanceVectorGenerator.create(i, s), l = Xt({
3734
3952
  coefficient: 1,
3735
3953
  sourceCharge: this.nodeCharge,
3736
3954
  targetCharge: this.nodeCharge,
@@ -3741,7 +3959,7 @@ var ne = (e, t) => {
3741
3959
  }
3742
3960
  }
3743
3961
  }
3744
- }, Ut = (e) => {
3962
+ }, Qt = (e) => {
3745
3963
  if (e.size === 0) return {
3746
3964
  centerX: 0,
3747
3965
  centerY: 0,
@@ -3757,7 +3975,7 @@ var ne = (e, t) => {
3757
3975
  centerY: (r + i) / 2,
3758
3976
  radius: s / 2
3759
3977
  };
3760
- }, Wt = class {
3978
+ }, $t = class {
3761
3979
  root;
3762
3980
  leaves = /* @__PURE__ */ new Map();
3763
3981
  coords;
@@ -3913,7 +4131,7 @@ var ne = (e, t) => {
3913
4131
  y: n / e.size
3914
4132
  };
3915
4133
  }
3916
- }, Gt = class {
4134
+ }, en = class {
3917
4135
  areaRadiusThreshold;
3918
4136
  nodeMass;
3919
4137
  nodeCharge;
@@ -3925,8 +4143,8 @@ var ne = (e, t) => {
3925
4143
  this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
3926
4144
  }
3927
4145
  apply(e, t) {
3928
- let n = new Wt({
3929
- box: Ut(e),
4146
+ let n = new $t({
4147
+ box: Qt(e),
3930
4148
  coords: e,
3931
4149
  areaRadiusThreshold: this.areaRadiusThreshold,
3932
4150
  nodeMass: this.nodeMass,
@@ -4036,7 +4254,7 @@ var ne = (e, t) => {
4036
4254
  });
4037
4255
  }
4038
4256
  calculateNodeRepulsiveForce(e) {
4039
- let t = this.distanceVectorGenerator.create(e.sourceCoords, e.targetCoords), n = Vt({
4257
+ let t = this.distanceVectorGenerator.create(e.sourceCoords, e.targetCoords), n = Xt({
4040
4258
  coefficient: this.nodeForceCoefficient,
4041
4259
  sourceCharge: e.sourceCharge,
4042
4260
  targetCharge: e.targetCharge,
@@ -4063,12 +4281,12 @@ var ne = (e, t) => {
4063
4281
  this.applyForce(e.totalForce, t);
4064
4282
  }
4065
4283
  }
4066
- }, Kt = (e) => e.theta === 0 ? new Ht({
4284
+ }, tn = (e) => e.theta === 0 ? new Zt({
4067
4285
  nodeCharge: e.nodeCharge,
4068
4286
  nodeForceCoefficient: e.nodeForceCoefficient,
4069
4287
  distanceVectorGenerator: e.distanceVectorGenerator,
4070
4288
  maxForce: e.maxForce
4071
- }) : new Gt({
4289
+ }) : new en({
4072
4290
  nodeCharge: e.nodeCharge,
4073
4291
  nodeForceCoefficient: e.nodeForceCoefficient,
4074
4292
  distanceVectorGenerator: e.distanceVectorGenerator,
@@ -4076,7 +4294,7 @@ var ne = (e, t) => {
4076
4294
  theta: e.theta,
4077
4295
  nodeMass: e.nodeMass,
4078
4296
  areaRadiusThreshold: e.areaRadiusThreshold
4079
- }), qt = class {
4297
+ }), nn = class {
4080
4298
  rand;
4081
4299
  sparsity;
4082
4300
  constructor(e) {
@@ -4101,7 +4319,7 @@ var ne = (e, t) => {
4101
4319
  });
4102
4320
  }), r;
4103
4321
  }
4104
- }, Jt = class {
4322
+ }, rn = class {
4105
4323
  distanceVectorGenerator;
4106
4324
  nodeForcesApplicationStrategy;
4107
4325
  fillerLayoutAlgorithm;
@@ -4112,7 +4330,7 @@ var ne = (e, t) => {
4112
4330
  edgeStiffness;
4113
4331
  convergenceVelocity;
4114
4332
  constructor(e) {
4115
- this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new Bt(e.rand), this.nodeForcesApplicationStrategy = Kt({
4333
+ this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new Yt(e.rand), this.nodeForcesApplicationStrategy = tn({
4116
4334
  distanceVectorGenerator: this.distanceVectorGenerator,
4117
4335
  nodeCharge: e.nodeCharge,
4118
4336
  maxForce: e.maxForce,
@@ -4120,7 +4338,7 @@ var ne = (e, t) => {
4120
4338
  theta: e.barnesHutTheta,
4121
4339
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4122
4340
  nodeMass: e.nodeMass
4123
- }), this.fillerLayoutAlgorithm = new qt({
4341
+ }), this.fillerLayoutAlgorithm = new nn({
4124
4342
  rand: e.rand,
4125
4343
  sparsity: e.edgeEquilibriumLength
4126
4344
  });
@@ -4130,7 +4348,7 @@ var ne = (e, t) => {
4130
4348
  graph: t,
4131
4349
  viewport: n
4132
4350
  });
4133
- for (let e = 0; e < this.maxIterations && !(new zt(t, r, {
4351
+ for (let e = 0; e < this.maxIterations && !(new Jt(t, r, {
4134
4352
  distanceVectorGenerator: this.distanceVectorGenerator,
4135
4353
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
4136
4354
  dtSec: this.dtSec,
@@ -4140,7 +4358,7 @@ var ne = (e, t) => {
4140
4358
  }).apply() < this.convergenceVelocity); e++);
4141
4359
  return r;
4142
4360
  }
4143
- }, Yt = class {
4361
+ }, an = class {
4144
4362
  graph;
4145
4363
  nextLayerNodesResolver;
4146
4364
  forest = /* @__PURE__ */ new Set();
@@ -4184,7 +4402,7 @@ var ne = (e, t) => {
4184
4402
  }), r = e;
4185
4403
  }
4186
4404
  }
4187
- }, Xt = class {
4405
+ }, on = class {
4188
4406
  params;
4189
4407
  constructor(e) {
4190
4408
  this.params = e;
@@ -4223,13 +4441,13 @@ var ne = (e, t) => {
4223
4441
  }
4224
4442
  return n - 2 * this.params.spaceAroundRadius;
4225
4443
  }
4226
- }, Zt = class {
4444
+ }, sn = class {
4227
4445
  tree;
4228
4446
  offsets = /* @__PURE__ */ new Map();
4229
4447
  treeSpans = /* @__PURE__ */ new Map();
4230
4448
  constructor(e, t) {
4231
4449
  this.tree = e;
4232
- let n = t.spaceAroundRadius, r = new Xt({ spaceAroundRadius: n });
4450
+ let n = t.spaceAroundRadius, r = new on({ spaceAroundRadius: n });
4233
4451
  [...this.tree.sequence].reverse().forEach((e) => {
4234
4452
  let t = Array.from(e.children).map((e) => this.treeSpans.get(e.nodeId)), i = r.generate(t), a = 0;
4235
4453
  e.children.forEach((e) => {
@@ -4245,19 +4463,19 @@ var ne = (e, t) => {
4245
4463
  generate() {
4246
4464
  return this.offsets;
4247
4465
  }
4248
- }, Qt = class {
4466
+ }, cn = class {
4249
4467
  params;
4250
4468
  constructor(e) {
4251
4469
  this.params = e;
4252
4470
  }
4253
4471
  calculateCoordinates(e) {
4254
- let t = /* @__PURE__ */ new Map(), n = new Yt(e.graph, this.params.nextLayerNodesResolver).generate(), r = 0;
4472
+ let t = /* @__PURE__ */ new Map(), n = new an(e.graph, this.params.nextLayerNodesResolver).generate(), r = 0;
4255
4473
  return n.forEach((e) => {
4256
4474
  t.set(e.root.nodeId, {
4257
4475
  x: r,
4258
4476
  y: 0
4259
4477
  });
4260
- let n = new Zt(e, { spaceAroundRadius: this.params.layerSpace / 2 }).generate(), i = [e.root];
4478
+ let n = new sn(e, { spaceAroundRadius: this.params.layerSpace / 2 }).generate(), i = [e.root];
4261
4479
  for (; i.length > 0;) {
4262
4480
  let e = [];
4263
4481
  r += this.params.layerWidth, i.forEach((i) => {
@@ -4274,7 +4492,7 @@ var ne = (e, t) => {
4274
4492
  t.set(n, this.params.transform(e));
4275
4493
  }), t;
4276
4494
  }
4277
- }, $t = (e) => {
4495
+ }, ln = (e) => {
4278
4496
  let { graph: t, currentNodeId: n } = e, r = t.getNodeOutgoingEdgeIds(n).map((e) => {
4279
4497
  let n = t.getEdge(e);
4280
4498
  return t.getPort(n.to).nodeId;
@@ -4283,19 +4501,19 @@ var ne = (e, t) => {
4283
4501
  return t.getPort(n.from).nodeId;
4284
4502
  });
4285
4503
  return /* @__PURE__ */ new Set([...r, ...i]);
4286
- }, en = (e) => {
4504
+ }, un = (e) => {
4287
4505
  let { graph: t, currentNodeId: n } = e, r = t.getNodeOutgoingEdgeIds(n).map((e) => {
4288
4506
  let n = t.getEdge(e);
4289
4507
  return t.getPort(n.to).nodeId;
4290
4508
  });
4291
4509
  return new Set(r);
4292
- }, tn = (e) => {
4510
+ }, dn = (e) => {
4293
4511
  let { graph: t, currentNodeId: n } = e, r = t.getNodeIncomingEdgeIds(n).map((e) => {
4294
4512
  let n = t.getEdge(e);
4295
4513
  return t.getPort(n.from).nodeId;
4296
4514
  });
4297
4515
  return new Set(r);
4298
- }, nn = class {
4516
+ }, fn = class {
4299
4517
  distanceVectorGenerator;
4300
4518
  nodeForcesApplicationStrategy;
4301
4519
  convergenceVelocity;
@@ -4305,7 +4523,7 @@ var ne = (e, t) => {
4305
4523
  edgeStiffness;
4306
4524
  fillerLayoutAlgorithm;
4307
4525
  constructor(e) {
4308
- this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Bt(e.rand), this.nodeForcesApplicationStrategy = Kt({
4526
+ this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Yt(e.rand), this.nodeForcesApplicationStrategy = tn({
4309
4527
  distanceVectorGenerator: this.distanceVectorGenerator,
4310
4528
  nodeCharge: e.nodeCharge,
4311
4529
  maxForce: e.maxForce,
@@ -4313,7 +4531,7 @@ var ne = (e, t) => {
4313
4531
  theta: e.barnesHutTheta,
4314
4532
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4315
4533
  nodeMass: e.nodeMass
4316
- }), this.fillerLayoutAlgorithm = new qt({
4534
+ }), this.fillerLayoutAlgorithm = new nn({
4317
4535
  rand: e.rand,
4318
4536
  sparsity: e.edgeEquilibriumLength
4319
4537
  });
@@ -4323,7 +4541,7 @@ var ne = (e, t) => {
4323
4541
  graph: t,
4324
4542
  viewport: n
4325
4543
  });
4326
- return new zt(t, i, {
4544
+ return new Jt(t, i, {
4327
4545
  distanceVectorGenerator: this.distanceVectorGenerator,
4328
4546
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
4329
4547
  dtSec: Math.min(r, this.maxTimeDeltaSec),
@@ -4335,7 +4553,7 @@ var ne = (e, t) => {
4335
4553
  return n.x === null || n.y === null;
4336
4554
  }) ? /* @__PURE__ */ new Map() : i;
4337
4555
  }
4338
- }, rn = (e) => {
4556
+ }, pn = (e) => {
4339
4557
  let t = 1779033703, n = 3144134277, r = 1013904242, i = 2773480762;
4340
4558
  for (let a = 0, o; a < e.length; a++) o = e.charCodeAt(a), t = n ^ Math.imul(t ^ o, 597399067), n = r ^ Math.imul(n ^ o, 2869860233), r = i ^ Math.imul(r ^ o, 951274213), i = t ^ Math.imul(i ^ o, 2716044179);
4341
4559
  return t = Math.imul(r ^ t >>> 18, 597399067), n = Math.imul(i ^ n >>> 22, 2869860233), r = Math.imul(t ^ r >>> 17, 951274213), i = Math.imul(n ^ i >>> 19, 2716044179), t ^= n ^ r ^ i, n ^= t, r ^= t, i ^= t, [
@@ -4344,17 +4562,17 @@ var ne = (e, t) => {
4344
4562
  r >>> 0,
4345
4563
  i >>> 0
4346
4564
  ];
4347
- }, an = (e, t, n, r) => function() {
4565
+ }, mn = (e, t, n, r) => function() {
4348
4566
  e |= 0, t |= 0, n |= 0, r |= 0;
4349
4567
  let i = (e + t | 0) + r | 0;
4350
4568
  return r = r + 1 | 0, e = t ^ t >>> 9, t = n + (n << 3) | 0, n = n << 21 | n >>> 11, n = n + i | 0, (i >>> 0) / 4294967296;
4351
- }, on = (e) => {
4569
+ }, hn = (e) => {
4352
4570
  switch (e?.type) {
4353
4571
  case "custom": return e.instance;
4354
4572
  default: {
4355
- let t = rn(e?.seed ?? K.seed);
4356
- return new nn({
4357
- rand: an(t[0], t[1], t[2], t[3]),
4573
+ let t = pn(e?.seed ?? K.seed);
4574
+ return new fn({
4575
+ rand: mn(t[0], t[1], t[2], t[3]),
4358
4576
  maxTimeDeltaSec: e?.maxTimeDeltaSec ?? K.maxTimeDeltaSec,
4359
4577
  nodeCharge: e?.nodeCharge ?? K.nodeCharge,
4360
4578
  nodeMass: e?.nodeMass ?? K.nodeMass,
@@ -4368,37 +4586,37 @@ var ne = (e, t) => {
4368
4586
  });
4369
4587
  }
4370
4588
  }
4371
- }, sn = { staticNodeResolver: () => !1 }, cn = (e) => ({
4372
- algorithm: on(e?.algorithm ?? {}),
4373
- staticNodeResolver: e?.staticNodeResolver ?? sn.staticNodeResolver,
4589
+ }, gn = { staticNodeResolver: () => !1 }, _n = (e) => ({
4590
+ algorithm: hn(e?.algorithm ?? {}),
4591
+ staticNodeResolver: e?.staticNodeResolver ?? gn.staticNodeResolver,
4374
4592
  onBeforeApplied: e?.events?.onBeforeApplied ?? J,
4375
4593
  onAfterApplied: e?.events?.onAfterApplied ?? J
4376
- }), ln = (e) => e instanceof l ? {
4594
+ }), vn = (e) => e instanceof l ? {
4377
4595
  type: "trigger",
4378
4596
  trigger: e
4379
4597
  } : e === "topologyChangeMicrotask" ? {
4380
4598
  type: "topologyChangeSchedule",
4381
- schedule: Ge
4599
+ schedule: Qe
4382
4600
  } : e?.type === "topologyChangeMacrotask" ? {
4383
4601
  type: "topologyChangeSchedule",
4384
- schedule: We
4602
+ schedule: Ze
4385
4603
  } : {
4386
4604
  type: "topologyChangeSchedule",
4387
- schedule: Ge
4388
- }, Q = Object.freeze({
4605
+ schedule: Qe
4606
+ }, yn = Object.freeze({
4389
4607
  staticNodeResolver: () => !1,
4390
4608
  hierarchicalLayout: {
4391
4609
  layerWidth: 300,
4392
4610
  layerSpace: 300
4393
4611
  }
4394
- }), $ = (e, t) => ({
4612
+ }), Q = (e, t) => ({
4395
4613
  a: e.a * t.a + e.b * t.d,
4396
4614
  b: e.a * t.b + e.b * t.e,
4397
4615
  c: e.a * t.c + e.b * t.f + e.c,
4398
4616
  d: e.d * t.a + e.e * t.d,
4399
4617
  e: e.d * t.b + e.e * t.e,
4400
4618
  f: e.d * t.c + e.e * t.f + e.f
4401
- }), un = (e) => {
4619
+ }), bn = (e) => {
4402
4620
  let { a: t, b: n, c: r, d: i, e: a, f: o } = e, s = t * a - n * i;
4403
4621
  return {
4404
4622
  a: a / s,
@@ -4408,7 +4626,7 @@ var ne = (e, t) => {
4408
4626
  e: t / s,
4409
4627
  f: (r * i - t * o) / s
4410
4628
  };
4411
- }, dn = class {
4629
+ }, xn = class {
4412
4630
  resolve(e) {
4413
4631
  if ("shift" in e) return this.createShiftBaseMatrix(e.shift);
4414
4632
  if ("scale" in e) {
@@ -4450,11 +4668,11 @@ var ne = (e, t) => {
4450
4668
  return this.createRelativeTransform(n, r);
4451
4669
  }
4452
4670
  createMirrorRelativeMatrix(e, t) {
4453
- let n = this.createMirrorYBaseMatrix(), r = $(this.createShiftBaseMatrix(t), this.createRotateBaseMatrix(e));
4671
+ let n = this.createMirrorYBaseMatrix(), r = Q(this.createShiftBaseMatrix(t), this.createRotateBaseMatrix(e));
4454
4672
  return this.createRelativeTransform(n, r);
4455
4673
  }
4456
4674
  createRelativeTransform(e, t) {
4457
- return $($(t, e), un(t));
4675
+ return Q(Q(t, e), bn(t));
4458
4676
  }
4459
4677
  createShiftBaseMatrix(e) {
4460
4678
  return {
@@ -4497,7 +4715,7 @@ var ne = (e, t) => {
4497
4715
  f: 0
4498
4716
  };
4499
4717
  }
4500
- }, fn = (e) => {
4718
+ }, Sn = (e) => {
4501
4719
  if (e === void 0) return (e) => e;
4502
4720
  if (typeof e == "function") return e;
4503
4721
  let t = Array.isArray(e) ? e : [e], n = {
@@ -4507,10 +4725,10 @@ var ne = (e, t) => {
4507
4725
  d: 0,
4508
4726
  e: 1,
4509
4727
  f: 0
4510
- }, r = new dn();
4728
+ }, r = new xn();
4511
4729
  return t.forEach((e) => {
4512
4730
  let t = r.resolve(e);
4513
- n = $(n, t);
4731
+ n = Q(n, t);
4514
4732
  }), (e) => {
4515
4733
  let { x: t, y: r } = e;
4516
4734
  return {
@@ -4518,25 +4736,25 @@ var ne = (e, t) => {
4518
4736
  y: n.d * t + n.e * r + n.f
4519
4737
  };
4520
4738
  };
4521
- }, pn = (e) => {
4739
+ }, Cn = (e) => {
4522
4740
  if (typeof e == "function") return e;
4523
4741
  switch (e) {
4524
- case "outgoing": return en;
4525
- case "incoming": return tn;
4526
- default: return $t;
4742
+ case "outgoing": return un;
4743
+ case "incoming": return dn;
4744
+ default: return ln;
4527
4745
  }
4528
- }, mn = (e) => {
4746
+ }, wn = (e) => {
4529
4747
  switch (e?.type) {
4530
4748
  case "custom": return e.instance;
4531
- case "hierarchical": return new Qt({
4532
- layerWidth: e.layerWidth ?? Q.hierarchicalLayout.layerWidth,
4533
- layerSpace: e.layerSpace ?? Q.hierarchicalLayout.layerSpace,
4534
- transform: fn(e.transform),
4535
- nextLayerNodesResolver: pn(e.nextLayerNodesResolver)
4749
+ case "hierarchical": return new cn({
4750
+ layerWidth: e.layerWidth ?? yn.hierarchicalLayout.layerWidth,
4751
+ layerSpace: e.layerSpace ?? yn.hierarchicalLayout.layerSpace,
4752
+ transform: Sn(e.transform),
4753
+ nextLayerNodesResolver: Cn(e.nextLayerNodesResolver)
4536
4754
  });
4537
4755
  default: {
4538
- let t = rn(e?.seed ?? K.seed), n = an(t[0], t[1], t[2], t[3]);
4539
- return new Jt({
4756
+ let t = pn(e?.seed ?? K.seed), n = mn(t[0], t[1], t[2], t[3]);
4757
+ return new rn({
4540
4758
  dtSec: e?.dtSec ?? K.dtSec,
4541
4759
  maxIterations: e?.maxIterations ?? K.maxIterations,
4542
4760
  rand: n,
@@ -4552,13 +4770,13 @@ var ne = (e, t) => {
4552
4770
  });
4553
4771
  }
4554
4772
  }
4555
- }, hn = (e) => ({
4556
- algorithm: mn(e.algorithm),
4557
- applyOn: ln(e.applyOn),
4558
- staticNodeResolver: e.staticNodeResolver ?? Q.staticNodeResolver,
4773
+ }, Tn = (e) => ({
4774
+ algorithm: wn(e.algorithm),
4775
+ applyOn: vn(e.applyOn),
4776
+ staticNodeResolver: e.staticNodeResolver ?? yn.staticNodeResolver,
4559
4777
  onBeforeApplied: e.events?.onBeforeApplied ?? J,
4560
4778
  onAfterApplied: e.events?.onAfterApplied ?? J
4561
- }), gn = (e, t) => ({
4779
+ }), En = (e, t) => ({
4562
4780
  ...e,
4563
4781
  onNodeDragStarted: (n) => {
4564
4782
  t.add(n), e.onNodeDragStarted(n);
@@ -4566,7 +4784,7 @@ var ne = (e, t) => {
4566
4784
  onNodeDragFinished: (n) => {
4567
4785
  t.delete(n), e.onNodeDragFinished(n);
4568
4786
  }
4569
- }), _n = (e, t) => {
4787
+ }), Dn = (e, t) => {
4570
4788
  e.graph.onBeforeNodeRemoved.subscribe((e) => {
4571
4789
  t.delete(e);
4572
4790
  }), e.graph.onBeforeClear.subscribe(() => {
@@ -4574,23 +4792,23 @@ var ne = (e, t) => {
4574
4792
  }), e.onBeforeDestroy.subscribe(() => {
4575
4793
  t.clear();
4576
4794
  });
4577
- }, vn = (e, t) => ({
4795
+ }, On = (e, t) => ({
4578
4796
  ...e,
4579
4797
  staticNodeResolver: (n) => e.staticNodeResolver(n) || t.has(n)
4580
- }), yn = (e) => () => e, bn = yn(0), xn = () => {
4798
+ }), $ = (e) => () => e, kn = $(0), An = () => {
4581
4799
  let e = 0;
4582
4800
  return () => e++;
4583
- }, Sn = (e, t) => {
4584
- let n = bn, r = bn, i = xn();
4585
- return e === "incremental" && (n = i), t === "incremental" && (r = i), typeof e == "number" && (n = yn(e)), typeof t == "number" && (r = yn(t)), typeof e == "function" && (n = e), typeof t == "function" && (r = t), {
4801
+ }, jn = (e, t) => {
4802
+ let n = kn, r = kn, i = An();
4803
+ return e === "incremental" && (n = i), t === "incremental" && (r = i), typeof e == "number" && (n = $(e)), typeof t == "number" && (r = $(t)), typeof e == "function" && (n = e), typeof t == "function" && (r = t), {
4586
4804
  nodesPriorityFn: n,
4587
4805
  edgesPriorityFn: r
4588
4806
  };
4589
- }, Cn = (e) => {
4590
- let t = Sn(e.nodes?.priority, e.edges?.priority);
4807
+ }, Mn = (e) => {
4808
+ let t = jn(e.nodes?.priority, e.edges?.priority);
4591
4809
  return {
4592
4810
  nodes: {
4593
- centerFn: e.nodes?.centerFn ?? re,
4811
+ centerFn: e.nodes?.centerFn ?? ie,
4594
4812
  priorityFn: t.nodesPriorityFn
4595
4813
  },
4596
4814
  ports: { direction: e.ports?.direction ?? 0 },
@@ -4599,30 +4817,30 @@ var ne = (e, t) => {
4599
4817
  priorityFn: t.edgesPriorityFn
4600
4818
  }
4601
4819
  };
4602
- }, wn = (e) => e.applyOn.type === "topologyChangeSchedule" ? e.applyOn.schedule : R, Tn = (e) => {
4603
- let { canvasDefaults: t } = e, n = e.hasLayout ? wn(e.layoutParams) : R;
4820
+ }, Nn = (e) => e.applyOn.type === "topologyChangeSchedule" ? e.applyOn.schedule : B, Pn = (e) => {
4821
+ let { canvasDefaults: t } = e, n = e.hasLayout ? Nn(e.layoutParams) : B;
4604
4822
  return { focus: {
4605
4823
  contentPadding: t.focus?.contentPadding ?? t.focus?.contentOffset ?? 100,
4606
4824
  minContentScale: t.focus?.minContentScale ?? 0,
4607
4825
  schedule: n,
4608
4826
  animationDuration: t.focus?.animationDuration ?? 0
4609
4827
  } };
4610
- }, En = (e) => ({
4828
+ }, Fn = (e) => ({
4611
4829
  onNodeSelected: e.onNodeSelected,
4612
4830
  mouseDownEventVerifier: e.mouseDownEventVerifier ?? q.mouseDownEventVerifier,
4613
4831
  mouseUpEventVerifier: e.mouseUpEventVerifier ?? q.mouseUpEventVerifier,
4614
4832
  movementThreshold: e.movementThreshold ?? q.movementThreshold
4615
- }), Dn = (e) => ({
4833
+ }), In = (e) => ({
4616
4834
  onCanvasSelected: e.onCanvasSelected,
4617
4835
  mouseDownEventVerifier: e.mouseDownEventVerifier ?? q.mouseDownEventVerifier,
4618
4836
  mouseUpEventVerifier: e.mouseUpEventVerifier ?? q.mouseUpEventVerifier,
4619
4837
  movementThreshold: e.movementThreshold ?? q.movementThreshold
4620
- }), On = (e) => ({
4838
+ }), Ln = (e) => ({
4621
4839
  onEdgeSelected: e.onEdgeSelected,
4622
4840
  mouseDownEventVerifier: e.mouseDownEventVerifier ?? q.mouseDownEventVerifier,
4623
4841
  mouseUpEventVerifier: e.mouseUpEventVerifier ?? q.mouseUpEventVerifier,
4624
4842
  movementThreshold: e.movementThreshold ?? q.movementThreshold
4625
- }), kn = class {
4843
+ }), Rn = class {
4626
4844
  element;
4627
4845
  used = !1;
4628
4846
  canvasDefaults = {};
@@ -4649,9 +4867,9 @@ var ne = (e, t) => {
4649
4867
  window = window;
4650
4868
  animationStaticNodes = /* @__PURE__ */ new Set();
4651
4869
  pointInsideVerifier;
4652
- eventTagger = new $e();
4870
+ eventTagger = new ot();
4653
4871
  constructor(e) {
4654
- this.element = e, this.pointInsideVerifier = new C(e, this.window);
4872
+ this.element = e, this.pointInsideVerifier = new ee(e, this.window);
4655
4873
  }
4656
4874
  setDefaults(e) {
4657
4875
  return this.canvasDefaults = e, this;
@@ -4693,40 +4911,40 @@ var ne = (e, t) => {
4693
4911
  return this.userSelectableCanvasConfig = e, this;
4694
4912
  }
4695
4913
  build() {
4696
- if (this.used) throw new Rt("Failed to build Canvas because CanvasBuilder is a single-use object");
4914
+ if (this.used) throw new qt("Failed to build Canvas because CanvasBuilder is a single-use object");
4697
4915
  this.used = !0;
4698
- let e = new y(this.element), t = new h(), n = new Ct(this.element), r = this.createHtmlView(n.main, t, e), i = Cn(this.canvasDefaults), a = new Ue(t, r, i), o = hn(this.layoutConfig), s = new Xe(t, e, Tn({
4916
+ let e = new y(this.element), t = new h(), n = new Mt(this.element), r = this.createHtmlView(n.main, t, e), i = Mn(this.canvasDefaults), a = new Xe(t, r, i), o = Tn(this.layoutConfig), s = new rt(t, e, Pn({
4699
4917
  canvasDefaults: this.canvasDefaults,
4700
4918
  hasLayout: this.hasLayout,
4701
4919
  layoutParams: o
4702
- }), this.window), c = new Ke(e), l = new d(new He(t), c, a, s);
4703
- if (this.hasBackground && ct.configure(l, Nt(this.backgroundConfig), n.background), this.hasNodeResizeReactiveEdges && b.configure(l), this.userSelectableEdgesConfig !== void 0) {
4704
- let e = On(this.userSelectableEdgesConfig);
4705
- yt.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
4920
+ }), this.window), c = new $e(e), l = new d(new Ye(t), c, a, s);
4921
+ if (this.hasBackground && gt.configure(l, Ht(this.backgroundConfig), n.background), this.hasNodeResizeReactiveEdges && b.configure(l), this.userSelectableEdgesConfig !== void 0) {
4922
+ let e = Ln(this.userSelectableEdgesConfig);
4923
+ Dt.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
4706
4924
  }
4707
4925
  if (this.userSelectableNodesConfig !== void 0) {
4708
- let e = En(this.userSelectableNodesConfig);
4709
- vt.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
4926
+ let e = Fn(this.userSelectableNodesConfig);
4927
+ Et.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
4710
4928
  }
4711
4929
  if (this.userSelectableCanvasConfig !== void 0) {
4712
- let e = Dn(this.userSelectableCanvasConfig);
4713
- bt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
4930
+ let e = In(this.userSelectableCanvasConfig);
4931
+ Ot.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
4714
4932
  }
4715
4933
  if (this.hasDraggableNodes) {
4716
- let e = Tt(this.dragConfig);
4717
- this.hasAnimatedLayout && (e = gn(e, this.animationStaticNodes)), nt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
4934
+ let e = Pt(this.dragConfig);
4935
+ this.hasAnimatedLayout && (e = En(e, this.animationStaticNodes)), ut.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
4718
4936
  }
4719
4937
  if (this.hasUserConnectablePorts) {
4720
- let t = Pt(this.connectablePortsConfig, i.edges.shapeFactory, l.graph);
4721
- lt.configure(l, n.overlayConnectablePorts, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
4938
+ let t = Ut(this.connectablePortsConfig, i.edges.shapeFactory, l.graph);
4939
+ _t.configure(l, n.overlayConnectablePorts, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
4722
4940
  }
4723
4941
  if (this.hasUserDraggableEdges) {
4724
- let t = Ft(this.draggableEdgesConfig, l.graph);
4725
- ut.configure(l, n.overlayDraggableEdges, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
4942
+ let t = Wt(this.draggableEdgesConfig, l.graph);
4943
+ vt.configure(l, n.overlayDraggableEdges, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
4726
4944
  }
4727
- if (this.virtualScrollConfig === void 0 ? this.hasTransformableViewport && rt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, At(this.transformConfig)) : it.configure(l, n.main, this.window, At(this.transformConfig), this.boxRenderingTrigger, this.pointInsideVerifier, this.eventTagger, It(this.virtualScrollConfig)), this.hasLayout && mt.configure(l, o), this.hasAnimatedLayout) {
4728
- let e = cn(this.animatedLayoutConfig);
4729
- this.hasDraggableNodes && (_n(l, this.animationStaticNodes), e = vn(e, this.animationStaticNodes)), _t.configure(l, e, this.window);
4945
+ if (this.virtualScrollConfig === void 0 ? this.hasTransformableViewport && dt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, zt(this.transformConfig)) : ft.configure(l, n.main, this.window, zt(this.transformConfig), this.boxRenderingTrigger, this.pointInsideVerifier, this.eventTagger, Gt(this.virtualScrollConfig)), this.hasLayout && St.configure(l, o), this.hasAnimatedLayout) {
4946
+ let e = _n(this.animatedLayoutConfig);
4947
+ this.hasDraggableNodes && (Dn(l, this.animationStaticNodes), e = On(e, this.animationStaticNodes)), Tt.configure(l, e, this.window);
4730
4948
  }
4731
4949
  return l.onBeforeDestroy.subscribe(() => {
4732
4950
  n.destroy();
@@ -4734,8 +4952,8 @@ var ne = (e, t) => {
4734
4952
  }
4735
4953
  createHtmlView(e, t, n) {
4736
4954
  let r = new a(t, n, e);
4737
- return this.virtualScrollConfig !== void 0 && (r = new s(r, t, this.boxRenderingTrigger, Lt(this.virtualScrollConfig))), r = new c(r, t), r;
4955
+ return this.virtualScrollConfig !== void 0 && (r = new s(r, t, this.boxRenderingTrigger, Kt(this.virtualScrollConfig))), r = new c(r, t), r;
4738
4956
  }
4739
4957
  };
4740
4958
  //#endregion
4741
- export { Ee as BezierEdgeShape, kn as CanvasBuilder, Rt as CanvasBuilderError, p as CanvasError, e as ConnectionCategory, I as DirectEdgeShape, l as EventSubject, Oe as HorizontalEdgeShape, ze as InteractiveEdgeError, Be as InteractiveEdgeShape, Ve as MidpointEdgeShape, ke as StraightEdgeShape, Me as VerticalEdgeShape, Ne as boxPortOffsetFn };
4959
+ export { je as BezierEdgeShape, Rn as CanvasBuilder, qt as CanvasBuilderError, p as CanvasError, e as ConnectionCategory, R as DirectEdgeShape, l as EventSubject, Ne as HorizontalEdgeShape, Ke as InteractiveEdgeError, qe as InteractiveEdgeShape, Je as MidpointEdgeShape, ze as OrthogonalEdgeShape, Pe as StraightEdgeShape, Le as VerticalEdgeShape, Be as boxPortOffsetFn };