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