@blueking/flow-canvas 0.0.11 → 0.0.12

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,4 +1,4 @@
1
- import { ref as H, computed as V, onScopeDispose as it, defineComponent as fe, h as qe, watch as ge, onBeforeUnmount as Te, createElementBlock as T, openBlock as A, normalizeStyle as Ee, createElementVNode as q, createVNode as at, createCommentVNode as Y, normalizeClass as te, Transition as lt, withCtx as He, withModifiers as ht, createTextVNode as je, renderSlot as Me, nextTick as Ge, onMounted as dt, createBlock as Ie, Fragment as de, renderList as Ce, toDisplayString as ce, unref as re, reactive as vt, resolveDynamicComponent as mt, Teleport as yt, inject as wt, createApp as bt } from "vue";
1
+ import { ref as H, computed as V, onScopeDispose as rt, defineComponent as fe, h as qe, watch as ge, onBeforeUnmount as Te, openBlock as A, createElementBlock as T, normalizeStyle as Ee, createElementVNode as q, normalizeClass as te, createCommentVNode as Y, createVNode as at, Transition as lt, withCtx as He, withModifiers as ht, createTextVNode as je, renderSlot as Me, nextTick as Ge, onMounted as dt, Fragment as de, renderList as Ie, toDisplayString as ce, unref as ie, createBlock as Ce, reactive as vt, resolveDynamicComponent as mt, Teleport as yt, inject as wt, createApp as bt } from "vue";
2
2
  import { Graph as Et } from "@antv/x6";
3
3
  import { register as xt } from "@antv/x6-vue-shape";
4
4
  import { Selection as It } from "@antv/x6-plugin-selection";
@@ -20,109 +20,109 @@ class kt extends Error {
20
20
  super(e), this.name = "CanvasSchemaError";
21
21
  }
22
22
  }
23
- function Re(n, e, o) {
23
+ function Re(s, e, o) {
24
24
  if (e.length === 0) {
25
25
  if (o === void 0) return;
26
26
  if (typeof o != "object" || o === null || Array.isArray(o))
27
27
  throw new Error("Root value of payload/extensions/meta must be an object or undefined");
28
28
  return o;
29
29
  }
30
- const t = n ? { ...n } : {};
31
- let s = t;
32
- for (let i = 0; i < e.length - 1; i++) {
33
- const l = e[i], a = s[l];
34
- a && typeof a == "object" && !Array.isArray(a) ? s[l] = { ...a } : s[l] = {}, s = s[l];
30
+ const t = s ? { ...s } : {};
31
+ let n = t;
32
+ for (let r = 0; r < e.length - 1; r++) {
33
+ const l = e[r], a = n[l];
34
+ a && typeof a == "object" && !Array.isArray(a) ? n[l] = { ...a } : n[l] = {}, n = n[l];
35
35
  }
36
- const r = e[e.length - 1];
37
- return o === void 0 ? delete s[r] : s[r] = o, t;
36
+ const i = e[e.length - 1];
37
+ return o === void 0 ? delete n[i] : n[i] = o, t;
38
38
  }
39
- function ct(n, e) {
39
+ function ct(s, e) {
40
40
  switch (e.type) {
41
41
  case "node.add":
42
- return St(n, e.node);
42
+ return St(s, e.node);
43
43
  case "node.move":
44
- return Mt(n, e.nodeId, e.position);
44
+ return Mt(s, e.nodeId, e.position);
45
45
  case "node.remove":
46
- return Nt(n, e.nodeId);
46
+ return Nt(s, e.nodeId);
47
47
  case "node.update":
48
- return Dt(n, e.nodeId, e.patch);
48
+ return Dt(s, e.nodeId, e.patch);
49
49
  case "node.set-payload":
50
- return At(n, e.nodeId, e.path, e.value);
50
+ return At(s, e.nodeId, e.path, e.value);
51
51
  case "node.set-extensions":
52
- return _t(n, e.nodeId, e.path, e.value);
52
+ return _t(s, e.nodeId, e.path, e.value);
53
53
  case "edge.add":
54
- return Pt(n, e.edge);
54
+ return Pt(s, e.edge);
55
55
  case "edge.remove":
56
- return Tt(n, e.edgeId);
56
+ return Tt(s, e.edgeId);
57
57
  case "edge.reconnect":
58
- return Rt(n, e.edgeId, e.source, e.target);
58
+ return Rt(s, e.edgeId, e.source, e.target);
59
59
  case "edge.update":
60
- return Lt(n, e.edgeId, e.patch);
60
+ return Lt(s, e.edgeId, e.patch);
61
61
  case "edge.set-payload":
62
- return Ot(n, e.edgeId, e.path, e.value);
62
+ return Ot(s, e.edgeId, e.path, e.value);
63
63
  case "edge.label.update":
64
- return $t(n, e.edgeId, e.labelId, e.patch);
64
+ return $t(s, e.edgeId, e.labelId, e.patch);
65
65
  case "model.set-meta":
66
- return Bt(n, e.path, e.value);
66
+ return Bt(s, e.path, e.value);
67
67
  default:
68
68
  throw new ue(`Unknown command type: ${e.type}`);
69
69
  }
70
70
  }
71
- function Ne(n, e) {
72
- const o = n.nodes[e];
71
+ function Ne(s, e) {
72
+ const o = s.nodes[e];
73
73
  if (!o) throw new ue(`Node "${e}" does not exist`);
74
74
  return o;
75
75
  }
76
- function De(n, e) {
77
- const o = n.edges[e];
76
+ function De(s, e) {
77
+ const o = s.edges[e];
78
78
  if (!o) throw new ue(`Edge "${e}" does not exist`);
79
79
  return o;
80
80
  }
81
- function ke(n, e, o) {
82
- const t = n.nodes[e.nodeId];
81
+ function ke(s, e, o) {
82
+ const t = s.nodes[e.nodeId];
83
83
  if (!t)
84
84
  throw new ue(`${o} node "${e.nodeId}" does not exist`);
85
- if (e.portId && t.ports && !t.ports.some((r) => r.id === e.portId))
85
+ if (e.portId && t.ports && !t.ports.some((i) => i.id === e.portId))
86
86
  throw new ue(`${o} port "${e.portId}" not found on node "${e.nodeId}"`);
87
87
  }
88
- function Le(n, e, o) {
89
- return { ...n, nodes: { ...n.nodes, [e]: o } };
88
+ function Le(s, e, o) {
89
+ return { ...s, nodes: { ...s.nodes, [e]: o } };
90
90
  }
91
- function Oe(n, e, o) {
92
- return { ...n, edges: { ...n.edges, [e]: o } };
91
+ function Oe(s, e, o) {
92
+ return { ...s, edges: { ...s.edges, [e]: o } };
93
93
  }
94
- function St(n, e) {
95
- if (n.nodes[e.id])
94
+ function St(s, e) {
95
+ if (s.nodes[e.id])
96
96
  throw new ue(`Node id "${e.id}" already exists`);
97
- return { ...n, nodes: { ...n.nodes, [e.id]: e } };
97
+ return { ...s, nodes: { ...s.nodes, [e.id]: e } };
98
98
  }
99
- function Mt(n, e, o) {
100
- const t = Ne(n, e);
101
- return Le(n, e, { ...t, position: o });
99
+ function Mt(s, e, o) {
100
+ const t = Ne(s, e);
101
+ return Le(s, e, { ...t, position: o });
102
102
  }
103
- function Nt(n, e) {
104
- Ne(n, e);
105
- const { [e]: o, ...t } = n.nodes, s = {};
106
- for (const [r, i] of Object.entries(n.edges))
107
- i.source.nodeId !== e && i.target.nodeId !== e && (s[r] = i);
108
- return { ...n, nodes: t, edges: s };
103
+ function Nt(s, e) {
104
+ Ne(s, e);
105
+ const { [e]: o, ...t } = s.nodes, n = {};
106
+ for (const [i, r] of Object.entries(s.edges))
107
+ r.source.nodeId !== e && r.target.nodeId !== e && (n[i] = r);
108
+ return { ...s, nodes: t, edges: n };
109
109
  }
110
- function Dt(n, e, o) {
111
- const t = Ne(n, e);
112
- return Le(n, e, { ...t, ...o, id: t.id });
110
+ function Dt(s, e, o) {
111
+ const t = Ne(s, e);
112
+ return Le(s, e, { ...t, ...o, id: t.id });
113
113
  }
114
- function At(n, e, o, t) {
115
- const s = Ne(n, e), r = Re(s.payload, o, t);
116
- return Le(n, e, { ...s, payload: r });
114
+ function At(s, e, o, t) {
115
+ const n = Ne(s, e), i = Re(n.payload, o, t);
116
+ return Le(s, e, { ...n, payload: i });
117
117
  }
118
- function _t(n, e, o, t) {
119
- const s = Ne(n, e), r = Re(s.extensions, o, t);
120
- return Le(n, e, { ...s, extensions: r });
118
+ function _t(s, e, o, t) {
119
+ const n = Ne(s, e), i = Re(n.extensions, o, t);
120
+ return Le(s, e, { ...n, extensions: i });
121
121
  }
122
- function Pt(n, e) {
123
- if (n.edges[e.id])
122
+ function Pt(s, e) {
123
+ if (s.edges[e.id])
124
124
  throw new ue(`Edge id "${e.id}" already exists`);
125
- if (ke(n, e.source, "Source"), ke(n, e.target, "Target"), e.labels) {
125
+ if (ke(s, e.source, "Source"), ke(s, e.target, "Target"), e.labels) {
126
126
  const o = /* @__PURE__ */ new Set();
127
127
  for (const t of e.labels) {
128
128
  if (o.has(t.id))
@@ -130,45 +130,45 @@ function Pt(n, e) {
130
130
  o.add(t.id);
131
131
  }
132
132
  }
133
- return { ...n, edges: { ...n.edges, [e.id]: e } };
133
+ return { ...s, edges: { ...s.edges, [e.id]: e } };
134
134
  }
135
- function Tt(n, e) {
136
- De(n, e);
137
- const { [e]: o, ...t } = n.edges;
138
- return { ...n, edges: t };
135
+ function Tt(s, e) {
136
+ De(s, e);
137
+ const { [e]: o, ...t } = s.edges;
138
+ return { ...s, edges: t };
139
139
  }
140
- function Rt(n, e, o, t) {
141
- const s = De(n, e), r = o ?? s.source, i = t ?? s.target;
142
- return ke(n, r, "Source"), ke(n, i, "Target"), Oe(n, e, { ...s, source: r, target: i });
140
+ function Rt(s, e, o, t) {
141
+ const n = De(s, e), i = o ?? n.source, r = t ?? n.target;
142
+ return ke(s, i, "Source"), ke(s, r, "Target"), Oe(s, e, { ...n, source: i, target: r });
143
143
  }
144
- function Lt(n, e, o) {
145
- const t = De(n, e), s = { ...t, ...o, id: t.id };
146
- return o.source && ke(n, s.source, "Source"), o.target && ke(n, s.target, "Target"), Oe(n, e, s);
144
+ function Lt(s, e, o) {
145
+ const t = De(s, e), n = { ...t, ...o, id: t.id };
146
+ return o.source && ke(s, n.source, "Source"), o.target && ke(s, n.target, "Target"), Oe(s, e, n);
147
147
  }
148
- function Ot(n, e, o, t) {
149
- const s = De(n, e), r = Re(s.payload, o, t);
150
- return Oe(n, e, { ...s, payload: r });
148
+ function Ot(s, e, o, t) {
149
+ const n = De(s, e), i = Re(n.payload, o, t);
150
+ return Oe(s, e, { ...n, payload: i });
151
151
  }
152
- function $t(n, e, o, t) {
153
- const s = De(n, e);
154
- if (!s.labels)
152
+ function $t(s, e, o, t) {
153
+ const n = De(s, e);
154
+ if (!n.labels)
155
155
  throw new ue(`Edge "${e}" has no labels`);
156
- const r = s.labels.findIndex((l) => l.id === o);
157
- if (r === -1)
156
+ const i = n.labels.findIndex((l) => l.id === o);
157
+ if (i === -1)
158
158
  throw new ue(`Label "${o}" not found in edge "${e}"`);
159
- const i = [...s.labels];
160
- return i[r] = { ...i[r], ...t, id: o }, Oe(n, e, { ...s, labels: i });
159
+ const r = [...n.labels];
160
+ return r[i] = { ...r[i], ...t, id: o }, Oe(s, e, { ...n, labels: r });
161
161
  }
162
- function Bt(n, e, o) {
163
- const t = Re(n.meta, e, o);
164
- return { ...n, meta: t };
162
+ function Bt(s, e, o) {
163
+ const t = Re(s.meta, e, o);
164
+ return { ...s, meta: t };
165
165
  }
166
- function Ft(n, e) {
167
- const o = e?.maxHistorySize ?? 100, t = H(n), s = [], r = [], i = H(!1), l = H(!1);
166
+ function Ft(s, e) {
167
+ const o = e?.maxHistorySize ?? 100, t = H(s), n = [], i = [], r = H(!1), l = H(!1);
168
168
  function a() {
169
- i.value = s.length > 0, l.value = r.length > 0;
169
+ r.value = n.length > 0, l.value = i.length > 0;
170
170
  }
171
- function v(b) {
171
+ function h(b) {
172
172
  const S = t.value;
173
173
  let M = S;
174
174
  for (const B of b.commands)
@@ -177,27 +177,27 @@ function Ft(n, e) {
177
177
  const B = e?.excludeCommandFromHistory, j = B ? b.commands.filter((k) => !B(k)) : b.commands;
178
178
  if (j.length > 0) {
179
179
  const k = j.length < b.commands.length ? { ...b, commands: j } : b;
180
- s.push({ snapshot: S, envelope: k }), s.length > o && s.shift(), r.length = 0;
180
+ n.push({ snapshot: S, envelope: k }), n.length > o && n.shift(), i.length = 0;
181
181
  }
182
182
  }
183
183
  return t.value = M, a(), M;
184
184
  }
185
185
  function f() {
186
- const b = s.pop();
186
+ const b = n.pop();
187
187
  if (!b) return null;
188
- r.push({ snapshot: t.value, envelope: b.envelope });
188
+ i.push({ snapshot: t.value, envelope: b.envelope });
189
189
  const S = e?.preserveMetaOnUndoRedo ? { ...b.snapshot, meta: t.value.meta } : b.snapshot;
190
190
  return t.value = S, a(), S;
191
191
  }
192
192
  function p() {
193
- const b = r.pop();
193
+ const b = i.pop();
194
194
  if (!b) return null;
195
- s.push({ snapshot: t.value, envelope: b.envelope });
195
+ n.push({ snapshot: t.value, envelope: b.envelope });
196
196
  const S = e?.preserveMetaOnUndoRedo ? { ...b.snapshot, meta: t.value.meta } : b.snapshot;
197
197
  return t.value = S, a(), S;
198
198
  }
199
199
  function u() {
200
- s.length = 0, r.length = 0, a();
200
+ n.length = 0, i.length = 0, a();
201
201
  }
202
202
  function w() {
203
203
  return t.value;
@@ -213,20 +213,20 @@ function Ft(n, e) {
213
213
  timestamp: Date.now(),
214
214
  commands: []
215
215
  };
216
- s.push({ snapshot: t.value, envelope: M }), s.length > o && s.shift(), r.length = 0, t.value = b, a();
216
+ n.push({ snapshot: t.value, envelope: M }), n.length > o && n.shift(), i.length = 0, t.value = b, a();
217
217
  }
218
218
  return {
219
219
  currentFlowModel: t,
220
- execute: v,
220
+ execute: h,
221
221
  undo: f,
222
222
  redo: p,
223
- canUndo: i,
223
+ canUndo: r,
224
224
  canRedo: l,
225
225
  get undoStack() {
226
- return s.map((b) => b.envelope);
226
+ return n.map((b) => b.envelope);
227
227
  },
228
228
  get redoStack() {
229
- return r.map((b) => b.envelope);
229
+ return i.map((b) => b.envelope);
230
230
  },
231
231
  clear: u,
232
232
  createSnapshot: w,
@@ -234,8 +234,8 @@ function Ft(n, e) {
234
234
  updateFlowModel: O
235
235
  };
236
236
  }
237
- function qt(n) {
238
- return n !== null && typeof n == "object" && n.rejected === !0;
237
+ function qt(s) {
238
+ return s !== null && typeof s == "object" && s.rejected === !0;
239
239
  }
240
240
  class Ht {
241
241
  plugins = [];
@@ -244,7 +244,7 @@ class Ht {
244
244
  /** 每次 attachRuntime 递增,detachRuntime 时旧 generation 的异步调用自动作废 */
245
245
  runtimeVersion = 0;
246
246
  install(e, o) {
247
- this.plugins = [...e].sort((t, s) => (t.priority ?? 100) - (s.priority ?? 100)), this.editorContext = o;
247
+ this.plugins = [...e].sort((t, n) => (t.priority ?? 100) - (n.priority ?? 100)), this.editorContext = o;
248
248
  for (const t of this.plugins)
249
249
  t.install?.(o);
250
250
  }
@@ -257,8 +257,8 @@ class Ht {
257
257
  const o = ++this.runtimeVersion;
258
258
  this.runtimeCtx = e;
259
259
  const t = this.createSafeRuntimeContext(e, o);
260
- for (const s of this.plugins)
261
- s.attachRuntime?.(t);
260
+ for (const n of this.plugins)
261
+ n.attachRuntime?.(t);
262
262
  }
263
263
  /** 按安装的逆序 detach,保证后安装的插件先释放运行时资源 */
264
264
  detachRuntime() {
@@ -271,16 +271,16 @@ class Ht {
271
271
  * 如果在 await 期间 detachRuntime 已执行,代理会将 graph 操作变为 no-op。
272
272
  */
273
273
  createSafeRuntimeContext(e, o) {
274
- const t = this, s = new Proxy(e.graph, {
275
- get(r, i, l) {
276
- const a = Reflect.get(r, i, l);
277
- return i === "use" && typeof a == "function" ? function(...f) {
274
+ const t = this, n = new Proxy(e.graph, {
275
+ get(i, r, l) {
276
+ const a = Reflect.get(i, r, l);
277
+ return r === "use" && typeof a == "function" ? function(...f) {
278
278
  if (t.runtimeVersion === o)
279
- return a.apply(r, f);
279
+ return a.apply(i, f);
280
280
  } : a;
281
281
  }
282
282
  });
283
- return { ...e, graph: s };
283
+ return { ...e, graph: n };
284
284
  }
285
285
  dispose() {
286
286
  for (const e of [...this.plugins].reverse())
@@ -292,8 +292,8 @@ class Ht {
292
292
  let o = e;
293
293
  for (const t of this.plugins) {
294
294
  if (!t.transformCommand) continue;
295
- const s = this.createPreview(o), r = t.transformCommand(o, s, this.editorContext);
296
- if (r === null)
295
+ const n = this.createPreview(o), i = t.transformCommand(o, n, this.editorContext);
296
+ if (i === null)
297
297
  return {
298
298
  rejected: !0,
299
299
  error: {
@@ -302,23 +302,23 @@ class Ht {
302
302
  source: t.name
303
303
  }
304
304
  };
305
- if (qt(r))
305
+ if (qt(i))
306
306
  return {
307
307
  rejected: !0,
308
308
  error: {
309
- code: r.code ?? "plugin_rejected",
310
- reason: r.reason,
309
+ code: i.code ?? "plugin_rejected",
310
+ reason: i.reason,
311
311
  source: t.name
312
312
  }
313
313
  };
314
- o = r;
314
+ o = i;
315
315
  }
316
316
  return { envelope: o };
317
317
  }
318
318
  afterCommand(e, o, t) {
319
319
  if (this.editorContext)
320
- for (const s of this.plugins)
321
- s.afterCommand?.(e, o, t, this.editorContext);
320
+ for (const n of this.plugins)
321
+ n.afterCommand?.(e, o, t, this.editorContext);
322
322
  }
323
323
  dispatchUiEvent(e) {
324
324
  if (this.runtimeCtx)
@@ -341,8 +341,8 @@ class Ht {
341
341
  if (!this.runtimeCtx) return [];
342
342
  const o = [];
343
343
  for (const t of this.plugins) {
344
- const s = t.onBlankContextMenu?.(e, this.runtimeCtx);
345
- s && o.push(...s);
344
+ const n = t.onBlankContextMenu?.(e, this.runtimeCtx);
345
+ n && o.push(...n);
346
346
  }
347
347
  return o;
348
348
  }
@@ -353,8 +353,8 @@ class Ht {
353
353
  for (const o of this.plugins) {
354
354
  const t = o.provideToolbarItems?.(this.editorContext);
355
355
  if (t)
356
- for (const s of t)
357
- e.set(s.id, s);
356
+ for (const n of t)
357
+ e.set(n.id, n);
358
358
  }
359
359
  return [...e.values()].sort((o, t) => (o.order ?? 0) - (t.order ?? 0));
360
360
  }
@@ -363,8 +363,8 @@ class Ht {
363
363
  if (!this.editorContext) return;
364
364
  let o;
365
365
  for (const t of this.plugins) {
366
- const s = t.decorateNode?.(e, this.editorContext);
367
- s && (o = o ? { ...o, ...s } : s);
366
+ const n = t.decorateNode?.(e, this.editorContext);
367
+ n && (o = o ? { ...o, ...n } : n);
368
368
  }
369
369
  return o;
370
370
  }
@@ -373,8 +373,8 @@ class Ht {
373
373
  if (!this.editorContext) return;
374
374
  let o;
375
375
  for (const t of this.plugins) {
376
- const s = t.decorateEdge?.(e, this.editorContext);
377
- s && (o = o ? { ...o, ...s } : s);
376
+ const n = t.decorateEdge?.(e, this.editorContext);
377
+ n && (o = o ? { ...o, ...n } : n);
378
378
  }
379
379
  return o;
380
380
  }
@@ -392,23 +392,23 @@ class Ht {
392
392
  const o = this.editorContext;
393
393
  return {
394
394
  previewFlowModel(t) {
395
- const s = t ?? e.commands;
396
- let r = o.flowModel.value;
397
- for (const i of s)
398
- r = ct(r, i);
399
- return r;
395
+ const n = t ?? e.commands;
396
+ let i = o.flowModel.value;
397
+ for (const r of n)
398
+ i = ct(i, r);
399
+ return i;
400
400
  }
401
401
  };
402
402
  }
403
403
  }
404
404
  let Gt = 0;
405
405
  function J() {
406
- const n = Date.now().toString(36), e = Math.random().toString(36).substring(2, 8);
407
- return `${n}-${e}-${++Gt}`;
406
+ const s = Date.now().toString(36), e = Math.random().toString(36).substring(2, 8);
407
+ return `${s}-${e}-${++Gt}`;
408
408
  }
409
409
  const ze = () => J();
410
- function Nn(n) {
411
- const { schema: e, plugins: o = [], historyOptions: t } = n, s = n.idGenerator ?? ze, r = { version: "1.0", ...n.initialFlowModel }, i = Ft(r, t), l = H(n.mode ?? "edit"), a = H(!1), v = H(null), f = H([]), p = {}, u = new Ht();
410
+ function Nn(s) {
411
+ const { schema: e, plugins: o = [], historyOptions: t } = s, n = s.idGenerator ?? ze, i = { version: "1.0", ...s.initialFlowModel }, r = Ft(i, t), l = H(s.mode ?? "edit"), a = H(!1), h = H(null), f = H([]), p = {}, u = new Ht();
412
412
  function w(S, M, B, j = "user:toolbar") {
413
413
  const k = {
414
414
  id: `history-${Date.now()}`,
@@ -417,11 +417,11 @@ function Nn(n) {
417
417
  timestamp: Date.now(),
418
418
  commands: []
419
419
  };
420
- u.afterCommand(k, M, B), f.value = u.collectToolbarItems(), n.onCommandResult?.({
420
+ u.afterCommand(k, M, B), f.value = u.collectToolbarItems(), s.onCommandResult?.({
421
421
  status: "applied",
422
422
  envelope: k,
423
423
  flowModel: B
424
- }), n.onFlowModelChange?.({
424
+ }), s.onFlowModelChange?.({
425
425
  flowModel: B,
426
426
  prevFlowModel: M,
427
427
  envelope: k,
@@ -429,43 +429,43 @@ function Nn(n) {
429
429
  });
430
430
  }
431
431
  const D = {
432
- execute: i.execute,
432
+ execute: r.execute,
433
433
  undo() {
434
- const S = i.currentFlowModel.value, M = i.undo();
434
+ const S = r.currentFlowModel.value, M = r.undo();
435
435
  return M && w("撤销", S, M), M;
436
436
  },
437
437
  redo() {
438
- const S = i.currentFlowModel.value, M = i.redo();
438
+ const S = r.currentFlowModel.value, M = r.redo();
439
439
  return M && w("重做", S, M), M;
440
440
  },
441
441
  get canUndo() {
442
- return i.canUndo;
442
+ return r.canUndo;
443
443
  },
444
444
  get canRedo() {
445
- return i.canRedo;
445
+ return r.canRedo;
446
446
  },
447
447
  get undoStack() {
448
- return i.undoStack;
448
+ return r.undoStack;
449
449
  },
450
450
  get redoStack() {
451
- return i.redoStack;
451
+ return r.redoStack;
452
452
  },
453
- clear: i.clear,
454
- createSnapshot: i.createSnapshot,
453
+ clear: r.clear,
454
+ createSnapshot: r.createSnapshot,
455
455
  replaceFlowModel(S) {
456
- const M = i.currentFlowModel.value;
457
- i.replaceFlowModel(S), w("替换 FlowModel", M, S, "system:replace");
456
+ const M = r.currentFlowModel.value;
457
+ r.replaceFlowModel(S), w("替换 FlowModel", M, S, "system:replace");
458
458
  },
459
459
  updateFlowModel(S, M) {
460
- const B = i.currentFlowModel.value;
461
- i.updateFlowModel(S, M), w(M ?? "更新 FlowModel", B, S, "system:update");
460
+ const B = r.currentFlowModel.value;
461
+ r.updateFlowModel(S, M), w(M ?? "更新 FlowModel", B, S, "system:update");
462
462
  }
463
463
  }, O = {
464
- flowModel: V(() => i.currentFlowModel.value),
464
+ flowModel: V(() => r.currentFlowModel.value),
465
465
  history: D,
466
466
  schema: e,
467
467
  mode: l,
468
- idGenerator: s,
468
+ idGenerator: n,
469
469
  executeCommand: b,
470
470
  replaceFlowModel(S) {
471
471
  D.replaceFlowModel(S);
@@ -480,7 +480,7 @@ function Nn(n) {
480
480
  setSelectionMode(S) {
481
481
  a.value = S;
482
482
  },
483
- api: v,
483
+ api: h,
484
484
  toolbarItems: f,
485
485
  extendedApi: p,
486
486
  _pluginManager: u,
@@ -493,9 +493,9 @@ function Nn(n) {
493
493
  history: D,
494
494
  schema: e,
495
495
  mode: l,
496
- idGenerator: s,
496
+ idGenerator: n,
497
497
  executeCommand: b
498
- }), f.value = u.collectToolbarItems(), it(() => {
498
+ }), f.value = u.collectToolbarItems(), rt(() => {
499
499
  u.dispose();
500
500
  });
501
501
  function b(S) {
@@ -506,16 +506,16 @@ function Nn(n) {
506
506
  envelope: S,
507
507
  error: M.error
508
508
  };
509
- return n.onCommandResult?.(k), k;
509
+ return s.onCommandResult?.(k), k;
510
510
  }
511
- const B = M.envelope, j = i.currentFlowModel.value;
511
+ const B = M.envelope, j = r.currentFlowModel.value;
512
512
  try {
513
- const k = i.execute(B), X = {
513
+ const k = r.execute(B), X = {
514
514
  status: "applied",
515
515
  envelope: B,
516
516
  flowModel: k
517
517
  };
518
- return u.afterCommand(B, j, k), f.value = u.collectToolbarItems(), n.onCommandResult?.(X), n.onFlowModelChange?.({
518
+ return u.afterCommand(B, j, k), f.value = u.collectToolbarItems(), s.onCommandResult?.(X), s.onFlowModelChange?.({
519
519
  flowModel: k,
520
520
  prevFlowModel: j,
521
521
  envelope: B,
@@ -532,7 +532,7 @@ function Nn(n) {
532
532
  source: "engine"
533
533
  }
534
534
  };
535
- return n.onCommandResult?.(X), X;
535
+ return s.onCommandResult?.(X), X;
536
536
  }
537
537
  throw k;
538
538
  }
@@ -541,10 +541,10 @@ function Nn(n) {
541
541
  }
542
542
  const zt = ["top", "right", "bottom", "left"];
543
543
  function ut() {
544
- return zt.map((n) => ({ id: n, group: n }));
544
+ return zt.map((s) => ({ id: s, group: s }));
545
545
  }
546
- function Ue(n, e) {
547
- return e?.(n) ?? n.ports ?? ut();
546
+ function Ue(s, e) {
547
+ return e?.(s) ?? s.ports ?? ut();
548
548
  }
549
549
  const Fe = -1, Ut = "flow-canvas-node-ring-target", We = "flow-canvas-node-ring-target--decorated", Ve = "flow-canvas-node-ring-target--pulse", jt = "linear-gradient(135deg, #cadcfa 0%, #cee0ff 100%)";
550
550
  class Wt {
@@ -574,8 +574,8 @@ class Wt {
574
574
  edgeDefaultAttrs = /* @__PURE__ */ new Map();
575
575
  lastModel = null;
576
576
  pendingDecorationRAFs = /* @__PURE__ */ new Map();
577
- constructor(e, o, t, s, r, i) {
578
- this.graph = e, this.schema = o, this.shapeRegistry = t, this.resolveNodeDecoration = s, this.resolveEdgeDecoration = r, this.resolveCanvasContext = i;
577
+ constructor(e, o, t, n, i, r) {
578
+ this.graph = e, this.schema = o, this.shapeRegistry = t, this.resolveNodeDecoration = n, this.resolveEdgeDecoration = i, this.resolveCanvasContext = r;
579
579
  }
580
580
  syncFlowModel(e) {
581
581
  if (!this.syncing) {
@@ -596,21 +596,21 @@ class Wt {
596
596
  * 仅在节点首次创建时调用一次。
597
597
  */
598
598
  saveNodeDefaultAttrs(e, o) {
599
- const s = o.x6CellConfig?.attrs?.body;
600
- if (!s) return;
601
- const r = {};
602
- let i = !1;
603
- s.stroke !== void 0 && (r.stroke = s.stroke, i = !0), s.strokeWidth !== void 0 && (r.strokeWidth = s.strokeWidth, i = !0), i && this.nodeDefaultAttrs.set(e, r);
599
+ const n = o.x6CellConfig?.attrs?.body;
600
+ if (!n) return;
601
+ const i = {};
602
+ let r = !1;
603
+ n.stroke !== void 0 && (i.stroke = n.stroke, r = !0), n.strokeWidth !== void 0 && (i.strokeWidth = n.strokeWidth, r = !0), r && this.nodeDefaultAttrs.set(e, i);
604
604
  }
605
605
  /**
606
606
  * 从 x6EdgeConfig.attrs.line 中提取基线描边,用于管理层清理时恢复。
607
607
  */
608
608
  saveEdgeDefaultAttrs(e, o) {
609
- const s = o?.x6EdgeConfig?.attrs?.line;
610
- if (!s) return;
611
- const r = {};
612
- let i = !1;
613
- s.stroke !== void 0 && (r.stroke = s.stroke, i = !0), s.strokeWidth !== void 0 && (r.strokeWidth = s.strokeWidth, i = !0), s.strokeDasharray !== void 0 && (r.strokeDasharray = s.strokeDasharray, i = !0), i && this.edgeDefaultAttrs.set(e, r);
609
+ const n = o?.x6EdgeConfig?.attrs?.line;
610
+ if (!n) return;
611
+ const i = {};
612
+ let r = !1;
613
+ n.stroke !== void 0 && (i.stroke = n.stroke, r = !0), n.strokeWidth !== void 0 && (i.strokeWidth = n.strokeWidth, r = !0), n.strokeDasharray !== void 0 && (i.strokeDasharray = n.strokeDasharray, r = !0), r && this.edgeDefaultAttrs.set(e, i);
614
614
  }
615
615
  /**
616
616
  * 恢复节点 attr 到基线值;无基线时设为安全默认值。
@@ -619,18 +619,18 @@ class Wt {
619
619
  * 使得内部 Vue 组件 (width/height: 100%) 折叠后无法恢复。
620
620
  */
621
621
  restoreNodeAttr(e, o, t) {
622
- const s = this.nodeDefaultAttrs.get(e.id)?.[t];
623
- if (s !== void 0)
624
- e.setAttrByPath(o, s);
622
+ const n = this.nodeDefaultAttrs.get(e.id)?.[t];
623
+ if (n !== void 0)
624
+ e.setAttrByPath(o, n);
625
625
  else {
626
- const r = t === "stroke" ? "none" : 0;
627
- e.setAttrByPath(o, r);
626
+ const i = t === "stroke" ? "none" : 0;
627
+ e.setAttrByPath(o, i);
628
628
  }
629
629
  }
630
630
  /** 恢复边 attr 到基线值;无基线时移除。 */
631
631
  restoreEdgeAttr(e, o, t) {
632
- const s = this.edgeDefaultAttrs.get(e.id)?.[t];
633
- s !== void 0 ? this.setEdgeAttrIfChanged(e, o, s) : e.attr(o) !== void 0 && e.removeAttrByPath(o);
632
+ const n = this.edgeDefaultAttrs.get(e.id)?.[t];
633
+ n !== void 0 ? this.setEdgeAttrIfChanged(e, o, n) : e.attr(o) !== void 0 && e.removeAttrByPath(o);
634
634
  }
635
635
  /**
636
636
  * 仅在值实际变化时调用 setAttrByPath。
@@ -638,32 +638,32 @@ class Wt {
638
638
  * 即使值相同也会导致 EdgeView.update() → updateConnection() → 路由器全量重算。
639
639
  */
640
640
  setEdgeAttrIfChanged(e, o, t) {
641
- const s = e.attr(o), r = typeof s == "object" && s !== null, i = typeof t == "object" && t !== null;
642
- s !== t && (r && i && JSON.stringify(s) === JSON.stringify(t) || e.setAttrByPath(o, t));
641
+ const n = e.attr(o), i = typeof n == "object" && n !== null, r = typeof t == "object" && t !== null;
642
+ n !== t && (i && r && JSON.stringify(n) === JSON.stringify(t) || e.setAttrByPath(o, t));
643
643
  }
644
644
  getNodeRingTarget(e) {
645
645
  return e ? e.querySelector(".flow-canvas-highlight-target") ?? e.querySelector(".flow-canvas-node-surface > :first-child") : null;
646
646
  }
647
647
  /** 让正式边接管交互式预览边时,恢复 schema 定义的端点 marker。 */
648
648
  syncEdgeMarker(e, o, t) {
649
- const r = o?.x6EdgeConfig?.attrs?.line?.[t], i = `line/${t}`;
650
- e.removeAttrByPath(i), r !== void 0 && e.setAttrByPath(i, r);
649
+ const i = o?.x6EdgeConfig?.attrs?.line?.[t], r = `line/${t}`;
650
+ e.removeAttrByPath(r), i !== void 0 && e.setAttrByPath(r, i);
651
651
  }
652
652
  getEdgeMarkerConfig(e, o) {
653
- const s = e?.x6EdgeConfig?.attrs?.line?.[o];
654
- if (s)
655
- return typeof s == "string" ? { name: s } : { ...s };
653
+ const n = e?.x6EdgeConfig?.attrs?.line?.[o];
654
+ if (n)
655
+ return typeof n == "string" ? { name: n } : { ...n };
656
656
  }
657
- applyEdgeMarkerDecoration(e, o, t, s) {
658
- if (!s) {
657
+ applyEdgeMarkerDecoration(e, o, t, n) {
658
+ if (!n) {
659
659
  this.prevEdgeDecorationMarkerIds.has(e.id) && (this.syncEdgeMarker(e, o, t), this.prevEdgeDecorationMarkerIds.delete(e.id));
660
660
  return;
661
661
  }
662
- const r = this.getEdgeMarkerConfig(o, t) ?? { name: "block", width: 8, height: 8 };
662
+ const i = this.getEdgeMarkerConfig(o, t) ?? { name: "block", width: 8, height: 8 };
663
663
  this.setEdgeAttrIfChanged(e, `line/${t}`, {
664
- ...r,
665
- stroke: s,
666
- fill: s
664
+ ...i,
665
+ stroke: n,
666
+ fill: n
667
667
  }), this.prevEdgeDecorationMarkerIds.add(e.id);
668
668
  }
669
669
  dispose() {
@@ -673,22 +673,22 @@ class Wt {
673
673
  }
674
674
  resolveNodes(e) {
675
675
  const o = /* @__PURE__ */ new Map();
676
- for (const [t, s] of Object.entries(e.nodes)) {
677
- const r = this.schema.nodeTypes[s.type];
678
- if (!r)
676
+ for (const [t, n] of Object.entries(e.nodes)) {
677
+ const i = this.schema.nodeTypes[n.type];
678
+ if (!i)
679
679
  throw new kt(
680
- `Unknown node type "${s.type}" for node "${t}". Registered types: [${Object.keys(this.schema.nodeTypes).join(", ")}]. Register the type in CanvasSchema.nodeTypes before using it in a FlowModel.`
680
+ `Unknown node type "${n.type}" for node "${t}". Registered types: [${Object.keys(this.schema.nodeTypes).join(", ")}]. Register the type in CanvasSchema.nodeTypes before using it in a FlowModel.`
681
681
  );
682
- const i = this.shapeRegistry.registerNodeType(s.type, r.component), l = r.getSize(s), a = Ue(s, r.getPorts);
683
- o.set(t, { model: s, definition: r, shapeName: i, size: l, ports: a });
682
+ const r = this.shapeRegistry.registerNodeType(n.type, i.component), l = i.getSize(n), a = Ue(n, i.getPorts);
683
+ o.set(t, { model: n, definition: i, shapeName: r, size: l, ports: a });
684
684
  }
685
685
  return o;
686
686
  }
687
687
  resolveEdges(e) {
688
688
  const o = /* @__PURE__ */ new Map();
689
- for (const [t, s] of Object.entries(e.edges)) {
690
- const r = s.type ?? this.schema.defaultEdgeType ?? "default", i = this.schema.edgeTypes?.[r];
691
- o.set(t, { model: s, definition: i });
689
+ for (const [t, n] of Object.entries(e.edges)) {
690
+ const i = n.type ?? this.schema.defaultEdgeType ?? "default", r = this.schema.edgeTypes?.[i];
691
+ o.set(t, { model: n, definition: r });
692
692
  }
693
693
  return o;
694
694
  }
@@ -696,42 +696,42 @@ class Wt {
696
696
  const o = new Set(e.keys());
697
697
  for (const t of this.knownNodeIds)
698
698
  if (!o.has(t)) {
699
- const s = this.graph.getCellById(t);
700
- s && this.graph.removeCell(s), this.knownNodeIds.delete(t), this.defaultHighlightedNodeIds.delete(t), this.prevNodeDecorationClasses.delete(t), this.prevNodeDecorationColors.delete(t), this.nodeDefaultAttrs.delete(t);
701
- const r = this.pendingDecorationRAFs.get(t);
702
- r && (cancelAnimationFrame(r), this.pendingDecorationRAFs.delete(t));
699
+ const n = this.graph.getCellById(t);
700
+ n && this.graph.removeCell(n), this.knownNodeIds.delete(t), this.defaultHighlightedNodeIds.delete(t), this.prevNodeDecorationClasses.delete(t), this.prevNodeDecorationColors.delete(t), this.nodeDefaultAttrs.delete(t);
701
+ const i = this.pendingDecorationRAFs.get(t);
702
+ i && (cancelAnimationFrame(i), this.pendingDecorationRAFs.delete(t));
703
703
  }
704
- for (const [t, s] of e) {
705
- const r = this.graph.getCellById(t);
706
- r ? this.updateExistingNode(r, s) : this.addNewNode(t, s);
704
+ for (const [t, n] of e) {
705
+ const i = this.graph.getCellById(t);
706
+ i ? this.updateExistingNode(i, n) : this.addNewNode(t, n);
707
707
  }
708
708
  }
709
709
  updateExistingNode(e, o) {
710
- const { model: t, size: s, ports: r, definition: i } = o;
710
+ const { model: t, size: n, ports: i, definition: r } = o;
711
711
  if (e.getData()?.type !== t.type) {
712
712
  this.graph.removeCell(e), this.addNewNode(e.id, o);
713
713
  return;
714
714
  }
715
715
  const a = e.getPosition();
716
716
  (a.x !== t.position.x || a.y !== t.position.y) && e.setPosition(t.position.x, t.position.y);
717
- const v = e.getSize();
718
- (v.width !== s.width || v.height !== s.height) && e.setSize(s.width, s.height, { silent: !0 }), this.syncNodePorts(e, r), e.setData({ ...t }), this.applyNodeBehavior(e, t, i), this.applyNodeHighlightAndDecoration(e, t);
717
+ const h = e.getSize();
718
+ (h.width !== n.width || h.height !== n.height) && e.setSize(n.width, n.height, { silent: !0 }), this.syncNodePorts(e, i), e.setData({ ...t }), this.applyNodeBehavior(e, t, r), this.applyNodeHighlightAndDecoration(e, t);
719
719
  }
720
720
  syncNodePorts(e, o) {
721
- const t = e.getPorts(), s = new Set(o.map((i) => i.id)), r = new Set(t.map((i) => i.id));
722
- for (const i of t)
723
- i.id && !s.has(i.id) && e.removePort(i.id);
724
- for (const i of o)
725
- r.has(i.id) || e.addPort({ id: i.id, group: i.group, ...i.x6PortConfig });
721
+ const t = e.getPorts(), n = new Set(o.map((r) => r.id)), i = new Set(t.map((r) => r.id));
722
+ for (const r of t)
723
+ r.id && !n.has(r.id) && e.removePort(r.id);
724
+ for (const r of o)
725
+ i.has(r.id) || e.addPort({ id: r.id, group: r.group, ...r.x6PortConfig });
726
726
  }
727
727
  addNewNode(e, o) {
728
- const { model: t, shapeName: s, size: r, ports: i, definition: l } = o, a = {
728
+ const { model: t, shapeName: n, size: i, ports: r, definition: l } = o, a = {
729
729
  id: t.id,
730
- shape: s,
730
+ shape: n,
731
731
  x: t.position.x,
732
732
  y: t.position.y,
733
- width: r.width,
734
- height: r.height,
733
+ width: i.width,
734
+ height: i.height,
735
735
  data: { ...t },
736
736
  ports: {
737
737
  groups: {
@@ -760,13 +760,13 @@ class Wt {
760
760
  }
761
761
  }
762
762
  },
763
- items: i.map((f) => ({ id: f.id, group: f.group, ...f.x6PortConfig }))
763
+ items: r.map((f) => ({ id: f.id, group: f.group, ...f.x6PortConfig }))
764
764
  },
765
765
  ...l.x6CellConfig
766
766
  };
767
767
  this.graph.addNode(a), this.knownNodeIds.add(e), this.saveNodeDefaultAttrs(e, l);
768
- const v = this.graph.getCellById(e);
769
- v && (this.applyNodeBehavior(v, t, l), this.applyNodeHighlightAndDecoration(v, t), this.scheduleDecorationRetryIfNeeded(v));
768
+ const h = this.graph.getCellById(e);
769
+ h && (this.applyNodeBehavior(h, t, l), this.applyNodeHighlightAndDecoration(h, t), this.scheduleDecorationRetryIfNeeded(h));
770
770
  }
771
771
  /**
772
772
  * Vue Shape 组件在 foreignObject 内异步挂载,addNewNode 同步调用
@@ -777,16 +777,16 @@ class Wt {
777
777
  scheduleDecorationRetryIfNeeded(e) {
778
778
  const o = this.graph.findViewByCell(e)?.container;
779
779
  if (this.getNodeRingTarget(o)) return;
780
- const t = e.id, s = this.pendingDecorationRAFs.get(t);
781
- s && cancelAnimationFrame(s);
782
- const r = requestAnimationFrame(() => {
780
+ const t = e.id, n = this.pendingDecorationRAFs.get(t);
781
+ n && cancelAnimationFrame(n);
782
+ const i = requestAnimationFrame(() => {
783
783
  if (this.pendingDecorationRAFs.delete(t), !this.knownNodeIds.has(t)) return;
784
- const i = this.lastModel?.nodes[t];
785
- if (!i) return;
784
+ const r = this.lastModel?.nodes[t];
785
+ if (!r) return;
786
786
  const l = this.graph.getCellById(t);
787
- l?.isNode() && this.applyNodeHighlightAndDecoration(l, i);
787
+ l?.isNode() && this.applyNodeHighlightAndDecoration(l, r);
788
788
  });
789
- this.pendingDecorationRAFs.set(t, r);
789
+ this.pendingDecorationRAFs.set(t, i);
790
790
  }
791
791
  /**
792
792
  * 将 schema 定义的 getBehavior 映射到 X6 节点属性。
@@ -802,32 +802,32 @@ class Wt {
802
802
  */
803
803
  applyNodeBehavior(e, o, t) {
804
804
  if (!t.getBehavior) return;
805
- const s = this.resolveCanvasContext?.();
806
- if (!s) return;
807
- const r = t.getBehavior(o, s);
808
- if (r.draggable !== void 0 && e.setProp("draggable", r.draggable, { silent: !0 }), r.connectable !== void 0) {
809
- const l = r.connectable ? !0 : r.targetable === !1 ? !1 : "passive";
805
+ const n = this.resolveCanvasContext?.();
806
+ if (!n) return;
807
+ const i = t.getBehavior(o, n);
808
+ if (i.draggable !== void 0 && e.setProp("draggable", i.draggable, { silent: !0 }), i.connectable !== void 0) {
809
+ const l = i.connectable ? !0 : i.targetable === !1 ? !1 : "passive";
810
810
  for (const a of e.getPorts())
811
811
  e.setPortProp(a.id, "attrs/circle/magnet", l, { silent: !0 });
812
812
  }
813
- if (r.showPorts !== void 0) {
814
- const l = r.showPorts;
813
+ if (i.showPorts !== void 0) {
814
+ const l = i.showPorts;
815
815
  for (const a of e.getPorts())
816
816
  e.setPortProp(a.id, "attrs/circle/visibility", l ? "visible" : "hidden", { silent: !0 });
817
817
  }
818
- const i = e.getData() ?? {};
819
- r.deletable !== void 0 && i._deletable !== r.deletable && e.setData({ ...i, _deletable: r.deletable }, { silent: !0 }), r.selectable !== void 0 && i._selectable !== r.selectable && e.setData({ ...e.getData(), _selectable: r.selectable }, { silent: !0 });
818
+ const r = e.getData() ?? {};
819
+ i.deletable !== void 0 && r._deletable !== i.deletable && e.setData({ ...r, _deletable: i.deletable }, { silent: !0 }), i.selectable !== void 0 && r._selectable !== i.selectable && e.setData({ ...e.getData(), _selectable: i.selectable }, { silent: !0 });
820
820
  }
821
821
  syncEdges(e, o) {
822
822
  const t = new Set(e.keys());
823
- for (const s of this.knownEdgeIds)
824
- if (!t.has(s)) {
825
- const r = this.graph.getCellById(s);
826
- r && this.graph.removeCell(r), this.knownEdgeIds.delete(s), this.defaultHighlightedEdgeIds.delete(s), this.prevEdgeDecorationClasses.delete(s), this.prevEdgeDecorationColors.delete(s), this.prevEdgeDecorationMarkerIds.delete(s), this.prevEdgeStyleIds.delete(s), this.edgeDefaultAttrs.delete(s);
823
+ for (const n of this.knownEdgeIds)
824
+ if (!t.has(n)) {
825
+ const i = this.graph.getCellById(n);
826
+ i && this.graph.removeCell(i), this.knownEdgeIds.delete(n), this.defaultHighlightedEdgeIds.delete(n), this.prevEdgeDecorationClasses.delete(n), this.prevEdgeDecorationColors.delete(n), this.prevEdgeDecorationMarkerIds.delete(n), this.prevEdgeStyleIds.delete(n), this.edgeDefaultAttrs.delete(n);
827
827
  }
828
- for (const [s, r] of e) {
829
- const i = this.graph.getCellById(s), { model: l, definition: a } = r;
830
- i ? (this.updateExistingEdge(i, l, a, o), this.knownEdgeIds.has(s) || (this.knownEdgeIds.add(s), this.saveEdgeDefaultAttrs(s, a))) : this.addNewEdge(s, l, a);
828
+ for (const [n, i] of e) {
829
+ const r = this.graph.getCellById(n), { model: l, definition: a } = i;
830
+ r ? (this.updateExistingEdge(r, l, a, o), this.knownEdgeIds.has(n) || (this.knownEdgeIds.add(n), this.saveEdgeDefaultAttrs(n, a))) : this.addNewEdge(n, l, a);
831
831
  }
832
832
  }
833
833
  /**
@@ -835,8 +835,8 @@ class Wt {
835
835
  * X6 Edge.getSource() 返回 { cell, port } 格式,与 FlowEdgeModel 的 { nodeId, portId } 不同,
836
836
  * 需要用 (currentSource as any).cell 来比较。
837
837
  */
838
- updateExistingEdge(e, o, t, s) {
839
- const r = e.getSource(), i = e.getTarget(), l = r.cell !== o.source.nodeId || r.port !== o.source.portId, a = i.cell !== o.target.nodeId || i.port !== o.target.portId;
838
+ updateExistingEdge(e, o, t, n) {
839
+ const i = e.getSource(), r = e.getTarget(), l = i.cell !== o.source.nodeId || i.port !== o.source.portId, a = r.cell !== o.target.nodeId || r.port !== o.target.portId;
840
840
  l && e.setSource({ cell: o.source.nodeId, port: o.source.portId }), a && e.setTarget({ cell: o.target.nodeId, port: o.target.portId });
841
841
  const f = (e.getData()?.type ?? void 0) !== (o.type ?? void 0);
842
842
  if (f) {
@@ -856,28 +856,28 @@ class Wt {
856
856
  e.getLabels().length > 0 && e.setLabels([]);
857
857
  return;
858
858
  }
859
- const t = o.labels.map((s) => ({
859
+ const t = o.labels.map((n) => ({
860
860
  attrs: {
861
- label: { text: s.text ?? "" }
861
+ label: { text: n.text ?? "" }
862
862
  },
863
- position: s.position != null ? { distance: s.position } : void 0
863
+ position: n.position != null ? { distance: n.position } : void 0
864
864
  }));
865
865
  e.setLabels(t);
866
866
  }
867
867
  addNewEdge(e, o, t) {
868
- const s = {
868
+ const n = {
869
869
  id: o.id,
870
870
  source: { cell: o.source.nodeId, port: o.source.portId },
871
871
  target: { cell: o.target.nodeId, port: o.target.portId },
872
872
  data: { ...o },
873
873
  zIndex: Fe
874
874
  };
875
- t?.router && (s.router = typeof t.router == "string" ? { name: t.router } : t.router), t?.connector && (s.connector = typeof t.connector == "string" ? { name: t.connector } : t.connector), t?.x6EdgeConfig && Object.assign(s, t.x6EdgeConfig), o.labels?.length && (s.labels = o.labels.map((i) => ({
876
- attrs: { label: { text: i.text ?? "" } },
877
- position: i.position != null ? { distance: i.position } : void 0
878
- }))), this.graph.addEdge(s), this.knownEdgeIds.add(e), this.saveEdgeDefaultAttrs(e, t);
879
- const r = this.graph.getCellById(e);
880
- r && this.applyEdgeStyleAndDecoration(r, o, t);
875
+ t?.router && (n.router = typeof t.router == "string" ? { name: t.router } : t.router), t?.connector && (n.connector = typeof t.connector == "string" ? { name: t.connector } : t.connector), t?.x6EdgeConfig && Object.assign(n, t.x6EdgeConfig), o.labels?.length && (n.labels = o.labels.map((r) => ({
876
+ attrs: { label: { text: r.text ?? "" } },
877
+ position: r.position != null ? { distance: r.position } : void 0
878
+ }))), this.graph.addEdge(n), this.knownEdgeIds.add(e), this.saveEdgeDefaultAttrs(e, t);
879
+ const i = this.graph.getCellById(e);
880
+ i && this.applyEdgeStyleAndDecoration(i, o, t);
881
881
  }
882
882
  /**
883
883
  * 重算所有边的视觉样式。
@@ -888,8 +888,8 @@ class Wt {
888
888
  for (const [e, o] of Object.entries(this.lastModel.edges)) {
889
889
  const t = this.graph.getCellById(e);
890
890
  if (!t?.isEdge()) continue;
891
- const s = o.type ?? this.schema.defaultEdgeType ?? "default", r = this.schema.edgeTypes?.[s];
892
- this.applyEdgeStyleAndDecoration(t, o, r);
891
+ const n = o.type ?? this.schema.defaultEdgeType ?? "default", i = this.schema.edgeTypes?.[n];
892
+ this.applyEdgeStyleAndDecoration(t, o, i);
893
893
  }
894
894
  }
895
895
  /**
@@ -902,8 +902,8 @@ class Wt {
902
902
  if (!o) return;
903
903
  const t = this.graph.getCellById(e);
904
904
  if (!t?.isEdge()) return;
905
- const s = o.type ?? this.schema.defaultEdgeType ?? "default", r = this.schema.edgeTypes?.[s];
906
- this.applyEdgeStyleAndDecoration(t, o, r);
905
+ const n = o.type ?? this.schema.defaultEdgeType ?? "default", i = this.schema.edgeTypes?.[n];
906
+ this.applyEdgeStyleAndDecoration(t, o, i);
907
907
  }
908
908
  /**
909
909
  * 重算所有节点的高亮 + 装饰视觉。
@@ -928,13 +928,13 @@ class Wt {
928
928
  * body/stroke 仅作为普通 SVG shape 的兜底同步。
929
929
  */
930
930
  applyNodeHighlightAndDecoration(e, o) {
931
- const t = this.highlightedNodeIds.has(e.id), s = this.resolveNodeDecoration?.(o), r = this.graph.findViewByCell(e)?.container, i = this.getNodeRingTarget(r), l = this.prevNodeDecorationClasses.get(e.id);
932
- l && (r?.classList.remove(l), this.prevNodeDecorationClasses.delete(e.id)), s?.className && (r?.classList.add(s.className), this.prevNodeDecorationClasses.set(e.id, s.className));
933
- const a = s?.borderColor, f = a ?? (t ? "#3a84ff" : void 0), p = this.prevNodeDecorationColors.has(e.id) || this.defaultHighlightedNodeIds.has(e.id);
934
- f ? (e.setAttrByPath("body/stroke", f), e.setAttrByPath("body/strokeWidth", 2)) : p && (this.restoreNodeAttr(e, "body/stroke", "stroke"), this.restoreNodeAttr(e, "body/strokeWidth", "strokeWidth")), i && (i.classList.add(Ut), a ? (i.classList.add(We), i.style.setProperty("--flow-canvas-node-decoration-ring-background", a), i.style.setProperty("--flow-canvas-node-decoration-ring-opacity", "0.95")) : (i.classList.remove(We), i.style.removeProperty("--flow-canvas-node-decoration-ring-background"), i.style.removeProperty("--flow-canvas-node-decoration-ring-opacity")), t ? (i.classList.add(Ve), i.style.setProperty(
931
+ const t = this.highlightedNodeIds.has(e.id), n = this.resolveNodeDecoration?.(o), i = this.graph.findViewByCell(e)?.container, r = this.getNodeRingTarget(i), l = this.prevNodeDecorationClasses.get(e.id);
932
+ l && (i?.classList.remove(l), this.prevNodeDecorationClasses.delete(e.id)), n?.className && (i?.classList.add(n.className), this.prevNodeDecorationClasses.set(e.id, n.className));
933
+ const a = n?.borderColor, f = a ?? (t ? "#3a84ff" : void 0), p = this.prevNodeDecorationColors.has(e.id) || this.defaultHighlightedNodeIds.has(e.id);
934
+ f ? (e.setAttrByPath("body/stroke", f), e.setAttrByPath("body/strokeWidth", 2)) : p && (this.restoreNodeAttr(e, "body/stroke", "stroke"), this.restoreNodeAttr(e, "body/strokeWidth", "strokeWidth")), r && (r.classList.add(Ut), a ? (r.classList.add(We), r.style.setProperty("--flow-canvas-node-decoration-ring-background", a), r.style.setProperty("--flow-canvas-node-decoration-ring-opacity", "0.95")) : (r.classList.remove(We), r.style.removeProperty("--flow-canvas-node-decoration-ring-background"), r.style.removeProperty("--flow-canvas-node-decoration-ring-opacity")), t ? (r.classList.add(Ve), r.style.setProperty(
935
935
  "--flow-canvas-node-pulse-ring-background",
936
936
  a ?? jt
937
- ), i.style.setProperty("--flow-canvas-node-pulse-ring-opacity", "0.95")) : (i.classList.remove(Ve), i.style.removeProperty("--flow-canvas-node-pulse-ring-background"), i.style.removeProperty("--flow-canvas-node-pulse-ring-opacity"))), a ? this.prevNodeDecorationColors.add(e.id) : this.prevNodeDecorationColors.delete(e.id), t && !a ? this.defaultHighlightedNodeIds.add(e.id) : this.defaultHighlightedNodeIds.delete(e.id);
937
+ ), r.style.setProperty("--flow-canvas-node-pulse-ring-opacity", "0.95")) : (r.classList.remove(Ve), 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), t && !a ? this.defaultHighlightedNodeIds.add(e.id) : this.defaultHighlightedNodeIds.delete(e.id);
938
938
  }
939
939
  getHoveredEdgeId() {
940
940
  return this.hoveredEdgeId;
@@ -961,15 +961,15 @@ class Wt {
961
961
  * 最终值 = decorationStroke ?? styleStroke ?? defaultHighlightStroke ?? (清除)。
962
962
  */
963
963
  applyEdgeStyleAndDecoration(e, o, t) {
964
- const s = this.highlightedEdgeIds.has(e.id), r = this.resolveEdgeDecoration?.(o), i = this.prevEdgeDecorationClasses.get(e.id);
965
- i && (this.graph.findViewByCell(e)?.container?.classList.remove(i), this.prevEdgeDecorationClasses.delete(e.id)), r?.className && (this.graph.findViewByCell(e)?.container?.classList.add(r.className), this.prevEdgeDecorationClasses.set(e.id, r.className));
966
- let l, a, v;
964
+ const n = this.highlightedEdgeIds.has(e.id), i = this.resolveEdgeDecoration?.(o), r = this.prevEdgeDecorationClasses.get(e.id);
965
+ 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));
966
+ let l, a, h;
967
967
  if (t?.style) {
968
- const O = this.graph.isSelected?.(e) ?? !1, b = this.hoveredEdgeId === e.id, S = t.style(o, { selected: O, highlighted: s, hovered: b });
969
- l = S.stroke, a = S.strokeWidth, v = S.strokeDasharray;
968
+ const O = this.graph.isSelected?.(e) ?? !1, b = this.hoveredEdgeId === e.id, S = t.style(o, { selected: O, highlighted: n, hovered: b });
969
+ l = S.stroke, a = S.strokeWidth, h = S.strokeDasharray;
970
970
  }
971
- const f = !t?.style && s ? "#3a84ff" : void 0, p = r?.strokeColor, u = r?.targetMarkerColor, w = p ?? l ?? f, D = !!t?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
972
- w ? this.setEdgeAttrIfChanged(e, "line/stroke", w) : D && this.restoreEdgeAttr(e, "line/stroke", "stroke"), this.applyEdgeMarkerDecoration(e, t, "targetMarker", u), t?.style ? (this.prevEdgeStyleIds.add(e.id), a ? this.setEdgeAttrIfChanged(e, "line/strokeWidth", a) : this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), v ? this.setEdgeAttrIfChanged(e, "line/strokeDasharray", v) : 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), f ? this.defaultHighlightedEdgeIds.add(e.id) : this.defaultHighlightedEdgeIds.delete(e.id);
971
+ const f = !t?.style && n ? "#3a84ff" : void 0, p = i?.strokeColor, u = i?.targetMarkerColor, w = p ?? l ?? f, D = !!t?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
972
+ w ? this.setEdgeAttrIfChanged(e, "line/stroke", w) : D && this.restoreEdgeAttr(e, "line/stroke", "stroke"), this.applyEdgeMarkerDecoration(e, t, "targetMarker", u), t?.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), f ? this.defaultHighlightedEdgeIds.add(e.id) : this.defaultHighlightedEdgeIds.delete(e.id);
973
973
  }
974
974
  }
975
975
  class Vt {
@@ -982,15 +982,15 @@ class Vt {
982
982
  }
983
983
  registerNodeType(e, o) {
984
984
  const t = this.getShapeName(e);
985
- let s = this.wrappedComponents.get(e);
986
- return s || (s = fe({
987
- name: `FlowCanvasNodeShape${e.replace(/(^|[-_])(\w)/g, (r, i, l) => l.toUpperCase())}`,
985
+ let n = this.wrappedComponents.get(e);
986
+ return n || (n = fe({
987
+ name: `FlowCanvasNodeShape${e.replace(/(^|[-_])(\w)/g, (i, r, l) => l.toUpperCase())}`,
988
988
  setup() {
989
989
  return () => qe("div", { class: "flow-canvas-node-surface" }, [qe(o)]);
990
990
  }
991
- }), this.wrappedComponents.set(e, s)), xt({
991
+ }), this.wrappedComponents.set(e, n)), xt({
992
992
  shape: t,
993
- component: s,
993
+ component: n,
994
994
  width: 100,
995
995
  height: 40
996
996
  }), t;
@@ -1006,8 +1006,8 @@ class Xt {
1006
1006
  flowModelRef;
1007
1007
  idGenerator;
1008
1008
  disposers = [];
1009
- constructor(e, o, t, s, r) {
1010
- this.graph = e, this.onUiEvent = o, this.onCommand = t, this.flowModelRef = s, this.idGenerator = r ?? ze, this.bindEvents();
1009
+ constructor(e, o, t, n, i) {
1010
+ this.graph = e, this.onUiEvent = o, this.onCommand = t, this.flowModelRef = n, this.idGenerator = i ?? ze, this.bindEvents();
1011
1011
  }
1012
1012
  dispose() {
1013
1013
  for (const e of this.disposers) e();
@@ -1018,6 +1018,10 @@ class Xt {
1018
1018
  this.onUiEvent({ type: "node.click", nodeId: e.id });
1019
1019
  }), this.on("node:dblclick", ({ node: e }) => {
1020
1020
  this.onUiEvent({ type: "node.dblclick", nodeId: e.id });
1021
+ }), this.on("node:mouseenter", ({ node: e }) => {
1022
+ this.onUiEvent({ type: "node.mouseenter", nodeId: e.id });
1023
+ }), this.on("node:mouseleave", ({ node: e }) => {
1024
+ this.onUiEvent({ type: "node.mouseleave", nodeId: e.id });
1021
1025
  }), this.on("node:contextmenu", ({ node: e, e: o }) => {
1022
1026
  this.onUiEvent({
1023
1027
  type: "node.contextmenu",
@@ -1025,13 +1029,13 @@ class Xt {
1025
1029
  position: { x: o.clientX, y: o.clientY }
1026
1030
  });
1027
1031
  }), this.on("edge:click", ({ edge: e, e: o }) => {
1028
- const s = o.target?.closest?.(".x6-edge-label");
1029
- if (s) {
1030
- const i = e.getData?.()?.labels ?? [], l = s.parentElement?.querySelectorAll(".x6-edge-label"), a = l ? Array.from(l).indexOf(s) : 0, v = i[Math.max(0, a)];
1032
+ const n = o.target?.closest?.(".x6-edge-label");
1033
+ if (n) {
1034
+ const r = e.getData?.()?.labels ?? [], l = n.parentElement?.querySelectorAll(".x6-edge-label"), a = l ? Array.from(l).indexOf(n) : 0, h = r[Math.max(0, a)];
1031
1035
  this.onUiEvent({
1032
1036
  type: "edge.label.click",
1033
1037
  edgeId: e.id,
1034
- labelId: v?.id ?? `label-${a}`
1038
+ labelId: h?.id ?? `label-${a}`
1035
1039
  });
1036
1040
  return;
1037
1041
  }
@@ -1054,9 +1058,9 @@ class Xt {
1054
1058
  commands: [{ type: "node.move", nodeId: e.id, position: { x: o.x, y: o.y } }]
1055
1059
  });
1056
1060
  }), this.on("edge:connected", ({ edge: e, isNew: o }) => {
1057
- const t = e.getSourceCell(), s = e.getTargetCell();
1058
- if (!t || !s) return;
1059
- const r = e.getSourcePortId(), i = e.getTargetPortId(), l = e.id in this.flowModelRef.value.edges;
1061
+ const t = e.getSourceCell(), n = e.getTargetCell();
1062
+ if (!t || !n) return;
1063
+ const i = e.getSourcePortId(), r = e.getTargetPortId(), l = e.id in this.flowModelRef.value.edges;
1060
1064
  o && !l ? (this.graph.removeCell(e), this.onCommand({
1061
1065
  id: J(),
1062
1066
  source: "user:drag",
@@ -1067,8 +1071,8 @@ class Xt {
1067
1071
  type: "edge.add",
1068
1072
  edge: {
1069
1073
  id: this.idGenerator("edge"),
1070
- source: { nodeId: t.id, portId: r ?? void 0 },
1071
- target: { nodeId: s.id, portId: i ?? void 0 }
1074
+ source: { nodeId: t.id, portId: i ?? void 0 },
1075
+ target: { nodeId: n.id, portId: r ?? void 0 }
1072
1076
  }
1073
1077
  }
1074
1078
  ]
@@ -1081,32 +1085,32 @@ class Xt {
1081
1085
  {
1082
1086
  type: "edge.reconnect",
1083
1087
  edgeId: e.id,
1084
- source: { nodeId: t.id, portId: r ?? void 0 },
1085
- target: { nodeId: s.id, portId: i ?? void 0 }
1088
+ source: { nodeId: t.id, portId: i ?? void 0 },
1089
+ target: { nodeId: n.id, portId: r ?? void 0 }
1086
1090
  }
1087
1091
  ]
1088
1092
  });
1089
1093
  }), this.on("edge:change:labels", ({ edge: e, current: o }) => {
1090
- const s = e.getData?.()?.labels ?? [];
1091
- if (!s.length || !o?.length) return;
1092
- const r = [];
1093
- for (let i = 0; i < Math.min(s.length, o.length); i++) {
1094
- const l = o[i], a = s[i];
1094
+ const n = e.getData?.()?.labels ?? [];
1095
+ if (!n.length || !o?.length) return;
1096
+ const i = [];
1097
+ for (let r = 0; r < Math.min(n.length, o.length); r++) {
1098
+ const l = o[r], a = n[r];
1095
1099
  if (!a?.id) continue;
1096
- const v = typeof l.position == "object" ? l.position?.distance : l.position;
1097
- v != null && r.push({
1100
+ const h = typeof l.position == "object" ? l.position?.distance : l.position;
1101
+ h != null && i.push({
1098
1102
  type: "edge.label.update",
1099
1103
  edgeId: e.id,
1100
1104
  labelId: a.id,
1101
- patch: { position: v }
1105
+ patch: { position: h }
1102
1106
  });
1103
1107
  }
1104
- r.length && this.onCommand({
1108
+ i.length && this.onCommand({
1105
1109
  id: J(),
1106
1110
  source: "user:drag",
1107
1111
  label: "拖动标签",
1108
1112
  timestamp: Date.now(),
1109
- commands: r
1113
+ commands: i
1110
1114
  });
1111
1115
  });
1112
1116
  }
@@ -1114,15 +1118,24 @@ class Xt {
1114
1118
  this.graph.on(e, o), this.disposers.push(() => this.graph.off(e, o));
1115
1119
  }
1116
1120
  }
1117
- function Kt(n) {
1118
- function e(o) {
1119
- const t = n.getCellById(o);
1120
- if (!t || !t.isNode()) return null;
1121
- const s = t, r = s.getPosition(), i = s.getSize(), l = { x: r.x, y: r.y, width: i.width, height: i.height }, a = n.localToGraph(l);
1122
- return new DOMRect(a.x, a.y, a.width, a.height);
1121
+ function Kt(s) {
1122
+ function e(t) {
1123
+ const n = s.getCellById(t);
1124
+ if (!n || !n.isNode()) return null;
1125
+ const i = n, r = i.getPosition(), l = i.getSize(), a = { x: r.x, y: r.y, width: l.width, height: l.height }, h = s.localToGraph(a);
1126
+ return new DOMRect(h.x, h.y, h.width, h.height);
1127
+ }
1128
+ function o(t) {
1129
+ const n = e(t);
1130
+ if (!n) return null;
1131
+ const i = s.container;
1132
+ if (!i || typeof i.getBoundingClientRect != "function") return n;
1133
+ const r = i.getBoundingClientRect();
1134
+ return new DOMRect(n.x + r.left, n.y + r.top, n.width, n.height);
1123
1135
  }
1124
1136
  return {
1125
- getNodeScreenRect: e
1137
+ getNodeScreenRect: e,
1138
+ getNodeViewportRect: o
1126
1139
  };
1127
1140
  }
1128
1141
  const Yt = Object.freeze({
@@ -1131,64 +1144,64 @@ const Yt = Object.freeze({
1131
1144
  bottom: 8,
1132
1145
  left: 8
1133
1146
  });
1134
- function ft(n) {
1147
+ function ft(s) {
1135
1148
  return {
1136
- nodeIds: n.filter((e) => e.isNode()).map((e) => e.id),
1137
- edgeIds: n.filter((e) => e.isEdge()).map((e) => e.id)
1149
+ nodeIds: s.filter((e) => e.isNode()).map((e) => e.id),
1150
+ edgeIds: s.filter((e) => e.isEdge()).map((e) => e.id)
1138
1151
  };
1139
1152
  }
1140
- function Zt(n, e = Yt) {
1153
+ function Zt(s, e = Yt) {
1141
1154
  return new DOMRect(
1142
- n.x - e.left,
1143
- n.y - e.top,
1144
- n.width + e.left + e.right,
1145
- n.height + e.top + e.bottom
1155
+ s.x - e.left,
1156
+ s.y - e.top,
1157
+ s.width + e.left + e.right,
1158
+ s.height + e.top + e.bottom
1146
1159
  );
1147
1160
  }
1148
- function Qt(n, e) {
1161
+ function Qt(s, e) {
1149
1162
  const o = [
1150
- ...e.nodeIds.map((r) => n.getCellById(r)),
1151
- ...e.edgeIds.map((r) => n.getCellById(r))
1152
- ].filter((r) => !!r);
1163
+ ...e.nodeIds.map((i) => s.getCellById(i)),
1164
+ ...e.edgeIds.map((i) => s.getCellById(i))
1165
+ ].filter((i) => !!i);
1153
1166
  if (o.length === 0) return null;
1154
- const t = n.getCellsBBox(o);
1167
+ const t = s.getCellsBBox(o);
1155
1168
  if (!t) return null;
1156
- const s = n.localToGraph(t);
1157
- return Zt(s);
1169
+ const n = s.localToGraph(t);
1170
+ return Zt(n);
1158
1171
  }
1159
- function gt(n, e, o) {
1160
- const t = n.nodeIds.filter((i) => {
1161
- const l = e.nodes[i];
1172
+ function gt(s, e, o) {
1173
+ const t = s.nodeIds.filter((r) => {
1174
+ const l = e.nodes[r];
1162
1175
  if (!l) return !1;
1163
1176
  const a = o(l);
1164
1177
  return a.deletable !== !1 && a.deleteDisabled !== !0;
1165
- }), s = new Set(t), r = n.edgeIds.filter((i) => {
1166
- const l = e.edges[i];
1167
- return l ? !s.has(l.source.nodeId) && !s.has(l.target.nodeId) : !1;
1178
+ }), n = new Set(t), i = s.edgeIds.filter((r) => {
1179
+ const l = e.edges[r];
1180
+ return l ? !n.has(l.source.nodeId) && !n.has(l.target.nodeId) : !1;
1168
1181
  });
1169
- return { nodeIds: t, edgeIds: r };
1182
+ return { nodeIds: t, edgeIds: i };
1170
1183
  }
1171
- function Jt(n) {
1184
+ function Jt(s) {
1172
1185
  return [
1173
- ...n.edgeIds.map((e) => ({ type: "edge.remove", edgeId: e })),
1174
- ...n.nodeIds.map((e) => ({ type: "node.remove", nodeId: e }))
1186
+ ...s.edgeIds.map((e) => ({ type: "edge.remove", edgeId: e })),
1187
+ ...s.nodeIds.map((e) => ({ type: "node.remove", nodeId: e }))
1175
1188
  ];
1176
1189
  }
1177
1190
  const eo = 100;
1178
1191
  function to({
1179
- graph: n,
1192
+ graph: s,
1180
1193
  overlayManager: e,
1181
1194
  executeCommand: o,
1182
1195
  schema: t,
1183
- flowModel: s,
1184
- getNodeBehavior: r,
1185
- idGenerator: i,
1196
+ flowModel: n,
1197
+ getNodeBehavior: i,
1198
+ idGenerator: r,
1186
1199
  defaultInsertGap: l,
1187
1200
  getContextMenuItems: a,
1188
- onHighlightChange: v,
1201
+ onHighlightChange: h,
1189
1202
  resolveNodeShape: f
1190
1203
  }) {
1191
- const p = i ?? ze;
1204
+ const p = r ?? ze;
1192
1205
  let u = [], w = [], D = null, O = !1, b = null;
1193
1206
  async function S() {
1194
1207
  if (O) return D;
@@ -1196,7 +1209,7 @@ function to({
1196
1209
  try {
1197
1210
  const d = await import("@antv/x6-plugin-dnd"), y = d.Dnd ?? d.default;
1198
1211
  return y ? (D = new y({
1199
- target: n,
1212
+ target: s,
1200
1213
  scaled: !0,
1201
1214
  animation: !0,
1202
1215
  getDragNode: (c) => c.clone(),
@@ -1216,8 +1229,8 @@ function to({
1216
1229
  if (!y?._dndSessionId || y._dndSessionId !== b) return;
1217
1230
  b = null;
1218
1231
  const c = d.getPosition();
1219
- n.removeNode(d.id);
1220
- const { _dndSessionId: g, ...h } = y, m = h.id || p("node");
1232
+ s.removeNode(d.id);
1233
+ const { _dndSessionId: g, ...v } = y, m = v.id || p("node");
1221
1234
  o({
1222
1235
  id: J(),
1223
1236
  source: "user:drag",
@@ -1226,39 +1239,39 @@ function to({
1226
1239
  commands: [
1227
1240
  {
1228
1241
  type: "node.add",
1229
- node: { ...h, id: m, position: { x: c.x, y: c.y } }
1242
+ node: { ...v, id: m, position: { x: c.x, y: c.y } }
1230
1243
  }
1231
1244
  ]
1232
1245
  });
1233
1246
  };
1234
- n.on("node:added", B);
1247
+ s.on("node:added", B);
1235
1248
  function j(d) {
1236
1249
  const y = t.nodeTypes[d.type];
1237
1250
  return Ue(d, y?.getPorts);
1238
1251
  }
1239
1252
  function k(d) {
1240
- return d ?? ft(n.getSelectedCells?.() ?? []);
1253
+ return d ?? ft(s.getSelectedCells?.() ?? []);
1241
1254
  }
1242
- function X(d, y, c, g, h) {
1255
+ function X(d, y, c, g, v) {
1243
1256
  switch (d) {
1244
1257
  case "left":
1245
1258
  return {
1246
- x: y.position.x - h - g.width,
1259
+ x: y.position.x - v - g.width,
1247
1260
  y: y.position.y + (c.height - g.height) / 2
1248
1261
  };
1249
1262
  case "top":
1250
1263
  return {
1251
1264
  x: y.position.x + (c.width - g.width) / 2,
1252
- y: y.position.y - h - g.height
1265
+ y: y.position.y - v - g.height
1253
1266
  };
1254
1267
  case "bottom":
1255
1268
  return {
1256
1269
  x: y.position.x + (c.width - g.width) / 2,
1257
- y: y.position.y + c.height + h
1270
+ y: y.position.y + c.height + v
1258
1271
  };
1259
1272
  default:
1260
1273
  return {
1261
- x: y.position.x + c.width + h,
1274
+ x: y.position.x + c.width + v,
1262
1275
  y: y.position.y + (c.height - g.height) / 2
1263
1276
  };
1264
1277
  }
@@ -1277,73 +1290,73 @@ function to({
1277
1290
  }
1278
1291
  const G = {
1279
1292
  zoomIn() {
1280
- n.zoom(0.1);
1293
+ s.zoom(0.1);
1281
1294
  },
1282
1295
  zoomOut() {
1283
- n.zoom(-0.1);
1296
+ s.zoom(-0.1);
1284
1297
  },
1285
1298
  zoomTo(d) {
1286
- n.zoomTo(d);
1299
+ s.zoomTo(d);
1287
1300
  },
1288
1301
  zoomToFit(d) {
1289
- n.zoomToFit({ padding: 40, maxScale: 1, ...d });
1302
+ s.zoomToFit({ padding: 40, maxScale: 1, ...d });
1290
1303
  },
1291
1304
  getZoom() {
1292
- return n.zoom();
1305
+ return s.zoom();
1293
1306
  },
1294
1307
  centerContent() {
1295
- n.centerContent();
1308
+ s.centerContent();
1296
1309
  },
1297
1310
  scrollToOrigin() {
1298
- n.translate(0, 0);
1311
+ s.translate(0, 0);
1299
1312
  },
1300
1313
  scrollToNode(d) {
1301
- const y = n.getCellById(d);
1302
- y && n.centerCell(y);
1314
+ const y = s.getCellById(d);
1315
+ y && s.centerCell(y);
1303
1316
  },
1304
1317
  getSelection() {
1305
1318
  return k();
1306
1319
  },
1307
1320
  getSelectionBounds(d) {
1308
- return Qt(n, k(d));
1321
+ return Qt(s, k(d));
1309
1322
  },
1310
1323
  selectNodes(d) {
1311
- const y = d.map((c) => n.getCellById(c)).filter(Boolean);
1312
- n.select?.(y);
1324
+ const y = d.map((c) => s.getCellById(c)).filter(Boolean);
1325
+ s.select?.(y);
1313
1326
  },
1314
1327
  selectEdges(d) {
1315
- const y = d.map((c) => n.getCellById(c)).filter(Boolean);
1316
- n.select?.(y);
1328
+ const y = d.map((c) => s.getCellById(c)).filter(Boolean);
1329
+ s.select?.(y);
1317
1330
  },
1318
1331
  clearSelection() {
1319
- const d = n.getSelectedCells?.();
1320
- d?.length && n.unselect?.(d);
1332
+ const d = s.getSelectedCells?.();
1333
+ d?.length && s.unselect?.(d);
1321
1334
  },
1322
1335
  deleteSelection(d) {
1323
- const y = k(d?.selection), c = gt(y, s.value, r ?? (() => ({}))), g = Jt(c);
1336
+ const y = k(d?.selection), c = gt(y, n.value, i ?? (() => ({}))), g = Jt(c);
1324
1337
  if (g.length === 0) return null;
1325
- const h = o({
1338
+ const v = o({
1326
1339
  id: J(),
1327
1340
  source: d?.source ?? "user:toolbar",
1328
1341
  label: d?.label ?? "删除选中",
1329
1342
  timestamp: Date.now(),
1330
1343
  commands: g
1331
1344
  });
1332
- return h.status === "applied" && d?.clearSelectionAfterApply !== !1 && G.clearSelection(), h;
1345
+ return v.status === "applied" && d?.clearSelectionAfterApply !== !1 && G.clearSelection(), v;
1333
1346
  },
1334
1347
  registerDndSource(d, y) {
1335
1348
  const c = async (g) => {
1336
- const h = await S();
1337
- if (!h) return;
1349
+ const v = await S();
1350
+ if (!v) return;
1338
1351
  const m = J();
1339
1352
  b = m;
1340
- const E = y(), L = f?.(E.type), z = n.createNode({
1353
+ const E = y(), L = f?.(E.type), z = s.createNode({
1341
1354
  width: L?.width ?? 154,
1342
1355
  height: L?.height ?? 54,
1343
1356
  shape: L?.shapeName ?? "rect",
1344
1357
  data: { ...E, _dndSessionId: m }
1345
1358
  });
1346
- h.start(z, g);
1359
+ v.start(z, g);
1347
1360
  };
1348
1361
  return d.addEventListener("mousedown", c), () => {
1349
1362
  d.removeEventListener("mousedown", c);
@@ -1354,14 +1367,14 @@ function to({
1354
1367
  * 复用 X6 原生的连线拖拽流程与 connecting.createEdge 配置。
1355
1368
  */
1356
1369
  startConnection(d, y) {
1357
- const c = n.getCellById(d);
1370
+ const c = s.getCellById(d);
1358
1371
  if (!c?.isNode()) return;
1359
- const g = c, h = n.findViewByCell(g);
1360
- if (!h) return;
1361
- const m = h.findPortElem(y, "circle") ?? h.findPortElem(y);
1372
+ const g = c, v = s.findViewByCell(g);
1373
+ if (!v) return;
1374
+ const m = v.findPortElem(y, "circle") ?? v.findPortElem(y);
1362
1375
  if (!m) return;
1363
- const L = (m.matches?.("[magnet]") ? m : m.querySelector?.("[magnet]")) ?? m, z = L.getBoundingClientRect(), ie = z.left + z.width / 2, N = z.top + z.height / 2, _ = new MouseEvent("mousedown", {
1364
- clientX: ie,
1376
+ const L = (m.matches?.("[magnet]") ? m : m.querySelector?.("[magnet]")) ?? m, z = L.getBoundingClientRect(), re = z.left + z.width / 2, N = z.top + z.height / 2, _ = new MouseEvent("mousedown", {
1377
+ clientX: re,
1365
1378
  clientY: N,
1366
1379
  button: 0,
1367
1380
  buttons: 1,
@@ -1371,15 +1384,15 @@ function to({
1371
1384
  L.dispatchEvent(_);
1372
1385
  },
1373
1386
  async exportAsImage(d) {
1374
- const { domToBlob: y } = await import("modern-screenshot"), c = d?.padding ?? 20, g = d?.backgroundColor ?? n.options.background?.color ?? "#ffffff", h = n.zoom(), m = n.translate(), E = n.getContentBBox(), L = E.width / h, z = E.height / h;
1387
+ const { domToBlob: y } = await import("modern-screenshot"), c = d?.padding ?? 20, g = d?.backgroundColor ?? s.options.background?.color ?? "#ffffff", v = s.zoom(), m = s.translate(), E = s.getContentBBox(), L = E.width / v, z = E.height / v;
1375
1388
  if (L === 0 || z === 0)
1376
1389
  return new Blob();
1377
- const ie = (E.x - m.tx) / h, N = (E.y - m.ty) / h, _ = Math.ceil(L + c * 2), x = Math.ceil(z + c * 2), R = document.createElement("div");
1390
+ const re = (E.x - m.tx) / v, N = (E.y - m.ty) / v, _ = Math.ceil(L + c * 2), x = Math.ceil(z + c * 2), R = document.createElement("div");
1378
1391
  R.style.cssText = "position:fixed;left:-99999px;top:0;pointer-events:none;";
1379
- const F = n.container.cloneNode(!0);
1392
+ const F = s.container.cloneNode(!0);
1380
1393
  F.style.width = `${_}px`, F.style.height = `${x}px`, F.style.overflow = "visible";
1381
1394
  const Z = F.querySelector("svg");
1382
- Z && (Z.setAttribute("width", String(_)), Z.setAttribute("height", String(x)), Z.style.width = `${_}px`, Z.style.height = `${x}px`), F.querySelector(".x6-graph-svg-viewport")?.setAttribute("transform", `matrix(1,0,0,1,${-ie + c},${-N + c})`), R.appendChild(F), document.body.appendChild(R);
1395
+ Z && (Z.setAttribute("width", String(_)), Z.setAttribute("height", String(x)), Z.style.width = `${_}px`, Z.style.height = `${x}px`), F.querySelector(".x6-graph-svg-viewport")?.setAttribute("transform", `matrix(1,0,0,1,${-re + c},${-N + c})`), R.appendChild(F), document.body.appendChild(R);
1383
1396
  try {
1384
1397
  return await M(), await y(F, {
1385
1398
  width: _,
@@ -1402,32 +1415,32 @@ function to({
1402
1415
  }
1403
1416
  },
1404
1417
  highlightNodes(d) {
1405
- u = d, v?.(u, w);
1418
+ u = d, h?.(u, w);
1406
1419
  },
1407
1420
  highlightEdges(d) {
1408
- w = d, v?.(u, w);
1421
+ w = d, h?.(u, w);
1409
1422
  },
1410
1423
  clearHighlight() {
1411
- u = [], w = [], v?.([], []);
1424
+ u = [], w = [], h?.([], []);
1412
1425
  },
1413
1426
  overlay: e,
1414
1427
  getContextMenuItems(d) {
1415
1428
  return a?.(d) ?? [];
1416
1429
  },
1417
1430
  insertNodeToRight(d, y, c) {
1418
- const g = s.value, h = g.nodes[d];
1419
- if (!h)
1431
+ const g = n.value, v = g.nodes[d];
1432
+ if (!v)
1420
1433
  return {
1421
1434
  status: "invalid",
1422
1435
  envelope: { id: "", source: "user:toolbar", timestamp: Date.now(), commands: [] },
1423
1436
  error: { code: "constraint_violated", reason: `Source node "${d}" not found`, source: "api" }
1424
1437
  };
1425
- const m = c?.gap ?? l ?? eo, E = c?.direction ?? "right", L = t.nodeTypes[h.type], z = t.nodeTypes[y.type], ie = L?.getSize(h) ?? { width: 154, height: 54 }, N = z?.getSize({ ...y, position: { x: 0, y: 0 } }) ?? {
1438
+ const m = c?.gap ?? l ?? eo, E = c?.direction ?? "right", L = t.nodeTypes[v.type], z = t.nodeTypes[y.type], re = L?.getSize(v) ?? { width: 154, height: 54 }, N = z?.getSize({ ...y, position: { x: 0, y: 0 } }) ?? {
1426
1439
  width: 154,
1427
1440
  height: 54
1428
- }, _ = X(E, h, ie, N, m), x = y.id || p("node"), R = { ...y, id: x, position: _ }, F = [{ type: "node.add", node: R }];
1441
+ }, _ = X(E, v, re, N, m), x = y.id || p("node"), R = { ...y, id: x, position: _ }, F = [{ type: "node.add", node: R }];
1429
1442
  if (c?.autoWireEdges) {
1430
- const ae = j(h), Q = j(R), K = E, me = U(E), pe = ae.find((I) => I.group === K), we = Q.find((I) => I.group === me), $e = Q.find((I) => I.group === K), Se = pe ? Object.values(g.edges).find(
1443
+ const ae = j(v), Q = j(R), K = E, me = U(E), pe = ae.find((I) => I.group === K), we = Q.find((I) => I.group === me), $e = Q.find((I) => I.group === K), Se = pe ? Object.values(g.edges).find(
1431
1444
  (I) => I.source.nodeId === d && I.source.portId === pe.id
1432
1445
  ) : Object.values(g.edges).find((I) => I.source.nodeId === d);
1433
1446
  if (Se) {
@@ -1485,108 +1498,108 @@ function to({
1485
1498
  return o(Z);
1486
1499
  },
1487
1500
  onGraphEvent(d, y) {
1488
- return n.on(d, y), () => n.off(d, y);
1501
+ return s.on(d, y), () => s.off(d, y);
1489
1502
  },
1490
1503
  unsafeGetGraph() {
1491
- return n;
1504
+ return s;
1492
1505
  }
1493
1506
  };
1494
1507
  return G;
1495
1508
  }
1496
1509
  function oo() {
1497
- const n = H(null), e = H(!1);
1510
+ const s = H(null), e = H(!1);
1498
1511
  let o = null, t = !1;
1499
- function s(p) {
1500
- o && (clearTimeout(o), o = null), n.value = p;
1512
+ function n(p) {
1513
+ o && (clearTimeout(o), o = null), s.value = p;
1501
1514
  }
1502
- function r(p = 100) {
1515
+ function i(p = 100) {
1503
1516
  t || (o && clearTimeout(o), o = setTimeout(() => {
1504
- n.value = null, o = null;
1517
+ s.value = null, o = null;
1505
1518
  }, p));
1506
1519
  }
1507
- function i() {
1520
+ function r() {
1508
1521
  t = !0, o && (clearTimeout(o), o = null);
1509
1522
  }
1510
1523
  function l(p = 100) {
1511
- t = !1, r(p);
1524
+ t = !1, i(p);
1512
1525
  }
1513
1526
  function a() {
1514
1527
  o && (clearTimeout(o), o = null);
1515
1528
  }
1516
- function v() {
1517
- a(), t = !1, n.value = null;
1529
+ function h() {
1530
+ a(), t = !1, s.value = null;
1518
1531
  }
1519
1532
  function f() {
1520
1533
  o && clearTimeout(o);
1521
1534
  }
1522
- return { hoveredNodeId: n, isDraggingNode: e, enter: s, leave: r, enterOverlay: i, leaveOverlay: l, cancelLeave: a, reset: v, cleanup: f };
1535
+ return { hoveredNodeId: s, isDraggingNode: e, enter: n, leave: i, enterOverlay: r, leaveOverlay: l, cancelLeave: a, reset: h, cleanup: f };
1523
1536
  }
1524
1537
  const Xe = 10, Ae = 12;
1525
- function Ke(n, e) {
1526
- const o = n.getTotalLength();
1538
+ function Ke(s, e) {
1539
+ const o = s.getTotalLength();
1527
1540
  if (o === 0) return { ...e, length: 0, totalLength: 0 };
1528
- let t = n.getPointAtLength(0), s = 1 / 0;
1529
- const r = 50, i = o / r;
1541
+ let t = s.getPointAtLength(0), n = 1 / 0;
1542
+ const i = 50, r = o / i;
1530
1543
  let l = 0;
1531
- for (let p = 0; p <= r; p++) {
1532
- const u = p * i, w = n.getPointAtLength(u), D = (w.x - e.x) ** 2 + (w.y - e.y) ** 2;
1533
- D < s && (s = D, t = w, l = u);
1544
+ for (let p = 0; p <= i; p++) {
1545
+ const u = p * r, w = s.getPointAtLength(u), D = (w.x - e.x) ** 2 + (w.y - e.y) ** 2;
1546
+ D < n && (n = D, t = w, l = u);
1534
1547
  }
1535
- const a = Math.max(0, l - i), v = Math.min(o, l + i), f = (v - a) / 20;
1536
- for (let p = a; p <= v; p += f) {
1537
- const u = n.getPointAtLength(p), w = (u.x - e.x) ** 2 + (u.y - e.y) ** 2;
1538
- w < s && (s = w, t = u, l = p);
1548
+ const a = Math.max(0, l - r), h = Math.min(o, l + r), f = (h - a) / 20;
1549
+ for (let p = a; p <= h; p += f) {
1550
+ const u = s.getPointAtLength(p), w = (u.x - e.x) ** 2 + (u.y - e.y) ** 2;
1551
+ w < n && (n = w, t = u, l = p);
1539
1552
  }
1540
1553
  return { x: t.x, y: t.y, length: l, totalLength: o };
1541
1554
  }
1542
- function Ye(n, e) {
1543
- return n < Xe || n > e - Xe;
1555
+ function Ye(s, e) {
1556
+ return s < Xe || s > e - Xe;
1544
1557
  }
1545
- function Ze(n, e, o) {
1546
- const t = n.querySelectorAll(".x6-edge-label");
1547
- for (const s of t) {
1548
- const r = s.getBoundingClientRect();
1549
- if (e >= r.left - Ae && e <= r.right + Ae && o >= r.top - Ae && o <= r.bottom + Ae)
1558
+ function Ze(s, e, o) {
1559
+ const t = s.querySelectorAll(".x6-edge-label");
1560
+ for (const n of t) {
1561
+ const i = n.getBoundingClientRect();
1562
+ if (e >= i.left - Ae && e <= i.right + Ae && o >= i.top - Ae && o <= i.bottom + Ae)
1550
1563
  return !0;
1551
1564
  }
1552
1565
  return !1;
1553
1566
  }
1554
1567
  function Qe() {
1555
- const n = "http://www.w3.org/2000/svg", e = document.createElementNS(n, "g");
1568
+ const s = "http://www.w3.org/2000/svg", e = document.createElementNS(s, "g");
1556
1569
  e.setAttribute("class", "flow-canvas-edge-delete-tool"), e.style.cursor = "pointer";
1557
- const o = document.createElementNS(n, "rect");
1570
+ const o = document.createElementNS(s, "rect");
1558
1571
  o.setAttribute("width", "20"), o.setAttribute("height", "20"), o.setAttribute("x", "-10"), o.setAttribute("y", "-10"), o.setAttribute("rx", "4"), o.setAttribute("ry", "4"), o.setAttribute("fill", "#3a84ff"), e.appendChild(o);
1559
- const t = document.createElementNS(n, "text");
1572
+ const t = document.createElementNS(s, "text");
1560
1573
  return t.setAttribute("font-family", "flow-canvas"), t.setAttribute("font-size", "16"), t.setAttribute("fill", "#ffffff"), t.setAttribute("text-anchor", "middle"), t.setAttribute("dominant-baseline", "central"), t.textContent = "", e.appendChild(t), e;
1561
1574
  }
1562
- function no(n) {
1575
+ function no(s) {
1563
1576
  let e = null, o = null;
1564
1577
  function t(l, a) {
1565
- if (r(), o = l, a.target?.closest?.(".x6-edge-label")) return;
1566
- const f = n.getCellById(l);
1578
+ if (i(), o = l, a.target?.closest?.(".x6-edge-label")) return;
1579
+ const f = s.getCellById(l);
1567
1580
  if (!f?.isEdge()) return;
1568
- const p = n.findViewByCell(f);
1581
+ const p = s.findViewByCell(f);
1569
1582
  if (!p) return;
1570
1583
  const u = p.container.querySelector("path");
1571
1584
  if (!u) return;
1572
- const w = n.clientToLocal(a.clientX, a.clientY), D = Ke(u, w);
1585
+ const w = s.clientToLocal(a.clientX, a.clientY), D = Ke(u, w);
1573
1586
  if (Ye(D.length, D.totalLength) || Ze(p.container, a.clientX, a.clientY)) return;
1574
1587
  const O = Qe();
1575
1588
  O.setAttribute("transform", `translate(${D.x}, ${D.y})`), p.container.appendChild(O), e = O;
1576
1589
  }
1577
- function s(l) {
1590
+ function n(l) {
1578
1591
  if (!o) return;
1579
1592
  if (l.target?.closest?.(".x6-edge-label")) {
1580
1593
  e && e.setAttribute("display", "none");
1581
1594
  return;
1582
1595
  }
1583
- const v = n.getCellById(o);
1584
- if (!v?.isEdge()) return;
1585
- const f = n.findViewByCell(v);
1596
+ const h = s.getCellById(o);
1597
+ if (!h?.isEdge()) return;
1598
+ const f = s.findViewByCell(h);
1586
1599
  if (!f) return;
1587
1600
  const p = f.container.querySelector("path");
1588
1601
  if (!p) return;
1589
- const u = n.clientToLocal(l.clientX, l.clientY), w = Ke(p, u);
1602
+ const u = s.clientToLocal(l.clientX, l.clientY), w = Ke(p, u);
1590
1603
  if (Ye(w.length, w.totalLength) || Ze(f.container, l.clientX, l.clientY))
1591
1604
  e && e.setAttribute("display", "none");
1592
1605
  else if (e)
@@ -1596,36 +1609,36 @@ function no(n) {
1596
1609
  D.setAttribute("transform", `translate(${w.x}, ${w.y})`), f.container.appendChild(D), e = D;
1597
1610
  }
1598
1611
  }
1599
- function r() {
1612
+ function i() {
1600
1613
  e && (e.remove(), e = null), o = null;
1601
1614
  }
1602
- function i(l) {
1615
+ function r(l) {
1603
1616
  l === o && (e = null, o = null);
1604
1617
  }
1605
- return { show: t, move: s, remove: r, handleEdgeRemoved: i };
1618
+ return { show: t, move: n, remove: i, handleEdgeRemoved: r };
1606
1619
  }
1607
- function so(n) {
1620
+ function so(s) {
1608
1621
  let e = null, o = 0;
1609
1622
  function t(f) {
1610
1623
  const p = f ? "visible" : "hidden";
1611
- for (const u of n.getNodes())
1624
+ for (const u of s.getNodes())
1612
1625
  for (const w of u.getPorts())
1613
1626
  u.setPortProp(w.id, "attrs/circle/visibility", p);
1614
1627
  }
1615
- function s(f) {
1628
+ function n(f) {
1616
1629
  if (!e)
1617
1630
  for (const p of f.getPorts())
1618
1631
  f.setPortProp(p.id, "attrs/circle/visibility", "visible");
1619
1632
  }
1620
- function r(f) {
1633
+ function i(f) {
1621
1634
  if (!e)
1622
1635
  for (const p of f.getPorts())
1623
1636
  f.setPortProp(p.id, "attrs/circle/visibility", "hidden");
1624
1637
  }
1625
- function i(f, p) {
1638
+ function r(f, p) {
1626
1639
  if (!f.getTargetCell())
1627
1640
  if (e = f.id, p?.size)
1628
- for (const u of n.getNodes()) {
1641
+ for (const u of s.getNodes()) {
1629
1642
  const w = p.has(u.id) ? "hidden" : "visible";
1630
1643
  for (const D of u.getPorts())
1631
1644
  u.setPortProp(D.id, "attrs/circle/visibility", w);
@@ -1639,30 +1652,30 @@ function so(n) {
1639
1652
  function a(f) {
1640
1653
  f === e && (e = null, t(!1));
1641
1654
  }
1642
- function v() {
1655
+ function h() {
1643
1656
  return !e && Date.now() >= o;
1644
1657
  }
1645
1658
  return {
1646
- showNodePorts: s,
1647
- hideNodePorts: r,
1648
- handleEdgeAdded: i,
1659
+ showNodePorts: n,
1660
+ hideNodePorts: i,
1661
+ handleEdgeAdded: r,
1649
1662
  handleEdgeConnected: l,
1650
1663
  handleEdgeRemoved: a,
1651
- canShowEdgeTool: v
1664
+ canShowEdgeTool: h
1652
1665
  };
1653
1666
  }
1654
- function Je(n) {
1655
- return n === "top" || n === "right" || n === "bottom" || n === "left";
1667
+ function Je(s) {
1668
+ return s === "top" || s === "right" || s === "bottom" || s === "left";
1656
1669
  }
1657
- function ro(n) {
1658
- const { editor: e, nodeHover: o, isSelectionModeActive: t, viewportVersion: s, getNodeBehavior: r, getInsertGap: i } = n, { isDraggingNode: l } = n, a = H(null), v = H(!1);
1670
+ function io(s) {
1671
+ const { editor: e, nodeHover: o, isSelectionModeActive: t, viewportVersion: n, getNodeBehavior: i, getInsertGap: r } = s, { isDraggingNode: l } = s, a = H(null), h = H(!1);
1659
1672
  let f = null, p = null, u = null;
1660
1673
  const w = V(() => ({
1661
1674
  enabled: !0,
1662
1675
  portGroup: "right",
1663
1676
  autoPanOnOpen: !0,
1664
1677
  autoPanPadding: 16,
1665
- ...n.quickAddProp.value
1678
+ ...s.quickAddProp.value
1666
1679
  }));
1667
1680
  function D() {
1668
1681
  f && (clearTimeout(f), f = null);
@@ -1673,7 +1686,7 @@ function ro(n) {
1673
1686
  }, 150);
1674
1687
  }
1675
1688
  function b(N) {
1676
- return v.value ? !0 : (D(), d(N) ? (a.value = N, !0) : (a.value = null, !1));
1689
+ return h.value ? !0 : (D(), d(N) ? (a.value = N, !0) : (a.value = null, !1));
1677
1690
  }
1678
1691
  function S() {
1679
1692
  D(), o.enterOverlay();
@@ -1740,27 +1753,27 @@ function ro(n) {
1740
1753
  function d(N) {
1741
1754
  if (!w.value.enabled || e.mode.value !== "edit") return !1;
1742
1755
  const x = e.flowModel.value.nodes[N];
1743
- return !x || r(x).quickAddEnabled === !1 ? !1 : !!U(x);
1756
+ return !x || i(x).quickAddEnabled === !1 ? !1 : !!U(x);
1744
1757
  }
1745
1758
  const y = V(() => {
1746
- if (s.value, !w.value.enabled) return null;
1759
+ if (n.value, !w.value.enabled) return null;
1747
1760
  const N = a.value;
1748
1761
  if (!N || l.value || !e.api.value || e.mode.value !== "edit" || t.value)
1749
1762
  return null;
1750
1763
  const x = e.flowModel.value.nodes[N];
1751
1764
  if (!x) return null;
1752
- const R = r(x);
1765
+ const R = i(x);
1753
1766
  if (R.quickAddEnabled === !1) return null;
1754
1767
  const F = U(x);
1755
1768
  return F ? { node: x, ...F, behavior: R } : null;
1756
1769
  });
1757
1770
  function c(N) {
1758
- v.value = !0, y.value && e._emitUiEvent({ type: "node.quick-add", nodeId: N, position: y.value.portPosition });
1771
+ h.value = !0, y.value && e._emitUiEvent({ type: "node.quick-add", nodeId: N, position: y.value.portPosition });
1759
1772
  }
1760
1773
  function g() {
1761
- v.value = !1;
1774
+ h.value = !1;
1762
1775
  }
1763
- function h(N) {
1776
+ function v(N) {
1764
1777
  const _ = e.api.value;
1765
1778
  if (!_) return;
1766
1779
  const x = e.flowModel.value.nodes[N];
@@ -1781,10 +1794,10 @@ function ro(n) {
1781
1794
  x.insertNodeToRight(N, F, {
1782
1795
  autoWireEdges: !0,
1783
1796
  direction: G(Z),
1784
- gap: i(),
1797
+ gap: r(),
1785
1798
  source: "user:quick-add",
1786
1799
  label: "快捷插入节点"
1787
- }).status === "applied" && e._emitUiEvent({ type: "node.action.quick-insert", sourceNodeId: N, newNodeId: R }), n.closePopover();
1800
+ }).status === "applied" && e._emitUiEvent({ type: "node.action.quick-insert", sourceNodeId: N, newNodeId: R }), s.closePopover();
1788
1801
  }
1789
1802
  function L(N) {
1790
1803
  if (!p) return;
@@ -1794,7 +1807,7 @@ function ro(n) {
1794
1807
  if (!R) return;
1795
1808
  const F = U(R);
1796
1809
  let Z = !0;
1797
- r(R).hidePortForQuickAdd === !1 && (Z = !1);
1810
+ i(R).hidePortForQuickAdd === !1 && (Z = !1);
1798
1811
  const Q = Z && !l.value && !!F && d(N);
1799
1812
  for (const K of x.getPorts()) {
1800
1813
  const me = Q && K.id === F?.portId ? "hidden" : "visible";
@@ -1815,14 +1828,14 @@ function ro(n) {
1815
1828
  );
1816
1829
  }
1817
1830
  ge(y, (N) => {
1818
- N || (v.value = !1);
1831
+ N || (h.value = !1);
1819
1832
  });
1820
- function ie() {
1833
+ function re() {
1821
1834
  f && clearTimeout(f), u?.(), u = null, p = null;
1822
1835
  }
1823
1836
  return {
1824
1837
  quickAddNodeId: a,
1825
- quickAddPopoverOpen: v,
1838
+ quickAddPopoverOpen: h,
1826
1839
  mergedConfig: w,
1827
1840
  data: y,
1828
1841
  enter: b,
@@ -1832,58 +1845,58 @@ function ro(n) {
1832
1845
  handleOverlayLeave: M,
1833
1846
  handleOpen: c,
1834
1847
  handleClose: g,
1835
- handleStartDrag: h,
1848
+ handleStartDrag: v,
1836
1849
  handlePopoverViewportOverflow: m,
1837
1850
  handleInsert: E,
1838
1851
  isActiveForNode: d,
1839
1852
  syncNodePorts: L,
1840
1853
  attachRuntime: z,
1841
- cleanup: ie
1854
+ cleanup: re
1842
1855
  };
1843
1856
  }
1844
- const io = 15, ao = 10;
1845
- function lo(n) {
1846
- const { editor: e } = n;
1847
- let o = null, t = null, s = null, r = null;
1848
- const i = [];
1857
+ const ro = 15, ao = 10;
1858
+ function lo(s) {
1859
+ const { editor: e } = s;
1860
+ let o = null, t = null, n = null, i = null;
1861
+ const r = [];
1849
1862
  let l = null;
1850
1863
  const a = V(() => ({
1851
1864
  enabled: !1,
1852
- bufferMargin: io,
1865
+ bufferMargin: ro,
1853
1866
  incomingPortGroup: "left",
1854
1867
  outgoingPortGroup: "right",
1855
- ...n.edgeDropProp.value
1868
+ ...s.edgeDropProp.value
1856
1869
  }));
1857
- function v(d) {
1870
+ function h(d) {
1858
1871
  if (!o) return null;
1859
1872
  const y = o.getCellById(d);
1860
1873
  if (!y?.isEdge()) return null;
1861
1874
  const c = o.findViewByCell(y)?.container;
1862
1875
  if (!c) return null;
1863
1876
  const g = c.querySelectorAll("path");
1864
- for (const h of g)
1865
- if (h.getAttribute("stroke") !== "transparent") return h;
1877
+ for (const v of g)
1878
+ if (v.getAttribute("stroke") !== "transparent") return v;
1866
1879
  return null;
1867
1880
  }
1868
1881
  function f(d) {
1869
- const y = v(d);
1870
- y && (y.style.stroke = "#3a84ff", r = d);
1882
+ const y = h(d);
1883
+ y && (y.style.stroke = "#3a84ff", i = d);
1871
1884
  }
1872
1885
  function p() {
1873
- if (!r) return;
1874
- const d = v(r);
1875
- d && (d.style.stroke = ""), r = null;
1886
+ if (!i) return;
1887
+ const d = h(i);
1888
+ d && (d.style.stroke = ""), i = null;
1876
1889
  }
1877
1890
  function u(d, y, c) {
1878
1891
  if (o) {
1879
1892
  const g = o.getCellById(d);
1880
1893
  if (g?.isNode()) {
1881
- const h = g.getPorts().find((m) => m.group === c);
1882
- if (h?.id) return h.id;
1894
+ const v = g.getPorts().find((m) => m.group === c);
1895
+ if (v?.id) return v.id;
1883
1896
  }
1884
1897
  }
1885
1898
  if (y.ports?.length) {
1886
- const g = y.ports.find((h) => h.group === c);
1899
+ const g = y.ports.find((v) => v.group === c);
1887
1900
  if (g) return g.id;
1888
1901
  }
1889
1902
  return c;
@@ -1892,8 +1905,8 @@ function lo(n) {
1892
1905
  const y = d.getTotalLength();
1893
1906
  if (y === 0) return [];
1894
1907
  const c = [];
1895
- for (let h = 0; h <= y; h += ao) {
1896
- const m = d.getPointAtLength(h);
1908
+ for (let v = 0; v <= y; v += ao) {
1909
+ const m = d.getPointAtLength(v);
1897
1910
  c.push({ x: m.x, y: m.y });
1898
1911
  }
1899
1912
  const g = d.getPointAtLength(y);
@@ -1901,16 +1914,16 @@ function lo(n) {
1901
1914
  }
1902
1915
  function D(d, y, c) {
1903
1916
  if (!o) return null;
1904
- const g = a.value, h = g.bufferMargin, m = {
1905
- x: d.x + h,
1906
- y: d.y + h,
1907
- width: Math.max(0, d.width - h * 2),
1908
- height: Math.max(0, d.height - h * 2)
1917
+ const g = a.value, v = g.bufferMargin, m = {
1918
+ x: d.x + v,
1919
+ y: d.y + v,
1920
+ width: Math.max(0, d.width - v * 2),
1921
+ height: Math.max(0, d.height - v * 2)
1909
1922
  };
1910
1923
  if (m.width <= 0 || m.height <= 0) return null;
1911
1924
  const E = m.x + m.width, L = m.y + m.height;
1912
1925
  let z = null;
1913
- const ie = d.x + d.width / 2, N = d.y + d.height / 2;
1926
+ const re = d.x + d.width / 2, N = d.y + d.height / 2;
1914
1927
  for (const _ of o.getEdges()) {
1915
1928
  const x = y.edges[_.id];
1916
1929
  if (!x || c && (x.source.nodeId === c || x.target.nodeId === c) || g.isEdgeDropTarget && !g.isEdgeDropTarget(x, y)) continue;
@@ -1923,7 +1936,7 @@ function lo(n) {
1923
1936
  let ae = !1, Q = 1 / 0;
1924
1937
  for (const K of Z)
1925
1938
  if (K.x >= m.x && K.x <= E && K.y >= m.y && K.y <= L) {
1926
- const me = K.x - ie, pe = K.y - N, we = me * me + pe * pe;
1939
+ const me = K.x - re, pe = K.y - N, we = me * me + pe * pe;
1927
1940
  we < Q && (Q = we), ae = !0;
1928
1941
  }
1929
1942
  ae && (!z || Q < z.distSq) && (z = { edgeId: _.id, edge: x, distSq: Q });
@@ -1932,8 +1945,8 @@ function lo(n) {
1932
1945
  }
1933
1946
  function O(d, y) {
1934
1947
  if (!a.value.enabled) return;
1935
- const g = e.flowModel.value, h = D(d, g, y);
1936
- h ? t !== h.edgeId && (p(), t = h.edgeId, f(h.edgeId)) : t && (p(), t = null);
1948
+ const g = e.flowModel.value, v = D(d, g, y);
1949
+ v ? t !== v.edgeId && (p(), t = v.edgeId, f(v.edgeId)) : t && (p(), t = null);
1937
1950
  }
1938
1951
  let b = !0;
1939
1952
  function S({ node: d }) {
@@ -1947,14 +1960,14 @@ function lo(n) {
1947
1960
  b = !g.isNodeInsertable || g.isNodeInsertable(c, y);
1948
1961
  }
1949
1962
  function M({ node: d }) {
1950
- !a.value.enabled || !b || s === null && (s = requestAnimationFrame(() => {
1951
- if (s = null, !o) return;
1963
+ !a.value.enabled || !b || n === null && (n = requestAnimationFrame(() => {
1964
+ if (n = null, !o) return;
1952
1965
  const y = d.getPosition(), c = d.getSize();
1953
1966
  O({ x: y.x, y: y.y, width: c.width, height: c.height }, d.id);
1954
1967
  }));
1955
1968
  }
1956
1969
  function B() {
1957
- s !== null && (cancelAnimationFrame(s), s = null), p(), b = !0;
1970
+ n !== null && (cancelAnimationFrame(n), n = null), p(), b = !0;
1958
1971
  }
1959
1972
  function j() {
1960
1973
  if (!o) return;
@@ -1966,22 +1979,22 @@ function lo(n) {
1966
1979
  d && (d = !1, p(), t = null);
1967
1980
  return;
1968
1981
  }
1969
- d = !0, s === null && (s = requestAnimationFrame(() => {
1970
- if (s = null, !o) return;
1971
- const c = y.getBoundingClientRect(), g = o.clientToLocal(c.left, c.top), h = o.clientToLocal(c.right, c.bottom), m = {
1982
+ d = !0, n === null && (n = requestAnimationFrame(() => {
1983
+ if (n = null, !o) return;
1984
+ const c = y.getBoundingClientRect(), g = o.clientToLocal(c.left, c.top), v = o.clientToLocal(c.right, c.bottom), m = {
1972
1985
  x: g.x,
1973
1986
  y: g.y,
1974
- width: h.x - g.x,
1975
- height: h.y - g.y
1987
+ width: v.x - g.x,
1988
+ height: v.y - g.y
1976
1989
  };
1977
1990
  O(m);
1978
1991
  }));
1979
- }, document.addEventListener("mousemove", l), i.push(() => {
1992
+ }, document.addEventListener("mousemove", l), r.push(() => {
1980
1993
  l && (document.removeEventListener("mousemove", l), l = null);
1981
1994
  });
1982
1995
  }
1983
1996
  function k() {
1984
- p(), t = null, s !== null && (cancelAnimationFrame(s), s = null);
1997
+ p(), t = null, n !== null && (cancelAnimationFrame(n), n = null);
1985
1998
  }
1986
1999
  function X(d) {
1987
2000
  if (!t || d.source !== "user:drag") return d;
@@ -1989,14 +2002,14 @@ function lo(n) {
1989
2002
  t = null, p();
1990
2003
  const c = e.flowModel.value, g = c.edges[y];
1991
2004
  if (!g) return d;
1992
- const h = d.commands.find((R) => R.type === "node.add" || R.type === "node.move");
1993
- if (!h) return d;
1994
- const m = h.type === "node.add" ? h.node.id : h.nodeId, E = h.type === "node.add" ? h.node : c.nodes[h.nodeId];
2005
+ const v = d.commands.find((R) => R.type === "node.add" || R.type === "node.move");
2006
+ if (!v) return d;
2007
+ const m = v.type === "node.add" ? v.node.id : v.nodeId, E = v.type === "node.add" ? v.node : c.nodes[v.nodeId];
1995
2008
  if (!E) return d;
1996
2009
  const L = a.value;
1997
2010
  if (L.isNodeInsertable && !L.isNodeInsertable(E, c))
1998
2011
  return d;
1999
- const z = u(m, E, L.incomingPortGroup), ie = u(m, E, L.outgoingPortGroup), N = e.idGenerator("edge"), _ = e.idGenerator("edge"), x = [
2012
+ const z = u(m, E, L.incomingPortGroup), re = u(m, E, L.outgoingPortGroup), N = e.idGenerator("edge"), _ = e.idGenerator("edge"), x = [
2000
2013
  { type: "edge.remove", edgeId: y },
2001
2014
  {
2002
2015
  type: "edge.add",
@@ -2012,7 +2025,7 @@ function lo(n) {
2012
2025
  edge: {
2013
2026
  id: _,
2014
2027
  type: g.type,
2015
- source: { nodeId: m, portId: ie },
2028
+ source: { nodeId: m, portId: re },
2016
2029
  target: { nodeId: g.target.nodeId, portId: g.target.portId }
2017
2030
  }
2018
2031
  }
@@ -2026,14 +2039,14 @@ function lo(n) {
2026
2039
  function U(d) {
2027
2040
  o = d;
2028
2041
  const y = (c, g) => {
2029
- d.on(c, g), i.push(() => d.off(c, g));
2042
+ d.on(c, g), r.push(() => d.off(c, g));
2030
2043
  };
2031
2044
  y("node:move", S), y("node:change:position", M), y("node:moved", B), j();
2032
2045
  }
2033
2046
  function G() {
2034
2047
  k();
2035
- for (const d of i) d();
2036
- i.length = 0, o = null, b = !0;
2048
+ for (const d of r) d();
2049
+ r.length = 0, o = null, b = !0;
2037
2050
  }
2038
2051
  return {
2039
2052
  attachRuntime: U,
@@ -2041,34 +2054,34 @@ function lo(n) {
2041
2054
  cleanup: G
2042
2055
  };
2043
2056
  }
2044
- function co(n) {
2045
- function e(s) {
2057
+ function co(s) {
2058
+ function e(n) {
2046
2059
  return {
2047
- id: n.idGenerator("node"),
2048
- type: s.type,
2049
- label: s.label,
2050
- ports: s.ports ? JSON.parse(JSON.stringify(s.ports)) : void 0,
2051
- payload: s.payload ? JSON.parse(JSON.stringify(s.payload)) : void 0,
2052
- extensions: s.extensions ? JSON.parse(JSON.stringify(s.extensions)) : void 0
2060
+ id: s.idGenerator("node"),
2061
+ type: n.type,
2062
+ label: n.label,
2063
+ ports: n.ports ? JSON.parse(JSON.stringify(n.ports)) : void 0,
2064
+ payload: n.payload ? JSON.parse(JSON.stringify(n.payload)) : void 0,
2065
+ extensions: n.extensions ? JSON.parse(JSON.stringify(n.extensions)) : void 0
2053
2066
  };
2054
2067
  }
2055
- function o(s, r, i) {
2056
- const l = n.api.value;
2057
- switch (s) {
2068
+ function o(n, i, r) {
2069
+ const l = s.api.value;
2070
+ switch (n) {
2058
2071
  case "delete":
2059
- return n.executeCommand({
2072
+ return s.executeCommand({
2060
2073
  id: J(),
2061
2074
  source: "user:toolbar",
2062
2075
  label: "删除节点",
2063
2076
  timestamp: Date.now(),
2064
- commands: [{ type: "node.remove", nodeId: r }]
2065
- }), n._emitUiEvent({ type: "node.action.delete", nodeId: r }), !0;
2077
+ commands: [{ type: "node.remove", nodeId: i }]
2078
+ }), s._emitUiEvent({ type: "node.action.delete", nodeId: i }), !0;
2066
2079
  case "copy": {
2067
2080
  if (!l) break;
2068
- const a = n.flowModel.value.nodes[r];
2081
+ const a = s.flowModel.value.nodes[i];
2069
2082
  if (!a) break;
2070
- const v = e(a), f = 50;
2071
- n.executeCommand({
2083
+ const h = e(a), f = 50;
2084
+ s.executeCommand({
2072
2085
  id: J(),
2073
2086
  source: "user:toolbar",
2074
2087
  label: "复制节点",
@@ -2077,7 +2090,7 @@ function co(n) {
2077
2090
  {
2078
2091
  type: "node.add",
2079
2092
  node: {
2080
- ...v,
2093
+ ...h,
2081
2094
  position: {
2082
2095
  x: a.position.x + f,
2083
2096
  y: a.position.y + f
@@ -2085,46 +2098,46 @@ function co(n) {
2085
2098
  }
2086
2099
  }
2087
2100
  ]
2088
- }), l.selectNodes([v.id]), n._emitUiEvent({ type: "node.action.copy", sourceNodeId: r, newNodeId: v.id });
2101
+ }), l.selectNodes([h.id]), s._emitUiEvent({ type: "node.action.copy", sourceNodeId: i, newNodeId: h.id });
2089
2102
  break;
2090
2103
  }
2091
2104
  case "copy-insert": {
2092
2105
  if (!l) break;
2093
- const a = n.flowModel.value.nodes[r];
2106
+ const a = s.flowModel.value.nodes[i];
2094
2107
  if (!a) break;
2095
- const v = e(a);
2096
- l.insertNodeToRight(r, v, {
2108
+ const h = e(a);
2109
+ l.insertNodeToRight(i, h, {
2097
2110
  autoWireEdges: !0,
2098
- gap: i,
2111
+ gap: r,
2099
2112
  label: "复制并插入节点"
2100
- }), l.selectNodes([v.id]), n._emitUiEvent({ type: "node.action.copy-insert", sourceNodeId: r, newNodeId: v.id });
2113
+ }), l.selectNodes([h.id]), s._emitUiEvent({ type: "node.action.copy-insert", sourceNodeId: i, newNodeId: h.id });
2101
2114
  break;
2102
2115
  }
2103
2116
  case "disconnect": {
2104
- const a = n.flowModel.value, v = Object.entries(a.edges).filter(([, f]) => {
2117
+ const a = s.flowModel.value, h = Object.entries(a.edges).filter(([, f]) => {
2105
2118
  const p = f;
2106
- return p.source.nodeId === r || p.target.nodeId === r;
2119
+ return p.source.nodeId === i || p.target.nodeId === i;
2107
2120
  }).map(([f]) => f);
2108
- if (v.length === 0) break;
2109
- n.executeCommand({
2121
+ if (h.length === 0) break;
2122
+ s.executeCommand({
2110
2123
  id: J(),
2111
2124
  source: "user:toolbar",
2112
2125
  label: "断开连线",
2113
2126
  timestamp: Date.now(),
2114
- commands: v.map((f) => ({ type: "edge.remove", edgeId: f }))
2115
- }), n._emitUiEvent({ type: "node.action.disconnect", nodeId: r, edgeIds: v });
2127
+ commands: h.map((f) => ({ type: "edge.remove", edgeId: f }))
2128
+ }), s._emitUiEvent({ type: "node.action.disconnect", nodeId: i, edgeIds: h });
2116
2129
  break;
2117
2130
  }
2118
2131
  case "debug": {
2119
- n._emitUiEvent({ type: "node.action.debug", nodeId: r });
2132
+ s._emitUiEvent({ type: "node.action.debug", nodeId: i });
2120
2133
  break;
2121
2134
  }
2122
2135
  }
2123
2136
  return !1;
2124
2137
  }
2125
- function t(s) {
2126
- n.api.value?.deleteSelection({
2127
- selection: s,
2138
+ function t(n) {
2139
+ s.api.value?.deleteSelection({
2140
+ selection: n,
2128
2141
  source: "user:toolbar",
2129
2142
  label: "批量删除选中"
2130
2143
  });
@@ -2152,8 +2165,8 @@ function uo() {
2152
2165
  ]
2153
2166
  };
2154
2167
  }
2155
- function fo(n, e) {
2156
- const o = e.defaultEdgeType ?? "default", t = e.edgeTypes?.[o], s = {
2168
+ function fo(s, e) {
2169
+ const o = e.defaultEdgeType ?? "default", t = e.edgeTypes?.[o], n = {
2157
2170
  zIndex: -1,
2158
2171
  attrs: {
2159
2172
  line: {
@@ -2163,36 +2176,36 @@ function fo(n, e) {
2163
2176
  }
2164
2177
  }
2165
2178
  };
2166
- t?.router && (s.router = typeof t.router == "string" ? { name: t.router } : t.router), t?.connector && (s.connector = typeof t.connector == "string" ? { name: t.connector } : t.connector), t?.x6EdgeConfig && Object.assign(s, t.x6EdgeConfig);
2167
- const r = s.attrs ?? {}, i = r.line ?? {};
2168
- return s.attrs = {
2169
- ...r,
2179
+ t?.router && (n.router = typeof t.router == "string" ? { name: t.router } : t.router), t?.connector && (n.connector = typeof t.connector == "string" ? { name: t.connector } : t.connector), t?.x6EdgeConfig && Object.assign(n, t.x6EdgeConfig);
2180
+ const i = n.attrs ?? {}, r = i.line ?? {};
2181
+ return n.attrs = {
2182
+ ...i,
2170
2183
  line: {
2171
- ...i,
2184
+ ...r,
2172
2185
  targetMarker: uo()
2173
2186
  }
2174
- }, n.createEdge(s);
2187
+ }, s.createEdge(n);
2175
2188
  }
2176
2189
  const go = ".x6-widget-selection", po = ".x6-graph-svg";
2177
- function ho(n) {
2178
- const e = n.querySelector(go), o = n.querySelector(po);
2190
+ function ho(s) {
2191
+ const e = s.querySelector(go), o = s.querySelector(po);
2179
2192
  return !e || !o || e.parentNode !== o.parentNode || !o.parentNode || o.previousSibling === e ? !1 : (o.parentNode.insertBefore(e, o), !0);
2180
2193
  }
2181
- function vo(n) {
2182
- const e = () => ho(n);
2194
+ function vo(s) {
2195
+ const e = () => ho(s);
2183
2196
  e();
2184
2197
  const o = new MutationObserver(() => {
2185
2198
  e();
2186
2199
  });
2187
- return o.observe(n, { childList: !0 }), () => o.disconnect();
2200
+ return o.observe(s, { childList: !0 }), () => o.disconnect();
2188
2201
  }
2189
- function mo(n, e, o) {
2190
- const t = new Set(e), s = new Set(o), r = /* @__PURE__ */ new Set([...t, ...s]);
2191
- for (const i of r) {
2192
- const l = n.getCellById(i);
2202
+ function mo(s, e, o) {
2203
+ const t = new Set(e), n = new Set(o), i = /* @__PURE__ */ new Set([...t, ...n]);
2204
+ for (const r of i) {
2205
+ const l = s.getCellById(r);
2193
2206
  if (!l?.isNode()) continue;
2194
- const a = s.has(i), v = l.getData() ?? {};
2195
- v._selected !== a && l.setData({ ...v, _selected: a });
2207
+ const a = n.has(r), h = l.getData() ?? {};
2208
+ h._selected !== a && l.setData({ ...h, _selected: a });
2196
2209
  }
2197
2210
  }
2198
2211
  const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
@@ -2205,15 +2218,15 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2205
2218
  actionsOffset: {}
2206
2219
  },
2207
2220
  emits: ["action"],
2208
- setup(n, { emit: e }) {
2209
- const o = n, t = V(() => {
2221
+ setup(s, { emit: e }) {
2222
+ const o = s, t = V(() => {
2210
2223
  const p = o.actionsOffset?.x ?? 0, u = o.actionsOffset?.y ?? 0, w = p !== 0 || u !== 0;
2211
2224
  return {
2212
2225
  left: `${o.position.x}px`,
2213
2226
  top: `${o.position.y}px`,
2214
2227
  transform: w ? `translate(${p}px, ${u}px)` : "translateX(-100%)"
2215
2228
  };
2216
- }), s = e, r = V(() => ({
2229
+ }), n = e, i = V(() => ({
2217
2230
  debug: {
2218
2231
  visible: o.config.showDebug && o.behavior.debuggable !== !1,
2219
2232
  disabled: o.behavior.debugDisabled === !0
@@ -2234,9 +2247,9 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2234
2247
  visible: o.config.showDisconnect && o.behavior.disconnectable !== !1,
2235
2248
  disabled: o.behavior.disconnectDisabled === !0
2236
2249
  }
2237
- })), i = V(() => r.value.copy.visible || r.value.copyInsert.visible || r.value.disconnect.visible), l = H(!1);
2250
+ })), r = V(() => i.value.copy.visible || i.value.copyInsert.visible || i.value.disconnect.visible), l = H(!1);
2238
2251
  let a = null;
2239
- function v() {
2252
+ function h() {
2240
2253
  a && (clearTimeout(a), a = null), l.value = !0;
2241
2254
  }
2242
2255
  function f() {
@@ -2251,20 +2264,20 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2251
2264
  style: Ee(t.value)
2252
2265
  }, [
2253
2266
  q("div", yo, [
2254
- r.value.debug.visible ? (A(), T("i", {
2267
+ i.value.debug.visible ? (A(), T("i", {
2255
2268
  key: 0,
2256
- class: te(["flow-canvas-icon canvas-debug flow-canvas-node-actions__icon", { "is-disabled": r.value.debug.disabled }]),
2257
- onClick: u[0] || (u[0] = (w) => !r.value.debug.disabled && s("action", "debug", n.node.id))
2269
+ class: te(["flow-canvas-icon canvas-debug flow-canvas-node-actions__icon", { "is-disabled": i.value.debug.disabled }]),
2270
+ onClick: u[0] || (u[0] = (w) => !i.value.debug.disabled && n("action", "debug", s.node.id))
2258
2271
  }, null, 2)) : Y("", !0),
2259
- r.value.delete.visible ? (A(), T("i", {
2272
+ i.value.delete.visible ? (A(), T("i", {
2260
2273
  key: 1,
2261
- class: te(["flow-canvas-icon canvas-shanchu flow-canvas-node-actions__icon", { "is-disabled": r.value.delete.disabled }]),
2262
- onClick: u[1] || (u[1] = (w) => !r.value.delete.disabled && s("action", "delete", n.node.id))
2274
+ class: te(["flow-canvas-icon canvas-shanchu flow-canvas-node-actions__icon", { "is-disabled": i.value.delete.disabled }]),
2275
+ onClick: u[1] || (u[1] = (w) => !i.value.delete.disabled && n("action", "delete", s.node.id))
2263
2276
  }, null, 2)) : Y("", !0),
2264
- i.value ? (A(), T("div", {
2277
+ r.value ? (A(), T("div", {
2265
2278
  key: 2,
2266
2279
  class: "flow-canvas-node-actions__more-wrapper",
2267
- onMouseenter: v,
2280
+ onMouseenter: h,
2268
2281
  onMouseleave: f
2269
2282
  }, [...u[5] || (u[5] = [
2270
2283
  q("i", { class: "flow-canvas-icon canvas-gengduo flow-canvas-node-actions__icon" }, null, -1)
@@ -2272,32 +2285,32 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2272
2285
  ]),
2273
2286
  at(lt, { name: "flow-canvas-fade" }, {
2274
2287
  default: He(() => [
2275
- l.value && i.value ? (A(), T("div", {
2288
+ l.value && r.value ? (A(), T("div", {
2276
2289
  key: 0,
2277
2290
  class: "flow-canvas-node-actions__dropdown",
2278
- onMouseenter: v,
2291
+ onMouseenter: h,
2279
2292
  onMouseleave: f
2280
2293
  }, [
2281
- r.value.copy.visible ? (A(), T("div", {
2294
+ i.value.copy.visible ? (A(), T("div", {
2282
2295
  key: 0,
2283
- class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.copy.disabled }]),
2284
- onClick: u[2] || (u[2] = (w) => !r.value.copy.disabled && s("action", "copy", n.node.id))
2296
+ class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.copy.disabled }]),
2297
+ onClick: u[2] || (u[2] = (w) => !i.value.copy.disabled && n("action", "copy", s.node.id))
2285
2298
  }, [...u[6] || (u[6] = [
2286
2299
  q("i", { class: "flow-canvas-icon canvas-copy-fuzhi-2" }, null, -1),
2287
2300
  q("span", null, "复制", -1)
2288
2301
  ])], 2)) : Y("", !0),
2289
- r.value.copyInsert.visible ? (A(), T("div", {
2302
+ i.value.copyInsert.visible ? (A(), T("div", {
2290
2303
  key: 1,
2291
- class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.copyInsert.disabled }]),
2292
- onClick: u[3] || (u[3] = (w) => !r.value.copyInsert.disabled && s("action", "copy-insert", n.node.id))
2304
+ class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.copyInsert.disabled }]),
2305
+ onClick: u[3] || (u[3] = (w) => !i.value.copyInsert.disabled && n("action", "copy-insert", s.node.id))
2293
2306
  }, [...u[7] || (u[7] = [
2294
2307
  q("i", { class: "flow-canvas-icon canvas-fuzhibingcharu" }, null, -1),
2295
2308
  q("span", null, "复制并插入", -1)
2296
2309
  ])], 2)) : Y("", !0),
2297
- r.value.disconnect.visible ? (A(), T("div", {
2310
+ i.value.disconnect.visible ? (A(), T("div", {
2298
2311
  key: 2,
2299
- class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.disconnect.disabled }]),
2300
- onClick: u[4] || (u[4] = (w) => !r.value.disconnect.disabled && s("action", "disconnect", n.node.id))
2312
+ class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.disconnect.disabled }]),
2313
+ onClick: u[4] || (u[4] = (w) => !i.value.disconnect.disabled && n("action", "disconnect", s.node.id))
2301
2314
  }, [...u[8] || (u[8] = [
2302
2315
  q("i", { class: "flow-canvas-icon canvas-unlock-jiebang" }, null, -1),
2303
2316
  q("span", null, "断开连线", -1)
@@ -2308,10 +2321,10 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2308
2321
  })
2309
2322
  ], 4));
2310
2323
  }
2311
- }), ve = (n, e) => {
2312
- const o = n.__vccOpts || n;
2313
- for (const [t, s] of e)
2314
- o[t] = s;
2324
+ }), ve = (s, e) => {
2325
+ const o = s.__vccOpts || s;
2326
+ for (const [t, n] of e)
2327
+ o[t] = n;
2315
2328
  return o;
2316
2329
  }, bo = /* @__PURE__ */ ve(wo, [["__scopeId", "data-v-3b39dab5"]]), Eo = {
2317
2330
  key: 0,
@@ -2325,19 +2338,19 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2325
2338
  autoPanPadding: {}
2326
2339
  },
2327
2340
  emits: ["open", "close", "start-drag", "viewport-overflow-right", "mouseenter", "mouseleave"],
2328
- setup(n, { expose: e, emit: o }) {
2329
- const t = n, s = o, r = H(), i = H(), l = H(!1), a = H(!1);
2330
- let v = null, f = !1, p = null;
2341
+ setup(s, { expose: e, emit: o }) {
2342
+ const t = s, n = o, i = H(), r = H(), l = H(!1), a = H(!1);
2343
+ let h = null, f = !1, p = null;
2331
2344
  function u(G) {
2332
- G.preventDefault(), G.stopPropagation(), v = { x: G.clientX, y: G.clientY }, f = !1, document.addEventListener("mousemove", w), document.addEventListener("mouseup", D);
2345
+ G.preventDefault(), G.stopPropagation(), h = { x: G.clientX, y: G.clientY }, f = !1, document.addEventListener("mousemove", w), document.addEventListener("mouseup", D);
2333
2346
  }
2334
2347
  function w(G) {
2335
- if (!v) return;
2336
- const d = G.clientX - v.x, y = G.clientY - v.y;
2337
- Math.sqrt(d * d + y * y) >= xo && (f = !0, O(), s("start-drag", t.node.id));
2348
+ if (!h) return;
2349
+ const d = G.clientX - h.x, y = G.clientY - h.y;
2350
+ Math.sqrt(d * d + y * y) >= xo && (f = !0, O(), n("start-drag", t.node.id));
2338
2351
  }
2339
2352
  function D() {
2340
- O(), f || b(), v = null, f = !1;
2353
+ O(), f || b(), h = null, f = !1;
2341
2354
  }
2342
2355
  function O() {
2343
2356
  document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", D);
@@ -2346,7 +2359,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2346
2359
  a.value ? B() : S();
2347
2360
  }
2348
2361
  function S() {
2349
- a.value = !0, s("open", t.node.id), Ge(() => {
2362
+ a.value = !0, n("open", t.node.id), Ge(() => {
2350
2363
  requestAnimationFrame(() => {
2351
2364
  M();
2352
2365
  });
@@ -2355,43 +2368,43 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2355
2368
  });
2356
2369
  }
2357
2370
  function M() {
2358
- if (!a.value || !t.autoPanOnOpen || !i.value) return;
2371
+ if (!a.value || !t.autoPanOnOpen || !r.value) return;
2359
2372
  const G = window.innerWidth || document.documentElement.clientWidth || 0;
2360
2373
  if (G <= 0) return;
2361
- const d = t.autoPanPadding ?? 16, c = i.value.getBoundingClientRect().right + d - G;
2362
- c > 0 && s("viewport-overflow-right", c);
2374
+ const d = t.autoPanPadding ?? 16, c = r.value.getBoundingClientRect().right + d - G;
2375
+ c > 0 && n("viewport-overflow-right", c);
2363
2376
  }
2364
2377
  function B() {
2365
- a.value = !1, s("close"), document.removeEventListener("mousedown", j);
2378
+ a.value = !1, n("close"), document.removeEventListener("mousedown", j);
2366
2379
  }
2367
2380
  function j(G) {
2368
2381
  const d = G.target;
2369
- r.value?.contains(d) || i.value?.contains(d) || B();
2382
+ i.value?.contains(d) || r.value?.contains(d) || B();
2370
2383
  }
2371
2384
  function k() {
2372
- a.value || s("mouseleave");
2385
+ a.value || n("mouseleave");
2373
2386
  }
2374
2387
  function X() {
2375
- p && (clearTimeout(p), p = null), s("mouseenter");
2388
+ p && (clearTimeout(p), p = null), n("mouseenter");
2376
2389
  }
2377
2390
  function U() {
2378
2391
  p = setTimeout(() => {
2379
- B(), s("mouseleave"), p = null;
2392
+ B(), n("mouseleave"), p = null;
2380
2393
  }, 150);
2381
2394
  }
2382
2395
  return Te(() => {
2383
2396
  O(), p && clearTimeout(p), document.removeEventListener("mousedown", j);
2384
2397
  }), e({ closePopover: B }), (G, d) => (A(), T("div", {
2385
2398
  class: "flow-canvas-quick-add",
2386
- style: Ee({ left: `${n.portPosition.x}px`, top: `${n.portPosition.y}px` }),
2387
- onMouseenter: d[2] || (d[2] = (y) => s("mouseenter")),
2399
+ style: Ee({ left: `${s.portPosition.x}px`, top: `${s.portPosition.y}px` }),
2400
+ onMouseenter: d[2] || (d[2] = (y) => n("mouseenter")),
2388
2401
  onMouseleave: k,
2389
2402
  onClick: d[3] || (d[3] = ht(() => {
2390
2403
  }, ["stop"]))
2391
2404
  }, [
2392
2405
  q("div", {
2393
2406
  ref_key: "btnRef",
2394
- ref: r,
2407
+ ref: i,
2395
2408
  class: te(["flow-canvas-quick-add__btn", { "is-hovered": l.value, "is-active": a.value }]),
2396
2409
  onMouseenter: d[0] || (d[0] = (y) => l.value = !0),
2397
2410
  onMouseleave: d[1] || (d[1] = (y) => l.value = !1),
@@ -2414,7 +2427,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2414
2427
  a.value ? (A(), T("div", {
2415
2428
  key: 0,
2416
2429
  ref_key: "popoverRef",
2417
- ref: i,
2430
+ ref: r,
2418
2431
  class: "flow-canvas-quick-add__popover",
2419
2432
  onMouseenter: X,
2420
2433
  onMouseleave: U
@@ -2435,20 +2448,20 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2435
2448
  canDelete: { type: Boolean }
2436
2449
  },
2437
2450
  emits: ["action"],
2438
- setup(n, { emit: e }) {
2439
- const o = n, t = e, s = V(() => ({
2451
+ setup(s, { emit: e }) {
2452
+ const o = s, t = e, n = V(() => ({
2440
2453
  left: `${o.position.x}px`,
2441
2454
  top: `${o.position.y}px`,
2442
2455
  transform: "translateX(-100%)"
2443
2456
  }));
2444
- return (r, i) => (A(), T("div", {
2457
+ return (i, r) => (A(), T("div", {
2445
2458
  class: "flow-canvas-selection-actions",
2446
- style: Ee(s.value)
2459
+ style: Ee(n.value)
2447
2460
  }, [
2448
2461
  q("div", ko, [
2449
2462
  q("i", {
2450
- class: te(["flow-canvas-icon canvas-shanchu flow-canvas-selection-actions__icon", { "is-disabled": !n.canDelete }]),
2451
- onClick: i[0] || (i[0] = (l) => n.canDelete && t("action", "delete"))
2463
+ class: te(["flow-canvas-icon canvas-shanchu flow-canvas-selection-actions__icon", { "is-disabled": !s.canDelete }]),
2464
+ onClick: r[0] || (r[0] = (l) => s.canDelete && t("action", "delete"))
2452
2465
  }, null, 2)
2453
2466
  ])
2454
2467
  ], 4));
@@ -2465,9 +2478,9 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2465
2478
  toolbarInclude: {}
2466
2479
  },
2467
2480
  emits: ["ui-event"],
2468
- setup(n, { expose: e, emit: o }) {
2469
- const t = n, s = o, r = H(), i = H();
2470
- let l, a, v, f, p = null, u = null, w = null, D = null, O = null;
2481
+ setup(s, { expose: e, emit: o }) {
2482
+ const t = s, n = o, i = H(), r = H();
2483
+ let l, a, h, f, p = null, u = null, w = null, D = null, O = null;
2471
2484
  const b = oo(), { hoveredNodeId: S, isDraggingNode: M } = b, B = b.enterOverlay, j = () => b.leaveOverlay(), k = H(0), X = H({ nodeIds: [], edgeIds: [] });
2472
2485
  function U(I) {
2473
2486
  const C = t.editor.api.value;
@@ -2529,7 +2542,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2529
2542
  position: { x: C.x + C.width, y: C.y + C.height + 4 },
2530
2543
  canDelete: P.nodeIds.length > 0 || P.edgeIds.length > 0
2531
2544
  };
2532
- }), h = H(), m = ro({
2545
+ }), v = H(), m = io({
2533
2546
  editor: t.editor,
2534
2547
  quickAddProp: V(() => t.quickAdd),
2535
2548
  isDraggingNode: M,
@@ -2538,9 +2551,9 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2538
2551
  viewportVersion: k,
2539
2552
  getNodeBehavior: U,
2540
2553
  getInsertGap: () => d.value.insertGap,
2541
- closePopover: () => h.value?.closePopover()
2554
+ closePopover: () => v.value?.closePopover()
2542
2555
  }), E = m.data, L = m.handleOpen, z = m.handleStartDrag;
2543
- function ie() {
2556
+ function re() {
2544
2557
  m.handleClose(), b.leaveOverlay(200), m.leave();
2545
2558
  }
2546
2559
  const N = m.handleOverlayEnter, _ = m.handleOverlayLeave, x = m.handleInsert, R = lo({
@@ -2643,9 +2656,9 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2643
2656
  return;
2644
2657
  }
2645
2658
  b.leave(180), m.quickAddPopoverOpen.value || m.leave();
2646
- }, r.value?.addEventListener("mousemove", w), D = () => {
2659
+ }, i.value?.addEventListener("mousemove", w), D = () => {
2647
2660
  b.reset(), m.quickAddPopoverOpen.value || (m.quickAddNodeId.value = null);
2648
- }, r.value?.addEventListener("mouseleave", D), r.value?.addEventListener("keydown", Q);
2661
+ }, i.value?.addEventListener("mouseleave", D), i.value?.addEventListener("keydown", Q);
2649
2662
  }
2650
2663
  function $e() {
2651
2664
  ge(
@@ -2660,7 +2673,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2660
2673
  );
2661
2674
  }
2662
2675
  dt(() => {
2663
- if (!i.value) return;
2676
+ if (!r.value) return;
2664
2677
  const I = /* @__PURE__ */ new Set(["model", "container"]), C = {};
2665
2678
  if (t.graphOptions)
2666
2679
  for (const [$, ne] of Object.entries(t.graphOptions)) {
@@ -2671,7 +2684,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2671
2684
  C[$] = ne;
2672
2685
  }
2673
2686
  l = new Et({
2674
- container: i.value,
2687
+ container: r.value,
2675
2688
  autoResize: !0,
2676
2689
  background: { color: "#edf2fc" },
2677
2690
  grid: {
@@ -2708,10 +2721,10 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2708
2721
  }
2709
2722
  },
2710
2723
  ...C
2711
- }), v = new Vt(), a = new Wt(
2724
+ }), h = new Vt(), a = new Wt(
2712
2725
  l,
2713
2726
  t.editor.schema,
2714
- v,
2727
+ h,
2715
2728
  ($) => t.editor._pluginManager.collectNodeDecorations($),
2716
2729
  ($) => t.editor._pluginManager.collectEdgeDecorations($),
2717
2730
  () => t.editor.api.value ? {
@@ -2744,7 +2757,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2744
2757
  resolveNodeShape: ($) => {
2745
2758
  const ne = t.editor.schema.nodeTypes[$];
2746
2759
  if (!ne) return null;
2747
- const he = v.registerNodeType($, ne.component), se = ne.getSize({ id: "", type: $, position: { x: 0, y: 0 } });
2760
+ const he = h.registerNodeType($, ne.component), se = ne.getSize({ id: "", type: $, position: { x: 0, y: 0 } });
2748
2761
  return { shapeName: he, width: se.width, height: se.height };
2749
2762
  }
2750
2763
  });
@@ -2764,7 +2777,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2764
2777
  t.editor._pluginManager.attachRuntime(ee);
2765
2778
  const le = t.editor._pluginManager.collectExtendedApi();
2766
2779
  Object.assign(t.editor.extendedApi, le), t.editor._emitUiEvent = ($) => {
2767
- t.editor._pluginManager.dispatchUiEvent($), s("ui-event", $);
2780
+ t.editor._pluginManager.dispatchUiEvent($), n("ui-event", $);
2768
2781
  }, f = new Xt(
2769
2782
  l,
2770
2783
  ($) => {
@@ -2789,7 +2802,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2789
2802
  let xe = /* @__PURE__ */ new Set(), be = /* @__PURE__ */ new Set();
2790
2803
  l.on("selection:changed", () => {
2791
2804
  const $ = ft(l.getSelectedCells?.() ?? []), ne = new Set($.nodeIds);
2792
- mo(l, xe, ne), xe = ne, X.value = $, t.editor._pluginManager.dispatchSelectionChange($), s("ui-event", {
2805
+ mo(l, xe, ne), xe = ne, X.value = $, t.editor._pluginManager.dispatchSelectionChange($), n("ui-event", {
2793
2806
  type: "selection.change",
2794
2807
  nodeIds: $.nodeIds,
2795
2808
  edgeIds: $.edgeIds
@@ -2810,53 +2823,53 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2810
2823
  b.reset(), m.quickAddNodeId.value = null, m.quickAddPopoverOpen.value = !1;
2811
2824
  }
2812
2825
  return e({ resetHoverState: Se }), Te(() => {
2813
- b.cleanup(), m.cleanup(), R.cleanup(), p?.remove(), u && l?.container?.removeEventListener("mousemove", u), w && r.value?.removeEventListener("mousemove", w), D && r.value?.removeEventListener("mouseleave", D), O?.(), r.value?.removeEventListener("keydown", Q), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
2826
+ b.cleanup(), m.cleanup(), R.cleanup(), p?.remove(), u && l?.container?.removeEventListener("mousemove", u), w && i.value?.removeEventListener("mousemove", w), D && i.value?.removeEventListener("mouseleave", D), O?.(), i.value?.removeEventListener("keydown", Q), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
2814
2827
  for (const I of Object.keys(t.editor.extendedApi))
2815
2828
  delete t.editor.extendedApi[I];
2816
- f?.dispose(), a?.dispose(), v?.dispose(), l?.dispose();
2829
+ f?.dispose(), a?.dispose(), h?.dispose(), l?.dispose();
2817
2830
  }), (I, C) => (A(), T("div", {
2818
2831
  ref_key: "rootRef",
2819
- ref: r,
2832
+ ref: i,
2820
2833
  class: te(["flow-canvas-runtime-core", { "flow-canvas-runtime-core--selection-mode": G.value }]),
2821
2834
  tabindex: "0"
2822
2835
  }, [
2823
2836
  q("div", {
2824
2837
  ref_key: "containerRef",
2825
- ref: i,
2838
+ ref: r,
2826
2839
  class: "flow-canvas-runtime-core__graph"
2827
2840
  }, null, 512),
2828
2841
  q("div", No, [
2829
- (A(!0), T(de, null, Ce(y.value, (P) => (A(), T("div", {
2842
+ (A(!0), T(de, null, Ie(y.value, (P) => (A(), T("div", {
2830
2843
  key: `badge-${P.nodeId}`,
2831
2844
  class: "flow-canvas-runtime-core__badge",
2832
2845
  style: Ee({ left: `${P.x}px`, top: `${P.y}px`, backgroundColor: P.badge.color })
2833
2846
  }, ce(P.badge.text), 5))), 128)),
2834
- re(E) ? (A(), Ie(Co, {
2847
+ ie(E) ? (A(), Ce(Co, {
2835
2848
  key: 0,
2836
2849
  ref_key: "quickAddPopoverRef",
2837
- ref: h,
2838
- node: re(E).node,
2839
- "port-position": re(E).portPosition,
2840
- "auto-pan-on-open": re(m).mergedConfig.value.autoPanOnOpen,
2841
- "auto-pan-padding": re(m).mergedConfig.value.autoPanPadding,
2842
- onOpen: re(L),
2843
- onClose: ie,
2844
- onStartDrag: re(z),
2845
- onViewportOverflowRight: re(m).handlePopoverViewportOverflow,
2846
- onMouseenter: re(N),
2847
- onMouseleave: re(_)
2850
+ ref: v,
2851
+ node: ie(E).node,
2852
+ "port-position": ie(E).portPosition,
2853
+ "auto-pan-on-open": ie(m).mergedConfig.value.autoPanOnOpen,
2854
+ "auto-pan-padding": ie(m).mergedConfig.value.autoPanPadding,
2855
+ onOpen: ie(L),
2856
+ onClose: re,
2857
+ onStartDrag: ie(z),
2858
+ onViewportOverflowRight: ie(m).handlePopoverViewportOverflow,
2859
+ onMouseenter: ie(N),
2860
+ onMouseleave: ie(_)
2848
2861
  }, {
2849
2862
  default: He(() => [
2850
2863
  Me(I.$slots, "quick-add-panel", {
2851
- node: re(E).node,
2852
- api: n.editor.api.value,
2853
- insertNodeToRight: (P) => re(x)(re(E).node.id, P),
2854
- closePopover: () => h.value?.closePopover()
2864
+ node: ie(E).node,
2865
+ api: s.editor.api.value,
2866
+ insertNodeToRight: (P) => ie(x)(ie(E).node.id, P),
2867
+ closePopover: () => v.value?.closePopover()
2855
2868
  }, void 0, !0)
2856
2869
  ]),
2857
2870
  _: 3
2858
2871
  }, 8, ["node", "port-position", "auto-pan-on-open", "auto-pan-padding", "onOpen", "onStartDrag", "onViewportOverflowRight", "onMouseenter", "onMouseleave"])) : Y("", !0),
2859
- c.value ? (A(), Ie(bo, {
2872
+ c.value ? (A(), Ce(bo, {
2860
2873
  key: 1,
2861
2874
  node: c.value.node,
2862
2875
  position: c.value.position,
@@ -2864,10 +2877,10 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2864
2877
  behavior: c.value.behavior,
2865
2878
  "actions-offset": c.value.behavior.actionsOffset,
2866
2879
  onAction: Z,
2867
- onMouseenter: re(B),
2880
+ onMouseenter: ie(B),
2868
2881
  onMouseleave: j
2869
2882
  }, null, 8, ["node", "position", "config", "behavior", "actions-offset", "onMouseenter"])) : Y("", !0),
2870
- g.value ? (A(), Ie(Mo, {
2883
+ g.value ? (A(), Ce(Mo, {
2871
2884
  key: 2,
2872
2885
  position: g.value.position,
2873
2886
  "can-delete": g.value.canDelete,
@@ -2882,48 +2895,48 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2882
2895
  editor: {},
2883
2896
  items: {}
2884
2897
  },
2885
- setup(n) {
2886
- const e = n, o = H(), t = V(() => e.items ? e.items : Object.keys(e.editor.schema.nodeTypes).map((s) => ({
2887
- type: s,
2888
- label: s.charAt(0).toUpperCase() + s.slice(1)
2898
+ setup(s) {
2899
+ const e = s, o = H(), t = V(() => e.items ? e.items : Object.keys(e.editor.schema.nodeTypes).map((n) => ({
2900
+ type: n,
2901
+ label: n.charAt(0).toUpperCase() + n.slice(1)
2889
2902
  })));
2890
2903
  return ge(
2891
2904
  [() => e.editor.api.value, t, o],
2892
- ([s, r, i], l, a) => {
2893
- if (!s || !i) return;
2894
- const v = [];
2895
- for (const f of r) {
2896
- const p = i.querySelector(`[data-node-type="${f.type}"]`);
2905
+ ([n, i, r], l, a) => {
2906
+ if (!n || !r) return;
2907
+ const h = [];
2908
+ for (const f of i) {
2909
+ const p = r.querySelector(`[data-node-type="${f.type}"]`);
2897
2910
  if (!p) continue;
2898
- const u = s.registerDndSource(p, () => ({
2911
+ const u = n.registerDndSource(p, () => ({
2899
2912
  id: J(),
2900
2913
  type: f.type,
2901
2914
  label: f.label,
2902
2915
  position: { x: 0, y: 0 }
2903
2916
  }));
2904
- v.push(u);
2917
+ h.push(u);
2905
2918
  }
2906
2919
  a(() => {
2907
- for (const f of v) f();
2920
+ for (const f of h) f();
2908
2921
  });
2909
2922
  },
2910
2923
  { flush: "post" }
2911
- ), (s, r) => (A(), T("div", Ao, [
2924
+ ), (n, i) => (A(), T("div", Ao, [
2912
2925
  q("div", {
2913
2926
  ref_key: "listRef",
2914
2927
  ref: o,
2915
2928
  class: "flow-canvas-node-palette__list"
2916
2929
  }, [
2917
- (A(!0), T(de, null, Ce(t.value, (i) => (A(), T("div", {
2918
- key: i.type,
2930
+ (A(!0), T(de, null, Ie(t.value, (r) => (A(), T("div", {
2931
+ key: r.type,
2919
2932
  class: "flow-canvas-node-palette__item",
2920
- "data-node-type": i.type
2933
+ "data-node-type": r.type
2921
2934
  }, [
2922
- i.icon ? (A(), T("i", {
2935
+ r.icon ? (A(), T("i", {
2923
2936
  key: 0,
2924
- class: te([i.icon, "flow-canvas-node-palette__item-icon"])
2937
+ class: te([r.icon, "flow-canvas-node-palette__item-icon"])
2925
2938
  }, null, 2)) : Y("", !0),
2926
- q("span", Po, ce(i.label), 1)
2939
+ q("span", Po, ce(r.label), 1)
2927
2940
  ], 8, _o))), 128))
2928
2941
  ], 512)
2929
2942
  ]));
@@ -2942,18 +2955,18 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2942
2955
  paletteItems: { default: void 0 }
2943
2956
  },
2944
2957
  emits: ["update:sidebarCollapsed"],
2945
- setup(n) {
2958
+ setup(s) {
2946
2959
  return (e, o) => (A(), T("div", Lo, [
2947
- !n.hideSidebar && (e.$slots.sidebar || n.editor) ? (A(), T("aside", {
2960
+ !s.hideSidebar && (e.$slots.sidebar || s.editor) ? (A(), T("aside", {
2948
2961
  key: 0,
2949
- class: te(["flow-canvas-layout__sidebar", { "is-collapsed": n.sidebarCollapsed }]),
2950
- style: Ee({ width: n.sidebarCollapsed ? "0px" : `${n.sidebarWidth}px` })
2962
+ class: te(["flow-canvas-layout__sidebar", { "is-collapsed": s.sidebarCollapsed }]),
2963
+ style: Ee({ width: s.sidebarCollapsed ? "0px" : `${s.sidebarWidth}px` })
2951
2964
  }, [
2952
2965
  Me(e.$slots, "sidebar", {}, () => [
2953
- n.editor ? (A(), Ie(Ro, {
2966
+ s.editor ? (A(), Ce(Ro, {
2954
2967
  key: 0,
2955
- editor: n.editor,
2956
- items: n.paletteItems
2968
+ editor: s.editor,
2969
+ items: s.paletteItems
2957
2970
  }, null, 8, ["editor", "items"])) : Y("", !0)
2958
2971
  ], !0)
2959
2972
  ], 6)) : Y("", !0),
@@ -2961,15 +2974,15 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2961
2974
  q("div", $o, [
2962
2975
  Me(e.$slots, "default", {}, void 0, !0)
2963
2976
  ]),
2964
- !n.hideFooter && e.$slots.footer ? (A(), T("div", Bo, [
2977
+ !s.hideFooter && e.$slots.footer ? (A(), T("div", Bo, [
2965
2978
  Me(e.$slots, "footer", {}, void 0, !0)
2966
2979
  ])) : Y("", !0)
2967
2980
  ])
2968
2981
  ]));
2969
2982
  }
2970
2983
  }), An = /* @__PURE__ */ ve(Fo, [["__scopeId", "data-v-26f35b6b"]]), et = typeof navigator < "u" && /Mac|iPod|iPhone|iPad/.test(navigator.platform ?? navigator.userAgent), qo = ["undo", "redo"];
2971
- function Ho(n) {
2972
- const e = new Set(n?.include), o = new Set(qo.filter((a) => !e.has(a))), t = [
2984
+ function Ho(s) {
2985
+ const e = new Set(s?.include), o = new Set(qo.filter((a) => !e.has(a))), t = [
2973
2986
  {
2974
2987
  id: "undo",
2975
2988
  type: "undo",
@@ -2988,7 +3001,7 @@ function Ho(n) {
2988
3001
  shortcut: et ? ["⇧", "⌘", "Z"] : ["Ctrl", "Shift", "Z"],
2989
3002
  order: 11
2990
3003
  }
2991
- ], s = [
3004
+ ], n = [
2992
3005
  {
2993
3006
  id: "select",
2994
3007
  type: "select",
@@ -3013,7 +3026,7 @@ function Ho(n) {
3013
3026
  description: "下载",
3014
3027
  order: 24
3015
3028
  }
3016
- ], r = [
3029
+ ], i = [
3017
3030
  {
3018
3031
  id: "zoom-out",
3019
3032
  type: "zoom-out",
@@ -3031,7 +3044,7 @@ function Ho(n) {
3031
3044
  description: "放大画布",
3032
3045
  order: 32
3033
3046
  }
3034
- ], i = [
3047
+ ], r = [
3035
3048
  {
3036
3049
  id: "reset",
3037
3050
  type: "reset",
@@ -3041,9 +3054,9 @@ function Ho(n) {
3041
3054
  order: 40
3042
3055
  }
3043
3056
  ];
3044
- return [...[...t, ...s].filter(
3057
+ return [...[...t, ...n].filter(
3045
3058
  (a) => !o.has(a.type)
3046
- ), ...r, ...i];
3059
+ ), ...i, ...r];
3047
3060
  }
3048
3061
  const Go = { class: "flow-canvas-toolbar" }, zo = {
3049
3062
  key: 0,
@@ -3062,7 +3075,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3062
3075
  include: {},
3063
3076
  editor: {}
3064
3077
  },
3065
- setup(n) {
3078
+ setup(s) {
3066
3079
  const e = /* @__PURE__ */ new Set([
3067
3080
  "undo",
3068
3081
  "redo",
@@ -3075,23 +3088,23 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3075
3088
  function t(c) {
3076
3089
  return c.id.startsWith("plugin:") || c.type === "custom";
3077
3090
  }
3078
- function s(c) {
3091
+ function n(c) {
3079
3092
  return c !== "custom" && o.has(c);
3080
3093
  }
3081
- const r = n, i = V(() => {
3082
- if (r.items) return r.items;
3083
- const c = Ho({ include: r.include }), g = r.editor.toolbarItems.value, h = new Set(r.exclude ?? []), m = /* @__PURE__ */ new Map();
3094
+ const i = s, r = V(() => {
3095
+ if (i.items) return i.items;
3096
+ const c = Ho({ include: i.include }), g = i.editor.toolbarItems.value, v = new Set(i.exclude ?? []), m = /* @__PURE__ */ new Map();
3084
3097
  for (const E of c)
3085
3098
  m.set(E.id, E);
3086
3099
  for (const E of g) {
3087
3100
  const L = m.get(E.id);
3088
3101
  L ? m.set(E.id, { ...L, ...E, order: L.order, group: L.group }) : t(E) && m.set(E.id, E);
3089
3102
  }
3090
- return [...m.values()].filter((E) => E.type === "custom" || !e.has(E.type) ? !0 : !h.has(E.type)).sort((E, L) => (E.order ?? 0) - (L.order ?? 0));
3091
- }), l = H(1), a = H(null), v = H(null), f = H(!1);
3103
+ return [...m.values()].filter((E) => E.type === "custom" || !e.has(E.type) ? !0 : !v.has(E.type)).sort((E, L) => (E.order ?? 0) - (L.order ?? 0));
3104
+ }), l = H(1), a = H(null), h = H(null), f = H(!1);
3092
3105
  let p = null;
3093
3106
  ge(
3094
- () => r.editor.api.value,
3107
+ () => i.editor.api.value,
3095
3108
  (c) => {
3096
3109
  p?.(), p = null, c && (l.value = c.getZoom(), p = c.onGraphEvent("scale", () => {
3097
3110
  l.value = c.getZoom();
@@ -3111,62 +3124,62 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3111
3124
  function D() {
3112
3125
  u.visible = !1, a.value = null;
3113
3126
  }
3114
- it(() => {
3127
+ rt(() => {
3115
3128
  p?.();
3116
3129
  });
3117
- const O = V(() => `${Math.round(l.value * 100)}%`), b = V(() => r.editor.api.value ? {
3118
- api: r.editor.api.value,
3119
- flowModel: r.editor.flowModel.value,
3120
- history: r.editor.history,
3121
- mode: r.editor.mode.value
3130
+ const O = V(() => `${Math.round(l.value * 100)}%`), b = V(() => i.editor.api.value ? {
3131
+ api: i.editor.api.value,
3132
+ flowModel: i.editor.flowModel.value,
3133
+ history: i.editor.history,
3134
+ mode: i.editor.mode.value
3122
3135
  } : null);
3123
3136
  function S(c) {
3124
3137
  return c.visible === !1 ? !1 : typeof c.visible == "function" ? b.value ? c.visible(b.value) : !1 : !0;
3125
3138
  }
3126
3139
  function M(c) {
3127
- return typeof c.active == "function" ? b.value ? c.active(b.value) : !1 : c.active !== void 0 ? c.active : c.type === "select" ? r.editor.selectionMode.value : !1;
3140
+ return typeof c.active == "function" ? b.value ? c.active(b.value) : !1 : c.active !== void 0 ? c.active : c.type === "select" ? i.editor.selectionMode.value : !1;
3128
3141
  }
3129
3142
  const B = V(() => {
3130
3143
  const c = d.value.filter(
3131
- (h) => s(h.type) && M(h)
3144
+ (v) => n(v.type) && M(v)
3132
3145
  );
3133
3146
  if (c.length === 0) return null;
3134
- const g = v.value;
3135
- return g && c.some((h) => h.type === g) ? g : c[0]?.type ?? null;
3147
+ const g = h.value;
3148
+ return g && c.some((v) => v.type === g) ? g : c[0]?.type ?? null;
3136
3149
  });
3137
3150
  function j(c) {
3138
- return s(c.type) ? B.value === c.type : M(c);
3151
+ return n(c.type) ? B.value === c.type : M(c);
3139
3152
  }
3140
3153
  function k(c) {
3141
- return !b.value || c.disabled === !0 ? !0 : typeof c.disabled == "function" ? c.disabled(b.value) : c.type === "undo" ? !r.editor.history.canUndo.value : c.type === "redo" ? !r.editor.history.canRedo.value : c.type === "export" ? f.value : !1;
3154
+ return !b.value || c.disabled === !0 ? !0 : typeof c.disabled == "function" ? c.disabled(b.value) : c.type === "undo" ? !i.editor.history.canUndo.value : c.type === "redo" ? !i.editor.history.canRedo.value : c.type === "export" ? f.value : !1;
3142
3155
  }
3143
3156
  function X(c) {
3144
- if (!(!b.value || !s(c.type) || !M(c))) {
3157
+ if (!(!b.value || !n(c.type) || !M(c))) {
3145
3158
  if (c.type === "select") {
3146
- r.editor.setSelectionMode(!1);
3159
+ i.editor.setSelectionMode(!1);
3147
3160
  return;
3148
3161
  }
3149
3162
  c.onClick?.(b.value);
3150
3163
  }
3151
3164
  }
3152
3165
  function U(c) {
3153
- if (s(c.type))
3166
+ if (n(c.type))
3154
3167
  for (const g of d.value)
3155
- !s(g.type) || g.id === c.id || X(g);
3168
+ !n(g.type) || g.id === c.id || X(g);
3156
3169
  }
3157
3170
  function G(c) {
3158
3171
  if (!b.value || k(c)) return;
3159
- if (s(c.type) && (v.value = c.type, U(c)), c.onClick) {
3172
+ if (n(c.type) && (h.value = c.type, U(c)), c.onClick) {
3160
3173
  c.onClick(b.value);
3161
3174
  return;
3162
3175
  }
3163
3176
  const { api: g } = b.value;
3164
3177
  switch (c.type) {
3165
3178
  case "undo":
3166
- r.editor.history.undo();
3179
+ i.editor.history.undo();
3167
3180
  break;
3168
3181
  case "redo":
3169
- r.editor.history.redo();
3182
+ i.editor.history.redo();
3170
3183
  break;
3171
3184
  case "zoom-in":
3172
3185
  g.zoomIn(), l.value = g.getZoom();
@@ -3182,20 +3195,20 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3182
3195
  break;
3183
3196
  case "export":
3184
3197
  if (f.value) break;
3185
- f.value = !0, g.exportAsImage().then((h) => {
3186
- const m = URL.createObjectURL(h), E = document.createElement("a");
3198
+ f.value = !0, g.exportAsImage().then((v) => {
3199
+ const m = URL.createObjectURL(v), E = document.createElement("a");
3187
3200
  E.href = m, E.download = "canvas-export.png", E.click(), URL.revokeObjectURL(m);
3188
- }).catch((h) => {
3189
- console.warn("[flow-canvas] Export failed:", h);
3201
+ }).catch((v) => {
3202
+ console.warn("[flow-canvas] Export failed:", v);
3190
3203
  }).finally(() => {
3191
3204
  f.value = !1;
3192
3205
  });
3193
3206
  break;
3194
3207
  case "select":
3195
- r.editor.setSelectionMode(!r.editor.selectionMode.value);
3208
+ i.editor.setSelectionMode(!i.editor.selectionMode.value);
3196
3209
  break;
3197
3210
  case "auto-layout":
3198
- r.editor._emitUiEvent({ type: "toolbar.auto-layout" });
3211
+ i.editor._emitUiEvent({ type: "toolbar.auto-layout" });
3199
3212
  break;
3200
3213
  case "search":
3201
3214
  case "minimap":
@@ -3206,21 +3219,21 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3206
3219
  break;
3207
3220
  }
3208
3221
  }
3209
- const d = V(() => i.value.filter(S)), y = V(() => {
3222
+ const d = V(() => r.value.filter(S)), y = V(() => {
3210
3223
  const c = /* @__PURE__ */ new Map(), g = [];
3211
- for (const h of d.value) {
3212
- const m = h.group ?? "default";
3213
- c.has(m) || (c.set(m, []), g.push(m)), c.get(m).push(h);
3224
+ for (const v of d.value) {
3225
+ const m = v.group ?? "default";
3226
+ c.has(m) || (c.set(m, []), g.push(m)), c.get(m).push(v);
3214
3227
  }
3215
- return g.map((h) => ({ name: h, items: c.get(h) })).filter((h) => h.items.length > 0);
3228
+ return g.map((v) => ({ name: v, items: c.get(v) })).filter((v) => v.items.length > 0);
3216
3229
  });
3217
3230
  return (c, g) => (A(), T("div", Go, [
3218
- (A(!0), T(de, null, Ce(y.value, (h, m) => (A(), T(de, {
3219
- key: h.name
3231
+ (A(!0), T(de, null, Ie(y.value, (v, m) => (A(), T(de, {
3232
+ key: v.name
3220
3233
  }, [
3221
3234
  m > 0 ? (A(), T("div", zo)) : Y("", !0),
3222
3235
  q("div", Uo, [
3223
- (A(!0), T(de, null, Ce(h.items, (E) => (A(), T(de, {
3236
+ (A(!0), T(de, null, Ie(v.items, (E) => (A(), T(de, {
3224
3237
  key: E.id
3225
3238
  }, [
3226
3239
  E.type === "zoom-display" ? (A(), T("span", jo, ce(O.value), 1)) : (A(), T("button", {
@@ -3238,7 +3251,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3238
3251
  onMouseenter: (L) => w(L, E),
3239
3252
  onMouseleave: D
3240
3253
  }, [
3241
- E.component ? (A(), Ie(mt(E.component), { key: 0 })) : E.icon ? (A(), T("i", {
3254
+ E.component ? (A(), Ce(mt(E.component), { key: 0 })) : E.icon ? (A(), T("i", {
3242
3255
  key: 1,
3243
3256
  class: te(E.icon)
3244
3257
  }, null, 2)) : (A(), T("span", {
@@ -3250,7 +3263,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3250
3263
  ], 64))), 128))
3251
3264
  ])
3252
3265
  ], 64))), 128)),
3253
- (A(), Ie(yt, { to: "body" }, [
3266
+ (A(), Ce(yt, { to: "body" }, [
3254
3267
  u.visible ? (A(), T("div", {
3255
3268
  key: 0,
3256
3269
  ref_key: "tooltipRef",
@@ -3260,7 +3273,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3260
3273
  }, [
3261
3274
  q("span", null, ce(u.text), 1),
3262
3275
  u.shortcut.length ? (A(), T("kbd", Xo, [
3263
- (A(!0), T(de, null, Ce(u.shortcut, (h, m) => (A(), T("span", { key: m }, ce(h), 1))), 128))
3276
+ (A(!0), T(de, null, Ie(u.shortcut, (v, m) => (A(), T("span", { key: m }, ce(v), 1))), 128))
3264
3277
  ])) : Y("", !0),
3265
3278
  g[0] || (g[0] = q("div", { class: "flow-canvas-toolbar-tooltip__arrow" }, null, -1))
3266
3279
  ], 4)) : Y("", !0)
@@ -3275,38 +3288,38 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3275
3288
  class: "flow-canvas-default-node__task-label"
3276
3289
  }, Jo = /* @__PURE__ */ fe({
3277
3290
  __name: "default-node",
3278
- setup(n) {
3279
- const o = wt("getNode")?.(), t = V(() => o?.getData?.() ?? null), s = V(() => t.value?.label || t.value?.type || ""), r = {
3291
+ setup(s) {
3292
+ const o = wt("getNode")?.(), t = V(() => o?.getData?.() ?? null), n = V(() => t.value?.label || t.value?.type || ""), i = {
3280
3293
  start: "canvas-kaishi",
3281
3294
  end: "canvas-stop",
3282
3295
  "parallel-gateway": "canvas-bingxingwangguan",
3283
3296
  "branch-gateway": "canvas-fenzhiwangguan",
3284
3297
  "converge-gateway": "canvas-huijuwangguan",
3285
3298
  "conditional-parallel-gateway": "canvas-tiaojianbingxingwangguan"
3286
- }, i = /* @__PURE__ */ new Set(["start", "end"]), l = /* @__PURE__ */ new Set([
3299
+ }, r = /* @__PURE__ */ new Set(["start", "end"]), l = /* @__PURE__ */ new Set([
3287
3300
  "parallel-gateway",
3288
3301
  "branch-gateway",
3289
3302
  "converge-gateway",
3290
3303
  "conditional-parallel-gateway"
3291
3304
  ]), a = V(() => {
3292
3305
  const f = t.value?.type ?? "";
3293
- return i.has(f) ? "endpoint" : l.has(f) ? "gateway" : "task";
3294
- }), v = V(() => r[t.value?.type ?? ""] ?? "");
3306
+ return r.has(f) ? "endpoint" : l.has(f) ? "gateway" : "task";
3307
+ }), h = V(() => i[t.value?.type ?? ""] ?? "");
3295
3308
  return (f, p) => (A(), T("div", {
3296
3309
  class: te(["flow-canvas-default-node", [`is-${a.value}`, { "flow-canvas-highlight-target": a.value !== "gateway" }]])
3297
3310
  }, [
3298
3311
  a.value === "endpoint" ? (A(), T(de, { key: 0 }, [
3299
- v.value ? (A(), T("i", {
3312
+ h.value ? (A(), T("i", {
3300
3313
  key: 0,
3301
- class: te([["flow-canvas-icon", v.value], "flow-canvas-default-node__ep-icon"])
3314
+ class: te([["flow-canvas-icon", h.value], "flow-canvas-default-node__ep-icon"])
3302
3315
  }, null, 2)) : Y("", !0),
3303
- q("span", Yo, ce(s.value), 1)
3316
+ q("span", Yo, ce(n.value), 1)
3304
3317
  ], 64)) : a.value === "gateway" ? (A(), T("div", Zo, [
3305
- v.value ? (A(), T("i", {
3318
+ h.value ? (A(), T("i", {
3306
3319
  key: 0,
3307
- class: te([["flow-canvas-icon", v.value], "flow-canvas-default-node__gw-icon"])
3320
+ class: te([["flow-canvas-icon", h.value], "flow-canvas-default-node__gw-icon"])
3308
3321
  }, null, 2)) : Y("", !0)
3309
- ])) : (A(), T("span", Qo, ce(s.value), 1))
3322
+ ])) : (A(), T("span", Qo, ce(n.value), 1))
3310
3323
  ], 2));
3311
3324
  }
3312
3325
  }), en = /* @__PURE__ */ ve(Jo, [["__scopeId", "data-v-f0e24a9f"]]), tn = {
@@ -3322,7 +3335,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3322
3335
  width: 64,
3323
3336
  height: 64
3324
3337
  }
3325
- }, tt = (n, e) => ({
3338
+ }, tt = (s, e) => ({
3326
3339
  stroke: e.hovered ? "#3a84ff" : "#abb5cc",
3327
3340
  strokeWidth: 2
3328
3341
  });
@@ -3352,48 +3365,48 @@ function on() {
3352
3365
  }
3353
3366
  };
3354
3367
  }
3355
- function Pn(n) {
3356
- const e = n?.nodeTypes ?? tn, o = {}, t = [];
3357
- for (const [i, l] of Object.entries(e)) {
3358
- const a = l.width ?? 150, v = l.height ?? 50;
3359
- o[i] = {
3368
+ function Pn(s) {
3369
+ const e = s?.nodeTypes ?? tn, o = {}, t = [];
3370
+ for (const [r, l] of Object.entries(e)) {
3371
+ const a = l.width ?? 150, h = l.height ?? 50;
3372
+ o[r] = {
3360
3373
  component: en,
3361
- getSize: () => ({ width: a, height: v }),
3374
+ getSize: () => ({ width: a, height: h }),
3362
3375
  getPorts: () => ut()
3363
3376
  }, t.push({
3364
- type: i,
3365
- label: l.label ?? i,
3377
+ type: r,
3378
+ label: l.label ?? r,
3366
3379
  icon: l.icon
3367
3380
  });
3368
3381
  }
3369
- const s = {
3382
+ const n = {
3370
3383
  ...on(),
3371
- ...n?.edgeTypes
3372
- }, r = n?.defaultEdgeType ?? "manhattan";
3384
+ ...s?.edgeTypes
3385
+ }, i = s?.defaultEdgeType ?? "manhattan";
3373
3386
  return {
3374
- schema: { nodeTypes: o, defaultEdgeType: r, edgeTypes: s },
3387
+ schema: { nodeTypes: o, defaultEdgeType: i, edgeTypes: n },
3375
3388
  paletteItems: t
3376
3389
  };
3377
3390
  }
3378
- function Tn(n) {
3391
+ function Tn(s) {
3379
3392
  return {
3380
3393
  name: "connection-validator",
3381
3394
  priority: 10,
3382
3395
  transformCommand(e, o, t) {
3383
- const s = /* @__PURE__ */ new Set();
3384
- for (const r of e.commands)
3385
- r.type === "edge.remove" && s.add(r.edgeId);
3386
- for (const r of e.commands) {
3387
- if (r.type !== "edge.add" && r.type !== "edge.reconnect") continue;
3388
- const i = t.flowModel.value, l = r.type === "edge.add" ? r.edge.source.nodeId : r.source?.nodeId, a = r.type === "edge.add" ? r.edge.target.nodeId : r.target?.nodeId;
3396
+ const n = /* @__PURE__ */ new Set();
3397
+ for (const i of e.commands)
3398
+ i.type === "edge.remove" && n.add(i.edgeId);
3399
+ for (const i of e.commands) {
3400
+ if (i.type !== "edge.add" && i.type !== "edge.reconnect") continue;
3401
+ const r = t.flowModel.value, l = i.type === "edge.add" ? i.edge.source.nodeId : i.source?.nodeId, a = i.type === "edge.add" ? i.edge.target.nodeId : i.target?.nodeId;
3389
3402
  if (!l || !a) continue;
3390
- const v = i.nodes[l], f = i.nodes[a];
3391
- if (!v || !f) continue;
3392
- const p = r.type === "edge.add" ? r.edge.source.portId : r.source?.portId, u = r.type === "edge.add" ? r.edge.target.portId : r.target?.portId, w = p ? v.ports?.find((M) => M.id === p) : void 0, D = u ? f.ports?.find((M) => M.id === u) : void 0, O = r.type === "edge.reconnect" ? r.edgeId : void 0, b = Object.values(i.edges).filter(
3393
- (M) => M.id !== O && !s.has(M.id)
3394
- ), S = n({
3395
- flowModel: i,
3396
- sourceNode: v,
3403
+ const h = r.nodes[l], f = r.nodes[a];
3404
+ if (!h || !f) continue;
3405
+ const p = i.type === "edge.add" ? i.edge.source.portId : i.source?.portId, u = i.type === "edge.add" ? i.edge.target.portId : i.target?.portId, w = p ? h.ports?.find((M) => M.id === p) : void 0, D = u ? f.ports?.find((M) => M.id === u) : void 0, O = i.type === "edge.reconnect" ? i.edgeId : void 0, b = Object.values(r.edges).filter(
3406
+ (M) => M.id !== O && !n.has(M.id)
3407
+ ), S = s({
3408
+ flowModel: r,
3409
+ sourceNode: h,
3397
3410
  targetNode: f,
3398
3411
  sourcePort: w,
3399
3412
  targetPort: D,
@@ -3410,13 +3423,13 @@ function Tn(n) {
3410
3423
  }
3411
3424
  };
3412
3425
  }
3413
- function Rn(n) {
3414
- const { rubberband: e = !0, multiple: o = !0, movable: t = !0 } = n ?? {};
3426
+ function Rn(s) {
3427
+ const { rubberband: e = !0, multiple: o = !0, movable: t = !0 } = s ?? {};
3415
3428
  return {
3416
3429
  name: "selection",
3417
3430
  priority: 90,
3418
- attachRuntime(s) {
3419
- s.graph.use(
3431
+ attachRuntime(n) {
3432
+ n.graph.use(
3420
3433
  new It({
3421
3434
  enabled: !0,
3422
3435
  rubberband: e,
@@ -3424,22 +3437,22 @@ function Rn(n) {
3424
3437
  movable: t,
3425
3438
  pointerEvents: "none",
3426
3439
  showNodeSelectionBox: !0,
3427
- filter: (r) => !(r.isNode() && (r.getData?.() ?? {})._selectable === !1)
3440
+ filter: (i) => !(i.isNode() && (i.getData?.() ?? {})._selectable === !1)
3428
3441
  })
3429
3442
  );
3430
3443
  }
3431
3444
  };
3432
3445
  }
3433
- function Ln(n) {
3434
- const { tolerance: e = 10, color: o = "#3a84ff" } = n ?? {};
3446
+ function Ln(s) {
3447
+ const { tolerance: e = 10, color: o = "#3a84ff" } = s ?? {};
3435
3448
  let t = null;
3436
3449
  return {
3437
3450
  name: "snapline",
3438
3451
  priority: 90,
3439
- async attachRuntime(s) {
3440
- const { Snapline: r } = await import("@antv/x6-plugin-snapline");
3441
- s.graph.use(
3442
- new r({
3452
+ async attachRuntime(n) {
3453
+ const { Snapline: i } = await import("@antv/x6-plugin-snapline");
3454
+ n.graph.use(
3455
+ new i({
3443
3456
  enabled: !0,
3444
3457
  tolerance: e,
3445
3458
  className: "flow-canvas-snapline"
@@ -3466,38 +3479,38 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3466
3479
  isAnchorTarget: { type: Function, default: void 0 }
3467
3480
  },
3468
3481
  emits: ["update:query", "select", "nextMatch", "prevMatch", "close"],
3469
- setup(n, { emit: e }) {
3470
- const o = n, t = e, s = H(null), r = H(null), i = H(-1);
3482
+ setup(s, { emit: e }) {
3483
+ const o = s, t = e, n = H(null), i = H(null), r = H(-1);
3471
3484
  ge(
3472
3485
  () => o.open,
3473
3486
  (u) => {
3474
- u && (i.value = -1, Ge(() => {
3475
- s.value?.focus(), s.value?.select();
3487
+ u && (r.value = -1, Ge(() => {
3488
+ n.value?.focus(), n.value?.select();
3476
3489
  }));
3477
3490
  }
3478
3491
  ), ge(
3479
3492
  () => o.query,
3480
3493
  () => {
3481
- i.value = -1;
3494
+ r.value = -1;
3482
3495
  }
3483
3496
  ), ge(
3484
3497
  () => o.results.length,
3485
3498
  (u) => {
3486
3499
  if (!u) {
3487
- i.value = -1;
3500
+ r.value = -1;
3488
3501
  return;
3489
3502
  }
3490
- i.value >= u && (i.value = -1);
3503
+ r.value >= u && (r.value = -1);
3491
3504
  }
3492
3505
  );
3493
3506
  function l(u) {
3494
3507
  t("update:query", u.target.value);
3495
3508
  }
3496
3509
  function a(u) {
3497
- i.value = u;
3510
+ r.value = u;
3498
3511
  }
3499
- function v() {
3500
- i.value = -1;
3512
+ function h() {
3513
+ r.value = -1;
3501
3514
  }
3502
3515
  function f(u) {
3503
3516
  if (u.key === "Escape") {
@@ -3506,17 +3519,17 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3506
3519
  }
3507
3520
  if (u.key === "ArrowDown") {
3508
3521
  if (u.preventDefault(), !o.results.length) return;
3509
- i.value = i.value < o.results.length - 1 ? i.value + 1 : 0;
3522
+ r.value = r.value < o.results.length - 1 ? r.value + 1 : 0;
3510
3523
  return;
3511
3524
  }
3512
3525
  if (u.key === "ArrowUp") {
3513
3526
  if (u.preventDefault(), !o.results.length) return;
3514
- i.value = i.value > 0 ? i.value - 1 : o.results.length - 1;
3527
+ r.value = r.value > 0 ? r.value - 1 : o.results.length - 1;
3515
3528
  return;
3516
3529
  }
3517
3530
  if (u.key === "Enter") {
3518
- if (u.preventDefault(), i.value >= 0) {
3519
- const w = o.results[i.value];
3531
+ if (u.preventDefault(), r.value >= 0) {
3532
+ const w = o.results[r.value];
3520
3533
  w && t("select", w.id);
3521
3534
  return;
3522
3535
  }
@@ -3526,30 +3539,30 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3526
3539
  function p(u) {
3527
3540
  if (!o.open) return;
3528
3541
  const w = u.target;
3529
- w && r.value?.contains(w) || o.isAnchorTarget?.(u.target) || t("close");
3542
+ w && i.value?.contains(w) || o.isAnchorTarget?.(u.target) || t("close");
3530
3543
  }
3531
3544
  return dt(() => {
3532
3545
  document.addEventListener("mousedown", p);
3533
3546
  }), Te(() => {
3534
3547
  document.removeEventListener("mousedown", p);
3535
- }), (u, w) => n.open ? (A(), T("div", {
3548
+ }), (u, w) => s.open ? (A(), T("div", {
3536
3549
  key: 0,
3537
3550
  ref_key: "panelRef",
3538
- ref: r,
3551
+ ref: i,
3539
3552
  class: "flow-canvas-search-popover",
3540
- style: Ee({ left: `${n.position.x}px`, top: `${n.position.y}px`, width: `${n.position.width}px` })
3553
+ style: Ee({ left: `${s.position.x}px`, top: `${s.position.y}px`, width: `${s.position.width}px` })
3541
3554
  }, [
3542
3555
  q("div", nn, [
3543
3556
  q("input", {
3544
3557
  ref_key: "inputRef",
3545
- ref: s,
3546
- value: n.query,
3547
- placeholder: n.placeholder,
3558
+ ref: n,
3559
+ value: s.query,
3560
+ placeholder: s.placeholder,
3548
3561
  onInput: l,
3549
3562
  onKeydown: f
3550
3563
  }, null, 40, sn),
3551
- n.query ? (A(), T(de, { key: 0 }, [
3552
- n.results.length ? (A(), T(de, { key: 1 }, [
3564
+ s.query ? (A(), T(de, { key: 0 }, [
3565
+ s.results.length ? (A(), T(de, { key: 1 }, [
3553
3566
  q("button", {
3554
3567
  type: "button",
3555
3568
  class: "flow-canvas-search-popover__nav-btn",
@@ -3571,7 +3584,7 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3571
3584
  })
3572
3585
  ], -1)
3573
3586
  ])]),
3574
- q("span", an, ce(n.matchIndex >= 0 ? n.matchIndex + 1 : 0) + " / " + ce(n.results.length), 1),
3587
+ q("span", an, ce(s.matchIndex >= 0 ? s.matchIndex + 1 : 0) + " / " + ce(s.results.length), 1),
3575
3588
  q("button", {
3576
3589
  type: "button",
3577
3590
  class: "flow-canvas-search-popover__nav-btn",
@@ -3597,15 +3610,15 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3597
3610
  ], 64)) : Y("", !0),
3598
3611
  w[4] || (w[4] = q("i", { class: "flow-canvas-icon canvas-search flow-canvas-search-popover__search-icon" }, null, -1))
3599
3612
  ]),
3600
- n.query && n.results.length ? (A(), T("div", {
3613
+ s.query && s.results.length ? (A(), T("div", {
3601
3614
  key: 0,
3602
3615
  class: "flow-canvas-search-popover__list-box",
3603
- onMouseleave: v
3616
+ onMouseleave: h
3604
3617
  }, [
3605
- (A(!0), T(de, null, Ce(n.results, (D, O) => (A(), T("button", {
3618
+ (A(!0), T(de, null, Ie(s.results, (D, O) => (A(), T("button", {
3606
3619
  key: D.id,
3607
3620
  type: "button",
3608
- class: te(["flow-canvas-search-popover__item", { "is-active": O === i.value, "is-matched": O === n.matchIndex }]),
3621
+ class: te(["flow-canvas-search-popover__item", { "is-active": O === r.value, "is-matched": O === s.matchIndex }]),
3609
3622
  onMouseenter: (b) => a(O),
3610
3623
  onClick: (b) => t("select", D.id)
3611
3624
  }, [
@@ -3615,36 +3628,36 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3615
3628
  ], 4)) : Y("", !0);
3616
3629
  }
3617
3630
  }), un = /* @__PURE__ */ ve(cn, [["__scopeId", "data-v-aca2b1c1"]]), nt = 282, fn = 4, gn = 300, _e = "flow-canvas-node-ring-target--search-match", Pe = "flow-canvas-node-ring-target--search-current", pn = "flow-canvas-node-ring-target";
3618
- function hn(n) {
3619
- return n !== null;
3631
+ function hn(s) {
3632
+ return s !== null;
3620
3633
  }
3621
- function vn(n) {
3634
+ function vn(s) {
3622
3635
  const e = /* @__PURE__ */ new Set();
3623
- return n.map((o) => o?.trim()).filter((o) => !!o).filter((o) => {
3636
+ return s.map((o) => o?.trim()).filter((o) => !!o).filter((o) => {
3624
3637
  const t = o.toLowerCase();
3625
3638
  return e.has(t) ? !1 : (e.add(t), !0);
3626
3639
  });
3627
3640
  }
3628
- function mn(n, e) {
3641
+ function mn(s, e) {
3629
3642
  const o = Math.max(8, window.innerWidth - e - 8);
3630
- return Math.min(Math.max(8, n), o);
3643
+ return Math.min(Math.max(8, s), o);
3631
3644
  }
3632
- function yn(n, e) {
3633
- const o = e?.getNodeMeta?.(n);
3645
+ function yn(s, e) {
3646
+ const o = e?.getNodeMeta?.(s);
3634
3647
  if (o === null) return null;
3635
- const t = o?.label?.trim() || n.label?.trim() || n.id, s = o?.subtitle?.trim() || void 0, r = vn(o?.keywords ?? [n.label, s]);
3636
- return r.length ? {
3637
- id: n.id,
3648
+ const t = o?.label?.trim() || s.label?.trim() || s.id, n = o?.subtitle?.trim() || void 0, i = vn(o?.keywords ?? [s.label, n]);
3649
+ return i.length ? {
3650
+ id: s.id,
3638
3651
  label: t,
3639
- subtitle: s,
3640
- keywords: r
3652
+ subtitle: n,
3653
+ keywords: i
3641
3654
  } : null;
3642
3655
  }
3643
- function On(n) {
3644
- let e = null, o = null, t = null, s = null, r = null, i = null;
3645
- const l = H(!1), a = H(""), v = H({ x: 0, y: 0, width: nt }), f = H(-1), p = V(() => e ? Object.values(e.flowModel.value.nodes).map((g) => yn(g, n)).filter(hn) : []), u = V(() => {
3646
- const g = a.value.trim().toLowerCase(), h = Math.max(1, n?.maxResults ?? gn);
3647
- return g ? p.value.filter((m) => m.keywords.some((E) => E.toLowerCase().includes(g))).slice(0, h) : p.value.slice(0, h);
3656
+ function On(s) {
3657
+ let e = null, o = null, t = null, n = null, i = null, r = null;
3658
+ const l = H(!1), a = H(""), h = H({ x: 0, y: 0, width: nt }), f = H(-1), p = V(() => e ? Object.values(e.flowModel.value.nodes).map((g) => yn(g, s)).filter(hn) : []), u = V(() => {
3659
+ const g = a.value.trim().toLowerCase(), v = Math.max(1, s?.maxResults ?? gn);
3660
+ return g ? p.value.filter((m) => m.keywords.some((E) => E.toLowerCase().includes(g))).slice(0, v) : p.value.slice(0, v);
3648
3661
  });
3649
3662
  function w() {
3650
3663
  return t?.querySelector('.flow-canvas-toolbar__btn[data-toolbar-type="search"]');
@@ -3653,10 +3666,10 @@ function On(n) {
3653
3666
  return w()?.closest(".flow-canvas-toolbar");
3654
3667
  }
3655
3668
  function O() {
3656
- const g = D(), h = t?.getBoundingClientRect(), m = g?.getBoundingClientRect() ?? h;
3669
+ const g = D(), v = t?.getBoundingClientRect(), m = g?.getBoundingClientRect() ?? v;
3657
3670
  if (!m) return;
3658
3671
  const E = Math.max(nt, Math.round(m.width));
3659
- v.value = {
3672
+ h.value = {
3660
3673
  x: mn(m.left, E),
3661
3674
  y: m.bottom + fn,
3662
3675
  width: E
@@ -3664,16 +3677,16 @@ function On(n) {
3664
3677
  }
3665
3678
  function b(g) {
3666
3679
  if (!o) return null;
3667
- const h = o.graph.getCellById(g);
3668
- if (!h?.isNode()) return null;
3669
- const m = o.graph.findViewByCell(h)?.container;
3680
+ const v = o.graph.getCellById(g);
3681
+ if (!v?.isNode()) return null;
3682
+ const m = o.graph.findViewByCell(v)?.container;
3670
3683
  return m ? m.querySelector(".flow-canvas-highlight-target") ?? m.querySelector(".flow-canvas-node-surface > :first-child") : null;
3671
3684
  }
3672
3685
  function S() {
3673
3686
  if (!o) return;
3674
3687
  const g = o.graph.getNodes();
3675
- for (const h of g) {
3676
- const m = b(h.id);
3688
+ for (const v of g) {
3689
+ const m = b(v.id);
3677
3690
  m && m.classList.remove(_e, Pe);
3678
3691
  }
3679
3692
  }
@@ -3684,28 +3697,28 @@ function On(n) {
3684
3697
  S();
3685
3698
  return;
3686
3699
  }
3687
- const h = new Set(u.value.map((L) => L.id)), m = f.value >= 0 ? u.value[f.value]?.id : null, E = o.graph.getNodes();
3700
+ const v = new Set(u.value.map((L) => L.id)), m = f.value >= 0 ? u.value[f.value]?.id : null, E = o.graph.getNodes();
3688
3701
  for (const L of E) {
3689
3702
  const z = b(L.id);
3690
- z && (z.classList.add(pn), L.id === m ? (z.classList.remove(_e), z.classList.add(Pe)) : h.has(L.id) ? (z.classList.remove(Pe), z.classList.add(_e)) : z.classList.remove(_e, Pe));
3703
+ z && (z.classList.add(pn), L.id === m ? (z.classList.remove(_e), z.classList.add(Pe)) : v.has(L.id) ? (z.classList.remove(Pe), z.classList.add(_e)) : z.classList.remove(_e, Pe));
3691
3704
  }
3692
3705
  }
3693
3706
  function B(g) {
3694
3707
  if (!o) return;
3695
- const h = u.value.findIndex((m) => m.id === g);
3696
- h >= 0 && (f.value = h), o.api.scrollToNode(g), M();
3708
+ const v = u.value.findIndex((m) => m.id === g);
3709
+ v >= 0 && (f.value = v), o.api.scrollToNode(g), M();
3697
3710
  }
3698
3711
  function j() {
3699
3712
  const g = u.value;
3700
3713
  if (g.length === 0) return;
3701
- const h = f.value < g.length - 1 ? f.value + 1 : 0;
3702
- f.value = h, B(g[h].id);
3714
+ const v = f.value < g.length - 1 ? f.value + 1 : 0;
3715
+ f.value = v, B(g[v].id);
3703
3716
  }
3704
3717
  function k() {
3705
3718
  const g = u.value;
3706
3719
  if (g.length === 0) return;
3707
- const h = f.value > 0 ? f.value - 1 : g.length - 1;
3708
- f.value = h, B(g[h].id);
3720
+ const v = f.value > 0 ? f.value - 1 : g.length - 1;
3721
+ f.value = v, B(g[v].id);
3709
3722
  }
3710
3723
  function X() {
3711
3724
  o && (l.value = !0, O(), requestAnimationFrame(() => O()));
@@ -3721,8 +3734,8 @@ function On(n) {
3721
3734
  X();
3722
3735
  }
3723
3736
  function d(g) {
3724
- const h = w();
3725
- return !!(h && g instanceof Node && h.contains(g));
3737
+ const v = w();
3738
+ return !!(v && g instanceof Node && v.contains(g));
3726
3739
  }
3727
3740
  function y() {
3728
3741
  l.value && O();
@@ -3732,11 +3745,11 @@ function On(n) {
3732
3745
  setup() {
3733
3746
  return () => qe(un, {
3734
3747
  open: l.value,
3735
- position: v.value,
3748
+ position: h.value,
3736
3749
  query: a.value,
3737
3750
  results: u.value,
3738
3751
  matchIndex: f.value,
3739
- placeholder: n?.placeholder ?? "搜索节点名称",
3752
+ placeholder: s?.placeholder ?? "搜索节点名称",
3740
3753
  isAnchorTarget: d,
3741
3754
  "onUpdate:query": (g) => {
3742
3755
  a.value = g, f.value = -1;
@@ -3755,7 +3768,7 @@ function On(n) {
3755
3768
  e = g;
3756
3769
  },
3757
3770
  attachRuntime(g) {
3758
- o = g, t = g.graph.container.closest(".flow-canvas-layout__content") ?? g.graph.container.parentElement, s = document.createElement("div"), s.className = "flow-canvas-search-host", document.body.append(s), r = bt(c), r.mount(s), i = ge(
3771
+ o = g, t = g.graph.container.closest(".flow-canvas-layout__content") ?? g.graph.container.parentElement, n = document.createElement("div"), n.className = "flow-canvas-search-host", document.body.append(n), i = bt(c), i.mount(n), r = ge(
3759
3772
  () => [a.value, u.value.length],
3760
3773
  () => {
3761
3774
  f.value = -1, M();
@@ -3763,10 +3776,10 @@ function On(n) {
3763
3776
  ), window.addEventListener("resize", y), window.addEventListener("scroll", y, !0);
3764
3777
  },
3765
3778
  detachRuntime() {
3766
- U(), i?.(), i = null, window.removeEventListener("resize", y), window.removeEventListener("scroll", y, !0), r?.unmount(), r = null, s?.remove(), s = null, t = null, o = null;
3779
+ U(), r?.(), r = null, window.removeEventListener("resize", y), window.removeEventListener("scroll", y, !0), i?.unmount(), i = null, n?.remove(), n = null, t = null, o = null;
3767
3780
  },
3768
3781
  dispose() {
3769
- U(), i?.(), i = null, e = null;
3782
+ U(), r?.(), r = null, e = null;
3770
3783
  },
3771
3784
  provideToolbarItems() {
3772
3785
  return [
@@ -3784,53 +3797,53 @@ function On(n) {
3784
3797
  }
3785
3798
  };
3786
3799
  }
3787
- const st = 52, rt = 16, pt = 4, wn = 40;
3788
- function bn(n) {
3789
- const { mountRect: e, toolbarRect: o, fallbackLeft: t, fallbackTop: s, fallbackWidth: r, height: i } = n, l = n.offset ?? pt;
3800
+ const st = 52, it = 16, pt = 4, wn = 40;
3801
+ function bn(s) {
3802
+ const { mountRect: e, toolbarRect: o, fallbackLeft: t, fallbackTop: n, fallbackWidth: i, height: r } = s, l = s.offset ?? pt;
3790
3803
  return !o || o.width <= 0 ? {
3791
3804
  left: t,
3792
- top: s,
3793
- width: r,
3794
- height: i
3805
+ top: n,
3806
+ width: i,
3807
+ height: r
3795
3808
  } : {
3796
3809
  left: Math.round(o.left - e.left),
3797
3810
  top: Math.round(o.bottom - e.top + l),
3798
3811
  width: Math.round(o.width),
3799
- height: i
3812
+ height: r
3800
3813
  };
3801
3814
  }
3802
- function En(n) {
3815
+ function En(s) {
3803
3816
  const e = document.createElement("div");
3804
- e.className = "flow-canvas-minimap", n.floating !== !1 && e.classList.add("flow-canvas-minimap--floating");
3817
+ e.className = "flow-canvas-minimap", s.floating !== !1 && e.classList.add("flow-canvas-minimap--floating");
3805
3818
  const o = document.createElement("div");
3806
3819
  o.className = "flow-canvas-minimap__host", e.append(o), Object.assign(e.style, {
3807
- width: `${n.width}px`,
3808
- height: `${n.height}px`
3809
- }), n.floating !== !1 && Object.assign(e.style, {
3820
+ width: `${s.width}px`,
3821
+ height: `${s.height}px`
3822
+ }), s.floating !== !1 && Object.assign(e.style, {
3810
3823
  top: `${st}px`,
3811
- left: `${rt}px`
3824
+ left: `${it}px`
3812
3825
  });
3813
- let t = null, s = n.defaultOpen ?? !1, r = null, i = null, l = null, a = null, v = {
3814
- width: n.width,
3815
- height: n.height
3826
+ let t = null, n = s.defaultOpen ?? !1, i = null, r = null, l = null, a = null, h = {
3827
+ width: s.width,
3828
+ height: s.height
3816
3829
  };
3817
3830
  function f(k, X) {
3818
3831
  if (!t) return;
3819
3832
  const U = t;
3820
- U.options.width = k, U.options.height = X, U.updatePaper(n.sourceGraph.container.clientWidth, n.sourceGraph.container.clientHeight);
3833
+ U.options.width = k, U.options.height = X, U.updatePaper(s.sourceGraph.container.clientWidth, s.sourceGraph.container.clientHeight);
3821
3834
  }
3822
3835
  function p() {
3823
- if (n.floating === !1) return;
3836
+ if (s.floating === !1) return;
3824
3837
  const k = bn({
3825
- mountRect: n.mountTarget.getBoundingClientRect(),
3826
- toolbarRect: n.getToolbarElement?.()?.getBoundingClientRect() ?? null,
3827
- fallbackLeft: rt,
3838
+ mountRect: s.mountTarget.getBoundingClientRect(),
3839
+ toolbarRect: s.getToolbarElement?.()?.getBoundingClientRect() ?? null,
3840
+ fallbackLeft: it,
3828
3841
  fallbackTop: st,
3829
- fallbackWidth: n.width,
3830
- height: n.height,
3831
- offset: n.panelOffset ?? pt
3842
+ fallbackWidth: s.width,
3843
+ height: s.height,
3844
+ offset: s.panelOffset ?? pt
3832
3845
  });
3833
- v = {
3846
+ h = {
3834
3847
  width: k.width,
3835
3848
  height: k.height
3836
3849
  }, Object.assign(e.style, {
@@ -3841,70 +3854,70 @@ function En(n) {
3841
3854
  }), f(k.width, k.height);
3842
3855
  }
3843
3856
  function u() {
3844
- if (n.floating === !1 || typeof ResizeObserver > "u") return;
3845
- const k = n.getToolbarElement?.() ?? null;
3846
- i || (i = new ResizeObserver(() => {
3847
- s && (u(), p());
3848
- })), a !== k && (i.disconnect(), i.observe(n.mountTarget), k && i.observe(k), a = k);
3857
+ if (s.floating === !1 || typeof ResizeObserver > "u") return;
3858
+ const k = s.getToolbarElement?.() ?? null;
3859
+ r || (r = new ResizeObserver(() => {
3860
+ n && (u(), p());
3861
+ })), a !== k && (r.disconnect(), r.observe(s.mountTarget), k && r.observe(k), a = k);
3849
3862
  }
3850
3863
  function w() {
3851
- n.floating !== !1 && (p(), u(), l || (l = () => {
3852
- s && (u(), p());
3864
+ s.floating !== !1 && (p(), u(), l || (l = () => {
3865
+ n && (u(), p());
3853
3866
  }, window.addEventListener("resize", l)));
3854
3867
  }
3855
3868
  function D() {
3856
- l && (window.removeEventListener("resize", l), l = null), i?.disconnect(), i = null, a = null;
3869
+ l && (window.removeEventListener("resize", l), l = null), r?.disconnect(), r = null, a = null;
3857
3870
  }
3858
3871
  function O() {
3859
- !n.onClickOutside || r || (r = (k) => {
3872
+ !s.onClickOutside || i || (i = (k) => {
3860
3873
  const X = k.target;
3861
- X && e.contains(X) || k.target?.closest('[data-toolbar-type="minimap"]') || k.target?.closest(".flow-canvas-layout__content") || n.onClickOutside();
3862
- }, document.addEventListener("mousedown", r));
3874
+ X && e.contains(X) || k.target?.closest('[data-toolbar-type="minimap"]') || k.target?.closest(".flow-canvas-layout__content") || s.onClickOutside();
3875
+ }, document.addEventListener("mousedown", i));
3863
3876
  }
3864
3877
  function b() {
3865
- r && (document.removeEventListener("mousedown", r), r = null);
3878
+ i && (document.removeEventListener("mousedown", i), i = null);
3866
3879
  }
3867
3880
  function S() {
3868
3881
  t || (t = new Ct({
3869
3882
  container: o,
3870
- width: v.width,
3871
- height: v.height,
3872
- padding: n.contentPadding ?? wn,
3883
+ width: h.width,
3884
+ height: h.height,
3885
+ padding: s.contentPadding ?? wn,
3873
3886
  scalable: !1
3874
- }), n.sourceGraph.use(t));
3887
+ }), s.sourceGraph.use(t));
3875
3888
  }
3876
3889
  function M(k) {
3877
- s = k, e.style.display = s ? "" : "none", s ? (w(), S(), O(), requestAnimationFrame(() => {
3878
- s && (u(), p());
3890
+ n = k, e.style.display = n ? "" : "none", n ? (w(), S(), O(), requestAnimationFrame(() => {
3891
+ n && (u(), p());
3879
3892
  })) : (b(), D());
3880
3893
  }
3881
3894
  function B() {
3882
- M(s), n.mountTarget.appendChild(e);
3895
+ M(n), s.mountTarget.appendChild(e);
3883
3896
  }
3884
3897
  function j() {
3885
3898
  b(), D(), t?.dispose(), t = null, e.remove();
3886
3899
  }
3887
3900
  return B(), {
3888
3901
  element: e,
3889
- isOpen: () => s,
3902
+ isOpen: () => n,
3890
3903
  setOpen: M,
3891
3904
  toggle() {
3892
- const k = !s;
3905
+ const k = !n;
3893
3906
  return M(k), k;
3894
3907
  },
3895
3908
  destroy: j
3896
3909
  };
3897
3910
  }
3898
- function $n(n) {
3911
+ function $n(s) {
3899
3912
  let e = null, o = null;
3900
3913
  const t = H(!1);
3901
- function s() {
3914
+ function n() {
3902
3915
  return o?.querySelector('.flow-canvas-toolbar__btn[data-toolbar-type="minimap"]');
3903
3916
  }
3904
- function r() {
3905
- return s()?.closest(".flow-canvas-toolbar");
3917
+ function i() {
3918
+ return n()?.closest(".flow-canvas-toolbar");
3906
3919
  }
3907
- function i(a) {
3920
+ function r(a) {
3908
3921
  e?.setOpen(a), t.value = a;
3909
3922
  }
3910
3923
  function l() {
@@ -3914,19 +3927,19 @@ function $n(n) {
3914
3927
  name: "minimap",
3915
3928
  priority: 90,
3916
3929
  attachRuntime(a) {
3917
- const v = a, f = n?.width ?? 334, p = n?.height ?? 180;
3918
- o = v.graph.container.closest(".flow-canvas-layout__content") ?? v.graph.container.parentElement;
3919
- const u = n?.container ?? o;
3930
+ const h = a, f = s?.width ?? 334, p = s?.height ?? 180;
3931
+ o = h.graph.container.closest(".flow-canvas-layout__content") ?? h.graph.container.parentElement;
3932
+ const u = s?.container ?? o;
3920
3933
  u && (e = En({
3921
3934
  sourceGraph: a.graph,
3922
3935
  mountTarget: u,
3923
3936
  width: f,
3924
3937
  height: p,
3925
- floating: !n?.container,
3938
+ floating: !s?.container,
3926
3939
  defaultOpen: !1,
3927
- getToolbarElement: n?.container ? void 0 : r,
3928
- onClickOutside: () => i(!1)
3929
- }), i(!1));
3940
+ getToolbarElement: s?.container ? void 0 : i,
3941
+ onClickOutside: () => r(!1)
3942
+ }), r(!1));
3930
3943
  },
3931
3944
  detachRuntime() {
3932
3945
  e?.destroy(), e = null, o = null, t.value = !1;
@@ -3948,50 +3961,50 @@ function $n(n) {
3948
3961
  };
3949
3962
  }
3950
3963
  function Bn() {
3951
- let n = null, e = 0;
3964
+ let s = null, e = 0;
3952
3965
  return {
3953
3966
  name: "clipboard",
3954
3967
  priority: 90,
3955
3968
  onKeyboardShortcut(o, t) {
3956
- const s = o.metaKey || o.ctrlKey;
3957
- if (s && o.key === "c") {
3958
- const r = t.graph.getSelectedCells?.() ?? [];
3959
- if (!r.length) return !1;
3960
- const i = t.flowModel.value, l = new Set(r.filter((f) => f.isNode()).map((f) => f.id)), a = [...l].map((f) => i.nodes[f]).filter(Boolean);
3969
+ const n = o.metaKey || o.ctrlKey;
3970
+ if (n && o.key === "c") {
3971
+ const i = t.graph.getSelectedCells?.() ?? [];
3972
+ if (!i.length) return !1;
3973
+ const r = t.flowModel.value, l = new Set(i.filter((f) => f.isNode()).map((f) => f.id)), a = [...l].map((f) => r.nodes[f]).filter(Boolean);
3961
3974
  if (!a.length) return !1;
3962
- const v = Object.values(i.edges).filter(
3975
+ const h = Object.values(r.edges).filter(
3963
3976
  (f) => l.has(f.source.nodeId) && l.has(f.target.nodeId)
3964
3977
  );
3965
- return n = { nodes: a, edges: v }, e = 0, !0;
3978
+ return s = { nodes: a, edges: h }, e = 0, !0;
3966
3979
  }
3967
- if (s && o.key === "v") {
3968
- if (!n?.nodes.length) return !1;
3980
+ if (n && o.key === "v") {
3981
+ if (!s?.nodes.length) return !1;
3969
3982
  e++;
3970
- const r = e * 30, i = /* @__PURE__ */ new Map(), l = [];
3971
- for (const a of n.nodes) {
3972
- const v = `${a.id}_cp${J().slice(0, 6)}`;
3973
- i.set(a.id, v), l.push({
3983
+ const i = e * 30, r = /* @__PURE__ */ new Map(), l = [];
3984
+ for (const a of s.nodes) {
3985
+ const h = `${a.id}_cp${J().slice(0, 6)}`;
3986
+ r.set(a.id, h), l.push({
3974
3987
  type: "node.add",
3975
3988
  node: {
3976
3989
  ...a,
3977
- id: v,
3990
+ id: h,
3978
3991
  position: {
3979
- x: a.position.x + r,
3980
- y: a.position.y + r
3992
+ x: a.position.x + i,
3993
+ y: a.position.y + i
3981
3994
  },
3982
3995
  payload: a.payload ? { ...a.payload } : {},
3983
3996
  extensions: a.extensions ? { ...a.extensions } : void 0
3984
3997
  }
3985
3998
  });
3986
3999
  }
3987
- for (const a of n.edges) {
3988
- const v = i.get(a.source.nodeId), f = i.get(a.target.nodeId);
3989
- !v || !f || l.push({
4000
+ for (const a of s.edges) {
4001
+ const h = r.get(a.source.nodeId), f = r.get(a.target.nodeId);
4002
+ !h || !f || l.push({
3990
4003
  type: "edge.add",
3991
4004
  edge: {
3992
4005
  ...a,
3993
4006
  id: `${a.id}_cp${J().slice(0, 6)}`,
3994
- source: { ...a.source, nodeId: v },
4007
+ source: { ...a.source, nodeId: h },
3995
4008
  target: { ...a.target, nodeId: f },
3996
4009
  labels: a.labels?.map((p) => ({ ...p, id: `${p.id}_cp${J().slice(0, 6)}` })),
3997
4010
  payload: a.payload ? { ...a.payload } : {}