@w6w/embed 0.2.26 → 0.2.28

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 (54) hide show
  1. package/dist/{CreateFunctionModal-DScxp_LN.js → CreateFunctionModal-B3LpcuI9.js} +2 -2
  2. package/dist/{CreateFunctionModal-DScxp_LN.js.map → CreateFunctionModal-B3LpcuI9.js.map} +1 -1
  3. package/dist/DocumentFormModal-DieWYFi4.js +175 -0
  4. package/dist/DocumentFormModal-DieWYFi4.js.map +1 -0
  5. package/dist/{ImportSpecModal-VdYN1QeZ.js → ImportSpecModal-xwTzj4KB.js} +2 -2
  6. package/dist/{ImportSpecModal-VdYN1QeZ.js.map → ImportSpecModal-xwTzj4KB.js.map} +1 -1
  7. package/dist/ModelRoutesManager-DtByS4mE.js +422 -0
  8. package/dist/ModelRoutesManager-DtByS4mE.js.map +1 -0
  9. package/dist/{WorkflowEditor-CGKoeSG7.js → WorkflowEditor-CvWkVmFn.js} +2 -2
  10. package/dist/{WorkflowEditor-CGKoeSG7.js.map → WorkflowEditor-CvWkVmFn.js.map} +1 -1
  11. package/dist/ai-keys-D676ly41.js +53 -0
  12. package/dist/ai-keys-D676ly41.js.map +1 -0
  13. package/dist/credentials-4Nf2GfMc.js +212 -0
  14. package/dist/credentials-4Nf2GfMc.js.map +1 -0
  15. package/dist/{editor-tools-Brw0cv2F.js → editor-tools-CVYTsVFN.js} +326 -326
  16. package/dist/editor-tools-CVYTsVFN.js.map +1 -0
  17. package/dist/editor.mjs +1 -1
  18. package/dist/editors.mjs +7 -7
  19. package/dist/{endpoints-DSRo1Lc5.js → endpoints-DArAqoLT.js} +15 -15
  20. package/dist/endpoints-DArAqoLT.js.map +1 -0
  21. package/dist/forms/ModelRoutesManager.d.ts +8 -0
  22. package/dist/forms.mjs +128 -133
  23. package/dist/forms.mjs.map +1 -1
  24. package/dist/index.mjs +16 -16
  25. package/dist/lib/callable-descriptors.d.ts +1 -1
  26. package/dist/lib/document-upload.d.ts +8 -0
  27. package/dist/lists/MyAiKeys.d.ts +5 -0
  28. package/dist/lists/TagChips.d.ts +4 -0
  29. package/dist/lists.d.ts +2 -0
  30. package/dist/lists.mjs +1552 -1072
  31. package/dist/lists.mjs.map +1 -1
  32. package/dist/models-CI0vLJ6o.js +346 -0
  33. package/dist/models-CI0vLJ6o.js.map +1 -0
  34. package/dist/rail.mjs +1 -1
  35. package/dist/repos/ai-keys.d.ts +14 -0
  36. package/dist/repos/credentials.d.ts +14 -14
  37. package/dist/repos/index.d.ts +1 -0
  38. package/dist/repos/models.d.ts +53 -4
  39. package/dist/repos.mjs +177 -162
  40. package/dist/repos.mjs.map +1 -1
  41. package/dist/{spec-import-SWOonsNr.js → spec-import-0B6oUewa.js} +5 -5
  42. package/dist/{spec-import-SWOonsNr.js.map → spec-import-0B6oUewa.js.map} +1 -1
  43. package/package.json +5 -5
  44. package/src/styles.css +23 -0
  45. package/dist/DocumentFormModal-Br4s8wmi.js +0 -89
  46. package/dist/DocumentFormModal-Br4s8wmi.js.map +0 -1
  47. package/dist/ModelRoutesManager-Bv6qefnq.js +0 -345
  48. package/dist/ModelRoutesManager-Bv6qefnq.js.map +0 -1
  49. package/dist/credentials-CMR_wEvx.js +0 -196
  50. package/dist/credentials-CMR_wEvx.js.map +0 -1
  51. package/dist/editor-tools-Brw0cv2F.js.map +0 -1
  52. package/dist/endpoints-DSRo1Lc5.js.map +0 -1
  53. package/dist/models-CK1KHd39.js +0 -311
  54. package/dist/models-CK1KHd39.js.map +0 -1
@@ -1,33 +1,33 @@
1
- import { jsx as n, jsxs as r, Fragment as j } from "react/jsx-runtime";
2
- import { r as Cn, l as je, m as Ve, d as De, e as En, h as Oe, c as An } from "./import-bindings-EUtxZ9Ti.js";
3
- import { useContext as ve, useState as u, useMemo as Qe, useEffect as be, createContext as We, useRef as Fe } from "react";
4
- import { ExpressionOptionsProvider as He, Icon as q, RetryPolicyFields as Pn, StepBuilderModal as In, IconButton as we, useEnterSubmit as Tn, CodeBlock as pe, DeleteButton as Dn, EditButton as On, ConfirmModal as Re, JsonEditor as Rn, useExpressionOptions as Mn, ExpressionInput as Ln, ResultViewer as jn } from "@w6w/ui";
5
- import { d as Vn, p as Qn, i as Wn, t as Fn, e as Me, a as Hn, h as $n, s as Bn } from "./document-sources-DNmBojx6.js";
6
- import { u as Jn, g as Kn, d as qn, a as Un, f as $e, h as Be, b as Je, e as Ke } from "./spec-export-DMMET5VM.js";
7
- import { i as _n, f as zn, e as Gn, b as Yn, u as Zn } from "./vault-BSEWhMYC.js";
8
- import { k as Xn } from "./spec-import-SWOonsNr.js";
9
- import { s as xn, M as K, b as et, C as nt } from "./ConfirmModal-Pv2-A_3U.js";
10
- import { u as tt, i as it, f as st } from "./slug-BVdgiP_L.js";
11
- import { WorkflowConnectionsPanel as at } from "@w6w/ui/flow";
1
+ import { jsx as n, jsxs as r, Fragment as V } from "react/jsx-runtime";
2
+ import { r as En, l as We, m as Fe, d as Me, e as An, h as Le, c as Pn } from "./import-bindings-EUtxZ9Ti.js";
3
+ import { useContext as ve, useState as u, useMemo as He, useEffect as be, createContext as $e, useRef as Be } from "react";
4
+ import { ExpressionOptionsProvider as Je, Icon as q, RetryPolicyFields as Tn, StepBuilderModal as In, IconButton as Se, useEnterSubmit as Dn, CodeBlock as pe, DeleteButton as On, EditButton as Rn, ConfirmModal as je, JsonEditor as Mn, useExpressionOptions as Ln, ExpressionInput as jn, ResultViewer as Vn } from "@w6w/ui";
5
+ import { d as Qn, p as Wn, i as Fn, t as Hn, e as Ve, a as $n, h as Bn, s as Jn } from "./document-sources-DNmBojx6.js";
6
+ import { u as Kn, g as qn, d as Un, a as _n, f as Ke, h as qe, b as Ue, e as _e } from "./spec-export-DMMET5VM.js";
7
+ import { i as zn, f as Gn, e as Yn, b as Zn, u as Xn } from "./vault-BSEWhMYC.js";
8
+ import { k as xn } from "./spec-import-0B6oUewa.js";
9
+ import { s as et, M as K, b as nt, C as tt } from "./ConfirmModal-Pv2-A_3U.js";
10
+ import { u as it, i as st, f as at } from "./slug-BVdgiP_L.js";
11
+ import { WorkflowConnectionsPanel as rt } from "@w6w/ui/flow";
12
12
  import { ApiError as L } from "@w6w/sdk";
13
- import { i as rt, p as qe, c as Ue, d as ot } from "./settings-rail--GdRMusb.js";
14
- import { w as _e, v as ze, y as Ge, x as Ye, b as Ze, d as lt, f as dt, h as ct, u as ut, t as ht, s as ft, r as mt, q as gt } from "./endpoints-DSRo1Lc5.js";
15
- import { a1 as Xe, a0 as pt, _ as vt, P as bt, U as yt, a3 as kt, Z as wt, V as Nt, X as St, K as Ct, I as Et } from "./workflows-Dz8LMjnt.js";
16
- import { I as xe } from "./ImportSpecModal-VdYN1QeZ.js";
17
- import { useQueryClient as At } from "@tanstack/react-query";
18
- import { foldStateLog as Pt } from "@w6w/expr";
19
- const ye = We(null);
20
- function Ri({
13
+ import { i as ot, p as ze, c as Ge, d as lt } from "./settings-rail--GdRMusb.js";
14
+ import { w as Ye, v as Ze, y as Xe, x as xe, b as en, d as dt, f as ct, h as ut, u as ht, t as ft, s as mt, r as gt, q as pt } from "./endpoints-DArAqoLT.js";
15
+ import { a1 as nn, a0 as vt, _ as bt, P as yt, U as kt, a3 as wt, Z as Nt, V as St, X as Ct, K as Et, I as At } from "./workflows-Dz8LMjnt.js";
16
+ import { I as tn } from "./ImportSpecModal-xwTzj4KB.js";
17
+ import { useQueryClient as Pt } from "@tanstack/react-query";
18
+ import { foldStateLog as Tt } from "@w6w/expr";
19
+ const ye = $e(null);
20
+ function ji({
21
21
  children: e,
22
22
  base: t = null
23
23
  }) {
24
- const [i, s] = u(null), a = i ?? t, l = Qe(() => ({ resource: a, setCallable: s }), [a]);
24
+ const [i, s] = u(null), a = i ?? t, l = He(() => ({ resource: a, setCallable: s }), [a]);
25
25
  return /* @__PURE__ */ n(ye.Provider, { value: l, children: e });
26
26
  }
27
- function Mi() {
27
+ function Vi() {
28
28
  return ve(ye) !== null;
29
29
  }
30
- function Li(e) {
30
+ function Qi(e) {
31
31
  const t = ve(ye);
32
32
  if (!t) throw new Error("useWorkspace must be used within <WorkspaceProvider>");
33
33
  const { setCallable: i } = t, s = e ? JSON.stringify(e) : "";
@@ -38,13 +38,13 @@ function It() {
38
38
  if (!e) throw new Error("useWorkspaceCallable must be used within <WorkspaceProvider>");
39
39
  return e.resource;
40
40
  }
41
- const en = { open: !1, activeTool: null };
42
- function Tt(e) {
43
- if (typeof localStorage > "u") return en;
44
- const t = localStorage.getItem(e), { activeTool: i } = Cn(t);
41
+ const sn = { open: !1, activeTool: null };
42
+ function Dt(e) {
43
+ if (typeof localStorage > "u") return sn;
44
+ const t = localStorage.getItem(e), { activeTool: i } = En(t);
45
45
  return { open: !1, activeTool: i };
46
46
  }
47
- function nn({
47
+ function an({
48
48
  tools: e,
49
49
  ctx: t,
50
50
  state: i,
@@ -85,12 +85,12 @@ function nn({
85
85
  ] })
86
86
  ] });
87
87
  }
88
- function Dt({
88
+ function Ot({
89
89
  storageKey: e,
90
90
  tools: t,
91
91
  ctx: i
92
92
  }) {
93
- const [s, a] = u(() => Tt(e));
93
+ const [s, a] = u(() => Dt(e));
94
94
  be(() => {
95
95
  typeof localStorage > "u" || localStorage.setItem(e, JSON.stringify({ activeTool: s.activeTool }));
96
96
  }, [e, s.activeTool]);
@@ -99,19 +99,19 @@ function Dt({
99
99
  (c) => c.open && c.activeTool === o ? { open: !1, activeTool: o } : { open: !0, activeTool: o }
100
100
  );
101
101
  }
102
- return /* @__PURE__ */ n(nn, { tools: t, ctx: i, state: s, onToggle: l });
102
+ return /* @__PURE__ */ n(an, { tools: t, ctx: i, state: s, onToggle: l });
103
103
  }
104
- function ji({
104
+ function Wi({
105
105
  tools: e,
106
106
  storageKey: t
107
107
  }) {
108
108
  const i = It(), s = e.filter((a) => a.isAvailable(i));
109
- return s.length === 0 ? null : t === null ? /* @__PURE__ */ n(nn, { tools: s, ctx: i, state: en, onToggle: () => {
110
- } }) : /* @__PURE__ */ n(Dt, { storageKey: t, tools: s, ctx: i }, t);
109
+ return s.length === 0 ? null : t === null ? /* @__PURE__ */ n(an, { tools: s, ctx: i, state: sn, onToggle: () => {
110
+ } }) : /* @__PURE__ */ n(Ot, { storageKey: t, tools: s, ctx: i }, t);
111
111
  }
112
- function Ot(e) {
113
- const t = e, i = _n(t ?? void 0, t != null), s = zn(), a = Jn(), l = Xn(t ?? void 0, t != null), o = Gn(), c = Yn(), h = Zn();
114
- return Qe(
112
+ function Rt(e) {
113
+ const t = e, i = zn(t ?? void 0, t != null), s = Gn(), a = Kn(), l = xn(t ?? void 0, t != null), o = Yn(), c = Zn(), h = Xn();
114
+ return He(
115
115
  () => ({
116
116
  vars: (i.data ?? []).map((d) => d.name),
117
117
  constants: (a.data ?? []).map((d) => d.name),
@@ -120,14 +120,14 @@ function Ot(e) {
120
120
  // field enumeration — no parsing, no gate logic, and no filtering here
121
121
  // (A5c); `isRefSafeKey` filtering happens once, downstream, at the
122
122
  // modal's render site.
123
- documents: Qn(l.data ?? []),
123
+ documents: Wn(l.data ?? []),
124
124
  // Real project values so the ƒx Result preview substitutes them for
125
125
  // `var.<name>` / `const.<name>` / `documents.<key>` / `documents.<key>.<field>` refs
126
126
  // instead of the raw template.
127
127
  sampleValues: {
128
128
  ...Object.fromEntries((i.data ?? []).map((d) => [`var.${d.name}`, d.value])),
129
129
  ...Object.fromEntries((a.data ?? []).map((d) => [`const.${d.name}`, d.value])),
130
- ...Vn(l.data ?? [])
130
+ ...Qn(l.data ?? [])
131
131
  },
132
132
  sealSecret: o,
133
133
  // A created var carries the SAME project the read above carried (B3) —
@@ -162,18 +162,18 @@ function Ot(e) {
162
162
  ]
163
163
  );
164
164
  }
165
- function Vi({
165
+ function Fi({
166
166
  project: e,
167
167
  children: t
168
168
  }) {
169
- const i = Ot(e);
170
- return /* @__PURE__ */ n(He, { value: i, children: t });
169
+ const i = Rt(e);
170
+ return /* @__PURE__ */ n(Je, { value: i, children: t });
171
171
  }
172
- function Rt({ ctx: e }) {
173
- const [t, i] = u(null), s = Fn(e);
172
+ function Mt({ ctx: e }) {
173
+ const [t, i] = u(null), s = Hn(e);
174
174
  if (!s) return null;
175
- const a = (e == null ? void 0 : e.kind) === "workflow" ? e.triggers : void 0, l = xn(s);
176
- return l.length === 0 ? /* @__PURE__ */ n("p", { className: "muted", children: tt(s) }) : /* @__PURE__ */ r("div", { children: [
175
+ const a = (e == null ? void 0 : e.kind) === "workflow" ? e.triggers : void 0, l = et(s);
176
+ return l.length === 0 ? /* @__PURE__ */ n("p", { className: "muted", children: it(s) }) : /* @__PURE__ */ r("div", { children: [
177
177
  /* @__PURE__ */ n("p", { className: "muted small", style: { marginTop: 0 }, children: "Call this from:" }),
178
178
  /* @__PURE__ */ n("div", { className: "rail-code-langs", children: l.map(({ id: o, label: c, icon: h }) => /* @__PURE__ */ r(
179
179
  "button",
@@ -191,19 +191,19 @@ function Rt({ ctx: e }) {
191
191
  },
192
192
  o
193
193
  )) }),
194
- t !== null && /* @__PURE__ */ n(K, { title: "Call from code", wide: !0, onClose: () => i(null), children: /* @__PURE__ */ n("div", { style: { height: 450 }, children: /* @__PURE__ */ n(et, { resource: s, triggers: a, initialTab: t }) }) })
194
+ t !== null && /* @__PURE__ */ n(K, { title: "Call from code", wide: !0, onClose: () => i(null), children: /* @__PURE__ */ n("div", { style: { height: 450 }, children: /* @__PURE__ */ n(nt, { resource: s, triggers: a, initialTab: t }) }) })
195
195
  ] });
196
196
  }
197
- function Mt() {
197
+ function Lt() {
198
198
  return /* @__PURE__ */ n(q, { name: "code" });
199
199
  }
200
- const Lt = {
200
+ const jt = {
201
201
  id: "code",
202
202
  title: "Code",
203
- Icon: Mt,
204
- isAvailable: (e) => Wn(e),
205
- Panel: Rt
206
- }, jt = {
203
+ Icon: Lt,
204
+ isAvailable: (e) => Fn(e),
205
+ Panel: Mt
206
+ }, Vt = {
207
207
  id: "connections",
208
208
  title: "Connections",
209
209
  rendersHeading: !0,
@@ -213,27 +213,27 @@ const Lt = {
213
213
  var t;
214
214
  return (e == null ? void 0 : e.kind) === "workflow" && Object.keys(((t = e.connectionResources) == null ? void 0 : t.connections) ?? {}).length > 0;
215
215
  },
216
- Panel: ({ ctx: e }) => (e == null ? void 0 : e.kind) === "workflow" && e.connectionResources ? /* @__PURE__ */ n(at, { resources: e.connectionResources }, e.id) : null
217
- }, Vt = { project: null, onNavigate: () => {
218
- } }, tn = We(Vt);
219
- function Qi({
216
+ Panel: ({ ctx: e }) => (e == null ? void 0 : e.kind) === "workflow" && e.connectionResources ? /* @__PURE__ */ n(rt, { resources: e.connectionResources }, e.id) : null
217
+ }, Qt = { project: null, onNavigate: () => {
218
+ } }, rn = $e(Qt);
219
+ function Hi({
220
220
  project: e,
221
221
  onNavigate: t,
222
222
  children: i
223
223
  }) {
224
- return /* @__PURE__ */ n(tn.Provider, { value: { project: e, onNavigate: t }, children: i });
224
+ return /* @__PURE__ */ n(rn.Provider, { value: { project: e, onNavigate: t }, children: i });
225
225
  }
226
- function sn() {
227
- return ve(tn);
226
+ function on() {
227
+ return ve(rn);
228
228
  }
229
- const Qt = "@w6w/call";
230
- function Le(e) {
229
+ const Wt = "@w6w/call";
230
+ function Qe(e) {
231
231
  return e ? e.kind === "workflow" ? e.workflow : e.kind === "function" ? e.function : `${e.uses.app}/${e.uses.action}` : "";
232
232
  }
233
- function Wt(e) {
233
+ function Ft(e) {
234
234
  return (e == null ? void 0 : e.kind) === "workflow" ? "Workflow (asynchronous)" : (e == null ? void 0 : e.kind) === "function" ? "Function (synchronous)" : "App action (synchronous)";
235
235
  }
236
- function an({
236
+ function ln({
237
237
  kind: e,
238
238
  id: t,
239
239
  policy: i,
@@ -241,14 +241,14 @@ function an({
241
241
  saving: a,
242
242
  onPersist: l
243
243
  }) {
244
- var y, M, V, N;
245
- const o = Ze(!0), { project: c } = sn(), h = Xe(c ?? void 0, !0), [d, v] = u(!1), [b, m] = u(null), C = (y = i.reroute) == null ? void 0 : y.target, k = Le(C), D = C ? Me({
244
+ var y, M, Q, N;
245
+ const o = en(!0), { project: c } = on(), h = nn(c ?? void 0, !0), [d, v] = u(!1), [b, m] = u(null), C = (y = i.reroute) == null ? void 0 : y.target, k = Qe(C), D = C ? Ve({
246
246
  resource: { kind: e, id: t },
247
247
  target: { kind: C.kind, id: k },
248
248
  hasAdapter: ((M = i.reroute) == null ? void 0 : M.with) !== void 0
249
- }) : "allow", O = (C == null ? void 0 : C.kind) === "workflow" ? ((N = (V = h.data) == null ? void 0 : V.find((p) => p.id === k)) == null ? void 0 : N.displayName) ?? void 0 : (() => {
249
+ }) : "allow", O = (C == null ? void 0 : C.kind) === "workflow" ? ((N = (Q = h.data) == null ? void 0 : Q.find((p) => p.id === k)) == null ? void 0 : N.displayName) ?? void 0 : (() => {
250
250
  var P;
251
- const p = (P = o.data) == null ? void 0 : P.find(($) => $.id === k);
251
+ const p = (P = o.data) == null ? void 0 : P.find((B) => B.id === k);
252
252
  return p ? p.displayName || p.key : void 0;
253
253
  })();
254
254
  be(() => {
@@ -260,10 +260,10 @@ function an({
260
260
  function R(p) {
261
261
  var U;
262
262
  let P;
263
- if (p.uses.app === Qt) {
264
- const Q = p.with ?? {}, W = typeof Q.targetId == "string" ? Q.targetId : "";
265
- if (!W) return;
266
- P = Q.targetKind === "workflow" ? { kind: "workflow", workflow: W } : { kind: "function", function: W };
263
+ if (p.uses.app === Wt) {
264
+ const W = p.with ?? {}, F = typeof W.targetId == "string" ? W.targetId : "";
265
+ if (!F) return;
266
+ P = W.targetKind === "workflow" ? { kind: "workflow", workflow: F } : { kind: "function", function: F };
267
267
  } else if (!p.uses.app.startsWith("@w6w/"))
268
268
  P = {
269
269
  kind: "action",
@@ -276,9 +276,9 @@ function an({
276
276
  };
277
277
  else
278
278
  return;
279
- if (Me({
279
+ if (Ve({
280
280
  resource: { kind: e, id: t },
281
- target: { kind: P.kind, id: Le(P) },
281
+ target: { kind: P.kind, id: Qe(P) },
282
282
  hasAdapter: ((U = i.reroute) == null ? void 0 : U.with) !== void 0
283
283
  }) === "block") {
284
284
  m(
@@ -291,7 +291,7 @@ function an({
291
291
  return !s && !a ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-errorhandling-body", children: [
292
292
  /* @__PURE__ */ r("section", { "data-testid": "rail-retry-section", children: [
293
293
  /* @__PURE__ */ n(
294
- Pn,
294
+ Tn,
295
295
  {
296
296
  value: i.retry,
297
297
  onChange: (p) => E({ ...i, retry: p }),
@@ -307,7 +307,7 @@ function an({
307
307
  /* @__PURE__ */ n("strong", { children: O ?? k }),
308
308
  " ",
309
309
  /* @__PURE__ */ n("code", { className: "muted", children: k }),
310
- /* @__PURE__ */ n("span", { className: "muted small block", children: Wt(C) })
310
+ /* @__PURE__ */ n("span", { className: "muted small block", children: Ft(C) })
311
311
  ] }),
312
312
  /* @__PURE__ */ n(
313
313
  "button",
@@ -356,34 +356,34 @@ function an({
356
356
  )
357
357
  ] });
358
358
  }
359
- function Ft({ ctx: e }) {
359
+ function Ht({ ctx: e }) {
360
360
  const t = "policy" in e ? e.policy : void 0, i = "onPolicyChange" in e ? e.onPolicyChange : void 0;
361
361
  return /* @__PURE__ */ n(
362
- an,
362
+ ln,
363
363
  {
364
364
  kind: e.kind,
365
365
  id: e.id,
366
- policy: t ? qe(t) : {},
366
+ policy: t ? ze(t) : {},
367
367
  ready: !!i,
368
368
  saving: !1,
369
369
  onPersist: (s) => i == null ? void 0 : i(s)
370
370
  }
371
371
  );
372
372
  }
373
- function Ht({ id: e, kind: t }) {
374
- const i = _e(e, t === "function"), s = ze(e, t === "endpoint"), a = Ge(), l = Ye(), o = Ue(t, t === "function" ? i.data : s.data), c = t === "function" ? a.isPending : l.isPending;
373
+ function $t({ id: e, kind: t }) {
374
+ const i = Ye(e, t === "function"), s = Ze(e, t === "endpoint"), a = Xe(), l = xe(), o = Ge(t, t === "function" ? i.data : s.data), c = t === "function" ? a.isPending : l.isPending;
375
375
  return /* @__PURE__ */ n(
376
- an,
376
+ ln,
377
377
  {
378
378
  kind: t,
379
379
  id: e,
380
- policy: o ? qe(o.definition) : {},
380
+ policy: o ? ze(o.definition) : {},
381
381
  ready: !!o,
382
382
  saving: c,
383
383
  onPersist: (h, d) => {
384
384
  if (!o) return;
385
385
  const v = {
386
- definition: ot(o.definition, h),
386
+ definition: lt(o.definition, h),
387
387
  ifUnmodifiedSince: o.updatedAt
388
388
  }, b = {
389
389
  onError: (m) => d(m instanceof L ? m.message : String(m))
@@ -393,19 +393,19 @@ function Ht({ id: e, kind: t }) {
393
393
  }
394
394
  );
395
395
  }
396
- function $t({ ctx: e }) {
397
- return (e == null ? void 0 : e.kind) !== "workflow" && (e == null ? void 0 : e.kind) !== "function" && (e == null ? void 0 : e.kind) !== "endpoint" ? null : e.kind === "workflow" || typeof e.onPolicyChange == "function" ? /* @__PURE__ */ n(Ft, { ctx: e }) : /* @__PURE__ */ n(Ht, { id: e.id, kind: e.kind });
396
+ function Bt({ ctx: e }) {
397
+ return (e == null ? void 0 : e.kind) !== "workflow" && (e == null ? void 0 : e.kind) !== "function" && (e == null ? void 0 : e.kind) !== "endpoint" ? null : e.kind === "workflow" || typeof e.onPolicyChange == "function" ? /* @__PURE__ */ n(Ht, { ctx: e }) : /* @__PURE__ */ n($t, { id: e.id, kind: e.kind });
398
398
  }
399
- function Bt() {
399
+ function Jt() {
400
400
  return /* @__PURE__ */ n(q, { name: "warning" });
401
401
  }
402
- const Jt = {
402
+ const Kt = {
403
403
  id: "error-handling",
404
404
  title: "Error handling",
405
- Icon: Bt,
406
- isAvailable: (e) => rt(e),
407
- Panel: $t
408
- }, Kt = {
405
+ Icon: Jt,
406
+ isAvailable: (e) => ot(e),
407
+ Panel: Bt
408
+ }, qt = {
409
409
  id: "history",
410
410
  title: "Execution history",
411
411
  Icon: () => /* @__PURE__ */ n(q, { name: "history" }),
@@ -415,7 +415,7 @@ const Jt = {
415
415
  (e == null ? void 0 : e.kind) === "workflow" && ((t = e.onOpenHistory) == null || t.call(e));
416
416
  }
417
417
  };
418
- function qt(e, t) {
418
+ function Ut(e, t) {
419
419
  if (!t.includes(",")) return { tags: e, typed: t };
420
420
  let i = e;
421
421
  for (const s of t.split(",")) {
@@ -424,26 +424,26 @@ function qt(e, t) {
424
424
  }
425
425
  return { tags: i, typed: "" };
426
426
  }
427
- function Ut(e, t) {
427
+ function _t(e, t) {
428
428
  return e.filter((i) => i !== t);
429
429
  }
430
- function _t({ tags: e, onChange: t }) {
430
+ function zt({ tags: e, onChange: t }) {
431
431
  const [i, s] = u("");
432
432
  function a(l) {
433
- const o = qt(e, l);
433
+ const o = Ut(e, l);
434
434
  s(o.typed), o.tags !== e && t(o.tags);
435
435
  }
436
436
  return /* @__PURE__ */ r("div", { className: "tag-list", "data-testid": "tag-editor", children: [
437
437
  e.map((l) => /* @__PURE__ */ r("span", { className: "tag removable", children: [
438
438
  l,
439
439
  /* @__PURE__ */ n(
440
- we,
440
+ Se,
441
441
  {
442
442
  danger: !0,
443
443
  icon: "close",
444
444
  label: `Remove tag ${l}`,
445
445
  title: `Remove ${l}`,
446
- onClick: () => t(Ut(e, l))
446
+ onClick: () => t(_t(e, l))
447
447
  }
448
448
  )
449
449
  ] }, l)),
@@ -459,8 +459,8 @@ function _t({ tags: e, onChange: t }) {
459
459
  )
460
460
  ] });
461
461
  }
462
- function rn(e) {
463
- const t = lt(e.kind).settings, { initial: i } = e, [s, a] = u(i.displayName), [l, o] = u(i.key ?? ""), [c, h] = u(i.tags ?? []), [d, v] = u(!1), [b, m] = u(null), C = s !== i.displayName, k = l !== (i.key ?? ""), D = t.hasTags && JSON.stringify(c) !== JSON.stringify(i.tags ?? []), O = C || k || D, E = t.canEditKey, R = l === "" || it(l), y = O && R && !d;
462
+ function dn(e) {
463
+ const t = dt(e.kind).settings, { initial: i } = e, [s, a] = u(i.displayName), [l, o] = u(i.key ?? ""), [c, h] = u(i.tags ?? []), [d, v] = u(!1), [b, m] = u(null), C = s !== i.displayName, k = l !== (i.key ?? ""), D = t.hasTags && JSON.stringify(c) !== JSON.stringify(i.tags ?? []), O = C || k || D, E = t.canEditKey, R = l === "" || st(l), y = O && R && !d;
464
464
  async function M() {
465
465
  if (y) {
466
466
  m(null), v(!0);
@@ -477,7 +477,7 @@ function rn(e) {
477
477
  }
478
478
  }
479
479
  }
480
- const V = Tn(M, { enabled: y });
480
+ const Q = Dn(M, { enabled: y });
481
481
  return /* @__PURE__ */ r(K, { title: "Edit settings", onClose: e.onClose, children: [
482
482
  /* @__PURE__ */ r("div", { className: "modal-body", children: [
483
483
  /* @__PURE__ */ r("label", { className: "field", children: [
@@ -490,7 +490,7 @@ function rn(e) {
490
490
  onChange: (N) => a(N.target.value),
491
491
  placeholder: t.namePlaceholder,
492
492
  autoFocus: !0,
493
- ...V
493
+ ...Q
494
494
  }
495
495
  )
496
496
  ] }),
@@ -501,9 +501,9 @@ function rn(e) {
501
501
  {
502
502
  type: "text",
503
503
  value: l,
504
- onChange: (N) => o(st(N.target.value)),
504
+ onChange: (N) => o(at(N.target.value)),
505
505
  placeholder: t.keyPlaceholder,
506
- ...V
506
+ ...Q
507
507
  }
508
508
  ),
509
509
  /* @__PURE__ */ r("span", { className: "muted small", children: [
@@ -513,7 +513,7 @@ function rn(e) {
513
513
  ] }),
514
514
  t.hasTags && /* @__PURE__ */ r("div", { children: [
515
515
  /* @__PURE__ */ n("p", { className: "muted small", style: { marginBottom: "8px" }, children: "Tags" }),
516
- /* @__PURE__ */ n(_t, { tags: c, onChange: h })
516
+ /* @__PURE__ */ n(zt, { tags: c, onChange: h })
517
517
  ] }),
518
518
  b && /* @__PURE__ */ n("div", { className: "error", children: b })
519
519
  ] }),
@@ -523,7 +523,7 @@ function rn(e) {
523
523
  ] })
524
524
  ] });
525
525
  }
526
- const zt = {
526
+ const Gt = {
527
527
  function: {
528
528
  json: "functions-version-json",
529
529
  error: "functions-version-error",
@@ -549,9 +549,9 @@ const zt = {
549
549
  invokeError: "endpoints-version-invoke-error"
550
550
  }
551
551
  };
552
- function on(e) {
553
- const { kind: t, id: i, versionNumber: s } = e, a = zt[t], l = Kn(t, i, s, !0), o = qn(t), c = Un(t), [h, d] = u(!1), [v, b] = u(null);
554
- return /* @__PURE__ */ r(j, { children: [
552
+ function cn(e) {
553
+ const { kind: t, id: i, versionNumber: s } = e, a = Gt[t], l = qn(t, i, s, !0), o = Un(t), c = _n(t), [h, d] = u(!1), [v, b] = u(null);
554
+ return /* @__PURE__ */ r(V, { children: [
555
555
  /* @__PURE__ */ r(K, { title: `Version ${s}`, onClose: e.onClose, wide: !0, children: [
556
556
  /* @__PURE__ */ r("div", { className: "modal-body", children: [
557
557
  l.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : l.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": a.error, children: l.error instanceof Error ? l.error.message : String(l.error) }) : l.data ? /* @__PURE__ */ n("div", { "data-testid": a.json, children: /* @__PURE__ */ n(
@@ -602,7 +602,7 @@ function on(e) {
602
602
  ] })
603
603
  ] }),
604
604
  h && /* @__PURE__ */ n(
605
- nt,
605
+ tt,
606
606
  {
607
607
  title: "Revert to this version",
608
608
  message: `Revert to version ${s}? This restores its content onto the resource's current draft; the resource's key and address stay unchanged.`,
@@ -616,7 +616,7 @@ function on(e) {
616
616
  )
617
617
  ] });
618
618
  }
619
- function Gt(e) {
619
+ function Yt(e) {
620
620
  const {
621
621
  archived: t,
622
622
  deleteLabel: i,
@@ -653,7 +653,7 @@ function Gt(e) {
653
653
  }
654
654
  ) : t ? /* @__PURE__ */ r("span", { className: "rail-danger-zone-delete", children: [
655
655
  /* @__PURE__ */ n(
656
- Dn,
656
+ On,
657
657
  {
658
658
  label: i,
659
659
  "data-testid": s,
@@ -668,13 +668,13 @@ function Gt(e) {
668
668
  h && /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-archive-error", children: h })
669
669
  ] });
670
670
  }
671
- function ln(e) {
671
+ function un(e) {
672
672
  return /* @__PURE__ */ r("div", { className: "right-rail-panel-head rail-settings-head", children: [
673
673
  /* @__PURE__ */ n("h3", { children: "Settings" }),
674
- /* @__PURE__ */ n(On, { label: "Edit settings", "data-testid": "rail-settings-edit", onClick: e.onEdit })
674
+ /* @__PURE__ */ n(Rn, { label: "Edit settings", "data-testid": "rail-settings-edit", onClick: e.onEdit })
675
675
  ] });
676
676
  }
677
- function dn(e) {
677
+ function hn(e) {
678
678
  const { id: t, displayName: i, fields: s, row: a, tags: l } = e;
679
679
  return /* @__PURE__ */ n("div", { className: "rail-meta", children: /* @__PURE__ */ n(
680
680
  "div",
@@ -686,21 +686,21 @@ function dn(e) {
686
686
  gap: "8px"
687
687
  },
688
688
  children: /* @__PURE__ */ r("dl", { className: "rail-meta-list", children: [
689
- i && /* @__PURE__ */ r(j, { children: [
689
+ i && /* @__PURE__ */ r(V, { children: [
690
690
  /* @__PURE__ */ n("dt", { children: "Name" }),
691
691
  /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-name", children: /* @__PURE__ */ n("code", { children: i }) })
692
692
  ] }),
693
693
  /* @__PURE__ */ n("dt", { children: "ID" }),
694
694
  /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-id", children: /* @__PURE__ */ n("code", { children: t }) }),
695
- s.includes("key") && a && /* @__PURE__ */ r(j, { children: [
695
+ s.includes("key") && a && /* @__PURE__ */ r(V, { children: [
696
696
  /* @__PURE__ */ n("dt", { children: "Key" }),
697
697
  /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-key", children: /* @__PURE__ */ n("code", { children: a.key || "unset" }) })
698
698
  ] }),
699
- s.includes("updatedAt") && a && /* @__PURE__ */ r(j, { children: [
699
+ s.includes("updatedAt") && a && /* @__PURE__ */ r(V, { children: [
700
700
  /* @__PURE__ */ n("dt", { children: "Updated" }),
701
701
  /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-updated", "data-value": a.updatedAt, children: new Date(a.updatedAt).toLocaleString() })
702
702
  ] }),
703
- l !== void 0 && a && /* @__PURE__ */ r(j, { children: [
703
+ l !== void 0 && a && /* @__PURE__ */ r(V, { children: [
704
704
  /* @__PURE__ */ n("dt", { children: "Tags" }),
705
705
  /* @__PURE__ */ n("dd", { "data-testid": "rail-meta-tags", children: l.length > 0 ? l.map((o) => /* @__PURE__ */ n("span", { className: "tag", children: o }, o)) : "No tags" })
706
706
  ] })
@@ -708,9 +708,9 @@ function dn(e) {
708
708
  }
709
709
  ) });
710
710
  }
711
- function cn(e) {
711
+ function fn(e) {
712
712
  return /* @__PURE__ */ n("div", { className: "rail-spec-actions", children: /* @__PURE__ */ n(
713
- we,
713
+ Se,
714
714
  {
715
715
  icon: "file-text",
716
716
  label: "Export, edit, or import",
@@ -719,7 +719,7 @@ function cn(e) {
719
719
  }
720
720
  ) });
721
721
  }
722
- function un(e) {
722
+ function mn(e) {
723
723
  const { kind: t, children: i, onImport: s, onClose: a } = e;
724
724
  return /* @__PURE__ */ r(K, { title: "Definition", onClose: a, children: [
725
725
  /* @__PURE__ */ r("div", { className: "modal-body", children: [
@@ -745,7 +745,7 @@ function un(e) {
745
745
  /* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: a, children: "Close" }) })
746
746
  ] });
747
747
  }
748
- function hn(e) {
748
+ function gn(e) {
749
749
  const { open: t, versions: i } = e;
750
750
  return /* @__PURE__ */ r("div", { className: "rail-version-section", children: [
751
751
  e.definitionStatus && /* @__PURE__ */ r("div", { "aria-live": "polite", "data-testid": "rail-definition-status", children: [
@@ -768,7 +768,7 @@ function hn(e) {
768
768
  }
769
769
  ),
770
770
  (t || e.definitionStatus) && /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-version-published", children: (i == null ? void 0 : i.currentPublishedVersion) != null ? `Published: v${i.currentPublishedVersion}` : "Never published" }),
771
- t && /* @__PURE__ */ r(j, { children: [
771
+ t && /* @__PURE__ */ r(V, { children: [
772
772
  /* @__PURE__ */ r("div", { className: "rail-version-actions", children: [
773
773
  /* @__PURE__ */ n(
774
774
  "button",
@@ -799,7 +799,7 @@ function hn(e) {
799
799
  ] })
800
800
  ] });
801
801
  }
802
- function fn(e) {
802
+ function pn(e) {
803
803
  const { loading: t, versions: i } = e;
804
804
  return /* @__PURE__ */ r(K, { title: "All versions", onClose: e.onClose, wide: !0, children: [
805
805
  /* @__PURE__ */ r("div", { className: "modal-body", children: [
@@ -827,7 +827,7 @@ function fn(e) {
827
827
  /* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Done" }) })
828
828
  ] });
829
829
  }
830
- const Yt = {
830
+ const Zt = {
831
831
  function: {
832
832
  deleteTitle: "Delete function",
833
833
  deleteMessage: "Delete this function permanently? Any endpoint, workflow, or call pointing to it will start failing with a not-found error the next time it runs, and this cannot be undone.",
@@ -856,11 +856,11 @@ const Yt = {
856
856
  archiveTestId: "wf-settings-archive"
857
857
  }
858
858
  };
859
- function mn(e) {
860
- const t = Yt[e.kind];
861
- return /* @__PURE__ */ r(j, { children: [
859
+ function vn(e) {
860
+ const t = Zt[e.kind];
861
+ return /* @__PURE__ */ r(V, { children: [
862
862
  /* @__PURE__ */ n(
863
- Gt,
863
+ Yt,
864
864
  {
865
865
  archived: e.archived,
866
866
  allowDirectDelete: e.kind === "workflow",
@@ -875,7 +875,7 @@ function mn(e) {
875
875
  }
876
876
  ),
877
877
  e.deleteConfirming && /* @__PURE__ */ n(
878
- Re,
878
+ je,
879
879
  {
880
880
  title: t.deleteTitle,
881
881
  message: t.deleteMessage,
@@ -886,7 +886,7 @@ function mn(e) {
886
886
  }
887
887
  ),
888
888
  e.archiveConfirming && /* @__PURE__ */ n(
889
- Re,
889
+ je,
890
890
  {
891
891
  title: t.archiveTitle,
892
892
  message: t.archiveMessage,
@@ -898,14 +898,14 @@ function mn(e) {
898
898
  )
899
899
  ] });
900
900
  }
901
- const gn = { functionsKey: ct, endpointsKey: dt, workflowsKey: kt };
902
- function Zt({
901
+ const bn = { functionsKey: ut, endpointsKey: ct, workflowsKey: wt };
902
+ function Xt({
903
903
  ctx: e,
904
904
  project: t,
905
905
  onNavigate: i,
906
906
  open: s
907
907
  }) {
908
- var se, fe;
908
+ var ae, me;
909
909
  const {
910
910
  editingSettings: a,
911
911
  setEditingSettings: l,
@@ -913,36 +913,36 @@ function Zt({
913
913
  setHistoryOpen: c,
914
914
  versionListOpen: h,
915
915
  setVersionListOpen: d
916
- } = s, v = Xe(t ?? void 0), b = (e == null ? void 0 : e.kind) === "workflow", m = (e == null ? void 0 : e.id) ?? "", C = pt(m, b), k = vt(t ?? void 0), D = bt(), O = yt(), E = Fe(!1), [R, y] = u(!1), [M, V] = u(!1), [N, p] = u(!1), [P, $] = u(!1), [U, Q] = u(!1), [W, re] = u(null), [_, oe] = u(null), F = $e(je("workflow"), m, N), z = Be("workflow", m, o && b), ne = Je("workflow"), le = Ke("workflow"), [ke, G] = u(null), [te, de] = u(null), [ie, ce] = u(
916
+ } = s, v = nn(t ?? void 0), b = (e == null ? void 0 : e.kind) === "workflow", m = (e == null ? void 0 : e.id) ?? "", C = vt(m, b), k = bt(t ?? void 0), D = yt(), O = kt(), E = Be(!1), [R, y] = u(!1), [M, Q] = u(!1), [N, p] = u(!1), [P, B] = u(!1), [U, W] = u(!1), [F, oe] = u(null), [_, le] = u(null), H = Ke(We("workflow"), m, N), z = qe("workflow", m, o && b), te = Ue("workflow"), de = _e("workflow"), [ke, G] = u(null), [ie, ce] = u(null), [se, ue] = u(
917
917
  null
918
918
  );
919
919
  if (!e || e.kind !== "workflow")
920
920
  return /* @__PURE__ */ n("p", { className: "muted small", children: "Open a workflow to see its settings." });
921
- const I = (se = v.data) == null ? void 0 : se.find((f) => f.id === e.id), ue = I && typeof I.displayName == "string" ? I.displayName : "", H = (I == null ? void 0 : I.tags) ?? [], Y = (I == null ? void 0 : I.status) === "archived";
921
+ const T = (ae = v.data) == null ? void 0 : ae.find((f) => f.id === e.id), he = T && typeof T.displayName == "string" ? T.displayName : "", $ = (T == null ? void 0 : T.tags) ?? [], Y = (T == null ? void 0 : T.status) === "archived";
922
922
  async function Z() {
923
923
  if (!E.current) {
924
- E.current = !0, re(null);
924
+ E.current = !0, oe(null);
925
925
  try {
926
- Y || await D.mutateAsync(m), await O.mutateAsync(m), $(!1), i({ type: "list" });
926
+ Y || await D.mutateAsync(m), await O.mutateAsync(m), B(!1), i({ type: "list" });
927
927
  } catch (f) {
928
- $(!1), re(f instanceof L ? f.message : String(f));
928
+ B(!1), oe(f instanceof L ? f.message : String(f));
929
929
  } finally {
930
930
  E.current = !1;
931
931
  }
932
932
  }
933
933
  }
934
- function he() {
935
- oe(null), D.mutate(m, {
934
+ function fe() {
935
+ le(null), D.mutate(m, {
936
936
  onSuccess: () => {
937
- Q(!1), i({ type: "list" });
937
+ W(!1), i({ type: "list" });
938
938
  },
939
939
  onError: (f) => {
940
- Q(!1), oe(f instanceof L ? f.message : String(f));
940
+ W(!1), le(f instanceof L ? f.message : String(f));
941
941
  }
942
942
  });
943
943
  }
944
944
  return /* @__PURE__ */ r("div", { className: "rail-settings-panel", children: [
945
- /* @__PURE__ */ n(ln, { onEdit: () => l(!0) }),
945
+ /* @__PURE__ */ n(un, { onEdit: () => l(!0) }),
946
946
  e.authoringSettings && e.onAuthoringSettingChange && /* @__PURE__ */ r("section", { className: "w6w-stack", "data-testid": "rail-workflow-authoring", children: [
947
947
  /* @__PURE__ */ r("label", { children: [
948
948
  /* @__PURE__ */ n(
@@ -974,27 +974,27 @@ function Zt({
974
974
  ] })
975
975
  ] }),
976
976
  /* @__PURE__ */ n(
977
- dn,
977
+ hn,
978
978
  {
979
979
  id: e.id,
980
- displayName: ue,
981
- fields: Ve("workflow"),
982
- row: I,
983
- tags: H
980
+ displayName: he,
981
+ fields: Fe("workflow"),
982
+ row: T,
983
+ tags: $
984
984
  }
985
985
  ),
986
- /* @__PURE__ */ n(cn, { onOpen: () => y(!0) }),
986
+ /* @__PURE__ */ n(fn, { onOpen: () => y(!0) }),
987
987
  /* @__PURE__ */ n(
988
- hn,
988
+ gn,
989
989
  {
990
990
  definitionStatus: e.definitionStatus,
991
991
  publishDisabled: e.publishDisabled,
992
992
  open: o,
993
993
  versions: z.data,
994
- publishing: ne.isPending,
995
- togglingEnabled: le.isPending,
994
+ publishing: te.isPending,
995
+ togglingEnabled: de.isPending,
996
996
  publishError: ke,
997
- enableError: te,
997
+ enableError: ie,
998
998
  onShow: () => {
999
999
  c(!0), d(!0);
1000
1000
  },
@@ -1003,45 +1003,45 @@ function Zt({
1003
1003
  e.onPublish();
1004
1004
  return;
1005
1005
  }
1006
- G(null), ne.mutate(m, {
1006
+ G(null), te.mutate(m, {
1007
1007
  onError: (f) => G(f instanceof L ? f.message : String(f))
1008
1008
  });
1009
1009
  },
1010
1010
  onToggleEnabled: () => {
1011
1011
  var f;
1012
- de(null), le.mutate(
1012
+ ce(null), de.mutate(
1013
1013
  { id: m, enabled: !((f = z.data) != null && f.enabled) },
1014
- { onError: (A) => de(A instanceof L ? A.message : String(A)) }
1014
+ { onError: (A) => ce(A instanceof L ? A.message : String(A)) }
1015
1015
  );
1016
1016
  }
1017
1017
  }
1018
1018
  ),
1019
1019
  h && /* @__PURE__ */ n(
1020
- fn,
1020
+ pn,
1021
1021
  {
1022
1022
  loading: z.isLoading,
1023
- versions: (fe = z.data) == null ? void 0 : fe.versions,
1024
- onSelect: (f) => ce({ id: m, versionNumber: f }),
1023
+ versions: (me = z.data) == null ? void 0 : me.versions,
1024
+ onSelect: (f) => ue({ id: m, versionNumber: f }),
1025
1025
  onClose: () => d(!1)
1026
1026
  }
1027
1027
  ),
1028
- ie && ie.id === m && /* @__PURE__ */ n(
1029
- on,
1028
+ se && se.id === m && /* @__PURE__ */ n(
1029
+ cn,
1030
1030
  {
1031
1031
  kind: "workflow",
1032
1032
  id: m,
1033
1033
  onRestore: e.onRestoreVersion,
1034
- versionNumber: ie.versionNumber,
1035
- onClose: () => ce(null)
1034
+ versionNumber: se.versionNumber,
1035
+ onClose: () => ue(null)
1036
1036
  }
1037
1037
  ),
1038
1038
  R && /* @__PURE__ */ r(
1039
- un,
1039
+ mn,
1040
1040
  {
1041
1041
  kind: "workflow",
1042
1042
  onClose: () => y(!1),
1043
1043
  onImport: () => {
1044
- y(!1), V(!0);
1044
+ y(!1), Q(!0);
1045
1045
  },
1046
1046
  children: [
1047
1047
  /* @__PURE__ */ n("p", { className: "muted small", children: "Export a portable definition — the same shape Import accepts." }),
@@ -1061,10 +1061,10 @@ function Zt({
1061
1061
  }
1062
1062
  ),
1063
1063
  N && /* @__PURE__ */ r(K, { title: "Export spec document", onClose: () => p(!1), wide: !0, children: [
1064
- /* @__PURE__ */ n("div", { className: "modal-body", children: F.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : F.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-spec-error", children: F.error instanceof Error ? F.error.message : String(F.error) }) : F.data ? /* @__PURE__ */ n("div", { "data-testid": "rail-spec-json", children: /* @__PURE__ */ n(
1064
+ /* @__PURE__ */ n("div", { className: "modal-body", children: H.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : H.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-spec-error", children: H.error instanceof Error ? H.error.message : String(H.error) }) : H.data ? /* @__PURE__ */ n("div", { "data-testid": "rail-spec-json", children: /* @__PURE__ */ n(
1065
1065
  pe,
1066
1066
  {
1067
- code: JSON.stringify(F.data, null, 2),
1067
+ code: JSON.stringify(H.data, null, 2),
1068
1068
  language: "json",
1069
1069
  maxHeight: "420px",
1070
1070
  copyable: !0
@@ -1072,27 +1072,27 @@ function Zt({
1072
1072
  ) }) : null }),
1073
1073
  /* @__PURE__ */ n("div", { className: "modal-actions", children: /* @__PURE__ */ n("button", { type: "button", className: "btn ghost", onClick: () => p(!1), children: "Close" }) })
1074
1074
  ] }),
1075
- a && I && /* @__PURE__ */ n(
1076
- rn,
1075
+ a && T && /* @__PURE__ */ n(
1076
+ dn,
1077
1077
  {
1078
1078
  kind: "workflow",
1079
1079
  id: m,
1080
1080
  initial: {
1081
- displayName: ue,
1082
- key: I.key ?? null,
1083
- tags: H
1081
+ displayName: he,
1082
+ key: T.key ?? null,
1083
+ tags: $
1084
1084
  },
1085
1085
  onSave: async (f) => {
1086
1086
  if (!C.data) throw new Error("Unable to save settings");
1087
1087
  const A = C.data;
1088
- return new Promise((me, ae) => {
1088
+ return new Promise((ge, re) => {
1089
1089
  const X = {
1090
1090
  ...A.workflow,
1091
1091
  displayName: f.displayName
1092
1092
  };
1093
1093
  f.key !== void 0 && (X.key = f.key), f.tags !== void 0 && (X.tags = f.tags), k.mutate(
1094
1094
  { definition: X, ifUnmodifiedSince: A.updatedAt },
1095
- { onSuccess: () => me(), onError: ae }
1095
+ { onSuccess: () => ge(), onError: re }
1096
1096
  );
1097
1097
  });
1098
1098
  },
@@ -1101,37 +1101,37 @@ function Zt({
1101
1101
  m
1102
1102
  ),
1103
1103
  /* @__PURE__ */ n(
1104
- mn,
1104
+ vn,
1105
1105
  {
1106
1106
  kind: "workflow",
1107
1107
  archived: Y,
1108
1108
  pending: D.isPending || O.isPending,
1109
1109
  deleteConfirming: P,
1110
1110
  archiveConfirming: U,
1111
- deleteError: W,
1111
+ deleteError: F,
1112
1112
  archiveError: _,
1113
- onRequestDelete: () => $(!0),
1114
- onRequestArchive: () => Q(!0),
1113
+ onRequestDelete: () => B(!0),
1114
+ onRequestArchive: () => W(!0),
1115
1115
  onConfirmDelete: Z,
1116
- onConfirmArchive: he,
1117
- onCloseDelete: () => $(!1),
1118
- onCloseArchive: () => Q(!1)
1116
+ onConfirmArchive: fe,
1117
+ onCloseDelete: () => B(!1),
1118
+ onCloseArchive: () => W(!1)
1119
1119
  }
1120
1120
  ),
1121
1121
  M && /* @__PURE__ */ n(
1122
- xe,
1122
+ tn,
1123
1123
  {
1124
1124
  kind: "workflow",
1125
1125
  project: t ?? void 0,
1126
- listKeys: gn,
1126
+ listKeys: bn,
1127
1127
  onOpenImported: (f, A) => i({ type: "imported", kind: f, id: A }),
1128
- onClose: () => V(!1)
1128
+ onClose: () => Q(!1)
1129
1129
  }
1130
1130
  )
1131
1131
  ] });
1132
1132
  }
1133
- function Xt({ ctx: e }) {
1134
- const { project: t, onNavigate: i } = sn(), [s, a] = u(!1), [l, o] = u(!1), [c, h] = u(!1), d = {
1133
+ function xt({ ctx: e }) {
1134
+ const { project: t, onNavigate: i } = on(), [s, a] = u(!1), [l, o] = u(!1), [c, h] = u(!1), d = {
1135
1135
  editingSettings: s,
1136
1136
  setEditingSettings: a,
1137
1137
  historyOpen: l,
@@ -1139,15 +1139,15 @@ function Xt({ ctx: e }) {
1139
1139
  versionListOpen: c,
1140
1140
  setVersionListOpen: h
1141
1141
  };
1142
- return (e == null ? void 0 : e.kind) === "workflow" ? /* @__PURE__ */ n(Zt, { ctx: e, project: t, onNavigate: i, open: d }) : /* @__PURE__ */ n(xt, { ctx: e, project: t, onNavigate: i, open: d });
1142
+ return (e == null ? void 0 : e.kind) === "workflow" ? /* @__PURE__ */ n(Xt, { ctx: e, project: t, onNavigate: i, open: d }) : /* @__PURE__ */ n(ei, { ctx: e, project: t, onNavigate: i, open: d });
1143
1143
  }
1144
- function xt({
1144
+ function ei({
1145
1145
  ctx: e,
1146
1146
  project: t,
1147
1147
  onNavigate: i,
1148
1148
  open: s
1149
1149
  }) {
1150
- var Ee, Ae, Pe;
1150
+ var Pe, Te, Ie;
1151
1151
  const {
1152
1152
  editingSettings: a,
1153
1153
  setEditingSettings: l,
@@ -1155,115 +1155,115 @@ function xt({
1155
1155
  setHistoryOpen: c,
1156
1156
  versionListOpen: h,
1157
1157
  setVersionListOpen: d
1158
- } = s, v = e == null ? void 0 : e.kind, b = ut(v === "endpoint"), m = Ze(v === "function"), [C, k] = u(!1), [D, O] = u(""), [E, R] = u(null), [y, M] = u(null), [V, N] = u(!1), [p, P] = u(!1), [$, U] = u(!1), [Q, W] = u(!1), [re, _] = u(!1), [oe, F] = u(null), [z, ne] = u(null), le = _e((e == null ? void 0 : e.id) ?? "", (e == null ? void 0 : e.kind) === "function"), ke = ze((e == null ? void 0 : e.id) ?? "", (e == null ? void 0 : e.kind) === "endpoint"), G = Ge(), te = Ye(), de = ht(), ie = ft(), ce = mt(), I = gt(), ue = e ? je(e.kind) : null, H = $e(ue, (e == null ? void 0 : e.id) ?? "", p), Y = e && De(e.kind) ? e.kind : null, Z = Be(Y, (e == null ? void 0 : e.id) ?? "", o), he = Je(Y ?? "function"), se = Ke(Y ?? "function"), [fe, f] = u(null), [A, me] = u(null), [ae, X] = u(
1158
+ } = s, v = e == null ? void 0 : e.kind, b = ht(v === "endpoint"), m = en(v === "function"), [C, k] = u(!1), [D, O] = u(""), [E, R] = u(null), [y, M] = u(null), [Q, N] = u(!1), [p, P] = u(!1), [B, U] = u(!1), [W, F] = u(!1), [oe, _] = u(!1), [le, H] = u(null), [z, te] = u(null), de = Ye((e == null ? void 0 : e.id) ?? "", (e == null ? void 0 : e.kind) === "function"), ke = Ze((e == null ? void 0 : e.id) ?? "", (e == null ? void 0 : e.kind) === "endpoint"), G = Xe(), ie = xe(), ce = ft(), se = mt(), ue = gt(), T = pt(), he = e ? We(e.kind) : null, $ = Ke(he, (e == null ? void 0 : e.id) ?? "", p), Y = e && Me(e.kind) ? e.kind : null, Z = qe(Y, (e == null ? void 0 : e.id) ?? "", o), fe = Ue(Y ?? "function"), ae = _e(Y ?? "function"), [me, f] = u(null), [A, ge] = u(null), [re, X] = u(
1159
1159
  null
1160
1160
  );
1161
1161
  if (!e || e.kind !== "function" && e.kind !== "endpoint")
1162
1162
  return /* @__PURE__ */ n("p", { className: "muted small", children: "Open a workflow, function, or endpoint to see its settings." });
1163
- const S = e.kind, T = e.id, B = S === "function" ? (Ee = m.data) == null ? void 0 : Ee.find((g) => g.id === T) : (Ae = b.data) == null ? void 0 : Ae.find((g) => g.id === T), J = Ue(S, S === "function" ? le.data : ke.data), x = (J == null ? void 0 : J.definition) ?? null, Se = B && typeof B.displayName == "string" ? B.displayName : "", pn = x ? JSON.stringify(x, null, 2) : "";
1164
- function vn() {
1165
- R(null), O(pn), M((J == null ? void 0 : J.updatedAt) ?? null), k(!0);
1163
+ const S = e.kind, I = e.id, j = S === "function" ? (Pe = m.data) == null ? void 0 : Pe.find((g) => g.id === I) : (Te = b.data) == null ? void 0 : Te.find((g) => g.id === I), J = Ge(S, S === "function" ? de.data : ke.data), x = (J == null ? void 0 : J.definition) ?? null, Ee = j && typeof j.displayName == "string" ? j.displayName : "", yn = x ? JSON.stringify(x, null, 2) : "";
1164
+ function kn() {
1165
+ R(null), O(yn), M((J == null ? void 0 : J.updatedAt) ?? null), k(!0);
1166
1166
  }
1167
- const ee = x ? En(D, { id: String(x.id), key: String(x.key) }) : { parsed: null, blockedReason: "No definition loaded yet." }, Ce = S === "function" ? G.isPending : te.isPending;
1168
- function bn() {
1167
+ const ee = x ? An(D, { id: String(x.id), key: String(x.key) }) : { parsed: null, blockedReason: "No definition loaded yet." }, Ae = S === "function" ? G.isPending : ie.isPending;
1168
+ function wn() {
1169
1169
  if (!ee.parsed || ee.blockedReason) return;
1170
1170
  R(null);
1171
1171
  const g = {
1172
1172
  onSuccess: () => k(!1),
1173
- onError: (ge) => R(ge instanceof L ? ge.message : String(ge))
1173
+ onError: (ne) => R(ne instanceof L ? ne.message : String(ne))
1174
1174
  }, w = { definition: ee.parsed, ifUnmodifiedSince: y };
1175
- S === "function" ? G.mutate(w, g) : te.mutate(w, g);
1175
+ S === "function" ? G.mutate(w, g) : ie.mutate(w, g);
1176
1176
  }
1177
- const yn = (B == null ? void 0 : B.archivedAt) != null;
1178
- function kn() {
1179
- F(null);
1177
+ const Nn = (j == null ? void 0 : j.archivedAt) != null;
1178
+ function Sn() {
1179
+ H(null);
1180
1180
  const g = {
1181
1181
  onSuccess: () => {
1182
- W(!1), i({ type: "list" });
1182
+ F(!1), i({ type: "list" });
1183
1183
  },
1184
1184
  onError: (w) => {
1185
- W(!1), F(w instanceof L ? w.message : String(w));
1185
+ F(!1), H(w instanceof L ? w.message : String(w));
1186
1186
  }
1187
1187
  };
1188
- S === "function" ? de.mutate(T, g) : ie.mutate(T, g);
1188
+ S === "function" ? ce.mutate(I, g) : se.mutate(I, g);
1189
1189
  }
1190
- function wn() {
1191
- ne(null);
1190
+ function Cn() {
1191
+ te(null);
1192
1192
  const g = {
1193
1193
  onSuccess: () => {
1194
1194
  _(!1), i({ type: "list" });
1195
1195
  },
1196
1196
  onError: (w) => {
1197
- _(!1), ne(w instanceof L ? w.message : String(w));
1197
+ _(!1), te(w instanceof L ? w.message : String(w));
1198
1198
  }
1199
1199
  };
1200
- S === "function" ? ce.mutate(T, g) : I.mutate(T, g);
1200
+ S === "function" ? ue.mutate(I, g) : T.mutate(I, g);
1201
1201
  }
1202
1202
  return /* @__PURE__ */ r("div", { className: "rail-settings-panel", children: [
1203
- /* @__PURE__ */ n(ln, { onEdit: () => l(!0) }),
1203
+ /* @__PURE__ */ n(un, { onEdit: () => l(!0) }),
1204
1204
  /* @__PURE__ */ n(
1205
- dn,
1205
+ hn,
1206
1206
  {
1207
- id: T,
1208
- displayName: Se,
1209
- fields: Ve(S),
1210
- row: B
1207
+ id: I,
1208
+ displayName: Ee,
1209
+ fields: Fe(S),
1210
+ row: j
1211
1211
  }
1212
1212
  ),
1213
- Oe(S) && /* @__PURE__ */ n(cn, { onOpen: () => N(!0) }),
1214
- De(S) && /* @__PURE__ */ n(
1215
- hn,
1213
+ Le(S) && /* @__PURE__ */ n(fn, { onOpen: () => N(!0) }),
1214
+ Me(S) && /* @__PURE__ */ n(
1215
+ gn,
1216
1216
  {
1217
1217
  open: o,
1218
1218
  versions: Z.data,
1219
- publishing: he.isPending,
1220
- togglingEnabled: se.isPending,
1221
- publishError: fe,
1219
+ publishing: fe.isPending,
1220
+ togglingEnabled: ae.isPending,
1221
+ publishError: me,
1222
1222
  enableError: A,
1223
1223
  onShow: () => {
1224
1224
  c(!0), d(!0);
1225
1225
  },
1226
1226
  onPublish: () => {
1227
- f(null), he.mutate(T, {
1227
+ f(null), fe.mutate(I, {
1228
1228
  onError: (g) => f(g instanceof L ? g.message : String(g))
1229
1229
  });
1230
1230
  },
1231
1231
  onToggleEnabled: () => {
1232
1232
  var g;
1233
- me(null), se.mutate(
1234
- { id: T, enabled: !((g = Z.data) != null && g.enabled) },
1235
- { onError: (w) => me(w instanceof L ? w.message : String(w)) }
1233
+ ge(null), ae.mutate(
1234
+ { id: I, enabled: !((g = Z.data) != null && g.enabled) },
1235
+ { onError: (w) => ge(w instanceof L ? w.message : String(w)) }
1236
1236
  );
1237
1237
  }
1238
1238
  }
1239
1239
  ),
1240
1240
  h && /* @__PURE__ */ n(
1241
- fn,
1241
+ pn,
1242
1242
  {
1243
1243
  loading: Z.isLoading,
1244
- versions: (Pe = Z.data) == null ? void 0 : Pe.versions,
1245
- onSelect: (g) => X({ id: T, versionNumber: g }),
1244
+ versions: (Ie = Z.data) == null ? void 0 : Ie.versions,
1245
+ onSelect: (g) => X({ id: I, versionNumber: g }),
1246
1246
  onClose: () => d(!1)
1247
1247
  }
1248
1248
  ),
1249
- ae && ae.id === T && /* @__PURE__ */ n(
1250
- on,
1249
+ re && re.id === I && /* @__PURE__ */ n(
1250
+ cn,
1251
1251
  {
1252
1252
  kind: S,
1253
- id: T,
1254
- versionNumber: ae.versionNumber,
1253
+ id: I,
1254
+ versionNumber: re.versionNumber,
1255
1255
  onClose: () => X(null)
1256
1256
  }
1257
1257
  ),
1258
- V && /* @__PURE__ */ n(
1259
- un,
1258
+ Q && /* @__PURE__ */ n(
1259
+ mn,
1260
1260
  {
1261
1261
  kind: S,
1262
1262
  onClose: () => N(!1),
1263
1263
  onImport: () => {
1264
1264
  N(!1), U(!0);
1265
1265
  },
1266
- children: Oe(S) && /* @__PURE__ */ r(j, { children: [
1266
+ children: Le(S) && /* @__PURE__ */ r(V, { children: [
1267
1267
  /* @__PURE__ */ n("p", { className: "muted small", children: "Export a portable definition — the same shape Import accepts — or Edit JSON to change what's stored directly." }),
1268
1268
  /* @__PURE__ */ r("div", { className: "rail-spec-menu-row", children: [
1269
1269
  /* @__PURE__ */ n(
@@ -1287,7 +1287,7 @@ function xt({
1287
1287
  disabled: !x,
1288
1288
  "data-testid": "rail-json-edit",
1289
1289
  onClick: () => {
1290
- N(!1), vn();
1290
+ N(!1), kn();
1291
1291
  },
1292
1292
  children: "Edit JSON"
1293
1293
  }
@@ -1297,10 +1297,10 @@ function xt({
1297
1297
  }
1298
1298
  ),
1299
1299
  p && /* @__PURE__ */ r(K, { title: "Export spec document", onClose: () => P(!1), wide: !0, children: [
1300
- /* @__PURE__ */ n("div", { className: "modal-body", children: H.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : H.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-spec-error", children: H.error instanceof Error ? H.error.message : String(H.error) }) : H.data ? /* @__PURE__ */ n("div", { "data-testid": "rail-spec-json", children: /* @__PURE__ */ n(
1300
+ /* @__PURE__ */ n("div", { className: "modal-body", children: $.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : $.isError ? /* @__PURE__ */ n("div", { className: "error", "data-testid": "rail-spec-error", children: $.error instanceof Error ? $.error.message : String($.error) }) : $.data ? /* @__PURE__ */ n("div", { "data-testid": "rail-spec-json", children: /* @__PURE__ */ n(
1301
1301
  pe,
1302
1302
  {
1303
- code: JSON.stringify(H.data, null, 2),
1303
+ code: JSON.stringify($.data, null, 2),
1304
1304
  language: "json",
1305
1305
  maxHeight: "420px",
1306
1306
  copyable: !0
@@ -1311,7 +1311,7 @@ function xt({
1311
1311
  C && /* @__PURE__ */ r(K, { title: "Edit definition", onClose: () => k(!1), wide: !0, children: [
1312
1312
  /* @__PURE__ */ r("div", { className: "modal-body", children: [
1313
1313
  /* @__PURE__ */ n(
1314
- Rn,
1314
+ Mn,
1315
1315
  {
1316
1316
  value: D,
1317
1317
  onChange: O,
@@ -1329,85 +1329,85 @@ function xt({
1329
1329
  {
1330
1330
  type: "button",
1331
1331
  className: "btn",
1332
- disabled: ee.blockedReason !== null || Ce,
1332
+ disabled: ee.blockedReason !== null || Ae,
1333
1333
  "data-testid": "rail-json-save",
1334
- onClick: bn,
1335
- children: Ce ? "Saving…" : "Save"
1334
+ onClick: wn,
1335
+ children: Ae ? "Saving…" : "Save"
1336
1336
  }
1337
1337
  )
1338
1338
  ] })
1339
1339
  ] }),
1340
- a && B && /* @__PURE__ */ n(
1341
- rn,
1340
+ a && j && /* @__PURE__ */ n(
1341
+ dn,
1342
1342
  {
1343
1343
  kind: S,
1344
- id: T,
1344
+ id: I,
1345
1345
  initial: {
1346
- displayName: Se,
1347
- key: B.key ?? null,
1348
- tags: []
1346
+ displayName: Ee,
1347
+ key: j.key ?? null,
1348
+ tags: j.tags ?? []
1349
1349
  },
1350
1350
  onSave: async (g) => {
1351
1351
  if (!J) throw new Error("Unable to save settings");
1352
- const w = J.definition, Ie = { definition: S === "function" ? (
1352
+ const w = J.definition, ne = j.tags ?? [], De = g.tags !== void 0 && (g.tags.length !== ne.length || g.tags.some((we, Ne) => we !== ne[Ne])) ? { tags: g.tags } : {}, Oe = { definition: S === "function" ? (
1353
1353
  // `canEditKey: true` for function (`callable-descriptors.ts`): `data.key` must
1354
1354
  // reach the server (the modal falls back to `initial.key` when unchanged).
1355
- { ...w, displayName: g.displayName, key: g.key ?? w.key }
1356
- ) : { ...w, displayName: g.displayName }, ifUnmodifiedSince: J.updatedAt };
1357
- return new Promise((Nn, Sn) => {
1358
- const Te = { onSuccess: () => Nn(), onError: Sn };
1359
- S === "function" ? G.mutate(Ie, Te) : te.mutate(Ie, Te);
1355
+ { ...w, displayName: g.displayName, key: g.key ?? w.key, ...De }
1356
+ ) : { ...w, displayName: g.displayName, ...De }, ifUnmodifiedSince: J.updatedAt };
1357
+ return new Promise((we, Ne) => {
1358
+ const Re = { onSuccess: () => we(), onError: Ne };
1359
+ S === "function" ? G.mutate(Oe, Re) : ie.mutate(Oe, Re);
1360
1360
  });
1361
1361
  },
1362
1362
  onClose: () => l(!1)
1363
1363
  },
1364
- T
1364
+ I
1365
1365
  ),
1366
- An(S) && /* @__PURE__ */ n(
1367
- mn,
1366
+ Pn(S) && /* @__PURE__ */ n(
1367
+ vn,
1368
1368
  {
1369
1369
  kind: S,
1370
- archived: yn,
1371
- deleteConfirming: Q,
1372
- archiveConfirming: re,
1373
- deleteError: oe,
1370
+ archived: Nn,
1371
+ deleteConfirming: W,
1372
+ archiveConfirming: oe,
1373
+ deleteError: le,
1374
1374
  archiveError: z,
1375
- onRequestDelete: () => W(!0),
1375
+ onRequestDelete: () => F(!0),
1376
1376
  onRequestArchive: () => _(!0),
1377
- onConfirmDelete: kn,
1378
- onConfirmArchive: wn,
1379
- onCloseDelete: () => W(!1),
1377
+ onConfirmDelete: Sn,
1378
+ onConfirmArchive: Cn,
1379
+ onCloseDelete: () => F(!1),
1380
1380
  onCloseArchive: () => _(!1)
1381
1381
  }
1382
1382
  ),
1383
- $ && /* @__PURE__ */ n(
1384
- xe,
1383
+ B && /* @__PURE__ */ n(
1384
+ tn,
1385
1385
  {
1386
1386
  kind: S,
1387
1387
  project: t ?? void 0,
1388
- listKeys: gn,
1388
+ listKeys: bn,
1389
1389
  onOpenImported: (g, w) => i({ type: "imported", kind: g, id: w }),
1390
1390
  onClose: () => U(!1)
1391
1391
  }
1392
1392
  )
1393
1393
  ] });
1394
1394
  }
1395
- function ei() {
1395
+ function ni() {
1396
1396
  return /* @__PURE__ */ n(q, { name: "settings" });
1397
1397
  }
1398
- const ni = {
1398
+ const ti = {
1399
1399
  id: "settings",
1400
1400
  title: "Settings",
1401
1401
  rendersHeading: !0,
1402
- Icon: ei,
1402
+ Icon: ni,
1403
1403
  isAvailable: (e) => (e == null ? void 0 : e.kind) === "workflow" || (e == null ? void 0 : e.kind) === "function" || (e == null ? void 0 : e.kind) === "endpoint",
1404
- Panel: Xt
1405
- }, ti = ["string", "number", "boolean", "object", "array"];
1406
- function ii({
1404
+ Panel: xt
1405
+ }, ii = ["string", "number", "boolean", "object", "array"];
1406
+ function si({
1407
1407
  variables: e,
1408
1408
  onVariablesChange: t
1409
1409
  }) {
1410
- const i = Mn().vars ?? [];
1410
+ const i = Ln().vars ?? [];
1411
1411
  function s() {
1412
1412
  t([...e, { key: "" }]);
1413
1413
  }
@@ -1417,7 +1417,7 @@ function ii({
1417
1417
  function l(c) {
1418
1418
  t(e.filter((h, d) => d !== c));
1419
1419
  }
1420
- const o = Hn(e);
1420
+ const o = $n(e);
1421
1421
  return /* @__PURE__ */ r("div", { className: "workflow-variable-fields", children: [
1422
1422
  /* @__PURE__ */ r("p", { className: "muted small", children: [
1423
1423
  "Declaring variables here defines this workflow's ",
@@ -1464,7 +1464,7 @@ function ii({
1464
1464
  }),
1465
1465
  children: [
1466
1466
  /* @__PURE__ */ n("option", { value: "", children: "(unset)" }),
1467
- ti.map((d) => /* @__PURE__ */ n("option", { value: d, children: d }, d))
1467
+ ii.map((d) => /* @__PURE__ */ n("option", { value: d, children: d }, d))
1468
1468
  ]
1469
1469
  }
1470
1470
  ),
@@ -1480,7 +1480,7 @@ function ii({
1480
1480
  /* @__PURE__ */ n("span", { className: "muted small", children: "required" })
1481
1481
  ] }),
1482
1482
  /* @__PURE__ */ n(
1483
- we,
1483
+ Se,
1484
1484
  {
1485
1485
  danger: !0,
1486
1486
  icon: "close",
@@ -1492,11 +1492,11 @@ function ii({
1492
1492
  /* @__PURE__ */ r("div", { className: "workflow-variable-default", children: [
1493
1493
  /* @__PURE__ */ n("span", { className: "muted small", children: "Default" }),
1494
1494
  /* @__PURE__ */ n(
1495
- He,
1495
+ Je,
1496
1496
  {
1497
- value: { vars: $n(e, h, i) },
1497
+ value: { vars: Bn(e, h, i) },
1498
1498
  children: /* @__PURE__ */ n(
1499
- Ln,
1499
+ jn,
1500
1500
  {
1501
1501
  value: c.default,
1502
1502
  onChange: (d) => a(h, { default: d }),
@@ -1515,20 +1515,20 @@ function ii({
1515
1515
  )) })
1516
1516
  ] });
1517
1517
  }
1518
- function Ne(e) {
1518
+ function Ce(e) {
1519
1519
  return e !== null && typeof e == "object" && !Array.isArray(e);
1520
1520
  }
1521
- function si(e, t) {
1522
- if (Ne(e)) return e;
1523
- if (t && t.length > 0) return Pt(t);
1521
+ function ai(e, t) {
1522
+ if (Ce(e)) return e;
1523
+ if (t && t.length > 0) return Tt(t);
1524
1524
  }
1525
- function ai(e) {
1525
+ function ri(e) {
1526
1526
  const t = /* @__PURE__ */ new Map(), i = [...e].sort((s, a) => s.seq - a.seq);
1527
1527
  for (const s of i) {
1528
1528
  if (s.warning !== void 0 || !Array.isArray(s.path)) continue;
1529
1529
  const a = s.nodeId ?? null, l = s.new !== void 0 && s.new !== null;
1530
1530
  if (s.path.length === 0) {
1531
- if (t.clear(), l && Ne(s.new)) for (const c of Object.keys(s.new)) t.set(c, a);
1531
+ if (t.clear(), l && Ce(s.new)) for (const c of Object.keys(s.new)) t.set(c, a);
1532
1532
  continue;
1533
1533
  }
1534
1534
  const o = s.path[0];
@@ -1536,14 +1536,14 @@ function ai(e) {
1536
1536
  }
1537
1537
  return t;
1538
1538
  }
1539
- const ri = /\{\{[\s\S]*?\}\}/;
1540
- function oi(e) {
1539
+ const oi = /\{\{[\s\S]*?\}\}/;
1540
+ function li(e) {
1541
1541
  const t = [], i = (s, a) => {
1542
- if (Ne(s) && Object.keys(s).length > 0) {
1542
+ if (Ce(s) && Object.keys(s).length > 0) {
1543
1543
  for (const [l, o] of Object.entries(s)) i(o, a ? `${a}.${l}` : l);
1544
1544
  return;
1545
1545
  }
1546
- if (typeof s == "string" && ri.test(s)) {
1546
+ if (typeof s == "string" && oi.test(s)) {
1547
1547
  t.push({ path: a, kind: "reference", text: s });
1548
1548
  return;
1549
1549
  }
@@ -1552,21 +1552,21 @@ function oi(e) {
1552
1552
  if (e) for (const [s, a] of Object.entries(e)) i(a, s);
1553
1553
  return t;
1554
1554
  }
1555
- function li(e) {
1555
+ function di(e) {
1556
1556
  return (e == null ? void 0 : e.kind) === "workflow" ? e.onOpenStartingState : void 0;
1557
1557
  }
1558
- function di() {
1558
+ function ci() {
1559
1559
  return /* @__PURE__ */ n(q, { name: "database" });
1560
1560
  }
1561
- function ci({ ctx: e }) {
1561
+ function ui({ ctx: e }) {
1562
1562
  var k, D, O, E, R;
1563
- const t = At(), i = wt(e.id), s = (k = i.data) == null ? void 0 : k[0], a = Nt((s == null ? void 0 : s.runId) ?? null), l = ((D = a.data) == null ? void 0 : D.status) ?? (s == null ? void 0 : s.status), o = St((s == null ? void 0 : s.runId) ?? null, l), c = l !== void 0 && !Ct(l), h = Fe(null);
1563
+ const t = Pt(), i = Nt(e.id), s = (k = i.data) == null ? void 0 : k[0], a = St((s == null ? void 0 : s.runId) ?? null), l = ((D = a.data) == null ? void 0 : D.status) ?? (s == null ? void 0 : s.status), o = Ct((s == null ? void 0 : s.runId) ?? null, l), c = l !== void 0 && !Et(l), h = Be(null);
1564
1564
  if (be(() => {
1565
- !c || !s || s.finishedAt !== null || h.current !== s.runId && (h.current = s.runId, t.invalidateQueries({ queryKey: Et(e.id) }));
1565
+ !c || !s || s.finishedAt !== null || h.current !== s.runId && (h.current = s.runId, t.invalidateQueries({ queryKey: At(e.id) }));
1566
1566
  }, [c, s, t, e.id]), i.isLoading) return /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" });
1567
1567
  if (!s)
1568
1568
  return /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-current-empty", children: "No run yet. Run the workflow and the state it ends with shows here." });
1569
- const d = ((O = o.data) == null ? void 0 : O.writes) ?? [], v = (E = a.data) == null ? void 0 : E.state, b = si(v, d), m = ai(d), C = b ? Object.keys(b) : [];
1569
+ const d = ((O = o.data) == null ? void 0 : O.writes) ?? [], v = (E = a.data) == null ? void 0 : E.state, b = ai(v, d), m = ri(d), C = b ? Object.keys(b) : [];
1570
1570
  return /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-state-current", children: [
1571
1571
  /* @__PURE__ */ r("dl", { className: "rail-meta-list", children: [
1572
1572
  /* @__PURE__ */ n("dt", { children: "Run" }),
@@ -1589,13 +1589,13 @@ function ci({ ctx: e }) {
1589
1589
  children: "Open this run"
1590
1590
  }
1591
1591
  ),
1592
- a.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : C.length === 0 || !b ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-current-none", children: "This run has no state." }) : /* @__PURE__ */ r(j, { children: [
1593
- /* @__PURE__ */ n(jn, { value: b }),
1592
+ a.isLoading ? /* @__PURE__ */ n("p", { className: "muted small", children: "Loading…" }) : C.length === 0 || !b ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-current-none", children: "This run has no state." }) : /* @__PURE__ */ r(V, { children: [
1593
+ /* @__PURE__ */ n(Vn, { value: b }),
1594
1594
  /* @__PURE__ */ n("ul", { className: "list", "data-testid": "rail-state-writers", children: C.map((y) => {
1595
1595
  const M = m.get(y);
1596
1596
  return /* @__PURE__ */ n("li", { "data-testid": "rail-state-writer", children: /* @__PURE__ */ r("span", { className: "list-main", children: [
1597
1597
  /* @__PURE__ */ n("code", { children: y }),
1598
- /* @__PURE__ */ n("span", { className: "muted small block", children: M ? /* @__PURE__ */ r(j, { children: [
1598
+ /* @__PURE__ */ n("span", { className: "muted small block", children: M ? /* @__PURE__ */ r(V, { children: [
1599
1599
  "Last written by ",
1600
1600
  /* @__PURE__ */ n("code", { children: M })
1601
1601
  ] }) : m.has(y) ? "From the starting state" : "No step wrote it" })
@@ -1605,8 +1605,8 @@ function ci({ ctx: e }) {
1605
1605
  ] })
1606
1606
  ] });
1607
1607
  }
1608
- function ui({ ctx: e }) {
1609
- const t = oi(e.startingState), i = Bn(e.startingState, e.variables ?? []);
1608
+ function hi({ ctx: e }) {
1609
+ const t = li(e.startingState), i = Jn(e.startingState, e.variables ?? []);
1610
1610
  return /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-state-starting", children: [
1611
1611
  /* @__PURE__ */ n("p", { className: "muted small", children: "Workflow inputs override starting state; starting state overrides project variables with the same name." }),
1612
1612
  i.length > 0 && /* @__PURE__ */ r("p", { className: "muted small", "data-testid": "starting-data-collision", children: [
@@ -1629,7 +1629,7 @@ function ui({ ctx: e }) {
1629
1629
  ),
1630
1630
  t.length === 0 ? /* @__PURE__ */ n("p", { className: "muted small", "data-testid": "rail-state-starting-empty", children: "No starting state. Every run begins with an empty state." }) : /* @__PURE__ */ n("ul", { className: "list", children: t.map((s) => /* @__PURE__ */ n("li", { "data-testid": "rail-state-starting-row", "data-kind": s.kind, children: /* @__PURE__ */ r("span", { className: "list-main", children: [
1631
1631
  /* @__PURE__ */ n("code", { children: s.path }),
1632
- /* @__PURE__ */ n("span", { className: "muted small block", children: s.kind === "reference" ? /* @__PURE__ */ r(j, { children: [
1632
+ /* @__PURE__ */ n("span", { className: "muted small block", children: s.kind === "reference" ? /* @__PURE__ */ r(V, { children: [
1633
1633
  "Reference ",
1634
1634
  /* @__PURE__ */ n("code", { children: s.text }),
1635
1635
  ", resolved when a run starts"
@@ -1637,13 +1637,13 @@ function ui({ ctx: e }) {
1637
1637
  ] }) }, s.path)) })
1638
1638
  ] });
1639
1639
  }
1640
- function hi({ ctx: e }) {
1640
+ function fi({ ctx: e }) {
1641
1641
  return (e == null ? void 0 : e.kind) !== "workflow" || !e.onOpenStartingState ? null : /* @__PURE__ */ r("div", { className: "w6w-stack", "data-testid": "rail-state-body", children: [
1642
1642
  /* @__PURE__ */ n("div", { className: "right-rail-panel-head", children: /* @__PURE__ */ n("h3", { children: "Data" }) }),
1643
1643
  e.onVariablesChange && /* @__PURE__ */ r("section", { "data-testid": "rail-workflow-variables", children: [
1644
1644
  /* @__PURE__ */ n("h4", { children: "Workflow inputs" }),
1645
1645
  /* @__PURE__ */ n(
1646
- ii,
1646
+ si,
1647
1647
  {
1648
1648
  variables: e.variables ?? [],
1649
1649
  onVariablesChange: e.onVariablesChange
@@ -1652,41 +1652,41 @@ function hi({ ctx: e }) {
1652
1652
  ] }),
1653
1653
  /* @__PURE__ */ r("section", { "data-testid": "rail-state-current-section", children: [
1654
1654
  /* @__PURE__ */ n("h4", { children: "Current state" }),
1655
- /* @__PURE__ */ n(ci, { ctx: e })
1655
+ /* @__PURE__ */ n(ui, { ctx: e })
1656
1656
  ] }),
1657
1657
  /* @__PURE__ */ n("hr", {}),
1658
1658
  /* @__PURE__ */ r("section", { "data-testid": "rail-state-starting-section", children: [
1659
1659
  /* @__PURE__ */ n("h4", { children: "Starting state" }),
1660
- /* @__PURE__ */ n(ui, { ctx: e })
1660
+ /* @__PURE__ */ n(hi, { ctx: e })
1661
1661
  ] })
1662
1662
  ] });
1663
1663
  }
1664
- const fi = {
1664
+ const mi = {
1665
1665
  id: "starting-state",
1666
1666
  title: "Data",
1667
1667
  rendersHeading: !0,
1668
- Icon: di,
1669
- isAvailable: (e) => li(e) !== void 0,
1670
- Panel: hi,
1668
+ Icon: ci,
1669
+ isAvailable: (e) => di(e) !== void 0,
1670
+ Panel: fi,
1671
1671
  hasIndicator: (e) => (e == null ? void 0 : e.kind) === "workflow" && e.hasStartingState === !0
1672
- }, Wi = [
1673
- ni,
1674
- Lt,
1675
- Jt,
1676
- fi,
1672
+ }, $i = [
1673
+ ti,
1677
1674
  jt,
1678
- Kt
1675
+ Kt,
1676
+ mi,
1677
+ Vt,
1678
+ qt
1679
1679
  ];
1680
1680
  export {
1681
- Qt as C,
1682
- Vi as P,
1683
- Qi as R,
1684
- Ri as W,
1685
- sn as a,
1686
- ji as b,
1687
- Li as c,
1688
- Mi as d,
1689
- Wi as e,
1681
+ Wt as C,
1682
+ Fi as P,
1683
+ Hi as R,
1684
+ ji as W,
1685
+ on as a,
1686
+ Wi as b,
1687
+ Qi as c,
1688
+ Vi as d,
1689
+ $i as e,
1690
1690
  It as u
1691
1691
  };
1692
- //# sourceMappingURL=editor-tools-Brw0cv2F.js.map
1692
+ //# sourceMappingURL=editor-tools-CVYTsVFN.js.map