react-semaphor 0.1.391 → 0.1.392

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 (68) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +120 -252
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +7 -7
  5. package/dist/chunks/analyze-result-contract-C9Gv2_qW.js +1585 -0
  6. package/dist/chunks/analyze-result-contract-Zgg-Bbpj.js +1 -0
  7. package/dist/chunks/{braces--20GzUQh.js → braces-8TRlDwDw.js} +1 -1
  8. package/dist/chunks/{braces-C0Vh_Mft.js → braces-D2tStQjF.js} +1 -1
  9. package/dist/chunks/{calendar-preferences-dialog-B-VsxhsA.js → calendar-preferences-dialog-49fcEPXS.js} +4 -4
  10. package/dist/chunks/{calendar-preferences-dialog-DE67Z3oQ.js → calendar-preferences-dialog-DwLeBLy2.js} +1 -1
  11. package/dist/chunks/dashboard-briefing-launcher-CgkSKkZR.js +80 -0
  12. package/dist/chunks/{dashboard-briefing-launcher-BIj3X7b3.js → dashboard-briefing-launcher-cgPKz1yX.js} +252 -252
  13. package/dist/chunks/dashboard-controls-D12ZSUP_.js +52 -0
  14. package/dist/chunks/{dashboard-controls-BXxucM4f.js → dashboard-controls-VMFm3OP4.js} +87 -87
  15. package/dist/chunks/{dashboard-json-C6oZuipD.js → dashboard-json-C-GG5yC7.js} +4 -4
  16. package/dist/chunks/{dashboard-json-BNwshkK2.js → dashboard-json-CvK0oI24.js} +1 -1
  17. package/dist/chunks/{edit-dashboard-visual-CmfrI_L3.js → edit-dashboard-visual-B5KB7dx4.js} +977 -977
  18. package/dist/chunks/edit-dashboard-visual-ql99faTz.js +178 -0
  19. package/dist/chunks/{index-icb12JV1.js → index-CQmKDEbe.js} +735 -741
  20. package/dist/chunks/{index-4W_ElSBJ.js → index-DXCBPLDu.js} +218 -223
  21. package/dist/chunks/{layout-grid-B7-klXiK.js → layout-grid-C0OI-MRn.js} +1 -1
  22. package/dist/chunks/{layout-grid-DV89AC9_.js → layout-grid-CiubineE.js} +1 -1
  23. package/dist/chunks/{palette-Dj-dgPYh.js → palette-C4KTXOug.js} +1 -1
  24. package/dist/chunks/{palette-5IwhMbSF.js → palette-Cp1hqZtm.js} +1 -1
  25. package/dist/chunks/{save-C5fwVdTF.js → save-C__QggEE.js} +1 -1
  26. package/dist/chunks/{save-16C6YSW2.js → save-DgMfP0j8.js} +1 -1
  27. package/dist/chunks/{search-0LmWwZzW.js → search-BHsQIWBV.js} +17 -7
  28. package/dist/chunks/{search-Dq1Mbb03.js → search-DNCejM7Z.js} +9 -4
  29. package/dist/chunks/source-identity-uMaUe036.js +1 -0
  30. package/dist/chunks/{source-identity-CN4xiyKJ.js → source-identity-y0VSSreA.js} +33 -15
  31. package/dist/chunks/{switch-bdJp0Bkw.js → switch-B79Hn4Qh.js} +27 -32
  32. package/dist/chunks/{switch-DUdaHFZQ.js → switch-BXQAlSuW.js} +637 -647
  33. package/dist/chunks/use-create-flow-overlay-state-7MFN3PWX.js +21 -0
  34. package/dist/chunks/{use-create-flow-overlay-state-YvqCp6Zo.js → use-create-flow-overlay-state-Bw5LRkf9.js} +93 -92
  35. package/dist/chunks/{validators-CHPH6ORs.js → validators-4EGCWWga.js} +1 -1
  36. package/dist/chunks/{validators-lWo8m0Q7.js → validators-CPtkrola.js} +1 -1
  37. package/dist/chunks/{x-B_cx7LwM.js → x-B6ghREd2.js} +10 -5
  38. package/dist/chunks/{x-IdR_js6f.js → x-CXDkqdur.js} +28 -18
  39. package/dist/dashboard/index.cjs +1 -1
  40. package/dist/dashboard/index.js +1 -1
  41. package/dist/dashboard-authoring/index.cjs +1 -1
  42. package/dist/dashboard-authoring/index.js +3 -3
  43. package/dist/data-app-builder/index.cjs +13 -13
  44. package/dist/data-app-builder/index.js +11 -11
  45. package/dist/data-app-sdk/index.cjs +5 -5
  46. package/dist/data-app-sdk/index.js +1589 -1234
  47. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  48. package/dist/data-app-sdk-adapters/index.js +6 -7
  49. package/dist/data-app-sdk-validation/index.cjs +1 -1
  50. package/dist/data-app-sdk-validation/index.js +3 -3
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.js +13 -13
  53. package/dist/surfboard/index.cjs +1 -1
  54. package/dist/surfboard/index.js +2 -2
  55. package/dist/types/analytics-protocol.d.ts +2107 -43
  56. package/dist/types/dashboard-assistant.d.ts +3 -1
  57. package/dist/types/data-app-sdk-adapters.d.ts +1 -1
  58. package/dist/types/data-app-sdk-validation.d.ts +4 -2
  59. package/dist/types/data-app-sdk.d.ts +73 -5
  60. package/package.json +2 -1
  61. package/src/data-app-sdk/README.md +55 -0
  62. package/dist/chunks/analyze-result-contract-CtXfp3nv.js +0 -1
  63. package/dist/chunks/analyze-result-contract-DuhlklhI.js +0 -102
  64. package/dist/chunks/dashboard-briefing-launcher-Czx6BcXW.js +0 -80
  65. package/dist/chunks/dashboard-controls-BP-DcPFs.js +0 -52
  66. package/dist/chunks/edit-dashboard-visual-BAprin3J.js +0 -178
  67. package/dist/chunks/source-identity-C-xaeE_I.js +0 -1
  68. package/dist/chunks/use-create-flow-overlay-state-BIHKf_XK.js +0 -21
@@ -1,24 +1,25 @@
1
- import { toSemaphorInputSnapshots as Lr, toSemaphorInputBinding as Dr, toSemaphorActiveInputSnapshots as Z, toSemaphorMatrixIntent as Or, toSemaphorSqlIntent as Br, toSemaphorInputOptionsIntent as $r, toSemaphorRecordsIntent as Wr, toSemaphorAnalysisQueryOptions as Nr, toSemaphorAnalysisIntent as Kr, toSemaphorMetricIntent as Fr, hasSemaphorInputValue as le, normalizeSemaphorInputOptions as nr, toSemaphorInputSpec as ir } from "../data-app-sdk-adapters/index.js";
2
- import { jsxs as f, Fragment as or, jsx as s } from "react/jsx-runtime";
3
- import { createContext as Se, useContext as V, useState as Q, useRef as L, useEffect as B, useMemo as w, Fragment as _r, useId as sr, useCallback as O, useReducer as zr } from "react";
4
- import { M as Mr, a as Hr, S as jr, E as Pr } from "../chunks/search-0LmWwZzW.js";
5
- import { X as Vr, j as Qr } from "../chunks/x-IdR_js6f.js";
6
- import { b as Ur } from "../chunks/validators-CHPH6ORs.js";
7
- import "../chunks/analyze-result-contract-DuhlklhI.js";
8
- function fe(e, r, t = {}) {
1
+ import { toSemaphorInputSnapshots as Nr, toSemaphorInputBinding as Fr, toSemaphorActiveInputSnapshots as Z, toSemaphorMatrixIntent as zr, toSemaphorSqlIntent as Mr, toSemaphorInputOptionsIntent as Hr, toSemaphorRecordsIntent as jr, toSemaphorAnalysisQueryOptions as Pr, toSemaphorAnalysisIntent as Qr, toSemaphorMetricIntent as Vr, hasSemaphorInputValue as ce, normalizeSemaphorInputOptions as cr, toSemaphorInputSpec as fr } from "../data-app-sdk-adapters/index.js";
2
+ import { jsxs as p, Fragment as pr, jsx as a } from "react/jsx-runtime";
3
+ import { createContext as we, useContext as V, useState as M, useRef as D, useEffect as $, useMemo as w, Fragment as Ur, useId as gr, useCallback as O, useReducer as Gr } from "react";
4
+ import { a as Jr, m as Yr } from "../chunks/source-identity-y0VSSreA.js";
5
+ import "../chunks/analyze-result-contract-C9Gv2_qW.js";
6
+ import { M as Xr, a as Zr, S as et, E as rt, C as tt } from "../chunks/search-BHsQIWBV.js";
7
+ import { X as nt, C as it, j as ot } from "../chunks/x-CXDkqdur.js";
8
+ import { b as st } from "../chunks/validators-4EGCWWga.js";
9
+ function ge(e, r, t = {}) {
9
10
  return {
10
11
  ...t,
11
12
  name: e,
12
13
  role: r
13
14
  };
14
15
  }
15
- function si(e) {
16
+ function Ti(e) {
16
17
  return e;
17
18
  }
18
- function ai(e) {
19
+ function Ci(e) {
19
20
  return e;
20
21
  }
21
- const di = {
22
+ const ki = {
22
23
  source: {
23
24
  semantic(e) {
24
25
  return {
@@ -35,16 +36,16 @@ const di = {
35
36
  },
36
37
  field: {
37
38
  measure(e, r) {
38
- return fe(e, "measure", r);
39
+ return ge(e, "measure", r);
39
40
  },
40
41
  dimension(e, r) {
41
- return fe(e, "dimension", r);
42
+ return ge(e, "dimension", r);
42
43
  },
43
44
  date(e, r) {
44
- return fe(e, "date", r);
45
+ return ge(e, "date", r);
45
46
  },
46
47
  id(e, r) {
47
- return fe(e, "id", r);
48
+ return ge(e, "id", r);
48
49
  }
49
50
  },
50
51
  filter(e) {
@@ -56,7 +57,7 @@ const di = {
56
57
  bindInput(e, r) {
57
58
  return {
58
59
  toAnalyticsInput() {
59
- const [t] = Lr([e]), n = Dr({
60
+ const [t] = Nr([e]), n = Fr({
60
61
  ...r,
61
62
  inputId: r.inputId || t.inputId
62
63
  });
@@ -128,316 +129,320 @@ const di = {
128
129
  queryKind: "matrix"
129
130
  };
130
131
  }
131
- }, qe = 10, Te = 100, Gr = 25, Jr = 500, ar = {
132
+ }, Te = 10, Ce = 100, at = 25, dt = 500, mr = {
132
133
  enabled: !1,
133
134
  queries: [],
135
+ issues: [],
134
136
  getQuery: () => {
135
137
  },
136
138
  getQueries: () => []
137
- }, $e = Se(null), We = Se(null), Ne = Se(
139
+ }, ze = we(null), Me = we(null), He = we(
138
140
  void 0
139
- ), P = [];
140
- function Yr({
141
+ ), Q = [];
142
+ function lt({
141
143
  debug: e,
142
144
  children: r
143
145
  }) {
144
- const t = w(() => on(e), [e]), [n, i] = zr(
145
- Ut,
146
+ const t = w(() => vn(e), [e]), [n, i] = Gr(
147
+ dn,
146
148
  t,
147
- Sr
148
- ), a = L(n), l = sr(), [p, c] = Q({ open: !1 });
149
- a.current = n, B(() => {
149
+ Cr
150
+ ), o = D(n), u = gr(), [f, d] = M({ open: !1 });
151
+ o.current = n, $(() => {
150
152
  i({ type: "config", config: t });
151
- }, [t]), B(() => {
153
+ }, [t]), $(() => {
152
154
  if (!n.enabled || !n.exposeWindowBridge || typeof window > "u")
153
155
  return;
154
- const h = en(() => a.current);
155
- return Xr({
156
- ownerId: l,
157
- bridge: h
156
+ const b = gn(() => o.current);
157
+ return ut({
158
+ ownerId: u,
159
+ bridge: b
158
160
  }), () => {
159
- Zr(l);
161
+ ct(u);
160
162
  };
161
- }, [l, n.enabled, n.exposeWindowBridge]);
162
- const u = w(() => ({ state: n, dispatch: i }), [n]), b = O((h) => {
163
- c({ open: !0, focus: h });
164
- }, []), y = O(() => {
165
- c((h) => ({ ...h, open: !1 }));
166
- }, []), v = O((h) => {
167
- c({ open: !0, focus: h });
163
+ }, [u, n.enabled, n.exposeWindowBridge]);
164
+ const c = w(() => ({ state: n, dispatch: i }), [n]), m = O((b) => {
165
+ d({ open: !0, focus: b });
166
+ }, []), v = O(() => {
167
+ d((b) => ({ ...b, open: !1 }));
168
+ }, []), S = O((b) => {
169
+ d({ open: !0, focus: b });
168
170
  }, []), g = w(
169
171
  () => ({
170
- open: p.open,
171
- focus: p.focus,
172
- openDevtools: b,
173
- closeDevtools: y,
174
- focusTrace: v
172
+ open: f.open,
173
+ focus: f.focus,
174
+ openDevtools: m,
175
+ closeDevtools: v,
176
+ focusTrace: S
175
177
  }),
176
178
  [
177
- y,
178
179
  v,
179
- b,
180
- p.focus,
181
- p.open
180
+ S,
181
+ m,
182
+ f.focus,
183
+ f.open
182
184
  ]
183
185
  );
184
- return /* @__PURE__ */ s($e.Provider, { value: u, children: /* @__PURE__ */ s(We.Provider, { value: g, children: r }) });
186
+ return /* @__PURE__ */ a(ze.Provider, { value: c, children: /* @__PURE__ */ a(Me.Provider, { value: g, children: r }) });
185
187
  }
186
- function Xr(e) {
187
- const r = P.findIndex(
188
+ function ut(e) {
189
+ const r = Q.findIndex(
188
190
  (t) => t.ownerId === e.ownerId
189
191
  );
190
- r >= 0 && P.splice(r, 1), P.push(e), dr();
192
+ r >= 0 && Q.splice(r, 1), Q.push(e), yr();
191
193
  }
192
- function Zr(e) {
193
- const r = P.findIndex(
194
+ function ct(e) {
195
+ const r = Q.findIndex(
194
196
  (t) => t.ownerId === e
195
197
  );
196
- r >= 0 && P.splice(r, 1), dr();
198
+ r >= 0 && Q.splice(r, 1), yr();
197
199
  }
198
- function dr() {
200
+ function yr() {
199
201
  if (typeof window > "u")
200
202
  return;
201
- const e = P[P.length - 1];
203
+ const e = Q[Q.length - 1];
202
204
  e ? window.__SEMAPHOR_DEVTOOLS__ = e.bridge : delete window.__SEMAPHOR_DEVTOOLS__;
203
205
  }
204
- function li({
206
+ function Ri({
205
207
  id: e,
206
208
  title: r,
207
209
  children: t
208
210
  }) {
209
211
  const n = w(() => ({ id: e, title: r }), [e, r]);
210
- return /* @__PURE__ */ s(Ne.Provider, { value: n, children: t });
212
+ return /* @__PURE__ */ a(He.Provider, { value: n, children: t });
211
213
  }
212
- function et({
214
+ function ft({
213
215
  buttonPosition: e = "bottom-right",
214
216
  initialIsOpen: r = !1,
215
217
  panelPosition: t = "right",
216
218
  className: n,
217
219
  style: i
218
220
  } = {}) {
219
- const a = lr(), l = V(We), [p, c] = Q(""), [u, b] = Q(!1), y = L(null), v = L(null), g = l == null ? void 0 : l.openDevtools, h = l == null ? void 0 : l.closeDevtools, C = (l == null ? void 0 : l.open) === !0;
220
- B(() => {
221
- vr();
222
- }, []), B(() => {
223
- r && a.enabled && (g == null || g());
224
- }, [r, a.enabled, g]), B(() => {
225
- if (!C || !h)
221
+ const o = hr(), u = V(Me), [f, d] = M(""), [c, m] = M(!1), v = D(null), S = D(null), g = u == null ? void 0 : u.openDevtools, b = u == null ? void 0 : u.closeDevtools, k = (u == null ? void 0 : u.open) === !0;
222
+ $(() => {
223
+ Tr();
224
+ }, []), $(() => {
225
+ r && o.enabled && (g == null || g());
226
+ }, [r, o.enabled, g]), $(() => {
227
+ if (!k || !b)
226
228
  return;
227
- const m = (S) => {
228
- var x, T;
229
- const k = S.target;
230
- k instanceof Node && ((x = y.current) != null && x.contains(k) || (T = v.current) != null && T.contains(k) || h());
229
+ const h = (I) => {
230
+ var q, A;
231
+ const R = I.target;
232
+ R instanceof Node && ((q = v.current) != null && q.contains(R) || (A = S.current) != null && A.contains(R) || b());
231
233
  };
232
- return document.addEventListener("pointerdown", m, !0), document.addEventListener("mousedown", m, !0), document.addEventListener("click", m, !0), () => {
233
- document.removeEventListener("pointerdown", m, !0), document.removeEventListener("mousedown", m, !0), document.removeEventListener("click", m, !0);
234
+ return document.addEventListener("pointerdown", h, !0), document.addEventListener("mousedown", h, !0), document.addEventListener("click", h, !0), () => {
235
+ document.removeEventListener("pointerdown", h, !0), document.removeEventListener("mousedown", h, !0), document.removeEventListener("click", h, !0);
234
236
  };
235
- }, [h, C]);
236
- const d = w(
237
- () => vt(a.queries),
238
- [a.queries]
239
- ), I = w(
240
- () => ur(a.queries),
241
- [a.queries]
242
- ), $ = St(d), A = w(
243
- () => wt(a.queries, p),
244
- [a.queries, p]
237
+ }, [b, k]);
238
+ const l = w(
239
+ () => Lt(o.queries),
240
+ [o.queries]
241
+ ), y = w(
242
+ () => je(o.queries),
243
+ [o.queries]
244
+ ), K = Ot(l), E = w(
245
+ () => Bt(o.queries, f),
246
+ [o.queries, f]
245
247
  ), W = w(
246
- () => It(A),
247
- [A]
248
- ), D = w(
249
- () => cr(A, l == null ? void 0 : l.focus) || A[0],
250
- [A, l == null ? void 0 : l.focus]
248
+ () => $t(E),
249
+ [E]
250
+ ), L = w(
251
+ () => vr(E, u == null ? void 0 : u.focus) || E[0],
252
+ [E, u == null ? void 0 : u.focus]
251
253
  );
252
- return !a.enabled || !l ? null : /* @__PURE__ */ f(or, { children: [
253
- /* @__PURE__ */ f(
254
+ return !o.enabled || !u ? null : /* @__PURE__ */ p(pr, { children: [
255
+ /* @__PURE__ */ p(
254
256
  "button",
255
257
  {
256
- ref: y,
258
+ ref: v,
257
259
  type: "button",
258
260
  "aria-label": "Open Semaphor Inspector",
259
- title: $,
260
- className: n ? `${K} ${n}` : K,
261
+ title: K,
262
+ className: n ? `${N} ${n}` : N,
261
263
  style: {
262
- ...o.launcher,
263
- ...zt(e),
264
- ...Mt(d.severity),
264
+ ...s.launcher,
265
+ ...en(e),
266
+ ...rn(l.severity),
265
267
  ...i
266
268
  },
267
269
  onClick: () => {
268
- var S;
269
- const m = (S = I[0]) == null ? void 0 : S.trace;
270
- l.openDevtools(
271
- m ? {
272
- traceId: m.traceId,
273
- queryId: m.queryId,
274
- viewId: m.viewId
270
+ var I;
271
+ const h = (I = y[0]) == null ? void 0 : I.trace;
272
+ u.openDevtools(
273
+ h ? {
274
+ traceId: h.traceId,
275
+ queryId: h.queryId,
276
+ viewId: h.viewId
275
277
  } : void 0
276
278
  );
277
279
  },
278
280
  children: [
279
- /* @__PURE__ */ s(tt, {}),
280
- /* @__PURE__ */ s("span", { style: o.launcherText, children: d.total }),
281
- d.issueCount > 0 ? /* @__PURE__ */ f("span", { style: o.launcherIssueCount, children: [
282
- d.issueCount,
281
+ /* @__PURE__ */ a(gt, {}),
282
+ /* @__PURE__ */ a("span", { style: s.launcherText, children: l.total }),
283
+ l.issueCount > 0 ? /* @__PURE__ */ p("span", { style: s.launcherIssueCount, children: [
284
+ l.issueCount,
283
285
  " issue",
284
- d.issueCount === 1 ? "" : "s"
286
+ l.issueCount === 1 ? "" : "s"
285
287
  ] }) : null
286
288
  ]
287
289
  }
288
290
  ),
289
- l.open ? /* @__PURE__ */ f(
291
+ u.open ? /* @__PURE__ */ p(
290
292
  "div",
291
293
  {
292
- ref: v,
294
+ ref: S,
293
295
  role: "dialog",
294
296
  "aria-label": "Semaphor Inspector",
295
297
  "aria-modal": "false",
296
- className: K,
298
+ className: N,
297
299
  style: {
298
- ...o.panel,
299
- ...Ht(t),
300
- ...u ? o.panelFullscreen : null
300
+ ...s.panel,
301
+ ...tn(t),
302
+ ...c ? s.panelFullscreen : null
301
303
  },
302
304
  children: [
303
- /* @__PURE__ */ f("div", { style: o.panelHeader, children: [
304
- /* @__PURE__ */ f("div", { style: o.panelTitleBlock, children: [
305
- /* @__PURE__ */ s("div", { style: o.panelTitle, children: "Semaphor Inspector" }),
306
- /* @__PURE__ */ f("div", { style: o.panelSubtitle, children: [
307
- d.total,
305
+ /* @__PURE__ */ p("div", { style: s.panelHeader, children: [
306
+ /* @__PURE__ */ p("div", { style: s.panelTitleBlock, children: [
307
+ /* @__PURE__ */ a("div", { style: s.panelTitle, children: "Semaphor Inspector" }),
308
+ /* @__PURE__ */ p("div", { style: s.panelSubtitle, children: [
309
+ l.total,
308
310
  " queries · ",
309
- d.loading,
311
+ l.loading,
310
312
  " loading ·",
311
313
  " ",
312
- d.failed,
314
+ l.failed,
313
315
  " failed · ",
314
- d.warningCount,
316
+ l.errorCount,
317
+ " errors ·",
318
+ " ",
319
+ l.warningCount,
315
320
  " warnings"
316
321
  ] })
317
322
  ] }),
318
- /* @__PURE__ */ f("div", { style: o.panelActions, children: [
319
- /* @__PURE__ */ s(
323
+ /* @__PURE__ */ p("div", { style: s.panelActions, children: [
324
+ /* @__PURE__ */ a(
320
325
  "button",
321
326
  {
322
327
  type: "button",
323
- "aria-label": u ? "Exit fullscreen Semaphor Inspector" : "Enter fullscreen Semaphor Inspector",
324
- title: u ? "Exit fullscreen Semaphor Inspector" : "Enter fullscreen Semaphor Inspector",
325
- style: o.iconButton,
326
- onClick: () => b((m) => !m),
327
- children: u ? /* @__PURE__ */ s(Mr, { size: 15 }) : /* @__PURE__ */ s(Hr, { size: 15 })
328
+ "aria-label": c ? "Exit fullscreen Semaphor Inspector" : "Enter fullscreen Semaphor Inspector",
329
+ title: c ? "Exit fullscreen Semaphor Inspector" : "Enter fullscreen Semaphor Inspector",
330
+ style: s.iconButton,
331
+ onClick: () => m((h) => !h),
332
+ children: c ? /* @__PURE__ */ a(Xr, { size: 15 }) : /* @__PURE__ */ a(Zr, { size: 15 })
328
333
  }
329
334
  ),
330
- /* @__PURE__ */ s(
335
+ /* @__PURE__ */ a(
331
336
  "button",
332
337
  {
333
338
  type: "button",
334
339
  "aria-label": "Close Semaphor Inspector",
335
- style: o.iconButton,
336
- onClick: l.closeDevtools,
337
- children: /* @__PURE__ */ s(Vr, { size: 15 })
340
+ style: s.iconButton,
341
+ onClick: u.closeDevtools,
342
+ children: /* @__PURE__ */ a(nt, { size: 15 })
338
343
  }
339
344
  )
340
345
  ] })
341
346
  ] }),
342
- /* @__PURE__ */ f("label", { style: o.searchBox, children: [
343
- /* @__PURE__ */ s(jr, { size: 14 }),
344
- /* @__PURE__ */ s(
347
+ /* @__PURE__ */ p("label", { style: s.searchBox, children: [
348
+ /* @__PURE__ */ a(et, { size: 14 }),
349
+ /* @__PURE__ */ a(
345
350
  "input",
346
351
  {
347
352
  "aria-label": "Search Semaphor traces",
348
- value: p,
349
- onChange: (m) => c(m.currentTarget.value),
353
+ value: f,
354
+ onChange: (h) => d(h.currentTarget.value),
350
355
  placeholder: "Search traces",
351
- style: o.searchInput
356
+ style: s.searchInput
352
357
  }
353
358
  )
354
359
  ] }),
355
- I.length ? /* @__PURE__ */ s(
356
- it,
360
+ y.length ? /* @__PURE__ */ a(
361
+ yt,
357
362
  {
358
- issues: I,
359
- onSelect: (m) => l.focusTrace({
360
- traceId: m.traceId,
361
- queryId: m.queryId,
362
- viewId: m.viewId
363
+ issues: y,
364
+ onSelect: (h) => u.focusTrace({
365
+ traceId: h.traceId,
366
+ queryId: h.queryId,
367
+ viewId: h.viewId
363
368
  })
364
369
  }
365
370
  ) : null,
366
- /* @__PURE__ */ f(
371
+ /* @__PURE__ */ p(
367
372
  "div",
368
373
  {
369
374
  style: {
370
- ...o.panelBody,
371
- ...jt(t)
375
+ ...s.panelBody,
376
+ ...nn(t)
372
377
  },
373
378
  children: [
374
- /* @__PURE__ */ s(
379
+ /* @__PURE__ */ a(
375
380
  "div",
376
381
  {
377
382
  style: {
378
- ...o.queryList,
379
- ...Pt()
383
+ ...s.queryList,
384
+ ...on()
380
385
  },
381
386
  "aria-label": "Registered queries",
382
- children: A.length ? W.map((m) => /* @__PURE__ */ f("div", { style: o.queryGroup, children: [
383
- /* @__PURE__ */ f("div", { style: o.queryGroupHeader, children: [
384
- /* @__PURE__ */ s("span", { children: m.title }),
385
- /* @__PURE__ */ s("span", { style: o.queryGroupCount, children: m.traces.length })
387
+ children: E.length ? W.map((h) => /* @__PURE__ */ p("div", { style: s.queryGroup, children: [
388
+ /* @__PURE__ */ p("div", { style: s.queryGroupHeader, children: [
389
+ /* @__PURE__ */ a("span", { children: h.title }),
390
+ /* @__PURE__ */ a("span", { style: s.queryGroupCount, children: h.traces.length })
386
391
  ] }),
387
- m.traces.length ? m.traces.map((S) => {
388
- var ne;
389
- const k = fr(S, D), x = we(S), T = mr(S), U = yr(S), re = Tt(S, x, U), te = re.join(" · "), E = pr(T), M = bt(I, S);
390
- return /* @__PURE__ */ f(
392
+ h.traces.length ? h.traces.map((I) => {
393
+ var ie;
394
+ const R = br(I, L), q = qe(I), A = wr(I), U = qr(I), te = _t(I, q, U), ne = te.join(" · "), T = Sr(A), H = Dt(y, I);
395
+ return /* @__PURE__ */ p(
391
396
  "button",
392
397
  {
393
398
  type: "button",
394
- title: `${x} · ${T} · ${te}`,
399
+ title: `${q} · ${A} · ${ne}`,
395
400
  style: {
396
- ...o.queryListItem,
397
- ...k ? o.queryListItemSelected : null
401
+ ...s.queryListItem,
402
+ ...R ? s.queryListItemSelected : null
398
403
  },
399
- onClick: () => l.focusTrace({
400
- traceId: S.traceId,
401
- queryId: S.queryId,
402
- viewId: S.viewId
404
+ onClick: () => u.focusTrace({
405
+ traceId: I.traceId,
406
+ queryId: I.queryId,
407
+ viewId: I.viewId
403
408
  }),
404
409
  children: [
405
- /* @__PURE__ */ f("span", { style: o.queryListItemHeader, children: [
406
- /* @__PURE__ */ s(ot, { status: (ne = S.latestAttempt) == null ? void 0 : ne.status }),
407
- /* @__PURE__ */ s("span", { style: o.queryListTitle, title: x, children: x }),
408
- /* @__PURE__ */ s(
410
+ /* @__PURE__ */ p("span", { style: s.queryListItemHeader, children: [
411
+ /* @__PURE__ */ a(ht, { status: (ie = I.latestAttempt) == null ? void 0 : ie.status }),
412
+ /* @__PURE__ */ a("span", { style: s.queryListTitle, title: q, children: q }),
413
+ /* @__PURE__ */ a(
409
414
  "span",
410
415
  {
411
416
  style: {
412
- ...o.queryListKindChip,
413
- ...gr(E)
417
+ ...s.queryListKindChip,
418
+ ...Ir(T)
414
419
  },
415
- children: T
420
+ children: A
416
421
  }
417
422
  ),
418
- M > 0 ? /* @__PURE__ */ s("span", { style: o.queryListIssueBadge, children: M }) : null
423
+ H > 0 ? /* @__PURE__ */ a("span", { style: s.queryListIssueBadge, children: H }) : null
419
424
  ] }),
420
- /* @__PURE__ */ s(
425
+ /* @__PURE__ */ a(
421
426
  "span",
422
427
  {
423
- className: `${K}-source`,
424
- style: o.queryListSource,
425
- title: te,
426
- children: re.map((ie, oe) => /* @__PURE__ */ f(_r, { children: [
427
- oe > 0 ? /* @__PURE__ */ s("span", { style: o.queryListSubtitleSep, children: " · " }) : null,
428
- /* @__PURE__ */ s("span", { children: ie })
429
- ] }, `${ie}:${oe}`))
428
+ className: `${N}-source`,
429
+ style: s.queryListSource,
430
+ title: ne,
431
+ children: te.map((oe, se) => /* @__PURE__ */ p(Ur, { children: [
432
+ se > 0 ? /* @__PURE__ */ a("span", { style: s.queryListSubtitleSep, children: " · " }) : null,
433
+ /* @__PURE__ */ a("span", { children: oe })
434
+ ] }, `${oe}:${se}`))
430
435
  }
431
436
  )
432
437
  ]
433
438
  },
434
- Oe(S)
439
+ We(I)
435
440
  );
436
- }) : /* @__PURE__ */ s("div", { style: o.queryGroupEmpty, children: "No input traces" })
437
- ] }, m.title)) : /* @__PURE__ */ s("div", { style: o.emptyState, children: "No matching traces" })
441
+ }) : /* @__PURE__ */ a("div", { style: s.queryGroupEmpty, children: "No input traces" })
442
+ ] }, h.title)) : /* @__PURE__ */ a("div", { style: s.emptyState, children: "No matching traces" })
438
443
  }
439
444
  ),
440
- /* @__PURE__ */ s(nt, { trace: D })
445
+ /* @__PURE__ */ a(mt, { trace: L })
441
446
  ]
442
447
  }
443
448
  )
@@ -446,229 +451,229 @@ function et({
446
451
  ) : null
447
452
  ] });
448
453
  }
449
- function ui({
454
+ function Di({
450
455
  queryId: e,
451
456
  viewId: r,
452
457
  label: t,
453
458
  className: n,
454
459
  style: i
455
460
  } = {}) {
456
- var y, v;
457
- const a = lr(), l = V(We), p = V(Ne);
458
- B(() => {
459
- vr();
461
+ var v, S;
462
+ const o = hr(), u = V(Me), f = V(He);
463
+ $(() => {
464
+ Tr();
460
465
  }, []);
461
- const c = r || (p == null ? void 0 : p.id), u = w(
462
- () => xt(a.queries, {
466
+ const d = r || (f == null ? void 0 : f.id), c = w(
467
+ () => Kt(o.queries, {
463
468
  queryId: e,
464
- viewId: c
469
+ viewId: d
465
470
  }),
466
471
  [
467
- a.queries,
472
+ o.queries,
468
473
  e,
469
- c
474
+ d
470
475
  ]
471
476
  );
472
- if (!a.enabled || !l || !u)
477
+ if (!o.enabled || !u || !c)
473
478
  return null;
474
- const b = t || `Inspect ${At(u, !!e)}`;
475
- return /* @__PURE__ */ f(
479
+ const m = t || `Inspect ${Nt(c, !!e)}`;
480
+ return /* @__PURE__ */ p(
476
481
  "button",
477
482
  {
478
483
  type: "button",
479
- "aria-label": b,
480
- title: b,
481
- className: n ? `${K} ${n}` : K,
484
+ "aria-label": m,
485
+ title: m,
486
+ className: n ? `${N} ${n}` : N,
482
487
  style: {
483
- ...o.inspectButton,
484
- ...Vt((y = u.latestAttempt) == null ? void 0 : y.status),
488
+ ...s.inspectButton,
489
+ ...sn((v = c.latestAttempt) == null ? void 0 : v.status),
485
490
  ...i
486
491
  },
487
- onClick: () => l.openDevtools({
488
- traceId: u.traceId,
489
- queryId: u.queryId,
490
- viewId: u.viewId
492
+ onClick: () => u.openDevtools({
493
+ traceId: c.traceId,
494
+ queryId: c.queryId,
495
+ viewId: c.viewId
491
496
  }),
492
497
  children: [
493
- /* @__PURE__ */ s(Pr, { size: 13 }),
494
- /* @__PURE__ */ s("span", { style: o.inspectButtonText, children: ((v = u.latestAttempt) == null ? void 0 : v.status) || "idle" })
498
+ /* @__PURE__ */ a(rt, { size: 13 }),
499
+ /* @__PURE__ */ a("span", { style: s.inspectButtonText, children: ((S = c.latestAttempt) == null ? void 0 : S.status) || "idle" })
495
500
  ]
496
501
  }
497
502
  );
498
503
  }
499
- function lr() {
500
- const e = V($e);
501
- return !e || !e.state.enabled ? ar : be(e.state);
504
+ function hr() {
505
+ const e = V(ze);
506
+ return !e || !e.state.enabled ? mr : le(e.state);
502
507
  }
503
- function rt({
508
+ function pt({
504
509
  spec: e,
505
510
  queryKind: r,
506
511
  queryKey: t,
507
512
  intent: n,
508
513
  activeInputs: i,
509
- debug: a
514
+ debug: o
510
515
  }) {
511
- const l = V($e), p = V(Ne), c = !!(l != null && l.state.enabled), u = l == null ? void 0 : l.dispatch, b = an(e), y = e.label, v = w(
516
+ const u = V(ze), f = V(He), d = !!(u != null && u.state.enabled), c = u == null ? void 0 : u.dispatch, m = Sn(e), v = e.label, S = w(
512
517
  () => JSON.stringify(e),
513
518
  [e]
514
519
  ), g = w(
515
520
  () => JSON.stringify(i || []),
516
521
  [i]
517
- ), h = w(
522
+ ), b = w(
518
523
  () => JSON.stringify(n || null),
519
524
  [n]
520
- ), C = L(e), d = L(v), I = L(n), $ = L(h), A = L(i), W = L(g), D = sn(a), m = JSON.stringify(D || []), S = L(D), k = L(m);
521
- d.current !== v && (d.current = v, C.current = e), $.current !== h && ($.current = h, I.current = n), W.current !== g && (W.current = g, A.current = i), k.current !== m && (k.current = m, S.current = D);
522
- const x = C.current, T = I.current, U = A.current, re = S.current, te = sr(), E = w(
523
- () => b || `query_${Tr(t)}`,
524
- [t, b]
525
- ), M = (a == null ? void 0 : a.viewId) || (p == null ? void 0 : p.id), ne = (a == null ? void 0 : a.viewTitle) || (a == null ? void 0 : a.title) || (p == null ? void 0 : p.title), ie = a == null ? void 0 : a.visualType, oe = a == null ? void 0 : a.sectionTitle, H = w(
525
+ ), k = D(e), l = D(S), y = D(n), K = D(b), E = D(i), W = D(g), L = bn(o), h = JSON.stringify(L || []), I = D(L), R = D(h);
526
+ l.current !== S && (l.current = S, k.current = e), K.current !== b && (K.current = b, y.current = n), W.current !== g && (W.current = g, E.current = i), R.current !== h && (R.current = h, I.current = L);
527
+ const q = k.current, A = y.current, U = E.current, te = I.current, ne = gr(), T = w(
528
+ () => m || `query_${Lr(t)}`,
529
+ [t, m]
530
+ ), H = (o == null ? void 0 : o.viewId) || (f == null ? void 0 : f.id), ie = (o == null ? void 0 : o.viewTitle) || (o == null ? void 0 : o.title) || (f == null ? void 0 : f.title), oe = o == null ? void 0 : o.visualType, se = o == null ? void 0 : o.sectionTitle, j = w(
526
531
  () => [
527
- M || "unscoped-view",
528
- E,
529
- te
532
+ H || "unscoped-view",
533
+ T,
534
+ ne
530
535
  ].join("::"),
531
- [E, te, M]
532
- ), ze = w(
536
+ [T, ne, H]
537
+ ), Ge = w(
533
538
  () => ({
534
- traceKey: H,
535
- spec: x,
536
- queryId: E,
537
- queryLabel: y,
539
+ traceKey: j,
540
+ spec: q,
541
+ queryId: T,
542
+ queryLabel: v,
538
543
  queryKind: r,
539
- builder: dn(r),
540
- viewId: M,
541
- viewTitle: ne,
542
- visualType: ie,
543
- sectionTitle: oe,
544
- sourceHints: re,
545
- intent: T,
544
+ builder: In(r),
545
+ viewId: H,
546
+ viewTitle: ie,
547
+ visualType: oe,
548
+ sectionTitle: se,
549
+ sourceHints: te,
550
+ intent: A,
546
551
  activeInputs: U,
547
- clientWarnings: b ? [] : ["Query spec is missing an explicit id; using an opaque internal id."]
552
+ clientWarnings: m ? [] : ["Query spec is missing an explicit id; using an opaque internal id."]
548
553
  }),
549
554
  [
550
- E,
555
+ T,
551
556
  r,
552
- b,
553
- y,
554
- x,
557
+ m,
558
+ v,
559
+ q,
555
560
  U,
556
- T,
557
- re,
558
- oe,
561
+ A,
562
+ te,
563
+ se,
564
+ j,
559
565
  H,
560
- M,
561
- ne,
562
- ie
566
+ ie,
567
+ oe
563
568
  ]
564
569
  );
565
- B(() => {
566
- if (!(!c || !u))
567
- return u({ type: "register", descriptor: ze }), () => {
568
- u({ type: "unregister", traceKey: H });
570
+ $(() => {
571
+ if (!(!d || !c))
572
+ return c({ type: "register", descriptor: Ge }), () => {
573
+ c({ type: "unregister", traceKey: j });
569
574
  };
570
- }, [ze, u, c, H]);
575
+ }, [Ge, c, d, j]);
571
576
  const F = O(
572
- (R, G) => {
573
- !c || !u || u({ type: "event", traceKey: H, event: R, latestAttempt: G });
577
+ (C, G) => {
578
+ !d || !c || c({ type: "event", traceKey: j, event: C, latestAttempt: G });
574
579
  },
575
- [u, c, H]
576
- ), Me = O(() => {
580
+ [c, d, j]
581
+ ), Je = O(() => {
577
582
  F(
578
583
  {
579
584
  type: "query_started",
580
- queryId: E,
581
- at: ye()
585
+ queryId: T,
586
+ at: ve()
582
587
  },
583
588
  { status: "loading" }
584
589
  );
585
- }, [F, E]), He = O(
586
- (R, G) => {
587
- const se = er(R), ae = yn(R), kr = hn(R);
590
+ }, [F, T]), Ye = O(
591
+ (C, G) => {
592
+ const ae = dr(C), de = kn(C), _r = Rn(C);
588
593
  F(
589
594
  {
590
595
  type: "query_succeeded",
591
- queryId: E,
592
- requestId: se,
593
- at: ye(),
594
- rowCount: ae,
596
+ queryId: T,
597
+ requestId: ae,
598
+ at: ve(),
599
+ rowCount: de,
595
600
  durationMs: G
596
601
  },
597
602
  {
598
- requestId: se,
603
+ requestId: ae,
599
604
  status: "success",
600
605
  durationMs: G,
601
- rowCount: ae,
602
- columnCount: kr,
603
- executionResult: Ze(R)
606
+ rowCount: de,
607
+ columnCount: _r,
608
+ executionResult: ar(C)
604
609
  }
605
610
  );
606
611
  },
607
- [F, E]
608
- ), ce = O(
609
- (R, G) => {
610
- const se = er(R), ae = R instanceof Error ? R.message : String(R);
612
+ [F, T]
613
+ ), pe = O(
614
+ (C, G) => {
615
+ const ae = dr(C), de = C instanceof Error ? C.message : String(C);
611
616
  F(
612
617
  {
613
618
  type: "query_failed",
614
- queryId: E,
615
- requestId: se,
616
- at: ye(),
617
- errorMessage: ae
619
+ queryId: T,
620
+ requestId: ae,
621
+ at: ve(),
622
+ errorMessage: de
618
623
  },
619
624
  {
620
- requestId: se,
625
+ requestId: ae,
621
626
  status: "error",
622
627
  durationMs: G,
623
- errorMessage: ae,
624
- executionResult: Ze(R)
628
+ errorMessage: de,
629
+ executionResult: ar(C)
625
630
  }
626
631
  );
627
632
  },
628
- [F, E]
629
- ), je = O(
630
- (R) => {
633
+ [F, T]
634
+ ), Xe = O(
635
+ (C) => {
631
636
  F(
632
637
  {
633
638
  type: "query_ignored_stale",
634
- queryId: E,
635
- at: ye(),
636
- reason: R
639
+ queryId: T,
640
+ at: ve(),
641
+ reason: C
637
642
  }
638
643
  );
639
644
  },
640
- [F, E]
641
- ), Pe = O(
642
- (R) => {
643
- ce(R, 0);
645
+ [F, T]
646
+ ), Ze = O(
647
+ (C) => {
648
+ pe(C, 0);
644
649
  },
645
- [ce]
646
- ), xe = c ? l == null ? void 0 : l.state.entries[H] : void 0;
650
+ [pe]
651
+ ), Ee = d ? u == null ? void 0 : u.state.entries[j] : void 0;
647
652
  return w(
648
653
  () => ({
649
- enabled: c,
650
- queryId: E,
651
- trace: xe ? he(xe) : void 0,
652
- start: Me,
653
- success: He,
654
- failure: ce,
655
- ignored: je,
656
- validationFailure: Pe
654
+ enabled: d,
655
+ queryId: T,
656
+ trace: Ee ? be(Ee) : void 0,
657
+ start: Je,
658
+ success: Ye,
659
+ failure: pe,
660
+ ignored: Xe,
661
+ validationFailure: Ze
657
662
  }),
658
663
  [
659
- c,
660
- ce,
661
- je,
662
- E,
663
- Me,
664
- He,
665
- xe,
666
- Pe
664
+ d,
665
+ pe,
666
+ Xe,
667
+ T,
668
+ Je,
669
+ Ye,
670
+ Ee,
671
+ Ze
667
672
  ]
668
673
  );
669
674
  }
670
- function tt() {
671
- return /* @__PURE__ */ s("span", { style: o.logoMark, "aria-hidden": !0, children: /* @__PURE__ */ f(
675
+ function gt() {
676
+ return /* @__PURE__ */ a("span", { style: s.logoMark, "aria-hidden": !0, children: /* @__PURE__ */ p(
672
677
  "svg",
673
678
  {
674
679
  viewBox: "0 0 100 100",
@@ -677,243 +682,263 @@ function tt() {
677
682
  height: "16",
678
683
  focusable: "false",
679
684
  children: [
680
- /* @__PURE__ */ s("rect", { x: "20", y: "15", width: "60", height: "12", rx: "6", fill: "currentColor" }),
681
- /* @__PURE__ */ s("rect", { x: "20", y: "35", width: "40", height: "12", rx: "6", fill: "currentColor" }),
682
- /* @__PURE__ */ s("rect", { x: "40", y: "55", width: "40", height: "12", rx: "6", fill: "currentColor" }),
683
- /* @__PURE__ */ s("rect", { x: "20", y: "75", width: "60", height: "12", rx: "6", fill: "currentColor" })
685
+ /* @__PURE__ */ a("rect", { x: "20", y: "15", width: "60", height: "12", rx: "6", fill: "currentColor" }),
686
+ /* @__PURE__ */ a("rect", { x: "20", y: "35", width: "40", height: "12", rx: "6", fill: "currentColor" }),
687
+ /* @__PURE__ */ a("rect", { x: "40", y: "55", width: "40", height: "12", rx: "6", fill: "currentColor" }),
688
+ /* @__PURE__ */ a("rect", { x: "20", y: "75", width: "60", height: "12", rx: "6", fill: "currentColor" })
684
689
  ]
685
690
  }
686
691
  ) });
687
692
  }
688
- function nt({
693
+ function mt({
689
694
  trace: e
690
695
  }) {
691
- var W, D, m, S, k, x;
696
+ var W, L, h, I, R, q;
692
697
  if (!e)
693
- return /* @__PURE__ */ s("div", { style: o.detailsPane, children: /* @__PURE__ */ s("div", { style: o.emptyState, children: "No traces registered yet" }) });
694
- const r = e.latestAttempt, t = r == null ? void 0 : r.executionResult, n = X(
698
+ return /* @__PURE__ */ a("div", { style: s.detailsPane, children: /* @__PURE__ */ a("div", { style: s.emptyState, children: "No traces registered yet" }) });
699
+ const r = e.latestAttempt, t = r == null ? void 0 : r.executionResult, n = Re(
695
700
  (W = t == null ? void 0 : t.validation) == null ? void 0 : W.warnings
696
- ), i = X((D = t == null ? void 0 : t.validation) == null ? void 0 : D.errors), a = hr(
697
- (m = t == null ? void 0 : t.coverage) == null ? void 0 : m.missingObligations
698
- ), l = X(
699
- (S = t == null ? void 0 : t.coverage) == null ? void 0 : S.warnings
700
- ), p = t == null ? void 0 : t.compiledQuery, c = _t(t), u = ((k = e.server) == null ? void 0 : k.compiledSql) || c.compiledSql, b = r != null && r.errorMessage ? [r.errorMessage] : [], y = [
701
+ ), i = Re((L = t == null ? void 0 : t.validation) == null ? void 0 : L.errors), o = xr(
702
+ (h = t == null ? void 0 : t.coverage) == null ? void 0 : h.missingObligations
703
+ ), u = Re(
704
+ (I = t == null ? void 0 : t.coverage) == null ? void 0 : I.warnings
705
+ ), f = t == null ? void 0 : t.compiledQuery, d = Zt(t), c = ((R = e.server) == null ? void 0 : R.compiledSql) || d.compiledSql, m = [
706
+ ...r != null && r.errorMessage ? [r.errorMessage] : [],
707
+ ...i
708
+ ], v = [
701
709
  ...e.clientWarnings,
702
710
  ...n,
703
- ...i,
704
- ...a,
705
- ...l
706
- ], v = e.inputsApplied.length > 0, g = !!(p || u), h = Ct(e), C = Ot(r == null ? void 0 : r.rowCount), d = Bt(r == null ? void 0 : r.durationMs), I = e.sourceRefs.length, $ = mr(e), A = pr($);
707
- return /* @__PURE__ */ f("div", { style: o.detailsPane, children: [
708
- /* @__PURE__ */ f("div", { style: o.detailsHeader, children: [
709
- /* @__PURE__ */ f("div", { style: o.detailsHeaderTopRow, children: [
710
- /* @__PURE__ */ s(
711
+ ...o,
712
+ ...u
713
+ ], S = e.inputsApplied.length > 0, g = !!(f || c), b = Mt(e), k = Qt(r == null ? void 0 : r.rowCount), l = Vt(r == null ? void 0 : r.durationMs), y = e.sourceRefs.length, K = wr(e), E = Sr(K);
714
+ return /* @__PURE__ */ p("div", { style: s.detailsPane, children: [
715
+ /* @__PURE__ */ p("div", { style: s.detailsHeader, children: [
716
+ /* @__PURE__ */ p("div", { style: s.detailsHeaderTopRow, children: [
717
+ /* @__PURE__ */ a(
711
718
  "span",
712
719
  {
713
720
  "aria-hidden": !0,
714
721
  style: {
715
- ...o.detailsHeaderStatusDot,
716
- ...br(r == null ? void 0 : r.status)
722
+ ...s.detailsHeaderStatusDot,
723
+ ...Er(r == null ? void 0 : r.status)
717
724
  }
718
725
  }
719
726
  ),
720
- /* @__PURE__ */ s("span", { style: o.detailsTitle, children: we(e) }),
721
- /* @__PURE__ */ s(
727
+ /* @__PURE__ */ a("span", { style: s.detailsTitle, children: qe(e) }),
728
+ /* @__PURE__ */ a(
722
729
  "span",
723
730
  {
724
731
  style: {
725
- ...o.detailsKindChip,
726
- ...gr(A)
732
+ ...s.detailsKindChip,
733
+ ...Ir(E)
727
734
  },
728
- children: $
735
+ children: K
729
736
  }
730
737
  )
731
738
  ] }),
732
- /* @__PURE__ */ f("div", { style: o.metaStrip, children: [
733
- /* @__PURE__ */ s("span", { style: o.metaStripItem, children: h }),
734
- /* @__PURE__ */ s("span", { style: o.metaStripDot, children: "·" }),
735
- /* @__PURE__ */ f("span", { style: o.metaStripItem, children: [
736
- C,
739
+ /* @__PURE__ */ p("div", { style: s.metaStrip, children: [
740
+ /* @__PURE__ */ a("span", { style: s.metaStripItem, children: b }),
741
+ /* @__PURE__ */ a("span", { style: s.metaStripDot, children: "·" }),
742
+ /* @__PURE__ */ p("span", { style: s.metaStripItem, children: [
743
+ k,
737
744
  " rows"
738
745
  ] }),
739
- /* @__PURE__ */ s("span", { style: o.metaStripDot, children: "·" }),
740
- /* @__PURE__ */ s("span", { style: o.metaStripItem, children: d }),
741
- I > 0 ? /* @__PURE__ */ f(or, { children: [
742
- /* @__PURE__ */ s("span", { style: o.metaStripDot, children: "·" }),
743
- /* @__PURE__ */ s("span", { style: o.metaStripItem, children: I === 1 ? "1 source" : `${I} sources` })
746
+ /* @__PURE__ */ a("span", { style: s.metaStripDot, children: "·" }),
747
+ /* @__PURE__ */ a("span", { style: s.metaStripItem, children: l }),
748
+ y > 0 ? /* @__PURE__ */ p(pr, { children: [
749
+ /* @__PURE__ */ a("span", { style: s.metaStripDot, children: "·" }),
750
+ /* @__PURE__ */ a("span", { style: s.metaStripItem, children: y === 1 ? "1 source" : `${y} sources` })
744
751
  ] }) : null
745
752
  ] })
746
753
  ] }),
747
- b.length ? /* @__PURE__ */ s(Ve, { tone: "error", title: "Error", items: b }) : null,
748
- y.length ? /* @__PURE__ */ s(Ve, { tone: "warning", title: "Warnings", items: y }) : null,
749
- /* @__PURE__ */ s(st, { trace: e }),
750
- /* @__PURE__ */ s(lt, { trace: e }),
751
- (x = e.sourceHints) != null && x.length ? /* @__PURE__ */ s(ut, { hints: e.sourceHints }) : null,
752
- v ? /* @__PURE__ */ s(gt, { inputs: e.inputsApplied }) : null,
753
- g ? /* @__PURE__ */ s(de, { title: "Compiled Query", defaultOpen: !0, children: /* @__PURE__ */ s(
754
- mt,
754
+ m.length ? /* @__PURE__ */ a(er, { tone: "error", title: "Error", items: m }) : null,
755
+ v.length ? /* @__PURE__ */ a(er, { tone: "warning", title: "Warnings", items: v }) : null,
756
+ /* @__PURE__ */ a(vt, { trace: e }),
757
+ /* @__PURE__ */ a(It, { trace: e }),
758
+ (q = e.sourceHints) != null && q.length ? /* @__PURE__ */ a(wt, { hints: e.sourceHints }) : null,
759
+ S ? /* @__PURE__ */ a(Et, { inputs: e.inputsApplied }) : null,
760
+ g ? /* @__PURE__ */ a(ue, { title: "Compiled Query", defaultOpen: !0, children: /* @__PURE__ */ a(
761
+ Tt,
755
762
  {
756
- compiledQuery: p,
757
- compiledSql: u
763
+ compiledQuery: f,
764
+ compiledSql: c
758
765
  }
759
766
  ) }) : null,
760
- /* @__PURE__ */ s(de, { title: "Lifecycle Events", children: e.recentEvents.length ? /* @__PURE__ */ s("div", { style: o.eventList, children: e.recentEvents.slice(-5).map((T, U) => /* @__PURE__ */ f(
767
+ /* @__PURE__ */ a(ue, { title: "Lifecycle Events", children: e.recentEvents.length ? /* @__PURE__ */ a("div", { style: s.eventList, children: e.recentEvents.slice(-5).map((A, U) => /* @__PURE__ */ p(
761
768
  "div",
762
769
  {
763
- style: o.eventRow,
770
+ style: s.eventRow,
764
771
  children: [
765
- /* @__PURE__ */ s("span", { style: o.eventType, children: Wt(T) }),
766
- /* @__PURE__ */ s("span", { style: o.eventMeta, children: Nt(T) })
772
+ /* @__PURE__ */ a("span", { style: s.eventType, children: Gt(A) }),
773
+ /* @__PURE__ */ a("span", { style: s.eventMeta, children: Jt(A) })
767
774
  ]
768
775
  },
769
- `${T.type}:${T.at}:${U}`
770
- )) }) : /* @__PURE__ */ s("div", { style: o.mutedText, children: "No attempts recorded" }) }),
771
- /* @__PURE__ */ s(de, { title: "Raw Trace", children: /* @__PURE__ */ s("pre", { style: o.codeBlock, children: $t(e) }) })
776
+ `${A.type}:${A.at}:${U}`
777
+ )) }) : /* @__PURE__ */ a("div", { style: s.mutedText, children: "No attempts recorded" }) }),
778
+ /* @__PURE__ */ a(ue, { title: "Raw Trace", children: /* @__PURE__ */ a("pre", { style: s.codeBlock, children: Ut(e) }) })
772
779
  ] });
773
780
  }
774
- function Ve({
781
+ function er({
775
782
  tone: e,
776
783
  title: r,
777
784
  items: t
778
785
  }) {
779
- const n = e === "error" ? o.alertCardError : o.alertCardWarning;
780
- return /* @__PURE__ */ f("div", { style: { ...o.alertCard, ...n }, children: [
781
- /* @__PURE__ */ s("div", { style: o.alertCardTitle, children: r }),
782
- t.length > 1 ? /* @__PURE__ */ s("ul", { style: o.alertCardList, children: t.map((i, a) => /* @__PURE__ */ s("li", { children: i }, `${e}-${a}`)) }) : /* @__PURE__ */ s("div", { children: t[0] })
786
+ const n = e === "error" ? s.alertCardError : s.alertCardWarning;
787
+ return /* @__PURE__ */ p("div", { style: { ...s.alertCard, ...n }, children: [
788
+ /* @__PURE__ */ a("div", { style: s.alertCardTitle, children: r }),
789
+ t.length > 1 ? /* @__PURE__ */ a("ul", { style: s.alertCardList, children: t.map((i, o) => /* @__PURE__ */ a("li", { children: i }, `${e}-${o}`)) }) : /* @__PURE__ */ a("div", { children: t[0] })
783
790
  ] });
784
791
  }
785
- function it({
792
+ function yt({
786
793
  issues: e,
787
794
  onSelect: r
788
795
  }) {
789
- const t = e.slice(0, 6), n = e.length - t.length;
790
- return /* @__PURE__ */ f("section", { style: o.issueSummary, "aria-label": "Semaphor trace issues", children: [
791
- /* @__PURE__ */ f("div", { style: o.issueSummaryHeader, children: [
792
- /* @__PURE__ */ s("span", { children: "Issues" }),
793
- /* @__PURE__ */ s("span", { style: o.issueSummaryCount, children: e.length })
794
- ] }),
795
- /* @__PURE__ */ f("div", { style: o.issueSummaryList, children: [
796
- t.map((i, a) => /* @__PURE__ */ f(
796
+ const [t, n] = M(!1), i = e.slice(0, 6), o = e.length - i.length, u = e.filter((c) => c.tone === "error").length, f = e.length - u, d = [
797
+ u ? `${u} error${u === 1 ? "" : "s"}` : "",
798
+ f ? `${f} warning${f === 1 ? "" : "s"}` : ""
799
+ ].filter(Boolean);
800
+ return /* @__PURE__ */ p("section", { style: s.issueSummary, "aria-label": "Semaphor trace issues", children: [
801
+ /* @__PURE__ */ p(
802
+ "button",
803
+ {
804
+ type: "button",
805
+ "aria-expanded": t,
806
+ style: s.issueSummaryToggle,
807
+ onClick: () => n((c) => !c),
808
+ children: [
809
+ /* @__PURE__ */ p("span", { style: s.issueSummaryHeaderLabel, children: [
810
+ t ? /* @__PURE__ */ a(it, { size: 13 }) : /* @__PURE__ */ a(tt, { size: 13 }),
811
+ /* @__PURE__ */ a("span", { children: "Issues" })
812
+ ] }),
813
+ /* @__PURE__ */ a("span", { style: s.issueSummaryCount, children: e.length })
814
+ ]
815
+ }
816
+ ),
817
+ t ? /* @__PURE__ */ p("div", { style: s.issueSummaryList, children: [
818
+ i.map((c, m) => /* @__PURE__ */ p(
797
819
  "button",
798
820
  {
799
821
  type: "button",
800
- title: `${i.title}: ${i.message}`,
801
- style: o.issueSummaryItem,
802
- onClick: () => r(i.trace),
822
+ title: `${c.title}: ${c.message}`,
823
+ style: s.issueSummaryItem,
824
+ onClick: () => r(c.trace),
803
825
  children: [
804
- /* @__PURE__ */ s(
826
+ /* @__PURE__ */ a(
805
827
  "span",
806
828
  {
807
829
  style: {
808
- ...o.issueSummaryBadge,
809
- ...i.tone === "error" ? o.issueSummaryBadgeError : o.issueSummaryBadgeWarning
830
+ ...s.issueSummaryBadge,
831
+ ...c.tone === "error" ? s.issueSummaryBadgeError : s.issueSummaryBadgeWarning
810
832
  },
811
- children: i.tone === "error" ? "Error" : "Warning"
833
+ children: c.tone === "error" ? "Error" : "Warning"
812
834
  }
813
835
  ),
814
- /* @__PURE__ */ f("span", { style: o.issueSummaryText, children: [
815
- /* @__PURE__ */ s("span", { style: o.issueSummaryTitle, children: i.title }),
816
- /* @__PURE__ */ s("span", { style: o.issueSummaryMessage, children: i.message })
836
+ /* @__PURE__ */ p("span", { style: s.issueSummaryText, children: [
837
+ /* @__PURE__ */ a("span", { style: s.issueSummaryTitle, children: c.title }),
838
+ /* @__PURE__ */ a("span", { style: s.issueSummaryMessage, children: c.message })
817
839
  ] })
818
840
  ]
819
841
  },
820
- `${i.trace.traceId}:${i.title}:${a}`
842
+ `${c.trace.traceId}:${c.title}:${m}`
821
843
  )),
822
- n > 0 ? /* @__PURE__ */ f("div", { style: o.issueSummaryMore, children: [
823
- n,
844
+ o > 0 ? /* @__PURE__ */ p("div", { style: s.issueSummaryMore, children: [
845
+ o,
824
846
  " more issue",
825
- n === 1 ? "" : "s",
847
+ o === 1 ? "" : "s",
826
848
  " in traces"
827
849
  ] }) : null
850
+ ] }) : /* @__PURE__ */ p("div", { style: s.issueSummaryCollapsed, children: [
851
+ d.join(" · "),
852
+ " across traces"
828
853
  ] })
829
854
  ] });
830
855
  }
831
- function ot({
856
+ function ht({
832
857
  status: e
833
858
  }) {
834
- return /* @__PURE__ */ s(
859
+ return /* @__PURE__ */ a(
835
860
  "span",
836
861
  {
837
862
  "aria-hidden": !0,
838
863
  style: {
839
- ...o.statusDot,
840
- ...br(e)
864
+ ...s.statusDot,
865
+ ...Er(e)
841
866
  }
842
867
  }
843
868
  );
844
869
  }
845
- function de({
870
+ function ue({
846
871
  title: e,
847
872
  children: r,
848
873
  defaultOpen: t = !1
849
874
  }) {
850
- const [n, i] = Q(t);
851
- return /* @__PURE__ */ f(
875
+ const [n, i] = M(t);
876
+ return /* @__PURE__ */ p(
852
877
  "details",
853
878
  {
854
- style: o.disclosure,
879
+ style: s.disclosure,
855
880
  open: n,
856
- onToggle: (a) => i(a.currentTarget.open),
881
+ onToggle: (o) => i(o.currentTarget.open),
857
882
  children: [
858
- /* @__PURE__ */ s("summary", { style: o.disclosureSummary, children: e }),
859
- /* @__PURE__ */ s("div", { style: o.disclosureBody, children: r })
883
+ /* @__PURE__ */ a("summary", { style: s.disclosureSummary, children: e }),
884
+ /* @__PURE__ */ a("div", { style: s.disclosureBody, children: r })
860
885
  ]
861
886
  }
862
887
  );
863
888
  }
864
- function st({
889
+ function vt({
865
890
  trace: e
866
891
  }) {
867
892
  var i;
868
- const r = (i = e.projectionFieldRefs) != null && i.length ? e.projectionFieldRefs : e.fieldRefs, t = e.inputFieldRefs || [], n = Rt(r);
869
- return /* @__PURE__ */ f("div", { style: o.recipe, children: [
870
- /* @__PURE__ */ s(at, { sources: e.sourceRefs }),
871
- /* @__PURE__ */ s(j, { title: "Measures", fields: n.measures }),
872
- /* @__PURE__ */ s(j, { title: "Time fields", fields: n.timeFields }),
873
- /* @__PURE__ */ s(
874
- j,
893
+ const r = (i = e.projectionFieldRefs) != null && i.length ? e.projectionFieldRefs : e.fieldRefs, t = e.inputFieldRefs || [], n = zt(r);
894
+ return /* @__PURE__ */ p("div", { style: s.recipe, children: [
895
+ /* @__PURE__ */ a(bt, { sources: e.sourceRefs }),
896
+ /* @__PURE__ */ a(P, { title: "Measures", fields: n.measures }),
897
+ /* @__PURE__ */ a(P, { title: "Time fields", fields: n.timeFields }),
898
+ /* @__PURE__ */ a(
899
+ P,
875
900
  {
876
901
  title: "Dimensions",
877
902
  fields: n.dimensions,
878
903
  emptyText: "No dimensions selected"
879
904
  }
880
905
  ),
881
- /* @__PURE__ */ s(j, { title: "Identifiers", fields: n.identifiers }),
882
- /* @__PURE__ */ s(j, { title: "Other fields", fields: n.other }),
883
- /* @__PURE__ */ s(j, { title: "Input bindings", fields: t })
906
+ /* @__PURE__ */ a(P, { title: "Identifiers", fields: n.identifiers }),
907
+ /* @__PURE__ */ a(P, { title: "Other fields", fields: n.other }),
908
+ /* @__PURE__ */ a(P, { title: "Input bindings", fields: t })
884
909
  ] });
885
910
  }
886
- function at({
911
+ function bt({
887
912
  sources: e
888
913
  }) {
889
- return e.length ? /* @__PURE__ */ f("div", { style: o.recipeGroup, children: [
890
- /* @__PURE__ */ f("div", { style: o.recipeGroupHeader, children: [
891
- /* @__PURE__ */ s("span", { style: o.recipeGroupTitle, children: "From" }),
892
- /* @__PURE__ */ s("span", { style: o.recipeGroupCount, children: e.length })
914
+ return e.length ? /* @__PURE__ */ p("div", { style: s.recipeGroup, children: [
915
+ /* @__PURE__ */ p("div", { style: s.recipeGroupHeader, children: [
916
+ /* @__PURE__ */ a("span", { style: s.recipeGroupTitle, children: "From" }),
917
+ /* @__PURE__ */ a("span", { style: s.recipeGroupCount, children: e.length })
893
918
  ] }),
894
- /* @__PURE__ */ s("div", { style: o.sourcePillRow, children: e.map((r, t) => /* @__PURE__ */ s(
895
- dt,
919
+ /* @__PURE__ */ a("div", { style: s.sourcePillRow, children: e.map((r, t) => /* @__PURE__ */ a(
920
+ St,
896
921
  {
897
922
  source: r
898
923
  },
899
- `${_(r)}:${t}`
924
+ `${z(r)}:${t}`
900
925
  )) })
901
926
  ] }) : null;
902
927
  }
903
- function dt({ source: e }) {
904
- const r = _(e);
905
- return /* @__PURE__ */ f("span", { style: o.sourcePill, title: r, children: [
906
- /* @__PURE__ */ s("span", { style: o.sourcePillLabel, children: r }),
907
- /* @__PURE__ */ s("span", { style: o.sourcePillRole, children: e.kind })
928
+ function St({ source: e }) {
929
+ const r = z(e);
930
+ return /* @__PURE__ */ p("span", { style: s.sourcePill, title: r, children: [
931
+ /* @__PURE__ */ a("span", { style: s.sourcePillLabel, children: r }),
932
+ /* @__PURE__ */ a("span", { style: s.sourcePillRole, children: e.kind })
908
933
  ] });
909
934
  }
910
- function lt({
935
+ function It({
911
936
  trace: e
912
937
  }) {
913
- return !e.sourceRefs.length && !e.fieldRefs.length ? null : /* @__PURE__ */ s(de, { title: "Sources and field refs", children: /* @__PURE__ */ f("div", { style: o.traceLineage, children: [
914
- /* @__PURE__ */ s(ct, { sources: e.sourceRefs }),
915
- /* @__PURE__ */ s(
916
- j,
938
+ return !e.sourceRefs.length && !e.fieldRefs.length ? null : /* @__PURE__ */ a(ue, { title: "Sources and field refs", children: /* @__PURE__ */ p("div", { style: s.traceLineage, children: [
939
+ /* @__PURE__ */ a(qt, { sources: e.sourceRefs }),
940
+ /* @__PURE__ */ a(
941
+ P,
917
942
  {
918
943
  title: "All field refs",
919
944
  fields: e.fieldRefs,
@@ -922,86 +947,86 @@ function lt({
922
947
  )
923
948
  ] }) });
924
949
  }
925
- function ut({
950
+ function wt({
926
951
  hints: e
927
952
  }) {
928
- return /* @__PURE__ */ s(de, { title: "Source hints", children: /* @__PURE__ */ s("div", { style: o.recipeFieldList, children: e.map((r, t) => {
929
- const n = Dt(r), i = r.component || r.exportName || n || "Source hint", a = [
953
+ return /* @__PURE__ */ a(ue, { title: "Source hints", children: /* @__PURE__ */ a("div", { style: s.recipeFieldList, children: e.map((r, t) => {
954
+ const n = Pt(r), i = r.component || r.exportName || n || "Source hint", o = [
930
955
  r.exportName && r.exportName !== i ? r.exportName : void 0,
931
956
  n,
932
957
  r.note
933
958
  ].filter(Boolean).join(" · ");
934
- return /* @__PURE__ */ f(
959
+ return /* @__PURE__ */ p(
935
960
  "div",
936
961
  {
937
- style: o.recipeFieldRow,
938
- title: a || i,
962
+ style: s.recipeFieldRow,
963
+ title: o || i,
939
964
  children: [
940
- /* @__PURE__ */ s("span", { style: o.recipeFieldName, children: i }),
941
- a ? /* @__PURE__ */ s("span", { style: o.recipeFieldMeta, children: a }) : null
965
+ /* @__PURE__ */ a("span", { style: s.recipeFieldName, children: i }),
966
+ o ? /* @__PURE__ */ a("span", { style: s.recipeFieldMeta, children: o }) : null
942
967
  ]
943
968
  },
944
969
  `${i}:${n}:${t}`
945
970
  );
946
971
  }) }) });
947
972
  }
948
- function ct({
973
+ function qt({
949
974
  sources: e
950
975
  }) {
951
- return /* @__PURE__ */ f("div", { style: o.recipeGroup, children: [
952
- /* @__PURE__ */ f("div", { style: o.recipeGroupHeader, children: [
953
- /* @__PURE__ */ s("span", { style: o.recipeGroupTitle, children: "Sources" }),
954
- /* @__PURE__ */ s("span", { style: o.recipeGroupCount, children: e.length })
976
+ return /* @__PURE__ */ p("div", { style: s.recipeGroup, children: [
977
+ /* @__PURE__ */ p("div", { style: s.recipeGroupHeader, children: [
978
+ /* @__PURE__ */ a("span", { style: s.recipeGroupTitle, children: "Sources" }),
979
+ /* @__PURE__ */ a("span", { style: s.recipeGroupCount, children: e.length })
955
980
  ] }),
956
- e.length ? /* @__PURE__ */ s("div", { style: o.recipeFieldList, children: e.map((r, t) => /* @__PURE__ */ f(
981
+ e.length ? /* @__PURE__ */ a("div", { style: s.recipeFieldList, children: e.map((r, t) => /* @__PURE__ */ p(
957
982
  "div",
958
983
  {
959
- style: o.recipeFieldRow,
960
- title: _(r),
984
+ style: s.recipeFieldRow,
985
+ title: z(r),
961
986
  children: [
962
- /* @__PURE__ */ s("span", { style: o.recipeFieldName, children: _(r) }),
963
- /* @__PURE__ */ s("span", { style: o.recipeFieldMeta, children: r.kind })
987
+ /* @__PURE__ */ a("span", { style: s.recipeFieldName, children: z(r) }),
988
+ /* @__PURE__ */ a("span", { style: s.recipeFieldMeta, children: r.kind })
964
989
  ]
965
990
  },
966
- `${_(r)}:${t}`
967
- )) }) : /* @__PURE__ */ s("div", { style: o.recipeEmptyText, children: "No sources captured" })
991
+ `${z(r)}:${t}`
992
+ )) }) : /* @__PURE__ */ a("div", { style: s.recipeEmptyText, children: "No sources captured" })
968
993
  ] });
969
994
  }
970
- function j({
995
+ function P({
971
996
  title: e,
972
997
  fields: r,
973
998
  emptyText: t
974
999
  }) {
975
- return !r.length && !t ? null : /* @__PURE__ */ f("div", { style: o.recipeGroup, children: [
976
- /* @__PURE__ */ f("div", { style: o.recipeGroupHeader, children: [
977
- /* @__PURE__ */ s("span", { style: o.recipeGroupTitle, children: e }),
978
- /* @__PURE__ */ s("span", { style: o.recipeGroupCount, children: r.length })
1000
+ return !r.length && !t ? null : /* @__PURE__ */ p("div", { style: s.recipeGroup, children: [
1001
+ /* @__PURE__ */ p("div", { style: s.recipeGroupHeader, children: [
1002
+ /* @__PURE__ */ a("span", { style: s.recipeGroupTitle, children: e }),
1003
+ /* @__PURE__ */ a("span", { style: s.recipeGroupCount, children: r.length })
979
1004
  ] }),
980
- r.length ? /* @__PURE__ */ s("div", { style: o.fieldChipList, children: r.map((n, i) => /* @__PURE__ */ s(
981
- ft,
1005
+ r.length ? /* @__PURE__ */ a("div", { style: s.fieldChipList, children: r.map((n, i) => /* @__PURE__ */ a(
1006
+ xt,
982
1007
  {
983
1008
  field: n,
984
1009
  groupTitle: e
985
1010
  },
986
- `${Ke(n)}:${i}`
987
- )) }) : /* @__PURE__ */ s("div", { style: o.recipeEmptyText, children: t })
1011
+ `${Pe(n)}:${i}`
1012
+ )) }) : /* @__PURE__ */ a("div", { style: s.recipeEmptyText, children: t })
988
1013
  ] });
989
1014
  }
990
- function ft({
1015
+ function xt({
991
1016
  field: e,
992
1017
  groupTitle: r
993
1018
  }) {
994
- const t = kt(e), n = e.label || e.name, i = e.dataType && e.dataType !== "unknown" ? e.dataType : void 0, a = e.source ? _(e.source) : void 0, l = [t, i, a].filter(Boolean).join(" · "), p = pt(e, r);
995
- return /* @__PURE__ */ f("div", { style: o.fieldChip, title: l, children: [
996
- /* @__PURE__ */ s("span", { style: { ...o.fieldGlyph, ...p.style }, children: p.text }),
997
- e.aggregate ? /* @__PURE__ */ s("span", { style: o.fieldAggBadge, children: e.aggregate }) : null,
998
- /* @__PURE__ */ s("span", { style: o.fieldChipName, children: n }),
999
- i ? /* @__PURE__ */ s("span", { style: o.fieldChipMeta, children: i }) : null,
1000
- i && a ? /* @__PURE__ */ s("span", { style: o.fieldChipMetaDot, children: "·" }) : null,
1001
- a ? /* @__PURE__ */ s("span", { style: o.fieldChipMeta, children: a }) : null
1019
+ const t = Ht(e), n = e.label || e.name, i = e.dataType && e.dataType !== "unknown" ? e.dataType : void 0, o = e.source ? z(e.source) : void 0, u = [t, i, o].filter(Boolean).join(" · "), f = At(e, r);
1020
+ return /* @__PURE__ */ p("div", { style: s.fieldChip, title: u, children: [
1021
+ /* @__PURE__ */ a("span", { style: { ...s.fieldGlyph, ...f.style }, children: f.text }),
1022
+ e.aggregate ? /* @__PURE__ */ a("span", { style: s.fieldAggBadge, children: e.aggregate }) : null,
1023
+ /* @__PURE__ */ a("span", { style: s.fieldChipName, children: n }),
1024
+ i ? /* @__PURE__ */ a("span", { style: s.fieldChipMeta, children: i }) : null,
1025
+ i && o ? /* @__PURE__ */ a("span", { style: s.fieldChipMetaDot, children: "·" }) : null,
1026
+ o ? /* @__PURE__ */ a("span", { style: s.fieldChipMeta, children: o }) : null
1002
1027
  ] });
1003
1028
  }
1004
- function pt(e, r) {
1029
+ function At(e, r) {
1005
1030
  const t = e.dataType, n = e.role;
1006
1031
  return !!e.aggregate || n === "measure" || r === "Measures" ? {
1007
1032
  text: "Σ",
@@ -1040,28 +1065,28 @@ function pt(e, r) {
1040
1065
  }
1041
1066
  };
1042
1067
  }
1043
- function gt({
1068
+ function Et({
1044
1069
  inputs: e
1045
1070
  }) {
1046
- return /* @__PURE__ */ f("div", { style: o.inputsAppliedBlock, children: [
1047
- /* @__PURE__ */ f("div", { style: o.inputsAppliedHeader, children: [
1048
- /* @__PURE__ */ s("span", { style: o.inputsAppliedTitle, children: "Active Inputs" }),
1049
- /* @__PURE__ */ s("span", { style: o.inputsAppliedCount, children: e.length })
1071
+ return /* @__PURE__ */ p("div", { style: s.inputsAppliedBlock, children: [
1072
+ /* @__PURE__ */ p("div", { style: s.inputsAppliedHeader, children: [
1073
+ /* @__PURE__ */ a("span", { style: s.inputsAppliedTitle, children: "Active Inputs" }),
1074
+ /* @__PURE__ */ a("span", { style: s.inputsAppliedCount, children: e.length })
1050
1075
  ] }),
1051
- /* @__PURE__ */ s("div", { style: o.inputRecipeList, children: e.map((r) => {
1052
- const t = Lt(r);
1053
- return /* @__PURE__ */ f(
1076
+ /* @__PURE__ */ a("div", { style: s.inputRecipeList, children: e.map((r) => {
1077
+ const t = jt(r);
1078
+ return /* @__PURE__ */ p(
1054
1079
  "div",
1055
1080
  {
1056
- style: o.inputRecipeRow,
1081
+ style: s.inputRecipeRow,
1057
1082
  title: t.title,
1058
1083
  children: [
1059
- /* @__PURE__ */ f("div", { style: o.inputRecipeHeader, children: [
1060
- /* @__PURE__ */ s("span", { style: o.inputRecipeId, title: r.inputId, children: r.inputId }),
1061
- t.operator ? /* @__PURE__ */ s("span", { style: o.inputOperatorBadge, children: t.operator }) : null,
1062
- /* @__PURE__ */ s("span", { style: o.inputValuePreview, title: t.value, children: t.value })
1084
+ /* @__PURE__ */ p("div", { style: s.inputRecipeHeader, children: [
1085
+ /* @__PURE__ */ a("span", { style: s.inputRecipeId, title: r.inputId, children: r.inputId }),
1086
+ t.operator ? /* @__PURE__ */ a("span", { style: s.inputOperatorBadge, children: t.operator }) : null,
1087
+ /* @__PURE__ */ a("span", { style: s.inputValuePreview, title: t.value, children: t.value })
1063
1088
  ] }),
1064
- t.binding ? /* @__PURE__ */ s("div", { style: o.inputRecipeBinding, title: t.binding, children: t.binding }) : null
1089
+ t.binding ? /* @__PURE__ */ a("div", { style: s.inputRecipeBinding, title: t.binding, children: t.binding }) : null
1065
1090
  ]
1066
1091
  },
1067
1092
  r.inputId
@@ -1069,41 +1094,41 @@ function gt({
1069
1094
  }) })
1070
1095
  ] });
1071
1096
  }
1072
- function mt({
1097
+ function Tt({
1073
1098
  compiledQuery: e,
1074
1099
  compiledSql: r
1075
1100
  }) {
1076
- return (e == null ? void 0 : e.kind) === "sql" ? /* @__PURE__ */ f("div", { style: o.compiledQuery, children: [
1077
- /* @__PURE__ */ s(Qe, { label: "SQL", value: e.sql }),
1078
- e.pythonCode ? /* @__PURE__ */ s(Ae, { label: "Python", value: e.pythonCode }) : null,
1079
- e.parameters ? /* @__PURE__ */ s(
1080
- Ae,
1101
+ return (e == null ? void 0 : e.kind) === "sql" ? /* @__PURE__ */ p("div", { style: s.compiledQuery, children: [
1102
+ /* @__PURE__ */ a(rr, { label: "SQL", value: e.sql }),
1103
+ e.pythonCode ? /* @__PURE__ */ a(ke, { label: "Python", value: e.pythonCode }) : null,
1104
+ e.parameters ? /* @__PURE__ */ a(
1105
+ ke,
1081
1106
  {
1082
1107
  label: "Parameters",
1083
- value: Be(e.parameters)
1108
+ value: _e(e.parameters)
1084
1109
  }
1085
1110
  ) : null
1086
- ] }) : r ? /* @__PURE__ */ s(Qe, { label: "SQL", value: r }) : /* @__PURE__ */ s(Ae, { label: "Compiled Query", value: Be(e) });
1111
+ ] }) : r ? /* @__PURE__ */ a(rr, { label: "SQL", value: r }) : /* @__PURE__ */ a(ke, { label: "Compiled Query", value: _e(e) });
1087
1112
  }
1088
- function Ae({
1113
+ function ke({
1089
1114
  label: e,
1090
1115
  value: r
1091
1116
  }) {
1092
- return /* @__PURE__ */ f("div", { style: o.codeBlockGroup, children: [
1093
- /* @__PURE__ */ s("div", { style: o.codeBlockLabel, children: e }),
1094
- /* @__PURE__ */ s("pre", { style: o.codeBlock, children: r })
1117
+ return /* @__PURE__ */ p("div", { style: s.codeBlockGroup, children: [
1118
+ /* @__PURE__ */ a("div", { style: s.codeBlockLabel, children: e }),
1119
+ /* @__PURE__ */ a("pre", { style: s.codeBlock, children: r })
1095
1120
  ] });
1096
1121
  }
1097
- function Qe({
1122
+ function rr({
1098
1123
  label: e,
1099
1124
  value: r
1100
1125
  }) {
1101
- return /* @__PURE__ */ f("div", { style: o.codeBlockGroup, children: [
1102
- /* @__PURE__ */ s("div", { style: o.codeBlockLabel, children: e }),
1103
- /* @__PURE__ */ s("pre", { style: o.codeBlock, children: ht(r) })
1126
+ return /* @__PURE__ */ p("div", { style: s.codeBlockGroup, children: [
1127
+ /* @__PURE__ */ a("div", { style: s.codeBlockLabel, children: e }),
1128
+ /* @__PURE__ */ a("pre", { style: s.codeBlock, children: kt(r) })
1104
1129
  ] });
1105
1130
  }
1106
- const yt = /* @__PURE__ */ new Set([
1131
+ const Ct = /* @__PURE__ */ new Set([
1107
1132
  "SELECT",
1108
1133
  "FROM",
1109
1134
  "JOIN",
@@ -1141,77 +1166,93 @@ const yt = /* @__PURE__ */ new Set([
1141
1166
  "ALL",
1142
1167
  "WITH"
1143
1168
  ]);
1144
- function ht(e) {
1169
+ function kt(e) {
1145
1170
  return e.split(/(\s+|,|\(|\))/).map((t, n) => {
1146
1171
  if (!t) return null;
1147
1172
  const i = t.toUpperCase();
1148
- return yt.has(i) ? /* @__PURE__ */ s("span", { style: o.sqlKeyword, children: t }, n) : t.startsWith("$") || t.startsWith(":") || t.startsWith("?") ? /* @__PURE__ */ s("span", { style: o.sqlBindParam, children: t }, n) : /* @__PURE__ */ s("span", { children: t }, n);
1173
+ return Ct.has(i) ? /* @__PURE__ */ a("span", { style: s.sqlKeyword, children: t }, n) : t.startsWith("$") || t.startsWith(":") || t.startsWith("?") ? /* @__PURE__ */ a("span", { style: s.sqlBindParam, children: t }, n) : /* @__PURE__ */ a("span", { children: t }, n);
1149
1174
  });
1150
1175
  }
1151
- function ur(e) {
1176
+ function je(e) {
1152
1177
  return e.flatMap((r) => {
1153
- var b, y, v, g;
1154
- const t = r.latestAttempt, n = t == null ? void 0 : t.executionResult, i = X(
1155
- (b = n == null ? void 0 : n.validation) == null ? void 0 : b.warnings
1156
- ), a = X(
1157
- (y = n == null ? void 0 : n.validation) == null ? void 0 : y.errors
1158
- ), l = hr(
1159
- (v = n == null ? void 0 : n.coverage) == null ? void 0 : v.missingObligations
1160
- ), p = X(
1178
+ var m, v, S, g;
1179
+ const t = r.latestAttempt, n = t == null ? void 0 : t.executionResult, i = De(
1180
+ (m = n == null ? void 0 : n.validation) == null ? void 0 : m.warnings
1181
+ ), o = De(
1182
+ (v = n == null ? void 0 : n.validation) == null ? void 0 : v.errors
1183
+ ), u = xr(
1184
+ (S = n == null ? void 0 : n.coverage) == null ? void 0 : S.missingObligations
1185
+ ), f = De(
1161
1186
  (g = n == null ? void 0 : n.coverage) == null ? void 0 : g.warnings
1162
- ), c = [], u = we(r);
1163
- (t == null ? void 0 : t.status) === "error" && c.push({
1187
+ ), d = [], c = qe(r);
1188
+ (t == null ? void 0 : t.status) === "error" && d.push({
1164
1189
  trace: r,
1165
1190
  tone: "error",
1166
- title: u,
1191
+ title: c,
1167
1192
  message: t.errorMessage || "Query attempt failed."
1168
1193
  });
1169
- for (const h of r.clientWarnings)
1170
- c.push({ trace: r, tone: "warning", title: u, message: h });
1171
- for (const h of i)
1172
- c.push({ trace: r, tone: "warning", title: u, message: h });
1173
- for (const h of a)
1174
- c.push({ trace: r, tone: "warning", title: u, message: h });
1175
- for (const h of l)
1176
- c.push({ trace: r, tone: "warning", title: u, message: h });
1177
- for (const h of p)
1178
- c.push({ trace: r, tone: "warning", title: u, message: h });
1179
- return c;
1194
+ for (const b of r.clientWarnings)
1195
+ d.push({ trace: r, tone: "warning", title: c, message: b });
1196
+ for (const b of i)
1197
+ d.push({ trace: r, tone: "warning", title: c, ...b });
1198
+ for (const b of o)
1199
+ d.push({ trace: r, tone: "error", title: c, ...b });
1200
+ for (const b of u)
1201
+ d.push({ trace: r, tone: "warning", title: c, message: b });
1202
+ for (const b of f)
1203
+ d.push({ trace: r, tone: "warning", title: c, ...b });
1204
+ return d;
1180
1205
  });
1181
1206
  }
1182
- function bt(e, r) {
1183
- return e.filter((t) => fr(t.trace, r)).length;
1207
+ function Rt(e) {
1208
+ return {
1209
+ traceId: e.trace.traceId,
1210
+ queryId: e.trace.queryId,
1211
+ viewId: e.trace.viewId,
1212
+ viewTitle: e.trace.viewTitle,
1213
+ queryLabel: e.trace.queryLabel,
1214
+ severity: e.tone,
1215
+ title: e.title,
1216
+ message: e.message,
1217
+ code: e.code,
1218
+ path: e.path
1219
+ };
1220
+ }
1221
+ function Dt(e, r) {
1222
+ return e.filter((t) => br(t.trace, r)).length;
1184
1223
  }
1185
- function vt(e) {
1186
- const r = ur(e), t = e.filter(
1187
- (a) => {
1188
- var l;
1189
- return ((l = a.latestAttempt) == null ? void 0 : l.status) === "error";
1224
+ function Lt(e) {
1225
+ const r = je(e), t = e.filter(
1226
+ (u) => {
1227
+ var f;
1228
+ return ((f = u.latestAttempt) == null ? void 0 : f.status) === "error";
1190
1229
  }
1191
1230
  ).length, n = e.filter(
1192
- (a) => {
1193
- var l;
1194
- return ((l = a.latestAttempt) == null ? void 0 : l.status) === "loading";
1231
+ (u) => {
1232
+ var f;
1233
+ return ((f = u.latestAttempt) == null ? void 0 : f.status) === "loading";
1195
1234
  }
1196
- ).length, i = r.filter((a) => a.tone === "warning").length;
1235
+ ).length, i = r.filter((u) => u.tone === "error").length, o = r.filter((u) => u.tone === "warning").length;
1197
1236
  return {
1198
1237
  total: e.length,
1199
1238
  failed: t,
1200
1239
  loading: n,
1201
- warningCount: i,
1240
+ errorCount: i,
1241
+ warningCount: o,
1202
1242
  issueCount: r.length,
1203
- severity: t ? "error" : i ? "warning" : n ? "loading" : "ok"
1243
+ severity: t || i ? "error" : o ? "warning" : n ? "loading" : "ok"
1204
1244
  };
1205
1245
  }
1206
- function St(e) {
1246
+ function Ot(e) {
1207
1247
  return [
1208
1248
  `${e.total} ${e.total === 1 ? "trace" : "traces"}`,
1209
1249
  `${e.loading} loading`,
1210
1250
  `${e.failed} failed`,
1251
+ `${e.errorCount} error${e.errorCount === 1 ? "" : "s"}`,
1211
1252
  `${e.warningCount} warning${e.warningCount === 1 ? "" : "s"}`
1212
1253
  ].join(" · ");
1213
1254
  }
1214
- function wt(e, r) {
1255
+ function Bt(e, r) {
1215
1256
  const t = r.trim().toLowerCase();
1216
1257
  return t ? e.filter(
1217
1258
  (n) => [
@@ -1223,36 +1264,36 @@ function wt(e, r) {
1223
1264
  n.sectionTitle,
1224
1265
  n.builder,
1225
1266
  n.queryKind,
1226
- yr(n)
1267
+ qr(n)
1227
1268
  ].filter(Boolean).join(" ").toLowerCase().includes(t)
1228
1269
  ) : e;
1229
1270
  }
1230
- function It(e) {
1231
- const r = e.filter((i) => i.queryKind === "inputOptions"), t = new Set(r.map(Oe));
1271
+ function $t(e) {
1272
+ const r = e.filter((i) => i.queryKind === "inputOptions"), t = new Set(r.map(We));
1232
1273
  return [
1233
- { title: "Views", traces: e.filter((i) => !t.has(Oe(i))) },
1274
+ { title: "Views", traces: e.filter((i) => !t.has(We(i))) },
1234
1275
  { title: "Inputs", traces: r }
1235
1276
  ];
1236
1277
  }
1237
- function cr(e, r) {
1278
+ function vr(e, r) {
1238
1279
  if (!(!(r != null && r.traceId) && !(r != null && r.queryId) && !(r != null && r.viewId)))
1239
1280
  return r.traceId ? e.find((t) => t.traceId === r.traceId) : e.find((t) => !(r.queryId && t.queryId !== r.queryId || r.viewId && t.viewId !== r.viewId));
1240
1281
  }
1241
- function xt(e, r) {
1282
+ function Kt(e, r) {
1242
1283
  if (r.queryId)
1243
- return cr(e, r);
1284
+ return vr(e, r);
1244
1285
  if (!r.viewId)
1245
1286
  return;
1246
1287
  const t = e.filter((n) => n.viewId === r.viewId);
1247
1288
  return t.length === 1 ? t[0] : void 0;
1248
1289
  }
1249
- function fr(e, r) {
1290
+ function br(e, r) {
1250
1291
  return !!(e && r && e.traceId === r.traceId);
1251
1292
  }
1252
- function Oe(e) {
1293
+ function We(e) {
1253
1294
  return e.traceId;
1254
1295
  }
1255
- function qt(e) {
1296
+ function Wt(e) {
1256
1297
  switch (e) {
1257
1298
  case "metric":
1258
1299
  return "metric";
@@ -1267,14 +1308,14 @@ function qt(e) {
1267
1308
  case "sql":
1268
1309
  return "sql";
1269
1310
  default:
1270
- return Ie(e);
1311
+ return xe(e);
1271
1312
  }
1272
1313
  }
1273
- function pr(e) {
1314
+ function Sr(e) {
1274
1315
  const r = e.trim().toLowerCase();
1275
1316
  return r === "metric" || r === "kpi" ? "metric" : r === "records" || r === "table" ? "records" : r === "matrix" || r === "pivot" ? "matrix" : r === "analysis" ? "analysis" : r === "inputs" || r === "input options" ? "inputs" : r === "sql" ? "sql" : "default";
1276
1317
  }
1277
- function gr(e) {
1318
+ function Ir(e) {
1278
1319
  switch (e) {
1279
1320
  case "metric":
1280
1321
  return {
@@ -1306,28 +1347,28 @@ function gr(e) {
1306
1347
  };
1307
1348
  }
1308
1349
  }
1309
- function we(e) {
1350
+ function qe(e) {
1310
1351
  return e.viewTitle || e.queryLabel || e.viewId || e.queryId;
1311
1352
  }
1312
- function Tt(e, r, t) {
1353
+ function _t(e, r, t) {
1313
1354
  const n = [];
1314
1355
  return e.queryLabel && e.queryLabel !== r && n.push(e.queryLabel), e.queryId && e.queryId !== r && e.queryId !== e.queryLabel ? n.push(e.queryId) : e.viewId && e.viewId !== r && e.viewId !== e.queryLabel && n.push(e.viewId), n.push(t), n;
1315
1356
  }
1316
- function mr(e) {
1317
- return Et(e.visualType) || qt(e.queryKind);
1357
+ function wr(e) {
1358
+ return Ft(e.visualType) || Wt(e.queryKind);
1318
1359
  }
1319
- function At(e, r) {
1320
- return r ? e.queryLabel || e.queryId : we(e);
1360
+ function Nt(e, r) {
1361
+ return r ? e.queryLabel || e.queryId : qe(e);
1321
1362
  }
1322
- function Et(e) {
1363
+ function Ft(e) {
1323
1364
  if (e)
1324
1365
  return e.replace(/[_-]+/g, " ").replace(/\b\w/g, (r) => r.toUpperCase());
1325
1366
  }
1326
- function yr(e) {
1327
- const r = e.sourceRefs.map(_);
1367
+ function qr(e) {
1368
+ const r = e.sourceRefs.map(z);
1328
1369
  return r.length ? r.length === 1 ? r[0] : `${r[0]} + ${r.length - 1} more` : "No source";
1329
1370
  }
1330
- function Rt(e) {
1371
+ function zt(e) {
1331
1372
  return e.reduce(
1332
1373
  (r, t) => (t.role === "measure" ? r.measures.push(t) : t.role === "date" ? r.timeFields.push(t) : t.role === "dimension" ? r.dimensions.push(t) : t.role === "id" ? r.identifiers.push(t) : r.other.push(t), r),
1333
1374
  {
@@ -1339,7 +1380,7 @@ function Rt(e) {
1339
1380
  }
1340
1381
  );
1341
1382
  }
1342
- function Ct(e) {
1383
+ function Mt(e) {
1343
1384
  var r, t;
1344
1385
  if (e.queryKind === "records" && ((r = e.projectionFieldRefs) != null && r.length) && e.projectionFieldRefs.every((n) => n.role === "measure") && ((t = e.latestAttempt) == null ? void 0 : t.rowCount) === 1)
1345
1386
  return "KPI query";
@@ -1357,15 +1398,15 @@ function Ct(e) {
1357
1398
  case "sql":
1358
1399
  return "SQL query";
1359
1400
  default:
1360
- return Ie(e.queryKind);
1401
+ return xe(e.queryKind);
1361
1402
  }
1362
1403
  }
1363
- function kt(e) {
1404
+ function Ht(e) {
1364
1405
  return [e.aggregate, e.label || e.name].filter(Boolean).join(" ");
1365
1406
  }
1366
- function Lt(e) {
1367
- var l, p, c;
1368
- const r = e.valuePreview || "redacted", t = ((l = e.fieldRef) == null ? void 0 : l.label) || ((p = e.fieldRef) == null ? void 0 : p.name), n = (c = e.fieldRef) != null && c.source ? _(e.fieldRef.source) : void 0, i = [t ? `on ${t}` : void 0, n].filter(Boolean).join(" · "), a = [
1407
+ function jt(e) {
1408
+ var u, f, d;
1409
+ const r = e.valuePreview || "redacted", t = ((u = e.fieldRef) == null ? void 0 : u.label) || ((f = e.fieldRef) == null ? void 0 : f.name), n = (d = e.fieldRef) != null && d.source ? z(e.fieldRef.source) : void 0, i = [t ? `on ${t}` : void 0, n].filter(Boolean).join(" · "), o = [
1369
1410
  e.inputId,
1370
1411
  e.operator,
1371
1412
  r,
@@ -1375,32 +1416,32 @@ function Lt(e) {
1375
1416
  operator: e.operator,
1376
1417
  value: r,
1377
1418
  binding: i,
1378
- title: a
1419
+ title: o
1379
1420
  };
1380
1421
  }
1381
- function _(e) {
1422
+ function z(e) {
1382
1423
  return e.kind === "semantic" ? e.datasetName || e.datasetId || e.domainId : e.kind === "physical" ? [
1383
1424
  e.schemaName,
1384
1425
  e.tableName
1385
1426
  ].filter(Boolean).join(".") || e.tableName : e.connectionId ? `SQL ${e.connectionId}` : "SQL source";
1386
1427
  }
1387
- function Dt(e) {
1428
+ function Pt(e) {
1388
1429
  if (e.file)
1389
1430
  return e.line && e.column ? `${e.file}:${e.line}:${e.column}` : e.line ? `${e.file}:${e.line}` : e.file;
1390
1431
  }
1391
- function Ot(e) {
1432
+ function Qt(e) {
1392
1433
  return typeof e == "number" ? e.toLocaleString() : "-";
1393
1434
  }
1394
- function Bt(e) {
1435
+ function Vt(e) {
1395
1436
  return typeof e == "number" ? `${Math.round(e)}ms` : "-";
1396
1437
  }
1397
- function $t(e) {
1398
- return Be(e);
1438
+ function Ut(e) {
1439
+ return _e(e);
1399
1440
  }
1400
- function Be(e) {
1441
+ function _e(e) {
1401
1442
  return JSON.stringify(e, null, 2) ?? "undefined";
1402
1443
  }
1403
- function Wt(e) {
1444
+ function Gt(e) {
1404
1445
  switch (e.type) {
1405
1446
  case "query_started":
1406
1447
  return "Started";
@@ -1413,10 +1454,10 @@ function Wt(e) {
1413
1454
  case "input_changed":
1414
1455
  return "Input changed";
1415
1456
  default:
1416
- return Kt(e);
1457
+ return Yt(e);
1417
1458
  }
1418
1459
  }
1419
- function Nt(e) {
1460
+ function Jt(e) {
1420
1461
  return [
1421
1462
  e.at,
1422
1463
  "durationMs" in e && typeof e.durationMs == "number" ? `${Math.round(e.durationMs)}ms` : void 0,
@@ -1425,31 +1466,44 @@ function Nt(e) {
1425
1466
  "errorMessage" in e ? e.errorMessage : void 0
1426
1467
  ].filter(Boolean).join(" - ");
1427
1468
  }
1428
- function Kt(e) {
1469
+ function Yt(e) {
1429
1470
  throw new Error(`Unsupported Semaphor trace event: ${JSON.stringify(e)}`);
1430
1471
  }
1431
- function hr(e) {
1472
+ function xr(e) {
1432
1473
  return Array.isArray(e) ? e.filter((r) => typeof r == "string") : [];
1433
1474
  }
1434
- function X(e) {
1435
- return Array.isArray(e) ? e.map((r) => Ft(r)).filter((r) => !!r) : [];
1475
+ function Re(e) {
1476
+ return Array.isArray(e) ? e.map((r) => Xt(r)).filter((r) => !!r) : [];
1436
1477
  }
1437
- function Ft(e) {
1478
+ function De(e) {
1479
+ return Array.isArray(e) ? e.map((r) => Ar(r)).filter(
1480
+ (r) => !!r
1481
+ ) : [];
1482
+ }
1483
+ function Xt(e) {
1484
+ var r;
1485
+ return (r = Ar(e)) == null ? void 0 : r.message;
1486
+ }
1487
+ function Ar(e) {
1438
1488
  if (typeof e == "string")
1439
- return e;
1489
+ return { message: e };
1440
1490
  if (!e || typeof e != "object" || Array.isArray(e))
1441
1491
  return;
1442
1492
  const r = e, t = typeof r.message == "string" ? r.message : "", n = typeof r.code == "string" ? r.code : "", i = typeof r.path == "string" ? r.path : "";
1443
- return t && n ? i ? `${t} (${n}, ${i})` : `${t} (${n})` : t || n || void 0;
1493
+ return t && n ? {
1494
+ message: i ? `${t} (${n}, ${i})` : `${t} (${n})`,
1495
+ code: n,
1496
+ ...i ? { path: i } : {}
1497
+ } : t ? { message: t } : n ? { message: n, code: n } : void 0;
1444
1498
  }
1445
- function _t(e) {
1499
+ function Zt(e) {
1446
1500
  const r = e == null ? void 0 : e.metadata, t = r && typeof r == "object" && !Array.isArray(r) && "dataAppDebug" in r && r.dataAppDebug && typeof r.dataAppDebug == "object" && !Array.isArray(r.dataAppDebug) ? r.dataAppDebug : void 0;
1447
1501
  return {
1448
1502
  compiledSql: typeof (t == null ? void 0 : t.compiledSql) == "string" ? t.compiledSql : void 0,
1449
1503
  queryHash: typeof (t == null ? void 0 : t.queryHash) == "string" ? t.queryHash : void 0
1450
1504
  };
1451
1505
  }
1452
- function zt(e) {
1506
+ function en(e) {
1453
1507
  return e === "relative" ? {
1454
1508
  position: "relative",
1455
1509
  top: "auto",
@@ -1463,7 +1517,7 @@ function zt(e) {
1463
1517
  left: e.endsWith("left") ? 20 : "auto"
1464
1518
  };
1465
1519
  }
1466
- function Mt(e) {
1520
+ function rn(e) {
1467
1521
  return e === "error" ? {
1468
1522
  borderColor: "var(--sd-error-border)",
1469
1523
  background: "var(--sd-error-bg)",
@@ -1482,7 +1536,7 @@ function Mt(e) {
1482
1536
  color: "var(--sd-success-fg)"
1483
1537
  };
1484
1538
  }
1485
- function Ht(e) {
1539
+ function tn(e) {
1486
1540
  return e === "right" ? {
1487
1541
  top: 16,
1488
1542
  right: 16,
@@ -1501,23 +1555,23 @@ function Ht(e) {
1501
1555
  borderRadius: 6
1502
1556
  };
1503
1557
  }
1504
- function jt(e) {
1558
+ function nn(e) {
1505
1559
  return e === "right" ? {
1506
1560
  gridTemplateColumns: "minmax(210px, 280px) minmax(0, 1fr)"
1507
1561
  } : {
1508
1562
  gridTemplateColumns: "minmax(260px, 340px) minmax(0, 1fr)"
1509
1563
  };
1510
1564
  }
1511
- function Pt(e) {
1565
+ function on(e) {
1512
1566
  return {
1513
1567
  borderRight: "1px solid var(--sd-border)",
1514
1568
  borderBottom: 0
1515
1569
  };
1516
1570
  }
1517
- function br(e) {
1571
+ function Er(e) {
1518
1572
  return e === "error" ? { background: "var(--sd-error-dot)" } : e === "success" ? { background: "var(--sd-success-dot)" } : e === "loading" ? { background: "var(--sd-loading-dot)" } : { background: "var(--sd-idle-dot)" };
1519
1573
  }
1520
- function Vt(e) {
1574
+ function sn(e) {
1521
1575
  return e === "error" ? {
1522
1576
  borderColor: "var(--sd-error-border)",
1523
1577
  color: "var(--sd-error-fg)"
@@ -1532,8 +1586,8 @@ function Vt(e) {
1532
1586
  color: "var(--sd-fg-muted)"
1533
1587
  };
1534
1588
  }
1535
- const Ue = "semaphor-devtools-stylesheet", K = "semaphor-devtools", Qt = `
1536
- .${K} {
1589
+ const tr = "semaphor-devtools-stylesheet", N = "semaphor-devtools", an = `
1590
+ .${N} {
1537
1591
  --sd-bg: #ffffff;
1538
1592
  --sd-bg-muted: #fafafa;
1539
1593
  --sd-bg-raised: #ffffff;
@@ -1582,7 +1636,7 @@ const Ue = "semaphor-devtools-stylesheet", K = "semaphor-devtools", Qt = `
1582
1636
  }
1583
1637
 
1584
1638
  @media (prefers-color-scheme: dark) {
1585
- .${K} {
1639
+ .${N} {
1586
1640
  --sd-bg: #09090b;
1587
1641
  --sd-bg-muted: #18181b;
1588
1642
  --sd-bg-raised: #18181b;
@@ -1626,7 +1680,7 @@ const Ue = "semaphor-devtools-stylesheet", K = "semaphor-devtools", Qt = `
1626
1680
  }
1627
1681
  }
1628
1682
 
1629
- .${K}-source {
1683
+ .${N}-source {
1630
1684
  display: -webkit-box;
1631
1685
  -webkit-line-clamp: 2;
1632
1686
  -webkit-box-orient: vertical;
@@ -1634,19 +1688,19 @@ const Ue = "semaphor-devtools-stylesheet", K = "semaphor-devtools", Qt = `
1634
1688
  word-break: break-all;
1635
1689
  }
1636
1690
  `;
1637
- function vr() {
1638
- if (typeof document > "u" || document.getElementById(Ue))
1691
+ function Tr() {
1692
+ if (typeof document > "u" || document.getElementById(tr))
1639
1693
  return;
1640
1694
  const e = document.createElement("style");
1641
- e.id = Ue, e.textContent = Qt, document.head.appendChild(e);
1695
+ e.id = tr, e.textContent = an, document.head.appendChild(e);
1642
1696
  }
1643
- const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', N = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", ge = {
1697
+ const me = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', _ = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", ye = {
1644
1698
  color: "var(--sd-fg-muted)",
1645
1699
  fontSize: 10,
1646
1700
  fontWeight: 600,
1647
1701
  textTransform: "uppercase",
1648
1702
  letterSpacing: "0.08em"
1649
- }, o = {
1703
+ }, s = {
1650
1704
  launcher: {
1651
1705
  position: "fixed",
1652
1706
  bottom: 20,
@@ -1661,7 +1715,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1661
1715
  borderStyle: "solid",
1662
1716
  borderRadius: 6,
1663
1717
  boxShadow: "var(--sd-shadow)",
1664
- font: `600 12px/1.2 ${pe}`,
1718
+ font: `600 12px/1.2 ${me}`,
1665
1719
  cursor: "pointer"
1666
1720
  },
1667
1721
  launcherText: {
@@ -1706,7 +1760,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1706
1760
  background: "var(--sd-bg)",
1707
1761
  color: "var(--sd-fg)",
1708
1762
  boxShadow: "var(--sd-shadow)",
1709
- font: `13px/1.4 ${pe}`
1763
+ font: `13px/1.4 ${me}`
1710
1764
  },
1711
1765
  panelFullscreen: {
1712
1766
  top: 0,
@@ -1775,7 +1829,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1775
1829
  outline: 0,
1776
1830
  background: "transparent",
1777
1831
  color: "var(--sd-fg)",
1778
- font: `12px/1.4 ${pe}`
1832
+ font: `12px/1.4 ${me}`
1779
1833
  },
1780
1834
  issueSummary: {
1781
1835
  margin: "0 10px 10px",
@@ -1787,17 +1841,33 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1787
1841
  color: "var(--sd-warning-fg)",
1788
1842
  overflow: "hidden"
1789
1843
  },
1790
- issueSummaryHeader: {
1844
+ issueSummaryToggle: {
1791
1845
  display: "flex",
1792
1846
  alignItems: "center",
1793
1847
  justifyContent: "space-between",
1794
1848
  gap: 8,
1849
+ width: "100%",
1795
1850
  padding: "7px 9px 5px",
1796
- ...ge
1851
+ border: 0,
1852
+ background: "transparent",
1853
+ color: "inherit",
1854
+ cursor: "pointer",
1855
+ ...ye
1856
+ },
1857
+ issueSummaryHeaderLabel: {
1858
+ display: "inline-flex",
1859
+ alignItems: "center",
1860
+ gap: 4,
1861
+ minWidth: 0
1797
1862
  },
1798
1863
  issueSummaryCount: {
1799
1864
  fontVariantNumeric: "tabular-nums"
1800
1865
  },
1866
+ issueSummaryCollapsed: {
1867
+ padding: "0 9px 8px 26px",
1868
+ color: "var(--sd-fg-muted)",
1869
+ fontSize: 11
1870
+ },
1801
1871
  issueSummaryList: {
1802
1872
  display: "grid",
1803
1873
  gap: 1,
@@ -1889,7 +1959,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1889
1959
  alignItems: "center",
1890
1960
  justifyContent: "space-between",
1891
1961
  padding: "4px 6px 3px",
1892
- ...ge
1962
+ ...ye
1893
1963
  },
1894
1964
  queryGroupCount: {
1895
1965
  color: "var(--sd-fg-subtle)",
@@ -1952,7 +2022,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1952
2022
  borderRadius: 3,
1953
2023
  background: "var(--sd-bg-accent)",
1954
2024
  color: "var(--sd-fg-muted)",
1955
- fontFamily: N,
2025
+ fontFamily: _,
1956
2026
  fontSize: 9,
1957
2027
  fontWeight: 600,
1958
2028
  textTransform: "uppercase",
@@ -2030,7 +2100,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2030
2100
  borderRadius: 3,
2031
2101
  background: "var(--sd-bg-accent)",
2032
2102
  color: "var(--sd-fg-muted)",
2033
- fontFamily: N,
2103
+ fontFamily: _,
2034
2104
  fontSize: 10,
2035
2105
  fontWeight: 600,
2036
2106
  textTransform: "uppercase",
@@ -2071,7 +2141,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2071
2141
  color: "var(--sd-fg)"
2072
2142
  },
2073
2143
  sourcePillLabel: {
2074
- fontFamily: N,
2144
+ fontFamily: _,
2075
2145
  fontSize: 11,
2076
2146
  color: "var(--sd-fg)"
2077
2147
  },
@@ -2083,7 +2153,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2083
2153
  borderRadius: 3,
2084
2154
  background: "var(--sd-bg-accent)",
2085
2155
  color: "var(--sd-fg-subtle)",
2086
- fontFamily: N,
2156
+ fontFamily: _,
2087
2157
  fontSize: 9,
2088
2158
  textTransform: "uppercase",
2089
2159
  letterSpacing: "0.06em"
@@ -2115,7 +2185,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2115
2185
  borderWidth: 1,
2116
2186
  borderStyle: "solid",
2117
2187
  borderRadius: 4,
2118
- fontFamily: N,
2188
+ fontFamily: _,
2119
2189
  fontSize: 11,
2120
2190
  fontWeight: 700,
2121
2191
  lineHeight: 1
@@ -2128,7 +2198,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2128
2198
  borderRadius: 3,
2129
2199
  background: "var(--sd-bg-accent)",
2130
2200
  color: "var(--sd-fg)",
2131
- fontFamily: N,
2201
+ fontFamily: _,
2132
2202
  fontSize: 10,
2133
2203
  fontWeight: 600,
2134
2204
  letterSpacing: "0.04em"
@@ -2145,7 +2215,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2145
2215
  },
2146
2216
  fieldChipMeta: {
2147
2217
  flex: "0 0 auto",
2148
- fontFamily: N,
2218
+ fontFamily: _,
2149
2219
  fontSize: 10,
2150
2220
  color: "var(--sd-fg-subtle)"
2151
2221
  },
@@ -2165,7 +2235,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2165
2235
  },
2166
2236
  disclosureSummary: {
2167
2237
  cursor: "pointer",
2168
- ...ge
2238
+ ...ye
2169
2239
  },
2170
2240
  disclosureBody: {
2171
2241
  marginTop: 8
@@ -2321,7 +2391,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2321
2391
  textOverflow: "ellipsis",
2322
2392
  whiteSpace: "nowrap",
2323
2393
  color: "var(--sd-fg)",
2324
- fontFamily: N,
2394
+ fontFamily: _,
2325
2395
  fontSize: 11,
2326
2396
  fontWeight: 600
2327
2397
  },
@@ -2334,7 +2404,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2334
2404
  borderRadius: 3,
2335
2405
  background: "var(--sd-bg-accent)",
2336
2406
  color: "var(--sd-fg-muted)",
2337
- fontFamily: N,
2407
+ fontFamily: _,
2338
2408
  fontSize: 10,
2339
2409
  textTransform: "uppercase",
2340
2410
  letterSpacing: "0.06em"
@@ -2393,7 +2463,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2393
2463
  gap: 5
2394
2464
  },
2395
2465
  codeBlockLabel: {
2396
- ...ge
2466
+ ...ye
2397
2467
  },
2398
2468
  codeBlock: {
2399
2469
  maxHeight: 260,
@@ -2404,7 +2474,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2404
2474
  borderRadius: 5,
2405
2475
  background: "var(--sd-bg-muted)",
2406
2476
  color: "var(--sd-fg)",
2407
- fontFamily: N,
2477
+ fontFamily: _,
2408
2478
  fontSize: 11,
2409
2479
  lineHeight: 1.5,
2410
2480
  whiteSpace: "pre-wrap"
@@ -2426,7 +2496,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2426
2496
  borderStyle: "solid",
2427
2497
  borderRadius: 5,
2428
2498
  background: "var(--sd-bg)",
2429
- font: `600 11px/1 ${pe}`,
2499
+ font: `600 11px/1 ${me}`,
2430
2500
  cursor: "pointer"
2431
2501
  },
2432
2502
  inspectButtonText: {
@@ -2435,7 +2505,7 @@ const pe = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2435
2505
  whiteSpace: "nowrap"
2436
2506
  }
2437
2507
  };
2438
- function Sr(e) {
2508
+ function Cr(e) {
2439
2509
  return {
2440
2510
  ...e,
2441
2511
  order: [],
@@ -2443,29 +2513,29 @@ function Sr(e) {
2443
2513
  sequence: 0
2444
2514
  };
2445
2515
  }
2446
- function Ut(e, r) {
2516
+ function dn(e, r) {
2447
2517
  if (r.type === "config")
2448
2518
  return r.config.enabled ? {
2449
2519
  ...e,
2450
2520
  ...r.config
2451
- } : Sr(r.config);
2521
+ } : Cr(r.config);
2452
2522
  if (!e.enabled)
2453
2523
  return e;
2454
2524
  switch (r.type) {
2455
2525
  case "register":
2456
- return Xt(Gt(e, r.descriptor));
2526
+ return fn(ln(e, r.descriptor));
2457
2527
  case "unregister":
2458
- return Jt(e, r.traceKey);
2528
+ return un(e, r.traceKey);
2459
2529
  case "event":
2460
- return Yt(e, r);
2530
+ return cn(e, r);
2461
2531
  default:
2462
2532
  return e;
2463
2533
  }
2464
2534
  }
2465
- function Gt(e, r) {
2466
- const t = e.entries[r.traceKey], n = t ? e.sequence : e.sequence + 1, i = Fe(), a = {
2467
- ...t || Zt(r),
2468
- ...wr(r),
2535
+ function ln(e, r) {
2536
+ const t = e.entries[r.traceKey], n = t ? e.sequence : e.sequence + 1, i = Qe(), o = {
2537
+ ...t || pn(r),
2538
+ ...kr(r),
2469
2539
  traceKey: r.traceKey,
2470
2540
  latestAttempt: (t == null ? void 0 : t.latestAttempt) || { status: "idle" },
2471
2541
  recentEvents: (t == null ? void 0 : t.recentEvents) || [],
@@ -2479,11 +2549,11 @@ function Gt(e, r) {
2479
2549
  order: t ? e.order : [...e.order, r.traceKey],
2480
2550
  entries: {
2481
2551
  ...e.entries,
2482
- [r.traceKey]: a
2552
+ [r.traceKey]: o
2483
2553
  }
2484
2554
  };
2485
2555
  }
2486
- function Jt(e, r) {
2556
+ function un(e, r) {
2487
2557
  const t = e.entries[r];
2488
2558
  return t ? {
2489
2559
  ...e,
@@ -2496,11 +2566,11 @@ function Jt(e, r) {
2496
2566
  }
2497
2567
  } : e;
2498
2568
  }
2499
- function Yt(e, r) {
2569
+ function cn(e, r) {
2500
2570
  const t = e.entries[r.traceKey];
2501
2571
  if (!t)
2502
2572
  return e;
2503
- const n = Fe(), i = [
2573
+ const n = Qe(), i = [
2504
2574
  ...t.recentEvents,
2505
2575
  r.event
2506
2576
  ].slice(-e.maxEventsPerQuery);
@@ -2520,10 +2590,10 @@ function Yt(e, r) {
2520
2590
  }
2521
2591
  };
2522
2592
  }
2523
- function Xt(e) {
2593
+ function fn(e) {
2524
2594
  if (e.order.length <= e.maxQueries)
2525
2595
  return e;
2526
- const r = e.order.map((i) => e.entries[i]).filter((i) => !!i).sort((i, a) => i.mounted !== a.mounted ? i.mounted ? 1 : -1 : i.lastEventAt - a.lastEventAt), t = e.order.length - e.maxQueries, n = new Set(
2596
+ const r = e.order.map((i) => e.entries[i]).filter((i) => !!i).sort((i, o) => i.mounted !== o.mounted ? i.mounted ? 1 : -1 : i.lastEventAt - o.lastEventAt), t = e.order.length - e.maxQueries, n = new Set(
2527
2597
  r.slice(0, t).map((i) => i.traceKey)
2528
2598
  );
2529
2599
  return n.size ? {
@@ -2534,10 +2604,10 @@ function Xt(e) {
2534
2604
  )
2535
2605
  } : e;
2536
2606
  }
2537
- function Zt(e) {
2538
- const r = Fe();
2607
+ function pn(e) {
2608
+ const r = Qe();
2539
2609
  return {
2540
- ...wr(e),
2610
+ ...kr(e),
2541
2611
  traceKey: e.traceKey,
2542
2612
  latestAttempt: { status: "idle" },
2543
2613
  recentEvents: [],
@@ -2546,14 +2616,14 @@ function Zt(e) {
2546
2616
  lastEventAt: r
2547
2617
  };
2548
2618
  }
2549
- function wr(e) {
2619
+ function kr(e) {
2550
2620
  var n;
2551
- const r = fn(e.spec), t = pn(
2621
+ const r = An(e.spec), t = En(
2552
2622
  e.spec,
2553
2623
  e.activeInputs
2554
2624
  );
2555
2625
  return {
2556
- traceId: Tr(e.traceKey),
2626
+ traceId: Lr(e.traceKey),
2557
2627
  viewId: e.viewId,
2558
2628
  viewTitle: e.viewTitle,
2559
2629
  visualType: e.visualType,
@@ -2562,92 +2632,98 @@ function wr(e) {
2562
2632
  queryLabel: e.queryLabel,
2563
2633
  queryKind: e.queryKind,
2564
2634
  builder: e.builder,
2565
- sourceRefs: cn(e.intent),
2635
+ sourceRefs: xn(e.intent),
2566
2636
  sourceHints: (n = e.sourceHints) != null && n.length ? e.sourceHints : void 0,
2567
2637
  projectionFieldRefs: r,
2568
2638
  inputFieldRefs: t,
2569
- fieldRefs: gn(e.intent),
2639
+ fieldRefs: Tn(e.intent),
2570
2640
  inputsApplied: (e.activeInputs || []).map((i) => ({
2571
2641
  inputId: i.inputId,
2572
2642
  fieldRef: i.field,
2573
2643
  operator: i.operator,
2574
- valuePreview: ln(i)
2644
+ valuePreview: wn(i)
2575
2645
  })),
2576
2646
  recentEvents: [],
2577
2647
  clientWarnings: e.clientWarnings
2578
2648
  };
2579
2649
  }
2580
- function he(e) {
2650
+ function be(e) {
2581
2651
  const {
2582
2652
  traceKey: r,
2583
2653
  mounted: t,
2584
2654
  registeredAt: n,
2585
2655
  lastEventAt: i,
2586
- ...a
2656
+ ...o
2587
2657
  } = e;
2588
- return a;
2658
+ return o;
2589
2659
  }
2590
- function be(e) {
2591
- return e.enabled ? {
2660
+ function le(e) {
2661
+ if (!e.enabled)
2662
+ return mr;
2663
+ const r = e.order.map((n) => e.entries[n]).filter((n) => !!n).map(be), t = je(r).map(Rt);
2664
+ return {
2592
2665
  enabled: !0,
2593
- queries: e.order.map((t) => e.entries[t]).filter((t) => !!t).map(he),
2594
- getQuery: (t) => {
2595
- const n = Object.values(e.entries).find(
2596
- (i) => i.queryId === t
2666
+ queries: r,
2667
+ issues: t,
2668
+ getQuery: (n) => {
2669
+ const i = Object.values(e.entries).find(
2670
+ (o) => o.queryId === n
2597
2671
  );
2598
- return n ? he(n) : void 0;
2672
+ return i ? be(i) : void 0;
2599
2673
  },
2600
- getQueries: (t) => Object.values(e.entries).filter((n) => n.queryId === t).map(he)
2601
- } : ar;
2674
+ getQueries: (n) => Object.values(e.entries).filter((i) => i.queryId === n).map(be)
2675
+ };
2602
2676
  }
2603
- function en(e) {
2677
+ function gn(e) {
2604
2678
  return {
2605
- snapshot: () => rn(be(e())),
2606
- getQuery: (r) => Ge(be(e()).getQuery(r)),
2607
- getQueries: (r) => be(e()).getQueries(r).map((t) => Ge(t)).filter((t) => !!t)
2679
+ snapshot: () => mn(le(e())),
2680
+ getQuery: (r) => nr(le(e()).getQuery(r)),
2681
+ getQueries: (r) => le(e()).getQueries(r).map((t) => nr(t)).filter((t) => !!t),
2682
+ getIssues: () => le(e()).issues
2608
2683
  };
2609
2684
  }
2610
- function rn(e) {
2685
+ function mn(e) {
2611
2686
  if (!e.enabled)
2612
2687
  return e;
2613
- const r = e.queries.map(Ir);
2688
+ const r = e.queries.map(Rr);
2614
2689
  return {
2615
2690
  enabled: e.enabled,
2616
2691
  queries: r,
2692
+ issues: e.issues,
2617
2693
  getQuery: (t) => r.find((n) => n.queryId === t),
2618
2694
  getQueries: (t) => r.filter((n) => n.queryId === t)
2619
2695
  };
2620
2696
  }
2621
- function Ge(e) {
2622
- return e ? Ir(e) : void 0;
2697
+ function nr(e) {
2698
+ return e ? Rr(e) : void 0;
2623
2699
  }
2624
- function Ir(e) {
2700
+ function Rr(e) {
2625
2701
  var r;
2626
2702
  return (r = e == null ? void 0 : e.latestAttempt) != null && r.executionResult ? {
2627
2703
  ...e,
2628
2704
  latestAttempt: {
2629
2705
  ...e.latestAttempt,
2630
- executionResult: tn(
2706
+ executionResult: yn(
2631
2707
  e.latestAttempt.executionResult
2632
2708
  )
2633
2709
  }
2634
2710
  } : e;
2635
2711
  }
2636
- function tn(e) {
2712
+ function yn(e) {
2637
2713
  const {
2638
2714
  compiledQuery: r,
2639
2715
  intent: t,
2640
2716
  result: n,
2641
2717
  ...i
2642
- } = e, a = nn(
2718
+ } = e, o = hn(
2643
2719
  i.metadata
2644
2720
  );
2645
2721
  return {
2646
2722
  ...i,
2647
- ...a ? { metadata: a } : {}
2723
+ ...o ? { metadata: o } : {}
2648
2724
  };
2649
2725
  }
2650
- function nn(e) {
2726
+ function hn(e) {
2651
2727
  if (!e || typeof e != "object" || Array.isArray(e))
2652
2728
  return e;
2653
2729
  const r = e.dataAppDebug;
@@ -2659,64 +2735,64 @@ function nn(e) {
2659
2735
  dataAppDebug: n
2660
2736
  };
2661
2737
  }
2662
- function on(e) {
2738
+ function vn(e) {
2663
2739
  return e === void 0 || e === !1 ? {
2664
2740
  enabled: !1,
2665
2741
  exposeWindowBridge: !1,
2666
- maxEventsPerQuery: qe,
2667
- maxQueries: Te
2742
+ maxEventsPerQuery: Te,
2743
+ maxQueries: Ce
2668
2744
  } : e === !0 ? {
2669
2745
  enabled: !0,
2670
2746
  exposeWindowBridge: !1,
2671
- maxEventsPerQuery: qe,
2672
- maxQueries: Te
2747
+ maxEventsPerQuery: Te,
2748
+ maxQueries: Ce
2673
2749
  } : {
2674
2750
  enabled: e.enabled !== !1,
2675
2751
  exposeWindowBridge: e.exposeWindowBridge === !0,
2676
- maxEventsPerQuery: Ye(
2752
+ maxEventsPerQuery: or(
2677
2753
  e.maxEventsPerQuery,
2678
- qe,
2679
- Gr
2754
+ Te,
2755
+ at
2680
2756
  ),
2681
- maxQueries: Ye(
2757
+ maxQueries: or(
2682
2758
  e.maxQueries,
2683
- Te,
2684
- Jr
2759
+ Ce,
2760
+ dt
2685
2761
  )
2686
2762
  };
2687
2763
  }
2688
- function sn(e) {
2764
+ function bn(e) {
2689
2765
  const t = [
2690
2766
  e == null ? void 0 : e.sourceHint,
2691
2767
  ...(e == null ? void 0 : e.sourceHints) || []
2692
2768
  ].filter((n) => !!n).map((n) => ({
2693
- file: me(n.file),
2694
- line: Je(n.line),
2695
- column: Je(n.column),
2696
- exportName: me(n.exportName),
2697
- component: me(n.component),
2698
- note: me(n.note)
2769
+ file: he(n.file),
2770
+ line: ir(n.line),
2771
+ column: ir(n.column),
2772
+ exportName: he(n.exportName),
2773
+ component: he(n.component),
2774
+ note: he(n.note)
2699
2775
  })).filter(
2700
2776
  (n) => !!(n.file || n.line || n.column || n.exportName || n.component || n.note)
2701
2777
  );
2702
2778
  return t.length ? t : void 0;
2703
2779
  }
2704
- function me(e) {
2780
+ function he(e) {
2705
2781
  if (typeof e != "string")
2706
2782
  return;
2707
2783
  const r = e.trim();
2708
2784
  return r || void 0;
2709
2785
  }
2710
- function Je(e) {
2786
+ function ir(e) {
2711
2787
  return typeof e == "number" && Number.isInteger(e) && e > 0 ? e : void 0;
2712
2788
  }
2713
- function Ye(e, r, t) {
2789
+ function or(e, r, t) {
2714
2790
  return e === void 0 || !Number.isFinite(e) || !Number.isInteger(e) || e <= 0 ? r : Math.min(e, t);
2715
2791
  }
2716
- function an(e) {
2792
+ function Sn(e) {
2717
2793
  return typeof e.id == "string" && e.id.trim() ? e.id : void 0;
2718
2794
  }
2719
- function dn(e) {
2795
+ function In(e) {
2720
2796
  switch (e) {
2721
2797
  case "metric":
2722
2798
  return "semaphor.metric";
@@ -2731,14 +2807,14 @@ function dn(e) {
2731
2807
  case "sql":
2732
2808
  return "semaphor.sql";
2733
2809
  default:
2734
- return Ie(e);
2810
+ return xe(e);
2735
2811
  }
2736
2812
  }
2737
- function Ie(e) {
2813
+ function xe(e) {
2738
2814
  throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`);
2739
2815
  }
2740
- function ln(e) {
2741
- if (un(e))
2816
+ function wn(e) {
2817
+ if (qn(e))
2742
2818
  return;
2743
2819
  const r = e.value;
2744
2820
  if (r !== void 0) {
@@ -2748,17 +2824,17 @@ function ln(e) {
2748
2824
  ).map((n) => String(n));
2749
2825
  if (t.length === r.length && t.length > 0) {
2750
2826
  const n = t.slice(0, 3).join(", "), i = t.length > 3 ? `, +${t.length - 3} more` : "";
2751
- return Xe(`${n}${i}`);
2827
+ return sr(`${n}${i}`);
2752
2828
  }
2753
2829
  return `${r.length} selected`;
2754
2830
  }
2755
- return typeof r == "number" || typeof r == "boolean" ? String(r) : typeof r == "string" ? Xe(r) : r && typeof r == "object" ? `object(${Object.keys(r).slice(0, 5).join(",")})` : String(r);
2831
+ return typeof r == "number" || typeof r == "boolean" ? String(r) : typeof r == "string" ? sr(r) : r && typeof r == "object" ? `object(${Object.keys(r).slice(0, 5).join(",")})` : String(r);
2756
2832
  }
2757
2833
  }
2758
- function Xe(e) {
2834
+ function sr(e) {
2759
2835
  return e.length > 80 ? `${e.slice(0, 77)}...` : e;
2760
2836
  }
2761
- function un(e) {
2837
+ function qn(e) {
2762
2838
  var t;
2763
2839
  const r = [
2764
2840
  e.inputId,
@@ -2769,177 +2845,180 @@ function un(e) {
2769
2845
  (n) => r.includes(n)
2770
2846
  );
2771
2847
  }
2772
- function cn(e) {
2773
- const r = /* @__PURE__ */ new Map();
2774
- return ve(e, (t) => {
2775
- mn(t) && r.set(qr(t), t);
2776
- }), [...r.values()];
2848
+ function xn(e) {
2849
+ const r = [];
2850
+ return Ie(e, (t) => {
2851
+ Cn(t) && r.push(t);
2852
+ }), Yr(r);
2777
2853
  }
2778
- function fn(e) {
2854
+ function An(e) {
2779
2855
  switch (e.queryKind) {
2780
2856
  case "metric":
2781
2857
  case "analysis":
2782
- return Y([
2858
+ return X([
2783
2859
  ...e.measures || [],
2784
2860
  e.primaryMeasure,
2785
2861
  e.dateField,
2786
2862
  ...e.dimensions || []
2787
2863
  ]);
2788
2864
  case "records":
2789
- return Y(e.fields || []);
2865
+ return X(e.fields || []);
2790
2866
  case "inputOptions":
2791
- return Y([
2867
+ return X([
2792
2868
  e.labelField,
2793
2869
  e.valueField,
2794
2870
  e.searchField,
2795
2871
  ...e.disambiguationFields || []
2796
2872
  ]);
2797
2873
  case "sql":
2798
- return Y(e.fields || []);
2874
+ return X(e.fields || []);
2799
2875
  case "matrix":
2800
- return Y([
2801
- ...(e.rows || []).map(Ee),
2802
- ...(e.columns || []).map(Ee),
2803
- ...(e.values || []).map(Ee)
2876
+ return X([
2877
+ ...(e.rows || []).map(Le),
2878
+ ...(e.columns || []).map(Le),
2879
+ ...(e.values || []).map(Le)
2804
2880
  ]);
2805
2881
  default:
2806
- return Ie(e);
2882
+ return xe(e);
2807
2883
  }
2808
2884
  }
2809
- function pn(e, r) {
2885
+ function En(e, r) {
2810
2886
  const t = [
2811
- ...(e.inputs || []).map(xr),
2887
+ ...(e.inputs || []).map(Dr),
2812
2888
  ...(r || []).map((n) => n.field)
2813
2889
  ];
2814
- return Y(t);
2890
+ return X(t);
2815
2891
  }
2816
- function Y(e) {
2892
+ function X(e) {
2817
2893
  const r = /* @__PURE__ */ new Map();
2818
2894
  return e.forEach((t) => {
2819
- t && ue(t) && r.set(Ke(t), t);
2895
+ t && fe(t) && r.set(Pe(t), t);
2820
2896
  }), [...r.values()];
2821
2897
  }
2822
- function xr(e) {
2898
+ function Dr(e) {
2823
2899
  if (!e || typeof e != "object")
2824
2900
  return;
2825
2901
  const r = e.toAnalyticsInput;
2826
2902
  if (typeof r == "function") {
2827
2903
  const n = r.call(e);
2828
- return xr(n);
2904
+ return Dr(n);
2829
2905
  }
2830
2906
  const t = e.field;
2831
- return ue(t) ? t : void 0;
2907
+ return fe(t) ? t : void 0;
2832
2908
  }
2833
- function Ee(e) {
2834
- if (ue(e))
2909
+ function Le(e) {
2910
+ if (fe(e))
2835
2911
  return e;
2836
2912
  if (!e || typeof e != "object")
2837
2913
  return;
2838
2914
  const r = e.field;
2839
- return ue(r) ? r : void 0;
2915
+ return fe(r) ? r : void 0;
2840
2916
  }
2841
- function gn(e) {
2917
+ function Tn(e) {
2842
2918
  const r = /* @__PURE__ */ new Map();
2843
- return ve(e, (t) => {
2844
- ue(t) && r.set(Ke(t), t);
2919
+ return Ie(e, (t) => {
2920
+ fe(t) && r.set(Pe(t), t);
2845
2921
  }), [...r.values()];
2846
2922
  }
2847
- function ve(e, r) {
2923
+ function Ie(e, r) {
2848
2924
  if (!(!e || typeof e != "object")) {
2849
2925
  if (r(e), Array.isArray(e)) {
2850
- e.forEach((t) => ve(t, r));
2926
+ e.forEach((t) => Ie(t, r));
2851
2927
  return;
2852
2928
  }
2853
2929
  Object.values(e).forEach(
2854
- (t) => ve(t, r)
2930
+ (t) => Ie(t, r)
2855
2931
  );
2856
2932
  }
2857
2933
  }
2858
- function mn(e) {
2934
+ function Cn(e) {
2859
2935
  if (!e || typeof e != "object")
2860
2936
  return !1;
2861
2937
  const r = e;
2862
2938
  return r.kind === "semantic" ? typeof r.domainId == "string" && typeof r.datasetName == "string" : r.kind === "physical" ? typeof r.connectionId == "string" && typeof r.tableName == "string" : r.kind === "sql" ? typeof r.connectionId == "string" : !1;
2863
2939
  }
2864
- function ue(e) {
2940
+ function fe(e) {
2865
2941
  if (!e || typeof e != "object")
2866
2942
  return !1;
2867
2943
  const r = e;
2868
2944
  return typeof r.name == "string" && (r.source !== void 0 || r.role !== void 0 || r.dataType !== void 0 || r.aggregate !== void 0);
2869
2945
  }
2870
- function qr(e) {
2871
- return e.kind === "semantic" ? [
2872
- e.kind,
2873
- e.domainId,
2874
- e.datasetId || e.datasetName
2875
- ].join(":") : e.kind === "physical" ? [
2876
- e.kind,
2877
- e.connectionId,
2878
- e.databaseName,
2879
- e.schemaName,
2880
- e.tableName
2881
- ].join(":") : [e.kind, e.connectionId].join(":");
2882
- }
2883
- function Ke(e) {
2946
+ function Pe(e) {
2884
2947
  return [
2885
2948
  e.name,
2886
2949
  e.role,
2887
2950
  e.aggregate,
2888
- e.source ? qr(e.source) : ""
2951
+ e.source ? Jr(e.source) : ""
2889
2952
  ].join(":");
2890
2953
  }
2891
- function yn(e) {
2954
+ function kn(e) {
2892
2955
  const r = e;
2893
2956
  return typeof (r == null ? void 0 : r.rowCount) == "number" ? r.rowCount : Array.isArray(r == null ? void 0 : r.records) ? r.records.length : void 0;
2894
2957
  }
2895
- function hn(e) {
2958
+ function Rn(e) {
2896
2959
  const r = e;
2897
2960
  return Array.isArray(r == null ? void 0 : r.columns) ? r.columns.length : void 0;
2898
2961
  }
2899
- function Ze(e) {
2962
+ function ar(e) {
2900
2963
  const r = e;
2901
2964
  return r == null ? void 0 : r.executionResult;
2902
2965
  }
2903
- function er(e) {
2966
+ function dr(e) {
2904
2967
  const r = e;
2905
2968
  return typeof (r == null ? void 0 : r.requestId) == "string" ? r.requestId : void 0;
2906
2969
  }
2907
- function Tr(e) {
2970
+ function Lr(e) {
2908
2971
  let r = 2166136261;
2909
2972
  for (let t = 0; t < e.length; t += 1)
2910
2973
  r ^= e.charCodeAt(t), r = Math.imul(r, 16777619);
2911
2974
  return (r >>> 0).toString(36);
2912
2975
  }
2913
- function ye() {
2976
+ function ve() {
2914
2977
  return (/* @__PURE__ */ new Date()).toISOString();
2915
2978
  }
2916
- function Fe() {
2979
+ function Qe() {
2917
2980
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
2918
2981
  }
2919
- const bn = [
2982
+ const Dn = [
2983
+ "primary",
2984
+ "comparisons",
2985
+ "contributors",
2986
+ "segments",
2987
+ "periodChanges",
2920
2988
  "records",
2921
2989
  "changes",
2922
2990
  "drivers",
2991
+ "absoluteDeltaDrivers",
2923
2992
  "largestNegativeChanges",
2924
2993
  "largestPositiveChanges",
2925
2994
  "largestNegativeDrivers",
2926
2995
  "largestPositiveDrivers"
2927
- ], vn = [
2996
+ ], Ln = [
2997
+ "primary",
2928
2998
  "records",
2999
+ "periodChanges",
2929
3000
  "changes",
3001
+ "comparisons",
3002
+ "contributors",
3003
+ "segments",
2930
3004
  "drivers",
3005
+ "absoluteDeltaDrivers",
2931
3006
  "largestNegativeChanges",
2932
3007
  "largestPositiveChanges",
2933
3008
  "largestNegativeDrivers",
2934
3009
  "largestPositiveDrivers"
2935
3010
  ];
2936
- function Ar(e) {
3011
+ function Or(e) {
2937
3012
  if (!e)
2938
3013
  return {};
2939
- const r = qn(e.executionResult), t = Sn(e, r), n = In(t);
3014
+ const r = _n(e.executionResult), t = On(e, r), n = Kn(t), i = Br(
3015
+ Ue(e.analysisWarnings),
3016
+ zn(t)
3017
+ );
2940
3018
  return {
2941
3019
  ...e,
2942
3020
  ...Object.keys(t).length ? { resultSets: t } : {},
3021
+ ...i.length ? { analysisWarnings: i } : {},
2943
3022
  ...n ? {
2944
3023
  columns: n.columns,
2945
3024
  records: n.records,
@@ -2947,84 +3026,121 @@ function Ar(e) {
2947
3026
  } : {}
2948
3027
  };
2949
3028
  }
2950
- function Sn(e, r) {
2951
- const t = wn(e.resultSets);
2952
- for (const i of bn) {
2953
- if (t[i]) {
2954
- t[i] = Er(t[i]);
3029
+ function On(e, r) {
3030
+ const t = Bn(e.resultSets);
3031
+ for (const i of Dn) {
3032
+ if (t[i])
2955
3033
  continue;
2956
- }
2957
- const a = Tn(e[i]);
2958
- if (!a.length)
3034
+ const o = Nn(e[i]);
3035
+ if (!o.length)
2959
3036
  continue;
2960
- const l = r.length ? r : An(a);
3037
+ const u = r.length ? r : Fn(o);
2961
3038
  t[i] = {
2962
- records: _e(a, l),
2963
- columns: l,
2964
- rowCount: a.length
3039
+ id: i,
3040
+ role: i,
3041
+ ...Ve({
3042
+ records: o,
3043
+ columns: u,
3044
+ resultSetKey: i
3045
+ }),
3046
+ columns: u,
3047
+ rowCount: o.length
2965
3048
  };
2966
3049
  }
2967
- const n = xn(e.executionResult);
3050
+ const n = Wn(e.executionResult);
2968
3051
  return n && n.records.length > 0 && !t.records && (t.records = n), t;
2969
3052
  }
2970
- function wn(e) {
3053
+ function Bn(e) {
2971
3054
  return Object.fromEntries(
2972
3055
  Object.entries(e || {}).map(([r, t]) => [
2973
3056
  r,
2974
- Er(t)
3057
+ $n(t, r)
2975
3058
  ])
2976
3059
  );
2977
3060
  }
2978
- function Er(e) {
2979
- var r;
3061
+ function $n(e, r = e.id || e.role || "resultSet") {
3062
+ var n;
3063
+ const t = Ve({
3064
+ records: e.records || [],
3065
+ columns: e.columns || [],
3066
+ resultSetKey: r
3067
+ });
2980
3068
  return {
2981
3069
  ...e,
2982
- records: _e(
2983
- e.records || [],
2984
- e.columns || []
2985
- ),
2986
- rowCount: e.rowCount ?? ((r = e.records) == null ? void 0 : r.length) ?? 0
3070
+ ...t,
3071
+ ...e.warnings || t.warnings ? {
3072
+ warnings: Br(
3073
+ Ue(e.warnings),
3074
+ t.warnings
3075
+ )
3076
+ } : {},
3077
+ rowCount: e.rowCount ?? ((n = e.records) == null ? void 0 : n.length) ?? 0
2987
3078
  };
2988
3079
  }
2989
- function In(e) {
3080
+ function Kn(e) {
2990
3081
  var r;
2991
- for (const t of vn)
3082
+ for (const t of Ln)
2992
3083
  if ((r = e[t]) != null && r.records.length)
2993
3084
  return e[t];
2994
3085
  return Object.values(e).find((t) => t.records.length) || Object.values(e)[0];
2995
3086
  }
2996
- function xn(e) {
3087
+ function Wn(e) {
2997
3088
  const r = e == null ? void 0 : e.result;
2998
3089
  if (!(!r || r.kind !== "records" && r.kind !== "sql"))
2999
3090
  return {
3000
- records: _e(r.records, r.columns),
3091
+ id: "records",
3092
+ role: "records",
3093
+ ...Ve({
3094
+ records: r.records,
3095
+ columns: r.columns,
3096
+ resultSetKey: "records"
3097
+ }),
3001
3098
  columns: r.columns,
3002
3099
  rowCount: r.rowCount ?? r.records.length
3003
3100
  };
3004
3101
  }
3005
- function qn(e) {
3102
+ function _n(e) {
3006
3103
  const r = e == null ? void 0 : e.result;
3007
3104
  return !r || r.kind !== "records" && r.kind !== "sql" ? [] : r.columns;
3008
3105
  }
3009
- function Tn(e) {
3106
+ function Nn(e) {
3010
3107
  return Array.isArray(e) ? e.filter(
3011
3108
  (r) => !!(r && typeof r == "object" && !Array.isArray(r))
3012
3109
  ) : [];
3013
3110
  }
3014
- function _e(e, r) {
3015
- return r.length ? e.map((t) => {
3016
- const n = {};
3017
- return r.forEach((i, a) => {
3018
- const l = En(t, {
3019
- name: i.key,
3020
- label: i.label,
3021
- fallbackNames: [i.name, Object.keys(t)[a]]
3022
- });
3023
- l !== void 0 && (n[i.key] = l);
3024
- }), Object.keys(n).length ? n : t;
3025
- }) : e;
3111
+ function Ve({
3112
+ records: e,
3113
+ columns: r,
3114
+ resultSetKey: t
3115
+ }) {
3116
+ if (!r.length)
3117
+ return { records: e };
3118
+ const n = [];
3119
+ return {
3120
+ records: e.map((o, u) => {
3121
+ const f = {};
3122
+ return r.forEach((d) => {
3123
+ if (Object.prototype.hasOwnProperty.call(o, d.key)) {
3124
+ f[d.key] = o[d.key];
3125
+ return;
3126
+ }
3127
+ n.push({
3128
+ code: "missing_analysis_result_key",
3129
+ severity: "warning",
3130
+ resultSetKey: t,
3131
+ rowIndex: u,
3132
+ columnKey: d.key,
3133
+ ...d.name ? { columnName: d.name } : {},
3134
+ ...d.label ? { columnLabel: d.label } : {},
3135
+ availableKeys: Object.keys(o),
3136
+ message: `Analysis result set "${t}" row ${u} is missing column key "${d.key}". Rows must expose values by column.key; labels and column names are display metadata only.`
3137
+ });
3138
+ }), f;
3139
+ }),
3140
+ ...n.length ? { warnings: n } : {}
3141
+ };
3026
3142
  }
3027
- function An(e) {
3143
+ function Fn(e) {
3028
3144
  return Array.from(
3029
3145
  new Set(e.flatMap((t) => Object.keys(t)))
3030
3146
  ).map((t) => ({
@@ -3033,338 +3149,329 @@ function An(e) {
3033
3149
  label: t
3034
3150
  }));
3035
3151
  }
3036
- function En(e, r) {
3037
- const t = [
3038
- r.name,
3039
- r.label,
3040
- ...r.fallbackNames || []
3041
- ].filter((n) => !!n);
3042
- for (const n of t)
3043
- if (Object.prototype.hasOwnProperty.call(e, n))
3044
- return e[n];
3045
- }
3046
- function Rn() {
3047
- return {
3048
- executeAnalysis: (e, r, t) => J(
3049
- e,
3050
- r,
3051
- t ?? {}
3052
- ).then(Ar),
3053
- executeMetric: (e, r) => J(e, r),
3054
- executeRecords: (e, r) => J(e, r),
3055
- executeInputOptions: (e, r) => J(e, r),
3056
- executeSql: (e, r) => J(e, r),
3057
- executeMatrix: (e, r) => J(e, r)
3058
- };
3059
- }
3060
- async function J(e, r, t) {
3061
- if (!r.token)
3062
- throw new Error(
3063
- "SemaphorDataAppProvider needs a token to execute queries."
3064
- );
3065
- const n = Wn(r), i = Ln(e, n);
3066
- let a;
3067
- try {
3068
- a = await fetch(n, {
3069
- method: "POST",
3070
- headers: {
3071
- "Content-Type": "application/json",
3072
- Authorization: `Bearer ${r.token}`
3073
- },
3074
- body: JSON.stringify({
3075
- intent: e,
3076
- activeInputs: r.activeInputs,
3077
- ...t ? { analysisOptions: t } : {},
3078
- resultShape: e.kind,
3079
- ...kn(r) ? { debug: { responseDetail: "debug" } } : {}
3080
- })
3081
- });
3082
- } catch (p) {
3083
- throw new Error(
3084
- `${i}: ${p instanceof Error ? p.message : String(p)}`
3085
- );
3086
- }
3087
- const l = await Bn(a);
3088
- if (!a.ok || l.error)
3089
- throw Cn(
3090
- `${i}: ${l.error || `Semaphor Data App execution failed with status ${a.status}.`}`,
3091
- l
3092
- );
3093
- return l;
3094
- }
3095
- function Cn(e, r) {
3096
- const t = new Error(e);
3097
- return r.requestId && (t.requestId = r.requestId), r.details !== void 0 && (t.details = r.details), r.executionResult !== void 0 && (t.executionResult = r.executionResult), t;
3098
- }
3099
- function kn(e) {
3100
- const r = e.debug;
3101
- return r ? r === !0 ? !0 : r.enabled !== !1 && r.requestServerDebug !== !1 : !1;
3102
- }
3103
- function Ln(e, r) {
3104
- return [
3105
- `Semaphor ${e.kind} query`,
3106
- e.id ? `id=${e.id}` : void 0,
3107
- e.label ? `label=${e.label}` : void 0,
3108
- Dn(e),
3109
- `endpoint=${On(r)}`
3110
- ].filter((t) => !!t).join(" ");
3111
- }
3112
- function Dn(e) {
3113
- const r = "source" in e ? e.source : void 0;
3114
- if (!(!r || typeof r != "object")) {
3115
- if (r.kind === "semantic")
3116
- return `source=${[
3117
- r.domainId,
3118
- r.datasetId || r.datasetName
3119
- ].filter(Boolean).join("/")}`;
3120
- if (r.kind === "physical")
3121
- return `source=${[
3122
- r.connectionId,
3123
- r.databaseName,
3124
- r.schemaName,
3125
- r.tableName
3126
- ].filter(Boolean).join("/")}`;
3127
- if (r.kind === "sql")
3128
- return r.connectionId ? `source=${r.connectionId}` : void 0;
3129
- }
3130
- }
3131
- function On(e) {
3132
- if (!e)
3133
- return "/api/v1/data-app/execute";
3134
- try {
3135
- return new URL(e, "http://localhost").pathname;
3136
- } catch {
3137
- return e;
3138
- }
3139
- }
3140
- async function Bn(e) {
3141
- const r = await e.text().catch(() => "");
3142
- if (!r.trim())
3143
- return e.ok ? {
3144
- error: "Semaphor Data App execution returned an empty response."
3145
- } : {};
3146
- try {
3147
- return JSON.parse(r);
3148
- } catch {
3149
- return e.ok ? {
3150
- error: "Semaphor Data App execution returned invalid JSON.",
3151
- details: r
3152
- } : {
3153
- error: $n(e, r),
3154
- details: r
3155
- };
3156
- }
3152
+ function zn(e) {
3153
+ return Object.values(e).flatMap(
3154
+ (r) => Ue(r.warnings)
3155
+ );
3157
3156
  }
3158
- function $n(e, r) {
3159
- const t = e.statusText ? ` ${e.statusText}` : "", n = r.replace(/\s+/g, " ").trim();
3160
- return n ? `Semaphor Data App execution failed with status ${e.status}${t}: ${n.slice(0, 240)}` : `Semaphor Data App execution failed with status ${e.status}${t}.`;
3157
+ function Ue(e) {
3158
+ return Array.isArray(e) ? e.filter(Mn) : [];
3161
3159
  }
3162
- function Wn(e) {
3163
- const r = Nn(e).replace(/\/+$/, "");
3164
- return r ? r.endsWith("/api") ? `${r}/v1/data-app/execute` : `${r}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
3160
+ function Mn(e) {
3161
+ return !!(e && typeof e == "object" && !Array.isArray(e));
3165
3162
  }
3166
- function Nn(e) {
3167
- if (e.apiBaseUrl)
3168
- return e.apiBaseUrl;
3169
- if (!e.token)
3170
- return "";
3171
- try {
3172
- return Qr(e.token).apiServiceUrl || "";
3173
- } catch {
3174
- return "";
3163
+ function Br(...e) {
3164
+ const r = /* @__PURE__ */ new Set(), t = [];
3165
+ for (const n of e.flatMap((i) => i || [])) {
3166
+ const i = Hn(n);
3167
+ r.has(i) || (r.add(i), t.push(n));
3175
3168
  }
3169
+ return t;
3176
3170
  }
3177
- const Rr = Se({});
3178
- function Kn() {
3179
- if (!(typeof window > "u"))
3180
- return window.__SEMAPHOR_DATA_APP_RUNTIME__;
3181
- }
3182
- function Fn() {
3183
- return V(Rr);
3171
+ function Hn(e) {
3172
+ return e.code === "missing_analysis_result_key" ? [
3173
+ e.code,
3174
+ e.resultSetKey,
3175
+ e.rowIndex,
3176
+ e.columnKey
3177
+ ].join(":") : Ne(e);
3178
+ }
3179
+ function Ne(e) {
3180
+ if (!e || typeof e != "object")
3181
+ return JSON.stringify(e);
3182
+ if (Array.isArray(e))
3183
+ return `[${e.map((t) => Ne(t)).join(",")}]`;
3184
+ const r = e;
3185
+ return `{${Object.keys(r).sort().map((t) => `${JSON.stringify(t)}:${Ne(r[t])}`).join(",")}}`;
3184
3186
  }
3185
- const Re = { value: null }, Ce = {}, _n = { records: [] }, ke = { options: [] }, zn = { records: [] }, Le = {};
3186
- function Mn(e) {
3187
- const r = Z(e.inputs), t = Nr(e);
3187
+ const Oe = { value: null }, Be = {}, jn = { records: [] }, $e = { options: [] }, Pn = { records: [] }, Ke = {};
3188
+ function Qn(e) {
3189
+ const r = Z(e.inputs), t = Pr(e);
3188
3190
  try {
3189
- const n = Kr(e), i = ee(n);
3191
+ const n = Qr(e), i = re(n, "analysis");
3190
3192
  return i ? {
3191
3193
  error: i,
3192
3194
  activeInputs: r,
3193
3195
  analysisOptions: t,
3194
- queryKey: q(
3196
+ queryKey: x(
3195
3197
  void 0,
3196
3198
  r,
3197
3199
  i,
3198
3200
  t
3199
3201
  ),
3200
- idleData: Ce
3202
+ idleData: Be
3201
3203
  } : {
3202
3204
  intent: n,
3203
3205
  error: null,
3204
3206
  activeInputs: r,
3205
3207
  analysisOptions: t,
3206
- queryKey: q(n, r, void 0, t),
3207
- idleData: Ce
3208
+ queryKey: x(n, r, void 0, t),
3209
+ idleData: Be
3208
3210
  };
3209
3211
  } catch (n) {
3210
- const i = z(n);
3212
+ const i = ee(n, "analysis");
3211
3213
  return {
3212
3214
  error: i,
3213
3215
  activeInputs: r,
3214
3216
  analysisOptions: t,
3215
- queryKey: q(
3217
+ queryKey: x(
3216
3218
  void 0,
3217
3219
  r,
3218
3220
  i,
3219
3221
  t
3220
3222
  ),
3221
- idleData: Ce
3223
+ idleData: Be
3222
3224
  };
3223
3225
  }
3224
3226
  }
3225
- function Hn(e) {
3227
+ function Vn(e) {
3226
3228
  const r = Z(e.inputs);
3227
3229
  try {
3228
- const t = Fr(e), n = ee(t);
3230
+ const t = Vr(e), n = re(t);
3229
3231
  return n ? {
3230
3232
  error: n,
3231
3233
  activeInputs: r,
3232
- queryKey: q(void 0, r, n),
3233
- idleData: Re
3234
+ queryKey: x(void 0, r, n),
3235
+ idleData: Oe
3234
3236
  } : {
3235
3237
  intent: t,
3236
3238
  error: null,
3237
3239
  activeInputs: r,
3238
- queryKey: q(t, r),
3239
- idleData: Re
3240
+ queryKey: x(t, r),
3241
+ idleData: Oe
3240
3242
  };
3241
3243
  } catch (t) {
3242
- const n = z(t);
3244
+ const n = ee(t, "metric");
3243
3245
  return {
3244
3246
  error: n,
3245
3247
  activeInputs: r,
3246
- queryKey: q(void 0, r, n),
3247
- idleData: Re
3248
+ queryKey: x(void 0, r, n),
3249
+ idleData: Oe
3248
3250
  };
3249
3251
  }
3250
3252
  }
3251
- function jn(e) {
3252
- const r = Z(e.inputs), t = _n;
3253
+ function Un(e) {
3254
+ const r = Z(e.inputs), t = jn;
3253
3255
  try {
3254
- const n = Wr(e), i = ee(n);
3256
+ const n = jr(e), i = re(n);
3255
3257
  return i ? {
3256
3258
  error: i,
3257
3259
  activeInputs: r,
3258
- queryKey: q(void 0, r, i),
3260
+ queryKey: x(void 0, r, i),
3259
3261
  idleData: t
3260
3262
  } : {
3261
3263
  intent: n,
3262
3264
  error: null,
3263
3265
  activeInputs: r,
3264
- queryKey: q(n, r),
3266
+ queryKey: x(n, r),
3265
3267
  idleData: t
3266
3268
  };
3267
3269
  } catch (n) {
3268
- const i = z(n);
3270
+ const i = ee(n, "records");
3269
3271
  return {
3270
3272
  error: i,
3271
3273
  activeInputs: r,
3272
- queryKey: q(void 0, r, i),
3274
+ queryKey: x(void 0, r, i),
3273
3275
  idleData: t
3274
3276
  };
3275
3277
  }
3276
3278
  }
3277
- function Pn(e) {
3279
+ function Gn(e) {
3278
3280
  const r = Z(e.inputs);
3279
3281
  try {
3280
- const t = $r(e), n = ee(t);
3282
+ const t = Hr(e), n = re(t);
3281
3283
  return n ? {
3282
3284
  error: n,
3283
3285
  activeInputs: r,
3284
- queryKey: q(void 0, r, n),
3285
- idleData: ke
3286
+ queryKey: x(void 0, r, n),
3287
+ idleData: $e
3286
3288
  } : {
3287
3289
  intent: t,
3288
3290
  error: null,
3289
3291
  activeInputs: r,
3290
- queryKey: q(t, r),
3291
- idleData: ke
3292
+ queryKey: x(t, r),
3293
+ idleData: $e
3292
3294
  };
3293
3295
  } catch (t) {
3294
- const n = z(t);
3296
+ const n = ee(t, "inputOptions");
3295
3297
  return {
3296
3298
  error: n,
3297
3299
  activeInputs: r,
3298
- queryKey: q(void 0, r, n),
3299
- idleData: ke
3300
+ queryKey: x(void 0, r, n),
3301
+ idleData: $e
3300
3302
  };
3301
3303
  }
3302
3304
  }
3303
- function Vn(e) {
3304
- const r = Z(e.inputs), t = zn;
3305
+ function Jn(e) {
3306
+ const r = Z(e.inputs), t = Pn;
3305
3307
  try {
3306
- const n = Br(e), i = ee(n);
3308
+ const n = Mr(e), i = re(n);
3307
3309
  return i ? {
3308
3310
  error: i,
3309
3311
  activeInputs: r,
3310
- queryKey: q(void 0, r, i),
3312
+ queryKey: x(void 0, r, i),
3311
3313
  idleData: t
3312
3314
  } : {
3313
3315
  intent: n,
3314
3316
  error: null,
3315
3317
  activeInputs: r,
3316
- queryKey: q(n, r),
3318
+ queryKey: x(n, r),
3317
3319
  idleData: t
3318
3320
  };
3319
3321
  } catch (n) {
3320
- const i = z(n);
3322
+ const i = ee(n, "sql");
3321
3323
  return {
3322
3324
  error: i,
3323
3325
  activeInputs: r,
3324
- queryKey: q(void 0, r, i),
3326
+ queryKey: x(void 0, r, i),
3325
3327
  idleData: t
3326
3328
  };
3327
3329
  }
3328
3330
  }
3329
- function Qn(e) {
3331
+ function Yn(e) {
3330
3332
  const r = Z(e.inputs);
3331
3333
  try {
3332
- const t = Or(e), n = ee(t);
3334
+ const t = zr(e), n = re(t);
3333
3335
  return n ? {
3334
3336
  error: n,
3335
3337
  activeInputs: r,
3336
- queryKey: q(void 0, r, n),
3337
- idleData: Le
3338
+ queryKey: x(void 0, r, n),
3339
+ idleData: Ke
3338
3340
  } : {
3339
3341
  intent: t,
3340
3342
  error: null,
3341
3343
  activeInputs: r,
3342
- queryKey: q(t, r),
3343
- idleData: Le
3344
+ queryKey: x(t, r),
3345
+ idleData: Ke
3344
3346
  };
3345
3347
  } catch (t) {
3346
- const n = z(t);
3348
+ const n = ee(t, "matrix");
3347
3349
  return {
3348
3350
  error: n,
3349
3351
  activeInputs: r,
3350
- queryKey: q(void 0, r, n),
3351
- idleData: Le
3352
+ queryKey: x(void 0, r, n),
3353
+ idleData: Ke
3352
3354
  };
3353
3355
  }
3354
3356
  }
3355
- function z(e) {
3356
- return e instanceof Error ? e : new Error(String(e));
3357
+ function Fe(e) {
3358
+ var o;
3359
+ if (Xn(e))
3360
+ return e;
3361
+ const r = e instanceof Error ? e : void 0, t = e, n = t == null ? void 0 : t.executionResult, i = Ae(
3362
+ (r == null ? void 0 : r.message) ?? String(e),
3363
+ {
3364
+ requestId: typeof (t == null ? void 0 : t.requestId) == "string" ? t.requestId : void 0,
3365
+ details: t == null ? void 0 : t.details,
3366
+ executionResult: n,
3367
+ validation: (t == null ? void 0 : t.validation) ?? (n == null ? void 0 : n.validation),
3368
+ validationIssues: (t == null ? void 0 : t.validationIssues) ?? ((o = n == null ? void 0 : n.validation) == null ? void 0 : o.errors)
3369
+ }
3370
+ );
3371
+ return i.name = (r == null ? void 0 : r.name) || i.name, i.stack = r == null ? void 0 : r.stack, i;
3372
+ }
3373
+ function ee(e, r) {
3374
+ const t = Fe(e);
3375
+ if (t.executionResult || t.validation)
3376
+ return t;
3377
+ const n = {
3378
+ ok: !1,
3379
+ errors: [
3380
+ {
3381
+ code: "invalid_query_spec",
3382
+ message: t.message,
3383
+ path: "spec"
3384
+ }
3385
+ ],
3386
+ warnings: [],
3387
+ repairHints: [
3388
+ {
3389
+ code: "invalid_query_spec",
3390
+ message: t.message,
3391
+ recommendedNextStep: "Update the Data App query spec to satisfy the SDK builder contract."
3392
+ }
3393
+ ]
3394
+ }, i = $r(
3395
+ void 0,
3396
+ r,
3397
+ n
3398
+ ), o = Ae(t.message, {
3399
+ executionResult: i,
3400
+ validation: n,
3401
+ validationIssues: n.errors
3402
+ });
3403
+ return o.stack = t.stack, o;
3404
+ }
3405
+ function Ae(e, r = {}) {
3406
+ var i, o, u;
3407
+ const t = new Error(e);
3408
+ t.name = "SemaphorDataAppQueryError", t.kind = "data_app_query_error", r.requestId && (t.requestId = r.requestId), r.details !== void 0 && (t.details = r.details), r.executionResult !== void 0 && (t.executionResult = r.executionResult), r.validation !== void 0 && (t.validation = r.validation);
3409
+ const n = r.validationIssues ?? ((i = r.validation) == null ? void 0 : i.errors) ?? ((u = (o = r.executionResult) == null ? void 0 : o.validation) == null ? void 0 : u.errors);
3410
+ return n !== void 0 && (t.validationIssues = n), t;
3357
3411
  }
3358
- function ee(e) {
3359
- const r = Ur(e);
3360
- if (r.ok)
3412
+ function Xn(e) {
3413
+ return e instanceof Error && e.kind === "data_app_query_error";
3414
+ }
3415
+ function re(e, r = e.kind) {
3416
+ const t = st(e);
3417
+ if (t.ok)
3361
3418
  return null;
3362
- const t = r.errors.map(
3363
- (n) => n.path ? `${n.code} at ${n.path}: ${n.message}` : `${n.code}: ${n.message}`
3364
- ).join("; ");
3365
- return new Error(`Invalid Semaphor analytics intent. ${t}`);
3419
+ const n = t.errors.map(
3420
+ (o) => o.path ? `${o.code} at ${o.path}: ${o.message}` : `${o.code}: ${o.message}`
3421
+ ).join("; "), i = $r(
3422
+ e,
3423
+ r,
3424
+ t
3425
+ );
3426
+ return Ae(
3427
+ `Invalid Semaphor analytics intent. ${n}`,
3428
+ {
3429
+ executionResult: i,
3430
+ validation: t,
3431
+ validationIssues: t.errors
3432
+ }
3433
+ );
3434
+ }
3435
+ function $r(e, r, t) {
3436
+ return {
3437
+ ...e != null && e.id ? { intentId: e.id } : {},
3438
+ ...e ? { intent: e } : {},
3439
+ status: "failed",
3440
+ resultShape: r,
3441
+ validation: t,
3442
+ coverage: {
3443
+ answeredObligations: [],
3444
+ missingObligations: ["query_spec_validation"],
3445
+ warnings: t.warnings
3446
+ },
3447
+ missingFields: t.errors.filter((n) => n.code === "missing_field").flatMap((n) => {
3448
+ var o;
3449
+ const i = n.path || ((o = n.repairHint) == null ? void 0 : o.invalidField);
3450
+ return i ? [i] : [];
3451
+ }),
3452
+ warnings: t.warnings.map((n) => n.message),
3453
+ diagnosticFeedback: {
3454
+ version: 1,
3455
+ status: "blocked",
3456
+ summary: "Data App query spec validation failed.",
3457
+ answered: [],
3458
+ blocked: t.errors.map((n) => {
3459
+ var o, u;
3460
+ const i = {
3461
+ reasonCode: "query_validation_failed",
3462
+ message: n.message
3463
+ };
3464
+ return n.code === "missing_field" && (i.missingFields = [
3465
+ n.path || ((o = n.repairHint) == null ? void 0 : o.invalidField) || n.message
3466
+ ]), (u = n.repairHint) != null && u.recommendedNextStep && (i.recommendedNextStep = n.repairHint.recommendedNextStep), i;
3467
+ })
3468
+ },
3469
+ metadata: {
3470
+ validationKind: "data_app_sdk_query_spec"
3471
+ }
3472
+ };
3366
3473
  }
3367
- function q(e, r, t, n) {
3474
+ function x(e, r, t, n) {
3368
3475
  return JSON.stringify({
3369
3476
  intent: e,
3370
3477
  activeInputs: r,
@@ -3372,54 +3479,198 @@ function q(e, r, t, n) {
3372
3479
  error: t == null ? void 0 : t.message
3373
3480
  });
3374
3481
  }
3375
- function ci(e) {
3376
- const [r, t] = Q(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), i = n ? e.value : r, a = w(
3377
- () => nr(e.options),
3482
+ function Zn() {
3483
+ return {
3484
+ executeAnalysis: (e, r, t) => J(
3485
+ e,
3486
+ r,
3487
+ t ?? {}
3488
+ ).then(Or),
3489
+ executeMetric: (e, r) => J(e, r),
3490
+ executeRecords: (e, r) => J(e, r),
3491
+ executeInputOptions: (e, r) => J(e, r),
3492
+ executeSql: (e, r) => J(e, r),
3493
+ executeMatrix: (e, r) => J(e, r)
3494
+ };
3495
+ }
3496
+ async function J(e, r, t) {
3497
+ if (!r.token)
3498
+ throw new Error(
3499
+ "SemaphorDataAppProvider needs a token to execute queries."
3500
+ );
3501
+ const n = ai(r), i = ti(e, n);
3502
+ let o;
3503
+ try {
3504
+ o = await fetch(n, {
3505
+ method: "POST",
3506
+ headers: {
3507
+ "Content-Type": "application/json",
3508
+ Authorization: `Bearer ${r.token}`
3509
+ },
3510
+ body: JSON.stringify({
3511
+ intent: e,
3512
+ activeInputs: r.activeInputs,
3513
+ ...t ? { analysisOptions: t } : {},
3514
+ resultShape: e.kind,
3515
+ ...ri(r) ? { debug: { responseDetail: "debug" } } : {}
3516
+ })
3517
+ });
3518
+ } catch (f) {
3519
+ throw new Error(
3520
+ `${i}: ${f instanceof Error ? f.message : String(f)}`
3521
+ );
3522
+ }
3523
+ const u = await oi(o);
3524
+ if (!o.ok || u.error)
3525
+ throw ei(
3526
+ `${i}: ${u.error || `Semaphor Data App execution failed with status ${o.status}.`}`,
3527
+ u
3528
+ );
3529
+ return u;
3530
+ }
3531
+ function ei(e, r) {
3532
+ var t;
3533
+ return Ae(e, {
3534
+ requestId: r.requestId,
3535
+ details: r.details,
3536
+ executionResult: r.executionResult,
3537
+ validation: (t = r.executionResult) == null ? void 0 : t.validation
3538
+ });
3539
+ }
3540
+ function ri(e) {
3541
+ const r = e.debug;
3542
+ return r ? r === !0 ? !0 : r.enabled !== !1 && r.requestServerDebug !== !1 : !1;
3543
+ }
3544
+ function ti(e, r) {
3545
+ return [
3546
+ `Semaphor ${e.kind} query`,
3547
+ e.id ? `id=${e.id}` : void 0,
3548
+ e.label ? `label=${e.label}` : void 0,
3549
+ ni(e),
3550
+ `endpoint=${ii(r)}`
3551
+ ].filter((t) => !!t).join(" ");
3552
+ }
3553
+ function ni(e) {
3554
+ const r = "source" in e ? e.source : void 0;
3555
+ if (!(!r || typeof r != "object")) {
3556
+ if (r.kind === "semantic")
3557
+ return `source=${[
3558
+ r.domainId,
3559
+ r.datasetId || r.datasetName
3560
+ ].filter(Boolean).join("/")}`;
3561
+ if (r.kind === "physical")
3562
+ return `source=${[
3563
+ r.connectionId,
3564
+ r.databaseName,
3565
+ r.schemaName,
3566
+ r.tableName
3567
+ ].filter(Boolean).join("/")}`;
3568
+ if (r.kind === "sql")
3569
+ return r.connectionId ? `source=${r.connectionId}` : void 0;
3570
+ }
3571
+ }
3572
+ function ii(e) {
3573
+ if (!e)
3574
+ return "/api/v1/data-app/execute";
3575
+ try {
3576
+ return new URL(e, "http://localhost").pathname;
3577
+ } catch {
3578
+ return e;
3579
+ }
3580
+ }
3581
+ async function oi(e) {
3582
+ const r = await e.text().catch(() => "");
3583
+ if (!r.trim())
3584
+ return e.ok ? {
3585
+ error: "Semaphor Data App execution returned an empty response."
3586
+ } : {};
3587
+ try {
3588
+ return JSON.parse(r);
3589
+ } catch {
3590
+ return e.ok ? {
3591
+ error: "Semaphor Data App execution returned invalid JSON.",
3592
+ details: r
3593
+ } : {
3594
+ error: si(e, r),
3595
+ details: r
3596
+ };
3597
+ }
3598
+ }
3599
+ function si(e, r) {
3600
+ const t = e.statusText ? ` ${e.statusText}` : "", n = r.replace(/\s+/g, " ").trim();
3601
+ return n ? `Semaphor Data App execution failed with status ${e.status}${t}: ${n.slice(0, 240)}` : `Semaphor Data App execution failed with status ${e.status}${t}.`;
3602
+ }
3603
+ function ai(e) {
3604
+ const r = di(e).replace(/\/+$/, "");
3605
+ return r ? r.endsWith("/api") ? `${r}/v1/data-app/execute` : `${r}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
3606
+ }
3607
+ function di(e) {
3608
+ if (e.apiBaseUrl)
3609
+ return e.apiBaseUrl;
3610
+ if (!e.token)
3611
+ return "";
3612
+ try {
3613
+ return ot(e.token).apiServiceUrl || "";
3614
+ } catch {
3615
+ return "";
3616
+ }
3617
+ }
3618
+ const Kr = we({});
3619
+ function li() {
3620
+ if (!(typeof window > "u"))
3621
+ return window.__SEMAPHOR_DATA_APP_RUNTIME__;
3622
+ }
3623
+ function ui() {
3624
+ return V(Kr);
3625
+ }
3626
+ function Li(e) {
3627
+ const [r, t] = M(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), i = n ? e.value : r, o = w(
3628
+ () => cr(e.options),
3378
3629
  [e.options]
3379
- ), l = O(
3380
- (c) => {
3381
- var b;
3382
- const u = c;
3383
- (b = e.onValueChange) == null || b.call(e, u), n || t(u);
3630
+ ), u = O(
3631
+ (d) => {
3632
+ var m;
3633
+ const c = d;
3634
+ (m = e.onValueChange) == null || m.call(e, c), n || t(c);
3384
3635
  },
3385
3636
  [n, e]
3386
- ), p = O(() => l(void 0), [l]);
3637
+ ), f = O(() => u(void 0), [u]);
3387
3638
  return w(() => {
3388
- const c = ir(e);
3639
+ const d = fr(e);
3389
3640
  return {
3390
3641
  id: e.id,
3391
3642
  kind: e.kind,
3392
3643
  label: e.label,
3393
- field: c.field,
3394
- operator: c.operator,
3395
- relationshipHint: c.relationshipHint,
3644
+ field: d.field,
3645
+ operator: d.operator,
3646
+ relationshipHint: d.relationshipHint,
3396
3647
  controlRole: e.kind === "control" ? e.role : void 0,
3397
3648
  value: i,
3398
- options: a,
3399
- isActive: le(i),
3400
- setValue: l,
3401
- clear: p,
3649
+ options: o,
3650
+ isActive: ce(i),
3651
+ setValue: u,
3652
+ clear: f,
3402
3653
  toAnalyticsInput: () => ({
3403
- inputId: c.inputId,
3404
- field: c.field,
3654
+ inputId: d.inputId,
3655
+ field: d.field,
3405
3656
  kind: e.kind,
3406
3657
  label: e.label,
3407
3658
  value: i,
3408
- isActive: le(i),
3409
- operator: c.operator,
3410
- relationshipHint: c.relationshipHint,
3659
+ isActive: ce(i),
3660
+ operator: d.operator,
3661
+ relationshipHint: d.relationshipHint,
3411
3662
  controlRole: e.kind === "control" ? e.role : void 0
3412
3663
  })
3413
3664
  };
3414
- }, [p, a, l, e, i]);
3665
+ }, [f, o, u, e, i]);
3415
3666
  }
3416
- function fi(e) {
3417
- const [r, t] = Q(() => Yn(e));
3418
- return B(() => {
3667
+ function Oi(e) {
3668
+ const [r, t] = M(() => hi(e));
3669
+ return $(() => {
3419
3670
  t((n) => {
3420
3671
  let i = n;
3421
- for (const a of e)
3422
- !Object.prototype.hasOwnProperty.call(i, a.id) && a.defaultValue !== void 0 && (i = { ...i, [a.id]: a.defaultValue });
3672
+ for (const o of e)
3673
+ !Object.prototype.hasOwnProperty.call(i, o.id) && o.defaultValue !== void 0 && (i = { ...i, [o.id]: o.defaultValue });
3423
3674
  return i;
3424
3675
  });
3425
3676
  }, [e]), w(
@@ -3427,35 +3678,35 @@ function fi(e) {
3427
3678
  const i = Object.prototype.hasOwnProperty.call(
3428
3679
  n,
3429
3680
  "value"
3430
- ), a = i ? n.value : r[n.id], l = nr(n.options), p = (b) => {
3431
- var y;
3432
- (y = n.onValueChange) == null || y.call(n, b), i || t((v) => ({
3433
- ...v,
3434
- [n.id]: b
3681
+ ), o = i ? n.value : r[n.id], u = cr(n.options), f = (m) => {
3682
+ var v;
3683
+ (v = n.onValueChange) == null || v.call(n, m), i || t((S) => ({
3684
+ ...S,
3685
+ [n.id]: m
3435
3686
  }));
3436
- }, c = () => p(void 0), u = ir(n);
3687
+ }, d = () => f(void 0), c = fr(n);
3437
3688
  return {
3438
3689
  id: n.id,
3439
3690
  kind: n.kind,
3440
3691
  label: n.label,
3441
- field: u.field,
3442
- operator: u.operator,
3443
- relationshipHint: u.relationshipHint,
3692
+ field: c.field,
3693
+ operator: c.operator,
3694
+ relationshipHint: c.relationshipHint,
3444
3695
  controlRole: n.kind === "control" ? n.role : void 0,
3445
- value: a,
3446
- options: l,
3447
- isActive: le(a),
3448
- setValue: p,
3449
- clear: c,
3696
+ value: o,
3697
+ options: u,
3698
+ isActive: ce(o),
3699
+ setValue: f,
3700
+ clear: d,
3450
3701
  toAnalyticsInput: () => ({
3451
- inputId: u.inputId,
3452
- field: u.field,
3702
+ inputId: c.inputId,
3703
+ field: c.field,
3453
3704
  kind: n.kind,
3454
3705
  label: n.label,
3455
- value: a,
3456
- isActive: le(a),
3457
- operator: u.operator,
3458
- relationshipHint: u.relationshipHint,
3706
+ value: o,
3707
+ isActive: ce(o),
3708
+ operator: c.operator,
3709
+ relationshipHint: c.relationshipHint,
3459
3710
  controlRole: n.kind === "control" ? n.role : void 0
3460
3711
  })
3461
3712
  };
@@ -3463,29 +3714,29 @@ function fi(e) {
3463
3714
  [e, r]
3464
3715
  );
3465
3716
  }
3466
- function pi(e, r) {
3467
- const t = (r == null ? void 0 : r.status) === "success" ? r.options : void 0, n = w(() => Gn(t), [t]);
3468
- B(() => {
3469
- Un(e.value, t) || e.clear();
3717
+ function Bi(e, r) {
3718
+ const t = (r == null ? void 0 : r.status) === "success" ? r.options : void 0, n = w(() => fi(t), [t]);
3719
+ $(() => {
3720
+ ci(e.value, t) || e.clear();
3470
3721
  }, [e, n, r == null ? void 0 : r.status, t]);
3471
3722
  }
3472
- function Un(e, r) {
3473
- if (!le(e) || r === void 0)
3723
+ function ci(e, r) {
3724
+ if (!ce(e) || r === void 0)
3474
3725
  return !0;
3475
3726
  const t = new Set(
3476
- r.map((i) => rr(i.value))
3727
+ r.map((i) => lr(i.value))
3477
3728
  );
3478
3729
  return (Array.isArray(e) ? e : [e]).every(
3479
- (i) => t.has(rr(i))
3730
+ (i) => t.has(lr(i))
3480
3731
  );
3481
3732
  }
3482
- function Gn(e) {
3733
+ function fi(e) {
3483
3734
  return JSON.stringify((e || []).map((r) => r.value));
3484
3735
  }
3485
- function rr(e) {
3736
+ function lr(e) {
3486
3737
  return `${typeof e}:${String(e)}`;
3487
3738
  }
3488
- function gi(e, r = {}) {
3739
+ function $i(e, r = {}) {
3489
3740
  const t = w(
3490
3741
  () => r.inputs ? {
3491
3742
  ...e,
@@ -3497,44 +3748,44 @@ function gi(e, r = {}) {
3497
3748
  case "metric":
3498
3749
  return {
3499
3750
  queryKind: t.queryKind,
3500
- request: Hn(t)
3751
+ request: Vn(t)
3501
3752
  };
3502
3753
  case "analysis":
3503
3754
  return {
3504
3755
  queryKind: t.queryKind,
3505
- request: Mn(t)
3756
+ request: Qn(t)
3506
3757
  };
3507
3758
  case "records":
3508
3759
  return {
3509
3760
  queryKind: t.queryKind,
3510
- request: jn(t)
3761
+ request: Un(t)
3511
3762
  };
3512
3763
  case "inputOptions":
3513
3764
  return {
3514
3765
  queryKind: t.queryKind,
3515
- request: Pn(t)
3766
+ request: Gn(t)
3516
3767
  };
3517
3768
  case "sql":
3518
3769
  return {
3519
3770
  queryKind: t.queryKind,
3520
- request: Vn(t)
3771
+ request: Jn(t)
3521
3772
  };
3522
3773
  case "matrix":
3523
3774
  return {
3524
3775
  queryKind: t.queryKind,
3525
- request: Qn(t)
3776
+ request: Yn(t)
3526
3777
  };
3527
3778
  default:
3528
- return De(t);
3779
+ return Se(t);
3529
3780
  }
3530
- }, [t]), i = rt({
3781
+ }, [t]), i = pt({
3531
3782
  spec: t,
3532
3783
  queryKind: n.queryKind,
3533
3784
  queryKey: n.request.queryKey,
3534
3785
  intent: n.request.intent,
3535
3786
  activeInputs: n.request.activeInputs,
3536
3787
  debug: r.debug
3537
- }), a = L(null), l = w(
3788
+ }), o = D(null), u = w(
3538
3789
  () => ({
3539
3790
  start: i.start,
3540
3791
  success: i.success,
@@ -3547,232 +3798,336 @@ function gi(e, r = {}) {
3547
3798
  i.start,
3548
3799
  i.success
3549
3800
  ]
3550
- ), p = O(
3551
- (d) => {
3552
- var $, A, W, D, m, S, k, x, T;
3553
- const I = n.request;
3554
- if (I.intent)
3801
+ ), f = O(
3802
+ (l) => {
3803
+ var K, E, W, L, h, I, R, q, A;
3804
+ const y = n.request;
3805
+ if (y.intent)
3555
3806
  switch (n.queryKind) {
3556
3807
  case "metric":
3557
- return ($ = d.executor) == null ? void 0 : $.executeMetric(
3558
- I.intent,
3559
- d
3808
+ return (K = l.executor) == null ? void 0 : K.executeMetric(
3809
+ y.intent,
3810
+ l
3560
3811
  );
3561
3812
  case "analysis":
3562
- return (W = (A = d.executor) == null ? void 0 : A.executeAnalysis) == null ? void 0 : W.call(
3563
- A,
3564
- I.intent,
3565
- d,
3566
- I.analysisOptions
3813
+ return (W = (E = l.executor) == null ? void 0 : E.executeAnalysis) == null ? void 0 : W.call(
3814
+ E,
3815
+ y.intent,
3816
+ l,
3817
+ y.analysisOptions
3567
3818
  );
3568
3819
  case "records":
3569
- return (D = d.executor) == null ? void 0 : D.executeRecords(
3570
- I.intent,
3571
- d
3820
+ return (L = l.executor) == null ? void 0 : L.executeRecords(
3821
+ y.intent,
3822
+ l
3572
3823
  );
3573
3824
  case "inputOptions":
3574
- return (m = d.executor) == null ? void 0 : m.executeInputOptions(
3575
- I.intent,
3576
- d
3825
+ return (h = l.executor) == null ? void 0 : h.executeInputOptions(
3826
+ y.intent,
3827
+ l
3577
3828
  );
3578
3829
  case "sql":
3579
- return (k = (S = d.executor) == null ? void 0 : S.executeSql) == null ? void 0 : k.call(
3580
- S,
3581
- I.intent,
3582
- d
3830
+ return (R = (I = l.executor) == null ? void 0 : I.executeSql) == null ? void 0 : R.call(
3831
+ I,
3832
+ y.intent,
3833
+ l
3583
3834
  );
3584
3835
  case "matrix":
3585
- return (T = (x = d.executor) == null ? void 0 : x.executeMatrix) == null ? void 0 : T.call(
3586
- x,
3587
- I.intent,
3588
- d
3836
+ return (A = (q = l.executor) == null ? void 0 : q.executeMatrix) == null ? void 0 : A.call(
3837
+ q,
3838
+ y.intent,
3839
+ l
3589
3840
  );
3590
3841
  default:
3591
- return De(n);
3842
+ return Se(n);
3592
3843
  }
3593
3844
  },
3594
3845
  [n]
3595
- ), c = Jn(
3846
+ ), d = yi(
3596
3847
  n.request.queryKey,
3597
- p,
3848
+ f,
3598
3849
  n.request.idleData,
3599
3850
  n.request.activeInputs,
3600
- l
3601
- ), u = i.queryId, b = i.validationFailure;
3602
- B(() => {
3603
- const d = n.request.error;
3604
- if (!d) {
3605
- a.current = null;
3851
+ u
3852
+ ), c = i.queryId, m = i.validationFailure;
3853
+ $(() => {
3854
+ const l = n.request.error;
3855
+ if (!l) {
3856
+ o.current = null;
3606
3857
  return;
3607
3858
  }
3608
- const I = `${u}:${d.message}`;
3609
- a.current !== I && (a.current = I, b(d));
3859
+ const y = `${c}:${l.message}`;
3860
+ o.current !== y && (o.current = y, m(l));
3610
3861
  }, [
3611
3862
  n.request.error,
3612
3863
  n.request.queryKey,
3613
- u,
3614
- b
3864
+ c,
3865
+ m
3615
3866
  ]);
3616
- const y = n.request.error ? n.request.idleData : c.data, v = n.request.error ? "error" : c.status, g = !n.request.error && c.status === "loading", h = n.request.error || c.error, C = i.trace;
3867
+ const v = n.request.error ? n.request.idleData : d.data, S = n.request.error ? "error" : d.status, g = !n.request.error && d.status === "loading", b = n.request.error || d.error, k = i.trace;
3617
3868
  switch (n.queryKind) {
3618
3869
  case "metric": {
3619
- const d = y;
3870
+ const l = v, y = Y({
3871
+ queryKind: n.queryKind,
3872
+ status: S,
3873
+ isLoading: g,
3874
+ error: b,
3875
+ trace: k,
3876
+ payload: l,
3877
+ activeInputs: n.request.activeInputs,
3878
+ isStale: d.isStale
3879
+ });
3620
3880
  return {
3621
3881
  id: t.id,
3622
3882
  intent: n.request.intent,
3623
- value: (d == null ? void 0 : d.value) ?? null,
3624
- measures: d == null ? void 0 : d.measures,
3625
- comparisonValue: d == null ? void 0 : d.comparisonValue,
3626
- delta: d == null ? void 0 : d.delta,
3627
- deltaPercent: d == null ? void 0 : d.deltaPercent,
3628
- records: d == null ? void 0 : d.records,
3629
- executionResult: d == null ? void 0 : d.executionResult,
3630
- status: v,
3631
- isLoading: g,
3632
- error: h,
3633
- trace: C
3883
+ value: (l == null ? void 0 : l.value) ?? null,
3884
+ measures: l == null ? void 0 : l.measures,
3885
+ comparisonValue: l == null ? void 0 : l.comparisonValue,
3886
+ delta: l == null ? void 0 : l.delta,
3887
+ deltaPercent: l == null ? void 0 : l.deltaPercent,
3888
+ records: l == null ? void 0 : l.records,
3889
+ ...y
3634
3890
  };
3635
3891
  }
3636
3892
  case "analysis": {
3637
- const d = Ar(y);
3893
+ const l = Or(v), y = Y({
3894
+ queryKind: n.queryKind,
3895
+ status: S,
3896
+ isLoading: g,
3897
+ error: b,
3898
+ trace: k,
3899
+ payload: l,
3900
+ activeInputs: n.request.activeInputs,
3901
+ isStale: d.isStale
3902
+ });
3638
3903
  return {
3639
3904
  id: t.id,
3640
3905
  intent: n.request.intent,
3641
- ...d || {},
3642
- status: v,
3643
- isLoading: g,
3644
- error: h,
3645
- trace: C
3906
+ ...l || {},
3907
+ ...y
3646
3908
  };
3647
3909
  }
3648
3910
  case "records": {
3649
- const d = y;
3911
+ const l = v, y = Y({
3912
+ queryKind: n.queryKind,
3913
+ status: S,
3914
+ isLoading: g,
3915
+ error: b,
3916
+ trace: k,
3917
+ payload: l,
3918
+ activeInputs: n.request.activeInputs,
3919
+ isStale: d.isStale
3920
+ });
3650
3921
  return {
3651
3922
  id: t.id,
3652
3923
  intent: n.request.intent,
3653
- records: (d == null ? void 0 : d.records) || [],
3654
- columns: d == null ? void 0 : d.columns,
3655
- rowCount: d == null ? void 0 : d.rowCount,
3656
- pagination: d == null ? void 0 : d.pagination,
3657
- executionResult: d == null ? void 0 : d.executionResult,
3658
- status: v,
3659
- isLoading: g,
3660
- error: h,
3661
- trace: C
3924
+ records: (l == null ? void 0 : l.records) || [],
3925
+ columns: l == null ? void 0 : l.columns,
3926
+ rowCount: l == null ? void 0 : l.rowCount,
3927
+ pagination: l == null ? void 0 : l.pagination,
3928
+ ...y
3662
3929
  };
3663
3930
  }
3664
3931
  case "inputOptions": {
3665
- const d = y;
3932
+ const l = v, y = Y({
3933
+ queryKind: n.queryKind,
3934
+ status: S,
3935
+ isLoading: g,
3936
+ error: b,
3937
+ trace: k,
3938
+ payload: l,
3939
+ activeInputs: n.request.activeInputs,
3940
+ isStale: d.isStale
3941
+ });
3666
3942
  return {
3667
3943
  id: t.id,
3668
3944
  intent: n.request.intent,
3669
- options: (d == null ? void 0 : d.options) || [],
3670
- executionResult: d == null ? void 0 : d.executionResult,
3671
- status: v,
3672
- isLoading: g,
3673
- error: h,
3674
- trace: C
3945
+ options: (l == null ? void 0 : l.options) || [],
3946
+ ...y
3675
3947
  };
3676
3948
  }
3677
3949
  case "sql": {
3678
- const d = y;
3950
+ const l = v, y = Y({
3951
+ queryKind: n.queryKind,
3952
+ status: S,
3953
+ isLoading: g,
3954
+ error: b,
3955
+ trace: k,
3956
+ payload: l,
3957
+ activeInputs: n.request.activeInputs,
3958
+ isStale: d.isStale
3959
+ });
3679
3960
  return {
3680
3961
  id: t.id,
3681
3962
  intent: n.request.intent,
3682
- records: (d == null ? void 0 : d.records) || [],
3683
- columns: d == null ? void 0 : d.columns,
3684
- rowCount: d == null ? void 0 : d.rowCount,
3685
- pagination: d == null ? void 0 : d.pagination,
3686
- output: d == null ? void 0 : d.output,
3687
- rowLimitExceeded: d == null ? void 0 : d.rowLimitExceeded,
3688
- executionResult: d == null ? void 0 : d.executionResult,
3689
- status: v,
3690
- isLoading: g,
3691
- error: h,
3692
- trace: C
3963
+ records: (l == null ? void 0 : l.records) || [],
3964
+ columns: l == null ? void 0 : l.columns,
3965
+ rowCount: l == null ? void 0 : l.rowCount,
3966
+ pagination: l == null ? void 0 : l.pagination,
3967
+ output: l == null ? void 0 : l.output,
3968
+ rowLimitExceeded: l == null ? void 0 : l.rowLimitExceeded,
3969
+ ...y
3693
3970
  };
3694
3971
  }
3695
3972
  case "matrix": {
3696
- const d = y;
3973
+ const l = v, y = Y({
3974
+ queryKind: n.queryKind,
3975
+ status: S,
3976
+ isLoading: g,
3977
+ error: b,
3978
+ trace: k,
3979
+ payload: l,
3980
+ activeInputs: n.request.activeInputs,
3981
+ isStale: d.isStale
3982
+ });
3697
3983
  return {
3698
3984
  id: t.id,
3699
3985
  intent: n.request.intent,
3700
- matrixResult: d == null ? void 0 : d.matrixResult,
3701
- grid: d == null ? void 0 : d.grid,
3702
- expansion: d == null ? void 0 : d.expansion,
3703
- executionResult: d == null ? void 0 : d.executionResult,
3704
- status: v,
3705
- isLoading: g,
3706
- error: h,
3707
- trace: C
3986
+ matrixResult: l == null ? void 0 : l.matrixResult,
3987
+ grid: l == null ? void 0 : l.grid,
3988
+ expansion: l == null ? void 0 : l.expansion,
3989
+ ...y
3708
3990
  };
3709
3991
  }
3710
3992
  default:
3711
- return De(n);
3993
+ return Se(n);
3712
3994
  }
3713
3995
  }
3714
- function Jn(e, r, t, n, i) {
3715
- const a = Fn(), l = L(r), p = L(n), [c, u] = Q({
3996
+ function Y(e) {
3997
+ var o, u, f;
3998
+ const r = pi(e.payload) ?? ((o = e.error) == null ? void 0 : o.executionResult), t = ((u = e.error) == null ? void 0 : u.validation) ?? (r == null ? void 0 : r.validation), n = r == null ? void 0 : r.coverage, i = r == null ? void 0 : r.diagnosticFeedback;
3999
+ return {
4000
+ status: e.status,
4001
+ executionStatus: r == null ? void 0 : r.status,
4002
+ executionResult: r,
4003
+ validation: t,
4004
+ coverage: n,
4005
+ diagnosticFeedback: i,
4006
+ isLoading: e.isLoading,
4007
+ isEmpty: mi(e.queryKind, e.payload, e.status),
4008
+ isPartial: gi(e.payload, r),
4009
+ isFiltered: !!((f = e.activeInputs) != null && f.some(
4010
+ (d) => d.kind === "filter" && d.isActive
4011
+ )),
4012
+ isStale: e.isStale,
4013
+ isValidated: !!t,
4014
+ error: e.error,
4015
+ trace: e.trace
4016
+ };
4017
+ }
4018
+ function pi(e) {
4019
+ const r = e;
4020
+ return r == null ? void 0 : r.executionResult;
4021
+ }
4022
+ function gi(e, r) {
4023
+ var n, i;
4024
+ const t = !!(e != null && e.rowLimitExceeded);
4025
+ return !!((r == null ? void 0 : r.status) === "partial" || ((n = r == null ? void 0 : r.diagnosticFeedback) == null ? void 0 : n.status) === "partial" || (r == null ? void 0 : r.status) !== "failed" && ((i = r == null ? void 0 : r.coverage) != null && i.missingObligations.length) || t);
4026
+ }
4027
+ function mi(e, r, t) {
4028
+ var n, i, o, u, f;
4029
+ if (t !== "success")
4030
+ return !1;
4031
+ switch (e) {
4032
+ case "metric": {
4033
+ const d = r;
4034
+ return (d == null ? void 0 : d.value) == null && !B(d == null ? void 0 : d.records);
4035
+ }
4036
+ case "analysis": {
4037
+ const d = r;
4038
+ return d ? !d.answerSummary && !B(d.records) && !B(d.changes) && !B(d.drivers) && !B(d.largestNegativeChanges) && !B(d.largestPositiveChanges) && !B(d.largestNegativeDrivers) && !B(d.largestPositiveDrivers) && !Object.values(d.resultSets || {}).some(
4039
+ (c) => B(c.records)
4040
+ ) : !0;
4041
+ }
4042
+ case "records": {
4043
+ const d = r;
4044
+ return !B(d == null ? void 0 : d.records);
4045
+ }
4046
+ case "sql": {
4047
+ const d = r;
4048
+ return !B(d == null ? void 0 : d.records) && (d == null ? void 0 : d.output) === void 0;
4049
+ }
4050
+ case "inputOptions": {
4051
+ const d = r;
4052
+ return !((n = d == null ? void 0 : d.options) != null && n.length);
4053
+ }
4054
+ case "matrix": {
4055
+ const d = r;
4056
+ return !((o = (i = d == null ? void 0 : d.matrixResult) == null ? void 0 : i.cells) != null && o.length) && !((f = (u = d == null ? void 0 : d.grid) == null ? void 0 : u.cells) != null && f.length);
4057
+ }
4058
+ default:
4059
+ return Se(e);
4060
+ }
4061
+ }
4062
+ function B(e) {
4063
+ return Array.isArray(e) && e.length > 0;
4064
+ }
4065
+ function yi(e, r, t, n, i) {
4066
+ const o = ui(), u = D(r), f = D(n), [d, c] = M({
3716
4067
  status: "idle",
3717
4068
  data: t,
3718
- error: null
4069
+ error: null,
4070
+ isStale: !1
3719
4071
  });
3720
- return l.current = r, p.current = n, B(() => {
3721
- let b;
4072
+ return u.current = r, f.current = n, $(() => {
4073
+ let m;
3722
4074
  try {
3723
- b = l.current({
3724
- ...a,
3725
- activeInputs: p.current
4075
+ m = u.current({
4076
+ ...o,
4077
+ activeInputs: f.current
3726
4078
  });
3727
4079
  } catch (g) {
3728
- i == null || i.failure(g, 0), u({
4080
+ i == null || i.failure(g, 0), c({
3729
4081
  status: "error",
3730
4082
  data: t,
3731
- error: z(g)
4083
+ error: Fe(g),
4084
+ isStale: !1
3732
4085
  });
3733
4086
  return;
3734
4087
  }
3735
- if (!b) {
3736
- u({ status: "idle", data: t, error: null });
4088
+ if (!m) {
4089
+ c({ status: "idle", data: t, error: null, isStale: !1 });
3737
4090
  return;
3738
4091
  }
3739
- let y = !1;
3740
- const v = Cr();
3741
- return i == null || i.start(), u((g) => ({
4092
+ let v = !1;
4093
+ const S = Wr();
4094
+ return i == null || i.start(), c((g) => ({
3742
4095
  status: "loading",
3743
4096
  data: g.data,
3744
- error: null
3745
- })), b.then((g) => {
3746
- y ? i == null || i.ignored("superseded") : (i == null || i.success(g, tr(v)), u({ status: "success", data: g, error: null }));
4097
+ error: null,
4098
+ isStale: g.isStale || g.status === "success"
4099
+ })), m.then((g) => {
4100
+ v ? i == null || i.ignored("superseded") : (i == null || i.success(g, ur(S)), c({ status: "success", data: g, error: null, isStale: !1 }));
3747
4101
  }).catch((g) => {
3748
- y ? i == null || i.ignored("superseded") : (i == null || i.failure(g, tr(v)), u({
4102
+ v ? i == null || i.ignored("superseded") : (i == null || i.failure(g, ur(S)), c({
3749
4103
  status: "error",
3750
4104
  data: t,
3751
- error: z(g)
4105
+ error: Fe(g),
4106
+ isStale: !1
3752
4107
  }));
3753
4108
  }), () => {
3754
- y = !0;
4109
+ v = !0;
3755
4110
  };
3756
- }, [t, e, a, i]), c;
4111
+ }, [t, e, o, i]), d;
3757
4112
  }
3758
- function Cr() {
4113
+ function Wr() {
3759
4114
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
3760
4115
  }
3761
- function tr(e) {
3762
- return Math.max(0, Math.round(Cr() - e));
4116
+ function ur(e) {
4117
+ return Math.max(0, Math.round(Wr() - e));
3763
4118
  }
3764
- function Yn(e) {
4119
+ function hi(e) {
3765
4120
  return Object.fromEntries(
3766
4121
  e.filter((r) => r.defaultValue !== void 0).map((r) => [r.id, r.defaultValue])
3767
4122
  );
3768
4123
  }
3769
- function De(e) {
4124
+ function Se(e) {
3770
4125
  throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`);
3771
4126
  }
3772
- function Xn(e) {
4127
+ function vi(e) {
3773
4128
  return !e || typeof e == "boolean" || e.enabled === !1 ? null : e.autoRenderDevtools === !0 ? {} : e.autoRenderDevtools ? e.autoRenderDevtools : null;
3774
4129
  }
3775
- function mi({
4130
+ function Ki({
3776
4131
  token: e,
3777
4132
  apiBaseUrl: r,
3778
4133
  executor: t,
@@ -3780,33 +4135,33 @@ function mi({
3780
4135
  children: i
3781
4136
  }) {
3782
4137
  var g;
3783
- const a = Kn(), l = ((g = a == null ? void 0 : a.authToken) == null ? void 0 : g.accessToken) || e, p = (a == null ? void 0 : a.dataApiBaseUrl) || (a == null ? void 0 : a.apiBaseUrl) || r, c = (a == null ? void 0 : a.debug) ?? n, u = Xn(c), b = w(() => Rn(), []), y = t || b, v = w(
4138
+ const o = li(), u = ((g = o == null ? void 0 : o.authToken) == null ? void 0 : g.accessToken) || e, f = (o == null ? void 0 : o.dataApiBaseUrl) || (o == null ? void 0 : o.apiBaseUrl) || r, d = (o == null ? void 0 : o.debug) ?? n, c = vi(d), m = w(() => Zn(), []), v = t || m, S = w(
3784
4139
  () => ({
3785
- token: l,
3786
- apiBaseUrl: p,
3787
- executor: y,
3788
- debug: c
4140
+ token: u,
4141
+ apiBaseUrl: f,
4142
+ executor: v,
4143
+ debug: d
3789
4144
  }),
3790
- [p, c, y, l]
4145
+ [f, d, v, u]
3791
4146
  );
3792
- return /* @__PURE__ */ s(Yr, { debug: c, children: /* @__PURE__ */ f(Rr.Provider, { value: v, children: [
4147
+ return /* @__PURE__ */ a(lt, { debug: d, children: /* @__PURE__ */ p(Kr.Provider, { value: S, children: [
3793
4148
  i,
3794
- u ? /* @__PURE__ */ s(et, { ...u }) : null
4149
+ c ? /* @__PURE__ */ a(ft, { ...c }) : null
3795
4150
  ] }) });
3796
4151
  }
3797
4152
  export {
3798
- mi as SemaphorDataAppProvider,
3799
- et as SemaphorDevtools,
3800
- ui as SemaphorDevtoolsInspectButton,
3801
- li as SemaphorViewBoundary,
3802
- Rn as createSemaphorQueryExecutor,
3803
- si as defineSemaphorDataApp,
3804
- ai as defineSemaphorInput,
3805
- Un as isSemaphorInputValueValidForOptions,
3806
- di as semaphor,
3807
- pi as useClearInvalidSemaphorInputValue,
3808
- lr as useSemaphorDevtools,
3809
- ci as useSemaphorInput,
3810
- fi as useSemaphorInputs,
3811
- gi as useSemaphorQuery
4153
+ Ki as SemaphorDataAppProvider,
4154
+ ft as SemaphorDevtools,
4155
+ Di as SemaphorDevtoolsInspectButton,
4156
+ Ri as SemaphorViewBoundary,
4157
+ Zn as createSemaphorQueryExecutor,
4158
+ Ti as defineSemaphorDataApp,
4159
+ Ci as defineSemaphorInput,
4160
+ ci as isSemaphorInputValueValidForOptions,
4161
+ ki as semaphor,
4162
+ Bi as useClearInvalidSemaphorInputValue,
4163
+ hr as useSemaphorDevtools,
4164
+ Li as useSemaphorInput,
4165
+ Oi as useSemaphorInputs,
4166
+ $i as useSemaphorQuery
3812
4167
  };