@object-ui/plugin-charts 11.0.0 → 11.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,47 +1,54 @@
1
- import { ComponentRegistry as e, buildChartSeries as t, buildOptionColorMap as n, compareToTrendLabelKey as r, computeDrillFilter as i, extractRecords as a, isDrillEnabled as o, resolveDateMacros as s, resolveDrillTitle as c, shiftFilterByCompareTo as l } from "@object-ui/core";
2
- import * as u from "react";
3
- import d, { Suspense as f, useCallback as p, useContext as m, useEffect as h, useMemo as g, useRef as ee, useState as _ } from "react";
4
- import { Button as te, Dialog as ne, DialogContent as re, DialogHeader as ie, DialogTitle as ae, RefreshIndicator as oe, Sheet as se, SheetContent as ce, SheetHeader as le, SheetTitle as v, Skeleton as y } from "@object-ui/components";
5
- import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
6
- import { Area as C, AreaChart as ue, Bar as de, BarChart as w, CartesianGrid as T, Cell as E, Funnel as fe, FunnelChart as pe, LabelList as me, Legend as D, Line as O, LineChart as k, Pie as he, PieChart as A, PolarAngleAxis as j, PolarGrid as ge, PolarRadiusAxis as _e, Radar as M, RadarChart as ve, ResponsiveContainer as N, Sankey as ye, Scatter as be, ScatterChart as P, Tooltip as F, Treemap as I, XAxis as L, YAxis as R, ZAxis as xe } from "recharts";
7
- import { SchemaRenderer as Se, SchemaRendererContext as Ce, useDataScope as z, useDrillNavigation as we } from "@object-ui/react";
8
- import { AlertCircle as Te, ArrowUpRight as B } from "lucide-react";
9
- import { useSafeFieldLabel as Ee, useSafeTranslate as De } from "@object-ui/i18n";
1
+ import { ComponentRegistry as e, buildChartSeries as t, buildDimensionLabelMap as n, buildOptionColorMap as r, compareToTrendLabelKey as i, computeDrillFilter as a, extractRecords as o, isDrillEnabled as s, relabelDimensions as c, resolveDateMacros as l, resolveDrillTitle as u, shiftFilterByCompareTo as d } from "@object-ui/core";
2
+ import * as f from "react";
3
+ import p, { Suspense as m, useCallback as h, useContext as g, useEffect as ee, useMemo as _, useRef as te, useState as v } from "react";
4
+ import { Button as ne, ChartSkeleton as re, Dialog as ie, DialogContent as ae, DialogHeader as oe, DialogTitle as se, RefreshIndicator as ce, Sheet as le, SheetContent as ue, SheetHeader as y, SheetTitle as b, Skeleton as x } from "@object-ui/components";
5
+ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
6
+ import { Area as T, AreaChart as de, Bar as fe, BarChart as E, CartesianGrid as D, Cell as O, Funnel as pe, FunnelChart as me, LabelList as he, Legend as k, Line as ge, LineChart as _e, Pie as ve, PieChart as A, PolarAngleAxis as ye, PolarGrid as be, PolarRadiusAxis as j, Radar as xe, RadarChart as M, ResponsiveContainer as N, Sankey as Se, Scatter as P, ScatterChart as F, Tooltip as I, Treemap as L, XAxis as R, YAxis as z, ZAxis as Ce } from "recharts";
7
+ import { SchemaRenderer as we, SchemaRendererContext as Te, useDataScope as B, useDrillNavigation as Ee } from "@object-ui/react";
8
+ import { AlertCircle as De, ArrowUpRight as Oe } from "lucide-react";
9
+ import { useSafeFieldLabel as ke, useSafeTranslate as Ae } from "@object-ui/i18n";
10
10
  //#region \0rolldown/runtime.js
11
- var V = Object.defineProperty, H = (e, t) => () => (e && (t = e(e = 0)), t), Oe = (e, t) => {
11
+ var V = Object.defineProperty, H = (e, t, n) => () => {
12
+ if (n) throw n[0];
13
+ try {
14
+ return e && (t = e(e = 0)), t;
15
+ } catch (e) {
16
+ throw n = [e], e;
17
+ }
18
+ }, je = (e, t) => {
12
19
  let n = {};
13
20
  for (var r in e) V(n, r, {
14
21
  get: e[r],
15
22
  enumerable: !0
16
23
  });
17
24
  return t || V(n, Symbol.toStringTag, { value: "Module" }), n;
18
- }, ke = /* @__PURE__ */ Oe({ default: () => Me });
19
- function Ae(e, t = 14) {
25
+ }, U = /* @__PURE__ */ je({ default: () => Pe });
26
+ function Me(e, t = 14) {
20
27
  return e.length > t ? `${e.slice(0, t - 1)}…` : e;
21
28
  }
22
- function je({ x: e, y: t, payload: n }) {
23
- let r = String(n?.value ?? ""), i = Ae(r);
24
- return /* @__PURE__ */ x("g", {
29
+ function Ne({ x: e, y: t, payload: n }) {
30
+ let r = String(n?.value ?? ""), i = Me(r);
31
+ return /* @__PURE__ */ C("g", {
25
32
  transform: `translate(${e},${t})`,
26
- children: /* @__PURE__ */ S("text", {
33
+ children: /* @__PURE__ */ w("text", {
27
34
  dy: 10,
28
35
  textAnchor: "end",
29
36
  transform: "rotate(-32)",
30
37
  fill: "hsl(var(--muted-foreground))",
31
38
  fontSize: 11,
32
39
  fontFamily: "monospace",
33
- children: [r !== i && /* @__PURE__ */ x("title", { children: r }), i]
40
+ children: [r !== i && /* @__PURE__ */ C("title", { children: r }), i]
34
41
  })
35
42
  });
36
43
  }
37
- function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
44
+ function Pe({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height: r = 400, className: i = "", color: a = "hsl(var(--primary))" }) {
38
45
  let o = e.map((e) => String(e?.[n] ?? "")), s = o.length > 4 || o.some((e) => e.length > 8);
39
- return /* @__PURE__ */ x("div", {
46
+ return /* @__PURE__ */ C("div", {
40
47
  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}`,
41
- children: /* @__PURE__ */ x(N, {
48
+ children: /* @__PURE__ */ C(N, {
42
49
  width: "100%",
43
50
  height: r,
44
- children: /* @__PURE__ */ S(w, {
51
+ children: /* @__PURE__ */ w(E, {
45
52
  data: e,
46
53
  margin: {
47
54
  top: 10,
@@ -50,66 +57,66 @@ function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
50
57
  bottom: s ? 24 : 5
51
58
  },
52
59
  children: [
53
- /* @__PURE__ */ S("defs", { children: [/* @__PURE__ */ S("linearGradient", {
60
+ /* @__PURE__ */ w("defs", { children: [/* @__PURE__ */ w("linearGradient", {
54
61
  id: "barGradient",
55
62
  x1: "0",
56
63
  y1: "0",
57
64
  x2: "0",
58
65
  y2: "1",
59
66
  children: [
60
- /* @__PURE__ */ x("stop", {
67
+ /* @__PURE__ */ C("stop", {
61
68
  offset: "0%",
62
69
  stopColor: a,
63
70
  stopOpacity: 1
64
71
  }),
65
- /* @__PURE__ */ x("stop", {
72
+ /* @__PURE__ */ C("stop", {
66
73
  offset: "90%",
67
74
  stopColor: a,
68
75
  stopOpacity: .6
69
76
  }),
70
- /* @__PURE__ */ x("stop", {
77
+ /* @__PURE__ */ C("stop", {
71
78
  offset: "100%",
72
79
  stopColor: a,
73
80
  stopOpacity: .3
74
81
  })
75
82
  ]
76
- }), /* @__PURE__ */ S("filter", {
83
+ }), /* @__PURE__ */ w("filter", {
77
84
  id: "glow",
78
85
  height: "130%",
79
86
  children: [
80
- /* @__PURE__ */ x("feGaussianBlur", {
87
+ /* @__PURE__ */ C("feGaussianBlur", {
81
88
  in: "SourceAlpha",
82
89
  stdDeviation: "3",
83
90
  result: "blur"
84
91
  }),
85
- /* @__PURE__ */ x("feOffset", {
92
+ /* @__PURE__ */ C("feOffset", {
86
93
  in: "blur",
87
94
  dx: "0",
88
95
  dy: "0",
89
96
  result: "offsetBlur"
90
97
  }),
91
- /* @__PURE__ */ x("feFlood", {
98
+ /* @__PURE__ */ C("feFlood", {
92
99
  floodColor: a,
93
100
  floodOpacity: "0.5",
94
101
  result: "offsetColor"
95
102
  }),
96
- /* @__PURE__ */ x("feComposite", {
103
+ /* @__PURE__ */ C("feComposite", {
97
104
  in: "offsetColor",
98
105
  in2: "offsetBlur",
99
106
  operator: "in",
100
107
  result: "offsetBlur"
101
108
  }),
102
- /* @__PURE__ */ S("feMerge", { children: [/* @__PURE__ */ x("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ x("feMergeNode", { in: "SourceGraphic" })] })
109
+ /* @__PURE__ */ w("feMerge", { children: [/* @__PURE__ */ C("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ C("feMergeNode", { in: "SourceGraphic" })] })
103
110
  ]
104
111
  })] }),
105
- /* @__PURE__ */ x(T, {
112
+ /* @__PURE__ */ C(D, {
106
113
  strokeDasharray: "3 3",
107
114
  stroke: "hsl(var(--border))",
108
115
  vertical: !1
109
116
  }),
110
- /* @__PURE__ */ x(L, {
117
+ /* @__PURE__ */ C(R, {
111
118
  dataKey: n,
112
- tick: s ? /* @__PURE__ */ x(je, {}) : {
119
+ tick: s ? /* @__PURE__ */ C(Ne, {}) : {
113
120
  fill: "hsl(var(--muted-foreground))",
114
121
  fontSize: 12,
115
122
  fontFamily: "monospace"
@@ -120,7 +127,7 @@ function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
120
127
  height: s ? 56 : void 0,
121
128
  dy: s ? void 0 : 10
122
129
  }),
123
- /* @__PURE__ */ x(R, {
130
+ /* @__PURE__ */ C(z, {
124
131
  tick: {
125
132
  fill: "hsl(var(--muted-foreground))",
126
133
  fontSize: 12,
@@ -129,7 +136,7 @@ function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
129
136
  tickLine: !1,
130
137
  axisLine: !1
131
138
  }),
132
- /* @__PURE__ */ x(F, {
139
+ /* @__PURE__ */ C(I, {
133
140
  cursor: {
134
141
  fill: "hsl(var(--muted))",
135
142
  opacity: .2
@@ -144,11 +151,11 @@ function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
144
151
  },
145
152
  itemStyle: { color: "hsl(var(--primary))" }
146
153
  }),
147
- /* @__PURE__ */ x(D, { wrapperStyle: {
154
+ /* @__PURE__ */ C(k, { wrapperStyle: {
148
155
  paddingTop: "20px",
149
156
  fontFamily: "monospace"
150
157
  } }),
151
- /* @__PURE__ */ x(de, {
158
+ /* @__PURE__ */ C(fe, {
152
159
  dataKey: t,
153
160
  fill: "url(#barGradient)",
154
161
  radius: [
@@ -165,32 +172,32 @@ function Me({ data: e = [], dataKey: t = "value", xAxisKey: n = "name", height:
165
172
  })
166
173
  });
167
174
  }
168
- var Ne = H((() => {}));
175
+ var Fe = H((() => {}));
169
176
  //#endregion
170
177
  //#region src/ChartContainerImpl.tsx
171
- function Pe() {
172
- let e = u.useContext(Le);
178
+ function Ie() {
179
+ let e = f.useContext(ze);
173
180
  if (!e) throw Error("useChart must be used within a <ChartContainer />");
174
181
  return e;
175
182
  }
176
- function U({ id: e, className: t, children: n, config: r, ...i }) {
177
- let a = u.useId(), o = `chart-${e || a.replace(/:/g, "")}`;
178
- return /* @__PURE__ */ x(Le.Provider, {
183
+ function W({ id: e, className: t, children: n, config: r, ...i }) {
184
+ let a = f.useId(), o = `chart-${e || a.replace(/:/g, "")}`;
185
+ return /* @__PURE__ */ C(ze.Provider, {
179
186
  value: { config: r },
180
- children: /* @__PURE__ */ S("div", {
187
+ children: /* @__PURE__ */ w("div", {
181
188
  "data-slot": "chart",
182
189
  "data-chart": o,
183
- className: K("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
190
+ className: q("block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
184
191
  style: {
185
192
  minHeight: 280,
186
193
  minWidth: 0,
187
194
  ...i.style
188
195
  },
189
196
  ...i,
190
- children: [/* @__PURE__ */ x(Re, {
197
+ children: [/* @__PURE__ */ C(Be, {
191
198
  id: o,
192
199
  config: r
193
- }), /* @__PURE__ */ x(N, {
200
+ }), /* @__PURE__ */ C(N, {
194
201
  width: "100%",
195
202
  height: "100%",
196
203
  children: n
@@ -198,15 +205,15 @@ function U({ id: e, className: t, children: n, config: r, ...i }) {
198
205
  })
199
206
  });
200
207
  }
201
- function W({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: o, labelFormatter: s, labelClassName: c, formatter: l, color: d, nameKey: f, labelKey: p }) {
202
- let { config: m } = Pe(), h = u.useMemo(() => {
208
+ function G({ active: e, payload: t, className: n, indicator: r = "dot", hideLabel: i = !1, hideIndicator: a = !1, label: o, labelFormatter: s, labelClassName: c, formatter: l, color: u, nameKey: d, labelKey: p }) {
209
+ let { config: m } = Ie(), h = f.useMemo(() => {
203
210
  if (i || !t?.length) return null;
204
- let [e] = t, n = Fe(m, e, `${p || e?.dataKey || e?.name || "value"}`), r = !p && typeof o == "string" ? m[o]?.label || o : n?.label;
205
- return s ? /* @__PURE__ */ x("div", {
206
- className: K("font-medium", c),
211
+ let [e] = t, n = Le(m, e, `${p || e?.dataKey || e?.name || "value"}`), r = !p && typeof o == "string" ? m[o]?.label || o : n?.label;
212
+ return s ? /* @__PURE__ */ C("div", {
213
+ className: q("font-medium", c),
207
214
  children: s(r, t)
208
- }) : r ? /* @__PURE__ */ x("div", {
209
- className: K("font-medium", c),
215
+ }) : r ? /* @__PURE__ */ C("div", {
216
+ className: q("font-medium", c),
210
217
  children: r
211
218
  }) : null;
212
219
  }, [
@@ -220,29 +227,29 @@ function W({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
220
227
  ]);
221
228
  if (!e || !t?.length) return null;
222
229
  let g = t.length === 1 && r !== "dot";
223
- return /* @__PURE__ */ S("div", {
224
- className: K("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),
225
- children: [g ? null : h, /* @__PURE__ */ x("div", {
230
+ return /* @__PURE__ */ w("div", {
231
+ className: q("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", n),
232
+ children: [g ? null : h, /* @__PURE__ */ C("div", {
226
233
  className: "grid gap-1.5",
227
234
  children: t.filter((e) => e.type !== "none").map((e, t) => {
228
- let n = Fe(m, e, `${f || e.name || e.dataKey || "value"}`), i = d || e.payload.fill || e.color;
229
- return /* @__PURE__ */ x("div", {
230
- className: K("[&>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" : ""),
231
- children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ S(b, { children: [n?.icon ? /* @__PURE__ */ x(n.icon, {}) : !a && /* @__PURE__ */ x("div", {
232
- className: K("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", r === "dot" ? "h-2.5 w-2.5" : "", r === "line" ? "w-1" : "", r === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", g && r === "dashed" ? "my-0.5" : ""),
235
+ let n = Le(m, e, `${d || e.name || e.dataKey || "value"}`), i = u || e.payload.fill || e.color;
236
+ return /* @__PURE__ */ C("div", {
237
+ className: q("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", r === "dot" ? "items-center" : ""),
238
+ children: l && e?.value !== void 0 && e.name ? l(e.value, e.name, e, t, e.payload) : /* @__PURE__ */ w(S, { children: [n?.icon ? /* @__PURE__ */ C(n.icon, {}) : !a && /* @__PURE__ */ C("div", {
239
+ className: q("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", r === "dot" ? "h-2.5 w-2.5" : "", r === "line" ? "w-1" : "", r === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", g && r === "dashed" ? "my-0.5" : ""),
233
240
  style: {
234
241
  "--color-bg": i,
235
242
  "--color-border": i
236
243
  }
237
- }), /* @__PURE__ */ S("div", {
238
- className: K("flex flex-1 justify-between leading-none", g ? "items-end" : "items-center"),
239
- children: [/* @__PURE__ */ S("div", {
244
+ }), /* @__PURE__ */ w("div", {
245
+ className: q("flex flex-1 justify-between leading-none", g ? "items-end" : "items-center"),
246
+ children: [/* @__PURE__ */ w("div", {
240
247
  className: "grid gap-1.5",
241
- children: [g ? h : null, /* @__PURE__ */ x("span", {
248
+ children: [g ? h : null, /* @__PURE__ */ C("span", {
242
249
  className: "text-muted-foreground",
243
250
  children: n?.label || e.name
244
251
  })]
245
- }), e.value && /* @__PURE__ */ x("span", {
252
+ }), e.value && /* @__PURE__ */ C("span", {
246
253
  className: "text-foreground font-mono font-medium tabular-nums",
247
254
  children: e.value.toLocaleString()
248
255
  })]
@@ -252,15 +259,15 @@ function W({ active: e, payload: t, className: n, indicator: r = "dot", hideLabe
252
259
  })]
253
260
  });
254
261
  }
255
- function G({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
256
- let { config: a } = Pe();
257
- return n?.length ? /* @__PURE__ */ x("div", {
258
- className: K("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
262
+ function K({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bottom", nameKey: i }) {
263
+ let { config: a } = Ie();
264
+ return n?.length ? /* @__PURE__ */ C("div", {
265
+ className: q("flex items-center justify-center gap-4", r === "top" ? "pb-3" : "pt-3", e),
259
266
  children: n.filter((e) => e.type !== "none").map((e) => {
260
- let n = Fe(a, e, `${i || e.dataKey || "value"}`);
261
- return /* @__PURE__ */ S("div", {
262
- className: K("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
263
- children: [n?.icon && !t ? /* @__PURE__ */ x(n.icon, {}) : /* @__PURE__ */ x("div", {
267
+ let n = Le(a, e, `${i || e.dataKey || "value"}`);
268
+ return /* @__PURE__ */ w("div", {
269
+ className: q("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
270
+ children: [n?.icon && !t ? /* @__PURE__ */ C(n.icon, {}) : /* @__PURE__ */ C("div", {
264
271
  className: "h-2 w-2 shrink-0 rounded-[2px]",
265
272
  style: { backgroundColor: e.color }
266
273
  }), n?.label]
@@ -268,18 +275,18 @@ function G({ className: e, hideIcon: t = !1, payload: n, verticalAlign: r = "bot
268
275
  })
269
276
  }) : null;
270
277
  }
271
- function Fe(e, t, n) {
278
+ function Le(e, t, n) {
272
279
  if (typeof t != "object" || !t) return;
273
280
  let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
274
281
  return n in t && typeof t[n] == "string" ? i = t[n] : r && n in r && typeof r[n] == "string" && (i = r[n]), i in e ? e[i] : e[n];
275
282
  }
276
- var K, Ie, Le, Re, q, J, ze = H((() => {
277
- K = (...e) => e.filter(Boolean).join(" "), Ie = {
283
+ var q, Re, ze, Be, J, Y, Ve = H((() => {
284
+ q = (...e) => e.filter(Boolean).join(" "), Re = {
278
285
  light: "",
279
286
  dark: ".dark"
280
- }, Le = u.createContext(null), Re = ({ id: e, config: t }) => {
287
+ }, ze = f.createContext(null), Be = ({ id: e, config: t }) => {
281
288
  let n = Object.entries(t).filter(([, e]) => e.theme || e.color);
282
- return n.length ? /* @__PURE__ */ x("style", { dangerouslySetInnerHTML: { __html: Object.entries(Ie).map(([t, r]) => `
289
+ return n.length ? /* @__PURE__ */ C("style", { dangerouslySetInnerHTML: { __html: Object.entries(Re).map(([t, r]) => `
283
290
  ${r} [data-chart=${e}] {
284
291
  ${n.map(([e, n]) => {
285
292
  let r = n.theme?.[t] || n.color;
@@ -287,47 +294,47 @@ ${n.map(([e, n]) => {
287
294
  }).join("\n")}
288
295
  }
289
296
  `).join("\n") } }) : null;
290
- }, q = F, J = D;
297
+ }, J = I, Y = k;
291
298
  }));
292
299
  //#endregion
293
300
  //#region src/chartDrillEvents.ts
294
- function Be(e) {
301
+ function He(e) {
295
302
  return e?.[0]?.dataKey || "value";
296
303
  }
297
- function Ve(e, t, n) {
304
+ function Ue(e, t, n) {
298
305
  if (!e) return null;
299
306
  let r = e.payload ?? e, i = r?.[t];
300
307
  if (i == null) return null;
301
- let a = Be(n);
308
+ let a = He(n);
302
309
  return {
303
310
  category: String(i),
304
311
  series: a,
305
312
  value: typeof r?.[a] == "number" ? r[a] : void 0
306
313
  };
307
314
  }
308
- function He(e, t) {
315
+ function We(e, t) {
309
316
  if (!e) return null;
310
317
  let n = e.name ?? e.payload?.name ?? e.root?.name;
311
318
  if (n == null) return null;
312
319
  let r = e.value ?? e.size ?? e.payload?.size;
313
320
  return {
314
321
  category: String(n),
315
- series: Be(t),
322
+ series: He(t),
316
323
  value: typeof r == "number" ? r : void 0
317
324
  };
318
325
  }
319
- function Ue(e, t) {
326
+ function Ge(e, t) {
320
327
  if (!e) return null;
321
328
  let n = e.payload ?? e, r = n?.name;
322
329
  return r == null || n?.depth === 0 ? null : {
323
330
  category: String(r),
324
- series: Be(t),
331
+ series: He(t),
325
332
  value: typeof n?.value == "number" ? n.value : void 0
326
333
  };
327
334
  }
328
- var We = H((() => {})), Ge = /* @__PURE__ */ Oe({ default: () => Ke });
329
- function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r = "name", series: i = [], className: a = "", colors: o, categoryColors: s, onChartClick: c, isAnimationActive: l }) {
330
- let d = e === "column" ? "bar" : e, f = Array.isArray(t) ? t : [], p = l === !1 ? { isAnimationActive: !1 } : {}, [m, h] = u.useState(!1), g = u.useCallback((e) => {
335
+ var Ke = H((() => {})), qe = /* @__PURE__ */ je({ default: () => Je });
336
+ function Je({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r = "name", series: i = [], className: a = "", colors: o, categoryColors: s, onChartClick: c, isAnimationActive: l }) {
337
+ let u = e === "column" ? "bar" : e, d = Array.isArray(t) ? t : [], p = l === !1 ? { isAnimationActive: !1 } : {}, [m, h] = f.useState(!1), g = f.useCallback((e) => {
331
338
  if (!c || !e) return;
332
339
  let t = Array.isArray(e.activePayload) ? e.activePayload[0] : void 0;
333
340
  c({
@@ -335,7 +342,7 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
335
342
  series: t?.dataKey ? String(t.dataKey) : void 0,
336
343
  value: typeof t?.value == "number" ? t.value : void 0
337
344
  });
338
- }, [c]), ee = u.useCallback((e) => {
345
+ }, [c]), ee = f.useCallback((e) => {
339
346
  if (!c || !e) return;
340
347
  let t = e.payload?.[r], n = i[0]?.dataKey || "value";
341
348
  c({
@@ -353,56 +360,56 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
353
360
  } : {}, te = c ? {
354
361
  onClick: ee,
355
362
  style: { cursor: "pointer" }
356
- } : {}, ne = u.useCallback((e, t, n) => s && s[e == null ? "" : String(e)] || n[t % n.length], [s]), re = u.useCallback((e) => {
363
+ } : {}, v = f.useCallback((e, t, n) => s && s[e == null ? "" : String(e)] || n[t % n.length], [s]), ne = f.useCallback((e) => {
357
364
  if (!c) return;
358
- let t = Ve(e, r, i);
365
+ let t = Ue(e, r, i);
359
366
  t && c(t);
360
367
  }, [
361
368
  c,
362
369
  r,
363
370
  i
364
- ]), ie = u.useCallback((e) => {
371
+ ]), re = f.useCallback((e) => {
365
372
  if (!c) return;
366
- let t = He(e, i);
373
+ let t = We(e, i);
367
374
  t && c(t);
368
- }, [c, i]), ae = u.useCallback((e) => {
375
+ }, [c, i]), ie = f.useCallback((e) => {
369
376
  if (!c) return;
370
- let t = Ue(e, i);
377
+ let t = Ge(e, i);
371
378
  t && c(t);
372
- }, [c, i]), oe = c ? {
373
- onClick: re,
379
+ }, [c, i]), ae = c ? {
380
+ onClick: ne,
374
381
  cursor: "pointer"
382
+ } : {}, oe = c ? {
383
+ onClick: re,
384
+ style: { cursor: "pointer" }
375
385
  } : {}, se = c ? {
376
386
  onClick: ie,
377
387
  style: { cursor: "pointer" }
378
- } : {}, ce = c ? {
379
- onClick: ae,
380
- style: { cursor: "pointer" }
381
388
  } : {};
382
- u.useEffect(() => {
389
+ f.useEffect(() => {
383
390
  let e = () => h(window.innerWidth < 640);
384
391
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
385
392
  }, []);
386
- let le = {
387
- bar: w,
388
- "horizontal-bar": w,
389
- line: k,
390
- area: ue,
393
+ let ce = {
394
+ bar: E,
395
+ "horizontal-bar": E,
396
+ line: _e,
397
+ area: de,
391
398
  pie: A,
392
399
  donut: A,
393
- radar: ve,
394
- scatter: P,
395
- funnel: pe,
396
- combo: w,
397
- treemap: w,
398
- sankey: w
399
- }[d] || w, v = u.useCallback((e) => {
400
+ radar: M,
401
+ scatter: F,
402
+ funnel: me,
403
+ combo: E,
404
+ treemap: E,
405
+ sankey: E
406
+ }[u] || E, le = f.useCallback((e) => {
400
407
  if (e == null || e === "") return "";
401
408
  let t = typeof e == "string" ? e : String(e);
402
409
  if (/^\d{4}-\d{2}-\d{2}/.test(t)) {
403
410
  let e = new Date(t);
404
411
  if (!Number.isNaN(e.getTime())) {
405
- let t = (f.length > 1 ? Math.abs(new Date(String(f[f.length - 1][r] ?? "")).getTime() - new Date(String(f[0][r] ?? "")).getTime()) : 0) / (1e3 * 60 * 60 * 24);
412
+ let t = (d.length > 1 ? Math.abs(new Date(String(d[d.length - 1][r] ?? "")).getTime() - new Date(String(d[0][r] ?? "")).getTime()) : 0) / (1e3 * 60 * 60 * 24);
406
413
  try {
407
414
  return t <= 62 ? e.toLocaleDateString(void 0, {
408
415
  month: "short",
@@ -418,16 +425,16 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
418
425
  }
419
426
  return m && t.length > 8 ? t.slice(0, 8) + "…" : t;
420
427
  }, [
421
- f,
428
+ d,
422
429
  r,
423
430
  m
424
- ]), y = u.useMemo(() => f.some((e) => String(e[r] || "").length > 5), [f, r]), D = () => Array.isArray(o) && o.length > 0 ? o : [
431
+ ]), ue = f.useMemo(() => d.some((e) => String(e[r] || "").length > 5), [d, r]), y = () => Array.isArray(o) && o.length > 0 ? o : [
425
432
  "hsl(var(--chart-1))",
426
433
  "hsl(var(--chart-2))",
427
434
  "hsl(var(--chart-3))",
428
435
  "hsl(var(--chart-4))",
429
436
  "hsl(var(--chart-5))"
430
- ], N = u.useCallback((e) => {
437
+ ], b = f.useCallback((e) => {
431
438
  if (e == null || e === "") return "";
432
439
  let t = typeof e == "number" ? e : Number(e);
433
440
  if (!Number.isFinite(t)) return String(e);
@@ -439,43 +446,43 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
439
446
  } catch {
440
447
  return String(t);
441
448
  }
442
- }, []), Se = u.useMemo(() => ({
449
+ }, []), x = f.useMemo(() => ({
443
450
  tickLine: !1,
444
451
  tickMargin: 10,
445
452
  axisLine: !1,
446
453
  interval: "preserveStartEnd",
447
454
  minTickGap: m ? 32 : 48,
448
- tickFormatter: v,
449
- ...!m && y && {
455
+ tickFormatter: le,
456
+ ...!m && ue && {
450
457
  angle: -35,
451
458
  textAnchor: "end",
452
459
  height: 60
453
460
  }
454
461
  }), [
455
462
  m,
456
- y,
457
- v
463
+ ue,
464
+ le
458
465
  ]);
459
- if (d === "pie" || d === "donut") {
460
- let e = d === "donut" ? "52%" : 0, t = D(), o = { ...n };
461
- return f.forEach((e, n) => {
466
+ if (u === "pie" || u === "donut") {
467
+ let e = u === "donut" ? "52%" : 0, t = y(), o = { ...n };
468
+ return d.forEach((e, n) => {
462
469
  let i = e?.[r];
463
470
  if (i == null || i === "") return;
464
471
  let a = String(i);
465
472
  o[a] || (o[a] = {
466
473
  label: a,
467
- color: ne(i, n, t)
474
+ color: v(i, n, t)
468
475
  });
469
- }), /* @__PURE__ */ x(U, {
476
+ }), /* @__PURE__ */ C(W, {
470
477
  config: o,
471
478
  className: a,
472
- children: /* @__PURE__ */ S(A, { children: [
473
- /* @__PURE__ */ x(q, {
479
+ children: /* @__PURE__ */ w(A, { children: [
480
+ /* @__PURE__ */ C(J, {
474
481
  cursor: !1,
475
- content: /* @__PURE__ */ x(W, { hideLabel: !0 })
482
+ content: /* @__PURE__ */ C(G, { hideLabel: !0 })
476
483
  }),
477
- /* @__PURE__ */ x(he, {
478
- data: f,
484
+ /* @__PURE__ */ C(ve, {
485
+ data: d,
479
486
  dataKey: i[0]?.dataKey || "value",
480
487
  nameKey: r || "name",
481
488
  innerRadius: e,
@@ -484,15 +491,15 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
484
491
  outerRadius: "85%",
485
492
  ...p,
486
493
  ...te,
487
- children: f.map((e, n) => /* @__PURE__ */ x(E, { fill: X(ne(e?.[r], n, t)) }, `cell-${n}`))
494
+ children: d.map((e, n) => /* @__PURE__ */ C(O, { fill: Z(v(e?.[r], n, t)) }, `cell-${n}`))
488
495
  }),
489
- /* @__PURE__ */ x(J, {
496
+ /* @__PURE__ */ C(Y, {
490
497
  verticalAlign: "bottom",
491
498
  wrapperStyle: {
492
499
  fontSize: m ? "11px" : "12px",
493
500
  paddingTop: "8px"
494
501
  },
495
- content: /* @__PURE__ */ x(G, {
502
+ content: /* @__PURE__ */ C(K, {
496
503
  nameKey: r,
497
504
  className: "flex-wrap"
498
505
  })
@@ -500,8 +507,8 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
500
507
  ] })
501
508
  });
502
509
  }
503
- if (d === "funnel") {
504
- let e = i[0]?.dataKey || "value", t = D(), o = c ? (t) => {
510
+ if (u === "funnel") {
511
+ let e = i[0]?.dataKey || "value", t = y(), o = c ? (t) => {
505
512
  t && c({
506
513
  category: t?.payload?.[r] ?? t?.[r],
507
514
  value: t?.payload?.[e] ?? t?.[e]
@@ -509,45 +516,45 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
509
516
  } : void 0, s = o ? {
510
517
  onClick: o,
511
518
  style: { cursor: "pointer" }
512
- } : {}, l = [...f].sort((t, n) => {
519
+ } : {}, l = [...d].sort((t, n) => {
513
520
  let r = Number(t?.[e] ?? 0);
514
521
  return Number(n?.[e] ?? 0) - r;
515
522
  });
516
- return /* @__PURE__ */ x(U, {
523
+ return /* @__PURE__ */ C(W, {
517
524
  config: n,
518
525
  className: a,
519
- children: /* @__PURE__ */ S(pe, { children: [/* @__PURE__ */ x(q, { content: /* @__PURE__ */ x(W, {}) }), /* @__PURE__ */ S(fe, {
526
+ children: /* @__PURE__ */ w(me, { children: [/* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }), /* @__PURE__ */ w(pe, {
520
527
  dataKey: e,
521
528
  data: l,
522
529
  nameKey: r,
523
530
  isAnimationActive: !0,
524
531
  ...s,
525
- children: [/* @__PURE__ */ x(me, {
532
+ children: [/* @__PURE__ */ C(he, {
526
533
  position: "right",
527
534
  fill: "hsl(var(--foreground))",
528
535
  stroke: "none",
529
536
  dataKey: r
530
- }), l.map((e, n) => /* @__PURE__ */ x(E, { fill: X(t[n % t.length]) }, `funnel-cell-${n}`))]
537
+ }), l.map((e, n) => /* @__PURE__ */ C(O, { fill: Z(t[n % t.length]) }, `funnel-cell-${n}`))]
531
538
  })] })
532
539
  });
533
540
  }
534
- if (d === "treemap") {
535
- let e = i[0]?.dataKey || "value", t = D();
536
- return /* @__PURE__ */ x(U, {
541
+ if (u === "treemap") {
542
+ let e = i[0]?.dataKey || "value", t = y();
543
+ return /* @__PURE__ */ C(W, {
537
544
  config: n,
538
545
  className: a,
539
- children: /* @__PURE__ */ x(I, {
540
- data: f.map((n, i) => ({
546
+ children: /* @__PURE__ */ C(L, {
547
+ data: d.map((n, i) => ({
541
548
  name: String(n?.[r] ?? ""),
542
549
  size: Number(n?.[e]) || 0,
543
- fill: X(t[i % t.length])
550
+ fill: Z(t[i % t.length])
544
551
  })),
545
552
  dataKey: "size",
546
553
  nameKey: "name",
547
554
  isAnimationActive: !0,
548
- content: /* @__PURE__ */ x((e) => {
555
+ content: /* @__PURE__ */ C((e) => {
549
556
  let { x: t, y: n, width: r, height: i, name: a, fill: o } = e;
550
- return r <= 0 || i <= 0 ? null : /* @__PURE__ */ S("g", { children: [/* @__PURE__ */ x("rect", {
557
+ return r <= 0 || i <= 0 ? null : /* @__PURE__ */ w("g", { children: [/* @__PURE__ */ C("rect", {
551
558
  x: t,
552
559
  y: n,
553
560
  width: r,
@@ -555,7 +562,7 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
555
562
  fill: o,
556
563
  stroke: "hsl(var(--background))",
557
564
  strokeWidth: 2
558
- }), r > 48 && i > 18 ? /* @__PURE__ */ x("text", {
565
+ }), r > 48 && i > 18 ? /* @__PURE__ */ C("text", {
559
566
  x: t + 6,
560
567
  y: n + 18,
561
568
  fill: "#fff",
@@ -564,21 +571,21 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
564
571
  children: a
565
572
  }) : null] });
566
573
  }, {}),
567
- ...se,
568
- children: /* @__PURE__ */ x(F, {})
574
+ ...oe,
575
+ children: /* @__PURE__ */ C(I, {})
569
576
  })
570
577
  });
571
578
  }
572
- if (d === "sankey") {
573
- let e = i[0]?.dataKey || "value", t = i[0]?.label || e, o = f.filter((t) => (Number(t?.[e]) || 0) > 0), s = [{ name: t }, ...o.map((e) => ({ name: String(e?.[r] ?? "") }))], c = o.map((t, n) => ({
579
+ if (u === "sankey") {
580
+ let e = i[0]?.dataKey || "value", t = i[0]?.label || e, o = d.filter((t) => (Number(t?.[e]) || 0) > 0), s = [{ name: t }, ...o.map((e) => ({ name: String(e?.[r] ?? "") }))], c = o.map((t, n) => ({
574
581
  source: 0,
575
582
  target: n + 1,
576
583
  value: Number(t?.[e]) || 0
577
584
  }));
578
- return c.length === 0 ? /* @__PURE__ */ x("div", { className: a }) : /* @__PURE__ */ x(U, {
585
+ return c.length === 0 ? /* @__PURE__ */ C("div", { className: a }) : /* @__PURE__ */ C(W, {
579
586
  config: n,
580
587
  className: a,
581
- children: /* @__PURE__ */ x(ye, {
588
+ children: /* @__PURE__ */ C(Se, {
582
589
  data: {
583
590
  nodes: s,
584
591
  links: c
@@ -589,23 +596,23 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
589
596
  strokeOpacity: .25
590
597
  },
591
598
  node: { fill: "hsl(var(--chart-1))" },
592
- ...ce,
593
- children: /* @__PURE__ */ x(F, {})
599
+ ...se,
600
+ children: /* @__PURE__ */ C(I, {})
594
601
  })
595
602
  });
596
603
  }
597
- if (d === "radar") return /* @__PURE__ */ x(U, {
604
+ if (u === "radar") return /* @__PURE__ */ C(W, {
598
605
  config: n,
599
606
  className: a,
600
- children: /* @__PURE__ */ S(ve, {
601
- data: f,
607
+ children: /* @__PURE__ */ w(M, {
608
+ data: d,
602
609
  children: [
603
- /* @__PURE__ */ x(ge, {}),
604
- /* @__PURE__ */ x(j, { dataKey: r }),
605
- /* @__PURE__ */ x(_e, {}),
606
- /* @__PURE__ */ x(q, { content: /* @__PURE__ */ x(W, {}) }),
607
- /* @__PURE__ */ x(J, {
608
- content: /* @__PURE__ */ x(G, {}),
610
+ /* @__PURE__ */ C(be, {}),
611
+ /* @__PURE__ */ C(ye, { dataKey: r }),
612
+ /* @__PURE__ */ C(j, {}),
613
+ /* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }),
614
+ /* @__PURE__ */ C(Y, {
615
+ content: /* @__PURE__ */ C(K, {}),
609
616
  ...m && {
610
617
  verticalAlign: "bottom",
611
618
  wrapperStyle: {
@@ -615,8 +622,8 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
615
622
  }
616
623
  }),
617
624
  i.map((e) => {
618
- let t = X(n[e.dataKey]?.color || Y);
619
- return /* @__PURE__ */ x(M, {
625
+ let t = Z(n[e.dataKey]?.color || X);
626
+ return /* @__PURE__ */ C(xe, {
620
627
  dataKey: e.dataKey,
621
628
  stroke: t,
622
629
  fill: t,
@@ -626,12 +633,12 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
626
633
  ]
627
634
  })
628
635
  });
629
- if (d === "scatter") return /* @__PURE__ */ x(U, {
636
+ if (u === "scatter") return /* @__PURE__ */ C(W, {
630
637
  config: n,
631
638
  className: a,
632
- children: /* @__PURE__ */ S(P, { children: [
633
- /* @__PURE__ */ x(T, { vertical: !1 }),
634
- /* @__PURE__ */ x(L, {
639
+ children: /* @__PURE__ */ w(F, { children: [
640
+ /* @__PURE__ */ C(D, { vertical: !1 }),
641
+ /* @__PURE__ */ C(R, {
635
642
  type: "number",
636
643
  dataKey: r,
637
644
  name: String(n[r]?.label || r),
@@ -639,22 +646,22 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
639
646
  axisLine: !1,
640
647
  minTickGap: m ? 32 : 48
641
648
  }),
642
- /* @__PURE__ */ x(R, {
649
+ /* @__PURE__ */ C(z, {
643
650
  type: "number",
644
651
  dataKey: i[0]?.dataKey || "value",
645
652
  name: String(n[i[0]?.dataKey]?.label || i[0]?.dataKey),
646
653
  tickLine: !1,
647
654
  axisLine: !1,
648
- tickFormatter: N,
655
+ tickFormatter: b,
649
656
  width: 48
650
657
  }),
651
- /* @__PURE__ */ x(xe, {
658
+ /* @__PURE__ */ C(Ce, {
652
659
  type: "number",
653
660
  range: [60, 400]
654
661
  }),
655
- /* @__PURE__ */ x(q, { content: /* @__PURE__ */ x(W, {}) }),
656
- /* @__PURE__ */ x(J, {
657
- content: /* @__PURE__ */ x(G, {}),
662
+ /* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }),
663
+ /* @__PURE__ */ C(Y, {
664
+ content: /* @__PURE__ */ C(K, {}),
658
665
  ...m && {
659
666
  verticalAlign: "bottom",
660
667
  wrapperStyle: {
@@ -664,46 +671,46 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
664
671
  }
665
672
  }),
666
673
  i.map((e, t) => {
667
- let r = D(), i = X(n[e.dataKey]?.color || r[t % r.length]), a = Z(e, "scatter");
668
- return /* @__PURE__ */ x(be, {
674
+ let r = y(), i = Z(n[e.dataKey]?.color || r[t % r.length]), a = Q(e, "scatter");
675
+ return /* @__PURE__ */ C(P, {
669
676
  name: n[e.dataKey]?.label || e.dataKey,
670
- data: f,
677
+ data: d,
671
678
  fill: i,
672
679
  fillOpacity: a?.fillOpacity,
673
- ...oe
680
+ ...ae
674
681
  }, e.dataKey);
675
682
  })
676
683
  ] })
677
684
  });
678
- if (d === "combo") return /* @__PURE__ */ x(U, {
685
+ if (u === "combo") return /* @__PURE__ */ C(W, {
679
686
  config: n,
680
687
  className: a,
681
- children: /* @__PURE__ */ S(w, {
682
- data: f,
688
+ children: /* @__PURE__ */ w(E, {
689
+ data: d,
683
690
  children: [
684
- /* @__PURE__ */ x(T, { vertical: !1 }),
685
- /* @__PURE__ */ x(L, {
691
+ /* @__PURE__ */ C(D, { vertical: !1 }),
692
+ /* @__PURE__ */ C(R, {
686
693
  dataKey: r,
687
- ...Se
694
+ ...x
688
695
  }),
689
- /* @__PURE__ */ x(R, {
696
+ /* @__PURE__ */ C(z, {
690
697
  yAxisId: "left",
691
698
  tickLine: !1,
692
699
  axisLine: !1,
693
- tickFormatter: N,
700
+ tickFormatter: b,
694
701
  width: 48
695
702
  }),
696
- /* @__PURE__ */ x(R, {
703
+ /* @__PURE__ */ C(z, {
697
704
  yAxisId: "right",
698
705
  orientation: "right",
699
706
  tickLine: !1,
700
707
  axisLine: !1,
701
- tickFormatter: N,
708
+ tickFormatter: b,
702
709
  width: 48
703
710
  }),
704
- /* @__PURE__ */ x(q, { content: /* @__PURE__ */ x(W, {}) }),
705
- /* @__PURE__ */ x(J, {
706
- content: /* @__PURE__ */ x(G, {}),
711
+ /* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }),
712
+ /* @__PURE__ */ C(Y, {
713
+ content: /* @__PURE__ */ C(K, {}),
707
714
  ...m && {
708
715
  verticalAlign: "bottom",
709
716
  wrapperStyle: {
@@ -713,8 +720,8 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
713
720
  }
714
721
  }),
715
722
  i.map((e, t) => {
716
- let r = X(n[e.dataKey]?.color || Y), i = e.chartType || (t === 0 ? "bar" : "line"), a = i === "bar" ? "left" : "right", o = Z(e, i);
717
- return i === "line" ? /* @__PURE__ */ x(O, {
723
+ let r = Z(n[e.dataKey]?.color || X), i = e.chartType || (t === 0 ? "bar" : "line"), a = i === "bar" ? "left" : "right", o = Q(e, i);
724
+ return i === "line" ? /* @__PURE__ */ C(ge, {
718
725
  yAxisId: a,
719
726
  type: "monotone",
720
727
  dataKey: e.dataKey,
@@ -724,7 +731,7 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
724
731
  strokeOpacity: o?.strokeOpacity,
725
732
  strokeDasharray: o?.strokeDasharray,
726
733
  ...p
727
- }, e.dataKey) : i === "area" ? /* @__PURE__ */ x(C, {
734
+ }, e.dataKey) : i === "area" ? /* @__PURE__ */ C(T, {
728
735
  yAxisId: a,
729
736
  type: "monotone",
730
737
  dataKey: e.dataKey,
@@ -734,7 +741,7 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
734
741
  strokeOpacity: o?.strokeOpacity,
735
742
  strokeDasharray: o?.strokeDasharray,
736
743
  ...p
737
- }, e.dataKey) : /* @__PURE__ */ x(de, {
744
+ }, e.dataKey) : /* @__PURE__ */ C(fe, {
738
745
  yAxisId: a,
739
746
  dataKey: e.dataKey,
740
747
  fill: r,
@@ -746,75 +753,75 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
746
753
  ]
747
754
  })
748
755
  });
749
- let Ce = d === "horizontal-bar", z = D(), we = s ? Object.values(s).map((e) => X(String(e))) : [], Te = Array.from(new Set([
750
- ...z,
756
+ let k = u === "horizontal-bar", N = y(), we = s ? Object.values(s).map((e) => Z(String(e))) : [], Te = Array.from(/* @__PURE__ */ new Set([
757
+ ...N,
751
758
  ...we,
752
- ...i.map((e, t) => X(n[e.dataKey]?.color || z[t % z.length] || Y))
759
+ ...i.map((e, t) => Z(n[e.dataKey]?.color || N[t % N.length] || X))
753
760
  ])), B = (e) => "g" + e.replace(/[^a-zA-Z0-9]/g, "");
754
- return /* @__PURE__ */ x(U, {
761
+ return /* @__PURE__ */ C(W, {
755
762
  config: n,
756
763
  className: a,
757
- children: /* @__PURE__ */ S(le, {
758
- data: f,
759
- layout: Ce ? "vertical" : "horizontal",
764
+ children: /* @__PURE__ */ w(ce, {
765
+ data: d,
766
+ layout: k ? "vertical" : "horizontal",
760
767
  ..._,
761
768
  children: [
762
- /* @__PURE__ */ x("defs", { children: Te.map((e) => /* @__PURE__ */ S(u.Fragment, { children: [/* @__PURE__ */ S("linearGradient", {
769
+ /* @__PURE__ */ C("defs", { children: Te.map((e) => /* @__PURE__ */ w(f.Fragment, { children: [/* @__PURE__ */ w("linearGradient", {
763
770
  id: `bg-${B(e)}`,
764
771
  x1: "0",
765
772
  y1: "0",
766
773
  x2: "0",
767
774
  y2: "1",
768
- children: [/* @__PURE__ */ x("stop", {
775
+ children: [/* @__PURE__ */ C("stop", {
769
776
  offset: "0%",
770
777
  style: { stopColor: e },
771
778
  stopOpacity: .95
772
- }), /* @__PURE__ */ x("stop", {
779
+ }), /* @__PURE__ */ C("stop", {
773
780
  offset: "100%",
774
781
  style: { stopColor: e },
775
782
  stopOpacity: .5
776
783
  })]
777
- }), /* @__PURE__ */ S("linearGradient", {
784
+ }), /* @__PURE__ */ w("linearGradient", {
778
785
  id: `ag-${B(e)}`,
779
786
  x1: "0",
780
787
  y1: "0",
781
788
  x2: "0",
782
789
  y2: "1",
783
- children: [/* @__PURE__ */ x("stop", {
790
+ children: [/* @__PURE__ */ C("stop", {
784
791
  offset: "0%",
785
792
  style: { stopColor: e },
786
793
  stopOpacity: .5
787
- }), /* @__PURE__ */ x("stop", {
794
+ }), /* @__PURE__ */ C("stop", {
788
795
  offset: "95%",
789
796
  style: { stopColor: e },
790
797
  stopOpacity: .05
791
798
  })]
792
799
  })] }, B(e))) }),
793
- /* @__PURE__ */ x(T, { vertical: !1 }),
794
- Ce ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(L, {
800
+ /* @__PURE__ */ C(D, { vertical: !1 }),
801
+ k ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(R, {
795
802
  type: "number",
796
803
  tickLine: !1,
797
804
  axisLine: !1,
798
- tickFormatter: N
799
- }), /* @__PURE__ */ x(R, {
805
+ tickFormatter: b
806
+ }), /* @__PURE__ */ C(z, {
800
807
  type: "category",
801
808
  dataKey: r,
802
809
  tickLine: !1,
803
810
  axisLine: !1,
804
- width: Math.min(140, Math.max(60, Math.max(...f.map((e) => String(e[r] ?? "").length)) * 7)),
805
- tickFormatter: v
806
- })] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(L, {
811
+ width: Math.min(140, Math.max(60, Math.max(...d.map((e) => String(e[r] ?? "").length)) * 7)),
812
+ tickFormatter: le
813
+ })] }) : /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(R, {
807
814
  dataKey: r,
808
- ...Se
809
- }), /* @__PURE__ */ x(R, {
815
+ ...x
816
+ }), /* @__PURE__ */ C(z, {
810
817
  tickLine: !1,
811
818
  axisLine: !1,
812
- tickFormatter: N,
819
+ tickFormatter: b,
813
820
  width: 48
814
821
  })] }),
815
- /* @__PURE__ */ x(q, { content: /* @__PURE__ */ x(W, {}) }),
816
- /* @__PURE__ */ x(J, {
817
- content: /* @__PURE__ */ x(G, {}),
822
+ /* @__PURE__ */ C(J, { content: /* @__PURE__ */ C(G, {}) }),
823
+ /* @__PURE__ */ C(Y, {
824
+ content: /* @__PURE__ */ C(K, {}),
818
825
  ...m && {
819
826
  verticalAlign: "bottom",
820
827
  wrapperStyle: {
@@ -824,21 +831,21 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
824
831
  }
825
832
  }),
826
833
  i.map((e, t) => {
827
- let a = D(), o = e.variant === "comparison", s = o ? i.slice(0, t).find((e) => e.variant !== "comparison") || i[0] : e, c = o ? i.indexOf(s) : t, l = X(n[s.dataKey]?.color || a[c % a.length] || Y);
828
- if (d === "bar" || d === "horizontal-bar") {
829
- let t = i.filter((e) => e.variant !== "comparison").length === 1 && !o && i.length === 1 && f.length > 1, n = Z(e, "bar");
830
- return /* @__PURE__ */ x(de, {
834
+ let a = y(), o = e.variant === "comparison", s = o ? i.slice(0, t).find((e) => e.variant !== "comparison") || i[0] : e, c = o ? i.indexOf(s) : t, l = Z(n[s.dataKey]?.color || a[c % a.length] || X);
835
+ if (u === "bar" || u === "horizontal-bar") {
836
+ let t = i.filter((e) => e.variant !== "comparison").length === 1 && !o && i.length === 1 && d.length > 1, n = Q(e, "bar");
837
+ return /* @__PURE__ */ C(fe, {
831
838
  dataKey: e.dataKey,
832
839
  fill: `url(#bg-${B(l)})`,
833
840
  radius: 4,
834
841
  fillOpacity: n?.fillOpacity,
835
842
  ...p,
836
- children: t && f.map((e, t) => /* @__PURE__ */ x(E, { fill: `url(#bg-${B(X(ne(e?.[r], t, a)))})` }, `cell-${t}`))
843
+ children: t && d.map((e, t) => /* @__PURE__ */ C(O, { fill: `url(#bg-${B(Z(v(e?.[r], t, a)))})` }, `cell-${t}`))
837
844
  }, e.dataKey);
838
845
  }
839
- if (d === "line") {
840
- let t = Z(e, "line");
841
- return /* @__PURE__ */ x(O, {
846
+ if (u === "line") {
847
+ let t = Q(e, "line");
848
+ return /* @__PURE__ */ C(ge, {
842
849
  type: "monotone",
843
850
  dataKey: e.dataKey,
844
851
  stroke: l,
@@ -849,9 +856,9 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
849
856
  ...p
850
857
  }, e.dataKey);
851
858
  }
852
- if (d === "area") {
853
- let t = Z(e, "area");
854
- return /* @__PURE__ */ x(C, {
859
+ if (u === "area") {
860
+ let t = Q(e, "area");
861
+ return /* @__PURE__ */ C(T, {
855
862
  type: "monotone",
856
863
  dataKey: e.dataKey,
857
864
  fill: `url(#ag-${B(l)})`,
@@ -869,8 +876,8 @@ function Ke({ chartType: e = "bar", data: t = [], config: n = {}, xAxisKey: r =
869
876
  })
870
877
  });
871
878
  }
872
- var Y, qe, X, Z, Je = H((() => {
873
- ze(), We(), Y = "hsl(var(--primary))", qe = {
879
+ var X, Ye, Z, Q, Xe = H((() => {
880
+ Ve(), Ke(), X = "hsl(var(--primary))", Ye = {
874
881
  slate: "#64748b",
875
882
  gray: "#6b7280",
876
883
  zinc: "#71717a",
@@ -893,14 +900,14 @@ var Y, qe, X, Z, Je = H((() => {
893
900
  fuchsia: "#d946ef",
894
901
  pink: "#ec4899",
895
902
  rose: "#f43f5e"
896
- }, X = (e) => qe[e] || e, Z = (e, t) => e?.variant === "comparison" ? {
903
+ }, Z = (e) => Ye[e] || e, Q = (e, t) => e?.variant === "comparison" ? {
897
904
  strokeOpacity: typeof e.opacity == "number" ? e.opacity : t === "line" || t === "scatter" ? .5 : .6,
898
905
  fillOpacity: typeof e.opacity == "number" ? e.opacity : t === "bar" ? .4 : t === "area" ? .2 : .5,
899
906
  strokeDasharray: e.dashArray ?? (t === "line" || t === "area" ? "4 4" : void 0)
900
907
  } : null;
901
- })), Ye = d.lazy(() => Promise.resolve().then(() => (Ne(), ke))), Xe = d.lazy(() => Promise.resolve().then(() => (Je(), Ge))), Ze = ({ schema: e }) => /* @__PURE__ */ x(f, {
902
- fallback: /* @__PURE__ */ x(y, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
903
- children: /* @__PURE__ */ x(Ye, {
908
+ })), Ze = p.lazy(() => Promise.resolve().then(() => (Fe(), U))), Qe = p.lazy(() => Promise.resolve().then(() => (Xe(), qe))), $e = ({ schema: e }) => /* @__PURE__ */ C(m, {
909
+ fallback: /* @__PURE__ */ C(x, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
910
+ children: /* @__PURE__ */ C(Ze, {
904
911
  data: e.data,
905
912
  dataKey: e.dataKey,
906
913
  xAxisKey: e.xAxisKey,
@@ -908,8 +915,8 @@ var Y, qe, X, Z, Je = H((() => {
908
915
  className: e.className,
909
916
  color: e.color
910
917
  })
911
- }), Q = ({ schema: e, onChartClick: t }) => {
912
- let n = d.useMemo(() => {
918
+ }), $ = ({ schema: e, onChartClick: t }) => {
919
+ let n = p.useMemo(() => {
913
920
  let t = e.series, n = e.xAxisKey, r = e.config;
914
921
  if (n || (e.index ? n = e.index : e.category && (n = e.category)), t || (e.categories ? t = e.categories.map((e) => ({ dataKey: e })) : e.value && (t = [{ dataKey: e.value }])), !r && t) {
915
922
  let n = e.colors || [
@@ -933,9 +940,9 @@ var Y, qe, X, Z, Je = H((() => {
933
940
  className: e.className
934
941
  };
935
942
  }, [e]);
936
- return /* @__PURE__ */ x(f, {
937
- fallback: /* @__PURE__ */ x(y, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
938
- children: /* @__PURE__ */ x(Xe, {
943
+ return /* @__PURE__ */ C(m, {
944
+ fallback: /* @__PURE__ */ C(x, { className: "w-full h-48 sm:h-64 md:h-80 lg:h-[400px]" }),
945
+ children: /* @__PURE__ */ C(Qe, {
939
946
  chartType: n.chartType,
940
947
  data: n.data,
941
948
  config: n.config,
@@ -951,10 +958,10 @@ var Y, qe, X, Z, Je = H((() => {
951
958
  };
952
959
  //#endregion
953
960
  //#region src/ObjectChart.tsx
954
- function $(e) {
961
+ function et(e) {
955
962
  return e.replace(/[_-]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
956
963
  }
957
- function Qe(e, t) {
964
+ function tt(e, t) {
958
965
  let { field: n, function: r, groupBy: i } = t, a = {};
959
966
  for (let t of e) {
960
967
  let e = String(t[i] ?? "Unknown");
@@ -985,16 +992,16 @@ function Qe(e, t) {
985
992
  };
986
993
  });
987
994
  }
988
- async function $e(e, t, n, r, i) {
995
+ async function nt(e, t, n, r, i) {
989
996
  if (!e.length || !t) return e;
990
- let o = i || ((e, t) => t), s = `__raw_${t}`, c = n?.fields?.[t];
997
+ let a = i || ((e, t) => t), s = `__raw_${t}`, c = n?.fields?.[t];
991
998
  if (!c) {
992
999
  let n = /^\d{4}-\d{2}-\d{2}/;
993
1000
  return e.map((e) => {
994
- let r = e[t], i = String(r ?? ""), a = n.test(i) ? i : $(i);
1001
+ let r = e[t], i = String(r ?? ""), o = n.test(i) ? i : et(i);
995
1002
  return {
996
1003
  ...e,
997
- [t]: o(i, a),
1004
+ [t]: a(i, o),
998
1005
  [s]: r
999
1006
  };
1000
1007
  });
@@ -1003,20 +1010,20 @@ async function $e(e, t, n, r, i) {
1003
1010
  if (l === "select" || l === "picklist" || l === "dropdown") {
1004
1011
  let n = c.options || [];
1005
1012
  if (n.length === 0) return e.map((e) => {
1006
- let n = e[t], r = String(n ?? ""), i = $(r);
1013
+ let n = e[t], r = String(n ?? ""), i = et(r);
1007
1014
  return {
1008
1015
  ...e,
1009
- [t]: o(r, i),
1016
+ [t]: a(r, i),
1010
1017
  [s]: n
1011
1018
  };
1012
1019
  });
1013
1020
  let r = {};
1014
1021
  for (let e of n) typeof e == "string" ? r[e] = e : e && typeof e == "object" && (r[String(e.value)] = e.label || String(e.value));
1015
1022
  return e.map((e) => {
1016
- let n = e[t], i = String(n ?? ""), a = r[i] || $(i);
1023
+ let n = e[t], i = String(n ?? ""), o = r[i] || et(i);
1017
1024
  return {
1018
1025
  ...e,
1019
- [t]: o(i, a),
1026
+ [t]: a(i, o),
1020
1027
  [s]: n
1021
1028
  };
1022
1029
  });
@@ -1032,14 +1039,14 @@ async function $e(e, t, n, r, i) {
1032
1039
  ...e,
1033
1040
  [s]: e[t]
1034
1041
  }));
1035
- let o = c.id_field || "id";
1042
+ let a = c.id_field || "id";
1036
1043
  try {
1037
- let l = a(await r.find(n, {
1038
- $filter: { [o]: { $in: i } },
1044
+ let l = o(await r.find(n, {
1045
+ $filter: { [a]: { $in: i } },
1039
1046
  $top: i.length
1040
1047
  })), u = c.reference_field || c.display_field || "name", d = {};
1041
1048
  for (let e of l) {
1042
- let t = String(e[o] ?? e.id ?? e._id ?? ""), n = e[u] || e.name || e.label || e.title || t;
1049
+ let t = String(e[a] ?? e.id ?? e._id ?? ""), n = e[u] || e.name || e.label || e.title || t;
1043
1050
  t && (d[t] = String(n));
1044
1051
  }
1045
1052
  return e.map((e) => {
@@ -1066,283 +1073,297 @@ async function $e(e, t, n, r, i) {
1066
1073
  let n = e[t], r = String(n ?? "");
1067
1074
  return {
1068
1075
  ...e,
1069
- [t]: u.test(r) ? r : $(r),
1076
+ [t]: u.test(r) ? r : et(r),
1070
1077
  [s]: n
1071
1078
  };
1072
1079
  });
1073
1080
  }
1074
- var et = (e) => {
1075
- let { schema: u } = e, d = e.onSegmentClick, f = m(Ce), y = e.dataSource || f?.dataSource, b = z(u.bind), { fieldOptionLabel: C } = Ee(), ue = ee(C);
1076
- h(() => {
1077
- ue.current = C;
1078
- }, [C]);
1079
- let [de, w] = _([]), [T, E] = _(() => !(Array.isArray(u.data) && u.data.length > 0) && (!!u.objectName || !!u.dataset)), [fe, pe] = _(null), [me, D] = _(null), [O, k] = _(null), { openRecordList: he } = we(), A = De(), j = g(() => u.aggregate ? JSON.stringify(u.aggregate) : "", [u.aggregate]), ge = g(() => u.filter ? JSON.stringify(u.filter) : "", [u.filter]), _e = g(() => u.compareTo ? JSON.stringify(u.compareTo) : "", [u.compareTo]), M = g(() => u.dataset ? JSON.stringify({
1080
- d: u.dataset,
1081
- dim: u.dimensions ?? [],
1082
- val: u.values ?? []
1081
+ var rt = (e) => {
1082
+ let { schema: f } = e, p = e.onSegmentClick, m = g(Te), x = e.dataSource || m?.dataSource, S = B(f.bind), { fieldOptionLabel: T } = ke(), de = te(T);
1083
+ ee(() => {
1084
+ de.current = T;
1085
+ }, [T]);
1086
+ let [fe, E] = v([]), [D, O] = v(() => !(Array.isArray(f.data) && f.data.length > 0) && (!!f.objectName || !!f.dataset)), [pe, me] = v(null), [he, k] = v(null), [ge, _e] = v(null), [ve, A] = v(null), { openRecordList: ye } = Ee(), be = Ae(), j = _(() => f.aggregate ? JSON.stringify(f.aggregate) : "", [f.aggregate]), xe = _(() => f.filter ? JSON.stringify(f.filter) : "", [f.filter]), M = _(() => f.compareTo ? JSON.stringify(f.compareTo) : "", [f.compareTo]), N = _(() => f.dataset ? JSON.stringify({
1087
+ d: f.dataset,
1088
+ dim: f.dimensions ?? [],
1089
+ val: f.values ?? []
1083
1090
  }) : "", [
1084
- u.dataset,
1085
- u.dimensions,
1086
- u.values
1087
- ]), ve = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
1088
- h(() => {
1091
+ f.dataset,
1092
+ f.dimensions,
1093
+ f.values
1094
+ ]), Se = (e) => e !== "pie" && e !== "donut" && e !== "funnel";
1095
+ ee(() => {
1089
1096
  let e = !1;
1090
1097
  return (async () => {
1091
1098
  try {
1092
1099
  let t = {
1093
1100
  headers: { accept: "application/json" },
1094
1101
  credentials: "include"
1095
- }, r = u.objectName, i, a = u.aggregate?.groupBy;
1096
- if (r) i = a && typeof a == "object" && !Array.isArray(a) ? a.field : typeof a == "string" ? a : u.xAxisKey;
1097
- else if (u.dataset) {
1098
- let e = Array.isArray(u.dimensions) && u.dimensions.length ? u.dimensions[0] : void 0, n = await (await fetch(`/api/v1/meta/dataset/${encodeURIComponent(u.dataset)}`, t)).json().catch(() => null), a = n?.item ?? n?.data ?? n;
1099
- r = a?.object, i = ((a?.dimensions || []).find((t) => t?.name === e) ?? (a?.dimensions || [])[0])?.field ?? e;
1102
+ }, i = f.objectName, a, o = null, s = f.aggregate?.groupBy;
1103
+ if (i) a = s && typeof s == "object" && !Array.isArray(s) ? s.field : typeof s == "string" ? s : f.xAxisKey;
1104
+ else if (f.dataset) {
1105
+ let e = Array.isArray(f.dimensions) && f.dimensions.length ? f.dimensions[0] : void 0, n = await (await fetch(`/api/v1/meta/dataset/${encodeURIComponent(f.dataset)}`, t)).json().catch(() => null);
1106
+ o = n?.item ?? n?.data ?? n, i = o?.object, a = ((o?.dimensions || []).find((t) => t?.name === e) ?? (o?.dimensions || [])[0])?.field ?? e;
1100
1107
  }
1101
- if (!r || !i) {
1102
- e || k(null);
1108
+ if (!i || !a) {
1109
+ e || (_e(null), A(null));
1103
1110
  return;
1104
1111
  }
1105
- let o = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(r)}`, t)).json().catch(() => null), s = n((o?.item ?? o?.data ?? o)?.fields?.[i]?.options);
1106
- e || k(s);
1112
+ let c = await (await fetch(`/api/v1/meta/object/${encodeURIComponent(i)}`, t)).json().catch(() => null), l = c?.item ?? c?.data ?? c, u = r(l?.fields?.[a]?.options), d = null;
1113
+ if (f.dataset && Array.isArray(f.dimensions)) {
1114
+ let e = {};
1115
+ for (let t of f.dimensions) {
1116
+ let r = (o?.dimensions || []).find((e) => e?.name === t)?.field ?? t, i = n(l?.fields?.[r]?.options);
1117
+ i && (e[t] = i);
1118
+ }
1119
+ Object.keys(e).length > 0 && (d = e);
1120
+ }
1121
+ e || (_e(u), A(d));
1107
1122
  } catch {
1108
- e || k(null);
1123
+ e || (_e(null), A(null));
1109
1124
  }
1110
1125
  })(), () => {
1111
1126
  e = !0;
1112
1127
  };
1113
1128
  }, [
1114
- u.objectName,
1115
- u.dataset,
1116
- M,
1129
+ f.objectName,
1130
+ f.dataset,
1131
+ N,
1117
1132
  j,
1118
- u.xAxisKey
1133
+ f.xAxisKey
1119
1134
  ]);
1120
- let N = p(async (e, t) => {
1121
- if (u.aggregate && typeof e.aggregate == "function") {
1122
- let n = u.aggregate.groupBy;
1135
+ let P = h(async (e, t) => {
1136
+ if (f.aggregate && typeof e.aggregate == "function") {
1137
+ let n = f.aggregate.groupBy;
1123
1138
  if (n && typeof n == "object" && !Array.isArray(n)) {
1124
- let r = u.aggregate.field, i = u.aggregate.function, a = {
1139
+ let r = f.aggregate.field, i = f.aggregate.function, a = {
1125
1140
  function: i,
1126
1141
  alias: r || i
1127
1142
  };
1128
1143
  i !== "count" && r && (a.field = r);
1129
- let o = await e.aggregate(u.objectName, {
1144
+ let o = await e.aggregate(f.objectName, {
1130
1145
  groupBy: [n],
1131
1146
  aggregations: [a],
1132
1147
  where: t
1133
1148
  });
1134
1149
  return Array.isArray(o) ? o : [];
1135
1150
  }
1136
- let r = await e.aggregate(u.objectName, {
1137
- field: u.aggregate.field,
1138
- function: u.aggregate.function,
1151
+ let r = await e.aggregate(f.objectName, {
1152
+ field: f.aggregate.field,
1153
+ function: f.aggregate.function,
1139
1154
  groupBy: n,
1140
1155
  filter: t
1141
1156
  });
1142
1157
  return Array.isArray(r) ? r : [];
1143
1158
  }
1144
1159
  if (typeof e.find == "function") {
1145
- let n = a(await e.find(u.objectName, { $filter: t }));
1146
- return u.aggregate && n.length > 0 && (n = Qe(n, u.aggregate)), n;
1160
+ let n = o(await e.find(f.objectName, { $filter: t }));
1161
+ return f.aggregate && n.length > 0 && (n = tt(n, f.aggregate)), n;
1147
1162
  }
1148
1163
  return [];
1149
- }, [u.objectName, j]), ye = p(async (e, t) => {
1150
- if (!e || !u.objectName && !u.dataset) {
1151
- t.current && E(!1);
1164
+ }, [f.objectName, j]), F = h(async (e, t) => {
1165
+ if (!e || !f.objectName && !f.dataset) {
1166
+ t.current && O(!1);
1152
1167
  return;
1153
1168
  }
1154
- t.current && (E(!0), pe(null));
1169
+ t.current && (O(!0), me(null));
1155
1170
  try {
1156
- if (u.dataset && typeof e.queryDataset == "function") {
1157
- let n = s(u.filter), r = await e.queryDataset(u.dataset, {
1158
- dimensions: Array.isArray(u.dimensions) ? u.dimensions : [],
1159
- measures: Array.isArray(u.values) ? u.values : [],
1171
+ if (f.dataset && typeof e.queryDataset == "function") {
1172
+ let n = l(f.filter), r = await e.queryDataset(f.dataset, {
1173
+ dimensions: Array.isArray(f.dimensions) ? f.dimensions : [],
1174
+ measures: Array.isArray(f.values) ? f.values : [],
1160
1175
  ...n ? { runtimeFilter: n } : {}
1161
1176
  });
1162
- t.current && w(Array.isArray(r?.rows) ? r.rows : []);
1177
+ t.current && E(Array.isArray(r?.rows) ? r.rows : []);
1163
1178
  return;
1164
1179
  }
1165
- let n = s(u.filter), r = u.compareTo, i = !!r && ve(u.chartType), a = i ? l(u.filter, r) : null, [o, c] = await Promise.all([N(e, n), a ? N(e, a) : Promise.resolve([])]), d = o, f = u.aggregate?.groupBy, p = f && typeof f == "object" && !Array.isArray(f) ? f.alias || f.field : f || u.xAxisKey;
1166
- if (i && c.length > 0 && u.aggregate) {
1167
- let e = u.aggregate.field, t = u.aggregate.function, n = (n) => {
1180
+ let n = l(f.filter), r = f.compareTo, i = !!r && Se(f.chartType), a = i ? d(f.filter, r) : null, [o, s] = await Promise.all([P(e, n), a ? P(e, a) : Promise.resolve([])]), c = o, u = f.aggregate?.groupBy, p = u && typeof u == "object" && !Array.isArray(u) ? u.alias || u.field : u || f.xAxisKey;
1181
+ if (i && s.length > 0 && f.aggregate) {
1182
+ let e = f.aggregate.field, t = f.aggregate.function, n = (n) => {
1168
1183
  if (n == null) return null;
1169
1184
  let r = `${e}_${t}`;
1170
1185
  return r in n ? Number(n[r]) : t === "count" && `${e}_count` in n ? Number(n[`${e}_count`]) : e in n ? Number(n[e]) : "value" in n ? Number(n.value) : "count" in n ? Number(n.count) : null;
1171
1186
  }, r = `${e}__comparison`, i = p;
1172
- if (i && d.some((e) => e[i] != null) && c.some((e) => e[i] != null)) {
1187
+ if (i && c.some((e) => e[i] != null) && s.some((e) => e[i] != null)) {
1173
1188
  let e = /* @__PURE__ */ new Map();
1174
- for (let t of c) {
1189
+ for (let t of s) {
1175
1190
  let r = String(t[i] ?? "");
1176
1191
  e.set(r, n(t));
1177
1192
  }
1178
- d = d.map((t) => {
1193
+ c = c.map((t) => {
1179
1194
  let n = String(t[i] ?? ""), a = e.get(n);
1180
1195
  return a == null ? t : {
1181
1196
  ...t,
1182
1197
  [r]: a
1183
1198
  };
1184
1199
  });
1185
- let t = new Set(d.map((e) => String(e[i] ?? "")));
1186
- for (let e of c) {
1200
+ let t = new Set(c.map((e) => String(e[i] ?? "")));
1201
+ for (let e of s) {
1187
1202
  let a = String(e[i] ?? "");
1188
- t.has(a) || d.push({
1203
+ t.has(a) || c.push({
1189
1204
  [i]: a,
1190
1205
  [r]: n(e)
1191
1206
  });
1192
1207
  }
1193
1208
  } else {
1194
- let e = Math.max(d.length, c.length), t = [];
1209
+ let e = Math.max(c.length, s.length), t = [];
1195
1210
  for (let i = 0; i < e; i++) {
1196
- let e = d[i] || {}, a = c[i];
1211
+ let e = c[i] || {}, a = s[i];
1197
1212
  t.push(a ? {
1198
1213
  ...e,
1199
1214
  [r]: n(a)
1200
1215
  } : e);
1201
1216
  }
1202
- d = t;
1217
+ c = t;
1203
1218
  }
1204
1219
  }
1205
1220
  if (p && typeof e.getObjectSchema == "function") try {
1206
- let t = await e.getObjectSchema(u.objectName);
1207
- d = await $e(d, p, t, e, (e, t) => ue.current(u.objectName, p, e, t));
1221
+ let t = await e.getObjectSchema(f.objectName);
1222
+ c = await nt(c, p, t, e, (e, t) => de.current(f.objectName, p, e, t));
1208
1223
  } catch {}
1209
- t.current && w(d);
1224
+ t.current && E(c);
1210
1225
  } catch (e) {
1211
- console.error("[ObjectChart] Fetch error:", e), t.current && pe(e instanceof Error ? e.message : "Failed to load chart data");
1226
+ console.error("[ObjectChart] Fetch error:", e), t.current && me(e instanceof Error ? e.message : "Failed to load chart data");
1212
1227
  } finally {
1213
- t.current && E(!1);
1228
+ t.current && O(!1);
1214
1229
  }
1215
1230
  }, [
1216
- u.objectName,
1217
- M,
1231
+ f.objectName,
1232
+ N,
1218
1233
  j,
1219
- ge,
1220
- _e,
1221
- u.xAxisKey,
1222
- u.chartType,
1223
- N
1234
+ xe,
1235
+ M,
1236
+ f.xAxisKey,
1237
+ f.chartType,
1238
+ P
1224
1239
  ]);
1225
- h(() => {
1240
+ ee(() => {
1226
1241
  let e = { current: !0 };
1227
- return (u.objectName || u.dataset) && !b && !u.data ? ye(y, e) : e.current && E(!1), () => {
1242
+ return (f.objectName || f.dataset) && !S && !f.data ? F(x, e) : e.current && O(!1), () => {
1228
1243
  e.current = !1;
1229
1244
  };
1230
1245
  }, [
1231
- u.objectName,
1232
- M,
1233
- y,
1234
- b,
1235
- u.data,
1236
- ge,
1246
+ f.objectName,
1247
+ N,
1248
+ x,
1249
+ S,
1250
+ f.data,
1251
+ xe,
1237
1252
  j,
1238
- _e,
1239
- ye
1253
+ M,
1254
+ F
1240
1255
  ]);
1241
- let be = b || u.data || de, P = Array.isArray(be) ? be : [], F = u.drillDown, I = u.aggregate?.groupBy || u.xAxisKey, L = g(() => {
1242
- if (!I) return /* @__PURE__ */ new Map();
1243
- let e = /* @__PURE__ */ new Map(), t = `__raw_${I}`;
1244
- for (let n of P) {
1245
- let r = n?.[I];
1256
+ let I = S || f.data || fe, L = Array.isArray(I) ? I : [], R = f.drillDown, z = f.aggregate?.groupBy || f.xAxisKey, Ce = _(() => {
1257
+ if (!z) return /* @__PURE__ */ new Map();
1258
+ let e = /* @__PURE__ */ new Map(), t = `__raw_${z}`;
1259
+ for (let n of L) {
1260
+ let r = n?.[z];
1246
1261
  if (r == null) continue;
1247
1262
  let i = t in (n || {}) ? n[t] : r;
1248
1263
  e.set(String(r), i);
1249
1264
  }
1250
1265
  return e;
1251
- }, [P, I]), R = u.compareTo, xe = !!R && ve(u.chartType) && !!u.aggregate && P.some((e) => e[`${u.aggregate.field}__comparison`] != null), V = g(() => {
1252
- let e = Array.isArray(u.series) ? u.series : null;
1253
- if (!xe) return e;
1254
- let t = e || [{ dataKey: u.aggregate.field }], n = {
1266
+ }, [L, z]), V = f.compareTo, H = !!V && Se(f.chartType) && !!f.aggregate && L.some((e) => e[`${f.aggregate.field}__comparison`] != null), je = _(() => {
1267
+ let e = Array.isArray(f.series) ? f.series : null;
1268
+ if (!H) return e;
1269
+ let t = e || [{ dataKey: f.aggregate.field }], n = {
1255
1270
  vsLastWeek: "Previous week",
1256
1271
  vsLastMonth: "Previous month",
1257
1272
  vsLastQuarter: "Previous quarter",
1258
1273
  vsLastYear: "Previous year",
1259
1274
  vsYesterday: "Yesterday",
1260
1275
  vsPreviousPeriod: "Previous period"
1261
- }[r(R, u.filter)] || "Previous period";
1276
+ }[i(V, f.filter)] || "Previous period";
1262
1277
  return [...t.map((e) => ({
1263
1278
  ...e,
1264
1279
  variant: e.variant || "current"
1265
1280
  })), {
1266
- dataKey: `${u.aggregate.field}__comparison`,
1281
+ dataKey: `${f.aggregate.field}__comparison`,
1267
1282
  label: n,
1268
1283
  variant: "comparison"
1269
1284
  }];
1270
1285
  }, [
1271
- xe,
1272
- u.series,
1273
- u.aggregate,
1274
- u.filter,
1275
- R
1276
- ]), H = u.dataset ? t(P, u.dimensions, u.values) : null, Oe = H ? {
1277
- ...u,
1278
- data: H.data,
1279
- xAxisKey: H.xAxisKey,
1280
- series: H.series
1286
+ H,
1287
+ f.series,
1288
+ f.aggregate,
1289
+ f.filter,
1290
+ V
1291
+ ]), U = f.dataset ? t(c(L, ve), f.dimensions, f.values) : null, Me = U ? {
1292
+ ...f,
1293
+ data: U.data,
1294
+ xAxisKey: U.xAxisKey,
1295
+ series: U.series
1281
1296
  } : {
1282
- ...u,
1283
- data: P,
1284
- ...V ? { series: V } : {}
1285
- }, ke = u.colors && !Array.isArray(u.colors) && typeof u.colors == "object" ? u.colors : null, Ae = Array.isArray(u.colors) ? u.colors : void 0, je = O || ke ? {
1286
- ...O || {},
1287
- ...ke || {}
1288
- } : void 0, Me = {
1289
- ...Oe,
1290
- colors: Ae,
1291
- ...je ? { categoryColors: je } : {}
1297
+ ...f,
1298
+ data: L,
1299
+ ...je ? { series: je } : {}
1300
+ }, Ne = f.colors && !Array.isArray(f.colors) && typeof f.colors == "object" ? f.colors : null, Pe = Array.isArray(f.colors) ? f.colors : void 0, Fe = ge || Ne ? {
1301
+ ...ge || {},
1302
+ ...Ne || {}
1303
+ } : void 0, Ie = {
1304
+ ...Me,
1305
+ colors: Pe,
1306
+ ...Fe ? { categoryColors: Fe } : {}
1292
1307
  };
1293
- if (T && P.length === 0) return /* @__PURE__ */ x("div", {
1294
- className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (u.className || ""),
1308
+ if (D && L.length === 0) return /* @__PURE__ */ w("div", {
1309
+ className: "p-2 " + (f.className || ""),
1295
1310
  "data-testid": "chart-loading",
1296
- children: "Loading chart data…"
1311
+ role: "status",
1312
+ "aria-busy": "true",
1313
+ "aria-live": "polite",
1314
+ children: [/* @__PURE__ */ C("span", {
1315
+ className: "sr-only",
1316
+ children: "Loading chart data…"
1317
+ }), /* @__PURE__ */ C(re, { className: "h-full" })]
1297
1318
  });
1298
- if (fe) return /* @__PURE__ */ S("div", {
1299
- className: "flex flex-col items-center justify-center gap-2 p-4 " + (u.className || ""),
1319
+ if (pe) return /* @__PURE__ */ w("div", {
1320
+ className: "flex flex-col items-center justify-center gap-2 p-4 " + (f.className || ""),
1300
1321
  "data-testid": "chart-error",
1301
1322
  role: "alert",
1302
1323
  children: [
1303
- /* @__PURE__ */ x(Te, { className: "h-6 w-6 text-destructive opacity-60" }),
1304
- /* @__PURE__ */ x("p", {
1324
+ /* @__PURE__ */ C(De, { className: "h-6 w-6 text-destructive opacity-60" }),
1325
+ /* @__PURE__ */ C("p", {
1305
1326
  className: "text-xs text-destructive font-medium",
1306
1327
  children: "Failed to load chart data"
1307
1328
  }),
1308
- /* @__PURE__ */ x("p", {
1329
+ /* @__PURE__ */ C("p", {
1309
1330
  className: "text-xs text-muted-foreground max-w-xs text-center",
1310
- children: fe
1331
+ children: pe
1311
1332
  })
1312
1333
  ]
1313
1334
  });
1314
- if (!y && u.objectName && P.length === 0) return /* @__PURE__ */ S("div", {
1315
- className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (u.className || ""),
1335
+ if (!x && f.objectName && L.length === 0) return /* @__PURE__ */ w("div", {
1336
+ className: "flex items-center justify-center text-muted-foreground text-sm p-4 " + (f.className || ""),
1316
1337
  "data-testid": "chart-no-datasource",
1317
1338
  children: [
1318
1339
  "No data source available for “",
1319
- u.objectName,
1340
+ f.objectName,
1320
1341
  "”"
1321
1342
  ]
1322
1343
  });
1323
- let Ne = o(F) ? (e) => {
1324
- let t = e.category, n = t != null && L.has(String(t)) ? L.get(String(t)) : t;
1325
- D({
1344
+ let W = s(R) ? (e) => {
1345
+ let t = e.category, n = t != null && Ce.has(String(t)) ? Ce.get(String(t)) : t;
1346
+ k({
1326
1347
  ...e,
1327
1348
  category: n,
1328
1349
  categoryLabel: t,
1329
1350
  scope: "cell"
1330
1351
  });
1331
- } : void 0, Pe = d ?? Ne, U = !d && me && u.objectName ? (() => {
1332
- let e = i(F, me, { groupByField: I }), t = {
1333
- ...u.filter || {},
1352
+ } : void 0, G = p ?? W, K = !p && he && f.objectName ? (() => {
1353
+ let e = a(R, he, { groupByField: z }), t = {
1354
+ ...f.filter || {},
1334
1355
  ...e
1335
- }, n = c(F, me, u.title || "Details"), r = F?.target ?? "drawer", a = /* @__PURE__ */ x("div", {
1356
+ }, n = u(R, he, f.title || "Details"), r = R?.target ?? "drawer", i = /* @__PURE__ */ C("div", {
1336
1357
  className: "overflow-auto",
1337
1358
  "data-testid": "chart-drill-body",
1338
- children: /* @__PURE__ */ x(Se, {
1359
+ children: /* @__PURE__ */ C(we, {
1339
1360
  schema: {
1340
1361
  type: "object-data-table",
1341
- objectName: u.objectName,
1362
+ objectName: f.objectName,
1342
1363
  filter: t,
1343
1364
  pagination: !0,
1344
- pageSize: F?.maxRows,
1345
- columns: F?.columns?.map((e) => ({
1365
+ pageSize: R?.maxRows,
1366
+ columns: R?.columns?.map((e) => ({
1346
1367
  accessorKey: e,
1347
1368
  header: e
1348
1369
  })),
@@ -1352,58 +1373,58 @@ var et = (e) => {
1352
1373
  target: "dialog"
1353
1374
  }
1354
1375
  },
1355
- dataSource: y
1376
+ dataSource: x
1356
1377
  })
1357
- }), o = he && u.objectName ? /* @__PURE__ */ S(te, {
1378
+ }), o = ye && f.objectName ? /* @__PURE__ */ w(ne, {
1358
1379
  type: "button",
1359
1380
  variant: "ghost",
1360
1381
  size: "sm",
1361
1382
  "data-testid": "drill-open-in-list",
1362
1383
  onClick: () => {
1363
- he(u.objectName, t), D(null);
1384
+ ye(f.objectName, t), k(null);
1364
1385
  },
1365
- children: [A("dashboard.openInList", "Open in list"), /* @__PURE__ */ x(B, { className: "ml-1 h-3.5 w-3.5" })]
1386
+ children: [be("dashboard.openInList", "Open in list"), /* @__PURE__ */ C(Oe, { className: "ml-1 h-3.5 w-3.5" })]
1366
1387
  }) : null;
1367
- return r === "dialog" ? /* @__PURE__ */ x(ne, {
1388
+ return r === "dialog" ? /* @__PURE__ */ C(ie, {
1368
1389
  open: !0,
1369
- onOpenChange: (e) => !e && D(null),
1370
- children: /* @__PURE__ */ S(re, {
1390
+ onOpenChange: (e) => !e && k(null),
1391
+ children: /* @__PURE__ */ w(ae, {
1371
1392
  className: "max-w-4xl",
1372
- children: [/* @__PURE__ */ S(ie, {
1393
+ children: [/* @__PURE__ */ w(oe, {
1373
1394
  className: "flex-row items-center justify-between gap-4 pr-8",
1374
- children: [/* @__PURE__ */ x(ae, { children: n }), o]
1375
- }), a]
1395
+ children: [/* @__PURE__ */ C(se, { children: n }), o]
1396
+ }), i]
1376
1397
  })
1377
- }) : /* @__PURE__ */ x(se, {
1398
+ }) : /* @__PURE__ */ C(le, {
1378
1399
  open: !0,
1379
- onOpenChange: (e) => !e && D(null),
1380
- children: /* @__PURE__ */ S(ce, {
1400
+ onOpenChange: (e) => !e && k(null),
1401
+ children: /* @__PURE__ */ w(ue, {
1381
1402
  side: "right",
1382
1403
  className: "w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col",
1383
- children: [/* @__PURE__ */ S(le, {
1404
+ children: [/* @__PURE__ */ w(y, {
1384
1405
  className: "flex-row items-center justify-between gap-4 pr-8",
1385
- children: [/* @__PURE__ */ x(v, { children: n }), o]
1386
- }), /* @__PURE__ */ x("div", {
1406
+ children: [/* @__PURE__ */ C(b, { children: n }), o]
1407
+ }), /* @__PURE__ */ C("div", {
1387
1408
  className: "flex-1 overflow-hidden mt-2",
1388
- children: a
1409
+ children: i
1389
1410
  })]
1390
1411
  })
1391
1412
  });
1392
1413
  })() : null;
1393
- return /* @__PURE__ */ S("div", {
1414
+ return /* @__PURE__ */ w("div", {
1394
1415
  className: "relative",
1395
1416
  children: [
1396
- /* @__PURE__ */ x(oe, { active: T && P.length > 0 }),
1397
- /* @__PURE__ */ x(Q, {
1417
+ /* @__PURE__ */ C(ce, { active: D && L.length > 0 }),
1418
+ /* @__PURE__ */ C($, {
1398
1419
  ...e,
1399
- schema: Me,
1400
- onChartClick: Pe
1420
+ schema: Ie,
1421
+ onChartClick: G
1401
1422
  }),
1402
- U
1423
+ K
1403
1424
  ]
1404
1425
  });
1405
1426
  };
1406
- e.register("object-chart", et, {
1427
+ e.register("object-chart", rt, {
1407
1428
  namespace: "plugin-charts",
1408
1429
  label: "Object Chart",
1409
1430
  category: "view",
@@ -1435,11 +1456,11 @@ e.register("object-chart", et, {
1435
1456
  });
1436
1457
  //#endregion
1437
1458
  //#region src/index.tsx
1438
- var tt = {
1439
- "bar-chart": Ze,
1440
- chart: Q
1459
+ var it = {
1460
+ "bar-chart": $e,
1461
+ chart: $
1441
1462
  };
1442
- e.register("bar-chart", Ze, {
1463
+ e.register("bar-chart", $e, {
1443
1464
  namespace: "plugin-charts",
1444
1465
  label: "Bar Chart",
1445
1466
  category: "plugin",
@@ -1503,7 +1524,7 @@ e.register("bar-chart", Ze, {
1503
1524
  height: 400,
1504
1525
  color: "#8884d8"
1505
1526
  }
1506
- }), e.register("chart", et, {
1527
+ }), e.register("chart", rt, {
1507
1528
  namespace: "view",
1508
1529
  category: "view",
1509
1530
  label: "Chart",
@@ -1530,7 +1551,7 @@ e.register("bar-chart", Ze, {
1530
1551
  label: "Value Field"
1531
1552
  }
1532
1553
  ]
1533
- }), e.register("chart", Q, {
1554
+ }), e.register("chart", $, {
1534
1555
  namespace: "plugin-charts",
1535
1556
  label: "Chart",
1536
1557
  category: "plugin",
@@ -1642,31 +1663,31 @@ e.register("bar-chart", Ze, {
1642
1663
  xAxisKey: "name",
1643
1664
  series: [{ dataKey: "sales" }, { dataKey: "revenue" }]
1644
1665
  }
1645
- }), e.register("chart:bar", Q, {
1666
+ }), e.register("chart:bar", $, {
1646
1667
  namespace: "plugin-charts",
1647
1668
  label: "Bar Chart (Alias)",
1648
1669
  category: "plugin",
1649
1670
  defaultProps: { chartType: "bar" }
1650
- }), e.register("pie-chart", Q, {
1671
+ }), e.register("pie-chart", $, {
1651
1672
  namespace: "plugin-charts",
1652
1673
  label: "Pie Chart",
1653
1674
  category: "plugin",
1654
1675
  defaultProps: { chartType: "pie" }
1655
- }), e.register("donut-chart", Q, {
1676
+ }), e.register("donut-chart", $, {
1656
1677
  namespace: "plugin-charts",
1657
1678
  label: "Donut Chart",
1658
1679
  category: "plugin",
1659
1680
  defaultProps: { chartType: "donut" }
1660
- }), e.register("radar-chart", Q, {
1681
+ }), e.register("radar-chart", $, {
1661
1682
  namespace: "plugin-charts",
1662
1683
  label: "Radar Chart",
1663
1684
  category: "plugin",
1664
1685
  defaultProps: { chartType: "radar" }
1665
- }), e.register("scatter-chart", Q, {
1686
+ }), e.register("scatter-chart", $, {
1666
1687
  namespace: "plugin-charts",
1667
1688
  label: "Scatter Chart",
1668
1689
  category: "plugin",
1669
1690
  defaultProps: { chartType: "scatter" }
1670
1691
  });
1671
1692
  //#endregion
1672
- export { Ze as ChartBarRenderer, Q as ChartRenderer, et as ObjectChart, tt as chartComponents };
1693
+ export { $e as ChartBarRenderer, $ as ChartRenderer, rt as ObjectChart, it as chartComponents };