@infinit-canvas/react 0.1.7 → 0.1.8

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.
@@ -1,4 +1,4 @@
1
- import { jsx as S, jsxs as $t, Fragment as Ne } from "react/jsx-runtime";
1
+ import { jsx as S, jsxs as $t, Fragment as Le } from "react/jsx-runtime";
2
2
  import { useRef as tt, useState as Gt, useMemo as St, useEffect as ft, useCallback as F, useContext as qe, createContext as Fn, memo as Zt, useLayoutEffect as kr } from "react";
3
3
  import { createPortal as Yn } from "react-dom";
4
4
  const Un = 160, qn = 60;
@@ -63,8 +63,8 @@ function jn(t) {
63
63
  function xo(t, e, n = { x: 0, y: 0, zoom: 1 }, r = !1) {
64
64
  const s = e.x, o = e.y, i = e.x + e.width, c = e.y + e.height;
65
65
  return t.filter((u) => {
66
- const { width: l, height: y } = jn(u), m = u.position.x, C = u.position.y, z = m + l, M = C + y;
67
- return r ? m < i && z > s && C < c && M > o : m >= s && z <= i && C >= o && M <= c;
66
+ const { width: l, height: g } = jn(u), v = u.position.x, N = u.position.y, z = v + l, R = N + g;
67
+ return r ? v < i && z > s && N < c && R > o : v >= s && z <= i && N >= o && R <= c;
68
68
  });
69
69
  }
70
70
  function mo(t) {
@@ -949,8 +949,8 @@ function Cr(t, e) {
949
949
  const s = { worker: r };
950
950
  return mn.set(t, s), s;
951
951
  }
952
- const Vt = 160, jt = 60, Lr = 10;
953
- function Nr({
952
+ const Vt = 160, jt = 60, Nr = 10;
953
+ function Lr({
954
954
  cards: t = [],
955
955
  nodes: e = [],
956
956
  edges: n = [],
@@ -961,27 +961,27 @@ function Nr({
961
961
  onConnect: c,
962
962
  onNodeClick: u,
963
963
  onNodeDragStart: l,
964
- onNodeDrag: y,
965
- onNodeDragStop: m,
966
- onEdgeClick: C,
964
+ onNodeDrag: g,
965
+ onNodeDragStop: v,
966
+ onEdgeClick: N,
967
967
  onEdgeDoubleClick: z,
968
- onEdgeMouseEnter: M,
968
+ onEdgeMouseEnter: R,
969
969
  onEdgeMouseMove: $,
970
- onEdgeMouseLeave: R,
970
+ onEdgeMouseLeave: k,
971
971
  onEdgeContextMenu: E,
972
972
  onNodeDoubleClick: _,
973
- onNodeMouseEnter: D,
974
- onNodeMouseMove: g,
973
+ onNodeMouseEnter: B,
974
+ onNodeMouseMove: D,
975
975
  onNodeMouseLeave: f,
976
- onNodeContextMenu: p,
977
- onPaneClick: v,
978
- onPaneContextMenu: L,
976
+ onNodeContextMenu: h,
977
+ onPaneClick: p,
978
+ onPaneContextMenu: M,
979
979
  onPaneMouseEnter: w,
980
- onPaneMouseMove: P,
981
- onPaneMouseLeave: k,
982
- onSelectionChange: B,
980
+ onPaneMouseMove: C,
981
+ onPaneMouseLeave: x,
982
+ onSelectionChange: T,
983
983
  onConnectStart: j,
984
- onConnectEnd: X,
984
+ onConnectEnd: W,
985
985
  onInit: xt,
986
986
  onMoveStart: K,
987
987
  onMove: rt,
@@ -994,12 +994,12 @@ function Nr({
994
994
  gridSize: It = 40,
995
995
  zoomMin: it = 0.1,
996
996
  zoomMax: mt = 4,
997
- initialCamera: Lt = { x: 0, y: 0, zoom: 1 },
997
+ initialCamera: Nt = { x: 0, y: 0, zoom: 1 },
998
998
  fitView: zt = !1,
999
999
  fitViewOptions: dt,
1000
1000
  nodesDraggable: ht = !0,
1001
1001
  nodesConnectable: Rt = !0,
1002
- elementsSelectable: Nt = !0,
1002
+ elementsSelectable: Lt = !0,
1003
1003
  multiSelectionKeyCode: gt = "Shift",
1004
1004
  selectionOnDrag: ne = !1,
1005
1005
  selectionMode: Ie = "partial",
@@ -1023,11 +1023,11 @@ function Nr({
1023
1023
  autoPanOnNodeDrag: dn = !0,
1024
1024
  autoPanOnConnect: fn = !0,
1025
1025
  autoPanSpeed: Qt = 5,
1026
- edgesReconnectable: Ln = !1,
1026
+ edgesReconnectable: Nn = !1,
1027
1027
  elevateNodesOnSelect: hn = !1,
1028
1028
  edgeRouting: fe = !0
1029
1029
  } = {}) {
1030
- const vt = tt(null), Te = tt(null), Et = tt(null), pt = tt({ ...Lt }), se = tt([...t]), Z = tt([...e]), Pt = tt([...n]), yn = tt(/* @__PURE__ */ new Map()), Se = tt(!1), te = tt(null), [gn, pn] = Gt(!1), _t = tt(null), Wt = tt(null), Me = tt(null), ie = tt(null), Ut = tt(!1), Re = tt(null), [Be, Je] = Gt({ x: Lt.x, y: Lt.y, zoom: Lt.zoom }), [Ve, ae] = Gt(null), Kt = St(() => /* @__PURE__ */ new Set(), []), he = St(() => /* @__PURE__ */ new Set(), []), ke = tt(!1), O = tt({});
1030
+ const vt = tt(null), Te = tt(null), Et = tt(null), pt = tt({ ...Nt }), se = tt([...t]), Z = tt([...e]), Pt = tt([...n]), yn = tt(/* @__PURE__ */ new Map()), Se = tt(!1), te = tt(null), [gn, pn] = Gt(!1), _t = tt(null), Wt = tt(null), Me = tt(null), ie = tt(null), Ut = tt(!1), Re = tt(null), [Be, Je] = Gt({ x: Nt.x, y: Nt.y, zoom: Nt.zoom }), [Ve, ae] = Gt(null), Kt = St(() => /* @__PURE__ */ new Set(), []), he = St(() => /* @__PURE__ */ new Set(), []), ke = tt(!1), O = tt({});
1031
1031
  O.current = {
1032
1032
  onHudUpdate: r,
1033
1033
  onNodesProcessed: s,
@@ -1036,27 +1036,27 @@ function Nr({
1036
1036
  onConnect: c,
1037
1037
  onNodeClick: u,
1038
1038
  onNodeDragStart: l,
1039
- onNodeDrag: y,
1040
- onNodeDragStop: m,
1041
- onEdgeClick: C,
1039
+ onNodeDrag: g,
1040
+ onNodeDragStop: v,
1041
+ onEdgeClick: N,
1042
1042
  onEdgeDoubleClick: z,
1043
- onEdgeMouseEnter: M,
1043
+ onEdgeMouseEnter: R,
1044
1044
  onEdgeMouseMove: $,
1045
- onEdgeMouseLeave: R,
1045
+ onEdgeMouseLeave: k,
1046
1046
  onEdgeContextMenu: E,
1047
1047
  onNodeDoubleClick: _,
1048
- onNodeMouseEnter: D,
1049
- onNodeMouseMove: g,
1048
+ onNodeMouseEnter: B,
1049
+ onNodeMouseMove: D,
1050
1050
  onNodeMouseLeave: f,
1051
- onNodeContextMenu: p,
1052
- onPaneClick: v,
1053
- onPaneContextMenu: L,
1051
+ onNodeContextMenu: h,
1052
+ onPaneClick: p,
1053
+ onPaneContextMenu: M,
1054
1054
  onPaneMouseEnter: w,
1055
- onPaneMouseMove: P,
1056
- onPaneMouseLeave: k,
1057
- onSelectionChange: B,
1055
+ onPaneMouseMove: C,
1056
+ onPaneMouseLeave: x,
1057
+ onSelectionChange: T,
1058
1058
  onConnectStart: j,
1059
- onConnectEnd: X,
1059
+ onConnectEnd: W,
1060
1060
  onInit: xt,
1061
1061
  onMoveStart: K,
1062
1062
  onMove: rt,
@@ -1094,88 +1094,88 @@ function Nr({
1094
1094
  ft(() => {
1095
1095
  const a = (d) => {
1096
1096
  d.key === gt && (Ut.current = !0), d.key === we && (ke.current = !0);
1097
- }, x = (d) => {
1097
+ }, m = (d) => {
1098
1098
  d.key === gt && (Ut.current = !1), d.key === we && (ke.current = !1);
1099
1099
  };
1100
- return window.addEventListener("keydown", a), window.addEventListener("keyup", x), () => {
1101
- window.removeEventListener("keydown", a), window.removeEventListener("keyup", x);
1100
+ return window.addEventListener("keydown", a), window.addEventListener("keyup", m), () => {
1101
+ window.removeEventListener("keydown", a), window.removeEventListener("keyup", m);
1102
1102
  };
1103
1103
  }, [gt, we]);
1104
1104
  const Jt = F(() => {
1105
1105
  var b;
1106
- const a = Z.current.filter((N) => N.selected), x = Pt.current.filter((N) => N.selected), d = { nodes: a, edges: x };
1106
+ const a = Z.current.filter((L) => L.selected), m = Pt.current.filter((L) => L.selected), d = { nodes: a, edges: m };
1107
1107
  (b = ye.current) == null || b.call(ye, d);
1108
- for (const N of he) N(d);
1108
+ for (const L of he) L(d);
1109
1109
  }, [he]);
1110
1110
  ft(() => {
1111
1111
  var a;
1112
1112
  se.current = [...t], (a = Et.current) == null || a.postMessage({ type: "cards", data: { cards: [...t] } });
1113
1113
  }, [t]);
1114
1114
  const ze = F((a) => {
1115
- const x = {};
1116
- for (const d of a) x[d.id] = d;
1115
+ const m = {};
1116
+ for (const d of a) m[d.id] = d;
1117
1117
  return a.map((d) => {
1118
1118
  if (!d.parentId) return d;
1119
- const b = x[d.parentId];
1119
+ const b = m[d.parentId];
1120
1120
  if (!b) return d;
1121
- let N = d.position.x, I = d.position.y, h = b;
1122
- for (; h; )
1123
- N += h.position.x, I += h.position.y, h = h.parentId ? x[h.parentId] : null;
1124
- return { ...d, _absolutePosition: { x: N, y: I } };
1121
+ let L = d.position.x, I = d.position.y, y = b;
1122
+ for (; y; )
1123
+ L += y.position.x, I += y.position.y, y = y.parentId ? m[y.parentId] : null;
1124
+ return { ...d, _absolutePosition: { x: L, y: I } };
1125
1125
  });
1126
1126
  }, []), ee = tt([]), Q = F((a) => {
1127
- const x = yn.current;
1128
- if (!x || x.size === 0) return a;
1127
+ const m = yn.current;
1128
+ if (!m || m.size === 0) return a;
1129
1129
  const d = {};
1130
- for (const [, b] of x)
1130
+ for (const [, b] of m)
1131
1131
  d[b.nodeId] || (d[b.nodeId] = []), d[b.nodeId].push({ id: b.id, type: b.type, position: b.position, x: b.x, y: b.y });
1132
1132
  return a.map((b) => {
1133
- const N = d[b.id];
1134
- return N && N.length > 0 ? { ...b, handles: N } : b;
1133
+ const L = d[b.id];
1134
+ return L && L.length > 0 ? { ...b, handles: L } : b;
1135
1135
  });
1136
1136
  }, []), Ft = F(() => {
1137
- var x;
1137
+ var m;
1138
1138
  if (_t.current) return;
1139
1139
  const a = Q(ee.current);
1140
- (x = Et.current) == null || x.postMessage({ type: "nodes", data: { nodes: a } });
1140
+ (m = Et.current) == null || m.postMessage({ type: "nodes", data: { nodes: a } });
1141
1141
  }, [Q]);
1142
1142
  ft(() => {
1143
1143
  var d;
1144
1144
  if (_t.current) {
1145
- const b = _t.current.id, N = /* @__PURE__ */ new Set([b, ..._t.current.selectedStarts.map((h) => h.id)]), I = {};
1146
- for (const h of Z.current)
1147
- N.has(h.id) && (I[h.id] = { ...h.position });
1145
+ const b = _t.current.id, L = /* @__PURE__ */ new Set([b, ..._t.current.selectedStarts.map((y) => y.id)]), I = {};
1146
+ for (const y of Z.current)
1147
+ L.has(y.id) && (I[y.id] = { ...y.position });
1148
1148
  Z.current = [...e];
1149
- for (const h of Z.current)
1150
- I[h.id] && (h.position = I[h.id]);
1149
+ for (const y of Z.current)
1150
+ I[y.id] && (y.position = I[y.id]);
1151
1151
  ee.current = ze(Z.current);
1152
1152
  return;
1153
1153
  }
1154
1154
  Z.current = [...e];
1155
1155
  const a = ze(e);
1156
1156
  ee.current = a;
1157
- const x = Q(a);
1158
- (d = Et.current) == null || d.postMessage({ type: "nodes", data: { nodes: x } });
1157
+ const m = Q(a);
1158
+ (d = Et.current) == null || d.postMessage({ type: "nodes", data: { nodes: m } });
1159
1159
  }, [e, ze, Q]), ft(() => {
1160
1160
  var a;
1161
1161
  Pt.current = [...n], (a = Et.current) == null || a.postMessage({ type: "edges", data: { edges: [...n] } });
1162
1162
  }, [n]);
1163
- const at = F((a, x) => {
1163
+ const at = F((a, m) => {
1164
1164
  const d = vt.current;
1165
1165
  if (!d) return { x: 0, y: 0 };
1166
- const b = d.getBoundingClientRect(), N = pt.current;
1166
+ const b = d.getBoundingClientRect(), L = pt.current;
1167
1167
  return {
1168
- x: (a - b.left - N.x) / N.zoom,
1169
- y: (x - b.top - N.y) / N.zoom
1168
+ x: (a - b.left - L.x) / L.zoom,
1169
+ y: (m - b.top - L.y) / L.zoom
1170
1170
  };
1171
- }, []), Tt = F((a, x) => {
1171
+ }, []), Tt = F((a, m) => {
1172
1172
  const d = ee.current.length > 0 ? ee.current : Z.current;
1173
1173
  let b = null;
1174
- for (let N = d.length - 1; N >= 0; N--) {
1175
- const I = d[N];
1174
+ for (let L = d.length - 1; L >= 0; L--) {
1175
+ const I = d[L];
1176
1176
  if (I.hidden) continue;
1177
- const h = I._absolutePosition || I.position, A = I.width || Vt, T = I.height || jt;
1178
- if (a >= h.x && a <= h.x + A && x >= h.y && x <= h.y + T) {
1177
+ const y = I._absolutePosition || I.position, A = I.width || Vt, P = I.height || jt;
1178
+ if (a >= y.x && a <= y.x + A && m >= y.y && m <= y.y + P) {
1179
1179
  if (I.type === "group") {
1180
1180
  b || (b = I);
1181
1181
  continue;
@@ -1184,58 +1184,58 @@ function Nr({
1184
1184
  }
1185
1185
  }
1186
1186
  return b;
1187
- }, []), xe = F((a, x) => {
1188
- const d = x.width || Vt, b = x.height || jt;
1187
+ }, []), xe = F((a, m) => {
1188
+ const d = m.width || Vt, b = m.height || jt;
1189
1189
  if (a.x !== void 0 && a.y !== void 0)
1190
- return { x: x.position.x + a.x, y: x.position.y + a.y };
1190
+ return { x: m.position.x + a.x, y: m.position.y + a.y };
1191
1191
  switch (a.position || (a.type === "source" ? "right" : "left")) {
1192
1192
  case "top":
1193
- return { x: x.position.x + d / 2, y: x.position.y };
1193
+ return { x: m.position.x + d / 2, y: m.position.y };
1194
1194
  case "bottom":
1195
- return { x: x.position.x + d / 2, y: x.position.y + b };
1195
+ return { x: m.position.x + d / 2, y: m.position.y + b };
1196
1196
  case "left":
1197
- return { x: x.position.x, y: x.position.y + b / 2 };
1197
+ return { x: m.position.x, y: m.position.y + b / 2 };
1198
1198
  case "right":
1199
- return { x: x.position.x + d, y: x.position.y + b / 2 };
1199
+ return { x: m.position.x + d, y: m.position.y + b / 2 };
1200
1200
  default:
1201
- return { x: x.position.x + d, y: x.position.y + b / 2 };
1201
+ return { x: m.position.x + d, y: m.position.y + b / 2 };
1202
1202
  }
1203
1203
  }, []), Ee = F((a) => {
1204
- const x = a.width || Vt, d = a.height || jt;
1204
+ const m = a.width || Vt, d = a.height || jt;
1205
1205
  return a.handles && a.handles.length > 0 ? a.handles.map((b) => {
1206
- const N = xe(b, a);
1207
- return { id: b.id || null, type: b.type, x: N.x, y: N.y };
1206
+ const L = xe(b, a);
1207
+ return { id: b.id || null, type: b.type, x: L.x, y: L.y };
1208
1208
  }) : [
1209
1209
  { id: null, type: "target", x: a.position.x, y: a.position.y + d / 2 },
1210
- { id: null, type: "source", x: a.position.x + x, y: a.position.y + d / 2 }
1210
+ { id: null, type: "source", x: a.position.x + m, y: a.position.y + d / 2 }
1211
1211
  ];
1212
- }, [xe]), tn = F((a, x) => {
1213
- const d = Z.current, b = pt.current, N = Math.max(Lr, Ot) / b.zoom;
1212
+ }, [xe]), tn = F((a, m) => {
1213
+ const d = Z.current, b = pt.current, L = Math.max(Nr, Ot) / b.zoom;
1214
1214
  for (let I = d.length - 1; I >= 0; I--) {
1215
- const h = d[I];
1216
- if (h.hidden) continue;
1217
- const A = Ee(h);
1218
- for (const T of A)
1219
- if (Math.abs(a - T.x) < N && Math.abs(x - T.y) < N)
1220
- return { nodeId: h.id, handleId: T.id, type: T.type, x: T.x, y: T.y };
1215
+ const y = d[I];
1216
+ if (y.hidden) continue;
1217
+ const A = Ee(y);
1218
+ for (const P of A)
1219
+ if (Math.abs(a - P.x) < L && Math.abs(m - P.y) < L)
1220
+ return { nodeId: y.id, handleId: P.id, type: P.type, x: P.x, y: P.y };
1221
1221
  }
1222
1222
  return null;
1223
- }, [Ee]), ue = F((a, x) => {
1223
+ }, [Ee]), ue = F((a, m) => {
1224
1224
  const b = 8 / pt.current.zoom;
1225
- for (let N = Pt.current.length - 1; N >= 0; N--) {
1226
- const I = Pt.current[N], h = Z.current.find((Mt) => Mt.id === I.source), A = Z.current.find((Mt) => Mt.id === I.target);
1227
- if (!h || !A) continue;
1228
- const T = h.width || Vt, Y = h.height || jt, H = A.height || jt, J = h.position.x + T, ct = h.position.y + Y / 2, U = A.position.x, nt = A.position.y + H / 2;
1229
- if (Ir(a, x, J, ct, U, nt) < b) return I;
1225
+ for (let L = Pt.current.length - 1; L >= 0; L--) {
1226
+ const I = Pt.current[L], y = Z.current.find((Mt) => Mt.id === I.source), A = Z.current.find((Mt) => Mt.id === I.target);
1227
+ if (!y || !A) continue;
1228
+ const P = y.width || Vt, Y = y.height || jt, H = A.height || jt, J = y.position.x + P, ct = y.position.y + Y / 2, U = A.position.x, nt = A.position.y + H / 2;
1229
+ if (Ir(a, m, J, ct, U, nt) < b) return I;
1230
1230
  }
1231
1231
  return null;
1232
1232
  }, []);
1233
1233
  ft(() => {
1234
- const a = Te.current, x = vt.current;
1235
- if (!a || !x) return;
1236
- const d = x.getBoundingClientRect(), b = st !== void 0 ? st : matchMedia("(prefers-color-scheme: dark)").matches, N = ze(Z.current);
1237
- ee.current = N;
1238
- const I = Q(N), { worker: h } = Cr(a, {
1234
+ const a = Te.current, m = vt.current;
1235
+ if (!a || !m) return;
1236
+ const d = m.getBoundingClientRect(), b = st !== void 0 ? st : matchMedia("(prefers-color-scheme: dark)").matches, L = ze(Z.current);
1237
+ ee.current = L;
1238
+ const I = Q(L), { worker: y } = Cr(a, {
1239
1239
  width: d.width,
1240
1240
  height: d.height,
1241
1241
  camera: pt.current,
@@ -1246,18 +1246,18 @@ function Nr({
1246
1246
  gridSize: It,
1247
1247
  edgeRouting: fe
1248
1248
  });
1249
- h.onmessage = (H) => {
1249
+ y.onmessage = (H) => {
1250
1250
  var J, ct;
1251
1251
  H.data.type === "hud" && ((J = ge.current) == null || J.call(ge, H.data.data)), H.data.type === "ready" && pn(!0), H.data.type === "nodesProcessed" && ((ct = pe.current) == null || ct.call(pe, H.data.data));
1252
- }, Et.current = h;
1252
+ }, Et.current = y;
1253
1253
  const A = new ResizeObserver((H) => {
1254
1254
  const { width: J, height: ct } = H[0].contentRect;
1255
- h.postMessage({ type: "resize", data: { width: J, height: ct } });
1255
+ y.postMessage({ type: "resize", data: { width: J, height: ct } });
1256
1256
  });
1257
- A.observe(x);
1258
- let T, Y;
1259
- return st === void 0 && (T = matchMedia("(prefers-color-scheme: dark)"), Y = (H) => h.postMessage({ type: "theme", data: { dark: H.matches } }), T.addEventListener("change", Y)), () => {
1260
- A.disconnect(), T && Y && T.removeEventListener("change", Y), Et.current = null;
1257
+ A.observe(m);
1258
+ let P, Y;
1259
+ return st === void 0 && (P = matchMedia("(prefers-color-scheme: dark)"), Y = (H) => y.postMessage({ type: "theme", data: { dark: H.matches } }), P.addEventListener("change", Y)), () => {
1260
+ A.disconnect(), P && Y && P.removeEventListener("change", Y), Et.current = null;
1261
1261
  };
1262
1262
  }, []), ft(() => {
1263
1263
  var a;
@@ -1266,69 +1266,69 @@ function Nr({
1266
1266
  var a;
1267
1267
  (a = Et.current) == null || a.postMessage({ type: "edgeRouting", data: { enabled: fe } });
1268
1268
  }, [fe]);
1269
- const Nn = tt(0), Ct = F((a = null) => {
1270
- var b, N, I;
1271
- const x = pt.current;
1269
+ const Ln = tt(0), Ct = F((a = null) => {
1270
+ var b, L, I;
1271
+ const m = pt.current;
1272
1272
  if (re) {
1273
- const h = vt.current;
1274
- if (h) {
1275
- const A = h.getBoundingClientRect(), T = -re[1][0] * x.zoom + A.width, Y = -re[1][1] * x.zoom + A.height, H = -re[0][0] * x.zoom, J = -re[0][1] * x.zoom;
1276
- x.x = Math.min(H, Math.max(T, x.x)), x.y = Math.min(J, Math.max(Y, x.y));
1273
+ const y = vt.current;
1274
+ if (y) {
1275
+ const A = y.getBoundingClientRect(), P = -re[1][0] * m.zoom + A.width, Y = -re[1][1] * m.zoom + A.height, H = -re[0][0] * m.zoom, J = -re[0][1] * m.zoom;
1276
+ m.x = Math.min(H, Math.max(P, m.x)), m.y = Math.min(J, Math.max(Y, m.y));
1277
1277
  }
1278
1278
  }
1279
- (b = Et.current) == null || b.postMessage({ type: "camera", data: { camera: { ...x } } });
1280
- const d = { x: x.x, y: x.y, zoom: x.zoom };
1281
- (I = (N = O.current).onMove) == null || I.call(N, a, d);
1282
- for (const h of Kt) h(d);
1283
- cancelAnimationFrame(Nn.current), Nn.current = requestAnimationFrame(() => {
1284
- Je({ x: x.x, y: x.y, zoom: x.zoom });
1279
+ (b = Et.current) == null || b.postMessage({ type: "camera", data: { camera: { ...m } } });
1280
+ const d = { x: m.x, y: m.y, zoom: m.zoom };
1281
+ (I = (L = O.current).onMove) == null || I.call(L, a, d);
1282
+ for (const y of Kt) y(d);
1283
+ cancelAnimationFrame(Ln.current), Ln.current = requestAnimationFrame(() => {
1284
+ Je({ x: m.x, y: m.y, zoom: m.zoom });
1285
1285
  });
1286
1286
  }, [Kt, re]), Ce = F(() => {
1287
1287
  var d, b;
1288
- const a = Wt.current, x = Me.current;
1289
- a && x ? ((d = Et.current) == null || d.postMessage({ type: "connecting", data: { from: a.startPos, to: x, _routedPoints: null } }), ae({ source: a.sourceId, sourceHandle: a.sourceHandle, target: null, targetHandle: null })) : ((b = Et.current) == null || b.postMessage({ type: "connecting", data: null }), ae(null));
1290
- }, []), Le = F(() => {
1291
- var x, d;
1288
+ const a = Wt.current, m = Me.current;
1289
+ a && m ? ((d = Et.current) == null || d.postMessage({ type: "connecting", data: { from: a.startPos, to: m, _routedPoints: null } }), ae({ source: a.sourceId, sourceHandle: a.sourceHandle, target: null, targetHandle: null })) : ((b = Et.current) == null || b.postMessage({ type: "connecting", data: null }), ae(null));
1290
+ }, []), Ne = F(() => {
1291
+ var m, d;
1292
1292
  const a = ie.current;
1293
- a ? (x = Et.current) == null || x.postMessage({ type: "selectionBox", data: a }) : (d = Et.current) == null || d.postMessage({ type: "selectionBox", data: null });
1293
+ a ? (m = Et.current) == null || m.postMessage({ type: "selectionBox", data: a }) : (d = Et.current) == null || d.postMessage({ type: "selectionBox", data: null });
1294
1294
  }, []), dr = F((a) => {
1295
- var N, I, h, A, T, Y, H, J, ct, U, nt, wt, Mt, At, Xt, Ht;
1296
- const x = Z.current.length > 0, d = at(a.clientX, a.clientY), b = Ut.current;
1297
- if (x && Rt) {
1298
- const W = tn(d.x, d.y);
1299
- if (Yt && Re.current && W) {
1295
+ var L, I, y, A, P, Y, H, J, ct, U, nt, wt, Mt, At, Xt, Ht;
1296
+ const m = Z.current.length > 0, d = at(a.clientX, a.clientY), b = Ut.current;
1297
+ if (m && Rt) {
1298
+ const X = tn(d.x, d.y);
1299
+ if (Yt && Re.current && X) {
1300
1300
  const V = Re.current;
1301
- if (W.nodeId !== V.nodeId) {
1302
- const qt = V.handleType === "target" ? { source: W.nodeId, target: V.nodeId, sourceHandle: W.handleId || null, targetHandle: V.handleId } : { source: V.nodeId, target: W.nodeId, sourceHandle: V.handleId, targetHandle: W.handleId || null };
1303
- (O.current.isValidConnection ? O.current.isValidConnection(qt) : !0) && ((N = ce.current) == null || N.call(ce, { ...qt, ...be }));
1301
+ if (X.nodeId !== V.nodeId) {
1302
+ const qt = V.handleType === "target" ? { source: X.nodeId, target: V.nodeId, sourceHandle: X.handleId || null, targetHandle: V.handleId } : { source: V.nodeId, target: X.nodeId, sourceHandle: V.handleId, targetHandle: X.handleId || null };
1303
+ (O.current.isValidConnection ? O.current.isValidConnection(qt) : !0) && ((L = ce.current) == null || L.call(ce, { ...qt, ...be }));
1304
1304
  }
1305
1305
  Re.current = null;
1306
1306
  return;
1307
1307
  }
1308
- if (Bt === "strict" ? W && W.type === "source" : W != null) {
1308
+ if (Bt === "strict" ? X && X.type === "source" : X != null) {
1309
1309
  if (Yt) {
1310
- Re.current = { nodeId: W.nodeId, handleId: W.handleId || null, handleType: W.type }, (h = (I = O.current).onConnectStart) == null || h.call(I, a, { nodeId: W.nodeId, handleId: W.handleId, handleType: W.type });
1310
+ Re.current = { nodeId: X.nodeId, handleId: X.handleId || null, handleType: X.type }, (y = (I = O.current).onConnectStart) == null || y.call(I, a, { nodeId: X.nodeId, handleId: X.handleId, handleType: X.type });
1311
1311
  return;
1312
1312
  }
1313
1313
  Wt.current = {
1314
- sourceId: W.nodeId,
1315
- sourceHandle: W.handleId || null,
1316
- sourceType: W.type,
1317
- startPos: { x: W.x, y: W.y }
1318
- }, Me.current = { x: d.x, y: d.y }, (A = vt.current) == null || A.setPointerCapture(a.pointerId), (Y = (T = O.current).onConnectStart) == null || Y.call(T, a, { nodeId: W.nodeId, handleId: W.handleId, handleType: W.type }), Ce();
1314
+ sourceId: X.nodeId,
1315
+ sourceHandle: X.handleId || null,
1316
+ sourceType: X.type,
1317
+ startPos: { x: X.x, y: X.y }
1318
+ }, Me.current = { x: d.x, y: d.y }, (A = vt.current) == null || A.setPointerCapture(a.pointerId), (Y = (P = O.current).onConnectStart) == null || Y.call(P, a, { nodeId: X.nodeId, handleId: X.handleId, handleType: X.type }), Ce();
1319
1319
  return;
1320
1320
  }
1321
1321
  }
1322
- if (x) {
1323
- const W = Tt(d.x, d.y);
1324
- if (W) {
1325
- if (bt.current && Nt) {
1322
+ if (m) {
1323
+ const X = Tt(d.x, d.y);
1324
+ if (X) {
1325
+ if (bt.current && Lt) {
1326
1326
  const kt = [];
1327
1327
  if (b)
1328
- kt.push({ id: W.id, type: "select", selected: !W.selected });
1329
- else if (!W.selected) {
1328
+ kt.push({ id: X.id, type: "select", selected: !X.selected });
1329
+ else if (!X.selected) {
1330
1330
  for (const V of Z.current)
1331
- V.id === W.id ? kt.push({ id: V.id, type: "select", selected: !0 }) : V.selected && kt.push({ id: V.id, type: "select", selected: !1 });
1331
+ V.id === X.id ? kt.push({ id: V.id, type: "select", selected: !0 }) : V.selected && kt.push({ id: V.id, type: "select", selected: !1 });
1332
1332
  if (Dt.current) {
1333
1333
  const V = Pt.current.filter((et) => et.selected).map((et) => ({ id: et.id, type: "select", selected: !1 }));
1334
1334
  V.length && Dt.current(V);
@@ -1336,32 +1336,32 @@ function Nr({
1336
1336
  }
1337
1337
  if (kt.length) {
1338
1338
  if (bt.current(kt), hn && !b) {
1339
- const V = Z.current.findIndex((et) => et.id === W.id);
1339
+ const V = Z.current.findIndex((et) => et.id === X.id);
1340
1340
  V >= 0 && V < Z.current.length - 1 && bt.current([
1341
- { id: W.id, type: "remove" },
1341
+ { id: X.id, type: "remove" },
1342
1342
  { type: "add", item: { ...Z.current[V], selected: !0 } }
1343
1343
  ]);
1344
1344
  }
1345
1345
  Jt();
1346
1346
  }
1347
1347
  }
1348
- if ((H = De.current) == null || H.call(De, a, W), ht) {
1349
- const kt = b && W.selected;
1348
+ if ((H = De.current) == null || H.call(De, a, X), ht) {
1349
+ const kt = b && X.selected;
1350
1350
  let V = null;
1351
- if (W.parentId && W.extent === "parent") {
1352
- const et = Z.current.find((qt) => qt.id === W.parentId);
1351
+ if (X.parentId && X.extent === "parent") {
1352
+ const et = Z.current.find((qt) => qt.id === X.parentId);
1353
1353
  if (et) {
1354
- const qt = et.width || Vt, Xe = et.height || jt, en = W.width || ((J = W.measured) == null ? void 0 : J.width) || Vt, Fe = W.height || ((ct = W.measured) == null ? void 0 : ct.height) || jt;
1354
+ const qt = et.width || Vt, Xe = et.height || jt, en = X.width || ((J = X.measured) == null ? void 0 : J.width) || Vt, Fe = X.height || ((ct = X.measured) == null ? void 0 : ct.height) || jt;
1355
1355
  V = { minX: 0, minY: 0, maxX: qt - en, maxY: Xe - Fe };
1356
1356
  }
1357
1357
  }
1358
1358
  if (_t.current = {
1359
- id: W.id,
1360
- startPos: { ...W.position },
1359
+ id: X.id,
1360
+ startPos: { ...X.position },
1361
1361
  startMouse: { x: d.x, y: d.y },
1362
1362
  parentClamp: V,
1363
- parentId: W.parentId || null,
1364
- selectedStarts: kt ? Z.current.filter((et) => et.selected && et.id !== W.id).map((et) => {
1363
+ parentId: X.parentId || null,
1364
+ selectedStarts: kt ? Z.current.filter((et) => et.selected && et.id !== X.id).map((et) => {
1365
1365
  var Xe, en;
1366
1366
  let qt = null;
1367
1367
  if (et.parentId && et.extent === "parent") {
@@ -1373,8 +1373,8 @@ function Nr({
1373
1373
  }
1374
1374
  return { id: et.id, startPos: { ...et.position }, parentClamp: qt, parentId: et.parentId || null };
1375
1375
  }) : []
1376
- }, (U = vt.current) == null || U.setPointerCapture(a.pointerId), (nt = Ae.current) == null || nt.call(Ae, a, W), bt.current) {
1377
- const et = [{ id: W.id, type: "position", dragging: !0 }];
1376
+ }, (U = vt.current) == null || U.setPointerCapture(a.pointerId), (nt = Ae.current) == null || nt.call(Ae, a, X), bt.current) {
1377
+ const et = [{ id: X.id, type: "position", dragging: !0 }];
1378
1378
  for (const qt of _t.current.selectedStarts)
1379
1379
  et.push({ id: qt.id, type: "position", dragging: !0 });
1380
1380
  bt.current(et);
@@ -1383,16 +1383,16 @@ function Nr({
1383
1383
  return;
1384
1384
  }
1385
1385
  }
1386
- if (Pt.current.length > 0 && Nt) {
1387
- const W = ue(d.x, d.y);
1388
- if (W) {
1386
+ if (Pt.current.length > 0 && Lt) {
1387
+ const X = ue(d.x, d.y);
1388
+ if (X) {
1389
1389
  if (Dt.current) {
1390
1390
  const kt = [];
1391
1391
  if (b)
1392
- kt.push({ id: W.id, type: "select", selected: !W.selected });
1392
+ kt.push({ id: X.id, type: "select", selected: !X.selected });
1393
1393
  else {
1394
1394
  for (const V of Pt.current)
1395
- V.id === W.id ? kt.push({ id: V.id, type: "select", selected: !0 }) : V.selected && kt.push({ id: V.id, type: "select", selected: !1 });
1395
+ V.id === X.id ? kt.push({ id: V.id, type: "select", selected: !0 }) : V.selected && kt.push({ id: V.id, type: "select", selected: !1 });
1396
1396
  if (bt.current) {
1397
1397
  const V = Z.current.filter((et) => et.selected).map((et) => ({ id: et.id, type: "select", selected: !1 }));
1398
1398
  V.length && bt.current(V);
@@ -1400,40 +1400,40 @@ function Nr({
1400
1400
  }
1401
1401
  kt.length && (Dt.current(kt), Jt());
1402
1402
  }
1403
- (wt = le.current) == null || wt.call(le, a, W);
1403
+ (wt = le.current) == null || wt.call(le, a, X);
1404
1404
  return;
1405
1405
  }
1406
1406
  }
1407
1407
  if (!b) {
1408
- const W = Z.current.filter((V) => V.selected).map((V) => ({ id: V.id, type: "select", selected: !1 })), kt = Pt.current.filter((V) => V.selected).map((V) => ({ id: V.id, type: "select", selected: !1 }));
1409
- W.length && bt.current && bt.current(W), kt.length && Dt.current && Dt.current(kt), (W.length || kt.length) && Jt();
1408
+ const X = Z.current.filter((V) => V.selected).map((V) => ({ id: V.id, type: "select", selected: !1 })), kt = Pt.current.filter((V) => V.selected).map((V) => ({ id: V.id, type: "select", selected: !1 }));
1409
+ X.length && bt.current && bt.current(X), kt.length && Dt.current && Dt.current(kt), (X.length || kt.length) && Jt();
1410
1410
  }
1411
1411
  if ((Mt = We.current) == null || Mt.call(We, a), ne || b) {
1412
- ie.current = { startWorld: { ...d }, endWorld: { ...d } }, (At = vt.current) == null || At.setPointerCapture(a.pointerId), Le();
1412
+ ie.current = { startWorld: { ...d }, endWorld: { ...d } }, (At = vt.current) == null || At.setPointerCapture(a.pointerId), Ne();
1413
1413
  return;
1414
1414
  }
1415
1415
  Se.current = !0, te.current = { x: a.clientX, y: a.clientY }, (Xt = vt.current) == null || Xt.classList.add("dragging"), (Ht = vt.current) == null || Ht.setPointerCapture(a.pointerId);
1416
- }, [at, Tt, tn, ue, ht, Rt, Nt, ne, Ce, Le, Jt]), fr = F((a) => {
1416
+ }, [at, Tt, tn, ue, ht, Rt, Lt, ne, Ce, Ne, Jt]), fr = F((a) => {
1417
1417
  var d, b;
1418
1418
  if (Wt.current) {
1419
1419
  if (Me.current = at(a.clientX, a.clientY), Ce(), fn) {
1420
- const N = vt.current;
1421
- if (N) {
1422
- const I = N.getBoundingClientRect(), h = 40, A = a.clientX - I.left, T = a.clientY - I.top;
1420
+ const L = vt.current;
1421
+ if (L) {
1422
+ const I = L.getBoundingClientRect(), y = 40, A = a.clientX - I.left, P = a.clientY - I.top;
1423
1423
  let Y = 0, H = 0;
1424
- A < h ? Y = Qt : A > I.width - h && (Y = -Qt), T < h ? H = Qt : T > I.height - h && (H = -Qt), (Y || H) && (pt.current.x += Y, pt.current.y += H, Ct(a));
1424
+ A < y ? Y = Qt : A > I.width - y && (Y = -Qt), P < y ? H = Qt : P > I.height - y && (H = -Qt), (Y || H) && (pt.current.x += Y, pt.current.y += H, Ct(a));
1425
1425
  }
1426
1426
  }
1427
1427
  return;
1428
1428
  }
1429
1429
  if (ie.current) {
1430
- ie.current.endWorld = at(a.clientX, a.clientY), Le();
1431
- const N = ie.current, I = Math.min(N.startWorld.x, N.endWorld.x), h = Math.min(N.startWorld.y, N.endWorld.y), A = Math.max(N.startWorld.x, N.endWorld.x), T = Math.max(N.startWorld.y, N.endWorld.y);
1430
+ ie.current.endWorld = at(a.clientX, a.clientY), Ne();
1431
+ const L = ie.current, I = Math.min(L.startWorld.x, L.endWorld.x), y = Math.min(L.startWorld.y, L.endWorld.y), A = Math.max(L.startWorld.x, L.endWorld.x), P = Math.max(L.startWorld.y, L.endWorld.y);
1432
1432
  if (bt.current) {
1433
1433
  const Y = [];
1434
1434
  for (const H of Z.current) {
1435
1435
  if (H.hidden) continue;
1436
- const J = H.width || Vt, ct = H.height || jt, U = Ie === "full" ? H.position.x >= I && H.position.x + J <= A && H.position.y >= h && H.position.y + ct <= T : H.position.x + J > I && H.position.x < A && H.position.y + ct > h && H.position.y < T;
1436
+ const J = H.width || Vt, ct = H.height || jt, U = Ie === "full" ? H.position.x >= I && H.position.x + J <= A && H.position.y >= y && H.position.y + ct <= P : H.position.x + J > I && H.position.x < A && H.position.y + ct > y && H.position.y < P;
1437
1437
  U !== !!H.selected && Y.push({ id: H.id, type: "select", selected: U });
1438
1438
  }
1439
1439
  Y.length && bt.current(Y);
@@ -1441,15 +1441,15 @@ function Nr({
1441
1441
  return;
1442
1442
  }
1443
1443
  if (_t.current) {
1444
- const N = at(a.clientX, a.clientY), I = _t.current, h = N.x - I.startMouse.x, A = N.y - I.startMouse.y;
1445
- let T = { x: I.startPos.x + h, y: I.startPos.y + A };
1446
- if (me && (T = Pn(T, de)), oe && (T = Tn(T, oe)), I.parentClamp) {
1444
+ const L = at(a.clientX, a.clientY), I = _t.current, y = L.x - I.startMouse.x, A = L.y - I.startMouse.y;
1445
+ let P = { x: I.startPos.x + y, y: I.startPos.y + A };
1446
+ if (me && (P = Pn(P, de)), oe && (P = Tn(P, oe)), I.parentClamp) {
1447
1447
  const U = I.parentClamp;
1448
- T = { x: Math.max(U.minX, Math.min(T.x, U.maxX)), y: Math.max(U.minY, Math.min(T.y, U.maxY)) };
1448
+ P = { x: Math.max(U.minX, Math.min(P.x, U.maxX)), y: Math.max(U.minY, Math.min(P.y, U.maxY)) };
1449
1449
  }
1450
- const Y = [{ id: I.id, position: T }];
1450
+ const Y = [{ id: I.id, position: P }];
1451
1451
  for (const U of I.selectedStarts) {
1452
- let nt = { x: U.startPos.x + h, y: U.startPos.y + A };
1452
+ let nt = { x: U.startPos.x + y, y: U.startPos.y + A };
1453
1453
  if (me && (nt = Pn(nt, de)), oe && (nt = Tn(nt, oe)), U.parentClamp) {
1454
1454
  const wt = U.parentClamp;
1455
1455
  nt = { x: Math.max(wt.minX, Math.min(nt.x, wt.maxX)), y: Math.max(wt.minY, Math.min(nt.y, wt.maxY)) };
@@ -1508,12 +1508,12 @@ function Nr({
1508
1508
  return;
1509
1509
  }
1510
1510
  if (!Se.current) return;
1511
- const x = pt.current;
1512
- x.x += a.clientX - te.current.x, x.y += a.clientY - te.current.y, te.current = { x: a.clientX, y: a.clientY }, Ct();
1513
- }, [Ct, at, Ce, Le]), hr = F((a) => {
1514
- var x, d, b, N, I;
1511
+ const m = pt.current;
1512
+ m.x += a.clientX - te.current.x, m.y += a.clientY - te.current.y, te.current = { x: a.clientX, y: a.clientY }, Ct();
1513
+ }, [Ct, at, Ce, Ne]), hr = F((a) => {
1514
+ var m, d, b, L, I;
1515
1515
  if (Wt.current) {
1516
- const h = at(a.clientX, a.clientY), A = tn(h.x, h.y);
1516
+ const y = at(a.clientX, a.clientY), A = tn(y.x, y.y);
1517
1517
  if (A && A.nodeId !== Wt.current.sourceId && (Bt === "loose" || A.type === "target")) {
1518
1518
  const H = Wt.current.sourceType === "target" ? {
1519
1519
  source: A.nodeId,
@@ -1526,25 +1526,25 @@ function Nr({
1526
1526
  sourceHandle: Wt.current.sourceHandle,
1527
1527
  targetHandle: A.handleId || null
1528
1528
  };
1529
- (O.current.isValidConnection ? O.current.isValidConnection(H) : !0) && ((x = ce.current) == null || x.call(ce, { ...H, ...be }));
1529
+ (O.current.isValidConnection ? O.current.isValidConnection(H) : !0) && ((m = ce.current) == null || m.call(ce, { ...H, ...be }));
1530
1530
  }
1531
1531
  (b = (d = O.current).onConnectEnd) == null || b.call(d, a.nativeEvent || a), Wt.current = null, Me.current = null, Ce();
1532
1532
  return;
1533
1533
  }
1534
1534
  if (ie.current) {
1535
- ie.current = null, Le(), Jt();
1535
+ ie.current = null, Ne(), Jt();
1536
1536
  return;
1537
1537
  }
1538
1538
  if (_t.current) {
1539
- const h = _t.current;
1539
+ const y = _t.current;
1540
1540
  if (bt.current) {
1541
- const T = Z.current.find((H) => H.id === h.id), Y = [{
1542
- id: h.id,
1541
+ const P = Z.current.find((H) => H.id === y.id), Y = [{
1542
+ id: y.id,
1543
1543
  type: "position",
1544
- position: T ? { ...T.position } : void 0,
1544
+ position: P ? { ...P.position } : void 0,
1545
1545
  dragging: !1
1546
1546
  }];
1547
- for (const H of h.selectedStarts) {
1547
+ for (const H of y.selectedStarts) {
1548
1548
  const J = Z.current.find((ct) => ct.id === H.id);
1549
1549
  Y.push({
1550
1550
  id: H.id,
@@ -1558,198 +1558,198 @@ function Nr({
1558
1558
  requestAnimationFrame(() => {
1559
1559
  _t.current = null;
1560
1560
  });
1561
- const A = Z.current.find((T) => T.id === h.id);
1562
- A && ((N = _e.current) == null || N.call(_e, a, A));
1561
+ const A = Z.current.find((P) => P.id === y.id);
1562
+ A && ((L = _e.current) == null || L.call(_e, a, A));
1563
1563
  return;
1564
1564
  }
1565
1565
  Se.current = !1, (I = vt.current) == null || I.classList.remove("dragging");
1566
- }, [at, tn, Ce, Le, Jt]);
1566
+ }, [at, tn, Ce, Ne, Jt]);
1567
1567
  ft(() => {
1568
1568
  const a = vt.current;
1569
1569
  if (!a) return;
1570
- const x = (d) => {
1570
+ const m = (d) => {
1571
1571
  Pe && d.preventDefault();
1572
1572
  const b = pt.current;
1573
1573
  if (Ge || ke.current) {
1574
- const T = Ze;
1575
- $e === "horizontal" ? b.x -= d.deltaY * T : ($e === "vertical" || (b.x -= d.deltaX * T), b.y -= d.deltaY * T), Ct(d);
1574
+ const P = Ze;
1575
+ $e === "horizontal" ? b.x -= d.deltaY * P : ($e === "vertical" || (b.x -= d.deltaX * P), b.y -= d.deltaY * P), Ct(d);
1576
1576
  return;
1577
1577
  }
1578
1578
  if (!Oe) return;
1579
- const N = d.deltaY > 0 ? 0.92 : 1.08, I = a.getBoundingClientRect(), h = d.clientX - I.left, A = d.clientY - I.top;
1580
- b.x = h - (h - b.x) * N, b.y = A - (A - b.y) * N, b.zoom = Math.min(mt, Math.max(it, b.zoom * N)), Ct(d);
1579
+ const L = d.deltaY > 0 ? 0.92 : 1.08, I = a.getBoundingClientRect(), y = d.clientX - I.left, A = d.clientY - I.top;
1580
+ b.x = y - (y - b.x) * L, b.y = A - (A - b.y) * L, b.zoom = Math.min(mt, Math.max(it, b.zoom * L)), Ct(d);
1581
1581
  };
1582
- return a.addEventListener("wheel", x, { passive: !Pe }), () => a.removeEventListener("wheel", x);
1582
+ return a.addEventListener("wheel", m, { passive: !Pe }), () => a.removeEventListener("wheel", m);
1583
1583
  }, [Ct, it, mt, Ge, $e, Ze, Oe, Pe]), ft(() => {
1584
1584
  if (!Ke) return;
1585
1585
  const a = vt.current;
1586
1586
  if (!a) return;
1587
- let x = 0, d = null;
1588
- const b = (h) => {
1589
- if (h.touches.length === 2) {
1590
- const A = h.touches[0].clientX - h.touches[1].clientX, T = h.touches[0].clientY - h.touches[1].clientY;
1591
- x = Math.hypot(A, T);
1587
+ let m = 0, d = null;
1588
+ const b = (y) => {
1589
+ if (y.touches.length === 2) {
1590
+ const A = y.touches[0].clientX - y.touches[1].clientX, P = y.touches[0].clientY - y.touches[1].clientY;
1591
+ m = Math.hypot(A, P);
1592
1592
  const Y = a.getBoundingClientRect();
1593
1593
  d = {
1594
- x: (h.touches[0].clientX + h.touches[1].clientX) / 2 - Y.left,
1595
- y: (h.touches[0].clientY + h.touches[1].clientY) / 2 - Y.top
1596
- }, h.preventDefault();
1594
+ x: (y.touches[0].clientX + y.touches[1].clientX) / 2 - Y.left,
1595
+ y: (y.touches[0].clientY + y.touches[1].clientY) / 2 - Y.top
1596
+ }, y.preventDefault();
1597
1597
  }
1598
- }, N = (h) => {
1599
- if (h.touches.length === 2 && x > 0) {
1600
- h.preventDefault();
1601
- const A = h.touches[0].clientX - h.touches[1].clientX, T = h.touches[0].clientY - h.touches[1].clientY, Y = Math.hypot(A, T), H = Y / x;
1602
- x = Y;
1598
+ }, L = (y) => {
1599
+ if (y.touches.length === 2 && m > 0) {
1600
+ y.preventDefault();
1601
+ const A = y.touches[0].clientX - y.touches[1].clientX, P = y.touches[0].clientY - y.touches[1].clientY, Y = Math.hypot(A, P), H = Y / m;
1602
+ m = Y;
1603
1603
  const J = pt.current, ct = d.x, U = d.y;
1604
- J.x = ct - (ct - J.x) * H, J.y = U - (U - J.y) * H, J.zoom = Math.min(mt, Math.max(it, J.zoom * H)), Ct(h);
1604
+ J.x = ct - (ct - J.x) * H, J.y = U - (U - J.y) * H, J.zoom = Math.min(mt, Math.max(it, J.zoom * H)), Ct(y);
1605
1605
  }
1606
1606
  }, I = () => {
1607
- x = 0, d = null;
1607
+ m = 0, d = null;
1608
1608
  };
1609
- return a.addEventListener("touchstart", b, { passive: !1 }), a.addEventListener("touchmove", N, { passive: !1 }), a.addEventListener("touchend", I), () => {
1610
- a.removeEventListener("touchstart", b), a.removeEventListener("touchmove", N), a.removeEventListener("touchend", I);
1609
+ return a.addEventListener("touchstart", b, { passive: !1 }), a.addEventListener("touchmove", L, { passive: !1 }), a.addEventListener("touchend", I), () => {
1610
+ a.removeEventListener("touchstart", b), a.removeEventListener("touchmove", L), a.removeEventListener("touchend", I);
1611
1611
  };
1612
1612
  }, [Ke, Ct, it, mt]), ft(() => {
1613
1613
  if (!Qe) return;
1614
1614
  const a = vt.current;
1615
1615
  if (!a) return;
1616
- const x = (d) => {
1616
+ const m = (d) => {
1617
1617
  var H, J, ct, U;
1618
1618
  const b = at(d.clientX, d.clientY);
1619
1619
  if (Tt(b.x, b.y)) {
1620
1620
  (J = (H = O.current).onNodeDoubleClick) == null || J.call(H, d, Tt(b.x, b.y));
1621
1621
  return;
1622
1622
  }
1623
- const N = ue(b.x, b.y);
1624
- if (N) {
1625
- (U = (ct = O.current).onEdgeDoubleClick) == null || U.call(ct, d, N);
1623
+ const L = ue(b.x, b.y);
1624
+ if (L) {
1625
+ (U = (ct = O.current).onEdgeDoubleClick) == null || U.call(ct, d, L);
1626
1626
  return;
1627
1627
  }
1628
- const I = 1.5, h = a.getBoundingClientRect(), A = d.clientX - h.left, T = d.clientY - h.top, Y = pt.current;
1629
- Y.x = A - (A - Y.x) * I, Y.y = T - (T - Y.y) * I, Y.zoom = Math.min(mt, Math.max(it, Y.zoom * I)), Ct(d);
1628
+ const I = 1.5, y = a.getBoundingClientRect(), A = d.clientX - y.left, P = d.clientY - y.top, Y = pt.current;
1629
+ Y.x = A - (A - Y.x) * I, Y.y = P - (P - Y.y) * I, Y.zoom = Math.min(mt, Math.max(it, Y.zoom * I)), Ct(d);
1630
1630
  };
1631
- return a.addEventListener("dblclick", x), () => a.removeEventListener("dblclick", x);
1631
+ return a.addEventListener("dblclick", m), () => a.removeEventListener("dblclick", m);
1632
1632
  }, [Qe, Ct, it, mt, at, Tt, ue]), ft(() => {
1633
1633
  const a = vt.current;
1634
1634
  if (!a) return;
1635
- const x = (d) => {
1636
- var h, A, T, Y, H, J;
1637
- const b = at(d.clientX, d.clientY), N = Tt(b.x, b.y);
1638
- if (N) {
1639
- (A = (h = O.current).onNodeContextMenu) == null || A.call(h, d, N);
1635
+ const m = (d) => {
1636
+ var y, A, P, Y, H, J;
1637
+ const b = at(d.clientX, d.clientY), L = Tt(b.x, b.y);
1638
+ if (L) {
1639
+ (A = (y = O.current).onNodeContextMenu) == null || A.call(y, d, L);
1640
1640
  return;
1641
1641
  }
1642
1642
  const I = ue(b.x, b.y);
1643
1643
  if (I) {
1644
- (Y = (T = O.current).onEdgeContextMenu) == null || Y.call(T, d, I);
1644
+ (Y = (P = O.current).onEdgeContextMenu) == null || Y.call(P, d, I);
1645
1645
  return;
1646
1646
  }
1647
1647
  (J = (H = O.current).onPaneContextMenu) == null || J.call(H, d);
1648
1648
  };
1649
- return a.addEventListener("contextmenu", x), () => a.removeEventListener("contextmenu", x);
1649
+ return a.addEventListener("contextmenu", m), () => a.removeEventListener("contextmenu", m);
1650
1650
  }, [at, Tt, ue]), ft(() => {
1651
1651
  const a = vt.current;
1652
1652
  if (!a) return;
1653
- let x = null, d = null;
1654
- const b = (h) => {
1655
- var Y, H, J, ct, U, nt, wt, Mt, At, Xt, Ht, W, kt, V;
1656
- (H = (Y = O.current).onPaneMouseMove) == null || H.call(Y, h);
1657
- const A = at(h.clientX, h.clientY), T = Tt(A.x, A.y);
1658
- if (T !== x && (x && ((ct = (J = O.current).onNodeMouseLeave) == null || ct.call(J, h, x)), T && ((nt = (U = O.current).onNodeMouseEnter) == null || nt.call(U, h, T)), x = T), T && ((Mt = (wt = O.current).onNodeMouseMove) == null || Mt.call(wt, h, T)), !T) {
1653
+ let m = null, d = null;
1654
+ const b = (y) => {
1655
+ var Y, H, J, ct, U, nt, wt, Mt, At, Xt, Ht, X, kt, V;
1656
+ (H = (Y = O.current).onPaneMouseMove) == null || H.call(Y, y);
1657
+ const A = at(y.clientX, y.clientY), P = Tt(A.x, A.y);
1658
+ if (P !== m && (m && ((ct = (J = O.current).onNodeMouseLeave) == null || ct.call(J, y, m)), P && ((nt = (U = O.current).onNodeMouseEnter) == null || nt.call(U, y, P)), m = P), P && ((Mt = (wt = O.current).onNodeMouseMove) == null || Mt.call(wt, y, P)), !P) {
1659
1659
  const et = ue(A.x, A.y);
1660
- et !== d && (d && ((Xt = (At = O.current).onEdgeMouseLeave) == null || Xt.call(At, h, d)), et && ((W = (Ht = O.current).onEdgeMouseEnter) == null || W.call(Ht, h, et)), d = et), et && ((V = (kt = O.current).onEdgeMouseMove) == null || V.call(kt, h, et));
1660
+ et !== d && (d && ((Xt = (At = O.current).onEdgeMouseLeave) == null || Xt.call(At, y, d)), et && ((X = (Ht = O.current).onEdgeMouseEnter) == null || X.call(Ht, y, et)), d = et), et && ((V = (kt = O.current).onEdgeMouseMove) == null || V.call(kt, y, et));
1661
1661
  }
1662
- }, N = (h) => {
1663
- var A, T;
1664
- return (T = (A = O.current).onPaneMouseEnter) == null ? void 0 : T.call(A, h);
1665
- }, I = (h) => {
1666
- var A, T, Y, H, J, ct;
1667
- (T = (A = O.current).onPaneMouseLeave) == null || T.call(A, h), x && ((H = (Y = O.current).onNodeMouseLeave) == null || H.call(Y, h, x), x = null), d && ((ct = (J = O.current).onEdgeMouseLeave) == null || ct.call(J, h, d), d = null);
1662
+ }, L = (y) => {
1663
+ var A, P;
1664
+ return (P = (A = O.current).onPaneMouseEnter) == null ? void 0 : P.call(A, y);
1665
+ }, I = (y) => {
1666
+ var A, P, Y, H, J, ct;
1667
+ (P = (A = O.current).onPaneMouseLeave) == null || P.call(A, y), m && ((H = (Y = O.current).onNodeMouseLeave) == null || H.call(Y, y, m), m = null), d && ((ct = (J = O.current).onEdgeMouseLeave) == null || ct.call(J, y, d), d = null);
1668
1668
  };
1669
- return a.addEventListener("mousemove", b), a.addEventListener("mouseenter", N), a.addEventListener("mouseleave", I), () => {
1670
- a.removeEventListener("mousemove", b), a.removeEventListener("mouseenter", N), a.removeEventListener("mouseleave", I);
1669
+ return a.addEventListener("mousemove", b), a.addEventListener("mouseenter", L), a.addEventListener("mouseleave", I), () => {
1670
+ a.removeEventListener("mousemove", b), a.removeEventListener("mouseenter", L), a.removeEventListener("mouseleave", I);
1671
1671
  };
1672
1672
  }, [at, Tt, ue]), ft(() => {
1673
- const a = Array.isArray(ve) ? ve : [ve], x = async (d) => {
1674
- var b, N;
1673
+ const a = Array.isArray(ve) ? ve : [ve], m = async (d) => {
1674
+ var b, L;
1675
1675
  if (a.includes(d.key)) {
1676
1676
  if (d.target.tagName === "INPUT" || d.target.tagName === "TEXTAREA" || d.target.isContentEditable) return;
1677
- const I = Z.current.filter((T) => T.selected), h = Pt.current.filter((T) => T.selected);
1678
- if (!I.length && !h.length || O.current.onBeforeDelete && !await O.current.onBeforeDelete({ nodes: I, edges: h }))
1677
+ const I = Z.current.filter((P) => P.selected), y = Pt.current.filter((P) => P.selected);
1678
+ if (!I.length && !y.length || O.current.onBeforeDelete && !await O.current.onBeforeDelete({ nodes: I, edges: y }))
1679
1679
  return;
1680
- const A = new Set(I.map((T) => T.id));
1681
- if (I.length && bt.current && (bt.current(I.map((T) => ({ id: T.id, type: "remove" }))), Dt.current)) {
1682
- const T = Pt.current.filter((Y) => A.has(Y.source) || A.has(Y.target));
1683
- T.length && Dt.current(T.map((Y) => ({ id: Y.id, type: "remove" })));
1680
+ const A = new Set(I.map((P) => P.id));
1681
+ if (I.length && bt.current && (bt.current(I.map((P) => ({ id: P.id, type: "remove" }))), Dt.current)) {
1682
+ const P = Pt.current.filter((Y) => A.has(Y.source) || A.has(Y.target));
1683
+ P.length && Dt.current(P.map((Y) => ({ id: Y.id, type: "remove" })));
1684
1684
  }
1685
- h.length && Dt.current && Dt.current(h.map((T) => ({ id: T.id, type: "remove" }))), (N = (b = O.current).onDelete) == null || N.call(b, { nodes: I, edges: h });
1685
+ y.length && Dt.current && Dt.current(y.map((P) => ({ id: P.id, type: "remove" }))), (L = (b = O.current).onDelete) == null || L.call(b, { nodes: I, edges: y });
1686
1686
  }
1687
1687
  if ((d.ctrlKey || d.metaKey) && d.key === "a") {
1688
1688
  if (d.target.tagName === "INPUT" || d.target.tagName === "TEXTAREA") return;
1689
1689
  if (d.preventDefault(), bt.current) {
1690
- const I = Z.current.filter((h) => !h.selected).map((h) => ({ id: h.id, type: "select", selected: !0 }));
1690
+ const I = Z.current.filter((y) => !y.selected).map((y) => ({ id: y.id, type: "select", selected: !0 }));
1691
1691
  I.length && bt.current(I);
1692
1692
  }
1693
1693
  if (Dt.current) {
1694
- const I = Pt.current.filter((h) => !h.selected).map((h) => ({ id: h.id, type: "select", selected: !0 }));
1694
+ const I = Pt.current.filter((y) => !y.selected).map((y) => ({ id: y.id, type: "select", selected: !0 }));
1695
1695
  I.length && Dt.current(I);
1696
1696
  }
1697
1697
  }
1698
1698
  };
1699
- return window.addEventListener("keydown", x), () => window.removeEventListener("keydown", x);
1699
+ return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
1700
1700
  }, [ve]);
1701
1701
  const In = tt(!1);
1702
1702
  ft(() => {
1703
- var a, x;
1703
+ var a, m;
1704
1704
  if (!In.current && Et.current) {
1705
1705
  if (In.current = !0, zt && Z.current.length > 0) {
1706
1706
  const d = vt.current;
1707
1707
  if (d) {
1708
- const b = d.getBoundingClientRect(), N = (dt == null ? void 0 : dt.padding) ?? 0.1, I = Mn(Z.current), h = Rn(I, b.width, b.height, N);
1709
- dt != null && dt.maxZoom && (h.zoom = Math.min(h.zoom, dt.maxZoom)), dt != null && dt.minZoom && (h.zoom = Math.max(h.zoom, dt.minZoom)), pt.current = h, Ct();
1708
+ const b = d.getBoundingClientRect(), L = (dt == null ? void 0 : dt.padding) ?? 0.1, I = Mn(Z.current), y = Rn(I, b.width, b.height, L);
1709
+ dt != null && dt.maxZoom && (y.zoom = Math.min(y.zoom, dt.maxZoom)), dt != null && dt.minZoom && (y.zoom = Math.max(y.zoom, dt.minZoom)), pt.current = y, Ct();
1710
1710
  }
1711
1711
  }
1712
- (x = (a = O.current).onInit) == null || x.call(a, {
1712
+ (m = (a = O.current).onInit) == null || m.call(a, {
1713
1713
  getNodes: () => [...Z.current],
1714
1714
  getEdges: () => [...Pt.current],
1715
1715
  getViewport: () => ({ ...pt.current }),
1716
1716
  fitView: (d = {}) => {
1717
1717
  const b = vt.current;
1718
1718
  if (!b || !Z.current.length) return;
1719
- const N = b.getBoundingClientRect(), I = Mn(Z.current), h = Rn(I, N.width, N.height, d.padding ?? 0.1);
1720
- pt.current = h, Ct();
1719
+ const L = b.getBoundingClientRect(), I = Mn(Z.current), y = Rn(I, L.width, L.height, d.padding ?? 0.1);
1720
+ pt.current = y, Ct();
1721
1721
  }
1722
1722
  });
1723
1723
  }
1724
1724
  });
1725
1725
  const yr = F(() => {
1726
- pt.current = { ...Lt }, Ct();
1727
- }, [Ct, Lt]), gr = F((a) => {
1728
- var x;
1726
+ pt.current = { ...Nt }, Ct();
1727
+ }, [Ct, Nt]), gr = F((a) => {
1728
+ var m;
1729
1729
  if (a)
1730
1730
  se.current.push(a);
1731
1731
  else {
1732
1732
  const d = pt.current, b = vt.current;
1733
1733
  if (!b) return;
1734
- const N = b.getBoundingClientRect(), I = Math.round(-d.x / d.zoom + N.width / 2 / d.zoom), h = Math.round(-d.y / d.zoom + N.height / 2 / d.zoom);
1734
+ const L = b.getBoundingClientRect(), I = Math.round(-d.x / d.zoom + L.width / 2 / d.zoom), y = Math.round(-d.y / d.zoom + L.height / 2 / d.zoom);
1735
1735
  se.current.push({
1736
1736
  x: I - 80,
1737
- y: h - 45,
1737
+ y: y - 45,
1738
1738
  w: 160,
1739
1739
  h: 90,
1740
1740
  title: "Note " + (se.current.length + 1),
1741
1741
  body: "Added at viewport center"
1742
1742
  });
1743
1743
  }
1744
- (x = Et.current) == null || x.postMessage({ type: "cards", data: { cards: [...se.current] } });
1744
+ (m = Et.current) == null || m.postMessage({ type: "cards", data: { cards: [...se.current] } });
1745
1745
  }, []), pr = F((a) => {
1746
1746
  if (a.id || (a.id = "node-" + Date.now()), !a.position) {
1747
- const x = pt.current, d = vt.current;
1747
+ const m = pt.current, d = vt.current;
1748
1748
  if (!d) return;
1749
1749
  const b = d.getBoundingClientRect();
1750
1750
  a.position = {
1751
- x: Math.round(-x.x / x.zoom + b.width / 2 / x.zoom) - Vt / 2,
1752
- y: Math.round(-x.y / x.zoom + b.height / 2 / x.zoom) - jt / 2
1751
+ x: Math.round(-m.x / m.zoom + b.width / 2 / m.zoom) - Vt / 2,
1752
+ y: Math.round(-m.y / m.zoom + b.height / 2 / m.zoom) - jt / 2
1753
1753
  };
1754
1754
  }
1755
1755
  a.data || (a.data = { label: a.id }), bt.current && bt.current([{ type: "add", item: a }]);
@@ -1828,36 +1828,36 @@ function Ro() {
1828
1828
  return qe(je);
1829
1829
  }
1830
1830
  function $r({ node: t, nodeType: e }) {
1831
- var m, C, z;
1831
+ var v, N, z;
1832
1832
  const n = yt(), r = tt(null), s = t._absolutePosition || t.position, o = tt(null);
1833
1833
  ft(() => {
1834
- const M = r.current;
1835
- if (!M) return;
1836
- const $ = new ResizeObserver((R) => {
1837
- var D, g, f, p;
1838
- const { width: E, height: _ } = R[0].contentRect;
1834
+ const R = r.current;
1835
+ if (!R) return;
1836
+ const $ = new ResizeObserver((k) => {
1837
+ var B, D, f, h;
1838
+ const { width: E, height: _ } = k[0].contentRect;
1839
1839
  if (E > 0 && _ > 0) {
1840
- const v = n.nodesRef.current.find((P) => P.id === t.id), L = (v == null ? void 0 : v.width) || ((D = v == null ? void 0 : v.measured) == null ? void 0 : D.width), w = (v == null ? void 0 : v.height) || ((g = v == null ? void 0 : v.measured) == null ? void 0 : g.height);
1841
- (Math.abs((L || 0) - E) > 1 || Math.abs((w || 0) - _) > 1) && ((p = (f = n.onNodesChangeRef).current) == null || p.call(f, [
1840
+ const p = n.nodesRef.current.find((C) => C.id === t.id), M = (p == null ? void 0 : p.width) || ((B = p == null ? void 0 : p.measured) == null ? void 0 : B.width), w = (p == null ? void 0 : p.height) || ((D = p == null ? void 0 : p.measured) == null ? void 0 : D.height);
1841
+ (Math.abs((M || 0) - E) > 1 || Math.abs((w || 0) - _) > 1) && ((h = (f = n.onNodesChangeRef).current) == null || h.call(f, [
1842
1842
  { id: t.id, type: "dimensions", dimensions: { width: E, height: _ }, setAttributes: !0 }
1843
1843
  ]));
1844
1844
  }
1845
1845
  });
1846
- return $.observe(M), () => $.disconnect();
1846
+ return $.observe(R), () => $.disconnect();
1847
1847
  }, [t.id, n]);
1848
- const i = F((M) => {
1849
- var B, j, X, xt;
1850
- M.stopPropagation();
1851
- const $ = M.target.tagName;
1852
- if ($ === "INPUT" || $ === "TEXTAREA" || $ === "SELECT" || $ === "BUTTON" || $ === "A" || $ === "LABEL" || M.target.isContentEditable) return;
1853
- let R = M.target;
1854
- for (; R && R !== r.current; ) {
1855
- if ((B = R.classList) != null && B.contains("nodrag") || (j = R.classList) != null && j.contains("nopan")) return;
1856
- R = R.parentElement;
1848
+ const i = F((R) => {
1849
+ var T, j, W, xt;
1850
+ R.stopPropagation();
1851
+ const $ = R.target.tagName;
1852
+ if ($ === "INPUT" || $ === "TEXTAREA" || $ === "SELECT" || $ === "BUTTON" || $ === "A" || $ === "LABEL" || R.target.isContentEditable) return;
1853
+ let k = R.target;
1854
+ for (; k && k !== r.current; ) {
1855
+ if ((T = k.classList) != null && T.contains("nodrag") || (j = k.classList) != null && j.contains("nopan")) return;
1856
+ k = k.parentElement;
1857
1857
  }
1858
1858
  if (n.onNodesChangeRef.current) {
1859
1859
  const K = [];
1860
- if (M.shiftKey)
1860
+ if (R.shiftKey)
1861
1861
  K.push({ id: t.id, type: "select", selected: !t.selected });
1862
1862
  else
1863
1863
  for (const q of n.nodesRef.current)
@@ -1866,20 +1866,20 @@ function $r({ node: t, nodeType: e }) {
1866
1866
  }
1867
1867
  const E = n.cameraRef.current, _ = n.wrapRef.current;
1868
1868
  if (!_) return;
1869
- const D = _.getBoundingClientRect(), g = (M.clientX - D.left - E.x) / E.zoom, f = (M.clientY - D.top - E.y) / E.zoom, v = M.shiftKey && t.selected ? n.nodesRef.current.filter((K) => K.selected && K.id !== t.id).map((K) => ({ id: K.id, startPos: { ...K.position } })) : [];
1869
+ const B = _.getBoundingClientRect(), D = (R.clientX - B.left - E.x) / E.zoom, f = (R.clientY - B.top - E.y) / E.zoom, p = R.shiftKey && t.selected ? n.nodesRef.current.filter((K) => K.selected && K.id !== t.id).map((K) => ({ id: K.id, startPos: { ...K.position } })) : [];
1870
1870
  o.current = {
1871
1871
  startPos: { ...t.position },
1872
- startMouse: { x: g, y: f },
1873
- selectedStarts: v
1872
+ startMouse: { x: D, y: f },
1873
+ selectedStarts: p
1874
1874
  };
1875
- const L = [{ id: t.id, type: "position", dragging: !0 }];
1876
- for (const K of v)
1877
- L.push({ id: K.id, type: "position", dragging: !0 });
1878
- (xt = (X = n.onNodesChangeRef).current) == null || xt.call(X, L);
1875
+ const M = [{ id: t.id, type: "position", dragging: !0 }];
1876
+ for (const K of p)
1877
+ M.push({ id: K.id, type: "position", dragging: !0 });
1878
+ (xt = (W = n.onNodesChangeRef).current) == null || xt.call(W, M);
1879
1879
  const w = r.current;
1880
- w && w.setPointerCapture(M.pointerId);
1881
- const P = (K) => {
1882
- var it, mt, Lt, zt;
1880
+ w && w.setPointerCapture(R.pointerId);
1881
+ const C = (K) => {
1882
+ var it, mt, Nt, zt;
1883
1883
  if (!o.current) return;
1884
1884
  const rt = n.cameraRef.current, q = _.getBoundingClientRect(), G = (K.clientX - q.left - rt.x) / rt.zoom, ot = (K.clientY - q.top - rt.y) / rt.zoom, lt = G - o.current.startMouse.x, ut = ot - o.current.startMouse.y;
1885
1885
  let st = { x: o.current.startPos.x + lt, y: o.current.startPos.y + ut };
@@ -1889,9 +1889,9 @@ function $r({ node: t, nodeType: e }) {
1889
1889
  }), t.parentId && t.extent === "parent") {
1890
1890
  const dt = n.nodesRef.current.find((ht) => ht.id === t.parentId);
1891
1891
  if (dt) {
1892
- const ht = dt.width || 160, Rt = dt.height || 60, Nt = t.width || ((it = t.measured) == null ? void 0 : it.width) || 160, gt = t.height || ((mt = t.measured) == null ? void 0 : mt.height) || 60;
1892
+ const ht = dt.width || 160, Rt = dt.height || 60, Lt = t.width || ((it = t.measured) == null ? void 0 : it.width) || 160, gt = t.height || ((mt = t.measured) == null ? void 0 : mt.height) || 60;
1893
1893
  st = {
1894
- x: Math.max(0, Math.min(st.x, ht - Nt)),
1894
+ x: Math.max(0, Math.min(st.x, ht - Lt)),
1895
1895
  y: Math.max(0, Math.min(st.y, Rt - gt))
1896
1896
  };
1897
1897
  }
@@ -1904,22 +1904,22 @@ function $r({ node: t, nodeType: e }) {
1904
1904
  y: n.snapGrid[1] * Math.round(ht.y / n.snapGrid[1])
1905
1905
  }), It.push({ id: dt.id, type: "position", position: ht, dragging: !0 });
1906
1906
  }
1907
- (zt = (Lt = n.onNodesChangeRef).current) == null || zt.call(Lt, It);
1908
- }, k = (K) => {
1907
+ (zt = (Nt = n.onNodesChangeRef).current) == null || zt.call(Nt, It);
1908
+ }, x = (K) => {
1909
1909
  var q, G;
1910
1910
  if (!o.current) return;
1911
1911
  const rt = [{ id: t.id, type: "position", dragging: !1 }];
1912
1912
  for (const ot of o.current.selectedStarts)
1913
1913
  rt.push({ id: ot.id, type: "position", dragging: !1 });
1914
- (G = (q = n.onNodesChangeRef).current) == null || G.call(q, rt), o.current = null, w && w.releasePointerCapture(K.pointerId), w == null || w.removeEventListener("pointermove", P), w == null || w.removeEventListener("pointerup", k);
1914
+ (G = (q = n.onNodesChangeRef).current) == null || G.call(q, rt), o.current = null, w && w.releasePointerCapture(K.pointerId), w == null || w.removeEventListener("pointermove", C), w == null || w.removeEventListener("pointerup", x);
1915
1915
  };
1916
- w == null || w.addEventListener("pointermove", P), w == null || w.addEventListener("pointerup", k);
1917
- }, [t, n]), c = F((M) => {
1918
- var g, f, p, v, L, w;
1916
+ w == null || w.addEventListener("pointermove", C), w == null || w.addEventListener("pointerup", x);
1917
+ }, [t, n]), c = F((R) => {
1918
+ var D, f, h, p, M, w;
1919
1919
  if (!t.selected) return;
1920
- const $ = M.shiftKey ? 10 : 1;
1921
- let R = 0, E = 0;
1922
- switch (M.key) {
1920
+ const $ = R.shiftKey ? 10 : 1;
1921
+ let k = 0, E = 0;
1922
+ switch (R.key) {
1923
1923
  case "ArrowUp":
1924
1924
  E = -$;
1925
1925
  break;
@@ -1927,27 +1927,27 @@ function $r({ node: t, nodeType: e }) {
1927
1927
  E = $;
1928
1928
  break;
1929
1929
  case "ArrowLeft":
1930
- R = -$;
1930
+ k = -$;
1931
1931
  break;
1932
1932
  case "ArrowRight":
1933
- R = $;
1933
+ k = $;
1934
1934
  break;
1935
1935
  case "Escape":
1936
- (f = (g = n.onNodesChangeRef).current) == null || f.call(g, [{ id: t.id, type: "select", selected: !1 }]);
1936
+ (f = (D = n.onNodesChangeRef).current) == null || f.call(D, [{ id: t.id, type: "select", selected: !1 }]);
1937
1937
  return;
1938
1938
  case "Delete":
1939
1939
  case "Backspace":
1940
- t.deletable !== !1 && ((v = (p = n.onNodesChangeRef).current) == null || v.call(p, [{ id: t.id, type: "remove" }]));
1940
+ t.deletable !== !1 && ((p = (h = n.onNodesChangeRef).current) == null || p.call(h, [{ id: t.id, type: "remove" }]));
1941
1941
  return;
1942
1942
  default:
1943
1943
  return;
1944
1944
  }
1945
- M.preventDefault();
1946
- const _ = { x: t.position.x + R, y: t.position.y + E }, D = [{ id: t.id, type: "position", position: _ }];
1947
- for (const P of n.nodesRef.current)
1948
- P.selected && P.id !== t.id && D.push({ id: P.id, type: "position", position: { x: P.position.x + R, y: P.position.y + E } });
1949
- (w = (L = n.onNodesChangeRef).current) == null || w.call(L, D);
1950
- }, [t, n]), u = t.width || ((m = t.measured) == null ? void 0 : m.width), l = t.height || ((C = t.measured) == null ? void 0 : C.height), y = !!(u && l);
1945
+ R.preventDefault();
1946
+ const _ = { x: t.position.x + k, y: t.position.y + E }, B = [{ id: t.id, type: "position", position: _ }];
1947
+ for (const C of n.nodesRef.current)
1948
+ C.selected && C.id !== t.id && B.push({ id: C.id, type: "position", position: { x: C.position.x + k, y: C.position.y + E } });
1949
+ (w = (M = n.onNodesChangeRef).current) == null || w.call(M, B);
1950
+ }, [t, n]), u = t.width || ((v = t.measured) == null ? void 0 : v.width), l = t.height || ((N = t.measured) == null ? void 0 : N.height), g = !!(u && l);
1951
1951
  return /* @__PURE__ */ S(je.Provider, { value: t.id, children: /* @__PURE__ */ S(
1952
1952
  "div",
1953
1953
  {
@@ -1959,7 +1959,7 @@ function $r({ node: t, nodeType: e }) {
1959
1959
  top: s.y,
1960
1960
  zIndex: t.type === "group" ? 0 : t.zIndex || 1,
1961
1961
  pointerEvents: t.type === "group" ? "none" : "all",
1962
- visibility: y ? "visible" : "hidden",
1962
+ visibility: g ? "visible" : "hidden",
1963
1963
  outline: "none"
1964
1964
  },
1965
1965
  "data-nodeid": t.id,
@@ -2000,32 +2000,32 @@ function Bn(t, e, n, r) {
2000
2000
  var c, u;
2001
2001
  const s = t.width || ((c = t.measured) == null ? void 0 : c.width) || On, o = t.height || ((u = t.measured) == null ? void 0 : u.height) || Qn, i = t._absolutePosition || t.position;
2002
2002
  if (t.handleBounds) {
2003
- const l = t.handleBounds[e] || [], y = n ? l.find((m) => m.id === n) : l[0];
2004
- if (y && y.x !== void 0 && y.y !== void 0) {
2005
- const m = y.position || (e === "source" ? "right" : "left");
2006
- return { x: i.x + y.x, y: i.y + y.y, position: m };
2003
+ const l = t.handleBounds[e] || [], g = n ? l.find((v) => v.id === n) : l[0];
2004
+ if (g && g.x !== void 0 && g.y !== void 0) {
2005
+ const v = g.position || (e === "source" ? "right" : "left");
2006
+ return { x: i.x + g.x, y: i.y + g.y, position: v };
2007
2007
  }
2008
2008
  }
2009
2009
  if (r) {
2010
- const l = `${t.id}__${n || e}`, y = r.get(l);
2011
- if (y && y.x !== void 0 && y.y !== void 0)
2012
- return { x: i.x + y.x, y: i.y + y.y, position: y.position || (e === "source" ? "right" : "left") };
2010
+ const l = `${t.id}__${n || e}`, g = r.get(l);
2011
+ if (g && g.x !== void 0 && g.y !== void 0)
2012
+ return { x: i.x + g.x, y: i.y + g.y, position: g.position || (e === "source" ? "right" : "left") };
2013
2013
  }
2014
2014
  if (t.handles && t.handles.length) {
2015
2015
  for (const l of t.handles)
2016
2016
  if (l.type === e && (!n || l.id === n)) {
2017
2017
  if (l.x !== void 0 && l.y !== void 0)
2018
2018
  return { x: i.x + l.x, y: i.y + l.y, position: l.position || (e === "source" ? "right" : "left") };
2019
- const y = l.position || (e === "source" ? "right" : "left");
2020
- switch (y) {
2019
+ const g = l.position || (e === "source" ? "right" : "left");
2020
+ switch (g) {
2021
2021
  case "top":
2022
- return { x: i.x + s / 2, y: i.y, position: y };
2022
+ return { x: i.x + s / 2, y: i.y, position: g };
2023
2023
  case "bottom":
2024
- return { x: i.x + s / 2, y: i.y + o, position: y };
2024
+ return { x: i.x + s / 2, y: i.y + o, position: g };
2025
2025
  case "left":
2026
- return { x: i.x, y: i.y + o / 2, position: y };
2026
+ return { x: i.x, y: i.y + o / 2, position: g };
2027
2027
  default:
2028
- return { x: i.x + s, y: i.y + o / 2, position: y };
2028
+ return { x: i.x + s, y: i.y + o / 2, position: g };
2029
2029
  }
2030
2030
  }
2031
2031
  }
@@ -2053,32 +2053,32 @@ function Dn({ x: t, y: e, position: n, type: r, onPointerDown: s }) {
2053
2053
  );
2054
2054
  }
2055
2055
  function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2056
- var g, f, p;
2057
- const s = yt(), [o, i] = Gt(null), c = F((v, L, w, P) => {
2056
+ var D, f, h;
2057
+ const s = yt(), [o, i] = Gt(null), c = F((p, M, w, C) => {
2058
2058
  var rt;
2059
- L.stopPropagation(), L.preventDefault();
2060
- const k = s.wrapRef.current;
2061
- if (!k) return;
2062
- const B = v === "source" ? P : w, j = v === "source" ? t.target : t.source;
2059
+ M.stopPropagation(), M.preventDefault();
2060
+ const x = s.wrapRef.current;
2061
+ if (!x) return;
2062
+ const T = p === "source" ? C : w, j = p === "source" ? t.target : t.source;
2063
2063
  (rt = s.workerRef.current) == null || rt.postMessage({
2064
2064
  type: "connecting",
2065
- data: { from: { x: B.x, y: B.y }, to: { x: B.x, y: B.y } }
2065
+ data: { from: { x: T.x, y: T.y }, to: { x: T.x, y: T.y } }
2066
2066
  });
2067
- const X = k.getBoundingClientRect(), xt = (q) => {
2067
+ const W = x.getBoundingClientRect(), xt = (q) => {
2068
2068
  var ut;
2069
- const G = s.cameraRef.current, ot = (q.clientX - X.left - G.x) / G.zoom, lt = (q.clientY - X.top - G.y) / G.zoom;
2069
+ const G = s.cameraRef.current, ot = (q.clientX - W.left - G.x) / G.zoom, lt = (q.clientY - W.top - G.y) / G.zoom;
2070
2070
  (ut = s.workerRef.current) == null || ut.postMessage({
2071
2071
  type: "connecting",
2072
- data: { from: { x: B.x, y: B.y }, to: { x: ot, y: lt } }
2072
+ data: { from: { x: T.x, y: T.y }, to: { x: ot, y: lt } }
2073
2073
  });
2074
2074
  }, K = (q) => {
2075
- var mt, Lt, zt, dt;
2076
- const G = s.cameraRef.current, ot = (q.clientX - X.left - G.x) / G.zoom, lt = (q.clientY - X.top - G.y) / G.zoom, ut = 20 / G.zoom;
2075
+ var mt, Nt, zt, dt;
2076
+ const G = s.cameraRef.current, ot = (q.clientX - W.left - G.x) / G.zoom, lt = (q.clientY - W.top - G.y) / G.zoom, ut = 20 / G.zoom;
2077
2077
  let st = null, It = null;
2078
2078
  const it = (mt = s.handleRegistryRef) == null ? void 0 : mt.current;
2079
2079
  for (const ht of s.nodesRef.current) {
2080
2080
  if (ht.hidden) continue;
2081
- const Rt = ht.width || On, Nt = ht.height || Qn, gt = ht._absolutePosition || ht.position, ne = [];
2081
+ const Rt = ht.width || On, Lt = ht.height || Qn, gt = ht._absolutePosition || ht.position, ne = [];
2082
2082
  if (it)
2083
2083
  for (const [, Bt] of it)
2084
2084
  Bt.nodeId === ht.id && ne.push(Bt);
@@ -2096,13 +2096,13 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2096
2096
  Ot = gt.x + Rt / 2, Yt = gt.y;
2097
2097
  break;
2098
2098
  case "bottom":
2099
- Ot = gt.x + Rt / 2, Yt = gt.y + Nt;
2099
+ Ot = gt.x + Rt / 2, Yt = gt.y + Lt;
2100
2100
  break;
2101
2101
  case "left":
2102
- Ot = gt.x, Yt = gt.y + Nt / 2;
2102
+ Ot = gt.x, Yt = gt.y + Lt / 2;
2103
2103
  break;
2104
2104
  default:
2105
- Ot = gt.x + Rt, Yt = gt.y + Nt / 2;
2105
+ Ot = gt.x + Rt, Yt = gt.y + Lt / 2;
2106
2106
  break;
2107
2107
  }
2108
2108
  if (Math.abs(ot - Ot) < ut && Math.abs(lt - Yt) < ut) {
@@ -2113,17 +2113,17 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2113
2113
  if (st) break;
2114
2114
  }
2115
2115
  if (st) {
2116
- const ht = v === "source" ? { source: st.id, target: j, sourceHandle: It, targetHandle: t.targetHandle } : { source: j, target: st.id, sourceHandle: t.sourceHandle, targetHandle: It };
2117
- (zt = (Lt = s.onEdgesChangeRef).current) == null || zt.call(Lt, [
2116
+ const ht = p === "source" ? { source: st.id, target: j, sourceHandle: It, targetHandle: t.targetHandle } : { source: j, target: st.id, sourceHandle: t.sourceHandle, targetHandle: It };
2117
+ (zt = (Nt = s.onEdgesChangeRef).current) == null || zt.call(Nt, [
2118
2118
  { id: t.id, type: "remove" },
2119
2119
  { type: "add", item: { id: t.id, ...ht } }
2120
2120
  ]);
2121
2121
  }
2122
- (dt = s.workerRef.current) == null || dt.postMessage({ type: "connecting", data: null }), k.removeEventListener("pointermove", xt), k.removeEventListener("pointerup", K);
2122
+ (dt = s.workerRef.current) == null || dt.postMessage({ type: "connecting", data: null }), x.removeEventListener("pointermove", xt), x.removeEventListener("pointerup", K);
2123
2123
  };
2124
- k.addEventListener("pointermove", xt), k.addEventListener("pointerup", K);
2125
- }, [t, s]), u = n.find((v) => v.id === t.source), l = n.find((v) => v.id === t.target), y = u && !!(u.width || (g = u.measured) != null && g.width), m = l && !!(l.width || (f = l.measured) != null && f.width), C = (p = s.handleRegistryRef) == null ? void 0 : p.current, z = y ? Bn(u, "source", t.sourceHandle, C) : null, M = m ? Bn(l, "target", t.targetHandle, C) : null, $ = t.type === "bezier" || t.type === "simplebezier" || t.type === "default", R = s.routedEdges || s.edges, E = R == null ? void 0 : R.find((v) => v.id === t.id), _ = $ ? null : (E == null ? void 0 : E._routedPoints) || t._routedPoints || null, D = r !== !1 && t.reconnectable !== !1;
2126
- return !z || !M ? null : /* @__PURE__ */ $t(
2124
+ x.addEventListener("pointermove", xt), x.addEventListener("pointerup", K);
2125
+ }, [t, s]), u = n.find((p) => p.id === t.source), l = n.find((p) => p.id === t.target), g = u && !!(u.width || (D = u.measured) != null && D.width), v = l && !!(l.width || (f = l.measured) != null && f.width), N = (h = s.handleRegistryRef) == null ? void 0 : h.current, z = g ? Bn(u, "source", t.sourceHandle, N) : null, R = v ? Bn(l, "target", t.targetHandle, N) : null, $ = t.type === "bezier" || t.type === "simplebezier" || t.type === "default", k = s.routedEdges || s.edges, E = k == null ? void 0 : k.find((p) => p.id === t.id), _ = $ ? null : (E == null ? void 0 : E._routedPoints) || t._routedPoints || null, B = r !== !1 && t.reconnectable !== !1;
2126
+ return !z || !R ? null : /* @__PURE__ */ $t(
2127
2127
  "g",
2128
2128
  {
2129
2129
  className: `ric-edge-wrapper ${t.selected ? "selected" : ""}`,
@@ -2139,10 +2139,10 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2139
2139
  target: t.target,
2140
2140
  sourceX: z.x,
2141
2141
  sourceY: z.y,
2142
- targetX: M.x,
2143
- targetY: M.y,
2142
+ targetX: R.x,
2143
+ targetY: R.y,
2144
2144
  sourcePosition: z.position,
2145
- targetPosition: M.position,
2145
+ targetPosition: R.position,
2146
2146
  sourceHandleId: t.sourceHandle,
2147
2147
  targetHandleId: t.targetHandle,
2148
2148
  data: t.data,
@@ -2156,7 +2156,7 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2156
2156
  routedPoints: _
2157
2157
  }
2158
2158
  ),
2159
- D && (o || t.selected) && /* @__PURE__ */ $t(Ne, { children: [
2159
+ B && (o || t.selected) && /* @__PURE__ */ $t(Le, { children: [
2160
2160
  /* @__PURE__ */ S(
2161
2161
  Dn,
2162
2162
  {
@@ -2164,17 +2164,17 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2164
2164
  y: z.y,
2165
2165
  position: z.position,
2166
2166
  type: "source",
2167
- onPointerDown: (v) => c("source", v, z, M)
2167
+ onPointerDown: (p) => c("source", p, z, R)
2168
2168
  }
2169
2169
  ),
2170
2170
  /* @__PURE__ */ S(
2171
2171
  Dn,
2172
2172
  {
2173
- x: M.x,
2174
- y: M.y,
2175
- position: M.position,
2173
+ x: R.x,
2174
+ y: R.y,
2175
+ position: R.position,
2176
2176
  type: "target",
2177
- onPointerDown: (v) => c("target", v, z, M)
2177
+ onPointerDown: (p) => c("target", p, z, R)
2178
2178
  }
2179
2179
  )
2180
2180
  ] })
@@ -2187,46 +2187,46 @@ function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
2187
2187
  var $;
2188
2188
  const n = yt(), [r, s] = Gt(null), o = tt(null);
2189
2189
  if (ft(() => {
2190
- const R = n.wrapRef.current;
2191
- if (!R) return;
2192
- let E = !1, _ = null, D = !1;
2193
- const g = (w) => {
2194
- w.key === t && (D = !0);
2190
+ const k = n.wrapRef.current;
2191
+ if (!k) return;
2192
+ let E = !1, _ = null, B = !1;
2193
+ const D = (w) => {
2194
+ w.key === t && (B = !0);
2195
2195
  }, f = (w) => {
2196
- w.key === t && (D = !1);
2197
- }, p = (w) => {
2198
- if (!D) return;
2199
- const P = w.target;
2200
- if (P.closest(".ric-node-wrapper") || P.closest(".ric-handle")) return;
2196
+ w.key === t && (B = !1);
2197
+ }, h = (w) => {
2198
+ if (!B) return;
2199
+ const C = w.target;
2200
+ if (C.closest(".ric-node-wrapper") || C.closest(".ric-handle")) return;
2201
2201
  E = !0;
2202
- const k = n.cameraRef.current, B = R.getBoundingClientRect(), j = (w.clientX - B.left - k.x) / k.zoom, X = (w.clientY - B.top - k.y) / k.zoom;
2203
- _ = { x: j, y: X }, s({ startX: j, startY: X, endX: j, endY: X }), w.stopPropagation();
2204
- }, v = (w) => {
2202
+ const x = n.cameraRef.current, T = k.getBoundingClientRect(), j = (w.clientX - T.left - x.x) / x.zoom, W = (w.clientY - T.top - x.y) / x.zoom;
2203
+ _ = { x: j, y: W }, s({ startX: j, startY: W, endX: j, endY: W }), w.stopPropagation();
2204
+ }, p = (w) => {
2205
2205
  if (!E || !_) return;
2206
- const P = n.cameraRef.current, k = R.getBoundingClientRect(), B = (w.clientX - k.left - P.x) / P.zoom, j = (w.clientY - k.top - P.y) / P.zoom;
2207
- s({ startX: _.x, startY: _.y, endX: B, endY: j });
2208
- }, L = (w) => {
2206
+ const C = n.cameraRef.current, x = k.getBoundingClientRect(), T = (w.clientX - x.left - C.x) / C.zoom, j = (w.clientY - x.top - C.y) / C.zoom;
2207
+ s({ startX: _.x, startY: _.y, endX: T, endY: j });
2208
+ }, M = (w) => {
2209
2209
  var K, rt;
2210
2210
  if (!E || !_) return;
2211
2211
  E = !1;
2212
- const P = n.cameraRef.current, k = R.getBoundingClientRect(), B = (w.clientX - k.left - P.x) / P.zoom, j = (w.clientY - k.top - P.y) / P.zoom, X = {
2213
- x: Math.min(_.x, B),
2212
+ const C = n.cameraRef.current, x = k.getBoundingClientRect(), T = (w.clientX - x.left - C.x) / C.zoom, j = (w.clientY - x.top - C.y) / C.zoom, W = {
2213
+ x: Math.min(_.x, T),
2214
2214
  y: Math.min(_.y, j),
2215
- width: Math.abs(B - _.x),
2215
+ width: Math.abs(T - _.x),
2216
2216
  height: Math.abs(j - _.y)
2217
2217
  }, xt = [];
2218
2218
  for (const q of n.nodesRef.current) {
2219
2219
  const G = q._absolutePosition || q.position, ot = q.width || 160, lt = q.height || 60;
2220
2220
  let ut;
2221
- e === "full" ? ut = G.x >= X.x && G.y >= X.y && G.x + ot <= X.x + X.width && G.y + lt <= X.y + X.height : ut = G.x + ot > X.x && G.x < X.x + X.width && G.y + lt > X.y && G.y < X.y + X.height, xt.push({ id: q.id, type: "select", selected: ut });
2221
+ e === "full" ? ut = G.x >= W.x && G.y >= W.y && G.x + ot <= W.x + W.width && G.y + lt <= W.y + W.height : ut = G.x + ot > W.x && G.x < W.x + W.width && G.y + lt > W.y && G.y < W.y + W.height, xt.push({ id: q.id, type: "select", selected: ut });
2222
2222
  }
2223
2223
  xt.length && ((rt = (K = n.onNodesChangeRef).current) == null || rt.call(K, xt)), _ = null, s(null);
2224
2224
  };
2225
- return R.addEventListener("pointerdown", p, !0), R.addEventListener("pointermove", v), R.addEventListener("pointerup", L), window.addEventListener("keydown", g), window.addEventListener("keyup", f), () => {
2226
- R.removeEventListener("pointerdown", p, !0), R.removeEventListener("pointermove", v), R.removeEventListener("pointerup", L), window.removeEventListener("keydown", g), window.removeEventListener("keyup", f);
2225
+ return k.addEventListener("pointerdown", h, !0), k.addEventListener("pointermove", p), k.addEventListener("pointerup", M), window.addEventListener("keydown", D), window.addEventListener("keyup", f), () => {
2226
+ k.removeEventListener("pointerdown", h, !0), k.removeEventListener("pointermove", p), k.removeEventListener("pointerup", M), window.removeEventListener("keydown", D), window.removeEventListener("keyup", f);
2227
2227
  };
2228
2228
  }, [n, t, e]), !r) return null;
2229
- const i = (($ = n.cameraRef) == null ? void 0 : $.current) || { x: 0, y: 0, zoom: 1 }, c = Math.min(r.startX, r.endX), u = Math.min(r.startY, r.endY), l = Math.abs(r.endX - r.startX), y = Math.abs(r.endY - r.startY), m = c * i.zoom + i.x, C = u * i.zoom + i.y, z = l * i.zoom, M = y * i.zoom;
2229
+ const i = (($ = n.cameraRef) == null ? void 0 : $.current) || { x: 0, y: 0, zoom: 1 }, c = Math.min(r.startX, r.endX), u = Math.min(r.startY, r.endY), l = Math.abs(r.endX - r.startX), g = Math.abs(r.endY - r.startY), v = c * i.zoom + i.x, N = u * i.zoom + i.y, z = l * i.zoom, R = g * i.zoom;
2230
2230
  return /* @__PURE__ */ S(
2231
2231
  "div",
2232
2232
  {
@@ -2234,10 +2234,10 @@ function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
2234
2234
  className: "ric-selection-box",
2235
2235
  style: {
2236
2236
  position: "absolute",
2237
- left: m,
2238
- top: C,
2237
+ left: v,
2238
+ top: N,
2239
2239
  width: z,
2240
- height: M,
2240
+ height: R,
2241
2241
  border: "1px dashed #3b82f6",
2242
2242
  background: "rgba(59, 130, 246, 0.08)",
2243
2243
  pointerEvents: "none",
@@ -2288,84 +2288,84 @@ function on({
2288
2288
  className: c = "",
2289
2289
  style: u = {},
2290
2290
  onConnect: l,
2291
- ...y
2291
+ ...g
2292
2292
  }) {
2293
- const m = qe(je), C = yt(), z = tt(null), M = tt(C);
2294
- M.current = C;
2293
+ const v = qe(je), N = yt(), z = tt(null), R = tt(N);
2294
+ R.current = N;
2295
2295
  const $ = F(() => {
2296
- var w, P, k;
2297
- const D = z.current;
2298
- if (!D || !m) return;
2299
- const g = M.current, f = (w = g.handleRegistryRef) == null ? void 0 : w.current;
2296
+ var w, C, x;
2297
+ const B = z.current;
2298
+ if (!B || !v) return;
2299
+ const D = R.current, f = (w = D.handleRegistryRef) == null ? void 0 : w.current;
2300
2300
  if (!f) return;
2301
- const p = `${m}__${n || t}`, v = (k = (P = g.cameraRef) == null ? void 0 : P.current) == null ? void 0 : k.zoom, L = Hr(D, v);
2302
- if (L) {
2303
- const B = { nodeId: m, id: n || null, type: t, position: e, x: L.x, y: L.y };
2304
- f.set(p, B);
2301
+ const h = `${v}__${n || t}`, p = (x = (C = D.cameraRef) == null ? void 0 : C.current) == null ? void 0 : x.zoom, M = Hr(B, p);
2302
+ if (M) {
2303
+ const T = { nodeId: v, id: n || null, type: t, position: e, x: M.x, y: M.y };
2304
+ f.set(h, T);
2305
2305
  }
2306
- }, [m, n, t, e]);
2306
+ }, [v, n, t, e]);
2307
2307
  kr(() => {
2308
2308
  $();
2309
2309
  }, [$]), ft(() => {
2310
- if (!m) return;
2311
- const D = M.current;
2312
- An(D, m);
2313
- const g = z.current, f = g == null ? void 0 : g.closest(".ric-node-wrapper"), p = new ResizeObserver(() => {
2314
- $(), An(M.current, m);
2310
+ if (!v) return;
2311
+ const B = R.current;
2312
+ An(B, v);
2313
+ const D = z.current, f = D == null ? void 0 : D.closest(".ric-node-wrapper"), h = new ResizeObserver(() => {
2314
+ $(), An(R.current, v);
2315
2315
  });
2316
- return f && p.observe(f), () => {
2317
- var P;
2318
- p.disconnect();
2319
- const v = M.current, L = (P = v.handleRegistryRef) == null ? void 0 : P.current, w = `${m}__${n || t}`;
2320
- L == null || L.delete(w), Jn(v, m);
2316
+ return f && h.observe(f), () => {
2317
+ var C;
2318
+ h.disconnect();
2319
+ const p = R.current, M = (C = p.handleRegistryRef) == null ? void 0 : C.current, w = `${v}__${n || t}`;
2320
+ M == null || M.delete(w), Jn(p, v);
2321
2321
  };
2322
- }, [m, n, t, e, $]);
2323
- const R = F(() => {
2324
- var k;
2325
- const D = M.current, g = D.nodesRef.current.find((B) => B.id === m);
2326
- if (!g) return null;
2327
- const f = g._absolutePosition || g.position, p = (k = D.handleRegistryRef) == null ? void 0 : k.current, v = `${m}__${n || t}`, L = p == null ? void 0 : p.get(v);
2328
- if (L && L.x !== void 0 && L.y !== void 0)
2329
- return { x: f.x + L.x, y: f.y + L.y };
2330
- const w = g.width || 160, P = g.height || 60;
2322
+ }, [v, n, t, e, $]);
2323
+ const k = F(() => {
2324
+ var x;
2325
+ const B = R.current, D = B.nodesRef.current.find((T) => T.id === v);
2326
+ if (!D) return null;
2327
+ const f = D._absolutePosition || D.position, h = (x = B.handleRegistryRef) == null ? void 0 : x.current, p = `${v}__${n || t}`, M = h == null ? void 0 : h.get(p);
2328
+ if (M && M.x !== void 0 && M.y !== void 0)
2329
+ return { x: f.x + M.x, y: f.y + M.y };
2330
+ const w = D.width || 160, C = D.height || 60;
2331
2331
  switch (e) {
2332
2332
  case "top":
2333
2333
  return { x: f.x + w / 2, y: f.y };
2334
2334
  case "bottom":
2335
- return { x: f.x + w / 2, y: f.y + P };
2335
+ return { x: f.x + w / 2, y: f.y + C };
2336
2336
  case "left":
2337
- return { x: f.x, y: f.y + P / 2 };
2337
+ return { x: f.x, y: f.y + C / 2 };
2338
2338
  default:
2339
- return { x: f.x + w, y: f.y + P / 2 };
2339
+ return { x: f.x + w, y: f.y + C / 2 };
2340
2340
  }
2341
- }, [m, n, t, e]), E = F((D) => {
2341
+ }, [v, n, t, e]), E = F((B) => {
2342
2342
  var j;
2343
2343
  if (!r || !s) return;
2344
- D.stopPropagation(), D.preventDefault();
2345
- const g = M.current, f = g.cameraRef.current, p = g.wrapRef.current;
2346
- if (!p) return;
2347
- const v = p.getBoundingClientRect(), L = R();
2348
- if (!L) return;
2349
- const w = L.x, P = L.y;
2350
- (j = g.workerRef.current) == null || j.postMessage({
2344
+ B.stopPropagation(), B.preventDefault();
2345
+ const D = R.current, f = D.cameraRef.current, h = D.wrapRef.current;
2346
+ if (!h) return;
2347
+ const p = h.getBoundingClientRect(), M = k();
2348
+ if (!M) return;
2349
+ const w = M.x, C = M.y;
2350
+ (j = D.workerRef.current) == null || j.postMessage({
2351
2351
  type: "connecting",
2352
- data: { from: { x: w, y: P }, to: { x: w, y: P } }
2353
- }), p.setPointerCapture(D.pointerId);
2354
- const k = (X) => {
2352
+ data: { from: { x: w, y: C }, to: { x: w, y: C } }
2353
+ }), h.setPointerCapture(B.pointerId);
2354
+ const x = (W) => {
2355
2355
  var rt;
2356
- const xt = (X.clientX - v.left - f.x) / f.zoom, K = (X.clientY - v.top - f.y) / f.zoom;
2357
- (rt = g.workerRef.current) == null || rt.postMessage({
2356
+ const xt = (W.clientX - p.left - f.x) / f.zoom, K = (W.clientY - p.top - f.y) / f.zoom;
2357
+ (rt = D.workerRef.current) == null || rt.postMessage({
2358
2358
  type: "connecting",
2359
- data: { from: { x: w, y: P }, to: { x: xt, y: K } }
2359
+ data: { from: { x: w, y: C }, to: { x: xt, y: K } }
2360
2360
  });
2361
- }, B = (X) => {
2361
+ }, T = (W) => {
2362
2362
  var lt, ut, st, It;
2363
- const xt = (X.clientX - v.left - f.x) / f.zoom, K = (X.clientY - v.top - f.y) / f.zoom, rt = 20 / f.zoom;
2363
+ const xt = (W.clientX - p.left - f.x) / f.zoom, K = (W.clientY - p.top - f.y) / f.zoom, rt = 20 / f.zoom;
2364
2364
  let q = null, G = null;
2365
- const ot = (lt = g.handleRegistryRef) == null ? void 0 : lt.current;
2366
- for (const it of g.nodesRef.current) {
2367
- if (it.id === m || it.hidden) continue;
2368
- const mt = it.width || 160, Lt = it.height || 60, zt = it._absolutePosition || it.position, dt = [];
2365
+ const ot = (lt = D.handleRegistryRef) == null ? void 0 : lt.current;
2366
+ for (const it of D.nodesRef.current) {
2367
+ if (it.id === v || it.hidden) continue;
2368
+ const mt = it.width || 160, Nt = it.height || 60, zt = it._absolutePosition || it.position, dt = [];
2369
2369
  if (ot)
2370
2370
  for (const [, Rt] of ot)
2371
2371
  Rt.nodeId === it.id && dt.push(Rt);
@@ -2374,25 +2374,25 @@ function on({
2374
2374
  { type: "source", position: "right" }
2375
2375
  ];
2376
2376
  for (const Rt of ht) {
2377
- let Nt, gt;
2377
+ let Lt, gt;
2378
2378
  if (Rt.x !== void 0 && Rt.y !== void 0)
2379
- Nt = zt.x + Rt.x, gt = zt.y + Rt.y;
2379
+ Lt = zt.x + Rt.x, gt = zt.y + Rt.y;
2380
2380
  else
2381
2381
  switch (Rt.position || (Rt.type === "source" ? "right" : "left")) {
2382
2382
  case "top":
2383
- Nt = zt.x + mt / 2, gt = zt.y;
2383
+ Lt = zt.x + mt / 2, gt = zt.y;
2384
2384
  break;
2385
2385
  case "bottom":
2386
- Nt = zt.x + mt / 2, gt = zt.y + Lt;
2386
+ Lt = zt.x + mt / 2, gt = zt.y + Nt;
2387
2387
  break;
2388
2388
  case "left":
2389
- Nt = zt.x, gt = zt.y + Lt / 2;
2389
+ Lt = zt.x, gt = zt.y + Nt / 2;
2390
2390
  break;
2391
2391
  default:
2392
- Nt = zt.x + mt, gt = zt.y + Lt / 2;
2392
+ Lt = zt.x + mt, gt = zt.y + Nt / 2;
2393
2393
  break;
2394
2394
  }
2395
- if (Math.abs(xt - Nt) < rt && Math.abs(K - gt) < rt) {
2395
+ if (Math.abs(xt - Lt) < rt && Math.abs(K - gt) < rt) {
2396
2396
  q = it, G = Rt.id || null;
2397
2397
  break;
2398
2398
  }
@@ -2401,17 +2401,17 @@ function on({
2401
2401
  }
2402
2402
  if (q) {
2403
2403
  const it = {
2404
- source: t === "source" ? m : q.id,
2405
- target: t === "source" ? q.id : m,
2404
+ source: t === "source" ? v : q.id,
2405
+ target: t === "source" ? q.id : v,
2406
2406
  sourceHandle: t === "source" ? n || null : G,
2407
2407
  targetHandle: t === "source" ? G : n || null
2408
2408
  };
2409
- (st = (ut = g.onEdgesChangeRef) == null ? void 0 : ut.current) == null || st.call(ut, [{ type: "add", item: { id: `e-${it.source}-${it.target}`, ...it } }]);
2409
+ (st = (ut = D.onEdgesChangeRef) == null ? void 0 : ut.current) == null || st.call(ut, [{ type: "add", item: { id: `e-${it.source}-${it.target}`, ...it } }]);
2410
2410
  }
2411
- (It = g.workerRef.current) == null || It.postMessage({ type: "connecting", data: null }), p.removeEventListener("pointermove", k), p.removeEventListener("pointerup", B);
2411
+ (It = D.workerRef.current) == null || It.postMessage({ type: "connecting", data: null }), h.removeEventListener("pointermove", x), h.removeEventListener("pointerup", T);
2412
2412
  };
2413
- p.addEventListener("pointermove", k), p.addEventListener("pointerup", B);
2414
- }, [m, n, t, e, r, s, R]), _ = {
2413
+ h.addEventListener("pointermove", x), h.addEventListener("pointerup", T);
2414
+ }, [v, n, t, e, r, s, k]), _ = {
2415
2415
  top: { top: 0, left: "50%", transform: "translate(-50%, -50%)" },
2416
2416
  bottom: { bottom: 0, left: "50%", transform: "translate(-50%, 50%)" },
2417
2417
  left: { top: "50%", left: 0, transform: "translate(-50%, -50%)" },
@@ -2423,7 +2423,7 @@ function on({
2423
2423
  ref: z,
2424
2424
  className: `ric-handle ric-handle-${e} ric-handle-${t} ${c}`,
2425
2425
  "data-handleid": n || null,
2426
- "data-nodeid": m,
2426
+ "data-nodeid": v,
2427
2427
  "data-handlepos": e,
2428
2428
  "data-handletype": t,
2429
2429
  onPointerDown: E,
@@ -2440,7 +2440,7 @@ function on({
2440
2440
  ..._,
2441
2441
  ...u
2442
2442
  },
2443
- ...y,
2443
+ ...g,
2444
2444
  children: i
2445
2445
  }
2446
2446
  );
@@ -2574,34 +2574,34 @@ function Vn({
2574
2574
  labelBgBorderRadius: c = 2,
2575
2575
  children: u,
2576
2576
  className: l = "",
2577
- ...y
2577
+ ...g
2578
2578
  }) {
2579
- const [m, C] = Gt({ x: 1, y: 0, width: 0, height: 0 }), z = tt(null);
2579
+ const [v, N] = Gt({ x: 1, y: 0, width: 0, height: 0 }), z = tt(null);
2580
2580
  return ft(() => {
2581
2581
  if (z.current) {
2582
- const M = z.current.getBBox();
2583
- C({
2584
- x: M.x,
2585
- y: M.y,
2586
- width: M.width,
2587
- height: M.height
2582
+ const R = z.current.getBBox();
2583
+ N({
2584
+ x: R.x,
2585
+ y: R.y,
2586
+ width: R.width,
2587
+ height: R.height
2588
2588
  });
2589
2589
  }
2590
2590
  }, [n]), n ? /* @__PURE__ */ $t(
2591
2591
  "g",
2592
2592
  {
2593
- transform: `translate(${t - m.width / 2} ${e - m.height / 2})`,
2593
+ transform: `translate(${t - v.width / 2} ${e - v.height / 2})`,
2594
2594
  className: `ric-edge-textwrapper ${l}`,
2595
- visibility: m.width ? "visible" : "hidden",
2596
- ...y,
2595
+ visibility: v.width ? "visible" : "hidden",
2596
+ ...g,
2597
2597
  children: [
2598
2598
  s && /* @__PURE__ */ S(
2599
2599
  "rect",
2600
2600
  {
2601
- width: m.width + 2 * i[0],
2601
+ width: v.width + 2 * i[0],
2602
2602
  x: -i[0],
2603
2603
  y: -i[1],
2604
- height: m.height + 2 * i[1],
2604
+ height: v.height + 2 * i[1],
2605
2605
  className: "ric-edge-textbg",
2606
2606
  style: o,
2607
2607
  rx: c,
@@ -2612,7 +2612,7 @@ function Vn({
2612
2612
  "text",
2613
2613
  {
2614
2614
  className: "ric-edge-text",
2615
- y: m.height / 2,
2615
+ y: v.height / 2,
2616
2616
  dy: "0.3em",
2617
2617
  ref: z,
2618
2618
  style: r,
@@ -2640,14 +2640,14 @@ function un({
2640
2640
  labelBgStyle: c,
2641
2641
  labelBgPadding: u,
2642
2642
  labelBgBorderRadius: l,
2643
- interactionWidth: y = 20,
2644
- style: m,
2645
- markerEnd: C,
2643
+ interactionWidth: g = 20,
2644
+ style: v,
2645
+ markerEnd: N,
2646
2646
  markerStart: z,
2647
- className: M = "",
2647
+ className: R = "",
2648
2648
  ...$
2649
2649
  }) {
2650
- return /* @__PURE__ */ $t(Ne, { children: [
2650
+ return /* @__PURE__ */ $t(Le, { children: [
2651
2651
  /* @__PURE__ */ S(
2652
2652
  "path",
2653
2653
  {
@@ -2656,20 +2656,20 @@ function un({
2656
2656
  fill: "none",
2657
2657
  stroke: "#b1b1b7",
2658
2658
  strokeWidth: 1.5,
2659
- className: `ric-edge-path ${M}`,
2660
- style: m,
2661
- markerEnd: C,
2659
+ className: `ric-edge-path ${R}`,
2660
+ style: v,
2661
+ markerEnd: N,
2662
2662
  markerStart: z,
2663
2663
  ...$
2664
2664
  }
2665
2665
  ),
2666
- y ? /* @__PURE__ */ S(
2666
+ g ? /* @__PURE__ */ S(
2667
2667
  "path",
2668
2668
  {
2669
2669
  d: e,
2670
2670
  fill: "none",
2671
2671
  strokeOpacity: 0,
2672
- strokeWidth: y,
2672
+ strokeWidth: g,
2673
2673
  className: "ric-edge-interaction",
2674
2674
  style: { pointerEvents: "stroke" }
2675
2675
  }
@@ -2714,64 +2714,64 @@ const tr = Zt(function({
2714
2714
  targetPosition: c = "top",
2715
2715
  label: u,
2716
2716
  labelStyle: l,
2717
- labelShowBg: y,
2718
- labelBgStyle: m,
2719
- labelBgPadding: C,
2717
+ labelShowBg: g,
2718
+ labelBgStyle: v,
2719
+ labelBgPadding: N,
2720
2720
  labelBgBorderRadius: z,
2721
- style: M,
2721
+ style: R,
2722
2722
  markerEnd: $,
2723
- markerStart: R,
2723
+ markerStart: k,
2724
2724
  interactionWidth: E
2725
2725
  }) {
2726
- let _, D, g;
2727
- const f = _n(n, r, i), p = _n(s, o, c), v = Math.abs(p.x - f.x), L = Math.max(50, v * 0.5);
2728
- let w, P, k, B;
2726
+ let _, B, D;
2727
+ const f = _n(n, r, i), h = _n(s, o, c), p = Math.abs(h.x - f.x), M = Math.max(50, p * 0.5);
2728
+ let w, C, x, T;
2729
2729
  switch (i) {
2730
2730
  case "left":
2731
- w = f.x - L, P = f.y;
2731
+ w = f.x - M, C = f.y;
2732
2732
  break;
2733
2733
  case "top":
2734
- w = f.x, P = f.y - L;
2734
+ w = f.x, C = f.y - M;
2735
2735
  break;
2736
2736
  case "bottom":
2737
- w = f.x, P = f.y + L;
2737
+ w = f.x, C = f.y + M;
2738
2738
  break;
2739
2739
  default:
2740
- w = f.x + L, P = f.y;
2740
+ w = f.x + M, C = f.y;
2741
2741
  break;
2742
2742
  }
2743
2743
  switch (c) {
2744
2744
  case "right":
2745
- k = p.x + L, B = p.y;
2745
+ x = h.x + M, T = h.y;
2746
2746
  break;
2747
2747
  case "top":
2748
- k = p.x, B = p.y - L;
2748
+ x = h.x, T = h.y - M;
2749
2749
  break;
2750
2750
  case "bottom":
2751
- k = p.x, B = p.y + L;
2751
+ x = h.x, T = h.y + M;
2752
2752
  break;
2753
2753
  default:
2754
- k = p.x - L, B = p.y;
2754
+ x = h.x - M, T = h.y;
2755
2755
  break;
2756
2756
  }
2757
- _ = `M ${n},${r} L ${f.x},${f.y} C ${w},${P} ${k},${B} ${p.x},${p.y} L ${s},${o}`;
2758
- const j = 0.5, X = 0.5;
2759
- return D = X * X * X * f.x + 3 * X * X * j * w + 3 * X * j * j * k + j * j * j * p.x, g = X * X * X * f.y + 3 * X * X * j * P + 3 * X * j * j * B + j * j * j * p.y, /* @__PURE__ */ S(
2757
+ _ = `M ${n},${r} L ${f.x},${f.y} C ${w},${C} ${x},${T} ${h.x},${h.y} L ${s},${o}`;
2758
+ const j = 0.5, W = 0.5;
2759
+ return B = W * W * W * f.x + 3 * W * W * j * w + 3 * W * j * j * x + j * j * j * h.x, D = W * W * W * f.y + 3 * W * W * j * C + 3 * W * j * j * T + j * j * j * h.y, /* @__PURE__ */ S(
2760
2760
  un,
2761
2761
  {
2762
2762
  id: e,
2763
2763
  path: _,
2764
- labelX: D,
2765
- labelY: g,
2764
+ labelX: B,
2765
+ labelY: D,
2766
2766
  label: u,
2767
2767
  labelStyle: l,
2768
- labelShowBg: y,
2769
- labelBgStyle: m,
2770
- labelBgPadding: C,
2768
+ labelShowBg: g,
2769
+ labelBgStyle: v,
2770
+ labelBgPadding: N,
2771
2771
  labelBgBorderRadius: z,
2772
- style: M,
2772
+ style: R,
2773
2773
  markerEnd: $,
2774
- markerStart: R,
2774
+ markerStart: k,
2775
2775
  interactionWidth: E
2776
2776
  }
2777
2777
  );
@@ -2790,42 +2790,42 @@ function nr({
2790
2790
  targetPosition: o = "left",
2791
2791
  curvature: i = 0.25
2792
2792
  }) {
2793
- const c = Math.abs(n - t), u = Math.abs(r - e), l = Math.sqrt(c * c + u * u), y = Math.max(l * i, 50);
2794
- let m, C, z, M;
2793
+ const c = Math.abs(n - t), u = Math.abs(r - e), l = Math.sqrt(c * c + u * u), g = Math.max(l * i, 50);
2794
+ let v, N, z, R;
2795
2795
  switch (s) {
2796
2796
  case "top":
2797
- m = t, C = e - y;
2797
+ v = t, N = e - g;
2798
2798
  break;
2799
2799
  case "bottom":
2800
- m = t, C = e + y;
2800
+ v = t, N = e + g;
2801
2801
  break;
2802
2802
  case "left":
2803
- m = t - y, C = e;
2803
+ v = t - g, N = e;
2804
2804
  break;
2805
2805
  default:
2806
- m = t + y, C = e;
2806
+ v = t + g, N = e;
2807
2807
  break;
2808
2808
  }
2809
2809
  switch (o) {
2810
2810
  case "top":
2811
- z = n, M = r - y;
2811
+ z = n, R = r - g;
2812
2812
  break;
2813
2813
  case "bottom":
2814
- z = n, M = r + y;
2814
+ z = n, R = r + g;
2815
2815
  break;
2816
2816
  case "right":
2817
- z = n + y, M = r;
2817
+ z = n + g, R = r;
2818
2818
  break;
2819
2819
  default:
2820
- z = n - y, M = r;
2820
+ z = n - g, R = r;
2821
2821
  break;
2822
2822
  }
2823
- const $ = `M ${t},${e} C ${m},${C} ${z},${M} ${n},${r}`, R = 0.5, E = 1 - R, _ = E * E * E * t + 3 * E * E * R * m + 3 * E * R * R * z + R * R * R * n, D = E * E * E * e + 3 * E * E * R * C + 3 * E * R * R * M + R * R * R * r;
2824
- return [$, _, D, 0, 0];
2823
+ const $ = `M ${t},${e} C ${v},${N} ${z},${R} ${n},${r}`, k = 0.5, E = 1 - k, _ = E * E * E * t + 3 * E * E * k * v + 3 * E * k * k * z + k * k * k * n, B = E * E * E * e + 3 * E * E * k * N + 3 * E * k * k * R + k * k * k * r;
2824
+ return [$, _, B, 0, 0];
2825
2825
  }
2826
2826
  function rr({ sourceX: t, sourceY: e, targetX: n, targetY: r }) {
2827
- const s = Math.abs(n - t), o = Math.max(s * 0.5, 50), i = t + o, c = n - o, u = `M ${t},${e} C ${i},${e} ${c},${r} ${n},${r}`, l = 0.5, y = 0.5, m = y * y * y * t + 3 * y * y * l * i + 3 * y * l * l * c + l * l * l * n, C = y * y * y * e + 3 * y * y * l * e + 3 * y * l * l * r + l * l * l * r;
2828
- return [u, m, C, 0, 0];
2827
+ const s = Math.abs(n - t), o = Math.max(s * 0.5, 50), i = t + o, c = n - o, u = `M ${t},${e} C ${i},${e} ${c},${r} ${n},${r}`, l = 0.5, g = 0.5, v = g * g * g * t + 3 * g * g * l * i + 3 * g * l * l * c + l * l * l * n, N = g * g * g * e + 3 * g * g * l * e + 3 * g * l * l * r + l * l * l * r;
2828
+ return [u, v, N, 0, 0];
2829
2829
  }
2830
2830
  function kn({
2831
2831
  sourceX: t,
@@ -2841,11 +2841,11 @@ function kn({
2841
2841
  if (u) {
2842
2842
  if (Math.abs(r - e) < 1)
2843
2843
  return [`M ${t},${e} L ${n},${r}`, (t + n) / 2, e, 0, 0];
2844
- const z = (t + n) / 2, M = r > e ? 1 : -1;
2845
- return [`M ${t},${e} L ${z - l},${e} Q ${z},${e} ${z},${e + M * l} L ${z},${r - M * l} Q ${z},${r} ${z + (n > z ? l : -l)},${r} L ${n},${r}`, z, (e + r) / 2, 0, 0];
2844
+ const z = (t + n) / 2, R = r > e ? 1 : -1;
2845
+ return [`M ${t},${e} L ${z - l},${e} Q ${z},${e} ${z},${e + R * l} L ${z},${r - R * l} Q ${z},${r} ${z + (n > z ? l : -l)},${r} L ${n},${r}`, z, (e + r) / 2, 0, 0];
2846
2846
  }
2847
- const y = (e + r) / 2, m = n > t ? 1 : -1;
2848
- return [`M ${t},${e} L ${t},${y - l} Q ${t},${y} ${t + m * l},${y} L ${n - m * l},${y} Q ${n},${y} ${n},${y + (r > y ? l : -l)} L ${n},${r}`, (t + n) / 2, y, 0, 0];
2847
+ const g = (e + r) / 2, v = n > t ? 1 : -1;
2848
+ return [`M ${t},${e} L ${t},${g - l} Q ${t},${g} ${t + v * l},${g} L ${n - v * l},${g} Q ${n},${g} ${n},${g + (r > g ? l : -l)} L ${n},${r}`, (t + n) / 2, g, 0, 0];
2849
2849
  }
2850
2850
  function zo({ sourceX: t, sourceY: e, targetX: n, targetY: r }) {
2851
2851
  const [, s, o] = nr({ sourceX: t, sourceY: e, targetX: n, targetY: r });
@@ -2903,20 +2903,20 @@ function ln(t, e) {
2903
2903
  }
2904
2904
  }
2905
2905
  function Yr(t, e, n, r, s, o, i, c) {
2906
- const u = Math.min(t, n), l = Math.max(t, n), y = Math.min(e, r), m = Math.max(e, r);
2907
- if (l <= s || u >= s + i || m <= o || y >= o + c) return !1;
2908
- const C = 0.5;
2909
- if (t > s + C && t < s + i - C && e > o + C && e < o + c - C || n > s + C && n < s + i - C && r > o + C && r < o + c - C) return !0;
2910
- const z = (t + n) / 2, M = (e + r) / 2;
2911
- if (z > s + C && z < s + i - C && M > o + C && M < o + c - C) return !0;
2906
+ const u = Math.min(t, n), l = Math.max(t, n), g = Math.min(e, r), v = Math.max(e, r);
2907
+ if (l <= s || u >= s + i || v <= o || g >= o + c) return !1;
2908
+ const N = 0.5;
2909
+ if (t > s + N && t < s + i - N && e > o + N && e < o + c - N || n > s + N && n < s + i - N && r > o + N && r < o + c - N) return !0;
2910
+ const z = (t + n) / 2, R = (e + r) / 2;
2911
+ if (z > s + N && z < s + i - N && R > o + N && R < o + c - N) return !0;
2912
2912
  const $ = [[s, o], [s + i, o], [s + i, o + c], [s, o + c]];
2913
- for (let R = 0; R < 4; R++)
2914
- if (Ur(t, e, n, r, $[R][0], $[R][1], $[(R + 1) % 4][0], $[(R + 1) % 4][1])) return !0;
2913
+ for (let k = 0; k < 4; k++)
2914
+ if (Ur(t, e, n, r, $[k][0], $[k][1], $[(k + 1) % 4][0], $[(k + 1) % 4][1])) return !0;
2915
2915
  return !1;
2916
2916
  }
2917
2917
  function Ur(t, e, n, r, s, o, i, c) {
2918
- const u = (i - s) * (e - o) - (c - o) * (t - s), l = (i - s) * (r - o) - (c - o) * (n - s), y = (n - t) * (o - e) - (r - e) * (s - t), m = (n - t) * (c - e) - (r - e) * (i - t);
2919
- return (u > 0 && l < 0 || u < 0 && l > 0) && (y > 0 && m < 0 || y < 0 && m > 0);
2918
+ const u = (i - s) * (e - o) - (c - o) * (t - s), l = (i - s) * (r - o) - (c - o) * (n - s), g = (n - t) * (o - e) - (r - e) * (s - t), v = (n - t) * (c - e) - (r - e) * (i - t);
2919
+ return (u > 0 && l < 0 || u < 0 && l > 0) && (g > 0 && v < 0 || g < 0 && v > 0);
2920
2920
  }
2921
2921
  function zn(t, e, n, r, s) {
2922
2922
  for (let o = 0; o < s.length; o++) {
@@ -2956,44 +2956,44 @@ function sr(t, e, n) {
2956
2956
  r.add(t.x), r.add(e.x), s.add(t.y), s.add(e.y);
2957
2957
  const o = Ue + 5;
2958
2958
  t.dir === "right" ? r.add(t.x + o) : t.dir === "left" ? r.add(t.x - o) : t.dir === "top" ? s.add(t.y - o) : t.dir === "bottom" && s.add(t.y + o), e.dir === "right" ? r.add(e.x + o) : e.dir === "left" ? r.add(e.x - o) : e.dir === "top" ? s.add(e.y - o) : e.dir === "bottom" && s.add(e.y + o);
2959
- for (let k = 0; k < n.length; k++) {
2960
- const B = n[k];
2961
- r.add(B.x), r.add(B.x + B.w), s.add(B.y), s.add(B.y + B.h);
2959
+ for (let x = 0; x < n.length; x++) {
2960
+ const T = n[x];
2961
+ r.add(T.x), r.add(T.x + T.w), s.add(T.y), s.add(T.y + T.h);
2962
2962
  }
2963
- const i = [...r].sort((k, B) => k - B), c = [...s].sort((k, B) => k - B), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2964
- for (let k = 0; k < i.length; k++) u.set(i[k], k);
2965
- for (let k = 0; k < c.length; k++) l.set(c[k], k);
2966
- const y = i.length, m = c.length, C = (k, B) => B * y + k, z = u.get(t.x), M = l.get(t.y), $ = u.get(e.x), R = l.get(e.y);
2967
- if (z === void 0 || M === void 0 || $ === void 0 || R === void 0) return null;
2968
- const E = C(z, M), _ = C($, R), D = new Float64Array(y * m).fill(1 / 0), g = new Float64Array(y * m).fill(1 / 0), f = new Int32Array(y * m).fill(-1), p = new Int8Array(y * m).fill(-1), v = new Uint8Array(y * m);
2969
- D[E] = 0, g[E] = Math.abs(i[$] - t.x) + Math.abs(c[R] - t.y);
2970
- const L = [E], w = 15, P = [[1, 0], [-1, 0], [0, 1], [0, -1]];
2971
- for (; L.length > 0; ) {
2972
- let k = 0;
2973
- for (let q = 1; q < L.length; q++)
2974
- g[L[q]] < g[L[k]] && (k = q);
2975
- const B = L[k];
2976
- if (L[k] = L[L.length - 1], L.pop(), B === _) {
2963
+ const i = [...r].sort((x, T) => x - T), c = [...s].sort((x, T) => x - T), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2964
+ for (let x = 0; x < i.length; x++) u.set(i[x], x);
2965
+ for (let x = 0; x < c.length; x++) l.set(c[x], x);
2966
+ const g = i.length, v = c.length, N = (x, T) => T * g + x, z = u.get(t.x), R = l.get(t.y), $ = u.get(e.x), k = l.get(e.y);
2967
+ if (z === void 0 || R === void 0 || $ === void 0 || k === void 0) return null;
2968
+ const E = N(z, R), _ = N($, k), B = new Float64Array(g * v).fill(1 / 0), D = new Float64Array(g * v).fill(1 / 0), f = new Int32Array(g * v).fill(-1), h = new Int8Array(g * v).fill(-1), p = new Uint8Array(g * v);
2969
+ B[E] = 0, D[E] = Math.abs(i[$] - t.x) + Math.abs(c[k] - t.y);
2970
+ const M = [E], w = 15, C = [[1, 0], [-1, 0], [0, 1], [0, -1]];
2971
+ for (; M.length > 0; ) {
2972
+ let x = 0;
2973
+ for (let q = 1; q < M.length; q++)
2974
+ D[M[q]] < D[M[x]] && (x = q);
2975
+ const T = M[x];
2976
+ if (M[x] = M[M.length - 1], M.pop(), T === _) {
2977
2977
  const q = [];
2978
2978
  let G = _;
2979
2979
  for (; G !== -1 && G !== E; ) {
2980
- const ot = G / y | 0, lt = G % y;
2980
+ const ot = G / g | 0, lt = G % g;
2981
2981
  q.unshift({ x: i[lt], y: c[ot] }), G = f[G];
2982
2982
  }
2983
2983
  return q.unshift({ x: t.x, y: t.y }), jr(q, n);
2984
2984
  }
2985
- if (v[B]) continue;
2986
- v[B] = 1;
2987
- const j = B / y | 0, X = B % y, xt = i[X], K = c[j], rt = p[B];
2985
+ if (p[T]) continue;
2986
+ p[T] = 1;
2987
+ const j = T / g | 0, W = T % g, xt = i[W], K = c[j], rt = h[T];
2988
2988
  for (let q = 0; q < 4; q++) {
2989
- const G = X + P[q][0], ot = j + P[q][1];
2990
- if (G < 0 || G >= y || ot < 0 || ot >= m) continue;
2991
- const lt = C(G, ot);
2992
- if (v[lt]) continue;
2989
+ const G = W + C[q][0], ot = j + C[q][1];
2990
+ if (G < 0 || G >= g || ot < 0 || ot >= v) continue;
2991
+ const lt = N(G, ot);
2992
+ if (p[lt]) continue;
2993
2993
  const ut = i[G], st = c[ot];
2994
2994
  if (qr(ut, st, n) || !zn(xt, K, ut, st, n)) continue;
2995
- const It = Math.abs(ut - xt) + Math.abs(st - K), it = rt >= 0 && rt !== q ? w : 0, mt = D[B] + It + it;
2996
- mt < D[lt] && (f[lt] = B, p[lt] = q, D[lt] = mt, g[lt] = mt + Math.abs(i[$] - ut) + Math.abs(c[R] - st), L.push(lt));
2995
+ const It = Math.abs(ut - xt) + Math.abs(st - K), it = rt >= 0 && rt !== q ? w : 0, mt = B[T] + It + it;
2996
+ mt < B[lt] && (f[lt] = T, h[lt] = q, B[lt] = mt, D[lt] = mt + Math.abs(i[$] - ut) + Math.abs(c[k] - st), M.push(lt));
2997
2997
  }
2998
2998
  }
2999
2999
  return null;
@@ -3033,8 +3033,8 @@ function Gr(t) {
3033
3033
  if (i.length < 2) continue;
3034
3034
  const c = (i.length - 1) * nn / 2;
3035
3035
  for (let u = 0; u < i.length; u++) {
3036
- const l = i[u], y = -c + u * nn, m = r.get(l.edgeId);
3037
- m && (m[l.segIdx].y += y, m[l.segIdx + 1].y += y);
3036
+ const l = i[u], g = -c + u * nn, v = r.get(l.edgeId);
3037
+ v && (v[l.segIdx].y += g, v[l.segIdx + 1].y += g);
3038
3038
  }
3039
3039
  }
3040
3040
  }
@@ -3045,8 +3045,8 @@ function Gr(t) {
3045
3045
  if (i.length < 2) continue;
3046
3046
  const c = (i.length - 1) * nn / 2;
3047
3047
  for (let u = 0; u < i.length; u++) {
3048
- const l = i[u], y = -c + u * nn, m = r.get(l.edgeId);
3049
- m && (m[l.segIdx].x += y, m[l.segIdx + 1].x += y);
3048
+ const l = i[u], g = -c + u * nn, v = r.get(l.edgeId);
3049
+ v && (v[l.segIdx].x += g, v[l.segIdx + 1].x += g);
3050
3050
  }
3051
3051
  }
3052
3052
  }
@@ -3071,10 +3071,10 @@ function En(t, e = 6, n = !1) {
3071
3071
  const r = e;
3072
3072
  let s = `M ${t[0].x},${t[0].y}`;
3073
3073
  for (let o = 1; o < t.length - 1; o++) {
3074
- const i = t[o - 1], c = t[o], u = t[o + 1], l = Math.abs(c.x - i.x) + Math.abs(c.y - i.y), y = Math.abs(u.x - c.x) + Math.abs(u.y - c.y), m = Math.min(r, l / 2, y / 2);
3075
- if (m > 0.5) {
3076
- const C = c.x - i.x, z = c.y - i.y, M = u.x - c.x, $ = u.y - c.y, R = Math.sqrt(C * C + z * z) || 1, E = Math.sqrt(M * M + $ * $) || 1;
3077
- s += ` L ${c.x - C / R * m},${c.y - z / R * m}`, s += ` Q ${c.x},${c.y} ${c.x + M / E * m},${c.y + $ / E * m}`;
3074
+ const i = t[o - 1], c = t[o], u = t[o + 1], l = Math.abs(c.x - i.x) + Math.abs(c.y - i.y), g = Math.abs(u.x - c.x) + Math.abs(u.y - c.y), v = Math.min(r, l / 2, g / 2);
3075
+ if (v > 0.5) {
3076
+ const N = c.x - i.x, z = c.y - i.y, R = u.x - c.x, $ = u.y - c.y, k = Math.sqrt(N * N + z * z) || 1, E = Math.sqrt(R * R + $ * $) || 1;
3077
+ s += ` L ${c.x - N / k * v},${c.y - z / k * v}`, s += ` Q ${c.x},${c.y} ${c.x + R / E * v},${c.y + $ / E * v}`;
3078
3078
  } else
3079
3079
  s += ` L ${c.x},${c.y}`;
3080
3080
  }
@@ -3088,8 +3088,8 @@ function Zr(t) {
3088
3088
  const e = 0.3;
3089
3089
  let n = `M ${t[0].x},${t[0].y}`;
3090
3090
  for (let r = 0; r < t.length - 1; r++) {
3091
- const s = t[r === 0 ? 0 : r - 1], o = t[r], i = t[r + 1], c = t[r + 2 < t.length ? r + 2 : t.length - 1], u = o.x + (i.x - s.x) * e, l = o.y + (i.y - s.y) * e, y = i.x - (c.x - o.x) * e, m = i.y - (c.y - o.y) * e;
3092
- n += ` C ${u},${l} ${y},${m} ${i.x},${i.y}`;
3091
+ const s = t[r === 0 ? 0 : r - 1], o = t[r], i = t[r + 1], c = t[r + 2 < t.length ? r + 2 : t.length - 1], u = o.x + (i.x - s.x) * e, l = o.y + (i.y - s.y) * e, g = i.x - (c.x - o.x) * e, v = i.y - (c.y - o.y) * e;
3092
+ n += ` C ${u},${l} ${g},${v} ${i.x},${i.y}`;
3093
3093
  }
3094
3094
  return n;
3095
3095
  }
@@ -3112,30 +3112,30 @@ function Cn(t) {
3112
3112
  }
3113
3113
  return { x: t[0].x, y: t[0].y };
3114
3114
  }
3115
- function Lo(t, e) {
3115
+ function No(t, e) {
3116
3116
  if (!t || !e || t.length === 0 || e.length === 0) return e;
3117
3117
  const n = {};
3118
3118
  for (const o of t) n[o.id] = o;
3119
3119
  const r = or(t, null), s = e.map((o) => {
3120
- var p, v, L, w;
3120
+ var h, p, M, w;
3121
3121
  const i = o.type || "default";
3122
3122
  if (i === "bezier" || i === "simplebezier" || i === "default") return o;
3123
3123
  const c = n[o.source], u = n[o.target];
3124
3124
  if (!c || !u || c.hidden || u.hidden) return o;
3125
- const l = Wn(c, "source", o.sourceHandle), y = Wn(u, "target", o.targetHandle), m = ln(l, cn), C = ln(y, cn), z = 5, M = r.filter((P) => P.id !== o.source && P.id !== o.target), $ = c._absolutePosition || c.position, R = c.width || ((p = c.measured) == null ? void 0 : p.width) || sn, E = c.height || ((v = c.measured) == null ? void 0 : v.height) || an;
3126
- M.push({ id: o.source, x: $.x - z, y: $.y - z, w: R + 2 * z, h: E + 2 * z });
3127
- const _ = u._absolutePosition || u.position, D = u.width || ((L = u.measured) == null ? void 0 : L.width) || sn, g = u.height || ((w = u.measured) == null ? void 0 : w.height) || an;
3128
- if (M.push({ id: o.target, x: _.x - z, y: _.y - z, w: D + 2 * z, h: g + 2 * z }), M.length === 0) return o;
3129
- const f = sr(m, C, M);
3130
- return f && f.length >= 2 ? (f.unshift({ x: l.x, y: l.y }), f.push({ x: y.x, y: y.y }), { ...o, _routedPoints: f }) : o;
3125
+ const l = Wn(c, "source", o.sourceHandle), g = Wn(u, "target", o.targetHandle), v = ln(l, cn), N = ln(g, cn), z = 5, R = r.filter((C) => C.id !== o.source && C.id !== o.target), $ = c._absolutePosition || c.position, k = c.width || ((h = c.measured) == null ? void 0 : h.width) || sn, E = c.height || ((p = c.measured) == null ? void 0 : p.height) || an;
3126
+ R.push({ id: o.source, x: $.x - z, y: $.y - z, w: k + 2 * z, h: E + 2 * z });
3127
+ const _ = u._absolutePosition || u.position, B = u.width || ((M = u.measured) == null ? void 0 : M.width) || sn, D = u.height || ((w = u.measured) == null ? void 0 : w.height) || an;
3128
+ if (R.push({ id: o.target, x: _.x - z, y: _.y - z, w: B + 2 * z, h: D + 2 * z }), R.length === 0) return o;
3129
+ const f = sr(v, N, R);
3130
+ return f && f.length >= 2 ? (f.unshift({ x: l.x, y: l.y }), f.push({ x: g.x, y: g.y }), { ...o, _routedPoints: f }) : o;
3131
3131
  });
3132
3132
  return Gr(s);
3133
3133
  }
3134
- function No(t, e, n, r, s, o, i, c) {
3134
+ function Lo(t, e, n, r, s, o, i, c) {
3135
3135
  const u = or(i, c ? new Set(c) : null);
3136
3136
  if (u.length === 0) return null;
3137
- const l = { x: t, y: e, dir: s || "right" }, y = { x: n, y: r, dir: o || "left" }, m = ln(l, cn), C = ln(y, cn), z = sr(m, C, u);
3138
- return z && z.length >= 2 ? (z.unshift({ x: l.x, y: l.y }), z.push({ x: y.x, y: y.y }), z) : null;
3137
+ const l = { x: t, y: e, dir: s || "right" }, g = { x: n, y: r, dir: o || "left" }, v = ln(l, cn), N = ln(g, cn), z = sr(v, N, u);
3138
+ return z && z.length >= 2 ? (z.unshift({ x: l.x, y: l.y }), z.push({ x: g.x, y: g.y }), z) : null;
3139
3139
  }
3140
3140
  const ir = Zt(function({
3141
3141
  id: e,
@@ -3147,37 +3147,37 @@ const ir = Zt(function({
3147
3147
  labelStyle: c,
3148
3148
  labelShowBg: u,
3149
3149
  labelBgStyle: l,
3150
- labelBgPadding: y,
3151
- labelBgBorderRadius: m,
3152
- style: C,
3150
+ labelBgPadding: g,
3151
+ labelBgBorderRadius: v,
3152
+ style: N,
3153
3153
  markerEnd: z,
3154
- markerStart: M,
3154
+ markerStart: R,
3155
3155
  interactionWidth: $,
3156
- routedPoints: R
3156
+ routedPoints: k
3157
3157
  }) {
3158
- let E, _, D;
3159
- if (R && R.length >= 2) {
3160
- E = En(R);
3161
- const g = Cn(R);
3162
- _ = g.x, D = g.y;
3158
+ let E, _, B;
3159
+ if (k && k.length >= 2) {
3160
+ E = En(k);
3161
+ const D = Cn(k);
3162
+ _ = D.x, B = D.y;
3163
3163
  } else
3164
- [E, _, D] = er({ sourceX: n, sourceY: r, targetX: s, targetY: o });
3164
+ [E, _, B] = er({ sourceX: n, sourceY: r, targetX: s, targetY: o });
3165
3165
  return /* @__PURE__ */ S(
3166
3166
  un,
3167
3167
  {
3168
3168
  id: e,
3169
3169
  path: E,
3170
3170
  labelX: _,
3171
- labelY: D,
3171
+ labelY: B,
3172
3172
  label: i,
3173
3173
  labelStyle: c,
3174
3174
  labelShowBg: u,
3175
3175
  labelBgStyle: l,
3176
- labelBgPadding: y,
3177
- labelBgBorderRadius: m,
3178
- style: C,
3176
+ labelBgPadding: g,
3177
+ labelBgBorderRadius: v,
3178
+ style: N,
3179
3179
  markerEnd: z,
3180
- markerStart: M,
3180
+ markerStart: R,
3181
3181
  interactionWidth: $
3182
3182
  }
3183
3183
  );
@@ -3193,24 +3193,24 @@ const ar = Zt(function({
3193
3193
  targetPosition: c = "top",
3194
3194
  label: u,
3195
3195
  labelStyle: l,
3196
- labelShowBg: y,
3197
- labelBgStyle: m,
3198
- labelBgPadding: C,
3196
+ labelShowBg: g,
3197
+ labelBgStyle: v,
3198
+ labelBgPadding: N,
3199
3199
  labelBgBorderRadius: z,
3200
- style: M,
3200
+ style: R,
3201
3201
  markerEnd: $,
3202
- markerStart: R,
3202
+ markerStart: k,
3203
3203
  pathOptions: E,
3204
3204
  interactionWidth: _,
3205
- routedPoints: D
3205
+ routedPoints: B
3206
3206
  }) {
3207
- let g, f, p;
3208
- if (D && D.length >= 2) {
3209
- g = En(D);
3210
- const v = Cn(D);
3211
- f = v.x, p = v.y;
3207
+ let D, f, h;
3208
+ if (B && B.length >= 2) {
3209
+ D = En(B);
3210
+ const p = Cn(B);
3211
+ f = p.x, h = p.y;
3212
3212
  } else
3213
- [g, f, p] = kn({
3213
+ [D, f, h] = kn({
3214
3214
  sourceX: n,
3215
3215
  sourceY: r,
3216
3216
  sourcePosition: i,
@@ -3224,18 +3224,18 @@ const ar = Zt(function({
3224
3224
  un,
3225
3225
  {
3226
3226
  id: e,
3227
- path: g,
3227
+ path: D,
3228
3228
  labelX: f,
3229
- labelY: p,
3229
+ labelY: h,
3230
3230
  label: u,
3231
3231
  labelStyle: l,
3232
- labelShowBg: y,
3233
- labelBgStyle: m,
3234
- labelBgPadding: C,
3232
+ labelShowBg: g,
3233
+ labelBgStyle: v,
3234
+ labelBgPadding: N,
3235
3235
  labelBgBorderRadius: z,
3236
- style: M,
3236
+ style: R,
3237
3237
  markerEnd: $,
3238
- markerStart: R,
3238
+ markerStart: k,
3239
3239
  interactionWidth: _
3240
3240
  }
3241
3241
  );
@@ -3263,23 +3263,23 @@ const cr = Zt(function({
3263
3263
  targetPosition: c,
3264
3264
  label: u,
3265
3265
  labelStyle: l,
3266
- labelShowBg: y,
3267
- labelBgStyle: m,
3268
- labelBgPadding: C,
3266
+ labelShowBg: g,
3267
+ labelBgStyle: v,
3268
+ labelBgPadding: N,
3269
3269
  labelBgBorderRadius: z,
3270
- style: M,
3270
+ style: R,
3271
3271
  markerEnd: $,
3272
- markerStart: R,
3272
+ markerStart: k,
3273
3273
  interactionWidth: E,
3274
3274
  routedPoints: _
3275
3275
  }) {
3276
- let D, g, f;
3276
+ let B, D, f;
3277
3277
  if (_ && _.length >= 2) {
3278
- D = En(_);
3279
- const p = Cn(_);
3280
- g = p.x, f = p.y;
3278
+ B = En(_);
3279
+ const h = Cn(_);
3280
+ D = h.x, f = h.y;
3281
3281
  } else
3282
- [D, g, f] = rr({
3282
+ [B, D, f] = rr({
3283
3283
  sourceX: n,
3284
3284
  sourceY: r,
3285
3285
  targetX: s,
@@ -3289,18 +3289,18 @@ const cr = Zt(function({
3289
3289
  un,
3290
3290
  {
3291
3291
  id: e,
3292
- path: D,
3293
- labelX: g,
3292
+ path: B,
3293
+ labelX: D,
3294
3294
  labelY: f,
3295
3295
  label: u,
3296
3296
  labelStyle: l,
3297
- labelShowBg: y,
3298
- labelBgStyle: m,
3299
- labelBgPadding: C,
3297
+ labelShowBg: g,
3298
+ labelBgStyle: v,
3299
+ labelBgPadding: N,
3300
3300
  labelBgBorderRadius: z,
3301
- style: M,
3301
+ style: R,
3302
3302
  markerEnd: $,
3303
- markerStart: R,
3303
+ markerStart: k,
3304
3304
  interactionWidth: E
3305
3305
  }
3306
3306
  );
@@ -3330,29 +3330,29 @@ function Io({
3330
3330
  width: c = "100%",
3331
3331
  height: u = "420px",
3332
3332
  className: l = "",
3333
- style: y = {},
3333
+ style: g = {},
3334
3334
  // Zoom/Camera
3335
- zoomMin: m,
3336
- zoomMax: C,
3335
+ zoomMin: v,
3336
+ zoomMax: N,
3337
3337
  initialCamera: z,
3338
- fitView: M,
3338
+ fitView: R,
3339
3339
  fitViewOptions: $,
3340
3340
  // Node/Edge callbacks
3341
- onNodesChange: R,
3341
+ onNodesChange: k,
3342
3342
  onEdgesChange: E,
3343
3343
  onConnect: _,
3344
- onConnectStart: D,
3345
- onConnectEnd: g,
3344
+ onConnectStart: B,
3345
+ onConnectEnd: D,
3346
3346
  onNodeClick: f,
3347
- onNodeDoubleClick: p,
3348
- onNodeMouseEnter: v,
3349
- onNodeMouseMove: L,
3347
+ onNodeDoubleClick: h,
3348
+ onNodeMouseEnter: p,
3349
+ onNodeMouseMove: M,
3350
3350
  onNodeMouseLeave: w,
3351
- onNodeContextMenu: P,
3352
- onNodeDragStart: k,
3353
- onNodeDrag: B,
3351
+ onNodeContextMenu: C,
3352
+ onNodeDragStart: x,
3353
+ onNodeDrag: T,
3354
3354
  onNodeDragStop: j,
3355
- onEdgeClick: X,
3355
+ onEdgeClick: W,
3356
3356
  onEdgeDoubleClick: xt,
3357
3357
  onEdgeMouseEnter: K,
3358
3358
  onEdgeMouseMove: rt,
@@ -3365,12 +3365,12 @@ function Io({
3365
3365
  onPaneMouseLeave: It,
3366
3366
  onSelectionChange: it,
3367
3367
  onInit: mt,
3368
- onMoveStart: Lt,
3368
+ onMoveStart: Nt,
3369
3369
  onMove: zt,
3370
3370
  onMoveEnd: dt,
3371
3371
  onDelete: ht,
3372
3372
  onBeforeDelete: Rt,
3373
- onError: Nt,
3373
+ onError: Lt,
3374
3374
  // Drag and drop
3375
3375
  onDragOver: gt,
3376
3376
  onDrop: ne,
@@ -3396,7 +3396,7 @@ function Io({
3396
3396
  panOnScrollMode: dn,
3397
3397
  panOnScrollSpeed: fn,
3398
3398
  zoomOnScroll: Qt,
3399
- zoomOnDoubleClick: Ln,
3399
+ zoomOnDoubleClick: Nn,
3400
3400
  zoomOnPinch: hn,
3401
3401
  preventScrolling: fe,
3402
3402
  translateExtent: vt,
@@ -3437,34 +3437,34 @@ function Io({
3437
3437
  onPointerMove: He,
3438
3438
  onPointerUp: _e,
3439
3439
  store: le
3440
- } = Nr({
3440
+ } = Lr({
3441
3441
  cards: t,
3442
3442
  nodes: O,
3443
3443
  edges: bt,
3444
3444
  dark: o,
3445
3445
  gridSize: i,
3446
- zoomMin: m,
3447
- zoomMax: C,
3446
+ zoomMin: v,
3447
+ zoomMax: N,
3448
3448
  initialCamera: z,
3449
- fitView: M,
3449
+ fitView: R,
3450
3450
  fitViewOptions: $,
3451
3451
  onHudUpdate: Ve,
3452
3452
  onNodesProcessed: gn,
3453
- onNodesChange: R,
3453
+ onNodesChange: k,
3454
3454
  onEdgesChange: E,
3455
3455
  onConnect: _,
3456
- onConnectStart: D,
3457
- onConnectEnd: g,
3456
+ onConnectStart: B,
3457
+ onConnectEnd: D,
3458
3458
  onNodeClick: f,
3459
- onNodeDoubleClick: p,
3460
- onNodeMouseEnter: v,
3461
- onNodeMouseMove: L,
3459
+ onNodeDoubleClick: h,
3460
+ onNodeMouseEnter: p,
3461
+ onNodeMouseMove: M,
3462
3462
  onNodeMouseLeave: w,
3463
- onNodeContextMenu: P,
3464
- onNodeDragStart: k,
3465
- onNodeDrag: B,
3463
+ onNodeContextMenu: C,
3464
+ onNodeDragStart: x,
3465
+ onNodeDrag: T,
3466
3466
  onNodeDragStop: j,
3467
- onEdgeClick: X,
3467
+ onEdgeClick: W,
3468
3468
  onEdgeDoubleClick: xt,
3469
3469
  onEdgeMouseEnter: K,
3470
3470
  onEdgeMouseMove: rt,
@@ -3477,12 +3477,12 @@ function Io({
3477
3477
  onPaneMouseLeave: It,
3478
3478
  onSelectionChange: it,
3479
3479
  onInit: mt,
3480
- onMoveStart: Lt,
3480
+ onMoveStart: Nt,
3481
3481
  onMove: zt,
3482
3482
  onMoveEnd: dt,
3483
3483
  onDelete: ht,
3484
3484
  onBeforeDelete: Rt,
3485
- onError: Nt,
3485
+ onError: Lt,
3486
3486
  nodesDraggable: Ot,
3487
3487
  nodesConnectable: Yt,
3488
3488
  elementsSelectable: me,
@@ -3502,7 +3502,7 @@ function Io({
3502
3502
  panOnScrollMode: dn,
3503
3503
  panOnScrollSpeed: fn,
3504
3504
  zoomOnScroll: Qt,
3505
- zoomOnDoubleClick: Ln,
3505
+ zoomOnDoubleClick: Nn,
3506
3506
  zoomOnPinch: hn,
3507
3507
  preventScrolling: fe,
3508
3508
  translateExtent: vt,
@@ -3539,7 +3539,7 @@ function Io({
3539
3539
  {
3540
3540
  ref: Dt,
3541
3541
  className: `ric-wrap ${l}`,
3542
- style: { width: c, height: u, ...y },
3542
+ style: { width: c, height: u, ...g },
3543
3543
  onPointerDown: Ae,
3544
3544
  onPointerMove: He,
3545
3545
  onPointerUp: _e,
@@ -3648,11 +3648,11 @@ function Io({
3648
3648
  ")   zoom: ",
3649
3649
  Ut.zoom,
3650
3650
  "x",
3651
- Ut.nodeCount > 0 && /* @__PURE__ */ $t(Ne, { children: [
3651
+ Ut.nodeCount > 0 && /* @__PURE__ */ $t(Le, { children: [
3652
3652
  "   nodes: ",
3653
3653
  Ut.nodeCount
3654
3654
  ] }),
3655
- Ut.edgeCount > 0 && /* @__PURE__ */ $t(Ne, { children: [
3655
+ Ut.edgeCount > 0 && /* @__PURE__ */ $t(Le, { children: [
3656
3656
  "   edges: ",
3657
3657
  Ut.edgeCount
3658
3658
  ] })
@@ -3745,97 +3745,103 @@ function So(t) {
3745
3745
  return [e, n, r];
3746
3746
  }
3747
3747
  function eo() {
3748
- const t = yt(), e = F(() => [...t.nodesRef.current], [t]), n = F(() => [...t.edgesRef.current], [t]), r = F((g) => t.nodesRef.current.find((f) => f.id === g), [t]), s = F((g) => t.edgesRef.current.find((f) => f.id === g), [t]), o = F((g) => {
3749
- var f, p, v, L;
3750
- if (typeof g == "function") {
3751
- const w = g(t.nodesRef.current);
3752
- (p = (f = t.onNodesChangeRef).current) == null || p.call(f, [
3753
- ...t.nodesRef.current.map((P) => ({ id: P.id, type: "remove" })),
3754
- ...w.map((P) => ({ type: "add", item: P }))
3748
+ const t = yt(), e = F(() => [...t.nodesRef.current], [t]), n = F(() => [...t.edgesRef.current], [t]), r = F((f) => t.nodesRef.current.find((h) => h.id === f), [t]), s = F((f) => t.edgesRef.current.find((h) => h.id === f), [t]), o = F((f) => {
3749
+ var h, p, M, w;
3750
+ if (typeof f == "function") {
3751
+ const C = f(t.nodesRef.current);
3752
+ (p = (h = t.onNodesChangeRef).current) == null || p.call(h, [
3753
+ ...t.nodesRef.current.map((x) => ({ id: x.id, type: "remove" })),
3754
+ ...C.map((x) => ({ type: "add", item: x }))
3755
3755
  ]);
3756
3756
  } else
3757
- (L = (v = t.onNodesChangeRef).current) == null || L.call(v, [
3758
- ...t.nodesRef.current.map((w) => ({ id: w.id, type: "remove" })),
3759
- ...g.map((w) => ({ type: "add", item: w }))
3757
+ (w = (M = t.onNodesChangeRef).current) == null || w.call(M, [
3758
+ ...t.nodesRef.current.map((C) => ({ id: C.id, type: "remove" })),
3759
+ ...f.map((C) => ({ type: "add", item: C }))
3760
3760
  ]);
3761
- }, [t]), i = F((g) => {
3762
- var f, p, v, L;
3763
- if (typeof g == "function") {
3764
- const w = g(t.edgesRef.current);
3765
- (p = (f = t.onEdgesChangeRef).current) == null || p.call(f, [
3766
- ...t.edgesRef.current.map((P) => ({ id: P.id, type: "remove" })),
3767
- ...w.map((P) => ({ type: "add", item: P }))
3761
+ }, [t]), i = F((f) => {
3762
+ var h, p, M, w;
3763
+ if (typeof f == "function") {
3764
+ const C = f(t.edgesRef.current);
3765
+ (p = (h = t.onEdgesChangeRef).current) == null || p.call(h, [
3766
+ ...t.edgesRef.current.map((x) => ({ id: x.id, type: "remove" })),
3767
+ ...C.map((x) => ({ type: "add", item: x }))
3768
3768
  ]);
3769
3769
  } else
3770
- (L = (v = t.onEdgesChangeRef).current) == null || L.call(v, [
3771
- ...t.edgesRef.current.map((w) => ({ id: w.id, type: "remove" })),
3772
- ...g.map((w) => ({ type: "add", item: w }))
3770
+ (w = (M = t.onEdgesChangeRef).current) == null || w.call(M, [
3771
+ ...t.edgesRef.current.map((C) => ({ id: C.id, type: "remove" })),
3772
+ ...f.map((C) => ({ type: "add", item: C }))
3773
3773
  ]);
3774
- }, [t]), c = F((g) => {
3775
- var p, v;
3776
- const f = Array.isArray(g) ? g : [g];
3777
- (v = (p = t.onNodesChangeRef).current) == null || v.call(p, f.map((L) => ({ type: "add", item: L })));
3778
- }, [t]), u = F((g) => {
3779
- var p, v;
3780
- const f = Array.isArray(g) ? g : [g];
3781
- (v = (p = t.onEdgesChangeRef).current) == null || v.call(p, f.map((L) => ({ type: "add", item: L })));
3782
- }, [t]), l = F(({ nodes: g = [], edges: f = [] }) => {
3783
- if (g.length && t.onNodesChangeRef.current) {
3784
- t.onNodesChangeRef.current(g.map((v) => ({ id: v.id, type: "remove" })));
3785
- const p = zr(g, t.edgesRef.current);
3786
- p.length && t.onEdgesChangeRef.current && t.onEdgesChangeRef.current(p.map((v) => ({ id: v.id, type: "remove" })));
3774
+ }, [t]), c = F((f) => {
3775
+ var p, M;
3776
+ const h = Array.isArray(f) ? f : [f];
3777
+ (M = (p = t.onNodesChangeRef).current) == null || M.call(p, h.map((w) => ({ type: "add", item: w })));
3778
+ }, [t]), u = F((f) => {
3779
+ var p, M;
3780
+ const h = Array.isArray(f) ? f : [f];
3781
+ (M = (p = t.onEdgesChangeRef).current) == null || M.call(p, h.map((w) => ({ type: "add", item: w })));
3782
+ }, [t]), l = F(({ nodes: f = [], edges: h = [] }) => {
3783
+ if (f.length && t.onNodesChangeRef.current) {
3784
+ t.onNodesChangeRef.current(f.map((M) => ({ id: M.id, type: "remove" })));
3785
+ const p = zr(f, t.edgesRef.current);
3786
+ p.length && t.onEdgesChangeRef.current && t.onEdgesChangeRef.current(p.map((M) => ({ id: M.id, type: "remove" })));
3787
3787
  }
3788
- f.length && t.onEdgesChangeRef.current && t.onEdgesChangeRef.current(f.map((p) => ({ id: p.id, type: "remove" })));
3789
- }, [t]), y = F(() => {
3790
- const g = t.cameraRef.current;
3791
- return { x: g.x, y: g.y, zoom: g.zoom };
3792
- }, [t]), m = F((g, f) => {
3788
+ h.length && t.onEdgesChangeRef.current && t.onEdgesChangeRef.current(h.map((p) => ({ id: p.id, type: "remove" })));
3789
+ }, [t]), g = F(() => {
3790
+ const f = t.cameraRef.current;
3791
+ return { x: f.x, y: f.y, zoom: f.zoom };
3792
+ }, [t]), v = F((f, h) => {
3793
3793
  t.cameraRef.current = {
3794
- x: g.x ?? t.cameraRef.current.x,
3795
- y: g.y ?? t.cameraRef.current.y,
3796
- zoom: g.zoom ?? t.cameraRef.current.zoom
3794
+ x: f.x ?? t.cameraRef.current.x,
3795
+ y: f.y ?? t.cameraRef.current.y,
3796
+ zoom: f.zoom ?? t.cameraRef.current.zoom
3797
3797
  }, t.sendCamera();
3798
- }, [t]), C = F(() => t.cameraRef.current.zoom, [t]), z = F((g) => {
3799
- const f = t.cameraRef.current, p = t.wrapRef.current;
3798
+ }, [t]), N = F(() => t.cameraRef.current.zoom, [t]), z = F((f) => {
3799
+ const h = t.cameraRef.current, p = t.wrapRef.current;
3800
3800
  if (!p) return;
3801
- const v = p.getBoundingClientRect(), L = v.width / 2, w = v.height / 2, P = 1.2;
3802
- f.x = L - (L - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.min(t.zoomMax, f.zoom * P), t.sendCamera();
3803
- }, [t]), M = F((g) => {
3804
- const f = t.cameraRef.current, p = t.wrapRef.current;
3801
+ const M = p.getBoundingClientRect(), w = M.width / 2, C = M.height / 2, x = 1.2;
3802
+ h.x = w - (w - h.x) * x, h.y = C - (C - h.y) * x, h.zoom = Math.min(t.zoomMax, h.zoom * x), t.sendCamera();
3803
+ }, [t]), R = F((f) => {
3804
+ const h = t.cameraRef.current, p = t.wrapRef.current;
3805
3805
  if (!p) return;
3806
- const v = p.getBoundingClientRect(), L = v.width / 2, w = v.height / 2, P = 1 / 1.2;
3807
- f.x = L - (L - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.max(t.zoomMin, f.zoom * P), t.sendCamera();
3808
- }, [t]), $ = F((g) => {
3809
- const f = t.cameraRef.current, p = t.wrapRef.current;
3806
+ const M = p.getBoundingClientRect(), w = M.width / 2, C = M.height / 2, x = 1 / 1.2;
3807
+ h.x = w - (w - h.x) * x, h.y = C - (C - h.y) * x, h.zoom = Math.max(t.zoomMin, h.zoom * x), t.sendCamera();
3808
+ }, [t]), $ = F((f) => {
3809
+ const h = t.cameraRef.current, p = t.wrapRef.current;
3810
3810
  if (!p) return;
3811
- const v = p.getBoundingClientRect(), L = v.width / 2, w = v.height / 2, P = g / f.zoom;
3812
- f.x = L - (L - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.min(t.zoomMax, Math.max(t.zoomMin, g)), t.sendCamera();
3813
- }, [t]), R = F((g = {}) => {
3814
- const f = t.nodesRef.current;
3815
- if (!f.length) return;
3811
+ const M = p.getBoundingClientRect(), w = M.width / 2, C = M.height / 2, x = f / h.zoom;
3812
+ h.x = w - (w - h.x) * x, h.y = C - (C - h.y) * x, h.zoom = Math.min(t.zoomMax, Math.max(t.zoomMin, f)), t.sendCamera();
3813
+ }, [t]), k = F((f = {}) => {
3814
+ const h = t.nodesRef.current;
3815
+ if (!h.length) return;
3816
3816
  const p = t.wrapRef.current;
3817
3817
  if (!p) return;
3818
- const v = p.getBoundingClientRect(), L = g.padding ?? 0.1, w = g.nodes ? f.filter((B) => g.nodes.some((j) => j.id === B.id)) : f;
3819
- if (!w.length) return;
3820
- const P = Mn(w), k = Rn(P, v.width, v.height, L);
3821
- g.maxZoom && (k.zoom = Math.min(k.zoom, g.maxZoom)), g.minZoom && (k.zoom = Math.max(k.zoom, g.minZoom)), t.cameraRef.current = k, t.sendCamera();
3822
- }, [t]), E = F((g, f, p = {}) => {
3823
- const v = t.wrapRef.current;
3824
- if (!v) return;
3825
- const L = v.getBoundingClientRect(), w = p.zoom ?? t.cameraRef.current.zoom;
3818
+ const M = p.getBoundingClientRect(), w = f.padding ?? 0.1, C = f.nodes ? h.filter((j) => f.nodes.some((W) => W.id === j.id)) : h;
3819
+ if (!C.length) return;
3820
+ const x = Mn(C), T = Rn(x, M.width, M.height, w);
3821
+ f.maxZoom && (T.zoom = Math.min(T.zoom, f.maxZoom)), f.minZoom && (T.zoom = Math.max(T.zoom, f.minZoom)), t.cameraRef.current = T, t.sendCamera();
3822
+ }, [t]), E = F((f, h, p = {}) => {
3823
+ const M = t.wrapRef.current;
3824
+ if (!M) return;
3825
+ const w = M.getBoundingClientRect(), C = p.zoom ?? t.cameraRef.current.zoom;
3826
3826
  t.cameraRef.current = {
3827
- x: L.width / 2 - g * w,
3828
- y: L.height / 2 - f * w,
3829
- zoom: w
3827
+ x: w.width / 2 - f * C,
3828
+ y: w.height / 2 - h * C,
3829
+ zoom: C
3830
3830
  }, t.sendCamera();
3831
- }, [t]), _ = F((g) => t.screenToWorld(g.x, g.y), [t]), D = F((g) => {
3832
- const f = t.cameraRef.current, p = t.wrapRef.current;
3831
+ }, [t]), _ = F((f) => t.screenToWorld(f.x, f.y), [t]), B = F((f) => {
3832
+ const h = t.cameraRef.current, p = t.wrapRef.current;
3833
3833
  if (!p) return { x: 0, y: 0 };
3834
- const v = p.getBoundingClientRect();
3834
+ const M = p.getBoundingClientRect();
3835
3835
  return {
3836
- x: g.x * f.zoom + f.x + v.left,
3837
- y: g.y * f.zoom + f.y + v.top
3836
+ x: f.x * h.zoom + h.x + M.left,
3837
+ y: f.y * h.zoom + h.y + M.top
3838
3838
  };
3839
+ }, [t]), D = F((f, h) => {
3840
+ var w, C;
3841
+ const p = t.nodesRef.current.find((x) => x.id === f);
3842
+ if (!p) return;
3843
+ const M = typeof h == "function" ? h(p.data) : { ...p.data, ...h };
3844
+ (C = (w = t.onNodesChangeRef).current) == null || C.call(w, [{ id: f, type: "replace", item: { ...p, data: M } }]);
3839
3845
  }, [t]);
3840
3846
  return {
3841
3847
  getNodes: e,
@@ -3847,16 +3853,17 @@ function eo() {
3847
3853
  addNodes: c,
3848
3854
  addEdges: u,
3849
3855
  deleteElements: l,
3850
- getViewport: y,
3851
- setViewport: m,
3852
- getZoom: C,
3856
+ getViewport: g,
3857
+ setViewport: v,
3858
+ getZoom: N,
3853
3859
  zoomIn: z,
3854
- zoomOut: M,
3860
+ zoomOut: R,
3855
3861
  zoomTo: $,
3856
- fitView: R,
3862
+ fitView: k,
3857
3863
  setCenter: E,
3858
3864
  screenToFlowPosition: _,
3859
- flowToScreenPosition: D
3865
+ flowToScreenPosition: B,
3866
+ updateNodeData: D
3860
3867
  };
3861
3868
  }
3862
3869
  function Bo() {
@@ -3967,52 +3974,52 @@ function Qo({
3967
3974
  style: o = {},
3968
3975
  className: i = ""
3969
3976
  }) {
3970
- const c = yt(), u = tt(null), l = tt(null), y = F(() => {
3971
- const m = u.current;
3972
- if (!m) return;
3973
- const C = m.getContext("2d"), z = window.devicePixelRatio || 1;
3974
- m.width = t * z, m.height = e * z, C.scale(z, z), C.clearRect(0, 0, t, e);
3975
- const M = c.nodesRef.current;
3976
- if (!M.length) return;
3977
- let $ = 1 / 0, R = 1 / 0, E = -1 / 0, _ = -1 / 0;
3978
- for (const k of M) {
3979
- const B = k.width || wn, j = k.height || bn;
3980
- k.position.x < $ && ($ = k.position.x), k.position.y < R && (R = k.position.y), k.position.x + B > E && (E = k.position.x + B), k.position.y + j > _ && (_ = k.position.y + j);
3977
+ const c = yt(), u = tt(null), l = tt(null), g = F(() => {
3978
+ const v = u.current;
3979
+ if (!v) return;
3980
+ const N = v.getContext("2d"), z = window.devicePixelRatio || 1;
3981
+ v.width = t * z, v.height = e * z, N.scale(z, z), N.clearRect(0, 0, t, e);
3982
+ const R = c.nodesRef.current;
3983
+ if (!R.length) return;
3984
+ let $ = 1 / 0, k = 1 / 0, E = -1 / 0, _ = -1 / 0;
3985
+ for (const x of R) {
3986
+ const T = x.width || wn, j = x.height || bn;
3987
+ x.position.x < $ && ($ = x.position.x), x.position.y < k && (k = x.position.y), x.position.x + T > E && (E = x.position.x + T), x.position.y + j > _ && (_ = x.position.y + j);
3981
3988
  }
3982
- const D = 40;
3983
- $ -= D, R -= D, E += D, _ += D;
3984
- const g = E - $, f = _ - R, p = Math.min(t / g, e / f), v = (t - g * p) / 2, L = (e - f * p) / 2;
3985
- for (const k of M) {
3986
- if (k.hidden) continue;
3987
- const B = k.width || wn, j = k.height || bn, X = (k.position.x - $) * p + v, xt = (k.position.y - R) * p + L, K = B * p, rt = j * p;
3988
- C.fillStyle = k.selected ? "#f59e0b" : typeof n == "function" ? n(k) : n, C.fillRect(X, xt, Math.max(K, 2), Math.max(rt, 2));
3989
+ const B = 40;
3990
+ $ -= B, k -= B, E += B, _ += B;
3991
+ const D = E - $, f = _ - k, h = Math.min(t / D, e / f), p = (t - D * h) / 2, M = (e - f * h) / 2;
3992
+ for (const x of R) {
3993
+ if (x.hidden) continue;
3994
+ const T = x.width || wn, j = x.height || bn, W = (x.position.x - $) * h + p, xt = (x.position.y - k) * h + M, K = T * h, rt = j * h;
3995
+ N.fillStyle = x.selected ? "#f59e0b" : typeof n == "function" ? n(x) : n, N.fillRect(W, xt, Math.max(K, 2), Math.max(rt, 2));
3989
3996
  }
3990
- const w = c.cameraRef.current, P = c.wrapRef.current;
3991
- if (P) {
3992
- const k = P.getBoundingClientRect(), B = -w.x / w.zoom, j = -w.y / w.zoom, X = k.width / w.zoom, xt = k.height / w.zoom;
3993
- C.fillStyle = s, C.fillRect(0, 0, t, e);
3994
- const K = (B - $) * p + v, rt = (j - R) * p + L, q = X * p, G = xt * p;
3995
- C.clearRect(K, rt, q, G);
3996
- for (const ot of M) {
3997
+ const w = c.cameraRef.current, C = c.wrapRef.current;
3998
+ if (C) {
3999
+ const x = C.getBoundingClientRect(), T = -w.x / w.zoom, j = -w.y / w.zoom, W = x.width / w.zoom, xt = x.height / w.zoom;
4000
+ N.fillStyle = s, N.fillRect(0, 0, t, e);
4001
+ const K = (T - $) * h + p, rt = (j - k) * h + M, q = W * h, G = xt * h;
4002
+ N.clearRect(K, rt, q, G);
4003
+ for (const ot of R) {
3997
4004
  if (ot.hidden) continue;
3998
- const lt = ot.width || wn, ut = ot.height || bn, st = (ot.position.x - $) * p + v, It = (ot.position.y - R) * p + L;
3999
- C.fillStyle = ot.selected ? "#f59e0b" : typeof n == "function" ? n(ot) : n, C.fillRect(st, It, Math.max(lt * p, 2), Math.max(ut * p, 2));
4005
+ const lt = ot.width || wn, ut = ot.height || bn, st = (ot.position.x - $) * h + p, It = (ot.position.y - k) * h + M;
4006
+ N.fillStyle = ot.selected ? "#f59e0b" : typeof n == "function" ? n(ot) : n, N.fillRect(st, It, Math.max(lt * h, 2), Math.max(ut * h, 2));
4000
4007
  }
4001
- C.strokeStyle = "#3b82f6", C.lineWidth = 1.5, C.strokeRect(K, rt, q, G);
4008
+ N.strokeStyle = "#3b82f6", N.lineWidth = 1.5, N.strokeRect(K, rt, q, G);
4002
4009
  }
4003
4010
  }, [c, t, e, n, r, s]);
4004
4011
  return ft(() => {
4005
- let m = !0;
4006
- function C() {
4007
- m && (y(), l.current = requestAnimationFrame(C));
4012
+ let v = !0;
4013
+ function N() {
4014
+ v && (g(), l.current = requestAnimationFrame(N));
4008
4015
  }
4009
4016
  const z = setInterval(() => {
4010
- cancelAnimationFrame(l.current), l.current = requestAnimationFrame(C);
4017
+ cancelAnimationFrame(l.current), l.current = requestAnimationFrame(N);
4011
4018
  }, 66);
4012
- return y(), () => {
4013
- m = !1, clearInterval(z), cancelAnimationFrame(l.current);
4019
+ return g(), () => {
4020
+ v = !1, clearInterval(z), cancelAnimationFrame(l.current);
4014
4021
  };
4015
- }, [y]), /* @__PURE__ */ S(
4022
+ }, [g]), /* @__PURE__ */ S(
4016
4023
  "canvas",
4017
4024
  {
4018
4025
  ref: u,
@@ -4078,21 +4085,21 @@ function ao({
4078
4085
  onInteractiveChange: c,
4079
4086
  position: u = "bottom-left",
4080
4087
  orientation: l = "vertical",
4081
- style: y = {},
4082
- className: m = "",
4083
- "aria-label": C = "Canvas controls",
4088
+ style: g = {},
4089
+ className: v = "",
4090
+ "aria-label": N = "Canvas controls",
4084
4091
  children: z
4085
4092
  }) {
4086
- const M = yt(), { zoomIn: $, zoomOut: R, fitView: E, getZoom: _ } = eo(), [D, g] = Gt(!0), f = _() <= M.zoomMin, p = _() >= M.zoomMax, v = F(() => {
4093
+ const R = yt(), { zoomIn: $, zoomOut: k, fitView: E, getZoom: _ } = eo(), [B, D] = Gt(!0), f = _() <= R.zoomMin, h = _() >= R.zoomMax, p = F(() => {
4087
4094
  $(), s == null || s();
4088
- }, [$, s]), L = F(() => {
4089
- R(), o == null || o();
4090
- }, [R, o]), w = F(() => {
4095
+ }, [$, s]), M = F(() => {
4096
+ k(), o == null || o();
4097
+ }, [k, o]), w = F(() => {
4091
4098
  E(r || { padding: 0.1 }), i == null || i();
4092
- }, [E, r, i]), P = F(() => {
4093
- const B = !D;
4094
- g(B), c == null || c(B);
4095
- }, [D, c]), k = {
4099
+ }, [E, r, i]), C = F(() => {
4100
+ const T = !B;
4101
+ D(T), c == null || c(T);
4102
+ }, [B, c]), x = {
4096
4103
  "top-left": { top: 10, left: 10 },
4097
4104
  "top-right": { top: 10, right: 10 },
4098
4105
  "top-center": { top: 10, left: "50%", transform: "translateX(-50%)" },
@@ -4103,25 +4110,25 @@ function ao({
4103
4110
  return /* @__PURE__ */ $t(
4104
4111
  "div",
4105
4112
  {
4106
- className: `ric-controls ${m}`,
4113
+ className: `ric-controls ${v}`,
4107
4114
  style: {
4108
4115
  position: "absolute",
4109
4116
  display: "flex",
4110
4117
  flexDirection: l === "horizontal" ? "row" : "column",
4111
4118
  gap: 2,
4112
4119
  zIndex: 5,
4113
- ...k,
4114
- ...y
4120
+ ...x,
4121
+ ...g
4115
4122
  },
4116
4123
  role: "toolbar",
4117
- "aria-label": C,
4124
+ "aria-label": N,
4118
4125
  children: [
4119
- t && /* @__PURE__ */ $t(Ne, { children: [
4126
+ t && /* @__PURE__ */ $t(Le, { children: [
4120
4127
  /* @__PURE__ */ S(
4121
4128
  rn,
4122
4129
  {
4123
- onClick: v,
4124
- disabled: p,
4130
+ onClick: p,
4131
+ disabled: h,
4125
4132
  title: "Zoom in",
4126
4133
  "aria-label": "Zoom in",
4127
4134
  className: "ric-controls-zoomin",
@@ -4131,7 +4138,7 @@ function ao({
4131
4138
  /* @__PURE__ */ S(
4132
4139
  rn,
4133
4140
  {
4134
- onClick: L,
4141
+ onClick: M,
4135
4142
  disabled: f,
4136
4143
  title: "Zoom out",
4137
4144
  "aria-label": "Zoom out",
@@ -4153,11 +4160,11 @@ function ao({
4153
4160
  n && /* @__PURE__ */ S(
4154
4161
  rn,
4155
4162
  {
4156
- onClick: P,
4157
- title: D ? "Lock interactivity" : "Unlock interactivity",
4158
- "aria-label": D ? "Lock interactivity" : "Unlock interactivity",
4163
+ onClick: C,
4164
+ title: B ? "Lock interactivity" : "Unlock interactivity",
4165
+ "aria-label": B ? "Lock interactivity" : "Unlock interactivity",
4159
4166
  className: "ric-controls-interactive",
4160
- children: D ? /* @__PURE__ */ S(io, {}) : /* @__PURE__ */ S(so, {})
4167
+ children: B ? /* @__PURE__ */ S(io, {}) : /* @__PURE__ */ S(so, {})
4161
4168
  }
4162
4169
  ),
4163
4170
  z
@@ -4235,34 +4242,34 @@ function ts({
4235
4242
  color: c = "#3b82f6",
4236
4243
  onResizeStart: u,
4237
4244
  onResize: l,
4238
- onResizeEnd: y
4245
+ onResizeEnd: g
4239
4246
  }) {
4240
- const m = qe(je), C = yt(), z = tt(null), M = F((E, _) => {
4247
+ const v = qe(je), N = yt(), z = tt(null), R = F((E, _) => {
4241
4248
  E.stopPropagation(), E.preventDefault();
4242
- const D = C.nodesRef.current.find((p) => p.id === m);
4243
- if (!D) return;
4249
+ const B = N.nodesRef.current.find((h) => h.id === v);
4250
+ if (!B) return;
4244
4251
  z.current = {
4245
4252
  direction: _,
4246
4253
  startX: E.clientX,
4247
4254
  startY: E.clientY,
4248
- width: D.width || 160,
4249
- height: D.height || 60
4255
+ width: B.width || 160,
4256
+ height: B.height || 60
4250
4257
  }, u == null || u(E, { width: z.current.width, height: z.current.height });
4251
- const g = (p) => {
4252
- var j, X;
4258
+ const D = (h) => {
4259
+ var j, W;
4253
4260
  if (!z.current) return;
4254
- const v = z.current, L = C.cameraRef.current, w = (p.clientX - v.startX) / L.zoom, P = (p.clientY - v.startY) / L.zoom;
4255
- let k = v.width, B = v.height;
4256
- v.direction.includes("e") && (k = Math.min(n, Math.max(t, v.width + w))), v.direction.includes("w") && (k = Math.min(n, Math.max(t, v.width - w))), v.direction.includes("s") && (B = Math.min(r, Math.max(e, v.height + P))), v.direction.includes("n") && (B = Math.min(r, Math.max(e, v.height - P))), (X = (j = C.onNodesChangeRef).current) == null || X.call(j, [
4257
- { id: m, type: "dimensions", dimensions: { width: k, height: B }, setAttributes: !0 }
4258
- ]), l == null || l(p, { width: k, height: B });
4259
- }, f = (p) => {
4260
- z.current = null, y == null || y(p, {}), window.removeEventListener("pointermove", g), window.removeEventListener("pointerup", f);
4261
+ const p = z.current, M = N.cameraRef.current, w = (h.clientX - p.startX) / M.zoom, C = (h.clientY - p.startY) / M.zoom;
4262
+ let x = p.width, T = p.height;
4263
+ p.direction.includes("e") && (x = Math.min(n, Math.max(t, p.width + w))), p.direction.includes("w") && (x = Math.min(n, Math.max(t, p.width - w))), p.direction.includes("s") && (T = Math.min(r, Math.max(e, p.height + C))), p.direction.includes("n") && (T = Math.min(r, Math.max(e, p.height - C))), (W = (j = N.onNodesChangeRef).current) == null || W.call(j, [
4264
+ { id: v, type: "dimensions", dimensions: { width: x, height: T }, setAttributes: !0 }
4265
+ ]), l == null || l(h, { width: x, height: T });
4266
+ }, f = (h) => {
4267
+ z.current = null, g == null || g(h, {}), window.removeEventListener("pointermove", D), window.removeEventListener("pointerup", f);
4261
4268
  };
4262
- window.addEventListener("pointermove", g), window.addEventListener("pointerup", f);
4263
- }, [m, C, t, e, n, r, u, l, y]);
4269
+ window.addEventListener("pointermove", D), window.addEventListener("pointerup", f);
4270
+ }, [v, N, t, e, n, r, u, l, g]);
4264
4271
  if (!s) return null;
4265
- const $ = 8, R = {
4272
+ const $ = 8, k = {
4266
4273
  position: "absolute",
4267
4274
  width: $,
4268
4275
  height: $,
@@ -4272,61 +4279,61 @@ function ts({
4272
4279
  zIndex: 20,
4273
4280
  ...o
4274
4281
  };
4275
- return /* @__PURE__ */ $t(Ne, { children: [
4282
+ return /* @__PURE__ */ $t(Le, { children: [
4276
4283
  /* @__PURE__ */ S(
4277
4284
  "div",
4278
4285
  {
4279
- style: { ...R, bottom: -$ / 2, right: -$ / 2, cursor: "nwse-resize" },
4280
- onPointerDown: (E) => M(E, "se")
4286
+ style: { ...k, bottom: -$ / 2, right: -$ / 2, cursor: "nwse-resize" },
4287
+ onPointerDown: (E) => R(E, "se")
4281
4288
  }
4282
4289
  ),
4283
4290
  /* @__PURE__ */ S(
4284
4291
  "div",
4285
4292
  {
4286
- style: { ...R, bottom: -$ / 2, left: -$ / 2, cursor: "nesw-resize" },
4287
- onPointerDown: (E) => M(E, "sw")
4293
+ style: { ...k, bottom: -$ / 2, left: -$ / 2, cursor: "nesw-resize" },
4294
+ onPointerDown: (E) => R(E, "sw")
4288
4295
  }
4289
4296
  ),
4290
4297
  /* @__PURE__ */ S(
4291
4298
  "div",
4292
4299
  {
4293
- style: { ...R, top: -$ / 2, right: -$ / 2, cursor: "nesw-resize" },
4294
- onPointerDown: (E) => M(E, "ne")
4300
+ style: { ...k, top: -$ / 2, right: -$ / 2, cursor: "nesw-resize" },
4301
+ onPointerDown: (E) => R(E, "ne")
4295
4302
  }
4296
4303
  ),
4297
4304
  /* @__PURE__ */ S(
4298
4305
  "div",
4299
4306
  {
4300
- style: { ...R, top: -$ / 2, left: -$ / 2, cursor: "nwse-resize" },
4301
- onPointerDown: (E) => M(E, "nw")
4307
+ style: { ...k, top: -$ / 2, left: -$ / 2, cursor: "nwse-resize" },
4308
+ onPointerDown: (E) => R(E, "nw")
4302
4309
  }
4303
4310
  ),
4304
4311
  /* @__PURE__ */ S(
4305
4312
  "div",
4306
4313
  {
4307
- style: { ...R, top: "50%", right: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4308
- onPointerDown: (E) => M(E, "e")
4314
+ style: { ...k, top: "50%", right: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4315
+ onPointerDown: (E) => R(E, "e")
4309
4316
  }
4310
4317
  ),
4311
4318
  /* @__PURE__ */ S(
4312
4319
  "div",
4313
4320
  {
4314
- style: { ...R, top: "50%", left: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4315
- onPointerDown: (E) => M(E, "w")
4321
+ style: { ...k, top: "50%", left: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4322
+ onPointerDown: (E) => R(E, "w")
4316
4323
  }
4317
4324
  ),
4318
4325
  /* @__PURE__ */ S(
4319
4326
  "div",
4320
4327
  {
4321
- style: { ...R, left: "50%", top: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4322
- onPointerDown: (E) => M(E, "n")
4328
+ style: { ...k, left: "50%", top: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4329
+ onPointerDown: (E) => R(E, "n")
4323
4330
  }
4324
4331
  ),
4325
4332
  /* @__PURE__ */ S(
4326
4333
  "div",
4327
4334
  {
4328
- style: { ...R, left: "50%", bottom: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4329
- onPointerDown: (E) => M(E, "s")
4335
+ style: { ...k, left: "50%", bottom: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4336
+ onPointerDown: (E) => R(E, "s")
4330
4337
  }
4331
4338
  )
4332
4339
  ] });
@@ -4340,9 +4347,9 @@ function es({
4340
4347
  style: o = {},
4341
4348
  className: i = ""
4342
4349
  }) {
4343
- const c = qe(je), l = yt().nodes.find((C) => C.id === c);
4350
+ const c = qe(je), l = yt().nodes.find((N) => N.id === c);
4344
4351
  if (!(t !== void 0 ? t : l == null ? void 0 : l.selected)) return null;
4345
- const m = {
4352
+ const v = {
4346
4353
  top: { bottom: "100%", left: r === "start" ? 0 : r === "end" ? void 0 : "50%", right: r === "end" ? 0 : void 0, transform: r === "center" ? "translateX(-50%)" : void 0, marginBottom: n },
4347
4354
  bottom: { top: "100%", left: r === "start" ? 0 : r === "end" ? void 0 : "50%", right: r === "end" ? 0 : void 0, transform: r === "center" ? "translateX(-50%)" : void 0, marginTop: n },
4348
4355
  left: { right: "100%", top: r === "start" ? 0 : r === "end" ? void 0 : "50%", bottom: r === "end" ? 0 : void 0, transform: r === "center" ? "translateY(-50%)" : void 0, marginRight: n },
@@ -4356,10 +4363,10 @@ function es({
4356
4363
  position: "absolute",
4357
4364
  zIndex: 1e3,
4358
4365
  pointerEvents: "all",
4359
- ...m,
4366
+ ...v,
4360
4367
  ...o
4361
4368
  },
4362
- onPointerDown: (C) => C.stopPropagation(),
4369
+ onPointerDown: (N) => N.stopPropagation(),
4363
4370
  children: s
4364
4371
  }
4365
4372
  );
@@ -4527,7 +4534,7 @@ export {
4527
4534
  vo as boxToRect,
4528
4535
  or as buildObstacles,
4529
4536
  Tn as clampPosition,
4530
- Lo as computeRoutedEdges,
4537
+ No as computeRoutedEdges,
4531
4538
  zo as getBezierEdgeCenter,
4532
4539
  nr as getBezierPath,
4533
4540
  wo as getBoundsOfBoxes,
@@ -4550,14 +4557,14 @@ export {
4550
4557
  Mo as nodeToRect,
4551
4558
  Co as reconnectEdge,
4552
4559
  mo as rectToBox,
4553
- No as routeSinglePath,
4560
+ Lo as routeSinglePath,
4554
4561
  En as routedPointsToPath,
4555
4562
  Pn as snapPosition,
4556
4563
  Ho as useConnection,
4557
4564
  Do as useEdges,
4558
4565
  So as useEdgesState,
4559
4566
  Xo as useHandleConnections,
4560
- Nr as useInfiniteCanvas,
4567
+ Lr as useInfiniteCanvas,
4561
4568
  Go as useInternalNode,
4562
4569
  Uo as useKeyPress,
4563
4570
  Wo as useNodeConnections,