dishui 0.0.56 → 0.0.59

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.
Files changed (32) hide show
  1. package/dist/components/Select/index.js +90 -72
  2. package/dist/components/Select/index.js.map +1 -1
  3. package/dist/components/pro/Flow/Flow.js +659 -552
  4. package/dist/components/pro/Flow/Flow.js.map +1 -1
  5. package/dist/components/pro/Flow/FlowCanvas.js +1041 -966
  6. package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
  7. package/dist/components/pro/Flow/canvas/ViewportContainer.d.ts +6 -0
  8. package/dist/components/pro/Flow/canvas/ViewportContainer.js +20 -15
  9. package/dist/components/pro/Flow/canvas/ViewportContainer.js.map +1 -1
  10. package/dist/components/pro/Flow/context/FlowUIContext.d.ts +6 -2
  11. package/dist/components/pro/Flow/context/FlowUIContext.js +51 -51
  12. package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
  13. package/dist/components/pro/Flow/hooks/useCompactMode.d.ts +13 -0
  14. package/dist/components/pro/Flow/hooks/useCompactMode.js +20 -0
  15. package/dist/components/pro/Flow/hooks/useCompactMode.js.map +1 -0
  16. package/dist/components/pro/Flow/hooks/useDraggablePanel.d.ts +19 -4
  17. package/dist/components/pro/Flow/hooks/useDraggablePanel.js +31 -24
  18. package/dist/components/pro/Flow/hooks/useDraggablePanel.js.map +1 -1
  19. package/dist/components/pro/Flow/hooks/useMindMap.js +16 -22
  20. package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
  21. package/dist/components/pro/Flow/hooks/usePixiApp.js +16 -16
  22. package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
  23. package/dist/components/pro/Flow/nodes/nodeUtils.d.ts +2 -2
  24. package/dist/components/pro/Flow/nodes/nodeUtils.js +12 -12
  25. package/dist/components/pro/Flow/nodes/nodeUtils.js.map +1 -1
  26. package/dist/components/pro/Flow/panels/FlowPanelGroup.d.ts +10 -5
  27. package/dist/components/pro/Flow/panels/FlowPanelGroup.js +95 -67
  28. package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
  29. package/dist/dishui.css +1 -1
  30. package/dist/utils/i18n.js +10 -0
  31. package/dist/utils/i18n.js.map +1 -1
  32. package/package.json +1 -1
@@ -1,620 +1,576 @@
1
- import { useFlowContext as Be } from "./context/FlowContext.js";
2
- import { useFlowUI as Ke } from "./context/FlowUIContext.js";
3
- import { usePixiApp as je } from "./hooks/usePixiApp.js";
4
- import { useViewport as Ue } from "./hooks/useViewport.js";
5
- import { GridRenderer as $e } from "./canvas/GridRenderer.js";
6
- import { SelectionOverlay as Je } from "./canvas/SelectionOverlay.js";
7
- import { shapeDrawers as Ge } from "./nodes/shapes.js";
8
- import { findClosestHandleWorld as Et, getHandlePositions as gt, handleWorldPos as Zt } from "./nodes/NodeHandles.js";
9
- import { distToSegment as me, generateId as Qe, isPointInNode as Dt, rectsOverlap as tn } from "./nodes/nodeUtils.js";
10
- import { NodeRenderer as en } from "./nodes/NodeRenderer.js";
11
- import { buildEdgePath as Ze, linearizeSegments as qe, resolveEdgeEndpoints as Mt } from "./edges/edgePaths.js";
12
- import { EdgeRenderer as nn } from "./edges/EdgeRenderer.js";
13
- import { LineRenderer as rn } from "./lines/LineRenderer.js";
14
- import { FreehandTool as on } from "./lines/FreehandTool.js";
15
- import { GeometricLineTool as sn } from "./lines/GeometricLineTool.js";
16
- import { computeAlignmentSnap as ne } from "./hooks/useAlignmentGuides.js";
17
- import { AlignmentGuidesRenderer as cn } from "./canvas/AlignmentGuides.js";
18
- import { getDocumentSlides as dn, nextAnimIndex as an } from "./nodes/animAnchors.js";
19
- import { useCallback as qt, useEffect as wt, useRef as b, useState as We } from "react";
20
- import { jsx as Le, jsxs as ln } from "react/jsx-runtime";
21
- import { Graphics as Ot } from "pixi.js";
22
- var un = {
1
+ import { useFlowContext as ln } from "./context/FlowContext.js";
2
+ import { useFlowUI as un } from "./context/FlowUIContext.js";
3
+ import { usePixiApp as fn } from "./hooks/usePixiApp.js";
4
+ import { useViewport as hn } from "./hooks/useViewport.js";
5
+ import { GridRenderer as yn } from "./canvas/GridRenderer.js";
6
+ import { SelectionOverlay as pn } from "./canvas/SelectionOverlay.js";
7
+ import { shapeDrawers as je } from "./nodes/shapes.js";
8
+ import { findClosestHandleWorld as At, getHandlePositions as It, handleWorldPos as Wt } from "./nodes/NodeHandles.js";
9
+ import { distToSegment as Ne, generateId as xn, isPointInNode as Yt, rectsOverlap as gn } from "./nodes/nodeUtils.js";
10
+ import { NodeRenderer as wn } from "./nodes/NodeRenderer.js";
11
+ import { buildEdgePath as sn, linearizeSegments as cn, resolveEdgeEndpoints as Mt } from "./edges/edgePaths.js";
12
+ import { EdgeRenderer as mn } from "./edges/EdgeRenderer.js";
13
+ import { LineRenderer as vn } from "./lines/LineRenderer.js";
14
+ import { FreehandTool as In } from "./lines/FreehandTool.js";
15
+ import { GeometricLineTool as bn } from "./lines/GeometricLineTool.js";
16
+ import { computeAlignmentSnap as le } from "./hooks/useAlignmentGuides.js";
17
+ import { AlignmentGuidesRenderer as Mn } from "./canvas/AlignmentGuides.js";
18
+ import { getDocumentSlides as Rn, nextAnimIndex as Sn } from "./nodes/animAnchors.js";
19
+ import { useCallback as Jt, useEffect as bt, useRef as I, useState as $e } from "react";
20
+ import { jsx as Ce, jsxs as Je } from "react/jsx-runtime";
21
+ import { Graphics as Qt } from "pixi.js";
22
+ var zn = {
23
23
  nw: "nwse-resize",
24
24
  ne: "nesw-resize",
25
25
  se: "nwse-resize",
26
26
  sw: "nesw-resize"
27
- };
28
- function Ae(F, E, G) {
29
- const { x: Z, y: D } = E.position, W = E.width, k = E.height, z = [
27
+ }, ue = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches, Qe = ue ? 2 : 1;
28
+ function $(_, S, H) {
29
+ return Math.min(S * Qe / _, H * Qe);
30
+ }
31
+ function tn(_, S, H) {
32
+ const { x: V, y: E } = S.position, L = S.width, D = S.height, C = [
30
33
  [
31
34
  "nw",
32
- Z,
33
- D
35
+ V,
36
+ E
34
37
  ],
35
38
  [
36
39
  "ne",
37
- Z + W,
38
- D
40
+ V + L,
41
+ E
39
42
  ],
40
43
  [
41
44
  "se",
42
- Z + W,
43
- D + k
45
+ V + L,
46
+ E + D
44
47
  ],
45
48
  [
46
49
  "sw",
47
- Z,
48
- D + k
50
+ V,
51
+ E + D
49
52
  ]
50
53
  ];
51
- let M = null, _ = G;
52
- for (const [U, it, tt] of z) {
53
- const K = Math.hypot(F.x - it, F.y - tt);
54
- K < _ && (_ = K, M = U);
54
+ let M = null, q = H;
55
+ for (const [j, at, nt] of C) {
56
+ const K = Math.hypot(_.x - at, _.y - nt);
57
+ K < q && (q = K, M = j);
55
58
  }
56
59
  return M;
57
60
  }
58
- function Ye(F, E, G, Z, D) {
59
- let W = null, k = D;
60
- for (const z of G) {
61
- const M = Mt(z, Z);
61
+ function en(_, S, H, V, E) {
62
+ let L = null, D = E;
63
+ for (const C of H) {
64
+ const M = Mt(C, V);
62
65
  if (!M) continue;
63
- const _ = Math.hypot(F - M.sx, E - M.sy);
64
- _ < k && (k = _, W = {
65
- edgeId: z.id,
66
+ const q = Math.hypot(_ - M.sx, S - M.sy);
67
+ q < D && (D = q, L = {
68
+ edgeId: C.id,
66
69
  end: "source",
67
70
  worldX: M.sx,
68
71
  worldY: M.sy
69
72
  });
70
- const U = Math.hypot(F - M.tx, E - M.ty);
71
- U < k && (k = U, W = {
72
- edgeId: z.id,
73
+ const j = Math.hypot(_ - M.tx, S - M.ty);
74
+ j < D && (D = j, L = {
75
+ edgeId: C.id,
73
76
  end: "target",
74
77
  worldX: M.tx,
75
78
  worldY: M.ty
76
79
  });
77
80
  }
78
- return W;
81
+ return L;
79
82
  }
80
- function Xe(F, E, G, Z) {
81
- let D = null, W = Z;
82
- for (const k of G) {
83
- const z = k.data.waypoints;
84
- if (z)
85
- for (let M = 0; M < z.length; M++) {
86
- const _ = Math.hypot(F - z[M].x, E - z[M].y);
87
- _ < W && (W = _, D = {
88
- edgeId: k.id,
83
+ function nn(_, S, H, V) {
84
+ let E = null, L = V;
85
+ for (const D of H) {
86
+ const C = D.data.waypoints;
87
+ if (C)
88
+ for (let M = 0; M < C.length; M++) {
89
+ const q = Math.hypot(_ - C[M].x, S - C[M].y);
90
+ q < L && (L = q, E = {
91
+ edgeId: D.id,
89
92
  waypointIndex: M,
90
- wx: z[M].x,
91
- wy: z[M].y
93
+ wx: C[M].x,
94
+ wy: C[M].y
92
95
  });
93
96
  }
94
97
  }
95
- return D;
98
+ return E;
96
99
  }
97
- function Fe(F, E, G, Z, D) {
98
- let W = null, k = D;
99
- for (const z of G) {
100
- if (z.type !== "simplebezier") continue;
101
- const M = Mt(z, Z);
100
+ function rn(_, S, H, V, E) {
101
+ let L = null, D = E;
102
+ for (const C of H) {
103
+ if (C.type !== "simplebezier") continue;
104
+ const M = Mt(C, V);
102
105
  if (!M) continue;
103
- const _ = z.data.waypoints ?? [], U = [
106
+ const q = C.data.waypoints ?? [], j = [
104
107
  {
105
108
  x: M.sx,
106
109
  y: M.sy
107
110
  },
108
- ..._,
111
+ ...q,
109
112
  {
110
113
  x: M.tx,
111
114
  y: M.ty
112
115
  }
113
- ], it = z.data.bezierControls, tt = U.length - 2;
114
- for (let K = 0; K <= tt; K++) {
115
- const et = U[K], nt = U[K + 1], mt = it?.[K], Vt = Math.hypot(nt.x - et.x, nt.y - et.y), kt = Math.max(30, Vt * 0.3), Bt = mt?.c1x ?? (K === 0 ? et.x + M.snx * kt : et.x + (nt.x - et.x) * 0.4), Ht = mt?.c1y ?? (K === 0 ? et.y + M.sny * kt : et.y), Tt = mt?.c2x ?? (K === tt ? nt.x + M.tnx * kt : nt.x - (nt.x - et.x) * 0.4), Rt = mt?.c2y ?? (K === tt ? nt.y + M.tny * kt : nt.y), It = Math.hypot(F - Bt, E - Ht);
116
- It < k && (k = It, W = {
117
- edgeId: z.id,
116
+ ], at = C.data.bezierControls, nt = j.length - 2;
117
+ for (let K = 0; K <= nt; K++) {
118
+ const rt = j[K], ot = j[K + 1], Rt = at?.[K], Xt = Math.hypot(ot.x - rt.x, ot.y - rt.y), Tt = Math.max(30, Xt * 0.3), te = Rt?.c1x ?? (K === 0 ? rt.x + M.snx * Tt : rt.x + (ot.x - rt.x) * 0.4), _t = Rt?.c1y ?? (K === 0 ? rt.y + M.sny * Tt : rt.y), Ft = Rt?.c2x ?? (K === nt ? ot.x + M.tnx * Tt : ot.x - (ot.x - rt.x) * 0.4), St = Rt?.c2y ?? (K === nt ? ot.y + M.tny * Tt : ot.y), zt = Math.hypot(_ - te, S - _t);
119
+ zt < D && (D = zt, L = {
120
+ edgeId: C.id,
118
121
  segmentIndex: K,
119
122
  controlEnd: "c1",
120
- wx: Bt,
121
- wy: Ht
123
+ wx: te,
124
+ wy: _t
122
125
  });
123
- const yt = Math.hypot(F - Tt, E - Rt);
124
- yt < k && (k = yt, W = {
125
- edgeId: z.id,
126
+ const pt = Math.hypot(_ - Ft, S - St);
127
+ pt < D && (D = pt, L = {
128
+ edgeId: C.id,
126
129
  segmentIndex: K,
127
130
  controlEnd: "c2",
128
- wx: Tt,
129
- wy: Rt
131
+ wx: Ft,
132
+ wy: St
130
133
  });
131
134
  }
132
135
  }
133
- return W;
136
+ return L;
134
137
  }
135
- function fn(F, E, G, Z) {
136
- const D = Mt(G, Z);
137
- if (!D) return 0;
138
- const W = G.data.waypoints ?? [], k = [
138
+ function Cn(_, S, H, V) {
139
+ const E = Mt(H, V);
140
+ if (!E) return 0;
141
+ const L = H.data.waypoints ?? [], D = [
139
142
  {
140
- x: D.sx,
141
- y: D.sy
143
+ x: E.sx,
144
+ y: E.sy
142
145
  },
143
- ...W,
146
+ ...L,
144
147
  {
145
- x: D.tx,
146
- y: D.ty
148
+ x: E.tx,
149
+ y: E.ty
147
150
  }
148
151
  ];
149
- let z = 1 / 0, M = 0;
150
- for (let _ = 0; _ < k.length - 1; _++) {
151
- const U = me(F, E, k[_].x, k[_].y, k[_ + 1].x, k[_ + 1].y);
152
- U < z && (z = U, M = _);
152
+ let C = 1 / 0, M = 0;
153
+ for (let q = 0; q < D.length - 1; q++) {
154
+ const j = Ne(_, S, D[q].x, D[q].y, D[q + 1].x, D[q + 1].y);
155
+ j < C && (C = j, M = q);
153
156
  }
154
157
  return M;
155
158
  }
156
- function hn(F, E, G, Z, D = 24) {
157
- let { x: W, y: k, w: z, h: M } = { ...F };
158
- const _ = E === "nw" || E === "sw", U = E === "ne" || E === "se", it = E === "nw" || E === "ne", tt = E === "sw" || E === "se";
159
- return _ && (W += G, z -= G), U && (z += G), it && (k += Z, M -= Z), tt && (M += Z), z < D && (_ && (W = F.x + F.w - D), z = D), M < D && (it && (k = F.y + F.h - D), M = D), {
160
- x: W,
161
- y: k,
162
- w: z,
159
+ function En(_, S, H, V, E = 24) {
160
+ let { x: L, y: D, w: C, h: M } = { ..._ };
161
+ const q = S === "nw" || S === "sw", j = S === "ne" || S === "se", at = S === "nw" || S === "ne", nt = S === "sw" || S === "se";
162
+ return q && (L += H, C -= H), j && (C += H), at && (D += V, M -= V), nt && (M += V), C < E && (q && (L = _.x + _.w - E), C = E), M < E && (at && (D = _.y + _.h - E), M = E), {
163
+ x: L,
164
+ y: D,
165
+ w: C,
163
166
  h: M
164
167
  };
165
168
  }
166
- function we(F, E, G, Z, D) {
167
- const W = Mt(G, Z);
168
- if (!W) return !1;
169
- const k = qe(Ze(G.type, W, G.data.waypoints, G.data.bezierControls));
170
- for (let z = 0; z < k.length - 1; z++) if (me(F, E, k[z].x, k[z].y, k[z + 1].x, k[z + 1].y) < D) return !0;
169
+ function Ee(_, S, H, V, E) {
170
+ const L = Mt(H, V);
171
+ if (!L) return !1;
172
+ const D = cn(sn(H.type, L, H.data.waypoints, H.data.bezierControls));
173
+ for (let C = 0; C < D.length - 1; C++) if (Ne(_, S, D[C].x, D[C].y, D[C + 1].x, D[C + 1].y) < E) return !0;
171
174
  return !1;
172
175
  }
173
- function _e(F, E, G, Z) {
174
- const D = G.points;
175
- for (let W = 0; W < D.length - 1; W++) if (me(F, E, D[W].x, D[W].y, D[W + 1].x, D[W + 1].y) < Z) return !0;
176
+ function on(_, S, H, V) {
177
+ const E = H.points;
178
+ for (let L = 0; L < E.length - 1; L++) if (Ne(_, S, E[L].x, E[L].y, E[L + 1].x, E[L + 1].y) < V) return !0;
176
179
  return !1;
177
180
  }
178
- function Wn({ onPixiReady: F }) {
179
- const E = b(null), G = b(null), Z = b(13751771), { pixiRef: D, readyRef: W } = je(E, qt((l) => {
180
- Z.current = l.gridDot, G.current && (G.current.dotColor = l.gridDot);
181
- }, [])), { setViewportInternal: k, viewportReqRef: z, viewport: M, autoFocus: _, showGrid: U, showAnchors: it, gridSize: tt, toolMode: K, edgeType: et, focusOnRect: nt, setFocusOnRect: mt, pendingPlacement: Vt, setPendingPlacement: kt, setContextMenu: Bt, beginNodeDrag: Ht, endNodeDrag: Tt, presentation: Rt, editingNodeId: It, setEditingNodeId: yt } = Ke(), { currentCanvas: re, selection: Ie, setSelection: lt, setDoc: J, currentCanvasId: oe, pushCanvas: Oe, doc: ve } = Be(), St = b(null), Kt = b(null), jt = b(null), Ut = b(null), se = b(null), ce = b(null), $t = b(null), Pt = b(null), Gt = b(null), Jt = b(null), zt = b([]), ie = b(null), de = b(null), ut = b(null), Wt = b(null), be = b({
181
+ function $n({ onPixiReady: _ }) {
182
+ const S = I(null), H = I(null), V = I(13751771), { pixiRef: E, readyRef: L } = fn(S, Jt((l) => {
183
+ V.current = l.gridDot, H.current && (H.current.dotColor = l.gridDot);
184
+ }, [])), { setViewportInternal: D, viewportReqRef: C, viewport: M, autoFocus: q, showGrid: j, showAnchors: at, gridSize: nt, toolMode: K, edgeType: rt, focusOnRect: ot, setFocusOnRect: Rt, pendingPlacement: Xt, setPendingPlacement: Tt, setContextMenu: te, beginNodeDrag: _t, endNodeDrag: Ft, presentation: St, editingNodeId: zt, setEditingNodeId: pt } = un(), { currentCanvas: fe, selection: Te, setSelection: ht, setDoc: J, currentCanvasId: he, pushCanvas: dn, doc: De } = ln(), Ct = I(null), ee = I(null), ne = I(null), re = I(null), ye = I(null), pe = I(null), oe = I(null), Ot = I(null), qt = I(null), se = I(null), Dt = I([]), xe = I(null), ge = I(null), lt = I(null), Zt = I(null), ke = I({
182
185
  time: 0,
183
186
  wx: 0,
184
187
  wy: 0
185
- }), Lt = b({
188
+ }), kt = I({
186
189
  time: 0,
187
190
  wx: 0,
188
191
  wy: 0
189
- }), At = b(null), Me = b({
192
+ }), He = I(0), Vt = I(null), Pe = I({
190
193
  x: 0,
191
194
  y: 0
192
- }), Re = it || Rt ? re : {
193
- ...re,
194
- nodes: re.nodes.filter((l) => l.type !== "animAnchor")
195
- }, A = b(Re);
196
- A.current = Re;
197
- const V = b(oe);
198
- V.current = oe;
199
- const Yt = b(Ie);
200
- Yt.current = Ie;
201
- const Se = b(ve);
202
- Se.current = ve;
203
- const Xt = b(K);
204
- Xt.current = K;
205
- const Ft = b(_);
206
- Ft.current = _;
207
- const _t = b(nt);
208
- _t.current = nt;
209
- const ze = b(et);
210
- ze.current = et;
211
- const Ce = b(it);
212
- Ce.current = it;
213
- const Ct = b(Rt);
214
- Ct.current = Rt;
215
- const ae = b(Vt);
216
- ae.current = Vt;
217
- const Ne = b(Ht);
218
- Ne.current = Ht;
219
- const le = b(Tt);
220
- le.current = Tt;
221
- const ft = b(null), rt = b(null), ot = b(null), dt = b(null), xt = b(null), pt = b(null), vt = b(null), ue = b(M), fe = b(0), { vmRef: $, screenToWorld: Ee } = Ue(D, qt((l) => {
222
- ue.current = l, fe.current || (fe.current = requestAnimationFrame(() => {
223
- fe.current = 0, k(ue.current);
195
+ }), Le = at || St ? fe : {
196
+ ...fe,
197
+ nodes: fe.nodes.filter((l) => l.type !== "animAnchor")
198
+ }, W = I(Le);
199
+ W.current = Le;
200
+ const B = I(he);
201
+ B.current = he;
202
+ const Bt = I(Te);
203
+ Bt.current = Te;
204
+ const Ge = I(De);
205
+ Ge.current = De;
206
+ const Kt = I(K);
207
+ Kt.current = K;
208
+ const Ut = I(q);
209
+ Ut.current = q;
210
+ const jt = I(ot);
211
+ jt.current = ot;
212
+ const Ae = I(rt);
213
+ Ae.current = rt;
214
+ const We = I(at);
215
+ We.current = at;
216
+ const Ht = I(St);
217
+ Ht.current = St;
218
+ const ce = I(Xt);
219
+ ce.current = Xt;
220
+ const Ye = I(_t);
221
+ Ye.current = _t;
222
+ const ie = I(Ft);
223
+ ie.current = Ft;
224
+ const st = I(null), Q = I(null), tt = I(null), ct = I(null), xt = I(null), yt = I(null), gt = I(null), we = I(M), me = I(0), { vmRef: F, screenToWorld: Xe } = hn(E, Jt((l) => {
225
+ we.current = l, me.current || (me.current = requestAnimationFrame(() => {
226
+ me.current = 0, D(we.current);
224
227
  }));
225
- }, [k])), st = b(Ee);
226
- st.current = Ee;
227
- const [at, he] = We(null), [ye, xe] = We(null), pe = b(at);
228
- pe.current = at;
229
- const Qt = b(() => {
228
+ }, [D])), it = I(Xe);
229
+ it.current = Xe;
230
+ const [ut, ve] = $e(null), [Ie, be] = $e(null), Me = I(ut);
231
+ Me.current = ut;
232
+ const de = I(() => {
230
233
  });
231
- Qt.current = (l, T, Y) => {
232
- yt(l === "node" ? T : null), he({
234
+ de.current = (l, P, X) => {
235
+ pt(l === "node" ? P : null), ve({
233
236
  kind: l,
234
- id: T,
235
- value: Y
237
+ id: P,
238
+ value: X
236
239
  });
237
240
  };
238
- const De = qt((l) => {
239
- const T = pe.current;
240
- T && (J((Y) => {
241
- const L = V.current, q = Y.canvases[L];
242
- if (!q) return Y;
243
- let X = q;
244
- if (T.kind === "node") X = {
245
- ...q,
246
- nodes: q.nodes.map((B) => B.id === T.id ? {
247
- ...B,
241
+ const _e = Jt((l) => {
242
+ const P = Me.current;
243
+ P && (J((X) => {
244
+ const A = B.current, Z = X.canvases[A];
245
+ if (!Z) return X;
246
+ let O = Z;
247
+ if (P.kind === "node") O = {
248
+ ...Z,
249
+ nodes: Z.nodes.map((Y) => Y.id === P.id ? {
250
+ ...Y,
248
251
  data: {
249
- ...B.data,
252
+ ...Y.data,
250
253
  label: l
251
254
  }
252
- } : B)
255
+ } : Y)
253
256
  };
254
- else if (T.kind === "edge") X = {
255
- ...q,
256
- edges: q.edges.map((B) => B.id === T.id ? {
257
- ...B,
257
+ else if (P.kind === "edge") O = {
258
+ ...Z,
259
+ edges: Z.edges.map((Y) => Y.id === P.id ? {
260
+ ...Y,
258
261
  data: {
259
- ...B.data,
262
+ ...Y.data,
260
263
  labelText: l
261
264
  }
262
- } : B)
265
+ } : Y)
263
266
  };
264
- else return Y;
267
+ else return X;
265
268
  return {
266
- ...Y,
269
+ ...X,
267
270
  canvases: {
268
- ...Y.canvases,
269
- [L]: X
271
+ ...X.canvases,
272
+ [A]: O
270
273
  }
271
274
  };
272
- }), he(null), yt(null), xe(null));
273
- }, [J, yt]), Ve = qt(() => {
274
- he(null), yt(null), xe(null);
275
- }, [yt]);
276
- wt(() => {
277
- if (!It || pe.current?.id === It) return;
278
- const l = A.current.nodes.find((T) => T.id === It);
279
- l && Qt.current("node", l.id, l.data.label);
280
- }, [It]), wt(() => {
281
- if (!at) return;
282
- const l = $.current;
275
+ }), ve(null), pt(null), be(null));
276
+ }, [J, pt]), an = Jt(() => {
277
+ ve(null), pt(null), be(null);
278
+ }, [pt]);
279
+ bt(() => {
280
+ if (!zt || Me.current?.id === zt) return;
281
+ const l = W.current.nodes.find((P) => P.id === zt);
282
+ l && de.current("node", l.id, l.data.label);
283
+ }, [zt]), bt(() => {
284
+ if (!ut) return;
285
+ const l = F.current;
283
286
  if (!l) return;
284
- const T = A.current;
285
- let Y = null;
286
- if (at.kind === "node") {
287
- const L = T.nodes.find((q) => q.id === at.id);
288
- L && (Y = {
289
- x: L.position.x + L.width / 2,
290
- y: L.position.y + L.height / 2
287
+ const P = W.current;
288
+ let X = null;
289
+ if (ut.kind === "node") {
290
+ const A = P.nodes.find((Z) => Z.id === ut.id);
291
+ A && (X = {
292
+ x: A.position.x + A.width / 2,
293
+ y: A.position.y + A.height / 2
291
294
  });
292
- } else if (at.kind === "edge") {
293
- const L = T.edges.find((X) => X.id === at.id), q = /* @__PURE__ */ new Map();
294
- for (const X of T.nodes) q.set(X.id, X);
295
- if (L) {
296
- const X = Mt(L, q);
297
- if (X) {
298
- const B = qe(Ze(L.type, X, L.data.waypoints, L.data.bezierControls)), Q = B[Math.floor(B.length / 2)] ?? {
299
- x: (X.sx + X.tx) / 2,
300
- y: (X.sy + X.ty) / 2
295
+ } else if (ut.kind === "edge") {
296
+ const A = P.edges.find((O) => O.id === ut.id), Z = /* @__PURE__ */ new Map();
297
+ for (const O of P.nodes) Z.set(O.id, O);
298
+ if (A) {
299
+ const O = Mt(A, Z);
300
+ if (O) {
301
+ const Y = cn(sn(A.type, O, A.data.waypoints, A.data.bezierControls)), dt = Y[Math.floor(Y.length / 2)] ?? {
302
+ x: (O.sx + O.tx) / 2,
303
+ y: (O.sy + O.ty) / 2
301
304
  };
302
- Y = {
303
- x: Q.x,
304
- y: Q.y
305
+ X = {
306
+ x: dt.x,
307
+ y: dt.y
305
308
  };
306
309
  }
307
310
  }
308
311
  }
309
- if (Y) {
310
- const L = l.worldToScreen(Y.x, Y.y);
311
- xe({
312
- x: L.x,
313
- y: L.y
312
+ if (X) {
313
+ const A = l.worldToScreen(X.x, X.y);
314
+ be({
315
+ x: A.x,
316
+ y: A.y
314
317
  });
315
318
  }
316
- }, [at, $]);
317
- const ke = b(0);
318
- wt(() => {
319
- z.current !== ke.current && (ke.current = z.current, ue.current = M, $.current?.setState(M));
319
+ }, [ut, F]);
320
+ const Fe = I(0);
321
+ bt(() => {
322
+ C.current !== Fe.current && (Fe.current = C.current, we.current = M, F.current?.setState(M));
320
323
  }, [
321
324
  M,
322
- $,
323
- z
324
- ]), wt(() => {
325
- mt((l, T, Y, L, q) => {
326
- const X = $.current, B = E.current;
327
- if (!X || !B) return;
328
- const Q = B.clientWidth || 800, ct = B.clientHeight || 600, bt = Math.max(0, q?.padding ?? 60), te = Math.max(1, Q - bt * 2), m = Math.max(1, ct - bt * 2), s = q?.preserveZoom ? X.state.zoom : Math.min(te / Math.max(Y, 1), m / Math.max(L, 1), q?.maxZoom ?? 2), u = l + Y / 2, v = T + L / 2, P = Q / 2 - u * s, N = ct / 2 - v * s;
329
- X.animateTo({
330
- x: P,
331
- y: N,
332
- zoom: s
333
- }, q?.duration ?? 350);
325
+ F,
326
+ C
327
+ ]), bt(() => {
328
+ Rt((l, P, X, A, Z) => {
329
+ const O = F.current, Y = S.current;
330
+ if (!O || !Y) return;
331
+ const dt = Y.clientWidth || 800, wt = Y.clientHeight || 600, mt = Math.max(0, Z?.padding ?? 60), Pt = Math.max(1, dt - mt * 2), vt = Math.max(1, wt - mt * 2), Et = Z?.preserveZoom ? O.state.zoom : Math.min(Pt / Math.max(X, 1), vt / Math.max(A, 1), Z?.maxZoom ?? 2), Nt = l + X / 2, ft = P + A / 2, $t = dt / 2 - Nt * Et, Se = wt / 2 - ft * Et;
332
+ O.animateTo({
333
+ x: $t,
334
+ y: Se,
335
+ zoom: Et
336
+ }, Z?.duration ?? 350);
334
337
  });
335
- }, [mt, $]);
336
- const He = qt((l) => {
337
- J((T) => {
338
- const Y = T.canvases[V.current];
339
- return Y ? {
340
- ...T,
338
+ }, [Rt, F]);
339
+ const Oe = Jt((l) => {
340
+ J((P) => {
341
+ const X = P.canvases[B.current];
342
+ return X ? {
343
+ ...P,
341
344
  canvases: {
342
- ...T.canvases,
343
- [V.current]: {
344
- ...Y,
345
- lines: [...Y.lines, l]
345
+ ...P.canvases,
346
+ [B.current]: {
347
+ ...X,
348
+ lines: [...X.lines, l]
346
349
  }
347
350
  }
348
- } : T;
351
+ } : P;
349
352
  });
350
- }, [J, oe]), ge = b(He);
351
- return ge.current = He, wt(() => {
352
- const l = D.current;
353
+ }, [J, he]), Re = I(Oe);
354
+ return Re.current = Oe, bt(() => {
355
+ const l = E.current;
353
356
  if (!l || l.destroyed) return;
354
- let T = !1;
355
- const Y = () => {
356
- if (T) return;
357
- if (!W.current) {
358
- setTimeout(Y, 30);
357
+ let P = !1, X = null, A = null, Z = null;
358
+ const O = () => {
359
+ if (P) return;
360
+ if (!L.current) {
361
+ setTimeout(O, 30);
359
362
  return;
360
363
  }
361
- G.current = new $e(l.app.stage, tt, U), G.current.dotColor = Z.current, St.current = new Je(l.app.stage), Kt.current = new en(l.world), jt.current = new nn(l.world), Ut.current = new rn(l.world);
362
- const L = new Ot();
363
- L.label = "connect-line", L.visible = !1, l.world.addChild(L), xt.current = L;
364
- const q = new Ot();
365
- q.label = "transform-handles", l.app.stage.addChild(q), Pt.current = q;
366
- const X = new Ot();
367
- X.label = "handle-hover", l.world.addChild(X), Gt.current = X;
368
- const B = new Ot();
369
- B.label = "edge-edit-handles", l.world.addChild(B), Wt.current = B;
370
- const Q = new Ot();
371
- Q.label = "ghost-placement", Q.alpha = 0.5, l.world.addChild(Q), At.current = Q, Jt.current = new cn(l.world), se.current = new on(l.app.stage, l.world, {
372
- onLineComplete: (m) => ge.current(m),
373
- screenToWorld: (m, s) => st.current(m, s)
374
- }), ce.current = new sn(l.app.stage, l.world, {
375
- onLineComplete: (m) => ge.current(m),
376
- screenToWorld: (m, s) => st.current(m, s)
377
- }), F?.(l);
378
- const ct = l.app.stage;
379
- ct.on("pointerdown", (m) => {
380
- if (E.current?.focus({ preventScroll: !0 }), $.current?.isPanning || $.current?.isSpaceHeld || m.button !== 0) return;
381
- const s = Xt.current;
382
- if (s === "pan") {
383
- $.current?.startPan(m.global.x, m.global.y);
384
- return;
385
- }
386
- if (s === "freehand" || s === "line" || s === "polyline" || s === "arrow") return;
387
- const u = st.current(m.global.x, m.global.y), v = A.current.nodes, P = A.current.edges, N = A.current.lines, I = Yt.current, S = m.metaKey || m.ctrlKey || m.shiftKey, O = $.current?.state.zoom ?? 1, e = ae.current;
388
- if (e) {
389
- const t = Qe("node"), i = u.x - e.width / 2, n = u.y - e.height / 2, o = ne([{
390
- id: "__ghost__",
391
- type: e.type,
392
- position: {
393
- x: i,
394
- y: n
395
- },
396
- width: e.width,
397
- height: e.height,
398
- data: {}
399
- }], v), r = i + o.dx, d = n + o.dy;
400
- J((w) => {
401
- const g = w.canvases[V.current];
402
- if (!g) return w;
403
- const C = {};
404
- e.type === "animAnchor" && (C.animIndex = an(w));
405
- const H = Math.max(0, ...g.nodes.map((h) => h.zIndex ?? 0), ...g.lines.map((h) => h.zIndex ?? 0));
406
- return {
407
- ...w,
408
- canvases: {
409
- ...w.canvases,
410
- [V.current]: {
411
- ...g,
412
- nodes: [...g.nodes, {
413
- id: t,
414
- type: e.type,
415
- position: {
416
- x: r,
417
- y: d
418
- },
419
- width: e.width,
420
- height: e.height,
421
- zIndex: H + 1,
422
- data: {
423
- ...e.data,
424
- ...C
425
- }
426
- }]
427
- }
428
- }
429
- };
430
- }), lt({
431
- nodeIds: /* @__PURE__ */ new Set([t]),
432
- edgeIds: /* @__PURE__ */ new Set(),
433
- lineIds: /* @__PURE__ */ new Set()
434
- }), Ft.current && window.setTimeout(() => {
435
- _t.current(r, d, e.width, e.height, {
436
- padding: 80,
437
- preserveZoom: !0,
438
- duration: 280
439
- });
440
- }, 0);
364
+ H.current = new yn(l.app.stage, nt, j), H.current.dotColor = V.current, Ct.current = new pn(l.app.stage), ee.current = new wn(l.world), ne.current = new mn(l.world), re.current = new vn(l.world);
365
+ const Y = new Qt();
366
+ Y.label = "connect-line", Y.visible = !1, l.world.addChild(Y), xt.current = Y;
367
+ const dt = new Qt();
368
+ dt.label = "transform-handles", l.app.stage.addChild(dt), Ot.current = dt;
369
+ const wt = new Qt();
370
+ wt.label = "handle-hover", l.world.addChild(wt), qt.current = wt;
371
+ const mt = new Qt();
372
+ mt.label = "edge-edit-handles", l.world.addChild(mt), Zt.current = mt;
373
+ const Pt = new Qt();
374
+ Pt.label = "ghost-placement", Pt.alpha = 0.5, l.world.addChild(Pt), Vt.current = Pt, se.current = new Mn(l.world), ye.current = new In(l.app.stage, l.world, {
375
+ onLineComplete: (f) => Re.current(f),
376
+ screenToWorld: (f, o) => it.current(f, o)
377
+ }), pe.current = new bn(l.app.stage, l.world, {
378
+ onLineComplete: (f) => Re.current(f),
379
+ screenToWorld: (f, o) => it.current(f, o)
380
+ }), _?.(l);
381
+ const vt = l.app.stage;
382
+ vt.on("pointerdown", (f) => {
383
+ if (S.current?.focus({ preventScroll: !0 }), F.current?.multiTouchActive || F.current?.isPanning || F.current?.isSpaceHeld || f.button !== 0) return;
384
+ const o = Kt.current;
385
+ if (o === "pan") {
386
+ F.current?.startPan(f.global.x, f.global.y);
441
387
  return;
442
388
  }
443
- const c = Date.now(), y = be.current, f = c - y.time < 350 && Math.hypot(u.x - y.wx, u.y - y.wy) < 8 / O;
444
- if (be.current = {
389
+ if (o === "freehand" || o === "line" || o === "polyline" || o === "arrow") return;
390
+ const i = it.current(f.global.x, f.global.y), p = W.current.nodes, N = W.current.edges, k = W.current.lines, z = Bt.current, b = f.metaKey || f.ctrlKey || f.shiftKey, T = F.current?.state.zoom ?? 1;
391
+ if (ce.current) return;
392
+ const c = Date.now(), h = ke.current, u = c - h.time < 350 && Math.hypot(i.x - h.wx, i.y - h.wy) < 8 / T;
393
+ if (ke.current = {
445
394
  time: c,
446
- wx: u.x,
447
- wy: u.y
448
- }, I.nodeIds.size === 1 && !S && s === "select") {
449
- const t = v.find((i) => i.id === [...I.nodeIds][0]);
395
+ wx: i.x,
396
+ wy: i.y
397
+ }, z.nodeIds.size === 1 && !b && o === "select") {
398
+ const t = p.find((r) => r.id === [...z.nodeIds][0]);
450
399
  if (t) {
451
- const i = Ae(u, t, Math.min(10 / O, 16));
452
- if (i) {
453
- const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), r = t.type === "geometryGroup", d = r || t.type === "flowGroup" || t.data.isGroup, w = t.position.x, g = t.position.y, C = t.width, H = t.height;
454
- for (const h of v)
455
- h.id !== t.id && (h.parentId === t.id ? n.set(h.id, {
456
- x: h.position.x,
457
- y: h.position.y,
458
- w: h.width,
459
- h: h.height
460
- }) : r && h.position.x >= w && h.position.y >= g && h.position.x + h.width <= w + C && h.position.y + h.height <= g + H && n.set(h.id, {
461
- x: h.position.x,
462
- y: h.position.y,
463
- w: h.width,
464
- h: h.height
400
+ const r = tn(i, t, $(T, 10, 16));
401
+ if (r) {
402
+ const d = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), e = t.type === "geometryGroup", s = e || t.type === "flowGroup" || t.data.isGroup, w = t.position.x, m = t.position.y, R = t.width, G = t.height;
403
+ for (const y of p)
404
+ y.id !== t.id && (y.parentId === t.id ? d.set(y.id, {
405
+ x: y.position.x,
406
+ y: y.position.y,
407
+ w: y.width,
408
+ h: y.height
409
+ }) : e && y.position.x >= w && y.position.y >= m && y.position.x + y.width <= w + R && y.position.y + y.height <= m + G && d.set(y.id, {
410
+ x: y.position.x,
411
+ y: y.position.y,
412
+ w: y.width,
413
+ h: y.height
465
414
  }));
466
- if (d)
467
- for (const h of A.current.lines) h.parentId === t.id ? o.set(h.id, h.points.map((R) => ({ ...R }))) : r && h.points.length > 0 && h.points.every((R) => R.x >= w && R.x <= w + C && R.y >= g && R.y <= g + H) && o.set(h.id, h.points.map((R) => ({ ...R })));
468
- pt.current = {
415
+ if (s)
416
+ for (const y of W.current.lines) y.parentId === t.id ? a.set(y.id, y.points.map((v) => ({ ...v }))) : e && y.points.length > 0 && y.points.every((v) => v.x >= w && v.x <= w + R && v.y >= m && v.y <= m + G) && a.set(y.id, y.points.map((v) => ({ ...v })));
417
+ yt.current = {
469
418
  active: !0,
470
419
  nodeId: t.id,
471
- handle: i,
472
- startWorld: u,
420
+ handle: r,
421
+ startWorld: i,
473
422
  startBounds: {
474
423
  x: t.position.x,
475
424
  y: t.position.y,
476
425
  w: t.width,
477
426
  h: t.height
478
427
  },
479
- childStarts: n,
480
- childLineStarts: o.size > 0 ? o : void 0
428
+ childStarts: d,
429
+ childLineStarts: a.size > 0 ? a : void 0
481
430
  };
482
431
  return;
483
432
  }
484
433
  }
485
434
  }
486
- let x = null;
487
- for (let t = v.length - 1; t >= 0; t--) if (Dt(u.x, u.y, v[t])) {
488
- x = v[t];
435
+ let n = null;
436
+ for (let t = p.length - 1; t >= 0; t--) if (Yt(i.x, i.y, p[t])) {
437
+ n = p[t];
489
438
  break;
490
439
  }
491
- if (x?.parentId) {
492
- const t = v.find((i) => i.id === x.parentId);
493
- t && (x = t);
440
+ if (n?.parentId) {
441
+ const t = p.find((r) => r.id === n.parentId);
442
+ t && (n = t);
494
443
  }
495
- if (x && (s === "select" || s === "connect")) {
496
- const t = Et(gt(x.width, x.height), x, u.x, u.y, Math.min(14 / O, 20));
497
- if (t) {
498
- ot.current = {
444
+ if ((o === "select" || o === "connect") && (n || ue)) {
445
+ const t = n ? [n] : p, r = $(T, 14, 20);
446
+ let d = null, a = null, e = 1 / 0;
447
+ for (const s of t) {
448
+ const w = At(It(s.width, s.height), s, i.x, i.y, r);
449
+ if (!w) continue;
450
+ const m = Wt(w, s), R = Math.hypot(i.x - m.x, i.y - m.y);
451
+ R < e && (e = R, d = s, a = w);
452
+ }
453
+ if (d && a) {
454
+ tt.current = {
499
455
  active: !0,
500
- sourceNodeId: x.id,
501
- sourceHandleId: t.id
456
+ sourceNodeId: d.id,
457
+ sourceHandleId: a.id
502
458
  };
503
459
  return;
504
460
  }
505
461
  }
506
- if ((s === "select" || s === "connect") && !S && I.edgeIds.size > 0) {
462
+ if ((o === "select" || o === "connect") && !b && z.edgeIds.size > 0) {
507
463
  const t = /* @__PURE__ */ new Map();
508
- for (const o of v) t.set(o.id, o);
509
- const i = P.filter((o) => I.edgeIds.has(o.id)), n = Ye(u.x, u.y, i, t, Math.min(14 / O, 20));
510
- if (n) {
511
- const o = P.find((r) => r.id === n.edgeId);
512
- if (o) {
513
- const r = n.end === "source" ? "target" : "source";
514
- dt.current = {
464
+ for (const a of p) t.set(a.id, a);
465
+ const r = N.filter((a) => z.edgeIds.has(a.id)), d = en(i.x, i.y, r, t, $(T, 14, 20));
466
+ if (d) {
467
+ const a = N.find((e) => e.id === d.edgeId);
468
+ if (a) {
469
+ const e = d.end === "source" ? "target" : "source";
470
+ ct.current = {
515
471
  active: !0,
516
- edgeId: o.id,
517
- movingEnd: n.end,
518
- fixedNodeId: r === "source" ? o.source : o.target,
519
- fixedHandleId: r === "source" ? o.sourceHandle : o.targetHandle
472
+ edgeId: a.id,
473
+ movingEnd: d.end,
474
+ fixedNodeId: e === "source" ? a.source : a.target,
475
+ fixedHandleId: e === "source" ? a.sourceHandle : a.targetHandle
520
476
  };
521
477
  return;
522
478
  }
523
479
  }
524
480
  }
525
- if (s === "select" && I.edgeIds.size > 0 && !x) {
481
+ if (o === "select" && z.edgeIds.size > 0 && !n) {
526
482
  const t = /* @__PURE__ */ new Map();
527
- for (const d of v) t.set(d.id, d);
528
- const i = P.filter((d) => I.edgeIds.has(d.id)), n = Math.min(10 / O, 14), o = Fe(u.x, u.y, i, t, n);
529
- if (o) {
530
- ut.current = {
483
+ for (const s of p) t.set(s.id, s);
484
+ const r = N.filter((s) => z.edgeIds.has(s.id)), d = $(T, 10, 14), a = rn(i.x, i.y, r, t, d);
485
+ if (a) {
486
+ lt.current = {
531
487
  active: !0,
532
- edgeId: o.edgeId,
533
- type: o.controlEnd === "c1" ? "bezierC1" : "bezierC2",
534
- index: o.segmentIndex
488
+ edgeId: a.edgeId,
489
+ type: a.controlEnd === "c1" ? "bezierC1" : "bezierC2",
490
+ index: a.segmentIndex
535
491
  };
536
492
  return;
537
493
  }
538
- const r = Xe(u.x, u.y, i, n);
539
- if (r) {
540
- if (f) {
541
- J((d) => {
542
- const w = d.canvases[V.current];
494
+ const e = nn(i.x, i.y, r, d);
495
+ if (e) {
496
+ if (u) {
497
+ J((s) => {
498
+ const w = s.canvases[B.current];
543
499
  return w ? {
544
- ...d,
500
+ ...s,
545
501
  canvases: {
546
- ...d.canvases,
547
- [V.current]: {
502
+ ...s.canvases,
503
+ [B.current]: {
548
504
  ...w,
549
- edges: w.edges.map((g) => {
550
- if (g.id !== r.edgeId) return g;
551
- const C = [...g.data.waypoints ?? []];
552
- C.splice(r.waypointIndex, 1);
553
- const H = {
554
- ...g.data,
555
- waypoints: C.length > 0 ? C : void 0
505
+ edges: w.edges.map((m) => {
506
+ if (m.id !== e.edgeId) return m;
507
+ const R = [...m.data.waypoints ?? []];
508
+ R.splice(e.waypointIndex, 1);
509
+ const G = {
510
+ ...m.data,
511
+ waypoints: R.length > 0 ? R : void 0
556
512
  };
557
- if (g.type === "simplebezier" && g.data.bezierControls) {
558
- const h = [...g.data.bezierControls];
559
- h.splice(r.waypointIndex, 2, null), H.bezierControls = h.some((R) => R !== null) ? h : void 0;
513
+ if (m.type === "simplebezier" && m.data.bezierControls) {
514
+ const y = [...m.data.bezierControls];
515
+ y.splice(e.waypointIndex, 2, null), G.bezierControls = y.some((v) => v !== null) ? y : void 0;
560
516
  }
561
517
  return {
562
- ...g,
563
- data: H
518
+ ...m,
519
+ data: G
564
520
  };
565
521
  })
566
522
  }
567
523
  }
568
- } : d;
524
+ } : s;
569
525
  });
570
526
  return;
571
527
  }
572
- ut.current = {
528
+ lt.current = {
573
529
  active: !0,
574
- edgeId: r.edgeId,
530
+ edgeId: e.edgeId,
575
531
  type: "waypoint",
576
- index: r.waypointIndex
532
+ index: e.waypointIndex
577
533
  };
578
534
  return;
579
535
  }
580
- if (f) {
581
- for (const d of i) if (we(u.x, u.y, d, t, Math.min(8 / O, 12))) {
582
- const w = fn(u.x, u.y, d, t), g = {
583
- x: u.x,
584
- y: u.y
536
+ if (u) {
537
+ for (const s of r) if (Ee(i.x, i.y, s, t, $(T, 8, 12))) {
538
+ const w = Cn(i.x, i.y, s, t), m = {
539
+ x: i.x,
540
+ y: i.y
585
541
  };
586
- J((C) => {
587
- const H = C.canvases[V.current];
588
- return H ? {
589
- ...C,
542
+ J((R) => {
543
+ const G = R.canvases[B.current];
544
+ return G ? {
545
+ ...R,
590
546
  canvases: {
591
- ...C.canvases,
592
- [V.current]: {
593
- ...H,
594
- edges: H.edges.map((h) => {
595
- if (h.id !== d.id) return h;
596
- const R = [...h.data.waypoints ?? []];
597
- R.splice(w, 0, g);
598
- const j = {
599
- ...h.data,
600
- waypoints: R
547
+ ...R.canvases,
548
+ [B.current]: {
549
+ ...G,
550
+ edges: G.edges.map((y) => {
551
+ if (y.id !== s.id) return y;
552
+ const v = [...y.data.waypoints ?? []];
553
+ v.splice(w, 0, m);
554
+ const U = {
555
+ ...y.data,
556
+ waypoints: v
601
557
  };
602
- if (h.type === "simplebezier" && h.data.bezierControls) {
603
- const ht = [...h.data.bezierControls];
604
- for (; ht.length < (h.data.waypoints ?? []).length + 1; ) ht.push(null);
605
- ht.splice(w, 1, null, null), j.bezierControls = ht;
558
+ if (y.type === "simplebezier" && y.data.bezierControls) {
559
+ const et = [...y.data.bezierControls];
560
+ for (; et.length < (y.data.waypoints ?? []).length + 1; ) et.push(null);
561
+ et.splice(w, 1, null, null), U.bezierControls = et;
606
562
  }
607
563
  return {
608
- ...h,
609
- data: j
564
+ ...y,
565
+ data: U
610
566
  };
611
567
  })
612
568
  }
613
569
  }
614
- } : C;
615
- }), ut.current = {
570
+ } : R;
571
+ }), lt.current = {
616
572
  active: !0,
617
- edgeId: d.id,
573
+ edgeId: s.id,
618
574
  type: "waypoint",
619
575
  index: w
620
576
  };
@@ -622,76 +578,76 @@ function Wn({ onPixiReady: F }) {
622
578
  }
623
579
  }
624
580
  }
625
- if (x && (s === "select" || s === "connect")) {
626
- !S && !I.nodeIds.has(x.id) ? lt({
627
- nodeIds: /* @__PURE__ */ new Set([x.id]),
581
+ if (n && (o === "select" || o === "connect")) {
582
+ !b && !z.nodeIds.has(n.id) ? ht({
583
+ nodeIds: /* @__PURE__ */ new Set([n.id]),
628
584
  edgeIds: /* @__PURE__ */ new Set(),
629
585
  lineIds: /* @__PURE__ */ new Set()
630
- }) : S && lt((r) => {
631
- const d = new Set(r.nodeIds);
632
- return d.has(x.id) ? d.delete(x.id) : d.add(x.id), {
633
- nodeIds: d,
586
+ }) : b && ht((e) => {
587
+ const s = new Set(e.nodeIds);
588
+ return s.has(n.id) ? s.delete(n.id) : s.add(n.id), {
589
+ nodeIds: s,
634
590
  edgeIds: /* @__PURE__ */ new Set(),
635
591
  lineIds: /* @__PURE__ */ new Set()
636
592
  };
637
- }), Ft.current && _t.current(x.position.x, x.position.y, x.width, x.height, {
593
+ }), Ut.current && jt.current(n.position.x, n.position.y, n.width, n.height, {
638
594
  padding: 80,
639
595
  preserveZoom: !0,
640
596
  duration: 280
641
597
  });
642
- const t = I.nodeIds.has(x.id) ? new Set(I.nodeIds) : /* @__PURE__ */ new Set([x.id]);
643
- S && !I.nodeIds.has(x.id) && t.add(x.id);
644
- const i = /* @__PURE__ */ new Set();
645
- for (const r of [...t]) {
646
- const d = v.find((R) => R.id === r);
647
- if (!d || d.type !== "flowGroup" && d.type !== "geometryGroup" && !d.data.isGroup) continue;
648
- const w = d.type === "geometryGroup", g = d.position.x, C = d.position.y, H = d.width, h = d.height;
649
- for (const R of v)
650
- if (!(t.has(R.id) || R.id === r)) {
651
- if (R.parentId === r) {
652
- t.add(R.id);
598
+ const t = z.nodeIds.has(n.id) ? new Set(z.nodeIds) : /* @__PURE__ */ new Set([n.id]);
599
+ b && !z.nodeIds.has(n.id) && t.add(n.id);
600
+ const r = /* @__PURE__ */ new Set();
601
+ for (const e of [...t]) {
602
+ const s = p.find((v) => v.id === e);
603
+ if (!s || s.type !== "flowGroup" && s.type !== "geometryGroup" && !s.data.isGroup) continue;
604
+ const w = s.type === "geometryGroup", m = s.position.x, R = s.position.y, G = s.width, y = s.height;
605
+ for (const v of p)
606
+ if (!(t.has(v.id) || v.id === e)) {
607
+ if (v.parentId === e) {
608
+ t.add(v.id);
653
609
  continue;
654
610
  }
655
- w && R.position.x >= g && R.position.y >= C && R.position.x + R.width <= g + H && R.position.y + R.height <= C + h && t.add(R.id);
611
+ w && v.position.x >= m && v.position.y >= R && v.position.x + v.width <= m + G && v.position.y + v.height <= R + y && t.add(v.id);
656
612
  }
657
- for (const R of A.current.lines) R.parentId === r && i.add(R.id);
658
- if (w) for (const R of A.current.lines)
659
- i.has(R.id) || R.points.length > 0 && R.points.every((j) => j.x >= g && j.x <= g + H && j.y >= C && j.y <= C + h) && i.add(R.id);
613
+ for (const v of W.current.lines) v.parentId === e && r.add(v.id);
614
+ if (w) for (const v of W.current.lines)
615
+ r.has(v.id) || v.points.length > 0 && v.points.every((U) => U.x >= m && U.x <= m + G && U.y >= R && U.y <= R + y) && r.add(v.id);
660
616
  }
661
- const n = /* @__PURE__ */ new Map();
662
- for (const r of v) t.has(r.id) && n.set(r.id, { ...r.position });
663
- const o = /* @__PURE__ */ new Map();
664
- if (i.size > 0)
665
- for (const r of A.current.lines) i.has(r.id) && o.set(r.id, r.points.map((d) => ({ ...d })));
666
- ft.current = {
617
+ const d = /* @__PURE__ */ new Map();
618
+ for (const e of p) t.has(e.id) && d.set(e.id, { ...e.position });
619
+ const a = /* @__PURE__ */ new Map();
620
+ if (r.size > 0)
621
+ for (const e of W.current.lines) r.has(e.id) && a.set(e.id, e.points.map((s) => ({ ...s })));
622
+ st.current = {
667
623
  active: !0,
668
624
  nodeIds: t,
669
- lineIds: i.size > 0 ? i : void 0,
670
- startWorld: u,
671
- nodeStarts: n,
672
- linePointStarts: o.size > 0 ? o : void 0
673
- }, Ne.current();
625
+ lineIds: r.size > 0 ? r : void 0,
626
+ startWorld: i,
627
+ nodeStarts: d,
628
+ linePointStarts: a.size > 0 ? a : void 0
629
+ }, Ye.current();
674
630
  return;
675
631
  }
676
- const p = /* @__PURE__ */ new Map();
677
- for (const t of v) p.set(t.id, t);
678
- const a = Math.min(8 / O, 12);
679
- for (const t of P) if (we(u.x, u.y, t, p, a)) {
680
- if (lt(S ? (i) => {
681
- const n = new Set(i.edgeIds);
682
- return n.has(t.id) ? n.delete(t.id) : n.add(t.id), {
683
- ...i,
684
- edgeIds: n
632
+ const g = /* @__PURE__ */ new Map();
633
+ for (const t of p) g.set(t.id, t);
634
+ const x = $(T, 8, 12);
635
+ for (const t of N) if (Ee(i.x, i.y, t, g, x)) {
636
+ if (ht(b ? (r) => {
637
+ const d = new Set(r.edgeIds);
638
+ return d.has(t.id) ? d.delete(t.id) : d.add(t.id), {
639
+ ...r,
640
+ edgeIds: d
685
641
  };
686
642
  } : {
687
643
  nodeIds: /* @__PURE__ */ new Set(),
688
644
  edgeIds: /* @__PURE__ */ new Set([t.id]),
689
645
  lineIds: /* @__PURE__ */ new Set()
690
- }), Ft.current) {
691
- const i = p.get(t.source), n = p.get(t.target);
692
- if (i && n) {
693
- const o = Math.min(i.position.x, n.position.x), r = Math.min(i.position.y, n.position.y), d = Math.max(i.position.x + i.width, n.position.x + n.width), w = Math.max(i.position.y + i.height, n.position.y + n.height);
694
- _t.current(o, r, d - o, w - r, {
646
+ }), Ut.current) {
647
+ const r = g.get(t.source), d = g.get(t.target);
648
+ if (r && d) {
649
+ const a = Math.min(r.position.x, d.position.x), e = Math.min(r.position.y, d.position.y), s = Math.max(r.position.x + r.width, d.position.x + d.width), w = Math.max(r.position.y + r.height, d.position.y + d.height);
650
+ jt.current(a, e, s - a, w - e, {
695
651
  padding: 80,
696
652
  preserveZoom: !0,
697
653
  duration: 280
@@ -700,465 +656,465 @@ function Wn({ onPixiReady: F }) {
700
656
  }
701
657
  return;
702
658
  }
703
- for (const t of N) if (_e(u.x, u.y, t, a)) {
704
- const i = I.lineIds.has(t.id);
705
- if (S ? lt((r) => {
706
- const d = new Set(r.lineIds);
707
- return d.has(t.id) ? d.delete(t.id) : d.add(t.id), {
708
- ...r,
709
- lineIds: d
659
+ for (const t of k) if (on(i.x, i.y, t, x)) {
660
+ const r = z.lineIds.has(t.id);
661
+ if (b ? ht((e) => {
662
+ const s = new Set(e.lineIds);
663
+ return s.has(t.id) ? s.delete(t.id) : s.add(t.id), {
664
+ ...e,
665
+ lineIds: s
710
666
  };
711
- }) : i || lt({
667
+ }) : r || ht({
712
668
  nodeIds: /* @__PURE__ */ new Set(),
713
669
  edgeIds: /* @__PURE__ */ new Set(),
714
670
  lineIds: /* @__PURE__ */ new Set([t.id])
715
- }), Ft.current && t.points.length > 0) {
716
- const r = t.points.map((h) => h.x), d = t.points.map((h) => h.y), w = Math.min(...r), g = Math.min(...d), C = Math.max(...r), H = Math.max(...d);
717
- _t.current(w, g, Math.max(1, C - w), Math.max(1, H - g), {
671
+ }), Ut.current && t.points.length > 0) {
672
+ const e = t.points.map((y) => y.x), s = t.points.map((y) => y.y), w = Math.min(...e), m = Math.min(...s), R = Math.max(...e), G = Math.max(...s);
673
+ jt.current(w, m, Math.max(1, R - w), Math.max(1, G - m), {
718
674
  padding: 80,
719
675
  preserveZoom: !0,
720
676
  duration: 280
721
677
  });
722
678
  }
723
- const n = i ? new Set(I.lineIds) : /* @__PURE__ */ new Set([t.id]), o = /* @__PURE__ */ new Map();
724
- for (const r of N) n.has(r.id) && o.set(r.id, r.points.map((d) => ({ ...d })));
725
- vt.current = {
679
+ const d = r ? new Set(z.lineIds) : /* @__PURE__ */ new Set([t.id]), a = /* @__PURE__ */ new Map();
680
+ for (const e of k) d.has(e.id) && a.set(e.id, e.points.map((s) => ({ ...s })));
681
+ gt.current = {
726
682
  active: !0,
727
- lineIds: n,
728
- startWorld: u,
729
- pointStarts: o
683
+ lineIds: d,
684
+ startWorld: i,
685
+ pointStarts: a
730
686
  };
731
687
  return;
732
688
  }
733
- S || lt({
689
+ b || ht({
734
690
  nodeIds: /* @__PURE__ */ new Set(),
735
691
  edgeIds: /* @__PURE__ */ new Set(),
736
692
  lineIds: /* @__PURE__ */ new Set()
737
- }), s === "select" && (rt.current = {
693
+ }), o === "select" && (Q.current = {
738
694
  active: !0,
739
695
  startScreen: {
740
- x: m.global.x,
741
- y: m.global.y
696
+ x: f.global.x,
697
+ y: f.global.y
742
698
  }
743
699
  });
744
- }), ct.on("globalpointermove", (m) => {
745
- const s = st.current(m.global.x, m.global.y);
746
- Me.current = s;
747
- const u = Xt.current;
748
- if (u === "freehand" || u === "line" || u === "polyline" || u === "arrow") return;
749
- const v = A.current.nodes, P = A.current.edges, N = $.current?.state.zoom ?? 1, I = !ft.current?.active && !ot.current?.active && !pt.current?.active && !dt.current?.active && !ut.current?.active && !vt.current?.active;
750
- let S = null;
751
- for (let e = v.length - 1; e >= 0; e--) if (Dt(s.x, s.y, v[e])) {
752
- const c = v[e];
753
- S = c.parentId ? v.find((y) => y.id === c.parentId)?.id ?? c.id : c.id;
700
+ }), vt.on("globalpointermove", (f) => {
701
+ const o = it.current(f.global.x, f.global.y);
702
+ if (Pe.current = o, F.current?.multiTouchActive) return;
703
+ const i = Kt.current;
704
+ if (i === "freehand" || i === "line" || i === "polyline" || i === "arrow") return;
705
+ const p = W.current.nodes, N = W.current.edges, k = F.current?.state.zoom ?? 1, z = !st.current?.active && !tt.current?.active && !yt.current?.active && !ct.current?.active && !lt.current?.active && !gt.current?.active;
706
+ let b = null;
707
+ for (let c = p.length - 1; c >= 0; c--) if (Yt(o.x, o.y, p[c])) {
708
+ const h = p[c];
709
+ b = h.parentId ? p.find((u) => u.id === h.parentId)?.id ?? h.id : h.id;
754
710
  break;
755
711
  }
756
- if ($t.current = S, I && (u === "select" || u === "connect")) {
757
- const e = /* @__PURE__ */ new Map();
758
- for (const p of v) e.set(p.id, p);
759
- const c = Yt.current, y = c.edgeIds.size > 0 ? P.filter((p) => c.edgeIds.has(p.id)) : [], f = y.length > 0 ? Ye(s.x, s.y, y, e, Math.min(12 / N, 18)) : null;
760
- de.current = f;
761
- let x = null;
762
- if (S) {
763
- const p = v.find((a) => a.id === S);
764
- if (p) {
765
- const a = Et(gt(p.width, p.height), p, s.x, s.y, Math.min(14 / N, 20));
766
- if (a) {
767
- const t = Zt(a, p);
768
- x = {
769
- nodeId: p.id,
770
- handleId: a.id,
771
- wx: t.x,
772
- wy: t.y
712
+ if (oe.current = b, z && (i === "select" || i === "connect")) {
713
+ const c = /* @__PURE__ */ new Map();
714
+ for (const x of p) c.set(x.id, x);
715
+ const h = Bt.current, u = h.edgeIds.size > 0 ? N.filter((x) => h.edgeIds.has(x.id)) : [], n = u.length > 0 ? en(o.x, o.y, u, c, $(k, 12, 18)) : null;
716
+ ge.current = n;
717
+ let g = null;
718
+ if (b) {
719
+ const x = p.find((t) => t.id === b);
720
+ if (x) {
721
+ const t = At(It(x.width, x.height), x, o.x, o.y, $(k, 14, 20));
722
+ if (t) {
723
+ const r = Wt(t, x);
724
+ g = {
725
+ nodeId: x.id,
726
+ handleId: t.id,
727
+ wx: r.x,
728
+ wy: r.y
773
729
  };
774
730
  }
775
731
  }
776
732
  }
777
- ie.current = x;
733
+ xe.current = g;
778
734
  }
779
- const O = E.current;
780
- if (O && I) {
781
- const e = Yt.current;
782
- let c = "";
783
- if (de.current) c = "crosshair";
784
- else if (ie.current) c = "crosshair";
785
- else if (e.edgeIds.size > 0 && u === "select") {
786
- const y = P.filter((p) => e.edgeIds.has(p.id)), f = /* @__PURE__ */ new Map();
787
- for (const p of v) f.set(p.id, p);
788
- const x = Math.min(10 / N, 14);
789
- (Xe(s.x, s.y, y, x) || Fe(s.x, s.y, y, f, x)) && (c = "grab");
735
+ const T = S.current;
736
+ if (T && z) {
737
+ const c = Bt.current;
738
+ let h = "";
739
+ if (ge.current) h = "crosshair";
740
+ else if (xe.current) h = "crosshair";
741
+ else if (c.edgeIds.size > 0 && i === "select") {
742
+ const u = N.filter((x) => c.edgeIds.has(x.id)), n = /* @__PURE__ */ new Map();
743
+ for (const x of p) n.set(x.id, x);
744
+ const g = $(k, 10, 14);
745
+ (nn(o.x, o.y, u, g) || rn(o.x, o.y, u, n, g)) && (h = "grab");
790
746
  }
791
- if (!c && e.nodeIds.size === 1 && u === "select") {
792
- const y = v.find((f) => f.id === [...e.nodeIds][0]);
793
- if (y) {
794
- const f = Ae(s, y, Math.min(10 / N, 16));
795
- f && (c = un[f]);
747
+ if (!h && c.nodeIds.size === 1 && i === "select") {
748
+ const u = p.find((n) => n.id === [...c.nodeIds][0]);
749
+ if (u) {
750
+ const n = tn(o, u, $(k, 10, 16));
751
+ n && (h = zn[n]);
796
752
  }
797
753
  }
798
- if (!c && u === "select") {
799
- const y = A.current.lines, f = Math.min(8 / N, 12);
800
- for (const x of y) if (_e(s.x, s.y, x, f)) {
801
- c = "move";
754
+ if (!h && i === "select") {
755
+ const u = W.current.lines, n = $(k, 8, 12);
756
+ for (const g of u) if (on(o.x, o.y, g, n)) {
757
+ h = "move";
802
758
  break;
803
759
  }
804
760
  }
805
- O.style.cursor = c;
761
+ T.style.cursor = h;
806
762
  }
807
- if (pt.current?.active) {
808
- const e = pt.current, c = s.x - e.startWorld.x, y = s.y - e.startWorld.y, f = hn(e.startBounds, e.handle, c, y), x = A.current.nodes, p = ne([{
809
- id: e.nodeId,
763
+ if (yt.current?.active) {
764
+ const c = yt.current, h = o.x - c.startWorld.x, u = o.y - c.startWorld.y, n = En(c.startBounds, c.handle, h, u), g = W.current.nodes, x = le([{
765
+ id: c.nodeId,
810
766
  type: "shapeRect",
811
767
  position: {
812
- x: f.x,
813
- y: f.y
768
+ x: n.x,
769
+ y: n.y
814
770
  },
815
- width: f.w,
816
- height: f.h,
771
+ width: n.w,
772
+ height: n.h,
817
773
  data: {}
818
- }], x);
819
- f.x += p.dx, f.y += p.dy, (e.handle === "ne" || e.handle === "se") && (f.w += p.dx), (e.handle === "se" || e.handle === "sw") && (f.h += p.dy), zt.current = p.guides;
820
- const a = e.startBounds, t = Math.max(f.w, 24), i = Math.max(f.h, 24), n = a.w > 0 ? t / a.w : 1, o = a.h > 0 ? i / a.h : 1;
821
- J((r) => {
822
- const d = r.canvases[V.current];
823
- return d ? {
824
- ...r,
774
+ }], g);
775
+ n.x += x.dx, n.y += x.dy, (c.handle === "ne" || c.handle === "se") && (n.w += x.dx), (c.handle === "se" || c.handle === "sw") && (n.h += x.dy), Dt.current = x.guides;
776
+ const t = c.startBounds, r = Math.max(n.w, 24), d = Math.max(n.h, 24), a = t.w > 0 ? r / t.w : 1, e = t.h > 0 ? d / t.h : 1;
777
+ J((s) => {
778
+ const w = s.canvases[B.current];
779
+ return w ? {
780
+ ...s,
825
781
  canvases: {
826
- ...r.canvases,
827
- [V.current]: {
828
- ...d,
829
- nodes: d.nodes.map((w) => {
830
- if (w.id === e.nodeId) return {
831
- ...w,
782
+ ...s.canvases,
783
+ [B.current]: {
784
+ ...w,
785
+ nodes: w.nodes.map((m) => {
786
+ if (m.id === c.nodeId) return {
787
+ ...m,
832
788
  position: {
833
- x: f.x,
834
- y: f.y
789
+ x: n.x,
790
+ y: n.y
835
791
  },
836
- width: t,
837
- height: i
792
+ width: r,
793
+ height: d
838
794
  };
839
- const g = e.childStarts.get(w.id);
840
- return g ? {
841
- ...w,
795
+ const R = c.childStarts.get(m.id);
796
+ return R ? {
797
+ ...m,
842
798
  position: {
843
- x: f.x + (g.x - a.x) * n,
844
- y: f.y + (g.y - a.y) * o
799
+ x: n.x + (R.x - t.x) * a,
800
+ y: n.y + (R.y - t.y) * e
845
801
  },
846
- width: Math.max(g.w * n, 24),
847
- height: Math.max(g.h * o, 24)
848
- } : w;
802
+ width: Math.max(R.w * a, 24),
803
+ height: Math.max(R.h * e, 24)
804
+ } : m;
849
805
  }),
850
- lines: e.childLineStarts ? d.lines.map((w) => {
851
- const g = e.childLineStarts.get(w.id);
852
- return g ? {
853
- ...w,
854
- points: g.map((C) => ({
855
- x: f.x + (C.x - a.x) * n,
856
- y: f.y + (C.y - a.y) * o
806
+ lines: c.childLineStarts ? w.lines.map((m) => {
807
+ const R = c.childLineStarts.get(m.id);
808
+ return R ? {
809
+ ...m,
810
+ points: R.map((G) => ({
811
+ x: n.x + (G.x - t.x) * a,
812
+ y: n.y + (G.y - t.y) * e
857
813
  }))
858
- } : w;
859
- }) : d.lines
814
+ } : m;
815
+ }) : w.lines
860
816
  }
861
817
  }
862
- } : r;
818
+ } : s;
863
819
  });
864
820
  return;
865
821
  }
866
- if (ut.current?.active) {
867
- const e = ut.current, c = A.current.nodes, y = /* @__PURE__ */ new Map();
868
- for (const f of c) y.set(f.id, f);
869
- J((f) => {
870
- const x = f.canvases[V.current];
871
- return x ? {
872
- ...f,
822
+ if (lt.current?.active) {
823
+ const c = lt.current, h = W.current.nodes, u = /* @__PURE__ */ new Map();
824
+ for (const n of h) u.set(n.id, n);
825
+ J((n) => {
826
+ const g = n.canvases[B.current];
827
+ return g ? {
828
+ ...n,
873
829
  canvases: {
874
- ...f.canvases,
875
- [V.current]: {
876
- ...x,
877
- edges: x.edges.map((p) => {
878
- if (p.id !== e.edgeId) return p;
879
- if (e.type === "waypoint") {
880
- const Nt = [...p.data.waypoints ?? []];
881
- return e.index < Nt.length && (Nt[e.index] = {
882
- x: s.x,
883
- y: s.y
830
+ ...n.canvases,
831
+ [B.current]: {
832
+ ...g,
833
+ edges: g.edges.map((x) => {
834
+ if (x.id !== c.edgeId) return x;
835
+ if (c.type === "waypoint") {
836
+ const Gt = [...x.data.waypoints ?? []];
837
+ return c.index < Gt.length && (Gt[c.index] = {
838
+ x: o.x,
839
+ y: o.y
884
840
  }), {
885
- ...p,
841
+ ...x,
886
842
  data: {
887
- ...p.data,
888
- waypoints: Nt
843
+ ...x.data,
844
+ waypoints: Gt
889
845
  }
890
846
  };
891
847
  }
892
- const a = Mt(p, y);
893
- if (!a) return p;
894
- const t = p.data.waypoints ?? [], i = [
848
+ const t = Mt(x, u);
849
+ if (!t) return x;
850
+ const r = x.data.waypoints ?? [], d = [
895
851
  {
896
- x: a.sx,
897
- y: a.sy
852
+ x: t.sx,
853
+ y: t.sy
898
854
  },
899
- ...t,
855
+ ...r,
900
856
  {
901
- x: a.tx,
902
- y: a.ty
857
+ x: t.tx,
858
+ y: t.ty
903
859
  }
904
- ], n = i.length - 1, o = [...p.data.bezierControls ?? []];
905
- for (; o.length < n; ) o.push(null);
906
- const r = e.index;
907
- if (r >= n) return p;
908
- const d = i[r], w = i[r + 1], g = o[r], C = Math.hypot(w.x - d.x, w.y - d.y), H = Math.max(30, C * 0.3), h = n - 1, R = r === 0 ? d.x + a.snx * H : d.x + (w.x - d.x) * 0.4, j = r === 0 ? d.y + a.sny * H : d.y, ht = r === h ? w.x + a.tnx * H : w.x - (w.x - d.x) * 0.4, ee = r === h ? w.y + a.tny * H : w.y;
909
- return e.type === "bezierC1" ? o[r] = {
910
- c1x: s.x,
911
- c1y: s.y,
912
- c2x: g?.c2x ?? ht,
913
- c2y: g?.c2y ?? ee
914
- } : o[r] = {
915
- c1x: g?.c1x ?? R,
916
- c1y: g?.c1y ?? j,
917
- c2x: s.x,
918
- c2y: s.y
860
+ ], a = d.length - 1, e = [...x.data.bezierControls ?? []];
861
+ for (; e.length < a; ) e.push(null);
862
+ const s = c.index;
863
+ if (s >= a) return x;
864
+ const w = d[s], m = d[s + 1], R = e[s], G = Math.hypot(m.x - w.x, m.y - w.y), y = Math.max(30, G * 0.3), v = a - 1, U = s === 0 ? w.x + t.snx * y : w.x + (m.x - w.x) * 0.4, et = s === 0 ? w.y + t.sny * y : w.y, Lt = s === v ? m.x + t.tnx * y : m.x - (m.x - w.x) * 0.4, ae = s === v ? m.y + t.tny * y : m.y;
865
+ return c.type === "bezierC1" ? e[s] = {
866
+ c1x: o.x,
867
+ c1y: o.y,
868
+ c2x: R?.c2x ?? Lt,
869
+ c2y: R?.c2y ?? ae
870
+ } : e[s] = {
871
+ c1x: R?.c1x ?? U,
872
+ c1y: R?.c1y ?? et,
873
+ c2x: o.x,
874
+ c2y: o.y
919
875
  }, {
920
- ...p,
876
+ ...x,
921
877
  data: {
922
- ...p.data,
923
- bezierControls: o
878
+ ...x.data,
879
+ bezierControls: e
924
880
  }
925
881
  };
926
882
  })
927
883
  }
928
884
  }
929
- } : f;
885
+ } : n;
930
886
  });
931
887
  return;
932
888
  }
933
- if (vt.current?.active) {
934
- const e = vt.current, c = s.x - e.startWorld.x, y = s.y - e.startWorld.y;
935
- J((f) => {
936
- const x = f.canvases[V.current];
937
- return x ? {
938
- ...f,
889
+ if (gt.current?.active) {
890
+ const c = gt.current, h = o.x - c.startWorld.x, u = o.y - c.startWorld.y;
891
+ J((n) => {
892
+ const g = n.canvases[B.current];
893
+ return g ? {
894
+ ...n,
939
895
  canvases: {
940
- ...f.canvases,
941
- [V.current]: {
942
- ...x,
943
- lines: x.lines.map((p) => {
944
- const a = e.pointStarts.get(p.id);
945
- return a ? {
946
- ...p,
947
- points: a.map((t) => ({
948
- x: t.x + c,
949
- y: t.y + y
896
+ ...n.canvases,
897
+ [B.current]: {
898
+ ...g,
899
+ lines: g.lines.map((x) => {
900
+ const t = c.pointStarts.get(x.id);
901
+ return t ? {
902
+ ...x,
903
+ points: t.map((r) => ({
904
+ x: r.x + h,
905
+ y: r.y + u
950
906
  }))
951
- } : p;
907
+ } : x;
952
908
  })
953
909
  }
954
910
  }
955
- } : f;
911
+ } : n;
956
912
  });
957
913
  return;
958
914
  }
959
- if (ft.current?.active) {
960
- const e = ft.current, c = s.x - e.startWorld.x, y = s.y - e.startWorld.y, f = A.current.nodes, x = ne(f.filter((t) => e.nodeIds.has(t.id)).map((t) => {
961
- const i = e.nodeStarts.get(t.id);
915
+ if (st.current?.active) {
916
+ const c = st.current, h = o.x - c.startWorld.x, u = o.y - c.startWorld.y, n = W.current.nodes, g = le(n.filter((r) => c.nodeIds.has(r.id)).map((r) => {
917
+ const d = c.nodeStarts.get(r.id);
962
918
  return {
963
- ...t,
919
+ ...r,
964
920
  position: {
965
- x: i.x + c,
966
- y: i.y + y
921
+ x: d.x + h,
922
+ y: d.y + u
967
923
  }
968
924
  };
969
- }), f), p = c + x.dx, a = y + x.dy;
970
- zt.current = x.guides, J((t) => {
971
- const i = t.canvases[V.current];
972
- return i ? {
973
- ...t,
925
+ }), n), x = h + g.dx, t = u + g.dy;
926
+ Dt.current = g.guides, J((r) => {
927
+ const d = r.canvases[B.current];
928
+ return d ? {
929
+ ...r,
974
930
  canvases: {
975
- ...t.canvases,
976
- [V.current]: {
977
- ...i,
978
- nodes: i.nodes.map((n) => {
979
- const o = e.nodeStarts.get(n.id);
980
- return o ? {
981
- ...n,
931
+ ...r.canvases,
932
+ [B.current]: {
933
+ ...d,
934
+ nodes: d.nodes.map((a) => {
935
+ const e = c.nodeStarts.get(a.id);
936
+ return e ? {
937
+ ...a,
982
938
  position: {
983
- x: o.x + p,
984
- y: o.y + a
939
+ x: e.x + x,
940
+ y: e.y + t
985
941
  }
986
- } : n;
942
+ } : a;
987
943
  }),
988
- lines: e.linePointStarts ? i.lines.map((n) => {
989
- const o = e.linePointStarts.get(n.id);
990
- return o ? {
991
- ...n,
992
- points: o.map((r) => ({
993
- x: r.x + p,
994
- y: r.y + a
944
+ lines: c.linePointStarts ? d.lines.map((a) => {
945
+ const e = c.linePointStarts.get(a.id);
946
+ return e ? {
947
+ ...a,
948
+ points: e.map((s) => ({
949
+ x: s.x + x,
950
+ y: s.y + t
995
951
  }))
996
- } : n;
997
- }) : i.lines
952
+ } : a;
953
+ }) : d.lines
998
954
  }
999
955
  }
1000
- } : t;
956
+ } : r;
1001
957
  });
1002
958
  return;
1003
959
  }
1004
- if (rt.current?.active && St.current) {
1005
- const e = Math.min(rt.current.startScreen.x, m.global.x), c = Math.min(rt.current.startScreen.y, m.global.y), y = Math.abs(m.global.x - rt.current.startScreen.x), f = Math.abs(m.global.y - rt.current.startScreen.y);
1006
- St.current.showMarquee(e, c, y, f);
960
+ if (Q.current?.active && Ct.current) {
961
+ const c = Math.min(Q.current.startScreen.x, f.global.x), h = Math.min(Q.current.startScreen.y, f.global.y), u = Math.abs(f.global.x - Q.current.startScreen.x), n = Math.abs(f.global.y - Q.current.startScreen.y);
962
+ Ct.current.showMarquee(c, h, u, n);
1007
963
  }
1008
- if (ot.current?.active && xt.current) {
1009
- const e = A.current.nodes.find((c) => c.id === ot.current.sourceNodeId);
1010
- if (e) {
1011
- const c = gt(e.width, e.height).find((y) => y.id === ot.current.sourceHandleId);
1012
- if (c) {
1013
- const y = Zt(c, e), f = y.x, x = y.y;
1014
- let p = s.x, a = s.y;
1015
- const t = $t.current;
1016
- if (t && t !== ot.current.sourceNodeId) {
1017
- const n = A.current.nodes.find((o) => o.id === t);
1018
- if (n) {
1019
- const o = Et(gt(n.width, n.height), n, s.x, s.y, 1 / 0);
1020
- if (o) {
1021
- const r = Zt(o, n);
1022
- p = r.x, a = r.y;
964
+ if (tt.current?.active && xt.current) {
965
+ const c = W.current.nodes.find((h) => h.id === tt.current.sourceNodeId);
966
+ if (c) {
967
+ const h = It(c.width, c.height).find((u) => u.id === tt.current.sourceHandleId);
968
+ if (h) {
969
+ const u = Wt(h, c), n = u.x, g = u.y;
970
+ let x = o.x, t = o.y;
971
+ const r = oe.current;
972
+ if (r && r !== tt.current.sourceNodeId) {
973
+ const a = W.current.nodes.find((e) => e.id === r);
974
+ if (a) {
975
+ const e = At(It(a.width, a.height), a, o.x, o.y, 1 / 0);
976
+ if (e) {
977
+ const s = Wt(e, a);
978
+ x = s.x, t = s.y;
1023
979
  }
1024
980
  }
1025
981
  }
1026
- const i = xt.current;
1027
- i.clear(), i.moveTo(f, x).lineTo(p, a).stroke({
982
+ const d = xt.current;
983
+ d.clear(), d.moveTo(n, g).lineTo(x, t).stroke({
1028
984
  color: 3900150,
1029
985
  width: 2,
1030
986
  alpha: 0.6
1031
- }), i.visible = !0;
987
+ }), d.visible = !0;
1032
988
  }
1033
989
  }
1034
990
  }
1035
- if (dt.current?.active && xt.current && !xt.current.destroyed) {
1036
- const e = dt.current, c = A.current.nodes.find((y) => y.id === e.fixedNodeId);
1037
- if (c) {
1038
- const y = gt(c.width, c.height).find((o) => o.id === e.fixedHandleId), f = y ? Zt(y, c) : {
1039
- x: c.position.x + c.width / 2,
1040
- y: c.position.y + c.height / 2
1041
- }, x = f.x, p = f.y;
1042
- let a = s.x, t = s.y;
1043
- const i = $t.current;
1044
- if (i && i !== e.fixedNodeId) {
1045
- const o = A.current.nodes.find((r) => r.id === i);
1046
- if (o) {
1047
- const r = Et(gt(o.width, o.height), o, s.x, s.y, 1 / 0);
1048
- if (r) {
1049
- const d = Zt(r, o);
1050
- a = d.x, t = d.y;
991
+ if (ct.current?.active && xt.current && !xt.current.destroyed) {
992
+ const c = ct.current, h = W.current.nodes.find((u) => u.id === c.fixedNodeId);
993
+ if (h) {
994
+ const u = It(h.width, h.height).find((e) => e.id === c.fixedHandleId), n = u ? Wt(u, h) : {
995
+ x: h.position.x + h.width / 2,
996
+ y: h.position.y + h.height / 2
997
+ }, g = n.x, x = n.y;
998
+ let t = o.x, r = o.y;
999
+ const d = oe.current;
1000
+ if (d && d !== c.fixedNodeId) {
1001
+ const e = W.current.nodes.find((s) => s.id === d);
1002
+ if (e) {
1003
+ const s = At(It(e.width, e.height), e, o.x, o.y, 1 / 0);
1004
+ if (s) {
1005
+ const w = Wt(s, e);
1006
+ t = w.x, r = w.y;
1051
1007
  }
1052
1008
  }
1053
1009
  }
1054
- const n = xt.current;
1055
- n.clear(), n.moveTo(x, p).lineTo(a, t).stroke({
1010
+ const a = xt.current;
1011
+ a.clear(), a.moveTo(g, x).lineTo(t, r).stroke({
1056
1012
  color: 16347926,
1057
1013
  width: 2,
1058
1014
  alpha: 0.7
1059
- }), n.visible = !0;
1015
+ }), a.visible = !0;
1060
1016
  }
1061
1017
  }
1062
1018
  });
1063
- const bt = () => {
1064
- zt.current = [];
1019
+ const Et = () => {
1020
+ Dt.current = [];
1065
1021
  try {
1066
- Jt.current?.clear();
1022
+ se.current?.clear();
1067
1023
  } catch {
1068
1024
  }
1069
1025
  try {
1070
- const m = xt.current;
1071
- m && !m.destroyed && (m.clear(), m.visible = !1);
1026
+ const f = xt.current;
1027
+ f && !f.destroyed && (f.clear(), f.visible = !1);
1072
1028
  } catch {
1073
1029
  }
1074
- E.current && (E.current.style.cursor = "");
1030
+ S.current && (S.current.style.cursor = "");
1075
1031
  };
1076
- ct.on("pointerup", (m) => {
1077
- if (bt(), ut.current?.active) {
1078
- ut.current = null;
1032
+ vt.on("pointerup", (f) => {
1033
+ if (Et(), lt.current?.active) {
1034
+ lt.current = null;
1079
1035
  return;
1080
1036
  }
1081
- if (pt.current?.active) {
1082
- pt.current = null;
1037
+ if (yt.current?.active) {
1038
+ yt.current = null;
1083
1039
  return;
1084
1040
  }
1085
- if (vt.current?.active) {
1086
- vt.current = null;
1041
+ if (gt.current?.active) {
1042
+ gt.current = null;
1087
1043
  return;
1088
1044
  }
1089
- if (ft.current?.active && (ft.current = null, le.current()), rt.current?.active) {
1090
- const s = st.current(rt.current.startScreen.x, rt.current.startScreen.y), u = st.current(m.global.x, m.global.y), v = Math.min(s.x, u.x), P = Math.min(s.y, u.y), N = Math.abs(u.x - s.x), I = Math.abs(u.y - s.y);
1091
- if (N > 4 && I > 4) {
1092
- const S = A.current.nodes.filter((e) => tn(v, P, N, I, e.position.x, e.position.y, e.width, e.height)), O = A.current.lines.filter((e) => e.points.length === 0 ? !1 : e.points.every((c) => c.x >= v && c.x <= v + N && c.y >= P && c.y <= P + I));
1093
- lt({
1094
- nodeIds: new Set(S.map((e) => e.id)),
1045
+ if (st.current?.active && (st.current = null, ie.current()), Q.current?.active) {
1046
+ const o = it.current(Q.current.startScreen.x, Q.current.startScreen.y), i = it.current(f.global.x, f.global.y), p = Math.min(o.x, i.x), N = Math.min(o.y, i.y), k = Math.abs(i.x - o.x), z = Math.abs(i.y - o.y);
1047
+ if (k > 4 && z > 4) {
1048
+ const b = W.current.nodes.filter((c) => gn(p, N, k, z, c.position.x, c.position.y, c.width, c.height)), T = W.current.lines.filter((c) => c.points.length === 0 ? !1 : c.points.every((h) => h.x >= p && h.x <= p + k && h.y >= N && h.y <= N + z));
1049
+ ht({
1050
+ nodeIds: new Set(b.map((c) => c.id)),
1095
1051
  edgeIds: /* @__PURE__ */ new Set(),
1096
- lineIds: new Set(O.map((e) => e.id))
1052
+ lineIds: new Set(T.map((c) => c.id))
1097
1053
  });
1098
1054
  }
1099
- rt.current = null, St.current?.hideMarquee();
1055
+ Q.current = null, Ct.current?.hideMarquee();
1100
1056
  }
1101
- if (dt.current?.active) {
1102
- const s = dt.current.edgeId, u = dt.current.movingEnd, v = dt.current.fixedNodeId;
1103
- dt.current = null;
1104
- const P = st.current(m.global.x, m.global.y), N = A.current.nodes;
1105
- let I = null;
1106
- for (let S = N.length - 1; S >= 0; S--) if (Dt(P.x, P.y, N[S]) && N[S].id !== v) {
1107
- I = N[S];
1057
+ if (ct.current?.active) {
1058
+ const o = ct.current.edgeId, i = ct.current.movingEnd, p = ct.current.fixedNodeId;
1059
+ ct.current = null;
1060
+ const N = it.current(f.global.x, f.global.y), k = W.current.nodes, z = ue ? $(F.current?.state.zoom ?? 1, 12, 24) : 0;
1061
+ let b = null;
1062
+ for (let T = k.length - 1; T >= 0; T--) if (Yt(N.x, N.y, k[T], z) && k[T].id !== p) {
1063
+ b = k[T];
1108
1064
  break;
1109
1065
  }
1110
- if (I) {
1111
- const S = I.id, O = Et(gt(I.width, I.height), I, P.x, P.y, 1 / 0)?.id;
1112
- J((e) => {
1113
- const c = e.canvases[V.current];
1114
- return c ? {
1115
- ...e,
1066
+ if (b) {
1067
+ const T = b.id, c = At(It(b.width, b.height), b, N.x, N.y, 1 / 0)?.id;
1068
+ J((h) => {
1069
+ const u = h.canvases[B.current];
1070
+ return u ? {
1071
+ ...h,
1116
1072
  canvases: {
1117
- ...e.canvases,
1118
- [V.current]: {
1119
- ...c,
1120
- edges: c.edges.map((y) => y.id !== s ? y : u === "source" ? {
1121
- ...y,
1122
- source: S,
1123
- sourceHandle: O
1073
+ ...h.canvases,
1074
+ [B.current]: {
1075
+ ...u,
1076
+ edges: u.edges.map((n) => n.id !== o ? n : i === "source" ? {
1077
+ ...n,
1078
+ source: T,
1079
+ sourceHandle: c
1124
1080
  } : {
1125
- ...y,
1126
- target: S,
1127
- targetHandle: O
1081
+ ...n,
1082
+ target: T,
1083
+ targetHandle: c
1128
1084
  })
1129
1085
  }
1130
1086
  }
1131
- } : e;
1087
+ } : h;
1132
1088
  });
1133
1089
  }
1134
1090
  return;
1135
1091
  }
1136
- if (ot.current?.active) {
1137
- const s = ot.current.sourceNodeId, u = ot.current.sourceHandleId;
1138
- ot.current = null;
1139
- const v = st.current(m.global.x, m.global.y), P = A.current.nodes;
1140
- let N = null;
1141
- for (let I = P.length - 1; I >= 0; I--) if (Dt(v.x, v.y, P[I]) && P[I].id !== s) {
1142
- N = P[I];
1092
+ if (tt.current?.active) {
1093
+ const o = tt.current.sourceNodeId, i = tt.current.sourceHandleId;
1094
+ tt.current = null;
1095
+ const p = it.current(f.global.x, f.global.y), N = W.current.nodes, k = ue ? $(F.current?.state.zoom ?? 1, 12, 24) : 0;
1096
+ let z = null;
1097
+ for (let b = N.length - 1; b >= 0; b--) if (Yt(p.x, p.y, N[b], k) && N[b].id !== o) {
1098
+ z = N[b];
1143
1099
  break;
1144
1100
  }
1145
- if (N) {
1146
- const I = N.id, S = Et(gt(N.width, N.height), N, v.x, v.y, 1 / 0)?.id, O = `edge_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`, e = ze.current;
1147
- J((c) => {
1148
- const y = c.canvases[V.current];
1149
- return !y || y.edges.some((f) => f.source === s && f.target === I && f.sourceHandle === u && f.targetHandle === S) ? c : {
1150
- ...c,
1101
+ if (z) {
1102
+ const b = z.id, T = At(It(z.width, z.height), z, p.x, p.y, 1 / 0)?.id, c = `edge_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`, h = Ae.current;
1103
+ J((u) => {
1104
+ const n = u.canvases[B.current];
1105
+ return !n || n.edges.some((g) => g.source === o && g.target === b && g.sourceHandle === i && g.targetHandle === T) ? u : {
1106
+ ...u,
1151
1107
  canvases: {
1152
- ...c.canvases,
1153
- [V.current]: {
1154
- ...y,
1155
- edges: [...y.edges, {
1156
- id: O,
1157
- source: s,
1158
- target: I,
1159
- sourceHandle: u,
1160
- targetHandle: S,
1161
- type: e,
1108
+ ...u.canvases,
1109
+ [B.current]: {
1110
+ ...n,
1111
+ edges: [...n.edges, {
1112
+ id: c,
1113
+ source: o,
1114
+ target: b,
1115
+ sourceHandle: i,
1116
+ targetHandle: T,
1117
+ type: h,
1162
1118
  data: {
1163
1119
  strokeColor: "theme:base-content",
1164
1120
  strokeWidth: 2,
@@ -1172,49 +1128,145 @@ function Wn({ onPixiReady: F }) {
1172
1128
  });
1173
1129
  }
1174
1130
  }
1175
- }), ct.on("pointerupoutside", () => {
1176
- bt(), ft.current?.active && le.current(), ft.current = null, pt.current = null, rt.current = null, dt.current = null, ot.current = null, ut.current = null, vt.current = null, St.current?.hideMarquee();
1177
- }), ct.on("rightclick", (m) => {
1178
- if (m.preventDefault?.(), $.current?.didRightPan) return;
1179
- const s = st.current(m.global.x, m.global.y), u = A.current.nodes;
1180
- let v = null;
1181
- for (let S = u.length - 1; S >= 0; S--) if (Dt(s.x, s.y, u[S])) {
1182
- v = u[S].id;
1131
+ }), vt.on("pointerupoutside", () => {
1132
+ Et(), st.current?.active && ie.current(), st.current = null, yt.current = null, Q.current = null, ct.current = null, tt.current = null, lt.current = null, gt.current = null, Ct.current?.hideMarquee();
1133
+ });
1134
+ const Nt = S.current;
1135
+ let ft = null;
1136
+ const $t = (f) => {
1137
+ const o = Nt.getBoundingClientRect(), i = f[0].clientX, p = f[0].clientY, N = f[1].clientX, k = f[1].clientY;
1138
+ return {
1139
+ dist: Math.hypot(N - i, k - p),
1140
+ midX: (i + N) / 2 - o.left,
1141
+ midY: (p + k) / 2 - o.top
1142
+ };
1143
+ }, Se = () => {
1144
+ Et(), st.current?.active && ie.current(), st.current = null, yt.current = null, Q.current = null, ct.current = null, tt.current = null, lt.current = null, gt.current = null, Ct.current?.hideMarquee(), F.current?.cancelPan();
1145
+ }, qe = (f) => {
1146
+ if (f.touches.length < 2) return;
1147
+ const o = F.current;
1148
+ o && (o.multiTouchActive = !0, Se(), ft = $t(f.touches), f.preventDefault());
1149
+ }, Ze = (f) => {
1150
+ if (!ft || f.touches.length < 2) return;
1151
+ f.preventDefault();
1152
+ const o = F.current;
1153
+ if (!o) return;
1154
+ const i = $t(f.touches), p = i.dist / Math.max(1, ft.dist);
1155
+ Number.isFinite(p) && p > 0 && o.zoomAt(i.midX, i.midY, p), o.setState({
1156
+ x: o.state.x + (i.midX - ft.midX),
1157
+ y: o.state.y + (i.midY - ft.midY)
1158
+ }), ft = i;
1159
+ }, ze = (f) => {
1160
+ if (f.touches.length >= 2) {
1161
+ ft = $t(f.touches);
1162
+ return;
1163
+ }
1164
+ if (ft = null, f.touches.length === 0) {
1165
+ const o = F.current;
1166
+ o && (o.multiTouchActive = !1), He.current = performance.now() + 350;
1167
+ }
1168
+ };
1169
+ Nt?.addEventListener("touchstart", qe, { passive: !1 }), Nt?.addEventListener("touchmove", Ze, { passive: !1 }), Nt?.addEventListener("touchend", ze), Nt?.addEventListener("touchcancel", ze), X = qe, A = Ze, Z = ze, vt.on("rightclick", (f) => {
1170
+ if (f.preventDefault?.(), F.current?.didRightPan) return;
1171
+ const o = it.current(f.global.x, f.global.y), i = W.current.nodes;
1172
+ let p = null;
1173
+ for (let b = i.length - 1; b >= 0; b--) if (Yt(o.x, o.y, i[b])) {
1174
+ p = i[b].id;
1183
1175
  break;
1184
1176
  }
1185
- const P = m.nativeEvent, N = P?.clientX ?? m.global.x, I = P?.clientY ?? m.global.y;
1186
- Bt({
1187
- x: N,
1188
- y: I,
1189
- nodeId: v
1177
+ const N = f.nativeEvent, k = N?.clientX ?? f.global.x, z = N?.clientY ?? f.global.y;
1178
+ te({
1179
+ x: k,
1180
+ y: z,
1181
+ nodeId: p
1190
1182
  });
1191
- }), ct.on("pointertap", (m) => {
1192
- if (m.button !== 0) return;
1193
- const s = Date.now(), u = st.current(m.global.x, m.global.y), v = Lt.current, P = u.x - v.wx, N = u.y - v.wy;
1194
- if (s - v.time < 400 && Math.abs(P) < 10 && Math.abs(N) < 10) {
1195
- const I = A.current.nodes;
1196
- for (let c = I.length - 1; c >= 0; c--) if (Dt(u.x, u.y, I[c])) {
1197
- const y = I[c], f = y.data.childCanvasId;
1198
- if (f) {
1199
- Oe(f), Lt.current = {
1183
+ }), vt.on("pointertap", (f) => {
1184
+ if (F.current?.multiTouchActive || performance.now() < He.current || f.button !== 0) return;
1185
+ const o = Date.now(), i = it.current(f.global.x, f.global.y), p = ce.current;
1186
+ if (p) {
1187
+ const b = xn("node"), T = i.x - p.width / 2, c = i.y - p.height / 2, h = le([{
1188
+ id: "__ghost__",
1189
+ type: p.type,
1190
+ position: {
1191
+ x: T,
1192
+ y: c
1193
+ },
1194
+ width: p.width,
1195
+ height: p.height,
1196
+ data: {}
1197
+ }], W.current.nodes), u = T + h.dx, n = c + h.dy;
1198
+ J((g) => {
1199
+ const x = g.canvases[B.current];
1200
+ if (!x) return g;
1201
+ const t = {};
1202
+ p.type === "animAnchor" && (t.animIndex = Sn(g));
1203
+ const r = Math.max(0, ...x.nodes.map((d) => d.zIndex ?? 0), ...x.lines.map((d) => d.zIndex ?? 0));
1204
+ return {
1205
+ ...g,
1206
+ canvases: {
1207
+ ...g.canvases,
1208
+ [B.current]: {
1209
+ ...x,
1210
+ nodes: [...x.nodes, {
1211
+ id: b,
1212
+ type: p.type,
1213
+ position: {
1214
+ x: u,
1215
+ y: n
1216
+ },
1217
+ width: p.width,
1218
+ height: p.height,
1219
+ zIndex: r + 1,
1220
+ data: {
1221
+ ...p.data,
1222
+ ...t
1223
+ }
1224
+ }]
1225
+ }
1226
+ }
1227
+ };
1228
+ }), ht({
1229
+ nodeIds: /* @__PURE__ */ new Set([b]),
1230
+ edgeIds: /* @__PURE__ */ new Set(),
1231
+ lineIds: /* @__PURE__ */ new Set()
1232
+ }), Ut.current && window.setTimeout(() => {
1233
+ jt.current(u, n, p.width, p.height, {
1234
+ padding: 80,
1235
+ preserveZoom: !0,
1236
+ duration: 280
1237
+ });
1238
+ }, 0), kt.current = {
1239
+ time: 0,
1240
+ wx: 0,
1241
+ wy: 0
1242
+ };
1243
+ return;
1244
+ }
1245
+ const N = kt.current, k = i.x - N.wx, z = i.y - N.wy;
1246
+ if (o - N.time < 400 && Math.abs(k) < 10 && Math.abs(z) < 10) {
1247
+ const b = W.current.nodes;
1248
+ for (let u = b.length - 1; u >= 0; u--) if (Yt(i.x, i.y, b[u])) {
1249
+ const n = b[u], g = n.data.childCanvasId;
1250
+ if (g) {
1251
+ dn(g), kt.current = {
1200
1252
  time: 0,
1201
1253
  wx: 0,
1202
1254
  wy: 0
1203
1255
  };
1204
1256
  return;
1205
1257
  }
1206
- Qt.current("node", y.id, y.data.label ?? ""), Lt.current = {
1258
+ de.current("node", n.id, n.data.label ?? ""), kt.current = {
1207
1259
  time: 0,
1208
1260
  wx: 0,
1209
1261
  wy: 0
1210
1262
  };
1211
1263
  return;
1212
1264
  }
1213
- const S = A.current.edges, O = /* @__PURE__ */ new Map();
1214
- for (const c of I) O.set(c.id, c);
1215
- const e = $.current?.state.zoom ?? 1;
1216
- for (let c = S.length - 1; c >= 0; c--) if (we(u.x, u.y, S[c], O, Math.min(8 / e, 12))) {
1217
- Qt.current("edge", S[c].id, S[c].data.labelText ?? ""), Lt.current = {
1265
+ const T = W.current.edges, c = /* @__PURE__ */ new Map();
1266
+ for (const u of b) c.set(u.id, u);
1267
+ const h = F.current?.state.zoom ?? 1;
1268
+ for (let u = T.length - 1; u >= 0; u--) if (Ee(i.x, i.y, T[u], c, $(h, 8, 12))) {
1269
+ de.current("edge", T[u].id, T[u].data.labelText ?? ""), kt.current = {
1218
1270
  time: 0,
1219
1271
  wx: 0,
1220
1272
  wy: 0
@@ -1222,161 +1274,169 @@ function Wn({ onPixiReady: F }) {
1222
1274
  return;
1223
1275
  }
1224
1276
  }
1225
- Lt.current = {
1226
- time: s,
1227
- wx: u.x,
1228
- wy: u.y
1277
+ kt.current = {
1278
+ time: o,
1279
+ wx: i.x,
1280
+ wy: i.y
1229
1281
  };
1230
1282
  });
1231
- let te = !1;
1232
- l.app.ticker.add((m) => {
1283
+ let Ve = !1;
1284
+ l.app.ticker.add((f) => {
1233
1285
  if (l.destroyed) return;
1234
- const s = m.deltaMS, u = l.app.screen, v = $.current?.state ?? {
1286
+ const o = f.deltaMS, i = l.app.screen, p = F.current?.state ?? {
1235
1287
  x: 0,
1236
1288
  y: 0,
1237
1289
  zoom: 1
1238
1290
  };
1239
- G.current?.update(v, u.width, u.height);
1240
- const P = $.current?.isPanning ?? !1;
1241
- P !== te && (te = P, E.current && (E.current.style.cursor = P ? "grabbing" : ""));
1242
- const N = A.current, I = Yt.current, S = dn(Se.current), O = /* @__PURE__ */ new Map();
1243
- S.forEach((a, t) => O.set(a.node.id, t + 1)), Kt.current?.advanceAnimation(s);
1244
- const e = Ct.current ? S[Ct.current.current] : void 0;
1245
- Kt.current?.sync(N.nodes, I.nodeIds, $t.current, O, {
1246
- showAnchors: Ce.current,
1247
- presentation: Ct.current !== null,
1248
- presentationAnchorId: e?.node.id,
1249
- presentationAnchorVisible: Ct.current?.showAnchor ?? !1
1291
+ H.current?.update(p, i.width, i.height);
1292
+ const N = F.current?.isPanning ?? !1;
1293
+ N !== Ve && (Ve = N, S.current && (S.current.style.cursor = N ? "grabbing" : ""));
1294
+ const k = W.current, z = Bt.current, b = Rn(Ge.current), T = /* @__PURE__ */ new Map();
1295
+ b.forEach((t, r) => T.set(t.node.id, r + 1)), ee.current?.advanceAnimation(o);
1296
+ const c = Ht.current ? b[Ht.current.current] : void 0;
1297
+ ee.current?.sync(k.nodes, z.nodeIds, oe.current, T, {
1298
+ showAnchors: We.current,
1299
+ presentation: Ht.current !== null,
1300
+ presentationAnchorId: c?.node.id,
1301
+ presentationAnchorVisible: Ht.current?.showAnchor ?? !1
1250
1302
  });
1251
- const c = /* @__PURE__ */ new Map();
1252
- for (const a of N.nodes) c.set(a.id, a);
1253
- jt.current?.advanceAnimation(s), jt.current?.sync(N.edges, c, I.edgeIds, null, { presentation: Ct.current !== null }), Ut.current?.advanceAnimation(s), Ut.current?.sync(N.lines, I.lineIds), Jt.current?.update(zt.current, u.width, u.height, v);
1254
- const y = Gt.current;
1255
- if (y) {
1256
- y.clear();
1257
- const a = ie.current;
1258
- a && (y.circle(a.wx, a.wy, 10).fill({
1303
+ const h = /* @__PURE__ */ new Map();
1304
+ for (const t of k.nodes) h.set(t.id, t);
1305
+ ne.current?.advanceAnimation(o), ne.current?.sync(k.edges, h, z.edgeIds, null, { presentation: Ht.current !== null }), re.current?.advanceAnimation(o), re.current?.sync(k.lines, z.lineIds), se.current?.update(Dt.current, i.width, i.height, p);
1306
+ const u = qt.current;
1307
+ if (u) {
1308
+ u.clear();
1309
+ const t = xe.current;
1310
+ t && (u.circle(t.wx, t.wy, 10).fill({
1259
1311
  color: 3900150,
1260
1312
  alpha: 0.12
1261
1313
  }).stroke({
1262
1314
  color: 3900150,
1263
1315
  width: 1.5,
1264
1316
  alpha: 0.5
1265
- }), y.circle(a.wx, a.wy, 4).fill({
1317
+ }), u.circle(t.wx, t.wy, 4).fill({
1266
1318
  color: 3900150,
1267
1319
  alpha: 0.9
1268
1320
  }));
1269
- const t = de.current;
1270
- t && !a && (y.circle(t.worldX, t.worldY, 10).fill({
1321
+ const r = ge.current;
1322
+ r && !t && (u.circle(r.worldX, r.worldY, 10).fill({
1271
1323
  color: 16347926,
1272
1324
  alpha: 0.12
1273
1325
  }).stroke({
1274
1326
  color: 16347926,
1275
1327
  width: 1.5,
1276
1328
  alpha: 0.5
1277
- }), y.circle(t.worldX, t.worldY, 4).fill({
1329
+ }), u.circle(r.worldX, r.worldY, 4).fill({
1278
1330
  color: 16347926,
1279
1331
  alpha: 0.9
1280
1332
  }));
1281
1333
  }
1282
- const f = At.current;
1283
- if (f) {
1284
- f.clear();
1285
- const a = ae.current;
1286
- if (a) {
1287
- const t = Me.current, i = t.x - a.width / 2, n = t.y - a.height / 2, o = ne([{
1334
+ const n = Vt.current;
1335
+ if (n) {
1336
+ n.clear();
1337
+ const t = ce.current;
1338
+ if (t) {
1339
+ const r = Pe.current, d = r.x - t.width / 2, a = r.y - t.height / 2, e = le([{
1288
1340
  id: "__ghost__",
1289
- type: a.type,
1341
+ type: t.type,
1290
1342
  position: {
1291
- x: i,
1292
- y: n
1343
+ x: d,
1344
+ y: a
1293
1345
  },
1294
- width: a.width,
1295
- height: a.height,
1346
+ width: t.width,
1347
+ height: t.height,
1296
1348
  data: {}
1297
- }], N.nodes);
1298
- zt.current = o.guides, f.position.set(i + o.dx, n + o.dy), (Ge[a.type] ?? Ge.shapeRect)(f, {
1299
- width: a.width,
1300
- height: a.height,
1349
+ }], k.nodes);
1350
+ Dt.current = e.guides, n.position.set(d + e.dx, a + e.dy), (je[t.type] ?? je.shapeRect)(n, {
1351
+ width: t.width,
1352
+ height: t.height,
1301
1353
  fill: "#3b82f6",
1302
1354
  stroke: "#3b82f6",
1303
1355
  strokeWidth: 1.5,
1304
- borderStyle: a.data.borderStyle
1356
+ borderStyle: t.data.borderStyle
1305
1357
  });
1306
1358
  } else
1307
- f.position.set(0, 0), !ft.current?.active && !pt.current?.active && (zt.current = []);
1359
+ n.position.set(0, 0), !st.current?.active && !yt.current?.active && (Dt.current = []);
1308
1360
  }
1309
- const x = Wt.current;
1310
- if (x && (x.clear(), I.edgeIds.size > 0 && Xt.current === "select")) {
1311
- const a = 1 / v.zoom;
1312
- for (const t of N.edges) {
1313
- if (!I.edgeIds.has(t.id)) continue;
1314
- const i = t.data.waypoints;
1315
- if (i) for (const n of i) x.circle(n.x, n.y, 5 * a).fill({ color: 16777215 }).stroke({
1361
+ const g = Zt.current;
1362
+ if (g && (g.clear(), z.edgeIds.size > 0 && Kt.current === "select")) {
1363
+ const t = 1 / p.zoom;
1364
+ for (const r of k.edges) {
1365
+ if (!z.edgeIds.has(r.id)) continue;
1366
+ const d = Mt(r, h);
1367
+ d && (g.circle(d.sx, d.sy, 5 * t).fill({ color: 16777215 }).stroke({
1368
+ color: 16347926,
1369
+ width: 1.5 * t
1370
+ }), g.circle(d.tx, d.ty, 5 * t).fill({ color: 16777215 }).stroke({
1371
+ color: 16347926,
1372
+ width: 1.5 * t
1373
+ }));
1374
+ const a = r.data.waypoints;
1375
+ if (a) for (const e of a) g.circle(e.x, e.y, 5 * t).fill({ color: 16777215 }).stroke({
1316
1376
  color: 3900150,
1317
- width: 1.5 * a
1377
+ width: 1.5 * t
1318
1378
  });
1319
- if (t.type === "simplebezier") {
1320
- const n = Mt(t, c);
1321
- if (!n) continue;
1322
- const o = i ?? [], r = [
1379
+ if (r.type === "simplebezier") {
1380
+ const e = Mt(r, h);
1381
+ if (!e) continue;
1382
+ const s = a ?? [], w = [
1323
1383
  {
1324
- x: n.sx,
1325
- y: n.sy
1384
+ x: e.sx,
1385
+ y: e.sy
1326
1386
  },
1327
- ...o,
1387
+ ...s,
1328
1388
  {
1329
- x: n.tx,
1330
- y: n.ty
1389
+ x: e.tx,
1390
+ y: e.ty
1331
1391
  }
1332
- ], d = t.data.bezierControls, w = r.length - 2;
1333
- for (let g = 0; g <= w; g++) {
1334
- const C = r[g], H = r[g + 1], h = d?.[g], R = Math.hypot(H.x - C.x, H.y - C.y), j = Math.max(30, R * 0.3), ht = h?.c1x ?? (g === 0 ? C.x + n.snx * j : C.x + (H.x - C.x) * 0.4), ee = h?.c1y ?? (g === 0 ? C.y + n.sny * j : C.y), Nt = h?.c2x ?? (g === w ? H.x + n.tnx * j : H.x - (H.x - C.x) * 0.4), Te = h?.c2y ?? (g === w ? H.y + n.tny * j : H.y);
1335
- x.moveTo(C.x, C.y).lineTo(ht, ee).stroke({
1392
+ ], m = r.data.bezierControls, R = w.length - 2;
1393
+ for (let G = 0; G <= R; G++) {
1394
+ const y = w[G], v = w[G + 1], U = m?.[G], et = Math.hypot(v.x - y.x, v.y - y.y), Lt = Math.max(30, et * 0.3), ae = U?.c1x ?? (G === 0 ? y.x + e.snx * Lt : y.x + (v.x - y.x) * 0.4), Gt = U?.c1y ?? (G === 0 ? y.y + e.sny * Lt : y.y), Be = U?.c2x ?? (G === R ? v.x + e.tnx * Lt : v.x - (v.x - y.x) * 0.4), Ke = U?.c2y ?? (G === R ? v.y + e.tny * Lt : v.y);
1395
+ g.moveTo(y.x, y.y).lineTo(ae, Gt).stroke({
1336
1396
  color: 10265519,
1337
- width: 1 * a
1338
- }), x.moveTo(H.x, H.y).lineTo(Nt, Te).stroke({
1397
+ width: 1 * t
1398
+ }), g.moveTo(v.x, v.y).lineTo(Be, Ke).stroke({
1339
1399
  color: 10265519,
1340
- width: 1 * a
1400
+ width: 1 * t
1341
1401
  });
1342
- const Pe = 4 * a;
1343
- x.circle(ht, ee, Pe).fill({ color: 16777215 }).stroke({
1402
+ const Ue = 4 * t;
1403
+ g.circle(ae, Gt, Ue).fill({ color: 16777215 }).stroke({
1344
1404
  color: 3900150,
1345
- width: 1.5 * a
1346
- }), x.circle(Nt, Te, Pe).fill({ color: 16777215 }).stroke({
1405
+ width: 1.5 * t
1406
+ }), g.circle(Be, Ke, Ue).fill({ color: 16777215 }).stroke({
1347
1407
  color: 3900150,
1348
- width: 1.5 * a
1408
+ width: 1.5 * t
1349
1409
  });
1350
1410
  }
1351
1411
  }
1352
1412
  }
1353
1413
  }
1354
- const p = Pt.current;
1355
- if (p && (p.clear(), I.nodeIds.size === 1 && Xt.current === "select")) {
1356
- const a = [...I.nodeIds][0], t = N.nodes.find((i) => i.id === a);
1357
- if (t) {
1358
- const i = v.zoom, n = t.position.x * i + v.x, o = t.position.y * i + v.y, r = t.width * i, d = t.height * i;
1359
- p.rect(n, o, r, d).stroke({
1414
+ const x = Ot.current;
1415
+ if (x && (x.clear(), z.nodeIds.size === 1 && Kt.current === "select")) {
1416
+ const t = [...z.nodeIds][0], r = k.nodes.find((d) => d.id === t);
1417
+ if (r) {
1418
+ const d = p.zoom, a = r.position.x * d + p.x, e = r.position.y * d + p.y, s = r.width * d, w = r.height * d;
1419
+ x.rect(a, e, s, w).stroke({
1360
1420
  color: 3900150,
1361
1421
  width: 1.5
1362
1422
  });
1363
- const w = 7, g = w / 2, C = [
1364
- [n, o],
1365
- [n + r, o],
1366
- [n + r, o + d],
1367
- [n, o + d]
1423
+ const m = 7, R = m / 2, G = [
1424
+ [a, e],
1425
+ [a + s, e],
1426
+ [a + s, e + w],
1427
+ [a, e + w]
1368
1428
  ];
1369
- for (const [R, j] of C) p.rect(R - g, j - g, w, w).fill({ color: 16777215 }).stroke({
1429
+ for (const [U, et] of G) x.rect(U - R, et - R, m, m).fill({ color: 16777215 }).stroke({
1370
1430
  color: 3900150,
1371
1431
  width: 1.5
1372
1432
  });
1373
- const H = 4, h = [
1374
- [n + r / 2, o],
1375
- [n + r, o + d / 2],
1376
- [n + r / 2, o + d],
1377
- [n, o + d / 2]
1433
+ const y = 4, v = [
1434
+ [a + s / 2, e],
1435
+ [a + s, e + w / 2],
1436
+ [a + s / 2, e + w],
1437
+ [a, e + w / 2]
1378
1438
  ];
1379
- for (const [R, j] of h) p.circle(R, j, H).fill({
1439
+ for (const [U, et] of v) x.circle(U, et, y).fill({
1380
1440
  color: 3900150,
1381
1441
  alpha: 0.9
1382
1442
  });
@@ -1384,72 +1444,87 @@ function Wn({ onPixiReady: F }) {
1384
1444
  }
1385
1445
  });
1386
1446
  };
1387
- return Y(), () => {
1388
- if (T = !0, l && !l.destroyed) try {
1447
+ return O(), () => {
1448
+ if (P = !0, l && !l.destroyed) try {
1389
1449
  l.app.stage.removeAllListeners();
1390
1450
  } catch {
1391
1451
  }
1392
- G.current?.destroy(), St.current?.destroy(), Kt.current?.destroy(), jt.current?.destroy(), Ut.current?.destroy(), se.current?.destroy(), ce.current?.destroy(), xt.current?.destroy(), Pt.current && (Pt.current.destroy(), Pt.current = null), Gt.current && (Gt.current.destroy(), Gt.current = null), Wt.current && (Wt.current.destroy(), Wt.current = null), At.current && (At.current.destroy(), At.current = null), Jt.current?.destroy();
1452
+ const Y = S.current;
1453
+ X && Y?.removeEventListener("touchstart", X), A && Y?.removeEventListener("touchmove", A), Z && (Y?.removeEventListener("touchend", Z), Y?.removeEventListener("touchcancel", Z)), H.current?.destroy(), Ct.current?.destroy(), ee.current?.destroy(), ne.current?.destroy(), re.current?.destroy(), ye.current?.destroy(), pe.current?.destroy(), xt.current?.destroy(), Ot.current && (Ot.current.destroy(), Ot.current = null), qt.current && (qt.current.destroy(), qt.current = null), Zt.current && (Zt.current.destroy(), Zt.current = null), Vt.current && (Vt.current.destroy(), Vt.current = null), se.current?.destroy();
1393
1454
  };
1394
- }, [D.current]), wt(() => {
1395
- const l = se.current, T = ce.current;
1396
- if (!(!l || !T))
1397
- switch (l.deactivate(), T.deactivate(), K) {
1455
+ }, [E.current]), bt(() => {
1456
+ const l = ye.current, P = pe.current;
1457
+ if (!(!l || !P))
1458
+ switch (l.deactivate(), P.deactivate(), K) {
1398
1459
  case "freehand":
1399
1460
  l.activate();
1400
1461
  break;
1401
1462
  case "line":
1402
- T.activate("straight");
1463
+ P.activate("straight");
1403
1464
  break;
1404
1465
  case "polyline":
1405
- T.activate("polyline");
1466
+ P.activate("polyline");
1406
1467
  break;
1407
1468
  case "arrow":
1408
- T.activate("arrow");
1469
+ P.activate("arrow");
1409
1470
  break;
1410
1471
  }
1411
- }, [K]), wt(() => {
1412
- G.current && (G.current.visible = U, G.current.gridSize = tt);
1413
- }, [U, tt]), wt(() => {
1414
- const l = E.current;
1472
+ }, [K]), bt(() => {
1473
+ H.current && (H.current.visible = j, H.current.gridSize = nt);
1474
+ }, [j, nt]), bt(() => {
1475
+ const l = S.current;
1415
1476
  if (!l) return;
1416
- const T = 1e-3, Y = (L) => {
1417
- L.preventDefault();
1418
- const q = $.current;
1419
- if (!q) return;
1420
- const X = l.getBoundingClientRect(), B = L.clientX - X.left, Q = L.clientY - X.top, ct = L.ctrlKey ? 3 : 1, bt = -L.deltaY * T * ct;
1421
- q.zoomAt(B, Q, 1 + bt);
1477
+ const P = 1e-3, X = (A) => {
1478
+ A.preventDefault();
1479
+ const Z = F.current;
1480
+ if (!Z) return;
1481
+ const O = l.getBoundingClientRect(), Y = A.clientX - O.left, dt = A.clientY - O.top, wt = A.ctrlKey ? 3 : 1, mt = -A.deltaY * P * wt;
1482
+ Z.zoomAt(Y, dt, 1 + mt);
1422
1483
  };
1423
- return l.addEventListener("wheel", Y, { passive: !1 }), () => l.removeEventListener("wheel", Y);
1424
- }, [$]), /* @__PURE__ */ ln("div", {
1484
+ return l.addEventListener("wheel", X, { passive: !1 }), () => l.removeEventListener("wheel", X);
1485
+ }, [F]), /* @__PURE__ */ Je("div", {
1425
1486
  style: {
1426
1487
  position: "relative",
1427
1488
  width: "100%",
1428
1489
  height: "100%"
1429
1490
  },
1430
- children: [/* @__PURE__ */ Le("div", {
1431
- ref: E,
1432
- className: "flow-canvas-wrapper",
1433
- tabIndex: -1,
1434
- onContextMenu: (l) => l.preventDefault()
1435
- }), at && ye && /* @__PURE__ */ Le("input", {
1436
- className: "flow-label-editor",
1437
- autoFocus: !0,
1438
- defaultValue: at.value,
1439
- style: {
1440
- left: ye.x,
1441
- top: ye.y
1442
- },
1443
- onKeyDown: (l) => {
1444
- l.key === "Enter" ? (l.preventDefault(), De(l.target.value)) : l.key === "Escape" && (l.preventDefault(), Ve()), l.stopPropagation();
1445
- },
1446
- onBlur: (l) => De(l.target.value),
1447
- onPointerDown: (l) => l.stopPropagation()
1448
- })]
1491
+ children: [
1492
+ /* @__PURE__ */ Ce("div", {
1493
+ ref: S,
1494
+ className: "flow-canvas-wrapper",
1495
+ tabIndex: -1,
1496
+ onContextMenu: (l) => l.preventDefault()
1497
+ }),
1498
+ ut && Ie && /* @__PURE__ */ Ce("input", {
1499
+ className: "flow-label-editor",
1500
+ autoFocus: !0,
1501
+ defaultValue: ut.value,
1502
+ style: {
1503
+ left: Ie.x,
1504
+ top: Ie.y
1505
+ },
1506
+ onFocus: (l) => l.currentTarget.select(),
1507
+ onKeyDown: (l) => {
1508
+ l.key === "Enter" ? (l.preventDefault(), _e(l.target.value)) : l.key === "Escape" && (l.preventDefault(), an()), l.stopPropagation();
1509
+ },
1510
+ onBlur: (l) => _e(l.target.value),
1511
+ onPointerDown: (l) => l.stopPropagation()
1512
+ }),
1513
+ Xt && !St && /* @__PURE__ */ Je("button", {
1514
+ type: "button",
1515
+ className: "flow-esc-button",
1516
+ onClick: () => Tt(null),
1517
+ title: "取消连续放置 (Esc)",
1518
+ children: [/* @__PURE__ */ Ce("span", {
1519
+ "aria-hidden": !0,
1520
+ children: "⎋"
1521
+ }), " 取消放置 (ESC)"]
1522
+ })
1523
+ ]
1449
1524
  });
1450
1525
  }
1451
1526
  export {
1452
- Wn as default
1527
+ $n as default
1453
1528
  };
1454
1529
 
1455
1530
  //# sourceMappingURL=FlowCanvas.js.map