@w6w/embed 0.2.1 → 0.2.11

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 (119) hide show
  1. package/dist/{ConfirmModal-RLbZT5_k.js → ConfirmModal-BE-SdX-O.js} +53 -49
  2. package/dist/{ConfirmModal-RLbZT5_k.js.map → ConfirmModal-BE-SdX-O.js.map} +1 -1
  3. package/dist/{CreateFunctionModal-DRsFx-FB.js → CreateFunctionModal-D6CQLpa_.js} +25 -25
  4. package/dist/{CreateFunctionModal-DRsFx-FB.js.map → CreateFunctionModal-D6CQLpa_.js.map} +1 -1
  5. package/dist/{DocumentFormModal-BExK1V-B.js → DocumentFormModal-YauVdolr.js} +5 -5
  6. package/dist/{DocumentFormModal-BExK1V-B.js.map → DocumentFormModal-YauVdolr.js.map} +1 -1
  7. package/dist/{ImportSpecModal-BDQIf6rg.js → ImportSpecModal-B7qd1Km2.js} +3 -3
  8. package/dist/{ImportSpecModal-BDQIf6rg.js.map → ImportSpecModal-B7qd1Km2.js.map} +1 -1
  9. package/dist/ModelRoutesManager-BGESQahw.js +345 -0
  10. package/dist/ModelRoutesManager-BGESQahw.js.map +1 -0
  11. package/dist/WorkflowEditor-CwvmAGp2.js +925 -0
  12. package/dist/WorkflowEditor-CwvmAGp2.js.map +1 -0
  13. package/dist/{apps-1FNUwbGv.js → apps-CboASBKr.js} +14 -14
  14. package/dist/{apps-1FNUwbGv.js.map → apps-CboASBKr.js.map} +1 -1
  15. package/dist/{callables-3mFrMVG_.js → callables-tOlflvbl.js} +11 -11
  16. package/dist/{callables-3mFrMVG_.js.map → callables-tOlflvbl.js.map} +1 -1
  17. package/dist/chrome/ConfirmModal.d.ts +4 -1
  18. package/dist/chrome/workspace.d.ts +4 -0
  19. package/dist/{coerce-input-BicYr7nc.js → coerce-input-DttlcSdO.js} +70 -58
  20. package/dist/coerce-input-DttlcSdO.js.map +1 -0
  21. package/dist/connections-D7cgXhDS.js +119 -0
  22. package/dist/connections-D7cgXhDS.js.map +1 -0
  23. package/dist/credentials-DaQU3Ca_.js +171 -0
  24. package/dist/credentials-DaQU3Ca_.js.map +1 -0
  25. package/dist/document-sources-UCwe8x77.js +91 -0
  26. package/dist/document-sources-UCwe8x77.js.map +1 -0
  27. package/dist/draft.mjs +1 -1
  28. package/dist/editor/BindingBanner.d.ts +13 -0
  29. package/dist/editor/CallableEditorFrame.d.ts +7 -0
  30. package/dist/editor/EndpointCards.d.ts +4 -1
  31. package/dist/editor/PublishControl.d.ts +19 -0
  32. package/dist/editor/TargetSelector.d.ts +15 -0
  33. package/dist/editor/TargetSelector.types.d.ts +2 -0
  34. package/dist/editor/definition.d.ts +2 -0
  35. package/dist/{editor-apps-BdenSV1o.js → editor-apps-BUZWld-m.js} +5 -5
  36. package/dist/{editor-apps-BdenSV1o.js.map → editor-apps-BUZWld-m.js.map} +1 -1
  37. package/dist/{editor-tools-RxmY5iyi.js → editor-tools-B_Lfx3kw.js} +11 -11
  38. package/dist/editor-tools-B_Lfx3kw.js.map +1 -0
  39. package/dist/editor.mjs +1 -1
  40. package/dist/editors.mjs +768 -621
  41. package/dist/editors.mjs.map +1 -1
  42. package/dist/{endpoints-B2ynbZo-.js → endpoints-DSRo1Lc5.js} +113 -107
  43. package/dist/endpoints-DSRo1Lc5.js.map +1 -0
  44. package/dist/fields-DvS8XZFc.js +21 -0
  45. package/dist/fields-DvS8XZFc.js.map +1 -0
  46. package/dist/forms/ModelBudgetsManager.d.ts +9 -0
  47. package/dist/forms/ModelRoutesManager.d.ts +14 -0
  48. package/dist/forms.d.ts +4 -0
  49. package/dist/forms.mjs +611 -212
  50. package/dist/forms.mjs.map +1 -1
  51. package/dist/index.mjs +119 -112
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/lib/binding-problems.d.ts +38 -0
  54. package/dist/lib/code-rail.d.ts +4 -2
  55. package/dist/lib/index.d.ts +1 -0
  56. package/dist/lib/invoke-error.d.ts +1 -0
  57. package/dist/lib/sdk-snippets.d.ts +1 -1
  58. package/dist/lib/target-fields.d.ts +8 -0
  59. package/dist/lib/trigger-preview.d.ts +1 -0
  60. package/dist/lib/workflow-live-run.d.ts +9 -2
  61. package/dist/lib/workflow-nodes.d.ts +5 -0
  62. package/dist/lib/workflow-validity.d.ts +1 -0
  63. package/dist/lib.mjs +72 -70
  64. package/dist/lists/ConnectionDependents.d.ts +31 -0
  65. package/dist/lists/ConnectionDetail.d.ts +4 -1
  66. package/dist/lists/ConnectionList.d.ts +4 -1
  67. package/dist/lists/CredentialDetail.d.ts +15 -0
  68. package/dist/lists/CredentialList.d.ts +14 -0
  69. package/dist/lists/ModelCatalog.d.ts +12 -0
  70. package/dist/lists/ModelUsage.d.ts +12 -0
  71. package/dist/lists.d.ts +8 -0
  72. package/dist/lists.mjs +1322 -604
  73. package/dist/lists.mjs.map +1 -1
  74. package/dist/models-bAayQPJ_.js +270 -0
  75. package/dist/models-bAayQPJ_.js.map +1 -0
  76. package/dist/{project-context-BiCjv_E3.js → project-context-Tvp-La7A.js} +3 -3
  77. package/dist/{project-context-BiCjv_E3.js.map → project-context-Tvp-La7A.js.map} +1 -1
  78. package/dist/rail.mjs +4 -4
  79. package/dist/repos/agents-studio-agents.d.ts +52 -0
  80. package/dist/repos/agents-studio-assets.d.ts +68 -0
  81. package/dist/repos/connections.d.ts +30 -12
  82. package/dist/repos/credentials.d.ts +83 -0
  83. package/dist/repos/endpoints.d.ts +9 -3
  84. package/dist/repos/fields.d.ts +34 -0
  85. package/dist/repos/functions.d.ts +7 -5
  86. package/dist/repos/index.d.ts +5 -0
  87. package/dist/repos/models.d.ts +289 -0
  88. package/dist/repos.mjs +613 -176
  89. package/dist/repos.mjs.map +1 -1
  90. package/dist/{slug-C4ktDPdy.js → slug-BVdgiP_L.js} +64 -60
  91. package/dist/slug-BVdgiP_L.js.map +1 -0
  92. package/dist/{spec-export-Cf3VQSQS.js → spec-export-CBbloO_n.js} +7 -7
  93. package/dist/{spec-export-Cf3VQSQS.js.map → spec-export-CBbloO_n.js.map} +1 -1
  94. package/dist/{spec-import-CjmxyZDR.js → spec-import-CW6R_Wk1.js} +160 -156
  95. package/dist/spec-import-CW6R_Wk1.js.map +1 -0
  96. package/dist/theme-context-E2ZhlXDX.js +6 -0
  97. package/dist/theme-context-E2ZhlXDX.js.map +1 -0
  98. package/dist/theme-context.d.ts +2 -0
  99. package/dist/trigger-preview-DKxfjzUY.js +145 -0
  100. package/dist/trigger-preview-DKxfjzUY.js.map +1 -0
  101. package/dist/{use-callable-draft-zHLpcr-b.js → use-callable-draft-DsALnSfF.js} +22 -22
  102. package/dist/{use-callable-draft-zHLpcr-b.js.map → use-callable-draft-DsALnSfF.js.map} +1 -1
  103. package/dist/{workflow-blank-DyL3_RUA.js → workflow-blank-DFpGObrn.js} +6 -6
  104. package/dist/{workflow-blank-DyL3_RUA.js.map → workflow-blank-DFpGObrn.js.map} +1 -1
  105. package/package.json +1 -1
  106. package/src/styles.css +2 -6
  107. package/dist/WorkflowEditor-DlbVv6Fs.js +0 -854
  108. package/dist/WorkflowEditor-DlbVv6Fs.js.map +0 -1
  109. package/dist/coerce-input-BicYr7nc.js.map +0 -1
  110. package/dist/connections-CjjYeRqb.js +0 -78
  111. package/dist/connections-CjjYeRqb.js.map +0 -1
  112. package/dist/document-sources-C0grrtdq.js +0 -86
  113. package/dist/document-sources-C0grrtdq.js.map +0 -1
  114. package/dist/editor-tools-RxmY5iyi.js.map +0 -1
  115. package/dist/endpoints-B2ynbZo-.js.map +0 -1
  116. package/dist/slug-C4ktDPdy.js.map +0 -1
  117. package/dist/spec-import-CjmxyZDR.js.map +0 -1
  118. package/dist/trigger-preview-VPkrryDl.js +0 -120
  119. package/dist/trigger-preview-VPkrryDl.js.map +0 -1
package/dist/lists.mjs CHANGED
@@ -1,42 +1,46 @@
1
1
  "use client";
2
- import { jsxs as o, jsx as t, Fragment as T } from "react/jsx-runtime";
3
- import { useState as $, useMemo as D, useEffect as Ne } from "react";
4
- import { F as ve, E as be } from "./CreateFunctionModal-DRsFx-FB.js";
5
- import { d as ke, a as Ce, b as $e, t as ne, n as W, r as Ie, j as Le } from "./endpoints-B2ynbZo-.js";
6
- import { u as O, a as U } from "./project-context-BiCjv_E3.js";
7
- import { CallableList as Ae, ReliabilityList as Me, EditButton as ae, DeleteButton as Te, ListItem as H, HealthStatusPill as Q, HistoryTimeline as De, useW6WApi as ie, connectionAppIdsToLookUp as se, ConnectionList as xe, AddConnectionModal as Ee, EditConnectionModal as le, ConfirmModal as Re, resolveConnectionAppMeta as je, ConnectionHeader as Se, IconButton as Qe } from "@w6w/ui";
8
- import { I as Ke } from "./ImportSpecModal-BDQIf6rg.js";
9
- import { i as Oe } from "./rail-settings-XYGToh00.js";
10
- import { _ as _e, Y as re, I as Be, M as Fe, J as Pe, E as He } from "./spec-import-CjmxyZDR.js";
11
- import { b as qe } from "./workflow-blank-DyL3_RUA.js";
12
- import { f as We, e as G, g as Ue, b as Ve, h as Ye, i as Ze } from "./api-calls--JHyif6a.js";
13
- import { C as ze, a as Je } from "./ConfirmModal-RLbZT5_k.js";
14
- import { D as Ge } from "./DocumentFormModal-BExK1V-B.js";
15
- import { H as Xe, a as oe } from "./editor-apps-BdenSV1o.js";
16
- import { ApiError as ce } from "@w6w/sdk";
17
- import { useQueryClient as de } from "@tanstack/react-query";
18
- import { i as et, j as tt, b as q, c as ue, f as nt, k as at } from "./connections-CjjYeRqb.js";
19
- import { d as it } from "./apps-1FNUwbGv.js";
20
- function V(e) {
21
- const { kind: n } = e, s = ke(n), [i, a] = $(!1), r = (e.rows ?? []).map((l) => ({
22
- ...e.toRow(l),
23
- id: l.id,
24
- archived: Oe(l)
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)
25
29
  }));
26
- return /* @__PURE__ */ o("div", { className: "w6w-embed-root", children: [
30
+ return /* @__PURE__ */ l("div", { className: "w6w-embed-root", children: [
27
31
  /* @__PURE__ */ t(
28
- Ae,
32
+ He,
29
33
  {
30
- rows: r,
31
- title: s.listTitle,
32
- description: s.listDescription,
33
- emptyCopy: s.emptyCopy,
34
- newLabel: s.newLabel,
35
- openRowTitle: s.openRowTitle,
34
+ rows: o,
35
+ title: i.listTitle,
36
+ description: i.listDescription,
37
+ emptyCopy: i.emptyCopy,
38
+ newLabel: i.newLabel,
39
+ openRowTitle: i.openRowTitle,
36
40
  testIds: {
37
- showArchived: s.showArchivedTestId,
38
- importOpen: s.importOpenTestId,
39
- archivedBadge: s.archivedBadgeTestId
41
+ showArchived: i.showArchivedTestId,
42
+ importOpen: i.importOpenTestId,
43
+ archivedBadge: i.archivedBadgeTestId
40
44
  },
41
45
  loading: e.loading,
42
46
  error: e.error,
@@ -48,15 +52,15 @@ function V(e) {
48
52
  slots: e.slots
49
53
  }
50
54
  ),
51
- i && /* @__PURE__ */ t(
52
- Ke,
55
+ s && /* @__PURE__ */ t(
56
+ tt,
53
57
  {
54
58
  kind: n,
55
59
  project: e.project ?? void 0,
56
- listKeys: { functionsKey: $e, endpointsKey: Ce, workflowsKey: _e },
57
- onOpenImported: (l, u) => {
60
+ listKeys: { functionsKey: Be, endpointsKey: Qe, workflowsKey: at },
61
+ onOpenImported: (r, c) => {
58
62
  var h;
59
- return (h = e.onOpen) == null ? void 0 : h.call(e, u);
63
+ return (h = e.onOpen) == null ? void 0 : h.call(e, c);
60
64
  },
61
65
  onClose: () => a(!1)
62
66
  }
@@ -64,56 +68,56 @@ function V(e) {
64
68
  e.children
65
69
  ] });
66
70
  }
67
- function zt(e) {
68
- const n = ne(), s = O(e.project), [i, a] = $(null);
71
+ function Un(e) {
72
+ const n = pe(), i = q(e.project), [s, a] = C(null);
69
73
  return /* @__PURE__ */ t(
70
- V,
74
+ re,
71
75
  {
72
76
  kind: "function",
73
77
  rows: n.data,
74
78
  loading: n.isLoading,
75
79
  error: n.error ? String(n.error) : null,
76
- project: s,
77
- toRow: (r) => ({
78
- title: r.displayName || r.key,
79
- description: r.description,
80
- badges: r.valid ? null : /* @__PURE__ */ t("span", { className: "w6w-callable-list-badge", children: "incomplete" })
80
+ project: i,
81
+ toRow: (o) => ({
82
+ title: o.displayName || o.key,
83
+ description: o.description,
84
+ badges: o.valid ? null : /* @__PURE__ */ t("span", { className: "w6w-callable-list-badge", children: "incomplete" })
81
85
  }),
82
86
  onOpen: e.onOpen,
83
87
  getHref: e.getHref,
84
- onCreate: () => a(W("function")),
88
+ onCreate: () => a(ae("function")),
85
89
  slots: e.slots,
86
- children: i !== null && /* @__PURE__ */ t(
87
- ve,
90
+ children: s !== null && /* @__PURE__ */ t(
91
+ qe,
88
92
  {
89
- newId: i,
90
- takenKeys: (n.data ?? []).map((r) => r.key),
93
+ newId: s,
94
+ takenKeys: (n.data ?? []).map((o) => o.key),
91
95
  onClose: () => a(null),
92
- onCreated: (r) => {
93
- var l;
94
- a(null), (l = e.onCreated) == null || l.call(e, r);
96
+ onCreated: (o) => {
97
+ var r;
98
+ a(null), (r = e.onCreated) == null || r.call(e, o);
95
99
  }
96
100
  }
97
101
  )
98
102
  }
99
103
  );
100
104
  }
101
- function Jt(e) {
102
- const n = Ie(), s = O(e.project), [i, a] = $(null);
105
+ function Vn(e) {
106
+ const n = We(), i = q(e.project), [s, a] = C(null);
103
107
  return /* @__PURE__ */ t(
104
- V,
108
+ re,
105
109
  {
106
110
  kind: "endpoint",
107
111
  rows: n.data,
108
112
  loading: n.isLoading,
109
113
  error: n.error ? String(n.error) : null,
110
- project: s,
111
- toRow: (r) => ({
114
+ project: i,
115
+ toRow: (o) => ({
112
116
  // The draft tag sits INSIDE the title, after the name: ui `ListItem` puts `badges` in
113
117
  // a trailing `margin-left: auto` slot, which would strand it at the row's far edge.
114
- title: /* @__PURE__ */ o(T, { children: [
115
- /* @__PURE__ */ t("strong", { children: r.displayName || r.key }),
116
- Le(r) ? /* @__PURE__ */ t(
118
+ title: /* @__PURE__ */ l(D, { children: [
119
+ /* @__PURE__ */ t("strong", { children: o.displayName || o.key }),
120
+ _e(o) ? /* @__PURE__ */ t(
117
121
  "span",
118
122
  {
119
123
  className: "tag warn",
@@ -123,221 +127,232 @@ function Jt(e) {
123
127
  }
124
128
  ) : null
125
129
  ] }),
126
- description: r.description
130
+ description: o.description
127
131
  }),
128
132
  onOpen: e.onOpen,
129
133
  getHref: e.getHref,
130
- onCreate: () => a(W("endpoint")),
134
+ onCreate: () => a(ae("endpoint")),
131
135
  slots: e.slots,
132
- children: i !== null && /* @__PURE__ */ t(
133
- be,
136
+ children: s !== null && /* @__PURE__ */ t(
137
+ Fe,
134
138
  {
135
- newId: i,
136
- takenKeys: (n.data ?? []).map((r) => r.key),
139
+ newId: s,
140
+ takenKeys: (n.data ?? []).map((o) => o.key),
137
141
  onClose: () => a(null),
138
- onCreated: (r) => {
139
- var l;
140
- a(null), (l = e.onCreated) == null || l.call(e, r);
142
+ onCreated: (o) => {
143
+ var r;
144
+ a(null), (r = e.onCreated) == null || r.call(e, o);
141
145
  }
142
146
  }
143
147
  )
144
148
  }
145
149
  );
146
150
  }
147
- function Gt(e) {
148
- const n = O(e.project), s = re(n ?? void 0, n != null), i = Be(n ?? void 0), [a, r] = $(null);
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);
149
153
  return /* @__PURE__ */ t(
150
- V,
154
+ re,
151
155
  {
152
156
  kind: "workflow",
153
- rows: s.data,
154
- loading: s.isLoading,
155
- error: a ?? (s.error ? String(s.error) : null),
157
+ rows: i.data,
158
+ loading: i.isLoading,
159
+ error: a ?? (i.error ? String(i.error) : null),
156
160
  project: n,
157
- toRow: (l) => ({
158
- title: l.displayName || l.name,
159
- description: l.description,
160
- badges: /* @__PURE__ */ o(T, { children: [
161
- l.tags.length > 0 && /* @__PURE__ */ t("span", { className: "wf-row-tags", children: l.tags.map((u) => /* @__PURE__ */ t("span", { className: "tag", children: u }, u)) }),
162
- l.status !== "archived" && /* @__PURE__ */ t("span", { className: `badge wf-status ${l.status}`, children: l.status })
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
167
  ] }),
164
- trailing: /* @__PURE__ */ o("span", { className: "wf-col wf-col-stats muted small", children: [
165
- l.runCount,
168
+ trailing: /* @__PURE__ */ l("span", { className: "wf-col wf-col-stats muted small", children: [
169
+ r.runCount,
166
170
  " ",
167
- l.runCount === 1 ? "run" : "runs"
171
+ r.runCount === 1 ? "run" : "runs"
168
172
  ] })
169
173
  }),
170
174
  onOpen: e.onOpen,
171
175
  getHref: e.getHref,
172
176
  onCreate: () => {
173
- r(null), i.mutate(qe(W("workflow")), {
174
- onSuccess: (l) => {
175
- var u;
176
- return (u = e.onCreated) == null ? void 0 : u.call(e, l.workflow.id);
177
+ o(null), s.mutate(ot(ae("workflow")), {
178
+ onSuccess: (r) => {
179
+ var c;
180
+ return (c = e.onCreated) == null ? void 0 : c.call(e, r.workflow.id);
177
181
  },
178
- onError: (l) => r(l instanceof Error ? l.message : String(l))
182
+ onError: (r) => o(r instanceof Error ? r.message : String(r))
179
183
  });
180
184
  },
181
- creating: i.isPending,
185
+ creating: s.isPending,
182
186
  slots: e.slots
183
187
  }
184
188
  );
185
189
  }
186
- function Xt({
190
+ function Zn({
187
191
  project: e,
188
192
  variant: n = "full",
189
- limit: s,
190
- days: i = 30,
193
+ limit: i,
194
+ days: s = 30,
191
195
  showChart: a,
192
- getHref: r,
193
- onOpen: l,
194
- showAllHref: u,
196
+ getHref: o,
197
+ onOpen: r,
198
+ showAllHref: c,
195
199
  onShowAll: h,
196
- slots: f
200
+ slots: w
197
201
  }) {
198
- var v, d;
199
- const g = U().project, m = e === void 0 ? g : e, b = m || null, y = We(b ?? void 0, i);
200
- let p = f == null ? void 0 : f.empty;
201
- return b ? y.isLoading ? p = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) : y.error && (p = /* @__PURE__ */ t("div", { className: "error", children: y.error.message })) : p = /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see its reliability." }), /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
202
- Me,
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,
203
207
  {
204
- services: b ? ((v = y.data) == null ? void 0 : v.services) ?? [] : [],
205
- window: b ? (d = y.data) == null ? void 0 : d.window : void 0,
206
- days: i,
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
+ days: s,
207
211
  compact: n === "compact",
208
212
  showChart: a,
209
- limit: s,
210
- getHref: r,
211
- onOpen: l,
212
- showAllHref: u,
213
+ limit: i,
214
+ getHref: o,
215
+ onOpen: r,
216
+ showAllHref: c,
213
217
  onShowAll: h,
214
- slots: { ...f, empty: p }
218
+ slots: { ...w, empty: b }
215
219
  }
216
220
  ) });
217
221
  }
218
- function st(e) {
222
+ function St(e) {
219
223
  const n = e.replace(/\s+/g, " ").trim();
220
224
  return n.length > 80 ? `${n.slice(0, 80)}…` : n;
221
225
  }
222
- function en({ project: e, onOpen: n, getHref: s, slots: i, rowSlots: a }) {
223
- var p, v;
224
- const r = O(e), l = Fe(r ?? void 0, r != null), u = Pe(), [h, f] = $(null), [g, m] = $(null), b = (i == null ? void 0 : i.header) === void 0 ? /* @__PURE__ */ o("div", { children: [
226
+ function Jn({ project: e, onOpen: n, getHref: i, slots: s, rowSlots: a }) {
227
+ 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: [
225
229
  /* @__PURE__ */ t("h3", { children: "Documents" }),
226
230
  /* @__PURE__ */ t("p", { className: "muted small", children: "Each document is free-form content stored verbatim." })
227
- ] }) : i.header, y = (i == null ? void 0 : i.empty) === void 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No documents yet." }) : i.empty;
228
- return /* @__PURE__ */ o("div", { className: "w6w-embed-root", children: [
229
- /* @__PURE__ */ o("section", { className: "section", children: [
230
- /* @__PURE__ */ o("div", { className: "section-head", children: [
231
- b,
232
- /* @__PURE__ */ t(
233
- "button",
234
- {
235
- type: "button",
236
- className: "btn",
237
- disabled: r == null,
238
- onClick: () => f({ mode: "create" }),
239
- children: "+ Add document"
240
- }
241
- )
242
- ] }),
243
- /* @__PURE__ */ o("div", { className: "card", children: [
244
- l.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
245
- ((p = l.data) == null ? void 0 : p.length) === 0 && y,
246
- /* @__PURE__ */ t("ul", { className: "list", children: (v = l.data) == null ? void 0 : v.map((d) => {
247
- var w, M, R;
248
- const N = (w = a == null ? void 0 : a.lead) == null ? void 0 : w.call(a, d), A = /* @__PURE__ */ o(T, { children: [
249
- N,
250
- /* @__PURE__ */ o(
251
- "div",
252
- {
253
- className: "list-main",
254
- style: { marginLeft: N != null ? "var(--w6w-sp-2)" : 0 },
255
- children: [
256
- /* @__PURE__ */ t("strong", { className: "list-name", title: d.key, children: d.key }),
257
- " ",
258
- /* @__PURE__ */ t("span", { className: "tag", children: d.format }),
259
- /* @__PURE__ */ o("div", { className: "muted small list-preview", children: [
260
- /* @__PURE__ */ t("code", { children: st(d.content) }),
261
- d.description && /* @__PURE__ */ o(T, { children: [
262
- " · ",
263
- d.description
264
- ] })
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 = [
232
+ {
233
+ key: "key",
234
+ 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(
241
+ "span",
242
+ {
243
+ className: "list-main",
244
+ style: { marginLeft: p != null ? "var(--w6w-sp-2)" : 0 },
245
+ children: [
246
+ /* @__PURE__ */ t("strong", { className: "list-name", title: m.key, children: m.key }),
247
+ " ",
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: [
252
+ " · ",
253
+ m.description
265
254
  ] })
266
- ]
267
- }
268
- )
269
- ] }), I = (M = a == null ? void 0 : a.footer) == null ? void 0 : M.call(a, d);
270
- return /* @__PURE__ */ o("li", { className: "linked", style: { flexWrap: "wrap" }, children: [
271
- s ? /* @__PURE__ */ t(
272
- "a",
273
- {
274
- className: "list-link",
275
- href: s(d.id),
276
- onClick: (L) => n == null ? void 0 : n(d.id, L),
277
- style: { display: "flex", alignItems: "center" },
278
- children: A
279
- }
280
- ) : /* @__PURE__ */ t(
281
- "button",
282
- {
283
- type: "button",
284
- className: "list-link",
285
- onClick: (L) => n == null ? void 0 : n(d.id, L),
286
- style: { display: "flex", alignItems: "center" },
287
- children: A
288
- }
289
- ),
290
- /* @__PURE__ */ o("div", { style: { display: "flex", gap: "var(--w6w-sp-1-5)" }, children: [
291
- /* @__PURE__ */ t(ze, { resource: { kind: "document", key: d.key } }),
292
- d.shared ? (R = a == null ? void 0 : a.sharedActions) == null ? void 0 : R.call(a, d) : /* @__PURE__ */ o(T, { children: [
255
+ ] })
256
+ ]
257
+ }
258
+ )
259
+ ] });
260
+ }
261
+ },
262
+ {
263
+ key: "actions",
264
+ header: "",
265
+ align: "right",
266
+ 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);
270
+ return (
271
+ // Clicks here must not reach the row's onOpen.
272
+ // 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: [
293
277
  /* @__PURE__ */ t(
294
- ae,
278
+ fe,
295
279
  {
296
280
  label: "Edit",
297
- onClick: () => f({ mode: "edit", d }),
298
- "data-testid": `document-edit-${d.id}`
281
+ onClick: () => w({ mode: "edit", d: m }),
282
+ "data-testid": `document-edit-${m.id}`
299
283
  }
300
284
  ),
301
285
  /* @__PURE__ */ t(
302
- Te,
286
+ Ve,
303
287
  {
304
288
  label: "Delete",
305
- onClick: () => m(d),
306
- disabled: u.isPending,
307
- "data-testid": `document-delete-${d.id}`
289
+ onClick: () => d(m),
290
+ disabled: c.isPending,
291
+ "data-testid": `document-delete-${m.id}`
308
292
  }
309
293
  )
310
294
  ] })
311
295
  ] }),
312
- I != null && /* @__PURE__ */ t("div", { style: { flexBasis: "100%" }, children: I })
313
- ] }, d.id);
314
- }) })
296
+ p != null && /* @__PURE__ */ t("div", { className: "w6w-doc-footer", children: p })
297
+ ] })
298
+ );
299
+ }
300
+ }
301
+ ];
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,
306
+ /* @__PURE__ */ t(
307
+ "button",
308
+ {
309
+ type: "button",
310
+ className: "btn",
311
+ disabled: o == null,
312
+ onClick: () => w({ mode: "create" }),
313
+ children: "+ Add document"
314
+ }
315
+ )
316
+ ] }),
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,
322
+ {
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
328
+ }
329
+ )
315
330
  ] })
316
331
  ] }),
317
332
  h && /* @__PURE__ */ t(
318
- Ge,
333
+ ft,
319
334
  {
320
335
  initial: h.mode === "edit" ? h.d : void 0,
321
- project: r,
322
- onClose: () => f(null),
323
- onSaved: () => f(null)
336
+ project: o,
337
+ onClose: () => w(null),
338
+ onSaved: () => w(null)
324
339
  }
325
340
  ),
326
- g && /* @__PURE__ */ t(
327
- Je,
341
+ N && /* @__PURE__ */ t(
342
+ wt,
328
343
  {
329
344
  title: "Delete document",
330
- message: `Delete the document "${g.key}"? This cannot be undone.`,
345
+ message: `Delete the document "${N.key}"? This cannot be undone.`,
331
346
  confirmLabel: "Delete",
332
347
  onConfirm: () => {
333
- r != null && u.mutate({ id: g.id, project: r }), m(null);
348
+ o != null && c.mutate({ id: N.id, project: o }), d(null);
334
349
  },
335
- onClose: () => m(null)
350
+ onClose: () => d(null)
336
351
  }
337
352
  )
338
353
  ] });
339
354
  }
340
- const lt = {
355
+ const Pt = {
341
356
  workflow: "Workflow run",
342
357
  workflow_step: "Workflow step",
343
358
  connection_test: "Connection test",
@@ -348,10 +363,10 @@ const lt = {
348
363
  endpoint: "Endpoint call",
349
364
  action: "App action"
350
365
  };
351
- function K(e) {
352
- return lt[e] ?? e;
366
+ function J(e) {
367
+ return Pt[e] ?? e;
353
368
  }
354
- const me = {
369
+ const Me = {
355
370
  workflow: "workflow",
356
371
  workflow_step: "workflow_step",
357
372
  connection_test: "base",
@@ -360,201 +375,201 @@ const me = {
360
375
  endpoint: "base",
361
376
  action: "base"
362
377
  };
363
- function rt(e) {
364
- return Object.hasOwn(me, e);
378
+ function Ot(e) {
379
+ return Object.hasOwn(Me, e);
365
380
  }
366
- function he(e) {
367
- return rt(e) ? me[e] : "base";
381
+ function De(e) {
382
+ return Ot(e) ? Me[e] : "base";
368
383
  }
369
- function ot(e, n) {
370
- const s = /* @__PURE__ */ new Map();
384
+ function qt(e, n) {
385
+ const i = /* @__PURE__ */ new Map();
371
386
  for (const a of e ?? []) {
372
- const r = a.displayName || a.key;
373
- r && s.set(a.id, r);
387
+ const o = a.displayName || a.key;
388
+ o && i.set(a.id, o);
374
389
  }
375
- const i = /* @__PURE__ */ new Map();
390
+ const s = /* @__PURE__ */ new Map();
376
391
  for (const a of n ?? []) {
377
- const r = a.displayName || a.name;
378
- r && i.set(a.id, r);
392
+ const o = a.displayName || a.name;
393
+ o && s.set(a.id, o);
379
394
  }
380
- return { functions: s, workflows: i };
395
+ return { functions: i, workflows: s };
381
396
  }
382
- function ct(e, n) {
383
- const s = e.summary ?? K(e.kind), i = he(e.kind);
384
- if (i === "function" && e.functionId !== null) {
397
+ function Ft(e, n) {
398
+ const i = e.summary ?? J(e.kind), s = De(e.kind);
399
+ if (s === "function" && e.functionId !== null) {
385
400
  const a = n.functions.get(e.functionId);
386
401
  if (a !== void 0)
387
402
  return { text: a, target: { kind: "function", id: e.functionId } };
388
403
  }
389
- if (i === "workflow" && e.workflowId !== null) {
404
+ if (s === "workflow" && e.workflowId !== null) {
390
405
  const a = n.workflows.get(e.workflowId);
391
406
  if (a !== void 0)
392
407
  return { text: a, target: { kind: "workflow", id: e.workflowId } };
393
408
  }
394
- if (i === "workflow_step") {
395
- const a = e.workflowId, r = a !== null ? n.workflows.get(a) : void 0, l = r ?? a ?? e.summary ?? "Unknown workflow", u = r !== void 0 && a !== null;
409
+ 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;
396
411
  return {
397
- text: e.stepId ? `${l} - ${e.stepId}` : l,
398
- target: u ? { kind: "workflow", id: a } : null
412
+ text: e.stepId ? `${r} - ${e.stepId}` : r,
413
+ target: c ? { kind: "workflow", id: a } : null
399
414
  };
400
415
  }
401
- return { text: s, target: null };
416
+ return { text: i, target: null };
402
417
  }
403
- const E = (e) => String(e).padStart(2, "0");
404
- function dt(e) {
418
+ const _ = (e) => String(e).padStart(2, "0");
419
+ function xe(e) {
405
420
  const n = new Date(e);
406
- return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${E(n.getMonth() + 1)}-${E(n.getDate())}`} ${E(n.getHours())}:${E(n.getMinutes())}:${E(n.getSeconds())}`;
421
+ return Number.isNaN(n.getTime()) ? e : `${`${n.getFullYear()}-${_(n.getMonth() + 1)}-${_(n.getDate())}`} ${_(n.getHours())}:${_(n.getMinutes())}:${_(n.getSeconds())}`;
407
422
  }
408
- function ut(e) {
423
+ function Ae(e) {
409
424
  return e == null || !Number.isFinite(e) || e < 0 ? null : e < 1e3 ? `${Math.round(e)} ms` : e < 6e4 ? `${(Math.floor(e / 100) / 10).toFixed(1)} s` : `${Math.floor(e / 6e4)}m ${Math.floor(e % 6e4 / 1e3)}s`;
410
425
  }
411
- function mt() {
426
+ function Kt() {
412
427
  const e = /* @__PURE__ */ new Date();
413
428
  return e.setHours(0, 0, 0, 0), e.toISOString();
414
429
  }
415
- function ht(e, n) {
416
- const s = new Date(e);
417
- if (Number.isNaN(s.getTime())) return e;
418
- const i = s.toLocaleDateString(void 0, { month: "short", day: "numeric" });
419
- return n === "week" ? `Week of ${i}` : i;
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" });
434
+ return n === "week" ? `Week of ${s}` : s;
420
435
  }
421
- function we({ ok: e }) {
436
+ function Re({ ok: e }) {
422
437
  return e === null ? /* @__PURE__ */ t("span", { className: "muted", children: "–" }) : /* @__PURE__ */ t("span", { className: e ? "ok" : "error", children: e ? "✓" : "✗" });
423
438
  }
424
- function B({ label: e, value: n }) {
425
- return /* @__PURE__ */ o("div", { className: "w6w-activity-card w6w-activity-stat", children: [
439
+ function G({ label: e, value: n }) {
440
+ return /* @__PURE__ */ l("div", { className: "w6w-activity-card w6w-activity-stat", children: [
426
441
  /* @__PURE__ */ t("div", { className: "w6w-activity-stat-value", children: n }),
427
442
  /* @__PURE__ */ t("div", { className: "muted small", children: e })
428
443
  ] });
429
444
  }
430
- function X({
445
+ function de({
431
446
  title: e,
432
447
  headline: n,
433
- loading: s
448
+ loading: i
434
449
  }) {
435
- const i = n ?? { workflowRuns: 0, succeeded: 0, failed: 0 };
436
- return /* @__PURE__ */ o("section", { className: "w6w-activity-section", children: [
450
+ const s = n ?? { workflowRuns: 0, succeeded: 0, failed: 0 };
451
+ return /* @__PURE__ */ l("section", { className: "w6w-activity-section", children: [
437
452
  /* @__PURE__ */ t("h3", { children: e }),
438
- s ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : /* @__PURE__ */ o("div", { className: "w6w-activity-stats", children: [
439
- /* @__PURE__ */ t(B, { label: "Workflow runs", value: i.workflowRuns }),
440
- /* @__PURE__ */ t(B, { label: "Succeeded", value: i.succeeded }),
441
- /* @__PURE__ */ t(B, { label: "Failed", value: i.failed })
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 })
442
457
  ] })
443
458
  ] });
444
459
  }
445
- function wt({
460
+ function Bt({
446
461
  entry: e,
447
462
  names: n,
448
- getHref: s,
449
- onOpen: i
463
+ getHref: i,
464
+ onOpen: s
450
465
  }) {
451
- const { text: a, target: r } = ct(e, n);
452
- if (r === null) return /* @__PURE__ */ t(T, { children: a });
453
- const l = i ? (u) => i(r, u) : void 0;
454
- return s ? /* @__PURE__ */ t("a", { href: s(r), onClick: l, children: a }) : l ? /* @__PURE__ */ t("button", { type: "button", className: "w6w-activity-link", onClick: l, children: a }) : /* @__PURE__ */ t(T, { children: a });
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 });
455
470
  }
456
- function fe({ entry: e, title: n }) {
457
- const s = ut(e.durationMs);
471
+ function Ee({ entry: e, title: n }) {
472
+ const i = Ae(e.durationMs);
458
473
  return /* @__PURE__ */ t(
459
- H,
474
+ te,
460
475
  {
461
- icon: /* @__PURE__ */ t(we, { ok: e.ok }),
462
- title: n ?? e.summary ?? K(e.kind),
463
- subtitle: `${K(e.kind)} · ${dt(e.occurredAt)}`,
464
- trailing: s === null ? void 0 : /* @__PURE__ */ t("span", { className: "muted small", children: s })
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 })
465
480
  }
466
481
  );
467
482
  }
468
- function F(e) {
469
- return /* @__PURE__ */ t(fe, { entry: e.entry, title: /* @__PURE__ */ t(wt, { ...e }) });
483
+ function X(e) {
484
+ return /* @__PURE__ */ t(Ee, { entry: e.entry, title: /* @__PURE__ */ t(Bt, { ...e }) });
470
485
  }
471
- const ft = {
472
- base: (e) => /* @__PURE__ */ t(fe, { entry: e.entry }),
473
- function: F,
474
- workflow: F,
475
- workflow_step: F
486
+ const Wt = {
487
+ base: (e) => /* @__PURE__ */ t(Ee, { entry: e.entry }),
488
+ function: X,
489
+ workflow: X,
490
+ workflow_step: X
476
491
  };
477
- function pt(e) {
478
- const n = ft[he(e.entry.kind)];
492
+ function _t(e) {
493
+ const n = Wt[De(e.entry.kind)];
479
494
  return /* @__PURE__ */ t(n, { ...e });
480
495
  }
481
- function tn({ getHref: e, onOpen: n, slots: s }) {
482
- var p, v, d, N, A, I;
483
- const i = G("today", { from: mt(), bucket: "day" }), a = G("week", { bucket: "week" }), r = ne(), l = re(), u = D(
484
- () => ot(r.data, l.data),
485
- [r.data, l.data]
486
- ), h = i.error ?? a.error, f = h ? h.message : null, g = ((p = a.data) == null ? void 0 : p.recent) ?? [], m = ((v = a.data) == null ? void 0 : v.series) ?? [], b = ((d = a.data) == null ? void 0 : d.range.bucket) ?? "week", y = !a.isLoading && g.length === 0 && (((N = a.data) == null ? void 0 : N.headline.workflowRuns) ?? 0) === 0;
487
- return /* @__PURE__ */ o("div", { className: "w6w-embed-root", children: [
488
- f && /* @__PURE__ */ t("div", { className: "error", children: f }),
489
- s == null ? void 0 : s.header,
490
- s == null ? void 0 : s.actions,
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,
491
506
  /* @__PURE__ */ t(
492
- X,
507
+ de,
493
508
  {
494
509
  title: "Today",
495
- headline: (A = i.data) == null ? void 0 : A.headline,
496
- loading: i.isLoading
510
+ headline: (T = s.data) == null ? void 0 : T.headline,
511
+ loading: s.isLoading
497
512
  }
498
513
  ),
499
514
  /* @__PURE__ */ t(
500
- X,
515
+ de,
501
516
  {
502
517
  title: "Last 7 days",
503
- headline: (I = a.data) == null ? void 0 : I.headline,
518
+ headline: (x = a.data) == null ? void 0 : x.headline,
504
519
  loading: a.isLoading
505
520
  }
506
521
  ),
507
- s == null ? void 0 : s.betweenHeadlineAndSeries,
508
- /* @__PURE__ */ o("section", { className: "w6w-activity-section", children: [
522
+ i == null ? void 0 : i.betweenHeadlineAndSeries,
523
+ /* @__PURE__ */ l("section", { className: "w6w-activity-section", children: [
509
524
  /* @__PURE__ */ t("h3", { children: "Activity over time" }),
510
- /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: a.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : m.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No activity in this window yet." }) : /* @__PURE__ */ t("ul", { className: "list", children: m.map((w) => /* @__PURE__ */ o("li", { children: [
511
- /* @__PURE__ */ o("span", { className: "list-main", children: [
512
- /* @__PURE__ */ t("strong", { children: ht(w.bucket, b) }),
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) }),
513
528
  " ",
514
- /* @__PURE__ */ t("span", { className: "muted small", children: K(w.kind) })
529
+ /* @__PURE__ */ t("span", { className: "muted small", children: J(v.kind) })
515
530
  ] }),
516
531
  " ",
517
- /* @__PURE__ */ t(we, { ok: w.ok }),
532
+ /* @__PURE__ */ t(Re, { ok: v.ok }),
518
533
  " ",
519
- /* @__PURE__ */ t("span", { className: "muted small", children: w.count })
520
- ] }, `${w.bucket}-${w.kind}-${String(w.ok)}`)) }) })
534
+ /* @__PURE__ */ t("span", { className: "muted small", children: v.count })
535
+ ] }, `${v.bucket}-${v.kind}-${String(v.ok)}`)) }) })
521
536
  ] }),
522
- /* @__PURE__ */ o("section", { children: [
537
+ /* @__PURE__ */ l("section", { children: [
523
538
  /* @__PURE__ */ t("h3", { className: "w6w-activity-h3", children: "Recent activity" }),
524
- /* @__PURE__ */ t("div", { className: "w6w-activity-card", children: a.isLoading ? /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }) : y ? (s == null ? void 0 : s.empty) ?? /* @__PURE__ */ t("p", { className: "muted", children: "No runs yet — activity shows up here once your workflows run." }) : g.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No recent activity in this window." }) : /* @__PURE__ */ t("div", { className: "list", children: g.map((w) => /* @__PURE__ */ t(
525
- pt,
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,
526
541
  {
527
- entry: w,
528
- names: u,
542
+ entry: v,
543
+ names: c,
529
544
  getHref: e,
530
545
  onOpen: n
531
546
  },
532
- w.id
547
+ v.id
533
548
  )) }) })
534
549
  ] })
535
550
  ] });
536
551
  }
537
- function gt(e) {
552
+ function Ht(e) {
538
553
  return e !== null && "project" in e;
539
554
  }
540
- function nn(e) {
541
- const n = U().project, [s, i] = $(He), a = e.scope !== void 0 ? e.scope : n ? { project: n } : null, r = e.filters !== void 0, l = e.filters ?? s, u = (h) => {
542
- var f;
543
- r || i(h), (f = e.onFiltersChange) == null || f.call(e, h);
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);
544
559
  };
545
560
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root", children: /* @__PURE__ */ t(
546
- Xe,
561
+ gt,
547
562
  {
548
563
  scope: a,
549
- showKind: e.showKind ?? gt(a),
550
- filters: l,
551
- onFiltersChange: u,
564
+ showKind: e.showKind ?? Ht(a),
565
+ filters: r,
566
+ onFiltersChange: c,
552
567
  onOpenInEditor: e.onOpenInEditor
553
568
  }
554
569
  ) });
555
570
  }
556
- const yt = 1440 * 60 * 1e3;
557
- function Nt(e) {
571
+ const Ut = 1440 * 60 * 1e3;
572
+ function Vt(e) {
558
573
  if (!(e === null || e.timeline === null))
559
574
  return e.timeline.map((n) => ({
560
575
  id: n.id,
@@ -567,39 +582,39 @@ function Nt(e) {
567
582
  link: n.link
568
583
  }));
569
584
  }
570
- function pe(e) {
585
+ function je(e) {
571
586
  return e.startedAt !== void 0 && e.resolvedAt === void 0;
572
587
  }
573
- function ee(e) {
588
+ function ue(e) {
574
589
  const n = new Date(e);
575
590
  return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone: "UTC" });
576
591
  }
577
- function te(e, n) {
578
- const s = new Date(e).getTime();
579
- return Number.isNaN(s) ? 0 : Math.max(0, Math.floor((n - s) / yt));
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));
580
595
  }
581
- function vt(e, n) {
582
- if (!pe(e) || e.startedAt === void 0) return null;
583
- const s = te(e.startedAt, n), i = ee(e.startedAt), a = s === 0 ? `open since ${i} (today)` : `open ${s}d (since ${i})`, r = e.updatedAt ?? e.startedAt, l = te(r, n), u = ee(r), h = l === 0 ? `last update ${u} (today)` : `last update ${u} (${l}d ago)`;
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)`;
584
599
  return `${a} · ${h}`;
585
600
  }
586
- function bt(e) {
601
+ function Zt(e) {
587
602
  return e ? Object.entries(e) : [];
588
603
  }
589
- function kt(e) {
604
+ function Jt(e) {
590
605
  return e.uptime.map((n) => ({ day: n.day, state: n.state }));
591
606
  }
592
- const x = [
607
+ const Q = [
593
608
  ["e4xx", "4xx"],
594
609
  ["e429", "429 rate-limited"],
595
610
  ["eAuth", "auth (401/403)"],
596
611
  ["e5xx", "5xx"]
597
612
  ];
598
- function ge(e) {
613
+ function Se(e) {
599
614
  const n = new Date(e);
600
615
  return Number.isNaN(n.getTime()) ? e : n.toLocaleDateString(void 0, { month: "short", day: "numeric" });
601
616
  }
602
- function Y(e) {
617
+ function oe(e) {
603
618
  if (!e) return "—";
604
619
  const n = new Date(e);
605
620
  return Number.isNaN(n.getTime()) ? e : n.toLocaleString(void 0, {
@@ -609,49 +624,49 @@ function Y(e) {
609
624
  minute: "2-digit"
610
625
  });
611
626
  }
612
- function S({ label: e, value: n, hint: s }) {
613
- return /* @__PURE__ */ o("div", { className: "w6w-rel-card", style: { flex: "1 1 150px", minWidth: 150 }, children: [
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: [
614
629
  /* @__PURE__ */ t("div", { style: { fontSize: "1.6rem", fontWeight: "var(--w6w-fw-semibold)", lineHeight: 1.15 }, children: n }),
615
630
  /* @__PURE__ */ t("div", { className: "muted small", children: e }),
616
- s && /* @__PURE__ */ t("div", { className: "muted small", children: s })
631
+ i && /* @__PURE__ */ t("div", { className: "muted small", children: i })
617
632
  ] });
618
633
  }
619
- function Ct({
634
+ function zt({
620
635
  vendor: e,
621
636
  displayName: n
622
637
  }) {
623
638
  if (!e)
624
- return /* @__PURE__ */ o("div", { className: "w6w-rel-card", children: [
625
- /* @__PURE__ */ o("h4", { style: { margin: "0 0 var(--w6w-sp-1)" }, children: [
639
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
640
+ /* @__PURE__ */ l("h4", { style: { margin: "0 0 var(--w6w-sp-1)" }, children: [
626
641
  n,
627
642
  " status"
628
643
  ] }),
629
- /* @__PURE__ */ o("p", { className: "muted", children: [
644
+ /* @__PURE__ */ l("p", { className: "muted", children: [
630
645
  n,
631
646
  " publishes no public health check, so there is nothing to ask about it. That is a statement about ",
632
647
  n,
633
648
  ", not a gap in the data above."
634
649
  ] })
635
650
  ] });
636
- const s = e.state === "unknown", i = bt(e.components), a = (e.timeline ?? []).filter(pe), r = Date.now();
637
- return /* @__PURE__ */ o("div", { className: "w6w-rel-card", children: [
638
- /* @__PURE__ */ o("h4", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
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: [
639
654
  n,
640
655
  " status",
641
656
  " ",
642
- /* @__PURE__ */ t(Q, { state: e.state, label: s ? "Unavailable" : void 0 })
657
+ /* @__PURE__ */ t(Z, { state: e.state, label: i ? "Unavailable" : void 0 })
643
658
  ] }),
644
- s && /* @__PURE__ */ t("p", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "We could not get a status from this API, so we cannot say whether it is up. That is separate from your own calls above, which are measured here regardless." }),
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." }),
645
660
  e.message && /* @__PURE__ */ t(
646
661
  "p",
647
662
  {
648
- className: s ? "muted small" : void 0,
663
+ className: i ? "muted small" : void 0,
649
664
  style: { margin: "0 0 var(--w6w-sp-2)" },
650
665
  children: e.message
651
666
  }
652
667
  ),
653
- /* @__PURE__ */ o("p", { className: "muted small", style: { margin: 0 }, children: [
654
- s ? "Tried to read" : "Read from",
668
+ /* @__PURE__ */ l("p", { className: "muted small", style: { margin: 0 }, children: [
669
+ i ? "Tried to read" : "Read from",
655
670
  " ",
656
671
  n,
657
672
  "'s own status page — what",
@@ -659,167 +674,167 @@ function Ct({
659
674
  n,
660
675
  " says about itself, not what your calls did · last checked",
661
676
  " ",
662
- Y(e.checkedAt),
663
- e.attributedTo.length > 0 && /* @__PURE__ */ o(T, { children: [
677
+ oe(e.checkedAt),
678
+ e.attributedTo.length > 0 && /* @__PURE__ */ l(D, { children: [
664
679
  " ",
665
680
  "· decided by",
666
681
  " ",
667
- e.attributedTo.map((l) => /* @__PURE__ */ t("code", { children: l }, l))
682
+ e.attributedTo.map((r) => /* @__PURE__ */ t("code", { children: r }, r))
668
683
  ] })
669
684
  ] }),
670
- i.length > 0 && /* @__PURE__ */ t("div", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: i.map(([l, u]) => /* @__PURE__ */ o("span", { className: "w6w-rel-tag", children: [
671
- l,
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,
672
687
  ": ",
673
- u.state
674
- ] }, l)) }),
675
- a.length > 0 && /* @__PURE__ */ t("ul", { className: "list", style: { margin: "var(--w6w-sp-2) 0 0" }, children: a.map((l) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ o("div", { className: "list-main", children: [
676
- /* @__PURE__ */ t("strong", { children: l.title }),
688
+ 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 }),
677
692
  " ",
678
- /* @__PURE__ */ t(Q, { state: l.state }),
679
- /* @__PURE__ */ t("div", { className: "muted small", children: vt(l, r) })
680
- ] }) }, l.id ?? l.title)) }),
681
- e.statusPageUrl !== null && /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: /* @__PURE__ */ o("a", { href: e.statusPageUrl, target: "_blank", rel: "noopener noreferrer", children: [
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: [
682
697
  n,
683
698
  "'s status page ↗"
684
699
  ] }) })
685
700
  ] });
686
701
  }
687
- function $t({ service: e }) {
702
+ function Gt({ service: e }) {
688
703
  if (e.calls === 0)
689
704
  return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("span", { className: "w6w-rel-idle-note", children: "No calls in this window" }) });
690
- const n = e.uptime, s = Math.max(1, ...n.map((i) => i.calls));
691
- return /* @__PURE__ */ o("div", { className: "w6w-rel-card", children: [
705
+ const n = e.uptime, i = Math.max(1, ...n.map((s) => s.calls));
706
+ return /* @__PURE__ */ l("div", { className: "w6w-rel-card", children: [
692
707
  /* @__PURE__ */ t(
693
708
  "div",
694
709
  {
695
710
  className: "rel-daily-chart",
696
711
  role: "img",
697
712
  "aria-label": `${e.displayName}, calls per day, oldest first`,
698
- children: n.map((i) => /* @__PURE__ */ t(
713
+ children: n.map((s) => /* @__PURE__ */ t(
699
714
  "span",
700
715
  {
701
- className: `rel-daily-bar rel-daily-bar-${i.state}`,
702
- style: { height: `${i.calls > 0 ? Math.max(i.calls / s * 100, 4) : 2}%` },
703
- title: `${ge(`${i.day}T00:00:00.000Z`)} — ${i.calls} calls, ${i.state}`
716
+ 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}`
704
719
  },
705
- i.day
720
+ s.day
706
721
  ))
707
722
  }
708
723
  ),
709
724
  /* @__PURE__ */ t("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: "Calls per day, oldest first. Bar colour is that day's own state." })
710
725
  ] });
711
726
  }
712
- function It({
727
+ function Xt({
713
728
  service: e,
714
729
  window: n
715
730
  }) {
716
- const s = [...e.uptime].reverse().filter((l) => l.calls > 0), i = e.vendorStatus, a = Nt(i), r = a === void 0 ? `${e.displayName} publishes no incident history.` : `No incidents from ${e.displayName} in this window.`;
717
- return /* @__PURE__ */ o("div", { className: "w6w-rel-card", children: [
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: [
718
733
  /* @__PURE__ */ t(
719
- De,
734
+ Ye,
720
735
  {
721
736
  window: n,
722
- days: kt(e),
737
+ days: Jt(e),
723
738
  incidents: a,
724
- vendorEmptyLabel: r,
739
+ vendorEmptyLabel: o,
725
740
  ariaLabel: `${e.displayName}, ${e.uptime.length}-day status and ${e.displayName} incidents, oldest day first`
726
741
  }
727
742
  ),
728
- /* @__PURE__ */ o("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: [
743
+ /* @__PURE__ */ l("p", { className: "muted small", style: { margin: "var(--w6w-sp-2) 0 0" }, children: [
729
744
  "Oldest day leftmost. Days with no calls are ",
730
745
  /* @__PURE__ */ t("code", { children: "unknown" }),
731
746
  " — never a quiet green."
732
747
  ] }),
733
- s.length > 0 && /* @__PURE__ */ t("div", { className: "list", style: { marginTop: "var(--w6w-sp-3)" }, children: s.slice(0, 14).map((l) => /* @__PURE__ */ o("div", { className: "rel-day-row", children: [
734
- /* @__PURE__ */ t("span", { style: { minWidth: 96 }, children: /* @__PURE__ */ t("strong", { children: ge(`${l.day}T00:00:00.000Z`) }) }),
735
- /* @__PURE__ */ t(Q, { state: l.state }),
736
- /* @__PURE__ */ o("span", { className: "muted small", children: [
737
- l.calls,
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,
738
753
  " calls"
739
754
  ] }),
740
- /* @__PURE__ */ t("span", { className: "rel-errors", children: x.filter(([u]) => l.errors[u] > 0).map(([u, h]) => /* @__PURE__ */ o("span", { className: "w6w-rel-tag", children: [
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: [
741
756
  h,
742
757
  " ×",
743
- l.errors[u]
744
- ] }, u)) })
745
- ] }, l.day)) })
758
+ r.errors[c]
759
+ ] }, c)) })
760
+ ] }, r.day)) })
746
761
  ] });
747
762
  }
748
- function Lt({ errors: e }) {
749
- if (x.reduce((i, [a]) => i + e[a], 0) === 0)
763
+ function en({ errors: e }) {
764
+ if (Q.reduce((s, [a]) => s + e[a], 0) === 0)
750
765
  return /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t("p", { className: "muted", style: { margin: 0 }, children: "No errors in this window." }) });
751
- const s = Math.max(1, ...x.map(([i]) => e[i]));
752
- return /* @__PURE__ */ t("div", { className: "w6w-rel-card rel-errormix-chart", children: x.map(([i, a]) => /* @__PURE__ */ o("div", { className: "rel-errormix-row", children: [
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: [
753
768
  /* @__PURE__ */ t("span", { className: "muted small", children: a }),
754
769
  /* @__PURE__ */ t("span", { className: "rel-errormix-track", children: /* @__PURE__ */ t(
755
770
  "span",
756
771
  {
757
772
  className: "rel-errormix-bar",
758
- style: { width: `${Math.max(e[i] / s * 100, e[i] > 0 ? 2 : 0)}%` }
773
+ style: { width: `${Math.max(e[s] / i * 100, e[s] > 0 ? 2 : 0)}%` }
759
774
  }
760
775
  ) }),
761
- /* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[i] })
762
- ] }, i)) });
763
- }
764
- function At({ project: e, appId: n }) {
765
- const s = Ve(e, n, { limit: 50 });
766
- if (s.isLoading) return /* @__PURE__ */ t("p", { className: "muted", children: "Loading calls…" });
767
- if (s.error) {
768
- const a = s.error;
769
- return /* @__PURE__ */ t("div", { className: "error", children: (a instanceof ce, a.message) });
776
+ /* @__PURE__ */ t("span", { className: "rel-errormix-value small", children: e[s] })
777
+ ] }, s)) });
778
+ }
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) });
770
785
  }
771
- const i = s.data ?? [];
772
- return i.length === 0 ? /* @__PURE__ */ t("p", { className: "muted", children: "No calls captured for this service. Calls appear here once a workflow, function or ad-hoc invoke reaches it." }) : /* @__PURE__ */ o("div", { className: "rel-calls", children: [
773
- /* @__PURE__ */ o("div", { className: "rel-call rel-call-head", children: [
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: [
774
789
  /* @__PURE__ */ t("span", { children: "When" }),
775
790
  /* @__PURE__ */ t("span", { children: "Action" }),
776
791
  /* @__PURE__ */ t("span", { children: "Method" }),
777
792
  /* @__PURE__ */ t("span", { children: "Status" }),
778
793
  /* @__PURE__ */ t("span", { children: "Took" })
779
794
  ] }),
780
- i.map((a, r) => /* @__PURE__ */ o("div", { className: "rel-call", children: [
781
- /* @__PURE__ */ t("span", { className: "muted small", children: Y(a.createdAt) }),
795
+ s.map((a, o) => /* @__PURE__ */ l("div", { className: "rel-call", children: [
796
+ /* @__PURE__ */ t("span", { className: "muted small", children: oe(a.createdAt) }),
782
797
  /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t("code", { children: a.actionKey ?? "—" }) }),
783
798
  /* @__PURE__ */ t("span", { className: "muted small", children: a.method }),
784
799
  /* @__PURE__ */ t("span", { className: a.status >= 400 || a.status === 0 ? "error" : "ok", children: a.status === 0 ? "no response" : a.status }),
785
800
  /* @__PURE__ */ t("span", { className: "muted small", children: a.durationMs != null ? `${a.durationMs} ms` : "—" })
786
- ] }, a.id ?? `${a.createdAt}-${r}`))
801
+ ] }, a.id ?? `${a.createdAt}-${o}`))
787
802
  ] });
788
803
  }
789
- function Mt({
804
+ function nn({
790
805
  backHref: e,
791
806
  onBack: n
792
807
  }) {
793
808
  return e !== void 0 ? /* @__PURE__ */ t("p", { children: /* @__PURE__ */ t("a", { href: e, onClick: n, children: "← Back to all services" }) }) : n ? /* @__PURE__ */ t("p", { children: /* @__PURE__ */ t("button", { type: "button", className: "list-link", onClick: n, children: "← Back to all services" }) }) : null;
794
809
  }
795
- function an({
810
+ function Xn({
796
811
  appId: e,
797
812
  project: n,
798
- days: s = 30,
799
- backHref: i,
813
+ days: i = 30,
814
+ backHref: s,
800
815
  onBack: a,
801
- slots: r
816
+ slots: o
802
817
  }) {
803
- var b, y, p, v;
804
- const l = U().project, u = (n === void 0 ? l : n) || void 0, h = Ue(u, [e], s), f = h.error, g = f ? (f instanceof ce, f.message) : null, m = (b = h.data) == null ? void 0 : b.services.find((d) => d.appId === e);
805
- return /* @__PURE__ */ o("div", { className: "w6w-embed-root", children: [
806
- r == null ? void 0 : r.header,
807
- r == null ? void 0 : r.actions,
808
- !u && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see this service." }),
809
- g && /* @__PURE__ */ t("div", { className: "error", children: g }),
810
- u && h.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
811
- h.data && !m && /* @__PURE__ */ o("div", { className: "w6w-rel-card", children: [
812
- (r == null ? void 0 : r.empty) ?? /* @__PURE__ */ o("p", { className: "muted", children: [
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: [
821
+ o == null ? void 0 : o.header,
822
+ o == null ? void 0 : o.actions,
823
+ !c && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Select a project to see this service." }),
824
+ 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: [
813
828
  /* @__PURE__ */ t("code", { children: e }),
814
829
  " is not used by this project's definitions and has no calls in the last ",
815
- s,
830
+ i,
816
831
  " days."
817
832
  ] }),
818
- /* @__PURE__ */ t(Mt, { backHref: i, onBack: a })
833
+ /* @__PURE__ */ t(nn, { backHref: s, onBack: a })
819
834
  ] }),
820
- m && /* @__PURE__ */ o(T, { children: [
821
- /* @__PURE__ */ o("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
822
- /* @__PURE__ */ o(
835
+ d && /* @__PURE__ */ l(D, { children: [
836
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
837
+ /* @__PURE__ */ l(
823
838
  "div",
824
839
  {
825
840
  style: {
@@ -829,357 +844,1060 @@ function an({
829
844
  marginBottom: "var(--w6w-sp-3)"
830
845
  },
831
846
  children: [
832
- /* @__PURE__ */ t(Q, { state: m.state }),
847
+ /* @__PURE__ */ t(Z, { state: d.state }),
833
848
  /* @__PURE__ */ t("span", { className: "muted small", children: "from your calls" }),
834
- /* @__PURE__ */ t("code", { className: "muted small", children: m.appId }),
835
- m.ongoingOutageId && /* @__PURE__ */ t("span", { className: "w6w-rel-tag", children: "outage still open" })
849
+ /* @__PURE__ */ t("code", { className: "muted small", children: d.appId }),
850
+ d.ongoingOutageId && /* @__PURE__ */ t("span", { className: "w6w-rel-tag", children: "outage still open" })
836
851
  ]
837
852
  }
838
853
  ),
839
- /* @__PURE__ */ o("div", { style: { display: "flex", gap: "var(--w6w-sp-3)", flexWrap: "wrap" }, children: [
840
- /* @__PURE__ */ t(S, { label: "Calls in window", value: String(m.calls) }),
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) }),
841
856
  /* @__PURE__ */ t(
842
- S,
857
+ Y,
843
858
  {
844
859
  label: "p95 latency",
845
- value: m.p95Ms === null ? "—" : `${m.p95Ms} ms`,
846
- hint: m.p95Ms === null ? "no timed calls" : void 0
860
+ value: d.p95Ms === null ? "—" : `${d.p95Ms} ms`,
861
+ hint: d.p95Ms === null ? "no timed calls" : void 0
847
862
  }
848
863
  ),
849
- /* @__PURE__ */ t(S, { label: "Last call", value: Y(m.lastCallAt) }),
864
+ /* @__PURE__ */ t(Y, { label: "Last call", value: oe(d.lastCallAt) }),
850
865
  /* @__PURE__ */ t(
851
- S,
866
+ Y,
852
867
  {
853
868
  label: "Errors",
854
- value: String(x.reduce((d, [N]) => d + m.errors[N], 0)),
855
- hint: x.filter(([d]) => m.errors[d] > 0).map(([d, N]) => `${N} ×${m.errors[d]}`).join(" · ") || "none"
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"
856
871
  }
857
872
  )
858
873
  ] })
859
874
  ] }),
860
- /* @__PURE__ */ o("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
875
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
861
876
  /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "Error mix" }),
862
- /* @__PURE__ */ t(Lt, { errors: m.errors })
877
+ /* @__PURE__ */ t(en, { errors: d.errors })
863
878
  ] }),
864
- /* @__PURE__ */ o("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
879
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
865
880
  /* @__PURE__ */ t("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: "API status" }),
866
- /* @__PURE__ */ t(Ct, { vendor: m.vendorStatus, displayName: m.displayName })
881
+ /* @__PURE__ */ t(zt, { vendor: d.vendorStatus, displayName: d.displayName })
867
882
  ] }),
868
- /* @__PURE__ */ o("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
869
- /* @__PURE__ */ o("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
883
+ /* @__PURE__ */ l("section", { style: { marginBottom: "var(--w6w-sp-5)" }, children: [
884
+ /* @__PURE__ */ l("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
870
885
  "Last ",
871
- ((y = h.data) == null ? void 0 : y.window.days) ?? s,
886
+ ((k = h.data) == null ? void 0 : k.window.days) ?? i,
872
887
  " days",
873
888
  " ",
874
- /* @__PURE__ */ o("span", { className: "muted small", children: [
889
+ /* @__PURE__ */ l("span", { className: "muted small", children: [
875
890
  "uptime means ",
876
- (p = h.data) == null ? void 0 : p.uptimeMeans
891
+ (b = h.data) == null ? void 0 : b.uptimeMeans
877
892
  ] })
878
893
  ] }),
879
- /* @__PURE__ */ t(It, { service: m, window: ((v = h.data) == null ? void 0 : v.window) ?? { from: "", to: "" } }),
880
- /* @__PURE__ */ t($t, { service: m })
894
+ /* @__PURE__ */ t(Xt, { service: d, window: ((g = h.data) == null ? void 0 : g.window) ?? { from: "", to: "" } }),
895
+ /* @__PURE__ */ t(Gt, { service: d })
881
896
  ] }),
882
- /* @__PURE__ */ o("section", { children: [
883
- /* @__PURE__ */ o("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
897
+ /* @__PURE__ */ l("section", { children: [
898
+ /* @__PURE__ */ l("h3", { style: { margin: "0 0 var(--w6w-sp-2)" }, children: [
884
899
  "Recent calls",
885
900
  " ",
886
901
  /* @__PURE__ */ t("span", { className: "muted small", children: "the requests behind the numbers above" })
887
902
  ] }),
888
- /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(At, { project: u, appId: m.appId }) })
903
+ /* @__PURE__ */ t("div", { className: "w6w-rel-card", children: /* @__PURE__ */ t(tn, { project: c, appId: d.appId }) })
889
904
  ] })
890
905
  ] })
891
906
  ] });
892
907
  }
893
- const Tt = [];
894
- function sn({ onOpen: e, getHref: n, addLabel: s, slots: i }) {
895
- const a = ie(), r = de(), l = et(), h = l.data ?? Tt, f = D(() => se(h), [h]), { byId: g } = oe(f), m = tt(), [b, y] = $(!1), [p, v] = $(null), [d, N] = $(null), A = typeof a.updateConnection == "function", I = i && "actions" in i ? i.actions : /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn", onClick: () => y(!0), children: s ?? "+ Add connection" });
896
- return /* @__PURE__ */ o("div", { className: "w6w-embed-root", children: [
908
+ function an(e) {
909
+ if (typeof e == "string") return e;
910
+ if (e && typeof e == "object") {
911
+ const n = e;
912
+ for (const i of ["stepId", "step", "id", "nodeId", "key"])
913
+ if (typeof n[i] == "string") return n[i];
914
+ }
915
+ return String(e);
916
+ }
917
+ function sn({
918
+ routes: e,
919
+ projectId: n
920
+ }) {
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: [
924
+ /* @__PURE__ */ t("span", { className: "badge", children: "route" }),
925
+ " ",
926
+ /* @__PURE__ */ t("span", { children: o.name }),
927
+ " ",
928
+ o.status === "broken" && /* @__PURE__ */ l(D, { children: [
929
+ /* @__PURE__ */ t("span", { className: "tag warn", children: "broken" }),
930
+ " ",
931
+ /* @__PURE__ */ t(
932
+ "button",
933
+ {
934
+ type: "button",
935
+ className: "btn link",
936
+ "data-testid": `connection-route-reconnect-${o.id}`,
937
+ onClick: () => s(o.id),
938
+ children: "Reconnect"
939
+ }
940
+ )
941
+ ] })
942
+ ] }, o.id)) }),
943
+ a != null && /* @__PURE__ */ t(
944
+ ln,
945
+ {
946
+ routeId: a.id,
947
+ projectId: a.project ?? n,
948
+ onDone: () => s(null)
949
+ }
950
+ )
951
+ ] });
952
+ }
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 }),
956
+ /* @__PURE__ */ t("button", { type: "button", className: "btn link", onClick: e.onDone, children: "Done" })
957
+ ] });
958
+ }
959
+ function Pe({
960
+ callables: e,
961
+ onOpenCallable: n,
962
+ routes: i,
963
+ projectId: s
964
+ }) {
965
+ return /* @__PURE__ */ l(D, { children: [
966
+ /* @__PURE__ */ t(sn, { routes: i ?? [], projectId: s }),
967
+ /* @__PURE__ */ t(rn, { callables: e, onOpenCallable: n })
968
+ ] });
969
+ }
970
+ function rn({
971
+ callables: e,
972
+ onOpenCallable: n
973
+ }) {
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 }),
978
+ " ",
979
+ n ? /* @__PURE__ */ t(
980
+ "button",
981
+ {
982
+ type: "button",
983
+ className: "btn link",
984
+ onClick: () => n(i.kind, i.id),
985
+ children: s
986
+ }
987
+ ) : /* @__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: [
990
+ " · ",
991
+ a.join(", ")
992
+ ] })
993
+ ] }, `${i.kind}:${i.id}`);
994
+ }) });
995
+ }
996
+ const on = [];
997
+ function ea({
998
+ onOpen: e,
999
+ getHref: n,
1000
+ addLabel: i,
1001
+ slots: s,
1002
+ onOpenCallable: a
1003
+ }) {
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: [
897
1007
  /* @__PURE__ */ t(
898
- xe,
1008
+ Ze,
899
1009
  {
900
- connections: h,
901
- appsById: g,
902
- loading: l.isLoading,
903
- error: l.error ? l.error.message : null,
1010
+ connections: w,
1011
+ appsById: d,
1012
+ loading: c.isLoading,
1013
+ error: c.error ? c.error.message : null,
904
1014
  onOpen: e,
905
1015
  getHref: n,
906
- onEdit: A ? v : void 0,
907
- onDelete: N,
908
- busy: m.isPending,
909
- slots: { ...i, actions: I }
1016
+ onEdit: O ? m : void 0,
1017
+ onDelete: T,
1018
+ busy: y.isPending,
1019
+ slots: { ...s, actions: R }
910
1020
  }
911
1021
  ),
912
- b && /* @__PURE__ */ t(
913
- Ee,
1022
+ k && /* @__PURE__ */ t(
1023
+ Je,
914
1024
  {
915
- onClose: () => y(!1),
1025
+ onClose: () => b(!1),
916
1026
  onCreated: () => {
917
- y(!1), r.invalidateQueries({ queryKey: q });
1027
+ b(!1), r.invalidateQueries({ queryKey: ne });
918
1028
  }
919
1029
  }
920
1030
  ),
921
- p && /* @__PURE__ */ t(
922
- le,
1031
+ g && /* @__PURE__ */ t(
1032
+ ye,
923
1033
  {
924
- connection: p,
925
- onClose: () => v(null),
1034
+ connection: g,
1035
+ onClose: () => m(null),
926
1036
  onSaved: () => {
927
- const w = p.id;
928
- v(null), r.invalidateQueries({ queryKey: q }), r.invalidateQueries({ queryKey: ue(w) });
1037
+ const M = g.id;
1038
+ m(null), r.invalidateQueries({ queryKey: ne }), r.invalidateQueries({ queryKey: Te(M) });
929
1039
  }
930
1040
  }
931
1041
  ),
932
- d && /* @__PURE__ */ t(
933
- Re,
1042
+ p && /* @__PURE__ */ t(
1043
+ cn,
934
1044
  {
935
- title: "Delete connection",
936
- message: `Delete the connection "${d.displayName || d.id}"? This cannot be undone.`,
937
- confirmLabel: "Delete",
938
- onClose: () => N(null),
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),
939
1052
  onConfirm: () => {
940
- const w = d.id;
941
- N(null), m.mutate(w);
1053
+ const M = p.id;
1054
+ T(null), y.mutate({ id: M, force: !0 });
942
1055
  }
943
1056
  }
944
1057
  )
945
1058
  ] });
946
1059
  }
947
- function P(e) {
1060
+ function cn({
1061
+ name: e,
1062
+ loading: n,
1063
+ callables: i,
1064
+ routes: s,
1065
+ projectId: a,
1066
+ onOpenCallable: o,
1067
+ onClose: r,
1068
+ onConfirm: c
1069
+ }) {
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
1076
+ ].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: [
1081
+ /* @__PURE__ */ t(
1082
+ Pe,
1083
+ {
1084
+ callables: i,
1085
+ routes: s,
1086
+ projectId: a,
1087
+ onOpenCallable: o
1088
+ }
1089
+ ),
1090
+ /* @__PURE__ */ t("p", { className: "w6w-small", children: b.join(" ") })
1091
+ ] })
1092
+ ] }),
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" }),
1095
+ /* @__PURE__ */ t(
1096
+ "button",
1097
+ {
1098
+ type: "button",
1099
+ className: "w6w-btn w6w-btn-danger",
1100
+ disabled: n,
1101
+ onClick: c,
1102
+ children: "Delete"
1103
+ }
1104
+ )
1105
+ ] })
1106
+ ] });
1107
+ }
1108
+ function ee(e) {
948
1109
  const n = new Date(e).getTime();
949
1110
  if (Number.isNaN(n)) return "recently";
950
- const s = Math.max(0, Math.round((Date.now() - n) / 1e3));
951
- if (s < 45) return "just now";
952
- const i = Math.round(s / 60);
953
- if (i < 60) return `${i}m ago`;
954
- const a = Math.round(i / 60);
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);
1114
+ if (s < 60) return `${s}m ago`;
1115
+ const a = Math.round(s / 60);
955
1116
  if (a < 24) return `${a}h ago`;
956
- const r = Math.round(a / 24);
957
- return r < 30 ? `${r}d ago` : new Date(e).toLocaleDateString();
1117
+ const o = Math.round(a / 24);
1118
+ return o < 30 ? `${o}d ago` : new Date(e).toLocaleDateString();
958
1119
  }
959
- const Dt = {
1120
+ const dn = {
960
1121
  ok: 6e3,
961
1122
  warn: 1e4,
962
1123
  error: 15e3
963
- }, xt = { ok: "✓", warn: "!", error: "✕" };
964
- function ln({
1124
+ }, un = { ok: "✓", warn: "!", error: "✕" };
1125
+ function ta({
965
1126
  connectionId: e,
966
1127
  onOpenAction: n,
967
- onBack: s,
968
- slots: i
1128
+ onBack: i,
1129
+ onOpenCallable: s,
1130
+ slots: a
969
1131
  }) {
970
- var z;
971
- const a = ie(), r = de(), l = nt(e), u = (z = l.data) == null ? void 0 : z.appId, h = D(
972
- () => se(l.data ? [l.data] : []),
973
- [l.data]
974
- ), { byId: f } = oe(h), g = l.data ? je(l.data, f) : void 0, m = it(u, !!u), b = Ye(e), y = D(() => {
975
- const c = /* @__PURE__ */ new Map();
976
- for (const k of b.data ?? []) {
977
- const C = c.get(k.actionKey) ?? [];
978
- C.push(k), c.set(k.actionKey, C);
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] : []),
1135
+ [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);
979
1141
  }
980
- return c;
981
- }, [b.data]), p = Ze(e).data ?? [], [v, d] = $(!1), [N, A] = $(""), I = at(e), [w, M] = $(null);
982
- Ne(() => {
983
- if (!w) return;
984
- const c = setTimeout(() => M(null), Dt[w.kind]);
985
- return () => clearTimeout(c);
986
- }, [w]);
987
- const R = () => {
988
- M(null), I.mutate(void 0, {
989
- onSuccess: (c) => {
990
- var k;
991
- if (!c.ok) {
992
- M({
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({
993
1155
  kind: "error",
994
- text: `Connection test failed${(k = c.error) != null && k.message ? `: ${c.error.message}` : "."}`
1156
+ text: `Connection test failed${($ = u.error) != null && $.message ? `: ${u.error.message}` : "."}`
995
1157
  });
996
1158
  return;
997
1159
  }
998
- M(
999
- c.untested ? { kind: "warn", text: `Connection stored. ${c.message ?? ""}`.trim() } : {
1160
+ S(
1161
+ u.untested ? { kind: "warn", text: `Connection stored. ${u.message ?? ""}`.trim() } : {
1000
1162
  kind: "ok",
1001
- text: `Connection is valid${c.actionKey ? ` — probed ${c.actionKey}` : ""}.`
1163
+ text: `Connection is valid${u.actionKey ? ` — probed ${u.actionKey}` : ""}.`
1002
1164
  }
1003
1165
  );
1004
1166
  },
1005
- onError: (c) => M({ kind: "error", text: (c == null ? void 0 : c.message) ?? "Test failed." })
1167
+ onError: (u) => S({ kind: "error", text: (u == null ? void 0 : u.message) ?? "Test failed." })
1006
1168
  });
1007
- }, L = D(() => {
1008
- var k;
1009
- const c = [...((k = m.data) == null ? void 0 : k.actions) ?? []];
1010
- return c.sort((C, J) => (C.title || C.key).localeCompare(J.title || J.key)), c;
1011
- }, [m.data]), Z = D(() => {
1012
- const c = N.trim().toLowerCase();
1013
- return c ? L.filter(
1014
- (k) => (k.title || "").toLowerCase().includes(c) || k.key.toLowerCase().includes(c) || (k.description || "").toLowerCase().includes(c)
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)
1015
1177
  ) : L;
1016
- }, [L, N]);
1017
- if (l.isLoading || m.isLoading)
1178
+ }, [L, R]);
1179
+ if (c.isLoading || y.isLoading)
1018
1180
  return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-conn-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
1019
- if (!l.data)
1020
- return /* @__PURE__ */ o("div", { className: "w6w-embed-root w6w-embed-conn-detail", "data-testid": "connection-not-found", children: [
1021
- (i == null ? void 0 : i.empty) ?? /* @__PURE__ */ t("h2", { children: "Connection not found" }),
1022
- s && /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "Back to integrations" })
1181
+ 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" })
1023
1185
  ] });
1024
- const j = l.data, _ = m.data, ye = !j.builtIn && typeof a.updateConnection == "function";
1025
- return /* @__PURE__ */ o("div", { className: "w6w-embed-root w6w-embed-conn-detail", children: [
1026
- (i == null ? void 0 : i.header) ?? /* @__PURE__ */ o(Se, { conn: j, app: g, children: [
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: [
1027
1189
  /* @__PURE__ */ t(
1028
1190
  "button",
1029
1191
  {
1030
1192
  type: "button",
1031
1193
  className: "w6w-btn w6w-btn-ghost",
1032
- disabled: I.isPending,
1033
- onClick: R,
1034
- children: I.isPending ? "Testing…" : "Test connection"
1194
+ disabled: j.isPending,
1195
+ onClick: U,
1196
+ children: j.isPending ? "Testing…" : "Test connection"
1035
1197
  }
1036
1198
  ),
1037
- ye && /* @__PURE__ */ t(
1038
- ae,
1199
+ z && /* @__PURE__ */ t(
1200
+ fe,
1039
1201
  {
1040
1202
  label: "Edit",
1041
- onClick: () => d(!0),
1203
+ onClick: () => O(!0),
1042
1204
  "data-testid": "connection-detail-edit"
1043
1205
  }
1044
1206
  ),
1045
- i == null ? void 0 : i.actions
1207
+ a == null ? void 0 : a.actions
1046
1208
  ] }),
1047
- w && /* @__PURE__ */ o(
1209
+ M && /* @__PURE__ */ l(
1048
1210
  "div",
1049
1211
  {
1050
- className: `w6w-result w6w-embed-conn-notice w6w-embed-conn-notice-${w.kind}`,
1051
- role: w.kind === "error" ? "alert" : "status",
1052
- "aria-live": w.kind === "error" ? "assertive" : "polite",
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",
1053
1215
  "data-testid": "connection-test-notice",
1054
1216
  children: [
1055
- /* @__PURE__ */ t("span", { "aria-hidden": "true", children: xt[w.kind] }),
1056
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-notice-text", children: w.text }),
1057
- /* @__PURE__ */ t(Qe, { icon: "close", label: "Dismiss", onClick: () => M(null) })
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) })
1058
1220
  ]
1059
1221
  }
1060
1222
  ),
1061
- /* @__PURE__ */ o("div", { className: "w6w-embed-conn-card", children: [
1062
- /* @__PURE__ */ o("h3", { children: [
1223
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1224
+ /* @__PURE__ */ l("h3", { children: [
1063
1225
  "App: ",
1064
- (g == null ? void 0 : g.displayName) ?? j.appId
1226
+ (d == null ? void 0 : d.displayName) ?? P.appId
1065
1227
  ] }),
1066
- _ && /* @__PURE__ */ o("p", { className: "w6w-muted w6w-small", children: [
1228
+ F && /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1067
1229
  "Version ",
1068
- /* @__PURE__ */ o("code", { children: [
1230
+ /* @__PURE__ */ l("code", { children: [
1069
1231
  "v",
1070
- _.version ?? "?"
1232
+ F.version ?? "?"
1071
1233
  ] }),
1072
1234
  " · source ",
1073
- /* @__PURE__ */ t("code", { children: _.sourceRef })
1235
+ /* @__PURE__ */ t("code", { children: F.sourceRef })
1074
1236
  ] }),
1075
- s && /* @__PURE__ */ t("p", { className: "w6w-small", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: s, children: "← Integrations" }) })
1237
+ i && /* @__PURE__ */ t("p", { className: "w6w-small", children: /* @__PURE__ */ t("button", { type: "button", className: "w6w-btn w6w-btn-ghost", onClick: i, children: "← Integrations" }) })
1076
1238
  ] }),
1077
- /* @__PURE__ */ o("div", { className: "w6w-embed-conn-card", children: [
1239
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1078
1240
  /* @__PURE__ */ t("h3", { children: "Actions" }),
1079
1241
  L.length === 0 && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "No actions exposed." }),
1080
1242
  L.length > 10 && /* @__PURE__ */ t(
1081
1243
  "input",
1082
1244
  {
1083
1245
  type: "search",
1084
- value: N,
1246
+ value: R,
1085
1247
  placeholder: `Search ${L.length} actions…`,
1086
- onChange: (c) => A(c.target.value),
1248
+ onChange: (u) => E(u.target.value),
1087
1249
  "aria-label": "Filter actions",
1088
1250
  className: "w6w-embed-conn-filter"
1089
1251
  }
1090
1252
  ),
1091
- L.length > 0 && Z.length === 0 && /* @__PURE__ */ o("p", { className: "w6w-muted w6w-small", children: [
1253
+ L.length > 0 && B.length === 0 && /* @__PURE__ */ l("p", { className: "w6w-muted w6w-small", children: [
1092
1254
  "No actions match “",
1093
- N,
1255
+ R,
1094
1256
  "”."
1095
1257
  ] }),
1096
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Actions", children: Z.map((c) => {
1097
- const k = y.get(c.key) ?? [];
1098
- return /* @__PURE__ */ o("li", { children: [
1099
- /* @__PURE__ */ o(
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(
1100
1262
  "button",
1101
1263
  {
1102
1264
  type: "button",
1103
1265
  className: "w6w-embed-conn-action",
1104
- "data-testid": `connection-action-${c.key}`,
1105
- onClick: () => n(c.key),
1266
+ "data-testid": `connection-action-${u.key}`,
1267
+ onClick: () => n(u.key),
1106
1268
  children: [
1107
- /* @__PURE__ */ t("strong", { children: c.title }),
1269
+ /* @__PURE__ */ t("strong", { children: u.title }),
1108
1270
  " ",
1109
- /* @__PURE__ */ t("code", { className: "w6w-muted", children: c.key }),
1271
+ /* @__PURE__ */ t("code", { className: "w6w-muted", children: u.key }),
1110
1272
  " ",
1111
- /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: c.type }),
1112
- c.description && /* @__PURE__ */ t("div", { className: "w6w-muted w6w-small", children: c.description })
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 })
1113
1275
  ]
1114
1276
  }
1115
1277
  ),
1116
- k.length > 0 && /* @__PURE__ */ t(
1278
+ $.length > 0 && /* @__PURE__ */ t(
1117
1279
  "ul",
1118
1280
  {
1119
1281
  className: "w6w-embed-conn-list w6w-embed-conn-tests",
1120
- "aria-label": `Saved tests for ${c.title || c.key}`,
1121
- children: k.map((C) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1122
- H,
1282
+ "aria-label": `Saved tests for ${u.title || u.key}`,
1283
+ children: $.map((I) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1284
+ te,
1123
1285
  {
1124
- title: C.name,
1125
- subtitle: C.lastRunAt ? /* @__PURE__ */ o("span", { children: [
1286
+ title: I.name,
1287
+ subtitle: I.lastRunAt ? /* @__PURE__ */ l("span", { children: [
1126
1288
  /* @__PURE__ */ t(
1127
1289
  "span",
1128
1290
  {
1129
- className: C.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1130
- children: C.lastRunOk ? "✓" : "✗"
1291
+ className: I.lastRunOk ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail",
1292
+ children: I.lastRunOk ? "✓" : "✗"
1131
1293
  }
1132
1294
  ),
1133
1295
  " ",
1134
- C.lastRunSummary ? `${C.lastRunSummary} · ` : "",
1135
- P(C.lastRunAt)
1136
- ] }) : `saved ${P(C.updatedAt)}`,
1137
- onClick: () => n(c.key, C.id)
1296
+ I.lastRunSummary ? `${I.lastRunSummary} · ` : "",
1297
+ ee(I.lastRunAt)
1298
+ ] }) : `saved ${ee(I.updatedAt)}`,
1299
+ onClick: () => n(u.key, I.id)
1138
1300
  }
1139
- ) }, C.id))
1301
+ ) }, I.id))
1140
1302
  }
1141
1303
  )
1142
- ] }, c.key);
1304
+ ] }, u.key);
1143
1305
  }) })
1144
1306
  ] }),
1145
- p.length > 0 && /* @__PURE__ */ o("div", { className: "w6w-embed-conn-card", children: [
1307
+ g && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "connection-used-by", children: [
1308
+ /* @__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,
1311
+ {
1312
+ callables: p,
1313
+ routes: T,
1314
+ projectId: m,
1315
+ onOpenCallable: s
1316
+ }
1317
+ )
1318
+ ] }),
1319
+ x.length > 0 && /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1146
1320
  /* @__PURE__ */ t("h3", { children: "Recent runs" }),
1147
1321
  /* @__PURE__ */ t("p", { className: "w6w-muted w6w-small", children: "Most recent tester runs against this connection." }),
1148
- /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", "aria-label": "Recent runs", children: p.map((c) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1149
- H,
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,
1150
1324
  {
1151
- title: c.actionKey,
1152
- subtitle: /* @__PURE__ */ o("span", { children: [
1153
- /* @__PURE__ */ t("span", { className: c.ok ? "w6w-embed-conn-ok" : "w6w-embed-conn-fail", children: c.ok ? "✓" : "✗" }),
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 ? "✓" : "✗" }),
1154
1328
  " ",
1155
- c.summary ? `${c.summary} · ` : "",
1156
- P(c.occurredAt)
1329
+ u.summary ? `${u.summary} · ` : "",
1330
+ ee(u.occurredAt)
1157
1331
  ] })
1158
1332
  }
1159
- ) }, c.id)) })
1333
+ ) }, u.id)) })
1160
1334
  ] }),
1161
1335
  v && /* @__PURE__ */ t(
1162
- le,
1336
+ ye,
1163
1337
  {
1164
- connection: j,
1165
- onClose: () => d(!1),
1338
+ connection: P,
1339
+ onClose: () => O(!1),
1166
1340
  onSaved: () => {
1167
- d(!1), r.invalidateQueries({ queryKey: ue(e) }), r.invalidateQueries({ queryKey: q });
1341
+ O(!1), r.invalidateQueries({ queryKey: Te(e) }), r.invalidateQueries({ queryKey: ne });
1342
+ }
1343
+ }
1344
+ )
1345
+ ] });
1346
+ }
1347
+ const mn = {};
1348
+ function he(e) {
1349
+ return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1350
+ }
1351
+ function H(e) {
1352
+ return (e / 100).toFixed(2);
1353
+ }
1354
+ function hn(e) {
1355
+ 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(" · ")}`;
1358
+ }
1359
+ function wn(e) {
1360
+ const { maxInputTokens: n, maxOutputTokens: i } = e.limits ?? {};
1361
+ if (n == null && i == null) return "—";
1362
+ const s = [];
1363
+ return n != null && s.push(`${he(n)} in`), i != null && s.push(`${he(i)} out`), s.join(" · ");
1364
+ }
1365
+ const pn = [
1366
+ {
1367
+ key: "model",
1368
+ header: "Model",
1369
+ render: (e) => /* @__PURE__ */ l("div", { className: "list-main", style: { maxWidth: 0, minWidth: "100%" }, children: [
1370
+ /* @__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: [
1372
+ e.provider,
1373
+ " · ",
1374
+ e.nativeId,
1375
+ " · ",
1376
+ e.source
1377
+ ] })
1378
+ ] })
1379
+ },
1380
+ {
1381
+ key: "provider",
1382
+ header: "Provider",
1383
+ render: (e) => /* @__PURE__ */ t("span", { className: "muted small", children: e.provider || "—" })
1384
+ },
1385
+ {
1386
+ key: "status",
1387
+ header: "Status",
1388
+ render: (e) => /* @__PURE__ */ t("span", { className: e.status === "active" ? "tag" : "tag warn", children: e.status })
1389
+ },
1390
+ {
1391
+ key: "rate",
1392
+ header: "Rate (per 1M tokens)",
1393
+ render: (e) => {
1394
+ const n = hn(e.currentRate);
1395
+ return n == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "—" }) : /* @__PURE__ */ t(
1396
+ "span",
1397
+ {
1398
+ className: "muted small",
1399
+ title: e.currentRate ? `effective ${e.currentRate.effectiveFrom}` : void 0,
1400
+ children: n
1168
1401
  }
1402
+ );
1403
+ }
1404
+ },
1405
+ {
1406
+ key: "limits",
1407
+ header: "Limits",
1408
+ render: (e) => /* @__PURE__ */ t("span", { className: "muted small", children: wn(e) })
1409
+ }
1410
+ ];
1411
+ function na(e) {
1412
+ var o;
1413
+ const n = Le(), i = e.filter ?? mn, s = $e({
1414
+ queryKey: It(i),
1415
+ 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: [
1421
+ /* @__PURE__ */ t("h3", { children: "Model catalog" }),
1422
+ /* @__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
+ ] }) }),
1424
+ /* @__PURE__ */ l("div", { className: "card", children: [
1425
+ s.isLoading && /* @__PURE__ */ t("p", { className: "muted", children: "Loading…" }),
1426
+ 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,
1430
+ {
1431
+ columns: pn,
1432
+ rows: a,
1433
+ rowKey: (r) => r.id,
1434
+ testId: "model-catalog-table",
1435
+ rowTestId: (r) => `model-catalog-${r.id}`
1436
+ }
1437
+ )
1438
+ ] }),
1439
+ s.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1440
+ "button",
1441
+ {
1442
+ type: "button",
1443
+ className: "btn ghost",
1444
+ disabled: s.isFetchingNextPage,
1445
+ onClick: () => void s.fetchNextPage(),
1446
+ "data-testid": "model-catalog-load-more",
1447
+ children: s.isFetchingNextPage ? "Loading…" : "Load more"
1448
+ }
1449
+ ) })
1450
+ ] }) });
1451
+ }
1452
+ const fn = {};
1453
+ function A(e) {
1454
+ return String(e).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1455
+ }
1456
+ function gn(e) {
1457
+ return `${e.currency} ${(e.amountMinor / 100).toFixed(2)}`;
1458
+ }
1459
+ function Nn(e, n) {
1460
+ return e.length > 0 ? e.map(gn).join(" · ") : n > 0 ? "unpriced" : "—";
1461
+ }
1462
+ function yn(e) {
1463
+ return e.costMinor == null ? null : `${e.currency ?? "USD"} ${(e.costMinor / 100).toFixed(2)}`;
1464
+ }
1465
+ function bn(e) {
1466
+ return e.totalsTruncated === !0;
1467
+ }
1468
+ const vn = [
1469
+ {
1470
+ key: "occurredAt",
1471
+ header: "When",
1472
+ render: (e) => /* @__PURE__ */ t("span", { className: "muted small", title: e.occurredAt, children: xe(e.occurredAt) })
1473
+ },
1474
+ {
1475
+ key: "model",
1476
+ 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: [
1479
+ e.provider,
1480
+ " · ",
1481
+ e.nativeId
1482
+ ] }),
1483
+ /* @__PURE__ */ t("div", { className: "muted small list-preview", title: e.connectionId, children: e.connectionId })
1484
+ ] })
1485
+ },
1486
+ {
1487
+ key: "route",
1488
+ header: "Route",
1489
+ render: (e) => e.routeId == null ? /* @__PURE__ */ t("span", { className: "muted small", children: "direct" }) : /* @__PURE__ */ t("code", { className: "muted small", title: e.routeId, children: e.routeId })
1490
+ },
1491
+ {
1492
+ key: "tokens",
1493
+ header: "Tokens",
1494
+ align: "right",
1495
+ render: (e) => /* @__PURE__ */ t(
1496
+ "span",
1497
+ {
1498
+ 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)
1169
1501
  }
1170
1502
  )
1503
+ },
1504
+ {
1505
+ key: "cost",
1506
+ header: "Cost",
1507
+ align: "right",
1508
+ render: (e) => {
1509
+ const n = yn(e);
1510
+ 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
+ }
1512
+ },
1513
+ {
1514
+ key: "result",
1515
+ header: "Result",
1516
+ render: (e) => {
1517
+ const n = Ae(e.durationMs);
1518
+ return /* @__PURE__ */ l("span", { className: "muted small", title: e.errorCode ?? void 0, children: [
1519
+ /* @__PURE__ */ t("span", { className: e.ok ? "tag" : "tag warn", children: e.ok ? "ok" : e.errorCode ?? "failed" }),
1520
+ n != null && /* @__PURE__ */ l(D, { children: [
1521
+ " · ",
1522
+ n
1523
+ ] })
1524
+ ] });
1525
+ }
1526
+ }
1527
+ ];
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),
1532
+ enabled: n != null,
1533
+ initialPageParam: void 0,
1534
+ getNextPageParam: (d) => d.nextCursor ?? void 0,
1535
+ queryFn: ({ pageParam: d }) => Tt(
1536
+ i,
1537
+ n,
1538
+ d ? { ...s, cursor: d } : s
1539
+ )
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: [
1543
+ /* @__PURE__ */ t("h3", { children: "Model usage" }),
1544
+ /* @__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
+ ] }) }),
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 ? (
1550
+ // 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),
1555
+ " requests"
1556
+ ] }),
1557
+ " · ",
1558
+ /* @__PURE__ */ l("span", { "data-testid": "model-usage-total-tokens", children: [
1559
+ A(r.totalTokens),
1560
+ " tokens (",
1561
+ A(r.inputTokens),
1562
+ " in /",
1563
+ " ",
1564
+ A(r.outputTokens),
1565
+ " out / ",
1566
+ A(r.cachedInputTokens),
1567
+ " cached / ",
1568
+ A(r.cacheWriteTokens),
1569
+ " cache write)"
1570
+ ] }),
1571
+ " · ",
1572
+ /* @__PURE__ */ t("span", { "data-testid": "model-usage-total-cost", children: Nn(r.cost, r.unpriced) }),
1573
+ r.unpriced > 0 && /* @__PURE__ */ l(D, { children: [
1574
+ " · ",
1575
+ /* @__PURE__ */ l(
1576
+ "span",
1577
+ {
1578
+ className: "tag warn",
1579
+ "data-testid": "model-usage-unpriced-total",
1580
+ title: "calls with no usable rate — not included in any cost total",
1581
+ children: [
1582
+ A(r.unpriced),
1583
+ " unpriced"
1584
+ ]
1585
+ }
1586
+ )
1587
+ ] })
1588
+ ] })
1589
+ ] }),
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." }),
1594
+ c.length > 0 && /* @__PURE__ */ t(
1595
+ le,
1596
+ {
1597
+ columns: vn,
1598
+ rows: c,
1599
+ rowKey: (d) => d.id,
1600
+ testId: "model-usage-table",
1601
+ rowTestId: (d) => `model-usage-${d.id}`
1602
+ }
1603
+ )
1604
+ ] }),
1605
+ a.hasNextPage && /* @__PURE__ */ t("div", { className: "row", children: /* @__PURE__ */ t(
1606
+ "button",
1607
+ {
1608
+ type: "button",
1609
+ className: "btn ghost",
1610
+ disabled: a.isFetchingNextPage,
1611
+ onClick: () => void a.fetchNextPage(),
1612
+ "data-testid": "model-usage-load-more",
1613
+ children: a.isFetchingNextPage ? "Loading…" : "Load more"
1614
+ }
1615
+ ) })
1616
+ ] })
1617
+ ] }) });
1618
+ }
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" }),
1624
+ s.isLoading && /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }),
1625
+ 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(
1630
+ "button",
1631
+ {
1632
+ type: "button",
1633
+ className: "w6w-embed-conn-action",
1634
+ "data-testid": `credential-row-${o.id}`,
1635
+ onClick: () => n == null ? void 0 : n(o.id),
1636
+ children: [
1637
+ /* @__PURE__ */ t("strong", { children: o.name }),
1638
+ " ",
1639
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: o.status }),
1640
+ r !== void 0 && /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1641
+ " ",
1642
+ r
1643
+ ] }),
1644
+ /* @__PURE__ */ l("span", { className: "w6w-muted w6w-small", children: [
1645
+ " · ",
1646
+ kn(o.connectionCount)
1647
+ ] })
1648
+ ]
1649
+ }
1650
+ ) }, o.id);
1651
+ }) })
1652
+ ] });
1653
+ }
1654
+ function Cn(e) {
1655
+ try {
1656
+ const n = JSON.parse(e);
1657
+ return n !== null && typeof n == "object" && !Array.isArray(n) ? n : null;
1658
+ } catch {
1659
+ return null;
1660
+ }
1661
+ }
1662
+ const we = (e) => Number.isNaN(Date.parse(e)) ? e : new Date(e).toLocaleString();
1663
+ function sa({
1664
+ credentialId: e,
1665
+ onOpenConnection: n,
1666
+ onDeleted: i,
1667
+ onBack: s,
1668
+ slots: a
1669
+ }) {
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" });
1674
+ if (o.isLoading)
1675
+ return /* @__PURE__ */ t("div", { className: "w6w-embed-root w6w-embed-cred-detail", children: /* @__PURE__ */ t("p", { className: "w6w-muted", children: "Loading…" }) });
1676
+ const L = o.data;
1677
+ 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.");
1694
+ return;
1695
+ }
1696
+ b(null), c.mutate(
1697
+ { source: f },
1698
+ {
1699
+ onSuccess: () => {
1700
+ y(""), m(!0);
1701
+ },
1702
+ onError: (W) => b((W == null ? void 0 : W.message) ?? "Rotate failed.")
1703
+ }
1704
+ );
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.")
1709
+ });
1710
+ }, u = () => {
1711
+ S(null), N.mutate(e, {
1712
+ onSuccess: (f) => {
1713
+ R(!1), f.ok ? i == null || i() : j(f.dependents.connections);
1714
+ },
1715
+ onError: (f) => S((f == null ? void 0 : f.message) ?? "Delete failed.")
1716
+ });
1717
+ };
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: [
1720
+ /* @__PURE__ */ t("h2", { children: L.name }),
1721
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1722
+ /* @__PURE__ */ t("code", { children: L.contract }),
1723
+ " ",
1724
+ /* @__PURE__ */ t("span", { className: "w6w-embed-conn-badge", children: L.status })
1725
+ ] }),
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,
1732
+ " connection",
1733
+ P === 1 ? "" : "s",
1734
+ " · created ",
1735
+ we(L.createdAt),
1736
+ " · updated ",
1737
+ we(L.updatedAt)
1738
+ ] }),
1739
+ U
1740
+ ] }),
1741
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", "data-testid": "credential-connections", children: [
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(
1744
+ "button",
1745
+ {
1746
+ type: "button",
1747
+ className: "w6w-embed-conn-action",
1748
+ onClick: () => n(f.id),
1749
+ children: f.displayName || f.appId
1750
+ }
1751
+ ) : /* @__PURE__ */ t("span", { children: f.displayName || f.appId }) }, f.id)) })
1752
+ ] }),
1753
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
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
+ ),
1768
+ /* @__PURE__ */ t(
1769
+ "textarea",
1770
+ {
1771
+ className: "w6w-input w6w-secret-input",
1772
+ "aria-label": "New secret (JSON object)",
1773
+ rows: 5,
1774
+ value: d,
1775
+ onChange: (f) => y(f.target.value),
1776
+ name: "w6w-cred-rotate",
1777
+ autoComplete: "off",
1778
+ autoCapitalize: "off",
1779
+ autoCorrect: "off",
1780
+ spellCheck: !1,
1781
+ "data-1p-ignore": "true",
1782
+ "data-lpignore": "true",
1783
+ "data-bwignore": "true",
1784
+ "data-form-type": "other"
1785
+ }
1786
+ ),
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
+ ),
1796
+ 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
+ )
1807
+ ] }),
1808
+ /* @__PURE__ */ l("div", { className: "w6w-embed-conn-card", children: [
1809
+ /* @__PURE__ */ t("h3", { children: "Manage" }),
1810
+ /* @__PURE__ */ l("div", { className: "w6w-modal-actions", children: [
1811
+ /* @__PURE__ */ t(
1812
+ "button",
1813
+ {
1814
+ type: "button",
1815
+ className: "w6w-btn w6w-btn-ghost",
1816
+ disabled: h.isPending,
1817
+ onClick: () => h.mutate(F ? "active" : "disabled"),
1818
+ children: F ? "Enable" : "Disable"
1819
+ }
1820
+ ),
1821
+ /* @__PURE__ */ t(
1822
+ "button",
1823
+ {
1824
+ type: "button",
1825
+ className: "w6w-btn w6w-btn-ghost",
1826
+ disabled: w.isPending,
1827
+ onClick: V,
1828
+ children: w.isPending ? "Testing…" : "Test credential"
1829
+ }
1830
+ ),
1831
+ /* @__PURE__ */ t(
1832
+ "button",
1833
+ {
1834
+ type: "button",
1835
+ className: "w6w-btn w6w-btn-danger",
1836
+ onClick: () => {
1837
+ j(null), R(!0);
1838
+ },
1839
+ children: "Delete"
1840
+ }
1841
+ )
1842
+ ] }),
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: [
1848
+ 'Delete the credential "',
1849
+ L.name,
1850
+ '"? This cannot be undone.'
1851
+ ] }),
1852
+ /* @__PURE__ */ t(
1853
+ "button",
1854
+ {
1855
+ type: "button",
1856
+ className: "w6w-btn w6w-btn-danger",
1857
+ disabled: N.isPending,
1858
+ onClick: u,
1859
+ children: "Confirm delete"
1860
+ }
1861
+ ),
1862
+ " ",
1863
+ /* @__PURE__ */ t(
1864
+ "button",
1865
+ {
1866
+ type: "button",
1867
+ className: "w6w-btn w6w-btn-ghost",
1868
+ onClick: () => R(!1),
1869
+ children: "Cancel"
1870
+ }
1871
+ )
1872
+ ] }),
1873
+ E && /* @__PURE__ */ l("div", { role: "alert", "data-testid": "credential-in-use", children: [
1874
+ /* @__PURE__ */ l("p", { className: "w6w-small", children: [
1875
+ "This credential is still used by ",
1876
+ E.length,
1877
+ " connection",
1878
+ E.length === 1 ? "" : "s",
1879
+ ". Delete those integrations first, or rotate this credential instead of deleting it."
1880
+ ] }),
1881
+ /* @__PURE__ */ t("ul", { className: "w6w-embed-conn-list", children: E.map((f) => /* @__PURE__ */ t("li", { children: f.displayName || f.appId }, f.id)) })
1882
+ ] }),
1883
+ M && /* @__PURE__ */ t("p", { role: "alert", children: M })
1884
+ ] })
1171
1885
  ] });
1172
1886
  }
1173
1887
  export {
1174
- tn as ActivitySummary,
1175
- ln as ConnectionDetail,
1176
- sn as ConnectionList,
1177
- en as DocumentList,
1178
- Jt as EndpointList,
1179
- zt as FunctionList,
1180
- Xt as ReliabilityBoard,
1181
- nn as RunHistory,
1182
- an as ServiceDetail,
1183
- Gt as WorkflowList
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
1184
1902
  };
1185
1903
  //# sourceMappingURL=lists.mjs.map