@infinit-canvas/react 0.1.3 → 0.1.5

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,5 +1,5 @@
1
- import { jsx as S, jsxs as It, Fragment as Le } from "react/jsx-runtime";
2
- import { useRef as V, 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";
1
+ import { jsx as S, jsxs as $t, Fragment as Le } from "react/jsx-runtime";
2
+ import { useRef as tt, useState as Gt, useMemo as St, useEffect as ht, 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;
5
5
  function ho(t) {
@@ -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, k = m + l, M = C + y;
67
- return r ? m < i && k > s && C < c && M > o : m >= s && k <= i && C >= o && M <= c;
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;
68
68
  });
69
69
  }
70
70
  function mo(t) {
@@ -964,42 +964,42 @@ function Lr({
964
964
  onNodeDrag: y,
965
965
  onNodeDragStop: m,
966
966
  onEdgeClick: C,
967
- onEdgeDoubleClick: k,
967
+ onEdgeDoubleClick: z,
968
968
  onEdgeMouseEnter: M,
969
969
  onEdgeMouseMove: $,
970
- onEdgeMouseLeave: z,
970
+ onEdgeMouseLeave: k,
971
971
  onEdgeContextMenu: E,
972
- onNodeDoubleClick: W,
973
- onNodeMouseEnter: H,
972
+ onNodeDoubleClick: _,
973
+ onNodeMouseEnter: D,
974
974
  onNodeMouseMove: g,
975
975
  onNodeMouseLeave: f,
976
976
  onNodeContextMenu: p,
977
977
  onPaneClick: v,
978
- onPaneContextMenu: w,
979
- onPaneMouseEnter: N,
978
+ onPaneContextMenu: N,
979
+ onPaneMouseEnter: w,
980
980
  onPaneMouseMove: P,
981
981
  onPaneMouseLeave: R,
982
982
  onSelectionChange: B,
983
983
  onConnectStart: q,
984
- onConnectEnd: D,
985
- onInit: it,
986
- onMoveStart: nt,
987
- onMove: lt,
984
+ onConnectEnd: X,
985
+ onInit: K,
986
+ onMoveStart: at,
987
+ onMove: rt,
988
988
  onMoveEnd: G,
989
989
  onDelete: j,
990
- onBeforeDelete: st,
991
- onError: rt,
992
- isValidConnection: ut,
993
- dark: dt,
994
- gridSize: Lt = 40,
995
- zoomMin: ot = 0.1,
996
- zoomMax: pt = 4,
997
- initialCamera: vt = { x: 0, y: 0, zoom: 1 },
998
- fitView: ht = !1,
999
- fitViewOptions: bt,
1000
- nodesDraggable: Et = !0,
1001
- nodesConnectable: kt = !0,
1002
- elementsSelectable: $t = !0,
990
+ onBeforeDelete: it,
991
+ onError: dt,
992
+ isValidConnection: ot,
993
+ dark: ft,
994
+ gridSize: It = 40,
995
+ zoomMin: st = 0.1,
996
+ zoomMax: xt = 4,
997
+ initialCamera: Nt = { x: 0, y: 0, zoom: 1 },
998
+ fitView: gt = !1,
999
+ fitViewOptions: ct,
1000
+ nodesDraggable: zt = !0,
1001
+ nodesConnectable: Rt = !0,
1002
+ elementsSelectable: Lt = !0,
1003
1003
  multiSelectionKeyCode: wt = "Shift",
1004
1004
  selectionOnDrag: ne = !1,
1005
1005
  selectionMode: Ie = "partial",
@@ -1027,7 +1027,7 @@ function Lr({
1027
1027
  elevateNodesOnSelect: hn = !1,
1028
1028
  edgeRouting: fe = !0
1029
1029
  } = {}) {
1030
- const xt = V(null), Te = V(null), Ct = V(null), gt = V({ ...vt }), se = V([...t]), Z = V([...e]), Pt = V([...n]), yn = V(/* @__PURE__ */ new Map()), Se = V(!1), te = V(null), [gn, pn] = Gt(!1), _t = V(null), Wt = V(null), Me = V(null), ie = V(null), Ut = V(!1), Re = V(null), [Be, Je] = Gt({ x: vt.x, y: vt.y, zoom: vt.zoom }), [Ve, ae] = Gt(null), Kt = St(() => /* @__PURE__ */ new Set(), []), he = St(() => /* @__PURE__ */ new Set(), []), ke = V(!1), O = V({});
1030
+ const mt = 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,
@@ -1039,34 +1039,34 @@ function Lr({
1039
1039
  onNodeDrag: y,
1040
1040
  onNodeDragStop: m,
1041
1041
  onEdgeClick: C,
1042
- onEdgeDoubleClick: k,
1042
+ onEdgeDoubleClick: z,
1043
1043
  onEdgeMouseEnter: M,
1044
1044
  onEdgeMouseMove: $,
1045
- onEdgeMouseLeave: z,
1045
+ onEdgeMouseLeave: k,
1046
1046
  onEdgeContextMenu: E,
1047
- onNodeDoubleClick: W,
1048
- onNodeMouseEnter: H,
1047
+ onNodeDoubleClick: _,
1048
+ onNodeMouseEnter: D,
1049
1049
  onNodeMouseMove: g,
1050
1050
  onNodeMouseLeave: f,
1051
1051
  onNodeContextMenu: p,
1052
1052
  onPaneClick: v,
1053
- onPaneContextMenu: w,
1054
- onPaneMouseEnter: N,
1053
+ onPaneContextMenu: N,
1054
+ onPaneMouseEnter: w,
1055
1055
  onPaneMouseMove: P,
1056
1056
  onPaneMouseLeave: R,
1057
1057
  onSelectionChange: B,
1058
1058
  onConnectStart: q,
1059
- onConnectEnd: D,
1060
- onInit: it,
1061
- onMoveStart: nt,
1062
- onMove: lt,
1059
+ onConnectEnd: X,
1060
+ onInit: K,
1061
+ onMoveStart: at,
1062
+ onMove: rt,
1063
1063
  onMoveEnd: G,
1064
1064
  onDelete: j,
1065
- onBeforeDelete: st,
1066
- onError: rt,
1067
- isValidConnection: ut
1065
+ onBeforeDelete: it,
1066
+ onError: dt,
1067
+ isValidConnection: ot
1068
1068
  };
1069
- const Mt = { get current() {
1069
+ const bt = { get current() {
1070
1070
  return O.current.onNodesChange;
1071
1071
  } }, Dt = { get current() {
1072
1072
  return O.current.onEdgesChange;
@@ -1074,9 +1074,9 @@ function Lr({
1074
1074
  return O.current.onConnect;
1075
1075
  } }, De = { get current() {
1076
1076
  return O.current.onNodeClick;
1077
- } }, He = { get current() {
1078
- return O.current.onNodeDragStart;
1079
1077
  } }, Ae = { get current() {
1078
+ return O.current.onNodeDragStart;
1079
+ } }, He = { get current() {
1080
1080
  return O.current.onNodeDrag;
1081
1081
  } }, _e = { get current() {
1082
1082
  return O.current.onNodeDragStop;
@@ -1091,7 +1091,7 @@ function Lr({
1091
1091
  } }, pe = { get current() {
1092
1092
  return O.current.onNodesProcessed;
1093
1093
  } };
1094
- ft(() => {
1094
+ ht(() => {
1095
1095
  const a = (d) => {
1096
1096
  d.key === wt && (Ut.current = !0), d.key === we && (ke.current = !0);
1097
1097
  }, x = (d) => {
@@ -1107,9 +1107,9 @@ function Lr({
1107
1107
  (b = ye.current) == null || b.call(ye, d);
1108
1108
  for (const L of he) L(d);
1109
1109
  }, [he]);
1110
- ft(() => {
1110
+ ht(() => {
1111
1111
  var a;
1112
- se.current = [...t], (a = Ct.current) == null || a.postMessage({ type: "cards", data: { cards: [...t] } });
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
1115
  const x = {};
@@ -1123,7 +1123,7 @@ function Lr({
1123
1123
  L += h.position.x, I += h.position.y, h = h.parentId ? x[h.parentId] : null;
1124
1124
  return { ...d, _absolutePosition: { x: L, y: I } };
1125
1125
  });
1126
- }, []), ee = V([]), Q = F((a) => {
1126
+ }, []), ee = tt([]), Q = F((a) => {
1127
1127
  const x = yn.current;
1128
1128
  if (!x || x.size === 0) return a;
1129
1129
  const d = {};
@@ -1137,9 +1137,9 @@ function Lr({
1137
1137
  var x;
1138
1138
  if (_t.current) return;
1139
1139
  const a = Q(ee.current);
1140
- (x = Ct.current) == null || x.postMessage({ type: "nodes", data: { nodes: a } });
1140
+ (x = Et.current) == null || x.postMessage({ type: "nodes", data: { nodes: a } });
1141
1141
  }, [Q]);
1142
- ft(() => {
1142
+ ht(() => {
1143
1143
  var d;
1144
1144
  if (_t.current) {
1145
1145
  const b = _t.current.id, L = /* @__PURE__ */ new Set([b, ..._t.current.selectedStarts.map((h) => h.id)]), I = {};
@@ -1155,15 +1155,15 @@ function Lr({
1155
1155
  const a = ze(e);
1156
1156
  ee.current = a;
1157
1157
  const x = Q(a);
1158
- (d = Ct.current) == null || d.postMessage({ type: "nodes", data: { nodes: x } });
1159
- }, [e, ze, Q]), ft(() => {
1158
+ (d = Et.current) == null || d.postMessage({ type: "nodes", data: { nodes: x } });
1159
+ }, [e, ze, Q]), ht(() => {
1160
1160
  var a;
1161
- Pt.current = [...n], (a = Ct.current) == null || a.postMessage({ type: "edges", data: { edges: [...n] } });
1161
+ Pt.current = [...n], (a = Et.current) == null || a.postMessage({ type: "edges", data: { edges: [...n] } });
1162
1162
  }, [n]);
1163
- const at = F((a, x) => {
1164
- const d = xt.current;
1163
+ const lt = F((a, x) => {
1164
+ const d = mt.current;
1165
1165
  if (!d) return { x: 0, y: 0 };
1166
- const b = d.getBoundingClientRect(), L = gt.current;
1166
+ const b = d.getBoundingClientRect(), L = pt.current;
1167
1167
  return {
1168
1168
  x: (a - b.left - L.x) / L.zoom,
1169
1169
  y: (x - b.top - L.y) / L.zoom
@@ -1210,7 +1210,7 @@ function Lr({
1210
1210
  { id: null, type: "source", x: a.position.x + x, y: a.position.y + d / 2 }
1211
1211
  ];
1212
1212
  }, [xe]), tn = F((a, x) => {
1213
- const d = Z.current, b = gt.current, L = Math.max(Nr, Ot) / b.zoom;
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
1215
  const h = d[I];
1216
1216
  if (h.hidden) continue;
@@ -1221,62 +1221,62 @@ function Lr({
1221
1221
  }
1222
1222
  return null;
1223
1223
  }, [Ee]), ue = F((a, x) => {
1224
- const b = 8 / gt.current.zoom;
1224
+ const b = 8 / pt.current.zoom;
1225
1225
  for (let L = Pt.current.length - 1; L >= 0; L--) {
1226
- const I = Pt.current[L], h = Z.current.find((Rt) => Rt.id === I.source), A = Z.current.find((Rt) => Rt.id === I.target);
1226
+ const I = Pt.current[L], h = Z.current.find((Mt) => Mt.id === I.source), A = Z.current.find((Mt) => Mt.id === I.target);
1227
1227
  if (!h || !A) continue;
1228
- const T = h.width || Vt, Y = h.height || jt, _ = A.height || jt, K = h.position.x + T, ct = h.position.y + Y / 2, U = A.position.x, et = A.position.y + _ / 2;
1229
- if (Ir(a, x, K, ct, U, et) < b) return I;
1228
+ const T = h.width || Vt, Y = h.height || jt, H = A.height || jt, J = h.position.x + T, ut = h.position.y + Y / 2, U = A.position.x, nt = A.position.y + H / 2;
1229
+ if (Ir(a, x, J, ut, U, nt) < b) return I;
1230
1230
  }
1231
1231
  return null;
1232
1232
  }, []);
1233
- ft(() => {
1234
- const a = Te.current, x = xt.current;
1233
+ ht(() => {
1234
+ const a = Te.current, x = mt.current;
1235
1235
  if (!a || !x) return;
1236
- const d = x.getBoundingClientRect(), b = dt !== void 0 ? dt : matchMedia("(prefers-color-scheme: dark)").matches, L = ze(Z.current);
1236
+ const d = x.getBoundingClientRect(), b = ft !== void 0 ? ft : matchMedia("(prefers-color-scheme: dark)").matches, L = ze(Z.current);
1237
1237
  ee.current = L;
1238
1238
  const I = Q(L), { worker: h } = Cr(a, {
1239
1239
  width: d.width,
1240
1240
  height: d.height,
1241
- camera: gt.current,
1241
+ camera: pt.current,
1242
1242
  cards: se.current,
1243
1243
  nodes: I,
1244
1244
  edges: Pt.current,
1245
1245
  dark: b,
1246
- gridSize: Lt,
1246
+ gridSize: It,
1247
1247
  edgeRouting: fe
1248
1248
  });
1249
- h.onmessage = (_) => {
1250
- var K, ct;
1251
- _.data.type === "hud" && ((K = ge.current) == null || K.call(ge, _.data.data)), _.data.type === "ready" && pn(!0), _.data.type === "nodesProcessed" && ((ct = pe.current) == null || ct.call(pe, _.data.data));
1252
- }, Ct.current = h;
1253
- const A = new ResizeObserver((_) => {
1254
- const { width: K, height: ct } = _[0].contentRect;
1255
- h.postMessage({ type: "resize", data: { width: K, height: ct } });
1249
+ h.onmessage = (H) => {
1250
+ var J, ut;
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" && ((ut = pe.current) == null || ut.call(pe, H.data.data));
1252
+ }, Et.current = h;
1253
+ const A = new ResizeObserver((H) => {
1254
+ const { width: J, height: ut } = H[0].contentRect;
1255
+ h.postMessage({ type: "resize", data: { width: J, height: ut } });
1256
1256
  });
1257
1257
  A.observe(x);
1258
1258
  let T, Y;
1259
- return dt === void 0 && (T = matchMedia("(prefers-color-scheme: dark)"), Y = (_) => h.postMessage({ type: "theme", data: { dark: _.matches } }), T.addEventListener("change", Y)), () => {
1260
- A.disconnect(), T && Y && T.removeEventListener("change", Y), Ct.current = null;
1259
+ return ft === 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;
1261
1261
  };
1262
- }, []), ft(() => {
1262
+ }, []), ht(() => {
1263
1263
  var a;
1264
- dt !== void 0 && ((a = Ct.current) == null || a.postMessage({ type: "theme", data: { dark: dt } }));
1265
- }, [dt]), ft(() => {
1264
+ ft !== void 0 && ((a = Et.current) == null || a.postMessage({ type: "theme", data: { dark: ft } }));
1265
+ }, [ft]), ht(() => {
1266
1266
  var a;
1267
- (a = Ct.current) == null || a.postMessage({ type: "edgeRouting", data: { enabled: fe } });
1267
+ (a = Et.current) == null || a.postMessage({ type: "edgeRouting", data: { enabled: fe } });
1268
1268
  }, [fe]);
1269
- const Ln = V(0), Nt = F((a = null) => {
1269
+ const Ln = tt(0), Ct = F((a = null) => {
1270
1270
  var b, L, I;
1271
- const x = gt.current;
1271
+ const x = pt.current;
1272
1272
  if (re) {
1273
- const h = xt.current;
1273
+ const h = mt.current;
1274
1274
  if (h) {
1275
- const A = h.getBoundingClientRect(), T = -re[1][0] * x.zoom + A.width, Y = -re[1][1] * x.zoom + A.height, _ = -re[0][0] * x.zoom, K = -re[0][1] * x.zoom;
1276
- x.x = Math.min(_, Math.max(T, x.x)), x.y = Math.min(K, Math.max(Y, x.y));
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));
1277
1277
  }
1278
1278
  }
1279
- (b = Ct.current) == null || b.postMessage({ type: "camera", data: { camera: { ...x } } });
1279
+ (b = Et.current) == null || b.postMessage({ type: "camera", data: { camera: { ...x } } });
1280
1280
  const d = { x: x.x, y: x.y, zoom: x.zoom };
1281
1281
  (I = (L = O.current).onMove) == null || I.call(L, a, d);
1282
1282
  for (const h of Kt) h(d);
@@ -1286,162 +1286,162 @@ function Lr({
1286
1286
  }, [Kt, re]), Ce = F(() => {
1287
1287
  var d, b;
1288
1288
  const a = Wt.current, x = Me.current;
1289
- a && x ? ((d = Ct.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 = Ct.current) == null || b.postMessage({ type: "connecting", data: null }), ae(null));
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
1290
  }, []), Ne = F(() => {
1291
1291
  var x, d;
1292
1292
  const a = ie.current;
1293
- a ? (x = Ct.current) == null || x.postMessage({ type: "selectionBox", data: a }) : (d = Ct.current) == null || d.postMessage({ type: "selectionBox", data: null });
1293
+ a ? (x = Et.current) == null || x.postMessage({ type: "selectionBox", data: a }) : (d = Et.current) == null || d.postMessage({ type: "selectionBox", data: null });
1294
1294
  }, []), dr = F((a) => {
1295
- var L, I, h, A, T, Y, _, K, ct, U, et, mt, Rt, Ht, Xt, At;
1296
- const x = Z.current.length > 0, d = at(a.clientX, a.clientY), b = Ut.current;
1297
- if (x && kt) {
1298
- const X = tn(d.x, d.y);
1299
- if (Yt && Re.current && X) {
1300
- const J = Re.current;
1301
- if (X.nodeId !== J.nodeId) {
1302
- const qt = J.handleType === "target" ? { source: X.nodeId, target: J.nodeId, sourceHandle: X.handleId || null, targetHandle: J.handleId } : { source: J.nodeId, target: X.nodeId, sourceHandle: J.handleId, targetHandle: X.handleId || null };
1295
+ var L, I, h, A, T, Y, H, J, ut, U, nt, vt, Mt, At, Xt, Ht;
1296
+ const x = Z.current.length > 0, d = lt(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) {
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
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" ? X && X.type === "source" : X != null) {
1308
+ if (Bt === "strict" ? W && W.type === "source" : W != null) {
1309
1309
  if (Yt) {
1310
- Re.current = { nodeId: X.nodeId, handleId: X.handleId || null, handleType: X.type }, (h = (I = O.current).onConnectStart) == null || h.call(I, a, { nodeId: X.nodeId, handleId: X.handleId, handleType: X.type });
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 });
1311
1311
  return;
1312
1312
  }
1313
1313
  Wt.current = {
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 = xt.current) == null || A.setPointerCapture(a.pointerId), (Y = (T = O.current).onConnectStart) == null || Y.call(T, a, { nodeId: X.nodeId, handleId: X.handleId, handleType: X.type }), Ce();
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 = mt.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();
1319
1319
  return;
1320
1320
  }
1321
1321
  }
1322
1322
  if (x) {
1323
- const X = Tt(d.x, d.y);
1324
- if (X) {
1325
- if (Mt.current && $t) {
1326
- const zt = [];
1323
+ const W = Tt(d.x, d.y);
1324
+ if (W) {
1325
+ if (bt.current && Lt) {
1326
+ const kt = [];
1327
1327
  if (b)
1328
- zt.push({ id: X.id, type: "select", selected: !X.selected });
1329
- else if (!X.selected) {
1330
- for (const J of Z.current)
1331
- J.id === X.id ? zt.push({ id: J.id, type: "select", selected: !0 }) : J.selected && zt.push({ id: J.id, type: "select", selected: !1 });
1328
+ kt.push({ id: W.id, type: "select", selected: !W.selected });
1329
+ else if (!W.selected) {
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 });
1332
1332
  if (Dt.current) {
1333
- const J = Pt.current.filter((tt) => tt.selected).map((tt) => ({ id: tt.id, type: "select", selected: !1 }));
1334
- J.length && Dt.current(J);
1333
+ const V = Pt.current.filter((et) => et.selected).map((et) => ({ id: et.id, type: "select", selected: !1 }));
1334
+ V.length && Dt.current(V);
1335
1335
  }
1336
1336
  }
1337
- if (zt.length) {
1338
- if (Mt.current(zt), hn && !b) {
1339
- const J = Z.current.findIndex((tt) => tt.id === X.id);
1340
- J >= 0 && J < Z.current.length - 1 && Mt.current([
1341
- { id: X.id, type: "remove" },
1342
- { type: "add", item: { ...Z.current[J], selected: !0 } }
1337
+ if (kt.length) {
1338
+ if (bt.current(kt), hn && !b) {
1339
+ const V = Z.current.findIndex((et) => et.id === W.id);
1340
+ V >= 0 && V < Z.current.length - 1 && bt.current([
1341
+ { id: W.id, type: "remove" },
1342
+ { type: "add", item: { ...Z.current[V], selected: !0 } }
1343
1343
  ]);
1344
1344
  }
1345
1345
  Jt();
1346
1346
  }
1347
1347
  }
1348
- if ((_ = De.current) == null || _.call(De, a, X), Et) {
1349
- const zt = b && X.selected;
1350
- let J = null;
1351
- if (X.parentId && X.extent === "parent") {
1352
- const tt = Z.current.find((qt) => qt.id === X.parentId);
1353
- if (tt) {
1354
- const qt = tt.width || Vt, Xe = tt.height || jt, en = X.width || ((K = X.measured) == null ? void 0 : K.width) || Vt, Fe = X.height || ((ct = X.measured) == null ? void 0 : ct.height) || jt;
1355
- J = { minX: 0, minY: 0, maxX: qt - en, maxY: Xe - Fe };
1348
+ if ((H = De.current) == null || H.call(De, a, W), zt) {
1349
+ const kt = b && W.selected;
1350
+ let V = null;
1351
+ if (W.parentId && W.extent === "parent") {
1352
+ const et = Z.current.find((qt) => qt.id === W.parentId);
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 || ((ut = W.measured) == null ? void 0 : ut.height) || jt;
1355
+ V = { minX: 0, minY: 0, maxX: qt - en, maxY: Xe - Fe };
1356
1356
  }
1357
1357
  }
1358
1358
  if (_t.current = {
1359
- id: X.id,
1360
- startPos: { ...X.position },
1359
+ id: W.id,
1360
+ startPos: { ...W.position },
1361
1361
  startMouse: { x: d.x, y: d.y },
1362
- parentClamp: J,
1363
- parentId: X.parentId || null,
1364
- selectedStarts: zt ? Z.current.filter((tt) => tt.selected && tt.id !== X.id).map((tt) => {
1362
+ parentClamp: V,
1363
+ parentId: W.parentId || null,
1364
+ selectedStarts: kt ? Z.current.filter((et) => et.selected && et.id !== W.id).map((et) => {
1365
1365
  var Xe, en;
1366
1366
  let qt = null;
1367
- if (tt.parentId && tt.extent === "parent") {
1368
- const Fe = Z.current.find((xn) => xn.id === tt.parentId);
1367
+ if (et.parentId && et.extent === "parent") {
1368
+ const Fe = Z.current.find((xn) => xn.id === et.parentId);
1369
1369
  if (Fe) {
1370
- const xn = Fe.width || Vt, br = Fe.height || jt, Mr = tt.width || ((Xe = tt.measured) == null ? void 0 : Xe.width) || Vt, Rr = tt.height || ((en = tt.measured) == null ? void 0 : en.height) || jt;
1370
+ const xn = Fe.width || Vt, br = Fe.height || jt, Mr = et.width || ((Xe = et.measured) == null ? void 0 : Xe.width) || Vt, Rr = et.height || ((en = et.measured) == null ? void 0 : en.height) || jt;
1371
1371
  qt = { minX: 0, minY: 0, maxX: xn - Mr, maxY: br - Rr };
1372
1372
  }
1373
1373
  }
1374
- return { id: tt.id, startPos: { ...tt.position }, parentClamp: qt, parentId: tt.parentId || null };
1374
+ return { id: et.id, startPos: { ...et.position }, parentClamp: qt, parentId: et.parentId || null };
1375
1375
  }) : []
1376
- }, (U = xt.current) == null || U.setPointerCapture(a.pointerId), (et = He.current) == null || et.call(He, a, X), Mt.current) {
1377
- const tt = [{ id: X.id, type: "position", dragging: !0 }];
1376
+ }, (U = mt.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 }];
1378
1378
  for (const qt of _t.current.selectedStarts)
1379
- tt.push({ id: qt.id, type: "position", dragging: !0 });
1380
- Mt.current(tt);
1379
+ et.push({ id: qt.id, type: "position", dragging: !0 });
1380
+ bt.current(et);
1381
1381
  }
1382
1382
  }
1383
1383
  return;
1384
1384
  }
1385
1385
  }
1386
- if (Pt.current.length > 0 && $t) {
1387
- const X = ue(d.x, d.y);
1388
- if (X) {
1386
+ if (Pt.current.length > 0 && Lt) {
1387
+ const W = ue(d.x, d.y);
1388
+ if (W) {
1389
1389
  if (Dt.current) {
1390
- const zt = [];
1390
+ const kt = [];
1391
1391
  if (b)
1392
- zt.push({ id: X.id, type: "select", selected: !X.selected });
1392
+ kt.push({ id: W.id, type: "select", selected: !W.selected });
1393
1393
  else {
1394
- for (const J of Pt.current)
1395
- J.id === X.id ? zt.push({ id: J.id, type: "select", selected: !0 }) : J.selected && zt.push({ id: J.id, type: "select", selected: !1 });
1396
- if (Mt.current) {
1397
- const J = Z.current.filter((tt) => tt.selected).map((tt) => ({ id: tt.id, type: "select", selected: !1 }));
1398
- J.length && Mt.current(J);
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 });
1396
+ if (bt.current) {
1397
+ const V = Z.current.filter((et) => et.selected).map((et) => ({ id: et.id, type: "select", selected: !1 }));
1398
+ V.length && bt.current(V);
1399
1399
  }
1400
1400
  }
1401
- zt.length && (Dt.current(zt), Jt());
1401
+ kt.length && (Dt.current(kt), Jt());
1402
1402
  }
1403
- (mt = le.current) == null || mt.call(le, a, X);
1403
+ (vt = le.current) == null || vt.call(le, a, W);
1404
1404
  return;
1405
1405
  }
1406
1406
  }
1407
1407
  if (!b) {
1408
- const X = Z.current.filter((J) => J.selected).map((J) => ({ id: J.id, type: "select", selected: !1 })), zt = Pt.current.filter((J) => J.selected).map((J) => ({ id: J.id, type: "select", selected: !1 }));
1409
- X.length && Mt.current && Mt.current(X), zt.length && Dt.current && Dt.current(zt), (X.length || zt.length) && Jt();
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();
1410
1410
  }
1411
- if ((Rt = We.current) == null || Rt.call(We, a), ne || b) {
1412
- ie.current = { startWorld: { ...d }, endWorld: { ...d } }, (Ht = xt.current) == null || Ht.setPointerCapture(a.pointerId), Ne();
1411
+ if ((Mt = We.current) == null || Mt.call(We, a), ne || b) {
1412
+ ie.current = { startWorld: { ...d }, endWorld: { ...d } }, (At = mt.current) == null || At.setPointerCapture(a.pointerId), Ne();
1413
1413
  return;
1414
1414
  }
1415
- Se.current = !0, te.current = { x: a.clientX, y: a.clientY }, (Xt = xt.current) == null || Xt.classList.add("dragging"), (At = xt.current) == null || At.setPointerCapture(a.pointerId);
1416
- }, [at, Tt, tn, ue, Et, kt, $t, ne, Ce, Ne, Jt]), fr = F((a) => {
1415
+ Se.current = !0, te.current = { x: a.clientX, y: a.clientY }, (Xt = mt.current) == null || Xt.classList.add("dragging"), (Ht = mt.current) == null || Ht.setPointerCapture(a.pointerId);
1416
+ }, [lt, Tt, tn, ue, zt, Rt, Lt, ne, Ce, Ne, Jt]), fr = F((a) => {
1417
1417
  var d, b;
1418
1418
  if (Wt.current) {
1419
- if (Me.current = at(a.clientX, a.clientY), Ce(), fn) {
1420
- const L = xt.current;
1419
+ if (Me.current = lt(a.clientX, a.clientY), Ce(), fn) {
1420
+ const L = mt.current;
1421
1421
  if (L) {
1422
1422
  const I = L.getBoundingClientRect(), h = 40, A = a.clientX - I.left, T = a.clientY - I.top;
1423
- let Y = 0, _ = 0;
1424
- A < h ? Y = Qt : A > I.width - h && (Y = -Qt), T < h ? _ = Qt : T > I.height - h && (_ = -Qt), (Y || _) && (gt.current.x += Y, gt.current.y += _, Nt(a));
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));
1425
1425
  }
1426
1426
  }
1427
1427
  return;
1428
1428
  }
1429
1429
  if (ie.current) {
1430
- ie.current.endWorld = at(a.clientX, a.clientY), Ne();
1430
+ ie.current.endWorld = lt(a.clientX, a.clientY), Ne();
1431
1431
  const L = ie.current, I = Math.min(L.startWorld.x, L.endWorld.x), h = Math.min(L.startWorld.y, L.endWorld.y), A = Math.max(L.startWorld.x, L.endWorld.x), T = Math.max(L.startWorld.y, L.endWorld.y);
1432
- if (Mt.current) {
1432
+ if (bt.current) {
1433
1433
  const Y = [];
1434
- for (const _ of Z.current) {
1435
- if (_.hidden) continue;
1436
- const K = _.width || Vt, ct = _.height || jt, U = Ie === "full" ? _.position.x >= I && _.position.x + K <= A && _.position.y >= h && _.position.y + ct <= T : _.position.x + K > I && _.position.x < A && _.position.y + ct > h && _.position.y < T;
1437
- U !== !!_.selected && Y.push({ id: _.id, type: "select", selected: U });
1434
+ for (const H of Z.current) {
1435
+ if (H.hidden) continue;
1436
+ const J = H.width || Vt, ut = H.height || jt, U = Ie === "full" ? H.position.x >= I && H.position.x + J <= A && H.position.y >= h && H.position.y + ut <= T : H.position.x + J > I && H.position.x < A && H.position.y + ut > h && H.position.y < T;
1437
+ U !== !!H.selected && Y.push({ id: H.id, type: "select", selected: U });
1438
1438
  }
1439
- Y.length && Mt.current(Y);
1439
+ Y.length && bt.current(Y);
1440
1440
  }
1441
1441
  return;
1442
1442
  }
1443
1443
  if (_t.current) {
1444
- const L = at(a.clientX, a.clientY), I = _t.current, h = L.x - I.startMouse.x, A = L.y - I.startMouse.y;
1444
+ const L = lt(a.clientX, a.clientY), I = _t.current, h = L.x - I.startMouse.x, A = L.y - I.startMouse.y;
1445
1445
  let T = { x: I.startPos.x + h, y: I.startPos.y + A };
1446
1446
  if (me && (T = Pn(T, de)), oe && (T = Tn(T, oe)), I.parentClamp) {
1447
1447
  const U = I.parentClamp;
@@ -1449,73 +1449,73 @@ function Lr({
1449
1449
  }
1450
1450
  const Y = [{ id: I.id, position: T }];
1451
1451
  for (const U of I.selectedStarts) {
1452
- let et = { x: U.startPos.x + h, y: U.startPos.y + A };
1453
- if (me && (et = Pn(et, de)), oe && (et = Tn(et, oe)), U.parentClamp) {
1454
- const mt = U.parentClamp;
1455
- et = { x: Math.max(mt.minX, Math.min(et.x, mt.maxX)), y: Math.max(mt.minY, Math.min(et.y, mt.maxY)) };
1452
+ let nt = { x: U.startPos.x + h, y: U.startPos.y + A };
1453
+ if (me && (nt = Pn(nt, de)), oe && (nt = Tn(nt, oe)), U.parentClamp) {
1454
+ const vt = U.parentClamp;
1455
+ nt = { x: Math.max(vt.minX, Math.min(nt.x, vt.maxX)), y: Math.max(vt.minY, Math.min(nt.y, vt.maxY)) };
1456
1456
  }
1457
- Y.push({ id: U.id, position: et });
1457
+ Y.push({ id: U.id, position: nt });
1458
1458
  }
1459
- const _ = [];
1459
+ const H = [];
1460
1460
  for (const U of Y) {
1461
- const et = Z.current.find((mt) => mt.id === U.id);
1462
- if (et) {
1463
- et.position = U.position, et.dragging = !0;
1464
- let mt = U.position;
1465
- if (et.parentId) {
1466
- let Rt = Z.current.find((At) => At.id === et.parentId), Ht = U.position.x, Xt = U.position.y;
1467
- for (; Rt; )
1468
- Ht += Rt.position.x, Xt += Rt.position.y, Rt = Rt.parentId ? Z.current.find((At) => At.id === Rt.parentId) : null;
1469
- mt = { x: Ht, y: Xt };
1461
+ const nt = Z.current.find((vt) => vt.id === U.id);
1462
+ if (nt) {
1463
+ nt.position = U.position, nt.dragging = !0;
1464
+ let vt = U.position;
1465
+ if (nt.parentId) {
1466
+ let Mt = Z.current.find((Ht) => Ht.id === nt.parentId), At = U.position.x, Xt = U.position.y;
1467
+ for (; Mt; )
1468
+ At += Mt.position.x, Xt += Mt.position.y, Mt = Mt.parentId ? Z.current.find((Ht) => Ht.id === Mt.parentId) : null;
1469
+ vt = { x: At, y: Xt };
1470
1470
  }
1471
- _.push({
1471
+ H.push({
1472
1472
  id: U.id,
1473
1473
  position: U.position,
1474
- _absolutePosition: mt,
1475
- width: et.width,
1476
- height: et.height,
1474
+ _absolutePosition: vt,
1475
+ width: nt.width,
1476
+ height: nt.height,
1477
1477
  dragging: !0,
1478
- selected: et.selected
1478
+ selected: nt.selected
1479
1479
  });
1480
1480
  }
1481
1481
  }
1482
- const K = new Set(Y.map((U) => U.id));
1482
+ const J = new Set(Y.map((U) => U.id));
1483
1483
  for (const U of Z.current)
1484
- if (U.parentId && K.has(U.parentId) && !K.has(U.id)) {
1485
- let et = Z.current.find((Ht) => Ht.id === U.parentId), mt = U.position.x, Rt = U.position.y;
1486
- for (; et; )
1487
- mt += et.position.x, Rt += et.position.y, et = et.parentId ? Z.current.find((Ht) => Ht.id === et.parentId) : null;
1488
- _.push({
1484
+ if (U.parentId && J.has(U.parentId) && !J.has(U.id)) {
1485
+ let nt = Z.current.find((At) => At.id === U.parentId), vt = U.position.x, Mt = U.position.y;
1486
+ for (; nt; )
1487
+ vt += nt.position.x, Mt += nt.position.y, nt = nt.parentId ? Z.current.find((At) => At.id === nt.parentId) : null;
1488
+ H.push({
1489
1489
  id: U.id,
1490
1490
  position: U.position,
1491
- _absolutePosition: { x: mt, y: Rt },
1491
+ _absolutePosition: { x: vt, y: Mt },
1492
1492
  width: U.width,
1493
1493
  height: U.height,
1494
1494
  dragging: !1,
1495
1495
  selected: U.selected
1496
1496
  });
1497
1497
  }
1498
- if ((d = Ct.current) == null || d.postMessage({ type: "nodePositions", data: { updates: _ } }), dn) {
1499
- const U = xt.current;
1498
+ if ((d = Et.current) == null || d.postMessage({ type: "nodePositions", data: { updates: H } }), dn) {
1499
+ const U = mt.current;
1500
1500
  if (U) {
1501
- const et = U.getBoundingClientRect(), mt = 40, Rt = a.clientX - et.left, Ht = a.clientY - et.top;
1502
- let Xt = 0, At = 0;
1503
- Rt < mt ? Xt = Qt : Rt > et.width - mt && (Xt = -Qt), Ht < mt ? At = Qt : Ht > et.height - mt && (At = -Qt), (Xt || At) && (gt.current.x += Xt, gt.current.y += At, Nt(a));
1501
+ const nt = U.getBoundingClientRect(), vt = 40, Mt = a.clientX - nt.left, At = a.clientY - nt.top;
1502
+ let Xt = 0, Ht = 0;
1503
+ Mt < vt ? Xt = Qt : Mt > nt.width - vt && (Xt = -Qt), At < vt ? Ht = Qt : At > nt.height - vt && (Ht = -Qt), (Xt || Ht) && (pt.current.x += Xt, pt.current.y += Ht, Ct(a));
1504
1504
  }
1505
1505
  }
1506
- const ct = Z.current.find((U) => U.id === I.id);
1507
- ct && ((b = Ae.current) == null || b.call(Ae, a, ct));
1506
+ const ut = Z.current.find((U) => U.id === I.id);
1507
+ ut && ((b = He.current) == null || b.call(He, a, ut));
1508
1508
  return;
1509
1509
  }
1510
1510
  if (!Se.current) return;
1511
- const x = gt.current;
1512
- x.x += a.clientX - te.current.x, x.y += a.clientY - te.current.y, te.current = { x: a.clientX, y: a.clientY }, Nt();
1513
- }, [Nt, at, Ce, Ne]), hr = F((a) => {
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, lt, Ce, Ne]), hr = F((a) => {
1514
1514
  var x, 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 h = lt(a.clientX, a.clientY), A = tn(h.x, h.y);
1517
1517
  if (A && A.nodeId !== Wt.current.sourceId && (Bt === "loose" || A.type === "target")) {
1518
- const _ = Wt.current.sourceType === "target" ? {
1518
+ const H = Wt.current.sourceType === "target" ? {
1519
1519
  source: A.nodeId,
1520
1520
  target: Wt.current.sourceId,
1521
1521
  sourceHandle: A.handleId || null,
@@ -1526,7 +1526,7 @@ function Lr({
1526
1526
  sourceHandle: Wt.current.sourceHandle,
1527
1527
  targetHandle: A.handleId || null
1528
1528
  };
1529
- (O.current.isValidConnection ? O.current.isValidConnection(_) : !0) && ((x = ce.current) == null || x.call(ce, { ..._, ...be }));
1529
+ (O.current.isValidConnection ? O.current.isValidConnection(H) : !0) && ((x = ce.current) == null || x.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;
@@ -1537,23 +1537,23 @@ function Lr({
1537
1537
  }
1538
1538
  if (_t.current) {
1539
1539
  const h = _t.current;
1540
- if (Mt.current) {
1541
- const T = Z.current.find((_) => _.id === h.id), Y = [{
1540
+ if (bt.current) {
1541
+ const T = Z.current.find((H) => H.id === h.id), Y = [{
1542
1542
  id: h.id,
1543
1543
  type: "position",
1544
1544
  position: T ? { ...T.position } : void 0,
1545
1545
  dragging: !1
1546
1546
  }];
1547
- for (const _ of h.selectedStarts) {
1548
- const K = Z.current.find((ct) => ct.id === _.id);
1547
+ for (const H of h.selectedStarts) {
1548
+ const J = Z.current.find((ut) => ut.id === H.id);
1549
1549
  Y.push({
1550
- id: _.id,
1550
+ id: H.id,
1551
1551
  type: "position",
1552
- position: K ? { ...K.position } : void 0,
1552
+ position: J ? { ...J.position } : void 0,
1553
1553
  dragging: !1
1554
1554
  });
1555
1555
  }
1556
- Mt.current(Y);
1556
+ bt.current(Y);
1557
1557
  }
1558
1558
  requestAnimationFrame(() => {
1559
1559
  _t.current = null;
@@ -1562,27 +1562,27 @@ function Lr({
1562
1562
  A && ((L = _e.current) == null || L.call(_e, a, A));
1563
1563
  return;
1564
1564
  }
1565
- Se.current = !1, (I = xt.current) == null || I.classList.remove("dragging");
1566
- }, [at, tn, Ce, Ne, Jt]);
1567
- ft(() => {
1568
- const a = xt.current;
1565
+ Se.current = !1, (I = mt.current) == null || I.classList.remove("dragging");
1566
+ }, [lt, tn, Ce, Ne, Jt]);
1567
+ ht(() => {
1568
+ const a = mt.current;
1569
1569
  if (!a) return;
1570
1570
  const x = (d) => {
1571
1571
  Pe && d.preventDefault();
1572
- const b = gt.current;
1572
+ const b = pt.current;
1573
1573
  if (Ge || ke.current) {
1574
1574
  const T = Ze;
1575
- $e === "horizontal" ? b.x -= d.deltaY * T : ($e === "vertical" || (b.x -= d.deltaX * T), b.y -= d.deltaY * T), Nt(d);
1575
+ $e === "horizontal" ? b.x -= d.deltaY * T : ($e === "vertical" || (b.x -= d.deltaX * T), b.y -= d.deltaY * T), Ct(d);
1576
1576
  return;
1577
1577
  }
1578
1578
  if (!Oe) return;
1579
1579
  const L = 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) * L, b.y = A - (A - b.y) * L, b.zoom = Math.min(pt, Math.max(ot, b.zoom * L)), Nt(d);
1580
+ b.x = h - (h - b.x) * L, b.y = A - (A - b.y) * L, b.zoom = Math.min(xt, Math.max(st, b.zoom * L)), Ct(d);
1581
1581
  };
1582
1582
  return a.addEventListener("wheel", x, { passive: !Pe }), () => a.removeEventListener("wheel", x);
1583
- }, [Nt, ot, pt, Ge, $e, Ze, Oe, Pe]), ft(() => {
1583
+ }, [Ct, st, xt, Ge, $e, Ze, Oe, Pe]), ht(() => {
1584
1584
  if (!Ke) return;
1585
- const a = xt.current;
1585
+ const a = mt.current;
1586
1586
  if (!a) return;
1587
1587
  let x = 0, d = null;
1588
1588
  const b = (h) => {
@@ -1598,10 +1598,10 @@ function Lr({
1598
1598
  }, L = (h) => {
1599
1599
  if (h.touches.length === 2 && x > 0) {
1600
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), _ = Y / x;
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
1602
  x = Y;
1603
- const K = gt.current, ct = d.x, U = d.y;
1604
- K.x = ct - (ct - K.x) * _, K.y = U - (U - K.y) * _, K.zoom = Math.min(pt, Math.max(ot, K.zoom * _)), Nt(h);
1603
+ const J = pt.current, ut = d.x, U = d.y;
1604
+ J.x = ut - (ut - J.x) * H, J.y = U - (U - J.y) * H, J.zoom = Math.min(xt, Math.max(st, J.zoom * H)), Ct(h);
1605
1605
  }
1606
1606
  }, I = () => {
1607
1607
  x = 0, d = null;
@@ -1609,32 +1609,32 @@ function Lr({
1609
1609
  return a.addEventListener("touchstart", b, { passive: !1 }), a.addEventListener("touchmove", L, { passive: !1 }), a.addEventListener("touchend", I), () => {
1610
1610
  a.removeEventListener("touchstart", b), a.removeEventListener("touchmove", L), a.removeEventListener("touchend", I);
1611
1611
  };
1612
- }, [Ke, Nt, ot, pt]), ft(() => {
1612
+ }, [Ke, Ct, st, xt]), ht(() => {
1613
1613
  if (!Qe) return;
1614
- const a = xt.current;
1614
+ const a = mt.current;
1615
1615
  if (!a) return;
1616
1616
  const x = (d) => {
1617
- var _, K, ct, U;
1618
- const b = at(d.clientX, d.clientY);
1617
+ var H, J, ut, U;
1618
+ const b = lt(d.clientX, d.clientY);
1619
1619
  if (Tt(b.x, b.y)) {
1620
- (K = (_ = O.current).onNodeDoubleClick) == null || K.call(_, d, Tt(b.x, b.y));
1620
+ (J = (H = O.current).onNodeDoubleClick) == null || J.call(H, d, Tt(b.x, b.y));
1621
1621
  return;
1622
1622
  }
1623
1623
  const L = ue(b.x, b.y);
1624
1624
  if (L) {
1625
- (U = (ct = O.current).onEdgeDoubleClick) == null || U.call(ct, d, L);
1625
+ (U = (ut = O.current).onEdgeDoubleClick) == null || U.call(ut, 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 = gt.current;
1629
- Y.x = A - (A - Y.x) * I, Y.y = T - (T - Y.y) * I, Y.zoom = Math.min(pt, Math.max(ot, Y.zoom * I)), Nt(d);
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(xt, Math.max(st, Y.zoom * I)), Ct(d);
1630
1630
  };
1631
1631
  return a.addEventListener("dblclick", x), () => a.removeEventListener("dblclick", x);
1632
- }, [Qe, Nt, ot, pt, at, Tt, ue]), ft(() => {
1633
- const a = xt.current;
1632
+ }, [Qe, Ct, st, xt, lt, Tt, ue]), ht(() => {
1633
+ const a = mt.current;
1634
1634
  if (!a) return;
1635
1635
  const x = (d) => {
1636
- var h, A, T, Y, _, K;
1637
- const b = at(d.clientX, d.clientY), L = Tt(b.x, b.y);
1636
+ var h, A, T, Y, H, J;
1637
+ const b = lt(d.clientX, d.clientY), L = Tt(b.x, b.y);
1638
1638
  if (L) {
1639
1639
  (A = (h = O.current).onNodeContextMenu) == null || A.call(h, d, L);
1640
1640
  return;
@@ -1644,32 +1644,32 @@ function Lr({
1644
1644
  (Y = (T = O.current).onEdgeContextMenu) == null || Y.call(T, d, I);
1645
1645
  return;
1646
1646
  }
1647
- (K = (_ = O.current).onPaneContextMenu) == null || K.call(_, d);
1647
+ (J = (H = O.current).onPaneContextMenu) == null || J.call(H, d);
1648
1648
  };
1649
1649
  return a.addEventListener("contextmenu", x), () => a.removeEventListener("contextmenu", x);
1650
- }, [at, Tt, ue]), ft(() => {
1651
- const a = xt.current;
1650
+ }, [lt, Tt, ue]), ht(() => {
1651
+ const a = mt.current;
1652
1652
  if (!a) return;
1653
1653
  let x = null, d = null;
1654
1654
  const b = (h) => {
1655
- var Y, _, K, ct, U, et, mt, Rt, Ht, Xt, At, X, zt, J;
1656
- (_ = (Y = O.current).onPaneMouseMove) == null || _.call(Y, h);
1657
- const A = at(h.clientX, h.clientY), T = Tt(A.x, A.y);
1658
- if (T !== x && (x && ((ct = (K = O.current).onNodeMouseLeave) == null || ct.call(K, h, x)), T && ((et = (U = O.current).onNodeMouseEnter) == null || et.call(U, h, T)), x = T), T && ((Rt = (mt = O.current).onNodeMouseMove) == null || Rt.call(mt, h, T)), !T) {
1659
- const tt = ue(A.x, A.y);
1660
- tt !== d && (d && ((Xt = (Ht = O.current).onEdgeMouseLeave) == null || Xt.call(Ht, h, d)), tt && ((X = (At = O.current).onEdgeMouseEnter) == null || X.call(At, h, tt)), d = tt), tt && ((J = (zt = O.current).onEdgeMouseMove) == null || J.call(zt, h, tt));
1655
+ var Y, H, J, ut, U, nt, vt, Mt, At, Xt, Ht, W, kt, V;
1656
+ (H = (Y = O.current).onPaneMouseMove) == null || H.call(Y, h);
1657
+ const A = lt(h.clientX, h.clientY), T = Tt(A.x, A.y);
1658
+ if (T !== x && (x && ((ut = (J = O.current).onNodeMouseLeave) == null || ut.call(J, h, x)), T && ((nt = (U = O.current).onNodeMouseEnter) == null || nt.call(U, h, T)), x = T), T && ((Mt = (vt = O.current).onNodeMouseMove) == null || Mt.call(vt, h, T)), !T) {
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));
1661
1661
  }
1662
1662
  }, L = (h) => {
1663
1663
  var A, T;
1664
1664
  return (T = (A = O.current).onPaneMouseEnter) == null ? void 0 : T.call(A, h);
1665
1665
  }, I = (h) => {
1666
- var A, T, Y, _, K, ct;
1667
- (T = (A = O.current).onPaneMouseLeave) == null || T.call(A, h), x && ((_ = (Y = O.current).onNodeMouseLeave) == null || _.call(Y, h, x), x = null), d && ((ct = (K = O.current).onEdgeMouseLeave) == null || ct.call(K, h, d), d = null);
1666
+ var A, T, Y, H, J, ut;
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 && ((ut = (J = O.current).onEdgeMouseLeave) == null || ut.call(J, h, d), d = null);
1668
1668
  };
1669
1669
  return a.addEventListener("mousemove", b), a.addEventListener("mouseenter", L), a.addEventListener("mouseleave", I), () => {
1670
1670
  a.removeEventListener("mousemove", b), a.removeEventListener("mouseenter", L), a.removeEventListener("mouseleave", I);
1671
1671
  };
1672
- }, [at, Tt, ue]), ft(() => {
1672
+ }, [lt, Tt, ue]), ht(() => {
1673
1673
  const a = Array.isArray(ve) ? ve : [ve], x = async (d) => {
1674
1674
  var b, L;
1675
1675
  if (a.includes(d.key)) {
@@ -1678,7 +1678,7 @@ function Lr({
1678
1678
  if (!I.length && !h.length || O.current.onBeforeDelete && !await O.current.onBeforeDelete({ nodes: I, edges: h }))
1679
1679
  return;
1680
1680
  const A = new Set(I.map((T) => T.id));
1681
- if (I.length && Mt.current && (Mt.current(I.map((T) => ({ id: T.id, type: "remove" }))), Dt.current)) {
1681
+ if (I.length && bt.current && (bt.current(I.map((T) => ({ id: T.id, type: "remove" }))), Dt.current)) {
1682
1682
  const T = Pt.current.filter((Y) => A.has(Y.source) || A.has(Y.target));
1683
1683
  T.length && Dt.current(T.map((Y) => ({ id: Y.id, type: "remove" })));
1684
1684
  }
@@ -1686,9 +1686,9 @@ function Lr({
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
- if (d.preventDefault(), Mt.current) {
1689
+ if (d.preventDefault(), bt.current) {
1690
1690
  const I = Z.current.filter((h) => !h.selected).map((h) => ({ id: h.id, type: "select", selected: !0 }));
1691
- I.length && Mt.current(I);
1691
+ I.length && bt.current(I);
1692
1692
  }
1693
1693
  if (Dt.current) {
1694
1694
  const I = Pt.current.filter((h) => !h.selected).map((h) => ({ id: h.id, type: "select", selected: !0 }));
@@ -1698,38 +1698,38 @@ function Lr({
1698
1698
  };
1699
1699
  return window.addEventListener("keydown", x), () => window.removeEventListener("keydown", x);
1700
1700
  }, [ve]);
1701
- const In = V(!1);
1702
- ft(() => {
1701
+ const In = tt(!1);
1702
+ ht(() => {
1703
1703
  var a, x;
1704
- if (!In.current && Ct.current) {
1705
- if (In.current = !0, ht && Z.current.length > 0) {
1706
- const d = xt.current;
1704
+ if (!In.current && Et.current) {
1705
+ if (In.current = !0, gt && Z.current.length > 0) {
1706
+ const d = mt.current;
1707
1707
  if (d) {
1708
- const b = d.getBoundingClientRect(), L = (bt == null ? void 0 : bt.padding) ?? 0.1, I = Mn(Z.current), h = Rn(I, b.width, b.height, L);
1709
- bt != null && bt.maxZoom && (h.zoom = Math.min(h.zoom, bt.maxZoom)), bt != null && bt.minZoom && (h.zoom = Math.max(h.zoom, bt.minZoom)), gt.current = h, Nt();
1708
+ const b = d.getBoundingClientRect(), L = (ct == null ? void 0 : ct.padding) ?? 0.1, I = Mn(Z.current), h = Rn(I, b.width, b.height, L);
1709
+ ct != null && ct.maxZoom && (h.zoom = Math.min(h.zoom, ct.maxZoom)), ct != null && ct.minZoom && (h.zoom = Math.max(h.zoom, ct.minZoom)), pt.current = h, Ct();
1710
1710
  }
1711
1711
  }
1712
1712
  (x = (a = O.current).onInit) == null || x.call(a, {
1713
1713
  getNodes: () => [...Z.current],
1714
1714
  getEdges: () => [...Pt.current],
1715
- getViewport: () => ({ ...gt.current }),
1715
+ getViewport: () => ({ ...pt.current }),
1716
1716
  fitView: (d = {}) => {
1717
- const b = xt.current;
1717
+ const b = mt.current;
1718
1718
  if (!b || !Z.current.length) return;
1719
1719
  const L = b.getBoundingClientRect(), I = Mn(Z.current), h = Rn(I, L.width, L.height, d.padding ?? 0.1);
1720
- gt.current = h, Nt();
1720
+ pt.current = h, Ct();
1721
1721
  }
1722
1722
  });
1723
1723
  }
1724
1724
  });
1725
1725
  const yr = F(() => {
1726
- gt.current = { ...vt }, Nt();
1727
- }, [Nt, vt]), gr = F((a) => {
1726
+ pt.current = { ...Nt }, Ct();
1727
+ }, [Ct, Nt]), gr = F((a) => {
1728
1728
  var x;
1729
1729
  if (a)
1730
1730
  se.current.push(a);
1731
1731
  else {
1732
- const d = gt.current, b = xt.current;
1732
+ const d = pt.current, b = mt.current;
1733
1733
  if (!b) return;
1734
1734
  const L = b.getBoundingClientRect(), I = Math.round(-d.x / d.zoom + L.width / 2 / d.zoom), h = Math.round(-d.y / d.zoom + L.height / 2 / d.zoom);
1735
1735
  se.current.push({
@@ -1741,10 +1741,10 @@ function Lr({
1741
1741
  body: "Added at viewport center"
1742
1742
  });
1743
1743
  }
1744
- (x = Ct.current) == null || x.postMessage({ type: "cards", data: { cards: [...se.current] } });
1744
+ (x = Et.current) == null || x.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 = gt.current, d = xt.current;
1747
+ const x = pt.current, d = mt.current;
1748
1748
  if (!d) return;
1749
1749
  const b = d.getBoundingClientRect();
1750
1750
  a.position = {
@@ -1752,26 +1752,26 @@ function Lr({
1752
1752
  y: Math.round(-x.y / x.zoom + b.height / 2 / x.zoom) - jt / 2
1753
1753
  };
1754
1754
  }
1755
- a.data || (a.data = { label: a.id }), Mt.current && Mt.current([{ type: "add", item: a }]);
1756
- }, []), xr = F(() => ({ ...gt.current }), []), mr = F((a) => {
1757
- gt.current = { ...gt.current, ...a }, Nt();
1758
- }, [Nt]), vr = F((a) => at(a.x, a.y), [at]), $n = n, wr = St(() => ({
1759
- wrapRef: xt,
1755
+ a.data || (a.data = { label: a.id }), bt.current && bt.current([{ type: "add", item: a }]);
1756
+ }, []), xr = F(() => ({ ...pt.current }), []), mr = F((a) => {
1757
+ pt.current = { ...pt.current, ...a }, Ct();
1758
+ }, [Ct]), vr = F((a) => lt(a.x, a.y), [lt]), $n = n, wr = St(() => ({
1759
+ wrapRef: mt,
1760
1760
  canvasRef: Te,
1761
- workerRef: Ct,
1762
- cameraRef: gt,
1761
+ workerRef: Et,
1762
+ cameraRef: pt,
1763
1763
  nodesRef: Z,
1764
1764
  edgesRef: Pt,
1765
1765
  handleRegistryRef: yn,
1766
1766
  syncNodesToWorker: Ft,
1767
- onNodesChangeRef: Mt,
1767
+ onNodesChangeRef: bt,
1768
1768
  onEdgesChangeRef: Dt,
1769
- sendCamera: Nt,
1770
- screenToWorld: at,
1769
+ sendCamera: Ct,
1770
+ screenToWorld: lt,
1771
1771
  viewportListeners: Kt,
1772
1772
  selectionListeners: he,
1773
- zoomMin: ot,
1774
- zoomMax: pt,
1773
+ zoomMin: st,
1774
+ zoomMax: xt,
1775
1775
  snapToGrid: me,
1776
1776
  snapGrid: de,
1777
1777
  nodeExtent: oe,
@@ -1793,9 +1793,9 @@ function Lr({
1793
1793
  get connection() {
1794
1794
  return Ve;
1795
1795
  }
1796
- }), [e, n, $n, Be, Ve, Nt, at, Ft, Kt, he, ot, pt, me, de, oe, be, fe]);
1796
+ }), [e, n, $n, Be, Ve, Ct, lt, Ft, Kt, he, st, xt, me, de, oe, be, fe]);
1797
1797
  return {
1798
- wrapRef: xt,
1798
+ wrapRef: mt,
1799
1799
  canvasRef: Te,
1800
1800
  canvasReady: gn,
1801
1801
  onPointerDown: dr,
@@ -1828,95 +1828,96 @@ function Ro() {
1828
1828
  return qe(je);
1829
1829
  }
1830
1830
  function $r({ node: t, nodeType: e }) {
1831
- var m, C, k;
1832
- const n = yt(), r = V(null), s = t._absolutePosition || t.position, o = V(null);
1833
- ft(() => {
1831
+ var m, C, z;
1832
+ const n = yt(), r = tt(null), s = t._absolutePosition || t.position, o = tt(null);
1833
+ ht(() => {
1834
1834
  const M = r.current;
1835
1835
  if (!M) return;
1836
- const $ = new ResizeObserver((z) => {
1837
- var H, g, f, p;
1838
- const { width: E, height: W } = z[0].contentRect;
1839
- if (E > 0 && W > 0) {
1840
- const v = n.nodesRef.current.find((P) => P.id === t.id), w = (v == null ? void 0 : v.width) || ((H = v == null ? void 0 : v.measured) == null ? void 0 : H.width), N = (v == null ? void 0 : v.height) || ((g = v == null ? void 0 : v.measured) == null ? void 0 : g.height);
1841
- (Math.abs((w || 0) - E) > 1 || Math.abs((N || 0) - W) > 1) && ((p = (f = n.onNodesChangeRef).current) == null || p.call(f, [
1842
- { id: t.id, type: "dimensions", dimensions: { width: E, height: W }, setAttributes: !0 }
1836
+ const $ = new ResizeObserver((k) => {
1837
+ var D, g, f, p;
1838
+ const { width: E, height: _ } = k[0].contentRect;
1839
+ if (E > 0 && _ > 0) {
1840
+ const v = n.nodesRef.current.find((P) => P.id === t.id), N = (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((N || 0) - E) > 1 || Math.abs((w || 0) - _) > 1) && ((p = (f = n.onNodesChangeRef).current) == null || p.call(f, [
1842
+ { id: t.id, type: "dimensions", dimensions: { width: E, height: _ }, setAttributes: !0 }
1843
1843
  ]));
1844
1844
  }
1845
1845
  });
1846
1846
  return $.observe(M), () => $.disconnect();
1847
1847
  }, [t.id, n]);
1848
1848
  const i = F((M) => {
1849
- var R, B, q;
1850
- M.stopPropagation();
1851
- let $ = M.target;
1852
- for (; $ && $ !== r.current; ) {
1853
- if ((R = $.classList) != null && R.contains("nodrag")) return;
1854
- $ = $.parentElement;
1849
+ var B, q, X;
1850
+ const $ = M.target.tagName;
1851
+ if ($ === "INPUT" || $ === "TEXTAREA" || $ === "SELECT" || $ === "BUTTON" || $ === "A" || M.target.isContentEditable) return;
1852
+ let k = M.target;
1853
+ for (; k && k !== r.current; ) {
1854
+ if ((B = k.classList) != null && B.contains("nodrag")) return;
1855
+ k = k.parentElement;
1855
1856
  }
1856
- if (n.onNodesChangeRef.current) {
1857
- const D = [];
1857
+ if (M.stopPropagation(), n.onNodesChangeRef.current) {
1858
+ const K = [];
1858
1859
  if (M.shiftKey)
1859
- D.push({ id: t.id, type: "select", selected: !t.selected });
1860
+ K.push({ id: t.id, type: "select", selected: !t.selected });
1860
1861
  else
1861
- for (const nt of n.nodesRef.current)
1862
- nt.id === t.id && !nt.selected ? D.push({ id: nt.id, type: "select", selected: !0 }) : nt.id !== t.id && nt.selected && D.push({ id: nt.id, type: "select", selected: !1 });
1863
- D.length && n.onNodesChangeRef.current(D);
1862
+ for (const rt of n.nodesRef.current)
1863
+ rt.id === t.id && !rt.selected ? K.push({ id: rt.id, type: "select", selected: !0 }) : rt.id !== t.id && rt.selected && K.push({ id: rt.id, type: "select", selected: !1 });
1864
+ K.length && n.onNodesChangeRef.current(K);
1864
1865
  }
1865
- const z = n.cameraRef.current, E = n.wrapRef.current;
1866
- if (!E) return;
1867
- const W = E.getBoundingClientRect(), H = (M.clientX - W.left - z.x) / z.zoom, g = (M.clientY - W.top - z.y) / z.zoom, p = M.shiftKey && t.selected ? n.nodesRef.current.filter((D) => D.selected && D.id !== t.id).map((D) => ({ id: D.id, startPos: { ...D.position } })) : [];
1866
+ const E = n.cameraRef.current, _ = n.wrapRef.current;
1867
+ if (!_) return;
1868
+ 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 } })) : [];
1868
1869
  o.current = {
1869
1870
  startPos: { ...t.position },
1870
- startMouse: { x: H, y: g },
1871
- selectedStarts: p
1871
+ startMouse: { x: g, y: f },
1872
+ selectedStarts: v
1872
1873
  };
1873
- const v = [{ id: t.id, type: "position", dragging: !0 }];
1874
- for (const D of p)
1875
- v.push({ id: D.id, type: "position", dragging: !0 });
1876
- (q = (B = n.onNodesChangeRef).current) == null || q.call(B, v);
1874
+ const N = [{ id: t.id, type: "position", dragging: !0 }];
1875
+ for (const K of v)
1876
+ N.push({ id: K.id, type: "position", dragging: !0 });
1877
+ (X = (q = n.onNodesChangeRef).current) == null || X.call(q, N);
1877
1878
  const w = r.current;
1878
1879
  w && w.setPointerCapture(M.pointerId);
1879
- const N = (D) => {
1880
- var dt, Lt, ot, pt;
1880
+ const P = (K) => {
1881
+ var It, st, xt, Nt;
1881
1882
  if (!o.current) return;
1882
- const it = n.cameraRef.current, nt = E.getBoundingClientRect(), lt = (D.clientX - nt.left - it.x) / it.zoom, G = (D.clientY - nt.top - it.y) / it.zoom, j = lt - o.current.startMouse.x, st = G - o.current.startMouse.y;
1883
- let rt = { x: o.current.startPos.x + j, y: o.current.startPos.y + st };
1884
- if (n.snapToGrid && n.snapGrid && (rt = {
1885
- x: n.snapGrid[0] * Math.round(rt.x / n.snapGrid[0]),
1886
- y: n.snapGrid[1] * Math.round(rt.y / n.snapGrid[1])
1883
+ const at = n.cameraRef.current, rt = _.getBoundingClientRect(), G = (K.clientX - rt.left - at.x) / at.zoom, j = (K.clientY - rt.top - at.y) / at.zoom, it = G - o.current.startMouse.x, dt = j - o.current.startMouse.y;
1884
+ let ot = { x: o.current.startPos.x + it, y: o.current.startPos.y + dt };
1885
+ if (n.snapToGrid && n.snapGrid && (ot = {
1886
+ x: n.snapGrid[0] * Math.round(ot.x / n.snapGrid[0]),
1887
+ y: n.snapGrid[1] * Math.round(ot.y / n.snapGrid[1])
1887
1888
  }), t.parentId && t.extent === "parent") {
1888
- const vt = n.nodesRef.current.find((ht) => ht.id === t.parentId);
1889
- if (vt) {
1890
- const ht = vt.width || 160, bt = vt.height || 60, Et = t.width || ((dt = t.measured) == null ? void 0 : dt.width) || 160, kt = t.height || ((Lt = t.measured) == null ? void 0 : Lt.height) || 60;
1891
- rt = {
1892
- x: Math.max(0, Math.min(rt.x, ht - Et)),
1893
- y: Math.max(0, Math.min(rt.y, bt - kt))
1889
+ const gt = n.nodesRef.current.find((ct) => ct.id === t.parentId);
1890
+ if (gt) {
1891
+ const ct = gt.width || 160, zt = gt.height || 60, Rt = t.width || ((It = t.measured) == null ? void 0 : It.width) || 160, Lt = t.height || ((st = t.measured) == null ? void 0 : st.height) || 60;
1892
+ ot = {
1893
+ x: Math.max(0, Math.min(ot.x, ct - Rt)),
1894
+ y: Math.max(0, Math.min(ot.y, zt - Lt))
1894
1895
  };
1895
1896
  }
1896
1897
  }
1897
- const ut = [{ id: t.id, type: "position", position: rt, dragging: !0 }];
1898
- for (const vt of o.current.selectedStarts) {
1899
- let ht = { x: vt.startPos.x + j, y: vt.startPos.y + st };
1900
- n.snapToGrid && n.snapGrid && (ht = {
1901
- x: n.snapGrid[0] * Math.round(ht.x / n.snapGrid[0]),
1902
- y: n.snapGrid[1] * Math.round(ht.y / n.snapGrid[1])
1903
- }), ut.push({ id: vt.id, type: "position", position: ht, dragging: !0 });
1898
+ const ft = [{ id: t.id, type: "position", position: ot, dragging: !0 }];
1899
+ for (const gt of o.current.selectedStarts) {
1900
+ let ct = { x: gt.startPos.x + it, y: gt.startPos.y + dt };
1901
+ n.snapToGrid && n.snapGrid && (ct = {
1902
+ x: n.snapGrid[0] * Math.round(ct.x / n.snapGrid[0]),
1903
+ y: n.snapGrid[1] * Math.round(ct.y / n.snapGrid[1])
1904
+ }), ft.push({ id: gt.id, type: "position", position: ct, dragging: !0 });
1904
1905
  }
1905
- (pt = (ot = n.onNodesChangeRef).current) == null || pt.call(ot, ut);
1906
- }, P = (D) => {
1907
- var nt, lt;
1906
+ (Nt = (xt = n.onNodesChangeRef).current) == null || Nt.call(xt, ft);
1907
+ }, R = (K) => {
1908
+ var rt, G;
1908
1909
  if (!o.current) return;
1909
- const it = [{ id: t.id, type: "position", dragging: !1 }];
1910
- for (const G of o.current.selectedStarts)
1911
- it.push({ id: G.id, type: "position", dragging: !1 });
1912
- (lt = (nt = n.onNodesChangeRef).current) == null || lt.call(nt, it), o.current = null, w && w.releasePointerCapture(D.pointerId), w == null || w.removeEventListener("pointermove", N), w == null || w.removeEventListener("pointerup", P);
1910
+ const at = [{ id: t.id, type: "position", dragging: !1 }];
1911
+ for (const j of o.current.selectedStarts)
1912
+ at.push({ id: j.id, type: "position", dragging: !1 });
1913
+ (G = (rt = n.onNodesChangeRef).current) == null || G.call(rt, at), o.current = null, w && w.releasePointerCapture(K.pointerId), w == null || w.removeEventListener("pointermove", P), w == null || w.removeEventListener("pointerup", R);
1913
1914
  };
1914
- w == null || w.addEventListener("pointermove", N), w == null || w.addEventListener("pointerup", P);
1915
+ w == null || w.addEventListener("pointermove", P), w == null || w.addEventListener("pointerup", R);
1915
1916
  }, [t, n]), c = F((M) => {
1916
- var g, f, p, v, w, N;
1917
+ var g, f, p, v, N, w;
1917
1918
  if (!t.selected) return;
1918
1919
  const $ = M.shiftKey ? 10 : 1;
1919
- let z = 0, E = 0;
1920
+ let k = 0, E = 0;
1920
1921
  switch (M.key) {
1921
1922
  case "ArrowUp":
1922
1923
  E = -$;
@@ -1925,10 +1926,10 @@ function $r({ node: t, nodeType: e }) {
1925
1926
  E = $;
1926
1927
  break;
1927
1928
  case "ArrowLeft":
1928
- z = -$;
1929
+ k = -$;
1929
1930
  break;
1930
1931
  case "ArrowRight":
1931
- z = $;
1932
+ k = $;
1932
1933
  break;
1933
1934
  case "Escape":
1934
1935
  (f = (g = n.onNodesChangeRef).current) == null || f.call(g, [{ id: t.id, type: "select", selected: !1 }]);
@@ -1941,10 +1942,10 @@ function $r({ node: t, nodeType: e }) {
1941
1942
  return;
1942
1943
  }
1943
1944
  M.preventDefault();
1944
- const W = { x: t.position.x + z, y: t.position.y + E }, H = [{ id: t.id, type: "position", position: W }];
1945
+ const _ = { x: t.position.x + k, y: t.position.y + E }, D = [{ id: t.id, type: "position", position: _ }];
1945
1946
  for (const P of n.nodesRef.current)
1946
- P.selected && P.id !== t.id && H.push({ id: P.id, type: "position", position: { x: P.position.x + z, y: P.position.y + E } });
1947
- (N = (w = n.onNodesChangeRef).current) == null || N.call(w, H);
1947
+ P.selected && P.id !== t.id && D.push({ id: P.id, type: "position", position: { x: P.position.x + k, y: P.position.y + E } });
1948
+ (w = (N = n.onNodesChangeRef).current) == null || w.call(N, D);
1948
1949
  }, [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);
1949
1950
  return /* @__PURE__ */ S(je.Provider, { value: t.id, children: /* @__PURE__ */ S(
1950
1951
  "div",
@@ -1965,7 +1966,7 @@ function $r({ node: t, nodeType: e }) {
1965
1966
  "data-nodeid": t.id,
1966
1967
  tabIndex: t.selectable !== !1 ? 0 : void 0,
1967
1968
  role: "button",
1968
- "aria-label": `Node ${((k = t.data) == null ? void 0 : k.label) || t.id}`,
1969
+ "aria-label": `Node ${((z = t.data) == null ? void 0 : z.label) || t.id}`,
1969
1970
  "aria-selected": !!t.selected,
1970
1971
  onPointerDown: i,
1971
1972
  onKeyDown: c,
@@ -2054,35 +2055,35 @@ function Dn({ x: t, y: e, position: n, type: r, onPointerDown: s }) {
2054
2055
  }
2055
2056
  function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2056
2057
  var g, f, p;
2057
- const s = yt(), [o, i] = Gt(null), c = F((v, w, N, P) => {
2058
- var lt;
2059
- w.stopPropagation(), w.preventDefault();
2058
+ const s = yt(), [o, i] = Gt(null), c = F((v, N, w, P) => {
2059
+ var rt;
2060
+ N.stopPropagation(), N.preventDefault();
2060
2061
  const R = s.wrapRef.current;
2061
2062
  if (!R) return;
2062
- const B = v === "source" ? P : N, q = v === "source" ? t.target : t.source;
2063
- (lt = s.workerRef.current) == null || lt.postMessage({
2063
+ const B = v === "source" ? P : w, q = v === "source" ? t.target : t.source;
2064
+ (rt = s.workerRef.current) == null || rt.postMessage({
2064
2065
  type: "connecting",
2065
2066
  data: { from: { x: B.x, y: B.y }, to: { x: B.x, y: B.y } }
2066
2067
  });
2067
- const D = R.getBoundingClientRect(), it = (G) => {
2068
- var ut;
2069
- const j = s.cameraRef.current, st = (G.clientX - D.left - j.x) / j.zoom, rt = (G.clientY - D.top - j.y) / j.zoom;
2070
- (ut = s.workerRef.current) == null || ut.postMessage({
2068
+ const X = R.getBoundingClientRect(), K = (G) => {
2069
+ var ot;
2070
+ const j = s.cameraRef.current, it = (G.clientX - X.left - j.x) / j.zoom, dt = (G.clientY - X.top - j.y) / j.zoom;
2071
+ (ot = s.workerRef.current) == null || ot.postMessage({
2071
2072
  type: "connecting",
2072
- data: { from: { x: B.x, y: B.y }, to: { x: st, y: rt } }
2073
+ data: { from: { x: B.x, y: B.y }, to: { x: it, y: dt } }
2073
2074
  });
2074
- }, nt = (G) => {
2075
- var pt, vt, ht, bt;
2076
- const j = s.cameraRef.current, st = (G.clientX - D.left - j.x) / j.zoom, rt = (G.clientY - D.top - j.y) / j.zoom, ut = 20 / j.zoom;
2077
- let dt = null, Lt = null;
2078
- const ot = (pt = s.handleRegistryRef) == null ? void 0 : pt.current;
2079
- for (const Et of s.nodesRef.current) {
2080
- if (Et.hidden) continue;
2081
- const kt = Et.width || On, $t = Et.height || Qn, wt = Et._absolutePosition || Et.position, ne = [];
2082
- if (ot)
2083
- for (const [, Bt] of ot)
2084
- Bt.nodeId === Et.id && ne.push(Bt);
2085
- const Ie = ne.length > 0 ? ne : Et.handles || [
2075
+ }, at = (G) => {
2076
+ var xt, Nt, gt, ct;
2077
+ const j = s.cameraRef.current, it = (G.clientX - X.left - j.x) / j.zoom, dt = (G.clientY - X.top - j.y) / j.zoom, ot = 20 / j.zoom;
2078
+ let ft = null, It = null;
2079
+ const st = (xt = s.handleRegistryRef) == null ? void 0 : xt.current;
2080
+ for (const zt of s.nodesRef.current) {
2081
+ if (zt.hidden) continue;
2082
+ const Rt = zt.width || On, Lt = zt.height || Qn, wt = zt._absolutePosition || zt.position, ne = [];
2083
+ if (st)
2084
+ for (const [, Bt] of st)
2085
+ Bt.nodeId === zt.id && ne.push(Bt);
2086
+ const Ie = ne.length > 0 ? ne : zt.handles || [
2086
2087
  { type: "target", position: "left" },
2087
2088
  { type: "source", position: "right" }
2088
2089
  ];
@@ -2093,37 +2094,37 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2093
2094
  else
2094
2095
  switch (Bt.position || (Bt.type === "source" ? "right" : "left")) {
2095
2096
  case "top":
2096
- Ot = wt.x + kt / 2, Yt = wt.y;
2097
+ Ot = wt.x + Rt / 2, Yt = wt.y;
2097
2098
  break;
2098
2099
  case "bottom":
2099
- Ot = wt.x + kt / 2, Yt = wt.y + $t;
2100
+ Ot = wt.x + Rt / 2, Yt = wt.y + Lt;
2100
2101
  break;
2101
2102
  case "left":
2102
- Ot = wt.x, Yt = wt.y + $t / 2;
2103
+ Ot = wt.x, Yt = wt.y + Lt / 2;
2103
2104
  break;
2104
2105
  default:
2105
- Ot = wt.x + kt, Yt = wt.y + $t / 2;
2106
+ Ot = wt.x + Rt, Yt = wt.y + Lt / 2;
2106
2107
  break;
2107
2108
  }
2108
- if (Math.abs(st - Ot) < ut && Math.abs(rt - Yt) < ut) {
2109
- dt = Et, Lt = Bt.id || null;
2109
+ if (Math.abs(it - Ot) < ot && Math.abs(dt - Yt) < ot) {
2110
+ ft = zt, It = Bt.id || null;
2110
2111
  break;
2111
2112
  }
2112
2113
  }
2113
- if (dt) break;
2114
+ if (ft) break;
2114
2115
  }
2115
- if (dt) {
2116
- const Et = v === "source" ? { source: dt.id, target: q, sourceHandle: Lt, targetHandle: t.targetHandle } : { source: q, target: dt.id, sourceHandle: t.sourceHandle, targetHandle: Lt };
2117
- (ht = (vt = s.onEdgesChangeRef).current) == null || ht.call(vt, [
2116
+ if (ft) {
2117
+ const zt = v === "source" ? { source: ft.id, target: q, sourceHandle: It, targetHandle: t.targetHandle } : { source: q, target: ft.id, sourceHandle: t.sourceHandle, targetHandle: It };
2118
+ (gt = (Nt = s.onEdgesChangeRef).current) == null || gt.call(Nt, [
2118
2119
  { id: t.id, type: "remove" },
2119
- { type: "add", item: { id: t.id, ...Et } }
2120
+ { type: "add", item: { id: t.id, ...zt } }
2120
2121
  ]);
2121
2122
  }
2122
- (bt = s.workerRef.current) == null || bt.postMessage({ type: "connecting", data: null }), R.removeEventListener("pointermove", it), R.removeEventListener("pointerup", nt);
2123
+ (ct = s.workerRef.current) == null || ct.postMessage({ type: "connecting", data: null }), R.removeEventListener("pointermove", K), R.removeEventListener("pointerup", at);
2123
2124
  };
2124
- R.addEventListener("pointermove", it), R.addEventListener("pointerup", nt);
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, k = 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", z = s.routedEdges || s.edges, E = z == null ? void 0 : z.find((v) => v.id === t.id), W = $ ? null : (E == null ? void 0 : E._routedPoints) || t._routedPoints || null, H = r !== !1 && t.reconnectable !== !1;
2126
- return !k || !M ? null : /* @__PURE__ */ It(
2125
+ R.addEventListener("pointermove", K), R.addEventListener("pointerup", at);
2126
+ }, [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", k = s.routedEdges || s.edges, E = k == null ? void 0 : k.find((v) => v.id === t.id), _ = $ ? null : (E == null ? void 0 : E._routedPoints) || t._routedPoints || null, D = r !== !1 && t.reconnectable !== !1;
2127
+ return !z || !M ? null : /* @__PURE__ */ $t(
2127
2128
  "g",
2128
2129
  {
2129
2130
  className: `ric-edge-wrapper ${t.selected ? "selected" : ""}`,
@@ -2137,11 +2138,11 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2137
2138
  id: t.id,
2138
2139
  source: t.source,
2139
2140
  target: t.target,
2140
- sourceX: k.x,
2141
- sourceY: k.y,
2141
+ sourceX: z.x,
2142
+ sourceY: z.y,
2142
2143
  targetX: M.x,
2143
2144
  targetY: M.y,
2144
- sourcePosition: k.position,
2145
+ sourcePosition: z.position,
2145
2146
  targetPosition: M.position,
2146
2147
  sourceHandleId: t.sourceHandle,
2147
2148
  targetHandleId: t.targetHandle,
@@ -2153,18 +2154,18 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2153
2154
  style: t.style,
2154
2155
  selectable: t.selectable !== !1,
2155
2156
  deletable: t.deletable !== !1,
2156
- routedPoints: W
2157
+ routedPoints: _
2157
2158
  }
2158
2159
  ),
2159
- H && (o || t.selected) && /* @__PURE__ */ It(Le, { children: [
2160
+ D && (o || t.selected) && /* @__PURE__ */ $t(Le, { children: [
2160
2161
  /* @__PURE__ */ S(
2161
2162
  Dn,
2162
2163
  {
2163
- x: k.x,
2164
- y: k.y,
2165
- position: k.position,
2164
+ x: z.x,
2165
+ y: z.y,
2166
+ position: z.position,
2166
2167
  type: "source",
2167
- onPointerDown: (v) => c("source", v, k, M)
2168
+ onPointerDown: (v) => c("source", v, z, M)
2168
2169
  }
2169
2170
  ),
2170
2171
  /* @__PURE__ */ S(
@@ -2174,7 +2175,7 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2174
2175
  y: M.y,
2175
2176
  position: M.position,
2176
2177
  type: "target",
2177
- onPointerDown: (v) => c("target", v, k, M)
2178
+ onPointerDown: (v) => c("target", v, z, M)
2178
2179
  }
2179
2180
  )
2180
2181
  ] })
@@ -2185,48 +2186,48 @@ function Br({ edge: t, edgeType: e, nodes: n, reconnectable: r }) {
2185
2186
  const Dr = Zt(Br);
2186
2187
  function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
2187
2188
  var $;
2188
- const n = yt(), [r, s] = Gt(null), o = V(null);
2189
- if (ft(() => {
2190
- const z = n.wrapRef.current;
2191
- if (!z) return;
2192
- let E = !1, W = null, H = !1;
2193
- const g = (N) => {
2194
- N.key === t && (H = !0);
2195
- }, f = (N) => {
2196
- N.key === t && (H = !1);
2197
- }, p = (N) => {
2198
- if (!H) return;
2199
- const P = N.target;
2189
+ const n = yt(), [r, s] = Gt(null), o = tt(null);
2190
+ if (ht(() => {
2191
+ const k = n.wrapRef.current;
2192
+ if (!k) return;
2193
+ let E = !1, _ = null, D = !1;
2194
+ const g = (w) => {
2195
+ w.key === t && (D = !0);
2196
+ }, f = (w) => {
2197
+ w.key === t && (D = !1);
2198
+ }, p = (w) => {
2199
+ if (!D) return;
2200
+ const P = w.target;
2200
2201
  if (P.closest(".ric-node-wrapper") || P.closest(".ric-handle")) return;
2201
2202
  E = !0;
2202
- const R = n.cameraRef.current, B = z.getBoundingClientRect(), q = (N.clientX - B.left - R.x) / R.zoom, D = (N.clientY - B.top - R.y) / R.zoom;
2203
- W = { x: q, y: D }, s({ startX: q, startY: D, endX: q, endY: D }), N.stopPropagation();
2204
- }, v = (N) => {
2205
- if (!E || !W) return;
2206
- const P = n.cameraRef.current, R = z.getBoundingClientRect(), B = (N.clientX - R.left - P.x) / P.zoom, q = (N.clientY - R.top - P.y) / P.zoom;
2207
- s({ startX: W.x, startY: W.y, endX: B, endY: q });
2208
- }, w = (N) => {
2209
- var nt, lt;
2210
- if (!E || !W) return;
2203
+ const R = n.cameraRef.current, B = k.getBoundingClientRect(), q = (w.clientX - B.left - R.x) / R.zoom, X = (w.clientY - B.top - R.y) / R.zoom;
2204
+ _ = { x: q, y: X }, s({ startX: q, startY: X, endX: q, endY: X }), w.stopPropagation();
2205
+ }, v = (w) => {
2206
+ if (!E || !_) return;
2207
+ const P = n.cameraRef.current, R = k.getBoundingClientRect(), B = (w.clientX - R.left - P.x) / P.zoom, q = (w.clientY - R.top - P.y) / P.zoom;
2208
+ s({ startX: _.x, startY: _.y, endX: B, endY: q });
2209
+ }, N = (w) => {
2210
+ var at, rt;
2211
+ if (!E || !_) return;
2211
2212
  E = !1;
2212
- const P = n.cameraRef.current, R = z.getBoundingClientRect(), B = (N.clientX - R.left - P.x) / P.zoom, q = (N.clientY - R.top - P.y) / P.zoom, D = {
2213
- x: Math.min(W.x, B),
2214
- y: Math.min(W.y, q),
2215
- width: Math.abs(B - W.x),
2216
- height: Math.abs(q - W.y)
2217
- }, it = [];
2213
+ const P = n.cameraRef.current, R = k.getBoundingClientRect(), B = (w.clientX - R.left - P.x) / P.zoom, q = (w.clientY - R.top - P.y) / P.zoom, X = {
2214
+ x: Math.min(_.x, B),
2215
+ y: Math.min(_.y, q),
2216
+ width: Math.abs(B - _.x),
2217
+ height: Math.abs(q - _.y)
2218
+ }, K = [];
2218
2219
  for (const G of n.nodesRef.current) {
2219
- const j = G._absolutePosition || G.position, st = G.width || 160, rt = G.height || 60;
2220
- let ut;
2221
- e === "full" ? ut = j.x >= D.x && j.y >= D.y && j.x + st <= D.x + D.width && j.y + rt <= D.y + D.height : ut = j.x + st > D.x && j.x < D.x + D.width && j.y + rt > D.y && j.y < D.y + D.height, it.push({ id: G.id, type: "select", selected: ut });
2220
+ const j = G._absolutePosition || G.position, it = G.width || 160, dt = G.height || 60;
2221
+ let ot;
2222
+ e === "full" ? ot = j.x >= X.x && j.y >= X.y && j.x + it <= X.x + X.width && j.y + dt <= X.y + X.height : ot = j.x + it > X.x && j.x < X.x + X.width && j.y + dt > X.y && j.y < X.y + X.height, K.push({ id: G.id, type: "select", selected: ot });
2222
2223
  }
2223
- it.length && ((lt = (nt = n.onNodesChangeRef).current) == null || lt.call(nt, it)), W = null, s(null);
2224
+ K.length && ((rt = (at = n.onNodesChangeRef).current) == null || rt.call(at, K)), _ = null, s(null);
2224
2225
  };
2225
- return z.addEventListener("pointerdown", p, !0), z.addEventListener("pointermove", v), z.addEventListener("pointerup", w), window.addEventListener("keydown", g), window.addEventListener("keyup", f), () => {
2226
- z.removeEventListener("pointerdown", p, !0), z.removeEventListener("pointermove", v), z.removeEventListener("pointerup", w), window.removeEventListener("keydown", g), window.removeEventListener("keyup", f);
2226
+ return k.addEventListener("pointerdown", p, !0), k.addEventListener("pointermove", v), k.addEventListener("pointerup", N), window.addEventListener("keydown", g), window.addEventListener("keyup", f), () => {
2227
+ k.removeEventListener("pointerdown", p, !0), k.removeEventListener("pointermove", v), k.removeEventListener("pointerup", N), window.removeEventListener("keydown", g), window.removeEventListener("keyup", f);
2227
2228
  };
2228
2229
  }, [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, k = l * i.zoom, M = y * i.zoom;
2230
+ 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;
2230
2231
  return /* @__PURE__ */ S(
2231
2232
  "div",
2232
2233
  {
@@ -2236,7 +2237,7 @@ function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
2236
2237
  position: "absolute",
2237
2238
  left: m,
2238
2239
  top: C,
2239
- width: k,
2240
+ width: z,
2240
2241
  height: M,
2241
2242
  border: "1px dashed #3b82f6",
2242
2243
  background: "rgba(59, 130, 246, 0.08)",
@@ -2247,7 +2248,7 @@ function Kn({ selectionKeyCode: t = "Shift", selectionMode: e = "partial" }) {
2247
2248
  );
2248
2249
  }
2249
2250
  Kn.displayName = "SelectionBox";
2250
- const Hr = Zt(Kn);
2251
+ const Ar = Zt(Kn);
2251
2252
  function Jn(t, e) {
2252
2253
  var s, o, i, c;
2253
2254
  const n = (s = t.handleRegistryRef) == null ? void 0 : s.current;
@@ -2263,12 +2264,12 @@ function Jn(t, e) {
2263
2264
  ]), (c = t.syncNodesToWorker) == null || c.call(t);
2264
2265
  }
2265
2266
  const vn = /* @__PURE__ */ new Set();
2266
- function Hn(t, e) {
2267
+ function An(t, e) {
2267
2268
  vn.has(e) || (vn.add(e), queueMicrotask(() => {
2268
2269
  vn.delete(e), Jn(t, e);
2269
2270
  }));
2270
2271
  }
2271
- function Ar(t, e) {
2272
+ function Hr(t, e) {
2272
2273
  const n = t.closest(".ric-node-wrapper");
2273
2274
  if (!n) return null;
2274
2275
  const r = n.getBoundingClientRect(), s = t.getBoundingClientRect(), o = e || 1;
@@ -2290,128 +2291,128 @@ function on({
2290
2291
  onConnect: l,
2291
2292
  ...y
2292
2293
  }) {
2293
- const m = qe(je), C = yt(), k = V(null), M = V(C);
2294
+ const m = qe(je), C = yt(), z = tt(null), M = tt(C);
2294
2295
  M.current = C;
2295
2296
  const $ = F(() => {
2296
- var N, P, R;
2297
- const H = k.current;
2298
- if (!H || !m) return;
2299
- const g = M.current, f = (N = g.handleRegistryRef) == null ? void 0 : N.current;
2297
+ var w, P, R;
2298
+ const D = z.current;
2299
+ if (!D || !m) return;
2300
+ const g = M.current, f = (w = g.handleRegistryRef) == null ? void 0 : w.current;
2300
2301
  if (!f) return;
2301
- const p = `${m}__${n || t}`, v = (R = (P = g.cameraRef) == null ? void 0 : P.current) == null ? void 0 : R.zoom, w = Ar(H, v);
2302
- if (w) {
2303
- const B = { nodeId: m, id: n || null, type: t, position: e, x: w.x, y: w.y };
2302
+ const p = `${m}__${n || t}`, v = (R = (P = g.cameraRef) == null ? void 0 : P.current) == null ? void 0 : R.zoom, N = Hr(D, v);
2303
+ if (N) {
2304
+ const B = { nodeId: m, id: n || null, type: t, position: e, x: N.x, y: N.y };
2304
2305
  f.set(p, B);
2305
2306
  }
2306
2307
  }, [m, n, t, e]);
2307
2308
  kr(() => {
2308
2309
  $();
2309
- }, [$]), ft(() => {
2310
+ }, [$]), ht(() => {
2310
2311
  if (!m) return;
2311
- const H = M.current;
2312
- Hn(H, m);
2313
- const g = k.current, f = g == null ? void 0 : g.closest(".ric-node-wrapper"), p = new ResizeObserver(() => {
2314
- $(), Hn(M.current, m);
2312
+ const D = M.current;
2313
+ An(D, m);
2314
+ const g = z.current, f = g == null ? void 0 : g.closest(".ric-node-wrapper"), p = new ResizeObserver(() => {
2315
+ $(), An(M.current, m);
2315
2316
  });
2316
2317
  return f && p.observe(f), () => {
2317
2318
  var P;
2318
2319
  p.disconnect();
2319
- const v = M.current, w = (P = v.handleRegistryRef) == null ? void 0 : P.current, N = `${m}__${n || t}`;
2320
- w == null || w.delete(N), Jn(v, m);
2320
+ const v = M.current, N = (P = v.handleRegistryRef) == null ? void 0 : P.current, w = `${m}__${n || t}`;
2321
+ N == null || N.delete(w), Jn(v, m);
2321
2322
  };
2322
2323
  }, [m, n, t, e, $]);
2323
- const z = F(() => {
2324
+ const k = F(() => {
2324
2325
  var R;
2325
- const H = M.current, g = H.nodesRef.current.find((B) => B.id === m);
2326
+ const D = M.current, g = D.nodesRef.current.find((B) => B.id === m);
2326
2327
  if (!g) return null;
2327
- const f = g._absolutePosition || g.position, p = (R = H.handleRegistryRef) == null ? void 0 : R.current, v = `${m}__${n || t}`, w = p == null ? void 0 : p.get(v);
2328
- if (w && w.x !== void 0 && w.y !== void 0)
2329
- return { x: f.x + w.x, y: f.y + w.y };
2330
- const N = g.width || 160, P = g.height || 60;
2328
+ const f = g._absolutePosition || g.position, p = (R = D.handleRegistryRef) == null ? void 0 : R.current, v = `${m}__${n || t}`, N = p == null ? void 0 : p.get(v);
2329
+ if (N && N.x !== void 0 && N.y !== void 0)
2330
+ return { x: f.x + N.x, y: f.y + N.y };
2331
+ const w = g.width || 160, P = g.height || 60;
2331
2332
  switch (e) {
2332
2333
  case "top":
2333
- return { x: f.x + N / 2, y: f.y };
2334
+ return { x: f.x + w / 2, y: f.y };
2334
2335
  case "bottom":
2335
- return { x: f.x + N / 2, y: f.y + P };
2336
+ return { x: f.x + w / 2, y: f.y + P };
2336
2337
  case "left":
2337
2338
  return { x: f.x, y: f.y + P / 2 };
2338
2339
  default:
2339
- return { x: f.x + N, y: f.y + P / 2 };
2340
+ return { x: f.x + w, y: f.y + P / 2 };
2340
2341
  }
2341
- }, [m, n, t, e]), E = F((H) => {
2342
+ }, [m, n, t, e]), E = F((D) => {
2342
2343
  var q;
2343
2344
  if (!r || !s) return;
2344
- H.stopPropagation(), H.preventDefault();
2345
+ D.stopPropagation(), D.preventDefault();
2345
2346
  const g = M.current, f = g.cameraRef.current, p = g.wrapRef.current;
2346
2347
  if (!p) return;
2347
- const v = p.getBoundingClientRect(), w = z();
2348
- if (!w) return;
2349
- const N = w.x, P = w.y;
2348
+ const v = p.getBoundingClientRect(), N = k();
2349
+ if (!N) return;
2350
+ const w = N.x, P = N.y;
2350
2351
  (q = g.workerRef.current) == null || q.postMessage({
2351
2352
  type: "connecting",
2352
- data: { from: { x: N, y: P }, to: { x: N, y: P } }
2353
- }), p.setPointerCapture(H.pointerId);
2354
- const R = (D) => {
2355
- var lt;
2356
- const it = (D.clientX - v.left - f.x) / f.zoom, nt = (D.clientY - v.top - f.y) / f.zoom;
2357
- (lt = g.workerRef.current) == null || lt.postMessage({
2353
+ data: { from: { x: w, y: P }, to: { x: w, y: P } }
2354
+ }), p.setPointerCapture(D.pointerId);
2355
+ const R = (X) => {
2356
+ var rt;
2357
+ const K = (X.clientX - v.left - f.x) / f.zoom, at = (X.clientY - v.top - f.y) / f.zoom;
2358
+ (rt = g.workerRef.current) == null || rt.postMessage({
2358
2359
  type: "connecting",
2359
- data: { from: { x: N, y: P }, to: { x: it, y: nt } }
2360
+ data: { from: { x: w, y: P }, to: { x: K, y: at } }
2360
2361
  });
2361
- }, B = (D) => {
2362
- var rt, ut, dt, Lt;
2363
- const it = (D.clientX - v.left - f.x) / f.zoom, nt = (D.clientY - v.top - f.y) / f.zoom, lt = 20 / f.zoom;
2362
+ }, B = (X) => {
2363
+ var dt, ot, ft, It;
2364
+ const K = (X.clientX - v.left - f.x) / f.zoom, at = (X.clientY - v.top - f.y) / f.zoom, rt = 20 / f.zoom;
2364
2365
  let G = null, j = null;
2365
- const st = (rt = g.handleRegistryRef) == null ? void 0 : rt.current;
2366
- for (const ot of g.nodesRef.current) {
2367
- if (ot.id === m || ot.hidden) continue;
2368
- const pt = ot.width || 160, vt = ot.height || 60, ht = ot._absolutePosition || ot.position, bt = [];
2369
- if (st)
2370
- for (const [, kt] of st)
2371
- kt.nodeId === ot.id && bt.push(kt);
2372
- const Et = bt.length > 0 ? bt : ot.handles || [
2366
+ const it = (dt = g.handleRegistryRef) == null ? void 0 : dt.current;
2367
+ for (const st of g.nodesRef.current) {
2368
+ if (st.id === m || st.hidden) continue;
2369
+ const xt = st.width || 160, Nt = st.height || 60, gt = st._absolutePosition || st.position, ct = [];
2370
+ if (it)
2371
+ for (const [, Rt] of it)
2372
+ Rt.nodeId === st.id && ct.push(Rt);
2373
+ const zt = ct.length > 0 ? ct : st.handles || [
2373
2374
  { type: "target", position: "left" },
2374
2375
  { type: "source", position: "right" }
2375
2376
  ];
2376
- for (const kt of Et) {
2377
- let $t, wt;
2378
- if (kt.x !== void 0 && kt.y !== void 0)
2379
- $t = ht.x + kt.x, wt = ht.y + kt.y;
2377
+ for (const Rt of zt) {
2378
+ let Lt, wt;
2379
+ if (Rt.x !== void 0 && Rt.y !== void 0)
2380
+ Lt = gt.x + Rt.x, wt = gt.y + Rt.y;
2380
2381
  else
2381
- switch (kt.position || (kt.type === "source" ? "right" : "left")) {
2382
+ switch (Rt.position || (Rt.type === "source" ? "right" : "left")) {
2382
2383
  case "top":
2383
- $t = ht.x + pt / 2, wt = ht.y;
2384
+ Lt = gt.x + xt / 2, wt = gt.y;
2384
2385
  break;
2385
2386
  case "bottom":
2386
- $t = ht.x + pt / 2, wt = ht.y + vt;
2387
+ Lt = gt.x + xt / 2, wt = gt.y + Nt;
2387
2388
  break;
2388
2389
  case "left":
2389
- $t = ht.x, wt = ht.y + vt / 2;
2390
+ Lt = gt.x, wt = gt.y + Nt / 2;
2390
2391
  break;
2391
2392
  default:
2392
- $t = ht.x + pt, wt = ht.y + vt / 2;
2393
+ Lt = gt.x + xt, wt = gt.y + Nt / 2;
2393
2394
  break;
2394
2395
  }
2395
- if (Math.abs(it - $t) < lt && Math.abs(nt - wt) < lt) {
2396
- G = ot, j = kt.id || null;
2396
+ if (Math.abs(K - Lt) < rt && Math.abs(at - wt) < rt) {
2397
+ G = st, j = Rt.id || null;
2397
2398
  break;
2398
2399
  }
2399
2400
  }
2400
2401
  if (G) break;
2401
2402
  }
2402
2403
  if (G) {
2403
- const ot = {
2404
+ const st = {
2404
2405
  source: t === "source" ? m : G.id,
2405
2406
  target: t === "source" ? G.id : m,
2406
2407
  sourceHandle: t === "source" ? n || null : j,
2407
2408
  targetHandle: t === "source" ? j : n || null
2408
2409
  };
2409
- (dt = (ut = g.onEdgesChangeRef) == null ? void 0 : ut.current) == null || dt.call(ut, [{ type: "add", item: { id: `e-${ot.source}-${ot.target}`, ...ot } }]);
2410
+ (ft = (ot = g.onEdgesChangeRef) == null ? void 0 : ot.current) == null || ft.call(ot, [{ type: "add", item: { id: `e-${st.source}-${st.target}`, ...st } }]);
2410
2411
  }
2411
- (Lt = g.workerRef.current) == null || Lt.postMessage({ type: "connecting", data: null }), p.removeEventListener("pointermove", R), p.removeEventListener("pointerup", B);
2412
+ (It = g.workerRef.current) == null || It.postMessage({ type: "connecting", data: null }), p.removeEventListener("pointermove", R), p.removeEventListener("pointerup", B);
2412
2413
  };
2413
2414
  p.addEventListener("pointermove", R), p.addEventListener("pointerup", B);
2414
- }, [m, n, t, e, r, s, z]), W = {
2415
+ }, [m, n, t, e, r, s, k]), _ = {
2415
2416
  top: { top: 0, left: "50%", transform: "translate(-50%, -50%)" },
2416
2417
  bottom: { bottom: 0, left: "50%", transform: "translate(-50%, 50%)" },
2417
2418
  left: { top: "50%", left: 0, transform: "translate(-50%, -50%)" },
@@ -2420,7 +2421,7 @@ function on({
2420
2421
  return /* @__PURE__ */ S(
2421
2422
  "div",
2422
2423
  {
2423
- ref: k,
2424
+ ref: z,
2424
2425
  className: `ric-handle ric-handle-${e} ric-handle-${t} ${c}`,
2425
2426
  "data-handleid": n || null,
2426
2427
  "data-nodeid": m,
@@ -2437,7 +2438,7 @@ function on({
2437
2438
  zIndex: 10,
2438
2439
  cursor: r ? "crosshair" : "default",
2439
2440
  boxSizing: "border-box",
2440
- ...W,
2441
+ ..._,
2441
2442
  ...u
2442
2443
  },
2443
2444
  ...y,
@@ -2454,7 +2455,7 @@ function ko({
2454
2455
  hideSourceHandle: o = !1,
2455
2456
  hideTargetHandle: i = !1
2456
2457
  }) {
2457
- return /* @__PURE__ */ It(
2458
+ return /* @__PURE__ */ $t(
2458
2459
  "div",
2459
2460
  {
2460
2461
  className: `ric-default-node${n ? " selected" : ""}`,
@@ -2483,7 +2484,7 @@ function _r({
2483
2484
  sourcePosition: r = "right",
2484
2485
  hideSourceHandle: s = !1
2485
2486
  }) {
2486
- return /* @__PURE__ */ It(
2487
+ return /* @__PURE__ */ $t(
2487
2488
  "div",
2488
2489
  {
2489
2490
  className: `ric-input-node${n ? " selected" : ""}`,
@@ -2512,7 +2513,7 @@ function Wr({
2512
2513
  targetPosition: r = "left",
2513
2514
  hideTargetHandle: s = !1
2514
2515
  }) {
2515
- return /* @__PURE__ */ It(
2516
+ return /* @__PURE__ */ $t(
2516
2517
  "div",
2517
2518
  {
2518
2519
  className: `ric-output-node${n ? " selected" : ""}`,
@@ -2576,10 +2577,10 @@ function Vn({
2576
2577
  className: l = "",
2577
2578
  ...y
2578
2579
  }) {
2579
- const [m, C] = Gt({ x: 1, y: 0, width: 0, height: 0 }), k = V(null);
2580
- return ft(() => {
2581
- if (k.current) {
2582
- const M = k.current.getBBox();
2580
+ const [m, C] = Gt({ x: 1, y: 0, width: 0, height: 0 }), z = tt(null);
2581
+ return ht(() => {
2582
+ if (z.current) {
2583
+ const M = z.current.getBBox();
2583
2584
  C({
2584
2585
  x: M.x,
2585
2586
  y: M.y,
@@ -2587,7 +2588,7 @@ function Vn({
2587
2588
  height: M.height
2588
2589
  });
2589
2590
  }
2590
- }, [n]), n ? /* @__PURE__ */ It(
2591
+ }, [n]), n ? /* @__PURE__ */ $t(
2591
2592
  "g",
2592
2593
  {
2593
2594
  transform: `translate(${t - m.width / 2} ${e - m.height / 2})`,
@@ -2614,7 +2615,7 @@ function Vn({
2614
2615
  className: "ric-edge-text",
2615
2616
  y: m.height / 2,
2616
2617
  dy: "0.3em",
2617
- ref: k,
2618
+ ref: z,
2618
2619
  style: r,
2619
2620
  children: n
2620
2621
  }
@@ -2626,7 +2627,7 @@ function Vn({
2626
2627
  }
2627
2628
  Vn.displayName = "EdgeText";
2628
2629
  const Fr = Zt(Vn);
2629
- function An(t) {
2630
+ function Hn(t) {
2630
2631
  return t != null && t !== "" && !isNaN(Number(t));
2631
2632
  }
2632
2633
  function un({
@@ -2643,11 +2644,11 @@ function un({
2643
2644
  interactionWidth: y = 20,
2644
2645
  style: m,
2645
2646
  markerEnd: C,
2646
- markerStart: k,
2647
+ markerStart: z,
2647
2648
  className: M = "",
2648
2649
  ...$
2649
2650
  }) {
2650
- return /* @__PURE__ */ It(Le, { children: [
2651
+ return /* @__PURE__ */ $t(Le, { children: [
2651
2652
  /* @__PURE__ */ S(
2652
2653
  "path",
2653
2654
  {
@@ -2659,7 +2660,7 @@ function un({
2659
2660
  className: `ric-edge-path ${M}`,
2660
2661
  style: m,
2661
2662
  markerEnd: C,
2662
- markerStart: k,
2663
+ markerStart: z,
2663
2664
  ...$
2664
2665
  }
2665
2666
  ),
@@ -2674,7 +2675,7 @@ function un({
2674
2675
  style: { pointerEvents: "stroke" }
2675
2676
  }
2676
2677
  ) : null,
2677
- s && An(n) && An(r) ? /* @__PURE__ */ S(
2678
+ s && Hn(n) && Hn(r) ? /* @__PURE__ */ S(
2678
2679
  Fr,
2679
2680
  {
2680
2681
  x: n,
@@ -2717,61 +2718,61 @@ const tr = Zt(function({
2717
2718
  labelShowBg: y,
2718
2719
  labelBgStyle: m,
2719
2720
  labelBgPadding: C,
2720
- labelBgBorderRadius: k,
2721
+ labelBgBorderRadius: z,
2721
2722
  style: M,
2722
2723
  markerEnd: $,
2723
- markerStart: z,
2724
+ markerStart: k,
2724
2725
  interactionWidth: E
2725
2726
  }) {
2726
- let W, H, g;
2727
- const f = _n(n, r, i), p = _n(s, o, c), v = Math.abs(p.x - f.x), w = Math.max(50, v * 0.5);
2728
- let N, P, R, B;
2727
+ let _, D, g;
2728
+ const f = _n(n, r, i), p = _n(s, o, c), v = Math.abs(p.x - f.x), N = Math.max(50, v * 0.5);
2729
+ let w, P, R, B;
2729
2730
  switch (i) {
2730
2731
  case "left":
2731
- N = f.x - w, P = f.y;
2732
+ w = f.x - N, P = f.y;
2732
2733
  break;
2733
2734
  case "top":
2734
- N = f.x, P = f.y - w;
2735
+ w = f.x, P = f.y - N;
2735
2736
  break;
2736
2737
  case "bottom":
2737
- N = f.x, P = f.y + w;
2738
+ w = f.x, P = f.y + N;
2738
2739
  break;
2739
2740
  default:
2740
- N = f.x + w, P = f.y;
2741
+ w = f.x + N, P = f.y;
2741
2742
  break;
2742
2743
  }
2743
2744
  switch (c) {
2744
2745
  case "right":
2745
- R = p.x + w, B = p.y;
2746
+ R = p.x + N, B = p.y;
2746
2747
  break;
2747
2748
  case "top":
2748
- R = p.x, B = p.y - w;
2749
+ R = p.x, B = p.y - N;
2749
2750
  break;
2750
2751
  case "bottom":
2751
- R = p.x, B = p.y + w;
2752
+ R = p.x, B = p.y + N;
2752
2753
  break;
2753
2754
  default:
2754
- R = p.x - w, B = p.y;
2755
+ R = p.x - N, B = p.y;
2755
2756
  break;
2756
2757
  }
2757
- W = `M ${n},${r} L ${f.x},${f.y} C ${N},${P} ${R},${B} ${p.x},${p.y} L ${s},${o}`;
2758
- const q = 0.5, D = 0.5;
2759
- return H = D * D * D * f.x + 3 * D * D * q * N + 3 * D * q * q * R + q * q * q * p.x, g = D * D * D * f.y + 3 * D * D * q * P + 3 * D * q * q * B + q * q * q * p.y, /* @__PURE__ */ S(
2758
+ _ = `M ${n},${r} L ${f.x},${f.y} C ${w},${P} ${R},${B} ${p.x},${p.y} L ${s},${o}`;
2759
+ const q = 0.5, X = 0.5;
2760
+ return D = X * X * X * f.x + 3 * X * X * q * w + 3 * X * q * q * R + q * q * q * p.x, g = X * X * X * f.y + 3 * X * X * q * P + 3 * X * q * q * B + q * q * q * p.y, /* @__PURE__ */ S(
2760
2761
  un,
2761
2762
  {
2762
2763
  id: e,
2763
- path: W,
2764
- labelX: H,
2764
+ path: _,
2765
+ labelX: D,
2765
2766
  labelY: g,
2766
2767
  label: u,
2767
2768
  labelStyle: l,
2768
2769
  labelShowBg: y,
2769
2770
  labelBgStyle: m,
2770
2771
  labelBgPadding: C,
2771
- labelBgBorderRadius: k,
2772
+ labelBgBorderRadius: z,
2772
2773
  style: M,
2773
2774
  markerEnd: $,
2774
- markerStart: z,
2775
+ markerStart: k,
2775
2776
  interactionWidth: E
2776
2777
  }
2777
2778
  );
@@ -2791,7 +2792,7 @@ function nr({
2791
2792
  curvature: i = 0.25
2792
2793
  }) {
2793
2794
  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, k, M;
2795
+ let m, C, z, M;
2795
2796
  switch (s) {
2796
2797
  case "top":
2797
2798
  m = t, C = e - y;
@@ -2808,20 +2809,20 @@ function nr({
2808
2809
  }
2809
2810
  switch (o) {
2810
2811
  case "top":
2811
- k = n, M = r - y;
2812
+ z = n, M = r - y;
2812
2813
  break;
2813
2814
  case "bottom":
2814
- k = n, M = r + y;
2815
+ z = n, M = r + y;
2815
2816
  break;
2816
2817
  case "right":
2817
- k = n + y, M = r;
2818
+ z = n + y, M = r;
2818
2819
  break;
2819
2820
  default:
2820
- k = n - y, M = r;
2821
+ z = n - y, M = r;
2821
2822
  break;
2822
2823
  }
2823
- const $ = `M ${t},${e} C ${m},${C} ${k},${M} ${n},${r}`, z = 0.5, E = 1 - z, W = E * E * E * t + 3 * E * E * z * m + 3 * E * z * z * k + z * z * z * n, H = E * E * E * e + 3 * E * E * z * C + 3 * E * z * z * M + z * z * z * r;
2824
- return [$, W, H, 0, 0];
2824
+ const $ = `M ${t},${e} C ${m},${C} ${z},${M} ${n},${r}`, k = 0.5, E = 1 - k, _ = E * E * E * t + 3 * E * E * k * m + 3 * E * k * k * z + k * k * k * n, D = E * E * E * e + 3 * E * E * k * C + 3 * E * k * k * M + k * k * k * r;
2825
+ return [$, _, D, 0, 0];
2825
2826
  }
2826
2827
  function rr({ sourceX: t, sourceY: e, targetX: n, targetY: r }) {
2827
2828
  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;
@@ -2841,8 +2842,8 @@ function kn({
2841
2842
  if (u) {
2842
2843
  if (Math.abs(r - e) < 1)
2843
2844
  return [`M ${t},${e} L ${n},${r}`, (t + n) / 2, e, 0, 0];
2844
- const k = (t + n) / 2, M = r > e ? 1 : -1;
2845
- return [`M ${t},${e} L ${k - l},${e} Q ${k},${e} ${k},${e + M * l} L ${k},${r - M * l} Q ${k},${r} ${k + (n > k ? l : -l)},${r} L ${n},${r}`, k, (e + r) / 2, 0, 0];
2845
+ const z = (t + n) / 2, M = r > e ? 1 : -1;
2846
+ 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];
2846
2847
  }
2847
2848
  const y = (e + r) / 2, m = n > t ? 1 : -1;
2848
2849
  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];
@@ -2907,11 +2908,11 @@ function Yr(t, e, n, r, s, o, i, c) {
2907
2908
  if (l <= s || u >= s + i || m <= o || y >= o + c) return !1;
2908
2909
  const C = 0.5;
2909
2910
  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 k = (t + n) / 2, M = (e + r) / 2;
2911
- if (k > s + C && k < s + i - C && M > o + C && M < o + c - C) return !0;
2911
+ const z = (t + n) / 2, M = (e + r) / 2;
2912
+ if (z > s + C && z < s + i - C && M > o + C && M < o + c - C) return !0;
2912
2913
  const $ = [[s, o], [s + i, o], [s + i, o + c], [s, o + c]];
2913
- for (let z = 0; z < 4; z++)
2914
- if (Ur(t, e, n, r, $[z][0], $[z][1], $[(z + 1) % 4][0], $[(z + 1) % 4][1])) return !0;
2914
+ for (let k = 0; k < 4; k++)
2915
+ if (Ur(t, e, n, r, $[k][0], $[k][1], $[(k + 1) % 4][0], $[(k + 1) % 4][1])) return !0;
2915
2916
  return !1;
2916
2917
  }
2917
2918
  function Ur(t, e, n, r, s, o, i, c) {
@@ -2963,37 +2964,37 @@ function sr(t, e, n) {
2963
2964
  const i = [...r].sort((R, B) => R - B), c = [...s].sort((R, B) => R - B), u = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2964
2965
  for (let R = 0; R < i.length; R++) u.set(i[R], R);
2965
2966
  for (let R = 0; R < c.length; R++) l.set(c[R], R);
2966
- const y = i.length, m = c.length, C = (R, B) => B * y + R, k = u.get(t.x), M = l.get(t.y), $ = u.get(e.x), z = l.get(e.y);
2967
- if (k === void 0 || M === void 0 || $ === void 0 || z === void 0) return null;
2968
- const E = C(k, M), W = C($, z), H = 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
- H[E] = 0, g[E] = Math.abs(i[$] - t.x) + Math.abs(c[z] - t.y);
2970
- const w = [E], N = 15, P = [[1, 0], [-1, 0], [0, 1], [0, -1]];
2971
- for (; w.length > 0; ) {
2967
+ const y = i.length, m = c.length, C = (R, B) => B * y + R, z = u.get(t.x), M = l.get(t.y), $ = u.get(e.x), k = l.get(e.y);
2968
+ if (z === void 0 || M === void 0 || $ === void 0 || k === void 0) return null;
2969
+ const E = C(z, M), _ = C($, k), 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);
2970
+ D[E] = 0, g[E] = Math.abs(i[$] - t.x) + Math.abs(c[k] - t.y);
2971
+ const N = [E], w = 15, P = [[1, 0], [-1, 0], [0, 1], [0, -1]];
2972
+ for (; N.length > 0; ) {
2972
2973
  let R = 0;
2973
- for (let G = 1; G < w.length; G++)
2974
- g[w[G]] < g[w[R]] && (R = G);
2975
- const B = w[R];
2976
- if (w[R] = w[w.length - 1], w.pop(), B === W) {
2974
+ for (let G = 1; G < N.length; G++)
2975
+ g[N[G]] < g[N[R]] && (R = G);
2976
+ const B = N[R];
2977
+ if (N[R] = N[N.length - 1], N.pop(), B === _) {
2977
2978
  const G = [];
2978
- let j = W;
2979
+ let j = _;
2979
2980
  for (; j !== -1 && j !== E; ) {
2980
- const st = j / y | 0, rt = j % y;
2981
- G.unshift({ x: i[rt], y: c[st] }), j = f[j];
2981
+ const it = j / y | 0, dt = j % y;
2982
+ G.unshift({ x: i[dt], y: c[it] }), j = f[j];
2982
2983
  }
2983
2984
  return G.unshift({ x: t.x, y: t.y }), jr(G, n);
2984
2985
  }
2985
2986
  if (v[B]) continue;
2986
2987
  v[B] = 1;
2987
- const q = B / y | 0, D = B % y, it = i[D], nt = c[q], lt = p[B];
2988
+ const q = B / y | 0, X = B % y, K = i[X], at = c[q], rt = p[B];
2988
2989
  for (let G = 0; G < 4; G++) {
2989
- const j = D + P[G][0], st = q + P[G][1];
2990
- if (j < 0 || j >= y || st < 0 || st >= m) continue;
2991
- const rt = C(j, st);
2992
- if (v[rt]) continue;
2993
- const ut = i[j], dt = c[st];
2994
- if (qr(ut, dt, n) || !zn(it, nt, ut, dt, n)) continue;
2995
- const Lt = Math.abs(ut - it) + Math.abs(dt - nt), ot = lt >= 0 && lt !== G ? N : 0, pt = H[B] + Lt + ot;
2996
- pt < H[rt] && (f[rt] = B, p[rt] = G, H[rt] = pt, g[rt] = pt + Math.abs(i[$] - ut) + Math.abs(c[z] - dt), w.push(rt));
2990
+ const j = X + P[G][0], it = q + P[G][1];
2991
+ if (j < 0 || j >= y || it < 0 || it >= m) continue;
2992
+ const dt = C(j, it);
2993
+ if (v[dt]) continue;
2994
+ const ot = i[j], ft = c[it];
2995
+ if (qr(ot, ft, n) || !zn(K, at, ot, ft, n)) continue;
2996
+ const It = Math.abs(ot - K) + Math.abs(ft - at), st = rt >= 0 && rt !== G ? w : 0, xt = D[B] + It + st;
2997
+ xt < D[dt] && (f[dt] = B, p[dt] = G, D[dt] = xt, g[dt] = xt + Math.abs(i[$] - ot) + Math.abs(c[k] - ft), N.push(dt));
2997
2998
  }
2998
2999
  }
2999
3000
  return null;
@@ -3073,8 +3074,8 @@ function En(t, e = 6, n = !1) {
3073
3074
  for (let o = 1; o < t.length - 1; o++) {
3074
3075
  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
3076
  if (m > 0.5) {
3076
- const C = c.x - i.x, k = c.y - i.y, M = u.x - c.x, $ = u.y - c.y, z = Math.sqrt(C * C + k * k) || 1, E = Math.sqrt(M * M + $ * $) || 1;
3077
- s += ` L ${c.x - C / z * m},${c.y - k / z * m}`, s += ` Q ${c.x},${c.y} ${c.x + M / E * m},${c.y + $ / E * m}`;
3077
+ const C = c.x - i.x, z = c.y - i.y, M = u.x - c.x, $ = u.y - c.y, k = Math.sqrt(C * C + z * z) || 1, E = Math.sqrt(M * M + $ * $) || 1;
3078
+ s += ` L ${c.x - C / k * m},${c.y - z / k * m}`, s += ` Q ${c.x},${c.y} ${c.x + M / E * m},${c.y + $ / E * m}`;
3078
3079
  } else
3079
3080
  s += ` L ${c.x},${c.y}`;
3080
3081
  }
@@ -3117,15 +3118,15 @@ function No(t, e) {
3117
3118
  const n = {};
3118
3119
  for (const o of t) n[o.id] = o;
3119
3120
  const r = or(t, null), s = e.map((o) => {
3120
- var p, v, w, N;
3121
+ var p, v, N, w;
3121
3122
  const i = o.type || "default";
3122
3123
  if (i === "bezier" || i === "simplebezier" || i === "default") return o;
3123
3124
  const c = n[o.source], u = n[o.target];
3124
3125
  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), k = 5, M = r.filter((P) => P.id !== o.source && P.id !== o.target), $ = c._absolutePosition || c.position, z = 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 - k, y: $.y - k, w: z + 2 * k, h: E + 2 * k });
3127
- const W = u._absolutePosition || u.position, H = u.width || ((w = u.measured) == null ? void 0 : w.width) || sn, g = u.height || ((N = u.measured) == null ? void 0 : N.height) || an;
3128
- if (M.push({ id: o.target, x: W.x - k, y: W.y - k, w: H + 2 * k, h: g + 2 * k }), M.length === 0) return o;
3126
+ 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, k = c.width || ((p = c.measured) == null ? void 0 : p.width) || sn, E = c.height || ((v = c.measured) == null ? void 0 : v.height) || an;
3127
+ M.push({ id: o.source, x: $.x - z, y: $.y - z, w: k + 2 * z, h: E + 2 * z });
3128
+ const _ = u._absolutePosition || u.position, D = u.width || ((N = u.measured) == null ? void 0 : N.width) || sn, g = u.height || ((w = u.measured) == null ? void 0 : w.height) || an;
3129
+ 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
3130
  const f = sr(m, C, M);
3130
3131
  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;
3131
3132
  });
@@ -3134,8 +3135,8 @@ function No(t, e) {
3134
3135
  function Lo(t, e, n, r, s, o, i, c) {
3135
3136
  const u = or(i, c ? new Set(c) : null);
3136
3137
  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), k = sr(m, C, u);
3138
- return k && k.length >= 2 ? (k.unshift({ x: l.x, y: l.y }), k.push({ x: y.x, y: y.y }), k) : null;
3138
+ 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);
3139
+ return z && z.length >= 2 ? (z.unshift({ x: l.x, y: l.y }), z.push({ x: y.x, y: y.y }), z) : null;
3139
3140
  }
3140
3141
  const ir = Zt(function({
3141
3142
  id: e,
@@ -3150,25 +3151,25 @@ const ir = Zt(function({
3150
3151
  labelBgPadding: y,
3151
3152
  labelBgBorderRadius: m,
3152
3153
  style: C,
3153
- markerEnd: k,
3154
+ markerEnd: z,
3154
3155
  markerStart: M,
3155
3156
  interactionWidth: $,
3156
- routedPoints: z
3157
+ routedPoints: k
3157
3158
  }) {
3158
- let E, W, H;
3159
- if (z && z.length >= 2) {
3160
- E = En(z);
3161
- const g = Cn(z);
3162
- W = g.x, H = g.y;
3159
+ let E, _, D;
3160
+ if (k && k.length >= 2) {
3161
+ E = En(k);
3162
+ const g = Cn(k);
3163
+ _ = g.x, D = g.y;
3163
3164
  } else
3164
- [E, W, H] = er({ sourceX: n, sourceY: r, targetX: s, targetY: o });
3165
+ [E, _, D] = er({ sourceX: n, sourceY: r, targetX: s, targetY: o });
3165
3166
  return /* @__PURE__ */ S(
3166
3167
  un,
3167
3168
  {
3168
3169
  id: e,
3169
3170
  path: E,
3170
- labelX: W,
3171
- labelY: H,
3171
+ labelX: _,
3172
+ labelY: D,
3172
3173
  label: i,
3173
3174
  labelStyle: c,
3174
3175
  labelShowBg: u,
@@ -3176,7 +3177,7 @@ const ir = Zt(function({
3176
3177
  labelBgPadding: y,
3177
3178
  labelBgBorderRadius: m,
3178
3179
  style: C,
3179
- markerEnd: k,
3180
+ markerEnd: z,
3180
3181
  markerStart: M,
3181
3182
  interactionWidth: $
3182
3183
  }
@@ -3196,18 +3197,18 @@ const ar = Zt(function({
3196
3197
  labelShowBg: y,
3197
3198
  labelBgStyle: m,
3198
3199
  labelBgPadding: C,
3199
- labelBgBorderRadius: k,
3200
+ labelBgBorderRadius: z,
3200
3201
  style: M,
3201
3202
  markerEnd: $,
3202
- markerStart: z,
3203
+ markerStart: k,
3203
3204
  pathOptions: E,
3204
- interactionWidth: W,
3205
- routedPoints: H
3205
+ interactionWidth: _,
3206
+ routedPoints: D
3206
3207
  }) {
3207
3208
  let g, f, p;
3208
- if (H && H.length >= 2) {
3209
- g = En(H);
3210
- const v = Cn(H);
3209
+ if (D && D.length >= 2) {
3210
+ g = En(D);
3211
+ const v = Cn(D);
3211
3212
  f = v.x, p = v.y;
3212
3213
  } else
3213
3214
  [g, f, p] = kn({
@@ -3232,11 +3233,11 @@ const ar = Zt(function({
3232
3233
  labelShowBg: y,
3233
3234
  labelBgStyle: m,
3234
3235
  labelBgPadding: C,
3235
- labelBgBorderRadius: k,
3236
+ labelBgBorderRadius: z,
3236
3237
  style: M,
3237
3238
  markerEnd: $,
3238
- markerStart: z,
3239
- interactionWidth: W
3239
+ markerStart: k,
3240
+ interactionWidth: _
3240
3241
  }
3241
3242
  );
3242
3243
  });
@@ -3266,20 +3267,20 @@ const cr = Zt(function({
3266
3267
  labelShowBg: y,
3267
3268
  labelBgStyle: m,
3268
3269
  labelBgPadding: C,
3269
- labelBgBorderRadius: k,
3270
+ labelBgBorderRadius: z,
3270
3271
  style: M,
3271
3272
  markerEnd: $,
3272
- markerStart: z,
3273
+ markerStart: k,
3273
3274
  interactionWidth: E,
3274
- routedPoints: W
3275
+ routedPoints: _
3275
3276
  }) {
3276
- let H, g, f;
3277
- if (W && W.length >= 2) {
3278
- H = En(W);
3279
- const p = Cn(W);
3277
+ let D, g, f;
3278
+ if (_ && _.length >= 2) {
3279
+ D = En(_);
3280
+ const p = Cn(_);
3280
3281
  g = p.x, f = p.y;
3281
3282
  } else
3282
- [H, g, f] = rr({
3283
+ [D, g, f] = rr({
3283
3284
  sourceX: n,
3284
3285
  sourceY: r,
3285
3286
  targetX: s,
@@ -3289,7 +3290,7 @@ const cr = Zt(function({
3289
3290
  un,
3290
3291
  {
3291
3292
  id: e,
3292
- path: H,
3293
+ path: D,
3293
3294
  labelX: g,
3294
3295
  labelY: f,
3295
3296
  label: u,
@@ -3297,10 +3298,10 @@ const cr = Zt(function({
3297
3298
  labelShowBg: y,
3298
3299
  labelBgStyle: m,
3299
3300
  labelBgPadding: C,
3300
- labelBgBorderRadius: k,
3301
+ labelBgBorderRadius: z,
3301
3302
  style: M,
3302
3303
  markerEnd: $,
3303
- markerStart: z,
3304
+ markerStart: k,
3304
3305
  interactionWidth: E
3305
3306
  }
3306
3307
  );
@@ -3334,43 +3335,43 @@ function Io({
3334
3335
  // Zoom/Camera
3335
3336
  zoomMin: m,
3336
3337
  zoomMax: C,
3337
- initialCamera: k,
3338
+ initialCamera: z,
3338
3339
  fitView: M,
3339
3340
  fitViewOptions: $,
3340
3341
  // Node/Edge callbacks
3341
- onNodesChange: z,
3342
+ onNodesChange: k,
3342
3343
  onEdgesChange: E,
3343
- onConnect: W,
3344
- onConnectStart: H,
3344
+ onConnect: _,
3345
+ onConnectStart: D,
3345
3346
  onConnectEnd: g,
3346
3347
  onNodeClick: f,
3347
3348
  onNodeDoubleClick: p,
3348
3349
  onNodeMouseEnter: v,
3349
- onNodeMouseMove: w,
3350
- onNodeMouseLeave: N,
3350
+ onNodeMouseMove: N,
3351
+ onNodeMouseLeave: w,
3351
3352
  onNodeContextMenu: P,
3352
3353
  onNodeDragStart: R,
3353
3354
  onNodeDrag: B,
3354
3355
  onNodeDragStop: q,
3355
- onEdgeClick: D,
3356
- onEdgeDoubleClick: it,
3357
- onEdgeMouseEnter: nt,
3358
- onEdgeMouseMove: lt,
3356
+ onEdgeClick: X,
3357
+ onEdgeDoubleClick: K,
3358
+ onEdgeMouseEnter: at,
3359
+ onEdgeMouseMove: rt,
3359
3360
  onEdgeMouseLeave: G,
3360
3361
  onEdgeContextMenu: j,
3361
- onPaneClick: st,
3362
- onPaneContextMenu: rt,
3363
- onPaneMouseEnter: ut,
3364
- onPaneMouseMove: dt,
3365
- onPaneMouseLeave: Lt,
3366
- onSelectionChange: ot,
3367
- onInit: pt,
3368
- onMoveStart: vt,
3369
- onMove: ht,
3370
- onMoveEnd: bt,
3371
- onDelete: Et,
3372
- onBeforeDelete: kt,
3373
- onError: $t,
3362
+ onPaneClick: it,
3363
+ onPaneContextMenu: dt,
3364
+ onPaneMouseEnter: ot,
3365
+ onPaneMouseMove: ft,
3366
+ onPaneMouseLeave: It,
3367
+ onSelectionChange: st,
3368
+ onInit: xt,
3369
+ onMoveStart: Nt,
3370
+ onMove: gt,
3371
+ onMoveEnd: ct,
3372
+ onDelete: zt,
3373
+ onBeforeDelete: Rt,
3374
+ onError: Lt,
3374
3375
  // Drag and drop
3375
3376
  onDragOver: wt,
3376
3377
  onDrop: ne,
@@ -3399,10 +3400,10 @@ function Io({
3399
3400
  zoomOnDoubleClick: Nn,
3400
3401
  zoomOnPinch: hn,
3401
3402
  preventScrolling: fe,
3402
- translateExtent: xt,
3403
+ translateExtent: mt,
3403
3404
  nodeExtent: Te,
3404
- autoPanOnNodeDrag: Ct,
3405
- autoPanOnConnect: gt,
3405
+ autoPanOnNodeDrag: Et,
3406
+ autoPanOnConnect: pt,
3406
3407
  autoPanSpeed: se,
3407
3408
  edgesReconnectable: Z,
3408
3409
  elevateNodesOnSelect: Pt,
@@ -3418,71 +3419,71 @@ function Io({
3418
3419
  children: Me,
3419
3420
  ...ie
3420
3421
  }) {
3421
- const [Ut, Re] = Gt({ wx: 0, wy: 0, zoom: "1.00" }), Be = V(null), Je = V(null), Ve = F(
3422
+ const [Ut, Re] = Gt({ wx: 0, wy: 0, zoom: "1.00" }), Be = tt(null), Je = tt(null), Ve = F(
3422
3423
  (Q) => {
3423
3424
  Re(Q), te == null || te(Q);
3424
3425
  },
3425
3426
  [te]
3426
3427
  ), ae = St(() => ({ ...Qr, ...r }), [r]), Kt = St(() => ({ ...Kr, ...s }), [s]), he = St(() => {
3427
3428
  const Q = e.filter((Ft) => Ft.type && ae[Ft.type]);
3428
- return Q.sort((Ft, at) => {
3429
- const Tt = Ft.type === "group" || !Ft.parentId && Q.some((Ee) => Ee.parentId === Ft.id), xe = at.type === "group" || !at.parentId && Q.some((Ee) => Ee.parentId === at.id);
3429
+ return Q.sort((Ft, lt) => {
3430
+ const Tt = Ft.type === "group" || !Ft.parentId && Q.some((Ee) => Ee.parentId === Ft.id), xe = lt.type === "group" || !lt.parentId && Q.some((Ee) => Ee.parentId === lt.id);
3430
3431
  return Tt && !xe ? -1 : !Tt && xe ? 1 : 0;
3431
3432
  });
3432
- }, [e, ae]), ke = St(() => n.filter((Q) => Q.type && Kt[Q.type]), [n, Kt]), O = St(() => e.map((Q) => Q.type && ae[Q.type] ? { ...Q, _customRendered: !0 } : Q), [e, ae]), Mt = St(() => n.map((Q) => Q.type && Kt[Q.type] ? { ...Q, _customRendered: !0 } : Q), [n, Kt]), {
3433
+ }, [e, ae]), ke = St(() => n.filter((Q) => Q.type && Kt[Q.type]), [n, Kt]), O = St(() => e.map((Q) => Q.type && ae[Q.type] ? { ...Q, _customRendered: !0 } : Q), [e, ae]), bt = St(() => n.map((Q) => Q.type && Kt[Q.type] ? { ...Q, _customRendered: !0 } : Q), [n, Kt]), {
3433
3434
  wrapRef: Dt,
3434
3435
  canvasRef: ce,
3435
3436
  canvasReady: De,
3436
- onPointerDown: He,
3437
- onPointerMove: Ae,
3437
+ onPointerDown: Ae,
3438
+ onPointerMove: He,
3438
3439
  onPointerUp: _e,
3439
3440
  store: le
3440
3441
  } = Lr({
3441
3442
  cards: t,
3442
3443
  nodes: O,
3443
- edges: Mt,
3444
+ edges: bt,
3444
3445
  dark: o,
3445
3446
  gridSize: i,
3446
3447
  zoomMin: m,
3447
3448
  zoomMax: C,
3448
- initialCamera: k,
3449
+ initialCamera: z,
3449
3450
  fitView: M,
3450
3451
  fitViewOptions: $,
3451
3452
  onHudUpdate: Ve,
3452
3453
  onNodesProcessed: gn,
3453
- onNodesChange: z,
3454
+ onNodesChange: k,
3454
3455
  onEdgesChange: E,
3455
- onConnect: W,
3456
- onConnectStart: H,
3456
+ onConnect: _,
3457
+ onConnectStart: D,
3457
3458
  onConnectEnd: g,
3458
3459
  onNodeClick: f,
3459
3460
  onNodeDoubleClick: p,
3460
3461
  onNodeMouseEnter: v,
3461
- onNodeMouseMove: w,
3462
- onNodeMouseLeave: N,
3462
+ onNodeMouseMove: N,
3463
+ onNodeMouseLeave: w,
3463
3464
  onNodeContextMenu: P,
3464
3465
  onNodeDragStart: R,
3465
3466
  onNodeDrag: B,
3466
3467
  onNodeDragStop: q,
3467
- onEdgeClick: D,
3468
- onEdgeDoubleClick: it,
3469
- onEdgeMouseEnter: nt,
3470
- onEdgeMouseMove: lt,
3468
+ onEdgeClick: X,
3469
+ onEdgeDoubleClick: K,
3470
+ onEdgeMouseEnter: at,
3471
+ onEdgeMouseMove: rt,
3471
3472
  onEdgeMouseLeave: G,
3472
3473
  onEdgeContextMenu: j,
3473
- onPaneClick: st,
3474
- onPaneContextMenu: rt,
3475
- onPaneMouseEnter: ut,
3476
- onPaneMouseMove: dt,
3477
- onPaneMouseLeave: Lt,
3478
- onSelectionChange: ot,
3479
- onInit: pt,
3480
- onMoveStart: vt,
3481
- onMove: ht,
3482
- onMoveEnd: bt,
3483
- onDelete: Et,
3484
- onBeforeDelete: kt,
3485
- onError: $t,
3474
+ onPaneClick: it,
3475
+ onPaneContextMenu: dt,
3476
+ onPaneMouseEnter: ot,
3477
+ onPaneMouseMove: ft,
3478
+ onPaneMouseLeave: It,
3479
+ onSelectionChange: st,
3480
+ onInit: xt,
3481
+ onMoveStart: Nt,
3482
+ onMove: gt,
3483
+ onMoveEnd: ct,
3484
+ onDelete: zt,
3485
+ onBeforeDelete: Rt,
3486
+ onError: Lt,
3486
3487
  nodesDraggable: Ot,
3487
3488
  nodesConnectable: Yt,
3488
3489
  elementsSelectable: me,
@@ -3505,10 +3506,10 @@ function Io({
3505
3506
  zoomOnDoubleClick: Nn,
3506
3507
  zoomOnPinch: hn,
3507
3508
  preventScrolling: fe,
3508
- translateExtent: xt,
3509
+ translateExtent: mt,
3509
3510
  nodeExtent: Te,
3510
- autoPanOnNodeDrag: Ct,
3511
- autoPanOnConnect: gt,
3511
+ autoPanOnNodeDrag: Et,
3512
+ autoPanOnConnect: pt,
3512
3513
  autoPanSpeed: se,
3513
3514
  edgesReconnectable: Z,
3514
3515
  elevateNodesOnSelect: Pt,
@@ -3524,24 +3525,24 @@ function Io({
3524
3525
  get edges() {
3525
3526
  return n;
3526
3527
  }
3527
- }), [le, e, n]), ye = V(null), ge = V(null), pe = V(null), Jt = V(null);
3528
- ft(() => {
3528
+ }), [le, e, n]), ye = tt(null), ge = tt(null), pe = tt(null), Jt = tt(null);
3529
+ ht(() => {
3529
3530
  let Q;
3530
3531
  const Ft = () => {
3531
- const at = le.cameraRef.current, Tt = `translate(${at.x}px, ${at.y}px) scale(${at.zoom})`, xe = `translate(${at.x}, ${at.y}) scale(${at.zoom})`;
3532
+ const lt = le.cameraRef.current, Tt = `translate(${lt.x}px, ${lt.y}px) scale(${lt.zoom})`, xe = `translate(${lt.x}, ${lt.y}) scale(${lt.zoom})`;
3532
3533
  ye.current && (ye.current.style.transform = Tt), ge.current && ge.current.setAttribute("transform", xe), pe.current && (pe.current.style.transform = Tt), Jt.current && (Jt.current.style.transform = Tt), Q = requestAnimationFrame(Ft);
3533
3534
  };
3534
3535
  return Q = requestAnimationFrame(Ft), () => cancelAnimationFrame(Q);
3535
3536
  }, [le]);
3536
3537
  const ze = he.length > 0, ee = ke.length > 0;
3537
- return /* @__PURE__ */ S(Zn.Provider, { value: We, children: /* @__PURE__ */ It(
3538
+ return /* @__PURE__ */ S(Zn.Provider, { value: We, children: /* @__PURE__ */ $t(
3538
3539
  "div",
3539
3540
  {
3540
3541
  ref: Dt,
3541
3542
  className: `ric-wrap ${l}`,
3542
3543
  style: { width: c, height: u, ...y },
3543
- onPointerDown: He,
3544
- onPointerMove: Ae,
3544
+ onPointerDown: Ae,
3545
+ onPointerMove: He,
3545
3546
  onPointerUp: _e,
3546
3547
  onDragOver: wt,
3547
3548
  onDrop: ne,
@@ -3640,7 +3641,7 @@ function Io({
3640
3641
  }
3641
3642
  ),
3642
3643
  _t && /* @__PURE__ */ S("div", { className: "ric-hint", children: Wt }),
3643
- pn && /* @__PURE__ */ It("div", { className: "ric-info", children: [
3644
+ pn && /* @__PURE__ */ $t("div", { className: "ric-info", children: [
3644
3645
  "world: (",
3645
3646
  Ut.wx,
3646
3647
  ", ",
@@ -3648,17 +3649,17 @@ function Io({
3648
3649
  ")   zoom: ",
3649
3650
  Ut.zoom,
3650
3651
  "x",
3651
- Ut.nodeCount > 0 && /* @__PURE__ */ It(Le, { children: [
3652
+ Ut.nodeCount > 0 && /* @__PURE__ */ $t(Le, { children: [
3652
3653
  "   nodes: ",
3653
3654
  Ut.nodeCount
3654
3655
  ] }),
3655
- Ut.edgeCount > 0 && /* @__PURE__ */ It(Le, { children: [
3656
+ Ut.edgeCount > 0 && /* @__PURE__ */ $t(Le, { children: [
3656
3657
  "   edges: ",
3657
3658
  Ut.edgeCount
3658
3659
  ] })
3659
3660
  ] }),
3660
3661
  /* @__PURE__ */ S(
3661
- Hr,
3662
+ Ar,
3662
3663
  {
3663
3664
  selectionKeyCode: de || "Shift",
3664
3665
  selectionMode: we || "partial"
@@ -3746,39 +3747,39 @@ function So(t) {
3746
3747
  }
3747
3748
  function eo() {
3748
3749
  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, w;
3750
+ var f, p, v, N;
3750
3751
  if (typeof g == "function") {
3751
- const N = g(t.nodesRef.current);
3752
+ const w = g(t.nodesRef.current);
3752
3753
  (p = (f = t.onNodesChangeRef).current) == null || p.call(f, [
3753
3754
  ...t.nodesRef.current.map((P) => ({ id: P.id, type: "remove" })),
3754
- ...N.map((P) => ({ type: "add", item: P }))
3755
+ ...w.map((P) => ({ type: "add", item: P }))
3755
3756
  ]);
3756
3757
  } else
3757
- (w = (v = t.onNodesChangeRef).current) == null || w.call(v, [
3758
- ...t.nodesRef.current.map((N) => ({ id: N.id, type: "remove" })),
3759
- ...g.map((N) => ({ type: "add", item: N }))
3758
+ (N = (v = t.onNodesChangeRef).current) == null || N.call(v, [
3759
+ ...t.nodesRef.current.map((w) => ({ id: w.id, type: "remove" })),
3760
+ ...g.map((w) => ({ type: "add", item: w }))
3760
3761
  ]);
3761
3762
  }, [t]), i = F((g) => {
3762
- var f, p, v, w;
3763
+ var f, p, v, N;
3763
3764
  if (typeof g == "function") {
3764
- const N = g(t.edgesRef.current);
3765
+ const w = g(t.edgesRef.current);
3765
3766
  (p = (f = t.onEdgesChangeRef).current) == null || p.call(f, [
3766
3767
  ...t.edgesRef.current.map((P) => ({ id: P.id, type: "remove" })),
3767
- ...N.map((P) => ({ type: "add", item: P }))
3768
+ ...w.map((P) => ({ type: "add", item: P }))
3768
3769
  ]);
3769
3770
  } else
3770
- (w = (v = t.onEdgesChangeRef).current) == null || w.call(v, [
3771
- ...t.edgesRef.current.map((N) => ({ id: N.id, type: "remove" })),
3772
- ...g.map((N) => ({ type: "add", item: N }))
3771
+ (N = (v = t.onEdgesChangeRef).current) == null || N.call(v, [
3772
+ ...t.edgesRef.current.map((w) => ({ id: w.id, type: "remove" })),
3773
+ ...g.map((w) => ({ type: "add", item: w }))
3773
3774
  ]);
3774
3775
  }, [t]), c = F((g) => {
3775
3776
  var p, v;
3776
3777
  const f = Array.isArray(g) ? g : [g];
3777
- (v = (p = t.onNodesChangeRef).current) == null || v.call(p, f.map((w) => ({ type: "add", item: w })));
3778
+ (v = (p = t.onNodesChangeRef).current) == null || v.call(p, f.map((N) => ({ type: "add", item: N })));
3778
3779
  }, [t]), u = F((g) => {
3779
3780
  var p, v;
3780
3781
  const f = Array.isArray(g) ? g : [g];
3781
- (v = (p = t.onEdgesChangeRef).current) == null || v.call(p, f.map((w) => ({ type: "add", item: w })));
3782
+ (v = (p = t.onEdgesChangeRef).current) == null || v.call(p, f.map((N) => ({ type: "add", item: N })));
3782
3783
  }, [t]), l = F(({ nodes: g = [], edges: f = [] }) => {
3783
3784
  if (g.length && t.onNodesChangeRef.current) {
3784
3785
  t.onNodesChangeRef.current(g.map((v) => ({ id: v.id, type: "remove" })));
@@ -3795,40 +3796,40 @@ function eo() {
3795
3796
  y: g.y ?? t.cameraRef.current.y,
3796
3797
  zoom: g.zoom ?? t.cameraRef.current.zoom
3797
3798
  }, t.sendCamera();
3798
- }, [t]), C = F(() => t.cameraRef.current.zoom, [t]), k = F((g) => {
3799
+ }, [t]), C = F(() => t.cameraRef.current.zoom, [t]), z = F((g) => {
3799
3800
  const f = t.cameraRef.current, p = t.wrapRef.current;
3800
3801
  if (!p) return;
3801
- const v = p.getBoundingClientRect(), w = v.width / 2, N = v.height / 2, P = 1.2;
3802
- f.x = w - (w - f.x) * P, f.y = N - (N - f.y) * P, f.zoom = Math.min(t.zoomMax, f.zoom * P), t.sendCamera();
3802
+ const v = p.getBoundingClientRect(), N = v.width / 2, w = v.height / 2, P = 1.2;
3803
+ f.x = N - (N - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.min(t.zoomMax, f.zoom * P), t.sendCamera();
3803
3804
  }, [t]), M = F((g) => {
3804
3805
  const f = t.cameraRef.current, p = t.wrapRef.current;
3805
3806
  if (!p) return;
3806
- const v = p.getBoundingClientRect(), w = v.width / 2, N = v.height / 2, P = 1 / 1.2;
3807
- f.x = w - (w - f.x) * P, f.y = N - (N - f.y) * P, f.zoom = Math.max(t.zoomMin, f.zoom * P), t.sendCamera();
3807
+ const v = p.getBoundingClientRect(), N = v.width / 2, w = v.height / 2, P = 1 / 1.2;
3808
+ f.x = N - (N - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.max(t.zoomMin, f.zoom * P), t.sendCamera();
3808
3809
  }, [t]), $ = F((g) => {
3809
3810
  const f = t.cameraRef.current, p = t.wrapRef.current;
3810
3811
  if (!p) return;
3811
- const v = p.getBoundingClientRect(), w = v.width / 2, N = v.height / 2, P = g / f.zoom;
3812
- f.x = w - (w - f.x) * P, f.y = N - (N - f.y) * P, f.zoom = Math.min(t.zoomMax, Math.max(t.zoomMin, g)), t.sendCamera();
3813
- }, [t]), z = F((g = {}) => {
3812
+ const v = p.getBoundingClientRect(), N = v.width / 2, w = v.height / 2, P = g / f.zoom;
3813
+ f.x = N - (N - f.x) * P, f.y = w - (w - f.y) * P, f.zoom = Math.min(t.zoomMax, Math.max(t.zoomMin, g)), t.sendCamera();
3814
+ }, [t]), k = F((g = {}) => {
3814
3815
  const f = t.nodesRef.current;
3815
3816
  if (!f.length) return;
3816
3817
  const p = t.wrapRef.current;
3817
3818
  if (!p) return;
3818
- const v = p.getBoundingClientRect(), w = g.padding ?? 0.1, N = g.nodes ? f.filter((B) => g.nodes.some((q) => q.id === B.id)) : f;
3819
- if (!N.length) return;
3820
- const P = Mn(N), R = Rn(P, v.width, v.height, w);
3819
+ const v = p.getBoundingClientRect(), N = g.padding ?? 0.1, w = g.nodes ? f.filter((B) => g.nodes.some((q) => q.id === B.id)) : f;
3820
+ if (!w.length) return;
3821
+ const P = Mn(w), R = Rn(P, v.width, v.height, N);
3821
3822
  g.maxZoom && (R.zoom = Math.min(R.zoom, g.maxZoom)), g.minZoom && (R.zoom = Math.max(R.zoom, g.minZoom)), t.cameraRef.current = R, t.sendCamera();
3822
3823
  }, [t]), E = F((g, f, p = {}) => {
3823
3824
  const v = t.wrapRef.current;
3824
3825
  if (!v) return;
3825
- const w = v.getBoundingClientRect(), N = p.zoom ?? t.cameraRef.current.zoom;
3826
+ const N = v.getBoundingClientRect(), w = p.zoom ?? t.cameraRef.current.zoom;
3826
3827
  t.cameraRef.current = {
3827
- x: w.width / 2 - g * N,
3828
- y: w.height / 2 - f * N,
3829
- zoom: N
3828
+ x: N.width / 2 - g * w,
3829
+ y: N.height / 2 - f * w,
3830
+ zoom: w
3830
3831
  }, t.sendCamera();
3831
- }, [t]), W = F((g) => t.screenToWorld(g.x, g.y), [t]), H = F((g) => {
3832
+ }, [t]), _ = F((g) => t.screenToWorld(g.x, g.y), [t]), D = F((g) => {
3832
3833
  const f = t.cameraRef.current, p = t.wrapRef.current;
3833
3834
  if (!p) return { x: 0, y: 0 };
3834
3835
  const v = p.getBoundingClientRect();
@@ -3850,13 +3851,13 @@ function eo() {
3850
3851
  getViewport: y,
3851
3852
  setViewport: m,
3852
3853
  getZoom: C,
3853
- zoomIn: k,
3854
+ zoomIn: z,
3854
3855
  zoomOut: M,
3855
3856
  zoomTo: $,
3856
- fitView: z,
3857
+ fitView: k,
3857
3858
  setCenter: E,
3858
- screenToFlowPosition: W,
3859
- flowToScreenPosition: H
3859
+ screenToFlowPosition: _,
3860
+ flowToScreenPosition: D
3860
3861
  };
3861
3862
  }
3862
3863
  function Bo() {
@@ -3865,10 +3866,10 @@ function Bo() {
3865
3866
  function Do() {
3866
3867
  return yt().edges;
3867
3868
  }
3868
- function Ho() {
3869
+ function Ao() {
3869
3870
  return yt().viewport;
3870
3871
  }
3871
- function Ao() {
3872
+ function Ho() {
3872
3873
  return yt().connection;
3873
3874
  }
3874
3875
  function _o(t) {
@@ -3887,14 +3888,14 @@ function Xo({ nodeId: t, type: e, handleId: n }) {
3887
3888
  return St(() => r.edges.filter((s) => e === "source" ? s.source === t && (n ? s.sourceHandle === n : !0) : s.target === t && (n ? s.targetHandle === n : !0)), [r.edges, t, e, n]);
3888
3889
  }
3889
3890
  function Fo({ onChange: t, onStart: e, onEnd: n }) {
3890
- const r = yt(), s = V(t), o = V(e), i = V(n);
3891
- ft(() => {
3891
+ const r = yt(), s = tt(t), o = tt(e), i = tt(n);
3892
+ ht(() => {
3892
3893
  s.current = t;
3893
- }, [t]), ft(() => {
3894
+ }, [t]), ht(() => {
3894
3895
  o.current = e;
3895
- }, [e]), ft(() => {
3896
+ }, [e]), ht(() => {
3896
3897
  i.current = n;
3897
- }, [n]), ft(() => {
3898
+ }, [n]), ht(() => {
3898
3899
  const c = (u) => {
3899
3900
  var l;
3900
3901
  (l = s.current) == null || l.call(s, { x: u.x, y: u.y, zoom: u.zoom });
@@ -3903,10 +3904,10 @@ function Fo({ onChange: t, onStart: e, onEnd: n }) {
3903
3904
  }, [r]);
3904
3905
  }
3905
3906
  function Yo({ onChange: t }) {
3906
- const e = yt(), n = V(t);
3907
- ft(() => {
3907
+ const e = yt(), n = tt(t);
3908
+ ht(() => {
3908
3909
  n.current = t;
3909
- }, [t]), ft(() => {
3910
+ }, [t]), ht(() => {
3910
3911
  const r = (s) => {
3911
3912
  var o;
3912
3913
  (o = n.current) == null || o.call(n, s);
@@ -3916,7 +3917,7 @@ function Yo({ onChange: t }) {
3916
3917
  }
3917
3918
  function Uo(t) {
3918
3919
  const [e, n] = Gt(!1), r = Array.isArray(t) ? t : [t];
3919
- return ft(() => {
3920
+ return ht(() => {
3920
3921
  const s = (i) => {
3921
3922
  r.includes(i.key) && n(!0);
3922
3923
  }, o = (i) => {
@@ -3967,50 +3968,50 @@ function Qo({
3967
3968
  style: o = {},
3968
3969
  className: i = ""
3969
3970
  }) {
3970
- const c = yt(), u = V(null), l = V(null), y = F(() => {
3971
+ const c = yt(), u = tt(null), l = tt(null), y = F(() => {
3971
3972
  const m = u.current;
3972
3973
  if (!m) return;
3973
- const C = m.getContext("2d"), k = window.devicePixelRatio || 1;
3974
- m.width = t * k, m.height = e * k, C.scale(k, k), C.clearRect(0, 0, t, e);
3974
+ const C = m.getContext("2d"), z = window.devicePixelRatio || 1;
3975
+ m.width = t * z, m.height = e * z, C.scale(z, z), C.clearRect(0, 0, t, e);
3975
3976
  const M = c.nodesRef.current;
3976
3977
  if (!M.length) return;
3977
- let $ = 1 / 0, z = 1 / 0, E = -1 / 0, W = -1 / 0;
3978
+ let $ = 1 / 0, k = 1 / 0, E = -1 / 0, _ = -1 / 0;
3978
3979
  for (const R of M) {
3979
3980
  const B = R.width || wn, q = R.height || bn;
3980
- R.position.x < $ && ($ = R.position.x), R.position.y < z && (z = R.position.y), R.position.x + B > E && (E = R.position.x + B), R.position.y + q > W && (W = R.position.y + q);
3981
+ R.position.x < $ && ($ = R.position.x), R.position.y < k && (k = R.position.y), R.position.x + B > E && (E = R.position.x + B), R.position.y + q > _ && (_ = R.position.y + q);
3981
3982
  }
3982
- const H = 40;
3983
- $ -= H, z -= H, E += H, W += H;
3984
- const g = E - $, f = W - z, p = Math.min(t / g, e / f), v = (t - g * p) / 2, w = (e - f * p) / 2;
3983
+ const D = 40;
3984
+ $ -= D, k -= D, E += D, _ += D;
3985
+ const g = E - $, f = _ - k, p = Math.min(t / g, e / f), v = (t - g * p) / 2, N = (e - f * p) / 2;
3985
3986
  for (const R of M) {
3986
3987
  if (R.hidden) continue;
3987
- const B = R.width || wn, q = R.height || bn, D = (R.position.x - $) * p + v, it = (R.position.y - z) * p + w, nt = B * p, lt = q * p;
3988
- C.fillStyle = R.selected ? "#f59e0b" : typeof n == "function" ? n(R) : n, C.fillRect(D, it, Math.max(nt, 2), Math.max(lt, 2));
3988
+ const B = R.width || wn, q = R.height || bn, X = (R.position.x - $) * p + v, K = (R.position.y - k) * p + N, at = B * p, rt = q * p;
3989
+ C.fillStyle = R.selected ? "#f59e0b" : typeof n == "function" ? n(R) : n, C.fillRect(X, K, Math.max(at, 2), Math.max(rt, 2));
3989
3990
  }
3990
- const N = c.cameraRef.current, P = c.wrapRef.current;
3991
+ const w = c.cameraRef.current, P = c.wrapRef.current;
3991
3992
  if (P) {
3992
- const R = P.getBoundingClientRect(), B = -N.x / N.zoom, q = -N.y / N.zoom, D = R.width / N.zoom, it = R.height / N.zoom;
3993
+ const R = P.getBoundingClientRect(), B = -w.x / w.zoom, q = -w.y / w.zoom, X = R.width / w.zoom, K = R.height / w.zoom;
3993
3994
  C.fillStyle = s, C.fillRect(0, 0, t, e);
3994
- const nt = (B - $) * p + v, lt = (q - z) * p + w, G = D * p, j = it * p;
3995
- C.clearRect(nt, lt, G, j);
3996
- for (const st of M) {
3997
- if (st.hidden) continue;
3998
- const rt = st.width || wn, ut = st.height || bn, dt = (st.position.x - $) * p + v, Lt = (st.position.y - z) * p + w;
3999
- C.fillStyle = st.selected ? "#f59e0b" : typeof n == "function" ? n(st) : n, C.fillRect(dt, Lt, Math.max(rt * p, 2), Math.max(ut * p, 2));
3995
+ const at = (B - $) * p + v, rt = (q - k) * p + N, G = X * p, j = K * p;
3996
+ C.clearRect(at, rt, G, j);
3997
+ for (const it of M) {
3998
+ if (it.hidden) continue;
3999
+ const dt = it.width || wn, ot = it.height || bn, ft = (it.position.x - $) * p + v, It = (it.position.y - k) * p + N;
4000
+ C.fillStyle = it.selected ? "#f59e0b" : typeof n == "function" ? n(it) : n, C.fillRect(ft, It, Math.max(dt * p, 2), Math.max(ot * p, 2));
4000
4001
  }
4001
- C.strokeStyle = "#3b82f6", C.lineWidth = 1.5, C.strokeRect(nt, lt, G, j);
4002
+ C.strokeStyle = "#3b82f6", C.lineWidth = 1.5, C.strokeRect(at, rt, G, j);
4002
4003
  }
4003
4004
  }, [c, t, e, n, r, s]);
4004
- return ft(() => {
4005
+ return ht(() => {
4005
4006
  let m = !0;
4006
4007
  function C() {
4007
4008
  m && (y(), l.current = requestAnimationFrame(C));
4008
4009
  }
4009
- const k = setInterval(() => {
4010
+ const z = setInterval(() => {
4010
4011
  cancelAnimationFrame(l.current), l.current = requestAnimationFrame(C);
4011
4012
  }, 66);
4012
4013
  return y(), () => {
4013
- m = !1, clearInterval(k), cancelAnimationFrame(l.current);
4014
+ m = !1, clearInterval(z), cancelAnimationFrame(l.current);
4014
4015
  };
4015
4016
  }, [y]), /* @__PURE__ */ S(
4016
4017
  "canvas",
@@ -4033,7 +4034,7 @@ function Qo({
4033
4034
  );
4034
4035
  }
4035
4036
  function no() {
4036
- return /* @__PURE__ */ It("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4037
+ return /* @__PURE__ */ $t("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4037
4038
  /* @__PURE__ */ S("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
4038
4039
  /* @__PURE__ */ S("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
4039
4040
  ] });
@@ -4045,13 +4046,13 @@ function oo() {
4045
4046
  return /* @__PURE__ */ S("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ S("path", { d: "M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7" }) });
4046
4047
  }
4047
4048
  function so() {
4048
- return /* @__PURE__ */ It("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4049
+ return /* @__PURE__ */ $t("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4049
4050
  /* @__PURE__ */ S("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
4050
4051
  /* @__PURE__ */ S("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
4051
4052
  ] });
4052
4053
  }
4053
4054
  function io() {
4054
- return /* @__PURE__ */ It("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4055
+ return /* @__PURE__ */ $t("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
4055
4056
  /* @__PURE__ */ S("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2" }),
4056
4057
  /* @__PURE__ */ S("path", { d: "M7 11V7a5 5 0 0 1 9.9-1" })
4057
4058
  ] });
@@ -4081,18 +4082,18 @@ function ao({
4081
4082
  style: y = {},
4082
4083
  className: m = "",
4083
4084
  "aria-label": C = "Canvas controls",
4084
- children: k
4085
+ children: z
4085
4086
  }) {
4086
- const M = yt(), { zoomIn: $, zoomOut: z, fitView: E, getZoom: W } = eo(), [H, g] = Gt(!0), f = W() <= M.zoomMin, p = W() >= M.zoomMax, v = F(() => {
4087
+ const M = yt(), { zoomIn: $, zoomOut: k, fitView: E, getZoom: _ } = eo(), [D, g] = Gt(!0), f = _() <= M.zoomMin, p = _() >= M.zoomMax, v = F(() => {
4087
4088
  $(), s == null || s();
4088
- }, [$, s]), w = F(() => {
4089
- z(), o == null || o();
4090
- }, [z, o]), N = F(() => {
4089
+ }, [$, s]), N = F(() => {
4090
+ k(), o == null || o();
4091
+ }, [k, o]), w = F(() => {
4091
4092
  E(r || { padding: 0.1 }), i == null || i();
4092
4093
  }, [E, r, i]), P = F(() => {
4093
- const B = !H;
4094
+ const B = !D;
4094
4095
  g(B), c == null || c(B);
4095
- }, [H, c]), R = {
4096
+ }, [D, c]), R = {
4096
4097
  "top-left": { top: 10, left: 10 },
4097
4098
  "top-right": { top: 10, right: 10 },
4098
4099
  "top-center": { top: 10, left: "50%", transform: "translateX(-50%)" },
@@ -4100,7 +4101,7 @@ function ao({
4100
4101
  "bottom-right": { bottom: 30, right: 10 },
4101
4102
  "bottom-center": { bottom: 30, left: "50%", transform: "translateX(-50%)" }
4102
4103
  }[u] || { bottom: 30, left: 10 };
4103
- return /* @__PURE__ */ It(
4104
+ return /* @__PURE__ */ $t(
4104
4105
  "div",
4105
4106
  {
4106
4107
  className: `ric-controls ${m}`,
@@ -4116,7 +4117,7 @@ function ao({
4116
4117
  role: "toolbar",
4117
4118
  "aria-label": C,
4118
4119
  children: [
4119
- t && /* @__PURE__ */ It(Le, { children: [
4120
+ t && /* @__PURE__ */ $t(Le, { children: [
4120
4121
  /* @__PURE__ */ S(
4121
4122
  rn,
4122
4123
  {
@@ -4131,7 +4132,7 @@ function ao({
4131
4132
  /* @__PURE__ */ S(
4132
4133
  rn,
4133
4134
  {
4134
- onClick: w,
4135
+ onClick: N,
4135
4136
  disabled: f,
4136
4137
  title: "Zoom out",
4137
4138
  "aria-label": "Zoom out",
@@ -4143,7 +4144,7 @@ function ao({
4143
4144
  e && /* @__PURE__ */ S(
4144
4145
  rn,
4145
4146
  {
4146
- onClick: N,
4147
+ onClick: w,
4147
4148
  title: "Fit view",
4148
4149
  "aria-label": "Fit view",
4149
4150
  className: "ric-controls-fitview",
@@ -4154,13 +4155,13 @@ function ao({
4154
4155
  rn,
4155
4156
  {
4156
4157
  onClick: P,
4157
- title: H ? "Lock interactivity" : "Unlock interactivity",
4158
- "aria-label": H ? "Lock interactivity" : "Unlock interactivity",
4158
+ title: D ? "Lock interactivity" : "Unlock interactivity",
4159
+ "aria-label": D ? "Lock interactivity" : "Unlock interactivity",
4159
4160
  className: "ric-controls-interactive",
4160
- children: H ? /* @__PURE__ */ S(io, {}) : /* @__PURE__ */ S(so, {})
4161
+ children: D ? /* @__PURE__ */ S(io, {}) : /* @__PURE__ */ S(so, {})
4161
4162
  }
4162
4163
  ),
4163
- k
4164
+ z
4164
4165
  ]
4165
4166
  }
4166
4167
  );
@@ -4237,32 +4238,32 @@ function ts({
4237
4238
  onResize: l,
4238
4239
  onResizeEnd: y
4239
4240
  }) {
4240
- const m = qe(je), C = yt(), k = V(null), M = F((E, W) => {
4241
+ const m = qe(je), C = yt(), z = tt(null), M = F((E, _) => {
4241
4242
  E.stopPropagation(), E.preventDefault();
4242
- const H = C.nodesRef.current.find((p) => p.id === m);
4243
- if (!H) return;
4244
- k.current = {
4245
- direction: W,
4243
+ const D = C.nodesRef.current.find((p) => p.id === m);
4244
+ if (!D) return;
4245
+ z.current = {
4246
+ direction: _,
4246
4247
  startX: E.clientX,
4247
4248
  startY: E.clientY,
4248
- width: H.width || 160,
4249
- height: H.height || 60
4250
- }, u == null || u(E, { width: k.current.width, height: k.current.height });
4249
+ width: D.width || 160,
4250
+ height: D.height || 60
4251
+ }, u == null || u(E, { width: z.current.width, height: z.current.height });
4251
4252
  const g = (p) => {
4252
- var q, D;
4253
- if (!k.current) return;
4254
- const v = k.current, w = C.cameraRef.current, N = (p.clientX - v.startX) / w.zoom, P = (p.clientY - v.startY) / w.zoom;
4253
+ var q, X;
4254
+ if (!z.current) return;
4255
+ const v = z.current, N = C.cameraRef.current, w = (p.clientX - v.startX) / N.zoom, P = (p.clientY - v.startY) / N.zoom;
4255
4256
  let R = v.width, B = v.height;
4256
- v.direction.includes("e") && (R = Math.min(n, Math.max(t, v.width + N))), v.direction.includes("w") && (R = Math.min(n, Math.max(t, v.width - N))), 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))), (D = (q = C.onNodesChangeRef).current) == null || D.call(q, [
4257
+ v.direction.includes("e") && (R = Math.min(n, Math.max(t, v.width + w))), v.direction.includes("w") && (R = 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 = (q = C.onNodesChangeRef).current) == null || X.call(q, [
4257
4258
  { id: m, type: "dimensions", dimensions: { width: R, height: B }, setAttributes: !0 }
4258
4259
  ]), l == null || l(p, { width: R, height: B });
4259
4260
  }, f = (p) => {
4260
- k.current = null, y == null || y(p, {}), window.removeEventListener("pointermove", g), window.removeEventListener("pointerup", f);
4261
+ z.current = null, y == null || y(p, {}), window.removeEventListener("pointermove", g), window.removeEventListener("pointerup", f);
4261
4262
  };
4262
4263
  window.addEventListener("pointermove", g), window.addEventListener("pointerup", f);
4263
4264
  }, [m, C, t, e, n, r, u, l, y]);
4264
4265
  if (!s) return null;
4265
- const $ = 8, z = {
4266
+ const $ = 8, k = {
4266
4267
  position: "absolute",
4267
4268
  width: $,
4268
4269
  height: $,
@@ -4272,60 +4273,60 @@ function ts({
4272
4273
  zIndex: 20,
4273
4274
  ...o
4274
4275
  };
4275
- return /* @__PURE__ */ It(Le, { children: [
4276
+ return /* @__PURE__ */ $t(Le, { children: [
4276
4277
  /* @__PURE__ */ S(
4277
4278
  "div",
4278
4279
  {
4279
- style: { ...z, bottom: -$ / 2, right: -$ / 2, cursor: "nwse-resize" },
4280
+ style: { ...k, bottom: -$ / 2, right: -$ / 2, cursor: "nwse-resize" },
4280
4281
  onPointerDown: (E) => M(E, "se")
4281
4282
  }
4282
4283
  ),
4283
4284
  /* @__PURE__ */ S(
4284
4285
  "div",
4285
4286
  {
4286
- style: { ...z, bottom: -$ / 2, left: -$ / 2, cursor: "nesw-resize" },
4287
+ style: { ...k, bottom: -$ / 2, left: -$ / 2, cursor: "nesw-resize" },
4287
4288
  onPointerDown: (E) => M(E, "sw")
4288
4289
  }
4289
4290
  ),
4290
4291
  /* @__PURE__ */ S(
4291
4292
  "div",
4292
4293
  {
4293
- style: { ...z, top: -$ / 2, right: -$ / 2, cursor: "nesw-resize" },
4294
+ style: { ...k, top: -$ / 2, right: -$ / 2, cursor: "nesw-resize" },
4294
4295
  onPointerDown: (E) => M(E, "ne")
4295
4296
  }
4296
4297
  ),
4297
4298
  /* @__PURE__ */ S(
4298
4299
  "div",
4299
4300
  {
4300
- style: { ...z, top: -$ / 2, left: -$ / 2, cursor: "nwse-resize" },
4301
+ style: { ...k, top: -$ / 2, left: -$ / 2, cursor: "nwse-resize" },
4301
4302
  onPointerDown: (E) => M(E, "nw")
4302
4303
  }
4303
4304
  ),
4304
4305
  /* @__PURE__ */ S(
4305
4306
  "div",
4306
4307
  {
4307
- style: { ...z, top: "50%", right: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4308
+ style: { ...k, top: "50%", right: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4308
4309
  onPointerDown: (E) => M(E, "e")
4309
4310
  }
4310
4311
  ),
4311
4312
  /* @__PURE__ */ S(
4312
4313
  "div",
4313
4314
  {
4314
- style: { ...z, top: "50%", left: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4315
+ style: { ...k, top: "50%", left: -$ / 2, cursor: "ew-resize", transform: "translateY(-50%)" },
4315
4316
  onPointerDown: (E) => M(E, "w")
4316
4317
  }
4317
4318
  ),
4318
4319
  /* @__PURE__ */ S(
4319
4320
  "div",
4320
4321
  {
4321
- style: { ...z, left: "50%", top: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4322
+ style: { ...k, left: "50%", top: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4322
4323
  onPointerDown: (E) => M(E, "n")
4323
4324
  }
4324
4325
  ),
4325
4326
  /* @__PURE__ */ S(
4326
4327
  "div",
4327
4328
  {
4328
- style: { ...z, left: "50%", bottom: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4329
+ style: { ...k, left: "50%", bottom: -$ / 2, cursor: "ns-resize", transform: "translateX(-50%)" },
4329
4330
  onPointerDown: (E) => M(E, "s")
4330
4331
  }
4331
4332
  )
@@ -4515,7 +4516,7 @@ export {
4515
4516
  Wr as OutputNode,
4516
4517
  Vo as Panel,
4517
4518
  is as Position,
4518
- Hr as SelectionBox,
4519
+ Ar as SelectionBox,
4519
4520
  cr as SimpleBezierEdge,
4520
4521
  ar as SmoothStepEdge,
4521
4522
  Or as StepEdge,
@@ -4553,7 +4554,7 @@ export {
4553
4554
  Lo as routeSinglePath,
4554
4555
  En as routedPointsToPath,
4555
4556
  Pn as snapPosition,
4556
- Ao as useConnection,
4557
+ Ho as useConnection,
4557
4558
  Do as useEdges,
4558
4559
  So as useEdgesState,
4559
4560
  Xo as useHandleConnections,
@@ -4572,5 +4573,5 @@ export {
4572
4573
  Zo as useStore,
4573
4574
  Oo as useStoreApi,
4574
4575
  qo as useUpdateNodeInternals,
4575
- Ho as useViewport
4576
+ Ao as useViewport
4576
4577
  };