@object-ui/plugin-charts 17.5.0 → 17.6.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,87 +1,87 @@
1
- import { ComponentRegistry as e, buildCategoryRank as t, buildChartSeries as n, buildOptionColorMap as r, compareToTrendLabelKey as i, computeDrillFilter as a, deriveDimensionLabelMaps as o, dimensionOptionTranslator as s, extractRecords as c, isDrillEnabled as l, loadDimensionFieldMeta as u, localizeFieldOptions as d, relabelDimensions as f, resolveContextTokens as p, resolveDrillTitle as ee, resolveFilterPlaceholders as m, shiftFilterByCompareTo as te } from "@object-ui/core";
1
+ import { ComponentRegistry as e, buildCategoryRank as t, buildChartSeries as n, buildOptionColorMap as r, chartRowBucketId as i, compareToTrendLabelKey as a, computeDrillFilter as o, deriveDimensionLabelMaps as s, dimensionOptionTranslator as c, extractRecords as l, humanizeLabel as u, isDrillEnabled as d, loadDimensionFieldMeta as f, localizeFieldOptions as p, relabelDimensions as m, resolveContextTokens as ee, resolveDrillTitle as te, resolveFilterPlaceholders as ne, shiftFilterByCompareTo as re } from "@object-ui/core";
2
2
  import * as h from "react";
3
- import g, { Suspense as _, useCallback as ne, useContext as re, useEffect as ie, useMemo as v, useRef as y, useState as b } from "react";
4
- import { Button as x, ChartSkeleton as S, Dialog as C, DialogContent as w, DialogHeader as ae, DialogTitle as oe, RefreshIndicator as se, Sheet as ce, SheetContent as le, SheetHeader as ue, SheetTitle as de, Skeleton as fe } from "@object-ui/components";
5
- import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
6
- import { Area as O, AreaChart as pe, Bar as me, BarChart as k, Brush as he, CartesianGrid as ge, Cell as _e, ComposedChart as ve, Funnel as ye, FunnelChart as be, LabelList as A, Legend as j, Line as xe, LineChart as Se, Pie as Ce, PieChart as we, PolarAngleAxis as Te, PolarGrid as Ee, PolarRadiusAxis as De, Radar as Oe, RadarChart as ke, ReferenceArea as Ae, ReferenceLine as je, ResponsiveContainer as Me, Sankey as Ne, Scatter as Pe, ScatterChart as Fe, Tooltip as M, Treemap as N, XAxis as P, YAxis as F, ZAxis as Ie } from "recharts";
7
- import { ElementDataSourceGate as Le, SchemaRenderer as Re, SchemaRendererContext as ze, useDataScope as Be, useDrillNavigation as Ve, useFilterScope as I } from "@object-ui/react";
8
- import { AlertCircle as He, ArrowUpRight as L } from "lucide-react";
9
- import { useSafeFieldLabel as R, useSafeTranslate as z } from "@object-ui/i18n";
3
+ import g, { Suspense as _, useCallback as ie, useContext as ae, useEffect as oe, useMemo as v, useState as y } from "react";
4
+ import { Button as b, ChartSkeleton as x, Dialog as S, DialogContent as C, DialogHeader as se, DialogTitle as ce, RefreshIndicator as le, Sheet as ue, SheetContent as de, SheetHeader as fe, SheetTitle as pe, Skeleton as w } from "@object-ui/components";
5
+ import { Fragment as me, jsx as T, jsxs as E } from "react/jsx-runtime";
6
+ import { Area as he, AreaChart as ge, Bar as _e, BarChart as D, Brush as ve, CartesianGrid as ye, Cell as be, ComposedChart as O, Funnel as xe, FunnelChart as Se, LabelList as Ce, Legend as k, Line as we, LineChart as Te, Pie as Ee, PieChart as De, PolarAngleAxis as Oe, PolarGrid as ke, PolarRadiusAxis as Ae, Radar as je, RadarChart as Me, ReferenceArea as Ne, ReferenceLine as Pe, ResponsiveContainer as Fe, Sankey as A, Scatter as j, ScatterChart as M, Tooltip as Ie, Treemap as Le, XAxis as N, YAxis as P, ZAxis as Re } from "recharts";
7
+ import { ElementDataSourceGate as F, SchemaRenderer as ze, SchemaRendererContext as Be, useDataScope as Ve, useDrillNavigation as He, useFilterScope as Ue } from "@object-ui/react";
8
+ import { AlertCircle as We, ArrowUpRight as Ge } from "lucide-react";
9
+ import { useSafeFieldLabel as Ke, useSafeTranslate as qe } from "@object-ui/i18n";
10
10
  //#region \0rolldown/runtime.js
11
- var B = Object.defineProperty, V = (e, t, n) => () => {
11
+ var I = Object.defineProperty, L = (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
- }, H = (e, t) => {
18
+ }, R = (e, t) => {
19
19
  let n = {};
20
- for (var r in e) B(n, r, {
20
+ for (var r in e) I(n, r, {
21
21
  get: e[r],
22
22
  enumerable: !0
23
23
  });
24
- return t || B(n, Symbol.toStringTag, { value: "Module" }), n;
24
+ return t || I(n, Symbol.toStringTag, { value: "Module" }), n;
25
25
  };
26
26
  //#endregion
27
27
  //#region src/normalizeChartSchema.ts
28
- function U(e) {
29
- let t = q(e);
28
+ function z(e) {
29
+ let t = W(e);
30
30
  if (t) return t;
31
- if (K(e)) return Object.values(e).find((e) => typeof e == "string" && e);
31
+ if (U(e)) return Object.values(e).find((e) => typeof e == "string" && e);
32
32
  }
33
- function W(e) {
34
- if (!K(e)) return;
35
- let t = {}, n = q(e.field);
33
+ function B(e) {
34
+ if (!U(e)) return;
35
+ let t = {}, n = W(e.field);
36
36
  n && (t.field = n);
37
- let r = q(e.format);
37
+ let r = W(e.format);
38
38
  r && (t.format = r);
39
- let i = J(e.min);
39
+ let i = G(e.min);
40
40
  i !== void 0 && (t.min = i);
41
- let a = J(e.max);
41
+ let a = G(e.max);
42
42
  a !== void 0 && (t.max = a);
43
- let o = J(e.stepSize);
43
+ let o = G(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 = q(e.position);
45
+ let s = W(e.position);
46
46
  (s === "left" || s === "right" || s === "top" || s === "bottom") && (t.position = s);
47
- let c = U(e.title);
47
+ let c = z(e.title);
48
48
  return c && (t.title = c), t;
49
49
  }
50
- function Ue(e) {
51
- if (!K(e)) {
52
- let t = q(e);
50
+ function V(e) {
51
+ if (!U(e)) {
52
+ let t = W(e);
53
53
  return t ? { dataKey: t } : void 0;
54
54
  }
55
- let t = q(e.dataKey) ?? q(e.name);
55
+ let t = W(e.dataKey) ?? W(e.name);
56
56
  if (!t) return;
57
- let n = { dataKey: t }, r = U(e.label);
57
+ let n = { dataKey: t }, r = z(e.label);
58
58
  r && (n.label = r);
59
- let i = q(e.chartType) ?? q(e.type);
59
+ let i = W(e.chartType) ?? W(e.type);
60
60
  (i === "bar" || i === "line" || i === "area") && (n.chartType = i);
61
- let a = q(e.variant);
61
+ let a = W(e.variant);
62
62
  (a === "comparison" || a === "current" || a === "primary") && (n.variant = a);
63
- let o = J(e.opacity);
63
+ let o = G(e.opacity);
64
64
  o !== void 0 && (n.opacity = o);
65
- let s = q(e.dashArray);
65
+ let s = W(e.dashArray);
66
66
  s && (n.dashArray = s);
67
- let c = q(e.stack);
67
+ let c = W(e.stack);
68
68
  c && (n.stack = c);
69
- let l = q(e.yAxis);
69
+ let l = W(e.yAxis);
70
70
  (l === "left" || l === "right") && (n.yAxis = l);
71
- let u = q(e.color);
71
+ let u = W(e.color);
72
72
  return u && (n.color = u), n;
73
73
  }
74
- function We(e) {
75
- if (!K(e)) return {};
76
- let t = {}, n = q(e.type), r = q(e.chartType) ?? q(e.specType) ?? (n && Qe.has(n) ? n : void 0);
77
- r && Ye.has(r) && (t.chartType = r);
78
- let i = e.xAxis, a = W(i);
74
+ function H(e) {
75
+ if (!U(e)) return {};
76
+ let t = {}, n = W(e.type), r = W(e.chartType) ?? W(e.specType) ?? (n && nt.has(n) ? n : void 0);
77
+ r && $e.has(r) && (t.chartType = r);
78
+ let i = e.xAxis, a = B(i);
79
79
  a && (a.format || a.title || a.showGridLines !== void 0) && (t.xAxis = a);
80
- let o = q(e.xAxisKey) ?? a?.field ?? q(i);
80
+ let o = W(e.xAxisKey) ?? a?.field ?? W(i);
81
81
  o && (t.xAxisKey = o);
82
- let s = (Array.isArray(e.yAxis) ? e.yAxis : e.yAxis === void 0 ? [] : [e.yAxis]).map((e) => W(e) ?? (q(e) ? { field: q(e) } : void 0)).filter((e) => !!e);
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);
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(Ue).filter((e) => !!e);
84
+ let c = (Array.isArray(e.series) ? e.series : Array.isArray(e.categories) ? e.categories : void 0)?.map(V).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 We(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 = U(e.title);
94
+ let l = z(e.title);
95
95
  l && (t.title = l);
96
- let u = U(e.subtitle);
96
+ let u = z(e.subtitle);
97
97
  u && (t.subtitle = u);
98
- let d = U(e.description);
98
+ let d = z(e.description);
99
99
  d && (t.description = d);
100
- let f = J(e.height);
101
- return f !== void 0 && f > 0 && (t.height = f), Array.isArray(e.annotations) && e.annotations.length && (t.annotations = e.annotations.filter(K)), K(e.interaction) && (t.interaction = e.interaction), t;
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;
102
102
  }
103
- function Ge(e) {
103
+ function Je(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 Ke(e, t) {
108
+ function Ye(e, t) {
109
109
  if (e === "combo") return "combo";
110
- let n = Ge(e);
110
+ let n = Je(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 G(e) {
115
+ function Xe(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 G(e) {
137
137
  }
138
138
  };
139
139
  }
140
- function qe(e, t) {
140
+ function Ze(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 > Y) return;
146
+ if (u < 1 || u > K) 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 Je(e) {
151
+ function Qe(e) {
152
152
  if (!e) return;
153
153
  let { min: t, max: n } = e;
154
154
  if (t !== void 0 || n !== void 0) return [t ?? "auto", n ?? "auto"];
155
155
  }
156
- var Ye, Xe, Ze, Qe, K, q, J, Y, $e = V((() => {
157
- Ye = /* @__PURE__ */ new Set([
156
+ var $e, et, tt, nt, U, W, G, K, rt = L((() => {
157
+ $e = /* @__PURE__ */ new Set([
158
158
  "bar",
159
159
  "column",
160
160
  "horizontal-bar",
@@ -168,44 +168,44 @@ var Ye, Xe, Ze, Qe, K, q, J, Y, $e = V((() => {
168
168
  "treemap",
169
169
  "sankey",
170
170
  "combo"
171
- ]), Xe = /* @__PURE__ */ new Set([
171
+ ]), et = /* @__PURE__ */ new Set([
172
172
  "gauge",
173
173
  "solid-gauge",
174
174
  "metric",
175
175
  "kpi",
176
176
  "bullet"
177
- ]), Ze = /* @__PURE__ */ new Set(["table", "pivot"]), Qe = /* @__PURE__ */ new Set([
178
- ...Ye,
179
- ...Xe,
180
- ...Ze
181
- ]), K = (e) => !!e && typeof e == "object" && !Array.isArray(e), q = (e) => typeof e == "string" && e ? e : void 0, J = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, Y = 200;
182
- })), et = /* @__PURE__ */ H({ default: () => rt });
183
- function tt(e, t = 14) {
177
+ ]), tt = /* @__PURE__ */ new Set(["table", "pivot"]), nt = /* @__PURE__ */ new Set([
178
+ ...$e,
179
+ ...et,
180
+ ...tt
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, K = 200;
182
+ })), it = /* @__PURE__ */ R({ default: () => st });
183
+ function at(e, t = 14) {
184
184
  return e.length > t ? `${e.slice(0, t - 1)}…` : e;
185
185
  }
186
- function nt({ x: e, y: t, payload: n }) {
187
- let r = String(n?.value ?? ""), i = tt(r);
188
- return /* @__PURE__ */ E("g", {
186
+ function ot({ x: e, y: t, payload: n }) {
187
+ let r = String(n?.value ?? ""), i = at(r);
188
+ return /* @__PURE__ */ T("g", {
189
189
  transform: `translate(${e},${t})`,
190
- children: /* @__PURE__ */ D("text", {
190
+ children: /* @__PURE__ */ E("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__ */ E("title", { children: r }), i]
197
+ children: [r !== i && /* @__PURE__ */ T("title", { children: r }), i]
198
198
  })
199
199
  });
200
200
  }
201
- function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
201
+ function st({ 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__ */ E("div", {
203
+ return /* @__PURE__ */ T("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__ */ E(Me, {
205
+ children: /* @__PURE__ */ T(Fe, {
206
206
  width: "100%",
207
207
  height: r,
208
- children: /* @__PURE__ */ D(k, {
208
+ children: /* @__PURE__ */ E(D, {
209
209
  data: e,
210
210
  margin: {
211
211
  top: 10,
@@ -214,66 +214,66 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
214
214
  bottom: s ? 24 : 5
215
215
  },
216
216
  children: [
217
- /* @__PURE__ */ D("defs", { children: [/* @__PURE__ */ D("linearGradient", {
217
+ /* @__PURE__ */ E("defs", { children: [/* @__PURE__ */ E("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__ */ E("stop", {
224
+ /* @__PURE__ */ T("stop", {
225
225
  offset: "0%",
226
226
  stopColor: a,
227
227
  stopOpacity: 1
228
228
  }),
229
- /* @__PURE__ */ E("stop", {
229
+ /* @__PURE__ */ T("stop", {
230
230
  offset: "90%",
231
231
  stopColor: a,
232
232
  stopOpacity: .6
233
233
  }),
234
- /* @__PURE__ */ E("stop", {
234
+ /* @__PURE__ */ T("stop", {
235
235
  offset: "100%",
236
236
  stopColor: a,
237
237
  stopOpacity: .3
238
238
  })
239
239
  ]
240
- }), /* @__PURE__ */ D("filter", {
240
+ }), /* @__PURE__ */ E("filter", {
241
241
  id: "glow",
242
242
  height: "130%",
243
243
  children: [
244
- /* @__PURE__ */ E("feGaussianBlur", {
244
+ /* @__PURE__ */ T("feGaussianBlur", {
245
245
  in: "SourceAlpha",
246
246
  stdDeviation: "3",
247
247
  result: "blur"
248
248
  }),
249
- /* @__PURE__ */ E("feOffset", {
249
+ /* @__PURE__ */ T("feOffset", {
250
250
  in: "blur",
251
251
  dx: "0",
252
252
  dy: "0",
253
253
  result: "offsetBlur"
254
254
  }),
255
- /* @__PURE__ */ E("feFlood", {
255
+ /* @__PURE__ */ T("feFlood", {
256
256
  floodColor: a,
257
257
  floodOpacity: "0.5",
258
258
  result: "offsetColor"
259
259
  }),
260
- /* @__PURE__ */ E("feComposite", {
260
+ /* @__PURE__ */ T("feComposite", {
261
261
  in: "offsetColor",
262
262
  in2: "offsetBlur",
263
263
  operator: "in",
264
264
  result: "offsetBlur"
265
265
  }),
266
- /* @__PURE__ */ D("feMerge", { children: [/* @__PURE__ */ E("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ E("feMergeNode", { in: "SourceGraphic" })] })
266
+ /* @__PURE__ */ E("feMerge", { children: [/* @__PURE__ */ T("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ T("feMergeNode", { in: "SourceGraphic" })] })
267
267
  ]
268
268
  })] }),
269
- /* @__PURE__ */ E(ge, {
269
+ /* @__PURE__ */ T(ye, {
270
270
  strokeDasharray: "3 3",
271
271
  stroke: "hsl(var(--border))",
272
272
  vertical: !1
273
273
  }),
274
- /* @__PURE__ */ E(P, {
274
+ /* @__PURE__ */ T(N, {
275
275
  dataKey: n,
276
- tick: s ? /* @__PURE__ */ E(nt, {}) : {
276
+ tick: s ? /* @__PURE__ */ T(ot, {}) : {
277
277
  fill: "hsl(var(--muted-foreground))",
278
278
  fontSize: 12,
279
279
  fontFamily: "monospace"
@@ -284,7 +284,7 @@ function rt({ 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__ */ E(F, {
287
+ /* @__PURE__ */ T(P, {
288
288
  tick: {
289
289
  fill: "hsl(var(--muted-foreground))",
290
290
  fontSize: 12,
@@ -293,7 +293,7 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
293
293
  tickLine: !1,
294
294
  axisLine: !1
295
295
  }),
296
- /* @__PURE__ */ E(M, {
296
+ /* @__PURE__ */ T(Ie, {
297
297
  cursor: {
298
298
  fill: "hsl(var(--muted))",
299
299
  opacity: .2
@@ -308,11 +308,11 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
308
308
  },
309
309
  itemStyle: { color: "hsl(var(--primary))" }
310
310
  }),
311
- /* @__PURE__ */ E(j, { wrapperStyle: {
311
+ /* @__PURE__ */ T(k, { wrapperStyle: {
312
312
  paddingTop: "20px",
313
313
  fontFamily: "monospace"
314
314
  } }),
315
- /* @__PURE__ */ E(me, {
315
+ /* @__PURE__ */ T(_e, {
316
316
  dataKey: t,
317
317
  fill: "url(#barGradient)",
318
318
  radius: [
@@ -329,15 +329,15 @@ function rt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
329
329
  })
330
330
  });
331
331
  }
332
- var it = V((() => {}));
332
+ var ct = L((() => {}));
333
333
  //#endregion
334
334
  //#region src/ChartContainerImpl.tsx
335
- function at() {
336
- let e = h.useContext(ut);
335
+ function q() {
336
+ let e = h.useContext(pt);
337
337
  if (!e) throw Error("useChart must be used within a <ChartContainer />");
338
338
  return e;
339
339
  }
340
- function X({ id: e, className: t, children: n, config: r, disableSettleRemount: i, style: a, ...o }) {
340
+ function J({ id: e, className: t, children: n, config: r, disableSettleRemount: i, style: a, ...o }) {
341
341
  let s = h.useId(), c = `chart-${e || s.replace(/:/g, "")}`, l = h.useRef(null), [u, d] = h.useState(0);
342
342
  h.useEffect(() => {
343
343
  if (i) return;
@@ -354,40 +354,41 @@ function X({ id: e, className: t, children: n, config: r, disableSettleRemount:
354
354
  t = !0, n != null && clearTimeout(n), r.disconnect();
355
355
  };
356
356
  }, [i]);
357
- let f = a?.height != null || a?.minHeight != null, p = a?.width != null || a?.minWidth != null, ee = {
358
- ...f ? {} : { minHeight: 280 },
357
+ let f = a?.height != null || a?.minHeight != null, p = a?.width != null || a?.minWidth != null, m = {
358
+ ...f ? {} : { minHeight: mt },
359
359
  ...p ? {} : { minWidth: 0 },
360
360
  ...a
361
361
  };
362
- return /* @__PURE__ */ E(ut.Provider, {
362
+ return /* @__PURE__ */ T(pt.Provider, {
363
363
  value: { config: r },
364
- children: /* @__PURE__ */ D("div", {
364
+ children: /* @__PURE__ */ E("div", {
365
365
  ref: l,
366
366
  "data-slot": "chart",
367
367
  "data-chart": c,
368
- className: Z("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
369
- style: ee,
368
+ className: Y("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
369
+ style: m,
370
370
  ...o,
371
- children: [/* @__PURE__ */ E(dt, {
371
+ children: [/* @__PURE__ */ T(X, {
372
372
  id: c,
373
373
  config: r
374
- }), /* @__PURE__ */ E(Me, {
374
+ }), /* @__PURE__ */ T(Fe, {
375
375
  width: "100%",
376
376
  height: "100%",
377
+ ...f ? {} : { minHeight: mt },
377
378
  children: n
378
379
  }, u)]
379
380
  })
380
381
  });
381
382
  }
382
- function ot({ 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 }) {
383
- let { config: p } = at(), ee = h.useMemo(() => {
383
+ function lt({ 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 }) {
384
+ let { config: p } = q(), m = h.useMemo(() => {
384
385
  if (i || !t?.length) return null;
385
- let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = ct(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
386
- return s ? /* @__PURE__ */ E("div", {
387
- className: Z("font-medium", c),
386
+ let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = dt(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
387
+ return s ? /* @__PURE__ */ T("div", {
388
+ className: Y("font-medium", c),
388
389
  children: s(a, t)
389
- }) : a ? /* @__PURE__ */ E("div", {
390
- className: Z("font-medium", c),
390
+ }) : a ? /* @__PURE__ */ T("div", {
391
+ className: Y("font-medium", c),
391
392
  children: a
392
393
  }) : null;
393
394
  }, [
@@ -400,30 +401,30 @@ function ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
400
401
  f
401
402
  ]);
402
403
  if (!e || !t?.length) return null;
403
- let m = t.length === 1 && r !== "dot";
404
- return /* @__PURE__ */ D("div", {
405
- className: Z("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),
406
- children: [m ? null : ee, /* @__PURE__ */ E("div", {
404
+ let ee = t.length === 1 && r !== "dot";
405
+ return /* @__PURE__ */ E("div", {
406
+ 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),
407
+ children: [ee ? null : m, /* @__PURE__ */ T("div", {
407
408
  className: "grid gap-1.5",
408
409
  children: t.filter((e) => e.type !== "none").map((e, t) => {
409
- let n = `${d || e.name || e.dataKey || "value"}`, i = ct(p, e, n), o = u || e.payload.fill || e.color;
410
- return /* @__PURE__ */ E("div", {
411
- className: Z("[&>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" : ""),
412
- children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ D(T, { children: [i?.icon ? /* @__PURE__ */ E(i.icon, {}) : !a && /* @__PURE__ */ E("div", {
413
- className: Z("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" : "", m && r === "dashed" ? "my-0.5" : ""),
410
+ let n = `${d || e.name || e.dataKey || "value"}`, i = dt(p, e, n), o = u || e.payload.fill || e.color;
411
+ return /* @__PURE__ */ T("div", {
412
+ 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" : ""),
413
+ children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ E(me, { children: [i?.icon ? /* @__PURE__ */ T(i.icon, {}) : !a && /* @__PURE__ */ T("div", {
414
+ 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" : "", ee && r === "dashed" ? "my-0.5" : ""),
414
415
  style: {
415
416
  "--color-bg": o,
416
417
  "--color-border": o
417
418
  }
418
- }), /* @__PURE__ */ D("div", {
419
- className: Z("flex flex-1 justify-between leading-none", m ? "items-end" : "items-center"),
420
- children: [/* @__PURE__ */ D("div", {
419
+ }), /* @__PURE__ */ E("div", {
420
+ className: Y("flex flex-1 justify-between leading-none", ee ? "items-end" : "items-center"),
421
+ children: [/* @__PURE__ */ E("div", {
421
422
  className: "grid gap-1.5",
422
- children: [m ? ee : null, /* @__PURE__ */ E("span", {
423
+ children: [ee ? m : null, /* @__PURE__ */ T("span", {
423
424
  className: "text-muted-foreground",
424
425
  children: i?.label || e.name
425
426
  })]
426
- }), e.value && /* @__PURE__ */ E("span", {
427
+ }), e.value && /* @__PURE__ */ T("span", {
427
428
  className: "text-foreground font-mono font-medium tabular-nums",
428
429
  children: e.value.toLocaleString()
429
430
  })]
@@ -433,15 +434,15 @@ function ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
433
434
  })]
434
435
  });
435
436
  }
436
- function st({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
437
- let { config: a } = at();
438
- return n?.length ? /* @__PURE__ */ E("div", {
439
- className: Z("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
437
+ function ut({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
438
+ let { config: a } = q();
439
+ return n?.length ? /* @__PURE__ */ T("div", {
440
+ className: Y("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
440
441
  children: n.filter((e) => e.type !== "none").map((e) => {
441
- let n = `${i || e.dataKey || "value"}`, r = ct(a, e, n);
442
- return /* @__PURE__ */ D("div", {
443
- className: Z("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
444
- children: [r?.icon && !t ? /* @__PURE__ */ E(r.icon, {}) : /* @__PURE__ */ E("div", {
442
+ let n = `${i || e.dataKey || "value"}`, r = dt(a, e, n);
443
+ return /* @__PURE__ */ E("div", {
444
+ className: Y("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
445
+ children: [r?.icon && !t ? /* @__PURE__ */ T(r.icon, {}) : /* @__PURE__ */ T("div", {
445
446
  className: "h-2 w-2 shrink-0 rounded-[2px]",
446
447
  style: { backgroundColor: e.color }
447
448
  }), r?.label]
@@ -449,18 +450,18 @@ function st({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bo
449
450
  })
450
451
  }) : null;
451
452
  }
452
- function ct(e, t, n) {
453
+ function dt(e, t, n) {
453
454
  if (typeof t != "object" || !t) return;
454
455
  let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
455
456
  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];
456
457
  }
457
- var Z, lt, ut, dt, ft, pt, mt = V((() => {
458
- Z = (...e) => e.filter(Boolean).join(" "), lt = {
458
+ var Y, ft, pt, mt, X, Z, ht, gt = L((() => {
459
+ Y = (...e) => e.filter(Boolean).join(" "), ft = {
459
460
  light: "",
460
461
  dark: ".dark"
461
- }, ut = h.createContext(null), dt = ({ id: e, config: t }) => {
462
+ }, pt = h.createContext(null), mt = 280, X = ({ id: e, config: t }) => {
462
463
  let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
463
- return n.length ? /* @__PURE__ */ E("style", { dangerouslySetInnerHTML: { __html: Object.entries(lt).map(([t, r]) => `
464
+ return n.length ? /* @__PURE__ */ T("style", { dangerouslySetInnerHTML: { __html: Object.entries(ft).map(([t, r]) => `
464
465
  ${r} [data-chart=${e}] {
465
466
  ${n.map(([e, n]) => {
466
467
  let r = n.theme?.[t] || n.color;
@@ -468,48 +469,48 @@ ${n.map(([e, n]) => {
468
469
  }).join("\n")}
469
470
  }
470
471
  `).join("\n") } }) : null;
471
- }, ft = M, pt = j;
472
+ }, Z = Ie, ht = k;
472
473
  }));
473
474
  //#endregion
474
475
  //#region src/chartDrillEvents.ts
475
- function ht(e) {
476
+ function _t(e) {
476
477
  return e?.[0]?.dataKey || "value";
477
478
  }
478
- function gt(e, t, n) {
479
+ function vt(e, t, n) {
479
480
  if (!e) return null;
480
481
  let r = e.payload ?? e, i = r?.[t];
481
482
  if (i == null) return null;
482
- let a = ht(n);
483
+ let a = _t(n);
483
484
  return {
484
485
  category: String(i),
485
486
  series: a,
486
487
  value: typeof r?.[a] == "number" ? r[a] : void 0
487
488
  };
488
489
  }
489
- function _t(e, t) {
490
+ function yt(e, t) {
490
491
  if (!e) return null;
491
492
  let n = e.name ?? e.payload?.name ?? e.root?.name;
492
493
  if (n == null) return null;
493
494
  let r = e.value ?? e.size ?? e.payload?.size;
494
495
  return {
495
496
  category: String(n),
496
- series: ht(t),
497
+ series: _t(t),
497
498
  value: typeof r == "number" ? r : void 0
498
499
  };
499
500
  }
500
- function vt(e, t) {
501
+ function bt(e, t) {
501
502
  if (!e) return null;
502
503
  let n = e.payload ?? e, r = n?.name;
503
504
  return r == null || n?.depth === 0 ? null : {
504
505
  category: String(r),
505
- series: ht(t),
506
+ series: _t(t),
506
507
  value: typeof n?.value == "number" ? n.value : void 0
507
508
  };
508
509
  }
509
- var yt = V((() => {})), bt = /* @__PURE__ */ H({ default: () => Tt });
510
- function xt(e) {
510
+ var xt = L((() => {})), St = /* @__PURE__ */ R({ default: () => kt });
511
+ function Ct(e) {
511
512
  let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
512
- return r <= 0 || i <= 0 ? null : /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("rect", {
513
+ return r <= 0 || i <= 0 ? null : /* @__PURE__ */ E("g", { children: [/* @__PURE__ */ T("rect", {
513
514
  x: t,
514
515
  y: n,
515
516
  width: r,
@@ -517,7 +518,7 @@ function xt(e) {
517
518
  fill: o,
518
519
  stroke: "hsl(var(--background))",
519
520
  strokeWidth: 2
520
- }), r > 48 && i > 18 ? /* @__PURE__ */ E("text", {
521
+ }), r > 48 && i > 18 ? /* @__PURE__ */ T("text", {
521
522
  x: t + 6,
522
523
  y: n + 18,
523
524
  fill: "#fff",
@@ -526,102 +527,127 @@ function xt(e) {
526
527
  children: a
527
528
  }) : null] });
528
529
  }
529
- function St({ title: e, subtitle: t, children: n }) {
530
- return !e && !t ? /* @__PURE__ */ E(T, { children: n }) : /* @__PURE__ */ D("div", {
530
+ function wt({ title: e, subtitle: t, children: n }) {
531
+ return !e && !t ? /* @__PURE__ */ T(me, { children: n }) : /* @__PURE__ */ E("div", {
531
532
  className: "flex h-full w-full flex-col",
532
- children: [/* @__PURE__ */ D("div", {
533
+ children: [/* @__PURE__ */ E("div", {
533
534
  className: "mb-2 shrink-0",
534
- children: [e ? /* @__PURE__ */ E("div", {
535
+ children: [e ? /* @__PURE__ */ T("div", {
535
536
  className: "text-sm font-medium leading-tight text-foreground",
536
537
  children: e
537
- }) : null, t ? /* @__PURE__ */ E("div", {
538
+ }) : null, t ? /* @__PURE__ */ T("div", {
538
539
  className: "text-xs leading-tight text-muted-foreground",
539
540
  children: t
540
541
  }) : null]
541
- }), /* @__PURE__ */ E("div", {
542
+ }), /* @__PURE__ */ T("div", {
542
543
  className: "min-h-0 flex-1",
543
544
  children: n
544
545
  })]
545
546
  });
546
547
  }
547
- function Ct({ 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: ee, showDataLabels: m, title: te, subtitle: g, description: _, height: ne, annotations: re, interaction: ie }) {
548
- let v = e === "column" ? "bar" : e, y = Ke(v, a), b = Ge(v), x = Array.isArray(n) ? n : [], S = d === !1 ? { isAnimationActive: !1 } : {}, C = {
549
- ...d === !1 ? { disableSettleRemount: !0 } : {},
550
- ...ne ? { style: { height: ne } } : {},
551
- ..._ ? {
548
+ function Tt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: a = "name", series: o = [], className: s = "", colors: c, categoryColors: l, categoryOrder: u, onChartClick: d, isAnimationActive: f, xAxis: p, yAxes: m, showLegend: ee, showDataLabels: te, title: ne, subtitle: re, description: g, height: _, annotations: ie, interaction: ae }) {
549
+ let oe = e === "column" ? "bar" : e, v = Ye(oe, o), y = Je(oe), b = Array.isArray(n) ? n : [], x = f === !1 ? { isAnimationActive: !1 } : {}, S = {
550
+ ...f === !1 ? { disableSettleRemount: !0 } : {},
551
+ ..._ ? { style: { height: _ } } : {},
552
+ ...g ? {
552
553
  role: "img",
553
- "aria-label": _
554
+ "aria-label": g
554
555
  } : {}
555
- }, [w, ae] = h.useState(!1), oe = h.useCallback((e) => {
556
- if (!u || !e) return;
557
- let t = Array.isArray(e.activePayload) ? e.activePayload[0] : void 0;
558
- u({
556
+ }, [C, se] = h.useState(!1), ce = h.useRef(null), le = h.useCallback((e) => (...t) => {
557
+ let n = Ft(t);
558
+ n !== void 0 && (ce.current = {
559
+ gesture: n,
560
+ dataKey: String(e.dataKey)
561
+ });
562
+ }, []), ue = d ? (e) => ({ onClick: le(e) }) : () => ({}), de = h.useCallback((e, t, n) => {
563
+ if (!d || !e) return;
564
+ let r = e.activeTooltipIndex ?? e.activeIndex, a = r == null ? NaN : Number(r), s = Number.isInteger(a) && a >= 0 ? b[a] : void 0, c = ce.current;
565
+ ce.current = null;
566
+ let l = Pt(t), u = c != null && l !== void 0 && c.gesture === l;
567
+ if (n && !u) return;
568
+ let f = u ? c.dataKey : Nt(e.activeDataKey, o), p = f != null && s ? s[f] : void 0;
569
+ d({
559
570
  category: e.activeLabel == null ? void 0 : String(e.activeLabel),
560
- series: t?.dataKey ? String(t.dataKey) : void 0,
561
- value: typeof t?.value == "number" ? t.value : void 0
571
+ categoryId: i(s),
572
+ series: f,
573
+ seriesLabel: It(f, o),
574
+ value: typeof p == "number" ? p : void 0
562
575
  });
563
- }, [u]), se = h.useCallback((e) => {
564
- if (!u || !e) return;
565
- let t = e.payload?.[i], n = a[0]?.dataKey || "value";
566
- u({
576
+ }, [
577
+ d,
578
+ b,
579
+ o
580
+ ]), fe = h.useCallback((e, t) => {
581
+ de(e, t, !1);
582
+ }, [de]), pe = h.useCallback((e, t) => {
583
+ de(e, t, !0);
584
+ }, [de]), w = h.useCallback((e) => {
585
+ if (!d || !e) return;
586
+ let t = e.payload?.[a], n = o[0]?.dataKey || "value";
587
+ d({
567
588
  category: t == null ? void 0 : String(t),
589
+ categoryId: i(e.payload),
568
590
  series: n,
591
+ seriesLabel: It(n, o),
569
592
  value: typeof e.payload?.[n] == "number" ? e.payload[n] : void 0
570
593
  });
571
594
  }, [
572
- u,
573
- i,
574
- a
575
- ]), ce = u ? {
576
- onClick: oe,
595
+ d,
596
+ a,
597
+ o
598
+ ]), k = d ? {
599
+ onClick: fe,
577
600
  style: { cursor: "pointer" }
578
- } : {}, le = u ? {
579
- onClick: se,
601
+ } : {}, Fe = d ? { onClick: pe } : {}, F = d ? (e) => ({
602
+ ...ue(e),
603
+ cursor: "pointer"
604
+ }) : () => ({}), ze = d ? {
605
+ onClick: w,
580
606
  style: { cursor: "pointer" }
581
- } : {}, ue = h.useCallback((e, t, n) => c && c[e == null ? "" : String(e)] || n[t % n.length], [c]), de = h.useCallback((e) => {
582
- if (!u) return;
583
- let t = gt(e, i, a);
584
- t && u(t);
607
+ } : {}, Be = h.useCallback((e, t, n) => l && l[e == null ? "" : String(e)] || n[t % n.length], [l]), Ve = h.useCallback((e) => {
608
+ if (!d) return;
609
+ let t = vt(e, a, o);
610
+ t && d(t);
585
611
  }, [
586
- u,
587
- i,
588
- a
589
- ]), fe = h.useCallback((e) => {
590
- if (!u) return;
591
- let t = _t(e, a);
592
- t && u(t);
593
- }, [u, a]), j = h.useCallback((e) => {
594
- if (!u) return;
595
- let t = vt(e, a);
596
- t && u(t);
597
- }, [u, a]), Me = u ? {
598
- onClick: de,
612
+ d,
613
+ a,
614
+ o
615
+ ]), He = h.useCallback((e) => {
616
+ if (!d) return;
617
+ let t = yt(e, o);
618
+ t && d(t);
619
+ }, [d, o]), Ue = h.useCallback((e) => {
620
+ if (!d) return;
621
+ let t = bt(e, o);
622
+ t && d(t);
623
+ }, [d, o]), We = d ? {
624
+ onClick: Ve,
599
625
  cursor: "pointer"
600
- } : {}, Le = u ? {
601
- onClick: fe,
626
+ } : {}, Ge = d ? {
627
+ onClick: He,
602
628
  style: { cursor: "pointer" }
603
- } : {}, Re = u ? {
604
- onClick: j,
629
+ } : {}, Ke = d ? {
630
+ onClick: Ue,
605
631
  style: { cursor: "pointer" }
606
632
  } : {};
607
633
  h.useEffect(() => {
608
- let e = () => ae(window.innerWidth < 640);
634
+ let e = () => se(window.innerWidth < 640);
609
635
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
610
636
  }, []);
611
- let ze = {
612
- bar: k,
613
- "horizontal-bar": k,
614
- line: Se,
615
- area: pe,
616
- pie: we,
617
- donut: we,
618
- radar: ke,
619
- scatter: Fe,
620
- funnel: be,
621
- combo: ve,
622
- treemap: k,
623
- sankey: k
624
- }[y] || k, Be = h.useCallback((e) => {
637
+ let qe = {
638
+ bar: D,
639
+ "horizontal-bar": D,
640
+ line: Te,
641
+ area: ge,
642
+ pie: De,
643
+ donut: De,
644
+ radar: Me,
645
+ scatter: M,
646
+ funnel: Se,
647
+ combo: O,
648
+ treemap: D,
649
+ sankey: D
650
+ }[v] || D, I = h.useCallback((e) => {
625
651
  if (e == null || e === "") return "";
626
652
  let t = r?.[String(e)]?.label;
627
653
  if (t != null) return String(t);
@@ -629,7 +655,7 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
629
655
  if (/^\d{4}-\d{2}-\d{2}/.test(n)) {
630
656
  let e = new Date(n);
631
657
  if (!Number.isNaN(e.getTime())) {
632
- let t = (x.length > 1 ? Math.abs(new Date(String(x[x.length - 1][i] ?? "")).getTime() - new Date(String(x[0][i] ?? "")).getTime()) : 0) / 864e5;
658
+ let t = (b.length > 1 ? Math.abs(new Date(String(b[b.length - 1][a] ?? "")).getTime() - new Date(String(b[0][a] ?? "")).getTime()) : 0) / 864e5;
633
659
  try {
634
660
  return t <= 62 ? e.toLocaleDateString(void 0, {
635
661
  month: "short",
@@ -643,19 +669,19 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
643
669
  }
644
670
  }
645
671
  }
646
- return w && n.length > 8 ? n.slice(0, 8) + "…" : n;
672
+ return C && n.length > 8 ? n.slice(0, 8) + "…" : n;
647
673
  }, [
648
- x,
649
- i,
650
- w,
674
+ b,
675
+ a,
676
+ C,
651
677
  r
652
- ]), Ve = h.useMemo(() => x.some((e) => String(e[i] || "").length > 5), [x, i]), I = () => Array.isArray(s) && s.length > 0 ? s : [
678
+ ]), L = h.useMemo(() => b.some((e) => String(e[a] || "").length > 5), [b, a]), R = () => Array.isArray(c) && c.length > 0 ? c : [
653
679
  "hsl(var(--chart-1))",
654
680
  "hsl(var(--chart-2))",
655
681
  "hsl(var(--chart-3))",
656
682
  "hsl(var(--chart-4))",
657
683
  "hsl(var(--chart-5))"
658
- ], He = h.useCallback((e) => {
684
+ ], z = h.useCallback((e) => {
659
685
  if (e == null || e === "") return "";
660
686
  let t = typeof e == "number" ? e : Number(e);
661
687
  if (!Number.isFinite(t)) return String(e);
@@ -667,20 +693,20 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
667
693
  } catch {
668
694
  return String(t);
669
695
  }
670
- }, []), L = p?.[0], R = p && p.length > 1 ? p[1] : L?.position === "right" ? L : void 0, z = !!p && p.length > 1, B = h.useMemo(() => G(f?.format) ?? Be, [f?.format, Be]), V = h.useMemo(() => G(L?.format) ?? He, [L?.format, He]), H = h.useMemo(() => G(R?.format) ?? He, [R?.format, He]), U = h.useCallback((e) => {
671
- let t = a.filter((t) => z ? (t.yAxis === "right" ? "right" : "left") === e : e === "left").map((e) => e.dataKey), n = [];
672
- for (let e of x) for (let r of t) {
696
+ }, []), B = m?.[0], V = m && m.length > 1 ? m[1] : B?.position === "right" ? B : void 0, H = !!m && m.length > 1, nt = h.useMemo(() => Xe(p?.format) ?? I, [p?.format, I]), U = h.useMemo(() => Xe(B?.format) ?? z, [B?.format, z]), W = h.useMemo(() => Xe(V?.format) ?? z, [V?.format, z]), G = h.useCallback((e) => {
697
+ let t = o.filter((t) => H ? (t.yAxis === "right" ? "right" : "left") === e : e === "left").map((e) => e.dataKey), n = [];
698
+ for (let e of b) for (let r of t) {
673
699
  let t = Number(e?.[r]);
674
700
  Number.isFinite(t) && n.push(t);
675
701
  }
676
702
  return n;
677
703
  }, [
678
- x,
679
- a,
680
- z
681
- ]), W = h.useCallback((e, t = "left") => {
704
+ b,
705
+ o,
706
+ H
707
+ ]), K = h.useCallback((e, t = "left") => {
682
708
  if (!e) return {};
683
- let n = Je(e), r = qe(e, U(t));
709
+ let n = Qe(e), r = Ze(e, G(t));
684
710
  return {
685
711
  ...r ? { ticks: r } : {},
686
712
  ...n ? { domain: n } : {},
@@ -695,17 +721,17 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
695
721
  position: "insideLeft"
696
722
  } } : {}
697
723
  };
698
- }, [U]), Ue = L?.showGridLines !== !1, We = {
699
- vertical: f?.showGridLines === !0,
700
- horizontal: Ue
701
- }, Qe = ee !== !1, K = h.useMemo(() => {
702
- if (!Array.isArray(re) || re.length === 0) return null;
724
+ }, [G]), rt = B?.showGridLines !== !1, it = {
725
+ vertical: p?.showGridLines === !0,
726
+ horizontal: rt
727
+ }, at = ee !== !1, ot = h.useMemo(() => {
728
+ if (!Array.isArray(ie) || ie.length === 0) return null;
703
729
  let e = {
704
730
  solid: void 0,
705
731
  dashed: "4 4",
706
732
  dotted: "1 4"
707
733
  };
708
- return re.map((t, n) => {
734
+ return ie.map((t, n) => {
709
735
  let r = t?.axis === "x", i = Q(String(t?.color || "hsl(var(--muted-foreground))")), a = e[String(t?.style ?? "dashed")], o = typeof t?.label == "string" ? t.label : void 0, s = o ? { label: {
710
736
  value: o,
711
737
  position: "insideTopRight",
@@ -720,9 +746,9 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
720
746
  y1: t.value,
721
747
  y2: t.endValue
722
748
  };
723
- return /* @__PURE__ */ E(Ae, {
749
+ return /* @__PURE__ */ T(Ne, {
724
750
  ...e,
725
- ...z && !r ? { yAxisId: "left" } : {},
751
+ ...H && !r ? { yAxisId: "left" } : {},
726
752
  fill: i,
727
753
  fillOpacity: .12,
728
754
  stroke: i,
@@ -730,198 +756,199 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
730
756
  ...s
731
757
  }, `ann-${n}`);
732
758
  }
733
- return /* @__PURE__ */ E(je, {
759
+ return /* @__PURE__ */ T(Pe, {
734
760
  ...r ? { x: t?.value } : { y: t?.value },
735
- ...z && !r ? { yAxisId: "left" } : {},
761
+ ...H && !r ? { yAxisId: "left" } : {},
736
762
  stroke: i,
737
763
  strokeDasharray: a,
738
764
  ...s
739
765
  }, `ann-${n}`);
740
766
  });
741
- }, [re, z]), q = ie?.tooltips !== !1, J = ie?.brush === !0 ? /* @__PURE__ */ E(he, {
742
- dataKey: i,
767
+ }, [ie, H]), st = ae?.tooltips !== !1, ct = ae?.brush === !0 ? /* @__PURE__ */ T(ve, {
768
+ dataKey: a,
743
769
  height: 24,
744
770
  travellerWidth: 8,
745
771
  stroke: "hsl(var(--muted-foreground))"
746
- }) : null, Y = (e) => m ? /* @__PURE__ */ E(A, {
772
+ }) : null, q = (e) => te ? /* @__PURE__ */ T(Ce, {
747
773
  position: "top",
748
774
  className: "fill-foreground",
749
775
  fontSize: 11,
750
776
  ...e ? { formatter: e } : {}
751
- }) : null, $e = h.useMemo(() => ({
777
+ }) : null, dt = h.useMemo(() => ({
752
778
  tickLine: !1,
753
779
  tickMargin: 10,
754
780
  axisLine: !1,
755
781
  interval: "preserveStartEnd",
756
- minTickGap: w ? 32 : 48,
757
- tickFormatter: B,
758
- ...f?.title ? { label: {
759
- value: f.title,
782
+ minTickGap: C ? 32 : 48,
783
+ tickFormatter: nt,
784
+ ...p?.title ? { label: {
785
+ value: p.title,
760
786
  position: "insideBottom",
761
787
  offset: -4
762
788
  } } : {},
763
- ...!w && Ve && {
789
+ ...!C && L && {
764
790
  angle: -35,
765
791
  textAnchor: "end",
766
792
  height: 60
767
793
  }
768
794
  }), [
769
- w,
770
- Ve,
771
- B,
772
- f?.title
795
+ C,
796
+ L,
797
+ nt,
798
+ p?.title
773
799
  ]);
774
- if (y && Xe.has(y)) {
775
- let e = a[0]?.dataKey || "value", t = x[0]?.[e], n = typeof t == "number" ? t : Number(t), i = a[0]?.label ?? r?.[e]?.label ?? e;
776
- return /* @__PURE__ */ E("div", {
777
- className: o,
800
+ if (v && et.has(v)) {
801
+ let e = o[0]?.dataKey || "value", t = b[0]?.[e], n = typeof t == "number" ? t : Number(t), i = o[0]?.label ?? r?.[e]?.label ?? e;
802
+ return /* @__PURE__ */ T("div", {
803
+ className: s,
778
804
  "data-testid": "advanced-chart-single-value",
779
- children: /* @__PURE__ */ D("div", {
805
+ children: /* @__PURE__ */ E("div", {
780
806
  className: "flex flex-col gap-1 py-4",
781
- children: [/* @__PURE__ */ E("span", {
807
+ children: [/* @__PURE__ */ T("span", {
782
808
  className: "text-3xl font-semibold tabular-nums",
783
809
  children: Number.isFinite(n) ? new Intl.NumberFormat().format(n) : String(t ?? "—")
784
- }), /* @__PURE__ */ E("span", {
810
+ }), /* @__PURE__ */ T("span", {
785
811
  className: "text-xs text-muted-foreground",
786
812
  children: String(i)
787
813
  })]
788
814
  })
789
815
  });
790
816
  }
791
- if (y && Ze.has(y)) return /* @__PURE__ */ D("div", {
792
- className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${o ?? ""}`,
817
+ if (v && tt.has(v)) return /* @__PURE__ */ E("div", {
818
+ className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${s ?? ""}`,
793
819
  "data-testid": "advanced-chart-tabular-notice",
794
820
  role: "note",
795
821
  children: [
796
822
  "Chart type “",
797
- y,
823
+ v,
798
824
  "” is tabular — render it with the data-table / pivot components; a chart block draws series charts."
799
825
  ]
800
826
  });
801
- if (y && !Ye.has(y)) return /* @__PURE__ */ D("div", {
802
- className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${o ?? ""}`,
827
+ if (v && !$e.has(v)) return /* @__PURE__ */ E("div", {
828
+ className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${s ?? ""}`,
803
829
  "data-testid": "advanced-chart-unknown-type",
804
830
  role: "note",
805
831
  children: [
806
832
  "Chart type “",
807
- y,
833
+ v,
808
834
  "” is not a spec chart type — nothing was drawn."
809
835
  ]
810
836
  });
811
- if (y === "pie" || y === "donut") {
812
- let e = y === "donut" ? "52%" : 0, t = I(), n = { ...r };
813
- return x.forEach((e, r) => {
814
- let a = e?.[i];
815
- if (a == null || a === "") return;
816
- let o = String(a);
837
+ if (v === "pie" || v === "donut") {
838
+ let e = v === "donut" ? "52%" : 0, t = R(), n = { ...r };
839
+ return b.forEach((e, r) => {
840
+ let i = e?.[a];
841
+ if (i == null || i === "") return;
842
+ let o = String(i);
817
843
  n[o] || (n[o] = {
818
844
  label: o,
819
- color: ue(a, r, t)
845
+ color: Be(i, r, t)
820
846
  });
821
- }), /* @__PURE__ */ E(X, {
847
+ }), /* @__PURE__ */ T(J, {
822
848
  config: n,
823
- className: o,
824
- ...C,
825
- children: /* @__PURE__ */ D(we, { children: [
826
- /* @__PURE__ */ E(ft, {
849
+ className: s,
850
+ ...S,
851
+ children: /* @__PURE__ */ E(De, { children: [
852
+ /* @__PURE__ */ T(Z, {
827
853
  cursor: !1,
828
- content: /* @__PURE__ */ E(ot, { hideLabel: !0 })
854
+ content: /* @__PURE__ */ T(lt, { hideLabel: !0 })
829
855
  }),
830
- /* @__PURE__ */ E(Ce, {
831
- data: x,
832
- dataKey: a[0]?.dataKey || "value",
833
- nameKey: i || "name",
856
+ /* @__PURE__ */ T(Ee, {
857
+ data: b,
858
+ dataKey: o[0]?.dataKey || "value",
859
+ nameKey: a || "name",
834
860
  innerRadius: e,
835
861
  strokeWidth: 5,
836
862
  paddingAngle: 2,
837
863
  outerRadius: "85%",
838
- ...S,
839
- ...le,
840
- children: x.map((e, n) => {
841
- let r = ue(e?.[i], n, t);
842
- return /* @__PURE__ */ E(_e, { fill: Q(r) }, `cell-${n}`);
864
+ ...x,
865
+ ...ze,
866
+ children: b.map((e, n) => {
867
+ let r = Be(e?.[a], n, t);
868
+ return /* @__PURE__ */ T(be, { fill: Q(r) }, `cell-${n}`);
843
869
  })
844
870
  }),
845
- Qe ? /* @__PURE__ */ E(pt, {
871
+ at ? /* @__PURE__ */ T(ht, {
846
872
  verticalAlign: "bottom",
847
873
  wrapperStyle: {
848
- fontSize: w ? "11px" : "12px",
874
+ fontSize: C ? "11px" : "12px",
849
875
  paddingTop: "8px"
850
876
  },
851
- content: /* @__PURE__ */ E(st, {
852
- nameKey: i,
877
+ content: /* @__PURE__ */ T(ut, {
878
+ nameKey: a,
853
879
  className: "flex-wrap"
854
880
  })
855
881
  }) : null
856
882
  ] })
857
883
  });
858
884
  }
859
- if (y === "funnel") {
860
- let e = a[0]?.dataKey || "value", n = I(), s = u ? (t) => {
861
- t && u({
862
- category: t?.payload?.[i] ?? t?.[i],
885
+ if (v === "funnel") {
886
+ let e = o[0]?.dataKey || "value", n = R(), c = d ? (t) => {
887
+ t && d({
888
+ category: t?.payload?.[a] ?? t?.[a],
889
+ categoryId: i(t?.payload) ?? i(t),
863
890
  value: t?.payload?.[e] ?? t?.[e]
864
891
  });
865
- } : void 0, c = s ? {
866
- onClick: s,
892
+ } : void 0, l = c ? {
893
+ onClick: c,
867
894
  style: { cursor: "pointer" }
868
- } : {}, d = t(l), f = d ? [...x].sort((e, t) => (d.get(String(e?.[i] ?? "")) ?? 2 ** 53 - 1) - (d.get(String(t?.[i] ?? "")) ?? 2 ** 53 - 1)) : [...x].sort((t, n) => {
895
+ } : {}, f = t(u), p = f ? [...b].sort((e, t) => (f.get(String(e?.[a] ?? "")) ?? 2 ** 53 - 1) - (f.get(String(t?.[a] ?? "")) ?? 2 ** 53 - 1)) : [...b].sort((t, n) => {
869
896
  let r = Number(t?.[e] ?? 0);
870
897
  return Number(n?.[e] ?? 0) - r;
871
898
  });
872
- return /* @__PURE__ */ E(X, {
899
+ return /* @__PURE__ */ T(J, {
873
900
  config: r,
874
- className: o,
875
- ...C,
876
- children: /* @__PURE__ */ D(be, { children: [/* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }), /* @__PURE__ */ D(ye, {
901
+ className: s,
902
+ ...S,
903
+ children: /* @__PURE__ */ E(Se, { children: [/* @__PURE__ */ T(Z, { content: /* @__PURE__ */ T(lt, {}) }), /* @__PURE__ */ E(xe, {
877
904
  dataKey: e,
878
- data: f,
879
- nameKey: i,
880
- ...S,
881
- ...c,
882
- children: [/* @__PURE__ */ E(A, {
905
+ data: p,
906
+ nameKey: a,
907
+ ...x,
908
+ ...l,
909
+ children: [/* @__PURE__ */ T(Ce, {
883
910
  position: "right",
884
911
  fill: "hsl(var(--foreground))",
885
912
  stroke: "none",
886
- dataKey: i
887
- }), f.map((e, t) => /* @__PURE__ */ E(_e, { fill: Q(n[t % n.length]) }, `funnel-cell-${t}`))]
913
+ dataKey: a
914
+ }), p.map((e, t) => /* @__PURE__ */ T(be, { fill: Q(n[t % n.length]) }, `funnel-cell-${t}`))]
888
915
  })] })
889
916
  });
890
917
  }
891
- if (y === "treemap") {
892
- let e = a[0]?.dataKey || "value", t = I(), n = x.map((n, r) => ({
893
- name: String(n?.[i] ?? ""),
918
+ if (v === "treemap") {
919
+ let e = o[0]?.dataKey || "value", t = R(), n = b.map((n, r) => ({
920
+ name: String(n?.[a] ?? ""),
894
921
  size: Number(n?.[e]) || 0,
895
922
  fill: Q(t[r % t.length])
896
923
  }));
897
- return /* @__PURE__ */ E(X, {
924
+ return /* @__PURE__ */ T(J, {
898
925
  config: r,
899
- className: o,
900
- ...C,
901
- children: /* @__PURE__ */ E(N, {
926
+ className: s,
927
+ ...S,
928
+ children: /* @__PURE__ */ T(Le, {
902
929
  data: n,
903
930
  dataKey: "size",
904
931
  nameKey: "name",
905
- ...S,
906
- content: /* @__PURE__ */ E(xt, {}),
907
- ...Le,
908
- children: /* @__PURE__ */ E(M, {})
932
+ ...x,
933
+ content: /* @__PURE__ */ T(Ct, {}),
934
+ ...Ge,
935
+ children: /* @__PURE__ */ T(Ie, {})
909
936
  })
910
937
  });
911
938
  }
912
- if (y === "sankey") {
913
- let e = a[0]?.dataKey || "value", t = a[0]?.label || e, n = x.filter((t) => (Number(t?.[e]) || 0) > 0), s = [{ name: t }, ...n.map((e) => ({ name: String(e?.[i] ?? "") }))], c = n.map((t, n) => ({
939
+ if (v === "sankey") {
940
+ let e = o[0]?.dataKey || "value", t = o[0]?.label || e, n = b.filter((t) => (Number(t?.[e]) || 0) > 0), i = [{ name: t }, ...n.map((e) => ({ name: String(e?.[a] ?? "") }))], c = n.map((t, n) => ({
914
941
  source: 0,
915
942
  target: n + 1,
916
943
  value: Number(t?.[e]) || 0
917
944
  }));
918
- return c.length === 0 ? /* @__PURE__ */ E("div", { className: o }) : /* @__PURE__ */ E(X, {
945
+ return c.length === 0 ? /* @__PURE__ */ T("div", { className: s }) : /* @__PURE__ */ T(J, {
919
946
  config: r,
920
- className: o,
921
- ...C,
922
- children: /* @__PURE__ */ E(Ne, {
947
+ className: s,
948
+ ...S,
949
+ children: /* @__PURE__ */ T(A, {
923
950
  data: {
924
- nodes: s,
951
+ nodes: i,
925
952
  links: c
926
953
  },
927
954
  nodePadding: 24,
@@ -930,25 +957,25 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
930
957
  strokeOpacity: .25
931
958
  },
932
959
  node: { fill: "hsl(var(--chart-1))" },
933
- ...Re,
934
- children: /* @__PURE__ */ E(M, {})
960
+ ...Ke,
961
+ children: /* @__PURE__ */ T(Ie, {})
935
962
  })
936
963
  });
937
964
  }
938
- if (y === "radar") return /* @__PURE__ */ E(X, {
965
+ if (v === "radar") return /* @__PURE__ */ T(J, {
939
966
  config: r,
940
- className: o,
941
- ...C,
942
- children: /* @__PURE__ */ D(ke, {
943
- data: x,
967
+ className: s,
968
+ ...S,
969
+ children: /* @__PURE__ */ E(Me, {
970
+ data: b,
944
971
  children: [
945
- /* @__PURE__ */ E(Ee, {}),
946
- /* @__PURE__ */ E(Te, { dataKey: i }),
947
- /* @__PURE__ */ E(De, {}),
948
- /* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }),
949
- /* @__PURE__ */ E(pt, {
950
- content: /* @__PURE__ */ E(st, {}),
951
- ...w && {
972
+ /* @__PURE__ */ T(ke, {}),
973
+ /* @__PURE__ */ T(Oe, { dataKey: a }),
974
+ /* @__PURE__ */ T(Ae, {}),
975
+ /* @__PURE__ */ T(Z, { content: /* @__PURE__ */ T(lt, {}) }),
976
+ /* @__PURE__ */ T(ht, {
977
+ content: /* @__PURE__ */ T(ut, {}),
978
+ ...C && {
952
979
  verticalAlign: "bottom",
953
980
  wrapperStyle: {
954
981
  fontSize: "11px",
@@ -956,50 +983,50 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
956
983
  }
957
984
  }
958
985
  }),
959
- a.map((e) => {
960
- let t = Q(r[e.dataKey]?.color || Et);
961
- return /* @__PURE__ */ E(Oe, {
986
+ o.map((e) => {
987
+ let t = Q(r[e.dataKey]?.color || At);
988
+ return /* @__PURE__ */ T(je, {
962
989
  dataKey: e.dataKey,
963
990
  stroke: t,
964
991
  fill: t,
965
992
  fillOpacity: .6,
966
- ...S
993
+ ...x
967
994
  }, e.dataKey);
968
995
  })
969
996
  ]
970
997
  })
971
998
  });
972
- if (y === "scatter") return /* @__PURE__ */ E(X, {
999
+ if (v === "scatter") return /* @__PURE__ */ T(J, {
973
1000
  config: r,
974
- className: o,
975
- ...C,
976
- children: /* @__PURE__ */ D(Fe, { children: [
977
- /* @__PURE__ */ E(ge, { vertical: !1 }),
978
- /* @__PURE__ */ E(P, {
1001
+ className: s,
1002
+ ...S,
1003
+ children: /* @__PURE__ */ E(M, { children: [
1004
+ /* @__PURE__ */ T(ye, { vertical: !1 }),
1005
+ /* @__PURE__ */ T(N, {
979
1006
  type: "number",
980
- dataKey: i,
981
- name: String(r[i]?.label || i),
1007
+ dataKey: a,
1008
+ name: String(r[a]?.label || a),
982
1009
  tickLine: !1,
983
1010
  axisLine: !1,
984
- minTickGap: w ? 32 : 48
1011
+ minTickGap: C ? 32 : 48
985
1012
  }),
986
- /* @__PURE__ */ E(F, {
1013
+ /* @__PURE__ */ T(P, {
987
1014
  type: "number",
988
- dataKey: a[0]?.dataKey || "value",
989
- name: String(r[a[0]?.dataKey]?.label || a[0]?.dataKey),
1015
+ dataKey: o[0]?.dataKey || "value",
1016
+ name: String(r[o[0]?.dataKey]?.label || o[0]?.dataKey),
990
1017
  tickLine: !1,
991
1018
  axisLine: !1,
992
- tickFormatter: He,
1019
+ tickFormatter: z,
993
1020
  width: 48
994
1021
  }),
995
- /* @__PURE__ */ E(Ie, {
1022
+ /* @__PURE__ */ T(Re, {
996
1023
  type: "number",
997
1024
  range: [60, 400]
998
1025
  }),
999
- /* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }),
1000
- /* @__PURE__ */ E(pt, {
1001
- content: /* @__PURE__ */ E(st, {}),
1002
- ...w && {
1026
+ /* @__PURE__ */ T(Z, { content: /* @__PURE__ */ T(lt, {}) }),
1027
+ /* @__PURE__ */ T(ht, {
1028
+ content: /* @__PURE__ */ T(ut, {}),
1029
+ ...C && {
1003
1030
  verticalAlign: "bottom",
1004
1031
  wrapperStyle: {
1005
1032
  fontSize: "11px",
@@ -1007,55 +1034,56 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1007
1034
  }
1008
1035
  }
1009
1036
  }),
1010
- a.map((e, t) => {
1011
- let n = I(), i = Q(r[e.dataKey]?.color || n[t % n.length]), a = Ot(e, "scatter");
1012
- return /* @__PURE__ */ E(Pe, {
1037
+ o.map((e, t) => {
1038
+ let n = R(), i = Q(r[e.dataKey]?.color || n[t % n.length]), a = Mt(e, "scatter");
1039
+ return /* @__PURE__ */ T(j, {
1013
1040
  name: r[e.dataKey]?.label || e.dataKey,
1014
- data: x,
1041
+ data: b,
1015
1042
  fill: i,
1016
1043
  fillOpacity: a?.fillOpacity,
1017
- ...S,
1018
- ...Me
1044
+ ...x,
1045
+ ...We
1019
1046
  }, e.dataKey);
1020
1047
  })
1021
1048
  ] })
1022
1049
  });
1023
- if (y === "combo") return /* @__PURE__ */ E(St, {
1024
- title: te,
1025
- subtitle: g,
1026
- children: /* @__PURE__ */ E(X, {
1050
+ if (v === "combo") return /* @__PURE__ */ T(wt, {
1051
+ title: ne,
1052
+ subtitle: re,
1053
+ children: /* @__PURE__ */ T(J, {
1027
1054
  config: r,
1028
- className: o,
1029
- ...C,
1030
- children: /* @__PURE__ */ D(ve, {
1031
- data: x,
1055
+ className: s,
1056
+ ...S,
1057
+ children: /* @__PURE__ */ E(O, {
1058
+ data: b,
1059
+ ...Fe,
1032
1060
  children: [
1033
- /* @__PURE__ */ E(ge, { ...We }),
1034
- /* @__PURE__ */ E(P, {
1035
- dataKey: i,
1036
- ...$e
1061
+ /* @__PURE__ */ T(ye, { ...it }),
1062
+ /* @__PURE__ */ T(N, {
1063
+ dataKey: a,
1064
+ ...dt
1037
1065
  }),
1038
- /* @__PURE__ */ E(F, {
1066
+ /* @__PURE__ */ T(P, {
1039
1067
  yAxisId: "left",
1040
1068
  tickLine: !1,
1041
1069
  axisLine: !1,
1042
- tickFormatter: V,
1070
+ tickFormatter: U,
1043
1071
  width: 48,
1044
- ...W(L)
1072
+ ...K(B)
1045
1073
  }),
1046
- /* @__PURE__ */ E(F, {
1074
+ /* @__PURE__ */ T(P, {
1047
1075
  yAxisId: "right",
1048
1076
  orientation: "right",
1049
1077
  tickLine: !1,
1050
1078
  axisLine: !1,
1051
- tickFormatter: H,
1079
+ tickFormatter: W,
1052
1080
  width: 48,
1053
- ...W(R, "right")
1081
+ ...K(V, "right")
1054
1082
  }),
1055
- q ? /* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }) : null,
1056
- Qe ? /* @__PURE__ */ E(pt, {
1057
- content: /* @__PURE__ */ E(st, {}),
1058
- ...w && {
1083
+ st ? /* @__PURE__ */ T(Z, { content: /* @__PURE__ */ T(lt, {}) }) : null,
1084
+ at ? /* @__PURE__ */ T(ht, {
1085
+ content: /* @__PURE__ */ T(ut, {}),
1086
+ ...C && {
1059
1087
  verticalAlign: "bottom",
1060
1088
  wrapperStyle: {
1061
1089
  fontSize: "11px",
@@ -1063,11 +1091,11 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1063
1091
  }
1064
1092
  }
1065
1093
  }) : null,
1066
- K,
1067
- J,
1068
- a.map((e, t) => {
1069
- let n = Q(r[e.dataKey]?.color || Et), i = e.chartType || b || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : b || i === "bar" ? "left" : "right", o = Ot(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = G((a === "right" ? R : L)?.format);
1070
- return i === "line" ? /* @__PURE__ */ E(xe, {
1094
+ ot,
1095
+ ct,
1096
+ o.map((e, t) => {
1097
+ let n = Q(r[e.dataKey]?.color || At), i = e.chartType || y || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : y || i === "bar" ? "left" : "right", o = Mt(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = Xe((a === "right" ? V : B)?.format);
1098
+ return i === "line" ? /* @__PURE__ */ T(we, {
1071
1099
  yAxisId: a,
1072
1100
  type: "monotone",
1073
1101
  dataKey: e.dataKey,
@@ -1076,9 +1104,10 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1076
1104
  dot: !1,
1077
1105
  strokeOpacity: o?.strokeOpacity,
1078
1106
  strokeDasharray: o?.strokeDasharray,
1079
- ...S,
1080
- children: Y(c)
1081
- }, e.dataKey) : i === "area" ? /* @__PURE__ */ E(O, {
1107
+ ...x,
1108
+ ...F(e),
1109
+ children: q(c)
1110
+ }, e.dataKey) : i === "area" ? /* @__PURE__ */ T(he, {
1082
1111
  yAxisId: a,
1083
1112
  type: "monotone",
1084
1113
  dataKey: e.dataKey,
@@ -1088,112 +1117,114 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1088
1117
  strokeOpacity: o?.strokeOpacity,
1089
1118
  strokeDasharray: o?.strokeDasharray,
1090
1119
  ...s,
1091
- ...S,
1092
- children: Y(c)
1093
- }, e.dataKey) : /* @__PURE__ */ E(me, {
1120
+ ...x,
1121
+ ...F(e),
1122
+ children: q(c)
1123
+ }, e.dataKey) : /* @__PURE__ */ T(_e, {
1094
1124
  yAxisId: a,
1095
1125
  dataKey: e.dataKey,
1096
1126
  fill: n,
1097
1127
  radius: 4,
1098
1128
  fillOpacity: o?.fillOpacity,
1099
1129
  ...s,
1100
- ...S,
1101
- children: Y(c)
1130
+ ...x,
1131
+ ...F(e),
1132
+ children: q(c)
1102
1133
  }, e.dataKey);
1103
1134
  })
1104
1135
  ]
1105
1136
  })
1106
1137
  })
1107
1138
  });
1108
- let et = y === "horizontal-bar", tt = I(), nt = c ? Object.values(c).map((e) => Q(String(e))) : [], rt = Array.from(/* @__PURE__ */ new Set([
1109
- ...tt,
1110
- ...nt,
1111
- ...a.map((e, t) => Q(r[e.dataKey]?.color || tt[t % tt.length] || Et))
1112
- ])), it = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
1113
- return /* @__PURE__ */ E(St, {
1114
- title: te,
1115
- subtitle: g,
1116
- children: /* @__PURE__ */ E(X, {
1139
+ let Y = v === "horizontal-bar", ft = R(), pt = l ? Object.values(l).map((e) => Q(String(e))) : [], mt = Array.from(/* @__PURE__ */ new Set([
1140
+ ...ft,
1141
+ ...pt,
1142
+ ...o.map((e, t) => Q(r[e.dataKey]?.color || ft[t % ft.length] || At))
1143
+ ])), X = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
1144
+ return /* @__PURE__ */ T(wt, {
1145
+ title: ne,
1146
+ subtitle: re,
1147
+ children: /* @__PURE__ */ T(J, {
1117
1148
  config: r,
1118
- className: o,
1119
- ...C,
1120
- children: /* @__PURE__ */ D(ze, {
1121
- data: x,
1122
- layout: et ? "vertical" : "horizontal",
1123
- ...ce,
1149
+ className: s,
1150
+ ...S,
1151
+ children: /* @__PURE__ */ E(qe, {
1152
+ data: b,
1153
+ layout: Y ? "vertical" : "horizontal",
1154
+ ...k,
1124
1155
  children: [
1125
- /* @__PURE__ */ E("defs", { children: rt.map((e) => /* @__PURE__ */ D(h.Fragment, { children: [/* @__PURE__ */ D("linearGradient", {
1126
- id: `bg-${it(e)}`,
1156
+ /* @__PURE__ */ T("defs", { children: mt.map((e) => /* @__PURE__ */ E(h.Fragment, { children: [/* @__PURE__ */ E("linearGradient", {
1157
+ id: `bg-${X(e)}`,
1127
1158
  x1: "0",
1128
1159
  y1: "0",
1129
1160
  x2: "0",
1130
1161
  y2: "1",
1131
- children: [/* @__PURE__ */ E("stop", {
1162
+ children: [/* @__PURE__ */ T("stop", {
1132
1163
  offset: "0%",
1133
1164
  style: { stopColor: e },
1134
1165
  stopOpacity: .95
1135
- }), /* @__PURE__ */ E("stop", {
1166
+ }), /* @__PURE__ */ T("stop", {
1136
1167
  offset: "100%",
1137
1168
  style: { stopColor: e },
1138
1169
  stopOpacity: .5
1139
1170
  })]
1140
- }), /* @__PURE__ */ D("linearGradient", {
1141
- id: `ag-${it(e)}`,
1171
+ }), /* @__PURE__ */ E("linearGradient", {
1172
+ id: `ag-${X(e)}`,
1142
1173
  x1: "0",
1143
1174
  y1: "0",
1144
1175
  x2: "0",
1145
1176
  y2: "1",
1146
- children: [/* @__PURE__ */ E("stop", {
1177
+ children: [/* @__PURE__ */ T("stop", {
1147
1178
  offset: "0%",
1148
1179
  style: { stopColor: e },
1149
1180
  stopOpacity: .5
1150
- }), /* @__PURE__ */ E("stop", {
1181
+ }), /* @__PURE__ */ T("stop", {
1151
1182
  offset: "95%",
1152
1183
  style: { stopColor: e },
1153
1184
  stopOpacity: .05
1154
1185
  })]
1155
- })] }, it(e))) }),
1156
- /* @__PURE__ */ E(ge, { ...We }),
1157
- et ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(P, {
1186
+ })] }, X(e))) }),
1187
+ /* @__PURE__ */ T(ye, { ...it }),
1188
+ Y ? /* @__PURE__ */ E(me, { children: [/* @__PURE__ */ T(N, {
1158
1189
  type: "number",
1159
1190
  tickLine: !1,
1160
1191
  axisLine: !1,
1161
- tickFormatter: V,
1162
- ...W(L)
1163
- }), /* @__PURE__ */ E(F, {
1192
+ tickFormatter: U,
1193
+ ...K(B)
1194
+ }), /* @__PURE__ */ T(P, {
1164
1195
  type: "category",
1165
- dataKey: i,
1196
+ dataKey: a,
1166
1197
  tickLine: !1,
1167
1198
  axisLine: !1,
1168
- width: Math.min(140, Math.max(60, Math.max(...x.map((e) => String(e[i] ?? "").length)) * 7)),
1169
- tickFormatter: B
1170
- })] }) : /* @__PURE__ */ D(T, { children: [
1171
- /* @__PURE__ */ E(P, {
1172
- dataKey: i,
1173
- ...$e
1199
+ width: Math.min(140, Math.max(60, Math.max(...b.map((e) => String(e[a] ?? "").length)) * 7)),
1200
+ tickFormatter: nt
1201
+ })] }) : /* @__PURE__ */ E(me, { children: [
1202
+ /* @__PURE__ */ T(N, {
1203
+ dataKey: a,
1204
+ ...dt
1174
1205
  }),
1175
- /* @__PURE__ */ E(F, {
1176
- ...z ? { yAxisId: "left" } : {},
1206
+ /* @__PURE__ */ T(P, {
1207
+ ...H ? { yAxisId: "left" } : {},
1177
1208
  tickLine: !1,
1178
1209
  axisLine: !1,
1179
- tickFormatter: V,
1210
+ tickFormatter: U,
1180
1211
  width: 48,
1181
- ...W(L)
1212
+ ...K(B)
1182
1213
  }),
1183
- z ? /* @__PURE__ */ E(F, {
1214
+ H ? /* @__PURE__ */ T(P, {
1184
1215
  yAxisId: "right",
1185
1216
  orientation: "right",
1186
1217
  tickLine: !1,
1187
1218
  axisLine: !1,
1188
- tickFormatter: H,
1219
+ tickFormatter: W,
1189
1220
  width: 48,
1190
- ...W(R, "right")
1221
+ ...K(V, "right")
1191
1222
  }) : null
1192
1223
  ] }),
1193
- q ? /* @__PURE__ */ E(ft, { content: /* @__PURE__ */ E(ot, {}) }) : null,
1194
- Qe ? /* @__PURE__ */ E(pt, {
1195
- content: /* @__PURE__ */ E(st, {}),
1196
- ...w && {
1224
+ st ? /* @__PURE__ */ T(Z, { content: /* @__PURE__ */ T(lt, {}) }) : null,
1225
+ at ? /* @__PURE__ */ T(ht, {
1226
+ content: /* @__PURE__ */ T(ut, {}),
1227
+ ...C && {
1197
1228
  verticalAlign: "bottom",
1198
1229
  wrapperStyle: {
1199
1230
  fontSize: "11px",
@@ -1201,26 +1232,27 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1201
1232
  }
1202
1233
  }
1203
1234
  }) : null,
1204
- K,
1205
- J,
1206
- a.map((e, t) => {
1207
- 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] || Et), u = z ? { yAxisId: e.yAxis === "right" ? "right" : "left" } : {}, d = e.stack ? { stackId: String(e.stack) } : {}, f = G((e.yAxis === "right" ? R : L)?.format);
1208
- if (y === "bar" || y === "horizontal-bar") {
1209
- let t = a.filter((e) => e.variant !== "comparison").length === 1 && !o && a.length === 1 && x.length > 1, r = Ot(e, "bar");
1210
- return /* @__PURE__ */ D(me, {
1235
+ ot,
1236
+ ct,
1237
+ o.map((e, t) => {
1238
+ let n = R(), i = e.variant === "comparison", s = i ? o.slice(0, t).find((e) => e.variant !== "comparison") || o[0] : e, c = i ? o.indexOf(s) : t, l = Q(r[s.dataKey]?.color || n[c % n.length] || At), u = H ? { yAxisId: e.yAxis === "right" ? "right" : "left" } : {}, d = e.stack ? { stackId: String(e.stack) } : {}, f = Xe((e.yAxis === "right" ? V : B)?.format);
1239
+ if (v === "bar" || v === "horizontal-bar") {
1240
+ let t = o.filter((e) => e.variant !== "comparison").length === 1 && !i && o.length === 1 && b.length > 1, r = Mt(e, "bar");
1241
+ return /* @__PURE__ */ E(_e, {
1211
1242
  dataKey: e.dataKey,
1212
- fill: `url(#bg-${it(l)})`,
1243
+ fill: `url(#bg-${X(l)})`,
1213
1244
  radius: 4,
1214
1245
  fillOpacity: r?.fillOpacity,
1215
1246
  ...d,
1216
1247
  ...u,
1217
- ...S,
1218
- children: [t && x.map((e, t) => /* @__PURE__ */ E(_e, { fill: `url(#bg-${it(Q(ue(e?.[i], t, n)))})` }, `cell-${t}`)), Y(f)]
1248
+ ...x,
1249
+ ...ue(e),
1250
+ children: [t && b.map((e, t) => /* @__PURE__ */ T(be, { fill: `url(#bg-${X(Q(Be(e?.[a], t, n)))})` }, `cell-${t}`)), q(f)]
1219
1251
  }, e.dataKey);
1220
1252
  }
1221
- if (y === "line") {
1222
- let t = Ot(e, "line");
1223
- return /* @__PURE__ */ E(xe, {
1253
+ if (v === "line") {
1254
+ let t = Mt(e, "line");
1255
+ return /* @__PURE__ */ T(we, {
1224
1256
  type: "monotone",
1225
1257
  dataKey: e.dataKey,
1226
1258
  stroke: l,
@@ -1229,16 +1261,17 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1229
1261
  strokeOpacity: t?.strokeOpacity,
1230
1262
  strokeDasharray: t?.strokeDasharray,
1231
1263
  ...u,
1232
- ...S,
1233
- children: Y(f)
1264
+ ...x,
1265
+ ...ue(e),
1266
+ children: q(f)
1234
1267
  }, e.dataKey);
1235
1268
  }
1236
- if (y === "area") {
1237
- let t = Ot(e, "area");
1238
- return /* @__PURE__ */ E(O, {
1269
+ if (v === "area") {
1270
+ let t = Mt(e, "area");
1271
+ return /* @__PURE__ */ T(he, {
1239
1272
  type: "monotone",
1240
1273
  dataKey: e.dataKey,
1241
- fill: `url(#ag-${it(l)})`,
1274
+ fill: `url(#ag-${X(l)})`,
1242
1275
  stroke: l,
1243
1276
  strokeWidth: 2,
1244
1277
  fillOpacity: t?.fillOpacity ?? 1,
@@ -1246,8 +1279,9 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1246
1279
  strokeDasharray: t?.strokeDasharray,
1247
1280
  ...d,
1248
1281
  ...u,
1249
- ...S,
1250
- children: Y(f)
1282
+ ...x,
1283
+ ...ue(e),
1284
+ children: q(f)
1251
1285
  }, e.dataKey);
1252
1286
  }
1253
1287
  return null;
@@ -1257,35 +1291,64 @@ function Ct({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: i =
1257
1291
  })
1258
1292
  });
1259
1293
  }
1260
- function wt(e) {
1294
+ function Et(e) {
1261
1295
  let t = e.chartType === "column" ? "bar" : e.chartType ?? "bar", n = Array.isArray(e.data) ? e.data : [], r = e.xAxisKey ?? "name";
1262
- return kt.has(t) && n.length > 0 && !n.some((e) => typeof e == "object" && !!e && r in e);
1296
+ return Lt.has(t) && n.length > 0 && !n.some((e) => typeof e == "object" && !!e && r in e);
1297
+ }
1298
+ function Dt(e) {
1299
+ let t = e.chartType === "column" ? "bar" : e.chartType ?? "bar", n = Array.isArray(e.data) ? e.data : [];
1300
+ return Rt.has(t) && n.length > 0 && Array.isArray(e.series) && e.series.length === 0;
1301
+ }
1302
+ function Ot({ code: e, className: t, children: n }) {
1303
+ return /* @__PURE__ */ T("div", {
1304
+ className: `flex h-full min-h-[120px] w-full items-center justify-center p-4 text-center text-sm text-muted-foreground ${t ?? ""}`,
1305
+ role: "status",
1306
+ "data-chart-error": e,
1307
+ children: /* @__PURE__ */ T("span", { children: n })
1308
+ });
1263
1309
  }
1264
- function Tt(e) {
1265
- let t = wt(e), n = e.xAxisKey ?? "name", r = h.useMemo(() => Object.keys((Array.isArray(e.data) ? e.data[0] : void 0) ?? {}), [e.data]);
1310
+ function kt(e) {
1311
+ let t = Et(e), n = !t && Dt(e), r = e.xAxisKey ?? "name", i = h.useMemo(() => Object.keys((Array.isArray(e.data) ? e.data[0] : void 0) ?? {}), [e.data]);
1266
1312
  return h.useEffect(() => {
1267
- t && console.warn(`[chart] no row has the category key "${n}" — rendering an explanatory placeholder instead of an empty axis. Row keys: ${JSON.stringify(r)}. A dataset query must PROJECT the dimension it groups by (framework#4033).`);
1313
+ t && console.warn(`[chart] no row has the category key "${r}" — rendering an explanatory placeholder instead of an empty axis. Row keys: ${JSON.stringify(i)}. A dataset query must PROJECT the dimension it groups by (framework#4033).`);
1268
1314
  }, [
1269
1315
  t,
1316
+ r,
1317
+ i
1318
+ ]), h.useEffect(() => {
1319
+ n && console.warn(`[chart] no series to plot against the category axis "${r}" — rendering an explanatory placeholder instead of an empty frame. Row keys: ${JSON.stringify(i)}. A grouped chart's SECOND dimension must be PROJECTED by the dataset query, and a chart with no measure selected has nothing to draw either (objectui#4683, framework#4033).`);
1320
+ }, [
1270
1321
  n,
1271
- r
1272
- ]), t ? /* @__PURE__ */ E("div", {
1273
- className: `flex h-full min-h-[120px] w-full items-center justify-center p-4 text-center text-sm text-muted-foreground ${e.className ?? ""}`,
1274
- role: "status",
1275
- "data-chart-error": "missing-category-key",
1276
- children: /* @__PURE__ */ D("span", { children: [
1322
+ r,
1323
+ i
1324
+ ]), t ? /* @__PURE__ */ E(Ot, {
1325
+ code: "missing-category-key",
1326
+ className: e.className,
1327
+ children: [
1277
1328
  "This chart cannot plot its category axis: no row has a",
1278
1329
  " ",
1279
- /* @__PURE__ */ E("code", {
1330
+ /* @__PURE__ */ T("code", {
1280
1331
  className: "font-mono",
1281
- children: n
1332
+ children: r
1282
1333
  }),
1283
1334
  " field."
1284
- ] })
1285
- }) : /* @__PURE__ */ E(Ct, { ...e });
1335
+ ]
1336
+ }) : n ? /* @__PURE__ */ E(Ot, {
1337
+ code: "no-plottable-series",
1338
+ className: e.className,
1339
+ children: [
1340
+ "This chart cannot plot any series: no measure or group reached its",
1341
+ " ",
1342
+ /* @__PURE__ */ T("code", {
1343
+ className: "font-mono",
1344
+ children: r
1345
+ }),
1346
+ " axis."
1347
+ ]
1348
+ }) : /* @__PURE__ */ T(Tt, { ...e });
1286
1349
  }
1287
- var Et, Dt, Q, Ot, kt, At = V((() => {
1288
- mt(), yt(), $e(), Et = "hsl(var(--primary))", Dt = {
1350
+ var At, jt, Q, Mt, Nt, Pt, Ft, It, Lt, Rt, zt = L((() => {
1351
+ gt(), xt(), rt(), At = "hsl(var(--primary))", jt = {
1289
1352
  slate: "#64748b",
1290
1353
  gray: "#6b7280",
1291
1354
  zinc: "#71717a",
@@ -1308,11 +1371,31 @@ var Et, Dt, Q, Ot, kt, At = V((() => {
1308
1371
  fuchsia: "#d946ef",
1309
1372
  pink: "#ec4899",
1310
1373
  rose: "#f43f5e"
1311
- }, Q = (e) => Dt[e] || e, Ot = (e, t) => e?.variant === "comparison" ? {
1374
+ }, Q = (e) => jt[e] || e, Mt = (e, t) => e?.variant === "comparison" ? {
1312
1375
  strokeOpacity: typeof e.opacity == "number" ? e.opacity : t === "line" || t === "scatter" ? .5 : .6,
1313
1376
  fillOpacity: typeof e.opacity == "number" ? e.opacity : t === "bar" ? .4 : t === "area" ? .2 : .5,
1314
1377
  strokeDasharray: e.dashArray ?? (t === "line" || t === "area" ? "4 4" : void 0)
1315
- } : null, kt = /* @__PURE__ */ new Set([
1378
+ } : null, Nt = (e, t) => {
1379
+ if (typeof e == "string" || typeof e == "number") {
1380
+ let t = String(e);
1381
+ if (t !== "") return t;
1382
+ }
1383
+ if (t.length === 1) {
1384
+ let e = t[0]?.dataKey;
1385
+ if (e != null && String(e) !== "") return String(e);
1386
+ }
1387
+ }, Pt = (e) => {
1388
+ if (e && typeof e == "object" && "nativeEvent" in e) return e.nativeEvent;
1389
+ }, Ft = (e) => {
1390
+ for (let t = e.length - 1; t >= 0; --t) {
1391
+ let n = Pt(e[t]);
1392
+ if (n !== void 0) return n;
1393
+ }
1394
+ }, It = (e, t) => {
1395
+ if (e == null) return;
1396
+ let n = t.find((t) => String(t.dataKey) === e);
1397
+ return typeof n?.label == "string" ? n.label : void 0;
1398
+ }, Lt = /* @__PURE__ */ new Set([
1316
1399
  "bar",
1317
1400
  "horizontal-bar",
1318
1401
  "line",
@@ -1322,14 +1405,20 @@ var Et, Dt, Q, Ot, kt, At = V((() => {
1322
1405
  "radar",
1323
1406
  "funnel",
1324
1407
  "combo"
1408
+ ]), Rt = /* @__PURE__ */ new Set([
1409
+ "bar",
1410
+ "horizontal-bar",
1411
+ "line",
1412
+ "area",
1413
+ "combo"
1325
1414
  ]);
1326
1415
  }));
1327
1416
  //#endregion
1328
1417
  //#region src/ChartRenderer.tsx
1329
- $e();
1330
- var jt = g.lazy(() => Promise.resolve().then(() => (it(), et))), Mt = g.lazy(() => Promise.resolve().then(() => (At(), bt))), Nt = ({ schema: e }) => /* @__PURE__ */ E(_, {
1331
- fallback: /* @__PURE__ */ E(fe, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1332
- children: /* @__PURE__ */ E(jt, {
1418
+ rt();
1419
+ var Bt = g.lazy(() => Promise.resolve().then(() => (ct(), it))), Vt = g.lazy(() => Promise.resolve().then(() => (zt(), St))), Ht = ({ schema: e }) => /* @__PURE__ */ T(_, {
1420
+ fallback: /* @__PURE__ */ T(w, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1421
+ children: /* @__PURE__ */ T(Bt, {
1333
1422
  data: e.data,
1334
1423
  dataKey: e.dataKey,
1335
1424
  xAxisKey: e.xAxisKey,
@@ -1339,7 +1428,7 @@ var jt = g.lazy(() => Promise.resolve().then(() => (it(), et))), Mt = g.lazy(()
1339
1428
  })
1340
1429
  }), $ = ({ schema: e, onChartClick: t }) => {
1341
1430
  let n = g.useMemo(() => {
1342
- let t = We(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;
1431
+ let t = H(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;
1343
1432
  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) {
1344
1433
  let t = e.colors || [
1345
1434
  "hsl(var(--chart-1))",
@@ -1363,9 +1452,9 @@ var jt = g.lazy(() => Promise.resolve().then(() => (it(), et))), Mt = g.lazy(()
1363
1452
  spec: t
1364
1453
  };
1365
1454
  }, [e]);
1366
- return /* @__PURE__ */ E(_, {
1367
- fallback: /* @__PURE__ */ E(fe, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1368
- children: /* @__PURE__ */ E(Mt, {
1455
+ return /* @__PURE__ */ T(_, {
1456
+ fallback: /* @__PURE__ */ T(w, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1457
+ children: /* @__PURE__ */ T(Vt, {
1369
1458
  chartType: n.chartType,
1370
1459
  data: n.data,
1371
1460
  config: n.config,
@@ -1392,15 +1481,12 @@ var jt = g.lazy(() => Promise.resolve().then(() => (it(), et))), Mt = g.lazy(()
1392
1481
  };
1393
1482
  //#endregion
1394
1483
  //#region src/ObjectChart.tsx
1395
- function Pt(e) {
1396
- return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
1397
- }
1398
- function Ft(e) {
1484
+ function Ut(e) {
1399
1485
  return e.field || e.function || "count";
1400
1486
  }
1401
- var It = "__comparison";
1402
- function Lt(e, t) {
1403
- let { field: n, function: r, groupBy: i } = t, a = Ft(t), o = {};
1487
+ var Wt = "__comparison";
1488
+ function Gt(e, t) {
1489
+ let { field: n, function: r, groupBy: i } = t, a = Ut(t), o = {};
1404
1490
  for (let t of e) {
1405
1491
  let e = String(t[i] ?? "Unknown");
1406
1492
  o[e] || (o[e] = []), o[e].push(t);
@@ -1428,13 +1514,13 @@ function Lt(e, t) {
1428
1514
  };
1429
1515
  });
1430
1516
  }
1431
- async function Rt(e, t, n, r, i) {
1517
+ async function Kt(e, t, n, r, i) {
1432
1518
  if (!e.length || !t) return e;
1433
1519
  let a = i || ((e, t) => t), o = `__raw_${t}`, s = n?.fields?.[t];
1434
1520
  if (!s) {
1435
1521
  let n = /^\d{4}-\d{2}-\d{2}/;
1436
1522
  return e.map((e) => {
1437
- let r = e[t], i = String(r ?? ""), s = n.test(i) ? i : Pt(i);
1523
+ let r = e[t], i = String(r ?? ""), s = n.test(i) ? i : u(i);
1438
1524
  return {
1439
1525
  ...e,
1440
1526
  [t]: a(i, s),
@@ -1442,11 +1528,11 @@ async function Rt(e, t, n, r, i) {
1442
1528
  };
1443
1529
  });
1444
1530
  }
1445
- let l = s.type;
1446
- if (l === "select" || l === "picklist" || l === "dropdown") {
1531
+ let c = s.type;
1532
+ if (c === "select" || c === "picklist" || c === "dropdown") {
1447
1533
  let n = s.options || [];
1448
1534
  if (n.length === 0) return e.map((e) => {
1449
- let n = e[t], r = String(n ?? ""), i = Pt(r);
1535
+ let n = e[t], r = String(n ?? ""), i = u(r);
1450
1536
  return {
1451
1537
  ...e,
1452
1538
  [t]: a(r, i),
@@ -1456,7 +1542,7 @@ async function Rt(e, t, n, r, i) {
1456
1542
  let r = {};
1457
1543
  for (let e of n) typeof e == "string" ? r[e] = e : e && typeof e == "object" && (r[String(e.value)] = e.label || String(e.value));
1458
1544
  return e.map((e) => {
1459
- let n = e[t], i = String(n ?? ""), s = r[i] || Pt(i);
1545
+ let n = e[t], i = String(n ?? ""), s = r[i] || u(i);
1460
1546
  return {
1461
1547
  ...e,
1462
1548
  [t]: a(i, s),
@@ -1464,7 +1550,7 @@ async function Rt(e, t, n, r, i) {
1464
1550
  };
1465
1551
  });
1466
1552
  }
1467
- if (l === "lookup" || l === "master_detail") {
1553
+ if (c === "lookup" || c === "master_detail") {
1468
1554
  let n = s.reference_to || s.reference;
1469
1555
  if (!n || !r || typeof r.find != "function") return e.map((e) => ({
1470
1556
  ...e,
@@ -1477,10 +1563,10 @@ async function Rt(e, t, n, r, i) {
1477
1563
  }));
1478
1564
  let a = s.id_field || "id";
1479
1565
  try {
1480
- let l = await r.find(n, {
1566
+ let c = await r.find(n, {
1481
1567
  $filter: { [a]: { $in: i } },
1482
1568
  $top: i.length
1483
- }), u = c(l), d = s.reference_field || s.display_field || "name", f = {};
1569
+ }), u = l(c), d = s.reference_field || s.display_field || "name", f = {};
1484
1570
  for (let e of u) {
1485
1571
  let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[d] || e.name || e.label || e.title || t;
1486
1572
  t && (f[t] = String(n));
@@ -1500,26 +1586,22 @@ async function Rt(e, t, n, r, i) {
1500
1586
  }));
1501
1587
  }
1502
1588
  }
1503
- if (l === "date" || l === "datetime" || l === "date_time" || l === "timestamp" || l === "time") return e.map((e) => ({
1589
+ if (c === "date" || c === "datetime" || c === "date_time" || c === "timestamp" || c === "time") return e.map((e) => ({
1504
1590
  ...e,
1505
1591
  [o]: e[t]
1506
1592
  }));
1507
- let u = /^\d{4}-\d{2}-\d{2}/;
1593
+ let d = /^\d{4}-\d{2}-\d{2}/;
1508
1594
  return e.map((e) => {
1509
1595
  let n = e[t], r = String(n ?? "");
1510
1596
  return {
1511
1597
  ...e,
1512
- [t]: u.test(r) ? r : Pt(r),
1598
+ [t]: d.test(r) ? r : u(r),
1513
1599
  [o]: n
1514
1600
  };
1515
1601
  });
1516
1602
  }
1517
- var zt = (e) => {
1518
- let { schema: t } = e, h = e.onSegmentClick, g = re(ze), _ = e.dataSource || g?.dataSource, fe = g?.apiFetch, T = Be(t.bind), { fieldOptionLabel: O } = R(), pe = y(O);
1519
- ie(() => {
1520
- pe.current = O;
1521
- }, [O]);
1522
- let [me, k] = b([]), [he, ge] = b(null), [_e, ve] = b(() => !(Array.isArray(t.data) && t.data.length > 0) && (!!t.objectName || !!t.dataset)), [ye, be] = b(null), [A, j] = b(null), [xe, Se] = b(null), { openRecordList: Ce } = Ve(), we = z(), Te = v(() => t.aggregate ? JSON.stringify(t.aggregate) : "", [t.aggregate]), Ee = v(() => t.filter ? JSON.stringify(t.filter) : "", [t.filter]), De = v(() => t.compareTo ? JSON.stringify(t.compareTo) : "", [t.compareTo]), Oe = v(() => t.dataset ? JSON.stringify({
1603
+ var qt = (e) => {
1604
+ let { schema: t } = e, i = e.onSegmentClick, u = ae(Be), h = e.dataSource || u?.dataSource, g = u?.apiFetch, _ = Ve(t.bind), { fieldOptionLabel: w } = Ke(), [me, he] = y([]), [ge, _e] = y(null), [D, ve] = y(() => !(Array.isArray(t.data) && t.data.length > 0) && (!!t.objectName || !!t.dataset)), [ye, be] = y(null), [O, xe] = y(null), [Se, Ce] = y(null), { openRecordList: k } = He(), we = qe(), Te = v(() => t.aggregate ? JSON.stringify(t.aggregate) : "", [t.aggregate]), Ee = v(() => t.filter ? JSON.stringify(t.filter) : "", [t.filter]), De = v(() => t.compareTo ? JSON.stringify(t.compareTo) : "", [t.compareTo]), Oe = v(() => t.dataset ? JSON.stringify({
1523
1605
  d: t.dataset,
1524
1606
  dim: t.dimensions ?? [],
1525
1607
  val: t.values ?? []
@@ -1528,11 +1610,11 @@ var zt = (e) => {
1528
1610
  t.dimensions,
1529
1611
  t.values
1530
1612
  ]), ke = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
1531
- ie(() => {
1613
+ oe(() => {
1532
1614
  let e = !1;
1533
1615
  return (async () => {
1534
1616
  try {
1535
- let n = fe ?? fetch, r = {
1617
+ let n = g ?? fetch, r = {
1536
1618
  headers: { accept: "application/json" },
1537
1619
  credentials: "include"
1538
1620
  }, i = t.objectName, a, o = null, s = t.aggregate?.groupBy;
@@ -1542,7 +1624,7 @@ var zt = (e) => {
1542
1624
  o = s?.item ?? s?.data ?? s, i = o?.object, a = ((o?.dimensions || []).find((t) => t?.name === e) ?? (o?.dimensions || [])[0])?.field ?? e;
1543
1625
  }
1544
1626
  if (!i || !a) {
1545
- e || Se(null);
1627
+ e || Ce(null);
1546
1628
  return;
1547
1629
  }
1548
1630
  let c = async (e) => {
@@ -1550,14 +1632,14 @@ var zt = (e) => {
1550
1632
  return t?.item ?? t?.data ?? t;
1551
1633
  }, l = {};
1552
1634
  if (t.dataset && Array.isArray(t.dimensions)) for (let e of t.dimensions) l[e] = (o?.dimensions || []).find((t) => t?.name === e)?.field ?? e;
1553
- let d = await u(c, i, [a, ...Object.values(l)]);
1554
- e || Se({
1555
- metaByPath: d,
1635
+ let u = await f(c, i, [a, ...Object.values(l)]);
1636
+ e || Ce({
1637
+ metaByPath: u,
1556
1638
  colorPath: a,
1557
1639
  fieldByDim: t.dataset && Array.isArray(t.dimensions) ? l : null
1558
1640
  });
1559
1641
  } catch {
1560
- e || Se(null);
1642
+ e || Ce(null);
1561
1643
  }
1562
1644
  })(), () => {
1563
1645
  e = !0;
@@ -1568,28 +1650,28 @@ var zt = (e) => {
1568
1650
  Oe,
1569
1651
  Te,
1570
1652
  t.xAxisKey,
1571
- fe
1653
+ g
1572
1654
  ]);
1573
1655
  let { fieldOptionColors: Ae, dimensionLabels: je } = v(() => {
1574
- if (!xe) return {
1656
+ if (!Se) return {
1575
1657
  fieldOptionColors: null,
1576
1658
  dimensionLabels: null
1577
1659
  };
1578
- let { metaByPath: e, colorPath: t, fieldByDim: n } = xe, i = d(e[t]?.options, s(e[t], O)), a = o(e, n ? Object.entries(n).map(([e, t]) => ({
1660
+ let { metaByPath: e, colorPath: t, fieldByDim: n } = Se, i = p(e[t]?.options, c(e[t], w)), a = s(e, n ? Object.entries(n).map(([e, t]) => ({
1579
1661
  dim: e,
1580
1662
  path: t
1581
- })) : null, O);
1663
+ })) : null, w);
1582
1664
  return {
1583
1665
  fieldOptionColors: r(i),
1584
1666
  dimensionLabels: a
1585
1667
  };
1586
- }, [xe, O]), Me = ne(async (e, n) => {
1668
+ }, [Se, w]), Me = ie(async (e, n) => {
1587
1669
  if (t.aggregate && typeof e.aggregate == "function") {
1588
1670
  let r = t.aggregate.groupBy;
1589
1671
  if (r && typeof r == "object" && !Array.isArray(r)) {
1590
1672
  let i = t.aggregate.field, a = t.aggregate.function, o = {
1591
1673
  function: a,
1592
- alias: Ft(t.aggregate)
1674
+ alias: Ut(t.aggregate)
1593
1675
  };
1594
1676
  a !== "count" && i && (o.field = i);
1595
1677
  let s = await e.aggregate(t.objectName, {
@@ -1608,11 +1690,11 @@ var zt = (e) => {
1608
1690
  return Array.isArray(i) ? i : [];
1609
1691
  }
1610
1692
  if (typeof e.find == "function") {
1611
- let r = await e.find(t.objectName, { $filter: n }), i = c(r);
1612
- return t.aggregate && i.length > 0 && (i = Lt(i, t.aggregate)), i;
1693
+ let r = await e.find(t.objectName, { $filter: n }), i = l(r);
1694
+ return t.aggregate && i.length > 0 && (i = Gt(i, t.aggregate)), i;
1613
1695
  }
1614
1696
  return [];
1615
- }, [t.objectName, Te]), Ne = I(), Pe = ne(async (e, n) => {
1697
+ }, [t.objectName, Te]), Ne = Ue(), Pe = ie(async (e, n) => {
1616
1698
  if (!e || !t.objectName && !t.dataset) {
1617
1699
  n.current && ve(!1);
1618
1700
  return;
@@ -1620,17 +1702,17 @@ var zt = (e) => {
1620
1702
  n.current && (ve(!0), be(null));
1621
1703
  try {
1622
1704
  if (t.dataset && typeof e.queryDataset == "function") {
1623
- let r = m(t.filter, Ne), i = await e.queryDataset(t.dataset, {
1705
+ let r = ne(t.filter, Ne), i = await e.queryDataset(t.dataset, {
1624
1706
  dimensions: Array.isArray(t.dimensions) ? t.dimensions : [],
1625
1707
  measures: Array.isArray(t.values) ? t.values : [],
1626
1708
  ...r ? { runtimeFilter: r } : {}
1627
1709
  });
1628
- n.current && (k(Array.isArray(i?.rows) ? i.rows : []), ge(Array.isArray(i?.fields) ? i.fields : null));
1710
+ n.current && (he(Array.isArray(i?.rows) ? i.rows : []), _e(Array.isArray(i?.fields) ? i.fields : null));
1629
1711
  return;
1630
1712
  }
1631
- let r = m(t.filter, Ne), i = t.compareTo, a = !!i && ke(t.chartType), o = a ? p(te(t.filter, i), Ne) : null, [s, c] = await Promise.all([Me(e, r), o ? Me(e, o) : Promise.resolve([])]), l = s, u = t.aggregate?.groupBy, d = u && typeof u == "object" && !Array.isArray(u) ? u.alias || u.field : u || t.xAxisKey;
1713
+ let r = ne(t.filter, Ne), i = t.compareTo, a = !!i && ke(t.chartType), o = a ? ee(re(t.filter, i), Ne) : null, [s, c] = await Promise.all([Me(e, r), o ? Me(e, o) : Promise.resolve([])]), l = s, u = t.aggregate?.groupBy, d = u && typeof u == "object" && !Array.isArray(u) ? u.alias || u.field : u || t.xAxisKey;
1632
1714
  if (a && c.length > 0 && t.aggregate) {
1633
- let e = t.aggregate.field, n = t.aggregate.function, r = Ft(t.aggregate), i = (t) => {
1715
+ let e = t.aggregate.field, n = t.aggregate.function, r = Ut(t.aggregate), i = (t) => {
1634
1716
  if (t == null) return null;
1635
1717
  if (e) {
1636
1718
  let r = `${e}_${n}`;
@@ -1638,7 +1720,7 @@ var zt = (e) => {
1638
1720
  if (n === "count" && `${e}_count` in t) return Number(t[`${e}_count`]);
1639
1721
  }
1640
1722
  return r in t ? Number(t[r]) : "value" in t ? Number(t.value) : "count" in t ? Number(t.count) : null;
1641
- }, a = `${r}${It}`, o = d;
1723
+ }, a = `${r}${Wt}`, o = d;
1642
1724
  if (o && l.some((e) => e[o] != null) && c.some((e) => e[o] != null)) {
1643
1725
  let e = /* @__PURE__ */ new Map();
1644
1726
  for (let t of c) {
@@ -1674,9 +1756,9 @@ var zt = (e) => {
1674
1756
  }
1675
1757
  if (d && typeof e.getObjectSchema == "function") try {
1676
1758
  let n = await e.getObjectSchema(t.objectName);
1677
- l = await Rt(l, d, n, e, (e, n) => pe.current(t.objectName, d, e, n));
1759
+ l = await Kt(l, d, n, e, (e, n) => w(t.objectName, d, e, n));
1678
1760
  } catch {}
1679
- n.current && k(l);
1761
+ n.current && he(l);
1680
1762
  } catch (e) {
1681
1763
  console.error("[ObjectChart] Fetch error:", e), n.current && be(e instanceof Error ? e.message : "Failed to load chart data");
1682
1764
  } finally {
@@ -1691,119 +1773,120 @@ var zt = (e) => {
1691
1773
  t.xAxisKey,
1692
1774
  t.chartType,
1693
1775
  Me,
1694
- Ne
1776
+ Ne,
1777
+ w
1695
1778
  ]);
1696
- ie(() => {
1779
+ oe(() => {
1697
1780
  let e = { current: !0 };
1698
- return (t.objectName || t.dataset) && !T && !t.data ? Pe(_, e) : e.current && ve(!1), () => {
1781
+ return (t.objectName || t.dataset) && !_ && !t.data ? Pe(h, e) : e.current && ve(!1), () => {
1699
1782
  e.current = !1;
1700
1783
  };
1701
1784
  }, [
1702
1785
  t.objectName,
1703
1786
  Oe,
1787
+ h,
1704
1788
  _,
1705
- T,
1706
1789
  t.data,
1707
1790
  Ee,
1708
1791
  Te,
1709
1792
  De,
1710
1793
  Pe
1711
1794
  ]);
1712
- let Fe = T || t.data || me, M = Array.isArray(Fe) ? Fe : [], N = t.drillDown, P = t.aggregate?.groupBy || t.xAxisKey, F = v(() => {
1713
- if (!P) return /* @__PURE__ */ new Map();
1714
- let e = /* @__PURE__ */ new Map(), t = `__raw_${P}`;
1715
- for (let n of M) {
1716
- let r = n?.[P];
1795
+ let Fe = _ || t.data || me, A = Array.isArray(Fe) ? Fe : [], j = t.drillDown, M = t.aggregate?.groupBy || t.xAxisKey, Ie = v(() => {
1796
+ if (!M) return /* @__PURE__ */ new Map();
1797
+ let e = /* @__PURE__ */ new Map(), t = `__raw_${M}`;
1798
+ for (let n of A) {
1799
+ let r = n?.[M];
1717
1800
  if (r == null) continue;
1718
1801
  let i = t in (n || {}) ? n[t] : r;
1719
1802
  e.set(String(r), i);
1720
1803
  }
1721
1804
  return e;
1722
- }, [M, P]), Ie = v(() => {
1723
- if (A) return {
1805
+ }, [A, M]), Le = v(() => {
1806
+ if (O) return {
1724
1807
  ...t.filter || {},
1725
- ...a(N, A, { groupByField: P })
1808
+ ...o(j, O, { groupByField: M })
1726
1809
  };
1727
1810
  }, [
1728
- A,
1729
- N,
1730
- P,
1811
+ O,
1812
+ j,
1813
+ M,
1731
1814
  Ee
1732
- ]), Le = !h && !!A && !!t.objectName && N?.target === "navigate" && !!Ce;
1733
- ie(() => {
1734
- Le && (Ce(t.objectName, Ie), j(null));
1735
- }, [Le]);
1736
- let B = t.compareTo, V = t.aggregate ? Ft(t.aggregate) : void 0, H = V ? `${V}${It}` : void 0, U = !!B && ke(t.chartType) && !!H && M.some((e) => e[H] != null), W = v(() => {
1815
+ ]), N = !i && !!O && !!t.objectName && j?.target === "navigate" && !!k;
1816
+ oe(() => {
1817
+ N && (k(t.objectName, Le), xe(null));
1818
+ }, [N]);
1819
+ let P = t.compareTo, Re = t.aggregate ? Ut(t.aggregate) : void 0, F = Re ? `${Re}${Wt}` : void 0, I = !!P && ke(t.chartType) && !!F && A.some((e) => e[F] != null), L = v(() => {
1737
1820
  let e = Array.isArray(t.series) ? t.series : null;
1738
- if (!U) return e;
1739
- let n = e || [{ dataKey: V }], r = {
1821
+ if (!I) return e;
1822
+ let n = e || [{ dataKey: Re }], r = {
1740
1823
  vsLastWeek: "Previous week",
1741
1824
  vsLastMonth: "Previous month",
1742
1825
  vsLastQuarter: "Previous quarter",
1743
1826
  vsLastYear: "Previous year",
1744
1827
  vsYesterday: "Yesterday",
1745
1828
  vsPreviousPeriod: "Previous period"
1746
- }[i(B, t.filter)] || "Previous period";
1829
+ }[a(P, t.filter)] || "Previous period";
1747
1830
  return [...n.map((e) => ({
1748
1831
  ...e,
1749
1832
  variant: e.variant || "current"
1750
1833
  })), {
1751
- dataKey: H,
1834
+ dataKey: F,
1752
1835
  label: r,
1753
1836
  variant: "comparison"
1754
1837
  }];
1755
1838
  }, [
1756
- U,
1839
+ I,
1757
1840
  t.series,
1758
- V,
1759
- H,
1841
+ Re,
1842
+ F,
1760
1843
  t.filter,
1761
- B
1762
- ]), Ue = t.dataset ? n(f(M, je), t.dimensions, t.values, he, { nullCategoryLabel: we("chart.nullCategory", "(None)") }) : null, We = Ue ? {
1844
+ P
1845
+ ]), R = t.dataset ? n(m(A, je), t.dimensions, t.values, ge, { nullCategoryLabel: we("chart.nullCategory", "(None)") }) : null, z = R ? {
1763
1846
  ...t,
1764
- data: Ue.data,
1765
- xAxisKey: Ue.xAxisKey,
1766
- series: Ue.series
1847
+ data: R.data,
1848
+ xAxisKey: R.xAxisKey,
1849
+ series: R.series
1767
1850
  } : {
1768
1851
  ...t,
1769
- data: M,
1770
- ...W ? { series: W } : {}
1771
- }, Ge = t.colors && !Array.isArray(t.colors) && typeof t.colors == "object" ? t.colors : null, Ke = Array.isArray(t.colors) ? t.colors : void 0, G = Ae || Ge ? {
1852
+ data: A,
1853
+ ...L ? { series: L } : {}
1854
+ }, B = t.colors && !Array.isArray(t.colors) && typeof t.colors == "object" ? t.colors : null, V = Array.isArray(t.colors) ? t.colors : void 0, H = Ae || B ? {
1772
1855
  ...Ae || {},
1773
- ...Ge || {}
1774
- } : void 0, qe = {
1775
- ...We,
1776
- colors: Ke,
1777
- ...G ? { categoryColors: G } : {}
1856
+ ...B || {}
1857
+ } : void 0, Je = {
1858
+ ...z,
1859
+ colors: V,
1860
+ ...H ? { categoryColors: H } : {}
1778
1861
  };
1779
- if (_e && M.length === 0) return /* @__PURE__ */ D("div", {
1862
+ if (D && A.length === 0) return /* @__PURE__ */ E("div", {
1780
1863
  className: "p-2 " + (t.className || ""),
1781
1864
  "data-testid": "chart-loading",
1782
1865
  role: "status",
1783
1866
  "aria-busy": "true",
1784
1867
  "aria-live": "polite",
1785
- children: [/* @__PURE__ */ E("span", {
1868
+ children: [/* @__PURE__ */ T("span", {
1786
1869
  className: "sr-only",
1787
1870
  children: "Loading chart data…"
1788
- }), /* @__PURE__ */ E(S, { className: "h-full" })]
1871
+ }), /* @__PURE__ */ T(x, { className: "h-full" })]
1789
1872
  });
1790
- if (ye) return /* @__PURE__ */ D("div", {
1873
+ if (ye) return /* @__PURE__ */ E("div", {
1791
1874
  className: "flex flex-col items-center justify-center gap-2 p-4 " + (t.className || ""),
1792
1875
  "data-testid": "chart-error",
1793
1876
  role: "alert",
1794
1877
  children: [
1795
- /* @__PURE__ */ E(He, { className: "h-6 w-6 text-destructive opacity-60" }),
1796
- /* @__PURE__ */ E("p", {
1878
+ /* @__PURE__ */ T(We, { className: "h-6 w-6 text-destructive opacity-60" }),
1879
+ /* @__PURE__ */ T("p", {
1797
1880
  className: "text-xs text-destructive font-medium",
1798
1881
  children: "Failed to load chart data"
1799
1882
  }),
1800
- /* @__PURE__ */ E("p", {
1883
+ /* @__PURE__ */ T("p", {
1801
1884
  className: "text-xs text-muted-foreground max-w-xs text-center",
1802
1885
  children: ye
1803
1886
  })
1804
1887
  ]
1805
1888
  });
1806
- if (!_ && t.objectName && M.length === 0) return /* @__PURE__ */ D("div", {
1889
+ if (!h && t.objectName && A.length === 0) return /* @__PURE__ */ E("div", {
1807
1890
  className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (t.className || ""),
1808
1891
  "data-testid": "chart-no-datasource",
1809
1892
  children: [
@@ -1812,22 +1895,22 @@ var zt = (e) => {
1812
1895
  "”"
1813
1896
  ]
1814
1897
  });
1815
- let Je = l(N) ? (e) => {
1816
- let t = e.category, n = t != null && F.has(String(t)) ? F.get(String(t)) : t;
1817
- j({
1898
+ let Ye = d(j) ? (e) => {
1899
+ let t = e.category, n = t != null && Ie.has(String(t)) ? Ie.get(String(t)) : t;
1900
+ xe({
1818
1901
  ...e,
1819
1902
  category: n,
1820
1903
  categoryLabel: t,
1821
1904
  scope: "cell"
1822
1905
  });
1823
- } : void 0, Ye = h ?? Je, Xe = !h && A && t.objectName && !Le ? (() => {
1824
- let e = Ie ?? {}, n = ee(N, A, t.title || "Details"), r = N?.target ?? "drawer", i = {
1906
+ } : void 0, Xe = i ?? Ye, Ze = !i && O && t.objectName && !N ? (() => {
1907
+ let e = Le ?? {}, n = te(j, O, t.title || "Details"), r = j?.target ?? "drawer", i = {
1825
1908
  type: "object-data-table",
1826
1909
  objectName: t.objectName,
1827
1910
  filter: e,
1828
1911
  pagination: !0,
1829
- pageSize: N?.maxRows,
1830
- columns: N?.columns?.map((e) => ({
1912
+ pageSize: j?.maxRows,
1913
+ columns: j?.columns?.map((e) => ({
1831
1914
  accessorKey: e,
1832
1915
  header: e
1833
1916
  })),
@@ -1836,75 +1919,75 @@ var zt = (e) => {
1836
1919
  mode: "record",
1837
1920
  target: "dialog"
1838
1921
  }
1839
- }, a = /* @__PURE__ */ E("div", {
1922
+ }, a = /* @__PURE__ */ T("div", {
1840
1923
  className: "overflow-auto",
1841
1924
  "data-testid": "chart-drill-body",
1842
- children: /* @__PURE__ */ E(Re, {
1925
+ children: /* @__PURE__ */ T(ze, {
1843
1926
  schema: i,
1844
- dataSource: _
1927
+ dataSource: h
1845
1928
  })
1846
- }), o = Ce && t.objectName ? /* @__PURE__ */ D(x, {
1929
+ }), o = k && t.objectName ? /* @__PURE__ */ E(b, {
1847
1930
  type: "button",
1848
1931
  variant: "ghost",
1849
1932
  size: "sm",
1850
1933
  "data-testid": "drill-open-in-list",
1851
1934
  onClick: () => {
1852
- Ce(t.objectName, e), j(null);
1935
+ k(t.objectName, e), xe(null);
1853
1936
  },
1854
- children: [we("dashboard.openInList", "Open in list"), /* @__PURE__ */ E(L, { className: "ml-1 h-3.5 w-3.5" })]
1937
+ children: [we("dashboard.openInList", "Open in list"), /* @__PURE__ */ T(Ge, { className: "ml-1 h-3.5 w-3.5" })]
1855
1938
  }) : null;
1856
- return r === "dialog" ? /* @__PURE__ */ E(C, {
1939
+ return r === "dialog" ? /* @__PURE__ */ T(S, {
1857
1940
  open: !0,
1858
- onOpenChange: (e) => !e && j(null),
1859
- children: /* @__PURE__ */ D(w, {
1941
+ onOpenChange: (e) => !e && xe(null),
1942
+ children: /* @__PURE__ */ E(C, {
1860
1943
  className: "max-w-4xl",
1861
- children: [/* @__PURE__ */ D(ae, {
1944
+ children: [/* @__PURE__ */ E(se, {
1862
1945
  className: "flex-row items-center justify-between gap-4 pr-8",
1863
- children: [/* @__PURE__ */ E(oe, { children: n }), o]
1946
+ children: [/* @__PURE__ */ T(ce, { children: n }), o]
1864
1947
  }), a]
1865
1948
  })
1866
- }) : /* @__PURE__ */ E(ce, {
1949
+ }) : /* @__PURE__ */ T(ue, {
1867
1950
  open: !0,
1868
- onOpenChange: (e) => !e && j(null),
1869
- children: /* @__PURE__ */ D(le, {
1951
+ onOpenChange: (e) => !e && xe(null),
1952
+ children: /* @__PURE__ */ E(de, {
1870
1953
  side: "right",
1871
1954
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
1872
- children: [/* @__PURE__ */ D(ue, {
1955
+ children: [/* @__PURE__ */ E(fe, {
1873
1956
  className: "flex-row items-center justify-between gap-4 pr-8",
1874
- children: [/* @__PURE__ */ E(de, { children: n }), o]
1875
- }), /* @__PURE__ */ E("div", {
1957
+ children: [/* @__PURE__ */ T(pe, { children: n }), o]
1958
+ }), /* @__PURE__ */ T("div", {
1876
1959
  className: "flex-1 overflow-hidden mt-2",
1877
1960
  children: a
1878
1961
  })]
1879
1962
  })
1880
1963
  });
1881
1964
  })() : null;
1882
- return /* @__PURE__ */ D("div", {
1883
- className: "relative",
1965
+ return /* @__PURE__ */ E("div", {
1966
+ className: "relative h-full",
1884
1967
  children: [
1885
- /* @__PURE__ */ E(se, { active: _e && M.length > 0 }),
1886
- /* @__PURE__ */ E($, {
1968
+ /* @__PURE__ */ T(le, { active: D && A.length > 0 }),
1969
+ /* @__PURE__ */ T($, {
1887
1970
  ...e,
1888
- schema: qe,
1889
- onChartClick: Ye
1971
+ schema: Je,
1972
+ onChartClick: Xe
1890
1973
  }),
1891
- Xe
1974
+ Ze
1892
1975
  ]
1893
1976
  });
1894
- }, Bt = { filter: !0 }, Vt = (e) => /* @__PURE__ */ E(Le, {
1977
+ }, Jt = { filter: !0 }, Yt = (e) => /* @__PURE__ */ T(F, {
1895
1978
  schema: e.schema,
1896
- mapping: Bt,
1979
+ mapping: Jt,
1897
1980
  dataSource: e.dataSource,
1898
1981
  testId: "object-chart",
1899
1982
  errorTitle: "This chart’s data source could not be resolved",
1900
- children: (t) => /* @__PURE__ */ E(zt, {
1983
+ children: (t) => /* @__PURE__ */ T(qt, {
1901
1984
  ...e,
1902
1985
  schema: t
1903
1986
  })
1904
1987
  });
1905
1988
  //#endregion
1906
1989
  //#region src/index.tsx
1907
- e.register("object-chart", Vt, {
1990
+ e.register("object-chart", Yt, {
1908
1991
  namespace: "plugin-charts",
1909
1992
  label: "Object Chart",
1910
1993
  category: "view",
@@ -1939,12 +2022,12 @@ e.register("object-chart", Vt, {
1939
2022
  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."
1940
2023
  }
1941
2024
  ]
1942
- }), $e();
1943
- var Ht = {
1944
- "bar-chart": Nt,
2025
+ }), rt();
2026
+ var Xt = {
2027
+ "bar-chart": Ht,
1945
2028
  chart: $
1946
2029
  };
1947
- e.register("bar-chart", Nt, {
2030
+ e.register("bar-chart", Ht, {
1948
2031
  namespace: "plugin-charts",
1949
2032
  label: "Bar Chart",
1950
2033
  category: "plugin",
@@ -2008,7 +2091,7 @@ e.register("bar-chart", Nt, {
2008
2091
  height: 400,
2009
2092
  color: "#8884d8"
2010
2093
  }
2011
- }), e.register("chart", Vt, {
2094
+ }), e.register("chart", Yt, {
2012
2095
  namespace: "view",
2013
2096
  category: "view",
2014
2097
  label: "Chart",
@@ -2175,4 +2258,4 @@ e.register("bar-chart", Nt, {
2175
2258
  defaultProps: { chartType: "scatter" }
2176
2259
  });
2177
2260
  //#endregion
2178
- export { Nt as ChartBarRenderer, $ as ChartRenderer, zt as ObjectChart, Vt as ObjectChartBlock, Ht as chartComponents, We as normalizeChartSchema };
2261
+ export { Ht as ChartBarRenderer, $ as ChartRenderer, qt as ObjectChart, Yt as ObjectChartBlock, Xt as chartComponents, H as normalizeChartSchema };