@w6w/embed 0.2.26 → 0.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/{CreateFunctionModal-DScxp_LN.js → CreateFunctionModal-B3LpcuI9.js} +2 -2
  2. package/dist/{CreateFunctionModal-DScxp_LN.js.map → CreateFunctionModal-B3LpcuI9.js.map} +1 -1
  3. package/dist/DocumentFormModal-DieWYFi4.js +175 -0
  4. package/dist/DocumentFormModal-DieWYFi4.js.map +1 -0
  5. package/dist/{ImportSpecModal-VdYN1QeZ.js → ImportSpecModal-xwTzj4KB.js} +2 -2
  6. package/dist/{ImportSpecModal-VdYN1QeZ.js.map → ImportSpecModal-xwTzj4KB.js.map} +1 -1
  7. package/dist/ModelRoutesManager-DtByS4mE.js +422 -0
  8. package/dist/ModelRoutesManager-DtByS4mE.js.map +1 -0
  9. package/dist/{WorkflowEditor-CGKoeSG7.js → WorkflowEditor-CvWkVmFn.js} +2 -2
  10. package/dist/{WorkflowEditor-CGKoeSG7.js.map → WorkflowEditor-CvWkVmFn.js.map} +1 -1
  11. package/dist/ai-keys-D676ly41.js +53 -0
  12. package/dist/ai-keys-D676ly41.js.map +1 -0
  13. package/dist/credentials-4Nf2GfMc.js +212 -0
  14. package/dist/credentials-4Nf2GfMc.js.map +1 -0
  15. package/dist/{editor-tools-Brw0cv2F.js → editor-tools-CVYTsVFN.js} +326 -326
  16. package/dist/editor-tools-CVYTsVFN.js.map +1 -0
  17. package/dist/editor.mjs +1 -1
  18. package/dist/editors.mjs +7 -7
  19. package/dist/{endpoints-DSRo1Lc5.js → endpoints-DArAqoLT.js} +15 -15
  20. package/dist/endpoints-DArAqoLT.js.map +1 -0
  21. package/dist/forms/ModelRoutesManager.d.ts +8 -0
  22. package/dist/forms.mjs +128 -133
  23. package/dist/forms.mjs.map +1 -1
  24. package/dist/index.mjs +16 -16
  25. package/dist/lib/callable-descriptors.d.ts +1 -1
  26. package/dist/lib/document-upload.d.ts +8 -0
  27. package/dist/lists/MyAiKeys.d.ts +5 -0
  28. package/dist/lists/TagChips.d.ts +4 -0
  29. package/dist/lists.d.ts +2 -0
  30. package/dist/lists.mjs +1589 -1166
  31. package/dist/lists.mjs.map +1 -1
  32. package/dist/models-CI0vLJ6o.js +346 -0
  33. package/dist/models-CI0vLJ6o.js.map +1 -0
  34. package/dist/rail.mjs +1 -1
  35. package/dist/repos/ai-keys.d.ts +14 -0
  36. package/dist/repos/credentials.d.ts +14 -14
  37. package/dist/repos/index.d.ts +1 -0
  38. package/dist/repos/models.d.ts +53 -4
  39. package/dist/repos.mjs +177 -162
  40. package/dist/repos.mjs.map +1 -1
  41. package/dist/{spec-import-SWOonsNr.js → spec-import-0B6oUewa.js} +5 -5
  42. package/dist/{spec-import-SWOonsNr.js.map → spec-import-0B6oUewa.js.map} +1 -1
  43. package/package.json +5 -5
  44. package/src/styles.css +23 -0
  45. package/dist/DocumentFormModal-Br4s8wmi.js +0 -89
  46. package/dist/DocumentFormModal-Br4s8wmi.js.map +0 -1
  47. package/dist/ModelRoutesManager-Bv6qefnq.js +0 -345
  48. package/dist/ModelRoutesManager-Bv6qefnq.js.map +0 -1
  49. package/dist/credentials-CMR_wEvx.js +0 -196
  50. package/dist/credentials-CMR_wEvx.js.map +0 -1
  51. package/dist/editor-tools-Brw0cv2F.js.map +0 -1
  52. package/dist/endpoints-DSRo1Lc5.js.map +0 -1
  53. package/dist/models-CK1KHd39.js +0 -311
  54. package/dist/models-CK1KHd39.js.map +0 -1
package/dist/lists.mjs CHANGED
@@ -1,37 +1,38 @@
1
1
  "use client";
2
- import { jsxs as r, jsx as t, Fragment as K } from "react/jsx-runtime";
3
- import { useState as f, useMemo as ie, useEffect as gt } from "react";
4
- import { F as yt, E as vt } from "./CreateFunctionModal-DScxp_LN.js";
5
- import { d as Nt, f as bt, h as kt, b as qe, n as Te, u as Ct, m as Tt } from "./endpoints-DSRo1Lc5.js";
6
- import { u as X, b as $e } from "./project-context-Tvp-La7A.js";
7
- import { CallableList as $t, ReliabilityList as Dt, EmptyState as De, DataTable as xe, EditButton as _e, DeleteButton as xt, ListItem as ke, HealthStatusPill as he, HistoryTimeline as Lt, useW6WApi as We, connectionAppIdsToLookUp as Be, ConnectionList as Et, AddConnectionModal as It, EditConnectionModal as Ue, Modal as Mt, resolveConnectionAppMeta as At, ConnectionHeader as Rt, IconButton as St, locateDataStoreError as Pt, tableSchemaOf as Ot, draftFromEntry as ue, CsvPanel as jt, DataTableGrid as Kt, NEW_ROW_ID as ne, newRowDraft as Me, kvValueTypeOf as Ft, DataEntryList as Qt, DataEntryEditor as qt, dirtyColumns as _t, csvFilenameOf as Wt, csvImportMessage as Ae, buildRowValue as Bt, rowWriteOf as Ut, remainingTtlSeconds as Ve, isVersionConflict as He, cellErrorsOf as Vt, parseDocText as Ht, kvValueOf as Jt, serializeCell as Yt, DataStoreList as zt, DATA_STORE_KINDS as Gt, DATA_STORE_KIND_LABEL as Zt, SCALAR_TYPES as Xt, ColumnsEditor as en, errorPlacement as tn } from "@w6w/ui";
8
- import { I as nn } from "./ImportSpecModal-VdYN1QeZ.js";
9
- import { i as an } from "./import-bindings-EUtxZ9Ti.js";
10
- import { a3 as sn, a1 as Je, T as rn, E as ln } from "./workflows-Dz8LMjnt.js";
11
- import { n as on, b as cn } from "./workflow-blank-BJFLdGyE.js";
12
- import { f as dn, e as Re, g as un, b as mn, h as hn, i as wn } from "./api-calls--JHyif6a.js";
13
- import { C as pe, a as pn, M as fn } from "./ConfirmModal-Pv2-A_3U.js";
14
- import { D as gn } from "./DocumentFormModal-Br4s8wmi.js";
15
- import { k as yn, i as vn } from "./spec-import-SWOonsNr.js";
16
- import { H as Nn, a as Ye } from "./editor-apps-HEOclsxL.js";
17
- import { ApiError as ze } from "@w6w/sdk";
18
- import { useQueryClient as fe, useInfiniteQuery as Ge } from "@tanstack/react-query";
19
- import { u as bn, o as kn, k as Ze, c as Ce, b as Xe, m as Cn, p as Tn } from "./connections-CzsCyIxY.js";
20
- import { M as $n } from "./ModelRoutesManager-Bv6qefnq.js";
21
- import { j as Dn } from "./apps-FMcQfyL2.js";
22
- import { u as ge } from "./client-context-CX61Bgw-.js";
23
- import { r as xn, x as Ln, p as En, A as In } from "./models-CK1KHd39.js";
24
- import { v as Mn, q as Le, n as An, f as et, p as Rn, o as Sn, x as Pn, y as On, z as jn, w as Kn } from "./credentials-CMR_wEvx.js";
25
- import { h as Fn, k as tt, p as nt, o as Qn, j as at, n as qn, m as _n, g as it, i as Wn, u as Bn, f as Un } from "./data-stores-UeQvwVCa.js";
26
- function Ee(e) {
27
- const { kind: n } = e, a = Nt(n), [s, i] = f(!1), o = (e.rows ?? []).map((l) => ({
28
- ...e.toRow(l),
29
- id: l.id,
30
- archived: an(l)
2
+ import { jsxs as l, jsx as t, Fragment as Q } from "react/jsx-runtime";
3
+ import { useState as f, useMemo as ie, useEffect as At } from "react";
4
+ import { F as St, E as Mt } from "./CreateFunctionModal-B3LpcuI9.js";
5
+ import { d as xt, f as Rt, h as Pt, b as Ye, n as Se, u as Ot, m as Kt } from "./endpoints-DArAqoLT.js";
6
+ import { u as X, b as Me } from "./project-context-Tvp-La7A.js";
7
+ import { CallableList as jt, ReliabilityList as Ft, EmptyState as xe, DataTable as Re, EditButton as ze, DeleteButton as Qt, ListItem as Ae, HealthStatusPill as ye, HistoryTimeline as _t, useW6WApi as Je, connectionAppIdsToLookUp as Ge, ConnectionList as qt, AddConnectionModal as Vt, EditConnectionModal as Ze, Modal as Wt, resolveConnectionAppMeta as Bt, ConnectionHeader as Ut, IconButton as Ht, locateDataStoreError as Yt, tableSchemaOf as zt, draftFromEntry as pe, CsvPanel as Jt, DataTableGrid as Gt, NEW_ROW_ID as ae, newRowDraft as Ke, kvValueTypeOf as Zt, DataEntryList as Xt, DataEntryEditor as en, dirtyColumns as tn, csvFilenameOf as nn, csvImportMessage as je, buildRowValue as an, rowWriteOf as sn, remainingTtlSeconds as Xe, isVersionConflict as et, cellErrorsOf as ln, parseDocText as rn, kvValueOf as on, serializeCell as cn, DataStoreList as dn, DATA_STORE_KINDS as un, DATA_STORE_KIND_LABEL as mn, SCALAR_TYPES as hn, ColumnsEditor as wn, errorPlacement as pn } from "@w6w/ui";
8
+ import { I as fn } from "./ImportSpecModal-xwTzj4KB.js";
9
+ import { i as yn } from "./import-bindings-EUtxZ9Ti.js";
10
+ import { a3 as gn, a1 as tt, T as vn, E as bn } from "./workflows-Dz8LMjnt.js";
11
+ import { n as Nn, b as kn } from "./workflow-blank-BJFLdGyE.js";
12
+ import { f as Cn, e as Fe, g as Tn, b as En, h as In, i as Dn } from "./api-calls--JHyif6a.js";
13
+ import { C as be, a as $n, M as Ln } from "./ConfirmModal-Pv2-A_3U.js";
14
+ import { D as An } from "./DocumentFormModal-DieWYFi4.js";
15
+ import { k as Sn, i as Mn } from "./spec-import-0B6oUewa.js";
16
+ import { H as xn, a as nt } from "./editor-apps-HEOclsxL.js";
17
+ import { ApiError as at } from "@w6w/sdk";
18
+ import { useQueryClient as me, useInfiniteQuery as st, useQuery as Rn } from "@tanstack/react-query";
19
+ import { u as it, o as lt, k as rt, c as ge, b as ot, m as Pn, p as ct, e as On } from "./connections-CzsCyIxY.js";
20
+ import { M as Kn } from "./ModelRoutesManager-DtByS4mE.js";
21
+ import { j as jn } from "./apps-FMcQfyL2.js";
22
+ import { u as he } from "./client-context-CX61Bgw-.js";
23
+ import { v as Fn, A as Qn, s as _n, E as qn, c as Vn } from "./models-CI0vLJ6o.js";
24
+ import { x as dt, w as Ne, a as ut, p as Wn, g as ke, v as Bn, q as Un, z as mt, A as ht, B as Hn, y as wt, o as ee, c as Yn, i as zn, h as Jn } from "./credentials-4Nf2GfMc.js";
25
+ import { u as pt, b as Gn, d as Zn, c as Xn } from "./ai-keys-D676ly41.js";
26
+ import { h as ea, k as ft, p as yt, o as ta, j as gt, n as na, m as aa, g as vt, i as sa, u as ia, f as la } from "./data-stores-UeQvwVCa.js";
27
+ function Pe(e) {
28
+ const { kind: n } = e, a = xt(n), [i, s] = f(!1), o = (e.rows ?? []).map((r) => ({
29
+ ...e.toRow(r),
30
+ id: r.id,
31
+ archived: yn(r)
31
32
  }));
32
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
33
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
33
34
  /* @__PURE__ */ t(
34
- $t,
35
+ jt,
35
36
  {
36
37
  rows: o,
37
38
  title: a.listTitle,
@@ -48,213 +49,226 @@ function Ee(e) {
48
49
  error: e.error,
49
50
  onCreate: e.onCreate,
50
51
  creating: e.creating,
51
- onImport: () => i(!0),
52
+ onImport: () => s(!0),
52
53
  onOpen: e.onOpen,
53
54
  getHref: e.getHref,
54
55
  slots: e.slots
55
56
  }
56
57
  ),
57
- s && /* @__PURE__ */ t(
58
- nn,
58
+ i && /* @__PURE__ */ t(
59
+ fn,
59
60
  {
60
61
  kind: n,
61
62
  project: e.project ?? void 0,
62
- listKeys: { functionsKey: kt, endpointsKey: bt, workflowsKey: sn },
63
- onOpenImported: (l, d) => {
63
+ listKeys: { functionsKey: Pt, endpointsKey: Rt, workflowsKey: gn },
64
+ onOpenImported: (r, c) => {
64
65
  var u;
65
- return (u = e.onOpen) == null ? void 0 : u.call(e, d);
66
+ return (u = e.onOpen) == null ? void 0 : u.call(e, c);
66
67
  },
67
- onClose: () => i(!1)
68
+ onClose: () => s(!1)
68
69
  }
69
70
  ),
70
71
  e.children
71
72
  ] });
72
73
  }
73
- function mi(e) {
74
- const n = qe(), a = X(e.project), [s, i] = f(null);
74
+ function bt({ tags: e }) {
75
+ return !e || e.length === 0 ? null : /* @__PURE__ */ t("span", { className: "wf-row-tags", "data-testid": "callable-row-tags", children: e.map((n) => /* @__PURE__ */ t("span", { className: "tag", children: n }, n)) });
76
+ }
77
+ function Fs(e) {
78
+ const n = Ye(), a = X(e.project), [i, s] = f(null);
75
79
  return /* @__PURE__ */ t(
76
- Ee,
80
+ Pe,
77
81
  {
78
82
  kind: "function",
79
83
  rows: n.data,
80
84
  loading: n.isLoading,
81
85
  error: n.error ? String(n.error) : null,
82
86
  project: a,
83
- toRow: (o) => ({
84
- title: o.displayName || o.key,
85
- description: o.description,
86
- badges: o.valid ? null : /* @__PURE__ */ t("span", { className: "w6w-callable-list-badge", children: "incomplete" })
87
- }),
87
+ toRow: (o) => {
88
+ var r;
89
+ return {
90
+ title: o.displayName || o.key,
91
+ description: o.description,
92
+ badges: (r = o.tags) != null && r.length || !o.valid ? /* @__PURE__ */ l(Q, { children: [
93
+ /* @__PURE__ */ t(bt, { tags: o.tags }),
94
+ o.valid ? null : /* @__PURE__ */ t("span", { className: "w6w-callable-list-badge", children: "incomplete" })
95
+ ] }) : null
96
+ };
97
+ },
88
98
  onOpen: e.onOpen,
89
99
  getHref: e.getHref,
90
- onCreate: () => i(Te("function")),
100
+ onCreate: () => s(Se("function")),
91
101
  slots: e.slots,
92
- children: s !== null && /* @__PURE__ */ t(
93
- yt,
102
+ children: i !== null && /* @__PURE__ */ t(
103
+ St,
94
104
  {
95
- newId: s,
105
+ newId: i,
96
106
  takenKeys: (n.data ?? []).map((o) => o.key),
97
- onClose: () => i(null),
107
+ onClose: () => s(null),
98
108
  onCreated: (o) => {
99
- var l;
100
- i(null), (l = e.onCreated) == null || l.call(e, o);
109
+ var r;
110
+ s(null), (r = e.onCreated) == null || r.call(e, o);
101
111
  }
102
112
  }
103
113
  )
104
114
  }
105
115
  );
106
116
  }
107
- function hi(e) {
108
- const n = Ct(), a = X(e.project), [s, i] = f(null);
117
+ function Qs(e) {
118
+ const n = Ot(), a = X(e.project), [i, s] = f(null);
109
119
  return /* @__PURE__ */ t(
110
- Ee,
120
+ Pe,
111
121
  {
112
122
  kind: "endpoint",
113
123
  rows: n.data,
114
124
  loading: n.isLoading,
115
125
  error: n.error ? String(n.error) : null,
116
126
  project: a,
117
- toRow: (o) => ({
118
- // The draft tag sits INSIDE the title, after the name: ui `ListItem` puts `badges` in
119
- // a trailing `margin-left: auto` slot, which would strand it at the row's far edge.
120
- title: /* @__PURE__ */ r(K, { children: [
121
- /* @__PURE__ */ t("strong", { children: o.displayName || o.key }),
122
- Tt(o) ? /* @__PURE__ */ t(
123
- "span",
124
- {
125
- className: "tag warn",
126
- "data-testid": "endpoint-draft",
127
- title: "No target configured yet — it cannot be invoked until one is set.",
128
- children: "Unfinished"
129
- }
130
- ) : null
131
- ] }),
132
- description: o.description
133
- }),
127
+ toRow: (o) => {
128
+ var r;
129
+ return {
130
+ // The draft tag sits INSIDE the title, after the name: ui `ListItem` puts `badges` in
131
+ // a trailing `margin-left: auto` slot, which would strand it at the row's far edge.
132
+ title: /* @__PURE__ */ l(Q, { children: [
133
+ /* @__PURE__ */ t("strong", { children: o.displayName || o.key }),
134
+ Kt(o) ? /* @__PURE__ */ t(
135
+ "span",
136
+ {
137
+ className: "tag warn",
138
+ "data-testid": "endpoint-draft",
139
+ title: "No target configured yet — it cannot be invoked until one is set.",
140
+ children: "Unfinished"
141
+ }
142
+ ) : null
143
+ ] }),
144
+ description: o.description,
145
+ badges: (r = o.tags) != null && r.length ? /* @__PURE__ */ t(bt, { tags: o.tags }) : null
146
+ };
147
+ },
134
148
  onOpen: e.onOpen,
135
149
  getHref: e.getHref,
136
- onCreate: () => i(Te("endpoint")),
150
+ onCreate: () => s(Se("endpoint")),
137
151
  slots: e.slots,
138
- children: s !== null && /* @__PURE__ */ t(
139
- vt,
152
+ children: i !== null && /* @__PURE__ */ t(
153
+ Mt,
140
154
  {
141
- newId: s,
155
+ newId: i,
142
156
  takenKeys: (n.data ?? []).map((o) => o.key),
143
- onClose: () => i(null),
157
+ onClose: () => s(null),
144
158
  onCreated: (o) => {
145
- var l;
146
- i(null), (l = e.onCreated) == null || l.call(e, o);
159
+ var r;
160
+ s(null), (r = e.onCreated) == null || r.call(e, o);
147
161
  }
148
162
  }
149
163
  )
150
164
  }
151
165
  );
152
166
  }
153
- function wi(e) {
154
- const n = X(e.project), a = Je(n ?? void 0, n != null), s = rn(n ?? void 0), [i, o] = f(null);
167
+ function _s(e) {
168
+ const n = X(e.project), a = tt(n ?? void 0, n != null), i = vn(n ?? void 0), [s, o] = f(null);
155
169
  return /* @__PURE__ */ t(
156
- Ee,
170
+ Pe,
157
171
  {
158
172
  kind: "workflow",
159
173
  rows: a.data,
160
174
  loading: a.isLoading,
161
- error: i ?? (a.error ? String(a.error) : null),
175
+ error: s ?? (a.error ? String(a.error) : null),
162
176
  project: n,
163
- toRow: (l) => ({
164
- title: l.displayName || l.name,
165
- description: l.description,
166
- badges: /* @__PURE__ */ r(K, { children: [
167
- l.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: l.tags.map((d) => /* @__PURE__ */ t("span", { className: "tag", children: d }, d)) }),
168
- l.status !== "archived" && /* @__PURE__ */ t("span", { className: `badge wf-status ${l.status}`, children: l.status })
177
+ toRow: (r) => ({
178
+ title: r.displayName || r.name,
179
+ description: r.description,
180
+ badges: /* @__PURE__ */ l(Q, { children: [
181
+ r.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: r.tags.map((c) => /* @__PURE__ */ t("span", { className: "tag", children: c }, c)) }),
182
+ r.status !== "archived" && /* @__PURE__ */ t("span", { className: `badge wf-status ${r.status}`, children: r.status })
169
183
  ] }),
170
- trailing: /* @__PURE__ */ r("span", { className: "wf-col wf-col-stats muted small", children: [
171
- l.runCount,
184
+ trailing: /* @__PURE__ */ l("span", { className: "wf-col wf-col-stats muted small", children: [
185
+ r.runCount,
172
186
  " ",
173
- l.runCount === 1 ? "run" : "runs"
187
+ r.runCount === 1 ? "run" : "runs"
174
188
  ] })
175
189
  }),
176
190
  onOpen: e.onOpen,
177
191
  getHref: e.getHref,
178
192
  onCreate: () => {
179
193
  o(null);
180
- const l = on((a.data ?? []).map((d) => d.displayName || d.name));
181
- s.mutate(cn(Te("workflow"), l), {
182
- onSuccess: (d) => {
194
+ const r = Nn((a.data ?? []).map((c) => c.displayName || c.name));
195
+ i.mutate(kn(Se("workflow"), r), {
196
+ onSuccess: (c) => {
183
197
  var u;
184
- return (u = e.onCreated) == null ? void 0 : u.call(e, d.workflow.id);
198
+ return (u = e.onCreated) == null ? void 0 : u.call(e, c.workflow.id);
185
199
  },
186
- onError: (d) => o(d instanceof Error ? d.message : String(d))
200
+ onError: (c) => o(c instanceof Error ? c.message : String(c))
187
201
  });
188
202
  },
189
- creating: s.isPending,
203
+ creating: i.isPending,
190
204
  slots: e.slots
191
205
  }
192
206
  );
193
207
  }
194
- function pi({
208
+ function qs({
195
209
  project: e,
196
210
  variant: n = "full",
197
211
  limit: a,
198
- days: s = 30,
199
- showChart: i,
212
+ days: i = 30,
213
+ showChart: s,
200
214
  getHref: o,
201
- onOpen: l,
202
- showAllHref: d,
215
+ onOpen: r,
216
+ showAllHref: c,
203
217
  onShowAll: u,
204
218
  slots: h
205
219
  }) {
206
- var g, m;
207
- const v = $e().project, w = e === void 0 ? v : e, b = w || null, N = dn(b ?? void 0, s);
208
- let $ = h == null ? void 0 : h.empty;
209
- return b ? N.isLoading ? $ = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : N.error && ($ = /* @__PURE__ */ t("div", { className: "error", children: N.error.message })) : $ = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
210
- Dt,
220
+ var y, p;
221
+ const g = Me().project, m = e === void 0 ? g : e, k = m || null, w = Cn(k ?? void 0, i);
222
+ let v = h == null ? void 0 : h.empty;
223
+ return k ? w.isLoading ? v = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : w.error && (v = /* @__PURE__ */ t("div", { className: "error", children: w.error.message })) : v = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
224
+ Ft,
211
225
  {
212
- services: b ? ((g = N.data) == null ? void 0 : g.services) ?? [] : [],
213
- window: b ? (m = N.data) == null ? void 0 : m.window : void 0,
214
- days: s,
226
+ services: k ? ((y = w.data) == null ? void 0 : y.services) ?? [] : [],
227
+ window: k ? (p = w.data) == null ? void 0 : p.window : void 0,
228
+ days: i,
215
229
  compact: n === "compact",
216
- showChart: i,
230
+ showChart: s,
217
231
  limit: a,
218
232
  getHref: o,
219
- onOpen: l,
220
- showAllHref: d,
233
+ onOpen: r,
234
+ showAllHref: c,
221
235
  onShowAll: u,
222
- slots: { ...h, empty: $ }
236
+ slots: { ...h, empty: v }
223
237
  }
224
238
  ) });
225
239
  }
226
- function Vn(e) {
240
+ function ra(e) {
227
241
  const n = e.replace(/\s+/g, " ").trim();
228
242
  return n.length > 80 ? `${n.slice(0, 80)}…` : n;
229
243
  }
230
- function fi({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
231
- var g;
232
- const o = X(e), l = yn(o ?? void 0, o != null), d = vn(), [u, h] = f(null), [v, w] = f(null), b = (s == null ? void 0 : s.header) === void 0 ? /* @__PURE__ */ r("div", { children: [
244
+ function Vs({ project: e, onOpen: n, getHref: a, slots: i, rowSlots: s }) {
245
+ var y;
246
+ const o = X(e), r = Sn(o ?? void 0, o != null), c = Mn(), [u, h] = f(null), [g, m] = f(null), k = (i == null ? void 0 : i.header) === void 0 ? /* @__PURE__ */ l("div", { children: [
233
247
  /* @__PURE__ */ t("h3", { children: "Documents" }),
234
248
  /* @__PURE__ */ t("p", { className: "muted small", children: "Each document is free-form content stored verbatim." })
235
- ] }) : s.header, N = (s == null ? void 0 : s.empty) === void 0 ? /* @__PURE__ */ t(De, { testId: "document-list-empty", children: "No documents yet." }) : s.empty, $ = [
249
+ ] }) : i.header, w = (i == null ? void 0 : i.empty) === void 0 ? /* @__PURE__ */ t(xe, { testId: "document-list-empty", children: "No documents yet." }) : i.empty, v = [
236
250
  {
237
251
  key: "key",
238
252
  header: "Document",
239
- render: (m) => {
240
- var D;
241
- const y = (D = i == null ? void 0 : i.lead) == null ? void 0 : D.call(i, m);
242
- return /* @__PURE__ */ r("span", { style: { display: "flex", alignItems: "center" }, children: [
243
- y,
244
- /* @__PURE__ */ r(
253
+ render: (p) => {
254
+ var I;
255
+ const C = (I = s == null ? void 0 : s.lead) == null ? void 0 : I.call(s, p);
256
+ return /* @__PURE__ */ l("span", { style: { display: "flex", alignItems: "center" }, children: [
257
+ C,
258
+ /* @__PURE__ */ l(
245
259
  "span",
246
260
  {
247
261
  className: "list-main",
248
- style: { marginLeft: y != null ? "var(--w6w-sp-2)" : 0 },
262
+ style: { marginLeft: C != null ? "var(--w6w-sp-2)" : 0 },
249
263
  children: [
250
- /* @__PURE__ */ t("strong", { className: "list-name", title: m.key, children: m.key }),
264
+ /* @__PURE__ */ t("strong", { className: "list-name", title: p.key, children: p.key }),
251
265
  " ",
252
- /* @__PURE__ */ t("span", { className: "tag", children: m.format }),
253
- /* @__PURE__ */ r("div", { className: "muted small list-preview", children: [
254
- /* @__PURE__ */ t("code", { children: Vn(m.content) }),
255
- m.description && /* @__PURE__ */ r(K, { children: [
266
+ /* @__PURE__ */ t("span", { className: "tag", children: p.format }),
267
+ /* @__PURE__ */ l("div", { className: "muted small list-preview", children: [
268
+ /* @__PURE__ */ t("code", { children: ra(p.content) }),
269
+ p.description && /* @__PURE__ */ l(Q, { children: [
256
270
  " · ",
257
- m.description
271
+ p.description
258
272
  ] })
259
273
  ] })
260
274
  ]
@@ -268,45 +282,46 @@ function fi({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
268
282
  header: "",
269
283
  align: "right",
270
284
  link: !1,
271
- render: (m) => {
272
- var D, E;
273
- const y = (D = i == null ? void 0 : i.footer) == null ? void 0 : D.call(i, m);
285
+ actions: !0,
286
+ render: (p) => {
287
+ var I, b;
288
+ const C = (I = s == null ? void 0 : s.footer) == null ? void 0 : I.call(s, p);
274
289
  return (
275
290
  // Clicks here must not reach the row's onOpen.
276
291
  // biome-ignore lint/a11y/useKeyWithClickEvents: propagation guard only; the buttons inside are the controls.
277
- /* @__PURE__ */ r("div", { onClick: (x) => x.stopPropagation(), children: [
278
- /* @__PURE__ */ r("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", justifyContent: "flex-end" }, children: [
279
- /* @__PURE__ */ t(pn, { resource: { kind: "document", key: m.key } }),
280
- m.shared ? (E = i == null ? void 0 : i.sharedActions) == null ? void 0 : E.call(i, m) : /* @__PURE__ */ r(K, { children: [
292
+ /* @__PURE__ */ l("div", { onClick: (E) => E.stopPropagation(), children: [
293
+ /* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", justifyContent: "flex-end" }, children: [
294
+ /* @__PURE__ */ t($n, { resource: { kind: "document", key: p.key } }),
295
+ p.shared ? (b = s == null ? void 0 : s.sharedActions) == null ? void 0 : b.call(s, p) : /* @__PURE__ */ l(Q, { children: [
281
296
  /* @__PURE__ */ t(
282
- _e,
297
+ ze,
283
298
  {
284
299
  label: "Edit",
285
- onClick: () => h({ mode: "edit", d: m }),
286
- "data-testid": `document-edit-${m.id}`
300
+ onClick: () => h({ mode: "edit", d: p }),
301
+ "data-testid": `document-edit-${p.id}`
287
302
  }
288
303
  ),
289
304
  /* @__PURE__ */ t(
290
- xt,
305
+ Qt,
291
306
  {
292
307
  label: "Delete",
293
- onClick: () => w(m),
294
- disabled: d.isPending,
295
- "data-testid": `document-delete-${m.id}`
308
+ onClick: () => m(p),
309
+ disabled: c.isPending,
310
+ "data-testid": `document-delete-${p.id}`
296
311
  }
297
312
  )
298
313
  ] })
299
314
  ] }),
300
- y != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: y })
315
+ C != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: C })
301
316
  ] })
302
317
  );
303
318
  }
304
319
  }
305
320
  ];
306
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
307
- /* @__PURE__ */ r("section", { className: "section", children: [
308
- /* @__PURE__ */ r("div", { className: "section-head", children: [
309
- b,
321
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
322
+ /* @__PURE__ */ l("section", { className: "section", children: [
323
+ /* @__PURE__ */ l("div", { className: "section-head", children: [
324
+ k,
310
325
  /* @__PURE__ */ t(
311
326
  "button",
312
327
  {
@@ -318,23 +333,23 @@ function fi({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
318
333
  }
319
334
  )
320
335
  ] }),
321
- /* @__PURE__ */ r("div", { children: [
322
- l.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
323
- ((g = l.data) == null ? void 0 : g.length) === 0 && N,
324
- l.data != null && l.data.length > 0 && /* @__PURE__ */ t(
325
- xe,
336
+ /* @__PURE__ */ l("div", { children: [
337
+ r.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
338
+ ((y = r.data) == null ? void 0 : y.length) === 0 && w,
339
+ r.data != null && r.data.length > 0 && /* @__PURE__ */ t(
340
+ Re,
326
341
  {
327
- columns: $,
328
- rows: l.data,
329
- rowKey: (m) => m.id,
330
- getRowHref: a ? (m) => a(m.id) : void 0,
331
- onRowClick: n ? (m, y) => n(m.id, y) : void 0
342
+ columns: v,
343
+ rows: r.data,
344
+ rowKey: (p) => p.id,
345
+ getRowHref: a ? (p) => a(p.id) : void 0,
346
+ onRowClick: n ? (p, C) => n(p.id, C) : void 0
332
347
  }
333
348
  )
334
349
  ] })
335
350
  ] }),
336
351
  u && /* @__PURE__ */ t(
337
- gn,
352
+ An,
338
353
  {
339
354
  initial: u.mode === "edit" ? u.d : void 0,
340
355
  project: o,
@@ -342,21 +357,21 @@ function fi({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
342
357
  onSaved: () => h(null)
343
358
  }
344
359
  ),
345
- v && /* @__PURE__ */ t(
346
- pe,
360
+ g && /* @__PURE__ */ t(
361
+ be,
347
362
  {
348
363
  title: "Delete document",
349
- message: `Delete the document "${v.key}"? This cannot be undone.`,
364
+ message: `Delete the document "${g.key}"? This cannot be undone.`,
350
365
  confirmLabel: "Delete",
351
366
  onConfirm: () => {
352
- o != null && d.mutate({ id: v.id, project: o }), w(null);
367
+ o != null && c.mutate({ id: g.id, project: o }), m(null);
353
368
  },
354
- onClose: () => w(null)
369
+ onClose: () => m(null)
355
370
  }
356
371
  )
357
372
  ] });
358
373
  }
359
- const Hn = {
374
+ const oa = {
360
375
  workflow: "Workflow run",
361
376
  workflow_step: "Workflow step",
362
377
  connection_test: "Connection test",
@@ -367,10 +382,10 @@ const Hn = {
367
382
  endpoint: "Endpoint call",
368
383
  action: "App action"
369
384
  };
370
- function we(e) {
371
- return Hn[e] ?? e;
385
+ function ve(e) {
386
+ return oa[e] ?? e;
372
387
  }
373
- const st = {
388
+ const Nt = {
374
389
  workflow: "workflow",
375
390
  workflow_step: "workflow_step",
376
391
  connection_test: "base",
@@ -379,207 +394,207 @@ const st = {
379
394
  endpoint: "base",
380
395
  action: "base"
381
396
  };
382
- function Jn(e) {
383
- return Object.hasOwn(st, e);
397
+ function ca(e) {
398
+ return Object.hasOwn(Nt, e);
384
399
  }
385
- function rt(e) {
386
- return Jn(e) ? st[e] : "base";
400
+ function kt(e) {
401
+ return ca(e) ? Nt[e] : "base";
387
402
  }
388
- function Yn(e, n) {
403
+ function da(e, n) {
389
404
  const a = /* @__PURE__ */ new Map();
390
- for (const i of e ?? []) {
391
- const o = i.displayName || i.key;
392
- o && a.set(i.id, o);
405
+ for (const s of e ?? []) {
406
+ const o = s.displayName || s.key;
407
+ o && a.set(s.id, o);
393
408
  }
394
- const s = /* @__PURE__ */ new Map();
395
- for (const i of n ?? []) {
396
- const o = i.displayName || i.name;
397
- o && s.set(i.id, o);
409
+ const i = /* @__PURE__ */ new Map();
410
+ for (const s of n ?? []) {
411
+ const o = s.displayName || s.name;
412
+ o && i.set(s.id, o);
398
413
  }
399
- return { functions: a, workflows: s };
400
- }
401
- function zn(e, n) {
402
- const a = e.summary ?? we(e.kind), s = rt(e.kind);
403
- if (s === "function" && e.functionId !== null) {
404
- const i = n.functions.get(e.functionId);
405
- if (i !== void 0)
406
- return { text: i, target: { kind: "function", id: e.functionId } };
414
+ return { functions: a, workflows: i };
415
+ }
416
+ function ua(e, n) {
417
+ const a = e.summary ?? ve(e.kind), i = kt(e.kind);
418
+ if (i === "function" && e.functionId !== null) {
419
+ const s = n.functions.get(e.functionId);
420
+ if (s !== void 0)
421
+ return { text: s, target: { kind: "function", id: e.functionId } };
407
422
  }
408
- if (s === "workflow" && e.workflowId !== null) {
409
- const i = n.workflows.get(e.workflowId);
410
- if (i !== void 0)
411
- return { text: i, target: { kind: "workflow", id: e.workflowId } };
423
+ if (i === "workflow" && e.workflowId !== null) {
424
+ const s = n.workflows.get(e.workflowId);
425
+ if (s !== void 0)
426
+ return { text: s, target: { kind: "workflow", id: e.workflowId } };
412
427
  }
413
- if (s === "workflow_step") {
414
- const i = e.workflowId, o = i !== null ? n.workflows.get(i) : void 0, l = o ?? i ?? e.summary ?? "Unknown workflow", d = o !== void 0 && i !== null;
428
+ if (i === "workflow_step") {
429
+ const s = e.workflowId, o = s !== null ? n.workflows.get(s) : void 0, r = o ?? s ?? e.summary ?? "Unknown workflow", c = o !== void 0 && s !== null;
415
430
  return {
416
- text: e.stepId ? `${l} - ${e.stepId}` : l,
417
- target: d ? { kind: "workflow", id: i } : null
431
+ text: e.stepId ? `${r} - ${e.stepId}` : r,
432
+ target: c ? { kind: "workflow", id: s } : null
418
433
  };
419
434
  }
420
435
  return { text: a, target: null };
421
436
  }
422
- const oe = (e) => String(e).padStart(2, "0");
423
- function lt(e) {
437
+ const de = (e) => String(e).padStart(2, "0");
438
+ function Ct(e) {
424
439
  const n = new Date(e);
425
- return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${oe(n.getMonth() + 1)}-${oe(n.getDate())}`} ${oe(n.getHours())}:${oe(n.getMinutes())}:${oe(n.getSeconds())}`;
440
+ return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${de(n.getMonth() + 1)}-${de(n.getDate())}`} ${de(n.getHours())}:${de(n.getMinutes())}:${de(n.getSeconds())}`;
426
441
  }
427
- function ot(e) {
442
+ function Tt(e) {
428
443
  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`;
429
444
  }
430
- function Gn() {
445
+ function ma() {
431
446
  const e = /* @__PURE__ */ new Date();
432
447
  return e.setHours(0, 0, 0, 0), e.toISOString();
433
448
  }
434
- function Zn(e, n) {
449
+ function ha(e, n) {
435
450
  const a = new Date(e);
436
451
  if (Number.isNaN(a.getTime())) return e;
437
- const s = a.toLocaleDateString(void 0, { month: "short", day: "numeric" });
438
- return n === "week" ? `Week of ${s}` : s;
452
+ const i = a.toLocaleDateString(void 0, { month: "short", day: "numeric" });
453
+ return n === "week" ? `Week of ${i}` : i;
439
454
  }
440
- function ct({ ok: e }) {
455
+ function Et({ ok: e }) {
441
456
  return e === null ? /* @__PURE__ */ t("span", { className: "muted", children: "–" }) : /* @__PURE__ */ t("span", { className: e ? "ok" : "error", children: e ? "✓" : "✗" });
442
457
  }
443
- function ve({ label: e, value: n }) {
444
- return /* @__PURE__ */ r("div", { className: "w6w-activity-card w6w-activity-stat", children: [
458
+ function De({ label: e, value: n }) {
459
+ return /* @__PURE__ */ l("div", { className: "w6w-activity-card w6w-activity-stat", children: [
445
460
  /* @__PURE__ */ t("div", { className: "w6w-activity-stat-value", children: n }),
446
461
  /* @__PURE__ */ t("div", { className: "muted small", children: e })
447
462
  ] });
448
463
  }
449
- function Se({
464
+ function Qe({
450
465
  title: e,
451
466
  headline: n,
452
467
  loading: a
453
468
  }) {
454
- const s = n ?? { workflowRuns: 0, succeeded: 0, failed: 0 };
455
- return /* @__PURE__ */ r("section", { className: "w6w-activity-section", children: [
469
+ const i = n ?? { workflowRuns: 0, succeeded: 0, failed: 0 };
470
+ return /* @__PURE__ */ l("section", { className: "w6w-activity-section", children: [
456
471
  /* @__PURE__ */ t("h3", { children: e }),
457
- a ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ r("div", { className: "w6w-activity-stats", children: [
458
- /* @__PURE__ */ t(ve, { label: "Workflow runs", value: s.workflowRuns }),
459
- /* @__PURE__ */ t(ve, { label: "Succeeded", value: s.succeeded }),
460
- /* @__PURE__ */ t(ve, { label: "Failed", value: s.failed })
472
+ a ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ l("div", { className: "w6w-activity-stats", children: [
473
+ /* @__PURE__ */ t(De, { label: "Workflow runs", value: i.workflowRuns }),
474
+ /* @__PURE__ */ t(De, { label: "Succeeded", value: i.succeeded }),
475
+ /* @__PURE__ */ t(De, { label: "Failed", value: i.failed })
461
476
  ] })
462
477
  ] });
463
478
  }
464
- function Xn({
479
+ function wa({
465
480
  entry: e,
466
481
  names: n,
467
482
  getHref: a,
468
- onOpen: s
483
+ onOpen: i
469
484
  }) {
470
- const { text: i, target: o } = zn(e, n);
471
- if (o === null) return /* @__PURE__ */ t(K, { children: i });
472
- const l = s ? (d) => s(o, d) : void 0;
473
- return a ? /* @__PURE__ */ t("a", { href: a(o), onClick: l, children: i }) : l ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: l, children: i }) : /* @__PURE__ */ t(K, { children: i });
485
+ const { text: s, target: o } = ua(e, n);
486
+ if (o === null) return /* @__PURE__ */ t(Q, { children: s });
487
+ const r = i ? (c) => i(o, c) : void 0;
488
+ return a ? /* @__PURE__ */ t("a", { href: a(o), onClick: r, children: s }) : r ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: r, children: s }) : /* @__PURE__ */ t(Q, { children: s });
474
489
  }
475
- function dt({ entry: e, title: n }) {
476
- const a = ot(e.durationMs);
490
+ function It({ entry: e, title: n }) {
491
+ const a = Tt(e.durationMs);
477
492
  return /* @__PURE__ */ t(
478
- ke,
493
+ Ae,
479
494
  {
480
- icon: /* @__PURE__ */ t(ct, { ok: e.ok }),
481
- title: n ?? e.summary ?? we(e.kind),
482
- subtitle: `${we(e.kind)} · ${lt(e.occurredAt)}`,
495
+ icon: /* @__PURE__ */ t(Et, { ok: e.ok }),
496
+ title: n ?? e.summary ?? ve(e.kind),
497
+ subtitle: `${ve(e.kind)} · ${Ct(e.occurredAt)}`,
483
498
  trailing: a === null ? void 0 : /* @__PURE__ */ t("span", { className: "muted small", children: a })
484
499
  }
485
500
  );
486
501
  }
487
- function Ne(e) {
488
- return /* @__PURE__ */ t(dt, { entry: e.entry, title: /* @__PURE__ */ t(Xn, { ...e }) });
502
+ function $e(e) {
503
+ return /* @__PURE__ */ t(It, { entry: e.entry, title: /* @__PURE__ */ t(wa, { ...e }) });
489
504
  }
490
- const ea = {
491
- base: (e) => /* @__PURE__ */ t(dt, { entry: e.entry }),
492
- function: Ne,
493
- workflow: Ne,
494
- workflow_step: Ne
505
+ const pa = {
506
+ base: (e) => /* @__PURE__ */ t(It, { entry: e.entry }),
507
+ function: $e,
508
+ workflow: $e,
509
+ workflow_step: $e
495
510
  };
496
- function ta(e) {
497
- const n = ea[rt(e.entry.kind)];
511
+ function fa(e) {
512
+ const n = pa[kt(e.entry.kind)];
498
513
  return /* @__PURE__ */ t(n, { ...e });
499
514
  }
500
- function gi({ getHref: e, onOpen: n, slots: a }) {
501
- var $, g, m, y, D, E;
502
- const s = Re("today", { from: Gn(), bucket: "day" }), i = Re("week", { bucket: "week" }), o = qe(), l = Je(), d = ie(
503
- () => Yn(o.data, l.data),
504
- [o.data, l.data]
505
- ), u = s.error ?? i.error, h = u ? u.message : null, v = (($ = i.data) == null ? void 0 : $.recent) ?? [], w = ((g = i.data) == null ? void 0 : g.series) ?? [], b = ((m = i.data) == null ? void 0 : m.range.bucket) ?? "week", N = !i.isLoading && v.length === 0 && (((y = i.data) == null ? void 0 : y.headline.workflowRuns) ?? 0) === 0;
506
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
515
+ function Ws({ getHref: e, onOpen: n, slots: a }) {
516
+ var v, y, p, C, I, b;
517
+ const i = Fe("today", { from: ma(), bucket: "day" }), s = Fe("week", { bucket: "week" }), o = Ye(), r = tt(), c = ie(
518
+ () => da(o.data, r.data),
519
+ [o.data, r.data]
520
+ ), u = i.error ?? s.error, h = u ? u.message : null, g = ((v = s.data) == null ? void 0 : v.recent) ?? [], m = ((y = s.data) == null ? void 0 : y.series) ?? [], k = ((p = s.data) == null ? void 0 : p.range.bucket) ?? "week", w = !s.isLoading && g.length === 0 && (((C = s.data) == null ? void 0 : C.headline.workflowRuns) ?? 0) === 0;
521
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
507
522
  h && /* @__PURE__ */ t("div", { className: "error", children: h }),
508
523
  a == null ? void 0 : a.header,
509
524
  a == null ? void 0 : a.actions,
510
525
  /* @__PURE__ */ t(
511
- Se,
526
+ Qe,
512
527
  {
513
528
  title: "Today",
514
- headline: (D = s.data) == null ? void 0 : D.headline,
515
- loading: s.isLoading
529
+ headline: (I = i.data) == null ? void 0 : I.headline,
530
+ loading: i.isLoading
516
531
  }
517
532
  ),
518
533
  /* @__PURE__ */ t(
519
- Se,
534
+ Qe,
520
535
  {
521
536
  title: "Last 7 days",
522
- headline: (E = i.data) == null ? void 0 : E.headline,
523
- loading: i.isLoading
537
+ headline: (b = s.data) == null ? void 0 : b.headline,
538
+ loading: s.isLoading
524
539
  }
525
540
  ),
526
541
  a == null ? void 0 : a.betweenHeadlineAndSeries,
527
- /* @__PURE__ */ r("section", { className: "w6w-activity-section", children: [
542
+ /* @__PURE__ */ l("section", { className: "w6w-activity-section", children: [
528
543
  /* @__PURE__ */ t("h3", { children: "Activity over time" }),
529
- /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: i.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: w.map((x) => /* @__PURE__ */ r("li", { children: [
530
- /* @__PURE__ */ r("span", { className: "list-main", children: [
531
- /* @__PURE__ */ t("strong", { children: Zn(x.bucket, b) }),
544
+ /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: s.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((E) => /* @__PURE__ */ l("li", { children: [
545
+ /* @__PURE__ */ l("span", { className: "list-main", children: [
546
+ /* @__PURE__ */ t("strong", { children: ha(E.bucket, k) }),
532
547
  " ",
533
- /* @__PURE__ */ t("span", { className: "muted small", children: we(x.kind) })
548
+ /* @__PURE__ */ t("span", { className: "muted small", children: ve(E.kind) })
534
549
  ] }),
535
550
  " ",
536
- /* @__PURE__ */ t(ct, { ok: x.ok }),
551
+ /* @__PURE__ */ t(Et, { ok: E.ok }),
537
552
  " ",
538
- /* @__PURE__ */ t("span", { className: "muted small", children: x.count })
539
- ] }, `${x.bucket}-${x.kind}-${String(x.ok)}`)) }) })
553
+ /* @__PURE__ */ t("span", { className: "muted small", children: E.count })
554
+ ] }, `${E.bucket}-${E.kind}-${String(E.ok)}`)) }) })
540
555
  ] }),
541
- /* @__PURE__ */ r("section", { children: [
556
+ /* @__PURE__ */ l("section", { children: [
542
557
  /* @__PURE__ */ t("h3", { className: "w6w-activity-h3", children: "Recent activity" }),
543
- /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: i.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : N ? (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("p", { className: "muted", children: "No runs yet — activity shows up here once your workflows run." }) : v.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No recent activity in this window." }) : /* @__PURE__ */ t("div", { className: "list", children: v.map((x) => /* @__PURE__ */ t(
544
- ta,
558
+ /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: s.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : w ? (a == null ? void 0 : a.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((E) => /* @__PURE__ */ t(
559
+ fa,
545
560
  {
546
- entry: x,
547
- names: d,
561
+ entry: E,
562
+ names: c,
548
563
  getHref: e,
549
564
  onOpen: n
550
565
  },
551
- x.id
566
+ E.id
552
567
  )) }) })
553
568
  ] })
554
569
  ] });
555
570
  }
556
- function na(e) {
571
+ function ya(e) {
557
572
  return e !== null && "project" in e;
558
573
  }
559
- function aa(e) {
560
- const n = $e().project, [a, s] = f(ln), i = e.scope !== void 0 ? e.scope : n ? { project: n } : null, o = e.filters !== void 0, l = e.filters ?? a, d = (u) => {
574
+ function ga(e) {
575
+ const n = Me().project, [a, i] = f(bn), s = e.scope !== void 0 ? e.scope : n ? { project: n } : null, o = e.filters !== void 0, r = e.filters ?? a, c = (u) => {
561
576
  var h;
562
- o || s(u), (h = e.onFiltersChange) == null || h.call(e, u);
577
+ o || i(u), (h = e.onFiltersChange) == null || h.call(e, u);
563
578
  };
564
579
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
565
- Nn,
580
+ xn,
566
581
  {
567
- scope: i,
568
- showKind: e.showKind ?? na(i),
569
- filters: l,
570
- onFiltersChange: d,
582
+ scope: s,
583
+ showKind: e.showKind ?? ya(s),
584
+ filters: r,
585
+ onFiltersChange: c,
571
586
  onOpenInEditor: e.onOpenInEditor
572
587
  }
573
588
  ) });
574
589
  }
575
- function ia({ title: e = "Logs", ...n }) {
576
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-logs", children: [
590
+ function va({ title: e = "Logs", ...n }) {
591
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-logs", children: [
577
592
  e !== null && /* @__PURE__ */ t("h2", { children: e }),
578
- /* @__PURE__ */ t(aa, { ...n })
593
+ /* @__PURE__ */ t(ga, { ...n })
579
594
  ] });
580
595
  }
581
- const yi = ia, sa = 1440 * 60 * 1e3;
582
- function ra(e) {
596
+ const Bs = va, ba = 1440 * 60 * 1e3;
597
+ function Na(e) {
583
598
  if (!(e === null || e.timeline === null))
584
599
  return e.timeline.map((n) => ({
585
600
  id: n.id,
@@ -592,39 +607,39 @@ function ra(e) {
592
607
  link: n.link
593
608
  }));
594
609
  }
595
- function ut(e) {
610
+ function Dt(e) {
596
611
  return e.startedAt !== void 0 && e.resolvedAt === void 0;
597
612
  }
598
- function Pe(e) {
613
+ function _e(e) {
599
614
  const n = new Date(e);
600
615
  return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone: "UTC" });
601
616
  }
602
- function Oe(e, n) {
617
+ function qe(e, n) {
603
618
  const a = new Date(e).getTime();
604
- return Number.isNaN(a) ? 0 : Math.max(0, Math.floor((n - a) / sa));
619
+ return Number.isNaN(a) ? 0 : Math.max(0, Math.floor((n - a) / ba));
605
620
  }
606
- function la(e, n) {
607
- if (!ut(e) || e.startedAt === void 0) return null;
608
- const a = Oe(e.startedAt, n), s = Pe(e.startedAt), i = a === 0 ? `open since ${s} (today)` : `open ${a}d (since ${s})`, o = e.updatedAt ?? e.startedAt, l = Oe(o, n), d = Pe(o), u = l === 0 ? `last update ${d} (today)` : `last update ${d} (${l}d ago)`;
609
- return `${i} · ${u}`;
621
+ function ka(e, n) {
622
+ if (!Dt(e) || e.startedAt === void 0) return null;
623
+ const a = qe(e.startedAt, n), i = _e(e.startedAt), s = a === 0 ? `open since ${i} (today)` : `open ${a}d (since ${i})`, o = e.updatedAt ?? e.startedAt, r = qe(o, n), c = _e(o), u = r === 0 ? `last update ${c} (today)` : `last update ${c} (${r}d ago)`;
624
+ return `${s} · ${u}`;
610
625
  }
611
- function oa(e) {
626
+ function Ca(e) {
612
627
  return e ? Object.entries(e) : [];
613
628
  }
614
- function ca(e) {
629
+ function Ta(e) {
615
630
  return e.uptime.map((n) => ({ day: n.day, state: n.state }));
616
631
  }
617
- const se = [
632
+ const le = [
618
633
  ["e4xx", "4xx"],
619
634
  ["e429", "429 rate-limited"],
620
635
  ["eAuth", "auth (401/403)"],
621
636
  ["e5xx", "5xx"]
622
637
  ];
623
- function mt(e) {
638
+ function $t(e) {
624
639
  const n = new Date(e);
625
640
  return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString(void 0, { month: "short", day: "numeric" });
626
641
  }
627
- function Ie(e) {
642
+ function Oe(e) {
628
643
  if (!e) return "—";
629
644
  const n = new Date(e);
630
645
  return Number.isNaN(n.getTime()) ? e : n.toLocaleString(void 0, {
@@ -634,37 +649,37 @@ function Ie(e) {
634
649
  minute: "2-digit"
635
650
  });
636
651
  }
637
- function me({ label: e, value: n, hint: a }) {
638
- return /* @__PURE__ */ r("div", { className: "w6w-rel-card", style: { flex: "1 1 150px", minWidth: 150 }, children: [
652
+ function fe({ label: e, value: n, hint: a }) {
653
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", style: { flex: "1 1 150px", minWidth: 150 }, children: [
639
654
  /* @__PURE__ */ t("div", { style: { fontSize: "1.6rem", fontWeight: "var(--w6w-fw-semibold)", lineHeight: 1.15 }, children: n }),
640
655
  /* @__PURE__ */ t("div", { className: "muted small", children: e }),
641
656
  a && /* @__PURE__ */ t("div", { className: "muted small", children: a })
642
657
  ] });
643
658
  }
644
- function da({
659
+ function Ea({
645
660
  vendor: e,
646
661
  displayName: n
647
662
  }) {
648
663
  if (!e)
649
- return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
650
- /* @__PURE__ */ r("h4", { style: { margin: "0 0 var(--w6w-sp-1)" }, children: [
664
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
665
+ /* @__PURE__ */ l("h4", { style: { margin: "0 0 var(--w6w-sp-1)" }, children: [
651
666
  n,
652
667
  " status"
653
668
  ] }),
654
- /* @__PURE__ */ r("p", { className: "muted", children: [
669
+ /* @__PURE__ */ l("p", { className: "muted", children: [
655
670
  n,
656
671
  " publishes no public health check, so there is nothing to ask about it. That is a statement about ",
657
672
  n,
658
673
  ", not a gap in the data above."
659
674
  ] })
660
675
  ] });
661
- const a = e.state === "unknown", s = oa(e.components), i = (e.timeline ?? []).filter(ut), o = Date.now();
662
- return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
663
- /* @__PURE__ */ r("h4", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
676
+ const a = e.state === "unknown", i = Ca(e.components), s = (e.timeline ?? []).filter(Dt), o = Date.now();
677
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
678
+ /* @__PURE__ */ l("h4", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
664
679
  n,
665
680
  " status",
666
681
  " ",
667
- /* @__PURE__ */ t(he, { state: e.state, label: a ? "Unavailable" : void 0 })
682
+ /* @__PURE__ */ t(ye, { state: e.state, label: a ? "Unavailable" : void 0 })
668
683
  ] }),
669
684
  a && /* @__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." }),
670
685
  e.message && /* @__PURE__ */ t(
@@ -675,7 +690,7 @@ function da({
675
690
  children: e.message
676
691
  }
677
692
  ),
678
- /* @__PURE__ */ r("p", { className: "muted small", style: { margin: 0 }, children: [
693
+ /* @__PURE__ */ l("p", { className: "muted small", style: { margin: 0 }, children: [
679
694
  a ? "Tried to read" : "Read from",
680
695
  " ",
681
696
  n,
@@ -684,167 +699,167 @@ function da({
684
699
  n,
685
700
  " says about itself, not what your calls did · last checked",
686
701
  " ",
687
- Ie(e.checkedAt),
688
- e.attributedTo.length > 0 && /* @__PURE__ */ r(K, { children: [
702
+ Oe(e.checkedAt),
703
+ e.attributedTo.length > 0 && /* @__PURE__ */ l(Q, { children: [
689
704
  " ",
690
705
  "· decided by",
691
706
  " ",
692
- e.attributedTo.map((l) => /* @__PURE__ */ t("code", { children: l }, l))
707
+ e.attributedTo.map((r) => /* @__PURE__ */ t("code", { children: r }, r))
693
708
  ] })
694
709
  ] }),
695
- s.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: s.map(([l, d]) => /* @__PURE__ */ r("span", { className: "w6w-rel-tag", children: [
696
- l,
710
+ i.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: i.map(([r, c]) => /* @__PURE__ */ l("span", { className: "w6w-rel-tag", children: [
711
+ r,
697
712
  ": ",
698
- d.state
699
- ] }, l)) }),
700
- i.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: i.map((l) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ r("div", { className: "list-main", children: [
701
- /* @__PURE__ */ t("strong", { children: l.title }),
713
+ c.state
714
+ ] }, r)) }),
715
+ s.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: s.map((r) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l("div", { className: "list-main", children: [
716
+ /* @__PURE__ */ t("strong", { children: r.title }),
702
717
  " ",
703
- /* @__PURE__ */ t(he, { state: l.state }),
704
- /* @__PURE__ */ t("div", { className: "muted small", children: la(l, o) })
705
- ] }) }, l.id ?? l.title)) }),
706
- e.statusPageUrl !== null && /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: /* @__PURE__ */ r("a", { href: e.statusPageUrl, target: "_blank", rel: "noopener noreferrer", children: [
718
+ /* @__PURE__ */ t(ye, { state: r.state }),
719
+ /* @__PURE__ */ t("div", { className: "muted small", children: ka(r, o) })
720
+ ] }) }, r.id ?? r.title)) }),
721
+ e.statusPageUrl !== null && /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: /* @__PURE__ */ l("a", { href: e.statusPageUrl, target: "_blank", rel: "noopener noreferrer", children: [
707
722
  n,
708
723
  "'s status page ↗"
709
724
  ] }) })
710
725
  ] });
711
726
  }
712
- function ua({ service: e }) {
727
+ function Ia({ service: e }) {
713
728
  if (e.calls === 0)
714
729
  return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("span", { className: "w6w-rel-idle-note", children: "No calls in this window" }) });
715
- const n = e.uptime, a = Math.max(1, ...n.map((s) => s.calls));
716
- return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
730
+ const n = e.uptime, a = Math.max(1, ...n.map((i) => i.calls));
731
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
717
732
  /* @__PURE__ */ t(
718
733
  "div",
719
734
  {
720
735
  className: "rel-daily-chart",
721
736
  role: "img",
722
737
  "aria-label": `${e.displayName}, calls per day, oldest first`,
723
- children: n.map((s) => /* @__PURE__ */ t(
738
+ children: n.map((i) => /* @__PURE__ */ t(
724
739
  "span",
725
740
  {
726
- className: `rel-daily-bar rel-daily-bar-${s.state}`,
727
- style: { height: `${s.calls > 0 ? Math.max(s.calls / a * 100, 4) : 2}%` },
728
- title: `${mt(`${s.day}T00:00:00.000Z`)} — ${s.calls} calls, ${s.state}`
741
+ className: `rel-daily-bar rel-daily-bar-${i.state}`,
742
+ style: { height: `${i.calls > 0 ? Math.max(i.calls / a * 100, 4) : 2}%` },
743
+ title: `${$t(`${i.day}T00:00:00.000Z`)} — ${i.calls} calls, ${i.state}`
729
744
  },
730
- s.day
745
+ i.day
731
746
  ))
732
747
  }
733
748
  ),
734
749
  /* @__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." })
735
750
  ] });
736
751
  }
737
- function ma({
752
+ function Da({
738
753
  service: e,
739
754
  window: n
740
755
  }) {
741
- const a = [...e.uptime].reverse().filter((l) => l.calls > 0), s = e.vendorStatus, i = ra(s), o = i === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
742
- return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
756
+ const a = [...e.uptime].reverse().filter((r) => r.calls > 0), i = e.vendorStatus, s = Na(i), o = s === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
757
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
743
758
  /* @__PURE__ */ t(
744
- Lt,
759
+ _t,
745
760
  {
746
761
  window: n,
747
- days: ca(e),
748
- incidents: i,
762
+ days: Ta(e),
763
+ incidents: s,
749
764
  vendorEmptyLabel: o,
750
765
  ariaLabel: `${e.displayName}, ${e.uptime.length}-day status and ${e.displayName} incidents, oldest day first`
751
766
  }
752
767
  ),
753
- /* @__PURE__ */ r("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: [
768
+ /* @__PURE__ */ l("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: [
754
769
  "Oldest day leftmost. Days with no calls are ",
755
770
  /* @__PURE__ */ t("code", { children: "unknown" }),
756
771
  " — never a quiet green."
757
772
  ] }),
758
- a.length > 0 && /* @__PURE__ */ t("div", { className: "list", style: { marginTop: "var(--w6w-sp-3)" }, children: a.slice(0, 14).map((l) => /* @__PURE__ */ r("div", { className: "rel-day-row", children: [
759
- /* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: mt(`${l.day}T00:00:00.000Z`) }) }),
760
- /* @__PURE__ */ t(he, { state: l.state }),
761
- /* @__PURE__ */ r("span", { className: "muted small", children: [
762
- l.calls,
773
+ a.length > 0 && /* @__PURE__ */ t("div", { className: "list", style: { marginTop: "var(--w6w-sp-3)" }, children: a.slice(0, 14).map((r) => /* @__PURE__ */ l("div", { className: "rel-day-row", children: [
774
+ /* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: $t(`${r.day}T00:00:00.000Z`) }) }),
775
+ /* @__PURE__ */ t(ye, { state: r.state }),
776
+ /* @__PURE__ */ l("span", { className: "muted small", children: [
777
+ r.calls,
763
778
  " calls"
764
779
  ] }),
765
- /* @__PURE__ */ t("span", { className: "rel-errors", children: se.filter(([d]) => l.errors[d] > 0).map(([d, u]) => /* @__PURE__ */ r("span", { className: "w6w-rel-tag", children: [
780
+ /* @__PURE__ */ t("span", { className: "rel-errors", children: le.filter(([c]) => r.errors[c] > 0).map(([c, u]) => /* @__PURE__ */ l("span", { className: "w6w-rel-tag", children: [
766
781
  u,
767
782
  " ×",
768
- l.errors[d]
769
- ] }, d)) })
770
- ] }, l.day)) })
783
+ r.errors[c]
784
+ ] }, c)) })
785
+ ] }, r.day)) })
771
786
  ] });
772
787
  }
773
- function ha({ errors: e }) {
774
- if (se.reduce((s, [i]) => s + e[i], 0) === 0)
788
+ function $a({ errors: e }) {
789
+ if (le.reduce((i, [s]) => i + e[s], 0) === 0)
775
790
  return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("p", { className: "muted", style: { margin: 0 }, children: "No errors in this window." }) });
776
- const a = Math.max(1, ...se.map(([s]) => e[s]));
777
- return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: se.map(([s, i]) => /* @__PURE__ */ r("div", { className: "rel-errormix-row", children: [
778
- /* @__PURE__ */ t("span", { className: "muted small", children: i }),
791
+ const a = Math.max(1, ...le.map(([i]) => e[i]));
792
+ return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: le.map(([i, s]) => /* @__PURE__ */ l("div", { className: "rel-errormix-row", children: [
793
+ /* @__PURE__ */ t("span", { className: "muted small", children: s }),
779
794
  /* @__PURE__ */ t("span", { className: "rel-errormix-track", children: /* @__PURE__ */ t(
780
795
  "span",
781
796
  {
782
797
  className: "rel-errormix-bar",
783
- style: { width: `${Math.max(e[s] / a * 100, e[s] > 0 ? 2 : 0)}%` }
798
+ style: { width: `${Math.max(e[i] / a * 100, e[i] > 0 ? 2 : 0)}%` }
784
799
  }
785
800
  ) }),
786
- /* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[s] })
787
- ] }, s)) });
801
+ /* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[i] })
802
+ ] }, i)) });
788
803
  }
789
- function wa({ project: e, appId: n }) {
790
- const a = mn(e, n, { limit: 50 });
804
+ function La({ project: e, appId: n }) {
805
+ const a = En(e, n, { limit: 50 });
791
806
  if (a.isLoading) return /* @__PURE__ */ t("p", { className: "muted", children: "Loading calls…" });
792
807
  if (a.error) {
793
- const i = a.error;
794
- return /* @__PURE__ */ t("div", { className: "error", children: (i instanceof ze, i.message) });
808
+ const s = a.error;
809
+ return /* @__PURE__ */ t("div", { className: "error", children: (s instanceof at, s.message) });
795
810
  }
796
- const s = a.data ?? [];
797
- return s.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__ */ r("div", { className: "rel-calls", children: [
798
- /* @__PURE__ */ r("div", { className: "rel-call rel-call-head", children: [
811
+ const i = a.data ?? [];
812
+ 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__ */ l("div", { className: "rel-calls", children: [
813
+ /* @__PURE__ */ l("div", { className: "rel-call rel-call-head", children: [
799
814
  /* @__PURE__ */ t("span", { children: "When" }),
800
815
  /* @__PURE__ */ t("span", { children: "Action" }),
801
816
  /* @__PURE__ */ t("span", { children: "Method" }),
802
817
  /* @__PURE__ */ t("span", { children: "Status" }),
803
818
  /* @__PURE__ */ t("span", { children: "Took" })
804
819
  ] }),
805
- s.map((i, o) => /* @__PURE__ */ r("div", { className: "rel-call", children: [
806
- /* @__PURE__ */ t("span", { className: "muted small", children: Ie(i.createdAt) }),
807
- /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: i.actionKey ?? "—" }) }),
808
- /* @__PURE__ */ t("span", { className: "muted small", children: i.method }),
809
- /* @__PURE__ */ t("span", { className: i.status >= 400 || i.status === 0 ? "error" : "ok", children: i.status === 0 ? "no response" : i.status }),
810
- /* @__PURE__ */ t("span", { className: "muted small", children: i.durationMs != null ? `${i.durationMs} ms` : "—" })
811
- ] }, i.id ?? `${i.createdAt}-${o}`))
820
+ i.map((s, o) => /* @__PURE__ */ l("div", { className: "rel-call", children: [
821
+ /* @__PURE__ */ t("span", { className: "muted small", children: Oe(s.createdAt) }),
822
+ /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: s.actionKey ?? "—" }) }),
823
+ /* @__PURE__ */ t("span", { className: "muted small", children: s.method }),
824
+ /* @__PURE__ */ t("span", { className: s.status >= 400 || s.status === 0 ? "error" : "ok", children: s.status === 0 ? "no response" : s.status }),
825
+ /* @__PURE__ */ t("span", { className: "muted small", children: s.durationMs != null ? `${s.durationMs} ms` : "—" })
826
+ ] }, s.id ?? `${s.createdAt}-${o}`))
812
827
  ] });
813
828
  }
814
- function pa({
829
+ function Aa({
815
830
  backHref: e,
816
831
  onBack: n
817
832
  }) {
818
833
  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;
819
834
  }
820
- function vi({
835
+ function Us({
821
836
  appId: e,
822
837
  project: n,
823
838
  days: a = 30,
824
- backHref: s,
825
- onBack: i,
839
+ backHref: i,
840
+ onBack: s,
826
841
  slots: o
827
842
  }) {
828
- var b, N, $, g;
829
- const l = $e().project, d = (n === void 0 ? l : n) || void 0, u = un(d, [e], a), h = u.error, v = h ? (h instanceof ze, h.message) : null, w = (b = u.data) == null ? void 0 : b.services.find((m) => m.appId === e);
830
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
843
+ var k, w, v, y;
844
+ const r = Me().project, c = (n === void 0 ? r : n) || void 0, u = Tn(c, [e], a), h = u.error, g = h ? (h instanceof at, h.message) : null, m = (k = u.data) == null ? void 0 : k.services.find((p) => p.appId === e);
845
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
831
846
  o == null ? void 0 : o.header,
832
847
  o == null ? void 0 : o.actions,
833
- !d && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see this service." }),
834
- v && /* @__PURE__ */ t("div", { className: "error", children: v }),
835
- d && u.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
836
- u.data && !w && /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
837
- (o == null ? void 0 : o.empty) ?? /* @__PURE__ */ r("p", { className: "muted", children: [
848
+ !c && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see this service." }),
849
+ g && /* @__PURE__ */ t("div", { className: "error", children: g }),
850
+ c && u.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
851
+ u.data && !m && /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
852
+ (o == null ? void 0 : o.empty) ?? /* @__PURE__ */ l("p", { className: "muted", children: [
838
853
  /* @__PURE__ */ t("code", { children: e }),
839
854
  " is not used by this project's definitions and has no calls in the last ",
840
855
  a,
841
856
  " days."
842
857
  ] }),
843
- /* @__PURE__ */ t(pa, { backHref: s, onBack: i })
858
+ /* @__PURE__ */ t(Aa, { backHref: i, onBack: s })
844
859
  ] }),
845
- w && /* @__PURE__ */ r(K, { children: [
846
- /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
847
- /* @__PURE__ */ r(
860
+ m && /* @__PURE__ */ l(Q, { children: [
861
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
862
+ /* @__PURE__ */ l(
848
863
  "div",
849
864
  {
850
865
  style: {
@@ -854,68 +869,68 @@ function vi({
854
869
  marginBottom: "var(--w6w-sp-3)"
855
870
  },
856
871
  children: [
857
- /* @__PURE__ */ t(he, { state: w.state }),
872
+ /* @__PURE__ */ t(ye, { state: m.state }),
858
873
  /* @__PURE__ */ t("span", { className: "muted small", children: "from your calls" }),
859
- /* @__PURE__ */ t("code", { className: "muted small", children: w.appId }),
860
- w.ongoingOutageId && /* @__PURE__ */ t("span", { className: "w6w-rel-tag", children: "outage still open" })
874
+ /* @__PURE__ */ t("code", { className: "muted small", children: m.appId }),
875
+ m.ongoingOutageId && /* @__PURE__ */ t("span", { className: "w6w-rel-tag", children: "outage still open" })
861
876
  ]
862
877
  }
863
878
  ),
864
- /* @__PURE__ */ r("div", { style: { display: "flex", gap: "var(--w6w-sp-3)", flexWrap: "wrap" }, children: [
865
- /* @__PURE__ */ t(me, { label: "Calls in window", value: String(w.calls) }),
879
+ /* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-3)", flexWrap: "wrap" }, children: [
880
+ /* @__PURE__ */ t(fe, { label: "Calls in window", value: String(m.calls) }),
866
881
  /* @__PURE__ */ t(
867
- me,
882
+ fe,
868
883
  {
869
884
  label: "p95 latency",
870
- value: w.p95Ms === null ? "—" : `${w.p95Ms} ms`,
871
- hint: w.p95Ms === null ? "no timed calls" : void 0
885
+ value: m.p95Ms === null ? "—" : `${m.p95Ms} ms`,
886
+ hint: m.p95Ms === null ? "no timed calls" : void 0
872
887
  }
873
888
  ),
874
- /* @__PURE__ */ t(me, { label: "Last call", value: Ie(w.lastCallAt) }),
889
+ /* @__PURE__ */ t(fe, { label: "Last call", value: Oe(m.lastCallAt) }),
875
890
  /* @__PURE__ */ t(
876
- me,
891
+ fe,
877
892
  {
878
893
  label: "Errors",
879
- value: String(se.reduce((m, [y]) => m + w.errors[y], 0)),
880
- hint: se.filter(([m]) => w.errors[m] > 0).map(([m, y]) => `${y} ×${w.errors[m]}`).join(" · ") || "none"
894
+ value: String(le.reduce((p, [C]) => p + m.errors[C], 0)),
895
+ hint: le.filter(([p]) => m.errors[p] > 0).map(([p, C]) => `${C} ×${m.errors[p]}`).join(" · ") || "none"
881
896
  }
882
897
  )
883
898
  ] })
884
899
  ] }),
885
- /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
900
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
886
901
  /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "Error mix" }),
887
- /* @__PURE__ */ t(ha, { errors: w.errors })
902
+ /* @__PURE__ */ t($a, { errors: m.errors })
888
903
  ] }),
889
- /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
904
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
890
905
  /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "API status" }),
891
- /* @__PURE__ */ t(da, { vendor: w.vendorStatus, displayName: w.displayName })
906
+ /* @__PURE__ */ t(Ea, { vendor: m.vendorStatus, displayName: m.displayName })
892
907
  ] }),
893
- /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
894
- /* @__PURE__ */ r("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
908
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
909
+ /* @__PURE__ */ l("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
895
910
  "Last ",
896
- ((N = u.data) == null ? void 0 : N.window.days) ?? a,
911
+ ((w = u.data) == null ? void 0 : w.window.days) ?? a,
897
912
  " days",
898
913
  " ",
899
- /* @__PURE__ */ r("span", { className: "muted small", children: [
914
+ /* @__PURE__ */ l("span", { className: "muted small", children: [
900
915
  "uptime means ",
901
- ($ = u.data) == null ? void 0 : $.uptimeMeans
916
+ (v = u.data) == null ? void 0 : v.uptimeMeans
902
917
  ] })
903
918
  ] }),
904
- /* @__PURE__ */ t(ma, { service: w, window: ((g = u.data) == null ? void 0 : g.window) ?? { from: "", to: "" } }),
905
- /* @__PURE__ */ t(ua, { service: w })
919
+ /* @__PURE__ */ t(Da, { service: m, window: ((y = u.data) == null ? void 0 : y.window) ?? { from: "", to: "" } }),
920
+ /* @__PURE__ */ t(Ia, { service: m })
906
921
  ] }),
907
- /* @__PURE__ */ r("section", { children: [
908
- /* @__PURE__ */ r("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
922
+ /* @__PURE__ */ l("section", { children: [
923
+ /* @__PURE__ */ l("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
909
924
  "Recent calls",
910
925
  " ",
911
926
  /* @__PURE__ */ t("span", { className: "muted small", children: "the requests behind the numbers above" })
912
927
  ] }),
913
- /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(wa, { project: d, appId: w.appId }) })
928
+ /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(La, { project: c, appId: m.appId }) })
914
929
  ] })
915
930
  ] })
916
931
  ] });
917
932
  }
918
- function fa(e) {
933
+ function Sa(e) {
919
934
  if (typeof e == "string") return e;
920
935
  if (e && typeof e == "object") {
921
936
  const n = e;
@@ -924,18 +939,18 @@ function fa(e) {
924
939
  }
925
940
  return String(e);
926
941
  }
927
- function ga({
942
+ function Ma({
928
943
  routes: e,
929
944
  projectId: n
930
945
  }) {
931
- const [a, s] = f(null), i = e.find((o) => o.id === a);
932
- return e.length === 0 ? null : /* @__PURE__ */ r(K, { children: [
933
- /* @__PURE__ */ t("ul", { className: "list small", "data-testid": "connection-dependent-routes", children: e.map((o) => /* @__PURE__ */ r("li", { "data-testid": `connection-dependent-route-${o.id}`, children: [
946
+ const [a, i] = f(null), s = e.find((o) => o.id === a);
947
+ return e.length === 0 ? null : /* @__PURE__ */ l(Q, { children: [
948
+ /* @__PURE__ */ t("ul", { className: "list small", "data-testid": "connection-dependent-routes", children: e.map((o) => /* @__PURE__ */ l("li", { "data-testid": `connection-dependent-route-${o.id}`, children: [
934
949
  /* @__PURE__ */ t("span", { className: "badge", children: "route" }),
935
950
  " ",
936
951
  /* @__PURE__ */ t("span", { children: o.name }),
937
952
  " ",
938
- o.status === "broken" && /* @__PURE__ */ r(K, { children: [
953
+ o.status === "broken" && /* @__PURE__ */ l(Q, { children: [
939
954
  /* @__PURE__ */ t("span", { className: "tag warn", children: "broken" }),
940
955
  " ",
941
956
  /* @__PURE__ */ t(
@@ -944,46 +959,46 @@ function ga({
944
959
  type: "button",
945
960
  className: "btn link",
946
961
  "data-testid": `connection-route-reconnect-${o.id}`,
947
- onClick: () => s(o.id),
962
+ onClick: () => i(o.id),
948
963
  children: "Reconnect"
949
964
  }
950
965
  )
951
966
  ] })
952
967
  ] }, o.id)) }),
953
- i != null && /* @__PURE__ */ t(
954
- ya,
968
+ s != null && /* @__PURE__ */ t(
969
+ xa,
955
970
  {
956
- routeId: i.id,
957
- projectId: i.project ?? n,
958
- onDone: () => s(null)
971
+ routeId: s.id,
972
+ projectId: s.project ?? n,
973
+ onDone: () => i(null)
959
974
  }
960
975
  )
961
976
  ] });
962
977
  }
963
- function ya(e) {
964
- return /* @__PURE__ */ r("div", { "data-testid": "connection-route-reconnect-host", children: [
965
- /* @__PURE__ */ t($n, { projectId: e.projectId, initialEditRouteId: e.routeId }),
978
+ function xa(e) {
979
+ return /* @__PURE__ */ l("div", { "data-testid": "connection-route-reconnect-host", children: [
980
+ /* @__PURE__ */ t(Kn, { projectId: e.projectId, initialEditRouteId: e.routeId }),
966
981
  /* @__PURE__ */ t("button", { type: "button", className: "btn link", onClick: e.onDone, children: "Done" })
967
982
  ] });
968
983
  }
969
- function ht({
984
+ function Lt({
970
985
  callables: e,
971
986
  onOpenCallable: n,
972
987
  routes: a,
973
- projectId: s
988
+ projectId: i
974
989
  }) {
975
- return /* @__PURE__ */ r(K, { children: [
976
- /* @__PURE__ */ t(ga, { routes: a ?? [], projectId: s }),
977
- /* @__PURE__ */ t(va, { callables: e, onOpenCallable: n })
990
+ return /* @__PURE__ */ l(Q, { children: [
991
+ /* @__PURE__ */ t(Ma, { routes: a ?? [], projectId: i }),
992
+ /* @__PURE__ */ t(Ra, { callables: e, onOpenCallable: n })
978
993
  ] });
979
994
  }
980
- function va({
995
+ function Ra({
981
996
  callables: e,
982
997
  onOpenCallable: n
983
998
  }) {
984
999
  return /* @__PURE__ */ t("ul", { className: "list small", children: e.map((a) => {
985
- const s = a.displayName || a.key || a.id, i = a.sites.map(fa);
986
- return /* @__PURE__ */ r("li", { children: [
1000
+ const i = a.displayName || a.key || a.id, s = a.sites.map(Sa);
1001
+ return /* @__PURE__ */ l("li", { children: [
987
1002
  /* @__PURE__ */ t("span", { className: "badge", children: a.kind }),
988
1003
  " ",
989
1004
  n ? /* @__PURE__ */ t(
@@ -992,419 +1007,419 @@ function va({
992
1007
  type: "button",
993
1008
  className: "btn link",
994
1009
  onClick: () => n(a.kind, a.id),
995
- children: s
1010
+ children: i
996
1011
  }
997
- ) : /* @__PURE__ */ t("span", { children: s }),
1012
+ ) : /* @__PURE__ */ t("span", { children: i }),
998
1013
  !a.enabled && /* @__PURE__ */ t("span", { className: "muted", children: " (disabled)" }),
999
- i.length > 0 && /* @__PURE__ */ r("span", { className: "muted", children: [
1014
+ s.length > 0 && /* @__PURE__ */ l("span", { className: "muted", children: [
1000
1015
  " · ",
1001
- i.join(", ")
1016
+ s.join(", ")
1002
1017
  ] })
1003
1018
  ] }, `${a.kind}:${a.id}`);
1004
1019
  }) });
1005
1020
  }
1006
- const Na = [];
1007
- function Ni({
1021
+ const Pa = [];
1022
+ function Hs({
1008
1023
  onOpen: e,
1009
1024
  getHref: n,
1010
1025
  addLabel: a,
1011
- slots: s,
1012
- onOpenCallable: i,
1026
+ slots: i,
1027
+ onOpenCallable: s,
1013
1028
  onCreateSharedCredential: o
1014
1029
  }) {
1015
- var R, A;
1016
- const l = We(), d = fe(), u = bn(), v = u.data ?? Na, w = ie(() => Be(v), [v]), { byId: b } = Ye(w), N = kn(), [$, g] = f(!1), [m, y] = f(null), [D, E] = f(null), x = X(void 0), k = Ze((D == null ? void 0 : D.id) ?? "", D !== null), Q = typeof l.updateConnection == "function", j = s && "actions" in s ? s.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => g(!0), children: a ?? "+ Add connection" });
1017
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
1030
+ var R, x;
1031
+ const r = Je(), c = me(), u = it(), g = u.data ?? Pa, m = ie(() => Ge(g), [g]), { byId: k } = nt(m), w = lt(), [v, y] = f(!1), [p, C] = f(null), [I, b] = f(null), E = X(void 0), T = rt((I == null ? void 0 : I.id) ?? "", I !== null), j = typeof r.updateConnection == "function", O = i && "actions" in i ? i.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => y(!0), children: a ?? "+ Add connection" });
1032
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
1018
1033
  /* @__PURE__ */ t(
1019
- Et,
1034
+ qt,
1020
1035
  {
1021
- connections: v,
1022
- appsById: b,
1036
+ connections: g,
1037
+ appsById: k,
1023
1038
  loading: u.isLoading,
1024
1039
  error: u.error ? u.error.message : null,
1025
1040
  onOpen: e,
1026
1041
  getHref: n,
1027
- onEdit: Q ? y : void 0,
1028
- onDelete: E,
1029
- busy: N.isPending,
1030
- slots: { ...s, actions: j }
1042
+ onEdit: j ? C : void 0,
1043
+ onDelete: b,
1044
+ busy: w.isPending,
1045
+ slots: { ...i, actions: O }
1031
1046
  }
1032
1047
  ),
1033
- $ && /* @__PURE__ */ t(
1034
- It,
1048
+ v && /* @__PURE__ */ t(
1049
+ Vt,
1035
1050
  {
1036
1051
  onCreateSharedCredential: o,
1037
- onClose: () => g(!1),
1052
+ onClose: () => y(!1),
1038
1053
  onCreated: () => {
1039
- g(!1), d.invalidateQueries({ queryKey: Ce });
1054
+ y(!1), c.invalidateQueries({ queryKey: ge });
1040
1055
  }
1041
1056
  }
1042
1057
  ),
1043
- m && /* @__PURE__ */ t(
1044
- Ue,
1058
+ p && /* @__PURE__ */ t(
1059
+ Ze,
1045
1060
  {
1046
- connection: m,
1047
- onClose: () => y(null),
1061
+ connection: p,
1062
+ onClose: () => C(null),
1048
1063
  onSaved: () => {
1049
- const P = m.id;
1050
- y(null), d.invalidateQueries({ queryKey: Ce }), d.invalidateQueries({ queryKey: Xe(P) });
1064
+ const D = p.id;
1065
+ C(null), c.invalidateQueries({ queryKey: ge }), c.invalidateQueries({ queryKey: ot(D) });
1051
1066
  }
1052
1067
  }
1053
1068
  ),
1054
- D && /* @__PURE__ */ t(
1055
- ba,
1069
+ I && /* @__PURE__ */ t(
1070
+ Oa,
1056
1071
  {
1057
- name: D.displayName || D.id,
1058
- loading: k.isLoading,
1059
- callables: k.isError ? [] : ((R = k.data) == null ? void 0 : R.callables) ?? [],
1060
- routes: k.isError ? [] : ((A = k.data) == null ? void 0 : A.routes) ?? [],
1061
- projectId: x,
1062
- onOpenCallable: i,
1063
- onClose: () => E(null),
1072
+ name: I.displayName || I.id,
1073
+ loading: T.isLoading,
1074
+ callables: T.isError ? [] : ((R = T.data) == null ? void 0 : R.callables) ?? [],
1075
+ routes: T.isError ? [] : ((x = T.data) == null ? void 0 : x.routes) ?? [],
1076
+ projectId: E,
1077
+ onOpenCallable: s,
1078
+ onClose: () => b(null),
1064
1079
  onConfirm: () => {
1065
- const P = D.id;
1066
- E(null), N.mutate({ id: P, force: !0 });
1080
+ const D = I.id;
1081
+ b(null), w.mutate({ id: D, force: !0 });
1067
1082
  }
1068
1083
  }
1069
1084
  )
1070
1085
  ] });
1071
1086
  }
1072
- function ba({
1087
+ function Oa({
1073
1088
  name: e,
1074
1089
  loading: n,
1075
1090
  callables: a,
1076
- routes: s,
1077
- projectId: i,
1091
+ routes: i,
1092
+ projectId: s,
1078
1093
  onOpenCallable: o,
1079
- onClose: l,
1080
- onConfirm: d
1094
+ onClose: r,
1095
+ onConfirm: c
1081
1096
  }) {
1082
- const u = a.length, h = s.length, v = u + h, w = `Delete the connection "${e}"? This cannot be undone.`, b = (g, m, y) => `${g} ${g === 1 ? m : y}`, N = [
1083
- u > 0 ? b(u, "callable", "callables") : null,
1084
- h > 0 ? b(h, "model route", "model routes") : null
1085
- ].filter(Boolean).join(" and "), $ = [
1097
+ const u = a.length, h = i.length, g = u + h, m = `Delete the connection "${e}"? This cannot be undone.`, k = (y, p, C) => `${y} ${y === 1 ? p : C}`, w = [
1098
+ u > 0 ? k(u, "callable", "callables") : null,
1099
+ h > 0 ? k(h, "model route", "model routes") : null
1100
+ ].filter(Boolean).join(" and "), v = [
1086
1101
  u > 0 ? `Deleting disables ${u === 1 ? "this callable" : `these ${u} callables`} until you reconnect ${u === 1 ? "it" : "them"}.` : null,
1087
1102
  h > 0 ? `${h === 1 ? "The model route becomes" : `The ${h} model routes become`} broken until ${h === 1 ? "it is" : "they are"} pointed at another connection.` : null
1088
- ].filter((g) => g != null);
1089
- return /* @__PURE__ */ r(Mt, { title: "Delete connection", onClose: l, children: [
1090
- /* @__PURE__ */ r("div", { className: "w6w-modal-body", children: [
1091
- /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: v === 0 ? w : `Delete the connection "${e}"? Used by ${N}.` }),
1092
- v > 0 && /* @__PURE__ */ r(K, { children: [
1103
+ ].filter((y) => y != null);
1104
+ return /* @__PURE__ */ l(Wt, { title: "Delete connection", onClose: r, children: [
1105
+ /* @__PURE__ */ l("div", { className: "w6w-modal-body", children: [
1106
+ /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: g === 0 ? m : `Delete the connection "${e}"? Used by ${w}.` }),
1107
+ g > 0 && /* @__PURE__ */ l(Q, { children: [
1093
1108
  /* @__PURE__ */ t(
1094
- ht,
1109
+ Lt,
1095
1110
  {
1096
1111
  callables: a,
1097
- routes: s,
1098
- projectId: i,
1112
+ routes: i,
1113
+ projectId: s,
1099
1114
  onOpenCallable: o
1100
1115
  }
1101
1116
  ),
1102
- /* @__PURE__ */ t("p", { className: "w6w-small", children: $.join(" ") })
1117
+ /* @__PURE__ */ t("p", { className: "w6w-small", children: v.join(" ") })
1103
1118
  ] })
1104
1119
  ] }),
1105
- /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
1106
- /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: l, children: "Cancel" }),
1120
+ /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
1121
+ /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: r, children: "Cancel" }),
1107
1122
  /* @__PURE__ */ t(
1108
1123
  "button",
1109
1124
  {
1110
1125
  type: "button",
1111
1126
  className: "w6w-btn w6w-btn-danger",
1112
1127
  disabled: n,
1113
- onClick: d,
1128
+ onClick: c,
1114
1129
  children: "Delete"
1115
1130
  }
1116
1131
  )
1117
1132
  ] })
1118
1133
  ] });
1119
1134
  }
1120
- function be(e) {
1135
+ function Le(e) {
1121
1136
  const n = new Date(e).getTime();
1122
1137
  if (Number.isNaN(n)) return "recently";
1123
1138
  const a = Math.max(0, Math.round((Date.now() - n) / 1e3));
1124
1139
  if (a < 45) return "just now";
1125
- const s = Math.round(a / 60);
1126
- if (s < 60) return `${s}m ago`;
1127
- const i = Math.round(s / 60);
1128
- if (i < 24) return `${i}h ago`;
1129
- const o = Math.round(i / 24);
1140
+ const i = Math.round(a / 60);
1141
+ if (i < 60) return `${i}m ago`;
1142
+ const s = Math.round(i / 60);
1143
+ if (s < 24) return `${s}h ago`;
1144
+ const o = Math.round(s / 24);
1130
1145
  return o < 30 ? `${o}d ago` : new Date(e).toLocaleDateString();
1131
1146
  }
1132
- const ka = {
1147
+ const Ka = {
1133
1148
  ok: 6e3,
1134
1149
  warn: 1e4,
1135
1150
  error: 15e3
1136
- }, Ca = { ok: "✓", warn: "!", error: "✕" };
1137
- function bi({
1151
+ }, ja = { ok: "✓", warn: "!", error: "✕" };
1152
+ function Ys({
1138
1153
  connectionId: e,
1139
1154
  onOpenAction: n,
1140
1155
  onBack: a,
1141
- onOpenCallable: s,
1142
- slots: i
1156
+ onOpenCallable: i,
1157
+ slots: s
1143
1158
  }) {
1144
- var _;
1145
- const o = We(), l = fe(), d = Cn(e), u = (_ = d.data) == null ? void 0 : _.appId, h = ie(
1146
- () => Be(d.data ? [d.data] : []),
1147
- [d.data]
1148
- ), { byId: v } = Ye(h), w = d.data ? At(d.data, v) : void 0, b = Dn(u, !!u), N = hn(e), $ = ie(() => {
1149
- const p = /* @__PURE__ */ new Map();
1150
- for (const L of N.data ?? []) {
1151
- const M = p.get(L.actionKey) ?? [];
1152
- M.push(L), p.set(L.actionKey, M);
1159
+ var W;
1160
+ const o = Je(), r = me(), c = Pn(e), u = (W = c.data) == null ? void 0 : W.appId, h = ie(
1161
+ () => Ge(c.data ? [c.data] : []),
1162
+ [c.data]
1163
+ ), { byId: g } = nt(h), m = c.data ? Bt(c.data, g) : void 0, k = jn(u, !!u), w = In(e), v = ie(() => {
1164
+ const N = /* @__PURE__ */ new Map();
1165
+ for (const M of w.data ?? []) {
1166
+ const P = N.get(M.actionKey) ?? [];
1167
+ P.push(M), N.set(M.actionKey, P);
1153
1168
  }
1154
- return p;
1155
- }, [N.data]), g = Ze(e).data, m = X(void 0), y = (g == null ? void 0 : g.callables) ?? [], D = (g == null ? void 0 : g.routes) ?? [], E = wn(e).data ?? [], [x, k] = f(!1), [Q, j] = f(""), R = Tn(e), [A, P] = f(null);
1156
- gt(() => {
1157
- if (!A) return;
1158
- const p = setTimeout(() => P(null), ka[A.kind]);
1159
- return () => clearTimeout(p);
1160
- }, [A]);
1161
- const H = () => {
1162
- P(null), R.mutate(void 0, {
1163
- onSuccess: (p) => {
1164
- var L;
1165
- if (!p.ok) {
1166
- P({
1169
+ return N;
1170
+ }, [w.data]), y = rt(e).data, p = X(void 0), C = (y == null ? void 0 : y.callables) ?? [], I = (y == null ? void 0 : y.routes) ?? [], b = Dn(e).data ?? [], [E, T] = f(!1), [j, O] = f(""), R = ct(e), [x, D] = f(null);
1171
+ At(() => {
1172
+ if (!x) return;
1173
+ const N = setTimeout(() => D(null), Ka[x.kind]);
1174
+ return () => clearTimeout(N);
1175
+ }, [x]);
1176
+ const S = () => {
1177
+ D(null), R.mutate(void 0, {
1178
+ onSuccess: (N) => {
1179
+ var M;
1180
+ if (!N.ok) {
1181
+ D({
1167
1182
  kind: "error",
1168
- text: `Connection test failed${(L = p.error) != null && L.message ? `: ${p.error.message}` : "."}`
1183
+ text: `Connection test failed${(M = N.error) != null && M.message ? `: ${N.error.message}` : "."}`
1169
1184
  });
1170
1185
  return;
1171
1186
  }
1172
- P(
1173
- p.untested ? { kind: "warn", text: `Connection stored. ${p.message ?? ""}`.trim() } : {
1187
+ D(
1188
+ N.untested ? { kind: "warn", text: `Connection stored. ${N.message ?? ""}`.trim() } : {
1174
1189
  kind: "ok",
1175
- text: `Connection is valid${p.actionKey ? ` — probed ${p.actionKey}` : ""}.`
1190
+ text: `Connection is valid${N.actionKey ? ` — probed ${N.actionKey}` : ""}.`
1176
1191
  }
1177
1192
  );
1178
1193
  },
1179
- onError: (p) => P({ kind: "error", text: (p == null ? void 0 : p.message) ?? "Test failed." })
1194
+ onError: (N) => D({ kind: "error", text: (N == null ? void 0 : N.message) ?? "Test failed." })
1180
1195
  });
1181
- }, I = ie(() => {
1182
- var L;
1183
- const p = [...((L = b.data) == null ? void 0 : L.actions) ?? []];
1184
- return p.sort((M, z) => (M.title || M.key).localeCompare(z.title || z.key)), p;
1185
- }, [b.data]), J = ie(() => {
1186
- const p = Q.trim().toLowerCase();
1187
- return p ? I.filter(
1188
- (L) => (L.title || "").toLowerCase().includes(p) || L.key.toLowerCase().includes(p) || (L.description || "").toLowerCase().includes(p)
1189
- ) : I;
1190
- }, [I, Q]);
1191
- if (d.isLoading || b.isLoading)
1196
+ }, $ = ie(() => {
1197
+ var M;
1198
+ const N = [...((M = k.data) == null ? void 0 : M.actions) ?? []];
1199
+ return N.sort((P, J) => (P.title || P.key).localeCompare(J.title || J.key)), N;
1200
+ }, [k.data]), V = ie(() => {
1201
+ const N = j.trim().toLowerCase();
1202
+ return N ? $.filter(
1203
+ (M) => (M.title || "").toLowerCase().includes(N) || M.key.toLowerCase().includes(N) || (M.description || "").toLowerCase().includes(N)
1204
+ ) : $;
1205
+ }, [$, j]);
1206
+ if (c.isLoading || k.isLoading)
1192
1207
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-conn-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
1193
- if (!d.data)
1194
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-conn-detail", "data-testid": "connection-not-found", children: [
1195
- (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
1208
+ if (!c.data)
1209
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-conn-detail", "data-testid": "connection-not-found", children: [
1210
+ (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
1196
1211
  a && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: a, children: "Back to integrations" })
1197
1212
  ] });
1198
- const q = d.data, S = b.data, U = !q.builtIn && typeof o.updateConnection == "function";
1199
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-conn-detail w6w-card-stack", children: [
1200
- (i == null ? void 0 : i.header) ?? /* @__PURE__ */ r(Rt, { conn: q, app: w, children: [
1213
+ const _ = c.data, K = k.data, H = !_.builtIn && typeof o.updateConnection == "function";
1214
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-conn-detail w6w-card-stack", children: [
1215
+ (s == null ? void 0 : s.header) ?? /* @__PURE__ */ l(Ut, { conn: _, app: m, children: [
1201
1216
  /* @__PURE__ */ t(
1202
1217
  "button",
1203
1218
  {
1204
1219
  type: "button",
1205
1220
  className: "w6w-btn w6w-btn-ghost",
1206
1221
  disabled: R.isPending,
1207
- onClick: H,
1222
+ onClick: S,
1208
1223
  children: R.isPending ? "Testing…" : "Test connection"
1209
1224
  }
1210
1225
  ),
1211
- U && /* @__PURE__ */ t(
1212
- _e,
1226
+ H && /* @__PURE__ */ t(
1227
+ ze,
1213
1228
  {
1214
1229
  label: "Edit",
1215
- onClick: () => k(!0),
1230
+ onClick: () => T(!0),
1216
1231
  "data-testid": "connection-detail-edit"
1217
1232
  }
1218
1233
  ),
1219
- i == null ? void 0 : i.actions
1234
+ s == null ? void 0 : s.actions
1220
1235
  ] }),
1221
- A && /* @__PURE__ */ r(
1236
+ x && /* @__PURE__ */ l(
1222
1237
  "div",
1223
1238
  {
1224
- className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${A.kind}`,
1225
- role: A.kind === "error" ? "alert" : "status",
1226
- "aria-live": A.kind === "error" ? "assertive" : "polite",
1239
+ className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${x.kind}`,
1240
+ role: x.kind === "error" ? "alert" : "status",
1241
+ "aria-live": x.kind === "error" ? "assertive" : "polite",
1227
1242
  "data-testid": "connection-test-notice",
1228
1243
  children: [
1229
- /* @__PURE__ */ t("span", { "aria-hidden": "true", children: Ca[A.kind] }),
1230
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: A.text }),
1231
- /* @__PURE__ */ t(St, { icon: "close", label: "Dismiss", onClick: () => P(null) })
1244
+ /* @__PURE__ */ t("span", { "aria-hidden": "true", children: ja[x.kind] }),
1245
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: x.text }),
1246
+ /* @__PURE__ */ t(Ht, { icon: "close", label: "Dismiss", onClick: () => D(null) })
1232
1247
  ]
1233
1248
  }
1234
1249
  ),
1235
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1236
- /* @__PURE__ */ r("h3", { children: [
1250
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1251
+ /* @__PURE__ */ l("h3", { children: [
1237
1252
  "App: ",
1238
- (w == null ? void 0 : w.displayName) ?? q.appId
1253
+ (m == null ? void 0 : m.displayName) ?? _.appId
1239
1254
  ] }),
1240
- S && /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1255
+ K && /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1241
1256
  "Version ",
1242
- /* @__PURE__ */ r("code", { children: [
1257
+ /* @__PURE__ */ l("code", { children: [
1243
1258
  "v",
1244
- S.version ?? "?"
1259
+ K.version ?? "?"
1245
1260
  ] }),
1246
1261
  " · source ",
1247
- /* @__PURE__ */ t("code", { children: S.sourceRef })
1262
+ /* @__PURE__ */ t("code", { children: K.sourceRef })
1248
1263
  ] }),
1249
1264
  a && /* @__PURE__ */ t("p", { className: "w6w-small", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: a, children: "← Integrations" }) })
1250
1265
  ] }),
1251
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1266
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1252
1267
  /* @__PURE__ */ t("h3", { children: "Actions" }),
1253
- I.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
1254
- I.length > 10 && /* @__PURE__ */ t(
1268
+ $.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
1269
+ $.length > 10 && /* @__PURE__ */ t(
1255
1270
  "input",
1256
1271
  {
1257
1272
  type: "search",
1258
- value: Q,
1259
- placeholder: `Search ${I.length} actions…`,
1260
- onChange: (p) => j(p.target.value),
1273
+ value: j,
1274
+ placeholder: `Search ${$.length} actions…`,
1275
+ onChange: (N) => O(N.target.value),
1261
1276
  "aria-label": "Filter actions",
1262
1277
  className: "w6w-embed-conn-filter"
1263
1278
  }
1264
1279
  ),
1265
- I.length > 0 && J.length === 0 && /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1280
+ $.length > 0 && V.length === 0 && /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1266
1281
  "No actions match “",
1267
- Q,
1282
+ j,
1268
1283
  "”."
1269
1284
  ] }),
1270
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: J.map((p) => {
1271
- const L = $.get(p.key) ?? [];
1272
- return /* @__PURE__ */ r("li", { children: [
1273
- /* @__PURE__ */ r(
1285
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: V.map((N) => {
1286
+ const M = v.get(N.key) ?? [];
1287
+ return /* @__PURE__ */ l("li", { children: [
1288
+ /* @__PURE__ */ l(
1274
1289
  "button",
1275
1290
  {
1276
1291
  type: "button",
1277
1292
  className: "w6w-embed-conn-action",
1278
- "data-testid": `connection-action-${p.key}`,
1279
- onClick: () => n(p.key),
1293
+ "data-testid": `connection-action-${N.key}`,
1294
+ onClick: () => n(N.key),
1280
1295
  children: [
1281
- /* @__PURE__ */ t("strong", { children: p.title }),
1296
+ /* @__PURE__ */ t("strong", { children: N.title }),
1282
1297
  " ",
1283
- /* @__PURE__ */ t("code", { className: "w6w-muted", children: p.key }),
1298
+ /* @__PURE__ */ t("code", { className: "w6w-muted", children: N.key }),
1284
1299
  " ",
1285
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: p.type }),
1286
- p.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: p.description })
1300
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: N.type }),
1301
+ N.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: N.description })
1287
1302
  ]
1288
1303
  }
1289
1304
  ),
1290
- L.length > 0 && /* @__PURE__ */ t(
1305
+ M.length > 0 && /* @__PURE__ */ t(
1291
1306
  "ul",
1292
1307
  {
1293
1308
  className: "w6w-embed-conn-list w6w-embed-conn-tests",
1294
- "aria-label": `Saved tests for ${p.title || p.key}`,
1295
- children: L.map((M) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1296
- ke,
1309
+ "aria-label": `Saved tests for ${N.title || N.key}`,
1310
+ children: M.map((P) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1311
+ Ae,
1297
1312
  {
1298
- title: M.name,
1299
- subtitle: M.lastRunAt ? /* @__PURE__ */ r("span", { children: [
1313
+ title: P.name,
1314
+ subtitle: P.lastRunAt ? /* @__PURE__ */ l("span", { children: [
1300
1315
  /* @__PURE__ */ t(
1301
1316
  "span",
1302
1317
  {
1303
- className: M.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1304
- children: M.lastRunOk ? "✓" : "✗"
1318
+ className: P.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1319
+ children: P.lastRunOk ? "✓" : "✗"
1305
1320
  }
1306
1321
  ),
1307
1322
  " ",
1308
- M.lastRunSummary ? `${M.lastRunSummary} · ` : "",
1309
- be(M.lastRunAt)
1310
- ] }) : `saved ${be(M.updatedAt)}`,
1311
- onClick: () => n(p.key, M.id)
1323
+ P.lastRunSummary ? `${P.lastRunSummary} · ` : "",
1324
+ Le(P.lastRunAt)
1325
+ ] }) : `saved ${Le(P.updatedAt)}`,
1326
+ onClick: () => n(N.key, P.id)
1312
1327
  }
1313
- ) }, M.id))
1328
+ ) }, P.id))
1314
1329
  }
1315
1330
  )
1316
- ] }, p.key);
1331
+ ] }, N.key);
1317
1332
  }) })
1318
1333
  ] }),
1319
- g && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "connection-used-by", children: [
1334
+ y && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "connection-used-by", children: [
1320
1335
  /* @__PURE__ */ t("h3", { children: "Used by" }),
1321
- y.length === 0 && D.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
1322
- ht,
1336
+ C.length === 0 && I.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
1337
+ Lt,
1323
1338
  {
1324
- callables: y,
1325
- routes: D,
1326
- projectId: m,
1327
- onOpenCallable: s
1339
+ callables: C,
1340
+ routes: I,
1341
+ projectId: p,
1342
+ onOpenCallable: i
1328
1343
  }
1329
1344
  )
1330
1345
  ] }),
1331
- E.length > 0 && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1346
+ b.length > 0 && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1332
1347
  /* @__PURE__ */ t("h3", { children: "Recent runs" }),
1333
1348
  /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Most recent tester runs against this connection." }),
1334
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: E.map((p) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1335
- ke,
1349
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: b.map((N) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1350
+ Ae,
1336
1351
  {
1337
- title: p.actionKey,
1338
- subtitle: /* @__PURE__ */ r("span", { children: [
1339
- /* @__PURE__ */ t("span", { className: p.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: p.ok ? "✓" : "✗" }),
1352
+ title: N.actionKey,
1353
+ subtitle: /* @__PURE__ */ l("span", { children: [
1354
+ /* @__PURE__ */ t("span", { className: N.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: N.ok ? "✓" : "✗" }),
1340
1355
  " ",
1341
- p.summary ? `${p.summary} · ` : "",
1342
- be(p.occurredAt)
1356
+ N.summary ? `${N.summary} · ` : "",
1357
+ Le(N.occurredAt)
1343
1358
  ] })
1344
1359
  }
1345
- ) }, p.id)) })
1360
+ ) }, N.id)) })
1346
1361
  ] }),
1347
- x && /* @__PURE__ */ t(
1348
- Ue,
1362
+ E && /* @__PURE__ */ t(
1363
+ Ze,
1349
1364
  {
1350
- connection: q,
1351
- onClose: () => k(!1),
1365
+ connection: _,
1366
+ onClose: () => T(!1),
1352
1367
  onSaved: () => {
1353
- k(!1), l.invalidateQueries({ queryKey: Xe(e) }), l.invalidateQueries({ queryKey: Ce });
1368
+ T(!1), r.invalidateQueries({ queryKey: ot(e) }), r.invalidateQueries({ queryKey: ge });
1354
1369
  }
1355
1370
  }
1356
1371
  )
1357
1372
  ] });
1358
1373
  }
1359
- const Ta = {};
1360
- function je(e) {
1374
+ const Fa = {};
1375
+ function Ve(e) {
1361
1376
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1362
1377
  }
1363
- function ce(e) {
1378
+ function ue(e) {
1364
1379
  return (e / 100).toFixed(2);
1365
1380
  }
1366
- function $a(e) {
1381
+ function Qa(e) {
1367
1382
  if (e == null) return null;
1368
1383
  const n = e.rates, a = [];
1369
- return n.input != null && a.push(`in ${ce(n.input)}`), n.output != null && a.push(`out ${ce(n.output)}`), n.cachedInput != null && a.push(`cached ${ce(n.cachedInput)}`), n.cacheWrite != null && a.push(`cache write ${ce(n.cacheWrite)}`), n.perRequest != null && a.push(`${ce(n.perRequest)}/request`), a.length === 0 ? null : `${n.currency ?? "USD"} ${a.join(" · ")}`;
1384
+ return n.input != null && a.push(`in ${ue(n.input)}`), n.output != null && a.push(`out ${ue(n.output)}`), n.cachedInput != null && a.push(`cached ${ue(n.cachedInput)}`), n.cacheWrite != null && a.push(`cache write ${ue(n.cacheWrite)}`), n.perRequest != null && a.push(`${ue(n.perRequest)}/request`), a.length === 0 ? null : `${n.currency ?? "USD"} ${a.join(" · ")}`;
1370
1385
  }
1371
- function Da(e) {
1386
+ function _a(e) {
1372
1387
  const { maxInputTokens: n, maxOutputTokens: a } = e.limits ?? {};
1373
- if (n == null && a == null) return "—";
1374
- const s = [];
1375
- return n != null && s.push(`${je(n)} in`), a != null && s.push(`${je(a)} out`), s.join(" · ");
1388
+ return n == null && a == null ? "—" : /* @__PURE__ */ l("div", { className: "model-catalog-limits", children: [
1389
+ n != null && /* @__PURE__ */ l("span", { children: [
1390
+ Ve(n),
1391
+ " input"
1392
+ ] }),
1393
+ a != null && /* @__PURE__ */ l("span", { children: [
1394
+ Ve(a),
1395
+ " output"
1396
+ ] })
1397
+ ] });
1376
1398
  }
1377
- const xa = [
1399
+ const qa = [
1378
1400
  {
1379
1401
  key: "model",
1380
1402
  header: "Model",
1381
- render: (e) => /* @__PURE__ */ r("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1382
- /* @__PURE__ */ t("strong", { className: "list-name", title: e.displayName, children: e.displayName }),
1383
- /* @__PURE__ */ r("div", { className: "muted small list-preview", title: `${e.provider} · ${e.nativeId}`, children: [
1403
+ width: "48%",
1404
+ render: (e) => /* @__PURE__ */ l("div", { className: "model-catalog-identity", children: [
1405
+ /* @__PURE__ */ l("div", { className: "model-catalog-name", children: [
1406
+ /* @__PURE__ */ t("strong", { children: e.displayName }),
1407
+ /* @__PURE__ */ t("span", { className: e.status === "active" ? "tag" : "tag warn", children: e.status })
1408
+ ] }),
1409
+ /* @__PURE__ */ l("div", { className: "muted small", children: [
1384
1410
  e.provider,
1385
1411
  " · ",
1386
- e.nativeId,
1387
- " · ",
1388
- e.source
1412
+ e.nativeId
1389
1413
  ] })
1390
1414
  ] })
1391
1415
  },
1392
- {
1393
- key: "provider",
1394
- header: "Provider",
1395
- render: (e) => /* @__PURE__ */ t("span", { className: "muted small", children: e.provider || "—" })
1396
- },
1397
- {
1398
- key: "status",
1399
- header: "Status",
1400
- render: (e) => /* @__PURE__ */ t("span", { className: e.status === "active" ? "tag" : "tag warn", children: e.status })
1401
- },
1402
1416
  {
1403
1417
  key: "rate",
1404
- header: "Rate (per 1M tokens)",
1418
+ header: "Price / 1M tokens",
1419
+ width: "28%",
1405
1420
  render: (e) => {
1406
- const n = $a(e.currentRate);
1407
- return n == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "—" }) : /* @__PURE__ */ t(
1421
+ const n = Qa(e.currentRate);
1422
+ return n == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "Not configured" }) : /* @__PURE__ */ t(
1408
1423
  "span",
1409
1424
  {
1410
1425
  className: "muted small",
@@ -1416,78 +1431,80 @@ const xa = [
1416
1431
  },
1417
1432
  {
1418
1433
  key: "limits",
1419
- header: "Limits",
1420
- render: (e) => /* @__PURE__ */ t("span", { className: "muted small", children: Da(e) })
1434
+ header: "Token limits",
1435
+ width: "24%",
1436
+ render: (e) => /* @__PURE__ */ t("div", { className: "muted small", children: _a(e) })
1421
1437
  }
1422
1438
  ];
1423
- function ki(e) {
1439
+ function zs(e) {
1424
1440
  var o;
1425
- const n = ge(), a = e.filter ?? Ta, s = Ge({
1426
- queryKey: Ln(a),
1441
+ const n = he(), a = e.filter ?? Fa, i = st({
1442
+ queryKey: Qn(a),
1427
1443
  initialPageParam: void 0,
1428
- getNextPageParam: (l) => l.nextCursor ?? void 0,
1429
- queryFn: ({ pageParam: l }) => xn(n, l ? { ...a, cursor: l } : a)
1430
- }), i = ((o = s.data) == null ? void 0 : o.pages.flatMap((l) => l.models)) ?? [];
1431
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
1432
- /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ r("div", { children: [
1433
- /* @__PURE__ */ t("h3", { children: "Model catalog" }),
1434
- /* @__PURE__ */ t("p", { className: "muted small", children: "The models discovered on this tenant's connections, plus any added by hand. A route may only name a model from this list; the rate card is what usage is priced with." })
1444
+ getNextPageParam: (r) => r.nextCursor ?? void 0,
1445
+ queryFn: ({ pageParam: r }) => Fn(n, r ? { ...a, cursor: r } : a)
1446
+ }), s = ((o = i.data) == null ? void 0 : o.pages.flatMap((r) => r.models)) ?? [];
1447
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
1448
+ /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ l("div", { children: [
1449
+ /* @__PURE__ */ t("h3", { children: "Available models" }),
1450
+ /* @__PURE__ */ t("p", { className: "muted small", children: "Models available through your tenant's integrations. Choose one when creating a model route. Prices shown here are used to calculate usage costs." })
1435
1451
  ] }) }),
1436
- /* @__PURE__ */ r("div", { children: [
1437
- s.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1438
- s.error != null && /* @__PURE__ */ t("div", { className: "error", children: s.error.message }),
1439
- s.isSuccess && i.length === 0 && /* @__PURE__ */ t(De, { testId: "model-catalog-empty", children: "No models yet. Discover them from a provider connection to start routing to them." }),
1440
- i.length > 0 && /* @__PURE__ */ t(
1441
- xe,
1452
+ /* @__PURE__ */ l("div", { children: [
1453
+ i.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1454
+ i.error != null && /* @__PURE__ */ t("div", { className: "error", children: i.error.message }),
1455
+ i.isSuccess && s.length === 0 && /* @__PURE__ */ t(xe, { testId: "model-catalog-empty", children: "No models yet. Discover them from a provider connection to start routing to them." }),
1456
+ s.length > 0 && /* @__PURE__ */ t(
1457
+ Re,
1442
1458
  {
1443
- columns: xa,
1444
- rows: i,
1445
- rowKey: (l) => l.id,
1459
+ columns: qa,
1460
+ className: "model-catalog-table",
1461
+ rows: s,
1462
+ rowKey: (r) => r.id,
1446
1463
  testId: "model-catalog-table",
1447
- rowTestId: (l) => `model-catalog-${l.id}`
1464
+ rowTestId: (r) => `model-catalog-${r.id}`
1448
1465
  }
1449
1466
  )
1450
1467
  ] }),
1451
- s.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1468
+ i.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1452
1469
  "button",
1453
1470
  {
1454
1471
  type: "button",
1455
1472
  className: "btn ghost",
1456
- disabled: s.isFetchingNextPage,
1457
- onClick: () => void s.fetchNextPage(),
1473
+ disabled: i.isFetchingNextPage,
1474
+ onClick: () => void i.fetchNextPage(),
1458
1475
  "data-testid": "model-catalog-load-more",
1459
- children: s.isFetchingNextPage ? "Loading…" : "Load more"
1476
+ children: i.isFetchingNextPage ? "Loading…" : "Load more"
1460
1477
  }
1461
1478
  ) })
1462
1479
  ] }) });
1463
1480
  }
1464
- const La = {};
1465
- function B(e) {
1481
+ const Va = {};
1482
+ function U(e) {
1466
1483
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1467
1484
  }
1468
- function Ea(e) {
1485
+ function Wa(e) {
1469
1486
  return `${e.currency} ${(e.amountMinor / 100).toFixed(2)}`;
1470
1487
  }
1471
- function Ia(e, n) {
1472
- return e.length > 0 ? e.map(Ea).join(" · ") : n > 0 ? "unpriced" : "—";
1488
+ function Ba(e, n) {
1489
+ return e.length > 0 ? e.map(Wa).join(" · ") : n > 0 ? "unpriced" : "—";
1473
1490
  }
1474
- function Ma(e) {
1491
+ function Ua(e) {
1475
1492
  return e.costMinor == null ? null : `${e.currency ?? "USD"} ${(e.costMinor / 100).toFixed(2)}`;
1476
1493
  }
1477
- function Aa(e) {
1494
+ function Ha(e) {
1478
1495
  return e.totalsTruncated === !0;
1479
1496
  }
1480
- const Ra = [
1497
+ const Ya = [
1481
1498
  {
1482
1499
  key: "occurredAt",
1483
1500
  header: "When",
1484
- render: (e) => /* @__PURE__ */ t("span", { className: "muted small", title: e.occurredAt, children: lt(e.occurredAt) })
1501
+ render: (e) => /* @__PURE__ */ t("span", { className: "muted small", title: e.occurredAt, children: Ct(e.occurredAt) })
1485
1502
  },
1486
1503
  {
1487
1504
  key: "model",
1488
1505
  header: "Model",
1489
- render: (e) => /* @__PURE__ */ r("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1490
- /* @__PURE__ */ r("strong", { className: "list-name", title: `${e.provider} · ${e.nativeId}`, children: [
1506
+ render: (e) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1507
+ /* @__PURE__ */ l("strong", { className: "list-name", title: `${e.provider} · ${e.nativeId}`, children: [
1491
1508
  e.provider,
1492
1509
  " · ",
1493
1510
  e.nativeId
@@ -1508,8 +1525,8 @@ const Ra = [
1508
1525
  "span",
1509
1526
  {
1510
1527
  className: "muted small",
1511
- title: `${B(e.inputTokens)} in · ${B(e.outputTokens)} out · ${B(e.cachedInputTokens)} cached input · ${B(e.cacheWriteTokens)} cache write`,
1512
- children: B(e.totalTokens)
1528
+ title: `${U(e.inputTokens)} in · ${U(e.outputTokens)} out · ${U(e.cachedInputTokens)} cached input · ${U(e.cacheWriteTokens)} cache write`,
1529
+ children: U(e.totalTokens)
1513
1530
  }
1514
1531
  )
1515
1532
  },
@@ -1518,7 +1535,7 @@ const Ra = [
1518
1535
  header: "Cost",
1519
1536
  align: "right",
1520
1537
  render: (e) => {
1521
- const n = Ma(e);
1538
+ const n = Ua(e);
1522
1539
  return n == null ? /* @__PURE__ */ t("span", { className: "tag warn", "data-testid": "model-usage-unpriced", title: "no usable rate", children: "unpriced" }) : /* @__PURE__ */ t("span", { className: "muted small", children: n });
1523
1540
  }
1524
1541
  },
@@ -1526,10 +1543,10 @@ const Ra = [
1526
1543
  key: "result",
1527
1544
  header: "Result",
1528
1545
  render: (e) => {
1529
- const n = ot(e.durationMs);
1530
- return /* @__PURE__ */ r("span", { className: "muted small", title: e.errorCode ?? void 0, children: [
1546
+ const n = Tt(e.durationMs);
1547
+ return /* @__PURE__ */ l("span", { className: "muted small", title: e.errorCode ?? void 0, children: [
1531
1548
  /* @__PURE__ */ t("span", { className: e.ok ? "tag" : "tag warn", children: e.ok ? "ok" : e.errorCode ?? "failed" }),
1532
- n != null && /* @__PURE__ */ r(K, { children: [
1549
+ n != null && /* @__PURE__ */ l(Q, { children: [
1533
1550
  " · ",
1534
1551
  n
1535
1552
  ] })
@@ -1537,61 +1554,61 @@ const Ra = [
1537
1554
  }
1538
1555
  }
1539
1556
  ];
1540
- function Ci(e) {
1541
- var h, v;
1542
- const n = X(e.projectId), a = ge(), s = e.filter ?? La, i = Ge({
1543
- queryKey: In(n ?? void 0, s),
1557
+ function Js(e) {
1558
+ var h, g;
1559
+ const n = X(e.projectId), a = he(), i = e.filter ?? Va, s = st({
1560
+ queryKey: qn(n ?? void 0, i),
1544
1561
  enabled: n != null,
1545
1562
  initialPageParam: void 0,
1546
- getNextPageParam: (w) => w.nextCursor ?? void 0,
1547
- queryFn: ({ pageParam: w }) => En(
1563
+ getNextPageParam: (m) => m.nextCursor ?? void 0,
1564
+ queryFn: ({ pageParam: m }) => _n(
1548
1565
  a,
1549
1566
  n,
1550
- w ? { ...s, cursor: w } : s
1567
+ m ? { ...i, cursor: m } : i
1551
1568
  )
1552
- }), o = ((h = i.data) == null ? void 0 : h.pages) ?? [], l = (v = o[0]) == null ? void 0 : v.totals, d = o.flatMap((w) => w.items), u = o.length > 0 && Aa(o[0]);
1553
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
1554
- /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ r("div", { children: [
1569
+ }), o = ((h = s.data) == null ? void 0 : h.pages) ?? [], r = (g = o[0]) == null ? void 0 : g.totals, c = o.flatMap((m) => m.items), u = o.length > 0 && Ha(o[0]);
1570
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
1571
+ /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ l("div", { children: [
1555
1572
  /* @__PURE__ */ t("h3", { children: "Model usage" }),
1556
1573
  /* @__PURE__ */ t("p", { className: "muted small", children: "Every model call this project paid for, priced with the rate card in force when it ran. A call with no usable rate counts as unpriced, not as free." })
1557
1574
  ] }) }),
1558
- n == null ? /* @__PURE__ */ t("div", { className: "card", children: /* @__PURE__ */ t("p", { className: "muted", "data-testid": "model-usage-no-project", children: "Select a project to see its model usage." }) }) : /* @__PURE__ */ r(K, { children: [
1559
- /* @__PURE__ */ r("div", { className: "card", "data-testid": "model-usage-totals", children: [
1575
+ n == null ? /* @__PURE__ */ t("div", { className: "card", children: /* @__PURE__ */ t("p", { className: "muted", "data-testid": "model-usage-no-project", children: "Select a project to see its model usage." }) }) : /* @__PURE__ */ l(Q, { children: [
1576
+ /* @__PURE__ */ l("div", { className: "card", "data-testid": "model-usage-totals", children: [
1560
1577
  u && /* @__PURE__ */ t("p", { className: "result warn", "data-testid": "model-usage-totals-partial", children: "Totals are partial: they cover a bounded scan of this window, not every matching call. Narrow the range for exact totals." }),
1561
- l == null ? (
1578
+ r == null ? (
1562
1579
  // A failed query is reported once, below — never as a perpetual "loading".
1563
- i.error == null && /* @__PURE__ */ t("p", { className: "muted", children: "Loading totals…" })
1564
- ) : /* @__PURE__ */ r("p", { className: "muted small", children: [
1565
- /* @__PURE__ */ r("span", { "data-testid": "model-usage-total-requests", children: [
1566
- B(l.requests),
1580
+ s.error == null && /* @__PURE__ */ t("p", { className: "muted", children: "Loading totals…" })
1581
+ ) : /* @__PURE__ */ l("p", { className: "muted small", children: [
1582
+ /* @__PURE__ */ l("span", { "data-testid": "model-usage-total-requests", children: [
1583
+ U(r.requests),
1567
1584
  " requests"
1568
1585
  ] }),
1569
1586
  " · ",
1570
- /* @__PURE__ */ r("span", { "data-testid": "model-usage-total-tokens", children: [
1571
- B(l.totalTokens),
1587
+ /* @__PURE__ */ l("span", { "data-testid": "model-usage-total-tokens", children: [
1588
+ U(r.totalTokens),
1572
1589
  " tokens (",
1573
- B(l.inputTokens),
1590
+ U(r.inputTokens),
1574
1591
  " in /",
1575
1592
  " ",
1576
- B(l.outputTokens),
1593
+ U(r.outputTokens),
1577
1594
  " out / ",
1578
- B(l.cachedInputTokens),
1595
+ U(r.cachedInputTokens),
1579
1596
  " cached / ",
1580
- B(l.cacheWriteTokens),
1597
+ U(r.cacheWriteTokens),
1581
1598
  " cache write)"
1582
1599
  ] }),
1583
1600
  " · ",
1584
- /* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: Ia(l.cost, l.unpriced) }),
1585
- l.unpriced > 0 && /* @__PURE__ */ r(K, { children: [
1601
+ /* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: Ba(r.cost, r.unpriced) }),
1602
+ r.unpriced > 0 && /* @__PURE__ */ l(Q, { children: [
1586
1603
  " · ",
1587
- /* @__PURE__ */ r(
1604
+ /* @__PURE__ */ l(
1588
1605
  "span",
1589
1606
  {
1590
1607
  className: "tag warn",
1591
1608
  "data-testid": "model-usage-unpriced-total",
1592
1609
  title: "calls with no usable rate — not included in any cost total",
1593
1610
  children: [
1594
- B(l.unpriced),
1611
+ U(r.unpriced),
1595
1612
  " unpriced"
1596
1613
  ]
1597
1614
  }
@@ -1599,55 +1616,55 @@ function Ci(e) {
1599
1616
  ] })
1600
1617
  ] })
1601
1618
  ] }),
1602
- i.error != null && /* @__PURE__ */ t("div", { className: "error", role: "alert", "data-testid": "model-usage-error", children: i.error.message }),
1603
- /* @__PURE__ */ r("div", { children: [
1604
- i.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1605
- i.isSuccess && d.length === 0 && /* @__PURE__ */ t(De, { testId: "model-usage-empty", children: "No model calls in this window. Usage rows appear here as routes are invoked." }),
1606
- d.length > 0 && /* @__PURE__ */ t(
1607
- xe,
1619
+ s.error != null && /* @__PURE__ */ t("div", { className: "error", role: "alert", "data-testid": "model-usage-error", children: s.error.message }),
1620
+ /* @__PURE__ */ l("div", { children: [
1621
+ s.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1622
+ s.isSuccess && c.length === 0 && /* @__PURE__ */ t(xe, { testId: "model-usage-empty", children: "No model calls in this window. Usage rows appear here as routes are invoked." }),
1623
+ c.length > 0 && /* @__PURE__ */ t(
1624
+ Re,
1608
1625
  {
1609
- columns: Ra,
1610
- rows: d,
1611
- rowKey: (w) => w.id,
1626
+ columns: Ya,
1627
+ rows: c,
1628
+ rowKey: (m) => m.id,
1612
1629
  testId: "model-usage-table",
1613
- rowTestId: (w) => `model-usage-${w.id}`
1630
+ rowTestId: (m) => `model-usage-${m.id}`
1614
1631
  }
1615
1632
  )
1616
1633
  ] }),
1617
- i.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1634
+ s.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1618
1635
  "button",
1619
1636
  {
1620
1637
  type: "button",
1621
1638
  className: "btn ghost",
1622
- disabled: i.isFetchingNextPage,
1623
- onClick: () => void i.fetchNextPage(),
1639
+ disabled: s.isFetchingNextPage,
1640
+ onClick: () => void s.fetchNextPage(),
1624
1641
  "data-testid": "model-usage-load-more",
1625
- children: i.isFetchingNextPage ? "Loading…" : "Load more"
1642
+ children: s.isFetchingNextPage ? "Loading…" : "Load more"
1626
1643
  }
1627
1644
  ) })
1628
1645
  ] })
1629
1646
  ] }) });
1630
1647
  }
1631
- const Sa = (e) => `${e} connection${e === 1 ? "" : "s"}`;
1632
- function Ti({ contract: e, onOpen: n, onCreate: a, slots: s }) {
1633
- const i = Mn(e ? { contract: e } : void 0), o = Le(), l = (i.data ?? []).filter((h) => !h.private), d = (h) => {
1634
- var v, w;
1635
- return ((w = (v = o.data) == null ? void 0 : v.find((b) => b.id === h)) == null ? void 0 : w.label) ?? h;
1648
+ const za = (e) => `${e} connection${e === 1 ? "" : "s"}`;
1649
+ function Gs({ contract: e, onOpen: n, onCreate: a, slots: i }) {
1650
+ const s = dt(e ? { contract: e } : void 0), o = Ne(), r = (s.data ?? []).filter((h) => !h.private), c = (h) => {
1651
+ var g, m;
1652
+ return ((m = (g = o.data) == null ? void 0 : g.find((k) => k.id === h)) == null ? void 0 : m.label) ?? h;
1636
1653
  }, u = a && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: a, children: "Add credential" });
1637
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-list", children: [
1638
- /* @__PURE__ */ r("div", { className: "w6w-connection-list-head", "data-testid": "credential-list-header", children: [
1639
- /* @__PURE__ */ t("div", { className: "w6w-connection-list-heading", children: (s == null ? void 0 : s.header) ?? /* @__PURE__ */ t("h2", { children: "Credentials" }) }),
1654
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-list", children: [
1655
+ /* @__PURE__ */ l("div", { className: "w6w-connection-list-head", "data-testid": "credential-list-header", children: [
1656
+ /* @__PURE__ */ t("div", { className: "w6w-connection-list-heading", children: (i == null ? void 0 : i.header) ?? /* @__PURE__ */ t("h2", { children: "Credentials" }) }),
1640
1657
  u && /* @__PURE__ */ t("div", { className: "w6w-connection-list-actions", children: u })
1641
1658
  ] }),
1642
- i.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1643
- i.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: i.error.message }),
1644
- !i.isLoading && !i.error && l.length === 0 && /* @__PURE__ */ t("div", { "data-testid": "credential-list-empty", children: (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ r(K, { children: [
1659
+ s.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1660
+ s.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: s.error.message }),
1661
+ !s.isLoading && !s.error && r.length === 0 && /* @__PURE__ */ t("div", { "data-testid": "credential-list-empty", children: (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ l(Q, { children: [
1645
1662
  /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No credentials yet." }),
1646
1663
  u
1647
1664
  ] }) }),
1648
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Credentials", children: l.map((h) => {
1649
- const v = Object.values(h.display)[0];
1650
- return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ r(
1665
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Credentials", children: r.map((h) => {
1666
+ const g = Object.values(h.display)[0];
1667
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l(
1651
1668
  "button",
1652
1669
  {
1653
1670
  type: "button",
@@ -1658,17 +1675,22 @@ function Ti({ contract: e, onOpen: n, onCreate: a, slots: s }) {
1658
1675
  /* @__PURE__ */ t("strong", { children: h.name }),
1659
1676
  " ",
1660
1677
  /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: h.status }),
1661
- /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", "data-testid": `credential-type-${h.id}`, children: [
1678
+ /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-type-${h.id}`, children: [
1662
1679
  " ",
1663
- d(h.contract)
1680
+ c(h.contract)
1664
1681
  ] }),
1665
- v !== void 0 && /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", children: [
1682
+ /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `credential-scope-${h.id}`, children: [
1666
1683
  " ",
1667
- v
1684
+ "· ",
1685
+ ut(h.accessScope)
1668
1686
  ] }),
1669
- /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", children: [
1687
+ g !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1688
+ " ",
1689
+ g
1690
+ ] }),
1691
+ /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1670
1692
  " · ",
1671
- Sa(h.connectionCount)
1693
+ za(h.connectionCount)
1672
1694
  ] })
1673
1695
  ]
1674
1696
  }
@@ -1676,17 +1698,17 @@ function Ti({ contract: e, onOpen: n, onCreate: a, slots: s }) {
1676
1698
  }) })
1677
1699
  ] });
1678
1700
  }
1679
- function wt({
1701
+ function Ce({
1680
1702
  fields: e,
1681
1703
  values: n,
1682
1704
  onChange: a,
1683
- idPrefix: s
1705
+ idPrefix: i
1684
1706
  }) {
1685
- return /* @__PURE__ */ t(K, { children: e.map((i) => {
1707
+ return /* @__PURE__ */ t(Q, { children: e.map((s) => {
1686
1708
  const o = {
1687
- className: i.secret ? "w6w-input w6w-secret-input" : "w6w-input",
1688
- value: n[i.key] ?? "",
1689
- name: `${s}-${i.key}`,
1709
+ className: s.secret ? "w6w-input w6w-secret-input" : "w6w-input",
1710
+ value: n[s.key] ?? "",
1711
+ name: `${i}-${s.key}`,
1690
1712
  autoComplete: "off",
1691
1713
  autoCapitalize: "off",
1692
1714
  autoCorrect: "off",
@@ -1696,94 +1718,132 @@ function wt({
1696
1718
  "data-bwignore": "true",
1697
1719
  "data-form-type": "other"
1698
1720
  };
1699
- return i.multiline ? /* @__PURE__ */ r("label", { className: "w6w-field", children: [
1700
- /* @__PURE__ */ t("span", { children: i.label }),
1701
- /* @__PURE__ */ t("textarea", { rows: 5, ...o, onChange: (l) => a(i.key, l.target.value) })
1702
- ] }, i.key) : /* @__PURE__ */ r("label", { className: "w6w-field", children: [
1703
- /* @__PURE__ */ t("span", { children: i.label }),
1704
- /* @__PURE__ */ t("input", { type: "text", ...o, onChange: (l) => a(i.key, l.target.value) })
1705
- ] }, i.key);
1721
+ return s.multiline ? /* @__PURE__ */ l("label", { className: "w6w-field", children: [
1722
+ /* @__PURE__ */ t("span", { children: s.label }),
1723
+ /* @__PURE__ */ t("textarea", { rows: 5, ...o, onChange: (r) => a(s.key, r.target.value) })
1724
+ ] }, s.key) : /* @__PURE__ */ l("label", { className: "w6w-field", children: [
1725
+ /* @__PURE__ */ t("span", { children: s.label }),
1726
+ /* @__PURE__ */ t("input", { type: "text", ...o, onChange: (r) => a(s.key, r.target.value) })
1727
+ ] }, s.key);
1706
1728
  }) });
1707
1729
  }
1708
- const pt = (e, n) => e.every((a) => (n[a.key] ?? "").length > 0), ft = (e, n) => Object.fromEntries(e.map((a) => [a.key, n[a.key] ?? ""]));
1709
- function $i({ onCreated: e, onCancel: n }) {
1710
- const a = Le(), s = An(), [i, o] = f(null), [l, d] = f(""), [u, h] = f({}), [v, w] = f(null), b = a.data ?? [], N = b.find((m) => m.id === i) ?? b[0], $ = (m) => {
1711
- o(m), h({}), w(null);
1712
- }, g = () => {
1713
- if (!N || s.isPending) return;
1714
- if (l.trim() === "") {
1715
- w("Give the credential a name.");
1730
+ const Te = (e, n) => e.every((a) => (n[a.key] ?? "").length > 0), Ee = (e, n) => Object.fromEntries(e.map((a) => [a.key, n[a.key] ?? ""])), Ja = [
1731
+ {
1732
+ value: "account",
1733
+ label: "This account",
1734
+ hint: "Authorized callers in the account can use it."
1735
+ },
1736
+ { value: "user", label: "Only me", hint: "Only you can use it. Others in the account cannot." }
1737
+ ];
1738
+ function Zs({ onCreated: e, onCancel: n }) {
1739
+ const a = pt(), [i, s] = f("account"), o = Ne(), r = Wn(), [c, u] = f(null), [h, g] = f(""), [m, k] = f({}), [w, v] = f(null), y = o.data ?? [], p = y.find((b) => b.id === c) ?? y[0], C = (b) => {
1740
+ u(b), k({}), v(null);
1741
+ }, I = () => {
1742
+ if (!p || r.isPending) return;
1743
+ if (h.trim() === "") {
1744
+ v("Give the credential a name.");
1716
1745
  return;
1717
1746
  }
1718
- if (!pt(N.fields, u)) {
1719
- w("Fill in every field.");
1747
+ if (!Te(p.fields, m)) {
1748
+ v("Fill in every field.");
1720
1749
  return;
1721
1750
  }
1722
- w(null);
1723
- const m = {
1724
- name: l.trim(),
1725
- contract: N.id,
1726
- source: ft(N.fields, u)
1751
+ v(null);
1752
+ const b = {
1753
+ name: h.trim(),
1754
+ contract: p.id,
1755
+ source: Ee(p.fields, m),
1756
+ ...a && i === "user" ? { accessScope: "user" } : {}
1727
1757
  };
1728
- h({}), s.mutate(m, {
1729
- onSuccess: (y) => {
1730
- s.reset(), e == null || e(y.id);
1758
+ k({}), r.mutate(b, {
1759
+ onSuccess: (E) => {
1760
+ r.reset(), e == null || e(E.id);
1731
1761
  },
1732
- onError: (y) => {
1733
- s.reset(), w(et(y, "create"));
1762
+ onError: (E) => {
1763
+ r.reset(), v(ke(E, "create"));
1734
1764
  }
1735
1765
  });
1736
1766
  };
1737
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-create", "data-testid": "credential-create", children: [
1767
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-create", "data-testid": "credential-create", children: [
1738
1768
  /* @__PURE__ */ t("h2", { children: "Add credential" }),
1739
- a.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1740
- a.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-types-error", children: "Could not load the credential types." }),
1741
- N && /* @__PURE__ */ r(
1769
+ o.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1770
+ o.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-types-error", children: "Could not load the credential types." }),
1771
+ p && /* @__PURE__ */ l(
1742
1772
  "form",
1743
1773
  {
1744
1774
  className: "w6w-card-stack",
1745
- onSubmit: (m) => {
1746
- m.preventDefault(), g();
1775
+ onSubmit: (b) => {
1776
+ b.preventDefault(), I();
1747
1777
  },
1748
1778
  children: [
1749
- /* @__PURE__ */ r("label", { className: "w6w-field", children: [
1779
+ /* @__PURE__ */ l("label", { className: "w6w-field", children: [
1750
1780
  /* @__PURE__ */ t("span", { children: "Type" }),
1751
1781
  /* @__PURE__ */ t(
1752
1782
  "select",
1753
1783
  {
1754
- value: N.id,
1784
+ value: p.id,
1755
1785
  "aria-label": "Credential type",
1756
- onChange: (m) => $(m.target.value),
1757
- children: b.map((m) => /* @__PURE__ */ t("option", { value: m.id, children: m.label }, m.id))
1786
+ onChange: (b) => C(b.target.value),
1787
+ children: y.map((b) => /* @__PURE__ */ t("option", { value: b.id, children: b.label }, b.id))
1758
1788
  }
1759
1789
  )
1760
1790
  ] }),
1761
- /* @__PURE__ */ r("label", { className: "w6w-field", children: [
1791
+ /* @__PURE__ */ l("label", { className: "w6w-field", children: [
1762
1792
  /* @__PURE__ */ t("span", { children: "Name" }),
1763
1793
  /* @__PURE__ */ t(
1764
1794
  "input",
1765
1795
  {
1766
1796
  type: "text",
1767
1797
  className: "w6w-input",
1768
- value: l,
1769
- onChange: (m) => d(m.target.value),
1798
+ value: h,
1799
+ onChange: (b) => g(b.target.value),
1770
1800
  maxLength: 120,
1771
1801
  autoComplete: "off"
1772
1802
  }
1773
1803
  )
1774
1804
  ] }),
1805
+ a && /* @__PURE__ */ l(
1806
+ "div",
1807
+ {
1808
+ role: "radiogroup",
1809
+ "aria-label": "Who can use it",
1810
+ className: "w6w-field",
1811
+ "data-testid": "credential-owner",
1812
+ children: [
1813
+ /* @__PURE__ */ t("span", { children: "Who can use it" }),
1814
+ Ja.map((b) => /* @__PURE__ */ l("label", { className: "w6w-radio", children: [
1815
+ /* @__PURE__ */ t(
1816
+ "input",
1817
+ {
1818
+ type: "radio",
1819
+ name: "w6w-cred-create-owner",
1820
+ value: b.value,
1821
+ checked: i === b.value,
1822
+ onChange: () => s(b.value)
1823
+ }
1824
+ ),
1825
+ " ",
1826
+ /* @__PURE__ */ t("strong", { children: b.label }),
1827
+ /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1828
+ " ",
1829
+ b.hint
1830
+ ] })
1831
+ ] }, b.value))
1832
+ ]
1833
+ }
1834
+ ),
1775
1835
  /* @__PURE__ */ t(
1776
- wt,
1836
+ Ce,
1777
1837
  {
1778
- fields: N.fields,
1779
- values: u,
1780
- onChange: (m, y) => h((D) => ({ ...D, [m]: y })),
1838
+ fields: p.fields,
1839
+ values: m,
1840
+ onChange: (b, E) => k((T) => ({ ...T, [b]: E })),
1781
1841
  idPrefix: "w6w-cred-create"
1782
1842
  }
1783
1843
  ),
1784
- v && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-create-error", children: v }),
1785
- /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
1786
- /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: s.isPending, children: s.isPending ? "Creating…" : "Create credential" }),
1844
+ w && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-create-error", children: w }),
1845
+ /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
1846
+ /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: r.isPending, children: r.isPending ? "Creating…" : "Create credential" }),
1787
1847
  n && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: n, children: "Cancel" })
1788
1848
  ] })
1789
1849
  ]
@@ -1791,8 +1851,8 @@ function $i({ onCreated: e, onCancel: n }) {
1791
1851
  )
1792
1852
  ] });
1793
1853
  }
1794
- const Ke = "google-service-account.v1";
1795
- function Pa(e) {
1854
+ const We = "google-service-account.v1";
1855
+ function Ga(e) {
1796
1856
  try {
1797
1857
  const n = JSON.parse(e);
1798
1858
  return n !== null && typeof n == "object" && !Array.isArray(n) ? n : null;
@@ -1800,137 +1860,141 @@ function Pa(e) {
1800
1860
  return null;
1801
1861
  }
1802
1862
  }
1803
- const Fe = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
1804
- function Di(e) {
1805
- return /* @__PURE__ */ t(Oa, { ...e }, e.credentialId);
1863
+ const Be = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
1864
+ function Xs(e) {
1865
+ return /* @__PURE__ */ t(Za, { ...e }, e.credentialId);
1806
1866
  }
1807
- function Oa({
1867
+ function Za({
1808
1868
  credentialId: e,
1809
1869
  onOpenConnection: n,
1810
1870
  onDeleted: a,
1811
- onBack: s,
1812
- slots: i
1871
+ onBack: i,
1872
+ slots: s
1813
1873
  }) {
1814
- var ee, de, re;
1815
- const o = Rn(e), l = Sn(e), d = Pn(e), u = On(e), h = jn(e), v = Kn(), w = Le(), [b, N] = f(""), [$, g] = f({}), [m, y] = f(null), [D, E] = f(!1), [x, k] = f(null), [Q, j] = f(null), [R, A] = f(!1), [P, H] = f(null), [I, J] = f(null), q = s && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "← Credentials" });
1874
+ var te, we, oe;
1875
+ const o = Bn(e), r = Un(e), c = mt(e), u = ht(e), h = Hn(e), g = wt(), m = Ne(), [k, w] = f(""), [v, y] = f({}), [p, C] = f(null), [I, b] = f(!1), [E, T] = f(null), [j, O] = f(null), [R, x] = f(!1), [D, S] = f(null), [$, V] = f(null), _ = i && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: i, children: "← Credentials" });
1816
1876
  if (o.isLoading)
1817
1877
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-cred-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
1818
- const S = o.data;
1819
- if (!S)
1820
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-detail", "data-testid": "credential-not-found", children: [
1821
- (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
1822
- q
1878
+ const K = o.data;
1879
+ if (!K)
1880
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-detail", "data-testid": "credential-not-found", children: [
1881
+ (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
1882
+ _
1823
1883
  ] });
1824
- const U = ((ee = l.data) == null ? void 0 : ee.connections) ?? [], _ = S.connectionCount, p = S.status === "disabled", L = S.contract === Ke || (de = w.data) == null ? void 0 : de.find((c) => c.id === S.contract), M = S.contract !== Ke && w.isLoading, z = () => {
1825
- if (!L) return;
1826
- if (E(!1), !pt(L.fields, $)) {
1827
- y("Fill in every field.");
1884
+ const H = ((te = r.data) == null ? void 0 : te.connections) ?? [], W = K.connectionCount, N = K.status === "disabled", M = K.contract === We || (we = m.data) == null ? void 0 : we.find((d) => d.id === K.contract), P = K.contract !== We && m.isLoading, J = () => {
1885
+ if (!M) return;
1886
+ if (b(!1), !Te(M.fields, v)) {
1887
+ C("Fill in every field.");
1828
1888
  return;
1829
1889
  }
1830
- y(null);
1831
- const c = ft(L.fields, $);
1832
- g({}), d.mutate(
1833
- { source: c },
1890
+ C(null);
1891
+ const d = Ee(M.fields, v);
1892
+ y({}), c.mutate(
1893
+ { source: d },
1834
1894
  {
1835
1895
  onSuccess: () => {
1836
- d.reset(), E(!0);
1896
+ c.reset(), b(!0);
1837
1897
  },
1838
- onError: (T) => {
1839
- d.reset(), y(et(T, "rotate"));
1898
+ onError: (A) => {
1899
+ c.reset(), C(ke(A, "rotate"));
1840
1900
  }
1841
1901
  }
1842
1902
  );
1843
- }, C = () => {
1844
- E(!1);
1845
- const c = Pa(b);
1846
- if (!c) {
1847
- y("Enter the new secret as a JSON object.");
1903
+ }, L = () => {
1904
+ b(!1);
1905
+ const d = Ga(k);
1906
+ if (!d) {
1907
+ C("Enter the new secret as a JSON object.");
1848
1908
  return;
1849
1909
  }
1850
- y(null), d.mutate(
1851
- { source: c },
1910
+ C(null), c.mutate(
1911
+ { source: d },
1852
1912
  {
1853
1913
  onSuccess: () => {
1854
- N(""), E(!0);
1914
+ w(""), b(!0);
1855
1915
  },
1856
- onError: (T) => y((T == null ? void 0 : T.message) ?? "Rotate failed.")
1916
+ onError: (A) => C(ee(A) ?? (A == null ? void 0 : A.message) ?? "Rotate failed.")
1857
1917
  }
1858
1918
  );
1859
- }, O = () => {
1860
- k(null), j(null), h.mutate(void 0, {
1861
- onSuccess: k,
1862
- onError: (c) => j((c == null ? void 0 : c.message) ?? "Test failed.")
1919
+ }, F = () => {
1920
+ T(null), O(null), h.mutate(void 0, {
1921
+ onSuccess: T,
1922
+ onError: (d) => O(ee(d) ?? (d == null ? void 0 : d.message) ?? "Test failed.")
1863
1923
  });
1864
1924
  }, G = () => {
1865
- J(null), v.mutate(e, {
1866
- onSuccess: (c) => {
1867
- A(!1), c.ok ? a == null || a() : H(c.dependents.connections);
1925
+ V(null), g.mutate(e, {
1926
+ onSuccess: (d) => {
1927
+ x(!1), d.ok ? a == null || a() : S(d.dependents.connections);
1868
1928
  },
1869
- onError: (c) => J((c == null ? void 0 : c.message) ?? "Delete failed.")
1929
+ onError: (d) => V(ee(d) ?? (d == null ? void 0 : d.message) ?? "Delete failed.")
1870
1930
  });
1871
1931
  };
1872
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-detail w6w-card-stack", children: [
1873
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1874
- /* @__PURE__ */ t("h2", { children: S.name }),
1875
- /* @__PURE__ */ r("p", { className: "w6w-small", children: [
1876
- /* @__PURE__ */ t("code", { children: S.contract }),
1932
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-detail w6w-card-stack", children: [
1933
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1934
+ /* @__PURE__ */ t("h2", { children: K.name }),
1935
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1936
+ /* @__PURE__ */ t("code", { children: K.contract }),
1877
1937
  " ",
1878
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: S.status })
1938
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: K.status })
1939
+ ] }),
1940
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1941
+ /* @__PURE__ */ t("span", { "data-testid": "credential-scope", children: ut(K.accessScope) }),
1942
+ /* @__PURE__ */ t("span", { className: "w6w-muted", children: " · Reusable credential" })
1879
1943
  ] }),
1880
- /* @__PURE__ */ t("dl", { className: "w6w-small", "data-testid": "credential-display", children: Object.entries(S.display).map(([c, T]) => /* @__PURE__ */ r("div", { children: [
1881
- /* @__PURE__ */ t("dt", { className: "w6w-muted", children: c }),
1882
- /* @__PURE__ */ t("dd", { children: T })
1883
- ] }, c)) }),
1884
- /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1885
- _,
1944
+ /* @__PURE__ */ t("dl", { className: "w6w-small", "data-testid": "credential-display", children: Object.entries(K.display).map(([d, A]) => /* @__PURE__ */ l("div", { children: [
1945
+ /* @__PURE__ */ t("dt", { className: "w6w-muted", children: d }),
1946
+ /* @__PURE__ */ t("dd", { children: A })
1947
+ ] }, d)) }),
1948
+ /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1949
+ W,
1886
1950
  " connection",
1887
- _ === 1 ? "" : "s",
1951
+ W === 1 ? "" : "s",
1888
1952
  " · created ",
1889
- Fe(S.createdAt),
1953
+ Be(K.createdAt),
1890
1954
  " · updated",
1891
1955
  " ",
1892
- Fe(S.updatedAt)
1956
+ Be(K.updatedAt)
1893
1957
  ] }),
1894
- q
1958
+ _
1895
1959
  ] }),
1896
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "credential-connections", children: [
1960
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "credential-connections", children: [
1897
1961
  /* @__PURE__ */ t("h3", { children: "Connected apps" }),
1898
- U.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any connection." }) : /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Connected apps", children: U.map((c) => /* @__PURE__ */ t("li", { children: n ? /* @__PURE__ */ t(
1962
+ H.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any connection." }) : /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Connected apps", children: H.map((d) => /* @__PURE__ */ t("li", { children: n ? /* @__PURE__ */ t(
1899
1963
  "button",
1900
1964
  {
1901
1965
  type: "button",
1902
1966
  className: "w6w-embed-conn-action",
1903
- onClick: () => n(c.id),
1904
- children: c.displayName || c.appId
1967
+ onClick: () => n(d.id),
1968
+ children: d.displayName || d.appId
1905
1969
  }
1906
- ) : /* @__PURE__ */ t("span", { children: c.displayName || c.appId }) }, c.id)) })
1970
+ ) : /* @__PURE__ */ t("span", { children: d.displayName || d.appId }) }, d.id)) })
1907
1971
  ] }),
1908
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1972
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1909
1973
  /* @__PURE__ */ t("h3", { children: "Rotate secret" }),
1910
- /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", "data-testid": "credential-rotation-impact", children: [
1911
- _,
1974
+ /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", "data-testid": "credential-rotation-impact", children: [
1975
+ W,
1912
1976
  " connection",
1913
- _ === 1 ? "" : "s",
1977
+ W === 1 ? "" : "s",
1914
1978
  " will be marked untested"
1915
1979
  ] }),
1916
- M && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1917
- L && /* @__PURE__ */ t(
1918
- wt,
1980
+ P && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1981
+ M && /* @__PURE__ */ t(
1982
+ Ce,
1919
1983
  {
1920
- fields: L.fields,
1921
- values: $,
1922
- onChange: (c, T) => g((F) => ({ ...F, [c]: T })),
1984
+ fields: M.fields,
1985
+ values: v,
1986
+ onChange: (d, A) => y((q) => ({ ...q, [d]: A })),
1923
1987
  idPrefix: "w6w-cred-rotate"
1924
1988
  }
1925
1989
  ),
1926
- !M && !L && /* @__PURE__ */ t(
1990
+ !P && !M && /* @__PURE__ */ t(
1927
1991
  "textarea",
1928
1992
  {
1929
1993
  className: "w6w-input w6w-secret-input",
1930
1994
  "aria-label": "New secret (JSON object)",
1931
1995
  rows: 5,
1932
- value: b,
1933
- onChange: (c) => N(c.target.value),
1996
+ value: k,
1997
+ onChange: (d) => w(d.target.value),
1934
1998
  name: "w6w-cred-rotate",
1935
1999
  autoComplete: "off",
1936
2000
  autoCapitalize: "off",
@@ -1942,30 +2006,30 @@ function Oa({
1942
2006
  "data-form-type": "other"
1943
2007
  }
1944
2008
  ),
1945
- m && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-rotate-error", children: m }),
1946
- D && /* @__PURE__ */ t("output", { children: "Secret rotated." }),
2009
+ p && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-rotate-error", children: p }),
2010
+ I && /* @__PURE__ */ t("output", { children: "Secret rotated." }),
1947
2011
  /* @__PURE__ */ t(
1948
2012
  "button",
1949
2013
  {
1950
2014
  type: "button",
1951
2015
  className: "w6w-btn",
1952
- disabled: d.isPending || M,
1953
- onClick: L ? z : C,
1954
- children: d.isPending ? "Rotating…" : "Rotate"
2016
+ disabled: c.isPending || P,
2017
+ onClick: M ? J : L,
2018
+ children: c.isPending ? "Rotating…" : "Rotate"
1955
2019
  }
1956
2020
  )
1957
2021
  ] }),
1958
- /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
2022
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1959
2023
  /* @__PURE__ */ t("h3", { children: "Manage" }),
1960
- /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
2024
+ /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
1961
2025
  /* @__PURE__ */ t(
1962
2026
  "button",
1963
2027
  {
1964
2028
  type: "button",
1965
2029
  className: "w6w-btn w6w-btn-ghost",
1966
2030
  disabled: u.isPending,
1967
- onClick: () => u.mutate(p ? "active" : "disabled"),
1968
- children: p ? "Enable" : "Disable"
2031
+ onClick: () => u.mutate(N ? "active" : "disabled"),
2032
+ children: N ? "Enable" : "Disable"
1969
2033
  }
1970
2034
  ),
1971
2035
  /* @__PURE__ */ t(
@@ -1974,7 +2038,7 @@ function Oa({
1974
2038
  type: "button",
1975
2039
  className: "w6w-btn w6w-btn-ghost",
1976
2040
  disabled: h.isPending,
1977
- onClick: O,
2041
+ onClick: F,
1978
2042
  children: h.isPending ? "Testing…" : "Test credential"
1979
2043
  }
1980
2044
  ),
@@ -1984,19 +2048,19 @@ function Oa({
1984
2048
  type: "button",
1985
2049
  className: "w6w-btn w6w-btn-danger",
1986
2050
  onClick: () => {
1987
- H(null), A(!0);
2051
+ S(null), x(!0);
1988
2052
  },
1989
2053
  children: "Delete"
1990
2054
  }
1991
2055
  )
1992
2056
  ] }),
1993
- x && /* @__PURE__ */ t("output", { "data-testid": "credential-test-result", children: x.ok ? "ok" : x.code ?? "failed" }),
1994
- Q && /* @__PURE__ */ t("p", { role: "alert", children: Q }),
1995
- u.isError && /* @__PURE__ */ t("p", { role: "alert", children: ((re = u.error) == null ? void 0 : re.message) ?? "Update failed." }),
1996
- R && /* @__PURE__ */ r("div", { "data-testid": "credential-delete-confirm", children: [
1997
- /* @__PURE__ */ r("p", { className: "w6w-small", children: [
2057
+ E && /* @__PURE__ */ t("output", { "data-testid": "credential-test-result", children: E.ok ? "ok" : E.code ?? "failed" }),
2058
+ j && /* @__PURE__ */ t("p", { role: "alert", children: j }),
2059
+ u.isError && /* @__PURE__ */ t("p", { role: "alert", children: ee(u.error) ?? ((oe = u.error) == null ? void 0 : oe.message) ?? "Update failed." }),
2060
+ R && /* @__PURE__ */ l("div", { "data-testid": "credential-delete-confirm", children: [
2061
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1998
2062
  'Delete the credential "',
1999
- S.name,
2063
+ K.name,
2000
2064
  '"? This cannot be undone.'
2001
2065
  ] }),
2002
2066
  /* @__PURE__ */ t(
@@ -2004,7 +2068,7 @@ function Oa({
2004
2068
  {
2005
2069
  type: "button",
2006
2070
  className: "w6w-btn w6w-btn-danger",
2007
- disabled: v.isPending,
2071
+ disabled: g.isPending,
2008
2072
  onClick: G,
2009
2073
  children: "Confirm delete"
2010
2074
  }
@@ -2015,311 +2079,669 @@ function Oa({
2015
2079
  {
2016
2080
  type: "button",
2017
2081
  className: "w6w-btn w6w-btn-ghost",
2018
- onClick: () => A(!1),
2082
+ onClick: () => x(!1),
2019
2083
  children: "Cancel"
2020
2084
  }
2021
2085
  )
2022
2086
  ] }),
2023
- P && /* @__PURE__ */ r("div", { role: "alert", "data-testid": "credential-in-use", children: [
2024
- /* @__PURE__ */ r("p", { className: "w6w-small", children: [
2087
+ D && /* @__PURE__ */ l("div", { role: "alert", "data-testid": "credential-in-use", children: [
2088
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
2025
2089
  "This credential is still used by ",
2026
- P.length,
2090
+ D.length,
2027
2091
  " connection",
2028
- P.length === 1 ? "" : "s",
2092
+ D.length === 1 ? "" : "s",
2029
2093
  ". Delete those integrations first, or rotate this credential instead of deleting it."
2030
2094
  ] }),
2031
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children: P.map((c) => /* @__PURE__ */ t("li", { children: c.displayName || c.appId }, c.id)) })
2095
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children: D.map((d) => /* @__PURE__ */ t("li", { children: d.displayName || d.appId }, d.id)) })
2032
2096
  ] }),
2033
- I && /* @__PURE__ */ t("p", { role: "alert", children: I })
2097
+ $ && /* @__PURE__ */ t("p", { role: "alert", children: $ })
2034
2098
  ] })
2035
2099
  ] });
2036
2100
  }
2037
- function V(e) {
2038
- const n = Pt(e), a = e == null ? void 0 : e.code;
2101
+ const Xa = "Keys that only you can use are not turned on for this account.", es = "Models that only your personal key can see are not added to the account's catalog.", ts = "This provider is not supported for personal keys.", ns = "Could not save the key. Nothing was kept.", as = "Could not save the key, and a partial copy could not be removed. Remove it under Shared credentials.", Ue = "The key was removed, but its stored copy was not.";
2102
+ function ss(e) {
2103
+ var i;
2104
+ const n = e ?? {}, a = Array.isArray(n.accepts) ? n.accepts : (i = n.serviceAccount) == null ? void 0 : i.accepts;
2105
+ return Array.isArray(a) ? a.filter((s) => typeof s == "string") : [];
2106
+ }
2107
+ function is(e, n) {
2108
+ for (const a of e ?? []) {
2109
+ const i = a;
2110
+ if (i.type === "oauth2" || typeof i.key != "string") continue;
2111
+ const s = ss(a).find((o) => n.some((r) => r.id === o));
2112
+ if (s) return { authKey: i.key, contract: s };
2113
+ }
2114
+ return null;
2115
+ }
2116
+ const re = (e) => e.provider ?? e.appId;
2117
+ function ei({ providerAppId: e }) {
2118
+ const n = pt(), a = Vn(), i = it(), s = dt({ accessScope: "user" }), o = Gn(n), r = Ne(), c = (a.data ?? []).filter((w) => w.designation), u = new Map((s.data ?? []).map((w) => [w.id, w])), h = (i.data ?? []).filter(
2119
+ (w) => w.accessScope === "user" && w.credentialId && u.has(w.credentialId)
2120
+ ), g = o.data ?? [], [m, k] = f(null);
2121
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-ai-keys w6w-card-stack", "data-testid": "my-ai-keys", children: [
2122
+ /* @__PURE__ */ t("h2", { children: "My AI keys" }),
2123
+ /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Keys that only you can use. They are never shown again after you save them." }),
2124
+ /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", "data-testid": "ai-keys-private-note", children: es }),
2125
+ !n && /* @__PURE__ */ t("output", { className: "w6w-muted", "data-testid": "ai-keys-disabled", children: Xa }),
2126
+ (a.isLoading || i.isLoading || s.isLoading) && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2127
+ a.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: "Could not load the AI providers." }),
2128
+ n && c.length > 0 && /* @__PURE__ */ t(ls, { providers: c, initial: e, types: r.data ?? [] }),
2129
+ !a.isLoading && !a.error && c.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No AI providers are available." }),
2130
+ m && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-keys-notice", children: m }),
2131
+ c.map((w) => {
2132
+ const v = h.filter((y) => y.appId === w.appId);
2133
+ return v.length === 0 ? null : /* @__PURE__ */ t(
2134
+ rs,
2135
+ {
2136
+ provider: w,
2137
+ keys: v,
2138
+ creds: u,
2139
+ current: g.find((y) => y.providerAppId === w.appId),
2140
+ types: r.data ?? [],
2141
+ onNotice: k
2142
+ },
2143
+ w.appId
2144
+ );
2145
+ })
2146
+ ] });
2147
+ }
2148
+ function ls({
2149
+ providers: e,
2150
+ initial: n,
2151
+ types: a
2152
+ }) {
2153
+ var R, x;
2154
+ const i = he(), s = me(), [o, r] = f(n), c = ((R = e.find((D) => D.appId === o)) == null ? void 0 : R.appId) ?? ((x = e[0]) == null ? void 0 : x.appId) ?? "", u = e.find((D) => D.appId === c), [h, g] = f(""), [m, k] = f({}), [w, v] = f(null), [y, p] = f(!1), [C, I] = f(!1), b = Rn({
2155
+ queryKey: ["app-auth", c],
2156
+ queryFn: () => i.console.apps.getAuth(c),
2157
+ enabled: c !== "",
2158
+ retry: !1
2159
+ }), E = is(b.data, a), T = E ? a.find((D) => D.id === E.contract) : void 0, j = (D) => {
2160
+ r(D), k({}), v(null), I(!1);
2161
+ }, O = async () => {
2162
+ if (!u || !E || !T || y) return;
2163
+ if (!Te(T.fields, m)) {
2164
+ v("Fill in every field.");
2165
+ return;
2166
+ }
2167
+ v(null), I(!1);
2168
+ const D = Ee(T.fields, m);
2169
+ k({}), p(!0);
2170
+ let S = null;
2171
+ try {
2172
+ const $ = await Yn(i, {
2173
+ name: h.trim() || `My ${re(u)} key`,
2174
+ contract: E.contract,
2175
+ source: D,
2176
+ accessScope: "user"
2177
+ });
2178
+ S = $.id, await On(i, c, {
2179
+ authKey: E.authKey,
2180
+ credentialId: $.id,
2181
+ accessScope: "user"
2182
+ }), g(""), I(!0);
2183
+ } catch ($) {
2184
+ if (S) {
2185
+ const V = await zn(i, S).then(
2186
+ (_) => _.ok,
2187
+ () => !1
2188
+ );
2189
+ v(V ? ee($) ?? ns : as);
2190
+ } else
2191
+ v(ke($, "create"));
2192
+ } finally {
2193
+ p(!1), s.invalidateQueries({ queryKey: Jn }), s.invalidateQueries({ queryKey: ge });
2194
+ }
2195
+ };
2196
+ return /* @__PURE__ */ l(
2197
+ "form",
2198
+ {
2199
+ className: "w6w-embed-conn-card w6w-card-stack",
2200
+ "data-testid": "ai-key-add",
2201
+ onSubmit: (D) => {
2202
+ D.preventDefault(), O();
2203
+ },
2204
+ children: [
2205
+ /* @__PURE__ */ t("h3", { children: "Add a key" }),
2206
+ /* @__PURE__ */ l("label", { className: "w6w-field", children: [
2207
+ /* @__PURE__ */ t("span", { children: "Provider" }),
2208
+ /* @__PURE__ */ t("select", { value: c, "aria-label": "Provider", onChange: (D) => j(D.target.value), children: e.map((D) => /* @__PURE__ */ t("option", { value: D.appId, children: re(D) }, D.appId)) })
2209
+ ] }),
2210
+ b.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
2211
+ !b.isLoading && !T && /* @__PURE__ */ t("p", { className: "w6w-muted", "data-testid": "ai-key-unsupported", children: ts }),
2212
+ T && /* @__PURE__ */ l(Q, { children: [
2213
+ /* @__PURE__ */ l("label", { className: "w6w-field", children: [
2214
+ /* @__PURE__ */ t("span", { children: "Name" }),
2215
+ /* @__PURE__ */ t(
2216
+ "input",
2217
+ {
2218
+ type: "text",
2219
+ className: "w6w-input",
2220
+ value: h,
2221
+ placeholder: u ? `My ${re(u)} key` : "",
2222
+ onChange: (D) => g(D.target.value),
2223
+ maxLength: 120,
2224
+ autoComplete: "off"
2225
+ }
2226
+ )
2227
+ ] }),
2228
+ /* @__PURE__ */ t(
2229
+ Ce,
2230
+ {
2231
+ fields: T.fields,
2232
+ values: m,
2233
+ onChange: (D, S) => k(($) => ({ ...$, [D]: S })),
2234
+ idPrefix: "w6w-ai-key-add"
2235
+ }
2236
+ ),
2237
+ w && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "ai-key-add-error", children: w }),
2238
+ C && /* @__PURE__ */ t("output", { "data-testid": "ai-key-saved", children: "Key saved. Only you can use it." }),
2239
+ /* @__PURE__ */ t("div", { className: "w6w-modal-actions", children: /* @__PURE__ */ t("button", { type: "submit", className: "w6w-btn", disabled: y, children: y ? "Saving…" : "Save key" }) })
2240
+ ] })
2241
+ ]
2242
+ }
2243
+ );
2244
+ }
2245
+ function rs({
2246
+ provider: e,
2247
+ keys: n,
2248
+ creds: a,
2249
+ current: i,
2250
+ types: s,
2251
+ onNotice: o
2252
+ }) {
2253
+ const r = Zn(), c = Xn(), [u, h] = f(null), g = e.appId, m = i && n.some((w) => w.id === i.connectionId) ? i : void 0, k = (w) => {
2254
+ h(null);
2255
+ const v = {
2256
+ onError: (y) => h(ee(y) ?? "Could not change the default key.")
2257
+ };
2258
+ w === null ? c.mutate(g, v) : r.mutate({ providerAppId: g, connectionId: w }, v);
2259
+ };
2260
+ return /* @__PURE__ */ l("section", { className: "w6w-embed-conn-card w6w-card-stack", "data-testid": `ai-provider-${g}`, children: [
2261
+ /* @__PURE__ */ t("h3", { children: re(e) }),
2262
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": `${re(e)} keys`, children: n.map((w) => {
2263
+ const v = a.get(w.credentialId);
2264
+ return /* @__PURE__ */ t(
2265
+ os,
2266
+ {
2267
+ connection: w,
2268
+ credential: v,
2269
+ descriptor: s.find((y) => y.id === v.contract),
2270
+ onNotice: o
2271
+ },
2272
+ w.id
2273
+ );
2274
+ }) }),
2275
+ /* @__PURE__ */ l("div", { role: "radiogroup", "aria-label": `Default key for ${re(e)}`, children: [
2276
+ /* @__PURE__ */ t("span", { className: "w6w-small", children: "Default key" }),
2277
+ /* @__PURE__ */ l("label", { className: "w6w-radio", children: [
2278
+ /* @__PURE__ */ t(
2279
+ "input",
2280
+ {
2281
+ type: "radio",
2282
+ name: `ai-default-${g}`,
2283
+ checked: !m,
2284
+ onChange: () => {
2285
+ m && k(null);
2286
+ }
2287
+ }
2288
+ ),
2289
+ " ",
2290
+ "None"
2291
+ ] }),
2292
+ n.map((w) => /* @__PURE__ */ l("label", { className: "w6w-radio", children: [
2293
+ /* @__PURE__ */ t(
2294
+ "input",
2295
+ {
2296
+ type: "radio",
2297
+ name: `ai-default-${g}`,
2298
+ "data-testid": `ai-default-${w.id}`,
2299
+ checked: (m == null ? void 0 : m.connectionId) === w.id,
2300
+ onChange: () => k(w.id)
2301
+ }
2302
+ ),
2303
+ " ",
2304
+ w.displayName
2305
+ ] }, w.id))
2306
+ ] }),
2307
+ (i == null ? void 0 : i.status) === "unavailable" && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": `ai-default-warning-${g}`, children: "Your default key for this provider is not available. Enable it, replace it or pick another." }),
2308
+ u && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: u })
2309
+ ] });
2310
+ }
2311
+ function os({
2312
+ connection: e,
2313
+ credential: n,
2314
+ descriptor: a,
2315
+ onNotice: i
2316
+ }) {
2317
+ const s = ct(e.id), o = mt(n.id), r = ht(n.id), c = lt(), u = wt(), [h, g] = f(!1), [m, k] = f({}), [w, v] = f(!1), [y, p] = f(null), [C, I] = f(null), [b, E] = f(null), T = n.status === "disabled", j = Object.values(n.display)[0], O = (S, $) => I(ee(S) ?? $), R = () => {
2318
+ E(null), I(null), s.mutate(void 0, {
2319
+ onSuccess: (S) => E(S.ok ? "ok" : "failed"),
2320
+ onError: (S) => O(S, "Could not test the key.")
2321
+ });
2322
+ }, x = () => {
2323
+ if (!a) return;
2324
+ if (p(null), !Te(a.fields, m)) {
2325
+ I("Fill in every field.");
2326
+ return;
2327
+ }
2328
+ I(null);
2329
+ const S = Ee(a.fields, m);
2330
+ k({}), o.mutate(
2331
+ { source: S },
2332
+ {
2333
+ onSuccess: () => {
2334
+ o.reset(), g(!1), p("Key replaced.");
2335
+ },
2336
+ onError: ($) => {
2337
+ o.reset(), I(ke($, "rotate"));
2338
+ }
2339
+ }
2340
+ );
2341
+ }, D = () => {
2342
+ I(null), i(null), c.mutate(
2343
+ { id: e.id },
2344
+ {
2345
+ onSuccess: (S) => {
2346
+ if (!S.ok) {
2347
+ v(!1), I("This key is still in use. Remove what uses it first.");
2348
+ return;
2349
+ }
2350
+ u.mutate(n.id, {
2351
+ onSuccess: ($) => {
2352
+ $.ok || i(Ue);
2353
+ },
2354
+ onError: ($) => i(ee($) ?? Ue)
2355
+ });
2356
+ },
2357
+ onError: (S) => {
2358
+ v(!1), O(S, "Could not remove the key.");
2359
+ }
2360
+ }
2361
+ );
2362
+ };
2363
+ return /* @__PURE__ */ l("li", { "data-testid": `ai-key-${e.id}`, children: [
2364
+ /* @__PURE__ */ l("div", { children: [
2365
+ /* @__PURE__ */ t("strong", { children: e.displayName }),
2366
+ " ",
2367
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", "data-testid": `ai-key-status-${e.id}`, children: n.status }),
2368
+ j !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", "data-testid": `ai-key-display-${e.id}`, children: [
2369
+ " ",
2370
+ j
2371
+ ] })
2372
+ ] }),
2373
+ /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
2374
+ /* @__PURE__ */ t(
2375
+ "button",
2376
+ {
2377
+ type: "button",
2378
+ className: "w6w-btn w6w-btn-ghost",
2379
+ disabled: s.isPending,
2380
+ onClick: R,
2381
+ children: s.isPending ? "Testing…" : "Test"
2382
+ }
2383
+ ),
2384
+ a && /* @__PURE__ */ t(
2385
+ "button",
2386
+ {
2387
+ type: "button",
2388
+ className: "w6w-btn w6w-btn-ghost",
2389
+ onClick: () => g((S) => !S),
2390
+ children: "Replace key"
2391
+ }
2392
+ ),
2393
+ /* @__PURE__ */ t(
2394
+ "button",
2395
+ {
2396
+ type: "button",
2397
+ className: "w6w-btn w6w-btn-ghost",
2398
+ disabled: r.isPending,
2399
+ onClick: () => r.mutate(T ? "active" : "disabled", {
2400
+ onError: (S) => O(S, "Could not change the key's status.")
2401
+ }),
2402
+ children: T ? "Enable" : "Disable"
2403
+ }
2404
+ ),
2405
+ /* @__PURE__ */ t(
2406
+ "button",
2407
+ {
2408
+ type: "button",
2409
+ className: "w6w-btn w6w-btn-danger",
2410
+ onClick: () => v(!0),
2411
+ children: "Remove"
2412
+ }
2413
+ )
2414
+ ] }),
2415
+ b && /* @__PURE__ */ t("output", { "data-testid": `ai-key-test-${e.id}`, children: b === "ok" ? "Test passed" : "Test failed" }),
2416
+ h && a && /* @__PURE__ */ l("div", { className: "w6w-card-stack", "data-testid": `ai-key-replace-${e.id}`, children: [
2417
+ /* @__PURE__ */ t(
2418
+ Ce,
2419
+ {
2420
+ fields: a.fields,
2421
+ values: m,
2422
+ onChange: (S, $) => k((V) => ({ ...V, [S]: $ })),
2423
+ idPrefix: `w6w-ai-key-replace-${e.id}`
2424
+ }
2425
+ ),
2426
+ /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", disabled: o.isPending, onClick: x, children: o.isPending ? "Replacing…" : "Save new key" })
2427
+ ] }),
2428
+ w && /* @__PURE__ */ l("div", { "data-testid": `ai-key-remove-confirm-${e.id}`, children: [
2429
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
2430
+ 'Remove "',
2431
+ e.displayName,
2432
+ '"? This cannot be undone.'
2433
+ ] }),
2434
+ /* @__PURE__ */ t(
2435
+ "button",
2436
+ {
2437
+ type: "button",
2438
+ className: "w6w-btn w6w-btn-danger",
2439
+ disabled: c.isPending,
2440
+ onClick: D,
2441
+ children: "Confirm remove"
2442
+ }
2443
+ ),
2444
+ " ",
2445
+ /* @__PURE__ */ t(
2446
+ "button",
2447
+ {
2448
+ type: "button",
2449
+ className: "w6w-btn w6w-btn-ghost",
2450
+ onClick: () => v(!1),
2451
+ children: "Cancel"
2452
+ }
2453
+ )
2454
+ ] }),
2455
+ y && /* @__PURE__ */ t("output", { children: y }),
2456
+ C && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: C })
2457
+ ] });
2458
+ }
2459
+ function Y(e) {
2460
+ const n = Yt(e), a = e == null ? void 0 : e.code;
2039
2461
  return n.code === void 0 && typeof a == "string" && a !== "" ? { ...n, code: a } : n;
2040
2462
  }
2041
- const Qe = 80;
2042
- function ja(e, n) {
2463
+ const He = 80;
2464
+ function cs(e, n) {
2043
2465
  if (typeof URL > "u" || typeof URL.createObjectURL != "function") return;
2044
- const a = URL.createObjectURL(new Blob([n], { type: "text/csv" })), s = document.createElement("a");
2045
- s.href = a, s.download = e, s.click(), URL.revokeObjectURL(a);
2046
- }
2047
- function Ka({ store: e, project: n }) {
2048
- var re;
2049
- const a = Ot(e), s = (a == null ? void 0 : a.columns) ?? [], i = (a == null ? void 0 : a.key) ?? "", [o, l] = f(""), [d, u] = f({}), [h, v] = f({}), [w, b] = f({}), [N, $] = f({}), [g, m] = f(null), [y, D] = f(null), [E, x] = f(null), k = ge(), Q = fe(), j = tt(e.id, n, o), R = nt(), A = Qn(), P = at(), H = qn(), I = _n(), J = (((re = j.data) == null ? void 0 : re.pages.flatMap((c) => c.items)) ?? []).map(
2050
- (c) => N[c.key] ?? c
2051
- ), q = new Map(J.map((c) => [c.key, c])), S = [], U = (c) => d[c], _ = U(ne), p = (c, T, F) => {
2052
- const Z = F === void 0 ? null : ue(F, s);
2053
- S.push({
2054
- id: c,
2055
- isNew: c === ne,
2056
- cells: T.cells,
2057
- version: T.version,
2058
- dirty: Z === null ? !0 : _t(T, Z, s).length > 0,
2059
- conflict: w[c] === !0,
2060
- cellErrors: h[c]
2466
+ const a = URL.createObjectURL(new Blob([n], { type: "text/csv" })), i = document.createElement("a");
2467
+ i.href = a, i.download = e, i.click(), URL.revokeObjectURL(a);
2468
+ }
2469
+ function ds({ store: e, project: n }) {
2470
+ var oe;
2471
+ const a = zt(e), i = (a == null ? void 0 : a.columns) ?? [], s = (a == null ? void 0 : a.key) ?? "", [o, r] = f(""), [c, u] = f({}), [h, g] = f({}), [m, k] = f({}), [w, v] = f({}), [y, p] = f(null), [C, I] = f(null), [b, E] = f(null), T = he(), j = me(), O = ft(e.id, n, o), R = yt(), x = ta(), D = gt(), S = na(), $ = aa(), V = (((oe = O.data) == null ? void 0 : oe.pages.flatMap((d) => d.items)) ?? []).map(
2472
+ (d) => w[d.key] ?? d
2473
+ ), _ = new Map(V.map((d) => [d.key, d])), K = [], H = (d) => c[d], W = H(ae), N = (d, A, q) => {
2474
+ const Z = q === void 0 ? null : pe(q, i);
2475
+ K.push({
2476
+ id: d,
2477
+ isNew: d === ae,
2478
+ cells: A.cells,
2479
+ version: A.version,
2480
+ dirty: Z === null ? !0 : tn(A, Z, i).length > 0,
2481
+ conflict: m[d] === !0,
2482
+ cellErrors: h[d]
2061
2483
  });
2062
2484
  };
2063
- _ !== void 0 && p(ne, _, void 0);
2064
- for (const c of J)
2065
- p(c.key, U(c.key) ?? ue(c, s), c);
2066
- const L = (c) => {
2067
- v((T) => ae(T, c)), b((T) => ae(T, c));
2068
- }, M = (c) => {
2069
- u((T) => ae(T, c)), L(c);
2485
+ W !== void 0 && N(ae, W, void 0);
2486
+ for (const d of V)
2487
+ N(d.key, H(d.key) ?? pe(d, i), d);
2488
+ const M = (d) => {
2489
+ g((A) => se(A, d)), k((A) => se(A, d));
2490
+ }, P = (d) => {
2491
+ u((A) => se(A, d)), M(d);
2070
2492
  };
2071
- function z(c, T, F) {
2072
- const Z = q.get(c), Y = U(c) ?? (Z ? ue(Z, s) : Me(s));
2073
- u((W) => ({ ...W, [c]: { ...Y, cells: { ...Y.cells, [T]: F } } })), v((W) => {
2074
- const te = W[c];
2075
- if (te === void 0 || !(T in te)) return W;
2076
- const le = ae(te, T);
2077
- return Object.keys(le).length === 0 ? ae(W, c) : { ...W, [c]: le };
2493
+ function J(d, A, q) {
2494
+ const Z = _.get(d), z = H(d) ?? (Z ? pe(Z, i) : Ke(i));
2495
+ u((B) => ({ ...B, [d]: { ...z, cells: { ...z.cells, [A]: q } } })), g((B) => {
2496
+ const ne = B[d];
2497
+ if (ne === void 0 || !(A in ne)) return B;
2498
+ const ce = se(ne, A);
2499
+ return Object.keys(ce).length === 0 ? se(B, d) : { ...B, [d]: ce };
2078
2500
  });
2079
2501
  }
2080
- async function C(c) {
2081
- const T = q.get(c), F = U(c) ?? (T ? ue(T, s) : void 0);
2082
- if (F === void 0) return;
2083
- m(null), L(c);
2084
- const Z = Bt(F, s);
2502
+ async function L(d) {
2503
+ const A = _.get(d), q = H(d) ?? (A ? pe(A, i) : void 0);
2504
+ if (q === void 0) return;
2505
+ p(null), M(d);
2506
+ const Z = an(q, i);
2085
2507
  if (!Z.ok) {
2086
- v((W) => ({ ...W, [c]: Z.errors }));
2508
+ g((B) => ({ ...B, [d]: Z.errors }));
2087
2509
  return;
2088
2510
  }
2089
- const Y = Ut(
2090
- F,
2511
+ const z = sn(
2512
+ q,
2091
2513
  Z.value,
2092
- Ve((T == null ? void 0 : T.expiresAt) ?? null, Date.now())
2514
+ Xe((A == null ? void 0 : A.expiresAt) ?? null, Date.now())
2093
2515
  );
2094
2516
  try {
2095
- Y.kind === "insert" ? await A.mutateAsync({
2517
+ z.kind === "insert" ? await x.mutateAsync({
2096
2518
  id: e.id,
2097
- row: Y.value,
2098
- ttlSeconds: Y.ttlSeconds,
2519
+ row: z.value,
2520
+ ttlSeconds: z.ttlSeconds,
2099
2521
  project: n
2100
2522
  }) : await R.mutateAsync({
2101
2523
  id: e.id,
2102
- key: Y.key,
2103
- value: Y.value,
2104
- ifVersion: Y.ifVersion,
2105
- ttlSeconds: Y.ttlSeconds,
2524
+ key: z.key,
2525
+ value: z.value,
2526
+ ifVersion: z.ifVersion,
2527
+ ttlSeconds: z.ttlSeconds,
2106
2528
  project: n
2107
- }), $((W) => ae(W, c)), M(c);
2108
- } catch (W) {
2109
- const te = V(W);
2110
- if (He(te)) {
2111
- b((ye) => ({ ...ye, [c]: !0 }));
2529
+ }), v((B) => se(B, d)), P(d);
2530
+ } catch (B) {
2531
+ const ne = Y(B);
2532
+ if (et(ne)) {
2533
+ k((Ie) => ({ ...Ie, [d]: !0 }));
2112
2534
  return;
2113
2535
  }
2114
- const le = Vt(te, s);
2115
- if (le !== null) {
2116
- v((ye) => ({ ...ye, [c]: le }));
2536
+ const ce = ln(ne, i);
2537
+ if (ce !== null) {
2538
+ g((Ie) => ({ ...Ie, [d]: ce }));
2117
2539
  return;
2118
2540
  }
2119
- m(te.message);
2541
+ p(ne.message);
2120
2542
  }
2121
2543
  }
2122
- async function O(c) {
2544
+ async function F(d) {
2123
2545
  try {
2124
- const T = await it(k, e.id, c, n);
2125
- $((F) => ({ ...F, [c]: T })), M(c), await Q.invalidateQueries({ queryKey: ["data-stores"] });
2126
- } catch (T) {
2127
- m(V(T).message);
2546
+ const A = await vt(T, e.id, d, n);
2547
+ v((q) => ({ ...q, [d]: A })), P(d), await j.invalidateQueries({ queryKey: ["data-stores"] });
2548
+ } catch (A) {
2549
+ p(Y(A).message);
2128
2550
  }
2129
2551
  }
2130
2552
  function G() {
2131
- const c = y;
2132
- D(null), c !== null && (c !== ne && P.mutate({ id: e.id, key: c, project: n }), M(c));
2553
+ const d = C;
2554
+ I(null), d !== null && (d !== ae && D.mutate({ id: e.id, key: d, project: n }), P(d));
2133
2555
  }
2134
- async function ee(c) {
2135
- x(null);
2556
+ async function te(d) {
2557
+ E(null);
2136
2558
  try {
2137
- const T = await H.mutateAsync({ id: e.id, csv: await c.text(), project: n });
2138
- x(Ae({ status: 200, text: JSON.stringify(T) }));
2139
- } catch (T) {
2140
- const F = T;
2141
- x(
2142
- typeof F.status == "number" ? Ae({ status: F.status, text: JSON.stringify(F.raw ?? null) }) : { ok: !1, message: V(T).message }
2559
+ const A = await S.mutateAsync({ id: e.id, csv: await d.text(), project: n });
2560
+ E(je({ status: 200, text: JSON.stringify(A) }));
2561
+ } catch (A) {
2562
+ const q = A;
2563
+ E(
2564
+ typeof q.status == "number" ? je({ status: q.status, text: JSON.stringify(q.raw ?? null) }) : { ok: !1, message: Y(A).message }
2143
2565
  );
2144
2566
  }
2145
2567
  }
2146
- async function de() {
2568
+ async function we() {
2147
2569
  try {
2148
- const c = await I.mutateAsync({ id: e.id, project: n });
2149
- ja(Wt(null, e.name), c), x(null);
2150
- } catch (c) {
2151
- x({ ok: !1, message: V(c).message });
2570
+ const d = await $.mutateAsync({ id: e.id, project: n });
2571
+ cs(nn(null, e.name), d), E(null);
2572
+ } catch (d) {
2573
+ E({ ok: !1, message: Y(d).message });
2152
2574
  }
2153
2575
  }
2154
- return /* @__PURE__ */ r("div", { children: [
2576
+ return /* @__PURE__ */ l("div", { children: [
2155
2577
  /* @__PURE__ */ t(
2156
- jt,
2578
+ Jt,
2157
2579
  {
2158
- result: E,
2159
- busy: I.isPending,
2160
- onImport: ee,
2161
- onRefuse: (c) => x({ ok: !1, message: c }),
2162
- onExport: de
2580
+ result: b,
2581
+ busy: $.isPending,
2582
+ onImport: te,
2583
+ onRefuse: (d) => E({ ok: !1, message: d }),
2584
+ onExport: we
2163
2585
  }
2164
2586
  ),
2165
2587
  /* @__PURE__ */ t(
2166
- Kt,
2588
+ Gt,
2167
2589
  {
2168
- columns: s,
2169
- keyColumn: i,
2170
- rows: S,
2171
- error: g,
2172
- loading: j.isPending,
2173
- hasMore: j.hasNextPage,
2590
+ columns: i,
2591
+ keyColumn: s,
2592
+ rows: K,
2593
+ error: y,
2594
+ loading: O.isPending,
2595
+ hasMore: O.hasNextPage,
2174
2596
  empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No rows match this key prefix." }),
2175
- onCellChange: z,
2176
- onSave: (c) => void C(c),
2177
- onDelete: D,
2178
- onReload: (c) => void O(c),
2597
+ onCellChange: J,
2598
+ onSave: (d) => void L(d),
2599
+ onDelete: I,
2600
+ onReload: (d) => void F(d),
2179
2601
  onAddRow: () => {
2180
- ne in d || (u((c) => ({ ...c, [ne]: Me(s) })), m(null));
2602
+ ae in c || (u((d) => ({ ...d, [ae]: Ke(i) })), p(null));
2181
2603
  },
2182
- onLoadMore: () => void j.fetchNextPage(),
2183
- onSearch: l
2604
+ onLoadMore: () => void O.fetchNextPage(),
2605
+ onSearch: r
2184
2606
  }
2185
2607
  ),
2186
- y !== null && /* @__PURE__ */ t(
2187
- pe,
2608
+ C !== null && /* @__PURE__ */ t(
2609
+ be,
2188
2610
  {
2189
2611
  title: "Delete entry",
2190
- message: y === ne ? "Discard this unsaved row?" : `Delete "${y}"? This cannot be undone.`,
2612
+ message: C === ae ? "Discard this unsaved row?" : `Delete "${C}"? This cannot be undone.`,
2191
2613
  confirmLabel: "Delete",
2192
2614
  onConfirm: G,
2193
- onClose: () => D(null)
2615
+ onClose: () => I(null)
2194
2616
  }
2195
2617
  )
2196
2618
  ] });
2197
2619
  }
2198
- function Fa({ store: e, project: n }) {
2199
- var z;
2200
- const a = e.kind === "doc", s = Ft(e), [i, o] = f(""), [l, d] = f(null), [u, h] = f(!1), [v, w] = f(""), [b, N] = f(""), [$, g] = f(null), [m, y] = f(!1), [D, E] = f({}), [x, k] = f(null), Q = ge(), j = fe(), R = tt(e.id, n, i), A = nt(), P = at(), H = (((z = R.data) == null ? void 0 : z.pages.flatMap((C) => C.items)) ?? []).map(
2201
- (C) => D[C.key] ?? C
2202
- ), I = l === null ? void 0 : H.find((C) => C.key === l), J = u || l !== null, q = (C) => a ? JSON.stringify(C.value ?? null, null, 2) : Yt(s, C.value), S = (C) => {
2203
- const O = q(C).replace(/\s+/g, " ");
2204
- return O.length > Qe ? `${O.slice(0, Qe)}…` : O;
2620
+ function us({ store: e, project: n }) {
2621
+ var J;
2622
+ const a = e.kind === "doc", i = Zt(e), [s, o] = f(""), [r, c] = f(null), [u, h] = f(!1), [g, m] = f(""), [k, w] = f(""), [v, y] = f(null), [p, C] = f(!1), [I, b] = f({}), [E, T] = f(null), j = he(), O = me(), R = ft(e.id, n, s), x = yt(), D = gt(), S = (((J = R.data) == null ? void 0 : J.pages.flatMap((L) => L.items)) ?? []).map(
2623
+ (L) => I[L.key] ?? L
2624
+ ), $ = r === null ? void 0 : S.find((L) => L.key === r), V = u || r !== null, _ = (L) => a ? JSON.stringify(L.value ?? null, null, 2) : cn(i, L.value), K = (L) => {
2625
+ const F = _(L).replace(/\s+/g, " ");
2626
+ return F.length > He ? `${F.slice(0, He)}…` : F;
2205
2627
  };
2206
- function U(C) {
2207
- d(C.key), h(!1), N(q(C)), g(null), y(!1);
2628
+ function H(L) {
2629
+ c(L.key), h(!1), w(_(L)), y(null), C(!1);
2208
2630
  }
2209
- function _() {
2210
- d(null), h(!1), w(""), N(""), g(null), y(!1);
2631
+ function W() {
2632
+ c(null), h(!1), m(""), w(""), y(null), C(!1);
2211
2633
  }
2212
- async function p() {
2213
- g(null), y(!1);
2214
- const C = a ? Ht(b) : Jt(s, b);
2215
- if (!C.ok) {
2216
- g(C.message);
2634
+ async function N() {
2635
+ y(null), C(!1);
2636
+ const L = a ? rn(k) : on(i, k);
2637
+ if (!L.ok) {
2638
+ y(L.message);
2217
2639
  return;
2218
2640
  }
2219
- const O = u ? v.trim() : l;
2220
- if (O === null || O === "") {
2221
- g("Enter a key.");
2641
+ const F = u ? g.trim() : r;
2642
+ if (F === null || F === "") {
2643
+ y("Enter a key.");
2222
2644
  return;
2223
2645
  }
2224
2646
  try {
2225
- await A.mutateAsync({
2647
+ await x.mutateAsync({
2226
2648
  id: e.id,
2227
- key: O,
2228
- value: C.value,
2649
+ key: F,
2650
+ value: L.value,
2229
2651
  // A new entry must not exist yet; an existing one is guarded by the version loaded.
2230
- ifVersion: u ? 0 : (I == null ? void 0 : I.version) ?? 0,
2231
- ttlSeconds: u ? void 0 : Ve((I == null ? void 0 : I.expiresAt) ?? null, Date.now()),
2652
+ ifVersion: u ? 0 : ($ == null ? void 0 : $.version) ?? 0,
2653
+ ttlSeconds: u ? void 0 : Xe(($ == null ? void 0 : $.expiresAt) ?? null, Date.now()),
2232
2654
  project: n
2233
- }), E((G) => ae(G, O)), _();
2655
+ }), b((G) => se(G, F)), W();
2234
2656
  } catch (G) {
2235
- const ee = V(G);
2236
- He(ee) ? y(!0) : g(ee.message);
2657
+ const te = Y(G);
2658
+ et(te) ? C(!0) : y(te.message);
2237
2659
  }
2238
2660
  }
2239
- async function L() {
2240
- if (l !== null)
2661
+ async function M() {
2662
+ if (r !== null)
2241
2663
  try {
2242
- const C = await it(Q, e.id, l, n);
2243
- E((O) => ({ ...O, [l]: C })), N(q(C)), y(!1), g(null), await j.invalidateQueries({ queryKey: ["data-stores"] });
2244
- } catch (C) {
2245
- g(V(C).message);
2664
+ const L = await vt(j, e.id, r, n);
2665
+ b((F) => ({ ...F, [r]: L })), w(_(L)), C(!1), y(null), await O.invalidateQueries({ queryKey: ["data-stores"] });
2666
+ } catch (L) {
2667
+ y(Y(L).message);
2246
2668
  }
2247
2669
  }
2248
- async function M() {
2249
- const C = x;
2250
- if (k(null), C !== null)
2670
+ async function P() {
2671
+ const L = E;
2672
+ if (T(null), L !== null)
2251
2673
  try {
2252
- await P.mutateAsync({ id: e.id, key: C, project: n }), C === l && _();
2253
- } catch (O) {
2254
- g(V(O).message);
2674
+ await D.mutateAsync({ id: e.id, key: L, project: n }), L === r && W();
2675
+ } catch (F) {
2676
+ y(Y(F).message);
2255
2677
  }
2256
2678
  }
2257
- return /* @__PURE__ */ r("div", { children: [
2679
+ return /* @__PURE__ */ l("div", { children: [
2258
2680
  /* @__PURE__ */ t(
2259
- Qt,
2681
+ Xt,
2260
2682
  {
2261
- rows: H.map((C) => ({ key: C.key, version: C.version, preview: S(C) })),
2683
+ rows: S.map((L) => ({ key: L.key, version: L.version, preview: K(L) })),
2262
2684
  loading: R.isPending,
2263
2685
  empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No entries match this key prefix." }),
2264
2686
  hasMore: R.hasNextPage,
2265
- onOpen: (C) => {
2266
- const O = H.find((G) => G.key === C);
2267
- O && U(O);
2687
+ onOpen: (L) => {
2688
+ const F = S.find((G) => G.key === L);
2689
+ F && H(F);
2268
2690
  },
2269
2691
  onSearch: o,
2270
2692
  onNew: () => {
2271
- d(null), h(!0), w(""), N(""), g(null), y(!1);
2693
+ c(null), h(!0), m(""), w(""), y(null), C(!1);
2272
2694
  },
2273
2695
  onLoadMore: () => void R.fetchNextPage()
2274
2696
  }
2275
2697
  ),
2276
- J && /* @__PURE__ */ t(
2277
- qt,
2698
+ V && /* @__PURE__ */ t(
2699
+ en,
2278
2700
  {
2279
2701
  kind: a ? "doc" : "kv",
2280
2702
  isNew: u,
2281
- entryKey: l ?? void 0,
2282
- newKey: v,
2283
- version: (I == null ? void 0 : I.version) ?? null,
2284
- expiresAt: (I == null ? void 0 : I.expiresAt) ?? null,
2285
- text: b,
2286
- error: $,
2287
- conflict: m,
2288
- saving: A.isPending || P.isPending,
2289
- onDelete: u ? void 0 : () => k(l),
2290
- onTextChange: (C) => {
2291
- N(C), g(null);
2703
+ entryKey: r ?? void 0,
2704
+ newKey: g,
2705
+ version: ($ == null ? void 0 : $.version) ?? null,
2706
+ expiresAt: ($ == null ? void 0 : $.expiresAt) ?? null,
2707
+ text: k,
2708
+ error: v,
2709
+ conflict: p,
2710
+ saving: x.isPending || D.isPending,
2711
+ onDelete: u ? void 0 : () => T(r),
2712
+ onTextChange: (L) => {
2713
+ w(L), y(null);
2292
2714
  },
2293
- onKeyChange: w,
2294
- onSave: () => void p(),
2295
- onCancel: _,
2296
- onReload: () => void L()
2715
+ onKeyChange: m,
2716
+ onSave: () => void N(),
2717
+ onCancel: W,
2718
+ onReload: () => void M()
2297
2719
  }
2298
2720
  ),
2299
- x !== null && /* @__PURE__ */ t(
2300
- pe,
2721
+ E !== null && /* @__PURE__ */ t(
2722
+ be,
2301
2723
  {
2302
2724
  title: "Delete entry",
2303
- message: `Delete "${x}"? This cannot be undone.`,
2725
+ message: `Delete "${E}"? This cannot be undone.`,
2304
2726
  confirmLabel: "Delete",
2305
- onConfirm: M,
2306
- onClose: () => k(null)
2727
+ onConfirm: P,
2728
+ onClose: () => T(null)
2307
2729
  }
2308
2730
  )
2309
2731
  ] });
2310
2732
  }
2311
- function ae(e, n) {
2733
+ function se(e, n) {
2312
2734
  if (!(n in e)) return e;
2313
2735
  const a = { ...e };
2314
2736
  return delete a[n], a;
2315
2737
  }
2316
- function xi({ id: e, project: n, slots: a }) {
2317
- const s = X(n), i = Fn(e, s ?? void 0), o = i.data;
2318
- let l;
2319
- s == null ? l = /* @__PURE__ */ t("p", { className: "muted", children: "No project selected." }) : i.isError ? l = /* @__PURE__ */ t("p", { className: "result error", children: V(i.error).message }) : o === void 0 ? l = /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : o.kind === "table" ? l = /* @__PURE__ */ t(Ka, { store: o, project: s }, o.id) : l = /* @__PURE__ */ t(Fa, { store: o, project: s }, o.id);
2320
- const d = (a == null ? void 0 : a.header) === void 0 ? o && /* @__PURE__ */ r("div", { children: [
2738
+ function ti({ id: e, project: n, slots: a }) {
2739
+ const i = X(n), s = ea(e, i ?? void 0), o = s.data;
2740
+ let r;
2741
+ i == null ? r = /* @__PURE__ */ t("p", { className: "muted", children: "No project selected." }) : s.isError ? r = /* @__PURE__ */ t("p", { className: "result error", children: Y(s.error).message }) : o === void 0 ? r = /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : o.kind === "table" ? r = /* @__PURE__ */ t(ds, { store: o, project: i }, o.id) : r = /* @__PURE__ */ t(us, { store: o, project: i }, o.id);
2742
+ const c = (a == null ? void 0 : a.header) === void 0 ? o && /* @__PURE__ */ l("div", { children: [
2321
2743
  /* @__PURE__ */ t("h3", { children: o.name }),
2322
- /* @__PURE__ */ r("p", { className: "muted small", children: [
2744
+ /* @__PURE__ */ l("p", { className: "muted small", children: [
2323
2745
  o.kind,
2324
2746
  " · ",
2325
2747
  o.entryCount,
@@ -2327,44 +2749,44 @@ function xi({ id: e, project: n, slots: a }) {
2327
2749
  o.entryCount === 1 ? "entry" : "entries"
2328
2750
  ] })
2329
2751
  ] }) : a.header;
2330
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
2331
- d,
2332
- l
2752
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
2753
+ c,
2754
+ r
2333
2755
  ] }) });
2334
2756
  }
2335
- const Qa = ["name", "kind", "description", "schema"];
2336
- function qa(e) {
2337
- const [n, a] = f(""), [s, i] = f(""), [o, l] = f("kv"), [d, u] = f("string"), [h, v] = f([]), [w, b] = f(""), [N, $] = f({}), [g, m] = f({}), [y, D] = f(null), E = Un();
2338
- function x() {
2339
- $({}), m({}), D(null);
2340
- const k = {
2757
+ const ms = ["name", "kind", "description", "schema"];
2758
+ function hs(e) {
2759
+ const [n, a] = f(""), [i, s] = f(""), [o, r] = f("kv"), [c, u] = f("string"), [h, g] = f([]), [m, k] = f(""), [w, v] = f({}), [y, p] = f({}), [C, I] = f(null), b = la();
2760
+ function E() {
2761
+ v({}), p({}), I(null);
2762
+ const T = {
2341
2763
  kind: o,
2342
2764
  name: n
2343
2765
  };
2344
- o === "kv" && (k.schema = { valueType: d }), o === "table" && (k.schema = w === "" ? { columns: h } : { columns: h, key: w }), s !== "" && (k.description = s), E.mutate(
2766
+ o === "kv" && (T.schema = { valueType: c }), o === "table" && (T.schema = m === "" ? { columns: h } : { columns: h, key: m }), i !== "" && (T.description = i), b.mutate(
2345
2767
  // The SDK's create body types `schema` as table columns only; the wire takes the S-2 shape
2346
2768
  // per kind, so the kv `{valueType}` schema is passed through as the host defines it.
2347
- { input: k, project: e.project },
2769
+ { input: T, project: e.project },
2348
2770
  {
2349
2771
  onSuccess: () => e.onClose(),
2350
- onError: (Q) => {
2351
- const j = V(Q), R = tn(j);
2352
- if (R.kind === "cell" && h.some((A) => A.name === R.column)) {
2353
- m({ [R.column]: j.message });
2772
+ onError: (j) => {
2773
+ const O = Y(j), R = pn(O);
2774
+ if (R.kind === "cell" && h.some((x) => x.name === R.column)) {
2775
+ p({ [R.column]: O.message });
2354
2776
  return;
2355
2777
  }
2356
- if (R.kind === "field" && Qa.includes(R.field)) {
2357
- $({ [R.field]: j.message });
2778
+ if (R.kind === "field" && ms.includes(R.field)) {
2779
+ v({ [R.field]: O.message });
2358
2780
  return;
2359
2781
  }
2360
- D(j.message);
2782
+ I(O.message);
2361
2783
  }
2362
2784
  }
2363
2785
  );
2364
2786
  }
2365
- return /* @__PURE__ */ r(fn, { title: "New data store", onClose: e.onClose, children: [
2366
- /* @__PURE__ */ r("div", { className: "modal-body", children: [
2367
- /* @__PURE__ */ r("label", { className: "field", children: [
2787
+ return /* @__PURE__ */ l(Ln, { title: "New data store", onClose: e.onClose, children: [
2788
+ /* @__PURE__ */ l("div", { className: "modal-body", children: [
2789
+ /* @__PURE__ */ l("label", { className: "field", children: [
2368
2790
  /* @__PURE__ */ t("span", { children: "Name" }),
2369
2791
  /* @__PURE__ */ t(
2370
2792
  "input",
@@ -2372,58 +2794,58 @@ function qa(e) {
2372
2794
  type: "text",
2373
2795
  "data-testid": "data-store-name",
2374
2796
  value: n,
2375
- onChange: (k) => a(k.target.value),
2797
+ onChange: (T) => a(T.target.value),
2376
2798
  placeholder: "e.g. counters"
2377
2799
  }
2378
2800
  )
2379
2801
  ] }),
2380
- N.name !== void 0 && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-field-error-name", children: N.name }),
2381
- /* @__PURE__ */ r("label", { className: "field", children: [
2802
+ w.name !== void 0 && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-field-error-name", children: w.name }),
2803
+ /* @__PURE__ */ l("label", { className: "field", children: [
2382
2804
  /* @__PURE__ */ t("span", { children: "Description" }),
2383
2805
  /* @__PURE__ */ t(
2384
2806
  "input",
2385
2807
  {
2386
2808
  type: "text",
2387
- value: s,
2388
- onChange: (k) => i(k.target.value),
2809
+ value: i,
2810
+ onChange: (T) => s(T.target.value),
2389
2811
  placeholder: "What this store holds"
2390
2812
  }
2391
2813
  )
2392
2814
  ] }),
2393
- /* @__PURE__ */ r("label", { className: "field", children: [
2815
+ /* @__PURE__ */ l("label", { className: "field", children: [
2394
2816
  /* @__PURE__ */ t("span", { children: "Kind" }),
2395
2817
  /* @__PURE__ */ t(
2396
2818
  "select",
2397
2819
  {
2398
2820
  "data-testid": "data-store-kind",
2399
2821
  value: o,
2400
- onChange: (k) => {
2401
- l(k.target.value), b("");
2822
+ onChange: (T) => {
2823
+ r(T.target.value), k("");
2402
2824
  },
2403
- children: Gt.map((k) => /* @__PURE__ */ t("option", { value: k, children: Zt[k] }, k))
2825
+ children: un.map((T) => /* @__PURE__ */ t("option", { value: T, children: mn[T] }, T))
2404
2826
  }
2405
2827
  ),
2406
2828
  /* @__PURE__ */ t("span", { className: "hint", children: "The kind is fixed once the store exists." })
2407
2829
  ] }),
2408
- N.kind !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: N.kind }),
2409
- o === "kv" && /* @__PURE__ */ r("label", { className: "field", children: [
2830
+ w.kind !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: w.kind }),
2831
+ o === "kv" && /* @__PURE__ */ l("label", { className: "field", children: [
2410
2832
  /* @__PURE__ */ t("span", { children: "Value type" }),
2411
- /* @__PURE__ */ t("select", { value: d, onChange: (k) => u(k.target.value), children: Xt.map((k) => /* @__PURE__ */ t("option", { value: k, children: k }, k)) })
2833
+ /* @__PURE__ */ t("select", { value: c, onChange: (T) => u(T.target.value), children: hn.map((T) => /* @__PURE__ */ t("option", { value: T, children: T }, T)) })
2412
2834
  ] }),
2413
2835
  o === "table" && /* @__PURE__ */ t(
2414
- en,
2836
+ wn,
2415
2837
  {
2416
2838
  columns: h,
2417
- onChange: v,
2418
- keyColumn: w,
2419
- onKeyColumnChange: b,
2420
- columnErrors: g
2839
+ onChange: g,
2840
+ keyColumn: m,
2841
+ onKeyColumnChange: k,
2842
+ columnErrors: y
2421
2843
  }
2422
2844
  ),
2423
- N.schema !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: N.schema }),
2424
- y !== null && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-form-error", children: y })
2845
+ w.schema !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: w.schema }),
2846
+ C !== null && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-form-error", children: C })
2425
2847
  ] }),
2426
- /* @__PURE__ */ r("div", { className: "modal-actions", children: [
2848
+ /* @__PURE__ */ l("div", { className: "modal-actions", children: [
2427
2849
  /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
2428
2850
  /* @__PURE__ */ t(
2429
2851
  "button",
@@ -2431,87 +2853,88 @@ function qa(e) {
2431
2853
  type: "button",
2432
2854
  className: "btn",
2433
2855
  "data-testid": "data-store-create",
2434
- disabled: E.isPending,
2435
- onClick: x,
2436
- children: E.isPending ? "Creating…" : "Create"
2856
+ disabled: b.isPending,
2857
+ onClick: E,
2858
+ children: b.isPending ? "Creating…" : "Create"
2437
2859
  }
2438
2860
  )
2439
2861
  ] })
2440
2862
  ] });
2441
2863
  }
2442
- function Li({ project: e, onOpen: n, getHref: a, slots: s }) {
2443
- const i = X(e), o = Wn(i ?? void 0), l = Bn(), [d, u] = f(!1), [h, v] = f(null), [w, b] = f(null), N = (s == null ? void 0 : s.header) === void 0 ? /* @__PURE__ */ r("div", { children: [
2864
+ function ni({ project: e, onOpen: n, getHref: a, slots: i }) {
2865
+ const s = X(e), o = sa(s ?? void 0), r = ia(), [c, u] = f(!1), [h, g] = f(null), [m, k] = f(null), w = (i == null ? void 0 : i.header) === void 0 ? /* @__PURE__ */ l("div", { children: [
2444
2866
  /* @__PURE__ */ t("h3", { children: "Data stores" }),
2445
2867
  /* @__PURE__ */ t("p", { className: "muted small", children: "Key-value, document and table storage for this project." })
2446
- ] }) : s.header;
2447
- return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
2868
+ ] }) : i.header;
2869
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
2448
2870
  /* @__PURE__ */ t(
2449
- zt,
2871
+ dn,
2450
2872
  {
2451
2873
  stores: o.data ?? [],
2452
2874
  loading: o.isLoading,
2453
- error: w ?? (o.error != null ? V(o.error).message : null),
2875
+ error: m ?? (o.error != null ? Y(o.error).message : null),
2454
2876
  onOpen: n,
2455
2877
  getHref: a,
2456
- onArchive: ($) => {
2457
- b(null), v($);
2878
+ onArchive: (v) => {
2879
+ k(null), g(v);
2458
2880
  },
2459
- busy: l.isPending,
2881
+ busy: r.isPending,
2460
2882
  slots: {
2461
- header: N,
2883
+ header: w,
2462
2884
  actions: /* @__PURE__ */ t(
2463
2885
  "button",
2464
2886
  {
2465
2887
  type: "button",
2466
2888
  className: "btn",
2467
2889
  "data-testid": "data-store-new",
2468
- disabled: i == null,
2890
+ disabled: s == null,
2469
2891
  onClick: () => u(!0),
2470
2892
  children: "+ New data store"
2471
2893
  }
2472
2894
  ),
2473
- empty: s == null ? void 0 : s.empty
2895
+ empty: i == null ? void 0 : i.empty
2474
2896
  }
2475
2897
  }
2476
2898
  ),
2477
- d && i != null && /* @__PURE__ */ t(qa, { project: i, onClose: () => u(!1) }),
2899
+ c && s != null && /* @__PURE__ */ t(hs, { project: s, onClose: () => u(!1) }),
2478
2900
  h && /* @__PURE__ */ t(
2479
- pe,
2901
+ be,
2480
2902
  {
2481
2903
  title: "Archive data store",
2482
2904
  message: `Archive "${h.name}" and its ${h.entryCount} ${h.entryCount === 1 ? "entry" : "entries"}? Workflows and the API can no longer reach it.`,
2483
2905
  confirmLabel: "Archive",
2484
2906
  onConfirm: () => {
2485
- const $ = h;
2486
- v(null), i != null && l.mutate(
2487
- { id: $.id, project: i },
2488
- { onError: (g) => b(V(g).message) }
2907
+ const v = h;
2908
+ g(null), s != null && r.mutate(
2909
+ { id: v.id, project: s },
2910
+ { onError: (y) => k(Y(y).message) }
2489
2911
  );
2490
2912
  },
2491
- onClose: () => v(null)
2913
+ onClose: () => g(null)
2492
2914
  }
2493
2915
  )
2494
2916
  ] });
2495
2917
  }
2496
2918
  export {
2497
- gi as ActivitySummary,
2498
- bi as ConnectionDetail,
2499
- Ni as ConnectionList,
2500
- $i as CredentialCreate,
2501
- Di as CredentialDetail,
2502
- Ti as CredentialList,
2503
- Li as DataStoreList,
2504
- xi as DataStoreView,
2505
- fi as DocumentList,
2506
- hi as EndpointList,
2507
- mi as FunctionList,
2508
- ia as Logs,
2509
- yi as LogsView,
2510
- ki as ModelCatalog,
2511
- Ci as ModelUsage,
2512
- pi as ReliabilityBoard,
2513
- aa as RunHistory,
2514
- vi as ServiceDetail,
2515
- wi as WorkflowList
2919
+ Ws as ActivitySummary,
2920
+ Ys as ConnectionDetail,
2921
+ Hs as ConnectionList,
2922
+ Zs as CredentialCreate,
2923
+ Xs as CredentialDetail,
2924
+ Gs as CredentialList,
2925
+ ni as DataStoreList,
2926
+ ti as DataStoreView,
2927
+ Vs as DocumentList,
2928
+ Qs as EndpointList,
2929
+ Fs as FunctionList,
2930
+ va as Logs,
2931
+ Bs as LogsView,
2932
+ zs as ModelCatalog,
2933
+ Js as ModelUsage,
2934
+ ei as MyAiKeys,
2935
+ qs as ReliabilityBoard,
2936
+ ga as RunHistory,
2937
+ Us as ServiceDetail,
2938
+ _s as WorkflowList
2516
2939
  };
2517
2940
  //# sourceMappingURL=lists.mjs.map