@w6w/embed 0.2.27 → 0.2.28

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