@blueking/flow-canvas 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,26 +1,26 @@
1
- import { ref as q, computed as j, onScopeDispose as Je, defineComponent as fe, h as Re, watch as pe, onBeforeUnmount as Me, createElementBlock as R, openBlock as D, normalizeStyle as we, createElementVNode as U, createVNode as et, createCommentVNode as Y, normalizeClass as se, Transition as tt, withCtx as He, withModifiers as rt, createTextVNode as Le, renderSlot as xe, onMounted as ot, createBlock as be, Fragment as me, renderList as Ie, toDisplayString as ge, unref as le, reactive as at, resolveDynamicComponent as lt, Teleport as dt, nextTick as Oe, inject as ct, createApp as ut } from "vue";
2
- import { Graph as ft } from "@antv/x6";
3
- import { register as gt } from "@antv/x6-vue-shape";
4
- import { Selection as pt } from "@antv/x6-plugin-selection";
5
- import { MiniMap as ht } from "@antv/x6-plugin-minimap";
6
- function fn() {
1
+ import { ref as G, computed as j, onScopeDispose as Je, defineComponent as ge, h as Re, watch as he, onBeforeUnmount as Me, createElementBlock as T, openBlock as _, normalizeStyle as we, createElementVNode as q, createVNode as et, createCommentVNode as Z, normalizeClass as se, Transition as tt, withCtx as $e, withModifiers as at, createTextVNode as He, renderSlot as Ie, onMounted as ot, createBlock as be, Fragment as pe, renderList as xe, toDisplayString as ue, unref as le, reactive as lt, resolveDynamicComponent as dt, Teleport as ct, nextTick as Le, inject as ut, createApp as ft } from "vue";
2
+ import { Graph as gt } from "@antv/x6";
3
+ import { register as pt } from "@antv/x6-vue-shape";
4
+ import { Selection as ht } from "@antv/x6-plugin-selection";
5
+ import { MiniMap as vt } from "@antv/x6-plugin-minimap";
6
+ function pn() {
7
7
  return {
8
8
  version: "1.0",
9
9
  nodes: {},
10
10
  edges: {}
11
11
  };
12
12
  }
13
- class ue extends Error {
13
+ class fe extends Error {
14
14
  constructor(e) {
15
15
  super(e), this.name = "CanvasConstraintError";
16
16
  }
17
17
  }
18
- class vt extends Error {
18
+ class yt extends Error {
19
19
  constructor(e) {
20
20
  super(e), this.name = "CanvasSchemaError";
21
21
  }
22
22
  }
23
- function Ne(s, e, t) {
23
+ function De(s, e, t) {
24
24
  if (e.length === 0) {
25
25
  if (t === void 0) return;
26
26
  if (typeof t != "object" || t === null || Array.isArray(t))
@@ -36,189 +36,197 @@ function Ne(s, e, t) {
36
36
  const i = e[e.length - 1];
37
37
  return t === void 0 ? delete n[i] : n[i] = t, o;
38
38
  }
39
- function $e(s, e) {
39
+ function nt(s, e) {
40
40
  switch (e.type) {
41
41
  case "node.add":
42
- return yt(s, e.node);
42
+ return mt(s, e.node);
43
43
  case "node.move":
44
- return mt(s, e.nodeId, e.position);
44
+ return wt(s, e.nodeId, e.position);
45
45
  case "node.remove":
46
- return wt(s, e.nodeId);
46
+ return bt(s, e.nodeId);
47
47
  case "node.update":
48
- return bt(s, e.nodeId, e.patch);
48
+ return xt(s, e.nodeId, e.patch);
49
49
  case "node.set-payload":
50
50
  return Et(s, e.nodeId, e.path, e.value);
51
51
  case "node.set-extensions":
52
- return xt(s, e.nodeId, e.path, e.value);
52
+ return It(s, e.nodeId, e.path, e.value);
53
53
  case "edge.add":
54
- return It(s, e.edge);
54
+ return Ct(s, e.edge);
55
55
  case "edge.remove":
56
- return Ct(s, e.edgeId);
56
+ return kt(s, e.edgeId);
57
57
  case "edge.reconnect":
58
- return kt(s, e.edgeId, e.source, e.target);
58
+ return St(s, e.edgeId, e.source, e.target);
59
59
  case "edge.update":
60
- return St(s, e.edgeId, e.patch);
60
+ return Mt(s, e.edgeId, e.patch);
61
61
  case "edge.set-payload":
62
- return Mt(s, e.edgeId, e.path, e.value);
62
+ return Dt(s, e.edgeId, e.path, e.value);
63
63
  case "edge.label.update":
64
64
  return Nt(s, e.edgeId, e.labelId, e.patch);
65
65
  case "model.set-meta":
66
66
  return _t(s, e.path, e.value);
67
67
  default:
68
- throw new ue(`Unknown command type: ${e.type}`);
68
+ throw new fe(`Unknown command type: ${e.type}`);
69
69
  }
70
70
  }
71
71
  function Ce(s, e) {
72
72
  const t = s.nodes[e];
73
- if (!t) throw new ue(`Node "${e}" does not exist`);
73
+ if (!t) throw new fe(`Node "${e}" does not exist`);
74
74
  return t;
75
75
  }
76
76
  function ke(s, e) {
77
77
  const t = s.edges[e];
78
- if (!t) throw new ue(`Edge "${e}" does not exist`);
78
+ if (!t) throw new fe(`Edge "${e}" does not exist`);
79
79
  return t;
80
80
  }
81
81
  function Ee(s, e, t) {
82
82
  const o = s.nodes[e.nodeId];
83
83
  if (!o)
84
- throw new ue(`${t} node "${e.nodeId}" does not exist`);
84
+ throw new fe(`${t} node "${e.nodeId}" does not exist`);
85
85
  if (e.portId && o.ports && !o.ports.some((i) => i.id === e.portId))
86
- throw new ue(`${t} port "${e.portId}" not found on node "${e.nodeId}"`);
86
+ throw new fe(`${t} port "${e.portId}" not found on node "${e.nodeId}"`);
87
87
  }
88
- function _e(s, e, t) {
88
+ function Ne(s, e, t) {
89
89
  return { ...s, nodes: { ...s.nodes, [e]: t } };
90
90
  }
91
- function De(s, e, t) {
91
+ function _e(s, e, t) {
92
92
  return { ...s, edges: { ...s.edges, [e]: t } };
93
93
  }
94
- function yt(s, e) {
94
+ function mt(s, e) {
95
95
  if (s.nodes[e.id])
96
- throw new ue(`Node id "${e.id}" already exists`);
96
+ throw new fe(`Node id "${e.id}" already exists`);
97
97
  return { ...s, nodes: { ...s.nodes, [e.id]: e } };
98
98
  }
99
- function mt(s, e, t) {
99
+ function wt(s, e, t) {
100
100
  const o = Ce(s, e);
101
- return _e(s, e, { ...o, position: t });
101
+ return Ne(s, e, { ...o, position: t });
102
102
  }
103
- function wt(s, e) {
103
+ function bt(s, e) {
104
104
  Ce(s, e);
105
105
  const { [e]: t, ...o } = s.nodes, n = {};
106
106
  for (const [i, r] of Object.entries(s.edges))
107
107
  r.source.nodeId !== e && r.target.nodeId !== e && (n[i] = r);
108
108
  return { ...s, nodes: o, edges: n };
109
109
  }
110
- function bt(s, e, t) {
110
+ function xt(s, e, t) {
111
111
  const o = Ce(s, e);
112
- return _e(s, e, { ...o, ...t, id: o.id });
112
+ return Ne(s, e, { ...o, ...t, id: o.id });
113
113
  }
114
114
  function Et(s, e, t, o) {
115
- const n = Ce(s, e), i = Ne(n.payload, t, o);
116
- return _e(s, e, { ...n, payload: i });
115
+ const n = Ce(s, e), i = De(n.payload, t, o);
116
+ return Ne(s, e, { ...n, payload: i });
117
117
  }
118
- function xt(s, e, t, o) {
119
- const n = Ce(s, e), i = Ne(n.extensions, t, o);
120
- return _e(s, e, { ...n, extensions: i });
118
+ function It(s, e, t, o) {
119
+ const n = Ce(s, e), i = De(n.extensions, t, o);
120
+ return Ne(s, e, { ...n, extensions: i });
121
121
  }
122
- function It(s, e) {
122
+ function Ct(s, e) {
123
123
  if (s.edges[e.id])
124
- throw new ue(`Edge id "${e.id}" already exists`);
124
+ throw new fe(`Edge id "${e.id}" already exists`);
125
125
  if (Ee(s, e.source, "Source"), Ee(s, e.target, "Target"), e.labels) {
126
126
  const t = /* @__PURE__ */ new Set();
127
127
  for (const o of e.labels) {
128
128
  if (t.has(o.id))
129
- throw new ue(`Duplicate label id "${o.id}" in edge "${e.id}"`);
129
+ throw new fe(`Duplicate label id "${o.id}" in edge "${e.id}"`);
130
130
  t.add(o.id);
131
131
  }
132
132
  }
133
133
  return { ...s, edges: { ...s.edges, [e.id]: e } };
134
134
  }
135
- function Ct(s, e) {
135
+ function kt(s, e) {
136
136
  ke(s, e);
137
137
  const { [e]: t, ...o } = s.edges;
138
138
  return { ...s, edges: o };
139
139
  }
140
- function kt(s, e, t, o) {
140
+ function St(s, e, t, o) {
141
141
  const n = ke(s, e), i = t ?? n.source, r = o ?? n.target;
142
- return Ee(s, i, "Source"), Ee(s, r, "Target"), De(s, e, { ...n, source: i, target: r });
142
+ return Ee(s, i, "Source"), Ee(s, r, "Target"), _e(s, e, { ...n, source: i, target: r });
143
143
  }
144
- function St(s, e, t) {
144
+ function Mt(s, e, t) {
145
145
  const o = ke(s, e), n = { ...o, ...t, id: o.id };
146
- return t.source && Ee(s, n.source, "Source"), t.target && Ee(s, n.target, "Target"), De(s, e, n);
146
+ return t.source && Ee(s, n.source, "Source"), t.target && Ee(s, n.target, "Target"), _e(s, e, n);
147
147
  }
148
- function Mt(s, e, t, o) {
149
- const n = ke(s, e), i = Ne(n.payload, t, o);
150
- return De(s, e, { ...n, payload: i });
148
+ function Dt(s, e, t, o) {
149
+ const n = ke(s, e), i = De(n.payload, t, o);
150
+ return _e(s, e, { ...n, payload: i });
151
151
  }
152
152
  function Nt(s, e, t, o) {
153
153
  const n = ke(s, e);
154
154
  if (!n.labels)
155
- throw new ue(`Edge "${e}" has no labels`);
155
+ throw new fe(`Edge "${e}" has no labels`);
156
156
  const i = n.labels.findIndex((l) => l.id === t);
157
157
  if (i === -1)
158
- throw new ue(`Label "${t}" not found in edge "${e}"`);
158
+ throw new fe(`Label "${t}" not found in edge "${e}"`);
159
159
  const r = [...n.labels];
160
- return r[i] = { ...r[i], ...o, id: t }, De(s, e, { ...n, labels: r });
160
+ return r[i] = { ...r[i], ...o, id: t }, _e(s, e, { ...n, labels: r });
161
161
  }
162
162
  function _t(s, e, t) {
163
- const o = Ne(s.meta, e, t);
163
+ const o = De(s.meta, e, t);
164
164
  return { ...s, meta: o };
165
165
  }
166
- function Dt(s, e) {
167
- const t = e?.maxHistorySize ?? 100, o = q(s), n = [], i = [], r = q(!1), l = q(!1);
166
+ function At(s, e) {
167
+ const t = e?.maxHistorySize ?? 100, o = G(s), n = [], i = [], r = G(!1), l = G(!1);
168
168
  function a() {
169
169
  r.value = n.length > 0, l.value = i.length > 0;
170
170
  }
171
- function h(k) {
172
- const S = o.value;
173
- let T = S;
174
- for (const P of k.commands)
175
- T = $e(T, P);
176
- return n.push({ snapshot: S, envelope: k }), n.length > t && n.shift(), i.length = 0, o.value = T, a(), T;
171
+ function h(C) {
172
+ const M = o.value;
173
+ let R = M;
174
+ for (const A of C.commands)
175
+ R = nt(R, A);
176
+ if (!C.skipHistory) {
177
+ const A = e?.excludeCommandFromHistory, B = A ? C.commands.filter((V) => !A(V)) : C.commands;
178
+ if (B.length > 0) {
179
+ const V = B.length < C.commands.length ? { ...C, commands: B } : C;
180
+ n.push({ snapshot: M, envelope: V }), n.length > t && n.shift(), i.length = 0;
181
+ }
182
+ }
183
+ return o.value = R, a(), R;
177
184
  }
178
185
  function u() {
179
- const k = n.pop();
180
- return k ? (i.push({ snapshot: o.value, envelope: k.envelope }), o.value = k.snapshot, a(), k.snapshot) : null;
181
- }
182
- function g() {
183
- const k = i.pop();
184
- if (!k) return null;
185
- n.push({ snapshot: o.value, envelope: k.envelope });
186
- let S = o.value;
187
- for (const T of k.envelope.commands)
188
- S = $e(S, T);
189
- return o.value = S, a(), S;
186
+ const C = n.pop();
187
+ if (!C) return null;
188
+ i.push({ snapshot: o.value, envelope: C.envelope });
189
+ const M = e?.preserveMetaOnUndoRedo ? { ...C.snapshot, meta: o.value.meta } : C.snapshot;
190
+ return o.value = M, a(), M;
190
191
  }
191
192
  function p() {
193
+ const C = i.pop();
194
+ if (!C) return null;
195
+ n.push({ snapshot: o.value, envelope: C.envelope });
196
+ const M = e?.preserveMetaOnUndoRedo ? { ...C.snapshot, meta: o.value.meta } : C.snapshot;
197
+ return o.value = M, a(), M;
198
+ }
199
+ function g() {
192
200
  n.length = 0, i.length = 0, a();
193
201
  }
194
- function E() {
202
+ function x() {
195
203
  return o.value;
196
204
  }
197
- function m(k) {
198
- o.value = k, p();
205
+ function m(C) {
206
+ o.value = C, g();
199
207
  }
200
208
  return {
201
209
  currentFlowModel: o,
202
210
  execute: h,
203
211
  undo: u,
204
- redo: g,
212
+ redo: p,
205
213
  canUndo: r,
206
214
  canRedo: l,
207
215
  get undoStack() {
208
- return n.map((k) => k.envelope);
216
+ return n.map((C) => C.envelope);
209
217
  },
210
218
  get redoStack() {
211
- return i.map((k) => k.envelope);
219
+ return i.map((C) => C.envelope);
212
220
  },
213
- clear: p,
214
- createSnapshot: E,
221
+ clear: g,
222
+ createSnapshot: x,
215
223
  replaceFlowModel: m
216
224
  };
217
225
  }
218
- function At(s) {
226
+ function Pt(s) {
219
227
  return s !== null && typeof s == "object" && s.rejected === !0;
220
228
  }
221
- class Pt {
229
+ class Tt {
222
230
  plugins = [];
223
231
  editorContext = null;
224
232
  runtimeCtx = null;
@@ -283,7 +291,7 @@ class Pt {
283
291
  source: o.name
284
292
  }
285
293
  };
286
- if (At(i))
294
+ if (Pt(i))
287
295
  return {
288
296
  rejected: !0,
289
297
  error: {
@@ -376,48 +384,48 @@ class Pt {
376
384
  const n = o ?? e.commands;
377
385
  let i = t.flowModel.value;
378
386
  for (const r of n)
379
- i = $e(i, r);
387
+ i = nt(i, r);
380
388
  return i;
381
389
  }
382
390
  };
383
391
  }
384
392
  }
385
- let Tt = 0;
393
+ let Rt = 0;
386
394
  function te() {
387
395
  const s = Date.now().toString(36), e = Math.random().toString(36).substring(2, 8);
388
- return `${s}-${e}-${++Tt}`;
396
+ return `${s}-${e}-${++Rt}`;
389
397
  }
390
- const Ge = () => te();
391
- function gn(s) {
392
- const { schema: e, plugins: t = [], historyOptions: o } = s, n = s.idGenerator ?? Ge, i = { version: "1.0", ...s.initialFlowModel }, r = Dt(i, o), l = q(s.mode ?? "edit"), a = q(!1), h = q(null), u = q([]), g = {}, p = new Pt();
393
- function E(T, P, G, K = "user:toolbar") {
398
+ const Be = () => te();
399
+ function hn(s) {
400
+ const { schema: e, plugins: t = [], historyOptions: o } = s, n = s.idGenerator ?? Be, i = { version: "1.0", ...s.initialFlowModel }, r = At(i, o), l = G(s.mode ?? "edit"), a = G(!1), h = G(null), u = G([]), p = {}, g = new Tt();
401
+ function x(R, A, B, V = "user:toolbar") {
394
402
  const O = {
395
403
  id: `history-${Date.now()}`,
396
- source: K,
397
- label: T,
404
+ source: V,
405
+ label: R,
398
406
  timestamp: Date.now(),
399
407
  commands: []
400
408
  };
401
- p.afterCommand(O, P, G), u.value = p.collectToolbarItems(), s.onCommandResult?.({
409
+ g.afterCommand(O, A, B), u.value = g.collectToolbarItems(), s.onCommandResult?.({
402
410
  status: "applied",
403
411
  envelope: O,
404
- flowModel: G
412
+ flowModel: B
405
413
  }), s.onFlowModelChange?.({
406
- flowModel: G,
407
- prevFlowModel: P,
414
+ flowModel: B,
415
+ prevFlowModel: A,
408
416
  envelope: O,
409
- source: K
417
+ source: V
410
418
  });
411
419
  }
412
420
  const m = {
413
421
  execute: r.execute,
414
422
  undo() {
415
- const T = r.currentFlowModel.value, P = r.undo();
416
- return P && E("撤销", T, P), P;
423
+ const R = r.currentFlowModel.value, A = r.undo();
424
+ return A && x("撤销", R, A), A;
417
425
  },
418
426
  redo() {
419
- const T = r.currentFlowModel.value, P = r.redo();
420
- return P && E("重做", T, P), P;
427
+ const R = r.currentFlowModel.value, A = r.redo();
428
+ return A && x("重做", R, A), A;
421
429
  },
422
430
  get canUndo() {
423
431
  return r.canUndo;
@@ -433,73 +441,73 @@ function gn(s) {
433
441
  },
434
442
  clear: r.clear,
435
443
  createSnapshot: r.createSnapshot,
436
- replaceFlowModel(T) {
437
- const P = r.currentFlowModel.value;
438
- r.replaceFlowModel(T), E("替换 FlowModel", P, T, "system:replace");
444
+ replaceFlowModel(R) {
445
+ const A = r.currentFlowModel.value;
446
+ r.replaceFlowModel(R), x("替换 FlowModel", A, R, "system:replace");
439
447
  }
440
- }, k = {
448
+ }, C = {
441
449
  flowModel: j(() => r.currentFlowModel.value),
442
450
  history: m,
443
451
  schema: e,
444
452
  mode: l,
445
453
  idGenerator: n,
446
- executeCommand: S,
447
- replaceFlowModel(T) {
448
- m.replaceFlowModel(T);
454
+ executeCommand: M,
455
+ replaceFlowModel(R) {
456
+ m.replaceFlowModel(R);
449
457
  },
450
- setMode(T) {
451
- l.value = T;
458
+ setMode(R) {
459
+ l.value = R;
452
460
  },
453
461
  selectionMode: a,
454
- setSelectionMode(T) {
455
- a.value = T;
462
+ setSelectionMode(R) {
463
+ a.value = R;
456
464
  },
457
465
  api: h,
458
466
  toolbarItems: u,
459
- extendedApi: g,
460
- _pluginManager: p,
461
- _emitUiEvent: (T) => {
462
- p.dispatchUiEvent(T);
467
+ extendedApi: p,
468
+ _pluginManager: g,
469
+ _emitUiEvent: (R) => {
470
+ g.dispatchUiEvent(R);
463
471
  }
464
472
  };
465
- p.install(t, {
466
- flowModel: k.flowModel,
473
+ g.install(t, {
474
+ flowModel: C.flowModel,
467
475
  history: m,
468
476
  schema: e,
469
477
  mode: l,
470
478
  idGenerator: n,
471
- executeCommand: S
472
- }), u.value = p.collectToolbarItems(), Je(() => {
473
- p.dispose();
479
+ executeCommand: M
480
+ }), u.value = g.collectToolbarItems(), Je(() => {
481
+ g.dispose();
474
482
  });
475
- function S(T) {
476
- const P = p.transformCommand(T);
477
- if ("rejected" in P) {
483
+ function M(R) {
484
+ const A = g.transformCommand(R);
485
+ if ("rejected" in A) {
478
486
  const O = {
479
487
  status: "rejected",
480
- envelope: T,
481
- error: P.error
488
+ envelope: R,
489
+ error: A.error
482
490
  };
483
491
  return s.onCommandResult?.(O), O;
484
492
  }
485
- const G = P.envelope, K = r.currentFlowModel.value;
493
+ const B = A.envelope, V = r.currentFlowModel.value;
486
494
  try {
487
- const O = r.execute(G), W = {
495
+ const O = r.execute(B), W = {
488
496
  status: "applied",
489
- envelope: G,
497
+ envelope: B,
490
498
  flowModel: O
491
499
  };
492
- return p.afterCommand(G, K, O), u.value = p.collectToolbarItems(), s.onCommandResult?.(W), s.onFlowModelChange?.({
500
+ return g.afterCommand(B, V, O), u.value = g.collectToolbarItems(), s.onCommandResult?.(W), s.onFlowModelChange?.({
493
501
  flowModel: O,
494
- prevFlowModel: K,
495
- envelope: G,
496
- source: G.source
502
+ prevFlowModel: V,
503
+ envelope: B,
504
+ source: B.source
497
505
  }), W;
498
506
  } catch (O) {
499
- if (O instanceof ue) {
507
+ if (O instanceof fe) {
500
508
  const W = {
501
509
  status: "invalid",
502
- envelope: G,
510
+ envelope: B,
503
511
  error: {
504
512
  code: "constraint_violated",
505
513
  reason: O.message,
@@ -511,17 +519,17 @@ function gn(s) {
511
519
  throw O;
512
520
  }
513
521
  }
514
- return k;
522
+ return C;
515
523
  }
516
- const Rt = ["top", "right", "bottom", "left"];
517
- function nt() {
518
- return Rt.map((s) => ({ id: s, group: s }));
524
+ const Lt = ["top", "right", "bottom", "left"];
525
+ function st() {
526
+ return Lt.map((s) => ({ id: s, group: s }));
519
527
  }
520
- function qe(s, e) {
521
- return e?.(s) ?? s.ports ?? nt();
528
+ function Fe(s, e) {
529
+ return e?.(s) ?? s.ports ?? st();
522
530
  }
523
- const Te = -1, Lt = "flow-canvas-node-ring-target", Fe = "flow-canvas-node-ring-target--decorated", Ue = "flow-canvas-node-ring-target--pulse", Ot = "linear-gradient(135deg, #cadcfa 0%, #cee0ff 100%)";
524
- class $t {
531
+ const Te = -1, Ot = "flow-canvas-node-ring-target", Ge = "flow-canvas-node-ring-target--decorated", qe = "flow-canvas-node-ring-target--pulse", $t = "linear-gradient(135deg, #cadcfa 0%, #cee0ff 100%)";
532
+ class Bt {
525
533
  graph;
526
534
  schema;
527
535
  shapeRegistry;
@@ -546,6 +554,7 @@ class $t {
546
554
  /** x6EdgeConfig 中 attrs.line 的基线值,清理时恢复而非删除 */
547
555
  edgeDefaultAttrs = /* @__PURE__ */ new Map();
548
556
  lastModel = null;
557
+ pendingDecorationRAFs = /* @__PURE__ */ new Map();
549
558
  constructor(e, t, o, n, i, r) {
550
559
  this.graph = e, this.schema = t, this.shapeRegistry = o, this.resolveNodeDecoration = n, this.resolveEdgeDecoration = i, this.resolveCanvasContext = r;
551
560
  }
@@ -621,17 +630,19 @@ class $t {
621
630
  e.removeAttrByPath(r), i !== void 0 && e.setAttrByPath(r, i);
622
631
  }
623
632
  dispose() {
624
- this.knownNodeIds.clear(), this.knownEdgeIds.clear();
633
+ for (const e of this.pendingDecorationRAFs.values())
634
+ cancelAnimationFrame(e);
635
+ this.pendingDecorationRAFs.clear(), this.knownNodeIds.clear(), this.knownEdgeIds.clear();
625
636
  }
626
637
  resolveNodes(e) {
627
638
  const t = /* @__PURE__ */ new Map();
628
639
  for (const [o, n] of Object.entries(e.nodes)) {
629
640
  const i = this.schema.nodeTypes[n.type];
630
641
  if (!i)
631
- throw new vt(
642
+ throw new yt(
632
643
  `Unknown node type "${n.type}" for node "${o}". Registered types: [${Object.keys(this.schema.nodeTypes).join(", ")}]. Register the type in CanvasSchema.nodeTypes before using it in a FlowModel.`
633
644
  );
634
- const r = this.shapeRegistry.registerNodeType(n.type, i.component), l = i.getSize(n), a = qe(n, i.getPorts);
645
+ const r = this.shapeRegistry.registerNodeType(n.type, i.component), l = i.getSize(n), a = Fe(n, i.getPorts);
635
646
  t.set(o, { model: n, definition: i, shapeName: r, size: l, ports: a });
636
647
  }
637
648
  return t;
@@ -650,6 +661,8 @@ class $t {
650
661
  if (!t.has(o)) {
651
662
  const n = this.graph.getCellById(o);
652
663
  n && this.graph.removeCell(n), this.knownNodeIds.delete(o), this.defaultHighlightedNodeIds.delete(o), this.prevNodeDecorationClasses.delete(o), this.prevNodeDecorationColors.delete(o), this.nodeDefaultAttrs.delete(o);
664
+ const i = this.pendingDecorationRAFs.get(o);
665
+ i && (cancelAnimationFrame(i), this.pendingDecorationRAFs.delete(o));
653
666
  }
654
667
  for (const [o, n] of e) {
655
668
  const i = this.graph.getCellById(o);
@@ -716,7 +729,27 @@ class $t {
716
729
  };
717
730
  this.graph.addNode(a), this.knownNodeIds.add(e), this.saveNodeDefaultAttrs(e, l);
718
731
  const h = this.graph.getCellById(e);
719
- h && (this.applyNodeBehavior(h, o, l), this.applyNodeHighlightAndDecoration(h, o));
732
+ h && (this.applyNodeBehavior(h, o, l), this.applyNodeHighlightAndDecoration(h, o), this.scheduleDecorationRetryIfNeeded(h, o));
733
+ }
734
+ /**
735
+ * Vue Shape 组件在 foreignObject 内异步挂载,addNewNode 同步调用
736
+ * applyNodeHighlightAndDecoration 时 ringTarget DOM 可能尚不存在。
737
+ * 延迟一帧重试,确保装饰环在节点首次渲染后即正确显示,
738
+ * 避免后续 refreshNodeHighlights 触发时装饰环才首次出现。
739
+ */
740
+ scheduleDecorationRetryIfNeeded(e, t) {
741
+ const o = this.graph.findViewByCell(e)?.container;
742
+ if (this.getNodeRingTarget(o)) return;
743
+ const n = e.id, i = this.pendingDecorationRAFs.get(n);
744
+ i && cancelAnimationFrame(i);
745
+ const r = requestAnimationFrame(() => {
746
+ if (this.pendingDecorationRAFs.delete(n), !this.knownNodeIds.has(n)) return;
747
+ const l = this.lastModel?.nodes[n];
748
+ if (!l) return;
749
+ const a = this.graph.getCellById(n);
750
+ a?.isNode() && this.applyNodeHighlightAndDecoration(a, l);
751
+ });
752
+ this.pendingDecorationRAFs.set(n, r);
720
753
  }
721
754
  /**
722
755
  * 将 schema 定义的 getBehavior 映射到 X6 节点属性。
@@ -771,12 +804,12 @@ class $t {
771
804
  const u = (e.getData()?.type ?? void 0) !== (t.type ?? void 0);
772
805
  if (u) {
773
806
  if (o?.router) {
774
- const g = typeof o.router == "string" ? { name: o.router } : o.router;
775
- e.setRouter(g);
807
+ const p = typeof o.router == "string" ? { name: o.router } : o.router;
808
+ e.setRouter(p);
776
809
  }
777
810
  if (o?.connector) {
778
- const g = typeof o.connector == "string" ? { name: o.connector } : o.connector;
779
- e.setConnector(g);
811
+ const p = typeof o.connector == "string" ? { name: o.connector } : o.connector;
812
+ e.setConnector(p);
780
813
  }
781
814
  }
782
815
  (u || l || a) && (this.syncEdgeMarker(e, o, "sourceMarker"), this.syncEdgeMarker(e, o, "targetMarker")), this.syncEdgeLabels(e, t), e.getZIndex() !== Te && e.setZIndex(Te), e.setData({ ...t }, { silent: !0 }), this.applyEdgeStyleAndDecoration(e, t, o);
@@ -860,11 +893,11 @@ class $t {
860
893
  applyNodeHighlightAndDecoration(e, t) {
861
894
  const o = this.highlightedNodeIds.has(e.id), n = this.resolveNodeDecoration?.(t), i = this.graph.findViewByCell(e)?.container, r = this.getNodeRingTarget(i), l = this.prevNodeDecorationClasses.get(e.id);
862
895
  l && (i?.classList.remove(l), this.prevNodeDecorationClasses.delete(e.id)), n?.className && (i?.classList.add(n.className), this.prevNodeDecorationClasses.set(e.id, n.className));
863
- const a = n?.borderColor, u = a ?? (o ? "#3a84ff" : void 0), g = this.prevNodeDecorationColors.has(e.id) || this.defaultHighlightedNodeIds.has(e.id);
864
- u ? (e.setAttrByPath("body/stroke", u), e.setAttrByPath("body/strokeWidth", 2)) : g && (this.restoreNodeAttr(e, "body/stroke", "stroke"), this.restoreNodeAttr(e, "body/strokeWidth", "strokeWidth")), r && (r.classList.add(Lt), a ? (r.classList.add(Fe), r.style.setProperty("--flow-canvas-node-decoration-ring-background", a), r.style.setProperty("--flow-canvas-node-decoration-ring-opacity", "0.95")) : (r.classList.remove(Fe), r.style.removeProperty("--flow-canvas-node-decoration-ring-background"), r.style.removeProperty("--flow-canvas-node-decoration-ring-opacity")), o ? (r.classList.add(Ue), r.style.setProperty(
896
+ const a = n?.borderColor, u = a ?? (o ? "#3a84ff" : void 0), p = this.prevNodeDecorationColors.has(e.id) || this.defaultHighlightedNodeIds.has(e.id);
897
+ u ? (e.setAttrByPath("body/stroke", u), e.setAttrByPath("body/strokeWidth", 2)) : p && (this.restoreNodeAttr(e, "body/stroke", "stroke"), this.restoreNodeAttr(e, "body/strokeWidth", "strokeWidth")), r && (r.classList.add(Ot), a ? (r.classList.add(Ge), r.style.setProperty("--flow-canvas-node-decoration-ring-background", a), r.style.setProperty("--flow-canvas-node-decoration-ring-opacity", "0.95")) : (r.classList.remove(Ge), r.style.removeProperty("--flow-canvas-node-decoration-ring-background"), r.style.removeProperty("--flow-canvas-node-decoration-ring-opacity")), o ? (r.classList.add(qe), r.style.setProperty(
865
898
  "--flow-canvas-node-pulse-ring-background",
866
- a ?? Ot
867
- ), r.style.setProperty("--flow-canvas-node-pulse-ring-opacity", "0.95")) : (r.classList.remove(Ue), r.style.removeProperty("--flow-canvas-node-pulse-ring-background"), r.style.removeProperty("--flow-canvas-node-pulse-ring-opacity"))), a ? this.prevNodeDecorationColors.add(e.id) : this.prevNodeDecorationColors.delete(e.id), o && !a ? this.defaultHighlightedNodeIds.add(e.id) : this.defaultHighlightedNodeIds.delete(e.id);
899
+ a ?? $t
900
+ ), r.style.setProperty("--flow-canvas-node-pulse-ring-opacity", "0.95")) : (r.classList.remove(qe), r.style.removeProperty("--flow-canvas-node-pulse-ring-background"), r.style.removeProperty("--flow-canvas-node-pulse-ring-opacity"))), a ? this.prevNodeDecorationColors.add(e.id) : this.prevNodeDecorationColors.delete(e.id), o && !a ? this.defaultHighlightedNodeIds.add(e.id) : this.defaultHighlightedNodeIds.delete(e.id);
868
901
  }
869
902
  getHoveredEdgeId() {
870
903
  return this.hoveredEdgeId;
@@ -895,14 +928,14 @@ class $t {
895
928
  r && (this.graph.findViewByCell(e)?.container?.classList.remove(r), this.prevEdgeDecorationClasses.delete(e.id)), i?.className && (this.graph.findViewByCell(e)?.container?.classList.add(i.className), this.prevEdgeDecorationClasses.set(e.id, i.className));
896
929
  let l, a, h;
897
930
  if (o?.style) {
898
- const m = this.graph.isSelected?.(e) ?? !1, k = this.hoveredEdgeId === e.id, S = o.style(t, { selected: m, highlighted: n, hovered: k });
899
- l = S.stroke, a = S.strokeWidth, h = S.strokeDasharray;
931
+ const m = this.graph.isSelected?.(e) ?? !1, C = this.hoveredEdgeId === e.id, M = o.style(t, { selected: m, highlighted: n, hovered: C });
932
+ l = M.stroke, a = M.strokeWidth, h = M.strokeDasharray;
900
933
  }
901
- const u = !o?.style && n ? "#3a84ff" : void 0, g = i?.strokeColor, p = g ?? l ?? u, E = !!o?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
902
- p ? this.setEdgeAttrIfChanged(e, "line/stroke", p) : E && this.restoreEdgeAttr(e, "line/stroke", "stroke"), o?.style ? (this.prevEdgeStyleIds.add(e.id), a ? this.setEdgeAttrIfChanged(e, "line/strokeWidth", a) : this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), h ? this.setEdgeAttrIfChanged(e, "line/strokeDasharray", h) : this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray")) : this.prevEdgeStyleIds.has(e.id) && (this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray"), this.prevEdgeStyleIds.delete(e.id)), g ? this.prevEdgeDecorationColors.add(e.id) : this.prevEdgeDecorationColors.delete(e.id), u ? this.defaultHighlightedEdgeIds.add(e.id) : this.defaultHighlightedEdgeIds.delete(e.id);
934
+ const u = !o?.style && n ? "#3a84ff" : void 0, p = i?.strokeColor, g = p ?? l ?? u, x = !!o?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
935
+ g ? this.setEdgeAttrIfChanged(e, "line/stroke", g) : x && this.restoreEdgeAttr(e, "line/stroke", "stroke"), o?.style ? (this.prevEdgeStyleIds.add(e.id), a ? this.setEdgeAttrIfChanged(e, "line/strokeWidth", a) : this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), h ? this.setEdgeAttrIfChanged(e, "line/strokeDasharray", h) : this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray")) : this.prevEdgeStyleIds.has(e.id) && (this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray"), this.prevEdgeStyleIds.delete(e.id)), p ? this.prevEdgeDecorationColors.add(e.id) : this.prevEdgeDecorationColors.delete(e.id), u ? this.defaultHighlightedEdgeIds.add(e.id) : this.defaultHighlightedEdgeIds.delete(e.id);
903
936
  }
904
937
  }
905
- class Bt {
938
+ class Ft {
906
939
  instanceId = te();
907
940
  registeredShapes = /* @__PURE__ */ new Map();
908
941
  wrappedComponents = /* @__PURE__ */ new Map();
@@ -913,12 +946,12 @@ class Bt {
913
946
  registerNodeType(e, t) {
914
947
  const o = this.getShapeName(e);
915
948
  let n = this.wrappedComponents.get(e);
916
- return n || (n = fe({
949
+ return n || (n = ge({
917
950
  name: `FlowCanvasNodeShape${e.replace(/(^|[-_])(\w)/g, (i, r, l) => l.toUpperCase())}`,
918
951
  setup() {
919
952
  return () => Re("div", { class: "flow-canvas-node-surface" }, [Re(t)]);
920
953
  }
921
- }), this.wrappedComponents.set(e, n)), gt({
954
+ }), this.wrappedComponents.set(e, n)), pt({
922
955
  shape: o,
923
956
  component: n,
924
957
  width: 100,
@@ -937,7 +970,7 @@ class Ht {
937
970
  idGenerator;
938
971
  disposers = [];
939
972
  constructor(e, t, o, n, i) {
940
- this.graph = e, this.onUiEvent = t, this.onCommand = o, this.flowModelRef = n, this.idGenerator = i ?? Ge, this.bindEvents();
973
+ this.graph = e, this.onUiEvent = t, this.onCommand = o, this.flowModelRef = n, this.idGenerator = i ?? Be, this.bindEvents();
941
974
  }
942
975
  dispose() {
943
976
  for (const e of this.disposers) e();
@@ -1055,7 +1088,7 @@ function Gt(s) {
1055
1088
  getNodeScreenRect: e
1056
1089
  };
1057
1090
  }
1058
- function st(s) {
1091
+ function it(s) {
1059
1092
  return {
1060
1093
  nodeIds: s.filter((e) => e.isNode()).map((e) => e.id),
1061
1094
  edgeIds: s.filter((e) => e.isEdge()).map((e) => e.id)
@@ -1072,7 +1105,7 @@ function qt(s, e) {
1072
1105
  const n = s.localToGraph(o);
1073
1106
  return new DOMRect(n.x, n.y, n.width, n.height);
1074
1107
  }
1075
- function it(s, e, t) {
1108
+ function rt(s, e, t) {
1076
1109
  const o = s.nodeIds.filter((r) => {
1077
1110
  const l = e.nodes[r];
1078
1111
  if (!l) return !1;
@@ -1084,14 +1117,14 @@ function it(s, e, t) {
1084
1117
  });
1085
1118
  return { nodeIds: o, edgeIds: i };
1086
1119
  }
1087
- function Ft(s) {
1120
+ function Ut(s) {
1088
1121
  return [
1089
1122
  ...s.edgeIds.map((e) => ({ type: "edge.remove", edgeId: e })),
1090
1123
  ...s.nodeIds.map((e) => ({ type: "node.remove", nodeId: e }))
1091
1124
  ];
1092
1125
  }
1093
- const Ut = 100;
1094
- function zt({
1126
+ const zt = 100;
1127
+ function jt({
1095
1128
  graph: s,
1096
1129
  overlayManager: e,
1097
1130
  executeCommand: t,
@@ -1104,11 +1137,11 @@ function zt({
1104
1137
  onHighlightChange: h,
1105
1138
  resolveNodeShape: u
1106
1139
  }) {
1107
- const g = r ?? Ge;
1108
- let p = [], E = [], m = null, k = !1, S = null;
1109
- async function T() {
1110
- if (k) return m;
1111
- k = !0;
1140
+ const p = r ?? Be;
1141
+ let g = [], x = [], m = null, C = !1, M = null;
1142
+ async function R() {
1143
+ if (C) return m;
1144
+ C = !0;
1112
1145
  try {
1113
1146
  const f = await import("@antv/x6-plugin-dnd"), d = f.Dnd ?? f.default;
1114
1147
  return d ? (m = new d({
@@ -1122,18 +1155,18 @@ function zt({
1122
1155
  return console.warn("[flow-canvas] @antv/x6-plugin-dnd not available, add it to your dependencies"), null;
1123
1156
  }
1124
1157
  }
1125
- function P() {
1158
+ function A() {
1126
1159
  return new Promise((f) => {
1127
1160
  requestAnimationFrame(() => requestAnimationFrame(() => f()));
1128
1161
  });
1129
1162
  }
1130
- const G = ({ node: f }) => {
1163
+ const B = ({ node: f }) => {
1131
1164
  const d = f.getData?.();
1132
- if (!d?._dndSessionId || d._dndSessionId !== S) return;
1133
- S = null;
1165
+ if (!d?._dndSessionId || d._dndSessionId !== M) return;
1166
+ M = null;
1134
1167
  const c = f.getPosition();
1135
1168
  s.removeNode(f.id);
1136
- const { _dndSessionId: v, ...b } = d, x = b.id || g("node");
1169
+ const { _dndSessionId: v, ...b } = d, E = b.id || p("node");
1137
1170
  t({
1138
1171
  id: te(),
1139
1172
  source: "user:drag",
@@ -1142,18 +1175,18 @@ function zt({
1142
1175
  commands: [
1143
1176
  {
1144
1177
  type: "node.add",
1145
- node: { ...b, id: x, position: { x: c.x, y: c.y } }
1178
+ node: { ...b, id: E, position: { x: c.x, y: c.y } }
1146
1179
  }
1147
1180
  ]
1148
1181
  });
1149
1182
  };
1150
- s.on("node:added", G);
1151
- function K(f) {
1183
+ s.on("node:added", B);
1184
+ function V(f) {
1152
1185
  const d = o.nodeTypes[f.type];
1153
- return qe(f, d?.getPorts);
1186
+ return Fe(f, d?.getPorts);
1154
1187
  }
1155
1188
  function O(f) {
1156
- return f ?? st(s.getSelectedCells?.() ?? []);
1189
+ return f ?? it(s.getSelectedCells?.() ?? []);
1157
1190
  }
1158
1191
  function W(f, d, c, v, b) {
1159
1192
  switch (f) {
@@ -1191,7 +1224,7 @@ function zt({
1191
1224
  return { x: d.width + c, y: 0 };
1192
1225
  }
1193
1226
  }
1194
- function M(f) {
1227
+ function D(f) {
1195
1228
  switch (f) {
1196
1229
  case "left":
1197
1230
  return "right";
@@ -1248,7 +1281,7 @@ function zt({
1248
1281
  f?.length && s.unselect?.(f);
1249
1282
  },
1250
1283
  deleteSelection(f) {
1251
- const d = O(f?.selection), c = it(d, n.value, i ?? (() => ({}))), v = Ft(c);
1284
+ const d = O(f?.selection), c = rt(d, n.value, i ?? (() => ({}))), v = Ut(c);
1252
1285
  if (v.length === 0) return null;
1253
1286
  const b = t({
1254
1287
  id: te(),
@@ -1261,17 +1294,17 @@ function zt({
1261
1294
  },
1262
1295
  registerDndSource(f, d) {
1263
1296
  const c = async (v) => {
1264
- const b = await T();
1297
+ const b = await R();
1265
1298
  if (!b) return;
1266
- const x = te();
1267
- S = x;
1268
- const B = d(), X = u?.(B.type), C = s.createNode({
1269
- width: X?.width ?? 154,
1270
- height: X?.height ?? 54,
1271
- shape: X?.shapeName ?? "rect",
1272
- data: { ...B, _dndSessionId: x }
1299
+ const E = te();
1300
+ M = E;
1301
+ const F = d(), K = u?.(F.type), k = s.createNode({
1302
+ width: K?.width ?? 154,
1303
+ height: K?.height ?? 54,
1304
+ shape: K?.shapeName ?? "rect",
1305
+ data: { ...F, _dndSessionId: E }
1273
1306
  });
1274
- b.start(C, v);
1307
+ b.start(k, v);
1275
1308
  };
1276
1309
  return f.addEventListener("mousedown", c), () => {
1277
1310
  f.removeEventListener("mousedown", c);
@@ -1286,9 +1319,9 @@ function zt({
1286
1319
  if (!c?.isNode()) return;
1287
1320
  const v = c, b = s.findViewByCell(v);
1288
1321
  if (!b) return;
1289
- const x = b.findPortElem(d, "circle") ?? b.findPortElem(d);
1290
- if (!x) return;
1291
- const X = (x.matches?.("[magnet]") ? x : x.querySelector?.("[magnet]")) ?? x, C = X.getBoundingClientRect(), L = C.left + C.width / 2, w = C.top + C.height / 2, A = new MouseEvent("mousedown", {
1322
+ const E = b.findPortElem(d, "circle") ?? b.findPortElem(d);
1323
+ if (!E) return;
1324
+ const K = (E.matches?.("[magnet]") ? E : E.querySelector?.("[magnet]")) ?? E, k = K.getBoundingClientRect(), L = k.left + k.width / 2, w = k.top + k.height / 2, P = new MouseEvent("mousedown", {
1292
1325
  clientX: L,
1293
1326
  clientY: w,
1294
1327
  button: 0,
@@ -1296,21 +1329,21 @@ function zt({
1296
1329
  bubbles: !0,
1297
1330
  cancelable: !0
1298
1331
  });
1299
- X.dispatchEvent(A);
1332
+ K.dispatchEvent(P);
1300
1333
  },
1301
1334
  async exportAsImage(f) {
1302
- const { domToBlob: d } = await import("modern-screenshot"), c = f?.padding ?? 20, v = f?.backgroundColor ?? s.options.background?.color ?? "#ffffff", b = s.zoom(), x = s.translate(), B = s.getContentBBox(), X = B.width / b, C = B.height / b;
1303
- if (X === 0 || C === 0)
1335
+ const { domToBlob: d } = await import("modern-screenshot"), c = f?.padding ?? 20, v = f?.backgroundColor ?? s.options.background?.color ?? "#ffffff", b = s.zoom(), E = s.translate(), F = s.getContentBBox(), K = F.width / b, k = F.height / b;
1336
+ if (K === 0 || k === 0)
1304
1337
  return new Blob();
1305
- const L = (B.x - x.tx) / b, w = (B.y - x.ty) / b, A = Math.ceil(X + c * 2), H = Math.ceil(C + c * 2), Z = document.createElement("div");
1306
- Z.style.cssText = "position:fixed;left:-99999px;top:0;pointer-events:none;";
1307
- const V = s.container.cloneNode(!0);
1308
- V.style.width = `${A}px`, V.style.height = `${H}px`, V.style.overflow = "visible";
1309
- const ee = V.querySelector("svg");
1310
- ee && (ee.setAttribute("width", String(A)), ee.setAttribute("height", String(H)), ee.style.width = `${A}px`, ee.style.height = `${H}px`), V.querySelector(".x6-graph-svg-viewport")?.setAttribute("transform", `matrix(1,0,0,1,${-L + c},${-w + c})`), Z.appendChild(V), document.body.appendChild(Z);
1338
+ const L = (F.x - E.tx) / b, w = (F.y - E.ty) / b, P = Math.ceil(K + c * 2), H = Math.ceil(k + c * 2), Y = document.createElement("div");
1339
+ Y.style.cssText = "position:fixed;left:-99999px;top:0;pointer-events:none;";
1340
+ const X = s.container.cloneNode(!0);
1341
+ X.style.width = `${P}px`, X.style.height = `${H}px`, X.style.overflow = "visible";
1342
+ const ee = X.querySelector("svg");
1343
+ ee && (ee.setAttribute("width", String(P)), ee.setAttribute("height", String(H)), ee.style.width = `${P}px`, ee.style.height = `${H}px`), X.querySelector(".x6-graph-svg-viewport")?.setAttribute("transform", `matrix(1,0,0,1,${-L + c},${-w + c})`), Y.appendChild(X), document.body.appendChild(Y);
1311
1344
  try {
1312
- return await P(), await d(V, {
1313
- width: A,
1345
+ return await A(), await d(X, {
1346
+ width: P,
1314
1347
  height: H,
1315
1348
  backgroundColor: v,
1316
1349
  scale: f?.scale ?? window.devicePixelRatio,
@@ -1326,17 +1359,17 @@ function zt({
1326
1359
  } catch (oe) {
1327
1360
  return console.warn("[flow-canvas] Export failed:", oe), new Blob();
1328
1361
  } finally {
1329
- Z.remove();
1362
+ Y.remove();
1330
1363
  }
1331
1364
  },
1332
1365
  highlightNodes(f) {
1333
- p = f, h?.(p, E);
1366
+ g = f, h?.(g, x);
1334
1367
  },
1335
1368
  highlightEdges(f) {
1336
- E = f, h?.(p, E);
1369
+ x = f, h?.(g, x);
1337
1370
  },
1338
1371
  clearHighlight() {
1339
- p = [], E = [], h?.([], []);
1372
+ g = [], x = [], h?.([], []);
1340
1373
  },
1341
1374
  overlay: e,
1342
1375
  getContextMenuItems(f) {
@@ -1350,47 +1383,47 @@ function zt({
1350
1383
  envelope: { id: "", source: "user:toolbar", timestamp: Date.now(), commands: [] },
1351
1384
  error: { code: "constraint_violated", reason: `Source node "${f}" not found`, source: "api" }
1352
1385
  };
1353
- const x = c?.gap ?? l ?? Ut, B = c?.direction ?? "right", X = o.nodeTypes[b.type], C = o.nodeTypes[d.type], L = X?.getSize(b) ?? { width: 154, height: 54 }, w = C?.getSize({ ...d, position: { x: 0, y: 0 } }) ?? {
1386
+ const E = c?.gap ?? l ?? zt, F = c?.direction ?? "right", K = o.nodeTypes[b.type], k = o.nodeTypes[d.type], L = K?.getSize(b) ?? { width: 154, height: 54 }, w = k?.getSize({ ...d, position: { x: 0, y: 0 } }) ?? {
1354
1387
  width: 154,
1355
1388
  height: 54
1356
- }, A = W(B, b, L, w, x), H = d.id || g("node"), Z = { ...d, id: H, position: A }, V = [{ type: "node.add", node: Z }], ee = z(B, w, x), Q = { x: A.x, y: A.y, width: w.width, height: w.height };
1389
+ }, P = W(F, b, L, w, E), H = d.id || p("node"), Y = { ...d, id: H, position: P }, X = [{ type: "node.add", node: Y }], ee = z(F, w, E), Q = { x: P.x, y: P.y, width: w.width, height: w.height };
1357
1390
  for (const [ie, ne] of Object.entries(v.nodes)) {
1358
1391
  if (ie === f || ie === H) continue;
1359
- const I = o.nodeTypes[ne.type]?.getSize(ne) ?? { width: 154, height: 54 }, _ = Q.x < ne.position.x + I.width && Q.x + Q.width > ne.position.x, F = Q.y < ne.position.y + I.height && Q.y + Q.height > ne.position.y;
1360
- _ && F && V.push({
1392
+ const I = o.nodeTypes[ne.type]?.getSize(ne) ?? { width: 154, height: 54 }, N = Q.x < ne.position.x + I.width && Q.x + Q.width > ne.position.x, U = Q.y < ne.position.y + I.height && Q.y + Q.height > ne.position.y;
1393
+ N && U && X.push({
1361
1394
  type: "node.move",
1362
1395
  nodeId: ie,
1363
1396
  position: { x: ne.position.x + ee.x, y: ne.position.y + ee.y }
1364
1397
  });
1365
1398
  }
1366
1399
  if (c?.autoWireEdges) {
1367
- const ie = K(b), ne = K(Z), N = B, I = M(B), _ = ie.find((J) => J.group === N), F = ne.find((J) => J.group === I), ae = ne.find((J) => J.group === N), de = _ ? Object.values(v.edges).find(
1368
- (J) => J.source.nodeId === f && J.source.portId === _.id
1400
+ const ie = V(b), ne = V(Y), S = F, I = D(F), N = ie.find((J) => J.group === S), U = ne.find((J) => J.group === I), ae = ne.find((J) => J.group === S), de = N ? Object.values(v.edges).find(
1401
+ (J) => J.source.nodeId === f && J.source.portId === N.id
1369
1402
  ) : Object.values(v.edges).find((J) => J.source.nodeId === f);
1370
1403
  if (de) {
1371
1404
  const J = de.target;
1372
- V.push({ type: "edge.remove", edgeId: de.id }), V.push({
1405
+ X.push({ type: "edge.remove", edgeId: de.id }), X.push({
1373
1406
  type: "edge.add",
1374
1407
  edge: {
1375
- id: g("edge"),
1376
- source: { nodeId: f, portId: _?.id },
1377
- target: { nodeId: H, portId: F?.id }
1408
+ id: p("edge"),
1409
+ source: { nodeId: f, portId: N?.id },
1410
+ target: { nodeId: H, portId: U?.id }
1378
1411
  }
1379
- }), V.push({
1412
+ }), X.push({
1380
1413
  type: "edge.add",
1381
1414
  edge: {
1382
- id: g("edge"),
1415
+ id: p("edge"),
1383
1416
  source: { nodeId: H, portId: ae?.id },
1384
1417
  target: J
1385
1418
  }
1386
1419
  });
1387
1420
  } else
1388
- V.push({
1421
+ X.push({
1389
1422
  type: "edge.add",
1390
1423
  edge: {
1391
- id: g("edge"),
1392
- source: { nodeId: f, portId: _?.id },
1393
- target: { nodeId: H, portId: F?.id }
1424
+ id: p("edge"),
1425
+ source: { nodeId: f, portId: N?.id },
1426
+ target: { nodeId: H, portId: U?.id }
1394
1427
  }
1395
1428
  });
1396
1429
  }
@@ -1399,7 +1432,7 @@ function zt({
1399
1432
  source: c?.source ?? "user:toolbar",
1400
1433
  label: c?.label ?? "插入节点",
1401
1434
  timestamp: Date.now(),
1402
- commands: V
1435
+ commands: X
1403
1436
  };
1404
1437
  return t(oe);
1405
1438
  },
@@ -1412,22 +1445,22 @@ function zt({
1412
1445
  };
1413
1446
  return y;
1414
1447
  }
1415
- function jt() {
1416
- const s = q(null), e = q(!1);
1448
+ function Wt() {
1449
+ const s = G(null), e = G(!1);
1417
1450
  let t = null, o = !1;
1418
- function n(g) {
1419
- t && (clearTimeout(t), t = null), s.value = g;
1451
+ function n(p) {
1452
+ t && (clearTimeout(t), t = null), s.value = p;
1420
1453
  }
1421
- function i(g = 100) {
1454
+ function i(p = 100) {
1422
1455
  o || (t && clearTimeout(t), t = setTimeout(() => {
1423
1456
  s.value = null, t = null;
1424
- }, g));
1457
+ }, p));
1425
1458
  }
1426
1459
  function r() {
1427
1460
  o = !0, t && (clearTimeout(t), t = null);
1428
1461
  }
1429
- function l(g = 100) {
1430
- o = !1, i(g);
1462
+ function l(p = 100) {
1463
+ o = !1, i(p);
1431
1464
  }
1432
1465
  function a() {
1433
1466
  t && (clearTimeout(t), t = null);
@@ -1440,28 +1473,28 @@ function jt() {
1440
1473
  }
1441
1474
  return { hoveredNodeId: s, isDraggingNode: e, enter: n, leave: i, enterOverlay: r, leaveOverlay: l, cancelLeave: a, reset: h, cleanup: u };
1442
1475
  }
1443
- const ze = 10, Se = 12;
1444
- function je(s, e) {
1476
+ const Ue = 10, Se = 12;
1477
+ function ze(s, e) {
1445
1478
  const t = s.getTotalLength();
1446
1479
  if (t === 0) return { ...e, length: 0, totalLength: 0 };
1447
1480
  let o = s.getPointAtLength(0), n = 1 / 0;
1448
1481
  const i = 50, r = t / i;
1449
1482
  let l = 0;
1450
- for (let g = 0; g <= i; g++) {
1451
- const p = g * r, E = s.getPointAtLength(p), m = (E.x - e.x) ** 2 + (E.y - e.y) ** 2;
1452
- m < n && (n = m, o = E, l = p);
1483
+ for (let p = 0; p <= i; p++) {
1484
+ const g = p * r, x = s.getPointAtLength(g), m = (x.x - e.x) ** 2 + (x.y - e.y) ** 2;
1485
+ m < n && (n = m, o = x, l = g);
1453
1486
  }
1454
1487
  const a = Math.max(0, l - r), h = Math.min(t, l + r), u = (h - a) / 20;
1455
- for (let g = a; g <= h; g += u) {
1456
- const p = s.getPointAtLength(g), E = (p.x - e.x) ** 2 + (p.y - e.y) ** 2;
1457
- E < n && (n = E, o = p, l = g);
1488
+ for (let p = a; p <= h; p += u) {
1489
+ const g = s.getPointAtLength(p), x = (g.x - e.x) ** 2 + (g.y - e.y) ** 2;
1490
+ x < n && (n = x, o = g, l = p);
1458
1491
  }
1459
1492
  return { x: o.x, y: o.y, length: l, totalLength: t };
1460
1493
  }
1461
- function We(s, e) {
1462
- return s < ze || s > e - ze;
1494
+ function je(s, e) {
1495
+ return s < Ue || s > e - Ue;
1463
1496
  }
1464
- function Ve(s, e, t) {
1497
+ function We(s, e, t) {
1465
1498
  const o = s.querySelectorAll(".x6-edge-label");
1466
1499
  for (const n of o) {
1467
1500
  const i = n.getBoundingClientRect();
@@ -1470,7 +1503,7 @@ function Ve(s, e, t) {
1470
1503
  }
1471
1504
  return !1;
1472
1505
  }
1473
- function Xe() {
1506
+ function Ve() {
1474
1507
  const s = "http://www.w3.org/2000/svg", e = document.createElementNS(s, "g");
1475
1508
  e.setAttribute("class", "flow-canvas-edge-delete-tool"), e.style.cursor = "pointer";
1476
1509
  const t = document.createElementNS(s, "rect");
@@ -1478,20 +1511,20 @@ function Xe() {
1478
1511
  const o = document.createElementNS(s, "text");
1479
1512
  return o.setAttribute("font-family", "flow-canvas"), o.setAttribute("font-size", "16"), o.setAttribute("fill", "#ffffff"), o.setAttribute("text-anchor", "middle"), o.setAttribute("dominant-baseline", "central"), o.textContent = "", e.appendChild(o), e;
1480
1513
  }
1481
- function Wt(s) {
1514
+ function Vt(s) {
1482
1515
  let e = null, t = null;
1483
1516
  function o(l, a) {
1484
1517
  if (i(), t = l, a.target?.closest?.(".x6-edge-label")) return;
1485
1518
  const u = s.getCellById(l);
1486
1519
  if (!u?.isEdge()) return;
1487
- const g = s.findViewByCell(u);
1488
- if (!g) return;
1489
- const p = g.container.querySelector("path");
1520
+ const p = s.findViewByCell(u);
1490
1521
  if (!p) return;
1491
- const E = s.clientToLocal(a.clientX, a.clientY), m = je(p, E);
1492
- if (We(m.length, m.totalLength) || Ve(g.container, a.clientX, a.clientY)) return;
1493
- const k = Xe();
1494
- k.setAttribute("transform", `translate(${m.x}, ${m.y})`), g.container.appendChild(k), e = k;
1522
+ const g = p.container.querySelector("path");
1523
+ if (!g) return;
1524
+ const x = s.clientToLocal(a.clientX, a.clientY), m = ze(g, x);
1525
+ if (je(m.length, m.totalLength) || We(p.container, a.clientX, a.clientY)) return;
1526
+ const C = Ve();
1527
+ C.setAttribute("transform", `translate(${m.x}, ${m.y})`), p.container.appendChild(C), e = C;
1495
1528
  }
1496
1529
  function n(l) {
1497
1530
  if (!t) return;
@@ -1503,16 +1536,16 @@ function Wt(s) {
1503
1536
  if (!h?.isEdge()) return;
1504
1537
  const u = s.findViewByCell(h);
1505
1538
  if (!u) return;
1506
- const g = u.container.querySelector("path");
1507
- if (!g) return;
1508
- const p = s.clientToLocal(l.clientX, l.clientY), E = je(g, p);
1509
- if (We(E.length, E.totalLength) || Ve(u.container, l.clientX, l.clientY))
1539
+ const p = u.container.querySelector("path");
1540
+ if (!p) return;
1541
+ const g = s.clientToLocal(l.clientX, l.clientY), x = ze(p, g);
1542
+ if (je(x.length, x.totalLength) || We(u.container, l.clientX, l.clientY))
1510
1543
  e && e.setAttribute("display", "none");
1511
1544
  else if (e)
1512
- e.removeAttribute("display"), e.setAttribute("transform", `translate(${E.x}, ${E.y})`);
1545
+ e.removeAttribute("display"), e.setAttribute("transform", `translate(${x.x}, ${x.y})`);
1513
1546
  else {
1514
- const m = Xe();
1515
- m.setAttribute("transform", `translate(${E.x}, ${E.y})`), u.container.appendChild(m), e = m;
1547
+ const m = Ve();
1548
+ m.setAttribute("transform", `translate(${x.x}, ${x.y})`), u.container.appendChild(m), e = m;
1516
1549
  }
1517
1550
  }
1518
1551
  function i() {
@@ -1523,31 +1556,31 @@ function Wt(s) {
1523
1556
  }
1524
1557
  return { show: o, move: n, remove: i, handleEdgeRemoved: r };
1525
1558
  }
1526
- function Vt(s) {
1559
+ function Xt(s) {
1527
1560
  let e = null, t = 0;
1528
1561
  function o(u) {
1529
- const g = u ? "visible" : "hidden";
1530
- for (const p of s.getNodes())
1531
- for (const E of p.getPorts())
1532
- p.setPortProp(E.id, "attrs/circle/visibility", g);
1562
+ const p = u ? "visible" : "hidden";
1563
+ for (const g of s.getNodes())
1564
+ for (const x of g.getPorts())
1565
+ g.setPortProp(x.id, "attrs/circle/visibility", p);
1533
1566
  }
1534
1567
  function n(u) {
1535
1568
  if (!e)
1536
- for (const g of u.getPorts())
1537
- u.setPortProp(g.id, "attrs/circle/visibility", "visible");
1569
+ for (const p of u.getPorts())
1570
+ u.setPortProp(p.id, "attrs/circle/visibility", "visible");
1538
1571
  }
1539
1572
  function i(u) {
1540
1573
  if (!e)
1541
- for (const g of u.getPorts())
1542
- u.setPortProp(g.id, "attrs/circle/visibility", "hidden");
1574
+ for (const p of u.getPorts())
1575
+ u.setPortProp(p.id, "attrs/circle/visibility", "hidden");
1543
1576
  }
1544
- function r(u, g) {
1577
+ function r(u, p) {
1545
1578
  if (!u.getTargetCell())
1546
- if (e = u.id, g?.size)
1547
- for (const p of s.getNodes()) {
1548
- const E = g.has(p.id) ? "hidden" : "visible";
1549
- for (const m of p.getPorts())
1550
- p.setPortProp(m.id, "attrs/circle/visibility", E);
1579
+ if (e = u.id, p?.size)
1580
+ for (const g of s.getNodes()) {
1581
+ const x = p.has(g.id) ? "hidden" : "visible";
1582
+ for (const m of g.getPorts())
1583
+ g.setPortProp(m.id, "attrs/circle/visibility", x);
1551
1584
  }
1552
1585
  else
1553
1586
  o(!0);
@@ -1570,13 +1603,13 @@ function Vt(s) {
1570
1603
  canShowEdgeTool: h
1571
1604
  };
1572
1605
  }
1573
- function Ye(s) {
1606
+ function Xe(s) {
1574
1607
  return s === "top" || s === "right" || s === "bottom" || s === "left";
1575
1608
  }
1576
- function Xt(s) {
1577
- const { editor: e, nodeHover: t, isSelectionModeActive: o, viewportVersion: n, getNodeBehavior: i, getInsertGap: r } = s, { isDraggingNode: l } = s, a = q(null), h = q(!1);
1578
- let u = null, g = null, p = null;
1579
- const E = j(() => ({
1609
+ function Kt(s) {
1610
+ const { editor: e, nodeHover: t, isSelectionModeActive: o, viewportVersion: n, getNodeBehavior: i, getInsertGap: r } = s, { isDraggingNode: l } = s, a = G(null), h = G(!1);
1611
+ let u = null, p = null, g = null;
1612
+ const x = j(() => ({
1580
1613
  enabled: !0,
1581
1614
  portGroup: "right",
1582
1615
  ...s.quickAddProp.value
@@ -1584,32 +1617,32 @@ function Xt(s) {
1584
1617
  function m() {
1585
1618
  u && (clearTimeout(u), u = null);
1586
1619
  }
1587
- function k() {
1620
+ function C() {
1588
1621
  u && clearTimeout(u), u = setTimeout(() => {
1589
1622
  a.value = null, u = null;
1590
1623
  }, 150);
1591
1624
  }
1592
- function S(C) {
1593
- return h.value ? !0 : (m(), y(C) ? (a.value = C, !0) : (a.value = null, !1));
1625
+ function M(k) {
1626
+ return h.value ? !0 : (m(), y(k) ? (a.value = k, !0) : (a.value = null, !1));
1594
1627
  }
1595
- function T() {
1628
+ function R() {
1596
1629
  m(), t.enterOverlay();
1597
1630
  }
1598
- function P() {
1599
- k(), t.leaveOverlay();
1631
+ function A() {
1632
+ C(), t.leaveOverlay();
1600
1633
  }
1601
- function G(C) {
1602
- const L = e.schema.nodeTypes[C.type];
1603
- return qe(C, L?.getPorts);
1634
+ function B(k) {
1635
+ const L = e.schema.nodeTypes[k.type];
1636
+ return Fe(k, L?.getPorts);
1604
1637
  }
1605
- function K(C, L) {
1606
- const w = E.value.getPort?.(C, L);
1638
+ function V(k, L) {
1639
+ const w = x.value.getPort?.(k, L);
1607
1640
  if (!w) return null;
1608
- const A = typeof w == "string" ? w : w.id;
1609
- return L.find((H) => H.id === A) ?? null;
1641
+ const P = typeof w == "string" ? w : w.id;
1642
+ return L.find((H) => H.id === P) ?? null;
1610
1643
  }
1611
- function O(C, L) {
1612
- const w = e.api.value?.overlay.getNodeScreenRect(C);
1644
+ function O(k, L) {
1645
+ const w = e.api.value?.overlay.getNodeScreenRect(k);
1613
1646
  if (!w) return null;
1614
1647
  switch (L) {
1615
1648
  case "top":
@@ -1624,143 +1657,143 @@ function Xt(s) {
1624
1657
  return null;
1625
1658
  }
1626
1659
  }
1627
- function W(C, L, w) {
1628
- if (!g) return O(C, w);
1629
- const A = g.getCellById(C);
1630
- if (A?.isNode()) {
1631
- const H = A, Z = g.findViewByCell(H), V = Z?.findPortElem(L, "circle") ?? Z?.findPortElem(L);
1632
- if (V) {
1633
- const ee = g.container.getBoundingClientRect(), Q = V.getBoundingClientRect();
1660
+ function W(k, L, w) {
1661
+ if (!p) return O(k, w);
1662
+ const P = p.getCellById(k);
1663
+ if (P?.isNode()) {
1664
+ const H = P, Y = p.findViewByCell(H), X = Y?.findPortElem(L, "circle") ?? Y?.findPortElem(L);
1665
+ if (X) {
1666
+ const ee = p.container.getBoundingClientRect(), Q = X.getBoundingClientRect();
1634
1667
  return {
1635
1668
  x: Q.left - ee.left + Q.width / 2,
1636
1669
  y: Q.top - ee.top + Q.height / 2
1637
1670
  };
1638
1671
  }
1639
1672
  }
1640
- return O(C, w);
1673
+ return O(k, w);
1641
1674
  }
1642
- function z(C) {
1643
- const L = G(C), w = K(C, L) ?? L.find((H) => H.group === E.value.portGroup) ?? null;
1675
+ function z(k) {
1676
+ const L = B(k), w = V(k, L) ?? L.find((H) => H.group === x.value.portGroup) ?? null;
1644
1677
  if (!w) return null;
1645
- const A = W(C.id, w.id, w.group);
1646
- return A ? { portId: w.id, portGroup: w.group, portPosition: A } : null;
1678
+ const P = W(k.id, w.id, w.group);
1679
+ return P ? { portId: w.id, portGroup: w.group, portPosition: P } : null;
1647
1680
  }
1648
- function M(C) {
1649
- const L = z(C), w = E.value.insertDirection;
1681
+ function D(k) {
1682
+ const L = z(k), w = x.value.insertDirection;
1650
1683
  if (typeof w == "function") {
1651
- const A = w(C, L ? { id: L.portId, group: L.portGroup } : null);
1652
- if (A) return A;
1684
+ const P = w(k, L ? { id: L.portId, group: L.portGroup } : null);
1685
+ if (P) return P;
1653
1686
  } else if (w)
1654
1687
  return w;
1655
- return L && Ye(L.portGroup) ? L.portGroup : Ye(E.value.portGroup) ? E.value.portGroup : "right";
1688
+ return L && Xe(L.portGroup) ? L.portGroup : Xe(x.value.portGroup) ? x.value.portGroup : "right";
1656
1689
  }
1657
- function y(C) {
1658
- if (!E.value.enabled || e.mode.value !== "edit") return !1;
1659
- const w = e.flowModel.value.nodes[C];
1690
+ function y(k) {
1691
+ if (!x.value.enabled || e.mode.value !== "edit") return !1;
1692
+ const w = e.flowModel.value.nodes[k];
1660
1693
  return !w || i(w).quickAddEnabled === !1 ? !1 : !!z(w);
1661
1694
  }
1662
1695
  const f = j(() => {
1663
- if (n.value, !E.value.enabled) return null;
1664
- const C = a.value;
1665
- if (!C || l.value || !e.api.value || e.mode.value !== "edit" || o.value)
1696
+ if (n.value, !x.value.enabled) return null;
1697
+ const k = a.value;
1698
+ if (!k || l.value || !e.api.value || e.mode.value !== "edit" || o.value)
1666
1699
  return null;
1667
- const w = e.flowModel.value.nodes[C];
1700
+ const w = e.flowModel.value.nodes[k];
1668
1701
  if (!w) return null;
1669
- const A = i(w);
1670
- if (A.quickAddEnabled === !1) return null;
1702
+ const P = i(w);
1703
+ if (P.quickAddEnabled === !1) return null;
1671
1704
  const H = z(w);
1672
- return H ? { node: w, ...H, behavior: A } : null;
1705
+ return H ? { node: w, ...H, behavior: P } : null;
1673
1706
  });
1674
- function d(C) {
1675
- h.value = !0, f.value && e._emitUiEvent({ type: "node.quick-add", nodeId: C, position: f.value.portPosition });
1707
+ function d(k) {
1708
+ h.value = !0, f.value && e._emitUiEvent({ type: "node.quick-add", nodeId: k, position: f.value.portPosition });
1676
1709
  }
1677
1710
  function c() {
1678
1711
  h.value = !1;
1679
1712
  }
1680
- function v(C) {
1713
+ function v(k) {
1681
1714
  const L = e.api.value;
1682
1715
  if (!L) return;
1683
- const w = e.flowModel.value.nodes[C];
1716
+ const w = e.flowModel.value.nodes[k];
1684
1717
  if (!w) return;
1685
- const A = z(w);
1686
- A && L.startConnection(C, A.portId);
1718
+ const P = z(w);
1719
+ P && L.startConnection(k, P.portId);
1687
1720
  }
1688
- function b(C, L) {
1721
+ function b(k, L) {
1689
1722
  const w = e.api.value;
1690
1723
  if (!w) return;
1691
- const A = L.id || e.idGenerator("node"), H = { ...L, id: A }, Z = e.flowModel.value.nodes[C];
1692
- if (!Z) return;
1693
- w.insertNodeToRight(C, H, {
1724
+ const P = L.id || e.idGenerator("node"), H = { ...L, id: P }, Y = e.flowModel.value.nodes[k];
1725
+ if (!Y) return;
1726
+ w.insertNodeToRight(k, H, {
1694
1727
  autoWireEdges: !0,
1695
- direction: M(Z),
1728
+ direction: D(Y),
1696
1729
  gap: r(),
1697
1730
  source: "user:quick-add",
1698
1731
  label: "快捷插入节点"
1699
- }).status === "applied" && e._emitUiEvent({ type: "node.action.quick-insert", sourceNodeId: C, newNodeId: A }), s.closePopover();
1732
+ }).status === "applied" && e._emitUiEvent({ type: "node.action.quick-insert", sourceNodeId: k, newNodeId: P }), s.closePopover();
1700
1733
  }
1701
- function x(C) {
1702
- if (!g) return;
1703
- const L = g.getCellById(C);
1734
+ function E(k) {
1735
+ if (!p) return;
1736
+ const L = p.getCellById(k);
1704
1737
  if (!L?.isNode()) return;
1705
- const w = L, A = e.flowModel.value.nodes[C];
1706
- if (!A) return;
1707
- const H = z(A);
1708
- let Z = !0;
1709
- i(A).hidePortForQuickAdd === !1 && (Z = !1);
1710
- const ee = Z && !l.value && !!H && y(C);
1738
+ const w = L, P = e.flowModel.value.nodes[k];
1739
+ if (!P) return;
1740
+ const H = z(P);
1741
+ let Y = !0;
1742
+ i(P).hidePortForQuickAdd === !1 && (Y = !1);
1743
+ const ee = Y && !l.value && !!H && y(k);
1711
1744
  for (const Q of w.getPorts()) {
1712
1745
  const oe = ee && Q.id === H?.portId ? "hidden" : "visible";
1713
1746
  w.setPortProp(Q.id, "attrs/circle/visibility", oe);
1714
1747
  }
1715
1748
  }
1716
- function B(C, L) {
1717
- p?.(), g = C, p = pe(
1749
+ function F(k, L) {
1750
+ g?.(), p = k, g = he(
1718
1751
  [a, l],
1719
- ([w], [A]) => {
1720
- if (A && A !== w) {
1721
- const H = C.getCellById(A);
1752
+ ([w], [P]) => {
1753
+ if (P && P !== w) {
1754
+ const H = k.getCellById(P);
1722
1755
  H?.isNode() && L(H);
1723
1756
  }
1724
- w && x(w);
1757
+ w && E(w);
1725
1758
  },
1726
1759
  { flush: "sync" }
1727
1760
  );
1728
1761
  }
1729
- pe(f, (C) => {
1730
- C || (h.value = !1);
1762
+ he(f, (k) => {
1763
+ k || (h.value = !1);
1731
1764
  });
1732
- function X() {
1733
- u && clearTimeout(u), p?.(), p = null, g = null;
1765
+ function K() {
1766
+ u && clearTimeout(u), g?.(), g = null, p = null;
1734
1767
  }
1735
1768
  return {
1736
1769
  quickAddNodeId: a,
1737
1770
  quickAddPopoverOpen: h,
1738
- mergedConfig: E,
1771
+ mergedConfig: x,
1739
1772
  data: f,
1740
- enter: S,
1741
- leave: k,
1773
+ enter: M,
1774
+ leave: C,
1742
1775
  cancelLeave: m,
1743
- handleOverlayEnter: T,
1744
- handleOverlayLeave: P,
1776
+ handleOverlayEnter: R,
1777
+ handleOverlayLeave: A,
1745
1778
  handleOpen: d,
1746
1779
  handleClose: c,
1747
1780
  handleStartDrag: v,
1748
1781
  handleInsert: b,
1749
1782
  isActiveForNode: y,
1750
- syncNodePorts: x,
1751
- attachRuntime: B,
1752
- cleanup: X
1783
+ syncNodePorts: E,
1784
+ attachRuntime: F,
1785
+ cleanup: K
1753
1786
  };
1754
1787
  }
1755
- const Yt = 15, Kt = 10;
1756
- function Zt(s) {
1788
+ const Zt = 15, Yt = 10;
1789
+ function Qt(s) {
1757
1790
  const { editor: e } = s;
1758
1791
  let t = null, o = null, n = null, i = null;
1759
1792
  const r = [];
1760
1793
  let l = null;
1761
1794
  const a = j(() => ({
1762
1795
  enabled: !1,
1763
- bufferMargin: Yt,
1796
+ bufferMargin: Zt,
1764
1797
  incomingPortGroup: "left",
1765
1798
  outgoingPortGroup: "right",
1766
1799
  ...s.edgeDropProp.value
@@ -1780,12 +1813,12 @@ function Zt(s) {
1780
1813
  const f = h(y);
1781
1814
  f && (f.style.stroke = "#3a84ff", i = y);
1782
1815
  }
1783
- function g() {
1816
+ function p() {
1784
1817
  if (!i) return;
1785
1818
  const y = h(i);
1786
1819
  y && (y.style.stroke = ""), i = null;
1787
1820
  }
1788
- function p(y, f, d) {
1821
+ function g(y, f, d) {
1789
1822
  if (t) {
1790
1823
  const c = t.getCellById(y);
1791
1824
  if (c?.isNode()) {
@@ -1799,11 +1832,11 @@ function Zt(s) {
1799
1832
  }
1800
1833
  return d;
1801
1834
  }
1802
- function E(y) {
1835
+ function x(y) {
1803
1836
  const f = y.getTotalLength();
1804
1837
  if (f === 0) return [];
1805
1838
  const d = [];
1806
- for (let v = 0; v <= f; v += Kt) {
1839
+ for (let v = 0; v <= f; v += Yt) {
1807
1840
  const b = y.getPointAtLength(v);
1808
1841
  d.push({ x: b.x, y: b.y });
1809
1842
  }
@@ -1819,62 +1852,62 @@ function Zt(s) {
1819
1852
  height: Math.max(0, y.height - v * 2)
1820
1853
  };
1821
1854
  if (b.width <= 0 || b.height <= 0) return null;
1822
- const x = b.x + b.width, B = b.y + b.height;
1823
- let X = null;
1824
- const C = y.x + y.width / 2, L = y.y + y.height / 2;
1855
+ const E = b.x + b.width, F = b.y + b.height;
1856
+ let K = null;
1857
+ const k = y.x + y.width / 2, L = y.y + y.height / 2;
1825
1858
  for (const w of t.getEdges()) {
1826
- const A = f.edges[w.id];
1827
- if (!A || d && (A.source.nodeId === d || A.target.nodeId === d) || c.isEdgeDropTarget && !c.isEdgeDropTarget(A, f)) continue;
1859
+ const P = f.edges[w.id];
1860
+ if (!P || d && (P.source.nodeId === d || P.target.nodeId === d) || c.isEdgeDropTarget && !c.isEdgeDropTarget(P, f)) continue;
1828
1861
  const H = t.findViewByCell(w);
1829
1862
  if (!H) continue;
1830
- const Z = H.findOne?.("path");
1831
- if (!Z || typeof Z.getTotalLength != "function") continue;
1832
- const V = E(Z);
1833
- if (!V.length) continue;
1863
+ const Y = H.findOne?.("path");
1864
+ if (!Y || typeof Y.getTotalLength != "function") continue;
1865
+ const X = x(Y);
1866
+ if (!X.length) continue;
1834
1867
  let ee = !1, Q = 1 / 0;
1835
- for (const oe of V)
1836
- if (oe.x >= b.x && oe.x <= x && oe.y >= b.y && oe.y <= B) {
1837
- const ie = oe.x - C, ne = oe.y - L, N = ie * ie + ne * ne;
1838
- N < Q && (Q = N), ee = !0;
1868
+ for (const oe of X)
1869
+ if (oe.x >= b.x && oe.x <= E && oe.y >= b.y && oe.y <= F) {
1870
+ const ie = oe.x - k, ne = oe.y - L, S = ie * ie + ne * ne;
1871
+ S < Q && (Q = S), ee = !0;
1839
1872
  }
1840
- ee && (!X || Q < X.distSq) && (X = { edgeId: w.id, edge: A, distSq: Q });
1873
+ ee && (!K || Q < K.distSq) && (K = { edgeId: w.id, edge: P, distSq: Q });
1841
1874
  }
1842
- return X ? { edgeId: X.edgeId, edge: X.edge } : null;
1875
+ return K ? { edgeId: K.edgeId, edge: K.edge } : null;
1843
1876
  }
1844
- function k(y, f) {
1877
+ function C(y, f) {
1845
1878
  if (!a.value.enabled) return;
1846
1879
  const c = e.flowModel.value, v = m(y, c, f);
1847
- v ? o !== v.edgeId && (g(), o = v.edgeId, u(v.edgeId)) : o && (g(), o = null);
1880
+ v ? o !== v.edgeId && (p(), o = v.edgeId, u(v.edgeId)) : o && (p(), o = null);
1848
1881
  }
1849
- let S = !0;
1850
- function T({ node: y }) {
1882
+ let M = !0;
1883
+ function R({ node: y }) {
1851
1884
  if (o = null, !a.value.enabled) return;
1852
1885
  const f = e.flowModel.value, d = f.nodes[y.id];
1853
1886
  if (!d) {
1854
- S = !1;
1887
+ M = !1;
1855
1888
  return;
1856
1889
  }
1857
1890
  const c = a.value;
1858
- S = !c.isNodeInsertable || c.isNodeInsertable(d, f);
1891
+ M = !c.isNodeInsertable || c.isNodeInsertable(d, f);
1859
1892
  }
1860
- function P({ node: y }) {
1861
- !a.value.enabled || !S || n === null && (n = requestAnimationFrame(() => {
1893
+ function A({ node: y }) {
1894
+ !a.value.enabled || !M || n === null && (n = requestAnimationFrame(() => {
1862
1895
  if (n = null, !t) return;
1863
1896
  const f = y.getPosition(), d = y.getSize();
1864
- k({ x: f.x, y: f.y, width: d.width, height: d.height }, y.id);
1897
+ C({ x: f.x, y: f.y, width: d.width, height: d.height }, y.id);
1865
1898
  }));
1866
1899
  }
1867
- function G() {
1868
- n !== null && (cancelAnimationFrame(n), n = null), g(), S = !0;
1900
+ function B() {
1901
+ n !== null && (cancelAnimationFrame(n), n = null), p(), M = !0;
1869
1902
  }
1870
- function K() {
1903
+ function V() {
1871
1904
  if (!t) return;
1872
1905
  let y = !1;
1873
1906
  l = () => {
1874
1907
  if (!a.value.enabled) return;
1875
1908
  const f = document.querySelector(".x6-widget-dnd");
1876
1909
  if (!f) {
1877
- y && (y = !1, g(), o = null);
1910
+ y && (y = !1, p(), o = null);
1878
1911
  return;
1879
1912
  }
1880
1913
  y = !0, n === null && (n = requestAnimationFrame(() => {
@@ -1885,29 +1918,29 @@ function Zt(s) {
1885
1918
  width: v.x - c.x,
1886
1919
  height: v.y - c.y
1887
1920
  };
1888
- k(b);
1921
+ C(b);
1889
1922
  }));
1890
1923
  }, document.addEventListener("mousemove", l), r.push(() => {
1891
1924
  l && (document.removeEventListener("mousemove", l), l = null);
1892
1925
  });
1893
1926
  }
1894
1927
  function O() {
1895
- g(), o = null, n !== null && (cancelAnimationFrame(n), n = null);
1928
+ p(), o = null, n !== null && (cancelAnimationFrame(n), n = null);
1896
1929
  }
1897
1930
  function W(y) {
1898
1931
  if (!o || y.source !== "user:drag") return y;
1899
1932
  const f = o;
1900
- o = null, g();
1933
+ o = null, p();
1901
1934
  const d = e.flowModel.value, c = d.edges[f];
1902
1935
  if (!c) return y;
1903
1936
  const v = y.commands.find((H) => H.type === "node.add" || H.type === "node.move");
1904
1937
  if (!v) return y;
1905
- const b = v.type === "node.add" ? v.node.id : v.nodeId, x = v.type === "node.add" ? v.node : d.nodes[v.nodeId];
1906
- if (!x) return y;
1907
- const B = a.value;
1908
- if (B.isNodeInsertable && !B.isNodeInsertable(x, d))
1938
+ const b = v.type === "node.add" ? v.node.id : v.nodeId, E = v.type === "node.add" ? v.node : d.nodes[v.nodeId];
1939
+ if (!E) return y;
1940
+ const F = a.value;
1941
+ if (F.isNodeInsertable && !F.isNodeInsertable(E, d))
1909
1942
  return y;
1910
- const X = p(b, x, B.incomingPortGroup), C = p(b, x, B.outgoingPortGroup), L = e.idGenerator("edge"), w = e.idGenerator("edge"), A = [
1943
+ const K = g(b, E, F.incomingPortGroup), k = g(b, E, F.outgoingPortGroup), L = e.idGenerator("edge"), w = e.idGenerator("edge"), P = [
1911
1944
  { type: "edge.remove", edgeId: f },
1912
1945
  {
1913
1946
  type: "edge.add",
@@ -1915,7 +1948,7 @@ function Zt(s) {
1915
1948
  id: L,
1916
1949
  type: c.type,
1917
1950
  source: { nodeId: c.source.nodeId, portId: c.source.portId },
1918
- target: { nodeId: b, portId: X }
1951
+ target: { nodeId: b, portId: K }
1919
1952
  }
1920
1953
  },
1921
1954
  {
@@ -1923,7 +1956,7 @@ function Zt(s) {
1923
1956
  edge: {
1924
1957
  id: w,
1925
1958
  type: c.type,
1926
- source: { nodeId: b, portId: C },
1959
+ source: { nodeId: b, portId: k },
1927
1960
  target: { nodeId: c.target.nodeId, portId: c.target.portId }
1928
1961
  }
1929
1962
  }
@@ -1931,7 +1964,7 @@ function Zt(s) {
1931
1964
  return {
1932
1965
  ...y,
1933
1966
  source: "user:edge-drop",
1934
- commands: [...y.commands, ...A]
1967
+ commands: [...y.commands, ...P]
1935
1968
  };
1936
1969
  }
1937
1970
  function z(y) {
@@ -1939,20 +1972,20 @@ function Zt(s) {
1939
1972
  const f = (d, c) => {
1940
1973
  y.on(d, c), r.push(() => y.off(d, c));
1941
1974
  };
1942
- f("node:move", T), f("node:change:position", P), f("node:moved", G), K();
1975
+ f("node:move", R), f("node:change:position", A), f("node:moved", B), V();
1943
1976
  }
1944
- function M() {
1977
+ function D() {
1945
1978
  O();
1946
1979
  for (const y of r) y();
1947
- r.length = 0, t = null, S = !0;
1980
+ r.length = 0, t = null, M = !0;
1948
1981
  }
1949
1982
  return {
1950
1983
  attachRuntime: z,
1951
1984
  tryExpandForEdgeDrop: W,
1952
- cleanup: M
1985
+ cleanup: D
1953
1986
  };
1954
1987
  }
1955
- function Qt(s) {
1988
+ function Jt(s) {
1956
1989
  function e(n) {
1957
1990
  return {
1958
1991
  id: s.idGenerator("node"),
@@ -2000,8 +2033,8 @@ function Qt(s) {
2000
2033
  }
2001
2034
  case "disconnect": {
2002
2035
  const a = s.flowModel.value, h = Object.entries(a.edges).filter(([, u]) => {
2003
- const g = u;
2004
- return g.source.nodeId === i || g.target.nodeId === i;
2036
+ const p = u;
2037
+ return p.source.nodeId === i || p.target.nodeId === i;
2005
2038
  }).map(([u]) => u);
2006
2039
  if (h.length === 0) break;
2007
2040
  s.executeCommand({
@@ -2029,7 +2062,7 @@ function Qt(s) {
2029
2062
  }
2030
2063
  return { handleNodeAction: t, deleteSelection: o };
2031
2064
  }
2032
- function Jt() {
2065
+ function eo() {
2033
2066
  return {
2034
2067
  refX: 0,
2035
2068
  children: [
@@ -2050,7 +2083,7 @@ function Jt() {
2050
2083
  ]
2051
2084
  };
2052
2085
  }
2053
- function eo(s, e) {
2086
+ function to(s, e) {
2054
2087
  const t = e.defaultEdgeType ?? "default", o = e.edgeTypes?.[t], n = {
2055
2088
  zIndex: -1,
2056
2089
  attrs: {
@@ -2067,11 +2100,11 @@ function eo(s, e) {
2067
2100
  ...i,
2068
2101
  line: {
2069
2102
  ...r,
2070
- targetMarker: Jt()
2103
+ targetMarker: eo()
2071
2104
  }
2072
2105
  }, s.createEdge(n);
2073
2106
  }
2074
- const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2107
+ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2075
2108
  __name: "node-actions-toolbar",
2076
2109
  props: {
2077
2110
  node: {},
@@ -2083,11 +2116,11 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2083
2116
  emits: ["action"],
2084
2117
  setup(s, { emit: e }) {
2085
2118
  const t = s, o = j(() => {
2086
- const g = t.actionsOffset?.x ?? 0, p = t.actionsOffset?.y ?? 0, E = g !== 0 || p !== 0;
2119
+ const p = t.actionsOffset?.x ?? 0, g = t.actionsOffset?.y ?? 0, x = p !== 0 || g !== 0;
2087
2120
  return {
2088
2121
  left: `${t.position.x}px`,
2089
2122
  top: `${t.position.y}px`,
2090
- transform: E ? `translate(${g}px, ${p}px)` : "translateX(-100%)"
2123
+ transform: x ? `translate(${p}px, ${g}px)` : "translateX(-100%)"
2091
2124
  };
2092
2125
  }), n = e, i = j(() => ({
2093
2126
  debug: {
@@ -2110,7 +2143,7 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2110
2143
  visible: t.config.showDisconnect && t.behavior.disconnectable !== !1,
2111
2144
  disabled: t.behavior.disconnectDisabled === !0
2112
2145
  }
2113
- })), r = j(() => i.value.copy.visible || i.value.copyInsert.visible || i.value.disconnect.visible), l = q(!1);
2146
+ })), r = j(() => i.value.copy.visible || i.value.copyInsert.visible || i.value.disconnect.visible), l = G(!1);
2114
2147
  let a = null;
2115
2148
  function h() {
2116
2149
  a && (clearTimeout(a), a = null), l.value = !0;
@@ -2122,77 +2155,77 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2122
2155
  }
2123
2156
  return Me(() => {
2124
2157
  a && clearTimeout(a);
2125
- }), (g, p) => (D(), R("div", {
2158
+ }), (p, g) => (_(), T("div", {
2126
2159
  class: "flow-canvas-node-actions",
2127
2160
  style: we(o.value)
2128
2161
  }, [
2129
- U("div", to, [
2130
- i.value.debug.visible ? (D(), R("i", {
2162
+ q("div", oo, [
2163
+ i.value.debug.visible ? (_(), T("i", {
2131
2164
  key: 0,
2132
2165
  class: se(["flow-canvas-icon canvas-debug flow-canvas-node-actions__icon", { "is-disabled": i.value.debug.disabled }]),
2133
- onClick: p[0] || (p[0] = (E) => !i.value.debug.disabled && n("action", "debug", s.node.id))
2134
- }, null, 2)) : Y("", !0),
2135
- i.value.delete.visible ? (D(), R("i", {
2166
+ onClick: g[0] || (g[0] = (x) => !i.value.debug.disabled && n("action", "debug", s.node.id))
2167
+ }, null, 2)) : Z("", !0),
2168
+ i.value.delete.visible ? (_(), T("i", {
2136
2169
  key: 1,
2137
2170
  class: se(["flow-canvas-icon canvas-shanchu flow-canvas-node-actions__icon", { "is-disabled": i.value.delete.disabled }]),
2138
- onClick: p[1] || (p[1] = (E) => !i.value.delete.disabled && n("action", "delete", s.node.id))
2139
- }, null, 2)) : Y("", !0),
2140
- r.value ? (D(), R("div", {
2171
+ onClick: g[1] || (g[1] = (x) => !i.value.delete.disabled && n("action", "delete", s.node.id))
2172
+ }, null, 2)) : Z("", !0),
2173
+ r.value ? (_(), T("div", {
2141
2174
  key: 2,
2142
2175
  class: "flow-canvas-node-actions__more-wrapper",
2143
2176
  onMouseenter: h,
2144
2177
  onMouseleave: u
2145
- }, [...p[5] || (p[5] = [
2146
- U("i", { class: "flow-canvas-icon canvas-gengduo flow-canvas-node-actions__icon" }, null, -1)
2147
- ])], 32)) : Y("", !0)
2178
+ }, [...g[5] || (g[5] = [
2179
+ q("i", { class: "flow-canvas-icon canvas-gengduo flow-canvas-node-actions__icon" }, null, -1)
2180
+ ])], 32)) : Z("", !0)
2148
2181
  ]),
2149
2182
  et(tt, { name: "flow-canvas-fade" }, {
2150
- default: He(() => [
2151
- l.value && r.value ? (D(), R("div", {
2183
+ default: $e(() => [
2184
+ l.value && r.value ? (_(), T("div", {
2152
2185
  key: 0,
2153
2186
  class: "flow-canvas-node-actions__dropdown",
2154
2187
  onMouseenter: h,
2155
2188
  onMouseleave: u
2156
2189
  }, [
2157
- i.value.copy.visible ? (D(), R("div", {
2190
+ i.value.copy.visible ? (_(), T("div", {
2158
2191
  key: 0,
2159
2192
  class: se(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.copy.disabled }]),
2160
- onClick: p[2] || (p[2] = (E) => !i.value.copy.disabled && n("action", "copy", s.node.id))
2161
- }, [...p[6] || (p[6] = [
2162
- U("i", { class: "flow-canvas-icon canvas-copy-fuzhi-2" }, null, -1),
2163
- U("span", null, "复制", -1)
2164
- ])], 2)) : Y("", !0),
2165
- i.value.copyInsert.visible ? (D(), R("div", {
2193
+ onClick: g[2] || (g[2] = (x) => !i.value.copy.disabled && n("action", "copy", s.node.id))
2194
+ }, [...g[6] || (g[6] = [
2195
+ q("i", { class: "flow-canvas-icon canvas-copy-fuzhi-2" }, null, -1),
2196
+ q("span", null, "复制", -1)
2197
+ ])], 2)) : Z("", !0),
2198
+ i.value.copyInsert.visible ? (_(), T("div", {
2166
2199
  key: 1,
2167
2200
  class: se(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.copyInsert.disabled }]),
2168
- onClick: p[3] || (p[3] = (E) => !i.value.copyInsert.disabled && n("action", "copy-insert", s.node.id))
2169
- }, [...p[7] || (p[7] = [
2170
- U("i", { class: "flow-canvas-icon canvas-fuzhibingcharu" }, null, -1),
2171
- U("span", null, "复制并插入", -1)
2172
- ])], 2)) : Y("", !0),
2173
- i.value.disconnect.visible ? (D(), R("div", {
2201
+ onClick: g[3] || (g[3] = (x) => !i.value.copyInsert.disabled && n("action", "copy-insert", s.node.id))
2202
+ }, [...g[7] || (g[7] = [
2203
+ q("i", { class: "flow-canvas-icon canvas-fuzhibingcharu" }, null, -1),
2204
+ q("span", null, "复制并插入", -1)
2205
+ ])], 2)) : Z("", !0),
2206
+ i.value.disconnect.visible ? (_(), T("div", {
2174
2207
  key: 2,
2175
2208
  class: se(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.disconnect.disabled }]),
2176
- onClick: p[4] || (p[4] = (E) => !i.value.disconnect.disabled && n("action", "disconnect", s.node.id))
2177
- }, [...p[8] || (p[8] = [
2178
- U("i", { class: "flow-canvas-icon canvas-unlock-jiebang" }, null, -1),
2179
- U("span", null, "断开连线", -1)
2180
- ])], 2)) : Y("", !0)
2181
- ], 32)) : Y("", !0)
2209
+ onClick: g[4] || (g[4] = (x) => !i.value.disconnect.disabled && n("action", "disconnect", s.node.id))
2210
+ }, [...g[8] || (g[8] = [
2211
+ q("i", { class: "flow-canvas-icon canvas-unlock-jiebang" }, null, -1),
2212
+ q("span", null, "断开连线", -1)
2213
+ ])], 2)) : Z("", !0)
2214
+ ], 32)) : Z("", !0)
2182
2215
  ]),
2183
2216
  _: 1
2184
2217
  })
2185
2218
  ], 4));
2186
2219
  }
2187
- }), he = (s, e) => {
2220
+ }), ve = (s, e) => {
2188
2221
  const t = s.__vccOpts || s;
2189
2222
  for (const [o, n] of e)
2190
2223
  t[o] = n;
2191
2224
  return t;
2192
- }, no = /* @__PURE__ */ he(oo, [["__scopeId", "data-v-3b39dab5"]]), so = {
2225
+ }, so = /* @__PURE__ */ ve(no, [["__scopeId", "data-v-3b39dab5"]]), io = {
2193
2226
  key: 0,
2194
2227
  class: "flow-canvas-quick-add__tooltip"
2195
- }, io = 5, ro = /* @__PURE__ */ fe({
2228
+ }, ro = 5, ao = /* @__PURE__ */ ge({
2196
2229
  __name: "node-quick-add-popover",
2197
2230
  props: {
2198
2231
  node: {},
@@ -2200,81 +2233,81 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2200
2233
  },
2201
2234
  emits: ["open", "close", "start-drag", "mouseenter", "mouseleave"],
2202
2235
  setup(s, { expose: e, emit: t }) {
2203
- const o = s, n = t, i = q(), r = q(), l = q(!1), a = q(!1);
2204
- let h = null, u = !1, g = null;
2205
- function p(z) {
2206
- z.preventDefault(), z.stopPropagation(), h = { x: z.clientX, y: z.clientY }, u = !1, document.addEventListener("mousemove", E), document.addEventListener("mouseup", m);
2236
+ const o = s, n = t, i = G(), r = G(), l = G(!1), a = G(!1);
2237
+ let h = null, u = !1, p = null;
2238
+ function g(z) {
2239
+ z.preventDefault(), z.stopPropagation(), h = { x: z.clientX, y: z.clientY }, u = !1, document.addEventListener("mousemove", x), document.addEventListener("mouseup", m);
2207
2240
  }
2208
- function E(z) {
2241
+ function x(z) {
2209
2242
  if (!h) return;
2210
- const M = z.clientX - h.x, y = z.clientY - h.y;
2211
- Math.sqrt(M * M + y * y) >= io && (u = !0, k(), n("start-drag", o.node.id));
2243
+ const D = z.clientX - h.x, y = z.clientY - h.y;
2244
+ Math.sqrt(D * D + y * y) >= ro && (u = !0, C(), n("start-drag", o.node.id));
2212
2245
  }
2213
2246
  function m() {
2214
- k(), u || S(), h = null, u = !1;
2247
+ C(), u || M(), h = null, u = !1;
2215
2248
  }
2216
- function k() {
2217
- document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", m);
2249
+ function C() {
2250
+ document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", m);
2218
2251
  }
2219
- function S() {
2220
- a.value ? P() : T();
2252
+ function M() {
2253
+ a.value ? A() : R();
2221
2254
  }
2222
- function T() {
2255
+ function R() {
2223
2256
  a.value = !0, n("open", o.node.id), requestAnimationFrame(() => {
2224
- document.addEventListener("mousedown", G);
2257
+ document.addEventListener("mousedown", B);
2225
2258
  });
2226
2259
  }
2227
- function P() {
2228
- a.value = !1, n("close"), document.removeEventListener("mousedown", G);
2260
+ function A() {
2261
+ a.value = !1, n("close"), document.removeEventListener("mousedown", B);
2229
2262
  }
2230
- function G(z) {
2231
- const M = z.target;
2232
- i.value?.contains(M) || r.value?.contains(M) || P();
2263
+ function B(z) {
2264
+ const D = z.target;
2265
+ i.value?.contains(D) || r.value?.contains(D) || A();
2233
2266
  }
2234
- function K() {
2267
+ function V() {
2235
2268
  a.value || n("mouseleave");
2236
2269
  }
2237
2270
  function O() {
2238
- g && (clearTimeout(g), g = null), n("mouseenter");
2271
+ p && (clearTimeout(p), p = null), n("mouseenter");
2239
2272
  }
2240
2273
  function W() {
2241
- g = setTimeout(() => {
2242
- P(), n("mouseleave"), g = null;
2274
+ p = setTimeout(() => {
2275
+ A(), n("mouseleave"), p = null;
2243
2276
  }, 150);
2244
2277
  }
2245
2278
  return Me(() => {
2246
- k(), g && clearTimeout(g), document.removeEventListener("mousedown", G);
2247
- }), e({ closePopover: P }), (z, M) => (D(), R("div", {
2279
+ C(), p && clearTimeout(p), document.removeEventListener("mousedown", B);
2280
+ }), e({ closePopover: A }), (z, D) => (_(), T("div", {
2248
2281
  class: "flow-canvas-quick-add",
2249
2282
  style: we({ left: `${s.portPosition.x}px`, top: `${s.portPosition.y}px` }),
2250
- onMouseenter: M[2] || (M[2] = (y) => n("mouseenter")),
2251
- onMouseleave: K,
2252
- onClick: M[3] || (M[3] = rt(() => {
2283
+ onMouseenter: D[2] || (D[2] = (y) => n("mouseenter")),
2284
+ onMouseleave: V,
2285
+ onClick: D[3] || (D[3] = at(() => {
2253
2286
  }, ["stop"]))
2254
2287
  }, [
2255
- U("div", {
2288
+ q("div", {
2256
2289
  ref_key: "btnRef",
2257
2290
  ref: i,
2258
2291
  class: se(["flow-canvas-quick-add__btn", { "is-hovered": l.value, "is-active": a.value }]),
2259
- onMouseenter: M[0] || (M[0] = (y) => l.value = !0),
2260
- onMouseleave: M[1] || (M[1] = (y) => l.value = !1),
2261
- onMousedown: p
2262
- }, [...M[4] || (M[4] = [
2263
- U("i", { class: "flow-canvas-icon canvas-zoom-add" }, null, -1)
2292
+ onMouseenter: D[0] || (D[0] = (y) => l.value = !0),
2293
+ onMouseleave: D[1] || (D[1] = (y) => l.value = !1),
2294
+ onMousedown: g
2295
+ }, [...D[4] || (D[4] = [
2296
+ q("i", { class: "flow-canvas-icon canvas-zoom-add" }, null, -1)
2264
2297
  ])], 34),
2265
- l.value && !a.value ? (D(), R("div", so, [...M[5] || (M[5] = [
2266
- U("div", null, [
2267
- U("b", null, "点击"),
2268
- Le(" 添加节点")
2298
+ l.value && !a.value ? (_(), T("div", io, [...D[5] || (D[5] = [
2299
+ q("div", null, [
2300
+ q("b", null, "点击"),
2301
+ He(" 添加节点")
2269
2302
  ], -1),
2270
- U("div", null, [
2271
- U("b", null, "拖拽"),
2272
- Le(" 连接节点")
2303
+ q("div", null, [
2304
+ q("b", null, "拖拽"),
2305
+ He(" 连接节点")
2273
2306
  ], -1)
2274
- ])])) : Y("", !0),
2307
+ ])])) : Z("", !0),
2275
2308
  et(tt, { name: "flow-canvas-fade" }, {
2276
- default: He(() => [
2277
- a.value ? (D(), R("div", {
2309
+ default: $e(() => [
2310
+ a.value ? (_(), T("div", {
2278
2311
  key: 0,
2279
2312
  ref_key: "popoverRef",
2280
2313
  ref: r,
@@ -2282,16 +2315,16 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2282
2315
  onMouseenter: O,
2283
2316
  onMouseleave: W
2284
2317
  }, [
2285
- xe(z.$slots, "default", {}, () => [
2286
- M[6] || (M[6] = U("div", { class: "flow-canvas-quick-add__default-content" }, "节点快捷操作面板", -1))
2318
+ Ie(z.$slots, "default", {}, () => [
2319
+ D[6] || (D[6] = q("div", { class: "flow-canvas-quick-add__default-content" }, "节点快捷操作面板", -1))
2287
2320
  ], !0)
2288
- ], 544)) : Y("", !0)
2321
+ ], 544)) : Z("", !0)
2289
2322
  ]),
2290
2323
  _: 3
2291
2324
  })
2292
2325
  ], 36));
2293
2326
  }
2294
- }), ao = /* @__PURE__ */ he(ro, [["__scopeId", "data-v-336cc3b4"]]), lo = { class: "flow-canvas-selection-actions__bar" }, co = /* @__PURE__ */ fe({
2327
+ }), lo = /* @__PURE__ */ ve(ao, [["__scopeId", "data-v-336cc3b4"]]), co = { class: "flow-canvas-selection-actions__bar" }, uo = /* @__PURE__ */ ge({
2295
2328
  __name: "selection-actions-toolbar",
2296
2329
  props: {
2297
2330
  position: {},
@@ -2304,19 +2337,19 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2304
2337
  top: `${t.position.y}px`,
2305
2338
  transform: "translateX(-100%)"
2306
2339
  }));
2307
- return (i, r) => (D(), R("div", {
2340
+ return (i, r) => (_(), T("div", {
2308
2341
  class: "flow-canvas-selection-actions",
2309
2342
  style: we(n.value)
2310
2343
  }, [
2311
- U("div", lo, [
2312
- U("i", {
2344
+ q("div", co, [
2345
+ q("i", {
2313
2346
  class: se(["flow-canvas-icon canvas-shanchu flow-canvas-selection-actions__icon", { "is-disabled": !s.canDelete }]),
2314
2347
  onClick: r[0] || (r[0] = (l) => s.canDelete && o("action", "delete"))
2315
2348
  }, null, 2)
2316
2349
  ])
2317
2350
  ], 4));
2318
2351
  }
2319
- }), uo = /* @__PURE__ */ he(co, [["__scopeId", "data-v-25eb8b79"]]), fo = { class: "flow-canvas-runtime-core__overlay" }, go = /* @__PURE__ */ fe({
2352
+ }), fo = /* @__PURE__ */ ve(uo, [["__scopeId", "data-v-25eb8b79"]]), go = { class: "flow-canvas-runtime-core__overlay" }, po = /* @__PURE__ */ ge({
2320
2353
  __name: "canvas-runtime-core",
2321
2354
  props: {
2322
2355
  editor: {},
@@ -2324,16 +2357,17 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2324
2357
  nodeActions: {},
2325
2358
  quickAdd: {},
2326
2359
  edgeDrop: {},
2327
- getConnectionExcludedNodeIds: { type: Function }
2360
+ getConnectionExcludedNodeIds: { type: Function },
2361
+ toolbarInclude: {}
2328
2362
  },
2329
2363
  emits: ["ui-event"],
2330
2364
  setup(s, { emit: e }) {
2331
- const t = s, o = e, n = q(), i = q();
2332
- let r, l, a, h, u = null, g = null, p = null, E = null;
2333
- const m = jt(), { hoveredNodeId: k, isDraggingNode: S } = m, T = m.enterOverlay, P = () => m.leaveOverlay(), G = q(0), K = q({ nodeIds: [], edgeIds: [] });
2334
- function O(N) {
2365
+ const t = s, o = e, n = G(), i = G();
2366
+ let r, l, a, h, u = null, p = null, g = null, x = null;
2367
+ const m = Wt(), { hoveredNodeId: C, isDraggingNode: M } = m, R = m.enterOverlay, A = () => m.leaveOverlay(), B = G(0), V = G({ nodeIds: [], edgeIds: [] });
2368
+ function O(S) {
2335
2369
  const I = t.editor.api.value;
2336
- return I ? t.editor.schema.nodeTypes[N.type]?.getBehavior?.(N, {
2370
+ return I ? t.editor.schema.nodeTypes[S.type]?.getBehavior?.(S, {
2337
2371
  api: I,
2338
2372
  flowModel: t.editor.flowModel.value,
2339
2373
  history: t.editor.history,
@@ -2348,176 +2382,187 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2348
2382
  showDisconnect: !0,
2349
2383
  insertGap: 100,
2350
2384
  ...t.nodeActions
2351
- })), M = j(
2385
+ })), D = j(
2352
2386
  () => {
2353
- if (G.value, !t.editor.api.value) return [];
2354
- const N = t.editor.flowModel.value, I = t.editor.api.value.overlay, _ = [];
2355
- for (const [F, ae] of Object.entries(N.nodes)) {
2387
+ if (B.value, !t.editor.api.value) return [];
2388
+ const S = t.editor.flowModel.value, I = t.editor.api.value.overlay, N = [];
2389
+ for (const [U, ae] of Object.entries(S.nodes)) {
2356
2390
  const de = t.editor._pluginManager.collectNodeDecorations(ae);
2357
2391
  if (!de?.badge) continue;
2358
- const J = I.getNodeScreenRect(F);
2359
- J && _.push({
2360
- nodeId: F,
2392
+ const J = I.getNodeScreenRect(U);
2393
+ J && N.push({
2394
+ nodeId: U,
2361
2395
  x: J.x + J.width - 4,
2362
2396
  y: J.y - 8,
2363
2397
  badge: de.badge
2364
2398
  });
2365
2399
  }
2366
- return _;
2400
+ return N;
2367
2401
  }
2368
2402
  ), y = j(() => {
2369
- G.value;
2370
- const N = k.value;
2371
- if (!N || S.value || !t.editor.api.value || t.editor.mode.value !== "edit" || W.value)
2403
+ B.value;
2404
+ const S = C.value;
2405
+ if (!S || M.value || !t.editor.api.value || t.editor.mode.value !== "edit" || W.value)
2372
2406
  return null;
2373
- const _ = t.editor.flowModel.value.nodes[N];
2374
- if (!_) return null;
2375
- const F = t.editor.api.value.overlay.getNodeScreenRect(N);
2376
- if (!F) return null;
2377
- const ae = O(_);
2407
+ const N = t.editor.flowModel.value.nodes[S];
2408
+ if (!N) return null;
2409
+ const U = t.editor.api.value.overlay.getNodeScreenRect(S);
2410
+ if (!U) return null;
2411
+ const ae = O(N);
2378
2412
  return ae.showActions === !1 ? null : {
2379
- node: _,
2380
- position: { x: F.x + F.width, y: F.y + F.height + 4 },
2413
+ node: N,
2414
+ position: { x: U.x + U.width, y: U.y + U.height + 4 },
2381
2415
  behavior: ae
2382
2416
  };
2383
2417
  }), f = j(() => {
2384
- if (G.value, !t.editor.api.value || t.editor.mode.value !== "edit") return null;
2385
- const N = K.value;
2386
- if (N.nodeIds.length + N.edgeIds.length <= 1) return null;
2387
- const I = t.editor.api.value.getSelectionBounds(N);
2418
+ if (B.value, !t.editor.api.value || t.editor.mode.value !== "edit") return null;
2419
+ const S = V.value;
2420
+ if (S.nodeIds.length + S.edgeIds.length <= 1) return null;
2421
+ const I = t.editor.api.value.getSelectionBounds(S);
2388
2422
  if (!I) return null;
2389
- const _ = it(N, t.editor.flowModel.value, O);
2423
+ const N = rt(S, t.editor.flowModel.value, O);
2390
2424
  return {
2391
2425
  position: { x: I.x + I.width, y: I.y + I.height + 4 },
2392
- canDelete: _.nodeIds.length > 0 || _.edgeIds.length > 0
2426
+ canDelete: N.nodeIds.length > 0 || N.edgeIds.length > 0
2393
2427
  };
2394
- }), d = q(), c = Xt({
2428
+ }), d = G(), c = Kt({
2395
2429
  editor: t.editor,
2396
2430
  quickAddProp: j(() => t.quickAdd),
2397
- isDraggingNode: S,
2431
+ isDraggingNode: M,
2398
2432
  nodeHover: m,
2399
2433
  isSelectionModeActive: W,
2400
- viewportVersion: G,
2434
+ viewportVersion: B,
2401
2435
  getNodeBehavior: O,
2402
2436
  getInsertGap: () => z.value.insertGap,
2403
2437
  closePopover: () => d.value?.closePopover()
2404
- }), v = c.data, b = c.handleOpen, x = c.handleClose, B = c.handleStartDrag, X = c.handleOverlayEnter, C = c.handleOverlayLeave, L = c.handleInsert, w = Zt({
2438
+ }), v = c.data, b = c.handleOpen, E = c.handleClose, F = c.handleStartDrag, K = c.handleOverlayEnter, k = c.handleOverlayLeave, L = c.handleInsert, w = Qt({
2405
2439
  editor: t.editor,
2406
2440
  edgeDropProp: j(() => t.edgeDrop)
2407
- }), A = Qt(t.editor);
2408
- function H(N, I) {
2409
- A.handleNodeAction(N, I, z.value.insertGap) && (k.value = null);
2441
+ }), P = Jt(t.editor);
2442
+ function H(S, I) {
2443
+ P.handleNodeAction(S, I, z.value.insertGap) && (C.value = null);
2410
2444
  }
2411
- function Z(N) {
2412
- N === "delete" && A.deleteSelection(K.value);
2445
+ function Y(S) {
2446
+ S === "delete" && P.deleteSelection(V.value);
2413
2447
  }
2414
- function V(N) {
2448
+ function X(S) {
2415
2449
  if (t.editor.mode.value !== "edit") return;
2416
- t.editor._pluginManager.dispatchKeyboardShortcut(N) && (N.preventDefault(), N.stopPropagation());
2450
+ if ((S.metaKey || S.ctrlKey) && (S.key === "z" || S.key === "Z")) {
2451
+ if (S.shiftKey) {
2452
+ if (!t.toolbarInclude?.includes("redo")) return;
2453
+ t.editor.history.redo();
2454
+ } else {
2455
+ if (!t.toolbarInclude?.includes("undo")) return;
2456
+ t.editor.history.undo();
2457
+ }
2458
+ S.preventDefault();
2459
+ return;
2460
+ }
2461
+ t.editor._pluginManager.dispatchKeyboardShortcut(S) && (S.preventDefault(), S.stopPropagation());
2417
2462
  }
2418
- function ee(N, I) {
2419
- const _ = r, F = (ae) => {
2420
- const de = _.isRubberbandEnabled?.() ?? !1;
2421
- de && _.disableRubberband?.(), ae ? r.enablePanning() : r.disablePanning(), de && _.enableRubberband?.();
2463
+ function ee(S, I) {
2464
+ const N = r, U = (ae) => {
2465
+ const de = N.isRubberbandEnabled?.() ?? !1;
2466
+ de && N.disableRubberband?.(), ae ? r.enablePanning() : r.disablePanning(), de && N.enableRubberband?.();
2422
2467
  };
2423
- N && I ? (_.enableSelection?.(), m.reset(), c.quickAddNodeId.value = null, c.quickAddPopoverOpen.value = !1, u?.remove(), F(!1), _.enableRubberband?.()) : (_.disableRubberband?.(), F(!0), _.disableSelection?.(), _.cleanSelection?.());
2468
+ S && I ? (N.enableSelection?.(), m.reset(), c.quickAddNodeId.value = null, c.quickAddPopoverOpen.value = !1, u?.remove(), U(!1), N.enableRubberband?.()) : (N.disableRubberband?.(), U(!0), N.disableSelection?.(), N.cleanSelection?.());
2424
2469
  }
2425
- function Q(N) {
2470
+ function Q(S) {
2426
2471
  r.on("node:move", ({ node: I }) => {
2427
- S.value = !0;
2428
- const _ = t.editor.flowModel.value.nodes[I.id];
2429
- _ && O(_).bringToFrontOnDrag === !1 || I.toFront?.();
2472
+ M.value = !0;
2473
+ const N = t.editor.flowModel.value.nodes[I.id];
2474
+ N && O(N).bringToFrontOnDrag === !1 || I.toFront?.();
2430
2475
  }), r.on("node:moved", () => {
2431
- S.value = !1;
2476
+ M.value = !1;
2432
2477
  }), r.on("node:mouseenter", ({ node: I }) => {
2433
2478
  if (W.value) {
2434
- k.value = null, c.quickAddNodeId.value = null, N.hideNodePorts(I);
2479
+ C.value = null, c.quickAddNodeId.value = null, S.hideNodePorts(I);
2435
2480
  return;
2436
2481
  }
2437
2482
  m.enter(I.id);
2438
- const _ = t.editor.flowModel.value.nodes[I.id];
2439
- if (_ && O(_).showPorts === !1) {
2483
+ const N = t.editor.flowModel.value.nodes[I.id];
2484
+ if (N && O(N).showPorts === !1) {
2440
2485
  c.mergedConfig.value.enabled && c.enter(I.id);
2441
2486
  return;
2442
2487
  }
2443
- c.mergedConfig.value.enabled && c.enter(I.id) || N.showNodePorts(I);
2488
+ c.mergedConfig.value.enabled && c.enter(I.id) || S.showNodePorts(I);
2444
2489
  }), r.on("node:mouseleave", ({ node: I }) => {
2445
2490
  if (W.value) {
2446
- N.hideNodePorts(I);
2491
+ S.hideNodePorts(I);
2447
2492
  return;
2448
2493
  }
2449
- const _ = t.editor.flowModel.value.nodes[I.id];
2450
- let F = 100;
2451
- _ && O(_).actionsOffset && (F = 300), m.leave(F), c.mergedConfig.value.enabled ? c.quickAddNodeId.value === I.id && !c.quickAddPopoverOpen.value ? c.leave() : c.quickAddNodeId.value !== I.id && N.hideNodePorts(I) : N.hideNodePorts(I);
2494
+ const N = t.editor.flowModel.value.nodes[I.id];
2495
+ let U = 100;
2496
+ N && O(N).actionsOffset && (U = 300), m.leave(U), c.mergedConfig.value.enabled ? c.quickAddNodeId.value === I.id && !c.quickAddPopoverOpen.value ? c.leave() : c.quickAddNodeId.value !== I.id && S.hideNodePorts(I) : S.hideNodePorts(I);
2452
2497
  });
2453
2498
  }
2454
- function oe(N) {
2499
+ function oe(S) {
2455
2500
  r.on("edge:added", ({ edge: I }) => {
2456
- let _;
2501
+ let N;
2457
2502
  if (t.getConnectionExcludedNodeIds && !I.getTargetCell()) {
2458
- const F = I.getSourceCell();
2459
- if (F) {
2460
- const ae = t.getConnectionExcludedNodeIds(F.id);
2461
- _ = ae instanceof Set ? ae : new Set(ae);
2503
+ const U = I.getSourceCell();
2504
+ if (U) {
2505
+ const ae = t.getConnectionExcludedNodeIds(U.id);
2506
+ N = ae instanceof Set ? ae : new Set(ae);
2462
2507
  }
2463
2508
  }
2464
- N.handleEdgeAdded(I, _);
2509
+ S.handleEdgeAdded(I, N);
2465
2510
  }), r.on("edge:connected", () => {
2466
- N.handleEdgeConnected();
2511
+ S.handleEdgeConnected();
2467
2512
  }), r.on("edge:removed", ({ edge: I }) => {
2468
- N.handleEdgeRemoved(I.id), u.handleEdgeRemoved(I.id);
2469
- }), r.on("edge:mouseenter", ({ edge: I, e: _ }) => {
2470
- const F = l.getHoveredEdgeId();
2471
- l.setHoveredEdge(I.id), F && F !== I.id && l.refreshSingleEdgeStyle(F), l.refreshSingleEdgeStyle(I.id), t.editor.mode.value === "edit" && !W.value && N.canShowEdgeTool() && u.show(I.id, _);
2513
+ S.handleEdgeRemoved(I.id), u.handleEdgeRemoved(I.id);
2514
+ }), r.on("edge:mouseenter", ({ edge: I, e: N }) => {
2515
+ const U = l.getHoveredEdgeId();
2516
+ l.setHoveredEdge(I.id), U && U !== I.id && l.refreshSingleEdgeStyle(U), l.refreshSingleEdgeStyle(I.id), t.editor.mode.value === "edit" && !W.value && S.canShowEdgeTool() && u.show(I.id, N);
2472
2517
  }), r.on("edge:mouseleave", ({ edge: I }) => {
2473
2518
  l.setHoveredEdge(null), l.refreshSingleEdgeStyle(I.id), u.remove();
2474
- }), r.on("edge:click", ({ edge: I, e: _ }) => {
2475
- _.target?.closest?.(".flow-canvas-edge-delete-tool") && t.editor.mode.value === "edit" && (u.remove(), t.editor.executeCommand({
2519
+ }), r.on("edge:click", ({ edge: I, e: N }) => {
2520
+ N.target?.closest?.(".flow-canvas-edge-delete-tool") && t.editor.mode.value === "edit" && (u.remove(), t.editor.executeCommand({
2476
2521
  id: te(),
2477
2522
  source: "user:toolbar",
2478
2523
  label: "删除连线",
2479
2524
  timestamp: Date.now(),
2480
2525
  commands: [{ type: "edge.remove", edgeId: I.id }]
2481
2526
  }));
2482
- }), g = (I) => u.move(I), r.container.addEventListener("mousemove", g);
2527
+ }), p = (I) => u.move(I), r.container.addEventListener("mousemove", p);
2483
2528
  }
2484
2529
  function ie() {
2485
- p = (N) => {
2486
- if (!k.value && !c.quickAddNodeId.value) return;
2487
- const I = N.target;
2530
+ g = (S) => {
2531
+ if (!C.value && !c.quickAddNodeId.value) return;
2532
+ const I = S.target;
2488
2533
  if (I?.closest?.(".x6-node") || I?.closest?.(".flow-canvas-node-actions") || I?.closest?.(".flow-canvas-quick-add")) {
2489
2534
  m.cancelLeave(), c.cancelLeave();
2490
2535
  return;
2491
2536
  }
2492
2537
  m.leave(180), c.quickAddPopoverOpen.value || c.leave();
2493
- }, n.value?.addEventListener("mousemove", p), E = () => {
2538
+ }, n.value?.addEventListener("mousemove", g), x = () => {
2494
2539
  m.reset(), c.quickAddPopoverOpen.value || (c.quickAddNodeId.value = null);
2495
- }, n.value?.addEventListener("mouseleave", E), n.value?.addEventListener("keydown", V);
2540
+ }, n.value?.addEventListener("mouseleave", x), n.value?.addEventListener("keydown", X);
2496
2541
  }
2497
2542
  function ne() {
2498
- pe(
2543
+ he(
2499
2544
  () => t.editor.flowModel.value,
2500
- (N) => l.syncFlowModel(N)
2501
- ), pe(
2545
+ (S) => l.syncFlowModel(S)
2546
+ ), he(
2502
2547
  [() => t.editor.mode.value, () => t.editor.selectionMode.value],
2503
- ([N, I]) => {
2504
- ee(N === "edit", I);
2548
+ ([S, I]) => {
2549
+ ee(S === "edit", I);
2505
2550
  },
2506
2551
  { immediate: !0 }
2507
2552
  );
2508
2553
  }
2509
2554
  return ot(() => {
2510
2555
  if (!i.value) return;
2511
- const N = /* @__PURE__ */ new Set(["model", "container"]), I = {};
2556
+ const S = /* @__PURE__ */ new Set(["model", "container"]), I = {};
2512
2557
  if (t.graphOptions)
2513
2558
  for (const [$, re] of Object.entries(t.graphOptions)) {
2514
- if (N.has($)) {
2559
+ if (S.has($)) {
2515
2560
  console.warn(`[flow-canvas] graphOptions.${$} is managed by the engine and will be ignored`);
2516
2561
  continue;
2517
2562
  }
2518
2563
  I[$] = re;
2519
2564
  }
2520
- r = new ft({
2565
+ r = new gt({
2521
2566
  container: i.value,
2522
2567
  autoResize: !0,
2523
2568
  background: { color: "#edf2fc" },
@@ -2543,11 +2588,11 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2543
2588
  connectionPoint: "anchor",
2544
2589
  snap: { radius: 30 },
2545
2590
  createEdge() {
2546
- return eo(this, t.editor.schema);
2591
+ return to(this, t.editor.schema);
2547
2592
  }
2548
2593
  },
2549
2594
  ...I
2550
- }), a = new Bt(), l = new $t(
2595
+ }), a = new Ft(), l = new Bt(
2551
2596
  r,
2552
2597
  t.editor.schema,
2553
2598
  a,
@@ -2560,9 +2605,9 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2560
2605
  mode: t.editor.mode.value
2561
2606
  } : null
2562
2607
  );
2563
- const _ = Gt(r), F = zt({
2608
+ const N = Gt(r), U = jt({
2564
2609
  graph: r,
2565
- overlayManager: _,
2610
+ overlayManager: N,
2566
2611
  executeCommand: ($) => t.editor.executeCommand(w.tryExpandForEdgeDrop($)),
2567
2612
  schema: t.editor.schema,
2568
2613
  flowModel: t.editor.flowModel,
@@ -2574,20 +2619,20 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2574
2619
  l.setHighlightedNodes($);
2575
2620
  const ce = l.setHighlightedEdges(re);
2576
2621
  l.refreshNodeHighlights();
2577
- const ve = new Set(re);
2578
- for (const ye of ce)
2579
- ve.has(ye) || l.refreshSingleEdgeStyle(ye);
2580
- for (const ye of ve)
2581
- ce.has(ye) || l.refreshSingleEdgeStyle(ye);
2622
+ const ye = new Set(re);
2623
+ for (const me of ce)
2624
+ ye.has(me) || l.refreshSingleEdgeStyle(me);
2625
+ for (const me of ye)
2626
+ ce.has(me) || l.refreshSingleEdgeStyle(me);
2582
2627
  },
2583
2628
  resolveNodeShape: ($) => {
2584
2629
  const re = t.editor.schema.nodeTypes[$];
2585
2630
  if (!re) return null;
2586
- const ce = a.registerNodeType($, re.component), ve = re.getSize({ id: "", type: $, position: { x: 0, y: 0 } });
2587
- return { shapeName: ce, width: ve.width, height: ve.height };
2631
+ const ce = a.registerNodeType($, re.component), ye = re.getSize({ id: "", type: $, position: { x: 0, y: 0 } });
2632
+ return { shapeName: ce, width: ye.width, height: ye.height };
2588
2633
  }
2589
2634
  });
2590
- t.editor.api.value = F;
2635
+ t.editor.api.value = U;
2591
2636
  const ae = {
2592
2637
  flowModel: t.editor.flowModel,
2593
2638
  history: t.editor.history,
@@ -2596,8 +2641,8 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2596
2641
  idGenerator: t.editor.idGenerator,
2597
2642
  executeCommand: t.editor.executeCommand,
2598
2643
  selectionMode: t.editor.selectionMode,
2599
- api: F,
2600
- overlay: _,
2644
+ api: U,
2645
+ overlay: N,
2601
2646
  graph: r
2602
2647
  };
2603
2648
  t.editor._pluginManager.attachRuntime(ae);
@@ -2613,22 +2658,22 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2613
2658
  if (l.isSyncing) return;
2614
2659
  const re = w.tryExpandForEdgeDrop($);
2615
2660
  if (t.editor.executeCommand(re).status !== "applied") {
2616
- for (const ve of re.commands)
2617
- if (ve.type === "edge.add") {
2618
- const ye = r.getCellById(ve.edge.id);
2619
- ye && r.removeCell(ye);
2661
+ for (const ye of re.commands)
2662
+ if (ye.type === "edge.add") {
2663
+ const me = r.getCellById(ye.edge.id);
2664
+ me && r.removeCell(me);
2620
2665
  }
2621
2666
  }
2622
2667
  },
2623
2668
  t.editor.flowModel,
2624
2669
  t.editor.idGenerator
2625
- ), u = Wt(r);
2626
- const J = Vt(r);
2670
+ ), u = Vt(r);
2671
+ const J = Xt(r);
2627
2672
  c.attachRuntime(r, ($) => J.hideNodePorts($)), w.attachRuntime(r), Q(J), oe(J);
2628
2673
  let Ae = /* @__PURE__ */ new Set();
2629
2674
  r.on("selection:changed", () => {
2630
- const $ = st(r.getSelectedCells?.() ?? []);
2631
- K.value = $, t.editor._pluginManager.dispatchSelectionChange($), o("ui-event", {
2675
+ const $ = it(r.getSelectedCells?.() ?? []);
2676
+ V.value = $, t.editor._pluginManager.dispatchSelectionChange($), o("ui-event", {
2632
2677
  type: "selection.change",
2633
2678
  nodeIds: $.nodeIds,
2634
2679
  edgeIds: $.edgeIds
@@ -2641,54 +2686,54 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2641
2686
  Ae = re;
2642
2687
  });
2643
2688
  const Pe = () => {
2644
- G.value++;
2689
+ B.value++;
2645
2690
  };
2646
2691
  r.on("translate", Pe), r.on("scale", Pe), r.on("resize", Pe), ie(), l.syncFlowModel(t.editor.flowModel.value), ne();
2647
2692
  }), Me(() => {
2648
- m.cleanup(), c.cleanup(), w.cleanup(), u?.remove(), g && r?.container?.removeEventListener("mousemove", g), p && n.value?.removeEventListener("mousemove", p), E && n.value?.removeEventListener("mouseleave", E), n.value?.removeEventListener("keydown", V), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
2649
- for (const N of Object.keys(t.editor.extendedApi))
2650
- delete t.editor.extendedApi[N];
2693
+ m.cleanup(), c.cleanup(), w.cleanup(), u?.remove(), p && r?.container?.removeEventListener("mousemove", p), g && n.value?.removeEventListener("mousemove", g), x && n.value?.removeEventListener("mouseleave", x), n.value?.removeEventListener("keydown", X), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
2694
+ for (const S of Object.keys(t.editor.extendedApi))
2695
+ delete t.editor.extendedApi[S];
2651
2696
  h?.dispose(), l?.dispose(), a?.dispose(), r?.dispose();
2652
- }), (N, I) => (D(), R("div", {
2697
+ }), (S, I) => (_(), T("div", {
2653
2698
  ref_key: "rootRef",
2654
2699
  ref: n,
2655
2700
  class: se(["flow-canvas-runtime-core", { "flow-canvas-runtime-core--selection-mode": W.value }]),
2656
2701
  tabindex: "0"
2657
2702
  }, [
2658
- U("div", {
2703
+ q("div", {
2659
2704
  ref_key: "containerRef",
2660
2705
  ref: i,
2661
2706
  class: "flow-canvas-runtime-core__graph"
2662
2707
  }, null, 512),
2663
- U("div", fo, [
2664
- (D(!0), R(me, null, Ie(M.value, (_) => (D(), R("div", {
2665
- key: `badge-${_.nodeId}`,
2708
+ q("div", go, [
2709
+ (_(!0), T(pe, null, xe(D.value, (N) => (_(), T("div", {
2710
+ key: `badge-${N.nodeId}`,
2666
2711
  class: "flow-canvas-runtime-core__badge",
2667
- style: we({ left: `${_.x}px`, top: `${_.y}px`, backgroundColor: _.badge.color })
2668
- }, ge(_.badge.text), 5))), 128)),
2669
- le(v) ? (D(), be(ao, {
2712
+ style: we({ left: `${N.x}px`, top: `${N.y}px`, backgroundColor: N.badge.color })
2713
+ }, ue(N.badge.text), 5))), 128)),
2714
+ le(v) ? (_(), be(lo, {
2670
2715
  key: 0,
2671
2716
  ref_key: "quickAddPopoverRef",
2672
2717
  ref: d,
2673
2718
  node: le(v).node,
2674
2719
  "port-position": le(v).portPosition,
2675
2720
  onOpen: le(b),
2676
- onClose: le(x),
2677
- onStartDrag: le(B),
2678
- onMouseenter: le(X),
2679
- onMouseleave: le(C)
2721
+ onClose: le(E),
2722
+ onStartDrag: le(F),
2723
+ onMouseenter: le(K),
2724
+ onMouseleave: le(k)
2680
2725
  }, {
2681
- default: He(() => [
2682
- xe(N.$slots, "quick-add-panel", {
2726
+ default: $e(() => [
2727
+ Ie(S.$slots, "quick-add-panel", {
2683
2728
  node: le(v).node,
2684
2729
  api: s.editor.api.value,
2685
- insertNodeToRight: (_) => le(L)(le(v).node.id, _),
2730
+ insertNodeToRight: (N) => le(L)(le(v).node.id, N),
2686
2731
  closePopover: () => d.value?.closePopover()
2687
2732
  }, void 0, !0)
2688
2733
  ]),
2689
2734
  _: 3
2690
- }, 8, ["node", "port-position", "onOpen", "onClose", "onStartDrag", "onMouseenter", "onMouseleave"])) : Y("", !0),
2691
- y.value ? (D(), be(no, {
2735
+ }, 8, ["node", "port-position", "onOpen", "onClose", "onStartDrag", "onMouseenter", "onMouseleave"])) : Z("", !0),
2736
+ y.value ? (_(), be(so, {
2692
2737
  key: 1,
2693
2738
  node: y.value.node,
2694
2739
  position: y.value.position,
@@ -2696,74 +2741,74 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2696
2741
  behavior: y.value.behavior,
2697
2742
  "actions-offset": y.value.behavior.actionsOffset,
2698
2743
  onAction: H,
2699
- onMouseenter: le(T),
2700
- onMouseleave: P
2701
- }, null, 8, ["node", "position", "config", "behavior", "actions-offset", "onMouseenter"])) : Y("", !0),
2702
- f.value ? (D(), be(uo, {
2744
+ onMouseenter: le(R),
2745
+ onMouseleave: A
2746
+ }, null, 8, ["node", "position", "config", "behavior", "actions-offset", "onMouseenter"])) : Z("", !0),
2747
+ f.value ? (_(), be(fo, {
2703
2748
  key: 2,
2704
2749
  position: f.value.position,
2705
2750
  "can-delete": f.value.canDelete,
2706
- onAction: Z
2707
- }, null, 8, ["position", "can-delete"])) : Y("", !0)
2751
+ onAction: Y
2752
+ }, null, 8, ["position", "can-delete"])) : Z("", !0)
2708
2753
  ])
2709
2754
  ], 2));
2710
2755
  }
2711
- }), pn = /* @__PURE__ */ he(go, [["__scopeId", "data-v-5a3959fd"]]), po = { class: "flow-canvas-node-palette" }, ho = ["data-node-type"], vo = { class: "flow-canvas-node-palette__item-label" }, yo = /* @__PURE__ */ fe({
2756
+ }), vn = /* @__PURE__ */ ve(po, [["__scopeId", "data-v-cd58116b"]]), ho = { class: "flow-canvas-node-palette" }, vo = ["data-node-type"], yo = { class: "flow-canvas-node-palette__item-label" }, mo = /* @__PURE__ */ ge({
2712
2757
  __name: "canvas-node-palette",
2713
2758
  props: {
2714
2759
  editor: {},
2715
2760
  items: {}
2716
2761
  },
2717
2762
  setup(s) {
2718
- const e = s, t = q(), o = j(() => e.items ? e.items : Object.keys(e.editor.schema.nodeTypes).map((n) => ({
2763
+ const e = s, t = G(), o = j(() => e.items ? e.items : Object.keys(e.editor.schema.nodeTypes).map((n) => ({
2719
2764
  type: n,
2720
2765
  label: n.charAt(0).toUpperCase() + n.slice(1)
2721
2766
  })));
2722
- return pe(
2767
+ return he(
2723
2768
  [() => e.editor.api.value, o, t],
2724
2769
  ([n, i, r], l, a) => {
2725
2770
  if (!n || !r) return;
2726
2771
  const h = [];
2727
2772
  for (const u of i) {
2728
- const g = r.querySelector(`[data-node-type="${u.type}"]`);
2729
- if (!g) continue;
2730
- const p = n.registerDndSource(g, () => ({
2773
+ const p = r.querySelector(`[data-node-type="${u.type}"]`);
2774
+ if (!p) continue;
2775
+ const g = n.registerDndSource(p, () => ({
2731
2776
  id: te(),
2732
2777
  type: u.type,
2733
2778
  label: u.label,
2734
2779
  position: { x: 0, y: 0 }
2735
2780
  }));
2736
- h.push(p);
2781
+ h.push(g);
2737
2782
  }
2738
2783
  a(() => {
2739
2784
  for (const u of h) u();
2740
2785
  });
2741
2786
  },
2742
2787
  { flush: "post" }
2743
- ), (n, i) => (D(), R("div", po, [
2744
- U("div", {
2788
+ ), (n, i) => (_(), T("div", ho, [
2789
+ q("div", {
2745
2790
  ref_key: "listRef",
2746
2791
  ref: t,
2747
2792
  class: "flow-canvas-node-palette__list"
2748
2793
  }, [
2749
- (D(!0), R(me, null, Ie(o.value, (r) => (D(), R("div", {
2794
+ (_(!0), T(pe, null, xe(o.value, (r) => (_(), T("div", {
2750
2795
  key: r.type,
2751
2796
  class: "flow-canvas-node-palette__item",
2752
2797
  "data-node-type": r.type
2753
2798
  }, [
2754
- r.icon ? (D(), R("i", {
2799
+ r.icon ? (_(), T("i", {
2755
2800
  key: 0,
2756
2801
  class: se([r.icon, "flow-canvas-node-palette__item-icon"])
2757
- }, null, 2)) : Y("", !0),
2758
- U("span", vo, ge(r.label), 1)
2759
- ], 8, ho))), 128))
2802
+ }, null, 2)) : Z("", !0),
2803
+ q("span", yo, ue(r.label), 1)
2804
+ ], 8, vo))), 128))
2760
2805
  ], 512)
2761
2806
  ]));
2762
2807
  }
2763
- }), mo = /* @__PURE__ */ he(yo, [["__scopeId", "data-v-300314b7"]]), wo = { class: "flow-canvas-layout" }, bo = { class: "flow-canvas-layout__main" }, Eo = { class: "flow-canvas-layout__content" }, xo = {
2808
+ }), wo = /* @__PURE__ */ ve(mo, [["__scopeId", "data-v-300314b7"]]), bo = { class: "flow-canvas-layout" }, xo = { class: "flow-canvas-layout__main" }, Eo = { class: "flow-canvas-layout__content" }, Io = {
2764
2809
  key: 0,
2765
2810
  class: "flow-canvas-layout__footer"
2766
- }, Io = /* @__PURE__ */ fe({
2811
+ }, Co = /* @__PURE__ */ ge({
2767
2812
  __name: "canvas-layout",
2768
2813
  props: {
2769
2814
  sidebarCollapsed: { type: Boolean, default: !1 },
@@ -2775,39 +2820,40 @@ const to = { class: "flow-canvas-node-actions__bar" }, oo = /* @__PURE__ */ fe({
2775
2820
  },
2776
2821
  emits: ["update:sidebarCollapsed"],
2777
2822
  setup(s) {
2778
- return (e, t) => (D(), R("div", wo, [
2779
- !s.hideSidebar && (e.$slots.sidebar || s.editor) ? (D(), R("aside", {
2823
+ return (e, t) => (_(), T("div", bo, [
2824
+ !s.hideSidebar && (e.$slots.sidebar || s.editor) ? (_(), T("aside", {
2780
2825
  key: 0,
2781
2826
  class: se(["flow-canvas-layout__sidebar", { "is-collapsed": s.sidebarCollapsed }]),
2782
2827
  style: we({ width: s.sidebarCollapsed ? "0px" : `${s.sidebarWidth}px` })
2783
2828
  }, [
2784
- xe(e.$slots, "sidebar", {}, () => [
2785
- s.editor ? (D(), be(mo, {
2829
+ Ie(e.$slots, "sidebar", {}, () => [
2830
+ s.editor ? (_(), be(wo, {
2786
2831
  key: 0,
2787
2832
  editor: s.editor,
2788
2833
  items: s.paletteItems
2789
- }, null, 8, ["editor", "items"])) : Y("", !0)
2834
+ }, null, 8, ["editor", "items"])) : Z("", !0)
2790
2835
  ], !0)
2791
- ], 6)) : Y("", !0),
2792
- U("div", bo, [
2793
- U("div", Eo, [
2794
- xe(e.$slots, "default", {}, void 0, !0)
2836
+ ], 6)) : Z("", !0),
2837
+ q("div", xo, [
2838
+ q("div", Eo, [
2839
+ Ie(e.$slots, "default", {}, void 0, !0)
2795
2840
  ]),
2796
- !s.hideFooter && e.$slots.footer ? (D(), R("div", xo, [
2797
- xe(e.$slots, "footer", {}, void 0, !0)
2798
- ])) : Y("", !0)
2841
+ !s.hideFooter && e.$slots.footer ? (_(), T("div", Io, [
2842
+ Ie(e.$slots, "footer", {}, void 0, !0)
2843
+ ])) : Z("", !0)
2799
2844
  ])
2800
2845
  ]));
2801
2846
  }
2802
- }), hn = /* @__PURE__ */ he(Io, [["__scopeId", "data-v-26f35b6b"]]), Co = ["undo", "redo"];
2803
- function ko(s) {
2804
- const e = new Set(s?.include), t = new Set(Co.filter((a) => !e.has(a))), o = [
2847
+ }), yn = /* @__PURE__ */ ve(Co, [["__scopeId", "data-v-26f35b6b"]]), Ke = typeof navigator < "u" && /Mac|iPod|iPhone|iPad/.test(navigator.platform ?? navigator.userAgent), ko = ["undo", "redo"];
2848
+ function So(s) {
2849
+ const e = new Set(s?.include), t = new Set(ko.filter((a) => !e.has(a))), o = [
2805
2850
  {
2806
2851
  id: "undo",
2807
2852
  type: "undo",
2808
2853
  group: "history",
2809
2854
  icon: "flow-canvas-icon canvas-undo",
2810
2855
  description: "撤销",
2856
+ shortcut: Ke ? ["⌘", "Z"] : ["Ctrl", "Z"],
2811
2857
  order: 10
2812
2858
  },
2813
2859
  {
@@ -2816,6 +2862,7 @@ function ko(s) {
2816
2862
  group: "history",
2817
2863
  icon: "flow-canvas-icon canvas-redo",
2818
2864
  description: "重做",
2865
+ shortcut: Ke ? ["⇧", "⌘", "Z"] : ["Ctrl", "Shift", "Z"],
2819
2866
  order: 11
2820
2867
  }
2821
2868
  ], n = [
@@ -2824,7 +2871,7 @@ function ko(s) {
2824
2871
  type: "select",
2825
2872
  group: "tools",
2826
2873
  icon: "flow-canvas-icon canvas-kuangxuan",
2827
- description: "框选",
2874
+ description: "框选模式",
2828
2875
  order: 20
2829
2876
  },
2830
2877
  {
@@ -2840,7 +2887,7 @@ function ko(s) {
2840
2887
  type: "export",
2841
2888
  group: "tools",
2842
2889
  icon: "flow-canvas-icon canvas-xiazai",
2843
- description: "导出为图片",
2890
+ description: "下载",
2844
2891
  order: 24
2845
2892
  }
2846
2893
  ], i = [
@@ -2875,17 +2922,21 @@ function ko(s) {
2875
2922
  (a) => !t.has(a.type)
2876
2923
  ), ...i, ...r];
2877
2924
  }
2878
- const So = { class: "flow-canvas-toolbar" }, Mo = {
2925
+ const Mo = { class: "flow-canvas-toolbar" }, Do = {
2879
2926
  key: 0,
2880
2927
  class: "flow-canvas-toolbar__separator"
2881
2928
  }, No = { class: "flow-canvas-toolbar__group" }, _o = {
2882
2929
  key: 0,
2883
2930
  class: "flow-canvas-toolbar__zoom-display"
2884
- }, Do = ["data-toolbar-id", "data-toolbar-type", "disabled", "onClick", "onMouseenter"], Ao = ["textContent"], Po = /* @__PURE__ */ fe({
2931
+ }, Ao = ["data-toolbar-id", "data-toolbar-type", "disabled", "onClick", "onMouseenter"], Po = ["textContent"], To = {
2932
+ key: 0,
2933
+ class: "flow-canvas-toolbar-tooltip__kbd"
2934
+ }, Ro = /* @__PURE__ */ ge({
2885
2935
  __name: "canvas-toolbar",
2886
2936
  props: {
2887
2937
  items: {},
2888
2938
  exclude: {},
2939
+ include: {},
2889
2940
  editor: {}
2890
2941
  },
2891
2942
  setup(s) {
@@ -2906,73 +2957,73 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
2906
2957
  }
2907
2958
  const i = s, r = j(() => {
2908
2959
  if (i.items) return i.items;
2909
- const d = ko(), c = i.editor.toolbarItems.value, v = new Set(i.exclude ?? []), b = /* @__PURE__ */ new Map();
2910
- for (const x of d)
2911
- b.set(x.id, x);
2912
- for (const x of c) {
2913
- const B = b.get(x.id);
2914
- B ? b.set(x.id, { ...B, ...x, order: B.order, group: B.group }) : o(x) && b.set(x.id, x);
2960
+ const d = So({ include: i.include }), c = i.editor.toolbarItems.value, v = new Set(i.exclude ?? []), b = /* @__PURE__ */ new Map();
2961
+ for (const E of d)
2962
+ b.set(E.id, E);
2963
+ for (const E of c) {
2964
+ const F = b.get(E.id);
2965
+ F ? b.set(E.id, { ...F, ...E, order: F.order, group: F.group }) : o(E) && b.set(E.id, E);
2915
2966
  }
2916
- return [...b.values()].filter((x) => x.type === "custom" || !e.has(x.type) ? !0 : !v.has(x.type)).sort((x, B) => (x.order ?? 0) - (B.order ?? 0));
2917
- }), l = q(1), a = q(null), h = q(null), u = q(!1);
2918
- let g = null;
2919
- pe(
2967
+ return [...b.values()].filter((E) => E.type === "custom" || !e.has(E.type) ? !0 : !v.has(E.type)).sort((E, F) => (E.order ?? 0) - (F.order ?? 0));
2968
+ }), l = G(1), a = G(null), h = G(null), u = G(!1);
2969
+ let p = null;
2970
+ he(
2920
2971
  () => i.editor.api.value,
2921
2972
  (d) => {
2922
- g?.(), g = null, d && (l.value = d.getZoom(), g = d.onGraphEvent("scale", () => {
2973
+ p?.(), p = null, d && (l.value = d.getZoom(), p = d.onGraphEvent("scale", () => {
2923
2974
  l.value = d.getZoom();
2924
2975
  }));
2925
2976
  },
2926
2977
  { immediate: !0 }
2927
2978
  );
2928
- const p = at({ visible: !1, text: "", x: 0, y: 0 });
2929
- function E(d, c) {
2979
+ const g = lt({ visible: !1, text: "", shortcut: [], x: 0, y: 0 });
2980
+ function x(d, c) {
2930
2981
  if (!c.description) return;
2931
2982
  const b = d.currentTarget.getBoundingClientRect();
2932
- p.text = c.description, p.visible = !0, Oe(() => {
2933
- const x = a.value?.offsetWidth ?? 0, B = a.value?.offsetHeight ?? 0;
2934
- p.x = b.left + b.width / 2 - x / 2, p.y = b.top - B - 6;
2983
+ g.text = c.description, g.shortcut = c.shortcut ?? [], g.visible = !0, Le(() => {
2984
+ const E = a.value?.offsetWidth ?? 0, F = a.value?.offsetHeight ?? 0;
2985
+ g.x = b.left + b.width / 2 - E / 2, g.y = b.top - F - 6;
2935
2986
  });
2936
2987
  }
2937
2988
  function m() {
2938
- p.visible = !1, a.value = null;
2989
+ g.visible = !1, a.value = null;
2939
2990
  }
2940
2991
  Je(() => {
2941
- g?.();
2992
+ p?.();
2942
2993
  });
2943
- const k = j(() => `${Math.round(l.value * 100)}%`), S = j(() => i.editor.api.value ? {
2994
+ const C = j(() => `${Math.round(l.value * 100)}%`), M = j(() => i.editor.api.value ? {
2944
2995
  api: i.editor.api.value,
2945
2996
  flowModel: i.editor.flowModel.value,
2946
2997
  history: i.editor.history,
2947
2998
  mode: i.editor.mode.value
2948
2999
  } : null);
2949
- function T(d) {
2950
- return d.visible === !1 ? !1 : typeof d.visible == "function" ? S.value ? d.visible(S.value) : !1 : !0;
3000
+ function R(d) {
3001
+ return d.visible === !1 ? !1 : typeof d.visible == "function" ? M.value ? d.visible(M.value) : !1 : !0;
2951
3002
  }
2952
- function P(d) {
2953
- return typeof d.active == "function" ? S.value ? d.active(S.value) : !1 : d.active !== void 0 ? d.active : d.type === "select" ? i.editor.selectionMode.value : !1;
3003
+ function A(d) {
3004
+ return typeof d.active == "function" ? M.value ? d.active(M.value) : !1 : d.active !== void 0 ? d.active : d.type === "select" ? i.editor.selectionMode.value : !1;
2954
3005
  }
2955
- const G = j(() => {
3006
+ const B = j(() => {
2956
3007
  const d = y.value.filter(
2957
- (v) => n(v.type) && P(v)
3008
+ (v) => n(v.type) && A(v)
2958
3009
  );
2959
3010
  if (d.length === 0) return null;
2960
3011
  const c = h.value;
2961
3012
  return c && d.some((v) => v.type === c) ? c : d[0]?.type ?? null;
2962
3013
  });
2963
- function K(d) {
2964
- return n(d.type) ? G.value === d.type : P(d);
3014
+ function V(d) {
3015
+ return n(d.type) ? B.value === d.type : A(d);
2965
3016
  }
2966
3017
  function O(d) {
2967
- return !S.value || d.disabled === !0 ? !0 : typeof d.disabled == "function" ? d.disabled(S.value) : d.type === "undo" ? !i.editor.history.canUndo.value : d.type === "redo" ? !i.editor.history.canRedo.value : d.type === "export" ? u.value : !1;
3018
+ return !M.value || d.disabled === !0 ? !0 : typeof d.disabled == "function" ? d.disabled(M.value) : d.type === "undo" ? !i.editor.history.canUndo.value : d.type === "redo" ? !i.editor.history.canRedo.value : d.type === "export" ? u.value : !1;
2968
3019
  }
2969
3020
  function W(d) {
2970
- if (!(!S.value || !n(d.type) || !P(d))) {
3021
+ if (!(!M.value || !n(d.type) || !A(d))) {
2971
3022
  if (d.type === "select") {
2972
3023
  i.editor.setSelectionMode(!1);
2973
3024
  return;
2974
3025
  }
2975
- d.onClick?.(S.value);
3026
+ d.onClick?.(M.value);
2976
3027
  }
2977
3028
  }
2978
3029
  function z(d) {
@@ -2980,13 +3031,13 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
2980
3031
  for (const c of y.value)
2981
3032
  !n(c.type) || c.id === d.id || W(c);
2982
3033
  }
2983
- function M(d) {
2984
- if (!S.value || O(d)) return;
3034
+ function D(d) {
3035
+ if (!M.value || O(d)) return;
2985
3036
  if (n(d.type) && (h.value = d.type, z(d)), d.onClick) {
2986
- d.onClick(S.value);
3037
+ d.onClick(M.value);
2987
3038
  return;
2988
3039
  }
2989
- const { api: c } = S.value;
3040
+ const { api: c } = M.value;
2990
3041
  switch (d.type) {
2991
3042
  case "undo":
2992
3043
  i.editor.history.undo();
@@ -3009,8 +3060,8 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
3009
3060
  case "export":
3010
3061
  if (u.value) break;
3011
3062
  u.value = !0, c.exportAsImage().then((v) => {
3012
- const b = URL.createObjectURL(v), x = document.createElement("a");
3013
- x.href = b, x.download = "canvas-export.png", x.click(), URL.revokeObjectURL(b);
3063
+ const b = URL.createObjectURL(v), E = document.createElement("a");
3064
+ E.href = b, E.download = "canvas-export.png", E.click(), URL.revokeObjectURL(b);
3014
3065
  }).catch((v) => {
3015
3066
  console.warn("[flow-canvas] Export failed:", v);
3016
3067
  }).finally(() => {
@@ -3032,7 +3083,7 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
3032
3083
  break;
3033
3084
  }
3034
3085
  }
3035
- const y = j(() => r.value.filter(T)), f = j(() => {
3086
+ const y = j(() => r.value.filter(R)), f = j(() => {
3036
3087
  const d = /* @__PURE__ */ new Map(), c = [];
3037
3088
  for (const v of y.value) {
3038
3089
  const b = v.group ?? "default";
@@ -3040,66 +3091,69 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
3040
3091
  }
3041
3092
  return c.map((v) => ({ name: v, items: d.get(v) })).filter((v) => v.items.length > 0);
3042
3093
  });
3043
- return (d, c) => (D(), R("div", So, [
3044
- (D(!0), R(me, null, Ie(f.value, (v, b) => (D(), R(me, {
3094
+ return (d, c) => (_(), T("div", Mo, [
3095
+ (_(!0), T(pe, null, xe(f.value, (v, b) => (_(), T(pe, {
3045
3096
  key: v.name
3046
3097
  }, [
3047
- b > 0 ? (D(), R("div", Mo)) : Y("", !0),
3048
- U("div", No, [
3049
- (D(!0), R(me, null, Ie(v.items, (x) => (D(), R(me, {
3050
- key: x.id
3098
+ b > 0 ? (_(), T("div", Do)) : Z("", !0),
3099
+ q("div", No, [
3100
+ (_(!0), T(pe, null, xe(v.items, (E) => (_(), T(pe, {
3101
+ key: E.id
3051
3102
  }, [
3052
- x.type === "zoom-display" ? (D(), R("span", _o, ge(k.value), 1)) : (D(), R("button", {
3103
+ E.type === "zoom-display" ? (_(), T("span", _o, ue(C.value), 1)) : (_(), T("button", {
3053
3104
  key: 1,
3054
3105
  type: "button",
3055
3106
  class: se(["flow-canvas-toolbar__btn", {
3056
- "is-disabled": O(x),
3057
- "is-active": K(x),
3058
- "is-exporting": x.type === "export" && u.value
3107
+ "is-disabled": O(E),
3108
+ "is-active": V(E),
3109
+ "is-exporting": E.type === "export" && u.value
3059
3110
  }]),
3060
- "data-toolbar-id": x.id,
3061
- "data-toolbar-type": x.type,
3062
- disabled: O(x),
3063
- onClick: (B) => M(x),
3064
- onMouseenter: (B) => E(B, x),
3111
+ "data-toolbar-id": E.id,
3112
+ "data-toolbar-type": E.type,
3113
+ disabled: O(E),
3114
+ onClick: (F) => D(E),
3115
+ onMouseenter: (F) => x(F, E),
3065
3116
  onMouseleave: m
3066
3117
  }, [
3067
- x.component ? (D(), be(lt(x.component), { key: 0 })) : x.icon ? (D(), R("i", {
3118
+ E.component ? (_(), be(dt(E.component), { key: 0 })) : E.icon ? (_(), T("i", {
3068
3119
  key: 1,
3069
- class: se(x.icon)
3070
- }, null, 2)) : (D(), R("span", {
3120
+ class: se(E.icon)
3121
+ }, null, 2)) : (_(), T("span", {
3071
3122
  key: 2,
3072
3123
  class: "flow-canvas-toolbar__text",
3073
- textContent: ge(x.text ?? x.description ?? x.id)
3074
- }, null, 8, Ao))
3075
- ], 42, Do))
3124
+ textContent: ue(E.text ?? E.description ?? E.id)
3125
+ }, null, 8, Po))
3126
+ ], 42, Ao))
3076
3127
  ], 64))), 128))
3077
3128
  ])
3078
3129
  ], 64))), 128)),
3079
- (D(), be(dt, { to: "body" }, [
3080
- p.visible ? (D(), R("div", {
3130
+ (_(), be(ct, { to: "body" }, [
3131
+ g.visible ? (_(), T("div", {
3081
3132
  key: 0,
3082
3133
  ref_key: "tooltipRef",
3083
3134
  ref: a,
3084
3135
  class: "flow-canvas-toolbar-tooltip",
3085
- style: we({ left: `${p.x}px`, top: `${p.y}px` })
3136
+ style: we({ left: `${g.x}px`, top: `${g.y}px` })
3086
3137
  }, [
3087
- Le(ge(p.text) + " ", 1),
3088
- c[0] || (c[0] = U("div", { class: "flow-canvas-toolbar-tooltip__arrow" }, null, -1))
3089
- ], 4)) : Y("", !0)
3138
+ q("span", null, ue(g.text), 1),
3139
+ g.shortcut.length ? (_(), T("kbd", To, [
3140
+ (_(!0), T(pe, null, xe(g.shortcut, (v, b) => (_(), T("span", { key: b }, ue(v), 1))), 128))
3141
+ ])) : Z("", !0),
3142
+ c[0] || (c[0] = q("div", { class: "flow-canvas-toolbar-tooltip__arrow" }, null, -1))
3143
+ ], 4)) : Z("", !0)
3090
3144
  ]))
3091
3145
  ]));
3092
3146
  }
3093
- }), vn = /* @__PURE__ */ he(Po, [["__scopeId", "data-v-77d4afbb"]]), To = { class: "flow-canvas-default-node__ep-label" }, Ro = {
3147
+ }), mn = /* @__PURE__ */ ve(Ro, [["__scopeId", "data-v-904248f4"]]), Lo = { class: "flow-canvas-default-node__ep-label" }, Oo = {
3094
3148
  key: 1,
3095
3149
  class: "flow-canvas-default-node__diamond flow-canvas-highlight-target"
3096
- }, Lo = {
3150
+ }, $o = {
3097
3151
  key: 2,
3098
3152
  class: "flow-canvas-default-node__task-label"
3099
- }, Oo = /* @__PURE__ */ fe({
3153
+ }, Bo = /* @__PURE__ */ ge({
3100
3154
  __name: "default-node",
3101
3155
  setup(s) {
3102
- const t = ct("getNode")?.(), o = j(() => t?.getData?.() ?? null), n = j(() => o.value?.label || o.value?.type || ""), i = {
3156
+ const t = ut("getNode")?.(), o = j(() => t?.getData?.() ?? null), n = j(() => o.value?.label || o.value?.type || ""), i = {
3103
3157
  start: "canvas-kaishi",
3104
3158
  end: "canvas-stop",
3105
3159
  "parallel-gateway": "canvas-bingxingwangguan",
@@ -3115,24 +3169,24 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
3115
3169
  const u = o.value?.type ?? "";
3116
3170
  return r.has(u) ? "endpoint" : l.has(u) ? "gateway" : "task";
3117
3171
  }), h = j(() => i[o.value?.type ?? ""] ?? "");
3118
- return (u, g) => (D(), R("div", {
3172
+ return (u, p) => (_(), T("div", {
3119
3173
  class: se(["flow-canvas-default-node", [`is-${a.value}`, { "flow-canvas-highlight-target": a.value !== "gateway" }]])
3120
3174
  }, [
3121
- a.value === "endpoint" ? (D(), R(me, { key: 0 }, [
3122
- h.value ? (D(), R("i", {
3175
+ a.value === "endpoint" ? (_(), T(pe, { key: 0 }, [
3176
+ h.value ? (_(), T("i", {
3123
3177
  key: 0,
3124
3178
  class: se([["flow-canvas-icon", h.value], "flow-canvas-default-node__ep-icon"])
3125
- }, null, 2)) : Y("", !0),
3126
- U("span", To, ge(n.value), 1)
3127
- ], 64)) : a.value === "gateway" ? (D(), R("div", Ro, [
3128
- h.value ? (D(), R("i", {
3179
+ }, null, 2)) : Z("", !0),
3180
+ q("span", Lo, ue(n.value), 1)
3181
+ ], 64)) : a.value === "gateway" ? (_(), T("div", Oo, [
3182
+ h.value ? (_(), T("i", {
3129
3183
  key: 0,
3130
3184
  class: se([["flow-canvas-icon", h.value], "flow-canvas-default-node__gw-icon"])
3131
- }, null, 2)) : Y("", !0)
3132
- ])) : (D(), R("span", Lo, ge(n.value), 1))
3185
+ }, null, 2)) : Z("", !0)
3186
+ ])) : (_(), T("span", $o, ue(n.value), 1))
3133
3187
  ], 2));
3134
3188
  }
3135
- }), $o = /* @__PURE__ */ he(Oo, [["__scopeId", "data-v-f0e24a9f"]]), Bo = {
3189
+ }), Fo = /* @__PURE__ */ ve(Bo, [["__scopeId", "data-v-f0e24a9f"]]), Ho = {
3136
3190
  start: { label: "开始", icon: "flow-canvas-icon canvas-kaishi", width: 88, height: 40 },
3137
3191
  end: { label: "结束", icon: "flow-canvas-icon canvas-stop", width: 88, height: 40 },
3138
3192
  empty: { label: "空节点", icon: "flow-canvas-icon canvas-jiedi", width: 240, height: 48 },
@@ -3145,11 +3199,11 @@ const So = { class: "flow-canvas-toolbar" }, Mo = {
3145
3199
  width: 64,
3146
3200
  height: 64
3147
3201
  }
3148
- }, Ke = (s, e) => ({
3202
+ }, Ze = (s, e) => ({
3149
3203
  stroke: e.hovered ? "#3a84ff" : "#abb5cc",
3150
3204
  strokeWidth: 2
3151
3205
  });
3152
- function Ze() {
3206
+ function Ye() {
3153
3207
  return {
3154
3208
  attrs: {
3155
3209
  line: {
@@ -3160,29 +3214,29 @@ function Ze() {
3160
3214
  }
3161
3215
  };
3162
3216
  }
3163
- function Ho() {
3217
+ function Go() {
3164
3218
  return {
3165
3219
  manhattan: {
3166
3220
  router: { name: "manhattan", args: { padding: 10, maxDirectionChange: 90 } },
3167
3221
  connector: { name: "rounded", args: { radius: 8 } },
3168
- style: Ke,
3169
- x6EdgeConfig: Ze()
3222
+ style: Ze,
3223
+ x6EdgeConfig: Ye()
3170
3224
  },
3171
3225
  bezier: {
3172
3226
  connector: { name: "smooth" },
3173
- style: Ke,
3174
- x6EdgeConfig: Ze()
3227
+ style: Ze,
3228
+ x6EdgeConfig: Ye()
3175
3229
  }
3176
3230
  };
3177
3231
  }
3178
- function yn(s) {
3179
- const e = s?.nodeTypes ?? Bo, t = {}, o = [];
3232
+ function wn(s) {
3233
+ const e = s?.nodeTypes ?? Ho, t = {}, o = [];
3180
3234
  for (const [r, l] of Object.entries(e)) {
3181
3235
  const a = l.width ?? 150, h = l.height ?? 50;
3182
3236
  t[r] = {
3183
- component: $o,
3237
+ component: Fo,
3184
3238
  getSize: () => ({ width: a, height: h }),
3185
- getPorts: () => nt()
3239
+ getPorts: () => st()
3186
3240
  }, o.push({
3187
3241
  type: r,
3188
3242
  label: l.label ?? r,
@@ -3190,7 +3244,7 @@ function yn(s) {
3190
3244
  });
3191
3245
  }
3192
3246
  const n = {
3193
- ...Ho(),
3247
+ ...Go(),
3194
3248
  ...s?.edgeTypes
3195
3249
  }, i = s?.defaultEdgeType ?? "manhattan";
3196
3250
  return {
@@ -3198,7 +3252,7 @@ function yn(s) {
3198
3252
  paletteItems: o
3199
3253
  };
3200
3254
  }
3201
- function mn(s) {
3255
+ function bn(s) {
3202
3256
  return {
3203
3257
  name: "connection-validator",
3204
3258
  priority: 10,
@@ -3212,20 +3266,20 @@ function mn(s) {
3212
3266
  if (!l || !a) continue;
3213
3267
  const h = r.nodes[l], u = r.nodes[a];
3214
3268
  if (!h || !u) continue;
3215
- const g = i.type === "edge.add" ? i.edge.source.portId : i.source?.portId, p = i.type === "edge.add" ? i.edge.target.portId : i.target?.portId, E = g ? h.ports?.find((P) => P.id === g) : void 0, m = p ? u.ports?.find((P) => P.id === p) : void 0, k = i.type === "edge.reconnect" ? i.edgeId : void 0, S = Object.values(r.edges).filter(
3216
- (P) => P.id !== k && !n.has(P.id)
3217
- ), T = s({
3269
+ const p = i.type === "edge.add" ? i.edge.source.portId : i.source?.portId, g = i.type === "edge.add" ? i.edge.target.portId : i.target?.portId, x = p ? h.ports?.find((A) => A.id === p) : void 0, m = g ? u.ports?.find((A) => A.id === g) : void 0, C = i.type === "edge.reconnect" ? i.edgeId : void 0, M = Object.values(r.edges).filter(
3270
+ (A) => A.id !== C && !n.has(A.id)
3271
+ ), R = s({
3218
3272
  flowModel: r,
3219
3273
  sourceNode: h,
3220
3274
  targetNode: u,
3221
- sourcePort: E,
3275
+ sourcePort: x,
3222
3276
  targetPort: m,
3223
- existingEdges: S
3277
+ existingEdges: M
3224
3278
  });
3225
- if (!T.valid)
3279
+ if (!R.valid)
3226
3280
  return {
3227
3281
  rejected: !0,
3228
- reason: T.reason ?? "Connection validation failed",
3282
+ reason: R.reason ?? "Connection validation failed",
3229
3283
  code: "validation_failed"
3230
3284
  };
3231
3285
  }
@@ -3233,14 +3287,14 @@ function mn(s) {
3233
3287
  }
3234
3288
  };
3235
3289
  }
3236
- function wn(s) {
3290
+ function xn(s) {
3237
3291
  const { rubberband: e = !0, multiple: t = !0, movable: o = !0 } = s ?? {};
3238
3292
  return {
3239
3293
  name: "selection",
3240
3294
  priority: 90,
3241
3295
  attachRuntime(n) {
3242
3296
  n.graph.use(
3243
- new pt({
3297
+ new ht({
3244
3298
  enabled: !0,
3245
3299
  rubberband: e,
3246
3300
  multiple: t,
@@ -3253,7 +3307,7 @@ function wn(s) {
3253
3307
  }
3254
3308
  };
3255
3309
  }
3256
- function bn(s) {
3310
+ function En(s) {
3257
3311
  const { tolerance: e = 10, color: t = "#3a84ff" } = s ?? {};
3258
3312
  let o = null;
3259
3313
  return {
@@ -3274,13 +3328,13 @@ function bn(s) {
3274
3328
  }
3275
3329
  };
3276
3330
  }
3277
- const Go = { class: "flow-canvas-search-popover__input" }, qo = ["value", "placeholder"], Fo = ["onMouseenter", "onClick"], Uo = { class: "flow-canvas-search-popover__item-label" }, zo = {
3331
+ const qo = { class: "flow-canvas-search-popover__input" }, Uo = ["value", "placeholder"], zo = ["onMouseenter", "onClick"], jo = { class: "flow-canvas-search-popover__item-label" }, Wo = {
3278
3332
  key: 0,
3279
3333
  class: "flow-canvas-search-popover__item-subtitle"
3280
- }, jo = {
3334
+ }, Vo = {
3281
3335
  key: 1,
3282
3336
  class: "flow-canvas-search-popover__empty"
3283
- }, Wo = /* @__PURE__ */ fe({
3337
+ }, Xo = /* @__PURE__ */ ge({
3284
3338
  __name: "search-popover",
3285
3339
  props: {
3286
3340
  open: { type: Boolean },
@@ -3293,20 +3347,20 @@ const Go = { class: "flow-canvas-search-popover__input" }, qo = ["value", "place
3293
3347
  },
3294
3348
  emits: ["update:query", "select", "close"],
3295
3349
  setup(s, { emit: e }) {
3296
- const t = s, o = e, n = q(null), i = q(null), r = q(-1);
3297
- pe(
3350
+ const t = s, o = e, n = G(null), i = G(null), r = G(-1);
3351
+ he(
3298
3352
  () => t.open,
3299
3353
  (m) => {
3300
- m && (r.value = -1, Oe(() => {
3354
+ m && (r.value = -1, Le(() => {
3301
3355
  n.value?.focus(), n.value?.select();
3302
3356
  }));
3303
3357
  }
3304
- ), pe(
3358
+ ), he(
3305
3359
  () => t.query,
3306
3360
  () => {
3307
3361
  r.value = -1;
3308
3362
  }
3309
- ), pe(
3363
+ ), he(
3310
3364
  () => t.results.length,
3311
3365
  (m) => {
3312
3366
  if (!m) {
@@ -3326,15 +3380,15 @@ const Go = { class: "flow-canvas-search-popover__input" }, qo = ["value", "place
3326
3380
  r.value = -1;
3327
3381
  }
3328
3382
  function u() {
3329
- o("update:query", ""), Oe(() => {
3383
+ o("update:query", ""), Le(() => {
3330
3384
  n.value?.focus();
3331
3385
  });
3332
3386
  }
3333
- function g() {
3387
+ function p() {
3334
3388
  const m = t.results[r.value] ?? t.results[0];
3335
3389
  m && o("select", m.id);
3336
3390
  }
3337
- function p(m) {
3391
+ function g(m) {
3338
3392
  if (m.key === "Escape") {
3339
3393
  m.preventDefault(), o("close");
3340
3394
  return;
@@ -3349,81 +3403,81 @@ const Go = { class: "flow-canvas-search-popover__input" }, qo = ["value", "place
3349
3403
  r.value = r.value > 0 ? r.value - 1 : t.results.length - 1;
3350
3404
  return;
3351
3405
  }
3352
- m.key === "Enter" && (m.preventDefault(), g());
3406
+ m.key === "Enter" && (m.preventDefault(), p());
3353
3407
  }
3354
- function E(m) {
3408
+ function x(m) {
3355
3409
  if (!t.open) return;
3356
- const k = m.target;
3357
- k && i.value?.contains(k) || t.isAnchorTarget?.(m.target) || o("close");
3410
+ const C = m.target;
3411
+ C && i.value?.contains(C) || t.isAnchorTarget?.(m.target) || o("close");
3358
3412
  }
3359
3413
  return ot(() => {
3360
- document.addEventListener("mousedown", E);
3414
+ document.addEventListener("mousedown", x);
3361
3415
  }), Me(() => {
3362
- document.removeEventListener("mousedown", E);
3363
- }), (m, k) => s.open ? (D(), R("div", {
3416
+ document.removeEventListener("mousedown", x);
3417
+ }), (m, C) => s.open ? (_(), T("div", {
3364
3418
  key: 0,
3365
3419
  ref_key: "panelRef",
3366
3420
  ref: i,
3367
3421
  class: "flow-canvas-search-popover",
3368
3422
  style: we({ left: `${s.position.x}px`, top: `${s.position.y}px`, width: `${s.position.width}px` })
3369
3423
  }, [
3370
- U("div", Go, [
3371
- k[1] || (k[1] = U("i", { class: "flow-canvas-icon canvas-search" }, null, -1)),
3372
- U("input", {
3424
+ q("div", qo, [
3425
+ C[1] || (C[1] = q("i", { class: "flow-canvas-icon canvas-search" }, null, -1)),
3426
+ q("input", {
3373
3427
  ref_key: "inputRef",
3374
3428
  ref: n,
3375
3429
  value: s.query,
3376
3430
  placeholder: s.placeholder,
3377
3431
  onInput: l,
3378
- onKeydown: p
3379
- }, null, 40, qo),
3380
- s.query ? (D(), R("button", {
3432
+ onKeydown: g
3433
+ }, null, 40, Uo),
3434
+ s.query ? (_(), T("button", {
3381
3435
  key: 0,
3382
3436
  type: "button",
3383
3437
  class: "flow-canvas-search-popover__clear",
3384
3438
  "aria-label": "清空搜索",
3385
3439
  onClick: u
3386
- }, [...k[0] || (k[0] = [
3387
- U("i", { class: "flow-canvas-icon canvas-close-circle-shape" }, null, -1)
3388
- ])])) : Y("", !0)
3440
+ }, [...C[0] || (C[0] = [
3441
+ q("i", { class: "flow-canvas-icon canvas-close-circle-shape" }, null, -1)
3442
+ ])])) : Z("", !0)
3389
3443
  ]),
3390
- s.results.length ? (D(), R("div", {
3444
+ s.results.length ? (_(), T("div", {
3391
3445
  key: 0,
3392
3446
  class: "flow-canvas-search-popover__list",
3393
3447
  onMouseleave: h
3394
3448
  }, [
3395
- (D(!0), R(me, null, Ie(s.results, (S, T) => (D(), R("button", {
3396
- key: S.id,
3449
+ (_(!0), T(pe, null, xe(s.results, (M, R) => (_(), T("button", {
3450
+ key: M.id,
3397
3451
  type: "button",
3398
- class: se(["flow-canvas-search-popover__item", { "is-active": T === r.value }]),
3399
- onMouseenter: (P) => a(T),
3400
- onClick: (P) => o("select", S.id)
3452
+ class: se(["flow-canvas-search-popover__item", { "is-active": R === r.value }]),
3453
+ onMouseenter: (A) => a(R),
3454
+ onClick: (A) => o("select", M.id)
3401
3455
  }, [
3402
- U("span", Uo, ge(S.label), 1),
3403
- S.subtitle ? (D(), R("span", zo, ge(S.subtitle), 1)) : Y("", !0)
3404
- ], 42, Fo))), 128))
3405
- ], 32)) : (D(), R("div", jo, ge(s.emptyText), 1))
3406
- ], 4)) : Y("", !0);
3407
- }
3408
- }), Vo = /* @__PURE__ */ he(Wo, [["__scopeId", "data-v-c80f6b26"]]), Qe = 282, Xo = 4, Yo = 300, Ko = 360, Be = 100, Zo = Ko * 4 - Be;
3409
- function Qo(s) {
3456
+ q("span", jo, ue(M.label), 1),
3457
+ M.subtitle ? (_(), T("span", Wo, ue(M.subtitle), 1)) : Z("", !0)
3458
+ ], 42, zo))), 128))
3459
+ ], 32)) : (_(), T("div", Vo, ue(s.emptyText), 1))
3460
+ ], 4)) : Z("", !0);
3461
+ }
3462
+ }), Ko = /* @__PURE__ */ ve(Xo, [["__scopeId", "data-v-c80f6b26"]]), Qe = 282, Zo = 4, Yo = 300, Qo = 360, Oe = 100, Jo = Qo * 4 - Oe;
3463
+ function en(s) {
3410
3464
  return s !== null;
3411
3465
  }
3412
- function Jo(s) {
3466
+ function tn(s) {
3413
3467
  const e = /* @__PURE__ */ new Set();
3414
3468
  return s.map((t) => t?.trim()).filter((t) => !!t).filter((t) => {
3415
3469
  const o = t.toLowerCase();
3416
3470
  return e.has(o) ? !1 : (e.add(o), !0);
3417
3471
  });
3418
3472
  }
3419
- function en(s, e) {
3473
+ function on(s, e) {
3420
3474
  const t = Math.max(8, window.innerWidth - e - 8);
3421
3475
  return Math.min(Math.max(8, s), t);
3422
3476
  }
3423
- function tn(s, e) {
3477
+ function nn(s, e) {
3424
3478
  const t = e?.getNodeMeta?.(s);
3425
3479
  if (t === null) return null;
3426
- const o = t?.label?.trim() || s.label?.trim() || s.id, n = t?.subtitle?.trim() || void 0, i = Jo(t?.keywords ?? [s.label, n]);
3480
+ const o = t?.label?.trim() || s.label?.trim() || s.id, n = t?.subtitle?.trim() || void 0, i = tn(t?.keywords ?? [s.label, n]);
3427
3481
  return i.length ? {
3428
3482
  id: s.id,
3429
3483
  label: o,
@@ -3431,96 +3485,96 @@ function tn(s, e) {
3431
3485
  keywords: i
3432
3486
  } : null;
3433
3487
  }
3434
- function En(s) {
3488
+ function In(s) {
3435
3489
  let e = null, t = null, o = null, n = null, i = null, r = [];
3436
- const l = q(!1), a = q(""), h = q({ x: 0, y: 0, width: Qe }), u = j(() => e ? Object.values(e.flowModel.value.nodes).map((M) => tn(M, s)).filter(Qo) : []), g = j(() => {
3437
- const M = a.value.trim().toLowerCase(), y = Math.max(1, s?.maxResults ?? Yo);
3438
- return M ? u.value.filter((f) => f.keywords.some((d) => d.toLowerCase().includes(M))).slice(0, y) : u.value.slice(0, y);
3490
+ const l = G(!1), a = G(""), h = G({ x: 0, y: 0, width: Qe }), u = j(() => e ? Object.values(e.flowModel.value.nodes).map((D) => nn(D, s)).filter(en) : []), p = j(() => {
3491
+ const D = a.value.trim().toLowerCase(), y = Math.max(1, s?.maxResults ?? Yo);
3492
+ return D ? u.value.filter((f) => f.keywords.some((d) => d.toLowerCase().includes(D))).slice(0, y) : u.value.slice(0, y);
3439
3493
  });
3440
- function p() {
3494
+ function g() {
3441
3495
  return o?.querySelector('.flow-canvas-toolbar__btn[data-toolbar-type="search"]');
3442
3496
  }
3443
- function E() {
3444
- return p()?.closest(".flow-canvas-toolbar");
3497
+ function x() {
3498
+ return g()?.closest(".flow-canvas-toolbar");
3445
3499
  }
3446
3500
  function m() {
3447
- const M = E(), y = o?.getBoundingClientRect(), f = M?.getBoundingClientRect() ?? y;
3501
+ const D = x(), y = o?.getBoundingClientRect(), f = D?.getBoundingClientRect() ?? y;
3448
3502
  if (!f) return;
3449
3503
  const d = Math.max(Qe, Math.round(f.width));
3450
3504
  h.value = {
3451
- x: en(f.left, d),
3452
- y: f.bottom + Xo,
3505
+ x: on(f.left, d),
3506
+ y: f.bottom + Zo,
3453
3507
  width: d
3454
3508
  };
3455
3509
  }
3456
- function k() {
3457
- r.forEach((M) => clearTimeout(M)), r = [], t?.api.clearHighlight();
3510
+ function C() {
3511
+ r.forEach((D) => clearTimeout(D)), r = [], t?.api.clearHighlight();
3458
3512
  }
3459
- function S(M) {
3460
- k();
3513
+ function M(D) {
3514
+ C();
3461
3515
  const y = setTimeout(() => {
3462
- t?.api.highlightNodes([M]);
3463
- }, Be), f = setTimeout(() => {
3516
+ t?.api.highlightNodes([D]);
3517
+ }, Oe), f = setTimeout(() => {
3464
3518
  t?.api.clearHighlight(), r = [];
3465
- }, Be + Zo);
3519
+ }, Oe + Jo);
3466
3520
  r.push(y, f);
3467
3521
  }
3468
- function T(M) {
3469
- t && (t.api.scrollToNode(M), S(M));
3522
+ function R(D) {
3523
+ t && (t.api.scrollToNode(D), M(D));
3470
3524
  }
3471
- function P() {
3525
+ function A() {
3472
3526
  t && (l.value = !0, m(), requestAnimationFrame(() => m()));
3473
3527
  }
3474
- function G() {
3528
+ function B() {
3475
3529
  l.value = !1, a.value = "";
3476
3530
  }
3477
- function K() {
3531
+ function V() {
3478
3532
  if (l.value) {
3479
- G();
3533
+ B();
3480
3534
  return;
3481
3535
  }
3482
- P();
3536
+ A();
3483
3537
  }
3484
- function O(M) {
3485
- const y = p();
3486
- return !!(y && M instanceof Node && y.contains(M));
3538
+ function O(D) {
3539
+ const y = g();
3540
+ return !!(y && D instanceof Node && y.contains(D));
3487
3541
  }
3488
3542
  function W() {
3489
3543
  l.value && m();
3490
3544
  }
3491
- const z = fe({
3545
+ const z = ge({
3492
3546
  name: "FlowCanvasSearchHost",
3493
3547
  setup() {
3494
- return () => Re(Vo, {
3548
+ return () => Re(Ko, {
3495
3549
  open: l.value,
3496
3550
  position: h.value,
3497
3551
  query: a.value,
3498
- results: g.value,
3552
+ results: p.value,
3499
3553
  placeholder: s?.placeholder ?? "搜索节点名称",
3500
3554
  emptyText: s?.emptyText ?? "暂无匹配节点",
3501
3555
  isAnchorTarget: O,
3502
- "onUpdate:query": (M) => {
3503
- a.value = M;
3556
+ "onUpdate:query": (D) => {
3557
+ a.value = D;
3504
3558
  },
3505
- onSelect: T,
3506
- onClose: G
3559
+ onSelect: R,
3560
+ onClose: B
3507
3561
  });
3508
3562
  }
3509
3563
  });
3510
3564
  return {
3511
3565
  name: "search",
3512
3566
  priority: 90,
3513
- install(M) {
3514
- e = M;
3567
+ install(D) {
3568
+ e = D;
3515
3569
  },
3516
- attachRuntime(M) {
3517
- t = M, o = M.graph.container.closest(".flow-canvas-layout__content") ?? M.graph.container.parentElement, n = document.createElement("div"), n.className = "flow-canvas-search-host", document.body.append(n), i = ut(z), i.mount(n), window.addEventListener("resize", W), window.addEventListener("scroll", W, !0);
3570
+ attachRuntime(D) {
3571
+ t = D, o = D.graph.container.closest(".flow-canvas-layout__content") ?? D.graph.container.parentElement, n = document.createElement("div"), n.className = "flow-canvas-search-host", document.body.append(n), i = ft(z), i.mount(n), window.addEventListener("resize", W), window.addEventListener("scroll", W, !0);
3518
3572
  },
3519
3573
  detachRuntime() {
3520
- G(), k(), window.removeEventListener("resize", W), window.removeEventListener("scroll", W, !0), i?.unmount(), i = null, n?.remove(), n = null, o = null, t = null;
3574
+ B(), C(), window.removeEventListener("resize", W), window.removeEventListener("scroll", W, !0), i?.unmount(), i = null, n?.remove(), n = null, o = null, t = null;
3521
3575
  },
3522
3576
  dispose() {
3523
- G(), k(), e = null;
3577
+ B(), C(), e = null;
3524
3578
  },
3525
3579
  provideToolbarItems() {
3526
3580
  return [
@@ -3528,18 +3582,18 @@ function En(s) {
3528
3582
  id: "plugin:search",
3529
3583
  type: "search",
3530
3584
  icon: "flow-canvas-icon canvas-search",
3531
- description: "搜索节点",
3585
+ description: "搜索",
3532
3586
  group: "tools",
3533
3587
  order: 22,
3534
3588
  active: () => l.value,
3535
- onClick: K
3589
+ onClick: V
3536
3590
  }
3537
3591
  ];
3538
3592
  }
3539
3593
  };
3540
3594
  }
3541
- const on = 52, nn = 16, sn = 40;
3542
- function rn(s) {
3595
+ const sn = 52, rn = 16, an = 40;
3596
+ function ln(s) {
3543
3597
  const e = document.createElement("div");
3544
3598
  e.className = "flow-canvas-minimap", s.floating !== !1 && e.classList.add("flow-canvas-minimap--floating");
3545
3599
  const t = document.createElement("div");
@@ -3547,35 +3601,35 @@ function rn(s) {
3547
3601
  width: `${s.width}px`,
3548
3602
  height: `${s.height}px`
3549
3603
  }), s.floating !== !1 && Object.assign(e.style, {
3550
- top: `${on}px`,
3551
- left: `${nn}px`
3604
+ top: `${sn}px`,
3605
+ left: `${rn}px`
3552
3606
  });
3553
3607
  let o = null, n = s.defaultOpen ?? !1, i = null;
3554
3608
  function r() {
3555
- !s.onClickOutside || i || (i = (p) => {
3556
- const E = p.target;
3557
- E && e.contains(E) || p.target?.closest('[data-toolbar-type="minimap"]') || s.onClickOutside();
3609
+ !s.onClickOutside || i || (i = (g) => {
3610
+ const x = g.target;
3611
+ x && e.contains(x) || g.target?.closest('[data-toolbar-type="minimap"]') || s.onClickOutside();
3558
3612
  }, document.addEventListener("mousedown", i));
3559
3613
  }
3560
3614
  function l() {
3561
3615
  i && (document.removeEventListener("mousedown", i), i = null);
3562
3616
  }
3563
3617
  function a() {
3564
- o || (o = new ht({
3618
+ o || (o = new vt({
3565
3619
  container: t,
3566
3620
  width: s.width,
3567
3621
  height: s.height,
3568
- padding: s.contentPadding ?? sn,
3622
+ padding: s.contentPadding ?? an,
3569
3623
  scalable: !1
3570
3624
  }), s.sourceGraph.use(o));
3571
3625
  }
3572
- function h(p) {
3573
- n = p, e.style.display = n ? "" : "none", n ? (a(), r()) : l();
3626
+ function h(g) {
3627
+ n = g, e.style.display = n ? "" : "none", n ? (a(), r()) : l();
3574
3628
  }
3575
3629
  function u() {
3576
3630
  h(n), s.mountTarget.appendChild(e);
3577
3631
  }
3578
- function g() {
3632
+ function p() {
3579
3633
  l(), o?.dispose(), o = null, e.remove();
3580
3634
  }
3581
3635
  return u(), {
@@ -3583,15 +3637,15 @@ function rn(s) {
3583
3637
  isOpen: () => n,
3584
3638
  setOpen: h,
3585
3639
  toggle() {
3586
- const p = !n;
3587
- return h(p), p;
3640
+ const g = !n;
3641
+ return h(g), g;
3588
3642
  },
3589
- destroy: g
3643
+ destroy: p
3590
3644
  };
3591
3645
  }
3592
- function xn(s) {
3646
+ function Cn(s) {
3593
3647
  let e = null;
3594
- const t = q(!1);
3648
+ const t = G(!1);
3595
3649
  function o(i) {
3596
3650
  e?.setOpen(i), t.value = i;
3597
3651
  }
@@ -3603,7 +3657,7 @@ function xn(s) {
3603
3657
  priority: 90,
3604
3658
  attachRuntime(i) {
3605
3659
  const r = s?.width ?? 334, l = s?.height ?? 180, a = s?.container ?? i.graph.container.closest(".flow-canvas-layout__content") ?? i.graph.container.parentElement;
3606
- a && (e = rn({
3660
+ a && (e = ln({
3607
3661
  sourceGraph: i.graph,
3608
3662
  mountTarget: a,
3609
3663
  width: r,
@@ -3622,7 +3676,7 @@ function xn(s) {
3622
3676
  id: "plugin:minimap",
3623
3677
  type: "minimap",
3624
3678
  icon: "flow-canvas-icon canvas-map",
3625
- description: "缩略图",
3679
+ description: "小地图",
3626
3680
  group: "tools",
3627
3681
  order: 23,
3628
3682
  active: () => t.value,
@@ -3632,7 +3686,7 @@ function xn(s) {
3632
3686
  }
3633
3687
  };
3634
3688
  }
3635
- function In() {
3689
+ function kn() {
3636
3690
  let s = null, e = 0;
3637
3691
  return {
3638
3692
  name: "clipboard",
@@ -3678,7 +3732,7 @@ function In() {
3678
3732
  id: `${a.id}_cp${te().slice(0, 6)}`,
3679
3733
  source: { ...a.source, nodeId: h },
3680
3734
  target: { ...a.target, nodeId: u },
3681
- labels: a.labels?.map((g) => ({ ...g, id: `${g.id}_cp${te().slice(0, 6)}` })),
3735
+ labels: a.labels?.map((p) => ({ ...p, id: `${p.id}_cp${te().slice(0, 6)}` })),
3682
3736
  payload: a.payload ? { ...a.payload } : {}
3683
3737
  }
3684
3738
  });
@@ -3696,27 +3750,27 @@ function In() {
3696
3750
  };
3697
3751
  }
3698
3752
  export {
3699
- ue as CanvasConstraintError,
3700
- hn as CanvasLayout,
3701
- mo as CanvasNodePalette,
3702
- pn as CanvasRuntime,
3703
- vt as CanvasSchemaError,
3704
- vn as CanvasToolbar,
3705
- $o as DefaultNode,
3706
- no as NodeActionsToolbar,
3707
- ao as NodeQuickAddPopover,
3708
- $e as applyCanvasCommand,
3709
- In as clipboardPlugin,
3710
- mn as connectionValidatorPlugin,
3711
- Ho as createBuiltinEdgeTypes,
3712
- Dt as createCanvasHistory,
3713
- yn as createDefaultSchema,
3714
- ko as createDefaultToolbarItems,
3715
- fn as createEmptyFlowModel,
3753
+ fe as CanvasConstraintError,
3754
+ yn as CanvasLayout,
3755
+ wo as CanvasNodePalette,
3756
+ vn as CanvasRuntime,
3757
+ yt as CanvasSchemaError,
3758
+ mn as CanvasToolbar,
3759
+ Fo as DefaultNode,
3760
+ so as NodeActionsToolbar,
3761
+ lo as NodeQuickAddPopover,
3762
+ nt as applyCanvasCommand,
3763
+ kn as clipboardPlugin,
3764
+ bn as connectionValidatorPlugin,
3765
+ Go as createBuiltinEdgeTypes,
3766
+ At as createCanvasHistory,
3767
+ wn as createDefaultSchema,
3768
+ So as createDefaultToolbarItems,
3769
+ pn as createEmptyFlowModel,
3716
3770
  te as generateId,
3717
- xn as minimapPlugin,
3718
- En as searchPlugin,
3719
- wn as selectionPlugin,
3720
- bn as snaplinePlugin,
3721
- gn as useCanvasEditor
3771
+ Cn as minimapPlugin,
3772
+ In as searchPlugin,
3773
+ xn as selectionPlugin,
3774
+ En as snaplinePlugin,
3775
+ hn as useCanvasEditor
3722
3776
  };