@object-ui/plugin-charts 17.6.0 → 17.7.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,160 +1,199 @@
1
- import { ComponentRegistry as e, buildCategoryRank as t, buildChartSeries as n, buildOptionColorMap as r, chartRowBucketId as i, compareToTrendLabelKey as a, computeDrillFilter as o, deriveDimensionLabelMaps as s, dimensionOptionTranslator as c, extractRecords as l, humanizeLabel as u, isDrillEnabled as d, loadDimensionFieldMeta as f, localizeFieldOptions as p, relabelDimensions as m, resolveContextTokens as ee, resolveDrillTitle as te, resolveFilterPlaceholders as ne, shiftFilterByCompareTo as re } from "@object-ui/core";
2
- import * as h from "react";
3
- import g, { Suspense as _, useCallback as ie, useContext as ae, useEffect as oe, useMemo as v, useState as y } from "react";
4
- import { Button as b, ChartSkeleton as x, Dialog as S, DialogContent as C, DialogHeader as se, DialogTitle as ce, RefreshIndicator as le, Sheet as ue, SheetContent as de, SheetHeader as fe, SheetTitle as pe, Skeleton as w } from "@object-ui/components";
5
- import { Fragment as me, jsx as T, jsxs as E } from "react/jsx-runtime";
6
- import { Area as he, AreaChart as ge, Bar as _e, BarChart as D, Brush as ve, CartesianGrid as ye, Cell as be, ComposedChart as O, Funnel as xe, FunnelChart as Se, LabelList as Ce, Legend as k, Line as we, LineChart as Te, Pie as Ee, PieChart as De, PolarAngleAxis as Oe, PolarGrid as ke, PolarRadiusAxis as Ae, Radar as je, RadarChart as Me, ReferenceArea as Ne, ReferenceLine as Pe, ResponsiveContainer as Fe, Sankey as A, Scatter as j, ScatterChart as M, Tooltip as Ie, Treemap as Le, XAxis as N, YAxis as P, ZAxis as Re } from "recharts";
7
- import { ElementDataSourceGate as F, SchemaRenderer as ze, SchemaRendererContext as Be, useDataScope as Ve, useDrillNavigation as He, useFilterScope as Ue } from "@object-ui/react";
8
- import { AlertCircle as We, ArrowUpRight as Ge } from "lucide-react";
9
- import { useSafeFieldLabel as Ke, useSafeTranslate as qe } from "@object-ui/i18n";
1
+ import { ComponentRegistry as e, FilterOperatorError as t, buildCategoryRank as n, buildChartSeries as r, buildOptionColorMap as i, chartMeasureKey as a, chartRowBucketId as o, chartTypeIgnoresCompareTo as s, compareToTrendLabelKey as c, composeDrillFilter as l, computeDrillFilter as u, deriveDimensionLabelMaps as d, dimensionOptionTranslator as f, elementDataSourceBlock as p, extractRecords as m, humanizeLabel as h, isDrillEnabled as ee, isRealCalendarDate as te, isStructuredGroupBy as ne, loadDimensionFieldMeta as re, localizeFieldOptions as ie, objectAggregateSpecQuery as ae, relabelDimensions as oe, resolveContextTokens as se, resolveDrillTitle as ce, resolveFilterPlaceholders as g, shiftFilterByCompareTo as le, toDateInputValue as ue, toDisplayDate as de } from "@object-ui/core";
2
+ import * as _ from "react";
3
+ import v, { Suspense as y, useCallback as b, useContext as x, useEffect as S, useMemo as C, useState as w } from "react";
4
+ import { Button as fe, ChartSkeleton as pe, DataEmptyState as me, Dialog as he, DialogContent as ge, DialogHeader as _e, DialogTitle as ve, RefreshIndicator as ye, Sheet as be, SheetContent as xe, SheetHeader as Se, SheetTitle as Ce, Skeleton as we } from "@object-ui/components";
5
+ import { builtinAggregateLabels as Te, pickLocalized as Ee, useDisplayLocale as De, useObjectTranslation as Oe, useSafeFieldLabel as ke, useSafeTranslate as Ae } from "@object-ui/i18n";
6
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
7
+ import { Area as je, AreaChart as Me, Bar as Ne, BarChart as Pe, Brush as Fe, CartesianGrid as O, Cell as Ie, ComposedChart as Le, Funnel as Re, FunnelChart as k, LabelList as ze, Legend as Be, Line as Ve, LineChart as He, Pie as Ue, PieChart as We, PolarAngleAxis as Ge, PolarGrid as Ke, PolarRadiusAxis as qe, Radar as Je, RadarChart as Ye, ReferenceArea as Xe, ReferenceLine as Ze, ResponsiveContainer as Qe, Sankey as $e, Scatter as A, ScatterChart as j, Tooltip as M, Treemap as et, XAxis as N, YAxis as P } from "recharts";
8
+ import { ElementDataSourceGate as tt, SchemaRenderer as nt, SchemaRendererContext as rt, useDataInvalidation as F, useDataScope as I, useDrillNavigation as L, useFilterScope as R } from "@object-ui/react";
9
+ import { AlertCircle as z, ArrowUpRight as it, Inbox as at } from "lucide-react";
10
10
  //#region \0rolldown/runtime.js
11
- var I = Object.defineProperty, L = (e, t, n) => () => {
11
+ var B = Object.defineProperty, V = (e, t, n) => () => {
12
12
  if (n) throw n[0];
13
13
  try {
14
14
  return e && (t = e(e = 0)), t;
15
15
  } catch (e) {
16
16
  throw n = [e], e;
17
17
  }
18
- }, R = (e, t) => {
18
+ }, ot = (e, t) => {
19
19
  let n = {};
20
- for (var r in e) I(n, r, {
20
+ for (var r in e) B(n, r, {
21
21
  get: e[r],
22
22
  enumerable: !0
23
23
  });
24
- return t || I(n, Symbol.toStringTag, { value: "Module" }), n;
24
+ return t || B(n, Symbol.toStringTag, { value: "Module" }), n;
25
25
  };
26
26
  //#endregion
27
27
  //#region src/normalizeChartSchema.ts
28
- function z(e) {
29
- let t = W(e);
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);
28
+ function H(e) {
29
+ if (!e) return;
30
+ let t = e.startsWith(K) ? e.slice(14) : e;
31
+ return vt.get(t);
32
+ }
33
+ function U(e, t) {
34
+ if (typeof e == "string" || q(e)) return Ee(e, t) || void 0;
35
+ }
36
+ function st(e, t) {
37
+ if (!q(e)) return;
38
+ let n = {}, r = J(e.field);
39
+ r && (n.field = r);
40
+ let i = J(e.format);
41
+ i && (n.format = i);
42
+ let a = Y(e.min);
43
+ a !== void 0 && (n.min = a);
44
+ let o = Y(e.max);
45
+ o !== void 0 && (n.max = o);
46
+ let s = Y(e.stepSize);
47
+ s !== void 0 && s > 0 && (n.stepSize = s), typeof e.showGridLines == "boolean" && (n.showGridLines = e.showGridLines), typeof e.logarithmic == "boolean" && (n.logarithmic = e.logarithmic);
48
+ let c = J(e.position);
49
+ (c === "left" || c === "right" || c === "top" || c === "bottom") && (n.position = c);
50
+ let l = U(e.title, t);
51
+ return l && (n.title = l), n;
52
+ }
53
+ function ct(e, t) {
54
+ if (!q(e)) {
55
+ let t = J(e);
53
56
  return t ? { dataKey: t } : void 0;
54
57
  }
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;
58
+ let n = J(e.dataKey) ?? J(e.name);
59
+ if (!n) return;
60
+ let r = { dataKey: n }, i = U(e.label, t);
61
+ i && (r.label = i);
62
+ let a = J(e.chartType) ?? J(e.type);
63
+ (a === "bar" || a === "line" || a === "area") && (r.chartType = a);
64
+ let o = J(e.variant);
65
+ (o === "comparison" || o === "current" || o === "primary") && (r.variant = o);
66
+ let s = Y(e.opacity);
67
+ s !== void 0 && (r.opacity = s);
68
+ let c = J(e.dashArray);
69
+ c && (r.dashArray = c);
70
+ let l = J(e.stack);
71
+ l && (r.stack = l);
72
+ let u = J(e.yAxis);
73
+ (u === "left" || u === "right") && (r.yAxis = u);
74
+ let d = J(e.color);
75
+ return d && (r.color = d), r;
73
76
  }
74
- function H(e) {
75
- if (!U(e)) return {};
76
- let t = {}, n = W(e.type), r = W(e.chartType) ?? W(e.specType) ?? (n && nt.has(n) ? n : void 0);
77
- r && $e.has(r) && (t.chartType = r);
78
- let i = e.xAxis, a = B(i);
79
- 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) => ({
77
+ function lt(e, t) {
78
+ let n = t === "horizontal-bar", r = t === "scatter" ? 1 : 2, i = (e ?? []).slice(0, r), a = [], o = (e) => n ? e === "bottom" ? "left" : e === "top" ? "right" : void 0 : e === "left" || e === "right" ? e : void 0, s = (e) => e === "left" ? "right" : "left", c = i.map((e) => o(e.position)), l = [];
79
+ if (i.length === 1) l.push(c[0] ?? "left");
80
+ else if (i.length === 2) {
81
+ let [e, t] = c;
82
+ e && t ? l.push(e, e === t ? s(e) : t) : e ? l.push(e, s(e)) : t ? l.push(s(t), t) : l.push("left", "right");
83
+ }
84
+ i.forEach((e, t) => {
85
+ e.position && (c[t] ? c[t] !== l[t] && a.push({
86
+ index: t,
87
+ position: e.position,
88
+ reason: "taken",
89
+ drawn: l[t]
90
+ }) : a.push({
91
+ index: t,
92
+ position: e.position,
93
+ reason: "side",
94
+ drawn: l[t]
95
+ }));
96
+ });
97
+ let u = r === 1 ? l[0] : "right", d = {
98
+ slotOf: l,
99
+ notes: a,
100
+ undrawn: (e ?? []).slice(i.length).map((e, t) => ({
101
+ index: i.length + t,
102
+ boundTo: u
103
+ }))
104
+ };
105
+ return l.forEach((e, t) => {
106
+ d[e] = t;
107
+ }), d;
108
+ }
109
+ function ut(e, t) {
110
+ if (!q(e)) return {};
111
+ let n = {}, r = J(e.type), i = J(e.chartType) ?? J(e.specType) ?? (r && _t.has(r) ? r : void 0) ?? H(r);
112
+ i && (n.chartType = i);
113
+ let a = e.xAxis, o = st(a, t);
114
+ o && Object.keys(o).some((e) => e !== "field") && (n.xAxis = o);
115
+ let s = J(e.xAxisKey) ?? o?.field ?? J(a);
116
+ s && (n.xAxisKey = s);
117
+ let c = (Array.isArray(e.yAxis) ? e.yAxis : e.yAxis === void 0 ? [] : [e.yAxis]).map((e) => st(e, t) ?? (J(e) ? { field: J(e) } : void 0)).filter((e) => !!e);
118
+ c.length && (n.yAxes = c);
119
+ let l = (Array.isArray(e.series) ? e.series : Array.isArray(e.categories) ? e.categories : void 0)?.map((e) => ct(e, t)).filter((e) => !!e);
120
+ if (!l?.length) {
121
+ let e = lt(c, i), t = [...e.slotOf, ...e.undrawn.map((e) => e.boundTo)], n = c.map((e, n) => ({
122
+ a: e,
123
+ slot: t[n],
124
+ i: n
125
+ })).filter(({ a: e }) => e.field).map(({ a: e, slot: t, i: n }) => ({
87
126
  dataKey: e.field,
88
127
  ...e.title ? { label: e.title } : {},
89
- ...t > 0 || e.position === "right" ? { yAxis: "right" } : {}
128
+ ...t === "right" || n > 0 ? { yAxis: t } : {}
90
129
  }));
91
- e.length && (c = e);
130
+ n.length && (l = n);
92
131
  }
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 Je(e) {
132
+ l?.length && (n.series = l), typeof e.showLegend == "boolean" && (n.showLegend = e.showLegend), typeof e.showDataLabels == "boolean" && (n.showDataLabels = e.showDataLabels);
133
+ let u = U(e.title, t);
134
+ u && (n.title = u);
135
+ let d = U(e.subtitle, t);
136
+ d && (n.subtitle = d);
137
+ let f = U(e.description, t);
138
+ f && (n.description = f);
139
+ let p = Y(e.height);
140
+ return p !== void 0 && p > 0 && (n.height = p), Array.isArray(e.annotations) && e.annotations.length && (n.annotations = e.annotations.filter(q)), q(e.interaction) && (n.interaction = e.interaction), n;
141
+ }
142
+ function dt(e) {
104
143
  if (e === "bar" || e === "column") return "bar";
105
144
  if (e === "line") return "line";
106
145
  if (e === "area") return "area";
107
146
  }
108
- function Ye(e, t) {
147
+ function ft(e, t) {
109
148
  if (e === "combo") return "combo";
110
- let n = Je(e);
149
+ let n = dt(e);
111
150
  if (!n || !t || t.length < 2) return e;
112
151
  let r = t.map((e) => e.chartType ?? n);
113
152
  return new Set(r).size > 1 ? "combo" : e;
114
153
  }
115
- function Xe(e) {
154
+ function W(e, t) {
116
155
  if (!e) return;
117
- let t = e.includes("%"), n = /^([$£€¥₹])/.exec(e), r = e.includes(","), i = /\.(0+)/.exec(e)?.[1].length ?? 0, a = {
156
+ let n = e.includes("%"), r = /^([$£€¥₹])/.exec(e), i = e.includes(","), a = /\.(0+)/.exec(e)?.[1].length ?? 0, o = {
118
157
  $: "USD",
119
158
  "£": "GBP",
120
159
  "€": "EUR",
121
160
  "¥": "CNY",
122
161
  "₹": "INR"
123
162
  };
124
- if (!t && !n && !r && i === 0) return;
125
- let o = {
126
- minimumFractionDigits: i,
127
- maximumFractionDigits: i,
128
- useGrouping: r
163
+ if (!n && !r && !i && a === 0) return;
164
+ let s = {
165
+ minimumFractionDigits: a,
166
+ maximumFractionDigits: a,
167
+ useGrouping: i
129
168
  };
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);
169
+ return n ? s.style = "percent" : r && (s.style = "currency", s.currency = o[r[1]] ?? "USD"), (e) => {
170
+ let n = typeof e == "number" ? e : Number(e);
171
+ if (!Number.isFinite(n)) return e == null ? "" : String(e);
133
172
  try {
134
- return new Intl.NumberFormat(void 0, o).format(t);
173
+ return new Intl.NumberFormat(t, s).format(n);
135
174
  } catch {
136
- return String(t);
175
+ return String(n);
137
176
  }
138
177
  };
139
178
  }
140
- function Ze(e, t) {
179
+ function pt(e, t) {
141
180
  let n = e?.stepSize;
142
181
  if (!n || n <= 0) return;
143
182
  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
183
  if (s === void 0 || !Number.isFinite(o) || !Number.isFinite(s) || s < o) return;
145
184
  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 > K) return;
185
+ if (u < 1 || u > yt) return;
147
186
  let d = [];
148
187
  for (let e = 0; e < u; e++) d.push(Number((c + e * n).toPrecision(12)));
149
188
  return e.max !== void 0 && d[d.length - 1] < e.max && d.push(e.max), d;
150
189
  }
151
- function Qe(e) {
190
+ function G(e) {
152
191
  if (!e) return;
153
192
  let { min: t, max: n } = e;
154
193
  if (t !== void 0 || n !== void 0) return [t ?? "auto", n ?? "auto"];
155
194
  }
156
- var $e, et, tt, nt, U, W, G, K, rt = L((() => {
157
- $e = /* @__PURE__ */ new Set([
195
+ var mt, ht, gt, _t, vt, K, q, J, Y, yt, bt = V((() => {
196
+ mt = /* @__PURE__ */ new Set([
158
197
  "bar",
159
198
  "column",
160
199
  "horizontal-bar",
@@ -168,44 +207,44 @@ var $e, et, tt, nt, U, W, G, K, rt = L((() => {
168
207
  "treemap",
169
208
  "sankey",
170
209
  "combo"
171
- ]), et = /* @__PURE__ */ new Set([
210
+ ]), ht = /* @__PURE__ */ new Set([
172
211
  "gauge",
173
212
  "solid-gauge",
174
213
  "metric",
175
214
  "kpi",
176
215
  "bullet"
177
- ]), tt = /* @__PURE__ */ new Set(["table", "pivot"]), nt = /* @__PURE__ */ new Set([
178
- ...$e,
179
- ...et,
180
- ...tt
181
- ]), U = (e) => !!e && typeof e == "object" && !Array.isArray(e), W = (e) => typeof e == "string" && e ? e : void 0, G = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, K = 200;
182
- })), it = /* @__PURE__ */ R({ default: () => st });
183
- function at(e, t = 14) {
216
+ ]), gt = /* @__PURE__ */ new Set(["table", "pivot"]), _t = /* @__PURE__ */ new Set([
217
+ ...mt,
218
+ ...ht,
219
+ ...gt
220
+ ]), vt = /* @__PURE__ */ new Map([["chart:bar", "bar"]]), K = "plugin-charts:", q = (e) => !!e && typeof e == "object" && !Array.isArray(e), J = (e) => typeof e == "string" && e ? e : void 0, Y = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, yt = 200;
221
+ })), xt = /* @__PURE__ */ ot({ default: () => wt });
222
+ function St(e, t = 14) {
184
223
  return e.length > t ? `${e.slice(0, t - 1)}…` : e;
185
224
  }
186
- function ot({ x: e, y: t, payload: n }) {
187
- let r = String(n?.value ?? ""), i = at(r);
188
- return /* @__PURE__ */ T("g", {
225
+ function Ct({ x: e, y: t, payload: n }) {
226
+ let r = String(n?.value ?? ""), i = St(r);
227
+ return /* @__PURE__ */ E("g", {
189
228
  transform: `translate(${e},${t})`,
190
- children: /* @__PURE__ */ E("text", {
229
+ children: /* @__PURE__ */ D("text", {
191
230
  dy: 10,
192
231
  textAnchor: "end",
193
232
  transform: "rotate(-32)",
194
233
  fill: "hsl(var(--muted-foreground))",
195
234
  fontSize: 11,
196
235
  fontFamily: "monospace",
197
- children: [r !== i && /* @__PURE__ */ T("title", { children: r }), i]
236
+ children: [r !== i && /* @__PURE__ */ E("title", { children: r }), i]
198
237
  })
199
238
  });
200
239
  }
201
- function st({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
240
+ function wt({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
202
241
  let o = e.map((e) => String(e?.[n] ?? "")), s = o.length > 4 || o.some((e) => e.length > 8);
203
- return /* @__PURE__ */ T("div", {
242
+ return /* @__PURE__ */ E("div", {
204
243
  className: `p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${i}`,
205
- children: /* @__PURE__ */ T(Fe, {
244
+ children: /* @__PURE__ */ E(Qe, {
206
245
  width: "100%",
207
246
  height: r,
208
- children: /* @__PURE__ */ E(D, {
247
+ children: /* @__PURE__ */ D(Pe, {
209
248
  data: e,
210
249
  margin: {
211
250
  top: 10,
@@ -214,66 +253,66 @@ function st({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
214
253
  bottom: s ? 24 : 5
215
254
  },
216
255
  children: [
217
- /* @__PURE__ */ E("defs", { children: [/* @__PURE__ */ E("linearGradient", {
256
+ /* @__PURE__ */ D("defs", { children: [/* @__PURE__ */ D("linearGradient", {
218
257
  id: "barGradient",
219
258
  x1: "0",
220
259
  y1: "0",
221
260
  x2: "0",
222
261
  y2: "1",
223
262
  children: [
224
- /* @__PURE__ */ T("stop", {
263
+ /* @__PURE__ */ E("stop", {
225
264
  offset: "0%",
226
265
  stopColor: a,
227
266
  stopOpacity: 1
228
267
  }),
229
- /* @__PURE__ */ T("stop", {
268
+ /* @__PURE__ */ E("stop", {
230
269
  offset: "90%",
231
270
  stopColor: a,
232
271
  stopOpacity: .6
233
272
  }),
234
- /* @__PURE__ */ T("stop", {
273
+ /* @__PURE__ */ E("stop", {
235
274
  offset: "100%",
236
275
  stopColor: a,
237
276
  stopOpacity: .3
238
277
  })
239
278
  ]
240
- }), /* @__PURE__ */ E("filter", {
279
+ }), /* @__PURE__ */ D("filter", {
241
280
  id: "glow",
242
281
  height: "130%",
243
282
  children: [
244
- /* @__PURE__ */ T("feGaussianBlur", {
283
+ /* @__PURE__ */ E("feGaussianBlur", {
245
284
  in: "SourceAlpha",
246
285
  stdDeviation: "3",
247
286
  result: "blur"
248
287
  }),
249
- /* @__PURE__ */ T("feOffset", {
288
+ /* @__PURE__ */ E("feOffset", {
250
289
  in: "blur",
251
290
  dx: "0",
252
291
  dy: "0",
253
292
  result: "offsetBlur"
254
293
  }),
255
- /* @__PURE__ */ T("feFlood", {
294
+ /* @__PURE__ */ E("feFlood", {
256
295
  floodColor: a,
257
296
  floodOpacity: "0.5",
258
297
  result: "offsetColor"
259
298
  }),
260
- /* @__PURE__ */ T("feComposite", {
299
+ /* @__PURE__ */ E("feComposite", {
261
300
  in: "offsetColor",
262
301
  in2: "offsetBlur",
263
302
  operator: "in",
264
303
  result: "offsetBlur"
265
304
  }),
266
- /* @__PURE__ */ E("feMerge", { children: [/* @__PURE__ */ T("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ T("feMergeNode", { in: "SourceGraphic" })] })
305
+ /* @__PURE__ */ D("feMerge", { children: [/* @__PURE__ */ E("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ E("feMergeNode", { in: "SourceGraphic" })] })
267
306
  ]
268
307
  })] }),
269
- /* @__PURE__ */ T(ye, {
308
+ /* @__PURE__ */ E(O, {
270
309
  strokeDasharray: "3 3",
271
310
  stroke: "hsl(var(--border))",
272
311
  vertical: !1
273
312
  }),
274
- /* @__PURE__ */ T(N, {
313
+ /* @__PURE__ */ E(N, {
275
314
  dataKey: n,
276
- tick: s ? /* @__PURE__ */ T(ot, {}) : {
315
+ tick: s ? /* @__PURE__ */ E(Ct, {}) : {
277
316
  fill: "hsl(var(--muted-foreground))",
278
317
  fontSize: 12,
279
318
  fontFamily: "monospace"
@@ -284,7 +323,7 @@ function st({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
284
323
  height: s ? 56 : void 0,
285
324
  dy: s ? void 0 : 10
286
325
  }),
287
- /* @__PURE__ */ T(P, {
326
+ /* @__PURE__ */ E(P, {
288
327
  tick: {
289
328
  fill: "hsl(var(--muted-foreground))",
290
329
  fontSize: 12,
@@ -293,7 +332,7 @@ function st({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
293
332
  tickLine: !1,
294
333
  axisLine: !1
295
334
  }),
296
- /* @__PURE__ */ T(Ie, {
335
+ /* @__PURE__ */ E(M, {
297
336
  cursor: {
298
337
  fill: "hsl(var(--muted))",
299
338
  opacity: .2
@@ -308,11 +347,11 @@ function st({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
308
347
  },
309
348
  itemStyle: { color: "hsl(var(--primary))" }
310
349
  }),
311
- /* @__PURE__ */ T(k, { wrapperStyle: {
350
+ /* @__PURE__ */ E(Be, { wrapperStyle: {
312
351
  paddingTop: "20px",
313
352
  fontFamily: "monospace"
314
353
  } }),
315
- /* @__PURE__ */ T(_e, {
354
+ /* @__PURE__ */ E(Ne, {
316
355
  dataKey: t,
317
356
  fill: "url(#barGradient)",
318
357
  radius: [
@@ -329,17 +368,17 @@ function st({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
329
368
  })
330
369
  });
331
370
  }
332
- var ct = L((() => {}));
371
+ var Tt = V((() => {}));
333
372
  //#endregion
334
373
  //#region src/ChartContainerImpl.tsx
335
- function q() {
336
- let e = h.useContext(pt);
374
+ function Et() {
375
+ let e = _.useContext(Z);
337
376
  if (!e) throw Error("useChart must be used within a <ChartContainer />");
338
377
  return e;
339
378
  }
340
- function J({ id: e, className: t, children: n, config: r, disableSettleRemount: i, style: a, ...o }) {
341
- let s = h.useId(), c = `chart-${e || s.replace(/:/g, "")}`, l = h.useRef(null), [u, d] = h.useState(0);
342
- h.useEffect(() => {
379
+ function Dt({ id: e, className: t, children: n, config: r, disableSettleRemount: i, style: a, ...o }) {
380
+ let s = _.useId(), c = `chart-${e || s.replace(/:/g, "")}`, l = _.useRef(null), [u, d] = _.useState(0);
381
+ _.useEffect(() => {
343
382
  if (i) return;
344
383
  let e = l.current;
345
384
  if (e == null || typeof ResizeObserver > "u") return;
@@ -355,40 +394,40 @@ function J({ id: e, className: t, children: n, config: r, disableSettleRemount:
355
394
  };
356
395
  }, [i]);
357
396
  let f = a?.height != null || a?.minHeight != null, p = a?.width != null || a?.minWidth != null, m = {
358
- ...f ? {} : { minHeight: mt },
397
+ ...f ? {} : { minHeight: Mt },
359
398
  ...p ? {} : { minWidth: 0 },
360
399
  ...a
361
400
  };
362
- return /* @__PURE__ */ T(pt.Provider, {
401
+ return /* @__PURE__ */ E(Z.Provider, {
363
402
  value: { config: r },
364
- children: /* @__PURE__ */ E("div", {
403
+ children: /* @__PURE__ */ D("div", {
365
404
  ref: l,
366
405
  "data-slot": "chart",
367
406
  "data-chart": c,
368
- className: Y("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
407
+ className: X("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
369
408
  style: m,
370
409
  ...o,
371
- children: [/* @__PURE__ */ T(X, {
410
+ children: [/* @__PURE__ */ E(Nt, {
372
411
  id: c,
373
412
  config: r
374
- }), /* @__PURE__ */ T(Fe, {
413
+ }), /* @__PURE__ */ E(Qe, {
375
414
  width: "100%",
376
415
  height: "100%",
377
- ...f ? {} : { minHeight: mt },
416
+ ...f ? {} : { minHeight: Mt },
378
417
  children: n
379
418
  }, u)]
380
419
  })
381
420
  });
382
421
  }
383
- function lt({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: o, labelFormatter: s, labelClassName: c, formatter: l, color: u, nameKey: d, labelKey: f }) {
384
- let { config: p } = q(), m = h.useMemo(() => {
422
+ function Ot({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: o, labelFormatter: s, labelClassName: c, formatter: l, color: u, nameKey: d, labelKey: f }) {
423
+ let { config: p } = Et(), m = De(), h = _.useMemo(() => {
385
424
  if (i || !t?.length) return null;
386
- let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = dt(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
387
- return s ? /* @__PURE__ */ T("div", {
388
- className: Y("font-medium", c),
425
+ let [e] = t, n = `${f || e?.dataKey || e?.name || "value"}`, r = At(p, e, n), a = !f && typeof o == "string" ? p[o]?.label || o : r?.label;
426
+ return s ? /* @__PURE__ */ E("div", {
427
+ className: X("font-medium", c),
389
428
  children: s(a, t)
390
- }) : a ? /* @__PURE__ */ T("div", {
391
- className: Y("font-medium", c),
429
+ }) : a ? /* @__PURE__ */ E("div", {
430
+ className: X("font-medium", c),
392
431
  children: a
393
432
  }) : null;
394
433
  }, [
@@ -402,31 +441,31 @@ function lt({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
402
441
  ]);
403
442
  if (!e || !t?.length) return null;
404
443
  let ee = t.length === 1 && r !== "dot";
405
- return /* @__PURE__ */ E("div", {
406
- className: Y("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", n),
407
- children: [ee ? null : m, /* @__PURE__ */ T("div", {
444
+ return /* @__PURE__ */ D("div", {
445
+ className: X("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),
446
+ children: [ee ? null : h, /* @__PURE__ */ E("div", {
408
447
  className: "grid gap-1.5",
409
448
  children: t.filter((e) => e.type !== "none").map((e, t) => {
410
- let n = `${d || e.name || e.dataKey || "value"}`, i = dt(p, e, n), o = u || e.payload.fill || e.color;
411
- return /* @__PURE__ */ T("div", {
412
- className: Y("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", r === "dot" ? "items-center" : ""),
413
- children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ E(me, { children: [i?.icon ? /* @__PURE__ */ T(i.icon, {}) : !a && /* @__PURE__ */ T("div", {
414
- className: Y("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", r === "dot" ? "h-2.5 w-2.5" : "", r === "line" ? "w-1" : "", r === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", ee && r === "dashed" ? "my-0.5" : ""),
449
+ let n = `${d || e.name || e.dataKey || "value"}`, i = At(p, e, n), o = u || e.payload.fill || e.color;
450
+ return /* @__PURE__ */ E("div", {
451
+ className: X("[&>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" : ""),
452
+ children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ D(T, { children: [i?.icon ? /* @__PURE__ */ E(i.icon, {}) : !a && /* @__PURE__ */ E("div", {
453
+ className: X("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", r === "dot" ? "h-2.5 w-2.5" : "", r === "line" ? "w-1" : "", r === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", ee && r === "dashed" ? "my-0.5" : ""),
415
454
  style: {
416
455
  "--color-bg": o,
417
456
  "--color-border": o
418
457
  }
419
- }), /* @__PURE__ */ E("div", {
420
- className: Y("flex flex-1 justify-between leading-none", ee ? "items-end" : "items-center"),
421
- children: [/* @__PURE__ */ E("div", {
458
+ }), /* @__PURE__ */ D("div", {
459
+ className: X("flex flex-1 justify-between leading-none", ee ? "items-end" : "items-center"),
460
+ children: [/* @__PURE__ */ D("div", {
422
461
  className: "grid gap-1.5",
423
- children: [ee ? m : null, /* @__PURE__ */ T("span", {
462
+ children: [ee ? h : null, /* @__PURE__ */ E("span", {
424
463
  className: "text-muted-foreground",
425
464
  children: i?.label || e.name
426
465
  })]
427
- }), e.value && /* @__PURE__ */ T("span", {
466
+ }), e.value && /* @__PURE__ */ E("span", {
428
467
  className: "text-foreground font-mono font-medium tabular-nums",
429
- children: e.value.toLocaleString()
468
+ children: e.value.toLocaleString(m)
430
469
  })]
431
470
  })] })
432
471
  }, e.dataKey);
@@ -434,34 +473,34 @@ function lt({ active: e, payload: t, className: n, indicator: r = "dot", hideLab
434
473
  })]
435
474
  });
436
475
  }
437
- function ut({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
438
- let { config: a } = q();
439
- return n?.length ? /* @__PURE__ */ T("div", {
440
- className: Y("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
476
+ function kt({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
477
+ let { config: a } = Et();
478
+ return n?.length ? /* @__PURE__ */ E("div", {
479
+ className: X("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
441
480
  children: n.filter((e) => e.type !== "none").map((e) => {
442
- let n = `${i || e.dataKey || "value"}`, r = dt(a, e, n);
443
- return /* @__PURE__ */ E("div", {
444
- className: Y("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
445
- children: [r?.icon && !t ? /* @__PURE__ */ T(r.icon, {}) : /* @__PURE__ */ T("div", {
446
- className: "h-2 w-2 shrink-0 rounded-[2px]",
447
- style: { backgroundColor: e.color }
448
- }), r?.label]
481
+ let n = `${i || e.dataKey || "value"}`, r = At(a, e, n);
482
+ return /* @__PURE__ */ D("div", {
483
+ className: X("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
484
+ children: [r?.icon && !t ? /* @__PURE__ */ E(r.icon, {}) : /* @__PURE__ */ E("div", {
485
+ className: "h-2 w-2 shrink-0 rounded-[2px] bg-(--color-bg)",
486
+ style: { "--color-bg": e.color }
487
+ }), r?.label ?? e.value]
449
488
  }, e.value);
450
489
  })
451
490
  }) : null;
452
491
  }
453
- function dt(e, t, n) {
492
+ function At(e, t, n) {
454
493
  if (typeof t != "object" || !t) return;
455
494
  let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
456
495
  return r && n in r && typeof r[n] == "string" ? i = r[n] : n in t && typeof t[n] == "string" && (i = t[n]), i in e ? e[i] : e[n];
457
496
  }
458
- var Y, ft, pt, mt, X, Z, ht, gt = L((() => {
459
- Y = (...e) => e.filter(Boolean).join(" "), ft = {
497
+ var X, jt, Z, Mt, Nt, Pt, Ft, It = V((() => {
498
+ X = (...e) => e.filter(Boolean).join(" "), jt = {
460
499
  light: "",
461
500
  dark: ".dark"
462
- }, pt = h.createContext(null), mt = 280, X = ({ id: e, config: t }) => {
501
+ }, Z = _.createContext(null), Mt = 280, Nt = ({ id: e, config: t }) => {
463
502
  let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
464
- return n.length ? /* @__PURE__ */ T("style", { dangerouslySetInnerHTML: { __html: Object.entries(ft).map(([t, r]) => `
503
+ return n.length ? /* @__PURE__ */ E("style", { dangerouslySetInnerHTML: { __html: Object.entries(jt).map(([t, r]) => `
465
504
  ${r} [data-chart=${e}] {
466
505
  ${n.map(([e, n]) => {
467
506
  let r = n.theme?.[t] || n.color;
@@ -469,48 +508,216 @@ ${n.map(([e, n]) => {
469
508
  }).join("\n")}
470
509
  }
471
510
  `).join("\n") } }) : null;
472
- }, Z = Ie, ht = k;
511
+ }, Pt = M, Ft = Be;
473
512
  }));
474
513
  //#endregion
475
514
  //#region src/chartDrillEvents.ts
476
- function _t(e) {
515
+ function Lt(e) {
477
516
  return e?.[0]?.dataKey || "value";
478
517
  }
479
- function vt(e, t, n) {
518
+ function Rt(e, t, n) {
480
519
  if (!e) return null;
481
520
  let r = e.payload ?? e, i = r?.[t];
482
521
  if (i == null) return null;
483
- let a = _t(n);
522
+ let a = Lt(n);
484
523
  return {
485
524
  category: String(i),
486
525
  series: a,
487
526
  value: typeof r?.[a] == "number" ? r[a] : void 0
488
527
  };
489
528
  }
490
- function yt(e, t) {
529
+ function zt(e, t) {
491
530
  if (!e) return null;
492
531
  let n = e.name ?? e.payload?.name ?? e.root?.name;
493
532
  if (n == null) return null;
494
533
  let r = e.value ?? e.size ?? e.payload?.size;
495
534
  return {
496
535
  category: String(n),
497
- series: _t(t),
536
+ series: Lt(t),
498
537
  value: typeof r == "number" ? r : void 0
499
538
  };
500
539
  }
501
- function bt(e, t) {
540
+ function Bt(e, t) {
502
541
  if (!e) return null;
503
542
  let n = e.payload ?? e, r = n?.name;
504
543
  return r == null || n?.depth === 0 ? null : {
505
544
  category: String(r),
506
- series: _t(t),
545
+ series: Lt(t),
507
546
  value: typeof n?.value == "number" ? n.value : void 0
508
547
  };
509
548
  }
510
- var xt = L((() => {})), St = /* @__PURE__ */ R({ default: () => kt });
511
- function Ct(e) {
549
+ var Vt = V((() => {})), Ht = /* @__PURE__ */ ot({ default: () => Tn });
550
+ function Ut(e) {
551
+ return e === "top" ? Vn : Bn;
552
+ }
553
+ function Wt(e) {
554
+ return e === "right" ? Hn : zn;
555
+ }
556
+ function Gt(e, t) {
557
+ return e ? t ? e === "left" || e === "right" ? { down: e } : { refused: e } : e === "top" || e === "bottom" ? { across: e } : { refused: e } : {};
558
+ }
559
+ function Kt(e, t) {
560
+ return e ? /* @__PURE__ */ D("p", {
561
+ role: "note",
562
+ "data-chart-note": "x-axis-position",
563
+ className: "px-1 text-xs text-muted-foreground",
564
+ children: [
565
+ /* @__PURE__ */ E("code", {
566
+ className: "font-mono",
567
+ children: "xAxis.position"
568
+ }),
569
+ " is",
570
+ " ",
571
+ /* @__PURE__ */ E("code", {
572
+ className: "font-mono",
573
+ children: e
574
+ }),
575
+ " —",
576
+ " ",
577
+ t ? /* @__PURE__ */ E(T, { children: "this chart's categories run down its side, so its x axis sits on the left or the right. It is drawn on the left." }) : /* @__PURE__ */ E(T, { children: "this chart's x axis runs across it, so it sits at the top or the bottom. It is drawn at the bottom." })
578
+ ]
579
+ }) : null;
580
+ }
581
+ function qt(e, t) {
582
+ return t ? e === "left" ? "bottom" : "top" : e;
583
+ }
584
+ function Jt(e) {
585
+ return e === "left" || e === "right" ? `on the ${e}` : `at the ${e}`;
586
+ }
587
+ function Yt(e, t) {
588
+ return e ? t ? Gn : Wn : Un;
589
+ }
590
+ function Xt(e, t) {
591
+ if (e.notes.length === 0) return null;
592
+ let n = t ? "this chart's value axes run across it, so each sits at the bottom or the top." : "this chart's value axes run up its side, so each sits on the left or the right.";
593
+ return Qt(...e.notes.map((e) => {
594
+ let r = Jt(qt(e.drawn, t));
595
+ return /* @__PURE__ */ D("p", {
596
+ role: "note",
597
+ "data-chart-note": "y-axis-position",
598
+ className: "px-1 text-xs text-muted-foreground",
599
+ children: [
600
+ /* @__PURE__ */ E("code", {
601
+ className: "font-mono",
602
+ children: `yAxis[${e.index}].position`
603
+ }),
604
+ " is",
605
+ " ",
606
+ /* @__PURE__ */ E("code", {
607
+ className: "font-mono",
608
+ children: e.position
609
+ }),
610
+ " —",
611
+ " ",
612
+ e.reason === "side" ? /* @__PURE__ */ D(T, { children: [
613
+ n,
614
+ " It is drawn ",
615
+ r,
616
+ "."
617
+ ] }) : /* @__PURE__ */ D(T, { children: [
618
+ /* @__PURE__ */ E("code", {
619
+ className: "font-mono",
620
+ children: "yAxis[0]"
621
+ }),
622
+ " already sits ",
623
+ Jt(e.position),
624
+ ", so this axis is drawn ",
625
+ r,
626
+ "."
627
+ ] })
628
+ ]
629
+ }, e.index);
630
+ }));
631
+ }
632
+ function Zt(e, t, n) {
633
+ if (e.undrawn.length === 0) return null;
634
+ let r = e.slotOf.length === 1, i = n ? "one at the bottom and one at the top" : "one on each side";
635
+ return Qt(...e.undrawn.map((a) => {
636
+ let o = e[a.boundTo];
637
+ if (r) return /* @__PURE__ */ D("p", {
638
+ role: "note",
639
+ "data-chart-note": "y-axis-undrawn",
640
+ className: "px-1 text-xs text-muted-foreground",
641
+ children: [
642
+ /* @__PURE__ */ E("code", {
643
+ className: "font-mono",
644
+ children: `yAxis[${a.index}]`
645
+ }),
646
+ " is not drawn — this chart draws one value axis",
647
+ o === void 0 ? null : /* @__PURE__ */ D(T, { children: [", ", /* @__PURE__ */ E("code", {
648
+ className: "font-mono",
649
+ children: `yAxis[${o}]`
650
+ })] }),
651
+ "."
652
+ ]
653
+ }, a.index);
654
+ let s = t?.[a.index]?.field;
655
+ return /* @__PURE__ */ D("p", {
656
+ role: "note",
657
+ "data-chart-note": "y-axis-undrawn",
658
+ className: "px-1 text-xs text-muted-foreground",
659
+ children: [
660
+ /* @__PURE__ */ E("code", {
661
+ className: "font-mono",
662
+ children: `yAxis[${a.index}]`
663
+ }),
664
+ " is not drawn — this chart draws at most two value axes, ",
665
+ i,
666
+ ".",
667
+ s ? /* @__PURE__ */ D(T, { children: [
668
+ " ",
669
+ "When the chart declares neither ",
670
+ /* @__PURE__ */ E("code", {
671
+ className: "font-mono",
672
+ children: "series"
673
+ }),
674
+ " nor",
675
+ " ",
676
+ /* @__PURE__ */ E("code", {
677
+ className: "font-mono",
678
+ children: "categories"
679
+ }),
680
+ ", its field ",
681
+ /* @__PURE__ */ E("code", {
682
+ className: "font-mono",
683
+ children: s
684
+ }),
685
+ " is plotted against the axis ",
686
+ Jt(qt(a.boundTo, n)),
687
+ o === void 0 ? null : /* @__PURE__ */ D(T, { children: [", ", /* @__PURE__ */ E("code", {
688
+ className: "font-mono",
689
+ children: `yAxis[${o}]`
690
+ })] }),
691
+ "."
692
+ ] }) : null
693
+ ]
694
+ }, a.index);
695
+ }));
696
+ }
697
+ function Qt(...e) {
698
+ let t = e.filter((e) => e != null && e !== !1);
699
+ return t.length <= 1 ? t[0] ?? null : /* @__PURE__ */ E(T, { children: t.map((e, t) => /* @__PURE__ */ E(_.Fragment, { children: e }, t)) });
700
+ }
701
+ function $t(e, t, n) {
702
+ if (!e) return {};
703
+ let r = G(e), i = pt(e, t);
704
+ return {
705
+ ...i ? { ticks: i } : {},
706
+ ...r ? { domain: r } : {},
707
+ ...r ? { allowDataOverflow: !0 } : {},
708
+ ...e.logarithmic ? {
709
+ scale: "log",
710
+ domain: r ?? [1, "auto"]
711
+ } : {},
712
+ ...e.title ? { label: {
713
+ value: e.title,
714
+ ...n
715
+ } } : {}
716
+ };
717
+ }
718
+ function en(e) {
512
719
  let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
513
- return r <= 0 || i <= 0 ? null : /* @__PURE__ */ E("g", { children: [/* @__PURE__ */ T("rect", {
720
+ return r <= 0 || i <= 0 ? null : /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("rect", {
514
721
  x: t,
515
722
  y: n,
516
723
  width: r,
@@ -518,7 +725,7 @@ function Ct(e) {
518
725
  fill: o,
519
726
  stroke: "hsl(var(--background))",
520
727
  strokeWidth: 2
521
- }), r > 48 && i > 18 ? /* @__PURE__ */ T("text", {
728
+ }), r > 48 && i > 18 ? /* @__PURE__ */ E("text", {
522
729
  x: t + 6,
523
730
  y: n + 18,
524
731
  fill: "#fff",
@@ -527,455 +734,715 @@ function Ct(e) {
527
734
  children: a
528
735
  }) : null] });
529
736
  }
530
- function wt({ title: e, subtitle: t, children: n }) {
531
- return !e && !t ? /* @__PURE__ */ T(me, { children: n }) : /* @__PURE__ */ E("div", {
737
+ function tn({ title: e, subtitle: t, children: n }) {
738
+ return !e && !t ? /* @__PURE__ */ E(T, { children: n }) : /* @__PURE__ */ D("div", {
532
739
  className: "flex h-full w-full flex-col",
533
- children: [/* @__PURE__ */ E("div", {
740
+ children: [/* @__PURE__ */ D("div", {
534
741
  className: "mb-2 shrink-0",
535
- children: [e ? /* @__PURE__ */ T("div", {
742
+ children: [e ? /* @__PURE__ */ E("div", {
536
743
  className: "text-sm font-medium leading-tight text-foreground",
537
744
  children: e
538
- }) : null, t ? /* @__PURE__ */ T("div", {
745
+ }) : null, t ? /* @__PURE__ */ E("div", {
539
746
  className: "text-xs leading-tight text-muted-foreground",
540
747
  children: t
541
748
  }) : null]
542
- }), /* @__PURE__ */ T("div", {
749
+ }), /* @__PURE__ */ E("div", {
543
750
  className: "min-h-0 flex-1",
544
751
  children: n
545
752
  })]
546
753
  });
547
754
  }
548
- function Tt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: a = "name", series: o = [], className: s = "", colors: c, categoryColors: l, categoryOrder: u, onChartClick: d, isAnimationActive: f, xAxis: p, yAxes: m, showLegend: ee, showDataLabels: te, title: ne, subtitle: re, description: g, height: _, annotations: ie, interaction: ae }) {
549
- let oe = e === "column" ? "bar" : e, v = Ye(oe, o), y = Je(oe), b = Array.isArray(n) ? n : [], x = f === !1 ? { isAnimationActive: !1 } : {}, S = {
755
+ function nn({ note: e, children: t }) {
756
+ return e ? /* @__PURE__ */ D("div", {
757
+ className: "flex h-full w-full flex-col",
758
+ children: [/* @__PURE__ */ E("div", {
759
+ className: "min-h-0 flex-1",
760
+ children: t
761
+ }), /* @__PURE__ */ E("div", {
762
+ className: "mt-1 shrink-0",
763
+ children: e
764
+ })]
765
+ }) : /* @__PURE__ */ E(T, { children: t });
766
+ }
767
+ function rn(e, t) {
768
+ let n = 0;
769
+ for (let r of e) {
770
+ let e = Number(r?.[t]);
771
+ Number.isFinite(e) && e > 0 && (n += 1);
772
+ }
773
+ return {
774
+ sizable: n,
775
+ total: e.length
776
+ };
777
+ }
778
+ function an({ dataKey: e, className: t }) {
779
+ return /* @__PURE__ */ D(Q, {
780
+ code: "no-positive-magnitude",
781
+ className: t,
782
+ children: [
783
+ "This chart has nothing to size: no row's",
784
+ " ",
785
+ /* @__PURE__ */ E("code", {
786
+ className: "font-mono",
787
+ children: e
788
+ }),
789
+ " is above zero."
790
+ ]
791
+ });
792
+ }
793
+ function on(e, t, n) {
794
+ let r = t - e;
795
+ return r <= 0 ? null : /* @__PURE__ */ D("p", {
796
+ role: "note",
797
+ "data-chart-note": "unsized-rows",
798
+ className: "px-1 text-xs text-muted-foreground",
799
+ children: [
800
+ r,
801
+ " of ",
802
+ t,
803
+ " rows ",
804
+ r === 1 ? "has" : "have",
805
+ " no",
806
+ " ",
807
+ /* @__PURE__ */ E("code", {
808
+ className: "font-mono",
809
+ children: n
810
+ }),
811
+ " above zero — this chart sizes by value, so",
812
+ " ",
813
+ r === 1 ? "that row is" : "those rows are",
814
+ " not drawn to scale."
815
+ ]
816
+ });
817
+ }
818
+ function sn(e) {
819
+ return e != null && Number.isFinite(Number(e));
820
+ }
821
+ function cn(e, t, n) {
822
+ let r = 0;
823
+ for (let i of e) {
824
+ let e = i;
825
+ sn(e?.[t]) && sn(e?.[n]) && (r += 1);
826
+ }
827
+ return {
828
+ plottable: r,
829
+ total: e.length
830
+ };
831
+ }
832
+ function ln({ xKey: e, yKey: t, className: n }) {
833
+ return /* @__PURE__ */ D(Q, {
834
+ code: "no-plottable-points",
835
+ className: n,
836
+ children: [
837
+ "This chart has nothing to place: no row carries a number for both",
838
+ " ",
839
+ /* @__PURE__ */ E("code", {
840
+ className: "font-mono",
841
+ children: e
842
+ }),
843
+ " and",
844
+ " ",
845
+ /* @__PURE__ */ E("code", {
846
+ className: "font-mono",
847
+ children: t
848
+ }),
849
+ "."
850
+ ]
851
+ });
852
+ }
853
+ function un(e) {
854
+ return typeof e == "boolean" ? !1 : Array.isArray(e) ? dn(e[0]) && dn(e[1]) : dn(e);
855
+ }
856
+ function dn(e) {
857
+ return typeof e == "number" || e instanceof Number || typeof e == "string" || e instanceof Date ? Number.isFinite(Number(e)) : !1;
858
+ }
859
+ function fn(e) {
860
+ let t = (e) => typeof e == "number" && Number.isFinite(e);
861
+ return t(e?.min) && t(e?.max) || t(e?.stepSize);
862
+ }
863
+ function pn(e, t) {
864
+ return e.some((e) => un(e?.[t]));
865
+ }
866
+ function mn(e, t, n) {
867
+ let r = t[n];
868
+ if (!r?.stack) return "none";
869
+ let i = ft(e, t), a = i === "combo" ? r.chartType || dt(e) || (n === 0 ? "bar" : "line") : i;
870
+ return a === "line" ? "none" : a === "area" ? "area" : "bar";
871
+ }
872
+ function hn({ keys: e, total: t, className: n }) {
873
+ return /* @__PURE__ */ D(Q, {
874
+ code: "no-numeric-value",
875
+ className: n,
876
+ children: [
877
+ "This chart has no scale to draw on:",
878
+ " ",
879
+ t === 1 ? "its only row has no" : `none of the ${t} rows has a`,
880
+ " numeric value for",
881
+ " ",
882
+ e.map((e, t) => /* @__PURE__ */ D(_.Fragment, { children: [t > 0 ? " or " : "", /* @__PURE__ */ E("code", {
883
+ className: "font-mono",
884
+ children: e
885
+ })] }, `${t}-${e}`)),
886
+ "."
887
+ ]
888
+ });
889
+ }
890
+ function gn({ seriesKeys: e, className: t }) {
891
+ let n = Ae();
892
+ return /* @__PURE__ */ D(Q, {
893
+ code: "scatter-multi-series",
894
+ className: t,
895
+ children: [
896
+ n("chart.scatterOneMeasure", "A scatter plots one measure. Keep exactly one series:"),
897
+ " ",
898
+ e.map((e, t) => /* @__PURE__ */ D(_.Fragment, { children: [t > 0 ? ", " : "", /* @__PURE__ */ E("code", {
899
+ className: "font-mono",
900
+ children: e
901
+ })] }, `${t}-${e}`))
902
+ ]
903
+ });
904
+ }
905
+ function _n(e, t, n, r) {
906
+ let i = t - e;
907
+ return i <= 0 ? null : /* @__PURE__ */ D("p", {
908
+ role: "note",
909
+ "data-chart-note": "unplotted-points",
910
+ className: "px-1 text-xs text-muted-foreground",
911
+ children: [
912
+ i,
913
+ " of ",
914
+ t,
915
+ " rows ",
916
+ i === 1 ? "has" : "have",
917
+ " no number for both",
918
+ " ",
919
+ /* @__PURE__ */ E("code", {
920
+ className: "font-mono",
921
+ children: n
922
+ }),
923
+ " and",
924
+ " ",
925
+ /* @__PURE__ */ E("code", {
926
+ className: "font-mono",
927
+ children: r
928
+ }),
929
+ " — this chart plots by position, so",
930
+ " ",
931
+ i === 1 ? "that point is" : "those points are",
932
+ " not drawn."
933
+ ]
934
+ });
935
+ }
936
+ function vn({ chartType: e, data: t = [], config: r = {}, xAxisKey: i = "name", series: a = [], className: s = "", colors: c, categoryColors: l, categoryOrder: u, onChartClick: d, isAnimationActive: f, xAxis: p, yAxes: m, showLegend: h, showDataLabels: ee, title: ne, subtitle: re, description: ie, height: ae, annotations: oe, interaction: se }) {
937
+ let ce = e === "column" ? "bar" : e, g = ft(ce, a), le = dt(ce), v = Array.isArray(t) ? t : [], y = De(), b = f === !1 ? { isAnimationActive: !1 } : {}, x = {
550
938
  ...f === !1 ? { disableSettleRemount: !0 } : {},
551
- ..._ ? { style: { height: _ } } : {},
552
- ...g ? {
939
+ ...ae ? { style: { height: ae } } : {},
940
+ ...ie ? {
553
941
  role: "img",
554
- "aria-label": g
942
+ "aria-label": ie
555
943
  } : {}
556
- }, [C, se] = h.useState(!1), ce = h.useRef(null), le = h.useCallback((e) => (...t) => {
557
- let n = Ft(t);
558
- n !== void 0 && (ce.current = {
944
+ }, [S, C] = _.useState(!1), w = _.useRef(null), fe = _.useCallback((e) => (...t) => {
945
+ let n = jn(t);
946
+ n !== void 0 && (w.current = {
559
947
  gesture: n,
560
948
  dataKey: String(e.dataKey)
561
949
  });
562
- }, []), ue = d ? (e) => ({ onClick: le(e) }) : () => ({}), de = h.useCallback((e, t, n) => {
950
+ }, []), pe = d ? (e) => ({ onClick: fe(e) }) : () => ({}), me = _.useCallback((e, t, n) => {
563
951
  if (!d || !e) return;
564
- let r = e.activeTooltipIndex ?? e.activeIndex, a = r == null ? NaN : Number(r), s = Number.isInteger(a) && a >= 0 ? b[a] : void 0, c = ce.current;
565
- ce.current = null;
566
- let l = Pt(t), u = c != null && l !== void 0 && c.gesture === l;
952
+ let r = e.activeTooltipIndex ?? e.activeIndex, i = r == null ? NaN : Number(r), s = Number.isInteger(i) && i >= 0 ? v[i] : void 0, c = w.current;
953
+ w.current = null;
954
+ let l = An(t), u = c != null && l !== void 0 && c.gesture === l;
567
955
  if (n && !u) return;
568
- let f = u ? c.dataKey : Nt(e.activeDataKey, o), p = f != null && s ? s[f] : void 0;
956
+ let f = u ? c.dataKey : kn(e.activeDataKey, a), p = f != null && s ? s[f] : void 0;
569
957
  d({
570
958
  category: e.activeLabel == null ? void 0 : String(e.activeLabel),
571
- categoryId: i(s),
959
+ categoryId: o(s),
572
960
  series: f,
573
- seriesLabel: It(f, o),
961
+ seriesLabel: Mn(f, a),
574
962
  value: typeof p == "number" ? p : void 0
575
963
  });
576
964
  }, [
577
965
  d,
578
- b,
579
- o
580
- ]), fe = h.useCallback((e, t) => {
581
- de(e, t, !1);
582
- }, [de]), pe = h.useCallback((e, t) => {
583
- de(e, t, !0);
584
- }, [de]), w = h.useCallback((e) => {
966
+ v,
967
+ a
968
+ ]), he = _.useCallback((e, t) => {
969
+ me(e, t, !1);
970
+ }, [me]), ge = _.useCallback((e, t) => {
971
+ me(e, t, !0);
972
+ }, [me]), _e = _.useCallback((e) => {
585
973
  if (!d || !e) return;
586
- let t = e.payload?.[a], n = o[0]?.dataKey || "value";
974
+ let t = e.payload?.[i], n = a[0]?.dataKey || "value";
587
975
  d({
588
976
  category: t == null ? void 0 : String(t),
589
- categoryId: i(e.payload),
977
+ categoryId: o(e.payload),
590
978
  series: n,
591
- seriesLabel: It(n, o),
979
+ seriesLabel: Mn(n, a),
592
980
  value: typeof e.payload?.[n] == "number" ? e.payload[n] : void 0
593
981
  });
594
982
  }, [
595
983
  d,
596
- a,
597
- o
598
- ]), k = d ? {
599
- onClick: fe,
984
+ i,
985
+ a
986
+ ]), ve = d ? {
987
+ onClick: he,
600
988
  style: { cursor: "pointer" }
601
- } : {}, Fe = d ? { onClick: pe } : {}, F = d ? (e) => ({
602
- ...ue(e),
989
+ } : {}, ye = d ? { onClick: ge } : {}, be = d ? (e) => ({
990
+ ...pe(e),
603
991
  cursor: "pointer"
604
- }) : () => ({}), ze = d ? {
605
- onClick: w,
992
+ }) : () => ({}), xe = d ? {
993
+ onClick: _e,
606
994
  style: { cursor: "pointer" }
607
- } : {}, Be = h.useCallback((e, t, n) => l && l[e == null ? "" : String(e)] || n[t % n.length], [l]), Ve = h.useCallback((e) => {
995
+ } : {}, Se = _.useCallback((e, t, n) => l && l[e == null ? "" : String(e)] || n[t % n.length], [l]), Ce = _.useCallback((e) => {
608
996
  if (!d) return;
609
- let t = vt(e, a, o);
997
+ let t = Rt(e, i, a);
610
998
  t && d(t);
611
999
  }, [
612
1000
  d,
613
- a,
614
- o
615
- ]), He = h.useCallback((e) => {
1001
+ i,
1002
+ a
1003
+ ]), we = _.useCallback((e) => {
616
1004
  if (!d) return;
617
- let t = yt(e, o);
1005
+ let t = zt(e, a);
618
1006
  t && d(t);
619
- }, [d, o]), Ue = h.useCallback((e) => {
1007
+ }, [d, a]), Te = _.useCallback((e) => {
620
1008
  if (!d) return;
621
- let t = bt(e, o);
1009
+ let t = Bt(e, a);
622
1010
  t && d(t);
623
- }, [d, o]), We = d ? {
624
- onClick: Ve,
1011
+ }, [d, a]), Ee = d ? {
1012
+ onClick: Ce,
625
1013
  cursor: "pointer"
626
- } : {}, Ge = d ? {
627
- onClick: He,
1014
+ } : {}, Oe = d ? {
1015
+ onClick: we,
628
1016
  style: { cursor: "pointer" }
629
- } : {}, Ke = d ? {
630
- onClick: Ue,
1017
+ } : {}, ke = d ? {
1018
+ onClick: Te,
631
1019
  style: { cursor: "pointer" }
632
1020
  } : {};
633
- h.useEffect(() => {
634
- let e = () => se(window.innerWidth < 640);
1021
+ _.useEffect(() => {
1022
+ let e = () => C(window.innerWidth < 640);
635
1023
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
636
1024
  }, []);
637
- let qe = {
638
- bar: D,
639
- "horizontal-bar": D,
640
- line: Te,
641
- area: ge,
642
- pie: De,
643
- donut: De,
644
- radar: Me,
645
- scatter: M,
646
- funnel: Se,
647
- combo: O,
648
- treemap: D,
649
- sankey: D
650
- }[v] || D, I = h.useCallback((e) => {
1025
+ let Ae = _.useCallback((e) => {
651
1026
  if (e == null || e === "") return "";
652
1027
  let t = r?.[String(e)]?.label;
653
1028
  if (t != null) return String(t);
654
1029
  let n = typeof e == "string" ? e : String(e);
655
1030
  if (/^\d{4}-\d{2}-\d{2}/.test(n)) {
656
- let e = new Date(n);
1031
+ let e = de(n);
657
1032
  if (!Number.isNaN(e.getTime())) {
658
- let t = (b.length > 1 ? Math.abs(new Date(String(b[b.length - 1][a] ?? "")).getTime() - new Date(String(b[0][a] ?? "")).getTime()) : 0) / 864e5;
1033
+ let t = (v.length > 1 ? Math.abs(new Date(String(v[v.length - 1][i] ?? "")).getTime() - new Date(String(v[0][i] ?? "")).getTime()) : 0) / 864e5;
659
1034
  try {
660
- return t <= 62 ? e.toLocaleDateString(void 0, {
1035
+ return t <= 62 ? e.toLocaleDateString(y, {
661
1036
  month: "short",
662
1037
  day: "numeric"
663
- }) : e.toLocaleDateString(void 0, {
1038
+ }) : e.toLocaleDateString(y, {
664
1039
  month: "short",
665
1040
  year: "numeric"
666
1041
  });
667
1042
  } catch {
668
- return e.toISOString().slice(0, 10);
1043
+ return te(n) ? ue(e) : e.toISOString().slice(0, 10);
669
1044
  }
670
1045
  }
671
1046
  }
672
- return C && n.length > 8 ? n.slice(0, 8) + "…" : n;
1047
+ return S && n.length > 8 ? n.slice(0, 8) + "…" : n;
673
1048
  }, [
674
- b,
675
- a,
676
- C,
677
- r
678
- ]), L = h.useMemo(() => b.some((e) => String(e[a] || "").length > 5), [b, a]), R = () => Array.isArray(c) && c.length > 0 ? c : [
1049
+ v,
1050
+ i,
1051
+ S,
1052
+ r,
1053
+ y
1054
+ ]), Be = _.useMemo(() => v.some((e) => String(e[i] || "").length > 5), [v, i]), Qe = v.length > 0 && v.length <= Pn, tt = (Qe || !S) && Be, nt = () => Array.isArray(c) && c.length > 0 ? c : [
679
1055
  "hsl(var(--chart-1))",
680
1056
  "hsl(var(--chart-2))",
681
1057
  "hsl(var(--chart-3))",
682
1058
  "hsl(var(--chart-4))",
683
1059
  "hsl(var(--chart-5))"
684
- ], z = h.useCallback((e) => {
1060
+ ], rt = _.useCallback((e) => {
685
1061
  if (e == null || e === "") return "";
686
1062
  let t = typeof e == "number" ? e : Number(e);
687
1063
  if (!Number.isFinite(t)) return String(e);
688
1064
  try {
689
- return new Intl.NumberFormat(void 0, {
1065
+ return new Intl.NumberFormat(y, {
690
1066
  notation: "compact",
691
1067
  maximumFractionDigits: 1
692
1068
  }).format(t);
693
1069
  } catch {
694
1070
  return String(t);
695
1071
  }
696
- }, []), B = m?.[0], V = m && m.length > 1 ? m[1] : B?.position === "right" ? B : void 0, H = !!m && m.length > 1, nt = h.useMemo(() => Xe(p?.format) ?? I, [p?.format, I]), U = h.useMemo(() => Xe(B?.format) ?? z, [B?.format, z]), W = h.useMemo(() => Xe(V?.format) ?? z, [V?.format, z]), G = h.useCallback((e) => {
697
- let t = o.filter((t) => H ? (t.yAxis === "right" ? "right" : "left") === e : e === "left").map((e) => e.dataKey), n = [];
698
- for (let e of b) for (let r of t) {
1072
+ }, [y]), F = m?.[0], I = g === "horizontal-bar", L = lt(m, g), R = L.left === void 0 ? void 0 : m?.[L.left], z = L.right === void 0 ? void 0 : m?.[L.right], it = !!R && !!z, at = g === "combo" || it, B = L.slotOf[0] ?? "left", V = Qt(Xt(L, I), Zt(L, m, I)), ot = (e) => it ? e.yAxis === "right" ? z : R : F, H = _.useMemo(() => W(p?.format, y) ?? Ae, [
1073
+ p?.format,
1074
+ y,
1075
+ Ae
1076
+ ]), U = _.useMemo(() => !Qe || !tt ? H : (e) => {
1077
+ let t = String(H(e) ?? "");
1078
+ return t.length > Fn ? `${t.slice(0, 11)}…` : t;
1079
+ }, [
1080
+ Qe,
1081
+ tt,
1082
+ H
1083
+ ]), st = _.useMemo(() => W(F?.format, y) ?? rt, [
1084
+ F?.format,
1085
+ y,
1086
+ rt
1087
+ ]), ct = _.useMemo(() => W(R?.format, y) ?? rt, [
1088
+ R?.format,
1089
+ y,
1090
+ rt
1091
+ ]), ut = _.useMemo(() => W(z?.format, y) ?? rt, [
1092
+ z?.format,
1093
+ y,
1094
+ rt
1095
+ ]), pt = _.useCallback((e) => {
1096
+ let t = a.filter((t) => !it || (t.yAxis === "right" ? "right" : "left") === e).map((e) => e.dataKey), n = [];
1097
+ for (let e of v) for (let r of t) {
699
1098
  let t = Number(e?.[r]);
700
1099
  Number.isFinite(t) && n.push(t);
701
1100
  }
702
1101
  return n;
703
1102
  }, [
704
- b,
705
- o,
706
- H
707
- ]), K = h.useCallback((e, t = "left") => {
708
- if (!e) return {};
709
- let n = Qe(e), r = Ze(e, G(t));
710
- return {
711
- ...r ? { ticks: r } : {},
712
- ...n ? { domain: n } : {},
713
- ...n ? { allowDataOverflow: !0 } : {},
714
- ...e.logarithmic ? {
715
- scale: "log",
716
- domain: n ?? [1, "auto"]
717
- } : {},
718
- ...e.title ? { label: {
719
- value: e.title,
720
- angle: -90,
721
- position: "insideLeft"
722
- } } : {}
723
- };
724
- }, [G]), rt = B?.showGridLines !== !1, it = {
1103
+ v,
1104
+ a,
1105
+ it
1106
+ ]), G = _.useCallback((e, t = "left", n) => $t(e, pt(t), n ?? Wt(t)), [pt]), _t = F?.showGridLines !== !1, vt = {
725
1107
  vertical: p?.showGridLines === !0,
726
- horizontal: rt
727
- }, at = ee !== !1, ot = h.useMemo(() => {
728
- if (!Array.isArray(ie) || ie.length === 0) return null;
1108
+ horizontal: _t
1109
+ }, { across: K, down: q, refused: J } = Gt(p?.position, I), Y = Kt(J, I), yt = h !== !1, bt = _.useMemo(() => {
1110
+ if (!Array.isArray(oe) || oe.length === 0) return null;
729
1111
  let e = {
730
1112
  solid: void 0,
731
1113
  dashed: "4 4",
732
1114
  dotted: "1 4"
733
- };
734
- return ie.map((t, n) => {
735
- let r = t?.axis === "x", i = Q(String(t?.color || "hsl(var(--muted-foreground))")), a = e[String(t?.style ?? "dashed")], o = typeof t?.label == "string" ? t.label : void 0, s = o ? { label: {
736
- value: o,
1115
+ }, t = Yt(at, I);
1116
+ return oe.map((n, r) => {
1117
+ let i = n?.axis === "x", a = $(String(n?.color || "hsl(var(--muted-foreground))")), o = e[String(n?.style ?? "dashed")], s = typeof n?.label == "string" ? n.label : void 0, c = s ? { label: {
1118
+ value: s,
737
1119
  position: "insideTopRight",
738
- fill: i,
1120
+ fill: a,
739
1121
  fontSize: 11
740
1122
  } } : {};
741
- if (t?.type === "region") {
742
- let e = r ? {
743
- x1: t.value,
744
- x2: t.endValue
1123
+ if (n?.type === "region") {
1124
+ let e = i ? {
1125
+ x1: n.value,
1126
+ x2: n.endValue
745
1127
  } : {
746
- y1: t.value,
747
- y2: t.endValue
1128
+ y1: n.value,
1129
+ y2: n.endValue
748
1130
  };
749
- return /* @__PURE__ */ T(Ne, {
1131
+ return /* @__PURE__ */ E(Xe, {
750
1132
  ...e,
751
- ...H && !r ? { yAxisId: "left" } : {},
752
- fill: i,
1133
+ ...t,
1134
+ fill: a,
753
1135
  fillOpacity: .12,
754
- stroke: i,
1136
+ stroke: a,
755
1137
  strokeOpacity: .35,
756
- ...s
757
- }, `ann-${n}`);
1138
+ ...c
1139
+ }, `ann-${r}`);
758
1140
  }
759
- return /* @__PURE__ */ T(Pe, {
760
- ...r ? { x: t?.value } : { y: t?.value },
761
- ...H && !r ? { yAxisId: "left" } : {},
762
- stroke: i,
763
- strokeDasharray: a,
764
- ...s
765
- }, `ann-${n}`);
1141
+ return /* @__PURE__ */ E(Ze, {
1142
+ ...i ? { x: n?.value } : { y: n?.value },
1143
+ ...t,
1144
+ stroke: a,
1145
+ strokeDasharray: o,
1146
+ ...c
1147
+ }, `ann-${r}`);
766
1148
  });
767
- }, [ie, H]), st = ae?.tooltips !== !1, ct = ae?.brush === !0 ? /* @__PURE__ */ T(ve, {
768
- dataKey: a,
1149
+ }, [
1150
+ oe,
1151
+ at,
1152
+ I
1153
+ ]), xt = se?.tooltips !== !1, St = se?.brush === !0 ? /* @__PURE__ */ E(Fe, {
1154
+ dataKey: i,
769
1155
  height: 24,
770
1156
  travellerWidth: 8,
771
1157
  stroke: "hsl(var(--muted-foreground))"
772
- }) : null, q = (e) => te ? /* @__PURE__ */ T(Ce, {
1158
+ }) : null, Ct = (e) => ee ? /* @__PURE__ */ E(ze, {
773
1159
  position: "top",
774
1160
  className: "fill-foreground",
775
1161
  fontSize: 11,
776
1162
  ...e ? { formatter: e } : {}
777
- }) : null, dt = h.useMemo(() => ({
1163
+ }) : null, wt = _.useMemo(() => ({
778
1164
  tickLine: !1,
779
1165
  tickMargin: 10,
780
1166
  axisLine: !1,
781
- interval: "preserveStartEnd",
782
- minTickGap: C ? 32 : 48,
783
- tickFormatter: nt,
1167
+ ...Qe ? { interval: 0 } : {
1168
+ interval: "preserveStartEnd",
1169
+ minTickGap: 0
1170
+ },
1171
+ tickFormatter: U,
1172
+ ...K ? { orientation: K } : {},
784
1173
  ...p?.title ? { label: {
785
1174
  value: p.title,
786
- position: "insideBottom",
787
- offset: -4
1175
+ ...Ut(K)
788
1176
  } } : {},
789
- ...!C && L && {
790
- angle: -35,
1177
+ ...tt && {
1178
+ angle: K === "top" ? 35 : -35,
791
1179
  textAnchor: "end",
792
1180
  height: 60
793
1181
  }
794
1182
  }), [
795
- C,
796
- L,
797
- nt,
798
- p?.title
1183
+ Qe,
1184
+ tt,
1185
+ U,
1186
+ p?.title,
1187
+ K
799
1188
  ]);
800
- if (v && et.has(v)) {
801
- let e = o[0]?.dataKey || "value", t = b[0]?.[e], n = typeof t == "number" ? t : Number(t), i = o[0]?.label ?? r?.[e]?.label ?? e;
802
- return /* @__PURE__ */ T("div", {
1189
+ if (g && ht.has(g)) {
1190
+ let e = a[0]?.dataKey || "value", t = v[0]?.[e], n = typeof t == "number" ? t : Number(t), i = a[0]?.label ?? r?.[e]?.label ?? e;
1191
+ return /* @__PURE__ */ E("div", {
803
1192
  className: s,
804
1193
  "data-testid": "advanced-chart-single-value",
805
- children: /* @__PURE__ */ E("div", {
1194
+ children: /* @__PURE__ */ D("div", {
806
1195
  className: "flex flex-col gap-1 py-4",
807
- children: [/* @__PURE__ */ T("span", {
1196
+ children: [/* @__PURE__ */ E("span", {
808
1197
  className: "text-3xl font-semibold tabular-nums",
809
- children: Number.isFinite(n) ? new Intl.NumberFormat().format(n) : String(t ?? "—")
810
- }), /* @__PURE__ */ T("span", {
1198
+ children: Number.isFinite(n) ? new Intl.NumberFormat(y).format(n) : String(t ?? "—")
1199
+ }), /* @__PURE__ */ E("span", {
811
1200
  className: "text-xs text-muted-foreground",
812
1201
  children: String(i)
813
1202
  })]
814
1203
  })
815
1204
  });
816
1205
  }
817
- if (v && tt.has(v)) return /* @__PURE__ */ E("div", {
1206
+ if (g && gt.has(g)) return /* @__PURE__ */ D("div", {
818
1207
  className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${s ?? ""}`,
819
1208
  "data-testid": "advanced-chart-tabular-notice",
820
1209
  role: "note",
821
1210
  children: [
822
1211
  "Chart type “",
823
- v,
1212
+ g,
824
1213
  "” is tabular — render it with the data-table / pivot components; a chart block draws series charts."
825
1214
  ]
826
1215
  });
827
- if (v && !$e.has(v)) return /* @__PURE__ */ E("div", {
1216
+ if (!g || !mt.has(g)) return /* @__PURE__ */ E("div", {
828
1217
  className: `rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground ${s ?? ""}`,
829
1218
  "data-testid": "advanced-chart-unknown-type",
830
1219
  role: "note",
831
- children: [
1220
+ children: g ? /* @__PURE__ */ D(T, { children: [
832
1221
  "Chart type “",
833
- v,
1222
+ g,
834
1223
  "” is not a spec chart type — nothing was drawn."
835
- ]
1224
+ ] }) : /* @__PURE__ */ E(T, { children: "This chart names no chart type — nothing was drawn." })
836
1225
  });
837
- if (v === "pie" || v === "donut") {
838
- let e = v === "donut" ? "52%" : 0, t = R(), n = { ...r };
839
- return b.forEach((e, r) => {
840
- let i = e?.[a];
841
- if (i == null || i === "") return;
842
- let o = String(i);
843
- n[o] || (n[o] = {
844
- label: o,
845
- color: Be(i, r, t)
1226
+ let Tt = {
1227
+ bar: Pe,
1228
+ "horizontal-bar": Pe,
1229
+ line: He,
1230
+ area: Me,
1231
+ pie: We,
1232
+ donut: We,
1233
+ radar: Ye,
1234
+ scatter: j,
1235
+ funnel: k,
1236
+ combo: Le,
1237
+ treemap: Pe,
1238
+ sankey: Pe
1239
+ }[g] || Pe;
1240
+ if (g === "pie" || g === "donut") {
1241
+ let e = g === "donut" ? "52%" : 0, t = nt(), n = a[0]?.dataKey || "value", o = rn(v, n);
1242
+ if (o.total > 0 && o.sizable === 0) return /* @__PURE__ */ E(an, {
1243
+ dataKey: n,
1244
+ className: s
1245
+ });
1246
+ let c = { ...r };
1247
+ v.forEach((e, n) => {
1248
+ let r = e?.[i];
1249
+ if (r == null || r === "") return;
1250
+ let a = String(r);
1251
+ c[a] || (c[a] = {
1252
+ label: a,
1253
+ color: Se(r, n, t)
846
1254
  });
847
- }), /* @__PURE__ */ T(J, {
848
- config: n,
1255
+ });
1256
+ let l = /* @__PURE__ */ E(Dt, {
1257
+ config: c,
849
1258
  className: s,
850
- ...S,
851
- children: /* @__PURE__ */ E(De, { children: [
852
- /* @__PURE__ */ T(Z, {
1259
+ ...x,
1260
+ children: /* @__PURE__ */ D(We, { children: [
1261
+ /* @__PURE__ */ E(Pt, {
853
1262
  cursor: !1,
854
- content: /* @__PURE__ */ T(lt, { hideLabel: !0 })
1263
+ content: /* @__PURE__ */ E(Ot, { hideLabel: !0 })
855
1264
  }),
856
- /* @__PURE__ */ T(Ee, {
857
- data: b,
858
- dataKey: o[0]?.dataKey || "value",
859
- nameKey: a || "name",
1265
+ /* @__PURE__ */ E(Ue, {
1266
+ data: v,
1267
+ dataKey: n,
1268
+ nameKey: i || "name",
860
1269
  innerRadius: e,
861
1270
  strokeWidth: 5,
862
1271
  paddingAngle: 2,
863
1272
  outerRadius: "85%",
864
- ...x,
865
- ...ze,
866
- children: b.map((e, n) => {
867
- let r = Be(e?.[a], n, t);
868
- return /* @__PURE__ */ T(be, { fill: Q(r) }, `cell-${n}`);
1273
+ ...b,
1274
+ ...xe,
1275
+ children: v.map((e, n) => {
1276
+ let r = Se(e?.[i], n, t);
1277
+ return /* @__PURE__ */ E(Ie, { fill: $(r) }, `cell-${n}`);
869
1278
  })
870
1279
  }),
871
- at ? /* @__PURE__ */ T(ht, {
1280
+ yt ? /* @__PURE__ */ E(Ft, {
872
1281
  verticalAlign: "bottom",
873
1282
  wrapperStyle: {
874
- fontSize: C ? "11px" : "12px",
1283
+ fontSize: S ? "11px" : "12px",
875
1284
  paddingTop: "8px"
876
1285
  },
877
- content: /* @__PURE__ */ T(ut, {
878
- nameKey: a,
1286
+ content: /* @__PURE__ */ E(kt, {
1287
+ nameKey: i,
879
1288
  className: "flex-wrap"
880
1289
  })
881
1290
  }) : null
882
1291
  ] })
883
1292
  });
1293
+ return /* @__PURE__ */ E(nn, {
1294
+ note: on(o.sizable, o.total, n),
1295
+ children: l
1296
+ });
884
1297
  }
885
- if (v === "funnel") {
886
- let e = o[0]?.dataKey || "value", n = R(), c = d ? (t) => {
1298
+ if (g === "funnel") {
1299
+ let e = a[0]?.dataKey || "value", t = nt(), c = rn(v, e);
1300
+ if (c.total > 0 && c.sizable === 0) return /* @__PURE__ */ E(an, {
1301
+ dataKey: e,
1302
+ className: s
1303
+ });
1304
+ let l = d ? (t) => {
887
1305
  t && d({
888
- category: t?.payload?.[a] ?? t?.[a],
889
- categoryId: i(t?.payload) ?? i(t),
1306
+ category: t?.payload?.[i] ?? t?.[i],
1307
+ categoryId: o(t?.payload) ?? o(t),
890
1308
  value: t?.payload?.[e] ?? t?.[e]
891
1309
  });
892
- } : void 0, l = c ? {
893
- onClick: c,
1310
+ } : void 0, f = l ? {
1311
+ onClick: l,
894
1312
  style: { cursor: "pointer" }
895
- } : {}, f = t(u), p = f ? [...b].sort((e, t) => (f.get(String(e?.[a] ?? "")) ?? 2 ** 53 - 1) - (f.get(String(t?.[a] ?? "")) ?? 2 ** 53 - 1)) : [...b].sort((t, n) => {
1313
+ } : {}, p = n(u), m = p ? [...v].sort((e, t) => (p.get(String(e?.[i] ?? "")) ?? 2 ** 53 - 1) - (p.get(String(t?.[i] ?? "")) ?? 2 ** 53 - 1)) : [...v].sort((t, n) => {
896
1314
  let r = Number(t?.[e] ?? 0);
897
1315
  return Number(n?.[e] ?? 0) - r;
898
- });
899
- return /* @__PURE__ */ T(J, {
1316
+ }), h = /* @__PURE__ */ E(Dt, {
900
1317
  config: r,
901
1318
  className: s,
902
- ...S,
903
- children: /* @__PURE__ */ E(Se, { children: [/* @__PURE__ */ T(Z, { content: /* @__PURE__ */ T(lt, {}) }), /* @__PURE__ */ E(xe, {
1319
+ ...x,
1320
+ children: /* @__PURE__ */ D(k, { children: [/* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }), /* @__PURE__ */ D(Re, {
904
1321
  dataKey: e,
905
- data: p,
906
- nameKey: a,
907
- ...x,
908
- ...l,
909
- children: [/* @__PURE__ */ T(Ce, {
1322
+ data: m,
1323
+ nameKey: i,
1324
+ ...b,
1325
+ ...f,
1326
+ children: [/* @__PURE__ */ E(ze, {
910
1327
  position: "right",
911
1328
  fill: "hsl(var(--foreground))",
912
1329
  stroke: "none",
913
- dataKey: a
914
- }), p.map((e, t) => /* @__PURE__ */ T(be, { fill: Q(n[t % n.length]) }, `funnel-cell-${t}`))]
1330
+ dataKey: i
1331
+ }), m.map((e, n) => /* @__PURE__ */ E(Ie, { fill: $(t[n % t.length]) }, `funnel-cell-${n}`))]
915
1332
  })] })
916
1333
  });
1334
+ return /* @__PURE__ */ E(nn, {
1335
+ note: on(c.sizable, c.total, e),
1336
+ children: h
1337
+ });
917
1338
  }
918
- if (v === "treemap") {
919
- let e = o[0]?.dataKey || "value", t = R(), n = b.map((n, r) => ({
920
- name: String(n?.[a] ?? ""),
1339
+ if (g === "treemap") {
1340
+ let e = a[0]?.dataKey || "value", t = nt(), n = rn(v, e);
1341
+ if (n.total > 0 && n.sizable === 0) return /* @__PURE__ */ E(an, {
1342
+ dataKey: e,
1343
+ className: s
1344
+ });
1345
+ let o = v.map((n, r) => ({
1346
+ name: String(n?.[i] ?? ""),
921
1347
  size: Number(n?.[e]) || 0,
922
- fill: Q(t[r % t.length])
923
- }));
924
- return /* @__PURE__ */ T(J, {
1348
+ fill: $(t[r % t.length])
1349
+ })), c = /* @__PURE__ */ E(Dt, {
925
1350
  config: r,
926
1351
  className: s,
927
- ...S,
928
- children: /* @__PURE__ */ T(Le, {
929
- data: n,
1352
+ ...x,
1353
+ children: /* @__PURE__ */ E(et, {
1354
+ data: o,
930
1355
  dataKey: "size",
931
1356
  nameKey: "name",
932
- ...x,
933
- content: /* @__PURE__ */ T(Ct, {}),
934
- ...Ge,
935
- children: /* @__PURE__ */ T(Ie, {})
1357
+ ...b,
1358
+ content: /* @__PURE__ */ E(en, {}),
1359
+ ...Oe,
1360
+ children: /* @__PURE__ */ E(M, {})
936
1361
  })
937
1362
  });
1363
+ return /* @__PURE__ */ E(nn, {
1364
+ note: on(n.sizable, n.total, e),
1365
+ children: c
1366
+ });
938
1367
  }
939
- if (v === "sankey") {
940
- let e = o[0]?.dataKey || "value", t = o[0]?.label || e, n = b.filter((t) => (Number(t?.[e]) || 0) > 0), i = [{ name: t }, ...n.map((e) => ({ name: String(e?.[a] ?? "") }))], c = n.map((t, n) => ({
1368
+ if (g === "sankey") {
1369
+ let e = a[0]?.dataKey || "value", t = a[0]?.label || e, n = v.filter((t) => (Number(t?.[e]) || 0) > 0), o = [{ name: t }, ...n.map((e) => ({ name: String(e?.[i] ?? "") }))], c = n.map((t, n) => ({
941
1370
  source: 0,
942
1371
  target: n + 1,
943
1372
  value: Number(t?.[e]) || 0
944
1373
  }));
945
- return c.length === 0 ? /* @__PURE__ */ T("div", { className: s }) : /* @__PURE__ */ T(J, {
946
- config: r,
1374
+ if (c.length === 0) return v.length === 0 ? /* @__PURE__ */ E("div", { className: s }) : /* @__PURE__ */ D(Q, {
1375
+ code: "no-positive-flow",
947
1376
  className: s,
948
- ...S,
949
- children: /* @__PURE__ */ T(A, {
950
- data: {
951
- nodes: i,
952
- links: c
953
- },
954
- nodePadding: 24,
955
- link: {
956
- stroke: "hsl(var(--muted-foreground))",
957
- strokeOpacity: .25
958
- },
959
- node: { fill: "hsl(var(--chart-1))" },
960
- ...Ke,
961
- children: /* @__PURE__ */ T(Ie, {})
1377
+ children: [
1378
+ "This chart has no flow to draw: no row's",
1379
+ " ",
1380
+ /* @__PURE__ */ E("code", {
1381
+ className: "font-mono",
1382
+ children: e
1383
+ }),
1384
+ " is above zero."
1385
+ ]
1386
+ });
1387
+ let l = v.length - n.length;
1388
+ return /* @__PURE__ */ E(nn, {
1389
+ note: l > 0 ? /* @__PURE__ */ D("p", {
1390
+ role: "note",
1391
+ "data-chart-note": "omitted-rows",
1392
+ className: "px-1 text-xs text-muted-foreground",
1393
+ children: [
1394
+ "Showing ",
1395
+ n.length,
1396
+ " of ",
1397
+ v.length,
1398
+ " rows — ",
1399
+ l,
1400
+ " ",
1401
+ l === 1 ? "row has" : "rows have",
1402
+ " no",
1403
+ " ",
1404
+ /* @__PURE__ */ E("code", {
1405
+ className: "font-mono",
1406
+ children: e
1407
+ }),
1408
+ " above zero, which a flow cannot draw."
1409
+ ]
1410
+ }) : null,
1411
+ children: /* @__PURE__ */ E(Dt, {
1412
+ config: r,
1413
+ className: s,
1414
+ ...x,
1415
+ children: /* @__PURE__ */ E($e, {
1416
+ data: {
1417
+ nodes: o,
1418
+ links: c
1419
+ },
1420
+ nodePadding: 24,
1421
+ link: {
1422
+ stroke: "hsl(var(--muted-foreground))",
1423
+ strokeOpacity: .25
1424
+ },
1425
+ node: { fill: "hsl(var(--chart-1))" },
1426
+ ...ke,
1427
+ children: /* @__PURE__ */ E(M, {})
1428
+ })
962
1429
  })
963
1430
  });
964
1431
  }
965
- if (v === "radar") return /* @__PURE__ */ T(J, {
1432
+ if (g === "radar") return /* @__PURE__ */ E(Dt, {
966
1433
  config: r,
967
1434
  className: s,
968
- ...S,
969
- children: /* @__PURE__ */ E(Me, {
970
- data: b,
1435
+ ...x,
1436
+ children: /* @__PURE__ */ D(Ye, {
1437
+ data: v,
971
1438
  children: [
972
- /* @__PURE__ */ T(ke, {}),
973
- /* @__PURE__ */ T(Oe, { dataKey: a }),
974
- /* @__PURE__ */ T(Ae, {}),
975
- /* @__PURE__ */ T(Z, { content: /* @__PURE__ */ T(lt, {}) }),
976
- /* @__PURE__ */ T(ht, {
977
- content: /* @__PURE__ */ T(ut, {}),
978
- ...C && {
1439
+ /* @__PURE__ */ E(Ke, {}),
1440
+ /* @__PURE__ */ E(Ge, { dataKey: i }),
1441
+ /* @__PURE__ */ E(qe, {}),
1442
+ /* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }),
1443
+ /* @__PURE__ */ E(Ft, {
1444
+ content: /* @__PURE__ */ E(kt, {}),
1445
+ ...S && {
979
1446
  verticalAlign: "bottom",
980
1447
  wrapperStyle: {
981
1448
  fontSize: "11px",
@@ -983,372 +1450,502 @@ function Tt({ chartType: e = "bar", data: n = [], config: r = {}, xAxisKey: a =
983
1450
  }
984
1451
  }
985
1452
  }),
986
- o.map((e) => {
987
- let t = Q(r[e.dataKey]?.color || At);
988
- return /* @__PURE__ */ T(je, {
1453
+ a.map((e) => {
1454
+ let t = $(r[e.dataKey]?.color || En), n = On(e, "radar");
1455
+ return /* @__PURE__ */ E(Je, {
989
1456
  dataKey: e.dataKey,
990
1457
  stroke: t,
991
1458
  fill: t,
992
- fillOpacity: .6,
993
- ...x
1459
+ fillOpacity: n.fillOpacity ?? .6,
1460
+ strokeOpacity: n.strokeOpacity,
1461
+ strokeDasharray: n.strokeDasharray,
1462
+ ...b
994
1463
  }, e.dataKey);
995
1464
  })
996
1465
  ]
997
1466
  })
998
1467
  });
999
- if (v === "scatter") return /* @__PURE__ */ T(J, {
1000
- config: r,
1001
- className: s,
1002
- ...S,
1003
- children: /* @__PURE__ */ E(M, { children: [
1004
- /* @__PURE__ */ T(ye, { vertical: !1 }),
1005
- /* @__PURE__ */ T(N, {
1006
- type: "number",
1007
- dataKey: a,
1008
- name: String(r[a]?.label || a),
1009
- tickLine: !1,
1010
- axisLine: !1,
1011
- minTickGap: C ? 32 : 48
1012
- }),
1013
- /* @__PURE__ */ T(P, {
1014
- type: "number",
1015
- dataKey: o[0]?.dataKey || "value",
1016
- name: String(r[o[0]?.dataKey]?.label || o[0]?.dataKey),
1017
- tickLine: !1,
1018
- axisLine: !1,
1019
- tickFormatter: z,
1020
- width: 48
1021
- }),
1022
- /* @__PURE__ */ T(Re, {
1023
- type: "number",
1024
- range: [60, 400]
1025
- }),
1026
- /* @__PURE__ */ T(Z, { content: /* @__PURE__ */ T(lt, {}) }),
1027
- /* @__PURE__ */ T(ht, {
1028
- content: /* @__PURE__ */ T(ut, {}),
1029
- ...C && {
1030
- verticalAlign: "bottom",
1031
- wrapperStyle: {
1032
- fontSize: "11px",
1033
- paddingTop: "8px"
1034
- }
1035
- }
1036
- }),
1037
- o.map((e, t) => {
1038
- let n = R(), i = Q(r[e.dataKey]?.color || n[t % n.length]), a = Mt(e, "scatter");
1039
- return /* @__PURE__ */ T(j, {
1040
- name: r[e.dataKey]?.label || e.dataKey,
1041
- data: b,
1042
- fill: i,
1043
- fillOpacity: a?.fillOpacity,
1044
- ...x,
1045
- ...We
1046
- }, e.dataKey);
1047
- })
1048
- ] })
1049
- });
1050
- if (v === "combo") return /* @__PURE__ */ T(wt, {
1051
- title: ne,
1052
- subtitle: re,
1053
- children: /* @__PURE__ */ T(J, {
1054
- config: r,
1055
- className: s,
1056
- ...S,
1057
- children: /* @__PURE__ */ E(O, {
1058
- data: b,
1059
- ...Fe,
1060
- children: [
1061
- /* @__PURE__ */ T(ye, { ...it }),
1062
- /* @__PURE__ */ T(N, {
1063
- dataKey: a,
1064
- ...dt
1065
- }),
1066
- /* @__PURE__ */ T(P, {
1067
- yAxisId: "left",
1468
+ if (g === "scatter") {
1469
+ if (a.length > 1) return /* @__PURE__ */ E(gn, {
1470
+ seriesKeys: a.map((e) => String(e.dataKey)),
1471
+ className: s
1472
+ });
1473
+ let e = a[0]?.dataKey || "value", t = cn(v, i, e), n = v.map((e) => Number(e?.[i])).filter((e) => Number.isFinite(e)), o = W(p?.format, y);
1474
+ if (t.total > 0 && t.plottable === 0) return /* @__PURE__ */ E(ln, {
1475
+ xKey: i,
1476
+ yKey: e,
1477
+ className: s
1478
+ });
1479
+ if (t.total > 0) {
1480
+ let n = [[i, p], [e, m?.[0]]].filter(([e, t]) => !fn(t) && !pn(v, e)).map(([e]) => e).filter((e, t, n) => n.indexOf(e) === t);
1481
+ if (n.length > 0) return /* @__PURE__ */ E(hn, {
1482
+ keys: n,
1483
+ total: t.total,
1484
+ className: s
1485
+ });
1486
+ }
1487
+ return /* @__PURE__ */ E(nn, {
1488
+ note: Qt(_n(t.plottable, t.total, i, e), Y, V),
1489
+ children: /* @__PURE__ */ E(Dt, {
1490
+ config: r,
1491
+ className: s,
1492
+ ...x,
1493
+ children: /* @__PURE__ */ D(j, { children: [
1494
+ /* @__PURE__ */ E(O, { ...vt }),
1495
+ /* @__PURE__ */ E(N, {
1496
+ type: "number",
1497
+ dataKey: i,
1498
+ name: String(r[i]?.label || i),
1068
1499
  tickLine: !1,
1069
1500
  axisLine: !1,
1070
- tickFormatter: U,
1071
- width: 48,
1072
- ...K(B)
1501
+ minTickGap: S ? 32 : 48,
1502
+ padding: Ln,
1503
+ ...o ? { tickFormatter: o } : {},
1504
+ ...K ? { orientation: K } : {},
1505
+ ...$t(p, n, Ut(K))
1073
1506
  }),
1074
- /* @__PURE__ */ T(P, {
1075
- yAxisId: "right",
1076
- orientation: "right",
1507
+ /* @__PURE__ */ E(P, {
1508
+ type: "number",
1509
+ dataKey: e,
1510
+ name: String(r[a[0]?.dataKey]?.label || a[0]?.dataKey),
1077
1511
  tickLine: !1,
1078
1512
  axisLine: !1,
1079
- tickFormatter: W,
1513
+ tickFormatter: st,
1080
1514
  width: 48,
1081
- ...K(V, "right")
1515
+ padding: Rn,
1516
+ ...B === "right" ? { orientation: "right" } : {},
1517
+ ...G(F, B)
1082
1518
  }),
1083
- st ? /* @__PURE__ */ T(Z, { content: /* @__PURE__ */ T(lt, {}) }) : null,
1084
- at ? /* @__PURE__ */ T(ht, {
1085
- content: /* @__PURE__ */ T(ut, {}),
1086
- ...C && {
1519
+ /* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }),
1520
+ /* @__PURE__ */ E(Ft, {
1521
+ content: /* @__PURE__ */ E(kt, { nameKey: e }),
1522
+ ...S && {
1087
1523
  verticalAlign: "bottom",
1088
1524
  wrapperStyle: {
1089
1525
  fontSize: "11px",
1090
1526
  paddingTop: "8px"
1091
1527
  }
1092
1528
  }
1093
- }) : null,
1094
- ot,
1095
- ct,
1096
- o.map((e, t) => {
1097
- let n = Q(r[e.dataKey]?.color || At), i = e.chartType || y || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : y || i === "bar" ? "left" : "right", o = Mt(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = Xe((a === "right" ? V : B)?.format);
1098
- return i === "line" ? /* @__PURE__ */ T(we, {
1099
- yAxisId: a,
1100
- type: "monotone",
1101
- dataKey: e.dataKey,
1102
- stroke: n,
1103
- strokeWidth: 2,
1104
- dot: !1,
1105
- strokeOpacity: o?.strokeOpacity,
1106
- strokeDasharray: o?.strokeDasharray,
1107
- ...x,
1108
- ...F(e),
1109
- children: q(c)
1110
- }, e.dataKey) : i === "area" ? /* @__PURE__ */ T(he, {
1111
- yAxisId: a,
1112
- type: "monotone",
1113
- dataKey: e.dataKey,
1114
- fill: n,
1115
- stroke: n,
1116
- fillOpacity: o?.fillOpacity ?? .4,
1117
- strokeOpacity: o?.strokeOpacity,
1118
- strokeDasharray: o?.strokeDasharray,
1119
- ...s,
1120
- ...x,
1121
- ...F(e),
1122
- children: q(c)
1123
- }, e.dataKey) : /* @__PURE__ */ T(_e, {
1124
- yAxisId: a,
1125
- dataKey: e.dataKey,
1126
- fill: n,
1127
- radius: 4,
1128
- fillOpacity: o?.fillOpacity,
1129
- ...s,
1130
- ...x,
1131
- ...F(e),
1132
- children: q(c)
1529
+ }),
1530
+ a.map((e, t) => {
1531
+ let n = nt(), i = $(r[e.dataKey]?.color || n[t % n.length]), a = On(e, "scatter");
1532
+ return /* @__PURE__ */ E(A, {
1533
+ name: r[e.dataKey]?.label || e.dataKey,
1534
+ data: v,
1535
+ fill: i,
1536
+ fillOpacity: a.fillOpacity,
1537
+ strokeOpacity: a.strokeOpacity,
1538
+ strokeDasharray: a.strokeDasharray,
1539
+ ...b,
1540
+ ...Ee
1133
1541
  }, e.dataKey);
1134
1542
  })
1135
- ]
1543
+ ] })
1136
1544
  })
1137
- })
1138
- });
1139
- let Y = v === "horizontal-bar", ft = R(), pt = l ? Object.values(l).map((e) => Q(String(e))) : [], mt = Array.from(/* @__PURE__ */ new Set([
1140
- ...ft,
1141
- ...pt,
1142
- ...o.map((e, t) => Q(r[e.dataKey]?.color || ft[t % ft.length] || At))
1143
- ])), X = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
1144
- return /* @__PURE__ */ T(wt, {
1545
+ });
1546
+ }
1547
+ if (g === "combo") return /* @__PURE__ */ E(tn, {
1145
1548
  title: ne,
1146
1549
  subtitle: re,
1147
- children: /* @__PURE__ */ T(J, {
1148
- config: r,
1149
- className: s,
1150
- ...S,
1151
- children: /* @__PURE__ */ E(qe, {
1152
- data: b,
1153
- layout: Y ? "vertical" : "horizontal",
1154
- ...k,
1155
- children: [
1156
- /* @__PURE__ */ T("defs", { children: mt.map((e) => /* @__PURE__ */ E(h.Fragment, { children: [/* @__PURE__ */ E("linearGradient", {
1157
- id: `bg-${X(e)}`,
1158
- x1: "0",
1159
- y1: "0",
1160
- x2: "0",
1161
- y2: "1",
1162
- children: [/* @__PURE__ */ T("stop", {
1163
- offset: "0%",
1164
- style: { stopColor: e },
1165
- stopOpacity: .95
1166
- }), /* @__PURE__ */ T("stop", {
1167
- offset: "100%",
1168
- style: { stopColor: e },
1169
- stopOpacity: .5
1170
- })]
1171
- }), /* @__PURE__ */ E("linearGradient", {
1172
- id: `ag-${X(e)}`,
1173
- x1: "0",
1174
- y1: "0",
1175
- x2: "0",
1176
- y2: "1",
1177
- children: [/* @__PURE__ */ T("stop", {
1178
- offset: "0%",
1179
- style: { stopColor: e },
1180
- stopOpacity: .5
1181
- }), /* @__PURE__ */ T("stop", {
1182
- offset: "95%",
1183
- style: { stopColor: e },
1184
- stopOpacity: .05
1185
- })]
1186
- })] }, X(e))) }),
1187
- /* @__PURE__ */ T(ye, { ...it }),
1188
- Y ? /* @__PURE__ */ E(me, { children: [/* @__PURE__ */ T(N, {
1189
- type: "number",
1190
- tickLine: !1,
1191
- axisLine: !1,
1192
- tickFormatter: U,
1193
- ...K(B)
1194
- }), /* @__PURE__ */ T(P, {
1195
- type: "category",
1196
- dataKey: a,
1197
- tickLine: !1,
1198
- axisLine: !1,
1199
- width: Math.min(140, Math.max(60, Math.max(...b.map((e) => String(e[a] ?? "").length)) * 7)),
1200
- tickFormatter: nt
1201
- })] }) : /* @__PURE__ */ E(me, { children: [
1202
- /* @__PURE__ */ T(N, {
1203
- dataKey: a,
1204
- ...dt
1550
+ children: /* @__PURE__ */ E(nn, {
1551
+ note: Qt(Y, V),
1552
+ children: /* @__PURE__ */ E(Dt, {
1553
+ config: r,
1554
+ className: s,
1555
+ ...x,
1556
+ children: /* @__PURE__ */ D(Le, {
1557
+ data: v,
1558
+ ...ye,
1559
+ children: [
1560
+ /* @__PURE__ */ E(O, {
1561
+ ...vt,
1562
+ ...Yt(at, I)
1563
+ }),
1564
+ /* @__PURE__ */ E(N, {
1565
+ dataKey: i,
1566
+ ...wt
1205
1567
  }),
1206
- /* @__PURE__ */ T(P, {
1207
- ...H ? { yAxisId: "left" } : {},
1568
+ /* @__PURE__ */ E(P, {
1569
+ yAxisId: "left",
1208
1570
  tickLine: !1,
1209
1571
  axisLine: !1,
1210
- tickFormatter: U,
1572
+ tickFormatter: ct,
1211
1573
  width: 48,
1212
- ...K(B)
1574
+ ...G(R, "left")
1213
1575
  }),
1214
- H ? /* @__PURE__ */ T(P, {
1576
+ /* @__PURE__ */ E(P, {
1215
1577
  yAxisId: "right",
1216
1578
  orientation: "right",
1217
1579
  tickLine: !1,
1218
1580
  axisLine: !1,
1219
- tickFormatter: W,
1581
+ tickFormatter: ut,
1220
1582
  width: 48,
1221
- ...K(V, "right")
1222
- }) : null
1223
- ] }),
1224
- st ? /* @__PURE__ */ T(Z, { content: /* @__PURE__ */ T(lt, {}) }) : null,
1225
- at ? /* @__PURE__ */ T(ht, {
1226
- content: /* @__PURE__ */ T(ut, {}),
1227
- ...C && {
1228
- verticalAlign: "bottom",
1229
- wrapperStyle: {
1230
- fontSize: "11px",
1231
- paddingTop: "8px"
1583
+ ...G(z, "right")
1584
+ }),
1585
+ xt ? /* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }) : null,
1586
+ yt ? /* @__PURE__ */ E(Ft, {
1587
+ content: /* @__PURE__ */ E(kt, {}),
1588
+ ...S && {
1589
+ verticalAlign: "bottom",
1590
+ wrapperStyle: {
1591
+ fontSize: "11px",
1592
+ paddingTop: "8px"
1593
+ }
1232
1594
  }
1233
- }
1234
- }) : null,
1235
- ot,
1236
- ct,
1237
- o.map((e, t) => {
1238
- let n = R(), i = e.variant === "comparison", s = i ? o.slice(0, t).find((e) => e.variant !== "comparison") || o[0] : e, c = i ? o.indexOf(s) : t, l = Q(r[s.dataKey]?.color || n[c % n.length] || At), u = H ? { yAxisId: e.yAxis === "right" ? "right" : "left" } : {}, d = e.stack ? { stackId: String(e.stack) } : {}, f = Xe((e.yAxis === "right" ? V : B)?.format);
1239
- if (v === "bar" || v === "horizontal-bar") {
1240
- let t = o.filter((e) => e.variant !== "comparison").length === 1 && !i && o.length === 1 && b.length > 1, r = Mt(e, "bar");
1241
- return /* @__PURE__ */ E(_e, {
1242
- dataKey: e.dataKey,
1243
- fill: `url(#bg-${X(l)})`,
1244
- radius: 4,
1245
- fillOpacity: r?.fillOpacity,
1246
- ...d,
1247
- ...u,
1248
- ...x,
1249
- ...ue(e),
1250
- children: [t && b.map((e, t) => /* @__PURE__ */ T(be, { fill: `url(#bg-${X(Q(Be(e?.[a], t, n)))})` }, `cell-${t}`)), q(f)]
1251
- }, e.dataKey);
1252
- }
1253
- if (v === "line") {
1254
- let t = Mt(e, "line");
1255
- return /* @__PURE__ */ T(we, {
1595
+ }) : null,
1596
+ bt,
1597
+ St,
1598
+ a.map((e, t) => {
1599
+ let n = $(r[e.dataKey]?.color || En), i = e.chartType || le || (t === 0 ? "bar" : "line"), a = e.yAxis === "right" || e.yAxis === "left" ? e.yAxis : le || i === "bar" ? "left" : "right", o = On(e, i), s = e.stack ? { stackId: String(e.stack) } : {}, c = W((a === "right" ? z : R)?.format, y);
1600
+ return i === "line" ? /* @__PURE__ */ E(Ve, {
1601
+ yAxisId: a,
1256
1602
  type: "monotone",
1257
1603
  dataKey: e.dataKey,
1258
- stroke: l,
1604
+ stroke: n,
1259
1605
  strokeWidth: 2,
1260
1606
  dot: !1,
1261
- strokeOpacity: t?.strokeOpacity,
1262
- strokeDasharray: t?.strokeDasharray,
1263
- ...u,
1264
- ...x,
1265
- ...ue(e),
1266
- children: q(f)
1267
- }, e.dataKey);
1268
- }
1269
- if (v === "area") {
1270
- let t = Mt(e, "area");
1271
- return /* @__PURE__ */ T(he, {
1607
+ strokeOpacity: o.strokeOpacity,
1608
+ strokeDasharray: o.strokeDasharray,
1609
+ ...b,
1610
+ ...be(e),
1611
+ children: Ct(c)
1612
+ }, e.dataKey) : i === "area" ? /* @__PURE__ */ E(je, {
1613
+ yAxisId: a,
1272
1614
  type: "monotone",
1273
1615
  dataKey: e.dataKey,
1274
- fill: `url(#ag-${X(l)})`,
1275
- stroke: l,
1276
- strokeWidth: 2,
1277
- fillOpacity: t?.fillOpacity ?? 1,
1278
- strokeOpacity: t?.strokeOpacity,
1279
- strokeDasharray: t?.strokeDasharray,
1280
- ...d,
1281
- ...u,
1282
- ...x,
1283
- ...ue(e),
1284
- children: q(f)
1616
+ fill: n,
1617
+ stroke: n,
1618
+ fillOpacity: o.fillOpacity ?? .4,
1619
+ strokeOpacity: o.strokeOpacity,
1620
+ strokeDasharray: o.strokeDasharray,
1621
+ ...s,
1622
+ ...b,
1623
+ ...be(e),
1624
+ children: Ct(c)
1625
+ }, e.dataKey) : /* @__PURE__ */ E(Ne, {
1626
+ yAxisId: a,
1627
+ dataKey: e.dataKey,
1628
+ fill: n,
1629
+ radius: 4,
1630
+ fillOpacity: o.fillOpacity,
1631
+ strokeOpacity: o.strokeOpacity,
1632
+ strokeDasharray: o.strokeDasharray,
1633
+ ...s,
1634
+ ...b,
1635
+ ...be(e),
1636
+ children: Ct(c)
1285
1637
  }, e.dataKey);
1286
- }
1287
- return null;
1288
- })
1289
- ]
1638
+ })
1639
+ ]
1640
+ })
1641
+ })
1642
+ })
1643
+ });
1644
+ let Et = g === "horizontal-bar", At = nt(), X = l ? Object.values(l).map((e) => $(String(e))) : [], jt = Array.from(/* @__PURE__ */ new Set([
1645
+ ...At,
1646
+ ...X,
1647
+ ...a.map((e, t) => $(r[e.dataKey]?.color || At[t % At.length] || En))
1648
+ ])), Z = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
1649
+ return /* @__PURE__ */ E(tn, {
1650
+ title: ne,
1651
+ subtitle: re,
1652
+ children: /* @__PURE__ */ E(nn, {
1653
+ note: Qt(Y, V),
1654
+ children: /* @__PURE__ */ E(Dt, {
1655
+ config: r,
1656
+ className: s,
1657
+ ...x,
1658
+ children: /* @__PURE__ */ D(Tt, {
1659
+ data: v,
1660
+ layout: Et ? "vertical" : "horizontal",
1661
+ ...ve,
1662
+ children: [
1663
+ /* @__PURE__ */ E("defs", { children: jt.map((e) => /* @__PURE__ */ D(_.Fragment, { children: [/* @__PURE__ */ D("linearGradient", {
1664
+ id: `bg-${Z(e)}`,
1665
+ x1: "0",
1666
+ y1: "0",
1667
+ x2: "0",
1668
+ y2: "1",
1669
+ children: [/* @__PURE__ */ E("stop", {
1670
+ offset: "0%",
1671
+ style: { stopColor: e },
1672
+ stopOpacity: .95
1673
+ }), /* @__PURE__ */ E("stop", {
1674
+ offset: "100%",
1675
+ style: { stopColor: e },
1676
+ stopOpacity: .5
1677
+ })]
1678
+ }), /* @__PURE__ */ D("linearGradient", {
1679
+ id: `ag-${Z(e)}`,
1680
+ x1: "0",
1681
+ y1: "0",
1682
+ x2: "0",
1683
+ y2: "1",
1684
+ children: [/* @__PURE__ */ E("stop", {
1685
+ offset: "0%",
1686
+ style: { stopColor: e },
1687
+ stopOpacity: .5
1688
+ }), /* @__PURE__ */ E("stop", {
1689
+ offset: "95%",
1690
+ style: { stopColor: e },
1691
+ stopOpacity: .05
1692
+ })]
1693
+ })] }, Z(e))) }),
1694
+ /* @__PURE__ */ E(O, {
1695
+ ...vt,
1696
+ ...Yt(at, I)
1697
+ }),
1698
+ Et ? /* @__PURE__ */ D(T, { children: [it ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(N, {
1699
+ xAxisId: "left",
1700
+ type: "number",
1701
+ tickLine: !1,
1702
+ axisLine: !1,
1703
+ tickFormatter: ct,
1704
+ ...G(R, "left", Bn)
1705
+ }), /* @__PURE__ */ E(N, {
1706
+ xAxisId: "right",
1707
+ orientation: "top",
1708
+ type: "number",
1709
+ tickLine: !1,
1710
+ axisLine: !1,
1711
+ tickFormatter: ut,
1712
+ ...G(z, "right", Vn)
1713
+ })] }) : /* @__PURE__ */ E(N, {
1714
+ type: "number",
1715
+ tickLine: !1,
1716
+ axisLine: !1,
1717
+ tickFormatter: st,
1718
+ ...B === "right" ? { orientation: "top" } : {},
1719
+ ...G(F, B, Ut(B === "right" ? "top" : "bottom"))
1720
+ }), /* @__PURE__ */ E(P, {
1721
+ type: "category",
1722
+ dataKey: i,
1723
+ tickLine: !1,
1724
+ axisLine: !1,
1725
+ width: Math.min(140, Math.max(60, Math.max(...v.map((e) => String(e[i] ?? "").length)) * 7)),
1726
+ tickFormatter: H,
1727
+ ...q ? { orientation: q } : {},
1728
+ ...p?.title ? { label: {
1729
+ value: p.title,
1730
+ ...Wt(q)
1731
+ } } : {}
1732
+ })] }) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(N, {
1733
+ dataKey: i,
1734
+ ...wt
1735
+ }), it ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(P, {
1736
+ yAxisId: "left",
1737
+ tickLine: !1,
1738
+ axisLine: !1,
1739
+ tickFormatter: ct,
1740
+ width: 48,
1741
+ ...G(R, "left")
1742
+ }), /* @__PURE__ */ E(P, {
1743
+ yAxisId: "right",
1744
+ orientation: "right",
1745
+ tickLine: !1,
1746
+ axisLine: !1,
1747
+ tickFormatter: ut,
1748
+ width: 48,
1749
+ ...G(z, "right")
1750
+ })] }) : /* @__PURE__ */ E(P, {
1751
+ tickLine: !1,
1752
+ axisLine: !1,
1753
+ tickFormatter: st,
1754
+ width: 48,
1755
+ ...B === "right" ? { orientation: "right" } : {},
1756
+ ...G(F, B)
1757
+ })] }),
1758
+ xt ? /* @__PURE__ */ E(Pt, { content: /* @__PURE__ */ E(Ot, {}) }) : null,
1759
+ yt ? /* @__PURE__ */ E(Ft, {
1760
+ content: /* @__PURE__ */ E(kt, {}),
1761
+ ...S && {
1762
+ verticalAlign: "bottom",
1763
+ wrapperStyle: {
1764
+ fontSize: "11px",
1765
+ paddingTop: "8px"
1766
+ }
1767
+ }
1768
+ }) : null,
1769
+ bt,
1770
+ St,
1771
+ a.map((e, t) => {
1772
+ let n = nt(), 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 = $(r[s.dataKey]?.color || n[c % n.length] || En), u = e.yAxis === "right" ? "right" : "left", d = it ? Et ? { xAxisId: u } : { yAxisId: u } : {}, f = e.stack ? { stackId: String(e.stack) } : {}, p = W(ot(e)?.format, y);
1773
+ if (g === "bar" || g === "horizontal-bar") {
1774
+ let t = a.filter((e) => e.variant !== "comparison").length === 1 && !o && a.length === 1 && v.length > 1, r = On(e, "bar");
1775
+ return /* @__PURE__ */ D(Ne, {
1776
+ dataKey: e.dataKey,
1777
+ fill: `url(#bg-${Z(l)})`,
1778
+ radius: 4,
1779
+ fillOpacity: r.fillOpacity,
1780
+ strokeOpacity: r.strokeOpacity,
1781
+ strokeDasharray: r.strokeDasharray,
1782
+ ...f,
1783
+ ...d,
1784
+ ...b,
1785
+ ...pe(e),
1786
+ children: [t && v.map((e, t) => /* @__PURE__ */ E(Ie, { fill: `url(#bg-${Z($(Se(e?.[i], t, n)))})` }, `cell-${t}`)), Ct(p)]
1787
+ }, e.dataKey);
1788
+ }
1789
+ if (g === "line") {
1790
+ let t = On(e, "line");
1791
+ return /* @__PURE__ */ E(Ve, {
1792
+ type: "monotone",
1793
+ dataKey: e.dataKey,
1794
+ stroke: l,
1795
+ strokeWidth: 2,
1796
+ dot: !1,
1797
+ strokeOpacity: t.strokeOpacity,
1798
+ strokeDasharray: t.strokeDasharray,
1799
+ ...d,
1800
+ ...b,
1801
+ ...pe(e),
1802
+ children: Ct(p)
1803
+ }, e.dataKey);
1804
+ }
1805
+ if (g === "area") {
1806
+ let t = On(e, "area");
1807
+ return /* @__PURE__ */ E(je, {
1808
+ type: "monotone",
1809
+ dataKey: e.dataKey,
1810
+ fill: `url(#ag-${Z(l)})`,
1811
+ stroke: l,
1812
+ strokeWidth: 2,
1813
+ fillOpacity: t.fillOpacity ?? 1,
1814
+ strokeOpacity: t.strokeOpacity,
1815
+ strokeDasharray: t.strokeDasharray,
1816
+ ...f,
1817
+ ...d,
1818
+ ...b,
1819
+ ...pe(e),
1820
+ children: Ct(p)
1821
+ }, e.dataKey);
1822
+ }
1823
+ return null;
1824
+ })
1825
+ ]
1826
+ })
1290
1827
  })
1291
1828
  })
1292
1829
  });
1293
1830
  }
1294
- function Et(e) {
1295
- let t = e.chartType === "column" ? "bar" : e.chartType ?? "bar", n = Array.isArray(e.data) ? e.data : [], r = e.xAxisKey ?? "name";
1296
- return Lt.has(t) && n.length > 0 && !n.some((e) => typeof e == "object" && !!e && r in e);
1831
+ function yn(e) {
1832
+ return e.chartType === "column" ? "bar" : e.chartType;
1833
+ }
1834
+ function bn(e) {
1835
+ let t = yn(e), n = Array.isArray(e.data) ? e.data : [], r = e.xAxisKey ?? "name";
1836
+ return t !== void 0 && Nn.has(t) && n.length > 0 && !n.some((e) => typeof e == "object" && !!e && r in e);
1837
+ }
1838
+ function xn(e) {
1839
+ let t = yn(e), n = Array.isArray(e.data) ? e.data : [];
1840
+ return t === void 0 || !Kn.has(t) || n.length === 0 ? null : e.series === void 0 ? "undeclared" : Array.isArray(e.series) && e.series.length === 0 ? "empty" : null;
1297
1841
  }
1298
- function Dt(e) {
1299
- let t = e.chartType === "column" ? "bar" : e.chartType ?? "bar", n = Array.isArray(e.data) ? e.data : [];
1300
- return Rt.has(t) && n.length > 0 && Array.isArray(e.series) && e.series.length === 0;
1842
+ function Sn(e) {
1843
+ let t = yn(e), n = Array.isArray(e.data) ? e.data : [], r = Array.isArray(e.series) ? e.series : [];
1844
+ if (t === void 0 || !Kn.has(t) || n.length === 0 || r.length === 0) return null;
1845
+ let i = Array.from(new Set(r.map((e) => String(e.dataKey))));
1846
+ if (!i.every((e) => n.some((t) => typeof t == "object" && !!t && Object.prototype.hasOwnProperty.call(t, e)))) return null;
1847
+ let a = Array.isArray(e.yAxes) ? e.yAxes : [], o = lt(a, t), s = o.left === void 0 ? void 0 : a[o.left], c = o.right === void 0 ? void 0 : a[o.right], l = !!s && !!c, u = (e) => fn(s) || (!l || e.yAxis !== "left") && fn(c);
1848
+ return r.some((e, i) => mn(t, r, i) !== "none" || u(e) || pn(n, String(e.dataKey))) ? null : i;
1849
+ }
1850
+ function Cn(e) {
1851
+ let t = yn(e), n = Array.isArray(e.data) ? e.data : [], r = Array.isArray(e.series) ? e.series : [];
1852
+ if (t === void 0 || !Kn.has(t) || n.length === 0 || r.length === 0) return null;
1853
+ let i = Array.from(new Set(r.map((e) => e.dataKey)));
1854
+ return i.every((e) => typeof e == "string" && /^[^.[]+$/.test(e) && !n.some((t) => typeof t == "object" && !!t && e in t)) ? i : null;
1855
+ }
1856
+ function wn({ keys: e, className: t }) {
1857
+ return /* @__PURE__ */ D(Q, {
1858
+ code: "missing-series-key",
1859
+ className: t,
1860
+ children: [
1861
+ "This chart cannot plot its series: no row has a",
1862
+ " ",
1863
+ e.map((e, t) => /* @__PURE__ */ D(_.Fragment, { children: [t > 0 ? " or " : "", /* @__PURE__ */ E("code", {
1864
+ className: "font-mono",
1865
+ children: e
1866
+ })] }, `${t}-${e}`)),
1867
+ " ",
1868
+ "field."
1869
+ ]
1870
+ });
1301
1871
  }
1302
- function Ot({ code: e, className: t, children: n }) {
1303
- return /* @__PURE__ */ T("div", {
1872
+ function Q({ code: e, className: t, children: n }) {
1873
+ return /* @__PURE__ */ E("div", {
1304
1874
  className: `flex h-full min-h-[120px] w-full items-center justify-center p-4 text-center text-sm text-muted-foreground ${t ?? ""}`,
1305
1875
  role: "status",
1306
1876
  "data-chart-error": e,
1307
- children: /* @__PURE__ */ T("span", { children: n })
1877
+ children: /* @__PURE__ */ E("span", { children: n })
1308
1878
  });
1309
1879
  }
1310
- function kt(e) {
1311
- let t = Et(e), n = !t && Dt(e), r = e.xAxisKey ?? "name", i = h.useMemo(() => Object.keys((Array.isArray(e.data) ? e.data[0] : void 0) ?? {}), [e.data]);
1312
- return h.useEffect(() => {
1313
- t && console.warn(`[chart] no row has the category key "${r}" — rendering an explanatory placeholder instead of an empty axis. Row keys: ${JSON.stringify(i)}. A dataset query must PROJECT the dimension it groups by (framework#4033).`);
1880
+ function Tn(e) {
1881
+ let t = bn(e), n = t ? null : xn(e), r = t || n ? null : Cn(e), i = t || n || r ? null : Sn(e), a = e.xAxisKey ?? "name", o = _.useMemo(() => Object.keys((Array.isArray(e.data) ? e.data[0] : void 0) ?? {}), [e.data]), s = r ? JSON.stringify(r) : null, c = JSON.stringify(o);
1882
+ return _.useEffect(() => {
1883
+ t && console.warn(`[chart] no row has the category key "${a}" — rendering an explanatory placeholder instead of an empty axis. Row keys: ${JSON.stringify(o)}. A dataset query must PROJECT the dimension it groups by (framework#4033).`);
1314
1884
  }, [
1315
1885
  t,
1316
- r,
1317
- i
1318
- ]), h.useEffect(() => {
1319
- n && console.warn(`[chart] no series to plot against the category axis "${r}" — rendering an explanatory placeholder instead of an empty frame. Row keys: ${JSON.stringify(i)}. A grouped chart's SECOND dimension must be PROJECTED by the dataset query, and a chart with no measure selected has nothing to draw either (objectui#4683, framework#4033).`);
1886
+ a,
1887
+ o
1888
+ ]), _.useEffect(() => {
1889
+ if (n) {
1890
+ if (n === "undeclared") {
1891
+ console.warn(`[chart] no series binding was declared for the category axis "${a}" — rendering an explanatory placeholder instead of an empty frame. Row keys: ${JSON.stringify(o)}. A bar / line / area / combo chart draws only the columns its \`series\` (or \`categories\`, or a y-axis \`field\`) names (objectui#4695).`);
1892
+ return;
1893
+ }
1894
+ console.warn(`[chart] no series to plot against the category axis "${a}" — rendering an explanatory placeholder instead of an empty frame. Row keys: ${JSON.stringify(o)}. A grouped chart's SECOND dimension must be PROJECTED by the dataset query, and a chart with no measure selected has nothing to draw either (objectui#4683, framework#4033).`);
1895
+ }
1320
1896
  }, [
1321
1897
  n,
1322
- r,
1323
- i
1324
- ]), t ? /* @__PURE__ */ E(Ot, {
1898
+ a,
1899
+ o
1900
+ ]), _.useEffect(() => {
1901
+ s && console.warn(`[chart] no row has the series key(s) ${s} — rendering an explanatory placeholder instead of an empty frame. Row keys: ${c}. A series \`dataKey\` must name a column the rows carry (objectui#10396).`);
1902
+ }, [s, c]), t ? /* @__PURE__ */ D(Q, {
1325
1903
  code: "missing-category-key",
1326
1904
  className: e.className,
1327
1905
  children: [
1328
1906
  "This chart cannot plot its category axis: no row has a",
1329
1907
  " ",
1330
- /* @__PURE__ */ T("code", {
1908
+ /* @__PURE__ */ E("code", {
1331
1909
  className: "font-mono",
1332
- children: r
1910
+ children: a
1333
1911
  }),
1334
1912
  " field."
1335
1913
  ]
1336
- }) : n ? /* @__PURE__ */ E(Ot, {
1914
+ }) : n === "undeclared" ? /* @__PURE__ */ D(Q, {
1915
+ code: "no-plottable-series",
1916
+ className: e.className,
1917
+ children: [
1918
+ "This chart cannot plot any series: none was declared to draw against its",
1919
+ " ",
1920
+ /* @__PURE__ */ E("code", {
1921
+ className: "font-mono",
1922
+ children: a
1923
+ }),
1924
+ " axis."
1925
+ ]
1926
+ }) : n === "empty" ? /* @__PURE__ */ D(Q, {
1337
1927
  code: "no-plottable-series",
1338
1928
  className: e.className,
1339
1929
  children: [
1340
1930
  "This chart cannot plot any series: no measure or group reached its",
1341
1931
  " ",
1342
- /* @__PURE__ */ T("code", {
1932
+ /* @__PURE__ */ E("code", {
1343
1933
  className: "font-mono",
1344
- children: r
1934
+ children: a
1345
1935
  }),
1346
1936
  " axis."
1347
1937
  ]
1348
- }) : /* @__PURE__ */ T(Tt, { ...e });
1938
+ }) : r ? /* @__PURE__ */ E(wn, {
1939
+ keys: r,
1940
+ className: e.className
1941
+ }) : i ? /* @__PURE__ */ E(hn, {
1942
+ keys: i,
1943
+ total: Array.isArray(e.data) ? e.data.length : 0,
1944
+ className: e.className
1945
+ }) : /* @__PURE__ */ E(vn, { ...e });
1349
1946
  }
1350
- var At, jt, Q, Mt, Nt, Pt, Ft, It, Lt, Rt, zt = L((() => {
1351
- gt(), xt(), rt(), At = "hsl(var(--primary))", jt = {
1947
+ var En, Dn, $, On, kn, An, jn, Mn, Nn, Pn, Fn, In, Ln, Rn, zn, Bn, Vn, Hn, Un, Wn, Gn, Kn, qn = V((() => {
1948
+ It(), Vt(), bt(), En = "hsl(var(--primary))", Dn = {
1352
1949
  slate: "#64748b",
1353
1950
  gray: "#6b7280",
1354
1951
  zinc: "#71717a",
@@ -1371,11 +1968,14 @@ var At, jt, Q, Mt, Nt, Pt, Ft, It, Lt, Rt, zt = L((() => {
1371
1968
  fuchsia: "#d946ef",
1372
1969
  pink: "#ec4899",
1373
1970
  rose: "#f43f5e"
1374
- }, Q = (e) => jt[e] || e, Mt = (e, t) => e?.variant === "comparison" ? {
1375
- strokeOpacity: typeof e.opacity == "number" ? e.opacity : t === "line" || t === "scatter" ? .5 : .6,
1376
- fillOpacity: typeof e.opacity == "number" ? e.opacity : t === "bar" ? .4 : t === "area" ? .2 : .5,
1377
- strokeDasharray: e.dashArray ?? (t === "line" || t === "area" ? "4 4" : void 0)
1378
- } : null, Nt = (e, t) => {
1971
+ }, $ = (e) => Dn[e] || e, On = (e, t) => {
1972
+ let n = e?.variant === "comparison", r = t === "area" || t === "radar", i = typeof e?.opacity == "number" ? e.opacity : void 0;
1973
+ return {
1974
+ strokeOpacity: i ?? (n ? t === "line" ? .5 : r ? .6 : void 0 : void 0),
1975
+ fillOpacity: i ?? (n ? t === "bar" ? .4 : r ? .2 : .5 : void 0),
1976
+ strokeDasharray: e?.dashArray ?? (n && (t === "line" || r) ? "4 4" : void 0)
1977
+ };
1978
+ }, kn = (e, t) => {
1379
1979
  if (typeof e == "string" || typeof e == "number") {
1380
1980
  let t = String(e);
1381
1981
  if (t !== "") return t;
@@ -1384,18 +1984,18 @@ var At, jt, Q, Mt, Nt, Pt, Ft, It, Lt, Rt, zt = L((() => {
1384
1984
  let e = t[0]?.dataKey;
1385
1985
  if (e != null && String(e) !== "") return String(e);
1386
1986
  }
1387
- }, Pt = (e) => {
1987
+ }, An = (e) => {
1388
1988
  if (e && typeof e == "object" && "nativeEvent" in e) return e.nativeEvent;
1389
- }, Ft = (e) => {
1989
+ }, jn = (e) => {
1390
1990
  for (let t = e.length - 1; t >= 0; --t) {
1391
- let n = Pt(e[t]);
1991
+ let n = An(e[t]);
1392
1992
  if (n !== void 0) return n;
1393
1993
  }
1394
- }, It = (e, t) => {
1994
+ }, Mn = (e, t) => {
1395
1995
  if (e == null) return;
1396
1996
  let n = t.find((t) => String(t.dataKey) === e);
1397
1997
  return typeof n?.label == "string" ? n.label : void 0;
1398
- }, Lt = /* @__PURE__ */ new Set([
1998
+ }, Nn = /* @__PURE__ */ new Set([
1399
1999
  "bar",
1400
2000
  "horizontal-bar",
1401
2001
  "line",
@@ -1405,7 +2005,25 @@ var At, jt, Q, Mt, Nt, Pt, Ft, It, Lt, Rt, zt = L((() => {
1405
2005
  "radar",
1406
2006
  "funnel",
1407
2007
  "combo"
1408
- ]), Rt = /* @__PURE__ */ new Set([
2008
+ ]), Pn = 5, Fn = 12, In = Math.ceil(Math.sqrt(400 / Math.PI)), Ln = {
2009
+ left: In,
2010
+ right: In
2011
+ }, Rn = {
2012
+ top: In,
2013
+ bottom: In
2014
+ }, zn = {
2015
+ angle: -90,
2016
+ position: "insideLeft"
2017
+ }, Bn = {
2018
+ position: "insideBottom",
2019
+ offset: -4
2020
+ }, Vn = {
2021
+ position: "insideTop",
2022
+ offset: -4
2023
+ }, Hn = {
2024
+ angle: 90,
2025
+ position: "insideRight"
2026
+ }, Un = {}, Wn = { yAxisId: "left" }, Gn = { xAxisId: "left" }, Kn = /* @__PURE__ */ new Set([
1409
2027
  "bar",
1410
2028
  "horizontal-bar",
1411
2029
  "line",
@@ -1415,10 +2033,10 @@ var At, jt, Q, Mt, Nt, Pt, Ft, It, Lt, Rt, zt = L((() => {
1415
2033
  }));
1416
2034
  //#endregion
1417
2035
  //#region src/ChartRenderer.tsx
1418
- rt();
1419
- var Bt = g.lazy(() => Promise.resolve().then(() => (ct(), it))), Vt = g.lazy(() => Promise.resolve().then(() => (zt(), St))), Ht = ({ schema: e }) => /* @__PURE__ */ T(_, {
1420
- fallback: /* @__PURE__ */ T(w, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1421
- children: /* @__PURE__ */ T(Bt, {
2036
+ bt();
2037
+ var Jn = v.lazy(() => Promise.resolve().then(() => (Tt(), xt))), Yn = v.lazy(() => Promise.resolve().then(() => (qn(), Ht))), Xn = ({ schema: e }) => /* @__PURE__ */ E(y, {
2038
+ fallback: /* @__PURE__ */ E(we, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
2039
+ children: /* @__PURE__ */ E(Jn, {
1422
2040
  data: e.data,
1423
2041
  dataKey: e.dataKey,
1424
2042
  xAxisKey: e.xAxisKey,
@@ -1426,67 +2044,85 @@ var Bt = g.lazy(() => Promise.resolve().then(() => (ct(), it))), Vt = g.lazy(()
1426
2044
  className: e.className,
1427
2045
  color: e.color
1428
2046
  })
1429
- }), $ = ({ schema: e, onChartClick: t }) => {
1430
- let n = g.useMemo(() => {
1431
- let t = H(e), n = Array.isArray(e.series) ? e.series : void 0, r = (n?.length && n.every((e) => !!e && typeof e == "object" && "dataKey" in e) ? n : t.series) ?? n, i = e.xAxisKey ?? t.xAxisKey, a = e.config;
1432
- if (i || (e.index ? i = e.index : e.category && (i = e.category)), r || (e.categories ? r = e.categories.map((e) => ({ dataKey: e })) : e.value && (r = [{ dataKey: e.value }])), !a && r) {
2047
+ }), Zn = ({ schema: e, onChartClick: t }) => {
2048
+ let { language: n } = Oe(), r = v.useMemo(() => {
2049
+ let t = ut(e, n), r = Array.isArray(e.series) ? e.series : void 0, i = t.series ?? r, a = e.xAxisKey ?? t.xAxisKey, o = e.config;
2050
+ if (!o && i) {
1433
2051
  let t = e.colors || [
1434
2052
  "hsl(var(--chart-1))",
1435
2053
  "hsl(var(--chart-2))",
1436
2054
  "hsl(var(--chart-3))"
1437
2055
  ], n = {};
1438
- r.forEach((e, r) => {
2056
+ i.forEach((e, r) => {
1439
2057
  n[e.dataKey] = {
1440
2058
  label: e.label || e.dataKey,
1441
2059
  color: e.color || t[r % t.length]
1442
2060
  };
1443
- }), a = n;
2061
+ }), o = n;
1444
2062
  }
1445
2063
  return {
1446
2064
  chartType: e.chartType ?? t.chartType,
1447
2065
  data: Array.isArray(e.data) ? e.data : [],
1448
- config: a,
1449
- xAxisKey: i,
1450
- series: r,
2066
+ config: o,
2067
+ xAxisKey: a,
2068
+ series: i,
1451
2069
  className: e.className,
1452
2070
  spec: t
1453
2071
  };
1454
- }, [e]);
1455
- return /* @__PURE__ */ T(_, {
1456
- fallback: /* @__PURE__ */ T(w, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
1457
- children: /* @__PURE__ */ T(Vt, {
1458
- chartType: n.chartType,
1459
- data: n.data,
1460
- config: n.config,
1461
- xAxisKey: n.xAxisKey,
1462
- series: n.series,
1463
- className: n.className,
2072
+ }, [e, n]);
2073
+ return /* @__PURE__ */ E(y, {
2074
+ fallback: /* @__PURE__ */ E(we, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
2075
+ children: /* @__PURE__ */ E(Yn, {
2076
+ chartType: r.chartType,
2077
+ data: r.data,
2078
+ config: r.config,
2079
+ xAxisKey: r.xAxisKey,
2080
+ series: r.series,
2081
+ className: r.className,
1464
2082
  colors: Array.isArray(e.colors) ? e.colors : void 0,
1465
2083
  categoryColors: e.categoryColors,
1466
2084
  categoryOrder: e.categoryOrder,
1467
2085
  isAnimationActive: e.isAnimationActive,
1468
2086
  onChartClick: t,
1469
- xAxis: n.spec.xAxis,
1470
- yAxes: n.spec.yAxes,
1471
- showLegend: n.spec.showLegend,
1472
- showDataLabels: n.spec.showDataLabels,
1473
- title: n.spec.title,
1474
- subtitle: n.spec.subtitle,
1475
- description: n.spec.description,
1476
- height: n.spec.height ?? e.height,
1477
- annotations: n.spec.annotations,
1478
- interaction: n.spec.interaction
2087
+ xAxis: r.spec.xAxis,
2088
+ yAxes: r.spec.yAxes,
2089
+ showLegend: r.spec.showLegend,
2090
+ showDataLabels: r.spec.showDataLabels,
2091
+ title: r.spec.title,
2092
+ subtitle: r.spec.subtitle,
2093
+ description: r.spec.description,
2094
+ height: r.spec.height ?? e.height,
2095
+ annotations: r.spec.annotations,
2096
+ interaction: r.spec.interaction
1479
2097
  })
1480
2098
  });
1481
2099
  };
1482
2100
  //#endregion
1483
2101
  //#region src/ObjectChart.tsx
1484
- function Ut(e) {
1485
- return e.field || e.function || "count";
2102
+ bt();
2103
+ function Qn(e) {
2104
+ return a(e, e.function || "count");
1486
2105
  }
1487
- var Wt = "__comparison";
1488
- function Gt(e, t) {
1489
- let { field: n, function: r, groupBy: i } = t, a = Ut(t), o = {};
2106
+ var $n = [
2107
+ "aggregate.groupBy",
2108
+ "xAxisKey",
2109
+ "xAxis.field"
2110
+ ];
2111
+ function er(e) {
2112
+ let t = e?.aggregate?.groupBy;
2113
+ if (t && typeof t == "object" && !Array.isArray(t)) {
2114
+ let e = t.field;
2115
+ return typeof e == "string" && e ? e : void 0;
2116
+ }
2117
+ return typeof t == "string" && t ? t : ut(e).xAxisKey;
2118
+ }
2119
+ var tr = "__comparison";
2120
+ function nr(e) {
2121
+ let t = e?.groupBy;
2122
+ return t && typeof t == "object" && !Array.isArray(t) ? t.alias || t.field : typeof t == "string" ? t : void 0;
2123
+ }
2124
+ function rr(e, t) {
2125
+ let { field: n, function: r, groupBy: i } = t, a = Qn(t), o = {};
1490
2126
  for (let t of e) {
1491
2127
  let e = String(t[i] ?? "Unknown");
1492
2128
  o[e] || (o[e] = []), o[e].push(t);
@@ -1514,13 +2150,13 @@ function Gt(e, t) {
1514
2150
  };
1515
2151
  });
1516
2152
  }
1517
- async function Kt(e, t, n, r, i) {
2153
+ async function ir(e, t, n, r, i) {
1518
2154
  if (!e.length || !t) return e;
1519
2155
  let a = i || ((e, t) => t), o = `__raw_${t}`, s = n?.fields?.[t];
1520
2156
  if (!s) {
1521
2157
  let n = /^\d{4}-\d{2}-\d{2}/;
1522
2158
  return e.map((e) => {
1523
- let r = e[t], i = String(r ?? ""), s = n.test(i) ? i : u(i);
2159
+ let r = e[t], i = String(r ?? ""), s = n.test(i) ? i : h(i);
1524
2160
  return {
1525
2161
  ...e,
1526
2162
  [t]: a(i, s),
@@ -1532,7 +2168,7 @@ async function Kt(e, t, n, r, i) {
1532
2168
  if (c === "select" || c === "picklist" || c === "dropdown") {
1533
2169
  let n = s.options || [];
1534
2170
  if (n.length === 0) return e.map((e) => {
1535
- let n = e[t], r = String(n ?? ""), i = u(r);
2171
+ let n = e[t], r = String(n ?? ""), i = h(r);
1536
2172
  return {
1537
2173
  ...e,
1538
2174
  [t]: a(r, i),
@@ -1542,7 +2178,7 @@ async function Kt(e, t, n, r, i) {
1542
2178
  let r = {};
1543
2179
  for (let e of n) typeof e == "string" ? r[e] = e : e && typeof e == "object" && (r[String(e.value)] = e.label || String(e.value));
1544
2180
  return e.map((e) => {
1545
- let n = e[t], i = String(n ?? ""), s = r[i] || u(i);
2181
+ let n = e[t], i = String(n ?? ""), s = r[i] || h(i);
1546
2182
  return {
1547
2183
  ...e,
1548
2184
  [t]: a(i, s),
@@ -1551,7 +2187,7 @@ async function Kt(e, t, n, r, i) {
1551
2187
  });
1552
2188
  }
1553
2189
  if (c === "lookup" || c === "master_detail") {
1554
- let n = s.reference_to || s.reference;
2190
+ let n = s.reference;
1555
2191
  if (!n || !r || typeof r.find != "function") return e.map((e) => ({
1556
2192
  ...e,
1557
2193
  [o]: e[t]
@@ -1566,16 +2202,16 @@ async function Kt(e, t, n, r, i) {
1566
2202
  let c = await r.find(n, {
1567
2203
  $filter: { [a]: { $in: i } },
1568
2204
  $top: i.length
1569
- }), u = l(c), d = s.reference_field || s.display_field || "name", f = {};
1570
- for (let e of u) {
1571
- let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[d] || e.name || e.label || e.title || t;
1572
- t && (f[t] = String(n));
2205
+ }), l = m(c), u = s.displayField || s.reference_field || "name", d = {};
2206
+ for (let e of l) {
2207
+ let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[u] || e.name || e.label || e.title || t;
2208
+ t && (d[t] = String(n));
1573
2209
  }
1574
2210
  return e.map((e) => {
1575
2211
  let n = e[t], r = String(n ?? "");
1576
2212
  return {
1577
2213
  ...e,
1578
- [t]: f[r] || r,
2214
+ [t]: d[r] || r,
1579
2215
  [o]: n
1580
2216
  };
1581
2217
  });
@@ -1590,209 +2226,207 @@ async function Kt(e, t, n, r, i) {
1590
2226
  ...e,
1591
2227
  [o]: e[t]
1592
2228
  }));
1593
- let d = /^\d{4}-\d{2}-\d{2}/;
2229
+ let l = /^\d{4}-\d{2}-\d{2}/;
1594
2230
  return e.map((e) => {
1595
2231
  let n = e[t], r = String(n ?? "");
1596
2232
  return {
1597
2233
  ...e,
1598
- [t]: d.test(r) ? r : u(r),
2234
+ [t]: l.test(r) ? r : h(r),
1599
2235
  [o]: n
1600
2236
  };
1601
2237
  });
1602
2238
  }
1603
- var qt = (e) => {
1604
- let { schema: t } = e, i = e.onSegmentClick, u = ae(Be), h = e.dataSource || u?.dataSource, g = u?.apiFetch, _ = Ve(t.bind), { fieldOptionLabel: w } = Ke(), [me, he] = y([]), [ge, _e] = y(null), [D, ve] = y(() => !(Array.isArray(t.data) && t.data.length > 0) && (!!t.objectName || !!t.dataset)), [ye, be] = y(null), [O, xe] = y(null), [Se, Ce] = y(null), { openRecordList: k } = He(), we = qe(), Te = v(() => t.aggregate ? JSON.stringify(t.aggregate) : "", [t.aggregate]), Ee = v(() => t.filter ? JSON.stringify(t.filter) : "", [t.filter]), De = v(() => t.compareTo ? JSON.stringify(t.compareTo) : "", [t.compareTo]), Oe = v(() => t.dataset ? JSON.stringify({
1605
- d: t.dataset,
1606
- dim: t.dimensions ?? [],
1607
- val: t.values ?? []
2239
+ var ar = (e) => {
2240
+ let { schema: n } = e, a = e.onSegmentClick, o = x(rt), p = e.dataSource || o?.dataSource, h = o?.apiFetch, te = I(n.bind), { fieldOptionLabel: ue } = ke(), [de, _] = w([]), [y, we] = w(null), [De, T] = w(void 0), [je, Me] = w(() => !(Array.isArray(n.data) && n.data.length > 0) && (!!n.objectName || !!n.dataset)), [Ne, Pe] = w(null), [Fe, O] = w(null), [Ie, Le] = w(null), { openRecordList: Re } = L(), k = Ae(), { t: ze, language: Be } = Oe(), Ve = C(() => ut(n, Be).chartType, [n, Be]), He = C(() => n.aggregate ? JSON.stringify(n.aggregate) : "", [n.aggregate]), Ue = C(() => n.filter ? JSON.stringify(n.filter) : "", [n.filter]), We = C(() => n.compareTo ? JSON.stringify(n.compareTo) : "", [n.compareTo]), Ge = C(() => n.dataset ? JSON.stringify({
2241
+ d: n.dataset,
2242
+ dim: n.dimensions ?? [],
2243
+ val: n.values ?? []
1608
2244
  }) : "", [
1609
- t.dataset,
1610
- t.dimensions,
1611
- t.values
1612
- ]), ke = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
1613
- oe(() => {
2245
+ n.dataset,
2246
+ n.dimensions,
2247
+ n.values
2248
+ ]);
2249
+ S(() => {
1614
2250
  let e = !1;
1615
2251
  return (async () => {
1616
2252
  try {
1617
- let n = g ?? fetch, r = {
2253
+ let t = h ?? fetch, r = {
1618
2254
  headers: { accept: "application/json" },
1619
2255
  credentials: "include"
1620
- }, i = t.objectName, a, o = null, s = t.aggregate?.groupBy;
1621
- if (i) a = s && typeof s == "object" && !Array.isArray(s) ? s.field : typeof s == "string" ? s : t.xAxisKey;
1622
- else if (t.dataset) {
1623
- let e = Array.isArray(t.dimensions) && t.dimensions.length ? t.dimensions[0] : void 0, s = await (await n(`/api/v1/meta/dataset/${encodeURIComponent(t.dataset)}`, r)).json().catch(() => null);
2256
+ }, i = n.objectName, a, o = null;
2257
+ if (i) a = er(n);
2258
+ else if (n.dataset) {
2259
+ let e = Array.isArray(n.dimensions) && n.dimensions.length ? n.dimensions[0] : void 0, s = await (await t(`/api/v1/meta/dataset/${encodeURIComponent(n.dataset)}`, r)).json().catch(() => null);
1624
2260
  o = s?.item ?? s?.data ?? s, i = o?.object, a = ((o?.dimensions || []).find((t) => t?.name === e) ?? (o?.dimensions || [])[0])?.field ?? e;
1625
2261
  }
1626
2262
  if (!i || !a) {
1627
- e || Ce(null);
2263
+ e || Le(null);
1628
2264
  return;
1629
2265
  }
1630
- let c = async (e) => {
1631
- let t = await (await n(`/api/v1/meta/object/${encodeURIComponent(e)}`, r)).json().catch(() => null);
1632
- return t?.item ?? t?.data ?? t;
1633
- }, l = {};
1634
- if (t.dataset && Array.isArray(t.dimensions)) for (let e of t.dimensions) l[e] = (o?.dimensions || []).find((t) => t?.name === e)?.field ?? e;
1635
- let u = await f(c, i, [a, ...Object.values(l)]);
1636
- e || Ce({
1637
- metaByPath: u,
2266
+ let s = async (e) => {
2267
+ let n = await (await t(`/api/v1/meta/object/${encodeURIComponent(e)}`, r)).json().catch(() => null);
2268
+ return n?.item ?? n?.data ?? n;
2269
+ }, c = {};
2270
+ if (n.dataset && Array.isArray(n.dimensions)) for (let e of n.dimensions) c[e] = (o?.dimensions || []).find((t) => t?.name === e)?.field ?? e;
2271
+ let l = await re(s, i, [a, ...Object.values(c)]);
2272
+ e || Le({
2273
+ metaByPath: l,
1638
2274
  colorPath: a,
1639
- fieldByDim: t.dataset && Array.isArray(t.dimensions) ? l : null
2275
+ fieldByDim: n.dataset && Array.isArray(n.dimensions) ? c : null
1640
2276
  });
1641
2277
  } catch {
1642
- e || Ce(null);
2278
+ e || Le(null);
1643
2279
  }
1644
2280
  })(), () => {
1645
2281
  e = !0;
1646
2282
  };
1647
2283
  }, [
1648
- t.objectName,
1649
- t.dataset,
1650
- Oe,
1651
- Te,
1652
- t.xAxisKey,
1653
- g
2284
+ n.objectName,
2285
+ n.dataset,
2286
+ Ge,
2287
+ He,
2288
+ n.xAxisKey,
2289
+ h
1654
2290
  ]);
1655
- let { fieldOptionColors: Ae, dimensionLabels: je } = v(() => {
1656
- if (!Se) return {
2291
+ let { fieldOptionColors: Ke, dimensionLabels: qe } = C(() => {
2292
+ if (!Ie) return {
1657
2293
  fieldOptionColors: null,
1658
2294
  dimensionLabels: null
1659
2295
  };
1660
- let { metaByPath: e, colorPath: t, fieldByDim: n } = Se, i = p(e[t]?.options, c(e[t], w)), a = s(e, n ? Object.entries(n).map(([e, t]) => ({
2296
+ let { metaByPath: e, colorPath: t, fieldByDim: n } = Ie, r = ie(e[t]?.options, f(e[t], ue)), a = d(e, n ? Object.entries(n).map(([e, t]) => ({
1661
2297
  dim: e,
1662
2298
  path: t
1663
- })) : null, w);
2299
+ })) : null, ue);
1664
2300
  return {
1665
- fieldOptionColors: r(i),
2301
+ fieldOptionColors: i(r),
1666
2302
  dimensionLabels: a
1667
2303
  };
1668
- }, [Se, w]), Me = ie(async (e, n) => {
1669
- if (t.aggregate && typeof e.aggregate == "function") {
1670
- let r = t.aggregate.groupBy;
1671
- if (r && typeof r == "object" && !Array.isArray(r)) {
1672
- let i = t.aggregate.field, a = t.aggregate.function, o = {
1673
- function: a,
1674
- alias: Ut(t.aggregate)
1675
- };
1676
- a !== "count" && i && (o.field = i);
1677
- let s = await e.aggregate(t.objectName, {
1678
- groupBy: [r],
1679
- aggregations: [o],
1680
- where: n
1681
- });
1682
- return Array.isArray(s) ? s : [];
2304
+ }, [Ie, ue]), Je = b(async (e, t) => {
2305
+ if (n.aggregate && typeof e.aggregate == "function") {
2306
+ let r = n.aggregate.groupBy;
2307
+ if (ne(r)) {
2308
+ let i = await e.aggregate(n.objectName, ae(n.aggregate, r, t));
2309
+ return Array.isArray(i) ? i : [];
1683
2310
  }
1684
- let i = await e.aggregate(t.objectName, {
1685
- field: t.aggregate.field,
1686
- function: t.aggregate.function,
2311
+ let i = await e.aggregate(n.objectName, {
2312
+ field: n.aggregate.field,
2313
+ function: n.aggregate.function,
1687
2314
  groupBy: r,
1688
- filter: n
2315
+ filter: t
1689
2316
  });
1690
2317
  return Array.isArray(i) ? i : [];
1691
2318
  }
1692
2319
  if (typeof e.find == "function") {
1693
- let r = await e.find(t.objectName, { $filter: n }), i = l(r);
1694
- return t.aggregate && i.length > 0 && (i = Gt(i, t.aggregate)), i;
2320
+ let r = await e.find(n.objectName, { $filter: t }), i = m(r), a = nr(n.aggregate);
2321
+ return n.aggregate && a && i.length > 0 && (i = rr(i, {
2322
+ ...n.aggregate,
2323
+ groupBy: a
2324
+ })), i;
1695
2325
  }
1696
2326
  return [];
1697
- }, [t.objectName, Te]), Ne = Ue(), Pe = ie(async (e, n) => {
1698
- if (!e || !t.objectName && !t.dataset) {
1699
- n.current && ve(!1);
2327
+ }, [n.objectName, He]), Ye = R(), Xe = b(async (e, t) => {
2328
+ if (!e || !n.objectName && !n.dataset) {
2329
+ t.current && Me(!1);
1700
2330
  return;
1701
2331
  }
1702
- n.current && (ve(!0), be(null));
2332
+ t.current && (Me(!0), Pe(null));
1703
2333
  try {
1704
- if (t.dataset && typeof e.queryDataset == "function") {
1705
- let r = ne(t.filter, Ne), i = await e.queryDataset(t.dataset, {
1706
- dimensions: Array.isArray(t.dimensions) ? t.dimensions : [],
1707
- measures: Array.isArray(t.values) ? t.values : [],
2334
+ if (n.dataset && typeof e.queryDataset == "function") {
2335
+ let r = g(n.filter, Ye), i = await e.queryDataset(n.dataset, {
2336
+ dimensions: Array.isArray(n.dimensions) ? n.dimensions : [],
2337
+ measures: Array.isArray(n.values) ? n.values : [],
1708
2338
  ...r ? { runtimeFilter: r } : {}
1709
2339
  });
1710
- n.current && (he(Array.isArray(i?.rows) ? i.rows : []), _e(Array.isArray(i?.fields) ? i.fields : null));
2340
+ t.current && (_(Array.isArray(i?.rows) ? i.rows : []), we(Array.isArray(i?.fields) ? i.fields : null), T(typeof i?.object == "string" && i.object ? i.object : void 0));
1711
2341
  return;
1712
2342
  }
1713
- let r = ne(t.filter, Ne), i = t.compareTo, a = !!i && ke(t.chartType), o = a ? ee(re(t.filter, i), Ne) : null, [s, c] = await Promise.all([Me(e, r), o ? Me(e, o) : Promise.resolve([])]), l = s, u = t.aggregate?.groupBy, d = u && typeof u == "object" && !Array.isArray(u) ? u.alias || u.field : u || t.xAxisKey;
1714
- if (a && c.length > 0 && t.aggregate) {
1715
- let e = t.aggregate.field, n = t.aggregate.function, r = Ut(t.aggregate), i = (t) => {
1716
- if (t == null) return null;
2343
+ let r = g(n.filter, Ye), i = n.compareTo, a = !!i && !s(Ve), o = a ? se(le(n.filter, i), Ye) : null, [c, l] = await Promise.all([Je(e, r), o ? Je(e, o) : Promise.resolve([])]), u = c, d = nr(n.aggregate) || n.xAxisKey;
2344
+ if (a && l.length > 0 && n.aggregate) {
2345
+ let e = n.aggregate.field, t = n.aggregate.function, r = Qn(n.aggregate), i = (n) => {
2346
+ if (n == null) return null;
1717
2347
  if (e) {
1718
- let r = `${e}_${n}`;
1719
- if (r in t) return Number(t[r]);
1720
- if (n === "count" && `${e}_count` in t) return Number(t[`${e}_count`]);
2348
+ let r = `${e}_${t}`;
2349
+ if (r in n) return Number(n[r]);
2350
+ if (t === "count" && `${e}_count` in n) return Number(n[`${e}_count`]);
1721
2351
  }
1722
- return r in t ? Number(t[r]) : "value" in t ? Number(t.value) : "count" in t ? Number(t.count) : null;
1723
- }, a = `${r}${Wt}`, o = d;
1724
- if (o && l.some((e) => e[o] != null) && c.some((e) => e[o] != null)) {
2352
+ return r in n ? Number(n[r]) : "value" in n ? Number(n.value) : "count" in n ? Number(n.count) : null;
2353
+ }, a = `${r}${tr}`, o = d;
2354
+ if (o && u.some((e) => e[o] != null) && l.some((e) => e[o] != null)) {
1725
2355
  let e = /* @__PURE__ */ new Map();
1726
- for (let t of c) {
2356
+ for (let t of l) {
1727
2357
  let n = String(t[o] ?? "");
1728
2358
  e.set(n, i(t));
1729
2359
  }
1730
- l = l.map((t) => {
2360
+ u = u.map((t) => {
1731
2361
  let n = String(t[o] ?? ""), r = e.get(n);
1732
2362
  return r == null ? t : {
1733
2363
  ...t,
1734
2364
  [a]: r
1735
2365
  };
1736
2366
  });
1737
- let t = new Set(l.map((e) => String(e[o] ?? "")));
1738
- for (let e of c) {
2367
+ let t = new Set(u.map((e) => String(e[o] ?? "")));
2368
+ for (let e of l) {
1739
2369
  let n = String(e[o] ?? "");
1740
- t.has(n) || l.push({
2370
+ t.has(n) || u.push({
1741
2371
  [o]: n,
1742
2372
  [a]: i(e)
1743
2373
  });
1744
2374
  }
1745
2375
  } else {
1746
- let e = Math.max(l.length, c.length), t = [];
2376
+ let e = Math.max(u.length, l.length), t = [];
1747
2377
  for (let n = 0; n < e; n++) {
1748
- let e = l[n] || {}, r = c[n];
2378
+ let e = u[n] || {}, r = l[n];
1749
2379
  t.push(r ? {
1750
2380
  ...e,
1751
2381
  [a]: i(r)
1752
2382
  } : e);
1753
2383
  }
1754
- l = t;
2384
+ u = t;
1755
2385
  }
1756
2386
  }
1757
- if (d && typeof e.getObjectSchema == "function") try {
1758
- let n = await e.getObjectSchema(t.objectName);
1759
- l = await Kt(l, d, n, e, (e, n) => w(t.objectName, d, e, n));
1760
- } catch {}
1761
- n.current && he(l);
2387
+ if (d && n.objectName && typeof e.getObjectSchema == "function") {
2388
+ let t = n.objectName;
2389
+ try {
2390
+ let n = await e.getObjectSchema(t);
2391
+ u = await ir(u, d, n, e, (e, n) => ue(t, d, e, n));
2392
+ } catch {}
2393
+ }
2394
+ t.current && _(u);
1762
2395
  } catch (e) {
1763
- console.error("[ObjectChart] Fetch error:", e), n.current && be(e instanceof Error ? e.message : "Failed to load chart data");
2396
+ console.error("[ObjectChart] Fetch error:", e), t.current && Pe(e instanceof Error ? e.message : "Failed to load chart data");
1764
2397
  } finally {
1765
- n.current && ve(!1);
2398
+ t.current && Me(!1);
1766
2399
  }
1767
2400
  }, [
1768
- t.objectName,
1769
- Oe,
1770
- Te,
1771
- Ee,
1772
- De,
1773
- t.xAxisKey,
1774
- t.chartType,
1775
- Me,
1776
- Ne,
1777
- w
1778
- ]);
1779
- oe(() => {
2401
+ n.objectName,
2402
+ Ge,
2403
+ He,
2404
+ Ue,
2405
+ We,
2406
+ n.xAxisKey,
2407
+ Ve,
2408
+ Je,
2409
+ Ye,
2410
+ ue
2411
+ ]), Ze = !!(n.objectName || n.dataset) && !te && !n.data, Qe = F(Ze ? n.dataset ? De : n.objectName : void 0);
2412
+ S(() => {
1780
2413
  let e = { current: !0 };
1781
- return (t.objectName || t.dataset) && !_ && !t.data ? Pe(h, e) : e.current && ve(!1), () => {
2414
+ return Ze ? Xe(p, e) : e.current && Me(!1), () => {
1782
2415
  e.current = !1;
1783
2416
  };
1784
2417
  }, [
1785
- t.objectName,
1786
- Oe,
1787
- h,
1788
- _,
1789
- t.data,
1790
- Ee,
1791
- Te,
1792
- De,
1793
- Pe
2418
+ n.objectName,
2419
+ Ge,
2420
+ p,
2421
+ te,
2422
+ n.data,
2423
+ Ue,
2424
+ He,
2425
+ We,
2426
+ Xe,
2427
+ Qe
1794
2428
  ]);
1795
- let Fe = _ || t.data || me, A = Array.isArray(Fe) ? Fe : [], j = t.drillDown, M = t.aggregate?.groupBy || t.xAxisKey, Ie = v(() => {
2429
+ let $e = te || n.data || de, A = Array.isArray($e) ? $e : [], j = n.drillDown, M = nr(n.aggregate) || n.xAxisKey, et = C(() => {
1796
2430
  if (!M) return /* @__PURE__ */ new Map();
1797
2431
  let e = /* @__PURE__ */ new Map(), t = `__raw_${M}`;
1798
2432
  for (let n of A) {
@@ -1802,111 +2436,161 @@ var qt = (e) => {
1802
2436
  e.set(String(r), i);
1803
2437
  }
1804
2438
  return e;
1805
- }, [A, M]), Le = v(() => {
1806
- if (O) return {
1807
- ...t.filter || {},
1808
- ...o(j, O, { groupByField: M })
1809
- };
2439
+ }, [A, M]), N = C(() => {
2440
+ if (Fe) try {
2441
+ return {
2442
+ ok: !0,
2443
+ filter: l(n.filter, u(j, Fe, { groupByField: M }))
2444
+ };
2445
+ } catch (e) {
2446
+ if (!(e instanceof t)) throw e;
2447
+ return {
2448
+ ok: !1,
2449
+ refusal: e
2450
+ };
2451
+ }
1810
2452
  }, [
1811
- O,
2453
+ Fe,
1812
2454
  j,
1813
2455
  M,
1814
- Ee
1815
- ]), N = !i && !!O && !!t.objectName && j?.target === "navigate" && !!k;
1816
- oe(() => {
1817
- N && (k(t.objectName, Le), xe(null));
1818
- }, [N]);
1819
- let P = t.compareTo, Re = t.aggregate ? Ut(t.aggregate) : void 0, F = Re ? `${Re}${Wt}` : void 0, I = !!P && ke(t.chartType) && !!F && A.some((e) => e[F] != null), L = v(() => {
1820
- let e = Array.isArray(t.series) ? t.series : null;
1821
- if (!I) return e;
1822
- let n = e || [{ dataKey: Re }], r = {
2456
+ Ue
2457
+ ]), P = N?.ok ? N.filter : void 0, tt = N?.ok === !1, B = N?.ok === !1 ? N.refusal.message : void 0;
2458
+ S(() => {
2459
+ B && console.warn(`[ObjectChart] drill-down refused — the drilled list cannot be scoped: ${B}`);
2460
+ }, [B]);
2461
+ let V = !a && !!Fe && !tt && !!n.objectName && j?.target === "navigate" && !!Re;
2462
+ S(() => {
2463
+ V && (Re(n.objectName, P), O(null));
2464
+ }, [V]);
2465
+ let ot = n.compareTo, H = n.aggregate ? Qn(n.aggregate) : void 0, U = H ? `${H}${tr}` : void 0, st = !!ot && !s(Ve) && !!U && A.some((e) => e[U] != null), ct = C(() => {
2466
+ let e = Array.isArray(n.series) ? n.series : null;
2467
+ if (!st) return e;
2468
+ let t = e || [{ dataKey: H }], r = {
1823
2469
  vsLastWeek: "Previous week",
1824
2470
  vsLastMonth: "Previous month",
1825
2471
  vsLastQuarter: "Previous quarter",
1826
2472
  vsLastYear: "Previous year",
1827
2473
  vsYesterday: "Yesterday",
1828
2474
  vsPreviousPeriod: "Previous period"
1829
- }[a(P, t.filter)] || "Previous period";
1830
- return [...n.map((e) => ({
2475
+ }[c(ot, n.filter)] || "Previous period";
2476
+ return [...t.map((e) => ({
1831
2477
  ...e,
1832
2478
  variant: e.variant || "current"
1833
2479
  })), {
1834
- dataKey: F,
2480
+ dataKey: U,
1835
2481
  label: r,
1836
2482
  variant: "comparison"
1837
2483
  }];
1838
2484
  }, [
1839
- I,
1840
- t.series,
1841
- Re,
1842
- F,
1843
- t.filter,
1844
- P
1845
- ]), R = t.dataset ? n(m(A, je), t.dimensions, t.values, ge, { nullCategoryLabel: we("chart.nullCategory", "(None)") }) : null, z = R ? {
1846
- ...t,
1847
- data: R.data,
1848
- xAxisKey: R.xAxisKey,
1849
- series: R.series
2485
+ st,
2486
+ n.series,
2487
+ H,
2488
+ U,
2489
+ n.filter,
2490
+ ot
2491
+ ]), lt = n.dataset ? r(oe(A, qe), n.dimensions, n.values, y, {
2492
+ nullCategoryLabel: k("chart.nullCategory", "(None)"),
2493
+ builtinAggregateLabels: Te(k)
2494
+ }) : null, dt = !!te || Array.isArray(n.data), ft = !!n.objectName && !n.dataset && !dt, W = ft && !ut(n, Be).xAxisKey ? nr(n.aggregate) : void 0, pt = lt ? {
2495
+ ...n,
2496
+ data: lt.data,
2497
+ xAxisKey: lt.xAxisKey,
2498
+ series: lt.series
1850
2499
  } : {
1851
- ...t,
2500
+ ...n,
1852
2501
  data: A,
1853
- ...L ? { series: L } : {}
1854
- }, B = t.colors && !Array.isArray(t.colors) && typeof t.colors == "object" ? t.colors : null, V = Array.isArray(t.colors) ? t.colors : void 0, H = Ae || B ? {
1855
- ...Ae || {},
1856
- ...B || {}
1857
- } : void 0, Je = {
1858
- ...z,
1859
- colors: V,
1860
- ...H ? { categoryColors: H } : {}
2502
+ ...W ? { xAxisKey: W } : {},
2503
+ ...ct ? { series: ct } : {}
2504
+ }, G = n.colors && !Array.isArray(n.colors) && typeof n.colors == "object" ? n.colors : null, mt = Array.isArray(n.colors) ? n.colors : void 0, ht = Ke || G ? {
2505
+ ...Ke || {},
2506
+ ...G || {}
2507
+ } : void 0, gt = {
2508
+ ...pt,
2509
+ colors: mt,
2510
+ ...ht ? { categoryColors: ht } : {}
1861
2511
  };
1862
- if (D && A.length === 0) return /* @__PURE__ */ E("div", {
1863
- className: "p-2 " + (t.className || ""),
2512
+ if (ft && !er(n)) return /* @__PURE__ */ D("div", {
2513
+ className: "p-4 text-destructive " + (n.className || ""),
2514
+ "data-testid": "chart-missing-category-axis",
2515
+ role: "alert",
2516
+ children: [
2517
+ k("chart.unconfigured.noCategoryAxis", "Chart category axis required — an object-bound chart will not invent one. Declare one of:"),
2518
+ " ",
2519
+ $n.map((e, t) => /* @__PURE__ */ D(v.Fragment, { children: [t > 0 ? ", " : "", /* @__PURE__ */ E("code", {
2520
+ className: "font-mono",
2521
+ children: e
2522
+ })] }, e))
2523
+ ]
2524
+ });
2525
+ if (je && A.length === 0) return /* @__PURE__ */ D("div", {
2526
+ className: "p-2 " + (n.className || ""),
1864
2527
  "data-testid": "chart-loading",
1865
2528
  role: "status",
1866
2529
  "aria-busy": "true",
1867
2530
  "aria-live": "polite",
1868
- children: [/* @__PURE__ */ T("span", {
2531
+ children: [/* @__PURE__ */ E("span", {
1869
2532
  className: "sr-only",
1870
2533
  children: "Loading chart data…"
1871
- }), /* @__PURE__ */ T(x, { className: "h-full" })]
2534
+ }), /* @__PURE__ */ E(pe, { className: "h-full" })]
1872
2535
  });
1873
- if (ye) return /* @__PURE__ */ E("div", {
1874
- className: "flex flex-col items-center justify-center gap-2 p-4 " + (t.className || ""),
2536
+ if (Ne) return /* @__PURE__ */ D("div", {
2537
+ className: "flex flex-col items-center justify-center gap-2 p-4 " + (n.className || ""),
1875
2538
  "data-testid": "chart-error",
1876
2539
  role: "alert",
1877
2540
  children: [
1878
- /* @__PURE__ */ T(We, { className: "h-6 w-6 text-destructive opacity-60" }),
1879
- /* @__PURE__ */ T("p", {
2541
+ /* @__PURE__ */ E(z, { className: "h-6 w-6 text-destructive opacity-60" }),
2542
+ /* @__PURE__ */ E("p", {
1880
2543
  className: "text-xs text-destructive font-medium",
1881
2544
  children: "Failed to load chart data"
1882
2545
  }),
1883
- /* @__PURE__ */ T("p", {
2546
+ /* @__PURE__ */ E("p", {
1884
2547
  className: "text-xs text-muted-foreground max-w-xs text-center",
1885
- children: ye
2548
+ children: Ne
1886
2549
  })
1887
2550
  ]
1888
2551
  });
1889
- if (!h && t.objectName && A.length === 0) return /* @__PURE__ */ E("div", {
1890
- className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (t.className || ""),
2552
+ if (!p && n.objectName && A.length === 0) return /* @__PURE__ */ D("div", {
2553
+ className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (n.className || ""),
1891
2554
  "data-testid": "chart-no-datasource",
1892
2555
  children: [
1893
2556
  "No data source available for “",
1894
- t.objectName,
2557
+ n.objectName,
1895
2558
  "”"
1896
2559
  ]
1897
2560
  });
1898
- let Ye = d(j) ? (e) => {
1899
- let t = e.category, n = t != null && Ie.has(String(t)) ? Ie.get(String(t)) : t;
1900
- xe({
2561
+ if ((n.objectName || n.dataset) && !te && !n.data && A.length === 0) return /* @__PURE__ */ E(me, {
2562
+ role: "status",
2563
+ "data-testid": "chart-empty-state",
2564
+ className: "h-full w-full gap-2 p-4 [&>h3]:text-sm [&>h3]:font-medium [&>p]:text-xs " + (n.className || ""),
2565
+ icon: /* @__PURE__ */ E(at, { className: "h-5 w-5 text-muted-foreground/70" }),
2566
+ iconWrapperClassName: "flex size-9 items-center justify-center rounded-lg bg-muted",
2567
+ title: k("dashboard.empty.title", "No data yet"),
2568
+ description: k("dashboard.empty.message", "This widget loaded successfully and its query returned no records yet."),
2569
+ children: /* @__PURE__ */ D("p", {
2570
+ className: "text-xs text-muted-foreground/80",
2571
+ "data-testid": "chart-empty-source",
2572
+ children: [
2573
+ /* @__PURE__ */ E("span", { children: k("dashboard.empty.sourceLabel", "Source:") }),
2574
+ " ",
2575
+ /* @__PURE__ */ E("span", {
2576
+ className: "font-mono",
2577
+ children: n.dataset || n.objectName
2578
+ })
2579
+ ]
2580
+ })
2581
+ });
2582
+ let _t = ee(j) ? (e) => {
2583
+ let t = e.category, n = t != null && et.has(String(t)) ? et.get(String(t)) : t;
2584
+ O({
1901
2585
  ...e,
1902
2586
  category: n,
1903
2587
  categoryLabel: t,
1904
2588
  scope: "cell"
1905
2589
  });
1906
- } : void 0, Xe = i ?? Ye, Ze = !i && O && t.objectName && !N ? (() => {
1907
- let e = Le ?? {}, n = te(j, O, t.title || "Details"), r = j?.target ?? "drawer", i = {
2590
+ } : void 0, vt = a ?? _t, K = !a && Fe && !tt && n.objectName && !V ? (() => {
2591
+ let e = P ?? {}, t = ce(j, Fe, Ee(n.title, Be) || "Details"), r = j?.target ?? "drawer", i = {
1908
2592
  type: "object-data-table",
1909
- objectName: t.objectName,
2593
+ objectName: n.objectName,
1910
2594
  filter: e,
1911
2595
  pagination: !0,
1912
2596
  pageSize: j?.maxRows,
@@ -1919,75 +2603,78 @@ var qt = (e) => {
1919
2603
  mode: "record",
1920
2604
  target: "dialog"
1921
2605
  }
1922
- }, a = /* @__PURE__ */ T("div", {
2606
+ }, a = /* @__PURE__ */ E("div", {
1923
2607
  className: "overflow-auto",
1924
2608
  "data-testid": "chart-drill-body",
1925
- children: /* @__PURE__ */ T(ze, {
2609
+ children: /* @__PURE__ */ E(nt, {
1926
2610
  schema: i,
1927
- dataSource: h
2611
+ dataSource: p
1928
2612
  })
1929
- }), o = k && t.objectName ? /* @__PURE__ */ E(b, {
2613
+ }), o = Re && n.objectName ? /* @__PURE__ */ D(fe, {
1930
2614
  type: "button",
1931
2615
  variant: "ghost",
1932
2616
  size: "sm",
1933
2617
  "data-testid": "drill-open-in-list",
1934
2618
  onClick: () => {
1935
- k(t.objectName, e), xe(null);
2619
+ Re(n.objectName, e), O(null);
1936
2620
  },
1937
- children: [we("dashboard.openInList", "Open in list"), /* @__PURE__ */ T(Ge, { className: "ml-1 h-3.5 w-3.5" })]
2621
+ children: [k("dashboard.openInList", "Open in list"), /* @__PURE__ */ E(it, { className: "ml-1 h-3.5 w-3.5" })]
1938
2622
  }) : null;
1939
- return r === "dialog" ? /* @__PURE__ */ T(S, {
2623
+ return r === "dialog" ? /* @__PURE__ */ E(he, {
1940
2624
  open: !0,
1941
- onOpenChange: (e) => !e && xe(null),
1942
- children: /* @__PURE__ */ E(C, {
2625
+ onOpenChange: (e) => !e && O(null),
2626
+ children: /* @__PURE__ */ D(ge, {
1943
2627
  className: "max-w-4xl",
1944
- children: [/* @__PURE__ */ E(se, {
2628
+ children: [/* @__PURE__ */ D(_e, {
1945
2629
  className: "flex-row items-center justify-between gap-4 pr-8",
1946
- children: [/* @__PURE__ */ T(ce, { children: n }), o]
2630
+ children: [/* @__PURE__ */ E(ve, { children: t }), o]
1947
2631
  }), a]
1948
2632
  })
1949
- }) : /* @__PURE__ */ T(ue, {
2633
+ }) : /* @__PURE__ */ E(be, {
1950
2634
  open: !0,
1951
- onOpenChange: (e) => !e && xe(null),
1952
- children: /* @__PURE__ */ E(de, {
2635
+ onOpenChange: (e) => !e && O(null),
2636
+ children: /* @__PURE__ */ D(xe, {
1953
2637
  side: "right",
1954
2638
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
1955
- children: [/* @__PURE__ */ E(fe, {
2639
+ children: [/* @__PURE__ */ D(Se, {
1956
2640
  className: "flex-row items-center justify-between gap-4 pr-8",
1957
- children: [/* @__PURE__ */ T(pe, { children: n }), o]
1958
- }), /* @__PURE__ */ T("div", {
2641
+ children: [/* @__PURE__ */ E(Ce, { children: t }), o]
2642
+ }), /* @__PURE__ */ E("div", {
1959
2643
  className: "flex-1 overflow-hidden mt-2",
1960
2644
  children: a
1961
2645
  })]
1962
2646
  })
1963
2647
  });
1964
2648
  })() : null;
1965
- return /* @__PURE__ */ E("div", {
2649
+ return /* @__PURE__ */ D("div", {
1966
2650
  className: "relative h-full",
1967
2651
  children: [
1968
- /* @__PURE__ */ T(le, { active: D && A.length > 0 }),
1969
- /* @__PURE__ */ T($, {
2652
+ /* @__PURE__ */ E(ye, {
2653
+ active: je && A.length > 0,
2654
+ ariaLabel: ze("chart.refreshing")
2655
+ }),
2656
+ /* @__PURE__ */ E(Zn, {
1970
2657
  ...e,
1971
- schema: Je,
1972
- onChartClick: Xe
2658
+ schema: gt,
2659
+ onChartClick: vt
1973
2660
  }),
1974
- Ze
2661
+ K
1975
2662
  ]
1976
2663
  });
1977
- }, Jt = { filter: !0 }, Yt = (e) => /* @__PURE__ */ T(F, {
2664
+ }, or = { filter: !0 }, sr = p((e) => /* @__PURE__ */ E(tt, {
1978
2665
  schema: e.schema,
1979
- mapping: Jt,
2666
+ mapping: or,
1980
2667
  dataSource: e.dataSource,
1981
2668
  testId: "object-chart",
1982
2669
  errorTitle: "This chart’s data source could not be resolved",
1983
- children: (t) => /* @__PURE__ */ T(qt, {
2670
+ children: (t) => /* @__PURE__ */ E(ar, {
1984
2671
  ...e,
1985
2672
  schema: t
1986
2673
  })
1987
- });
2674
+ }));
1988
2675
  //#endregion
1989
2676
  //#region src/index.tsx
1990
- e.register("object-chart", Yt, {
2677
+ e.register("object-chart", sr, {
1991
2678
  namespace: "plugin-charts",
1992
2679
  label: "Object Chart",
1993
2680
  category: "view",
@@ -1995,39 +2682,34 @@ e.register("object-chart", Yt, {
1995
2682
  {
1996
2683
  name: "objectName",
1997
2684
  type: "string",
1998
- label: "Object Name",
1999
2685
  required: !0
2000
2686
  },
2001
2687
  {
2002
2688
  name: "data",
2003
2689
  type: "array",
2004
- label: "Data",
2005
2690
  description: "Optional static data"
2006
2691
  },
2007
2692
  {
2008
2693
  name: "filter",
2009
- type: "array",
2010
- label: "Filter"
2694
+ type: "array"
2011
2695
  },
2012
2696
  {
2013
2697
  name: "aggregate",
2014
2698
  type: "object",
2015
- label: "Aggregate",
2016
2699
  description: "Aggregation config: { field, function, groupBy }"
2017
2700
  },
2018
2701
  {
2019
2702
  name: "drillDown",
2020
2703
  type: "object",
2021
- label: "Drill-down",
2022
2704
  description: "Segment drill config: { enabled?, filter?, title?, target?: 'drawer' | 'dialog', columns?, maxRows? }. Present = on; {} is enough. Clicking a segment opens the underlying records filtered by the clicked category."
2023
2705
  }
2024
2706
  ]
2025
- }), rt();
2026
- var Xt = {
2027
- "bar-chart": Ht,
2028
- chart: $
2707
+ }), bt();
2708
+ var cr = {
2709
+ "bar-chart": Xn,
2710
+ chart: Zn
2029
2711
  };
2030
- e.register("bar-chart", Ht, {
2712
+ e.register("bar-chart", Xn, {
2031
2713
  namespace: "plugin-charts",
2032
2714
  label: "Bar Chart",
2033
2715
  category: "plugin",
@@ -2035,32 +2717,23 @@ e.register("bar-chart", Ht, {
2035
2717
  {
2036
2718
  name: "data",
2037
2719
  type: "array",
2038
- label: "Data",
2039
2720
  required: !0
2040
2721
  },
2041
2722
  {
2042
2723
  name: "dataKey",
2043
- type: "string",
2044
- label: "Data Key",
2045
- defaultValue: "value"
2724
+ type: "string"
2046
2725
  },
2047
2726
  {
2048
2727
  name: "xAxisKey",
2049
- type: "string",
2050
- label: "X-Axis Key",
2051
- defaultValue: "name"
2728
+ type: "string"
2052
2729
  },
2053
2730
  {
2054
2731
  name: "height",
2055
- type: "number",
2056
- label: "Height",
2057
- defaultValue: 400
2732
+ type: "number"
2058
2733
  },
2059
2734
  {
2060
2735
  name: "color",
2061
- type: "color",
2062
- label: "Color",
2063
- defaultValue: "#8884d8"
2736
+ type: "color"
2064
2737
  }
2065
2738
  ],
2066
2739
  defaultProps: {
@@ -2091,7 +2764,7 @@ e.register("bar-chart", Ht, {
2091
2764
  height: 400,
2092
2765
  color: "#8884d8"
2093
2766
  }
2094
- }), e.register("chart", Yt, {
2767
+ }), e.register("chart", sr, {
2095
2768
  namespace: "view",
2096
2769
  category: "view",
2097
2770
  label: "Chart",
@@ -2100,26 +2773,22 @@ e.register("bar-chart", Ht, {
2100
2773
  {
2101
2774
  name: "objectName",
2102
2775
  type: "string",
2103
- label: "Object Name",
2104
2776
  required: !0
2105
2777
  },
2106
2778
  {
2107
2779
  name: "type",
2108
- type: "string",
2109
- label: "Chart Type"
2780
+ type: "string"
2110
2781
  },
2111
2782
  {
2112
2783
  name: "categoryField",
2113
- type: "string",
2114
- label: "Category Field"
2784
+ type: "string"
2115
2785
  },
2116
2786
  {
2117
2787
  name: "valueField",
2118
- type: "string",
2119
- label: "Value Field"
2788
+ type: "string"
2120
2789
  }
2121
2790
  ]
2122
- }), e.register("chart", $, {
2791
+ }), e.register("chart", Zn, {
2123
2792
  namespace: "plugin-charts",
2124
2793
  label: "Chart",
2125
2794
  category: "plugin",
@@ -2127,7 +2796,6 @@ e.register("bar-chart", Ht, {
2127
2796
  {
2128
2797
  name: "chartType",
2129
2798
  type: "enum",
2130
- label: "Chart Type",
2131
2799
  enum: [
2132
2800
  {
2133
2801
  label: "Bar",
@@ -2157,36 +2825,29 @@ e.register("bar-chart", Ht, {
2157
2825
  label: "Scatter",
2158
2826
  value: "scatter"
2159
2827
  }
2160
- ],
2161
- defaultValue: "bar"
2828
+ ]
2162
2829
  },
2163
2830
  {
2164
2831
  name: "data",
2165
2832
  type: "code",
2166
- label: "Data (JSON)",
2167
2833
  required: !0
2168
2834
  },
2169
2835
  {
2170
2836
  name: "config",
2171
- type: "code",
2172
- label: "Config (JSON)"
2837
+ type: "code"
2173
2838
  },
2174
2839
  {
2175
2840
  name: "xAxisKey",
2176
- type: "string",
2177
- label: "X Axis Key",
2178
- defaultValue: "name"
2841
+ type: "string"
2179
2842
  },
2180
2843
  {
2181
2844
  name: "series",
2182
2845
  type: "code",
2183
- label: "Series (JSON Array)",
2184
2846
  required: !0
2185
2847
  },
2186
2848
  {
2187
2849
  name: "className",
2188
- type: "string",
2189
- label: "CSS Class"
2850
+ type: "string"
2190
2851
  }
2191
2852
  ],
2192
2853
  defaultProps: {
@@ -2231,31 +2892,10 @@ e.register("bar-chart", Ht, {
2231
2892
  xAxisKey: "name",
2232
2893
  series: [{ dataKey: "sales" }, { dataKey: "revenue" }]
2233
2894
  }
2234
- }), e.register("chart:bar", $, {
2895
+ }), e.register("chart:bar", Zn, {
2235
2896
  namespace: "plugin-charts",
2236
2897
  label: "Bar Chart (Alias)",
2237
- category: "plugin",
2238
- defaultProps: { chartType: "bar" }
2239
- }), e.register("pie-chart", $, {
2240
- namespace: "plugin-charts",
2241
- label: "Pie Chart",
2242
- category: "plugin",
2243
- defaultProps: { chartType: "pie" }
2244
- }), e.register("donut-chart", $, {
2245
- namespace: "plugin-charts",
2246
- label: "Donut Chart",
2247
- category: "plugin",
2248
- defaultProps: { chartType: "donut" }
2249
- }), e.register("radar-chart", $, {
2250
- namespace: "plugin-charts",
2251
- label: "Radar Chart",
2252
- category: "plugin",
2253
- defaultProps: { chartType: "radar" }
2254
- }), e.register("scatter-chart", $, {
2255
- namespace: "plugin-charts",
2256
- label: "Scatter Chart",
2257
- category: "plugin",
2258
- defaultProps: { chartType: "scatter" }
2898
+ category: "plugin"
2259
2899
  });
2260
2900
  //#endregion
2261
- export { Ht as ChartBarRenderer, $ as ChartRenderer, qt as ObjectChart, Yt as ObjectChartBlock, Xt as chartComponents, H as normalizeChartSchema };
2901
+ export { Xn as ChartBarRenderer, Zn as ChartRenderer, ar as ObjectChart, sr as ObjectChartBlock, cr as chartComponents, ut as normalizeChartSchema };