@cascivo/flow 0.1.19 → 0.16.1

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