@w6w/ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/LICENSE +21 -0
  3. package/README.md +260 -2
  4. package/dist/ActionTestForm.d.ts +76 -0
  5. package/dist/AddConnectionModal.d.ts +24 -0
  6. package/dist/AppPicker.d.ts +83 -0
  7. package/dist/CodeBlock-CZu4TFSi.cjs +15 -0
  8. package/dist/CodeBlock-CZu4TFSi.cjs.map +1 -0
  9. package/dist/CodeBlock-Dot3Pd7P.js +2889 -0
  10. package/dist/CodeBlock-Dot3Pd7P.js.map +1 -0
  11. package/dist/CodeBlock.d.ts +65 -0
  12. package/dist/CodeEditor.d.ts +42 -0
  13. package/dist/ConfirmModal-DJPYXE9t.cjs +11 -0
  14. package/dist/ConfirmModal-DJPYXE9t.cjs.map +1 -0
  15. package/dist/ConfirmModal-sY1tzkBO.js +6335 -0
  16. package/dist/ConfirmModal-sY1tzkBO.js.map +1 -0
  17. package/dist/Copyable-1niV9gUa.js +771 -0
  18. package/dist/Copyable-1niV9gUa.js.map +1 -0
  19. package/dist/Copyable-CYZU1o4X.cjs +2 -0
  20. package/dist/Copyable-CYZU1o4X.cjs.map +1 -0
  21. package/dist/JsonEditor.d.ts +60 -0
  22. package/dist/NodeConfigForm.d.ts +70 -0
  23. package/dist/ParamsForm.d.ts +56 -0
  24. package/dist/PropertyEntryForm.d.ts +56 -0
  25. package/dist/RetryPolicyFields.d.ts +18 -0
  26. package/dist/StepBuilderModal.d.ts +375 -0
  27. package/dist/TriggerFillForm.d.ts +52 -0
  28. package/dist/WaitEditor.d.ts +6 -0
  29. package/dist/WorkflowFlowEditor.d.ts +119 -0
  30. package/dist/YamlEditor.d.ts +46 -0
  31. package/dist/app-categories.d.ts +38 -0
  32. package/dist/app-pages.d.ts +111 -0
  33. package/dist/code.cjs +2 -0
  34. package/dist/code.cjs.map +1 -0
  35. package/dist/code.d.ts +29 -0
  36. package/dist/code.mjs +7 -0
  37. package/dist/code.mjs.map +1 -0
  38. package/dist/components/ApiCallsPanel.d.ts +41 -0
  39. package/dist/components/AppIcon.d.ts +25 -0
  40. package/dist/components/AuthFieldsForm.d.ts +22 -0
  41. package/dist/components/Combobox.d.ts +24 -0
  42. package/dist/components/ConfirmModal.d.ts +33 -0
  43. package/dist/components/Copyable.d.ts +51 -0
  44. package/dist/components/CopyableText.d.ts +40 -0
  45. package/dist/components/DeleteButton.d.ts +16 -0
  46. package/dist/components/EditButton.d.ts +10 -0
  47. package/dist/components/ExecutionDetail.d.ts +70 -0
  48. package/dist/components/ExecutionFilters.d.ts +59 -0
  49. package/dist/components/ExecutionList.d.ts +60 -0
  50. package/dist/components/ExecutionLogPanel.d.ts +98 -0
  51. package/dist/components/ExecutionStats.d.ts +47 -0
  52. package/dist/components/ExpressionEditorModal.d.ts +42 -0
  53. package/dist/components/ExpressionInput.d.ts +36 -0
  54. package/dist/components/ExpressionOptions.d.ts +185 -0
  55. package/dist/components/HealthStatusPill.d.ts +25 -0
  56. package/dist/components/HistoryTimeline.d.ts +56 -0
  57. package/dist/components/Icon.d.ts +34 -0
  58. package/dist/components/IconButton.d.ts +60 -0
  59. package/dist/components/InfoTip.d.ts +15 -0
  60. package/dist/components/InternalIcon.d.ts +19 -0
  61. package/dist/components/ListItem.d.ts +25 -0
  62. package/dist/components/Modal.d.ts +29 -0
  63. package/dist/components/RepoSyncIndicator.d.ts +29 -0
  64. package/dist/components/ResolvedParams.d.ts +31 -0
  65. package/dist/components/ServerResources.d.ts +47 -0
  66. package/dist/components/StepStatusPill.d.ts +51 -0
  67. package/dist/components/UptimeStrip.d.ts +56 -0
  68. package/dist/components/execution-format.d.ts +24 -0
  69. package/dist/components/expression-dom.d.ts +154 -0
  70. package/dist/components/expression-template.d.ts +86 -0
  71. package/dist/components/history-scale.d.ts +33 -0
  72. package/dist/components/icons.d.ts +41 -0
  73. package/dist/components/resolved-clip.d.ts +42 -0
  74. package/dist/components/server-resources-format.d.ts +68 -0
  75. package/dist/components/server-resources.fixture.d.ts +9 -0
  76. package/dist/components/use-copy.d.ts +14 -0
  77. package/dist/createW6WApi.d.ts +31 -0
  78. package/dist/flow-connect.d.ts +138 -0
  79. package/dist/flow-fanout.d.ts +15 -0
  80. package/dist/flow-types.d.ts +356 -0
  81. package/dist/flow-utils.d.ts +284 -0
  82. package/dist/flow.cjs +3 -0
  83. package/dist/flow.cjs.map +1 -0
  84. package/dist/flow.d.ts +22 -0
  85. package/dist/flow.mjs +1977 -0
  86. package/dist/flow.mjs.map +1 -0
  87. package/dist/index.cjs +2 -0
  88. package/dist/index.cjs.map +1 -0
  89. package/dist/index.d.ts +94 -0
  90. package/dist/index.mjs +1811 -0
  91. package/dist/index.mjs.map +1 -0
  92. package/dist/oauth-popup.d.ts +17 -0
  93. package/dist/output-shape.d.ts +58 -0
  94. package/dist/provider.d.ts +420 -0
  95. package/dist/resolve-params.d.ts +112 -0
  96. package/dist/resolved-json.d.ts +21 -0
  97. package/dist/run-visuals.d.ts +90 -0
  98. package/dist/step-preview-state.d.ts +143 -0
  99. package/dist/theme.d.ts +32 -0
  100. package/dist/trigger-fields.d.ts +56 -0
  101. package/dist/types.d.ts +413 -0
  102. package/dist/ui.css +1 -0
  103. package/dist/use-app-action-defs.d.ts +7 -0
  104. package/dist/use-enter-submit.d.ts +23 -0
  105. package/dist/use-seed-sources.d.ts +16 -0
  106. package/package.json +111 -3
  107. package/src/code.css +542 -0
  108. package/src/styles/_buttons.scss +38 -0
  109. package/src/styles/_chips.scss +210 -0
  110. package/src/styles/_code.scss +139 -0
  111. package/src/styles/_copyable.scss +147 -0
  112. package/src/styles/_data-vars.scss +38 -0
  113. package/src/styles/_execution-history.scss +282 -0
  114. package/src/styles/_execution-log.scss +178 -0
  115. package/src/styles/_expression-field.scss +65 -0
  116. package/src/styles/_expression-inline.scss +63 -0
  117. package/src/styles/_expression-modal.scss +292 -0
  118. package/src/styles/_fields.scss +161 -0
  119. package/src/styles/_flow.scss +217 -0
  120. package/src/styles/_fx.scss +158 -0
  121. package/src/styles/_health.scss +46 -0
  122. package/src/styles/_history-timeline.scss +156 -0
  123. package/src/styles/_icon-button.scss +22 -0
  124. package/src/styles/_icon.scss +15 -0
  125. package/src/styles/_icons.scss +31 -0
  126. package/src/styles/_incoming-state.scss +46 -0
  127. package/src/styles/_info-tip.scss +9 -0
  128. package/src/styles/_layout.scss +6 -0
  129. package/src/styles/_lists.scss +64 -0
  130. package/src/styles/_modal.scss +125 -0
  131. package/src/styles/_multiselect.scss +69 -0
  132. package/src/styles/_repo-sync-indicator.scss +99 -0
  133. package/src/styles/_scale.scss +70 -0
  134. package/src/styles/_sections.scss +36 -0
  135. package/src/styles/_server-resources.scss +163 -0
  136. package/src/styles/_step-builder.scss +376 -0
  137. package/src/styles/_step-config.scss +195 -0
  138. package/src/styles/_tabs.scss +54 -0
  139. package/src/styles/_tester.scss +111 -0
  140. package/src/styles/_tokens.scss +141 -0
  141. package/src/styles/_uptime.scss +61 -0
  142. package/src/styles.css +4208 -0
  143. package/src/styles.scss +61 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,1811 @@
1
+ var Tt = Object.defineProperty;
2
+ var At = (e, s, n) => s in e ? Tt(e, s, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[s] = n;
3
+ var V = (e, s, n) => At(e, typeof s != "symbol" ? s + "" : s, n);
4
+ import { j as Et, a0 as Mt, J as z, ab as _t, M as Ve, L as Pt, l as It, am as L } from "./ConfirmModal-sY1tzkBO.js";
5
+ import { aa as en, Q as tn, a9 as sn, an as nn, ao as an, ap as rn, H as ln, a1 as on, a8 as cn, aq as dn, S as un, ar as wn, as as mn, at as hn, au as pn, av as fn, Y as vn, aw as yn, ax as Nn, ay as gn, u as bn } from "./ConfirmModal-sY1tzkBO.js";
6
+ import { jsxs as o, jsx as t, Fragment as k } from "react/jsx-runtime";
7
+ import { useMemo as ye, useState as v, useEffect as G, useId as Ut, useRef as Ft } from "react";
8
+ import { C as ke } from "./CodeBlock-Dot3Pd7P.js";
9
+ import { yaml as Lt } from "@codemirror/lang-yaml";
10
+ import { EditorView as Bt } from "@codemirror/view";
11
+ import Jt from "@uiw/react-codemirror";
12
+ import { u as Dt, a as Ht, b as jt, C as qt, I as ze } from "./Copyable-1niV9gUa.js";
13
+ import { i as xn } from "./Copyable-1niV9gUa.js";
14
+ class ce extends Error {
15
+ constructor(n, l, d, a) {
16
+ super(d);
17
+ V(this, "status");
18
+ V(this, "code");
19
+ /**
20
+ * The parsed error response body, when the server sent one. Carries the
21
+ * fields that ride alongside an error — e.g. an invoke's `logs` and
22
+ * `apiCalls` — which the message alone would drop.
23
+ */
24
+ V(this, "body");
25
+ this.name = "ApiError", this.status = n, this.code = l, this.body = a;
26
+ }
27
+ }
28
+ function _s(e) {
29
+ const s = e.baseUrl.replace(/\/$/, ""), n = e.fetch ?? globalThis.fetch, l = async () => typeof e.token == "function" ? await e.token() : e.token;
30
+ async function d(r, c) {
31
+ const u = new Headers(c == null ? void 0 : c.headers), w = await l();
32
+ w && u.set("authorization", `Bearer ${w}`), c != null && c.body && !u.has("content-type") && u.set("content-type", "application/json");
33
+ let h;
34
+ try {
35
+ h = await n(`${s}${r}`, { ...c, headers: u });
36
+ } catch (N) {
37
+ throw new ce(
38
+ 0,
39
+ "network_error",
40
+ `Could not reach the w6w server (${(c == null ? void 0 : c.method) ?? "GET"} ${s}${r}). It may be down or unreachable. (${N.message})`
41
+ );
42
+ }
43
+ const m = await h.text();
44
+ let p = null;
45
+ if (m)
46
+ try {
47
+ p = JSON.parse(m);
48
+ } catch {
49
+ if (!h.ok)
50
+ throw new ce(
51
+ h.status,
52
+ "bad_response",
53
+ `Server returned a non-JSON ${h.status} response: ${m.slice(0, 200)}`
54
+ );
55
+ }
56
+ if (!h.ok) {
57
+ const N = (p == null ? void 0 : p.error) ?? {};
58
+ throw new ce(h.status, N.code ?? "error", N.message ?? h.statusText, p);
59
+ }
60
+ return { status: h.status, data: p };
61
+ }
62
+ async function a(r, c) {
63
+ const { data: u } = await d(r, c);
64
+ return u;
65
+ }
66
+ return {
67
+ // A bare GET only returns the server's default page (50) — every consumer
68
+ // of this client treats the result as the complete catalog, so page
69
+ // through it here. Capped at 20 pages as a runaway backstop.
70
+ listApps: async () => {
71
+ const r = [];
72
+ let c;
73
+ for (let u = 0; u < 20; u++) {
74
+ const w = new URLSearchParams({ limit: "200" });
75
+ c && w.set("cursor", c);
76
+ const h = await a(`/apps?${w}`);
77
+ if (r.push(...h.apps), !h.nextCursor) break;
78
+ c = h.nextCursor;
79
+ }
80
+ return r;
81
+ },
82
+ // Bounded lookup: dedupe; `[]` sends nothing; chunks of <= 100 (the server's
83
+ // `MAX_IDS_PER_QUERY`), each `GET /apps?ids=a,b` with no limit/cursor.
84
+ listAppsByIds: async (r) => {
85
+ const c = Array.from(new Set(r)), u = [];
86
+ for (let w = 0; w < c.length; w += 100) {
87
+ const m = c.slice(w, w + 100).map(encodeURIComponent).join(","), p = await a(`/apps?ids=${m}`);
88
+ u.push(...p.apps);
89
+ }
90
+ return u;
91
+ },
92
+ getAppAuth: async (r) => (await a(`/apps/${encodeURIComponent(r)}/auths`)).auths ?? [],
93
+ createConnection: (r, c) => a(`/apps/${encodeURIComponent(r)}/connections`, {
94
+ method: "POST",
95
+ body: JSON.stringify(c)
96
+ }).then((u) => u.connection),
97
+ startAppOAuthFlow: (r, c, u) => a(
98
+ `/apps/${encodeURIComponent(r)}/oauth-config/${encodeURIComponent(c)}/authorize-url`,
99
+ { method: "POST", body: JSON.stringify(u) }
100
+ ),
101
+ getAppActions: (r) => a(`/apps/${encodeURIComponent(r)}`).then(
102
+ (c) => c.actions ?? []
103
+ ),
104
+ listConnectionsForApp: (r) => a(
105
+ `/apps/${encodeURIComponent(r)}/connections`
106
+ ).then((c) => c.connections ?? []),
107
+ listConnections: () => a("/connections").then((r) => r.connections ?? []),
108
+ invokeAction: (r, c, u, w = {}) => a(
109
+ `/apps/${encodeURIComponent(r)}/actions/${encodeURIComponent(c)}/invoke`,
110
+ // This body is built KEY BY KEY, not by spreading `opts` — so every new
111
+ // option has to be named here or it is silently dropped before the wire
112
+ // (the caller compiles, the UI looks right, the field never leaves the
113
+ // page). `project` scopes document-expression resolution to the
114
+ // workflow's selected project; `state` is the start state upstream step
115
+ // outputs are seeded from, so `{{ steps.<id>.output.<f> }}` resolves.
116
+ // Undefined keys are dropped by JSON.stringify, so an absent project or
117
+ // state leaves the request byte-identical to one that never had them.
118
+ {
119
+ method: "POST",
120
+ body: JSON.stringify({
121
+ params: u,
122
+ connectionId: w.connectionId,
123
+ project: w.project,
124
+ state: w.state
125
+ })
126
+ }
127
+ ),
128
+ listSavedTests: (r) => a(
129
+ `/connections/${encodeURIComponent(r)}/saved-tests`
130
+ ).then((c) => c.savedTests ?? []),
131
+ createSavedTest: (r, c) => a(
132
+ `/connections/${encodeURIComponent(r)}/saved-tests`,
133
+ { method: "POST", body: JSON.stringify(c) }
134
+ ).then((u) => u.savedTest),
135
+ updateSavedTest: (r, c, u) => a(
136
+ `/connections/${encodeURIComponent(r)}/saved-tests/${encodeURIComponent(c)}`,
137
+ { method: "PATCH", body: JSON.stringify(u) }
138
+ ).then((w) => w.savedTest),
139
+ deleteSavedTest: (r, c) => a(
140
+ `/connections/${encodeURIComponent(r)}/saved-tests/${encodeURIComponent(c)}`,
141
+ { method: "DELETE" }
142
+ ).then(() => {
143
+ }),
144
+ recordTestRun: (r, c) => a(`/connections/${encodeURIComponent(r)}/test-runs`, {
145
+ method: "POST",
146
+ body: JSON.stringify(c)
147
+ }).then(() => {
148
+ }),
149
+ listTestRuns: (r) => a(
150
+ `/connections/${encodeURIComponent(r)}/test-runs`
151
+ ).then((c) => c.runs ?? []),
152
+ saveStepTest: (r, c, u) => a(
153
+ `/workflows/${encodeURIComponent(r)}/steps/${encodeURIComponent(c)}/tests`,
154
+ { method: "POST", body: JSON.stringify(u) }
155
+ ).then((w) => w.stepTest),
156
+ listStepTests: (r, c) => a(
157
+ `/workflows/${encodeURIComponent(r)}/steps/${encodeURIComponent(c)}/tests`
158
+ ).then((u) => u.stepTests ?? []),
159
+ recordStepTestRun: (r, c, u) => a(
160
+ `/workflows/${encodeURIComponent(r)}/steps/${encodeURIComponent(c)}/test-runs`,
161
+ { method: "POST", body: JSON.stringify(u) }
162
+ ).then(() => {
163
+ }),
164
+ listFunctions: () => a("/functions").then((r) => r.functions ?? []),
165
+ getFunction: (r) => a(
166
+ `/functions/${encodeURIComponent(r)}`
167
+ ).then((c) => ({ ...c.function, valid: c.valid })),
168
+ // The real synchronous route (`/functions/:id/invoke`) — deliberately NOT
169
+ // `POST /run`, which would give the test stage a different code path than
170
+ // the `@w6w/call` node it's standing in for. Returns the raw output,
171
+ // pinned against the committed `studio/src/repos/functions.ts` signature.
172
+ invokeFunction: (r, c) => a(`/functions/${encodeURIComponent(r)}/invoke`, {
173
+ method: "POST",
174
+ body: JSON.stringify({ inputs: c })
175
+ }).then((u) => u.output),
176
+ listWorkflows: () => a("/workflows").then((r) => r.workflows ?? []),
177
+ getWorkflow: (r) => a(`/workflows/${encodeURIComponent(r)}`).then(
178
+ (c) => c.workflow
179
+ ),
180
+ // `rawReq`, not `req<T>` — the ONE caller that needs the response's own
181
+ // status code: `200` (the run reached a terminal state inside the wait
182
+ // window) vs `202` (the server's own wait-timeout, still running). Both
183
+ // are 2xx successes; `rawReq` already throws on a non-2xx.
184
+ runWorkflow: (r, c = {}) => d(`/workflows/${encodeURIComponent(r)}/run?wait=true`, {
185
+ method: "POST",
186
+ body: JSON.stringify({ variables: c.variables, input: c.input })
187
+ }).then(({ status: u, data: w }) => ({ ...w ?? {}, terminal: u === 200 }))
188
+ };
189
+ }
190
+ function Ge(e) {
191
+ if (!e) return "";
192
+ try {
193
+ return JSON.stringify(JSON.parse(e), null, 2);
194
+ } catch {
195
+ return e;
196
+ }
197
+ }
198
+ function Kt(e, s) {
199
+ return `${e.method}-${e.url ?? e.host}-${s}`;
200
+ }
201
+ function Wt({ calls: e, defaultOpen: s, keyOf: n, title: l }) {
202
+ if (e.length === 0) return null;
203
+ const d = n ?? Kt;
204
+ return /* @__PURE__ */ o("div", { className: "w6w-stack", style: { gap: 4 }, children: [
205
+ l !== !1 && /* @__PURE__ */ t("strong", { className: "w6w-small", children: l ?? /* @__PURE__ */ o(k, { children: [
206
+ "API ",
207
+ e.length === 1 ? "call" : "calls",
208
+ " (",
209
+ e.length,
210
+ ")"
211
+ ] }) }),
212
+ e.map((a, r) => /* @__PURE__ */ o(
213
+ "details",
214
+ {
215
+ open: s,
216
+ className: "w6w-result",
217
+ style: { padding: 8 },
218
+ children: [
219
+ /* @__PURE__ */ t("summary", { style: { cursor: "pointer" }, children: /* @__PURE__ */ o("span", { className: "w6w-small", children: [
220
+ a.method,
221
+ " ",
222
+ a.url ?? a.host,
223
+ " →",
224
+ " ",
225
+ /* @__PURE__ */ t("strong", { children: a.error ? "failed" : a.status }),
226
+ a.durationMs !== void 0 && /* @__PURE__ */ o("span", { className: "w6w-muted", children: [
227
+ " · ",
228
+ a.durationMs,
229
+ "ms"
230
+ ] })
231
+ ] }) }),
232
+ /* @__PURE__ */ o("div", { className: "w6w-stack", style: { gap: 6, marginTop: 8 }, children: [
233
+ a.error && /* @__PURE__ */ t("div", { className: "w6w-error w6w-small", children: a.error }),
234
+ /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: "Request headers" }),
235
+ /* @__PURE__ */ t("pre", { className: "w6w-result", children: JSON.stringify(a.requestHeaders ?? {}, null, 2) }),
236
+ a.requestBody && /* @__PURE__ */ o(k, { children: [
237
+ /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: "Request body" }),
238
+ /* @__PURE__ */ t("pre", { className: "w6w-result", children: Ge(a.requestBody) })
239
+ ] }),
240
+ /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: "Response headers" }),
241
+ /* @__PURE__ */ t("pre", { className: "w6w-result", children: JSON.stringify(a.responseHeaders ?? {}, null, 2) }),
242
+ a.responseBody && /* @__PURE__ */ o(k, { children: [
243
+ /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: "Response body" }),
244
+ /* @__PURE__ */ t("pre", { className: "w6w-result", children: Ge(a.responseBody) })
245
+ ] }),
246
+ a.truncated && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: "A captured body exceeded the size cap and was truncated." })
247
+ ] })
248
+ ]
249
+ },
250
+ d(a, r)
251
+ ))
252
+ ] });
253
+ }
254
+ function Ne({
255
+ title: e,
256
+ subtitle: s,
257
+ icon: n,
258
+ trailing: l,
259
+ active: d = !1,
260
+ onClick: a,
261
+ ariaLabel: r
262
+ }) {
263
+ const c = /* @__PURE__ */ o(k, { children: [
264
+ n != null && /* @__PURE__ */ t("span", { className: "w6w-list-item-icon", children: n }),
265
+ /* @__PURE__ */ o("span", { className: "w6w-list-item-body", children: [
266
+ /* @__PURE__ */ t("span", { className: "w6w-list-item-title", children: e }),
267
+ s != null && /* @__PURE__ */ t("span", { className: "w6w-list-item-subtitle", children: s })
268
+ ] }),
269
+ l != null && /* @__PURE__ */ t("span", { className: "w6w-list-item-trailing", children: l })
270
+ ] }), u = `w6w-list-item${d ? " active" : ""}`;
271
+ return a ? /* @__PURE__ */ t(
272
+ "button",
273
+ {
274
+ type: "button",
275
+ className: u,
276
+ "aria-pressed": d,
277
+ "aria-label": r,
278
+ onClick: a,
279
+ children: c
280
+ }
281
+ ) : /* @__PURE__ */ t("div", { className: u, "aria-label": r, children: c });
282
+ }
283
+ function de(e) {
284
+ const s = Date.parse(e);
285
+ if (Number.isNaN(s)) return "";
286
+ const n = Math.max(0, Math.round((Date.now() - s) / 1e3));
287
+ if (n < 45) return "just now";
288
+ const l = Math.round(n / 60);
289
+ if (l < 60) return `${l}m ago`;
290
+ const d = Math.round(l / 60);
291
+ if (d < 24) return `${d}h ago`;
292
+ const a = Math.round(d / 24);
293
+ return a < 7 ? `${a}d ago` : new Date(s).toLocaleDateString();
294
+ }
295
+ function Qe(e) {
296
+ const s = {};
297
+ for (const n of (e == null ? void 0 : e.params) ?? [])
298
+ n.key && n.default !== void 0 && (s[n.key] = n.default);
299
+ return s;
300
+ }
301
+ function Vt(e) {
302
+ var n, l, d;
303
+ const s = e.indexOf("{");
304
+ if (s >= 0)
305
+ try {
306
+ const a = JSON.parse(e.slice(s)), r = ((l = (n = a == null ? void 0 : a.errors) == null ? void 0 : n[0]) == null ? void 0 : l.message) ?? (typeof (a == null ? void 0 : a.error) == "object" ? (d = a.error) == null ? void 0 : d.message : a == null ? void 0 : a.error) ?? (a == null ? void 0 : a.message);
307
+ if (typeof r == "string" && r.trim()) {
308
+ const c = e.slice(0, s).replace(/[:\s]+$/, "");
309
+ return c ? `${c}: ${r.trim()}` : r.trim();
310
+ }
311
+ } catch {
312
+ }
313
+ return e;
314
+ }
315
+ function tt(e) {
316
+ return typeof e == "object" && e !== null && typeof e.status == "number" && typeof e.code == "string";
317
+ }
318
+ function zt(e) {
319
+ if (!tt(e))
320
+ return { headline: (e == null ? void 0 : e.message) ?? "The action failed to run." };
321
+ const s = Vt(e.message ?? ""), n = `${e.status} ${e.code} ${e.message ?? ""}`.toLowerCase();
322
+ return e.status === 401 || e.status === 403 || /\b(401|403)\b|forbidden|unauthorized|not authorized|permission|scope|access denied|invalid api key|invalid credential/.test(
323
+ n
324
+ ) ? {
325
+ headline: "Permission denied by the provider — this is a credential/scope problem, not a w6w error.",
326
+ hint: "The connection's API key is missing the permissions this action needs. Fix it at the provider — e.g. SendGrid → Settings → API Keys → give the key the required scopes (or Full Access), or create a new key — then update this connection's credential and try again.",
327
+ detail: s
328
+ } : { headline: "The action returned an error.", detail: s };
329
+ }
330
+ function Gt(e) {
331
+ const s = tt(e) ? e.body ?? e.raw : null;
332
+ return (s == null ? void 0 : s.apiCalls) ?? [];
333
+ }
334
+ function ue() {
335
+ const [e, s] = v(""), [n, l] = v(void 0), [d, a] = v(!1);
336
+ return { text: e, value: n, invalid: d, onChange: (c) => {
337
+ s(c);
338
+ const u = c.trim();
339
+ if (u === "") {
340
+ a(!1);
341
+ return;
342
+ }
343
+ try {
344
+ const w = JSON.parse(u);
345
+ w !== null && typeof w == "object" && !Array.isArray(w) ? (l(w), a(!1)) : a(!0);
346
+ } catch {
347
+ a(!0);
348
+ }
349
+ } };
350
+ }
351
+ function Ps({
352
+ appId: e,
353
+ actions: s,
354
+ connectionId: n,
355
+ action: l,
356
+ seedValues: d,
357
+ onSavedTestsChanged: a,
358
+ seedTestId: r,
359
+ onDirtyChange: c,
360
+ onTestSaved: u,
361
+ onDeleted: w,
362
+ embedded: h = !1
363
+ }) {
364
+ var qe;
365
+ const m = Et(), p = ye(() => {
366
+ const i = [...s];
367
+ return i.sort((f, g) => (f.title || f.key).localeCompare(g.title || g.key)), i;
368
+ }, [s]), [N, ee] = v((l == null ? void 0 : l.key) ?? ""), y = l ?? s.find((i) => i.key === N) ?? null, [Ce, Oe] = v(!1), [A, _] = v(null), [Re, P] = v(void 0), [nt, E] = v([]), C = ue(), O = ue(), R = ue(), [te, at] = v(""), [se, rt] = v(""), Te = C.invalid || O.invalid || R.invalid, lt = () => {
369
+ const i = {};
370
+ return C.text.trim() !== "" && C.value !== void 0 && (i.body = C.value), O.text.trim() !== "" && O.value !== void 0 && (i.query = O.value), R.text.trim() !== "" && R.value !== void 0 && (i.headers = R.value), te && (i.target = te), se.trim() !== "" && (i.match = se.trim()), Object.keys(i).length > 0 ? i : void 0;
371
+ }, [I, ne] = v("form"), [it, Ae] = v(""), [ot, Ee] = v(!1), [T, Me] = v(!1), b = (y == null ? void 0 : y.key) ?? null, _e = d ? { ...d } : Qe(y), [Pe, D] = v(() => ({
372
+ key: b,
373
+ values: _e
374
+ })), [x, U] = v(r ?? null), [Ie, H] = v(_e);
375
+ if (Pe.key !== b) {
376
+ const i = Qe(y);
377
+ D({ key: b, values: i }), H(i), U(r ?? null), _(null), P(void 0), E([]);
378
+ }
379
+ const [ct, dt] = v(r);
380
+ r !== ct && (dt(r), U(r ?? null));
381
+ const [Ue, ut] = v(d);
382
+ if (d !== Ue) {
383
+ const i = JSON.stringify(d ?? null) !== JSON.stringify(Ue ?? null);
384
+ if (ut(d), d && i) {
385
+ const f = { ...d };
386
+ D({ key: b, values: f }), H(f), _(null), P(void 0), E([]);
387
+ }
388
+ }
389
+ const S = Pe.values, Fe = (i) => D({ key: b, values: i }), Le = ye(
390
+ () => JSON.stringify(S) !== JSON.stringify(Ie),
391
+ [S, Ie]
392
+ );
393
+ G(() => {
394
+ c == null || c(Le);
395
+ }, [Le]);
396
+ const wt = () => {
397
+ Ae(JSON.stringify(S, null, 2)), Ee(!1), ne("json");
398
+ }, mt = async (i) => {
399
+ if (!y || Te) return;
400
+ const f = y.key;
401
+ Oe(!0), _(null), P(void 0), E([]);
402
+ let g;
403
+ const Ke = lt();
404
+ try {
405
+ const M = await m.invokeAction(e, f, i, {
406
+ connectionId: n,
407
+ ...Ke ? { overrides: Ke } : {}
408
+ });
409
+ P(M.value), E(M.apiCalls ?? []), g = { ok: !0, summary: "OK", result: M.value };
410
+ } catch (M) {
411
+ const We = zt(M);
412
+ _(We), E(Gt(M)), g = { ok: !1, summary: We.headline };
413
+ } finally {
414
+ Oe(!1);
415
+ }
416
+ if (n)
417
+ try {
418
+ await m.recordTestRun(n, {
419
+ savedTestId: x ?? null,
420
+ actionKey: f,
421
+ ok: g.ok,
422
+ summary: g.summary.slice(0, 200),
423
+ result: g.result
424
+ }), ie(), kt(), a == null || a();
425
+ } catch {
426
+ }
427
+ }, ht = () => mt(S), [j, Be] = v(null), [q, F] = v(null), [pt, ft] = v(0), [vt, K] = v(!1), [ae, re] = v(""), [yt, le] = v(!1), ie = () => ft((i) => i + 1);
428
+ G(() => {
429
+ if (!n) {
430
+ Be(null);
431
+ return;
432
+ }
433
+ let i = !1;
434
+ return F(null), m.listSavedTests(n).then((f) => !i && Be(f)).catch((f) => !i && F(f.message)), () => {
435
+ i = !0;
436
+ };
437
+ }, [m, n, pt]);
438
+ const Je = b ? (j ?? []).filter((i) => i.actionKey === b) : [], [Nt, oe] = v(null), [gt, bt] = v(0), kt = () => bt((i) => i + 1);
439
+ G(() => {
440
+ const i = m.listTestRuns;
441
+ if (!n || !i) {
442
+ oe(null);
443
+ return;
444
+ }
445
+ let f = !1;
446
+ return i(n).then((g) => !f && oe(g)).catch(() => !f && oe(null)), () => {
447
+ f = !0;
448
+ };
449
+ }, [m, n, gt]);
450
+ const De = b ? (Nt ?? []).filter((i) => i.actionKey === b).slice().sort((i, f) => Date.parse(f.occurredAt) - Date.parse(i.occurredAt)) : [], xt = () => {
451
+ !n || !y || (re(""), F(null), K(!0));
452
+ }, St = () => {
453
+ !n || !y || (x ? He() : xt());
454
+ }, He = async () => {
455
+ if (!(!n || !y))
456
+ try {
457
+ let i;
458
+ if (x)
459
+ i = await m.updateSavedTest(n, x, { values: S });
460
+ else {
461
+ const f = ae.trim();
462
+ if (!f) return;
463
+ i = await m.createSavedTest(n, {
464
+ actionKey: y.key,
465
+ name: f,
466
+ values: S
467
+ }), U(i.id);
468
+ }
469
+ H({ ...S }), K(!1), re(""), ie(), a == null || a(), u == null || u(i);
470
+ } catch (i) {
471
+ F(i.message);
472
+ }
473
+ }, $t = (i) => {
474
+ const f = { ...i.values };
475
+ D({ key: b, values: f }), H(f), U(i.id), ne("form"), _(null), P(void 0), E([]);
476
+ }, Ct = async () => {
477
+ if (!n || !x) return;
478
+ const i = x;
479
+ try {
480
+ await m.deleteSavedTest(n, i), U(null), ie(), a == null || a(), w == null || w(i);
481
+ } catch (f) {
482
+ F(f.message);
483
+ }
484
+ }, Ot = /* @__PURE__ */ o("div", { className: "w6w-stack", style: { gap: "var(--w6w-sp-1-5)" }, children: [
485
+ /* @__PURE__ */ o(
486
+ "div",
487
+ {
488
+ className: "w6w-field-labelrow",
489
+ style: { display: "flex", justifyContent: "space-between", alignItems: "center" },
490
+ children: [
491
+ /* @__PURE__ */ t("span", { className: "w6w-muted w6w-small", children: "Parameters" }),
492
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: "var(--w6w-sp-1)" }, children: [
493
+ /* @__PURE__ */ t(
494
+ "button",
495
+ {
496
+ type: "button",
497
+ className: `w6w-btn w6w-btn-sm w6w-btn-ghost${I === "form" ? " active" : ""}`,
498
+ "aria-pressed": I === "form",
499
+ onClick: () => ne("form"),
500
+ children: "Form"
501
+ }
502
+ ),
503
+ /* @__PURE__ */ t(
504
+ "button",
505
+ {
506
+ type: "button",
507
+ className: `w6w-btn w6w-btn-sm w6w-btn-ghost${I === "json" ? " active" : ""}`,
508
+ "aria-pressed": I === "json",
509
+ onClick: wt,
510
+ children: "JSON"
511
+ }
512
+ ),
513
+ !h && /* @__PURE__ */ t(
514
+ "button",
515
+ {
516
+ type: "button",
517
+ className: "w6w-btn w6w-btn-sm w6w-btn-ghost",
518
+ "aria-pressed": T,
519
+ title: T ? "Collapse the params editor" : "Open the params editor in a larger view",
520
+ "aria-label": T ? "Collapse the params editor" : "Open the params editor in a larger view",
521
+ onClick: () => Me((i) => !i),
522
+ children: T ? "⤡" : "⤢"
523
+ }
524
+ )
525
+ ] })
526
+ ]
527
+ }
528
+ ),
529
+ I === "form" ? /* @__PURE__ */ t(Mt, { params: (y == null ? void 0 : y.params) ?? [], values: S, onChange: Fe }) : /* @__PURE__ */ o(k, { children: [
530
+ /* @__PURE__ */ t(
531
+ z,
532
+ {
533
+ value: it,
534
+ onChange: Ae,
535
+ minHeight: T ? "50vh" : "200px",
536
+ "aria-label": "Params JSON",
537
+ onValidChange: (i) => {
538
+ i !== null && typeof i == "object" && !Array.isArray(i) && Fe(i);
539
+ },
540
+ onValidityChange: ({ valid: i }) => Ee(!i)
541
+ }
542
+ ),
543
+ ot && /* @__PURE__ */ t("span", { className: "w6w-hint", style: { color: "var(--w6w-danger)" }, children: "Invalid JSON" })
544
+ ] })
545
+ ] }), Rt = /* @__PURE__ */ o("details", { className: "w6w-section", "data-testid": "overrides-region", children: [
546
+ /* @__PURE__ */ o("summary", { className: "w6w-section-summary", children: [
547
+ /* @__PURE__ */ t("span", { className: "w6w-section-title", children: "Overrides" }),
548
+ /* @__PURE__ */ t("span", { className: "w6w-section-subtitle", children: "Reach a vendor field this action's own params don't declare" })
549
+ ] }),
550
+ /* @__PURE__ */ o("div", { className: "w6w-stack w6w-section-body", style: { gap: "var(--w6w-sp-2)" }, children: [
551
+ /* @__PURE__ */ o("div", { className: "w6w-field", children: [
552
+ /* @__PURE__ */ t("span", { children: "Body" }),
553
+ /* @__PURE__ */ t(
554
+ z,
555
+ {
556
+ value: C.text,
557
+ onChange: C.onChange,
558
+ minHeight: "80px",
559
+ "aria-label": "Overrides body (JSON)"
560
+ }
561
+ ),
562
+ C.invalid && /* @__PURE__ */ t("span", { className: "w6w-hint", style: { color: "var(--w6w-danger)" }, children: "Invalid JSON" })
563
+ ] }),
564
+ /* @__PURE__ */ o("div", { className: "w6w-field", children: [
565
+ /* @__PURE__ */ t("span", { children: "Query" }),
566
+ /* @__PURE__ */ t(
567
+ z,
568
+ {
569
+ value: O.text,
570
+ onChange: O.onChange,
571
+ minHeight: "80px",
572
+ "aria-label": "Overrides query (JSON)"
573
+ }
574
+ ),
575
+ O.invalid && /* @__PURE__ */ t("span", { className: "w6w-hint", style: { color: "var(--w6w-danger)" }, children: "Invalid JSON" })
576
+ ] }),
577
+ /* @__PURE__ */ o("div", { className: "w6w-field", children: [
578
+ /* @__PURE__ */ t("span", { children: "Headers" }),
579
+ /* @__PURE__ */ t(
580
+ z,
581
+ {
582
+ value: R.text,
583
+ onChange: R.onChange,
584
+ minHeight: "80px",
585
+ "aria-label": "Overrides headers (JSON)"
586
+ }
587
+ ),
588
+ R.invalid && /* @__PURE__ */ t("span", { className: "w6w-hint", style: { color: "var(--w6w-danger)" }, children: "Invalid JSON" })
589
+ ] }),
590
+ /* @__PURE__ */ o("label", { className: "w6w-field", children: [
591
+ /* @__PURE__ */ t("span", { children: "Target" }),
592
+ /* @__PURE__ */ o(
593
+ "select",
594
+ {
595
+ "aria-label": "Overrides target",
596
+ value: te,
597
+ onChange: (i) => at(i.target.value),
598
+ children: [
599
+ /* @__PURE__ */ t("option", { value: "", children: "— default (first) —" }),
600
+ /* @__PURE__ */ t("option", { value: "first", children: "first" }),
601
+ /* @__PURE__ */ t("option", { value: "first-write", children: "first-write" }),
602
+ /* @__PURE__ */ t("option", { value: "all", children: "all" })
603
+ ]
604
+ }
605
+ )
606
+ ] }),
607
+ /* @__PURE__ */ o("label", { className: "w6w-field", children: [
608
+ /* @__PURE__ */ t("span", { children: "Match" }),
609
+ /* @__PURE__ */ t(
610
+ "input",
611
+ {
612
+ type: "text",
613
+ "aria-label": "Overrides match",
614
+ value: se,
615
+ placeholder: "Restrict to requests whose URL contains…",
616
+ onChange: (i) => rt(i.target.value)
617
+ }
618
+ )
619
+ ] }),
620
+ /* @__PURE__ */ t("span", { className: "w6w-hint", children: "Merged onto the outbound request at the wire, never into the params above — name a field the way the vendor's own API documents it." })
621
+ ] })
622
+ ] }), W = n ? /* @__PURE__ */ o("div", { className: "w6w-stack", style: { gap: "var(--w6w-sp-1-5)" }, children: [
623
+ /* @__PURE__ */ t(
624
+ "div",
625
+ {
626
+ className: "w6w-field-labelrow",
627
+ style: { display: "flex", justifyContent: "space-between", alignItems: "center" },
628
+ children: /* @__PURE__ */ t("span", { className: "w6w-muted w6w-small", children: "Saved tests" })
629
+ }
630
+ ),
631
+ q && /* @__PURE__ */ t("span", { className: "w6w-hint", style: { color: "var(--w6w-danger)" }, children: q }),
632
+ Je.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "No saved tests for this action yet." }) : /* @__PURE__ */ t(
633
+ "ul",
634
+ {
635
+ className: "w6w-stack",
636
+ style: { listStyle: "none", margin: 0, padding: 0, gap: "var(--w6w-sp-1-5)" },
637
+ children: Je.map((i) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
638
+ Ne,
639
+ {
640
+ title: i.name,
641
+ subtitle: i.lastRunAt ? /* @__PURE__ */ o("span", { children: [
642
+ /* @__PURE__ */ t(
643
+ "span",
644
+ {
645
+ style: { color: i.lastRunOk ? "var(--w6w-success)" : "var(--w6w-danger)" },
646
+ children: i.lastRunOk ? "✓" : "✗"
647
+ }
648
+ ),
649
+ " ",
650
+ i.lastRunSummary ? `${i.lastRunSummary} · ` : "",
651
+ de(i.lastRunAt)
652
+ ] }) : `saved ${de(i.updatedAt)}`,
653
+ active: i.id === x,
654
+ onClick: () => $t(i)
655
+ }
656
+ ) }, i.id))
657
+ }
658
+ ),
659
+ m.listTestRuns && De.length > 0 && /* @__PURE__ */ o(k, { children: [
660
+ /* @__PURE__ */ t(
661
+ "div",
662
+ {
663
+ className: "w6w-field-labelrow",
664
+ style: { display: "flex", justifyContent: "space-between", alignItems: "center" },
665
+ children: /* @__PURE__ */ t("span", { className: "w6w-muted w6w-small", children: "Recent runs" })
666
+ }
667
+ ),
668
+ /* @__PURE__ */ t(
669
+ "ul",
670
+ {
671
+ className: "w6w-stack",
672
+ style: { listStyle: "none", margin: 0, padding: 0, gap: "var(--w6w-sp-1-5)" },
673
+ children: De.map((i) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
674
+ Ne,
675
+ {
676
+ title: /* @__PURE__ */ o("span", { children: [
677
+ /* @__PURE__ */ t("span", { style: { color: i.ok ? "var(--w6w-success)" : "var(--w6w-danger)" }, children: i.ok ? "✓" : "✗" }),
678
+ " ",
679
+ i.actionKey
680
+ ] }),
681
+ subtitle: /* @__PURE__ */ o("span", { children: [
682
+ i.summary ? `${i.summary} · ` : "",
683
+ de(i.occurredAt)
684
+ ] })
685
+ }
686
+ ) }, i.id))
687
+ }
688
+ )
689
+ ] })
690
+ ] }) : null, je = (qe = j == null ? void 0 : j.find((i) => i.id === x)) == null ? void 0 : qe.name;
691
+ return /* @__PURE__ */ o("div", { className: `w6w-stack${h ? " w6w-tester-embedded-root" : ""}`, children: [
692
+ !l && (s.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "This app exposes no actions." }) : (
693
+ // biome-ignore lint/a11y/noLabelWithoutControl: Combobox renders its own <select>/<input> INSIDE this label, so the field text labels the control at runtime; the rule cannot see through the component boundary.
694
+ /* @__PURE__ */ o("label", { className: "w6w-field", children: [
695
+ /* @__PURE__ */ o("span", { children: [
696
+ "Action",
697
+ b ? "" : " *"
698
+ ] }),
699
+ /* @__PURE__ */ t(
700
+ _t,
701
+ {
702
+ value: N,
703
+ placeholder: "— pick an action —",
704
+ onChange: ee,
705
+ options: p.map((i) => ({
706
+ value: i.key,
707
+ label: `${i.title ?? i.key} (${i.key})`
708
+ }))
709
+ }
710
+ )
711
+ ] })
712
+ )),
713
+ y ? /* @__PURE__ */ o(k, { children: [
714
+ /* @__PURE__ */ o("div", { children: [
715
+ /* @__PURE__ */ o("strong", { children: [
716
+ y.title ?? y.key,
717
+ " ",
718
+ /* @__PURE__ */ t("code", { className: "w6w-muted", children: y.key })
719
+ ] }),
720
+ y.description && /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", style: { margin: "var(--w6w-sp-0-5) 0 0" }, children: y.description })
721
+ ] }),
722
+ (() => {
723
+ const i = /* @__PURE__ */ o("div", { className: "w6w-stack", style: { gap: "var(--w6w-sp-3)" }, children: [
724
+ Ot,
725
+ Rt,
726
+ A && /* @__PURE__ */ o("div", { className: "w6w-result w6w-error", children: [
727
+ /* @__PURE__ */ t("strong", { children: A.headline }),
728
+ A.hint && /* @__PURE__ */ t("div", { style: { marginTop: "var(--w6w-sp-1-5)" }, children: A.hint }),
729
+ A.detail && /* @__PURE__ */ t(
730
+ "div",
731
+ {
732
+ className: "w6w-muted w6w-small",
733
+ style: {
734
+ marginTop: "var(--w6w-sp-1-5)",
735
+ whiteSpace: "pre-wrap",
736
+ wordBreak: "break-word"
737
+ },
738
+ children: A.detail
739
+ }
740
+ )
741
+ ] }),
742
+ Re !== void 0 && /* @__PURE__ */ o("div", { className: "w6w-stack", style: { gap: "var(--w6w-sp-1)" }, children: [
743
+ /* @__PURE__ */ t("strong", { className: "w6w-small", children: "Result" }),
744
+ /* @__PURE__ */ t("pre", { className: "w6w-result", children: JSON.stringify(Re, null, 2) })
745
+ ] }),
746
+ /* @__PURE__ */ t(Wt, { calls: nt })
747
+ ] }), f = /* @__PURE__ */ o(
748
+ "div",
749
+ {
750
+ className: `w6w-tester-actions${h || T ? " w6w-tester-actions-footer" : ""}`,
751
+ style: { display: "flex", gap: "var(--w6w-sp-2)" },
752
+ children: [
753
+ /* @__PURE__ */ t(
754
+ "button",
755
+ {
756
+ type: "button",
757
+ className: "w6w-btn",
758
+ disabled: Ce || Te,
759
+ onClick: ht,
760
+ children: Ce ? "Running…" : "Run action"
761
+ }
762
+ ),
763
+ n && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: St, children: "Save test" }),
764
+ n && x && /* @__PURE__ */ t(
765
+ "button",
766
+ {
767
+ type: "button",
768
+ className: "w6w-btn w6w-btn-ghost",
769
+ style: { marginLeft: "auto", color: "var(--w6w-danger)" },
770
+ onClick: () => le(!0),
771
+ children: "Delete"
772
+ }
773
+ )
774
+ ]
775
+ }
776
+ ), g = /* @__PURE__ */ o("div", { className: "w6w-stack", style: { gap: "var(--w6w-sp-3)" }, children: [
777
+ i,
778
+ f
779
+ ] });
780
+ return h ? /* @__PURE__ */ o("div", { className: "w6w-tester-embedded", children: [
781
+ /* @__PURE__ */ t("div", { className: "w6w-tester-embedded-scroll", children: W ? /* @__PURE__ */ o("div", { className: "w6w-tester-embedded-cols", children: [
782
+ /* @__PURE__ */ t("div", { className: "w6w-tester-embedded-main", children: i }),
783
+ /* @__PURE__ */ t("div", { className: "w6w-tester-embedded-rail", children: W })
784
+ ] }) : i }),
785
+ f
786
+ ] }) : T ? /* @__PURE__ */ t(
787
+ Ve,
788
+ {
789
+ title: `Edit params — ${y.title ?? y.key}`,
790
+ onClose: () => Me(!1),
791
+ size: "full",
792
+ children: /* @__PURE__ */ o("div", { className: "w6w-tester-popout", children: [
793
+ /* @__PURE__ */ t("div", { className: "w6w-tester-popout-scroll", children: W ? /* @__PURE__ */ o(
794
+ "div",
795
+ {
796
+ style: {
797
+ display: "flex",
798
+ gap: "var(--w6w-sp-4)",
799
+ alignItems: "flex-start"
800
+ },
801
+ children: [
802
+ /* @__PURE__ */ t("div", { style: { flex: 1, minWidth: 0 }, children: i }),
803
+ /* @__PURE__ */ t("div", { style: { width: 260, flexShrink: 0 }, children: W })
804
+ ]
805
+ }
806
+ ) : i }),
807
+ f
808
+ ] })
809
+ }
810
+ ) : g;
811
+ })(),
812
+ vt && /* @__PURE__ */ t(Ve, { title: "Save test", onClose: () => K(!1), children: /* @__PURE__ */ o(
813
+ "form",
814
+ {
815
+ className: "w6w-stack",
816
+ style: { gap: "var(--w6w-sp-3)" },
817
+ onSubmit: (i) => {
818
+ i.preventDefault(), He();
819
+ },
820
+ children: [
821
+ /* @__PURE__ */ o("label", { className: "w6w-field", children: [
822
+ /* @__PURE__ */ t("span", { children: "Name this saved test" }),
823
+ /* @__PURE__ */ t(
824
+ "input",
825
+ {
826
+ type: "text",
827
+ value: ae,
828
+ placeholder: "e.g. valid sender",
829
+ onChange: (i) => re(i.target.value)
830
+ }
831
+ )
832
+ ] }),
833
+ q && /* @__PURE__ */ t("span", { className: "w6w-hint", style: { color: "var(--w6w-danger)" }, children: q }),
834
+ /* @__PURE__ */ o(
835
+ "div",
836
+ {
837
+ style: { display: "flex", gap: "var(--w6w-sp-2)", justifyContent: "flex-end" },
838
+ children: [
839
+ /* @__PURE__ */ t(
840
+ "button",
841
+ {
842
+ type: "button",
843
+ className: "w6w-btn w6w-btn-ghost",
844
+ onClick: () => K(!1),
845
+ children: "Cancel"
846
+ }
847
+ ),
848
+ /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: !ae.trim(), children: "Save" })
849
+ ]
850
+ }
851
+ )
852
+ ]
853
+ }
854
+ ) }),
855
+ yt && /* @__PURE__ */ t(
856
+ Pt,
857
+ {
858
+ title: "Delete saved test",
859
+ message: je ? `Delete "${je}"? This cannot be undone.` : "Delete this saved test? This cannot be undone.",
860
+ confirmLabel: "Delete",
861
+ onConfirm: () => {
862
+ le(!1), Ct();
863
+ },
864
+ onClose: () => le(!1)
865
+ }
866
+ )
867
+ ] }) : !l && /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Pick an action above to test it." })
868
+ ] });
869
+ }
870
+ function Is(e) {
871
+ const s = It(e.theme), { copied: n, copy: l } = Dt(e.value), d = ye(
872
+ () => [
873
+ Lt(),
874
+ Bt.theme({
875
+ "&": {
876
+ fontSize: "13px",
877
+ fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
878
+ backgroundColor: "var(--w6w-panel-2)",
879
+ color: "var(--w6w-text)",
880
+ border: "1px solid var(--w6w-border)",
881
+ borderRadius: "8px"
882
+ },
883
+ "&.cm-focused": { outline: "2px solid var(--w6w-accent)" },
884
+ ".cm-gutters": {
885
+ backgroundColor: "var(--w6w-panel)",
886
+ color: "var(--w6w-muted)",
887
+ border: "none",
888
+ borderRight: "1px solid var(--w6w-border)"
889
+ },
890
+ ".cm-scroller": { overflow: "auto" }
891
+ })
892
+ ],
893
+ []
894
+ );
895
+ function a(r) {
896
+ e.onChange(r);
897
+ }
898
+ return /* @__PURE__ */ o("div", { className: "w6w-yaml-editor", "aria-label": e["aria-label"] ?? "YAML editor", children: [
899
+ /* @__PURE__ */ t(
900
+ Jt,
901
+ {
902
+ value: e.value,
903
+ onChange: a,
904
+ extensions: d,
905
+ placeholder: e.placeholder,
906
+ readOnly: e.readOnly,
907
+ editable: !e.readOnly,
908
+ theme: s,
909
+ height: e.height,
910
+ minHeight: e.minHeight ?? "240px",
911
+ maxHeight: e.maxHeight,
912
+ basicSetup: {
913
+ lineNumbers: !0,
914
+ foldGutter: !0,
915
+ highlightActiveLine: !e.readOnly,
916
+ autocompletion: !0,
917
+ bracketMatching: !0,
918
+ closeBrackets: !0
919
+ }
920
+ }
921
+ ),
922
+ e.copyable && /* @__PURE__ */ o(k, { children: [
923
+ /* @__PURE__ */ t(
924
+ "button",
925
+ {
926
+ type: "button",
927
+ className: `w6w-icon-btn w6w-copyable-btn${n ? " is-copied" : ""}`,
928
+ "aria-label": "Copy",
929
+ onClick: () => void l(),
930
+ children: n ? /* @__PURE__ */ t(Ht, {}) : /* @__PURE__ */ t(jt, {})
931
+ }
932
+ ),
933
+ /* @__PURE__ */ t("span", { className: "w6w-copyable-status", "aria-live": "polite", children: n ? "Copied" : "" })
934
+ ] })
935
+ ] });
936
+ }
937
+ const we = "…";
938
+ function Qt(e, s, n = "end") {
939
+ if (s === void 0 || s < 1 || s >= e.length) return e;
940
+ if (n === "start")
941
+ return `${we}${e.slice(e.length - s)}`;
942
+ if (n === "end")
943
+ return `${e.slice(0, s)}${we}`;
944
+ const l = Math.ceil(s / 2), d = s - l;
945
+ return `${e.slice(0, l)}${we}${e.slice(e.length - d)}`;
946
+ }
947
+ function Us(e) {
948
+ const { value: s, chars: n, crop: l = "end", label: d, className: a, copiedMs: r } = e, c = Qt(s, n, l), u = ["w6w-copyable--bare", a].filter(Boolean).join(" ");
949
+ return /* @__PURE__ */ t(qt, { value: s, readOnly: !0, label: d, className: u, copiedMs: r, children: /* @__PURE__ */ t("span", { children: c }) });
950
+ }
951
+ const Yt = {
952
+ ok: "Operational",
953
+ degraded: "Degraded",
954
+ down: "Down",
955
+ unknown: "Unknown"
956
+ };
957
+ function Fs({ state: e, label: s, ariaLabel: n }) {
958
+ const l = s ?? Yt[e];
959
+ return /* @__PURE__ */ o("span", { className: `w6w-health-pill w6w-health-pill-${e}`, "aria-label": n, children: [
960
+ /* @__PURE__ */ t("span", { className: "w6w-health-pill-dot", "aria-hidden": "true" }),
961
+ /* @__PURE__ */ t("span", { className: "w6w-health-pill-label", children: l })
962
+ ] });
963
+ }
964
+ const Zt = {
965
+ ok: "Operational",
966
+ degraded: "Degraded",
967
+ down: "Down",
968
+ unknown: "Unknown"
969
+ };
970
+ function Ls({ days: e, ariaLabel: s }) {
971
+ return e.length === 0 ? null : /* @__PURE__ */ t(
972
+ "div",
973
+ {
974
+ className: "w6w-uptime-strip",
975
+ role: "img",
976
+ "aria-label": s ?? `${e.length}-day status`,
977
+ children: e.map((n, l) => /* @__PURE__ */ t(
978
+ "span",
979
+ {
980
+ className: `w6w-uptime-cell w6w-uptime-cell-${n.state}`,
981
+ title: n.label ?? `${n.day} — ${Zt[n.state]}`
982
+ },
983
+ `${n.day}-${l}`
984
+ ))
985
+ }
986
+ );
987
+ }
988
+ const st = "—", Ye = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
989
+ function Xt(e) {
990
+ if (e === null || !Number.isFinite(e)) return st;
991
+ if (e < 1024) return `${Math.round(e)} B`;
992
+ let s = e, n = 0;
993
+ for (; s >= 1024 && n < Ye.length - 1; )
994
+ s /= 1024, n += 1;
995
+ return `${s.toFixed(1)} ${Ye[n]}`;
996
+ }
997
+ function $(e) {
998
+ return e === null || !Number.isFinite(e) ? st : `${Math.round(e * 100)}%`;
999
+ }
1000
+ function B(e) {
1001
+ if (e === void 0 || e.load1 === null) return null;
1002
+ const s = e.cpuLimit ?? e.cpus;
1003
+ return s === null || s <= 0 ? null : e.load1 / s;
1004
+ }
1005
+ function J(e) {
1006
+ if (e === void 0) return null;
1007
+ const { memoryTotal: s, memoryAvailable: n } = e;
1008
+ return s === null || n === null || s <= 0 ? null : (s - n) / s;
1009
+ }
1010
+ function es(e, s, n) {
1011
+ return e < s ? s : e > n ? n : e;
1012
+ }
1013
+ function ts(e, s, n, l) {
1014
+ const d = e.length;
1015
+ if (d < 2) return "";
1016
+ const a = [];
1017
+ for (let r = 0; r < d; r++) {
1018
+ const c = e[r];
1019
+ if (c === null) continue;
1020
+ const u = r / (d - 1) * s, w = l <= 0 ? n : n - es(c, 0, l) / l * n;
1021
+ a.push(`${Number(u.toFixed(2))},${Number(w.toFixed(2))}`);
1022
+ }
1023
+ return a.join(" ");
1024
+ }
1025
+ const ss = "—", Ze = 100, Xe = 24;
1026
+ function ge({
1027
+ values: e,
1028
+ max: s,
1029
+ className: n
1030
+ }) {
1031
+ const l = ts(e, Ze, Xe, s);
1032
+ return l === "" ? null : /* @__PURE__ */ t(
1033
+ "svg",
1034
+ {
1035
+ className: n,
1036
+ viewBox: `0 0 ${Ze} ${Xe}`,
1037
+ preserveAspectRatio: "none",
1038
+ "aria-hidden": "true",
1039
+ focusable: "false",
1040
+ children: /* @__PURE__ */ t(
1041
+ "polyline",
1042
+ {
1043
+ points: l,
1044
+ fill: "none",
1045
+ stroke: "var(--w6w-accent)",
1046
+ strokeWidth: 2,
1047
+ vectorEffect: "non-scaling-stroke"
1048
+ }
1049
+ )
1050
+ }
1051
+ );
1052
+ }
1053
+ function me(e) {
1054
+ return e === null ? ss : e.toFixed(2);
1055
+ }
1056
+ function Z(e) {
1057
+ let s = 1;
1058
+ for (const n of e) n !== null && n > s && (s = n);
1059
+ return s;
1060
+ }
1061
+ function Q({
1062
+ label: e,
1063
+ value: s,
1064
+ values: n,
1065
+ max: l
1066
+ }) {
1067
+ return /* @__PURE__ */ o("li", { className: "w6w-server-resources__row", children: [
1068
+ /* @__PURE__ */ t("span", { className: "w6w-server-resources__label", children: e }),
1069
+ /* @__PURE__ */ t("span", { className: "w6w-server-resources__value", children: s }),
1070
+ /* @__PURE__ */ t(ge, { className: "w6w-server-resources__spark", values: n, max: l })
1071
+ ] });
1072
+ }
1073
+ function xe(e) {
1074
+ const s = e[e.length - 1], n = e.map((a) => B(a)), l = e.map((a) => J(a)), d = e.map((a) => a.processRss);
1075
+ return { last: s, cpuValues: n, memoryValues: l, rssValues: d };
1076
+ }
1077
+ function Bs({
1078
+ samples: e,
1079
+ title: s = "Server resources",
1080
+ intervalMs: n
1081
+ }) {
1082
+ const { last: l, cpuValues: d, memoryValues: a, rssValues: r } = xe(e);
1083
+ return /* @__PURE__ */ o("section", { className: "w6w-server-resources w6w-server-resources--card", "aria-label": s, children: [
1084
+ /* @__PURE__ */ t("h3", { className: "w6w-server-resources__title", children: s }),
1085
+ /* @__PURE__ */ o("ul", { className: "w6w-server-resources__rows", children: [
1086
+ /* @__PURE__ */ t(
1087
+ Q,
1088
+ {
1089
+ label: "CPU",
1090
+ value: $(B(l)),
1091
+ values: d,
1092
+ max: Z(d)
1093
+ }
1094
+ ),
1095
+ /* @__PURE__ */ t(
1096
+ Q,
1097
+ {
1098
+ label: "Memory",
1099
+ value: $(J(l)),
1100
+ values: a,
1101
+ max: 1
1102
+ }
1103
+ ),
1104
+ /* @__PURE__ */ t(
1105
+ Q,
1106
+ {
1107
+ label: "Process",
1108
+ value: Xt((l == null ? void 0 : l.processRss) ?? null),
1109
+ values: r,
1110
+ max: Z(r)
1111
+ }
1112
+ )
1113
+ ] }),
1114
+ /* @__PURE__ */ t("p", { className: "w6w-server-resources__meta", children: `Load ${me((l == null ? void 0 : l.load1) ?? null)} / ${me((l == null ? void 0 : l.load5) ?? null)} / ${me(
1115
+ (l == null ? void 0 : l.load15) ?? null
1116
+ )}` }),
1117
+ n !== void 0 && /* @__PURE__ */ t("p", { className: "w6w-server-resources__meta", children: `Sampled every ${n / 1e3}s` })
1118
+ ] });
1119
+ }
1120
+ function Js({ samples: e, title: s = "Server" }) {
1121
+ const { last: n, cpuValues: l } = xe(e);
1122
+ return /* @__PURE__ */ o("section", { className: "w6w-server-resources w6w-server-resources--small", "aria-label": s, children: [
1123
+ /* @__PURE__ */ t("h3", { className: "w6w-server-resources__title", children: s }),
1124
+ /* @__PURE__ */ o("ul", { className: "w6w-server-resources__rows", children: [
1125
+ /* @__PURE__ */ t(
1126
+ Q,
1127
+ {
1128
+ label: "CPU",
1129
+ value: $(B(n)),
1130
+ values: l,
1131
+ max: Z(l)
1132
+ }
1133
+ ),
1134
+ /* @__PURE__ */ o("li", { className: "w6w-server-resources__row", children: [
1135
+ /* @__PURE__ */ t("span", { className: "w6w-server-resources__label", children: "Memory" }),
1136
+ /* @__PURE__ */ t("span", { className: "w6w-server-resources__value", children: $(J(n)) })
1137
+ ] })
1138
+ ] })
1139
+ ] });
1140
+ }
1141
+ function Ds({ samples: e, onExpand: s }) {
1142
+ const { last: n, cpuValues: l, memoryValues: d } = xe(e);
1143
+ return /* @__PURE__ */ o("aside", { className: "w6w-server-resources w6w-server-resources--rail", children: [
1144
+ /* @__PURE__ */ o("div", { className: "w6w-server-resources__rail-row", children: [
1145
+ /* @__PURE__ */ t("span", { className: "w6w-server-resources__label", children: "CPU" }),
1146
+ /* @__PURE__ */ t("span", { className: "w6w-server-resources__value", children: $(B(n)) }),
1147
+ /* @__PURE__ */ t(
1148
+ ge,
1149
+ {
1150
+ className: "w6w-server-resources__spark",
1151
+ values: l,
1152
+ max: Z(l)
1153
+ }
1154
+ )
1155
+ ] }),
1156
+ /* @__PURE__ */ o("div", { className: "w6w-server-resources__rail-row", children: [
1157
+ /* @__PURE__ */ t("span", { className: "w6w-server-resources__label", children: "MEM" }),
1158
+ /* @__PURE__ */ t("span", { className: "w6w-server-resources__value", children: $(J(n)) }),
1159
+ /* @__PURE__ */ t(ge, { className: "w6w-server-resources__spark", values: d, max: 1 })
1160
+ ] }),
1161
+ s !== void 0 && /* @__PURE__ */ t(
1162
+ "button",
1163
+ {
1164
+ type: "button",
1165
+ className: "w6w-server-resources__expand",
1166
+ "aria-label": "Show server resources",
1167
+ onClick: s,
1168
+ children: "Details"
1169
+ }
1170
+ )
1171
+ ] });
1172
+ }
1173
+ function Hs({ samples: e }) {
1174
+ const s = e[e.length - 1], n = $(B(s)), l = $(J(s));
1175
+ return /* @__PURE__ */ t("span", { className: "w6w-server-resources w6w-server-resources--badge", children: `CPU ${n} · MEM ${l}` });
1176
+ }
1177
+ const ns = 1, as = 1440 * 60 * 1e3;
1178
+ function rs(e, s, n) {
1179
+ const l = s.startedAt ?? s.updatedAt;
1180
+ if (l === void 0) return null;
1181
+ const d = Date.parse(l), a = s.resolvedAt !== void 0 ? Date.parse(s.resolvedAt) : s.startedAt !== void 0 ? n : d, r = Date.parse(`${e.from}T00:00:00.000Z`), c = Date.parse(`${e.to}T00:00:00.000Z`) + as, u = c - r;
1182
+ if (a < r || d >= c) return null;
1183
+ const w = d < r, h = a > c, m = Math.max(d, r), p = Math.min(a, c), N = (m - r) / u * 100, ee = (p - m) / u * 100, y = Math.max(ee, ns);
1184
+ return { leftPct: N, widthPct: y, clippedStart: w, clippedEnd: h };
1185
+ }
1186
+ const ls = {
1187
+ ok: "Operational",
1188
+ degraded: "Degraded",
1189
+ down: "Down",
1190
+ unknown: "Unknown"
1191
+ }, is = "This vendor publishes no incident history.", os = "No incidents in this window.";
1192
+ function cs(e) {
1193
+ const s = e.startedAt ?? e.updatedAt, n = [e.title];
1194
+ return e.components !== void 0 && e.components.length > 0 && n.push(`(${e.components.join(", ")})`), s !== void 0 && n.push(
1195
+ e.resolvedAt !== void 0 ? `${s} – ${e.resolvedAt}` : `${s} – ongoing`
1196
+ ), n.join(" ");
1197
+ }
1198
+ function js({
1199
+ window: e,
1200
+ days: s,
1201
+ incidents: n,
1202
+ vendorEmptyLabel: l,
1203
+ nowMs: d = Date.now(),
1204
+ ariaLabel: a
1205
+ }) {
1206
+ const r = s.length, c = r > 0 ? 100 / r : 0, u = n === void 0 ? l ?? is : n.length === 0 ? l ?? os : null;
1207
+ return /* @__PURE__ */ t("div", { className: "w6w-history-timeline", role: "img", "aria-label": a ?? `${r}-day history`, children: /* @__PURE__ */ o("div", { className: "w6w-history-plot", children: [
1208
+ /* @__PURE__ */ t("div", { className: "w6w-history-lane w6w-history-lane-execution", children: s.map((w, h) => /* @__PURE__ */ t(
1209
+ "span",
1210
+ {
1211
+ className: `w6w-history-cell w6w-history-cell-${w.state}`,
1212
+ style: { left: `${h * c}%`, width: `${c}%` },
1213
+ title: w.label ?? `${w.day} — ${ls[w.state]}`
1214
+ },
1215
+ `${w.day}-${h}`
1216
+ )) }),
1217
+ /* @__PURE__ */ t("div", { className: "w6w-history-lane w6w-history-lane-vendor", children: u !== null ? /* @__PURE__ */ t("span", { className: "w6w-history-empty", title: u, children: u }) : n == null ? void 0 : n.map((w, h) => {
1218
+ const m = rs(e, w, d);
1219
+ if (m === null) return null;
1220
+ const p = [
1221
+ m.clippedStart ? "w6w-history-bar-clip-start" : "",
1222
+ m.clippedEnd ? "w6w-history-bar-clip-end" : ""
1223
+ ].filter(Boolean).join(" ");
1224
+ return /* @__PURE__ */ t(
1225
+ "span",
1226
+ {
1227
+ className: `w6w-history-bar w6w-history-bar-${w.state}${p ? ` ${p}` : ""}`,
1228
+ style: { left: `${m.leftPct}%`, width: `${m.widthPct}%` },
1229
+ title: cs(w)
1230
+ },
1231
+ w.id ?? `${w.title}-${h}`
1232
+ );
1233
+ }) }),
1234
+ /* @__PURE__ */ o("div", { className: "w6w-history-axis", children: [
1235
+ /* @__PURE__ */ t("span", { className: "w6w-history-tick w6w-history-tick-start", style: { left: "0%" }, children: e.from }),
1236
+ /* @__PURE__ */ t("span", { className: "w6w-history-tick w6w-history-tick-end", style: { left: "100%" }, children: e.to })
1237
+ ] })
1238
+ ] }) });
1239
+ }
1240
+ function qs({ label: e, children: s, className: n }) {
1241
+ const [l, d] = v(!1), a = Ut();
1242
+ return /* @__PURE__ */ o("span", { className: ["w6w-info-tip", n ?? ""].filter(Boolean).join(" "), children: [
1243
+ /* @__PURE__ */ t(
1244
+ L,
1245
+ {
1246
+ label: e,
1247
+ icon: "info",
1248
+ "aria-expanded": l,
1249
+ "aria-controls": a,
1250
+ onClick: () => d((r) => !r)
1251
+ }
1252
+ ),
1253
+ l && /* @__PURE__ */ t("span", { id: a, className: "w6w-info-tip-body w6w-muted w6w-small", children: s })
1254
+ ] });
1255
+ }
1256
+ function Ks(e) {
1257
+ const { label: s, onClick: n, disabled: l, className: d, ...a } = e;
1258
+ return /* @__PURE__ */ t(
1259
+ L,
1260
+ {
1261
+ label: s,
1262
+ onClick: n,
1263
+ disabled: l,
1264
+ className: d,
1265
+ icon: "edit",
1266
+ "data-testid": a["data-testid"]
1267
+ }
1268
+ );
1269
+ }
1270
+ function Ws(e) {
1271
+ const { label: s, onClick: n, disabled: l, className: d, ...a } = e;
1272
+ return /* @__PURE__ */ t(
1273
+ L,
1274
+ {
1275
+ label: s,
1276
+ onClick: n,
1277
+ disabled: l,
1278
+ className: d,
1279
+ danger: !0,
1280
+ icon: "delete",
1281
+ "data-testid": a["data-testid"]
1282
+ }
1283
+ );
1284
+ }
1285
+ function Vs(e) {
1286
+ const { branch: s, shortSha: n, lastSyncLabel: l, onSyncNow: d, syncing: a, className: r, ...c } = e, [u, w] = v(!1), h = Ft(null);
1287
+ return G(() => {
1288
+ if (!u) return;
1289
+ const m = (N) => {
1290
+ h.current && !h.current.contains(N.target) && w(!1);
1291
+ }, p = (N) => N.key === "Escape" && w(!1);
1292
+ return document.addEventListener("mousedown", m), document.addEventListener("keydown", p), () => {
1293
+ document.removeEventListener("mousedown", m), document.removeEventListener("keydown", p);
1294
+ };
1295
+ }, [u]), /* @__PURE__ */ o(
1296
+ "div",
1297
+ {
1298
+ className: `w6w-repo-sync${r ? ` ${r}` : ""}`,
1299
+ ref: h,
1300
+ "data-testid": c["data-testid"],
1301
+ children: [
1302
+ /* @__PURE__ */ o(
1303
+ "button",
1304
+ {
1305
+ type: "button",
1306
+ className: "w6w-repo-sync-trigger",
1307
+ "aria-haspopup": "menu",
1308
+ "aria-expanded": u,
1309
+ "aria-busy": a,
1310
+ onClick: () => w((m) => !m),
1311
+ children: [
1312
+ /* @__PURE__ */ o("span", { className: "w6w-repo-sync-icon", children: [
1313
+ /* @__PURE__ */ t(ze, { name: "github" }),
1314
+ a && /* @__PURE__ */ t(ze, { name: "sync", size: 10, className: "w6w-repo-sync-spin" })
1315
+ ] }),
1316
+ /* @__PURE__ */ t("span", { className: "w6w-repo-sync-branch", children: s }),
1317
+ n != null && /* @__PURE__ */ t("code", { className: "w6w-repo-sync-sha", children: n })
1318
+ ]
1319
+ }
1320
+ ),
1321
+ u && /* @__PURE__ */ o("div", { className: "w6w-repo-sync-menu", role: "menu", children: [
1322
+ /* @__PURE__ */ o("div", { className: "w6w-repo-sync-detail", children: [
1323
+ /* @__PURE__ */ t("span", { children: s }),
1324
+ n != null && /* @__PURE__ */ t("code", { children: n }),
1325
+ l != null && /* @__PURE__ */ t("span", { children: l })
1326
+ ] }),
1327
+ /* @__PURE__ */ t(
1328
+ "button",
1329
+ {
1330
+ type: "button",
1331
+ role: "menuitem",
1332
+ className: "w6w-repo-sync-item",
1333
+ "data-testid": "repo-sync-now",
1334
+ disabled: a,
1335
+ onClick: d,
1336
+ children: a ? "Syncing…" : "Sync now"
1337
+ }
1338
+ )
1339
+ ] })
1340
+ ]
1341
+ }
1342
+ );
1343
+ }
1344
+ const ds = {
1345
+ pending: "Pending",
1346
+ running: "Running",
1347
+ succeeded: "Succeeded",
1348
+ failed: "Failed",
1349
+ skipped: "Skipped",
1350
+ queued: "Queued",
1351
+ canceled: "Canceled"
1352
+ };
1353
+ function Se({ state: e, label: s, ariaLabel: n }) {
1354
+ const l = s ?? ds[e];
1355
+ return /* @__PURE__ */ o("span", { className: `w6w-step-pill w6w-step-pill-${e}`, "aria-label": n, children: [
1356
+ /* @__PURE__ */ t("span", { className: "w6w-step-pill-dot", "aria-hidden": "true" }),
1357
+ /* @__PURE__ */ t("span", { className: "w6w-step-pill-label", children: l })
1358
+ ] });
1359
+ }
1360
+ const us = "—", he = 1e3, pe = 6e4;
1361
+ function $e(e) {
1362
+ return e == null || !Number.isFinite(e) || e < 0 ? us : e < he ? `${Math.round(e)} ms` : e < pe ? `${(e / he).toFixed(1)} s` : `${Math.floor(e / pe)}m ${Math.round(e % pe / he)}s`;
1363
+ }
1364
+ function X(e) {
1365
+ const s = new Date(e);
1366
+ return Number.isNaN(s.getTime()) ? e : s.toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
1367
+ }
1368
+ const ws = {
1369
+ function: "Function",
1370
+ endpoint: "Endpoint",
1371
+ workflow: "Workflow"
1372
+ };
1373
+ function zs({
1374
+ items: e,
1375
+ selectedId: s = null,
1376
+ onSelect: n,
1377
+ showCallable: l = !1,
1378
+ loading: d = !1,
1379
+ emptyLabel: a,
1380
+ hasPrev: r,
1381
+ hasNext: c,
1382
+ onPrev: u,
1383
+ onNext: w
1384
+ }) {
1385
+ const h = u || w ? /* @__PURE__ */ o("div", { className: "w6w-execution-list-pager", children: [
1386
+ /* @__PURE__ */ t(
1387
+ "button",
1388
+ {
1389
+ type: "button",
1390
+ className: "w6w-btn w6w-btn-ghost",
1391
+ "data-testid": "execution-list-prev",
1392
+ disabled: !r,
1393
+ onClick: u,
1394
+ children: "Previous"
1395
+ }
1396
+ ),
1397
+ /* @__PURE__ */ t(
1398
+ "button",
1399
+ {
1400
+ type: "button",
1401
+ className: "w6w-btn w6w-btn-ghost",
1402
+ "data-testid": "execution-list-next",
1403
+ disabled: !c,
1404
+ onClick: w,
1405
+ children: "Next"
1406
+ }
1407
+ )
1408
+ ] }) : null;
1409
+ let m;
1410
+ return d && e.length === 0 ? m = /* @__PURE__ */ t("p", { "data-testid": "execution-list-loading", children: "Loading…" }) : e.length === 0 ? m = /* @__PURE__ */ t("p", { "data-testid": "execution-list-empty", children: a ?? "No executions yet." }) : m = /* @__PURE__ */ t("ul", { className: "w6w-execution-list-rows", children: e.map((p) => /* @__PURE__ */ t("li", { "data-testid": "execution-row", "data-execution-id": p.id, children: /* @__PURE__ */ t(
1411
+ Ne,
1412
+ {
1413
+ icon: /* @__PURE__ */ t(Se, { state: p.status }),
1414
+ title: l ? p.callableName : X(p.startedAt),
1415
+ subtitle: l ? `${ws[p.kind]} · ${X(p.startedAt)}` : p.id,
1416
+ trailing: $e(p.durationMs),
1417
+ active: p.id === s,
1418
+ onClick: n ? () => n(p.id) : void 0
1419
+ }
1420
+ ) }, p.id)) }), /* @__PURE__ */ o("div", { className: "w6w-execution-list", "data-testid": "execution-list", children: [
1421
+ m,
1422
+ h
1423
+ ] });
1424
+ }
1425
+ function ms({
1426
+ steps: e,
1427
+ emptyLabel: s,
1428
+ onDismiss: n,
1429
+ runError: l,
1430
+ stepErrors: d
1431
+ }) {
1432
+ const a = n ? /* @__PURE__ */ t("div", { className: "w6w-execution-log-head", children: /* @__PURE__ */ t(L, { label: "Dismiss run log", "data-testid": "execution-log-dismiss", onClick: n, children: "×" }) }) : null, r = d ?? [], c = l || r.length > 0 ? /* @__PURE__ */ o("div", { className: "w6w-execution-log-errors w6w-stack", children: [
1433
+ l && /* @__PURE__ */ t(be, { error: l }),
1434
+ r.map((u, w) => /* @__PURE__ */ t(
1435
+ be,
1436
+ {
1437
+ label: u.label ?? u.stepId,
1438
+ error: u.error
1439
+ },
1440
+ `${u.stepId}:${w}`
1441
+ ))
1442
+ ] }) : null;
1443
+ return e.length === 0 ? /* @__PURE__ */ o(k, { children: [
1444
+ a,
1445
+ c,
1446
+ /* @__PURE__ */ t("div", { className: "w6w-execution-log-empty", children: /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: s ?? "No steps have run yet." }) })
1447
+ ] }) : /* @__PURE__ */ o(k, { children: [
1448
+ a,
1449
+ c,
1450
+ /* @__PURE__ */ t("ol", { className: "w6w-execution-log", children: e.map((u) => /* @__PURE__ */ t(hs, { step: u }, u.id)) })
1451
+ ] });
1452
+ }
1453
+ function hs({ step: e }) {
1454
+ const [s, n] = v(!1), l = /* @__PURE__ */ o("div", { className: "w6w-execution-log-row-header", children: [
1455
+ /* @__PURE__ */ t(Se, { state: e.status }),
1456
+ /* @__PURE__ */ t("span", { className: "w6w-execution-log-row-label", children: e.label ?? e.id }),
1457
+ /* @__PURE__ */ t(ps, { startedAt: e.startedAt, finishedAt: e.finishedAt })
1458
+ ] }), d = e.error ? /* @__PURE__ */ t(be, { error: e.error }) : null;
1459
+ return e.input === void 0 && e.output === void 0 && !e.meta ? /* @__PURE__ */ o("li", { className: "w6w-execution-log-row", children: [
1460
+ /* @__PURE__ */ t("div", { className: "w6w-section", children: l }),
1461
+ d
1462
+ ] }) : /* @__PURE__ */ o("li", { className: "w6w-execution-log-row", children: [
1463
+ /* @__PURE__ */ o("details", { className: "w6w-section", open: s, onToggle: (a) => n(a.currentTarget.open), children: [
1464
+ /* @__PURE__ */ t("summary", { className: "w6w-section-summary", children: l }),
1465
+ s && /* @__PURE__ */ o("div", { className: "w6w-execution-log-row-body w6w-section-body w6w-stack", children: [
1466
+ /* @__PURE__ */ t(et, { title: "Input", value: e.input }),
1467
+ /* @__PURE__ */ t(et, { title: "Output", value: e.output }),
1468
+ e.meta && /* @__PURE__ */ o("div", { className: "w6w-execution-log-json w6w-stack", children: [
1469
+ /* @__PURE__ */ t("strong", { className: "w6w-small", children: "Metadata" }),
1470
+ /* @__PURE__ */ t(ke, { code: JSON.stringify(e.meta, null, 2), language: "json" })
1471
+ ] })
1472
+ ] })
1473
+ ] }),
1474
+ d
1475
+ ] });
1476
+ }
1477
+ function be({ error: e, label: s }) {
1478
+ return /* @__PURE__ */ o("div", { className: "w6w-result w6w-error", children: [
1479
+ s !== void 0 && /* @__PURE__ */ t("strong", { className: "w6w-execution-log-error-label", children: s }),
1480
+ e.code && /* @__PURE__ */ t("div", { className: "w6w-small w6w-execution-log-error-code", children: /* @__PURE__ */ t("code", { children: e.code }) }),
1481
+ e.message
1482
+ ] });
1483
+ }
1484
+ function ps({ startedAt: e, finishedAt: s }) {
1485
+ if (e && s) {
1486
+ const n = fs(e, s);
1487
+ return /* @__PURE__ */ o("span", { className: "w6w-execution-log-timing", children: [
1488
+ e,
1489
+ " → ",
1490
+ s,
1491
+ n && /* @__PURE__ */ o("span", { children: [
1492
+ " (",
1493
+ n,
1494
+ ")"
1495
+ ] })
1496
+ ] });
1497
+ }
1498
+ return e ? /* @__PURE__ */ o("span", { className: "w6w-execution-log-timing", children: [
1499
+ "Started ",
1500
+ e
1501
+ ] }) : /* @__PURE__ */ t("span", { className: "w6w-execution-log-timing", children: "—" });
1502
+ }
1503
+ function fs(e, s) {
1504
+ const n = Date.parse(e), l = Date.parse(s);
1505
+ if (!Number.isFinite(n) || !Number.isFinite(l) || l < n) return null;
1506
+ const d = l - n;
1507
+ if (d < 1e3) return `${d}ms`;
1508
+ const a = d / 1e3;
1509
+ if (a < 60) return `${a.toFixed(1)}s`;
1510
+ const r = Math.floor(a / 60), c = Math.round(a % 60);
1511
+ return `${r}m ${c}s`;
1512
+ }
1513
+ function et({ title: e, value: s }) {
1514
+ return /* @__PURE__ */ o("div", { className: "w6w-execution-log-json w6w-stack", children: [
1515
+ /* @__PURE__ */ t("strong", { className: "w6w-small", children: e }),
1516
+ s === void 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Not available." }) : /* @__PURE__ */ t(ke, { code: JSON.stringify(s, null, 2), language: "json" })
1517
+ ] });
1518
+ }
1519
+ const vs = { status: "", kind: "", from: "", to: "", q: "" }, ys = [
1520
+ { value: "", label: "Any status" },
1521
+ { value: "queued", label: "Queued" },
1522
+ { value: "running", label: "Running" },
1523
+ { value: "succeeded", label: "Succeeded" },
1524
+ { value: "failed", label: "Failed" },
1525
+ { value: "canceled", label: "Canceled" }
1526
+ ], Ns = [
1527
+ { value: "", label: "Any type" },
1528
+ { value: "function", label: "Function" },
1529
+ { value: "endpoint", label: "Endpoint" },
1530
+ { value: "workflow", label: "Workflow" }
1531
+ ];
1532
+ function Gs({
1533
+ value: e,
1534
+ onChange: s,
1535
+ showKind: n = !1,
1536
+ searchPlaceholder: l = "Search by id or name",
1537
+ disabled: d = !1
1538
+ }) {
1539
+ const a = e.status !== "" || e.kind !== "" || e.from !== "" || e.to !== "" || e.q !== "";
1540
+ return /* @__PURE__ */ o("div", { className: "w6w-execution-filters", "data-testid": "execution-filters", children: [
1541
+ /* @__PURE__ */ t(
1542
+ "input",
1543
+ {
1544
+ type: "search",
1545
+ className: "w6w-execution-filters-search",
1546
+ "data-testid": "execution-filter-q",
1547
+ "aria-label": "Search executions",
1548
+ placeholder: l,
1549
+ value: e.q,
1550
+ disabled: d,
1551
+ onChange: (r) => s({ ...e, q: r.target.value })
1552
+ }
1553
+ ),
1554
+ /* @__PURE__ */ t(
1555
+ "select",
1556
+ {
1557
+ className: "w6w-execution-filters-select",
1558
+ "data-testid": "execution-filter-status",
1559
+ "aria-label": "Status",
1560
+ value: e.status,
1561
+ disabled: d,
1562
+ onChange: (r) => s({ ...e, status: r.target.value }),
1563
+ children: ys.map((r) => /* @__PURE__ */ t("option", { value: r.value, children: r.label }, r.value))
1564
+ }
1565
+ ),
1566
+ n && /* @__PURE__ */ t(
1567
+ "select",
1568
+ {
1569
+ className: "w6w-execution-filters-select",
1570
+ "data-testid": "execution-filter-kind",
1571
+ "aria-label": "Type",
1572
+ value: e.kind,
1573
+ disabled: d,
1574
+ onChange: (r) => s({ ...e, kind: r.target.value }),
1575
+ children: Ns.map((r) => /* @__PURE__ */ t("option", { value: r.value, children: r.label }, r.value))
1576
+ }
1577
+ ),
1578
+ /* @__PURE__ */ t(
1579
+ "input",
1580
+ {
1581
+ type: "date",
1582
+ className: "w6w-execution-filters-date",
1583
+ "data-testid": "execution-filter-from",
1584
+ "aria-label": "From date",
1585
+ value: e.from,
1586
+ disabled: d,
1587
+ onChange: (r) => s({ ...e, from: r.target.value })
1588
+ }
1589
+ ),
1590
+ /* @__PURE__ */ t(
1591
+ "input",
1592
+ {
1593
+ type: "date",
1594
+ className: "w6w-execution-filters-date",
1595
+ "data-testid": "execution-filter-to",
1596
+ "aria-label": "To date",
1597
+ value: e.to,
1598
+ disabled: d,
1599
+ onChange: (r) => s({ ...e, to: r.target.value })
1600
+ }
1601
+ ),
1602
+ a && /* @__PURE__ */ t(
1603
+ "button",
1604
+ {
1605
+ type: "button",
1606
+ className: "w6w-btn w6w-btn-ghost w6w-execution-filters-clear",
1607
+ "data-testid": "execution-filter-clear",
1608
+ disabled: d,
1609
+ onClick: () => s({ ...vs }),
1610
+ children: "Clear"
1611
+ }
1612
+ )
1613
+ ] });
1614
+ }
1615
+ const Y = "—";
1616
+ function Qs({ stats: e, label: s }) {
1617
+ const n = [
1618
+ {
1619
+ testid: "execution-stat-total",
1620
+ label: "Executions",
1621
+ value: e ? String(e.total) : Y
1622
+ },
1623
+ {
1624
+ testid: "execution-stat-success-rate",
1625
+ label: "Success rate",
1626
+ value: gs(e == null ? void 0 : e.successRate)
1627
+ },
1628
+ {
1629
+ testid: "execution-stat-failed",
1630
+ label: "Failed",
1631
+ value: e ? String(e.failed) : Y
1632
+ },
1633
+ {
1634
+ testid: "execution-stat-avg-duration",
1635
+ label: "Avg duration",
1636
+ value: e ? $e(e.avgDurationMs) : Y
1637
+ }
1638
+ ];
1639
+ return e && e.inFlight > 0 && n.push({
1640
+ testid: "execution-stat-in-flight",
1641
+ label: "In flight",
1642
+ value: String(e.inFlight)
1643
+ }), /* @__PURE__ */ o("section", { className: "w6w-execution-stats", "data-testid": "execution-stats", children: [
1644
+ s != null && /* @__PURE__ */ t("p", { className: "w6w-execution-stats-label", children: s }),
1645
+ /* @__PURE__ */ t("div", { className: "w6w-execution-stats-cards", children: n.map((l) => /* @__PURE__ */ o("div", { className: "w6w-execution-stat", "data-testid": l.testid, children: [
1646
+ /* @__PURE__ */ t("span", { className: "w6w-execution-stat-value", "data-stat-value": l.value, children: l.value }),
1647
+ /* @__PURE__ */ t("span", { className: "w6w-execution-stat-label", children: l.label })
1648
+ ] }, l.testid)) })
1649
+ ] });
1650
+ }
1651
+ function gs(e) {
1652
+ return e == null || !Number.isFinite(e) ? Y : `${Math.round(e * 100)}%`;
1653
+ }
1654
+ const bs = {
1655
+ function: "Function",
1656
+ endpoint: "Endpoint",
1657
+ workflow: "Workflow"
1658
+ };
1659
+ function ks(e) {
1660
+ return JSON.stringify(e, null, 2) ?? "null";
1661
+ }
1662
+ function Ys({
1663
+ execution: e,
1664
+ loading: s = !1,
1665
+ errorMessage: n,
1666
+ onClose: l,
1667
+ onOpenInEditor: d
1668
+ }) {
1669
+ return /* @__PURE__ */ o("section", { className: "w6w-execution-detail w6w-stack", "data-testid": "execution-detail", children: [
1670
+ n != null && /* @__PURE__ */ t(
1671
+ "p",
1672
+ {
1673
+ role: "alert",
1674
+ className: "w6w-execution-detail-error-message",
1675
+ "data-testid": "execution-detail-error-message",
1676
+ children: n
1677
+ }
1678
+ ),
1679
+ e ? /* @__PURE__ */ t(xs, { execution: e, onClose: l, onOpenInEditor: d }) : s ? /* @__PURE__ */ t("p", { className: "w6w-muted", "data-testid": "execution-detail-loading", children: "Loading…" }) : /* @__PURE__ */ t("p", { className: "w6w-muted", "data-testid": "execution-detail-empty", children: "No execution selected." })
1680
+ ] });
1681
+ }
1682
+ function xs({
1683
+ execution: e,
1684
+ onClose: s,
1685
+ onOpenInEditor: n
1686
+ }) {
1687
+ return /* @__PURE__ */ o(k, { children: [
1688
+ /* @__PURE__ */ o("div", { className: "w6w-execution-detail-head", children: [
1689
+ /* @__PURE__ */ o("div", { className: "w6w-execution-detail-title", children: [
1690
+ /* @__PURE__ */ t("h3", { className: "w6w-execution-detail-name", children: e.callableName }),
1691
+ /* @__PURE__ */ o("div", { className: "w6w-execution-detail-meta", children: [
1692
+ /* @__PURE__ */ t(Se, { state: e.status }),
1693
+ /* @__PURE__ */ t("span", { className: "w6w-execution-detail-kind w6w-muted w6w-small", children: bs[e.kind] })
1694
+ ] })
1695
+ ] }),
1696
+ (n || s) && /* @__PURE__ */ o("div", { className: "w6w-execution-detail-actions", children: [
1697
+ n && /* @__PURE__ */ t(
1698
+ "button",
1699
+ {
1700
+ type: "button",
1701
+ className: "w6w-btn w6w-btn-ghost",
1702
+ "data-testid": "execution-detail-open-editor",
1703
+ onClick: n,
1704
+ children: "Open in visual editor"
1705
+ }
1706
+ ),
1707
+ s && /* @__PURE__ */ t(L, { label: "Close", "data-testid": "execution-detail-close", onClick: s, children: "×" })
1708
+ ] })
1709
+ ] }),
1710
+ /* @__PURE__ */ t("p", { className: "w6w-execution-detail-id-line", children: /* @__PURE__ */ t("code", { className: "w6w-execution-detail-id", "data-testid": "execution-detail-id", children: e.id }) }),
1711
+ /* @__PURE__ */ o("dl", { className: "w6w-execution-detail-timing", children: [
1712
+ /* @__PURE__ */ t(fe, { label: "Started", value: X(e.startedAt) }),
1713
+ /* @__PURE__ */ t(
1714
+ fe,
1715
+ {
1716
+ label: "Finished",
1717
+ value: e.finishedAt ? X(e.finishedAt) : "—"
1718
+ }
1719
+ ),
1720
+ /* @__PURE__ */ t(fe, { label: "Duration", value: $e(e.durationMs) })
1721
+ ] }),
1722
+ e.steps !== void 0 && /* @__PURE__ */ o(
1723
+ "section",
1724
+ {
1725
+ className: "w6w-execution-detail-section w6w-stack",
1726
+ "data-testid": "execution-detail-steps",
1727
+ children: [
1728
+ /* @__PURE__ */ t("strong", { className: "w6w-small", children: "Steps" }),
1729
+ /* @__PURE__ */ t(ms, { steps: e.steps, emptyLabel: "No steps ran." })
1730
+ ]
1731
+ }
1732
+ ),
1733
+ e.input !== void 0 && /* @__PURE__ */ t(ve, { title: "Input", testid: "execution-detail-input", value: e.input }),
1734
+ e.output !== void 0 && /* @__PURE__ */ t(ve, { title: "Output", testid: "execution-detail-output", value: e.output }),
1735
+ e.error != null && /* @__PURE__ */ t(ve, { title: "Error", testid: "execution-detail-error", value: e.error })
1736
+ ] });
1737
+ }
1738
+ function fe({ label: e, value: s }) {
1739
+ return /* @__PURE__ */ o("div", { className: "w6w-execution-detail-timing-item", children: [
1740
+ /* @__PURE__ */ t("dt", { children: e }),
1741
+ /* @__PURE__ */ t("dd", { children: s })
1742
+ ] });
1743
+ }
1744
+ function ve({ title: e, testid: s, value: n }) {
1745
+ return /* @__PURE__ */ o("section", { className: "w6w-execution-detail-section w6w-stack", "data-testid": s, children: [
1746
+ /* @__PURE__ */ t("strong", { className: "w6w-small", children: e }),
1747
+ /* @__PURE__ */ t(ke, { code: ks(n), language: "json" })
1748
+ ] });
1749
+ }
1750
+ export {
1751
+ Ps as ActionTestForm,
1752
+ en as AddConnectionModal,
1753
+ Wt as ApiCallsPanel,
1754
+ ce as ApiError,
1755
+ tn as AppIcon,
1756
+ sn as AppPicker,
1757
+ nn as AuthFieldsForm,
1758
+ ke as CodeBlock,
1759
+ an as CodeEditor,
1760
+ _t as Combobox,
1761
+ Pt as ConfirmModal,
1762
+ qt as Copyable,
1763
+ Us as CopyableText,
1764
+ Ws as DeleteButton,
1765
+ Ks as EditButton,
1766
+ Ys as ExecutionDetail,
1767
+ Gs as ExecutionFilters,
1768
+ zs as ExecutionList,
1769
+ ms as ExecutionLogPanel,
1770
+ Qs as ExecutionStats,
1771
+ rn as ExpressionInput,
1772
+ ln as ExpressionOptionsProvider,
1773
+ Fs as HealthStatusPill,
1774
+ js as HistoryTimeline,
1775
+ ze as Icon,
1776
+ L as IconButton,
1777
+ qs as InfoTip,
1778
+ z as JsonEditor,
1779
+ Ne as ListItem,
1780
+ Ve as Modal,
1781
+ on as NodeConfigForm,
1782
+ Mt as ParamsForm,
1783
+ cn as PropertyEntryForm,
1784
+ Vs as RepoSyncIndicator,
1785
+ dn as RetryPolicyFields,
1786
+ Hs as ServerResourcesBadge,
1787
+ Bs as ServerResourcesCard,
1788
+ Js as ServerResourcesCardSmall,
1789
+ Ds as ServerResourcesRail,
1790
+ un as StepBuilderModal,
1791
+ Se as StepStatusPill,
1792
+ Ls as UptimeStrip,
1793
+ wn as W6WUIProvider,
1794
+ Is as YamlEditor,
1795
+ _s as createW6WApi,
1796
+ Qt as cropText,
1797
+ mn as filterOptions,
1798
+ $e as formatDurationMs,
1799
+ X as formatExecutionTime,
1800
+ xn as iconNames,
1801
+ hn as isExprValue,
1802
+ pn as isSecretValue,
1803
+ fn as isTestRequired,
1804
+ vn as requiredParamsFilled,
1805
+ yn as shouldUseCombobox,
1806
+ Nn as startOAuthPopup,
1807
+ gn as useEnterSubmit,
1808
+ bn as useExpressionOptions,
1809
+ Et as useW6WApi
1810
+ };
1811
+ //# sourceMappingURL=index.mjs.map