@object-ui/plugin-report 17.2.0 → 17.3.0

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.
package/dist/index.js CHANGED
@@ -1,56 +1,56 @@
1
- import { ComponentRegistry as e, buildDatasetDrillFilter as t, buildDatasetFieldHelpers as n, formatDimensionValue as r, formatMeasure as i, mergeFilters as a } from "@object-ui/core";
2
- import * as o from "react";
3
- import s from "react";
4
- import { isSpecReport as c, specReportToPresentation as l } from "@object-ui/types";
5
- import { SchemaRenderer as u, SchemaRendererContext as d } from "@object-ui/react";
6
- import { Badge as f, Button as p, Card as m, CardContent as h, CardDescription as g, CardHeader as _, CardTitle as v, Skeleton as y } from "@object-ui/components";
7
- import { jsx as b, jsxs as x } from "react/jsx-runtime";
8
- import { AlertTriangle as S, Download as C, Loader2 as w, Printer as T, RefreshCw as E, Table2 as D } from "lucide-react";
9
- import { getCellRenderer as O, resolveCellRendererType as ee } from "@object-ui/fields";
10
- import { useSafeFieldLabel as k, useSafeTranslate as A } from "@object-ui/i18n";
1
+ import { ComponentRegistry as e, buildDatasetDrillFilter as t, buildDatasetFieldHelpers as n, formatDimensionValue as r, formatMeasure as i, mergeFilters as a, pivotBucketId as o, pivotCellKey as s } from "@object-ui/core";
2
+ import * as c from "react";
3
+ import l from "react";
4
+ import { isSpecReport as u, specReportToPresentation as d } from "@object-ui/types";
5
+ import { SchemaRenderer as f, SchemaRendererContext as p } from "@object-ui/react";
6
+ import { Badge as m, Button as h, Card as g, CardContent as _, CardDescription as v, CardHeader as y, CardTitle as b, Skeleton as x } from "@object-ui/components";
7
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
8
+ import { AlertTriangle as w, Download as T, Loader2 as E, Printer as D, RefreshCw as O, Table2 as k } from "lucide-react";
9
+ import { getCellRenderer as A, resolveCellRendererType as j } from "@object-ui/fields";
10
+ import { useSafeFieldLabel as M, useSafeTranslate as ee } from "@object-ui/i18n";
11
11
  //#region src/LegacyReportRenderer.tsx
12
- var j = ({ schema: t }) => {
12
+ var N = ({ schema: t }) => {
13
13
  let { title: n, description: r, data: i, columns: a } = t;
14
14
  t.chart?.type;
15
15
  let o = !!t.chart;
16
- return /* @__PURE__ */ x(m, {
16
+ return /* @__PURE__ */ C(g, {
17
17
  className: `h-full flex flex-col ${t.className || ""}`,
18
- children: [/* @__PURE__ */ x(_, { children: [n && /* @__PURE__ */ b(v, { children: n }), r && /* @__PURE__ */ b(g, { children: r })] }), /* @__PURE__ */ x(h, {
18
+ children: [/* @__PURE__ */ C(y, { children: [n && /* @__PURE__ */ S(b, { children: n }), r && /* @__PURE__ */ S(v, { children: r })] }), /* @__PURE__ */ C(_, {
19
19
  className: "flex-1 overflow-auto space-y-4",
20
20
  children: [o && (() => {
21
21
  let n = t.chart?.type, r = n ? e.get(n) : null;
22
- return r ||= e.get("chart"), r ? /* @__PURE__ */ b("div", {
22
+ return r ||= e.get("chart"), r ? /* @__PURE__ */ S("div", {
23
23
  className: "min-h-[300px] border rounded-lg p-4 bg-background/50",
24
- children: /* @__PURE__ */ b(r, { schema: {
24
+ children: /* @__PURE__ */ S(r, { schema: {
25
25
  ...t.chart,
26
26
  data: t.chart.data || i
27
27
  } })
28
- }) : /* @__PURE__ */ x("div", {
28
+ }) : /* @__PURE__ */ C("div", {
29
29
  className: "min-h-[100px] border rounded-md p-4 bg-muted/20 text-muted-foreground flex items-center justify-center",
30
30
  children: ["Unknown component type: ", n || "chart"]
31
31
  });
32
- })(), i && i.length > 0 && /* @__PURE__ */ b("div", {
32
+ })(), i && i.length > 0 && /* @__PURE__ */ S("div", {
33
33
  className: "border rounded-lg",
34
34
  children: (() => {
35
35
  let t = e.get("grid") || e.get("table");
36
- return t ? /* @__PURE__ */ b(t, { schema: {
36
+ return t ? /* @__PURE__ */ S(t, { schema: {
37
37
  type: "grid",
38
38
  rowData: i,
39
39
  columnDefs: a,
40
40
  domLayout: "autoHeight"
41
- } }) : /* @__PURE__ */ b("div", {
41
+ } }) : /* @__PURE__ */ S("div", {
42
42
  className: "overflow-x-auto",
43
- children: /* @__PURE__ */ x("table", {
43
+ children: /* @__PURE__ */ C("table", {
44
44
  className: "w-full text-sm text-left",
45
- children: [/* @__PURE__ */ b("thead", {
45
+ children: [/* @__PURE__ */ S("thead", {
46
46
  className: "text-xs uppercase bg-muted",
47
- children: /* @__PURE__ */ b("tr", { children: a?.map((e) => /* @__PURE__ */ b("th", {
47
+ children: /* @__PURE__ */ S("tr", { children: a?.map((e) => /* @__PURE__ */ S("th", {
48
48
  className: "px-6 py-3",
49
49
  children: e.headerName || e.label || e.field
50
50
  }, e.field)) })
51
- }), /* @__PURE__ */ b("tbody", { children: i.map((e, t) => /* @__PURE__ */ b("tr", {
51
+ }), /* @__PURE__ */ S("tbody", { children: i.map((e, t) => /* @__PURE__ */ S("tr", {
52
52
  className: "bg-background border-b",
53
- children: a?.map((t) => /* @__PURE__ */ b("td", {
53
+ children: a?.map((t) => /* @__PURE__ */ S("td", {
54
54
  className: "px-6 py-4",
55
55
  children: e[t.field]
56
56
  }, t.field))
@@ -64,29 +64,29 @@ var j = ({ schema: t }) => {
64
64
  };
65
65
  //#endregion
66
66
  //#region src/ReportExportEngine.ts
67
- function M(e, t, n) {
67
+ function P(e, t, n) {
68
68
  let r = e.fields || [], i = r.map((e) => e.label || e.name), a = t.map((e) => r.map((t) => {
69
69
  let n = e[t.name];
70
- return n = R(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
70
+ return n = B(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
71
71
  }));
72
- z([...n?.includeHeaders === !1 ? [] : [i.join(",")], ...a.map((e) => e.join(","))].join("\n"), n?.filename || `${e.title || "report"}.csv`, "text/csv");
72
+ H([...n?.includeHeaders === !1 ? [] : [i.join(",")], ...a.map((e) => e.join(","))].join("\n"), n?.filename || `${e.title || "report"}.csv`, "text/csv");
73
73
  }
74
- function N(e, t, n) {
74
+ function te(e, t, n) {
75
75
  let r = {
76
76
  title: e.title,
77
77
  description: e.description,
78
78
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
79
79
  data: t
80
80
  };
81
- z(JSON.stringify(r, null, 2), n?.filename || `${e.title || "report"}.json`, "application/json");
81
+ H(JSON.stringify(r, null, 2), n?.filename || `${e.title || "report"}.json`, "application/json");
82
82
  }
83
- function P(e, t, n) {
84
- let r = e.fields || [], i = re(n?.orientation), a = ne(n?.pageSize);
85
- z(`<!DOCTYPE html>
83
+ function F(e, t, n) {
84
+ let r = e.fields || [], i = V(n?.orientation), a = ne(n?.pageSize);
85
+ H(`<!DOCTYPE html>
86
86
  <html>
87
87
  <head>
88
88
  <meta charset="utf-8">
89
- <title>${L(e.title || "Report")}</title>
89
+ <title>${z(e.title || "Report")}</title>
90
90
  <style>
91
91
  @page { size: ${a} ${i}; margin: 20mm; }
92
92
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
@@ -100,20 +100,20 @@ function P(e, t, n) {
100
100
  </style>
101
101
  </head>
102
102
  <body>
103
- <h1>${L(e.title || "Report")}</h1>
104
- ${e.description ? `<p class="description">${L(e.description)}</p>` : ""}
103
+ <h1>${z(e.title || "Report")}</h1>
104
+ ${e.description ? `<p class="description">${z(e.description)}</p>` : ""}
105
105
  <p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
106
106
  <table>
107
- <thead><tr>${r.map((e) => `<th>${L(e.label || e.name)}</th>`).join("")}</tr></thead>
108
- <tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${L(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
107
+ <thead><tr>${r.map((e) => `<th>${z(e.label || e.name)}</th>`).join("")}</tr></thead>
108
+ <tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${z(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
109
109
  </table>
110
110
  </body>
111
111
  </html>`, n?.filename || `${e.title || "report"}.html`, "text/html");
112
112
  }
113
- function te(e, t, n) {
114
- let r = e.fields || [], i = re(n?.orientation), a = ne(n?.pageSize), o = window.open("", "_blank");
113
+ function I(e, t, n) {
114
+ let r = e.fields || [], i = V(n?.orientation), a = ne(n?.pageSize), o = window.open("", "_blank");
115
115
  if (!o) {
116
- P(e, t, {
116
+ F(e, t, {
117
117
  ...n,
118
118
  format: "html",
119
119
  filename: n?.filename?.replace(/\.pdf$/, ".html") || `${e.title || "report"}.html`
@@ -124,7 +124,7 @@ function te(e, t, n) {
124
124
  <html>
125
125
  <head>
126
126
  <meta charset="utf-8">
127
- <title>${L(e.title || "Report")}</title>
127
+ <title>${z(e.title || "Report")}</title>
128
128
  <style>
129
129
  @page { size: ${a} ${i}; margin: 20mm; }
130
130
  @media print { .no-print { display: none; } }
@@ -139,49 +139,49 @@ function te(e, t, n) {
139
139
  </style>
140
140
  </head>
141
141
  <body>
142
- <h1>${L(e.title || "Report")}</h1>
143
- ${e.description ? `<p class="description">${L(e.description)}</p>` : ""}
142
+ <h1>${z(e.title || "Report")}</h1>
143
+ ${e.description ? `<p class="description">${z(e.description)}</p>` : ""}
144
144
  <p class="meta">Generated: ${(/* @__PURE__ */ new Date()).toLocaleString()}</p>
145
145
  <table>
146
- <thead><tr>${r.map((e) => `<th>${L(e.label || e.name)}</th>`).join("")}</tr></thead>
147
- <tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${L(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
146
+ <thead><tr>${r.map((e) => `<th>${z(e.label || e.name)}</th>`).join("")}</tr></thead>
147
+ <tbody>${t.map((e) => `<tr>${r.map((t) => `<td>${z(String(e[t.name] ?? ""))}</td>`).join("")}</tr>`).join("")}</tbody>
148
148
  </table>
149
149
  </body>
150
150
  </html>`), o.document.close(), o.onload = () => {
151
151
  o.print();
152
152
  };
153
153
  }
154
- function F(e, t, n) {
154
+ function L(e, t, n) {
155
155
  let r = e.fields || [], i = r.map((e) => e.label || e.name), a = t.map((e) => r.map((t) => {
156
156
  let n = e[t.name];
157
- return n = R(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n") || n.includes(" ")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
157
+ return n = B(n), typeof n == "string" && (n.includes(",") || n.includes("\"") || n.includes("\n") || n.includes(" ")) ? `"${n.replace(/"/g, "\"\"")}"` : n ?? "";
158
158
  }));
159
- z("" + [...n?.includeHeaders === !1 ? [] : [i.join(" ")], ...a.map((e) => e.join(" "))].join("\n"), n?.filename || `${e.title || "report"}.tsv`, "text/tab-separated-values");
159
+ H("" + [...n?.includeHeaders === !1 ? [] : [i.join(" ")], ...a.map((e) => e.join(" "))].join("\n"), n?.filename || `${e.title || "report"}.tsv`, "text/tab-separated-values");
160
160
  }
161
- function I(e, t, n, r) {
161
+ function R(e, t, n, r) {
162
162
  switch (e) {
163
163
  case "csv":
164
- M(t, n, r);
164
+ P(t, n, r);
165
165
  break;
166
166
  case "json":
167
- N(t, n, r);
167
+ te(t, n, r);
168
168
  break;
169
169
  case "html":
170
- P(t, n, r);
170
+ F(t, n, r);
171
171
  break;
172
172
  case "pdf":
173
- te(t, n, r);
173
+ I(t, n, r);
174
174
  break;
175
175
  case "excel":
176
- F(t, n, r);
176
+ L(t, n, r);
177
177
  break;
178
178
  default: console.warn(`Unsupported export format: ${e}`);
179
179
  }
180
180
  }
181
- function L(e) {
181
+ function z(e) {
182
182
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
183
183
  }
184
- function R(e) {
184
+ function B(e) {
185
185
  if (typeof e == "string" && e.length > 0) {
186
186
  let t = e.charAt(0);
187
187
  if (t === "=" || t === "+" || t === "-" || t === "@" || t === "|") return `\t${e}`;
@@ -196,19 +196,19 @@ function ne(e) {
196
196
  "Legal"
197
197
  ].includes(e || "") ? e : "A4";
198
198
  }
199
- function re(e) {
199
+ function V(e) {
200
200
  return e === "landscape" ? "landscape" : "portrait";
201
201
  }
202
- function z(e, t, n) {
202
+ function H(e, t, n) {
203
203
  let r = new Blob([e], { type: `${n};charset=utf-8` }), i = URL.createObjectURL(r), a = document.createElement("a");
204
204
  a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
205
205
  }
206
206
  //#endregion
207
207
  //#region src/formatValue.ts
208
- function B(e, t) {
208
+ function U(e, t) {
209
209
  if (e == null || e === "") return "";
210
210
  let n = t?.type, r = t?.format;
211
- if (n === "date" || r === "date" || ie(e)) return ae(e);
211
+ if (n === "date" || r === "date" || re(e)) return ie(e);
212
212
  if (n === "number" || typeof e == "number") {
213
213
  let t = typeof e == "number" ? e : Number(e);
214
214
  return isNaN(t) ? String(e) : r === "currency" || r === "currency_cny" ? `¥${t.toLocaleString("en-US", {
@@ -224,10 +224,10 @@ function B(e, t) {
224
224
  }
225
225
  return String(e);
226
226
  }
227
- function ie(e) {
227
+ function re(e) {
228
228
  return typeof e == "string" && /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2})?/.test(e);
229
229
  }
230
- function ae(e) {
230
+ function ie(e) {
231
231
  try {
232
232
  let t = new Date(e);
233
233
  return isNaN(t.getTime()) ? String(e) : `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}`;
@@ -237,7 +237,7 @@ function ae(e) {
237
237
  }
238
238
  //#endregion
239
239
  //#region src/ReportViewer.tsx
240
- function oe(e, t) {
240
+ function ae(e, t) {
241
241
  if (!t || t.length === 0 || !e || e.length === 0) return null;
242
242
  let n = t[0], r = n.field, i = /* @__PURE__ */ new Map();
243
243
  for (let t of e) {
@@ -253,7 +253,7 @@ function oe(e, t) {
253
253
  let o = n.sort === "desc" ? -1 : 1;
254
254
  return a.sort((e, t) => e.key.localeCompare(t.key) * o), a;
255
255
  }
256
- function se(e, t, n) {
256
+ function oe(e, t, n) {
257
257
  if (!e) return 0;
258
258
  let r = e.map((e) => Number(e[t]) || 0);
259
259
  switch (n) {
@@ -266,18 +266,18 @@ function se(e, t, n) {
266
266
  default: return "";
267
267
  }
268
268
  }
269
- var V = ({ schema: e, onRefresh: t }) => {
270
- let { report: n, data: r, showToolbar: i = !0, allowExport: a = !0, allowPrint: o = !0, loading: c = !1 } = e, l = (e) => {
269
+ var W = ({ schema: e, onRefresh: t }) => {
270
+ let { report: n, data: r, showToolbar: i = !0, allowExport: a = !0, allowPrint: o = !0, loading: s = !1 } = e, c = (e) => {
271
271
  if (!n) {
272
272
  console.warn("ReportViewer: Cannot export, no report defined");
273
273
  return;
274
274
  }
275
- I(e, n, r || [], n.exportConfigs?.[e]);
276
- }, d = () => {
275
+ R(e, n, r || [], n.exportConfigs?.[e]);
276
+ }, u = () => {
277
277
  window.print();
278
- }, S = () => {
278
+ }, d = () => {
279
279
  t?.();
280
- }, w = (e, t) => se(r, e, t), D = (e, t) => {
280
+ }, p = (e, t) => oe(r, e, t), w = (e, t) => {
281
281
  let r = n?.conditionalFormatting;
282
282
  if (!(!r || !Array.isArray(r))) for (let n of r) {
283
283
  if (n.field !== e) continue;
@@ -295,150 +295,153 @@ var V = ({ schema: e, onRefresh: t }) => {
295
295
  case "greater_than":
296
296
  a = Number(t) > Number(n.value);
297
297
  break;
298
- case "less_than":
299
- a = Number(t) < Number(n.value);
300
- break;
298
+ case "less_than": a = Number(t) < Number(n.value);
301
299
  }
302
300
  if (a) {
303
301
  let e = {};
304
302
  return n.backgroundColor && (e.backgroundColor = n.backgroundColor), n.textColor && (e.color = n.textColor), e;
305
303
  }
306
304
  }
307
- }, k = (e, t) => {
305
+ }, E = (e, t) => {
308
306
  if (e == null || e === "") return "";
309
- if (t.renderAs === "badge" && (!t.type || t.type === "string" || t.type === "text")) return /* @__PURE__ */ b(f, {
310
- className: t.colorMap?.[String(e)] || "",
311
- children: String(e)
312
- });
313
- if (t.aggregation) return B(e, t);
307
+ if (t.renderAs === "badge" && (!t.type || t.type === "string" || t.type === "text")) {
308
+ let n = t.colorMap?.[String(e)] || "";
309
+ return /* @__PURE__ */ S(m, {
310
+ className: n,
311
+ children: String(e)
312
+ });
313
+ }
314
+ if (t.aggregation) return U(e, t);
314
315
  if (t.type) {
315
316
  let n = { ...t };
316
- return t.colorMap && !n.options && (n.options = Object.entries(t.colorMap).map(([e, t]) => ({
317
+ t.colorMap && !n.options && (n.options = Object.entries(t.colorMap).map(([e, t]) => ({
317
318
  value: e,
318
319
  label: e,
319
320
  color: t
320
- }))), /* @__PURE__ */ b(O(ee(n)), {
321
+ })));
322
+ let r = A(j(n));
323
+ return /* @__PURE__ */ S(r, {
321
324
  value: e,
322
325
  field: n
323
326
  });
324
327
  }
325
- return B(e, t);
328
+ return U(e, t);
326
329
  };
327
- return n ? /* @__PURE__ */ x("div", {
330
+ return n ? /* @__PURE__ */ C("div", {
328
331
  className: "space-y-4",
329
- children: [i && /* @__PURE__ */ x("div", {
332
+ children: [i && /* @__PURE__ */ C("div", {
330
333
  className: "flex items-center justify-between gap-2 p-4 bg-card rounded-lg border",
331
- children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("h2", {
334
+ children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("h2", {
332
335
  className: "text-lg font-semibold",
333
336
  children: n.title
334
- }), n.description && /* @__PURE__ */ b("p", {
337
+ }), n.description && /* @__PURE__ */ S("p", {
335
338
  className: "text-sm text-muted-foreground",
336
339
  children: n.description
337
- })] }), /* @__PURE__ */ x("div", {
340
+ })] }), /* @__PURE__ */ C("div", {
338
341
  className: "flex items-center gap-2",
339
342
  children: [
340
- n.refreshInterval && /* @__PURE__ */ x(p, {
343
+ n.refreshInterval && /* @__PURE__ */ C(h, {
341
344
  variant: "outline",
342
345
  size: "sm",
343
- onClick: S,
344
- children: [/* @__PURE__ */ b(E, { className: "h-4 w-4 mr-2" }), "Refresh"]
346
+ onClick: d,
347
+ children: [/* @__PURE__ */ S(O, { className: "h-4 w-4 mr-2" }), "Refresh"]
345
348
  }),
346
- o && /* @__PURE__ */ x(p, {
349
+ o && /* @__PURE__ */ C(h, {
347
350
  variant: "outline",
348
351
  size: "sm",
349
- onClick: d,
350
- children: [/* @__PURE__ */ b(T, { className: "h-4 w-4 mr-2" }), "Print"]
352
+ onClick: u,
353
+ children: [/* @__PURE__ */ S(D, { className: "h-4 w-4 mr-2" }), "Print"]
351
354
  }),
352
- a && n.showExportButtons && /* @__PURE__ */ x("div", {
355
+ a && n.showExportButtons && /* @__PURE__ */ C("div", {
353
356
  className: "flex items-center gap-1",
354
357
  children: [
355
- /* @__PURE__ */ x(p, {
358
+ /* @__PURE__ */ C(h, {
356
359
  variant: "outline",
357
360
  size: "sm",
358
- onClick: () => l("pdf"),
359
- children: [/* @__PURE__ */ b(C, { className: "h-4 w-4 mr-2" }), "PDF"]
361
+ onClick: () => c("pdf"),
362
+ children: [/* @__PURE__ */ S(T, { className: "h-4 w-4 mr-2" }), "PDF"]
360
363
  }),
361
- /* @__PURE__ */ x(p, {
364
+ /* @__PURE__ */ C(h, {
362
365
  variant: "outline",
363
366
  size: "sm",
364
- onClick: () => l("excel"),
365
- children: [/* @__PURE__ */ b(C, { className: "h-4 w-4 mr-2" }), "Excel"]
367
+ onClick: () => c("excel"),
368
+ children: [/* @__PURE__ */ S(T, { className: "h-4 w-4 mr-2" }), "Excel"]
366
369
  }),
367
- /* @__PURE__ */ x(p, {
370
+ /* @__PURE__ */ C(h, {
368
371
  variant: "outline",
369
372
  size: "sm",
370
- onClick: () => l("csv"),
371
- children: [/* @__PURE__ */ b(C, { className: "h-4 w-4 mr-2" }), "CSV"]
373
+ onClick: () => c("csv"),
374
+ children: [/* @__PURE__ */ S(T, { className: "h-4 w-4 mr-2" }), "CSV"]
372
375
  })
373
376
  ]
374
377
  })
375
378
  ]
376
379
  })]
377
- }), /* @__PURE__ */ x(m, { children: [/* @__PURE__ */ x(_, { children: [!i && n.title && /* @__PURE__ */ b(v, { children: n.title }), !i && n.description && /* @__PURE__ */ b(g, { children: n.description })] }), /* @__PURE__ */ x(h, {
380
+ }), /* @__PURE__ */ C(g, { children: [/* @__PURE__ */ C(y, { children: [!i && n.title && /* @__PURE__ */ S(b, { children: n.title }), !i && n.description && /* @__PURE__ */ S(v, { children: n.description })] }), /* @__PURE__ */ C(_, {
378
381
  className: "space-y-6",
379
382
  children: [
380
- c && /* @__PURE__ */ x("div", {
383
+ s && /* @__PURE__ */ C("div", {
381
384
  className: "space-y-6",
382
- children: [/* @__PURE__ */ b("div", {
385
+ children: [/* @__PURE__ */ S("div", {
383
386
  className: "grid grid-cols-1 md:grid-cols-3 gap-4",
384
387
  children: [
385
388
  1,
386
389
  2,
387
390
  3
388
- ].map((e) => /* @__PURE__ */ b(m, { children: /* @__PURE__ */ x(h, {
391
+ ].map((e) => /* @__PURE__ */ S(g, { children: /* @__PURE__ */ C(_, {
389
392
  className: "p-4 space-y-2",
390
- children: [/* @__PURE__ */ b(y, { className: "h-4 w-20" }), /* @__PURE__ */ b(y, { className: "h-8 w-28" })]
393
+ children: [/* @__PURE__ */ S(x, { className: "h-4 w-20" }), /* @__PURE__ */ S(x, { className: "h-8 w-28" })]
391
394
  }) }, e))
392
- }), /* @__PURE__ */ x("div", {
395
+ }), /* @__PURE__ */ C("div", {
393
396
  className: "space-y-2",
394
- children: [/* @__PURE__ */ b(y, { className: "h-10 w-full" }), [
397
+ children: [/* @__PURE__ */ S(x, { className: "h-10 w-full" }), [
395
398
  1,
396
399
  2,
397
400
  3,
398
401
  4,
399
402
  5
400
- ].map((e) => /* @__PURE__ */ b(y, { className: "h-8 w-full" }, e))]
403
+ ].map((e) => /* @__PURE__ */ S(x, { className: "h-8 w-full" }, e))]
401
404
  })]
402
405
  }),
403
- !c && n.sections?.map((e, t) => e.visible === !1 ? null : /* @__PURE__ */ x("div", {
406
+ !s && n.sections?.map((e, t) => e.visible === !1 ? null : /* @__PURE__ */ C("div", {
404
407
  className: "space-y-2",
405
408
  children: [
406
- e.title && e.type !== "header" && /* @__PURE__ */ b("h3", {
409
+ e.title && e.type !== "header" && /* @__PURE__ */ S("h3", {
407
410
  className: "text-lg font-semibold border-b pb-2",
408
411
  children: e.title
409
412
  }),
410
- e.type === "header" && e.title && /* @__PURE__ */ b("div", {
413
+ e.type === "header" && e.title && /* @__PURE__ */ S("div", {
411
414
  className: "text-2xl font-bold py-4",
412
415
  children: e.title
413
416
  }),
414
- e.type === "summary" && /* @__PURE__ */ b("div", {
417
+ e.type === "summary" && /* @__PURE__ */ S("div", {
415
418
  className: "grid grid-cols-1 md:grid-cols-3 gap-4",
416
- children: n.fields?.filter((e) => e.showInSummary).map((e, t) => /* @__PURE__ */ b(m, { children: /* @__PURE__ */ x(h, {
419
+ children: n.fields?.filter((e) => e.showInSummary).map((e, t) => /* @__PURE__ */ S(g, { children: /* @__PURE__ */ C(_, {
417
420
  className: "p-4",
418
- children: [/* @__PURE__ */ b("div", {
421
+ children: [/* @__PURE__ */ S("div", {
419
422
  className: "text-sm text-muted-foreground",
420
423
  children: e.label || e.name
421
- }), /* @__PURE__ */ b("div", {
424
+ }), /* @__PURE__ */ S("div", {
422
425
  className: "text-2xl font-bold",
423
- children: B(w(e.name, e.aggregation), e)
426
+ children: U(p(e.name, e.aggregation), e)
424
427
  })]
425
428
  }) }, t))
426
429
  }),
427
- e.type === "table" && /* @__PURE__ */ b("div", {
430
+ e.type === "table" && /* @__PURE__ */ S("div", {
428
431
  className: "border rounded-lg overflow-x-auto",
429
- children: /* @__PURE__ */ x("table", {
432
+ children: /* @__PURE__ */ C("table", {
430
433
  className: "w-full text-sm min-w-[600px]",
431
- children: [/* @__PURE__ */ b("thead", {
434
+ children: [/* @__PURE__ */ S("thead", {
432
435
  className: "bg-muted",
433
- children: /* @__PURE__ */ b("tr", { children: e.columns?.map((e, t) => /* @__PURE__ */ b("th", {
436
+ children: /* @__PURE__ */ S("tr", { children: e.columns?.map((e, t) => /* @__PURE__ */ S("th", {
434
437
  className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
435
438
  children: e.label || e.name
436
439
  }, t)) })
437
- }), /* @__PURE__ */ b("tbody", { children: (() => {
438
- let t = oe(r || [], n.groupBy || []);
439
- return t ? t.map((t) => /* @__PURE__ */ x(s.Fragment, { children: [/* @__PURE__ */ b("tr", {
440
+ }), /* @__PURE__ */ S("tbody", { children: (() => {
441
+ let t = ae(r || [], n.groupBy || []);
442
+ return t ? t.map((t) => /* @__PURE__ */ C(l.Fragment, { children: [/* @__PURE__ */ S("tr", {
440
443
  className: "bg-muted/60",
441
- children: /* @__PURE__ */ x("td", {
444
+ children: /* @__PURE__ */ C("td", {
442
445
  colSpan: e.columns?.length || 1,
443
446
  className: "px-4 py-2 font-semibold text-sm",
444
447
  children: [
@@ -448,73 +451,73 @@ var V = ({ schema: e, onRefresh: t }) => {
448
451
  ")"
449
452
  ]
450
453
  })
451
- }), t.rows.map((t, n) => /* @__PURE__ */ b("tr", {
454
+ }), t.rows.map((t, n) => /* @__PURE__ */ S("tr", {
452
455
  className: "border-t hover:bg-muted/50 even:bg-muted/20",
453
- children: e.columns?.map((e, n) => /* @__PURE__ */ b("td", {
456
+ children: e.columns?.map((e, n) => /* @__PURE__ */ S("td", {
454
457
  className: `px-4 py-2 ${e.type === "number" ? "text-right tabular-nums" : ""}`,
455
- style: D(e.name, t[e.name]),
456
- children: k(t[e.name], e)
458
+ style: w(e.name, t[e.name]),
459
+ children: E(t[e.name], e)
457
460
  }, n))
458
- }, n))] }, t.key)) : r?.map((t, n) => /* @__PURE__ */ b("tr", {
461
+ }, n))] }, t.key)) : r?.map((t, n) => /* @__PURE__ */ S("tr", {
459
462
  className: "border-t hover:bg-muted/50 even:bg-muted/20",
460
- children: e.columns?.map((e, n) => /* @__PURE__ */ b("td", {
463
+ children: e.columns?.map((e, n) => /* @__PURE__ */ S("td", {
461
464
  className: `px-4 py-2 ${e.type === "number" ? "text-right tabular-nums" : ""}`,
462
- style: D(e.name, t[e.name]),
463
- children: k(t[e.name], e)
465
+ style: w(e.name, t[e.name]),
466
+ children: E(t[e.name], e)
464
467
  }, n))
465
468
  }, n));
466
469
  })() })]
467
470
  })
468
471
  }),
469
- e.type === "text" && e.text && /* @__PURE__ */ b("div", {
472
+ e.type === "text" && e.text && /* @__PURE__ */ S("div", {
470
473
  className: "prose max-w-none",
471
- children: /* @__PURE__ */ b("p", { children: e.text })
474
+ children: /* @__PURE__ */ S("p", { children: e.text })
472
475
  }),
473
- e.type === "page-break" && /* @__PURE__ */ b("div", { className: "border-t-2 border-dashed my-8 print:page-break-after-always" }),
474
- e.content && /* @__PURE__ */ b(u, { schema: e.content })
476
+ e.type === "page-break" && /* @__PURE__ */ S("div", { className: "border-t-2 border-dashed my-8 print:page-break-after-always" }),
477
+ e.content && /* @__PURE__ */ S(f, { schema: e.content })
475
478
  ]
476
479
  }, t)),
477
- !n.sections && r && r.length > 0 && /* @__PURE__ */ b("div", {
480
+ !n.sections && r && r.length > 0 && /* @__PURE__ */ S("div", {
478
481
  className: "border rounded-lg overflow-x-auto",
479
- children: /* @__PURE__ */ x("table", {
482
+ children: /* @__PURE__ */ C("table", {
480
483
  className: "w-full text-sm min-w-[600px]",
481
- children: [/* @__PURE__ */ b("thead", {
484
+ children: [/* @__PURE__ */ S("thead", {
482
485
  className: "bg-muted",
483
- children: /* @__PURE__ */ b("tr", { children: n.fields?.map((e, t) => /* @__PURE__ */ b("th", {
486
+ children: /* @__PURE__ */ S("tr", { children: n.fields?.map((e, t) => /* @__PURE__ */ S("th", {
484
487
  className: `px-4 py-2 font-medium ${e.type === "number" ? "text-right" : "text-left"}`,
485
488
  children: e.label || e.name
486
489
  }, t)) })
487
- }), /* @__PURE__ */ b("tbody", { children: r.map((e, t) => /* @__PURE__ */ b("tr", {
490
+ }), /* @__PURE__ */ S("tbody", { children: r.map((e, t) => /* @__PURE__ */ S("tr", {
488
491
  className: "border-t hover:bg-muted/50 even:bg-muted/20",
489
- children: n.fields?.map((t, n) => /* @__PURE__ */ b("td", {
492
+ children: n.fields?.map((t, n) => /* @__PURE__ */ S("td", {
490
493
  className: `px-4 py-2 ${t.type === "number" ? "text-right tabular-nums" : ""}`,
491
- style: D(t.name, e[t.name]),
492
- children: k(e[t.name], t)
494
+ style: w(t.name, e[t.name]),
495
+ children: E(e[t.name], t)
493
496
  }, n))
494
497
  }, t)) })]
495
498
  })
496
499
  })
497
500
  ]
498
501
  })] })]
499
- }) : /* @__PURE__ */ b(m, { children: /* @__PURE__ */ b(h, {
502
+ }) : /* @__PURE__ */ S(g, { children: /* @__PURE__ */ S(_, {
500
503
  className: "p-8 text-center text-muted-foreground",
501
504
  children: "No report to display"
502
505
  }) });
503
506
  };
504
507
  //#endregion
505
508
  //#region src/DatasetReportRenderer.tsx
506
- function H(e) {
509
+ function G(e) {
507
510
  if (!e || typeof e != "object") return !1;
508
511
  let t = e;
509
512
  return typeof t.dataset == "string" && t.dataset.length > 0 || t.type === "joined" && Array.isArray(t.blocks) && t.blocks.some((e) => typeof e?.dataset == "string");
510
513
  }
511
- function U(e, t) {
514
+ function K(e, t) {
512
515
  return e ? typeof e == "string" ? e : typeof e == "object" && typeof e.default == "string" ? e.default : t : t;
513
516
  }
514
- function W(e) {
517
+ function q(e) {
515
518
  return Array.isArray(e) ? e.filter((e) => typeof e == "string" && !!e) : [];
516
519
  }
517
- function G(e) {
520
+ function J(e) {
518
521
  if (!Array.isArray(e)) return;
519
522
  let t = {};
520
523
  for (let n of e) {
@@ -523,18 +526,18 @@ function G(e) {
523
526
  }
524
527
  return Object.keys(t).length > 0 ? t : void 0;
525
528
  }
526
- function ce(e, t, n) {
529
+ function se(e, t, n) {
527
530
  if (!e) return;
528
531
  let r = /* @__PURE__ */ new Set([...t, ...n]), i = {};
529
532
  for (let [t, n] of Object.entries(e)) r.has(t) && (i[t] = n);
530
533
  return Object.keys(i).length > 0 ? i : void 0;
531
534
  }
532
- function K(e, t, n, r, i, a, s) {
533
- let [c, l] = o.useState({
535
+ function Y(e, t, n, r, i, a, o) {
536
+ let [s, l] = c.useState({
534
537
  status: "idle",
535
538
  rows: []
536
- }), u = ce(s, t, n), d = JSON.stringify(r ?? null), f = JSON.stringify(a ?? null), p = JSON.stringify(u ?? null), m = `${e}|${t.join(",")}|${n.join(",")}|${d}|${f}|${p}`;
537
- return o.useEffect(() => {
539
+ }), u = se(o, t, n), d = JSON.stringify(r ?? null), f = JSON.stringify(a ?? null), p = JSON.stringify(u ?? null), m = `${e}|${t.join(",")}|${n.join(",")}|${d}|${f}|${p}`;
540
+ return c.useEffect(() => {
538
541
  let o = i;
539
542
  if (!o || typeof o.queryDataset != "function") {
540
543
  l({
@@ -581,10 +584,10 @@ function K(e, t, n, r, i, a, s) {
581
584
  }), () => {
582
585
  s = !0;
583
586
  };
584
- }, [m]), c;
587
+ }, [m]), s;
585
588
  }
586
- function q({ dataset: e }) {
587
- return /* @__PURE__ */ x("div", {
589
+ function X({ dataset: e }) {
590
+ return /* @__PURE__ */ C("div", {
588
591
  className: "flex items-center justify-center rounded-md border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
589
592
  children: [
590
593
  "This report binds the “",
@@ -593,35 +596,35 @@ function q({ dataset: e }) {
593
596
  ]
594
597
  });
595
598
  }
596
- function J({ status: e, error: t }) {
597
- return e === "error" ? /* @__PURE__ */ x("div", {
599
+ function Z({ status: e, error: t }) {
600
+ return e === "error" ? /* @__PURE__ */ C("div", {
598
601
  role: "alert",
599
602
  className: "flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",
600
- children: [/* @__PURE__ */ b(S, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ b("span", {
603
+ children: [/* @__PURE__ */ S(w, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ S("span", {
601
604
  className: "break-words",
602
605
  children: t
603
606
  })]
604
- }) : /* @__PURE__ */ x("div", {
607
+ }) : /* @__PURE__ */ C("div", {
605
608
  className: "flex items-center gap-2 p-4 text-xs text-muted-foreground",
606
- children: [/* @__PURE__ */ b(w, { className: "h-4 w-4 animate-spin" }), " Running report…"]
609
+ children: [/* @__PURE__ */ S(E, { className: "h-4 w-4 animate-spin" }), " Running report…"]
607
610
  });
608
611
  }
609
- function Y() {
610
- return /* @__PURE__ */ x("div", {
612
+ function ce() {
613
+ return /* @__PURE__ */ C("div", {
611
614
  className: "flex flex-col items-center justify-center gap-2 rounded-md border border-dashed bg-muted/20 p-6 text-xs text-muted-foreground",
612
- children: [/* @__PURE__ */ b(D, { className: "h-6 w-6" }), " The dataset returned no rows for this report’s scope."]
615
+ children: [/* @__PURE__ */ S(k, { className: "h-6 w-6" }), " The dataset returned no rows for this report’s scope."]
613
616
  });
614
617
  }
615
618
  var le = "cursor-pointer hover:bg-accent/40";
616
619
  function ue({ dataset: e, rows: a, values: o, runtimeFilter: s, dataSource: c, onDrill: l, order: u, withTotals: d }) {
617
- let f = K(e, a, o, s, c, d && a.length > 0 ? [[]] : void 0, u), { fieldLabel: p } = k(), m = A();
618
- if (o.length === 0) return /* @__PURE__ */ b(q, { dataset: e });
619
- if (f.status === "loading" || f.status === "idle") return /* @__PURE__ */ b(J, { status: f.status });
620
- if (f.status === "error") return /* @__PURE__ */ b(J, {
620
+ let f = Y(e, a, o, s, c, d && a.length > 0 ? [[]] : void 0, u), { fieldLabel: p } = M(), m = ee();
621
+ if (o.length === 0) return /* @__PURE__ */ S(X, { dataset: e });
622
+ if (f.status === "loading" || f.status === "idle") return /* @__PURE__ */ S(Z, { status: f.status });
623
+ if (f.status === "error") return /* @__PURE__ */ S(Z, {
621
624
  status: "error",
622
625
  error: f.error
623
626
  });
624
- if (f.rows.length === 0) return /* @__PURE__ */ b(Y, {});
627
+ if (f.rows.length === 0) return /* @__PURE__ */ S(ce, {});
625
628
  let h = !!l && a.length > 0, g = f.dimensionFields ? a.filter((e) => e in f.dimensionFields) : [], _ = (n, r) => {
626
629
  let i = {};
627
630
  for (let e of a) i[e] = n[e];
@@ -633,35 +636,35 @@ function ue({ dataset: e, rows: a, values: o, runtimeFilter: s, dataSource: c, o
633
636
  object: f.object,
634
637
  objectFilter: u
635
638
  });
636
- }, { measureField: v, headerLabel: y } = n(f.fields, f.object, p), S = [...a, ...o], C = d ? f.totals?.find((e) => Array.isArray(e.dimensions) && e.dimensions.length === 0)?.rows?.[0] : void 0, w = m("report.total", "Total");
637
- return /* @__PURE__ */ b("div", {
639
+ }, { measureField: v, headerLabel: y } = n(f.fields, f.object, p), b = [...a, ...o], x = d ? f.totals?.find((e) => Array.isArray(e.dimensions) && e.dimensions.length === 0)?.rows?.[0] : void 0, w = m("report.total", "Total");
640
+ return /* @__PURE__ */ S("div", {
638
641
  className: "overflow-auto max-h-[70vh] rounded-md border",
639
- children: /* @__PURE__ */ x("table", {
642
+ children: /* @__PURE__ */ C("table", {
640
643
  className: "w-full text-xs",
641
- children: [/* @__PURE__ */ b("thead", {
644
+ children: [/* @__PURE__ */ S("thead", {
642
645
  className: "bg-muted/40",
643
- children: /* @__PURE__ */ b("tr", { children: S.map((e) => /* @__PURE__ */ b("th", {
646
+ children: /* @__PURE__ */ S("tr", { children: b.map((e) => /* @__PURE__ */ S("th", {
644
647
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
645
648
  children: y(e)
646
649
  }, e)) })
647
- }), /* @__PURE__ */ x("tbody", { children: [f.rows.map((e, t) => /* @__PURE__ */ b("tr", {
650
+ }), /* @__PURE__ */ C("tbody", { children: [f.rows.map((e, t) => /* @__PURE__ */ S("tr", {
648
651
  className: `border-t${h ? ` ${le}` : ""}`,
649
652
  "data-testid": h ? "dataset-drill-row" : void 0,
650
653
  onClick: h ? () => _(e, t) : void 0,
651
- children: S.map((t) => /* @__PURE__ */ b("td", {
654
+ children: b.map((t) => /* @__PURE__ */ S("td", {
652
655
  className: "px-2 py-1 tabular-nums whitespace-nowrap",
653
656
  children: o.includes(t) ? i(e[t], v(t)?.format, v(t)?.currency, v(t)?.percentScale) : r(e[t])
654
657
  }, t))
655
- }, t)), C && /* @__PURE__ */ x("tr", {
658
+ }, t)), x && /* @__PURE__ */ C("tr", {
656
659
  className: "border-t bg-muted/30 font-medium",
657
660
  "data-testid": "dataset-report-total-row",
658
- children: [a.length > 0 && /* @__PURE__ */ b("td", {
661
+ children: [a.length > 0 && /* @__PURE__ */ S("td", {
659
662
  colSpan: a.length,
660
663
  className: "px-2 py-1 whitespace-nowrap",
661
664
  children: w
662
- }), o.map((e) => /* @__PURE__ */ b("td", {
665
+ }), o.map((e) => /* @__PURE__ */ S("td", {
663
666
  className: "px-2 py-1 tabular-nums whitespace-nowrap",
664
- children: i(C[e], v(e)?.format, v(e)?.currency, v(e)?.percentScale)
667
+ children: i(x[e], v(e)?.format, v(e)?.currency, v(e)?.percentScale)
665
668
  }, e))]
666
669
  })] })]
667
670
  })
@@ -707,8 +710,8 @@ function fe(e) {
707
710
  }
708
711
  }
709
712
  function pe(t) {
710
- let [, n] = o.useReducer((e) => e + 1, 0);
711
- return o.useEffect(() => {
713
+ let [, n] = c.useReducer((e) => e + 1, 0);
714
+ return c.useEffect(() => {
712
715
  if (e.get(t)) return;
713
716
  let r = typeof e.subscribe == "function" ? e.subscribe(() => {
714
717
  e.get(t) && n();
@@ -717,9 +720,9 @@ function pe(t) {
717
720
  }, [t]), e.get(t);
718
721
  }
719
722
  function me({ dataset: e, chart: t, runtimeFilter: r, dataSource: a, order: o }) {
720
- let s = typeof t.xAxis == "string" ? t.xAxis : "", c = typeof t.yAxis == "string" ? t.yAxis : "", l = fe(t.type), u = l.kind === "series" || l.kind === "single_value", d = K(e, l.kind === "series" && s ? [s] : [], u && c ? [c] : [], r, a, void 0, o), f = pe("chart"), { fieldLabel: p } = k(), m = typeof t.title == "string" ? t.title : void 0;
723
+ let s = typeof t.xAxis == "string" ? t.xAxis : "", c = typeof t.yAxis == "string" ? t.yAxis : "", l = fe(t.type), u = l.kind === "series" || l.kind === "single_value", d = Y(e, l.kind === "series" && s ? [s] : [], u && c ? [c] : [], r, a, void 0, o), f = pe("chart"), { fieldLabel: p } = M(), m = typeof t.title == "string" ? t.title : void 0;
721
724
  if (l.kind === "tabular") return null;
722
- if (l.kind === "unsupported") return /* @__PURE__ */ x("div", {
725
+ if (l.kind === "unsupported") return /* @__PURE__ */ C("div", {
723
726
  className: "rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground",
724
727
  "data-testid": "dataset-report-chart-unsupported",
725
728
  children: [
@@ -729,38 +732,38 @@ function me({ dataset: e, chart: t, runtimeFilter: r, dataSource: a, order: o })
729
732
  ]
730
733
  });
731
734
  if (l.kind === "series" && !s || !c) return null;
732
- if (d.status === "loading" || d.status === "idle") return /* @__PURE__ */ x("div", {
735
+ if (d.status === "loading" || d.status === "idle") return /* @__PURE__ */ C("div", {
733
736
  className: "flex items-center gap-2 p-4 text-xs text-muted-foreground",
734
- children: [/* @__PURE__ */ b(w, { className: "h-4 w-4 animate-spin" }), " Loading chart…"]
737
+ children: [/* @__PURE__ */ S(E, { className: "h-4 w-4 animate-spin" }), " Loading chart…"]
735
738
  });
736
739
  if (d.status === "error" || d.rows.length === 0) return null;
737
740
  if (l.kind === "single_value") {
738
741
  let { measureField: e, headerLabel: t } = n(d.fields, d.object, p), r = e(c);
739
- return /* @__PURE__ */ x("div", {
742
+ return /* @__PURE__ */ C("div", {
740
743
  className: "rounded-md border bg-card p-3",
741
744
  "data-testid": "dataset-report-metric",
742
- children: [m ? /* @__PURE__ */ b("h3", {
745
+ children: [m ? /* @__PURE__ */ S("h3", {
743
746
  className: "mb-2 text-sm font-semibold",
744
747
  children: m
745
- }) : null, /* @__PURE__ */ x("div", {
748
+ }) : null, /* @__PURE__ */ C("div", {
746
749
  className: "flex flex-col gap-0.5 py-2",
747
- children: [/* @__PURE__ */ b("span", {
750
+ children: [/* @__PURE__ */ S("span", {
748
751
  className: "text-2xl font-semibold tabular-nums",
749
752
  children: i(d.rows[0]?.[c], r?.format, r?.currency, r?.percentScale)
750
- }), /* @__PURE__ */ b("span", {
753
+ }), /* @__PURE__ */ S("span", {
751
754
  className: "text-xs text-muted-foreground",
752
755
  children: t(c)
753
756
  })]
754
757
  })]
755
758
  });
756
759
  }
757
- return f ? /* @__PURE__ */ x("div", {
760
+ return f ? /* @__PURE__ */ C("div", {
758
761
  className: "rounded-md border bg-card p-3",
759
762
  "data-testid": "dataset-report-chart",
760
- children: [m ? /* @__PURE__ */ b("h3", {
763
+ children: [m ? /* @__PURE__ */ S("h3", {
761
764
  className: "mb-2 text-sm font-semibold",
762
765
  children: m
763
- }) : null, /* @__PURE__ */ b(f, { schema: {
766
+ }) : null, /* @__PURE__ */ S(f, { schema: {
764
767
  chartType: l.chartType,
765
768
  data: d.rows,
766
769
  xAxisKey: s,
@@ -770,45 +773,45 @@ function me({ dataset: e, chart: t, runtimeFilter: r, dataSource: a, order: o })
770
773
  } })]
771
774
  }) : null;
772
775
  }
773
- function X(e, t) {
774
- return e.map((e) => String(t[e] ?? "∅")).join("");
776
+ function Q(e, t) {
777
+ return o(e.map((e) => String(t[e] ?? "∅")));
775
778
  }
776
779
  function he(e, t) {
777
780
  return e.map((e) => r(t[e])).join(" / ");
778
781
  }
779
- function Z({ dataset: e, rows: a, columnsAcross: s, values: c, runtimeFilter: l, dataSource: u, onDrill: d, order: f }) {
780
- let p = K(e, [...a, ...s], c, l, u, [
782
+ function ge({ dataset: e, rows: a, columnsAcross: o, values: l, runtimeFilter: u, dataSource: d, onDrill: f, order: p }) {
783
+ let m = Y(e, [...a, ...o], l, u, d, [
781
784
  a,
782
- s,
785
+ o,
783
786
  []
784
- ], f), m = A(), { fieldLabel: h } = k(), g = o.useMemo(() => {
785
- if (p.status !== "ok") return null;
787
+ ], p), h = ee(), { fieldLabel: g } = M(), _ = c.useMemo(() => {
788
+ if (m.status !== "ok") return null;
786
789
  let e = [], t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map();
787
- return p.rows.forEach((o, c) => {
788
- let l = X(a, o), u = X(s, o);
789
- if (!n.has(l)) {
790
- n.add(l);
790
+ return m.rows.forEach((c, l) => {
791
+ let u = Q(a, c), d = Q(o, c);
792
+ if (!n.has(u)) {
793
+ n.add(u);
791
794
  let t = {};
792
- for (let e of a) t[e] = o[e];
795
+ for (let e of a) t[e] = c[e];
793
796
  e.push({
794
- id: l,
795
- label: he(a, o),
797
+ id: u,
798
+ label: he(a, c),
796
799
  key: t
797
800
  });
798
801
  }
799
- if (!r.has(u)) {
800
- r.add(u);
802
+ if (!r.has(d)) {
803
+ r.add(d);
801
804
  let e = {};
802
- for (let t of s) e[t] = o[t];
805
+ for (let t of o) e[t] = c[t];
803
806
  t.push({
804
- id: u,
805
- label: he(s, o),
807
+ id: d,
808
+ label: he(o, c),
806
809
  key: e
807
810
  });
808
811
  }
809
- i.set(`${l} ${u}`, {
810
- row: o,
811
- index: c
812
+ i.set(s(u, d), {
813
+ row: c,
814
+ index: l
812
815
  });
813
816
  }), {
814
817
  rowHeaders: e,
@@ -816,108 +819,108 @@ function Z({ dataset: e, rows: a, columnsAcross: s, values: c, runtimeFilter: l,
816
819
  cells: i
817
820
  };
818
821
  }, [
819
- p,
822
+ m,
820
823
  a,
821
- s
824
+ o
822
825
  ]);
823
- if (c.length === 0) return /* @__PURE__ */ b(q, { dataset: e });
824
- if (p.status === "loading" || p.status === "idle") return /* @__PURE__ */ b(J, { status: p.status });
825
- if (p.status === "error") return /* @__PURE__ */ b(J, {
826
+ if (l.length === 0) return /* @__PURE__ */ S(X, { dataset: e });
827
+ if (m.status === "loading" || m.status === "idle") return /* @__PURE__ */ S(Z, { status: m.status });
828
+ if (m.status === "error") return /* @__PURE__ */ S(Z, {
826
829
  status: "error",
827
- error: p.error
830
+ error: m.error
828
831
  });
829
- if (!g || g.rowHeaders.length === 0) return /* @__PURE__ */ b(Y, {});
830
- let { measureField: _, headerLabel: v } = n(p.fields, p.object, h), y = m("report.total", "Total"), S = !!d, C = p.dimensionFields ? [...a, ...s].filter((e) => e in p.dimensionFields) : [], w = (n, r, i) => {
831
- let a = p.drillRanges?.[i], o = !!a && Object.keys(a).length > 0, s = p.object && (C.length > 0 || o) ? t(p.drillRawRows?.[i], C, p.dimensionFields ?? {}, l, a) : void 0;
832
- d({
832
+ if (!_ || _.rowHeaders.length === 0) return /* @__PURE__ */ S(ce, {});
833
+ let { measureField: v, headerLabel: y } = n(m.fields, m.object, g), b = h("report.total", "Total"), x = !!f, w = m.dimensionFields ? [...a, ...o].filter((e) => e in m.dimensionFields) : [], T = (n, r, i) => {
834
+ let a = m.drillRanges?.[i], o = !!a && Object.keys(a).length > 0, s = m.object && (w.length > 0 || o) ? t(m.drillRawRows?.[i], w, m.dimensionFields ?? {}, u, a) : void 0;
835
+ f({
833
836
  dataset: e,
834
837
  groupKey: {
835
838
  ...n,
836
839
  ...r
837
840
  },
838
- runtimeFilter: l,
839
- object: p.object,
841
+ runtimeFilter: u,
842
+ object: m.object,
840
843
  objectFilter: s
841
844
  });
842
- }, T = g.colHeaders.flatMap((e) => c.map((t) => ({
845
+ }, E = _.colHeaders.flatMap((e) => l.map((t) => ({
843
846
  col: e,
844
847
  measure: t,
845
- header: c.length === 1 ? e.label : `${e.label} · ${v(t)}`
846
- }))), E = (e) => p.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, D = /* @__PURE__ */ new Map();
847
- for (let e of E(a) ?? []) D.set(X(a, e), e);
848
- let O = /* @__PURE__ */ new Map();
849
- for (let e of E(s) ?? []) O.set(X(s, e), e);
850
- let ee = E([])?.[0], j = D.size > 0, M = O.size > 0;
851
- return /* @__PURE__ */ b("div", {
848
+ header: l.length === 1 ? e.label : `${e.label} · ${y(t)}`
849
+ }))), D = (e) => m.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, O = /* @__PURE__ */ new Map();
850
+ for (let e of D(a) ?? []) O.set(Q(a, e), e);
851
+ let k = /* @__PURE__ */ new Map();
852
+ for (let e of D(o) ?? []) k.set(Q(o, e), e);
853
+ let A = D([])?.[0], j = O.size > 0, N = k.size > 0;
854
+ return /* @__PURE__ */ S("div", {
852
855
  className: "overflow-auto max-h-[70vh] rounded-md border",
853
856
  "data-testid": "dataset-matrix",
854
- children: /* @__PURE__ */ x("table", {
857
+ children: /* @__PURE__ */ C("table", {
855
858
  className: "w-full text-xs",
856
- children: [/* @__PURE__ */ b("thead", {
859
+ children: [/* @__PURE__ */ S("thead", {
857
860
  className: "bg-muted/40",
858
- children: /* @__PURE__ */ x("tr", { children: [
859
- a.map((e) => /* @__PURE__ */ b("th", {
861
+ children: /* @__PURE__ */ C("tr", { children: [
862
+ a.map((e) => /* @__PURE__ */ S("th", {
860
863
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
861
- children: v(e)
864
+ children: y(e)
862
865
  }, e)),
863
- T.map((e) => /* @__PURE__ */ b("th", {
866
+ E.map((e) => /* @__PURE__ */ S("th", {
864
867
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
865
868
  children: e.header
866
869
  }, `${e.col.id}-${e.measure}`)),
867
- j && c.map((e) => /* @__PURE__ */ b("th", {
870
+ j && l.map((e) => /* @__PURE__ */ S("th", {
868
871
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
869
872
  "data-testid": "matrix-total-col-header",
870
- children: c.length === 1 ? y : `${y} · ${v(e)}`
873
+ children: l.length === 1 ? b : `${b} · ${y(e)}`
871
874
  }, `total-${e}`))
872
875
  ] })
873
- }), /* @__PURE__ */ x("tbody", { children: [g.rowHeaders.map((e) => /* @__PURE__ */ x("tr", {
876
+ }), /* @__PURE__ */ C("tbody", { children: [_.rowHeaders.map((e) => /* @__PURE__ */ C("tr", {
874
877
  className: "border-t",
875
878
  children: [
876
- a.map((t) => /* @__PURE__ */ b("td", {
879
+ a.map((t) => /* @__PURE__ */ S("td", {
877
880
  className: "px-2 py-1 whitespace-nowrap font-medium",
878
881
  children: r(e.key[t])
879
882
  }, t)),
880
- T.map((t) => {
881
- let n = g.cells.get(`${e.id} ${t.col.id}`), r = n?.row[t.measure], a = S && n != null;
882
- return /* @__PURE__ */ b("td", {
883
+ E.map((t) => {
884
+ let n = _.cells.get(s(e.id, t.col.id)), r = n?.row[t.measure], a = x && n != null;
885
+ return /* @__PURE__ */ S("td", {
883
886
  className: `px-2 py-1 text-right tabular-nums whitespace-nowrap${a ? ` ${le}` : ""}`,
884
887
  "data-testid": a ? "dataset-drill-cell" : void 0,
885
- onClick: a ? () => w(e.key, t.col.key, n.index) : void 0,
886
- children: i(r, _(t.measure)?.format, _(t.measure)?.currency, _(t.measure)?.percentScale)
888
+ onClick: a ? () => T(e.key, t.col.key, n.index) : void 0,
889
+ children: i(r, v(t.measure)?.format, v(t.measure)?.currency, v(t.measure)?.percentScale)
887
890
  }, `${t.col.id}-${t.measure}`);
888
891
  }),
889
- j && c.map((t) => /* @__PURE__ */ b("td", {
892
+ j && l.map((t) => /* @__PURE__ */ S("td", {
890
893
  className: "px-2 py-1 text-right tabular-nums whitespace-nowrap font-medium",
891
894
  "data-testid": "matrix-row-total",
892
- children: i(D.get(e.id)?.[t], _(t)?.format, _(t)?.currency, _(t)?.percentScale)
895
+ children: i(O.get(e.id)?.[t], v(t)?.format, v(t)?.currency, v(t)?.percentScale)
893
896
  }, `total-${t}`))
894
897
  ]
895
- }, e.id)), M && /* @__PURE__ */ x("tr", {
898
+ }, e.id)), N && /* @__PURE__ */ C("tr", {
896
899
  className: "border-t bg-muted/30 font-medium",
897
900
  "data-testid": "matrix-total-row",
898
901
  children: [
899
- a.length > 0 && /* @__PURE__ */ b("td", {
902
+ a.length > 0 && /* @__PURE__ */ S("td", {
900
903
  colSpan: a.length,
901
904
  className: "px-2 py-1 whitespace-nowrap",
902
- children: y
905
+ children: b
903
906
  }),
904
- T.map((e) => /* @__PURE__ */ b("td", {
907
+ E.map((e) => /* @__PURE__ */ S("td", {
905
908
  className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
906
- children: i(O.get(e.col.id)?.[e.measure], _(e.measure)?.format, _(e.measure)?.currency, _(e.measure)?.percentScale)
909
+ children: i(k.get(e.col.id)?.[e.measure], v(e.measure)?.format, v(e.measure)?.currency, v(e.measure)?.percentScale)
907
910
  }, `${e.col.id}-${e.measure}`)),
908
- j && c.map((e) => /* @__PURE__ */ b("td", {
911
+ j && l.map((e) => /* @__PURE__ */ S("td", {
909
912
  className: "px-2 py-1 text-right tabular-nums whitespace-nowrap",
910
913
  "data-testid": "matrix-grand-total",
911
- children: i(ee?.[e], _(e)?.format, _(e)?.currency, _(e)?.percentScale)
914
+ children: i(A?.[e], v(e)?.format, v(e)?.currency, v(e)?.percentScale)
912
915
  }, `grand-${e}`))
913
916
  ]
914
917
  })] })]
915
918
  })
916
919
  });
917
920
  }
918
- var ge = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i }) => {
921
+ var _e = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i }) => {
919
922
  let o = a(e.runtimeFilter ?? e.filter, n), s = e.drilldown === !1 ? void 0 : r, c = de(e.type);
920
- if (c === "joined" && Array.isArray(e.blocks)) return /* @__PURE__ */ b("div", {
923
+ if (c === "joined" && Array.isArray(e.blocks)) return /* @__PURE__ */ S("div", {
921
924
  className: i,
922
925
  "data-testid": "dataset-joined-report",
923
926
  "data-report-name": e.name,
@@ -927,52 +930,52 @@ var ge = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i
927
930
  gap: 24
928
931
  },
929
932
  children: e.blocks.map((e, n) => {
930
- let r = a(o, e.runtimeFilter ?? e.filter), i = W(e.columns), c = G(e.order), l = de(e.type), u = l === "matrix" && i.length > 0 ? /* @__PURE__ */ b(Z, {
933
+ let r = a(o, e.runtimeFilter ?? e.filter), i = q(e.columns), c = J(e.order), l = de(e.type), u = l === "matrix" && i.length > 0 ? /* @__PURE__ */ S(ge, {
931
934
  dataset: String(e.dataset ?? ""),
932
- rows: W(e.rows),
935
+ rows: q(e.rows),
933
936
  columnsAcross: i,
934
- values: W(e.values),
937
+ values: q(e.values),
935
938
  runtimeFilter: r,
936
939
  dataSource: t,
937
940
  onDrill: s,
938
941
  order: c
939
- }) : /* @__PURE__ */ b(ue, {
942
+ }) : /* @__PURE__ */ S(ue, {
940
943
  dataset: String(e.dataset ?? ""),
941
- rows: W(e.rows),
942
- values: W(e.values),
944
+ rows: q(e.rows),
945
+ values: q(e.values),
943
946
  runtimeFilter: r,
944
947
  dataSource: t,
945
948
  onDrill: s,
946
949
  order: c,
947
950
  withTotals: l === "summary" || l === "matrix"
948
951
  });
949
- return /* @__PURE__ */ x("section", {
952
+ return /* @__PURE__ */ C("section", {
950
953
  "data-testid": "dataset-report-block",
951
954
  "data-block-id": e.name ?? `block-${n}`,
952
955
  className: "flex flex-col gap-2 rounded-lg border bg-card p-4",
953
- children: [/* @__PURE__ */ x("header", {
956
+ children: [/* @__PURE__ */ C("header", {
954
957
  className: "flex flex-col gap-0.5",
955
- children: [/* @__PURE__ */ b("h3", {
958
+ children: [/* @__PURE__ */ S("h3", {
956
959
  className: "text-sm font-semibold",
957
- children: U(e.label, e.name ?? `Block ${n + 1}`)
958
- }), e.description ? /* @__PURE__ */ b("p", {
960
+ children: K(e.label, e.name ?? `Block ${n + 1}`)
961
+ }), e.description ? /* @__PURE__ */ S("p", {
959
962
  className: "text-xs text-muted-foreground",
960
- children: U(e.description, "")
963
+ children: K(e.description, "")
961
964
  }) : null]
962
965
  }), u]
963
966
  }, e.name ?? `block-${n}`);
964
967
  })
965
968
  });
966
- let l = W(e.columns), u = G(e.order);
967
- if (c === "matrix" && l.length > 0) return /* @__PURE__ */ b("div", {
969
+ let l = q(e.columns), u = J(e.order);
970
+ if (c === "matrix" && l.length > 0) return /* @__PURE__ */ S("div", {
968
971
  className: i,
969
972
  "data-testid": "dataset-report",
970
973
  "data-report-name": e.name,
971
- children: /* @__PURE__ */ b(Z, {
974
+ children: /* @__PURE__ */ S(ge, {
972
975
  dataset: String(e.dataset ?? ""),
973
- rows: W(e.rows),
976
+ rows: q(e.rows),
974
977
  columnsAcross: l,
975
- values: W(e.values),
978
+ values: q(e.values),
976
979
  runtimeFilter: o,
977
980
  dataSource: t,
978
981
  onDrill: s,
@@ -980,21 +983,21 @@ var ge = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i
980
983
  })
981
984
  });
982
985
  let d = e.chart && typeof e.chart == "object" && e.chart.type ? e.chart : null;
983
- return /* @__PURE__ */ x("div", {
986
+ return /* @__PURE__ */ C("div", {
984
987
  className: `${i ?? ""} flex flex-col gap-3`,
985
988
  "data-testid": "dataset-report",
986
989
  "data-report-name": e.name,
987
990
  "data-report-presentation": c,
988
- children: [d ? /* @__PURE__ */ b(me, {
991
+ children: [d ? /* @__PURE__ */ S(me, {
989
992
  dataset: String(e.dataset ?? ""),
990
993
  chart: d,
991
994
  runtimeFilter: o,
992
995
  dataSource: t,
993
996
  order: u
994
- }) : null, /* @__PURE__ */ b(ue, {
997
+ }) : null, /* @__PURE__ */ S(ue, {
995
998
  dataset: String(e.dataset ?? ""),
996
- rows: W(e.rows),
997
- values: W(e.values),
999
+ rows: q(e.rows),
1000
+ values: q(e.values),
998
1001
  runtimeFilter: o,
999
1002
  dataSource: t,
1000
1003
  onDrill: s,
@@ -1002,32 +1005,37 @@ var ge = ({ report: e, dataSource: t, runtimeFilter: n, onDrill: r, className: i
1002
1005
  withTotals: c === "summary" || c === "matrix"
1003
1006
  })]
1004
1007
  });
1005
- }, Q = (e) => {
1006
- let { dataSource: t, rows: n, runtimeFilter: r, onDrill: i, className: a } = e, s = o.useContext(d), u = t ?? s?.dataSource, f = e.schema;
1007
- return f && typeof f == "object" && f.type === "spec-report" && f.report && typeof f.report == "object" && (f = f.report), H(f) ? /* @__PURE__ */ b(ge, {
1008
- report: f,
1009
- dataSource: u,
1008
+ }, $ = (e) => {
1009
+ let { dataSource: t, rows: n, runtimeFilter: r, onDrill: i, className: a } = e, o = c.useContext(p), s = t ?? o?.dataSource, l = e.schema;
1010
+ if (l && typeof l == "object" && l.type === "spec-report" && l.report && typeof l.report == "object" && (l = l.report), G(l)) return /* @__PURE__ */ S(_e, {
1011
+ report: l,
1012
+ dataSource: s,
1010
1013
  runtimeFilter: r,
1011
1014
  onDrill: i,
1012
1015
  className: a
1013
- }) : c(f) ? /* @__PURE__ */ b("div", {
1014
- className: a,
1015
- "data-testid": "report-presentation-bridge",
1016
- children: /* @__PURE__ */ b(V, { schema: {
1016
+ });
1017
+ if (u(l)) {
1018
+ let e = {
1017
1019
  type: "report-viewer",
1018
- report: l(f),
1020
+ report: d(l),
1019
1021
  data: n ?? [],
1020
1022
  showToolbar: !1
1021
- } })
1022
- }) : /* @__PURE__ */ b(j, { schema: f });
1023
+ };
1024
+ return /* @__PURE__ */ S("div", {
1025
+ className: a,
1026
+ "data-testid": "report-presentation-bridge",
1027
+ children: /* @__PURE__ */ S(W, { schema: e })
1028
+ });
1029
+ }
1030
+ return /* @__PURE__ */ S(N, { schema: l });
1023
1031
  };
1024
1032
  //#endregion
1025
1033
  //#region src/LiveReportExporter.ts
1026
- async function $(e, t) {
1034
+ async function ve(e, t) {
1027
1035
  let { dataSource: n, resource: r, queryParams: i, format: a, exportConfig: o } = t, s = a || e.defaultExportFormat || "pdf";
1028
1036
  try {
1029
1037
  let t = (await n.find(r, i)).data || [];
1030
- return I(s, e, t, {
1038
+ return R(s, e, t, {
1031
1039
  format: s,
1032
1040
  ...e.exportConfigs?.[s],
1033
1041
  ...o
@@ -1045,17 +1053,17 @@ async function $(e, t) {
1045
1053
  };
1046
1054
  }
1047
1055
  }
1048
- function _e(e, t, n = {}) {
1049
- let { columns: r, filename: i, includeAggregationRow: a = !1 } = n, o = r || (e.fields || []).map(ye), s = o.map((e) => e.header), c = t.map((e, t) => o.map((n) => {
1056
+ function ye(e, t, n = {}) {
1057
+ let { columns: r, filename: i, includeAggregationRow: a = !1 } = n, o = r || (e.fields || []).map(xe), s = o.map((e) => e.header), c = t.map((e, t) => o.map((n) => {
1050
1058
  if (n.formula) return n.formula.replace(/\{ROW\}/g, String(t + 2));
1051
1059
  let r = e[n.name];
1052
- return be(r, n.numberFormat);
1060
+ return Se(r, n.numberFormat);
1053
1061
  }));
1054
1062
  if (a && t.length > 0) {
1055
1063
  let n = o.map((n, r) => {
1056
1064
  let i = (e.fields || []).find((e) => e.name === n.name);
1057
1065
  if (i?.aggregation) {
1058
- let e = Se(r), n = t.length + 1;
1066
+ let e = we(r), n = t.length + 1;
1059
1067
  switch (i.aggregation) {
1060
1068
  case "sum": return `=SUM(${e}2:${e}${n})`;
1061
1069
  case "avg": return `=AVERAGE(${e}2:${e}${n})`;
@@ -1069,15 +1077,15 @@ function _e(e, t, n = {}) {
1069
1077
  });
1070
1078
  c.push(n);
1071
1079
  }
1072
- we("" + [s.join(" "), ...c.map((e) => e.join(" "))].join("\n"), i || `${e.title || "report"}.tsv`, "text/tab-separated-values");
1080
+ Ee("" + [s.join(" "), ...c.map((e) => e.join(" "))].join("\n"), i || `${e.title || "report"}.tsv`, "text/tab-separated-values");
1073
1081
  }
1074
- function ve(e, t, n, r) {
1082
+ function be(e, t, n, r) {
1075
1083
  return async () => {
1076
1084
  let i = e.schedule;
1077
1085
  if (!i?.enabled) return [];
1078
1086
  let a = i.formats || [e.defaultExportFormat || "pdf"], o = [];
1079
1087
  for (let r of a) {
1080
- let i = await $(e, {
1088
+ let i = await ve(e, {
1081
1089
  dataSource: t,
1082
1090
  resource: n,
1083
1091
  format: r
@@ -1087,16 +1095,16 @@ function ve(e, t, n, r) {
1087
1095
  return r(e, i), o;
1088
1096
  };
1089
1097
  }
1090
- function ye(e) {
1098
+ function xe(e) {
1091
1099
  return {
1092
1100
  name: e.name,
1093
1101
  header: e.label || e.name
1094
1102
  };
1095
1103
  }
1096
- function be(e, t) {
1097
- return e == null ? "" : typeof e == "number" && t ? e.toLocaleString("en-US", xe(t)) : Ce(String(e));
1104
+ function Se(e, t) {
1105
+ return e == null ? "" : typeof e == "number" && t ? e.toLocaleString("en-US", Ce(t)) : Te(String(e));
1098
1106
  }
1099
- function xe(e) {
1107
+ function Ce(e) {
1100
1108
  if (e.includes("%")) return {
1101
1109
  style: "percent",
1102
1110
  minimumFractionDigits: 0
@@ -1107,23 +1115,23 @@ function xe(e) {
1107
1115
  maximumFractionDigits: Math.max(0, t - 1)
1108
1116
  };
1109
1117
  }
1110
- function Se(e) {
1118
+ function we(e) {
1111
1119
  let t = "", n = e;
1112
1120
  for (; n >= 0;) t = String.fromCharCode(n % 26 + 65) + t, n = Math.floor(n / 26) - 1;
1113
1121
  return t;
1114
1122
  }
1115
- function Ce(e) {
1123
+ function Te(e) {
1116
1124
  if (e.length > 0) {
1117
1125
  let t = e.charAt(0);
1118
1126
  if (t === "=" || t === "+" || t === "-" || t === "@" || t === "|") return `'${e}`;
1119
1127
  }
1120
1128
  return e;
1121
1129
  }
1122
- function we(e, t, n) {
1130
+ function Ee(e, t, n) {
1123
1131
  let r = new Blob([e], { type: `${n};charset=utf-8` }), i = URL.createObjectURL(r), a = document.createElement("a");
1124
1132
  a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
1125
1133
  }
1126
- e.register("report", Q, {
1134
+ e.register("report", $, {
1127
1135
  namespace: "report",
1128
1136
  label: "Report",
1129
1137
  category: "Report",
@@ -1144,7 +1152,7 @@ e.register("report", Q, {
1144
1152
  label: "Chart Configuration"
1145
1153
  }
1146
1154
  ]
1147
- }), e.register("spec-report", Q, {
1155
+ }), e.register("spec-report", $, {
1148
1156
  namespace: "report",
1149
1157
  label: "Spec Report",
1150
1158
  category: "Report",
@@ -1157,7 +1165,7 @@ e.register("report", Q, {
1157
1165
  type: "string",
1158
1166
  label: "Report Type"
1159
1167
  }]
1160
- }), e.register("report-viewer", V, {
1168
+ }), e.register("report-viewer", W, {
1161
1169
  namespace: "report",
1162
1170
  label: "Report Viewer",
1163
1171
  category: "Report",
@@ -1172,4 +1180,4 @@ e.register("report", Q, {
1172
1180
  }]
1173
1181
  });
1174
1182
  //#endregion
1175
- export { ge as DatasetReportRenderer, j as LegacyReportRenderer, Q as ReportRenderer, V as ReportViewer, ve as createScheduleTrigger, M as exportAsCSV, F as exportAsExcel, P as exportAsHTML, N as exportAsJSON, te as exportAsPDF, _e as exportExcelWithFormulas, I as exportReport, $ as exportWithLiveData, B as formatValue, H as isDatasetReport, a as mergeFilters };
1183
+ export { _e as DatasetReportRenderer, N as LegacyReportRenderer, $ as ReportRenderer, W as ReportViewer, be as createScheduleTrigger, P as exportAsCSV, L as exportAsExcel, F as exportAsHTML, te as exportAsJSON, I as exportAsPDF, ye as exportExcelWithFormulas, R as exportReport, ve as exportWithLiveData, U as formatValue, G as isDatasetReport, a as mergeFilters };