react-semaphor 0.1.389 → 0.1.391

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.
@@ -1,24 +1,24 @@
1
- import { toSemaphorInputSnapshots as Tr, toSemaphorInputBinding as kr, toSemaphorActiveInputSnapshots as Y, toSemaphorMatrixIntent as Cr, toSemaphorSqlIntent as Dr, toSemaphorInputOptionsIntent as Lr, toSemaphorRecordsIntent as Or, toSemaphorAnalysisQueryOptions as Br, toSemaphorAnalysisIntent as Kr, toSemaphorMetricIntent as Nr, hasSemaphorInputValue as oe, normalizeSemaphorInputOptions as nr, toSemaphorInputSpec as ir } from "../data-app-sdk-adapters/index.js";
2
- import { jsxs as p, Fragment as or, jsx as o } from "react/jsx-runtime";
3
- import { createContext as ye, useContext as Q, useState as V, useRef as D, useEffect as K, useMemo as b, Fragment as $r, useId as sr, useCallback as O, useReducer as Wr } from "react";
4
- import { M as Fr, a as _r, S as zr, E as Hr } from "../chunks/search-0LmWwZzW.js";
5
- import { X as Mr, j as jr } from "../chunks/x-IdR_js6f.js";
6
- import { b as Pr } from "../chunks/validators-CHPH6ORs.js";
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
7
  import "../chunks/analyze-result-contract-DuhlklhI.js";
8
- function le(e, r, t = {}) {
8
+ function fe(e, r, t = {}) {
9
9
  return {
10
10
  ...t,
11
11
  name: e,
12
12
  role: r
13
13
  };
14
14
  }
15
- function ri(e) {
15
+ function si(e) {
16
16
  return e;
17
17
  }
18
- function ti(e) {
18
+ function ai(e) {
19
19
  return e;
20
20
  }
21
- const ni = {
21
+ const di = {
22
22
  source: {
23
23
  semantic(e) {
24
24
  return {
@@ -35,16 +35,16 @@ const ni = {
35
35
  },
36
36
  field: {
37
37
  measure(e, r) {
38
- return le(e, "measure", r);
38
+ return fe(e, "measure", r);
39
39
  },
40
40
  dimension(e, r) {
41
- return le(e, "dimension", r);
41
+ return fe(e, "dimension", r);
42
42
  },
43
43
  date(e, r) {
44
- return le(e, "date", r);
44
+ return fe(e, "date", r);
45
45
  },
46
46
  id(e, r) {
47
- return le(e, "id", r);
47
+ return fe(e, "id", r);
48
48
  }
49
49
  },
50
50
  filter(e) {
@@ -56,7 +56,7 @@ const ni = {
56
56
  bindInput(e, r) {
57
57
  return {
58
58
  toAnalyticsInput() {
59
- const [t] = Tr([e]), n = kr({
59
+ const [t] = Lr([e]), n = Dr({
60
60
  ...r,
61
61
  inputId: r.inputId || t.inputId
62
62
  });
@@ -128,68 +128,68 @@ const ni = {
128
128
  queryKind: "matrix"
129
129
  };
130
130
  }
131
- }, be = 10, Se = 100, Qr = 25, Vr = 500, ar = {
131
+ }, qe = 10, Te = 100, Gr = 25, Jr = 500, ar = {
132
132
  enabled: !1,
133
133
  queries: [],
134
134
  getQuery: () => {
135
135
  },
136
136
  getQueries: () => []
137
- }, Le = ye(null), Oe = ye(null), Be = ye(
137
+ }, $e = Se(null), We = Se(null), Ne = Se(
138
138
  void 0
139
139
  ), P = [];
140
- function Ur({
140
+ function Yr({
141
141
  debug: e,
142
142
  children: r
143
143
  }) {
144
- const t = b(() => Zt(e), [e]), [n, i] = Wr(
145
- Mt,
144
+ const t = w(() => on(e), [e]), [n, i] = zr(
145
+ Ut,
146
146
  t,
147
- hr
148
- ), d = D(n), l = sr(), [c, u] = V({ open: !1 });
149
- d.current = n, K(() => {
147
+ Sr
148
+ ), a = L(n), l = sr(), [p, c] = Q({ open: !1 });
149
+ a.current = n, B(() => {
150
150
  i({ type: "config", config: t });
151
- }, [t]), K(() => {
151
+ }, [t]), B(() => {
152
152
  if (!n.enabled || !n.exposeWindowBridge || typeof window > "u")
153
153
  return;
154
- const S = Gt(() => d.current);
155
- return Gr({
154
+ const h = en(() => a.current);
155
+ return Xr({
156
156
  ownerId: l,
157
- bridge: S
157
+ bridge: h
158
158
  }), () => {
159
- Jr(l);
159
+ Zr(l);
160
160
  };
161
161
  }, [l, n.enabled, n.exposeWindowBridge]);
162
- const f = b(() => ({ state: n, dispatch: i }), [n]), m = O((S) => {
163
- u({ open: !0, focus: S });
162
+ const u = w(() => ({ state: n, dispatch: i }), [n]), b = O((h) => {
163
+ c({ open: !0, focus: h });
164
164
  }, []), y = O(() => {
165
- u((S) => ({ ...S, open: !1 }));
166
- }, []), h = O((S) => {
167
- u({ open: !0, focus: S });
168
- }, []), g = b(
165
+ c((h) => ({ ...h, open: !1 }));
166
+ }, []), v = O((h) => {
167
+ c({ open: !0, focus: h });
168
+ }, []), g = w(
169
169
  () => ({
170
- open: c.open,
171
- focus: c.focus,
172
- openDevtools: m,
170
+ open: p.open,
171
+ focus: p.focus,
172
+ openDevtools: b,
173
173
  closeDevtools: y,
174
- focusTrace: h
174
+ focusTrace: v
175
175
  }),
176
176
  [
177
177
  y,
178
- h,
179
- m,
180
- c.focus,
181
- c.open
178
+ v,
179
+ b,
180
+ p.focus,
181
+ p.open
182
182
  ]
183
183
  );
184
- return /* @__PURE__ */ o(Le.Provider, { value: f, children: /* @__PURE__ */ o(Oe.Provider, { value: g, children: r }) });
184
+ return /* @__PURE__ */ s($e.Provider, { value: u, children: /* @__PURE__ */ s(We.Provider, { value: g, children: r }) });
185
185
  }
186
- function Gr(e) {
186
+ function Xr(e) {
187
187
  const r = P.findIndex(
188
188
  (t) => t.ownerId === e.ownerId
189
189
  );
190
190
  r >= 0 && P.splice(r, 1), P.push(e), dr();
191
191
  }
192
- function Jr(e) {
192
+ function Zr(e) {
193
193
  const r = P.findIndex(
194
194
  (t) => t.ownerId === e
195
195
  );
@@ -201,216 +201,243 @@ function dr() {
201
201
  const e = P[P.length - 1];
202
202
  e ? window.__SEMAPHOR_DEVTOOLS__ = e.bridge : delete window.__SEMAPHOR_DEVTOOLS__;
203
203
  }
204
- function ii({
204
+ function li({
205
205
  id: e,
206
206
  title: r,
207
207
  children: t
208
208
  }) {
209
- const n = b(() => ({ id: e, title: r }), [e, r]);
210
- return /* @__PURE__ */ o(Be.Provider, { value: n, children: t });
209
+ const n = w(() => ({ id: e, title: r }), [e, r]);
210
+ return /* @__PURE__ */ s(Ne.Provider, { value: n, children: t });
211
211
  }
212
- function Yr({
212
+ function et({
213
213
  buttonPosition: e = "bottom-right",
214
214
  initialIsOpen: r = !1,
215
215
  panelPosition: t = "right",
216
216
  className: n,
217
217
  style: i
218
218
  } = {}) {
219
- const d = lr(), l = Q(Oe), [c, u] = V(""), [f, m] = V(!1), y = D(null), h = D(null), g = l == null ? void 0 : l.openDevtools, S = l == null ? void 0 : l.closeDevtools, k = (l == null ? void 0 : l.open) === !0;
220
- K(() => {
221
- yr();
222
- }, []), K(() => {
223
- r && d.enabled && (g == null || g());
224
- }, [r, d.enabled, g]), K(() => {
225
- if (!k || !S)
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)
226
226
  return;
227
- const v = (w) => {
228
- var I, E;
229
- const A = w.target;
230
- A instanceof Node && ((I = y.current) != null && I.contains(A) || (E = h.current) != null && E.contains(A) || S());
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());
231
231
  };
232
- return document.addEventListener("pointerdown", v, !0), document.addEventListener("mousedown", v, !0), document.addEventListener("click", v, !0), () => {
233
- document.removeEventListener("pointerdown", v, !0), document.removeEventListener("mousedown", v, !0), document.removeEventListener("click", v, !0);
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
234
  };
235
- }, [S, k]);
236
- const a = b(
237
- () => gt(d.queries),
238
- [d.queries]
239
- ), x = mt(a), C = b(
240
- () => yt(d.queries, c),
241
- [d.queries, c]
242
- ), L = b(
243
- () => ht(C),
244
- [C]
245
- ), B = b(
246
- () => ur(C, l == null ? void 0 : l.focus) || C[0],
247
- [C, l == null ? void 0 : l.focus]
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]
245
+ ), 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
251
  );
249
- return !d.enabled || !l ? null : /* @__PURE__ */ p(or, { children: [
250
- /* @__PURE__ */ p(
252
+ return !a.enabled || !l ? null : /* @__PURE__ */ f(or, { children: [
253
+ /* @__PURE__ */ f(
251
254
  "button",
252
255
  {
253
256
  ref: y,
254
257
  type: "button",
255
258
  "aria-label": "Open Semaphor Inspector",
256
- title: x,
257
- className: n ? `${$} ${n}` : $,
259
+ title: $,
260
+ className: n ? `${K} ${n}` : K,
258
261
  style: {
259
- ...s.launcher,
260
- ...Nt(e),
261
- ...$t(a.severity),
262
+ ...o.launcher,
263
+ ...zt(e),
264
+ ...Mt(d.severity),
262
265
  ...i
263
266
  },
264
- onClick: () => l.openDevtools(),
267
+ 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
275
+ } : void 0
276
+ );
277
+ },
265
278
  children: [
266
- /* @__PURE__ */ o(Zr, {}),
267
- /* @__PURE__ */ o("span", { style: s.launcherText, children: a.total }),
268
- a.issueCount > 0 ? /* @__PURE__ */ p("span", { style: s.launcherIssueCount, children: [
269
- a.issueCount,
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,
270
283
  " issue",
271
- a.issueCount === 1 ? "" : "s"
284
+ d.issueCount === 1 ? "" : "s"
272
285
  ] }) : null
273
286
  ]
274
287
  }
275
288
  ),
276
- l.open ? /* @__PURE__ */ p(
289
+ l.open ? /* @__PURE__ */ f(
277
290
  "div",
278
291
  {
279
- ref: h,
292
+ ref: v,
280
293
  role: "dialog",
281
294
  "aria-label": "Semaphor Inspector",
282
295
  "aria-modal": "false",
283
- className: $,
296
+ className: K,
284
297
  style: {
285
- ...s.panel,
286
- ...Wt(t),
287
- ...f ? s.panelFullscreen : null
298
+ ...o.panel,
299
+ ...Ht(t),
300
+ ...u ? o.panelFullscreen : null
288
301
  },
289
302
  children: [
290
- /* @__PURE__ */ p("div", { style: s.panelHeader, children: [
291
- /* @__PURE__ */ p("div", { style: s.panelTitleBlock, children: [
292
- /* @__PURE__ */ o("div", { style: s.panelTitle, children: "Semaphor Inspector" }),
293
- /* @__PURE__ */ p("div", { style: s.panelSubtitle, children: [
294
- a.total,
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,
295
308
  " queries · ",
296
- a.loading,
309
+ d.loading,
297
310
  " loading ·",
298
311
  " ",
299
- a.failed,
300
- " failed"
312
+ d.failed,
313
+ " failed · ",
314
+ d.warningCount,
315
+ " warnings"
301
316
  ] })
302
317
  ] }),
303
- /* @__PURE__ */ p("div", { style: s.panelActions, children: [
304
- /* @__PURE__ */ o(
318
+ /* @__PURE__ */ f("div", { style: o.panelActions, children: [
319
+ /* @__PURE__ */ s(
305
320
  "button",
306
321
  {
307
322
  type: "button",
308
- "aria-label": f ? "Exit fullscreen Semaphor Inspector" : "Enter fullscreen Semaphor Inspector",
309
- title: f ? "Exit fullscreen Semaphor Inspector" : "Enter fullscreen Semaphor Inspector",
310
- style: s.iconButton,
311
- onClick: () => m((v) => !v),
312
- children: f ? /* @__PURE__ */ o(Fr, { size: 15 }) : /* @__PURE__ */ o(_r, { size: 15 })
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 })
313
328
  }
314
329
  ),
315
- /* @__PURE__ */ o(
330
+ /* @__PURE__ */ s(
316
331
  "button",
317
332
  {
318
333
  type: "button",
319
334
  "aria-label": "Close Semaphor Inspector",
320
- style: s.iconButton,
335
+ style: o.iconButton,
321
336
  onClick: l.closeDevtools,
322
- children: /* @__PURE__ */ o(Mr, { size: 15 })
337
+ children: /* @__PURE__ */ s(Vr, { size: 15 })
323
338
  }
324
339
  )
325
340
  ] })
326
341
  ] }),
327
- /* @__PURE__ */ p("label", { style: s.searchBox, children: [
328
- /* @__PURE__ */ o(zr, { size: 14 }),
329
- /* @__PURE__ */ o(
342
+ /* @__PURE__ */ f("label", { style: o.searchBox, children: [
343
+ /* @__PURE__ */ s(jr, { size: 14 }),
344
+ /* @__PURE__ */ s(
330
345
  "input",
331
346
  {
332
347
  "aria-label": "Search Semaphor traces",
333
- value: c,
334
- onChange: (v) => u(v.currentTarget.value),
348
+ value: p,
349
+ onChange: (m) => c(m.currentTarget.value),
335
350
  placeholder: "Search traces",
336
- style: s.searchInput
351
+ style: o.searchInput
337
352
  }
338
353
  )
339
354
  ] }),
340
- /* @__PURE__ */ p(
355
+ I.length ? /* @__PURE__ */ s(
356
+ it,
357
+ {
358
+ issues: I,
359
+ onSelect: (m) => l.focusTrace({
360
+ traceId: m.traceId,
361
+ queryId: m.queryId,
362
+ viewId: m.viewId
363
+ })
364
+ }
365
+ ) : null,
366
+ /* @__PURE__ */ f(
341
367
  "div",
342
368
  {
343
369
  style: {
344
- ...s.panelBody,
345
- ...Ft(t)
370
+ ...o.panelBody,
371
+ ...jt(t)
346
372
  },
347
373
  children: [
348
- /* @__PURE__ */ o(
374
+ /* @__PURE__ */ s(
349
375
  "div",
350
376
  {
351
377
  style: {
352
- ...s.queryList,
353
- ..._t()
378
+ ...o.queryList,
379
+ ...Pt()
354
380
  },
355
381
  "aria-label": "Registered queries",
356
- children: C.length ? L.map((v) => /* @__PURE__ */ p("div", { style: s.queryGroup, children: [
357
- /* @__PURE__ */ p("div", { style: s.queryGroupHeader, children: [
358
- /* @__PURE__ */ o("span", { children: v.title }),
359
- /* @__PURE__ */ o("span", { style: s.queryGroupCount, children: v.traces.length })
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 })
360
386
  ] }),
361
- v.traces.length ? v.traces.map((w) => {
362
- var R;
363
- const A = bt(w, B), I = Ke(w), E = pr(w), z = gr(w), Z = wt(w, I, z), ee = Z.join(" · "), ae = cr(E);
364
- return /* @__PURE__ */ p(
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(
365
391
  "button",
366
392
  {
367
393
  type: "button",
368
- title: `${I} · ${E} · ${ee}`,
394
+ title: `${x} · ${T} · ${te}`,
369
395
  style: {
370
- ...s.queryListItem,
371
- ...A ? s.queryListItemSelected : null
396
+ ...o.queryListItem,
397
+ ...k ? o.queryListItemSelected : null
372
398
  },
373
399
  onClick: () => l.focusTrace({
374
- traceId: w.traceId,
375
- queryId: w.queryId,
376
- viewId: w.viewId
400
+ traceId: S.traceId,
401
+ queryId: S.queryId,
402
+ viewId: S.viewId
377
403
  }),
378
404
  children: [
379
- /* @__PURE__ */ p("span", { style: s.queryListItemHeader, children: [
380
- /* @__PURE__ */ o(rt, { status: (R = w.latestAttempt) == null ? void 0 : R.status }),
381
- /* @__PURE__ */ o("span", { style: s.queryListTitle, title: I, children: I }),
382
- /* @__PURE__ */ o(
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(
383
409
  "span",
384
410
  {
385
411
  style: {
386
- ...s.queryListKindChip,
387
- ...fr(ae)
412
+ ...o.queryListKindChip,
413
+ ...gr(E)
388
414
  },
389
- children: E
415
+ children: T
390
416
  }
391
- )
417
+ ),
418
+ M > 0 ? /* @__PURE__ */ s("span", { style: o.queryListIssueBadge, children: M }) : null
392
419
  ] }),
393
- /* @__PURE__ */ o(
420
+ /* @__PURE__ */ s(
394
421
  "span",
395
422
  {
396
- className: `${$}-source`,
397
- style: s.queryListSource,
398
- title: ee,
399
- children: Z.map((H, re) => /* @__PURE__ */ p($r, { children: [
400
- re > 0 ? /* @__PURE__ */ o("span", { style: s.queryListSubtitleSep, children: " · " }) : null,
401
- /* @__PURE__ */ o("span", { children: H })
402
- ] }, `${H}:${re}`))
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}`))
403
430
  }
404
431
  )
405
432
  ]
406
433
  },
407
- Ce(w)
434
+ Oe(S)
408
435
  );
409
- }) : /* @__PURE__ */ o("div", { style: s.queryGroupEmpty, children: "No input traces" })
410
- ] }, v.title)) : /* @__PURE__ */ o("div", { style: s.emptyState, children: "No matching traces" })
436
+ }) : /* @__PURE__ */ s("div", { style: o.queryGroupEmpty, children: "No input traces" })
437
+ ] }, m.title)) : /* @__PURE__ */ s("div", { style: o.emptyState, children: "No matching traces" })
411
438
  }
412
439
  ),
413
- /* @__PURE__ */ o(et, { trace: B })
440
+ /* @__PURE__ */ s(nt, { trace: D })
414
441
  ]
415
442
  }
416
443
  )
@@ -419,229 +446,229 @@ function Yr({
419
446
  ) : null
420
447
  ] });
421
448
  }
422
- function oi({
449
+ function ui({
423
450
  queryId: e,
424
451
  viewId: r,
425
452
  label: t,
426
453
  className: n,
427
454
  style: i
428
455
  } = {}) {
429
- var y, h;
430
- const d = lr(), l = Q(Oe), c = Q(Be);
431
- K(() => {
432
- yr();
456
+ var y, v;
457
+ const a = lr(), l = V(We), p = V(Ne);
458
+ B(() => {
459
+ vr();
433
460
  }, []);
434
- const u = r || (c == null ? void 0 : c.id), f = b(
435
- () => vt(d.queries, {
461
+ const c = r || (p == null ? void 0 : p.id), u = w(
462
+ () => xt(a.queries, {
436
463
  queryId: e,
437
- viewId: u
464
+ viewId: c
438
465
  }),
439
466
  [
440
- d.queries,
467
+ a.queries,
441
468
  e,
442
- u
469
+ c
443
470
  ]
444
471
  );
445
- if (!d.enabled || !l || !f)
472
+ if (!a.enabled || !l || !u)
446
473
  return null;
447
- const m = t || `Inspect ${xt(f, !!e)}`;
448
- return /* @__PURE__ */ p(
474
+ const b = t || `Inspect ${At(u, !!e)}`;
475
+ return /* @__PURE__ */ f(
449
476
  "button",
450
477
  {
451
478
  type: "button",
452
- "aria-label": m,
453
- title: m,
454
- className: n ? `${$} ${n}` : $,
479
+ "aria-label": b,
480
+ title: b,
481
+ className: n ? `${K} ${n}` : K,
455
482
  style: {
456
- ...s.inspectButton,
457
- ...zt((y = f.latestAttempt) == null ? void 0 : y.status),
483
+ ...o.inspectButton,
484
+ ...Vt((y = u.latestAttempt) == null ? void 0 : y.status),
458
485
  ...i
459
486
  },
460
487
  onClick: () => l.openDevtools({
461
- traceId: f.traceId,
462
- queryId: f.queryId,
463
- viewId: f.viewId
488
+ traceId: u.traceId,
489
+ queryId: u.queryId,
490
+ viewId: u.viewId
464
491
  }),
465
492
  children: [
466
- /* @__PURE__ */ o(Hr, { size: 13 }),
467
- /* @__PURE__ */ o("span", { style: s.inspectButtonText, children: ((h = f.latestAttempt) == null ? void 0 : h.status) || "idle" })
493
+ /* @__PURE__ */ s(Pr, { size: 13 }),
494
+ /* @__PURE__ */ s("span", { style: o.inspectButtonText, children: ((v = u.latestAttempt) == null ? void 0 : v.status) || "idle" })
468
495
  ]
469
496
  }
470
497
  );
471
498
  }
472
499
  function lr() {
473
- const e = Q(Le);
474
- return !e || !e.state.enabled ? ar : ge(e.state);
500
+ const e = V($e);
501
+ return !e || !e.state.enabled ? ar : be(e.state);
475
502
  }
476
- function Xr({
503
+ function rt({
477
504
  spec: e,
478
505
  queryKind: r,
479
506
  queryKey: t,
480
507
  intent: n,
481
508
  activeInputs: i,
482
- debug: d
509
+ debug: a
483
510
  }) {
484
- const l = Q(Le), c = Q(Be), u = !!(l != null && l.state.enabled), f = l == null ? void 0 : l.dispatch, m = rn(e), y = e.label, h = b(
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(
485
512
  () => JSON.stringify(e),
486
513
  [e]
487
- ), g = b(
514
+ ), g = w(
488
515
  () => JSON.stringify(i || []),
489
516
  [i]
490
- ), S = b(
517
+ ), h = w(
491
518
  () => JSON.stringify(n || null),
492
519
  [n]
493
- ), k = D(e), a = D(h), x = D(n), C = D(S), L = D(i), B = D(g), v = en(d), w = JSON.stringify(v || []), A = D(v), I = D(w);
494
- a.current !== h && (a.current = h, k.current = e), C.current !== S && (C.current = S, x.current = n), B.current !== g && (B.current = g, L.current = i), I.current !== w && (I.current = w, A.current = v);
495
- const E = k.current, z = x.current, Z = L.current, ee = A.current, ae = sr(), R = b(
496
- () => m || `query_${xr(t)}`,
497
- [t, m]
498
- ), H = (d == null ? void 0 : d.viewId) || (c == null ? void 0 : c.id), re = (d == null ? void 0 : d.viewTitle) || (d == null ? void 0 : d.title) || (c == null ? void 0 : c.title), Fe = d == null ? void 0 : d.visualType, _e = d == null ? void 0 : d.sectionTitle, M = b(
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(
499
526
  () => [
500
- H || "unscoped-view",
501
- R,
502
- ae
527
+ M || "unscoped-view",
528
+ E,
529
+ te
503
530
  ].join("::"),
504
- [R, ae, H]
505
- ), ze = b(
531
+ [E, te, M]
532
+ ), ze = w(
506
533
  () => ({
507
- traceKey: M,
508
- spec: E,
509
- queryId: R,
534
+ traceKey: H,
535
+ spec: x,
536
+ queryId: E,
510
537
  queryLabel: y,
511
538
  queryKind: r,
512
- builder: tn(r),
513
- viewId: H,
514
- viewTitle: re,
515
- visualType: Fe,
516
- sectionTitle: _e,
517
- sourceHints: ee,
518
- intent: z,
519
- activeInputs: Z,
520
- clientWarnings: m ? [] : ["Query spec is missing an explicit id; using an opaque internal id."]
539
+ builder: dn(r),
540
+ viewId: M,
541
+ viewTitle: ne,
542
+ visualType: ie,
543
+ sectionTitle: oe,
544
+ sourceHints: re,
545
+ intent: T,
546
+ activeInputs: U,
547
+ clientWarnings: b ? [] : ["Query spec is missing an explicit id; using an opaque internal id."]
521
548
  }),
522
549
  [
523
- R,
550
+ E,
524
551
  r,
525
- m,
552
+ b,
526
553
  y,
527
- E,
528
- Z,
529
- z,
530
- ee,
531
- _e,
532
- M,
533
- H,
554
+ x,
555
+ U,
556
+ T,
534
557
  re,
535
- Fe
558
+ oe,
559
+ H,
560
+ M,
561
+ ne,
562
+ ie
536
563
  ]
537
564
  );
538
- K(() => {
539
- if (!(!u || !f))
540
- return f({ type: "register", descriptor: ze }), () => {
541
- f({ type: "unregister", traceKey: M });
565
+ B(() => {
566
+ if (!(!c || !u))
567
+ return u({ type: "register", descriptor: ze }), () => {
568
+ u({ type: "unregister", traceKey: H });
542
569
  };
543
- }, [ze, f, u, M]);
544
- const W = O(
545
- (T, U) => {
546
- !u || !f || f({ type: "event", traceKey: M, event: T, latestAttempt: U });
570
+ }, [ze, u, c, H]);
571
+ const F = O(
572
+ (R, G) => {
573
+ !c || !u || u({ type: "event", traceKey: H, event: R, latestAttempt: G });
547
574
  },
548
- [f, u, M]
549
- ), He = O(() => {
550
- W(
575
+ [u, c, H]
576
+ ), Me = O(() => {
577
+ F(
551
578
  {
552
579
  type: "query_started",
553
- queryId: R,
554
- at: fe()
580
+ queryId: E,
581
+ at: ye()
555
582
  },
556
583
  { status: "loading" }
557
584
  );
558
- }, [W, R]), Me = O(
559
- (T, U) => {
560
- const te = er(T), ne = cn(T), Er = fn(T);
561
- W(
585
+ }, [F, E]), He = O(
586
+ (R, G) => {
587
+ const se = er(R), ae = yn(R), kr = hn(R);
588
+ F(
562
589
  {
563
590
  type: "query_succeeded",
564
- queryId: R,
565
- requestId: te,
566
- at: fe(),
567
- rowCount: ne,
568
- durationMs: U
591
+ queryId: E,
592
+ requestId: se,
593
+ at: ye(),
594
+ rowCount: ae,
595
+ durationMs: G
569
596
  },
570
597
  {
571
- requestId: te,
598
+ requestId: se,
572
599
  status: "success",
573
- durationMs: U,
574
- rowCount: ne,
575
- columnCount: Er,
576
- executionResult: Ze(T)
600
+ durationMs: G,
601
+ rowCount: ae,
602
+ columnCount: kr,
603
+ executionResult: Ze(R)
577
604
  }
578
605
  );
579
606
  },
580
- [W, R]
581
- ), de = O(
582
- (T, U) => {
583
- const te = er(T), ne = T instanceof Error ? T.message : String(T);
584
- W(
607
+ [F, E]
608
+ ), ce = O(
609
+ (R, G) => {
610
+ const se = er(R), ae = R instanceof Error ? R.message : String(R);
611
+ F(
585
612
  {
586
613
  type: "query_failed",
587
- queryId: R,
588
- requestId: te,
589
- at: fe(),
590
- errorMessage: ne
614
+ queryId: E,
615
+ requestId: se,
616
+ at: ye(),
617
+ errorMessage: ae
591
618
  },
592
619
  {
593
- requestId: te,
620
+ requestId: se,
594
621
  status: "error",
595
- durationMs: U,
596
- errorMessage: ne,
597
- executionResult: Ze(T)
622
+ durationMs: G,
623
+ errorMessage: ae,
624
+ executionResult: Ze(R)
598
625
  }
599
626
  );
600
627
  },
601
- [W, R]
628
+ [F, E]
602
629
  ), je = O(
603
- (T) => {
604
- W(
630
+ (R) => {
631
+ F(
605
632
  {
606
633
  type: "query_ignored_stale",
607
- queryId: R,
608
- at: fe(),
609
- reason: T
634
+ queryId: E,
635
+ at: ye(),
636
+ reason: R
610
637
  }
611
638
  );
612
639
  },
613
- [W, R]
640
+ [F, E]
614
641
  ), Pe = O(
615
- (T) => {
616
- de(T, 0);
642
+ (R) => {
643
+ ce(R, 0);
617
644
  },
618
- [de]
619
- ), ve = u ? l == null ? void 0 : l.state.entries[M] : void 0;
620
- return b(
645
+ [ce]
646
+ ), xe = c ? l == null ? void 0 : l.state.entries[H] : void 0;
647
+ return w(
621
648
  () => ({
622
- enabled: u,
623
- queryId: R,
624
- trace: ve ? pe(ve) : void 0,
625
- start: He,
626
- success: Me,
627
- failure: de,
649
+ enabled: c,
650
+ queryId: E,
651
+ trace: xe ? he(xe) : void 0,
652
+ start: Me,
653
+ success: He,
654
+ failure: ce,
628
655
  ignored: je,
629
656
  validationFailure: Pe
630
657
  }),
631
658
  [
632
- u,
633
- de,
659
+ c,
660
+ ce,
634
661
  je,
635
- R,
636
- He,
662
+ E,
637
663
  Me,
638
- ve,
664
+ He,
665
+ xe,
639
666
  Pe
640
667
  ]
641
668
  );
642
669
  }
643
- function Zr() {
644
- return /* @__PURE__ */ o("span", { style: s.logoMark, "aria-hidden": !0, children: /* @__PURE__ */ p(
670
+ function tt() {
671
+ return /* @__PURE__ */ s("span", { style: o.logoMark, "aria-hidden": !0, children: /* @__PURE__ */ f(
645
672
  "svg",
646
673
  {
647
674
  viewBox: "0 0 100 100",
@@ -650,151 +677,200 @@ function Zr() {
650
677
  height: "16",
651
678
  focusable: "false",
652
679
  children: [
653
- /* @__PURE__ */ o("rect", { x: "20", y: "15", width: "60", height: "12", rx: "6", fill: "currentColor" }),
654
- /* @__PURE__ */ o("rect", { x: "20", y: "35", width: "40", height: "12", rx: "6", fill: "currentColor" }),
655
- /* @__PURE__ */ o("rect", { x: "40", y: "55", width: "40", height: "12", rx: "6", fill: "currentColor" }),
656
- /* @__PURE__ */ o("rect", { x: "20", y: "75", width: "60", height: "12", rx: "6", fill: "currentColor" })
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" })
657
684
  ]
658
685
  }
659
686
  ) });
660
687
  }
661
- function et({
688
+ function nt({
662
689
  trace: e
663
690
  }) {
664
- var L, B, v, w, A;
691
+ var W, D, m, S, k, x;
665
692
  if (!e)
666
- return /* @__PURE__ */ o("div", { style: s.detailsPane, children: /* @__PURE__ */ o("div", { style: s.emptyState, children: "No traces registered yet" }) });
667
- const r = e.latestAttempt, t = r == null ? void 0 : r.executionResult, n = xe(
668
- (L = t == null ? void 0 : t.validation) == null ? void 0 : L.warnings
669
- ), i = xe((B = t == null ? void 0 : t.validation) == null ? void 0 : B.errors), d = xe(
670
- (v = t == null ? void 0 : t.coverage) == null ? void 0 : v.missingObligations
671
- ), l = t == null ? void 0 : t.compiledQuery, c = Kt(t), u = ((w = e.server) == null ? void 0 : w.compiledSql) || c.compiledSql, f = r != null && r.errorMessage ? [r.errorMessage] : [], m = [
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(
695
+ (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 = [
672
701
  ...e.clientWarnings,
673
702
  ...n,
674
703
  ...i,
675
- ...d
676
- ], y = e.inputsApplied.length > 0, h = !!(l || u), g = Rt(e), S = kt(r == null ? void 0 : r.rowCount), k = Ct(r == null ? void 0 : r.durationMs), a = e.sourceRefs.length, x = pr(e), C = cr(x);
677
- return /* @__PURE__ */ p("div", { style: s.detailsPane, children: [
678
- /* @__PURE__ */ p("div", { style: s.detailsHeader, children: [
679
- /* @__PURE__ */ p("div", { style: s.detailsHeaderTopRow, children: [
680
- /* @__PURE__ */ o(
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(
681
711
  "span",
682
712
  {
683
713
  "aria-hidden": !0,
684
714
  style: {
685
- ...s.detailsHeaderStatusDot,
686
- ...mr(r == null ? void 0 : r.status)
715
+ ...o.detailsHeaderStatusDot,
716
+ ...br(r == null ? void 0 : r.status)
687
717
  }
688
718
  }
689
719
  ),
690
- /* @__PURE__ */ o("span", { style: s.detailsTitle, children: Ke(e) }),
691
- /* @__PURE__ */ o(
720
+ /* @__PURE__ */ s("span", { style: o.detailsTitle, children: we(e) }),
721
+ /* @__PURE__ */ s(
692
722
  "span",
693
723
  {
694
724
  style: {
695
- ...s.detailsKindChip,
696
- ...fr(C)
725
+ ...o.detailsKindChip,
726
+ ...gr(A)
697
727
  },
698
- children: x
728
+ children: $
699
729
  }
700
730
  )
701
731
  ] }),
702
- /* @__PURE__ */ p("div", { style: s.metaStrip, children: [
703
- /* @__PURE__ */ o("span", { style: s.metaStripItem, children: g }),
704
- /* @__PURE__ */ o("span", { style: s.metaStripDot, children: "·" }),
705
- /* @__PURE__ */ p("span", { style: s.metaStripItem, children: [
706
- S,
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,
707
737
  " rows"
708
738
  ] }),
709
- /* @__PURE__ */ o("span", { style: s.metaStripDot, children: "·" }),
710
- /* @__PURE__ */ o("span", { style: s.metaStripItem, children: k }),
711
- a > 0 ? /* @__PURE__ */ p(or, { children: [
712
- /* @__PURE__ */ o("span", { style: s.metaStripDot, children: "·" }),
713
- /* @__PURE__ */ o("span", { style: s.metaStripItem, children: a === 1 ? "1 source" : `${a} sources` })
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` })
714
744
  ] }) : null
715
745
  ] })
716
746
  ] }),
717
- f.length ? /* @__PURE__ */ o(Qe, { tone: "error", title: "Error", items: f }) : null,
718
- m.length ? /* @__PURE__ */ o(Qe, { tone: "warning", title: "Warnings", items: m }) : null,
719
- /* @__PURE__ */ o(tt, { trace: e }),
720
- /* @__PURE__ */ o(ot, { trace: e }),
721
- (A = e.sourceHints) != null && A.length ? /* @__PURE__ */ o(st, { hints: e.sourceHints }) : null,
722
- y ? /* @__PURE__ */ o(ut, { inputs: e.inputsApplied }) : null,
723
- h ? /* @__PURE__ */ o(ie, { title: "Compiled Query", defaultOpen: !0, children: /* @__PURE__ */ o(
724
- ct,
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,
725
755
  {
726
- compiledQuery: l,
756
+ compiledQuery: p,
727
757
  compiledSql: u
728
758
  }
729
759
  ) }) : null,
730
- /* @__PURE__ */ o(ie, { title: "Lifecycle Events", children: e.recentEvents.length ? /* @__PURE__ */ o("div", { style: s.eventList, children: e.recentEvents.slice(-5).map((I, E) => /* @__PURE__ */ p(
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(
731
761
  "div",
732
762
  {
733
- style: s.eventRow,
763
+ style: o.eventRow,
734
764
  children: [
735
- /* @__PURE__ */ o("span", { style: s.eventType, children: Lt(I) }),
736
- /* @__PURE__ */ o("span", { style: s.eventMeta, children: Ot(I) })
765
+ /* @__PURE__ */ s("span", { style: o.eventType, children: Wt(T) }),
766
+ /* @__PURE__ */ s("span", { style: o.eventMeta, children: Nt(T) })
737
767
  ]
738
768
  },
739
- `${I.type}:${I.at}:${E}`
740
- )) }) : /* @__PURE__ */ o("div", { style: s.mutedText, children: "No attempts recorded" }) }),
741
- /* @__PURE__ */ o(ie, { title: "Raw Trace", children: /* @__PURE__ */ o("pre", { style: s.codeBlock, children: Dt(e) }) })
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) }) })
742
772
  ] });
743
773
  }
744
- function Qe({
774
+ function Ve({
745
775
  tone: e,
746
776
  title: r,
747
777
  items: t
748
778
  }) {
749
- const n = e === "error" ? s.alertCardError : s.alertCardWarning;
750
- return /* @__PURE__ */ p("div", { style: { ...s.alertCard, ...n }, children: [
751
- /* @__PURE__ */ o("div", { style: s.alertCardTitle, children: r }),
752
- t.length > 1 ? /* @__PURE__ */ o("ul", { style: s.alertCardList, children: t.map((i, d) => /* @__PURE__ */ o("li", { children: i }, `${e}-${d}`)) }) : /* @__PURE__ */ o("div", { children: t[0] })
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] })
753
783
  ] });
754
784
  }
755
- function rt({
785
+ function it({
786
+ issues: e,
787
+ onSelect: r
788
+ }) {
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(
797
+ "button",
798
+ {
799
+ type: "button",
800
+ title: `${i.title}: ${i.message}`,
801
+ style: o.issueSummaryItem,
802
+ onClick: () => r(i.trace),
803
+ children: [
804
+ /* @__PURE__ */ s(
805
+ "span",
806
+ {
807
+ style: {
808
+ ...o.issueSummaryBadge,
809
+ ...i.tone === "error" ? o.issueSummaryBadgeError : o.issueSummaryBadgeWarning
810
+ },
811
+ children: i.tone === "error" ? "Error" : "Warning"
812
+ }
813
+ ),
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 })
817
+ ] })
818
+ ]
819
+ },
820
+ `${i.trace.traceId}:${i.title}:${a}`
821
+ )),
822
+ n > 0 ? /* @__PURE__ */ f("div", { style: o.issueSummaryMore, children: [
823
+ n,
824
+ " more issue",
825
+ n === 1 ? "" : "s",
826
+ " in traces"
827
+ ] }) : null
828
+ ] })
829
+ ] });
830
+ }
831
+ function ot({
756
832
  status: e
757
833
  }) {
758
- return /* @__PURE__ */ o(
834
+ return /* @__PURE__ */ s(
759
835
  "span",
760
836
  {
761
837
  "aria-hidden": !0,
762
838
  style: {
763
- ...s.statusDot,
764
- ...mr(e)
839
+ ...o.statusDot,
840
+ ...br(e)
765
841
  }
766
842
  }
767
843
  );
768
844
  }
769
- function ie({
845
+ function de({
770
846
  title: e,
771
847
  children: r,
772
848
  defaultOpen: t = !1
773
849
  }) {
774
- const [n, i] = V(t);
775
- return /* @__PURE__ */ p(
850
+ const [n, i] = Q(t);
851
+ return /* @__PURE__ */ f(
776
852
  "details",
777
853
  {
778
- style: s.disclosure,
854
+ style: o.disclosure,
779
855
  open: n,
780
- onToggle: (d) => i(d.currentTarget.open),
856
+ onToggle: (a) => i(a.currentTarget.open),
781
857
  children: [
782
- /* @__PURE__ */ o("summary", { style: s.disclosureSummary, children: e }),
783
- /* @__PURE__ */ o("div", { style: s.disclosureBody, children: r })
858
+ /* @__PURE__ */ s("summary", { style: o.disclosureSummary, children: e }),
859
+ /* @__PURE__ */ s("div", { style: o.disclosureBody, children: r })
784
860
  ]
785
861
  }
786
862
  );
787
863
  }
788
- function tt({
864
+ function st({
789
865
  trace: e
790
866
  }) {
791
867
  var i;
792
- const r = (i = e.projectionFieldRefs) != null && i.length ? e.projectionFieldRefs : e.fieldRefs, t = e.inputFieldRefs || [], n = qt(r);
793
- return /* @__PURE__ */ p("div", { style: s.recipe, children: [
794
- /* @__PURE__ */ o(nt, { sources: e.sourceRefs }),
795
- /* @__PURE__ */ o(j, { title: "Measures", fields: n.measures }),
796
- /* @__PURE__ */ o(j, { title: "Time fields", fields: n.timeFields }),
797
- /* @__PURE__ */ o(
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(
798
874
  j,
799
875
  {
800
876
  title: "Dimensions",
@@ -802,41 +878,41 @@ function tt({
802
878
  emptyText: "No dimensions selected"
803
879
  }
804
880
  ),
805
- /* @__PURE__ */ o(j, { title: "Identifiers", fields: n.identifiers }),
806
- /* @__PURE__ */ o(j, { title: "Other fields", fields: n.other }),
807
- /* @__PURE__ */ o(j, { title: "Input bindings", fields: t })
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 })
808
884
  ] });
809
885
  }
810
- function nt({
886
+ function at({
811
887
  sources: e
812
888
  }) {
813
- return e.length ? /* @__PURE__ */ p("div", { style: s.recipeGroup, children: [
814
- /* @__PURE__ */ p("div", { style: s.recipeGroupHeader, children: [
815
- /* @__PURE__ */ o("span", { style: s.recipeGroupTitle, children: "From" }),
816
- /* @__PURE__ */ o("span", { style: s.recipeGroupCount, children: e.length })
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 })
817
893
  ] }),
818
- /* @__PURE__ */ o("div", { style: s.sourcePillRow, children: e.map((r, t) => /* @__PURE__ */ o(
819
- it,
894
+ /* @__PURE__ */ s("div", { style: o.sourcePillRow, children: e.map((r, t) => /* @__PURE__ */ s(
895
+ dt,
820
896
  {
821
897
  source: r
822
898
  },
823
- `${F(r)}:${t}`
899
+ `${_(r)}:${t}`
824
900
  )) })
825
901
  ] }) : null;
826
902
  }
827
- function it({ source: e }) {
828
- const r = F(e);
829
- return /* @__PURE__ */ p("span", { style: s.sourcePill, title: r, children: [
830
- /* @__PURE__ */ o("span", { style: s.sourcePillLabel, children: r }),
831
- /* @__PURE__ */ o("span", { style: s.sourcePillRole, children: e.kind })
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 })
832
908
  ] });
833
909
  }
834
- function ot({
910
+ function lt({
835
911
  trace: e
836
912
  }) {
837
- return !e.sourceRefs.length && !e.fieldRefs.length ? null : /* @__PURE__ */ o(ie, { title: "Sources and field refs", children: /* @__PURE__ */ p("div", { style: s.traceLineage, children: [
838
- /* @__PURE__ */ o(at, { sources: e.sourceRefs }),
839
- /* @__PURE__ */ o(
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(
840
916
  j,
841
917
  {
842
918
  title: "All field refs",
@@ -846,49 +922,49 @@ function ot({
846
922
  )
847
923
  ] }) });
848
924
  }
849
- function st({
925
+ function ut({
850
926
  hints: e
851
927
  }) {
852
- return /* @__PURE__ */ o(ie, { title: "Source hints", children: /* @__PURE__ */ o("div", { style: s.recipeFieldList, children: e.map((r, t) => {
853
- const n = Tt(r), i = r.component || r.exportName || n || "Source hint", d = [
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 = [
854
930
  r.exportName && r.exportName !== i ? r.exportName : void 0,
855
931
  n,
856
932
  r.note
857
933
  ].filter(Boolean).join(" · ");
858
- return /* @__PURE__ */ p(
934
+ return /* @__PURE__ */ f(
859
935
  "div",
860
936
  {
861
- style: s.recipeFieldRow,
862
- title: d || i,
937
+ style: o.recipeFieldRow,
938
+ title: a || i,
863
939
  children: [
864
- /* @__PURE__ */ o("span", { style: s.recipeFieldName, children: i }),
865
- d ? /* @__PURE__ */ o("span", { style: s.recipeFieldMeta, children: d }) : null
940
+ /* @__PURE__ */ s("span", { style: o.recipeFieldName, children: i }),
941
+ a ? /* @__PURE__ */ s("span", { style: o.recipeFieldMeta, children: a }) : null
866
942
  ]
867
943
  },
868
944
  `${i}:${n}:${t}`
869
945
  );
870
946
  }) }) });
871
947
  }
872
- function at({
948
+ function ct({
873
949
  sources: e
874
950
  }) {
875
- return /* @__PURE__ */ p("div", { style: s.recipeGroup, children: [
876
- /* @__PURE__ */ p("div", { style: s.recipeGroupHeader, children: [
877
- /* @__PURE__ */ o("span", { style: s.recipeGroupTitle, children: "Sources" }),
878
- /* @__PURE__ */ o("span", { style: s.recipeGroupCount, children: e.length })
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 })
879
955
  ] }),
880
- e.length ? /* @__PURE__ */ o("div", { style: s.recipeFieldList, children: e.map((r, t) => /* @__PURE__ */ p(
956
+ e.length ? /* @__PURE__ */ s("div", { style: o.recipeFieldList, children: e.map((r, t) => /* @__PURE__ */ f(
881
957
  "div",
882
958
  {
883
- style: s.recipeFieldRow,
884
- title: F(r),
959
+ style: o.recipeFieldRow,
960
+ title: _(r),
885
961
  children: [
886
- /* @__PURE__ */ o("span", { style: s.recipeFieldName, children: F(r) }),
887
- /* @__PURE__ */ o("span", { style: s.recipeFieldMeta, children: r.kind })
962
+ /* @__PURE__ */ s("span", { style: o.recipeFieldName, children: _(r) }),
963
+ /* @__PURE__ */ s("span", { style: o.recipeFieldMeta, children: r.kind })
888
964
  ]
889
965
  },
890
- `${F(r)}:${t}`
891
- )) }) : /* @__PURE__ */ o("div", { style: s.recipeEmptyText, children: "No sources captured" })
966
+ `${_(r)}:${t}`
967
+ )) }) : /* @__PURE__ */ s("div", { style: o.recipeEmptyText, children: "No sources captured" })
892
968
  ] });
893
969
  }
894
970
  function j({
@@ -896,36 +972,36 @@ function j({
896
972
  fields: r,
897
973
  emptyText: t
898
974
  }) {
899
- return !r.length && !t ? null : /* @__PURE__ */ p("div", { style: s.recipeGroup, children: [
900
- /* @__PURE__ */ p("div", { style: s.recipeGroupHeader, children: [
901
- /* @__PURE__ */ o("span", { style: s.recipeGroupTitle, children: e }),
902
- /* @__PURE__ */ o("span", { style: s.recipeGroupCount, children: r.length })
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 })
903
979
  ] }),
904
- r.length ? /* @__PURE__ */ o("div", { style: s.fieldChipList, children: r.map((n, i) => /* @__PURE__ */ o(
905
- dt,
980
+ r.length ? /* @__PURE__ */ s("div", { style: o.fieldChipList, children: r.map((n, i) => /* @__PURE__ */ s(
981
+ ft,
906
982
  {
907
983
  field: n,
908
984
  groupTitle: e
909
985
  },
910
- `${Ne(n)}:${i}`
911
- )) }) : /* @__PURE__ */ o("div", { style: s.recipeEmptyText, children: t })
986
+ `${Ke(n)}:${i}`
987
+ )) }) : /* @__PURE__ */ s("div", { style: o.recipeEmptyText, children: t })
912
988
  ] });
913
989
  }
914
- function dt({
990
+ function ft({
915
991
  field: e,
916
992
  groupTitle: r
917
993
  }) {
918
- const t = At(e), n = e.label || e.name, i = e.dataType && e.dataType !== "unknown" ? e.dataType : void 0, d = e.source ? F(e.source) : void 0, l = [t, i, d].filter(Boolean).join(" · "), c = lt(e, r);
919
- return /* @__PURE__ */ p("div", { style: s.fieldChip, title: l, children: [
920
- /* @__PURE__ */ o("span", { style: { ...s.fieldGlyph, ...c.style }, children: c.text }),
921
- e.aggregate ? /* @__PURE__ */ o("span", { style: s.fieldAggBadge, children: e.aggregate }) : null,
922
- /* @__PURE__ */ o("span", { style: s.fieldChipName, children: n }),
923
- i ? /* @__PURE__ */ o("span", { style: s.fieldChipMeta, children: i }) : null,
924
- i && d ? /* @__PURE__ */ o("span", { style: s.fieldChipMetaDot, children: "·" }) : null,
925
- d ? /* @__PURE__ */ o("span", { style: s.fieldChipMeta, children: d }) : null
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
926
1002
  ] });
927
1003
  }
928
- function lt(e, r) {
1004
+ function pt(e, r) {
929
1005
  const t = e.dataType, n = e.role;
930
1006
  return !!e.aggregate || n === "measure" || r === "Measures" ? {
931
1007
  text: "Σ",
@@ -964,28 +1040,28 @@ function lt(e, r) {
964
1040
  }
965
1041
  };
966
1042
  }
967
- function ut({
1043
+ function gt({
968
1044
  inputs: e
969
1045
  }) {
970
- return /* @__PURE__ */ p("div", { style: s.inputsAppliedBlock, children: [
971
- /* @__PURE__ */ p("div", { style: s.inputsAppliedHeader, children: [
972
- /* @__PURE__ */ o("span", { style: s.inputsAppliedTitle, children: "Active Inputs" }),
973
- /* @__PURE__ */ o("span", { style: s.inputsAppliedCount, children: e.length })
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 })
974
1050
  ] }),
975
- /* @__PURE__ */ o("div", { style: s.inputRecipeList, children: e.map((r) => {
976
- const t = Et(r);
977
- return /* @__PURE__ */ p(
1051
+ /* @__PURE__ */ s("div", { style: o.inputRecipeList, children: e.map((r) => {
1052
+ const t = Lt(r);
1053
+ return /* @__PURE__ */ f(
978
1054
  "div",
979
1055
  {
980
- style: s.inputRecipeRow,
1056
+ style: o.inputRecipeRow,
981
1057
  title: t.title,
982
1058
  children: [
983
- /* @__PURE__ */ p("div", { style: s.inputRecipeHeader, children: [
984
- /* @__PURE__ */ o("span", { style: s.inputRecipeId, title: r.inputId, children: r.inputId }),
985
- t.operator ? /* @__PURE__ */ o("span", { style: s.inputOperatorBadge, children: t.operator }) : null,
986
- /* @__PURE__ */ o("span", { style: s.inputValuePreview, title: t.value, children: t.value })
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 })
987
1063
  ] }),
988
- t.binding ? /* @__PURE__ */ o("div", { style: s.inputRecipeBinding, title: t.binding, children: t.binding }) : null
1064
+ t.binding ? /* @__PURE__ */ s("div", { style: o.inputRecipeBinding, title: t.binding, children: t.binding }) : null
989
1065
  ]
990
1066
  },
991
1067
  r.inputId
@@ -993,41 +1069,41 @@ function ut({
993
1069
  }) })
994
1070
  ] });
995
1071
  }
996
- function ct({
1072
+ function mt({
997
1073
  compiledQuery: e,
998
1074
  compiledSql: r
999
1075
  }) {
1000
- return (e == null ? void 0 : e.kind) === "sql" ? /* @__PURE__ */ p("div", { style: s.compiledQuery, children: [
1001
- /* @__PURE__ */ o(Ve, { label: "SQL", value: e.sql }),
1002
- e.pythonCode ? /* @__PURE__ */ o(we, { label: "Python", value: e.pythonCode }) : null,
1003
- e.parameters ? /* @__PURE__ */ o(
1004
- we,
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,
1005
1081
  {
1006
1082
  label: "Parameters",
1007
- value: De(e.parameters)
1083
+ value: Be(e.parameters)
1008
1084
  }
1009
1085
  ) : null
1010
- ] }) : r ? /* @__PURE__ */ o(Ve, { label: "SQL", value: r }) : /* @__PURE__ */ o(we, { label: "Compiled Query", value: De(e) });
1086
+ ] }) : r ? /* @__PURE__ */ s(Qe, { label: "SQL", value: r }) : /* @__PURE__ */ s(Ae, { label: "Compiled Query", value: Be(e) });
1011
1087
  }
1012
- function we({
1088
+ function Ae({
1013
1089
  label: e,
1014
1090
  value: r
1015
1091
  }) {
1016
- return /* @__PURE__ */ p("div", { style: s.codeBlockGroup, children: [
1017
- /* @__PURE__ */ o("div", { style: s.codeBlockLabel, children: e }),
1018
- /* @__PURE__ */ o("pre", { style: s.codeBlock, children: r })
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 })
1019
1095
  ] });
1020
1096
  }
1021
- function Ve({
1097
+ function Qe({
1022
1098
  label: e,
1023
1099
  value: r
1024
1100
  }) {
1025
- return /* @__PURE__ */ p("div", { style: s.codeBlockGroup, children: [
1026
- /* @__PURE__ */ o("div", { style: s.codeBlockLabel, children: e }),
1027
- /* @__PURE__ */ o("pre", { style: s.codeBlock, children: pt(r) })
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) })
1028
1104
  ] });
1029
1105
  }
1030
- const ft = /* @__PURE__ */ new Set([
1106
+ const yt = /* @__PURE__ */ new Set([
1031
1107
  "SELECT",
1032
1108
  "FROM",
1033
1109
  "JOIN",
@@ -1065,40 +1141,69 @@ const ft = /* @__PURE__ */ new Set([
1065
1141
  "ALL",
1066
1142
  "WITH"
1067
1143
  ]);
1068
- function pt(e) {
1144
+ function ht(e) {
1069
1145
  return e.split(/(\s+|,|\(|\))/).map((t, n) => {
1070
1146
  if (!t) return null;
1071
1147
  const i = t.toUpperCase();
1072
- return ft.has(i) ? /* @__PURE__ */ o("span", { style: s.sqlKeyword, children: t }, n) : t.startsWith("$") || t.startsWith(":") || t.startsWith("?") ? /* @__PURE__ */ o("span", { style: s.sqlBindParam, children: t }, n) : /* @__PURE__ */ o("span", { children: t }, n);
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);
1073
1149
  });
1074
1150
  }
1075
- function gt(e) {
1076
- const r = e.filter(
1077
- (i) => {
1078
- var d;
1079
- return ((d = i.latestAttempt) == null ? void 0 : d.status) === "error";
1080
- }
1081
- ).length, t = e.filter(
1082
- (i) => {
1083
- var d;
1084
- return ((d = i.latestAttempt) == null ? void 0 : d.status) === "loading";
1151
+ function ur(e) {
1152
+ 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(
1161
+ (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({
1164
+ trace: r,
1165
+ tone: "error",
1166
+ title: u,
1167
+ message: t.errorMessage || "Query attempt failed."
1168
+ });
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;
1180
+ });
1181
+ }
1182
+ function bt(e, r) {
1183
+ return e.filter((t) => fr(t.trace, r)).length;
1184
+ }
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";
1085
1190
  }
1086
1191
  ).length, n = e.filter(
1087
- (i) => {
1088
- var d, l, c, u;
1089
- return i.clientWarnings.length > 0 || !!((u = (c = (l = (d = i.latestAttempt) == null ? void 0 : d.executionResult) == null ? void 0 : l.validation) == null ? void 0 : c.warnings) != null && u.length);
1192
+ (a) => {
1193
+ var l;
1194
+ return ((l = a.latestAttempt) == null ? void 0 : l.status) === "loading";
1090
1195
  }
1091
- ).length;
1196
+ ).length, i = r.filter((a) => a.tone === "warning").length;
1092
1197
  return {
1093
1198
  total: e.length,
1094
- failed: r,
1095
- loading: t,
1096
- warningCount: n,
1097
- issueCount: r + n,
1098
- severity: r ? "error" : n ? "warning" : t ? "loading" : "ok"
1199
+ failed: t,
1200
+ loading: n,
1201
+ warningCount: i,
1202
+ issueCount: r.length,
1203
+ severity: t ? "error" : i ? "warning" : n ? "loading" : "ok"
1099
1204
  };
1100
1205
  }
1101
- function mt(e) {
1206
+ function St(e) {
1102
1207
  return [
1103
1208
  `${e.total} ${e.total === 1 ? "trace" : "traces"}`,
1104
1209
  `${e.loading} loading`,
@@ -1106,7 +1211,7 @@ function mt(e) {
1106
1211
  `${e.warningCount} warning${e.warningCount === 1 ? "" : "s"}`
1107
1212
  ].join(" · ");
1108
1213
  }
1109
- function yt(e, r) {
1214
+ function wt(e, r) {
1110
1215
  const t = r.trim().toLowerCase();
1111
1216
  return t ? e.filter(
1112
1217
  (n) => [
@@ -1118,36 +1223,36 @@ function yt(e, r) {
1118
1223
  n.sectionTitle,
1119
1224
  n.builder,
1120
1225
  n.queryKind,
1121
- gr(n)
1226
+ yr(n)
1122
1227
  ].filter(Boolean).join(" ").toLowerCase().includes(t)
1123
1228
  ) : e;
1124
1229
  }
1125
- function ht(e) {
1126
- const r = e.filter((i) => i.queryKind === "inputOptions"), t = new Set(r.map(Ce));
1230
+ function It(e) {
1231
+ const r = e.filter((i) => i.queryKind === "inputOptions"), t = new Set(r.map(Oe));
1127
1232
  return [
1128
- { title: "Views", traces: e.filter((i) => !t.has(Ce(i))) },
1233
+ { title: "Views", traces: e.filter((i) => !t.has(Oe(i))) },
1129
1234
  { title: "Inputs", traces: r }
1130
1235
  ];
1131
1236
  }
1132
- function ur(e, r) {
1237
+ function cr(e, r) {
1133
1238
  if (!(!(r != null && r.traceId) && !(r != null && r.queryId) && !(r != null && r.viewId)))
1134
1239
  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));
1135
1240
  }
1136
- function vt(e, r) {
1241
+ function xt(e, r) {
1137
1242
  if (r.queryId)
1138
- return ur(e, r);
1243
+ return cr(e, r);
1139
1244
  if (!r.viewId)
1140
1245
  return;
1141
1246
  const t = e.filter((n) => n.viewId === r.viewId);
1142
1247
  return t.length === 1 ? t[0] : void 0;
1143
1248
  }
1144
- function bt(e, r) {
1249
+ function fr(e, r) {
1145
1250
  return !!(e && r && e.traceId === r.traceId);
1146
1251
  }
1147
- function Ce(e) {
1252
+ function Oe(e) {
1148
1253
  return e.traceId;
1149
1254
  }
1150
- function St(e) {
1255
+ function qt(e) {
1151
1256
  switch (e) {
1152
1257
  case "metric":
1153
1258
  return "metric";
@@ -1162,14 +1267,14 @@ function St(e) {
1162
1267
  case "sql":
1163
1268
  return "sql";
1164
1269
  default:
1165
- return he(e);
1270
+ return Ie(e);
1166
1271
  }
1167
1272
  }
1168
- function cr(e) {
1273
+ function pr(e) {
1169
1274
  const r = e.trim().toLowerCase();
1170
1275
  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";
1171
1276
  }
1172
- function fr(e) {
1277
+ function gr(e) {
1173
1278
  switch (e) {
1174
1279
  case "metric":
1175
1280
  return {
@@ -1201,28 +1306,28 @@ function fr(e) {
1201
1306
  };
1202
1307
  }
1203
1308
  }
1204
- function Ke(e) {
1309
+ function we(e) {
1205
1310
  return e.viewTitle || e.queryLabel || e.viewId || e.queryId;
1206
1311
  }
1207
- function wt(e, r, t) {
1312
+ function Tt(e, r, t) {
1208
1313
  const n = [];
1209
1314
  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;
1210
1315
  }
1211
- function pr(e) {
1212
- return It(e.visualType) || St(e.queryKind);
1316
+ function mr(e) {
1317
+ return Et(e.visualType) || qt(e.queryKind);
1213
1318
  }
1214
- function xt(e, r) {
1215
- return r ? e.queryLabel || e.queryId : Ke(e);
1319
+ function At(e, r) {
1320
+ return r ? e.queryLabel || e.queryId : we(e);
1216
1321
  }
1217
- function It(e) {
1322
+ function Et(e) {
1218
1323
  if (e)
1219
1324
  return e.replace(/[_-]+/g, " ").replace(/\b\w/g, (r) => r.toUpperCase());
1220
1325
  }
1221
- function gr(e) {
1222
- const r = e.sourceRefs.map(F);
1326
+ function yr(e) {
1327
+ const r = e.sourceRefs.map(_);
1223
1328
  return r.length ? r.length === 1 ? r[0] : `${r[0]} + ${r.length - 1} more` : "No source";
1224
1329
  }
1225
- function qt(e) {
1330
+ function Rt(e) {
1226
1331
  return e.reduce(
1227
1332
  (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),
1228
1333
  {
@@ -1234,7 +1339,7 @@ function qt(e) {
1234
1339
  }
1235
1340
  );
1236
1341
  }
1237
- function Rt(e) {
1342
+ function Ct(e) {
1238
1343
  var r, t;
1239
1344
  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)
1240
1345
  return "KPI query";
@@ -1252,15 +1357,15 @@ function Rt(e) {
1252
1357
  case "sql":
1253
1358
  return "SQL query";
1254
1359
  default:
1255
- return he(e.queryKind);
1360
+ return Ie(e.queryKind);
1256
1361
  }
1257
1362
  }
1258
- function At(e) {
1363
+ function kt(e) {
1259
1364
  return [e.aggregate, e.label || e.name].filter(Boolean).join(" ");
1260
1365
  }
1261
- function Et(e) {
1262
- var l, c, u;
1263
- const r = e.valuePreview || "redacted", t = ((l = e.fieldRef) == null ? void 0 : l.label) || ((c = e.fieldRef) == null ? void 0 : c.name), n = (u = e.fieldRef) != null && u.source ? F(e.fieldRef.source) : void 0, i = [t ? `on ${t}` : void 0, n].filter(Boolean).join(" · "), d = [
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 = [
1264
1369
  e.inputId,
1265
1370
  e.operator,
1266
1371
  r,
@@ -1270,32 +1375,32 @@ function Et(e) {
1270
1375
  operator: e.operator,
1271
1376
  value: r,
1272
1377
  binding: i,
1273
- title: d
1378
+ title: a
1274
1379
  };
1275
1380
  }
1276
- function F(e) {
1381
+ function _(e) {
1277
1382
  return e.kind === "semantic" ? e.datasetName || e.datasetId || e.domainId : e.kind === "physical" ? [
1278
1383
  e.schemaName,
1279
1384
  e.tableName
1280
1385
  ].filter(Boolean).join(".") || e.tableName : e.connectionId ? `SQL ${e.connectionId}` : "SQL source";
1281
1386
  }
1282
- function Tt(e) {
1387
+ function Dt(e) {
1283
1388
  if (e.file)
1284
1389
  return e.line && e.column ? `${e.file}:${e.line}:${e.column}` : e.line ? `${e.file}:${e.line}` : e.file;
1285
1390
  }
1286
- function kt(e) {
1391
+ function Ot(e) {
1287
1392
  return typeof e == "number" ? e.toLocaleString() : "-";
1288
1393
  }
1289
- function Ct(e) {
1394
+ function Bt(e) {
1290
1395
  return typeof e == "number" ? `${Math.round(e)}ms` : "-";
1291
1396
  }
1292
- function Dt(e) {
1293
- return De(e);
1397
+ function $t(e) {
1398
+ return Be(e);
1294
1399
  }
1295
- function De(e) {
1400
+ function Be(e) {
1296
1401
  return JSON.stringify(e, null, 2) ?? "undefined";
1297
1402
  }
1298
- function Lt(e) {
1403
+ function Wt(e) {
1299
1404
  switch (e.type) {
1300
1405
  case "query_started":
1301
1406
  return "Started";
@@ -1308,10 +1413,10 @@ function Lt(e) {
1308
1413
  case "input_changed":
1309
1414
  return "Input changed";
1310
1415
  default:
1311
- return Bt(e);
1416
+ return Kt(e);
1312
1417
  }
1313
1418
  }
1314
- function Ot(e) {
1419
+ function Nt(e) {
1315
1420
  return [
1316
1421
  e.at,
1317
1422
  "durationMs" in e && typeof e.durationMs == "number" ? `${Math.round(e.durationMs)}ms` : void 0,
@@ -1320,20 +1425,31 @@ function Ot(e) {
1320
1425
  "errorMessage" in e ? e.errorMessage : void 0
1321
1426
  ].filter(Boolean).join(" - ");
1322
1427
  }
1323
- function Bt(e) {
1428
+ function Kt(e) {
1324
1429
  throw new Error(`Unsupported Semaphor trace event: ${JSON.stringify(e)}`);
1325
1430
  }
1326
- function xe(e) {
1431
+ function hr(e) {
1327
1432
  return Array.isArray(e) ? e.filter((r) => typeof r == "string") : [];
1328
1433
  }
1329
- function Kt(e) {
1434
+ function X(e) {
1435
+ return Array.isArray(e) ? e.map((r) => Ft(r)).filter((r) => !!r) : [];
1436
+ }
1437
+ function Ft(e) {
1438
+ if (typeof e == "string")
1439
+ return e;
1440
+ if (!e || typeof e != "object" || Array.isArray(e))
1441
+ return;
1442
+ 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;
1444
+ }
1445
+ function _t(e) {
1330
1446
  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;
1331
1447
  return {
1332
1448
  compiledSql: typeof (t == null ? void 0 : t.compiledSql) == "string" ? t.compiledSql : void 0,
1333
1449
  queryHash: typeof (t == null ? void 0 : t.queryHash) == "string" ? t.queryHash : void 0
1334
1450
  };
1335
1451
  }
1336
- function Nt(e) {
1452
+ function zt(e) {
1337
1453
  return e === "relative" ? {
1338
1454
  position: "relative",
1339
1455
  top: "auto",
@@ -1347,7 +1463,7 @@ function Nt(e) {
1347
1463
  left: e.endsWith("left") ? 20 : "auto"
1348
1464
  };
1349
1465
  }
1350
- function $t(e) {
1466
+ function Mt(e) {
1351
1467
  return e === "error" ? {
1352
1468
  borderColor: "var(--sd-error-border)",
1353
1469
  background: "var(--sd-error-bg)",
@@ -1366,7 +1482,7 @@ function $t(e) {
1366
1482
  color: "var(--sd-success-fg)"
1367
1483
  };
1368
1484
  }
1369
- function Wt(e) {
1485
+ function Ht(e) {
1370
1486
  return e === "right" ? {
1371
1487
  top: 16,
1372
1488
  right: 16,
@@ -1385,23 +1501,23 @@ function Wt(e) {
1385
1501
  borderRadius: 6
1386
1502
  };
1387
1503
  }
1388
- function Ft(e) {
1504
+ function jt(e) {
1389
1505
  return e === "right" ? {
1390
1506
  gridTemplateColumns: "minmax(210px, 280px) minmax(0, 1fr)"
1391
1507
  } : {
1392
1508
  gridTemplateColumns: "minmax(260px, 340px) minmax(0, 1fr)"
1393
1509
  };
1394
1510
  }
1395
- function _t(e) {
1511
+ function Pt(e) {
1396
1512
  return {
1397
1513
  borderRight: "1px solid var(--sd-border)",
1398
1514
  borderBottom: 0
1399
1515
  };
1400
1516
  }
1401
- function mr(e) {
1517
+ function br(e) {
1402
1518
  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)" };
1403
1519
  }
1404
- function zt(e) {
1520
+ function Vt(e) {
1405
1521
  return e === "error" ? {
1406
1522
  borderColor: "var(--sd-error-border)",
1407
1523
  color: "var(--sd-error-fg)"
@@ -1416,8 +1532,8 @@ function zt(e) {
1416
1532
  color: "var(--sd-fg-muted)"
1417
1533
  };
1418
1534
  }
1419
- const Ue = "semaphor-devtools-stylesheet", $ = "semaphor-devtools", Ht = `
1420
- .${$} {
1535
+ const Ue = "semaphor-devtools-stylesheet", K = "semaphor-devtools", Qt = `
1536
+ .${K} {
1421
1537
  --sd-bg: #ffffff;
1422
1538
  --sd-bg-muted: #fafafa;
1423
1539
  --sd-bg-raised: #ffffff;
@@ -1466,7 +1582,7 @@ const Ue = "semaphor-devtools-stylesheet", $ = "semaphor-devtools", Ht = `
1466
1582
  }
1467
1583
 
1468
1584
  @media (prefers-color-scheme: dark) {
1469
- .${$} {
1585
+ .${K} {
1470
1586
  --sd-bg: #09090b;
1471
1587
  --sd-bg-muted: #18181b;
1472
1588
  --sd-bg-raised: #18181b;
@@ -1510,7 +1626,7 @@ const Ue = "semaphor-devtools-stylesheet", $ = "semaphor-devtools", Ht = `
1510
1626
  }
1511
1627
  }
1512
1628
 
1513
- .${$}-source {
1629
+ .${K}-source {
1514
1630
  display: -webkit-box;
1515
1631
  -webkit-line-clamp: 2;
1516
1632
  -webkit-box-orient: vertical;
@@ -1518,19 +1634,19 @@ const Ue = "semaphor-devtools-stylesheet", $ = "semaphor-devtools", Ht = `
1518
1634
  word-break: break-all;
1519
1635
  }
1520
1636
  `;
1521
- function yr() {
1637
+ function vr() {
1522
1638
  if (typeof document > "u" || document.getElementById(Ue))
1523
1639
  return;
1524
1640
  const e = document.createElement("style");
1525
- e.id = Ue, e.textContent = Ht, document.head.appendChild(e);
1641
+ e.id = Ue, e.textContent = Qt, document.head.appendChild(e);
1526
1642
  }
1527
- const ue = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', N = "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", Ie = {
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 = {
1528
1644
  color: "var(--sd-fg-muted)",
1529
1645
  fontSize: 10,
1530
1646
  fontWeight: 600,
1531
1647
  textTransform: "uppercase",
1532
1648
  letterSpacing: "0.08em"
1533
- }, s = {
1649
+ }, o = {
1534
1650
  launcher: {
1535
1651
  position: "fixed",
1536
1652
  bottom: 20,
@@ -1545,7 +1661,7 @@ const ue = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1545
1661
  borderStyle: "solid",
1546
1662
  borderRadius: 6,
1547
1663
  boxShadow: "var(--sd-shadow)",
1548
- font: `600 12px/1.2 ${ue}`,
1664
+ font: `600 12px/1.2 ${pe}`,
1549
1665
  cursor: "pointer"
1550
1666
  },
1551
1667
  launcherText: {
@@ -1590,7 +1706,7 @@ const ue = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1590
1706
  background: "var(--sd-bg)",
1591
1707
  color: "var(--sd-fg)",
1592
1708
  boxShadow: "var(--sd-shadow)",
1593
- font: `13px/1.4 ${ue}`
1709
+ font: `13px/1.4 ${pe}`
1594
1710
  },
1595
1711
  panelFullscreen: {
1596
1712
  top: 0,
@@ -1659,7 +1775,95 @@ const ue = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1659
1775
  outline: 0,
1660
1776
  background: "transparent",
1661
1777
  color: "var(--sd-fg)",
1662
- font: `12px/1.4 ${ue}`
1778
+ font: `12px/1.4 ${pe}`
1779
+ },
1780
+ issueSummary: {
1781
+ margin: "0 10px 10px",
1782
+ borderWidth: 1,
1783
+ borderStyle: "solid",
1784
+ borderColor: "var(--sd-warning-border)",
1785
+ borderRadius: 6,
1786
+ background: "var(--sd-warning-bg)",
1787
+ color: "var(--sd-warning-fg)",
1788
+ overflow: "hidden"
1789
+ },
1790
+ issueSummaryHeader: {
1791
+ display: "flex",
1792
+ alignItems: "center",
1793
+ justifyContent: "space-between",
1794
+ gap: 8,
1795
+ padding: "7px 9px 5px",
1796
+ ...ge
1797
+ },
1798
+ issueSummaryCount: {
1799
+ fontVariantNumeric: "tabular-nums"
1800
+ },
1801
+ issueSummaryList: {
1802
+ display: "grid",
1803
+ gap: 1,
1804
+ padding: "0 6px 6px"
1805
+ },
1806
+ issueSummaryItem: {
1807
+ display: "grid",
1808
+ gridTemplateColumns: "auto minmax(0, 1fr)",
1809
+ alignItems: "start",
1810
+ gap: 8,
1811
+ width: "100%",
1812
+ padding: "7px 8px",
1813
+ border: 0,
1814
+ borderRadius: 5,
1815
+ background: "transparent",
1816
+ color: "inherit",
1817
+ textAlign: "left",
1818
+ cursor: "pointer"
1819
+ },
1820
+ issueSummaryBadge: {
1821
+ display: "inline-flex",
1822
+ alignItems: "center",
1823
+ height: 17,
1824
+ padding: "0 5px",
1825
+ borderWidth: 1,
1826
+ borderStyle: "solid",
1827
+ borderRadius: 3,
1828
+ fontSize: 9,
1829
+ fontWeight: 700,
1830
+ textTransform: "uppercase",
1831
+ letterSpacing: "0.06em"
1832
+ },
1833
+ issueSummaryBadgeError: {
1834
+ borderColor: "var(--sd-error-border)",
1835
+ background: "var(--sd-error-bg)",
1836
+ color: "var(--sd-error-fg)"
1837
+ },
1838
+ issueSummaryBadgeWarning: {
1839
+ borderColor: "var(--sd-warning-border)",
1840
+ background: "var(--sd-bg)",
1841
+ color: "var(--sd-warning-fg)"
1842
+ },
1843
+ issueSummaryText: {
1844
+ display: "grid",
1845
+ gap: 2,
1846
+ minWidth: 0
1847
+ },
1848
+ issueSummaryTitle: {
1849
+ overflow: "hidden",
1850
+ textOverflow: "ellipsis",
1851
+ whiteSpace: "nowrap",
1852
+ color: "var(--sd-fg)",
1853
+ fontSize: 12,
1854
+ fontWeight: 650
1855
+ },
1856
+ issueSummaryMessage: {
1857
+ overflow: "hidden",
1858
+ textOverflow: "ellipsis",
1859
+ whiteSpace: "nowrap",
1860
+ color: "var(--sd-warning-fg)",
1861
+ fontSize: 11
1862
+ },
1863
+ issueSummaryMore: {
1864
+ padding: "3px 8px 5px",
1865
+ color: "var(--sd-fg-muted)",
1866
+ fontSize: 11
1663
1867
  },
1664
1868
  panelBody: {
1665
1869
  display: "grid",
@@ -1685,7 +1889,7 @@ const ue = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1685
1889
  alignItems: "center",
1686
1890
  justifyContent: "space-between",
1687
1891
  padding: "4px 6px 3px",
1688
- ...Ie
1892
+ ...ge
1689
1893
  },
1690
1894
  queryGroupCount: {
1691
1895
  color: "var(--sd-fg-subtle)",
@@ -1754,6 +1958,24 @@ const ue = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1754
1958
  textTransform: "uppercase",
1755
1959
  letterSpacing: "0.06em"
1756
1960
  },
1961
+ queryListIssueBadge: {
1962
+ flex: "0 0 auto",
1963
+ display: "inline-flex",
1964
+ alignItems: "center",
1965
+ justifyContent: "center",
1966
+ minWidth: 16,
1967
+ height: 16,
1968
+ padding: "0 4px",
1969
+ borderWidth: 1,
1970
+ borderStyle: "solid",
1971
+ borderColor: "var(--sd-warning-border)",
1972
+ borderRadius: 999,
1973
+ background: "var(--sd-warning-bg)",
1974
+ color: "var(--sd-warning-fg)",
1975
+ fontSize: 10,
1976
+ fontWeight: 700,
1977
+ fontVariantNumeric: "tabular-nums"
1978
+ },
1757
1979
  queryListSource: {
1758
1980
  minWidth: 0,
1759
1981
  paddingLeft: 14,
@@ -1943,7 +2165,7 @@ const ue = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
1943
2165
  },
1944
2166
  disclosureSummary: {
1945
2167
  cursor: "pointer",
1946
- ...Ie
2168
+ ...ge
1947
2169
  },
1948
2170
  disclosureBody: {
1949
2171
  marginTop: 8
@@ -2171,7 +2393,7 @@ const ue = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2171
2393
  gap: 5
2172
2394
  },
2173
2395
  codeBlockLabel: {
2174
- ...Ie
2396
+ ...ge
2175
2397
  },
2176
2398
  codeBlock: {
2177
2399
  maxHeight: 260,
@@ -2204,7 +2426,7 @@ const ue = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2204
2426
  borderStyle: "solid",
2205
2427
  borderRadius: 5,
2206
2428
  background: "var(--sd-bg)",
2207
- font: `600 11px/1 ${ue}`,
2429
+ font: `600 11px/1 ${pe}`,
2208
2430
  cursor: "pointer"
2209
2431
  },
2210
2432
  inspectButtonText: {
@@ -2213,7 +2435,7 @@ const ue = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe
2213
2435
  whiteSpace: "nowrap"
2214
2436
  }
2215
2437
  };
2216
- function hr(e) {
2438
+ function Sr(e) {
2217
2439
  return {
2218
2440
  ...e,
2219
2441
  order: [],
@@ -2221,29 +2443,29 @@ function hr(e) {
2221
2443
  sequence: 0
2222
2444
  };
2223
2445
  }
2224
- function Mt(e, r) {
2446
+ function Ut(e, r) {
2225
2447
  if (r.type === "config")
2226
2448
  return r.config.enabled ? {
2227
2449
  ...e,
2228
2450
  ...r.config
2229
- } : hr(r.config);
2451
+ } : Sr(r.config);
2230
2452
  if (!e.enabled)
2231
2453
  return e;
2232
2454
  switch (r.type) {
2233
2455
  case "register":
2234
- return Vt(jt(e, r.descriptor));
2456
+ return Xt(Gt(e, r.descriptor));
2235
2457
  case "unregister":
2236
- return Pt(e, r.traceKey);
2458
+ return Jt(e, r.traceKey);
2237
2459
  case "event":
2238
- return Qt(e, r);
2460
+ return Yt(e, r);
2239
2461
  default:
2240
2462
  return e;
2241
2463
  }
2242
2464
  }
2243
- function jt(e, r) {
2244
- const t = e.entries[r.traceKey], n = t ? e.sequence : e.sequence + 1, i = $e(), d = {
2245
- ...t || Ut(r),
2246
- ...vr(r),
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),
2247
2469
  traceKey: r.traceKey,
2248
2470
  latestAttempt: (t == null ? void 0 : t.latestAttempt) || { status: "idle" },
2249
2471
  recentEvents: (t == null ? void 0 : t.recentEvents) || [],
@@ -2257,11 +2479,11 @@ function jt(e, r) {
2257
2479
  order: t ? e.order : [...e.order, r.traceKey],
2258
2480
  entries: {
2259
2481
  ...e.entries,
2260
- [r.traceKey]: d
2482
+ [r.traceKey]: a
2261
2483
  }
2262
2484
  };
2263
2485
  }
2264
- function Pt(e, r) {
2486
+ function Jt(e, r) {
2265
2487
  const t = e.entries[r];
2266
2488
  return t ? {
2267
2489
  ...e,
@@ -2274,11 +2496,11 @@ function Pt(e, r) {
2274
2496
  }
2275
2497
  } : e;
2276
2498
  }
2277
- function Qt(e, r) {
2499
+ function Yt(e, r) {
2278
2500
  const t = e.entries[r.traceKey];
2279
2501
  if (!t)
2280
2502
  return e;
2281
- const n = $e(), i = [
2503
+ const n = Fe(), i = [
2282
2504
  ...t.recentEvents,
2283
2505
  r.event
2284
2506
  ].slice(-e.maxEventsPerQuery);
@@ -2298,10 +2520,10 @@ function Qt(e, r) {
2298
2520
  }
2299
2521
  };
2300
2522
  }
2301
- function Vt(e) {
2523
+ function Xt(e) {
2302
2524
  if (e.order.length <= e.maxQueries)
2303
2525
  return e;
2304
- const r = e.order.map((i) => e.entries[i]).filter((i) => !!i).sort((i, d) => i.mounted !== d.mounted ? i.mounted ? 1 : -1 : i.lastEventAt - d.lastEventAt), t = e.order.length - e.maxQueries, n = new Set(
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(
2305
2527
  r.slice(0, t).map((i) => i.traceKey)
2306
2528
  );
2307
2529
  return n.size ? {
@@ -2312,10 +2534,10 @@ function Vt(e) {
2312
2534
  )
2313
2535
  } : e;
2314
2536
  }
2315
- function Ut(e) {
2316
- const r = $e();
2537
+ function Zt(e) {
2538
+ const r = Fe();
2317
2539
  return {
2318
- ...vr(e),
2540
+ ...wr(e),
2319
2541
  traceKey: e.traceKey,
2320
2542
  latestAttempt: { status: "idle" },
2321
2543
  recentEvents: [],
@@ -2324,14 +2546,14 @@ function Ut(e) {
2324
2546
  lastEventAt: r
2325
2547
  };
2326
2548
  }
2327
- function vr(e) {
2549
+ function wr(e) {
2328
2550
  var n;
2329
- const r = an(e.spec), t = dn(
2551
+ const r = fn(e.spec), t = pn(
2330
2552
  e.spec,
2331
2553
  e.activeInputs
2332
2554
  );
2333
2555
  return {
2334
- traceId: xr(e.traceKey),
2556
+ traceId: Tr(e.traceKey),
2335
2557
  viewId: e.viewId,
2336
2558
  viewTitle: e.viewTitle,
2337
2559
  visualType: e.visualType,
@@ -2340,55 +2562,55 @@ function vr(e) {
2340
2562
  queryLabel: e.queryLabel,
2341
2563
  queryKind: e.queryKind,
2342
2564
  builder: e.builder,
2343
- sourceRefs: sn(e.intent),
2565
+ sourceRefs: cn(e.intent),
2344
2566
  sourceHints: (n = e.sourceHints) != null && n.length ? e.sourceHints : void 0,
2345
2567
  projectionFieldRefs: r,
2346
2568
  inputFieldRefs: t,
2347
- fieldRefs: ln(e.intent),
2569
+ fieldRefs: gn(e.intent),
2348
2570
  inputsApplied: (e.activeInputs || []).map((i) => ({
2349
2571
  inputId: i.inputId,
2350
2572
  fieldRef: i.field,
2351
2573
  operator: i.operator,
2352
- valuePreview: nn(i)
2574
+ valuePreview: ln(i)
2353
2575
  })),
2354
2576
  recentEvents: [],
2355
2577
  clientWarnings: e.clientWarnings
2356
2578
  };
2357
2579
  }
2358
- function pe(e) {
2580
+ function he(e) {
2359
2581
  const {
2360
2582
  traceKey: r,
2361
2583
  mounted: t,
2362
2584
  registeredAt: n,
2363
2585
  lastEventAt: i,
2364
- ...d
2586
+ ...a
2365
2587
  } = e;
2366
- return d;
2588
+ return a;
2367
2589
  }
2368
- function ge(e) {
2590
+ function be(e) {
2369
2591
  return e.enabled ? {
2370
2592
  enabled: !0,
2371
- queries: e.order.map((t) => e.entries[t]).filter((t) => !!t).map(pe),
2593
+ queries: e.order.map((t) => e.entries[t]).filter((t) => !!t).map(he),
2372
2594
  getQuery: (t) => {
2373
2595
  const n = Object.values(e.entries).find(
2374
2596
  (i) => i.queryId === t
2375
2597
  );
2376
- return n ? pe(n) : void 0;
2598
+ return n ? he(n) : void 0;
2377
2599
  },
2378
- getQueries: (t) => Object.values(e.entries).filter((n) => n.queryId === t).map(pe)
2600
+ getQueries: (t) => Object.values(e.entries).filter((n) => n.queryId === t).map(he)
2379
2601
  } : ar;
2380
2602
  }
2381
- function Gt(e) {
2603
+ function en(e) {
2382
2604
  return {
2383
- snapshot: () => Jt(ge(e())),
2384
- getQuery: (r) => Ge(ge(e()).getQuery(r)),
2385
- getQueries: (r) => ge(e()).getQueries(r).map((t) => Ge(t)).filter((t) => !!t)
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)
2386
2608
  };
2387
2609
  }
2388
- function Jt(e) {
2610
+ function rn(e) {
2389
2611
  if (!e.enabled)
2390
2612
  return e;
2391
- const r = e.queries.map(br);
2613
+ const r = e.queries.map(Ir);
2392
2614
  return {
2393
2615
  enabled: e.enabled,
2394
2616
  queries: r,
@@ -2397,35 +2619,35 @@ function Jt(e) {
2397
2619
  };
2398
2620
  }
2399
2621
  function Ge(e) {
2400
- return e ? br(e) : void 0;
2622
+ return e ? Ir(e) : void 0;
2401
2623
  }
2402
- function br(e) {
2624
+ function Ir(e) {
2403
2625
  var r;
2404
2626
  return (r = e == null ? void 0 : e.latestAttempt) != null && r.executionResult ? {
2405
2627
  ...e,
2406
2628
  latestAttempt: {
2407
2629
  ...e.latestAttempt,
2408
- executionResult: Yt(
2630
+ executionResult: tn(
2409
2631
  e.latestAttempt.executionResult
2410
2632
  )
2411
2633
  }
2412
2634
  } : e;
2413
2635
  }
2414
- function Yt(e) {
2636
+ function tn(e) {
2415
2637
  const {
2416
2638
  compiledQuery: r,
2417
2639
  intent: t,
2418
2640
  result: n,
2419
2641
  ...i
2420
- } = e, d = Xt(
2642
+ } = e, a = nn(
2421
2643
  i.metadata
2422
2644
  );
2423
2645
  return {
2424
2646
  ...i,
2425
- ...d ? { metadata: d } : {}
2647
+ ...a ? { metadata: a } : {}
2426
2648
  };
2427
2649
  }
2428
- function Xt(e) {
2650
+ function nn(e) {
2429
2651
  if (!e || typeof e != "object" || Array.isArray(e))
2430
2652
  return e;
2431
2653
  const r = e.dataAppDebug;
@@ -2437,49 +2659,49 @@ function Xt(e) {
2437
2659
  dataAppDebug: n
2438
2660
  };
2439
2661
  }
2440
- function Zt(e) {
2662
+ function on(e) {
2441
2663
  return e === void 0 || e === !1 ? {
2442
2664
  enabled: !1,
2443
2665
  exposeWindowBridge: !1,
2444
- maxEventsPerQuery: be,
2445
- maxQueries: Se
2666
+ maxEventsPerQuery: qe,
2667
+ maxQueries: Te
2446
2668
  } : e === !0 ? {
2447
2669
  enabled: !0,
2448
2670
  exposeWindowBridge: !1,
2449
- maxEventsPerQuery: be,
2450
- maxQueries: Se
2671
+ maxEventsPerQuery: qe,
2672
+ maxQueries: Te
2451
2673
  } : {
2452
2674
  enabled: e.enabled !== !1,
2453
2675
  exposeWindowBridge: e.exposeWindowBridge === !0,
2454
2676
  maxEventsPerQuery: Ye(
2455
2677
  e.maxEventsPerQuery,
2456
- be,
2457
- Qr
2678
+ qe,
2679
+ Gr
2458
2680
  ),
2459
2681
  maxQueries: Ye(
2460
2682
  e.maxQueries,
2461
- Se,
2462
- Vr
2683
+ Te,
2684
+ Jr
2463
2685
  )
2464
2686
  };
2465
2687
  }
2466
- function en(e) {
2688
+ function sn(e) {
2467
2689
  const t = [
2468
2690
  e == null ? void 0 : e.sourceHint,
2469
2691
  ...(e == null ? void 0 : e.sourceHints) || []
2470
2692
  ].filter((n) => !!n).map((n) => ({
2471
- file: ce(n.file),
2693
+ file: me(n.file),
2472
2694
  line: Je(n.line),
2473
2695
  column: Je(n.column),
2474
- exportName: ce(n.exportName),
2475
- component: ce(n.component),
2476
- note: ce(n.note)
2696
+ exportName: me(n.exportName),
2697
+ component: me(n.component),
2698
+ note: me(n.note)
2477
2699
  })).filter(
2478
2700
  (n) => !!(n.file || n.line || n.column || n.exportName || n.component || n.note)
2479
2701
  );
2480
2702
  return t.length ? t : void 0;
2481
2703
  }
2482
- function ce(e) {
2704
+ function me(e) {
2483
2705
  if (typeof e != "string")
2484
2706
  return;
2485
2707
  const r = e.trim();
@@ -2491,10 +2713,10 @@ function Je(e) {
2491
2713
  function Ye(e, r, t) {
2492
2714
  return e === void 0 || !Number.isFinite(e) || !Number.isInteger(e) || e <= 0 ? r : Math.min(e, t);
2493
2715
  }
2494
- function rn(e) {
2716
+ function an(e) {
2495
2717
  return typeof e.id == "string" && e.id.trim() ? e.id : void 0;
2496
2718
  }
2497
- function tn(e) {
2719
+ function dn(e) {
2498
2720
  switch (e) {
2499
2721
  case "metric":
2500
2722
  return "semaphor.metric";
@@ -2509,14 +2731,14 @@ function tn(e) {
2509
2731
  case "sql":
2510
2732
  return "semaphor.sql";
2511
2733
  default:
2512
- return he(e);
2734
+ return Ie(e);
2513
2735
  }
2514
2736
  }
2515
- function he(e) {
2737
+ function Ie(e) {
2516
2738
  throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`);
2517
2739
  }
2518
- function nn(e) {
2519
- if (on(e))
2740
+ function ln(e) {
2741
+ if (un(e))
2520
2742
  return;
2521
2743
  const r = e.value;
2522
2744
  if (r !== void 0) {
@@ -2536,7 +2758,7 @@ function nn(e) {
2536
2758
  function Xe(e) {
2537
2759
  return e.length > 80 ? `${e.slice(0, 77)}...` : e;
2538
2760
  }
2539
- function on(e) {
2761
+ function un(e) {
2540
2762
  var t;
2541
2763
  const r = [
2542
2764
  e.inputId,
@@ -2547,105 +2769,105 @@ function on(e) {
2547
2769
  (n) => r.includes(n)
2548
2770
  );
2549
2771
  }
2550
- function sn(e) {
2772
+ function cn(e) {
2551
2773
  const r = /* @__PURE__ */ new Map();
2552
- return me(e, (t) => {
2553
- un(t) && r.set(wr(t), t);
2774
+ return ve(e, (t) => {
2775
+ mn(t) && r.set(qr(t), t);
2554
2776
  }), [...r.values()];
2555
2777
  }
2556
- function an(e) {
2778
+ function fn(e) {
2557
2779
  switch (e.queryKind) {
2558
2780
  case "metric":
2559
2781
  case "analysis":
2560
- return J([
2782
+ return Y([
2561
2783
  ...e.measures || [],
2562
2784
  e.primaryMeasure,
2563
2785
  e.dateField,
2564
2786
  ...e.dimensions || []
2565
2787
  ]);
2566
2788
  case "records":
2567
- return J(e.fields || []);
2789
+ return Y(e.fields || []);
2568
2790
  case "inputOptions":
2569
- return J([
2791
+ return Y([
2570
2792
  e.labelField,
2571
2793
  e.valueField,
2572
2794
  e.searchField,
2573
2795
  ...e.disambiguationFields || []
2574
2796
  ]);
2575
2797
  case "sql":
2576
- return J(e.fields || []);
2798
+ return Y(e.fields || []);
2577
2799
  case "matrix":
2578
- return J([
2579
- ...(e.rows || []).map(qe),
2580
- ...(e.columns || []).map(qe),
2581
- ...(e.values || []).map(qe)
2800
+ return Y([
2801
+ ...(e.rows || []).map(Ee),
2802
+ ...(e.columns || []).map(Ee),
2803
+ ...(e.values || []).map(Ee)
2582
2804
  ]);
2583
2805
  default:
2584
- return he(e);
2806
+ return Ie(e);
2585
2807
  }
2586
2808
  }
2587
- function dn(e, r) {
2809
+ function pn(e, r) {
2588
2810
  const t = [
2589
- ...(e.inputs || []).map(Sr),
2811
+ ...(e.inputs || []).map(xr),
2590
2812
  ...(r || []).map((n) => n.field)
2591
2813
  ];
2592
- return J(t);
2814
+ return Y(t);
2593
2815
  }
2594
- function J(e) {
2816
+ function Y(e) {
2595
2817
  const r = /* @__PURE__ */ new Map();
2596
2818
  return e.forEach((t) => {
2597
- t && se(t) && r.set(Ne(t), t);
2819
+ t && ue(t) && r.set(Ke(t), t);
2598
2820
  }), [...r.values()];
2599
2821
  }
2600
- function Sr(e) {
2822
+ function xr(e) {
2601
2823
  if (!e || typeof e != "object")
2602
2824
  return;
2603
2825
  const r = e.toAnalyticsInput;
2604
2826
  if (typeof r == "function") {
2605
2827
  const n = r.call(e);
2606
- return Sr(n);
2828
+ return xr(n);
2607
2829
  }
2608
2830
  const t = e.field;
2609
- return se(t) ? t : void 0;
2831
+ return ue(t) ? t : void 0;
2610
2832
  }
2611
- function qe(e) {
2612
- if (se(e))
2833
+ function Ee(e) {
2834
+ if (ue(e))
2613
2835
  return e;
2614
2836
  if (!e || typeof e != "object")
2615
2837
  return;
2616
2838
  const r = e.field;
2617
- return se(r) ? r : void 0;
2839
+ return ue(r) ? r : void 0;
2618
2840
  }
2619
- function ln(e) {
2841
+ function gn(e) {
2620
2842
  const r = /* @__PURE__ */ new Map();
2621
- return me(e, (t) => {
2622
- se(t) && r.set(Ne(t), t);
2843
+ return ve(e, (t) => {
2844
+ ue(t) && r.set(Ke(t), t);
2623
2845
  }), [...r.values()];
2624
2846
  }
2625
- function me(e, r) {
2847
+ function ve(e, r) {
2626
2848
  if (!(!e || typeof e != "object")) {
2627
2849
  if (r(e), Array.isArray(e)) {
2628
- e.forEach((t) => me(t, r));
2850
+ e.forEach((t) => ve(t, r));
2629
2851
  return;
2630
2852
  }
2631
2853
  Object.values(e).forEach(
2632
- (t) => me(t, r)
2854
+ (t) => ve(t, r)
2633
2855
  );
2634
2856
  }
2635
2857
  }
2636
- function un(e) {
2858
+ function mn(e) {
2637
2859
  if (!e || typeof e != "object")
2638
2860
  return !1;
2639
2861
  const r = e;
2640
2862
  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;
2641
2863
  }
2642
- function se(e) {
2864
+ function ue(e) {
2643
2865
  if (!e || typeof e != "object")
2644
2866
  return !1;
2645
2867
  const r = e;
2646
2868
  return typeof r.name == "string" && (r.source !== void 0 || r.role !== void 0 || r.dataType !== void 0 || r.aggregate !== void 0);
2647
2869
  }
2648
- function wr(e) {
2870
+ function qr(e) {
2649
2871
  return e.kind === "semantic" ? [
2650
2872
  e.kind,
2651
2873
  e.domainId,
@@ -2658,19 +2880,19 @@ function wr(e) {
2658
2880
  e.tableName
2659
2881
  ].join(":") : [e.kind, e.connectionId].join(":");
2660
2882
  }
2661
- function Ne(e) {
2883
+ function Ke(e) {
2662
2884
  return [
2663
2885
  e.name,
2664
2886
  e.role,
2665
2887
  e.aggregate,
2666
- e.source ? wr(e.source) : ""
2888
+ e.source ? qr(e.source) : ""
2667
2889
  ].join(":");
2668
2890
  }
2669
- function cn(e) {
2891
+ function yn(e) {
2670
2892
  const r = e;
2671
2893
  return typeof (r == null ? void 0 : r.rowCount) == "number" ? r.rowCount : Array.isArray(r == null ? void 0 : r.records) ? r.records.length : void 0;
2672
2894
  }
2673
- function fn(e) {
2895
+ function hn(e) {
2674
2896
  const r = e;
2675
2897
  return Array.isArray(r == null ? void 0 : r.columns) ? r.columns.length : void 0;
2676
2898
  }
@@ -2682,19 +2904,19 @@ function er(e) {
2682
2904
  const r = e;
2683
2905
  return typeof (r == null ? void 0 : r.requestId) == "string" ? r.requestId : void 0;
2684
2906
  }
2685
- function xr(e) {
2907
+ function Tr(e) {
2686
2908
  let r = 2166136261;
2687
2909
  for (let t = 0; t < e.length; t += 1)
2688
2910
  r ^= e.charCodeAt(t), r = Math.imul(r, 16777619);
2689
2911
  return (r >>> 0).toString(36);
2690
2912
  }
2691
- function fe() {
2913
+ function ye() {
2692
2914
  return (/* @__PURE__ */ new Date()).toISOString();
2693
2915
  }
2694
- function $e() {
2916
+ function Fe() {
2695
2917
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
2696
2918
  }
2697
- const pn = [
2919
+ const bn = [
2698
2920
  "records",
2699
2921
  "changes",
2700
2922
  "drivers",
@@ -2702,7 +2924,7 @@ const pn = [
2702
2924
  "largestPositiveChanges",
2703
2925
  "largestNegativeDrivers",
2704
2926
  "largestPositiveDrivers"
2705
- ], gn = [
2927
+ ], vn = [
2706
2928
  "records",
2707
2929
  "changes",
2708
2930
  "drivers",
@@ -2711,10 +2933,10 @@ const pn = [
2711
2933
  "largestNegativeDrivers",
2712
2934
  "largestPositiveDrivers"
2713
2935
  ];
2714
- function Ir(e) {
2936
+ function Ar(e) {
2715
2937
  if (!e)
2716
2938
  return {};
2717
- const r = bn(e.executionResult), t = mn(e, r), n = hn(t);
2939
+ const r = qn(e.executionResult), t = Sn(e, r), n = In(t);
2718
2940
  return {
2719
2941
  ...e,
2720
2942
  ...Object.keys(t).length ? { resultSets: t } : {},
@@ -2725,84 +2947,84 @@ function Ir(e) {
2725
2947
  } : {}
2726
2948
  };
2727
2949
  }
2728
- function mn(e, r) {
2729
- const t = yn(e.resultSets);
2730
- for (const i of pn) {
2950
+ function Sn(e, r) {
2951
+ const t = wn(e.resultSets);
2952
+ for (const i of bn) {
2731
2953
  if (t[i]) {
2732
- t[i] = qr(t[i]);
2954
+ t[i] = Er(t[i]);
2733
2955
  continue;
2734
2956
  }
2735
- const d = Sn(e[i]);
2736
- if (!d.length)
2957
+ const a = Tn(e[i]);
2958
+ if (!a.length)
2737
2959
  continue;
2738
- const l = r.length ? r : wn(d);
2960
+ const l = r.length ? r : An(a);
2739
2961
  t[i] = {
2740
- records: We(d, l),
2962
+ records: _e(a, l),
2741
2963
  columns: l,
2742
- rowCount: d.length
2964
+ rowCount: a.length
2743
2965
  };
2744
2966
  }
2745
- const n = vn(e.executionResult);
2967
+ const n = xn(e.executionResult);
2746
2968
  return n && n.records.length > 0 && !t.records && (t.records = n), t;
2747
2969
  }
2748
- function yn(e) {
2970
+ function wn(e) {
2749
2971
  return Object.fromEntries(
2750
2972
  Object.entries(e || {}).map(([r, t]) => [
2751
2973
  r,
2752
- qr(t)
2974
+ Er(t)
2753
2975
  ])
2754
2976
  );
2755
2977
  }
2756
- function qr(e) {
2978
+ function Er(e) {
2757
2979
  var r;
2758
2980
  return {
2759
2981
  ...e,
2760
- records: We(
2982
+ records: _e(
2761
2983
  e.records || [],
2762
2984
  e.columns || []
2763
2985
  ),
2764
2986
  rowCount: e.rowCount ?? ((r = e.records) == null ? void 0 : r.length) ?? 0
2765
2987
  };
2766
2988
  }
2767
- function hn(e) {
2989
+ function In(e) {
2768
2990
  var r;
2769
- for (const t of gn)
2991
+ for (const t of vn)
2770
2992
  if ((r = e[t]) != null && r.records.length)
2771
2993
  return e[t];
2772
2994
  return Object.values(e).find((t) => t.records.length) || Object.values(e)[0];
2773
2995
  }
2774
- function vn(e) {
2996
+ function xn(e) {
2775
2997
  const r = e == null ? void 0 : e.result;
2776
2998
  if (!(!r || r.kind !== "records" && r.kind !== "sql"))
2777
2999
  return {
2778
- records: We(r.records, r.columns),
3000
+ records: _e(r.records, r.columns),
2779
3001
  columns: r.columns,
2780
3002
  rowCount: r.rowCount ?? r.records.length
2781
3003
  };
2782
3004
  }
2783
- function bn(e) {
3005
+ function qn(e) {
2784
3006
  const r = e == null ? void 0 : e.result;
2785
3007
  return !r || r.kind !== "records" && r.kind !== "sql" ? [] : r.columns;
2786
3008
  }
2787
- function Sn(e) {
3009
+ function Tn(e) {
2788
3010
  return Array.isArray(e) ? e.filter(
2789
3011
  (r) => !!(r && typeof r == "object" && !Array.isArray(r))
2790
3012
  ) : [];
2791
3013
  }
2792
- function We(e, r) {
3014
+ function _e(e, r) {
2793
3015
  return r.length ? e.map((t) => {
2794
3016
  const n = {};
2795
- return r.forEach((i, d) => {
2796
- const l = xn(t, {
3017
+ return r.forEach((i, a) => {
3018
+ const l = En(t, {
2797
3019
  name: i.key,
2798
3020
  label: i.label,
2799
- fallbackNames: [i.name, Object.keys(t)[d]]
3021
+ fallbackNames: [i.name, Object.keys(t)[a]]
2800
3022
  });
2801
3023
  l !== void 0 && (n[i.key] = l);
2802
3024
  }), Object.keys(n).length ? n : t;
2803
3025
  }) : e;
2804
3026
  }
2805
- function wn(e) {
3027
+ function An(e) {
2806
3028
  return Array.from(
2807
3029
  new Set(e.flatMap((t) => Object.keys(t)))
2808
3030
  ).map((t) => ({
@@ -2811,7 +3033,7 @@ function wn(e) {
2811
3033
  label: t
2812
3034
  }));
2813
3035
  }
2814
- function xn(e, r) {
3036
+ function En(e, r) {
2815
3037
  const t = [
2816
3038
  r.name,
2817
3039
  r.label,
@@ -2821,29 +3043,29 @@ function xn(e, r) {
2821
3043
  if (Object.prototype.hasOwnProperty.call(e, n))
2822
3044
  return e[n];
2823
3045
  }
2824
- function In() {
3046
+ function Rn() {
2825
3047
  return {
2826
- executeAnalysis: (e, r, t) => G(
3048
+ executeAnalysis: (e, r, t) => J(
2827
3049
  e,
2828
3050
  r,
2829
3051
  t ?? {}
2830
- ).then(Ir),
2831
- executeMetric: (e, r) => G(e, r),
2832
- executeRecords: (e, r) => G(e, r),
2833
- executeInputOptions: (e, r) => G(e, r),
2834
- executeSql: (e, r) => G(e, r),
2835
- executeMatrix: (e, r) => G(e, r)
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)
2836
3058
  };
2837
3059
  }
2838
- async function G(e, r, t) {
3060
+ async function J(e, r, t) {
2839
3061
  if (!r.token)
2840
3062
  throw new Error(
2841
3063
  "SemaphorDataAppProvider needs a token to execute queries."
2842
3064
  );
2843
- const n = Dn(r), i = An(e, n);
2844
- let d;
3065
+ const n = Wn(r), i = Ln(e, n);
3066
+ let a;
2845
3067
  try {
2846
- d = await fetch(n, {
3068
+ a = await fetch(n, {
2847
3069
  method: "POST",
2848
3070
  headers: {
2849
3071
  "Content-Type": "application/json",
@@ -2854,40 +3076,40 @@ async function G(e, r, t) {
2854
3076
  activeInputs: r.activeInputs,
2855
3077
  ...t ? { analysisOptions: t } : {},
2856
3078
  resultShape: e.kind,
2857
- ...Rn(r) ? { debug: { responseDetail: "debug" } } : {}
3079
+ ...kn(r) ? { debug: { responseDetail: "debug" } } : {}
2858
3080
  })
2859
3081
  });
2860
- } catch (c) {
3082
+ } catch (p) {
2861
3083
  throw new Error(
2862
- `${i}: ${c instanceof Error ? c.message : String(c)}`
3084
+ `${i}: ${p instanceof Error ? p.message : String(p)}`
2863
3085
  );
2864
3086
  }
2865
- const l = await kn(d);
2866
- if (!d.ok || l.error)
2867
- throw qn(
2868
- `${i}: ${l.error || `Semaphor Data App execution failed with status ${d.status}.`}`,
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}.`}`,
2869
3091
  l
2870
3092
  );
2871
3093
  return l;
2872
3094
  }
2873
- function qn(e, r) {
3095
+ function Cn(e, r) {
2874
3096
  const t = new Error(e);
2875
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;
2876
3098
  }
2877
- function Rn(e) {
3099
+ function kn(e) {
2878
3100
  const r = e.debug;
2879
3101
  return r ? r === !0 ? !0 : r.enabled !== !1 && r.requestServerDebug !== !1 : !1;
2880
3102
  }
2881
- function An(e, r) {
3103
+ function Ln(e, r) {
2882
3104
  return [
2883
3105
  `Semaphor ${e.kind} query`,
2884
3106
  e.id ? `id=${e.id}` : void 0,
2885
3107
  e.label ? `label=${e.label}` : void 0,
2886
- En(e),
2887
- `endpoint=${Tn(r)}`
3108
+ Dn(e),
3109
+ `endpoint=${On(r)}`
2888
3110
  ].filter((t) => !!t).join(" ");
2889
3111
  }
2890
- function En(e) {
3112
+ function Dn(e) {
2891
3113
  const r = "source" in e ? e.source : void 0;
2892
3114
  if (!(!r || typeof r != "object")) {
2893
3115
  if (r.kind === "semantic")
@@ -2906,7 +3128,7 @@ function En(e) {
2906
3128
  return r.connectionId ? `source=${r.connectionId}` : void 0;
2907
3129
  }
2908
3130
  }
2909
- function Tn(e) {
3131
+ function On(e) {
2910
3132
  if (!e)
2911
3133
  return "/api/v1/data-app/execute";
2912
3134
  try {
@@ -2915,7 +3137,7 @@ function Tn(e) {
2915
3137
  return e;
2916
3138
  }
2917
3139
  }
2918
- async function kn(e) {
3140
+ async function Bn(e) {
2919
3141
  const r = await e.text().catch(() => "");
2920
3142
  if (!r.trim())
2921
3143
  return e.ok ? {
@@ -2928,43 +3150,43 @@ async function kn(e) {
2928
3150
  error: "Semaphor Data App execution returned invalid JSON.",
2929
3151
  details: r
2930
3152
  } : {
2931
- error: Cn(e, r),
3153
+ error: $n(e, r),
2932
3154
  details: r
2933
3155
  };
2934
3156
  }
2935
3157
  }
2936
- function Cn(e, r) {
3158
+ function $n(e, r) {
2937
3159
  const t = e.statusText ? ` ${e.statusText}` : "", n = r.replace(/\s+/g, " ").trim();
2938
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}.`;
2939
3161
  }
2940
- function Dn(e) {
2941
- const r = Ln(e).replace(/\/+$/, "");
3162
+ function Wn(e) {
3163
+ const r = Nn(e).replace(/\/+$/, "");
2942
3164
  return r ? r.endsWith("/api") ? `${r}/v1/data-app/execute` : `${r}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
2943
3165
  }
2944
- function Ln(e) {
3166
+ function Nn(e) {
2945
3167
  if (e.apiBaseUrl)
2946
3168
  return e.apiBaseUrl;
2947
3169
  if (!e.token)
2948
3170
  return "";
2949
3171
  try {
2950
- return jr(e.token).apiServiceUrl || "";
3172
+ return Qr(e.token).apiServiceUrl || "";
2951
3173
  } catch {
2952
3174
  return "";
2953
3175
  }
2954
3176
  }
2955
- const Rr = ye({});
2956
- function On() {
3177
+ const Rr = Se({});
3178
+ function Kn() {
2957
3179
  if (!(typeof window > "u"))
2958
3180
  return window.__SEMAPHOR_DATA_APP_RUNTIME__;
2959
3181
  }
2960
- function Bn() {
2961
- return Q(Rr);
3182
+ function Fn() {
3183
+ return V(Rr);
2962
3184
  }
2963
- const Re = { value: null }, Ae = {}, Kn = { records: [] }, Ee = { options: [] }, Nn = { records: [] }, Te = {};
2964
- function $n(e) {
2965
- const r = Y(e.inputs), t = Br(e);
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);
2966
3188
  try {
2967
- const n = Kr(e), i = X(n);
3189
+ const n = Kr(e), i = ee(n);
2968
3190
  return i ? {
2969
3191
  error: i,
2970
3192
  activeInputs: r,
@@ -2975,17 +3197,17 @@ function $n(e) {
2975
3197
  i,
2976
3198
  t
2977
3199
  ),
2978
- idleData: Ae
3200
+ idleData: Ce
2979
3201
  } : {
2980
3202
  intent: n,
2981
3203
  error: null,
2982
3204
  activeInputs: r,
2983
3205
  analysisOptions: t,
2984
3206
  queryKey: q(n, r, void 0, t),
2985
- idleData: Ae
3207
+ idleData: Ce
2986
3208
  };
2987
3209
  } catch (n) {
2988
- const i = _(n);
3210
+ const i = z(n);
2989
3211
  return {
2990
3212
  error: i,
2991
3213
  activeInputs: r,
@@ -2996,14 +3218,14 @@ function $n(e) {
2996
3218
  i,
2997
3219
  t
2998
3220
  ),
2999
- idleData: Ae
3221
+ idleData: Ce
3000
3222
  };
3001
3223
  }
3002
3224
  }
3003
- function Wn(e) {
3004
- const r = Y(e.inputs);
3225
+ function Hn(e) {
3226
+ const r = Z(e.inputs);
3005
3227
  try {
3006
- const t = Nr(e), n = X(t);
3228
+ const t = Fr(e), n = ee(t);
3007
3229
  return n ? {
3008
3230
  error: n,
3009
3231
  activeInputs: r,
@@ -3017,7 +3239,7 @@ function Wn(e) {
3017
3239
  idleData: Re
3018
3240
  };
3019
3241
  } catch (t) {
3020
- const n = _(t);
3242
+ const n = z(t);
3021
3243
  return {
3022
3244
  error: n,
3023
3245
  activeInputs: r,
@@ -3026,10 +3248,10 @@ function Wn(e) {
3026
3248
  };
3027
3249
  }
3028
3250
  }
3029
- function Fn(e) {
3030
- const r = Y(e.inputs), t = Kn;
3251
+ function jn(e) {
3252
+ const r = Z(e.inputs), t = _n;
3031
3253
  try {
3032
- const n = Or(e), i = X(n);
3254
+ const n = Wr(e), i = ee(n);
3033
3255
  return i ? {
3034
3256
  error: i,
3035
3257
  activeInputs: r,
@@ -3043,7 +3265,7 @@ function Fn(e) {
3043
3265
  idleData: t
3044
3266
  };
3045
3267
  } catch (n) {
3046
- const i = _(n);
3268
+ const i = z(n);
3047
3269
  return {
3048
3270
  error: i,
3049
3271
  activeInputs: r,
@@ -3052,36 +3274,36 @@ function Fn(e) {
3052
3274
  };
3053
3275
  }
3054
3276
  }
3055
- function _n(e) {
3056
- const r = Y(e.inputs);
3277
+ function Pn(e) {
3278
+ const r = Z(e.inputs);
3057
3279
  try {
3058
- const t = Lr(e), n = X(t);
3280
+ const t = $r(e), n = ee(t);
3059
3281
  return n ? {
3060
3282
  error: n,
3061
3283
  activeInputs: r,
3062
3284
  queryKey: q(void 0, r, n),
3063
- idleData: Ee
3285
+ idleData: ke
3064
3286
  } : {
3065
3287
  intent: t,
3066
3288
  error: null,
3067
3289
  activeInputs: r,
3068
3290
  queryKey: q(t, r),
3069
- idleData: Ee
3291
+ idleData: ke
3070
3292
  };
3071
3293
  } catch (t) {
3072
- const n = _(t);
3294
+ const n = z(t);
3073
3295
  return {
3074
3296
  error: n,
3075
3297
  activeInputs: r,
3076
3298
  queryKey: q(void 0, r, n),
3077
- idleData: Ee
3299
+ idleData: ke
3078
3300
  };
3079
3301
  }
3080
3302
  }
3081
- function zn(e) {
3082
- const r = Y(e.inputs), t = Nn;
3303
+ function Vn(e) {
3304
+ const r = Z(e.inputs), t = zn;
3083
3305
  try {
3084
- const n = Dr(e), i = X(n);
3306
+ const n = Br(e), i = ee(n);
3085
3307
  return i ? {
3086
3308
  error: i,
3087
3309
  activeInputs: r,
@@ -3095,7 +3317,7 @@ function zn(e) {
3095
3317
  idleData: t
3096
3318
  };
3097
3319
  } catch (n) {
3098
- const i = _(n);
3320
+ const i = z(n);
3099
3321
  return {
3100
3322
  error: i,
3101
3323
  activeInputs: r,
@@ -3104,37 +3326,37 @@ function zn(e) {
3104
3326
  };
3105
3327
  }
3106
3328
  }
3107
- function Hn(e) {
3108
- const r = Y(e.inputs);
3329
+ function Qn(e) {
3330
+ const r = Z(e.inputs);
3109
3331
  try {
3110
- const t = Cr(e), n = X(t);
3332
+ const t = Or(e), n = ee(t);
3111
3333
  return n ? {
3112
3334
  error: n,
3113
3335
  activeInputs: r,
3114
3336
  queryKey: q(void 0, r, n),
3115
- idleData: Te
3337
+ idleData: Le
3116
3338
  } : {
3117
3339
  intent: t,
3118
3340
  error: null,
3119
3341
  activeInputs: r,
3120
3342
  queryKey: q(t, r),
3121
- idleData: Te
3343
+ idleData: Le
3122
3344
  };
3123
3345
  } catch (t) {
3124
- const n = _(t);
3346
+ const n = z(t);
3125
3347
  return {
3126
3348
  error: n,
3127
3349
  activeInputs: r,
3128
3350
  queryKey: q(void 0, r, n),
3129
- idleData: Te
3351
+ idleData: Le
3130
3352
  };
3131
3353
  }
3132
3354
  }
3133
- function _(e) {
3355
+ function z(e) {
3134
3356
  return e instanceof Error ? e : new Error(String(e));
3135
3357
  }
3136
- function X(e) {
3137
- const r = Pr(e);
3358
+ function ee(e) {
3359
+ const r = Ur(e);
3138
3360
  if (r.ok)
3139
3361
  return null;
3140
3362
  const t = r.errors.map(
@@ -3150,90 +3372,90 @@ function q(e, r, t, n) {
3150
3372
  error: t == null ? void 0 : t.message
3151
3373
  });
3152
3374
  }
3153
- function si(e) {
3154
- const [r, t] = V(e.defaultValue), n = Object.prototype.hasOwnProperty.call(e, "value"), i = n ? e.value : r, d = b(
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(
3155
3377
  () => nr(e.options),
3156
3378
  [e.options]
3157
3379
  ), l = O(
3158
- (u) => {
3159
- var m;
3160
- const f = u;
3161
- (m = e.onValueChange) == null || m.call(e, f), n || t(f);
3380
+ (c) => {
3381
+ var b;
3382
+ const u = c;
3383
+ (b = e.onValueChange) == null || b.call(e, u), n || t(u);
3162
3384
  },
3163
3385
  [n, e]
3164
- ), c = O(() => l(void 0), [l]);
3165
- return b(() => {
3166
- const u = ir(e);
3386
+ ), p = O(() => l(void 0), [l]);
3387
+ return w(() => {
3388
+ const c = ir(e);
3167
3389
  return {
3168
3390
  id: e.id,
3169
3391
  kind: e.kind,
3170
3392
  label: e.label,
3171
- field: u.field,
3172
- operator: u.operator,
3173
- relationshipHint: u.relationshipHint,
3393
+ field: c.field,
3394
+ operator: c.operator,
3395
+ relationshipHint: c.relationshipHint,
3174
3396
  controlRole: e.kind === "control" ? e.role : void 0,
3175
3397
  value: i,
3176
- options: d,
3177
- isActive: oe(i),
3398
+ options: a,
3399
+ isActive: le(i),
3178
3400
  setValue: l,
3179
- clear: c,
3401
+ clear: p,
3180
3402
  toAnalyticsInput: () => ({
3181
- inputId: u.inputId,
3182
- field: u.field,
3403
+ inputId: c.inputId,
3404
+ field: c.field,
3183
3405
  kind: e.kind,
3184
3406
  label: e.label,
3185
3407
  value: i,
3186
- isActive: oe(i),
3187
- operator: u.operator,
3188
- relationshipHint: u.relationshipHint,
3408
+ isActive: le(i),
3409
+ operator: c.operator,
3410
+ relationshipHint: c.relationshipHint,
3189
3411
  controlRole: e.kind === "control" ? e.role : void 0
3190
3412
  })
3191
3413
  };
3192
- }, [c, d, l, e, i]);
3414
+ }, [p, a, l, e, i]);
3193
3415
  }
3194
- function ai(e) {
3195
- const [r, t] = V(() => Qn(e));
3196
- return K(() => {
3416
+ function fi(e) {
3417
+ const [r, t] = Q(() => Yn(e));
3418
+ return B(() => {
3197
3419
  t((n) => {
3198
3420
  let i = n;
3199
- for (const d of e)
3200
- !Object.prototype.hasOwnProperty.call(i, d.id) && d.defaultValue !== void 0 && (i = { ...i, [d.id]: d.defaultValue });
3421
+ for (const a of e)
3422
+ !Object.prototype.hasOwnProperty.call(i, a.id) && a.defaultValue !== void 0 && (i = { ...i, [a.id]: a.defaultValue });
3201
3423
  return i;
3202
3424
  });
3203
- }, [e]), b(
3425
+ }, [e]), w(
3204
3426
  () => e.map((n) => {
3205
3427
  const i = Object.prototype.hasOwnProperty.call(
3206
3428
  n,
3207
3429
  "value"
3208
- ), d = i ? n.value : r[n.id], l = nr(n.options), c = (m) => {
3430
+ ), a = i ? n.value : r[n.id], l = nr(n.options), p = (b) => {
3209
3431
  var y;
3210
- (y = n.onValueChange) == null || y.call(n, m), i || t((h) => ({
3211
- ...h,
3212
- [n.id]: m
3432
+ (y = n.onValueChange) == null || y.call(n, b), i || t((v) => ({
3433
+ ...v,
3434
+ [n.id]: b
3213
3435
  }));
3214
- }, u = () => c(void 0), f = ir(n);
3436
+ }, c = () => p(void 0), u = ir(n);
3215
3437
  return {
3216
3438
  id: n.id,
3217
3439
  kind: n.kind,
3218
3440
  label: n.label,
3219
- field: f.field,
3220
- operator: f.operator,
3221
- relationshipHint: f.relationshipHint,
3441
+ field: u.field,
3442
+ operator: u.operator,
3443
+ relationshipHint: u.relationshipHint,
3222
3444
  controlRole: n.kind === "control" ? n.role : void 0,
3223
- value: d,
3445
+ value: a,
3224
3446
  options: l,
3225
- isActive: oe(d),
3226
- setValue: c,
3227
- clear: u,
3447
+ isActive: le(a),
3448
+ setValue: p,
3449
+ clear: c,
3228
3450
  toAnalyticsInput: () => ({
3229
- inputId: f.inputId,
3230
- field: f.field,
3451
+ inputId: u.inputId,
3452
+ field: u.field,
3231
3453
  kind: n.kind,
3232
3454
  label: n.label,
3233
- value: d,
3234
- isActive: oe(d),
3235
- operator: f.operator,
3236
- relationshipHint: f.relationshipHint,
3455
+ value: a,
3456
+ isActive: le(a),
3457
+ operator: u.operator,
3458
+ relationshipHint: u.relationshipHint,
3237
3459
  controlRole: n.kind === "control" ? n.role : void 0
3238
3460
  })
3239
3461
  };
@@ -3241,14 +3463,14 @@ function ai(e) {
3241
3463
  [e, r]
3242
3464
  );
3243
3465
  }
3244
- function di(e, r) {
3245
- const t = (r == null ? void 0 : r.status) === "success" ? r.options : void 0, n = b(() => jn(t), [t]);
3246
- K(() => {
3247
- Mn(e.value, t) || e.clear();
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();
3248
3470
  }, [e, n, r == null ? void 0 : r.status, t]);
3249
3471
  }
3250
- function Mn(e, r) {
3251
- if (!oe(e) || r === void 0)
3472
+ function Un(e, r) {
3473
+ if (!le(e) || r === void 0)
3252
3474
  return !0;
3253
3475
  const t = new Set(
3254
3476
  r.map((i) => rr(i.value))
@@ -3257,62 +3479,62 @@ function Mn(e, r) {
3257
3479
  (i) => t.has(rr(i))
3258
3480
  );
3259
3481
  }
3260
- function jn(e) {
3482
+ function Gn(e) {
3261
3483
  return JSON.stringify((e || []).map((r) => r.value));
3262
3484
  }
3263
3485
  function rr(e) {
3264
3486
  return `${typeof e}:${String(e)}`;
3265
3487
  }
3266
- function li(e, r = {}) {
3267
- const t = b(
3488
+ function gi(e, r = {}) {
3489
+ const t = w(
3268
3490
  () => r.inputs ? {
3269
3491
  ...e,
3270
3492
  inputs: r.inputs
3271
3493
  } : e,
3272
3494
  [r.inputs, e]
3273
- ), n = b(() => {
3495
+ ), n = w(() => {
3274
3496
  switch (t.queryKind) {
3275
3497
  case "metric":
3276
3498
  return {
3277
3499
  queryKind: t.queryKind,
3278
- request: Wn(t)
3500
+ request: Hn(t)
3279
3501
  };
3280
3502
  case "analysis":
3281
3503
  return {
3282
3504
  queryKind: t.queryKind,
3283
- request: $n(t)
3505
+ request: Mn(t)
3284
3506
  };
3285
3507
  case "records":
3286
3508
  return {
3287
3509
  queryKind: t.queryKind,
3288
- request: Fn(t)
3510
+ request: jn(t)
3289
3511
  };
3290
3512
  case "inputOptions":
3291
3513
  return {
3292
3514
  queryKind: t.queryKind,
3293
- request: _n(t)
3515
+ request: Pn(t)
3294
3516
  };
3295
3517
  case "sql":
3296
3518
  return {
3297
3519
  queryKind: t.queryKind,
3298
- request: zn(t)
3520
+ request: Vn(t)
3299
3521
  };
3300
3522
  case "matrix":
3301
3523
  return {
3302
3524
  queryKind: t.queryKind,
3303
- request: Hn(t)
3525
+ request: Qn(t)
3304
3526
  };
3305
3527
  default:
3306
- return ke(t);
3528
+ return De(t);
3307
3529
  }
3308
- }, [t]), i = Xr({
3530
+ }, [t]), i = rt({
3309
3531
  spec: t,
3310
3532
  queryKind: n.queryKind,
3311
3533
  queryKey: n.request.queryKey,
3312
3534
  intent: n.request.intent,
3313
3535
  activeInputs: n.request.activeInputs,
3314
3536
  debug: r.debug
3315
- }), d = D(null), l = b(
3537
+ }), a = L(null), l = w(
3316
3538
  () => ({
3317
3539
  start: i.start,
3318
3540
  success: i.success,
@@ -3325,232 +3547,232 @@ function li(e, r = {}) {
3325
3547
  i.start,
3326
3548
  i.success
3327
3549
  ]
3328
- ), c = O(
3329
- (a) => {
3330
- var C, L, B, v, w, A, I, E, z;
3331
- const x = n.request;
3332
- if (x.intent)
3550
+ ), p = O(
3551
+ (d) => {
3552
+ var $, A, W, D, m, S, k, x, T;
3553
+ const I = n.request;
3554
+ if (I.intent)
3333
3555
  switch (n.queryKind) {
3334
3556
  case "metric":
3335
- return (C = a.executor) == null ? void 0 : C.executeMetric(
3336
- x.intent,
3337
- a
3557
+ return ($ = d.executor) == null ? void 0 : $.executeMetric(
3558
+ I.intent,
3559
+ d
3338
3560
  );
3339
3561
  case "analysis":
3340
- return (B = (L = a.executor) == null ? void 0 : L.executeAnalysis) == null ? void 0 : B.call(
3341
- L,
3342
- x.intent,
3343
- a,
3344
- x.analysisOptions
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
3345
3567
  );
3346
3568
  case "records":
3347
- return (v = a.executor) == null ? void 0 : v.executeRecords(
3348
- x.intent,
3349
- a
3569
+ return (D = d.executor) == null ? void 0 : D.executeRecords(
3570
+ I.intent,
3571
+ d
3350
3572
  );
3351
3573
  case "inputOptions":
3352
- return (w = a.executor) == null ? void 0 : w.executeInputOptions(
3353
- x.intent,
3354
- a
3574
+ return (m = d.executor) == null ? void 0 : m.executeInputOptions(
3575
+ I.intent,
3576
+ d
3355
3577
  );
3356
3578
  case "sql":
3357
- return (I = (A = a.executor) == null ? void 0 : A.executeSql) == null ? void 0 : I.call(
3358
- A,
3359
- x.intent,
3360
- a
3579
+ return (k = (S = d.executor) == null ? void 0 : S.executeSql) == null ? void 0 : k.call(
3580
+ S,
3581
+ I.intent,
3582
+ d
3361
3583
  );
3362
3584
  case "matrix":
3363
- return (z = (E = a.executor) == null ? void 0 : E.executeMatrix) == null ? void 0 : z.call(
3364
- E,
3365
- x.intent,
3366
- a
3585
+ return (T = (x = d.executor) == null ? void 0 : x.executeMatrix) == null ? void 0 : T.call(
3586
+ x,
3587
+ I.intent,
3588
+ d
3367
3589
  );
3368
3590
  default:
3369
- return ke(n);
3591
+ return De(n);
3370
3592
  }
3371
3593
  },
3372
3594
  [n]
3373
- ), u = Pn(
3595
+ ), c = Jn(
3374
3596
  n.request.queryKey,
3375
- c,
3597
+ p,
3376
3598
  n.request.idleData,
3377
3599
  n.request.activeInputs,
3378
3600
  l
3379
- ), f = i.queryId, m = i.validationFailure;
3380
- K(() => {
3381
- const a = n.request.error;
3382
- if (!a) {
3383
- d.current = null;
3601
+ ), u = i.queryId, b = i.validationFailure;
3602
+ B(() => {
3603
+ const d = n.request.error;
3604
+ if (!d) {
3605
+ a.current = null;
3384
3606
  return;
3385
3607
  }
3386
- const x = `${f}:${a.message}`;
3387
- d.current !== x && (d.current = x, m(a));
3608
+ const I = `${u}:${d.message}`;
3609
+ a.current !== I && (a.current = I, b(d));
3388
3610
  }, [
3389
3611
  n.request.error,
3390
3612
  n.request.queryKey,
3391
- f,
3392
- m
3613
+ u,
3614
+ b
3393
3615
  ]);
3394
- const y = n.request.error ? n.request.idleData : u.data, h = n.request.error ? "error" : u.status, g = !n.request.error && u.status === "loading", S = n.request.error || u.error, k = i.trace;
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;
3395
3617
  switch (n.queryKind) {
3396
3618
  case "metric": {
3397
- const a = y;
3619
+ const d = y;
3398
3620
  return {
3399
3621
  id: t.id,
3400
3622
  intent: n.request.intent,
3401
- value: (a == null ? void 0 : a.value) ?? null,
3402
- measures: a == null ? void 0 : a.measures,
3403
- comparisonValue: a == null ? void 0 : a.comparisonValue,
3404
- delta: a == null ? void 0 : a.delta,
3405
- deltaPercent: a == null ? void 0 : a.deltaPercent,
3406
- records: a == null ? void 0 : a.records,
3407
- executionResult: a == null ? void 0 : a.executionResult,
3408
- status: h,
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,
3409
3631
  isLoading: g,
3410
- error: S,
3411
- trace: k
3632
+ error: h,
3633
+ trace: C
3412
3634
  };
3413
3635
  }
3414
3636
  case "analysis": {
3415
- const a = Ir(y);
3637
+ const d = Ar(y);
3416
3638
  return {
3417
3639
  id: t.id,
3418
3640
  intent: n.request.intent,
3419
- ...a || {},
3420
- status: h,
3641
+ ...d || {},
3642
+ status: v,
3421
3643
  isLoading: g,
3422
- error: S,
3423
- trace: k
3644
+ error: h,
3645
+ trace: C
3424
3646
  };
3425
3647
  }
3426
3648
  case "records": {
3427
- const a = y;
3649
+ const d = y;
3428
3650
  return {
3429
3651
  id: t.id,
3430
3652
  intent: n.request.intent,
3431
- records: (a == null ? void 0 : a.records) || [],
3432
- columns: a == null ? void 0 : a.columns,
3433
- rowCount: a == null ? void 0 : a.rowCount,
3434
- pagination: a == null ? void 0 : a.pagination,
3435
- executionResult: a == null ? void 0 : a.executionResult,
3436
- status: h,
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,
3437
3659
  isLoading: g,
3438
- error: S,
3439
- trace: k
3660
+ error: h,
3661
+ trace: C
3440
3662
  };
3441
3663
  }
3442
3664
  case "inputOptions": {
3443
- const a = y;
3665
+ const d = y;
3444
3666
  return {
3445
3667
  id: t.id,
3446
3668
  intent: n.request.intent,
3447
- options: (a == null ? void 0 : a.options) || [],
3448
- executionResult: a == null ? void 0 : a.executionResult,
3449
- status: h,
3669
+ options: (d == null ? void 0 : d.options) || [],
3670
+ executionResult: d == null ? void 0 : d.executionResult,
3671
+ status: v,
3450
3672
  isLoading: g,
3451
- error: S,
3452
- trace: k
3673
+ error: h,
3674
+ trace: C
3453
3675
  };
3454
3676
  }
3455
3677
  case "sql": {
3456
- const a = y;
3678
+ const d = y;
3457
3679
  return {
3458
3680
  id: t.id,
3459
3681
  intent: n.request.intent,
3460
- records: (a == null ? void 0 : a.records) || [],
3461
- columns: a == null ? void 0 : a.columns,
3462
- rowCount: a == null ? void 0 : a.rowCount,
3463
- pagination: a == null ? void 0 : a.pagination,
3464
- output: a == null ? void 0 : a.output,
3465
- rowLimitExceeded: a == null ? void 0 : a.rowLimitExceeded,
3466
- executionResult: a == null ? void 0 : a.executionResult,
3467
- status: h,
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,
3468
3690
  isLoading: g,
3469
- error: S,
3470
- trace: k
3691
+ error: h,
3692
+ trace: C
3471
3693
  };
3472
3694
  }
3473
3695
  case "matrix": {
3474
- const a = y;
3696
+ const d = y;
3475
3697
  return {
3476
3698
  id: t.id,
3477
3699
  intent: n.request.intent,
3478
- matrixResult: a == null ? void 0 : a.matrixResult,
3479
- grid: a == null ? void 0 : a.grid,
3480
- expansion: a == null ? void 0 : a.expansion,
3481
- executionResult: a == null ? void 0 : a.executionResult,
3482
- status: h,
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,
3483
3705
  isLoading: g,
3484
- error: S,
3485
- trace: k
3706
+ error: h,
3707
+ trace: C
3486
3708
  };
3487
3709
  }
3488
3710
  default:
3489
- return ke(n);
3711
+ return De(n);
3490
3712
  }
3491
3713
  }
3492
- function Pn(e, r, t, n, i) {
3493
- const d = Bn(), l = D(r), c = D(n), [u, f] = V({
3714
+ function Jn(e, r, t, n, i) {
3715
+ const a = Fn(), l = L(r), p = L(n), [c, u] = Q({
3494
3716
  status: "idle",
3495
3717
  data: t,
3496
3718
  error: null
3497
3719
  });
3498
- return l.current = r, c.current = n, K(() => {
3499
- let m;
3720
+ return l.current = r, p.current = n, B(() => {
3721
+ let b;
3500
3722
  try {
3501
- m = l.current({
3502
- ...d,
3503
- activeInputs: c.current
3723
+ b = l.current({
3724
+ ...a,
3725
+ activeInputs: p.current
3504
3726
  });
3505
3727
  } catch (g) {
3506
- i == null || i.failure(g, 0), f({
3728
+ i == null || i.failure(g, 0), u({
3507
3729
  status: "error",
3508
3730
  data: t,
3509
- error: _(g)
3731
+ error: z(g)
3510
3732
  });
3511
3733
  return;
3512
3734
  }
3513
- if (!m) {
3514
- f({ status: "idle", data: t, error: null });
3735
+ if (!b) {
3736
+ u({ status: "idle", data: t, error: null });
3515
3737
  return;
3516
3738
  }
3517
3739
  let y = !1;
3518
- const h = Ar();
3519
- return i == null || i.start(), f((g) => ({
3740
+ const v = Cr();
3741
+ return i == null || i.start(), u((g) => ({
3520
3742
  status: "loading",
3521
3743
  data: g.data,
3522
3744
  error: null
3523
- })), m.then((g) => {
3524
- y ? i == null || i.ignored("superseded") : (i == null || i.success(g, tr(h)), f({ status: "success", data: g, 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 }));
3525
3747
  }).catch((g) => {
3526
- y ? i == null || i.ignored("superseded") : (i == null || i.failure(g, tr(h)), f({
3748
+ y ? i == null || i.ignored("superseded") : (i == null || i.failure(g, tr(v)), u({
3527
3749
  status: "error",
3528
3750
  data: t,
3529
- error: _(g)
3751
+ error: z(g)
3530
3752
  }));
3531
3753
  }), () => {
3532
3754
  y = !0;
3533
3755
  };
3534
- }, [t, e, d, i]), u;
3756
+ }, [t, e, a, i]), c;
3535
3757
  }
3536
- function Ar() {
3758
+ function Cr() {
3537
3759
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
3538
3760
  }
3539
3761
  function tr(e) {
3540
- return Math.max(0, Math.round(Ar() - e));
3762
+ return Math.max(0, Math.round(Cr() - e));
3541
3763
  }
3542
- function Qn(e) {
3764
+ function Yn(e) {
3543
3765
  return Object.fromEntries(
3544
3766
  e.filter((r) => r.defaultValue !== void 0).map((r) => [r.id, r.defaultValue])
3545
3767
  );
3546
3768
  }
3547
- function ke(e) {
3769
+ function De(e) {
3548
3770
  throw new Error(`Unsupported Semaphor query kind: ${JSON.stringify(e)}`);
3549
3771
  }
3550
- function Vn(e) {
3772
+ function Xn(e) {
3551
3773
  return !e || typeof e == "boolean" || e.enabled === !1 ? null : e.autoRenderDevtools === !0 ? {} : e.autoRenderDevtools ? e.autoRenderDevtools : null;
3552
3774
  }
3553
- function ui({
3775
+ function mi({
3554
3776
  token: e,
3555
3777
  apiBaseUrl: r,
3556
3778
  executor: t,
@@ -3558,33 +3780,33 @@ function ui({
3558
3780
  children: i
3559
3781
  }) {
3560
3782
  var g;
3561
- const d = On(), l = ((g = d == null ? void 0 : d.authToken) == null ? void 0 : g.accessToken) || e, c = (d == null ? void 0 : d.dataApiBaseUrl) || (d == null ? void 0 : d.apiBaseUrl) || r, u = (d == null ? void 0 : d.debug) ?? n, f = Vn(u), m = b(() => In(), []), y = t || m, h = b(
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(
3562
3784
  () => ({
3563
3785
  token: l,
3564
- apiBaseUrl: c,
3786
+ apiBaseUrl: p,
3565
3787
  executor: y,
3566
- debug: u
3788
+ debug: c
3567
3789
  }),
3568
- [c, u, y, l]
3790
+ [p, c, y, l]
3569
3791
  );
3570
- return /* @__PURE__ */ o(Ur, { debug: u, children: /* @__PURE__ */ p(Rr.Provider, { value: h, children: [
3792
+ return /* @__PURE__ */ s(Yr, { debug: c, children: /* @__PURE__ */ f(Rr.Provider, { value: v, children: [
3571
3793
  i,
3572
- f ? /* @__PURE__ */ o(Yr, { ...f }) : null
3794
+ u ? /* @__PURE__ */ s(et, { ...u }) : null
3573
3795
  ] }) });
3574
3796
  }
3575
3797
  export {
3576
- ui as SemaphorDataAppProvider,
3577
- Yr as SemaphorDevtools,
3578
- oi as SemaphorDevtoolsInspectButton,
3579
- ii as SemaphorViewBoundary,
3580
- In as createSemaphorQueryExecutor,
3581
- ri as defineSemaphorDataApp,
3582
- ti as defineSemaphorInput,
3583
- Mn as isSemaphorInputValueValidForOptions,
3584
- ni as semaphor,
3585
- di as useClearInvalidSemaphorInputValue,
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,
3586
3808
  lr as useSemaphorDevtools,
3587
- si as useSemaphorInput,
3588
- ai as useSemaphorInputs,
3589
- li as useSemaphorQuery
3809
+ ci as useSemaphorInput,
3810
+ fi as useSemaphorInputs,
3811
+ gi as useSemaphorQuery
3590
3812
  };