@cascivo/flow 0.1.18 → 0.16.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,18 +1,20 @@
1
1
  "use client";
2
+ import './flow.css';
2
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";
3
4
  import { useId as l, useRef as u } from "react";
4
5
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
5
- import { builtin as m, t as h } from "@cascivo/i18n";
6
+ import { cn as m } from "@cascivo/core/pure";
7
+ import { builtin as h, t as g } from "@cascivo/i18n";
6
8
  //#region src/engine/types.ts
7
- var g = {
9
+ var _ = {
8
10
  width: 150,
9
11
  height: 40
10
- }, _ = {
12
+ }, v = {
11
13
  x: 0,
12
14
  y: 0,
13
15
  zoom: 1
14
16
  };
15
- function v(e = {}) {
17
+ function y(e = {}) {
16
18
  let [t, r] = n({
17
19
  value: e.nodes,
18
20
  defaultValue: e.defaultNodes ?? [],
@@ -23,7 +25,7 @@ function v(e = {}) {
23
25
  onChange: e.onEdgesChange
24
26
  }), [o, s] = n({
25
27
  value: e.viewport,
26
- defaultValue: e.defaultViewport ?? _,
28
+ defaultValue: e.defaultViewport ?? v,
27
29
  onChange: e.onViewportChange
28
30
  });
29
31
  return {
@@ -46,16 +48,16 @@ function v(e = {}) {
46
48
  }
47
49
  //#endregion
48
50
  //#region src/engine/transform.ts
49
- function y(e, t = .2, n = 2) {
51
+ function b(e, t = .2, n = 2) {
50
52
  return Math.min(n, Math.max(t, e));
51
53
  }
52
- function b(e, t) {
54
+ function x(e, t) {
53
55
  return {
54
56
  x: (e.x - t.x) / t.zoom,
55
57
  y: (e.y - t.y) / t.zoom
56
58
  };
57
59
  }
58
- function x(e, t) {
60
+ function S(e, t) {
59
61
  return {
60
62
  x: e.x * t.zoom + t.x,
61
63
  y: e.y * t.zoom + t.y
@@ -63,14 +65,14 @@ function x(e, t) {
63
65
  }
64
66
  //#endregion
65
67
  //#region src/engine/geometry.ts
66
- function S(e) {
68
+ function C(e) {
67
69
  return {
68
- width: e.width ?? g.width,
69
- height: e.height ?? g.height
70
+ width: e.width ?? _.width,
71
+ height: e.height ?? _.height
70
72
  };
71
73
  }
72
- function C(e) {
73
- let { width: t, height: n } = S(e);
74
+ function w(e) {
75
+ let { width: t, height: n } = C(e);
74
76
  return {
75
77
  x: e.position.x,
76
78
  y: e.position.y,
@@ -78,8 +80,8 @@ function C(e) {
78
80
  height: n
79
81
  };
80
82
  }
81
- function w(e, t) {
82
- let { x: n, y: r, width: i, height: a } = C(e);
83
+ function T(e, t) {
84
+ let { x: n, y: r, width: i, height: a } = w(e);
83
85
  switch (t) {
84
86
  case "top": return {
85
87
  x: n + i / 2,
@@ -99,11 +101,11 @@ function w(e, t) {
99
101
  };
100
102
  }
101
103
  }
102
- function T(e) {
104
+ function E(e) {
103
105
  if (e.length === 0) return null;
104
106
  let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity;
105
107
  for (let a of e) {
106
- let e = C(a);
108
+ let e = w(a);
107
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);
108
110
  }
109
111
  return {
@@ -113,14 +115,14 @@ function T(e) {
113
115
  height: i - n
114
116
  };
115
117
  }
116
- function E(e, t, n = {}) {
118
+ function D(e, t, n = {}) {
117
119
  let { padding: r = .1, minZoom: i = .2, maxZoom: a = 2 } = n;
118
120
  if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0) return {
119
121
  x: t.width / 2 - e.x,
120
122
  y: t.height / 2 - e.y,
121
123
  zoom: 1
122
124
  };
123
- let o = t.width / (e.width * (1 + r * 2)), s = t.height / (e.height * (1 + r * 2)), c = y(Math.min(o, s), i, a);
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);
124
126
  return {
125
127
  x: t.width / 2 - (e.x + e.width / 2) * c,
126
128
  y: t.height / 2 - (e.y + e.height / 2) * c,
@@ -129,11 +131,11 @@ function E(e, t, n = {}) {
129
131
  }
130
132
  //#endregion
131
133
  //#region src/engine/path.ts
132
- var D = (e) => Number.isInteger(e) ? String(e) : e.toFixed(2).replace(/\.?0+$/, ""), O = (e, t) => ({
134
+ var O = (e) => Number.isInteger(e) ? String(e) : e.toFixed(2).replace(/\.?0+$/, ""), k = (e, t) => ({
133
135
  x: (e.x + t.x) / 2,
134
136
  y: (e.y + t.y) / 2
135
137
  });
136
- function k(e) {
138
+ function A(e) {
137
139
  switch (e) {
138
140
  case "top": return {
139
141
  x: 0,
@@ -153,14 +155,14 @@ function k(e) {
153
155
  };
154
156
  }
155
157
  }
156
- function A({ source: e, target: t }) {
158
+ function j({ source: e, target: t }) {
157
159
  return {
158
- d: `M${D(e.x)},${D(e.y)} L${D(t.x)},${D(t.y)}`,
159
- mid: O(e, t)
160
+ d: `M${O(e.x)},${O(e.y)} L${O(t.x)},${O(t.y)}`,
161
+ mid: k(e, t)
160
162
  };
161
163
  }
162
- function j(e) {
163
- 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 = k(i), l = k(a), u = {
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 = {
164
166
  x: t.x + c.x * s,
165
167
  y: t.y + c.y * s
166
168
  }, d = {
@@ -171,31 +173,31 @@ function j(e) {
171
173
  y: (t.y + 3 * u.y + 3 * d.y + n.y) / 8
172
174
  };
173
175
  return {
174
- d: `M${D(t.x)},${D(t.y)} C${D(u.x)},${D(u.y)} ${D(d.x)},${D(d.y)} ${D(n.x)},${D(n.y)}`,
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)}`,
175
177
  mid: f
176
178
  };
177
179
  }
178
- function M(e, t) {
180
+ function N(e, t) {
179
181
  return Math.hypot(t.x - e.x, t.y - e.y);
180
182
  }
181
- function N(e, t, n) {
182
- let r = M(e, t) || 1;
183
+ function P(e, t, n) {
184
+ let r = N(e, t) || 1;
183
185
  return {
184
186
  x: e.x + (t.x - e.x) / r * n,
185
187
  y: e.y + (t.y - e.y) / r * n
186
188
  };
187
189
  }
188
- function P(e, t) {
190
+ function F(e, t) {
189
191
  if (e.length < 2) return "";
190
- let n = e[0], r = `M${D(n.x)},${D(n.y)}`;
192
+ let n = e[0], r = `M${O(n.x)},${O(n.y)}`;
191
193
  for (let n = 1; n < e.length - 1; n++) {
192
- let i = e[n - 1], a = e[n], o = e[n + 1], s = Math.min(t, M(i, a) / 2, M(a, o) / 2), c = N(a, i, s), l = N(a, o, s);
193
- r += ` L${D(c.x)},${D(c.y)} Q${D(a.x)},${D(a.y)} ${D(l.x)},${D(l.y)}`;
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)}`;
194
196
  }
195
197
  let i = e[e.length - 1];
196
- return r += ` L${D(i.x)},${D(i.y)}`, r;
198
+ return r += ` L${O(i.x)},${O(i.y)}`, r;
197
199
  }
198
- function F(e) {
200
+ function I(e) {
199
201
  let { source: t, target: n, borderRadius: r = 8 } = e, i = e.sourcePosition ?? "right", a = i === "left" || i === "right", o = [t];
200
202
  if (a) {
201
203
  let e = (t.x + n.x) / 2;
@@ -217,21 +219,21 @@ function F(e) {
217
219
  });
218
220
  }
219
221
  return o.push(n), {
220
- d: P(o, r),
221
- mid: O(t, n)
222
+ d: F(o, r),
223
+ mid: k(t, n)
222
224
  };
223
225
  }
224
- function I(e, t) {
226
+ function L(e, t) {
225
227
  switch (e) {
226
- case "straight": return A(t);
227
- case "smoothstep": return F(t);
228
- case "bezier": return j(t);
228
+ case "straight": return j(t);
229
+ case "smoothstep": return I(t);
230
+ case "bezier": return M(t);
229
231
  }
230
232
  }
231
233
  //#endregion
232
234
  //#region src/engine/layout.ts
233
- function L(e, t = {}) {
234
- let n = t.gap ?? 40, r = t.nodeWidth ?? g.width, i = t.nodeHeight ?? g.height, a = t.columns ?? Math.max(1, Math.ceil(Math.sqrt(e.length)));
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)));
235
237
  return e.map((e, t) => {
236
238
  let o = t % a, s = Math.floor(t / a);
237
239
  return {
@@ -243,8 +245,8 @@ function L(e, t = {}) {
243
245
  };
244
246
  });
245
247
  }
246
- function R(e, t, n = {}) {
247
- let r = n.direction ?? "LR", i = n.gap ?? 60, a = n.nodeWidth ?? g.width, o = n.nodeHeight ?? g.height, s = new Set(e.map((e) => e.id)), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
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();
248
250
  for (let t of e) l.set(t.id, 0);
249
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));
250
252
  let u = /* @__PURE__ */ new Map(), d = e.filter((e) => (l.get(e.id) ?? 0) === 0).map((e) => e.id);
@@ -278,21 +280,21 @@ function R(e, t, n = {}) {
278
280
  };
279
281
  });
280
282
  }
281
- function z(e, t, n) {
282
- return n === "grid" ? L(e) : n === "layered" ? R(e, t) : n(e, t);
283
+ function B(e, t, n) {
284
+ return n === "grid" ? R(e) : n === "layered" ? z(e, t) : n(e, t);
283
285
  }
284
286
  //#endregion
285
287
  //#region src/engine/script.ts
286
- function B(e) {
288
+ function ee(e) {
287
289
  return "edge" in e;
288
290
  }
289
- function ee(e, t) {
291
+ function te(e, t) {
290
292
  let n = {
291
293
  label: e.label,
292
294
  description: e.description,
293
295
  duration: e.duration
294
296
  };
295
- if (B(e)) {
297
+ if (ee(e)) {
296
298
  let r = t.find((t) => t.id === e.edge);
297
299
  if (!r) throw Error(`FlowStory: step references unknown edge "${e.edge}"`);
298
300
  return {
@@ -316,13 +318,13 @@ function ee(e, t) {
316
318
  throw Error(`FlowStory: no edge connects "${e.from}" and "${e.to}"`);
317
319
  }
318
320
  function V(e, t) {
319
- return e.map((e) => ee(e, t));
321
+ return e.map((e) => te(e, t));
320
322
  }
321
323
  //#endregion
322
324
  //#region src/core/use-viewport.ts
323
325
  var H = 1.2;
324
326
  function U(e, t = {}) {
325
- 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 }), x = (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) => {
326
328
  let n = f.peek();
327
329
  p({
328
330
  x: n.x + e,
@@ -330,7 +332,7 @@ function U(e, t = {}) {
330
332
  zoom: n.zoom
331
333
  });
332
334
  }, S = (e, t) => {
333
- let r = f.peek(), a = y(e, n, i);
335
+ let r = f.peek(), a = b(e, n, i);
334
336
  if (!t) {
335
337
  p({
336
338
  x: r.x,
@@ -339,7 +341,7 @@ function U(e, t = {}) {
339
341
  });
340
342
  return;
341
343
  }
342
- let o = b(t, r);
344
+ let o = x(t, r);
343
345
  p({
344
346
  x: t.x - o.x * a,
345
347
  y: t.y - o.y * a,
@@ -351,7 +353,7 @@ function U(e, t = {}) {
351
353
  x: e.clientWidth / 2,
352
354
  y: e.clientHeight / 2
353
355
  };
354
- }, w = () => S(f.peek().zoom * H, C()), D = () => S(f.peek().zoom / H, C()), O = () => {
356
+ }, w = () => S(f.peek().zoom * H, C()), T = () => S(f.peek().zoom / H, C()), O = () => {
355
357
  let e = h.peek();
356
358
  if (e && e.width > 0 && e.height > 0) return e;
357
359
  let t = m.current;
@@ -360,10 +362,10 @@ function U(e, t = {}) {
360
362
  height: t.clientHeight
361
363
  } : null;
362
364
  }, k = (t) => {
363
- let r = T(e.nodes.peek());
365
+ let r = E(e.nodes.peek());
364
366
  if (!r) return;
365
367
  let a = t ?? O();
366
- a && p(E(r, a, {
368
+ a && p(D(r, a, {
367
369
  padding: l,
368
370
  minZoom: n,
369
371
  maxZoom: i
@@ -409,16 +411,16 @@ function U(e, t = {}) {
409
411
  containerRef: m,
410
412
  panHandleRef: g,
411
413
  viewport: f,
412
- pan: x,
414
+ pan: y,
413
415
  zoomTo: S,
414
416
  zoomIn: w,
415
- zoomOut: D,
417
+ zoomOut: T,
416
418
  fitView: k
417
419
  };
418
420
  }
419
421
  //#endregion
420
422
  //#region src/core/use-connection.ts
421
- var te = "[data-flow-handle][data-handle-type=\"source\"]", ne = "[data-flow-handle][data-handle-type=\"target\"]";
423
+ var ne = "[data-flow-handle][data-handle-type=\"source\"]", re = "[data-flow-handle][data-handle-type=\"target\"]";
422
424
  function W(e) {
423
425
  let { containerRef: t } = e, n = o(null), r = u(e.onConnect);
424
426
  r.current = e.onConnect;
@@ -440,7 +442,7 @@ function W(e) {
440
442
  }, o = (e) => {
441
443
  let t = n.peek();
442
444
  if (window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), n.value = null, !t) return;
443
- let s = e.target, c = s instanceof Element ? s.closest(ne) : null, l = c?.closest("[data-node-id]");
445
+ let s = e.target, c = s instanceof Element ? s.closest(re) : null, l = c?.closest("[data-node-id]");
444
446
  if (!l) return;
445
447
  let u = {
446
448
  source: t.source,
@@ -452,7 +454,7 @@ function W(e) {
452
454
  }, s = (e) => {
453
455
  let t = e.target;
454
456
  if (!(t instanceof Element)) return;
455
- let r = t.closest(te);
457
+ let r = t.closest(ne);
456
458
  if (!r) return;
457
459
  let a = r.closest("[data-node-id]");
458
460
  if (!a) return;
@@ -472,9 +474,9 @@ function W(e) {
472
474
  }
473
475
  //#endregion
474
476
  //#region src/core/use-story.ts
475
- var re = 1500;
476
- function ie(e) {
477
- let { steps: r, loop: i = !0, stepDuration: a = re, stepGap: o = 0 } = e, [c, l] = n({
477
+ var ie = 1500;
478
+ function ae(e) {
479
+ let { steps: r, loop: i = !0, stepDuration: a = ie, stepGap: o = 0 } = e, [c, l] = n({
478
480
  value: e.currentStep,
479
481
  defaultValue: e.defaultCurrentStep ?? 0,
480
482
  onChange: e.onStepChange
@@ -525,9 +527,9 @@ var G = {
525
527
  };
526
528
  //#endregion
527
529
  //#region src/core/flow-canvas/flow-canvas.tsx
528
- function ae({ 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", ...y }) {
530
+ function oe({ 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 }) {
529
531
  c();
530
- let b = v({
532
+ let b = y({
531
533
  viewport: r,
532
534
  defaultViewport: i,
533
535
  onViewportChange: a
@@ -542,7 +544,7 @@ function ae({ children: t, flow: n, viewport: r, defaultViewport: i, onViewportC
542
544
  ref: C.containerRef,
543
545
  className: e(G.canvas, g),
544
546
  role: _,
545
- ...y,
547
+ ...v,
546
548
  children: [/* @__PURE__ */ p("div", {
547
549
  className: G.pane,
548
550
  style: {
@@ -558,28 +560,28 @@ function ae({ children: t, flow: n, viewport: r, defaultViewport: i, onViewportC
558
560
  }), h]
559
561
  });
560
562
  }
561
- var oe = { background: "_background_1pu9x_2" };
563
+ var se = { background: "_background_1pu9x_2" };
562
564
  //#endregion
563
565
  //#region src/flows/flow-background/flow-background.tsx
564
- function se({ variant: t = "dots", gap: n = 20, size: r = 1, color: i, className: a, style: o, ...s }) {
566
+ function ce({ variant: e = "dots", gap: t = 20, size: n = 1, color: r, className: i, style: a, ...o }) {
565
567
  return /* @__PURE__ */ f("div", {
566
- "data-variant": t,
568
+ "data-variant": e,
567
569
  "aria-hidden": "true",
568
- className: e(oe.background, a),
570
+ className: m(se.background, i),
569
571
  style: {
570
- "--flow-bg-gap": `${n}px`,
571
- "--flow-bg-size": `${r}px`,
572
- "--flow-bg-thick": `${Math.max(1, r)}px`,
573
- ...i ? { "--flow-bg-color": i } : {},
574
- ...o
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
575
577
  },
576
- ...s
578
+ ...o
577
579
  });
578
580
  }
579
- var ce = { node: "_node_9zyg4_2" };
581
+ var le = { node: "_node_9zyg4_2" };
580
582
  //#endregion
581
583
  //#region src/flows/flow-node/flow-node.tsx
582
- function le({ 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 }) {
584
+ function ue({ 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 }) {
583
585
  c();
584
586
  let S = m && h, [C, w] = n({
585
587
  value: i,
@@ -634,7 +636,7 @@ function le({ id: t, position: i, defaultPosition: a, onPositionChange: o, onMea
634
636
  "data-static": !h || void 0,
635
637
  role: "group",
636
638
  tabIndex: h ? 0 : void 0,
637
- className: e(ce.node, v),
639
+ className: e(le.node, v),
638
640
  style: {
639
641
  "--flow-x": `${P.x}px`,
640
642
  "--flow-y": `${P.y}px`
@@ -649,27 +651,27 @@ function le({ id: t, position: i, defaultPosition: a, onPositionChange: o, onMea
649
651
  children: _
650
652
  });
651
653
  }
652
- var ue = {
654
+ var de = {
653
655
  handle: "_handle_8a1xa_2",
654
656
  dot: "_dot_8a1xa_41"
655
657
  };
656
658
  //#endregion
657
659
  //#region src/flows/flow-handle/flow-handle.tsx
658
- function de(e) {
660
+ function fe(e) {
659
661
  return e === "source" ? "right" : "left";
660
662
  }
661
- function K({ type: t, position: n, id: r, isConnectable: i = !0, className: a, ...o }) {
663
+ function K({ type: e, position: t, id: n, isConnectable: r = !0, className: i, ...a }) {
662
664
  return /* @__PURE__ */ f("div", {
663
- "data-handle-type": t,
664
- "data-handle-pos": n ?? de(t),
665
- "data-handle-id": r,
666
- "data-connectable": i || void 0,
665
+ "data-handle-type": e,
666
+ "data-handle-pos": t ?? fe(e),
667
+ "data-handle-id": n,
668
+ "data-connectable": r || void 0,
667
669
  "data-flow-handle": "",
668
- tabIndex: i ? 0 : -1,
669
- className: e(ue.handle, a),
670
- ...o,
670
+ tabIndex: r ? 0 : -1,
671
+ className: m(de.handle, i),
672
+ ...a,
671
673
  children: /* @__PURE__ */ f("span", {
672
- className: ue.dot,
674
+ className: de.dot,
673
675
  "aria-hidden": "true"
674
676
  })
675
677
  });
@@ -685,7 +687,7 @@ var q = {
685
687
  //#endregion
686
688
  //#region src/flows/flow-edge/flow-edge.tsx
687
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 }) {
688
- let x = l(), S = `flow-arrow-${t ?? x}`, C = g || _, { d: w, mid: T } = I(c, {
690
+ let x = l(), S = `flow-arrow-${t ?? x}`, C = g || _, { d: w, mid: T } = L(c, {
689
691
  source: {
690
692
  x: n,
691
693
  y: r
@@ -740,8 +742,8 @@ function J({ id: t, sourceX: n, sourceY: r, targetX: i, targetY: a, sourcePositi
740
742
  })] });
741
743
  }
742
744
  var Y = {
743
- controls: "_controls_c0e5r_2",
744
- button: "_button_c0e5r_32"
745
+ controls: "_controls_s32im_2",
746
+ button: "_button_s32im_32"
745
747
  }, X = {
746
748
  width: 18,
747
749
  height: 18,
@@ -749,7 +751,7 @@ var Y = {
749
751
  fill: "none",
750
752
  "aria-hidden": !0
751
753
  };
752
- function fe({ position: t = "bottom-left", showZoom: n = !0, showFitView: r = !0, onZoomIn: i, onZoomOut: a, onFitView: o, labels: s, className: l, ...u }) {
754
+ function pe({ position: t = "bottom-left", showZoom: n = !0, showFitView: r = !0, onZoomIn: i, onZoomOut: a, onFitView: o, labels: s, className: l, ...u }) {
753
755
  return c(), /* @__PURE__ */ p("div", {
754
756
  "data-position": t,
755
757
  className: e(Y.controls, l),
@@ -757,7 +759,7 @@ function fe({ position: t = "bottom-left", showZoom: n = !0, showFitView: r = !0
757
759
  children: [n && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("button", {
758
760
  type: "button",
759
761
  className: Y.button,
760
- "aria-label": s?.zoomIn ?? h(m.flow.zoomIn),
762
+ "aria-label": s?.zoomIn ?? g(h.flow.zoomIn),
761
763
  onClick: i,
762
764
  children: /* @__PURE__ */ f("svg", {
763
765
  ...X,
@@ -771,7 +773,7 @@ function fe({ position: t = "bottom-left", showZoom: n = !0, showFitView: r = !0
771
773
  }), /* @__PURE__ */ f("button", {
772
774
  type: "button",
773
775
  className: Y.button,
774
- "aria-label": s?.zoomOut ?? h(m.flow.zoomOut),
776
+ "aria-label": s?.zoomOut ?? g(h.flow.zoomOut),
775
777
  onClick: a,
776
778
  children: /* @__PURE__ */ f("svg", {
777
779
  ...X,
@@ -785,7 +787,7 @@ function fe({ position: t = "bottom-left", showZoom: n = !0, showFitView: r = !0
785
787
  })] }), r && /* @__PURE__ */ f("button", {
786
788
  type: "button",
787
789
  className: Y.button,
788
- "aria-label": s?.fitView ?? h(m.flow.fitView),
790
+ "aria-label": s?.fitView ?? g(h.flow.fitView),
789
791
  onClick: o,
790
792
  children: /* @__PURE__ */ f("svg", {
791
793
  ...X,
@@ -807,27 +809,27 @@ var Z = {
807
809
  };
808
810
  //#endregion
809
811
  //#region src/flows/flow-minimap/flow-minimap.tsx
810
- function pe({ nodes: t, viewport: n, containerWidth: i, containerHeight: a, width: o = 200, height: l = 150, position: d = "bottom-right", nodeColor: g, onViewportChange: _, label: v, className: y }) {
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, className: y }) {
811
813
  c();
812
- let x = T(t) ?? {
814
+ let b = E(t) ?? {
813
815
  x: 0,
814
816
  y: 0,
815
817
  width: 1,
816
818
  height: 1
817
- }, S = x.width || 1, w = x.height || 1, E = S * .1, D = w * .1, O = {
818
- x: x.x - E,
819
- y: x.y - D,
820
- width: S + E * 2,
821
- height: w + D * 2
819
+ }, S = b.width || 1, C = b.height || 1, T = S * .1, D = C * .1, O = {
820
+ x: b.x - T,
821
+ y: b.y - D,
822
+ width: S + T * 2,
823
+ height: C + D * 2
822
824
  }, k = Math.min(o / O.width, l / O.height), A = -O.x * k + (o - O.width * k) / 2, j = -O.y * k + (l - O.height * k) / 2, M = (e) => ({
823
825
  x: e.x * k + A,
824
826
  y: e.y * k + j
825
827
  }), N = null;
826
828
  if (i && a) {
827
- let e = b({
829
+ let e = x({
828
830
  x: 0,
829
831
  y: 0
830
- }, n), t = b({
832
+ }, n), t = x({
831
833
  x: i,
832
834
  y: a
833
835
  }, n), r = M(e);
@@ -866,9 +868,9 @@ function pe({ nodes: t, viewport: n, containerWidth: i, containerHeight: a, widt
866
868
  width: o,
867
869
  height: l,
868
870
  role: "img",
869
- "aria-label": v ?? h(m.flow.minimap),
871
+ "aria-label": v ?? g(h.flow.minimap),
870
872
  children: [t.map((e) => {
871
- let t = C(e), n = M({
873
+ let t = w(e), n = M({
872
874
  x: t.x,
873
875
  y: t.y
874
876
  });
@@ -879,7 +881,7 @@ function pe({ nodes: t, viewport: n, containerWidth: i, containerHeight: a, widt
879
881
  y: n.y,
880
882
  width: t.width * k,
881
883
  height: t.height * k,
882
- fill: g
884
+ fill: m
883
885
  }, e.id);
884
886
  }), N && /* @__PURE__ */ f("rect", {
885
887
  ref: R,
@@ -892,42 +894,42 @@ function pe({ nodes: t, viewport: n, containerWidth: i, containerHeight: a, widt
892
894
  })]
893
895
  });
894
896
  }
895
- var me = { panel: "_panel_l0cix_2" };
897
+ var he = { panel: "_panel_l0cix_2" };
896
898
  //#endregion
897
899
  //#region src/flows/flow-panel/flow-panel.tsx
898
- function he({ position: t = "top-right", children: n, className: r, ...i }) {
900
+ function ge({ position: e = "top-right", children: t, className: n, ...r }) {
899
901
  return /* @__PURE__ */ f("div", {
900
- "data-position": t,
901
- className: e(me.panel, r),
902
- ...i,
903
- children: n
902
+ "data-position": e,
903
+ className: m(he.panel, n),
904
+ ...r,
905
+ children: t
904
906
  });
905
907
  }
906
- var ge = { flow: "_flow_vejge_2" }, _e = 0;
907
- function ve({ 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: y, interactive: x = !0, activeEdgeId: S, activeDirection: C, className: T, style: E }) {
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 }) {
908
910
  c();
909
- let D = v({
910
- defaultNodes: g ? z(t, n, g) : t,
911
+ let D = y({
912
+ defaultNodes: g ? B(t, n, g) : t,
911
913
  defaultEdges: n,
912
914
  onNodesChange: r,
913
915
  onEdgesChange: i
914
916
  }), O = U(D, {
915
917
  minZoom: _,
916
- maxZoom: y,
918
+ maxZoom: v,
917
919
  fitOnInit: l
918
920
  }), { connection: k } = W({
919
921
  containerRef: O.containerRef,
920
922
  clientToFlow: (e, t) => {
921
923
  let n = O.containerRef.current?.getBoundingClientRect();
922
- return b({
924
+ return x({
923
925
  x: e - (n?.left ?? 0),
924
926
  y: t - (n?.top ?? 0)
925
927
  }, D.viewport.peek());
926
928
  },
927
- enabled: x,
929
+ enabled: b,
928
930
  onConnect: (e) => {
929
931
  D.addEdge({
930
- id: `e-${++_e}`,
932
+ id: `e-${++ve}`,
931
933
  source: e.source,
932
934
  target: e.target
933
935
  }), a?.(e);
@@ -951,30 +953,30 @@ function ve({ nodes: t, edges: n, onNodesChange: r, onEdgesChange: i, onConnect:
951
953
  height: t.height
952
954
  } : e];
953
955
  })), R = k.value;
954
- return /* @__PURE__ */ p(ae, {
956
+ return /* @__PURE__ */ p(oe, {
955
957
  flow: D,
956
958
  controller: O,
957
959
  minZoom: _,
958
- maxZoom: y,
959
- chrome: /* @__PURE__ */ p(d, { children: [m && /* @__PURE__ */ f(fe, {
960
+ maxZoom: v,
961
+ chrome: /* @__PURE__ */ p(d, { children: [m && /* @__PURE__ */ f(pe, {
960
962
  onZoomIn: O.zoomIn,
961
963
  onZoomOut: O.zoomOut,
962
964
  onFitView: () => O.fitView()
963
- }), h && /* @__PURE__ */ f(pe, {
965
+ }), h && /* @__PURE__ */ f(me, {
964
966
  nodes: N,
965
967
  viewport: D.viewport.value,
966
968
  containerWidth: O.containerRef.current?.clientWidth,
967
969
  containerHeight: O.containerRef.current?.clientHeight,
968
970
  onViewportChange: D.setViewport
969
971
  })] }),
970
- className: e(ge.flow, T),
972
+ className: e(_e.flow, w),
971
973
  style: E,
972
974
  children: [
973
- u && /* @__PURE__ */ f(se, { ...typeof u == "object" ? u : {} }),
975
+ u && /* @__PURE__ */ f(ce, { ...typeof u == "object" ? u : {} }),
974
976
  P.map((e) => {
975
977
  let t = L.get(e.source), n = L.get(e.target);
976
978
  if (!t || !n) return null;
977
- let r = w(t, "right"), i = w(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;
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;
978
980
  return /* @__PURE__ */ f(J, {
979
981
  id: e.id,
980
982
  sourceX: r.x,
@@ -998,22 +1000,22 @@ function ve({ nodes: t, edges: n, onNodesChange: r, onEdgesChange: i, onConnect:
998
1000
  targetY: R.to.y,
999
1001
  markerEnd: !1
1000
1002
  }),
1001
- N.map((e) => /* @__PURE__ */ f(le, {
1003
+ N.map((e) => /* @__PURE__ */ f(ue, {
1002
1004
  id: e.id,
1003
1005
  position: e.position,
1004
1006
  zoom: F,
1005
- interactive: x,
1007
+ interactive: b,
1006
1008
  selected: e.selected ?? !1,
1007
- onSelect: x ? A : void 0,
1009
+ onSelect: b ? A : void 0,
1008
1010
  onMeasure: (t) => M(e.id, t),
1009
1011
  onPositionChange: (t) => D.updateNode(e.id, { position: t }),
1010
1012
  children: s && e.type && s[e.type] ? s[e.type]({ node: e }) : /* @__PURE__ */ p(d, { children: [
1011
1013
  /* @__PURE__ */ f("span", { children: String(e.data?.label ?? e.id) }),
1012
- x && /* @__PURE__ */ f(K, {
1014
+ b && /* @__PURE__ */ f(K, {
1013
1015
  type: "target",
1014
1016
  position: "left"
1015
1017
  }),
1016
- x && /* @__PURE__ */ f(K, {
1018
+ b && /* @__PURE__ */ f(K, {
1017
1019
  type: "source",
1018
1020
  position: "right"
1019
1021
  })
@@ -1023,14 +1025,14 @@ function ve({ nodes: t, edges: n, onNodesChange: r, onEdgesChange: i, onConnect:
1023
1025
  });
1024
1026
  }
1025
1027
  var Q = {
1026
- story: "_story_7qja0_2",
1027
- overlay: "_overlay_7qja0_7",
1028
- caption: "_caption_7qja0_20",
1029
- captionText: "_captionText_7qja0_36",
1030
- captionDesc: "_captionDesc_7qja0_48",
1031
- controls: "_controls_7qja0_52",
1032
- button: "_button_7qja0_64",
1033
- indicator: "_indicator_7qja0_93"
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"
1034
1036
  }, $ = {
1035
1037
  width: 18,
1036
1038
  height: 18,
@@ -1038,15 +1040,15 @@ var Q = {
1038
1040
  fill: "currentColor",
1039
1041
  "aria-hidden": !0
1040
1042
  };
1041
- function ye({ 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: g = !0, background: _ = !0, interactive: v = !1, labels: y, clock: b, className: x, style: S }) {
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 }) {
1042
1044
  c();
1043
- let C = V(r, n), w = ie({
1045
+ let C = V(r, n), w = ae({
1044
1046
  steps: C,
1045
1047
  loop: i,
1046
1048
  stepDuration: a,
1047
1049
  stepGap: o,
1048
1050
  playing: s,
1049
- defaultPlaying: g,
1051
+ defaultPlaying: m,
1050
1052
  currentStep: l,
1051
1053
  defaultCurrentStep: 0,
1052
1054
  onStepChange: u,
@@ -1055,7 +1057,7 @@ function ye({ nodes: t, edges: n, script: r, loop: i = !0, stepDuration: a = 150
1055
1057
  return /* @__PURE__ */ p("div", {
1056
1058
  className: e(Q.story, x),
1057
1059
  style: S,
1058
- children: [/* @__PURE__ */ f(ve, {
1060
+ children: [/* @__PURE__ */ f(ye, {
1059
1061
  nodes: t,
1060
1062
  edges: n,
1061
1063
  background: _,
@@ -1080,7 +1082,7 @@ function ye({ nodes: t, edges: n, script: r, loop: i = !0, stepDuration: a = 150
1080
1082
  /* @__PURE__ */ f("button", {
1081
1083
  type: "button",
1082
1084
  className: Q.button,
1083
- "aria-label": y?.previous ?? h(m.flow.previous),
1085
+ "aria-label": y?.previous ?? g(h.flow.previous),
1084
1086
  onClick: w.prev,
1085
1087
  children: /* @__PURE__ */ f("svg", {
1086
1088
  ...$,
@@ -1095,7 +1097,7 @@ function ye({ nodes: t, edges: n, script: r, loop: i = !0, stepDuration: a = 150
1095
1097
  /* @__PURE__ */ f("button", {
1096
1098
  type: "button",
1097
1099
  className: Q.button,
1098
- "aria-label": D ? y?.pause ?? h(m.flow.pause) : y?.play ?? h(m.flow.play),
1100
+ "aria-label": D ? y?.pause ?? g(h.flow.pause) : y?.play ?? g(h.flow.play),
1099
1101
  "aria-pressed": D,
1100
1102
  onClick: w.toggle,
1101
1103
  children: D ? /* @__PURE__ */ f("svg", {
@@ -1109,7 +1111,7 @@ function ye({ nodes: t, edges: n, script: r, loop: i = !0, stepDuration: a = 150
1109
1111
  /* @__PURE__ */ f("button", {
1110
1112
  type: "button",
1111
1113
  className: Q.button,
1112
- "aria-label": y?.next ?? h(m.flow.next),
1114
+ "aria-label": y?.next ?? g(h.flow.next),
1113
1115
  onClick: w.next,
1114
1116
  children: /* @__PURE__ */ f("svg", {
1115
1117
  ...$,
@@ -1123,7 +1125,7 @@ function ye({ nodes: t, edges: n, script: r, loop: i = !0, stepDuration: a = 150
1123
1125
  }),
1124
1126
  /* @__PURE__ */ f("span", {
1125
1127
  className: Q.indicator,
1126
- children: h(m.flow.step, {
1128
+ children: g(h.flow.step, {
1127
1129
  current: E + 1,
1128
1130
  total: C.length
1129
1131
  })
@@ -1134,4 +1136,4 @@ function ye({ nodes: t, edges: n, script: r, loop: i = !0, stepDuration: a = 150
1134
1136
  });
1135
1137
  }
1136
1138
  //#endregion
1137
- export { g as DEFAULT_NODE_SIZE, ve as Flow, se as FlowBackground, ae as FlowCanvas, fe as FlowControls, J as FlowEdge, K as FlowHandle, pe as FlowMiniMap, le as FlowNode, he as FlowPanel, ye as FlowStory, z as applyLayout, j as bezierPath, y as clampZoom, I as edgePath, E as fitViewport, x as flowToScreen, T as graphBounds, L as gridLayout, w as handleAnchor, R as layeredLayout, C as nodeBounds, S as nodeSize, V as resolveScript, ee as resolveStep, b as screenToFlow, F as smoothStepPath, A as straightPath, W as useConnection, v as useFlow, ie as useStory, U as useViewport };
1139
+ export { _ as DEFAULT_NODE_SIZE, ye as Flow, ce as FlowBackground, oe as FlowCanvas, pe as FlowControls, J as FlowEdge, K as FlowHandle, me as FlowMiniMap, ue 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, V as resolveScript, te as resolveStep, x as screenToFlow, I as smoothStepPath, j as straightPath, W as useConnection, y as useFlow, ae as useStory, U as useViewport };