@getartisanflow/alpineflow 0.2.3-alpha → 0.2.5-alpha

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.
Files changed (145) hide show
  1. package/README.md +1 -0
  2. package/dist/alpineflow-collab.esm.js.map +1 -1
  3. package/dist/alpineflow-collab.js.map +1 -1
  4. package/dist/alpineflow-schema.esm.js +785 -679
  5. package/dist/alpineflow-schema.esm.js.map +1 -1
  6. package/dist/alpineflow-workflow.esm.js.map +1 -1
  7. package/dist/alpineflow.bundle.esm.js +7007 -6869
  8. package/dist/alpineflow.bundle.esm.js.map +1 -1
  9. package/dist/alpineflow.esm.js +2 -2
  10. package/dist/alpineflow.js +1 -1
  11. package/dist/{index-B8jw3ALY.js → index-iNX5XDHl.js} +6086 -5948
  12. package/dist/index-iNX5XDHl.js.map +1 -0
  13. package/dist/locales/de.json +62 -0
  14. package/dist/locales/en.json +62 -0
  15. package/dist/types/lib/collab.d.ts +2 -2
  16. package/dist/types/lib/core.d.ts +2 -2
  17. package/dist/types/lib/dagre.d.ts +1 -1
  18. package/dist/types/lib/elk.d.ts +1 -1
  19. package/dist/types/lib/force.d.ts +1 -1
  20. package/dist/types/lib/hierarchy.d.ts +1 -1
  21. package/dist/types/lib/schema.d.ts +2 -2
  22. package/dist/types/lib/whiteboard.d.ts +1 -1
  23. package/dist/types/lib/workflow.d.ts +2 -2
  24. package/dist/types/src/animate/animator.d.ts +6 -6
  25. package/dist/types/src/animate/clamp-dimensions.d.ts +1 -1
  26. package/dist/types/src/animate/flow-group.d.ts +1 -1
  27. package/dist/types/src/animate/handle-registry.d.ts +1 -1
  28. package/dist/types/src/animate/index.d.ts +19 -19
  29. package/dist/types/src/animate/interpolators.d.ts +1 -1
  30. package/dist/types/src/animate/motion/decay.d.ts +1 -1
  31. package/dist/types/src/animate/motion/index.d.ts +7 -7
  32. package/dist/types/src/animate/motion/inertia.d.ts +1 -1
  33. package/dist/types/src/animate/motion/keyframes.d.ts +1 -1
  34. package/dist/types/src/animate/motion/presets.d.ts +1 -1
  35. package/dist/types/src/animate/motion/spring.d.ts +1 -1
  36. package/dist/types/src/animate/particle-renderers.d.ts +1 -1
  37. package/dist/types/src/animate/recording/event-cursor.d.ts +1 -1
  38. package/dist/types/src/animate/recording/index.d.ts +7 -7
  39. package/dist/types/src/animate/recording/recorder.d.ts +1 -1
  40. package/dist/types/src/animate/recording/recording.d.ts +1 -1
  41. package/dist/types/src/animate/recording/replay.d.ts +2 -2
  42. package/dist/types/src/animate/recording/thumbnail.d.ts +1 -1
  43. package/dist/types/src/animate/recording/types.d.ts +3 -3
  44. package/dist/types/src/animate/recording/virtual-engine.d.ts +1 -1
  45. package/dist/types/src/animate/timeline.d.ts +5 -5
  46. package/dist/types/src/animate/transaction.d.ts +1 -1
  47. package/dist/types/src/collab/awareness.d.ts +1 -1
  48. package/dist/types/src/collab/bridge.d.ts +2 -2
  49. package/dist/types/src/collab/directives/flow-cursors.d.ts +1 -1
  50. package/dist/types/src/collab/index.d.ts +9 -9
  51. package/dist/types/src/collab/providers/in-memory.d.ts +1 -1
  52. package/dist/types/src/collab/providers/reverb.d.ts +1 -1
  53. package/dist/types/src/collab/providers/websocket.d.ts +1 -1
  54. package/dist/types/src/collab/store.d.ts +2 -2
  55. package/dist/types/src/core/__fixtures__/nodes.d.ts +1 -1
  56. package/dist/types/src/core/announcer.d.ts +10 -3
  57. package/dist/types/src/core/child-layout.d.ts +1 -1
  58. package/dist/types/src/core/child-validation.d.ts +1 -1
  59. package/dist/types/src/core/clipboard.d.ts +1 -1
  60. package/dist/types/src/core/collapse.d.ts +1 -1
  61. package/dist/types/src/core/compute.d.ts +1 -1
  62. package/dist/types/src/core/connections.d.ts +1 -1
  63. package/dist/types/src/core/controls-panel.d.ts +3 -0
  64. package/dist/types/src/core/crossing-reduction.d.ts +2 -2
  65. package/dist/types/src/core/drag.d.ts +1 -1
  66. package/dist/types/src/core/edge-paths/avoidant.d.ts +3 -3
  67. package/dist/types/src/core/edge-paths/bezier.d.ts +2 -2
  68. package/dist/types/src/core/edge-paths/editable.d.ts +2 -2
  69. package/dist/types/src/core/edge-paths/index.d.ts +7 -7
  70. package/dist/types/src/core/edge-paths/orthogonal.d.ts +2 -2
  71. package/dist/types/src/core/edge-paths/smoothstep.d.ts +2 -2
  72. package/dist/types/src/core/edge-paths/straight.d.ts +1 -1
  73. package/dist/types/src/core/edge-paths/utils.d.ts +1 -1
  74. package/dist/types/src/core/edge-utils.d.ts +3 -3
  75. package/dist/types/src/core/endpoint-spread.d.ts +1 -1
  76. package/dist/types/src/core/export.d.ts +1 -1
  77. package/dist/types/src/core/floating-edge.d.ts +1 -1
  78. package/dist/types/src/core/geometry.d.ts +1 -1
  79. package/dist/types/src/core/gradients.d.ts +1 -1
  80. package/dist/types/src/core/graph.d.ts +1 -1
  81. package/dist/types/src/core/helper-lines.d.ts +1 -1
  82. package/dist/types/src/core/history.d.ts +1 -1
  83. package/dist/types/src/core/index.d.ts +17 -17
  84. package/dist/types/src/core/intersection.d.ts +1 -1
  85. package/dist/types/src/core/lasso-hit-test.d.ts +1 -1
  86. package/dist/types/src/core/lasso.d.ts +2 -2
  87. package/dist/types/src/core/layout/dagre.d.ts +1 -1
  88. package/dist/types/src/core/layout/elk.d.ts +1 -1
  89. package/dist/types/src/core/layout/force.d.ts +1 -1
  90. package/dist/types/src/core/layout/hierarchy.d.ts +1 -1
  91. package/dist/types/src/core/minimap.d.ts +1 -1
  92. package/dist/types/src/core/pan-zoom.d.ts +10 -4
  93. package/dist/types/src/core/proximity-connect.d.ts +1 -1
  94. package/dist/types/src/core/render-plan.d.ts +1 -1
  95. package/dist/types/src/core/resize.d.ts +1 -1
  96. package/dist/types/src/core/schema-geometry.d.ts +1 -1
  97. package/dist/types/src/core/selection-box.d.ts +1 -1
  98. package/dist/types/src/core/shapes.d.ts +1 -1
  99. package/dist/types/src/core/sub-flow.d.ts +1 -1
  100. package/dist/types/src/core/translations.d.ts +175 -0
  101. package/dist/types/src/core/types.d.ts +29 -11
  102. package/dist/types/src/index.d.ts +31 -30
  103. package/dist/types/src/plugin/connection-utils.d.ts +3 -3
  104. package/dist/types/src/plugin/data/__real-canvas-harness.d.ts +1 -1
  105. package/dist/types/src/plugin/data/__test-utils.d.ts +1 -1
  106. package/dist/types/src/plugin/data/canvas-animation.d.ts +13 -13
  107. package/dist/types/src/plugin/data/canvas-batch.d.ts +1 -1
  108. package/dist/types/src/plugin/data/canvas-collapse.d.ts +1 -1
  109. package/dist/types/src/plugin/data/canvas-compute.d.ts +2 -2
  110. package/dist/types/src/plugin/data/canvas-condense.d.ts +1 -1
  111. package/dist/types/src/plugin/data/canvas-config.d.ts +1 -1
  112. package/dist/types/src/plugin/data/canvas-context.d.ts +22 -22
  113. package/dist/types/src/plugin/data/canvas-dom.d.ts +2 -2
  114. package/dist/types/src/plugin/data/canvas-edges.d.ts +2 -2
  115. package/dist/types/src/plugin/data/canvas-history.d.ts +2 -2
  116. package/dist/types/src/plugin/data/canvas-layout.d.ts +4 -4
  117. package/dist/types/src/plugin/data/canvas-nodes.d.ts +2 -2
  118. package/dist/types/src/plugin/data/canvas-particles.d.ts +2 -2
  119. package/dist/types/src/plugin/data/canvas-rows.d.ts +2 -2
  120. package/dist/types/src/plugin/data/canvas-selection.d.ts +1 -1
  121. package/dist/types/src/plugin/data/canvas-validation.d.ts +2 -2
  122. package/dist/types/src/plugin/data/canvas-viewport.d.ts +4 -4
  123. package/dist/types/src/plugin/directives/flow-edge.d.ts +1 -1
  124. package/dist/types/src/plugin/directives/flow-handle-validate.d.ts +1 -1
  125. package/dist/types/src/plugin/directives/flow-handle.d.ts +2 -2
  126. package/dist/types/src/plugin/drag-validation.d.ts +1 -1
  127. package/dist/types/src/plugin/handle-index.d.ts +1 -1
  128. package/dist/types/src/schema/canvas-augmentation.test-d.d.ts +1 -1
  129. package/dist/types/src/schema/diff.d.ts +1 -1
  130. package/dist/types/src/schema/dot.d.ts +1 -1
  131. package/dist/types/src/schema/field-ops.d.ts +1 -1
  132. package/dist/types/src/schema/history.d.ts +1 -1
  133. package/dist/types/src/schema/index.d.ts +24 -24
  134. package/dist/types/src/schema/layout.d.ts +1 -1
  135. package/dist/types/src/schema/references.d.ts +1 -1
  136. package/dist/types/src/schema/serialization.d.ts +1 -1
  137. package/dist/types/src/schema/types.d.ts +1 -1
  138. package/dist/types/src/schema/validate.d.ts +1 -1
  139. package/dist/types/src/workflow/condition.d.ts +1 -1
  140. package/dist/types/src/workflow/index.d.ts +3 -3
  141. package/dist/types/src/workflow/replay.d.ts +1 -1
  142. package/dist/types/src/workflow/run.d.ts +1 -1
  143. package/dist/types/src/workflow/types.d.ts +3 -3
  144. package/package.json +5 -2
  145. package/dist/index-B8jw3ALY.js.map +0 -1
@@ -1,157 +1,157 @@
1
- const V = "__alpineflow_registry__";
2
- function ce() {
3
- return typeof globalThis < "u" ? (globalThis[V] || (globalThis[V] = /* @__PURE__ */ new Map()), globalThis[V]) : /* @__PURE__ */ new Map();
1
+ const X = "__alpineflow_registry__";
2
+ function he() {
3
+ return typeof globalThis < "u" ? (globalThis[X] || (globalThis[X] = /* @__PURE__ */ new Map()), globalThis[X]) : /* @__PURE__ */ new Map();
4
4
  }
5
- function le(e, t) {
6
- ce().set(e, t);
5
+ function ye(e, t) {
6
+ he().set(e, t);
7
7
  }
8
- function fe(e, t, r, o) {
9
- const s = [];
10
- return { edges: e.map((i) => {
11
- let a = i;
12
- return i.source === t && i.sourceHandle === r && (a = { ...a, sourceHandle: o }), i.target === t && i.targetHandle === r && (a = { ...a, targetHandle: o }), a !== i && s.push(i.id), a;
13
- }), cascadedIds: s };
8
+ function Ee(e, t, r, n) {
9
+ const i = [];
10
+ return { edges: e.map((s) => {
11
+ let c = s;
12
+ return s.source === t && s.sourceHandle === r && (c = { ...c, sourceHandle: n }), s.target === t && s.targetHandle === r && (c = { ...c, targetHandle: n }), c !== s && i.push(s.id), c;
13
+ }), cascadedIds: i };
14
14
  }
15
- function ue(e, t, r) {
16
- const o = [];
15
+ function ve(e, t, r) {
16
+ const n = [];
17
17
  return { edges: e.filter((d) => {
18
- const i = d.source === t && d.sourceHandle === r || d.target === t && d.targetHandle === r;
19
- return i && o.push(d.id), !i;
20
- }), droppedIds: o };
18
+ const s = d.source === t && d.sourceHandle === r || d.target === t && d.targetHandle === r;
19
+ return s && n.push(d.id), !s;
20
+ }), droppedIds: n };
21
21
  }
22
- const pe = /^[a-z][a-z0-9_]*$/, me = 40;
23
- function ie(e) {
24
- return typeof e == "string" && e.length <= me && pe.test(e);
22
+ const we = /^[a-z][a-z0-9_]*$/, be = 40;
23
+ function pe(e) {
24
+ return typeof e == "string" && e.length <= be && we.test(e);
25
25
  }
26
- function G(e, t, r) {
27
- const o = e?.el ?? e?._container;
28
- if (!o || typeof o.dispatchEvent != "function")
26
+ function W(e, t, r) {
27
+ const n = e?.el ?? e?._container;
28
+ if (!n || typeof n.dispatchEvent != "function")
29
29
  return;
30
- const s = [], d = typeof window < "u" ? window : void 0, i = (a) => {
31
- s.push(a.error ?? a.message), a.preventDefault();
30
+ const i = [], d = typeof window < "u" ? window : void 0, s = (c) => {
31
+ i.push(c.error ?? c.message), c.preventDefault();
32
32
  };
33
- d && typeof d.addEventListener == "function" && d.addEventListener("error", i, !0);
33
+ d && typeof d.addEventListener == "function" && d.addEventListener("error", s, !0);
34
34
  try {
35
- o.dispatchEvent(new CustomEvent(t, { detail: r, bubbles: !0 }));
36
- } catch (a) {
37
- s.push(a);
35
+ n.dispatchEvent(new CustomEvent(t, { detail: r, bubbles: !0 }));
36
+ } catch (c) {
37
+ i.push(c);
38
38
  } finally {
39
- d && typeof d.removeEventListener == "function" && d.removeEventListener("error", i, !0);
39
+ d && typeof d.removeEventListener == "function" && d.removeEventListener("error", s, !0);
40
40
  }
41
- for (const a of s)
42
- console.error("[alpineflow/schema] listener threw while handling", t, a);
41
+ for (const c of i)
42
+ console.error("[alpineflow/schema] listener threw while handling", t, c);
43
43
  }
44
- function j(e, t) {
44
+ function V(e, t) {
45
45
  return e?.nodes?.find((r) => r.id === t) ?? null;
46
46
  }
47
- function ge(e, t, r) {
48
- const o = j(e, t);
49
- return o ? ie(r?.name) ? (o.data || (o.data = { label: t, fields: [] }), (o.data.fields ?? []).some((d) => d.name === r.name) ? { applied: !1, reason: "duplicate" } : (Array.isArray(o.data.fields) || (o.data.fields = []), o.data.fields.push({ ...r }), G(e, "schema:field-added", { nodeId: t, field: { ...r } }), { applied: !0 })) : { applied: !1, reason: "invalid-name" } : { applied: !1, reason: "no-node" };
47
+ function Se(e, t, r) {
48
+ const n = V(e, t);
49
+ return n ? pe(r?.name) ? (n.data || (n.data = { label: t, fields: [] }), (n.data.fields ?? []).some((d) => d.name === r.name) ? { applied: !1, reason: "duplicate" } : (Array.isArray(n.data.fields) || (n.data.fields = []), n.data.fields.push({ ...r }), W(e, "schema:field-added", { nodeId: t, field: { ...r } }), { applied: !0 })) : { applied: !1, reason: "invalid-name" } : { applied: !1, reason: "no-node" };
50
50
  }
51
- function he(e, t, r, o) {
52
- if (r === o)
51
+ function Ae(e, t, r, n) {
52
+ if (r === n)
53
53
  return { applied: !1, reason: "unchanged", cascadedEdgeIds: [] };
54
- if (!ie(o))
54
+ if (!pe(n))
55
55
  return { applied: !1, reason: "invalid-name", cascadedEdgeIds: [] };
56
- const s = j(e, t);
57
- if (!s)
58
- return { applied: !1, reason: "no-node", cascadedEdgeIds: [] };
59
- const d = s.data?.fields ?? [], i = d.find((u) => u.name === r);
56
+ const i = V(e, t);
60
57
  if (!i)
58
+ return { applied: !1, reason: "no-node", cascadedEdgeIds: [] };
59
+ const d = i.data?.fields ?? [], s = d.find((u) => u.name === r);
60
+ if (!s)
61
61
  return { applied: !1, reason: "no-field", cascadedEdgeIds: [] };
62
- if (d.some((u) => u.name === o))
62
+ if (d.some((u) => u.name === n))
63
63
  return { applied: !1, reason: "duplicate", cascadedEdgeIds: [] };
64
- i.name = o;
65
- const a = e.edges ?? [], { edges: n, cascadedIds: c } = fe(a, t, r, o);
66
- if (c.length > 0) {
67
- const u = new Map(n.map((l) => [l.id, l]));
64
+ s.name = n;
65
+ const c = e.edges ?? [], { edges: o, cascadedIds: a } = Ee(c, t, r, n);
66
+ if (a.length > 0) {
67
+ const u = new Map(o.map((l) => [l.id, l]));
68
68
  for (const l of e.edges) {
69
- const p = u.get(l.id);
70
- !p || p === l || (l.sourceHandle !== p.sourceHandle && (l.sourceHandle = p.sourceHandle), l.targetHandle !== p.targetHandle && (l.targetHandle = p.targetHandle));
69
+ const m = u.get(l.id);
70
+ !m || m === l || (l.sourceHandle !== m.sourceHandle && (l.sourceHandle = m.sourceHandle), l.targetHandle !== m.targetHandle && (l.targetHandle = m.targetHandle));
71
71
  }
72
72
  }
73
- return G(e, "schema:field-renamed", {
73
+ return W(e, "schema:field-renamed", {
74
74
  nodeId: t,
75
75
  oldName: r,
76
- newName: o,
77
- cascadedEdgeIds: c
78
- }), c.length > 0 && G(e, "schema:edges-cascaded", {
76
+ newName: n,
77
+ cascadedEdgeIds: a
78
+ }), a.length > 0 && W(e, "schema:edges-cascaded", {
79
79
  nodeId: t,
80
- fieldName: o,
81
- edgeIds: c,
80
+ fieldName: n,
81
+ edgeIds: a,
82
82
  operation: "rename"
83
- }), { applied: !0, cascadedEdgeIds: c };
83
+ }), { applied: !0, cascadedEdgeIds: a };
84
84
  }
85
- function ye(e, t, r) {
86
- const o = j(e, t);
87
- if (!o)
85
+ function Ie(e, t, r) {
86
+ const n = V(e, t);
87
+ if (!n)
88
88
  return { applied: !1, reason: "no-node", droppedEdgeIds: [] };
89
- const d = (o.data?.fields ?? []).findIndex((n) => n.name === r);
89
+ const d = (n.data?.fields ?? []).findIndex((o) => o.name === r);
90
90
  if (d === -1)
91
91
  return { applied: !1, reason: "no-field", droppedEdgeIds: [] };
92
- o.data.fields.splice(d, 1);
93
- const i = e.edges ?? [], { droppedIds: a } = ue(i, t, r);
94
- if (a.length > 0) {
95
- const n = new Set(a);
96
- for (let c = e.edges.length - 1; c >= 0; c--)
97
- n.has(e.edges[c].id) && e.edges.splice(c, 1);
92
+ n.data.fields.splice(d, 1);
93
+ const s = e.edges ?? [], { droppedIds: c } = ve(s, t, r);
94
+ if (c.length > 0) {
95
+ const o = new Set(c);
96
+ for (let a = e.edges.length - 1; a >= 0; a--)
97
+ o.has(e.edges[a].id) && e.edges.splice(a, 1);
98
98
  e._rebuildEdgeMap?.();
99
99
  }
100
- return G(e, "schema:field-removed", {
100
+ return W(e, "schema:field-removed", {
101
101
  nodeId: t,
102
102
  fieldName: r,
103
- droppedEdgeIds: a
104
- }), a.length > 0 && G(e, "schema:edges-cascaded", {
103
+ droppedEdgeIds: c
104
+ }), c.length > 0 && W(e, "schema:edges-cascaded", {
105
105
  nodeId: t,
106
106
  fieldName: r,
107
- edgeIds: a,
107
+ edgeIds: c,
108
108
  operation: "remove"
109
- }), { applied: !0, droppedEdgeIds: a };
109
+ }), { applied: !0, droppedEdgeIds: c };
110
110
  }
111
- function Ee(e, t, r) {
111
+ function Ne(e, t, r) {
112
112
  if (!Array.isArray(r))
113
113
  return { applied: !1, reason: "mismatch" };
114
114
  if (new Set(r).size !== r.length)
115
115
  return { applied: !1, reason: "mismatch" };
116
- const o = j(e, t);
117
- if (!o)
116
+ const n = V(e, t);
117
+ if (!n)
118
118
  return { applied: !1, reason: "no-node" };
119
- const s = o.data?.fields ?? [];
120
- if (r.length !== s.length)
119
+ const i = n.data?.fields ?? [];
120
+ if (r.length !== i.length)
121
121
  return { applied: !1, reason: "mismatch" };
122
- const d = new Set(s.map((c) => c.name)), i = new Set(r);
123
- if (d.size !== i.size)
122
+ const d = new Set(i.map((a) => a.name)), s = new Set(r);
123
+ if (d.size !== s.size)
124
124
  return { applied: !1, reason: "mismatch" };
125
- for (const c of r)
126
- if (!d.has(c))
125
+ for (const a of r)
126
+ if (!d.has(a))
127
127
  return { applied: !1, reason: "mismatch" };
128
- const a = /* @__PURE__ */ Object.create(null);
129
- for (const c of s)
130
- a[c.name] = c;
131
- const n = r.map((c) => a[c]);
132
- return o.data.fields.splice(0, o.data.fields.length, ...n), { applied: !0 };
128
+ const c = /* @__PURE__ */ Object.create(null);
129
+ for (const a of i)
130
+ c[a.name] = a;
131
+ const o = r.map((a) => c[a]);
132
+ return n.data.fields.splice(0, n.data.fields.length, ...o), { applied: !0 };
133
133
  }
134
- function de(e) {
134
+ function me(e) {
135
135
  const t = /* @__PURE__ */ new Map();
136
- for (const o of e)
137
- t.set(o.id, o);
136
+ for (const n of e)
137
+ t.set(n.id, n);
138
138
  const r = [];
139
- for (const o of e) {
140
- const s = o.data?.fields ?? [];
141
- for (const d of s) {
139
+ for (const n of e) {
140
+ const i = n.data?.fields ?? [];
141
+ for (const d of i) {
142
142
  if (typeof d?.name != "string" || !d.name.endsWith("_id"))
143
143
  continue;
144
- const i = d.name.slice(0, -3);
145
- if (!i)
144
+ const s = d.name.slice(0, -3);
145
+ if (!s)
146
146
  continue;
147
- const a = t.get(i);
148
- if (!a || a.id === o.id)
147
+ const c = t.get(s);
148
+ if (!c || c.id === n.id)
149
149
  continue;
150
- const n = a.data?.fields ?? [], u = n.find((l) => l.key === "primary")?.name ?? n[0]?.name ?? "id";
150
+ const o = c.data?.fields ?? [], u = o.find((l) => l.key === "primary")?.name ?? o[0]?.name ?? "id";
151
151
  r.push({
152
- fromNodeId: o.id,
152
+ fromNodeId: n.id,
153
153
  fromFieldName: d.name,
154
- toNodeId: a.id,
154
+ toNodeId: c.id,
155
155
  toFieldName: u,
156
156
  confidence: "exact"
157
157
  });
@@ -159,337 +159,337 @@ function de(e) {
159
159
  }
160
160
  return r;
161
161
  }
162
- function ve(e, t) {
162
+ function Ce(e, t) {
163
163
  return e === t ? !0 : e === void 0 || t === void 0 ? e === t : JSON.stringify(e) === JSON.stringify(t);
164
164
  }
165
- function te(e, t, r = {}) {
166
- const o = r.deleteMissing ?? !0, s = new Map(e.map((i) => [i.id, i])), d = [];
167
- for (const i of t) {
168
- const a = s.get(i.id);
169
- if (!a) {
170
- d.push(i);
165
+ function se(e, t, r = {}) {
166
+ const n = r.deleteMissing ?? !0, i = new Map(e.map((s) => [s.id, s])), d = [];
167
+ for (const s of t) {
168
+ const c = i.get(s.id);
169
+ if (!c) {
170
+ d.push(s);
171
171
  continue;
172
172
  }
173
- if (o)
174
- for (const n of Object.keys(a))
175
- n !== "id" && !(n in i) && delete a[n];
176
- for (const [n, c] of Object.entries(i))
177
- n === "id" || n === "__proto__" || n === "constructor" || n === "prototype" || ve(a[n], c) || (a[n] = c);
178
- d.push(a);
173
+ if (n)
174
+ for (const o of Object.keys(c))
175
+ o !== "id" && !(o in s) && delete c[o];
176
+ for (const [o, a] of Object.entries(s))
177
+ o === "id" || o === "__proto__" || o === "constructor" || o === "prototype" || Ce(c[o], a) || (c[o] = a);
178
+ d.push(c);
179
179
  }
180
180
  return d;
181
181
  }
182
182
  function K(e) {
183
- const t = (e.nodes ?? []).map((o) => ({
184
- id: o.id,
185
- label: o.data?.label ?? "",
186
- fields: (o.data?.fields ?? []).map((s) => ({ ...s })),
187
- position: { x: o.position?.x ?? 0, y: o.position?.y ?? 0 }
188
- })), r = (e.edges ?? []).map((o) => {
189
- const s = { id: o.id, source: o.source, target: o.target };
190
- return o.sourceHandle !== void 0 && (s.sourceHandle = o.sourceHandle), o.targetHandle !== void 0 && (s.targetHandle = o.targetHandle), o.label !== void 0 && (s.label = o.label), s;
183
+ const t = (e.nodes ?? []).map((n) => ({
184
+ id: n.id,
185
+ label: n.data?.label ?? "",
186
+ fields: (n.data?.fields ?? []).map((i) => ({ ...i })),
187
+ position: { x: n.position?.x ?? 0, y: n.position?.y ?? 0 }
188
+ })), r = (e.edges ?? []).map((n) => {
189
+ const i = { id: n.id, source: n.source, target: n.target };
190
+ return n.sourceHandle !== void 0 && (i.sourceHandle = n.sourceHandle), n.targetHandle !== void 0 && (i.targetHandle = n.targetHandle), n.label !== void 0 && (i.label = n.label), i;
191
191
  });
192
192
  return { version: 1, nodes: t, edges: r };
193
193
  }
194
- function ae(e, t) {
194
+ function ge(e, t) {
195
195
  if (!t || typeof t.version != "number")
196
196
  throw new Error("[alpineflow/schema] schemaFromJSON: missing or invalid version");
197
197
  if (t.version !== 1)
198
198
  throw new Error(`[alpineflow/schema] schemaFromJSON: unsupported version ${t.version}`);
199
- const r = (t.nodes ?? []).map((i) => ({
200
- id: i.id,
201
- position: { x: i.position?.x ?? 0, y: i.position?.y ?? 0 },
199
+ const r = (t.nodes ?? []).map((s) => ({
200
+ id: s.id,
201
+ position: { x: s.position?.x ?? 0, y: s.position?.y ?? 0 },
202
202
  data: {
203
- label: i.label,
204
- fields: (i.fields ?? []).map((a) => ({ ...a }))
203
+ label: s.label,
204
+ fields: (s.fields ?? []).map((c) => ({ ...c }))
205
205
  }
206
- })), o = (t.edges ?? []).map((i) => {
207
- const a = { id: i.id, source: i.source, target: i.target };
208
- return i.sourceHandle !== void 0 && (a.sourceHandle = i.sourceHandle), i.targetHandle !== void 0 && (a.targetHandle = i.targetHandle), i.label !== void 0 && (a.label = i.label), a;
209
- }), s = te(e.nodes, r, { deleteMissing: !1 });
210
- e.nodes.splice(0, e.nodes.length, ...s);
211
- const d = te(e.edges, o, { deleteMissing: !1 });
206
+ })), n = (t.edges ?? []).map((s) => {
207
+ const c = { id: s.id, source: s.source, target: s.target };
208
+ return s.sourceHandle !== void 0 && (c.sourceHandle = s.sourceHandle), s.targetHandle !== void 0 && (c.targetHandle = s.targetHandle), s.label !== void 0 && (c.label = s.label), c;
209
+ }), i = se(e.nodes, r, { deleteMissing: !1 });
210
+ e.nodes.splice(0, e.nodes.length, ...i);
211
+ const d = se(e.edges, n, { deleteMissing: !1 });
212
212
  e.edges.splice(0, e.edges.length, ...d), e._rebuildNodeMap?.(), e._rebuildEdgeMap?.(), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => {
213
213
  e._layoutAnimTick = (e._layoutAnimTick ?? 0) + 1;
214
214
  });
215
215
  }
216
- function be(e, t) {
217
- for (const n of t)
218
- if (n && typeof n.source == "string" && n.source === n.target)
216
+ function Le(e, t) {
217
+ for (const o of t)
218
+ if (o && typeof o.source == "string" && o.source === o.target)
219
219
  return !0;
220
- const r = /* @__PURE__ */ new Map(), o = (n) => {
221
- let c = r.get(n);
222
- return c || (c = [], r.set(n, c)), c;
220
+ const r = /* @__PURE__ */ new Map(), n = (o) => {
221
+ let a = r.get(o);
222
+ return a || (a = [], r.set(o, a)), a;
223
223
  };
224
- for (const n of e)
225
- n && typeof n.id == "string" && o(n.id);
226
- for (const n of t)
227
- !n || typeof n.source != "string" || typeof n.target != "string" || (o(n.source).push(n.target), o(n.target));
228
- const s = 0, d = 1, i = 2, a = /* @__PURE__ */ new Map();
229
- for (const n of r.keys())
230
- a.set(n, s);
231
- for (const n of r.keys()) {
232
- if (a.get(n) !== s) continue;
233
- const c = [{ node: n, idx: 0 }];
234
- for (a.set(n, d); c.length > 0; ) {
235
- const u = c[c.length - 1], l = r.get(u.node) ?? [];
224
+ for (const o of e)
225
+ o && typeof o.id == "string" && n(o.id);
226
+ for (const o of t)
227
+ !o || typeof o.source != "string" || typeof o.target != "string" || (n(o.source).push(o.target), n(o.target));
228
+ const i = 0, d = 1, s = 2, c = /* @__PURE__ */ new Map();
229
+ for (const o of r.keys())
230
+ c.set(o, i);
231
+ for (const o of r.keys()) {
232
+ if (c.get(o) !== i) continue;
233
+ const a = [{ node: o, idx: 0 }];
234
+ for (c.set(o, d); a.length > 0; ) {
235
+ const u = a[a.length - 1], l = r.get(u.node) ?? [];
236
236
  if (u.idx < l.length) {
237
- const p = l[u.idx++], m = a.get(p);
238
- if (m === d)
237
+ const m = l[u.idx++], g = c.get(m);
238
+ if (g === d)
239
239
  return !0;
240
- m === s && (a.set(p, d), c.push({ node: p, idx: 0 }));
240
+ g === i && (c.set(m, d), a.push({ node: m, idx: 0 }));
241
241
  } else
242
- a.set(u.node, i), c.pop();
242
+ c.set(u.node, s), a.pop();
243
243
  }
244
244
  }
245
245
  return !1;
246
246
  }
247
- function we(e) {
248
- const t = [], r = Array.isArray(e?.nodes) ? e.nodes : [], o = Array.isArray(e?.edges) ? e.edges : [], s = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
249
- for (const n of r)
250
- !n || typeof n.id != "string" || (s.has(n.id) && d.add(n.id), s.add(n.id));
251
- for (const n of d)
247
+ function Re(e) {
248
+ const t = [], r = Array.isArray(e?.nodes) ? e.nodes : [], n = Array.isArray(e?.edges) ? e.edges : [], i = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
249
+ for (const o of r)
250
+ !o || typeof o.id != "string" || (i.has(o.id) && d.add(o.id), i.add(o.id));
251
+ for (const o of d)
252
252
  t.push({
253
253
  severity: "error",
254
254
  code: "duplicate-node-id",
255
- nodeId: n,
256
- message: `Duplicate node id "${n}".`
255
+ nodeId: o,
256
+ message: `Duplicate node id "${o}".`
257
257
  });
258
- for (const n of r) {
259
- if (!n || typeof n.id != "string") continue;
260
- const c = Array.isArray(n.data?.fields) ? n.data.fields : [];
261
- if (c.length === 0) continue;
258
+ for (const o of r) {
259
+ if (!o || typeof o.id != "string") continue;
260
+ const a = Array.isArray(o.data?.fields) ? o.data.fields : [];
261
+ if (a.length === 0) continue;
262
262
  const u = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
263
- for (const m of c)
264
- !m || typeof m.name != "string" || (u.has(m.name) && l.add(m.name), u.add(m.name));
265
- for (const m of l)
263
+ for (const g of a)
264
+ !g || typeof g.name != "string" || (u.has(g.name) && l.add(g.name), u.add(g.name));
265
+ for (const g of l)
266
266
  t.push({
267
267
  severity: "error",
268
268
  code: "duplicate-field",
269
- nodeId: n.id,
270
- fieldName: m,
271
- message: `Duplicate field "${m}" on node "${n.id}".`
269
+ nodeId: o.id,
270
+ fieldName: g,
271
+ message: `Duplicate field "${g}" on node "${o.id}".`
272
272
  });
273
- c.some((m) => m && m.key === "primary") || t.push({
273
+ a.some((g) => g && g.key === "primary") || t.push({
274
274
  severity: "warning",
275
275
  code: "missing-primary-key",
276
- nodeId: n.id,
277
- message: `Node "${n.id}" has no primary-key field.`
276
+ nodeId: o.id,
277
+ message: `Node "${o.id}" has no primary-key field.`
278
278
  });
279
279
  }
280
- for (const n of o) {
281
- if (!n) continue;
282
- const c = typeof n.id == "string" ? n.id : void 0;
283
- (typeof n.source != "string" || !s.has(n.source)) && t.push({
280
+ for (const o of n) {
281
+ if (!o) continue;
282
+ const a = typeof o.id == "string" ? o.id : void 0;
283
+ (typeof o.source != "string" || !i.has(o.source)) && t.push({
284
284
  severity: "error",
285
285
  code: "dangling-edge",
286
- edgeId: c,
287
- nodeId: typeof n.source == "string" ? n.source : void 0,
288
- message: `Edge ${c ? `"${c}" ` : ""}references missing source node "${n.source}".`
289
- }), (typeof n.target != "string" || !s.has(n.target)) && t.push({
286
+ edgeId: a,
287
+ nodeId: typeof o.source == "string" ? o.source : void 0,
288
+ message: `Edge ${a ? `"${a}" ` : ""}references missing source node "${o.source}".`
289
+ }), (typeof o.target != "string" || !i.has(o.target)) && t.push({
290
290
  severity: "error",
291
291
  code: "dangling-edge",
292
- edgeId: c,
293
- nodeId: typeof n.target == "string" ? n.target : void 0,
294
- message: `Edge ${c ? `"${c}" ` : ""}references missing target node "${n.target}".`
292
+ edgeId: a,
293
+ nodeId: typeof o.target == "string" ? o.target : void 0,
294
+ message: `Edge ${a ? `"${a}" ` : ""}references missing target node "${o.target}".`
295
295
  });
296
296
  }
297
- const i = /* @__PURE__ */ new Set();
298
- for (const n of o)
299
- n && (typeof n.source == "string" && i.add(n.source), typeof n.target == "string" && i.add(n.target));
300
- for (const n of r)
301
- !n || typeof n.id != "string" || i.has(n.id) || t.push({
297
+ const s = /* @__PURE__ */ new Set();
298
+ for (const o of n)
299
+ o && (typeof o.source == "string" && s.add(o.source), typeof o.target == "string" && s.add(o.target));
300
+ for (const o of r)
301
+ !o || typeof o.id != "string" || s.has(o.id) || t.push({
302
302
  severity: "warning",
303
303
  code: "disconnected-node",
304
- nodeId: n.id,
305
- message: `Node "${n.id}" has no connected edges.`
304
+ nodeId: o.id,
305
+ message: `Node "${o.id}" has no connected edges.`
306
306
  });
307
- return be(r, o) && t.push({
307
+ return Le(r, n) && t.push({
308
308
  severity: "warning",
309
309
  code: "cycle",
310
310
  message: "Directed cycle detected in edge graph."
311
- }), { valid: !t.some((n) => n.severity === "error"), issues: t };
311
+ }), { valid: !t.some((o) => o.severity === "error"), issues: t };
312
312
  }
313
- function ne(e) {
313
+ function ie(e) {
314
314
  return !e || !Array.isArray(e.nodes) ? [] : e.nodes.filter((t) => !!t && typeof t.id == "string");
315
315
  }
316
- function oe(e) {
316
+ function de(e) {
317
317
  return !e || !Array.isArray(e.edges) ? [] : e.edges.filter((t) => !!t && typeof t.id == "string");
318
318
  }
319
- function re(e) {
319
+ function ce(e) {
320
320
  const t = /* @__PURE__ */ new Map(), r = Array.isArray(e.fields) ? e.fields : [];
321
- for (const o of r)
322
- o && typeof o.name == "string" && t.set(o.name, o);
321
+ for (const n of r)
322
+ n && typeof n.name == "string" && t.set(n.name, n);
323
323
  return t;
324
324
  }
325
- function Se(e, t, r = {}) {
326
- const o = ne(e), s = ne(t), d = oe(e), i = oe(t), a = /* @__PURE__ */ new Map();
327
- for (const f of o)
328
- a.set(f.id, f);
329
- const n = /* @__PURE__ */ new Map();
330
- for (const f of s)
331
- n.set(f.id, f);
332
- const c = [], u = [];
333
- for (const f of n.keys())
334
- a.has(f) || c.push(f);
335
- for (const f of a.keys())
336
- n.has(f) || u.push(f);
337
- const l = [], p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set();
325
+ function Fe(e, t, r = {}) {
326
+ const n = ie(e), i = ie(t), d = de(e), s = de(t), c = /* @__PURE__ */ new Map();
327
+ for (const f of n)
328
+ c.set(f.id, f);
329
+ const o = /* @__PURE__ */ new Map();
330
+ for (const f of i)
331
+ o.set(f.id, f);
332
+ const a = [], u = [];
333
+ for (const f of o.keys())
334
+ c.has(f) || a.push(f);
335
+ for (const f of c.keys())
336
+ o.has(f) || u.push(f);
337
+ const l = [], m = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set();
338
338
  if (r.detectRenames) {
339
- const f = (h) => (Array.isArray(h.fields) ? h.fields : []).filter((T) => T && typeof T.name == "string").map((T) => T.name).sort().join("\0");
339
+ const f = (h) => (Array.isArray(h.fields) ? h.fields : []).filter((x) => x && typeof x.name == "string").map((x) => x.name).sort().join("\0");
340
340
  for (const h of u) {
341
- const I = a.get(h);
341
+ const I = c.get(h);
342
342
  if (!I) continue;
343
- const T = f(I), D = [];
344
- for (const F of c) {
345
- if (p.has(F)) continue;
346
- const C = n.get(F);
347
- C && f(C) === T && D.push(F);
343
+ const x = f(I), _ = [];
344
+ for (const R of a) {
345
+ if (m.has(R)) continue;
346
+ const C = o.get(R);
347
+ C && f(C) === x && _.push(R);
348
348
  }
349
- if (D.length === 1) {
350
- const F = D[0];
351
- l.push({ from: h, to: F }), p.add(F), m.add(h);
349
+ if (_.length === 1) {
350
+ const R = _[0];
351
+ l.push({ from: h, to: R }), m.add(R), g.add(h);
352
352
  }
353
353
  }
354
354
  }
355
- const b = c.filter((f) => !p.has(f)), g = u.filter((f) => !m.has(f)), y = [];
356
- for (const f of a.keys())
357
- n.has(f) && y.push({ beforeId: f, afterId: f });
355
+ const v = a.filter((f) => !m.has(f)), b = u.filter((f) => !g.has(f)), p = [];
356
+ for (const f of c.keys())
357
+ o.has(f) && p.push({ beforeId: f, afterId: f });
358
358
  for (const f of l)
359
- y.push({ beforeId: f.from, afterId: f.to });
360
- const E = /* @__PURE__ */ new Map();
359
+ p.push({ beforeId: f.from, afterId: f.to });
360
+ const y = /* @__PURE__ */ new Map();
361
361
  for (const f of r.fieldRenames ?? []) {
362
362
  if (!f || typeof f.nodeId != "string" || typeof f.from != "string" || typeof f.to != "string") continue;
363
- let h = E.get(f.nodeId);
364
- h || (h = [], E.set(f.nodeId, h)), h.push({ from: f.from, to: f.to });
363
+ let h = y.get(f.nodeId);
364
+ h || (h = [], y.set(f.nodeId, h)), h.push({ from: f.from, to: f.to });
365
365
  }
366
- const S = /* @__PURE__ */ new Map();
366
+ const w = /* @__PURE__ */ new Map();
367
367
  for (const f of l)
368
- S.set(f.from, f.to);
368
+ w.set(f.from, f.to);
369
369
  for (const f of r.fieldRenames ?? []) {
370
370
  if (!f || typeof f.nodeId != "string") continue;
371
- const h = S.get(f.nodeId);
372
- if (h && !E.has(h)) {
373
- const I = E.get(f.nodeId) ?? [];
374
- E.set(h, I);
371
+ const h = w.get(f.nodeId);
372
+ if (h && !y.has(h)) {
373
+ const I = y.get(f.nodeId) ?? [];
374
+ y.set(h, I);
375
375
  }
376
376
  }
377
- const v = [], A = [], x = [], N = [];
378
- for (const { beforeId: f, afterId: h } of y) {
379
- const I = a.get(f), T = n.get(h);
380
- if (!I || !T) continue;
381
- const D = re(I), F = re(T), C = E.get(h) ?? E.get(f) ?? [], P = /* @__PURE__ */ new Set(), z = /* @__PURE__ */ new Set();
382
- for (const w of C) {
383
- const B = D.get(w.from), M = F.get(w.to);
384
- if (!B || !M || P.has(w.from) || z.has(w.to)) continue;
385
- v.push({ nodeId: h, from: w.from, to: w.to }), P.add(w.from), z.add(w.to);
386
- const J = typeof B.type == "string" ? B.type : "", Y = typeof M.type == "string" ? M.type : "";
387
- J !== Y && N.push({
377
+ const E = [], A = [], F = [], N = [];
378
+ for (const { beforeId: f, afterId: h } of p) {
379
+ const I = c.get(f), x = o.get(h);
380
+ if (!I || !x) continue;
381
+ const _ = ce(I), R = ce(x), C = y.get(h) ?? y.get(f) ?? [], P = /* @__PURE__ */ new Set(), Z = /* @__PURE__ */ new Set();
382
+ for (const S of C) {
383
+ const B = _.get(S.from), M = R.get(S.to);
384
+ if (!B || !M || P.has(S.from) || Z.has(S.to)) continue;
385
+ E.push({ nodeId: h, from: S.from, to: S.to }), P.add(S.from), Z.add(S.to);
386
+ const j = typeof B.type == "string" ? B.type : "", z = typeof M.type == "string" ? M.type : "";
387
+ j !== z && N.push({
388
388
  nodeId: h,
389
- fieldName: w.to,
390
- from: J,
391
- to: Y
389
+ fieldName: S.to,
390
+ from: j,
391
+ to: z
392
392
  });
393
393
  }
394
- for (const [w] of F)
395
- z.has(w) || D.has(w) || A.push({ nodeId: h, fieldName: w });
396
- for (const [w] of D)
397
- P.has(w) || F.has(w) || x.push({ nodeId: h, fieldName: w });
398
- for (const [w, B] of D) {
399
- if (P.has(w)) continue;
400
- const M = F.get(w);
394
+ for (const [S] of R)
395
+ Z.has(S) || _.has(S) || A.push({ nodeId: h, fieldName: S });
396
+ for (const [S] of _)
397
+ P.has(S) || R.has(S) || F.push({ nodeId: h, fieldName: S });
398
+ for (const [S, B] of _) {
399
+ if (P.has(S)) continue;
400
+ const M = R.get(S);
401
401
  if (!M) continue;
402
- const J = typeof B.type == "string" ? B.type : "", Y = typeof M.type == "string" ? M.type : "";
403
- J !== Y && N.push({
402
+ const j = typeof B.type == "string" ? B.type : "", z = typeof M.type == "string" ? M.type : "";
403
+ j !== z && N.push({
404
404
  nodeId: h,
405
- fieldName: w,
406
- from: J,
407
- to: Y
405
+ fieldName: S,
406
+ from: j,
407
+ to: z
408
408
  });
409
409
  }
410
410
  }
411
- const R = /* @__PURE__ */ new Set();
412
- for (const f of d) R.add(f.id);
411
+ const T = /* @__PURE__ */ new Set();
412
+ for (const f of d) T.add(f.id);
413
413
  const $ = /* @__PURE__ */ new Set();
414
- for (const f of i) $.add(f.id);
415
- const k = [], q = [];
414
+ for (const f of s) $.add(f.id);
415
+ const D = [], q = [];
416
416
  for (const f of $)
417
- R.has(f) || k.push(f);
418
- for (const f of R)
417
+ T.has(f) || D.push(f);
418
+ for (const f of T)
419
419
  $.has(f) || q.push(f);
420
- b.sort(), g.sort(), l.sort((f, h) => f.from.localeCompare(h.from));
420
+ v.sort(), b.sort(), l.sort((f, h) => f.from.localeCompare(h.from));
421
421
  const L = (f) => `${f.nodeId}\0${f.fieldName}`;
422
- return A.sort((f, h) => L(f).localeCompare(L(h))), x.sort((f, h) => L(f).localeCompare(L(h))), v.sort((f, h) => {
422
+ return A.sort((f, h) => L(f).localeCompare(L(h))), F.sort((f, h) => L(f).localeCompare(L(h))), E.sort((f, h) => {
423
423
  const I = f.nodeId.localeCompare(h.nodeId);
424
424
  return I !== 0 ? I : f.from.localeCompare(h.from);
425
- }), N.sort((f, h) => L(f).localeCompare(L(h))), k.sort(), q.sort(), {
426
- addedNodes: b,
427
- removedNodes: g,
425
+ }), N.sort((f, h) => L(f).localeCompare(L(h))), D.sort(), q.sort(), {
426
+ addedNodes: v,
427
+ removedNodes: b,
428
428
  renamedNodes: l,
429
429
  addedFields: A,
430
- removedFields: x,
431
- renamedFields: v,
430
+ removedFields: F,
431
+ renamedFields: E,
432
432
  changedFieldTypes: N,
433
- addedEdges: k,
433
+ addedEdges: D,
434
434
  removedEdges: q
435
435
  };
436
436
  }
437
- const Ie = {
437
+ const xe = {
438
438
  rankdir: "LR",
439
439
  nodeShape: "plaintext",
440
440
  includeFieldTypes: !0,
441
441
  includeFieldKeys: !0,
442
442
  graphName: "schema"
443
443
  };
444
- function W(e) {
444
+ function Y(e) {
445
445
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
446
446
  }
447
- function _(e) {
447
+ function H(e) {
448
448
  return e.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
449
449
  }
450
- function Ae(e, t) {
451
- const r = String(e?.id ?? ""), o = String(e?.data?.label ?? ""), s = Array.isArray(e?.data?.fields) ? e.data.fields : [], d = 1 + (t.includeFieldKeys ? 1 : 0) + (t.includeFieldTypes ? 1 : 0), i = [];
452
- i.push(
453
- ` <TR><TD BGCOLOR="#f0f0f0" COLSPAN="${d}"><B>${W(o)}</B></TD></TR>`
450
+ function Te(e, t) {
451
+ const r = String(e?.id ?? ""), n = String(e?.data?.label ?? ""), i = Array.isArray(e?.data?.fields) ? e.data.fields : [], d = 1 + (t.includeFieldKeys ? 1 : 0) + (t.includeFieldTypes ? 1 : 0), s = [];
452
+ s.push(
453
+ ` <TR><TD BGCOLOR="#f0f0f0" COLSPAN="${d}"><B>${Y(n)}</B></TD></TR>`
454
454
  );
455
- for (const a of s) {
456
- const n = String(a?.name ?? ""), c = [];
455
+ for (const c of i) {
456
+ const o = String(c?.name ?? ""), a = [];
457
457
  if (t.includeFieldKeys) {
458
- const u = a?.key === "primary" ? "PK" : a?.key === "foreign" ? "FK" : "";
459
- c.push(`<TD>${u}</TD>`);
458
+ const u = c?.key === "primary" ? "PK" : c?.key === "foreign" ? "FK" : "";
459
+ a.push(`<TD>${u}</TD>`);
460
460
  }
461
- c.push(`<TD PORT="${W(n)}">${W(n)}</TD>`), t.includeFieldTypes && c.push(`<TD>${W(String(a?.type ?? ""))}</TD>`), i.push(` <TR>${c.join("")}</TR>`);
461
+ a.push(`<TD PORT="${Y(o)}">${Y(o)}</TD>`), t.includeFieldTypes && a.push(`<TD>${Y(String(c?.type ?? ""))}</TD>`), s.push(` <TR>${a.join("")}</TR>`);
462
462
  }
463
- return ` "${_(r)}" [label=<
463
+ return ` "${H(r)}" [label=<
464
464
  <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4">
465
- ${i.join(`
465
+ ${s.join(`
466
466
  `)}
467
467
  </TABLE>
468
468
  >];`;
469
469
  }
470
- function Ne(e) {
471
- const t = `"${_(String(e?.source ?? ""))}"`, r = `"${_(String(e?.target ?? ""))}"`, o = e?.sourceHandle ? `:"${_(String(e.sourceHandle))}"` : "", s = e?.targetHandle ? `:"${_(String(e.targetHandle))}"` : "", d = e?.label ? ` [label="${_(String(e.label))}"]` : "";
472
- return ` ${t}${o} -> ${r}${s}${d};`;
470
+ function _e(e) {
471
+ const t = `"${H(String(e?.source ?? ""))}"`, r = `"${H(String(e?.target ?? ""))}"`, n = e?.sourceHandle ? `:"${H(String(e.sourceHandle))}"` : "", i = e?.targetHandle ? `:"${H(String(e.targetHandle))}"` : "", d = e?.label ? ` [label="${H(String(e.label))}"]` : "";
472
+ return ` ${t}${n} -> ${r}${i}${d};`;
473
473
  }
474
- function Ce(e, t = {}) {
475
- const r = { ...Ie, ...t }, o = [];
476
- o.push(`digraph "${_(r.graphName)}" {`), o.push(` rankdir=${r.rankdir};`), o.push(` node [shape=${r.nodeShape}];`);
477
- for (const s of e?.nodes ?? [])
478
- o.push(Ae(s, r));
479
- for (const s of e?.edges ?? [])
480
- o.push(Ne(s));
481
- return o.push("}"), o.join(`
474
+ function De(e, t = {}) {
475
+ const r = { ...xe, ...t }, n = [];
476
+ n.push(`digraph "${H(r.graphName)}" {`), n.push(` rankdir=${r.rankdir};`), n.push(` node [shape=${r.nodeShape}];`);
477
+ for (const i of e?.nodes ?? [])
478
+ n.push(Te(i, r));
479
+ for (const i of e?.edges ?? [])
480
+ n.push(_e(i));
481
+ return n.push("}"), n.join(`
482
482
  `);
483
483
  }
484
- const Le = ["dagre", "tree", "grid"];
485
- async function Fe(e, t = {}) {
486
- const r = t.direction ?? "LR", o = t.nodeSpacing ?? 80, s = t.rankSpacing ?? 160, d = xe(t.algorithm), i = t.deriveFromReferences ? Te(e) : null;
484
+ const ke = ["dagre", "tree", "grid"];
485
+ async function $e(e, t = {}) {
486
+ const r = t.direction ?? "LR", n = t.nodeSpacing ?? 80, i = t.rankSpacing ?? 160, d = Me(t.algorithm), s = t.deriveFromReferences ? He(e) : null;
487
487
  try {
488
- for (const a of d) {
489
- if (a === "dagre" && Re(e, r, o, s) || a === "tree" && De(e, r, o, s))
488
+ for (const c of d) {
489
+ if (c === "dagre" && Oe(e, r, n, i) || c === "tree" && qe(e, r, n, i))
490
490
  return;
491
- if (a === "grid") {
492
- ke(e.nodes ?? [], o, s, r);
491
+ if (c === "grid") {
492
+ Pe(e.nodes ?? [], n, i, r);
493
493
  return;
494
494
  }
495
495
  }
@@ -497,151 +497,151 @@ async function Fe(e, t = {}) {
497
497
  '[alpineflow/schema] schemaLayout: no layout algorithm available. Register @getartisanflow/alpineflow/dagre (or hierarchy), or pass { algorithm: "grid" } for the always-available fallback.'
498
498
  );
499
499
  } finally {
500
- i && i.restore();
500
+ s && s.restore();
501
501
  }
502
502
  }
503
- function xe(e) {
504
- return e ? [e] : [...Le];
503
+ function Me(e) {
504
+ return e ? [e] : [...ke];
505
505
  }
506
- function Te(e) {
506
+ function He(e) {
507
507
  const t = e.edges;
508
508
  if (!Array.isArray(t))
509
509
  return null;
510
- const r = t.slice(), o = de(e.nodes ?? []).map((s, d) => ({
510
+ const r = t.slice(), n = me(e.nodes ?? []).map((i, d) => ({
511
511
  id: `schema-layout-inferred-${d}`,
512
- source: s.fromNodeId,
513
- target: s.toNodeId,
514
- sourceHandle: s.fromFieldName,
515
- targetHandle: s.toFieldName
512
+ source: i.fromNodeId,
513
+ target: i.toNodeId,
514
+ sourceHandle: i.fromFieldName,
515
+ targetHandle: i.toFieldName
516
516
  }));
517
- return t.splice(0, t.length, ...o), {
517
+ return t.splice(0, t.length, ...n), {
518
518
  restore: () => {
519
519
  t.splice(0, t.length, ...r);
520
520
  }
521
521
  };
522
522
  }
523
- function Re(e, t, r, o) {
523
+ function Oe(e, t, r, n) {
524
524
  if (typeof e.layout != "function")
525
525
  return !1;
526
526
  try {
527
527
  return e.layout({
528
528
  direction: t,
529
529
  nodesep: r,
530
- ranksep: o
530
+ ranksep: n
531
531
  }), !0;
532
532
  } catch {
533
533
  return !1;
534
534
  }
535
535
  }
536
- function De(e, t, r, o) {
536
+ function qe(e, t, r, n) {
537
537
  if (typeof e.treeLayout != "function")
538
538
  return !1;
539
539
  try {
540
540
  return e.treeLayout({
541
541
  direction: t,
542
542
  nodeWidth: r + 200,
543
- nodeHeight: o + 80
543
+ nodeHeight: n + 80
544
544
  }), !0;
545
545
  } catch {
546
546
  return !1;
547
547
  }
548
548
  }
549
- function ke(e, t, r, o) {
550
- const s = e.length;
551
- if (s === 0)
549
+ function Pe(e, t, r, n) {
550
+ const i = e.length;
551
+ if (i === 0)
552
552
  return;
553
- const d = Math.max(1, Math.ceil(Math.sqrt(s))), i = Math.ceil(s / d), a = t + 300, n = r + 200;
554
- for (let c = 0; c < s; c++) {
555
- const u = c % d, l = Math.floor(c / d);
556
- let p = u * a, m = l * n;
557
- o === "BT" ? m = (i - 1 - l) * n : o === "RL" && (p = (d - 1 - u) * a), e[c].position = { x: p, y: m };
553
+ const d = Math.max(1, Math.ceil(Math.sqrt(i))), s = Math.ceil(i / d), c = t + 300, o = r + 200;
554
+ for (let a = 0; a < i; a++) {
555
+ const u = a % d, l = Math.floor(a / d);
556
+ let m = u * c, g = l * o;
557
+ n === "BT" ? g = (s - 1 - l) * o : n === "RL" && (m = (d - 1 - u) * c), e[a].position = { x: m, y: g };
558
558
  }
559
559
  }
560
- const se = [
560
+ const ae = [
561
561
  "schema:field-added",
562
562
  "schema:field-renamed",
563
563
  "schema:field-removed",
564
564
  "schema:edges-cascaded"
565
565
  ];
566
- function Ve(e, t = {}) {
567
- const r = Math.max(1, t.limit ?? 50), o = [], s = [];
568
- let d = 0, i = 0, a = null, n = !1;
569
- const c = e?.el ?? e?._container ?? null;
570
- if (!c || typeof c.addEventListener != "function")
571
- return He();
566
+ function ct(e, t = {}) {
567
+ const r = Math.max(1, t.limit ?? 50), n = [], i = [];
568
+ let d = 0, s = 0, c = null, o = !1;
569
+ const a = e?.el ?? e?._container ?? null;
570
+ if (!a || typeof a.addEventListener != "function")
571
+ return Be();
572
572
  const u = () => {
573
- for (; o.length > r && o.length > 1; )
574
- o.shift();
575
- }, l = (y) => {
576
- const E = o[o.length - 1];
577
- E !== void 0 && JSON.stringify(E) === JSON.stringify(y) || (o.push(y), u(), s.length = 0);
578
- }, p = () => {
579
- n || d > 0 || i > 0 || l(K(e));
573
+ for (; n.length > r && n.length > 1; )
574
+ n.shift();
575
+ }, l = (p) => {
576
+ const y = n[n.length - 1];
577
+ y !== void 0 && JSON.stringify(y) === JSON.stringify(p) || (n.push(p), u(), i.length = 0);
578
+ }, m = () => {
579
+ o || d > 0 || s > 0 || l(K(e));
580
580
  };
581
- o.push(K(e));
582
- const m = () => {
583
- p();
581
+ n.push(K(e));
582
+ const g = () => {
583
+ m();
584
584
  };
585
- for (const y of se)
586
- c.addEventListener(y, m);
587
- const b = (y) => {
585
+ for (const p of ae)
586
+ a.addEventListener(p, g);
587
+ const v = (p) => {
588
588
  d++;
589
589
  try {
590
- ae(e, y);
590
+ ge(e, p);
591
591
  } finally {
592
592
  d--;
593
593
  }
594
594
  };
595
595
  return {
596
596
  get canUndo() {
597
- return o.length > 1;
597
+ return n.length > 1;
598
598
  },
599
599
  get canRedo() {
600
- return s.length > 0;
600
+ return i.length > 0;
601
601
  },
602
602
  undo() {
603
- if (n || o.length <= 1)
603
+ if (o || n.length <= 1)
604
604
  return !1;
605
- const y = o.pop();
606
- s.push(y);
607
- const E = o[o.length - 1];
608
- return b(E), !0;
605
+ const p = n.pop();
606
+ i.push(p);
607
+ const y = n[n.length - 1];
608
+ return v(y), !0;
609
609
  },
610
610
  redo() {
611
- if (n || s.length === 0)
611
+ if (o || i.length === 0)
612
612
  return !1;
613
- const y = s.pop();
614
- return o.push(y), b(y), !0;
613
+ const p = i.pop();
614
+ return n.push(p), v(p), !0;
615
615
  },
616
616
  clear() {
617
- o.length = 0, s.length = 0, n || o.push(K(e));
617
+ n.length = 0, i.length = 0, o || n.push(K(e));
618
618
  },
619
- batch(y) {
620
- if (n)
621
- return y();
622
- i === 0 && (a = K(e)), i++;
619
+ batch(p) {
620
+ if (o)
621
+ return p();
622
+ s === 0 && (c = K(e)), s++;
623
623
  try {
624
- const E = y();
625
- return i--, i === 0 && (a = null, d === 0 && !n && l(K(e))), E;
626
- } catch (E) {
627
- if (i--, i === 0) {
628
- const S = a;
629
- a = null, S && !n && b(S);
624
+ const y = p();
625
+ return s--, s === 0 && (c = null, d === 0 && !o && l(K(e))), y;
626
+ } catch (y) {
627
+ if (s--, s === 0) {
628
+ const w = c;
629
+ c = null, w && !o && v(w);
630
630
  }
631
- throw E;
631
+ throw y;
632
632
  }
633
633
  },
634
634
  dispose() {
635
- if (!n) {
636
- n = !0;
637
- for (const y of se)
638
- c.removeEventListener(y, m);
639
- o.length = 0, s.length = 0, a = null;
635
+ if (!o) {
636
+ o = !0;
637
+ for (const p of ae)
638
+ a.removeEventListener(p, g);
639
+ n.length = 0, i.length = 0, c = null;
640
640
  }
641
641
  }
642
642
  };
643
643
  }
644
- function He() {
644
+ function Be() {
645
645
  return {
646
646
  get canUndo() {
647
647
  return !1;
@@ -660,7 +660,113 @@ function He() {
660
660
  }
661
661
  };
662
662
  }
663
- function H(e) {
663
+ const Ke = {
664
+ "controls.label": "Flow controls",
665
+ "controls.zoomIn": "Zoom in",
666
+ "controls.zoomOut": "Zoom out",
667
+ "controls.fitView": "Fit view",
668
+ "controls.toggleInteractive": "Toggle interactivity",
669
+ "controls.lockInteractive": "Lock interactivity",
670
+ "controls.unlockInteractive": "Unlock interactivity",
671
+ "controls.resetPanels": "Reset panels",
672
+ "controls.toggleFullscreen": "Toggle fullscreen",
673
+ "controls.enterFullscreen": "Enter fullscreen",
674
+ "controls.exitFullscreen": "Exit fullscreen",
675
+ "canvas.label": "Flow diagram",
676
+ "canvas.loading": "Loading…",
677
+ "canvas.selectionMode": "Selection Mode — tap with two fingers to exit",
678
+ "a11y.nodeLabel": "Node: :label",
679
+ "a11y.nodeId": "Node :id",
680
+ "a11y.edgeLabel": "Edge: :label",
681
+ "a11y.edgeEndpoints": "Edge from :source to :target",
682
+ "a11y.sourceHandle": "source handle :id",
683
+ "a11y.targetHandle": "target handle :id",
684
+ "a11y.addControlPoint": "Double-click to add control point",
685
+ "announce.nodeAdded": "Added node: :label",
686
+ "announce.nodesAdded_one": "Added :count node",
687
+ "announce.nodesAdded_other": "Added :count nodes",
688
+ "announce.nodeRemoved": "Removed node: :label",
689
+ "announce.nodesRemoved_one": "Removed :count node",
690
+ "announce.nodesRemoved_other": "Removed :count nodes",
691
+ "announce.connected": "Connected :source to :target",
692
+ "announce.connectionsAdded_one": "Added :count connection",
693
+ "announce.connectionsAdded_other": "Added :count connections",
694
+ "announce.disconnected": "Removed connection from :source to :target",
695
+ "announce.connectionsRemoved_one": "Removed :count connection",
696
+ "announce.connectionsRemoved_other": "Removed :count connections",
697
+ "announce.selectionCleared": "Selection cleared",
698
+ "announce.nodesSelected_one": ":count node",
699
+ "announce.nodesSelected_other": ":count nodes",
700
+ "announce.edgesSelected_one": ":count edge",
701
+ "announce.edgesSelected_other": ":count edges",
702
+ "announce.selectionJoin": ":nodes and :edges",
703
+ "announce.selected": ":items selected",
704
+ "announce.viewportZoom": "Viewport: zoom :percent%",
705
+ "announce.viewFitted": "Fitted view to content",
706
+ "announce.node": "node",
707
+ "announce.reparented": "Moved :name into :parent",
708
+ "announce.detached": "Detached :name from :parent",
709
+ "workflow.condition": "Condition",
710
+ "workflow.customEvaluator": "[custom evaluator]",
711
+ "workflow.wait": "Wait",
712
+ "schema.inspector.noNode": "No node selected.",
713
+ "schema.inspector.noEdge": "No edge selected.",
714
+ "schema.inspector.noRow": "No row selected.",
715
+ "schema.inspector.missingRow": "Selected row no longer exists.",
716
+ "schema.inspector.label": "label",
717
+ "schema.inspector.name": "name",
718
+ "schema.inspector.type": "type",
719
+ "schema.inspector.required": "required",
720
+ "schema.inspector.remove": "remove",
721
+ "schema.inspector.delete": "delete",
722
+ "schema.inspector.add": "add",
723
+ "schema.inspector.fieldName": "field name"
724
+ }, Ue = Ke, G = "en", le = /* @__PURE__ */ new Map();
725
+ function Q(e) {
726
+ const r = e.trim().replace(/_/g, "-") || G;
727
+ let n = le.get(r);
728
+ if (!n) {
729
+ try {
730
+ n = new Intl.PluralRules(r);
731
+ } catch {
732
+ n = Q(G);
733
+ }
734
+ le.set(r, n);
735
+ }
736
+ return n;
737
+ }
738
+ function U(e) {
739
+ return typeof e == "string" && e !== "" ? e : void 0;
740
+ }
741
+ function fe(e, t, r, n) {
742
+ return r === void 0 ? U(e[t]) ?? U(e[`${t}_other`]) : U(e[`${t}_${n.select(r)}`]) ?? U(e[`${t}_other`]) ?? U(e[t]);
743
+ }
744
+ const ue = /* @__PURE__ */ new Map();
745
+ function Je(e, t) {
746
+ const r = Object.keys(t).sort((d, s) => s.length - d.length);
747
+ if (r.length === 0) return e;
748
+ const n = r.join("\0");
749
+ let i = ue.get(n);
750
+ return i || (i = new RegExp(`:(${r.map((d) => d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`, "g"), ue.set(n, i)), e.replace(i, (d, s) => String(t[s]));
751
+ }
752
+ function je(e, t) {
753
+ const r = {};
754
+ for (const [d, s] of Object.entries({})) {
755
+ const c = U(s);
756
+ c !== void 0 && (r[d] = c);
757
+ }
758
+ const n = Q(t), i = Q(G);
759
+ return (d, s = {}) => {
760
+ const c = typeof s.count == "number" ? s.count : void 0, o = fe(r, d, c, n) ?? fe(Ue, d, c, i) ?? d;
761
+ return Je(o, s);
762
+ };
763
+ }
764
+ const ze = je(void 0, G);
765
+ function ee(e) {
766
+ const t = e;
767
+ return typeof t?.t != "function" ? ze : (r, n) => t.t(r, n);
768
+ }
769
+ function k(e) {
664
770
  if (!e || e.size === 0)
665
771
  return null;
666
772
  let t = null;
@@ -668,43 +774,43 @@ function H(e) {
668
774
  t = r;
669
775
  return t;
670
776
  }
671
- function $e(e) {
777
+ function We(e) {
672
778
  if (!e)
673
779
  return null;
674
780
  const t = e.indexOf(".");
675
781
  return t < 1 || t === e.length - 1 ? null : { nodeId: e.slice(0, t), fieldName: e.slice(t + 1) };
676
782
  }
677
- function X(e, t) {
783
+ function te(e, t) {
678
784
  const r = t.closest(".flow-container");
679
785
  if (r)
680
786
  try {
681
787
  return e.$data(r) ?? null;
682
788
  } catch {
683
789
  }
684
- const o = document.querySelectorAll(".flow-container");
685
- if (o.length === 1)
790
+ const n = document.querySelectorAll(".flow-container");
791
+ if (n.length === 1)
686
792
  try {
687
- return e.$data(o[0]) ?? null;
793
+ return e.$data(n[0]) ?? null;
688
794
  } catch {
689
795
  }
690
- return o.length > 1 && !window.__alpineflowSchemaMultiCanvasWarned && (window.__alpineflowSchemaMultiCanvasWarned = !0, console.warn(
796
+ return n.length > 1 && !window.__alpineflowSchemaMultiCanvasWarned && (window.__alpineflowSchemaMultiCanvasWarned = !0, console.warn(
691
797
  "[alpineflow/schema] inspector directive found multiple .flow-container elements on the page; place inspector inside the canvas OR scope the directive expression to a specific canvas (multi-canvas scope selector is on the v0.2.2 roadmap)."
692
798
  )), null;
693
799
  }
694
- function Q(e) {
800
+ function ne(e) {
695
801
  return e.querySelector(
696
802
  ":scope > template[x-schema-default-ui]"
697
803
  );
698
804
  }
699
- function U(e) {
805
+ function J(e) {
700
806
  const t = e.querySelector(":scope > [data-schema-default-ui-root]");
701
807
  t && t.remove();
702
808
  }
703
- function Z(e) {
809
+ function oe(e) {
704
810
  const t = document.createElement("div");
705
811
  return t.setAttribute("data-schema-default-ui-root", ""), e.appendChild(t), t;
706
812
  }
707
- function ee(e) {
813
+ function re(e) {
708
814
  if (!e)
709
815
  return null;
710
816
  const t = document.activeElement;
@@ -713,27 +819,27 @@ function ee(e) {
713
819
  const r = t.getAttribute("data-field");
714
820
  if (!r)
715
821
  return null;
716
- let o = null, s = null;
822
+ let n = null, i = null;
717
823
  if (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement)
718
824
  try {
719
- o = t.selectionStart, s = t.selectionEnd;
825
+ n = t.selectionStart, i = t.selectionEnd;
720
826
  } catch {
721
827
  }
722
828
  return {
723
829
  field: r,
724
830
  tagName: t.tagName.toLowerCase(),
725
- selectionStart: o,
726
- selectionEnd: s
831
+ selectionStart: n,
832
+ selectionEnd: i
727
833
  };
728
834
  }
729
- function Me(e) {
835
+ function Ye(e) {
730
836
  return typeof globalThis.CSS < "u" && typeof globalThis.CSS.escape == "function" ? globalThis.CSS.escape(e) : e.replace(/["\\]/g, "\\$&");
731
837
  }
732
838
  function O(e, t) {
733
839
  if (!e || !t)
734
840
  return;
735
841
  const r = e.querySelector(
736
- `[data-field="${Me(t.field)}"]`
842
+ `[data-field="${Ye(t.field)}"]`
737
843
  );
738
844
  if (r && r.tagName.toLowerCase() === t.tagName)
739
845
  try {
@@ -741,140 +847,140 @@ function O(e, t) {
741
847
  } catch {
742
848
  }
743
849
  }
744
- function _e(e) {
850
+ function Ge(e) {
745
851
  e.directive(
746
852
  "schema-node-inspector",
747
- (t, r, { effect: o, cleanup: s }) => {
748
- const d = t, i = X(e, d);
749
- if (!i)
853
+ (t, r, { effect: n, cleanup: i }) => {
854
+ const d = t, s = te(e, d);
855
+ if (!s)
750
856
  return;
751
- const a = Q(d), n = {
857
+ const c = ne(d), o = {
752
858
  addField(u) {
753
- const l = H(i.selectedNodes);
754
- return l ? i.addField?.(l, u) ?? { applied: !1, reason: "no-helper" } : { applied: !1, reason: "no-selection" };
859
+ const l = k(s.selectedNodes);
860
+ return l ? s.addField?.(l, u) ?? { applied: !1, reason: "no-helper" } : { applied: !1, reason: "no-selection" };
755
861
  },
756
862
  renameField(u, l) {
757
- const p = H(i.selectedNodes);
758
- return p ? i.renameField?.(p, u, l) ?? {
863
+ const m = k(s.selectedNodes);
864
+ return m ? s.renameField?.(m, u, l) ?? {
759
865
  applied: !1,
760
866
  reason: "no-helper",
761
867
  cascadedEdgeIds: []
762
868
  } : { applied: !1, reason: "no-selection", cascadedEdgeIds: [] };
763
869
  },
764
870
  removeField(u) {
765
- const l = H(i.selectedNodes);
766
- return l ? i.removeField?.(l, u) ?? {
871
+ const l = k(s.selectedNodes);
872
+ return l ? s.removeField?.(l, u) ?? {
767
873
  applied: !1,
768
874
  reason: "no-helper",
769
875
  droppedEdgeIds: []
770
876
  } : { applied: !1, reason: "no-selection", droppedEdgeIds: [] };
771
877
  },
772
878
  reorderFields(u) {
773
- const l = H(i.selectedNodes);
774
- return l ? i.reorderFields?.(l, u) ?? {
879
+ const l = k(s.selectedNodes);
880
+ return l ? s.reorderFields?.(l, u) ?? {
775
881
  applied: !1,
776
882
  reason: "no-helper"
777
883
  } : { applied: !1, reason: "no-selection" };
778
884
  }
779
- }, c = e.addScopeToNode(d, {
780
- inspector: n,
885
+ }, a = e.addScopeToNode(d, {
886
+ inspector: o,
781
887
  get selectedNode() {
782
- const u = H(i.selectedNodes);
783
- return u ? i.nodes?.find((l) => l.id === u) ?? null : null;
888
+ const u = k(s.selectedNodes);
889
+ return u ? s.nodes?.find((l) => l.id === u) ?? null : null;
784
890
  }
785
891
  });
786
- a && o(() => {
787
- Oe(d, i);
788
- }), s(() => {
789
- U(d), c?.();
892
+ c && n(() => {
893
+ Ve(d, s);
894
+ }), i(() => {
895
+ J(d), a?.();
790
896
  });
791
897
  }
792
898
  );
793
899
  }
794
- function Oe(e, t) {
795
- const r = e.querySelector(
900
+ function Ve(e, t) {
901
+ const r = ee(t), n = e.querySelector(
796
902
  ":scope > [data-schema-default-ui-root]"
797
- ), o = ee(r);
798
- U(e);
799
- const s = Z(e), d = H(t.selectedNodes), i = d ? t.nodes?.find((g) => g.id === d) : null;
800
- if (!i) {
801
- const g = document.createElement("div");
802
- g.setAttribute("data-schema-inspector-empty", ""), g.textContent = "No node selected.", s.appendChild(g), O(s, o);
903
+ ), i = re(n);
904
+ J(e);
905
+ const d = oe(e), s = k(t.selectedNodes), c = s ? t.nodes?.find((p) => p.id === s) : null;
906
+ if (!c) {
907
+ const p = document.createElement("div");
908
+ p.setAttribute("data-schema-inspector-empty", ""), p.textContent = r("schema.inspector.noNode"), d.appendChild(p), O(d, i);
803
909
  return;
804
910
  }
805
- const a = document.createElement("header");
806
- a.setAttribute("data-schema-inspector-label", ""), a.textContent = String(i.data?.label ?? i.id), s.appendChild(a);
807
- const n = document.createElement("ul");
808
- n.setAttribute("data-schema-inspector-fields", "");
809
- const c = Array.isArray(i.data?.fields) ? i.data.fields : [];
810
- for (const g of c) {
911
+ const o = document.createElement("header");
912
+ o.setAttribute("data-schema-inspector-label", ""), o.textContent = String(c.data?.label ?? c.id), d.appendChild(o);
913
+ const a = document.createElement("ul");
914
+ a.setAttribute("data-schema-inspector-fields", "");
915
+ const u = Array.isArray(c.data?.fields) ? c.data.fields : [];
916
+ for (const p of u) {
811
917
  const y = document.createElement("li");
812
- y.setAttribute("data-schema-inspector-field", ""), y.dataset.fieldName = String(g?.name ?? "");
813
- const E = document.createElement("span");
814
- if (E.textContent = String(g?.name ?? ""), y.appendChild(E), g?.type) {
815
- const v = document.createElement("span");
816
- v.setAttribute("data-field-type", ""), v.textContent = String(g.type), y.appendChild(v);
918
+ y.setAttribute("data-schema-inspector-field", ""), y.dataset.fieldName = String(p?.name ?? "");
919
+ const w = document.createElement("span");
920
+ if (w.textContent = String(p?.name ?? ""), y.appendChild(w), p?.type) {
921
+ const A = document.createElement("span");
922
+ A.setAttribute("data-field-type", ""), A.textContent = String(p.type), y.appendChild(A);
817
923
  }
818
- const S = document.createElement("button");
819
- S.type = "button", S.setAttribute("data-action", "remove"), S.textContent = "remove", S.addEventListener("click", () => {
820
- t.removeField?.(i.id, g.name);
821
- }), y.appendChild(S), n.appendChild(y);
924
+ const E = document.createElement("button");
925
+ E.type = "button", E.setAttribute("data-action", "remove"), E.textContent = r("schema.inspector.remove"), E.addEventListener("click", () => {
926
+ t.removeField?.(c.id, p.name);
927
+ }), y.appendChild(E), a.appendChild(y);
822
928
  }
823
- s.appendChild(n);
824
- const u = document.createElement("form");
825
- u.setAttribute("data-schema-inspector-add-field", "");
826
- const l = document.createElement("input");
827
- l.setAttribute("data-field", "name"), l.placeholder = "field name", u.appendChild(l);
828
- const p = Array.isArray(t._config?.fieldTypeRegistry) ? t._config.fieldTypeRegistry : null;
829
- let m;
830
- if (p && p.length > 0) {
831
- const g = document.createElement("select");
832
- g.setAttribute("data-field", "type");
833
- for (const y of p) {
834
- const E = document.createElement("option");
835
- E.value = y, E.textContent = y, g.appendChild(E);
929
+ d.appendChild(a);
930
+ const l = document.createElement("form");
931
+ l.setAttribute("data-schema-inspector-add-field", "");
932
+ const m = document.createElement("input");
933
+ m.setAttribute("data-field", "name"), m.placeholder = r("schema.inspector.fieldName"), l.appendChild(m);
934
+ const g = Array.isArray(t._config?.fieldTypeRegistry) ? t._config.fieldTypeRegistry : null;
935
+ let v;
936
+ if (g && g.length > 0) {
937
+ const p = document.createElement("select");
938
+ p.setAttribute("data-field", "type");
939
+ for (const y of g) {
940
+ const w = document.createElement("option");
941
+ w.value = y, w.textContent = y, p.appendChild(w);
836
942
  }
837
- g.value = p[0], m = g;
943
+ p.value = g[0], v = p;
838
944
  } else {
839
- const g = document.createElement("input");
840
- g.setAttribute("data-field", "type"), g.placeholder = "type", g.value = "text", m = g;
945
+ const p = document.createElement("input");
946
+ p.setAttribute("data-field", "type"), p.placeholder = r("schema.inspector.type"), p.value = "text", v = p;
841
947
  }
842
- u.appendChild(m);
948
+ l.appendChild(v);
843
949
  const b = document.createElement("button");
844
- b.type = "submit", b.textContent = "add", u.appendChild(b), u.addEventListener("submit", (g) => {
845
- g.preventDefault();
846
- const y = l.value.trim();
950
+ b.type = "submit", b.textContent = r("schema.inspector.add"), l.appendChild(b), l.addEventListener("submit", (p) => {
951
+ p.preventDefault();
952
+ const y = m.value.trim();
847
953
  if (!y)
848
954
  return;
849
- const E = m.value, S = (typeof E == "string" ? E.trim() : "") || "text";
850
- t.addField?.(i.id, { name: y, type: S })?.applied && (l.value = "");
851
- }), s.appendChild(u), O(s, o);
955
+ const w = v.value, E = (typeof w == "string" ? w.trim() : "") || "text";
956
+ t.addField?.(c.id, { name: y, type: E })?.applied && (m.value = "");
957
+ }), d.appendChild(l), O(d, i);
852
958
  }
853
- function qe(e) {
959
+ function Ze(e) {
854
960
  e.directive(
855
961
  "schema-row-inspector",
856
- (t, r, { effect: o, cleanup: s }) => {
857
- const d = t, i = X(e, d);
858
- if (!i)
962
+ (t, r, { effect: n, cleanup: i }) => {
963
+ const d = t, s = te(e, d);
964
+ if (!s)
859
965
  return;
860
- const a = Q(d), n = () => $e(H(i.selectedRows)), c = () => {
861
- const p = n();
862
- if (!p)
966
+ const c = ne(d), o = () => We(k(s.selectedRows)), a = () => {
967
+ const m = o();
968
+ if (!m)
863
969
  return null;
864
- const m = i.nodes?.find((g) => g.id === p.nodeId);
865
- return m ? (m.data?.fields ?? []).find((g) => g?.name === p.fieldName) ?? null : null;
970
+ const g = s.nodes?.find((b) => b.id === m.nodeId);
971
+ return g ? (g.data?.fields ?? []).find((b) => b?.name === m.fieldName) ?? null : null;
866
972
  }, u = {
867
- renameField(p) {
868
- const m = n();
869
- return m ? i.renameField?.(m.nodeId, m.fieldName, p) ?? {
973
+ renameField(m) {
974
+ const g = o();
975
+ return g ? s.renameField?.(g.nodeId, g.fieldName, m) ?? {
870
976
  applied: !1,
871
977
  reason: "no-helper",
872
978
  cascadedEdgeIds: []
873
979
  } : { applied: !1, reason: "no-selection", cascadedEdgeIds: [] };
874
980
  },
875
981
  removeField() {
876
- const p = n();
877
- return p ? i.removeField?.(p.nodeId, p.fieldName) ?? {
982
+ const m = o();
983
+ return m ? s.removeField?.(m.nodeId, m.fieldName) ?? {
878
984
  applied: !1,
879
985
  reason: "no-helper",
880
986
  droppedEdgeIds: []
@@ -885,209 +991,209 @@ function qe(e) {
885
991
  * field in place. For name changes, use `renameField` so edges
886
992
  * cascade correctly.
887
993
  */
888
- updateField(p) {
889
- const m = c();
890
- if (!m)
994
+ updateField(m) {
995
+ const g = a();
996
+ if (!g)
891
997
  return { applied: !1, reason: "no-selection" };
892
- for (const [b, g] of Object.entries(p))
893
- b !== "name" && (m[b] = g);
998
+ for (const [v, b] of Object.entries(m))
999
+ v !== "name" && (g[v] = b);
894
1000
  return { applied: !0 };
895
1001
  }
896
1002
  }, l = e.addScopeToNode(d, {
897
1003
  inspector: u,
898
1004
  get selectedRow() {
899
- return n();
1005
+ return o();
900
1006
  }
901
1007
  });
902
- a && o(() => {
903
- Pe(d, i, n());
904
- }), s(() => {
905
- U(d), l?.();
1008
+ c && n(() => {
1009
+ Xe(d, s, o());
1010
+ }), i(() => {
1011
+ J(d), l?.();
906
1012
  });
907
1013
  }
908
1014
  );
909
1015
  }
910
- function Pe(e, t, r) {
911
- const o = e.querySelector(
1016
+ function Xe(e, t, r) {
1017
+ const n = ee(t), i = e.querySelector(
912
1018
  ":scope > [data-schema-default-ui-root]"
913
- ), s = ee(o);
914
- U(e);
915
- const d = Z(e);
1019
+ ), d = re(i);
1020
+ J(e);
1021
+ const s = oe(e);
916
1022
  if (!r) {
917
- const g = document.createElement("div");
918
- g.setAttribute("data-schema-inspector-empty", ""), g.textContent = "No row selected.", d.appendChild(g), O(d, s);
1023
+ const p = document.createElement("div");
1024
+ p.setAttribute("data-schema-inspector-empty", ""), p.textContent = n("schema.inspector.noRow"), s.appendChild(p), O(s, d);
919
1025
  return;
920
1026
  }
921
- const a = t.nodes?.find((g) => g.id === r.nodeId)?.data?.fields?.find((g) => g?.name === r.fieldName) ?? null;
922
- if (!a) {
923
- const g = document.createElement("div");
924
- g.setAttribute("data-schema-inspector-empty", ""), g.textContent = "Selected row no longer exists.", d.appendChild(g), O(d, s);
1027
+ const o = t.nodes?.find((p) => p.id === r.nodeId)?.data?.fields?.find((p) => p?.name === r.fieldName) ?? null;
1028
+ if (!o) {
1029
+ const p = document.createElement("div");
1030
+ p.setAttribute("data-schema-inspector-empty", ""), p.textContent = n("schema.inspector.missingRow"), s.appendChild(p), O(s, d);
925
1031
  return;
926
1032
  }
927
- const n = document.createElement("label");
928
- n.textContent = "name ";
929
- const c = document.createElement("input");
930
- c.setAttribute("data-field", "name"), c.value = String(a.name ?? ""), c.addEventListener("change", () => {
931
- const g = c.value.trim();
932
- !g || g === a.name || t.renameField?.(r.nodeId, r.fieldName, g);
933
- }), n.appendChild(c), d.appendChild(n);
934
- const u = document.createElement("label");
935
- u.textContent = "type ";
936
- const l = document.createElement("input");
937
- l.setAttribute("data-field", "type"), l.value = String(a.type ?? ""), l.addEventListener("change", () => {
938
- a.type = l.value;
939
- }), u.appendChild(l), d.appendChild(u);
940
- const p = document.createElement("label");
941
- p.textContent = "required ";
1033
+ const a = document.createElement("label");
1034
+ a.textContent = n("schema.inspector.name") + " ";
1035
+ const u = document.createElement("input");
1036
+ u.setAttribute("data-field", "name"), u.value = String(o.name ?? ""), u.addEventListener("change", () => {
1037
+ const p = u.value.trim();
1038
+ !p || p === o.name || t.renameField?.(r.nodeId, r.fieldName, p);
1039
+ }), a.appendChild(u), s.appendChild(a);
1040
+ const l = document.createElement("label");
1041
+ l.textContent = n("schema.inspector.type") + " ";
942
1042
  const m = document.createElement("input");
943
- m.type = "checkbox", m.setAttribute("data-field", "required"), m.checked = !!a.required, m.addEventListener("change", () => {
944
- a.required = m.checked;
945
- }), p.appendChild(m), d.appendChild(p);
1043
+ m.setAttribute("data-field", "type"), m.value = String(o.type ?? ""), m.addEventListener("change", () => {
1044
+ o.type = m.value;
1045
+ }), l.appendChild(m), s.appendChild(l);
1046
+ const g = document.createElement("label");
1047
+ g.textContent = n("schema.inspector.required") + " ";
1048
+ const v = document.createElement("input");
1049
+ v.type = "checkbox", v.setAttribute("data-field", "required"), v.checked = !!o.required, v.addEventListener("change", () => {
1050
+ o.required = v.checked;
1051
+ }), g.appendChild(v), s.appendChild(g);
946
1052
  const b = document.createElement("button");
947
- b.type = "button", b.setAttribute("data-action", "remove"), b.textContent = "remove", b.addEventListener("click", () => {
1053
+ b.type = "button", b.setAttribute("data-action", "remove"), b.textContent = n("schema.inspector.remove"), b.addEventListener("click", () => {
948
1054
  t.removeField?.(r.nodeId, r.fieldName);
949
- }), d.appendChild(b), O(d, s);
1055
+ }), s.appendChild(b), O(s, d);
950
1056
  }
951
- function Be(e) {
1057
+ function Qe(e) {
952
1058
  e.directive(
953
1059
  "schema-edge-inspector",
954
- (t, r, { effect: o, cleanup: s }) => {
955
- const d = t, i = X(e, d);
956
- if (!i)
1060
+ (t, r, { effect: n, cleanup: i }) => {
1061
+ const d = t, s = te(e, d);
1062
+ if (!s)
957
1063
  return;
958
- const a = Q(d), n = () => {
959
- const l = H(i.selectedEdges);
960
- return l ? i.edges?.find((p) => p.id === l) ?? null : null;
961
- }, c = {
1064
+ const c = ne(d), o = () => {
1065
+ const l = k(s.selectedEdges);
1066
+ return l ? s.edges?.find((m) => m.id === l) ?? null : null;
1067
+ }, a = {
962
1068
  updateEdge(l) {
963
- const p = n();
964
- if (!p)
1069
+ const m = o();
1070
+ if (!m)
965
1071
  return { applied: !1, reason: "no-selection" };
966
- for (const [m, b] of Object.entries(l))
967
- p[m] = b;
1072
+ for (const [g, v] of Object.entries(l))
1073
+ m[g] = v;
968
1074
  return { applied: !0 };
969
1075
  },
970
1076
  setLabel(l) {
971
1077
  return this.updateEdge({ label: l });
972
1078
  },
973
1079
  removeEdge() {
974
- const l = n();
1080
+ const l = o();
975
1081
  if (!l)
976
1082
  return { applied: !1, reason: "no-selection" };
977
- if (typeof i.removeEdges == "function")
978
- return i.removeEdges([l.id]), { applied: !0 };
979
- const p = i.edges?.findIndex((m) => m.id === l.id) ?? -1;
980
- return p === -1 ? { applied: !1, reason: "no-helper" } : (i.edges.splice(p, 1), { applied: !0 });
1083
+ if (typeof s.removeEdges == "function")
1084
+ return s.removeEdges([l.id]), { applied: !0 };
1085
+ const m = s.edges?.findIndex((g) => g.id === l.id) ?? -1;
1086
+ return m === -1 ? { applied: !1, reason: "no-helper" } : (s.edges.splice(m, 1), { applied: !0 });
981
1087
  }
982
1088
  }, u = e.addScopeToNode(d, {
983
- inspector: c,
1089
+ inspector: a,
984
1090
  get selectedEdge() {
985
- return n();
1091
+ return o();
986
1092
  }
987
1093
  });
988
- a && o(() => {
989
- Ke(d, i, n());
990
- }), s(() => {
991
- U(d), u?.();
1094
+ c && n(() => {
1095
+ et(d, s, o());
1096
+ }), i(() => {
1097
+ J(d), u?.();
992
1098
  });
993
1099
  }
994
1100
  );
995
1101
  }
996
- function Ke(e, t, r) {
997
- const o = e.querySelector(
1102
+ function et(e, t, r) {
1103
+ const n = ee(t), i = e.querySelector(
998
1104
  ":scope > [data-schema-default-ui-root]"
999
- ), s = ee(o);
1000
- U(e);
1001
- const d = Z(e);
1105
+ ), d = re(i);
1106
+ J(e);
1107
+ const s = oe(e);
1002
1108
  if (!r) {
1003
- const c = document.createElement("div");
1004
- c.setAttribute("data-schema-inspector-empty", ""), c.textContent = "No edge selected.", d.appendChild(c), O(d, s);
1109
+ const u = document.createElement("div");
1110
+ u.setAttribute("data-schema-inspector-empty", ""), u.textContent = n("schema.inspector.noEdge"), s.appendChild(u), O(s, d);
1005
1111
  return;
1006
1112
  }
1007
- const i = document.createElement("label");
1008
- i.textContent = "label ";
1009
- const a = document.createElement("input");
1010
- a.setAttribute("data-field", "label"), a.value = String(r.label ?? ""), a.addEventListener("input", () => {
1011
- r.label = a.value;
1012
- }), i.appendChild(a), d.appendChild(i);
1013
- const n = document.createElement("button");
1014
- n.type = "button", n.setAttribute("data-action", "delete"), n.textContent = "delete", n.addEventListener("click", () => {
1113
+ const c = document.createElement("label");
1114
+ c.textContent = n("schema.inspector.label") + " ";
1115
+ const o = document.createElement("input");
1116
+ o.setAttribute("data-field", "label"), o.value = String(r.label ?? ""), o.addEventListener("input", () => {
1117
+ r.label = o.value;
1118
+ }), c.appendChild(o), s.appendChild(c);
1119
+ const a = document.createElement("button");
1120
+ a.type = "button", a.setAttribute("data-action", "delete"), a.textContent = n("schema.inspector.delete"), a.addEventListener("click", () => {
1015
1121
  if (typeof t.removeEdges == "function")
1016
1122
  t.removeEdges([r.id]);
1017
1123
  else {
1018
- const c = t.edges?.findIndex((u) => u.id === r.id) ?? -1;
1019
- c !== -1 && t.edges.splice(c, 1);
1124
+ const u = t.edges?.findIndex((l) => l.id === r.id) ?? -1;
1125
+ u !== -1 && t.edges.splice(u, 1);
1020
1126
  }
1021
- }), d.appendChild(n), O(d, s);
1127
+ }), s.appendChild(a), O(s, d);
1022
1128
  }
1023
- const Ue = 4;
1024
- function Je(e) {
1129
+ const tt = 4;
1130
+ function nt(e) {
1025
1131
  e.directive(
1026
1132
  "schema-reorderable",
1027
- (t, r, { cleanup: o }) => {
1028
- const s = t;
1029
- s.classList.add("flow-schema-reorderable"), s.style.touchAction = "none";
1030
- let d = !1, i = !1, a = 0, n = 0, c = 0, u = null;
1133
+ (t, r, { cleanup: n }) => {
1134
+ const i = t;
1135
+ i.classList.add("flow-schema-reorderable"), i.style.touchAction = "none";
1136
+ let d = !1, s = !1, c = 0, o = 0, a = 0, u = null;
1031
1137
  const l = () => {
1032
- const v = s.parentElement;
1033
- return v ? Array.from(
1034
- v.querySelectorAll(":scope > .flow-schema-row")
1138
+ const E = i.parentElement;
1139
+ return E ? Array.from(
1140
+ E.querySelectorAll(":scope > .flow-schema-row")
1035
1141
  ) : [];
1036
- }, p = () => {
1037
- for (const v of l())
1038
- v.classList.remove("flow-schema-row-drop-target");
1039
- }, m = (v) => {
1040
- const A = s.parentElement;
1041
- if (!A) return n;
1042
- const x = Array.from(
1142
+ }, m = () => {
1143
+ for (const E of l())
1144
+ E.classList.remove("flow-schema-row-drop-target");
1145
+ }, g = (E) => {
1146
+ const A = i.parentElement;
1147
+ if (!A) return o;
1148
+ const F = Array.from(
1043
1149
  A.querySelectorAll(":scope > .flow-schema-row")
1044
- ).filter((R) => R !== s);
1045
- if (x.length === 0) return n;
1150
+ ).filter((T) => T !== i);
1151
+ if (F.length === 0) return o;
1046
1152
  let N = 0;
1047
- for (const R of x) {
1048
- const $ = R.getBoundingClientRect();
1049
- $.top + $.height / 2 < v && N++;
1153
+ for (const T of F) {
1154
+ const $ = T.getBoundingClientRect();
1155
+ $.top + $.height / 2 < E && N++;
1050
1156
  }
1051
1157
  return N;
1052
- }, b = (v) => {
1053
- p();
1158
+ }, v = (E) => {
1159
+ m();
1054
1160
  const A = l();
1055
- let x = v;
1056
- v >= n && (x = v + 1);
1057
- const N = A[x] ?? A[v];
1058
- N && N !== s && N.classList.add("flow-schema-row-drop-target");
1059
- }, g = () => {
1060
- s.style.transform = "", s.classList.remove("flow-schema-row-dragging"), p();
1061
- }, y = (v) => {
1062
- if (d || v.button !== void 0 && v.button !== 0) return;
1063
- d = !0, i = !1, a = v.clientY, u = v.pointerId ?? null, n = l().indexOf(s), c = n, s.classList.add("flow-schema-row-dragging");
1161
+ let F = E;
1162
+ E >= o && (F = E + 1);
1163
+ const N = A[F] ?? A[E];
1164
+ N && N !== i && N.classList.add("flow-schema-row-drop-target");
1165
+ }, b = () => {
1166
+ i.style.transform = "", i.classList.remove("flow-schema-row-dragging"), m();
1167
+ }, p = (E) => {
1168
+ if (d || E.button !== void 0 && E.button !== 0) return;
1169
+ d = !0, s = !1, c = E.clientY, u = E.pointerId ?? null, o = l().indexOf(i), a = o, i.classList.add("flow-schema-row-dragging");
1064
1170
  try {
1065
- u !== null && typeof s.setPointerCapture == "function" && s.setPointerCapture(u);
1171
+ u !== null && typeof i.setPointerCapture == "function" && i.setPointerCapture(u);
1066
1172
  } catch {
1067
1173
  }
1068
- document.addEventListener("pointermove", E), document.addEventListener("pointerup", S), document.addEventListener("pointercancel", S);
1069
- }, E = (v) => {
1174
+ document.addEventListener("pointermove", y), document.addEventListener("pointerup", w), document.addEventListener("pointercancel", w);
1175
+ }, y = (E) => {
1070
1176
  if (!d) return;
1071
- const A = v.clientY - a;
1072
- !i && Math.abs(A) > Ue && (i = !0), s.style.transform = `translateY(${A}px)`, i && (c = m(v.clientY), b(c));
1073
- }, S = (v) => {
1177
+ const A = E.clientY - c;
1178
+ !s && Math.abs(A) > tt && (s = !0), i.style.transform = `translateY(${A}px)`, s && (a = g(E.clientY), v(a));
1179
+ }, w = (E) => {
1074
1180
  if (!d) return;
1075
- const A = i, x = c, N = n;
1181
+ const A = s, F = a, N = o;
1076
1182
  try {
1077
- u !== null && typeof s.releasePointerCapture == "function" && typeof s.hasPointerCapture == "function" && s.hasPointerCapture(u) && s.releasePointerCapture(u);
1183
+ u !== null && typeof i.releasePointerCapture == "function" && typeof i.hasPointerCapture == "function" && i.hasPointerCapture(u) && i.releasePointerCapture(u);
1078
1184
  } catch {
1079
1185
  }
1080
- if (document.removeEventListener("pointermove", E), document.removeEventListener("pointerup", S), document.removeEventListener("pointercancel", S), d = !1, u = null, g(), !A)
1186
+ if (document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", w), document.removeEventListener("pointercancel", w), d = !1, u = null, b(), !A)
1081
1187
  return;
1082
- const R = (C) => {
1188
+ const T = (C) => {
1083
1189
  C.stopImmediatePropagation(), C.stopPropagation(), C.preventDefault();
1084
1190
  };
1085
- s.addEventListener("click", R, { capture: !0, once: !0 }), setTimeout(() => {
1086
- s.removeEventListener("click", R, { capture: !0 });
1191
+ i.addEventListener("click", T, { capture: !0, once: !0 }), setTimeout(() => {
1192
+ i.removeEventListener("click", T, { capture: !0 });
1087
1193
  }, 0);
1088
- const k = s.closest("[data-flow-node-id]")?.getAttribute("data-flow-node-id") ?? null;
1089
- if (!k) return;
1090
- const q = s.closest(".flow-container");
1194
+ const D = i.closest("[data-flow-node-id]")?.getAttribute("data-flow-node-id") ?? null;
1195
+ if (!D) return;
1196
+ const q = i.closest(".flow-container");
1091
1197
  if (!q) return;
1092
1198
  let L;
1093
1199
  try {
@@ -1096,143 +1202,143 @@ function Je(e) {
1096
1202
  return;
1097
1203
  }
1098
1204
  if (!L || typeof L.reorderFields != "function") return;
1099
- const h = (L.nodes ?? []).find((C) => C?.id === k)?.data?.fields ?? [];
1205
+ const h = (L.nodes ?? []).find((C) => C?.id === D)?.data?.fields ?? [];
1100
1206
  if (!Array.isArray(h) || h.length < 2) return;
1101
1207
  const I = h.map((C) => C.name);
1102
1208
  if (N < 0 || N >= I.length) return;
1103
- const [T] = I.splice(N, 1), D = Math.max(0, Math.min(x, I.length));
1104
- I.splice(D, 0, T), !I.every(
1209
+ const [x] = I.splice(N, 1), _ = Math.max(0, Math.min(F, I.length));
1210
+ I.splice(_, 0, x), !I.every(
1105
1211
  (C, P) => h[P]?.name === C
1106
- ) && L.reorderFields(k, I);
1212
+ ) && L.reorderFields(D, I);
1107
1213
  };
1108
- s.addEventListener("pointerdown", y), o(() => {
1214
+ i.addEventListener("pointerdown", p), n(() => {
1109
1215
  try {
1110
- s.removeEventListener("pointerdown", y), typeof document < "u" && (document.removeEventListener("pointermove", E), document.removeEventListener("pointerup", S), document.removeEventListener("pointercancel", S)), s.classList.remove("flow-schema-reorderable"), s.classList.remove("flow-schema-row-dragging"), p(), s.style.transform = "", s.style.touchAction = "";
1216
+ i.removeEventListener("pointerdown", p), typeof document < "u" && (document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", w), document.removeEventListener("pointercancel", w)), i.classList.remove("flow-schema-reorderable"), i.classList.remove("flow-schema-row-dragging"), m(), i.style.transform = "", i.style.touchAction = "";
1111
1217
  } catch {
1112
1218
  }
1113
1219
  });
1114
1220
  }
1115
1221
  );
1116
1222
  }
1117
- function Ye(e) {
1223
+ function ot(e) {
1118
1224
  const t = e.parentElement;
1119
1225
  return t ? Array.from(
1120
1226
  t.querySelectorAll(":scope > .flow-schema-row")
1121
1227
  ) : [];
1122
1228
  }
1123
- function Ge(e, t) {
1124
- const r = Ye(e), o = r.indexOf(e);
1125
- if (o === -1) return;
1126
- const s = r[o + t];
1127
- s && s.focus();
1229
+ function rt(e, t) {
1230
+ const r = ot(e), n = r.indexOf(e);
1231
+ if (n === -1) return;
1232
+ const i = r[n + t];
1233
+ i && i.focus();
1128
1234
  }
1129
- function We(e, t) {
1235
+ function st(e, t) {
1130
1236
  const r = e.closest("[data-flow-node-id]");
1131
1237
  if (!r) return !1;
1132
- const o = e.closest(".flow-container");
1133
- if (!o) return !1;
1134
- const s = Array.from(
1135
- o.querySelectorAll("[data-flow-node-id]")
1136
- ), d = s.indexOf(r);
1238
+ const n = e.closest(".flow-container");
1239
+ if (!n) return !1;
1240
+ const i = Array.from(
1241
+ n.querySelectorAll("[data-flow-node-id]")
1242
+ ), d = i.indexOf(r);
1137
1243
  if (d === -1) return !1;
1138
- const i = s[d + t];
1139
- if (!i) return !1;
1140
- const a = t === 1 ? i.querySelector(".flow-schema-row") : (() => {
1141
- const n = i.querySelectorAll(".flow-schema-row");
1142
- return n.length > 0 ? n[n.length - 1] : null;
1244
+ const s = i[d + t];
1245
+ if (!s) return !1;
1246
+ const c = t === 1 ? s.querySelector(".flow-schema-row") : (() => {
1247
+ const o = s.querySelectorAll(".flow-schema-row");
1248
+ return o.length > 0 ? o[o.length - 1] : null;
1143
1249
  })();
1144
- return a ? (a.focus(), !0) : !1;
1250
+ return c ? (c.focus(), !0) : !1;
1145
1251
  }
1146
- function je(e) {
1252
+ function it(e) {
1147
1253
  e.click();
1148
1254
  }
1149
- function ze(e) {
1255
+ function dt(e) {
1150
1256
  e.directive(
1151
1257
  "schema-keyboard-nav",
1152
- (t, r, { effect: o, cleanup: s }) => {
1258
+ (t, r, { effect: n, cleanup: i }) => {
1153
1259
  const d = t;
1154
- d.setAttribute("tabindex", "0"), d.setAttribute("role", "row"), o(() => {
1155
- const a = d.dataset.flowSchemaField ?? "", c = d.querySelector(".flow-schema-row-type")?.textContent ?? "";
1260
+ d.setAttribute("tabindex", "0"), d.setAttribute("role", "row"), n(() => {
1261
+ const c = d.dataset.flowSchemaField ?? "", a = d.querySelector(".flow-schema-row-type")?.textContent ?? "";
1156
1262
  d.setAttribute(
1157
1263
  "aria-label",
1158
- `${a}${c ? " (" + c + ")" : ""}`
1264
+ `${c}${a ? " (" + a + ")" : ""}`
1159
1265
  );
1160
1266
  });
1161
- const i = (a) => {
1162
- const n = a.key;
1163
- if (n === "ArrowDown" || n === "ArrowUp") {
1164
- a.preventDefault(), a.stopPropagation(), Ge(d, n === "ArrowDown" ? 1 : -1);
1267
+ const s = (c) => {
1268
+ const o = c.key;
1269
+ if (o === "ArrowDown" || o === "ArrowUp") {
1270
+ c.preventDefault(), c.stopPropagation(), rt(d, o === "ArrowDown" ? 1 : -1);
1165
1271
  return;
1166
1272
  }
1167
- if (n === "Tab") {
1168
- We(d, a.shiftKey ? -1 : 1) && a.preventDefault();
1273
+ if (o === "Tab") {
1274
+ st(d, c.shiftKey ? -1 : 1) && c.preventDefault();
1169
1275
  return;
1170
1276
  }
1171
- if (n === "Enter" || n === " ") {
1172
- a.preventDefault(), je(d);
1277
+ if (o === "Enter" || o === " ") {
1278
+ c.preventDefault(), it(d);
1173
1279
  return;
1174
1280
  }
1175
- if (n === "Escape") {
1281
+ if (o === "Escape") {
1176
1282
  d.blur();
1177
1283
  return;
1178
1284
  }
1179
1285
  };
1180
- d.addEventListener("keydown", i), s(() => {
1286
+ d.addEventListener("keydown", s), i(() => {
1181
1287
  try {
1182
- d.removeEventListener("keydown", i), d.removeAttribute("tabindex"), d.removeAttribute("role"), d.removeAttribute("aria-label");
1288
+ d.removeEventListener("keydown", s), d.removeAttribute("tabindex"), d.removeAttribute("role"), d.removeAttribute("aria-label");
1183
1289
  } catch {
1184
1290
  }
1185
1291
  });
1186
1292
  }
1187
1293
  );
1188
1294
  }
1189
- function Xe(e) {
1190
- e && typeof e.directive == "function" && (_e(e), qe(e), Be(e), Je(e), ze(e)), le("schema", {
1295
+ function at(e) {
1296
+ e && typeof e.directive == "function" && (Ge(e), Ze(e), Qe(e), nt(e), dt(e)), ye("schema", {
1191
1297
  setup(t) {
1192
- !t.el && t._container && (t.el = t._container), t.addField = function(r, o) {
1193
- return ge(this, r, o);
1194
- }, t.renameField = function(r, o, s) {
1195
- return he(this, r, o, s);
1196
- }, t.removeField = function(r, o) {
1197
- return ye(this, r, o);
1198
- }, t.reorderFields = function(r, o) {
1199
- return Ee(this, r, o);
1298
+ !t.el && t._container && (t.el = t._container), t.addField = function(r, n) {
1299
+ return Se(this, r, n);
1300
+ }, t.renameField = function(r, n, i) {
1301
+ return Ae(this, r, n, i);
1302
+ }, t.removeField = function(r, n) {
1303
+ return Ie(this, r, n);
1304
+ }, t.reorderFields = function(r, n) {
1305
+ return Ne(this, r, n);
1200
1306
  }, t.inferReferences = function() {
1201
- return de(this.nodes ?? []);
1307
+ return me(this.nodes ?? []);
1202
1308
  }, t.schemaToJSON = function() {
1203
1309
  return K(this);
1204
1310
  }, t.schemaFromJSON = function(r) {
1205
- return ae(this, r);
1311
+ return ge(this, r);
1206
1312
  }, t.validateSchema = function() {
1207
- return we(this);
1208
- }, t.diffSchemas = function(r, o, s) {
1209
- return Se(r, o, s);
1313
+ return Re(this);
1314
+ }, t.diffSchemas = function(r, n, i) {
1315
+ return Fe(r, n, i);
1210
1316
  }, t.toDot = function(r) {
1211
- return Ce(this, r);
1317
+ return De(this, r);
1212
1318
  }, t.schemaLayout = function(r) {
1213
- return Fe(this, r);
1319
+ return $e(this, r);
1214
1320
  };
1215
1321
  }
1216
1322
  });
1217
1323
  }
1218
1324
  export {
1219
- ge as addField,
1220
- Ve as attachSchemaHistory,
1221
- Xe as default,
1222
- Se as diffSchemas,
1223
- de as inferReferences,
1224
- Be as registerEdgeInspectorDirective,
1225
- _e as registerNodeInspectorDirective,
1226
- qe as registerRowInspectorDirective,
1227
- ze as registerSchemaKeyboardNavDirective,
1228
- Je as registerSchemaReorderableDirective,
1229
- ye as removeField,
1230
- he as renameField,
1231
- Ee as reorderFields,
1232
- ae as schemaFromJSON,
1233
- Fe as schemaLayout,
1325
+ Se as addField,
1326
+ ct as attachSchemaHistory,
1327
+ at as default,
1328
+ Fe as diffSchemas,
1329
+ me as inferReferences,
1330
+ Qe as registerEdgeInspectorDirective,
1331
+ Ge as registerNodeInspectorDirective,
1332
+ Ze as registerRowInspectorDirective,
1333
+ dt as registerSchemaKeyboardNavDirective,
1334
+ nt as registerSchemaReorderableDirective,
1335
+ Ie as removeField,
1336
+ Ae as renameField,
1337
+ Ne as reorderFields,
1338
+ ge as schemaFromJSON,
1339
+ $e as schemaLayout,
1234
1340
  K as schemaToJSON,
1235
- Ce as toDot,
1236
- we as validateSchema
1341
+ De as toDot,
1342
+ Re as validateSchema
1237
1343
  };
1238
1344
  //# sourceMappingURL=alpineflow-schema.esm.js.map