@w6w/embed 0.2.11 → 0.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +22 -5
  2. package/dist/ConfirmModal-Pv2-A_3U.js +186 -0
  3. package/dist/ConfirmModal-Pv2-A_3U.js.map +1 -0
  4. package/dist/{CreateFunctionModal-D6CQLpa_.js → CreateFunctionModal-DScxp_LN.js} +2 -2
  5. package/dist/{CreateFunctionModal-D6CQLpa_.js.map → CreateFunctionModal-DScxp_LN.js.map} +1 -1
  6. package/dist/{DocumentFormModal-YauVdolr.js → DocumentFormModal-Br4s8wmi.js} +3 -3
  7. package/dist/{DocumentFormModal-YauVdolr.js.map → DocumentFormModal-Br4s8wmi.js.map} +1 -1
  8. package/dist/ImportSpecModal-Cpzp8ndt.js +251 -0
  9. package/dist/ImportSpecModal-Cpzp8ndt.js.map +1 -0
  10. package/dist/{ModelRoutesManager-BGESQahw.js → ModelRoutesManager-1Ac5wcas.js} +3 -3
  11. package/dist/{ModelRoutesManager-BGESQahw.js.map → ModelRoutesManager-1Ac5wcas.js.map} +1 -1
  12. package/dist/WorkflowEditor-CmhXHRxi.js +1109 -0
  13. package/dist/WorkflowEditor-CmhXHRxi.js.map +1 -0
  14. package/dist/apps-ItBvnWX3.js +92 -0
  15. package/dist/apps-ItBvnWX3.js.map +1 -0
  16. package/dist/chrome/DangerZone.d.ts +4 -3
  17. package/dist/chrome/ExecutionProfileHeader.d.ts +3 -3
  18. package/dist/chrome/JsonToggle.d.ts +29 -20
  19. package/dist/chrome/Modal.d.ts +3 -1
  20. package/dist/chrome/RightRail.d.ts +6 -1
  21. package/dist/chrome/VersionHistoryModal.d.ts +2 -0
  22. package/dist/chrome/index.d.ts +1 -0
  23. package/dist/chrome/workspace.d.ts +32 -1
  24. package/dist/{coerce-input-DttlcSdO.js → coerce-input-DFJ4n_wc.js} +68 -69
  25. package/dist/coerce-input-DFJ4n_wc.js.map +1 -0
  26. package/dist/{connections-D7cgXhDS.js → connections-CzsCyIxY.js} +10 -10
  27. package/dist/{connections-D7cgXhDS.js.map → connections-CzsCyIxY.js.map} +1 -1
  28. package/dist/{credentials-DaQU3Ca_.js → credentials-Cn92LGhJ.js} +4 -4
  29. package/dist/{credentials-DaQU3Ca_.js.map → credentials-Cn92LGhJ.js.map} +1 -1
  30. package/dist/data-stores-UeQvwVCa.js +170 -0
  31. package/dist/data-stores-UeQvwVCa.js.map +1 -0
  32. package/dist/document-sources-DNmBojx6.js +169 -0
  33. package/dist/document-sources-DNmBojx6.js.map +1 -0
  34. package/dist/draft/use-workflow-draft.d.ts +2 -0
  35. package/dist/draft.mjs +2 -2
  36. package/dist/editor/PublishTooltip.d.ts +7 -0
  37. package/dist/editor/SetupIncompleteBanner.d.ts +12 -0
  38. package/dist/editor/StartingStateModal.d.ts +14 -0
  39. package/dist/editor/WorkflowSettingsModal.d.ts +6 -1
  40. package/dist/editor/WorkflowVariablesEditor.d.ts +6 -0
  41. package/dist/editor/definition.d.ts +4 -0
  42. package/dist/editor/json-apply.d.ts +29 -0
  43. package/dist/editor/step-problems-feed.d.ts +5 -0
  44. package/dist/editor/types.d.ts +2 -2
  45. package/dist/editor-apps-DkkC7wOQ.js +152 -0
  46. package/dist/editor-apps-DkkC7wOQ.js.map +1 -0
  47. package/dist/editor-tools-BR27RGto.js +1683 -0
  48. package/dist/editor-tools-BR27RGto.js.map +1 -0
  49. package/dist/editor.mjs +1 -1
  50. package/dist/editors.mjs +536 -478
  51. package/dist/editors.mjs.map +1 -1
  52. package/dist/forms.mjs +3 -3
  53. package/dist/{rail-settings-XYGToh00.js → import-bindings-EUtxZ9Ti.js} +90 -24
  54. package/dist/import-bindings-EUtxZ9Ti.js.map +1 -0
  55. package/dist/index.mjs +138 -108
  56. package/dist/index.mjs.map +1 -1
  57. package/dist/lib/binding-problems.d.ts +5 -1
  58. package/dist/lib/history-query.d.ts +45 -0
  59. package/dist/lib/import-bindings.d.ts +89 -0
  60. package/dist/lib/index.d.ts +3 -0
  61. package/dist/lib/rail-settings.d.ts +1 -1
  62. package/dist/lib/setup-incomplete.d.ts +22 -0
  63. package/dist/lib/starting-data.d.ts +31 -0
  64. package/dist/lib/state-panel.d.ts +29 -0
  65. package/dist/lib/target-fields.d.ts +3 -15
  66. package/dist/lib/workflow-live-run.d.ts +84 -6
  67. package/dist/lib/workflow-validity.d.ts +64 -16
  68. package/dist/lib/workflow-variables.d.ts +1 -1
  69. package/dist/lib/workflow-version.d.ts +2 -0
  70. package/dist/lib.mjs +87 -72
  71. package/dist/lists/DataStoreList.d.ts +17 -0
  72. package/dist/lists/DataStoreView.d.ts +19 -0
  73. package/dist/lists/Logs.d.ts +19 -0
  74. package/dist/lists.d.ts +6 -0
  75. package/dist/lists.mjs +1255 -816
  76. package/dist/lists.mjs.map +1 -1
  77. package/dist/rail/ConnectionsTool.d.ts +2 -0
  78. package/dist/rail/HistoryTool.d.ts +2 -0
  79. package/dist/rail/StartingStateTool.d.ts +2 -0
  80. package/dist/rail/settings-sections.d.ts +4 -1
  81. package/dist/rail.mjs +1 -1
  82. package/dist/repos/connections.d.ts +1 -0
  83. package/dist/repos/constants.d.ts +12 -0
  84. package/dist/repos/data-stores.d.ts +84 -0
  85. package/dist/repos/history.d.ts +9 -0
  86. package/dist/repos/index.d.ts +2 -0
  87. package/dist/repos/spec-export.d.ts +3 -3
  88. package/dist/repos/spec-import.d.ts +30 -1
  89. package/dist/repos/step-tests.d.ts +2 -0
  90. package/dist/repos/webhook-listen.d.ts +35 -0
  91. package/dist/repos/workflows.d.ts +105 -2
  92. package/dist/repos.mjs +370 -328
  93. package/dist/repos.mjs.map +1 -1
  94. package/dist/setup-incomplete-BHs3Lpfy.js +199 -0
  95. package/dist/setup-incomplete-BHs3Lpfy.js.map +1 -0
  96. package/dist/{spec-export-CBbloO_n.js → spec-export-DGy5ijps.js} +72 -59
  97. package/dist/spec-export-DGy5ijps.js.map +1 -0
  98. package/dist/spec-import-SWOonsNr.js +116 -0
  99. package/dist/spec-import-SWOonsNr.js.map +1 -0
  100. package/dist/{step-tests-CivICmTq.js → step-tests-B4E4W3ly.js} +8 -7
  101. package/dist/step-tests-B4E4W3ly.js.map +1 -0
  102. package/dist/{use-callable-draft-DsALnSfF.js → use-callable-draft-DCauHt5o.js} +2 -2
  103. package/dist/{use-callable-draft-DsALnSfF.js.map → use-callable-draft-DCauHt5o.js.map} +1 -1
  104. package/dist/use-workflow-draft-l3P5KZzw.js +338 -0
  105. package/dist/use-workflow-draft-l3P5KZzw.js.map +1 -0
  106. package/dist/workflows-BZN4Hyz1.js +623 -0
  107. package/dist/workflows-BZN4Hyz1.js.map +1 -0
  108. package/package.json +4 -3
  109. package/src/styles.css +153 -1
  110. package/dist/ConfirmModal-BE-SdX-O.js +0 -185
  111. package/dist/ConfirmModal-BE-SdX-O.js.map +0 -1
  112. package/dist/ImportSpecModal-B7qd1Km2.js +0 -136
  113. package/dist/ImportSpecModal-B7qd1Km2.js.map +0 -1
  114. package/dist/WorkflowEditor-CwvmAGp2.js +0 -925
  115. package/dist/WorkflowEditor-CwvmAGp2.js.map +0 -1
  116. package/dist/apps-CboASBKr.js +0 -77
  117. package/dist/apps-CboASBKr.js.map +0 -1
  118. package/dist/coerce-input-DttlcSdO.js.map +0 -1
  119. package/dist/document-sources-UCwe8x77.js +0 -91
  120. package/dist/document-sources-UCwe8x77.js.map +0 -1
  121. package/dist/editor-apps-BUZWld-m.js +0 -95
  122. package/dist/editor-apps-BUZWld-m.js.map +0 -1
  123. package/dist/editor-tools-B_Lfx3kw.js +0 -1279
  124. package/dist/editor-tools-B_Lfx3kw.js.map +0 -1
  125. package/dist/rail-settings-XYGToh00.js.map +0 -1
  126. package/dist/spec-export-CBbloO_n.js.map +0 -1
  127. package/dist/spec-import-CW6R_Wk1.js +0 -469
  128. package/dist/spec-import-CW6R_Wk1.js.map +0 -1
  129. package/dist/step-tests-CivICmTq.js.map +0 -1
  130. package/dist/trigger-preview-DKxfjzUY.js +0 -145
  131. package/dist/trigger-preview-DKxfjzUY.js.map +0 -1
  132. package/dist/use-workflow-draft-DzAyUeA6.js +0 -316
  133. package/dist/use-workflow-draft-DzAyUeA6.js.map +0 -1
package/dist/lists.mjs CHANGED
@@ -1,83 +1,85 @@
1
1
  "use client";
2
- import { jsxs as l, jsx as t, Fragment as D } from "react/jsx-runtime";
3
- import { useState as C, useMemo as K, useEffect as Oe } from "react";
4
- import { F as qe, E as Fe } from "./CreateFunctionModal-D6CQLpa_.js";
5
- import { d as Ke, f as Qe, h as Be, b as pe, n as ae, u as We, m as _e } from "./endpoints-DSRo1Lc5.js";
6
- import { u as q, b as ie } from "./project-context-Tvp-La7A.js";
7
- import { CallableList as He, ReliabilityList as Ue, EmptyState as se, DataTable as le, EditButton as fe, DeleteButton as Ve, ListItem as te, HealthStatusPill as Z, HistoryTimeline as Ye, useW6WApi as ge, connectionAppIdsToLookUp as Ne, ConnectionList as Ze, AddConnectionModal as Je, EditConnectionModal as ye, Modal as ze, resolveConnectionAppMeta as Ge, ConnectionHeader as Xe, IconButton as et } from "@w6w/ui";
8
- import { I as tt } from "./ImportSpecModal-B7qd1Km2.js";
9
- import { i as nt } from "./rail-settings-XYGToh00.js";
10
- import { $ as at, Z as be, L as it, P as st, M as lt, E as rt } from "./spec-import-CW6R_Wk1.js";
11
- import { b as ot } from "./workflow-blank-DFpGObrn.js";
12
- import { f as ct, e as ce, g as dt, b as ut, h as mt, i as ht } from "./api-calls--JHyif6a.js";
13
- import { C as wt, a as pt } from "./ConfirmModal-BE-SdX-O.js";
14
- import { D as ft } from "./DocumentFormModal-YauVdolr.js";
15
- import { H as gt, u as ve } from "./editor-apps-BUZWld-m.js";
16
- import { ApiError as ke } from "@w6w/sdk";
17
- import { useQueryClient as Ce, useInfiniteQuery as $e } from "@tanstack/react-query";
18
- import { u as Nt, o as yt, k as Ie, c as ne, d as Te, m as bt, p as vt } from "./connections-D7cgXhDS.js";
19
- import { M as kt } from "./ModelRoutesManager-BGESQahw.js";
20
- import { h as Ct } from "./apps-CboASBKr.js";
21
- import { u as Le } from "./client-context-CX61Bgw-.js";
22
- import { p as $t, v as It, n as Tt, y as Lt } from "./models-bAayQPJ_.js";
23
- import { n as Mt, m as Dt, k as xt, p as At, q as Rt, v as Et, o as jt } from "./credentials-DaQU3Ca_.js";
24
- function re(e) {
25
- const { kind: n } = e, i = Ke(n), [s, a] = C(!1), o = (e.rows ?? []).map((r) => ({
26
- ...e.toRow(r),
27
- id: r.id,
28
- archived: nt(r)
2
+ import { jsxs as r, jsx as t, Fragment as Q } from "react/jsx-runtime";
3
+ import { useState as f, useMemo as ae, useEffect as ut } from "react";
4
+ import { F as mt, E as ht } from "./CreateFunctionModal-DScxp_LN.js";
5
+ import { d as wt, f as pt, h as ft, b as Ke, n as ke, u as gt, m as yt } from "./endpoints-DSRo1Lc5.js";
6
+ import { u as G, b as Ce } from "./project-context-Tvp-La7A.js";
7
+ import { CallableList as vt, ReliabilityList as Nt, EmptyState as De, DataTable as $e, EditButton as Qe, DeleteButton as bt, ListItem as Ne, HealthStatusPill as ue, HistoryTimeline as kt, useW6WApi as Fe, connectionAppIdsToLookUp as qe, ConnectionList as Ct, AddConnectionModal as Dt, EditConnectionModal as _e, Modal as $t, resolveConnectionAppMeta as Tt, ConnectionHeader as Lt, IconButton as Mt, locateDataStoreError as It, tableSchemaOf as xt, draftFromEntry as ce, CsvPanel as Et, DataTableGrid as At, NEW_ROW_ID as te, newRowDraft as Ie, kvValueTypeOf as Rt, DataEntryList as St, DataEntryEditor as Pt, dirtyColumns as Ot, csvFilenameOf as jt, csvImportMessage as xe, buildRowValue as Kt, rowWriteOf as Qt, remainingTtlSeconds as We, isVersionConflict as Be, cellErrorsOf as Ft, parseDocText as qt, kvValueOf as _t, serializeCell as Wt, DataStoreList as Bt, DATA_STORE_KINDS as Ut, DATA_STORE_KIND_LABEL as Vt, SCALAR_TYPES as Ht, ColumnsEditor as Jt, errorPlacement as Yt } from "@w6w/ui";
8
+ import { I as zt } from "./ImportSpecModal-Cpzp8ndt.js";
9
+ import { i as Zt } from "./import-bindings-EUtxZ9Ti.js";
10
+ import { a3 as Gt, a1 as Ue, T as Xt, E as en } from "./workflows-BZN4Hyz1.js";
11
+ import { b as tn } from "./workflow-blank-DFpGObrn.js";
12
+ import { f as nn, e as Ee, g as an, b as sn, h as rn, i as ln } from "./api-calls--JHyif6a.js";
13
+ import { C as he, a as on, M as cn } from "./ConfirmModal-Pv2-A_3U.js";
14
+ import { D as dn } from "./DocumentFormModal-Br4s8wmi.js";
15
+ import { k as un, i as mn } from "./spec-import-SWOonsNr.js";
16
+ import { H as hn, a as Ve } from "./editor-apps-DkkC7wOQ.js";
17
+ import { ApiError as He } from "@w6w/sdk";
18
+ import { useQueryClient as we, useInfiniteQuery as Je } from "@tanstack/react-query";
19
+ import { u as wn, o as pn, k as Ye, c as be, b as ze, m as fn, p as gn } from "./connections-CzsCyIxY.js";
20
+ import { M as yn } from "./ModelRoutesManager-1Ac5wcas.js";
21
+ import { j as vn } from "./apps-ItBvnWX3.js";
22
+ import { u as pe } from "./client-context-CX61Bgw-.js";
23
+ import { p as Nn, v as bn, n as kn, y as Cn } from "./models-bAayQPJ_.js";
24
+ import { n as Dn, m as $n, k as Tn, p as Ln, q as Mn, v as In, o as xn } from "./credentials-Cn92LGhJ.js";
25
+ import { h as En, k as Ze, p as Ge, o as An, j as Xe, n as Rn, m as Sn, g as et, i as Pn, u as On, f as jn } from "./data-stores-UeQvwVCa.js";
26
+ function Te(e) {
27
+ const { kind: n } = e, a = wt(n), [s, i] = f(!1), o = (e.rows ?? []).map((l) => ({
28
+ ...e.toRow(l),
29
+ id: l.id,
30
+ archived: Zt(l)
29
31
  }));
30
- return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
32
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
31
33
  /* @__PURE__ */ t(
32
- He,
34
+ vt,
33
35
  {
34
36
  rows: o,
35
- title: i.listTitle,
36
- description: i.listDescription,
37
- emptyCopy: i.emptyCopy,
38
- newLabel: i.newLabel,
39
- openRowTitle: i.openRowTitle,
37
+ title: a.listTitle,
38
+ description: a.listDescription,
39
+ emptyCopy: a.emptyCopy,
40
+ newLabel: a.newLabel,
41
+ openRowTitle: a.openRowTitle,
40
42
  testIds: {
41
- showArchived: i.showArchivedTestId,
42
- importOpen: i.importOpenTestId,
43
- archivedBadge: i.archivedBadgeTestId
43
+ showArchived: a.showArchivedTestId,
44
+ importOpen: a.importOpenTestId,
45
+ archivedBadge: a.archivedBadgeTestId
44
46
  },
45
47
  loading: e.loading,
46
48
  error: e.error,
47
49
  onCreate: e.onCreate,
48
50
  creating: e.creating,
49
- onImport: () => a(!0),
51
+ onImport: () => i(!0),
50
52
  onOpen: e.onOpen,
51
53
  getHref: e.getHref,
52
54
  slots: e.slots
53
55
  }
54
56
  ),
55
57
  s && /* @__PURE__ */ t(
56
- tt,
58
+ zt,
57
59
  {
58
60
  kind: n,
59
61
  project: e.project ?? void 0,
60
- listKeys: { functionsKey: Be, endpointsKey: Qe, workflowsKey: at },
61
- onOpenImported: (r, c) => {
62
- var h;
63
- return (h = e.onOpen) == null ? void 0 : h.call(e, c);
62
+ listKeys: { functionsKey: ft, endpointsKey: pt, workflowsKey: Gt },
63
+ onOpenImported: (l, c) => {
64
+ var m;
65
+ return (m = e.onOpen) == null ? void 0 : m.call(e, c);
64
66
  },
65
- onClose: () => a(!1)
67
+ onClose: () => i(!1)
66
68
  }
67
69
  ),
68
70
  e.children
69
71
  ] });
70
72
  }
71
- function Un(e) {
72
- const n = pe(), i = q(e.project), [s, a] = C(null);
73
+ function ai(e) {
74
+ const n = Ke(), a = G(e.project), [s, i] = f(null);
73
75
  return /* @__PURE__ */ t(
74
- re,
76
+ Te,
75
77
  {
76
78
  kind: "function",
77
79
  rows: n.data,
78
80
  loading: n.isLoading,
79
81
  error: n.error ? String(n.error) : null,
80
- project: i,
82
+ project: a,
81
83
  toRow: (o) => ({
82
84
  title: o.displayName || o.key,
83
85
  description: o.description,
@@ -85,39 +87,39 @@ function Un(e) {
85
87
  }),
86
88
  onOpen: e.onOpen,
87
89
  getHref: e.getHref,
88
- onCreate: () => a(ae("function")),
90
+ onCreate: () => i(ke("function")),
89
91
  slots: e.slots,
90
92
  children: s !== null && /* @__PURE__ */ t(
91
- qe,
93
+ mt,
92
94
  {
93
95
  newId: s,
94
96
  takenKeys: (n.data ?? []).map((o) => o.key),
95
- onClose: () => a(null),
97
+ onClose: () => i(null),
96
98
  onCreated: (o) => {
97
- var r;
98
- a(null), (r = e.onCreated) == null || r.call(e, o);
99
+ var l;
100
+ i(null), (l = e.onCreated) == null || l.call(e, o);
99
101
  }
100
102
  }
101
103
  )
102
104
  }
103
105
  );
104
106
  }
105
- function Vn(e) {
106
- const n = We(), i = q(e.project), [s, a] = C(null);
107
+ function ii(e) {
108
+ const n = gt(), a = G(e.project), [s, i] = f(null);
107
109
  return /* @__PURE__ */ t(
108
- re,
110
+ Te,
109
111
  {
110
112
  kind: "endpoint",
111
113
  rows: n.data,
112
114
  loading: n.isLoading,
113
115
  error: n.error ? String(n.error) : null,
114
- project: i,
116
+ project: a,
115
117
  toRow: (o) => ({
116
118
  // The draft tag sits INSIDE the title, after the name: ui `ListItem` puts `badges` in
117
119
  // a trailing `margin-left: auto` slot, which would strand it at the row's far edge.
118
- title: /* @__PURE__ */ l(D, { children: [
120
+ title: /* @__PURE__ */ r(Q, { children: [
119
121
  /* @__PURE__ */ t("strong", { children: o.displayName || o.key }),
120
- _e(o) ? /* @__PURE__ */ t(
122
+ yt(o) ? /* @__PURE__ */ t(
121
123
  "span",
122
124
  {
123
125
  className: "tag warn",
@@ -131,55 +133,55 @@ function Vn(e) {
131
133
  }),
132
134
  onOpen: e.onOpen,
133
135
  getHref: e.getHref,
134
- onCreate: () => a(ae("endpoint")),
136
+ onCreate: () => i(ke("endpoint")),
135
137
  slots: e.slots,
136
138
  children: s !== null && /* @__PURE__ */ t(
137
- Fe,
139
+ ht,
138
140
  {
139
141
  newId: s,
140
142
  takenKeys: (n.data ?? []).map((o) => o.key),
141
- onClose: () => a(null),
143
+ onClose: () => i(null),
142
144
  onCreated: (o) => {
143
- var r;
144
- a(null), (r = e.onCreated) == null || r.call(e, o);
145
+ var l;
146
+ i(null), (l = e.onCreated) == null || l.call(e, o);
145
147
  }
146
148
  }
147
149
  )
148
150
  }
149
151
  );
150
152
  }
151
- function Yn(e) {
152
- const n = q(e.project), i = be(n ?? void 0, n != null), s = it(n ?? void 0), [a, o] = C(null);
153
+ function si(e) {
154
+ const n = G(e.project), a = Ue(n ?? void 0, n != null), s = Xt(n ?? void 0), [i, o] = f(null);
153
155
  return /* @__PURE__ */ t(
154
- re,
156
+ Te,
155
157
  {
156
158
  kind: "workflow",
157
- rows: i.data,
158
- loading: i.isLoading,
159
- error: a ?? (i.error ? String(i.error) : null),
159
+ rows: a.data,
160
+ loading: a.isLoading,
161
+ error: i ?? (a.error ? String(a.error) : null),
160
162
  project: n,
161
- toRow: (r) => ({
162
- title: r.displayName || r.name,
163
- description: r.description,
164
- badges: /* @__PURE__ */ l(D, { children: [
165
- r.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: r.tags.map((c) => /* @__PURE__ */ t("span", { className: "tag", children: c }, c)) }),
166
- r.status !== "archived" && /* @__PURE__ */ t("span", { className: `badge wf-status ${r.status}`, children: r.status })
163
+ toRow: (l) => ({
164
+ title: l.displayName || l.name,
165
+ description: l.description,
166
+ badges: /* @__PURE__ */ r(Q, { children: [
167
+ l.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: l.tags.map((c) => /* @__PURE__ */ t("span", { className: "tag", children: c }, c)) }),
168
+ l.status !== "archived" && /* @__PURE__ */ t("span", { className: `badge wf-status ${l.status}`, children: l.status })
167
169
  ] }),
168
- trailing: /* @__PURE__ */ l("span", { className: "wf-col wf-col-stats muted small", children: [
169
- r.runCount,
170
+ trailing: /* @__PURE__ */ r("span", { className: "wf-col wf-col-stats muted small", children: [
171
+ l.runCount,
170
172
  " ",
171
- r.runCount === 1 ? "run" : "runs"
173
+ l.runCount === 1 ? "run" : "runs"
172
174
  ] })
173
175
  }),
174
176
  onOpen: e.onOpen,
175
177
  getHref: e.getHref,
176
178
  onCreate: () => {
177
- o(null), s.mutate(ot(ae("workflow")), {
178
- onSuccess: (r) => {
179
+ o(null), s.mutate(tn(ke("workflow")), {
180
+ onSuccess: (l) => {
179
181
  var c;
180
- return (c = e.onCreated) == null ? void 0 : c.call(e, r.workflow.id);
182
+ return (c = e.onCreated) == null ? void 0 : c.call(e, l.workflow.id);
181
183
  },
182
- onError: (r) => o(r instanceof Error ? r.message : String(r))
184
+ onError: (l) => o(l instanceof Error ? l.message : String(l))
183
185
  });
184
186
  },
185
187
  creating: s.isPending,
@@ -187,70 +189,70 @@ function Yn(e) {
187
189
  }
188
190
  );
189
191
  }
190
- function Zn({
192
+ function ri({
191
193
  project: e,
192
194
  variant: n = "full",
193
- limit: i,
195
+ limit: a,
194
196
  days: s = 30,
195
- showChart: a,
197
+ showChart: i,
196
198
  getHref: o,
197
- onOpen: r,
199
+ onOpen: l,
198
200
  showAllHref: c,
199
- onShowAll: h,
200
- slots: w
201
+ onShowAll: m,
202
+ slots: h
201
203
  }) {
202
- var g, m;
203
- const N = ie().project, d = e === void 0 ? N : e, y = d || null, k = ct(y ?? void 0, s);
204
- let b = w == null ? void 0 : w.empty;
205
- return y ? k.isLoading ? b = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : k.error && (b = /* @__PURE__ */ t("div", { className: "error", children: k.error.message })) : b = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
206
- Ue,
204
+ var g, w;
205
+ const N = Ce().project, d = e === void 0 ? N : e, k = d || null, b = nn(k ?? void 0, s);
206
+ let D = h == null ? void 0 : h.empty;
207
+ return k ? b.isLoading ? D = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : b.error && (D = /* @__PURE__ */ t("div", { className: "error", children: b.error.message })) : D = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
208
+ Nt,
207
209
  {
208
- services: y ? ((g = k.data) == null ? void 0 : g.services) ?? [] : [],
209
- window: y ? (m = k.data) == null ? void 0 : m.window : void 0,
210
+ services: k ? ((g = b.data) == null ? void 0 : g.services) ?? [] : [],
211
+ window: k ? (w = b.data) == null ? void 0 : w.window : void 0,
210
212
  days: s,
211
213
  compact: n === "compact",
212
- showChart: a,
213
- limit: i,
214
+ showChart: i,
215
+ limit: a,
214
216
  getHref: o,
215
- onOpen: r,
217
+ onOpen: l,
216
218
  showAllHref: c,
217
- onShowAll: h,
218
- slots: { ...w, empty: b }
219
+ onShowAll: m,
220
+ slots: { ...h, empty: D }
219
221
  }
220
222
  ) });
221
223
  }
222
- function St(e) {
224
+ function Kn(e) {
223
225
  const n = e.replace(/\s+/g, " ").trim();
224
226
  return n.length > 80 ? `${n.slice(0, 80)}…` : n;
225
227
  }
226
- function Jn({ project: e, onOpen: n, getHref: i, slots: s, rowSlots: a }) {
228
+ function li({ project: e, onOpen: n, getHref: a, slots: s, rowSlots: i }) {
227
229
  var g;
228
- const o = q(e), r = st(o ?? void 0, o != null), c = lt(), [h, w] = C(null), [N, d] = C(null), y = (s == null ? void 0 : s.header) === void 0 ? /* @__PURE__ */ l("div", { children: [
230
+ const o = G(e), l = un(o ?? void 0, o != null), c = mn(), [m, h] = f(null), [N, d] = f(null), k = (s == null ? void 0 : s.header) === void 0 ? /* @__PURE__ */ r("div", { children: [
229
231
  /* @__PURE__ */ t("h3", { children: "Documents" }),
230
232
  /* @__PURE__ */ t("p", { className: "muted small", children: "Each document is free-form content stored verbatim." })
231
- ] }) : s.header, k = (s == null ? void 0 : s.empty) === void 0 ? /* @__PURE__ */ t(se, { testId: "document-list-empty", children: "No documents yet." }) : s.empty, b = [
233
+ ] }) : s.header, b = (s == null ? void 0 : s.empty) === void 0 ? /* @__PURE__ */ t(De, { testId: "document-list-empty", children: "No documents yet." }) : s.empty, D = [
232
234
  {
233
235
  key: "key",
234
236
  header: "Document",
235
- render: (m) => {
236
- var T;
237
- const p = (T = a == null ? void 0 : a.lead) == null ? void 0 : T.call(a, m);
238
- return /* @__PURE__ */ l("span", { style: { display: "flex", alignItems: "center" }, children: [
239
- p,
240
- /* @__PURE__ */ l(
237
+ render: (w) => {
238
+ var I;
239
+ const y = (I = i == null ? void 0 : i.lead) == null ? void 0 : I.call(i, w);
240
+ return /* @__PURE__ */ r("span", { style: { display: "flex", alignItems: "center" }, children: [
241
+ y,
242
+ /* @__PURE__ */ r(
241
243
  "span",
242
244
  {
243
245
  className: "list-main",
244
- style: { marginLeft: p != null ? "var(--w6w-sp-2)" : 0 },
246
+ style: { marginLeft: y != null ? "var(--w6w-sp-2)" : 0 },
245
247
  children: [
246
- /* @__PURE__ */ t("strong", { className: "list-name", title: m.key, children: m.key }),
248
+ /* @__PURE__ */ t("strong", { className: "list-name", title: w.key, children: w.key }),
247
249
  " ",
248
- /* @__PURE__ */ t("span", { className: "tag", children: m.format }),
249
- /* @__PURE__ */ l("div", { className: "muted small list-preview", children: [
250
- /* @__PURE__ */ t("code", { children: St(m.content) }),
251
- m.description && /* @__PURE__ */ l(D, { children: [
250
+ /* @__PURE__ */ t("span", { className: "tag", children: w.format }),
251
+ /* @__PURE__ */ r("div", { className: "muted small list-preview", children: [
252
+ /* @__PURE__ */ t("code", { children: Kn(w.content) }),
253
+ w.description && /* @__PURE__ */ r(Q, { children: [
252
254
  " · ",
253
- m.description
255
+ w.description
254
256
  ] })
255
257
  ] })
256
258
  ]
@@ -264,82 +266,82 @@ function Jn({ project: e, onOpen: n, getHref: i, slots: s, rowSlots: a }) {
264
266
  header: "",
265
267
  align: "right",
266
268
  link: !1,
267
- render: (m) => {
268
- var T, x;
269
- const p = (T = a == null ? void 0 : a.footer) == null ? void 0 : T.call(a, m);
269
+ render: (w) => {
270
+ var I, S;
271
+ const y = (I = i == null ? void 0 : i.footer) == null ? void 0 : I.call(i, w);
270
272
  return (
271
273
  // Clicks here must not reach the row's onOpen.
272
274
  // biome-ignore lint/a11y/useKeyWithClickEvents: propagation guard only; the buttons inside are the controls.
273
- /* @__PURE__ */ l("div", { onClick: (v) => v.stopPropagation(), children: [
274
- /* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", justifyContent: "flex-end" }, children: [
275
- /* @__PURE__ */ t(pt, { resource: { kind: "document", key: m.key } }),
276
- m.shared ? (x = a == null ? void 0 : a.sharedActions) == null ? void 0 : x.call(a, m) : /* @__PURE__ */ l(D, { children: [
275
+ /* @__PURE__ */ r("div", { onClick: ($) => $.stopPropagation(), children: [
276
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)", justifyContent: "flex-end" }, children: [
277
+ /* @__PURE__ */ t(on, { resource: { kind: "document", key: w.key } }),
278
+ w.shared ? (S = i == null ? void 0 : i.sharedActions) == null ? void 0 : S.call(i, w) : /* @__PURE__ */ r(Q, { children: [
277
279
  /* @__PURE__ */ t(
278
- fe,
280
+ Qe,
279
281
  {
280
282
  label: "Edit",
281
- onClick: () => w({ mode: "edit", d: m }),
282
- "data-testid": `document-edit-${m.id}`
283
+ onClick: () => h({ mode: "edit", d: w }),
284
+ "data-testid": `document-edit-${w.id}`
283
285
  }
284
286
  ),
285
287
  /* @__PURE__ */ t(
286
- Ve,
288
+ bt,
287
289
  {
288
290
  label: "Delete",
289
- onClick: () => d(m),
291
+ onClick: () => d(w),
290
292
  disabled: c.isPending,
291
- "data-testid": `document-delete-${m.id}`
293
+ "data-testid": `document-delete-${w.id}`
292
294
  }
293
295
  )
294
296
  ] })
295
297
  ] }),
296
- p != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: p })
298
+ y != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: y })
297
299
  ] })
298
300
  );
299
301
  }
300
302
  }
301
303
  ];
302
- return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
303
- /* @__PURE__ */ l("section", { className: "section", children: [
304
- /* @__PURE__ */ l("div", { className: "section-head", children: [
305
- y,
304
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
305
+ /* @__PURE__ */ r("section", { className: "section", children: [
306
+ /* @__PURE__ */ r("div", { className: "section-head", children: [
307
+ k,
306
308
  /* @__PURE__ */ t(
307
309
  "button",
308
310
  {
309
311
  type: "button",
310
312
  className: "btn",
311
313
  disabled: o == null,
312
- onClick: () => w({ mode: "create" }),
314
+ onClick: () => h({ mode: "create" }),
313
315
  children: "+ Add document"
314
316
  }
315
317
  )
316
318
  ] }),
317
- /* @__PURE__ */ l("div", { className: "card", children: [
318
- r.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
319
- ((g = r.data) == null ? void 0 : g.length) === 0 && k,
320
- r.data != null && r.data.length > 0 && /* @__PURE__ */ t(
321
- le,
319
+ /* @__PURE__ */ r("div", { className: "card", children: [
320
+ l.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
321
+ ((g = l.data) == null ? void 0 : g.length) === 0 && b,
322
+ l.data != null && l.data.length > 0 && /* @__PURE__ */ t(
323
+ $e,
322
324
  {
323
- columns: b,
324
- rows: r.data,
325
- rowKey: (m) => m.id,
326
- getRowHref: i ? (m) => i(m.id) : void 0,
327
- onRowClick: n ? (m, p) => n(m.id, p) : void 0
325
+ columns: D,
326
+ rows: l.data,
327
+ rowKey: (w) => w.id,
328
+ getRowHref: a ? (w) => a(w.id) : void 0,
329
+ onRowClick: n ? (w, y) => n(w.id, y) : void 0
328
330
  }
329
331
  )
330
332
  ] })
331
333
  ] }),
332
- h && /* @__PURE__ */ t(
333
- ft,
334
+ m && /* @__PURE__ */ t(
335
+ dn,
334
336
  {
335
- initial: h.mode === "edit" ? h.d : void 0,
337
+ initial: m.mode === "edit" ? m.d : void 0,
336
338
  project: o,
337
- onClose: () => w(null),
338
- onSaved: () => w(null)
339
+ onClose: () => h(null),
340
+ onSaved: () => h(null)
339
341
  }
340
342
  ),
341
343
  N && /* @__PURE__ */ t(
342
- wt,
344
+ he,
343
345
  {
344
346
  title: "Delete document",
345
347
  message: `Delete the document "${N.key}"? This cannot be undone.`,
@@ -352,7 +354,7 @@ function Jn({ project: e, onOpen: n, getHref: i, slots: s, rowSlots: a }) {
352
354
  )
353
355
  ] });
354
356
  }
355
- const Pt = {
357
+ const Qn = {
356
358
  workflow: "Workflow run",
357
359
  workflow_step: "Workflow step",
358
360
  connection_test: "Connection test",
@@ -363,10 +365,10 @@ const Pt = {
363
365
  endpoint: "Endpoint call",
364
366
  action: "App action"
365
367
  };
366
- function J(e) {
367
- return Pt[e] ?? e;
368
+ function me(e) {
369
+ return Qn[e] ?? e;
368
370
  }
369
- const Me = {
371
+ const tt = {
370
372
  workflow: "workflow",
371
373
  workflow_step: "workflow_step",
372
374
  connection_test: "base",
@@ -375,201 +377,207 @@ const Me = {
375
377
  endpoint: "base",
376
378
  action: "base"
377
379
  };
378
- function Ot(e) {
379
- return Object.hasOwn(Me, e);
380
+ function Fn(e) {
381
+ return Object.hasOwn(tt, e);
380
382
  }
381
- function De(e) {
382
- return Ot(e) ? Me[e] : "base";
383
+ function nt(e) {
384
+ return Fn(e) ? tt[e] : "base";
383
385
  }
384
- function qt(e, n) {
385
- const i = /* @__PURE__ */ new Map();
386
- for (const a of e ?? []) {
387
- const o = a.displayName || a.key;
388
- o && i.set(a.id, o);
386
+ function qn(e, n) {
387
+ const a = /* @__PURE__ */ new Map();
388
+ for (const i of e ?? []) {
389
+ const o = i.displayName || i.key;
390
+ o && a.set(i.id, o);
389
391
  }
390
392
  const s = /* @__PURE__ */ new Map();
391
- for (const a of n ?? []) {
392
- const o = a.displayName || a.name;
393
- o && s.set(a.id, o);
393
+ for (const i of n ?? []) {
394
+ const o = i.displayName || i.name;
395
+ o && s.set(i.id, o);
394
396
  }
395
- return { functions: i, workflows: s };
397
+ return { functions: a, workflows: s };
396
398
  }
397
- function Ft(e, n) {
398
- const i = e.summary ?? J(e.kind), s = De(e.kind);
399
+ function _n(e, n) {
400
+ const a = e.summary ?? me(e.kind), s = nt(e.kind);
399
401
  if (s === "function" && e.functionId !== null) {
400
- const a = n.functions.get(e.functionId);
401
- if (a !== void 0)
402
- return { text: a, target: { kind: "function", id: e.functionId } };
402
+ const i = n.functions.get(e.functionId);
403
+ if (i !== void 0)
404
+ return { text: i, target: { kind: "function", id: e.functionId } };
403
405
  }
404
406
  if (s === "workflow" && e.workflowId !== null) {
405
- const a = n.workflows.get(e.workflowId);
406
- if (a !== void 0)
407
- return { text: a, target: { kind: "workflow", id: e.workflowId } };
407
+ const i = n.workflows.get(e.workflowId);
408
+ if (i !== void 0)
409
+ return { text: i, target: { kind: "workflow", id: e.workflowId } };
408
410
  }
409
411
  if (s === "workflow_step") {
410
- const a = e.workflowId, o = a !== null ? n.workflows.get(a) : void 0, r = o ?? a ?? e.summary ?? "Unknown workflow", c = o !== void 0 && a !== null;
412
+ const i = e.workflowId, o = i !== null ? n.workflows.get(i) : void 0, l = o ?? i ?? e.summary ?? "Unknown workflow", c = o !== void 0 && i !== null;
411
413
  return {
412
- text: e.stepId ? `${r} - ${e.stepId}` : r,
413
- target: c ? { kind: "workflow", id: a } : null
414
+ text: e.stepId ? `${l} - ${e.stepId}` : l,
415
+ target: c ? { kind: "workflow", id: i } : null
414
416
  };
415
417
  }
416
- return { text: i, target: null };
418
+ return { text: a, target: null };
417
419
  }
418
- const _ = (e) => String(e).padStart(2, "0");
419
- function xe(e) {
420
+ const re = (e) => String(e).padStart(2, "0");
421
+ function at(e) {
420
422
  const n = new Date(e);
421
- return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${_(n.getMonth() + 1)}-${_(n.getDate())}`} ${_(n.getHours())}:${_(n.getMinutes())}:${_(n.getSeconds())}`;
423
+ return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${re(n.getMonth() + 1)}-${re(n.getDate())}`} ${re(n.getHours())}:${re(n.getMinutes())}:${re(n.getSeconds())}`;
422
424
  }
423
- function Ae(e) {
425
+ function it(e) {
424
426
  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`;
425
427
  }
426
- function Kt() {
428
+ function Wn() {
427
429
  const e = /* @__PURE__ */ new Date();
428
430
  return e.setHours(0, 0, 0, 0), e.toISOString();
429
431
  }
430
- function Qt(e, n) {
431
- const i = new Date(e);
432
- if (Number.isNaN(i.getTime())) return e;
433
- const s = i.toLocaleDateString(void 0, { month: "short", day: "numeric" });
432
+ function Bn(e, n) {
433
+ const a = new Date(e);
434
+ if (Number.isNaN(a.getTime())) return e;
435
+ const s = a.toLocaleDateString(void 0, { month: "short", day: "numeric" });
434
436
  return n === "week" ? `Week of ${s}` : s;
435
437
  }
436
- function Re({ ok: e }) {
438
+ function st({ ok: e }) {
437
439
  return e === null ? /* @__PURE__ */ t("span", { className: "muted", children: "–" }) : /* @__PURE__ */ t("span", { className: e ? "ok" : "error", children: e ? "✓" : "✗" });
438
440
  }
439
- function G({ label: e, value: n }) {
440
- return /* @__PURE__ */ l("div", { className: "w6w-activity-card w6w-activity-stat", children: [
441
+ function ge({ label: e, value: n }) {
442
+ return /* @__PURE__ */ r("div", { className: "w6w-activity-card w6w-activity-stat", children: [
441
443
  /* @__PURE__ */ t("div", { className: "w6w-activity-stat-value", children: n }),
442
444
  /* @__PURE__ */ t("div", { className: "muted small", children: e })
443
445
  ] });
444
446
  }
445
- function de({
447
+ function Ae({
446
448
  title: e,
447
449
  headline: n,
448
- loading: i
450
+ loading: a
449
451
  }) {
450
452
  const s = n ?? { workflowRuns: 0, succeeded: 0, failed: 0 };
451
- return /* @__PURE__ */ l("section", { className: "w6w-activity-section", children: [
453
+ return /* @__PURE__ */ r("section", { className: "w6w-activity-section", children: [
452
454
  /* @__PURE__ */ t("h3", { children: e }),
453
- i ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ l("div", { className: "w6w-activity-stats", children: [
454
- /* @__PURE__ */ t(G, { label: "Workflow runs", value: s.workflowRuns }),
455
- /* @__PURE__ */ t(G, { label: "Succeeded", value: s.succeeded }),
456
- /* @__PURE__ */ t(G, { label: "Failed", value: s.failed })
455
+ a ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ r("div", { className: "w6w-activity-stats", children: [
456
+ /* @__PURE__ */ t(ge, { label: "Workflow runs", value: s.workflowRuns }),
457
+ /* @__PURE__ */ t(ge, { label: "Succeeded", value: s.succeeded }),
458
+ /* @__PURE__ */ t(ge, { label: "Failed", value: s.failed })
457
459
  ] })
458
460
  ] });
459
461
  }
460
- function Bt({
462
+ function Un({
461
463
  entry: e,
462
464
  names: n,
463
- getHref: i,
465
+ getHref: a,
464
466
  onOpen: s
465
467
  }) {
466
- const { text: a, target: o } = Ft(e, n);
467
- if (o === null) return /* @__PURE__ */ t(D, { children: a });
468
- const r = s ? (c) => s(o, c) : void 0;
469
- return i ? /* @__PURE__ */ t("a", { href: i(o), onClick: r, children: a }) : r ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: r, children: a }) : /* @__PURE__ */ t(D, { children: a });
468
+ const { text: i, target: o } = _n(e, n);
469
+ if (o === null) return /* @__PURE__ */ t(Q, { children: i });
470
+ const l = s ? (c) => s(o, c) : void 0;
471
+ return a ? /* @__PURE__ */ t("a", { href: a(o), onClick: l, children: i }) : l ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: l, children: i }) : /* @__PURE__ */ t(Q, { children: i });
470
472
  }
471
- function Ee({ entry: e, title: n }) {
472
- const i = Ae(e.durationMs);
473
+ function rt({ entry: e, title: n }) {
474
+ const a = it(e.durationMs);
473
475
  return /* @__PURE__ */ t(
474
- te,
476
+ Ne,
475
477
  {
476
- icon: /* @__PURE__ */ t(Re, { ok: e.ok }),
477
- title: n ?? e.summary ?? J(e.kind),
478
- subtitle: `${J(e.kind)} · ${xe(e.occurredAt)}`,
479
- trailing: i === null ? void 0 : /* @__PURE__ */ t("span", { className: "muted small", children: i })
478
+ icon: /* @__PURE__ */ t(st, { ok: e.ok }),
479
+ title: n ?? e.summary ?? me(e.kind),
480
+ subtitle: `${me(e.kind)} · ${at(e.occurredAt)}`,
481
+ trailing: a === null ? void 0 : /* @__PURE__ */ t("span", { className: "muted small", children: a })
480
482
  }
481
483
  );
482
484
  }
483
- function X(e) {
484
- return /* @__PURE__ */ t(Ee, { entry: e.entry, title: /* @__PURE__ */ t(Bt, { ...e }) });
485
+ function ye(e) {
486
+ return /* @__PURE__ */ t(rt, { entry: e.entry, title: /* @__PURE__ */ t(Un, { ...e }) });
485
487
  }
486
- const Wt = {
487
- base: (e) => /* @__PURE__ */ t(Ee, { entry: e.entry }),
488
- function: X,
489
- workflow: X,
490
- workflow_step: X
488
+ const Vn = {
489
+ base: (e) => /* @__PURE__ */ t(rt, { entry: e.entry }),
490
+ function: ye,
491
+ workflow: ye,
492
+ workflow_step: ye
491
493
  };
492
- function _t(e) {
493
- const n = Wt[De(e.entry.kind)];
494
+ function Hn(e) {
495
+ const n = Vn[nt(e.entry.kind)];
494
496
  return /* @__PURE__ */ t(n, { ...e });
495
497
  }
496
- function zn({ getHref: e, onOpen: n, slots: i }) {
497
- var b, g, m, p, T, x;
498
- const s = ce("today", { from: Kt(), bucket: "day" }), a = ce("week", { bucket: "week" }), o = pe(), r = be(), c = K(
499
- () => qt(o.data, r.data),
500
- [o.data, r.data]
501
- ), h = s.error ?? a.error, w = h ? h.message : null, N = ((b = a.data) == null ? void 0 : b.recent) ?? [], d = ((g = a.data) == null ? void 0 : g.series) ?? [], y = ((m = a.data) == null ? void 0 : m.range.bucket) ?? "week", k = !a.isLoading && N.length === 0 && (((p = a.data) == null ? void 0 : p.headline.workflowRuns) ?? 0) === 0;
502
- return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
503
- w && /* @__PURE__ */ t("div", { className: "error", children: w }),
504
- i == null ? void 0 : i.header,
505
- i == null ? void 0 : i.actions,
498
+ function oi({ getHref: e, onOpen: n, slots: a }) {
499
+ var D, g, w, y, I, S;
500
+ const s = Ee("today", { from: Wn(), bucket: "day" }), i = Ee("week", { bucket: "week" }), o = Ke(), l = Ue(), c = ae(
501
+ () => qn(o.data, l.data),
502
+ [o.data, l.data]
503
+ ), m = s.error ?? i.error, h = m ? m.message : null, N = ((D = i.data) == null ? void 0 : D.recent) ?? [], d = ((g = i.data) == null ? void 0 : g.series) ?? [], k = ((w = i.data) == null ? void 0 : w.range.bucket) ?? "week", b = !i.isLoading && N.length === 0 && (((y = i.data) == null ? void 0 : y.headline.workflowRuns) ?? 0) === 0;
504
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
505
+ h && /* @__PURE__ */ t("div", { className: "error", children: h }),
506
+ a == null ? void 0 : a.header,
507
+ a == null ? void 0 : a.actions,
506
508
  /* @__PURE__ */ t(
507
- de,
509
+ Ae,
508
510
  {
509
511
  title: "Today",
510
- headline: (T = s.data) == null ? void 0 : T.headline,
512
+ headline: (I = s.data) == null ? void 0 : I.headline,
511
513
  loading: s.isLoading
512
514
  }
513
515
  ),
514
516
  /* @__PURE__ */ t(
515
- de,
517
+ Ae,
516
518
  {
517
519
  title: "Last 7 days",
518
- headline: (x = a.data) == null ? void 0 : x.headline,
519
- loading: a.isLoading
520
+ headline: (S = i.data) == null ? void 0 : S.headline,
521
+ loading: i.isLoading
520
522
  }
521
523
  ),
522
- i == null ? void 0 : i.betweenHeadlineAndSeries,
523
- /* @__PURE__ */ l("section", { className: "w6w-activity-section", children: [
524
+ a == null ? void 0 : a.betweenHeadlineAndSeries,
525
+ /* @__PURE__ */ r("section", { className: "w6w-activity-section", children: [
524
526
  /* @__PURE__ */ t("h3", { children: "Activity over time" }),
525
- /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: a.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : d.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: d.map((v) => /* @__PURE__ */ l("li", { children: [
526
- /* @__PURE__ */ l("span", { className: "list-main", children: [
527
- /* @__PURE__ */ t("strong", { children: Qt(v.bucket, y) }),
527
+ /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: i.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : d.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: d.map(($) => /* @__PURE__ */ r("li", { children: [
528
+ /* @__PURE__ */ r("span", { className: "list-main", children: [
529
+ /* @__PURE__ */ t("strong", { children: Bn($.bucket, k) }),
528
530
  " ",
529
- /* @__PURE__ */ t("span", { className: "muted small", children: J(v.kind) })
531
+ /* @__PURE__ */ t("span", { className: "muted small", children: me($.kind) })
530
532
  ] }),
531
533
  " ",
532
- /* @__PURE__ */ t(Re, { ok: v.ok }),
534
+ /* @__PURE__ */ t(st, { ok: $.ok }),
533
535
  " ",
534
- /* @__PURE__ */ t("span", { className: "muted small", children: v.count })
535
- ] }, `${v.bucket}-${v.kind}-${String(v.ok)}`)) }) })
536
+ /* @__PURE__ */ t("span", { className: "muted small", children: $.count })
537
+ ] }, `${$.bucket}-${$.kind}-${String($.ok)}`)) }) })
536
538
  ] }),
537
- /* @__PURE__ */ l("section", { children: [
539
+ /* @__PURE__ */ r("section", { children: [
538
540
  /* @__PURE__ */ t("h3", { className: "w6w-activity-h3", children: "Recent activity" }),
539
- /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: a.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : k ? (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("p", { className: "muted", children: "No runs yet — activity shows up here once your workflows run." }) : N.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No recent activity in this window." }) : /* @__PURE__ */ t("div", { className: "list", children: N.map((v) => /* @__PURE__ */ t(
540
- _t,
541
+ /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: i.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : b ? (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("p", { className: "muted", children: "No runs yet — activity shows up here once your workflows run." }) : N.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No recent activity in this window." }) : /* @__PURE__ */ t("div", { className: "list", children: N.map(($) => /* @__PURE__ */ t(
542
+ Hn,
541
543
  {
542
- entry: v,
544
+ entry: $,
543
545
  names: c,
544
546
  getHref: e,
545
547
  onOpen: n
546
548
  },
547
- v.id
549
+ $.id
548
550
  )) }) })
549
551
  ] })
550
552
  ] });
551
553
  }
552
- function Ht(e) {
554
+ function Jn(e) {
553
555
  return e !== null && "project" in e;
554
556
  }
555
- function Gn(e) {
556
- const n = ie().project, [i, s] = C(rt), a = e.scope !== void 0 ? e.scope : n ? { project: n } : null, o = e.filters !== void 0, r = e.filters ?? i, c = (h) => {
557
- var w;
558
- o || s(h), (w = e.onFiltersChange) == null || w.call(e, h);
557
+ function Yn(e) {
558
+ const n = Ce().project, [a, s] = f(en), i = e.scope !== void 0 ? e.scope : n ? { project: n } : null, o = e.filters !== void 0, l = e.filters ?? a, c = (m) => {
559
+ var h;
560
+ o || s(m), (h = e.onFiltersChange) == null || h.call(e, m);
559
561
  };
560
562
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
561
- gt,
563
+ hn,
562
564
  {
563
- scope: a,
564
- showKind: e.showKind ?? Ht(a),
565
- filters: r,
565
+ scope: i,
566
+ showKind: e.showKind ?? Jn(i),
567
+ filters: l,
566
568
  onFiltersChange: c,
567
569
  onOpenInEditor: e.onOpenInEditor
568
570
  }
569
571
  ) });
570
572
  }
571
- const Ut = 1440 * 60 * 1e3;
572
- function Vt(e) {
573
+ function zn({ title: e = "Logs", ...n }) {
574
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-logs", children: [
575
+ e !== null && /* @__PURE__ */ t("h2", { children: e }),
576
+ /* @__PURE__ */ t(Yn, { ...n })
577
+ ] });
578
+ }
579
+ const ci = zn, Zn = 1440 * 60 * 1e3;
580
+ function Gn(e) {
573
581
  if (!(e === null || e.timeline === null))
574
582
  return e.timeline.map((n) => ({
575
583
  id: n.id,
@@ -582,39 +590,39 @@ function Vt(e) {
582
590
  link: n.link
583
591
  }));
584
592
  }
585
- function je(e) {
593
+ function lt(e) {
586
594
  return e.startedAt !== void 0 && e.resolvedAt === void 0;
587
595
  }
588
- function ue(e) {
596
+ function Re(e) {
589
597
  const n = new Date(e);
590
598
  return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone: "UTC" });
591
599
  }
592
- function me(e, n) {
593
- const i = new Date(e).getTime();
594
- return Number.isNaN(i) ? 0 : Math.max(0, Math.floor((n - i) / Ut));
600
+ function Se(e, n) {
601
+ const a = new Date(e).getTime();
602
+ return Number.isNaN(a) ? 0 : Math.max(0, Math.floor((n - a) / Zn));
595
603
  }
596
- function Yt(e, n) {
597
- if (!je(e) || e.startedAt === void 0) return null;
598
- const i = me(e.startedAt, n), s = ue(e.startedAt), a = i === 0 ? `open since ${s} (today)` : `open ${i}d (since ${s})`, o = e.updatedAt ?? e.startedAt, r = me(o, n), c = ue(o), h = r === 0 ? `last update ${c} (today)` : `last update ${c} (${r}d ago)`;
599
- return `${a} · ${h}`;
604
+ function Xn(e, n) {
605
+ if (!lt(e) || e.startedAt === void 0) return null;
606
+ const a = Se(e.startedAt, n), s = Re(e.startedAt), i = a === 0 ? `open since ${s} (today)` : `open ${a}d (since ${s})`, o = e.updatedAt ?? e.startedAt, l = Se(o, n), c = Re(o), m = l === 0 ? `last update ${c} (today)` : `last update ${c} (${l}d ago)`;
607
+ return `${i} · ${m}`;
600
608
  }
601
- function Zt(e) {
609
+ function ea(e) {
602
610
  return e ? Object.entries(e) : [];
603
611
  }
604
- function Jt(e) {
612
+ function ta(e) {
605
613
  return e.uptime.map((n) => ({ day: n.day, state: n.state }));
606
614
  }
607
- const Q = [
615
+ const ie = [
608
616
  ["e4xx", "4xx"],
609
617
  ["e429", "429 rate-limited"],
610
618
  ["eAuth", "auth (401/403)"],
611
619
  ["e5xx", "5xx"]
612
620
  ];
613
- function Se(e) {
621
+ function ot(e) {
614
622
  const n = new Date(e);
615
623
  return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString(void 0, { month: "short", day: "numeric" });
616
624
  }
617
- function oe(e) {
625
+ function Le(e) {
618
626
  if (!e) return "—";
619
627
  const n = new Date(e);
620
628
  return Number.isNaN(n.getTime()) ? e : n.toLocaleString(void 0, {
@@ -624,49 +632,49 @@ function oe(e) {
624
632
  minute: "2-digit"
625
633
  });
626
634
  }
627
- function Y({ label: e, value: n, hint: i }) {
628
- return /* @__PURE__ */ l("div", { className: "w6w-rel-card", style: { flex: "1 1 150px", minWidth: 150 }, children: [
635
+ function de({ label: e, value: n, hint: a }) {
636
+ return /* @__PURE__ */ r("div", { className: "w6w-rel-card", style: { flex: "1 1 150px", minWidth: 150 }, children: [
629
637
  /* @__PURE__ */ t("div", { style: { fontSize: "1.6rem", fontWeight: "var(--w6w-fw-semibold)", lineHeight: 1.15 }, children: n }),
630
638
  /* @__PURE__ */ t("div", { className: "muted small", children: e }),
631
- i && /* @__PURE__ */ t("div", { className: "muted small", children: i })
639
+ a && /* @__PURE__ */ t("div", { className: "muted small", children: a })
632
640
  ] });
633
641
  }
634
- function zt({
642
+ function na({
635
643
  vendor: e,
636
644
  displayName: n
637
645
  }) {
638
646
  if (!e)
639
- return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
640
- /* @__PURE__ */ l("h4", { style: { margin: "0 0 var(--w6w-sp-1)" }, children: [
647
+ return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
648
+ /* @__PURE__ */ r("h4", { style: { margin: "0 0 var(--w6w-sp-1)" }, children: [
641
649
  n,
642
650
  " status"
643
651
  ] }),
644
- /* @__PURE__ */ l("p", { className: "muted", children: [
652
+ /* @__PURE__ */ r("p", { className: "muted", children: [
645
653
  n,
646
654
  " publishes no public health check, so there is nothing to ask about it. That is a statement about ",
647
655
  n,
648
656
  ", not a gap in the data above."
649
657
  ] })
650
658
  ] });
651
- const i = e.state === "unknown", s = Zt(e.components), a = (e.timeline ?? []).filter(je), o = Date.now();
652
- return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
653
- /* @__PURE__ */ l("h4", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
659
+ const a = e.state === "unknown", s = ea(e.components), i = (e.timeline ?? []).filter(lt), o = Date.now();
660
+ return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
661
+ /* @__PURE__ */ r("h4", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
654
662
  n,
655
663
  " status",
656
664
  " ",
657
- /* @__PURE__ */ t(Z, { state: e.state, label: i ? "Unavailable" : void 0 })
665
+ /* @__PURE__ */ t(ue, { state: e.state, label: a ? "Unavailable" : void 0 })
658
666
  ] }),
659
- i && /* @__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." }),
667
+ 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." }),
660
668
  e.message && /* @__PURE__ */ t(
661
669
  "p",
662
670
  {
663
- className: i ? "muted small" : void 0,
671
+ className: a ? "muted small" : void 0,
664
672
  style: { margin: "0 0 var(--w6w-sp-2)" },
665
673
  children: e.message
666
674
  }
667
675
  ),
668
- /* @__PURE__ */ l("p", { className: "muted small", style: { margin: 0 }, children: [
669
- i ? "Tried to read" : "Read from",
676
+ /* @__PURE__ */ r("p", { className: "muted small", style: { margin: 0 }, children: [
677
+ a ? "Tried to read" : "Read from",
670
678
  " ",
671
679
  n,
672
680
  "'s own status page — what",
@@ -674,36 +682,36 @@ function zt({
674
682
  n,
675
683
  " says about itself, not what your calls did · last checked",
676
684
  " ",
677
- oe(e.checkedAt),
678
- e.attributedTo.length > 0 && /* @__PURE__ */ l(D, { children: [
685
+ Le(e.checkedAt),
686
+ e.attributedTo.length > 0 && /* @__PURE__ */ r(Q, { children: [
679
687
  " ",
680
688
  "· decided by",
681
689
  " ",
682
- e.attributedTo.map((r) => /* @__PURE__ */ t("code", { children: r }, r))
690
+ e.attributedTo.map((l) => /* @__PURE__ */ t("code", { children: l }, l))
683
691
  ] })
684
692
  ] }),
685
- 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: [
686
- r,
693
+ s.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: s.map(([l, c]) => /* @__PURE__ */ r("span", { className: "w6w-rel-tag", children: [
694
+ l,
687
695
  ": ",
688
696
  c.state
689
- ] }, r)) }),
690
- a.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: a.map((r) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l("div", { className: "list-main", children: [
691
- /* @__PURE__ */ t("strong", { children: r.title }),
697
+ ] }, l)) }),
698
+ i.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: i.map((l) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ r("div", { className: "list-main", children: [
699
+ /* @__PURE__ */ t("strong", { children: l.title }),
692
700
  " ",
693
- /* @__PURE__ */ t(Z, { state: r.state }),
694
- /* @__PURE__ */ t("div", { className: "muted small", children: Yt(r, o) })
695
- ] }) }, r.id ?? r.title)) }),
696
- 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: [
701
+ /* @__PURE__ */ t(ue, { state: l.state }),
702
+ /* @__PURE__ */ t("div", { className: "muted small", children: Xn(l, o) })
703
+ ] }) }, l.id ?? l.title)) }),
704
+ e.statusPageUrl !== null && /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: /* @__PURE__ */ r("a", { href: e.statusPageUrl, target: "_blank", rel: "noopener noreferrer", children: [
697
705
  n,
698
706
  "'s status page ↗"
699
707
  ] }) })
700
708
  ] });
701
709
  }
702
- function Gt({ service: e }) {
710
+ function aa({ service: e }) {
703
711
  if (e.calls === 0)
704
712
  return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("span", { className: "w6w-rel-idle-note", children: "No calls in this window" }) });
705
- const n = e.uptime, i = Math.max(1, ...n.map((s) => s.calls));
706
- return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
713
+ const n = e.uptime, a = Math.max(1, ...n.map((s) => s.calls));
714
+ return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
707
715
  /* @__PURE__ */ t(
708
716
  "div",
709
717
  {
@@ -714,8 +722,8 @@ function Gt({ service: e }) {
714
722
  "span",
715
723
  {
716
724
  className: `rel-daily-bar rel-daily-bar-${s.state}`,
717
- style: { height: `${s.calls > 0 ? Math.max(s.calls / i * 100, 4) : 2}%` },
718
- title: `${Se(`${s.day}T00:00:00.000Z`)} — ${s.calls} calls, ${s.state}`
725
+ style: { height: `${s.calls > 0 ? Math.max(s.calls / a * 100, 4) : 2}%` },
726
+ title: `${ot(`${s.day}T00:00:00.000Z`)} — ${s.calls} calls, ${s.state}`
719
727
  },
720
728
  s.day
721
729
  ))
@@ -724,117 +732,117 @@ function Gt({ service: e }) {
724
732
  /* @__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." })
725
733
  ] });
726
734
  }
727
- function Xt({
735
+ function ia({
728
736
  service: e,
729
737
  window: n
730
738
  }) {
731
- const i = [...e.uptime].reverse().filter((r) => r.calls > 0), s = e.vendorStatus, a = Vt(s), o = a === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
732
- return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
739
+ const a = [...e.uptime].reverse().filter((l) => l.calls > 0), s = e.vendorStatus, i = Gn(s), o = i === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
740
+ return /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
733
741
  /* @__PURE__ */ t(
734
- Ye,
742
+ kt,
735
743
  {
736
744
  window: n,
737
- days: Jt(e),
738
- incidents: a,
745
+ days: ta(e),
746
+ incidents: i,
739
747
  vendorEmptyLabel: o,
740
748
  ariaLabel: `${e.displayName}, ${e.uptime.length}-day status and ${e.displayName} incidents, oldest day first`
741
749
  }
742
750
  ),
743
- /* @__PURE__ */ l("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: [
751
+ /* @__PURE__ */ r("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: [
744
752
  "Oldest day leftmost. Days with no calls are ",
745
753
  /* @__PURE__ */ t("code", { children: "unknown" }),
746
754
  " — never a quiet green."
747
755
  ] }),
748
- i.length > 0 && /* @__PURE__ */ t("div", { className: "list", style: { marginTop: "var(--w6w-sp-3)" }, children: i.slice(0, 14).map((r) => /* @__PURE__ */ l("div", { className: "rel-day-row", children: [
749
- /* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: Se(`${r.day}T00:00:00.000Z`) }) }),
750
- /* @__PURE__ */ t(Z, { state: r.state }),
751
- /* @__PURE__ */ l("span", { className: "muted small", children: [
752
- r.calls,
756
+ a.length > 0 && /* @__PURE__ */ t("div", { className: "list", style: { marginTop: "var(--w6w-sp-3)" }, children: a.slice(0, 14).map((l) => /* @__PURE__ */ r("div", { className: "rel-day-row", children: [
757
+ /* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: ot(`${l.day}T00:00:00.000Z`) }) }),
758
+ /* @__PURE__ */ t(ue, { state: l.state }),
759
+ /* @__PURE__ */ r("span", { className: "muted small", children: [
760
+ l.calls,
753
761
  " calls"
754
762
  ] }),
755
- /* @__PURE__ */ t("span", { className: "rel-errors", children: Q.filter(([c]) => r.errors[c] > 0).map(([c, h]) => /* @__PURE__ */ l("span", { className: "w6w-rel-tag", children: [
756
- h,
763
+ /* @__PURE__ */ t("span", { className: "rel-errors", children: ie.filter(([c]) => l.errors[c] > 0).map(([c, m]) => /* @__PURE__ */ r("span", { className: "w6w-rel-tag", children: [
764
+ m,
757
765
  " ×",
758
- r.errors[c]
766
+ l.errors[c]
759
767
  ] }, c)) })
760
- ] }, r.day)) })
768
+ ] }, l.day)) })
761
769
  ] });
762
770
  }
763
- function en({ errors: e }) {
764
- if (Q.reduce((s, [a]) => s + e[a], 0) === 0)
771
+ function sa({ errors: e }) {
772
+ if (ie.reduce((s, [i]) => s + e[i], 0) === 0)
765
773
  return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("p", { className: "muted", style: { margin: 0 }, children: "No errors in this window." }) });
766
- const i = Math.max(1, ...Q.map(([s]) => e[s]));
767
- return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: Q.map(([s, a]) => /* @__PURE__ */ l("div", { className: "rel-errormix-row", children: [
768
- /* @__PURE__ */ t("span", { className: "muted small", children: a }),
774
+ const a = Math.max(1, ...ie.map(([s]) => e[s]));
775
+ return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: ie.map(([s, i]) => /* @__PURE__ */ r("div", { className: "rel-errormix-row", children: [
776
+ /* @__PURE__ */ t("span", { className: "muted small", children: i }),
769
777
  /* @__PURE__ */ t("span", { className: "rel-errormix-track", children: /* @__PURE__ */ t(
770
778
  "span",
771
779
  {
772
780
  className: "rel-errormix-bar",
773
- style: { width: `${Math.max(e[s] / i * 100, e[s] > 0 ? 2 : 0)}%` }
781
+ style: { width: `${Math.max(e[s] / a * 100, e[s] > 0 ? 2 : 0)}%` }
774
782
  }
775
783
  ) }),
776
784
  /* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[s] })
777
785
  ] }, s)) });
778
786
  }
779
- function tn({ project: e, appId: n }) {
780
- const i = ut(e, n, { limit: 50 });
781
- if (i.isLoading) return /* @__PURE__ */ t("p", { className: "muted", children: "Loading calls…" });
782
- if (i.error) {
783
- const a = i.error;
784
- return /* @__PURE__ */ t("div", { className: "error", children: (a instanceof ke, a.message) });
787
+ function ra({ project: e, appId: n }) {
788
+ const a = sn(e, n, { limit: 50 });
789
+ if (a.isLoading) return /* @__PURE__ */ t("p", { className: "muted", children: "Loading calls…" });
790
+ if (a.error) {
791
+ const i = a.error;
792
+ return /* @__PURE__ */ t("div", { className: "error", children: (i instanceof He, i.message) });
785
793
  }
786
- const s = i.data ?? [];
787
- 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: [
788
- /* @__PURE__ */ l("div", { className: "rel-call rel-call-head", children: [
794
+ const s = a.data ?? [];
795
+ return s.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No calls captured for this service. Calls appear here once a workflow, function or ad-hoc invoke reaches it." }) : /* @__PURE__ */ r("div", { className: "rel-calls", children: [
796
+ /* @__PURE__ */ r("div", { className: "rel-call rel-call-head", children: [
789
797
  /* @__PURE__ */ t("span", { children: "When" }),
790
798
  /* @__PURE__ */ t("span", { children: "Action" }),
791
799
  /* @__PURE__ */ t("span", { children: "Method" }),
792
800
  /* @__PURE__ */ t("span", { children: "Status" }),
793
801
  /* @__PURE__ */ t("span", { children: "Took" })
794
802
  ] }),
795
- s.map((a, o) => /* @__PURE__ */ l("div", { className: "rel-call", children: [
796
- /* @__PURE__ */ t("span", { className: "muted small", children: oe(a.createdAt) }),
797
- /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: a.actionKey ?? "—" }) }),
798
- /* @__PURE__ */ t("span", { className: "muted small", children: a.method }),
799
- /* @__PURE__ */ t("span", { className: a.status >= 400 || a.status === 0 ? "error" : "ok", children: a.status === 0 ? "no response" : a.status }),
800
- /* @__PURE__ */ t("span", { className: "muted small", children: a.durationMs != null ? `${a.durationMs} ms` : "—" })
801
- ] }, a.id ?? `${a.createdAt}-${o}`))
803
+ s.map((i, o) => /* @__PURE__ */ r("div", { className: "rel-call", children: [
804
+ /* @__PURE__ */ t("span", { className: "muted small", children: Le(i.createdAt) }),
805
+ /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: i.actionKey ?? "—" }) }),
806
+ /* @__PURE__ */ t("span", { className: "muted small", children: i.method }),
807
+ /* @__PURE__ */ t("span", { className: i.status >= 400 || i.status === 0 ? "error" : "ok", children: i.status === 0 ? "no response" : i.status }),
808
+ /* @__PURE__ */ t("span", { className: "muted small", children: i.durationMs != null ? `${i.durationMs} ms` : "—" })
809
+ ] }, i.id ?? `${i.createdAt}-${o}`))
802
810
  ] });
803
811
  }
804
- function nn({
812
+ function la({
805
813
  backHref: e,
806
814
  onBack: n
807
815
  }) {
808
816
  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;
809
817
  }
810
- function Xn({
818
+ function di({
811
819
  appId: e,
812
820
  project: n,
813
- days: i = 30,
821
+ days: a = 30,
814
822
  backHref: s,
815
- onBack: a,
823
+ onBack: i,
816
824
  slots: o
817
825
  }) {
818
- var y, k, b, g;
819
- const r = ie().project, c = (n === void 0 ? r : n) || void 0, h = dt(c, [e], i), w = h.error, N = w ? (w instanceof ke, w.message) : null, d = (y = h.data) == null ? void 0 : y.services.find((m) => m.appId === e);
820
- return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
826
+ var k, b, D, g;
827
+ const l = Ce().project, c = (n === void 0 ? l : n) || void 0, m = an(c, [e], a), h = m.error, N = h ? (h instanceof He, h.message) : null, d = (k = m.data) == null ? void 0 : k.services.find((w) => w.appId === e);
828
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
821
829
  o == null ? void 0 : o.header,
822
830
  o == null ? void 0 : o.actions,
823
831
  !c && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see this service." }),
824
832
  N && /* @__PURE__ */ t("div", { className: "error", children: N }),
825
- c && h.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
826
- h.data && !d && /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
827
- (o == null ? void 0 : o.empty) ?? /* @__PURE__ */ l("p", { className: "muted", children: [
833
+ c && m.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
834
+ m.data && !d && /* @__PURE__ */ r("div", { className: "w6w-rel-card", children: [
835
+ (o == null ? void 0 : o.empty) ?? /* @__PURE__ */ r("p", { className: "muted", children: [
828
836
  /* @__PURE__ */ t("code", { children: e }),
829
837
  " is not used by this project's definitions and has no calls in the last ",
830
- i,
838
+ a,
831
839
  " days."
832
840
  ] }),
833
- /* @__PURE__ */ t(nn, { backHref: s, onBack: a })
841
+ /* @__PURE__ */ t(la, { backHref: s, onBack: i })
834
842
  ] }),
835
- d && /* @__PURE__ */ l(D, { children: [
836
- /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
837
- /* @__PURE__ */ l(
843
+ d && /* @__PURE__ */ r(Q, { children: [
844
+ /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
845
+ /* @__PURE__ */ r(
838
846
  "div",
839
847
  {
840
848
  style: {
@@ -844,88 +852,88 @@ function Xn({
844
852
  marginBottom: "var(--w6w-sp-3)"
845
853
  },
846
854
  children: [
847
- /* @__PURE__ */ t(Z, { state: d.state }),
855
+ /* @__PURE__ */ t(ue, { state: d.state }),
848
856
  /* @__PURE__ */ t("span", { className: "muted small", children: "from your calls" }),
849
857
  /* @__PURE__ */ t("code", { className: "muted small", children: d.appId }),
850
858
  d.ongoingOutageId && /* @__PURE__ */ t("span", { className: "w6w-rel-tag", children: "outage still open" })
851
859
  ]
852
860
  }
853
861
  ),
854
- /* @__PURE__ */ l("div", { style: { display: "flex", gap: "var(--w6w-sp-3)", flexWrap: "wrap" }, children: [
855
- /* @__PURE__ */ t(Y, { label: "Calls in window", value: String(d.calls) }),
862
+ /* @__PURE__ */ r("div", { style: { display: "flex", gap: "var(--w6w-sp-3)", flexWrap: "wrap" }, children: [
863
+ /* @__PURE__ */ t(de, { label: "Calls in window", value: String(d.calls) }),
856
864
  /* @__PURE__ */ t(
857
- Y,
865
+ de,
858
866
  {
859
867
  label: "p95 latency",
860
868
  value: d.p95Ms === null ? "—" : `${d.p95Ms} ms`,
861
869
  hint: d.p95Ms === null ? "no timed calls" : void 0
862
870
  }
863
871
  ),
864
- /* @__PURE__ */ t(Y, { label: "Last call", value: oe(d.lastCallAt) }),
872
+ /* @__PURE__ */ t(de, { label: "Last call", value: Le(d.lastCallAt) }),
865
873
  /* @__PURE__ */ t(
866
- Y,
874
+ de,
867
875
  {
868
876
  label: "Errors",
869
- value: String(Q.reduce((m, [p]) => m + d.errors[p], 0)),
870
- hint: Q.filter(([m]) => d.errors[m] > 0).map(([m, p]) => `${p} ×${d.errors[m]}`).join(" · ") || "none"
877
+ value: String(ie.reduce((w, [y]) => w + d.errors[y], 0)),
878
+ hint: ie.filter(([w]) => d.errors[w] > 0).map(([w, y]) => `${y} ×${d.errors[w]}`).join(" · ") || "none"
871
879
  }
872
880
  )
873
881
  ] })
874
882
  ] }),
875
- /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
883
+ /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
876
884
  /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "Error mix" }),
877
- /* @__PURE__ */ t(en, { errors: d.errors })
885
+ /* @__PURE__ */ t(sa, { errors: d.errors })
878
886
  ] }),
879
- /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
887
+ /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
880
888
  /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "API status" }),
881
- /* @__PURE__ */ t(zt, { vendor: d.vendorStatus, displayName: d.displayName })
889
+ /* @__PURE__ */ t(na, { vendor: d.vendorStatus, displayName: d.displayName })
882
890
  ] }),
883
- /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
884
- /* @__PURE__ */ l("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
891
+ /* @__PURE__ */ r("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
892
+ /* @__PURE__ */ r("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
885
893
  "Last ",
886
- ((k = h.data) == null ? void 0 : k.window.days) ?? i,
894
+ ((b = m.data) == null ? void 0 : b.window.days) ?? a,
887
895
  " days",
888
896
  " ",
889
- /* @__PURE__ */ l("span", { className: "muted small", children: [
897
+ /* @__PURE__ */ r("span", { className: "muted small", children: [
890
898
  "uptime means ",
891
- (b = h.data) == null ? void 0 : b.uptimeMeans
899
+ (D = m.data) == null ? void 0 : D.uptimeMeans
892
900
  ] })
893
901
  ] }),
894
- /* @__PURE__ */ t(Xt, { service: d, window: ((g = h.data) == null ? void 0 : g.window) ?? { from: "", to: "" } }),
895
- /* @__PURE__ */ t(Gt, { service: d })
902
+ /* @__PURE__ */ t(ia, { service: d, window: ((g = m.data) == null ? void 0 : g.window) ?? { from: "", to: "" } }),
903
+ /* @__PURE__ */ t(aa, { service: d })
896
904
  ] }),
897
- /* @__PURE__ */ l("section", { children: [
898
- /* @__PURE__ */ l("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
905
+ /* @__PURE__ */ r("section", { children: [
906
+ /* @__PURE__ */ r("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
899
907
  "Recent calls",
900
908
  " ",
901
909
  /* @__PURE__ */ t("span", { className: "muted small", children: "the requests behind the numbers above" })
902
910
  ] }),
903
- /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(tn, { project: c, appId: d.appId }) })
911
+ /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(ra, { project: c, appId: d.appId }) })
904
912
  ] })
905
913
  ] })
906
914
  ] });
907
915
  }
908
- function an(e) {
916
+ function oa(e) {
909
917
  if (typeof e == "string") return e;
910
918
  if (e && typeof e == "object") {
911
919
  const n = e;
912
- for (const i of ["stepId", "step", "id", "nodeId", "key"])
913
- if (typeof n[i] == "string") return n[i];
920
+ for (const a of ["stepId", "step", "id", "nodeId", "key"])
921
+ if (typeof n[a] == "string") return n[a];
914
922
  }
915
923
  return String(e);
916
924
  }
917
- function sn({
925
+ function ca({
918
926
  routes: e,
919
927
  projectId: n
920
928
  }) {
921
- const [i, s] = C(null), a = e.find((o) => o.id === i);
922
- return e.length === 0 ? null : /* @__PURE__ */ l(D, { children: [
923
- /* @__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: [
929
+ const [a, s] = f(null), i = e.find((o) => o.id === a);
930
+ return e.length === 0 ? null : /* @__PURE__ */ r(Q, { children: [
931
+ /* @__PURE__ */ t("ul", { className: "list small", "data-testid": "connection-dependent-routes", children: e.map((o) => /* @__PURE__ */ r("li", { "data-testid": `connection-dependent-route-${o.id}`, children: [
924
932
  /* @__PURE__ */ t("span", { className: "badge", children: "route" }),
925
933
  " ",
926
934
  /* @__PURE__ */ t("span", { children: o.name }),
927
935
  " ",
928
- o.status === "broken" && /* @__PURE__ */ l(D, { children: [
936
+ o.status === "broken" && /* @__PURE__ */ r(Q, { children: [
929
937
  /* @__PURE__ */ t("span", { className: "tag warn", children: "broken" }),
930
938
  " ",
931
939
  /* @__PURE__ */ t(
@@ -940,158 +948,158 @@ function sn({
940
948
  )
941
949
  ] })
942
950
  ] }, o.id)) }),
943
- a != null && /* @__PURE__ */ t(
944
- ln,
951
+ i != null && /* @__PURE__ */ t(
952
+ da,
945
953
  {
946
- routeId: a.id,
947
- projectId: a.project ?? n,
954
+ routeId: i.id,
955
+ projectId: i.project ?? n,
948
956
  onDone: () => s(null)
949
957
  }
950
958
  )
951
959
  ] });
952
960
  }
953
- function ln(e) {
954
- return /* @__PURE__ */ l("div", { "data-testid": "connection-route-reconnect-host", children: [
955
- /* @__PURE__ */ t(kt, { projectId: e.projectId, initialEditRouteId: e.routeId }),
961
+ function da(e) {
962
+ return /* @__PURE__ */ r("div", { "data-testid": "connection-route-reconnect-host", children: [
963
+ /* @__PURE__ */ t(yn, { projectId: e.projectId, initialEditRouteId: e.routeId }),
956
964
  /* @__PURE__ */ t("button", { type: "button", className: "btn link", onClick: e.onDone, children: "Done" })
957
965
  ] });
958
966
  }
959
- function Pe({
967
+ function ct({
960
968
  callables: e,
961
969
  onOpenCallable: n,
962
- routes: i,
970
+ routes: a,
963
971
  projectId: s
964
972
  }) {
965
- return /* @__PURE__ */ l(D, { children: [
966
- /* @__PURE__ */ t(sn, { routes: i ?? [], projectId: s }),
967
- /* @__PURE__ */ t(rn, { callables: e, onOpenCallable: n })
973
+ return /* @__PURE__ */ r(Q, { children: [
974
+ /* @__PURE__ */ t(ca, { routes: a ?? [], projectId: s }),
975
+ /* @__PURE__ */ t(ua, { callables: e, onOpenCallable: n })
968
976
  ] });
969
977
  }
970
- function rn({
978
+ function ua({
971
979
  callables: e,
972
980
  onOpenCallable: n
973
981
  }) {
974
- return /* @__PURE__ */ t("ul", { className: "list small", children: e.map((i) => {
975
- const s = i.displayName || i.key || i.id, a = i.sites.map(an);
976
- return /* @__PURE__ */ l("li", { children: [
977
- /* @__PURE__ */ t("span", { className: "badge", children: i.kind }),
982
+ return /* @__PURE__ */ t("ul", { className: "list small", children: e.map((a) => {
983
+ const s = a.displayName || a.key || a.id, i = a.sites.map(oa);
984
+ return /* @__PURE__ */ r("li", { children: [
985
+ /* @__PURE__ */ t("span", { className: "badge", children: a.kind }),
978
986
  " ",
979
987
  n ? /* @__PURE__ */ t(
980
988
  "button",
981
989
  {
982
990
  type: "button",
983
991
  className: "btn link",
984
- onClick: () => n(i.kind, i.id),
992
+ onClick: () => n(a.kind, a.id),
985
993
  children: s
986
994
  }
987
995
  ) : /* @__PURE__ */ t("span", { children: s }),
988
- !i.enabled && /* @__PURE__ */ t("span", { className: "muted", children: " (disabled)" }),
989
- a.length > 0 && /* @__PURE__ */ l("span", { className: "muted", children: [
996
+ !a.enabled && /* @__PURE__ */ t("span", { className: "muted", children: " (disabled)" }),
997
+ i.length > 0 && /* @__PURE__ */ r("span", { className: "muted", children: [
990
998
  " · ",
991
- a.join(", ")
999
+ i.join(", ")
992
1000
  ] })
993
- ] }, `${i.kind}:${i.id}`);
1001
+ ] }, `${a.kind}:${a.id}`);
994
1002
  }) });
995
1003
  }
996
- const on = [];
997
- function ea({
1004
+ const ma = [];
1005
+ function ui({
998
1006
  onOpen: e,
999
1007
  getHref: n,
1000
- addLabel: i,
1008
+ addLabel: a,
1001
1009
  slots: s,
1002
- onOpenCallable: a
1010
+ onOpenCallable: i
1003
1011
  }) {
1004
- var E, j;
1005
- const o = ge(), r = Ce(), c = Nt(), w = c.data ?? on, N = K(() => Ne(w), [w]), { byId: d } = ve(N), y = yt(), [k, b] = C(!1), [g, m] = C(null), [p, T] = C(null), x = q(void 0), v = Ie((p == null ? void 0 : p.id) ?? "", p !== null), O = typeof o.updateConnection == "function", R = s && "actions" in s ? s.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => b(!0), children: i ?? "+ Add connection" });
1006
- return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
1012
+ var P, A;
1013
+ const o = Fe(), l = we(), c = wn(), h = c.data ?? ma, N = ae(() => qe(h), [h]), { byId: d } = Ve(N), k = pn(), [b, D] = f(!1), [g, w] = f(null), [y, I] = f(null), S = G(void 0), $ = Ye((y == null ? void 0 : y.id) ?? "", y !== null), T = typeof o.updateConnection == "function", j = s && "actions" in s ? s.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => D(!0), children: a ?? "+ Add connection" });
1014
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
1007
1015
  /* @__PURE__ */ t(
1008
- Ze,
1016
+ Ct,
1009
1017
  {
1010
- connections: w,
1018
+ connections: h,
1011
1019
  appsById: d,
1012
1020
  loading: c.isLoading,
1013
1021
  error: c.error ? c.error.message : null,
1014
1022
  onOpen: e,
1015
1023
  getHref: n,
1016
- onEdit: O ? m : void 0,
1017
- onDelete: T,
1018
- busy: y.isPending,
1019
- slots: { ...s, actions: R }
1024
+ onEdit: T ? w : void 0,
1025
+ onDelete: I,
1026
+ busy: k.isPending,
1027
+ slots: { ...s, actions: j }
1020
1028
  }
1021
1029
  ),
1022
- k && /* @__PURE__ */ t(
1023
- Je,
1030
+ b && /* @__PURE__ */ t(
1031
+ Dt,
1024
1032
  {
1025
- onClose: () => b(!1),
1033
+ onClose: () => D(!1),
1026
1034
  onCreated: () => {
1027
- b(!1), r.invalidateQueries({ queryKey: ne });
1035
+ D(!1), l.invalidateQueries({ queryKey: be });
1028
1036
  }
1029
1037
  }
1030
1038
  ),
1031
1039
  g && /* @__PURE__ */ t(
1032
- ye,
1040
+ _e,
1033
1041
  {
1034
1042
  connection: g,
1035
- onClose: () => m(null),
1043
+ onClose: () => w(null),
1036
1044
  onSaved: () => {
1037
- const M = g.id;
1038
- m(null), r.invalidateQueries({ queryKey: ne }), r.invalidateQueries({ queryKey: Te(M) });
1045
+ const R = g.id;
1046
+ w(null), l.invalidateQueries({ queryKey: be }), l.invalidateQueries({ queryKey: ze(R) });
1039
1047
  }
1040
1048
  }
1041
1049
  ),
1042
- p && /* @__PURE__ */ t(
1043
- cn,
1050
+ y && /* @__PURE__ */ t(
1051
+ ha,
1044
1052
  {
1045
- name: p.displayName || p.id,
1046
- loading: v.isLoading,
1047
- callables: v.isError ? [] : ((E = v.data) == null ? void 0 : E.callables) ?? [],
1048
- routes: v.isError ? [] : ((j = v.data) == null ? void 0 : j.routes) ?? [],
1049
- projectId: x,
1050
- onOpenCallable: a,
1051
- onClose: () => T(null),
1053
+ name: y.displayName || y.id,
1054
+ loading: $.isLoading,
1055
+ callables: $.isError ? [] : ((P = $.data) == null ? void 0 : P.callables) ?? [],
1056
+ routes: $.isError ? [] : ((A = $.data) == null ? void 0 : A.routes) ?? [],
1057
+ projectId: S,
1058
+ onOpenCallable: i,
1059
+ onClose: () => I(null),
1052
1060
  onConfirm: () => {
1053
- const M = p.id;
1054
- T(null), y.mutate({ id: M, force: !0 });
1061
+ const R = y.id;
1062
+ I(null), k.mutate({ id: R, force: !0 });
1055
1063
  }
1056
1064
  }
1057
1065
  )
1058
1066
  ] });
1059
1067
  }
1060
- function cn({
1068
+ function ha({
1061
1069
  name: e,
1062
1070
  loading: n,
1063
- callables: i,
1071
+ callables: a,
1064
1072
  routes: s,
1065
- projectId: a,
1073
+ projectId: i,
1066
1074
  onOpenCallable: o,
1067
- onClose: r,
1075
+ onClose: l,
1068
1076
  onConfirm: c
1069
1077
  }) {
1070
- const h = i.length, w = s.length, N = h + w, d = `Delete the connection "${e}"? This cannot be undone.`, y = (g, m, p) => `${g} ${g === 1 ? m : p}`, k = [
1071
- h > 0 ? y(h, "callable", "callables") : null,
1072
- w > 0 ? y(w, "model route", "model routes") : null
1073
- ].filter(Boolean).join(" and "), b = [
1074
- h > 0 ? `Deleting disables ${h === 1 ? "this callable" : `these ${h} callables`} until you reconnect ${h === 1 ? "it" : "them"}.` : null,
1075
- w > 0 ? `${w === 1 ? "The model route becomes" : `The ${w} model routes become`} broken until ${w === 1 ? "it is" : "they are"} pointed at another connection.` : null
1078
+ const m = a.length, h = s.length, N = m + h, d = `Delete the connection "${e}"? This cannot be undone.`, k = (g, w, y) => `${g} ${g === 1 ? w : y}`, b = [
1079
+ m > 0 ? k(m, "callable", "callables") : null,
1080
+ h > 0 ? k(h, "model route", "model routes") : null
1081
+ ].filter(Boolean).join(" and "), D = [
1082
+ m > 0 ? `Deleting disables ${m === 1 ? "this callable" : `these ${m} callables`} until you reconnect ${m === 1 ? "it" : "them"}.` : null,
1083
+ 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
1076
1084
  ].filter((g) => g != null);
1077
- return /* @__PURE__ */ l(ze, { title: "Delete connection", onClose: r, children: [
1078
- /* @__PURE__ */ l("div", { className: "w6w-modal-body", children: [
1079
- /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: N === 0 ? d : `Delete the connection "${e}"? Used by ${k}.` }),
1080
- N > 0 && /* @__PURE__ */ l(D, { children: [
1085
+ return /* @__PURE__ */ r($t, { title: "Delete connection", onClose: l, children: [
1086
+ /* @__PURE__ */ r("div", { className: "w6w-modal-body", children: [
1087
+ /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: N === 0 ? d : `Delete the connection "${e}"? Used by ${b}.` }),
1088
+ N > 0 && /* @__PURE__ */ r(Q, { children: [
1081
1089
  /* @__PURE__ */ t(
1082
- Pe,
1090
+ ct,
1083
1091
  {
1084
- callables: i,
1092
+ callables: a,
1085
1093
  routes: s,
1086
- projectId: a,
1094
+ projectId: i,
1087
1095
  onOpenCallable: o
1088
1096
  }
1089
1097
  ),
1090
- /* @__PURE__ */ t("p", { className: "w6w-small", children: b.join(" ") })
1098
+ /* @__PURE__ */ t("p", { className: "w6w-small", children: D.join(" ") })
1091
1099
  ] })
1092
1100
  ] }),
1093
- /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
1094
- /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: r, children: "Cancel" }),
1101
+ /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
1102
+ /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: l, children: "Cancel" }),
1095
1103
  /* @__PURE__ */ t(
1096
1104
  "button",
1097
1105
  {
@@ -1105,270 +1113,270 @@ function cn({
1105
1113
  ] })
1106
1114
  ] });
1107
1115
  }
1108
- function ee(e) {
1116
+ function ve(e) {
1109
1117
  const n = new Date(e).getTime();
1110
1118
  if (Number.isNaN(n)) return "recently";
1111
- const i = Math.max(0, Math.round((Date.now() - n) / 1e3));
1112
- if (i < 45) return "just now";
1113
- const s = Math.round(i / 60);
1119
+ const a = Math.max(0, Math.round((Date.now() - n) / 1e3));
1120
+ if (a < 45) return "just now";
1121
+ const s = Math.round(a / 60);
1114
1122
  if (s < 60) return `${s}m ago`;
1115
- const a = Math.round(s / 60);
1116
- if (a < 24) return `${a}h ago`;
1117
- const o = Math.round(a / 24);
1123
+ const i = Math.round(s / 60);
1124
+ if (i < 24) return `${i}h ago`;
1125
+ const o = Math.round(i / 24);
1118
1126
  return o < 30 ? `${o}d ago` : new Date(e).toLocaleDateString();
1119
1127
  }
1120
- const dn = {
1128
+ const wa = {
1121
1129
  ok: 6e3,
1122
1130
  warn: 1e4,
1123
1131
  error: 15e3
1124
- }, un = { ok: "✓", warn: "!", error: "✕" };
1125
- function ta({
1132
+ }, pa = { ok: "✓", warn: "!", error: "✕" };
1133
+ function mi({
1126
1134
  connectionId: e,
1127
1135
  onOpenAction: n,
1128
- onBack: i,
1136
+ onBack: a,
1129
1137
  onOpenCallable: s,
1130
- slots: a
1138
+ slots: i
1131
1139
  }) {
1132
- var V;
1133
- const o = ge(), r = Ce(), c = bt(e), h = (V = c.data) == null ? void 0 : V.appId, w = K(
1134
- () => Ne(c.data ? [c.data] : []),
1140
+ var U;
1141
+ const o = Fe(), l = we(), c = fn(e), m = (U = c.data) == null ? void 0 : U.appId, h = ae(
1142
+ () => qe(c.data ? [c.data] : []),
1135
1143
  [c.data]
1136
- ), { byId: N } = ve(w), d = c.data ? Ge(c.data, N) : void 0, y = Ct(h, !!h), k = mt(e), b = K(() => {
1137
- const u = /* @__PURE__ */ new Map();
1138
- for (const $ of k.data ?? []) {
1139
- const I = u.get($.actionKey) ?? [];
1140
- I.push($), u.set($.actionKey, I);
1144
+ ), { byId: N } = Ve(h), d = c.data ? Tt(c.data, N) : void 0, k = vn(m, !!m), b = rn(e), D = ae(() => {
1145
+ const p = /* @__PURE__ */ new Map();
1146
+ for (const E of b.data ?? []) {
1147
+ const x = p.get(E.actionKey) ?? [];
1148
+ x.push(E), p.set(E.actionKey, x);
1141
1149
  }
1142
- return u;
1143
- }, [k.data]), g = Ie(e).data, m = q(void 0), p = (g == null ? void 0 : g.callables) ?? [], T = (g == null ? void 0 : g.routes) ?? [], x = ht(e).data ?? [], [v, O] = C(!1), [R, E] = C(""), j = vt(e), [M, S] = C(null);
1144
- Oe(() => {
1145
- if (!M) return;
1146
- const u = setTimeout(() => S(null), dn[M.kind]);
1147
- return () => clearTimeout(u);
1148
- }, [M]);
1149
- const U = () => {
1150
- S(null), j.mutate(void 0, {
1151
- onSuccess: (u) => {
1152
- var $;
1153
- if (!u.ok) {
1154
- S({
1150
+ return p;
1151
+ }, [b.data]), g = Ye(e).data, w = G(void 0), y = (g == null ? void 0 : g.callables) ?? [], I = (g == null ? void 0 : g.routes) ?? [], S = ln(e).data ?? [], [$, T] = f(!1), [j, P] = f(""), A = gn(e), [R, F] = f(null);
1152
+ ut(() => {
1153
+ if (!R) return;
1154
+ const p = setTimeout(() => F(null), wa[R.kind]);
1155
+ return () => clearTimeout(p);
1156
+ }, [R]);
1157
+ const H = () => {
1158
+ F(null), A.mutate(void 0, {
1159
+ onSuccess: (p) => {
1160
+ var E;
1161
+ if (!p.ok) {
1162
+ F({
1155
1163
  kind: "error",
1156
- text: `Connection test failed${($ = u.error) != null && $.message ? `: ${u.error.message}` : "."}`
1164
+ text: `Connection test failed${(E = p.error) != null && E.message ? `: ${p.error.message}` : "."}`
1157
1165
  });
1158
1166
  return;
1159
1167
  }
1160
- S(
1161
- u.untested ? { kind: "warn", text: `Connection stored. ${u.message ?? ""}`.trim() } : {
1168
+ F(
1169
+ p.untested ? { kind: "warn", text: `Connection stored. ${p.message ?? ""}`.trim() } : {
1162
1170
  kind: "ok",
1163
- text: `Connection is valid${u.actionKey ? ` — probed ${u.actionKey}` : ""}.`
1171
+ text: `Connection is valid${p.actionKey ? ` — probed ${p.actionKey}` : ""}.`
1164
1172
  }
1165
1173
  );
1166
1174
  },
1167
- onError: (u) => S({ kind: "error", text: (u == null ? void 0 : u.message) ?? "Test failed." })
1175
+ onError: (p) => F({ kind: "error", text: (p == null ? void 0 : p.message) ?? "Test failed." })
1168
1176
  });
1169
- }, L = K(() => {
1170
- var $;
1171
- const u = [...(($ = y.data) == null ? void 0 : $.actions) ?? []];
1172
- return u.sort((I, f) => (I.title || I.key).localeCompare(f.title || f.key)), u;
1173
- }, [y.data]), B = K(() => {
1174
- const u = R.trim().toLowerCase();
1175
- return u ? L.filter(
1176
- ($) => ($.title || "").toLowerCase().includes(u) || $.key.toLowerCase().includes(u) || ($.description || "").toLowerCase().includes(u)
1177
+ }, L = ae(() => {
1178
+ var E;
1179
+ const p = [...((E = k.data) == null ? void 0 : E.actions) ?? []];
1180
+ return p.sort((x, C) => (x.title || x.key).localeCompare(C.title || C.key)), p;
1181
+ }, [k.data]), J = ae(() => {
1182
+ const p = j.trim().toLowerCase();
1183
+ return p ? L.filter(
1184
+ (E) => (E.title || "").toLowerCase().includes(p) || E.key.toLowerCase().includes(p) || (E.description || "").toLowerCase().includes(p)
1177
1185
  ) : L;
1178
- }, [L, R]);
1179
- if (c.isLoading || y.isLoading)
1186
+ }, [L, j]);
1187
+ if (c.isLoading || k.isLoading)
1180
1188
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-conn-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
1181
1189
  if (!c.data)
1182
- return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-conn-detail", "data-testid": "connection-not-found", children: [
1183
- (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
1184
- i && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: i, children: "Back to integrations" })
1190
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-conn-detail", "data-testid": "connection-not-found", children: [
1191
+ (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
1192
+ a && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: a, children: "Back to integrations" })
1185
1193
  ] });
1186
- const P = c.data, F = y.data, z = !P.builtIn && typeof o.updateConnection == "function";
1187
- return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-conn-detail w6w-card-stack", children: [
1188
- (a == null ? void 0 : a.header) ?? /* @__PURE__ */ l(Xe, { conn: P, app: d, children: [
1194
+ const K = c.data, B = k.data, Y = !K.builtIn && typeof o.updateConnection == "function";
1195
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-conn-detail w6w-card-stack", children: [
1196
+ (i == null ? void 0 : i.header) ?? /* @__PURE__ */ r(Lt, { conn: K, app: d, children: [
1189
1197
  /* @__PURE__ */ t(
1190
1198
  "button",
1191
1199
  {
1192
1200
  type: "button",
1193
1201
  className: "w6w-btn w6w-btn-ghost",
1194
- disabled: j.isPending,
1195
- onClick: U,
1196
- children: j.isPending ? "Testing…" : "Test connection"
1202
+ disabled: A.isPending,
1203
+ onClick: H,
1204
+ children: A.isPending ? "Testing…" : "Test connection"
1197
1205
  }
1198
1206
  ),
1199
- z && /* @__PURE__ */ t(
1200
- fe,
1207
+ Y && /* @__PURE__ */ t(
1208
+ Qe,
1201
1209
  {
1202
1210
  label: "Edit",
1203
- onClick: () => O(!0),
1211
+ onClick: () => T(!0),
1204
1212
  "data-testid": "connection-detail-edit"
1205
1213
  }
1206
1214
  ),
1207
- a == null ? void 0 : a.actions
1215
+ i == null ? void 0 : i.actions
1208
1216
  ] }),
1209
- M && /* @__PURE__ */ l(
1217
+ R && /* @__PURE__ */ r(
1210
1218
  "div",
1211
1219
  {
1212
- className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${M.kind}`,
1213
- role: M.kind === "error" ? "alert" : "status",
1214
- "aria-live": M.kind === "error" ? "assertive" : "polite",
1220
+ className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${R.kind}`,
1221
+ role: R.kind === "error" ? "alert" : "status",
1222
+ "aria-live": R.kind === "error" ? "assertive" : "polite",
1215
1223
  "data-testid": "connection-test-notice",
1216
1224
  children: [
1217
- /* @__PURE__ */ t("span", { "aria-hidden": "true", children: un[M.kind] }),
1218
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: M.text }),
1219
- /* @__PURE__ */ t(et, { icon: "close", label: "Dismiss", onClick: () => S(null) })
1225
+ /* @__PURE__ */ t("span", { "aria-hidden": "true", children: pa[R.kind] }),
1226
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: R.text }),
1227
+ /* @__PURE__ */ t(Mt, { icon: "close", label: "Dismiss", onClick: () => F(null) })
1220
1228
  ]
1221
1229
  }
1222
1230
  ),
1223
- /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1224
- /* @__PURE__ */ l("h3", { children: [
1231
+ /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1232
+ /* @__PURE__ */ r("h3", { children: [
1225
1233
  "App: ",
1226
- (d == null ? void 0 : d.displayName) ?? P.appId
1234
+ (d == null ? void 0 : d.displayName) ?? K.appId
1227
1235
  ] }),
1228
- F && /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1236
+ B && /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1229
1237
  "Version ",
1230
- /* @__PURE__ */ l("code", { children: [
1238
+ /* @__PURE__ */ r("code", { children: [
1231
1239
  "v",
1232
- F.version ?? "?"
1240
+ B.version ?? "?"
1233
1241
  ] }),
1234
1242
  " · source ",
1235
- /* @__PURE__ */ t("code", { children: F.sourceRef })
1243
+ /* @__PURE__ */ t("code", { children: B.sourceRef })
1236
1244
  ] }),
1237
- i && /* @__PURE__ */ t("p", { className: "w6w-small", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: i, children: "← Integrations" }) })
1245
+ a && /* @__PURE__ */ t("p", { className: "w6w-small", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: a, children: "← Integrations" }) })
1238
1246
  ] }),
1239
- /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1247
+ /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1240
1248
  /* @__PURE__ */ t("h3", { children: "Actions" }),
1241
1249
  L.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
1242
1250
  L.length > 10 && /* @__PURE__ */ t(
1243
1251
  "input",
1244
1252
  {
1245
1253
  type: "search",
1246
- value: R,
1254
+ value: j,
1247
1255
  placeholder: `Search ${L.length} actions…`,
1248
- onChange: (u) => E(u.target.value),
1256
+ onChange: (p) => P(p.target.value),
1249
1257
  "aria-label": "Filter actions",
1250
1258
  className: "w6w-embed-conn-filter"
1251
1259
  }
1252
1260
  ),
1253
- L.length > 0 && B.length === 0 && /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1261
+ L.length > 0 && J.length === 0 && /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1254
1262
  "No actions match “",
1255
- R,
1263
+ j,
1256
1264
  "”."
1257
1265
  ] }),
1258
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: B.map((u) => {
1259
- const $ = b.get(u.key) ?? [];
1260
- return /* @__PURE__ */ l("li", { children: [
1261
- /* @__PURE__ */ l(
1266
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: J.map((p) => {
1267
+ const E = D.get(p.key) ?? [];
1268
+ return /* @__PURE__ */ r("li", { children: [
1269
+ /* @__PURE__ */ r(
1262
1270
  "button",
1263
1271
  {
1264
1272
  type: "button",
1265
1273
  className: "w6w-embed-conn-action",
1266
- "data-testid": `connection-action-${u.key}`,
1267
- onClick: () => n(u.key),
1274
+ "data-testid": `connection-action-${p.key}`,
1275
+ onClick: () => n(p.key),
1268
1276
  children: [
1269
- /* @__PURE__ */ t("strong", { children: u.title }),
1277
+ /* @__PURE__ */ t("strong", { children: p.title }),
1270
1278
  " ",
1271
- /* @__PURE__ */ t("code", { className: "w6w-muted", children: u.key }),
1279
+ /* @__PURE__ */ t("code", { className: "w6w-muted", children: p.key }),
1272
1280
  " ",
1273
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: u.type }),
1274
- u.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: u.description })
1281
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: p.type }),
1282
+ p.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: p.description })
1275
1283
  ]
1276
1284
  }
1277
1285
  ),
1278
- $.length > 0 && /* @__PURE__ */ t(
1286
+ E.length > 0 && /* @__PURE__ */ t(
1279
1287
  "ul",
1280
1288
  {
1281
1289
  className: "w6w-embed-conn-list w6w-embed-conn-tests",
1282
- "aria-label": `Saved tests for ${u.title || u.key}`,
1283
- children: $.map((I) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1284
- te,
1290
+ "aria-label": `Saved tests for ${p.title || p.key}`,
1291
+ children: E.map((x) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1292
+ Ne,
1285
1293
  {
1286
- title: I.name,
1287
- subtitle: I.lastRunAt ? /* @__PURE__ */ l("span", { children: [
1294
+ title: x.name,
1295
+ subtitle: x.lastRunAt ? /* @__PURE__ */ r("span", { children: [
1288
1296
  /* @__PURE__ */ t(
1289
1297
  "span",
1290
1298
  {
1291
- className: I.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1292
- children: I.lastRunOk ? "✓" : "✗"
1299
+ className: x.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1300
+ children: x.lastRunOk ? "✓" : "✗"
1293
1301
  }
1294
1302
  ),
1295
1303
  " ",
1296
- I.lastRunSummary ? `${I.lastRunSummary} · ` : "",
1297
- ee(I.lastRunAt)
1298
- ] }) : `saved ${ee(I.updatedAt)}`,
1299
- onClick: () => n(u.key, I.id)
1304
+ x.lastRunSummary ? `${x.lastRunSummary} · ` : "",
1305
+ ve(x.lastRunAt)
1306
+ ] }) : `saved ${ve(x.updatedAt)}`,
1307
+ onClick: () => n(p.key, x.id)
1300
1308
  }
1301
- ) }, I.id))
1309
+ ) }, x.id))
1302
1310
  }
1303
1311
  )
1304
- ] }, u.key);
1312
+ ] }, p.key);
1305
1313
  }) })
1306
1314
  ] }),
1307
- g && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "connection-used-by", children: [
1315
+ g && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "connection-used-by", children: [
1308
1316
  /* @__PURE__ */ t("h3", { children: "Used by" }),
1309
- p.length === 0 && T.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
1310
- Pe,
1317
+ y.length === 0 && I.length === 0 ? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Not used by any callable" }) : /* @__PURE__ */ t(
1318
+ ct,
1311
1319
  {
1312
- callables: p,
1313
- routes: T,
1314
- projectId: m,
1320
+ callables: y,
1321
+ routes: I,
1322
+ projectId: w,
1315
1323
  onOpenCallable: s
1316
1324
  }
1317
1325
  )
1318
1326
  ] }),
1319
- x.length > 0 && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1327
+ S.length > 0 && /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1320
1328
  /* @__PURE__ */ t("h3", { children: "Recent runs" }),
1321
1329
  /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Most recent tester runs against this connection." }),
1322
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: x.map((u) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1323
- te,
1330
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: S.map((p) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1331
+ Ne,
1324
1332
  {
1325
- title: u.actionKey,
1326
- subtitle: /* @__PURE__ */ l("span", { children: [
1327
- /* @__PURE__ */ t("span", { className: u.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: u.ok ? "✓" : "✗" }),
1333
+ title: p.actionKey,
1334
+ subtitle: /* @__PURE__ */ r("span", { children: [
1335
+ /* @__PURE__ */ t("span", { className: p.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: p.ok ? "✓" : "✗" }),
1328
1336
  " ",
1329
- u.summary ? `${u.summary} · ` : "",
1330
- ee(u.occurredAt)
1337
+ p.summary ? `${p.summary} · ` : "",
1338
+ ve(p.occurredAt)
1331
1339
  ] })
1332
1340
  }
1333
- ) }, u.id)) })
1341
+ ) }, p.id)) })
1334
1342
  ] }),
1335
- v && /* @__PURE__ */ t(
1336
- ye,
1343
+ $ && /* @__PURE__ */ t(
1344
+ _e,
1337
1345
  {
1338
- connection: P,
1339
- onClose: () => O(!1),
1346
+ connection: K,
1347
+ onClose: () => T(!1),
1340
1348
  onSaved: () => {
1341
- O(!1), r.invalidateQueries({ queryKey: Te(e) }), r.invalidateQueries({ queryKey: ne });
1349
+ T(!1), l.invalidateQueries({ queryKey: ze(e) }), l.invalidateQueries({ queryKey: be });
1342
1350
  }
1343
1351
  }
1344
1352
  )
1345
1353
  ] });
1346
1354
  }
1347
- const mn = {};
1348
- function he(e) {
1355
+ const fa = {};
1356
+ function Pe(e) {
1349
1357
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1350
1358
  }
1351
- function H(e) {
1359
+ function le(e) {
1352
1360
  return (e / 100).toFixed(2);
1353
1361
  }
1354
- function hn(e) {
1362
+ function ga(e) {
1355
1363
  if (e == null) return null;
1356
- const n = e.rates, i = [];
1357
- return n.input != null && i.push(`in ${H(n.input)}`), n.output != null && i.push(`out ${H(n.output)}`), n.cachedInput != null && i.push(`cached ${H(n.cachedInput)}`), n.cacheWrite != null && i.push(`cache write ${H(n.cacheWrite)}`), n.perRequest != null && i.push(`${H(n.perRequest)}/request`), i.length === 0 ? null : `${n.currency ?? "USD"} ${i.join(" · ")}`;
1364
+ const n = e.rates, a = [];
1365
+ return n.input != null && a.push(`in ${le(n.input)}`), n.output != null && a.push(`out ${le(n.output)}`), n.cachedInput != null && a.push(`cached ${le(n.cachedInput)}`), n.cacheWrite != null && a.push(`cache write ${le(n.cacheWrite)}`), n.perRequest != null && a.push(`${le(n.perRequest)}/request`), a.length === 0 ? null : `${n.currency ?? "USD"} ${a.join(" · ")}`;
1358
1366
  }
1359
- function wn(e) {
1360
- const { maxInputTokens: n, maxOutputTokens: i } = e.limits ?? {};
1361
- if (n == null && i == null) return "—";
1367
+ function ya(e) {
1368
+ const { maxInputTokens: n, maxOutputTokens: a } = e.limits ?? {};
1369
+ if (n == null && a == null) return "—";
1362
1370
  const s = [];
1363
- return n != null && s.push(`${he(n)} in`), i != null && s.push(`${he(i)} out`), s.join(" · ");
1371
+ return n != null && s.push(`${Pe(n)} in`), a != null && s.push(`${Pe(a)} out`), s.join(" · ");
1364
1372
  }
1365
- const pn = [
1373
+ const va = [
1366
1374
  {
1367
1375
  key: "model",
1368
1376
  header: "Model",
1369
- render: (e) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1377
+ render: (e) => /* @__PURE__ */ r("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1370
1378
  /* @__PURE__ */ t("strong", { className: "list-name", title: e.displayName, children: e.displayName }),
1371
- /* @__PURE__ */ l("div", { className: "muted small list-preview", title: `${e.provider} · ${e.nativeId}`, children: [
1379
+ /* @__PURE__ */ r("div", { className: "muted small list-preview", title: `${e.provider} · ${e.nativeId}`, children: [
1372
1380
  e.provider,
1373
1381
  " · ",
1374
1382
  e.nativeId,
@@ -1391,7 +1399,7 @@ const pn = [
1391
1399
  key: "rate",
1392
1400
  header: "Rate (per 1M tokens)",
1393
1401
  render: (e) => {
1394
- const n = hn(e.currentRate);
1402
+ const n = ga(e.currentRate);
1395
1403
  return n == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "—" }) : /* @__PURE__ */ t(
1396
1404
  "span",
1397
1405
  {
@@ -1405,34 +1413,34 @@ const pn = [
1405
1413
  {
1406
1414
  key: "limits",
1407
1415
  header: "Limits",
1408
- render: (e) => /* @__PURE__ */ t("span", { className: "muted small", children: wn(e) })
1416
+ render: (e) => /* @__PURE__ */ t("span", { className: "muted small", children: ya(e) })
1409
1417
  }
1410
1418
  ];
1411
- function na(e) {
1419
+ function hi(e) {
1412
1420
  var o;
1413
- const n = Le(), i = e.filter ?? mn, s = $e({
1414
- queryKey: It(i),
1421
+ const n = pe(), a = e.filter ?? fa, s = Je({
1422
+ queryKey: bn(a),
1415
1423
  initialPageParam: void 0,
1416
- getNextPageParam: (r) => r.nextCursor ?? void 0,
1417
- queryFn: ({ pageParam: r }) => $t(n, r ? { ...i, cursor: r } : i)
1418
- }), a = ((o = s.data) == null ? void 0 : o.pages.flatMap((r) => r.models)) ?? [];
1419
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
1420
- /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ l("div", { children: [
1424
+ getNextPageParam: (l) => l.nextCursor ?? void 0,
1425
+ queryFn: ({ pageParam: l }) => Nn(n, l ? { ...a, cursor: l } : a)
1426
+ }), i = ((o = s.data) == null ? void 0 : o.pages.flatMap((l) => l.models)) ?? [];
1427
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
1428
+ /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ r("div", { children: [
1421
1429
  /* @__PURE__ */ t("h3", { children: "Model catalog" }),
1422
1430
  /* @__PURE__ */ t("p", { className: "muted small", children: "The models discovered on this tenant's connections, plus any added by hand. A route may only name a model from this list; the rate card is what usage is priced with." })
1423
1431
  ] }) }),
1424
- /* @__PURE__ */ l("div", { className: "card", children: [
1432
+ /* @__PURE__ */ r("div", { className: "card", children: [
1425
1433
  s.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1426
1434
  s.error != null && /* @__PURE__ */ t("div", { className: "error", children: s.error.message }),
1427
- s.isSuccess && a.length === 0 && /* @__PURE__ */ t(se, { testId: "model-catalog-empty", children: "No models yet. Discover them from a provider connection to start routing to them." }),
1428
- a.length > 0 && /* @__PURE__ */ t(
1429
- le,
1435
+ s.isSuccess && i.length === 0 && /* @__PURE__ */ t(De, { testId: "model-catalog-empty", children: "No models yet. Discover them from a provider connection to start routing to them." }),
1436
+ i.length > 0 && /* @__PURE__ */ t(
1437
+ $e,
1430
1438
  {
1431
- columns: pn,
1432
- rows: a,
1433
- rowKey: (r) => r.id,
1439
+ columns: va,
1440
+ rows: i,
1441
+ rowKey: (l) => l.id,
1434
1442
  testId: "model-catalog-table",
1435
- rowTestId: (r) => `model-catalog-${r.id}`
1443
+ rowTestId: (l) => `model-catalog-${l.id}`
1436
1444
  }
1437
1445
  )
1438
1446
  ] }),
@@ -1449,33 +1457,33 @@ function na(e) {
1449
1457
  ) })
1450
1458
  ] }) });
1451
1459
  }
1452
- const fn = {};
1453
- function A(e) {
1460
+ const Na = {};
1461
+ function W(e) {
1454
1462
  return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1455
1463
  }
1456
- function gn(e) {
1464
+ function ba(e) {
1457
1465
  return `${e.currency} ${(e.amountMinor / 100).toFixed(2)}`;
1458
1466
  }
1459
- function Nn(e, n) {
1460
- return e.length > 0 ? e.map(gn).join(" · ") : n > 0 ? "unpriced" : "—";
1467
+ function ka(e, n) {
1468
+ return e.length > 0 ? e.map(ba).join(" · ") : n > 0 ? "unpriced" : "—";
1461
1469
  }
1462
- function yn(e) {
1470
+ function Ca(e) {
1463
1471
  return e.costMinor == null ? null : `${e.currency ?? "USD"} ${(e.costMinor / 100).toFixed(2)}`;
1464
1472
  }
1465
- function bn(e) {
1473
+ function Da(e) {
1466
1474
  return e.totalsTruncated === !0;
1467
1475
  }
1468
- const vn = [
1476
+ const $a = [
1469
1477
  {
1470
1478
  key: "occurredAt",
1471
1479
  header: "When",
1472
- render: (e) => /* @__PURE__ */ t("span", { className: "muted small", title: e.occurredAt, children: xe(e.occurredAt) })
1480
+ render: (e) => /* @__PURE__ */ t("span", { className: "muted small", title: e.occurredAt, children: at(e.occurredAt) })
1473
1481
  },
1474
1482
  {
1475
1483
  key: "model",
1476
1484
  header: "Model",
1477
- render: (e) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1478
- /* @__PURE__ */ l("strong", { className: "list-name", title: `${e.provider} · ${e.nativeId}`, children: [
1485
+ render: (e) => /* @__PURE__ */ r("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1486
+ /* @__PURE__ */ r("strong", { className: "list-name", title: `${e.provider} · ${e.nativeId}`, children: [
1479
1487
  e.provider,
1480
1488
  " · ",
1481
1489
  e.nativeId
@@ -1496,8 +1504,8 @@ const vn = [
1496
1504
  "span",
1497
1505
  {
1498
1506
  className: "muted small",
1499
- title: `${A(e.inputTokens)} in · ${A(e.outputTokens)} out · ${A(e.cachedInputTokens)} cached input · ${A(e.cacheWriteTokens)} cache write`,
1500
- children: A(e.totalTokens)
1507
+ title: `${W(e.inputTokens)} in · ${W(e.outputTokens)} out · ${W(e.cachedInputTokens)} cached input · ${W(e.cacheWriteTokens)} cache write`,
1508
+ children: W(e.totalTokens)
1501
1509
  }
1502
1510
  )
1503
1511
  },
@@ -1506,7 +1514,7 @@ const vn = [
1506
1514
  header: "Cost",
1507
1515
  align: "right",
1508
1516
  render: (e) => {
1509
- const n = yn(e);
1517
+ const n = Ca(e);
1510
1518
  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 });
1511
1519
  }
1512
1520
  },
@@ -1514,10 +1522,10 @@ const vn = [
1514
1522
  key: "result",
1515
1523
  header: "Result",
1516
1524
  render: (e) => {
1517
- const n = Ae(e.durationMs);
1518
- return /* @__PURE__ */ l("span", { className: "muted small", title: e.errorCode ?? void 0, children: [
1525
+ const n = it(e.durationMs);
1526
+ return /* @__PURE__ */ r("span", { className: "muted small", title: e.errorCode ?? void 0, children: [
1519
1527
  /* @__PURE__ */ t("span", { className: e.ok ? "tag" : "tag warn", children: e.ok ? "ok" : e.errorCode ?? "failed" }),
1520
- n != null && /* @__PURE__ */ l(D, { children: [
1528
+ n != null && /* @__PURE__ */ r(Q, { children: [
1521
1529
  " · ",
1522
1530
  n
1523
1531
  ] })
@@ -1525,61 +1533,61 @@ const vn = [
1525
1533
  }
1526
1534
  }
1527
1535
  ];
1528
- function aa(e) {
1529
- var w, N;
1530
- const n = q(e.projectId), i = Le(), s = e.filter ?? fn, a = $e({
1531
- queryKey: Lt(n ?? void 0, s),
1536
+ function wi(e) {
1537
+ var h, N;
1538
+ const n = G(e.projectId), a = pe(), s = e.filter ?? Na, i = Je({
1539
+ queryKey: Cn(n ?? void 0, s),
1532
1540
  enabled: n != null,
1533
1541
  initialPageParam: void 0,
1534
1542
  getNextPageParam: (d) => d.nextCursor ?? void 0,
1535
- queryFn: ({ pageParam: d }) => Tt(
1536
- i,
1543
+ queryFn: ({ pageParam: d }) => kn(
1544
+ a,
1537
1545
  n,
1538
1546
  d ? { ...s, cursor: d } : s
1539
1547
  )
1540
- }), o = ((w = a.data) == null ? void 0 : w.pages) ?? [], r = (N = o[0]) == null ? void 0 : N.totals, c = o.flatMap((d) => d.items), h = o.length > 0 && bn(o[0]);
1541
- return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ l("section", { className: "section", children: [
1542
- /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ l("div", { children: [
1548
+ }), o = ((h = i.data) == null ? void 0 : h.pages) ?? [], l = (N = o[0]) == null ? void 0 : N.totals, c = o.flatMap((d) => d.items), m = o.length > 0 && Da(o[0]);
1549
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
1550
+ /* @__PURE__ */ t("div", { className: "section-head", children: /* @__PURE__ */ r("div", { children: [
1543
1551
  /* @__PURE__ */ t("h3", { children: "Model usage" }),
1544
1552
  /* @__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." })
1545
1553
  ] }) }),
1546
- 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(D, { children: [
1547
- /* @__PURE__ */ l("div", { className: "card", "data-testid": "model-usage-totals", children: [
1548
- h && /* @__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." }),
1549
- r == null ? (
1554
+ n == null ? /* @__PURE__ */ t("div", { className: "card", children: /* @__PURE__ */ t("p", { className: "muted", "data-testid": "model-usage-no-project", children: "Select a project to see its model usage." }) }) : /* @__PURE__ */ r(Q, { children: [
1555
+ /* @__PURE__ */ r("div", { className: "card", "data-testid": "model-usage-totals", children: [
1556
+ 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." }),
1557
+ l == null ? (
1550
1558
  // A failed query is reported once, below — never as a perpetual "loading".
1551
- a.error == null && /* @__PURE__ */ t("p", { className: "muted", children: "Loading totals…" })
1552
- ) : /* @__PURE__ */ l("p", { className: "muted small", children: [
1553
- /* @__PURE__ */ l("span", { "data-testid": "model-usage-total-requests", children: [
1554
- A(r.requests),
1559
+ i.error == null && /* @__PURE__ */ t("p", { className: "muted", children: "Loading totals…" })
1560
+ ) : /* @__PURE__ */ r("p", { className: "muted small", children: [
1561
+ /* @__PURE__ */ r("span", { "data-testid": "model-usage-total-requests", children: [
1562
+ W(l.requests),
1555
1563
  " requests"
1556
1564
  ] }),
1557
1565
  " · ",
1558
- /* @__PURE__ */ l("span", { "data-testid": "model-usage-total-tokens", children: [
1559
- A(r.totalTokens),
1566
+ /* @__PURE__ */ r("span", { "data-testid": "model-usage-total-tokens", children: [
1567
+ W(l.totalTokens),
1560
1568
  " tokens (",
1561
- A(r.inputTokens),
1569
+ W(l.inputTokens),
1562
1570
  " in /",
1563
1571
  " ",
1564
- A(r.outputTokens),
1572
+ W(l.outputTokens),
1565
1573
  " out / ",
1566
- A(r.cachedInputTokens),
1574
+ W(l.cachedInputTokens),
1567
1575
  " cached / ",
1568
- A(r.cacheWriteTokens),
1576
+ W(l.cacheWriteTokens),
1569
1577
  " cache write)"
1570
1578
  ] }),
1571
1579
  " · ",
1572
- /* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: Nn(r.cost, r.unpriced) }),
1573
- r.unpriced > 0 && /* @__PURE__ */ l(D, { children: [
1580
+ /* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: ka(l.cost, l.unpriced) }),
1581
+ l.unpriced > 0 && /* @__PURE__ */ r(Q, { children: [
1574
1582
  " · ",
1575
- /* @__PURE__ */ l(
1583
+ /* @__PURE__ */ r(
1576
1584
  "span",
1577
1585
  {
1578
1586
  className: "tag warn",
1579
1587
  "data-testid": "model-usage-unpriced-total",
1580
1588
  title: "calls with no usable rate — not included in any cost total",
1581
1589
  children: [
1582
- A(r.unpriced),
1590
+ W(l.unpriced),
1583
1591
  " unpriced"
1584
1592
  ]
1585
1593
  }
@@ -1587,14 +1595,14 @@ function aa(e) {
1587
1595
  ] })
1588
1596
  ] })
1589
1597
  ] }),
1590
- a.error != null && /* @__PURE__ */ t("div", { className: "error", role: "alert", "data-testid": "model-usage-error", children: a.error.message }),
1591
- /* @__PURE__ */ l("div", { className: "card", children: [
1592
- a.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1593
- a.isSuccess && c.length === 0 && /* @__PURE__ */ t(se, { testId: "model-usage-empty", children: "No model calls in this window. Usage rows appear here as routes are invoked." }),
1598
+ i.error != null && /* @__PURE__ */ t("div", { className: "error", role: "alert", "data-testid": "model-usage-error", children: i.error.message }),
1599
+ /* @__PURE__ */ r("div", { className: "card", children: [
1600
+ i.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1601
+ i.isSuccess && c.length === 0 && /* @__PURE__ */ t(De, { testId: "model-usage-empty", children: "No model calls in this window. Usage rows appear here as routes are invoked." }),
1594
1602
  c.length > 0 && /* @__PURE__ */ t(
1595
- le,
1603
+ $e,
1596
1604
  {
1597
- columns: vn,
1605
+ columns: $a,
1598
1606
  rows: c,
1599
1607
  rowKey: (d) => d.id,
1600
1608
  testId: "model-usage-table",
@@ -1602,31 +1610,31 @@ function aa(e) {
1602
1610
  }
1603
1611
  )
1604
1612
  ] }),
1605
- a.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1613
+ i.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1606
1614
  "button",
1607
1615
  {
1608
1616
  type: "button",
1609
1617
  className: "btn ghost",
1610
- disabled: a.isFetchingNextPage,
1611
- onClick: () => void a.fetchNextPage(),
1618
+ disabled: i.isFetchingNextPage,
1619
+ onClick: () => void i.fetchNextPage(),
1612
1620
  "data-testid": "model-usage-load-more",
1613
- children: a.isFetchingNextPage ? "Loading…" : "Load more"
1621
+ children: i.isFetchingNextPage ? "Loading…" : "Load more"
1614
1622
  }
1615
1623
  ) })
1616
1624
  ] })
1617
1625
  ] }) });
1618
1626
  }
1619
- const kn = (e) => `${e} connection${e === 1 ? "" : "s"}`;
1620
- function ia({ contract: e, onOpen: n, slots: i }) {
1621
- const s = Mt(e ? { contract: e } : void 0), a = s.data ?? [];
1622
- return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-list", children: [
1623
- (i == null ? void 0 : i.header) ?? /* @__PURE__ */ t("h2", { children: "Credentials" }),
1627
+ const Ta = (e) => `${e} connection${e === 1 ? "" : "s"}`;
1628
+ function pi({ contract: e, onOpen: n, slots: a }) {
1629
+ const s = Dn(e ? { contract: e } : void 0), i = s.data ?? [];
1630
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-list", children: [
1631
+ (a == null ? void 0 : a.header) ?? /* @__PURE__ */ t("h2", { children: "Credentials" }),
1624
1632
  s.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1625
1633
  s.error && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", children: s.error.message }),
1626
- !s.isLoading && !s.error && a.length === 0 && /* @__PURE__ */ t("div", { "data-testid": "credential-list-empty", children: (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No credentials yet." }) }),
1627
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Credentials", children: a.map((o) => {
1628
- const r = Object.values(o.display)[0];
1629
- return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l(
1634
+ !s.isLoading && !s.error && i.length === 0 && /* @__PURE__ */ t("div", { "data-testid": "credential-list-empty", children: (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No credentials yet." }) }),
1635
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Credentials", children: i.map((o) => {
1636
+ const l = Object.values(o.display)[0];
1637
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ r(
1630
1638
  "button",
1631
1639
  {
1632
1640
  type: "button",
@@ -1637,13 +1645,13 @@ function ia({ contract: e, onOpen: n, slots: i }) {
1637
1645
  /* @__PURE__ */ t("strong", { children: o.name }),
1638
1646
  " ",
1639
1647
  /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: o.status }),
1640
- r !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1648
+ l !== void 0 && /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", children: [
1641
1649
  " ",
1642
- r
1650
+ l
1643
1651
  ] }),
1644
- /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1652
+ /* @__PURE__ */ r("span", { className: "w6w-muted w6w-small", children: [
1645
1653
  " · ",
1646
- kn(o.connectionCount)
1654
+ Ta(o.connectionCount)
1647
1655
  ] })
1648
1656
  ]
1649
1657
  }
@@ -1651,7 +1659,7 @@ function ia({ contract: e, onOpen: n, slots: i }) {
1651
1659
  }) })
1652
1660
  ] });
1653
1661
  }
1654
- function Cn(e) {
1662
+ function La(e) {
1655
1663
  try {
1656
1664
  const n = JSON.parse(e);
1657
1665
  return n !== null && typeof n == "object" && !Array.isArray(n) ? n : null;
@@ -1659,112 +1667,97 @@ function Cn(e) {
1659
1667
  return null;
1660
1668
  }
1661
1669
  }
1662
- const we = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
1663
- function sa({
1670
+ const Oe = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
1671
+ function fi({
1664
1672
  credentialId: e,
1665
1673
  onOpenConnection: n,
1666
- onDeleted: i,
1674
+ onDeleted: a,
1667
1675
  onBack: s,
1668
- slots: a
1676
+ slots: i
1669
1677
  }) {
1670
- var $, I;
1671
- const o = Dt(e), r = xt(e), c = At(e), h = Rt(e), w = Et(e), N = jt(), [d, y] = C(""), [k, b] = C(null), [g, m] = C(!1), [p, T] = C(
1672
- null
1673
- ), [x, v] = C(null), [O, R] = C(!1), [E, j] = C(null), [M, S] = C(null), U = s && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "← Credentials" });
1678
+ var E, x;
1679
+ const o = $n(e), l = Tn(e), c = Ln(e), m = Mn(e), h = In(e), N = xn(), [d, k] = f(""), [b, D] = f(null), [g, w] = f(!1), [y, I] = f(null), [S, $] = f(null), [T, j] = f(!1), [P, A] = f(null), [R, F] = f(null), H = s && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "← Credentials" });
1674
1680
  if (o.isLoading)
1675
1681
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-cred-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
1676
1682
  const L = o.data;
1677
1683
  if (!L)
1678
- return /* @__PURE__ */ l(
1679
- "div",
1680
- {
1681
- className: "w6w-embed-root w6w-embed-cred-detail",
1682
- "data-testid": "credential-not-found",
1683
- children: [
1684
- (a == null ? void 0 : a.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
1685
- U
1686
- ]
1687
- }
1688
- );
1689
- const B = (($ = r.data) == null ? void 0 : $.connections) ?? [], P = L.connectionCount, F = L.status === "disabled", z = () => {
1690
- m(!1);
1691
- const f = Cn(d);
1692
- if (!f) {
1693
- b("Enter the new secret as a JSON object.");
1684
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-detail", "data-testid": "credential-not-found", children: [
1685
+ (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Credential not found" }),
1686
+ H
1687
+ ] });
1688
+ const J = ((E = l.data) == null ? void 0 : E.connections) ?? [], K = L.connectionCount, B = L.status === "disabled", Y = () => {
1689
+ w(!1);
1690
+ const C = La(d);
1691
+ if (!C) {
1692
+ D("Enter the new secret as a JSON object.");
1694
1693
  return;
1695
1694
  }
1696
- b(null), c.mutate(
1697
- { source: f },
1695
+ D(null), c.mutate(
1696
+ { source: C },
1698
1697
  {
1699
1698
  onSuccess: () => {
1700
- y(""), m(!0);
1699
+ k(""), w(!0);
1701
1700
  },
1702
- onError: (W) => b((W == null ? void 0 : W.message) ?? "Rotate failed.")
1701
+ onError: (v) => D((v == null ? void 0 : v.message) ?? "Rotate failed.")
1703
1702
  }
1704
1703
  );
1705
- }, V = () => {
1706
- T(null), v(null), w.mutate(void 0, {
1707
- onSuccess: T,
1708
- onError: (f) => v((f == null ? void 0 : f.message) ?? "Test failed.")
1704
+ }, U = () => {
1705
+ I(null), $(null), h.mutate(void 0, {
1706
+ onSuccess: I,
1707
+ onError: (C) => $((C == null ? void 0 : C.message) ?? "Test failed.")
1709
1708
  });
1710
- }, u = () => {
1711
- S(null), N.mutate(e, {
1712
- onSuccess: (f) => {
1713
- R(!1), f.ok ? i == null || i() : j(f.dependents.connections);
1709
+ }, p = () => {
1710
+ F(null), N.mutate(e, {
1711
+ onSuccess: (C) => {
1712
+ j(!1), C.ok ? a == null || a() : A(C.dependents.connections);
1714
1713
  },
1715
- onError: (f) => S((f == null ? void 0 : f.message) ?? "Delete failed.")
1714
+ onError: (C) => F((C == null ? void 0 : C.message) ?? "Delete failed.")
1716
1715
  });
1717
1716
  };
1718
- return /* @__PURE__ */ l("div", { className: "w6w-embed-root w6w-embed-cred-detail w6w-card-stack", children: [
1719
- /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1717
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root w6w-embed-cred-detail w6w-card-stack", children: [
1718
+ /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1720
1719
  /* @__PURE__ */ t("h2", { children: L.name }),
1721
- /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1720
+ /* @__PURE__ */ r("p", { className: "w6w-small", children: [
1722
1721
  /* @__PURE__ */ t("code", { children: L.contract }),
1723
1722
  " ",
1724
1723
  /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: L.status })
1725
1724
  ] }),
1726
- /* @__PURE__ */ t("dl", { className: "w6w-small", "data-testid": "credential-display", children: Object.entries(L.display).map(([f, W]) => /* @__PURE__ */ l("div", { children: [
1727
- /* @__PURE__ */ t("dt", { className: "w6w-muted", children: f }),
1728
- /* @__PURE__ */ t("dd", { children: W })
1729
- ] }, f)) }),
1730
- /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1731
- P,
1725
+ /* @__PURE__ */ t("dl", { className: "w6w-small", "data-testid": "credential-display", children: Object.entries(L.display).map(([C, v]) => /* @__PURE__ */ r("div", { children: [
1726
+ /* @__PURE__ */ t("dt", { className: "w6w-muted", children: C }),
1727
+ /* @__PURE__ */ t("dd", { children: v })
1728
+ ] }, C)) }),
1729
+ /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", children: [
1730
+ K,
1732
1731
  " connection",
1733
- P === 1 ? "" : "s",
1732
+ K === 1 ? "" : "s",
1734
1733
  " · created ",
1735
- we(L.createdAt),
1736
- " · updated ",
1737
- we(L.updatedAt)
1734
+ Oe(L.createdAt),
1735
+ " · updated",
1736
+ " ",
1737
+ Oe(L.updatedAt)
1738
1738
  ] }),
1739
- U
1739
+ H
1740
1740
  ] }),
1741
- /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "credential-connections", children: [
1741
+ /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", "data-testid": "credential-connections", children: [
1742
1742
  /* @__PURE__ */ t("h3", { children: "Connected apps" }),
1743
- B.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: B.map((f) => /* @__PURE__ */ t("li", { children: n ? /* @__PURE__ */ t(
1743
+ J.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: J.map((C) => /* @__PURE__ */ t("li", { children: n ? /* @__PURE__ */ t(
1744
1744
  "button",
1745
1745
  {
1746
1746
  type: "button",
1747
1747
  className: "w6w-embed-conn-action",
1748
- onClick: () => n(f.id),
1749
- children: f.displayName || f.appId
1748
+ onClick: () => n(C.id),
1749
+ children: C.displayName || C.appId
1750
1750
  }
1751
- ) : /* @__PURE__ */ t("span", { children: f.displayName || f.appId }) }, f.id)) })
1751
+ ) : /* @__PURE__ */ t("span", { children: C.displayName || C.appId }) }, C.id)) })
1752
1752
  ] }),
1753
- /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1753
+ /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1754
1754
  /* @__PURE__ */ t("h3", { children: "Rotate secret" }),
1755
- /* @__PURE__ */ l(
1756
- "p",
1757
- {
1758
- className: "w6w-muted w6w-small",
1759
- "data-testid": "credential-rotation-impact",
1760
- children: [
1761
- P,
1762
- " connection",
1763
- P === 1 ? "" : "s",
1764
- " will be marked untested"
1765
- ]
1766
- }
1767
- ),
1755
+ /* @__PURE__ */ r("p", { className: "w6w-muted w6w-small", "data-testid": "credential-rotation-impact", children: [
1756
+ K,
1757
+ " connection",
1758
+ K === 1 ? "" : "s",
1759
+ " will be marked untested"
1760
+ ] }),
1768
1761
  /* @__PURE__ */ t(
1769
1762
  "textarea",
1770
1763
  {
@@ -1772,7 +1765,7 @@ function sa({
1772
1765
  "aria-label": "New secret (JSON object)",
1773
1766
  rows: 5,
1774
1767
  value: d,
1775
- onChange: (f) => y(f.target.value),
1768
+ onChange: (C) => k(C.target.value),
1776
1769
  name: "w6w-cred-rotate",
1777
1770
  autoComplete: "off",
1778
1771
  autoCapitalize: "off",
@@ -1784,38 +1777,21 @@ function sa({
1784
1777
  "data-form-type": "other"
1785
1778
  }
1786
1779
  ),
1787
- k && /* @__PURE__ */ t(
1788
- "p",
1789
- {
1790
- className: "w6w-error",
1791
- role: "alert",
1792
- "data-testid": "credential-rotate-error",
1793
- children: k
1794
- }
1795
- ),
1780
+ b && /* @__PURE__ */ t("p", { className: "w6w-error", role: "alert", "data-testid": "credential-rotate-error", children: b }),
1796
1781
  g && /* @__PURE__ */ t("output", { children: "Secret rotated." }),
1797
- /* @__PURE__ */ t(
1798
- "button",
1799
- {
1800
- type: "button",
1801
- className: "w6w-btn",
1802
- disabled: c.isPending,
1803
- onClick: z,
1804
- children: c.isPending ? "Rotating…" : "Rotate"
1805
- }
1806
- )
1782
+ /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", disabled: c.isPending, onClick: Y, children: c.isPending ? "Rotating…" : "Rotate" })
1807
1783
  ] }),
1808
- /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1784
+ /* @__PURE__ */ r("div", { className: "w6w-embed-conn-card", children: [
1809
1785
  /* @__PURE__ */ t("h3", { children: "Manage" }),
1810
- /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
1786
+ /* @__PURE__ */ r("div", { className: "w6w-modal-actions", children: [
1811
1787
  /* @__PURE__ */ t(
1812
1788
  "button",
1813
1789
  {
1814
1790
  type: "button",
1815
1791
  className: "w6w-btn w6w-btn-ghost",
1816
- disabled: h.isPending,
1817
- onClick: () => h.mutate(F ? "active" : "disabled"),
1818
- children: F ? "Enable" : "Disable"
1792
+ disabled: m.isPending,
1793
+ onClick: () => m.mutate(B ? "active" : "disabled"),
1794
+ children: B ? "Enable" : "Disable"
1819
1795
  }
1820
1796
  ),
1821
1797
  /* @__PURE__ */ t(
@@ -1823,9 +1799,9 @@ function sa({
1823
1799
  {
1824
1800
  type: "button",
1825
1801
  className: "w6w-btn w6w-btn-ghost",
1826
- disabled: w.isPending,
1827
- onClick: V,
1828
- children: w.isPending ? "Testing…" : "Test credential"
1802
+ disabled: h.isPending,
1803
+ onClick: U,
1804
+ children: h.isPending ? "Testing…" : "Test credential"
1829
1805
  }
1830
1806
  ),
1831
1807
  /* @__PURE__ */ t(
@@ -1834,17 +1810,17 @@ function sa({
1834
1810
  type: "button",
1835
1811
  className: "w6w-btn w6w-btn-danger",
1836
1812
  onClick: () => {
1837
- j(null), R(!0);
1813
+ A(null), j(!0);
1838
1814
  },
1839
1815
  children: "Delete"
1840
1816
  }
1841
1817
  )
1842
1818
  ] }),
1843
- p && /* @__PURE__ */ t("output", { "data-testid": "credential-test-result", children: p.ok ? "ok" : p.code ?? "failed" }),
1844
- x && /* @__PURE__ */ t("p", { role: "alert", children: x }),
1845
- h.isError && /* @__PURE__ */ t("p", { role: "alert", children: ((I = h.error) == null ? void 0 : I.message) ?? "Update failed." }),
1846
- O && /* @__PURE__ */ l("div", { "data-testid": "credential-delete-confirm", children: [
1847
- /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1819
+ y && /* @__PURE__ */ t("output", { "data-testid": "credential-test-result", children: y.ok ? "ok" : y.code ?? "failed" }),
1820
+ S && /* @__PURE__ */ t("p", { role: "alert", children: S }),
1821
+ m.isError && /* @__PURE__ */ t("p", { role: "alert", children: ((x = m.error) == null ? void 0 : x.message) ?? "Update failed." }),
1822
+ T && /* @__PURE__ */ r("div", { "data-testid": "credential-delete-confirm", children: [
1823
+ /* @__PURE__ */ r("p", { className: "w6w-small", children: [
1848
1824
  'Delete the credential "',
1849
1825
  L.name,
1850
1826
  '"? This cannot be undone.'
@@ -1855,7 +1831,7 @@ function sa({
1855
1831
  type: "button",
1856
1832
  className: "w6w-btn w6w-btn-danger",
1857
1833
  disabled: N.isPending,
1858
- onClick: u,
1834
+ onClick: p,
1859
1835
  children: "Confirm delete"
1860
1836
  }
1861
1837
  ),
@@ -1865,39 +1841,502 @@ function sa({
1865
1841
  {
1866
1842
  type: "button",
1867
1843
  className: "w6w-btn w6w-btn-ghost",
1868
- onClick: () => R(!1),
1844
+ onClick: () => j(!1),
1869
1845
  children: "Cancel"
1870
1846
  }
1871
1847
  )
1872
1848
  ] }),
1873
- E && /* @__PURE__ */ l("div", { role: "alert", "data-testid": "credential-in-use", children: [
1874
- /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1849
+ P && /* @__PURE__ */ r("div", { role: "alert", "data-testid": "credential-in-use", children: [
1850
+ /* @__PURE__ */ r("p", { className: "w6w-small", children: [
1875
1851
  "This credential is still used by ",
1876
- E.length,
1852
+ P.length,
1877
1853
  " connection",
1878
- E.length === 1 ? "" : "s",
1854
+ P.length === 1 ? "" : "s",
1879
1855
  ". Delete those integrations first, or rotate this credential instead of deleting it."
1880
1856
  ] }),
1881
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children: E.map((f) => /* @__PURE__ */ t("li", { children: f.displayName || f.appId }, f.id)) })
1857
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children: P.map((C) => /* @__PURE__ */ t("li", { children: C.displayName || C.appId }, C.id)) })
1858
+ ] }),
1859
+ R && /* @__PURE__ */ t("p", { role: "alert", children: R })
1860
+ ] })
1861
+ ] });
1862
+ }
1863
+ function V(e) {
1864
+ const n = It(e), a = e == null ? void 0 : e.code;
1865
+ return n.code === void 0 && typeof a == "string" && a !== "" ? { ...n, code: a } : n;
1866
+ }
1867
+ const je = 80;
1868
+ function Ma(e, n) {
1869
+ if (typeof URL > "u" || typeof URL.createObjectURL != "function") return;
1870
+ const a = URL.createObjectURL(new Blob([n], { type: "text/csv" })), s = document.createElement("a");
1871
+ s.href = a, s.download = e, s.click(), URL.revokeObjectURL(a);
1872
+ }
1873
+ function Ia({ store: e, project: n }) {
1874
+ var Me;
1875
+ const a = xt(e), s = (a == null ? void 0 : a.columns) ?? [], i = (a == null ? void 0 : a.key) ?? "", [o, l] = f(""), [c, m] = f({}), [h, N] = f({}), [d, k] = f({}), [b, D] = f({}), [g, w] = f(null), [y, I] = f(null), [S, $] = f(null), T = pe(), j = we(), P = Ze(e.id, n, o), A = Ge(), R = An(), F = Xe(), H = Rn(), L = Sn(), J = (((Me = P.data) == null ? void 0 : Me.pages.flatMap((u) => u.items)) ?? []).map(
1876
+ (u) => b[u.key] ?? u
1877
+ ), K = new Map(J.map((u) => [u.key, u])), B = [], Y = (u) => c[u], U = Y(te), p = (u, M, q) => {
1878
+ const Z = q === void 0 ? null : ce(q, s);
1879
+ B.push({
1880
+ id: u,
1881
+ isNew: u === te,
1882
+ cells: M.cells,
1883
+ version: M.version,
1884
+ dirty: Z === null ? !0 : Ot(M, Z, s).length > 0,
1885
+ conflict: d[u] === !0,
1886
+ cellErrors: h[u]
1887
+ });
1888
+ };
1889
+ U !== void 0 && p(te, U, void 0);
1890
+ for (const u of J)
1891
+ p(u.key, Y(u.key) ?? ce(u, s), u);
1892
+ const E = (u) => {
1893
+ N((M) => ne(M, u)), k((M) => ne(M, u));
1894
+ }, x = (u) => {
1895
+ m((M) => ne(M, u)), E(u);
1896
+ };
1897
+ function C(u, M, q) {
1898
+ const Z = K.get(u), z = Y(u) ?? (Z ? ce(Z, s) : Ie(s));
1899
+ m((_) => ({ ..._, [u]: { ...z, cells: { ...z.cells, [M]: q } } })), N((_) => {
1900
+ const ee = _[u];
1901
+ if (ee === void 0 || !(M in ee)) return _;
1902
+ const se = ne(ee, M);
1903
+ return Object.keys(se).length === 0 ? ne(_, u) : { ..._, [u]: se };
1904
+ });
1905
+ }
1906
+ async function v(u) {
1907
+ const M = K.get(u), q = Y(u) ?? (M ? ce(M, s) : void 0);
1908
+ if (q === void 0) return;
1909
+ w(null), E(u);
1910
+ const Z = Kt(q, s);
1911
+ if (!Z.ok) {
1912
+ N((_) => ({ ..._, [u]: Z.errors }));
1913
+ return;
1914
+ }
1915
+ const z = Qt(
1916
+ q,
1917
+ Z.value,
1918
+ We((M == null ? void 0 : M.expiresAt) ?? null, Date.now())
1919
+ );
1920
+ try {
1921
+ z.kind === "insert" ? await R.mutateAsync({
1922
+ id: e.id,
1923
+ row: z.value,
1924
+ ttlSeconds: z.ttlSeconds,
1925
+ project: n
1926
+ }) : await A.mutateAsync({
1927
+ id: e.id,
1928
+ key: z.key,
1929
+ value: z.value,
1930
+ ifVersion: z.ifVersion,
1931
+ ttlSeconds: z.ttlSeconds,
1932
+ project: n
1933
+ }), D((_) => ne(_, u)), x(u);
1934
+ } catch (_) {
1935
+ const ee = V(_);
1936
+ if (Be(ee)) {
1937
+ k((fe) => ({ ...fe, [u]: !0 }));
1938
+ return;
1939
+ }
1940
+ const se = Ft(ee, s);
1941
+ if (se !== null) {
1942
+ N((fe) => ({ ...fe, [u]: se }));
1943
+ return;
1944
+ }
1945
+ w(ee.message);
1946
+ }
1947
+ }
1948
+ async function O(u) {
1949
+ try {
1950
+ const M = await et(T, e.id, u, n);
1951
+ D((q) => ({ ...q, [u]: M })), x(u), await j.invalidateQueries({ queryKey: ["data-stores"] });
1952
+ } catch (M) {
1953
+ w(V(M).message);
1954
+ }
1955
+ }
1956
+ function X() {
1957
+ const u = y;
1958
+ I(null), u !== null && (u !== te && F.mutate({ id: e.id, key: u, project: n }), x(u));
1959
+ }
1960
+ async function oe(u) {
1961
+ $(null);
1962
+ try {
1963
+ const M = await H.mutateAsync({ id: e.id, csv: await u.text(), project: n });
1964
+ $(xe({ status: 200, text: JSON.stringify(M) }));
1965
+ } catch (M) {
1966
+ const q = M;
1967
+ $(
1968
+ typeof q.status == "number" ? xe({ status: q.status, text: JSON.stringify(q.raw ?? null) }) : { ok: !1, message: V(M).message }
1969
+ );
1970
+ }
1971
+ }
1972
+ async function dt() {
1973
+ try {
1974
+ const u = await L.mutateAsync({ id: e.id, project: n });
1975
+ Ma(jt(null, e.name), u), $(null);
1976
+ } catch (u) {
1977
+ $({ ok: !1, message: V(u).message });
1978
+ }
1979
+ }
1980
+ return /* @__PURE__ */ r("div", { children: [
1981
+ /* @__PURE__ */ t(
1982
+ Et,
1983
+ {
1984
+ result: S,
1985
+ busy: L.isPending,
1986
+ onImport: oe,
1987
+ onRefuse: (u) => $({ ok: !1, message: u }),
1988
+ onExport: dt
1989
+ }
1990
+ ),
1991
+ /* @__PURE__ */ t(
1992
+ At,
1993
+ {
1994
+ columns: s,
1995
+ keyColumn: i,
1996
+ rows: B,
1997
+ error: g,
1998
+ loading: P.isPending,
1999
+ hasMore: P.hasNextPage,
2000
+ empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No rows match this key prefix." }),
2001
+ onCellChange: C,
2002
+ onSave: (u) => void v(u),
2003
+ onDelete: I,
2004
+ onReload: (u) => void O(u),
2005
+ onAddRow: () => {
2006
+ te in c || (m((u) => ({ ...u, [te]: Ie(s) })), w(null));
2007
+ },
2008
+ onLoadMore: () => void P.fetchNextPage(),
2009
+ onSearch: l
2010
+ }
2011
+ ),
2012
+ y !== null && /* @__PURE__ */ t(
2013
+ he,
2014
+ {
2015
+ title: "Delete entry",
2016
+ message: y === te ? "Discard this unsaved row?" : `Delete "${y}"? This cannot be undone.`,
2017
+ confirmLabel: "Delete",
2018
+ onConfirm: X,
2019
+ onClose: () => I(null)
2020
+ }
2021
+ )
2022
+ ] });
2023
+ }
2024
+ function xa({ store: e, project: n }) {
2025
+ var C;
2026
+ const a = e.kind === "doc", s = Rt(e), [i, o] = f(""), [l, c] = f(null), [m, h] = f(!1), [N, d] = f(""), [k, b] = f(""), [D, g] = f(null), [w, y] = f(!1), [I, S] = f({}), [$, T] = f(null), j = pe(), P = we(), A = Ze(e.id, n, i), R = Ge(), F = Xe(), H = (((C = A.data) == null ? void 0 : C.pages.flatMap((v) => v.items)) ?? []).map(
2027
+ (v) => I[v.key] ?? v
2028
+ ), L = l === null ? void 0 : H.find((v) => v.key === l), J = m || l !== null, K = (v) => a ? JSON.stringify(v.value ?? null, null, 2) : Wt(s, v.value), B = (v) => {
2029
+ const O = K(v).replace(/\s+/g, " ");
2030
+ return O.length > je ? `${O.slice(0, je)}…` : O;
2031
+ };
2032
+ function Y(v) {
2033
+ c(v.key), h(!1), b(K(v)), g(null), y(!1);
2034
+ }
2035
+ function U() {
2036
+ c(null), h(!1), d(""), b(""), g(null), y(!1);
2037
+ }
2038
+ async function p() {
2039
+ g(null), y(!1);
2040
+ const v = a ? qt(k) : _t(s, k);
2041
+ if (!v.ok) {
2042
+ g(v.message);
2043
+ return;
2044
+ }
2045
+ const O = m ? N.trim() : l;
2046
+ if (O === null || O === "") {
2047
+ g("Enter a key.");
2048
+ return;
2049
+ }
2050
+ try {
2051
+ await R.mutateAsync({
2052
+ id: e.id,
2053
+ key: O,
2054
+ value: v.value,
2055
+ // A new entry must not exist yet; an existing one is guarded by the version loaded.
2056
+ ifVersion: m ? 0 : (L == null ? void 0 : L.version) ?? 0,
2057
+ ttlSeconds: m ? void 0 : We((L == null ? void 0 : L.expiresAt) ?? null, Date.now()),
2058
+ project: n
2059
+ }), S((X) => ne(X, O)), U();
2060
+ } catch (X) {
2061
+ const oe = V(X);
2062
+ Be(oe) ? y(!0) : g(oe.message);
2063
+ }
2064
+ }
2065
+ async function E() {
2066
+ if (l !== null)
2067
+ try {
2068
+ const v = await et(j, e.id, l, n);
2069
+ S((O) => ({ ...O, [l]: v })), b(K(v)), y(!1), g(null), await P.invalidateQueries({ queryKey: ["data-stores"] });
2070
+ } catch (v) {
2071
+ g(V(v).message);
2072
+ }
2073
+ }
2074
+ async function x() {
2075
+ const v = $;
2076
+ if (T(null), v !== null)
2077
+ try {
2078
+ await F.mutateAsync({ id: e.id, key: v, project: n }), v === l && U();
2079
+ } catch (O) {
2080
+ g(V(O).message);
2081
+ }
2082
+ }
2083
+ return /* @__PURE__ */ r("div", { children: [
2084
+ /* @__PURE__ */ t(
2085
+ St,
2086
+ {
2087
+ rows: H.map((v) => ({ key: v.key, version: v.version, preview: B(v) })),
2088
+ loading: A.isPending,
2089
+ empty: /* @__PURE__ */ t("p", { className: "muted small", children: "No entries match this key prefix." }),
2090
+ hasMore: A.hasNextPage,
2091
+ onOpen: (v) => {
2092
+ const O = H.find((X) => X.key === v);
2093
+ O && Y(O);
2094
+ },
2095
+ onSearch: o,
2096
+ onNew: () => {
2097
+ c(null), h(!0), d(""), b(""), g(null), y(!1);
2098
+ },
2099
+ onLoadMore: () => void A.fetchNextPage()
2100
+ }
2101
+ ),
2102
+ J && /* @__PURE__ */ t(
2103
+ Pt,
2104
+ {
2105
+ kind: a ? "doc" : "kv",
2106
+ isNew: m,
2107
+ entryKey: l ?? void 0,
2108
+ newKey: N,
2109
+ version: (L == null ? void 0 : L.version) ?? null,
2110
+ expiresAt: (L == null ? void 0 : L.expiresAt) ?? null,
2111
+ text: k,
2112
+ error: D,
2113
+ conflict: w,
2114
+ saving: R.isPending || F.isPending,
2115
+ onDelete: m ? void 0 : () => T(l),
2116
+ onTextChange: (v) => {
2117
+ b(v), g(null);
2118
+ },
2119
+ onKeyChange: d,
2120
+ onSave: () => void p(),
2121
+ onCancel: U,
2122
+ onReload: () => void E()
2123
+ }
2124
+ ),
2125
+ $ !== null && /* @__PURE__ */ t(
2126
+ he,
2127
+ {
2128
+ title: "Delete entry",
2129
+ message: `Delete "${$}"? This cannot be undone.`,
2130
+ confirmLabel: "Delete",
2131
+ onConfirm: x,
2132
+ onClose: () => T(null)
2133
+ }
2134
+ )
2135
+ ] });
2136
+ }
2137
+ function ne(e, n) {
2138
+ if (!(n in e)) return e;
2139
+ const a = { ...e };
2140
+ return delete a[n], a;
2141
+ }
2142
+ function gi({ id: e, project: n, slots: a }) {
2143
+ const s = G(n), i = En(e, s ?? void 0), o = i.data;
2144
+ let l;
2145
+ s == null ? l = /* @__PURE__ */ t("p", { className: "muted", children: "No project selected." }) : i.isError ? l = /* @__PURE__ */ t("p", { className: "result error", children: V(i.error).message }) : o === void 0 ? l = /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : o.kind === "table" ? l = /* @__PURE__ */ t(Ia, { store: o, project: s }, o.id) : l = /* @__PURE__ */ t(xa, { store: o, project: s }, o.id);
2146
+ const c = (a == null ? void 0 : a.header) === void 0 ? o && /* @__PURE__ */ r("div", { children: [
2147
+ /* @__PURE__ */ t("h3", { children: o.name }),
2148
+ /* @__PURE__ */ r("p", { className: "muted small", children: [
2149
+ o.kind,
2150
+ " · ",
2151
+ o.entryCount,
2152
+ " ",
2153
+ o.entryCount === 1 ? "entry" : "entries"
2154
+ ] })
2155
+ ] }) : a.header;
2156
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ r("section", { className: "section", children: [
2157
+ c,
2158
+ l
2159
+ ] }) });
2160
+ }
2161
+ const Ea = ["name", "kind", "description", "schema"];
2162
+ function Aa(e) {
2163
+ const [n, a] = f(""), [s, i] = f(""), [o, l] = f("kv"), [c, m] = f("string"), [h, N] = f([]), [d, k] = f(""), [b, D] = f({}), [g, w] = f({}), [y, I] = f(null), S = jn();
2164
+ function $() {
2165
+ D({}), w({}), I(null);
2166
+ const T = {
2167
+ kind: o,
2168
+ name: n
2169
+ };
2170
+ o === "kv" && (T.schema = { valueType: c }), o === "table" && (T.schema = d === "" ? { columns: h } : { columns: h, key: d }), s !== "" && (T.description = s), S.mutate(
2171
+ // The SDK's create body types `schema` as table columns only; the wire takes the S-2 shape
2172
+ // per kind, so the kv `{valueType}` schema is passed through as the host defines it.
2173
+ { input: T, project: e.project },
2174
+ {
2175
+ onSuccess: () => e.onClose(),
2176
+ onError: (j) => {
2177
+ const P = V(j), A = Yt(P);
2178
+ if (A.kind === "cell" && h.some((R) => R.name === A.column)) {
2179
+ w({ [A.column]: P.message });
2180
+ return;
2181
+ }
2182
+ if (A.kind === "field" && Ea.includes(A.field)) {
2183
+ D({ [A.field]: P.message });
2184
+ return;
2185
+ }
2186
+ I(P.message);
2187
+ }
2188
+ }
2189
+ );
2190
+ }
2191
+ return /* @__PURE__ */ r(cn, { title: "New data store", onClose: e.onClose, children: [
2192
+ /* @__PURE__ */ r("div", { className: "modal-body", children: [
2193
+ /* @__PURE__ */ r("label", { className: "field", children: [
2194
+ /* @__PURE__ */ t("span", { children: "Name" }),
2195
+ /* @__PURE__ */ t(
2196
+ "input",
2197
+ {
2198
+ type: "text",
2199
+ "data-testid": "data-store-name",
2200
+ value: n,
2201
+ onChange: (T) => a(T.target.value),
2202
+ placeholder: "e.g. counters"
2203
+ }
2204
+ )
1882
2205
  ] }),
1883
- M && /* @__PURE__ */ t("p", { role: "alert", children: M })
2206
+ b.name !== void 0 && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-field-error-name", children: b.name }),
2207
+ /* @__PURE__ */ r("label", { className: "field", children: [
2208
+ /* @__PURE__ */ t("span", { children: "Description" }),
2209
+ /* @__PURE__ */ t(
2210
+ "input",
2211
+ {
2212
+ type: "text",
2213
+ value: s,
2214
+ onChange: (T) => i(T.target.value),
2215
+ placeholder: "What this store holds"
2216
+ }
2217
+ )
2218
+ ] }),
2219
+ /* @__PURE__ */ r("label", { className: "field", children: [
2220
+ /* @__PURE__ */ t("span", { children: "Kind" }),
2221
+ /* @__PURE__ */ t(
2222
+ "select",
2223
+ {
2224
+ "data-testid": "data-store-kind",
2225
+ value: o,
2226
+ onChange: (T) => {
2227
+ l(T.target.value), k("");
2228
+ },
2229
+ children: Ut.map((T) => /* @__PURE__ */ t("option", { value: T, children: Vt[T] }, T))
2230
+ }
2231
+ ),
2232
+ /* @__PURE__ */ t("span", { className: "hint", children: "The kind is fixed once the store exists." })
2233
+ ] }),
2234
+ b.kind !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: b.kind }),
2235
+ o === "kv" && /* @__PURE__ */ r("label", { className: "field", children: [
2236
+ /* @__PURE__ */ t("span", { children: "Value type" }),
2237
+ /* @__PURE__ */ t("select", { value: c, onChange: (T) => m(T.target.value), children: Ht.map((T) => /* @__PURE__ */ t("option", { value: T, children: T }, T)) })
2238
+ ] }),
2239
+ o === "table" && /* @__PURE__ */ t(
2240
+ Jt,
2241
+ {
2242
+ columns: h,
2243
+ onChange: N,
2244
+ keyColumn: d,
2245
+ onKeyColumnChange: k,
2246
+ columnErrors: g
2247
+ }
2248
+ ),
2249
+ b.schema !== void 0 && /* @__PURE__ */ t("div", { className: "result error", children: b.schema }),
2250
+ y !== null && /* @__PURE__ */ t("div", { className: "result error", "data-testid": "data-store-form-error", children: y })
2251
+ ] }),
2252
+ /* @__PURE__ */ r("div", { className: "modal-actions", children: [
2253
+ /* @__PURE__ */ t("button", { type: "button", className: "btn ghost", onClick: e.onClose, children: "Cancel" }),
2254
+ /* @__PURE__ */ t(
2255
+ "button",
2256
+ {
2257
+ type: "button",
2258
+ className: "btn",
2259
+ "data-testid": "data-store-create",
2260
+ disabled: S.isPending,
2261
+ onClick: $,
2262
+ children: S.isPending ? "Creating…" : "Create"
2263
+ }
2264
+ )
1884
2265
  ] })
1885
2266
  ] });
1886
2267
  }
2268
+ function yi({ project: e, onOpen: n, getHref: a, slots: s }) {
2269
+ const i = G(e), o = Pn(i ?? void 0), l = On(), [c, m] = f(!1), [h, N] = f(null), [d, k] = f(null), b = (s == null ? void 0 : s.header) === void 0 ? /* @__PURE__ */ r("div", { children: [
2270
+ /* @__PURE__ */ t("h3", { children: "Data stores" }),
2271
+ /* @__PURE__ */ t("p", { className: "muted small", children: "Key-value, document and table storage for this project." })
2272
+ ] }) : s.header;
2273
+ return /* @__PURE__ */ r("div", { className: "w6w-embed-root", children: [
2274
+ /* @__PURE__ */ t(
2275
+ Bt,
2276
+ {
2277
+ stores: o.data ?? [],
2278
+ loading: o.isLoading,
2279
+ error: d ?? (o.error != null ? V(o.error).message : null),
2280
+ onOpen: n,
2281
+ getHref: a,
2282
+ onArchive: (D) => {
2283
+ k(null), N(D);
2284
+ },
2285
+ busy: l.isPending,
2286
+ slots: {
2287
+ header: b,
2288
+ actions: /* @__PURE__ */ t(
2289
+ "button",
2290
+ {
2291
+ type: "button",
2292
+ className: "btn",
2293
+ "data-testid": "data-store-new",
2294
+ disabled: i == null,
2295
+ onClick: () => m(!0),
2296
+ children: "+ New data store"
2297
+ }
2298
+ ),
2299
+ empty: s == null ? void 0 : s.empty
2300
+ }
2301
+ }
2302
+ ),
2303
+ c && i != null && /* @__PURE__ */ t(Aa, { project: i, onClose: () => m(!1) }),
2304
+ h && /* @__PURE__ */ t(
2305
+ he,
2306
+ {
2307
+ title: "Archive data store",
2308
+ message: `Archive "${h.name}" and its ${h.entryCount} ${h.entryCount === 1 ? "entry" : "entries"}? Workflows and the API can no longer reach it.`,
2309
+ confirmLabel: "Archive",
2310
+ onConfirm: () => {
2311
+ const D = h;
2312
+ N(null), i != null && l.mutate(
2313
+ { id: D.id, project: i },
2314
+ { onError: (g) => k(V(g).message) }
2315
+ );
2316
+ },
2317
+ onClose: () => N(null)
2318
+ }
2319
+ )
2320
+ ] });
2321
+ }
1887
2322
  export {
1888
- zn as ActivitySummary,
1889
- ta as ConnectionDetail,
1890
- ea as ConnectionList,
1891
- sa as CredentialDetail,
1892
- ia as CredentialList,
1893
- Jn as DocumentList,
1894
- Vn as EndpointList,
1895
- Un as FunctionList,
1896
- na as ModelCatalog,
1897
- aa as ModelUsage,
1898
- Zn as ReliabilityBoard,
1899
- Gn as RunHistory,
1900
- Xn as ServiceDetail,
1901
- Yn as WorkflowList
2323
+ oi as ActivitySummary,
2324
+ mi as ConnectionDetail,
2325
+ ui as ConnectionList,
2326
+ fi as CredentialDetail,
2327
+ pi as CredentialList,
2328
+ yi as DataStoreList,
2329
+ gi as DataStoreView,
2330
+ li as DocumentList,
2331
+ ii as EndpointList,
2332
+ ai as FunctionList,
2333
+ zn as Logs,
2334
+ ci as LogsView,
2335
+ hi as ModelCatalog,
2336
+ wi as ModelUsage,
2337
+ ri as ReliabilityBoard,
2338
+ Yn as RunHistory,
2339
+ di as ServiceDetail,
2340
+ si as WorkflowList
1902
2341
  };
1903
2342
  //# sourceMappingURL=lists.mjs.map