@m3ui-vue/m3ui-vue 1.3.2 → 1.3.4
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/API.md +77 -5
- package/dist/api.json +1 -1
- package/dist/components/MFlow.vue.d.ts +45 -6
- package/dist/components/MFlowHandle.vue.d.ts +3 -2
- package/dist/composables/flowPaths.d.ts +20 -1
- package/dist/composables/useFlow.d.ts +47 -1
- package/dist/flow.d.ts +2 -2
- package/dist/flow.js +1358 -1060
- package/dist/flow.js.map +1 -1
- package/dist/flowPaths-DzW-aiET.js +204 -0
- package/dist/flowPaths-DzW-aiET.js.map +1 -0
- package/dist/gantt.js +1 -1
- package/dist/m3ui.js +2 -2
- package/dist/m3ui.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/MFlow.test.ts +139 -2
- package/src/components/MFloorPlanInspector.vue +3 -3
- package/src/components/MFlow.vue +268 -33
- package/src/components/MFlowHandle.vue +5 -3
- package/src/components/_MFlowEdge.vue +73 -1
- package/src/composables/flowPaths.ts +77 -7
- package/src/composables/useFlow.ts +39 -1
- package/src/flow.ts +2 -1
- package/dist/flowPaths-CUc6X373.js +0 -161
- package/dist/flowPaths-CUc6X373.js.map +0 -1
package/dist/flow.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { i as e } from "./useLocale-CaWwi-b6.js";
|
|
2
2
|
import { r as t, t as n, u as r } from "./MIconButton-DoNotQ9v.js";
|
|
3
|
-
import { a as i, c as a,
|
|
4
|
-
import { Fragment as
|
|
3
|
+
import { a as i, c as a, d as o, i as s, l as c, n as l, o as u, r as d, s as f, t as p, u as m } from "./flowPaths-DzW-aiET.js";
|
|
4
|
+
import { Fragment as h, Transition as g, computed as _, createBlock as v, createCommentVNode as y, createElementBlock as b, createElementVNode as x, createTextVNode as S, createVNode as C, defineComponent as w, inject as T, mergeProps as ee, nextTick as E, normalizeClass as D, normalizeStyle as O, onBeforeUnmount as te, onMounted as ne, openBlock as k, provide as re, reactive as ie, ref as A, renderList as ae, renderSlot as oe, shallowReactive as se, shallowRef as ce, toDisplayString as le, toRaw as ue, unref as j, useSlots as de, vShow as fe, watch as pe, withCtx as me, withDirectives as M, withModifiers as he } from "vue";
|
|
5
5
|
//#region src/composables/useFlow.ts
|
|
6
6
|
var ge = Symbol("m3-flow"), _e = Symbol("m3-flow-node");
|
|
7
7
|
function ve() {
|
|
8
|
-
let e =
|
|
8
|
+
let e = T(ge, null);
|
|
9
9
|
if (!e) throw Error("useFlow() must be called inside <MFlow>");
|
|
10
10
|
return e;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
function ye() {
|
|
13
|
+
return T(_e, null);
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/composables/flowLayout.ts
|
|
17
|
-
function
|
|
17
|
+
function N(e, t, n) {
|
|
18
18
|
let r = new Map(e.map((e) => [e.id, e])), i = (e) => {
|
|
19
19
|
let t = r.get(e);
|
|
20
20
|
for (let e = 0; t?.parentId && e < 100; e++) t = r.get(t.parentId);
|
|
@@ -50,7 +50,7 @@ function j(e, t, n) {
|
|
|
50
50
|
levelGap: n.levelGap ?? 80
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function P(e, t, n) {
|
|
54
54
|
let r = Math.max(0, ...n.values()) + 1, i = Array(r).fill(0);
|
|
55
55
|
for (let t of e.ids) i[n.get(t)] = Math.max(i[n.get(t)], e.size(t).depth);
|
|
56
56
|
let a = [], o = 0;
|
|
@@ -70,8 +70,8 @@ function M(e, t, n) {
|
|
|
70
70
|
}
|
|
71
71
|
return c;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
let r =
|
|
73
|
+
function be(e, t, n = {}) {
|
|
74
|
+
let r = N(e, t, n), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = r.ids.filter((e) => !r.inc.get(e).length);
|
|
75
75
|
!o.length && r.ids.length && o.push(r.ids[0]);
|
|
76
76
|
let s = /* @__PURE__ */ new Map(), c = [], l = (e) => {
|
|
77
77
|
if (!a.has(e)) for (a.add(e), s.set(e, 0), c.push(e); c.length;) {
|
|
@@ -92,10 +92,10 @@ function ye(e, t, n = {}) {
|
|
|
92
92
|
for (let e of a) p(e, o), o += u.get(e) + r.gap;
|
|
93
93
|
}, m = 0;
|
|
94
94
|
for (let e of o) d(e), p(e, m), m += u.get(e) + r.gap * 2;
|
|
95
|
-
return
|
|
95
|
+
return P(r, f, s);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
let r =
|
|
97
|
+
function xe(e, t, n = {}) {
|
|
98
|
+
let r = N(e, t, n), i = /* @__PURE__ */ new Map(), a = new Map(r.ids.map((e) => [e, []])), o = (e) => {
|
|
99
99
|
i.set(e, 1);
|
|
100
100
|
for (let t of r.out.get(e)) i.get(t) !== 1 && (a.get(e).push(t), i.get(t) || o(t));
|
|
101
101
|
i.set(e, 2);
|
|
@@ -166,19 +166,19 @@ function be(e, t, n = {}) {
|
|
|
166
166
|
let y = Infinity;
|
|
167
167
|
for (let e of r.ids) y = Math.min(y, _.get(e) - r.size(e).breadth / 2);
|
|
168
168
|
if (Number.isFinite(y)) for (let e of r.ids) _.set(e, _.get(e) - y);
|
|
169
|
-
return
|
|
169
|
+
return P(r, _, l);
|
|
170
170
|
}
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region src/composables/_flowSlot.ts
|
|
173
|
-
var
|
|
174
|
-
|
|
173
|
+
var F = (e) => e.fn(e.scope);
|
|
174
|
+
F.props = ["fn", "scope"];
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/components/MFlowHandle.vue?vue&type=script&setup=true&lang.ts
|
|
177
|
-
var
|
|
177
|
+
var Se = [
|
|
178
178
|
"data-flow-handle",
|
|
179
179
|
"data-handle-id",
|
|
180
180
|
"data-flow-connectable"
|
|
181
|
-
],
|
|
181
|
+
], I = /* @__PURE__ */ w({
|
|
182
182
|
__name: "MFlowHandle",
|
|
183
183
|
props: {
|
|
184
184
|
type: { default: "source" },
|
|
@@ -190,7 +190,8 @@ var N = [
|
|
|
190
190
|
}
|
|
191
191
|
},
|
|
192
192
|
setup(e) {
|
|
193
|
-
let t = e, n =
|
|
193
|
+
let t = e, n = T(ge, null), r = T(_e, null), i = A(), a = _(() => t.position ?? (t.type === "source" ? n?.direction.value === "vertical" ? "bottom" : "right" : n?.direction.value === "vertical" ? "top" : "left")), o = _(() => t.connectable && !!n?.nodesConnectable.value && r?.node.value.connectable !== !1), s = _(() => `${r?.id}:${t.id ?? ""}:${t.type}`), c = _(() => n?.connectionTarget.value?.key === s.value ? n.connectionTarget.value : null), l = {
|
|
194
|
+
auto: "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
194
195
|
top: "top-0 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
195
196
|
right: "top-1/2 right-0 translate-x-1/2 -translate-y-1/2",
|
|
196
197
|
bottom: "bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2",
|
|
@@ -203,10 +204,10 @@ var N = [
|
|
|
203
204
|
position: a.value,
|
|
204
205
|
connectable: o.value
|
|
205
206
|
})));
|
|
206
|
-
}),
|
|
207
|
+
}), te(() => u?.()), (t, n) => (k(), b("div", {
|
|
207
208
|
ref_key: "el",
|
|
208
209
|
ref: i,
|
|
209
|
-
class:
|
|
210
|
+
class: D(["m3-flow-handle absolute z-10 size-2.5 rounded-full border-2 transition-[background-color,border-color,scale,opacity] duration-150 before:absolute before:-inset-2.5 before:rounded-full", [
|
|
210
211
|
l[a.value],
|
|
211
212
|
c.value ? c.value.valid ? "scale-150 border-primary bg-primary" : "scale-125 border-error bg-error-container" : "border-outline bg-surface",
|
|
212
213
|
o.value ? "cursor-crosshair hover:scale-125 hover:border-primary" : "opacity-0"
|
|
@@ -215,9 +216,9 @@ var N = [
|
|
|
215
216
|
"data-handle-id": e.id,
|
|
216
217
|
"data-flow-connectable": o.value,
|
|
217
218
|
"aria-hidden": "true"
|
|
218
|
-
}, null, 10,
|
|
219
|
+
}, null, 10, Se));
|
|
219
220
|
}
|
|
220
|
-
}),
|
|
221
|
+
}), L = { class: "flex items-center gap-3 p-3" }, Ce = {
|
|
221
222
|
class: "material-symbols-outlined text-[24px]",
|
|
222
223
|
"aria-hidden": "true"
|
|
223
224
|
}, we = { class: "min-w-0 flex-1" }, Te = {
|
|
@@ -233,7 +234,7 @@ var N = [
|
|
|
233
234
|
}, Oe = {
|
|
234
235
|
key: 0,
|
|
235
236
|
class: "px-3 pb-3"
|
|
236
|
-
}, ke = /* @__PURE__ */
|
|
237
|
+
}, ke = /* @__PURE__ */ w({
|
|
237
238
|
__name: "MFlowNode",
|
|
238
239
|
props: {
|
|
239
240
|
label: {},
|
|
@@ -246,7 +247,7 @@ var N = [
|
|
|
246
247
|
targetPosition: {}
|
|
247
248
|
},
|
|
248
249
|
setup(e) {
|
|
249
|
-
let t = e, n =
|
|
250
|
+
let t = e, n = T(ge, null), r = T(_e, null), i = _(() => r?.selected.value ?? !1), a = _(() => r?.dragging.value ?? !1), o = _(() => {
|
|
250
251
|
let e = r?.node.value, i = e && n ? n.sidePositions(e) : {
|
|
251
252
|
source: "right",
|
|
252
253
|
target: "left"
|
|
@@ -266,30 +267,30 @@ var N = [
|
|
|
266
267
|
error: "bg-error-container text-on-error-container",
|
|
267
268
|
neutral: "bg-surface-container-highest text-on-surface-variant"
|
|
268
269
|
};
|
|
269
|
-
return (t, n) => (
|
|
270
|
+
return (t, n) => (k(), b("div", { class: D(["m3-flow-card rounded-md border text-on-surface transition-[box-shadow,border-color] duration-200", [
|
|
270
271
|
s[e.variant],
|
|
271
272
|
i.value && "border-primary! ring-1 ring-primary",
|
|
272
273
|
a.value ? "shadow-elevation-4!" : e.variant === "elevated" ? "hover:shadow-elevation-2" : "hover:shadow-elevation-1"
|
|
273
274
|
]]) }, [
|
|
274
|
-
|
|
275
|
-
oe(t.$slots, "icon", {}, () => [e.icon ? (
|
|
275
|
+
x("div", L, [
|
|
276
|
+
oe(t.$slots, "icon", {}, () => [e.icon ? (k(), b("span", {
|
|
276
277
|
key: 0,
|
|
277
|
-
class:
|
|
278
|
-
}, [
|
|
279
|
-
|
|
280
|
-
t.$slots.trailing ? (
|
|
278
|
+
class: D(["flex size-10 shrink-0 items-center justify-center rounded-sm", c[e.color]])
|
|
279
|
+
}, [x("span", Ce, le(e.icon), 1)], 2)) : y("", !0)]),
|
|
280
|
+
x("div", we, [e.label ? (k(), b("div", Te, le(e.label), 1)) : y("", !0), e.subtitle ? (k(), b("div", Ee, le(e.subtitle), 1)) : y("", !0)]),
|
|
281
|
+
t.$slots.trailing ? (k(), b("div", De, [oe(t.$slots, "trailing")])) : y("", !0)
|
|
281
282
|
]),
|
|
282
|
-
t.$slots.default ? (
|
|
283
|
-
|
|
283
|
+
t.$slots.default ? (k(), b("div", Oe, [oe(t.$slots, "default")])) : y("", !0),
|
|
284
|
+
j(r) && (e.handles === "both" || e.handles === "target") ? (k(), v(I, {
|
|
284
285
|
key: 1,
|
|
285
286
|
type: "target",
|
|
286
287
|
position: o.value.target
|
|
287
|
-
}, null, 8, ["position"])) :
|
|
288
|
-
|
|
288
|
+
}, null, 8, ["position"])) : y("", !0),
|
|
289
|
+
j(r) && (e.handles === "both" || e.handles === "source") ? (k(), v(I, {
|
|
289
290
|
key: 2,
|
|
290
291
|
type: "source",
|
|
291
292
|
position: o.value.source
|
|
292
|
-
}, null, 8, ["position"])) :
|
|
293
|
+
}, null, 8, ["position"])) : y("", !0)
|
|
293
294
|
], 2));
|
|
294
295
|
}
|
|
295
296
|
}), Ae = [
|
|
@@ -304,33 +305,33 @@ var N = [
|
|
|
304
305
|
}, Me = {
|
|
305
306
|
key: 0,
|
|
306
307
|
class: "material-symbols-outlined text-[18px]"
|
|
307
|
-
},
|
|
308
|
+
}, Ne = { class: "truncate px-1" }, R = {
|
|
308
309
|
key: 0,
|
|
309
310
|
class: "absolute -top-1.5 -right-1.5 flex h-6 min-w-6 items-center justify-center rounded-full bg-tertiary px-1.5 text-label-small text-on-tertiary shadow-elevation-1"
|
|
310
|
-
}, Pe = /* @__PURE__ */
|
|
311
|
+
}, Pe = /* @__PURE__ */ w({
|
|
311
312
|
__name: "_MFlowNodeShell",
|
|
312
313
|
props: {
|
|
313
314
|
node: {},
|
|
314
315
|
render: { type: Function }
|
|
315
316
|
},
|
|
316
317
|
setup(t) {
|
|
317
|
-
let n = t, r =
|
|
318
|
+
let n = t, r = T(ge), i = e(), a = A(), o = n.node.id, s = _(() => n.node), c = _(() => r.selectedNodes.value.has(o)), l = _(() => r.isLifted(o));
|
|
318
319
|
re(_e, {
|
|
319
320
|
id: o,
|
|
320
321
|
node: s,
|
|
321
322
|
selected: c,
|
|
322
323
|
dragging: l
|
|
323
324
|
});
|
|
324
|
-
let u =
|
|
325
|
+
let u = _(() => n.node.type === "group"), d = _(() => n.node.data ?? {}), f = _(() => r.getAbsolutePosition(o)), p = _(() => u.value ? r.getSize(o) : {
|
|
325
326
|
width: n.node.width,
|
|
326
327
|
height: n.node.height
|
|
327
|
-
}),
|
|
328
|
+
}), m = _(() => {
|
|
328
329
|
switch (n.node.type) {
|
|
329
330
|
case "input": return "source";
|
|
330
331
|
case "output": return "target";
|
|
331
332
|
default: return "both";
|
|
332
333
|
}
|
|
333
|
-
}),
|
|
334
|
+
}), h = _(() => {
|
|
334
335
|
let e = n.node.data ?? {};
|
|
335
336
|
return {
|
|
336
337
|
size: e.size ?? 56,
|
|
@@ -338,38 +339,38 @@ var N = [
|
|
|
338
339
|
badge: e.badge,
|
|
339
340
|
ring: e.ring
|
|
340
341
|
};
|
|
341
|
-
}),
|
|
342
|
+
}), g = {
|
|
342
343
|
primary: "bg-primary-container text-on-primary-container",
|
|
343
344
|
secondary: "bg-secondary-container text-on-secondary-container",
|
|
344
345
|
tertiary: "bg-tertiary-container text-on-tertiary-container",
|
|
345
346
|
error: "bg-error-container text-on-error-container",
|
|
346
347
|
neutral: "bg-surface-container-highest text-on-surface",
|
|
347
348
|
inverse: "bg-inverse-surface text-inverse-on-surface"
|
|
348
|
-
},
|
|
349
|
+
}, w = {
|
|
349
350
|
primary: "ring-4 ring-primary/35",
|
|
350
351
|
secondary: "ring-4 ring-secondary/35",
|
|
351
352
|
tertiary: "ring-4 ring-tertiary/35",
|
|
352
353
|
error: "ring-4 ring-error/35"
|
|
353
|
-
},
|
|
354
|
-
return ne(() => r.registerNodeEl(o, a.value)),
|
|
354
|
+
}, ee = _(() => n.node.draggable !== !1 && !r.locked.value);
|
|
355
|
+
return ne(() => r.registerNodeEl(o, a.value)), te(() => r.registerNodeEl(o, null)), (e, n) => (k(), b("div", {
|
|
355
356
|
ref_key: "el",
|
|
356
357
|
ref: a,
|
|
357
|
-
class:
|
|
358
|
-
style:
|
|
358
|
+
class: D(["m3-flow-node absolute top-0 left-0 rounded-md outline-none focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-secondary", [s.value.class, ee.value && (l.value ? "cursor-grabbing" : "cursor-grab")]]),
|
|
359
|
+
style: O({
|
|
359
360
|
transform: `translate(${f.value.x}px, ${f.value.y}px)`,
|
|
360
|
-
zIndex:
|
|
361
|
+
zIndex: j(r).zIndexOf(j(o)),
|
|
361
362
|
width: p.value.width ? `${p.value.width}px` : void 0,
|
|
362
363
|
height: p.value.height ? `${p.value.height}px` : void 0
|
|
363
364
|
}),
|
|
364
|
-
"data-flow-node":
|
|
365
|
+
"data-flow-node": j(o),
|
|
365
366
|
"data-selected": c.value || void 0,
|
|
366
367
|
"data-dragging": l.value || void 0,
|
|
367
368
|
tabindex: "0",
|
|
368
369
|
role: "group",
|
|
369
|
-
"aria-roledescription":
|
|
370
|
-
"aria-label": d.value.label ??
|
|
371
|
-
onKeydown: n[0] ||= (e) =>
|
|
372
|
-
}, [t.render ? (
|
|
370
|
+
"aria-roledescription": j(i).flowNode,
|
|
371
|
+
"aria-label": d.value.label ?? j(o),
|
|
372
|
+
onKeydown: n[0] ||= (e) => j(r).onNodeKey(e, j(o))
|
|
373
|
+
}, [t.render ? (k(), v(j(F), {
|
|
373
374
|
key: 0,
|
|
374
375
|
fn: t.render,
|
|
375
376
|
scope: {
|
|
@@ -378,33 +379,33 @@ var N = [
|
|
|
378
379
|
selected: c.value,
|
|
379
380
|
dragging: l.value
|
|
380
381
|
}
|
|
381
|
-
}, null, 8, ["fn", "scope"])) : u.value ? (
|
|
382
|
+
}, null, 8, ["fn", "scope"])) : u.value ? (k(), b("div", {
|
|
382
383
|
key: 1,
|
|
383
|
-
class:
|
|
384
|
-
}, [d.value.label ? (
|
|
384
|
+
class: D(["size-full rounded-lg border bg-surface-container-low/70 transition-colors", c.value ? "border-primary" : "border-outline-variant"])
|
|
385
|
+
}, [d.value.label ? (k(), b("div", je, [d.value.icon ? (k(), b("span", Me, le(d.value.icon), 1)) : y("", !0), S(" " + le(d.value.label), 1)])) : y("", !0)], 2)) : s.value.type === "circle" ? (k(), b("div", {
|
|
385
386
|
key: 2,
|
|
386
387
|
class: "relative",
|
|
387
|
-
style:
|
|
388
|
-
width: `${
|
|
389
|
-
height: `${
|
|
388
|
+
style: O({
|
|
389
|
+
width: `${h.value.size}px`,
|
|
390
|
+
height: `${h.value.size}px`
|
|
390
391
|
})
|
|
391
392
|
}, [
|
|
392
|
-
|
|
393
|
-
|
|
393
|
+
x("div", { class: D(["m3-flow-circle flex size-full items-center justify-center rounded-full border-2 text-title-small", [
|
|
394
|
+
g[h.value.color],
|
|
394
395
|
c.value ? "border-primary" : "border-transparent",
|
|
395
|
-
|
|
396
|
-
]]) }, [
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
h.value.ring && w[h.value.ring]
|
|
397
|
+
]]) }, [x("span", Ne, le(d.value.label), 1)], 2),
|
|
398
|
+
h.value.badge !== void 0 && h.value.badge !== null && h.value.badge !== "" ? (k(), b("span", R, le(h.value.badge), 1)) : y("", !0),
|
|
399
|
+
C(I, {
|
|
399
400
|
type: "source",
|
|
400
401
|
position: "right"
|
|
401
402
|
})
|
|
402
|
-
], 4)) : (
|
|
403
|
+
], 4)) : (k(), v(ke, {
|
|
403
404
|
key: 3,
|
|
404
|
-
label: d.value.label ??
|
|
405
|
+
label: d.value.label ?? j(o),
|
|
405
406
|
subtitle: d.value.subtitle,
|
|
406
407
|
icon: d.value.icon,
|
|
407
|
-
handles:
|
|
408
|
+
handles: m.value
|
|
408
409
|
}, null, 8, [
|
|
409
410
|
"label",
|
|
410
411
|
"subtitle",
|
|
@@ -416,92 +417,162 @@ var N = [
|
|
|
416
417
|
"data-flow-edge",
|
|
417
418
|
"tabindex",
|
|
418
419
|
"aria-label"
|
|
419
|
-
],
|
|
420
|
+
], z = ["d"], Ie = ["d"], Le = ["d", "stroke-width"], Re = ["d"], ze = [
|
|
421
|
+
"data-flow-segment",
|
|
422
|
+
"x",
|
|
423
|
+
"y",
|
|
424
|
+
"width",
|
|
425
|
+
"height"
|
|
426
|
+
], Be = [
|
|
420
427
|
"data-flow-reconnect",
|
|
421
428
|
"cx",
|
|
422
429
|
"cy"
|
|
423
|
-
],
|
|
430
|
+
], Ve = /* @__PURE__ */ w({
|
|
424
431
|
__name: "_MFlowEdge",
|
|
425
432
|
props: {
|
|
426
433
|
edge: {},
|
|
427
434
|
render: { type: Function }
|
|
428
435
|
},
|
|
429
436
|
setup(t) {
|
|
430
|
-
let n = t, r =
|
|
431
|
-
function u(
|
|
432
|
-
|
|
437
|
+
let n = t, r = T(ge), i = e(), a = _(() => r.edgeGeometry(n.edge)), o = _(() => r.selectedEdges.value.has(n.edge.id)), s = _(() => r.insertEdge.value === n.edge.id), c = _(() => n.edge.selectable !== !1 && !r.locked.value), l = _(() => o.value && r.isReconnectable(n.edge));
|
|
438
|
+
function u() {
|
|
439
|
+
let e = a.value;
|
|
440
|
+
if (!e) return null;
|
|
441
|
+
let t = n.edge.deletable !== !1 && !r.locked.value, i = n.edge.label ? n.edge.label.length * 7 + 16 : 0, o = i + (t ? 24 + (i ? 4 : 0) : 0);
|
|
442
|
+
return o ? {
|
|
443
|
+
x: e.labelX,
|
|
444
|
+
y: e.labelY,
|
|
445
|
+
hw: o / 2 + (t ? 8 : 2),
|
|
446
|
+
hh: t ? 20 : 12
|
|
447
|
+
} : null;
|
|
433
448
|
}
|
|
434
|
-
let
|
|
449
|
+
let d = _(() => {
|
|
450
|
+
if (!o.value || !r.isReroutable(n.edge)) return [];
|
|
451
|
+
a.value;
|
|
452
|
+
let e = r.edgeCorners(n.edge) ?? [], t = [], i = u();
|
|
453
|
+
for (let n = 0; n < e.length - 1; n++) {
|
|
454
|
+
let [r, a] = e[n], [o, s] = e[n + 1], c = Math.hypot(o - r, s - a);
|
|
455
|
+
if (c < 16) continue;
|
|
456
|
+
let l = Math.abs(a - s) < .01, u = (o - r) / c, d = (s - a) / c, f = (e) => ({
|
|
457
|
+
x: r + u * e,
|
|
458
|
+
y: a + d * e
|
|
459
|
+
}), p = (e) => {
|
|
460
|
+
if (!i) return Infinity;
|
|
461
|
+
let t = l ? 9 : 4, n = l ? 4 : 9;
|
|
462
|
+
return Math.max(Math.abs(e.x - i.x) - i.hw - t, Math.abs(e.y - i.y) - i.hh - n);
|
|
463
|
+
}, m = f(c / 2);
|
|
464
|
+
if (p(m) < 6) {
|
|
465
|
+
let e = p(m);
|
|
466
|
+
for (let t = 4; t <= c / 2 - 8; t += 4) {
|
|
467
|
+
let n = [f(c / 2 - t), f(c / 2 + t)].find((e) => p(e) >= 6);
|
|
468
|
+
if (n) {
|
|
469
|
+
m = n, e = Infinity;
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
for (let n of [f(c / 2 - t), f(c / 2 + t)]) {
|
|
473
|
+
let t = p(n);
|
|
474
|
+
t > e && (e = t, m = n);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
t.push({
|
|
479
|
+
i: n,
|
|
480
|
+
x: m.x,
|
|
481
|
+
y: m.y,
|
|
482
|
+
horizontal: l
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
return t;
|
|
486
|
+
});
|
|
487
|
+
function f(e, t, n, r, i) {
|
|
488
|
+
return !e || e === "none" ? "" : p(t - i * Math.cos(r), n - i * Math.sin(r), r, 9, e === "arrow-closed");
|
|
489
|
+
}
|
|
490
|
+
let m = _(() => {
|
|
435
491
|
let e = a.value;
|
|
436
|
-
return e ?
|
|
437
|
-
}),
|
|
492
|
+
return e ? f(n.edge.markerEnd ?? "arrow-closed", e.targetX, e.targetY, e.targetAngle, e.targetInset) : "";
|
|
493
|
+
}), g = _(() => {
|
|
438
494
|
let e = a.value;
|
|
439
|
-
return e ?
|
|
440
|
-
}),
|
|
495
|
+
return e ? f(n.edge.markerStart, e.sourceX, e.sourceY, e.sourceAngle + Math.PI, e.sourceInset) : "";
|
|
496
|
+
}), S = _(() => {
|
|
441
497
|
let e = (e) => String(r.getNode(e)?.data?.label ?? e);
|
|
442
498
|
return i.flowEdge.replace("{source}", e(n.edge.source)).replace("{target}", e(n.edge.target));
|
|
443
|
-
}),
|
|
499
|
+
}), C = /^(primary|secondary|tertiary|error|outline|outline-variant|on-surface|on-surface-variant|inverse-surface|inverse-primary)(-container)?$/, w = _(() => {
|
|
444
500
|
if (o.value || s.value) return "var(--color-primary)";
|
|
445
501
|
let e = n.edge.color;
|
|
446
|
-
return e ?
|
|
447
|
-
}), ee =
|
|
502
|
+
return e ? C.test(e) ? `var(--color-${e})` : e : "var(--color-outline)";
|
|
503
|
+
}), ee = _(() => (n.edge.width ?? 2) + (s.value ? 2 : 0)), E = _(() => ({
|
|
448
504
|
edge: n.edge,
|
|
449
505
|
selected: o.value,
|
|
450
506
|
highlighted: s.value,
|
|
451
507
|
...a.value
|
|
452
508
|
}));
|
|
453
|
-
return (e, n) => a.value ? (
|
|
509
|
+
return (e, n) => a.value ? (k(), b("g", {
|
|
454
510
|
key: 0,
|
|
455
|
-
class:
|
|
511
|
+
class: D(["m3-flow-edge outline-none", [t.edge.class, o.value && "m3-flow-edge-selected"]]),
|
|
456
512
|
"data-flow-edge": t.edge.id,
|
|
457
513
|
tabindex: c.value ? 0 : void 0,
|
|
458
|
-
"aria-label":
|
|
514
|
+
"aria-label": S.value,
|
|
459
515
|
role: "img",
|
|
460
|
-
onKeydown: n[0] ||= (e) =>
|
|
516
|
+
onKeydown: n[0] ||= (e) => j(r).onEdgeKey(e, t.edge.id)
|
|
461
517
|
}, [
|
|
462
|
-
|
|
518
|
+
x("path", {
|
|
463
519
|
d: a.value.path,
|
|
464
520
|
fill: "none",
|
|
465
521
|
stroke: "transparent",
|
|
466
522
|
"stroke-width": "16",
|
|
467
523
|
style: { pointerEvents: "stroke" },
|
|
468
|
-
class:
|
|
469
|
-
}, null, 10,
|
|
470
|
-
s.value ? (
|
|
524
|
+
class: D(j(r).branching.value ? "cursor-crosshair" : c.value && "cursor-pointer")
|
|
525
|
+
}, null, 10, z),
|
|
526
|
+
s.value ? (k(), b("path", {
|
|
471
527
|
key: 0,
|
|
472
528
|
d: a.value.path,
|
|
473
529
|
fill: "none",
|
|
474
530
|
"stroke-width": "14",
|
|
475
531
|
"stroke-linecap": "round",
|
|
476
532
|
class: "m3-flow-edge-halo stroke-primary/25"
|
|
477
|
-
}, null, 8,
|
|
478
|
-
t.render ? (
|
|
533
|
+
}, null, 8, Ie)) : y("", !0),
|
|
534
|
+
t.render ? (k(), v(j(F), {
|
|
479
535
|
key: 1,
|
|
480
536
|
fn: t.render,
|
|
481
|
-
scope:
|
|
482
|
-
}, null, 8, ["fn", "scope"])) : (
|
|
537
|
+
scope: E.value
|
|
538
|
+
}, null, 8, ["fn", "scope"])) : (k(), b(h, { key: 2 }, [x("path", {
|
|
483
539
|
d: a.value.path,
|
|
484
540
|
fill: "none",
|
|
485
541
|
"stroke-width": ee.value,
|
|
486
542
|
"stroke-linecap": "round",
|
|
487
|
-
class:
|
|
488
|
-
style:
|
|
489
|
-
stroke:
|
|
543
|
+
class: D(["m3-flow-edge-line", [t.edge.animated === "reverse" ? "m3-flow-edge-animated m3-flow-edge-reverse" : t.edge.animated && "m3-flow-edge-animated", t.edge.dashed && !t.edge.animated && "m3-flow-edge-dashed"]]),
|
|
544
|
+
style: O({
|
|
545
|
+
stroke: w.value,
|
|
490
546
|
strokeWidth: `${ee.value}px`
|
|
491
547
|
})
|
|
492
|
-
}, null, 14,
|
|
548
|
+
}, null, 14, Le), (k(!0), b(h, null, ae([m.value, g.value], (e, n) => M((k(), b("path", {
|
|
493
549
|
key: n,
|
|
494
550
|
d: e,
|
|
495
551
|
"stroke-width": "2",
|
|
496
552
|
"stroke-linejoin": "round",
|
|
497
553
|
"stroke-linecap": "round",
|
|
498
554
|
class: "m3-flow-edge-line",
|
|
499
|
-
style:
|
|
500
|
-
stroke:
|
|
501
|
-
fill: (n === 0 ? t.edge.markerEnd ?? "arrow-closed" : t.edge.markerStart) === "arrow-closed" ?
|
|
555
|
+
style: O({
|
|
556
|
+
stroke: w.value,
|
|
557
|
+
fill: (n === 0 ? t.edge.markerEnd ?? "arrow-closed" : t.edge.markerStart) === "arrow-closed" ? w.value : "none"
|
|
502
558
|
})
|
|
503
|
-
}, null, 12,
|
|
504
|
-
|
|
559
|
+
}, null, 12, Re)), [[fe, e]])), 128))], 64)),
|
|
560
|
+
(k(!0), b(h, null, ae(d.value, (e) => (k(), b("rect", {
|
|
561
|
+
key: `s${e.i}`,
|
|
562
|
+
"data-flow-segment": e.i,
|
|
563
|
+
x: e.x - (e.horizontal ? 9 : 4),
|
|
564
|
+
y: e.y - (e.horizontal ? 4 : 9),
|
|
565
|
+
width: e.horizontal ? 18 : 8,
|
|
566
|
+
height: e.horizontal ? 8 : 18,
|
|
567
|
+
rx: "4",
|
|
568
|
+
"stroke-width": "2",
|
|
569
|
+
class: D(["fill-surface stroke-primary", e.horizontal ? "cursor-row-resize" : "cursor-col-resize"]),
|
|
570
|
+
style: {
|
|
571
|
+
pointerEvents: "all",
|
|
572
|
+
touchAction: "none"
|
|
573
|
+
}
|
|
574
|
+
}, null, 10, ze))), 128)),
|
|
575
|
+
l.value ? (k(), b(h, { key: 3 }, ae(["source", "target"], (e) => x("circle", {
|
|
505
576
|
key: e,
|
|
506
577
|
"data-flow-reconnect": e,
|
|
507
578
|
cx: e === "source" ? a.value.sourceX : a.value.targetX,
|
|
@@ -510,17 +581,17 @@ var N = [
|
|
|
510
581
|
"stroke-width": "2",
|
|
511
582
|
class: "cursor-move fill-surface stroke-primary",
|
|
512
583
|
style: { pointerEvents: "all" }
|
|
513
|
-
}, null, 8,
|
|
514
|
-
], 42, Fe)) :
|
|
584
|
+
}, null, 8, Be)), 64)) : y("", !0)
|
|
585
|
+
], 42, Fe)) : y("", !0);
|
|
515
586
|
}
|
|
516
|
-
}),
|
|
587
|
+
}), He = ["data-flow-edge"], Ue = { class: "flex items-center gap-1" }, We = ["data-flow-edge-delete", "aria-label"], Ge = /* @__PURE__ */ w({
|
|
517
588
|
__name: "_MFlowEdgeLabel",
|
|
518
589
|
props: {
|
|
519
590
|
edge: {},
|
|
520
591
|
render: { type: Function }
|
|
521
592
|
},
|
|
522
593
|
setup(t) {
|
|
523
|
-
let n = t, r =
|
|
594
|
+
let n = t, r = T(ge), i = _(() => r.edgeGeometry(n.edge)), a = _(() => r.selectedEdges.value.has(n.edge.id)), o = _(() => a.value && n.edge.deletable !== !1 && !r.locked.value), s = e();
|
|
524
595
|
function c(e) {
|
|
525
596
|
e.detail === 0 && r.remove({ edges: [n.edge.id] });
|
|
526
597
|
}
|
|
@@ -531,68 +602,68 @@ var N = [
|
|
|
531
602
|
error: "bg-error-container text-on-error-container",
|
|
532
603
|
neutral: "bg-surface-container-high text-on-surface-variant"
|
|
533
604
|
};
|
|
534
|
-
return (e, n) => i.value ? (
|
|
605
|
+
return (e, n) => i.value ? (k(), b("div", {
|
|
535
606
|
key: 0,
|
|
536
607
|
class: "m3-flow-edge-label absolute top-0 left-0 cursor-pointer",
|
|
537
|
-
style:
|
|
608
|
+
style: O({ transform: `translate(${i.value.labelX}px, ${i.value.labelY}px) translate(-50%, -50%)` }),
|
|
538
609
|
"data-flow-edge": t.edge.id
|
|
539
|
-
}, [
|
|
610
|
+
}, [x("div", Ue, [t.render ? (k(), v(j(F), {
|
|
540
611
|
key: 0,
|
|
541
612
|
fn: t.render,
|
|
542
613
|
scope: {
|
|
543
614
|
edge: t.edge,
|
|
544
615
|
selected: a.value
|
|
545
616
|
}
|
|
546
|
-
}, null, 8, ["fn", "scope"])) : t.edge.label ? (
|
|
617
|
+
}, null, 8, ["fn", "scope"])) : t.edge.label ? (k(), b("span", {
|
|
547
618
|
key: 1,
|
|
548
|
-
class:
|
|
549
|
-
}, le(t.edge.label), 3)) :
|
|
619
|
+
class: D(["block rounded-sm px-2 py-0.5 text-label-medium whitespace-nowrap transition-colors", a.value ? "bg-secondary-container text-on-secondary-container" : l[t.edge.labelTone ?? "neutral"]])
|
|
620
|
+
}, le(t.edge.label), 3)) : y("", !0), o.value ? (k(), b("button", {
|
|
550
621
|
key: 2,
|
|
551
622
|
type: "button",
|
|
552
623
|
class: "m3-flow-edge-delete relative flex size-6 cursor-pointer items-center justify-center rounded-full bg-surface-container-highest text-on-surface-variant shadow-elevation-1 transition-colors outline-none before:absolute before:-inset-2 hover:bg-error-container hover:text-on-error-container focus-visible:ring-2 focus-visible:ring-secondary",
|
|
553
624
|
"data-flow-edge-delete": t.edge.id,
|
|
554
|
-
"aria-label":
|
|
625
|
+
"aria-label": j(s).flowDeleteEdge,
|
|
555
626
|
onClick: c
|
|
556
|
-
}, [...n[0] ||= [
|
|
627
|
+
}, [...n[0] ||= [x("span", {
|
|
557
628
|
class: "material-symbols-outlined text-[16px]",
|
|
558
629
|
"aria-hidden": "true"
|
|
559
|
-
}, "close", -1)]], 8,
|
|
630
|
+
}, "close", -1)]], 8, We)) : y("", !0)])], 12, He)) : y("", !0);
|
|
560
631
|
}
|
|
561
|
-
}),
|
|
632
|
+
}), Ke = ["aria-label"], qe = {
|
|
562
633
|
key: 0,
|
|
563
634
|
class: "pointer-events-none absolute inset-0 size-full",
|
|
564
635
|
"aria-hidden": "true"
|
|
565
|
-
},
|
|
636
|
+
}, Je = [
|
|
566
637
|
"x",
|
|
567
638
|
"y",
|
|
568
639
|
"width",
|
|
569
640
|
"height"
|
|
570
|
-
],
|
|
641
|
+
], Ye = [
|
|
571
642
|
"cx",
|
|
572
643
|
"cy",
|
|
573
644
|
"r"
|
|
574
|
-
],
|
|
645
|
+
], Xe = ["d"], Ze = ["fill"], Qe = {
|
|
575
646
|
class: "m3-flow-edges pointer-events-none absolute top-0 left-0 size-px overflow-visible",
|
|
576
647
|
"aria-hidden": "false"
|
|
577
|
-
},
|
|
648
|
+
}, $e = ["d", "stroke-dasharray"], et = { class: "m3-flow-edge-labels absolute top-0 left-0" }, tt = {
|
|
578
649
|
key: 0,
|
|
579
650
|
class: "pointer-events-none absolute top-0 left-0 size-px overflow-visible",
|
|
580
651
|
"aria-hidden": "true"
|
|
581
|
-
},
|
|
652
|
+
}, nt = [
|
|
582
653
|
"x1",
|
|
583
654
|
"x2",
|
|
584
655
|
"y1",
|
|
585
656
|
"y2"
|
|
586
|
-
],
|
|
657
|
+
], rt = {
|
|
587
658
|
key: 2,
|
|
588
659
|
class: "pointer-events-none absolute inset-0 flex items-center justify-center"
|
|
589
|
-
},
|
|
660
|
+
}, it = { class: "pointer-events-auto" }, at = {
|
|
590
661
|
class: "sr-only",
|
|
591
662
|
"aria-live": "polite"
|
|
592
|
-
},
|
|
663
|
+
}, ot = null, st = 0, ct = (e) => `${e}-${Math.random().toString(36).slice(2, 9)}`, lt = () => ({
|
|
593
664
|
nodes: [],
|
|
594
665
|
edges: []
|
|
595
|
-
}),
|
|
666
|
+
}), ut = /* @__PURE__ */ w({
|
|
596
667
|
inheritAttrs: !1,
|
|
597
668
|
__name: "MFlow",
|
|
598
669
|
props: {
|
|
@@ -646,6 +717,10 @@ var N = [
|
|
|
646
717
|
type: Boolean,
|
|
647
718
|
default: !0
|
|
648
719
|
},
|
|
720
|
+
edgesReroutable: {
|
|
721
|
+
type: Boolean,
|
|
722
|
+
default: !1
|
|
723
|
+
},
|
|
649
724
|
defaultEdgeOptions: {},
|
|
650
725
|
autoConnect: {
|
|
651
726
|
type: Boolean,
|
|
@@ -687,7 +762,7 @@ var N = [
|
|
|
687
762
|
},
|
|
688
763
|
getId: {},
|
|
689
764
|
edgeBranching: {
|
|
690
|
-
type: Boolean,
|
|
765
|
+
type: [Boolean, String],
|
|
691
766
|
default: !1
|
|
692
767
|
},
|
|
693
768
|
nativeContextMenu: {
|
|
@@ -696,140 +771,115 @@ var N = [
|
|
|
696
771
|
},
|
|
697
772
|
label: {}
|
|
698
773
|
},
|
|
699
|
-
emits:
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
"update:viewport",
|
|
703
|
-
"update:selection",
|
|
704
|
-
"update:locked",
|
|
705
|
-
"connect",
|
|
706
|
-
"connect-start",
|
|
707
|
-
"connect-end",
|
|
708
|
-
"reconnect",
|
|
709
|
-
"insert",
|
|
710
|
-
"node-click",
|
|
711
|
-
"node-dblclick",
|
|
712
|
-
"node-contextmenu",
|
|
713
|
-
"node-drag-start",
|
|
714
|
-
"node-drag",
|
|
715
|
-
"node-drag-stop",
|
|
716
|
-
"edge-click",
|
|
717
|
-
"edge-dblclick",
|
|
718
|
-
"edge-contextmenu",
|
|
719
|
-
"pane-click",
|
|
720
|
-
"pane-contextmenu",
|
|
721
|
-
"pane-dblclick",
|
|
722
|
-
"delete",
|
|
723
|
-
"init"
|
|
724
|
-
],
|
|
725
|
-
setup(n, { expose: a, emit: d }) {
|
|
726
|
-
let p = n, y = d, b = de(), x = e(), S = D(), w = D(), fe = (e) => !!e && e !== S.value && !w.value?.contains(e), k = D({
|
|
774
|
+
emits: /* @__PURE__ */ "update:nodes.update:edges.update:viewport.update:selection.update:locked.connect.connect-start.branch.connect-end.reconnect.reroute.insert.node-click.node-dblclick.node-contextmenu.node-drag-start.node-drag.node-drag-stop.edge-click.edge-dblclick.edge-contextmenu.pane-click.pane-contextmenu.pane-dblclick.delete.init".split("."),
|
|
775
|
+
setup(n, { expose: p, emit: g }) {
|
|
776
|
+
let S = n, C = g, w = de(), T = e(), D = A(), fe = A(), me = (e) => !!e && e !== D.value && !fe.value?.contains(e), M = A({
|
|
727
777
|
width: 0,
|
|
728
778
|
height: 0
|
|
729
|
-
}),
|
|
730
|
-
|
|
731
|
-
},
|
|
732
|
-
pe(() =>
|
|
733
|
-
e && !
|
|
734
|
-
}), pe(() =>
|
|
735
|
-
|
|
779
|
+
}), he = A(!1), _e = A(""), ve = (e) => {
|
|
780
|
+
_e.value = "", E(() => _e.value = e);
|
|
781
|
+
}, ye = (e) => S.getId?.(e) ?? ct(e === "node" ? "n" : "e"), N = ce(S.nodes), P = ce(S.edges), F = ce(S.selection ?? lt()), Se = A(S.locked);
|
|
782
|
+
pe(() => S.selection, (e) => {
|
|
783
|
+
e && !ft(e, F.value) && (F.value = e);
|
|
784
|
+
}), pe(() => S.locked, (e) => {
|
|
785
|
+
Se.value = e;
|
|
736
786
|
});
|
|
737
|
-
let
|
|
738
|
-
get: () =>
|
|
787
|
+
let I = _({
|
|
788
|
+
get: () => Se.value,
|
|
739
789
|
set: (e) => {
|
|
740
|
-
|
|
790
|
+
Se.value = e, C("update:locked", e);
|
|
741
791
|
}
|
|
742
|
-
}),
|
|
743
|
-
let t =
|
|
744
|
-
return t &&
|
|
792
|
+
}), L = _(() => new Map(N.value.map((e) => [e.id, e]))), Ce = _(() => new Map(P.value.map((e) => [e.id, e]))), we = (e) => L.value.get(e), Te = (e) => {
|
|
793
|
+
let t = L.value.get(e)?.parentId;
|
|
794
|
+
return t && L.value.has(t) ? t : void 0;
|
|
745
795
|
};
|
|
746
|
-
function
|
|
796
|
+
function Ee(e) {
|
|
747
797
|
let t = [];
|
|
748
|
-
for (let n =
|
|
798
|
+
for (let n = Te(e); n && t.length < 50; n = Te(n)) t.push(n);
|
|
749
799
|
return t;
|
|
750
800
|
}
|
|
751
|
-
let
|
|
752
|
-
function
|
|
753
|
-
let t =
|
|
754
|
-
return !t || !!t.hidden ||
|
|
801
|
+
let De = (e) => Ee(e).length;
|
|
802
|
+
function Oe(e) {
|
|
803
|
+
let t = L.value.get(e);
|
|
804
|
+
return !t || !!t.hidden || Ee(e).some((e) => L.value.get(e)?.hidden);
|
|
755
805
|
}
|
|
756
|
-
let
|
|
806
|
+
let ke = _(() => {
|
|
757
807
|
let e = /* @__PURE__ */ new Map();
|
|
758
|
-
for (let t of
|
|
808
|
+
for (let t of N.value) t.parentId && L.value.has(t.parentId) && (e.get(t.parentId) ?? e.set(t.parentId, []).get(t.parentId)).push(t.id);
|
|
759
809
|
return e;
|
|
760
810
|
});
|
|
761
|
-
function
|
|
762
|
-
let t = [], n = (e) => (
|
|
811
|
+
function Ae(e) {
|
|
812
|
+
let t = [], n = (e) => (ke.value.get(e) ?? []).forEach((e) => {
|
|
763
813
|
t.push(e), n(e);
|
|
764
814
|
});
|
|
765
815
|
return n(e), t;
|
|
766
816
|
}
|
|
767
|
-
let
|
|
768
|
-
function
|
|
817
|
+
let je = _(() => new Set(F.value.nodes)), Me = _(() => new Set(F.value.edges)), Ne = _(() => !!S.edgeBranching && Le.value && !I.value);
|
|
818
|
+
function R(e) {
|
|
769
819
|
let t = {
|
|
770
|
-
nodes: e.nodes ??
|
|
771
|
-
edges: e.edges ??
|
|
820
|
+
nodes: e.nodes ?? F.value.nodes,
|
|
821
|
+
edges: e.edges ?? F.value.edges
|
|
772
822
|
};
|
|
773
|
-
|
|
823
|
+
Fe(t.nodes, F.value.nodes) && Fe(t.edges, F.value.edges) || (F.value = t, C("update:selection", t));
|
|
774
824
|
}
|
|
775
|
-
let
|
|
776
|
-
nodes:
|
|
777
|
-
edges:
|
|
825
|
+
let Fe = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), z = _(() => S.elementsSelectable && !I.value), Ie = _(() => S.nodesDraggable && !I.value), Le = _(() => S.nodesConnectable && !I.value), Re = ce([]), ze = ce([]), Be = null, He = () => ({
|
|
826
|
+
nodes: N.value,
|
|
827
|
+
edges: P.value
|
|
778
828
|
});
|
|
779
|
-
function
|
|
780
|
-
if (!
|
|
829
|
+
function Ue(e, t) {
|
|
830
|
+
if (!S.history) return;
|
|
781
831
|
let n = performance.now();
|
|
782
|
-
if (t &&
|
|
783
|
-
|
|
832
|
+
if (t && Be?.key === t && n - Be.at < 800) {
|
|
833
|
+
Be.at = n, ze.value = [];
|
|
784
834
|
return;
|
|
785
835
|
}
|
|
786
|
-
|
|
836
|
+
Be = t ? {
|
|
787
837
|
key: t,
|
|
788
838
|
at: n
|
|
789
|
-
} : null,
|
|
839
|
+
} : null, Re.value = [...Re.value, e].slice(-S.historySize), ze.value = [];
|
|
790
840
|
}
|
|
791
|
-
let
|
|
792
|
-
function
|
|
793
|
-
|
|
794
|
-
|
|
841
|
+
let We = null, ut = !1;
|
|
842
|
+
function dt() {
|
|
843
|
+
ut || We || (We = He(), queueMicrotask(() => {
|
|
844
|
+
We && Ue(We), We = null;
|
|
795
845
|
}));
|
|
796
846
|
}
|
|
797
|
-
let
|
|
798
|
-
pe(() =>
|
|
799
|
-
|
|
800
|
-
}), pe(() =>
|
|
801
|
-
|
|
847
|
+
let ft = (e, t) => ue(e) === ue(t);
|
|
848
|
+
pe(() => S.nodes, (e) => {
|
|
849
|
+
ft(e, N.value) || (dt(), N.value = e);
|
|
850
|
+
}), pe(() => S.edges, (e) => {
|
|
851
|
+
ft(e, P.value) || (dt(), P.value = e);
|
|
802
852
|
});
|
|
803
|
-
function
|
|
804
|
-
t.history !== !1 &&
|
|
853
|
+
function B(e, t = {}) {
|
|
854
|
+
t.history !== !1 && Ue(He(), t.coalesce), ut || (ut = !0, E(() => ut = !1)), e.nodes && !ft(e.nodes, N.value) && (N.value = e.nodes, C("update:nodes", e.nodes)), e.edges && !ft(e.edges, P.value) && (P.value = e.edges, C("update:edges", e.edges));
|
|
805
855
|
}
|
|
806
|
-
function
|
|
807
|
-
|
|
856
|
+
function pt(e) {
|
|
857
|
+
B(e, { history: !1 });
|
|
808
858
|
let t = new Set(e.nodes.map((e) => e.id)), n = new Set(e.edges.map((e) => e.id));
|
|
809
|
-
|
|
810
|
-
nodes:
|
|
811
|
-
edges:
|
|
859
|
+
R({
|
|
860
|
+
nodes: F.value.nodes.filter((e) => t.has(e)),
|
|
861
|
+
edges: F.value.edges.filter((e) => n.has(e))
|
|
812
862
|
});
|
|
813
863
|
}
|
|
814
|
-
function
|
|
815
|
-
let e =
|
|
816
|
-
e && (
|
|
864
|
+
function mt() {
|
|
865
|
+
let e = Re.value[Re.value.length - 1];
|
|
866
|
+
e && (ze.value = [...ze.value, He()], Re.value = Re.value.slice(0, -1), Be = null, pt(e));
|
|
817
867
|
}
|
|
818
|
-
function
|
|
819
|
-
let e =
|
|
820
|
-
e && (
|
|
868
|
+
function ht() {
|
|
869
|
+
let e = ze.value[ze.value.length - 1];
|
|
870
|
+
e && (Re.value = [...Re.value, He()], ze.value = ze.value.slice(0, -1), Be = null, pt(e));
|
|
821
871
|
}
|
|
822
|
-
let
|
|
823
|
-
function
|
|
824
|
-
let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), n =
|
|
825
|
-
for (let r of
|
|
826
|
-
e.add(r.id),
|
|
827
|
-
let i =
|
|
872
|
+
let gt = _(() => Re.value.length > 0), _t = _(() => ze.value.length > 0), V = se(/* @__PURE__ */ new Map()), H = /* @__PURE__ */ new Map(), vt = ce(/* @__PURE__ */ new Set()), yt = !1, bt = /* @__PURE__ */ new Set();
|
|
873
|
+
function xt() {
|
|
874
|
+
let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), n = S.animate && he.value && !yt && !r();
|
|
875
|
+
for (let r of N.value) {
|
|
876
|
+
e.add(r.id), Oe(r.id) && t.add(r.id);
|
|
877
|
+
let i = bt.has(r.id) && !t.has(r.id), a = V.get(r.id), { x: o, y: s } = r.position;
|
|
828
878
|
if (!a) {
|
|
829
|
-
|
|
879
|
+
V.set(r.id, ie({
|
|
830
880
|
x: o,
|
|
831
881
|
y: s
|
|
832
|
-
})),
|
|
882
|
+
})), H.set(r.id, {
|
|
833
883
|
x: o,
|
|
834
884
|
y: s,
|
|
835
885
|
vx: 0,
|
|
@@ -839,48 +889,48 @@ var N = [
|
|
|
839
889
|
});
|
|
840
890
|
continue;
|
|
841
891
|
}
|
|
842
|
-
let c =
|
|
843
|
-
(c.tx !== o || c.ty !== s || i) && (c.tx = o, c.ty = s, !n || i ||
|
|
892
|
+
let c = H.get(r.id);
|
|
893
|
+
(c.tx !== o || c.ty !== s || i) && (c.tx = o, c.ty = s, !n || i || vt.value.has(r.id) ? (c.x = o, c.y = s, c.vx = c.vy = 0, a.x = o, a.y = s) : Et());
|
|
844
894
|
}
|
|
845
|
-
for (let t of [...
|
|
846
|
-
|
|
895
|
+
for (let t of [...V.keys()]) e.has(t) || (V.delete(t), H.delete(t));
|
|
896
|
+
bt = t, yt = !1;
|
|
847
897
|
}
|
|
848
|
-
pe(
|
|
849
|
-
let
|
|
850
|
-
function
|
|
851
|
-
|
|
898
|
+
pe(N, xt, { immediate: !0 });
|
|
899
|
+
let St = t.stiffness, Ct = 2 * t.dampingRatio * Math.sqrt(St), wt = .004, U = 0, Tt = 0;
|
|
900
|
+
function Et() {
|
|
901
|
+
U || typeof requestAnimationFrame > "u" || (Tt = performance.now(), U = requestAnimationFrame(Dt));
|
|
852
902
|
}
|
|
853
|
-
function
|
|
854
|
-
|
|
855
|
-
let t = Math.min((e -
|
|
856
|
-
|
|
903
|
+
function Dt(e) {
|
|
904
|
+
U = 0;
|
|
905
|
+
let t = Math.min((e - Tt) / 1e3, 1 / 20);
|
|
906
|
+
Tt = e;
|
|
857
907
|
let n = !1;
|
|
858
|
-
for (let [e, r] of
|
|
908
|
+
for (let [e, r] of H) {
|
|
859
909
|
if (r.x === r.tx && r.y === r.ty && !r.vx && !r.vy) continue;
|
|
860
|
-
for (let e = 0; e < t; e +=
|
|
861
|
-
let n = Math.min(
|
|
862
|
-
r.vx += (-
|
|
910
|
+
for (let e = 0; e < t; e += wt) {
|
|
911
|
+
let n = Math.min(wt, t - e);
|
|
912
|
+
r.vx += (-St * (r.x - r.tx) - Ct * r.vx) * n, r.vy += (-St * (r.y - r.ty) - Ct * r.vy) * n, r.x += r.vx * n, r.y += r.vy * n;
|
|
863
913
|
}
|
|
864
914
|
Math.abs(r.x - r.tx) < .1 && Math.abs(r.y - r.ty) < .1 && Math.abs(r.vx) < 2 && Math.abs(r.vy) < 2 ? (r.x = r.tx, r.y = r.ty, r.vx = r.vy = 0) : n = !0;
|
|
865
|
-
let i =
|
|
915
|
+
let i = V.get(e);
|
|
866
916
|
i && (i.x = r.x, i.y = r.y);
|
|
867
917
|
}
|
|
868
|
-
|
|
918
|
+
gn(t) && (n = !0), Fr(t) && (n = !0), n && (U = requestAnimationFrame(Dt));
|
|
869
919
|
}
|
|
870
|
-
function
|
|
920
|
+
function W(e) {
|
|
871
921
|
let t = 0, n = 0, r = e;
|
|
872
922
|
for (let e = 0; r && e < 50; e++) {
|
|
873
|
-
let e =
|
|
874
|
-
t += e?.x ?? i?.position.x ?? 0, n += e?.y ?? i?.position.y ?? 0, r =
|
|
923
|
+
let e = V.get(r), i = L.value.get(r);
|
|
924
|
+
t += e?.x ?? i?.position.x ?? 0, n += e?.y ?? i?.position.y ?? 0, r = Te(r);
|
|
875
925
|
}
|
|
876
926
|
return {
|
|
877
927
|
x: t,
|
|
878
928
|
y: n
|
|
879
929
|
};
|
|
880
930
|
}
|
|
881
|
-
let
|
|
882
|
-
function
|
|
883
|
-
let t =
|
|
931
|
+
let Ot = se(/* @__PURE__ */ new Map()), kt = se(/* @__PURE__ */ new Map()), At = /* @__PURE__ */ new Map(), jt = /* @__PURE__ */ new Map(), G = se(/* @__PURE__ */ new Map());
|
|
932
|
+
function K(e) {
|
|
933
|
+
let t = L.value.get(e);
|
|
884
934
|
if (!t) return {
|
|
885
935
|
width: 0,
|
|
886
936
|
height: 0
|
|
@@ -890,12 +940,12 @@ var N = [
|
|
|
890
940
|
height: t.height
|
|
891
941
|
};
|
|
892
942
|
if (t.type === "group" && !t.width) {
|
|
893
|
-
let n =
|
|
943
|
+
let n = G.get(e);
|
|
894
944
|
if (n) return n;
|
|
895
945
|
let r = 200, i = 120;
|
|
896
|
-
for (let t of
|
|
897
|
-
if (
|
|
898
|
-
let e =
|
|
946
|
+
for (let t of ke.value.get(e) ?? []) {
|
|
947
|
+
if (Oe(t)) continue;
|
|
948
|
+
let e = V.get(t), n = K(t);
|
|
899
949
|
r = Math.max(r, (e?.x ?? 0) + n.width + 24), i = Math.max(i, (e?.y ?? 0) + n.height + 24);
|
|
900
950
|
}
|
|
901
951
|
return {
|
|
@@ -903,23 +953,23 @@ var N = [
|
|
|
903
953
|
height: t.height ?? Math.max(i, 60)
|
|
904
954
|
};
|
|
905
955
|
}
|
|
906
|
-
let n =
|
|
956
|
+
let n = Ot.get(e);
|
|
907
957
|
return {
|
|
908
958
|
width: t.width ?? n?.width ?? 0,
|
|
909
959
|
height: t.height ?? n?.height ?? 0
|
|
910
960
|
};
|
|
911
961
|
}
|
|
912
|
-
function
|
|
913
|
-
let t =
|
|
962
|
+
function Mt(e) {
|
|
963
|
+
let t = At.get(e);
|
|
914
964
|
if (!t) return;
|
|
915
|
-
let n = t.offsetWidth, r = t.offsetHeight, i =
|
|
916
|
-
(!i || i.width !== n || i.height !== r) &&
|
|
965
|
+
let n = t.offsetWidth, r = t.offsetHeight, i = Ot.get(e);
|
|
966
|
+
(!i || i.width !== n || i.height !== r) && Ot.set(e, {
|
|
917
967
|
width: n,
|
|
918
968
|
height: r
|
|
919
969
|
});
|
|
920
|
-
let a =
|
|
970
|
+
let a = jt.get(e);
|
|
921
971
|
if (!a?.size) {
|
|
922
|
-
|
|
972
|
+
kt.has(e) && kt.delete(e);
|
|
923
973
|
return;
|
|
924
974
|
}
|
|
925
975
|
let o = t.getBoundingClientRect(), s = J.value.zoom || 1, c = [];
|
|
@@ -931,40 +981,40 @@ var N = [
|
|
|
931
981
|
y: (t.top + t.height / 2 - o.top) / s
|
|
932
982
|
});
|
|
933
983
|
}
|
|
934
|
-
|
|
984
|
+
kt.set(e, c);
|
|
935
985
|
}
|
|
936
|
-
let
|
|
937
|
-
function
|
|
938
|
-
|
|
939
|
-
let e =
|
|
940
|
-
|
|
986
|
+
let Nt = /* @__PURE__ */ new Set();
|
|
987
|
+
function Pt(e) {
|
|
988
|
+
Nt.add(e), !(Nt.size > 1) && E(() => {
|
|
989
|
+
let e = Nt;
|
|
990
|
+
Nt = /* @__PURE__ */ new Set(), e.forEach(Mt);
|
|
941
991
|
});
|
|
942
992
|
}
|
|
943
|
-
function
|
|
993
|
+
function Ft(e, t, n) {
|
|
944
994
|
let r = {
|
|
945
995
|
el: t,
|
|
946
996
|
info: n
|
|
947
997
|
};
|
|
948
|
-
return (
|
|
949
|
-
|
|
998
|
+
return (jt.get(e) ?? jt.set(e, /* @__PURE__ */ new Set()).get(e)).add(r), Pt(e), () => {
|
|
999
|
+
jt.get(e)?.delete(r), Pt(e);
|
|
950
1000
|
};
|
|
951
1001
|
}
|
|
952
|
-
function
|
|
953
|
-
if (t)
|
|
1002
|
+
function It(e, t) {
|
|
1003
|
+
if (t) At.set(e, t), Mt(e), ii?.observe(t);
|
|
954
1004
|
else {
|
|
955
|
-
let t =
|
|
956
|
-
t &&
|
|
1005
|
+
let t = At.get(e);
|
|
1006
|
+
t && ii?.unobserve(t), At.delete(e), Ot.delete(e), kt.delete(e);
|
|
957
1007
|
}
|
|
958
1008
|
}
|
|
959
|
-
let
|
|
960
|
-
let t =
|
|
1009
|
+
let Lt = (e) => {
|
|
1010
|
+
let t = S.direction === "vertical";
|
|
961
1011
|
return {
|
|
962
1012
|
source: e.sourcePosition ?? (t ? "bottom" : "right"),
|
|
963
1013
|
target: e.targetPosition ?? (t ? "top" : "left")
|
|
964
1014
|
};
|
|
965
1015
|
};
|
|
966
|
-
function
|
|
967
|
-
let n =
|
|
1016
|
+
function Rt(e, t) {
|
|
1017
|
+
let n = W(e), r = K(e);
|
|
968
1018
|
switch (t) {
|
|
969
1019
|
case "top": return {
|
|
970
1020
|
x: n.x + r.width / 2,
|
|
@@ -984,103 +1034,160 @@ var N = [
|
|
|
984
1034
|
};
|
|
985
1035
|
}
|
|
986
1036
|
}
|
|
987
|
-
function
|
|
988
|
-
let r =
|
|
1037
|
+
function zt(e, t) {
|
|
1038
|
+
let n = t.x - e.x, r = t.y - e.y;
|
|
1039
|
+
return Math.abs(n) >= Math.abs(r) ? n >= 0 ? "right" : "left" : r >= 0 ? "bottom" : "top";
|
|
1040
|
+
}
|
|
1041
|
+
let Bt = (e, t, n, r) => e === "auto" ? n ? zt(t, n) : r === "source" ? "right" : "left" : e;
|
|
1042
|
+
function Vt(e, t, n, r = null) {
|
|
1043
|
+
let i = Ht(e, t, n);
|
|
1044
|
+
return i && {
|
|
1045
|
+
...i,
|
|
1046
|
+
position: Bt(i.position, i, r, t)
|
|
1047
|
+
};
|
|
1048
|
+
}
|
|
1049
|
+
function Ht(e, t, n) {
|
|
1050
|
+
let r = L.value.get(e);
|
|
989
1051
|
if (!r) return null;
|
|
990
|
-
let i =
|
|
1052
|
+
let i = kt.get(e)?.filter((e) => e.type === t), a = i?.length ? (n == null ? i[0] : i.find((e) => e.id === n)) ?? i[0] : void 0;
|
|
991
1053
|
if (a) {
|
|
992
|
-
let t =
|
|
1054
|
+
let t = W(e);
|
|
993
1055
|
return {
|
|
994
1056
|
x: t.x + a.x,
|
|
995
1057
|
y: t.y + a.y,
|
|
996
1058
|
position: a.position,
|
|
997
|
-
inset:
|
|
1059
|
+
inset: Ut
|
|
998
1060
|
};
|
|
999
1061
|
}
|
|
1000
|
-
let o =
|
|
1062
|
+
let o = Lt(r)[t];
|
|
1001
1063
|
return {
|
|
1002
|
-
...
|
|
1064
|
+
...Rt(e, o),
|
|
1003
1065
|
position: o,
|
|
1004
1066
|
inset: 0
|
|
1005
1067
|
};
|
|
1006
1068
|
}
|
|
1007
|
-
let
|
|
1008
|
-
function
|
|
1069
|
+
let Ut = 5;
|
|
1070
|
+
function Wt(e, t) {
|
|
1009
1071
|
switch (e) {
|
|
1010
|
-
case "smoothstep": return
|
|
1011
|
-
case "step": return
|
|
1012
|
-
case "straight": return
|
|
1013
|
-
default: return
|
|
1072
|
+
case "smoothstep": return u(t);
|
|
1073
|
+
case "step": return f(t);
|
|
1074
|
+
case "straight": return a(t);
|
|
1075
|
+
default: return s(t);
|
|
1014
1076
|
}
|
|
1015
1077
|
}
|
|
1016
|
-
let
|
|
1017
|
-
function
|
|
1018
|
-
let t =
|
|
1078
|
+
let Gt = (e) => e.type ?? S.defaultEdgeOptions?.type ?? "bezier", q = (e) => e.pathType ?? S.defaultEdgeOptions?.pathType ?? Gt(e), Kt = _(() => new Set(P.value.map((e) => `${e.source}>${e.target}`)));
|
|
1079
|
+
function qt(e) {
|
|
1080
|
+
let t = W(e), n = K(e);
|
|
1019
1081
|
return {
|
|
1020
1082
|
x: t.x + n.width / 2,
|
|
1021
1083
|
y: t.y + n.height / 2,
|
|
1022
1084
|
r: Math.min(n.width, n.height) / 2
|
|
1023
1085
|
};
|
|
1024
1086
|
}
|
|
1025
|
-
function
|
|
1026
|
-
let t =
|
|
1087
|
+
function Jt(e) {
|
|
1088
|
+
let t = L.value.get(e.source)?.type === "circle", n = L.value.get(e.target)?.type === "circle", r = t ? qt(e.source) : Vt(e.source, "source", e.sourceHandle), i = n ? qt(e.target) : Vt(e.target, "target", e.targetHandle);
|
|
1027
1089
|
if (!r || !i) return null;
|
|
1028
|
-
let a = i.x - r.x, o = i.y - r.y, s = Math.hypot(a, o) || 1, c = a / s, l = o / s, u =
|
|
1029
|
-
sourceX: r.x + c *
|
|
1030
|
-
sourceY: r.y + l *
|
|
1031
|
-
sourcePosition:
|
|
1032
|
-
targetX: i.x - c *
|
|
1033
|
-
targetY: i.y - l *
|
|
1034
|
-
targetPosition:
|
|
1090
|
+
let a = i.x - r.x, o = i.y - r.y, s = Math.hypot(a, o) || 1, c = a / s, l = o / s, u = Kt.value.has(`${e.target}>${e.source}`) ? 6 : 0, d = -l * u, f = c * u, p = t ? r.r : 0, m = n ? i.r + 2 : 0, h = Math.abs(a) >= Math.abs(o), g = {
|
|
1091
|
+
sourceX: r.x + c * p + d,
|
|
1092
|
+
sourceY: r.y + l * p + f,
|
|
1093
|
+
sourcePosition: h ? a >= 0 ? "right" : "left" : o >= 0 ? "bottom" : "top",
|
|
1094
|
+
targetX: i.x - c * m + d,
|
|
1095
|
+
targetY: i.y - l * m + f,
|
|
1096
|
+
targetPosition: h ? a >= 0 ? "left" : "right" : o >= 0 ? "top" : "bottom"
|
|
1035
1097
|
};
|
|
1036
1098
|
return {
|
|
1037
|
-
...
|
|
1038
|
-
...
|
|
1099
|
+
...g,
|
|
1100
|
+
...Wt(e.type ?? S.defaultEdgeOptions?.type ?? "straight", g),
|
|
1039
1101
|
sourceInset: 0,
|
|
1040
1102
|
targetInset: 0
|
|
1041
1103
|
};
|
|
1042
1104
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1105
|
+
let Yt = (e) => L.value.get(e.source)?.type === "circle" || L.value.get(e.target)?.type === "circle", Xt = (e) => !Yt(e) && (q(e) === "smoothstep" || q(e) === "step");
|
|
1106
|
+
function Zt(e) {
|
|
1107
|
+
if (Qn.value?.id === e.id) return Qn.value.route;
|
|
1108
|
+
if (e.route) {
|
|
1109
|
+
if (cn(e.source) && cn(e.target)) {
|
|
1110
|
+
let t = V.get(e.source), n = L.value.get(e.source);
|
|
1111
|
+
if (t && n && (t.x !== n.position.x || t.y !== n.position.y)) return Qt(e, t.x - n.position.x, t.y - n.position.y);
|
|
1112
|
+
}
|
|
1113
|
+
return e.route;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
function Qt(e, t, n) {
|
|
1117
|
+
let r = $t(e)?.s, i = !r || r.position === "left" || r.position === "right";
|
|
1118
|
+
return e.route.map((e, r) => e + (r % 2 == 0 === i ? t : n));
|
|
1119
|
+
}
|
|
1120
|
+
function $t(e) {
|
|
1121
|
+
let t = Ht(e.source, "source", e.sourceHandle), n = Ht(e.target, "target", e.targetHandle);
|
|
1046
1122
|
if (!t || !n) return null;
|
|
1047
1123
|
let r = {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
targetPosition: n.position
|
|
1124
|
+
...t,
|
|
1125
|
+
position: t.position === "auto" && e.sourcePosition ? e.sourcePosition : Bt(t.position, t, n, "source")
|
|
1126
|
+
}, i = {
|
|
1127
|
+
...n,
|
|
1128
|
+
position: n.position === "auto" && e.targetPosition ? e.targetPosition : Bt(n.position, n, t, "target")
|
|
1054
1129
|
};
|
|
1055
1130
|
return {
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1131
|
+
s: r,
|
|
1132
|
+
t: i,
|
|
1133
|
+
ends: {
|
|
1134
|
+
sourceX: r.x,
|
|
1135
|
+
sourceY: r.y,
|
|
1136
|
+
sourcePosition: r.position,
|
|
1137
|
+
targetX: i.x,
|
|
1138
|
+
targetY: i.y,
|
|
1139
|
+
targetPosition: i.position
|
|
1140
|
+
}
|
|
1060
1141
|
};
|
|
1061
1142
|
}
|
|
1062
|
-
|
|
1143
|
+
function en(e) {
|
|
1144
|
+
if (Yt(e)) return Jt(e);
|
|
1145
|
+
let t = $t(e);
|
|
1146
|
+
if (!t) return null;
|
|
1147
|
+
let { s: n, t: r, ends: a } = t, o = Xt(e) ? Zt(e) : void 0, s = o ? i({
|
|
1148
|
+
...a,
|
|
1149
|
+
route: o,
|
|
1150
|
+
borderRadius: q(e) === "step" ? 0 : 8
|
|
1151
|
+
}) : Wt(q(e), a);
|
|
1152
|
+
return {
|
|
1153
|
+
...a,
|
|
1154
|
+
...s,
|
|
1155
|
+
sourceInset: n.inset,
|
|
1156
|
+
targetInset: r.inset
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
function tn(e) {
|
|
1160
|
+
if (!Xt(e)) return null;
|
|
1161
|
+
let t = $t(e);
|
|
1162
|
+
if (!t) return null;
|
|
1163
|
+
let n = Zt(e);
|
|
1164
|
+
return n ? m({
|
|
1165
|
+
...t.ends,
|
|
1166
|
+
route: n
|
|
1167
|
+
}) : o(t.ends);
|
|
1168
|
+
}
|
|
1169
|
+
let nn = (e) => !I.value && Xt(e) && (e.reroutable ?? S.edgesReroutable), rn = _(() => N.value.filter((e) => !Oe(e.id))), an = _(() => rn.value.filter((e) => e.type === "group").sort((e, t) => De(e.id) - De(t.id))), on = _(() => rn.value.filter((e) => e.type !== "group")), sn = _(() => P.value.filter((e) => !e.hidden && !Oe(e.source) && !Oe(e.target))), cn = (e) => vt.value.has(e) || Ee(e).some((e) => vt.value.has(e)), ln = (e) => (cn(e) ? 1e3 : 0) + De(e) * 10 + (je.value.has(e) ? 3 : 0), un = (e) => w[`node-${e.type ?? "default"}`], dn = (e) => w[`edge-${Gt(e)}`], fn = (e) => !I.value && (e.reconnectable ?? S.edgesReconnectable), J = A({
|
|
1063
1170
|
x: 0,
|
|
1064
1171
|
y: 0,
|
|
1065
1172
|
zoom: 1,
|
|
1066
|
-
...
|
|
1173
|
+
...S.viewport
|
|
1067
1174
|
});
|
|
1068
|
-
pe(() =>
|
|
1175
|
+
pe(() => S.viewport, (e) => {
|
|
1069
1176
|
!e || e.x === J.value.x && e.y === J.value.y && e.zoom === J.value.zoom || (Y = null, J.value = { ...e });
|
|
1070
1177
|
});
|
|
1071
|
-
let
|
|
1072
|
-
function
|
|
1073
|
-
(e.x !== J.value.x || e.y !== J.value.y || e.zoom !== J.value.zoom) && (J.value = e,
|
|
1178
|
+
let pn = (e) => Math.min(S.maxZoom, Math.max(S.minZoom, e));
|
|
1179
|
+
function mn(e) {
|
|
1180
|
+
(e.x !== J.value.x || e.y !== J.value.y || e.zoom !== J.value.zoom) && (J.value = e, C("update:viewport", e));
|
|
1074
1181
|
}
|
|
1075
1182
|
let Y = null;
|
|
1076
|
-
function
|
|
1183
|
+
function hn(e, t = {}) {
|
|
1077
1184
|
let n = {
|
|
1078
1185
|
x: e.x ?? J.value.x,
|
|
1079
1186
|
y: e.y ?? J.value.y,
|
|
1080
|
-
zoom:
|
|
1187
|
+
zoom: pn(e.zoom ?? J.value.zoom)
|
|
1081
1188
|
};
|
|
1082
|
-
if (t.animate === !1 || !
|
|
1083
|
-
Y = null,
|
|
1189
|
+
if (t.animate === !1 || !he.value || r() || typeof requestAnimationFrame > "u") {
|
|
1190
|
+
Y = null, mn(n);
|
|
1084
1191
|
return;
|
|
1085
1192
|
}
|
|
1086
1193
|
let i = Y;
|
|
@@ -1100,9 +1207,9 @@ var N = [
|
|
|
1100
1207
|
v: i?.z.v ?? 0,
|
|
1101
1208
|
t: n.zoom
|
|
1102
1209
|
}
|
|
1103
|
-
},
|
|
1210
|
+
}, Et();
|
|
1104
1211
|
}
|
|
1105
|
-
function
|
|
1212
|
+
function gn(e) {
|
|
1106
1213
|
let t = Y;
|
|
1107
1214
|
if (!t) return !1;
|
|
1108
1215
|
let n = !0;
|
|
@@ -1111,67 +1218,67 @@ var N = [
|
|
|
1111
1218
|
t.y,
|
|
1112
1219
|
t.z
|
|
1113
1220
|
]) {
|
|
1114
|
-
for (let t = 0; t < e; t +=
|
|
1115
|
-
let n = Math.min(
|
|
1116
|
-
r.v += (-
|
|
1221
|
+
for (let t = 0; t < e; t += wt) {
|
|
1222
|
+
let n = Math.min(wt, e - t);
|
|
1223
|
+
r.v += (-St * (r.p - r.t) - Ct * r.v) * n, r.p += r.v * n;
|
|
1117
1224
|
}
|
|
1118
1225
|
let i = r === t.z ? 5e-4 : .1;
|
|
1119
1226
|
Math.abs(r.p - r.t) < i && Math.abs(r.v) < i * 10 ? (r.p = r.t, r.v = 0) : n = !1;
|
|
1120
1227
|
}
|
|
1121
|
-
return
|
|
1228
|
+
return mn({
|
|
1122
1229
|
x: t.x.p,
|
|
1123
1230
|
y: t.y.p,
|
|
1124
1231
|
zoom: t.z.p
|
|
1125
1232
|
}), n && (Y = null), !n;
|
|
1126
1233
|
}
|
|
1127
|
-
function
|
|
1128
|
-
return
|
|
1234
|
+
function _n() {
|
|
1235
|
+
return D.value?.getBoundingClientRect() ?? {
|
|
1129
1236
|
left: 0,
|
|
1130
1237
|
top: 0,
|
|
1131
|
-
width:
|
|
1132
|
-
height:
|
|
1238
|
+
width: M.value.width,
|
|
1239
|
+
height: M.value.height
|
|
1133
1240
|
};
|
|
1134
1241
|
}
|
|
1135
|
-
function
|
|
1136
|
-
let t =
|
|
1242
|
+
function vn(e) {
|
|
1243
|
+
let t = _n();
|
|
1137
1244
|
return {
|
|
1138
1245
|
x: (e.x - t.left - J.value.x) / J.value.zoom,
|
|
1139
1246
|
y: (e.y - t.top - J.value.y) / J.value.zoom
|
|
1140
1247
|
};
|
|
1141
1248
|
}
|
|
1142
|
-
function
|
|
1143
|
-
let t =
|
|
1249
|
+
function yn(e) {
|
|
1250
|
+
let t = _n();
|
|
1144
1251
|
return {
|
|
1145
1252
|
x: e.x * J.value.zoom + J.value.x + t.left,
|
|
1146
1253
|
y: e.y * J.value.zoom + J.value.y + t.top
|
|
1147
1254
|
};
|
|
1148
1255
|
}
|
|
1149
|
-
function
|
|
1150
|
-
let i =
|
|
1256
|
+
function bn(e, t, n, r = !1) {
|
|
1257
|
+
let i = pn(e), a = Y && r ? {
|
|
1151
1258
|
x: Y.x.t,
|
|
1152
1259
|
y: Y.y.t,
|
|
1153
1260
|
zoom: Y.z.t
|
|
1154
1261
|
} : J.value, o = (t - a.x) / a.zoom, s = (n - a.y) / a.zoom;
|
|
1155
|
-
|
|
1262
|
+
hn({
|
|
1156
1263
|
x: t - o * i,
|
|
1157
1264
|
y: n - s * i,
|
|
1158
1265
|
zoom: i
|
|
1159
1266
|
}, { animate: r });
|
|
1160
1267
|
}
|
|
1161
|
-
let
|
|
1162
|
-
function
|
|
1163
|
-
let r =
|
|
1164
|
-
|
|
1165
|
-
x:
|
|
1166
|
-
y:
|
|
1268
|
+
let xn = () => Y?.z.t ?? J.value.zoom, Sn = () => bn(xn() * 1.25, M.value.width / 2, M.value.height / 2, !0), Cn = () => bn(xn() / 1.25, M.value.width / 2, M.value.height / 2, !0), wn = (e, t = {}) => bn(e, M.value.width / 2, M.value.height / 2, t.animate ?? !0);
|
|
1269
|
+
function Tn(e, t, n = {}) {
|
|
1270
|
+
let r = pn(n.zoom ?? xn());
|
|
1271
|
+
hn({
|
|
1272
|
+
x: M.value.width / 2 - e * r,
|
|
1273
|
+
y: M.value.height / 2 - t * r,
|
|
1167
1274
|
zoom: r
|
|
1168
1275
|
}, { animate: n.animate ?? !0 });
|
|
1169
1276
|
}
|
|
1170
|
-
function
|
|
1277
|
+
function En(e) {
|
|
1171
1278
|
let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
|
|
1172
1279
|
for (let a of e) {
|
|
1173
|
-
if (
|
|
1174
|
-
let e =
|
|
1280
|
+
if (Oe(a)) continue;
|
|
1281
|
+
let e = W(a), o = K(a);
|
|
1175
1282
|
t = Math.min(t, e.x), n = Math.min(n, e.y), r = Math.max(r, e.x + o.width), i = Math.max(i, e.y + o.height);
|
|
1176
1283
|
}
|
|
1177
1284
|
return Number.isFinite(t) ? {
|
|
@@ -1181,118 +1288,124 @@ var N = [
|
|
|
1181
1288
|
height: i - n
|
|
1182
1289
|
} : null;
|
|
1183
1290
|
}
|
|
1184
|
-
function
|
|
1185
|
-
let t = e.nodes ??
|
|
1186
|
-
for (let [e, t] of
|
|
1187
|
-
let r =
|
|
1291
|
+
function Dn(e = {}) {
|
|
1292
|
+
let t = e.nodes ?? N.value.map((e) => e.id), n = /* @__PURE__ */ new Map();
|
|
1293
|
+
for (let [e, t] of H) {
|
|
1294
|
+
let r = V.get(e);
|
|
1188
1295
|
r && (r.x !== t.tx || r.y !== t.ty) && (n.set(e, {
|
|
1189
1296
|
x: r.x,
|
|
1190
1297
|
y: r.y
|
|
1191
1298
|
}), r.x = t.tx, r.y = t.ty);
|
|
1192
1299
|
}
|
|
1193
|
-
let r =
|
|
1300
|
+
let r = En(t);
|
|
1194
1301
|
for (let [e, t] of n) {
|
|
1195
|
-
let n =
|
|
1302
|
+
let n = V.get(e);
|
|
1196
1303
|
n.x = t.x, n.y = t.y;
|
|
1197
1304
|
}
|
|
1198
|
-
if (!r || !
|
|
1199
|
-
let i = e.padding ?? .1, a =
|
|
1200
|
-
|
|
1201
|
-
zoom:
|
|
1305
|
+
if (!r || !M.value.width || !M.value.height) return;
|
|
1306
|
+
let i = e.padding ?? .1, a = M.value.width * (1 - 2 * i), o = M.value.height * (1 - 2 * i), s = Math.min(e.maxZoom ?? 1.5, Math.max(e.minZoom ?? S.minZoom, Math.min(a / Math.max(1, r.width), o / Math.max(1, r.height))));
|
|
1307
|
+
Tn(r.x + r.width / 2, r.y + r.height / 2, {
|
|
1308
|
+
zoom: pn(s),
|
|
1202
1309
|
animate: e.animate ?? !0
|
|
1203
1310
|
});
|
|
1204
1311
|
}
|
|
1205
|
-
let
|
|
1206
|
-
function
|
|
1207
|
-
|
|
1312
|
+
let On = (e) => Array.isArray(e) ? e : [e];
|
|
1313
|
+
function kn(e) {
|
|
1314
|
+
B({ nodes: [...N.value, ...On(e)] });
|
|
1208
1315
|
}
|
|
1209
|
-
function
|
|
1210
|
-
|
|
1316
|
+
function An(e) {
|
|
1317
|
+
B({ edges: [...P.value, ...On(e)] });
|
|
1318
|
+
}
|
|
1319
|
+
function jn(e) {
|
|
1320
|
+
B({
|
|
1321
|
+
nodes: e.nodes,
|
|
1322
|
+
edges: e.edges
|
|
1323
|
+
});
|
|
1211
1324
|
}
|
|
1212
|
-
function
|
|
1213
|
-
|
|
1325
|
+
function Mn(e, t) {
|
|
1326
|
+
B({ nodes: N.value.map((n) => n.id === e ? typeof t == "function" ? t(n) : {
|
|
1214
1327
|
...n,
|
|
1215
1328
|
...t
|
|
1216
1329
|
} : n) });
|
|
1217
1330
|
}
|
|
1218
|
-
function
|
|
1219
|
-
|
|
1331
|
+
function Nn(e, t) {
|
|
1332
|
+
B({ edges: P.value.map((n) => n.id === e ? typeof t == "function" ? t(n) : {
|
|
1220
1333
|
...n,
|
|
1221
1334
|
...t
|
|
1222
1335
|
} : n) });
|
|
1223
1336
|
}
|
|
1224
|
-
function
|
|
1337
|
+
function Pn(e) {
|
|
1225
1338
|
let t = /* @__PURE__ */ new Set();
|
|
1226
|
-
for (let n of e.nodes ?? [])
|
|
1227
|
-
let n = new Set(e.edges ?? []), r =
|
|
1339
|
+
for (let n of e.nodes ?? []) L.value.has(n) && (t.add(n), Ae(n).forEach((e) => t.add(e)));
|
|
1340
|
+
let n = new Set(e.edges ?? []), r = N.value.filter((e) => t.has(e.id)), i = P.value.filter((e) => n.has(e.id) || t.has(e.source) || t.has(e.target));
|
|
1228
1341
|
if (r.length || i.length) {
|
|
1229
|
-
if (
|
|
1230
|
-
let e =
|
|
1342
|
+
if (S.beforeDelete) {
|
|
1343
|
+
let e = S.beforeDelete({
|
|
1231
1344
|
nodes: r,
|
|
1232
1345
|
edges: i
|
|
1233
1346
|
});
|
|
1234
1347
|
if (e instanceof Promise) {
|
|
1235
1348
|
e.then((e) => {
|
|
1236
|
-
e &&
|
|
1349
|
+
e && Fn(t, new Set(i.map((e) => e.id)));
|
|
1237
1350
|
});
|
|
1238
1351
|
return;
|
|
1239
1352
|
}
|
|
1240
1353
|
if (!e) return;
|
|
1241
1354
|
}
|
|
1242
|
-
|
|
1355
|
+
Fn(t, new Set(i.map((e) => e.id)));
|
|
1243
1356
|
}
|
|
1244
1357
|
}
|
|
1245
|
-
function
|
|
1246
|
-
let n =
|
|
1358
|
+
function Fn(e, t) {
|
|
1359
|
+
let n = N.value.filter((t) => e.has(t.id)), r = P.value.filter((n) => t.has(n.id) || e.has(n.source) || e.has(n.target));
|
|
1247
1360
|
if (!n.length && !r.length) return;
|
|
1248
1361
|
let i = new Set(r);
|
|
1249
|
-
|
|
1250
|
-
nodes: n.length ?
|
|
1251
|
-
edges: r.length ?
|
|
1252
|
-
}),
|
|
1253
|
-
nodes:
|
|
1254
|
-
edges:
|
|
1255
|
-
}),
|
|
1362
|
+
B({
|
|
1363
|
+
nodes: n.length ? N.value.filter((t) => !e.has(t.id)) : void 0,
|
|
1364
|
+
edges: r.length ? P.value.filter((e) => !i.has(e)) : void 0
|
|
1365
|
+
}), R({
|
|
1366
|
+
nodes: F.value.nodes.filter((t) => !e.has(t)),
|
|
1367
|
+
edges: F.value.edges.filter((e) => !i.has(Ce.value.get(e)))
|
|
1368
|
+
}), C("delete", {
|
|
1256
1369
|
nodes: n,
|
|
1257
1370
|
edges: r
|
|
1258
|
-
}),
|
|
1371
|
+
}), ve(T.flowDeleted.replace("{count}", String(n.length + r.length)));
|
|
1259
1372
|
}
|
|
1260
|
-
function
|
|
1261
|
-
|
|
1262
|
-
nodes:
|
|
1263
|
-
edges:
|
|
1373
|
+
function In() {
|
|
1374
|
+
I.value || Pn({
|
|
1375
|
+
nodes: F.value.nodes.filter((e) => L.value.get(e)?.deletable !== !1),
|
|
1376
|
+
edges: F.value.edges.filter((e) => Ce.value.get(e)?.deletable !== !1)
|
|
1264
1377
|
});
|
|
1265
1378
|
}
|
|
1266
|
-
function
|
|
1267
|
-
|
|
1268
|
-
nodes:
|
|
1269
|
-
edges:
|
|
1379
|
+
function Ln() {
|
|
1380
|
+
z.value && R({
|
|
1381
|
+
nodes: rn.value.filter((e) => e.selectable !== !1).map((e) => e.id),
|
|
1382
|
+
edges: sn.value.filter((e) => e.selectable !== !1).map((e) => e.id)
|
|
1270
1383
|
});
|
|
1271
1384
|
}
|
|
1272
|
-
function
|
|
1273
|
-
let e = new Set(
|
|
1274
|
-
for (let t of [...e])
|
|
1275
|
-
e.size && (
|
|
1276
|
-
nodes:
|
|
1385
|
+
function Rn() {
|
|
1386
|
+
let e = new Set(F.value.nodes);
|
|
1387
|
+
for (let t of [...e]) Ae(t).forEach((t) => e.add(t));
|
|
1388
|
+
e.size && (ot = {
|
|
1389
|
+
nodes: N.value.filter((t) => e.has(t.id)).map((t) => {
|
|
1277
1390
|
if (t.parentId && !e.has(t.parentId)) {
|
|
1278
1391
|
let { parentId: e, extent: n, ...r } = t;
|
|
1279
1392
|
return {
|
|
1280
1393
|
...r,
|
|
1281
|
-
position:
|
|
1394
|
+
position: W(t.id)
|
|
1282
1395
|
};
|
|
1283
1396
|
}
|
|
1284
1397
|
return t;
|
|
1285
1398
|
}),
|
|
1286
|
-
edges:
|
|
1287
|
-
},
|
|
1399
|
+
edges: P.value.filter((t) => e.has(t.source) && e.has(t.target))
|
|
1400
|
+
}, st = 0);
|
|
1288
1401
|
}
|
|
1289
|
-
function
|
|
1290
|
-
|
|
1402
|
+
function zn() {
|
|
1403
|
+
I.value || (Rn(), In());
|
|
1291
1404
|
}
|
|
1292
|
-
function
|
|
1293
|
-
if (!
|
|
1294
|
-
|
|
1295
|
-
let t =
|
|
1405
|
+
function Bn(e) {
|
|
1406
|
+
if (!ot?.nodes.length || I.value) return;
|
|
1407
|
+
st++;
|
|
1408
|
+
let t = ot.nodes.filter((e) => !e.parentId || !ot.nodes.some((t) => t.id === e.parentId)), n = Math.min(...t.map((e) => e.position.x)), r = Math.min(...t.map((e) => e.position.y)), i = S.gridSize * 2 * st, a = e ? e.x - n : i, o = e ? e.y - r : i, s = new Map(ot.nodes.map((e) => [e.id, ye("node")])), c = new Set(t.map((e) => e.id)), l = ot.nodes.map((e) => ({
|
|
1296
1409
|
...e,
|
|
1297
1410
|
id: s.get(e.id),
|
|
1298
1411
|
parentId: e.parentId ? s.get(e.parentId) ?? e.parentId : void 0,
|
|
@@ -1300,30 +1413,30 @@ var N = [
|
|
|
1300
1413
|
x: e.position.x + a,
|
|
1301
1414
|
y: e.position.y + o
|
|
1302
1415
|
} : e.position
|
|
1303
|
-
})), u =
|
|
1416
|
+
})), u = ot.edges.map((e) => ({
|
|
1304
1417
|
...e,
|
|
1305
|
-
id:
|
|
1418
|
+
id: ye("edge"),
|
|
1306
1419
|
source: s.get(e.source),
|
|
1307
1420
|
target: s.get(e.target)
|
|
1308
1421
|
}));
|
|
1309
|
-
|
|
1310
|
-
nodes: [...
|
|
1311
|
-
edges: u.length ? [...
|
|
1312
|
-
}),
|
|
1422
|
+
yt = !0, B({
|
|
1423
|
+
nodes: [...N.value, ...l],
|
|
1424
|
+
edges: u.length ? [...P.value, ...u] : void 0
|
|
1425
|
+
}), R({
|
|
1313
1426
|
nodes: l.map((e) => e.id),
|
|
1314
1427
|
edges: u.map((e) => e.id)
|
|
1315
1428
|
});
|
|
1316
1429
|
}
|
|
1317
|
-
let
|
|
1318
|
-
async function
|
|
1319
|
-
let r = e ??
|
|
1320
|
-
...
|
|
1430
|
+
let Vn = () => S.layoutOptions?.direction ?? (S.direction === "vertical" ? "TB" : "LR");
|
|
1431
|
+
async function Hn(e, t, n = {}) {
|
|
1432
|
+
let r = e ?? S.layout ?? "tree", i = r === "tree" ? be : r === "layered" ? xe : r, a = new Map(N.value.filter((e) => !e.parentId).map((e) => [e.id, K(e.id)])), o = {
|
|
1433
|
+
...S.layoutOptions,
|
|
1321
1434
|
...t
|
|
1322
|
-
}, s = await i(
|
|
1435
|
+
}, s = await i(N.value, P.value, {
|
|
1323
1436
|
...o,
|
|
1324
1437
|
sizes: a,
|
|
1325
|
-
direction: o.direction ??
|
|
1326
|
-
}), c = !1, l =
|
|
1438
|
+
direction: o.direction ?? Vn()
|
|
1439
|
+
}), c = !1, l = N.value.map((e) => {
|
|
1327
1440
|
let t = s[e.id];
|
|
1328
1441
|
return !t || Math.abs(t.x - e.position.x) < .5 && Math.abs(t.y - e.position.y) < .5 ? e : (c = !0, {
|
|
1329
1442
|
...e,
|
|
@@ -1333,77 +1446,104 @@ var N = [
|
|
|
1333
1446
|
}
|
|
1334
1447
|
});
|
|
1335
1448
|
});
|
|
1336
|
-
c &&
|
|
1449
|
+
c && B({ nodes: l }, { history: n.history });
|
|
1337
1450
|
}
|
|
1338
|
-
let
|
|
1451
|
+
let Un = _(() => rn.value.map((e) => e.id).join(",") + "|" + sn.value.map((e) => `${e.source}>${e.target}`).join(","));
|
|
1339
1452
|
pe([
|
|
1340
|
-
|
|
1341
|
-
() =>
|
|
1342
|
-
() => JSON.stringify(
|
|
1453
|
+
Un,
|
|
1454
|
+
() => S.direction,
|
|
1455
|
+
() => JSON.stringify(S.layoutOptions ?? {})
|
|
1343
1456
|
], () => {
|
|
1344
|
-
|
|
1345
|
-
await
|
|
1457
|
+
S.layout && he.value && E(async () => {
|
|
1458
|
+
await Hn(null, void 0, { history: !1 }), S.fitView && Dn();
|
|
1346
1459
|
});
|
|
1347
1460
|
});
|
|
1348
|
-
let
|
|
1461
|
+
let Wn = "input, textarea, select, button, a, label, [contenteditable], [data-flow-nodrag]", X = null, Gn = null, Z = /* @__PURE__ */ new Map(), Kn = null, Q = {
|
|
1349
1462
|
x: 0,
|
|
1350
1463
|
y: 0,
|
|
1351
1464
|
inside: !1
|
|
1352
|
-
},
|
|
1353
|
-
function
|
|
1354
|
-
window.addEventListener("pointermove",
|
|
1465
|
+
}, qn = A(null), $ = ce(null), Jn = A(null), Yn = _(() => !!$.value), Xn = ce([]), Zn = A(!1), Qn = ce(null);
|
|
1466
|
+
function $n() {
|
|
1467
|
+
window.addEventListener("pointermove", ur), window.addEventListener("pointerup", fr), window.addEventListener("pointercancel", pr);
|
|
1355
1468
|
}
|
|
1356
|
-
function
|
|
1357
|
-
window.removeEventListener("pointermove",
|
|
1469
|
+
function er() {
|
|
1470
|
+
window.removeEventListener("pointermove", ur), window.removeEventListener("pointerup", fr), window.removeEventListener("pointercancel", pr), ir();
|
|
1358
1471
|
}
|
|
1359
|
-
let
|
|
1360
|
-
function
|
|
1472
|
+
let tr = [];
|
|
1473
|
+
function nr(e) {
|
|
1361
1474
|
e.cancelable && e.preventDefault();
|
|
1362
1475
|
}
|
|
1363
|
-
function
|
|
1364
|
-
|
|
1365
|
-
for (let e of
|
|
1476
|
+
function rr(e) {
|
|
1477
|
+
ir(), tr = e && e !== window ? [e, window] : [window];
|
|
1478
|
+
for (let e of tr) e.addEventListener("touchmove", nr, { passive: !1 });
|
|
1366
1479
|
}
|
|
1367
|
-
function
|
|
1368
|
-
for (let e of
|
|
1369
|
-
|
|
1480
|
+
function ir() {
|
|
1481
|
+
for (let e of tr) e.removeEventListener("touchmove", nr);
|
|
1482
|
+
tr = [];
|
|
1370
1483
|
}
|
|
1371
|
-
function
|
|
1484
|
+
function ar(e) {
|
|
1372
1485
|
let t = e.target;
|
|
1373
|
-
if (
|
|
1486
|
+
if (me(t)) return;
|
|
1374
1487
|
if (e.pointerType === "touch") {
|
|
1375
1488
|
if (X || Z.clear(), Z.set(e.pointerId, {
|
|
1376
1489
|
x: e.clientX,
|
|
1377
1490
|
y: e.clientY
|
|
1378
1491
|
}), Z.size === 2) {
|
|
1379
|
-
|
|
1492
|
+
mr(), _r();
|
|
1380
1493
|
return;
|
|
1381
1494
|
}
|
|
1382
1495
|
if (Z.size > 2) return;
|
|
1383
1496
|
}
|
|
1384
1497
|
if (X || e.button === 2) return;
|
|
1385
|
-
|
|
1498
|
+
Gn = t, D.value?.focus({ preventScroll: !0 });
|
|
1386
1499
|
let n = t.closest("[data-flow-handle]"), r = t.closest("[data-flow-reconnect]"), i = t.closest("[data-flow-node]"), a = t.closest("[data-flow-edge]");
|
|
1387
|
-
if (e.button === 1) return
|
|
1500
|
+
if (e.button === 1) return sr(e);
|
|
1388
1501
|
let o = t.closest("[data-flow-edge-delete]");
|
|
1389
1502
|
if (o) {
|
|
1390
|
-
e.preventDefault(),
|
|
1503
|
+
e.preventDefault(), Pn({ edges: [o.dataset.flowEdgeDelete] });
|
|
1391
1504
|
return;
|
|
1392
1505
|
}
|
|
1506
|
+
let s = t.closest("[data-flow-segment]");
|
|
1507
|
+
if (s && a) {
|
|
1508
|
+
let t = Ce.value.get(a.dataset.flowEdge), n = t && nn(t) ? tn(t) : null;
|
|
1509
|
+
if (t && n) {
|
|
1510
|
+
e.preventDefault(), X = {
|
|
1511
|
+
kind: "reroute",
|
|
1512
|
+
id: e.pointerId,
|
|
1513
|
+
edge: t,
|
|
1514
|
+
segment: Number(s.dataset.flowSegment),
|
|
1515
|
+
corners: n,
|
|
1516
|
+
sx: e.clientX,
|
|
1517
|
+
sy: e.clientY,
|
|
1518
|
+
moved: !1
|
|
1519
|
+
}, $n(), e.pointerType === "touch" && rr(null);
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1393
1523
|
if (r && a) {
|
|
1394
|
-
let t =
|
|
1395
|
-
if (t &&
|
|
1524
|
+
let t = Ce.value.get(a.dataset.flowEdge);
|
|
1525
|
+
if (t && fn(t)) return e.preventDefault(), Hr(e, t, r.dataset.flowReconnect);
|
|
1396
1526
|
}
|
|
1397
1527
|
if (n && i && n.dataset.flowConnectable === "true" && Le.value) {
|
|
1398
1528
|
if (e.preventDefault(), e.stopPropagation(), n.dataset.flowHandle === "target") {
|
|
1399
|
-
let t = i.dataset.flowNode, r = n.dataset.handleId || null, a =
|
|
1400
|
-
if (o)
|
|
1529
|
+
let t = i.dataset.flowNode, r = n.dataset.handleId || null, a = sn.value.filter((e) => e.target === t && (e.targetHandle ?? null) === r && fn(e)), o = a[a.length - 1];
|
|
1530
|
+
if (o) {
|
|
1531
|
+
Hr(e, o, "target");
|
|
1532
|
+
let n = X;
|
|
1533
|
+
n?.kind === "connect" && (n.tap = {
|
|
1534
|
+
x: e.clientX,
|
|
1535
|
+
y: e.clientY,
|
|
1536
|
+
touch: e.pointerType === "touch",
|
|
1537
|
+
nodeId: t
|
|
1538
|
+
});
|
|
1539
|
+
return;
|
|
1540
|
+
}
|
|
1401
1541
|
}
|
|
1402
|
-
return
|
|
1542
|
+
return Ir(e, i.dataset.flowNode, n.dataset.handleId || null, n.dataset.flowHandle);
|
|
1403
1543
|
}
|
|
1404
|
-
if (i) return t.closest(
|
|
1544
|
+
if (i) return t.closest(Wn) && t.closest(Wn) !== i ? void 0 : lr(e, i.dataset.flowNode);
|
|
1405
1545
|
if (a) {
|
|
1406
|
-
let t = e.pointerType === "touch", n =
|
|
1546
|
+
let t = e.pointerType === "touch", n = Ce.value.get(a.dataset.flowEdge), r = n && Ne.value && (!t || Me.value.has(n.id)) ? n : void 0;
|
|
1407
1547
|
r && e.preventDefault(), X = {
|
|
1408
1548
|
kind: "pan",
|
|
1409
1549
|
id: e.pointerId,
|
|
@@ -1415,14 +1555,14 @@ var N = [
|
|
|
1415
1555
|
target: "pane",
|
|
1416
1556
|
touch: t,
|
|
1417
1557
|
branch: r
|
|
1418
|
-
},
|
|
1558
|
+
}, $n();
|
|
1419
1559
|
return;
|
|
1420
1560
|
}
|
|
1421
|
-
if ((e.shiftKey ||
|
|
1422
|
-
|
|
1561
|
+
if ((e.shiftKey || S.selectionOnDrag && e.pointerType !== "touch" || !S.panOnDrag) && z.value) return cr(e);
|
|
1562
|
+
sr(e);
|
|
1423
1563
|
}
|
|
1424
|
-
let
|
|
1425
|
-
function
|
|
1564
|
+
let or;
|
|
1565
|
+
function sr(e) {
|
|
1426
1566
|
let t = e.pointerType === "touch", n = {
|
|
1427
1567
|
kind: "pan",
|
|
1428
1568
|
id: e.pointerId,
|
|
@@ -1434,9 +1574,9 @@ var N = [
|
|
|
1434
1574
|
target: "pane",
|
|
1435
1575
|
touch: t
|
|
1436
1576
|
};
|
|
1437
|
-
X = n, Y = null,
|
|
1577
|
+
X = n, Y = null, $n(), clearTimeout(or), t && z.value && (or = setTimeout(() => {
|
|
1438
1578
|
if (X !== n || n.moved) return;
|
|
1439
|
-
let e =
|
|
1579
|
+
let e = _n(), t = n.sx - e.left, r = n.sy - e.top;
|
|
1440
1580
|
X = {
|
|
1441
1581
|
kind: "marquee",
|
|
1442
1582
|
id: n.id,
|
|
@@ -1444,9 +1584,9 @@ var N = [
|
|
|
1444
1584
|
sy: r,
|
|
1445
1585
|
x: t,
|
|
1446
1586
|
y: r,
|
|
1447
|
-
additive: [...
|
|
1587
|
+
additive: [...F.value.nodes],
|
|
1448
1588
|
moved: !0
|
|
1449
|
-
},
|
|
1589
|
+
}, qn.value = {
|
|
1450
1590
|
x: t,
|
|
1451
1591
|
y: r,
|
|
1452
1592
|
width: 0,
|
|
@@ -1454,8 +1594,8 @@ var N = [
|
|
|
1454
1594
|
}, navigator.vibrate?.(10);
|
|
1455
1595
|
}, 450));
|
|
1456
1596
|
}
|
|
1457
|
-
function
|
|
1458
|
-
let t =
|
|
1597
|
+
function cr(e) {
|
|
1598
|
+
let t = _n();
|
|
1459
1599
|
X = {
|
|
1460
1600
|
kind: "marquee",
|
|
1461
1601
|
id: e.pointerId,
|
|
@@ -1463,60 +1603,62 @@ var N = [
|
|
|
1463
1603
|
sy: e.clientY - t.top,
|
|
1464
1604
|
x: e.clientX - t.left,
|
|
1465
1605
|
y: e.clientY - t.top,
|
|
1466
|
-
additive: e.shiftKey ? [...
|
|
1606
|
+
additive: e.shiftKey ? [...F.value.nodes] : [],
|
|
1467
1607
|
moved: !1
|
|
1468
|
-
},
|
|
1608
|
+
}, $n();
|
|
1469
1609
|
}
|
|
1470
|
-
function
|
|
1471
|
-
let n =
|
|
1610
|
+
function lr(e, t) {
|
|
1611
|
+
let n = L.value.get(t);
|
|
1472
1612
|
if (!n) return;
|
|
1473
|
-
let r = !1;
|
|
1474
|
-
if (
|
|
1613
|
+
let r = !1, i;
|
|
1614
|
+
if (z.value && n.selectable !== !1) {
|
|
1475
1615
|
if (e.shiftKey || e.metaKey || e.ctrlKey) {
|
|
1476
|
-
let e =
|
|
1477
|
-
if (
|
|
1478
|
-
} else
|
|
1616
|
+
let e = je.value.has(t);
|
|
1617
|
+
if (R({ nodes: e ? F.value.nodes.filter((e) => e !== t) : [...F.value.nodes, t] }), e) return;
|
|
1618
|
+
} else je.value.has(t) ? r = !0 : i = () => R({
|
|
1479
1619
|
nodes: [t],
|
|
1480
1620
|
edges: []
|
|
1481
1621
|
});
|
|
1482
1622
|
}
|
|
1483
|
-
|
|
1623
|
+
let a = e.pointerType === "touch";
|
|
1624
|
+
i && !a && i(), X = {
|
|
1484
1625
|
kind: "node",
|
|
1485
1626
|
id: e.pointerId,
|
|
1486
1627
|
nodeId: t,
|
|
1487
1628
|
sx: e.clientX,
|
|
1488
1629
|
sy: e.clientY,
|
|
1489
|
-
touch:
|
|
1630
|
+
touch: a,
|
|
1490
1631
|
active: !1,
|
|
1491
1632
|
starts: /* @__PURE__ */ new Map(),
|
|
1492
1633
|
moved: !1,
|
|
1493
|
-
reselect: r
|
|
1494
|
-
|
|
1634
|
+
reselect: r,
|
|
1635
|
+
select: a ? i : void 0
|
|
1636
|
+
}, $n();
|
|
1495
1637
|
}
|
|
1496
|
-
function
|
|
1638
|
+
function ur(e) {
|
|
1497
1639
|
if (Q.x = e.clientX, Q.y = e.clientY, e.pointerType === "touch" && Z.has(e.pointerId) && (Z.set(e.pointerId, {
|
|
1498
1640
|
x: e.clientX,
|
|
1499
1641
|
y: e.clientY
|
|
1500
|
-
}),
|
|
1642
|
+
}), Kn)) return yr();
|
|
1501
1643
|
let t = X;
|
|
1502
1644
|
if (t && t.kind !== "pinch" && t.id === e.pointerId) {
|
|
1503
1645
|
if (t.kind === "pan") {
|
|
1504
1646
|
let n = e.clientX - t.sx, r = e.clientY - t.sy;
|
|
1505
1647
|
if (!t.moved && Math.hypot(n, r) < (t.touch ? 6 : 4)) return;
|
|
1506
|
-
if (t.branch && !t.moved) return
|
|
1507
|
-
t.moved = !0, clearTimeout(
|
|
1648
|
+
if (t.branch && !t.moved) return Lr(t, t.branch, e);
|
|
1649
|
+
t.moved = !0, clearTimeout(or), Zn.value = !0, mn({
|
|
1508
1650
|
x: t.vx + n,
|
|
1509
1651
|
y: t.vy + r,
|
|
1510
1652
|
zoom: J.value.zoom
|
|
1511
1653
|
});
|
|
1512
1654
|
} else if (t.kind === "marquee") {
|
|
1513
|
-
let n =
|
|
1655
|
+
let n = _n();
|
|
1514
1656
|
if (t.x = e.clientX - n.left, t.y = e.clientY - n.top, !t.moved && Math.hypot(t.x - t.sx, t.y - t.sy) < 4) return;
|
|
1515
|
-
t.moved = !0,
|
|
1657
|
+
t.moved = !0, Cr(t);
|
|
1516
1658
|
} else if (t.kind === "node") {
|
|
1517
1659
|
if (!t.active) {
|
|
1518
1660
|
if (Math.hypot(e.clientX - t.sx, e.clientY - t.sy) < (t.touch ? 6 : 4)) return;
|
|
1519
|
-
if (!Ie.value || !
|
|
1661
|
+
if (!Ie.value || !wr(t, e)) {
|
|
1520
1662
|
X = {
|
|
1521
1663
|
kind: "pan",
|
|
1522
1664
|
id: t.id,
|
|
@@ -1530,87 +1672,121 @@ var N = [
|
|
|
1530
1672
|
return;
|
|
1531
1673
|
}
|
|
1532
1674
|
}
|
|
1533
|
-
t.moved = !0,
|
|
1534
|
-
} else t.kind === "connect"
|
|
1675
|
+
t.moved = !0, Er(t, e.clientX, e.clientY), jr(t), C("node-drag", [...t.starts.keys()].map((e) => L.value.get(e)), e), Et();
|
|
1676
|
+
} else if (t.kind === "connect") t.moved = !0, qr(t, e.clientX, e.clientY), Et();
|
|
1677
|
+
else if (t.kind === "reroute") {
|
|
1678
|
+
if (!t.moved && Math.hypot(e.clientX - t.sx, e.clientY - t.sy) < (e.pointerType === "touch" ? 6 : 4)) return;
|
|
1679
|
+
t.moved = !0, Qn.value = {
|
|
1680
|
+
id: t.edge.id,
|
|
1681
|
+
route: dr(t, e)
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1535
1684
|
}
|
|
1536
1685
|
}
|
|
1537
|
-
function
|
|
1538
|
-
|
|
1539
|
-
|
|
1686
|
+
function dr(e, t) {
|
|
1687
|
+
let n = e.corners.map((e) => [e[0], e[1]]), r = e.segment, i = n[r], a = n[r + 1], o = Math.abs(i[1] - a[1]) < .01, s = +!!o, l = S.gridSize || 20, u = (e) => S.snapToGrid ? Math.round(e / l) * l : Math.round(e), d = (o ? t.clientY - e.sy : t.clientX - e.sx) / J.value.zoom, f = u(i[s] + d), p = r === 0, m = r === n.length - 2, h = s === 1 ? 0 : 1, g = Math.sign(a[h] - i[h]) || 1, _ = Math.abs(a[h] - i[h]), v = Math.min(l, _ / 3), y = (e, t) => s === 1 ? [e[0], t] : [t, e[1]], b = (e, t) => h === 0 ? [e[0] + t, e[1]] : [e[0], e[1] + t], x = [];
|
|
1688
|
+
if (p) {
|
|
1689
|
+
let e = b(i, g * v);
|
|
1690
|
+
x.push(e, y(e, f));
|
|
1691
|
+
} else x.push(y(i, f));
|
|
1692
|
+
if (m) {
|
|
1693
|
+
let e = b(a, -g * v);
|
|
1694
|
+
x.push(y(e, f), e);
|
|
1695
|
+
} else x.push(y(a, f));
|
|
1696
|
+
let C = [
|
|
1697
|
+
...n.slice(0, p ? 1 : r),
|
|
1698
|
+
...x,
|
|
1699
|
+
...n.slice(m ? r + 1 : r + 2)
|
|
1700
|
+
], w = $t(e.edge);
|
|
1701
|
+
return c(C, w?.s.position, w?.t.position);
|
|
1702
|
+
}
|
|
1703
|
+
function fr(e) {
|
|
1704
|
+
if (Z.delete(e.pointerId), Kn) {
|
|
1705
|
+
Z.size < 2 && vr();
|
|
1540
1706
|
return;
|
|
1541
1707
|
}
|
|
1542
1708
|
let t = X;
|
|
1543
1709
|
if (t && t.kind !== "pinch" && t.id === e.pointerId) {
|
|
1544
|
-
if (X = null, clearTimeout(
|
|
1545
|
-
else if (t.kind === "marquee")
|
|
1710
|
+
if (X = null, clearTimeout(or), er(), Zn.value = !1, t.kind === "pan") t.moved || hr(e);
|
|
1711
|
+
else if (t.kind === "marquee") qn.value = null, t.moved || hr(e);
|
|
1546
1712
|
else if (t.kind === "node") {
|
|
1547
|
-
if (t.active)
|
|
1713
|
+
if (t.active) Pr(t, e);
|
|
1548
1714
|
else {
|
|
1549
|
-
t.reselect && !e.shiftKey &&
|
|
1715
|
+
t.select?.(), t.reselect && !e.shiftKey && R({
|
|
1550
1716
|
nodes: [t.nodeId],
|
|
1551
1717
|
edges: []
|
|
1552
1718
|
});
|
|
1553
|
-
let n =
|
|
1554
|
-
n &&
|
|
1719
|
+
let n = L.value.get(t.nodeId);
|
|
1720
|
+
n && C("node-click", n, e);
|
|
1721
|
+
}
|
|
1722
|
+
} else if (t.kind === "connect") Jr(t, e);
|
|
1723
|
+
else if (t.kind === "reroute") {
|
|
1724
|
+
let e = Qn.value;
|
|
1725
|
+
if (Qn.value = null, t.moved && e) {
|
|
1726
|
+
let n = Ce.value.get(t.edge.id);
|
|
1727
|
+
n && (Nn(n.id, { route: e.route }), C("reroute", {
|
|
1728
|
+
...n,
|
|
1729
|
+
route: e.route
|
|
1730
|
+
}));
|
|
1555
1731
|
}
|
|
1556
|
-
}
|
|
1732
|
+
}
|
|
1557
1733
|
}
|
|
1558
1734
|
}
|
|
1559
|
-
function
|
|
1560
|
-
if (clearTimeout(
|
|
1561
|
-
Z.size < 2 &&
|
|
1735
|
+
function pr(e) {
|
|
1736
|
+
if (clearTimeout(or), Z.delete(e.pointerId), Kn) {
|
|
1737
|
+
Z.size < 2 && vr();
|
|
1562
1738
|
return;
|
|
1563
1739
|
}
|
|
1564
|
-
|
|
1740
|
+
mr();
|
|
1565
1741
|
}
|
|
1566
|
-
function
|
|
1742
|
+
function mr() {
|
|
1567
1743
|
let e = X;
|
|
1568
|
-
if (X = null,
|
|
1744
|
+
if (X = null, er(), Zn.value = !1, qn.value = null, e?.kind === "node" && e.active) {
|
|
1569
1745
|
for (let [t, n] of e.starts) {
|
|
1570
|
-
let e =
|
|
1746
|
+
let e = H.get(t);
|
|
1571
1747
|
e && (e.tx = n.x, e.ty = n.y);
|
|
1572
1748
|
}
|
|
1573
|
-
|
|
1749
|
+
vt.value = /* @__PURE__ */ new Set(), G.clear(), Xn.value = [], kr.value = null, Ar = null, Et();
|
|
1574
1750
|
}
|
|
1575
|
-
e?.kind === "connect" && ($.value = null,
|
|
1751
|
+
e?.kind === "connect" && ($.value = null, Jn.value = null), e?.kind === "reroute" && (Qn.value = null);
|
|
1576
1752
|
}
|
|
1577
|
-
function
|
|
1578
|
-
let t = (
|
|
1753
|
+
function hr(e) {
|
|
1754
|
+
let t = (Gn ?? e.target).closest("[data-flow-edge]"), n = t ? Ce.value.get(t.dataset.flowEdge) : void 0;
|
|
1579
1755
|
if (n) {
|
|
1580
|
-
|
|
1756
|
+
z.value && n.selectable !== !1 && (e.shiftKey ? R({ edges: Me.value.has(n.id) ? F.value.edges.filter((e) => e !== n.id) : [...F.value.edges, n.id] }) : R({
|
|
1581
1757
|
nodes: [],
|
|
1582
1758
|
edges: [n.id]
|
|
1583
|
-
})),
|
|
1759
|
+
})), C("edge-click", n, e);
|
|
1584
1760
|
return;
|
|
1585
1761
|
}
|
|
1586
|
-
e.shiftKey ||
|
|
1762
|
+
e.shiftKey || R(lt()), C("pane-click", vn({
|
|
1587
1763
|
x: e.clientX,
|
|
1588
1764
|
y: e.clientY
|
|
1589
1765
|
}), e);
|
|
1590
1766
|
}
|
|
1591
|
-
function
|
|
1592
|
-
let [e, t] = [...Z.values()], n =
|
|
1767
|
+
function gr() {
|
|
1768
|
+
let [e, t] = [...Z.values()], n = _n();
|
|
1593
1769
|
return {
|
|
1594
1770
|
dist: Math.hypot(e.x - t.x, e.y - t.y) || 1,
|
|
1595
1771
|
cx: (e.x + t.x) / 2 - n.left,
|
|
1596
1772
|
cy: (e.y + t.y) / 2 - n.top
|
|
1597
1773
|
};
|
|
1598
1774
|
}
|
|
1599
|
-
function
|
|
1600
|
-
clearTimeout(
|
|
1601
|
-
let e =
|
|
1602
|
-
Y = null, X = { kind: "pinch" },
|
|
1775
|
+
function _r() {
|
|
1776
|
+
clearTimeout(or);
|
|
1777
|
+
let e = gr();
|
|
1778
|
+
Y = null, X = { kind: "pinch" }, Kn = {
|
|
1603
1779
|
...e,
|
|
1604
1780
|
zoom: J.value.zoom,
|
|
1605
1781
|
fx: (e.cx - J.value.x) / J.value.zoom,
|
|
1606
1782
|
fy: (e.cy - J.value.y) / J.value.zoom
|
|
1607
|
-
},
|
|
1783
|
+
}, $n();
|
|
1608
1784
|
}
|
|
1609
|
-
function
|
|
1610
|
-
|
|
1785
|
+
function vr() {
|
|
1786
|
+
Kn = null;
|
|
1611
1787
|
let e = [...Z][0];
|
|
1612
1788
|
if (!e) {
|
|
1613
|
-
X = null,
|
|
1789
|
+
X = null, er();
|
|
1614
1790
|
return;
|
|
1615
1791
|
}
|
|
1616
1792
|
let [t, n] = e;
|
|
@@ -1626,98 +1802,99 @@ var N = [
|
|
|
1626
1802
|
touch: !0
|
|
1627
1803
|
};
|
|
1628
1804
|
}
|
|
1629
|
-
function
|
|
1630
|
-
if (!
|
|
1631
|
-
let e =
|
|
1632
|
-
|
|
1633
|
-
x: e.cx -
|
|
1634
|
-
y: e.cy -
|
|
1805
|
+
function yr() {
|
|
1806
|
+
if (!Kn || Z.size < 2) return;
|
|
1807
|
+
let e = gr(), t = pn(Kn.zoom * e.dist / Kn.dist);
|
|
1808
|
+
mn({
|
|
1809
|
+
x: e.cx - Kn.fx * t,
|
|
1810
|
+
y: e.cy - Kn.fy * t,
|
|
1635
1811
|
zoom: t
|
|
1636
1812
|
});
|
|
1637
1813
|
}
|
|
1638
|
-
function
|
|
1814
|
+
function br(e) {
|
|
1639
1815
|
let t = e.target;
|
|
1640
|
-
if (
|
|
1816
|
+
if (me(t) || t.closest("[data-flow-nowheel]")) return;
|
|
1641
1817
|
e.preventDefault();
|
|
1642
|
-
let n = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ?
|
|
1643
|
-
if (e.ctrlKey || e.metaKey ||
|
|
1818
|
+
let n = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? M.value.height : 1, r = _n();
|
|
1819
|
+
if (e.ctrlKey || e.metaKey || S.wheel === "zoom") {
|
|
1644
1820
|
let t = Math.max(-50, Math.min(50, e.deltaY * n));
|
|
1645
|
-
|
|
1821
|
+
bn(J.value.zoom * Math.exp(-t * .01), e.clientX - r.left, e.clientY - r.top), Y = null;
|
|
1646
1822
|
return;
|
|
1647
1823
|
}
|
|
1648
1824
|
let i = (e.shiftKey && !e.deltaX ? e.deltaY : e.deltaX) * n, a = (e.shiftKey && !e.deltaX ? 0 : e.deltaY) * n;
|
|
1649
|
-
Y = null,
|
|
1825
|
+
Y = null, mn({
|
|
1650
1826
|
x: J.value.x - i,
|
|
1651
1827
|
y: J.value.y - a,
|
|
1652
1828
|
zoom: J.value.zoom
|
|
1653
1829
|
});
|
|
1654
1830
|
}
|
|
1655
|
-
function
|
|
1831
|
+
function xr(e) {
|
|
1656
1832
|
let t = e.target;
|
|
1657
|
-
if (
|
|
1833
|
+
if (me(t)) return;
|
|
1658
1834
|
let n = t.closest("[data-flow-node]"), r = t.closest("[data-flow-edge]");
|
|
1659
1835
|
if (n) {
|
|
1660
|
-
let t =
|
|
1661
|
-
t &&
|
|
1836
|
+
let t = L.value.get(n.dataset.flowNode);
|
|
1837
|
+
t && C("node-dblclick", t, e);
|
|
1662
1838
|
} else if (r) {
|
|
1663
|
-
let t =
|
|
1664
|
-
t &&
|
|
1665
|
-
} else if (
|
|
1839
|
+
let t = Ce.value.get(r.dataset.flowEdge);
|
|
1840
|
+
t && C("edge-dblclick", t, e);
|
|
1841
|
+
} else if (C("pane-dblclick", vn({
|
|
1666
1842
|
x: e.clientX,
|
|
1667
1843
|
y: e.clientY
|
|
1668
|
-
}), e),
|
|
1669
|
-
let t =
|
|
1670
|
-
|
|
1844
|
+
}), e), S.zoomOnDoubleClick) {
|
|
1845
|
+
let t = _n();
|
|
1846
|
+
bn(xn() * 2, e.clientX - t.left, e.clientY - t.top, !0);
|
|
1671
1847
|
}
|
|
1672
1848
|
}
|
|
1673
|
-
function
|
|
1849
|
+
function Sr(e) {
|
|
1674
1850
|
let t = e.target;
|
|
1675
|
-
if (
|
|
1676
|
-
!
|
|
1677
|
-
let n = t.closest("[data-flow-node]"), r = t.closest("[data-flow-edge]"), i = n ?
|
|
1678
|
-
i ?
|
|
1851
|
+
if (me(t)) return;
|
|
1852
|
+
!S.nativeContextMenu && !t.closest("input, textarea, select, [contenteditable]") && e.preventDefault();
|
|
1853
|
+
let n = t.closest("[data-flow-node]"), r = t.closest("[data-flow-edge]"), i = n ? L.value.get(n.dataset.flowNode) : void 0, a = r ? Ce.value.get(r.dataset.flowEdge) : void 0;
|
|
1854
|
+
i ? C("node-contextmenu", i, e) : a ? C("edge-contextmenu", a, e) : C("pane-contextmenu", vn({
|
|
1679
1855
|
x: e.clientX,
|
|
1680
1856
|
y: e.clientY
|
|
1681
1857
|
}), e);
|
|
1682
1858
|
}
|
|
1683
|
-
function
|
|
1859
|
+
function Cr(e) {
|
|
1684
1860
|
let t = Math.min(e.sx, e.x), n = Math.min(e.sy, e.y), r = Math.abs(e.x - e.sx), i = Math.abs(e.y - e.sy);
|
|
1685
|
-
|
|
1861
|
+
qn.value = {
|
|
1686
1862
|
x: t,
|
|
1687
1863
|
y: n,
|
|
1688
1864
|
width: r,
|
|
1689
1865
|
height: i
|
|
1690
1866
|
};
|
|
1691
|
-
let a = J.value.zoom, o = (t - J.value.x) / a, s = (n - J.value.y) / a, c = o + r / a, l = s + i / a, u =
|
|
1867
|
+
let a = J.value.zoom, o = (t - J.value.x) / a, s = (n - J.value.y) / a, c = o + r / a, l = s + i / a, u = rn.value.filter((e) => {
|
|
1692
1868
|
if (e.selectable === !1) return !1;
|
|
1693
|
-
let t =
|
|
1869
|
+
let t = W(e.id), n = K(e.id);
|
|
1694
1870
|
return t.x < c && t.x + n.width > o && t.y < l && t.y + n.height > s;
|
|
1695
1871
|
}).map((e) => e.id), d = [.../* @__PURE__ */ new Set([...e.additive, ...u])], f = new Set(d);
|
|
1696
|
-
|
|
1872
|
+
R({
|
|
1697
1873
|
nodes: d,
|
|
1698
|
-
edges:
|
|
1874
|
+
edges: sn.value.filter((e) => e.selectable !== !1 && f.has(e.source) && f.has(e.target)).map((e) => e.id)
|
|
1699
1875
|
});
|
|
1700
1876
|
}
|
|
1701
|
-
function
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1877
|
+
function wr(e, t) {
|
|
1878
|
+
e.select?.(), e.select = void 0;
|
|
1879
|
+
let n = je.value.has(e.nodeId) ? F.value.nodes : [e.nodeId], r = n.filter((e) => {
|
|
1880
|
+
let t = L.value.get(e);
|
|
1881
|
+
return t && t.draggable !== !1 && !Oe(e) && !Ee(e).some((e) => n.includes(e));
|
|
1705
1882
|
});
|
|
1706
|
-
if (!r.includes(e.nodeId) &&
|
|
1883
|
+
if (!r.includes(e.nodeId) && L.value.get(e.nodeId)?.draggable === !1 || !r.length) return !1;
|
|
1707
1884
|
for (let t of r) {
|
|
1708
|
-
let n =
|
|
1885
|
+
let n = H.get(t);
|
|
1709
1886
|
e.starts.set(t, {
|
|
1710
1887
|
x: n.tx,
|
|
1711
1888
|
y: n.ty
|
|
1712
1889
|
});
|
|
1713
1890
|
}
|
|
1714
1891
|
e.active = !0;
|
|
1715
|
-
for (let e of r) for (let t of
|
|
1716
|
-
return
|
|
1892
|
+
for (let e of r) for (let t of Ee(e)) G.has(t) || G.set(t, K(t));
|
|
1893
|
+
return vt.value = new Set(r), document.body.style.userSelect = "none", C("node-drag-start", r.map((e) => L.value.get(e)), t), !0;
|
|
1717
1894
|
}
|
|
1718
|
-
function
|
|
1719
|
-
if (!
|
|
1720
|
-
X &&
|
|
1895
|
+
function Tr(e, t) {
|
|
1896
|
+
if (!L.value.has(e) || I.value) return;
|
|
1897
|
+
X && mr(), H.has(e) || xt(), z.value && R({
|
|
1721
1898
|
nodes: [e],
|
|
1722
1899
|
edges: []
|
|
1723
1900
|
});
|
|
@@ -1733,34 +1910,37 @@ var N = [
|
|
|
1733
1910
|
moved: !0,
|
|
1734
1911
|
reselect: !1
|
|
1735
1912
|
};
|
|
1736
|
-
X = n, Q.x = t.clientX, Q.y = t.clientY,
|
|
1913
|
+
X = n, Q.x = t.clientX, Q.y = t.clientY, $n(), n.touch && rr(t.target), wr(n, t) || (X = null, er());
|
|
1737
1914
|
}
|
|
1738
|
-
function
|
|
1915
|
+
function Er(e, t, n) {
|
|
1739
1916
|
let r = J.value.zoom, i = (t - e.sx) / r, a = (n - e.sy) / r, o = e.starts.get(e.nodeId) ?? [...e.starts.values()][0], s = e.starts.has(e.nodeId) ? e.nodeId : [...e.starts.keys()][0];
|
|
1740
|
-
if (
|
|
1741
|
-
let e =
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1917
|
+
if (S.snapToGrid) {
|
|
1918
|
+
let e = S.gridSize, t = L.value.get(s)?.gridOffset ?? {
|
|
1919
|
+
x: 0,
|
|
1920
|
+
y: 0
|
|
1921
|
+
};
|
|
1922
|
+
i = Math.round((o.x + t.x + i) / e) * e - o.x - t.x, a = Math.round((o.y + t.y + a) / e) * e - o.y - t.y, Xn.value = [];
|
|
1923
|
+
} else if (S.guides && e.starts.size === 1) {
|
|
1924
|
+
let e = Dr(s, o, i, a);
|
|
1745
1925
|
i = e.dx, a = e.dy;
|
|
1746
1926
|
}
|
|
1747
1927
|
for (let [t, n] of e.starts) {
|
|
1748
|
-
let e = n.x + i, r = n.y + a, o =
|
|
1928
|
+
let e = n.x + i, r = n.y + a, o = L.value.get(t), s = Te(t);
|
|
1749
1929
|
if (o.extent === "parent" && s) {
|
|
1750
|
-
let n =
|
|
1930
|
+
let n = K(s), i = K(t);
|
|
1751
1931
|
e = Math.max(0, Math.min(n.width - i.width, e)), r = Math.max(0, Math.min(n.height - i.height, r));
|
|
1752
1932
|
}
|
|
1753
|
-
let c =
|
|
1933
|
+
let c = H.get(t);
|
|
1754
1934
|
c.x = c.tx = e, c.y = c.ty = r, c.vx = c.vy = 0;
|
|
1755
|
-
let l =
|
|
1935
|
+
let l = V.get(t);
|
|
1756
1936
|
l.x = e, l.y = r;
|
|
1757
1937
|
}
|
|
1758
1938
|
}
|
|
1759
|
-
function
|
|
1760
|
-
let i =
|
|
1939
|
+
function Dr(e, t, n, r) {
|
|
1940
|
+
let i = Te(e) ? W(Te(e)) : {
|
|
1761
1941
|
x: 0,
|
|
1762
1942
|
y: 0
|
|
1763
|
-
}, a =
|
|
1943
|
+
}, a = K(e), o = i.x + t.x + n, s = i.y + t.y + r, c = [
|
|
1764
1944
|
o,
|
|
1765
1945
|
o + a.width / 2,
|
|
1766
1946
|
o + a.width
|
|
@@ -1770,12 +1950,12 @@ var N = [
|
|
|
1770
1950
|
s + a.height
|
|
1771
1951
|
], u = 6 / J.value.zoom, d = null, f = null, p = /* @__PURE__ */ new Set([
|
|
1772
1952
|
e,
|
|
1773
|
-
...
|
|
1774
|
-
...
|
|
1953
|
+
...Ae(e),
|
|
1954
|
+
...Ee(e)
|
|
1775
1955
|
]);
|
|
1776
|
-
for (let e of
|
|
1956
|
+
for (let e of rn.value) {
|
|
1777
1957
|
if (p.has(e.id)) continue;
|
|
1778
|
-
let t =
|
|
1958
|
+
let t = W(e.id), n = K(e.id), r = [
|
|
1779
1959
|
t.x,
|
|
1780
1960
|
t.x + n.width / 2,
|
|
1781
1961
|
t.x + n.width
|
|
@@ -1821,76 +2001,76 @@ var N = [
|
|
|
1821
2001
|
to: Math.max(e + a.width, f.box.x2)
|
|
1822
2002
|
});
|
|
1823
2003
|
}
|
|
1824
|
-
return
|
|
2004
|
+
return Xn.value = m, {
|
|
1825
2005
|
dx: n,
|
|
1826
2006
|
dy: r
|
|
1827
2007
|
};
|
|
1828
2008
|
}
|
|
1829
|
-
function
|
|
2009
|
+
function Or(e) {
|
|
1830
2010
|
let t, n = /* @__PURE__ */ new Set();
|
|
1831
2011
|
return typeof e == "string" ? (t = {
|
|
1832
|
-
...
|
|
1833
|
-
...
|
|
1834
|
-
}, n.add(e),
|
|
2012
|
+
...W(e),
|
|
2013
|
+
...K(e)
|
|
2014
|
+
}, n.add(e), Ae(e).forEach((e) => n.add(e)), Ee(e).forEach((e) => n.add(e))) : t = e, rn.value.filter((e) => {
|
|
1835
2015
|
if (n.has(e.id) || e.type === "group") return !1;
|
|
1836
|
-
let r =
|
|
2016
|
+
let r = W(e.id), i = K(e.id);
|
|
1837
2017
|
return r.x < t.x + t.width && r.x + i.width > t.x && r.y < t.y + t.height && r.y + i.height > t.y;
|
|
1838
2018
|
});
|
|
1839
2019
|
}
|
|
1840
|
-
let
|
|
1841
|
-
function
|
|
1842
|
-
|
|
1843
|
-
let t =
|
|
1844
|
-
|
|
1845
|
-
}
|
|
1846
|
-
function
|
|
1847
|
-
if (!
|
|
1848
|
-
let t = [...e.starts.keys()][0], n =
|
|
1849
|
-
if (!n || n.type === "group" || n.connectable === !1 || n.insertable === !1 ||
|
|
1850
|
-
let r = null, i = null, a =
|
|
2020
|
+
let kr = A(null), Ar = null;
|
|
2021
|
+
function jr(e) {
|
|
2022
|
+
Ar = null;
|
|
2023
|
+
let t = Mr(e);
|
|
2024
|
+
Ar = t, kr.value = t?.edge.id ?? null;
|
|
2025
|
+
}
|
|
2026
|
+
function Mr(e) {
|
|
2027
|
+
if (!S.insertOnEdge || e.starts.size !== 1 || !Le.value) return null;
|
|
2028
|
+
let t = [...e.starts.keys()][0], n = L.value.get(t);
|
|
2029
|
+
if (!n || n.type === "group" || n.connectable === !1 || n.insertable === !1 || P.value.some((e) => e.source === t || e.target === t)) return null;
|
|
2030
|
+
let r = null, i = null, a = kt.get(t);
|
|
1851
2031
|
if (a?.length) {
|
|
1852
2032
|
let e = a.find((e) => e.type === "target" && e.connectable), t = a.find((e) => e.type === "source" && e.connectable);
|
|
1853
2033
|
if (!e && n.type !== "circle" || !t && n.type !== "circle") return null;
|
|
1854
2034
|
r = e?.id ?? null, i = t?.id ?? null;
|
|
1855
2035
|
}
|
|
1856
|
-
let o =
|
|
1857
|
-
for (let e of
|
|
2036
|
+
let o = W(t), s = K(t), c = o.x + s.width / 2, u = o.y + s.height / 2, f = Math.max(8 / J.value.zoom, Math.min(s.width, s.height) / 2), p = null;
|
|
2037
|
+
for (let e of sn.value) {
|
|
1858
2038
|
if (e.deletable === !1) continue;
|
|
1859
|
-
let t =
|
|
2039
|
+
let t = en(e);
|
|
1860
2040
|
if (!t) continue;
|
|
1861
|
-
let n =
|
|
1862
|
-
n <= f && (!
|
|
2041
|
+
let n = l(c, u, tn(e) ?? d(q(e), t));
|
|
2042
|
+
n <= f && (!p || n < p.d) && (p = {
|
|
1863
2043
|
edge: e,
|
|
1864
2044
|
d: n
|
|
1865
2045
|
});
|
|
1866
2046
|
}
|
|
1867
|
-
if (!
|
|
1868
|
-
let
|
|
1869
|
-
source:
|
|
1870
|
-
sourceHandle:
|
|
2047
|
+
if (!p) return null;
|
|
2048
|
+
let m = p.edge, h = {
|
|
2049
|
+
source: m.source,
|
|
2050
|
+
sourceHandle: m.sourceHandle ?? null,
|
|
1871
2051
|
target: t,
|
|
1872
2052
|
targetHandle: r
|
|
1873
|
-
},
|
|
2053
|
+
}, g = {
|
|
1874
2054
|
source: t,
|
|
1875
2055
|
sourceHandle: i,
|
|
1876
|
-
target:
|
|
1877
|
-
targetHandle:
|
|
2056
|
+
target: m.target,
|
|
2057
|
+
targetHandle: m.targetHandle ?? null
|
|
1878
2058
|
};
|
|
1879
|
-
return !
|
|
2059
|
+
return !Gr(h) || !Gr(g) ? null : {
|
|
1880
2060
|
node: t,
|
|
1881
|
-
edge:
|
|
1882
|
-
connections: [
|
|
2061
|
+
edge: m,
|
|
2062
|
+
connections: [h, g]
|
|
1883
2063
|
};
|
|
1884
2064
|
}
|
|
1885
|
-
function
|
|
2065
|
+
function Nr(e, t) {
|
|
1886
2066
|
let n = new Map(e.map((e) => [e.id, e])), r = n.get(t.edge.source), i = n.get(t.node), a = n.get(t.edge.target);
|
|
1887
2067
|
if (!r || !i || !a || r.parentId !== i.parentId || i.parentId !== a.parentId) return e;
|
|
1888
|
-
let o =
|
|
2068
|
+
let o = S.direction !== "vertical", s = o ? "x" : "y", c = (e) => o ? K(e).width : K(e).height, l = r.position[s] + c(r.id);
|
|
1889
2069
|
if (a.position[s] < l) return e;
|
|
1890
2070
|
let u = Math.max(i.position[s], l + 48), d = Math.max(0, u + c(i.id) + 48 - a.position[s]), f = /* @__PURE__ */ new Set();
|
|
1891
2071
|
if (d > 0) {
|
|
1892
2072
|
let e = /* @__PURE__ */ new Map();
|
|
1893
|
-
for (let n of
|
|
2073
|
+
for (let n of P.value) n !== t.edge && (e.get(n.source) ?? e.set(n.source, []).get(n.source)).push(n.target);
|
|
1894
2074
|
let o = [a.id];
|
|
1895
2075
|
for (; o.length;) {
|
|
1896
2076
|
let t = o.shift();
|
|
@@ -1913,50 +2093,50 @@ var N = [
|
|
|
1913
2093
|
}
|
|
1914
2094
|
} : e);
|
|
1915
2095
|
}
|
|
1916
|
-
function
|
|
2096
|
+
function Pr(e, t) {
|
|
1917
2097
|
document.body.style.userSelect = "";
|
|
1918
|
-
let n =
|
|
1919
|
-
|
|
2098
|
+
let n = Ar;
|
|
2099
|
+
Ar = null, kr.value = null;
|
|
1920
2100
|
let r;
|
|
1921
|
-
if (n &&
|
|
2101
|
+
if (n && S.autoConnect) {
|
|
1922
2102
|
let { id: e, label: t, source: i, target: a, sourceHandle: o, targetHandle: s, ...c } = n.edge;
|
|
1923
2103
|
r = n.connections.map((e) => ({
|
|
1924
2104
|
...c,
|
|
1925
|
-
id:
|
|
2105
|
+
id: ye("edge"),
|
|
1926
2106
|
...e
|
|
1927
2107
|
}));
|
|
1928
2108
|
}
|
|
1929
|
-
|
|
2109
|
+
Xn.value = [];
|
|
1930
2110
|
let i = [...e.starts.keys()].filter((t) => {
|
|
1931
|
-
let n =
|
|
2111
|
+
let n = H.get(t), r = e.starts.get(t);
|
|
1932
2112
|
return n.tx !== r.x || n.ty !== r.y;
|
|
1933
2113
|
}), a = /* @__PURE__ */ new Map();
|
|
1934
|
-
if (
|
|
1935
|
-
let n =
|
|
2114
|
+
if (S.dropIntoGroups) {
|
|
2115
|
+
let n = vn({
|
|
1936
2116
|
x: t.clientX,
|
|
1937
2117
|
y: t.clientY
|
|
1938
2118
|
});
|
|
1939
2119
|
for (let t of e.starts.keys()) {
|
|
1940
|
-
let e =
|
|
2120
|
+
let e = L.value.get(t);
|
|
1941
2121
|
if (e.type === "group") continue;
|
|
1942
|
-
let r = /* @__PURE__ */ new Set([t, ...
|
|
1943
|
-
let t =
|
|
2122
|
+
let r = /* @__PURE__ */ new Set([t, ...Ae(t)]), i = an.value.filter((e) => !r.has(e.id)).filter((e) => {
|
|
2123
|
+
let t = W(e.id), r = K(e.id);
|
|
1944
2124
|
return n.x >= t.x && n.x <= t.x + r.width && n.y >= t.y && n.y <= t.y + r.height;
|
|
1945
|
-
}).sort((e, t) =>
|
|
2125
|
+
}).sort((e, t) => De(t.id) - De(e.id))[0];
|
|
1946
2126
|
(i?.id ?? void 0) !== (e.parentId ?? void 0) && a.set(t, i?.id);
|
|
1947
2127
|
}
|
|
1948
2128
|
}
|
|
1949
2129
|
if (i.length || a.size) {
|
|
1950
|
-
let t = new Set(i), o =
|
|
2130
|
+
let t = new Set(i), o = N.value.map((e) => {
|
|
1951
2131
|
if (!t.has(e.id) && !a.has(e.id)) return e;
|
|
1952
|
-
let n =
|
|
2132
|
+
let n = H.get(e.id), r = {
|
|
1953
2133
|
x: n.tx,
|
|
1954
2134
|
y: n.ty
|
|
1955
2135
|
}, i = e.parentId;
|
|
1956
2136
|
if (a.has(e.id)) {
|
|
1957
|
-
let t =
|
|
2137
|
+
let t = W(e.id);
|
|
1958
2138
|
i = a.get(e.id);
|
|
1959
|
-
let n = i ?
|
|
2139
|
+
let n = i ? W(i) : {
|
|
1960
2140
|
x: 0,
|
|
1961
2141
|
y: 0
|
|
1962
2142
|
};
|
|
@@ -1964,9 +2144,9 @@ var N = [
|
|
|
1964
2144
|
x: t.x - n.x,
|
|
1965
2145
|
y: t.y - n.y
|
|
1966
2146
|
};
|
|
1967
|
-
let o =
|
|
2147
|
+
let o = H.get(e.id);
|
|
1968
2148
|
o.x = o.tx = r.x, o.y = o.ty = r.y;
|
|
1969
|
-
let s =
|
|
2149
|
+
let s = V.get(e.id);
|
|
1970
2150
|
s.x = r.x, s.y = r.y;
|
|
1971
2151
|
}
|
|
1972
2152
|
let o = {
|
|
@@ -1974,40 +2154,43 @@ var N = [
|
|
|
1974
2154
|
position: r
|
|
1975
2155
|
};
|
|
1976
2156
|
return i ? o.parentId = i : delete o.parentId, o;
|
|
1977
|
-
}), s = r && n ?
|
|
1978
|
-
|
|
2157
|
+
}), s = r && n ? Nr(o, n) : o, c = e.starts.get(e.nodeId), l = H.get(e.nodeId), u = r ? [...P.value.filter((e) => e !== n.edge), ...r] : void 0;
|
|
2158
|
+
c && l && !a.size && (l.tx !== c.x || l.ty !== c.y) && P.value.some((e) => e.route && t.has(e.source) && t.has(e.target)) && (u = (u ?? P.value).map((e) => e.route && t.has(e.source) && t.has(e.target) ? {
|
|
2159
|
+
...e,
|
|
2160
|
+
route: Qt(e, l.tx - c.x, l.ty - c.y)
|
|
2161
|
+
} : e)), r && (vt.value = /* @__PURE__ */ new Set()), B({
|
|
1979
2162
|
nodes: s,
|
|
1980
|
-
edges:
|
|
2163
|
+
edges: u
|
|
1981
2164
|
});
|
|
1982
|
-
let
|
|
1983
|
-
|
|
2165
|
+
let d = L.value.get(e.nodeId);
|
|
2166
|
+
d && ve(T.flowMoved.replace("{label}", Xr(d)));
|
|
1984
2167
|
}
|
|
1985
|
-
|
|
1986
|
-
let o = [...e.starts.keys()].map((e) =>
|
|
1987
|
-
n &&
|
|
1988
|
-
node:
|
|
2168
|
+
vt.value = /* @__PURE__ */ new Set(), G.clear();
|
|
2169
|
+
let o = [...e.starts.keys()].map((e) => L.value.get(e)).filter(Boolean);
|
|
2170
|
+
n && C("insert", {
|
|
2171
|
+
node: L.value.get(n.node),
|
|
1989
2172
|
edge: n.edge,
|
|
1990
2173
|
connections: n.connections
|
|
1991
|
-
}),
|
|
2174
|
+
}), C("node-drag-stop", {
|
|
1992
2175
|
nodes: o,
|
|
1993
|
-
intersecting:
|
|
2176
|
+
intersecting: Or(e.nodeId),
|
|
1994
2177
|
event: t
|
|
1995
2178
|
});
|
|
1996
2179
|
}
|
|
1997
|
-
function
|
|
2180
|
+
function Fr(e) {
|
|
1998
2181
|
let t = X;
|
|
1999
2182
|
if (!t || t.kind !== "node" && t.kind !== "connect" || !t.moved) return !1;
|
|
2000
|
-
let n =
|
|
2183
|
+
let n = _n(), r = Q.x - n.left, i = Q.y - n.top, a = r < 40 ? 1 - r / 40 : r > n.width - 40 ? -(1 - (n.width - r) / 40) : 0, o = i < 40 ? 1 - i / 40 : i > n.height - 40 ? -(1 - (n.height - i) / 40) : 0;
|
|
2001
2184
|
if (!a && !o) return !1;
|
|
2002
2185
|
let s = Math.max(-1, Math.min(1, a)) * 600 * e, c = Math.max(-1, Math.min(1, o)) * 600 * e;
|
|
2003
|
-
return
|
|
2186
|
+
return mn({
|
|
2004
2187
|
x: J.value.x + s,
|
|
2005
2188
|
y: J.value.y + c,
|
|
2006
2189
|
zoom: J.value.zoom
|
|
2007
|
-
}), t.kind === "node" ? (t.sx += s, t.sy += c,
|
|
2190
|
+
}), t.kind === "node" ? (t.sx += s, t.sy += c, Er(t, Q.x, Q.y)) : qr(t, Q.x, Q.y), !0;
|
|
2008
2191
|
}
|
|
2009
|
-
function
|
|
2010
|
-
let i =
|
|
2192
|
+
function Ir(e, t, n, r) {
|
|
2193
|
+
let i = Ht(t, r, n);
|
|
2011
2194
|
i && (X = {
|
|
2012
2195
|
kind: "connect",
|
|
2013
2196
|
id: e.pointerId,
|
|
@@ -2016,6 +2199,12 @@ var N = [
|
|
|
2016
2199
|
handleId: n,
|
|
2017
2200
|
type: r
|
|
2018
2201
|
},
|
|
2202
|
+
tap: {
|
|
2203
|
+
x: e.clientX,
|
|
2204
|
+
y: e.clientY,
|
|
2205
|
+
touch: e.pointerType === "touch",
|
|
2206
|
+
nodeId: t
|
|
2207
|
+
},
|
|
2019
2208
|
moved: !1
|
|
2020
2209
|
}, $.value = {
|
|
2021
2210
|
from: i,
|
|
@@ -2025,17 +2214,20 @@ var N = [
|
|
|
2025
2214
|
},
|
|
2026
2215
|
toPosition: null,
|
|
2027
2216
|
type: r,
|
|
2028
|
-
edgeType:
|
|
2029
|
-
}, Q.x = e.clientX, Q.y = e.clientY,
|
|
2217
|
+
edgeType: q({ ...S.defaultEdgeOptions })
|
|
2218
|
+
}, Q.x = e.clientX, Q.y = e.clientY, C("connect-start", {
|
|
2030
2219
|
nodeId: t,
|
|
2031
2220
|
handleId: n,
|
|
2032
2221
|
type: r
|
|
2033
|
-
}),
|
|
2222
|
+
}), $n());
|
|
2034
2223
|
}
|
|
2035
|
-
function
|
|
2036
|
-
let r =
|
|
2224
|
+
function Lr(e, t, n) {
|
|
2225
|
+
let r = Ht(t.source, "source", t.sourceHandle);
|
|
2037
2226
|
if (!r) return;
|
|
2038
|
-
let i = t.sourceHandle ?? null, a = {
|
|
2227
|
+
let i = t.sourceHandle ?? null, { direction: a, segment: o, ...s } = Rr(t, vn({
|
|
2228
|
+
x: e.sx,
|
|
2229
|
+
y: e.sy
|
|
2230
|
+
})), c = {
|
|
2039
2231
|
kind: "connect",
|
|
2040
2232
|
id: e.id,
|
|
2041
2233
|
from: {
|
|
@@ -2043,30 +2235,106 @@ var N = [
|
|
|
2043
2235
|
handleId: i,
|
|
2044
2236
|
type: "source"
|
|
2045
2237
|
},
|
|
2238
|
+
branch: {
|
|
2239
|
+
edge: t,
|
|
2240
|
+
at: s,
|
|
2241
|
+
direction: a,
|
|
2242
|
+
segment: o
|
|
2243
|
+
},
|
|
2046
2244
|
moved: !0
|
|
2047
2245
|
};
|
|
2048
|
-
X =
|
|
2049
|
-
let o = rn({
|
|
2050
|
-
x: e.sx,
|
|
2051
|
-
y: e.sy
|
|
2052
|
-
});
|
|
2053
|
-
$.value = {
|
|
2246
|
+
X = c, $.value = {
|
|
2054
2247
|
from: {
|
|
2055
|
-
x:
|
|
2056
|
-
y:
|
|
2248
|
+
x: s.x,
|
|
2249
|
+
y: s.y,
|
|
2057
2250
|
position: r.position
|
|
2058
2251
|
},
|
|
2059
|
-
to:
|
|
2252
|
+
to: s,
|
|
2060
2253
|
toPosition: null,
|
|
2061
2254
|
type: "source",
|
|
2062
|
-
edgeType:
|
|
2063
|
-
},
|
|
2255
|
+
edgeType: q(t)
|
|
2256
|
+
}, C("connect-start", {
|
|
2064
2257
|
nodeId: t.source,
|
|
2065
2258
|
handleId: i,
|
|
2066
2259
|
type: "source"
|
|
2067
|
-
}),
|
|
2260
|
+
}), qr(c, n.clientX, n.clientY), Et();
|
|
2261
|
+
}
|
|
2262
|
+
function Rr(e, t) {
|
|
2263
|
+
let n = en(e);
|
|
2264
|
+
if (!n) return {
|
|
2265
|
+
...t,
|
|
2266
|
+
direction: "right",
|
|
2267
|
+
segment: 0
|
|
2268
|
+
};
|
|
2269
|
+
let r = tn(e) ?? d(q(e), n), i = {
|
|
2270
|
+
x: t.x,
|
|
2271
|
+
y: t.y,
|
|
2272
|
+
d: Infinity,
|
|
2273
|
+
a: r[0],
|
|
2274
|
+
b: r[0],
|
|
2275
|
+
i: 0
|
|
2276
|
+
};
|
|
2277
|
+
for (let e = 1; e < r.length; e++) {
|
|
2278
|
+
let [n, a] = r[e - 1], [o, s] = r[e], c = o - n, l = s - a, u = c * c + l * l, d = u ? Math.max(0, Math.min(1, ((t.x - n) * c + (t.y - a) * l) / u)) : 0, f = n + d * c, p = a + d * l, m = Math.hypot(f - t.x, p - t.y);
|
|
2279
|
+
m < i.d && (i = {
|
|
2280
|
+
x: f,
|
|
2281
|
+
y: p,
|
|
2282
|
+
d: m,
|
|
2283
|
+
a: r[e - 1],
|
|
2284
|
+
b: r[e],
|
|
2285
|
+
i: e - 1
|
|
2286
|
+
});
|
|
2287
|
+
}
|
|
2288
|
+
let { x: a, y: o } = i, s = S.gridSize || 20;
|
|
2289
|
+
if (S.snapToGrid) {
|
|
2290
|
+
let e = (e, t, n) => Math.max(Math.min(t, n), Math.min(Math.max(t, n), e));
|
|
2291
|
+
Math.abs(i.a[1] - i.b[1]) < .01 ? a = e(Math.round(a / s) * s, i.a[0], i.b[0]) : Math.abs(i.a[0] - i.b[0]) < .01 && (o = e(Math.round(o / s) * s, i.a[1], i.b[1]));
|
|
2292
|
+
}
|
|
2293
|
+
let c = i.b[0] - i.a[0], l = i.b[1] - i.a[1];
|
|
2294
|
+
return {
|
|
2295
|
+
x: a,
|
|
2296
|
+
y: o,
|
|
2297
|
+
direction: Math.abs(c) >= Math.abs(l) ? c >= 0 ? "right" : "left" : l >= 0 ? "bottom" : "top",
|
|
2298
|
+
segment: i.i
|
|
2299
|
+
};
|
|
2068
2300
|
}
|
|
2069
|
-
function
|
|
2301
|
+
function zr(e, t = {}) {
|
|
2302
|
+
let n = t.radius ?? 8, r = null;
|
|
2303
|
+
for (let i of sn.value) {
|
|
2304
|
+
if (t.ignore?.(i)) continue;
|
|
2305
|
+
let a = en(i);
|
|
2306
|
+
if (!a) continue;
|
|
2307
|
+
let o = l(e.x, e.y, tn(i) ?? d(q(i), a));
|
|
2308
|
+
o <= n && (!r || o < r.d) && (r = {
|
|
2309
|
+
edge: i,
|
|
2310
|
+
d: o
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
if (!r) return null;
|
|
2314
|
+
let { direction: i, segment: a, ...o } = Rr(r.edge, e);
|
|
2315
|
+
return {
|
|
2316
|
+
edge: r.edge,
|
|
2317
|
+
position: o,
|
|
2318
|
+
direction: i,
|
|
2319
|
+
routes: Br(r.edge, o, a, i)
|
|
2320
|
+
};
|
|
2321
|
+
}
|
|
2322
|
+
function Br(e, t, n, r) {
|
|
2323
|
+
let i = tn(e), a = $t(e);
|
|
2324
|
+
if (!i || !a || !e.route) return;
|
|
2325
|
+
let o = [t.x, t.y], s = Vr[r];
|
|
2326
|
+
return {
|
|
2327
|
+
before: c([...i.slice(0, n + 1), o], a.s.position, s),
|
|
2328
|
+
after: c([o, ...i.slice(n + 1)], r, a.t.position)
|
|
2329
|
+
};
|
|
2330
|
+
}
|
|
2331
|
+
let Vr = {
|
|
2332
|
+
top: "bottom",
|
|
2333
|
+
bottom: "top",
|
|
2334
|
+
left: "right",
|
|
2335
|
+
right: "left"
|
|
2336
|
+
};
|
|
2337
|
+
function Hr(e, t, n) {
|
|
2070
2338
|
let r = n === "target" ? {
|
|
2071
2339
|
nodeId: t.source,
|
|
2072
2340
|
handleId: t.sourceHandle ?? null,
|
|
@@ -2075,7 +2343,7 @@ var N = [
|
|
|
2075
2343
|
nodeId: t.target,
|
|
2076
2344
|
handleId: t.targetHandle ?? null,
|
|
2077
2345
|
type: "target"
|
|
2078
|
-
}, i =
|
|
2346
|
+
}, i = Ht(r.nodeId, r.type, r.handleId);
|
|
2079
2347
|
if (!i) return;
|
|
2080
2348
|
X = {
|
|
2081
2349
|
kind: "connect",
|
|
@@ -2087,7 +2355,7 @@ var N = [
|
|
|
2087
2355
|
},
|
|
2088
2356
|
moved: !1
|
|
2089
2357
|
};
|
|
2090
|
-
let a =
|
|
2358
|
+
let a = vn({
|
|
2091
2359
|
x: e.clientX,
|
|
2092
2360
|
y: e.clientY
|
|
2093
2361
|
});
|
|
@@ -2096,11 +2364,11 @@ var N = [
|
|
|
2096
2364
|
to: a,
|
|
2097
2365
|
toPosition: null,
|
|
2098
2366
|
type: r.type,
|
|
2099
|
-
edgeType:
|
|
2100
|
-
}, Q.x = e.clientX, Q.y = e.clientY,
|
|
2367
|
+
edgeType: q(t)
|
|
2368
|
+
}, Q.x = e.clientX, Q.y = e.clientY, $n();
|
|
2101
2369
|
}
|
|
2102
|
-
let
|
|
2103
|
-
function
|
|
2370
|
+
let Ur = (e, t) => `${e}:${t.id ?? ""}:${t.type}`;
|
|
2371
|
+
function Wr(e, t, n) {
|
|
2104
2372
|
return e.type === "source" ? {
|
|
2105
2373
|
source: e.nodeId,
|
|
2106
2374
|
sourceHandle: e.handleId,
|
|
@@ -2113,18 +2381,18 @@ var N = [
|
|
|
2113
2381
|
targetHandle: e.handleId
|
|
2114
2382
|
};
|
|
2115
2383
|
}
|
|
2116
|
-
function
|
|
2117
|
-
return e.source === e.target ||
|
|
2384
|
+
function Gr(e, t) {
|
|
2385
|
+
return e.source === e.target || P.value.some((n) => n !== t && n.source === e.source && n.target === e.target && (n.sourceHandle ?? null) === e.sourceHandle && (n.targetHandle ?? null) === e.targetHandle) ? !1 : !S.isValidConnection || S.isValidConnection(e);
|
|
2118
2386
|
}
|
|
2119
|
-
let
|
|
2120
|
-
function
|
|
2121
|
-
let r =
|
|
2387
|
+
let Kr = null;
|
|
2388
|
+
function qr(e, t, n) {
|
|
2389
|
+
let r = vn({
|
|
2122
2390
|
x: t,
|
|
2123
2391
|
y: n
|
|
2124
|
-
}), i = e.from.type === "source" ? "target" : "source", a =
|
|
2125
|
-
for (let e of
|
|
2392
|
+
}), i = e.from.type === "source" ? "target" : "source", a = S.connectionRadius / J.value.zoom, o = null;
|
|
2393
|
+
for (let e of rn.value) {
|
|
2126
2394
|
if (e.connectable === !1) continue;
|
|
2127
|
-
let t =
|
|
2395
|
+
let t = W(e.id), n = K(e.id), s = r.x >= t.x && r.x <= t.x + n.width && r.y >= t.y && r.y <= t.y + n.height, c = (kt.get(e.id) ?? []).filter((e) => e.type === i && e.connectable);
|
|
2128
2396
|
if (c.length) for (let n of c) {
|
|
2129
2397
|
let i = t.x + n.x, c = t.y + n.y, l = Math.hypot(i - r.x, c - r.y);
|
|
2130
2398
|
(l <= a || s) && (!o || l < o.d) && (o = {
|
|
@@ -2137,7 +2405,7 @@ var N = [
|
|
|
2137
2405
|
});
|
|
2138
2406
|
}
|
|
2139
2407
|
else if (s) {
|
|
2140
|
-
let t =
|
|
2408
|
+
let t = Lt(e)[i], n = Rt(e.id, t), a = Math.hypot(n.x - r.x, n.y - r.y);
|
|
2141
2409
|
(!o || a < o.d) && (o = {
|
|
2142
2410
|
nodeId: e.id,
|
|
2143
2411
|
h: null,
|
|
@@ -2151,13 +2419,13 @@ var N = [
|
|
|
2151
2419
|
o && o.nodeId === e.from.nodeId && (o = null);
|
|
2152
2420
|
let s = $.value;
|
|
2153
2421
|
if (o) {
|
|
2154
|
-
let t =
|
|
2155
|
-
|
|
2422
|
+
let t = Gr(Wr(e.from, o.nodeId, o.h?.id ?? null), e.reconnect?.edge);
|
|
2423
|
+
Kr = {
|
|
2156
2424
|
nodeId: o.nodeId,
|
|
2157
2425
|
handleId: o.h?.id ?? null,
|
|
2158
2426
|
valid: t
|
|
2159
|
-
},
|
|
2160
|
-
key:
|
|
2427
|
+
}, Jn.value = {
|
|
2428
|
+
key: Ur(o.nodeId, {
|
|
2161
2429
|
id: o.h?.id ?? null,
|
|
2162
2430
|
type: i
|
|
2163
2431
|
}),
|
|
@@ -2170,123 +2438,149 @@ var N = [
|
|
|
2170
2438
|
} : r,
|
|
2171
2439
|
toPosition: t ? o.position : null
|
|
2172
2440
|
};
|
|
2173
|
-
} else
|
|
2441
|
+
} else Kr = null, Jn.value = null, $.value = {
|
|
2174
2442
|
...s,
|
|
2175
2443
|
to: r,
|
|
2176
2444
|
toPosition: null
|
|
2177
2445
|
};
|
|
2178
2446
|
}
|
|
2179
|
-
function
|
|
2180
|
-
let n =
|
|
2181
|
-
|
|
2182
|
-
let r =
|
|
2447
|
+
function Jr(e, t) {
|
|
2448
|
+
let n = Kr;
|
|
2449
|
+
Kr = null, $.value = null, Jn.value = null;
|
|
2450
|
+
let r = vn({
|
|
2183
2451
|
x: t.clientX,
|
|
2184
2452
|
y: t.clientY
|
|
2185
|
-
}), i =
|
|
2453
|
+
}), i = e.tap;
|
|
2454
|
+
if (i && Math.hypot(t.clientX - i.x, t.clientY - i.y) < (i.touch ? 6 : 4)) {
|
|
2455
|
+
let n = L.value.get(i.nodeId);
|
|
2456
|
+
n && z.value && n.selectable !== !1 && R({
|
|
2457
|
+
nodes: [n.id],
|
|
2458
|
+
edges: []
|
|
2459
|
+
}), n && C("node-click", n, t), C("connect-end", {
|
|
2460
|
+
connection: null,
|
|
2461
|
+
position: r,
|
|
2462
|
+
from: e.from
|
|
2463
|
+
});
|
|
2464
|
+
return;
|
|
2465
|
+
}
|
|
2466
|
+
let a = n?.valid ? Wr(e.from, n.nodeId, n.handleId) : null;
|
|
2186
2467
|
if (e.reconnect) {
|
|
2187
2468
|
let t = e.reconnect.edge;
|
|
2188
|
-
|
|
2469
|
+
a ? (C("reconnect", {
|
|
2189
2470
|
edge: t,
|
|
2190
|
-
connection:
|
|
2191
|
-
}),
|
|
2192
|
-
source:
|
|
2193
|
-
target:
|
|
2194
|
-
sourceHandle:
|
|
2195
|
-
targetHandle:
|
|
2196
|
-
|
|
2471
|
+
connection: a
|
|
2472
|
+
}), S.autoConnect && Nn(t.id, {
|
|
2473
|
+
source: a.source,
|
|
2474
|
+
target: a.target,
|
|
2475
|
+
sourceHandle: a.sourceHandle,
|
|
2476
|
+
targetHandle: a.targetHandle,
|
|
2477
|
+
route: void 0,
|
|
2478
|
+
[e.reconnect.end === "source" ? "sourcePosition" : "targetPosition"]: void 0
|
|
2479
|
+
})) : e.moved && !n && t.deletable !== !1 && Pn({ edges: [t.id] });
|
|
2197
2480
|
return;
|
|
2198
2481
|
}
|
|
2199
|
-
if (
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2482
|
+
if (e.branch) {
|
|
2483
|
+
let t = e.branch;
|
|
2484
|
+
if (C("branch", {
|
|
2485
|
+
edge: t.edge,
|
|
2486
|
+
connection: a,
|
|
2487
|
+
position: t.at,
|
|
2488
|
+
direction: t.direction,
|
|
2489
|
+
end: r,
|
|
2490
|
+
routes: Br(t.edge, t.at, t.segment, t.direction)
|
|
2491
|
+
}), S.edgeBranching === "junction") return;
|
|
2492
|
+
}
|
|
2493
|
+
if (a && (C("connect", a), S.autoConnect)) {
|
|
2494
|
+
An({
|
|
2495
|
+
...S.defaultEdgeOptions,
|
|
2496
|
+
id: ye("edge"),
|
|
2497
|
+
...a
|
|
2204
2498
|
});
|
|
2205
|
-
let e =
|
|
2206
|
-
e && t &&
|
|
2499
|
+
let e = L.value.get(a.source), t = L.value.get(a.target);
|
|
2500
|
+
e && t && ve(T.flowConnected.replace("{source}", Xr(e)).replace("{target}", Xr(t)));
|
|
2207
2501
|
}
|
|
2208
|
-
|
|
2209
|
-
connection:
|
|
2502
|
+
C("connect-end", {
|
|
2503
|
+
connection: a,
|
|
2210
2504
|
position: r,
|
|
2211
2505
|
from: e.from
|
|
2212
2506
|
});
|
|
2213
2507
|
}
|
|
2214
|
-
let
|
|
2508
|
+
let Yr = _(() => {
|
|
2215
2509
|
let e = $.value;
|
|
2216
2510
|
if (!e) return "";
|
|
2217
|
-
let t = e.type === "target", n =
|
|
2511
|
+
let t = e.type === "target", n = {
|
|
2218
2512
|
top: "bottom",
|
|
2219
2513
|
bottom: "top",
|
|
2220
2514
|
left: "right",
|
|
2221
2515
|
right: "left"
|
|
2222
|
-
}
|
|
2516
|
+
}, r = Bt(e.from.position, e.from, e.to, e.type), i = e.toPosition && e.toPosition !== "auto" ? e.toPosition : e.toPosition === "auto" ? zt(e.to, e.from) : n[r], a = t ? {
|
|
2223
2517
|
sourceX: e.to.x,
|
|
2224
2518
|
sourceY: e.to.y,
|
|
2225
|
-
sourcePosition:
|
|
2519
|
+
sourcePosition: i,
|
|
2226
2520
|
targetX: e.from.x,
|
|
2227
2521
|
targetY: e.from.y,
|
|
2228
|
-
targetPosition:
|
|
2522
|
+
targetPosition: r
|
|
2229
2523
|
} : {
|
|
2230
2524
|
sourceX: e.from.x,
|
|
2231
2525
|
sourceY: e.from.y,
|
|
2232
|
-
sourcePosition:
|
|
2526
|
+
sourcePosition: r,
|
|
2233
2527
|
targetX: e.to.x,
|
|
2234
2528
|
targetY: e.to.y,
|
|
2235
|
-
targetPosition:
|
|
2529
|
+
targetPosition: i
|
|
2236
2530
|
};
|
|
2237
|
-
return
|
|
2238
|
-
}),
|
|
2239
|
-
function
|
|
2531
|
+
return Wt(e.edgeType, a).path;
|
|
2532
|
+
}), Xr = (e) => String(e.data?.label ?? e.id);
|
|
2533
|
+
function Zr(e) {
|
|
2240
2534
|
return !!e?.closest?.("input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])");
|
|
2241
2535
|
}
|
|
2242
|
-
function
|
|
2243
|
-
if (
|
|
2536
|
+
function Qr(e) {
|
|
2537
|
+
if (Zr(e.target)) return;
|
|
2244
2538
|
let t = e.ctrlKey || e.metaKey, n = e.key.toLowerCase();
|
|
2245
2539
|
if (e.key === "Escape") {
|
|
2246
|
-
if (X)
|
|
2247
|
-
else if (
|
|
2540
|
+
if (X) mr();
|
|
2541
|
+
else if (F.value.nodes.length || F.value.edges.length) R(lt());
|
|
2248
2542
|
else return;
|
|
2249
2543
|
e.preventDefault(), e.stopPropagation();
|
|
2250
2544
|
return;
|
|
2251
2545
|
}
|
|
2252
2546
|
if (t && n === "z" && !e.shiftKey) {
|
|
2253
|
-
e.preventDefault(),
|
|
2547
|
+
e.preventDefault(), mt();
|
|
2254
2548
|
return;
|
|
2255
2549
|
}
|
|
2256
2550
|
if (t && (n === "z" && e.shiftKey || n === "y")) {
|
|
2257
|
-
e.preventDefault(),
|
|
2551
|
+
e.preventDefault(), ht();
|
|
2258
2552
|
return;
|
|
2259
2553
|
}
|
|
2260
2554
|
if (t && n === "a") {
|
|
2261
|
-
e.preventDefault(),
|
|
2555
|
+
e.preventDefault(), Ln();
|
|
2262
2556
|
return;
|
|
2263
2557
|
}
|
|
2264
2558
|
if (t && n === "c") {
|
|
2265
|
-
|
|
2559
|
+
Rn();
|
|
2266
2560
|
return;
|
|
2267
2561
|
}
|
|
2268
2562
|
if (t && n === "x") {
|
|
2269
|
-
e.preventDefault(),
|
|
2563
|
+
e.preventDefault(), zn();
|
|
2270
2564
|
return;
|
|
2271
2565
|
}
|
|
2272
2566
|
if (t && n === "v") {
|
|
2273
|
-
e.preventDefault(),
|
|
2567
|
+
e.preventDefault(), Bn(Q.inside ? vn(Q) : void 0);
|
|
2274
2568
|
return;
|
|
2275
2569
|
}
|
|
2276
|
-
if (
|
|
2277
|
-
e.preventDefault(),
|
|
2570
|
+
if (S.deleteKeys?.includes(e.key)) {
|
|
2571
|
+
e.preventDefault(), In();
|
|
2278
2572
|
return;
|
|
2279
2573
|
}
|
|
2280
2574
|
if (!t && (e.key === "+" || e.key === "=")) {
|
|
2281
|
-
e.preventDefault(),
|
|
2575
|
+
e.preventDefault(), Sn();
|
|
2282
2576
|
return;
|
|
2283
2577
|
}
|
|
2284
2578
|
if (!t && (e.key === "-" || e.key === "_")) {
|
|
2285
|
-
e.preventDefault(),
|
|
2579
|
+
e.preventDefault(), Cn();
|
|
2286
2580
|
return;
|
|
2287
2581
|
}
|
|
2288
2582
|
if (e.key === "!" || e.shiftKey && e.code === "Digit1") {
|
|
2289
|
-
e.preventDefault(),
|
|
2583
|
+
e.preventDefault(), Dn();
|
|
2290
2584
|
return;
|
|
2291
2585
|
}
|
|
2292
2586
|
let r = {
|
|
@@ -2295,39 +2589,39 @@ var N = [
|
|
|
2295
2589
|
ArrowUp: [0, -1],
|
|
2296
2590
|
ArrowDown: [0, 1]
|
|
2297
2591
|
}[e.key];
|
|
2298
|
-
if (r &&
|
|
2592
|
+
if (r && F.value.nodes.length && Ie.value) {
|
|
2299
2593
|
e.preventDefault();
|
|
2300
|
-
let t =
|
|
2594
|
+
let t = S.snapToGrid ? S.gridSize : e.shiftKey ? 50 : 10, n = F.value.nodes, i = new Set(n.filter((e) => L.value.get(e)?.draggable !== !1 && !Ee(e).some((e) => n.includes(e))));
|
|
2301
2595
|
if (!i.size) return;
|
|
2302
|
-
|
|
2596
|
+
yt = !0, B({ nodes: N.value.map((e) => i.has(e.id) ? {
|
|
2303
2597
|
...e,
|
|
2304
2598
|
position: {
|
|
2305
2599
|
x: e.position.x + r[0] * t,
|
|
2306
2600
|
y: e.position.y + r[1] * t
|
|
2307
2601
|
}
|
|
2308
2602
|
} : e) }, { coalesce: `move:${[...i].join(",")}` });
|
|
2309
|
-
let a =
|
|
2310
|
-
a &&
|
|
2311
|
-
} else r && !
|
|
2603
|
+
let a = L.value.get([...i][0]);
|
|
2604
|
+
a && ve(T.flowMoved.replace("{label}", Xr(a)));
|
|
2605
|
+
} else r && !F.value.nodes.length && (e.preventDefault(), mn({
|
|
2312
2606
|
x: J.value.x - r[0] * 40,
|
|
2313
2607
|
y: J.value.y - r[1] * 40,
|
|
2314
2608
|
zoom: J.value.zoom
|
|
2315
2609
|
}));
|
|
2316
2610
|
}
|
|
2317
|
-
function
|
|
2318
|
-
|
|
2611
|
+
function $r(e, t) {
|
|
2612
|
+
Zr(e.target) || e.target.dataset.flowNode !== t || (e.key === "Enter" || e.key === " ") && z.value && (e.preventDefault(), e.shiftKey ? R({ nodes: je.value.has(t) ? F.value.nodes.filter((e) => e !== t) : [...F.value.nodes, t] }) : R({
|
|
2319
2613
|
nodes: [t],
|
|
2320
2614
|
edges: []
|
|
2321
2615
|
}));
|
|
2322
2616
|
}
|
|
2323
|
-
function
|
|
2324
|
-
(e.key === "Enter" || e.key === " ") &&
|
|
2617
|
+
function ei(e, t) {
|
|
2618
|
+
(e.key === "Enter" || e.key === " ") && z.value && (e.preventDefault(), R({
|
|
2325
2619
|
nodes: [],
|
|
2326
2620
|
edges: [t]
|
|
2327
2621
|
}));
|
|
2328
2622
|
}
|
|
2329
|
-
let
|
|
2330
|
-
let e =
|
|
2623
|
+
let ti = `m3-flow-bg-${Math.random().toString(36).slice(2, 8)}`, ni = _(() => {
|
|
2624
|
+
let e = S.gridSize * J.value.zoom;
|
|
2331
2625
|
for (; e < 10;) e *= 2;
|
|
2332
2626
|
return {
|
|
2333
2627
|
gap: e,
|
|
@@ -2335,163 +2629,167 @@ var N = [
|
|
|
2335
2629
|
y: (J.value.y % e + e) % e,
|
|
2336
2630
|
r: Math.max(.6, Math.min(1.4, J.value.zoom))
|
|
2337
2631
|
};
|
|
2338
|
-
}),
|
|
2339
|
-
nodes:
|
|
2340
|
-
edges:
|
|
2632
|
+
}), ri = {
|
|
2633
|
+
nodes: _(() => N.value),
|
|
2634
|
+
edges: _(() => P.value),
|
|
2341
2635
|
viewport: J,
|
|
2342
|
-
minZoom:
|
|
2343
|
-
maxZoom:
|
|
2344
|
-
selection:
|
|
2345
|
-
size:
|
|
2346
|
-
locked:
|
|
2347
|
-
getNode:
|
|
2348
|
-
getAbsolutePosition:
|
|
2349
|
-
getSize:
|
|
2350
|
-
getIntersectingNodes:
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2636
|
+
minZoom: _(() => S.minZoom),
|
|
2637
|
+
maxZoom: _(() => S.maxZoom),
|
|
2638
|
+
selection: _(() => F.value),
|
|
2639
|
+
size: M,
|
|
2640
|
+
locked: I,
|
|
2641
|
+
getNode: we,
|
|
2642
|
+
getAbsolutePosition: W,
|
|
2643
|
+
getSize: K,
|
|
2644
|
+
getIntersectingNodes: Or,
|
|
2645
|
+
getEdgeAt: zr,
|
|
2646
|
+
screenToFlow: vn,
|
|
2647
|
+
flowToScreen: yn,
|
|
2648
|
+
setViewport: hn,
|
|
2649
|
+
fitView: Dn,
|
|
2650
|
+
setCenter: Tn,
|
|
2651
|
+
zoomIn: Sn,
|
|
2652
|
+
zoomOut: Cn,
|
|
2653
|
+
zoomTo: wn,
|
|
2654
|
+
addNodes: kn,
|
|
2655
|
+
change: jn,
|
|
2656
|
+
addEdges: An,
|
|
2657
|
+
updateNode: Mn,
|
|
2658
|
+
updateEdge: Nn,
|
|
2659
|
+
remove: Pn,
|
|
2660
|
+
setSelection: R,
|
|
2661
|
+
layout: (e, t) => Hn(e, t),
|
|
2662
|
+
undo: mt,
|
|
2663
|
+
redo: ht,
|
|
2664
|
+
canUndo: gt,
|
|
2665
|
+
canRedo: _t,
|
|
2666
|
+
copy: Rn,
|
|
2667
|
+
cut: zn,
|
|
2668
|
+
paste: Bn,
|
|
2669
|
+
startDrag: Tr,
|
|
2670
|
+
registerHandle: Ft,
|
|
2671
|
+
measureNode: Pt,
|
|
2672
|
+
startConnection: Ir,
|
|
2673
|
+
connectionTarget: Jn,
|
|
2674
|
+
connecting: Yn,
|
|
2675
|
+
insertEdge: kr,
|
|
2676
|
+
branching: Ne,
|
|
2381
2677
|
nodesConnectable: Le,
|
|
2382
|
-
direction:
|
|
2383
|
-
registerNodeEl:
|
|
2384
|
-
selectedNodes:
|
|
2385
|
-
selectedEdges:
|
|
2386
|
-
dragging:
|
|
2387
|
-
isLifted:
|
|
2388
|
-
zIndexOf:
|
|
2389
|
-
edgeGeometry:
|
|
2390
|
-
isReconnectable:
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2678
|
+
direction: _(() => S.direction),
|
|
2679
|
+
registerNodeEl: It,
|
|
2680
|
+
selectedNodes: je,
|
|
2681
|
+
selectedEdges: Me,
|
|
2682
|
+
dragging: vt,
|
|
2683
|
+
isLifted: cn,
|
|
2684
|
+
zIndexOf: ln,
|
|
2685
|
+
edgeGeometry: en,
|
|
2686
|
+
isReconnectable: fn,
|
|
2687
|
+
isReroutable: nn,
|
|
2688
|
+
edgeCorners: tn,
|
|
2689
|
+
sidePositions: Lt,
|
|
2690
|
+
onNodeKey: $r,
|
|
2691
|
+
onEdgeKey: ei
|
|
2394
2692
|
};
|
|
2395
|
-
re(ge,
|
|
2396
|
-
let
|
|
2693
|
+
re(ge, ri);
|
|
2694
|
+
let ii;
|
|
2397
2695
|
return ne(async () => {
|
|
2398
|
-
let e =
|
|
2399
|
-
e.addEventListener("wheel",
|
|
2696
|
+
let e = D.value;
|
|
2697
|
+
e.addEventListener("wheel", br, { passive: !1 });
|
|
2400
2698
|
let t = new ResizeObserver(() => {
|
|
2401
|
-
|
|
2699
|
+
M.value = {
|
|
2402
2700
|
width: e.clientWidth,
|
|
2403
2701
|
height: e.clientHeight
|
|
2404
2702
|
};
|
|
2405
2703
|
});
|
|
2406
|
-
t.observe(e),
|
|
2704
|
+
t.observe(e), te(() => t.disconnect()), M.value = {
|
|
2407
2705
|
width: e.clientWidth,
|
|
2408
2706
|
height: e.clientHeight
|
|
2409
|
-
},
|
|
2707
|
+
}, ii = new ResizeObserver((e) => {
|
|
2410
2708
|
for (let t of e) {
|
|
2411
2709
|
let e = t.target.dataset.flowNode;
|
|
2412
|
-
e &&
|
|
2710
|
+
e && Mt(e);
|
|
2413
2711
|
}
|
|
2414
2712
|
});
|
|
2415
|
-
for (let [e, t] of
|
|
2416
|
-
await
|
|
2417
|
-
}),
|
|
2418
|
-
|
|
2419
|
-
}),
|
|
2713
|
+
for (let [e, t] of At) ii.observe(t), Mt(e);
|
|
2714
|
+
await E(), S.layout && await Hn(null, void 0, { history: !1 }), await E(), S.fitView && Dn({ animate: !1 }), he.value = !0, C("init", ri);
|
|
2715
|
+
}), te(() => {
|
|
2716
|
+
D.value?.removeEventListener("wheel", br), er(), ii?.disconnect(), U && cancelAnimationFrame(U), clearTimeout(or), document.body.style.userSelect = "";
|
|
2717
|
+
}), p(ri), (e, t) => (k(), b("div", ee({
|
|
2420
2718
|
ref_key: "root",
|
|
2421
|
-
ref:
|
|
2719
|
+
ref: D
|
|
2422
2720
|
}, e.$attrs, {
|
|
2423
|
-
class: ["m3-flow overflow-hidden bg-surface outline-none select-none", [
|
|
2721
|
+
class: ["m3-flow overflow-hidden bg-surface outline-none select-none", [Zn.value && "cursor-grabbing", I.value && "m3-flow-locked"]],
|
|
2424
2722
|
tabindex: "0",
|
|
2425
2723
|
role: "application",
|
|
2426
|
-
"aria-label": n.label ??
|
|
2724
|
+
"aria-label": n.label ?? j(T).flowCanvas,
|
|
2427
2725
|
"aria-roledescription": "flow",
|
|
2428
|
-
onPointerdown:
|
|
2726
|
+
onPointerdown: ar,
|
|
2429
2727
|
onPointerenter: t[0] ||= (e) => Q.inside = !0,
|
|
2430
2728
|
onPointerleave: t[1] ||= (e) => Q.inside = !1,
|
|
2431
|
-
onDblclick:
|
|
2432
|
-
onContextmenu:
|
|
2433
|
-
onKeydown:
|
|
2729
|
+
onDblclick: xr,
|
|
2730
|
+
onContextmenu: Sr,
|
|
2731
|
+
onKeydown: Qr
|
|
2434
2732
|
}), [
|
|
2435
|
-
n.background === "none" ?
|
|
2436
|
-
id:
|
|
2437
|
-
x:
|
|
2438
|
-
y:
|
|
2439
|
-
width:
|
|
2440
|
-
height:
|
|
2733
|
+
n.background === "none" ? y("", !0) : (k(), b("svg", qe, [x("defs", null, [x("pattern", {
|
|
2734
|
+
id: ti,
|
|
2735
|
+
x: ni.value.x,
|
|
2736
|
+
y: ni.value.y,
|
|
2737
|
+
width: ni.value.gap,
|
|
2738
|
+
height: ni.value.gap,
|
|
2441
2739
|
patternUnits: "userSpaceOnUse"
|
|
2442
|
-
}, [n.background === "dots" ? (
|
|
2740
|
+
}, [n.background === "dots" ? (k(), b("circle", {
|
|
2443
2741
|
key: 0,
|
|
2444
|
-
cx:
|
|
2445
|
-
cy:
|
|
2446
|
-
r:
|
|
2742
|
+
cx: ni.value.r,
|
|
2743
|
+
cy: ni.value.r,
|
|
2744
|
+
r: ni.value.r,
|
|
2447
2745
|
class: "fill-outline-variant"
|
|
2448
|
-
}, null, 8,
|
|
2746
|
+
}, null, 8, Ye)) : (k(), b("path", {
|
|
2449
2747
|
key: 1,
|
|
2450
|
-
d: `M${
|
|
2748
|
+
d: `M${ni.value.gap} 0 L0 0 0 ${ni.value.gap}`,
|
|
2451
2749
|
fill: "none",
|
|
2452
2750
|
class: "stroke-outline-variant",
|
|
2453
2751
|
"stroke-width": "1"
|
|
2454
|
-
}, null, 8,
|
|
2752
|
+
}, null, 8, Xe))], 8, Je)]), x("rect", {
|
|
2455
2753
|
width: "100%",
|
|
2456
2754
|
height: "100%",
|
|
2457
|
-
fill: `url(#${
|
|
2458
|
-
}, null, 8,
|
|
2459
|
-
|
|
2755
|
+
fill: `url(#${ti})`
|
|
2756
|
+
}, null, 8, Ze)])),
|
|
2757
|
+
x("div", {
|
|
2460
2758
|
ref_key: "layer",
|
|
2461
|
-
ref:
|
|
2759
|
+
ref: fe,
|
|
2462
2760
|
class: "m3-flow-viewport absolute top-0 left-0 origin-top-left",
|
|
2463
|
-
style:
|
|
2761
|
+
style: O({
|
|
2464
2762
|
transform: `translate(${J.value.x}px, ${J.value.y}px) scale(${J.value.zoom})`,
|
|
2465
|
-
visibility:
|
|
2763
|
+
visibility: he.value ? void 0 : "hidden"
|
|
2466
2764
|
})
|
|
2467
2765
|
}, [
|
|
2468
|
-
(
|
|
2766
|
+
(k(!0), b(h, null, ae(an.value, (e) => (k(), v(Pe, {
|
|
2469
2767
|
key: e.id,
|
|
2470
2768
|
node: e,
|
|
2471
|
-
render:
|
|
2769
|
+
render: un(e)
|
|
2472
2770
|
}, null, 8, ["node", "render"]))), 128)),
|
|
2473
|
-
(
|
|
2771
|
+
(k(), b("svg", Qe, [(k(!0), b(h, null, ae(sn.value, (e) => (k(), v(Ve, {
|
|
2474
2772
|
key: e.id,
|
|
2475
2773
|
edge: e,
|
|
2476
|
-
render:
|
|
2477
|
-
}, null, 8, ["edge", "render"]))), 128)), $.value ? (
|
|
2774
|
+
render: dn(e)
|
|
2775
|
+
}, null, 8, ["edge", "render"]))), 128)), $.value ? (k(), b("path", {
|
|
2478
2776
|
key: 0,
|
|
2479
2777
|
class: "m3-flow-connection-line fill-none stroke-primary",
|
|
2480
|
-
d:
|
|
2778
|
+
d: Yr.value,
|
|
2481
2779
|
"stroke-width": "2",
|
|
2482
|
-
"stroke-dasharray":
|
|
2483
|
-
}, null, 8,
|
|
2484
|
-
|
|
2780
|
+
"stroke-dasharray": Jn.value?.valid ? void 0 : "6 4"
|
|
2781
|
+
}, null, 8, $e)) : y("", !0)])),
|
|
2782
|
+
x("div", et, [(k(!0), b(h, null, ae(sn.value, (t) => (k(), b(h, { key: t.id }, [t.label || e.$slots["edge-label"] || Me.value.has(t.id) ? (k(), v(Ge, {
|
|
2485
2783
|
key: 0,
|
|
2486
2784
|
edge: t,
|
|
2487
2785
|
render: e.$slots["edge-label"]
|
|
2488
|
-
}, null, 8, ["edge", "render"])) :
|
|
2489
|
-
(
|
|
2786
|
+
}, null, 8, ["edge", "render"])) : y("", !0)], 64))), 128))]),
|
|
2787
|
+
(k(!0), b(h, null, ae(on.value, (e) => (k(), v(Pe, {
|
|
2490
2788
|
key: e.id,
|
|
2491
2789
|
node: e,
|
|
2492
|
-
render:
|
|
2790
|
+
render: un(e)
|
|
2493
2791
|
}, null, 8, ["node", "render"]))), 128)),
|
|
2494
|
-
|
|
2792
|
+
Xn.value.length ? (k(), b("svg", tt, [(k(!0), b(h, null, ae(Xn.value, (e, t) => (k(), b("line", {
|
|
2495
2793
|
key: t,
|
|
2496
2794
|
class: "stroke-primary",
|
|
2497
2795
|
"stroke-width": "1",
|
|
@@ -2500,24 +2798,24 @@ var N = [
|
|
|
2500
2798
|
x2: e.x ?? e.to,
|
|
2501
2799
|
y1: e.y ?? e.from,
|
|
2502
2800
|
y2: e.y ?? e.to
|
|
2503
|
-
}, null, 8,
|
|
2801
|
+
}, null, 8, nt))), 128))])) : y("", !0)
|
|
2504
2802
|
], 4),
|
|
2505
|
-
|
|
2803
|
+
qn.value ? (k(), b("div", {
|
|
2506
2804
|
key: 1,
|
|
2507
2805
|
class: "m3-flow-marquee pointer-events-none absolute rounded-xs border border-primary bg-primary/8",
|
|
2508
|
-
style:
|
|
2509
|
-
left: `${
|
|
2510
|
-
top: `${
|
|
2511
|
-
width: `${
|
|
2512
|
-
height: `${
|
|
2806
|
+
style: O({
|
|
2807
|
+
left: `${qn.value.x}px`,
|
|
2808
|
+
top: `${qn.value.y}px`,
|
|
2809
|
+
width: `${qn.value.width}px`,
|
|
2810
|
+
height: `${qn.value.height}px`
|
|
2513
2811
|
})
|
|
2514
|
-
}, null, 4)) :
|
|
2515
|
-
!
|
|
2516
|
-
oe(e.$slots, "default", { flow:
|
|
2517
|
-
|
|
2518
|
-
], 16,
|
|
2812
|
+
}, null, 4)) : y("", !0),
|
|
2813
|
+
!N.value.length && e.$slots.empty ? (k(), b("div", rt, [x("div", it, [oe(e.$slots, "empty")])])) : y("", !0),
|
|
2814
|
+
oe(e.$slots, "default", { flow: ri }),
|
|
2815
|
+
x("div", at, le(_e.value), 1)
|
|
2816
|
+
], 16, Ke));
|
|
2519
2817
|
}
|
|
2520
|
-
}),
|
|
2818
|
+
}), dt = {
|
|
2521
2819
|
"top-left": "top-0 left-0",
|
|
2522
2820
|
"top-center": "top-0 left-1/2 -translate-x-1/2",
|
|
2523
2821
|
"top-right": "top-0 right-0",
|
|
@@ -2526,7 +2824,7 @@ var N = [
|
|
|
2526
2824
|
"bottom-right": "bottom-0 right-0",
|
|
2527
2825
|
"center-left": "top-1/2 left-0 -translate-y-1/2",
|
|
2528
2826
|
"center-right": "top-1/2 right-0 -translate-y-1/2"
|
|
2529
|
-
},
|
|
2827
|
+
}, ft = ["aria-orientation"], B = /* @__PURE__ */ w({
|
|
2530
2828
|
__name: "MFlowControls",
|
|
2531
2829
|
props: {
|
|
2532
2830
|
position: { default: "bottom-left" },
|
|
@@ -2553,82 +2851,82 @@ var N = [
|
|
|
2553
2851
|
}
|
|
2554
2852
|
},
|
|
2555
2853
|
setup(t) {
|
|
2556
|
-
let r = t, i = ve(), a = e(), o =
|
|
2854
|
+
let r = t, i = ve(), a = e(), o = _(() => r.orientation === "vertical"), s = _(() => {
|
|
2557
2855
|
let e = i.selection.value;
|
|
2558
2856
|
return {
|
|
2559
2857
|
nodes: e.nodes.filter((e) => i.getNode(e)?.deletable !== !1),
|
|
2560
2858
|
edges: e.edges.filter((e) => i.edges.value.find((t) => t.id === e)?.deletable !== !1)
|
|
2561
2859
|
};
|
|
2562
|
-
}), c =
|
|
2563
|
-
return (e, r) => (
|
|
2564
|
-
class:
|
|
2860
|
+
}), c = _(() => r.delete && !i.locked.value && s.value.nodes.length + s.value.edges.length > 0);
|
|
2861
|
+
return (e, r) => (k(), b("div", {
|
|
2862
|
+
class: D(["m3-flow-controls absolute z-20 m-4 flex gap-1 rounded-full bg-surface-container p-1 shadow-elevation-3", [j(dt)[t.position], o.value ? "flex-col" : "flex-row"]]),
|
|
2565
2863
|
role: "toolbar",
|
|
2566
2864
|
"aria-orientation": t.orientation
|
|
2567
2865
|
}, [
|
|
2568
|
-
t.zoom ? (
|
|
2866
|
+
t.zoom ? (k(), b(h, { key: 0 }, [C(n, {
|
|
2569
2867
|
icon: "add",
|
|
2570
|
-
label:
|
|
2571
|
-
disabled:
|
|
2572
|
-
onClick: r[0] ||= (e) =>
|
|
2573
|
-
}, null, 8, ["label", "disabled"]),
|
|
2868
|
+
label: j(a).flowZoomIn,
|
|
2869
|
+
disabled: j(i).viewport.value.zoom >= j(i).maxZoom.value - .001,
|
|
2870
|
+
onClick: r[0] ||= (e) => j(i).zoomIn()
|
|
2871
|
+
}, null, 8, ["label", "disabled"]), C(n, {
|
|
2574
2872
|
icon: "remove",
|
|
2575
|
-
label:
|
|
2576
|
-
disabled:
|
|
2577
|
-
onClick: r[1] ||= (e) =>
|
|
2578
|
-
}, null, 8, ["label", "disabled"])], 64)) :
|
|
2579
|
-
t.fit ? (
|
|
2873
|
+
label: j(a).flowZoomOut,
|
|
2874
|
+
disabled: j(i).viewport.value.zoom <= j(i).minZoom.value + .001,
|
|
2875
|
+
onClick: r[1] ||= (e) => j(i).zoomOut()
|
|
2876
|
+
}, null, 8, ["label", "disabled"])], 64)) : y("", !0),
|
|
2877
|
+
t.fit ? (k(), v(n, {
|
|
2580
2878
|
key: 1,
|
|
2581
2879
|
icon: "fit_screen",
|
|
2582
|
-
label:
|
|
2583
|
-
onClick: r[2] ||= (e) =>
|
|
2584
|
-
}, null, 8, ["label"])) :
|
|
2585
|
-
t.history ? (
|
|
2880
|
+
label: j(a).flowFitView,
|
|
2881
|
+
onClick: r[2] ||= (e) => j(i).fitView()
|
|
2882
|
+
}, null, 8, ["label"])) : y("", !0),
|
|
2883
|
+
t.history ? (k(), b(h, { key: 2 }, [C(n, {
|
|
2586
2884
|
icon: "undo",
|
|
2587
|
-
label:
|
|
2588
|
-
disabled: !
|
|
2589
|
-
onClick: r[3] ||= (e) =>
|
|
2590
|
-
}, null, 8, ["label", "disabled"]),
|
|
2885
|
+
label: j(a).flowUndo,
|
|
2886
|
+
disabled: !j(i).canUndo.value,
|
|
2887
|
+
onClick: r[3] ||= (e) => j(i).undo()
|
|
2888
|
+
}, null, 8, ["label", "disabled"]), C(n, {
|
|
2591
2889
|
icon: "redo",
|
|
2592
|
-
label:
|
|
2593
|
-
disabled: !
|
|
2594
|
-
onClick: r[4] ||= (e) =>
|
|
2595
|
-
}, null, 8, ["label", "disabled"])], 64)) :
|
|
2596
|
-
|
|
2597
|
-
default:
|
|
2890
|
+
label: j(a).flowRedo,
|
|
2891
|
+
disabled: !j(i).canRedo.value,
|
|
2892
|
+
onClick: r[4] ||= (e) => j(i).redo()
|
|
2893
|
+
}, null, 8, ["label", "disabled"])], 64)) : y("", !0),
|
|
2894
|
+
C(g, { name: o.value ? "m3-flow-ctl-v" : "m3-flow-ctl-h" }, {
|
|
2895
|
+
default: me(() => [c.value ? (k(), v(n, {
|
|
2598
2896
|
key: 0,
|
|
2599
2897
|
icon: "delete",
|
|
2600
|
-
label:
|
|
2898
|
+
label: j(a).flowDelete,
|
|
2601
2899
|
color: "error",
|
|
2602
|
-
onClick: r[5] ||= (e) =>
|
|
2603
|
-
}, null, 8, ["label"])) :
|
|
2900
|
+
onClick: r[5] ||= (e) => j(i).remove(s.value)
|
|
2901
|
+
}, null, 8, ["label"])) : y("", !0)]),
|
|
2604
2902
|
_: 1
|
|
2605
2903
|
}, 8, ["name"]),
|
|
2606
|
-
t.lock ? (
|
|
2904
|
+
t.lock ? (k(), v(n, {
|
|
2607
2905
|
key: 3,
|
|
2608
|
-
icon:
|
|
2609
|
-
label:
|
|
2610
|
-
onClick: r[6] ||= (e) =>
|
|
2611
|
-
}, null, 8, ["icon", "label"])) :
|
|
2906
|
+
icon: j(i).locked.value ? "lock" : "lock_open",
|
|
2907
|
+
label: j(i).locked.value ? j(a).flowUnlock : j(a).flowLock,
|
|
2908
|
+
onClick: r[6] ||= (e) => j(i).locked.value = !j(i).locked.value
|
|
2909
|
+
}, null, 8, ["icon", "label"])) : y("", !0),
|
|
2612
2910
|
oe(e.$slots, "default")
|
|
2613
|
-
], 10,
|
|
2911
|
+
], 10, ft));
|
|
2614
2912
|
}
|
|
2615
|
-
}),
|
|
2913
|
+
}), pt = [
|
|
2616
2914
|
"width",
|
|
2617
2915
|
"height",
|
|
2618
2916
|
"viewBox",
|
|
2619
2917
|
"aria-label"
|
|
2620
|
-
],
|
|
2918
|
+
], mt = [
|
|
2621
2919
|
"x",
|
|
2622
2920
|
"y",
|
|
2623
2921
|
"width",
|
|
2624
2922
|
"height",
|
|
2625
2923
|
"rx"
|
|
2626
|
-
],
|
|
2924
|
+
], ht = ["d"], gt = [
|
|
2627
2925
|
"x",
|
|
2628
2926
|
"y",
|
|
2629
2927
|
"width",
|
|
2630
2928
|
"height"
|
|
2631
|
-
],
|
|
2929
|
+
], _t = /* @__PURE__ */ w({
|
|
2632
2930
|
__name: "MFlowMinimap",
|
|
2633
2931
|
props: {
|
|
2634
2932
|
position: { default: "bottom-right" },
|
|
@@ -2645,11 +2943,11 @@ var N = [
|
|
|
2645
2943
|
}
|
|
2646
2944
|
},
|
|
2647
2945
|
setup(t) {
|
|
2648
|
-
let n = t, r = ve(), i = e(), a =
|
|
2946
|
+
let n = t, r = ve(), i = e(), a = A(), o = _(() => r.nodes.value.filter((e) => !e.hidden).map((e) => ({
|
|
2649
2947
|
node: e,
|
|
2650
2948
|
...r.getAbsolutePosition(e.id),
|
|
2651
2949
|
...r.getSize(e.id)
|
|
2652
|
-
})).filter((e) => e.width > 0 && e.height > 0)), s =
|
|
2950
|
+
})).filter((e) => e.width > 0 && e.height > 0)), s = _(() => {
|
|
2653
2951
|
let e = r.viewport.value, t = r.size.value;
|
|
2654
2952
|
return {
|
|
2655
2953
|
x: -e.x / e.zoom,
|
|
@@ -2657,7 +2955,7 @@ var N = [
|
|
|
2657
2955
|
width: t.width / e.zoom,
|
|
2658
2956
|
height: t.height / e.zoom
|
|
2659
2957
|
};
|
|
2660
|
-
}), c = null, l =
|
|
2958
|
+
}), c = null, l = _(() => {
|
|
2661
2959
|
if (c) return c;
|
|
2662
2960
|
let e = s.value.x, t = s.value.y, r = e + s.value.width, i = t + s.value.height;
|
|
2663
2961
|
for (let n of o.value) e = Math.min(e, n.x), t = Math.min(t, n.y), r = Math.max(r, n.x + n.width), i = Math.max(i, n.y + n.height);
|
|
@@ -2668,7 +2966,7 @@ var N = [
|
|
|
2668
2966
|
width: d,
|
|
2669
2967
|
height: f
|
|
2670
2968
|
};
|
|
2671
|
-
}), u =
|
|
2969
|
+
}), u = _(() => {
|
|
2672
2970
|
let e = l.value, t = s.value;
|
|
2673
2971
|
return `M${e.x},${e.y}h${e.width}v${e.height}h${-e.width}Z M${t.x},${t.y}v${t.height}h${t.width}v${-t.height}Z`;
|
|
2674
2972
|
});
|
|
@@ -2679,57 +2977,57 @@ var N = [
|
|
|
2679
2977
|
y: n.y + (e.clientY - t.top) / t.height * n.height
|
|
2680
2978
|
};
|
|
2681
2979
|
}
|
|
2682
|
-
function
|
|
2980
|
+
function f(e) {
|
|
2683
2981
|
if (!n.pannable) return;
|
|
2684
2982
|
e.preventDefault(), c = { ...l.value }, a.value.setPointerCapture?.(e.pointerId);
|
|
2685
2983
|
let t = d(e);
|
|
2686
2984
|
r.setCenter(t.x, t.y, { animate: !0 });
|
|
2687
2985
|
}
|
|
2688
|
-
function
|
|
2986
|
+
function p(e) {
|
|
2689
2987
|
if (!c) return;
|
|
2690
2988
|
let t = d(e);
|
|
2691
2989
|
r.setCenter(t.x, t.y, { animate: !1 });
|
|
2692
2990
|
}
|
|
2693
|
-
function
|
|
2991
|
+
function m() {
|
|
2694
2992
|
c = null;
|
|
2695
2993
|
}
|
|
2696
|
-
function
|
|
2994
|
+
function g(e) {
|
|
2697
2995
|
n.zoomable && r.zoomTo(r.viewport.value.zoom * Math.exp(-Math.max(-50, Math.min(50, e.deltaY)) * .01), { animate: !1 });
|
|
2698
2996
|
}
|
|
2699
|
-
return (e, n) => (
|
|
2700
|
-
class:
|
|
2701
|
-
onWheel: he(
|
|
2702
|
-
}, [(
|
|
2997
|
+
return (e, n) => (k(), b("div", {
|
|
2998
|
+
class: D(["m3-flow-minimap absolute z-20 m-4 overflow-hidden rounded-lg bg-surface-container shadow-elevation-3", j(dt)[t.position]]),
|
|
2999
|
+
onWheel: he(g, ["stop", "prevent"])
|
|
3000
|
+
}, [(k(), b("svg", {
|
|
2703
3001
|
ref_key: "svg",
|
|
2704
3002
|
ref: a,
|
|
2705
3003
|
width: t.width,
|
|
2706
3004
|
height: t.height,
|
|
2707
3005
|
viewBox: `${l.value.x} ${l.value.y} ${l.value.width} ${l.value.height}`,
|
|
2708
|
-
class:
|
|
3006
|
+
class: D(["block touch-none", t.pannable && "cursor-pointer"]),
|
|
2709
3007
|
role: "img",
|
|
2710
|
-
"aria-label":
|
|
2711
|
-
onPointerdown:
|
|
2712
|
-
onPointermove:
|
|
2713
|
-
onPointerup:
|
|
2714
|
-
onPointercancel:
|
|
3008
|
+
"aria-label": j(i).flowMinimap,
|
|
3009
|
+
onPointerdown: f,
|
|
3010
|
+
onPointermove: p,
|
|
3011
|
+
onPointerup: m,
|
|
3012
|
+
onPointercancel: m
|
|
2715
3013
|
}, [
|
|
2716
|
-
(
|
|
3014
|
+
(k(!0), b(h, null, ae(o.value, (e) => (k(), b("rect", {
|
|
2717
3015
|
key: e.node.id,
|
|
2718
3016
|
x: e.x,
|
|
2719
3017
|
y: e.y,
|
|
2720
3018
|
width: e.width,
|
|
2721
3019
|
height: e.height,
|
|
2722
3020
|
rx: Math.min(e.width, e.height) * .1,
|
|
2723
|
-
class:
|
|
2724
|
-
style:
|
|
3021
|
+
class: D(e.node.type === "group" ? "fill-none stroke-outline-variant" : !t.nodeColor?.(e.node) && (j(r).selection.value.nodes.includes(e.node.id) ? "fill-primary" : "fill-outline-variant")),
|
|
3022
|
+
style: O(e.node.type !== "group" && t.nodeColor?.(e.node) ? { fill: t.nodeColor(e.node) } : void 0),
|
|
2725
3023
|
"vector-effect": "non-scaling-stroke"
|
|
2726
|
-
}, null, 14,
|
|
2727
|
-
|
|
3024
|
+
}, null, 14, mt))), 128)),
|
|
3025
|
+
x("path", {
|
|
2728
3026
|
d: u.value,
|
|
2729
3027
|
"fill-rule": "evenodd",
|
|
2730
3028
|
class: "fill-on-surface/8"
|
|
2731
|
-
}, null, 8,
|
|
2732
|
-
|
|
3029
|
+
}, null, 8, ht),
|
|
3030
|
+
x("rect", {
|
|
2733
3031
|
x: s.value.x,
|
|
2734
3032
|
y: s.value.y,
|
|
2735
3033
|
width: s.value.width,
|
|
@@ -2738,10 +3036,10 @@ var N = [
|
|
|
2738
3036
|
class: "stroke-primary",
|
|
2739
3037
|
"stroke-width": "1.5",
|
|
2740
3038
|
"vector-effect": "non-scaling-stroke"
|
|
2741
|
-
}, null, 8,
|
|
2742
|
-
], 42,
|
|
3039
|
+
}, null, 8, gt)
|
|
3040
|
+
], 42, pt))], 34));
|
|
2743
3041
|
}
|
|
2744
|
-
}),
|
|
3042
|
+
}), V = /* @__PURE__ */ new Set([
|
|
2745
3043
|
"primary",
|
|
2746
3044
|
"secondary",
|
|
2747
3045
|
"tertiary",
|
|
@@ -2753,20 +3051,20 @@ var N = [
|
|
|
2753
3051
|
"success",
|
|
2754
3052
|
"on-surface",
|
|
2755
3053
|
"on-surface-variant"
|
|
2756
|
-
]),
|
|
2757
|
-
function
|
|
3054
|
+
]), H = 24, vt = 36, yt = 56;
|
|
3055
|
+
function bt(e) {
|
|
2758
3056
|
return e === "horizontal" ? "LR" : e === "vertical" || !e ? "TB" : e;
|
|
2759
3057
|
}
|
|
2760
|
-
function
|
|
3058
|
+
function xt(e) {
|
|
2761
3059
|
return e === "LR" || e === "RL" ? "horizontal" : "vertical";
|
|
2762
3060
|
}
|
|
2763
|
-
function
|
|
3061
|
+
function St(e) {
|
|
2764
3062
|
if (e.width && e.height) return {
|
|
2765
3063
|
width: e.width,
|
|
2766
3064
|
height: e.height
|
|
2767
3065
|
};
|
|
2768
3066
|
if (e.type === "circle") {
|
|
2769
|
-
let t = e.data?.size ??
|
|
3067
|
+
let t = e.data?.size ?? yt;
|
|
2770
3068
|
return {
|
|
2771
3069
|
width: t,
|
|
2772
3070
|
height: t
|
|
@@ -2778,13 +3076,13 @@ function yt(e) {
|
|
|
2778
3076
|
height: 36 + t.reduce((e, t) => e + Math.max(1, Math.ceil(t.length * 8 / (r - 40))), 0) * 20
|
|
2779
3077
|
};
|
|
2780
3078
|
}
|
|
2781
|
-
function
|
|
3079
|
+
function Ct(e, t, n, r) {
|
|
2782
3080
|
let i = new Map(e.map((e) => [e.id, e])), a = /* @__PURE__ */ new Map();
|
|
2783
3081
|
for (let t of e) {
|
|
2784
3082
|
let e = t.parentId && i.has(t.parentId) ? t.parentId : void 0;
|
|
2785
3083
|
a.has(e) || a.set(e, []), a.get(e).push(t);
|
|
2786
3084
|
}
|
|
2787
|
-
let o = r.sizes instanceof Map ? r.sizes : new Map(Object.entries(r.sizes ?? {})), s = /* @__PURE__ */ new Map(), c = n === "tree" ?
|
|
3085
|
+
let o = r.sizes instanceof Map ? r.sizes : new Map(Object.entries(r.sizes ?? {})), s = /* @__PURE__ */ new Map(), c = n === "tree" ? be : xe, l = (e, t) => {
|
|
2788
3086
|
let n = i.get(e);
|
|
2789
3087
|
for (let e = 0; n && e < 100; e++) {
|
|
2790
3088
|
let e = n.parentId && i.has(n.parentId) ? n.parentId : void 0;
|
|
@@ -2797,9 +3095,9 @@ function bt(e, t, n, r) {
|
|
|
2797
3095
|
let t = u(e.id);
|
|
2798
3096
|
s.set(e.id, {
|
|
2799
3097
|
width: Math.max(200, t.width + 48),
|
|
2800
|
-
height: Math.max(120, t.height +
|
|
3098
|
+
height: Math.max(120, t.height + vt + H)
|
|
2801
3099
|
});
|
|
2802
|
-
} else s.set(e.id, o.get(e.id) ??
|
|
3100
|
+
} else s.set(e.id, o.get(e.id) ?? St(e));
|
|
2803
3101
|
let i = n.map((e) => ({
|
|
2804
3102
|
...e,
|
|
2805
3103
|
parentId: void 0
|
|
@@ -2827,7 +3125,7 @@ function bt(e, t, n, r) {
|
|
|
2827
3125
|
width: 0,
|
|
2828
3126
|
height: 0
|
|
2829
3127
|
};
|
|
2830
|
-
let _ = e === void 0 ? -p :
|
|
3128
|
+
let _ = e === void 0 ? -p : H - p, v = e === void 0 ? -m : vt - m;
|
|
2831
3129
|
for (let e of n) {
|
|
2832
3130
|
let t = f[e.id] ?? {
|
|
2833
3131
|
x: 0,
|
|
@@ -2845,19 +3143,19 @@ function bt(e, t, n, r) {
|
|
|
2845
3143
|
};
|
|
2846
3144
|
u(void 0);
|
|
2847
3145
|
}
|
|
2848
|
-
function
|
|
2849
|
-
return n || t.layout === !1 ||
|
|
3146
|
+
function wt(e, t, n) {
|
|
3147
|
+
return n || t.layout === !1 || Ct(e.nodes, e.edges, t.layout ?? "layered", {
|
|
2850
3148
|
direction: e.rankdir,
|
|
2851
3149
|
...t.layoutOptions
|
|
2852
3150
|
}), e;
|
|
2853
3151
|
}
|
|
2854
|
-
var
|
|
3152
|
+
var U = class extends SyntaxError {
|
|
2855
3153
|
constructor(e, t, n) {
|
|
2856
3154
|
let r = t.slice(0, n).split("\n");
|
|
2857
3155
|
super(`${e} (line ${r.length}, column ${r.at(-1).length + 1})`);
|
|
2858
3156
|
}
|
|
2859
3157
|
};
|
|
2860
|
-
function
|
|
3158
|
+
function Tt(e) {
|
|
2861
3159
|
let t = [], n = 0, r = e.length;
|
|
2862
3160
|
for (; n < r;) {
|
|
2863
3161
|
let i = e[n];
|
|
@@ -2897,7 +3195,7 @@ function St(e) {
|
|
|
2897
3195
|
if (i === "\"") {
|
|
2898
3196
|
let i = n, a = "";
|
|
2899
3197
|
for (n++;;) {
|
|
2900
|
-
if (n >= r) throw new
|
|
3198
|
+
if (n >= r) throw new U("Unterminated string", e, i);
|
|
2901
3199
|
let t = e[n];
|
|
2902
3200
|
if (t === "\\" && e[n + 1] === "\"") {
|
|
2903
3201
|
a += "\"", n += 2;
|
|
@@ -2935,7 +3233,7 @@ function St(e) {
|
|
|
2935
3233
|
let i = n, a = 0, o = n;
|
|
2936
3234
|
for (; o < r; o++) if (e[o] === "<") a++;
|
|
2937
3235
|
else if (e[o] === ">" && --a === 0) break;
|
|
2938
|
-
if (o >= r) throw new
|
|
3236
|
+
if (o >= r) throw new U("Unterminated HTML label", e, i);
|
|
2939
3237
|
t.push({
|
|
2940
3238
|
t: "id",
|
|
2941
3239
|
v: e.slice(n + 1, o),
|
|
@@ -2967,37 +3265,37 @@ function St(e) {
|
|
|
2967
3265
|
}), n += o[0].length;
|
|
2968
3266
|
continue;
|
|
2969
3267
|
}
|
|
2970
|
-
throw new
|
|
3268
|
+
throw new U(`Unexpected "${i}"`, e, n);
|
|
2971
3269
|
}
|
|
2972
3270
|
return t;
|
|
2973
3271
|
}
|
|
2974
|
-
function
|
|
3272
|
+
function Et(e) {
|
|
2975
3273
|
return e.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]*>/g, "").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"").replace(/'|'/g, "'").replace(/ /g, " ").replace(/&/g, "&").trim();
|
|
2976
3274
|
}
|
|
2977
|
-
function
|
|
3275
|
+
function Dt(e, t, n) {
|
|
2978
3276
|
return e.replace(/\\N/g, t).replace(/\\G/g, n).replace(/\\[nlr]/g, "\n").replace(/\\(.)/g, "$1").replace(/\n$/, "");
|
|
2979
3277
|
}
|
|
2980
|
-
function
|
|
3278
|
+
function W(e) {
|
|
2981
3279
|
if (!e) return;
|
|
2982
3280
|
let t = e.split(":")[0].split(";")[0].trim().replace(/^\/[^/]*\//, "");
|
|
2983
3281
|
return /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(t) ? t.slice(0, 7) + (t.length > 7 ? t.slice(7) : "") : /^[a-z]+$/i.test(t) ? t.toLowerCase() : void 0;
|
|
2984
3282
|
}
|
|
2985
|
-
function
|
|
3283
|
+
function Ot(e, t) {
|
|
2986
3284
|
let n = e.dir ?? (t ? "forward" : "none"), r = (e) => e === "none" ? "none" : e && /vee|open|empty|normal-o|o/.test(e) && e !== "normal" ? "arrow" : "arrow-closed", i = n === "forward" || n === "both" ? r(e.arrowhead) : "none", a = n === "back" || n === "both" ? r(e.arrowtail) : "none", o = {};
|
|
2987
3285
|
return i !== "arrow-closed" && (o.markerEnd = i), a !== "none" && (o.markerStart = a), o;
|
|
2988
3286
|
}
|
|
2989
|
-
function
|
|
2990
|
-
let n =
|
|
3287
|
+
function kt(e, t = {}) {
|
|
3288
|
+
let n = Tt(e), r = 0, i = (e = 0) => n[r + e], a = (e, t = 0) => {
|
|
2991
3289
|
let n = i(t);
|
|
2992
3290
|
return !!n && n.t === "p" && n.v === e;
|
|
2993
3291
|
}, o = (e, t = 0) => {
|
|
2994
3292
|
let n = i(t);
|
|
2995
3293
|
return !!n && n.t === "id" && !n.quoted && n.v.toLowerCase() === e;
|
|
2996
3294
|
}, s = (t) => {
|
|
2997
|
-
throw new
|
|
3295
|
+
throw new U(t, e, i()?.at ?? e.length);
|
|
2998
3296
|
}, c = (e) => a(e) ? n[r++] : s(`Expected "${e}"`), l = () => {
|
|
2999
3297
|
let e = i();
|
|
3000
|
-
return !e || e.t !== "id" ? s("Expected an id") : (r++, e.html ?
|
|
3298
|
+
return !e || e.t !== "id" ? s("Expected an id") : (r++, e.html ? Et(e.v) : e.v);
|
|
3001
3299
|
}, u = !1;
|
|
3002
3300
|
o("strict") && (u = !0, r++);
|
|
3003
3301
|
let d;
|
|
@@ -3026,13 +3324,13 @@ function Et(e, t = {}) {
|
|
|
3026
3324
|
}
|
|
3027
3325
|
})), n && Object.assign(m.get(e), n);
|
|
3028
3326
|
}, S = /* @__PURE__ */ new Map(), C = (e) => {
|
|
3029
|
-
if (o("subgraph") || a("{")) return { ids: [...
|
|
3327
|
+
if (o("subgraph") || a("{")) return { ids: [...w(e).members] };
|
|
3030
3328
|
let t = l(), n;
|
|
3031
3329
|
return a(":") && (r++, n = l(), a(":") && (r++, n += ":" + l())), x(t, e), {
|
|
3032
3330
|
ids: [t],
|
|
3033
3331
|
port: n
|
|
3034
3332
|
};
|
|
3035
|
-
},
|
|
3333
|
+
}, w = (e) => {
|
|
3036
3334
|
let t;
|
|
3037
3335
|
o("subgraph") && (r++, i()?.t === "id" && (t = l()));
|
|
3038
3336
|
let n = {
|
|
@@ -3055,10 +3353,10 @@ function Et(e, t = {}) {
|
|
|
3055
3353
|
...e.cluster ? { parentId: e.cluster } : {}
|
|
3056
3354
|
}), n.cluster = r;
|
|
3057
3355
|
}
|
|
3058
|
-
return c("{"),
|
|
3059
|
-
},
|
|
3060
|
-
for (; i() && !a("}");)
|
|
3061
|
-
},
|
|
3356
|
+
return c("{"), T(n), c("}"), n;
|
|
3357
|
+
}, T = (e) => {
|
|
3358
|
+
for (; i() && !a("}");) ee(e), (a(";") || a(",")) && r++;
|
|
3359
|
+
}, ee = (e) => {
|
|
3062
3360
|
if ((o("graph") || o("node") || o("edge")) && a("[", 1)) {
|
|
3063
3361
|
let t = i().v.toLowerCase();
|
|
3064
3362
|
r++, Object.assign(e[t], b());
|
|
@@ -3090,34 +3388,34 @@ function Et(e, t = {}) {
|
|
|
3090
3388
|
if (u && v.has(a)) continue;
|
|
3091
3389
|
v.add(a);
|
|
3092
3390
|
let o = { ...c };
|
|
3093
|
-
n.port && (o.tailport = n.port), r.port && (o.headport = r.port), g.push(
|
|
3391
|
+
n.port && (o.tailport = n.port), r.port && (o.headport = r.port), g.push(At(e, i, o, g.length, d, t));
|
|
3094
3392
|
}
|
|
3095
3393
|
}
|
|
3096
|
-
},
|
|
3394
|
+
}, E = {
|
|
3097
3395
|
node: {},
|
|
3098
3396
|
edge: {},
|
|
3099
3397
|
graph: {},
|
|
3100
3398
|
members: /* @__PURE__ */ new Set()
|
|
3101
3399
|
};
|
|
3102
|
-
c("{"),
|
|
3103
|
-
let
|
|
3400
|
+
c("{"), T(E), c("}"), i() && s("Unexpected text after the graph");
|
|
3401
|
+
let D = /* @__PURE__ */ new Set();
|
|
3104
3402
|
for (let e of g) {
|
|
3105
|
-
for (;
|
|
3106
|
-
|
|
3403
|
+
for (; D.has(e.id);) e.id = `${e.id}_`;
|
|
3404
|
+
D.add(e.id);
|
|
3107
3405
|
}
|
|
3108
|
-
let
|
|
3406
|
+
let O = p.some((e) => e.type !== "group");
|
|
3109
3407
|
for (let e of p) {
|
|
3110
3408
|
if (e.type === "group") {
|
|
3111
3409
|
let t = _.get(e.id);
|
|
3112
3410
|
e.data = {
|
|
3113
|
-
label: t.label === void 0 ? void 0 :
|
|
3411
|
+
label: t.label === void 0 ? void 0 : Dt(t.label, e.id, f ?? ""),
|
|
3114
3412
|
attrs: { ...t }
|
|
3115
3413
|
};
|
|
3116
3414
|
continue;
|
|
3117
3415
|
}
|
|
3118
3416
|
let n = m.get(e.id), r = h.get(e.id);
|
|
3119
3417
|
r && (e.parentId = r);
|
|
3120
|
-
let i = n.label === void 0 ? e.id :
|
|
3418
|
+
let i = n.label === void 0 ? e.id : Dt(n.label, e.id, f ?? ""), a = n.shape?.toLowerCase();
|
|
3121
3419
|
a === "circle" || a === "doublecircle" || a === "point" || a === "mcircle" ? (e.type = "circle", e.data = {
|
|
3122
3420
|
label: a === "point" ? "" : i,
|
|
3123
3421
|
...a === "doublecircle" ? { ring: "primary" } : {},
|
|
@@ -3128,46 +3426,46 @@ function Et(e, t = {}) {
|
|
|
3128
3426
|
}), /\binvis\b/.test(n.style ?? "") && (e.hidden = !0);
|
|
3129
3427
|
let o = /^\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)/.exec(n.pos ?? "");
|
|
3130
3428
|
if (o) {
|
|
3131
|
-
let t =
|
|
3429
|
+
let t = St(e);
|
|
3132
3430
|
e.position = {
|
|
3133
3431
|
x: Number(o[1]) * 4 / 3 - t.width / 2,
|
|
3134
3432
|
y: -Number(o[2]) * 4 / 3 - t.height / 2
|
|
3135
3433
|
};
|
|
3136
|
-
} else
|
|
3434
|
+
} else O = !1;
|
|
3137
3435
|
}
|
|
3138
|
-
if (
|
|
3436
|
+
if (O) {
|
|
3139
3437
|
let e = p.filter((e) => e.type !== "group"), t = Math.min(...e.map((e) => e.position.x)), n = Math.min(...e.map((e) => e.position.y));
|
|
3140
3438
|
for (let r of e) r.position = {
|
|
3141
3439
|
x: Math.round(r.position.x - t),
|
|
3142
3440
|
y: Math.round(r.position.y - n)
|
|
3143
3441
|
};
|
|
3144
|
-
p.some((e) => e.type === "group") &&
|
|
3442
|
+
p.some((e) => e.type === "group") && Ct(p.filter((e) => e.type === "group" || e.parentId), [], "layered", {});
|
|
3145
3443
|
}
|
|
3146
|
-
let
|
|
3147
|
-
return
|
|
3444
|
+
let te = (E.graph.rankdir ?? "").toUpperCase(), ne = te === "LR" || te === "RL" || te === "BT" ? te : "TB";
|
|
3445
|
+
return wt({
|
|
3148
3446
|
nodes: p,
|
|
3149
3447
|
edges: g,
|
|
3150
|
-
rankdir:
|
|
3151
|
-
direction:
|
|
3448
|
+
rankdir: ne,
|
|
3449
|
+
direction: xt(ne),
|
|
3152
3450
|
directed: d,
|
|
3153
|
-
attrs: { ...
|
|
3451
|
+
attrs: { ...E.graph },
|
|
3154
3452
|
...f === void 0 ? {} : { name: f },
|
|
3155
|
-
...
|
|
3156
|
-
}, t,
|
|
3453
|
+
...E.graph.label === void 0 ? {} : { label: Dt(E.graph.label, "", f ?? "") }
|
|
3454
|
+
}, t, O && !p.some((e) => e.type === "group"));
|
|
3157
3455
|
}
|
|
3158
|
-
function
|
|
3456
|
+
function At(e, t, n, r, i, a) {
|
|
3159
3457
|
let o = {
|
|
3160
3458
|
id: n.id ?? `e${r + 1}`,
|
|
3161
3459
|
source: e,
|
|
3162
3460
|
target: t
|
|
3163
3461
|
};
|
|
3164
|
-
a.edgeType && (o.type = a.edgeType), n.label !== void 0 && (o.label =
|
|
3462
|
+
a.edgeType && (o.type = a.edgeType), n.label !== void 0 && (o.label = Dt(n.label, "", ""));
|
|
3165
3463
|
let s = n.style ?? "";
|
|
3166
3464
|
/\b(dashed|dotted)\b/.test(s) && (o.dashed = !0), /\binvis\b/.test(s) && (o.hidden = !0);
|
|
3167
|
-
let c =
|
|
3168
|
-
return c && (o.color = c), n.penwidth && Number(n.penwidth) > 0 ? o.width = Number(n.penwidth) * 2 : /\bbold\b/.test(s) && (o.width = 4), Object.assign(o,
|
|
3465
|
+
let c = W(n.color);
|
|
3466
|
+
return c && (o.color = c), n.penwidth && Number(n.penwidth) > 0 ? o.width = Number(n.penwidth) * 2 : /\bbold\b/.test(s) && (o.width = 4), Object.assign(o, Ot(n, i)), o.data = { attrs: n }, o;
|
|
3169
3467
|
}
|
|
3170
|
-
var
|
|
3468
|
+
var jt = /* @__PURE__ */ new Set([
|
|
3171
3469
|
"strict",
|
|
3172
3470
|
"graph",
|
|
3173
3471
|
"digraph",
|
|
@@ -3175,19 +3473,19 @@ var Ot = /* @__PURE__ */ new Set([
|
|
|
3175
3473
|
"edge",
|
|
3176
3474
|
"subgraph"
|
|
3177
3475
|
]);
|
|
3178
|
-
function W(e) {
|
|
3179
|
-
return /^[A-Za-z_][\w]*$/.test(e) && !Ot.has(e.toLowerCase()) || /^-?(?:\.\d+|\d+(?:\.\d*)?)$/.test(e) ? e : `"${e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n")}"`;
|
|
3180
|
-
}
|
|
3181
3476
|
function G(e) {
|
|
3182
|
-
|
|
3477
|
+
return /^[A-Za-z_][\w]*$/.test(e) && !jt.has(e.toLowerCase()) || /^-?(?:\.\d+|\d+(?:\.\d*)?)$/.test(e) ? e : `"${e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n")}"`;
|
|
3478
|
+
}
|
|
3479
|
+
function K(e) {
|
|
3480
|
+
let t = Object.entries(e).map(([e, t]) => `${G(e)}=${G(t)}`);
|
|
3183
3481
|
return t.length ? ` [${t.join(", ")}]` : "";
|
|
3184
3482
|
}
|
|
3185
|
-
var
|
|
3483
|
+
var Mt = /* @__PURE__ */ new Set([
|
|
3186
3484
|
"label",
|
|
3187
3485
|
"pos",
|
|
3188
3486
|
"shape",
|
|
3189
3487
|
"style"
|
|
3190
|
-
]),
|
|
3488
|
+
]), Nt = /* @__PURE__ */ new Set([
|
|
3191
3489
|
"label",
|
|
3192
3490
|
"color",
|
|
3193
3491
|
"penwidth",
|
|
@@ -3199,16 +3497,16 @@ var kt = /* @__PURE__ */ new Set([
|
|
|
3199
3497
|
"tailport",
|
|
3200
3498
|
"headport"
|
|
3201
3499
|
]);
|
|
3202
|
-
function
|
|
3500
|
+
function Pt(e, t) {
|
|
3203
3501
|
let n = e?.attrs, r = {};
|
|
3204
3502
|
if (n && typeof n == "object") for (let [e, i] of Object.entries(n)) !t.has(e) && typeof i == "string" && (r[e] = i);
|
|
3205
3503
|
return r;
|
|
3206
3504
|
}
|
|
3207
|
-
function
|
|
3505
|
+
function Ft(e) {
|
|
3208
3506
|
let t = e.data?.label;
|
|
3209
3507
|
return t == null ? void 0 : String(t);
|
|
3210
3508
|
}
|
|
3211
|
-
function
|
|
3509
|
+
function It(e) {
|
|
3212
3510
|
let t = new Map(e.map((e) => [e.id, e])), n = /* @__PURE__ */ new Map(), r = (e, i = 0) => {
|
|
3213
3511
|
if (n.has(e.id)) return n.get(e.id);
|
|
3214
3512
|
let a = e.parentId && t.has(e.parentId) && i < 100 ? r(t.get(e.parentId), i + 1) : {
|
|
@@ -3222,7 +3520,7 @@ function Nt(e) {
|
|
|
3222
3520
|
};
|
|
3223
3521
|
return r;
|
|
3224
3522
|
}
|
|
3225
|
-
function
|
|
3523
|
+
function Lt(e) {
|
|
3226
3524
|
let t = new Set(e.map((e) => e.id)), n = /* @__PURE__ */ new Map();
|
|
3227
3525
|
for (let r of e) {
|
|
3228
3526
|
let e = r.parentId && t.has(r.parentId) ? r.parentId : void 0;
|
|
@@ -3230,47 +3528,47 @@ function Pt(e) {
|
|
|
3230
3528
|
}
|
|
3231
3529
|
return n;
|
|
3232
3530
|
}
|
|
3233
|
-
function
|
|
3234
|
-
let r = n.directed ?? !0, i = [`${r ? "digraph" : "graph"}${n.name ? ` ${
|
|
3531
|
+
function Rt(e, t, n = {}) {
|
|
3532
|
+
let r = n.directed ?? !0, i = [`${r ? "digraph" : "graph"}${n.name ? ` ${G(n.name)}` : ""} {`], a = bt(n.direction);
|
|
3235
3533
|
a !== "TB" && i.push(` rankdir=${a};`);
|
|
3236
|
-
let o =
|
|
3534
|
+
let o = Lt(e), s = It(e), c = n.sizes instanceof Map ? n.sizes : new Map(Object.entries(n.sizes ?? {})), l = (e, t) => {
|
|
3237
3535
|
for (let r of o.get(e) ?? []) {
|
|
3238
|
-
let e =
|
|
3536
|
+
let e = Ft(r);
|
|
3239
3537
|
if (r.type === "group") {
|
|
3240
3538
|
let n = /^cluster/i.test(r.id) ? r.id : `cluster_${r.id}`;
|
|
3241
|
-
i.push(`${t}subgraph ${
|
|
3242
|
-
let a =
|
|
3539
|
+
i.push(`${t}subgraph ${G(n)} {`);
|
|
3540
|
+
let a = Pt(r.data, Mt);
|
|
3243
3541
|
e && (a.label = e);
|
|
3244
|
-
for (let [e, n] of Object.entries(a)) i.push(`${t} ${
|
|
3542
|
+
for (let [e, n] of Object.entries(a)) i.push(`${t} ${G(e)}=${G(n)};`);
|
|
3245
3543
|
l(r.id, t + " "), i.push(`${t}}`);
|
|
3246
3544
|
continue;
|
|
3247
3545
|
}
|
|
3248
|
-
let a =
|
|
3546
|
+
let a = Pt(r.data, Mt);
|
|
3249
3547
|
if (e !== void 0 && e !== r.id && (a.label = e), r.type === "circle" ? a.shape = r.data?.ring ? "doublecircle" : "circle" : r.data?.attrs?.shape && (a.shape = r.data.attrs.shape), r.hidden && (a.style = "invis"), n.positions) {
|
|
3250
|
-
let e = s(r), t = c.get(r.id) ??
|
|
3251
|
-
a.pos = `${
|
|
3548
|
+
let e = s(r), t = c.get(r.id) ?? St(r);
|
|
3549
|
+
a.pos = `${zt((e.x + t.width / 2) * .75)},${zt(-(e.y + t.height / 2) * .75)}`;
|
|
3252
3550
|
}
|
|
3253
|
-
i.push(`${t}${
|
|
3551
|
+
i.push(`${t}${G(r.id)}${K(a)};`);
|
|
3254
3552
|
}
|
|
3255
3553
|
};
|
|
3256
3554
|
l(void 0, " ");
|
|
3257
3555
|
let u = r ? "->" : "--";
|
|
3258
3556
|
for (let e of t) {
|
|
3259
|
-
let t =
|
|
3260
|
-
e.label && (t.label = e.label), e.color && !
|
|
3557
|
+
let t = Pt(e.data, Nt);
|
|
3558
|
+
e.label && (t.label = e.label), e.color && !V.has(e.color) && !e.color.startsWith("var(") && (t.color = e.color), e.width && e.width !== 2 && (t.penwidth = String(zt(e.width / 2)));
|
|
3261
3559
|
let n = [e.dashed ? "dashed" : "", e.hidden ? "invis" : ""].filter(Boolean).join(",");
|
|
3262
3560
|
n && (t.style = n);
|
|
3263
3561
|
let a = e.markerEnd ?? "arrow-closed", o = e.markerStart ?? "none";
|
|
3264
3562
|
r && (a === "none" && o === "none" ? t.dir = "none" : a === "none" ? t.dir = "back" : o !== "none" && (t.dir = "both"), a === "arrow" && (t.arrowhead = "vee"), o === "arrow" && (t.arrowtail = "vee"));
|
|
3265
|
-
let s = e.data?.attrs?.tailport, c = e.data?.attrs?.headport, l = (e) => e ? ":" + e.split(":").map(
|
|
3266
|
-
i.push(` ${
|
|
3563
|
+
let s = e.data?.attrs?.tailport, c = e.data?.attrs?.headport, l = (e) => e ? ":" + e.split(":").map(G).join(":") : "";
|
|
3564
|
+
i.push(` ${G(e.source)}${l(s)} ${u} ${G(e.target)}${l(c)}${K(t)};`);
|
|
3267
3565
|
}
|
|
3268
3566
|
return i.push("}"), i.join("\n") + "\n";
|
|
3269
3567
|
}
|
|
3270
|
-
function
|
|
3568
|
+
function zt(e) {
|
|
3271
3569
|
return Math.round(e * 100) / 100;
|
|
3272
3570
|
}
|
|
3273
|
-
var
|
|
3571
|
+
var Bt = [
|
|
3274
3572
|
{
|
|
3275
3573
|
open: "(((",
|
|
3276
3574
|
close: ")))",
|
|
@@ -3341,7 +3639,7 @@ var It = [
|
|
|
3341
3639
|
close: "}",
|
|
3342
3640
|
shape: "diamond"
|
|
3343
3641
|
}
|
|
3344
|
-
],
|
|
3642
|
+
], Vt = /^(classDef|class|style|linkStyle|click|accTitle|accDescr|direction)\b/, Ht = /* @__PURE__ */ new Set([
|
|
3345
3643
|
"end",
|
|
3346
3644
|
"graph",
|
|
3347
3645
|
"flowchart",
|
|
@@ -3353,7 +3651,7 @@ var It = [
|
|
|
3353
3651
|
"click",
|
|
3354
3652
|
"direction"
|
|
3355
3653
|
]);
|
|
3356
|
-
function
|
|
3654
|
+
function Ut(e) {
|
|
3357
3655
|
let t = e.trim();
|
|
3358
3656
|
return t.startsWith("\"") && t.endsWith("\"") && t.length > 1 && (t = t.slice(1, -1)), t.startsWith("`") && t.endsWith("`") && t.length > 1 && (t = t.slice(1, -1).replace(/\*\*|__|\*|_/g, "")), t.replace(/<br\s*\/?>/gi, "\n").replace(/#quot;/g, "\"").replace(/#(\d+);/g, (e, t) => String.fromCodePoint(Number(t))).replace(/#([a-z]+);/gi, (e, t) => ({
|
|
3359
3657
|
amp: "&",
|
|
@@ -3363,7 +3661,7 @@ function zt(e) {
|
|
|
3363
3661
|
apos: "'"
|
|
3364
3662
|
})[t.toLowerCase()] ?? e);
|
|
3365
3663
|
}
|
|
3366
|
-
function
|
|
3664
|
+
function Wt(e) {
|
|
3367
3665
|
let t = [], n = 0, r = !1, i = 0;
|
|
3368
3666
|
for (let a = 0; a <= e.length; a++) {
|
|
3369
3667
|
let o = e[a];
|
|
@@ -3377,9 +3675,9 @@ function Bt(e) {
|
|
|
3377
3675
|
}
|
|
3378
3676
|
return t;
|
|
3379
3677
|
}
|
|
3380
|
-
function
|
|
3381
|
-
let n =
|
|
3382
|
-
if (!r || !i) throw new
|
|
3678
|
+
function Gt(e, t = {}) {
|
|
3679
|
+
let n = Wt(e.replace(/^\s*---\n[\s\S]*?\n---\s*\n/, (e) => "\n".repeat(e.split("\n").length - 1))), r = n.shift(), i = r && /^(flowchart|graph)(?:\s+(TB|TD|BT|RL|LR))?\s*(.*)$/i.exec(r.text);
|
|
3680
|
+
if (!r || !i) throw new U("Expected \"flowchart\" or \"graph\"", e, r?.at ?? 0);
|
|
3383
3681
|
let a = (i[2] ?? "TB").toUpperCase(), o = a === "TD" ? "TB" : a;
|
|
3384
3682
|
i[3] && n.unshift({
|
|
3385
3683
|
text: i[3],
|
|
@@ -3398,7 +3696,7 @@ function Vt(e, t = {}) {
|
|
|
3398
3696
|
};
|
|
3399
3697
|
for (let { text: r, at: i } of n) {
|
|
3400
3698
|
let n = (t, n = 0) => {
|
|
3401
|
-
throw new
|
|
3699
|
+
throw new U(t, e, i + n);
|
|
3402
3700
|
};
|
|
3403
3701
|
if (/^end$/i.test(r)) {
|
|
3404
3702
|
u.length || n("\"end\" without a subgraph"), u.pop();
|
|
@@ -3406,7 +3704,7 @@ function Vt(e, t = {}) {
|
|
|
3406
3704
|
}
|
|
3407
3705
|
let a = /^subgraph\s+(.+)$/i.exec(r);
|
|
3408
3706
|
if (a) {
|
|
3409
|
-
let e = a[1].trim(), t = /^([\w-]+)\s*\[(.*)\]$/.exec(e), n = t ? t[1] : /^[\w-]+$/.test(e) ? e : e.replace(/^"|"$/g, ""), r =
|
|
3707
|
+
let e = a[1].trim(), t = /^([\w-]+)\s*\[(.*)\]$/.exec(e), n = t ? t[1] : /^[\w-]+$/.test(e) ? e : e.replace(/^"|"$/g, ""), r = Ut(t ? t[2] : e), i = c.get(n) ?? {
|
|
3410
3708
|
id: n,
|
|
3411
3709
|
position: {
|
|
3412
3710
|
x: 0,
|
|
@@ -3416,7 +3714,7 @@ function Vt(e, t = {}) {
|
|
|
3416
3714
|
i.type = "group", i.data = { label: r }, u.length ? i.parentId = u.at(-1) : delete i.parentId, c.has(n) || (c.set(n, i), s.push(i)), u.push(n);
|
|
3417
3715
|
continue;
|
|
3418
3716
|
}
|
|
3419
|
-
if (
|
|
3717
|
+
if (Vt.test(r)) continue;
|
|
3420
3718
|
let o = 0, f = () => {
|
|
3421
3719
|
for (; o < r.length && /\s/.test(r[o]);) o++;
|
|
3422
3720
|
}, p = () => {
|
|
@@ -3430,12 +3728,12 @@ function Vt(e, t = {}) {
|
|
|
3430
3728
|
let e = r.indexOf("}", o);
|
|
3431
3729
|
e < 0 && n("Unclosed \"@{\"", o);
|
|
3432
3730
|
let t = r.slice(o + 2, e), s = /\bshape\s*:\s*([\w-]+)/.exec(t), c = /\blabel\s*:\s*("(?:[^"\\]|\\.)*"|[^,}]+)/.exec(t);
|
|
3433
|
-
s && (a = s[1].toLowerCase()), c && (i =
|
|
3434
|
-
} else for (let e of
|
|
3731
|
+
s && (a = s[1].toLowerCase()), c && (i = Ut(c[1])), o = e + 1;
|
|
3732
|
+
} else for (let e of Bt) {
|
|
3435
3733
|
if (!r.startsWith(e.open, o)) continue;
|
|
3436
3734
|
let t = o + e.open.length, n = r[t] === "\"" ? r.indexOf("\"", t + 1) + 1 : t, s = r.indexOf(e.close, n);
|
|
3437
3735
|
if (!(n === 0 || s < 0)) {
|
|
3438
|
-
i =
|
|
3736
|
+
i = Ut(r.slice(t, s)), a = e.shape, o = s + e.close.length;
|
|
3439
3737
|
break;
|
|
3440
3738
|
}
|
|
3441
3739
|
}
|
|
@@ -3456,7 +3754,7 @@ function Vt(e, t = {}) {
|
|
|
3456
3754
|
line: e ? "dotted" : t[2] === "==" ? "thick" : "solid",
|
|
3457
3755
|
start: t[1] ?? "",
|
|
3458
3756
|
end: r === "-" || r === "=" ? "" : r,
|
|
3459
|
-
label:
|
|
3757
|
+
label: Ut(t[3]),
|
|
3460
3758
|
raw: t[0]
|
|
3461
3759
|
}, o += t[0].length;
|
|
3462
3760
|
} else if (i) {
|
|
@@ -3468,7 +3766,7 @@ function Vt(e, t = {}) {
|
|
|
3468
3766
|
raw: i[0]
|
|
3469
3767
|
}, o += i[0].length, f(), r[o] === "|") {
|
|
3470
3768
|
let e = r.indexOf("|", o + 1);
|
|
3471
|
-
e < 0 && n("Unclosed \"|\"", o), a.label =
|
|
3769
|
+
e < 0 && n("Unclosed \"|\"", o), a.label = Ut(r.slice(o + 1, e)), o = e + 1;
|
|
3472
3770
|
}
|
|
3473
3771
|
} else return null;
|
|
3474
3772
|
return a;
|
|
@@ -3477,56 +3775,56 @@ function Vt(e, t = {}) {
|
|
|
3477
3775
|
let e = h();
|
|
3478
3776
|
e || n(`Unexpected "${r.slice(o, o + 12)}"`, o);
|
|
3479
3777
|
let i = m();
|
|
3480
|
-
for (let n of g) for (let r of i) l.push(
|
|
3778
|
+
for (let n of g) for (let r of i) l.push(Kt(n, r, e, l.length, t));
|
|
3481
3779
|
g = i;
|
|
3482
3780
|
}
|
|
3483
3781
|
}
|
|
3484
|
-
if (u.length) throw new
|
|
3485
|
-
let f = [], p =
|
|
3782
|
+
if (u.length) throw new U(`Subgraph "${u.at(-1)}" has no "end"`, e, e.length);
|
|
3783
|
+
let f = [], p = Lt(s), m = (e) => {
|
|
3486
3784
|
for (let t of p.get(e) ?? []) f.push(t), m(t.id);
|
|
3487
3785
|
};
|
|
3488
|
-
return m(void 0),
|
|
3786
|
+
return m(void 0), wt({
|
|
3489
3787
|
nodes: f,
|
|
3490
3788
|
edges: l,
|
|
3491
3789
|
rankdir: o,
|
|
3492
|
-
direction:
|
|
3790
|
+
direction: xt(o),
|
|
3493
3791
|
directed: !0,
|
|
3494
3792
|
attrs: {}
|
|
3495
3793
|
}, t, !1);
|
|
3496
3794
|
}
|
|
3497
|
-
function
|
|
3795
|
+
function q(e) {
|
|
3498
3796
|
return e === ">" || e === "<" ? "arrow-closed" : e === "o" || e === "x" ? "arrow" : "none";
|
|
3499
3797
|
}
|
|
3500
|
-
function
|
|
3798
|
+
function Kt(e, t, n, r, i) {
|
|
3501
3799
|
let a = {
|
|
3502
3800
|
id: `e${r + 1}`,
|
|
3503
3801
|
source: e,
|
|
3504
3802
|
target: t
|
|
3505
3803
|
};
|
|
3506
3804
|
i.edgeType && (a.type = i.edgeType), n.label && (a.label = n.label), n.line === "dotted" && (a.dashed = !0), n.line === "thick" && (a.width = 4), n.line === "invisible" && (a.hidden = !0);
|
|
3507
|
-
let o =
|
|
3508
|
-
return o !== "arrow-closed" && (a.markerEnd = o), n.start && (a.markerStart =
|
|
3805
|
+
let o = q(n.end);
|
|
3806
|
+
return o !== "arrow-closed" && (a.markerEnd = o), n.start && (a.markerStart = q(n.start)), a.data = { link: n.raw.replace(/\s+/g, " ") }, a;
|
|
3509
3807
|
}
|
|
3510
|
-
function
|
|
3808
|
+
function qt(e) {
|
|
3511
3809
|
return `"${e.replace(/"/g, "#quot;").replace(/\n/g, "<br>")}"`;
|
|
3512
3810
|
}
|
|
3513
|
-
var
|
|
3514
|
-
function
|
|
3515
|
-
let r = [`flowchart ${
|
|
3811
|
+
var Jt = new Map(Bt.map((e) => [e.shape, e]));
|
|
3812
|
+
function Yt(e, t, n = {}) {
|
|
3813
|
+
let r = [`flowchart ${bt(n.direction)}`], i = /* @__PURE__ */ new Map(), a = 0, o = /* @__PURE__ */ new Set();
|
|
3516
3814
|
for (let t of e) {
|
|
3517
|
-
let e = /^[A-Za-z_][\w-]*$/.test(t.id) && !t.id.endsWith("-") && !
|
|
3815
|
+
let e = /^[A-Za-z_][\w-]*$/.test(t.id) && !t.id.endsWith("-") && !Ht.has(t.id.toLowerCase()) ? t.id : "";
|
|
3518
3816
|
for (; !e || o.has(e);) e = `n${++a}`;
|
|
3519
3817
|
o.add(e), i.set(t.id, e);
|
|
3520
3818
|
}
|
|
3521
|
-
let s =
|
|
3819
|
+
let s = Lt(e), c = (e, t) => {
|
|
3522
3820
|
for (let n of s.get(e) ?? []) {
|
|
3523
|
-
let e = i.get(n.id), a =
|
|
3821
|
+
let e = i.get(n.id), a = Ft(n);
|
|
3524
3822
|
if (n.type === "group") {
|
|
3525
|
-
r.push(`${t}subgraph ${e}[${
|
|
3823
|
+
r.push(`${t}subgraph ${e}[${qt(a ?? n.id)}]`), c(n.id, t + " "), r.push(`${t}end`);
|
|
3526
3824
|
continue;
|
|
3527
3825
|
}
|
|
3528
|
-
let o = n.data ?? {}, s = n.type === "circle" ? o.ring ? "doublecircle" : "circle" : o.shape &&
|
|
3529
|
-
r.push(`${t}${e}${l ? `${l.open}${
|
|
3826
|
+
let o = n.data ?? {}, s = n.type === "circle" ? o.ring ? "doublecircle" : "circle" : o.shape && Jt.has(o.shape) ? o.shape : a !== void 0 && a !== n.id ? "rect" : "", l = s ? Jt.get(s) : void 0;
|
|
3827
|
+
r.push(`${t}${e}${l ? `${l.open}${qt(a ?? n.id)}${l.close}` : ""}`);
|
|
3530
3828
|
}
|
|
3531
3829
|
};
|
|
3532
3830
|
c(void 0, " ");
|
|
@@ -3537,11 +3835,11 @@ function Gt(e, t, n = {}) {
|
|
|
3537
3835
|
let t = a !== "none", n = o === "none" ? "" : "<";
|
|
3538
3836
|
s = e.dashed ? `${n}-.${t ? "->" : "-"}` : (e.width ?? 2) >= 3 ? `${n}==${t ? ">" : "="}` : `${n}--${t ? ">" : "-"}`;
|
|
3539
3837
|
}
|
|
3540
|
-
r.push(` ${t} ${s}${e.label && !e.hidden ? `|${
|
|
3838
|
+
r.push(` ${t} ${s}${e.label && !e.hidden ? `|${qt(e.label)}|` : ""} ${n}`);
|
|
3541
3839
|
}
|
|
3542
3840
|
return r.join("\n") + "\n";
|
|
3543
3841
|
}
|
|
3544
3842
|
//#endregion
|
|
3545
|
-
export {
|
|
3843
|
+
export { ut as MFlow, B as MFlowControls, I as MFlowHandle, _t as MFlowMinimap, ke as MFlowNode, p as arrowPath, s as getBezierPath, i as getRoutedPath, u as getSmoothStepPath, f as getStepPath, a as getStraightPath, xe as layoutLayered, be as layoutTree, kt as parseDot, Gt as parseMermaid, c as pointsToRoute, m as routePoints, o as smoothStepPoints, Rt as toDot, Yt as toMermaid, ve as useFlow, ye as useFlowNode };
|
|
3546
3844
|
|
|
3547
3845
|
//# sourceMappingURL=flow.js.map
|