@nivaro/react 0.3.94 → 0.3.96

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,44 +1,44 @@
1
1
  import { jsxs as d, jsx as e, Fragment as y } from "react/jsx-runtime";
2
- import { useQuery as A } from "@tanstack/react-query";
3
- import { ArrowLeft as B, ChevronRight as j, ExternalLink as R } from "lucide-react";
4
- import { useState as F, useCallback as q, useMemo as J, Suspense as K, createContext as Q, useEffect as z, lazy as M, useContext as G } from "react";
5
- import { useNavigation as H, useNivaroClient as V } from "../../context.js";
6
- import { get as W } from "../../lib/commands.js";
7
- import { cn as w } from "../../lib/utils.js";
8
- import { QueryErrorState as X } from "../QueryErrorState.js";
9
- import { Sheet as Y, SheetContent as Z, SheetTitle as ee, SheetDescription as te } from "../ui/sheet.js";
10
- import { Skeleton as E } from "../ui/skeleton.js";
11
- import { Chip as re } from "./chip.js";
12
- import { num as S, ms as ne } from "./format.js";
13
- const le = M(
14
- () => import("../RecordDrilldownSheet.js").then((i) => ({ default: i.RecordDrilldownSheet }))
15
- ), I = Q(null);
16
- function ie() {
17
- return G(I);
2
+ import { useQuery as Q } from "@tanstack/react-query";
3
+ import { ArrowLeft as z, ChevronRight as B, ExternalLink as j } from "lucide-react";
4
+ import { useState as A, useCallback as U, useMemo as X, Suspense as V, createContext as W, useEffect as Y, lazy as Z, useContext as ee } from "react";
5
+ import { useNavigation as te, useNivaroClient as re } from "../../context.js";
6
+ import { get as ne } from "../../lib/commands.js";
7
+ import { cn as k } from "../../lib/utils.js";
8
+ import { QueryErrorState as ae } from "../QueryErrorState.js";
9
+ import { Sheet as le, SheetContent as ie, SheetTitle as oe, SheetDescription as de } from "../ui/sheet.js";
10
+ import { Skeleton as q } from "../ui/skeleton.js";
11
+ import { Chip as se } from "./chip.js";
12
+ import { num as S, ms as H } from "./format.js";
13
+ const ce = Z(
14
+ () => import("../RecordDrilldownSheet.js").then((a) => ({ default: a.RecordDrilldownSheet }))
15
+ ), M = W(null);
16
+ function me() {
17
+ return ee(M);
18
18
  }
19
- function ve({
20
- target: i,
21
- children: n,
22
- className: m,
23
- tip: p
19
+ function Pe({
20
+ target: a,
21
+ children: r,
22
+ className: l,
23
+ tip: c
24
24
  }) {
25
- const a = ie();
26
- return !a || !i ? /* @__PURE__ */ e(y, { children: n }) : /* @__PURE__ */ e(
25
+ const n = me();
26
+ return !n || !a ? /* @__PURE__ */ e(y, { children: r }) : /* @__PURE__ */ e(
27
27
  "button",
28
28
  {
29
29
  type: "button",
30
- "data-ops-drill": i.metric,
31
- "data-tip": p ?? "Show the rows behind this",
32
- onClick: () => a.open(i),
33
- className: w(
30
+ "data-ops-drill": a.metric,
31
+ "data-tip": c ?? "Show the rows behind this",
32
+ onClick: () => n.open(a),
33
+ className: k(
34
34
  "cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
35
- m
35
+ l
36
36
  ),
37
- children: n
37
+ children: r
38
38
  }
39
39
  );
40
40
  }
41
- const ae = [
41
+ const ue = [
42
42
  [
43
43
  /^(failed|error|bad|breached|open|refused|rejected|critical|high)/i,
44
44
  "border-red-200 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
@@ -51,278 +51,364 @@ const ae = [
51
51
  /^(ok|done|sent|accepted|ready|success|healthy|closed|fixed)/i,
52
52
  "border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300"
53
53
  ]
54
- ];
55
- function oe({ col: i, value: n }) {
56
- var p;
57
- if (n == null || n === "") return /* @__PURE__ */ e("span", { className: "text-slate-400", children: "–" });
58
- const m = typeof n == "number" ? n : Number(n);
59
- switch (i.type) {
54
+ ], T = /* @__PURE__ */ new Set(["number", "ms", "usd"]), pe = /^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)\s+(\S.*)$/, xe = 90;
55
+ function be(a) {
56
+ return a >= 500 ? "border-red-200 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300" : a >= 400 ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300" : "border-slate-200 bg-slate-50 text-slate-600 dark:border-border dark:bg-muted dark:text-muted-foreground";
57
+ }
58
+ function he({ col: a, value: r }) {
59
+ var c;
60
+ if (r == null || r === "" || r === "–" || r === "-")
61
+ return /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-muted-foreground/50", children: "–" });
62
+ const l = typeof r == "number" ? r : Number(r);
63
+ switch (a.type) {
60
64
  case "number":
61
- return /* @__PURE__ */ e(y, { children: Number.isFinite(m) ? S(m, Number.isInteger(m) ? 0 : 1) : String(n) });
65
+ return /* @__PURE__ */ e(y, { children: Number.isFinite(l) ? S(l, Number.isInteger(l) ? 0 : 1) : String(r) });
62
66
  case "ms":
63
- return /* @__PURE__ */ e(y, { children: Number.isFinite(m) ? ne(m) : String(n) });
67
+ return Number.isFinite(l) ? /* @__PURE__ */ e("span", { className: k(l >= 5e3 && "font-medium text-amber-700 dark:text-amber-400"), children: H(l) }) : /* @__PURE__ */ e(y, { children: String(r) });
64
68
  case "usd":
65
- return /* @__PURE__ */ e(y, { children: Number.isFinite(m) ? `$${m.toLocaleString("en-US", { maximumFractionDigits: m < 10 ? 2 : 0 })}` : String(n) });
69
+ return /* @__PURE__ */ e(y, { children: Number.isFinite(l) ? `$${l.toLocaleString("en-US", { maximumFractionDigits: l < 10 ? 2 : 0 })}` : String(r) });
66
70
  case "status": {
67
- const a = String(n), h = (p = ae.find(([g]) => g.test(a))) == null ? void 0 : p[1];
71
+ const n = String(r), s = /^\d{3}$/.test(n) ? be(Number(n)) : (c = ue.find(([h]) => h.test(n))) == null ? void 0 : c[1];
68
72
  return /* @__PURE__ */ e(
69
- re,
73
+ se,
70
74
  {
71
- className: h ?? "border-slate-200 bg-slate-50 text-slate-700 dark:border-border dark:bg-muted dark:text-muted-foreground",
72
- children: a
75
+ className: k(
76
+ "tabular-nums",
77
+ s ?? "border-slate-200 bg-slate-50 text-slate-700 dark:border-border dark:bg-muted dark:text-muted-foreground"
78
+ ),
79
+ children: n
73
80
  }
74
81
  );
75
82
  }
76
- default:
77
- return /* @__PURE__ */ e(y, { children: String(n) });
83
+ case "time":
84
+ return /* @__PURE__ */ e(y, { children: String(r) });
85
+ default: {
86
+ const n = String(r), s = n.match(pe);
87
+ return s ? /* @__PURE__ */ d("span", { className: "inline-flex min-w-0 items-baseline gap-1.5", children: [
88
+ /* @__PURE__ */ e("span", { className: "w-[42px] shrink-0 font-mono text-[10px] font-semibold tracking-wide text-slate-500 dark:text-muted-foreground", children: s[1] }),
89
+ /* @__PURE__ */ e("span", { className: "min-w-0 break-all font-mono text-[11.5px] text-slate-800 dark:text-foreground", children: s[2] })
90
+ ] }) : n.length > xe ? /* @__PURE__ */ e("span", { className: "line-clamp-2", "data-tip": n, children: n }) : /* @__PURE__ */ e(y, { children: n });
91
+ }
78
92
  }
79
93
  }
80
- function de(i, n) {
81
- if (n !== "json") return i;
94
+ function ge(a, r, l, c) {
95
+ const n = a._drill_metric, s = a._drill_key, h = r[0] ? a[r[0].key] : null, b = h == null ? void 0 : String(h), g = a._record_collection, o = a._record_id;
96
+ if (typeof g == "string" && g !== "" && o != null && o !== "")
97
+ return () => c(g, String(o), b);
98
+ if (n) return () => l({ metric: n, key: s == null ? null : String(s), label: b });
99
+ }
100
+ function fe({ stats: a }) {
101
+ const r = a.length === 6 ? "grid-cols-3 sm:grid-cols-6" : a.length === 4 ? "grid-cols-2 sm:grid-cols-4" : a.length <= 3 ? "grid-cols-3" : "grid-cols-2 sm:grid-cols-3";
102
+ return /* @__PURE__ */ e(
103
+ "dl",
104
+ {
105
+ "data-ops-drill-stats": "",
106
+ className: k(
107
+ "grid gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 dark:border-border dark:bg-border",
108
+ r
109
+ ),
110
+ children: a.map((l) => {
111
+ const c = typeof l.value == "number" ? l.value : Number(l.value), n = l.value != null && l.value !== "" && Number.isFinite(c), s = n ? l.format === "ms" ? H(c) : S(c, Number.isInteger(c) ? 0 : 1) : l.value ?? "–";
112
+ return /* @__PURE__ */ d("div", { className: "bg-white px-3 py-2.5 dark:bg-card", children: [
113
+ /* @__PURE__ */ e("dt", { className: "truncate text-[11px] text-slate-500 dark:text-muted-foreground", children: l.label }),
114
+ /* @__PURE__ */ e(
115
+ "dd",
116
+ {
117
+ className: k(
118
+ "mt-0.5 text-[17px] font-semibold leading-tight tabular-nums",
119
+ l.tone && n && c === 0 ? "text-slate-400 dark:text-muted-foreground" : l.tone === "bad" && n ? "text-red-600 dark:text-red-400" : l.tone === "warn" && n ? "text-amber-600 dark:text-amber-400" : "text-slate-900 dark:text-foreground"
120
+ ),
121
+ children: s
122
+ }
123
+ )
124
+ ] }, l.label);
125
+ })
126
+ }
127
+ );
128
+ }
129
+ function ke(a, r) {
130
+ if (r !== "json") return a;
82
131
  try {
83
- return JSON.stringify(JSON.parse(i), null, 2);
132
+ return JSON.stringify(JSON.parse(a), null, 2);
84
133
  } catch {
85
- return i;
134
+ return a;
86
135
  }
87
136
  }
88
- function se({
89
- reportId: i,
90
- target: n,
91
- onTitle: m,
92
- onDrill: p,
93
- onLink: a,
94
- onRecord: h
137
+ function Ne({
138
+ reportId: a,
139
+ target: r,
140
+ onTitle: l,
141
+ onDrill: c,
142
+ onLink: n,
143
+ onRecord: s
95
144
  }) {
96
- var l, c, N;
97
- const g = V(), b = A({
98
- queryKey: ["ops-drill", i, n.metric, n.key ?? null],
99
- queryFn: () => g.request(
100
- W(`/ops-reports/${i}/drill`, {
101
- metric: n.metric,
102
- ...n.key ? { key: n.key } : {},
145
+ var L, P, R;
146
+ const h = re(), b = Q({
147
+ queryKey: ["ops-drill", a, r.metric, r.key ?? null],
148
+ queryFn: () => h.request(
149
+ ne(`/ops-reports/${a}/drill`, {
150
+ metric: r.metric,
151
+ ...r.key ? { key: r.key } : {},
103
152
  limit: 200
104
153
  })
105
154
  ).then((t) => t.data),
106
155
  staleTime: 6e4
107
- }), f = (l = b.data) == null ? void 0 : l.title;
108
- if (z(() => {
109
- f && m(f);
110
- }, [f]), b.isLoading)
156
+ }), g = (L = b.data) == null ? void 0 : L.title;
157
+ if (Y(() => {
158
+ g && l(g);
159
+ }, [g]), b.isLoading)
111
160
  return /* @__PURE__ */ d("div", { className: "space-y-2 p-5", "aria-busy": "true", children: [
112
- /* @__PURE__ */ e(E, { className: "h-4 w-2/3" }),
113
- /* @__PURE__ */ e(E, { className: "h-32 w-full" })
161
+ /* @__PURE__ */ e(q, { className: "h-4 w-2/3" }),
162
+ /* @__PURE__ */ e(q, { className: "h-32 w-full" })
114
163
  ] });
115
164
  if (b.error || !b.data)
116
- return /* @__PURE__ */ e("div", { className: "p-5", children: /* @__PURE__ */ e(X, { error: b.error, what: "these rows", onRetry: () => void b.refetch() }) });
117
- const o = b.data, s = o.columns ?? [], x = o.rows ?? [], r = x.some((t) => typeof t._link == "string" && t._link);
118
- return /* @__PURE__ */ d("div", { className: "space-y-4 p-5", "data-ops-drill-level": o.metric, children: [
119
- o.description && /* @__PURE__ */ e(te, { className: "text-[12.5px] leading-relaxed text-slate-600 dark:text-muted-foreground", children: o.description }),
120
- o.detail && (((c = o.detail.fields) == null ? void 0 : c.length) ?? 0) > 0 && /* @__PURE__ */ e("dl", { className: "grid grid-cols-[130px_1fr] gap-x-3 gap-y-1 rounded-lg border border-slate-200 bg-slate-50 p-3 text-[12px] dark:border-border dark:bg-muted/40", children: o.detail.fields.map((t) => /* @__PURE__ */ d("div", { className: "contents", children: [
121
- /* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-muted-foreground", children: t.label }),
122
- /* @__PURE__ */ e("dd", { className: "min-w-0 break-words text-slate-900 dark:text-foreground", children: t.link ? /* @__PURE__ */ d(
123
- "button",
124
- {
125
- type: "button",
126
- onClick: () => a(t.link),
127
- className: "inline-flex items-center gap-1 text-sky-700 hover:underline dark:text-nvr-cyan",
128
- children: [
129
- t.value ?? "Open",
130
- /* @__PURE__ */ e(R, { className: "h-3 w-3", "aria-hidden": !0 })
131
- ]
132
- }
133
- ) : t.value ?? "–" })
134
- ] }, t.label)) }),
135
- (((N = o.detail) == null ? void 0 : N.blocks) ?? []).map((t) => /* @__PURE__ */ d("div", { children: [
165
+ return /* @__PURE__ */ e("div", { className: "p-5", children: /* @__PURE__ */ e(ae, { error: b.error, what: "these rows", onRetry: () => void b.refetch() }) });
166
+ const o = b.data, x = o.columns ?? [], f = o.rows ?? [], i = f.map((t) => ge(t, x, c, s)), u = f.some((t) => typeof t._link == "string" && t._link) || i.some(Boolean), w = ((P = o.detail) == null ? void 0 : P.fields) ?? [], _ = w.filter((t) => t.kind === "meta" && t.value != null && t.value !== ""), G = _.filter((t) => !t.link), D = _.filter((t) => t.link), C = w.filter((t) => t.kind === "stat"), $ = w.filter((t) => !t.kind), E = o.truncated ? `Showing the first ${S(f.length)} of ${S(o.total)}` : `${S(o.total || f.length)} ${(o.total || f.length) === 1 ? "row" : "rows"}`, O = (t) => /* @__PURE__ */ d(
167
+ "button",
168
+ {
169
+ type: "button",
170
+ onClick: () => n(t.link),
171
+ className: "inline-flex items-center gap-1 rounded font-medium text-sky-700 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-nvr-cyan",
172
+ children: [
173
+ t.value ?? "Open",
174
+ /* @__PURE__ */ e(j, { className: "h-3 w-3", "aria-hidden": !0 })
175
+ ]
176
+ }
177
+ );
178
+ return /* @__PURE__ */ d("div", { className: "space-y-5 p-5", "data-ops-drill-level": o.metric, children: [
179
+ _.length > 0 && /* @__PURE__ */ d(
180
+ "div",
181
+ {
182
+ "data-ops-drill-meta": "",
183
+ className: "-mt-1 flex flex-wrap items-center justify-between gap-x-4 gap-y-1.5 text-[12.5px]",
184
+ children: [
185
+ /* @__PURE__ */ e("p", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-slate-600 dark:text-muted-foreground", children: G.map((t, v) => /* @__PURE__ */ d("span", { className: "inline-flex items-center gap-2", children: [
186
+ v > 0 && /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "text-slate-300 dark:text-muted-foreground/40", children: "·" }),
187
+ /* @__PURE__ */ e("span", { className: k(v === 0 && "text-slate-800 dark:text-foreground"), children: t.value })
188
+ ] }, t.label)) }),
189
+ D.length > 0 && /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center gap-3", children: D.map((t) => /* @__PURE__ */ e("span", { children: O(t) }, t.label)) })
190
+ ]
191
+ }
192
+ ),
193
+ o.description && /* @__PURE__ */ e(de, { className: "max-w-[70ch] text-[12.5px] leading-relaxed text-slate-600 dark:text-muted-foreground", children: o.description }),
194
+ C.length > 0 && /* @__PURE__ */ e(fe, { stats: C }),
195
+ $.length > 0 && /* @__PURE__ */ e(
196
+ "dl",
197
+ {
198
+ className: k(
199
+ "grid grid-cols-[minmax(96px,max-content)_1fr] gap-x-6 gap-y-1.5 text-[12.5px]",
200
+ C.length === 0 && "rounded-lg border border-slate-200 px-3.5 py-3 dark:border-border"
201
+ ),
202
+ children: $.map((t) => /* @__PURE__ */ d("div", { className: "contents", children: [
203
+ /* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-muted-foreground", children: t.label }),
204
+ /* @__PURE__ */ e("dd", { className: "min-w-0 break-words text-slate-900 dark:text-foreground", children: t.link ? O(t) : t.value ?? "–" })
205
+ ] }, t.label))
206
+ }
207
+ ),
208
+ (((R = o.detail) == null ? void 0 : R.blocks) ?? []).map((t) => /* @__PURE__ */ d("div", { children: [
136
209
  /* @__PURE__ */ e("h4", { className: "mb-1 text-[10.5px] font-semibold uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: t.title }),
137
210
  t.kind === "text" ? /* @__PURE__ */ e("p", { className: "whitespace-pre-wrap text-[12px] text-slate-800 dark:text-foreground", children: t.text }) : /* @__PURE__ */ e(
138
211
  "pre",
139
212
  {
140
213
  "data-ops-block": t.kind ?? "code",
141
214
  className: "max-h-72 overflow-auto rounded-md bg-[#0f172a] p-3 font-mono text-[11.5px] leading-relaxed text-slate-100",
142
- children: de(t.text, t.kind)
215
+ children: ke(t.text, t.kind)
143
216
  }
144
217
  )
145
218
  ] }, t.title)),
146
- x.length > 0 && /* @__PURE__ */ d("div", { children: [
147
- /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-lg border border-slate-200 dark:border-border", children: /* @__PURE__ */ d("table", { className: "w-full text-[12px]", children: [
219
+ f.length > 0 && /* @__PURE__ */ d("section", { "aria-label": o.rows_title ?? void 0, children: [
220
+ o.rows_title && /* @__PURE__ */ d("div", { className: "mb-2 flex flex-wrap items-baseline justify-between gap-x-3", children: [
221
+ /* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-900 dark:text-foreground", children: o.rows_title }),
222
+ /* @__PURE__ */ e(
223
+ "span",
224
+ {
225
+ className: "text-[11.5px] tabular-nums text-slate-500 dark:text-muted-foreground",
226
+ "data-ops-drill-total": "",
227
+ children: E
228
+ }
229
+ )
230
+ ] }),
231
+ /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-lg border border-slate-200 dark:border-border", children: /* @__PURE__ */ d("table", { className: "w-full text-[12.5px]", children: [
148
232
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ d("tr", { className: "border-b border-slate-200 bg-slate-50 text-left text-[10.5px] uppercase tracking-wide text-slate-500 dark:border-border dark:bg-muted/40 dark:text-muted-foreground", children: [
149
- s.map((t) => /* @__PURE__ */ e(
233
+ x.map((t) => /* @__PURE__ */ e(
150
234
  "th",
151
235
  {
152
- className: w(
153
- "px-2.5 py-1.5 font-medium",
154
- (t.type === "number" || t.type === "ms" || t.type === "usd") && "text-right"
236
+ className: k(
237
+ "whitespace-nowrap px-3 py-2 font-medium",
238
+ T.has(t.type ?? "") && "text-right"
155
239
  ),
156
240
  children: t.label
157
241
  },
158
242
  t.key
159
243
  )),
160
- r && /* @__PURE__ */ e("th", { className: "w-8" })
244
+ u && /* @__PURE__ */ e("th", { className: "w-8", children: /* @__PURE__ */ e("span", { className: "sr-only", children: "Open" }) })
161
245
  ] }) }),
162
- /* @__PURE__ */ e("tbody", { children: x.map((t, T) => {
163
- const C = t._drill_metric, D = t._drill_key, L = typeof t._link == "string" && t._link ? t._link : null, v = s[0] ? t[s[0].key] : null, _ = t._record_collection, $ = t._record_id, O = typeof _ == "string" && _ !== "" && $ != null && $ !== "", U = v == null ? void 0 : String(v), k = O ? () => h(_, String($), U) : C ? () => p({
164
- metric: C,
165
- key: D == null ? null : String(D),
166
- label: v == null ? void 0 : String(v)
167
- }) : void 0;
246
+ /* @__PURE__ */ e("tbody", { children: f.map((t, v) => {
247
+ const J = t._drill_metric, F = typeof t._link == "string" && t._link ? t._link : null, I = t._record_collection, K = typeof I == "string" && I !== "", N = i[v];
168
248
  return /* @__PURE__ */ d(
169
249
  "tr",
170
250
  {
171
- "data-ops-drill-row": O ? "record" : C ?? void 0,
172
- tabIndex: k ? 0 : void 0,
173
- onClick: k,
174
- onKeyDown: k ? (u) => {
175
- (u.key === "Enter" || u.key === " ") && (u.preventDefault(), k());
251
+ "data-ops-drill-row": K ? "record" : J ?? void 0,
252
+ tabIndex: N ? 0 : void 0,
253
+ onClick: N,
254
+ onKeyDown: N ? (p) => {
255
+ (p.key === "Enter" || p.key === " ") && (p.preventDefault(), N());
176
256
  } : void 0,
177
- className: w(
178
- "border-b border-slate-100 last:border-0 dark:border-border/60",
179
- k && "cursor-pointer hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50"
257
+ className: k(
258
+ "group border-b border-slate-100 last:border-0 dark:border-border/60",
259
+ N && "cursor-pointer hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50 dark:hover:bg-muted/60"
180
260
  ),
181
261
  children: [
182
- s.map((u, P) => /* @__PURE__ */ e(
262
+ x.map((p) => /* @__PURE__ */ e(
183
263
  "td",
184
264
  {
185
- className: w(
186
- "px-2.5 py-1.5 align-top text-slate-700 dark:text-foreground",
187
- (u.type === "number" || u.type === "ms" || u.type === "usd") && "text-right tabular-nums"
265
+ className: k(
266
+ "px-3 py-2 align-top text-slate-700 dark:text-foreground",
267
+ T.has(p.type ?? "") && "text-right tabular-nums",
268
+ (T.has(p.type ?? "") || p.type === "time" || p.type === "status") && "whitespace-nowrap",
269
+ p.type === "time" && "tabular-nums text-slate-500 dark:text-muted-foreground",
270
+ p.key === "message" && "min-w-[200px] text-slate-600 dark:text-muted-foreground"
188
271
  ),
189
- children: /* @__PURE__ */ d("span", { className: "inline-flex items-center gap-1", children: [
190
- /* @__PURE__ */ e(oe, { col: u, value: t[u.key] }),
191
- k && P === 0 && /* @__PURE__ */ e(j, { className: "h-3 w-3 text-slate-400", "aria-hidden": !0 })
192
- ] })
272
+ children: /* @__PURE__ */ e(he, { col: p, value: t[p.key] })
193
273
  },
194
- u.key
274
+ p.key
195
275
  )),
196
- r && /* @__PURE__ */ e("td", { className: "px-1 text-right", children: L && /* @__PURE__ */ e(
276
+ u && /* @__PURE__ */ e("td", { className: "w-8 px-1 py-1.5 text-right align-top", children: F ? /* @__PURE__ */ e(
197
277
  "button",
198
278
  {
199
279
  type: "button",
200
280
  "aria-label": "Open in the app",
201
281
  "data-tip": "Open in the app",
202
- onClick: (u) => {
203
- u.stopPropagation(), a(L);
282
+ onClick: (p) => {
283
+ p.stopPropagation(), n(F);
204
284
  },
205
- className: "rounded p-1 text-slate-400 hover:bg-muted hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
206
- children: /* @__PURE__ */ e(R, { className: "h-3.5 w-3.5" })
285
+ className: "rounded p-1 text-slate-400 hover:bg-muted hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:text-foreground",
286
+ children: /* @__PURE__ */ e(j, { className: "h-3.5 w-3.5" })
287
+ }
288
+ ) : N ? /* @__PURE__ */ e(
289
+ B,
290
+ {
291
+ className: "ml-auto mr-1 mt-0.5 h-3.5 w-3.5 text-slate-300 transition-colors group-hover:text-slate-500 dark:text-muted-foreground/50 dark:group-hover:text-muted-foreground",
292
+ "aria-hidden": !0
207
293
  }
208
- ) })
294
+ ) : null })
209
295
  ]
210
296
  },
211
- T
297
+ v
212
298
  );
213
299
  }) })
214
300
  ] }) }),
215
- /* @__PURE__ */ e(
301
+ !o.rows_title && /* @__PURE__ */ e(
216
302
  "p",
217
303
  {
218
304
  className: "mt-1.5 text-[11px] text-slate-500 dark:text-muted-foreground",
219
305
  "data-ops-drill-total": "",
220
- children: o.truncated ? `Showing the first ${S(x.length)} of ${S(o.total)}` : `${S(o.total || x.length)} ${(o.total || x.length) === 1 ? "row" : "rows"}`
306
+ children: E
221
307
  }
222
308
  )
223
309
  ] }),
224
- x.length === 0 && !o.detail && /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "Nothing behind this number." })
310
+ f.length === 0 && !o.detail && /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "Nothing behind this number." })
225
311
  ] });
226
312
  }
227
- function we({
228
- reportId: i,
229
- linkTo: n,
230
- children: m
313
+ function Re({
314
+ reportId: a,
315
+ linkTo: r,
316
+ children: l
231
317
  }) {
232
- const p = H(), [a, h] = F([]), [g, b] = F(null), f = q((r) => h([r]), []), o = J(() => ({ open: f }), [f]), s = a[a.length - 1], x = q(
233
- (r) => {
234
- let l = r;
235
- const c = r.match(/^\/collections\/([^/?#]+)\/([^/?#]+)/);
236
- c && p.itemUrl && (l = p.itemUrl({ collection: c[1], itemId: c[2] })), n && (l = n(r) ?? (c ? l : null)), l && window.open(l, "_blank", "noopener");
318
+ const c = te(), [n, s] = A([]), [h, b] = A(null), g = U((i) => s([i]), []), o = X(() => ({ open: g }), [g]), x = n[n.length - 1], f = U(
319
+ (i) => {
320
+ let m = i;
321
+ const u = i.match(/^\/collections\/([^/?#]+)\/([^/?#]+)/);
322
+ u && c.itemUrl && (m = c.itemUrl({ collection: u[1], itemId: u[2] })), r && (m = r(i) ?? (u ? m : null)), m && window.open(m, "_blank", "noopener");
237
323
  },
238
- [p, n]
324
+ [c, r]
239
325
  );
240
- return /* @__PURE__ */ d(I.Provider, { value: o, children: [
241
- m,
242
- /* @__PURE__ */ e(Y, { open: a.length > 0, onOpenChange: (r) => !r && h([]), children: /* @__PURE__ */ d(
243
- Z,
326
+ return /* @__PURE__ */ d(M.Provider, { value: o, children: [
327
+ l,
328
+ /* @__PURE__ */ e(le, { open: n.length > 0, onOpenChange: (i) => !i && s([]), children: /* @__PURE__ */ d(
329
+ ie,
244
330
  {
245
331
  side: "right",
246
332
  "data-ops-drill-panel": "",
247
333
  "aria-describedby": void 0,
248
334
  className: "flex w-[94vw] flex-col gap-0 p-0 sm:max-w-[760px]",
249
335
  children: [
250
- /* @__PURE__ */ d("div", { className: "shrink-0 border-b border-slate-200 px-5 pb-3 pt-3 pr-12 dark:border-border", children: [
251
- /* @__PURE__ */ d(
336
+ /* @__PURE__ */ d("div", { className: "shrink-0 border-b border-slate-200 px-5 pb-3.5 pt-4 pr-12 dark:border-border", children: [
337
+ n.length > 1 && /* @__PURE__ */ d(
252
338
  "nav",
253
339
  {
254
340
  "aria-label": "Drill path",
255
- className: "mb-1 flex min-h-[20px] flex-wrap items-center gap-1 text-[11.5px] text-slate-500 dark:text-muted-foreground",
341
+ className: "mb-1.5 flex min-h-[20px] flex-wrap items-center gap-1 text-[11.5px] text-slate-500 dark:text-muted-foreground",
256
342
  children: [
257
- a.length > 1 && /* @__PURE__ */ d(
343
+ /* @__PURE__ */ d(
258
344
  "button",
259
345
  {
260
346
  type: "button",
261
347
  "data-ops-drill-back": "",
262
- onClick: () => h((r) => r.slice(0, -1)),
348
+ onClick: () => s((i) => i.slice(0, -1)),
263
349
  className: "mr-1 inline-flex items-center gap-1 rounded px-1 py-0.5 font-medium text-sky-700 hover:bg-muted dark:text-nvr-cyan",
264
350
  children: [
265
- /* @__PURE__ */ e(B, { className: "h-3 w-3", "aria-hidden": !0 }),
351
+ /* @__PURE__ */ e(z, { className: "h-3 w-3", "aria-hidden": !0 }),
266
352
  "Back"
267
353
  ]
268
354
  }
269
355
  ),
270
- a.map((r, l) => /* @__PURE__ */ d(
356
+ n.map((i, m) => /* @__PURE__ */ d(
271
357
  "span",
272
358
  {
273
359
  className: "inline-flex items-center gap-1",
274
360
  children: [
275
- l > 0 && /* @__PURE__ */ e(j, { className: "h-3 w-3", "aria-hidden": !0 }),
276
- l < a.length - 1 ? /* @__PURE__ */ e(
361
+ m > 0 && /* @__PURE__ */ e(B, { className: "h-3 w-3", "aria-hidden": !0 }),
362
+ m < n.length - 1 ? /* @__PURE__ */ e(
277
363
  "button",
278
364
  {
279
365
  type: "button",
280
- onClick: () => h((c) => c.slice(0, l + 1)),
366
+ onClick: () => s((u) => u.slice(0, m + 1)),
281
367
  className: "max-w-[160px] truncate hover:text-slate-800 hover:underline dark:hover:text-foreground",
282
- children: r.title ?? r.label ?? r.metric
368
+ children: i.title ?? i.label ?? i.metric
283
369
  }
284
- ) : /* @__PURE__ */ e("span", { className: "max-w-[220px] truncate font-medium text-slate-700 dark:text-foreground", children: r.title ?? r.label ?? r.metric })
370
+ ) : /* @__PURE__ */ e("span", { className: "max-w-[220px] truncate font-medium text-slate-700 dark:text-foreground", children: i.title ?? i.label ?? i.metric })
285
371
  ]
286
372
  },
287
- `${r.metric}:${r.key ?? ""}:${l}`
373
+ `${i.metric}:${i.key ?? ""}:${m}`
288
374
  ))
289
375
  ]
290
376
  }
291
377
  ),
292
- /* @__PURE__ */ e(ee, { className: "truncate text-[15px]", children: (s == null ? void 0 : s.title) ?? (s == null ? void 0 : s.label) ?? "Loading…" })
378
+ /* @__PURE__ */ e(oe, { className: "truncate text-[16px] font-semibold tracking-[-0.01em]", children: (x == null ? void 0 : x.title) ?? (x == null ? void 0 : x.label) ?? "Loading…" })
293
379
  ] }),
294
- /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto bg-white dark:bg-background", children: s && /* @__PURE__ */ e(
295
- se,
380
+ /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto bg-white dark:bg-background", children: x && /* @__PURE__ */ e(
381
+ Ne,
296
382
  {
297
- reportId: i,
298
- target: s,
299
- onTitle: (r) => h(
300
- (l) => l.map(
301
- (c, N) => N === l.length - 1 && c.title !== r ? { ...c, title: r } : c
383
+ reportId: a,
384
+ target: x,
385
+ onTitle: (i) => s(
386
+ (m) => m.map(
387
+ (u, w) => w === m.length - 1 && u.title !== i ? { ...u, title: i } : u
302
388
  )
303
389
  ),
304
- onDrill: (r) => h((l) => [...l, r]),
305
- onLink: x,
306
- onRecord: (r, l, c) => b({ collection: r, itemId: l, title: c })
390
+ onDrill: (i) => s((m) => [...m, i]),
391
+ onLink: f,
392
+ onRecord: (i, m, u) => b({ collection: i, itemId: m, title: u })
307
393
  },
308
- `${s.metric}:${s.key ?? ""}:${a.length}`
394
+ `${x.metric}:${x.key ?? ""}:${n.length}`
309
395
  ) })
310
396
  ]
311
397
  }
312
398
  ) }),
313
- g && /* @__PURE__ */ e(K, { fallback: null, children: /* @__PURE__ */ e(
314
- le,
399
+ h && /* @__PURE__ */ e(V, { fallback: null, children: /* @__PURE__ */ e(
400
+ ce,
315
401
  {
316
- collection: g.collection,
317
- itemId: g.itemId,
318
- title: g.title,
402
+ collection: h.collection,
403
+ itemId: h.itemId,
404
+ title: h.title,
319
405
  onClose: () => b(null)
320
406
  }
321
407
  ) })
322
408
  ] });
323
409
  }
324
410
  export {
325
- we as DrillProvider,
326
- ve as Drillable,
327
- ie as useDrill
411
+ Re as DrillProvider,
412
+ Pe as Drillable,
413
+ me as useDrill
328
414
  };