@object-ui/plugin-charts 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
@@ -2,86 +2,86 @@ import { ComponentRegistry as e, buildCategoryRank as t, buildChartSeries as n,
2
2
  import * as m from "react";
3
3
  import h, { Suspense as g, useCallback as ee, useContext as te, useEffect as ne, useMemo as _, useRef as re, useState as v } from "react";
4
4
  import { Button as ie, ChartSkeleton as y, Dialog as ae, DialogContent as b, DialogHeader as x, DialogTitle as S, RefreshIndicator as C, Sheet as oe, SheetContent as se, SheetHeader as ce, SheetTitle as le, Skeleton as ue } from "@object-ui/components";
5
- import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
6
- import { Area as de, AreaChart as fe, Bar as pe, BarChart as D, Brush as me, CartesianGrid as he, Cell as O, ComposedChart as ge, Funnel as _e, FunnelChart as ve, LabelList as ye, Legend as k, Line as be, LineChart as xe, Pie as Se, PieChart as Ce, PolarAngleAxis as we, PolarGrid as Te, PolarRadiusAxis as Ee, Radar as De, RadarChart as Oe, ReferenceArea as ke, ReferenceLine as Ae, ResponsiveContainer as A, Sankey as je, Scatter as Me, ScatterChart as j, Tooltip as M, Treemap as Ne, XAxis as N, YAxis as P, ZAxis as Pe } from "recharts";
7
- import { SchemaRenderer as Fe, SchemaRendererContext as Ie, useDataScope as Le, useDrillNavigation as Re, useFilterScope as ze } from "@object-ui/react";
8
- import { AlertCircle as Be, ArrowUpRight as Ve } from "lucide-react";
9
- import { useSafeFieldLabel as He, useSafeTranslate as F } from "@object-ui/i18n";
5
+ import { Fragment as de, jsx as w, jsxs as T } from "react/jsx-runtime";
6
+ import { Area as fe, AreaChart as pe, Bar as me, BarChart as E, Brush as he, CartesianGrid as ge, Cell as D, ComposedChart as _e, Funnel as ve, FunnelChart as O, LabelList as k, Legend as A, Line as ye, LineChart as be, Pie as xe, PieChart as Se, PolarAngleAxis as Ce, PolarGrid as we, PolarRadiusAxis as Te, Radar as Ee, RadarChart as De, ReferenceArea as Oe, ReferenceLine as ke, ResponsiveContainer as Ae, Sankey as je, Scatter as Me, ScatterChart as j, Tooltip as M, Treemap as N, XAxis as P, YAxis as F, ZAxis as Ne } from "recharts";
7
+ import { SchemaRenderer as Pe, SchemaRendererContext as Fe, useDataScope as Ie, useDrillNavigation as Le, useFilterScope as Re } from "@object-ui/react";
8
+ import { AlertCircle as ze, ArrowUpRight as Be } from "lucide-react";
9
+ import { useSafeFieldLabel as Ve, useSafeTranslate as I } from "@object-ui/i18n";
10
10
  //#region \0rolldown/runtime.js
11
- var I = Object.defineProperty, L = (e, t, n) => () => {
11
+ var L = Object.defineProperty, R = (e, t, n) => () => {
12
12
  if (n) throw n[0];
13
13
  try {
14
14
  return e && (t = e(e = 0)), t;
15
15
  } catch (e) {
16
16
  throw n = [e], e;
17
17
  }
18
- }, R = (e, t) => {
18
+ }, z = (e, t) => {
19
19
  let n = {};
20
- for (var r in e) I(n, r, {
20
+ for (var r in e) L(n, r, {
21
21
  get: e[r],
22
22
  enumerable: !0
23
23
  });
24
- return t || I(n, Symbol.toStringTag, { value: "Module" }), n;
24
+ return t || L(n, Symbol.toStringTag, { value: "Module" }), n;
25
25
  };
26
26
  //#endregion
27
27
  //#region src/normalizeChartSchema.ts
28
- function z(e) {
29
- let t = W(e);
28
+ function B(e) {
29
+ let t = G(e);
30
30
  if (t) return t;
31
- if (U(e)) return Object.values(e).find((e) => typeof e == "string" && e);
31
+ if (W(e)) return Object.values(e).find((e) => typeof e == "string" && e);
32
32
  }
33
- function B(e) {
34
- if (!U(e)) return;
35
- let t = {}, n = W(e.field);
33
+ function V(e) {
34
+ if (!W(e)) return;
35
+ let t = {}, n = G(e.field);
36
36
  n && (t.field = n);
37
- let r = W(e.format);
37
+ let r = G(e.format);
38
38
  r && (t.format = r);
39
- let i = G(e.min);
39
+ let i = K(e.min);
40
40
  i !== void 0 && (t.min = i);
41
- let a = G(e.max);
41
+ let a = K(e.max);
42
42
  a !== void 0 && (t.max = a);
43
- let o = G(e.stepSize);
43
+ let o = K(e.stepSize);
44
44
  o !== void 0 && o > 0 && (t.stepSize = o), typeof e.showGridLines == "boolean" && (t.showGridLines = e.showGridLines), typeof e.logarithmic == "boolean" && (t.logarithmic = e.logarithmic);
45
- let s = W(e.position);
45
+ let s = G(e.position);
46
46
  (s === "left" || s === "right" || s === "top" || s === "bottom") && (t.position = s);
47
- let c = z(e.title);
47
+ let c = B(e.title);
48
48
  return c && (t.title = c), t;
49
49
  }
50
- function V(e) {
51
- if (!U(e)) {
52
- let t = W(e);
50
+ function H(e) {
51
+ if (!W(e)) {
52
+ let t = G(e);
53
53
  return t ? { dataKey: t } : void 0;
54
54
  }
55
- let t = W(e.dataKey) ?? W(e.name);
55
+ let t = G(e.dataKey) ?? G(e.name);
56
56
  if (!t) return;
57
- let n = { dataKey: t }, r = z(e.label);
57
+ let n = { dataKey: t }, r = B(e.label);
58
58
  r && (n.label = r);
59
- let i = W(e.chartType) ?? W(e.type);
59
+ let i = G(e.chartType) ?? G(e.type);
60
60
  (i === "bar" || i === "line" || i === "area") && (n.chartType = i);
61
- let a = W(e.variant);
61
+ let a = G(e.variant);
62
62
  (a === "comparison" || a === "current" || a === "primary") && (n.variant = a);
63
- let o = G(e.opacity);
63
+ let o = K(e.opacity);
64
64
  o !== void 0 && (n.opacity = o);
65
- let s = W(e.dashArray);
65
+ let s = G(e.dashArray);
66
66
  s && (n.dashArray = s);
67
- let c = W(e.stack);
67
+ let c = G(e.stack);
68
68
  c && (n.stack = c);
69
- let l = W(e.yAxis);
69
+ let l = G(e.yAxis);
70
70
  (l === "left" || l === "right") && (n.yAxis = l);
71
- let u = W(e.color);
71
+ let u = G(e.color);
72
72
  return u && (n.color = u), n;
73
73
  }
74
- function Ue(e) {
75
- if (!U(e)) return {};
76
- let t = {}, n = W(e.type), r = W(e.chartType) ?? W(e.specType) ?? (n && Ze.has(n) ? n : void 0);
77
- r && Je.has(r) && (t.chartType = r);
78
- let i = e.xAxis, a = B(i);
74
+ function He(e) {
75
+ if (!W(e)) return {};
76
+ let t = {}, n = G(e.type), r = G(e.chartType) ?? G(e.specType) ?? (n && Xe.has(n) ? n : void 0);
77
+ r && qe.has(r) && (t.chartType = r);
78
+ let i = e.xAxis, a = V(i);
79
79
  a && (a.format || a.title || a.showGridLines !== void 0) && (t.xAxis = a);
80
- let o = W(e.xAxisKey) ?? a?.field ?? W(i);
80
+ let o = G(e.xAxisKey) ?? a?.field ?? G(i);
81
81
  o && (t.xAxisKey = o);
82
- let s = (Array.isArray(e.yAxis) ? e.yAxis : e.yAxis === void 0 ? [] : [e.yAxis]).map((e) => B(e) ?? (W(e) ? { field: W(e) } : void 0)).filter((e) => !!e);
82
+ let s = (Array.isArray(e.yAxis) ? e.yAxis : e.yAxis === void 0 ? [] : [e.yAxis]).map((e) => V(e) ?? (G(e) ? { field: G(e) } : void 0)).filter((e) => !!e);
83
83
  s.length && (t.yAxes = s);
84
- let c = (Array.isArray(e.series) ? e.series : Array.isArray(e.categories) ? e.categories : void 0)?.map(V).filter((e) => !!e);
84
+ let c = (Array.isArray(e.series) ? e.series : Array.isArray(e.categories) ? e.categories : void 0)?.map(H).filter((e) => !!e);
85
85
  if (!c?.length) {
86
86
  let e = s.filter((e) => e.field).map((e, t) => ({
87
87
  dataKey: e.field,
@@ -91,28 +91,28 @@ function Ue(e) {
91
91
  e.length && (c = e);
92
92
  }
93
93
  c?.length && (t.series = c), typeof e.showLegend == "boolean" && (t.showLegend = e.showLegend), typeof e.showDataLabels == "boolean" && (t.showDataLabels = e.showDataLabels);
94
- let l = z(e.title);
94
+ let l = B(e.title);
95
95
  l && (t.title = l);
96
- let u = z(e.subtitle);
96
+ let u = B(e.subtitle);
97
97
  u && (t.subtitle = u);
98
- let d = z(e.description);
98
+ let d = B(e.description);
99
99
  d && (t.description = d);
100
- let f = G(e.height);
101
- return f !== void 0 && f > 0 && (t.height = f), Array.isArray(e.annotations) && e.annotations.length && (t.annotations = e.annotations.filter(U)), U(e.interaction) && (t.interaction = e.interaction), t;
100
+ let f = K(e.height);
101
+ return f !== void 0 && f > 0 && (t.height = f), Array.isArray(e.annotations) && e.annotations.length && (t.annotations = e.annotations.filter(W)), W(e.interaction) && (t.interaction = e.interaction), t;
102
102
  }
103
- function We(e) {
103
+ function Ue(e) {
104
104
  if (e === "bar" || e === "column") return "bar";
105
105
  if (e === "line") return "line";
106
106
  if (e === "area") return "area";
107
107
  }
108
- function Ge(e, t) {
108
+ function We(e, t) {
109
109
  if (e === "combo") return "combo";
110
- let n = We(e);
110
+ let n = Ue(e);
111
111
  if (!n || !t || t.length < 2) return e;
112
112
  let r = t.map((e) => e.chartType ?? n);
113
113
  return new Set(r).size > 1 ? "combo" : e;
114
114
  }
115
- function H(e) {
115
+ function U(e) {
116
116
  if (!e) return;
117
117
  let t = e.includes("%"), n = /^([$£€¥₹])/.exec(e), r = e.includes(","), i = /\.(0+)/.exec(e)?.[1].length ?? 0, a = {
118
118
  $: "USD",
@@ -137,24 +137,24 @@ function H(e) {
137
137
  }
138
138
  };
139
139
  }
140
- function Ke(e, t) {
140
+ function Ge(e, t) {
141
141
  let n = e?.stepSize;
142
142
  if (!n || n <= 0) return;
143
143
  let r = t.filter((e) => Number.isFinite(e)), i = r.length ? Math.min(...r) : void 0, a = r.length ? Math.max(...r) : void 0, o = e.min ?? Math.min(0, i ?? 0), s = e.max ?? a;
144
144
  if (s === void 0 || !Number.isFinite(o) || !Number.isFinite(s) || s < o) return;
145
145
  let c = Math.floor(o / n) * n, l = e.max === void 0 ? Math.ceil(s / n) * n : e.max, u = Math.floor((l - c) / n + 1e-9) + 1;
146
- if (u < 1 || u > Qe) return;
146
+ if (u < 1 || u > Ze) return;
147
147
  let d = [];
148
148
  for (let e = 0; e < u; e++) d.push(Number((c + e * n).toPrecision(12)));
149
149
  return e.max !== void 0 && d[d.length - 1] < e.max && d.push(e.max), d;
150
150
  }
151
- function qe(e) {
151
+ function Ke(e) {
152
152
  if (!e) return;
153
153
  let { min: t, max: n } = e;
154
- if (!(t === void 0 && n === void 0)) return [t ?? "auto", n ?? "auto"];
154
+ if (t !== void 0 || n !== void 0) return [t ?? "auto", n ?? "auto"];
155
155
  }
156
- var Je, Ye, Xe, Ze, U, W, G, Qe, $e = L((() => {
157
- Je = /* @__PURE__ */ new Set([
156
+ var qe, Je, Ye, Xe, W, G, K, Ze, Qe = R((() => {
157
+ qe = /* @__PURE__ */ new Set([
158
158
  "bar",
159
159
  "column",
160
160
  "horizontal-bar",
@@ -168,44 +168,44 @@ var Je, Ye, Xe, Ze, U, W, G, Qe, $e = L((() => {
168
168
  "treemap",
169
169
  "sankey",
170
170
  "combo"
171
- ]), Ye = /* @__PURE__ */ new Set([
171
+ ]), Je = /* @__PURE__ */ new Set([
172
172
  "gauge",
173
173
  "solid-gauge",
174
174
  "metric",
175
175
  "kpi",
176
176
  "bullet"
177
- ]), Xe = /* @__PURE__ */ new Set(["table", "pivot"]), Ze = /* @__PURE__ */ new Set([
177
+ ]), Ye = /* @__PURE__ */ new Set(["table", "pivot"]), Xe = /* @__PURE__ */ new Set([
178
+ ...qe,
178
179
  ...Je,
179
- ...Ye,
180
- ...Xe
181
- ]), U = (e) => !!e && typeof e == "object" && !Array.isArray(e), W = (e) => typeof e == "string" && e ? e : void 0, G = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, Qe = 200;
182
- })), et = /* @__PURE__ */ R({ default: () => nt });
183
- function tt(e, t = 14) {
180
+ ...Ye
181
+ ]), W = (e) => !!e && typeof e == "object" && !Array.isArray(e), G = (e) => typeof e == "string" && e ? e : void 0, K = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, Ze = 200;
182
+ })), $e = /* @__PURE__ */ z({ default: () => tt });
183
+ function et(e, t = 14) {
184
184
  return e.length > t ? `${e.slice(0, t - 1)}…` : e;
185
185
  }
186
- function K({ x: e, y: t, payload: n }) {
187
- let r = String(n?.value ?? ""), i = tt(r);
188
- return /* @__PURE__ */ T("g", {
186
+ function q({ x: e, y: t, payload: n }) {
187
+ let r = String(n?.value ?? ""), i = et(r);
188
+ return /* @__PURE__ */ w("g", {
189
189
  transform: `translate(${e},${t})`,
190
- children: /* @__PURE__ */ E("text", {
190
+ children: /* @__PURE__ */ T("text", {
191
191
  dy: 10,
192
192
  textAnchor: "end",
193
193
  transform: "rotate(-32)",
194
194
  fill: "hsl(var(--muted-foreground))",
195
195
  fontSize: 11,
196
196
  fontFamily: "monospace",
197
- children: [r !== i && /* @__PURE__ */ T("title", { children: r }), i]
197
+ children: [r !== i && /* @__PURE__ */ w("title", { children: r }), i]
198
198
  })
199
199
  });
200
200
  }
201
- function nt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
201
+ function tt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
202
202
  let o = e.map((e) => String(e?.[n] ?? "")), s = o.length > 4 || o.some((e) => e.length > 8);
203
- return /* @__PURE__ */ T("div", {
203
+ return /* @__PURE__ */ w("div", {
204
204
  className: `p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${i}`,
205
- children: /* @__PURE__ */ T(A, {
205
+ children: /* @__PURE__ */ w(Ae, {
206
206
  width: "100%",
207
207
  height: r,
208
- children: /* @__PURE__ */ E(D, {
208
+ children: /* @__PURE__ */ T(E, {
209
209
  data: e,
210
210
  margin: {
211
211
  top: 10,
@@ -214,66 +214,66 @@ function nt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
214
214
  bottom: s ? 24 : 5
215
215
  },
216
216
  children: [
217
- /* @__PURE__ */ E("defs", { children: [/* @__PURE__ */ E("linearGradient", {
217
+ /* @__PURE__ */ T("defs", { children: [/* @__PURE__ */ T("linearGradient", {
218
218
  id: "barGradient",
219
219
  x1: "0",
220
220
  y1: "0",
221
221
  x2: "0",
222
222
  y2: "1",
223
223
  children: [
224
- /* @__PURE__ */ T("stop", {
224
+ /* @__PURE__ */ w("stop", {
225
225
  offset: "0%",
226
226
  stopColor: a,
227
227
  stopOpacity: 1
228
228
  }),
229
- /* @__PURE__ */ T("stop", {
229
+ /* @__PURE__ */ w("stop", {
230
230
  offset: "90%",
231
231
  stopColor: a,
232
232
  stopOpacity: .6
233
233
  }),
234
- /* @__PURE__ */ T("stop", {
234
+ /* @__PURE__ */ w("stop", {
235
235
  offset: "100%",
236
236
  stopColor: a,
237
237
  stopOpacity: .3
238
238
  })
239
239
  ]
240
- }), /* @__PURE__ */ E("filter", {
240
+ }), /* @__PURE__ */ T("filter", {
241
241
  id: "glow",
242
242
  height: "130%",
243
243
  children: [
244
- /* @__PURE__ */ T("feGaussianBlur", {
244
+ /* @__PURE__ */ w("feGaussianBlur", {
245
245
  in: "SourceAlpha",
246
246
  stdDeviation: "3",
247
247
  result: "blur"
248
248
  }),
249
- /* @__PURE__ */ T("feOffset", {
249
+ /* @__PURE__ */ w("feOffset", {
250
250
  in: "blur",
251
251
  dx: "0",
252
252
  dy: "0",
253
253
  result: "offsetBlur"
254
254
  }),
255
- /* @__PURE__ */ T("feFlood", {
255
+ /* @__PURE__ */ w("feFlood", {
256
256
  floodColor: a,
257
257
  floodOpacity: "0.5",
258
258
  result: "offsetColor"
259
259
  }),
260
- /* @__PURE__ */ T("feComposite", {
260
+ /* @__PURE__ */ w("feComposite", {
261
261
  in: "offsetColor",
262
262
  in2: "offsetBlur",
263
263
  operator: "in",
264
264
  result: "offsetBlur"
265
265
  }),
266
- /* @__PURE__ */ E("feMerge", { children: [/* @__PURE__ */ T("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ T("feMergeNode", { in: "SourceGraphic" })] })
266
+ /* @__PURE__ */ T("feMerge", { children: [/* @__PURE__ */ w("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ w("feMergeNode", { in: "SourceGraphic" })] })
267
267
  ]
268
268
  })] }),
269
- /* @__PURE__ */ T(he, {
269
+ /* @__PURE__ */ w(ge, {
270
270
  strokeDasharray: "3 3",
271
271
  stroke: "hsl(var(--border))",
272
272
  vertical: !1
273
273
  }),
274
- /* @__PURE__ */ T(N, {
274
+ /* @__PURE__ */ w(P, {
275
275
  dataKey: n,
276
- tick: s ? /* @__PURE__ */ T(K, {}) : {
276
+ tick: s ? /* @__PURE__ */ w(q, {}) : {
277
277
  fill: "hsl(var(--muted-foreground))",
278
278
  fontSize: 12,
279
279
  fontFamily: "monospace"
@@ -284,7 +284,7 @@ function nt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
284
284
  height: s ? 56 : void 0,
285
285
  dy: s ? void 0 : 10
286
286
  }),
287
- /* @__PURE__ */ T(P, {
287
+ /* @__PURE__ */ w(F, {
288
288
  tick: {
289
289
  fill: "hsl(var(--muted-foreground))",
290
290
  fontSize: 12,
@@ -293,7 +293,7 @@ function nt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
293
293
  tickLine: !1,
294
294
  axisLine: !1
295
295
  }),
296
- /* @__PURE__ */ T(M, {
296
+ /* @__PURE__ */ w(M, {
297
297
  cursor: {
298
298
  fill: "hsl(var(--muted))",
299
299
  opacity: .2
@@ -308,11 +308,11 @@ function nt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
308
308
  },
309
309
  itemStyle: { color: "hsl(var(--primary))" }
310
310
  }),
311
- /* @__PURE__ */ T(k, { wrapperStyle: {
311
+ /* @__PURE__ */ w(A, { wrapperStyle: {
312
312
  paddingTop: "20px",
313
313
  fontFamily: "monospace"
314
314
  } }),
315
- /* @__PURE__ */ T(pe, {
315
+ /* @__PURE__ */ w(me, {
316
316
  dataKey: t,
317
317
  fill: "url(#barGradient)",
318
318
  radius: [
@@ -329,15 +329,15 @@ function nt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
329
329
  })
330
330
  });
331
331
  }
332
- var rt = L((() => {}));
332
+ var nt = R((() => {}));
333
333
  //#endregion
334
334
  //#region src/ChartContainerImpl.tsx
335
- function it() {
336
- let e = m.useContext(ct);
335
+ function rt() {
336
+ let e = m.useContext(st);
337
337
  if (!e) throw Error("useChart must be used within a <ChartContainer />");
338
338
  return e;
339
339
  }
340
- function q({ id: e, className: t, children: n, config: r, disableSettleRemount: i, ...a }) {
340
+ function J({ id: e, className: t, children: n, config: r, disableSettleRemount: i, ...a }) {
341
341
  let o = m.useId(), s = `chart-${e || o.replace(/:/g, "")}`, c = m.useRef(null), [l, u] = m.useState(0);
342
342
  return m.useEffect(() => {
343
343
  if (i) return;
@@ -353,23 +353,23 @@ function q({ id: e, className: t, children: n, config: r, disableSettleRemount:
353
353
  return r.observe(e), () => {
354
354
  t = !0, n != null && clearTimeout(n), r.disconnect();
355
355
  };
356
- }, [i]), /* @__PURE__ */ T(ct.Provider, {
356
+ }, [i]), /* @__PURE__ */ w(st.Provider, {
357
357
  value: { config: r },
358
- children: /* @__PURE__ */ E("div", {
358
+ children: /* @__PURE__ */ T("div", {
359
359
  ref: c,
360
360
  "data-slot": "chart",
361
361
  "data-chart": s,
362
- className: J("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
362
+ className: Y("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
363
363
  style: {
364
364
  minHeight: 280,
365
365
  minWidth: 0,
366
366
  ...a.style
367
367
  },
368
368
  ...a,
369
- children: [/* @__PURE__ */ T(lt, {
369
+ children: [/* @__PURE__ */ w(ct, {
370
370
  id: s,
371
371
  config: r
372
- }), /* @__PURE__ */ T(A, {
372
+ }), /* @__PURE__ */ w(Ae, {
373
373
  width: "100%",
374
374
  height: "100%",
375
375
  children: n
@@ -377,15 +377,15 @@ function q({ id: e, className: t, children: n, config: r, disableSettleRemount:
377
377
  })
378
378
  });
379
379
  }
380
- function at({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: o, labelFormatter: s, labelClassName: c, formatter: l, color: u, nameKey: d, labelKey: f }) {
381
- let { config: p } = it(), h = m.useMemo(() => {
380
+ function it({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: o, labelFormatter: s, labelClassName: c, formatter: l, color: u, nameKey: d, labelKey: f }) {
381
+ let { config: p } = rt(), h = m.useMemo(() => {
382
382
  if (i || !t?.length) return null;
383
- let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = st(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
384
- return s ? /* @__PURE__ */ T("div", {
385
- className: J("font-medium", c),
383
+ let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = ot(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
384
+ return s ? /* @__PURE__ */ w("div", {
385
+ className: Y("font-medium", c),
386
386
  children: s(a, t)
387
- }) : a ? /* @__PURE__ */ T("div", {
388
- className: J("font-medium", c),
387
+ }) : a ? /* @__PURE__ */ w("div", {
388
+ className: Y("font-medium", c),
389
389
  children: a
390
390
  }) : null;
391
391
  }, [
@@ -399,29 +399,29 @@ function at({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
399
399
  ]);
400
400
  if (!e || !t?.length) return null;
401
401
  let g = t.length === 1 && r !== "dot";
402
- return /* @__PURE__ */ E("div", {
403
- className: J("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", n),
404
- children: [g ? null : h, /* @__PURE__ */ T("div", {
402
+ return /* @__PURE__ */ T("div", {
403
+ className: Y("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", n),
404
+ children: [g ? null : h, /* @__PURE__ */ w("div", {
405
405
  className: "grid gap-1.5",
406
406
  children: t.filter((e) => e.type !== "none").map((e, t) => {
407
- let n = `${d || e.name || e.dataKey || "value"}`, i = st(p, e, n), o = u || e.payload.fill || e.color;
408
- return /* @__PURE__ */ T("div", {
409
- className: J("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", r === "dot" ? "items-center" : ""),
410
- children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ E(w, { children: [i?.icon ? /* @__PURE__ */ T(i.icon, {}) : !a && /* @__PURE__ */ T("div", {
411
- className: J("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", r === "dot" ? "h-2.5 w-2.5" : "", r === "line" ? "w-1" : "", r === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", g && r === "dashed" ? "my-0.5" : ""),
407
+ let n = `${d || e.name || e.dataKey || "value"}`, i = ot(p, e, n), o = u || e.payload.fill || e.color;
408
+ return /* @__PURE__ */ w("div", {
409
+ className: Y("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", r === "dot" ? "items-center" : ""),
410
+ children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ T(de, { children: [i?.icon ? /* @__PURE__ */ w(i.icon, {}) : !a && /* @__PURE__ */ w("div", {
411
+ className: Y("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", r === "dot" ? "h-2.5 w-2.5" : "", r === "line" ? "w-1" : "", r === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", g && r === "dashed" ? "my-0.5" : ""),
412
412
  style: {
413
413
  "--color-bg": o,
414
414
  "--color-border": o
415
415
  }
416
- }), /* @__PURE__ */ E("div", {
417
- className: J("flex flex-1 justify-between leading-none", g ? "items-end" : "items-center"),
418
- children: [/* @__PURE__ */ E("div", {
416
+ }), /* @__PURE__ */ T("div", {
417
+ className: Y("flex flex-1 justify-between leading-none", g ? "items-end" : "items-center"),
418
+ children: [/* @__PURE__ */ T("div", {
419
419
  className: "grid gap-1.5",
420
- children: [g ? h : null, /* @__PURE__ */ T("span", {
420
+ children: [g ? h : null, /* @__PURE__ */ w("span", {
421
421
  className: "text-muted-foreground",
422
422
  children: i?.label || e.name
423
423
  })]
424
- }), e.value && /* @__PURE__ */ T("span", {
424
+ }), e.value && /* @__PURE__ */ w("span", {
425
425
  className: "text-foreground font-mono font-medium tabular-nums",
426
426
  children: e.value.toLocaleString()
427
427
  })]
@@ -431,15 +431,15 @@ function at({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
431
431
  })]
432
432
  });
433
433
  }
434
- function ot({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
435
- let { config: a } = it();
436
- return n?.length ? /* @__PURE__ */ T("div", {
437
- className: J("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
434
+ function at({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
435
+ let { config: a } = rt();
436
+ return n?.length ? /* @__PURE__ */ w("div", {
437
+ className: Y("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
438
438
  children: n.filter((e) => e.type !== "none").map((e) => {
439
- let n = `${i || e.dataKey || "value"}`, r = st(a, e, n);
440
- return /* @__PURE__ */ E("div", {
441
- className: J("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
442
- children: [r?.icon && !t ? /* @__PURE__ */ T(r.icon, {}) : /* @__PURE__ */ T("div", {
439
+ let n = `${i || e.dataKey || "value"}`, r = ot(a, e, n);
440
+ return /* @__PURE__ */ T("div", {
441
+ className: Y("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
442
+ children: [r?.icon && !t ? /* @__PURE__ */ w(r.icon, {}) : /* @__PURE__ */ w("div", {
443
443
  className: "h-2 w-2 shrink-0 rounded-[2px]",
444
444
  style: { backgroundColor: e.color }
445
445
  }), r?.label]
@@ -447,18 +447,18 @@ function ot({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bo
447
447
  })
448
448
  }) : null;
449
449
  }
450
- function st(e, t, n) {
450
+ function ot(e, t, n) {
451
451
  if (typeof t != "object" || !t) return;
452
452
  let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
453
- return n in t && typeof t[n] == "string" ? i = t[n] : r && n in r && typeof r[n] == "string" && (i = r[n]), i in e ? e[i] : e[n];
453
+ return r && n in r && typeof r[n] == "string" ? i = r[n] : n in t && typeof t[n] == "string" && (i = t[n]), i in e ? e[i] : e[n];
454
454
  }
455
- var J, Y, ct, lt, X, Z, ut = L((() => {
456
- J = (...e) => e.filter(Boolean).join(" "), Y = {
455
+ var Y, X, st, ct, Z, lt, ut = R((() => {
456
+ Y = (...e) => e.filter(Boolean).join(" "), X = {
457
457
  light: "",
458
458
  dark: ".dark"
459
- }, ct = m.createContext(null), lt = ({ id: e, config: t }) => {
459
+ }, st = m.createContext(null), ct = ({ id: e, config: t }) => {
460
460
  let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
461
- return n.length ? /* @__PURE__ */ T("style", { dangerouslySetInnerHTML: { __html: Object.entries(Y).map(([t, r]) => `
461
+ return n.length ? /* @__PURE__ */ w("style", { dangerouslySetInnerHTML: { __html: Object.entries(X).map(([t, r]) => `
462
462
  ${r} [data-chart=${e}] {
463
463
  ${n.map(([e, n]) => {
464
464
  let r = n.theme?.[t] || n.color;
@@ -466,7 +466,7 @@ ${n.map(([e, n]) => {
466
466
  }).join("\n")}
467
467
  }
468
468
  `).join("\n") } }) : null;
469
- }, X = M, Z = k;
469
+ }, Z = M, lt = A;
470
470
  }));
471
471
  //#endregion
472
472
  //#region src/chartDrillEvents.ts
@@ -504,10 +504,10 @@ function mt(e, t) {
504
504
  value: typeof n?.value == "number" ? n.value : void 0
505
505
  };
506
506
  }
507
- var ht = L((() => {})), gt = /* @__PURE__ */ R({ default: () => xt });
507
+ var ht = R((() => {})), gt = /* @__PURE__ */ z({ default: () => xt });
508
508
  function _t(e) {
509
509
  let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
510
- return r <= 0 || i <= 0 ? null : /* @__PURE__ */ E("g", { children: [/* @__PURE__ */ T("rect", {
510
+ return r <= 0 || i <= 0 ? null : /* @__PURE__ */ T("g", { children: [/* @__PURE__ */ w("rect", {
511
511
  x: t,
512
512
  y: n,
513
513
  width: r,
@@ -515,7 +515,7 @@ function _t(e) {
515
515
  fill: o,
516
516
  stroke: "hsl(var(--background))",
517
517
  strokeWidth: 2
518
- }), r > 48 && i > 18 ? /* @__PURE__ */ T("text", {
518
+ }), r > 48 && i > 18 ? /* @__PURE__ */ w("text", {
519
519
  x: t + 6,
520
520
  y: n + 18,
521
521
  fill: "#fff",
@@ -525,25 +525,25 @@ function _t(e) {
525
525
  }) : null] });
526
526
  }
527
527
  function vt({ title: e, subtitle: t, children: n }) {
528
- return !e && !t ? /* @__PURE__ */ T(w, { children: n }) : /* @__PURE__ */ E("div", {
528
+ return !e && !t ? /* @__PURE__ */ w(de, { children: n }) : /* @__PURE__ */ T("div", {
529
529
  className: "flex h-full w-full flex-col",
530
- children: [/* @__PURE__ */ E("div", {
530
+ children: [/* @__PURE__ */ T("div", {
531
531
  className: "mb-2 shrink-0",
532
- children: [e ? /* @__PURE__ */ T("div", {
532
+ children: [e ? /* @__PURE__ */ w("div", {
533
533
  className: "text-sm font-medium leading-tight text-foreground",
534
534
  children: e
535
- }) : null, t ? /* @__PURE__ */ T("div", {
535
+ }) : null, t ? /* @__PURE__ */ w("div", {
536
536
  className: "text-xs leading-tight text-muted-foreground",
537
537
  children: t
538
538
  }) : null]
539
- }), /* @__PURE__ */ T("div", {
539
+ }), /* @__PURE__ */ w("div", {
540
540
  className: "min-h-0 flex-1",
541
541
  children: n
542
542
  })]
543
543
  });
544
544
  }
545
545
  function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i = "name", series: a = [], className: o = "", colors: s, categoryColors: c, categoryOrder: l, onChartClick: u, isAnimationActive: d, xAxis: f, yAxes: p, showLegend: h, showDataLabels: g, title: ee, subtitle: te, description: ne, height: _, annotations: re, interaction: v }) {
546
- let ie = e === "column" ? "bar" : e, y = Ge(ie, a), ae = We(ie), b = Array.isArray(n) ? n : [], x = d === !1 ? { isAnimationActive: !1 } : {}, S = {
546
+ let ie = e === "column" ? "bar" : e, y = We(ie, a), ae = Ue(ie), b = Array.isArray(n) ? n : [], x = d === !1 ? { isAnimationActive: !1 } : {}, S = {
547
547
  ...d === !1 ? { disableSettleRemount: !0 } : {},
548
548
  ..._ ? { style: { height: _ } } : {},
549
549
  ...ne ? {
@@ -576,7 +576,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
576
576
  } : {}, ue = u ? {
577
577
  onClick: ce,
578
578
  style: { cursor: "pointer" }
579
- } : {}, k = m.useCallback((e, t, n) => c && c[e == null ? "" : String(e)] || n[t % n.length], [c]), A = m.useCallback((e) => {
579
+ } : {}, A = m.useCallback((e, t, n) => c && c[e == null ? "" : String(e)] || n[t % n.length], [c]), Ae = m.useCallback((e) => {
580
580
  if (!u) return;
581
581
  let t = ft(e, i, a);
582
582
  t && u(t);
@@ -584,42 +584,42 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
584
584
  u,
585
585
  i,
586
586
  a
587
- ]), Fe = m.useCallback((e) => {
587
+ ]), Pe = m.useCallback((e) => {
588
588
  if (!u) return;
589
589
  let t = pt(e, a);
590
590
  t && u(t);
591
- }, [u, a]), Ie = m.useCallback((e) => {
591
+ }, [u, a]), Fe = m.useCallback((e) => {
592
592
  if (!u) return;
593
593
  let t = mt(e, a);
594
594
  t && u(t);
595
- }, [u, a]), Le = u ? {
596
- onClick: A,
595
+ }, [u, a]), Ie = u ? {
596
+ onClick: Ae,
597
597
  cursor: "pointer"
598
+ } : {}, Le = u ? {
599
+ onClick: Pe,
600
+ style: { cursor: "pointer" }
598
601
  } : {}, Re = u ? {
599
602
  onClick: Fe,
600
603
  style: { cursor: "pointer" }
601
- } : {}, ze = u ? {
602
- onClick: Ie,
603
- style: { cursor: "pointer" }
604
604
  } : {};
605
605
  m.useEffect(() => {
606
606
  let e = () => oe(window.innerWidth < 640);
607
607
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
608
608
  }, []);
609
- let Be = {
610
- bar: D,
611
- "horizontal-bar": D,
612
- line: xe,
613
- area: fe,
614
- pie: Ce,
615
- donut: Ce,
616
- radar: Oe,
609
+ let ze = {
610
+ bar: E,
611
+ "horizontal-bar": E,
612
+ line: be,
613
+ area: pe,
614
+ pie: Se,
615
+ donut: Se,
616
+ radar: De,
617
617
  scatter: j,
618
- funnel: ve,
619
- combo: ge,
620
- treemap: D,
621
- sankey: D
622
- }[y] || D, Ve = m.useCallback((e) => {
618
+ funnel: O,
619
+ combo: _e,
620
+ treemap: E,
621
+ sankey: E
622
+ }[y] || E, Be = m.useCallback((e) => {
623
623
  if (e == null || e === "") return "";
624
624
  let t = r?.[String(e)]?.label;
625
625
  if (t != null) return String(t);
@@ -627,7 +627,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
627
627
  if (/^\d{4}-\d{2}-\d{2}/.test(n)) {
628
628
  let e = new Date(n);
629
629
  if (!Number.isNaN(e.getTime())) {
630
- let t = (b.length > 1 ? Math.abs(new Date(String(b[b.length - 1][i] ?? "")).getTime() - new Date(String(b[0][i] ?? "")).getTime()) : 0) / (1e3 * 60 * 60 * 24);
630
+ let t = (b.length > 1 ? Math.abs(new Date(String(b[b.length - 1][i] ?? "")).getTime() - new Date(String(b[0][i] ?? "")).getTime()) : 0) / 864e5;
631
631
  try {
632
632
  return t <= 62 ? e.toLocaleDateString(void 0, {
633
633
  month: "short",
@@ -647,13 +647,13 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
647
647
  i,
648
648
  C,
649
649
  r
650
- ]), He = m.useMemo(() => b.some((e) => String(e[i] || "").length > 5), [b, i]), F = () => Array.isArray(s) && s.length > 0 ? s : [
650
+ ]), Ve = m.useMemo(() => b.some((e) => String(e[i] || "").length > 5), [b, i]), I = () => Array.isArray(s) && s.length > 0 ? s : [
651
651
  "hsl(var(--chart-1))",
652
652
  "hsl(var(--chart-2))",
653
653
  "hsl(var(--chart-3))",
654
654
  "hsl(var(--chart-4))",
655
655
  "hsl(var(--chart-5))"
656
- ], I = m.useCallback((e) => {
656
+ ], L = m.useCallback((e) => {
657
657
  if (e == null || e === "") return "";
658
658
  let t = typeof e == "number" ? e : Number(e);
659
659
  if (!Number.isFinite(t)) return String(e);
@@ -665,8 +665,8 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
665
665
  } catch {
666
666
  return String(t);
667
667
  }
668
- }, []), L = p?.[0], R = p && p.length > 1 ? p[1] : L?.position === "right" ? L : void 0, z = !!p && p.length > 1, B = m.useMemo(() => H(f?.format) ?? Ve, [f?.format, Ve]), V = m.useMemo(() => H(L?.format) ?? I, [L?.format, I]), Ue = m.useMemo(() => H(R?.format) ?? I, [R?.format, I]), Ze = m.useCallback((e) => {
669
- let t = a.filter((t) => z ? (t.yAxis === "right" ? "right" : "left") === e : e === "left").map((e) => e.dataKey), n = [];
668
+ }, []), R = p?.[0], z = p && p.length > 1 ? p[1] : R?.position === "right" ? R : void 0, B = !!p && p.length > 1, V = m.useMemo(() => U(f?.format) ?? Be, [f?.format, Be]), H = m.useMemo(() => U(R?.format) ?? L, [R?.format, L]), He = m.useMemo(() => U(z?.format) ?? L, [z?.format, L]), Xe = m.useCallback((e) => {
669
+ let t = a.filter((t) => B ? (t.yAxis === "right" ? "right" : "left") === e : e === "left").map((e) => e.dataKey), n = [];
670
670
  for (let e of b) for (let r of t) {
671
671
  let t = Number(e?.[r]);
672
672
  Number.isFinite(t) && n.push(t);
@@ -675,10 +675,10 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
675
675
  }, [
676
676
  b,
677
677
  a,
678
- z
679
- ]), U = m.useCallback((e, t = "left") => {
678
+ B
679
+ ]), W = m.useCallback((e, t = "left") => {
680
680
  if (!e) return {};
681
- let n = qe(e), r = Ke(e, Ze(t));
681
+ let n = Ke(e), r = Ge(e, Xe(t));
682
682
  return {
683
683
  ...r ? { ticks: r } : {},
684
684
  ...n ? { domain: n } : {},
@@ -693,10 +693,10 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
693
693
  position: "insideLeft"
694
694
  } } : {}
695
695
  };
696
- }, [Ze]), W = L?.showGridLines !== !1, G = {
696
+ }, [Xe]), G = R?.showGridLines !== !1, K = {
697
697
  vertical: f?.showGridLines === !0,
698
- horizontal: W
699
- }, Qe = h !== !1, $e = m.useMemo(() => {
698
+ horizontal: G
699
+ }, Ze = h !== !1, Qe = m.useMemo(() => {
700
700
  if (!Array.isArray(re) || re.length === 0) return null;
701
701
  let e = {
702
702
  solid: void 0,
@@ -710,79 +710,83 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
710
710
  fill: i,
711
711
  fontSize: 11
712
712
  } } : {};
713
- return t?.type === "region" ? /* @__PURE__ */ T(ke, {
714
- ...r ? {
713
+ if (t?.type === "region") {
714
+ let e = r ? {
715
715
  x1: t.value,
716
716
  x2: t.endValue
717
717
  } : {
718
718
  y1: t.value,
719
719
  y2: t.endValue
720
- },
721
- ...z && !r ? { yAxisId: "left" } : {},
722
- fill: i,
723
- fillOpacity: .12,
724
- stroke: i,
725
- strokeOpacity: .35,
726
- ...s
727
- }, `ann-${n}`) : /* @__PURE__ */ T(Ae, {
720
+ };
721
+ return /* @__PURE__ */ w(Oe, {
722
+ ...e,
723
+ ...B && !r ? { yAxisId: "left" } : {},
724
+ fill: i,
725
+ fillOpacity: .12,
726
+ stroke: i,
727
+ strokeOpacity: .35,
728
+ ...s
729
+ }, `ann-${n}`);
730
+ }
731
+ return /* @__PURE__ */ w(ke, {
728
732
  ...r ? { x: t?.value } : { y: t?.value },
729
- ...z && !r ? { yAxisId: "left" } : {},
733
+ ...B && !r ? { yAxisId: "left" } : {},
730
734
  stroke: i,
731
735
  strokeDasharray: a,
732
736
  ...s
733
737
  }, `ann-${n}`);
734
738
  });
735
- }, [re, z]), et = v?.tooltips !== !1, tt = v?.brush === !0 ? /* @__PURE__ */ T(me, {
739
+ }, [re, B]), $e = v?.tooltips !== !1, et = v?.brush === !0 ? /* @__PURE__ */ w(he, {
736
740
  dataKey: i,
737
741
  height: 24,
738
742
  travellerWidth: 8,
739
743
  stroke: "hsl(var(--muted-foreground))"
740
- }) : null, K = (e) => g ? /* @__PURE__ */ T(ye, {
744
+ }) : null, q = (e) => g ? /* @__PURE__ */ w(k, {
741
745
  position: "top",
742
746
  className: "fill-foreground",
743
747
  fontSize: 11,
744
748
  ...e ? { formatter: e } : {}
745
- }) : null, nt = m.useMemo(() => ({
749
+ }) : null, tt = m.useMemo(() => ({
746
750
  tickLine: !1,
747
751
  tickMargin: 10,
748
752
  axisLine: !1,
749
753
  interval: "preserveStartEnd",
750
754
  minTickGap: C ? 32 : 48,
751
- tickFormatter: B,
755
+ tickFormatter: V,
752
756
  ...f?.title ? { label: {
753
757
  value: f.title,
754
758
  position: "insideBottom",
755
759
  offset: -4
756
760
  } } : {},
757
- ...!C && He && {
761
+ ...!C && Ve && {
758
762
  angle: -35,
759
763
  textAnchor: "end",
760
764
  height: 60
761
765
  }
762
766
  }), [
763
767
  C,
764
- He,
765
- B,
768
+ Ve,
769
+ V,
766
770
  f?.title
767
771
  ]);
768
- if (y && Ye.has(y)) {
772
+ if (y && Je.has(y)) {
769
773
  let e = a[0]?.dataKey || "value", t = b[0]?.[e], n = typeof t == "number" ? t : Number(t), i = a[0]?.label ?? r?.[e]?.label ?? e;
770
- return /* @__PURE__ */ T("div", {
774
+ return /* @__PURE__ */ w("div", {
771
775
  className: o,
772
776
  "data-testid": "advanced-chart-single-value",
773
- children: /* @__PURE__ */ E("div", {
777
+ children: /* @__PURE__ */ T("div", {
774
778
  className: "flex flex-col gap-1 py-4",
775
- children: [/* @__PURE__ */ T("span", {
779
+ children: [/* @__PURE__ */ w("span", {
776
780
  className: "text-3xl font-semibold tabular-nums",
777
781
  children: Number.isFinite(n) ? new Intl.NumberFormat().format(n) : String(t ?? "—")
778
- }), /* @__PURE__ */ T("span", {
782
+ }), /* @__PURE__ */ w("span", {
779
783
  className: "text-xs text-muted-foreground",
780
784
  children: String(i)
781
785
  })]
782
786
  })
783
787
  });
784
788
  }
785
- if (y && Xe.has(y)) return /* @__PURE__ */ E("div", {
789
+ if (y && Ye.has(y)) return /* @__PURE__ */ T("div", {
786
790
  className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${o ?? ""}`,
787
791
  "data-testid": "advanced-chart-tabular-notice",
788
792
  role: "note",
@@ -792,7 +796,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
792
796
  "” is tabular — render it with the data-table / pivot components; a chart block draws series charts."
793
797
  ]
794
798
  });
795
- if (y && !Je.has(y)) return /* @__PURE__ */ E("div", {
799
+ if (y && !qe.has(y)) return /* @__PURE__ */ T("div", {
796
800
  className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${o ?? ""}`,
797
801
  "data-testid": "advanced-chart-unknown-type",
798
802
  role: "note",
@@ -803,25 +807,25 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
803
807
  ]
804
808
  });
805
809
  if (y === "pie" || y === "donut") {
806
- let e = y === "donut" ? "52%" : 0, t = F(), n = { ...r };
810
+ let e = y === "donut" ? "52%" : 0, t = I(), n = { ...r };
807
811
  return b.forEach((e, r) => {
808
812
  let a = e?.[i];
809
813
  if (a == null || a === "") return;
810
814
  let o = String(a);
811
815
  n[o] || (n[o] = {
812
816
  label: o,
813
- color: k(a, r, t)
817
+ color: A(a, r, t)
814
818
  });
815
- }), /* @__PURE__ */ T(q, {
819
+ }), /* @__PURE__ */ w(J, {
816
820
  config: n,
817
821
  className: o,
818
822
  ...S,
819
- children: /* @__PURE__ */ E(Ce, { children: [
820
- /* @__PURE__ */ T(X, {
823
+ children: /* @__PURE__ */ T(Se, { children: [
824
+ /* @__PURE__ */ w(Z, {
821
825
  cursor: !1,
822
- content: /* @__PURE__ */ T(at, { hideLabel: !0 })
826
+ content: /* @__PURE__ */ w(it, { hideLabel: !0 })
823
827
  }),
824
- /* @__PURE__ */ T(Se, {
828
+ /* @__PURE__ */ w(xe, {
825
829
  data: b,
826
830
  dataKey: a[0]?.dataKey || "value",
827
831
  nameKey: i || "name",
@@ -832,26 +836,26 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
832
836
  ...x,
833
837
  ...ue,
834
838
  children: b.map((e, n) => {
835
- let r = k(e?.[i], n, t);
836
- return /* @__PURE__ */ T(O, { fill: Q(r) }, `cell-${n}`);
839
+ let r = A(e?.[i], n, t);
840
+ return /* @__PURE__ */ w(D, { fill: Q(r) }, `cell-${n}`);
837
841
  })
838
842
  }),
839
- /* @__PURE__ */ T(Z, {
843
+ Ze ? /* @__PURE__ */ w(lt, {
840
844
  verticalAlign: "bottom",
841
845
  wrapperStyle: {
842
846
  fontSize: C ? "11px" : "12px",
843
847
  paddingTop: "8px"
844
848
  },
845
- content: /* @__PURE__ */ T(ot, {
849
+ content: /* @__PURE__ */ w(at, {
846
850
  nameKey: i,
847
851
  className: "flex-wrap"
848
852
  })
849
- })
853
+ }) : null
850
854
  ] })
851
855
  });
852
856
  }
853
857
  if (y === "funnel") {
854
- let e = a[0]?.dataKey || "value", n = F(), s = u ? (t) => {
858
+ let e = a[0]?.dataKey || "value", n = I(), s = u ? (t) => {
855
859
  t && u({
856
860
  category: t?.payload?.[i] ?? t?.[i],
857
861
  value: t?.payload?.[e] ?? t?.[e]
@@ -863,43 +867,43 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
863
867
  let r = Number(t?.[e] ?? 0);
864
868
  return Number(n?.[e] ?? 0) - r;
865
869
  });
866
- return /* @__PURE__ */ T(q, {
870
+ return /* @__PURE__ */ w(J, {
867
871
  config: r,
868
872
  className: o,
869
873
  ...S,
870
- children: /* @__PURE__ */ E(ve, { children: [/* @__PURE__ */ T(X, { content: /* @__PURE__ */ T(at, {}) }), /* @__PURE__ */ E(_e, {
874
+ children: /* @__PURE__ */ T(O, { children: [/* @__PURE__ */ w(Z, { content: /* @__PURE__ */ w(it, {}) }), /* @__PURE__ */ T(ve, {
871
875
  dataKey: e,
872
876
  data: f,
873
877
  nameKey: i,
874
878
  ...x,
875
879
  ...c,
876
- children: [/* @__PURE__ */ T(ye, {
880
+ children: [/* @__PURE__ */ w(k, {
877
881
  position: "right",
878
882
  fill: "hsl(var(--foreground))",
879
883
  stroke: "none",
880
884
  dataKey: i
881
- }), f.map((e, t) => /* @__PURE__ */ T(O, { fill: Q(n[t % n.length]) }, `funnel-cell-${t}`))]
885
+ }), f.map((e, t) => /* @__PURE__ */ w(D, { fill: Q(n[t % n.length]) }, `funnel-cell-${t}`))]
882
886
  })] })
883
887
  });
884
888
  }
885
889
  if (y === "treemap") {
886
- let e = a[0]?.dataKey || "value", t = F(), n = b.map((n, r) => ({
890
+ let e = a[0]?.dataKey || "value", t = I(), n = b.map((n, r) => ({
887
891
  name: String(n?.[i] ?? ""),
888
892
  size: Number(n?.[e]) || 0,
889
893
  fill: Q(t[r % t.length])
890
894
  }));
891
- return /* @__PURE__ */ T(q, {
895
+ return /* @__PURE__ */ w(J, {
892
896
  config: r,
893
897
  className: o,
894
898
  ...S,
895
- children: /* @__PURE__ */ T(Ne, {
899
+ children: /* @__PURE__ */ w(N, {
896
900
  data: n,
897
901
  dataKey: "size",
898
902
  nameKey: "name",
899
903
  ...x,
900
- content: /* @__PURE__ */ T(_t, {}),
901
- ...Re,
902
- children: /* @__PURE__ */ T(M, {})
904
+ content: /* @__PURE__ */ w(_t, {}),
905
+ ...Le,
906
+ children: /* @__PURE__ */ w(M, {})
903
907
  })
904
908
  });
905
909
  }
@@ -909,11 +913,11 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
909
913
  target: n + 1,
910
914
  value: Number(t?.[e]) || 0
911
915
  }));
912
- return c.length === 0 ? /* @__PURE__ */ T("div", { className: o }) : /* @__PURE__ */ T(q, {
916
+ return c.length === 0 ? /* @__PURE__ */ w("div", { className: o }) : /* @__PURE__ */ w(J, {
913
917
  config: r,
914
918
  className: o,
915
919
  ...S,
916
- children: /* @__PURE__ */ T(je, {
920
+ children: /* @__PURE__ */ w(je, {
917
921
  data: {
918
922
  nodes: s,
919
923
  links: c
@@ -924,24 +928,24 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
924
928
  strokeOpacity: .25
925
929
  },
926
930
  node: { fill: "hsl(var(--chart-1))" },
927
- ...ze,
928
- children: /* @__PURE__ */ T(M, {})
931
+ ...Re,
932
+ children: /* @__PURE__ */ w(M, {})
929
933
  })
930
934
  });
931
935
  }
932
- if (y === "radar") return /* @__PURE__ */ T(q, {
936
+ if (y === "radar") return /* @__PURE__ */ w(J, {
933
937
  config: r,
934
938
  className: o,
935
939
  ...S,
936
- children: /* @__PURE__ */ E(Oe, {
940
+ children: /* @__PURE__ */ T(De, {
937
941
  data: b,
938
942
  children: [
939
- /* @__PURE__ */ T(Te, {}),
940
- /* @__PURE__ */ T(we, { dataKey: i }),
941
- /* @__PURE__ */ T(Ee, {}),
942
- /* @__PURE__ */ T(X, { content: /* @__PURE__ */ T(at, {}) }),
943
- /* @__PURE__ */ T(Z, {
944
- content: /* @__PURE__ */ T(ot, {}),
943
+ /* @__PURE__ */ w(we, {}),
944
+ /* @__PURE__ */ w(Ce, { dataKey: i }),
945
+ /* @__PURE__ */ w(Te, {}),
946
+ /* @__PURE__ */ w(Z, { content: /* @__PURE__ */ w(it, {}) }),
947
+ /* @__PURE__ */ w(lt, {
948
+ content: /* @__PURE__ */ w(at, {}),
945
949
  ...C && {
946
950
  verticalAlign: "bottom",
947
951
  wrapperStyle: {
@@ -952,7 +956,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
952
956
  }),
953
957
  a.map((e) => {
954
958
  let t = Q(r[e.dataKey]?.color || St);
955
- return /* @__PURE__ */ T(De, {
959
+ return /* @__PURE__ */ w(Ee, {
956
960
  dataKey: e.dataKey,
957
961
  stroke: t,
958
962
  fill: t,
@@ -963,13 +967,13 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
963
967
  ]
964
968
  })
965
969
  });
966
- if (y === "scatter") return /* @__PURE__ */ T(q, {
970
+ if (y === "scatter") return /* @__PURE__ */ w(J, {
967
971
  config: r,
968
972
  className: o,
969
973
  ...S,
970
- children: /* @__PURE__ */ E(j, { children: [
971
- /* @__PURE__ */ T(he, { vertical: !1 }),
972
- /* @__PURE__ */ T(N, {
974
+ children: /* @__PURE__ */ T(j, { children: [
975
+ /* @__PURE__ */ w(ge, { vertical: !1 }),
976
+ /* @__PURE__ */ w(P, {
973
977
  type: "number",
974
978
  dataKey: i,
975
979
  name: String(r[i]?.label || i),
@@ -977,22 +981,22 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
977
981
  axisLine: !1,
978
982
  minTickGap: C ? 32 : 48
979
983
  }),
980
- /* @__PURE__ */ T(P, {
984
+ /* @__PURE__ */ w(F, {
981
985
  type: "number",
982
986
  dataKey: a[0]?.dataKey || "value",
983
987
  name: String(r[a[0]?.dataKey]?.label || a[0]?.dataKey),
984
988
  tickLine: !1,
985
989
  axisLine: !1,
986
- tickFormatter: I,
990
+ tickFormatter: L,
987
991
  width: 48
988
992
  }),
989
- /* @__PURE__ */ T(Pe, {
993
+ /* @__PURE__ */ w(Ne, {
990
994
  type: "number",
991
995
  range: [60, 400]
992
996
  }),
993
- /* @__PURE__ */ T(X, { content: /* @__PURE__ */ T(at, {}) }),
994
- /* @__PURE__ */ T(Z, {
995
- content: /* @__PURE__ */ T(ot, {}),
997
+ /* @__PURE__ */ w(Z, { content: /* @__PURE__ */ w(it, {}) }),
998
+ /* @__PURE__ */ w(lt, {
999
+ content: /* @__PURE__ */ w(at, {}),
996
1000
  ...C && {
997
1001
  verticalAlign: "bottom",
998
1002
  wrapperStyle: {
@@ -1002,53 +1006,53 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1002
1006
  }
1003
1007
  }),
1004
1008
  a.map((e, t) => {
1005
- let n = F(), i = Q(r[e.dataKey]?.color || n[t % n.length]), a = wt(e, "scatter");
1006
- return /* @__PURE__ */ T(Me, {
1009
+ let n = I(), i = Q(r[e.dataKey]?.color || n[t % n.length]), a = wt(e, "scatter");
1010
+ return /* @__PURE__ */ w(Me, {
1007
1011
  name: r[e.dataKey]?.label || e.dataKey,
1008
1012
  data: b,
1009
1013
  fill: i,
1010
1014
  fillOpacity: a?.fillOpacity,
1011
1015
  ...x,
1012
- ...Le
1016
+ ...Ie
1013
1017
  }, e.dataKey);
1014
1018
  })
1015
1019
  ] })
1016
1020
  });
1017
- if (y === "combo") return /* @__PURE__ */ T(vt, {
1021
+ if (y === "combo") return /* @__PURE__ */ w(vt, {
1018
1022
  title: ee,
1019
1023
  subtitle: te,
1020
- children: /* @__PURE__ */ T(q, {
1024
+ children: /* @__PURE__ */ w(J, {
1021
1025
  config: r,
1022
1026
  className: o,
1023
1027
  ...S,
1024
- children: /* @__PURE__ */ E(ge, {
1028
+ children: /* @__PURE__ */ T(_e, {
1025
1029
  data: b,
1026
1030
  children: [
1027
- /* @__PURE__ */ T(he, { ...G }),
1028
- /* @__PURE__ */ T(N, {
1031
+ /* @__PURE__ */ w(ge, { ...K }),
1032
+ /* @__PURE__ */ w(P, {
1029
1033
  dataKey: i,
1030
- ...nt
1034
+ ...tt
1031
1035
  }),
1032
- /* @__PURE__ */ T(P, {
1036
+ /* @__PURE__ */ w(F, {
1033
1037
  yAxisId: "left",
1034
1038
  tickLine: !1,
1035
1039
  axisLine: !1,
1036
- tickFormatter: V,
1040
+ tickFormatter: H,
1037
1041
  width: 48,
1038
- ...U(L)
1042
+ ...W(R)
1039
1043
  }),
1040
- /* @__PURE__ */ T(P, {
1044
+ /* @__PURE__ */ w(F, {
1041
1045
  yAxisId: "right",
1042
1046
  orientation: "right",
1043
1047
  tickLine: !1,
1044
1048
  axisLine: !1,
1045
- tickFormatter: Ue,
1049
+ tickFormatter: He,
1046
1050
  width: 48,
1047
- ...U(R, "right")
1051
+ ...W(z, "right")
1048
1052
  }),
1049
- et ? /* @__PURE__ */ T(X, { content: /* @__PURE__ */ T(at, {}) }) : null,
1050
- Qe ? /* @__PURE__ */ T(Z, {
1051
- content: /* @__PURE__ */ T(ot, {}),
1053
+ $e ? /* @__PURE__ */ w(Z, { content: /* @__PURE__ */ w(it, {}) }) : null,
1054
+ Ze ? /* @__PURE__ */ w(lt, {
1055
+ content: /* @__PURE__ */ w(at, {}),
1052
1056
  ...C && {
1053
1057
  verticalAlign: "bottom",
1054
1058
  wrapperStyle: {
@@ -1057,11 +1061,11 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1057
1061
  }
1058
1062
  }
1059
1063
  }) : null,
1060
- $e,
1061
- tt,
1064
+ Qe,
1065
+ et,
1062
1066
  a.map((e, t) => {
1063
- let n = Q(r[e.dataKey]?.color || St), i = e.chartType || ae || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : ae || i === "bar" ? "left" : "right", o = wt(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = H((a === "right" ? R : L)?.format);
1064
- return i === "line" ? /* @__PURE__ */ T(be, {
1067
+ let n = Q(r[e.dataKey]?.color || St), i = e.chartType || ae || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : ae || i === "bar" ? "left" : "right", o = wt(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = U((a === "right" ? z : R)?.format);
1068
+ return i === "line" ? /* @__PURE__ */ w(ye, {
1065
1069
  yAxisId: a,
1066
1070
  type: "monotone",
1067
1071
  dataKey: e.dataKey,
@@ -1071,8 +1075,8 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1071
1075
  strokeOpacity: o?.strokeOpacity,
1072
1076
  strokeDasharray: o?.strokeDasharray,
1073
1077
  ...x,
1074
- children: K(c)
1075
- }, e.dataKey) : i === "area" ? /* @__PURE__ */ T(de, {
1078
+ children: q(c)
1079
+ }, e.dataKey) : i === "area" ? /* @__PURE__ */ w(fe, {
1076
1080
  yAxisId: a,
1077
1081
  type: "monotone",
1078
1082
  dataKey: e.dataKey,
@@ -1083,8 +1087,8 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1083
1087
  strokeDasharray: o?.strokeDasharray,
1084
1088
  ...s,
1085
1089
  ...x,
1086
- children: K(c)
1087
- }, e.dataKey) : /* @__PURE__ */ T(pe, {
1090
+ children: q(c)
1091
+ }, e.dataKey) : /* @__PURE__ */ w(me, {
1088
1092
  yAxisId: a,
1089
1093
  dataKey: e.dataKey,
1090
1094
  fill: n,
@@ -1092,101 +1096,101 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1092
1096
  fillOpacity: o?.fillOpacity,
1093
1097
  ...s,
1094
1098
  ...x,
1095
- children: K(c)
1099
+ children: q(c)
1096
1100
  }, e.dataKey);
1097
1101
  })
1098
1102
  ]
1099
1103
  })
1100
1104
  })
1101
1105
  });
1102
- let rt = y === "horizontal-bar", it = F(), st = c ? Object.values(c).map((e) => Q(String(e))) : [], J = Array.from(/* @__PURE__ */ new Set([
1103
- ...it,
1104
- ...st,
1105
- ...a.map((e, t) => Q(r[e.dataKey]?.color || it[t % it.length] || St))
1106
- ])), Y = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
1107
- return /* @__PURE__ */ T(vt, {
1106
+ let nt = y === "horizontal-bar", rt = I(), ot = c ? Object.values(c).map((e) => Q(String(e))) : [], Y = Array.from(/* @__PURE__ */ new Set([
1107
+ ...rt,
1108
+ ...ot,
1109
+ ...a.map((e, t) => Q(r[e.dataKey]?.color || rt[t % rt.length] || St))
1110
+ ])), X = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
1111
+ return /* @__PURE__ */ w(vt, {
1108
1112
  title: ee,
1109
1113
  subtitle: te,
1110
- children: /* @__PURE__ */ T(q, {
1114
+ children: /* @__PURE__ */ w(J, {
1111
1115
  config: r,
1112
1116
  className: o,
1113
1117
  ...S,
1114
- children: /* @__PURE__ */ E(Be, {
1118
+ children: /* @__PURE__ */ T(ze, {
1115
1119
  data: b,
1116
- layout: rt ? "vertical" : "horizontal",
1120
+ layout: nt ? "vertical" : "horizontal",
1117
1121
  ...le,
1118
1122
  children: [
1119
- /* @__PURE__ */ T("defs", { children: J.map((e) => /* @__PURE__ */ E(m.Fragment, { children: [/* @__PURE__ */ E("linearGradient", {
1120
- id: `bg-${Y(e)}`,
1123
+ /* @__PURE__ */ w("defs", { children: Y.map((e) => /* @__PURE__ */ T(m.Fragment, { children: [/* @__PURE__ */ T("linearGradient", {
1124
+ id: `bg-${X(e)}`,
1121
1125
  x1: "0",
1122
1126
  y1: "0",
1123
1127
  x2: "0",
1124
1128
  y2: "1",
1125
- children: [/* @__PURE__ */ T("stop", {
1129
+ children: [/* @__PURE__ */ w("stop", {
1126
1130
  offset: "0%",
1127
1131
  style: { stopColor: e },
1128
1132
  stopOpacity: .95
1129
- }), /* @__PURE__ */ T("stop", {
1133
+ }), /* @__PURE__ */ w("stop", {
1130
1134
  offset: "100%",
1131
1135
  style: { stopColor: e },
1132
1136
  stopOpacity: .5
1133
1137
  })]
1134
- }), /* @__PURE__ */ E("linearGradient", {
1135
- id: `ag-${Y(e)}`,
1138
+ }), /* @__PURE__ */ T("linearGradient", {
1139
+ id: `ag-${X(e)}`,
1136
1140
  x1: "0",
1137
1141
  y1: "0",
1138
1142
  x2: "0",
1139
1143
  y2: "1",
1140
- children: [/* @__PURE__ */ T("stop", {
1144
+ children: [/* @__PURE__ */ w("stop", {
1141
1145
  offset: "0%",
1142
1146
  style: { stopColor: e },
1143
1147
  stopOpacity: .5
1144
- }), /* @__PURE__ */ T("stop", {
1148
+ }), /* @__PURE__ */ w("stop", {
1145
1149
  offset: "95%",
1146
1150
  style: { stopColor: e },
1147
1151
  stopOpacity: .05
1148
1152
  })]
1149
- })] }, Y(e))) }),
1150
- /* @__PURE__ */ T(he, { ...G }),
1151
- rt ? /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(N, {
1153
+ })] }, X(e))) }),
1154
+ /* @__PURE__ */ w(ge, { ...K }),
1155
+ nt ? /* @__PURE__ */ T(de, { children: [/* @__PURE__ */ w(P, {
1152
1156
  type: "number",
1153
1157
  tickLine: !1,
1154
1158
  axisLine: !1,
1155
- tickFormatter: V,
1156
- ...U(L)
1157
- }), /* @__PURE__ */ T(P, {
1159
+ tickFormatter: H,
1160
+ ...W(R)
1161
+ }), /* @__PURE__ */ w(F, {
1158
1162
  type: "category",
1159
1163
  dataKey: i,
1160
1164
  tickLine: !1,
1161
1165
  axisLine: !1,
1162
1166
  width: Math.min(140, Math.max(60, Math.max(...b.map((e) => String(e[i] ?? "").length)) * 7)),
1163
- tickFormatter: B
1164
- })] }) : /* @__PURE__ */ E(w, { children: [
1165
- /* @__PURE__ */ T(N, {
1167
+ tickFormatter: V
1168
+ })] }) : /* @__PURE__ */ T(de, { children: [
1169
+ /* @__PURE__ */ w(P, {
1166
1170
  dataKey: i,
1167
- ...nt
1171
+ ...tt
1168
1172
  }),
1169
- /* @__PURE__ */ T(P, {
1170
- ...z ? { yAxisId: "left" } : {},
1173
+ /* @__PURE__ */ w(F, {
1174
+ ...B ? { yAxisId: "left" } : {},
1171
1175
  tickLine: !1,
1172
1176
  axisLine: !1,
1173
- tickFormatter: V,
1177
+ tickFormatter: H,
1174
1178
  width: 48,
1175
- ...U(L)
1179
+ ...W(R)
1176
1180
  }),
1177
- z ? /* @__PURE__ */ T(P, {
1181
+ B ? /* @__PURE__ */ w(F, {
1178
1182
  yAxisId: "right",
1179
1183
  orientation: "right",
1180
1184
  tickLine: !1,
1181
1185
  axisLine: !1,
1182
- tickFormatter: Ue,
1186
+ tickFormatter: He,
1183
1187
  width: 48,
1184
- ...U(R, "right")
1188
+ ...W(z, "right")
1185
1189
  }) : null
1186
1190
  ] }),
1187
- et ? /* @__PURE__ */ T(X, { content: /* @__PURE__ */ T(at, {}) }) : null,
1188
- Qe ? /* @__PURE__ */ T(Z, {
1189
- content: /* @__PURE__ */ T(ot, {}),
1191
+ $e ? /* @__PURE__ */ w(Z, { content: /* @__PURE__ */ w(it, {}) }) : null,
1192
+ Ze ? /* @__PURE__ */ w(lt, {
1193
+ content: /* @__PURE__ */ w(at, {}),
1190
1194
  ...C && {
1191
1195
  verticalAlign: "bottom",
1192
1196
  wrapperStyle: {
@@ -1195,26 +1199,26 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1195
1199
  }
1196
1200
  }
1197
1201
  }) : null,
1198
- $e,
1199
- tt,
1202
+ Qe,
1203
+ et,
1200
1204
  a.map((e, t) => {
1201
- let n = F(), o = e.variant === "comparison", s = o ? a.slice(0, t).find((e) => e.variant !== "comparison") || a[0] : e, c = o ? a.indexOf(s) : t, l = Q(r[s.dataKey]?.color || n[c % n.length] || St), u = z ? { yAxisId: e.yAxis === "right" ? "right" : "left" } : {}, d = e.stack ? { stackId: String(e.stack) } : {}, f = H((e.yAxis === "right" ? R : L)?.format);
1205
+ let n = I(), o = e.variant === "comparison", s = o ? a.slice(0, t).find((e) => e.variant !== "comparison") || a[0] : e, c = o ? a.indexOf(s) : t, l = Q(r[s.dataKey]?.color || n[c % n.length] || St), u = B ? { yAxisId: e.yAxis === "right" ? "right" : "left" } : {}, d = e.stack ? { stackId: String(e.stack) } : {}, f = U((e.yAxis === "right" ? z : R)?.format);
1202
1206
  if (y === "bar" || y === "horizontal-bar") {
1203
1207
  let t = a.filter((e) => e.variant !== "comparison").length === 1 && !o && a.length === 1 && b.length > 1, r = wt(e, "bar");
1204
- return /* @__PURE__ */ E(pe, {
1208
+ return /* @__PURE__ */ T(me, {
1205
1209
  dataKey: e.dataKey,
1206
- fill: `url(#bg-${Y(l)})`,
1210
+ fill: `url(#bg-${X(l)})`,
1207
1211
  radius: 4,
1208
1212
  fillOpacity: r?.fillOpacity,
1209
1213
  ...d,
1210
1214
  ...u,
1211
1215
  ...x,
1212
- children: [t && b.map((e, t) => /* @__PURE__ */ T(O, { fill: `url(#bg-${Y(Q(k(e?.[i], t, n)))})` }, `cell-${t}`)), K(f)]
1216
+ children: [t && b.map((e, t) => /* @__PURE__ */ w(D, { fill: `url(#bg-${X(Q(A(e?.[i], t, n)))})` }, `cell-${t}`)), q(f)]
1213
1217
  }, e.dataKey);
1214
1218
  }
1215
1219
  if (y === "line") {
1216
1220
  let t = wt(e, "line");
1217
- return /* @__PURE__ */ T(be, {
1221
+ return /* @__PURE__ */ w(ye, {
1218
1222
  type: "monotone",
1219
1223
  dataKey: e.dataKey,
1220
1224
  stroke: l,
@@ -1224,15 +1228,15 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1224
1228
  strokeDasharray: t?.strokeDasharray,
1225
1229
  ...u,
1226
1230
  ...x,
1227
- children: K(f)
1231
+ children: q(f)
1228
1232
  }, e.dataKey);
1229
1233
  }
1230
1234
  if (y === "area") {
1231
1235
  let t = wt(e, "area");
1232
- return /* @__PURE__ */ T(de, {
1236
+ return /* @__PURE__ */ w(fe, {
1233
1237
  type: "monotone",
1234
1238
  dataKey: e.dataKey,
1235
- fill: `url(#ag-${Y(l)})`,
1239
+ fill: `url(#ag-${X(l)})`,
1236
1240
  stroke: l,
1237
1241
  strokeWidth: 2,
1238
1242
  fillOpacity: t?.fillOpacity ?? 1,
@@ -1241,7 +1245,7 @@ function yt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1241
1245
  ...d,
1242
1246
  ...u,
1243
1247
  ...x,
1244
- children: K(f)
1248
+ children: q(f)
1245
1249
  }, e.dataKey);
1246
1250
  }
1247
1251
  return null;
@@ -1263,23 +1267,23 @@ function xt(e) {
1263
1267
  t,
1264
1268
  n,
1265
1269
  r
1266
- ]), t ? /* @__PURE__ */ T("div", {
1270
+ ]), t ? /* @__PURE__ */ w("div", {
1267
1271
  className: `flex h-full min-h-[120px] w-full items-center justify-center p-4 text-center text-sm text-muted-foreground ${e.className ?? ""}`,
1268
1272
  role: "status",
1269
1273
  "data-chart-error": "missing-category-key",
1270
- children: /* @__PURE__ */ E("span", { children: [
1274
+ children: /* @__PURE__ */ T("span", { children: [
1271
1275
  "This chart cannot plot its category axis: no row has a",
1272
1276
  " ",
1273
- /* @__PURE__ */ T("code", {
1277
+ /* @__PURE__ */ w("code", {
1274
1278
  className: "font-mono",
1275
1279
  children: n
1276
1280
  }),
1277
1281
  " field."
1278
1282
  ] })
1279
- }) : /* @__PURE__ */ T(yt, { ...e });
1283
+ }) : /* @__PURE__ */ w(yt, { ...e });
1280
1284
  }
1281
- var St, Ct, Q, wt, Tt, Et = L((() => {
1282
- ut(), ht(), $e(), St = "hsl(var(--primary))", Ct = {
1285
+ var St, Ct, Q, wt, Tt, Et = R((() => {
1286
+ ut(), ht(), Qe(), St = "hsl(var(--primary))", Ct = {
1283
1287
  slate: "#64748b",
1284
1288
  gray: "#6b7280",
1285
1289
  zinc: "#71717a",
@@ -1320,10 +1324,10 @@ var St, Ct, Q, wt, Tt, Et = L((() => {
1320
1324
  }));
1321
1325
  //#endregion
1322
1326
  //#region src/ChartRenderer.tsx
1323
- $e();
1324
- var Dt = h.lazy(() => Promise.resolve().then(() => (rt(), et))), Ot = h.lazy(() => Promise.resolve().then(() => (Et(), gt))), kt = ({ schema: e }) => /* @__PURE__ */ T(g, {
1325
- fallback: /* @__PURE__ */ T(ue, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1326
- children: /* @__PURE__ */ T(Dt, {
1327
+ Qe();
1328
+ var Dt = h.lazy(() => Promise.resolve().then(() => (nt(), $e))), Ot = h.lazy(() => Promise.resolve().then(() => (Et(), gt))), kt = ({ schema: e }) => /* @__PURE__ */ w(g, {
1329
+ fallback: /* @__PURE__ */ w(ue, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1330
+ children: /* @__PURE__ */ w(Dt, {
1327
1331
  data: e.data,
1328
1332
  dataKey: e.dataKey,
1329
1333
  xAxisKey: e.xAxisKey,
@@ -1333,7 +1337,7 @@ var Dt = h.lazy(() => Promise.resolve().then(() => (rt(), et))), Ot = h.lazy(()
1333
1337
  })
1334
1338
  }), $ = ({ schema: e, onChartClick: t }) => {
1335
1339
  let n = h.useMemo(() => {
1336
- let t = Ue(e), n = Array.isArray(e.series) ? e.series : void 0, r = (n?.length && n.every((e) => !!e && typeof e == "object" && "dataKey" in e) ? n : t.series) ?? n, i = e.xAxisKey ?? t.xAxisKey, a = e.config;
1340
+ let t = He(e), n = Array.isArray(e.series) ? e.series : void 0, r = (n?.length && n.every((e) => !!e && typeof e == "object" && "dataKey" in e) ? n : t.series) ?? n, i = e.xAxisKey ?? t.xAxisKey, a = e.config;
1337
1341
  if (i || (e.index ? i = e.index : e.category && (i = e.category)), r || (e.categories ? r = e.categories.map((e) => ({ dataKey: e })) : e.value && (r = [{ dataKey: e.value }])), !a && r) {
1338
1342
  let t = e.colors || [
1339
1343
  "hsl(var(--chart-1))",
@@ -1357,9 +1361,9 @@ var Dt = h.lazy(() => Promise.resolve().then(() => (rt(), et))), Ot = h.lazy(()
1357
1361
  spec: t
1358
1362
  };
1359
1363
  }, [e]);
1360
- return /* @__PURE__ */ T(g, {
1361
- fallback: /* @__PURE__ */ T(ue, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1362
- children: /* @__PURE__ */ T(Ot, {
1364
+ return /* @__PURE__ */ w(g, {
1365
+ fallback: /* @__PURE__ */ w(ue, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1366
+ children: /* @__PURE__ */ w(Ot, {
1363
1367
  chartType: n.chartType,
1364
1368
  data: n.data,
1365
1369
  config: n.config,
@@ -1414,9 +1418,7 @@ function Nt(e, t) {
1414
1418
  case "max":
1415
1419
  s = o.length > 0 ? Math.max(...o) : 0;
1416
1420
  break;
1417
- default:
1418
- s = o.reduce((e, t) => e + t, 0);
1419
- break;
1421
+ default: s = o.reduce((e, t) => e + t, 0);
1420
1422
  }
1421
1423
  return {
1422
1424
  [i]: e,
@@ -1473,19 +1475,19 @@ async function Pt(e, t, n, r, i) {
1473
1475
  }));
1474
1476
  let a = c.id_field || "id";
1475
1477
  try {
1476
- let l = s(await r.find(n, {
1478
+ let l = await r.find(n, {
1477
1479
  $filter: { [a]: { $in: i } },
1478
1480
  $top: i.length
1479
- })), u = c.reference_field || c.display_field || "name", d = {};
1480
- for (let e of l) {
1481
- let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[u] || e.name || e.label || e.title || t;
1482
- t && (d[t] = String(n));
1481
+ }), u = s(l), d = c.reference_field || c.display_field || "name", f = {};
1482
+ for (let e of u) {
1483
+ let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[d] || e.name || e.label || e.title || t;
1484
+ t && (f[t] = String(n));
1483
1485
  }
1484
1486
  return e.map((e) => {
1485
1487
  let n = e[t], r = String(n ?? "");
1486
1488
  return {
1487
1489
  ...e,
1488
- [t]: d[r] || r,
1490
+ [t]: f[r] || r,
1489
1491
  [o]: n
1490
1492
  };
1491
1493
  });
@@ -1511,11 +1513,11 @@ async function Pt(e, t, n, r, i) {
1511
1513
  });
1512
1514
  }
1513
1515
  var Ft = (e) => {
1514
- let { schema: t } = e, m = e.onSegmentClick, h = te(Ie), g = e.dataSource || h?.dataSource, ue = Le(t.bind), { fieldOptionLabel: w } = He(), de = re(w);
1516
+ let { schema: t } = e, m = e.onSegmentClick, h = te(Fe), g = e.dataSource || h?.dataSource, ue = Ie(t.bind), { fieldOptionLabel: de } = Ve(), fe = re(de);
1515
1517
  ne(() => {
1516
- de.current = w;
1517
- }, [w]);
1518
- let [fe, pe] = v([]), [D, me] = v(null), [he, O] = v(() => !(Array.isArray(t.data) && t.data.length > 0) && (!!t.objectName || !!t.dataset)), [ge, _e] = v(null), [ve, ye] = v(null), [k, be] = v(null), [xe, Se] = v(null), { openRecordList: Ce } = Re(), we = F(), Te = _(() => t.aggregate ? JSON.stringify(t.aggregate) : "", [t.aggregate]), Ee = _(() => t.filter ? JSON.stringify(t.filter) : "", [t.filter]), De = _(() => t.compareTo ? JSON.stringify(t.compareTo) : "", [t.compareTo]), Oe = _(() => t.dataset ? JSON.stringify({
1518
+ fe.current = de;
1519
+ }, [de]);
1520
+ let [pe, me] = v([]), [E, he] = v(null), [ge, D] = v(() => !(Array.isArray(t.data) && t.data.length > 0) && (!!t.objectName || !!t.dataset)), [_e, ve] = v(null), [O, k] = v(null), [A, ye] = v(null), [be, xe] = v(null), { openRecordList: Se } = Le(), Ce = I(), we = _(() => t.aggregate ? JSON.stringify(t.aggregate) : "", [t.aggregate]), Te = _(() => t.filter ? JSON.stringify(t.filter) : "", [t.filter]), Ee = _(() => t.compareTo ? JSON.stringify(t.compareTo) : "", [t.compareTo]), De = _(() => t.dataset ? JSON.stringify({
1519
1521
  d: t.dataset,
1520
1522
  dim: t.dimensions ?? [],
1521
1523
  val: t.values ?? []
@@ -1523,7 +1525,7 @@ var Ft = (e) => {
1523
1525
  t.dataset,
1524
1526
  t.dimensions,
1525
1527
  t.values
1526
- ]), ke = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
1528
+ ]), Oe = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
1527
1529
  ne(() => {
1528
1530
  let e = !1;
1529
1531
  return (async () => {
@@ -1538,7 +1540,7 @@ var Ft = (e) => {
1538
1540
  s = r?.item ?? r?.data ?? r, a = s?.object, o = ((s?.dimensions || []).find((t) => t?.name === e) ?? (s?.dimensions || [])[0])?.field ?? e;
1539
1541
  }
1540
1542
  if (!a || !o) {
1541
- e || (be(null), Se(null));
1543
+ e || (ye(null), xe(null));
1542
1544
  return;
1543
1545
  }
1544
1546
  let l = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(a)}`, n)).json().catch(() => null), u = l?.item ?? l?.data ?? l, d = i(u?.fields?.[o]?.options), f = null;
@@ -1550,9 +1552,9 @@ var Ft = (e) => {
1550
1552
  }
1551
1553
  Object.keys(e).length > 0 && (f = e);
1552
1554
  }
1553
- e || (be(d), Se(f));
1555
+ e || (ye(d), xe(f));
1554
1556
  } catch {
1555
- e || (be(null), Se(null));
1557
+ e || (ye(null), xe(null));
1556
1558
  }
1557
1559
  })(), () => {
1558
1560
  e = !0;
@@ -1560,11 +1562,11 @@ var Ft = (e) => {
1560
1562
  }, [
1561
1563
  t.objectName,
1562
1564
  t.dataset,
1563
- Oe,
1564
- Te,
1565
+ De,
1566
+ we,
1565
1567
  t.xAxisKey
1566
1568
  ]);
1567
- let Ae = ee(async (e, n) => {
1569
+ let ke = ee(async (e, n) => {
1568
1570
  if (t.aggregate && typeof e.aggregate == "function") {
1569
1571
  let r = t.aggregate.groupBy;
1570
1572
  if (r && typeof r == "object" && !Array.isArray(r)) {
@@ -1589,27 +1591,27 @@ var Ft = (e) => {
1589
1591
  return Array.isArray(i) ? i : [];
1590
1592
  }
1591
1593
  if (typeof e.find == "function") {
1592
- let r = s(await e.find(t.objectName, { $filter: n }));
1593
- return t.aggregate && r.length > 0 && (r = Nt(r, t.aggregate)), r;
1594
+ let r = await e.find(t.objectName, { $filter: n }), i = s(r);
1595
+ return t.aggregate && i.length > 0 && (i = Nt(i, t.aggregate)), i;
1594
1596
  }
1595
1597
  return [];
1596
- }, [t.objectName, Te]), A = ze(), je = ee(async (e, n) => {
1598
+ }, [t.objectName, we]), Ae = Re(), je = ee(async (e, n) => {
1597
1599
  if (!e || !t.objectName && !t.dataset) {
1598
- n.current && O(!1);
1600
+ n.current && D(!1);
1599
1601
  return;
1600
1602
  }
1601
- n.current && (O(!0), _e(null));
1603
+ n.current && (D(!0), ve(null));
1602
1604
  try {
1603
1605
  if (t.dataset && typeof e.queryDataset == "function") {
1604
- let r = f(t.filter, A), i = await e.queryDataset(t.dataset, {
1606
+ let r = f(t.filter, Ae), i = await e.queryDataset(t.dataset, {
1605
1607
  dimensions: Array.isArray(t.dimensions) ? t.dimensions : [],
1606
1608
  measures: Array.isArray(t.values) ? t.values : [],
1607
1609
  ...r ? { runtimeFilter: r } : {}
1608
1610
  });
1609
- n.current && (pe(Array.isArray(i?.rows) ? i.rows : []), me(Array.isArray(i?.fields) ? i.fields : null));
1611
+ n.current && (me(Array.isArray(i?.rows) ? i.rows : []), he(Array.isArray(i?.fields) ? i.fields : null));
1610
1612
  return;
1611
1613
  }
1612
- let r = f(t.filter, A), i = t.compareTo, a = !!i && ke(t.chartType), o = a ? u(p(t.filter, i), A) : null, [s, c] = await Promise.all([Ae(e, r), o ? Ae(e, o) : Promise.resolve([])]), l = s, d = t.aggregate?.groupBy, m = d && typeof d == "object" && !Array.isArray(d) ? d.alias || d.field : d || t.xAxisKey;
1614
+ let r = f(t.filter, Ae), i = t.compareTo, a = !!i && Oe(t.chartType), o = a ? u(p(t.filter, i), Ae) : null, [s, c] = await Promise.all([ke(e, r), o ? ke(e, o) : Promise.resolve([])]), l = s, d = t.aggregate?.groupBy, m = d && typeof d == "object" && !Array.isArray(d) ? d.alias || d.field : d || t.xAxisKey;
1613
1615
  if (a && c.length > 0 && t.aggregate) {
1614
1616
  let e = t.aggregate.field, n = t.aggregate.function, r = jt(t.aggregate), i = (t) => {
1615
1617
  if (t == null) return null;
@@ -1655,122 +1657,136 @@ var Ft = (e) => {
1655
1657
  }
1656
1658
  if (m && typeof e.getObjectSchema == "function") try {
1657
1659
  let n = await e.getObjectSchema(t.objectName);
1658
- l = await Pt(l, m, n, e, (e, n) => de.current(t.objectName, m, e, n));
1660
+ l = await Pt(l, m, n, e, (e, n) => fe.current(t.objectName, m, e, n));
1659
1661
  } catch {}
1660
- n.current && pe(l);
1662
+ n.current && me(l);
1661
1663
  } catch (e) {
1662
- console.error("[ObjectChart] Fetch error:", e), n.current && _e(e instanceof Error ? e.message : "Failed to load chart data");
1664
+ console.error("[ObjectChart] Fetch error:", e), n.current && ve(e instanceof Error ? e.message : "Failed to load chart data");
1663
1665
  } finally {
1664
- n.current && O(!1);
1666
+ n.current && D(!1);
1665
1667
  }
1666
1668
  }, [
1667
1669
  t.objectName,
1668
- Oe,
1670
+ De,
1671
+ we,
1669
1672
  Te,
1670
1673
  Ee,
1671
- De,
1672
1674
  t.xAxisKey,
1673
1675
  t.chartType,
1674
- Ae,
1675
- A
1676
+ ke,
1677
+ Ae
1676
1678
  ]);
1677
1679
  ne(() => {
1678
1680
  let e = { current: !0 };
1679
- return (t.objectName || t.dataset) && !ue && !t.data ? je(g, e) : e.current && O(!1), () => {
1681
+ return (t.objectName || t.dataset) && !ue && !t.data ? je(g, e) : e.current && D(!1), () => {
1680
1682
  e.current = !1;
1681
1683
  };
1682
1684
  }, [
1683
1685
  t.objectName,
1684
- Oe,
1686
+ De,
1685
1687
  g,
1686
1688
  ue,
1687
1689
  t.data,
1688
- Ee,
1689
1690
  Te,
1690
- De,
1691
+ we,
1692
+ Ee,
1691
1693
  je
1692
1694
  ]);
1693
- let Me = ue || t.data || fe, j = Array.isArray(Me) ? Me : [], M = t.drillDown, Ne = t.aggregate?.groupBy || t.xAxisKey, N = _(() => {
1694
- if (!Ne) return /* @__PURE__ */ new Map();
1695
- let e = /* @__PURE__ */ new Map(), t = `__raw_${Ne}`;
1695
+ let Me = ue || t.data || pe, j = Array.isArray(Me) ? Me : [], M = t.drillDown, N = t.aggregate?.groupBy || t.xAxisKey, P = _(() => {
1696
+ if (!N) return /* @__PURE__ */ new Map();
1697
+ let e = /* @__PURE__ */ new Map(), t = `__raw_${N}`;
1696
1698
  for (let n of j) {
1697
- let r = n?.[Ne];
1699
+ let r = n?.[N];
1698
1700
  if (r == null) continue;
1699
1701
  let i = t in (n || {}) ? n[t] : r;
1700
1702
  e.set(String(r), i);
1701
1703
  }
1702
1704
  return e;
1703
- }, [j, Ne]), P = t.compareTo, Pe = t.aggregate ? jt(t.aggregate) : void 0, I = Pe ? `${Pe}${Mt}` : void 0, L = !!P && ke(t.chartType) && !!I && j.some((e) => e[I] != null), R = _(() => {
1705
+ }, [j, N]), F = _(() => {
1706
+ if (O) return {
1707
+ ...t.filter || {},
1708
+ ...o(M, O, { groupByField: N })
1709
+ };
1710
+ }, [
1711
+ O,
1712
+ M,
1713
+ N,
1714
+ Te
1715
+ ]), Ne = !m && !!O && !!t.objectName && M?.target === "navigate" && !!Se;
1716
+ ne(() => {
1717
+ Ne && (Se(t.objectName, F), k(null));
1718
+ }, [Ne]);
1719
+ let L = t.compareTo, R = t.aggregate ? jt(t.aggregate) : void 0, z = R ? `${R}${Mt}` : void 0, B = !!L && Oe(t.chartType) && !!z && j.some((e) => e[z] != null), V = _(() => {
1704
1720
  let e = Array.isArray(t.series) ? t.series : null;
1705
- if (!L) return e;
1706
- let n = e || [{ dataKey: Pe }], r = {
1721
+ if (!B) return e;
1722
+ let n = e || [{ dataKey: R }], r = {
1707
1723
  vsLastWeek: "Previous week",
1708
1724
  vsLastMonth: "Previous month",
1709
1725
  vsLastQuarter: "Previous quarter",
1710
1726
  vsLastYear: "Previous year",
1711
1727
  vsYesterday: "Yesterday",
1712
1728
  vsPreviousPeriod: "Previous period"
1713
- }[a(P, t.filter)] || "Previous period";
1729
+ }[a(L, t.filter)] || "Previous period";
1714
1730
  return [...n.map((e) => ({
1715
1731
  ...e,
1716
1732
  variant: e.variant || "current"
1717
1733
  })), {
1718
- dataKey: I,
1734
+ dataKey: z,
1719
1735
  label: r,
1720
1736
  variant: "comparison"
1721
1737
  }];
1722
1738
  }, [
1723
- L,
1739
+ B,
1724
1740
  t.series,
1725
- Pe,
1726
- I,
1741
+ R,
1742
+ z,
1727
1743
  t.filter,
1728
- P
1729
- ]), z = t.dataset ? n(l(j, xe), t.dimensions, t.values, D) : null, B = z ? {
1744
+ L
1745
+ ]), H = t.dataset ? n(l(j, be), t.dimensions, t.values, E) : null, He = H ? {
1730
1746
  ...t,
1731
- data: z.data,
1732
- xAxisKey: z.xAxisKey,
1733
- series: z.series
1747
+ data: H.data,
1748
+ xAxisKey: H.xAxisKey,
1749
+ series: H.series
1734
1750
  } : {
1735
1751
  ...t,
1736
1752
  data: j,
1737
- ...R ? { series: R } : {}
1738
- }, V = t.colors && !Array.isArray(t.colors) && typeof t.colors == "object" ? t.colors : null, Ue = Array.isArray(t.colors) ? t.colors : void 0, We = k || V ? {
1739
- ...k || {},
1740
- ...V || {}
1753
+ ...V ? { series: V } : {}
1754
+ }, Ue = t.colors && !Array.isArray(t.colors) && typeof t.colors == "object" ? t.colors : null, We = Array.isArray(t.colors) ? t.colors : void 0, U = A || Ue ? {
1755
+ ...A || {},
1756
+ ...Ue || {}
1741
1757
  } : void 0, Ge = {
1742
- ...B,
1743
- colors: Ue,
1744
- ...We ? { categoryColors: We } : {}
1758
+ ...He,
1759
+ colors: We,
1760
+ ...U ? { categoryColors: U } : {}
1745
1761
  };
1746
- if (he && j.length === 0) return /* @__PURE__ */ E("div", {
1762
+ if (ge && j.length === 0) return /* @__PURE__ */ T("div", {
1747
1763
  className: "p-2 " + (t.className || ""),
1748
1764
  "data-testid": "chart-loading",
1749
1765
  role: "status",
1750
1766
  "aria-busy": "true",
1751
1767
  "aria-live": "polite",
1752
- children: [/* @__PURE__ */ T("span", {
1768
+ children: [/* @__PURE__ */ w("span", {
1753
1769
  className: "sr-only",
1754
1770
  children: "Loading chart data…"
1755
- }), /* @__PURE__ */ T(y, { className: "h-full" })]
1771
+ }), /* @__PURE__ */ w(y, { className: "h-full" })]
1756
1772
  });
1757
- if (ge) return /* @__PURE__ */ E("div", {
1773
+ if (_e) return /* @__PURE__ */ T("div", {
1758
1774
  className: "flex flex-col items-center justify-center gap-2 p-4 " + (t.className || ""),
1759
1775
  "data-testid": "chart-error",
1760
1776
  role: "alert",
1761
1777
  children: [
1762
- /* @__PURE__ */ T(Be, { className: "h-6 w-6 text-destructive opacity-60" }),
1763
- /* @__PURE__ */ T("p", {
1778
+ /* @__PURE__ */ w(ze, { className: "h-6 w-6 text-destructive opacity-60" }),
1779
+ /* @__PURE__ */ w("p", {
1764
1780
  className: "text-xs text-destructive font-medium",
1765
1781
  children: "Failed to load chart data"
1766
1782
  }),
1767
- /* @__PURE__ */ T("p", {
1783
+ /* @__PURE__ */ w("p", {
1768
1784
  className: "text-xs text-muted-foreground max-w-xs text-center",
1769
- children: ge
1785
+ children: _e
1770
1786
  })
1771
1787
  ]
1772
1788
  });
1773
- if (!g && t.objectName && j.length === 0) return /* @__PURE__ */ E("div", {
1789
+ if (!g && t.objectName && j.length === 0) return /* @__PURE__ */ T("div", {
1774
1790
  className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (t.className || ""),
1775
1791
  "data-testid": "chart-no-datasource",
1776
1792
  children: [
@@ -1779,86 +1795,83 @@ var Ft = (e) => {
1779
1795
  "”"
1780
1796
  ]
1781
1797
  });
1782
- let H = c(M) ? (e) => {
1783
- let t = e.category, n = t != null && N.has(String(t)) ? N.get(String(t)) : t;
1784
- ye({
1798
+ let Ke = c(M) ? (e) => {
1799
+ let t = e.category, n = t != null && P.has(String(t)) ? P.get(String(t)) : t;
1800
+ k({
1785
1801
  ...e,
1786
1802
  category: n,
1787
1803
  categoryLabel: t,
1788
1804
  scope: "cell"
1789
1805
  });
1790
- } : void 0, Ke = m ?? H, qe = !m && ve && t.objectName ? (() => {
1791
- let e = o(M, ve, { groupByField: Ne }), n = {
1792
- ...t.filter || {},
1793
- ...e
1794
- }, r = d(M, ve, t.title || "Details"), i = M?.target ?? "drawer", a = /* @__PURE__ */ T("div", {
1806
+ } : void 0, qe = m ?? Ke, Je = !m && O && t.objectName && !Ne ? (() => {
1807
+ let e = F ?? {}, n = d(M, O, t.title || "Details"), r = M?.target ?? "drawer", i = {
1808
+ type: "object-data-table",
1809
+ objectName: t.objectName,
1810
+ filter: e,
1811
+ pagination: !0,
1812
+ pageSize: M?.maxRows,
1813
+ columns: M?.columns?.map((e) => ({
1814
+ accessorKey: e,
1815
+ header: e
1816
+ })),
1817
+ drillDown: {
1818
+ enabled: !0,
1819
+ mode: "record",
1820
+ target: "dialog"
1821
+ }
1822
+ }, a = /* @__PURE__ */ w("div", {
1795
1823
  className: "overflow-auto",
1796
1824
  "data-testid": "chart-drill-body",
1797
- children: /* @__PURE__ */ T(Fe, {
1798
- schema: {
1799
- type: "object-data-table",
1800
- objectName: t.objectName,
1801
- filter: n,
1802
- pagination: !0,
1803
- pageSize: M?.maxRows,
1804
- columns: M?.columns?.map((e) => ({
1805
- accessorKey: e,
1806
- header: e
1807
- })),
1808
- drillDown: {
1809
- enabled: !0,
1810
- mode: "record",
1811
- target: "dialog"
1812
- }
1813
- },
1825
+ children: /* @__PURE__ */ w(Pe, {
1826
+ schema: i,
1814
1827
  dataSource: g
1815
1828
  })
1816
- }), s = Ce && t.objectName ? /* @__PURE__ */ E(ie, {
1829
+ }), o = Se && t.objectName ? /* @__PURE__ */ T(ie, {
1817
1830
  type: "button",
1818
1831
  variant: "ghost",
1819
1832
  size: "sm",
1820
1833
  "data-testid": "drill-open-in-list",
1821
1834
  onClick: () => {
1822
- Ce(t.objectName, n), ye(null);
1835
+ Se(t.objectName, e), k(null);
1823
1836
  },
1824
- children: [we("dashboard.openInList", "Open in list"), /* @__PURE__ */ T(Ve, { className: "ml-1 h-3.5 w-3.5" })]
1837
+ children: [Ce("dashboard.openInList", "Open in list"), /* @__PURE__ */ w(Be, { className: "ml-1 h-3.5 w-3.5" })]
1825
1838
  }) : null;
1826
- return i === "dialog" ? /* @__PURE__ */ T(ae, {
1839
+ return r === "dialog" ? /* @__PURE__ */ w(ae, {
1827
1840
  open: !0,
1828
- onOpenChange: (e) => !e && ye(null),
1829
- children: /* @__PURE__ */ E(b, {
1841
+ onOpenChange: (e) => !e && k(null),
1842
+ children: /* @__PURE__ */ T(b, {
1830
1843
  className: "max-w-4xl",
1831
- children: [/* @__PURE__ */ E(x, {
1844
+ children: [/* @__PURE__ */ T(x, {
1832
1845
  className: "flex-row items-center justify-between gap-4 pr-8",
1833
- children: [/* @__PURE__ */ T(S, { children: r }), s]
1846
+ children: [/* @__PURE__ */ w(S, { children: n }), o]
1834
1847
  }), a]
1835
1848
  })
1836
- }) : /* @__PURE__ */ T(oe, {
1849
+ }) : /* @__PURE__ */ w(oe, {
1837
1850
  open: !0,
1838
- onOpenChange: (e) => !e && ye(null),
1839
- children: /* @__PURE__ */ E(se, {
1851
+ onOpenChange: (e) => !e && k(null),
1852
+ children: /* @__PURE__ */ T(se, {
1840
1853
  side: "right",
1841
1854
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
1842
- children: [/* @__PURE__ */ E(ce, {
1855
+ children: [/* @__PURE__ */ T(ce, {
1843
1856
  className: "flex-row items-center justify-between gap-4 pr-8",
1844
- children: [/* @__PURE__ */ T(le, { children: r }), s]
1845
- }), /* @__PURE__ */ T("div", {
1857
+ children: [/* @__PURE__ */ w(le, { children: n }), o]
1858
+ }), /* @__PURE__ */ w("div", {
1846
1859
  className: "flex-1 overflow-hidden mt-2",
1847
1860
  children: a
1848
1861
  })]
1849
1862
  })
1850
1863
  });
1851
1864
  })() : null;
1852
- return /* @__PURE__ */ E("div", {
1865
+ return /* @__PURE__ */ T("div", {
1853
1866
  className: "relative",
1854
1867
  children: [
1855
- /* @__PURE__ */ T(C, { active: he && j.length > 0 }),
1856
- /* @__PURE__ */ T($, {
1868
+ /* @__PURE__ */ w(C, { active: ge && j.length > 0 }),
1869
+ /* @__PURE__ */ w($, {
1857
1870
  ...e,
1858
1871
  schema: Ge,
1859
- onChartClick: Ke
1872
+ onChartClick: qe
1860
1873
  }),
1861
- qe
1874
+ Je
1862
1875
  ]
1863
1876
  });
1864
1877
  };
@@ -1889,6 +1902,12 @@ e.register("object-chart", Ft, {
1889
1902
  type: "object",
1890
1903
  label: "Aggregate",
1891
1904
  description: "Aggregation config: { field, function, groupBy }"
1905
+ },
1906
+ {
1907
+ name: "drillDown",
1908
+ type: "object",
1909
+ label: "Drill-down",
1910
+ description: "Segment drill config: { enabled?, filter?, title?, target?: 'drawer' | 'dialog', columns?, maxRows? }. Present = on; {} is enough. Clicking a segment opens the underlying records filtered by the clicked category."
1892
1911
  }
1893
1912
  ]
1894
1913
  });