@cascivo/flow 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,1139 +1,3 @@
1
1
  "use client";
2
2
  import './flow.css';
3
- import { cn as e, useComputed as t, useControllableSignal as n, useDraggable as r, useEffectPropSignal as i, useResizeObserver as a, useSignal as o, useSignalEffect as s, useSignals as c } from "@cascivo/core";
4
- import { useId as l, useRef as u } from "react";
5
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
6
- import { cn as m } from "@cascivo/core/pure";
7
- import { builtin as h, t as g } from "@cascivo/i18n";
8
- //#region src/engine/types.ts
9
- var _ = {
10
- width: 150,
11
- height: 40
12
- }, v = {
13
- x: 0,
14
- y: 0,
15
- zoom: 1
16
- };
17
- function y(e = {}) {
18
- let [t, r] = n({
19
- value: e.nodes,
20
- defaultValue: e.defaultNodes ?? [],
21
- onChange: e.onNodesChange
22
- }), [i, a] = n({
23
- value: e.edges,
24
- defaultValue: e.defaultEdges ?? [],
25
- onChange: e.onEdgesChange
26
- }), [o, s] = n({
27
- value: e.viewport,
28
- defaultValue: e.defaultViewport ?? v,
29
- onChange: e.onViewportChange
30
- });
31
- return {
32
- nodes: t,
33
- edges: i,
34
- viewport: o,
35
- setNodes: r,
36
- updateNode: (e, n) => {
37
- r(t.value.map((t) => t.id === e ? {
38
- ...t,
39
- ...n
40
- } : t));
41
- },
42
- setEdges: a,
43
- addEdge: (e) => {
44
- a([...i.value, e]);
45
- },
46
- setViewport: s
47
- };
48
- }
49
- //#endregion
50
- //#region src/engine/transform.ts
51
- function b(e, t = .2, n = 2) {
52
- return Math.min(n, Math.max(t, e));
53
- }
54
- function x(e, t) {
55
- return {
56
- x: (e.x - t.x) / t.zoom,
57
- y: (e.y - t.y) / t.zoom
58
- };
59
- }
60
- function S(e, t) {
61
- return {
62
- x: e.x * t.zoom + t.x,
63
- y: e.y * t.zoom + t.y
64
- };
65
- }
66
- //#endregion
67
- //#region src/engine/geometry.ts
68
- function C(e) {
69
- return {
70
- width: e.width ?? _.width,
71
- height: e.height ?? _.height
72
- };
73
- }
74
- function w(e) {
75
- let { width: t, height: n } = C(e);
76
- return {
77
- x: e.position.x,
78
- y: e.position.y,
79
- width: t,
80
- height: n
81
- };
82
- }
83
- function T(e, t) {
84
- let { x: n, y: r, width: i, height: a } = w(e);
85
- switch (t) {
86
- case "top": return {
87
- x: n + i / 2,
88
- y: r
89
- };
90
- case "right": return {
91
- x: n + i,
92
- y: r + a / 2
93
- };
94
- case "bottom": return {
95
- x: n + i / 2,
96
- y: r + a
97
- };
98
- case "left": return {
99
- x: n,
100
- y: r + a / 2
101
- };
102
- }
103
- }
104
- function E(e) {
105
- if (e.length === 0) return null;
106
- let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
107
- for (let a of e) {
108
- let e = w(a);
109
- t = Math.min(t, e.x), n = Math.min(n, e.y), r = Math.max(r, e.x + e.width), i = Math.max(i, e.y + e.height);
110
- }
111
- return {
112
- x: t,
113
- y: n,
114
- width: r - t,
115
- height: i - n
116
- };
117
- }
118
- function D(e, t, n = {}) {
119
- let { padding: r = .1, minZoom: i = .2, maxZoom: a = 2 } = n;
120
- if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0) return {
121
- x: t.width / 2 - e.x,
122
- y: t.height / 2 - e.y,
123
- zoom: 1
124
- };
125
- let o = t.width / (e.width * (1 + r * 2)), s = t.height / (e.height * (1 + r * 2)), c = b(Math.min(o, s), i, a);
126
- return {
127
- x: t.width / 2 - (e.x + e.width / 2) * c,
128
- y: t.height / 2 - (e.y + e.height / 2) * c,
129
- zoom: c
130
- };
131
- }
132
- //#endregion
133
- //#region src/engine/path.ts
134
- var O = (e) => Number.isInteger(e) ? String(e) : e.toFixed(2).replace(/\.?0+$/, ""), k = (e, t) => ({
135
- x: (e.x + t.x) / 2,
136
- y: (e.y + t.y) / 2
137
- });
138
- function A(e) {
139
- switch (e) {
140
- case "top": return {
141
- x: 0,
142
- y: -1
143
- };
144
- case "bottom": return {
145
- x: 0,
146
- y: 1
147
- };
148
- case "left": return {
149
- x: -1,
150
- y: 0
151
- };
152
- case "right": return {
153
- x: 1,
154
- y: 0
155
- };
156
- }
157
- }
158
- function j({ source: e, target: t }) {
159
- return {
160
- d: `M${O(e.x)},${O(e.y)} L${O(t.x)},${O(t.y)}`,
161
- mid: k(e, t)
162
- };
163
- }
164
- function M(e) {
165
- let { source: t, target: n, curvature: r = .25 } = e, i = e.sourcePosition ?? "right", a = e.targetPosition ?? "left", o = Math.hypot(n.x - t.x, n.y - t.y), s = Math.max(r * o, 20), c = A(i), l = A(a), u = {
166
- x: t.x + c.x * s,
167
- y: t.y + c.y * s
168
- }, d = {
169
- x: n.x + l.x * s,
170
- y: n.y + l.y * s
171
- }, f = {
172
- x: (t.x + 3 * u.x + 3 * d.x + n.x) / 8,
173
- y: (t.y + 3 * u.y + 3 * d.y + n.y) / 8
174
- };
175
- return {
176
- d: `M${O(t.x)},${O(t.y)} C${O(u.x)},${O(u.y)} ${O(d.x)},${O(d.y)} ${O(n.x)},${O(n.y)}`,
177
- mid: f
178
- };
179
- }
180
- function N(e, t) {
181
- return Math.hypot(t.x - e.x, t.y - e.y);
182
- }
183
- function P(e, t, n) {
184
- let r = N(e, t) || 1;
185
- return {
186
- x: e.x + (t.x - e.x) / r * n,
187
- y: e.y + (t.y - e.y) / r * n
188
- };
189
- }
190
- function F(e, t) {
191
- if (e.length < 2) return "";
192
- let n = e[0], r = `M${O(n.x)},${O(n.y)}`;
193
- for (let n = 1; n < e.length - 1; n++) {
194
- let i = e[n - 1], a = e[n], o = e[n + 1], s = Math.min(t, N(i, a) / 2, N(a, o) / 2), c = P(a, i, s), l = P(a, o, s);
195
- r += ` L${O(c.x)},${O(c.y)} Q${O(a.x)},${O(a.y)} ${O(l.x)},${O(l.y)}`;
196
- }
197
- let i = e[e.length - 1];
198
- return r += ` L${O(i.x)},${O(i.y)}`, r;
199
- }
200
- function I(e) {
201
- let { source: t, target: n, borderRadius: r = 8 } = e, i = e.sourcePosition ?? "right", a = i === "left" || i === "right", o = [t];
202
- if (a) {
203
- let e = (t.x + n.x) / 2;
204
- o.push({
205
- x: e,
206
- y: t.y
207
- }, {
208
- x: e,
209
- y: n.y
210
- });
211
- } else {
212
- let e = (t.y + n.y) / 2;
213
- o.push({
214
- x: t.x,
215
- y: e
216
- }, {
217
- x: n.x,
218
- y: e
219
- });
220
- }
221
- return o.push(n), {
222
- d: F(o, r),
223
- mid: k(t, n)
224
- };
225
- }
226
- function L(e, t) {
227
- switch (e) {
228
- case "straight": return j(t);
229
- case "smoothstep": return I(t);
230
- case "bezier": return M(t);
231
- }
232
- }
233
- //#endregion
234
- //#region src/engine/layout.ts
235
- function R(e, t = {}) {
236
- let n = t.gap ?? 40, r = t.nodeWidth ?? _.width, i = t.nodeHeight ?? _.height, a = t.columns ?? Math.max(1, Math.ceil(Math.sqrt(e.length)));
237
- return e.map((e, t) => {
238
- let o = t % a, s = Math.floor(t / a);
239
- return {
240
- ...e,
241
- position: {
242
- x: o * (r + n),
243
- y: s * (i + n)
244
- }
245
- };
246
- });
247
- }
248
- function z(e, t, n = {}) {
249
- let r = n.direction ?? "LR", i = n.gap ?? 60, a = n.nodeWidth ?? _.width, o = n.nodeHeight ?? _.height, s = new Set(e.map((e) => e.id)), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
250
- for (let t of e) l.set(t.id, 0);
251
- for (let e of t) !s.has(e.source) || !s.has(e.target) || (c.set(e.source, [...c.get(e.source) ?? [], e.target]), l.set(e.target, (l.get(e.target) ?? 0) + 1));
252
- let u = /* @__PURE__ */ new Map(), d = e.filter((e) => (l.get(e.id) ?? 0) === 0).map((e) => e.id);
253
- for (let e of d) u.set(e, 0);
254
- let f = new Map(l);
255
- for (; d.length > 0;) {
256
- let e = [];
257
- for (let t of d) {
258
- let n = u.get(t) ?? 0;
259
- for (let r of c.get(t) ?? []) u.set(r, Math.max(u.get(r) ?? 0, n + 1)), f.set(r, (f.get(r) ?? 0) - 1), (f.get(r) ?? 0) === 0 && e.push(r);
260
- }
261
- d = e;
262
- }
263
- for (let t of e) u.has(t.id) || u.set(t.id, 0);
264
- let p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
265
- for (let t of e) {
266
- let e = u.get(t.id) ?? 0, n = m.get(e) ?? 0;
267
- p.set(t.id, n), m.set(e, n + 1);
268
- }
269
- return e.map((e) => {
270
- let t = u.get(e.id) ?? 0, n = p.get(e.id) ?? 0, s = r === "LR" ? {
271
- x: t * (a + i),
272
- y: n * (o + i)
273
- } : {
274
- x: n * (a + i),
275
- y: t * (o + i)
276
- };
277
- return {
278
- ...e,
279
- position: s
280
- };
281
- });
282
- }
283
- function B(e, t, n) {
284
- return n === "grid" ? R(e) : n === "layered" ? z(e, t) : n(e, t);
285
- }
286
- //#endregion
287
- //#region src/engine/script.ts
288
- function V(e) {
289
- return "edge" in e;
290
- }
291
- function ee(e, t) {
292
- let n = {
293
- label: e.label,
294
- description: e.description,
295
- duration: e.duration
296
- };
297
- if (V(e)) {
298
- let r = t.find((t) => t.id === e.edge);
299
- if (!r) throw Error(`FlowStory: step references unknown edge "${e.edge}"`);
300
- return {
301
- edgeId: r.id,
302
- direction: e.reverse ? "reverse" : "forward",
303
- ...n
304
- };
305
- }
306
- let r = t.find((t) => t.source === e.from && t.target === e.to);
307
- if (r) return {
308
- edgeId: r.id,
309
- direction: "forward",
310
- ...n
311
- };
312
- let i = t.find((t) => t.source === e.to && t.target === e.from);
313
- if (i) return {
314
- edgeId: i.id,
315
- direction: "reverse",
316
- ...n
317
- };
318
- throw Error(`FlowStory: no edge connects "${e.from}" and "${e.to}"`);
319
- }
320
- function te(e, t) {
321
- return e.map((e) => ee(e, t));
322
- }
323
- //#endregion
324
- //#region src/core/use-viewport.ts
325
- var H = 1.2;
326
- function U(e, t = {}) {
327
- let { minZoom: n = .2, maxZoom: i = 2, panOnDrag: o = !0, zoomOnScroll: c = !0, fitPadding: l = .1, fitOnInit: d = !1 } = t, { viewport: f, setViewport: p } = e, { ref: m, size: h } = a(), { handleRef: g, offset: _, isDragging: v } = r({ isDisabled: !o }), y = (e, t) => {
328
- let n = f.peek();
329
- p({
330
- x: n.x + e,
331
- y: n.y + t,
332
- zoom: n.zoom
333
- });
334
- }, S = (e, t) => {
335
- let r = f.peek(), a = b(e, n, i);
336
- if (!t) {
337
- p({
338
- x: r.x,
339
- y: r.y,
340
- zoom: a
341
- });
342
- return;
343
- }
344
- let o = x(t, r);
345
- p({
346
- x: t.x - o.x * a,
347
- y: t.y - o.y * a,
348
- zoom: a
349
- });
350
- }, C = () => {
351
- let e = m.current;
352
- if (e) return {
353
- x: e.clientWidth / 2,
354
- y: e.clientHeight / 2
355
- };
356
- }, w = () => S(f.peek().zoom * H, C()), T = () => S(f.peek().zoom / H, C()), O = () => {
357
- let e = h.peek();
358
- if (e && e.width > 0 && e.height > 0) return e;
359
- let t = m.current;
360
- return t && t.clientWidth > 0 ? {
361
- width: t.clientWidth,
362
- height: t.clientHeight
363
- } : null;
364
- }, k = (t) => {
365
- let r = E(e.nodes.peek());
366
- if (!r) return;
367
- let a = t ?? O();
368
- a && p(D(r, a, {
369
- padding: l,
370
- minZoom: n,
371
- maxZoom: i
372
- }));
373
- }, A = u(null);
374
- s(() => {
375
- let e = v.value, t = _.value;
376
- if (!o) return;
377
- if (!e) {
378
- A.current = null;
379
- return;
380
- }
381
- A.current ||= {
382
- vp: f.peek(),
383
- off: t
384
- };
385
- let n = A.current;
386
- p({
387
- x: n.vp.x + (t.x - n.off.x),
388
- y: n.vp.y + (t.y - n.off.y),
389
- zoom: n.vp.zoom
390
- });
391
- }), s(() => {
392
- if (!c || typeof window > "u") return;
393
- let e = m.current;
394
- if (!e) return;
395
- let t = (t) => {
396
- t.preventDefault();
397
- let n = e.getBoundingClientRect(), r = {
398
- x: t.clientX - n.left,
399
- y: t.clientY - n.top
400
- }, i = t.deltaY < 0 ? H : 1 / H;
401
- S(f.peek().zoom * i, r);
402
- };
403
- return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
404
- });
405
- let j = u(!1);
406
- return s(() => {
407
- if (!d || j.current) return;
408
- let e = h.value;
409
- !e || e.width === 0 || (j.current = !0, k(e));
410
- }), {
411
- containerRef: m,
412
- panHandleRef: g,
413
- viewport: f,
414
- pan: y,
415
- zoomTo: S,
416
- zoomIn: w,
417
- zoomOut: T,
418
- fitView: k
419
- };
420
- }
421
- //#endregion
422
- //#region src/core/use-connection.ts
423
- var ne = "[data-flow-handle][data-handle-type=\"source\"]", re = "[data-flow-handle][data-handle-type=\"target\"]";
424
- function ie(e) {
425
- let { containerRef: t } = e, n = o(null), r = u(e.onConnect);
426
- r.current = e.onConnect;
427
- let a = u(e.isValid);
428
- a.current = e.isValid;
429
- let c = u(e.clientToFlow);
430
- c.current = e.clientToFlow;
431
- let l = i(e.enabled ?? !0);
432
- return s(() => {
433
- if (!l.value || typeof window > "u") return;
434
- let e = t.current;
435
- if (!e) return;
436
- let i = (e) => {
437
- let t = n.peek();
438
- t && (n.value = {
439
- ...t,
440
- to: c.current(e.clientX, e.clientY)
441
- });
442
- }, o = (e) => {
443
- let t = n.peek();
444
- if (window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), n.value = null, !t) return;
445
- let s = e.target, c = s instanceof Element ? s.closest(re) : null, l = c?.closest("[data-node-id]");
446
- if (!l) return;
447
- let u = {
448
- source: t.source,
449
- target: l.getAttribute("data-node-id") ?? "",
450
- sourceHandle: t.sourceHandle,
451
- targetHandle: c?.getAttribute("data-handle-id") ?? void 0
452
- };
453
- !u.target || u.source === u.target || a.current && !a.current(u) || r.current?.(u);
454
- }, s = (e) => {
455
- let t = e.target;
456
- if (!(t instanceof Element)) return;
457
- let r = t.closest(ne);
458
- if (!r) return;
459
- let a = r.closest("[data-node-id]");
460
- if (!a) return;
461
- e.stopPropagation();
462
- let s = r.getBoundingClientRect();
463
- n.value = {
464
- source: a.getAttribute("data-node-id") ?? "",
465
- sourceHandle: r.getAttribute("data-handle-id") ?? void 0,
466
- from: c.current(s.left + s.width / 2, s.top + s.height / 2),
467
- to: c.current(e.clientX, e.clientY)
468
- }, window.addEventListener("pointermove", i), window.addEventListener("pointerup", o);
469
- };
470
- return e.addEventListener("pointerdown", s), () => {
471
- e.removeEventListener("pointerdown", s), window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o);
472
- };
473
- }), { connection: n };
474
- }
475
- //#endregion
476
- //#region src/core/use-story.ts
477
- var ae = 1500;
478
- function oe(e) {
479
- let { steps: r, loop: i = !0, stepDuration: a = ae, stepGap: o = 0 } = e, [c, l] = n({
480
- value: e.currentStep,
481
- defaultValue: e.defaultCurrentStep ?? 0,
482
- onChange: e.onStepChange
483
- }), [d, f] = n({
484
- value: e.playing,
485
- defaultValue: e.defaultPlaying ?? !0,
486
- onChange: e.onPlayingChange
487
- }), p = t(() => r[c.value] ?? null), m = u(e.clock);
488
- m.current = e.clock;
489
- let h = u(r);
490
- h.current = r;
491
- let g = () => m.current ?? {
492
- setTimeout: (e, t) => window.setTimeout(e, t),
493
- clearTimeout: (e) => window.clearTimeout(e)
494
- }, _ = (e) => {
495
- let t = h.current.length;
496
- if (t === 0) return;
497
- let n = c.peek() + e;
498
- l(i ? (n % t + t) % t : Math.max(0, Math.min(t - 1, n)));
499
- };
500
- return s(() => {
501
- if (!d.value) return;
502
- let e = c.value, t = r.length;
503
- if (t === 0 || typeof window > "u" && !m.current) return;
504
- let n = (r[e]?.duration ?? a) + o, s = g(), u = s.setTimeout(() => {
505
- let n = e + 1;
506
- n >= t ? i ? l(0) : f(!1) : l(n);
507
- }, n);
508
- return () => s.clearTimeout(u);
509
- }), {
510
- currentStep: c,
511
- playing: d,
512
- activeStep: p,
513
- play: () => f(!0),
514
- pause: () => f(!1),
515
- toggle: () => f(!d.peek()),
516
- next: () => _(1),
517
- prev: () => _(-1),
518
- restart: () => {
519
- l(0), f(!0);
520
- }
521
- };
522
- }
523
- var W = {
524
- canvas: "_canvas_6fiig_2",
525
- pane: "_pane_6fiig_13",
526
- panSurface: "_panSurface_6fiig_24"
527
- };
528
- //#endregion
529
- //#region src/core/flow-canvas/flow-canvas.tsx
530
- function se({ children: t, flow: n, viewport: r, defaultViewport: i, onViewportChange: a, minZoom: o, maxZoom: s, panOnDrag: l = !0, zoomOnScroll: u = !0, fitView: d = !1, controller: m, chrome: h, className: g, role: _ = "application", ...v }) {
531
- c();
532
- let b = y({
533
- viewport: r,
534
- defaultViewport: i,
535
- onViewportChange: a
536
- }), x = n ?? b, S = U(x, {
537
- minZoom: o,
538
- maxZoom: s,
539
- panOnDrag: l,
540
- zoomOnScroll: u,
541
- fitOnInit: d
542
- }), C = m ?? S, w = x.viewport.value;
543
- return /* @__PURE__ */ p("div", {
544
- ref: C.containerRef,
545
- className: e(W.canvas, g),
546
- role: _,
547
- ...v,
548
- children: [/* @__PURE__ */ p("div", {
549
- className: W.pane,
550
- style: {
551
- "--flow-tx": `${w.x}px`,
552
- "--flow-ty": `${w.y}px`,
553
- "--flow-scale": String(w.zoom)
554
- },
555
- children: [/* @__PURE__ */ f("div", {
556
- ref: C.panHandleRef,
557
- className: W.panSurface,
558
- "aria-hidden": "true"
559
- }), t]
560
- }), h]
561
- });
562
- }
563
- var ce = { background: "_background_1pu9x_2" };
564
- //#endregion
565
- //#region src/flows/flow-background/flow-background.tsx
566
- function le({ variant: e = "dots", gap: t = 20, size: n = 1, color: r, className: i, style: a, ...o }) {
567
- return /* @__PURE__ */ f("div", {
568
- "data-variant": e,
569
- "aria-hidden": "true",
570
- className: m(ce.background, i),
571
- style: {
572
- "--flow-bg-gap": `${t}px`,
573
- "--flow-bg-size": `${n}px`,
574
- "--flow-bg-thick": `${Math.max(1, n)}px`,
575
- ...r ? { "--flow-bg-color": r } : {},
576
- ...a
577
- },
578
- ...o
579
- });
580
- }
581
- var ue = { node: "_node_9zyg4_2" };
582
- //#endregion
583
- //#region src/flows/flow-node/flow-node.tsx
584
- function de({ id: t, position: i, defaultPosition: a, onPositionChange: o, onMeasure: l, zoom: d = 1, selected: p = !1, draggable: m = !0, interactive: h = !0, onSelect: g, children: _, className: v, onClick: y, onKeyDown: b, ...x }) {
585
- c();
586
- let S = m && h, [C, w] = n({
587
- value: i,
588
- defaultValue: a ?? i ?? {
589
- x: 0,
590
- y: 0
591
- },
592
- onChange: o
593
- }), { handleRef: T, targetRef: E, offset: D, isDragging: O } = r({ isDisabled: !S }), k = u(null), A = (e) => {
594
- k.current = e, T.current = e, E.current = e;
595
- }, j = u(l);
596
- j.current = l, s(() => {
597
- let e = k.current;
598
- if (!e || typeof ResizeObserver > "u") return;
599
- let t = () => {
600
- let t = e.offsetWidth, n = e.offsetHeight;
601
- t > 0 && n > 0 && j.current?.({
602
- width: t,
603
- height: n
604
- });
605
- };
606
- t();
607
- let n = new ResizeObserver(t);
608
- return n.observe(e), () => n.disconnect();
609
- });
610
- let M = u(d);
611
- M.current = d;
612
- let N = u(null);
613
- s(() => {
614
- let e = O.value, t = D.value;
615
- if (!S) return;
616
- if (!e) {
617
- N.current = null;
618
- return;
619
- }
620
- N.current ||= {
621
- pos: C.peek(),
622
- off: t
623
- };
624
- let n = N.current, r = M.current || 1;
625
- w({
626
- x: n.pos.x + (t.x - n.off.x) / r,
627
- y: n.pos.y + (t.y - n.off.y) / r
628
- });
629
- });
630
- let P = C.value;
631
- return /* @__PURE__ */ f("div", {
632
- ref: A,
633
- "data-node-id": t,
634
- "data-selected": p || void 0,
635
- "data-dragging": O.value || void 0,
636
- "data-static": !h || void 0,
637
- role: "group",
638
- tabIndex: h ? 0 : void 0,
639
- className: e(ue.node, v),
640
- style: {
641
- "--flow-x": `${P.x}px`,
642
- "--flow-y": `${P.y}px`
643
- },
644
- onClick: (e) => {
645
- h && g?.(t), y?.(e);
646
- },
647
- onKeyDown: (e) => {
648
- h && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), g?.(t)), b?.(e);
649
- },
650
- ...x,
651
- children: _
652
- });
653
- }
654
- var G = {
655
- handle: "_handle_8a1xa_2",
656
- dot: "_dot_8a1xa_41"
657
- };
658
- //#endregion
659
- //#region src/flows/flow-handle/flow-handle.tsx
660
- function fe(e) {
661
- return e === "source" ? "right" : "left";
662
- }
663
- function K({ type: e, position: t, id: n, isConnectable: r = !0, className: i, ...a }) {
664
- return /* @__PURE__ */ f("div", {
665
- "data-handle-type": e,
666
- "data-handle-pos": t ?? fe(e),
667
- "data-handle-id": n,
668
- "data-connectable": r || void 0,
669
- "data-flow-handle": "",
670
- tabIndex: r ? 0 : -1,
671
- className: m(G.handle, i),
672
- ...a,
673
- children: /* @__PURE__ */ f("span", {
674
- className: G.dot,
675
- "aria-hidden": "true"
676
- })
677
- });
678
- }
679
- var q = {
680
- edgeSvg: "_edgeSvg_789n0_2",
681
- edgePath: "_edgePath_789n0_11",
682
- hit: "_hit_789n0_18",
683
- arrow: "_arrow_789n0_26",
684
- "cascivo-flow-dash": "_cascivo-flow-dash_789n0_1",
685
- label: "_label_789n0_64"
686
- };
687
- //#endregion
688
- //#region src/flows/flow-edge/flow-edge.tsx
689
- function J({ id: t, sourceX: n, sourceY: r, targetX: i, targetY: a, sourcePosition: o = "right", targetPosition: s = "left", type: c = "bezier", animated: u = !1, label: m, selected: h = !1, markerStart: g = !1, markerEnd: _ = !0, direction: v = "forward", active: y, className: b }) {
690
- let x = l(), S = `flow-arrow-${t ?? x}`, C = g || _, { d: w, mid: T } = L(c, {
691
- source: {
692
- x: n,
693
- y: r
694
- },
695
- target: {
696
- x: i,
697
- y: a
698
- },
699
- sourcePosition: o,
700
- targetPosition: s
701
- });
702
- return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("svg", {
703
- className: e(q.edgeSvg, b),
704
- "data-edge-id": t,
705
- "data-animated": u || void 0,
706
- "data-selected": h || void 0,
707
- "data-active": y || void 0,
708
- "data-direction": v,
709
- "aria-hidden": "true",
710
- children: [
711
- C && /* @__PURE__ */ f("defs", { children: /* @__PURE__ */ f("marker", {
712
- id: S,
713
- viewBox: "0 0 10 10",
714
- refX: "9",
715
- refY: "5",
716
- markerWidth: "7",
717
- markerHeight: "7",
718
- orient: "auto-start-reverse",
719
- children: /* @__PURE__ */ f("path", {
720
- className: q.arrow,
721
- d: "M0,0 L10,5 L0,10 z"
722
- })
723
- }) }),
724
- /* @__PURE__ */ f("path", {
725
- className: q.hit,
726
- d: w
727
- }),
728
- /* @__PURE__ */ f("path", {
729
- className: q.edgePath,
730
- d: w,
731
- markerStart: g ? `url(#${S})` : void 0,
732
- markerEnd: _ ? `url(#${S})` : void 0
733
- })
734
- ]
735
- }), m != null && /* @__PURE__ */ f("div", {
736
- className: q.label,
737
- style: {
738
- "--flow-label-x": `${T.x}px`,
739
- "--flow-label-y": `${T.y}px`
740
- },
741
- children: m
742
- })] });
743
- }
744
- var Y = {
745
- controls: "_controls_s32im_2",
746
- button: "_button_s32im_32"
747
- }, X = {
748
- width: 18,
749
- height: 18,
750
- viewBox: "0 0 24 24",
751
- fill: "none",
752
- "aria-hidden": !0
753
- };
754
- function pe({ position: t = "bottom-left", showZoom: n = !0, showFitView: r = !0, onZoomIn: i, onZoomOut: a, onFitView: o, labels: s, className: l, ...u }) {
755
- return c(), /* @__PURE__ */ p("div", {
756
- "data-position": t,
757
- className: e(Y.controls, l),
758
- ...u,
759
- children: [n && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("button", {
760
- type: "button",
761
- className: Y.button,
762
- "aria-label": s?.zoomIn ?? g(h.flow.zoomIn),
763
- onClick: i,
764
- children: /* @__PURE__ */ f("svg", {
765
- ...X,
766
- children: /* @__PURE__ */ f("path", {
767
- d: "M12 5v14M5 12h14",
768
- stroke: "currentColor",
769
- strokeWidth: "2",
770
- strokeLinecap: "round"
771
- })
772
- })
773
- }), /* @__PURE__ */ f("button", {
774
- type: "button",
775
- className: Y.button,
776
- "aria-label": s?.zoomOut ?? g(h.flow.zoomOut),
777
- onClick: a,
778
- children: /* @__PURE__ */ f("svg", {
779
- ...X,
780
- children: /* @__PURE__ */ f("path", {
781
- d: "M5 12h14",
782
- stroke: "currentColor",
783
- strokeWidth: "2",
784
- strokeLinecap: "round"
785
- })
786
- })
787
- })] }), r && /* @__PURE__ */ f("button", {
788
- type: "button",
789
- className: Y.button,
790
- "aria-label": s?.fitView ?? g(h.flow.fitView),
791
- onClick: o,
792
- children: /* @__PURE__ */ f("svg", {
793
- ...X,
794
- children: /* @__PURE__ */ f("path", {
795
- d: "M4 9V5a1 1 0 0 1 1-1h4M15 4h4a1 1 0 0 1 1 1v4M20 15v4a1 1 0 0 1-1 1h-4M9 20H5a1 1 0 0 1-1-1v-4",
796
- stroke: "currentColor",
797
- strokeWidth: "2",
798
- strokeLinecap: "round",
799
- strokeLinejoin: "round"
800
- })
801
- })
802
- })]
803
- });
804
- }
805
- var Z = {
806
- minimap: "_minimap_rdahv_2",
807
- node: "_node_rdahv_28",
808
- viewport: "_viewport_rdahv_32"
809
- };
810
- //#endregion
811
- //#region src/flows/flow-minimap/flow-minimap.tsx
812
- function me({ nodes: t, viewport: n, containerWidth: i, containerHeight: a, width: o = 200, height: l = 150, position: d = "bottom-right", nodeColor: m, onViewportChange: _, label: v, ariaLabel: y, className: b }) {
813
- c();
814
- let S = E(t) ?? {
815
- x: 0,
816
- y: 0,
817
- width: 1,
818
- height: 1
819
- }, C = S.width || 1, T = S.height || 1, D = C * .1, O = T * .1, k = {
820
- x: S.x - D,
821
- y: S.y - O,
822
- width: C + D * 2,
823
- height: T + O * 2
824
- }, A = Math.min(o / k.width, l / k.height), j = -k.x * A + (o - k.width * A) / 2, M = -k.y * A + (l - k.height * A) / 2, N = (e) => ({
825
- x: e.x * A + j,
826
- y: e.y * A + M
827
- }), P = null;
828
- if (i && a) {
829
- let e = x({
830
- x: 0,
831
- y: 0
832
- }, n), t = x({
833
- x: i,
834
- y: a
835
- }, n), r = N(e);
836
- P = {
837
- x: r.x,
838
- y: r.y,
839
- w: (t.x - e.x) * A,
840
- h: (t.y - e.y) * A
841
- };
842
- }
843
- let { handleRef: F, offset: I, isDragging: L } = r({ isDisabled: !_ }), R = u(null), z = (e) => {
844
- R.current = e, F.current = e;
845
- }, B = u(_);
846
- B.current = _;
847
- let V = u(null);
848
- return s(() => {
849
- let e = L.value, t = I.value;
850
- if (!B.current) return;
851
- if (!e) {
852
- V.current = null;
853
- return;
854
- }
855
- V.current ||= {
856
- vp: n,
857
- off: t
858
- };
859
- let r = V.current, i = r.vp.zoom;
860
- B.current({
861
- x: r.vp.x - (t.x - r.off.x) / A * i,
862
- y: r.vp.y - (t.y - r.off.y) / A * i,
863
- zoom: i
864
- });
865
- }), /* @__PURE__ */ p("svg", {
866
- "data-position": d,
867
- className: e(Z.minimap, b),
868
- width: o,
869
- height: l,
870
- role: "img",
871
- "aria-label": y ?? v ?? g(h.flow.minimap),
872
- children: [t.map((e) => {
873
- let t = w(e), n = N({
874
- x: t.x,
875
- y: t.y
876
- });
877
- return /* @__PURE__ */ f("rect", {
878
- "data-node-id": e.id,
879
- className: Z.node,
880
- x: n.x,
881
- y: n.y,
882
- width: t.width * A,
883
- height: t.height * A,
884
- fill: m
885
- }, e.id);
886
- }), P && /* @__PURE__ */ f("rect", {
887
- ref: z,
888
- "data-viewport": "",
889
- className: Z.viewport,
890
- x: P.x,
891
- y: P.y,
892
- width: P.w,
893
- height: P.h
894
- })]
895
- });
896
- }
897
- var he = { panel: "_panel_l0cix_2" };
898
- //#endregion
899
- //#region src/flows/flow-panel/flow-panel.tsx
900
- function ge({ position: e = "top-right", children: t, className: n, ...r }) {
901
- return /* @__PURE__ */ f("div", {
902
- "data-position": e,
903
- className: m(he.panel, n),
904
- ...r,
905
- children: t
906
- });
907
- }
908
- var _e = { flow: "_flow_vejge_2" }, ve = 0;
909
- function ye({ nodes: t, edges: n, onNodesChange: r, onEdgesChange: i, onConnect: a, nodeTypes: s, fitView: l = !0, background: u = !1, controls: m = !1, minimap: h = !1, layout: g, minZoom: _, maxZoom: v, interactive: b = !0, activeEdgeId: S, activeDirection: C, className: w, style: E }) {
910
- c();
911
- let D = y({
912
- defaultNodes: g ? B(t, n, g) : t,
913
- defaultEdges: n,
914
- onNodesChange: r,
915
- onEdgesChange: i
916
- }), O = U(D, {
917
- minZoom: _,
918
- maxZoom: v,
919
- fitOnInit: l
920
- }), { connection: k } = ie({
921
- containerRef: O.containerRef,
922
- clientToFlow: (e, t) => {
923
- let n = O.containerRef.current?.getBoundingClientRect();
924
- return x({
925
- x: e - (n?.left ?? 0),
926
- y: t - (n?.top ?? 0)
927
- }, D.viewport.peek());
928
- },
929
- enabled: b,
930
- onConnect: (e) => {
931
- D.addEdge({
932
- id: `e-${++ve}`,
933
- source: e.source,
934
- target: e.target
935
- }), a?.(e);
936
- }
937
- }), A = (e) => {
938
- D.setNodes(D.nodes.value.map((t) => ({
939
- ...t,
940
- selected: t.id === e
941
- })));
942
- }, j = o({}), M = (e, t) => {
943
- let n = j.peek()[e];
944
- n && n.width === t.width && n.height === t.height || (j.value = {
945
- ...j.peek(),
946
- [e]: t
947
- });
948
- }, N = D.nodes.value, P = D.edges.value, F = D.viewport.value.zoom, I = j.value, L = new Map(N.map((e) => {
949
- let t = I[e.id];
950
- return [e.id, t ? {
951
- ...e,
952
- width: t.width,
953
- height: t.height
954
- } : e];
955
- })), R = k.value;
956
- return /* @__PURE__ */ p(se, {
957
- flow: D,
958
- controller: O,
959
- minZoom: _,
960
- maxZoom: v,
961
- chrome: /* @__PURE__ */ p(d, { children: [m && /* @__PURE__ */ f(pe, {
962
- onZoomIn: O.zoomIn,
963
- onZoomOut: O.zoomOut,
964
- onFitView: () => O.fitView()
965
- }), h && /* @__PURE__ */ f(me, {
966
- nodes: N,
967
- viewport: D.viewport.value,
968
- containerWidth: O.containerRef.current?.clientWidth,
969
- containerHeight: O.containerRef.current?.clientHeight,
970
- onViewportChange: D.setViewport
971
- })] }),
972
- className: e(_e.flow, w),
973
- style: E,
974
- children: [
975
- u && /* @__PURE__ */ f(le, { ...typeof u == "object" ? u : {} }),
976
- P.map((e) => {
977
- let t = L.get(e.source), n = L.get(e.target);
978
- if (!t || !n) return null;
979
- let r = T(t, "right"), i = T(n, "left"), a = S === e.id, o = a ? C : void 0, s = o === "reverse" ? !0 : o === "forward" ? !1 : e.markerStart ?? !1, c = o === "reverse" ? !1 : o === "forward" ? !0 : e.markerEnd ?? !0;
980
- return /* @__PURE__ */ f(J, {
981
- id: e.id,
982
- sourceX: r.x,
983
- sourceY: r.y,
984
- targetX: i.x,
985
- targetY: i.y,
986
- type: e.type ?? "bezier",
987
- animated: e.animated || a,
988
- active: a,
989
- direction: o,
990
- markerStart: s,
991
- markerEnd: c,
992
- label: e.label,
993
- selected: e.selected
994
- }, e.id);
995
- }),
996
- R && /* @__PURE__ */ f(J, {
997
- sourceX: R.from.x,
998
- sourceY: R.from.y,
999
- targetX: R.to.x,
1000
- targetY: R.to.y,
1001
- markerEnd: !1
1002
- }),
1003
- N.map((e) => /* @__PURE__ */ f(de, {
1004
- id: e.id,
1005
- position: e.position,
1006
- zoom: F,
1007
- interactive: b,
1008
- selected: e.selected ?? !1,
1009
- onSelect: b ? A : void 0,
1010
- onMeasure: (t) => M(e.id, t),
1011
- onPositionChange: (t) => D.updateNode(e.id, { position: t }),
1012
- children: s && e.type && s[e.type] ? s[e.type]({ node: e }) : /* @__PURE__ */ p(d, { children: [
1013
- /* @__PURE__ */ f("span", { children: String(e.data?.label ?? e.id) }),
1014
- b && /* @__PURE__ */ f(K, {
1015
- type: "target",
1016
- position: "left"
1017
- }),
1018
- b && /* @__PURE__ */ f(K, {
1019
- type: "source",
1020
- position: "right"
1021
- })
1022
- ] })
1023
- }, e.id))
1024
- ]
1025
- });
1026
- }
1027
- var Q = {
1028
- story: "_story_btt88_2",
1029
- overlay: "_overlay_btt88_7",
1030
- caption: "_caption_btt88_20",
1031
- captionText: "_captionText_btt88_36",
1032
- captionDesc: "_captionDesc_btt88_48",
1033
- controls: "_controls_btt88_52",
1034
- button: "_button_btt88_64",
1035
- indicator: "_indicator_btt88_93"
1036
- }, $ = {
1037
- width: 18,
1038
- height: 18,
1039
- viewBox: "0 0 24 24",
1040
- fill: "currentColor",
1041
- "aria-hidden": !0
1042
- };
1043
- function be({ nodes: t, edges: n, script: r, loop: i = !0, stepDuration: a = 1500, stepGap: o = 0, playing: s, currentStep: l, onStepChange: u, controls: d = !0, autoPlay: m = !0, background: _ = !0, interactive: v = !1, labels: y, clock: b, className: x, style: S }) {
1044
- c();
1045
- let C = te(r, n), w = oe({
1046
- steps: C,
1047
- loop: i,
1048
- stepDuration: a,
1049
- stepGap: o,
1050
- playing: s,
1051
- defaultPlaying: m,
1052
- currentStep: l,
1053
- defaultCurrentStep: 0,
1054
- onStepChange: u,
1055
- clock: b
1056
- }), T = w.activeStep.value, E = w.currentStep.value, D = w.playing.value;
1057
- return /* @__PURE__ */ p("div", {
1058
- className: e(Q.story, x),
1059
- style: S,
1060
- children: [/* @__PURE__ */ f(ye, {
1061
- nodes: t,
1062
- edges: n,
1063
- background: _,
1064
- interactive: v,
1065
- activeEdgeId: T?.edgeId,
1066
- activeDirection: T?.direction
1067
- }), /* @__PURE__ */ p("div", {
1068
- className: Q.overlay,
1069
- children: [/* @__PURE__ */ f("div", {
1070
- className: Q.caption,
1071
- "aria-live": "polite",
1072
- children: T?.label && /* @__PURE__ */ p("span", {
1073
- className: Q.captionText,
1074
- children: [/* @__PURE__ */ f("strong", { children: T.label }), T.description && /* @__PURE__ */ p("span", {
1075
- className: Q.captionDesc,
1076
- children: [" — ", T.description]
1077
- })]
1078
- }, E)
1079
- }), d && /* @__PURE__ */ p("div", {
1080
- className: Q.controls,
1081
- children: [
1082
- /* @__PURE__ */ f("button", {
1083
- type: "button",
1084
- className: Q.button,
1085
- "aria-label": y?.previous ?? g(h.flow.previous),
1086
- onClick: w.prev,
1087
- children: /* @__PURE__ */ f("svg", {
1088
- ...$,
1089
- children: /* @__PURE__ */ f("path", {
1090
- d: "M15 6 9 12l6 6",
1091
- stroke: "currentColor",
1092
- strokeWidth: "2",
1093
- fill: "none"
1094
- })
1095
- })
1096
- }),
1097
- /* @__PURE__ */ f("button", {
1098
- type: "button",
1099
- className: Q.button,
1100
- "aria-label": D ? y?.pause ?? g(h.flow.pause) : y?.play ?? g(h.flow.play),
1101
- "aria-pressed": D,
1102
- onClick: w.toggle,
1103
- children: D ? /* @__PURE__ */ f("svg", {
1104
- ...$,
1105
- children: /* @__PURE__ */ f("path", { d: "M7 5h3v14H7zM14 5h3v14h-3z" })
1106
- }) : /* @__PURE__ */ f("svg", {
1107
- ...$,
1108
- children: /* @__PURE__ */ f("path", { d: "M7 5l11 7-11 7z" })
1109
- })
1110
- }),
1111
- /* @__PURE__ */ f("button", {
1112
- type: "button",
1113
- className: Q.button,
1114
- "aria-label": y?.next ?? g(h.flow.next),
1115
- onClick: w.next,
1116
- children: /* @__PURE__ */ f("svg", {
1117
- ...$,
1118
- children: /* @__PURE__ */ f("path", {
1119
- d: "M9 6l6 6-6 6",
1120
- stroke: "currentColor",
1121
- strokeWidth: "2",
1122
- fill: "none"
1123
- })
1124
- })
1125
- }),
1126
- /* @__PURE__ */ f("span", {
1127
- className: Q.indicator,
1128
- children: g(h.flow.step, {
1129
- current: E + 1,
1130
- total: C.length
1131
- })
1132
- })
1133
- ]
1134
- })]
1135
- })]
1136
- });
1137
- }
1138
- //#endregion
1139
- export { _ as DEFAULT_NODE_SIZE, ye as Flow, le as FlowBackground, se as FlowCanvas, pe as FlowControls, J as FlowEdge, K as FlowHandle, me as FlowMiniMap, de as FlowNode, ge as FlowPanel, be as FlowStory, B as applyLayout, M as bezierPath, b as clampZoom, L as edgePath, D as fitViewport, S as flowToScreen, E as graphBounds, R as gridLayout, T as handleAnchor, z as layeredLayout, w as nodeBounds, C as nodeSize, te as resolveScript, ee as resolveStep, x as screenToFlow, I as smoothStepPath, j as straightPath, ie as useConnection, y as useFlow, oe as useStory, U as useViewport };
3
+ import{cn as e,useComputed as t,useControllableSignal as r,useDraggable as i,useEffectPropSignal as a,useResizeObserver as o,useSignal as s,useSignalEffect as c,useSignals as l}from"@cascivo/core";import{useId as u,useRef as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{cn as h}from"@cascivo/core/pure";import{builtin as g,t as _}from"@cascivo/i18n";var v={width:150,height:40},y={x:0,y:0,zoom:1};function useFlow(e={}){let[t,i]=r({value:e.nodes,defaultValue:e.defaultNodes??[],onChange:e.onNodesChange}),[a,o]=r({value:e.edges,defaultValue:e.defaultEdges??[],onChange:e.onEdgesChange}),[s,c]=r({value:e.viewport,defaultValue:e.defaultViewport??y,onChange:e.onViewportChange});return{nodes:t,edges:a,viewport:s,setNodes:i,updateNode:(e,r)=>{i(t.value.map(t=>t.id===e?{...t,...r}:t))},setEdges:o,addEdge:e=>{o([...a.value,e])},setViewport:c}}function clampZoom(e,t=.2,r=2){return Math.min(r,Math.max(t,e))}function screenToFlow(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function flowToScreen(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function nodeSize(e){return{width:e.width??v.width,height:e.height??v.height}}function nodeBounds(e){let{width:t,height:r}=nodeSize(e);return{x:e.position.x,y:e.position.y,width:t,height:r}}function handleAnchor(e,t){let{x:r,y:i,width:a,height:o}=nodeBounds(e);switch(t){case`top`:return{x:r+a/2,y:i};case`right`:return{x:r+a,y:i+o/2};case`bottom`:return{x:r+a/2,y:i+o};case`left`:return{x:r,y:i+o/2}}}function graphBounds(e){if(e.length===0)return null;let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let o of e){let e=nodeBounds(o);t=Math.min(t,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+e.width),a=Math.max(a,e.y+e.height)}return{x:t,y:r,width:i-t,height:a-r}}function fitViewport(e,t,r={}){let{padding:i=.1,minZoom:a=.2,maxZoom:o=2}=r;if(e.width<=0||e.height<=0||t.width<=0||t.height<=0)return{x:t.width/2-e.x,y:t.height/2-e.y,zoom:1};let s=t.width/(e.width*(1+i*2)),c=t.height/(e.height*(1+i*2)),l=clampZoom(Math.min(s,c),a,o);return{x:t.width/2-(e.x+e.width/2)*l,y:t.height/2-(e.y+e.height/2)*l,zoom:l}}var n=e=>Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,``),midpoint=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2});function normal(e){switch(e){case`top`:return{x:0,y:-1};case`bottom`:return{x:0,y:1};case`left`:return{x:-1,y:0};case`right`:return{x:1,y:0}}}function straightPath({source:e,target:t}){return{d:`M${n(e.x)},${n(e.y)} L${n(t.x)},${n(t.y)}`,mid:midpoint(e,t)}}function bezierPath(e){let{source:t,target:r,curvature:i=.25}=e,a=e.sourcePosition??`right`,o=e.targetPosition??`left`,s=Math.hypot(r.x-t.x,r.y-t.y),c=Math.max(i*s,20),l=normal(a),u=normal(o),d={x:t.x+l.x*c,y:t.y+l.y*c},f={x:r.x+u.x*c,y:r.y+u.y*c},p={x:(t.x+3*d.x+3*f.x+r.x)/8,y:(t.y+3*d.y+3*f.y+r.y)/8};return{d:`M${n(t.x)},${n(t.y)} C${n(d.x)},${n(d.y)} ${n(f.x)},${n(f.y)} ${n(r.x)},${n(r.y)}`,mid:p}}function len(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function towards(e,t,r){let i=len(e,t)||1;return{x:e.x+(t.x-e.x)/i*r,y:e.y+(t.y-e.y)/i*r}}function roundedPath(e,t){if(e.length<2)return``;let r=e[0],i=`M${n(r.x)},${n(r.y)}`;for(let r=1;r<e.length-1;r++){let a=e[r-1],o=e[r],s=e[r+1],c=Math.min(t,len(a,o)/2,len(o,s)/2),l=towards(o,a,c),u=towards(o,s,c);i+=` L${n(l.x)},${n(l.y)} Q${n(o.x)},${n(o.y)} ${n(u.x)},${n(u.y)}`}let a=e[e.length-1];return i+=` L${n(a.x)},${n(a.y)}`,i}function smoothStepPath(e){let{source:t,target:r,borderRadius:i=8}=e,a=e.sourcePosition??`right`,o=a===`left`||a===`right`,s=[t];if(o){let e=(t.x+r.x)/2;s.push({x:e,y:t.y},{x:e,y:r.y})}else{let e=(t.y+r.y)/2;s.push({x:t.x,y:e},{x:r.x,y:e})}return s.push(r),{d:roundedPath(s,i),mid:midpoint(t,r)}}function edgePath(e,t){switch(e){case`straight`:return straightPath(t);case`smoothstep`:return smoothStepPath(t);case`bezier`:return bezierPath(t)}}function gridLayout(e,t={}){let r=t.gap??40,i=t.nodeWidth??v.width,a=t.nodeHeight??v.height,o=t.columns??Math.max(1,Math.ceil(Math.sqrt(e.length)));return e.map((e,t)=>{let s=t%o,c=Math.floor(t/o);return{...e,position:{x:s*(i+r),y:c*(a+r)}}})}function layeredLayout(e,t,r={}){let i=r.direction??`LR`,a=r.gap??60,o=r.nodeWidth??v.width,s=r.nodeHeight??v.height,c=new Set(e.map(e=>e.id)),l=new Map,u=new Map;for(let t of e)u.set(t.id,0);for(let e of t)!c.has(e.source)||!c.has(e.target)||(l.set(e.source,[...l.get(e.source)??[],e.target]),u.set(e.target,(u.get(e.target)??0)+1));let d=new Map,f=e.filter(e=>(u.get(e.id)??0)===0).map(e=>e.id);for(let e of f)d.set(e,0);let p=new Map(u);for(;f.length>0;){let e=[];for(let t of f){let r=d.get(t)??0;for(let i of l.get(t)??[])d.set(i,Math.max(d.get(i)??0,r+1)),p.set(i,(p.get(i)??0)-1),(p.get(i)??0)===0&&e.push(i)}f=e}for(let t of e)d.has(t.id)||d.set(t.id,0);let m=new Map,h=new Map;for(let t of e){let e=d.get(t.id)??0,r=h.get(e)??0;m.set(t.id,r),h.set(e,r+1)}return e.map(e=>{let t=d.get(e.id)??0,r=m.get(e.id)??0,c=i===`LR`?{x:t*(o+a),y:r*(s+a)}:{x:r*(o+a),y:t*(s+a)};return{...e,position:c}})}function applyLayout(e,t,r){return r===`grid`?gridLayout(e):r===`layered`?layeredLayout(e,t):r(e,t)}function isEdgeStep(e){return`edge`in e}function resolveStep(e,t){let r={label:e.label,description:e.description,duration:e.duration};if(isEdgeStep(e)){let i=t.find(t=>t.id===e.edge);if(!i)throw Error(`FlowStory: step references unknown edge "${e.edge}"`);return{edgeId:i.id,direction:e.reverse?`reverse`:`forward`,...r}}let i=t.find(t=>t.source===e.from&&t.target===e.to);if(i)return{edgeId:i.id,direction:`forward`,...r};let a=t.find(t=>t.source===e.to&&t.target===e.from);if(a)return{edgeId:a.id,direction:`reverse`,...r};throw Error(`FlowStory: no edge connects "${e.from}" and "${e.to}"`)}function resolveScript(e,t){return e.map(e=>resolveStep(e,t))}var b=1.2;function useViewport(e,t={}){let{minZoom:r=.2,maxZoom:a=2,panOnDrag:s=!0,zoomOnScroll:l=!0,fitPadding:u=.1,fitOnInit:f=!1}=t,{viewport:p,setViewport:m}=e,{ref:h,size:g}=o(),{handleRef:_,offset:v,isDragging:y}=i({isDisabled:!s}),pan=(e,t)=>{let r=p.peek();m({x:r.x+e,y:r.y+t,zoom:r.zoom})},zoomTo=(e,t)=>{let i=p.peek(),o=clampZoom(e,r,a);if(!t){m({x:i.x,y:i.y,zoom:o});return}let s=screenToFlow(t,i);m({x:t.x-s.x*o,y:t.y-s.y*o,zoom:o})},containerCenter=()=>{let e=h.current;if(e)return{x:e.clientWidth/2,y:e.clientHeight/2}},zoomIn=()=>zoomTo(p.peek().zoom*b,containerCenter()),zoomOut=()=>zoomTo(p.peek().zoom/b,containerCenter()),measuredSize=()=>{let e=g.peek();if(e&&e.width>0&&e.height>0)return e;let t=h.current;return t&&t.clientWidth>0?{width:t.clientWidth,height:t.clientHeight}:null},fitView=t=>{let i=graphBounds(e.nodes.peek());if(!i)return;let o=t??measuredSize();o&&m(fitViewport(i,o,{padding:u,minZoom:r,maxZoom:a}))},x=d(null);c(()=>{let e=y.value,t=v.value;if(!s)return;if(!e){x.current=null;return}x.current||={vp:p.peek(),off:t};let r=x.current;m({x:r.vp.x+(t.x-r.off.x),y:r.vp.y+(t.y-r.off.y),zoom:r.vp.zoom})}),c(()=>{if(!l||typeof window>`u`)return;let e=h.current;if(!e)return;let onWheel=t=>{t.preventDefault();let r=e.getBoundingClientRect(),i={x:t.clientX-r.left,y:t.clientY-r.top},a=t.deltaY<0?b:1/b;zoomTo(p.peek().zoom*a,i)};return e.addEventListener(`wheel`,onWheel,{passive:!1}),()=>e.removeEventListener(`wheel`,onWheel)});let S=d(!1);return c(()=>{if(!f||S.current)return;let e=g.value;!e||e.width===0||(S.current=!0,fitView(e))}),{containerRef:h,panHandleRef:_,viewport:p,pan,zoomTo,zoomIn,zoomOut,fitView}}var x=`[data-flow-handle][data-handle-type="source"]`,S=`[data-flow-handle][data-handle-type="target"]`;function useConnection(e){let{containerRef:t}=e,r=s(null),i=d(e.onConnect);i.current=e.onConnect;let o=d(e.isValid);o.current=e.isValid;let l=d(e.clientToFlow);l.current=e.clientToFlow;let u=a(e.enabled??!0);return c(()=>{if(!u.value||typeof window>`u`)return;let e=t.current;if(!e)return;let onMove=e=>{let t=r.peek();t&&(r.value={...t,to:l.current(e.clientX,e.clientY)})},onUp=e=>{let t=r.peek();if(window.removeEventListener(`pointermove`,onMove),window.removeEventListener(`pointerup`,onUp),r.value=null,!t)return;let a=e.target,s=a instanceof Element?a.closest(S):null,c=s?.closest(`[data-node-id]`);if(!c)return;let l={source:t.source,target:c.getAttribute(`data-node-id`)??``,sourceHandle:t.sourceHandle,targetHandle:s?.getAttribute(`data-handle-id`)??void 0};!l.target||l.source===l.target||o.current&&!o.current(l)||i.current?.(l)},onDown=e=>{let t=e.target;if(!(t instanceof Element))return;let i=t.closest(x);if(!i)return;let a=i.closest(`[data-node-id]`);if(!a)return;e.stopPropagation();let o=i.getBoundingClientRect();r.value={source:a.getAttribute(`data-node-id`)??``,sourceHandle:i.getAttribute(`data-handle-id`)??void 0,from:l.current(o.left+o.width/2,o.top+o.height/2),to:l.current(e.clientX,e.clientY)},window.addEventListener(`pointermove`,onMove),window.addEventListener(`pointerup`,onUp)};return e.addEventListener(`pointerdown`,onDown),()=>{e.removeEventListener(`pointerdown`,onDown),window.removeEventListener(`pointermove`,onMove),window.removeEventListener(`pointerup`,onUp)}}),{connection:r}}var C=1500;function useStory(e){let{steps:i,loop:a=!0,stepDuration:o=C,stepGap:s=0}=e,[l,u]=r({value:e.currentStep,defaultValue:e.defaultCurrentStep??0,onChange:e.onStepChange}),[f,p]=r({value:e.playing,defaultValue:e.defaultPlaying??!0,onChange:e.onPlayingChange}),m=t(()=>i[l.value]??null),h=d(e.clock);h.current=e.clock;let g=d(i);g.current=i;let clock=()=>h.current??{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)},advance=e=>{let t=g.current.length;if(t===0)return;let r=l.peek()+e;u(a?(r%t+t)%t:Math.max(0,Math.min(t-1,r)))};return c(()=>{if(!f.value)return;let e=l.value,t=i.length;if(t===0||typeof window>`u`&&!h.current)return;let r=(i[e]?.duration??o)+s,c=clock(),d=c.setTimeout(()=>{let r=e+1;r>=t?a?u(0):p(!1):u(r)},r);return()=>c.clearTimeout(d)}),{currentStep:l,playing:f,activeStep:m,play:()=>p(!0),pause:()=>p(!1),toggle:()=>p(!f.peek()),next:()=>advance(1),prev:()=>advance(-1),restart:()=>{u(0),p(!0)}}}var w={canvas:`_canvas_6fiig_2`,pane:`_pane_6fiig_13`,panSurface:`_panSurface_6fiig_24`};function FlowCanvas({children:t,flow:r,viewport:i,defaultViewport:a,onViewportChange:o,minZoom:s,maxZoom:c,panOnDrag:u=!0,zoomOnScroll:d=!0,fitView:f=!1,controller:h,chrome:g,className:_,role:v=`application`,...y}){l();let b=useFlow({viewport:i,defaultViewport:a,onViewportChange:o}),x=r??b,S=useViewport(x,{minZoom:s,maxZoom:c,panOnDrag:u,zoomOnScroll:d,fitOnInit:f}),C=h??S,T=x.viewport.value;return m(`div`,{ref:C.containerRef,className:e(w.canvas,_),role:v,...y,children:[m(`div`,{className:w.pane,style:{"--flow-tx":`${T.x}px`,"--flow-ty":`${T.y}px`,"--flow-scale":String(T.zoom)},children:[p(`div`,{ref:C.panHandleRef,className:w.panSurface,"aria-hidden":`true`}),t]}),g]})}var T={background:`_background_1pu9x_2`};function FlowBackground({variant:e=`dots`,gap:t=20,size:r=1,color:i,className:a,style:o,...s}){return p(`div`,{"data-variant":e,"aria-hidden":`true`,className:h(T.background,a),style:{"--flow-bg-gap":`${t}px`,"--flow-bg-size":`${r}px`,"--flow-bg-thick":`${Math.max(1,r)}px`,...i?{"--flow-bg-color":i}:{},...o},...s})}var E={node:`_node_9zyg4_2`};function FlowNode({id:t,position:a,defaultPosition:o,onPositionChange:s,onMeasure:u,zoom:f=1,selected:m=!1,draggable:h=!0,interactive:g=!0,onSelect:_,children:v,className:y,onClick:b,onKeyDown:x,...S}){l();let C=h&&g,[w,T]=r({value:a,defaultValue:o??a??{x:0,y:0},onChange:s}),{handleRef:D,targetRef:O,offset:k,isDragging:A}=i({isDisabled:!C}),j=d(null),setRefs=e=>{j.current=e,D.current=e,O.current=e},M=d(u);M.current=u,c(()=>{let e=j.current;if(!e||typeof ResizeObserver>`u`)return;let report=()=>{let t=e.offsetWidth,r=e.offsetHeight;t>0&&r>0&&M.current?.({width:t,height:r})};report();let t=new ResizeObserver(report);return t.observe(e),()=>t.disconnect()});let N=d(f);N.current=f;let P=d(null);c(()=>{let e=A.value,t=k.value;if(!C)return;if(!e){P.current=null;return}P.current||={pos:w.peek(),off:t};let r=P.current,i=N.current||1;T({x:r.pos.x+(t.x-r.off.x)/i,y:r.pos.y+(t.y-r.off.y)/i})});let F=w.value;return p(`div`,{ref:setRefs,"data-node-id":t,"data-selected":m||void 0,"data-dragging":A.value||void 0,"data-static":!g||void 0,role:`group`,tabIndex:g?0:void 0,className:e(E.node,y),style:{"--flow-x":`${F.x}px`,"--flow-y":`${F.y}px`},onClick:e=>{g&&_?.(t),b?.(e)},onKeyDown:e=>{g&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_?.(t)),x?.(e)},...S,children:v})}var D={handle:`_handle_8a1xa_2`,dot:`_dot_8a1xa_41`};function defaultPosition(e){return e===`source`?`right`:`left`}function FlowHandle({type:e,position:t,id:r,isConnectable:i=!0,className:a,...o}){return p(`div`,{"data-handle-type":e,"data-handle-pos":t??defaultPosition(e),"data-handle-id":r,"data-connectable":i||void 0,"data-flow-handle":``,tabIndex:i?0:-1,className:h(D.handle,a),...o,children:p(`span`,{className:D.dot,"aria-hidden":`true`})})}var O={edgeSvg:`_edgeSvg_789n0_2`,edgePath:`_edgePath_789n0_11`,hit:`_hit_789n0_18`,arrow:`_arrow_789n0_26`,"cascivo-flow-dash":`_cascivo-flow-dash_789n0_1`,label:`_label_789n0_64`};function FlowEdge({id:t,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s=`right`,targetPosition:c=`left`,type:l=`bezier`,animated:d=!1,label:h,selected:g=!1,markerStart:_=!1,markerEnd:v=!0,direction:y=`forward`,active:b,className:x}){let S=u(),C=`flow-arrow-${t??S}`,w=_||v,{d:T,mid:E}=edgePath(l,{source:{x:r,y:i},target:{x:a,y:o},sourcePosition:s,targetPosition:c});return m(f,{children:[m(`svg`,{className:e(O.edgeSvg,x),"data-edge-id":t,"data-animated":d||void 0,"data-selected":g||void 0,"data-active":b||void 0,"data-direction":y,"aria-hidden":`true`,children:[w&&p(`defs`,{children:p(`marker`,{id:C,viewBox:`0 0 10 10`,refX:`9`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto-start-reverse`,children:p(`path`,{className:O.arrow,d:`M0,0 L10,5 L0,10 z`})})}),p(`path`,{className:O.hit,d:T}),p(`path`,{className:O.edgePath,d:T,markerStart:_?`url(#${C})`:void 0,markerEnd:v?`url(#${C})`:void 0})]}),h!=null&&p(`div`,{className:O.label,style:{"--flow-label-x":`${E.x}px`,"--flow-label-y":`${E.y}px`},children:h})]})}var k={controls:`_controls_s32im_2`,button:`_button_s32im_32`},A={width:18,height:18,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":!0};function FlowControls({position:t=`bottom-left`,showZoom:r=!0,showFitView:i=!0,onZoomIn:a,onZoomOut:o,onFitView:s,labels:c,className:u,...d}){return l(),m(`div`,{"data-position":t,className:e(k.controls,u),...d,children:[r&&m(f,{children:[p(`button`,{type:`button`,className:k.button,"aria-label":c?.zoomIn??_(g.flow.zoomIn),onClick:a,children:p(`svg`,{...A,children:p(`path`,{d:`M12 5v14M5 12h14`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})})}),p(`button`,{type:`button`,className:k.button,"aria-label":c?.zoomOut??_(g.flow.zoomOut),onClick:o,children:p(`svg`,{...A,children:p(`path`,{d:`M5 12h14`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`})})})]}),i&&p(`button`,{type:`button`,className:k.button,"aria-label":c?.fitView??_(g.flow.fitView),onClick:s,children:p(`svg`,{...A,children:p(`path`,{d:`M4 9V5a1 1 0 0 1 1-1h4M15 4h4a1 1 0 0 1 1 1v4M20 15v4a1 1 0 0 1-1 1h-4M9 20H5a1 1 0 0 1-1-1v-4`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})})})]})}var j={minimap:`_minimap_rdahv_2`,node:`_node_rdahv_28`,viewport:`_viewport_rdahv_32`};function FlowMiniMap({nodes:t,viewport:r,containerWidth:a,containerHeight:o,width:s=200,height:u=150,position:f=`bottom-right`,nodeColor:h,onViewportChange:v,label:y,ariaLabel:b,className:x}){l();let S=graphBounds(t)??{x:0,y:0,width:1,height:1},C=S.width||1,w=S.height||1,T=C*.1,E=w*.1,D={x:S.x-T,y:S.y-E,width:C+T*2,height:w+E*2},O=Math.min(s/D.width,u/D.height),k=-D.x*O+(s-D.width*O)/2,A=-D.y*O+(u-D.height*O)/2,toMM=e=>({x:e.x*O+k,y:e.y*O+A}),M=null;if(a&&o){let e=screenToFlow({x:0,y:0},r),t=screenToFlow({x:a,y:o},r),i=toMM(e);M={x:i.x,y:i.y,w:(t.x-e.x)*O,h:(t.y-e.y)*O}}let{handleRef:N,offset:P,isDragging:F}=i({isDisabled:!v}),I=d(null),setRectRef=e=>{I.current=e,N.current=e},L=d(v);L.current=v;let R=d(null);return c(()=>{let e=F.value,t=P.value;if(!L.current)return;if(!e){R.current=null;return}R.current||={vp:r,off:t};let i=R.current,a=i.vp.zoom;L.current({x:i.vp.x-(t.x-i.off.x)/O*a,y:i.vp.y-(t.y-i.off.y)/O*a,zoom:a})}),m(`svg`,{"data-position":f,className:e(j.minimap,x),width:s,height:u,role:`img`,"aria-label":b??y??_(g.flow.minimap),children:[t.map(e=>{let t=nodeBounds(e),r=toMM({x:t.x,y:t.y});return p(`rect`,{"data-node-id":e.id,className:j.node,x:r.x,y:r.y,width:t.width*O,height:t.height*O,fill:h},e.id)}),M&&p(`rect`,{ref:setRectRef,"data-viewport":``,className:j.viewport,x:M.x,y:M.y,width:M.w,height:M.h})]})}var M={panel:`_panel_l0cix_2`};function FlowPanel({position:e=`top-right`,children:t,className:r,...i}){return p(`div`,{"data-position":e,className:h(M.panel,r),...i,children:t})}var N={flow:`_flow_vejge_2`},P=0;function Flow({nodes:t,edges:r,onNodesChange:i,onEdgesChange:a,onConnect:o,nodeTypes:c,fitView:u=!0,background:d=!1,controls:h=!1,minimap:g=!1,layout:_,minZoom:v,maxZoom:y,interactive:b=!0,activeEdgeId:x,activeDirection:S,className:C,style:w}){l();let T=useFlow({defaultNodes:_?applyLayout(t,r,_):t,defaultEdges:r,onNodesChange:i,onEdgesChange:a}),E=useViewport(T,{minZoom:v,maxZoom:y,fitOnInit:u}),{connection:D}=useConnection({containerRef:E.containerRef,clientToFlow:(e,t)=>{let r=E.containerRef.current?.getBoundingClientRect();return screenToFlow({x:e-(r?.left??0),y:t-(r?.top??0)},T.viewport.peek())},enabled:b,onConnect:e=>{T.addEdge({id:`e-${++P}`,source:e.source,target:e.target}),o?.(e)}}),select=e=>{T.setNodes(T.nodes.value.map(t=>({...t,selected:t.id===e})))},O=s({}),measure=(e,t)=>{let r=O.peek()[e];r&&r.width===t.width&&r.height===t.height||(O.value={...O.peek(),[e]:t})},k=T.nodes.value,A=T.edges.value,j=T.viewport.value.zoom,M=O.value,F=new Map(k.map(e=>{let t=M[e.id];return[e.id,t?{...e,width:t.width,height:t.height}:e]})),I=D.value;return m(FlowCanvas,{flow:T,controller:E,minZoom:v,maxZoom:y,chrome:m(f,{children:[h&&p(FlowControls,{onZoomIn:E.zoomIn,onZoomOut:E.zoomOut,onFitView:()=>E.fitView()}),g&&p(FlowMiniMap,{nodes:k,viewport:T.viewport.value,containerWidth:E.containerRef.current?.clientWidth,containerHeight:E.containerRef.current?.clientHeight,onViewportChange:T.setViewport})]}),className:e(N.flow,C),style:w,children:[d&&p(FlowBackground,{...typeof d==`object`?d:{}}),A.map(e=>{let t=F.get(e.source),r=F.get(e.target);if(!t||!r)return null;let i=handleAnchor(t,`right`),a=handleAnchor(r,`left`),o=x===e.id,s=o?S:void 0,c=s===`reverse`?!0:s===`forward`?!1:e.markerStart??!1,l=s===`reverse`?!1:s===`forward`?!0:e.markerEnd??!0;return p(FlowEdge,{id:e.id,sourceX:i.x,sourceY:i.y,targetX:a.x,targetY:a.y,type:e.type??`bezier`,animated:e.animated||o,active:o,direction:s,markerStart:c,markerEnd:l,label:e.label,selected:e.selected},e.id)}),I&&p(FlowEdge,{sourceX:I.from.x,sourceY:I.from.y,targetX:I.to.x,targetY:I.to.y,markerEnd:!1}),k.map(e=>p(FlowNode,{id:e.id,position:e.position,zoom:j,interactive:b,selected:e.selected??!1,onSelect:b?select:void 0,onMeasure:t=>measure(e.id,t),onPositionChange:t=>T.updateNode(e.id,{position:t}),children:c&&e.type&&c[e.type]?c[e.type]({node:e}):m(f,{children:[p(`span`,{children:String(e.data?.label??e.id)}),b&&p(FlowHandle,{type:`target`,position:`left`}),b&&p(FlowHandle,{type:`source`,position:`right`})]})},e.id))]})}var F={story:`_story_btt88_2`,overlay:`_overlay_btt88_7`,caption:`_caption_btt88_20`,captionText:`_captionText_btt88_36`,captionDesc:`_captionDesc_btt88_48`,controls:`_controls_btt88_52`,button:`_button_btt88_64`,indicator:`_indicator_btt88_93`},I={width:18,height:18,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0};function FlowStory({nodes:t,edges:r,script:i,loop:a=!0,stepDuration:o=1500,stepGap:s=0,playing:c,currentStep:u,onStepChange:d,controls:f=!0,autoPlay:h=!0,background:v=!0,interactive:y=!1,labels:b,clock:x,className:S,style:C}){l();let w=resolveScript(i,r),T=useStory({steps:w,loop:a,stepDuration:o,stepGap:s,playing:c,defaultPlaying:h,currentStep:u,defaultCurrentStep:0,onStepChange:d,clock:x}),E=T.activeStep.value,D=T.currentStep.value,O=T.playing.value;return m(`div`,{className:e(F.story,S),style:C,children:[p(Flow,{nodes:t,edges:r,background:v,interactive:y,activeEdgeId:E?.edgeId,activeDirection:E?.direction}),m(`div`,{className:F.overlay,children:[p(`div`,{className:F.caption,"aria-live":`polite`,children:E?.label&&m(`span`,{className:F.captionText,children:[p(`strong`,{children:E.label}),E.description&&m(`span`,{className:F.captionDesc,children:[` — `,E.description]})]},D)}),f&&m(`div`,{className:F.controls,children:[p(`button`,{type:`button`,className:F.button,"aria-label":b?.previous??_(g.flow.previous),onClick:T.prev,children:p(`svg`,{...I,children:p(`path`,{d:`M15 6 9 12l6 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})})}),p(`button`,{type:`button`,className:F.button,"aria-label":O?b?.pause??_(g.flow.pause):b?.play??_(g.flow.play),"aria-pressed":O,onClick:T.toggle,children:O?p(`svg`,{...I,children:p(`path`,{d:`M7 5h3v14H7zM14 5h3v14h-3z`})}):p(`svg`,{...I,children:p(`path`,{d:`M7 5l11 7-11 7z`})})}),p(`button`,{type:`button`,className:F.button,"aria-label":b?.next??_(g.flow.next),onClick:T.next,children:p(`svg`,{...I,children:p(`path`,{d:`M9 6l6 6-6 6`,stroke:`currentColor`,strokeWidth:`2`,fill:`none`})})}),p(`span`,{className:F.indicator,children:_(g.flow.step,{current:D+1,total:w.length})})]})]})]})}export{v as DEFAULT_NODE_SIZE,Flow,FlowBackground,FlowCanvas,FlowControls,FlowEdge,FlowHandle,FlowMiniMap,FlowNode,FlowPanel,FlowStory,applyLayout,bezierPath,clampZoom,edgePath,fitViewport,flowToScreen,graphBounds,gridLayout,handleAnchor,layeredLayout,nodeBounds,nodeSize,resolveScript,resolveStep,screenToFlow,smoothStepPath,straightPath,useConnection,useFlow,useStory,useViewport};