@object-ui/plugin-dashboard 17.1.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,22 +1,22 @@
1
- import { ComponentRegistry as e, DATE_RANGE_PRESETS as t, buildCategoryOrder as n, buildChartSeries as r, buildDatasetDrillFilter as i, buildDatasetFieldHelpers as a, buildDimensionLabelMap as o, buildOptionColorMap as s, buildWidgetScopedFilter as c, compareToTrendLabelKey as l, computeDrillFilter as u, dashboardFilterVariableDefs as d, extractRecords as f, findChartSeriesRow as p, formatDimensionValue as m, formatMeasure as h, isDrillEnabled as g, mergeFilters as _, relabelDimensions as v, resolveDashboardFilterDefs as y, resolveDrillTitle as b, resolveFilterPlaceholders as x, shiftFilterByCompareTo as S } from "@object-ui/core";
2
- import { PageVariablesProvider as C, SchemaRenderer as w, SchemaRendererContext as T, useActionEngine as E, useDataScope as ee, useDnd as D, useDrillNavigation as O, useFilterScope as te, useHasDndProvider as k, useObjectLabel as ne, usePageVariables as re } from "@object-ui/react";
3
- import { createSafeTranslation as A, resolveFieldCurrency as ie, useLocalization as j, useObjectTranslation as M, useSafeFieldLabel as ae, useSafeTranslate as N } from "@object-ui/i18n";
4
- import { Button as P, Calendar as oe, Card as se, CardContent as F, CardHeader as ce, CardTitle as I, ChartSkeleton as le, Combobox as ue, ConfigPanelRenderer as de, ConfigRow as L, DataEmptyState as R, Dialog as z, DialogContent as fe, DialogHeader as pe, DialogTitle as me, GridSkeleton as B, Input as he, Popover as ge, PopoverContent as V, PopoverTrigger as H, RefreshIndicator as U, Select as _e, SelectContent as ve, SelectItem as W, SelectTrigger as ye, SelectValue as be, Sheet as xe, SheetContent as Se, SheetHeader as Ce, SheetTitle as we, Skeleton as G, cn as K, getLazyIcon as Te, useConfigDraft as Ee } from "@object-ui/components";
1
+ import { ComponentRegistry as e, DATE_RANGE_PRESETS as t, buildCategoryOrder as n, buildChartSeries as r, buildDatasetDrillFilter as i, buildDatasetFieldHelpers as a, buildDimensionLabelMap as o, buildOptionColorMap as s, buildWidgetScopedFilter as c, compareToTrendLabelKey as l, computeDrillFilter as u, dashboardFilterVariableDefs as d, extractRecords as f, findChartSeriesRow as p, formatDimensionValue as m, formatMeasure as h, isDrillEnabled as g, mergeFilters as _, pivotBucketId as v, pivotCellKey as y, relabelDimensions as b, resolveDashboardFilterDefs as x, resolveDrillTitle as S, resolveFilterPlaceholders as C, shiftFilterByCompareTo as w } from "@object-ui/core";
2
+ import { PageVariablesProvider as T, SchemaRenderer as E, SchemaRendererContext as D, useActionEngine as O, useDataScope as k, useDnd as A, useDrillNavigation as j, useFilterScope as ee, useHasDndProvider as M, useObjectLabel as te, usePageVariables as ne } from "@object-ui/react";
3
+ import { createSafeTranslation as N, resolveFieldCurrency as P, useLocalization as F, useObjectTranslation as re, useSafeFieldLabel as ie, useSafeTranslate as I } from "@object-ui/i18n";
4
+ import { Button as L, Calendar as ae, Card as oe, CardContent as R, CardHeader as se, CardTitle as z, ChartSkeleton as ce, Combobox as le, ConfigPanelRenderer as ue, ConfigRow as B, DataEmptyState as V, Dialog as H, DialogContent as de, DialogHeader as fe, DialogTitle as pe, GridSkeleton as me, Input as he, Popover as U, PopoverContent as W, PopoverTrigger as ge, RefreshIndicator as _e, Select as ve, SelectContent as ye, SelectItem as be, SelectTrigger as xe, SelectValue as Se, Sheet as Ce, SheetContent as we, SheetHeader as Te, SheetTitle as Ee, Skeleton as G, cn as K, getLazyIcon as De, useConfigDraft as Oe } from "@object-ui/components";
5
5
  import * as q from "react";
6
- import De, { Fragment as Oe, forwardRef as ke, useCallback as J, useContext as Ae, useEffect as Y, useMemo as X, useRef as je, useState as Z } from "react";
7
- import { AlertCircle as Me, AlertTriangle as Ne, ArrowDownIcon as Pe, ArrowUpIcon as Fe, ArrowUpRight as Ie, BarChart3 as Le, CalendarIcon as Re, Download as ze, Edit as Be, GripVertical as Ve, Loader2 as He, MinusIcon as Ue, RefreshCw as We, RotateCcw as Ge, Save as Ke, Settings as qe, X as Je } from "lucide-react";
8
- import { DndContext as Ye, PointerSensor as Xe, closestCenter as Ze, useSensor as Qe, useSensors as $e } from "@dnd-kit/core";
9
- import { SortableContext as et, arrayMove as tt, rectSortingStrategy as nt, useSortable as rt, verticalListSortingStrategy as it } from "@dnd-kit/sortable";
10
- import { CSS as at } from "@dnd-kit/utilities";
11
- import { formatCurrency as ot, formatDate as st, formatPercent as ct, getCellRenderer as lt, resolveCellRendererType as ut } from "@object-ui/fields";
12
- import { Fragment as dt, jsx as Q, jsxs as $ } from "react/jsx-runtime";
13
- import { ResponsiveGridLayout as ft, useContainerWidth as pt } from "react-grid-layout";
6
+ import ke, { Fragment as Ae, forwardRef as je, useCallback as J, useContext as Me, useEffect as Y, useMemo as X, useRef as Ne, useState as Z } from "react";
7
+ import { AlertCircle as Pe, AlertTriangle as Fe, ArrowDownIcon as Ie, ArrowUpIcon as Le, ArrowUpRight as Re, BarChart3 as ze, CalendarIcon as Be, Download as Ve, Edit as He, GripVertical as Ue, Loader2 as We, MinusIcon as Ge, RefreshCw as Ke, RotateCcw as qe, Save as Je, Settings as Ye, X as Xe } from "lucide-react";
8
+ import { DndContext as Ze, PointerSensor as Qe, closestCenter as $e, useSensor as et, useSensors as tt } from "@dnd-kit/core";
9
+ import { SortableContext as nt, arrayMove as rt, rectSortingStrategy as it, useSortable as at, verticalListSortingStrategy as ot } from "@dnd-kit/sortable";
10
+ import { CSS as st } from "@dnd-kit/utilities";
11
+ import { formatCurrency as ct, formatDate as lt, formatPercent as ut, getCellRenderer as dt, resolveCellRendererType as ft } from "@object-ui/fields";
12
+ import { Fragment as pt, jsx as Q, jsxs as $ } from "react/jsx-runtime";
13
+ import { ResponsiveGridLayout as mt, useContainerWidth as ht } from "react-grid-layout";
14
14
  import "react-grid-layout/css/styles.css";
15
15
  //#region src/utils.ts
16
- function mt(e) {
16
+ function gt(e) {
17
17
  return typeof e == "object" && !!e && !Array.isArray(e) && e.provider === "object";
18
18
  }
19
- function ht(e, t) {
19
+ function _t(e, t) {
20
20
  if (t == null || e == null || typeof e != "number" || !Number.isFinite(e) || typeof t != "number" || !Number.isFinite(t)) return null;
21
21
  if (t === 0) return e === 0 ? {
22
22
  value: 0,
@@ -38,7 +38,7 @@ function ht(e, t) {
38
38
  }
39
39
  //#endregion
40
40
  //#region src/widgetDispatch.ts
41
- var gt = {
41
+ var vt = {
42
42
  column: "bar",
43
43
  "stacked-bar": "bar",
44
44
  "grouped-bar": "bar",
@@ -48,7 +48,7 @@ var gt = {
48
48
  "stacked-area": "area",
49
49
  pyramid: "funnel",
50
50
  bubble: "scatter"
51
- }, _t = /* @__PURE__ */ new Set([
51
+ }, yt = /* @__PURE__ */ new Set([
52
52
  "bar",
53
53
  "horizontal-bar",
54
54
  "line",
@@ -59,14 +59,15 @@ var gt = {
59
59
  "funnel",
60
60
  "radar",
61
61
  "treemap",
62
- "sankey"
63
- ]), vt = /* @__PURE__ */ new Set([
62
+ "sankey",
63
+ "combo"
64
+ ]), bt = /* @__PURE__ */ new Set([
64
65
  "metric",
65
66
  "gauge",
66
67
  "solid-gauge",
67
68
  "kpi",
68
69
  "bullet"
69
- ]), yt = /* @__PURE__ */ new Set(["table", "list"]), bt = /* @__PURE__ */ new Set([
70
+ ]), xt = /* @__PURE__ */ new Set(["table", "list"]), St = /* @__PURE__ */ new Set([
70
71
  "sunburst",
71
72
  "word-cloud",
72
73
  "choropleth",
@@ -79,17 +80,17 @@ var gt = {
79
80
  "candlestick",
80
81
  "stock"
81
82
  ]);
82
- function xt(e) {
83
+ function Ct(e) {
83
84
  if (!e) return { family: "passthrough" };
84
- let t = gt[e] ?? e;
85
- return _t.has(t) ? {
85
+ let t = vt[e] ?? e;
86
+ return yt.has(t) ? {
86
87
  family: "series",
87
88
  chartType: t
88
- } : vt.has(e) ? { family: "metric" } : yt.has(e) ? { family: "table" } : e === "pivot" ? { family: "pivot" } : e === "custom" ? { family: "custom" } : bt.has(e) ? { family: "unsupported" } : { family: "passthrough" };
89
+ } : bt.has(e) ? { family: "metric" } : xt.has(e) ? { family: "table" } : e === "pivot" ? { family: "pivot" } : e === "custom" ? { family: "custom" } : St.has(e) ? { family: "unsupported" } : { family: "passthrough" };
89
90
  }
90
91
  //#endregion
91
92
  //#region src/recordFields.tsx
92
- var St = /* @__PURE__ */ new Set([
93
+ var wt = /* @__PURE__ */ new Set([
93
94
  "id",
94
95
  "organization_id",
95
96
  "tenant_id",
@@ -103,15 +104,15 @@ var St = /* @__PURE__ */ new Set([
103
104
  "_id",
104
105
  "__typename"
105
106
  ]);
106
- function Ct(e, t) {
107
- return t && (t.isSystem === !0 || t.system === !0) ? !0 : St.has(e);
107
+ function Tt(e, t) {
108
+ return t && (t.isSystem === !0 || t.system === !0) ? !0 : wt.has(e);
108
109
  }
109
- var wt = /* @__PURE__ */ new Set([
110
+ var Et = /* @__PURE__ */ new Set([
110
111
  "select",
111
112
  "picklist",
112
113
  "dropdown",
113
114
  "status"
114
- ]), Tt = /* @__PURE__ */ new Set([
115
+ ]), Dt = /* @__PURE__ */ new Set([
115
116
  "currency",
116
117
  "money",
117
118
  "number",
@@ -121,7 +122,7 @@ var wt = /* @__PURE__ */ new Set([
121
122
  "percent",
122
123
  "percentage"
123
124
  ]);
124
- function Et(e) {
125
+ function Ot(e) {
125
126
  let t = {}, n = e?.fields;
126
127
  if (!n) return t;
127
128
  if (Array.isArray(n)) for (let e of n) e?.name && (t[e.name] = e);
@@ -131,9 +132,9 @@ function Et(e) {
131
132
  };
132
133
  return t;
133
134
  }
134
- function Dt(e) {
135
+ function kt(e) {
135
136
  let { accessorKey: t, label: n, def: r, objectName: i, fieldOptionLabel: a, overrides: o = {} } = e, s = o.referenceTo ?? r?.referenceTo ?? (typeof r?.reference == "string" ? r.reference : r?.reference?.to) ?? r?.target, c = o.options ?? r?.options;
136
- return i && c && a && wt.has(r?.type) && (c = c.map((e) => {
137
+ return i && c && a && Et.has(r?.type) && (c = c.map((e) => {
137
138
  if (e == null) return e;
138
139
  let n = typeof e == "object" ? e.value : e, r = typeof e == "object" && e.label || String(n);
139
140
  return {
@@ -152,10 +153,10 @@ function Dt(e) {
152
153
  decimals: o.decimals ?? r?.decimals ?? r?.scale
153
154
  };
154
155
  }
155
- function Ot(e) {
156
- return Tt.has(e.type) || typeof e.format == "string" && /^[$¥€£]|%$|0/.test(e.format);
156
+ function At(e) {
157
+ return Dt.has(e.type) || typeof e.format == "string" && /^[$¥€£]|%$|0/.test(e.format);
157
158
  }
158
- function kt(e, t, n) {
159
+ function jt(e, t, n) {
159
160
  if (e == null || e === "") return "";
160
161
  let r = t.format;
161
162
  if (typeof r == "string" && /^\$|¥|€|£/.test(r) && typeof e == "number") {
@@ -165,20 +166,22 @@ function kt(e, t, n) {
165
166
  "€": "EUR",
166
167
  "£": "GBP"
167
168
  }[r[0]];
168
- return ot(e, t.currency || i || n);
169
+ return ct(e, t.currency || i || n);
169
170
  }
170
171
  if (typeof r == "string" && /%/.test(r) && typeof e == "number") {
171
- let t = (r.match(/0\.(0+)%/) || [void 0, ""])[1].length;
172
- return ct((e > 1 ? e / 100 : e) * 100, t);
172
+ let t = (r.match(/0\.(0+)%/) || [void 0, ""])[1].length, n = e > 1 ? e / 100 : e;
173
+ return ut(n * 100, t);
173
174
  }
174
- return typeof r == "string" && /[YMDHms]/.test(r) ? st(e, r) : /* @__PURE__ */ Q(lt(ut(t)), {
175
+ if (typeof r == "string" && /[YMDHms]/.test(r)) return lt(e, r);
176
+ let i = dt(ft(t));
177
+ return /* @__PURE__ */ Q(i, {
175
178
  value: e,
176
179
  field: t
177
180
  });
178
181
  }
179
182
  //#endregion
180
183
  //#region src/RecordDetailDrawer.tsx
181
- var At = [
184
+ var Mt = [
182
185
  "name",
183
186
  "title",
184
187
  "label",
@@ -186,21 +189,21 @@ var At = [
186
189
  "display_name",
187
190
  "full_name"
188
191
  ];
189
- function jt(e, t) {
192
+ function Nt(e, t) {
190
193
  if (t && t.trim()) return t;
191
- for (let t of At) {
194
+ for (let t of Mt) {
192
195
  let n = e[t];
193
196
  if (typeof n == "string" && n.trim()) return n;
194
197
  }
195
198
  let n = e.id ?? e._id;
196
199
  return n == null ? "Record" : String(n);
197
200
  }
198
- var Mt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
199
- let { fieldLabel: s, fieldOptionLabel: c } = ae(), { currency: l } = j(), u = X(() => {
201
+ var Pt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, target: a = "drawer", onClose: o }) => {
202
+ let { fieldLabel: s, fieldOptionLabel: c } = ie(), { currency: l } = F(), u = X(() => {
200
203
  if (!e) return [];
201
- let i = Et(n), a;
202
- return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !Ct(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !Ct(e)), a.map((n) => {
203
- let r = i[n], a = n.charAt(0).toUpperCase() + n.slice(1).replace(/([A-Z])/g, " $1").replace(/_/g, " "), o = t ? s(t, n, a) : a, u = Dt({
204
+ let i = Ot(n), a;
205
+ return a = r && r.length > 0 ? r : Object.keys(i).length > 0 ? Object.keys(i).filter((e) => !Tt(e, i[e])) : Object.keys(e).filter((e) => !e.startsWith("_") && !Tt(e)), a.map((n) => {
206
+ let r = i[n], a = n.charAt(0).toUpperCase() + n.slice(1).replace(/([A-Z])/g, " $1").replace(/_/g, " "), o = t ? s(t, n, a) : a, u = kt({
204
207
  accessorKey: n,
205
208
  label: o,
206
209
  def: r,
@@ -210,8 +213,8 @@ var Mt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
210
213
  return {
211
214
  key: n,
212
215
  label: o,
213
- node: kt(e[n], u, l),
214
- numeric: Ot(u)
216
+ node: jt(e[n], u, l),
217
+ numeric: At(u)
215
218
  };
216
219
  });
217
220
  }, [
@@ -224,7 +227,7 @@ var Mt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
224
227
  l
225
228
  ]);
226
229
  if (!e) return null;
227
- let d = jt(e, i), f = /* @__PURE__ */ Q("dl", {
230
+ let d = Nt(e, i), f = /* @__PURE__ */ Q("dl", {
228
231
  className: "divide-y divide-border/60",
229
232
  "data-testid": "record-detail-body",
230
233
  children: u.map((e) => /* @__PURE__ */ $("div", {
@@ -241,23 +244,23 @@ var Mt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
241
244
  })]
242
245
  }, e.key))
243
246
  });
244
- return a === "dialog" ? /* @__PURE__ */ Q(z, {
247
+ return a === "dialog" ? /* @__PURE__ */ Q(H, {
245
248
  open: !0,
246
249
  onOpenChange: (e) => !e && o(),
247
- children: /* @__PURE__ */ $(fe, {
250
+ children: /* @__PURE__ */ $(de, {
248
251
  className: "max-w-2xl",
249
- children: [/* @__PURE__ */ Q(pe, { children: /* @__PURE__ */ Q(me, { children: d }) }), /* @__PURE__ */ Q("div", {
252
+ children: [/* @__PURE__ */ Q(fe, { children: /* @__PURE__ */ Q(pe, { children: d }) }), /* @__PURE__ */ Q("div", {
250
253
  className: "max-h-[70vh] overflow-auto",
251
254
  children: f
252
255
  })]
253
256
  })
254
- }) : /* @__PURE__ */ Q(xe, {
257
+ }) : /* @__PURE__ */ Q(Ce, {
255
258
  open: !0,
256
259
  onOpenChange: (e) => !e && o(),
257
- children: /* @__PURE__ */ $(Se, {
260
+ children: /* @__PURE__ */ $(we, {
258
261
  side: "right",
259
262
  className: "w-full sm:max-w-md md:max-w-lg flex flex-col",
260
- children: [/* @__PURE__ */ Q(Ce, { children: /* @__PURE__ */ Q(we, { children: d }) }), /* @__PURE__ */ Q("div", {
263
+ children: [/* @__PURE__ */ Q(Te, { children: /* @__PURE__ */ Q(Ee, { children: d }) }), /* @__PURE__ */ Q("div", {
261
264
  className: "flex-1 overflow-auto mt-2 pr-1",
262
265
  children: f
263
266
  })]
@@ -266,13 +269,13 @@ var Mt = ({ record: e, objectName: t, objectSchema: n, fields: r, title: i, targ
266
269
  };
267
270
  //#endregion
268
271
  //#region src/ObjectDataTable.tsx
269
- function Nt(e) {
272
+ function Ft(e) {
270
273
  return e.map((e) => typeof e == "string" ? {
271
274
  header: e.replace(/_/g, " ").replace(/([A-Z])/g, " $1").trim().replace(/\b\w/g, (e) => e.toUpperCase()),
272
275
  accessorKey: e
273
276
  } : e);
274
277
  }
275
- function Pt(e, t) {
278
+ function It(e, t) {
276
279
  if (!t?.fields) return [];
277
280
  let n = {};
278
281
  if (Array.isArray(t.fields)) for (let e of t.fields) e?.name && (n[e.name] = e);
@@ -290,35 +293,37 @@ function Pt(e, t) {
290
293
  } else for (let [e, t] of Object.entries(n)) r(t?.type) && a.add(e);
291
294
  return Array.from(a);
292
295
  }
293
- var Ft = ({ schema: e, dataSource: t, className: n }) => {
294
- let { currency: r } = j(), i = Ae(T), a = t || i?.dataSource, o = ee(e.bind), { fieldLabel: s, fieldOptionLabel: c } = ae(), l = "No data available", u = "No data source available for", { t: d } = M(), p = d("dashboard.noDataAvailable");
296
+ var Lt = ({ schema: e, dataSource: t, className: n }) => {
297
+ let { currency: r } = F(), i = Me(D), a = t || i?.dataSource, o = k(e.bind), { fieldLabel: s, fieldOptionLabel: c } = ie(), l = "No data available", u = "No data source available for", { t: d } = re(), p = d("dashboard.noDataAvailable");
295
298
  p && p !== "dashboard.noDataAvailable" && (l = p);
296
299
  let m = d("dashboard.noDataSourceFor");
297
300
  m && m !== "dashboard.noDataSourceFor" && (u = m);
298
- let [h, _] = Z([]), [v, y] = Z(null), [b, S] = Z(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [C, E] = Z(null), D = e.drillDown, O = g(D) && (D?.mode ?? "record") === "record", [k, ne] = Z(null), re = J((e) => {
299
- ne(e ?? null);
300
- }, []), A = te();
301
+ let [h, _] = Z([]), [v, y] = Z(null), [b, x] = Z(() => !(Array.isArray(e.data) && e.data.length > 0) && !!e.objectName), [S, w] = Z(null), T = e.drillDown, O = g(T) && (T?.mode ?? "record") === "record", [A, j] = Z(null), M = J((e) => {
302
+ j(e ?? null);
303
+ }, []), te = ee();
301
304
  Y(() => {
302
305
  let t = !0;
303
306
  return e.objectName && !o && (!e.data || e.data.length === 0) ? (async () => {
304
307
  if (!a || !e.objectName) {
305
- t && S(!1);
308
+ t && x(!1);
306
309
  return;
307
310
  }
308
- t && (S(!0), E(null));
311
+ t && (x(!0), w(null));
309
312
  try {
310
313
  let n;
311
314
  if (typeof a.find == "function") {
312
- let t = Pt(e, v), r = { $filter: x(e.filter, A) };
313
- t.length && (r.$expand = t), n = f(await a.find(e.objectName, r));
315
+ let t = It(e, v), r = { $filter: C(e.filter, te) };
316
+ t.length && (r.$expand = t);
317
+ let i = await a.find(e.objectName, r);
318
+ n = f(i);
314
319
  } else return;
315
320
  t && _(n);
316
321
  } catch (e) {
317
- console.error("[ObjectDataTable] Fetch error:", e), t && E(e instanceof Error ? e.message : "Failed to load data");
322
+ console.error("[ObjectDataTable] Fetch error:", e), t && w(e instanceof Error ? e.message : "Failed to load data");
318
323
  } finally {
319
- t && S(!1);
324
+ t && x(!1);
320
325
  }
321
- })() : t && S(!1), () => {
326
+ })() : t && x(!1), () => {
322
327
  t = !1;
323
328
  };
324
329
  }, [
@@ -328,7 +333,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
328
333
  e.data,
329
334
  e.filter,
330
335
  v,
331
- A
336
+ te
332
337
  ]), Y(() => {
333
338
  let t = !0;
334
339
  if (!(!a || !e.objectName || typeof a.getObjectSchema != "function")) return a.getObjectSchema(e.objectName).then((e) => {
@@ -337,7 +342,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
337
342
  t = !1;
338
343
  };
339
344
  }, [e.objectName, a]);
340
- let ie = o || e.data || h, N = Array.isArray(ie) ? ie : [], P = X(() => {
345
+ let ne = o || e.data || h, N = Array.isArray(ne) ? ne : [], P = X(() => {
341
346
  let t = e.objectName, n = {};
342
347
  if (v?.fields) {
343
348
  let e = v.fields;
@@ -351,7 +356,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
351
356
  let n = e.charAt(0).toUpperCase() + e.slice(1).replace(/([A-Z])/g, " $1");
352
357
  return t ? s(t, e, n) : n;
353
358
  }, a = (e) => {
354
- let i = Dt({
359
+ let i = kt({
355
360
  accessorKey: e.accessorKey,
356
361
  label: e.header,
357
362
  def: n[e.accessorKey],
@@ -365,13 +370,13 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
365
370
  currency: e.currency,
366
371
  decimals: e.decimals
367
372
  }
368
- }), a = e.align ?? (Ot(i) ? "right" : void 0);
373
+ }), a = e.align ?? (At(i) ? "right" : void 0);
369
374
  if (typeof e.cell == "function") return {
370
375
  ...e,
371
376
  ...i,
372
377
  align: a
373
378
  };
374
- let o = (e) => kt(e, i, r);
379
+ let o = (e) => jt(e, i, r);
375
380
  return {
376
381
  ...e,
377
382
  ...i,
@@ -380,13 +385,13 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
380
385
  };
381
386
  };
382
387
  if (e.columns && e.columns.length > 0) {
383
- let n = Nt(e.columns);
388
+ let n = Ft(e.columns);
384
389
  return (t ? n.map((e) => ({
385
390
  ...e,
386
391
  header: s(t, e.accessorKey, e.header)
387
392
  })) : n).map(a);
388
393
  }
389
- return N.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !Ct(e, n[e])) : Object.keys(N[0]).filter((e) => !e.startsWith("_") && !Ct(e))).map((e) => a({
394
+ return N.length === 0 ? [] : (Object.keys(n).length > 0 ? Object.keys(n).filter((e) => !Tt(e, n[e])) : Object.keys(N[0]).filter((e) => !e.startsWith("_") && !Tt(e))).map((e) => a({
390
395
  header: i(e),
391
396
  accessorKey: e
392
397
  }));
@@ -428,7 +433,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
428
433
  }, e))]
429
434
  })
430
435
  });
431
- if (C) return /* @__PURE__ */ Q("div", {
436
+ if (S) return /* @__PURE__ */ Q("div", {
432
437
  className: K("overflow-auto", n),
433
438
  "data-testid": "table-error",
434
439
  children: /* @__PURE__ */ $("div", {
@@ -464,7 +469,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
464
469
  ]
465
470
  }), /* @__PURE__ */ Q("p", {
466
471
  className: "text-xs",
467
- children: C
472
+ children: S
468
473
  })]
469
474
  })
470
475
  });
@@ -525,35 +530,35 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
525
530
  })]
526
531
  })
527
532
  });
528
- let oe = {
533
+ let I = {
529
534
  ...e,
530
535
  type: "data-table",
531
536
  data: N,
532
537
  columns: P,
533
- onRowClick: e.onRowClick ?? (O ? re : void 0)
534
- }, se = D?.title && !D.title.includes("${") ? D.title : void 0;
538
+ onRowClick: e.onRowClick ?? (O ? M : void 0)
539
+ }, L = T?.title && !T.title.includes("${") ? T.title : void 0;
535
540
  return /* @__PURE__ */ $("div", {
536
541
  className: K("relative", n),
537
542
  children: [
538
- /* @__PURE__ */ Q(U, { active: b && N.length > 0 }),
539
- /* @__PURE__ */ Q(w, {
540
- schema: oe,
543
+ /* @__PURE__ */ Q(_e, { active: b && N.length > 0 }),
544
+ /* @__PURE__ */ Q(E, {
545
+ schema: I,
541
546
  className: n
542
547
  }),
543
- O && /* @__PURE__ */ Q(Mt, {
544
- record: k,
548
+ O && /* @__PURE__ */ Q(Pt, {
549
+ record: A,
545
550
  objectName: e.objectName,
546
551
  objectSchema: v,
547
- fields: D?.columns,
548
- title: se,
549
- target: D?.target === "dialog" ? "dialog" : "drawer",
550
- onClose: () => ne(null)
552
+ fields: T?.columns,
553
+ title: L,
554
+ target: T?.target === "dialog" ? "dialog" : "drawer",
555
+ onClose: () => j(null)
551
556
  })
552
557
  ]
553
558
  });
554
- }, It = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
555
- let { openRecordList: i } = O(), a = N();
556
- return !i || !e ? null : /* @__PURE__ */ $(P, {
559
+ }, Rt = ({ objectName: e, filter: t, onNavigate: n, className: r }) => {
560
+ let { openRecordList: i } = j(), a = I();
561
+ return !i || !e ? null : /* @__PURE__ */ $(L, {
557
562
  type: "button",
558
563
  variant: "ghost",
559
564
  size: "sm",
@@ -562,14 +567,14 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
562
567
  onClick: () => {
563
568
  i(e, t), n?.();
564
569
  },
565
- children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Q(Ie, { className: "ml-1 h-3.5 w-3.5" })]
570
+ children: [a("dashboard.openInList", "Open in list"), /* @__PURE__ */ Q(Re, { className: "ml-1 h-3.5 w-3.5" })]
566
571
  });
567
- }, Lt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l, report: u }) => {
568
- let { openRecordList: d } = O(), f = u && typeof u == "object" && (Array.isArray(u.columns) || "objectName" in u), p = r === "navigate" && !!d && !f && !!i;
569
- if (De.useEffect(() => {
572
+ }, zt = ({ open: e, onClose: t, title: n, target: r = "drawer", objectName: i, filter: a, dataSource: o, columns: s, maxRows: c, className: l, report: u }) => {
573
+ let { openRecordList: d } = j(), f = u && typeof u == "object" && (Array.isArray(u.columns) || "objectName" in u), p = r === "navigate" && !!d && !f && !!i;
574
+ if (ke.useEffect(() => {
570
575
  e && p && (d(i, a), t());
571
576
  }, [e, p]), p) return null;
572
- let m = f ? null : /* @__PURE__ */ Q(It, {
577
+ let m = f ? null : /* @__PURE__ */ Q(Rt, {
573
578
  objectName: i,
574
579
  filter: a,
575
580
  onNavigate: t
@@ -577,8 +582,7 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
577
582
  className: K("overflow-auto", l),
578
583
  "data-testid": "drill-down-body",
579
584
  children: f ? (() => {
580
- let e = u.filter, t = e ? a ? { $and: [e, a] } : e : a;
581
- return /* @__PURE__ */ Q(w, { schema: {
585
+ let e = u.filter, t = e ? a ? { $and: [e, a] } : e : a, n = {
582
586
  ...u,
583
587
  type: "spec-report",
584
588
  report: {
@@ -586,8 +590,9 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
586
590
  filter: t
587
591
  },
588
592
  filter: t
589
- } });
590
- })() : /* @__PURE__ */ Q(Ft, {
593
+ };
594
+ return /* @__PURE__ */ Q(E, { schema: n });
595
+ })() : /* @__PURE__ */ Q(Lt, {
591
596
  schema: {
592
597
  type: "object-data-table",
593
598
  objectName: i,
@@ -608,69 +613,69 @@ var Ft = ({ schema: e, dataSource: t, className: n }) => {
608
613
  dataSource: o
609
614
  })
610
615
  });
611
- return r === "dialog" ? /* @__PURE__ */ Q(z, {
616
+ return r === "dialog" ? /* @__PURE__ */ Q(H, {
612
617
  open: e,
613
618
  onOpenChange: (e) => !e && t(),
614
- children: /* @__PURE__ */ $(fe, {
619
+ children: /* @__PURE__ */ $(de, {
615
620
  className: "max-w-5xl",
616
- children: [/* @__PURE__ */ $(pe, {
621
+ children: [/* @__PURE__ */ $(fe, {
617
622
  className: "flex-row items-center justify-between gap-4 pr-8",
618
- children: [/* @__PURE__ */ Q(me, { children: n }), m]
623
+ children: [/* @__PURE__ */ Q(pe, { children: n }), m]
619
624
  }), h]
620
625
  })
621
- }) : /* @__PURE__ */ Q(xe, {
626
+ }) : /* @__PURE__ */ Q(Ce, {
622
627
  open: e,
623
628
  onOpenChange: (e) => !e && t(),
624
- children: /* @__PURE__ */ $(Se, {
629
+ children: /* @__PURE__ */ $(we, {
625
630
  side: "right",
626
631
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
627
- children: [/* @__PURE__ */ $(Ce, {
632
+ children: [/* @__PURE__ */ $(Te, {
628
633
  className: "flex-row items-center justify-between gap-4 pr-8",
629
- children: [/* @__PURE__ */ Q(we, { children: n }), m]
634
+ children: [/* @__PURE__ */ Q(Ee, { children: n }), m]
630
635
  }), /* @__PURE__ */ Q("div", {
631
636
  className: "flex-1 overflow-hidden mt-2",
632
637
  children: h
633
638
  })]
634
639
  })
635
640
  });
636
- }, Rt = i;
637
- function zt(e, t, n) {
641
+ }, Bt = i;
642
+ function Vt(e, t, n) {
638
643
  let r = [], i = [], a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
639
644
  return e.forEach((e, c) => {
640
- let l = t.map((t) => String(e[t] ?? "∅")).join(""), u = String(e[n] ?? "∅");
645
+ let l = v(t.map((t) => String(e[t] ?? "∅"))), u = String(e[n] ?? "∅");
641
646
  a.has(l) || (a.add(l), r.push({
642
647
  id: l,
643
648
  labels: t.map((t) => m(e[t]))
644
649
  })), o.has(u) || (o.add(u), i.push({
645
650
  id: u,
646
651
  label: m(e[n])
647
- })), s.set(`${l} ${u}`, c);
652
+ })), s.set(y(l, u), c);
648
653
  }), {
649
654
  rowHeaders: r,
650
655
  colHeaders: i,
651
656
  cellIndex: s
652
657
  };
653
658
  }
654
- function Bt(e) {
659
+ function Ht(e) {
655
660
  if (e == null) return "";
656
661
  let t = String(e);
657
662
  return /[",\n\r]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
658
663
  }
659
- function Vt(e) {
660
- return e.map((e) => e.map(Bt).join(",")).join("\r\n");
664
+ function Ut(e) {
665
+ return e.map((e) => e.map(Ht).join(",")).join("\r\n");
661
666
  }
662
- function Ht(e, t) {
667
+ function Wt(e, t) {
663
668
  if (typeof document > "u") return;
664
- let n = e && e.trim() ? e.trim() : "export", r = new Blob([`\uFEFF${Vt(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
669
+ let n = e && e.trim() ? e.trim() : "export", r = new Blob([`\uFEFF${Ut(t)}`], { type: "text/csv;charset=utf-8;" }), i = URL.createObjectURL(r), a = document.createElement("a");
665
670
  a.href = i, a.download = n.endsWith(".csv") ? n : `${n}.csv`, document.body.appendChild(a), a.click(), a.remove(), URL.revokeObjectURL(i);
666
671
  }
667
- var Ut = /* @__PURE__ */ new Set([
672
+ var Gt = /* @__PURE__ */ new Set([
668
673
  "metric",
669
674
  "kpi",
670
675
  "gauge",
671
676
  "solid-gauge",
672
677
  "bullet"
673
- ]), Wt = {
678
+ ]), Kt = {
674
679
  bar: "bar",
675
680
  column: "column",
676
681
  "horizontal-bar": "horizontal-bar",
@@ -692,47 +697,47 @@ var Ut = /* @__PURE__ */ new Set([
692
697
  treemap: "treemap",
693
698
  sankey: "sankey"
694
699
  };
695
- function Gt({ widget: e, dataSource: t }) {
696
- let i = String(e?.dataset ?? ""), c = X(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), l = X(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), u = e?.compareTo && typeof e.compareTo == "object" ? e.compareTo : void 0, d = String(e?.type ?? ""), f = Ut.has(d) || c.length === 0, g = d === "table" || d === "pivot", _ = d === "pivot" && c.length >= 2, y = _ ? c.slice(0, -1) : [], b = _ ? c[c.length - 1] : "", S = _ ? [
697
- y,
698
- [b],
700
+ function qt({ widget: e, dataSource: t }) {
701
+ let i = String(e?.dataset ?? ""), c = X(() => Array.isArray(e?.dimensions) ? e.dimensions.filter(Boolean) : [], [e]), l = X(() => Array.isArray(e?.values) ? e.values.filter(Boolean) : [], [e]), u = e?.compareTo && typeof e.compareTo == "object" ? e.compareTo : void 0, d = String(e?.type ?? ""), f = Gt.has(d) || c.length === 0, g = d === "table" || d === "pivot", _ = d === "pivot" && c.length >= 2, x = _ ? c.slice(0, -1) : [], S = _ ? c[c.length - 1] : "", w = _ ? [
702
+ x,
703
+ [S],
699
704
  []
700
- ] : void 0, C = e?.options && typeof e.options == "object" && !Array.isArray(e.options) ? e.options : {}, T = typeof C.dateGranularity == "string" ? C.dateGranularity : void 0, E = typeof C.sortBy == "string" && C.sortBy ? C.sortBy : void 0, ee = E && (c.includes(E) || l.includes(E)) ? E : void 0, D = ee ? { [ee]: C.sortOrder === "desc" ? "desc" : "asc" } : void 0, O = typeof C.limit == "number" && Number.isFinite(C.limit) && C.limit > 0 ? Math.floor(C.limit) : void 0, k = N(), { fieldLabel: ne } = ae(), re = te(), A = e?.filter, ie = X(() => A && typeof A == "object" && Object.keys(A).length > 0 ? x(A, re) : void 0, [A, re]), [j, M] = Z({
705
+ ] : void 0, T = e?.options && typeof e.options == "object" && !Array.isArray(e.options) ? e.options : {}, D = typeof T.dateGranularity == "string" ? T.dateGranularity : void 0, O = typeof T.sortBy == "string" && T.sortBy ? T.sortBy : void 0, k = O && (c.includes(O) || l.includes(O)) ? O : void 0, A = k ? { [k]: T.sortOrder === "desc" ? "desc" : "asc" } : void 0, j = typeof T.limit == "number" && Number.isFinite(T.limit) && T.limit > 0 ? Math.floor(T.limit) : void 0, M = I(), { fieldLabel: te } = ie(), ne = ee(), N = e?.filter, P = X(() => N && typeof N == "object" && Object.keys(N).length > 0 ? C(N, ne) : void 0, [N, ne]), [F, re] = Z({
701
706
  status: "idle",
702
707
  rows: []
703
- }), [P, oe] = Z(null), [se, F] = Z(null), [ce, I] = Z(null), [ue, de] = Z(null);
708
+ }), [L, ae] = Z(null), [oe, R] = Z(null), [se, z] = Z(null), [le, ue] = Z(null), B = `${d}|${i}|${c.join(",")}|${l.join(",")}|${JSON.stringify(N ?? null)}|${JSON.stringify(u ?? null)}|${D ?? ""}|${JSON.stringify(A ?? null)}|${j ?? ""}`;
704
709
  if (Y(() => {
705
710
  let e = t;
706
711
  if (!e || typeof e.queryDataset != "function") {
707
- M({
712
+ re({
708
713
  status: "error",
709
714
  rows: [],
710
- error: k("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
715
+ error: M("dashboard.datasetUnsupported", "This data source does not support dataset queries.")
711
716
  });
712
717
  return;
713
718
  }
714
719
  if (l.length === 0) {
715
- M({
720
+ re({
716
721
  status: "idle",
717
722
  rows: []
718
723
  });
719
724
  return;
720
725
  }
721
726
  let n = !1;
722
- return M({
727
+ return re({
723
728
  status: "loading",
724
729
  rows: []
725
730
  }), e.queryDataset(i, {
726
731
  dimensions: c,
727
732
  measures: l,
728
- ...ie ? { runtimeFilter: ie } : {},
733
+ ...P ? { runtimeFilter: P } : {},
729
734
  ...u ? { compareTo: u } : {},
730
- ...S ? { totals: { groupings: S } } : {},
731
- ...T ? { dateGranularity: T } : {},
732
- ...D ? { order: D } : {},
733
- ...O == null ? {} : { limit: O }
735
+ ...w ? { totals: { groupings: w } } : {},
736
+ ...D ? { dateGranularity: D } : {},
737
+ ...A ? { order: A } : {},
738
+ ...j == null ? {} : { limit: j }
734
739
  }).then((e) => {
735
- n || M({
740
+ n || re({
736
741
  status: "ok",
737
742
  rows: Array.isArray(e?.rows) ? e.rows : [],
738
743
  fields: Array.isArray(e?.fields) ? e.fields : [],
@@ -743,7 +748,7 @@ function Gt({ widget: e, dataSource: t }) {
743
748
  totals: Array.isArray(e?.totals) ? e.totals : void 0
744
749
  });
745
750
  }).catch((e) => {
746
- n || M({
751
+ n || re({
747
752
  status: "error",
748
753
  rows: [],
749
754
  error: String(e?.message ?? e)
@@ -751,17 +756,17 @@ function Gt({ widget: e, dataSource: t }) {
751
756
  }), () => {
752
757
  n = !0;
753
758
  };
754
- }, [`${d}|${i}|${c.join(",")}|${l.join(",")}|${JSON.stringify(A ?? null)}|${JSON.stringify(u ?? null)}|${T ?? ""}|${JSON.stringify(D ?? null)}|${O ?? ""}`]), Y(() => {
759
+ }, [B]), Y(() => {
755
760
  if (f || g) {
756
- F(null), I(null), de(null);
761
+ R(null), z(null), ue(null);
757
762
  return;
758
763
  }
759
- let e = j.object;
764
+ let e = F.object;
760
765
  if (!e || c.length === 0) {
761
- F(null), I(null), de(null);
766
+ R(null), z(null), ue(null);
762
767
  return;
763
768
  }
764
- let t = (e) => j.dimensionFields && j.dimensionFields[e] || e, r = !1;
769
+ let t = (e) => F.dimensionFields && F.dimensionFields[e] || e, r = !1;
765
770
  return (async () => {
766
771
  try {
767
772
  let i = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(e)}`, {
@@ -772,24 +777,24 @@ function Gt({ widget: e, dataSource: t }) {
772
777
  let n = o(a?.fields?.[t(e)]?.options);
773
778
  n && (d[e] = n);
774
779
  }
775
- r || (F(u), I(Object.keys(d).length > 0 ? d : null), de(n(l)));
780
+ r || (R(u), z(Object.keys(d).length > 0 ? d : null), ue(n(l)));
776
781
  } catch {
777
- r || (F(null), I(null), de(null));
782
+ r || (R(null), z(null), ue(null));
778
783
  }
779
784
  })(), () => {
780
785
  r = !0;
781
786
  };
782
787
  }, [
783
- j.object,
784
- j.dimensionFields,
788
+ F.object,
789
+ F.dimensionFields,
785
790
  c,
786
791
  f,
787
792
  g
788
793
  ]), l.length === 0) return /* @__PURE__ */ Q("div", {
789
794
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
790
- children: k("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
795
+ children: M("dashboard.pickMeasures", "Pick measures (values) for this dataset widget.")
791
796
  });
792
- if (j.status === "loading" || j.status === "idle") return /* @__PURE__ */ $("div", {
797
+ if (F.status === "loading" || F.status === "idle") return /* @__PURE__ */ $("div", {
793
798
  className: "h-full w-full p-2",
794
799
  "data-testid": "dataset-loading",
795
800
  role: "status",
@@ -797,79 +802,79 @@ function Gt({ widget: e, dataSource: t }) {
797
802
  "aria-live": "polite",
798
803
  children: [/* @__PURE__ */ Q("span", {
799
804
  className: "sr-only",
800
- children: k("dashboard.loading", "Loading…")
805
+ children: M("dashboard.loading", "Loading…")
801
806
  }), f ? /* @__PURE__ */ $("div", {
802
807
  className: "flex h-full w-full flex-col items-start justify-center gap-2 p-2",
803
808
  children: [/* @__PURE__ */ Q(G, { className: "h-8 w-32 rounded" }), /* @__PURE__ */ Q(G, { className: "h-3 w-20 rounded" })]
804
- }) : g ? /* @__PURE__ */ Q(B, {
809
+ }) : g ? /* @__PURE__ */ Q(me, {
805
810
  className: "h-full",
806
811
  rows: 5,
807
812
  columns: Math.max(2, c.length + l.length)
808
- }) : /* @__PURE__ */ Q(le, { className: "h-full" })]
813
+ }) : /* @__PURE__ */ Q(ce, { className: "h-full" })]
809
814
  });
810
- if (j.status === "error") return /* @__PURE__ */ $("div", {
815
+ if (F.status === "error") return /* @__PURE__ */ $("div", {
811
816
  role: "alert",
812
817
  className: "flex h-full w-full items-start gap-2 rounded border border-destructive/40 bg-destructive/5 p-3 text-xs text-destructive",
813
- children: [/* @__PURE__ */ Q(Ne, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Q("span", {
818
+ children: [/* @__PURE__ */ Q(Fe, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), /* @__PURE__ */ Q("span", {
814
819
  className: "break-words",
815
- children: j.error
820
+ children: F.error
816
821
  })]
817
822
  });
818
- if (j.rows.length === 0 && !f) return /* @__PURE__ */ $("div", {
823
+ if (F.rows.length === 0 && !f) return /* @__PURE__ */ $("div", {
819
824
  className: "flex h-full w-full items-center justify-center rounded border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground",
820
- children: [/* @__PURE__ */ Q(Le, { className: "mr-2 h-4 w-4" }), k("dashboard.noRows", "No rows")]
825
+ children: [/* @__PURE__ */ Q(ze, { className: "mr-2 h-4 w-4" }), M("dashboard.noRows", "No rows")]
821
826
  });
822
- let { measureField: L, headerLabel: R } = a(j.fields, j.object, ne), { object: z, dimensionFields: fe, drillRawRows: pe, drillRanges: me } = j, he = fe ? c.filter((e) => e in fe) : [], ge = !!z && (he.length > 0 || !!me?.length), V = (t, n) => {
823
- if (!z) return;
824
- let r = Rt(pe?.[t], he, fe ?? {}, ie, me?.[t]);
825
- oe({
827
+ let { measureField: V, headerLabel: H } = a(F.fields, F.object, te), { object: de, dimensionFields: fe, drillRawRows: pe, drillRanges: he } = F, U = fe ? c.filter((e) => e in fe) : [], W = !!de && (U.length > 0 || !!he?.length), ge = (t, n) => {
828
+ if (!de) return;
829
+ let r = Bt(pe?.[t], U, fe ?? {}, P, he?.[t]);
830
+ ae({
826
831
  filter: r,
827
832
  title: n || String(e?.title ?? "")
828
833
  });
829
- }, H = P && z ? /* @__PURE__ */ Q(Lt, {
834
+ }, _e = L && de ? /* @__PURE__ */ Q(zt, {
830
835
  open: !0,
831
- onClose: () => oe(null),
832
- title: P.title || String(e?.title ?? k("dashboard.details", "Details")),
833
- objectName: z,
834
- filter: P.filter,
836
+ onClose: () => ae(null),
837
+ title: L.title || String(e?.title ?? M("dashboard.details", "Details")),
838
+ objectName: de,
839
+ filter: L.filter,
835
840
  dataSource: t
836
841
  }) : null;
837
842
  if (f) {
838
- let e = L(l[0]);
843
+ let e = V(l[0]), t = F.rows[0]?.[l[0]] ?? 0;
839
844
  return /* @__PURE__ */ $("div", {
840
845
  className: "flex h-full w-full flex-col items-start justify-center gap-1 p-2",
841
846
  children: [/* @__PURE__ */ Q("span", {
842
847
  className: "text-2xl font-semibold tabular-nums",
843
- children: h(j.rows[0]?.[l[0]] ?? 0, e?.format, e?.currency)
848
+ children: h(t, e?.format, e?.currency, e?.percentScale)
844
849
  }), /* @__PURE__ */ Q("span", {
845
850
  className: "text-xs text-muted-foreground",
846
- children: R(l[0])
851
+ children: H(l[0])
847
852
  })]
848
853
  });
849
854
  }
850
855
  if (g) {
851
856
  let t = [...c, ...l], n = /* @__PURE__ */ Q("button", {
852
857
  type: "button",
853
- onClick: () => Ht(String(e?.title ?? i ?? "export"), [t.map((e) => R(e)), ...j.rows.map((e) => t.map((t) => {
858
+ onClick: () => Wt(String(e?.title ?? i ?? "export"), [t.map((e) => H(e)), ...F.rows.map((e) => t.map((t) => {
854
859
  let n = e[t];
855
860
  return n == null ? "" : typeof n == "number" ? n : String(n);
856
861
  }))]),
857
862
  "data-testid": "dataset-export",
858
- title: k("dashboard.exportCsv", "Export CSV"),
859
- "aria-label": k("dashboard.exportCsv", "Export CSV"),
863
+ title: M("dashboard.exportCsv", "Export CSV"),
864
+ "aria-label": M("dashboard.exportCsv", "Export CSV"),
860
865
  className: "absolute right-1 top-1 z-10 rounded p-1 text-muted-foreground opacity-70 hover:bg-accent/50 hover:text-foreground hover:opacity-100",
861
- children: /* @__PURE__ */ Q(ze, { className: "h-3.5 w-3.5" })
866
+ children: /* @__PURE__ */ Q(Ve, { className: "h-3.5 w-3.5" })
862
867
  });
863
868
  if (_) {
864
- let e = zt(j.rows, y, b), t = e.colHeaders.flatMap((e) => l.map((t) => ({
869
+ let e = Vt(F.rows, x, S), t = e.colHeaders.flatMap((e) => l.map((t) => ({
865
870
  col: e,
866
871
  measure: t,
867
- header: l.length === 1 ? e.label : `${e.label} · ${R(t)}`
868
- }))), r = (e, t) => h(e, L(t)?.format, L(t)?.currency), i = (e) => j.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, a = /* @__PURE__ */ new Map();
869
- for (let e of i(y) ?? []) a.set(y.map((t) => String(e[t] ?? "∅")).join(""), e);
872
+ header: l.length === 1 ? e.label : `${e.label} · ${H(t)}`
873
+ }))), r = (e, t) => h(e, V(t)?.format, V(t)?.currency, V(t)?.percentScale), i = (e) => F.totals?.find((t) => Array.isArray(t.dimensions) && t.dimensions.join(",") === e.join(","))?.rows, a = /* @__PURE__ */ new Map();
874
+ for (let e of i(x) ?? []) a.set(v(x.map((t) => String(e[t] ?? "∅"))), e);
870
875
  let o = /* @__PURE__ */ new Map();
871
- for (let e of i([b]) ?? []) o.set(String(e[b] ?? "∅"), e);
872
- let s = i([])?.[0], c = a.size > 0, u = o.size > 0, d = k("dashboard.total", "Total");
876
+ for (let e of i([S]) ?? []) o.set(String(e[S] ?? "∅"), e);
877
+ let s = i([])?.[0], c = a.size > 0, u = o.size > 0, d = M("dashboard.total", "Total");
873
878
  return /* @__PURE__ */ $("div", {
874
879
  className: "relative h-full w-full overflow-auto p-1",
875
880
  "data-testid": "dataset-matrix",
@@ -880,9 +885,9 @@ function Gt({ widget: e, dataSource: t }) {
880
885
  children: [/* @__PURE__ */ Q("thead", {
881
886
  className: "bg-muted/40",
882
887
  children: /* @__PURE__ */ $("tr", { children: [
883
- y.map((e) => /* @__PURE__ */ Q("th", {
888
+ x.map((e) => /* @__PURE__ */ Q("th", {
884
889
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
885
- children: R(e)
890
+ children: H(e)
886
891
  }, e)),
887
892
  t.map((e) => /* @__PURE__ */ Q("th", {
888
893
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
@@ -891,7 +896,7 @@ function Gt({ widget: e, dataSource: t }) {
891
896
  c && l.map((e) => /* @__PURE__ */ Q("th", {
892
897
  className: "px-2 py-1.5 text-right font-medium whitespace-nowrap",
893
898
  "data-testid": "matrix-total-col-header",
894
- children: l.length === 1 ? d : `${d} · ${R(e)}`
899
+ children: l.length === 1 ? d : `${d} · ${H(e)}`
895
900
  }, `total-${e}`))
896
901
  ] })
897
902
  }), /* @__PURE__ */ $("tbody", { children: [e.rowHeaders.map((n) => /* @__PURE__ */ $("tr", {
@@ -902,11 +907,11 @@ function Gt({ widget: e, dataSource: t }) {
902
907
  children: e
903
908
  }, t)),
904
909
  t.map((t) => {
905
- let i = e.cellIndex.get(`${n.id} ${t.col.id}`), a = i == null ? void 0 : j.rows[i], o = ge && i != null, s = [...n.labels, t.col.label].filter(Boolean).join(" / ");
910
+ let i = e.cellIndex.get(y(n.id, t.col.id)), a = i == null ? void 0 : F.rows[i], o = W && i != null, s = [...n.labels, t.col.label].filter(Boolean).join(" / ");
906
911
  return /* @__PURE__ */ Q("td", {
907
912
  className: K("px-2 py-1 text-right tabular-nums whitespace-nowrap", o && "cursor-pointer hover:bg-accent/40"),
908
913
  "data-testid": o ? "dataset-drill-cell" : void 0,
909
- onClick: o ? () => V(i, s) : void 0,
914
+ onClick: o ? () => ge(i, s) : void 0,
910
915
  children: a ? r(a[t.measure], t.measure) : "—"
911
916
  }, `${t.col.id}-${t.measure}`);
912
917
  }),
@@ -920,8 +925,8 @@ function Gt({ widget: e, dataSource: t }) {
920
925
  className: "border-t bg-muted/30 font-medium",
921
926
  "data-testid": "matrix-total-row",
922
927
  children: [
923
- y.length > 0 && /* @__PURE__ */ Q("td", {
924
- colSpan: y.length,
928
+ x.length > 0 && /* @__PURE__ */ Q("td", {
929
+ colSpan: x.length,
925
930
  className: "px-2 py-1 whitespace-nowrap",
926
931
  children: d
927
932
  }),
@@ -937,7 +942,7 @@ function Gt({ widget: e, dataSource: t }) {
937
942
  ]
938
943
  })] })]
939
944
  }),
940
- H
945
+ _e
941
946
  ]
942
947
  });
943
948
  }
@@ -952,105 +957,106 @@ function Gt({ widget: e, dataSource: t }) {
952
957
  className: "bg-muted/40",
953
958
  children: /* @__PURE__ */ Q("tr", { children: r.map((e) => /* @__PURE__ */ Q("th", {
954
959
  className: "px-2 py-1.5 text-left font-medium whitespace-nowrap",
955
- children: R(e)
960
+ children: H(e)
956
961
  }, e)) })
957
- }), /* @__PURE__ */ Q("tbody", { children: j.rows.map((e, t) => /* @__PURE__ */ Q("tr", {
958
- className: K("border-t", ge && "cursor-pointer hover:bg-accent/40"),
959
- "data-testid": ge ? "dataset-drill-row" : void 0,
960
- onClick: ge ? () => V(t, he.map((t) => m(e[t])).filter(Boolean).join(" / ")) : void 0,
962
+ }), /* @__PURE__ */ Q("tbody", { children: F.rows.map((e, t) => /* @__PURE__ */ Q("tr", {
963
+ className: K("border-t", W && "cursor-pointer hover:bg-accent/40"),
964
+ "data-testid": W ? "dataset-drill-row" : void 0,
965
+ onClick: W ? () => ge(t, U.map((t) => m(e[t])).filter(Boolean).join(" / ")) : void 0,
961
966
  children: r.map((t) => /* @__PURE__ */ Q("td", {
962
967
  className: "px-2 py-1 whitespace-nowrap tabular-nums",
963
- children: l.includes(t) ? h(e[t], L(t)?.format, L(t)?.currency) : m(e[t])
968
+ children: l.includes(t) ? h(e[t], V(t)?.format, V(t)?.currency, V(t)?.percentScale) : m(e[t])
964
969
  }, t))
965
970
  }, t)) })]
966
971
  }),
967
- H
972
+ _e
968
973
  ]
969
974
  });
970
975
  }
971
- let U = Wt[d] ?? "bar", _e = v(j.rows, ce), { data: ve, xAxisKey: W, series: ye } = r(_e, c, l, j.fields), be = (Array.isArray(C.stageOrder) ? C.stageOrder : void 0)?.flatMap((e) => {
972
- let t = String(e), n = ce?.[c[0]]?.[t];
976
+ let ve = Kt[d] ?? "bar", ye = b(F.rows, se), { data: be, xAxisKey: xe, series: Se } = r(ye, c, l, F.fields), Ce = (Array.isArray(T.stageOrder) ? T.stageOrder : void 0)?.flatMap((e) => {
977
+ let t = String(e), n = se?.[c[0]]?.[t];
973
978
  return n && n !== t ? [t, n] : [t];
974
- }), xe = be?.length ? be : ue, Se = ge ? (e) => {
975
- let t = p(_e, c, l, e?.category, e?.series);
979
+ }), we = Ce?.length ? Ce : le, Te = e?.chartConfig && typeof e.chartConfig == "object" && !Array.isArray(e.chartConfig) ? e.chartConfig : {}, Ee = typeof Te.showLegend == "boolean" ? Te.showLegend : void 0, De = W ? (e) => {
980
+ let t = p(ye, c, l, e?.category, e?.series);
976
981
  if (t < 0) return;
977
982
  let n = c.length >= 2 && l.length === 1, r = [e?.category, n ? e?.series : void 0].filter(Boolean).map(String).join(" / ");
978
- V(t, r);
983
+ ge(t, r);
979
984
  } : void 0;
980
985
  return /* @__PURE__ */ $("div", {
981
986
  className: K("relative h-full w-full min-h-[220px]"),
982
- children: [/* @__PURE__ */ Q(w, {
987
+ children: [/* @__PURE__ */ Q(E, {
983
988
  schema: {
984
989
  type: "chart",
985
- chartType: U,
986
- data: ve,
987
- xAxisKey: W,
988
- series: ye,
990
+ chartType: ve,
991
+ data: be,
992
+ xAxisKey: xe,
993
+ series: Se,
989
994
  isAnimationActive: !1,
990
- ...se ? { categoryColors: se } : {},
991
- ...xe ? { categoryOrder: xe } : {}
995
+ ...Ee == null ? {} : { showLegend: Ee },
996
+ ...oe ? { categoryColors: oe } : {},
997
+ ...we ? { categoryOrder: we } : {}
992
998
  },
993
- onChartClick: Se,
994
- onSegmentClick: Se
995
- }), H]
999
+ onChartClick: De,
1000
+ onSegmentClick: De
1001
+ }), _e]
996
1002
  });
997
1003
  }
998
1004
  //#endregion
999
1005
  //#region src/DashboardFilterBar.tsx
1000
- var Kt = "__all__", qt = "__custom__";
1001
- function Jt(e, t) {
1006
+ var Jt = "__all__", Yt = "__custom__";
1007
+ function Xt(e, t) {
1002
1008
  if (e) {
1003
1009
  if (e.preset) return t(e.preset);
1004
1010
  if (e.from || e.to) return `${e.from ?? "…"} – ${e.to ?? "…"}`;
1005
1011
  }
1006
1012
  }
1007
- function Yt(e) {
1013
+ function Zt(e) {
1008
1014
  return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
1009
1015
  }
1010
- function Xt({ def: e, value: n, onChange: r }) {
1011
- let i = N(), [a, o] = Z(!1), s = e.allowCustomRange !== !1, c = (e) => i(`dashboard.filters.range.${e}`, e.replace(/_/g, " ")), l = n?.preset ?? (n?.from || n?.to ? qt : Kt);
1016
+ function Qt({ def: e, value: n, onChange: r }) {
1017
+ let i = I(), [a, o] = Z(!1), s = e.allowCustomRange !== !1, c = (e) => i(`dashboard.filters.range.${e}`, e.replace(/_/g, " ")), l = n?.preset ?? (n?.from || n?.to ? Yt : Jt);
1012
1018
  return /* @__PURE__ */ $("div", {
1013
1019
  className: "flex items-center gap-1",
1014
1020
  "data-testid": `dashboard-filter-${e.name}`,
1015
- children: [/* @__PURE__ */ $(_e, {
1021
+ children: [/* @__PURE__ */ $(ve, {
1016
1022
  value: l,
1017
1023
  onValueChange: (e) => {
1018
- e === Kt ? r(void 0) : e === qt ? o(!0) : r({ preset: e });
1024
+ e === Jt ? r(void 0) : e === Yt ? o(!0) : r({ preset: e });
1019
1025
  },
1020
- children: [/* @__PURE__ */ $(ye, {
1026
+ children: [/* @__PURE__ */ $(xe, {
1021
1027
  className: "h-8 w-auto min-w-36 gap-1",
1022
1028
  "aria-label": e.label || i("dashboard.filters.dateRange", "Date range"),
1023
- children: [/* @__PURE__ */ Q(Re, { className: "size-3.5 opacity-60" }), /* @__PURE__ */ Q(be, {
1029
+ children: [/* @__PURE__ */ Q(Be, { className: "size-3.5 opacity-60" }), /* @__PURE__ */ Q(Se, {
1024
1030
  placeholder: i("dashboard.filters.dateRange", "Date range"),
1025
- children: Jt(n, c) ?? i("dashboard.filters.allTime", "All time")
1031
+ children: Xt(n, c) ?? i("dashboard.filters.allTime", "All time")
1026
1032
  })]
1027
- }), /* @__PURE__ */ $(ve, { children: [
1028
- /* @__PURE__ */ Q(W, {
1029
- value: Kt,
1033
+ }), /* @__PURE__ */ $(ye, { children: [
1034
+ /* @__PURE__ */ Q(be, {
1035
+ value: Jt,
1030
1036
  children: i("dashboard.filters.allTime", "All time")
1031
1037
  }),
1032
- t.map((e) => /* @__PURE__ */ Q(W, {
1038
+ t.map((e) => /* @__PURE__ */ Q(be, {
1033
1039
  value: e,
1034
1040
  children: c(e)
1035
1041
  }, e)),
1036
- s && /* @__PURE__ */ Q(W, {
1037
- value: qt,
1042
+ s && /* @__PURE__ */ Q(be, {
1043
+ value: Yt,
1038
1044
  children: i("dashboard.filters.custom", "Custom…")
1039
1045
  })
1040
1046
  ] })]
1041
- }), s && /* @__PURE__ */ $(ge, {
1047
+ }), s && /* @__PURE__ */ $(U, {
1042
1048
  open: a,
1043
1049
  onOpenChange: o,
1044
- children: [/* @__PURE__ */ Q(H, {
1050
+ children: [/* @__PURE__ */ Q(ge, {
1045
1051
  asChild: !0,
1046
1052
  children: /* @__PURE__ */ Q("span", {
1047
1053
  "aria-hidden": !0,
1048
1054
  className: "size-0"
1049
1055
  })
1050
- }), /* @__PURE__ */ Q(V, {
1056
+ }), /* @__PURE__ */ Q(W, {
1051
1057
  className: "w-auto p-0",
1052
1058
  align: "start",
1053
- children: /* @__PURE__ */ Q(oe, {
1059
+ children: /* @__PURE__ */ Q(ae, {
1054
1060
  mode: "range",
1055
1061
  numberOfMonths: 2,
1056
1062
  selected: {
@@ -1063,8 +1069,8 @@ function Xt({ def: e, value: n, onChange: r }) {
1063
1069
  return;
1064
1070
  }
1065
1071
  r({
1066
- ...e?.from ? { from: Yt(e.from) } : {},
1067
- ...e?.to ? { to: Yt(e.to) } : {}
1072
+ ...e?.from ? { from: Zt(e.from) } : {},
1073
+ ...e?.to ? { to: Zt(e.to) } : {}
1068
1074
  });
1069
1075
  }
1070
1076
  })
@@ -1072,8 +1078,8 @@ function Xt({ def: e, value: n, onChange: r }) {
1072
1078
  })]
1073
1079
  });
1074
1080
  }
1075
- function Zt({ def: e, value: t, onChange: n, dataSource: r }) {
1076
- let i = N(), [a, o] = Z(null), s = e.optionsFrom;
1081
+ function $t({ def: e, value: t, onChange: n, dataSource: r }) {
1082
+ let i = I(), [a, o] = Z(null), s = e.optionsFrom;
1077
1083
  Y(() => {
1078
1084
  if (!s || !r) return;
1079
1085
  let e = !1, t = () => {
@@ -1152,24 +1158,24 @@ function Zt({ def: e, value: t, onChange: n, dataSource: r }) {
1152
1158
  r
1153
1159
  ]);
1154
1160
  let c = X(() => e.options?.length ? e.options : a ?? [], [e.options, a]), l = e.label || e.name, u = t ? c.find((e) => e.value === String(t))?.label ?? String(t) : void 0;
1155
- return /* @__PURE__ */ $(_e, {
1156
- value: t ? String(t) : Kt,
1157
- onValueChange: (e) => n(e === Kt ? void 0 : e),
1158
- children: [/* @__PURE__ */ Q(ye, {
1161
+ return /* @__PURE__ */ $(ve, {
1162
+ value: t ? String(t) : Jt,
1163
+ onValueChange: (e) => n(e === Jt ? void 0 : e),
1164
+ children: [/* @__PURE__ */ Q(xe, {
1159
1165
  className: "h-8 w-auto min-w-32",
1160
1166
  "aria-label": l,
1161
1167
  "data-testid": `dashboard-filter-${e.name}`,
1162
- children: /* @__PURE__ */ Q(be, { children: u ?? `${l}: ${i("dashboard.filters.all", "All")}` })
1163
- }), /* @__PURE__ */ $(ve, { children: [/* @__PURE__ */ Q(W, {
1164
- value: Kt,
1168
+ children: /* @__PURE__ */ Q(Se, { children: u ?? `${l}: ${i("dashboard.filters.all", "All")}` })
1169
+ }), /* @__PURE__ */ $(ye, { children: [/* @__PURE__ */ Q(be, {
1170
+ value: Jt,
1165
1171
  children: i("dashboard.filters.all", "All")
1166
- }), c.map((e) => /* @__PURE__ */ Q(W, {
1172
+ }), c.map((e) => /* @__PURE__ */ Q(be, {
1167
1173
  value: e.value,
1168
1174
  children: e.label
1169
1175
  }, e.value))] })]
1170
1176
  });
1171
1177
  }
1172
- function Qt({ def: e, value: t, onChange: n }) {
1178
+ function en({ def: e, value: t, onChange: n }) {
1173
1179
  let [r, i] = Z(t == null ? "" : String(t));
1174
1180
  Y(() => {
1175
1181
  i(t == null ? "" : String(t));
@@ -1196,8 +1202,8 @@ function Qt({ def: e, value: t, onChange: n }) {
1196
1202
  "data-testid": `dashboard-filter-${e.name}`
1197
1203
  });
1198
1204
  }
1199
- function $t({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, className: a }) {
1200
- let o = N();
1205
+ function tn({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, className: a }) {
1206
+ let o = I();
1201
1207
  if (e.length === 0) return null;
1202
1208
  let s = (e) => e == null || e === "" || typeof e == "object" && Object.keys(e).length === 0, c = e.some((e) => {
1203
1209
  let n = t[e.name], r = e.defaultValue;
@@ -1210,47 +1216,47 @@ function $t({ defs: e, values: t, onChange: n, onReset: r, dataSource: i, classN
1210
1216
  "aria-label": o("dashboard.filters.label", "Dashboard filters"),
1211
1217
  children: [e.map((e) => {
1212
1218
  let r = t[e.name], a = (t) => n(e.name, t);
1213
- return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */ Q(Xt, {
1219
+ return e.type === "dateRange" || e.type === "date" ? /* @__PURE__ */ Q(Qt, {
1214
1220
  def: e,
1215
1221
  value: r,
1216
1222
  onChange: a
1217
- }, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */ Q(Zt, {
1223
+ }, e.name) : e.type === "select" || e.type === "lookup" ? /* @__PURE__ */ Q($t, {
1218
1224
  def: e,
1219
1225
  value: r,
1220
1226
  onChange: a,
1221
1227
  dataSource: i
1222
- }, e.name) : /* @__PURE__ */ Q(Qt, {
1228
+ }, e.name) : /* @__PURE__ */ Q(en, {
1223
1229
  def: e,
1224
1230
  value: r,
1225
1231
  onChange: a
1226
1232
  }, e.name);
1227
- }), r && c && /* @__PURE__ */ $(P, {
1233
+ }), r && c && /* @__PURE__ */ $(L, {
1228
1234
  variant: "ghost",
1229
1235
  size: "sm",
1230
1236
  onClick: r,
1231
1237
  className: "text-muted-foreground",
1232
- children: [/* @__PURE__ */ Q(Ge, { className: "size-3.5" }), o("dashboard.filters.reset", "Reset")]
1238
+ children: [/* @__PURE__ */ Q(qe, { className: "size-3.5" }), o("dashboard.filters.reset", "Reset")]
1233
1239
  })]
1234
1240
  });
1235
1241
  }
1236
1242
  //#endregion
1237
1243
  //#region src/DashboardRenderer.tsx
1238
- function en({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
1239
- let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = rt({
1244
+ function nn({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
1245
+ let { attributes: a, listeners: o, setNodeRef: s, transform: c, transition: l, isDragging: u, isOver: d } = at({
1240
1246
  id: e,
1241
1247
  disabled: t
1242
- });
1248
+ }), f = {
1249
+ transform: st.Transform.toString(c),
1250
+ transition: l,
1251
+ opacity: u ? .4 : 1,
1252
+ ...n ? {
1253
+ gridColumn: `span ${n.w}`,
1254
+ gridRow: `span ${n.h}`
1255
+ } : {}
1256
+ };
1243
1257
  return /* @__PURE__ */ Q("div", {
1244
1258
  ref: s,
1245
- style: {
1246
- transform: at.Transform.toString(c),
1247
- transition: l,
1248
- opacity: u ? .4 : 1,
1249
- ...n ? {
1250
- gridColumn: `span ${n.w}`,
1251
- gridRow: `span ${n.h}`
1252
- } : {}
1253
- },
1259
+ style: f,
1254
1260
  className: K("h-full w-full", r, !t && "cursor-grab active:cursor-grabbing", d && !u && "ring-2 ring-primary ring-offset-2 rounded-lg"),
1255
1261
  "data-sortable-widget-id": e,
1256
1262
  ...a,
@@ -1258,19 +1264,19 @@ function en({ id: e, disabled: t, gridSpan: n, className: r, children: i }) {
1258
1264
  children: i
1259
1265
  });
1260
1266
  }
1261
- function tn(e) {
1262
- return e ? Te(e) : null;
1267
+ function rn(e) {
1268
+ return e ? De(e) : null;
1263
1269
  }
1264
- function nn(e) {
1270
+ function an(e) {
1265
1271
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
1266
1272
  }
1267
- var rn = [
1273
+ var on = [
1268
1274
  "hsl(var(--chart-1))",
1269
1275
  "hsl(var(--chart-2))",
1270
1276
  "hsl(var(--chart-3))",
1271
1277
  "hsl(var(--chart-4))",
1272
1278
  "hsl(var(--chart-5))"
1273
- ], an = /* @__PURE__ */ new Set([
1279
+ ], sn = /* @__PURE__ */ new Set([
1274
1280
  "bar",
1275
1281
  "horizontal-bar",
1276
1282
  "line",
@@ -1282,20 +1288,20 @@ var rn = [
1282
1288
  "treemap",
1283
1289
  "sankey"
1284
1290
  ]);
1285
- function on(e) {
1286
- return an.has(e) ? { enabled: !0 } : void 0;
1291
+ function cn(e) {
1292
+ return sn.has(e) ? { enabled: !0 } : void 0;
1287
1293
  }
1288
- var sn = /* @__PURE__ */ new Set([
1294
+ var ln = /* @__PURE__ */ new Set([
1289
1295
  "object-chart",
1290
1296
  "object-metric",
1291
1297
  "object-data-table"
1292
- ]), cn = {
1298
+ ]), un = {
1293
1299
  type: "text",
1294
1300
  value: "This widget uses a retired data format. Edit it to bind a dataset.",
1295
1301
  variant: "caption",
1296
1302
  align: "center",
1297
1303
  className: "flex h-full w-full items-center justify-center rounded border border-dashed border-destructive/40 bg-destructive/5 p-4 text-center text-destructive"
1298
- }, ln = ke(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: o, selectedWidgetId: s, onWidgetClick: l, onWidgetsReorder: u, modalHandler: d, scriptHandlers: f, hideHeaderText: p, ...m }, h) => {
1304
+ }, dn = je(({ schema: e, className: t, dataSource: n, onRefresh: r, recordCount: i, userActions: a, designMode: o, selectedWidgetId: s, onWidgetClick: l, onWidgetsReorder: u, modalHandler: d, scriptHandlers: f, hideHeaderText: p, ...m }, h) => {
1299
1305
  let g = (() => {
1300
1306
  if (e.columns != null) return e.columns;
1301
1307
  let t = e.widgets ?? [], n = 0;
@@ -1304,48 +1310,48 @@ var sn = /* @__PURE__ */ new Set([
1304
1310
  t > n && (n = t), (e.layout?.w ?? 0) > n && (n = e.layout.w);
1305
1311
  }
1306
1312
  return n > 4 ? 12 : 4;
1307
- })(), v = g, b = e.gap || 4, x = e.columns != null || g !== 4, [S, C] = Z(!1), [T, ee] = Z(!1), D = je(null), O = X(() => y(e), [e.globalFilters, e.dateRange]), { variables: te, setVariable: k, resetVariables: A } = re(), { executeAction: ie, engine: j } = E({ actions: X(() => (e.header?.actions ?? []).map((e) => ({
1313
+ })(), v = g, y = e.gap || 4, b = e.columns != null || g !== 4, [S, C] = Z(!1), [w, T] = Z(!1), D = Ne(null), k = X(() => x(e), [e.globalFilters, e.dateRange]), { variables: A, setVariable: j, resetVariables: ee } = ne(), M = X(() => (e.header?.actions ?? []).map((e) => ({
1308
1314
  name: e.actionUrl || e.label,
1309
1315
  type: e.actionType || "url",
1310
1316
  target: e.actionUrl,
1311
1317
  label: e.label
1312
- })), [e.header?.actions]) }), { dashboardLabel: ae, dashboardDescription: N, dashboardActionLabel: oe, widgetTitle: le, widgetDescription: ue, fieldLabel: de } = ne(), { t: L } = M(), R = J((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? L(`report.aggregate.${n}`, { defaultValue: n }) : e ? de(e, t, t) : t, [L, de]), z = e.name, fe = J((e) => {
1313
- if (!z) return e.label;
1318
+ })), [e.header?.actions]), { executeAction: N, engine: P } = O({ actions: M }), { dashboardLabel: F, dashboardDescription: ie, dashboardActionLabel: I, widgetTitle: ae, widgetDescription: ce, fieldLabel: le } = te(), { t: ue } = re(), B = J((e, t, n) => n && (!t || t === "value" || t === "count" || n === "count") ? ue(`report.aggregate.${n}`, { defaultValue: n }) : e ? le(e, t, t) : t, [ue, le]), V = e.name, H = J((e) => {
1319
+ if (!V) return e.label;
1314
1320
  let t = e.actionUrl || e.label;
1315
- return oe(z, t, e.label);
1316
- }, [z, oe]), pe = J((e) => {
1317
- let t = nn(e.title);
1318
- return !z || !e.id || t === void 0 ? t : le(z, e.id, t);
1319
- }, [z, le]), me = J((e) => {
1320
- let t = nn(e.description);
1321
- return !z || !e.id ? t : ue(z, e.id, t);
1322
- }, [z, ue]);
1321
+ return I(V, t, e.label);
1322
+ }, [V, I]), de = J((e) => {
1323
+ let t = an(e.title);
1324
+ return !V || !e.id || t === void 0 ? t : ae(V, e.id, t);
1325
+ }, [V, ae]), fe = J((e) => {
1326
+ let t = an(e.description);
1327
+ return !V || !e.id ? t : ce(V, e.id, t);
1328
+ }, [V, ce]);
1323
1329
  Y(() => {
1324
- let e = j.getRunner();
1330
+ let e = P.getRunner();
1325
1331
  if (d && e.setModalHandler(d), f) for (let [t, n] of Object.entries(f)) e.registerScript(t, n);
1326
1332
  }, [
1327
- j,
1333
+ P,
1328
1334
  d,
1329
1335
  f
1330
1336
  ]), Y(() => {
1331
- let e = () => ee(window.innerWidth < 768);
1337
+ let e = () => T(window.innerWidth < 768);
1332
1338
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
1333
1339
  }, []);
1334
- let B = J(() => {
1340
+ let pe = J(() => {
1335
1341
  r && (C(!0), r(), setTimeout(() => C(!1), 600));
1336
1342
  }, [r]);
1337
1343
  Y(() => {
1338
- if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return D.current = setInterval(B, e.refreshInterval * 1e3), () => {
1344
+ if (!(!e.refreshInterval || e.refreshInterval <= 0 || !r)) return D.current = setInterval(pe, e.refreshInterval * 1e3), () => {
1339
1345
  D.current && clearInterval(D.current);
1340
1346
  };
1341
1347
  }, [
1342
1348
  e.refreshInterval,
1343
1349
  r,
1344
- B
1350
+ pe
1345
1351
  ]);
1346
- let he = J((e, t) => {
1352
+ let me = J((e, t) => {
1347
1353
  !o || !l || !t || (e.stopPropagation(), l(t));
1348
- }, [o, l]), ge = J((t, n, r) => {
1354
+ }, [o, l]), he = J((t, n, r) => {
1349
1355
  if (!o || !l) return;
1350
1356
  let i = e.widgets || [];
1351
1357
  if (t.key === "Enter" || t.key === " ") t.preventDefault(), l(n ?? null);
@@ -1362,20 +1368,20 @@ var sn = /* @__PURE__ */ new Set([
1362
1368
  o,
1363
1369
  l,
1364
1370
  e.widgets
1365
- ]), V = J((e) => {
1371
+ ]), U = J((e) => {
1366
1372
  !o || !l || e.target === e.currentTarget && l(null);
1367
- }, [o, l]), H = !!(o && u), U = $e(Qe(Xe, { activationConstraint: { distance: 5 } })), _e = J((t) => {
1368
- if (!H) return;
1373
+ }, [o, l]), W = !!(o && u), ge = tt(et(Qe, { activationConstraint: { distance: 5 } })), _e = J((t) => {
1374
+ if (!W) return;
1369
1375
  let { active: n, over: r } = t;
1370
1376
  if (!r || n.id === r.id) return;
1371
1377
  let i = e.widgets ?? [], a = i.findIndex((e) => e.id === n.id), o = i.findIndex((e) => e.id === r.id);
1372
- a < 0 || o < 0 || u?.(tt(i, a, o));
1378
+ a < 0 || o < 0 || u?.(rt(i, a, o));
1373
1379
  }, [
1374
- H,
1380
+ W,
1375
1381
  e.widgets,
1376
1382
  u
1377
1383
  ]), ve = (e, t, r) => {
1378
- let i = e.type === "metric" || vt.has(e.type || ""), a = x ? {
1384
+ let i = e.type === "metric" || bt.has(e.type || ""), a = b ? {
1379
1385
  w: Math.min(i ? 3 : 6, v),
1380
1386
  h: i ? 2 : 4
1381
1387
  } : void 0, l = e.layout ?? a, u = l ? {
@@ -1384,11 +1390,11 @@ var sn = /* @__PURE__ */ new Set([
1384
1390
  } : void 0, d = !!e.dataset, f = () => {
1385
1391
  if (e.component) return e.component;
1386
1392
  let t = e.type, n = e.options || {}, r = e.data || n.data;
1387
- if (!r && e.object) return cn;
1388
- let i = xt(t), a = i.chartType ?? t;
1393
+ if (!r && e.object) return un;
1394
+ let i = Ct(t), a = i.chartType ?? t;
1389
1395
  if (i.family === "series" && i.chartType) {
1390
1396
  let t = n.xField || "name", o = n.yField || "value";
1391
- if (mt(r)) {
1397
+ if (gt(r)) {
1392
1398
  let s = r.aggregate, c = s ? {
1393
1399
  field: s.field,
1394
1400
  function: s.function,
@@ -1403,11 +1409,11 @@ var sn = /* @__PURE__ */ new Set([
1403
1409
  xAxisKey: t,
1404
1410
  series: [{
1405
1411
  dataKey: l,
1406
- label: R(r.object, l, c?.function)
1412
+ label: B(r.object, l, c?.function)
1407
1413
  }],
1408
- colors: rn,
1414
+ colors: on,
1409
1415
  isAnimationActive: !1,
1410
- drillDown: n.drillDown ?? on(i.chartType),
1416
+ drillDown: n.drillDown ?? cn(i.chartType),
1411
1417
  compareTo: e.compareTo,
1412
1418
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
1413
1419
  };
@@ -1419,16 +1425,16 @@ var sn = /* @__PURE__ */ new Set([
1419
1425
  xAxisKey: t,
1420
1426
  series: [{
1421
1427
  dataKey: o,
1422
- label: R(void 0, o, void 0)
1428
+ label: B(void 0, o, void 0)
1423
1429
  }],
1424
- colors: rn,
1430
+ colors: on,
1425
1431
  isAnimationActive: !1,
1426
1432
  className: "h-[200px] sm:h-[250px] md:h-[300px]"
1427
1433
  };
1428
1434
  }
1429
1435
  if (i.family === "metric") {
1430
- let i = nn(e.title) || t;
1431
- if (mt(r)) {
1436
+ let i = an(e.title) || t;
1437
+ if (gt(r)) {
1432
1438
  let t = r.aggregate;
1433
1439
  return {
1434
1440
  type: "object-metric",
@@ -1453,7 +1459,7 @@ var sn = /* @__PURE__ */ new Set([
1453
1459
  }
1454
1460
  if (i.family === "table") {
1455
1461
  let i = t === "list";
1456
- if (mt(r)) {
1462
+ if (gt(r)) {
1457
1463
  let { data: t, ...a } = n;
1458
1464
  return {
1459
1465
  type: "object-data-table",
@@ -1479,7 +1485,7 @@ var sn = /* @__PURE__ */ new Set([
1479
1485
  className: "border-0"
1480
1486
  };
1481
1487
  }
1482
- return i.family === "pivot" ? cn : i.family === "custom" ? {
1488
+ return i.family === "pivot" ? un : i.family === "custom" ? {
1483
1489
  type: "text",
1484
1490
  value: "Custom widget — set `component` to a UIComponent schema.",
1485
1491
  variant: "caption",
@@ -1495,38 +1501,38 @@ var sn = /* @__PURE__ */ new Set([
1495
1501
  ...e,
1496
1502
  ...n
1497
1503
  };
1498
- }, p = O.length > 0 ? c(e, O, te) : void 0, m = (() => {
1504
+ }, p = k.length > 0 ? c(e, k, A) : void 0, m = (() => {
1499
1505
  let e = f();
1500
- return p && e && sn.has(e.type) ? {
1506
+ return p && e && ln.has(e.type) ? {
1501
1507
  ...e,
1502
1508
  filter: _(e.filter, p)
1503
1509
  } : e;
1504
1510
  })(), h = p && d ? {
1505
1511
  ...e,
1506
1512
  filter: _(e.filter, p)
1507
- } : e, g = e.type === "metric" && !d, y = pe(e), b = me(e), S = e.id || y || `widget-${t}`, C = o && s === e.id, E = o ? {
1513
+ } : e, g = e.type === "metric" && !d, y = de(e), x = fe(e), S = e.id || y || `widget-${t}`, C = o && s === e.id, T = o ? {
1508
1514
  "data-testid": `dashboard-preview-widget-${e.id}`,
1509
1515
  "data-widget-id": e.id,
1510
1516
  role: "button",
1511
1517
  tabIndex: 0,
1512
1518
  "aria-selected": C,
1513
1519
  "aria-label": `Widget: ${y || `Widget ${t + 1}`}`,
1514
- onClick: (t) => he(t, e.id),
1515
- onKeyDown: (n) => ge(n, e.id, t)
1516
- } : {}, ee = o ? K("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", C ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, D = !T && u && !H ? {
1520
+ onClick: (t) => me(t, e.id),
1521
+ onKeyDown: (n) => he(n, e.id, t)
1522
+ } : {}, D = o ? K("cursor-pointer rounded-lg transition-all outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", C ? "ring-2 ring-primary shadow-md bg-primary/5 dark:bg-primary/10" : "hover:ring-2 hover:ring-primary/40 hover:shadow-sm") : void 0, O = !w && u && !W ? {
1517
1523
  gridColumn: `span ${u.w}`,
1518
1524
  gridRow: `span ${u.h}`
1519
- } : void 0, k = g ? /* @__PURE__ */ $("div", {
1520
- className: K("h-full w-full", o && "relative", ee),
1521
- style: D,
1522
- ...E,
1525
+ } : void 0, j = g ? /* @__PURE__ */ $("div", {
1526
+ className: K("h-full w-full", o && "relative", D),
1527
+ style: O,
1528
+ ...T,
1523
1529
  children: [d ? /* @__PURE__ */ Q("div", {
1524
1530
  className: K("h-full w-full", o && "pointer-events-none"),
1525
- children: /* @__PURE__ */ Q(Gt, {
1531
+ children: /* @__PURE__ */ Q(qt, {
1526
1532
  widget: h,
1527
1533
  dataSource: n
1528
1534
  })
1529
- }) : /* @__PURE__ */ Q(w, {
1535
+ }) : /* @__PURE__ */ Q(E, {
1530
1536
  schema: m,
1531
1537
  className: K("h-full w-full", o && "pointer-events-none"),
1532
1538
  dataSource: n
@@ -1535,30 +1541,30 @@ var sn = /* @__PURE__ */ new Set([
1535
1541
  "aria-hidden": "true",
1536
1542
  "data-testid": "widget-click-overlay"
1537
1543
  })]
1538
- }) : /* @__PURE__ */ $(se, {
1539
- className: K("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", ee),
1540
- style: D,
1541
- ...E,
1544
+ }) : /* @__PURE__ */ $(oe, {
1545
+ className: K("overflow-hidden border-border/50 shadow-sm transition-all hover:shadow-md", "bg-card/50 backdrop-blur-sm", r && "w-full", o && "relative", D),
1546
+ style: O,
1547
+ ...T,
1542
1548
  children: [
1543
- y && /* @__PURE__ */ $(ce, {
1549
+ y && /* @__PURE__ */ $(se, {
1544
1550
  className: "pb-2 border-b border-border/40 bg-muted/20 px-3 sm:px-6",
1545
- children: [/* @__PURE__ */ Q(I, {
1551
+ children: [/* @__PURE__ */ Q(z, {
1546
1552
  className: "text-sm sm:text-base font-medium tracking-tight truncate",
1547
1553
  title: y,
1548
1554
  children: y
1549
- }), b && /* @__PURE__ */ Q("p", {
1555
+ }), x && /* @__PURE__ */ Q("p", {
1550
1556
  className: "text-xs text-muted-foreground mt-0.5 line-clamp-2",
1551
- children: b
1557
+ children: x
1552
1558
  })]
1553
1559
  }),
1554
- /* @__PURE__ */ Q(F, {
1560
+ /* @__PURE__ */ Q(R, {
1555
1561
  className: "p-0",
1556
1562
  children: /* @__PURE__ */ Q("div", {
1557
1563
  className: K("h-full w-full", "p-3 sm:p-4 md:p-6", o && "pointer-events-none"),
1558
- children: d ? /* @__PURE__ */ Q(Gt, {
1564
+ children: d ? /* @__PURE__ */ Q(qt, {
1559
1565
  widget: h,
1560
1566
  dataSource: n
1561
- }) : /* @__PURE__ */ Q(w, {
1567
+ }) : /* @__PURE__ */ Q(E, {
1562
1568
  schema: m,
1563
1569
  dataSource: n
1564
1570
  })
@@ -1571,36 +1577,36 @@ var sn = /* @__PURE__ */ new Set([
1571
1577
  })
1572
1578
  ]
1573
1579
  });
1574
- return H && e.id ? /* @__PURE__ */ Q(en, {
1580
+ return W && e.id ? /* @__PURE__ */ Q(nn, {
1575
1581
  id: e.id,
1576
- gridSpan: !T && u ? {
1582
+ gridSpan: !w && u ? {
1577
1583
  w: u.w,
1578
1584
  h: u.h
1579
1585
  } : void 0,
1580
- children: k
1581
- }, S) : /* @__PURE__ */ Q(Oe, { children: k }, S);
1582
- }, W = e.title || e.label, ye = e.header && /* @__PURE__ */ $("div", {
1586
+ children: j
1587
+ }, S) : /* @__PURE__ */ Q(Ae, { children: j }, S);
1588
+ }, ye = e.title || e.label, be = e.header && /* @__PURE__ */ $("div", {
1583
1589
  className: "col-span-full mb-4",
1584
1590
  children: [
1585
- !p && e.header.showTitle !== !1 && W && /* @__PURE__ */ Q("h2", {
1591
+ !p && e.header.showTitle !== !1 && ye && /* @__PURE__ */ Q("h2", {
1586
1592
  className: "text-lg font-semibold tracking-tight",
1587
- children: z ? ae({
1588
- name: z,
1589
- label: nn(W)
1590
- }) : nn(W)
1593
+ children: V ? F({
1594
+ name: V,
1595
+ label: an(ye)
1596
+ }) : an(ye)
1591
1597
  }),
1592
1598
  !p && e.header.showDescription !== !1 && e.description && /* @__PURE__ */ Q("p", {
1593
1599
  className: "text-sm text-muted-foreground mt-1",
1594
- children: z ? N({
1595
- name: z,
1596
- description: nn(e.description)
1597
- }) : nn(e.description)
1600
+ children: V ? ie({
1601
+ name: V,
1602
+ description: an(e.description)
1603
+ }) : an(e.description)
1598
1604
  }),
1599
1605
  e.header.actions && e.header.actions.length > 0 && /* @__PURE__ */ Q("div", {
1600
1606
  className: "flex gap-2 mt-3",
1601
1607
  children: e.header.actions.map((e, t) => {
1602
- let n = tn(e.icon);
1603
- return /* @__PURE__ */ $(P, {
1608
+ let n = rn(e.icon);
1609
+ return /* @__PURE__ */ $(L, {
1604
1610
  variant: "outline",
1605
1611
  size: "sm",
1606
1612
  onClick: async () => {
@@ -1613,126 +1619,126 @@ var sn = /* @__PURE__ */ new Set([
1613
1619
  /^https?:\/\//.test(n) || n.startsWith("//") ? window.location.assign(n) : (window.history.pushState({}, "", n), window.dispatchEvent(new PopStateEvent("popstate")));
1614
1620
  return;
1615
1621
  }
1616
- let i = await ie(n || r);
1622
+ let i = await N(n || r);
1617
1623
  i?.success || console.warn("[DashboardRenderer] action failed", i?.error);
1618
1624
  },
1619
- children: [n && /* @__PURE__ */ Q(n, { className: "w-4 h-4 mr-1.5" }), fe(e)]
1625
+ children: [n && /* @__PURE__ */ Q(n, { className: "w-4 h-4 mr-1.5" }), H(e)]
1620
1626
  }, t);
1621
1627
  })
1622
1628
  })
1623
1629
  ]
1624
- }), be = O.length > 0 && /* @__PURE__ */ Q($t, {
1625
- defs: O,
1626
- values: te,
1627
- onChange: k,
1628
- onReset: A,
1630
+ }), xe = k.length > 0 && /* @__PURE__ */ Q(tn, {
1631
+ defs: k,
1632
+ values: A,
1633
+ onChange: j,
1634
+ onReset: ee,
1629
1635
  dataSource: n,
1630
1636
  className: "mb-2"
1631
- }), xe = i !== void 0 && /* @__PURE__ */ $("span", {
1637
+ }), Se = i !== void 0 && /* @__PURE__ */ $("span", {
1632
1638
  className: "text-xs text-muted-foreground",
1633
1639
  children: [i.toLocaleString(), " records"]
1634
- }), Se = a ? JSON.stringify(a) : void 0, Ce = r && /* @__PURE__ */ $("div", {
1635
- className: K("flex items-center justify-end gap-3 mb-2", !T && "col-span-full"),
1636
- children: [xe, /* @__PURE__ */ $(P, {
1640
+ }), Ce = a ? JSON.stringify(a) : void 0, we = r && /* @__PURE__ */ $("div", {
1641
+ className: K("flex items-center justify-end gap-3 mb-2", !w && "col-span-full"),
1642
+ children: [Se, /* @__PURE__ */ $(L, {
1637
1643
  variant: "outline",
1638
1644
  size: "sm",
1639
- onClick: B,
1645
+ onClick: pe,
1640
1646
  disabled: S,
1641
1647
  "aria-label": "Refresh dashboard",
1642
- children: [/* @__PURE__ */ Q(We, { className: K("h-4 w-4 mr-2", S && "animate-spin") }), S ? "Refreshing…" : "Refresh All"]
1648
+ children: [/* @__PURE__ */ Q(Ke, { className: K("h-4 w-4 mr-2", S && "animate-spin") }), S ? "Refreshing…" : "Refresh All"]
1643
1649
  })]
1644
- }), we = X(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), G = X(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), Te = X(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
1645
- if (T) {
1650
+ }), Te = X(() => (e.widgets ?? []).map((e) => e.id).filter((e) => !!e), [e.widgets]), Ee = X(() => (e.widgets ?? []).filter((e) => e.type === "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]), G = X(() => (e.widgets ?? []).filter((e) => e.type !== "metric").map((e) => e.id).filter((e) => !!e), [e.widgets]);
1651
+ if (w) {
1646
1652
  let n = e.widgets?.filter((e) => e.type === "metric") || [], r = e.widgets?.filter((e) => e.type !== "metric") || [], i = /* @__PURE__ */ $("div", {
1647
1653
  ref: h,
1648
1654
  className: K("flex flex-col gap-4 px-4", t),
1649
- "data-user-actions": Se,
1650
- onClick: V,
1655
+ "data-user-actions": Ce,
1656
+ onClick: U,
1651
1657
  ...m,
1652
1658
  children: [
1653
- ye,
1654
1659
  be,
1655
- Ce,
1660
+ xe,
1661
+ we,
1656
1662
  n.length > 0 && /* @__PURE__ */ Q("div", {
1657
1663
  className: "grid grid-cols-2 gap-3",
1658
- onClick: V,
1659
- children: /* @__PURE__ */ Q(et, {
1660
- items: G,
1661
- strategy: nt,
1662
- disabled: !H,
1664
+ onClick: U,
1665
+ children: /* @__PURE__ */ Q(nt, {
1666
+ items: Ee,
1667
+ strategy: it,
1668
+ disabled: !W,
1663
1669
  children: n.map((e, t) => ve(e, t))
1664
1670
  })
1665
1671
  }),
1666
1672
  r.length > 0 && /* @__PURE__ */ Q("div", {
1667
1673
  className: "flex flex-col gap-4",
1668
- onClick: V,
1669
- children: /* @__PURE__ */ Q(et, {
1670
- items: Te,
1671
- strategy: it,
1672
- disabled: !H,
1674
+ onClick: U,
1675
+ children: /* @__PURE__ */ Q(nt, {
1676
+ items: G,
1677
+ strategy: ot,
1678
+ disabled: !W,
1673
1679
  children: r.map((e, t) => ve(e, t, !0))
1674
1680
  })
1675
1681
  })
1676
1682
  ]
1677
1683
  });
1678
- return H ? /* @__PURE__ */ Q(Ye, {
1679
- sensors: U,
1680
- collisionDetection: Ze,
1684
+ return W ? /* @__PURE__ */ Q(Ze, {
1685
+ sensors: ge,
1686
+ collisionDetection: $e,
1681
1687
  onDragEnd: _e,
1682
1688
  children: i
1683
1689
  }) : i;
1684
1690
  }
1685
- let Ee = /* @__PURE__ */ $("div", {
1691
+ let De = /* @__PURE__ */ $("div", {
1686
1692
  ref: h,
1687
- className: K("grid", !x && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
1693
+ className: K("grid", !b && "auto-rows-min grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", t),
1688
1694
  style: {
1689
- ...x && {
1695
+ ...b && {
1690
1696
  gridTemplateColumns: `repeat(${v}, minmax(0, 1fr))`,
1691
1697
  gridAutoRows: "minmax(5rem, auto)"
1692
1698
  },
1693
- gap: `${b * .25}rem`
1699
+ gap: `${y * .25}rem`
1694
1700
  },
1695
- "data-user-actions": Se,
1696
- onClick: V,
1701
+ "data-user-actions": Ce,
1702
+ onClick: U,
1697
1703
  ...m,
1698
1704
  children: [
1699
- ye,
1700
1705
  be,
1701
- Ce,
1702
- /* @__PURE__ */ Q(et, {
1703
- items: we,
1704
- strategy: nt,
1705
- disabled: !H,
1706
+ xe,
1707
+ we,
1708
+ /* @__PURE__ */ Q(nt, {
1709
+ items: Te,
1710
+ strategy: it,
1711
+ disabled: !W,
1706
1712
  children: e.widgets?.map((e, t) => ve(e, t))
1707
1713
  })
1708
1714
  ]
1709
1715
  });
1710
- return H ? /* @__PURE__ */ Q(Ye, {
1711
- sensors: U,
1712
- collisionDetection: Ze,
1716
+ return W ? /* @__PURE__ */ Q(Ze, {
1717
+ sensors: ge,
1718
+ collisionDetection: $e,
1713
1719
  onDragEnd: _e,
1714
- children: Ee
1715
- }) : Ee;
1720
+ children: De
1721
+ }) : De;
1716
1722
  });
1717
- ln.displayName = "DashboardRendererInner";
1718
- var un = ke((e, t) => {
1719
- let { schema: n } = e, r = X(() => y(n), [n.globalFilters, n.dateRange]);
1720
- return r.length === 0 ? /* @__PURE__ */ Q(ln, {
1723
+ dn.displayName = "DashboardRendererInner";
1724
+ var fn = je((e, t) => {
1725
+ let { schema: n } = e, r = X(() => x(n), [n.globalFilters, n.dateRange]);
1726
+ return r.length === 0 ? /* @__PURE__ */ Q(dn, {
1721
1727
  ref: t,
1722
1728
  ...e
1723
- }) : /* @__PURE__ */ Q(C, {
1729
+ }) : /* @__PURE__ */ Q(T, {
1724
1730
  definitions: d(r),
1725
- children: /* @__PURE__ */ Q(ln, {
1731
+ children: /* @__PURE__ */ Q(dn, {
1726
1732
  ref: t,
1727
1733
  ...e
1728
1734
  })
1729
1735
  });
1730
1736
  });
1731
- un.displayName = "DashboardRenderer";
1737
+ fn.displayName = "DashboardRenderer";
1732
1738
  //#endregion
1733
1739
  //#region src/DashboardGridLayout.tsx
1734
- function dn({ editMode: e }) {
1735
- let t = D();
1740
+ function pn({ editMode: e }) {
1741
+ let t = A();
1736
1742
  return q.useEffect(() => {
1737
1743
  if (e) return t.startDrag({
1738
1744
  id: "dashboard-layout",
@@ -1744,14 +1750,14 @@ function dn({ editMode: e }) {
1744
1750
  t.endDrag("dashboard");
1745
1751
  }, [e, t]), null;
1746
1752
  }
1747
- var fn = [
1753
+ var mn = [
1748
1754
  "hsl(var(--chart-1))",
1749
1755
  "hsl(var(--chart-2))",
1750
1756
  "hsl(var(--chart-3))",
1751
1757
  "hsl(var(--chart-4))",
1752
1758
  "hsl(var(--chart-5))"
1753
1759
  ];
1754
- function pn(e, t) {
1760
+ function hn(e, t) {
1755
1761
  if (!e.widgets?.length) return e;
1756
1762
  let n = new Map(t.map((e) => [e.i, e])), r = e.widgets.map((e, t) => {
1757
1763
  let r = e.id || `widget-${t}`, i = n.get(r);
@@ -1770,7 +1776,7 @@ function pn(e, t) {
1770
1776
  widgets: r
1771
1777
  };
1772
1778
  }
1773
- function mn(e) {
1779
+ function gn(e) {
1774
1780
  return { lg: e.widgets?.map((e, t) => ({
1775
1781
  i: e.id || `widget-${t}`,
1776
1782
  x: e.layout?.x ?? t % 4 * 3,
@@ -1779,8 +1785,8 @@ function mn(e) {
1779
1785
  h: e.layout?.h ?? 4
1780
1786
  })) || [] };
1781
1787
  }
1782
- var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
1783
- let { width: a, containerRef: o, mounted: s } = pt(), [c, l] = q.useState(!1), [u, d] = q.useState(!1), f = k(), p = q.useRef(null), m = q.useCallback(() => {
1788
+ var _n = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRefresh: i }) => {
1789
+ let { width: a, containerRef: o, mounted: s } = ht(), [c, l] = q.useState(!1), [u, d] = q.useState(!1), f = M(), p = q.useRef(null), m = q.useCallback(() => {
1784
1790
  i && (d(!0), i(), setTimeout(() => d(!1), 600));
1785
1791
  }, [i]);
1786
1792
  q.useEffect(() => {
@@ -1792,7 +1798,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1792
1798
  i,
1793
1799
  m
1794
1800
  ]);
1795
- let [h, g] = q.useState(() => mn(e)), _ = q.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
1801
+ let [h, g] = q.useState(() => gn(e)), _ = q.useMemo(() => JSON.stringify(e.widgets?.map((e, t) => ({
1796
1802
  i: e.id || `widget-${t}`,
1797
1803
  x: e.layout?.x,
1798
1804
  y: e.layout?.y,
@@ -1800,24 +1806,24 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1800
1806
  h: e.layout?.h
1801
1807
  })) ?? []), [e.widgets]);
1802
1808
  q.useEffect(() => {
1803
- g(mn(e));
1809
+ g(gn(e));
1804
1810
  }, [_]);
1805
1811
  let v = q.useCallback((e, t) => {
1806
1812
  g(t), n?.(e);
1807
1813
  }, [n]), y = q.useCallback(() => {
1808
- r ? r(pn(e, h.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), l(!1);
1814
+ r ? r(hn(e, h.lg)) : globalThis.process?.env?.NODE_ENV !== "production" && console.warn("[DashboardGridLayout] Layout edits are in-memory only. Wire `onSchemaChange` to persist via your data adapter."), l(!1);
1809
1815
  }, [
1810
1816
  r,
1811
1817
  e,
1812
1818
  h
1813
1819
  ]), b = q.useCallback(() => {
1814
- g(mn(e));
1820
+ g(gn(e));
1815
1821
  }, [e]), x = q.useCallback((e) => {
1816
1822
  if (e.component) return e.component;
1817
- let t = e.type, n = e.options || {}, r = xt(t);
1823
+ let t = e.type, n = e.options || {}, r = Ct(t);
1818
1824
  if (r.family === "series" && r.chartType) {
1819
1825
  let t = e.data || n.data, i = n.xField || "name", a = n.yField || "value";
1820
- if (mt(t)) {
1826
+ if (gt(t)) {
1821
1827
  let e = t.aggregate, n = e ? {
1822
1828
  field: e.field,
1823
1829
  function: e.function,
@@ -1830,7 +1836,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1830
1836
  aggregate: n,
1831
1837
  xAxisKey: i,
1832
1838
  series: [{ dataKey: o }],
1833
- colors: fn,
1839
+ colors: mn,
1834
1840
  isAnimationActive: !1,
1835
1841
  className: "h-full"
1836
1842
  };
@@ -1842,14 +1848,14 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1842
1848
  data: o,
1843
1849
  xAxisKey: i,
1844
1850
  series: [{ dataKey: a }],
1845
- colors: fn,
1851
+ colors: mn,
1846
1852
  isAnimationActive: !1,
1847
1853
  className: "h-full"
1848
1854
  };
1849
1855
  }
1850
1856
  if (r.family === "metric") {
1851
1857
  let r = e.data || n.data, i = e.title || t;
1852
- if (mt(r)) {
1858
+ if (gt(r)) {
1853
1859
  let t = r.aggregate;
1854
1860
  return {
1855
1861
  type: "object-metric",
@@ -1874,7 +1880,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1874
1880
  }
1875
1881
  if (r.family === "table") {
1876
1882
  let t = e.data || n.data;
1877
- if (mt(t)) {
1883
+ if (gt(t)) {
1878
1884
  let { data: e, ...r } = n;
1879
1885
  return {
1880
1886
  type: "data-table",
@@ -1898,7 +1904,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1898
1904
  }
1899
1905
  if (r.family === "pivot") {
1900
1906
  let t = e.data || n.data;
1901
- if (mt(t)) {
1907
+ if (gt(t)) {
1902
1908
  let { data: e, ...r } = n;
1903
1909
  return {
1904
1910
  type: "pivot",
@@ -1930,7 +1936,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1930
1936
  className: K("w-full", t),
1931
1937
  "data-testid": "grid-layout",
1932
1938
  children: [
1933
- f && /* @__PURE__ */ Q(dn, { editMode: c }),
1939
+ f && /* @__PURE__ */ Q(pn, { editMode: c }),
1934
1940
  /* @__PURE__ */ $("div", {
1935
1941
  className: "mb-4 flex items-center justify-between",
1936
1942
  children: [/* @__PURE__ */ Q("h2", {
@@ -1938,41 +1944,41 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1938
1944
  children: e.title || e.label || "Dashboard"
1939
1945
  }), /* @__PURE__ */ Q("div", {
1940
1946
  className: "flex gap-2",
1941
- children: c ? /* @__PURE__ */ $(dt, { children: [
1942
- /* @__PURE__ */ $(P, {
1947
+ children: c ? /* @__PURE__ */ $(pt, { children: [
1948
+ /* @__PURE__ */ $(L, {
1943
1949
  onClick: y,
1944
1950
  size: "sm",
1945
1951
  variant: "default",
1946
- children: [/* @__PURE__ */ Q(Ke, { className: "h-4 w-4 mr-2" }), "Save Layout"]
1952
+ children: [/* @__PURE__ */ Q(Je, { className: "h-4 w-4 mr-2" }), "Save Layout"]
1947
1953
  }),
1948
- /* @__PURE__ */ $(P, {
1954
+ /* @__PURE__ */ $(L, {
1949
1955
  onClick: b,
1950
1956
  size: "sm",
1951
1957
  variant: "outline",
1952
- children: [/* @__PURE__ */ Q(Je, { className: "h-4 w-4 mr-2" }), "Reset"]
1958
+ children: [/* @__PURE__ */ Q(Xe, { className: "h-4 w-4 mr-2" }), "Reset"]
1953
1959
  }),
1954
- /* @__PURE__ */ Q(P, {
1960
+ /* @__PURE__ */ Q(L, {
1955
1961
  onClick: () => l(!1),
1956
1962
  size: "sm",
1957
1963
  variant: "ghost",
1958
1964
  children: "Cancel"
1959
1965
  })
1960
- ] }) : /* @__PURE__ */ $(dt, { children: [i && /* @__PURE__ */ $(P, {
1966
+ ] }) : /* @__PURE__ */ $(pt, { children: [i && /* @__PURE__ */ $(L, {
1961
1967
  onClick: m,
1962
1968
  size: "sm",
1963
1969
  variant: "outline",
1964
1970
  disabled: u,
1965
1971
  "aria-label": "Refresh dashboard",
1966
- children: [/* @__PURE__ */ Q(We, { className: K("h-4 w-4 mr-2", u && "animate-spin") }), u ? "Refreshing…" : "Refresh All"]
1967
- }), /* @__PURE__ */ $(P, {
1972
+ children: [/* @__PURE__ */ Q(Ke, { className: K("h-4 w-4 mr-2", u && "animate-spin") }), u ? "Refreshing…" : "Refresh All"]
1973
+ }), /* @__PURE__ */ $(L, {
1968
1974
  onClick: () => l(!0),
1969
1975
  size: "sm",
1970
1976
  variant: "outline",
1971
- children: [/* @__PURE__ */ Q(Be, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
1977
+ children: [/* @__PURE__ */ Q(He, { className: "h-4 w-4 mr-2" }), "Edit Layout"]
1972
1978
  })] })
1973
1979
  })]
1974
1980
  }),
1975
- s && /* @__PURE__ */ Q(ft, {
1981
+ s && /* @__PURE__ */ Q(mt, {
1976
1982
  className: "layout",
1977
1983
  width: a,
1978
1984
  layouts: h,
@@ -1998,35 +2004,35 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
1998
2004
  resizeConfig: { enabled: c },
1999
2005
  onLayoutChange: v,
2000
2006
  children: e.widgets?.map((e, t) => {
2001
- let n = e.id || `widget-${t}`, r = x(e);
2007
+ let n = e.id || `widget-${t}`, r = x(e), i = e.type === "metric";
2002
2008
  return /* @__PURE__ */ Q("div", {
2003
2009
  className: "h-full",
2004
- children: e.type === "metric" ? /* @__PURE__ */ $("div", {
2010
+ children: i ? /* @__PURE__ */ $("div", {
2005
2011
  className: "h-full w-full relative",
2006
2012
  children: [c && /* @__PURE__ */ Q("div", {
2007
2013
  className: "drag-handle absolute top-2 right-2 z-10 cursor-move p-1 bg-background/80 rounded border border-border",
2008
- children: /* @__PURE__ */ Q(Ve, { className: "h-4 w-4" })
2009
- }), /* @__PURE__ */ Q(w, {
2014
+ children: /* @__PURE__ */ Q(Ue, { className: "h-4 w-4" })
2015
+ }), /* @__PURE__ */ Q(E, {
2010
2016
  schema: r,
2011
2017
  className: "h-full w-full"
2012
2018
  })]
2013
- }) : /* @__PURE__ */ $(se, {
2019
+ }) : /* @__PURE__ */ $(oe, {
2014
2020
  className: K("h-full overflow-hidden border-border/50 shadow-sm transition-all", "bg-card/50 backdrop-blur-sm", c && "ring-2 ring-primary/20"),
2015
- children: [e.title && /* @__PURE__ */ $(ce, {
2021
+ children: [e.title && /* @__PURE__ */ $(se, {
2016
2022
  className: "pb-2 border-b border-border/40 bg-muted/20 flex flex-row items-center justify-between",
2017
- children: [/* @__PURE__ */ Q(I, {
2023
+ children: [/* @__PURE__ */ Q(z, {
2018
2024
  className: "text-base font-medium tracking-tight truncate",
2019
2025
  title: e.title,
2020
2026
  children: e.title
2021
2027
  }), c && /* @__PURE__ */ Q("div", {
2022
2028
  className: "drag-handle cursor-move p-1 hover:bg-muted/40 rounded",
2023
- children: /* @__PURE__ */ Q(Ve, { className: "h-4 w-4" })
2029
+ children: /* @__PURE__ */ Q(Ue, { className: "h-4 w-4" })
2024
2030
  })]
2025
- }), /* @__PURE__ */ Q(F, {
2031
+ }), /* @__PURE__ */ Q(R, {
2026
2032
  className: "p-0 h-full",
2027
2033
  children: /* @__PURE__ */ Q("div", {
2028
2034
  className: K("h-full w-full overflow-auto p-4"),
2029
- children: /* @__PURE__ */ Q(w, { schema: r })
2035
+ children: /* @__PURE__ */ Q(E, { schema: r })
2030
2036
  })
2031
2037
  })]
2032
2038
  })
@@ -2035,7 +2041,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
2035
2041
  })
2036
2042
  ]
2037
2043
  });
2038
- }, gn = A({
2044
+ }, vn = N({
2039
2045
  "dashboard.trend.vsLastQuarter": "vs last quarter",
2040
2046
  "dashboard.trend.vsLastMonth": "vs last month",
2041
2047
  "dashboard.trend.vsLastWeek": "vs last week",
@@ -2043,7 +2049,7 @@ var hn = ({ schema: e, className: t, onLayoutChange: n, onSchemaChange: r, onRef
2043
2049
  "dashboard.trend.vsYesterday": "vs yesterday",
2044
2050
  "dashboard.trend.vsPreviousPeriod": "vs previous period"
2045
2051
  }, "dashboard.trend.vsLastQuarter");
2046
- function _n(e) {
2052
+ function yn(e) {
2047
2053
  switch (e.trim().toLowerCase().replace(/\s+/g, " ")) {
2048
2054
  case "vs last quarter":
2049
2055
  case "vs previous quarter": return "dashboard.trend.vsLastQuarter";
@@ -2059,11 +2065,11 @@ function _n(e) {
2059
2065
  default: return;
2060
2066
  }
2061
2067
  }
2062
- function vn(e, t, n) {
2068
+ function bn(e, t, n) {
2063
2069
  if (e == null) return "";
2064
2070
  if (typeof e == "string") {
2065
2071
  let r = Number(e);
2066
- return !isFinite(r) || e.trim() === "" ? e : vn(r, t, n);
2072
+ return !isFinite(r) || e.trim() === "" ? e : bn(r, t, n);
2067
2073
  }
2068
2074
  if (!isFinite(e)) return String(e);
2069
2075
  let r = {
@@ -2100,10 +2106,10 @@ function vn(e, t, n) {
2100
2106
  maximumFractionDigits: c
2101
2107
  }).format(e);
2102
2108
  }
2103
- function yn(e) {
2109
+ function xn(e) {
2104
2110
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
2105
2111
  }
2106
- var bn = {
2112
+ var Sn = {
2107
2113
  default: "bg-muted text-muted-foreground",
2108
2114
  blue: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
2109
2115
  teal: "bg-teal-500/10 text-teal-600 dark:text-teal-400",
@@ -2112,7 +2118,7 @@ var bn = {
2112
2118
  success: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
2113
2119
  warning: "bg-amber-500/10 text-amber-600 dark:text-amber-400",
2114
2120
  danger: "bg-rose-500/10 text-rose-600 dark:text-rose-400"
2115
- }, xn = {
2121
+ }, Cn = {
2116
2122
  default: "text-foreground",
2117
2123
  blue: "text-blue-600 dark:text-blue-400",
2118
2124
  teal: "text-teal-600 dark:text-teal-400",
@@ -2121,18 +2127,18 @@ var bn = {
2121
2127
  success: "text-emerald-600 dark:text-emerald-400",
2122
2128
  warning: "text-amber-600 dark:text-amber-400",
2123
2129
  danger: "text-rose-600 dark:text-rose-400"
2124
- }, Sn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, variant: m = "card", ...h }) => {
2125
- let g = bn[c] || bn.default, { t: _ } = gn(), v = X(() => {
2126
- let e = yn(a) || yn(n?.label);
2130
+ }, wn = ({ label: e, value: t, trend: n, icon: r, className: i, description: a, loading: o, error: s, colorVariant: c = "default", format: l, currency: u, prefix: d, suffix: f, onClick: p, variant: m = "card", ...h }) => {
2131
+ let g = Sn[c] || Sn.default, { t: _ } = vn(), v = X(() => {
2132
+ let e = xn(a) || xn(n?.label);
2127
2133
  if (!e) return e;
2128
- let t = _n(e);
2134
+ let t = yn(e);
2129
2135
  return t ? _(t) : e;
2130
2136
  }, [
2131
2137
  a,
2132
2138
  n?.label,
2133
2139
  _
2134
2140
  ]), y = X(() => {
2135
- let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? vn(t, l, u) : t ?? "", n = String(e);
2141
+ let e = typeof t == "number" || typeof t == "string" && t.trim() !== "" && isFinite(Number(t)) ? bn(t, l, u) : t ?? "", n = String(e);
2136
2142
  return `${d && n.startsWith(d) ? "" : d ?? ""}${n}${f && n.endsWith(f) ? "" : f ?? ""}`;
2137
2143
  }, [
2138
2144
  t,
@@ -2142,13 +2148,13 @@ var bn = {
2142
2148
  f
2143
2149
  ]), b = X(() => {
2144
2150
  if (typeof r == "string") {
2145
- let e = Te(r);
2151
+ let e = De(r);
2146
2152
  return e ? /* @__PURE__ */ Q(e, { className: "h-4 w-4" }) : null;
2147
2153
  }
2148
2154
  return r;
2149
2155
  }, [r]);
2150
2156
  if (m === "bare") {
2151
- let t = xn[c] || xn.default;
2157
+ let t = Cn[c] || Cn.default;
2152
2158
  return /* @__PURE__ */ Q("div", {
2153
2159
  className: K("flex flex-col gap-1 min-w-0", p && "cursor-pointer", i),
2154
2160
  onClick: p,
@@ -2160,7 +2166,7 @@ var bn = {
2160
2166
  children: o ? /* @__PURE__ */ $("div", {
2161
2167
  className: "flex items-center gap-2 text-muted-foreground",
2162
2168
  "data-testid": "metric-loading",
2163
- children: [/* @__PURE__ */ Q(He, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2169
+ children: [/* @__PURE__ */ Q(We, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2164
2170
  className: "text-sm",
2165
2171
  children: "Loading…"
2166
2172
  })]
@@ -2168,20 +2174,20 @@ var bn = {
2168
2174
  className: "flex items-center gap-2",
2169
2175
  "data-testid": "metric-error",
2170
2176
  role: "alert",
2171
- children: [/* @__PURE__ */ Q(Me, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2177
+ children: [/* @__PURE__ */ Q(Pe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2172
2178
  className: "text-xs text-destructive truncate",
2173
2179
  children: s
2174
2180
  })]
2175
- }) : /* @__PURE__ */ $(dt, { children: [/* @__PURE__ */ Q("div", {
2181
+ }) : /* @__PURE__ */ $(pt, { children: [/* @__PURE__ */ Q("div", {
2176
2182
  className: K("text-[2rem] leading-none font-extrabold tabular-nums tracking-tight truncate", t),
2177
2183
  children: y
2178
2184
  }), /* @__PURE__ */ Q("div", {
2179
2185
  className: "text-xs font-medium text-muted-foreground truncate",
2180
- children: yn(e)
2186
+ children: xn(e)
2181
2187
  })] })
2182
2188
  });
2183
2189
  }
2184
- return /* @__PURE__ */ $(se, {
2190
+ return /* @__PURE__ */ $(oe, {
2185
2191
  className: K("h-full overflow-hidden", p && "cursor-pointer transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", i),
2186
2192
  onClick: p,
2187
2193
  role: p ? "button" : void 0,
@@ -2190,19 +2196,19 @@ var bn = {
2190
2196
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p());
2191
2197
  } : void 0,
2192
2198
  ...h,
2193
- children: [/* @__PURE__ */ $(ce, {
2199
+ children: [/* @__PURE__ */ $(se, {
2194
2200
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
2195
- children: [/* @__PURE__ */ Q(I, {
2201
+ children: [/* @__PURE__ */ Q(z, {
2196
2202
  className: "text-sm font-medium truncate",
2197
- children: yn(e)
2203
+ children: xn(e)
2198
2204
  }), b && /* @__PURE__ */ Q("div", {
2199
2205
  className: K("flex h-8 w-8 items-center justify-center rounded-md shrink-0", g),
2200
2206
  children: b
2201
2207
  })]
2202
- }), /* @__PURE__ */ Q(F, { children: o ? /* @__PURE__ */ $("div", {
2208
+ }), /* @__PURE__ */ Q(R, { children: o ? /* @__PURE__ */ $("div", {
2203
2209
  className: "flex items-center gap-2 text-muted-foreground",
2204
2210
  "data-testid": "metric-loading",
2205
- children: [/* @__PURE__ */ Q(He, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2211
+ children: [/* @__PURE__ */ Q(We, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2206
2212
  className: "text-sm",
2207
2213
  children: "Loading…"
2208
2214
  })]
@@ -2210,11 +2216,11 @@ var bn = {
2210
2216
  className: "flex items-center gap-2",
2211
2217
  "data-testid": "metric-error",
2212
2218
  role: "alert",
2213
- children: [/* @__PURE__ */ Q(Me, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2219
+ children: [/* @__PURE__ */ Q(Pe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2214
2220
  className: "text-xs text-destructive truncate",
2215
2221
  children: s
2216
2222
  })]
2217
- }) : /* @__PURE__ */ $(dt, { children: [/* @__PURE__ */ Q("div", {
2223
+ }) : /* @__PURE__ */ $(pt, { children: [/* @__PURE__ */ Q("div", {
2218
2224
  className: "text-2xl font-bold tabular-nums tracking-tight truncate",
2219
2225
  children: y
2220
2226
  }), (n || a) && /* @__PURE__ */ $("div", {
@@ -2222,9 +2228,9 @@ var bn = {
2222
2228
  children: [n && /* @__PURE__ */ $("span", {
2223
2229
  className: K("flex items-center shrink-0 font-medium", n.direction === "up" && "text-emerald-600 dark:text-emerald-400", n.direction === "down" && "text-rose-600 dark:text-rose-400", n.direction === "neutral" && "text-muted-foreground"),
2224
2230
  children: [
2225
- n.direction === "up" && /* @__PURE__ */ Q(Fe, { className: "h-3 w-3 mr-1" }),
2226
- n.direction === "down" && /* @__PURE__ */ Q(Pe, { className: "h-3 w-3 mr-1" }),
2227
- n.direction === "neutral" && /* @__PURE__ */ Q(Ue, { className: "h-3 w-3 mr-1" }),
2231
+ n.direction === "up" && /* @__PURE__ */ Q(Le, { className: "h-3 w-3 mr-1" }),
2232
+ n.direction === "down" && /* @__PURE__ */ Q(Ie, { className: "h-3 w-3 mr-1" }),
2233
+ n.direction === "neutral" && /* @__PURE__ */ Q(Ge, { className: "h-3 w-3 mr-1" }),
2228
2234
  n.value,
2229
2235
  "%"
2230
2236
  ]
@@ -2237,24 +2243,24 @@ var bn = {
2237
2243
  };
2238
2244
  //#endregion
2239
2245
  //#region src/MetricCard.tsx
2240
- function Cn(e) {
2246
+ function Tn(e) {
2241
2247
  if (e != null) return typeof e == "string" ? e : e.defaultValue || e.key;
2242
2248
  }
2243
- var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
2244
- let u = n ? Te(n) : null;
2245
- return /* @__PURE__ */ $(se, {
2249
+ var En = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a, className: o, loading: s, error: c, ...l }) => {
2250
+ let u = n ? De(n) : null;
2251
+ return /* @__PURE__ */ $(oe, {
2246
2252
  className: K("h-full", o),
2247
2253
  ...l,
2248
- children: [/* @__PURE__ */ $(ce, {
2254
+ children: [/* @__PURE__ */ $(se, {
2249
2255
  className: "flex flex-row items-center justify-between space-y-0 pb-2",
2250
- children: [/* @__PURE__ */ Q(I, {
2256
+ children: [/* @__PURE__ */ Q(z, {
2251
2257
  className: "text-sm font-medium",
2252
- children: Cn(e)
2258
+ children: Tn(e)
2253
2259
  }), u && /* @__PURE__ */ Q(u, { className: "h-4 w-4 text-muted-foreground" })]
2254
- }), /* @__PURE__ */ Q(F, { children: s ? /* @__PURE__ */ $("div", {
2260
+ }), /* @__PURE__ */ Q(R, { children: s ? /* @__PURE__ */ $("div", {
2255
2261
  className: "flex items-center gap-2 text-muted-foreground",
2256
2262
  "data-testid": "metric-card-loading",
2257
- children: [/* @__PURE__ */ Q(He, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2263
+ children: [/* @__PURE__ */ Q(We, { className: "h-4 w-4 animate-spin" }), /* @__PURE__ */ Q("span", {
2258
2264
  className: "text-sm",
2259
2265
  children: "Loading…"
2260
2266
  })]
@@ -2262,11 +2268,11 @@ var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2262
2268
  className: "flex items-center gap-2",
2263
2269
  "data-testid": "metric-card-error",
2264
2270
  role: "alert",
2265
- children: [/* @__PURE__ */ Q(Me, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2271
+ children: [/* @__PURE__ */ Q(Pe, { className: "h-4 w-4 text-destructive shrink-0" }), /* @__PURE__ */ Q("span", {
2266
2272
  className: "text-xs text-destructive truncate",
2267
2273
  children: c
2268
2274
  })]
2269
- }) : /* @__PURE__ */ $(dt, { children: [/* @__PURE__ */ Q("div", {
2275
+ }) : /* @__PURE__ */ $(pt, { children: [/* @__PURE__ */ Q("div", {
2270
2276
  className: "text-2xl font-bold",
2271
2277
  children: t
2272
2278
  }), (r || i || a) && /* @__PURE__ */ $("p", {
@@ -2274,47 +2280,47 @@ var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2274
2280
  children: [r && i && /* @__PURE__ */ $("span", {
2275
2281
  className: K("flex items-center mr-2", r === "up" && "text-green-500", r === "down" && "text-red-500", r === "neutral" && "text-yellow-500"),
2276
2282
  children: [
2277
- r === "up" && /* @__PURE__ */ Q(Fe, { className: "h-3 w-3 mr-1" }),
2278
- r === "down" && /* @__PURE__ */ Q(Pe, { className: "h-3 w-3 mr-1" }),
2279
- r === "neutral" && /* @__PURE__ */ Q(Ue, { className: "h-3 w-3 mr-1" }),
2283
+ r === "up" && /* @__PURE__ */ Q(Le, { className: "h-3 w-3 mr-1" }),
2284
+ r === "down" && /* @__PURE__ */ Q(Ie, { className: "h-3 w-3 mr-1" }),
2285
+ r === "neutral" && /* @__PURE__ */ Q(Ge, { className: "h-3 w-3 mr-1" }),
2280
2286
  i
2281
2287
  ]
2282
- }), Cn(a)]
2288
+ }), Tn(a)]
2283
2289
  })] }) })]
2284
2290
  });
2285
- }, Tn = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: i, trend: a, icon: o, className: s, description: c, dataSource: u, colorVariant: d, format: f, currency: p, prefix: m, suffix: h, invert: _, drillDown: v, title: y, compareTo: C, t: E, variant: ee }) => {
2286
- let D = Ae(T), O = u || D?.dataSource, [k, ne] = Z(!1), [re, A] = Z(null), [M, ae] = Z(null), [N, P] = Z(!1), [oe, se] = Z(null), [F, ce] = Z(null);
2291
+ }, Dn = ({ objectName: e, aggregate: t, filter: n, label: r, fallbackValue: i, trend: a, icon: o, className: s, description: c, dataSource: u, colorVariant: d, format: f, currency: p, prefix: m, suffix: h, invert: _, drillDown: v, title: y, compareTo: b, t: x, variant: T }) => {
2292
+ let O = Me(D), k = u || O?.dataSource, [A, j] = Z(!1), [M, te] = Z(null), [ne, N] = Z(null), [re, ie] = Z(!1), [I, L] = Z(null), [ae, oe] = Z(null);
2287
2293
  Y(() => {
2288
2294
  let t = !0;
2289
- if (!(!O || !e || typeof O.getObjectSchema != "function")) return O.getObjectSchema(e).then((e) => {
2290
- t && ce(e);
2295
+ if (!(!k || !e || typeof k.getObjectSchema != "function")) return k.getObjectSchema(e).then((e) => {
2296
+ t && oe(e);
2291
2297
  }).catch(() => {}), () => {
2292
2298
  t = !1;
2293
2299
  };
2294
- }, [O, e]);
2295
- let I = X(() => {
2300
+ }, [k, e]);
2301
+ let R = X(() => {
2296
2302
  let e = t?.field;
2297
- if (!e || !F?.fields) return null;
2298
- let n = F.fields;
2303
+ if (!e || !ae?.fields) return null;
2304
+ let n = ae.fields;
2299
2305
  return Array.isArray(n) ? n.find((t) => t?.name === e) || null : n[e] || null;
2300
- }, [F, t?.field]), le = X(() => {
2306
+ }, [ae, t?.field]), se = X(() => {
2301
2307
  if (f) return f;
2302
- if (I) {
2303
- if (I.type === "currency") {
2304
- let e = I.scale ?? 0;
2308
+ if (R) {
2309
+ if (R.type === "currency") {
2310
+ let e = R.scale ?? 0;
2305
2311
  return e > 0 ? `0,0.${"0".repeat(e)}` : "0,0";
2306
2312
  }
2307
- if (I.type === "percent") return "0,0%";
2308
- if (I.type === "number" || I.type === "integer") return "0,0";
2313
+ if (R.type === "percent") return "0,0%";
2314
+ if (R.type === "number" || R.type === "integer") return "0,0";
2309
2315
  }
2310
- }, [f, I]), { currency: ue } = j(), de = X(() => {
2316
+ }, [f, R]), { currency: z } = F(), ce = X(() => {
2311
2317
  if (p) return p;
2312
- if (I?.type === "currency") return ie(I, ue);
2318
+ if (R?.type === "currency") return P(R, z);
2313
2319
  }, [
2314
2320
  p,
2315
- I,
2316
- ue
2317
- ]), L = X(() => t ? JSON.stringify(t) : "", [t]), R = te(), B = X(() => x(n, R), [n, R]), he = X(() => B ? JSON.stringify(B) : "", [B]), ge = X(() => C ? JSON.stringify(C) : "", [C]), V = J(async (n, r) => {
2321
+ R,
2322
+ z
2323
+ ]), le = X(() => t ? JSON.stringify(t) : "", [t]), ue = ee(), B = X(() => C(n, ue), [n, ue]), V = X(() => B ? JSON.stringify(B) : "", [B]), me = X(() => b ? JSON.stringify(b) : "", [b]), he = J(async (n, r) => {
2318
2324
  if (t && typeof n.aggregate == "function") {
2319
2325
  let i = await n.aggregate(e, {
2320
2326
  field: t.field,
@@ -2335,88 +2341,88 @@ var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2335
2341
  return (Array.isArray(t) ? t : t?.data || t?.records || []).length;
2336
2342
  }
2337
2343
  return null;
2338
- }, [e, L]), H = J(async (t, r) => {
2344
+ }, [e, le]), U = J(async (t, r) => {
2339
2345
  if (!(!t || !e)) {
2340
- r.current && (P(!0), se(null));
2346
+ r.current && (ie(!0), L(null));
2341
2347
  try {
2342
- let e = C ? S(n, C) : null, [i, a] = await Promise.all([V(t, B), e ? V(t, e) : Promise.resolve(null)]);
2348
+ let e = b ? w(n, b) : null, [i, a] = await Promise.all([he(t, B), e ? he(t, e) : Promise.resolve(null)]);
2343
2349
  if (i === null) return;
2344
- r.current && (A(i), ae(typeof a == "number" && Number.isFinite(a) ? a : null));
2350
+ r.current && (te(i), N(typeof a == "number" && Number.isFinite(a) ? a : null));
2345
2351
  } catch (e) {
2346
- console.error("[ObjectMetricWidget] Fetch error:", e), r.current && se(e instanceof Error ? e.message : "Failed to load metric");
2352
+ console.error("[ObjectMetricWidget] Fetch error:", e), r.current && L(e instanceof Error ? e.message : "Failed to load metric");
2347
2353
  } finally {
2348
- r.current && P(!1);
2354
+ r.current && ie(!1);
2349
2355
  }
2350
2356
  }
2351
2357
  }, [
2352
2358
  e,
2353
- L,
2354
- he,
2355
- ge,
2356
- V
2359
+ le,
2360
+ V,
2361
+ me,
2362
+ he
2357
2363
  ]);
2358
2364
  Y(() => {
2359
2365
  let t = { current: !0 };
2360
- return O && e ? H(O, t) : (A(null), se(null)), () => {
2366
+ return k && e ? U(k, t) : (te(null), L(null)), () => {
2361
2367
  t.current = !1;
2362
2368
  };
2363
2369
  }, [
2364
- O,
2370
+ k,
2365
2371
  e,
2366
- H
2372
+ U
2367
2373
  ]);
2368
- let U = re === null ? O ? "—" : i ?? "—" : re;
2369
- _ && typeof U == "number" && isFinite(U) && U >= 0 && U <= 1 && (U = 1 - U);
2370
- let _e = X(() => {
2371
- if (!C || typeof re != "number" || !Number.isFinite(re) || M === null) return;
2372
- let e = ht(re, M);
2374
+ let W = M === null ? k ? "—" : i ?? "—" : M;
2375
+ _ && typeof W == "number" && isFinite(W) && W >= 0 && W <= 1 && (W = 1 - W);
2376
+ let ge = X(() => {
2377
+ if (!b || typeof M != "number" || !Number.isFinite(M) || ne === null) return;
2378
+ let e = _t(M, ne);
2373
2379
  if (!e) return;
2374
- let t = l(C, n), r = `dashboard.trend.${t}`, i = {
2380
+ let t = l(b, n), r = `dashboard.trend.${t}`, i = {
2375
2381
  vsPreviousPeriod: "vs previous period",
2376
2382
  vsLastWeek: "vs last week",
2377
2383
  vsLastMonth: "vs last month",
2378
2384
  vsLastQuarter: "vs last quarter",
2379
2385
  vsLastYear: "vs last year",
2380
2386
  vsYesterday: "vs yesterday"
2381
- }, a = E ? E(r, i[t] || t) : i[t] || t;
2387
+ }, a = x ? x(r, i[t] || t) : i[t] || t;
2382
2388
  return {
2383
2389
  value: e.value,
2384
2390
  direction: e.direction,
2385
2391
  label: a
2386
2392
  };
2387
2393
  }, [
2388
- C,
2389
- re,
2394
+ b,
2390
2395
  M,
2396
+ ne,
2391
2397
  n,
2392
- E
2393
- ]) ?? a, ve = g(v) && !!e && !!O, W = X(() => {
2394
- let e = typeof r == "string" ? r : r?.defaultValue || "";
2395
- return b(v, {}, (typeof y == "string" ? y : y?.defaultValue || "") || e || "Details");
2398
+ x
2399
+ ]) ?? a, _e = g(v) && !!e && !!k, ve = X(() => {
2400
+ let e = typeof r == "string" ? r : r?.defaultValue || "", t = typeof y == "string" ? y : y?.defaultValue || "";
2401
+ return S(v, {}, t || e || "Details");
2396
2402
  }, [
2397
2403
  v,
2398
2404
  r,
2399
2405
  y
2400
2406
  ]), ye = X(() => {
2401
- if (!ve) return null;
2402
- let t = v?.target ?? "drawer", n = v?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Q(It, {
2407
+ if (!_e) return null;
2408
+ let t = v?.target ?? "drawer", n = v?.report, r = n && typeof n == "object" && (Array.isArray(n.columns) || "objectName" in n), i = r ? null : /* @__PURE__ */ Q(Rt, {
2403
2409
  objectName: e,
2404
2410
  filter: B,
2405
- onNavigate: () => ne(!1)
2411
+ onNavigate: () => j(!1)
2406
2412
  }), a;
2407
2413
  if (r) {
2408
- let e = n.filter, t = e ? B ? { $and: [e, B] } : e : B;
2414
+ let e = n.filter, t = e ? B ? { $and: [e, B] } : e : B, r = {
2415
+ type: "spec-report",
2416
+ ...n,
2417
+ filter: t
2418
+ };
2409
2419
  a = /* @__PURE__ */ Q("div", {
2410
2420
  className: "h-full overflow-auto",
2411
- children: /* @__PURE__ */ Q(w, { schema: {
2412
- type: "spec-report",
2413
- ...n,
2414
- filter: t
2415
- } })
2421
+ children: /* @__PURE__ */ Q(E, { schema: r })
2416
2422
  });
2417
2423
  } else a = /* @__PURE__ */ Q("div", {
2418
2424
  className: "h-full overflow-auto",
2419
- children: /* @__PURE__ */ Q(w, { schema: {
2425
+ children: /* @__PURE__ */ Q(E, { schema: {
2420
2426
  type: "object-data-table",
2421
2427
  objectName: e,
2422
2428
  filter: B,
@@ -2428,25 +2434,25 @@ var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2428
2434
  }
2429
2435
  } })
2430
2436
  });
2431
- return t === "dialog" ? /* @__PURE__ */ Q(z, {
2437
+ return t === "dialog" ? /* @__PURE__ */ Q(H, {
2432
2438
  open: !0,
2433
- onOpenChange: (e) => !e && ne(!1),
2434
- children: /* @__PURE__ */ $(fe, {
2439
+ onOpenChange: (e) => !e && j(!1),
2440
+ children: /* @__PURE__ */ $(de, {
2435
2441
  className: "max-w-5xl",
2436
- children: [/* @__PURE__ */ $(pe, {
2442
+ children: [/* @__PURE__ */ $(fe, {
2437
2443
  className: "flex-row items-center justify-between gap-4 pr-8",
2438
- children: [/* @__PURE__ */ Q(me, { children: W }), i]
2444
+ children: [/* @__PURE__ */ Q(pe, { children: ve }), i]
2439
2445
  }), a]
2440
2446
  })
2441
- }) : /* @__PURE__ */ Q(xe, {
2447
+ }) : /* @__PURE__ */ Q(Ce, {
2442
2448
  open: !0,
2443
- onOpenChange: (e) => !e && ne(!1),
2444
- children: /* @__PURE__ */ $(Se, {
2449
+ onOpenChange: (e) => !e && j(!1),
2450
+ children: /* @__PURE__ */ $(we, {
2445
2451
  side: "right",
2446
2452
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-5xl flex flex-col",
2447
- children: [/* @__PURE__ */ $(Ce, {
2453
+ children: [/* @__PURE__ */ $(Te, {
2448
2454
  className: "flex-row items-center justify-between gap-4 pr-8",
2449
- children: [/* @__PURE__ */ Q(we, { children: W }), i]
2455
+ children: [/* @__PURE__ */ Q(Ee, { children: ve }), i]
2450
2456
  }), /* @__PURE__ */ Q("div", {
2451
2457
  className: "flex-1 overflow-hidden mt-2",
2452
2458
  children: a
@@ -2454,39 +2460,39 @@ var wn = ({ title: e, value: t, icon: n, trend: r, trendValue: i, description: a
2454
2460
  })
2455
2461
  });
2456
2462
  }, [
2457
- ve,
2463
+ _e,
2458
2464
  v,
2459
2465
  e,
2460
2466
  B,
2461
- W
2467
+ ve
2462
2468
  ]);
2463
- return /* @__PURE__ */ $(dt, { children: [/* @__PURE__ */ Q(Sn, {
2469
+ return /* @__PURE__ */ $(pt, { children: [/* @__PURE__ */ Q(wn, {
2464
2470
  label: r,
2465
- value: U,
2466
- trend: _e,
2471
+ value: W,
2472
+ trend: ge,
2467
2473
  icon: o,
2468
2474
  className: s,
2469
2475
  description: c,
2470
- loading: N,
2471
- error: oe,
2476
+ loading: re,
2477
+ error: I,
2472
2478
  colorVariant: d,
2473
- format: le,
2474
- currency: de,
2479
+ format: se,
2480
+ currency: ce,
2475
2481
  prefix: m,
2476
2482
  suffix: h,
2477
- variant: ee,
2478
- onClick: ve ? () => ne(!0) : void 0
2479
- }), k && ye] });
2483
+ variant: T,
2484
+ onClick: _e ? () => j(!0) : void 0
2485
+ }), A && ye] });
2480
2486
  };
2481
2487
  //#endregion
2482
2488
  //#region src/PivotTable.tsx
2483
- function En() {
2484
- return N()("dashboard.total", "Total");
2489
+ function On() {
2490
+ return I()("dashboard.total", "Total");
2485
2491
  }
2486
- function Dn() {
2487
- return N()("dashboard.noDataAvailable", "No data available");
2492
+ function kn() {
2493
+ return I()("dashboard.noDataAvailable", "No data available");
2488
2494
  }
2489
- function On(e, t) {
2495
+ function An(e, t) {
2490
2496
  if (!t) return String(e);
2491
2497
  let n = "", r = !1, i, a = t, o = a.match(/^([^0-9.,#]*)/);
2492
2498
  if (o && o[1]) {
@@ -2503,18 +2509,18 @@ function On(e, t) {
2503
2509
  }
2504
2510
  return n + l + c;
2505
2511
  }
2506
- var kn = "—";
2507
- function An(e, t) {
2508
- return e === "" ? kn : t?.[e] ?? e;
2512
+ var jn = "—";
2513
+ function Mn(e, t) {
2514
+ return e === "" ? jn : t?.[e] ?? e;
2509
2515
  }
2510
- var jn = /* @__PURE__ */ new Set([
2516
+ var Nn = /* @__PURE__ */ new Set([
2511
2517
  "sum",
2512
2518
  "count",
2513
2519
  "avg",
2514
2520
  "min",
2515
2521
  "max"
2516
2522
  ]);
2517
- function Mn(e, t) {
2523
+ function Pn(e, t) {
2518
2524
  if (e.length === 0) return 0;
2519
2525
  switch (t) {
2520
2526
  case "sum": return e.reduce((e, t) => e + t, 0);
@@ -2525,8 +2531,8 @@ function Mn(e, t) {
2525
2531
  default: return NaN;
2526
2532
  }
2527
2533
  }
2528
- var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
2529
- let { title: o, rowField: s, columnField: c, valueField: l, aggregation: u = "sum", data: d = [], showRowTotals: f = !1, showColumnTotals: p = !1, format: m, columnColors: h, drillDown: _ } = e, v = En(), y = Dn(), b = g(_) && typeof a == "function", x = (e) => {
2534
+ var Fn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabel: i, onDrillDown: a }) => {
2535
+ let { title: o, rowField: s, columnField: c, valueField: l, aggregation: u = "sum", data: d = [], showRowTotals: f = !1, showColumnTotals: p = !1, format: m, columnColors: h, drillDown: _ } = e, v = On(), y = kn(), b = g(_) && typeof a == "function", x = (e) => {
2530
2536
  b && a({
2531
2537
  ...e,
2532
2538
  rowLabel: e.rowKey === void 0 ? e.rowLabel : n?.[e.rowKey] ?? e.rowKey,
@@ -2534,7 +2540,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2534
2540
  });
2535
2541
  }, S = (e) => (t) => {
2536
2542
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
2537
- }, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(d) ? d : [], { rowKeys: T, colKeys: E, matrix: ee, rowTotals: D, colTotals: O, grandTotal: te } = X(() => {
2543
+ }, C = b ? "cursor-pointer hover:bg-accent/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-[-2px]" : "", w = Array.isArray(d) ? d : [], { rowKeys: T, colKeys: E, matrix: D, rowTotals: O, colTotals: k, grandTotal: A } = X(() => {
2538
2544
  let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = {};
2539
2545
  for (let r of w) {
2540
2546
  let i = String(r[s] ?? ""), a = String(r[c] ?? ""), o = Number(r[l]) || 0;
@@ -2545,10 +2551,10 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2545
2551
  a[e] = {};
2546
2552
  let t = [];
2547
2553
  for (let r of i) {
2548
- let i = n[e]?.[r] ?? [], o = Mn(i, u);
2554
+ let i = n[e]?.[r] ?? [], o = Pn(i, u);
2549
2555
  a[e][r] = o, t.push(...i), !d[r] && d[r];
2550
2556
  }
2551
- o[e] = Mn(t, u);
2557
+ o[e] = Pn(t, u);
2552
2558
  }
2553
2559
  for (let e of i) {
2554
2560
  let t = [];
@@ -2556,7 +2562,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2556
2562
  let r = n[i]?.[e] ?? [];
2557
2563
  t.push(...r);
2558
2564
  }
2559
- d[e] = Mn(t, u);
2565
+ d[e] = Pn(t, u);
2560
2566
  }
2561
2567
  let f = [];
2562
2568
  for (let e of w) f.push(Number(e[l]) || 0);
@@ -2566,7 +2572,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2566
2572
  matrix: a,
2567
2573
  rowTotals: o,
2568
2574
  colTotals: d,
2569
- grandTotal: Mn(f, u)
2575
+ grandTotal: Pn(f, u)
2570
2576
  };
2571
2577
  }, [
2572
2578
  w,
@@ -2574,13 +2580,13 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2574
2580
  c,
2575
2581
  l,
2576
2582
  u
2577
- ]), k = (e) => On(e, m);
2578
- return jn.has(u) ? w.length === 0 ? /* @__PURE__ */ $("div", {
2583
+ ]), j = (e) => An(e, m);
2584
+ return Nn.has(u) ? w.length === 0 ? /* @__PURE__ */ $("div", {
2579
2585
  className: K("overflow-auto", t),
2580
2586
  children: [o && /* @__PURE__ */ Q("h3", {
2581
2587
  className: "text-sm font-semibold mb-2",
2582
2588
  children: o
2583
- }), /* @__PURE__ */ Q(R, {
2589
+ }), /* @__PURE__ */ Q(V, {
2584
2590
  "data-testid": "pivot-empty-state",
2585
2591
  className: "py-8 gap-2 [&>h3]:hidden",
2586
2592
  icon: /* @__PURE__ */ $("svg", {
@@ -2652,7 +2658,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2652
2658
  onClick: b ? t : void 0,
2653
2659
  onKeyDown: b ? S(t) : void 0,
2654
2660
  "aria-label": b ? `Drill into ${c}: ${e || "(empty)"}` : void 0,
2655
- children: An(e, r)
2661
+ children: Mn(e, r)
2656
2662
  }, e);
2657
2663
  }),
2658
2664
  f && /* @__PURE__ */ Q("th", {
@@ -2677,10 +2683,10 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2677
2683
  rowKey: e
2678
2684
  })) : void 0,
2679
2685
  "aria-label": b ? `Drill into ${s}: ${e || "(empty)"}` : void 0,
2680
- children: An(e, n)
2686
+ children: Mn(e, n)
2681
2687
  }),
2682
2688
  E.map((t) => {
2683
- let n = ee[e]?.[t] ?? 0, r = () => x({
2689
+ let n = D[e]?.[t] ?? 0, r = () => x({
2684
2690
  scope: "cell",
2685
2691
  rowKey: e,
2686
2692
  colKey: t,
@@ -2693,7 +2699,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2693
2699
  onClick: b ? r : void 0,
2694
2700
  onKeyDown: b ? S(r) : void 0,
2695
2701
  "aria-label": b ? `Drill into ${s}=${e || "(empty)"}, ${c}=${t || "(empty)"}` : void 0,
2696
- children: k(n)
2702
+ children: j(n)
2697
2703
  }, t);
2698
2704
  }),
2699
2705
  f && /* @__PURE__ */ Q("td", {
@@ -2703,14 +2709,14 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2703
2709
  onClick: b ? () => x({
2704
2710
  scope: "row",
2705
2711
  rowKey: e,
2706
- value: D[e] ?? 0
2712
+ value: O[e] ?? 0
2707
2713
  }) : void 0,
2708
2714
  onKeyDown: b ? S(() => x({
2709
2715
  scope: "row",
2710
2716
  rowKey: e,
2711
- value: D[e] ?? 0
2717
+ value: O[e] ?? 0
2712
2718
  })) : void 0,
2713
- children: k(D[e] ?? 0)
2719
+ children: j(O[e] ?? 0)
2714
2720
  })
2715
2721
  ]
2716
2722
  }, e)) }),
@@ -2728,14 +2734,14 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2728
2734
  onClick: b ? () => x({
2729
2735
  scope: "column",
2730
2736
  colKey: e,
2731
- value: O[e] ?? 0
2737
+ value: k[e] ?? 0
2732
2738
  }) : void 0,
2733
2739
  onKeyDown: b ? S(() => x({
2734
2740
  scope: "column",
2735
2741
  colKey: e,
2736
- value: O[e] ?? 0
2742
+ value: k[e] ?? 0
2737
2743
  })) : void 0,
2738
- children: k(O[e] ?? 0)
2744
+ children: j(k[e] ?? 0)
2739
2745
  }, e)),
2740
2746
  f && /* @__PURE__ */ Q("td", {
2741
2747
  className: K("text-right p-2 tabular-nums font-bold", C),
@@ -2743,13 +2749,13 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2743
2749
  tabIndex: b ? 0 : void 0,
2744
2750
  onClick: b ? () => x({
2745
2751
  scope: "total",
2746
- value: te
2752
+ value: A
2747
2753
  }) : void 0,
2748
2754
  onKeyDown: b ? S(() => x({
2749
2755
  scope: "total",
2750
- value: te
2756
+ value: A
2751
2757
  })) : void 0,
2752
- children: k(te)
2758
+ children: j(A)
2753
2759
  })
2754
2760
  ]
2755
2761
  }) })
@@ -2771,17 +2777,17 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2771
2777
  String(u),
2772
2778
  "” — this pivot table renders",
2773
2779
  " ",
2774
- [...jn].join(", "),
2780
+ [...Nn].join(", "),
2775
2781
  "."
2776
2782
  ]
2777
2783
  })
2778
2784
  })]
2779
2785
  });
2780
- }, Pn = ({ schema: e, dataSource: t, className: n }) => {
2781
- let r = Ae(T), i = t || r?.dataSource, a = ee(e.bind), [o, s] = Z([]), [c, l] = Z(!1), [d, p] = Z(null), [m, h] = Z({}), [_, v] = Z({}), [y, S] = Z(null), { fieldLabel: C, fieldOptionLabel: w } = ae(), E = je(C), D = je(w);
2786
+ }, In = ({ schema: e, dataSource: t, className: n }) => {
2787
+ let r = Me(D), i = t || r?.dataSource, a = k(e.bind), [o, s] = Z([]), [c, l] = Z(!1), [d, p] = Z(null), [m, h] = Z({}), [_, v] = Z({}), [y, b] = Z(null), { fieldLabel: x, fieldOptionLabel: w } = ie(), T = Ne(x), E = Ne(w);
2782
2788
  Y(() => {
2783
- E.current = C, D.current = w;
2784
- }, [C, w]), Y(() => {
2789
+ T.current = x, E.current = w;
2790
+ }, [x, w]), Y(() => {
2785
2791
  if (!i || !e.objectName) return;
2786
2792
  let t = i.getObjectSchema;
2787
2793
  if (typeof t != "function") return;
@@ -2791,13 +2797,13 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2791
2797
  let r = e.objectName, i = {}, a = {};
2792
2798
  for (let [e, n] of Object.entries(t.fields)) {
2793
2799
  let t = n?.label ? String(n.label) : e;
2794
- a[e] = E.current(r, e, t);
2800
+ a[e] = T.current(r, e, t);
2795
2801
  let o = n?.options;
2796
2802
  if (Array.isArray(o) && o.length > 0) {
2797
2803
  let t = {};
2798
2804
  for (let n of o) if (n && n.value !== void 0 && n.label !== void 0) {
2799
2805
  let i = String(n.value), a = String(n.label);
2800
- t[i] = D.current(r, e, i, a);
2806
+ t[i] = E.current(r, e, i, a);
2801
2807
  }
2802
2808
  Object.keys(t).length > 0 && (i[e] = t);
2803
2809
  }
@@ -2807,7 +2813,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2807
2813
  n = !1;
2808
2814
  };
2809
2815
  }, [i, e.objectName]);
2810
- let O = te();
2816
+ let O = ee();
2811
2817
  Y(() => {
2812
2818
  let t = !0;
2813
2819
  return e.objectName && !a && (!e.data || e.data.length === 0) && (async () => {
@@ -2815,8 +2821,10 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2815
2821
  t && (l(!0), p(null));
2816
2822
  try {
2817
2823
  let n;
2818
- if (typeof i.find == "function") n = f(await i.find(e.objectName, { $filter: x(e.filter, O) }));
2819
- else return;
2824
+ if (typeof i.find == "function") {
2825
+ let t = await i.find(e.objectName, { $filter: C(e.filter, O) });
2826
+ n = f(t);
2827
+ } else return;
2820
2828
  t && s(n);
2821
2829
  } catch (e) {
2822
2830
  console.error("[ObjectPivotTable] Fetch error:", e), t && p(e instanceof Error ? e.message : "Failed to load data");
@@ -2835,8 +2843,8 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2835
2843
  e.filter,
2836
2844
  O
2837
2845
  ]);
2838
- let k = a || e.data || o, ne = Array.isArray(k) ? k : [];
2839
- if (c && ne.length === 0) return /* @__PURE__ */ $("div", {
2846
+ let A = a || e.data || o, j = Array.isArray(A) ? A : [];
2847
+ if (c && j.length === 0) return /* @__PURE__ */ $("div", {
2840
2848
  className: K("overflow-auto", n),
2841
2849
  "data-testid": "pivot-loading",
2842
2850
  children: [e.title && /* @__PURE__ */ Q("h3", {
@@ -2910,7 +2918,7 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2910
2918
  })]
2911
2919
  })]
2912
2920
  });
2913
- if (!i && e.objectName && ne.length === 0) return /* @__PURE__ */ $("div", {
2921
+ if (!i && e.objectName && j.length === 0) return /* @__PURE__ */ $("div", {
2914
2922
  className: K("overflow-auto", n),
2915
2923
  children: [e.title && /* @__PURE__ */ Q("h3", {
2916
2924
  className: "text-sm font-semibold mb-2",
@@ -2927,40 +2935,40 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
2927
2935
  })
2928
2936
  })]
2929
2937
  });
2930
- let re = {
2938
+ let M = {
2931
2939
  ...e,
2932
- data: ne
2933
- }, A = e.rowField ? m[e.rowField] : void 0, ie = e.columnField ? m[e.columnField] : void 0, j = e.rowField ? _[e.rowField] : void 0, M = e.drillDown;
2934
- return /* @__PURE__ */ $(dt, { children: [/* @__PURE__ */ Q(Nn, {
2935
- schema: re,
2940
+ data: j
2941
+ }, te = e.rowField ? m[e.rowField] : void 0, ne = e.columnField ? m[e.columnField] : void 0, N = e.rowField ? _[e.rowField] : void 0, P = e.drillDown, F = g(P) ? (e) => b(e) : void 0;
2942
+ return /* @__PURE__ */ $(pt, { children: [/* @__PURE__ */ Q(Fn, {
2943
+ schema: M,
2936
2944
  className: n,
2937
- rowLabels: A,
2938
- columnLabels: ie,
2939
- rowFieldLabel: j,
2940
- onDrillDown: g(M) ? (e) => S(e) : void 0
2945
+ rowLabels: te,
2946
+ columnLabels: ne,
2947
+ rowFieldLabel: N,
2948
+ onDrillDown: F
2941
2949
  }), (() => {
2942
2950
  if (!y || !e.objectName) return null;
2943
- let t = u(M, y, {
2951
+ let t = u(P, y, {
2944
2952
  rowField: e.rowField,
2945
2953
  columnField: e.columnField
2946
2954
  }), n = {
2947
2955
  ...e.filter || {},
2948
2956
  ...t
2949
- };
2950
- return /* @__PURE__ */ Q(Lt, {
2957
+ }, r = S(P, y, e.title || "Details");
2958
+ return /* @__PURE__ */ Q(zt, {
2951
2959
  open: !0,
2952
- onClose: () => S(null),
2953
- title: b(M, y, e.title || "Details"),
2954
- target: M?.target ?? "drawer",
2960
+ onClose: () => b(null),
2961
+ title: r,
2962
+ target: P?.target ?? "drawer",
2955
2963
  objectName: e.objectName,
2956
2964
  filter: n,
2957
2965
  dataSource: i,
2958
- columns: M?.columns,
2959
- maxRows: M?.maxRows,
2960
- report: M?.report
2966
+ columns: P?.columns,
2967
+ maxRows: P?.maxRows,
2968
+ report: P?.report
2961
2969
  });
2962
2970
  })()] });
2963
- }, Fn = {
2971
+ }, Ln = {
2964
2972
  breadcrumb: ["Dashboard", "Configuration"],
2965
2973
  sections: [
2966
2974
  {
@@ -3086,12 +3094,12 @@ var Nn = ({ schema: e, className: t, rowLabels: n, columnLabels: r, rowFieldLabe
3086
3094
  }
3087
3095
  ]
3088
3096
  };
3089
- function In({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
3090
- let { draft: a, isDirty: o, updateField: s, discard: c } = Ee(n, { onUpdate: i });
3091
- return /* @__PURE__ */ Q(de, {
3097
+ function Rn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
3098
+ let { draft: a, isDirty: o, updateField: s, discard: c } = Oe(n, { onUpdate: i });
3099
+ return /* @__PURE__ */ Q(ue, {
3092
3100
  open: e,
3093
3101
  onClose: t,
3094
- schema: Fn,
3102
+ schema: Ln,
3095
3103
  draft: a,
3096
3104
  isDirty: o,
3097
3105
  onFieldChange: s,
@@ -3101,7 +3109,7 @@ function In({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i }) {
3101
3109
  }
3102
3110
  //#endregion
3103
3111
  //#region src/WidgetConfigPanel.tsx
3104
- var Ln = [
3112
+ var zn = [
3105
3113
  {
3106
3114
  value: "metric",
3107
3115
  label: "Metric"
@@ -3146,7 +3154,7 @@ var Ln = [
3146
3154
  value: "pivot",
3147
3155
  label: "Pivot Table"
3148
3156
  }
3149
- ], Rn = [
3157
+ ], Bn = [
3150
3158
  {
3151
3159
  value: "default",
3152
3160
  label: "Default"
@@ -3179,7 +3187,7 @@ var Ln = [
3179
3187
  value: "danger",
3180
3188
  label: "Danger"
3181
3189
  }
3182
- ], zn = [
3190
+ ], Vn = [
3183
3191
  "bar",
3184
3192
  "horizontal-bar",
3185
3193
  "line",
@@ -3188,20 +3196,20 @@ var Ln = [
3188
3196
  "donut",
3189
3197
  "scatter",
3190
3198
  "funnel"
3191
- ], Bn = [
3199
+ ], Hn = [
3192
3200
  "metric",
3193
3201
  "gauge",
3194
3202
  "solid-gauge",
3195
3203
  "kpi",
3196
3204
  "bullet"
3197
3205
  ];
3198
- function Vn(e) {
3199
- return !!e && zn.includes(e);
3206
+ function Un(e) {
3207
+ return !!e && Vn.includes(e);
3200
3208
  }
3201
- function Hn(e) {
3202
- return !!e && !Bn.includes(e);
3209
+ function Wn(e) {
3210
+ return !!e && !Hn.includes(e);
3203
3211
  }
3204
- function Un({ names: e, options: t, placeholder: n, emptyText: r, onChange: i }) {
3212
+ function Gn({ names: e, options: t, placeholder: n, emptyText: r, onChange: i }) {
3205
3213
  let [a, o] = q.useState(""), s = q.useMemo(() => new Set(e), [e]), c = q.useMemo(() => t.filter((e) => !s.has(e.value)), [t, s]), l = (t) => {
3206
3214
  let n = t.trim();
3207
3215
  !n || s.has(n) || (i([...e, n]), o(""));
@@ -3221,10 +3229,10 @@ function Un({ names: e, options: t, placeholder: n, emptyText: r, onChange: i })
3221
3229
  "aria-label": `Remove ${e}`,
3222
3230
  className: "text-muted-foreground hover:text-foreground",
3223
3231
  onClick: () => u(e),
3224
- children: /* @__PURE__ */ Q(Je, { className: "h-3 w-3" })
3232
+ children: /* @__PURE__ */ Q(Xe, { className: "h-3 w-3" })
3225
3233
  })]
3226
3234
  }, e))
3227
- }), c.length > 0 ? /* @__PURE__ */ Q(ue, {
3235
+ }), c.length > 0 ? /* @__PURE__ */ Q(le, {
3228
3236
  options: c,
3229
3237
  value: "",
3230
3238
  onValueChange: l,
@@ -3242,7 +3250,7 @@ function Un({ names: e, options: t, placeholder: n, emptyText: r, onChange: i })
3242
3250
  },
3243
3251
  placeholder: n,
3244
3252
  className: "h-7 flex-1 text-xs"
3245
- }), /* @__PURE__ */ Q(P, {
3253
+ }), /* @__PURE__ */ Q(L, {
3246
3254
  type: "button",
3247
3255
  size: "sm",
3248
3256
  variant: "outline",
@@ -3254,7 +3262,7 @@ function Un({ names: e, options: t, placeholder: n, emptyText: r, onChange: i })
3254
3262
  })]
3255
3263
  });
3256
3264
  }
3257
- function Wn(e, t) {
3265
+ function Kn(e, t) {
3258
3266
  let n = e ?? [], r = n.length > 0, i = n.map((e) => ({
3259
3267
  value: e.name,
3260
3268
  label: e.label && e.label !== e.name ? `${e.label} (${e.name})` : e.name
@@ -3263,11 +3271,11 @@ function Wn(e, t) {
3263
3271
  label: "Dataset",
3264
3272
  type: "custom",
3265
3273
  helpText: "The semantic-layer dataset this widget binds to (ADR-0021).",
3266
- render: (e, t) => /* @__PURE__ */ Q(L, {
3274
+ render: (e, t) => /* @__PURE__ */ Q(B, {
3267
3275
  label: "Dataset",
3268
3276
  children: /* @__PURE__ */ Q("div", {
3269
3277
  "data-testid": "config-field-dataset",
3270
- children: /* @__PURE__ */ Q(ue, {
3278
+ children: /* @__PURE__ */ Q(le, {
3271
3279
  options: i,
3272
3280
  value: e ?? "",
3273
3281
  onValueChange: t,
@@ -3288,19 +3296,19 @@ function Wn(e, t) {
3288
3296
  key: "dimensions",
3289
3297
  label: "Dimensions",
3290
3298
  type: "custom",
3291
- visibleWhen: (e) => Hn(e.type),
3299
+ visibleWhen: (e) => Wn(e.type),
3292
3300
  helpText: t === "pivot" ? "Group/split fields. The last dimension spreads across as columns." : "Group/split the values by these dataset dimensions.",
3293
3301
  render: (e, t, n) => {
3294
3302
  let r = (a(n.dataset)?.dimensions ?? []).map((e) => ({
3295
3303
  value: e.name,
3296
3304
  label: e.label && e.label !== e.name ? `${e.label} (${e.name})` : e.name
3297
3305
  }));
3298
- return /* @__PURE__ */ Q(L, {
3306
+ return /* @__PURE__ */ Q(B, {
3299
3307
  label: "Dimensions",
3300
3308
  children: /* @__PURE__ */ Q("div", {
3301
3309
  "data-testid": "config-field-dimensions",
3302
3310
  className: "w-40",
3303
- children: /* @__PURE__ */ Q(Un, {
3311
+ children: /* @__PURE__ */ Q(Gn, {
3304
3312
  names: Array.isArray(e) ? e : [],
3305
3313
  options: r,
3306
3314
  placeholder: "Add dimension…",
@@ -3315,7 +3323,7 @@ function Wn(e, t) {
3315
3323
  breadcrumb: ["Dashboard", {
3316
3324
  pivot: "Pivot table",
3317
3325
  table: "Table"
3318
- }[t ?? ""] ?? (Vn(t) ? "Chart" : "Widget")],
3326
+ }[t ?? ""] ?? (Un(t) ? "Chart" : "Widget")],
3319
3327
  sections: [
3320
3328
  {
3321
3329
  key: "general",
@@ -3337,7 +3345,7 @@ function Wn(e, t) {
3337
3345
  key: "type",
3338
3346
  label: "Widget type",
3339
3347
  type: "select",
3340
- options: Ln,
3348
+ options: zn,
3341
3349
  defaultValue: "metric"
3342
3350
  }
3343
3351
  ]
@@ -3359,12 +3367,12 @@ function Wn(e, t) {
3359
3367
  value: e.name,
3360
3368
  label: e.aggregate ? `${e.label ?? e.name} · ${e.aggregate}` : e.label ?? e.name
3361
3369
  }));
3362
- return /* @__PURE__ */ Q(L, {
3370
+ return /* @__PURE__ */ Q(B, {
3363
3371
  label: "Values",
3364
3372
  children: /* @__PURE__ */ Q("div", {
3365
3373
  "data-testid": "config-field-values",
3366
3374
  className: "w-40",
3367
- children: /* @__PURE__ */ Q(Un, {
3375
+ children: /* @__PURE__ */ Q(Gn, {
3368
3376
  names: Array.isArray(e) ? e : [],
3369
3377
  options: r,
3370
3378
  placeholder: "Add measure…",
@@ -3420,14 +3428,14 @@ function Wn(e, t) {
3420
3428
  key: "colorVariant",
3421
3429
  label: "Color variant",
3422
3430
  type: "select",
3423
- options: Rn,
3431
+ options: Bn,
3424
3432
  defaultValue: "default"
3425
3433
  }]
3426
3434
  }
3427
3435
  ]
3428
3436
  };
3429
3437
  }
3430
- function Gn(e) {
3438
+ function qn(e) {
3431
3439
  if (e == null) return "";
3432
3440
  if (typeof e == "string") return e;
3433
3441
  if (typeof e == "object") {
@@ -3436,7 +3444,7 @@ function Gn(e) {
3436
3444
  }
3437
3445
  return String(e);
3438
3446
  }
3439
- var Kn = [
3447
+ var Jn = [
3440
3448
  "object",
3441
3449
  "categoryField",
3442
3450
  "categoryGranularity",
@@ -3463,32 +3471,32 @@ var Kn = [
3463
3471
  "searchable",
3464
3472
  "pagination"
3465
3473
  ];
3466
- function qn(e) {
3474
+ function Yn(e) {
3467
3475
  let t = e.type, n = { ...e };
3468
- for (let e of Kn) delete n[e];
3469
- return Hn(t) || delete n.dimensions, n;
3476
+ for (let e of Jn) delete n[e];
3477
+ return Wn(t) || delete n.dimensions, n;
3470
3478
  }
3471
- function Jn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, datasets: o, datasetsLoading: s }) {
3472
- let { draft: c, isDirty: l, updateField: u, discard: d } = Ee(q.useMemo(() => ({
3479
+ function Xn({ open: e, onClose: t, config: n, onSave: r, onFieldChange: i, headerExtra: a, datasets: o, datasetsLoading: s }) {
3480
+ let c = q.useMemo(() => ({
3473
3481
  ...n,
3474
- title: typeof n.title == "object" ? Gn(n.title) : n.title,
3475
- description: typeof n.description == "object" ? Gn(n.description) : n.description
3476
- }), [n]), { onUpdate: i });
3477
- return /* @__PURE__ */ Q(de, {
3482
+ title: typeof n.title == "object" ? qn(n.title) : n.title,
3483
+ description: typeof n.description == "object" ? qn(n.description) : n.description
3484
+ }), [n]), { draft: l, isDirty: u, updateField: d, discard: f } = Oe(c, { onUpdate: i }), p = q.useMemo(() => Kn(o, l.type), [o, l.type]);
3485
+ return /* @__PURE__ */ Q(ue, {
3478
3486
  open: e,
3479
3487
  onClose: t,
3480
- schema: q.useMemo(() => Wn(o, c.type), [o, c.type]),
3481
- draft: c,
3482
- isDirty: l,
3483
- onFieldChange: u,
3484
- onSave: () => r(qn(c)),
3485
- onDiscard: d,
3488
+ schema: p,
3489
+ draft: l,
3490
+ isDirty: u,
3491
+ onFieldChange: d,
3492
+ onSave: () => r(Yn(l)),
3493
+ onDiscard: f,
3486
3494
  headerExtra: a
3487
3495
  });
3488
3496
  }
3489
3497
  //#endregion
3490
3498
  //#region src/DashboardWithConfig.tsx
3491
- function Yn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s, datasets: c, datasetsLoading: l }) {
3499
+ function Zn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh: i, recordCount: a, defaultConfigOpen: o = !1, className: s, datasets: c, datasetsLoading: l }) {
3492
3500
  let [u, d] = Z(o), [f, p] = Z(null), [m, h] = Z(e), [g, _] = Z(0);
3493
3501
  Y(() => {
3494
3502
  h(e), _((e) => e + 1);
@@ -3547,14 +3555,14 @@ function Yn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3547
3555
  className: "flex-1 min-w-0 overflow-auto relative",
3548
3556
  children: [/* @__PURE__ */ Q("div", {
3549
3557
  className: "absolute top-2 right-2 z-10",
3550
- children: /* @__PURE__ */ $(P, {
3558
+ children: /* @__PURE__ */ $(L, {
3551
3559
  size: "sm",
3552
3560
  variant: u ? "default" : "outline",
3553
3561
  onClick: C,
3554
3562
  "data-testid": "dashboard-config-toggle",
3555
- children: [/* @__PURE__ */ Q(qe, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
3563
+ children: [/* @__PURE__ */ Q(Ye, { className: "h-3.5 w-3.5 mr-1" }), "Settings"]
3556
3564
  })
3557
- }), /* @__PURE__ */ Q(un, {
3565
+ }), /* @__PURE__ */ Q(fn, {
3558
3566
  schema: m,
3559
3567
  onRefresh: i,
3560
3568
  recordCount: a,
@@ -3564,7 +3572,7 @@ function Yn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3564
3572
  })]
3565
3573
  }), u && /* @__PURE__ */ Q("div", {
3566
3574
  className: "relative shrink-0",
3567
- children: f && v ? /* @__PURE__ */ Q(Jn, {
3575
+ children: f && v ? /* @__PURE__ */ Q(Xn, {
3568
3576
  open: !0,
3569
3577
  onClose: b,
3570
3578
  config: v,
@@ -3572,7 +3580,7 @@ function Yn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3572
3580
  onFieldChange: x,
3573
3581
  datasets: c,
3574
3582
  datasetsLoading: l
3575
- }) : /* @__PURE__ */ Q(In, {
3583
+ }) : /* @__PURE__ */ Q(Rn, {
3576
3584
  open: !0,
3577
3585
  onClose: () => d(!1),
3578
3586
  config: t,
@@ -3581,7 +3589,7 @@ function Yn({ schema: e, config: t, onConfigSave: n, onWidgetSave: r, onRefresh:
3581
3589
  })]
3582
3590
  });
3583
3591
  }
3584
- e.register("dashboard", un, {
3592
+ e.register("dashboard", fn, {
3585
3593
  namespace: "view",
3586
3594
  label: "Dashboard",
3587
3595
  category: "Complex",
@@ -3609,7 +3617,7 @@ e.register("dashboard", un, {
3609
3617
  columns: 3,
3610
3618
  widgets: []
3611
3619
  }
3612
- }), e.register("metric", Sn, {
3620
+ }), e.register("metric", wn, {
3613
3621
  namespace: "plugin-dashboard",
3614
3622
  label: "Metric Widget",
3615
3623
  category: "Dashboard",
@@ -3622,7 +3630,7 @@ e.register("dashboard", un, {
3622
3630
  type: "string",
3623
3631
  label: "Value"
3624
3632
  }]
3625
- }), e.register("metric-card", wn, {
3633
+ }), e.register("metric-card", En, {
3626
3634
  namespace: "plugin-dashboard",
3627
3635
  label: "Metric Card",
3628
3636
  category: "Dashboard",
@@ -3677,7 +3685,7 @@ e.register("dashboard", un, {
3677
3685
  title: "Metric",
3678
3686
  value: "0"
3679
3687
  }
3680
- }), e.register("object-metric", Tn, {
3688
+ }), e.register("object-metric", Dn, {
3681
3689
  namespace: "plugin-dashboard",
3682
3690
  label: "Object Metric",
3683
3691
  category: "Dashboard",
@@ -3706,7 +3714,7 @@ e.register("dashboard", un, {
3706
3714
  }
3707
3715
  ],
3708
3716
  defaultProps: { label: "Metric" }
3709
- }), e.register("pivot", Nn, {
3717
+ }), e.register("pivot", Fn, {
3710
3718
  namespace: "plugin-dashboard",
3711
3719
  label: "Pivot Table",
3712
3720
  category: "Dashboard",
@@ -3785,7 +3793,7 @@ e.register("dashboard", un, {
3785
3793
  aggregation: "sum",
3786
3794
  data: []
3787
3795
  }
3788
- }), e.register("object-pivot", Pn, {
3796
+ }), e.register("object-pivot", In, {
3789
3797
  namespace: "plugin-dashboard",
3790
3798
  label: "Object Pivot Table",
3791
3799
  category: "Dashboard",
@@ -3874,7 +3882,7 @@ e.register("dashboard", un, {
3874
3882
  valueField: "",
3875
3883
  aggregation: "sum"
3876
3884
  }
3877
- }), e.register("dashboard-grid", hn, {
3885
+ }), e.register("dashboard-grid", _n, {
3878
3886
  namespace: "plugin-dashboard",
3879
3887
  label: "Dashboard Grid (Editable)",
3880
3888
  category: "Complex",
@@ -3892,7 +3900,7 @@ e.register("dashboard", un, {
3892
3900
  title: "Dashboard",
3893
3901
  widgets: []
3894
3902
  }
3895
- }), e.register("object-data-table", Ft, {
3903
+ }), e.register("object-data-table", Lt, {
3896
3904
  namespace: "plugin-dashboard",
3897
3905
  label: "Object Data Table",
3898
3906
  category: "Dashboard",
@@ -3930,18 +3938,18 @@ e.register("dashboard", un, {
3930
3938
  pagination: !1
3931
3939
  }
3932
3940
  });
3933
- var Xn = {
3934
- DashboardRenderer: un,
3935
- DashboardGridLayout: hn,
3936
- MetricWidget: Sn,
3937
- MetricCard: wn,
3938
- ObjectMetricWidget: Tn,
3939
- PivotTable: Nn,
3940
- ObjectPivotTable: Pn,
3941
- ObjectDataTable: Ft,
3942
- DashboardConfigPanel: In,
3943
- WidgetConfigPanel: Jn,
3944
- DashboardWithConfig: Yn
3941
+ var Qn = {
3942
+ DashboardRenderer: fn,
3943
+ DashboardGridLayout: _n,
3944
+ MetricWidget: wn,
3945
+ MetricCard: En,
3946
+ ObjectMetricWidget: Dn,
3947
+ PivotTable: Fn,
3948
+ ObjectPivotTable: In,
3949
+ ObjectDataTable: Lt,
3950
+ DashboardConfigPanel: Rn,
3951
+ WidgetConfigPanel: Xn,
3952
+ DashboardWithConfig: Zn
3945
3953
  };
3946
3954
  //#endregion
3947
- export { In as DashboardConfigPanel, hn as DashboardGridLayout, un as DashboardRenderer, Yn as DashboardWithConfig, Lt as DrillDownDrawer, wn as MetricCard, Sn as MetricWidget, Ft as ObjectDataTable, Tn as ObjectMetricWidget, Pn as ObjectPivotTable, Nn as PivotTable, Jn as WidgetConfigPanel, Xn as dashboardComponents };
3955
+ export { Rn as DashboardConfigPanel, _n as DashboardGridLayout, fn as DashboardRenderer, Zn as DashboardWithConfig, zt as DrillDownDrawer, En as MetricCard, wn as MetricWidget, Lt as ObjectDataTable, Dn as ObjectMetricWidget, In as ObjectPivotTable, Fn as PivotTable, Xn as WidgetConfigPanel, Qn as dashboardComponents };