@w6w/embed 0.1.1 → 0.2.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 (148) hide show
  1. package/README.md +231 -4
  2. package/dist/ConfirmModal-RLbZT5_k.js +181 -0
  3. package/dist/ConfirmModal-RLbZT5_k.js.map +1 -0
  4. package/dist/CreateFunctionModal-DRsFx-FB.js +221 -0
  5. package/dist/CreateFunctionModal-DRsFx-FB.js.map +1 -0
  6. package/dist/DocumentFormModal-BExK1V-B.js +89 -0
  7. package/dist/DocumentFormModal-BExK1V-B.js.map +1 -0
  8. package/dist/ImportSpecModal-BDQIf6rg.js +136 -0
  9. package/dist/ImportSpecModal-BDQIf6rg.js.map +1 -0
  10. package/dist/W6WEmbedProvider.d.ts +22 -4
  11. package/dist/WorkflowEditor-DlbVv6Fs.js +854 -0
  12. package/dist/WorkflowEditor-DlbVv6Fs.js.map +1 -0
  13. package/dist/api-calls--JHyif6a.js +107 -0
  14. package/dist/api-calls--JHyif6a.js.map +1 -0
  15. package/dist/apps-1FNUwbGv.js +77 -0
  16. package/dist/apps-1FNUwbGv.js.map +1 -0
  17. package/dist/callables-3mFrMVG_.js +151 -0
  18. package/dist/callables-3mFrMVG_.js.map +1 -0
  19. package/dist/chrome/index.d.ts +6 -0
  20. package/dist/chrome/workspace.d.ts +29 -1
  21. package/dist/coerce-input-BicYr7nc.js +139 -0
  22. package/dist/coerce-input-BicYr7nc.js.map +1 -0
  23. package/dist/connections-CjjYeRqb.js +78 -0
  24. package/dist/connections-CjjYeRqb.js.map +1 -0
  25. package/dist/document-sources-C0grrtdq.js +86 -0
  26. package/dist/document-sources-C0grrtdq.js.map +1 -0
  27. package/dist/draft/index.d.ts +3 -1
  28. package/dist/draft/use-callable-draft.d.ts +65 -0
  29. package/dist/draft/workflow-save.d.ts +3 -0
  30. package/dist/draft.mjs +9 -5
  31. package/dist/draft.mjs.map +1 -1
  32. package/dist/editor/CallableEditorFrame.d.ts +33 -0
  33. package/dist/editor/EditorShell.d.ts +16 -0
  34. package/dist/editor/EndpointCards.d.ts +56 -0
  35. package/dist/editor/EndpointEditor.d.ts +26 -0
  36. package/dist/editor/FunctionEditor.d.ts +21 -0
  37. package/dist/editor/InputListEditor.d.ts +29 -0
  38. package/dist/editor/TargetSelector.d.ts +30 -0
  39. package/dist/editor/TargetSelector.types.d.ts +62 -0
  40. package/dist/editor/editor-apps.d.ts +8 -2
  41. package/dist/editor/types.d.ts +57 -0
  42. package/dist/editor-apps-BdenSV1o.js +95 -0
  43. package/dist/editor-apps-BdenSV1o.js.map +1 -0
  44. package/dist/editor-tools-RxmY5iyi.js +1279 -0
  45. package/dist/editor-tools-RxmY5iyi.js.map +1 -0
  46. package/dist/editor.mjs +2 -2166
  47. package/dist/editor.mjs.map +1 -1
  48. package/dist/editors/DocumentEditor.d.ts +20 -0
  49. package/dist/editors/doc-format.d.ts +3 -0
  50. package/dist/editors.d.ts +12 -0
  51. package/dist/editors.mjs +1313 -0
  52. package/dist/editors.mjs.map +1 -0
  53. package/dist/embed-status.d.ts +20 -0
  54. package/dist/endpoints-B2ynbZo-.js +227 -0
  55. package/dist/endpoints-B2ynbZo-.js.map +1 -0
  56. package/dist/forms/CreateEndpointModal.d.ts +54 -0
  57. package/dist/forms/CreateFunctionModal.d.ts +55 -0
  58. package/dist/forms/DocumentFormModal.d.ts +8 -0
  59. package/dist/forms/SecretsManager.d.ts +12 -0
  60. package/dist/forms/VarsManager.d.ts +29 -0
  61. package/dist/forms.d.ts +6 -0
  62. package/dist/forms.mjs +407 -0
  63. package/dist/forms.mjs.map +1 -0
  64. package/dist/index.d.ts +3 -1
  65. package/dist/index.mjs +153 -50
  66. package/dist/index.mjs.map +1 -1
  67. package/dist/lib/callable-record.d.ts +21 -0
  68. package/dist/lib/coerce-input.d.ts +6 -0
  69. package/dist/lib/endpoint-editor.d.ts +23 -0
  70. package/dist/lib/index.d.ts +7 -0
  71. package/dist/lib/input-coverage.d.ts +28 -0
  72. package/dist/lib/input-seeding.d.ts +67 -0
  73. package/dist/lib/rail-settings.d.ts +3 -3
  74. package/dist/lib/recent-activity.d.ts +128 -0
  75. package/dist/lib/target-fields.d.ts +168 -0
  76. package/dist/lib/workflow-blank.d.ts +2 -0
  77. package/dist/lib.mjs +70 -48
  78. package/dist/lib.mjs.map +1 -1
  79. package/dist/lists/ActivitySummary.d.ts +29 -0
  80. package/dist/lists/CallableKindList.d.ts +34 -0
  81. package/dist/lists/ConnectionDetail.d.ts +17 -0
  82. package/dist/lists/ConnectionList.d.ts +16 -0
  83. package/dist/lists/DocumentList.d.ts +29 -0
  84. package/dist/lists/EndpointList.d.ts +19 -0
  85. package/dist/lists/FunctionList.d.ts +18 -0
  86. package/dist/lists/ReliabilityBoard.d.ts +23 -0
  87. package/dist/lists/RunHistory.d.ts +11 -0
  88. package/dist/lists/ServiceDetail.d.ts +20 -0
  89. package/dist/lists/WorkflowList.d.ts +19 -0
  90. package/dist/lists/vendor-history.d.ts +40 -0
  91. package/dist/lists.d.ts +20 -0
  92. package/dist/lists.mjs +1185 -0
  93. package/dist/lists.mjs.map +1 -0
  94. package/dist/project-context-BiCjv_E3.js +25 -0
  95. package/dist/project-context-BiCjv_E3.js.map +1 -0
  96. package/dist/project-context.d.ts +15 -1
  97. package/dist/rail/CallableRail.d.ts +12 -0
  98. package/dist/rail/CallableWorkspace.d.ts +16 -0
  99. package/dist/rail/SettingsTool.d.ts +7 -1
  100. package/dist/rail/settings-sections.d.ts +2 -2
  101. package/dist/rail-settings-XYGToh00.js +111 -0
  102. package/dist/rail-settings-XYGToh00.js.map +1 -0
  103. package/dist/rail.d.ts +11 -0
  104. package/dist/rail.mjs +35 -0
  105. package/dist/rail.mjs.map +1 -0
  106. package/dist/repos/api-calls.d.ts +4 -0
  107. package/dist/repos/apps.d.ts +14 -0
  108. package/dist/repos/callables.d.ts +91 -0
  109. package/dist/repos/connections.d.ts +33 -0
  110. package/dist/repos/dashboard.d.ts +4 -0
  111. package/dist/repos/endpoints.d.ts +125 -0
  112. package/dist/repos/functions.d.ts +79 -0
  113. package/dist/repos/index.d.ts +10 -0
  114. package/dist/repos/reliability.d.ts +42 -0
  115. package/dist/repos/saved-tests.d.ts +46 -0
  116. package/dist/repos/spec-export.d.ts +23 -0
  117. package/dist/repos/workflows.d.ts +138 -0
  118. package/dist/repos.mjs +174 -88
  119. package/dist/repos.mjs.map +1 -1
  120. package/dist/settings-rail--GdRMusb.js +33 -0
  121. package/dist/settings-rail--GdRMusb.js.map +1 -0
  122. package/dist/slug-C4ktDPdy.js +315 -0
  123. package/dist/slug-C4ktDPdy.js.map +1 -0
  124. package/dist/spec-export-Cf3VQSQS.js +176 -0
  125. package/dist/spec-export-Cf3VQSQS.js.map +1 -0
  126. package/dist/spec-import-CjmxyZDR.js +465 -0
  127. package/dist/spec-import-CjmxyZDR.js.map +1 -0
  128. package/dist/step-tests-CivICmTq.js +18 -0
  129. package/dist/step-tests-CivICmTq.js.map +1 -0
  130. package/dist/trigger-preview-VPkrryDl.js +120 -0
  131. package/dist/trigger-preview-VPkrryDl.js.map +1 -0
  132. package/dist/use-callable-draft-zHLpcr-b.js +271 -0
  133. package/dist/use-callable-draft-zHLpcr-b.js.map +1 -0
  134. package/dist/{use-workflow-draft-oI02dsP-.js → use-workflow-draft-DzAyUeA6.js} +48 -46
  135. package/dist/use-workflow-draft-DzAyUeA6.js.map +1 -0
  136. package/dist/vault-BSEWhMYC.js +117 -0
  137. package/dist/vault-BSEWhMYC.js.map +1 -0
  138. package/dist/workflow-blank-DyL3_RUA.js +14 -0
  139. package/dist/workflow-blank-DyL3_RUA.js.map +1 -0
  140. package/package.json +21 -5
  141. package/src/styles.css +408 -1
  142. package/dist/project-context-Dbk0Gr1K.js +0 -16
  143. package/dist/project-context-Dbk0Gr1K.js.map +0 -1
  144. package/dist/slug-ByKQgxrf.js +0 -642
  145. package/dist/slug-ByKQgxrf.js.map +0 -1
  146. package/dist/spec-import-HgO7ZkLZ.js +0 -898
  147. package/dist/spec-import-HgO7ZkLZ.js.map +0 -1
  148. package/dist/use-workflow-draft-oI02dsP-.js.map +0 -1
package/dist/lists.mjs ADDED
@@ -0,0 +1,1185 @@
1
+ "use client";
2
+ import { jsxs as o, jsx as t, Fragment as T } from "react/jsx-runtime";
3
+ import { useState as $, useMemo as D, useEffect as Ne } from "react";
4
+ import { F as ve, E as be } from "./CreateFunctionModal-DRsFx-FB.js";
5
+ import { d as ke, a as Ce, b as $e, t as ne, n as W, r as Ie, j as Le } from "./endpoints-B2ynbZo-.js";
6
+ import { u as O, a as U } from "./project-context-BiCjv_E3.js";
7
+ import { CallableList as Ae, ReliabilityList as Me, EditButton as ae, DeleteButton as Te, ListItem as H, HealthStatusPill as Q, HistoryTimeline as De, useW6WApi as ie, connectionAppIdsToLookUp as se, ConnectionList as xe, AddConnectionModal as Ee, EditConnectionModal as le, ConfirmModal as Re, resolveConnectionAppMeta as je, ConnectionHeader as Se, IconButton as Qe } from "@w6w/ui";
8
+ import { I as Ke } from "./ImportSpecModal-BDQIf6rg.js";
9
+ import { i as Oe } from "./rail-settings-XYGToh00.js";
10
+ import { _ as _e, Y as re, I as Be, M as Fe, J as Pe, E as He } from "./spec-import-CjmxyZDR.js";
11
+ import { b as qe } from "./workflow-blank-DyL3_RUA.js";
12
+ import { f as We, e as G, g as Ue, b as Ve, h as Ye, i as Ze } from "./api-calls--JHyif6a.js";
13
+ import { C as ze, a as Je } from "./ConfirmModal-RLbZT5_k.js";
14
+ import { D as Ge } from "./DocumentFormModal-BExK1V-B.js";
15
+ import { H as Xe, a as oe } from "./editor-apps-BdenSV1o.js";
16
+ import { ApiError as ce } from "@w6w/sdk";
17
+ import { useQueryClient as de } from "@tanstack/react-query";
18
+ import { i as et, j as tt, b as q, c as ue, f as nt, k as at } from "./connections-CjjYeRqb.js";
19
+ import { d as it } from "./apps-1FNUwbGv.js";
20
+ function V(e) {
21
+ const { kind: n } = e, s = ke(n), [i, a] = $(!1), r = (e.rows ?? []).map((l) => ({
22
+ ...e.toRow(l),
23
+ id: l.id,
24
+ archived: Oe(l)
25
+ }));
26
+ return /* @__PURE__ */ o("div", { className: "w6w-embed-root", children: [
27
+ /* @__PURE__ */ t(
28
+ Ae,
29
+ {
30
+ rows: r,
31
+ title: s.listTitle,
32
+ description: s.listDescription,
33
+ emptyCopy: s.emptyCopy,
34
+ newLabel: s.newLabel,
35
+ openRowTitle: s.openRowTitle,
36
+ testIds: {
37
+ showArchived: s.showArchivedTestId,
38
+ importOpen: s.importOpenTestId,
39
+ archivedBadge: s.archivedBadgeTestId
40
+ },
41
+ loading: e.loading,
42
+ error: e.error,
43
+ onCreate: e.onCreate,
44
+ creating: e.creating,
45
+ onImport: () => a(!0),
46
+ onOpen: e.onOpen,
47
+ getHref: e.getHref,
48
+ slots: e.slots
49
+ }
50
+ ),
51
+ i && /* @__PURE__ */ t(
52
+ Ke,
53
+ {
54
+ kind: n,
55
+ project: e.project ?? void 0,
56
+ listKeys: { functionsKey: $e, endpointsKey: Ce, workflowsKey: _e },
57
+ onOpenImported: (l, u) => {
58
+ var h;
59
+ return (h = e.onOpen) == null ? void 0 : h.call(e, u);
60
+ },
61
+ onClose: () => a(!1)
62
+ }
63
+ ),
64
+ e.children
65
+ ] });
66
+ }
67
+ function zt(e) {
68
+ const n = ne(), s = O(e.project), [i, a] = $(null);
69
+ return /* @__PURE__ */ t(
70
+ V,
71
+ {
72
+ kind: "function",
73
+ rows: n.data,
74
+ loading: n.isLoading,
75
+ error: n.error ? String(n.error) : null,
76
+ project: s,
77
+ toRow: (r) => ({
78
+ title: r.displayName || r.key,
79
+ description: r.description,
80
+ badges: r.valid ? null : /* @__PURE__ */ t("span", { className: "w6w-callable-list-badge", children: "incomplete" })
81
+ }),
82
+ onOpen: e.onOpen,
83
+ getHref: e.getHref,
84
+ onCreate: () => a(W("function")),
85
+ slots: e.slots,
86
+ children: i !== null && /* @__PURE__ */ t(
87
+ ve,
88
+ {
89
+ newId: i,
90
+ takenKeys: (n.data ?? []).map((r) => r.key),
91
+ onClose: () => a(null),
92
+ onCreated: (r) => {
93
+ var l;
94
+ a(null), (l = e.onCreated) == null || l.call(e, r);
95
+ }
96
+ }
97
+ )
98
+ }
99
+ );
100
+ }
101
+ function Jt(e) {
102
+ const n = Ie(), s = O(e.project), [i, a] = $(null);
103
+ return /* @__PURE__ */ t(
104
+ V,
105
+ {
106
+ kind: "endpoint",
107
+ rows: n.data,
108
+ loading: n.isLoading,
109
+ error: n.error ? String(n.error) : null,
110
+ project: s,
111
+ toRow: (r) => ({
112
+ // The draft tag sits INSIDE the title, after the name: ui `ListItem` puts `badges` in
113
+ // a trailing `margin-left: auto` slot, which would strand it at the row's far edge.
114
+ title: /* @__PURE__ */ o(T, { children: [
115
+ /* @__PURE__ */ t("strong", { children: r.displayName || r.key }),
116
+ Le(r) ? /* @__PURE__ */ t(
117
+ "span",
118
+ {
119
+ className: "tag warn",
120
+ "data-testid": "endpoint-draft",
121
+ title: "No target configured yet — it cannot be invoked until one is set.",
122
+ children: "Unfinished"
123
+ }
124
+ ) : null
125
+ ] }),
126
+ description: r.description
127
+ }),
128
+ onOpen: e.onOpen,
129
+ getHref: e.getHref,
130
+ onCreate: () => a(W("endpoint")),
131
+ slots: e.slots,
132
+ children: i !== null && /* @__PURE__ */ t(
133
+ be,
134
+ {
135
+ newId: i,
136
+ takenKeys: (n.data ?? []).map((r) => r.key),
137
+ onClose: () => a(null),
138
+ onCreated: (r) => {
139
+ var l;
140
+ a(null), (l = e.onCreated) == null || l.call(e, r);
141
+ }
142
+ }
143
+ )
144
+ }
145
+ );
146
+ }
147
+ function Gt(e) {
148
+ const n = O(e.project), s = re(n ?? void 0, n != null), i = Be(n ?? void 0), [a, r] = $(null);
149
+ return /* @__PURE__ */ t(
150
+ V,
151
+ {
152
+ kind: "workflow",
153
+ rows: s.data,
154
+ loading: s.isLoading,
155
+ error: a ?? (s.error ? String(s.error) : null),
156
+ project: n,
157
+ toRow: (l) => ({
158
+ title: l.displayName || l.name,
159
+ description: l.description,
160
+ badges: /* @__PURE__ */ o(T, { children: [
161
+ l.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: l.tags.map((u) => /* @__PURE__ */ t("span", { className: "tag", children: u }, u)) }),
162
+ l.status !== "archived" && /* @__PURE__ */ t("span", { className: `badge wf-status ${l.status}`, children: l.status })
163
+ ] }),
164
+ trailing: /* @__PURE__ */ o("span", { className: "wf-col wf-col-stats muted small", children: [
165
+ l.runCount,
166
+ " ",
167
+ l.runCount === 1 ? "run" : "runs"
168
+ ] })
169
+ }),
170
+ onOpen: e.onOpen,
171
+ getHref: e.getHref,
172
+ onCreate: () => {
173
+ r(null), i.mutate(qe(W("workflow")), {
174
+ onSuccess: (l) => {
175
+ var u;
176
+ return (u = e.onCreated) == null ? void 0 : u.call(e, l.workflow.id);
177
+ },
178
+ onError: (l) => r(l instanceof Error ? l.message : String(l))
179
+ });
180
+ },
181
+ creating: i.isPending,
182
+ slots: e.slots
183
+ }
184
+ );
185
+ }
186
+ function Xt({
187
+ project: e,
188
+ variant: n = "full",
189
+ limit: s,
190
+ days: i = 30,
191
+ showChart: a,
192
+ getHref: r,
193
+ onOpen: l,
194
+ showAllHref: u,
195
+ onShowAll: h,
196
+ slots: f
197
+ }) {
198
+ var v, d;
199
+ const g = U().project, m = e === void 0 ? g : e, b = m || null, y = We(b ?? void 0, i);
200
+ let p = f == null ? void 0 : f.empty;
201
+ return b ? y.isLoading ? p = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : y.error && (p = /* @__PURE__ */ t("div", { className: "error", children: y.error.message })) : p = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
202
+ Me,
203
+ {
204
+ services: b ? ((v = y.data) == null ? void 0 : v.services) ?? [] : [],
205
+ window: b ? (d = y.data) == null ? void 0 : d.window : void 0,
206
+ days: i,
207
+ compact: n === "compact",
208
+ showChart: a,
209
+ limit: s,
210
+ getHref: r,
211
+ onOpen: l,
212
+ showAllHref: u,
213
+ onShowAll: h,
214
+ slots: { ...f, empty: p }
215
+ }
216
+ ) });
217
+ }
218
+ function st(e) {
219
+ const n = e.replace(/\s+/g, " ").trim();
220
+ return n.length > 80 ? `${n.slice(0, 80)}…` : n;
221
+ }
222
+ function en({ project: e, onOpen: n, getHref: s, slots: i, rowSlots: a }) {
223
+ var p, v;
224
+ const r = O(e), l = Fe(r ?? void 0, r != null), u = Pe(), [h, f] = $(null), [g, m] = $(null), b = (i == null ? void 0 : i.header) === void 0 ? /* @__PURE__ */ o("div", { children: [
225
+ /* @__PURE__ */ t("h3", { children: "Documents" }),
226
+ /* @__PURE__ */ t("p", { className: "muted small", children: "Each document is free-form content stored verbatim." })
227
+ ] }) : i.header, y = (i == null ? void 0 : i.empty) === void 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No documents yet." }) : i.empty;
228
+ return /* @__PURE__ */ o("div", { className: "w6w-embed-root", children: [
229
+ /* @__PURE__ */ o("section", { className: "section", children: [
230
+ /* @__PURE__ */ o("div", { className: "section-head", children: [
231
+ b,
232
+ /* @__PURE__ */ t(
233
+ "button",
234
+ {
235
+ type: "button",
236
+ className: "btn",
237
+ disabled: r == null,
238
+ onClick: () => f({ mode: "create" }),
239
+ children: "+ Add document"
240
+ }
241
+ )
242
+ ] }),
243
+ /* @__PURE__ */ o("div", { className: "card", children: [
244
+ l.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
245
+ ((p = l.data) == null ? void 0 : p.length) === 0 && y,
246
+ /* @__PURE__ */ t("ul", { className: "list", children: (v = l.data) == null ? void 0 : v.map((d) => {
247
+ var w, M, R;
248
+ const N = (w = a == null ? void 0 : a.lead) == null ? void 0 : w.call(a, d), A = /* @__PURE__ */ o(T, { children: [
249
+ N,
250
+ /* @__PURE__ */ o(
251
+ "div",
252
+ {
253
+ className: "list-main",
254
+ style: { marginLeft: N != null ? "var(--w6w-sp-2)" : 0 },
255
+ children: [
256
+ /* @__PURE__ */ t("strong", { className: "list-name", title: d.key, children: d.key }),
257
+ " ",
258
+ /* @__PURE__ */ t("span", { className: "tag", children: d.format }),
259
+ /* @__PURE__ */ o("div", { className: "muted small list-preview", children: [
260
+ /* @__PURE__ */ t("code", { children: st(d.content) }),
261
+ d.description && /* @__PURE__ */ o(T, { children: [
262
+ " · ",
263
+ d.description
264
+ ] })
265
+ ] })
266
+ ]
267
+ }
268
+ )
269
+ ] }), I = (M = a == null ? void 0 : a.footer) == null ? void 0 : M.call(a, d);
270
+ return /* @__PURE__ */ o("li", { className: "linked", style: { flexWrap: "wrap" }, children: [
271
+ s ? /* @__PURE__ */ t(
272
+ "a",
273
+ {
274
+ className: "list-link",
275
+ href: s(d.id),
276
+ onClick: (L) => n == null ? void 0 : n(d.id, L),
277
+ style: { display: "flex", alignItems: "center" },
278
+ children: A
279
+ }
280
+ ) : /* @__PURE__ */ t(
281
+ "button",
282
+ {
283
+ type: "button",
284
+ className: "list-link",
285
+ onClick: (L) => n == null ? void 0 : n(d.id, L),
286
+ style: { display: "flex", alignItems: "center" },
287
+ children: A
288
+ }
289
+ ),
290
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)" }, children: [
291
+ /* @__PURE__ */ t(ze, { resource: { kind: "document", key: d.key } }),
292
+ d.shared ? (R = a == null ? void 0 : a.sharedActions) == null ? void 0 : R.call(a, d) : /* @__PURE__ */ o(T, { children: [
293
+ /* @__PURE__ */ t(
294
+ ae,
295
+ {
296
+ label: "Edit",
297
+ onClick: () => f({ mode: "edit", d }),
298
+ "data-testid": `document-edit-${d.id}`
299
+ }
300
+ ),
301
+ /* @__PURE__ */ t(
302
+ Te,
303
+ {
304
+ label: "Delete",
305
+ onClick: () => m(d),
306
+ disabled: u.isPending,
307
+ "data-testid": `document-delete-${d.id}`
308
+ }
309
+ )
310
+ ] })
311
+ ] }),
312
+ I != null && /* @__PURE__ */ t("div", { style: { flexBasis: "100%" }, children: I })
313
+ ] }, d.id);
314
+ }) })
315
+ ] })
316
+ ] }),
317
+ h && /* @__PURE__ */ t(
318
+ Ge,
319
+ {
320
+ initial: h.mode === "edit" ? h.d : void 0,
321
+ project: r,
322
+ onClose: () => f(null),
323
+ onSaved: () => f(null)
324
+ }
325
+ ),
326
+ g && /* @__PURE__ */ t(
327
+ Je,
328
+ {
329
+ title: "Delete document",
330
+ message: `Delete the document "${g.key}"? This cannot be undone.`,
331
+ confirmLabel: "Delete",
332
+ onConfirm: () => {
333
+ r != null && u.mutate({ id: g.id, project: r }), m(null);
334
+ },
335
+ onClose: () => m(null)
336
+ }
337
+ )
338
+ ] });
339
+ }
340
+ const lt = {
341
+ workflow: "Workflow run",
342
+ workflow_step: "Workflow step",
343
+ connection_test: "Connection test",
344
+ node_debug: "Node debug",
345
+ // The synchronous arms, which joined the ledger with `0065_invocations`.
346
+ // Without these three the rollup would render raw column values.
347
+ function: "Function call",
348
+ endpoint: "Endpoint call",
349
+ action: "App action"
350
+ };
351
+ function K(e) {
352
+ return lt[e] ?? e;
353
+ }
354
+ const me = {
355
+ workflow: "workflow",
356
+ workflow_step: "workflow_step",
357
+ connection_test: "base",
358
+ node_debug: "base",
359
+ function: "function",
360
+ endpoint: "base",
361
+ action: "base"
362
+ };
363
+ function rt(e) {
364
+ return Object.hasOwn(me, e);
365
+ }
366
+ function he(e) {
367
+ return rt(e) ? me[e] : "base";
368
+ }
369
+ function ot(e, n) {
370
+ const s = /* @__PURE__ */ new Map();
371
+ for (const a of e ?? []) {
372
+ const r = a.displayName || a.key;
373
+ r && s.set(a.id, r);
374
+ }
375
+ const i = /* @__PURE__ */ new Map();
376
+ for (const a of n ?? []) {
377
+ const r = a.displayName || a.name;
378
+ r && i.set(a.id, r);
379
+ }
380
+ return { functions: s, workflows: i };
381
+ }
382
+ function ct(e, n) {
383
+ const s = e.summary ?? K(e.kind), i = he(e.kind);
384
+ if (i === "function" && e.functionId !== null) {
385
+ const a = n.functions.get(e.functionId);
386
+ if (a !== void 0)
387
+ return { text: a, target: { kind: "function", id: e.functionId } };
388
+ }
389
+ if (i === "workflow" && e.workflowId !== null) {
390
+ const a = n.workflows.get(e.workflowId);
391
+ if (a !== void 0)
392
+ return { text: a, target: { kind: "workflow", id: e.workflowId } };
393
+ }
394
+ if (i === "workflow_step") {
395
+ const a = e.workflowId, r = a !== null ? n.workflows.get(a) : void 0, l = r ?? a ?? e.summary ?? "Unknown workflow", u = r !== void 0 && a !== null;
396
+ return {
397
+ text: e.stepId ? `${l} - ${e.stepId}` : l,
398
+ target: u ? { kind: "workflow", id: a } : null
399
+ };
400
+ }
401
+ return { text: s, target: null };
402
+ }
403
+ const E = (e) => String(e).padStart(2, "0");
404
+ function dt(e) {
405
+ const n = new Date(e);
406
+ return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${E(n.getMonth() + 1)}-${E(n.getDate())}`} ${E(n.getHours())}:${E(n.getMinutes())}:${E(n.getSeconds())}`;
407
+ }
408
+ function ut(e) {
409
+ return e == null || !Number.isFinite(e) || e < 0 ? null : e < 1e3 ? `${Math.round(e)} ms` : e < 6e4 ? `${(Math.floor(e / 100) / 10).toFixed(1)} s` : `${Math.floor(e / 6e4)}m ${Math.floor(e % 6e4 / 1e3)}s`;
410
+ }
411
+ function mt() {
412
+ const e = /* @__PURE__ */ new Date();
413
+ return e.setHours(0, 0, 0, 0), e.toISOString();
414
+ }
415
+ function ht(e, n) {
416
+ const s = new Date(e);
417
+ if (Number.isNaN(s.getTime())) return e;
418
+ const i = s.toLocaleDateString(void 0, { month: "short", day: "numeric" });
419
+ return n === "week" ? `Week of ${i}` : i;
420
+ }
421
+ function we({ ok: e }) {
422
+ return e === null ? /* @__PURE__ */ t("span", { className: "muted", children: "–" }) : /* @__PURE__ */ t("span", { className: e ? "ok" : "error", children: e ? "✓" : "✗" });
423
+ }
424
+ function B({ label: e, value: n }) {
425
+ return /* @__PURE__ */ o("div", { className: "w6w-activity-card w6w-activity-stat", children: [
426
+ /* @__PURE__ */ t("div", { className: "w6w-activity-stat-value", children: n }),
427
+ /* @__PURE__ */ t("div", { className: "muted small", children: e })
428
+ ] });
429
+ }
430
+ function X({
431
+ title: e,
432
+ headline: n,
433
+ loading: s
434
+ }) {
435
+ const i = n ?? { workflowRuns: 0, succeeded: 0, failed: 0 };
436
+ return /* @__PURE__ */ o("section", { className: "w6w-activity-section", children: [
437
+ /* @__PURE__ */ t("h3", { children: e }),
438
+ s ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ o("div", { className: "w6w-activity-stats", children: [
439
+ /* @__PURE__ */ t(B, { label: "Workflow runs", value: i.workflowRuns }),
440
+ /* @__PURE__ */ t(B, { label: "Succeeded", value: i.succeeded }),
441
+ /* @__PURE__ */ t(B, { label: "Failed", value: i.failed })
442
+ ] })
443
+ ] });
444
+ }
445
+ function wt({
446
+ entry: e,
447
+ names: n,
448
+ getHref: s,
449
+ onOpen: i
450
+ }) {
451
+ const { text: a, target: r } = ct(e, n);
452
+ if (r === null) return /* @__PURE__ */ t(T, { children: a });
453
+ const l = i ? (u) => i(r, u) : void 0;
454
+ return s ? /* @__PURE__ */ t("a", { href: s(r), onClick: l, children: a }) : l ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: l, children: a }) : /* @__PURE__ */ t(T, { children: a });
455
+ }
456
+ function fe({ entry: e, title: n }) {
457
+ const s = ut(e.durationMs);
458
+ return /* @__PURE__ */ t(
459
+ H,
460
+ {
461
+ icon: /* @__PURE__ */ t(we, { ok: e.ok }),
462
+ title: n ?? e.summary ?? K(e.kind),
463
+ subtitle: `${K(e.kind)} · ${dt(e.occurredAt)}`,
464
+ trailing: s === null ? void 0 : /* @__PURE__ */ t("span", { className: "muted small", children: s })
465
+ }
466
+ );
467
+ }
468
+ function F(e) {
469
+ return /* @__PURE__ */ t(fe, { entry: e.entry, title: /* @__PURE__ */ t(wt, { ...e }) });
470
+ }
471
+ const ft = {
472
+ base: (e) => /* @__PURE__ */ t(fe, { entry: e.entry }),
473
+ function: F,
474
+ workflow: F,
475
+ workflow_step: F
476
+ };
477
+ function pt(e) {
478
+ const n = ft[he(e.entry.kind)];
479
+ return /* @__PURE__ */ t(n, { ...e });
480
+ }
481
+ function tn({ getHref: e, onOpen: n, slots: s }) {
482
+ var p, v, d, N, A, I;
483
+ const i = G("today", { from: mt(), bucket: "day" }), a = G("week", { bucket: "week" }), r = ne(), l = re(), u = D(
484
+ () => ot(r.data, l.data),
485
+ [r.data, l.data]
486
+ ), h = i.error ?? a.error, f = h ? h.message : null, g = ((p = a.data) == null ? void 0 : p.recent) ?? [], m = ((v = a.data) == null ? void 0 : v.series) ?? [], b = ((d = a.data) == null ? void 0 : d.range.bucket) ?? "week", y = !a.isLoading && g.length === 0 && (((N = a.data) == null ? void 0 : N.headline.workflowRuns) ?? 0) === 0;
487
+ return /* @__PURE__ */ o("div", { className: "w6w-embed-root", children: [
488
+ f && /* @__PURE__ */ t("div", { className: "error", children: f }),
489
+ s == null ? void 0 : s.header,
490
+ s == null ? void 0 : s.actions,
491
+ /* @__PURE__ */ t(
492
+ X,
493
+ {
494
+ title: "Today",
495
+ headline: (A = i.data) == null ? void 0 : A.headline,
496
+ loading: i.isLoading
497
+ }
498
+ ),
499
+ /* @__PURE__ */ t(
500
+ X,
501
+ {
502
+ title: "Last 7 days",
503
+ headline: (I = a.data) == null ? void 0 : I.headline,
504
+ loading: a.isLoading
505
+ }
506
+ ),
507
+ s == null ? void 0 : s.betweenHeadlineAndSeries,
508
+ /* @__PURE__ */ o("section", { className: "w6w-activity-section", children: [
509
+ /* @__PURE__ */ t("h3", { children: "Activity over time" }),
510
+ /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: a.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : m.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: m.map((w) => /* @__PURE__ */ o("li", { children: [
511
+ /* @__PURE__ */ o("span", { className: "list-main", children: [
512
+ /* @__PURE__ */ t("strong", { children: ht(w.bucket, b) }),
513
+ " ",
514
+ /* @__PURE__ */ t("span", { className: "muted small", children: K(w.kind) })
515
+ ] }),
516
+ " ",
517
+ /* @__PURE__ */ t(we, { ok: w.ok }),
518
+ " ",
519
+ /* @__PURE__ */ t("span", { className: "muted small", children: w.count })
520
+ ] }, `${w.bucket}-${w.kind}-${String(w.ok)}`)) }) })
521
+ ] }),
522
+ /* @__PURE__ */ o("section", { children: [
523
+ /* @__PURE__ */ t("h3", { className: "w6w-activity-h3", children: "Recent activity" }),
524
+ /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: a.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : y ? (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ t("p", { className: "muted", children: "No runs yet — activity shows up here once your workflows run." }) : g.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No recent activity in this window." }) : /* @__PURE__ */ t("div", { className: "list", children: g.map((w) => /* @__PURE__ */ t(
525
+ pt,
526
+ {
527
+ entry: w,
528
+ names: u,
529
+ getHref: e,
530
+ onOpen: n
531
+ },
532
+ w.id
533
+ )) }) })
534
+ ] })
535
+ ] });
536
+ }
537
+ function gt(e) {
538
+ return e !== null && "project" in e;
539
+ }
540
+ function nn(e) {
541
+ const n = U().project, [s, i] = $(He), a = e.scope !== void 0 ? e.scope : n ? { project: n } : null, r = e.filters !== void 0, l = e.filters ?? s, u = (h) => {
542
+ var f;
543
+ r || i(h), (f = e.onFiltersChange) == null || f.call(e, h);
544
+ };
545
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
546
+ Xe,
547
+ {
548
+ scope: a,
549
+ showKind: e.showKind ?? gt(a),
550
+ filters: l,
551
+ onFiltersChange: u,
552
+ onOpenInEditor: e.onOpenInEditor
553
+ }
554
+ ) });
555
+ }
556
+ const yt = 1440 * 60 * 1e3;
557
+ function Nt(e) {
558
+ if (!(e === null || e.timeline === null))
559
+ return e.timeline.map((n) => ({
560
+ id: n.id,
561
+ title: n.title,
562
+ state: n.state,
563
+ startedAt: n.startedAt,
564
+ updatedAt: n.updatedAt,
565
+ resolvedAt: n.resolvedAt,
566
+ components: n.components,
567
+ link: n.link
568
+ }));
569
+ }
570
+ function pe(e) {
571
+ return e.startedAt !== void 0 && e.resolvedAt === void 0;
572
+ }
573
+ function ee(e) {
574
+ const n = new Date(e);
575
+ return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone: "UTC" });
576
+ }
577
+ function te(e, n) {
578
+ const s = new Date(e).getTime();
579
+ return Number.isNaN(s) ? 0 : Math.max(0, Math.floor((n - s) / yt));
580
+ }
581
+ function vt(e, n) {
582
+ if (!pe(e) || e.startedAt === void 0) return null;
583
+ const s = te(e.startedAt, n), i = ee(e.startedAt), a = s === 0 ? `open since ${i} (today)` : `open ${s}d (since ${i})`, r = e.updatedAt ?? e.startedAt, l = te(r, n), u = ee(r), h = l === 0 ? `last update ${u} (today)` : `last update ${u} (${l}d ago)`;
584
+ return `${a} · ${h}`;
585
+ }
586
+ function bt(e) {
587
+ return e ? Object.entries(e) : [];
588
+ }
589
+ function kt(e) {
590
+ return e.uptime.map((n) => ({ day: n.day, state: n.state }));
591
+ }
592
+ const x = [
593
+ ["e4xx", "4xx"],
594
+ ["e429", "429 rate-limited"],
595
+ ["eAuth", "auth (401/403)"],
596
+ ["e5xx", "5xx"]
597
+ ];
598
+ function ge(e) {
599
+ const n = new Date(e);
600
+ return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString(void 0, { month: "short", day: "numeric" });
601
+ }
602
+ function Y(e) {
603
+ if (!e) return "—";
604
+ const n = new Date(e);
605
+ return Number.isNaN(n.getTime()) ? e : n.toLocaleString(void 0, {
606
+ month: "short",
607
+ day: "numeric",
608
+ hour: "numeric",
609
+ minute: "2-digit"
610
+ });
611
+ }
612
+ function S({ label: e, value: n, hint: s }) {
613
+ return /* @__PURE__ */ o("div", { className: "w6w-rel-card", style: { flex: "1 1 150px", minWidth: 150 }, children: [
614
+ /* @__PURE__ */ t("div", { style: { fontSize: "1.6rem", fontWeight: "var(--w6w-fw-semibold)", lineHeight: 1.15 }, children: n }),
615
+ /* @__PURE__ */ t("div", { className: "muted small", children: e }),
616
+ s && /* @__PURE__ */ t("div", { className: "muted small", children: s })
617
+ ] });
618
+ }
619
+ function Ct({
620
+ vendor: e,
621
+ displayName: n
622
+ }) {
623
+ if (!e)
624
+ return /* @__PURE__ */ o("div", { className: "w6w-rel-card", children: [
625
+ /* @__PURE__ */ o("h4", { style: { margin: "0 0 var(--w6w-sp-1)" }, children: [
626
+ n,
627
+ " status"
628
+ ] }),
629
+ /* @__PURE__ */ o("p", { className: "muted", children: [
630
+ n,
631
+ " publishes no public health check, so there is nothing to ask about it. That is a statement about ",
632
+ n,
633
+ ", not a gap in the data above."
634
+ ] })
635
+ ] });
636
+ const s = e.state === "unknown", i = bt(e.components), a = (e.timeline ?? []).filter(pe), r = Date.now();
637
+ return /* @__PURE__ */ o("div", { className: "w6w-rel-card", children: [
638
+ /* @__PURE__ */ o("h4", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
639
+ n,
640
+ " status",
641
+ " ",
642
+ /* @__PURE__ */ t(Q, { state: e.state, label: s ? "Unavailable" : void 0 })
643
+ ] }),
644
+ s && /* @__PURE__ */ t("p", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "We could not get a status from this API, so we cannot say whether it is up. That is separate from your own calls above, which are measured here regardless." }),
645
+ e.message && /* @__PURE__ */ t(
646
+ "p",
647
+ {
648
+ className: s ? "muted small" : void 0,
649
+ style: { margin: "0 0 var(--w6w-sp-2)" },
650
+ children: e.message
651
+ }
652
+ ),
653
+ /* @__PURE__ */ o("p", { className: "muted small", style: { margin: 0 }, children: [
654
+ s ? "Tried to read" : "Read from",
655
+ " ",
656
+ n,
657
+ "'s own status page — what",
658
+ " ",
659
+ n,
660
+ " says about itself, not what your calls did · last checked",
661
+ " ",
662
+ Y(e.checkedAt),
663
+ e.attributedTo.length > 0 && /* @__PURE__ */ o(T, { children: [
664
+ " ",
665
+ "· decided by",
666
+ " ",
667
+ e.attributedTo.map((l) => /* @__PURE__ */ t("code", { children: l }, l))
668
+ ] })
669
+ ] }),
670
+ i.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: i.map(([l, u]) => /* @__PURE__ */ o("span", { className: "w6w-rel-tag", children: [
671
+ l,
672
+ ": ",
673
+ u.state
674
+ ] }, l)) }),
675
+ a.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: a.map((l) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ o("div", { className: "list-main", children: [
676
+ /* @__PURE__ */ t("strong", { children: l.title }),
677
+ " ",
678
+ /* @__PURE__ */ t(Q, { state: l.state }),
679
+ /* @__PURE__ */ t("div", { className: "muted small", children: vt(l, r) })
680
+ ] }) }, l.id ?? l.title)) }),
681
+ e.statusPageUrl !== null && /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: /* @__PURE__ */ o("a", { href: e.statusPageUrl, target: "_blank", rel: "noopener noreferrer", children: [
682
+ n,
683
+ "'s status page ↗"
684
+ ] }) })
685
+ ] });
686
+ }
687
+ function $t({ service: e }) {
688
+ if (e.calls === 0)
689
+ return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("span", { className: "w6w-rel-idle-note", children: "No calls in this window" }) });
690
+ const n = e.uptime, s = Math.max(1, ...n.map((i) => i.calls));
691
+ return /* @__PURE__ */ o("div", { className: "w6w-rel-card", children: [
692
+ /* @__PURE__ */ t(
693
+ "div",
694
+ {
695
+ className: "rel-daily-chart",
696
+ role: "img",
697
+ "aria-label": `${e.displayName}, calls per day, oldest first`,
698
+ children: n.map((i) => /* @__PURE__ */ t(
699
+ "span",
700
+ {
701
+ className: `rel-daily-bar rel-daily-bar-${i.state}`,
702
+ style: { height: `${i.calls > 0 ? Math.max(i.calls / s * 100, 4) : 2}%` },
703
+ title: `${ge(`${i.day}T00:00:00.000Z`)} — ${i.calls} calls, ${i.state}`
704
+ },
705
+ i.day
706
+ ))
707
+ }
708
+ ),
709
+ /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: "Calls per day, oldest first. Bar colour is that day's own state." })
710
+ ] });
711
+ }
712
+ function It({
713
+ service: e,
714
+ window: n
715
+ }) {
716
+ const s = [...e.uptime].reverse().filter((l) => l.calls > 0), i = e.vendorStatus, a = Nt(i), r = a === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
717
+ return /* @__PURE__ */ o("div", { className: "w6w-rel-card", children: [
718
+ /* @__PURE__ */ t(
719
+ De,
720
+ {
721
+ window: n,
722
+ days: kt(e),
723
+ incidents: a,
724
+ vendorEmptyLabel: r,
725
+ ariaLabel: `${e.displayName}, ${e.uptime.length}-day status and ${e.displayName} incidents, oldest day first`
726
+ }
727
+ ),
728
+ /* @__PURE__ */ o("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: [
729
+ "Oldest day leftmost. Days with no calls are ",
730
+ /* @__PURE__ */ t("code", { children: "unknown" }),
731
+ " — never a quiet green."
732
+ ] }),
733
+ s.length > 0 && /* @__PURE__ */ t("div", { className: "list", style: { marginTop: "var(--w6w-sp-3)" }, children: s.slice(0, 14).map((l) => /* @__PURE__ */ o("div", { className: "rel-day-row", children: [
734
+ /* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: ge(`${l.day}T00:00:00.000Z`) }) }),
735
+ /* @__PURE__ */ t(Q, { state: l.state }),
736
+ /* @__PURE__ */ o("span", { className: "muted small", children: [
737
+ l.calls,
738
+ " calls"
739
+ ] }),
740
+ /* @__PURE__ */ t("span", { className: "rel-errors", children: x.filter(([u]) => l.errors[u] > 0).map(([u, h]) => /* @__PURE__ */ o("span", { className: "w6w-rel-tag", children: [
741
+ h,
742
+ " ×",
743
+ l.errors[u]
744
+ ] }, u)) })
745
+ ] }, l.day)) })
746
+ ] });
747
+ }
748
+ function Lt({ errors: e }) {
749
+ if (x.reduce((i, [a]) => i + e[a], 0) === 0)
750
+ return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("p", { className: "muted", style: { margin: 0 }, children: "No errors in this window." }) });
751
+ const s = Math.max(1, ...x.map(([i]) => e[i]));
752
+ return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: x.map(([i, a]) => /* @__PURE__ */ o("div", { className: "rel-errormix-row", children: [
753
+ /* @__PURE__ */ t("span", { className: "muted small", children: a }),
754
+ /* @__PURE__ */ t("span", { className: "rel-errormix-track", children: /* @__PURE__ */ t(
755
+ "span",
756
+ {
757
+ className: "rel-errormix-bar",
758
+ style: { width: `${Math.max(e[i] / s * 100, e[i] > 0 ? 2 : 0)}%` }
759
+ }
760
+ ) }),
761
+ /* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[i] })
762
+ ] }, i)) });
763
+ }
764
+ function At({ project: e, appId: n }) {
765
+ const s = Ve(e, n, { limit: 50 });
766
+ if (s.isLoading) return /* @__PURE__ */ t("p", { className: "muted", children: "Loading calls…" });
767
+ if (s.error) {
768
+ const a = s.error;
769
+ return /* @__PURE__ */ t("div", { className: "error", children: (a instanceof ce, a.message) });
770
+ }
771
+ const i = s.data ?? [];
772
+ return i.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No calls captured for this service. Calls appear here once a workflow, function or ad-hoc invoke reaches it." }) : /* @__PURE__ */ o("div", { className: "rel-calls", children: [
773
+ /* @__PURE__ */ o("div", { className: "rel-call rel-call-head", children: [
774
+ /* @__PURE__ */ t("span", { children: "When" }),
775
+ /* @__PURE__ */ t("span", { children: "Action" }),
776
+ /* @__PURE__ */ t("span", { children: "Method" }),
777
+ /* @__PURE__ */ t("span", { children: "Status" }),
778
+ /* @__PURE__ */ t("span", { children: "Took" })
779
+ ] }),
780
+ i.map((a, r) => /* @__PURE__ */ o("div", { className: "rel-call", children: [
781
+ /* @__PURE__ */ t("span", { className: "muted small", children: Y(a.createdAt) }),
782
+ /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: a.actionKey ?? "—" }) }),
783
+ /* @__PURE__ */ t("span", { className: "muted small", children: a.method }),
784
+ /* @__PURE__ */ t("span", { className: a.status >= 400 || a.status === 0 ? "error" : "ok", children: a.status === 0 ? "no response" : a.status }),
785
+ /* @__PURE__ */ t("span", { className: "muted small", children: a.durationMs != null ? `${a.durationMs} ms` : "—" })
786
+ ] }, a.id ?? `${a.createdAt}-${r}`))
787
+ ] });
788
+ }
789
+ function Mt({
790
+ backHref: e,
791
+ onBack: n
792
+ }) {
793
+ return e !== void 0 ? /* @__PURE__ */ t("p", { children: /* @__PURE__ */ t("a", { href: e, onClick: n, children: "← Back to all services" }) }) : n ? /* @__PURE__ */ t("p", { children: /* @__PURE__ */ t("button", { type: "button", className: "list-link", onClick: n, children: "← Back to all services" }) }) : null;
794
+ }
795
+ function an({
796
+ appId: e,
797
+ project: n,
798
+ days: s = 30,
799
+ backHref: i,
800
+ onBack: a,
801
+ slots: r
802
+ }) {
803
+ var b, y, p, v;
804
+ const l = U().project, u = (n === void 0 ? l : n) || void 0, h = Ue(u, [e], s), f = h.error, g = f ? (f instanceof ce, f.message) : null, m = (b = h.data) == null ? void 0 : b.services.find((d) => d.appId === e);
805
+ return /* @__PURE__ */ o("div", { className: "w6w-embed-root", children: [
806
+ r == null ? void 0 : r.header,
807
+ r == null ? void 0 : r.actions,
808
+ !u && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see this service." }),
809
+ g && /* @__PURE__ */ t("div", { className: "error", children: g }),
810
+ u && h.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
811
+ h.data && !m && /* @__PURE__ */ o("div", { className: "w6w-rel-card", children: [
812
+ (r == null ? void 0 : r.empty) ?? /* @__PURE__ */ o("p", { className: "muted", children: [
813
+ /* @__PURE__ */ t("code", { children: e }),
814
+ " is not used by this project's definitions and has no calls in the last ",
815
+ s,
816
+ " days."
817
+ ] }),
818
+ /* @__PURE__ */ t(Mt, { backHref: i, onBack: a })
819
+ ] }),
820
+ m && /* @__PURE__ */ o(T, { children: [
821
+ /* @__PURE__ */ o("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
822
+ /* @__PURE__ */ o(
823
+ "div",
824
+ {
825
+ style: {
826
+ display: "flex",
827
+ alignItems: "center",
828
+ gap: "var(--w6w-sp-3)",
829
+ marginBottom: "var(--w6w-sp-3)"
830
+ },
831
+ children: [
832
+ /* @__PURE__ */ t(Q, { state: m.state }),
833
+ /* @__PURE__ */ t("span", { className: "muted small", children: "from your calls" }),
834
+ /* @__PURE__ */ t("code", { className: "muted small", children: m.appId }),
835
+ m.ongoingOutageId && /* @__PURE__ */ t("span", { className: "w6w-rel-tag", children: "outage still open" })
836
+ ]
837
+ }
838
+ ),
839
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: "var(--w6w-sp-3)", flexWrap: "wrap" }, children: [
840
+ /* @__PURE__ */ t(S, { label: "Calls in window", value: String(m.calls) }),
841
+ /* @__PURE__ */ t(
842
+ S,
843
+ {
844
+ label: "p95 latency",
845
+ value: m.p95Ms === null ? "—" : `${m.p95Ms} ms`,
846
+ hint: m.p95Ms === null ? "no timed calls" : void 0
847
+ }
848
+ ),
849
+ /* @__PURE__ */ t(S, { label: "Last call", value: Y(m.lastCallAt) }),
850
+ /* @__PURE__ */ t(
851
+ S,
852
+ {
853
+ label: "Errors",
854
+ value: String(x.reduce((d, [N]) => d + m.errors[N], 0)),
855
+ hint: x.filter(([d]) => m.errors[d] > 0).map(([d, N]) => `${N} ×${m.errors[d]}`).join(" · ") || "none"
856
+ }
857
+ )
858
+ ] })
859
+ ] }),
860
+ /* @__PURE__ */ o("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
861
+ /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "Error mix" }),
862
+ /* @__PURE__ */ t(Lt, { errors: m.errors })
863
+ ] }),
864
+ /* @__PURE__ */ o("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
865
+ /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "API status" }),
866
+ /* @__PURE__ */ t(Ct, { vendor: m.vendorStatus, displayName: m.displayName })
867
+ ] }),
868
+ /* @__PURE__ */ o("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
869
+ /* @__PURE__ */ o("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
870
+ "Last ",
871
+ ((y = h.data) == null ? void 0 : y.window.days) ?? s,
872
+ " days",
873
+ " ",
874
+ /* @__PURE__ */ o("span", { className: "muted small", children: [
875
+ "uptime means ",
876
+ (p = h.data) == null ? void 0 : p.uptimeMeans
877
+ ] })
878
+ ] }),
879
+ /* @__PURE__ */ t(It, { service: m, window: ((v = h.data) == null ? void 0 : v.window) ?? { from: "", to: "" } }),
880
+ /* @__PURE__ */ t($t, { service: m })
881
+ ] }),
882
+ /* @__PURE__ */ o("section", { children: [
883
+ /* @__PURE__ */ o("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
884
+ "Recent calls",
885
+ " ",
886
+ /* @__PURE__ */ t("span", { className: "muted small", children: "the requests behind the numbers above" })
887
+ ] }),
888
+ /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(At, { project: u, appId: m.appId }) })
889
+ ] })
890
+ ] })
891
+ ] });
892
+ }
893
+ const Tt = [];
894
+ function sn({ onOpen: e, getHref: n, addLabel: s, slots: i }) {
895
+ const a = ie(), r = de(), l = et(), h = l.data ?? Tt, f = D(() => se(h), [h]), { byId: g } = oe(f), m = tt(), [b, y] = $(!1), [p, v] = $(null), [d, N] = $(null), A = typeof a.updateConnection == "function", I = i && "actions" in i ? i.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => y(!0), children: s ?? "+ Add connection" });
896
+ return /* @__PURE__ */ o("div", { className: "w6w-embed-root", children: [
897
+ /* @__PURE__ */ t(
898
+ xe,
899
+ {
900
+ connections: h,
901
+ appsById: g,
902
+ loading: l.isLoading,
903
+ error: l.error ? l.error.message : null,
904
+ onOpen: e,
905
+ getHref: n,
906
+ onEdit: A ? v : void 0,
907
+ onDelete: N,
908
+ busy: m.isPending,
909
+ slots: { ...i, actions: I }
910
+ }
911
+ ),
912
+ b && /* @__PURE__ */ t(
913
+ Ee,
914
+ {
915
+ onClose: () => y(!1),
916
+ onCreated: () => {
917
+ y(!1), r.invalidateQueries({ queryKey: q });
918
+ }
919
+ }
920
+ ),
921
+ p && /* @__PURE__ */ t(
922
+ le,
923
+ {
924
+ connection: p,
925
+ onClose: () => v(null),
926
+ onSaved: () => {
927
+ const w = p.id;
928
+ v(null), r.invalidateQueries({ queryKey: q }), r.invalidateQueries({ queryKey: ue(w) });
929
+ }
930
+ }
931
+ ),
932
+ d && /* @__PURE__ */ t(
933
+ Re,
934
+ {
935
+ title: "Delete connection",
936
+ message: `Delete the connection "${d.displayName || d.id}"? This cannot be undone.`,
937
+ confirmLabel: "Delete",
938
+ onClose: () => N(null),
939
+ onConfirm: () => {
940
+ const w = d.id;
941
+ N(null), m.mutate(w);
942
+ }
943
+ }
944
+ )
945
+ ] });
946
+ }
947
+ function P(e) {
948
+ const n = new Date(e).getTime();
949
+ if (Number.isNaN(n)) return "recently";
950
+ const s = Math.max(0, Math.round((Date.now() - n) / 1e3));
951
+ if (s < 45) return "just now";
952
+ const i = Math.round(s / 60);
953
+ if (i < 60) return `${i}m ago`;
954
+ const a = Math.round(i / 60);
955
+ if (a < 24) return `${a}h ago`;
956
+ const r = Math.round(a / 24);
957
+ return r < 30 ? `${r}d ago` : new Date(e).toLocaleDateString();
958
+ }
959
+ const Dt = {
960
+ ok: 6e3,
961
+ warn: 1e4,
962
+ error: 15e3
963
+ }, xt = { ok: "✓", warn: "!", error: "✕" };
964
+ function ln({
965
+ connectionId: e,
966
+ onOpenAction: n,
967
+ onBack: s,
968
+ slots: i
969
+ }) {
970
+ var z;
971
+ const a = ie(), r = de(), l = nt(e), u = (z = l.data) == null ? void 0 : z.appId, h = D(
972
+ () => se(l.data ? [l.data] : []),
973
+ [l.data]
974
+ ), { byId: f } = oe(h), g = l.data ? je(l.data, f) : void 0, m = it(u, !!u), b = Ye(e), y = D(() => {
975
+ const c = /* @__PURE__ */ new Map();
976
+ for (const k of b.data ?? []) {
977
+ const C = c.get(k.actionKey) ?? [];
978
+ C.push(k), c.set(k.actionKey, C);
979
+ }
980
+ return c;
981
+ }, [b.data]), p = Ze(e).data ?? [], [v, d] = $(!1), [N, A] = $(""), I = at(e), [w, M] = $(null);
982
+ Ne(() => {
983
+ if (!w) return;
984
+ const c = setTimeout(() => M(null), Dt[w.kind]);
985
+ return () => clearTimeout(c);
986
+ }, [w]);
987
+ const R = () => {
988
+ M(null), I.mutate(void 0, {
989
+ onSuccess: (c) => {
990
+ var k;
991
+ if (!c.ok) {
992
+ M({
993
+ kind: "error",
994
+ text: `Connection test failed${(k = c.error) != null && k.message ? `: ${c.error.message}` : "."}`
995
+ });
996
+ return;
997
+ }
998
+ M(
999
+ c.untested ? { kind: "warn", text: `Connection stored. ${c.message ?? ""}`.trim() } : {
1000
+ kind: "ok",
1001
+ text: `Connection is valid${c.actionKey ? ` — probed ${c.actionKey}` : ""}.`
1002
+ }
1003
+ );
1004
+ },
1005
+ onError: (c) => M({ kind: "error", text: (c == null ? void 0 : c.message) ?? "Test failed." })
1006
+ });
1007
+ }, L = D(() => {
1008
+ var k;
1009
+ const c = [...((k = m.data) == null ? void 0 : k.actions) ?? []];
1010
+ return c.sort((C, J) => (C.title || C.key).localeCompare(J.title || J.key)), c;
1011
+ }, [m.data]), Z = D(() => {
1012
+ const c = N.trim().toLowerCase();
1013
+ return c ? L.filter(
1014
+ (k) => (k.title || "").toLowerCase().includes(c) || k.key.toLowerCase().includes(c) || (k.description || "").toLowerCase().includes(c)
1015
+ ) : L;
1016
+ }, [L, N]);
1017
+ if (l.isLoading || m.isLoading)
1018
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-conn-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
1019
+ if (!l.data)
1020
+ return /* @__PURE__ */ o("div", { className: "w6w-embed-root w6w-embed-conn-detail", "data-testid": "connection-not-found", children: [
1021
+ (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
1022
+ s && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "Back to integrations" })
1023
+ ] });
1024
+ const j = l.data, _ = m.data, ye = !j.builtIn && typeof a.updateConnection == "function";
1025
+ return /* @__PURE__ */ o("div", { className: "w6w-embed-root w6w-embed-conn-detail", children: [
1026
+ (i == null ? void 0 : i.header) ?? /* @__PURE__ */ o(Se, { conn: j, app: g, children: [
1027
+ /* @__PURE__ */ t(
1028
+ "button",
1029
+ {
1030
+ type: "button",
1031
+ className: "w6w-btn w6w-btn-ghost",
1032
+ disabled: I.isPending,
1033
+ onClick: R,
1034
+ children: I.isPending ? "Testing…" : "Test connection"
1035
+ }
1036
+ ),
1037
+ ye && /* @__PURE__ */ t(
1038
+ ae,
1039
+ {
1040
+ label: "Edit",
1041
+ onClick: () => d(!0),
1042
+ "data-testid": "connection-detail-edit"
1043
+ }
1044
+ ),
1045
+ i == null ? void 0 : i.actions
1046
+ ] }),
1047
+ w && /* @__PURE__ */ o(
1048
+ "div",
1049
+ {
1050
+ className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${w.kind}`,
1051
+ role: w.kind === "error" ? "alert" : "status",
1052
+ "aria-live": w.kind === "error" ? "assertive" : "polite",
1053
+ "data-testid": "connection-test-notice",
1054
+ children: [
1055
+ /* @__PURE__ */ t("span", { "aria-hidden": "true", children: xt[w.kind] }),
1056
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: w.text }),
1057
+ /* @__PURE__ */ t(Qe, { icon: "close", label: "Dismiss", onClick: () => M(null) })
1058
+ ]
1059
+ }
1060
+ ),
1061
+ /* @__PURE__ */ o("div", { className: "w6w-embed-conn-card", children: [
1062
+ /* @__PURE__ */ o("h3", { children: [
1063
+ "App: ",
1064
+ (g == null ? void 0 : g.displayName) ?? j.appId
1065
+ ] }),
1066
+ _ && /* @__PURE__ */ o("p", { className: "w6w-muted w6w-small", children: [
1067
+ "Version ",
1068
+ /* @__PURE__ */ o("code", { children: [
1069
+ "v",
1070
+ _.version ?? "?"
1071
+ ] }),
1072
+ " · source ",
1073
+ /* @__PURE__ */ t("code", { children: _.sourceRef })
1074
+ ] }),
1075
+ s && /* @__PURE__ */ t("p", { className: "w6w-small", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "← Integrations" }) })
1076
+ ] }),
1077
+ /* @__PURE__ */ o("div", { className: "w6w-embed-conn-card", children: [
1078
+ /* @__PURE__ */ t("h3", { children: "Actions" }),
1079
+ L.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
1080
+ L.length > 10 && /* @__PURE__ */ t(
1081
+ "input",
1082
+ {
1083
+ type: "search",
1084
+ value: N,
1085
+ placeholder: `Search ${L.length} actions…`,
1086
+ onChange: (c) => A(c.target.value),
1087
+ "aria-label": "Filter actions",
1088
+ className: "w6w-embed-conn-filter"
1089
+ }
1090
+ ),
1091
+ L.length > 0 && Z.length === 0 && /* @__PURE__ */ o("p", { className: "w6w-muted w6w-small", children: [
1092
+ "No actions match “",
1093
+ N,
1094
+ "”."
1095
+ ] }),
1096
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: Z.map((c) => {
1097
+ const k = y.get(c.key) ?? [];
1098
+ return /* @__PURE__ */ o("li", { children: [
1099
+ /* @__PURE__ */ o(
1100
+ "button",
1101
+ {
1102
+ type: "button",
1103
+ className: "w6w-embed-conn-action",
1104
+ "data-testid": `connection-action-${c.key}`,
1105
+ onClick: () => n(c.key),
1106
+ children: [
1107
+ /* @__PURE__ */ t("strong", { children: c.title }),
1108
+ " ",
1109
+ /* @__PURE__ */ t("code", { className: "w6w-muted", children: c.key }),
1110
+ " ",
1111
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: c.type }),
1112
+ c.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: c.description })
1113
+ ]
1114
+ }
1115
+ ),
1116
+ k.length > 0 && /* @__PURE__ */ t(
1117
+ "ul",
1118
+ {
1119
+ className: "w6w-embed-conn-list w6w-embed-conn-tests",
1120
+ "aria-label": `Saved tests for ${c.title || c.key}`,
1121
+ children: k.map((C) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1122
+ H,
1123
+ {
1124
+ title: C.name,
1125
+ subtitle: C.lastRunAt ? /* @__PURE__ */ o("span", { children: [
1126
+ /* @__PURE__ */ t(
1127
+ "span",
1128
+ {
1129
+ className: C.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1130
+ children: C.lastRunOk ? "✓" : "✗"
1131
+ }
1132
+ ),
1133
+ " ",
1134
+ C.lastRunSummary ? `${C.lastRunSummary} · ` : "",
1135
+ P(C.lastRunAt)
1136
+ ] }) : `saved ${P(C.updatedAt)}`,
1137
+ onClick: () => n(c.key, C.id)
1138
+ }
1139
+ ) }, C.id))
1140
+ }
1141
+ )
1142
+ ] }, c.key);
1143
+ }) })
1144
+ ] }),
1145
+ p.length > 0 && /* @__PURE__ */ o("div", { className: "w6w-embed-conn-card", children: [
1146
+ /* @__PURE__ */ t("h3", { children: "Recent runs" }),
1147
+ /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Most recent tester runs against this connection." }),
1148
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: p.map((c) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1149
+ H,
1150
+ {
1151
+ title: c.actionKey,
1152
+ subtitle: /* @__PURE__ */ o("span", { children: [
1153
+ /* @__PURE__ */ t("span", { className: c.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: c.ok ? "✓" : "✗" }),
1154
+ " ",
1155
+ c.summary ? `${c.summary} · ` : "",
1156
+ P(c.occurredAt)
1157
+ ] })
1158
+ }
1159
+ ) }, c.id)) })
1160
+ ] }),
1161
+ v && /* @__PURE__ */ t(
1162
+ le,
1163
+ {
1164
+ connection: j,
1165
+ onClose: () => d(!1),
1166
+ onSaved: () => {
1167
+ d(!1), r.invalidateQueries({ queryKey: ue(e) }), r.invalidateQueries({ queryKey: q });
1168
+ }
1169
+ }
1170
+ )
1171
+ ] });
1172
+ }
1173
+ export {
1174
+ tn as ActivitySummary,
1175
+ ln as ConnectionDetail,
1176
+ sn as ConnectionList,
1177
+ en as DocumentList,
1178
+ Jt as EndpointList,
1179
+ zt as FunctionList,
1180
+ Xt as ReliabilityBoard,
1181
+ nn as RunHistory,
1182
+ an as ServiceDetail,
1183
+ Gt as WorkflowList
1184
+ };
1185
+ //# sourceMappingURL=lists.mjs.map