@blueking/flow-canvas 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ref as q, computed as j, onScopeDispose as Je, defineComponent as ge, h as Re, watch as he, onBeforeUnmount as Me, createElementBlock as T, openBlock as D, normalizeStyle as be, createElementVNode as F, createVNode as et, createCommentVNode as Z, normalizeClass as se, Transition as tt, withCtx as $e, withModifiers as at, createTextVNode as Ge, renderSlot as Ie, onMounted as ot, createBlock as we, Fragment as pe, renderList as Ee, toDisplayString as ue, unref as le, reactive as lt, resolveDynamicComponent as dt, Teleport as ct, nextTick as Le, inject as ut, createApp as ft } from "vue";
1
+ import { ref as G, computed as j, onScopeDispose as Je, defineComponent as ge, h as Re, watch as he, onBeforeUnmount as Me, createElementBlock as T, openBlock as _, normalizeStyle as we, createElementVNode as q, createVNode as et, createCommentVNode as Z, normalizeClass as se, Transition as tt, withCtx as $e, withModifiers as at, createTextVNode as He, renderSlot as Ie, onMounted as ot, createBlock as be, Fragment as pe, renderList as xe, toDisplayString as ue, unref as le, reactive as lt, resolveDynamicComponent as dt, Teleport as ct, nextTick as Le, inject as ut, createApp as ft } from "vue";
2
2
  import { Graph as gt } from "@antv/x6";
3
3
  import { register as pt } from "@antv/x6-vue-shape";
4
4
  import { Selection as ht } from "@antv/x6-plugin-selection";
@@ -20,7 +20,7 @@ class yt extends Error {
20
20
  super(e), this.name = "CanvasSchemaError";
21
21
  }
22
22
  }
23
- function _e(s, e, t) {
23
+ function De(s, e, t) {
24
24
  if (e.length === 0) {
25
25
  if (t === void 0) return;
26
26
  if (typeof t != "object" || t === null || Array.isArray(t))
@@ -41,13 +41,13 @@ function nt(s, e) {
41
41
  case "node.add":
42
42
  return mt(s, e.node);
43
43
  case "node.move":
44
- return bt(s, e.nodeId, e.position);
44
+ return wt(s, e.nodeId, e.position);
45
45
  case "node.remove":
46
- return wt(s, e.nodeId);
46
+ return bt(s, e.nodeId);
47
47
  case "node.update":
48
- return Et(s, e.nodeId, e.patch);
48
+ return xt(s, e.nodeId, e.patch);
49
49
  case "node.set-payload":
50
- return xt(s, e.nodeId, e.path, e.value);
50
+ return Et(s, e.nodeId, e.path, e.value);
51
51
  case "node.set-extensions":
52
52
  return It(s, e.nodeId, e.path, e.value);
53
53
  case "edge.add":
@@ -59,11 +59,11 @@ function nt(s, e) {
59
59
  case "edge.update":
60
60
  return Mt(s, e.edgeId, e.patch);
61
61
  case "edge.set-payload":
62
- return _t(s, e.edgeId, e.path, e.value);
62
+ return Dt(s, e.edgeId, e.path, e.value);
63
63
  case "edge.label.update":
64
64
  return Nt(s, e.edgeId, e.labelId, e.patch);
65
65
  case "model.set-meta":
66
- return Dt(s, e.path, e.value);
66
+ return _t(s, e.path, e.value);
67
67
  default:
68
68
  throw new fe(`Unknown command type: ${e.type}`);
69
69
  }
@@ -78,7 +78,7 @@ function ke(s, e) {
78
78
  if (!t) throw new fe(`Edge "${e}" does not exist`);
79
79
  return t;
80
80
  }
81
- function xe(s, e, t) {
81
+ function Ee(s, e, t) {
82
82
  const o = s.nodes[e.nodeId];
83
83
  if (!o)
84
84
  throw new fe(`${t} node "${e.nodeId}" does not exist`);
@@ -88,7 +88,7 @@ function xe(s, e, t) {
88
88
  function Ne(s, e, t) {
89
89
  return { ...s, nodes: { ...s.nodes, [e]: t } };
90
90
  }
91
- function De(s, e, t) {
91
+ function _e(s, e, t) {
92
92
  return { ...s, edges: { ...s.edges, [e]: t } };
93
93
  }
94
94
  function mt(s, e) {
@@ -96,33 +96,33 @@ function mt(s, e) {
96
96
  throw new fe(`Node id "${e.id}" already exists`);
97
97
  return { ...s, nodes: { ...s.nodes, [e.id]: e } };
98
98
  }
99
- function bt(s, e, t) {
99
+ function wt(s, e, t) {
100
100
  const o = Ce(s, e);
101
101
  return Ne(s, e, { ...o, position: t });
102
102
  }
103
- function wt(s, e) {
103
+ function bt(s, e) {
104
104
  Ce(s, e);
105
105
  const { [e]: t, ...o } = s.nodes, n = {};
106
106
  for (const [i, r] of Object.entries(s.edges))
107
107
  r.source.nodeId !== e && r.target.nodeId !== e && (n[i] = r);
108
108
  return { ...s, nodes: o, edges: n };
109
109
  }
110
- function Et(s, e, t) {
110
+ function xt(s, e, t) {
111
111
  const o = Ce(s, e);
112
112
  return Ne(s, e, { ...o, ...t, id: o.id });
113
113
  }
114
- function xt(s, e, t, o) {
115
- const n = Ce(s, e), i = _e(n.payload, t, o);
114
+ function Et(s, e, t, o) {
115
+ const n = Ce(s, e), i = De(n.payload, t, o);
116
116
  return Ne(s, e, { ...n, payload: i });
117
117
  }
118
118
  function It(s, e, t, o) {
119
- const n = Ce(s, e), i = _e(n.extensions, t, o);
119
+ const n = Ce(s, e), i = De(n.extensions, t, o);
120
120
  return Ne(s, e, { ...n, extensions: i });
121
121
  }
122
122
  function Ct(s, e) {
123
123
  if (s.edges[e.id])
124
124
  throw new fe(`Edge id "${e.id}" already exists`);
125
- if (xe(s, e.source, "Source"), xe(s, e.target, "Target"), e.labels) {
125
+ if (Ee(s, e.source, "Source"), Ee(s, e.target, "Target"), e.labels) {
126
126
  const t = /* @__PURE__ */ new Set();
127
127
  for (const o of e.labels) {
128
128
  if (t.has(o.id))
@@ -139,15 +139,15 @@ function kt(s, e) {
139
139
  }
140
140
  function St(s, e, t, o) {
141
141
  const n = ke(s, e), i = t ?? n.source, r = o ?? n.target;
142
- return xe(s, i, "Source"), xe(s, r, "Target"), De(s, e, { ...n, source: i, target: r });
142
+ return Ee(s, i, "Source"), Ee(s, r, "Target"), _e(s, e, { ...n, source: i, target: r });
143
143
  }
144
144
  function Mt(s, e, t) {
145
145
  const o = ke(s, e), n = { ...o, ...t, id: o.id };
146
- return t.source && xe(s, n.source, "Source"), t.target && xe(s, n.target, "Target"), De(s, e, n);
146
+ return t.source && Ee(s, n.source, "Source"), t.target && Ee(s, n.target, "Target"), _e(s, e, n);
147
147
  }
148
- function _t(s, e, t, o) {
149
- const n = ke(s, e), i = _e(n.payload, t, o);
150
- return De(s, e, { ...n, payload: i });
148
+ function Dt(s, e, t, o) {
149
+ const n = ke(s, e), i = De(n.payload, t, o);
150
+ return _e(s, e, { ...n, payload: i });
151
151
  }
152
152
  function Nt(s, e, t, o) {
153
153
  const n = ke(s, e);
@@ -157,14 +157,14 @@ function Nt(s, e, t, o) {
157
157
  if (i === -1)
158
158
  throw new fe(`Label "${t}" not found in edge "${e}"`);
159
159
  const r = [...n.labels];
160
- return r[i] = { ...r[i], ...o, id: t }, De(s, e, { ...n, labels: r });
160
+ return r[i] = { ...r[i], ...o, id: t }, _e(s, e, { ...n, labels: r });
161
161
  }
162
- function Dt(s, e, t) {
163
- const o = _e(s.meta, e, t);
162
+ function _t(s, e, t) {
163
+ const o = De(s.meta, e, t);
164
164
  return { ...s, meta: o };
165
165
  }
166
166
  function At(s, e) {
167
- const t = e?.maxHistorySize ?? 100, o = q(s), n = [], i = [], r = q(!1), l = q(!1);
167
+ const t = e?.maxHistorySize ?? 100, o = G(s), n = [], i = [], r = G(!1), l = G(!1);
168
168
  function a() {
169
169
  r.value = n.length > 0, l.value = i.length > 0;
170
170
  }
@@ -199,7 +199,7 @@ function At(s, e) {
199
199
  function g() {
200
200
  n.length = 0, i.length = 0, a();
201
201
  }
202
- function E() {
202
+ function x() {
203
203
  return o.value;
204
204
  }
205
205
  function m(C) {
@@ -219,7 +219,7 @@ function At(s, e) {
219
219
  return i.map((C) => C.envelope);
220
220
  },
221
221
  clear: g,
222
- createSnapshot: E,
222
+ createSnapshot: x,
223
223
  replaceFlowModel: m
224
224
  };
225
225
  }
@@ -397,8 +397,8 @@ function te() {
397
397
  }
398
398
  const Be = () => te();
399
399
  function hn(s) {
400
- const { schema: e, plugins: t = [], historyOptions: o } = s, n = s.idGenerator ?? Be, i = { version: "1.0", ...s.initialFlowModel }, r = At(i, o), l = q(s.mode ?? "edit"), a = q(!1), h = q(null), u = q([]), p = {}, g = new Tt();
401
- function E(R, A, B, V = "user:toolbar") {
400
+ const { schema: e, plugins: t = [], historyOptions: o } = s, n = s.idGenerator ?? Be, i = { version: "1.0", ...s.initialFlowModel }, r = At(i, o), l = G(s.mode ?? "edit"), a = G(!1), h = G(null), u = G([]), p = {}, g = new Tt();
401
+ function x(R, A, B, V = "user:toolbar") {
402
402
  const O = {
403
403
  id: `history-${Date.now()}`,
404
404
  source: V,
@@ -421,11 +421,11 @@ function hn(s) {
421
421
  execute: r.execute,
422
422
  undo() {
423
423
  const R = r.currentFlowModel.value, A = r.undo();
424
- return A && E("撤销", R, A), A;
424
+ return A && x("撤销", R, A), A;
425
425
  },
426
426
  redo() {
427
427
  const R = r.currentFlowModel.value, A = r.redo();
428
- return A && E("重做", R, A), A;
428
+ return A && x("重做", R, A), A;
429
429
  },
430
430
  get canUndo() {
431
431
  return r.canUndo;
@@ -443,7 +443,7 @@ function hn(s) {
443
443
  createSnapshot: r.createSnapshot,
444
444
  replaceFlowModel(R) {
445
445
  const A = r.currentFlowModel.value;
446
- r.replaceFlowModel(R), E("替换 FlowModel", A, R, "system:replace");
446
+ r.replaceFlowModel(R), x("替换 FlowModel", A, R, "system:replace");
447
447
  }
448
448
  }, C = {
449
449
  flowModel: j(() => r.currentFlowModel.value),
@@ -525,10 +525,10 @@ const Lt = ["top", "right", "bottom", "left"];
525
525
  function st() {
526
526
  return Lt.map((s) => ({ id: s, group: s }));
527
527
  }
528
- function He(s, e) {
528
+ function Fe(s, e) {
529
529
  return e?.(s) ?? s.ports ?? st();
530
530
  }
531
- const Te = -1, Ot = "flow-canvas-node-ring-target", qe = "flow-canvas-node-ring-target--decorated", Fe = "flow-canvas-node-ring-target--pulse", $t = "linear-gradient(135deg, #cadcfa 0%, #cee0ff 100%)";
531
+ const Te = -1, Ot = "flow-canvas-node-ring-target", Ge = "flow-canvas-node-ring-target--decorated", qe = "flow-canvas-node-ring-target--pulse", $t = "linear-gradient(135deg, #cadcfa 0%, #cee0ff 100%)";
532
532
  class Bt {
533
533
  graph;
534
534
  schema;
@@ -554,6 +554,7 @@ class Bt {
554
554
  /** x6EdgeConfig 中 attrs.line 的基线值,清理时恢复而非删除 */
555
555
  edgeDefaultAttrs = /* @__PURE__ */ new Map();
556
556
  lastModel = null;
557
+ pendingDecorationRAFs = /* @__PURE__ */ new Map();
557
558
  constructor(e, t, o, n, i, r) {
558
559
  this.graph = e, this.schema = t, this.shapeRegistry = o, this.resolveNodeDecoration = n, this.resolveEdgeDecoration = i, this.resolveCanvasContext = r;
559
560
  }
@@ -629,7 +630,9 @@ class Bt {
629
630
  e.removeAttrByPath(r), i !== void 0 && e.setAttrByPath(r, i);
630
631
  }
631
632
  dispose() {
632
- this.knownNodeIds.clear(), this.knownEdgeIds.clear();
633
+ for (const e of this.pendingDecorationRAFs.values())
634
+ cancelAnimationFrame(e);
635
+ this.pendingDecorationRAFs.clear(), this.knownNodeIds.clear(), this.knownEdgeIds.clear();
633
636
  }
634
637
  resolveNodes(e) {
635
638
  const t = /* @__PURE__ */ new Map();
@@ -639,7 +642,7 @@ class Bt {
639
642
  throw new yt(
640
643
  `Unknown node type "${n.type}" for node "${o}". Registered types: [${Object.keys(this.schema.nodeTypes).join(", ")}]. Register the type in CanvasSchema.nodeTypes before using it in a FlowModel.`
641
644
  );
642
- const r = this.shapeRegistry.registerNodeType(n.type, i.component), l = i.getSize(n), a = He(n, i.getPorts);
645
+ const r = this.shapeRegistry.registerNodeType(n.type, i.component), l = i.getSize(n), a = Fe(n, i.getPorts);
643
646
  t.set(o, { model: n, definition: i, shapeName: r, size: l, ports: a });
644
647
  }
645
648
  return t;
@@ -658,6 +661,8 @@ class Bt {
658
661
  if (!t.has(o)) {
659
662
  const n = this.graph.getCellById(o);
660
663
  n && this.graph.removeCell(n), this.knownNodeIds.delete(o), this.defaultHighlightedNodeIds.delete(o), this.prevNodeDecorationClasses.delete(o), this.prevNodeDecorationColors.delete(o), this.nodeDefaultAttrs.delete(o);
664
+ const i = this.pendingDecorationRAFs.get(o);
665
+ i && (cancelAnimationFrame(i), this.pendingDecorationRAFs.delete(o));
661
666
  }
662
667
  for (const [o, n] of e) {
663
668
  const i = this.graph.getCellById(o);
@@ -724,7 +729,27 @@ class Bt {
724
729
  };
725
730
  this.graph.addNode(a), this.knownNodeIds.add(e), this.saveNodeDefaultAttrs(e, l);
726
731
  const h = this.graph.getCellById(e);
727
- h && (this.applyNodeBehavior(h, o, l), this.applyNodeHighlightAndDecoration(h, o));
732
+ h && (this.applyNodeBehavior(h, o, l), this.applyNodeHighlightAndDecoration(h, o), this.scheduleDecorationRetryIfNeeded(h, o));
733
+ }
734
+ /**
735
+ * Vue Shape 组件在 foreignObject 内异步挂载,addNewNode 同步调用
736
+ * applyNodeHighlightAndDecoration 时 ringTarget DOM 可能尚不存在。
737
+ * 延迟一帧重试,确保装饰环在节点首次渲染后即正确显示,
738
+ * 避免后续 refreshNodeHighlights 触发时装饰环才首次出现。
739
+ */
740
+ scheduleDecorationRetryIfNeeded(e, t) {
741
+ const o = this.graph.findViewByCell(e)?.container;
742
+ if (this.getNodeRingTarget(o)) return;
743
+ const n = e.id, i = this.pendingDecorationRAFs.get(n);
744
+ i && cancelAnimationFrame(i);
745
+ const r = requestAnimationFrame(() => {
746
+ if (this.pendingDecorationRAFs.delete(n), !this.knownNodeIds.has(n)) return;
747
+ const l = this.lastModel?.nodes[n];
748
+ if (!l) return;
749
+ const a = this.graph.getCellById(n);
750
+ a?.isNode() && this.applyNodeHighlightAndDecoration(a, l);
751
+ });
752
+ this.pendingDecorationRAFs.set(n, r);
728
753
  }
729
754
  /**
730
755
  * 将 schema 定义的 getBehavior 映射到 X6 节点属性。
@@ -869,10 +894,10 @@ class Bt {
869
894
  const o = this.highlightedNodeIds.has(e.id), n = this.resolveNodeDecoration?.(t), i = this.graph.findViewByCell(e)?.container, r = this.getNodeRingTarget(i), l = this.prevNodeDecorationClasses.get(e.id);
870
895
  l && (i?.classList.remove(l), this.prevNodeDecorationClasses.delete(e.id)), n?.className && (i?.classList.add(n.className), this.prevNodeDecorationClasses.set(e.id, n.className));
871
896
  const a = n?.borderColor, u = a ?? (o ? "#3a84ff" : void 0), p = this.prevNodeDecorationColors.has(e.id) || this.defaultHighlightedNodeIds.has(e.id);
872
- u ? (e.setAttrByPath("body/stroke", u), e.setAttrByPath("body/strokeWidth", 2)) : p && (this.restoreNodeAttr(e, "body/stroke", "stroke"), this.restoreNodeAttr(e, "body/strokeWidth", "strokeWidth")), r && (r.classList.add(Ot), a ? (r.classList.add(qe), r.style.setProperty("--flow-canvas-node-decoration-ring-background", a), r.style.setProperty("--flow-canvas-node-decoration-ring-opacity", "0.95")) : (r.classList.remove(qe), r.style.removeProperty("--flow-canvas-node-decoration-ring-background"), r.style.removeProperty("--flow-canvas-node-decoration-ring-opacity")), o ? (r.classList.add(Fe), r.style.setProperty(
897
+ u ? (e.setAttrByPath("body/stroke", u), e.setAttrByPath("body/strokeWidth", 2)) : p && (this.restoreNodeAttr(e, "body/stroke", "stroke"), this.restoreNodeAttr(e, "body/strokeWidth", "strokeWidth")), r && (r.classList.add(Ot), a ? (r.classList.add(Ge), r.style.setProperty("--flow-canvas-node-decoration-ring-background", a), r.style.setProperty("--flow-canvas-node-decoration-ring-opacity", "0.95")) : (r.classList.remove(Ge), r.style.removeProperty("--flow-canvas-node-decoration-ring-background"), r.style.removeProperty("--flow-canvas-node-decoration-ring-opacity")), o ? (r.classList.add(qe), r.style.setProperty(
873
898
  "--flow-canvas-node-pulse-ring-background",
874
899
  a ?? $t
875
- ), r.style.setProperty("--flow-canvas-node-pulse-ring-opacity", "0.95")) : (r.classList.remove(Fe), r.style.removeProperty("--flow-canvas-node-pulse-ring-background"), r.style.removeProperty("--flow-canvas-node-pulse-ring-opacity"))), a ? this.prevNodeDecorationColors.add(e.id) : this.prevNodeDecorationColors.delete(e.id), o && !a ? this.defaultHighlightedNodeIds.add(e.id) : this.defaultHighlightedNodeIds.delete(e.id);
900
+ ), r.style.setProperty("--flow-canvas-node-pulse-ring-opacity", "0.95")) : (r.classList.remove(qe), r.style.removeProperty("--flow-canvas-node-pulse-ring-background"), r.style.removeProperty("--flow-canvas-node-pulse-ring-opacity"))), a ? this.prevNodeDecorationColors.add(e.id) : this.prevNodeDecorationColors.delete(e.id), o && !a ? this.defaultHighlightedNodeIds.add(e.id) : this.defaultHighlightedNodeIds.delete(e.id);
876
901
  }
877
902
  getHoveredEdgeId() {
878
903
  return this.hoveredEdgeId;
@@ -906,11 +931,11 @@ class Bt {
906
931
  const m = this.graph.isSelected?.(e) ?? !1, C = this.hoveredEdgeId === e.id, M = o.style(t, { selected: m, highlighted: n, hovered: C });
907
932
  l = M.stroke, a = M.strokeWidth, h = M.strokeDasharray;
908
933
  }
909
- const u = !o?.style && n ? "#3a84ff" : void 0, p = i?.strokeColor, g = p ?? l ?? u, E = !!o?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
910
- g ? this.setEdgeAttrIfChanged(e, "line/stroke", g) : E && this.restoreEdgeAttr(e, "line/stroke", "stroke"), o?.style ? (this.prevEdgeStyleIds.add(e.id), a ? this.setEdgeAttrIfChanged(e, "line/strokeWidth", a) : this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), h ? this.setEdgeAttrIfChanged(e, "line/strokeDasharray", h) : this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray")) : this.prevEdgeStyleIds.has(e.id) && (this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray"), this.prevEdgeStyleIds.delete(e.id)), p ? this.prevEdgeDecorationColors.add(e.id) : this.prevEdgeDecorationColors.delete(e.id), u ? this.defaultHighlightedEdgeIds.add(e.id) : this.defaultHighlightedEdgeIds.delete(e.id);
934
+ const u = !o?.style && n ? "#3a84ff" : void 0, p = i?.strokeColor, g = p ?? l ?? u, x = !!o?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
935
+ g ? this.setEdgeAttrIfChanged(e, "line/stroke", g) : x && this.restoreEdgeAttr(e, "line/stroke", "stroke"), o?.style ? (this.prevEdgeStyleIds.add(e.id), a ? this.setEdgeAttrIfChanged(e, "line/strokeWidth", a) : this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), h ? this.setEdgeAttrIfChanged(e, "line/strokeDasharray", h) : this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray")) : this.prevEdgeStyleIds.has(e.id) && (this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray"), this.prevEdgeStyleIds.delete(e.id)), p ? this.prevEdgeDecorationColors.add(e.id) : this.prevEdgeDecorationColors.delete(e.id), u ? this.defaultHighlightedEdgeIds.add(e.id) : this.defaultHighlightedEdgeIds.delete(e.id);
911
936
  }
912
937
  }
913
- class Ht {
938
+ class Ft {
914
939
  instanceId = te();
915
940
  registeredShapes = /* @__PURE__ */ new Map();
916
941
  wrappedComponents = /* @__PURE__ */ new Map();
@@ -937,7 +962,7 @@ class Ht {
937
962
  this.registeredShapes.clear(), this.wrappedComponents.clear();
938
963
  }
939
964
  }
940
- class Gt {
965
+ class Ht {
941
966
  graph;
942
967
  onUiEvent;
943
968
  onCommand;
@@ -1052,7 +1077,7 @@ class Gt {
1052
1077
  this.graph.on(e, t), this.disposers.push(() => this.graph.off(e, t));
1053
1078
  }
1054
1079
  }
1055
- function qt(s) {
1080
+ function Gt(s) {
1056
1081
  function e(t) {
1057
1082
  const o = s.getCellById(t);
1058
1083
  if (!o || !o.isNode()) return null;
@@ -1069,7 +1094,7 @@ function it(s) {
1069
1094
  edgeIds: s.filter((e) => e.isEdge()).map((e) => e.id)
1070
1095
  };
1071
1096
  }
1072
- function Ft(s, e) {
1097
+ function qt(s, e) {
1073
1098
  const t = [
1074
1099
  ...e.nodeIds.map((i) => s.getCellById(i)),
1075
1100
  ...e.edgeIds.map((i) => s.getCellById(i))
@@ -1113,7 +1138,7 @@ function jt({
1113
1138
  resolveNodeShape: u
1114
1139
  }) {
1115
1140
  const p = r ?? Be;
1116
- let g = [], E = [], m = null, C = !1, M = null;
1141
+ let g = [], x = [], m = null, C = !1, M = null;
1117
1142
  async function R() {
1118
1143
  if (C) return m;
1119
1144
  C = !0;
@@ -1141,7 +1166,7 @@ function jt({
1141
1166
  M = null;
1142
1167
  const c = f.getPosition();
1143
1168
  s.removeNode(f.id);
1144
- const { _dndSessionId: v, ...w } = d, x = w.id || p("node");
1169
+ const { _dndSessionId: v, ...b } = d, E = b.id || p("node");
1145
1170
  t({
1146
1171
  id: te(),
1147
1172
  source: "user:drag",
@@ -1150,7 +1175,7 @@ function jt({
1150
1175
  commands: [
1151
1176
  {
1152
1177
  type: "node.add",
1153
- node: { ...w, id: x, position: { x: c.x, y: c.y } }
1178
+ node: { ...b, id: E, position: { x: c.x, y: c.y } }
1154
1179
  }
1155
1180
  ]
1156
1181
  });
@@ -1158,31 +1183,31 @@ function jt({
1158
1183
  s.on("node:added", B);
1159
1184
  function V(f) {
1160
1185
  const d = o.nodeTypes[f.type];
1161
- return He(f, d?.getPorts);
1186
+ return Fe(f, d?.getPorts);
1162
1187
  }
1163
1188
  function O(f) {
1164
1189
  return f ?? it(s.getSelectedCells?.() ?? []);
1165
1190
  }
1166
- function W(f, d, c, v, w) {
1191
+ function W(f, d, c, v, b) {
1167
1192
  switch (f) {
1168
1193
  case "left":
1169
1194
  return {
1170
- x: d.position.x - w - v.width,
1195
+ x: d.position.x - b - v.width,
1171
1196
  y: d.position.y + (c.height - v.height) / 2
1172
1197
  };
1173
1198
  case "top":
1174
1199
  return {
1175
1200
  x: d.position.x + (c.width - v.width) / 2,
1176
- y: d.position.y - w - v.height
1201
+ y: d.position.y - b - v.height
1177
1202
  };
1178
1203
  case "bottom":
1179
1204
  return {
1180
1205
  x: d.position.x + (c.width - v.width) / 2,
1181
- y: d.position.y + c.height + w
1206
+ y: d.position.y + c.height + b
1182
1207
  };
1183
1208
  default:
1184
1209
  return {
1185
- x: d.position.x + c.width + w,
1210
+ x: d.position.x + c.width + b,
1186
1211
  y: d.position.y + (c.height - v.height) / 2
1187
1212
  };
1188
1213
  }
@@ -1199,7 +1224,7 @@ function jt({
1199
1224
  return { x: d.width + c, y: 0 };
1200
1225
  }
1201
1226
  }
1202
- function _(f) {
1227
+ function D(f) {
1203
1228
  switch (f) {
1204
1229
  case "left":
1205
1230
  return "right";
@@ -1241,7 +1266,7 @@ function jt({
1241
1266
  return O();
1242
1267
  },
1243
1268
  getSelectionBounds(f) {
1244
- return Ft(s, O(f));
1269
+ return qt(s, O(f));
1245
1270
  },
1246
1271
  selectNodes(f) {
1247
1272
  const d = f.map((c) => s.getCellById(c)).filter(Boolean);
@@ -1258,28 +1283,28 @@ function jt({
1258
1283
  deleteSelection(f) {
1259
1284
  const d = O(f?.selection), c = rt(d, n.value, i ?? (() => ({}))), v = Ut(c);
1260
1285
  if (v.length === 0) return null;
1261
- const w = t({
1286
+ const b = t({
1262
1287
  id: te(),
1263
1288
  source: f?.source ?? "user:toolbar",
1264
1289
  label: f?.label ?? "删除选中",
1265
1290
  timestamp: Date.now(),
1266
1291
  commands: v
1267
1292
  });
1268
- return w.status === "applied" && f?.clearSelectionAfterApply !== !1 && y.clearSelection(), w;
1293
+ return b.status === "applied" && f?.clearSelectionAfterApply !== !1 && y.clearSelection(), b;
1269
1294
  },
1270
1295
  registerDndSource(f, d) {
1271
1296
  const c = async (v) => {
1272
- const w = await R();
1273
- if (!w) return;
1274
- const x = te();
1275
- M = x;
1276
- const H = d(), K = u?.(H.type), k = s.createNode({
1297
+ const b = await R();
1298
+ if (!b) return;
1299
+ const E = te();
1300
+ M = E;
1301
+ const F = d(), K = u?.(F.type), k = s.createNode({
1277
1302
  width: K?.width ?? 154,
1278
1303
  height: K?.height ?? 54,
1279
1304
  shape: K?.shapeName ?? "rect",
1280
- data: { ...H, _dndSessionId: x }
1305
+ data: { ...F, _dndSessionId: E }
1281
1306
  });
1282
- w.start(k, v);
1307
+ b.start(k, v);
1283
1308
  };
1284
1309
  return f.addEventListener("mousedown", c), () => {
1285
1310
  f.removeEventListener("mousedown", c);
@@ -1292,13 +1317,13 @@ function jt({
1292
1317
  startConnection(f, d) {
1293
1318
  const c = s.getCellById(f);
1294
1319
  if (!c?.isNode()) return;
1295
- const v = c, w = s.findViewByCell(v);
1296
- if (!w) return;
1297
- const x = w.findPortElem(d, "circle") ?? w.findPortElem(d);
1298
- if (!x) return;
1299
- const K = (x.matches?.("[magnet]") ? x : x.querySelector?.("[magnet]")) ?? x, k = K.getBoundingClientRect(), L = k.left + k.width / 2, b = k.top + k.height / 2, P = new MouseEvent("mousedown", {
1320
+ const v = c, b = s.findViewByCell(v);
1321
+ if (!b) return;
1322
+ const E = b.findPortElem(d, "circle") ?? b.findPortElem(d);
1323
+ if (!E) return;
1324
+ const K = (E.matches?.("[magnet]") ? E : E.querySelector?.("[magnet]")) ?? E, k = K.getBoundingClientRect(), L = k.left + k.width / 2, w = k.top + k.height / 2, P = new MouseEvent("mousedown", {
1300
1325
  clientX: L,
1301
- clientY: b,
1326
+ clientY: w,
1302
1327
  button: 0,
1303
1328
  buttons: 1,
1304
1329
  bubbles: !0,
@@ -1307,19 +1332,19 @@ function jt({
1307
1332
  K.dispatchEvent(P);
1308
1333
  },
1309
1334
  async exportAsImage(f) {
1310
- const { domToBlob: d } = await import("modern-screenshot"), c = f?.padding ?? 20, v = f?.backgroundColor ?? s.options.background?.color ?? "#ffffff", w = s.zoom(), x = s.translate(), H = s.getContentBBox(), K = H.width / w, k = H.height / w;
1335
+ const { domToBlob: d } = await import("modern-screenshot"), c = f?.padding ?? 20, v = f?.backgroundColor ?? s.options.background?.color ?? "#ffffff", b = s.zoom(), E = s.translate(), F = s.getContentBBox(), K = F.width / b, k = F.height / b;
1311
1336
  if (K === 0 || k === 0)
1312
1337
  return new Blob();
1313
- const L = (H.x - x.tx) / w, b = (H.y - x.ty) / w, P = Math.ceil(K + c * 2), G = Math.ceil(k + c * 2), Y = document.createElement("div");
1338
+ const L = (F.x - E.tx) / b, w = (F.y - E.ty) / b, P = Math.ceil(K + c * 2), H = Math.ceil(k + c * 2), Y = document.createElement("div");
1314
1339
  Y.style.cssText = "position:fixed;left:-99999px;top:0;pointer-events:none;";
1315
1340
  const X = s.container.cloneNode(!0);
1316
- X.style.width = `${P}px`, X.style.height = `${G}px`, X.style.overflow = "visible";
1341
+ X.style.width = `${P}px`, X.style.height = `${H}px`, X.style.overflow = "visible";
1317
1342
  const ee = X.querySelector("svg");
1318
- ee && (ee.setAttribute("width", String(P)), ee.setAttribute("height", String(G)), ee.style.width = `${P}px`, ee.style.height = `${G}px`), X.querySelector(".x6-graph-svg-viewport")?.setAttribute("transform", `matrix(1,0,0,1,${-L + c},${-b + c})`), Y.appendChild(X), document.body.appendChild(Y);
1343
+ ee && (ee.setAttribute("width", String(P)), ee.setAttribute("height", String(H)), ee.style.width = `${P}px`, ee.style.height = `${H}px`), X.querySelector(".x6-graph-svg-viewport")?.setAttribute("transform", `matrix(1,0,0,1,${-L + c},${-w + c})`), Y.appendChild(X), document.body.appendChild(Y);
1319
1344
  try {
1320
1345
  return await A(), await d(X, {
1321
1346
  width: P,
1322
- height: G,
1347
+ height: H,
1323
1348
  backgroundColor: v,
1324
1349
  scale: f?.scale ?? window.devicePixelRatio,
1325
1350
  filter: (oe) => {
@@ -1338,32 +1363,32 @@ function jt({
1338
1363
  }
1339
1364
  },
1340
1365
  highlightNodes(f) {
1341
- g = f, h?.(g, E);
1366
+ g = f, h?.(g, x);
1342
1367
  },
1343
1368
  highlightEdges(f) {
1344
- E = f, h?.(g, E);
1369
+ x = f, h?.(g, x);
1345
1370
  },
1346
1371
  clearHighlight() {
1347
- g = [], E = [], h?.([], []);
1372
+ g = [], x = [], h?.([], []);
1348
1373
  },
1349
1374
  overlay: e,
1350
1375
  getContextMenuItems(f) {
1351
1376
  return a?.(f) ?? [];
1352
1377
  },
1353
1378
  insertNodeToRight(f, d, c) {
1354
- const v = n.value, w = v.nodes[f];
1355
- if (!w)
1379
+ const v = n.value, b = v.nodes[f];
1380
+ if (!b)
1356
1381
  return {
1357
1382
  status: "invalid",
1358
1383
  envelope: { id: "", source: "user:toolbar", timestamp: Date.now(), commands: [] },
1359
1384
  error: { code: "constraint_violated", reason: `Source node "${f}" not found`, source: "api" }
1360
1385
  };
1361
- const x = c?.gap ?? l ?? zt, H = c?.direction ?? "right", K = o.nodeTypes[w.type], k = o.nodeTypes[d.type], L = K?.getSize(w) ?? { width: 154, height: 54 }, b = k?.getSize({ ...d, position: { x: 0, y: 0 } }) ?? {
1386
+ const E = c?.gap ?? l ?? zt, F = c?.direction ?? "right", K = o.nodeTypes[b.type], k = o.nodeTypes[d.type], L = K?.getSize(b) ?? { width: 154, height: 54 }, w = k?.getSize({ ...d, position: { x: 0, y: 0 } }) ?? {
1362
1387
  width: 154,
1363
1388
  height: 54
1364
- }, P = W(H, w, L, b, x), G = d.id || p("node"), Y = { ...d, id: G, position: P }, X = [{ type: "node.add", node: Y }], ee = z(H, b, x), Q = { x: P.x, y: P.y, width: b.width, height: b.height };
1389
+ }, P = W(F, b, L, w, E), H = d.id || p("node"), Y = { ...d, id: H, position: P }, X = [{ type: "node.add", node: Y }], ee = z(F, w, E), Q = { x: P.x, y: P.y, width: w.width, height: w.height };
1365
1390
  for (const [ie, ne] of Object.entries(v.nodes)) {
1366
- if (ie === f || ie === G) continue;
1391
+ if (ie === f || ie === H) continue;
1367
1392
  const I = o.nodeTypes[ne.type]?.getSize(ne) ?? { width: 154, height: 54 }, N = Q.x < ne.position.x + I.width && Q.x + Q.width > ne.position.x, U = Q.y < ne.position.y + I.height && Q.y + Q.height > ne.position.y;
1368
1393
  N && U && X.push({
1369
1394
  type: "node.move",
@@ -1372,7 +1397,7 @@ function jt({
1372
1397
  });
1373
1398
  }
1374
1399
  if (c?.autoWireEdges) {
1375
- const ie = V(w), ne = V(Y), S = H, I = _(H), N = ie.find((J) => J.group === S), U = ne.find((J) => J.group === I), ae = ne.find((J) => J.group === S), de = N ? Object.values(v.edges).find(
1400
+ const ie = V(b), ne = V(Y), S = F, I = D(F), N = ie.find((J) => J.group === S), U = ne.find((J) => J.group === I), ae = ne.find((J) => J.group === S), de = N ? Object.values(v.edges).find(
1376
1401
  (J) => J.source.nodeId === f && J.source.portId === N.id
1377
1402
  ) : Object.values(v.edges).find((J) => J.source.nodeId === f);
1378
1403
  if (de) {
@@ -1382,13 +1407,13 @@ function jt({
1382
1407
  edge: {
1383
1408
  id: p("edge"),
1384
1409
  source: { nodeId: f, portId: N?.id },
1385
- target: { nodeId: G, portId: U?.id }
1410
+ target: { nodeId: H, portId: U?.id }
1386
1411
  }
1387
1412
  }), X.push({
1388
1413
  type: "edge.add",
1389
1414
  edge: {
1390
1415
  id: p("edge"),
1391
- source: { nodeId: G, portId: ae?.id },
1416
+ source: { nodeId: H, portId: ae?.id },
1392
1417
  target: J
1393
1418
  }
1394
1419
  });
@@ -1398,7 +1423,7 @@ function jt({
1398
1423
  edge: {
1399
1424
  id: p("edge"),
1400
1425
  source: { nodeId: f, portId: N?.id },
1401
- target: { nodeId: G, portId: U?.id }
1426
+ target: { nodeId: H, portId: U?.id }
1402
1427
  }
1403
1428
  });
1404
1429
  }
@@ -1421,7 +1446,7 @@ function jt({
1421
1446
  return y;
1422
1447
  }
1423
1448
  function Wt() {
1424
- const s = q(null), e = q(!1);
1449
+ const s = G(null), e = G(!1);
1425
1450
  let t = null, o = !1;
1426
1451
  function n(p) {
1427
1452
  t && (clearTimeout(t), t = null), s.value = p;
@@ -1456,13 +1481,13 @@ function ze(s, e) {
1456
1481
  const i = 50, r = t / i;
1457
1482
  let l = 0;
1458
1483
  for (let p = 0; p <= i; p++) {
1459
- const g = p * r, E = s.getPointAtLength(g), m = (E.x - e.x) ** 2 + (E.y - e.y) ** 2;
1460
- m < n && (n = m, o = E, l = g);
1484
+ const g = p * r, x = s.getPointAtLength(g), m = (x.x - e.x) ** 2 + (x.y - e.y) ** 2;
1485
+ m < n && (n = m, o = x, l = g);
1461
1486
  }
1462
1487
  const a = Math.max(0, l - r), h = Math.min(t, l + r), u = (h - a) / 20;
1463
1488
  for (let p = a; p <= h; p += u) {
1464
- const g = s.getPointAtLength(p), E = (g.x - e.x) ** 2 + (g.y - e.y) ** 2;
1465
- E < n && (n = E, o = g, l = p);
1489
+ const g = s.getPointAtLength(p), x = (g.x - e.x) ** 2 + (g.y - e.y) ** 2;
1490
+ x < n && (n = x, o = g, l = p);
1466
1491
  }
1467
1492
  return { x: o.x, y: o.y, length: l, totalLength: t };
1468
1493
  }
@@ -1496,7 +1521,7 @@ function Vt(s) {
1496
1521
  if (!p) return;
1497
1522
  const g = p.container.querySelector("path");
1498
1523
  if (!g) return;
1499
- const E = s.clientToLocal(a.clientX, a.clientY), m = ze(g, E);
1524
+ const x = s.clientToLocal(a.clientX, a.clientY), m = ze(g, x);
1500
1525
  if (je(m.length, m.totalLength) || We(p.container, a.clientX, a.clientY)) return;
1501
1526
  const C = Ve();
1502
1527
  C.setAttribute("transform", `translate(${m.x}, ${m.y})`), p.container.appendChild(C), e = C;
@@ -1513,14 +1538,14 @@ function Vt(s) {
1513
1538
  if (!u) return;
1514
1539
  const p = u.container.querySelector("path");
1515
1540
  if (!p) return;
1516
- const g = s.clientToLocal(l.clientX, l.clientY), E = ze(p, g);
1517
- if (je(E.length, E.totalLength) || We(u.container, l.clientX, l.clientY))
1541
+ const g = s.clientToLocal(l.clientX, l.clientY), x = ze(p, g);
1542
+ if (je(x.length, x.totalLength) || We(u.container, l.clientX, l.clientY))
1518
1543
  e && e.setAttribute("display", "none");
1519
1544
  else if (e)
1520
- e.removeAttribute("display"), e.setAttribute("transform", `translate(${E.x}, ${E.y})`);
1545
+ e.removeAttribute("display"), e.setAttribute("transform", `translate(${x.x}, ${x.y})`);
1521
1546
  else {
1522
1547
  const m = Ve();
1523
- m.setAttribute("transform", `translate(${E.x}, ${E.y})`), u.container.appendChild(m), e = m;
1548
+ m.setAttribute("transform", `translate(${x.x}, ${x.y})`), u.container.appendChild(m), e = m;
1524
1549
  }
1525
1550
  }
1526
1551
  function i() {
@@ -1536,8 +1561,8 @@ function Xt(s) {
1536
1561
  function o(u) {
1537
1562
  const p = u ? "visible" : "hidden";
1538
1563
  for (const g of s.getNodes())
1539
- for (const E of g.getPorts())
1540
- g.setPortProp(E.id, "attrs/circle/visibility", p);
1564
+ for (const x of g.getPorts())
1565
+ g.setPortProp(x.id, "attrs/circle/visibility", p);
1541
1566
  }
1542
1567
  function n(u) {
1543
1568
  if (!e)
@@ -1553,9 +1578,9 @@ function Xt(s) {
1553
1578
  if (!u.getTargetCell())
1554
1579
  if (e = u.id, p?.size)
1555
1580
  for (const g of s.getNodes()) {
1556
- const E = p.has(g.id) ? "hidden" : "visible";
1581
+ const x = p.has(g.id) ? "hidden" : "visible";
1557
1582
  for (const m of g.getPorts())
1558
- g.setPortProp(m.id, "attrs/circle/visibility", E);
1583
+ g.setPortProp(m.id, "attrs/circle/visibility", x);
1559
1584
  }
1560
1585
  else
1561
1586
  o(!0);
@@ -1582,9 +1607,9 @@ function Xe(s) {
1582
1607
  return s === "top" || s === "right" || s === "bottom" || s === "left";
1583
1608
  }
1584
1609
  function Kt(s) {
1585
- const { editor: e, nodeHover: t, isSelectionModeActive: o, viewportVersion: n, getNodeBehavior: i, getInsertGap: r } = s, { isDraggingNode: l } = s, a = q(null), h = q(!1);
1610
+ const { editor: e, nodeHover: t, isSelectionModeActive: o, viewportVersion: n, getNodeBehavior: i, getInsertGap: r } = s, { isDraggingNode: l } = s, a = G(null), h = G(!1);
1586
1611
  let u = null, p = null, g = null;
1587
- const E = j(() => ({
1612
+ const x = j(() => ({
1588
1613
  enabled: !0,
1589
1614
  portGroup: "right",
1590
1615
  ...s.quickAddProp.value
@@ -1608,35 +1633,35 @@ function Kt(s) {
1608
1633
  }
1609
1634
  function B(k) {
1610
1635
  const L = e.schema.nodeTypes[k.type];
1611
- return He(k, L?.getPorts);
1636
+ return Fe(k, L?.getPorts);
1612
1637
  }
1613
1638
  function V(k, L) {
1614
- const b = E.value.getPort?.(k, L);
1615
- if (!b) return null;
1616
- const P = typeof b == "string" ? b : b.id;
1617
- return L.find((G) => G.id === P) ?? null;
1639
+ const w = x.value.getPort?.(k, L);
1640
+ if (!w) return null;
1641
+ const P = typeof w == "string" ? w : w.id;
1642
+ return L.find((H) => H.id === P) ?? null;
1618
1643
  }
1619
1644
  function O(k, L) {
1620
- const b = e.api.value?.overlay.getNodeScreenRect(k);
1621
- if (!b) return null;
1645
+ const w = e.api.value?.overlay.getNodeScreenRect(k);
1646
+ if (!w) return null;
1622
1647
  switch (L) {
1623
1648
  case "top":
1624
- return { x: b.x + b.width / 2, y: b.y };
1649
+ return { x: w.x + w.width / 2, y: w.y };
1625
1650
  case "bottom":
1626
- return { x: b.x + b.width / 2, y: b.y + b.height };
1651
+ return { x: w.x + w.width / 2, y: w.y + w.height };
1627
1652
  case "left":
1628
- return { x: b.x, y: b.y + b.height / 2 };
1653
+ return { x: w.x, y: w.y + w.height / 2 };
1629
1654
  case "right":
1630
- return { x: b.x + b.width, y: b.y + b.height / 2 };
1655
+ return { x: w.x + w.width, y: w.y + w.height / 2 };
1631
1656
  default:
1632
1657
  return null;
1633
1658
  }
1634
1659
  }
1635
- function W(k, L, b) {
1636
- if (!p) return O(k, b);
1660
+ function W(k, L, w) {
1661
+ if (!p) return O(k, w);
1637
1662
  const P = p.getCellById(k);
1638
1663
  if (P?.isNode()) {
1639
- const G = P, Y = p.findViewByCell(G), X = Y?.findPortElem(L, "circle") ?? Y?.findPortElem(L);
1664
+ const H = P, Y = p.findViewByCell(H), X = Y?.findPortElem(L, "circle") ?? Y?.findPortElem(L);
1640
1665
  if (X) {
1641
1666
  const ee = p.container.getBoundingClientRect(), Q = X.getBoundingClientRect();
1642
1667
  return {
@@ -1645,39 +1670,39 @@ function Kt(s) {
1645
1670
  };
1646
1671
  }
1647
1672
  }
1648
- return O(k, b);
1673
+ return O(k, w);
1649
1674
  }
1650
1675
  function z(k) {
1651
- const L = B(k), b = V(k, L) ?? L.find((G) => G.group === E.value.portGroup) ?? null;
1652
- if (!b) return null;
1653
- const P = W(k.id, b.id, b.group);
1654
- return P ? { portId: b.id, portGroup: b.group, portPosition: P } : null;
1655
- }
1656
- function _(k) {
1657
- const L = z(k), b = E.value.insertDirection;
1658
- if (typeof b == "function") {
1659
- const P = b(k, L ? { id: L.portId, group: L.portGroup } : null);
1676
+ const L = B(k), w = V(k, L) ?? L.find((H) => H.group === x.value.portGroup) ?? null;
1677
+ if (!w) return null;
1678
+ const P = W(k.id, w.id, w.group);
1679
+ return P ? { portId: w.id, portGroup: w.group, portPosition: P } : null;
1680
+ }
1681
+ function D(k) {
1682
+ const L = z(k), w = x.value.insertDirection;
1683
+ if (typeof w == "function") {
1684
+ const P = w(k, L ? { id: L.portId, group: L.portGroup } : null);
1660
1685
  if (P) return P;
1661
- } else if (b)
1662
- return b;
1663
- return L && Xe(L.portGroup) ? L.portGroup : Xe(E.value.portGroup) ? E.value.portGroup : "right";
1686
+ } else if (w)
1687
+ return w;
1688
+ return L && Xe(L.portGroup) ? L.portGroup : Xe(x.value.portGroup) ? x.value.portGroup : "right";
1664
1689
  }
1665
1690
  function y(k) {
1666
- if (!E.value.enabled || e.mode.value !== "edit") return !1;
1667
- const b = e.flowModel.value.nodes[k];
1668
- return !b || i(b).quickAddEnabled === !1 ? !1 : !!z(b);
1691
+ if (!x.value.enabled || e.mode.value !== "edit") return !1;
1692
+ const w = e.flowModel.value.nodes[k];
1693
+ return !w || i(w).quickAddEnabled === !1 ? !1 : !!z(w);
1669
1694
  }
1670
1695
  const f = j(() => {
1671
- if (n.value, !E.value.enabled) return null;
1696
+ if (n.value, !x.value.enabled) return null;
1672
1697
  const k = a.value;
1673
1698
  if (!k || l.value || !e.api.value || e.mode.value !== "edit" || o.value)
1674
1699
  return null;
1675
- const b = e.flowModel.value.nodes[k];
1676
- if (!b) return null;
1677
- const P = i(b);
1700
+ const w = e.flowModel.value.nodes[k];
1701
+ if (!w) return null;
1702
+ const P = i(w);
1678
1703
  if (P.quickAddEnabled === !1) return null;
1679
- const G = z(b);
1680
- return G ? { node: b, ...G, behavior: P } : null;
1704
+ const H = z(w);
1705
+ return H ? { node: w, ...H, behavior: P } : null;
1681
1706
  });
1682
1707
  function d(k) {
1683
1708
  h.value = !0, f.value && e._emitUiEvent({ type: "node.quick-add", nodeId: k, position: f.value.portPosition });
@@ -1688,48 +1713,48 @@ function Kt(s) {
1688
1713
  function v(k) {
1689
1714
  const L = e.api.value;
1690
1715
  if (!L) return;
1691
- const b = e.flowModel.value.nodes[k];
1692
- if (!b) return;
1693
- const P = z(b);
1716
+ const w = e.flowModel.value.nodes[k];
1717
+ if (!w) return;
1718
+ const P = z(w);
1694
1719
  P && L.startConnection(k, P.portId);
1695
1720
  }
1696
- function w(k, L) {
1697
- const b = e.api.value;
1698
- if (!b) return;
1699
- const P = L.id || e.idGenerator("node"), G = { ...L, id: P }, Y = e.flowModel.value.nodes[k];
1721
+ function b(k, L) {
1722
+ const w = e.api.value;
1723
+ if (!w) return;
1724
+ const P = L.id || e.idGenerator("node"), H = { ...L, id: P }, Y = e.flowModel.value.nodes[k];
1700
1725
  if (!Y) return;
1701
- b.insertNodeToRight(k, G, {
1726
+ w.insertNodeToRight(k, H, {
1702
1727
  autoWireEdges: !0,
1703
- direction: _(Y),
1728
+ direction: D(Y),
1704
1729
  gap: r(),
1705
1730
  source: "user:quick-add",
1706
1731
  label: "快捷插入节点"
1707
1732
  }).status === "applied" && e._emitUiEvent({ type: "node.action.quick-insert", sourceNodeId: k, newNodeId: P }), s.closePopover();
1708
1733
  }
1709
- function x(k) {
1734
+ function E(k) {
1710
1735
  if (!p) return;
1711
1736
  const L = p.getCellById(k);
1712
1737
  if (!L?.isNode()) return;
1713
- const b = L, P = e.flowModel.value.nodes[k];
1738
+ const w = L, P = e.flowModel.value.nodes[k];
1714
1739
  if (!P) return;
1715
- const G = z(P);
1740
+ const H = z(P);
1716
1741
  let Y = !0;
1717
1742
  i(P).hidePortForQuickAdd === !1 && (Y = !1);
1718
- const ee = Y && !l.value && !!G && y(k);
1719
- for (const Q of b.getPorts()) {
1720
- const oe = ee && Q.id === G?.portId ? "hidden" : "visible";
1721
- b.setPortProp(Q.id, "attrs/circle/visibility", oe);
1743
+ const ee = Y && !l.value && !!H && y(k);
1744
+ for (const Q of w.getPorts()) {
1745
+ const oe = ee && Q.id === H?.portId ? "hidden" : "visible";
1746
+ w.setPortProp(Q.id, "attrs/circle/visibility", oe);
1722
1747
  }
1723
1748
  }
1724
- function H(k, L) {
1749
+ function F(k, L) {
1725
1750
  g?.(), p = k, g = he(
1726
1751
  [a, l],
1727
- ([b], [P]) => {
1728
- if (P && P !== b) {
1729
- const G = k.getCellById(P);
1730
- G?.isNode() && L(G);
1752
+ ([w], [P]) => {
1753
+ if (P && P !== w) {
1754
+ const H = k.getCellById(P);
1755
+ H?.isNode() && L(H);
1731
1756
  }
1732
- b && x(b);
1757
+ w && E(w);
1733
1758
  },
1734
1759
  { flush: "sync" }
1735
1760
  );
@@ -1743,7 +1768,7 @@ function Kt(s) {
1743
1768
  return {
1744
1769
  quickAddNodeId: a,
1745
1770
  quickAddPopoverOpen: h,
1746
- mergedConfig: E,
1771
+ mergedConfig: x,
1747
1772
  data: f,
1748
1773
  enter: M,
1749
1774
  leave: C,
@@ -1753,10 +1778,10 @@ function Kt(s) {
1753
1778
  handleOpen: d,
1754
1779
  handleClose: c,
1755
1780
  handleStartDrag: v,
1756
- handleInsert: w,
1781
+ handleInsert: b,
1757
1782
  isActiveForNode: y,
1758
- syncNodePorts: x,
1759
- attachRuntime: H,
1783
+ syncNodePorts: E,
1784
+ attachRuntime: F,
1760
1785
  cleanup: K
1761
1786
  };
1762
1787
  }
@@ -1797,7 +1822,7 @@ function Qt(s) {
1797
1822
  if (t) {
1798
1823
  const c = t.getCellById(y);
1799
1824
  if (c?.isNode()) {
1800
- const v = c.getPorts().find((w) => w.group === d);
1825
+ const v = c.getPorts().find((b) => b.group === d);
1801
1826
  if (v?.id) return v.id;
1802
1827
  }
1803
1828
  }
@@ -1807,45 +1832,45 @@ function Qt(s) {
1807
1832
  }
1808
1833
  return d;
1809
1834
  }
1810
- function E(y) {
1835
+ function x(y) {
1811
1836
  const f = y.getTotalLength();
1812
1837
  if (f === 0) return [];
1813
1838
  const d = [];
1814
1839
  for (let v = 0; v <= f; v += Yt) {
1815
- const w = y.getPointAtLength(v);
1816
- d.push({ x: w.x, y: w.y });
1840
+ const b = y.getPointAtLength(v);
1841
+ d.push({ x: b.x, y: b.y });
1817
1842
  }
1818
1843
  const c = y.getPointAtLength(f);
1819
1844
  return d.push({ x: c.x, y: c.y }), d;
1820
1845
  }
1821
1846
  function m(y, f, d) {
1822
1847
  if (!t) return null;
1823
- const c = a.value, v = c.bufferMargin, w = {
1848
+ const c = a.value, v = c.bufferMargin, b = {
1824
1849
  x: y.x + v,
1825
1850
  y: y.y + v,
1826
1851
  width: Math.max(0, y.width - v * 2),
1827
1852
  height: Math.max(0, y.height - v * 2)
1828
1853
  };
1829
- if (w.width <= 0 || w.height <= 0) return null;
1830
- const x = w.x + w.width, H = w.y + w.height;
1854
+ if (b.width <= 0 || b.height <= 0) return null;
1855
+ const E = b.x + b.width, F = b.y + b.height;
1831
1856
  let K = null;
1832
1857
  const k = y.x + y.width / 2, L = y.y + y.height / 2;
1833
- for (const b of t.getEdges()) {
1834
- const P = f.edges[b.id];
1858
+ for (const w of t.getEdges()) {
1859
+ const P = f.edges[w.id];
1835
1860
  if (!P || d && (P.source.nodeId === d || P.target.nodeId === d) || c.isEdgeDropTarget && !c.isEdgeDropTarget(P, f)) continue;
1836
- const G = t.findViewByCell(b);
1837
- if (!G) continue;
1838
- const Y = G.findOne?.("path");
1861
+ const H = t.findViewByCell(w);
1862
+ if (!H) continue;
1863
+ const Y = H.findOne?.("path");
1839
1864
  if (!Y || typeof Y.getTotalLength != "function") continue;
1840
- const X = E(Y);
1865
+ const X = x(Y);
1841
1866
  if (!X.length) continue;
1842
1867
  let ee = !1, Q = 1 / 0;
1843
1868
  for (const oe of X)
1844
- if (oe.x >= w.x && oe.x <= x && oe.y >= w.y && oe.y <= H) {
1869
+ if (oe.x >= b.x && oe.x <= E && oe.y >= b.y && oe.y <= F) {
1845
1870
  const ie = oe.x - k, ne = oe.y - L, S = ie * ie + ne * ne;
1846
1871
  S < Q && (Q = S), ee = !0;
1847
1872
  }
1848
- ee && (!K || Q < K.distSq) && (K = { edgeId: b.id, edge: P, distSq: Q });
1873
+ ee && (!K || Q < K.distSq) && (K = { edgeId: w.id, edge: P, distSq: Q });
1849
1874
  }
1850
1875
  return K ? { edgeId: K.edgeId, edge: K.edge } : null;
1851
1876
  }
@@ -1887,13 +1912,13 @@ function Qt(s) {
1887
1912
  }
1888
1913
  y = !0, n === null && (n = requestAnimationFrame(() => {
1889
1914
  if (n = null, !t) return;
1890
- const d = f.getBoundingClientRect(), c = t.clientToLocal(d.left, d.top), v = t.clientToLocal(d.right, d.bottom), w = {
1915
+ const d = f.getBoundingClientRect(), c = t.clientToLocal(d.left, d.top), v = t.clientToLocal(d.right, d.bottom), b = {
1891
1916
  x: c.x,
1892
1917
  y: c.y,
1893
1918
  width: v.x - c.x,
1894
1919
  height: v.y - c.y
1895
1920
  };
1896
- C(w);
1921
+ C(b);
1897
1922
  }));
1898
1923
  }, document.addEventListener("mousemove", l), r.push(() => {
1899
1924
  l && (document.removeEventListener("mousemove", l), l = null);
@@ -1908,14 +1933,14 @@ function Qt(s) {
1908
1933
  o = null, p();
1909
1934
  const d = e.flowModel.value, c = d.edges[f];
1910
1935
  if (!c) return y;
1911
- const v = y.commands.find((G) => G.type === "node.add" || G.type === "node.move");
1936
+ const v = y.commands.find((H) => H.type === "node.add" || H.type === "node.move");
1912
1937
  if (!v) return y;
1913
- const w = v.type === "node.add" ? v.node.id : v.nodeId, x = v.type === "node.add" ? v.node : d.nodes[v.nodeId];
1914
- if (!x) return y;
1915
- const H = a.value;
1916
- if (H.isNodeInsertable && !H.isNodeInsertable(x, d))
1938
+ const b = v.type === "node.add" ? v.node.id : v.nodeId, E = v.type === "node.add" ? v.node : d.nodes[v.nodeId];
1939
+ if (!E) return y;
1940
+ const F = a.value;
1941
+ if (F.isNodeInsertable && !F.isNodeInsertable(E, d))
1917
1942
  return y;
1918
- const K = g(w, x, H.incomingPortGroup), k = g(w, x, H.outgoingPortGroup), L = e.idGenerator("edge"), b = e.idGenerator("edge"), P = [
1943
+ const K = g(b, E, F.incomingPortGroup), k = g(b, E, F.outgoingPortGroup), L = e.idGenerator("edge"), w = e.idGenerator("edge"), P = [
1919
1944
  { type: "edge.remove", edgeId: f },
1920
1945
  {
1921
1946
  type: "edge.add",
@@ -1923,15 +1948,15 @@ function Qt(s) {
1923
1948
  id: L,
1924
1949
  type: c.type,
1925
1950
  source: { nodeId: c.source.nodeId, portId: c.source.portId },
1926
- target: { nodeId: w, portId: K }
1951
+ target: { nodeId: b, portId: K }
1927
1952
  }
1928
1953
  },
1929
1954
  {
1930
1955
  type: "edge.add",
1931
1956
  edge: {
1932
- id: b,
1957
+ id: w,
1933
1958
  type: c.type,
1934
- source: { nodeId: w, portId: k },
1959
+ source: { nodeId: b, portId: k },
1935
1960
  target: { nodeId: c.target.nodeId, portId: c.target.portId }
1936
1961
  }
1937
1962
  }
@@ -1949,7 +1974,7 @@ function Qt(s) {
1949
1974
  };
1950
1975
  f("node:move", R), f("node:change:position", A), f("node:moved", B), V();
1951
1976
  }
1952
- function _() {
1977
+ function D() {
1953
1978
  O();
1954
1979
  for (const y of r) y();
1955
1980
  r.length = 0, t = null, M = !0;
@@ -1957,7 +1982,7 @@ function Qt(s) {
1957
1982
  return {
1958
1983
  attachRuntime: z,
1959
1984
  tryExpandForEdgeDrop: W,
1960
- cleanup: _
1985
+ cleanup: D
1961
1986
  };
1962
1987
  }
1963
1988
  function Jt(s) {
@@ -2091,11 +2116,11 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2091
2116
  emits: ["action"],
2092
2117
  setup(s, { emit: e }) {
2093
2118
  const t = s, o = j(() => {
2094
- const p = t.actionsOffset?.x ?? 0, g = t.actionsOffset?.y ?? 0, E = p !== 0 || g !== 0;
2119
+ const p = t.actionsOffset?.x ?? 0, g = t.actionsOffset?.y ?? 0, x = p !== 0 || g !== 0;
2095
2120
  return {
2096
2121
  left: `${t.position.x}px`,
2097
2122
  top: `${t.position.y}px`,
2098
- transform: E ? `translate(${p}px, ${g}px)` : "translateX(-100%)"
2123
+ transform: x ? `translate(${p}px, ${g}px)` : "translateX(-100%)"
2099
2124
  };
2100
2125
  }), n = e, i = j(() => ({
2101
2126
  debug: {
@@ -2118,7 +2143,7 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2118
2143
  visible: t.config.showDisconnect && t.behavior.disconnectable !== !1,
2119
2144
  disabled: t.behavior.disconnectDisabled === !0
2120
2145
  }
2121
- })), r = j(() => i.value.copy.visible || i.value.copyInsert.visible || i.value.disconnect.visible), l = q(!1);
2146
+ })), r = j(() => i.value.copy.visible || i.value.copyInsert.visible || i.value.disconnect.visible), l = G(!1);
2122
2147
  let a = null;
2123
2148
  function h() {
2124
2149
  a && (clearTimeout(a), a = null), l.value = !0;
@@ -2130,61 +2155,61 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2130
2155
  }
2131
2156
  return Me(() => {
2132
2157
  a && clearTimeout(a);
2133
- }), (p, g) => (D(), T("div", {
2158
+ }), (p, g) => (_(), T("div", {
2134
2159
  class: "flow-canvas-node-actions",
2135
- style: be(o.value)
2160
+ style: we(o.value)
2136
2161
  }, [
2137
- F("div", oo, [
2138
- i.value.debug.visible ? (D(), T("i", {
2162
+ q("div", oo, [
2163
+ i.value.debug.visible ? (_(), T("i", {
2139
2164
  key: 0,
2140
2165
  class: se(["flow-canvas-icon canvas-debug flow-canvas-node-actions__icon", { "is-disabled": i.value.debug.disabled }]),
2141
- onClick: g[0] || (g[0] = (E) => !i.value.debug.disabled && n("action", "debug", s.node.id))
2166
+ onClick: g[0] || (g[0] = (x) => !i.value.debug.disabled && n("action", "debug", s.node.id))
2142
2167
  }, null, 2)) : Z("", !0),
2143
- i.value.delete.visible ? (D(), T("i", {
2168
+ i.value.delete.visible ? (_(), T("i", {
2144
2169
  key: 1,
2145
2170
  class: se(["flow-canvas-icon canvas-shanchu flow-canvas-node-actions__icon", { "is-disabled": i.value.delete.disabled }]),
2146
- onClick: g[1] || (g[1] = (E) => !i.value.delete.disabled && n("action", "delete", s.node.id))
2171
+ onClick: g[1] || (g[1] = (x) => !i.value.delete.disabled && n("action", "delete", s.node.id))
2147
2172
  }, null, 2)) : Z("", !0),
2148
- r.value ? (D(), T("div", {
2173
+ r.value ? (_(), T("div", {
2149
2174
  key: 2,
2150
2175
  class: "flow-canvas-node-actions__more-wrapper",
2151
2176
  onMouseenter: h,
2152
2177
  onMouseleave: u
2153
2178
  }, [...g[5] || (g[5] = [
2154
- F("i", { class: "flow-canvas-icon canvas-gengduo flow-canvas-node-actions__icon" }, null, -1)
2179
+ q("i", { class: "flow-canvas-icon canvas-gengduo flow-canvas-node-actions__icon" }, null, -1)
2155
2180
  ])], 32)) : Z("", !0)
2156
2181
  ]),
2157
2182
  et(tt, { name: "flow-canvas-fade" }, {
2158
2183
  default: $e(() => [
2159
- l.value && r.value ? (D(), T("div", {
2184
+ l.value && r.value ? (_(), T("div", {
2160
2185
  key: 0,
2161
2186
  class: "flow-canvas-node-actions__dropdown",
2162
2187
  onMouseenter: h,
2163
2188
  onMouseleave: u
2164
2189
  }, [
2165
- i.value.copy.visible ? (D(), T("div", {
2190
+ i.value.copy.visible ? (_(), T("div", {
2166
2191
  key: 0,
2167
2192
  class: se(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.copy.disabled }]),
2168
- onClick: g[2] || (g[2] = (E) => !i.value.copy.disabled && n("action", "copy", s.node.id))
2193
+ onClick: g[2] || (g[2] = (x) => !i.value.copy.disabled && n("action", "copy", s.node.id))
2169
2194
  }, [...g[6] || (g[6] = [
2170
- F("i", { class: "flow-canvas-icon canvas-copy-fuzhi-2" }, null, -1),
2171
- F("span", null, "复制", -1)
2195
+ q("i", { class: "flow-canvas-icon canvas-copy-fuzhi-2" }, null, -1),
2196
+ q("span", null, "复制", -1)
2172
2197
  ])], 2)) : Z("", !0),
2173
- i.value.copyInsert.visible ? (D(), T("div", {
2198
+ i.value.copyInsert.visible ? (_(), T("div", {
2174
2199
  key: 1,
2175
2200
  class: se(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.copyInsert.disabled }]),
2176
- onClick: g[3] || (g[3] = (E) => !i.value.copyInsert.disabled && n("action", "copy-insert", s.node.id))
2201
+ onClick: g[3] || (g[3] = (x) => !i.value.copyInsert.disabled && n("action", "copy-insert", s.node.id))
2177
2202
  }, [...g[7] || (g[7] = [
2178
- F("i", { class: "flow-canvas-icon canvas-fuzhibingcharu" }, null, -1),
2179
- F("span", null, "复制并插入", -1)
2203
+ q("i", { class: "flow-canvas-icon canvas-fuzhibingcharu" }, null, -1),
2204
+ q("span", null, "复制并插入", -1)
2180
2205
  ])], 2)) : Z("", !0),
2181
- i.value.disconnect.visible ? (D(), T("div", {
2206
+ i.value.disconnect.visible ? (_(), T("div", {
2182
2207
  key: 2,
2183
2208
  class: se(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.disconnect.disabled }]),
2184
- onClick: g[4] || (g[4] = (E) => !i.value.disconnect.disabled && n("action", "disconnect", s.node.id))
2209
+ onClick: g[4] || (g[4] = (x) => !i.value.disconnect.disabled && n("action", "disconnect", s.node.id))
2185
2210
  }, [...g[8] || (g[8] = [
2186
- F("i", { class: "flow-canvas-icon canvas-unlock-jiebang" }, null, -1),
2187
- F("span", null, "断开连线", -1)
2211
+ q("i", { class: "flow-canvas-icon canvas-unlock-jiebang" }, null, -1),
2212
+ q("span", null, "断开连线", -1)
2188
2213
  ])], 2)) : Z("", !0)
2189
2214
  ], 32)) : Z("", !0)
2190
2215
  ]),
@@ -2208,21 +2233,21 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2208
2233
  },
2209
2234
  emits: ["open", "close", "start-drag", "mouseenter", "mouseleave"],
2210
2235
  setup(s, { expose: e, emit: t }) {
2211
- const o = s, n = t, i = q(), r = q(), l = q(!1), a = q(!1);
2236
+ const o = s, n = t, i = G(), r = G(), l = G(!1), a = G(!1);
2212
2237
  let h = null, u = !1, p = null;
2213
2238
  function g(z) {
2214
- z.preventDefault(), z.stopPropagation(), h = { x: z.clientX, y: z.clientY }, u = !1, document.addEventListener("mousemove", E), document.addEventListener("mouseup", m);
2239
+ z.preventDefault(), z.stopPropagation(), h = { x: z.clientX, y: z.clientY }, u = !1, document.addEventListener("mousemove", x), document.addEventListener("mouseup", m);
2215
2240
  }
2216
- function E(z) {
2241
+ function x(z) {
2217
2242
  if (!h) return;
2218
- const _ = z.clientX - h.x, y = z.clientY - h.y;
2219
- Math.sqrt(_ * _ + y * y) >= ro && (u = !0, C(), n("start-drag", o.node.id));
2243
+ const D = z.clientX - h.x, y = z.clientY - h.y;
2244
+ Math.sqrt(D * D + y * y) >= ro && (u = !0, C(), n("start-drag", o.node.id));
2220
2245
  }
2221
2246
  function m() {
2222
2247
  C(), u || M(), h = null, u = !1;
2223
2248
  }
2224
2249
  function C() {
2225
- document.removeEventListener("mousemove", E), document.removeEventListener("mouseup", m);
2250
+ document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", m);
2226
2251
  }
2227
2252
  function M() {
2228
2253
  a.value ? A() : R();
@@ -2236,8 +2261,8 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2236
2261
  a.value = !1, n("close"), document.removeEventListener("mousedown", B);
2237
2262
  }
2238
2263
  function B(z) {
2239
- const _ = z.target;
2240
- i.value?.contains(_) || r.value?.contains(_) || A();
2264
+ const D = z.target;
2265
+ i.value?.contains(D) || r.value?.contains(D) || A();
2241
2266
  }
2242
2267
  function V() {
2243
2268
  a.value || n("mouseleave");
@@ -2252,37 +2277,37 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2252
2277
  }
2253
2278
  return Me(() => {
2254
2279
  C(), p && clearTimeout(p), document.removeEventListener("mousedown", B);
2255
- }), e({ closePopover: A }), (z, _) => (D(), T("div", {
2280
+ }), e({ closePopover: A }), (z, D) => (_(), T("div", {
2256
2281
  class: "flow-canvas-quick-add",
2257
- style: be({ left: `${s.portPosition.x}px`, top: `${s.portPosition.y}px` }),
2258
- onMouseenter: _[2] || (_[2] = (y) => n("mouseenter")),
2282
+ style: we({ left: `${s.portPosition.x}px`, top: `${s.portPosition.y}px` }),
2283
+ onMouseenter: D[2] || (D[2] = (y) => n("mouseenter")),
2259
2284
  onMouseleave: V,
2260
- onClick: _[3] || (_[3] = at(() => {
2285
+ onClick: D[3] || (D[3] = at(() => {
2261
2286
  }, ["stop"]))
2262
2287
  }, [
2263
- F("div", {
2288
+ q("div", {
2264
2289
  ref_key: "btnRef",
2265
2290
  ref: i,
2266
2291
  class: se(["flow-canvas-quick-add__btn", { "is-hovered": l.value, "is-active": a.value }]),
2267
- onMouseenter: _[0] || (_[0] = (y) => l.value = !0),
2268
- onMouseleave: _[1] || (_[1] = (y) => l.value = !1),
2292
+ onMouseenter: D[0] || (D[0] = (y) => l.value = !0),
2293
+ onMouseleave: D[1] || (D[1] = (y) => l.value = !1),
2269
2294
  onMousedown: g
2270
- }, [..._[4] || (_[4] = [
2271
- F("i", { class: "flow-canvas-icon canvas-zoom-add" }, null, -1)
2295
+ }, [...D[4] || (D[4] = [
2296
+ q("i", { class: "flow-canvas-icon canvas-zoom-add" }, null, -1)
2272
2297
  ])], 34),
2273
- l.value && !a.value ? (D(), T("div", io, [..._[5] || (_[5] = [
2274
- F("div", null, [
2275
- F("b", null, "点击"),
2276
- Ge(" 添加节点")
2298
+ l.value && !a.value ? (_(), T("div", io, [...D[5] || (D[5] = [
2299
+ q("div", null, [
2300
+ q("b", null, "点击"),
2301
+ He(" 添加节点")
2277
2302
  ], -1),
2278
- F("div", null, [
2279
- F("b", null, "拖拽"),
2280
- Ge(" 连接节点")
2303
+ q("div", null, [
2304
+ q("b", null, "拖拽"),
2305
+ He(" 连接节点")
2281
2306
  ], -1)
2282
2307
  ])])) : Z("", !0),
2283
2308
  et(tt, { name: "flow-canvas-fade" }, {
2284
2309
  default: $e(() => [
2285
- a.value ? (D(), T("div", {
2310
+ a.value ? (_(), T("div", {
2286
2311
  key: 0,
2287
2312
  ref_key: "popoverRef",
2288
2313
  ref: r,
@@ -2291,7 +2316,7 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2291
2316
  onMouseleave: W
2292
2317
  }, [
2293
2318
  Ie(z.$slots, "default", {}, () => [
2294
- _[6] || (_[6] = F("div", { class: "flow-canvas-quick-add__default-content" }, "节点快捷操作面板", -1))
2319
+ D[6] || (D[6] = q("div", { class: "flow-canvas-quick-add__default-content" }, "节点快捷操作面板", -1))
2295
2320
  ], !0)
2296
2321
  ], 544)) : Z("", !0)
2297
2322
  ]),
@@ -2312,12 +2337,12 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2312
2337
  top: `${t.position.y}px`,
2313
2338
  transform: "translateX(-100%)"
2314
2339
  }));
2315
- return (i, r) => (D(), T("div", {
2340
+ return (i, r) => (_(), T("div", {
2316
2341
  class: "flow-canvas-selection-actions",
2317
- style: be(n.value)
2342
+ style: we(n.value)
2318
2343
  }, [
2319
- F("div", co, [
2320
- F("i", {
2344
+ q("div", co, [
2345
+ q("i", {
2321
2346
  class: se(["flow-canvas-icon canvas-shanchu flow-canvas-selection-actions__icon", { "is-disabled": !s.canDelete }]),
2322
2347
  onClick: r[0] || (r[0] = (l) => s.canDelete && o("action", "delete"))
2323
2348
  }, null, 2)
@@ -2337,9 +2362,9 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2337
2362
  },
2338
2363
  emits: ["ui-event"],
2339
2364
  setup(s, { emit: e }) {
2340
- const t = s, o = e, n = q(), i = q();
2341
- let r, l, a, h, u = null, p = null, g = null, E = null;
2342
- const m = Wt(), { hoveredNodeId: C, isDraggingNode: M } = m, R = m.enterOverlay, A = () => m.leaveOverlay(), B = q(0), V = q({ nodeIds: [], edgeIds: [] });
2365
+ const t = s, o = e, n = G(), i = G();
2366
+ let r, l, a, h, u = null, p = null, g = null, x = null;
2367
+ const m = Wt(), { hoveredNodeId: C, isDraggingNode: M } = m, R = m.enterOverlay, A = () => m.leaveOverlay(), B = G(0), V = G({ nodeIds: [], edgeIds: [] });
2343
2368
  function O(S) {
2344
2369
  const I = t.editor.api.value;
2345
2370
  return I ? t.editor.schema.nodeTypes[S.type]?.getBehavior?.(S, {
@@ -2357,7 +2382,7 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2357
2382
  showDisconnect: !0,
2358
2383
  insertGap: 100,
2359
2384
  ...t.nodeActions
2360
- })), _ = j(
2385
+ })), D = j(
2361
2386
  () => {
2362
2387
  if (B.value, !t.editor.api.value) return [];
2363
2388
  const S = t.editor.flowModel.value, I = t.editor.api.value.overlay, N = [];
@@ -2400,7 +2425,7 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2400
2425
  position: { x: I.x + I.width, y: I.y + I.height + 4 },
2401
2426
  canDelete: N.nodeIds.length > 0 || N.edgeIds.length > 0
2402
2427
  };
2403
- }), d = q(), c = Kt({
2428
+ }), d = G(), c = Kt({
2404
2429
  editor: t.editor,
2405
2430
  quickAddProp: j(() => t.quickAdd),
2406
2431
  isDraggingNode: M,
@@ -2410,11 +2435,11 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2410
2435
  getNodeBehavior: O,
2411
2436
  getInsertGap: () => z.value.insertGap,
2412
2437
  closePopover: () => d.value?.closePopover()
2413
- }), v = c.data, w = c.handleOpen, x = c.handleClose, H = c.handleStartDrag, K = c.handleOverlayEnter, k = c.handleOverlayLeave, L = c.handleInsert, b = Qt({
2438
+ }), v = c.data, b = c.handleOpen, E = c.handleClose, F = c.handleStartDrag, K = c.handleOverlayEnter, k = c.handleOverlayLeave, L = c.handleInsert, w = Qt({
2414
2439
  editor: t.editor,
2415
2440
  edgeDropProp: j(() => t.edgeDrop)
2416
2441
  }), P = Jt(t.editor);
2417
- function G(S, I) {
2442
+ function H(S, I) {
2418
2443
  P.handleNodeAction(S, I, z.value.insertGap) && (C.value = null);
2419
2444
  }
2420
2445
  function Y(S) {
@@ -2510,9 +2535,9 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2510
2535
  return;
2511
2536
  }
2512
2537
  m.leave(180), c.quickAddPopoverOpen.value || c.leave();
2513
- }, n.value?.addEventListener("mousemove", g), E = () => {
2538
+ }, n.value?.addEventListener("mousemove", g), x = () => {
2514
2539
  m.reset(), c.quickAddPopoverOpen.value || (c.quickAddNodeId.value = null);
2515
- }, n.value?.addEventListener("mouseleave", E), n.value?.addEventListener("keydown", X);
2540
+ }, n.value?.addEventListener("mouseleave", x), n.value?.addEventListener("keydown", X);
2516
2541
  }
2517
2542
  function ne() {
2518
2543
  he(
@@ -2567,7 +2592,7 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2567
2592
  }
2568
2593
  },
2569
2594
  ...I
2570
- }), a = new Ht(), l = new Bt(
2595
+ }), a = new Ft(), l = new Bt(
2571
2596
  r,
2572
2597
  t.editor.schema,
2573
2598
  a,
@@ -2580,10 +2605,10 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2580
2605
  mode: t.editor.mode.value
2581
2606
  } : null
2582
2607
  );
2583
- const N = qt(r), U = jt({
2608
+ const N = Gt(r), U = jt({
2584
2609
  graph: r,
2585
2610
  overlayManager: N,
2586
- executeCommand: ($) => t.editor.executeCommand(b.tryExpandForEdgeDrop($)),
2611
+ executeCommand: ($) => t.editor.executeCommand(w.tryExpandForEdgeDrop($)),
2587
2612
  schema: t.editor.schema,
2588
2613
  flowModel: t.editor.flowModel,
2589
2614
  getNodeBehavior: O,
@@ -2624,14 +2649,14 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2624
2649
  const de = t.editor._pluginManager.collectExtendedApi();
2625
2650
  Object.assign(t.editor.extendedApi, de), t.editor._emitUiEvent = ($) => {
2626
2651
  t.editor._pluginManager.dispatchUiEvent($), o("ui-event", $);
2627
- }, h = new Gt(
2652
+ }, h = new Ht(
2628
2653
  r,
2629
2654
  ($) => {
2630
2655
  ($.type === "node.click" || $.type === "node.dblclick" || $.type === "node.contextmenu") && m.enter($.nodeId), t.editor._emitUiEvent($);
2631
2656
  },
2632
2657
  ($) => {
2633
2658
  if (l.isSyncing) return;
2634
- const re = b.tryExpandForEdgeDrop($);
2659
+ const re = w.tryExpandForEdgeDrop($);
2635
2660
  if (t.editor.executeCommand(re).status !== "applied") {
2636
2661
  for (const ye of re.commands)
2637
2662
  if (ye.type === "edge.add") {
@@ -2644,7 +2669,7 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2644
2669
  t.editor.idGenerator
2645
2670
  ), u = Vt(r);
2646
2671
  const J = Xt(r);
2647
- c.attachRuntime(r, ($) => J.hideNodePorts($)), b.attachRuntime(r), Q(J), oe(J);
2672
+ c.attachRuntime(r, ($) => J.hideNodePorts($)), w.attachRuntime(r), Q(J), oe(J);
2648
2673
  let Ae = /* @__PURE__ */ new Set();
2649
2674
  r.on("selection:changed", () => {
2650
2675
  const $ = it(r.getSelectedCells?.() ?? []);
@@ -2665,36 +2690,36 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2665
2690
  };
2666
2691
  r.on("translate", Pe), r.on("scale", Pe), r.on("resize", Pe), ie(), l.syncFlowModel(t.editor.flowModel.value), ne();
2667
2692
  }), Me(() => {
2668
- m.cleanup(), c.cleanup(), b.cleanup(), u?.remove(), p && r?.container?.removeEventListener("mousemove", p), g && n.value?.removeEventListener("mousemove", g), E && n.value?.removeEventListener("mouseleave", E), n.value?.removeEventListener("keydown", X), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
2693
+ m.cleanup(), c.cleanup(), w.cleanup(), u?.remove(), p && r?.container?.removeEventListener("mousemove", p), g && n.value?.removeEventListener("mousemove", g), x && n.value?.removeEventListener("mouseleave", x), n.value?.removeEventListener("keydown", X), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
2669
2694
  for (const S of Object.keys(t.editor.extendedApi))
2670
2695
  delete t.editor.extendedApi[S];
2671
2696
  h?.dispose(), l?.dispose(), a?.dispose(), r?.dispose();
2672
- }), (S, I) => (D(), T("div", {
2697
+ }), (S, I) => (_(), T("div", {
2673
2698
  ref_key: "rootRef",
2674
2699
  ref: n,
2675
2700
  class: se(["flow-canvas-runtime-core", { "flow-canvas-runtime-core--selection-mode": W.value }]),
2676
2701
  tabindex: "0"
2677
2702
  }, [
2678
- F("div", {
2703
+ q("div", {
2679
2704
  ref_key: "containerRef",
2680
2705
  ref: i,
2681
2706
  class: "flow-canvas-runtime-core__graph"
2682
2707
  }, null, 512),
2683
- F("div", go, [
2684
- (D(!0), T(pe, null, Ee(_.value, (N) => (D(), T("div", {
2708
+ q("div", go, [
2709
+ (_(!0), T(pe, null, xe(D.value, (N) => (_(), T("div", {
2685
2710
  key: `badge-${N.nodeId}`,
2686
2711
  class: "flow-canvas-runtime-core__badge",
2687
- style: be({ left: `${N.x}px`, top: `${N.y}px`, backgroundColor: N.badge.color })
2712
+ style: we({ left: `${N.x}px`, top: `${N.y}px`, backgroundColor: N.badge.color })
2688
2713
  }, ue(N.badge.text), 5))), 128)),
2689
- le(v) ? (D(), we(lo, {
2714
+ le(v) ? (_(), be(lo, {
2690
2715
  key: 0,
2691
2716
  ref_key: "quickAddPopoverRef",
2692
2717
  ref: d,
2693
2718
  node: le(v).node,
2694
2719
  "port-position": le(v).portPosition,
2695
- onOpen: le(w),
2696
- onClose: le(x),
2697
- onStartDrag: le(H),
2720
+ onOpen: le(b),
2721
+ onClose: le(E),
2722
+ onStartDrag: le(F),
2698
2723
  onMouseenter: le(K),
2699
2724
  onMouseleave: le(k)
2700
2725
  }, {
@@ -2708,18 +2733,18 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2708
2733
  ]),
2709
2734
  _: 3
2710
2735
  }, 8, ["node", "port-position", "onOpen", "onClose", "onStartDrag", "onMouseenter", "onMouseleave"])) : Z("", !0),
2711
- y.value ? (D(), we(so, {
2736
+ y.value ? (_(), be(so, {
2712
2737
  key: 1,
2713
2738
  node: y.value.node,
2714
2739
  position: y.value.position,
2715
2740
  config: z.value,
2716
2741
  behavior: y.value.behavior,
2717
2742
  "actions-offset": y.value.behavior.actionsOffset,
2718
- onAction: G,
2743
+ onAction: H,
2719
2744
  onMouseenter: le(R),
2720
2745
  onMouseleave: A
2721
2746
  }, null, 8, ["node", "position", "config", "behavior", "actions-offset", "onMouseenter"])) : Z("", !0),
2722
- f.value ? (D(), we(fo, {
2747
+ f.value ? (_(), be(fo, {
2723
2748
  key: 2,
2724
2749
  position: f.value.position,
2725
2750
  "can-delete": f.value.canDelete,
@@ -2735,7 +2760,7 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2735
2760
  items: {}
2736
2761
  },
2737
2762
  setup(s) {
2738
- const e = s, t = q(), o = j(() => e.items ? e.items : Object.keys(e.editor.schema.nodeTypes).map((n) => ({
2763
+ const e = s, t = G(), o = j(() => e.items ? e.items : Object.keys(e.editor.schema.nodeTypes).map((n) => ({
2739
2764
  type: n,
2740
2765
  label: n.charAt(0).toUpperCase() + n.slice(1)
2741
2766
  })));
@@ -2760,27 +2785,27 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2760
2785
  });
2761
2786
  },
2762
2787
  { flush: "post" }
2763
- ), (n, i) => (D(), T("div", ho, [
2764
- F("div", {
2788
+ ), (n, i) => (_(), T("div", ho, [
2789
+ q("div", {
2765
2790
  ref_key: "listRef",
2766
2791
  ref: t,
2767
2792
  class: "flow-canvas-node-palette__list"
2768
2793
  }, [
2769
- (D(!0), T(pe, null, Ee(o.value, (r) => (D(), T("div", {
2794
+ (_(!0), T(pe, null, xe(o.value, (r) => (_(), T("div", {
2770
2795
  key: r.type,
2771
2796
  class: "flow-canvas-node-palette__item",
2772
2797
  "data-node-type": r.type
2773
2798
  }, [
2774
- r.icon ? (D(), T("i", {
2799
+ r.icon ? (_(), T("i", {
2775
2800
  key: 0,
2776
2801
  class: se([r.icon, "flow-canvas-node-palette__item-icon"])
2777
2802
  }, null, 2)) : Z("", !0),
2778
- F("span", yo, ue(r.label), 1)
2803
+ q("span", yo, ue(r.label), 1)
2779
2804
  ], 8, vo))), 128))
2780
2805
  ], 512)
2781
2806
  ]));
2782
2807
  }
2783
- }), bo = /* @__PURE__ */ ve(mo, [["__scopeId", "data-v-300314b7"]]), wo = { class: "flow-canvas-layout" }, Eo = { class: "flow-canvas-layout__main" }, xo = { class: "flow-canvas-layout__content" }, Io = {
2808
+ }), wo = /* @__PURE__ */ ve(mo, [["__scopeId", "data-v-300314b7"]]), bo = { class: "flow-canvas-layout" }, xo = { class: "flow-canvas-layout__main" }, Eo = { class: "flow-canvas-layout__content" }, Io = {
2784
2809
  key: 0,
2785
2810
  class: "flow-canvas-layout__footer"
2786
2811
  }, Co = /* @__PURE__ */ ge({
@@ -2795,25 +2820,25 @@ const oo = { class: "flow-canvas-node-actions__bar" }, no = /* @__PURE__ */ ge({
2795
2820
  },
2796
2821
  emits: ["update:sidebarCollapsed"],
2797
2822
  setup(s) {
2798
- return (e, t) => (D(), T("div", wo, [
2799
- !s.hideSidebar && (e.$slots.sidebar || s.editor) ? (D(), T("aside", {
2823
+ return (e, t) => (_(), T("div", bo, [
2824
+ !s.hideSidebar && (e.$slots.sidebar || s.editor) ? (_(), T("aside", {
2800
2825
  key: 0,
2801
2826
  class: se(["flow-canvas-layout__sidebar", { "is-collapsed": s.sidebarCollapsed }]),
2802
- style: be({ width: s.sidebarCollapsed ? "0px" : `${s.sidebarWidth}px` })
2827
+ style: we({ width: s.sidebarCollapsed ? "0px" : `${s.sidebarWidth}px` })
2803
2828
  }, [
2804
2829
  Ie(e.$slots, "sidebar", {}, () => [
2805
- s.editor ? (D(), we(bo, {
2830
+ s.editor ? (_(), be(wo, {
2806
2831
  key: 0,
2807
2832
  editor: s.editor,
2808
2833
  items: s.paletteItems
2809
2834
  }, null, 8, ["editor", "items"])) : Z("", !0)
2810
2835
  ], !0)
2811
2836
  ], 6)) : Z("", !0),
2812
- F("div", Eo, [
2813
- F("div", xo, [
2837
+ q("div", xo, [
2838
+ q("div", Eo, [
2814
2839
  Ie(e.$slots, "default", {}, void 0, !0)
2815
2840
  ]),
2816
- !s.hideFooter && e.$slots.footer ? (D(), T("div", Io, [
2841
+ !s.hideFooter && e.$slots.footer ? (_(), T("div", Io, [
2817
2842
  Ie(e.$slots, "footer", {}, void 0, !0)
2818
2843
  ])) : Z("", !0)
2819
2844
  ])
@@ -2897,10 +2922,10 @@ function So(s) {
2897
2922
  (a) => !t.has(a.type)
2898
2923
  ), ...i, ...r];
2899
2924
  }
2900
- const Mo = { class: "flow-canvas-toolbar" }, _o = {
2925
+ const Mo = { class: "flow-canvas-toolbar" }, Do = {
2901
2926
  key: 0,
2902
2927
  class: "flow-canvas-toolbar__separator"
2903
- }, No = { class: "flow-canvas-toolbar__group" }, Do = {
2928
+ }, No = { class: "flow-canvas-toolbar__group" }, _o = {
2904
2929
  key: 0,
2905
2930
  class: "flow-canvas-toolbar__zoom-display"
2906
2931
  }, Ao = ["data-toolbar-id", "data-toolbar-type", "disabled", "onClick", "onMouseenter"], Po = ["textContent"], To = {
@@ -2932,15 +2957,15 @@ const Mo = { class: "flow-canvas-toolbar" }, _o = {
2932
2957
  }
2933
2958
  const i = s, r = j(() => {
2934
2959
  if (i.items) return i.items;
2935
- const d = So({ include: i.include }), c = i.editor.toolbarItems.value, v = new Set(i.exclude ?? []), w = /* @__PURE__ */ new Map();
2936
- for (const x of d)
2937
- w.set(x.id, x);
2938
- for (const x of c) {
2939
- const H = w.get(x.id);
2940
- H ? w.set(x.id, { ...H, ...x, order: H.order, group: H.group }) : o(x) && w.set(x.id, x);
2960
+ const d = So({ include: i.include }), c = i.editor.toolbarItems.value, v = new Set(i.exclude ?? []), b = /* @__PURE__ */ new Map();
2961
+ for (const E of d)
2962
+ b.set(E.id, E);
2963
+ for (const E of c) {
2964
+ const F = b.get(E.id);
2965
+ F ? b.set(E.id, { ...F, ...E, order: F.order, group: F.group }) : o(E) && b.set(E.id, E);
2941
2966
  }
2942
- return [...w.values()].filter((x) => x.type === "custom" || !e.has(x.type) ? !0 : !v.has(x.type)).sort((x, H) => (x.order ?? 0) - (H.order ?? 0));
2943
- }), l = q(1), a = q(null), h = q(null), u = q(!1);
2967
+ return [...b.values()].filter((E) => E.type === "custom" || !e.has(E.type) ? !0 : !v.has(E.type)).sort((E, F) => (E.order ?? 0) - (F.order ?? 0));
2968
+ }), l = G(1), a = G(null), h = G(null), u = G(!1);
2944
2969
  let p = null;
2945
2970
  he(
2946
2971
  () => i.editor.api.value,
@@ -2952,12 +2977,12 @@ const Mo = { class: "flow-canvas-toolbar" }, _o = {
2952
2977
  { immediate: !0 }
2953
2978
  );
2954
2979
  const g = lt({ visible: !1, text: "", shortcut: [], x: 0, y: 0 });
2955
- function E(d, c) {
2980
+ function x(d, c) {
2956
2981
  if (!c.description) return;
2957
- const w = d.currentTarget.getBoundingClientRect();
2982
+ const b = d.currentTarget.getBoundingClientRect();
2958
2983
  g.text = c.description, g.shortcut = c.shortcut ?? [], g.visible = !0, Le(() => {
2959
- const x = a.value?.offsetWidth ?? 0, H = a.value?.offsetHeight ?? 0;
2960
- g.x = w.left + w.width / 2 - x / 2, g.y = w.top - H - 6;
2984
+ const E = a.value?.offsetWidth ?? 0, F = a.value?.offsetHeight ?? 0;
2985
+ g.x = b.left + b.width / 2 - E / 2, g.y = b.top - F - 6;
2961
2986
  });
2962
2987
  }
2963
2988
  function m() {
@@ -3006,7 +3031,7 @@ const Mo = { class: "flow-canvas-toolbar" }, _o = {
3006
3031
  for (const c of y.value)
3007
3032
  !n(c.type) || c.id === d.id || W(c);
3008
3033
  }
3009
- function _(d) {
3034
+ function D(d) {
3010
3035
  if (!M.value || O(d)) return;
3011
3036
  if (n(d.type) && (h.value = d.type, z(d)), d.onClick) {
3012
3037
  d.onClick(M.value);
@@ -3035,8 +3060,8 @@ const Mo = { class: "flow-canvas-toolbar" }, _o = {
3035
3060
  case "export":
3036
3061
  if (u.value) break;
3037
3062
  u.value = !0, c.exportAsImage().then((v) => {
3038
- const w = URL.createObjectURL(v), x = document.createElement("a");
3039
- x.href = w, x.download = "canvas-export.png", x.click(), URL.revokeObjectURL(w);
3063
+ const b = URL.createObjectURL(v), E = document.createElement("a");
3064
+ E.href = b, E.download = "canvas-export.png", E.click(), URL.revokeObjectURL(b);
3040
3065
  }).catch((v) => {
3041
3066
  console.warn("[flow-canvas] Export failed:", v);
3042
3067
  }).finally(() => {
@@ -3061,60 +3086,60 @@ const Mo = { class: "flow-canvas-toolbar" }, _o = {
3061
3086
  const y = j(() => r.value.filter(R)), f = j(() => {
3062
3087
  const d = /* @__PURE__ */ new Map(), c = [];
3063
3088
  for (const v of y.value) {
3064
- const w = v.group ?? "default";
3065
- d.has(w) || (d.set(w, []), c.push(w)), d.get(w).push(v);
3089
+ const b = v.group ?? "default";
3090
+ d.has(b) || (d.set(b, []), c.push(b)), d.get(b).push(v);
3066
3091
  }
3067
3092
  return c.map((v) => ({ name: v, items: d.get(v) })).filter((v) => v.items.length > 0);
3068
3093
  });
3069
- return (d, c) => (D(), T("div", Mo, [
3070
- (D(!0), T(pe, null, Ee(f.value, (v, w) => (D(), T(pe, {
3094
+ return (d, c) => (_(), T("div", Mo, [
3095
+ (_(!0), T(pe, null, xe(f.value, (v, b) => (_(), T(pe, {
3071
3096
  key: v.name
3072
3097
  }, [
3073
- w > 0 ? (D(), T("div", _o)) : Z("", !0),
3074
- F("div", No, [
3075
- (D(!0), T(pe, null, Ee(v.items, (x) => (D(), T(pe, {
3076
- key: x.id
3098
+ b > 0 ? (_(), T("div", Do)) : Z("", !0),
3099
+ q("div", No, [
3100
+ (_(!0), T(pe, null, xe(v.items, (E) => (_(), T(pe, {
3101
+ key: E.id
3077
3102
  }, [
3078
- x.type === "zoom-display" ? (D(), T("span", Do, ue(C.value), 1)) : (D(), T("button", {
3103
+ E.type === "zoom-display" ? (_(), T("span", _o, ue(C.value), 1)) : (_(), T("button", {
3079
3104
  key: 1,
3080
3105
  type: "button",
3081
3106
  class: se(["flow-canvas-toolbar__btn", {
3082
- "is-disabled": O(x),
3083
- "is-active": V(x),
3084
- "is-exporting": x.type === "export" && u.value
3107
+ "is-disabled": O(E),
3108
+ "is-active": V(E),
3109
+ "is-exporting": E.type === "export" && u.value
3085
3110
  }]),
3086
- "data-toolbar-id": x.id,
3087
- "data-toolbar-type": x.type,
3088
- disabled: O(x),
3089
- onClick: (H) => _(x),
3090
- onMouseenter: (H) => E(H, x),
3111
+ "data-toolbar-id": E.id,
3112
+ "data-toolbar-type": E.type,
3113
+ disabled: O(E),
3114
+ onClick: (F) => D(E),
3115
+ onMouseenter: (F) => x(F, E),
3091
3116
  onMouseleave: m
3092
3117
  }, [
3093
- x.component ? (D(), we(dt(x.component), { key: 0 })) : x.icon ? (D(), T("i", {
3118
+ E.component ? (_(), be(dt(E.component), { key: 0 })) : E.icon ? (_(), T("i", {
3094
3119
  key: 1,
3095
- class: se(x.icon)
3096
- }, null, 2)) : (D(), T("span", {
3120
+ class: se(E.icon)
3121
+ }, null, 2)) : (_(), T("span", {
3097
3122
  key: 2,
3098
3123
  class: "flow-canvas-toolbar__text",
3099
- textContent: ue(x.text ?? x.description ?? x.id)
3124
+ textContent: ue(E.text ?? E.description ?? E.id)
3100
3125
  }, null, 8, Po))
3101
3126
  ], 42, Ao))
3102
3127
  ], 64))), 128))
3103
3128
  ])
3104
3129
  ], 64))), 128)),
3105
- (D(), we(ct, { to: "body" }, [
3106
- g.visible ? (D(), T("div", {
3130
+ (_(), be(ct, { to: "body" }, [
3131
+ g.visible ? (_(), T("div", {
3107
3132
  key: 0,
3108
3133
  ref_key: "tooltipRef",
3109
3134
  ref: a,
3110
3135
  class: "flow-canvas-toolbar-tooltip",
3111
- style: be({ left: `${g.x}px`, top: `${g.y}px` })
3136
+ style: we({ left: `${g.x}px`, top: `${g.y}px` })
3112
3137
  }, [
3113
- F("span", null, ue(g.text), 1),
3114
- g.shortcut.length ? (D(), T("kbd", To, [
3115
- (D(!0), T(pe, null, Ee(g.shortcut, (v, w) => (D(), T("span", { key: w }, ue(v), 1))), 128))
3138
+ q("span", null, ue(g.text), 1),
3139
+ g.shortcut.length ? (_(), T("kbd", To, [
3140
+ (_(!0), T(pe, null, xe(g.shortcut, (v, b) => (_(), T("span", { key: b }, ue(v), 1))), 128))
3116
3141
  ])) : Z("", !0),
3117
- c[0] || (c[0] = F("div", { class: "flow-canvas-toolbar-tooltip__arrow" }, null, -1))
3142
+ c[0] || (c[0] = q("div", { class: "flow-canvas-toolbar-tooltip__arrow" }, null, -1))
3118
3143
  ], 4)) : Z("", !0)
3119
3144
  ]))
3120
3145
  ]));
@@ -3144,24 +3169,24 @@ const Mo = { class: "flow-canvas-toolbar" }, _o = {
3144
3169
  const u = o.value?.type ?? "";
3145
3170
  return r.has(u) ? "endpoint" : l.has(u) ? "gateway" : "task";
3146
3171
  }), h = j(() => i[o.value?.type ?? ""] ?? "");
3147
- return (u, p) => (D(), T("div", {
3172
+ return (u, p) => (_(), T("div", {
3148
3173
  class: se(["flow-canvas-default-node", [`is-${a.value}`, { "flow-canvas-highlight-target": a.value !== "gateway" }]])
3149
3174
  }, [
3150
- a.value === "endpoint" ? (D(), T(pe, { key: 0 }, [
3151
- h.value ? (D(), T("i", {
3175
+ a.value === "endpoint" ? (_(), T(pe, { key: 0 }, [
3176
+ h.value ? (_(), T("i", {
3152
3177
  key: 0,
3153
3178
  class: se([["flow-canvas-icon", h.value], "flow-canvas-default-node__ep-icon"])
3154
3179
  }, null, 2)) : Z("", !0),
3155
- F("span", Lo, ue(n.value), 1)
3156
- ], 64)) : a.value === "gateway" ? (D(), T("div", Oo, [
3157
- h.value ? (D(), T("i", {
3180
+ q("span", Lo, ue(n.value), 1)
3181
+ ], 64)) : a.value === "gateway" ? (_(), T("div", Oo, [
3182
+ h.value ? (_(), T("i", {
3158
3183
  key: 0,
3159
3184
  class: se([["flow-canvas-icon", h.value], "flow-canvas-default-node__gw-icon"])
3160
3185
  }, null, 2)) : Z("", !0)
3161
- ])) : (D(), T("span", $o, ue(n.value), 1))
3186
+ ])) : (_(), T("span", $o, ue(n.value), 1))
3162
3187
  ], 2));
3163
3188
  }
3164
- }), Ho = /* @__PURE__ */ ve(Bo, [["__scopeId", "data-v-f0e24a9f"]]), Go = {
3189
+ }), Fo = /* @__PURE__ */ ve(Bo, [["__scopeId", "data-v-f0e24a9f"]]), Ho = {
3165
3190
  start: { label: "开始", icon: "flow-canvas-icon canvas-kaishi", width: 88, height: 40 },
3166
3191
  end: { label: "结束", icon: "flow-canvas-icon canvas-stop", width: 88, height: 40 },
3167
3192
  empty: { label: "空节点", icon: "flow-canvas-icon canvas-jiedi", width: 240, height: 48 },
@@ -3189,7 +3214,7 @@ function Ye() {
3189
3214
  }
3190
3215
  };
3191
3216
  }
3192
- function qo() {
3217
+ function Go() {
3193
3218
  return {
3194
3219
  manhattan: {
3195
3220
  router: { name: "manhattan", args: { padding: 10, maxDirectionChange: 90 } },
@@ -3204,12 +3229,12 @@ function qo() {
3204
3229
  }
3205
3230
  };
3206
3231
  }
3207
- function bn(s) {
3208
- const e = s?.nodeTypes ?? Go, t = {}, o = [];
3232
+ function wn(s) {
3233
+ const e = s?.nodeTypes ?? Ho, t = {}, o = [];
3209
3234
  for (const [r, l] of Object.entries(e)) {
3210
3235
  const a = l.width ?? 150, h = l.height ?? 50;
3211
3236
  t[r] = {
3212
- component: Ho,
3237
+ component: Fo,
3213
3238
  getSize: () => ({ width: a, height: h }),
3214
3239
  getPorts: () => st()
3215
3240
  }, o.push({
@@ -3219,7 +3244,7 @@ function bn(s) {
3219
3244
  });
3220
3245
  }
3221
3246
  const n = {
3222
- ...qo(),
3247
+ ...Go(),
3223
3248
  ...s?.edgeTypes
3224
3249
  }, i = s?.defaultEdgeType ?? "manhattan";
3225
3250
  return {
@@ -3227,7 +3252,7 @@ function bn(s) {
3227
3252
  paletteItems: o
3228
3253
  };
3229
3254
  }
3230
- function wn(s) {
3255
+ function bn(s) {
3231
3256
  return {
3232
3257
  name: "connection-validator",
3233
3258
  priority: 10,
@@ -3241,13 +3266,13 @@ function wn(s) {
3241
3266
  if (!l || !a) continue;
3242
3267
  const h = r.nodes[l], u = r.nodes[a];
3243
3268
  if (!h || !u) continue;
3244
- const p = i.type === "edge.add" ? i.edge.source.portId : i.source?.portId, g = i.type === "edge.add" ? i.edge.target.portId : i.target?.portId, E = p ? h.ports?.find((A) => A.id === p) : void 0, m = g ? u.ports?.find((A) => A.id === g) : void 0, C = i.type === "edge.reconnect" ? i.edgeId : void 0, M = Object.values(r.edges).filter(
3269
+ const p = i.type === "edge.add" ? i.edge.source.portId : i.source?.portId, g = i.type === "edge.add" ? i.edge.target.portId : i.target?.portId, x = p ? h.ports?.find((A) => A.id === p) : void 0, m = g ? u.ports?.find((A) => A.id === g) : void 0, C = i.type === "edge.reconnect" ? i.edgeId : void 0, M = Object.values(r.edges).filter(
3245
3270
  (A) => A.id !== C && !n.has(A.id)
3246
3271
  ), R = s({
3247
3272
  flowModel: r,
3248
3273
  sourceNode: h,
3249
3274
  targetNode: u,
3250
- sourcePort: E,
3275
+ sourcePort: x,
3251
3276
  targetPort: m,
3252
3277
  existingEdges: M
3253
3278
  });
@@ -3262,7 +3287,7 @@ function wn(s) {
3262
3287
  }
3263
3288
  };
3264
3289
  }
3265
- function En(s) {
3290
+ function xn(s) {
3266
3291
  const { rubberband: e = !0, multiple: t = !0, movable: o = !0 } = s ?? {};
3267
3292
  return {
3268
3293
  name: "selection",
@@ -3282,7 +3307,7 @@ function En(s) {
3282
3307
  }
3283
3308
  };
3284
3309
  }
3285
- function xn(s) {
3310
+ function En(s) {
3286
3311
  const { tolerance: e = 10, color: t = "#3a84ff" } = s ?? {};
3287
3312
  let o = null;
3288
3313
  return {
@@ -3303,7 +3328,7 @@ function xn(s) {
3303
3328
  }
3304
3329
  };
3305
3330
  }
3306
- const Fo = { class: "flow-canvas-search-popover__input" }, Uo = ["value", "placeholder"], zo = ["onMouseenter", "onClick"], jo = { class: "flow-canvas-search-popover__item-label" }, Wo = {
3331
+ const qo = { class: "flow-canvas-search-popover__input" }, Uo = ["value", "placeholder"], zo = ["onMouseenter", "onClick"], jo = { class: "flow-canvas-search-popover__item-label" }, Wo = {
3307
3332
  key: 0,
3308
3333
  class: "flow-canvas-search-popover__item-subtitle"
3309
3334
  }, Vo = {
@@ -3322,7 +3347,7 @@ const Fo = { class: "flow-canvas-search-popover__input" }, Uo = ["value", "place
3322
3347
  },
3323
3348
  emits: ["update:query", "select", "close"],
3324
3349
  setup(s, { emit: e }) {
3325
- const t = s, o = e, n = q(null), i = q(null), r = q(-1);
3350
+ const t = s, o = e, n = G(null), i = G(null), r = G(-1);
3326
3351
  he(
3327
3352
  () => t.open,
3328
3353
  (m) => {
@@ -3380,25 +3405,25 @@ const Fo = { class: "flow-canvas-search-popover__input" }, Uo = ["value", "place
3380
3405
  }
3381
3406
  m.key === "Enter" && (m.preventDefault(), p());
3382
3407
  }
3383
- function E(m) {
3408
+ function x(m) {
3384
3409
  if (!t.open) return;
3385
3410
  const C = m.target;
3386
3411
  C && i.value?.contains(C) || t.isAnchorTarget?.(m.target) || o("close");
3387
3412
  }
3388
3413
  return ot(() => {
3389
- document.addEventListener("mousedown", E);
3414
+ document.addEventListener("mousedown", x);
3390
3415
  }), Me(() => {
3391
- document.removeEventListener("mousedown", E);
3392
- }), (m, C) => s.open ? (D(), T("div", {
3416
+ document.removeEventListener("mousedown", x);
3417
+ }), (m, C) => s.open ? (_(), T("div", {
3393
3418
  key: 0,
3394
3419
  ref_key: "panelRef",
3395
3420
  ref: i,
3396
3421
  class: "flow-canvas-search-popover",
3397
- style: be({ left: `${s.position.x}px`, top: `${s.position.y}px`, width: `${s.position.width}px` })
3422
+ style: we({ left: `${s.position.x}px`, top: `${s.position.y}px`, width: `${s.position.width}px` })
3398
3423
  }, [
3399
- F("div", Fo, [
3400
- C[1] || (C[1] = F("i", { class: "flow-canvas-icon canvas-search" }, null, -1)),
3401
- F("input", {
3424
+ q("div", qo, [
3425
+ C[1] || (C[1] = q("i", { class: "flow-canvas-icon canvas-search" }, null, -1)),
3426
+ q("input", {
3402
3427
  ref_key: "inputRef",
3403
3428
  ref: n,
3404
3429
  value: s.query,
@@ -3406,32 +3431,32 @@ const Fo = { class: "flow-canvas-search-popover__input" }, Uo = ["value", "place
3406
3431
  onInput: l,
3407
3432
  onKeydown: g
3408
3433
  }, null, 40, Uo),
3409
- s.query ? (D(), T("button", {
3434
+ s.query ? (_(), T("button", {
3410
3435
  key: 0,
3411
3436
  type: "button",
3412
3437
  class: "flow-canvas-search-popover__clear",
3413
3438
  "aria-label": "清空搜索",
3414
3439
  onClick: u
3415
3440
  }, [...C[0] || (C[0] = [
3416
- F("i", { class: "flow-canvas-icon canvas-close-circle-shape" }, null, -1)
3441
+ q("i", { class: "flow-canvas-icon canvas-close-circle-shape" }, null, -1)
3417
3442
  ])])) : Z("", !0)
3418
3443
  ]),
3419
- s.results.length ? (D(), T("div", {
3444
+ s.results.length ? (_(), T("div", {
3420
3445
  key: 0,
3421
3446
  class: "flow-canvas-search-popover__list",
3422
3447
  onMouseleave: h
3423
3448
  }, [
3424
- (D(!0), T(pe, null, Ee(s.results, (M, R) => (D(), T("button", {
3449
+ (_(!0), T(pe, null, xe(s.results, (M, R) => (_(), T("button", {
3425
3450
  key: M.id,
3426
3451
  type: "button",
3427
3452
  class: se(["flow-canvas-search-popover__item", { "is-active": R === r.value }]),
3428
3453
  onMouseenter: (A) => a(R),
3429
3454
  onClick: (A) => o("select", M.id)
3430
3455
  }, [
3431
- F("span", jo, ue(M.label), 1),
3432
- M.subtitle ? (D(), T("span", Wo, ue(M.subtitle), 1)) : Z("", !0)
3456
+ q("span", jo, ue(M.label), 1),
3457
+ M.subtitle ? (_(), T("span", Wo, ue(M.subtitle), 1)) : Z("", !0)
3433
3458
  ], 42, zo))), 128))
3434
- ], 32)) : (D(), T("div", Vo, ue(s.emptyText), 1))
3459
+ ], 32)) : (_(), T("div", Vo, ue(s.emptyText), 1))
3435
3460
  ], 4)) : Z("", !0);
3436
3461
  }
3437
3462
  }), Ko = /* @__PURE__ */ ve(Xo, [["__scopeId", "data-v-c80f6b26"]]), Qe = 282, Zo = 4, Yo = 300, Qo = 360, Oe = 100, Jo = Qo * 4 - Oe;
@@ -3462,18 +3487,18 @@ function nn(s, e) {
3462
3487
  }
3463
3488
  function In(s) {
3464
3489
  let e = null, t = null, o = null, n = null, i = null, r = [];
3465
- const l = q(!1), a = q(""), h = q({ x: 0, y: 0, width: Qe }), u = j(() => e ? Object.values(e.flowModel.value.nodes).map((_) => nn(_, s)).filter(en) : []), p = j(() => {
3466
- const _ = a.value.trim().toLowerCase(), y = Math.max(1, s?.maxResults ?? Yo);
3467
- return _ ? u.value.filter((f) => f.keywords.some((d) => d.toLowerCase().includes(_))).slice(0, y) : u.value.slice(0, y);
3490
+ const l = G(!1), a = G(""), h = G({ x: 0, y: 0, width: Qe }), u = j(() => e ? Object.values(e.flowModel.value.nodes).map((D) => nn(D, s)).filter(en) : []), p = j(() => {
3491
+ const D = a.value.trim().toLowerCase(), y = Math.max(1, s?.maxResults ?? Yo);
3492
+ return D ? u.value.filter((f) => f.keywords.some((d) => d.toLowerCase().includes(D))).slice(0, y) : u.value.slice(0, y);
3468
3493
  });
3469
3494
  function g() {
3470
3495
  return o?.querySelector('.flow-canvas-toolbar__btn[data-toolbar-type="search"]');
3471
3496
  }
3472
- function E() {
3497
+ function x() {
3473
3498
  return g()?.closest(".flow-canvas-toolbar");
3474
3499
  }
3475
3500
  function m() {
3476
- const _ = E(), y = o?.getBoundingClientRect(), f = _?.getBoundingClientRect() ?? y;
3501
+ const D = x(), y = o?.getBoundingClientRect(), f = D?.getBoundingClientRect() ?? y;
3477
3502
  if (!f) return;
3478
3503
  const d = Math.max(Qe, Math.round(f.width));
3479
3504
  h.value = {
@@ -3483,19 +3508,19 @@ function In(s) {
3483
3508
  };
3484
3509
  }
3485
3510
  function C() {
3486
- r.forEach((_) => clearTimeout(_)), r = [], t?.api.clearHighlight();
3511
+ r.forEach((D) => clearTimeout(D)), r = [], t?.api.clearHighlight();
3487
3512
  }
3488
- function M(_) {
3513
+ function M(D) {
3489
3514
  C();
3490
3515
  const y = setTimeout(() => {
3491
- t?.api.highlightNodes([_]);
3516
+ t?.api.highlightNodes([D]);
3492
3517
  }, Oe), f = setTimeout(() => {
3493
3518
  t?.api.clearHighlight(), r = [];
3494
3519
  }, Oe + Jo);
3495
3520
  r.push(y, f);
3496
3521
  }
3497
- function R(_) {
3498
- t && (t.api.scrollToNode(_), M(_));
3522
+ function R(D) {
3523
+ t && (t.api.scrollToNode(D), M(D));
3499
3524
  }
3500
3525
  function A() {
3501
3526
  t && (l.value = !0, m(), requestAnimationFrame(() => m()));
@@ -3510,9 +3535,9 @@ function In(s) {
3510
3535
  }
3511
3536
  A();
3512
3537
  }
3513
- function O(_) {
3538
+ function O(D) {
3514
3539
  const y = g();
3515
- return !!(y && _ instanceof Node && y.contains(_));
3540
+ return !!(y && D instanceof Node && y.contains(D));
3516
3541
  }
3517
3542
  function W() {
3518
3543
  l.value && m();
@@ -3528,8 +3553,8 @@ function In(s) {
3528
3553
  placeholder: s?.placeholder ?? "搜索节点名称",
3529
3554
  emptyText: s?.emptyText ?? "暂无匹配节点",
3530
3555
  isAnchorTarget: O,
3531
- "onUpdate:query": (_) => {
3532
- a.value = _;
3556
+ "onUpdate:query": (D) => {
3557
+ a.value = D;
3533
3558
  },
3534
3559
  onSelect: R,
3535
3560
  onClose: B
@@ -3539,11 +3564,11 @@ function In(s) {
3539
3564
  return {
3540
3565
  name: "search",
3541
3566
  priority: 90,
3542
- install(_) {
3543
- e = _;
3567
+ install(D) {
3568
+ e = D;
3544
3569
  },
3545
- attachRuntime(_) {
3546
- t = _, o = _.graph.container.closest(".flow-canvas-layout__content") ?? _.graph.container.parentElement, n = document.createElement("div"), n.className = "flow-canvas-search-host", document.body.append(n), i = ft(z), i.mount(n), window.addEventListener("resize", W), window.addEventListener("scroll", W, !0);
3570
+ attachRuntime(D) {
3571
+ t = D, o = D.graph.container.closest(".flow-canvas-layout__content") ?? D.graph.container.parentElement, n = document.createElement("div"), n.className = "flow-canvas-search-host", document.body.append(n), i = ft(z), i.mount(n), window.addEventListener("resize", W), window.addEventListener("scroll", W, !0);
3547
3572
  },
3548
3573
  detachRuntime() {
3549
3574
  B(), C(), window.removeEventListener("resize", W), window.removeEventListener("scroll", W, !0), i?.unmount(), i = null, n?.remove(), n = null, o = null, t = null;
@@ -3582,8 +3607,8 @@ function ln(s) {
3582
3607
  let o = null, n = s.defaultOpen ?? !1, i = null;
3583
3608
  function r() {
3584
3609
  !s.onClickOutside || i || (i = (g) => {
3585
- const E = g.target;
3586
- E && e.contains(E) || g.target?.closest('[data-toolbar-type="minimap"]') || s.onClickOutside();
3610
+ const x = g.target;
3611
+ x && e.contains(x) || g.target?.closest('[data-toolbar-type="minimap"]') || s.onClickOutside();
3587
3612
  }, document.addEventListener("mousedown", i));
3588
3613
  }
3589
3614
  function l() {
@@ -3620,7 +3645,7 @@ function ln(s) {
3620
3645
  }
3621
3646
  function Cn(s) {
3622
3647
  let e = null;
3623
- const t = q(!1);
3648
+ const t = G(!1);
3624
3649
  function o(i) {
3625
3650
  e?.setOpen(i), t.value = i;
3626
3651
  }
@@ -3727,25 +3752,25 @@ function kn() {
3727
3752
  export {
3728
3753
  fe as CanvasConstraintError,
3729
3754
  yn as CanvasLayout,
3730
- bo as CanvasNodePalette,
3755
+ wo as CanvasNodePalette,
3731
3756
  vn as CanvasRuntime,
3732
3757
  yt as CanvasSchemaError,
3733
3758
  mn as CanvasToolbar,
3734
- Ho as DefaultNode,
3759
+ Fo as DefaultNode,
3735
3760
  so as NodeActionsToolbar,
3736
3761
  lo as NodeQuickAddPopover,
3737
3762
  nt as applyCanvasCommand,
3738
3763
  kn as clipboardPlugin,
3739
- wn as connectionValidatorPlugin,
3740
- qo as createBuiltinEdgeTypes,
3764
+ bn as connectionValidatorPlugin,
3765
+ Go as createBuiltinEdgeTypes,
3741
3766
  At as createCanvasHistory,
3742
- bn as createDefaultSchema,
3767
+ wn as createDefaultSchema,
3743
3768
  So as createDefaultToolbarItems,
3744
3769
  pn as createEmptyFlowModel,
3745
3770
  te as generateId,
3746
3771
  Cn as minimapPlugin,
3747
3772
  In as searchPlugin,
3748
- En as selectionPlugin,
3749
- xn as snaplinePlugin,
3773
+ xn as selectionPlugin,
3774
+ En as snaplinePlugin,
3750
3775
  hn as useCanvasEditor
3751
3776
  };