drizzle-cube 0.1.21 → 0.1.24

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.
Files changed (53) hide show
  1. package/dist/adapters/{compiler-CPsEzFP2.js → compiler-CSr2Ti96.js} +553 -505
  2. package/dist/adapters/express/index.js +1 -1
  3. package/dist/adapters/fastify/index.js +1 -1
  4. package/dist/adapters/hono/index.js +1 -1
  5. package/dist/adapters/nextjs/index.js +50 -50
  6. package/dist/client/charts/chartConfigs.d.ts +31 -1
  7. package/dist/client/charts.d.ts +1 -0
  8. package/dist/client/charts.js +1 -1
  9. package/dist/client/chunks/charts-Dx3asDBi.js +2269 -0
  10. package/dist/client/chunks/charts-Dx3asDBi.js.map +1 -0
  11. package/dist/client/chunks/{icons-B5RVM-7b.js → icons-BMGOKdZb.js} +279 -239
  12. package/dist/client/chunks/icons-BMGOKdZb.js.map +1 -0
  13. package/dist/client/chunks/{providers-DI5zeeEU.js → providers-B7MVnAAt.js} +50 -50
  14. package/dist/client/chunks/providers-B7MVnAAt.js.map +1 -0
  15. package/dist/client/components/ChartConfigPanel.d.ts +3 -2
  16. package/dist/client/components/ColorPaletteSelector.d.ts +11 -0
  17. package/dist/client/components/DashboardGrid.d.ts +3 -1
  18. package/dist/client/components/DataHistogram.d.ts +23 -0
  19. package/dist/client/components/PortletEditModal.d.ts +3 -2
  20. package/dist/client/components/charts/ActivityGridChart.config.d.ts +5 -0
  21. package/dist/client/components/charts/ActivityGridChart.d.ts +2 -0
  22. package/dist/client/components/charts/AreaChart.d.ts +1 -1
  23. package/dist/client/components/charts/BarChart.d.ts +1 -1
  24. package/dist/client/components/charts/BubbleChart.d.ts +1 -1
  25. package/dist/client/components/charts/KpiNumber.config.d.ts +5 -0
  26. package/dist/client/components/charts/KpiNumber.d.ts +2 -0
  27. package/dist/client/components/charts/KpiText.config.d.ts +5 -0
  28. package/dist/client/components/charts/KpiText.d.ts +2 -0
  29. package/dist/client/components/charts/LineChart.d.ts +1 -1
  30. package/dist/client/components/charts/PieChart.d.ts +1 -1
  31. package/dist/client/components/charts/RadarChart.d.ts +1 -1
  32. package/dist/client/components/charts/RadialBarChart.d.ts +1 -1
  33. package/dist/client/components/charts/ScatterChart.d.ts +1 -1
  34. package/dist/client/components/charts/TreeMapChart.d.ts +1 -1
  35. package/dist/client/components/charts/index.d.ts +3 -0
  36. package/dist/client/components.js +5134 -2607
  37. package/dist/client/components.js.map +1 -1
  38. package/dist/client/hooks/useCubeMeta.d.ts +1 -0
  39. package/dist/client/hooks.js +62 -60
  40. package/dist/client/hooks.js.map +1 -1
  41. package/dist/client/index.d.ts +1 -0
  42. package/dist/client/index.js +2 -2
  43. package/dist/client/providers.js +1 -1
  44. package/dist/client/types.d.ts +17 -5
  45. package/dist/client/utils/colorPalettes.d.ts +35 -0
  46. package/dist/client-bundle-stats.html +1 -1
  47. package/dist/server/index.d.ts +3 -8
  48. package/dist/server/index.js +748 -700
  49. package/package.json +22 -1
  50. package/dist/client/chunks/charts-BadAUMmd.js +0 -2285
  51. package/dist/client/chunks/charts-BadAUMmd.js.map +0 -1
  52. package/dist/client/chunks/icons-B5RVM-7b.js.map +0 -1
  53. package/dist/client/chunks/providers-DI5zeeEU.js.map +0 -1
@@ -0,0 +1,2269 @@
1
+ import { jsx as i, jsxs as g } from "react/jsx-runtime";
2
+ import { useState as G } from "react";
3
+ import { ResponsiveContainer as ze, Tooltip as ut, BarChart as ft, CartesianGrid as he, XAxis as ye, YAxis as pe, Legend as _, Bar as mt, Cell as ke, LineChart as xt, Line as ht, AreaChart as yt, Area as pt, PieChart as vt, Pie as gt, ScatterChart as bt, Scatter as Re, RadarChart as wt, PolarGrid as Nt, PolarAngleAxis as At, PolarRadiusAxis as St, Radar as Mt, RadialBarChart as kt, RadialBar as $t, Treemap as Lt } from "recharts";
4
+ import { u as K } from "./providers-B7MVnAAt.js";
5
+ function U({ children: e, height: t = "100%" }) {
6
+ try {
7
+ if (t === "100%")
8
+ return /* @__PURE__ */ i("div", { className: "w-full h-full flex-1 flex flex-col relative", style: { minHeight: "250px", overflow: "hidden" }, children: /* @__PURE__ */ i(ze, { width: "100%", height: "100%", debounce: 50, style: { marginTop: "16px" }, children: e }) });
9
+ const r = {
10
+ height: typeof t == "number" ? `${t}px` : t,
11
+ width: "100%",
12
+ minHeight: "200px"
13
+ };
14
+ return /* @__PURE__ */ i("div", { className: "w-full flex flex-col relative", style: { ...r, overflow: "hidden" }, children: /* @__PURE__ */ i(ze, { width: "100%", height: "100%", debounce: 50, style: { marginTop: "16px" }, children: e }) });
15
+ } catch (r) {
16
+ return console.error("ChartContainer ResponsiveContainer error:", r), /* @__PURE__ */ g(
17
+ "div",
18
+ {
19
+ className: "flex flex-col items-center justify-center w-full h-full p-4 text-center border-2 border-dashed border-yellow-300 rounded-lg bg-yellow-50",
20
+ style: { height: t },
21
+ children: [
22
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold text-yellow-600 mb-1", children: "Chart Container Error" }),
23
+ /* @__PURE__ */ i("div", { className: "text-xs text-gray-600", children: r instanceof Error ? r.message : "Failed to create responsive container" })
24
+ ]
25
+ }
26
+ );
27
+ }
28
+ }
29
+ function V({ formatter: e, labelFormatter: t }) {
30
+ return /* @__PURE__ */ i(
31
+ ut,
32
+ {
33
+ formatter: e,
34
+ labelFormatter: t,
35
+ contentStyle: {
36
+ backgroundColor: "white",
37
+ border: "1px solid #e5e7eb",
38
+ borderRadius: "0.5rem",
39
+ fontSize: "0.875rem",
40
+ color: "#1f2937",
41
+ boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
42
+ padding: "8px 12px"
43
+ }
44
+ }
45
+ );
46
+ }
47
+ const T = [
48
+ "#3b82f6",
49
+ // blue
50
+ "#10b981",
51
+ // green
52
+ "#f59e0b",
53
+ // yellow
54
+ "#ef4444",
55
+ // red
56
+ "#8b5cf6",
57
+ // purple
58
+ "#f97316",
59
+ // orange
60
+ "#06b6d4",
61
+ // cyan
62
+ "#84cc16"
63
+ // lime
64
+ ], se = [
65
+ "#440154",
66
+ // dark purple
67
+ "#414487",
68
+ // purple-blue
69
+ "#2a788e",
70
+ // teal
71
+ "#22a884",
72
+ // green-teal
73
+ "#7ad151",
74
+ // green
75
+ "#fde725"
76
+ // yellow
77
+ ], De = "#10b981", Tt = "#ef4444", ve = {
78
+ top: 5,
79
+ right: 30,
80
+ left: 20,
81
+ bottom: 5
82
+ };
83
+ function we(e, t) {
84
+ return t[e] || e;
85
+ }
86
+ function D(e, t) {
87
+ if (!e) return String(e || "Unknown");
88
+ const r = String(e);
89
+ if (r.match(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}/)) {
90
+ let n = r;
91
+ r.includes(" ") && (n = r.replace(" ", "T").replace("+00", "Z").replace(/\+\d{2}:\d{2}$/, "Z")), !n.endsWith("Z") && !n.includes("+") && (n = n + "Z");
92
+ const s = new Date(n);
93
+ if (isNaN(s.getTime()))
94
+ return r;
95
+ const a = s.getUTCFullYear(), l = String(s.getUTCMonth() + 1).padStart(2, "0"), c = String(s.getUTCDate()).padStart(2, "0"), d = s.getUTCHours(), o = s.getUTCMinutes();
96
+ if (t)
97
+ switch (t.toLowerCase()) {
98
+ case "year":
99
+ return `${a}`;
100
+ case "quarter":
101
+ const m = Math.floor(s.getUTCMonth() / 3) + 1;
102
+ return `${a}-Q${m}`;
103
+ case "month":
104
+ return `${a}-${l}`;
105
+ case "week":
106
+ return `${a}-${l}-${c}`;
107
+ case "day":
108
+ return `${a}-${l}-${c}`;
109
+ case "hour":
110
+ return `${a}-${l}-${c} ${String(d).padStart(2, "0")}:00`;
111
+ case "minute":
112
+ return `${a}-${l}-${c} ${String(d).padStart(2, "0")}:${String(o).padStart(2, "0")}`;
113
+ }
114
+ const u = s.getUTCSeconds(), f = s.getUTCMilliseconds();
115
+ if (c === "01" && d === 0 && o === 0 && u === 0 && f === 0) {
116
+ if (l === "01" || l === "04" || l === "07" || l === "10") {
117
+ const m = Math.floor(s.getUTCMonth() / 3) + 1;
118
+ return `${a}-Q${m}`;
119
+ }
120
+ return `${a}-${l}`;
121
+ }
122
+ return d === 0 && o === 0 && u === 0 && f === 0 ? `${a}-${l}-${c}` : o === 0 && u === 0 && f === 0 ? `${a}-${l}-${c} ${String(d).padStart(2, "0")}:00` : `${a}-${l}-${c} ${String(d).padStart(2, "0")}:${String(o).padStart(2, "0")}`;
123
+ }
124
+ return r;
125
+ }
126
+ function O(e, t) {
127
+ try {
128
+ if (e != null && e.timeDimensions) {
129
+ const n = e.timeDimensions.find((s) => t === s.dimension || t.startsWith(s.dimension.replace(".", "_")) || t === `${s.dimension}_${s.granularity}`);
130
+ if (n != null && n.granularity)
131
+ return n.granularity;
132
+ }
133
+ const r = t.match(/_([a-z]+)$/);
134
+ if (r) {
135
+ const n = r[1];
136
+ if (["year", "quarter", "month", "week", "day", "hour", "minute", "second"].includes(n))
137
+ return n;
138
+ }
139
+ return;
140
+ } catch {
141
+ return;
142
+ }
143
+ }
144
+ function Ft(e, t, r, n, s = {}) {
145
+ if (!e || e.length === 0) return [];
146
+ const a = O(n, t);
147
+ return e.map((l) => {
148
+ const c = {
149
+ name: D(l[t], a) || l[t] || "Unknown"
150
+ };
151
+ return r.forEach((d) => {
152
+ const o = we(d, s);
153
+ c[o] = typeof l[d] == "string" ? parseFloat(l[d]) : l[d] || 0;
154
+ }), c;
155
+ });
156
+ }
157
+ function C(e, t, r, n, s, a = {}) {
158
+ var N;
159
+ if (!e || e.length === 0)
160
+ return { data: [], seriesKeys: [], hasDimensions: !1 };
161
+ const l = n || {}, c = [
162
+ ...l.dimensions || [],
163
+ ...((N = l.timeDimensions) == null ? void 0 : N.map((x) => x.dimension)) || []
164
+ ], d = l.measures || [], o = r.filter((x) => d.includes(x)), u = (s || []).filter((x) => c.includes(x));
165
+ if (u.length > 0) {
166
+ const x = {};
167
+ e.forEach((S) => {
168
+ const $ = O(n, t), h = D(S[t], $) || S[t] || "Unknown";
169
+ x[h] || (x[h] = { name: String(h) }), o.forEach((y) => {
170
+ const b = we(y, a);
171
+ x[h][b] = (x[h][b] || 0) + (typeof S[y] == "string" ? parseFloat(S[y]) : S[y] || 0);
172
+ }), u.forEach((y) => {
173
+ const b = S[y];
174
+ if (b != null) {
175
+ const A = String(b), w = o[0] || d.find(
176
+ (k) => k.includes("totalCost") || k.includes("count") || k.includes("sum")
177
+ ) || d[0];
178
+ if (w) {
179
+ const k = typeof S[w] == "string" ? parseFloat(S[w]) : S[w] || 0;
180
+ x[h][A] = (x[h][A] || 0) + k;
181
+ }
182
+ }
183
+ });
184
+ });
185
+ const v = Object.values(x), p = Array.from(new Set(
186
+ e.flatMap(
187
+ (S) => u.map(($) => {
188
+ const h = S[$];
189
+ return h != null ? String(h) : null;
190
+ }).filter(($) => $ !== null)
191
+ )
192
+ ));
193
+ return {
194
+ data: v,
195
+ seriesKeys: p,
196
+ hasDimensions: !0
197
+ };
198
+ }
199
+ const f = Ft(e, t, r, n, a), m = r.map((x) => we(x, a));
200
+ return {
201
+ data: f,
202
+ seriesKeys: m,
203
+ hasDimensions: !1
204
+ };
205
+ }
206
+ function Ur({
207
+ data: e,
208
+ chartConfig: t,
209
+ displayConfig: r = {},
210
+ queryObject: n,
211
+ height: s = "100%",
212
+ colorPalette: a
213
+ }) {
214
+ const [l, c] = G(null), { labelMap: d, getFieldLabel: o } = K();
215
+ try {
216
+ const u = {
217
+ showLegend: (r == null ? void 0 : r.showLegend) ?? !0,
218
+ showGrid: (r == null ? void 0 : r.showGrid) ?? !0,
219
+ showTooltip: (r == null ? void 0 : r.showTooltip) ?? !0,
220
+ stacked: (r == null ? void 0 : r.stacked) ?? !1
221
+ };
222
+ if (!e || e.length === 0)
223
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
224
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
225
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No data points to display in bar chart" })
226
+ ] }) });
227
+ let f, m, N = [];
228
+ if (t != null && t.xAxis && (t != null && t.yAxis))
229
+ f = t.xAxis[0], m = Array.isArray(t.yAxis) ? t.yAxis : [t.yAxis], N = t.series || [];
230
+ else if (t != null && t.x && (t != null && t.y))
231
+ f = t.x, m = Array.isArray(t.y) ? t.y : [t.y];
232
+ else
233
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
234
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
235
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "Invalid or missing chart axis configuration" })
236
+ ] }) });
237
+ if (!f || !m || m.length === 0)
238
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
239
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
240
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "Missing required X-axis or Y-axis fields" })
241
+ ] }) });
242
+ const { data: x, seriesKeys: v } = C(
243
+ e,
244
+ f,
245
+ m,
246
+ n,
247
+ N,
248
+ d
249
+ ), p = u.stacked === !0, S = v.length === 1 && x.some((y) => {
250
+ const b = y[v[0]];
251
+ return typeof b == "number" && b < 0;
252
+ }), $ = u.showLegend, h = {
253
+ ...ve,
254
+ left: 40
255
+ // Increased from 20 to 40 for Y-axis label space
256
+ };
257
+ return !x || x.length === 0 ? /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
258
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No valid data" }),
259
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No valid data points for bar chart after transformation" })
260
+ ] }) }) : /* @__PURE__ */ i(U, { height: s, children: /* @__PURE__ */ g(ft, { data: x, margin: h, children: [
261
+ u.showGrid && /* @__PURE__ */ i(he, { strokeDasharray: "3 3" }),
262
+ /* @__PURE__ */ i(
263
+ ye,
264
+ {
265
+ dataKey: "name",
266
+ tick: { fontSize: 12 },
267
+ angle: -45,
268
+ textAnchor: "end",
269
+ height: 60
270
+ }
271
+ ),
272
+ /* @__PURE__ */ i(
273
+ pe,
274
+ {
275
+ tick: { fontSize: 12 },
276
+ label: { value: o(m[0]), angle: -90, position: "left", style: { textAnchor: "middle", fontSize: "12px" } }
277
+ }
278
+ ),
279
+ u.showTooltip && /* @__PURE__ */ i(V, {}),
280
+ $ && /* @__PURE__ */ i(
281
+ _,
282
+ {
283
+ wrapperStyle: { fontSize: "12px", paddingTop: "25px" },
284
+ iconType: "rect",
285
+ iconSize: 8,
286
+ layout: "horizontal",
287
+ align: "center",
288
+ verticalAlign: "bottom",
289
+ onMouseEnter: (y) => c(String(y.dataKey || "")),
290
+ onMouseLeave: () => c(null)
291
+ }
292
+ ),
293
+ v.map((y, b) => /* @__PURE__ */ i(
294
+ mt,
295
+ {
296
+ dataKey: y,
297
+ stackId: p ? "stack" : void 0,
298
+ fill: S ? De : (a == null ? void 0 : a.colors) && a.colors[b % a.colors.length] || T[b % T.length],
299
+ fillOpacity: l ? l === y ? 1 : 0.3 : 1,
300
+ children: S && x.map((A, w) => {
301
+ const k = A[y], L = typeof k == "number" && k < 0 ? Tt : De;
302
+ return /* @__PURE__ */ i(
303
+ ke,
304
+ {
305
+ fill: L,
306
+ fillOpacity: l ? l === y ? 1 : 0.3 : 1
307
+ },
308
+ `cell-${w}`
309
+ );
310
+ })
311
+ },
312
+ y
313
+ ))
314
+ ] }) });
315
+ } catch (u) {
316
+ return console.error("BarChart rendering error:", u), /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center w-full text-red-500 p-4", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
317
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Bar Chart Error" }),
318
+ /* @__PURE__ */ i("div", { className: "text-xs mb-2", children: u instanceof Error ? u.message : "Unknown rendering error" }),
319
+ /* @__PURE__ */ i("div", { className: "text-xs text-gray-600", children: "Check the data and configuration" })
320
+ ] }) });
321
+ }
322
+ }
323
+ function Vr({
324
+ data: e,
325
+ chartConfig: t,
326
+ displayConfig: r = {},
327
+ queryObject: n,
328
+ height: s = "100%",
329
+ colorPalette: a
330
+ }) {
331
+ const [l, c] = G(null), { labelMap: d, getFieldLabel: o } = K();
332
+ try {
333
+ const u = {
334
+ showLegend: (r == null ? void 0 : r.showLegend) ?? !0,
335
+ showGrid: (r == null ? void 0 : r.showGrid) ?? !0,
336
+ showTooltip: (r == null ? void 0 : r.showTooltip) ?? !0
337
+ };
338
+ if (!e || e.length === 0)
339
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
340
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
341
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No data points to display in line chart" })
342
+ ] }) });
343
+ let f, m, N = [];
344
+ if (t != null && t.xAxis && (t != null && t.yAxis))
345
+ f = t.xAxis[0], m = Array.isArray(t.yAxis) ? t.yAxis : [t.yAxis], N = t.series || [];
346
+ else if (t != null && t.x && (t != null && t.y))
347
+ f = t.x, m = Array.isArray(t.y) ? t.y : [t.y];
348
+ else
349
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
350
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
351
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "Invalid or missing chart axis configuration" })
352
+ ] }) });
353
+ if (!f || !m || m.length === 0)
354
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
355
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
356
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "Missing required X-axis or Y-axis fields" })
357
+ ] }) });
358
+ const { data: x, seriesKeys: v } = C(
359
+ e,
360
+ f,
361
+ m,
362
+ n,
363
+ N,
364
+ d
365
+ ), p = u.showLegend, S = {
366
+ ...ve,
367
+ left: 40
368
+ // Increased from 20 to 40 for Y-axis label space
369
+ };
370
+ return !x || x.length === 0 ? /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
371
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No valid data" }),
372
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No valid data points for line chart after transformation" })
373
+ ] }) }) : /* @__PURE__ */ i(U, { height: s, children: /* @__PURE__ */ g(xt, { data: x, margin: S, children: [
374
+ u.showGrid && /* @__PURE__ */ i(he, { strokeDasharray: "3 3" }),
375
+ /* @__PURE__ */ i(
376
+ ye,
377
+ {
378
+ dataKey: "name",
379
+ tick: { fontSize: 12 },
380
+ angle: -45,
381
+ textAnchor: "end",
382
+ height: 60
383
+ }
384
+ ),
385
+ /* @__PURE__ */ i(
386
+ pe,
387
+ {
388
+ tick: { fontSize: 12 },
389
+ label: { value: o(m[0]), angle: -90, position: "left", style: { textAnchor: "middle", fontSize: "12px" } }
390
+ }
391
+ ),
392
+ u.showTooltip && /* @__PURE__ */ i(V, {}),
393
+ p && /* @__PURE__ */ i(
394
+ _,
395
+ {
396
+ wrapperStyle: { fontSize: "12px", paddingTop: "25px" },
397
+ iconType: "line",
398
+ iconSize: 8,
399
+ layout: "horizontal",
400
+ align: "center",
401
+ verticalAlign: "bottom",
402
+ onMouseEnter: ($) => c(String($.dataKey || "")),
403
+ onMouseLeave: () => c(null)
404
+ }
405
+ ),
406
+ v.map(($, h) => /* @__PURE__ */ i(
407
+ ht,
408
+ {
409
+ type: "monotone",
410
+ dataKey: $,
411
+ stroke: (a == null ? void 0 : a.colors) && a.colors[h % a.colors.length] || T[h % T.length],
412
+ strokeWidth: 2,
413
+ dot: { r: 3 },
414
+ activeDot: { r: 5 },
415
+ strokeOpacity: l ? l === $ ? 1 : 0.3 : 1
416
+ },
417
+ $
418
+ ))
419
+ ] }) });
420
+ } catch (u) {
421
+ return console.error("LineChart rendering error:", u), /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center w-full text-red-500 p-4", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
422
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Line Chart Error" }),
423
+ /* @__PURE__ */ i("div", { className: "text-xs mb-2", children: u instanceof Error ? u.message : "Unknown rendering error" }),
424
+ /* @__PURE__ */ i("div", { className: "text-xs text-gray-600", children: "Check the data and configuration" })
425
+ ] }) });
426
+ }
427
+ }
428
+ function qr({
429
+ data: e,
430
+ chartConfig: t,
431
+ displayConfig: r = {},
432
+ queryObject: n,
433
+ height: s = "100%",
434
+ colorPalette: a
435
+ }) {
436
+ const [l, c] = G(null), { labelMap: d, getFieldLabel: o } = K();
437
+ try {
438
+ const u = {
439
+ showLegend: (r == null ? void 0 : r.showLegend) ?? !0,
440
+ showGrid: (r == null ? void 0 : r.showGrid) ?? !0,
441
+ showTooltip: (r == null ? void 0 : r.showTooltip) ?? !0,
442
+ stacked: (r == null ? void 0 : r.stacked) ?? !1
443
+ };
444
+ if (!e || e.length === 0)
445
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
446
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
447
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No data points to display in area chart" })
448
+ ] }) });
449
+ let f, m, N = [];
450
+ if (t != null && t.xAxis && (t != null && t.yAxis))
451
+ f = t.xAxis[0], m = Array.isArray(t.yAxis) ? t.yAxis : [t.yAxis], N = t.series || [];
452
+ else if (t != null && t.x && (t != null && t.y))
453
+ f = t.x, m = Array.isArray(t.y) ? t.y : [t.y];
454
+ else
455
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
456
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
457
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "Invalid or missing chart axis configuration" })
458
+ ] }) });
459
+ if (!f || !m || m.length === 0)
460
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
461
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
462
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "Missing required X-axis or Y-axis fields" })
463
+ ] }) });
464
+ const { data: x, seriesKeys: v } = C(
465
+ e,
466
+ f,
467
+ m,
468
+ n,
469
+ N,
470
+ d
471
+ ), p = u.showLegend, S = {
472
+ ...ve,
473
+ left: 40
474
+ // Increased from 20 to 40 for Y-axis label space
475
+ };
476
+ return !x || x.length === 0 ? /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
477
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No valid data" }),
478
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No valid data points for area chart after transformation" })
479
+ ] }) }) : /* @__PURE__ */ i(U, { height: s, children: /* @__PURE__ */ g(yt, { data: x, margin: S, children: [
480
+ u.showGrid && /* @__PURE__ */ i(he, { strokeDasharray: "3 3" }),
481
+ /* @__PURE__ */ i(
482
+ ye,
483
+ {
484
+ dataKey: "name",
485
+ tick: { fontSize: 12 },
486
+ angle: -45,
487
+ textAnchor: "end",
488
+ height: 60
489
+ }
490
+ ),
491
+ /* @__PURE__ */ i(
492
+ pe,
493
+ {
494
+ tick: { fontSize: 12 },
495
+ label: { value: o(m[0]), angle: -90, position: "left", style: { textAnchor: "middle", fontSize: "12px" } }
496
+ }
497
+ ),
498
+ u.showTooltip && /* @__PURE__ */ i(V, {}),
499
+ p && /* @__PURE__ */ i(
500
+ _,
501
+ {
502
+ wrapperStyle: { fontSize: "12px", paddingTop: "10px" },
503
+ iconType: "rect",
504
+ iconSize: 8,
505
+ layout: "horizontal",
506
+ align: "center",
507
+ verticalAlign: "bottom",
508
+ onMouseEnter: ($) => c(String($.dataKey || "")),
509
+ onMouseLeave: () => c(null)
510
+ }
511
+ ),
512
+ v.map(($, h) => /* @__PURE__ */ i(
513
+ pt,
514
+ {
515
+ type: "monotone",
516
+ dataKey: $,
517
+ stackId: u.stacked ? "stack" : void 0,
518
+ stroke: (a == null ? void 0 : a.colors) && a.colors[h % a.colors.length] || T[h % T.length],
519
+ fill: (a == null ? void 0 : a.colors) && a.colors[h % a.colors.length] || T[h % T.length],
520
+ fillOpacity: l ? l === $ ? 0.6 : 0.1 : 0.3,
521
+ strokeWidth: 2,
522
+ strokeOpacity: l ? l === $ ? 1 : 0.3 : 1
523
+ },
524
+ $
525
+ ))
526
+ ] }) });
527
+ } catch (u) {
528
+ return console.error("AreaChart rendering error:", u), /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center w-full text-red-500 p-4", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
529
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Area Chart Error" }),
530
+ /* @__PURE__ */ i("div", { className: "text-xs mb-2", children: u instanceof Error ? u.message : "Unknown rendering error" }),
531
+ /* @__PURE__ */ i("div", { className: "text-xs text-gray-600", children: "Check the data and configuration" })
532
+ ] }) });
533
+ }
534
+ }
535
+ function Br({
536
+ data: e,
537
+ chartConfig: t,
538
+ displayConfig: r = {},
539
+ queryObject: n,
540
+ height: s = "100%",
541
+ colorPalette: a
542
+ }) {
543
+ const [l, c] = G(null), { labelMap: d } = K();
544
+ try {
545
+ const o = {
546
+ showLegend: (r == null ? void 0 : r.showLegend) ?? !0,
547
+ showTooltip: (r == null ? void 0 : r.showTooltip) ?? !0
548
+ };
549
+ if (!e || e.length === 0)
550
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
551
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
552
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No data points to display in pie chart" })
553
+ ] }) });
554
+ let u, f, m, N = [];
555
+ if (t != null && t.xAxis && (t != null && t.yAxis))
556
+ f = t.xAxis[0], m = Array.isArray(t.yAxis) ? t.yAxis : [t.yAxis], N = t.series || [];
557
+ else if (t != null && t.x && (t != null && t.y))
558
+ f = t.x, m = Array.isArray(t.y) ? t.y : [t.y];
559
+ else
560
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
561
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
562
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "chartConfig.x/y or chartConfig.xAxis/yAxis required for pie chart" })
563
+ ] }) });
564
+ if (!f || !m || m.length === 0)
565
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
566
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
567
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "Missing required X-axis or Y-axis fields" })
568
+ ] }) });
569
+ if (N.length > 0) {
570
+ const { data: v } = C(
571
+ e,
572
+ f,
573
+ m,
574
+ n,
575
+ N,
576
+ d
577
+ );
578
+ if (u = [], v.length > 0) {
579
+ const p = v[0];
580
+ Object.keys(p).forEach((S) => {
581
+ S !== "name" && typeof p[S] == "number" && u.push({
582
+ name: String(S),
583
+ value: p[S]
584
+ });
585
+ });
586
+ }
587
+ } else {
588
+ const v = O(n, f);
589
+ u = e.map((p) => {
590
+ let S = D(p[f], v) || String(p[f]) || "Unknown";
591
+ return typeof p[f] == "boolean" ? S = p[f] ? "Active" : "Inactive" : (S === "true" || S === "false") && (S = S === "true" ? "Active" : "Inactive"), {
592
+ name: S,
593
+ value: typeof p[m[0]] == "string" ? parseFloat(p[m[0]]) : p[m[0]] || 0
594
+ };
595
+ });
596
+ }
597
+ const x = u.length;
598
+ return u = u.filter(
599
+ (v) => v.value != null && !isNaN(v.value) && v.value !== 0 && v.value > 0
600
+ ), u.length === 0 ? /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
601
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No valid data" }),
602
+ /* @__PURE__ */ i("div", { className: "text-xs", children: x > 0 ? `Filtered out ${x} data points (zero or invalid values)` : "No data points to display in pie chart" })
603
+ ] }) }) : /* @__PURE__ */ i(U, { height: s, children: /* @__PURE__ */ g(vt, { children: [
604
+ /* @__PURE__ */ i(
605
+ gt,
606
+ {
607
+ data: u,
608
+ cx: "50%",
609
+ cy: "50%",
610
+ outerRadius: "70%",
611
+ dataKey: "value",
612
+ label: o.showLegend ? void 0 : ({ name: v, percent: p }) => `${v} ${(p * 100).toFixed(0)}%`,
613
+ children: u.map((v, p) => /* @__PURE__ */ i(
614
+ ke,
615
+ {
616
+ fill: (a == null ? void 0 : a.colors) && a.colors[p % a.colors.length] || T[p % T.length],
617
+ fillOpacity: l ? l === u[p].name ? 1 : 0.3 : 1
618
+ },
619
+ `cell-${p}`
620
+ ))
621
+ }
622
+ ),
623
+ o.showTooltip && /* @__PURE__ */ i(V, {}),
624
+ o.showLegend && /* @__PURE__ */ i(
625
+ _,
626
+ {
627
+ wrapperStyle: { fontSize: "12px", paddingTop: "10px" },
628
+ iconType: "circle",
629
+ iconSize: 8,
630
+ layout: "horizontal",
631
+ align: "center",
632
+ verticalAlign: "bottom",
633
+ onMouseEnter: (v) => c(String(v.value || "")),
634
+ onMouseLeave: () => c(null)
635
+ }
636
+ )
637
+ ] }) });
638
+ } catch (o) {
639
+ return console.error("PieChart rendering error:", o), /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center w-full text-red-500 p-4", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
640
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Pie Chart Error" }),
641
+ /* @__PURE__ */ i("div", { className: "text-xs mb-2", children: o instanceof Error ? o.message : "Unknown rendering error" }),
642
+ /* @__PURE__ */ i("div", { className: "text-xs text-gray-600", children: "Check the data and configuration" })
643
+ ] }) });
644
+ }
645
+ }
646
+ function _r({
647
+ data: e,
648
+ chartConfig: t,
649
+ displayConfig: r = {},
650
+ queryObject: n,
651
+ height: s = "100%",
652
+ colorPalette: a
653
+ }) {
654
+ const [l, c] = G(null), { getFieldLabel: d } = K();
655
+ try {
656
+ const o = {
657
+ showLegend: (r == null ? void 0 : r.showLegend) ?? !0,
658
+ showGrid: (r == null ? void 0 : r.showGrid) ?? !0,
659
+ showTooltip: (r == null ? void 0 : r.showTooltip) ?? !0
660
+ };
661
+ if (!e || e.length === 0)
662
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
663
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
664
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No data points to display in scatter chart" })
665
+ ] }) });
666
+ let u, f, m = [];
667
+ if (t != null && t.xAxis && (t != null && t.yAxis))
668
+ u = t.xAxis[0], f = Array.isArray(t.yAxis) ? t.yAxis[0] : t.yAxis, m = t.series || [];
669
+ else if (t != null && t.x && (t != null && t.y))
670
+ u = t.x, f = Array.isArray(t.y) ? t.y[0] : t.y;
671
+ else
672
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
673
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
674
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "Invalid or missing chart axis configuration" })
675
+ ] }) });
676
+ if (!u || !f)
677
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
678
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
679
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "Missing required X-axis or Y-axis fields" })
680
+ ] }) });
681
+ let N, x = {};
682
+ if (m.length > 0) {
683
+ const h = m[0];
684
+ e.forEach((b) => {
685
+ const A = String(b[h] || "Default");
686
+ x[A] || (x[A] = []);
687
+ const w = O(n, u), k = D(b[u], w) || b[u], L = typeof b[f] == "string" ? parseFloat(b[f]) : b[f] || 0;
688
+ x[A].push({
689
+ x: typeof k == "string" ? parseFloat(k) || 0 : k,
690
+ y: L,
691
+ name: `${A} (${k}, ${L})`
692
+ });
693
+ });
694
+ const y = Object.keys(x);
695
+ N = x[y[0]] || [];
696
+ } else {
697
+ const h = O(n, u);
698
+ N = e.map((y) => {
699
+ const b = D(y[u], h) || y[u], A = typeof y[f] == "string" ? parseFloat(y[f]) : y[f] || 0;
700
+ return {
701
+ x: typeof b == "string" ? parseFloat(b) || 0 : b,
702
+ y: A,
703
+ name: `(${b}, ${A})`
704
+ };
705
+ });
706
+ }
707
+ if (!N || N.length === 0)
708
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
709
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No valid data" }),
710
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No valid data points for scatter chart after transformation" })
711
+ ] }) });
712
+ const v = Object.keys(x), p = v.length > 1, S = o.showLegend && p, $ = {
713
+ ...ve,
714
+ left: 40
715
+ // Increased from 20 to 40 for Y-axis label space
716
+ };
717
+ return /* @__PURE__ */ i(U, { height: s, children: /* @__PURE__ */ g(bt, { data: N, margin: $, children: [
718
+ o.showGrid && /* @__PURE__ */ i(he, { strokeDasharray: "3 3" }),
719
+ /* @__PURE__ */ i(
720
+ ye,
721
+ {
722
+ type: "number",
723
+ dataKey: "x",
724
+ name: d(u),
725
+ tick: { fontSize: 12 }
726
+ }
727
+ ),
728
+ /* @__PURE__ */ i(
729
+ pe,
730
+ {
731
+ type: "number",
732
+ dataKey: "y",
733
+ name: d(f),
734
+ tick: { fontSize: 12 },
735
+ label: { value: d(f), angle: -90, position: "left", style: { textAnchor: "middle", fontSize: "12px" } }
736
+ }
737
+ ),
738
+ o.showTooltip && /* @__PURE__ */ i(V, {}),
739
+ S && /* @__PURE__ */ i(
740
+ _,
741
+ {
742
+ wrapperStyle: { fontSize: "12px", paddingTop: "10px" },
743
+ iconType: "circle",
744
+ iconSize: 8,
745
+ layout: "horizontal",
746
+ align: "center",
747
+ verticalAlign: "bottom",
748
+ onMouseEnter: (h) => c(String(h.dataKey || "")),
749
+ onMouseLeave: () => c(null)
750
+ }
751
+ ),
752
+ p ? (
753
+ // Multiple series
754
+ v.map((h, y) => /* @__PURE__ */ i(
755
+ Re,
756
+ {
757
+ name: h,
758
+ data: x[h],
759
+ fill: (a == null ? void 0 : a.colors) && a.colors[y % a.colors.length] || T[y % T.length],
760
+ fillOpacity: l ? l === h ? 1 : 0.3 : 1
761
+ },
762
+ h
763
+ ))
764
+ ) : (
765
+ // Single series
766
+ /* @__PURE__ */ i(
767
+ Re,
768
+ {
769
+ name: "Data",
770
+ data: N,
771
+ fill: (a == null ? void 0 : a.colors) && a.colors[0] || T[0]
772
+ }
773
+ )
774
+ )
775
+ ] }) });
776
+ } catch (o) {
777
+ return console.error("ScatterChart rendering error:", o), /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center w-full text-red-500 p-4", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
778
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Scatter Chart Error" }),
779
+ /* @__PURE__ */ i("div", { className: "text-xs mb-2", children: o instanceof Error ? o.message : "Unknown rendering error" }),
780
+ /* @__PURE__ */ i("div", { className: "text-xs text-gray-600", children: "Check the data and configuration" })
781
+ ] }) });
782
+ }
783
+ }
784
+ function Kr({
785
+ data: e,
786
+ chartConfig: t,
787
+ displayConfig: r = {},
788
+ queryObject: n,
789
+ height: s = "100%",
790
+ colorPalette: a
791
+ }) {
792
+ const [l, c] = G(null);
793
+ try {
794
+ const d = {
795
+ showLegend: (r == null ? void 0 : r.showLegend) ?? !0,
796
+ showTooltip: (r == null ? void 0 : r.showTooltip) ?? !0,
797
+ showGrid: (r == null ? void 0 : r.showGrid) ?? !0
798
+ };
799
+ if (!e || e.length === 0)
800
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
801
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
802
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No data points to display in radar chart" })
803
+ ] }) });
804
+ let o, u = [];
805
+ if (t != null && t.xAxis && (t != null && t.yAxis)) {
806
+ const f = t.xAxis[0], m = Array.isArray(t.yAxis) ? t.yAxis : [t.yAxis], N = t.series || [], { data: x, seriesKeys: v } = C(
807
+ e,
808
+ f,
809
+ m,
810
+ n,
811
+ N
812
+ );
813
+ o = x, u = v;
814
+ } else {
815
+ const f = e[0], m = Object.keys(f), N = m.find(
816
+ (v) => typeof f[v] == "string" || v.toLowerCase().includes("subject") || v.toLowerCase().includes("name") || v.toLowerCase().includes("category")
817
+ ) || m[0], x = m.filter(
818
+ (v) => typeof f[v] == "number" && v !== N
819
+ );
820
+ if (x.length === 0)
821
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
822
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
823
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No numeric fields found for radar chart values" })
824
+ ] }) });
825
+ if (N) {
826
+ const v = O(n, N);
827
+ o = e.map((p) => {
828
+ const S = {
829
+ name: D(p[N], v) || String(p[N]) || "Unknown"
830
+ };
831
+ return x.forEach(($) => {
832
+ const h = $.split(".").pop() || $;
833
+ S[h] = typeof p[$] == "string" ? parseFloat(p[$]) : p[$] || 0;
834
+ }), S;
835
+ }), u = x.map((p) => p.split(".").pop() || p);
836
+ } else
837
+ o = e.map((v) => ({
838
+ name: String(v[m[0]] || "Unknown"),
839
+ value: typeof v[x[0]] == "string" ? parseFloat(v[x[0]]) : v[x[0]] || 0
840
+ })), u = ["value"];
841
+ }
842
+ return !o || o.length === 0 ? /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
843
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No valid data" }),
844
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No valid data points for radar chart after transformation" })
845
+ ] }) }) : /* @__PURE__ */ i(U, { height: s, children: /* @__PURE__ */ g(wt, { data: o, margin: { top: 20, right: 80, bottom: 20, left: 80 }, children: [
846
+ d.showGrid && /* @__PURE__ */ i(Nt, {}),
847
+ /* @__PURE__ */ i(
848
+ At,
849
+ {
850
+ dataKey: "name",
851
+ tick: { fontSize: 12 },
852
+ className: "text-gray-600"
853
+ }
854
+ ),
855
+ /* @__PURE__ */ i(
856
+ St,
857
+ {
858
+ tick: { fontSize: 10 },
859
+ className: "text-gray-600"
860
+ }
861
+ ),
862
+ d.showTooltip && /* @__PURE__ */ i(V, {}),
863
+ d.showLegend && u.length > 1 && /* @__PURE__ */ i(
864
+ _,
865
+ {
866
+ wrapperStyle: { fontSize: "12px", paddingTop: "10px" },
867
+ iconType: "rect",
868
+ iconSize: 8,
869
+ layout: "horizontal",
870
+ align: "center",
871
+ verticalAlign: "bottom",
872
+ onMouseEnter: (f) => c(String(f.dataKey || "")),
873
+ onMouseLeave: () => c(null)
874
+ }
875
+ ),
876
+ u.map((f, m) => /* @__PURE__ */ i(
877
+ Mt,
878
+ {
879
+ name: f,
880
+ dataKey: f,
881
+ stroke: (a == null ? void 0 : a.colors) && a.colors[m % a.colors.length] || T[m % T.length],
882
+ fill: (a == null ? void 0 : a.colors) && a.colors[m % a.colors.length] || T[m % T.length],
883
+ fillOpacity: l ? l === f ? 0.6 : 0.1 : 0.3,
884
+ strokeOpacity: l ? l === f ? 1 : 0.3 : 1,
885
+ strokeWidth: 2
886
+ },
887
+ f
888
+ ))
889
+ ] }) });
890
+ } catch (d) {
891
+ return console.error("RadarChart rendering error:", d), /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center w-full text-red-500 p-4", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
892
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Radar Chart Error" }),
893
+ /* @__PURE__ */ i("div", { className: "text-xs mb-2", children: d instanceof Error ? d.message : "Unknown rendering error" }),
894
+ /* @__PURE__ */ i("div", { className: "text-xs text-gray-600", children: "Check the data and configuration" })
895
+ ] }) });
896
+ }
897
+ }
898
+ function Yr({
899
+ data: e,
900
+ chartConfig: t,
901
+ displayConfig: r = {},
902
+ queryObject: n,
903
+ height: s = "100%",
904
+ colorPalette: a
905
+ }) {
906
+ const [l, c] = G(null);
907
+ try {
908
+ const d = {
909
+ showLegend: (r == null ? void 0 : r.showLegend) ?? !0,
910
+ showTooltip: (r == null ? void 0 : r.showTooltip) ?? !0
911
+ };
912
+ if (!e || e.length === 0)
913
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
914
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
915
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No data points to display in radial bar chart" })
916
+ ] }) });
917
+ let o;
918
+ if (t != null && t.xAxis && (t != null && t.yAxis)) {
919
+ const u = t.xAxis[0], f = Array.isArray(t.yAxis) ? t.yAxis[0] : t.yAxis, m = O(n, u);
920
+ o = e.map((N, x) => ({
921
+ name: D(N[u], m) || String(N[u]) || "Unknown",
922
+ value: typeof N[f] == "string" ? parseFloat(N[f]) : N[f] || 0,
923
+ fill: (a == null ? void 0 : a.colors) && a.colors[x % a.colors.length] || T[x % T.length]
924
+ }));
925
+ } else {
926
+ const u = e[0], f = Object.keys(u), m = f.find(
927
+ (x) => typeof u[x] == "string" || x.toLowerCase().includes("name") || x.toLowerCase().includes("label") || x.toLowerCase().includes("category")
928
+ ) || f[0], N = f.find(
929
+ (x) => typeof u[x] == "number" && x !== m
930
+ ) || f[1];
931
+ if (!N)
932
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
933
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
934
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No numeric field found for radial bar chart values" })
935
+ ] }) });
936
+ o = e.map((x, v) => {
937
+ let p = x[m];
938
+ return typeof p == "boolean" ? p = p ? "Active" : "Inactive" : p === "true" || p === "false" ? p = p === "true" ? "Active" : "Inactive" : p = String(p), {
939
+ name: p,
940
+ value: typeof x[N] == "string" ? parseFloat(x[N]) : x[N] || 0,
941
+ fill: (a == null ? void 0 : a.colors) && a.colors[v % a.colors.length] || T[v % T.length]
942
+ };
943
+ });
944
+ }
945
+ return o = o.filter((u) => u.value != null && u.value !== 0), o.length === 0 ? /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
946
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No valid data" }),
947
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No valid data points for radial bar chart after transformation" })
948
+ ] }) }) : /* @__PURE__ */ i(U, { height: s, children: /* @__PURE__ */ g(
949
+ kt,
950
+ {
951
+ data: o,
952
+ innerRadius: "10%",
953
+ outerRadius: "80%",
954
+ margin: { top: 20, right: 30, bottom: 20, left: 30 },
955
+ children: [
956
+ d.showTooltip && /* @__PURE__ */ i(V, {}),
957
+ d.showLegend && /* @__PURE__ */ i(
958
+ _,
959
+ {
960
+ wrapperStyle: { fontSize: "12px", paddingTop: "10px" },
961
+ iconType: "circle",
962
+ iconSize: 8,
963
+ layout: "horizontal",
964
+ align: "center",
965
+ verticalAlign: "bottom",
966
+ onMouseEnter: (u) => c(String(u.value || "")),
967
+ onMouseLeave: () => c(null)
968
+ }
969
+ ),
970
+ /* @__PURE__ */ i(
971
+ $t,
972
+ {
973
+ dataKey: "value",
974
+ cornerRadius: 4,
975
+ label: { position: "insideStart", fill: "#fff", fontSize: 12 },
976
+ children: o.map((u, f) => /* @__PURE__ */ i(
977
+ ke,
978
+ {
979
+ fill: u.fill,
980
+ fillOpacity: l ? l === u.name ? 1 : 0.3 : 1
981
+ },
982
+ `cell-${f}`
983
+ ))
984
+ }
985
+ )
986
+ ]
987
+ }
988
+ ) });
989
+ } catch (d) {
990
+ return console.error("RadialBarChart rendering error:", d), /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center w-full text-red-500 p-4", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
991
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Radial Bar Chart Error" }),
992
+ /* @__PURE__ */ i("div", { className: "text-xs mb-2", children: d instanceof Error ? d.message : "Unknown rendering error" }),
993
+ /* @__PURE__ */ i("div", { className: "text-xs text-gray-600", children: "Check the data and configuration" })
994
+ ] }) });
995
+ }
996
+ }
997
+ function oe(e, t) {
998
+ return e == null || t == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
999
+ }
1000
+ function jt(e, t) {
1001
+ return e == null || t == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
1002
+ }
1003
+ function et(e) {
1004
+ let t, r, n;
1005
+ e.length !== 2 ? (t = oe, r = (c, d) => oe(e(c), d), n = (c, d) => e(c) - d) : (t = e === oe || e === jt ? e : Et, r = e, n = e);
1006
+ function s(c, d, o = 0, u = c.length) {
1007
+ if (o < u) {
1008
+ if (t(d, d) !== 0) return u;
1009
+ do {
1010
+ const f = o + u >>> 1;
1011
+ r(c[f], d) < 0 ? o = f + 1 : u = f;
1012
+ } while (o < u);
1013
+ }
1014
+ return o;
1015
+ }
1016
+ function a(c, d, o = 0, u = c.length) {
1017
+ if (o < u) {
1018
+ if (t(d, d) !== 0) return u;
1019
+ do {
1020
+ const f = o + u >>> 1;
1021
+ r(c[f], d) <= 0 ? o = f + 1 : u = f;
1022
+ } while (o < u);
1023
+ }
1024
+ return o;
1025
+ }
1026
+ function l(c, d, o = 0, u = c.length) {
1027
+ const f = s(c, d, o, u - 1);
1028
+ return f > o && n(c[f - 1], d) > -n(c[f], d) ? f - 1 : f;
1029
+ }
1030
+ return { left: s, center: l, right: a };
1031
+ }
1032
+ function Et() {
1033
+ return 0;
1034
+ }
1035
+ function zt(e) {
1036
+ return e === null ? NaN : +e;
1037
+ }
1038
+ const Rt = et(oe), tt = Rt.right;
1039
+ et(zt).center;
1040
+ class He extends Map {
1041
+ constructor(t, r = It) {
1042
+ if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: r } }), t != null) for (const [n, s] of t) this.set(n, s);
1043
+ }
1044
+ get(t) {
1045
+ return super.get(Ie(this, t));
1046
+ }
1047
+ has(t) {
1048
+ return super.has(Ie(this, t));
1049
+ }
1050
+ set(t, r) {
1051
+ return super.set(Dt(this, t), r);
1052
+ }
1053
+ delete(t) {
1054
+ return super.delete(Ht(this, t));
1055
+ }
1056
+ }
1057
+ function Ie({ _intern: e, _key: t }, r) {
1058
+ const n = t(r);
1059
+ return e.has(n) ? e.get(n) : r;
1060
+ }
1061
+ function Dt({ _intern: e, _key: t }, r) {
1062
+ const n = t(r);
1063
+ return e.has(n) ? e.get(n) : (e.set(n, r), r);
1064
+ }
1065
+ function Ht({ _intern: e, _key: t }, r) {
1066
+ const n = t(r);
1067
+ return e.has(n) && (r = e.get(n), e.delete(n)), r;
1068
+ }
1069
+ function It(e) {
1070
+ return e !== null && typeof e == "object" ? e.valueOf() : e;
1071
+ }
1072
+ const Ot = Math.sqrt(50), Gt = Math.sqrt(10), Ut = Math.sqrt(2);
1073
+ function ce(e, t, r) {
1074
+ const n = (t - e) / Math.max(0, r), s = Math.floor(Math.log10(n)), a = n / Math.pow(10, s), l = a >= Ot ? 10 : a >= Gt ? 5 : a >= Ut ? 2 : 1;
1075
+ let c, d, o;
1076
+ return s < 0 ? (o = Math.pow(10, -s) / l, c = Math.round(e * o), d = Math.round(t * o), c / o < e && ++c, d / o > t && --d, o = -o) : (o = Math.pow(10, s) * l, c = Math.round(e / o), d = Math.round(t / o), c * o < e && ++c, d * o > t && --d), d < c && 0.5 <= r && r < 2 ? ce(e, t, r * 2) : [c, d, o];
1077
+ }
1078
+ function Vt(e, t, r) {
1079
+ if (t = +t, e = +e, r = +r, !(r > 0)) return [];
1080
+ if (e === t) return [e];
1081
+ const n = t < e, [s, a, l] = n ? ce(t, e, r) : ce(e, t, r);
1082
+ if (!(a >= s)) return [];
1083
+ const c = a - s + 1, d = new Array(c);
1084
+ if (n)
1085
+ if (l < 0) for (let o = 0; o < c; ++o) d[o] = (a - o) / -l;
1086
+ else for (let o = 0; o < c; ++o) d[o] = (a - o) * l;
1087
+ else if (l < 0) for (let o = 0; o < c; ++o) d[o] = (s + o) / -l;
1088
+ else for (let o = 0; o < c; ++o) d[o] = (s + o) * l;
1089
+ return d;
1090
+ }
1091
+ function Ne(e, t, r) {
1092
+ return t = +t, e = +e, r = +r, ce(e, t, r)[2];
1093
+ }
1094
+ function qt(e, t, r) {
1095
+ t = +t, e = +e, r = +r;
1096
+ const n = t < e, s = n ? Ne(t, e, r) : Ne(e, t, r);
1097
+ return (n ? -1 : 1) * (s < 0 ? 1 / -s : s);
1098
+ }
1099
+ function $e(e, t, r) {
1100
+ e.prototype = t.prototype = r, r.constructor = e;
1101
+ }
1102
+ function rt(e, t) {
1103
+ var r = Object.create(e.prototype);
1104
+ for (var n in t) r[n] = t[n];
1105
+ return r;
1106
+ }
1107
+ function ee() {
1108
+ }
1109
+ var Z = 0.7, de = 1 / Z, X = "\\s*([+-]?\\d+)\\s*", J = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", H = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", Bt = /^#([0-9a-f]{3,8})$/, _t = new RegExp(`^rgb\\(${X},${X},${X}\\)$`), Kt = new RegExp(`^rgb\\(${H},${H},${H}\\)$`), Yt = new RegExp(`^rgba\\(${X},${X},${X},${J}\\)$`), Wt = new RegExp(`^rgba\\(${H},${H},${H},${J}\\)$`), Xt = new RegExp(`^hsl\\(${J},${H},${H}\\)$`), Qt = new RegExp(`^hsla\\(${J},${H},${H},${J}\\)$`), Oe = {
1110
+ aliceblue: 15792383,
1111
+ antiquewhite: 16444375,
1112
+ aqua: 65535,
1113
+ aquamarine: 8388564,
1114
+ azure: 15794175,
1115
+ beige: 16119260,
1116
+ bisque: 16770244,
1117
+ black: 0,
1118
+ blanchedalmond: 16772045,
1119
+ blue: 255,
1120
+ blueviolet: 9055202,
1121
+ brown: 10824234,
1122
+ burlywood: 14596231,
1123
+ cadetblue: 6266528,
1124
+ chartreuse: 8388352,
1125
+ chocolate: 13789470,
1126
+ coral: 16744272,
1127
+ cornflowerblue: 6591981,
1128
+ cornsilk: 16775388,
1129
+ crimson: 14423100,
1130
+ cyan: 65535,
1131
+ darkblue: 139,
1132
+ darkcyan: 35723,
1133
+ darkgoldenrod: 12092939,
1134
+ darkgray: 11119017,
1135
+ darkgreen: 25600,
1136
+ darkgrey: 11119017,
1137
+ darkkhaki: 12433259,
1138
+ darkmagenta: 9109643,
1139
+ darkolivegreen: 5597999,
1140
+ darkorange: 16747520,
1141
+ darkorchid: 10040012,
1142
+ darkred: 9109504,
1143
+ darksalmon: 15308410,
1144
+ darkseagreen: 9419919,
1145
+ darkslateblue: 4734347,
1146
+ darkslategray: 3100495,
1147
+ darkslategrey: 3100495,
1148
+ darkturquoise: 52945,
1149
+ darkviolet: 9699539,
1150
+ deeppink: 16716947,
1151
+ deepskyblue: 49151,
1152
+ dimgray: 6908265,
1153
+ dimgrey: 6908265,
1154
+ dodgerblue: 2003199,
1155
+ firebrick: 11674146,
1156
+ floralwhite: 16775920,
1157
+ forestgreen: 2263842,
1158
+ fuchsia: 16711935,
1159
+ gainsboro: 14474460,
1160
+ ghostwhite: 16316671,
1161
+ gold: 16766720,
1162
+ goldenrod: 14329120,
1163
+ gray: 8421504,
1164
+ green: 32768,
1165
+ greenyellow: 11403055,
1166
+ grey: 8421504,
1167
+ honeydew: 15794160,
1168
+ hotpink: 16738740,
1169
+ indianred: 13458524,
1170
+ indigo: 4915330,
1171
+ ivory: 16777200,
1172
+ khaki: 15787660,
1173
+ lavender: 15132410,
1174
+ lavenderblush: 16773365,
1175
+ lawngreen: 8190976,
1176
+ lemonchiffon: 16775885,
1177
+ lightblue: 11393254,
1178
+ lightcoral: 15761536,
1179
+ lightcyan: 14745599,
1180
+ lightgoldenrodyellow: 16448210,
1181
+ lightgray: 13882323,
1182
+ lightgreen: 9498256,
1183
+ lightgrey: 13882323,
1184
+ lightpink: 16758465,
1185
+ lightsalmon: 16752762,
1186
+ lightseagreen: 2142890,
1187
+ lightskyblue: 8900346,
1188
+ lightslategray: 7833753,
1189
+ lightslategrey: 7833753,
1190
+ lightsteelblue: 11584734,
1191
+ lightyellow: 16777184,
1192
+ lime: 65280,
1193
+ limegreen: 3329330,
1194
+ linen: 16445670,
1195
+ magenta: 16711935,
1196
+ maroon: 8388608,
1197
+ mediumaquamarine: 6737322,
1198
+ mediumblue: 205,
1199
+ mediumorchid: 12211667,
1200
+ mediumpurple: 9662683,
1201
+ mediumseagreen: 3978097,
1202
+ mediumslateblue: 8087790,
1203
+ mediumspringgreen: 64154,
1204
+ mediumturquoise: 4772300,
1205
+ mediumvioletred: 13047173,
1206
+ midnightblue: 1644912,
1207
+ mintcream: 16121850,
1208
+ mistyrose: 16770273,
1209
+ moccasin: 16770229,
1210
+ navajowhite: 16768685,
1211
+ navy: 128,
1212
+ oldlace: 16643558,
1213
+ olive: 8421376,
1214
+ olivedrab: 7048739,
1215
+ orange: 16753920,
1216
+ orangered: 16729344,
1217
+ orchid: 14315734,
1218
+ palegoldenrod: 15657130,
1219
+ palegreen: 10025880,
1220
+ paleturquoise: 11529966,
1221
+ palevioletred: 14381203,
1222
+ papayawhip: 16773077,
1223
+ peachpuff: 16767673,
1224
+ peru: 13468991,
1225
+ pink: 16761035,
1226
+ plum: 14524637,
1227
+ powderblue: 11591910,
1228
+ purple: 8388736,
1229
+ rebeccapurple: 6697881,
1230
+ red: 16711680,
1231
+ rosybrown: 12357519,
1232
+ royalblue: 4286945,
1233
+ saddlebrown: 9127187,
1234
+ salmon: 16416882,
1235
+ sandybrown: 16032864,
1236
+ seagreen: 3050327,
1237
+ seashell: 16774638,
1238
+ sienna: 10506797,
1239
+ silver: 12632256,
1240
+ skyblue: 8900331,
1241
+ slateblue: 6970061,
1242
+ slategray: 7372944,
1243
+ slategrey: 7372944,
1244
+ snow: 16775930,
1245
+ springgreen: 65407,
1246
+ steelblue: 4620980,
1247
+ tan: 13808780,
1248
+ teal: 32896,
1249
+ thistle: 14204888,
1250
+ tomato: 16737095,
1251
+ turquoise: 4251856,
1252
+ violet: 15631086,
1253
+ wheat: 16113331,
1254
+ white: 16777215,
1255
+ whitesmoke: 16119285,
1256
+ yellow: 16776960,
1257
+ yellowgreen: 10145074
1258
+ };
1259
+ $e(ee, P, {
1260
+ copy(e) {
1261
+ return Object.assign(new this.constructor(), this, e);
1262
+ },
1263
+ displayable() {
1264
+ return this.rgb().displayable();
1265
+ },
1266
+ hex: Ge,
1267
+ // Deprecated! Use color.formatHex.
1268
+ formatHex: Ge,
1269
+ formatHex8: Zt,
1270
+ formatHsl: Jt,
1271
+ formatRgb: Ue,
1272
+ toString: Ue
1273
+ });
1274
+ function Ge() {
1275
+ return this.rgb().formatHex();
1276
+ }
1277
+ function Zt() {
1278
+ return this.rgb().formatHex8();
1279
+ }
1280
+ function Jt() {
1281
+ return nt(this).formatHsl();
1282
+ }
1283
+ function Ue() {
1284
+ return this.rgb().formatRgb();
1285
+ }
1286
+ function P(e) {
1287
+ var t, r;
1288
+ return e = (e + "").trim().toLowerCase(), (t = Bt.exec(e)) ? (r = t[1].length, t = parseInt(t[1], 16), r === 6 ? Ve(t) : r === 3 ? new j(t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, (t & 15) << 4 | t & 15, 1) : r === 8 ? ie(t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, (t & 255) / 255) : r === 4 ? ie(t >> 12 & 15 | t >> 8 & 240, t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, ((t & 15) << 4 | t & 15) / 255) : null) : (t = _t.exec(e)) ? new j(t[1], t[2], t[3], 1) : (t = Kt.exec(e)) ? new j(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, 1) : (t = Yt.exec(e)) ? ie(t[1], t[2], t[3], t[4]) : (t = Wt.exec(e)) ? ie(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, t[4]) : (t = Xt.exec(e)) ? _e(t[1], t[2] / 100, t[3] / 100, 1) : (t = Qt.exec(e)) ? _e(t[1], t[2] / 100, t[3] / 100, t[4]) : Oe.hasOwnProperty(e) ? Ve(Oe[e]) : e === "transparent" ? new j(NaN, NaN, NaN, 0) : null;
1289
+ }
1290
+ function Ve(e) {
1291
+ return new j(e >> 16 & 255, e >> 8 & 255, e & 255, 1);
1292
+ }
1293
+ function ie(e, t, r, n) {
1294
+ return n <= 0 && (e = t = r = NaN), new j(e, t, r, n);
1295
+ }
1296
+ function Pt(e) {
1297
+ return e instanceof ee || (e = P(e)), e ? (e = e.rgb(), new j(e.r, e.g, e.b, e.opacity)) : new j();
1298
+ }
1299
+ function Ae(e, t, r, n) {
1300
+ return arguments.length === 1 ? Pt(e) : new j(e, t, r, n ?? 1);
1301
+ }
1302
+ function j(e, t, r, n) {
1303
+ this.r = +e, this.g = +t, this.b = +r, this.opacity = +n;
1304
+ }
1305
+ $e(j, Ae, rt(ee, {
1306
+ brighter(e) {
1307
+ return e = e == null ? de : Math.pow(de, e), new j(this.r * e, this.g * e, this.b * e, this.opacity);
1308
+ },
1309
+ darker(e) {
1310
+ return e = e == null ? Z : Math.pow(Z, e), new j(this.r * e, this.g * e, this.b * e, this.opacity);
1311
+ },
1312
+ rgb() {
1313
+ return this;
1314
+ },
1315
+ clamp() {
1316
+ return new j(B(this.r), B(this.g), B(this.b), ue(this.opacity));
1317
+ },
1318
+ displayable() {
1319
+ return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
1320
+ },
1321
+ hex: qe,
1322
+ // Deprecated! Use color.formatHex.
1323
+ formatHex: qe,
1324
+ formatHex8: Ct,
1325
+ formatRgb: Be,
1326
+ toString: Be
1327
+ }));
1328
+ function qe() {
1329
+ return `#${q(this.r)}${q(this.g)}${q(this.b)}`;
1330
+ }
1331
+ function Ct() {
1332
+ return `#${q(this.r)}${q(this.g)}${q(this.b)}${q((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
1333
+ }
1334
+ function Be() {
1335
+ const e = ue(this.opacity);
1336
+ return `${e === 1 ? "rgb(" : "rgba("}${B(this.r)}, ${B(this.g)}, ${B(this.b)}${e === 1 ? ")" : `, ${e})`}`;
1337
+ }
1338
+ function ue(e) {
1339
+ return isNaN(e) ? 1 : Math.max(0, Math.min(1, e));
1340
+ }
1341
+ function B(e) {
1342
+ return Math.max(0, Math.min(255, Math.round(e) || 0));
1343
+ }
1344
+ function q(e) {
1345
+ return e = B(e), (e < 16 ? "0" : "") + e.toString(16);
1346
+ }
1347
+ function _e(e, t, r, n) {
1348
+ return n <= 0 ? e = t = r = NaN : r <= 0 || r >= 1 ? e = t = NaN : t <= 0 && (e = NaN), new z(e, t, r, n);
1349
+ }
1350
+ function nt(e) {
1351
+ if (e instanceof z) return new z(e.h, e.s, e.l, e.opacity);
1352
+ if (e instanceof ee || (e = P(e)), !e) return new z();
1353
+ if (e instanceof z) return e;
1354
+ e = e.rgb();
1355
+ var t = e.r / 255, r = e.g / 255, n = e.b / 255, s = Math.min(t, r, n), a = Math.max(t, r, n), l = NaN, c = a - s, d = (a + s) / 2;
1356
+ return c ? (t === a ? l = (r - n) / c + (r < n) * 6 : r === a ? l = (n - t) / c + 2 : l = (t - r) / c + 4, c /= d < 0.5 ? a + s : 2 - a - s, l *= 60) : c = d > 0 && d < 1 ? 0 : l, new z(l, c, d, e.opacity);
1357
+ }
1358
+ function er(e, t, r, n) {
1359
+ return arguments.length === 1 ? nt(e) : new z(e, t, r, n ?? 1);
1360
+ }
1361
+ function z(e, t, r, n) {
1362
+ this.h = +e, this.s = +t, this.l = +r, this.opacity = +n;
1363
+ }
1364
+ $e(z, er, rt(ee, {
1365
+ brighter(e) {
1366
+ return e = e == null ? de : Math.pow(de, e), new z(this.h, this.s, this.l * e, this.opacity);
1367
+ },
1368
+ darker(e) {
1369
+ return e = e == null ? Z : Math.pow(Z, e), new z(this.h, this.s, this.l * e, this.opacity);
1370
+ },
1371
+ rgb() {
1372
+ var e = this.h % 360 + (this.h < 0) * 360, t = isNaN(e) || isNaN(this.s) ? 0 : this.s, r = this.l, n = r + (r < 0.5 ? r : 1 - r) * t, s = 2 * r - n;
1373
+ return new j(
1374
+ ge(e >= 240 ? e - 240 : e + 120, s, n),
1375
+ ge(e, s, n),
1376
+ ge(e < 120 ? e + 240 : e - 120, s, n),
1377
+ this.opacity
1378
+ );
1379
+ },
1380
+ clamp() {
1381
+ return new z(Ke(this.h), ae(this.s), ae(this.l), ue(this.opacity));
1382
+ },
1383
+ displayable() {
1384
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
1385
+ },
1386
+ formatHsl() {
1387
+ const e = ue(this.opacity);
1388
+ return `${e === 1 ? "hsl(" : "hsla("}${Ke(this.h)}, ${ae(this.s) * 100}%, ${ae(this.l) * 100}%${e === 1 ? ")" : `, ${e})`}`;
1389
+ }
1390
+ }));
1391
+ function Ke(e) {
1392
+ return e = (e || 0) % 360, e < 0 ? e + 360 : e;
1393
+ }
1394
+ function ae(e) {
1395
+ return Math.max(0, Math.min(1, e || 0));
1396
+ }
1397
+ function ge(e, t, r) {
1398
+ return (e < 60 ? t + (r - t) * e / 60 : e < 180 ? r : e < 240 ? t + (r - t) * (240 - e) / 60 : t) * 255;
1399
+ }
1400
+ const Le = (e) => () => e;
1401
+ function tr(e, t) {
1402
+ return function(r) {
1403
+ return e + r * t;
1404
+ };
1405
+ }
1406
+ function rr(e, t, r) {
1407
+ return e = Math.pow(e, r), t = Math.pow(t, r) - e, r = 1 / r, function(n) {
1408
+ return Math.pow(e + n * t, r);
1409
+ };
1410
+ }
1411
+ function nr(e) {
1412
+ return (e = +e) == 1 ? st : function(t, r) {
1413
+ return r - t ? rr(t, r, e) : Le(isNaN(t) ? r : t);
1414
+ };
1415
+ }
1416
+ function st(e, t) {
1417
+ var r = t - e;
1418
+ return r ? tr(e, r) : Le(isNaN(e) ? t : e);
1419
+ }
1420
+ const Ye = function e(t) {
1421
+ var r = nr(t);
1422
+ function n(s, a) {
1423
+ var l = r((s = Ae(s)).r, (a = Ae(a)).r), c = r(s.g, a.g), d = r(s.b, a.b), o = st(s.opacity, a.opacity);
1424
+ return function(u) {
1425
+ return s.r = l(u), s.g = c(u), s.b = d(u), s.opacity = o(u), s + "";
1426
+ };
1427
+ }
1428
+ return n.gamma = e, n;
1429
+ }(1);
1430
+ function sr(e, t) {
1431
+ t || (t = []);
1432
+ var r = e ? Math.min(t.length, e.length) : 0, n = t.slice(), s;
1433
+ return function(a) {
1434
+ for (s = 0; s < r; ++s) n[s] = e[s] * (1 - a) + t[s] * a;
1435
+ return n;
1436
+ };
1437
+ }
1438
+ function ir(e) {
1439
+ return ArrayBuffer.isView(e) && !(e instanceof DataView);
1440
+ }
1441
+ function ar(e, t) {
1442
+ var r = t ? t.length : 0, n = e ? Math.min(r, e.length) : 0, s = new Array(n), a = new Array(r), l;
1443
+ for (l = 0; l < n; ++l) s[l] = Te(e[l], t[l]);
1444
+ for (; l < r; ++l) a[l] = t[l];
1445
+ return function(c) {
1446
+ for (l = 0; l < n; ++l) a[l] = s[l](c);
1447
+ return a;
1448
+ };
1449
+ }
1450
+ function lr(e, t) {
1451
+ var r = /* @__PURE__ */ new Date();
1452
+ return e = +e, t = +t, function(n) {
1453
+ return r.setTime(e * (1 - n) + t * n), r;
1454
+ };
1455
+ }
1456
+ function fe(e, t) {
1457
+ return e = +e, t = +t, function(r) {
1458
+ return e * (1 - r) + t * r;
1459
+ };
1460
+ }
1461
+ function or(e, t) {
1462
+ var r = {}, n = {}, s;
1463
+ (e === null || typeof e != "object") && (e = {}), (t === null || typeof t != "object") && (t = {});
1464
+ for (s in t)
1465
+ s in e ? r[s] = Te(e[s], t[s]) : n[s] = t[s];
1466
+ return function(a) {
1467
+ for (s in r) n[s] = r[s](a);
1468
+ return n;
1469
+ };
1470
+ }
1471
+ var Se = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, be = new RegExp(Se.source, "g");
1472
+ function cr(e) {
1473
+ return function() {
1474
+ return e;
1475
+ };
1476
+ }
1477
+ function dr(e) {
1478
+ return function(t) {
1479
+ return e(t) + "";
1480
+ };
1481
+ }
1482
+ function ur(e, t) {
1483
+ var r = Se.lastIndex = be.lastIndex = 0, n, s, a, l = -1, c = [], d = [];
1484
+ for (e = e + "", t = t + ""; (n = Se.exec(e)) && (s = be.exec(t)); )
1485
+ (a = s.index) > r && (a = t.slice(r, a), c[l] ? c[l] += a : c[++l] = a), (n = n[0]) === (s = s[0]) ? c[l] ? c[l] += s : c[++l] = s : (c[++l] = null, d.push({ i: l, x: fe(n, s) })), r = be.lastIndex;
1486
+ return r < t.length && (a = t.slice(r), c[l] ? c[l] += a : c[++l] = a), c.length < 2 ? d[0] ? dr(d[0].x) : cr(t) : (t = d.length, function(o) {
1487
+ for (var u = 0, f; u < t; ++u) c[(f = d[u]).i] = f.x(o);
1488
+ return c.join("");
1489
+ });
1490
+ }
1491
+ function Te(e, t) {
1492
+ var r = typeof t, n;
1493
+ return t == null || r === "boolean" ? Le(t) : (r === "number" ? fe : r === "string" ? (n = P(t)) ? (t = n, Ye) : ur : t instanceof P ? Ye : t instanceof Date ? lr : ir(t) ? sr : Array.isArray(t) ? ar : typeof t.valueOf != "function" && typeof t.toString != "function" || isNaN(t) ? or : fe)(e, t);
1494
+ }
1495
+ function fr(e, t) {
1496
+ return e = +e, t = +t, function(r) {
1497
+ return Math.round(e * (1 - r) + t * r);
1498
+ };
1499
+ }
1500
+ function mr(e) {
1501
+ return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
1502
+ }
1503
+ function me(e, t) {
1504
+ if ((r = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e")) < 0) return null;
1505
+ var r, n = e.slice(0, r);
1506
+ return [
1507
+ n.length > 1 ? n[0] + n.slice(2) : n,
1508
+ +e.slice(r + 1)
1509
+ ];
1510
+ }
1511
+ function Q(e) {
1512
+ return e = me(Math.abs(e)), e ? e[1] : NaN;
1513
+ }
1514
+ function xr(e, t) {
1515
+ return function(r, n) {
1516
+ for (var s = r.length, a = [], l = 0, c = e[0], d = 0; s > 0 && c > 0 && (d + c + 1 > n && (c = Math.max(1, n - d)), a.push(r.substring(s -= c, s + c)), !((d += c + 1) > n)); )
1517
+ c = e[l = (l + 1) % e.length];
1518
+ return a.reverse().join(t);
1519
+ };
1520
+ }
1521
+ function hr(e) {
1522
+ return function(t) {
1523
+ return t.replace(/[0-9]/g, function(r) {
1524
+ return e[+r];
1525
+ });
1526
+ };
1527
+ }
1528
+ var yr = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
1529
+ function xe(e) {
1530
+ if (!(t = yr.exec(e))) throw new Error("invalid format: " + e);
1531
+ var t;
1532
+ return new Fe({
1533
+ fill: t[1],
1534
+ align: t[2],
1535
+ sign: t[3],
1536
+ symbol: t[4],
1537
+ zero: t[5],
1538
+ width: t[6],
1539
+ comma: t[7],
1540
+ precision: t[8] && t[8].slice(1),
1541
+ trim: t[9],
1542
+ type: t[10]
1543
+ });
1544
+ }
1545
+ xe.prototype = Fe.prototype;
1546
+ function Fe(e) {
1547
+ this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
1548
+ }
1549
+ Fe.prototype.toString = function() {
1550
+ return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
1551
+ };
1552
+ function pr(e) {
1553
+ e: for (var t = e.length, r = 1, n = -1, s; r < t; ++r)
1554
+ switch (e[r]) {
1555
+ case ".":
1556
+ n = s = r;
1557
+ break;
1558
+ case "0":
1559
+ n === 0 && (n = r), s = r;
1560
+ break;
1561
+ default:
1562
+ if (!+e[r]) break e;
1563
+ n > 0 && (n = 0);
1564
+ break;
1565
+ }
1566
+ return n > 0 ? e.slice(0, n) + e.slice(s + 1) : e;
1567
+ }
1568
+ var it;
1569
+ function vr(e, t) {
1570
+ var r = me(e, t);
1571
+ if (!r) return e + "";
1572
+ var n = r[0], s = r[1], a = s - (it = Math.max(-8, Math.min(8, Math.floor(s / 3))) * 3) + 1, l = n.length;
1573
+ return a === l ? n : a > l ? n + new Array(a - l + 1).join("0") : a > 0 ? n.slice(0, a) + "." + n.slice(a) : "0." + new Array(1 - a).join("0") + me(e, Math.max(0, t + a - 1))[0];
1574
+ }
1575
+ function We(e, t) {
1576
+ var r = me(e, t);
1577
+ if (!r) return e + "";
1578
+ var n = r[0], s = r[1];
1579
+ return s < 0 ? "0." + new Array(-s).join("0") + n : n.length > s + 1 ? n.slice(0, s + 1) + "." + n.slice(s + 1) : n + new Array(s - n.length + 2).join("0");
1580
+ }
1581
+ const Xe = {
1582
+ "%": (e, t) => (e * 100).toFixed(t),
1583
+ b: (e) => Math.round(e).toString(2),
1584
+ c: (e) => e + "",
1585
+ d: mr,
1586
+ e: (e, t) => e.toExponential(t),
1587
+ f: (e, t) => e.toFixed(t),
1588
+ g: (e, t) => e.toPrecision(t),
1589
+ o: (e) => Math.round(e).toString(8),
1590
+ p: (e, t) => We(e * 100, t),
1591
+ r: We,
1592
+ s: vr,
1593
+ X: (e) => Math.round(e).toString(16).toUpperCase(),
1594
+ x: (e) => Math.round(e).toString(16)
1595
+ };
1596
+ function Qe(e) {
1597
+ return e;
1598
+ }
1599
+ var Ze = Array.prototype.map, Je = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
1600
+ function gr(e) {
1601
+ var t = e.grouping === void 0 || e.thousands === void 0 ? Qe : xr(Ze.call(e.grouping, Number), e.thousands + ""), r = e.currency === void 0 ? "" : e.currency[0] + "", n = e.currency === void 0 ? "" : e.currency[1] + "", s = e.decimal === void 0 ? "." : e.decimal + "", a = e.numerals === void 0 ? Qe : hr(Ze.call(e.numerals, String)), l = e.percent === void 0 ? "%" : e.percent + "", c = e.minus === void 0 ? "−" : e.minus + "", d = e.nan === void 0 ? "NaN" : e.nan + "";
1602
+ function o(f) {
1603
+ f = xe(f);
1604
+ var m = f.fill, N = f.align, x = f.sign, v = f.symbol, p = f.zero, S = f.width, $ = f.comma, h = f.precision, y = f.trim, b = f.type;
1605
+ b === "n" ? ($ = !0, b = "g") : Xe[b] || (h === void 0 && (h = 12), y = !0, b = "g"), (p || m === "0" && N === "=") && (p = !0, m = "0", N = "=");
1606
+ var A = v === "$" ? r : v === "#" && /[boxX]/.test(b) ? "0" + b.toLowerCase() : "", w = v === "$" ? n : /[%p]/.test(b) ? l : "", k = Xe[b], L = /[defgprs%]/.test(b);
1607
+ h = h === void 0 ? 6 : /[gprs]/.test(b) ? Math.max(1, Math.min(21, h)) : Math.max(0, Math.min(20, h));
1608
+ function F(M) {
1609
+ var R = A, E = w, Y, Ee, te;
1610
+ if (b === "c")
1611
+ E = k(M) + E, M = "";
1612
+ else {
1613
+ M = +M;
1614
+ var re = M < 0 || 1 / M < 0;
1615
+ if (M = isNaN(M) ? d : k(Math.abs(M), h), y && (M = pr(M)), re && +M == 0 && x !== "+" && (re = !1), R = (re ? x === "(" ? x : c : x === "-" || x === "(" ? "" : x) + R, E = (b === "s" ? Je[8 + it / 3] : "") + E + (re && x === "(" ? ")" : ""), L) {
1616
+ for (Y = -1, Ee = M.length; ++Y < Ee; )
1617
+ if (te = M.charCodeAt(Y), 48 > te || te > 57) {
1618
+ E = (te === 46 ? s + M.slice(Y + 1) : M.slice(Y)) + E, M = M.slice(0, Y);
1619
+ break;
1620
+ }
1621
+ }
1622
+ }
1623
+ $ && !p && (M = t(M, 1 / 0));
1624
+ var ne = R.length + M.length + E.length, I = ne < S ? new Array(S - ne + 1).join(m) : "";
1625
+ switch ($ && p && (M = t(I + M, I.length ? S - E.length : 1 / 0), I = ""), N) {
1626
+ case "<":
1627
+ M = R + M + E + I;
1628
+ break;
1629
+ case "=":
1630
+ M = R + I + M + E;
1631
+ break;
1632
+ case "^":
1633
+ M = I.slice(0, ne = I.length >> 1) + R + M + E + I.slice(ne);
1634
+ break;
1635
+ default:
1636
+ M = I + R + M + E;
1637
+ break;
1638
+ }
1639
+ return a(M);
1640
+ }
1641
+ return F.toString = function() {
1642
+ return f + "";
1643
+ }, F;
1644
+ }
1645
+ function u(f, m) {
1646
+ var N = o((f = xe(f), f.type = "f", f)), x = Math.max(-8, Math.min(8, Math.floor(Q(m) / 3))) * 3, v = Math.pow(10, -x), p = Je[8 + x / 3];
1647
+ return function(S) {
1648
+ return N(v * S) + p;
1649
+ };
1650
+ }
1651
+ return {
1652
+ format: o,
1653
+ formatPrefix: u
1654
+ };
1655
+ }
1656
+ var le, at, lt;
1657
+ br({
1658
+ thousands: ",",
1659
+ grouping: [3],
1660
+ currency: ["$", ""]
1661
+ });
1662
+ function br(e) {
1663
+ return le = gr(e), at = le.format, lt = le.formatPrefix, le;
1664
+ }
1665
+ function wr(e) {
1666
+ return Math.max(0, -Q(Math.abs(e)));
1667
+ }
1668
+ function Nr(e, t) {
1669
+ return Math.max(0, Math.max(-8, Math.min(8, Math.floor(Q(t) / 3))) * 3 - Q(Math.abs(e)));
1670
+ }
1671
+ function Ar(e, t) {
1672
+ return e = Math.abs(e), t = Math.abs(t) - e, Math.max(0, Q(t) - Q(e)) + 1;
1673
+ }
1674
+ function je(e, t) {
1675
+ switch (arguments.length) {
1676
+ case 0:
1677
+ break;
1678
+ case 1:
1679
+ this.range(e);
1680
+ break;
1681
+ default:
1682
+ this.range(t).domain(e);
1683
+ break;
1684
+ }
1685
+ return this;
1686
+ }
1687
+ const Pe = Symbol("implicit");
1688
+ function ot() {
1689
+ var e = new He(), t = [], r = [], n = Pe;
1690
+ function s(a) {
1691
+ let l = e.get(a);
1692
+ if (l === void 0) {
1693
+ if (n !== Pe) return n;
1694
+ e.set(a, l = t.push(a) - 1);
1695
+ }
1696
+ return r[l % r.length];
1697
+ }
1698
+ return s.domain = function(a) {
1699
+ if (!arguments.length) return t.slice();
1700
+ t = [], e = new He();
1701
+ for (const l of a)
1702
+ e.has(l) || e.set(l, t.push(l) - 1);
1703
+ return s;
1704
+ }, s.range = function(a) {
1705
+ return arguments.length ? (r = Array.from(a), s) : r.slice();
1706
+ }, s.unknown = function(a) {
1707
+ return arguments.length ? (n = a, s) : n;
1708
+ }, s.copy = function() {
1709
+ return ot(t, r).unknown(n);
1710
+ }, je.apply(s, arguments), s;
1711
+ }
1712
+ function Sr(e) {
1713
+ return function() {
1714
+ return e;
1715
+ };
1716
+ }
1717
+ function Mr(e) {
1718
+ return +e;
1719
+ }
1720
+ var Ce = [0, 1];
1721
+ function W(e) {
1722
+ return e;
1723
+ }
1724
+ function Me(e, t) {
1725
+ return (t -= e = +e) ? function(r) {
1726
+ return (r - e) / t;
1727
+ } : Sr(isNaN(t) ? NaN : 0.5);
1728
+ }
1729
+ function kr(e, t) {
1730
+ var r;
1731
+ return e > t && (r = e, e = t, t = r), function(n) {
1732
+ return Math.max(e, Math.min(t, n));
1733
+ };
1734
+ }
1735
+ function $r(e, t, r) {
1736
+ var n = e[0], s = e[1], a = t[0], l = t[1];
1737
+ return s < n ? (n = Me(s, n), a = r(l, a)) : (n = Me(n, s), a = r(a, l)), function(c) {
1738
+ return a(n(c));
1739
+ };
1740
+ }
1741
+ function Lr(e, t, r) {
1742
+ var n = Math.min(e.length, t.length) - 1, s = new Array(n), a = new Array(n), l = -1;
1743
+ for (e[n] < e[0] && (e = e.slice().reverse(), t = t.slice().reverse()); ++l < n; )
1744
+ s[l] = Me(e[l], e[l + 1]), a[l] = r(t[l], t[l + 1]);
1745
+ return function(c) {
1746
+ var d = tt(e, c, 1, n) - 1;
1747
+ return a[d](s[d](c));
1748
+ };
1749
+ }
1750
+ function Tr(e, t) {
1751
+ return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());
1752
+ }
1753
+ function Fr() {
1754
+ var e = Ce, t = Ce, r = Te, n, s, a, l = W, c, d, o;
1755
+ function u() {
1756
+ var m = Math.min(e.length, t.length);
1757
+ return l !== W && (l = kr(e[0], e[m - 1])), c = m > 2 ? Lr : $r, d = o = null, f;
1758
+ }
1759
+ function f(m) {
1760
+ return m == null || isNaN(m = +m) ? a : (d || (d = c(e.map(n), t, r)))(n(l(m)));
1761
+ }
1762
+ return f.invert = function(m) {
1763
+ return l(s((o || (o = c(t, e.map(n), fe)))(m)));
1764
+ }, f.domain = function(m) {
1765
+ return arguments.length ? (e = Array.from(m, Mr), u()) : e.slice();
1766
+ }, f.range = function(m) {
1767
+ return arguments.length ? (t = Array.from(m), u()) : t.slice();
1768
+ }, f.rangeRound = function(m) {
1769
+ return t = Array.from(m), r = fr, u();
1770
+ }, f.clamp = function(m) {
1771
+ return arguments.length ? (l = m ? !0 : W, u()) : l !== W;
1772
+ }, f.interpolate = function(m) {
1773
+ return arguments.length ? (r = m, u()) : r;
1774
+ }, f.unknown = function(m) {
1775
+ return arguments.length ? (a = m, f) : a;
1776
+ }, function(m, N) {
1777
+ return n = m, s = N, u();
1778
+ };
1779
+ }
1780
+ function jr() {
1781
+ return Fr()(W, W);
1782
+ }
1783
+ function Er(e, t, r, n) {
1784
+ var s = qt(e, t, r), a;
1785
+ switch (n = xe(n ?? ",f"), n.type) {
1786
+ case "s": {
1787
+ var l = Math.max(Math.abs(e), Math.abs(t));
1788
+ return n.precision == null && !isNaN(a = Nr(s, l)) && (n.precision = a), lt(n, l);
1789
+ }
1790
+ case "":
1791
+ case "e":
1792
+ case "g":
1793
+ case "p":
1794
+ case "r": {
1795
+ n.precision == null && !isNaN(a = Ar(s, Math.max(Math.abs(e), Math.abs(t)))) && (n.precision = a - (n.type === "e"));
1796
+ break;
1797
+ }
1798
+ case "f":
1799
+ case "%": {
1800
+ n.precision == null && !isNaN(a = wr(s)) && (n.precision = a - (n.type === "%") * 2);
1801
+ break;
1802
+ }
1803
+ }
1804
+ return at(n);
1805
+ }
1806
+ function ct(e) {
1807
+ var t = e.domain;
1808
+ return e.ticks = function(r) {
1809
+ var n = t();
1810
+ return Vt(n[0], n[n.length - 1], r ?? 10);
1811
+ }, e.tickFormat = function(r, n) {
1812
+ var s = t();
1813
+ return Er(s[0], s[s.length - 1], r ?? 10, n);
1814
+ }, e.nice = function(r) {
1815
+ r == null && (r = 10);
1816
+ var n = t(), s = 0, a = n.length - 1, l = n[s], c = n[a], d, o, u = 10;
1817
+ for (c < l && (o = l, l = c, c = o, o = s, s = a, a = o); u-- > 0; ) {
1818
+ if (o = Ne(l, c, r), o === d)
1819
+ return n[s] = l, n[a] = c, t(n);
1820
+ if (o > 0)
1821
+ l = Math.floor(l / o) * o, c = Math.ceil(c / o) * o;
1822
+ else if (o < 0)
1823
+ l = Math.ceil(l * o) / o, c = Math.floor(c * o) / o;
1824
+ else
1825
+ break;
1826
+ d = o;
1827
+ }
1828
+ return e;
1829
+ }, e;
1830
+ }
1831
+ function zr() {
1832
+ var e = jr();
1833
+ return e.copy = function() {
1834
+ return Tr(e, zr());
1835
+ }, je.apply(e, arguments), ct(e);
1836
+ }
1837
+ function dt() {
1838
+ var e = 0, t = 1, r = 1, n = [0.5], s = [0, 1], a;
1839
+ function l(d) {
1840
+ return d != null && d <= d ? s[tt(n, d, 0, r)] : a;
1841
+ }
1842
+ function c() {
1843
+ var d = -1;
1844
+ for (n = new Array(r); ++d < r; ) n[d] = ((d + 1) * t - (d - r) * e) / (r + 1);
1845
+ return l;
1846
+ }
1847
+ return l.domain = function(d) {
1848
+ return arguments.length ? ([e, t] = d, e = +e, t = +t, c()) : [e, t];
1849
+ }, l.range = function(d) {
1850
+ return arguments.length ? (r = (s = Array.from(d)).length - 1, c()) : s.slice();
1851
+ }, l.invertExtent = function(d) {
1852
+ var o = s.indexOf(d);
1853
+ return o < 0 ? [NaN, NaN] : o < 1 ? [e, n[0]] : o >= r ? [n[r - 1], t] : [n[o - 1], n[o]];
1854
+ }, l.unknown = function(d) {
1855
+ return arguments.length && (a = d), l;
1856
+ }, l.thresholds = function() {
1857
+ return n.slice();
1858
+ }, l.copy = function() {
1859
+ return dt().domain([e, t]).range(s).unknown(a);
1860
+ }, je.apply(ct(l), arguments);
1861
+ }
1862
+ function Wr({
1863
+ data: e,
1864
+ chartConfig: t,
1865
+ displayConfig: r = {},
1866
+ queryObject: n,
1867
+ height: s = "100%",
1868
+ colorPalette: a
1869
+ }) {
1870
+ const [l, c] = G(null), { getFieldLabel: d } = K();
1871
+ try {
1872
+ const o = {
1873
+ showTooltip: (r == null ? void 0 : r.showTooltip) ?? !0,
1874
+ showLegend: (r == null ? void 0 : r.showLegend) ?? !0
1875
+ };
1876
+ if (!e || e.length === 0)
1877
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
1878
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
1879
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No data points to display in treemap chart" })
1880
+ ] }) });
1881
+ let u, f = !1, m;
1882
+ if (t != null && t.xAxis && (t != null && t.yAxis)) {
1883
+ const h = t.xAxis[0], y = Array.isArray(t.yAxis) ? t.yAxis[0] : t.yAxis;
1884
+ m = Array.isArray(t.series) ? t.series[0] : t.series;
1885
+ const b = O(n, h);
1886
+ if (m) {
1887
+ const A = e.map((w) => {
1888
+ const k = w[m];
1889
+ return typeof k == "string" ? parseFloat(k) : k;
1890
+ }).filter((w) => !isNaN(w));
1891
+ if (f = A.length === e.length && A.every((w) => typeof w == "number"), console.log("TreeMap Debug:", {
1892
+ seriesField: m,
1893
+ data: e,
1894
+ seriesValues: A,
1895
+ isNumericSeries: f,
1896
+ rawValues: e.map((w) => w[m])
1897
+ }), f) {
1898
+ const w = Math.min(...A), k = Math.max(...A), L = dt().domain([w, k]).range(se);
1899
+ u = e.map((F) => {
1900
+ const M = typeof F[m] == "string" ? parseFloat(F[m]) : F[m], R = L(M);
1901
+ return console.log("TreeMap Color Assignment:", {
1902
+ item: F[h],
1903
+ seriesValue: M,
1904
+ color: R,
1905
+ minValue: w,
1906
+ maxValue: k
1907
+ }), {
1908
+ name: D(F[h], b) || String(F[h]) || "Unknown",
1909
+ size: typeof F[y] == "string" ? parseFloat(F[y]) : F[y] || 0,
1910
+ fill: R,
1911
+ series: String(F[m])
1912
+ };
1913
+ });
1914
+ } else {
1915
+ const w = [...new Set(e.map((L) => String(L[m])))], k = ot().domain(w).range((a == null ? void 0 : a.colors) || T);
1916
+ u = e.map((L) => ({
1917
+ name: D(L[h], b) || String(L[h]) || "Unknown",
1918
+ size: typeof L[y] == "string" ? parseFloat(L[y]) : L[y] || 0,
1919
+ fill: k(String(L[m])),
1920
+ series: String(L[m])
1921
+ }));
1922
+ }
1923
+ } else
1924
+ u = e.map((A, w) => ({
1925
+ name: D(A[h], b) || String(A[h]) || "Unknown",
1926
+ size: typeof A[y] == "string" ? parseFloat(A[y]) : A[y] || 0,
1927
+ fill: (a == null ? void 0 : a.colors) && a.colors[w % a.colors.length] || T[w % T.length]
1928
+ }));
1929
+ } else {
1930
+ const h = e[0], y = Object.keys(h), b = y.find(
1931
+ (w) => typeof h[w] == "string" || w.toLowerCase().includes("name") || w.toLowerCase().includes("label") || w.toLowerCase().includes("category")
1932
+ ) || y[0], A = y.find((w) => w.toLowerCase().includes("size")) || y.find(
1933
+ (w) => typeof h[w] == "number" && w !== b
1934
+ ) || y[1];
1935
+ if (!A)
1936
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-yellow-600", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
1937
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "Configuration Error" }),
1938
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No numeric field found for treemap chart size" })
1939
+ ] }) });
1940
+ u = e.map((w, k) => {
1941
+ let L = w[b];
1942
+ return typeof L == "boolean" ? L = L ? "Active" : "Inactive" : L === "true" || L === "false" ? L = L === "true" ? "Active" : "Inactive" : L = String(L), {
1943
+ name: L,
1944
+ size: typeof w[A] == "string" ? parseFloat(w[A]) : w[A] || 0,
1945
+ fill: (a == null ? void 0 : a.colors) && a.colors[k % a.colors.length] || T[k % T.length]
1946
+ };
1947
+ });
1948
+ }
1949
+ if (u = u.filter((h) => h.size != null && h.size > 0), u.length === 0)
1950
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
1951
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No valid data" }),
1952
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No valid data points for treemap chart after transformation" })
1953
+ ] }) });
1954
+ const N = (h) => {
1955
+ var M;
1956
+ const { x: y, y: b, width: A, height: w, index: k, name: L, size: F } = h;
1957
+ return A < 20 || w < 20 ? null : /* @__PURE__ */ g("g", { children: [
1958
+ /* @__PURE__ */ i(
1959
+ "rect",
1960
+ {
1961
+ x: y,
1962
+ y: b,
1963
+ width: A,
1964
+ height: w,
1965
+ style: {
1966
+ fill: ((M = u[k]) == null ? void 0 : M.fill) || (a == null ? void 0 : a.colors) && a.colors[k % a.colors.length] || T[k % T.length],
1967
+ fillOpacity: l !== null ? l === k ? 1 : 0.6 : 0.8,
1968
+ stroke: "#fff",
1969
+ strokeWidth: 2,
1970
+ cursor: "pointer"
1971
+ },
1972
+ onMouseEnter: () => c(k),
1973
+ onMouseLeave: () => c(null)
1974
+ }
1975
+ ),
1976
+ /* @__PURE__ */ i(
1977
+ "foreignObject",
1978
+ {
1979
+ x: y,
1980
+ y: b,
1981
+ width: A,
1982
+ height: w,
1983
+ style: { pointerEvents: "none", overflow: "visible" },
1984
+ children: /* @__PURE__ */ g(
1985
+ "div",
1986
+ {
1987
+ style: {
1988
+ width: "100%",
1989
+ height: "100%",
1990
+ display: "flex",
1991
+ flexDirection: "column",
1992
+ alignItems: "center",
1993
+ justifyContent: "center",
1994
+ padding: "4px",
1995
+ boxSizing: "border-box",
1996
+ color: "#ffffff",
1997
+ textShadow: "0 1px 2px rgba(0,0,0,0.8)",
1998
+ fontFamily: "system-ui, -apple-system, sans-serif",
1999
+ overflow: "hidden"
2000
+ },
2001
+ children: [
2002
+ A > 40 && w > 30 && /* @__PURE__ */ i(
2003
+ "div",
2004
+ {
2005
+ style: {
2006
+ fontSize: `${Math.max(10, Math.min(A / 8, w / 8, 16))}px`,
2007
+ fontWeight: "600",
2008
+ textAlign: "center",
2009
+ lineHeight: "1.2",
2010
+ marginBottom: A > 60 && w > 45 ? "4px" : "0",
2011
+ wordBreak: "break-word",
2012
+ hyphens: "auto"
2013
+ },
2014
+ children: L
2015
+ }
2016
+ ),
2017
+ A > 60 && w > 45 && /* @__PURE__ */ i(
2018
+ "div",
2019
+ {
2020
+ style: {
2021
+ fontSize: `${Math.max(8, Math.min(A / 10, w / 10, 14))}px`,
2022
+ textAlign: "center",
2023
+ opacity: 0.9
2024
+ },
2025
+ children: typeof F == "number" ? F.toLocaleString() : F
2026
+ }
2027
+ )
2028
+ ]
2029
+ }
2030
+ )
2031
+ }
2032
+ )
2033
+ ] });
2034
+ }, v = u.some((h) => "series" in h) ? [...new Set(u.map((h) => h.series).filter(Boolean))] : [];
2035
+ let p = [];
2036
+ if (o.showLegend && m) {
2037
+ if (console.log("TreeMap Legend Debug:", {
2038
+ showLegend: o.showLegend,
2039
+ seriesField: m,
2040
+ isNumericSeries: f,
2041
+ uniqueSeries: v,
2042
+ data: e.slice(0, 2)
2043
+ // First 2 items for debugging
2044
+ }), f) {
2045
+ const h = Math.min(...e.map((b) => {
2046
+ const A = b[m];
2047
+ return typeof A == "string" ? parseFloat(A) : A;
2048
+ })), y = Math.max(...e.map((b) => {
2049
+ const A = b[m];
2050
+ return typeof A == "string" ? parseFloat(A) : A;
2051
+ }));
2052
+ console.log("Creating numeric legend:", { minValue: h, maxValue: y }), p = se.map((b, A) => {
2053
+ const w = A / (se.length - 1);
2054
+ return {
2055
+ value: (h + (y - h) * w).toFixed(2),
2056
+ type: "rect",
2057
+ color: b
2058
+ };
2059
+ });
2060
+ } else v.length > 1 && (console.log("Creating categorical legend:", v), p = v.map((h, y) => ({
2061
+ value: h,
2062
+ type: "rect",
2063
+ color: T[y % T.length]
2064
+ })));
2065
+ console.log("Final legendPayload:", p);
2066
+ }
2067
+ const S = o.showLegend && p.length > 0, $ = S ? typeof s == "string" && s.includes("%") ? s : typeof s == "number" ? s + 60 : `calc(${s} + 60px)` : s;
2068
+ return /* @__PURE__ */ g("div", { className: "w-full", style: { height: $ }, children: [
2069
+ /* @__PURE__ */ i(U, { height: S ? "calc(100% - 50px)" : "100%", children: /* @__PURE__ */ i(
2070
+ Lt,
2071
+ {
2072
+ data: u,
2073
+ dataKey: "size",
2074
+ aspectRatio: 4 / 3,
2075
+ stroke: "#fff",
2076
+ content: /* @__PURE__ */ i(N, {}),
2077
+ children: o.showTooltip && /* @__PURE__ */ i(V, {})
2078
+ }
2079
+ ) }),
2080
+ S && /* @__PURE__ */ i("div", { className: "flex justify-center items-center mt-4 pb-2", children: f ? (
2081
+ // Gradient legend for numeric series
2082
+ /* @__PURE__ */ g("div", { className: "flex flex-col items-center", children: [
2083
+ /* @__PURE__ */ i("div", { className: "text-xs font-semibold text-gray-700 mb-2", children: m ? d(m) : "" }),
2084
+ /* @__PURE__ */ g("div", { className: "flex items-center gap-2", children: [
2085
+ /* @__PURE__ */ i("span", { className: "text-xs text-gray-600", children: Math.min(...e.map((h) => {
2086
+ const y = h[m];
2087
+ return typeof y == "string" ? parseFloat(y) : y;
2088
+ })).toFixed(2) }),
2089
+ /* @__PURE__ */ i(
2090
+ "div",
2091
+ {
2092
+ className: "h-4 rounded",
2093
+ style: {
2094
+ width: "200px",
2095
+ background: `linear-gradient(to right, ${se.join(", ")})`
2096
+ }
2097
+ }
2098
+ ),
2099
+ /* @__PURE__ */ i("span", { className: "text-xs text-gray-600", children: Math.max(...e.map((h) => {
2100
+ const y = h[m];
2101
+ return typeof y == "string" ? parseFloat(y) : y;
2102
+ })).toFixed(2) })
2103
+ ] })
2104
+ ] })
2105
+ ) : (
2106
+ // Discrete legend for categorical series
2107
+ /* @__PURE__ */ i("div", { className: "flex flex-wrap justify-center gap-4", children: p.map((h, y) => /* @__PURE__ */ g("div", { className: "flex items-center gap-2", children: [
2108
+ /* @__PURE__ */ i(
2109
+ "div",
2110
+ {
2111
+ className: "w-3 h-3 rounded-sm",
2112
+ style: { backgroundColor: h.color }
2113
+ }
2114
+ ),
2115
+ /* @__PURE__ */ i("span", { className: "text-xs text-gray-600", children: h.value })
2116
+ ] }, y)) })
2117
+ ) })
2118
+ ] });
2119
+ } catch (o) {
2120
+ return console.error("TreeMapChart rendering error:", o), /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center w-full text-red-500 p-4", style: { height: s }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
2121
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "TreeMap Chart Error" }),
2122
+ /* @__PURE__ */ i("div", { className: "text-xs mb-2", children: o instanceof Error ? o.message : "Unknown rendering error" }),
2123
+ /* @__PURE__ */ i("div", { className: "text-xs text-gray-600", children: "Check the data and configuration" })
2124
+ ] }) });
2125
+ }
2126
+ }
2127
+ function Xr({
2128
+ data: e,
2129
+ chartConfig: t,
2130
+ height: r = 300
2131
+ }) {
2132
+ const { getFieldLabel: n } = K();
2133
+ if (!e || e.length === 0)
2134
+ return /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: r }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
2135
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No data available" }),
2136
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "No data to display in table" })
2137
+ ] }) });
2138
+ const s = Object.keys(e[0] || {}), a = t != null && t.xAxis && t.xAxis.length > 0 ? t.xAxis.filter((l) => s.includes(l)) : s;
2139
+ return a.length === 0 ? /* @__PURE__ */ i("div", { className: "flex items-center justify-center w-full text-gray-500", style: { height: r }, children: /* @__PURE__ */ g("div", { className: "text-center", children: [
2140
+ /* @__PURE__ */ i("div", { className: "text-sm font-semibold mb-1", children: "No columns available" }),
2141
+ /* @__PURE__ */ i("div", { className: "text-xs", children: "Data structure is invalid" })
2142
+ ] }) }) : /* @__PURE__ */ i("div", { className: "w-full overflow-auto", style: { height: r }, children: /* @__PURE__ */ g("table", { className: "min-w-full divide-y divide-gray-200", children: [
2143
+ /* @__PURE__ */ i("thead", { className: "bg-gray-50 sticky top-0", children: /* @__PURE__ */ i("tr", { children: a.map((l) => /* @__PURE__ */ i(
2144
+ "th",
2145
+ {
2146
+ className: "px-3 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",
2147
+ children: n(l)
2148
+ },
2149
+ l
2150
+ )) }) }),
2151
+ /* @__PURE__ */ i("tbody", { className: "bg-white divide-y divide-gray-200", children: e.map((l, c) => /* @__PURE__ */ i("tr", { className: "hover:bg-gray-50", children: a.map((d) => /* @__PURE__ */ i(
2152
+ "td",
2153
+ {
2154
+ className: "px-3 py-2 whitespace-nowrap text-sm text-gray-900",
2155
+ children: Rr(l[d])
2156
+ },
2157
+ d
2158
+ )) }, c)) })
2159
+ ] }) });
2160
+ }
2161
+ function Rr(e) {
2162
+ return e == null ? "" : typeof e == "number" ? e.toLocaleString() : typeof e == "boolean" ? e ? "Yes" : "No" : String(e);
2163
+ }
2164
+ function Qr(e) {
2165
+ const t = Dr(e);
2166
+ return {
2167
+ portlets: e,
2168
+ layouts: t
2169
+ };
2170
+ }
2171
+ function Dr(e) {
2172
+ const t = e.map((r) => ({
2173
+ i: r.id,
2174
+ x: r.x,
2175
+ y: r.y,
2176
+ w: r.w,
2177
+ h: r.h,
2178
+ minW: 3,
2179
+ minH: 3
2180
+ }));
2181
+ return {
2182
+ lg: t,
2183
+ md: t.map((r) => ({ ...r, w: Math.min(r.w, 8) })),
2184
+ sm: t.map((r) => ({ ...r, w: Math.min(r.w, 6) })),
2185
+ xs: t.map((r) => ({ ...r, w: Math.min(r.w, 4) })),
2186
+ xxs: t.map((r) => ({ ...r, w: 2 }))
2187
+ };
2188
+ }
2189
+ function Zr(e, t = {}) {
2190
+ const { formatNumbers: r = !0, precision: n = 2 } = t;
2191
+ return r ? e.map((s) => {
2192
+ const a = {};
2193
+ for (const [l, c] of Object.entries(s))
2194
+ typeof c == "number" ? a[l] = Number(c.toFixed(n)) : a[l] = c;
2195
+ return a;
2196
+ }) : e;
2197
+ }
2198
+ function Jr() {
2199
+ return `portlet-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
2200
+ }
2201
+ function Pr(e, t = 6, r = 4) {
2202
+ return e.length === 0 ? { x: 0, y: 0 } : { x: 0, y: Math.max(...e.map((s) => s.y + s.h)) };
2203
+ }
2204
+ function Cr(e) {
2205
+ try {
2206
+ const t = JSON.parse(e);
2207
+ return typeof t != "object" || t === null ? { valid: !1, error: "Query must be a JSON object" } : !t.measures && !t.dimensions ? { valid: !1, error: "Query must have at least measures or dimensions" } : { valid: !0, query: t };
2208
+ } catch {
2209
+ return { valid: !1, error: "Invalid JSON format" };
2210
+ }
2211
+ }
2212
+ function en() {
2213
+ return {
2214
+ title: "Sample Chart",
2215
+ query: JSON.stringify({
2216
+ measures: ["count"],
2217
+ dimensions: ["category"]
2218
+ }, null, 2),
2219
+ chartType: "bar",
2220
+ chartConfig: {
2221
+ x: "category",
2222
+ y: ["count"]
2223
+ },
2224
+ displayConfig: {
2225
+ showLegend: !0,
2226
+ showGrid: !0,
2227
+ showTooltip: !0
2228
+ },
2229
+ w: 6,
2230
+ h: 4,
2231
+ x: 0,
2232
+ y: 0
2233
+ };
2234
+ }
2235
+ export {
2236
+ qr as A,
2237
+ Ur as B,
2238
+ ve as C,
2239
+ Xr as D,
2240
+ Vr as L,
2241
+ Tt as N,
2242
+ Br as P,
2243
+ Kr as R,
2244
+ _r as S,
2245
+ Wr as T,
2246
+ Yr as a,
2247
+ Tr as b,
2248
+ Qr as c,
2249
+ W as d,
2250
+ D as e,
2251
+ Zr as f,
2252
+ O as g,
2253
+ zr as h,
2254
+ je as i,
2255
+ se as j,
2256
+ T as k,
2257
+ ct as l,
2258
+ U as m,
2259
+ Dr as n,
2260
+ ot as o,
2261
+ Jr as p,
2262
+ dt as q,
2263
+ Pr as r,
2264
+ en as s,
2265
+ Fr as t,
2266
+ De as u,
2267
+ Cr as v
2268
+ };
2269
+ //# sourceMappingURL=charts-Dx3asDBi.js.map