@trinitydesign/design-system 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/charts.js ADDED
@@ -0,0 +1,2650 @@
1
+ import { jsxs as s, jsx as t, Fragment as bt } from "react/jsx-runtime";
2
+ import $t, { useId as Ft, useMemo as Q, useState as It, useCallback as pt } from "react";
3
+ import { ResponsiveContainer as Z, LineChart as xt, CartesianGrid as lt, XAxis as at, YAxis as et, Tooltip as nt, Legend as st, ReferenceLine as tt, Area as dt, Line as yt, BarChart as vt, Bar as kt, AreaChart as St, PieChart as Kt, Pie as Rt, Cell as gt, Sector as Dt, ScatterChart as Tt, ZAxis as Ot, Scatter as Bt, RadialBarChart as Ct, RadialBar as zt, PolarAngleAxis as Et, ComposedChart as jt } from "recharts";
4
+ import { Box as l, Skeleton as ut, Typography as z, useTheme as _t } from "@mui/material";
5
+ import { b as K, a as wt, s as G } from "./ai.js";
6
+ const V = wt.colors.gray, M = [
7
+ K.primary.light,
8
+ // Purple (#7841C9)
9
+ K.secondary.main,
10
+ // Coral (#FF6150)
11
+ K.primary.main,
12
+ // Navy (#0A2540)
13
+ "#24A148",
14
+ // Green (success)
15
+ "#F59E0B",
16
+ // Amber (warning)
17
+ "#3B82F6",
18
+ // Blue
19
+ "#8B5CF6",
20
+ // Violet
21
+ "#EC4899",
22
+ // Pink
23
+ "#14B8A6",
24
+ // Teal
25
+ "#F97316"
26
+ // Orange
27
+ ], J = wt.colors.indigo;
28
+ J[50], // #EDE7FD
29
+ J[100], // #D2C3FA
30
+ J[200], // #B49CF6
31
+ J[300], // #9574F2
32
+ J[400], // #7E57F0
33
+ J[500], // #6739ED
34
+ J[600], // #5F33EB
35
+ J[700], // #542CE8
36
+ J[800], // #4A24E5
37
+ J[900];
38
+ const ft = {
39
+ success: "#24A148",
40
+ error: "#DA1E28",
41
+ neutral: K.neutral.gray500
42
+ }, o = {
43
+ fontFamily: '"Montserrat", sans-serif',
44
+ title: {
45
+ fontSize: 16,
46
+ fontWeight: 600,
47
+ fill: V[900]
48
+ },
49
+ subtitle: {
50
+ fontSize: 13,
51
+ fontWeight: 400,
52
+ fill: K.neutral.gray500
53
+ },
54
+ axisLabel: {
55
+ fontSize: 12,
56
+ fontWeight: 500,
57
+ fill: K.neutral.gray600
58
+ },
59
+ axisTick: {
60
+ fontSize: 11,
61
+ fontWeight: 400,
62
+ fill: K.neutral.gray500
63
+ },
64
+ legend: {
65
+ fontSize: 12,
66
+ fontWeight: 500,
67
+ fill: V[700]
68
+ },
69
+ tooltip: {
70
+ fontSize: 12,
71
+ fontWeight: 400,
72
+ fill: V[700]
73
+ },
74
+ tooltipLabel: {
75
+ fontSize: 13,
76
+ fontWeight: 600,
77
+ fill: V[900]
78
+ },
79
+ dataLabel: {
80
+ fontSize: 11,
81
+ fontWeight: 500,
82
+ fill: V[700]
83
+ }
84
+ }, At = {
85
+ md: 12
86
+ }, N = {
87
+ defaultHeight: 300,
88
+ // Stroke widths
89
+ strokeWidth: {
90
+ default: 2
91
+ },
92
+ // Dot/point sizes
93
+ dotSize: {
94
+ small: 4,
95
+ default: 6
96
+ },
97
+ // Bar sizing
98
+ barRadius: 4,
99
+ barMaxWidth: 60
100
+ }, X = {
101
+ // Flat properties for simple access
102
+ stroke: V[200],
103
+ strokeDasharray: "3 3",
104
+ strokeWidth: 1,
105
+ // Theme-specific properties
106
+ light: {
107
+ stroke: V[200],
108
+ strokeOpacity: 1
109
+ },
110
+ dark: {
111
+ stroke: V[700],
112
+ strokeOpacity: 0.5
113
+ }
114
+ }, v = {
115
+ // Flat properties for simple access
116
+ stroke: V[300],
117
+ strokeWidth: 1,
118
+ tickSize: 6,
119
+ tickPadding: 8,
120
+ tickFontSize: 11,
121
+ labelFontSize: 12,
122
+ // Theme-specific properties
123
+ light: {
124
+ lineColor: V[300],
125
+ lineOpacity: 1,
126
+ tickColor: K.neutral.gray500
127
+ },
128
+ dark: {
129
+ lineColor: K.neutral.gray600,
130
+ lineOpacity: 0.5,
131
+ tickColor: K.neutral.gray400
132
+ }
133
+ }, _ = {
134
+ backgroundColor: "#FFFFFF",
135
+ borderColor: V[200],
136
+ borderRadius: 8,
137
+ boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
138
+ padding: "12px 16px"
139
+ }, it = {
140
+ iconSize: 12
141
+ }, Y = {
142
+ duration: 400,
143
+ easing: "ease-out"
144
+ };
145
+ K.primary.light;
146
+ V[900], K.neutral.gray500, V[200], V[300], V[200], V[700], K.neutral.darkPaper, K.neutral.white, K.neutral.gray400, G.effects.onDark.emphasis, G.effects.onDark.divider, K.neutral.darkPaper, G.effects.onDark.emphasis, V[300];
147
+ const P = (e) => M[e % M.length], U = ({
148
+ title: e,
149
+ subtitle: r,
150
+ height: d = 300,
151
+ loading: c = !1,
152
+ error: f,
153
+ empty: i = !1,
154
+ emptyMessage: b = "No data available",
155
+ children: n,
156
+ sx: g,
157
+ variant: m = "default"
158
+ }) => {
159
+ const a = {
160
+ width: "100%",
161
+ ...m === "outlined" && {
162
+ border: "1px solid",
163
+ borderColor: "divider",
164
+ // Use MUI theme
165
+ borderRadius: `${G.borders.radius.card}px`,
166
+ p: 2
167
+ },
168
+ ...m === "elevated" && {
169
+ boxShadow: G.effects.shadow.surface,
170
+ borderRadius: `${G.borders.radius.card}px`,
171
+ p: 2,
172
+ backgroundColor: "background.paper"
173
+ // Use MUI theme
174
+ },
175
+ ...g
176
+ };
177
+ return c ? /* @__PURE__ */ s(l, { sx: a, children: [
178
+ e && /* @__PURE__ */ s(l, { sx: { mb: 2 }, children: [
179
+ /* @__PURE__ */ t(ut, { variant: "text", width: 200, height: 24 }),
180
+ r && /* @__PURE__ */ t(ut, { variant: "text", width: 300, height: 18, sx: { mt: 0.5 } })
181
+ ] }),
182
+ /* @__PURE__ */ t(
183
+ ut,
184
+ {
185
+ variant: "rectangular",
186
+ height: d,
187
+ sx: { borderRadius: 1 }
188
+ }
189
+ )
190
+ ] }) : f ? /* @__PURE__ */ s(l, { sx: a, children: [
191
+ e && /* @__PURE__ */ s(l, { sx: { mb: 2 }, children: [
192
+ /* @__PURE__ */ t(
193
+ z,
194
+ {
195
+ sx: {
196
+ ...o.title,
197
+ fontFamily: o.fontFamily
198
+ },
199
+ children: e
200
+ }
201
+ ),
202
+ r && /* @__PURE__ */ t(
203
+ z,
204
+ {
205
+ sx: {
206
+ ...o.subtitle,
207
+ fontFamily: o.fontFamily,
208
+ mt: 0.5
209
+ },
210
+ children: r
211
+ }
212
+ )
213
+ ] }),
214
+ /* @__PURE__ */ t(
215
+ l,
216
+ {
217
+ sx: {
218
+ height: d,
219
+ display: "flex",
220
+ alignItems: "center",
221
+ justifyContent: "center",
222
+ backgroundColor: "rgba(218, 30, 40, 0.05)",
223
+ borderRadius: 1,
224
+ border: "1px dashed rgba(218, 30, 40, 0.3)"
225
+ },
226
+ children: /* @__PURE__ */ s(l, { sx: { textAlign: "center", p: 3 }, children: [
227
+ /* @__PURE__ */ t(
228
+ z,
229
+ {
230
+ sx: {
231
+ color: G.colors.status.error.text,
232
+ fontWeight: 500,
233
+ mb: 0.5
234
+ },
235
+ children: "Error loading chart"
236
+ }
237
+ ),
238
+ /* @__PURE__ */ t(
239
+ z,
240
+ {
241
+ variant: "body2",
242
+ sx: { color: "text.secondary" },
243
+ children: f
244
+ }
245
+ )
246
+ ] })
247
+ }
248
+ )
249
+ ] }) : i ? /* @__PURE__ */ s(l, { sx: a, children: [
250
+ e && /* @__PURE__ */ s(l, { sx: { mb: 2 }, children: [
251
+ /* @__PURE__ */ t(
252
+ z,
253
+ {
254
+ sx: {
255
+ ...o.title,
256
+ fontFamily: o.fontFamily
257
+ },
258
+ children: e
259
+ }
260
+ ),
261
+ r && /* @__PURE__ */ t(
262
+ z,
263
+ {
264
+ sx: {
265
+ ...o.subtitle,
266
+ fontFamily: o.fontFamily,
267
+ mt: 0.5
268
+ },
269
+ children: r
270
+ }
271
+ )
272
+ ] }),
273
+ /* @__PURE__ */ t(
274
+ l,
275
+ {
276
+ sx: {
277
+ height: d,
278
+ display: "flex",
279
+ alignItems: "center",
280
+ justifyContent: "center",
281
+ backgroundColor: "action.hover",
282
+ // Use MUI theme for subtle bg
283
+ borderRadius: `${G.borders.radius.card}px`,
284
+ border: "1px dashed",
285
+ borderColor: "divider"
286
+ // Use MUI theme
287
+ },
288
+ children: /* @__PURE__ */ s(l, { sx: { textAlign: "center", p: 3 }, children: [
289
+ /* @__PURE__ */ s(
290
+ l,
291
+ {
292
+ component: "svg",
293
+ sx: {
294
+ width: 48,
295
+ height: 48,
296
+ color: "text.disabled",
297
+ // Use MUI theme
298
+ mb: 1
299
+ },
300
+ viewBox: "0 0 24 24",
301
+ fill: "none",
302
+ stroke: "currentColor",
303
+ strokeWidth: 1.5,
304
+ children: [
305
+ /* @__PURE__ */ t("path", { d: "M3 3v18h18", strokeLinecap: "round", strokeLinejoin: "round" }),
306
+ /* @__PURE__ */ t("path", { d: "M7 16l4-4 4 4 6-6", strokeLinecap: "round", strokeLinejoin: "round" })
307
+ ]
308
+ }
309
+ ),
310
+ /* @__PURE__ */ t(
311
+ z,
312
+ {
313
+ sx: {
314
+ color: "text.secondary",
315
+ // Use MUI theme
316
+ fontWeight: 500
317
+ },
318
+ children: b
319
+ }
320
+ )
321
+ ] })
322
+ }
323
+ )
324
+ ] }) : /* @__PURE__ */ s(l, { sx: a, children: [
325
+ (e || r) && /* @__PURE__ */ s(l, { sx: { mb: At.md }, children: [
326
+ e && /* @__PURE__ */ t(
327
+ z,
328
+ {
329
+ sx: {
330
+ ...o.title,
331
+ fontFamily: o.fontFamily
332
+ },
333
+ children: e
334
+ }
335
+ ),
336
+ r && /* @__PURE__ */ t(
337
+ z,
338
+ {
339
+ sx: {
340
+ ...o.subtitle,
341
+ fontFamily: o.fontFamily,
342
+ mt: 0.5
343
+ },
344
+ children: r
345
+ }
346
+ )
347
+ ] }),
348
+ n
349
+ ] });
350
+ }, ht = ({
351
+ active: e,
352
+ payload: r,
353
+ label: d,
354
+ valueFormatter: c,
355
+ labelFormatter: f,
356
+ showTotal: i = !1,
357
+ unit: b = ""
358
+ }) => {
359
+ if (!e || !r || r.length === 0)
360
+ return null;
361
+ const n = f ? f(String(d)) : d, g = (a) => c ? c(a) : typeof a == "number" ? a.toLocaleString() : a, m = i ? r.reduce((a, u) => a + (Number(u.value) || 0), 0) : null;
362
+ return /* @__PURE__ */ s(
363
+ l,
364
+ {
365
+ sx: {
366
+ backgroundColor: _.backgroundColor,
367
+ border: `1px solid ${_.borderColor}`,
368
+ borderRadius: `${_.borderRadius}px`,
369
+ boxShadow: _.boxShadow,
370
+ padding: _.padding,
371
+ minWidth: 140
372
+ },
373
+ children: [
374
+ n && /* @__PURE__ */ t(
375
+ z,
376
+ {
377
+ sx: {
378
+ ...o.tooltipLabel,
379
+ fontFamily: o.fontFamily,
380
+ mb: 1,
381
+ pb: 1,
382
+ borderBottom: `1px solid ${K.neutral.gray100}`
383
+ },
384
+ children: n
385
+ }
386
+ ),
387
+ /* @__PURE__ */ t(l, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: r.map((a, u) => /* @__PURE__ */ s(
388
+ l,
389
+ {
390
+ sx: {
391
+ display: "flex",
392
+ alignItems: "center",
393
+ justifyContent: "space-between",
394
+ gap: 2
395
+ },
396
+ children: [
397
+ /* @__PURE__ */ s(l, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
398
+ /* @__PURE__ */ t(
399
+ l,
400
+ {
401
+ sx: {
402
+ width: 10,
403
+ height: 10,
404
+ borderRadius: `${G.borders.radius.circle}px`,
405
+ // Perfect circle
406
+ backgroundColor: a.color,
407
+ flexShrink: 0
408
+ }
409
+ }
410
+ ),
411
+ /* @__PURE__ */ t(
412
+ z,
413
+ {
414
+ sx: {
415
+ ...o.tooltip,
416
+ fontFamily: o.fontFamily,
417
+ color: K.neutral.gray600
418
+ },
419
+ children: a.name
420
+ }
421
+ )
422
+ ] }),
423
+ /* @__PURE__ */ s(
424
+ z,
425
+ {
426
+ sx: {
427
+ ...o.tooltip,
428
+ fontFamily: o.fontFamily,
429
+ fontWeight: 600,
430
+ color: K.neutral.gray900
431
+ },
432
+ children: [
433
+ g(a.value),
434
+ b
435
+ ]
436
+ }
437
+ )
438
+ ]
439
+ },
440
+ u
441
+ )) }),
442
+ i && m !== null && /* @__PURE__ */ s(
443
+ l,
444
+ {
445
+ sx: {
446
+ mt: 1,
447
+ pt: 1,
448
+ borderTop: `1px solid ${K.neutral.gray100}`,
449
+ display: "flex",
450
+ justifyContent: "space-between"
451
+ },
452
+ children: [
453
+ /* @__PURE__ */ t(
454
+ z,
455
+ {
456
+ sx: {
457
+ ...o.tooltip,
458
+ fontFamily: o.fontFamily,
459
+ fontWeight: 600
460
+ },
461
+ children: "Total"
462
+ }
463
+ ),
464
+ /* @__PURE__ */ s(
465
+ z,
466
+ {
467
+ sx: {
468
+ ...o.tooltip,
469
+ fontFamily: o.fontFamily,
470
+ fontWeight: 600
471
+ },
472
+ children: [
473
+ g(m),
474
+ b
475
+ ]
476
+ }
477
+ )
478
+ ]
479
+ }
480
+ )
481
+ ]
482
+ }
483
+ );
484
+ }, Qt = ({ active: e, payload: r, valueFormatter: d, unit: c = "" }) => {
485
+ if (!e || !r || r.length === 0)
486
+ return null;
487
+ const f = r[0], i = d ? d(f.value) : f.value.toLocaleString();
488
+ return /* @__PURE__ */ s(
489
+ l,
490
+ {
491
+ sx: {
492
+ backgroundColor: _.backgroundColor,
493
+ border: `1px solid ${_.borderColor}`,
494
+ borderRadius: `${_.borderRadius}px`,
495
+ boxShadow: _.boxShadow,
496
+ px: 1.5,
497
+ py: 1,
498
+ display: "flex",
499
+ alignItems: "center",
500
+ gap: 1
501
+ },
502
+ children: [
503
+ /* @__PURE__ */ t(
504
+ l,
505
+ {
506
+ sx: {
507
+ width: 8,
508
+ height: 8,
509
+ borderRadius: `${G.borders.radius.circle}px`,
510
+ // Perfect circle
511
+ backgroundColor: f.color
512
+ }
513
+ }
514
+ ),
515
+ /* @__PURE__ */ s(
516
+ z,
517
+ {
518
+ sx: {
519
+ ...o.tooltip,
520
+ fontFamily: o.fontFamily,
521
+ fontWeight: 600
522
+ },
523
+ children: [
524
+ i,
525
+ c
526
+ ]
527
+ }
528
+ )
529
+ ]
530
+ }
531
+ );
532
+ }, ct = ({
533
+ payload: e,
534
+ direction: r = "horizontal",
535
+ formatter: d,
536
+ onClick: c,
537
+ disabledKeys: f = []
538
+ }) => !e || e.length === 0 ? null : /* @__PURE__ */ t(
539
+ l,
540
+ {
541
+ sx: {
542
+ display: "flex",
543
+ flexDirection: r === "horizontal" ? "row" : "column",
544
+ flexWrap: "wrap",
545
+ justifyContent: "center",
546
+ gap: r === "horizontal" ? 3 : 1,
547
+ pt: 2
548
+ },
549
+ children: e.map((i, b) => {
550
+ const n = f.includes(i.dataKey || i.value), g = d ? d(i.value) : i.value;
551
+ return /* @__PURE__ */ s(
552
+ l,
553
+ {
554
+ onClick: () => c?.(i.dataKey || i.value),
555
+ sx: {
556
+ display: "flex",
557
+ alignItems: "center",
558
+ gap: 1,
559
+ cursor: c ? "pointer" : "default",
560
+ opacity: n ? 0.4 : 1,
561
+ transition: "opacity 0.2s ease",
562
+ "&:hover": c ? {
563
+ opacity: n ? 0.4 : 0.7
564
+ } : {}
565
+ },
566
+ children: [
567
+ /* @__PURE__ */ t(
568
+ l,
569
+ {
570
+ sx: {
571
+ width: it.iconSize,
572
+ height: it.iconSize,
573
+ borderRadius: G.borders.radius.circle,
574
+ backgroundColor: i.color,
575
+ flexShrink: 0
576
+ }
577
+ }
578
+ ),
579
+ /* @__PURE__ */ t(
580
+ z,
581
+ {
582
+ sx: {
583
+ ...o.legend,
584
+ fontFamily: o.fontFamily,
585
+ textDecoration: n ? "line-through" : "none"
586
+ },
587
+ children: g
588
+ }
589
+ )
590
+ ]
591
+ },
592
+ `legend-${b}`
593
+ );
594
+ })
595
+ }
596
+ ), Ut = ({ payload: e, direction: r = "horizontal", formatter: d, onToggle: c, hiddenKeys: f }) => !e || e.length === 0 ? null : /* @__PURE__ */ t(
597
+ l,
598
+ {
599
+ sx: {
600
+ display: "flex",
601
+ flexDirection: r === "horizontal" ? "row" : "column",
602
+ flexWrap: "wrap",
603
+ justifyContent: "center",
604
+ gap: r === "horizontal" ? 3 : 1,
605
+ pt: 2
606
+ },
607
+ children: e.map((i, b) => {
608
+ const n = i.dataKey || i.value, g = f.includes(n), m = d ? d(i.value) : i.value;
609
+ return /* @__PURE__ */ s(
610
+ l,
611
+ {
612
+ onClick: () => c(n),
613
+ sx: {
614
+ display: "flex",
615
+ alignItems: "center",
616
+ gap: 1,
617
+ cursor: "pointer",
618
+ opacity: g ? 0.4 : 1,
619
+ transition: `all ${G.motion.duration.fast}`,
620
+ px: 1.5,
621
+ py: 0.5,
622
+ borderRadius: 1,
623
+ "&:hover": {
624
+ backgroundColor: G.effects.overlay.hover
625
+ // 8%
626
+ }
627
+ },
628
+ children: [
629
+ /* @__PURE__ */ t(
630
+ l,
631
+ {
632
+ sx: {
633
+ width: it.iconSize,
634
+ height: it.iconSize,
635
+ borderRadius: G.borders.radius.circle,
636
+ backgroundColor: g ? "action.disabled" : i.color,
637
+ // @intentional-color: chart series color
638
+ flexShrink: 0,
639
+ transition: `background-color ${G.motion.duration.fast}`
640
+ }
641
+ }
642
+ ),
643
+ /* @__PURE__ */ t(
644
+ z,
645
+ {
646
+ sx: {
647
+ ...o.legend,
648
+ fontFamily: o.fontFamily,
649
+ textDecoration: g ? "line-through" : "none",
650
+ color: g ? "text.disabled" : o.legend.fill
651
+ // @intentional-color: chart text
652
+ },
653
+ children: m
654
+ }
655
+ )
656
+ ]
657
+ },
658
+ `legend-${b}`
659
+ );
660
+ })
661
+ }
662
+ ), mt = ({
663
+ payload: e,
664
+ data: r,
665
+ direction: d = "vertical",
666
+ showValues: c = !0,
667
+ showPercent: f = !0,
668
+ valueFormatter: i
669
+ }) => {
670
+ if (!e || e.length === 0)
671
+ return null;
672
+ const b = r?.reduce((n, g) => n + g.value, 0) || 0;
673
+ return /* @__PURE__ */ t(
674
+ l,
675
+ {
676
+ sx: {
677
+ display: "flex",
678
+ flexDirection: d === "horizontal" ? "row" : "column",
679
+ flexWrap: "wrap",
680
+ gap: d === "horizontal" ? 3 : 1.5,
681
+ py: 1
682
+ },
683
+ children: e.map((n, g) => {
684
+ const a = r?.find((x) => x.name === n.value)?.value || 0, u = b > 0 ? (a / b * 100).toFixed(1) : "0", F = i ? i(a) : a.toLocaleString();
685
+ return /* @__PURE__ */ s(
686
+ l,
687
+ {
688
+ sx: {
689
+ display: "flex",
690
+ alignItems: "center",
691
+ gap: 1.5,
692
+ minWidth: d === "horizontal" ? "auto" : 160
693
+ },
694
+ children: [
695
+ /* @__PURE__ */ t(
696
+ l,
697
+ {
698
+ sx: {
699
+ width: it.iconSize,
700
+ height: it.iconSize,
701
+ borderRadius: `${G.borders.radius.circle}px`,
702
+ // Perfect circle
703
+ backgroundColor: n.color,
704
+ flexShrink: 0
705
+ }
706
+ }
707
+ ),
708
+ /* @__PURE__ */ s(l, { sx: { display: "flex", flexDirection: "column" }, children: [
709
+ /* @__PURE__ */ t(
710
+ z,
711
+ {
712
+ sx: {
713
+ ...o.legend,
714
+ fontFamily: o.fontFamily
715
+ },
716
+ children: n.value
717
+ }
718
+ ),
719
+ (c || f) && /* @__PURE__ */ s(
720
+ z,
721
+ {
722
+ sx: {
723
+ fontSize: 11,
724
+ color: "text.secondary",
725
+ // Use MUI theme
726
+ fontFamily: o.fontFamily
727
+ },
728
+ children: [
729
+ c && F,
730
+ c && f && " • ",
731
+ f && `${u}%`
732
+ ]
733
+ }
734
+ )
735
+ ] })
736
+ ]
737
+ },
738
+ `legend-${g}`
739
+ );
740
+ })
741
+ }
742
+ );
743
+ }, te = ({
744
+ data: e,
745
+ series: r,
746
+ height: d = N.defaultHeight,
747
+ width: c = "100%",
748
+ title: f,
749
+ subtitle: i,
750
+ margin: b = { top: 20, right: 30, left: 20, bottom: 20 },
751
+ colors: n = M,
752
+ showGrid: g = !0,
753
+ gridDirection: m = "horizontal",
754
+ xAxis: a = {},
755
+ yAxis: u = {},
756
+ legend: F = { show: !0, position: "bottom" },
757
+ tooltip: x = { show: !0 },
758
+ animate: j = !0,
759
+ animationDuration: R = Y.duration,
760
+ loading: A = !1,
761
+ emptyMessage: L,
762
+ error: y,
763
+ sx: C,
764
+ curveType: W = "monotone",
765
+ showArea: w = !1,
766
+ connectNulls: T = !1,
767
+ referenceLines: O = [],
768
+ onDataPointClick: B,
769
+ ariaLabel: H
770
+ }) => {
771
+ const p = Ft(), $ = Q(
772
+ () => r.map((S, h) => `line-gradient-${h}-${p.replace(/:/g, "-")}`),
773
+ [r, p]
774
+ ), E = !e || e.length === 0;
775
+ return /* @__PURE__ */ t(
776
+ U,
777
+ {
778
+ title: f,
779
+ subtitle: i,
780
+ height: d,
781
+ loading: A,
782
+ error: y,
783
+ empty: E,
784
+ emptyMessage: L,
785
+ sx: C,
786
+ children: /* @__PURE__ */ t(Z, { width: c, height: d, children: /* @__PURE__ */ s(
787
+ xt,
788
+ {
789
+ data: e,
790
+ margin: b,
791
+ "aria-label": H || f || "Line chart",
792
+ children: [
793
+ w && /* @__PURE__ */ t("defs", { children: r.map((S, h) => {
794
+ const D = S.color || n[h % n.length] || P(h);
795
+ return /* @__PURE__ */ s(
796
+ "linearGradient",
797
+ {
798
+ id: $[h],
799
+ x1: "0",
800
+ y1: "0",
801
+ x2: "0",
802
+ y2: "1",
803
+ children: [
804
+ /* @__PURE__ */ t("stop", { offset: "5%", stopColor: D, stopOpacity: 0.3 }),
805
+ /* @__PURE__ */ t("stop", { offset: "95%", stopColor: D, stopOpacity: 0 })
806
+ ]
807
+ },
808
+ $[h]
809
+ );
810
+ }) }),
811
+ g && /* @__PURE__ */ t(
812
+ lt,
813
+ {
814
+ strokeDasharray: X.strokeDasharray,
815
+ stroke: X.stroke,
816
+ vertical: m === "vertical" || m === "both",
817
+ horizontal: m === "horizontal" || m === "both"
818
+ }
819
+ ),
820
+ /* @__PURE__ */ t(
821
+ at,
822
+ {
823
+ dataKey: a.dataKey || "name",
824
+ hide: a.hide,
825
+ tickFormatter: a.tickFormatter,
826
+ tick: {
827
+ ...o.axisTick,
828
+ fontFamily: o.fontFamily
829
+ },
830
+ axisLine: { stroke: v.stroke },
831
+ tickLine: { stroke: v.stroke },
832
+ angle: a.angle,
833
+ textAnchor: a.angle ? "end" : "middle",
834
+ height: a.angle ? 60 : 30
835
+ }
836
+ ),
837
+ /* @__PURE__ */ t(
838
+ et,
839
+ {
840
+ hide: u.hide,
841
+ domain: u.domain,
842
+ tickFormatter: u.tickFormatter,
843
+ tick: {
844
+ ...o.axisTick,
845
+ fontFamily: o.fontFamily
846
+ },
847
+ axisLine: { stroke: v.stroke },
848
+ tickLine: { stroke: v.stroke },
849
+ tickCount: u.tickCount,
850
+ unit: u.unit,
851
+ width: u.label ? 60 : 50,
852
+ label: u.label ? {
853
+ value: u.label,
854
+ angle: -90,
855
+ position: "insideLeft",
856
+ style: {
857
+ ...o.axisLabel,
858
+ fontFamily: o.fontFamily
859
+ }
860
+ } : void 0
861
+ }
862
+ ),
863
+ x.show !== !1 && /* @__PURE__ */ t(
864
+ nt,
865
+ {
866
+ content: /* @__PURE__ */ t(
867
+ ht,
868
+ {
869
+ labelFormatter: x.labelFormatter,
870
+ valueFormatter: x.formatter
871
+ }
872
+ ),
873
+ cursor: x.cursor !== !1 ? { stroke: X.stroke } : !1
874
+ }
875
+ ),
876
+ F.show !== !1 && /* @__PURE__ */ t(
877
+ st,
878
+ {
879
+ content: /* @__PURE__ */ t(ct, { formatter: F.formatter }),
880
+ verticalAlign: F.position === "top" ? "top" : "bottom",
881
+ align: F.align || "center"
882
+ }
883
+ ),
884
+ O.map((S, h) => /* @__PURE__ */ t(
885
+ tt,
886
+ {
887
+ y: S.axis === "y" ? S.value : void 0,
888
+ x: S.axis === "x" ? S.value : void 0,
889
+ stroke: S.color || M[0],
890
+ strokeDasharray: S.strokeDasharray || "5 5",
891
+ label: S.label ? {
892
+ value: S.label,
893
+ position: "insideTopRight",
894
+ style: {
895
+ ...o.dataLabel,
896
+ fontFamily: o.fontFamily
897
+ }
898
+ } : void 0
899
+ },
900
+ `ref-${h}`
901
+ )),
902
+ w && r.map((S, h) => (S.color || n[h % n.length] || P(h), /* @__PURE__ */ t(
903
+ dt,
904
+ {
905
+ type: W,
906
+ dataKey: S.dataKey,
907
+ "aria-label": `${S.name || S.dataKey} area fill`,
908
+ fill: `url(#${$[h]})`,
909
+ stroke: "none",
910
+ fillOpacity: 1,
911
+ isAnimationActive: j,
912
+ animationDuration: R,
913
+ connectNulls: T
914
+ },
915
+ `area-${S.dataKey}`
916
+ ))),
917
+ r.map((S, h) => {
918
+ const D = S.color || n[h % n.length] || P(h);
919
+ return /* @__PURE__ */ t(
920
+ yt,
921
+ {
922
+ type: W,
923
+ dataKey: S.dataKey,
924
+ name: S.name || S.dataKey,
925
+ stroke: D,
926
+ strokeWidth: N.strokeWidth.default,
927
+ strokeDasharray: S.strokeDasharray,
928
+ dot: S.showDots !== !1 ? {
929
+ r: N.dotSize.small,
930
+ fill: D,
931
+ strokeWidth: 2,
932
+ // eslint-disable-next-line no-restricted-syntax
933
+ stroke: "#FFFFFF"
934
+ // @intentional-color: white outline for visual emphasis
935
+ } : !1,
936
+ activeDot: {
937
+ r: N.dotSize.default,
938
+ fill: D,
939
+ strokeWidth: 2,
940
+ // eslint-disable-next-line no-restricted-syntax
941
+ stroke: "#FFFFFF",
942
+ // @intentional-color: white outline for visual emphasis
943
+ onClick: B ? (I, k) => {
944
+ k && k.payload && B(k.payload, k.index || 0);
945
+ } : void 0,
946
+ style: B ? { cursor: "pointer" } : void 0
947
+ },
948
+ isAnimationActive: j,
949
+ animationDuration: R,
950
+ connectNulls: T
951
+ },
952
+ S.dataKey
953
+ );
954
+ })
955
+ ]
956
+ }
957
+ ) })
958
+ }
959
+ );
960
+ }, ee = ({
961
+ data: e,
962
+ series: r,
963
+ height: d = N.defaultHeight,
964
+ width: c = "100%",
965
+ title: f,
966
+ subtitle: i,
967
+ margin: b = { top: 20, right: 30, left: 20, bottom: 20 },
968
+ colors: n = M,
969
+ showGrid: g = !0,
970
+ gridDirection: m = "horizontal",
971
+ xAxis: a = {},
972
+ yAxis: u = {},
973
+ legend: F = { show: !0, position: "bottom" },
974
+ tooltip: x = { show: !0 },
975
+ animate: j = !0,
976
+ animationDuration: R = Y.duration,
977
+ loading: A = !1,
978
+ emptyMessage: L,
979
+ error: y,
980
+ sx: C,
981
+ layout: W = "vertical",
982
+ variant: w = "grouped",
983
+ barRadius: T = N.barRadius,
984
+ maxBarWidth: O = N.barMaxWidth,
985
+ barGap: B,
986
+ barCategoryGap: H,
987
+ referenceLines: p = [],
988
+ onDataPointClick: $,
989
+ ariaLabel: E
990
+ }) => {
991
+ const S = !e || e.length === 0, h = W === "horizontal", D = (k, q) => {
992
+ if (w === "stacked" || w === "stacked-percent")
993
+ return k.stackId || "stack";
994
+ }, I = (k, q) => w === "grouped" || q === 1 ? T : k === q - 1 ? h ? [0, T, T, 0] : [T, T, 0, 0] : 0;
995
+ return /* @__PURE__ */ t(
996
+ U,
997
+ {
998
+ title: f,
999
+ subtitle: i,
1000
+ height: d,
1001
+ loading: A,
1002
+ error: y,
1003
+ empty: S,
1004
+ emptyMessage: L,
1005
+ sx: C,
1006
+ children: /* @__PURE__ */ t(Z, { width: c, height: d, children: /* @__PURE__ */ s(
1007
+ vt,
1008
+ {
1009
+ data: e,
1010
+ margin: b,
1011
+ layout: h ? "vertical" : "horizontal",
1012
+ barGap: B,
1013
+ barCategoryGap: H,
1014
+ "aria-label": E || f || "Bar chart",
1015
+ children: [
1016
+ g && /* @__PURE__ */ t(
1017
+ lt,
1018
+ {
1019
+ strokeDasharray: X.strokeDasharray,
1020
+ stroke: X.stroke,
1021
+ vertical: h ? m === "horizontal" || m === "both" : m === "vertical" || m === "both",
1022
+ horizontal: h ? m === "vertical" || m === "both" : m === "horizontal" || m === "both"
1023
+ }
1024
+ ),
1025
+ h ? /* @__PURE__ */ s(bt, { children: [
1026
+ /* @__PURE__ */ t(
1027
+ at,
1028
+ {
1029
+ type: "number",
1030
+ hide: a.hide,
1031
+ domain: a.domain,
1032
+ tickFormatter: a.tickFormatter,
1033
+ tick: {
1034
+ ...o.axisTick,
1035
+ fontFamily: o.fontFamily
1036
+ },
1037
+ axisLine: { stroke: v.stroke },
1038
+ tickLine: { stroke: v.stroke }
1039
+ }
1040
+ ),
1041
+ /* @__PURE__ */ t(
1042
+ et,
1043
+ {
1044
+ type: "category",
1045
+ dataKey: u.dataKey || a.dataKey || "name",
1046
+ hide: u.hide,
1047
+ tick: {
1048
+ ...o.axisTick,
1049
+ fontFamily: o.fontFamily
1050
+ },
1051
+ axisLine: { stroke: v.stroke },
1052
+ tickLine: { stroke: v.stroke },
1053
+ width: 80
1054
+ }
1055
+ )
1056
+ ] }) : /* @__PURE__ */ s(bt, { children: [
1057
+ /* @__PURE__ */ t(
1058
+ at,
1059
+ {
1060
+ dataKey: a.dataKey || "name",
1061
+ hide: a.hide,
1062
+ tickFormatter: a.tickFormatter,
1063
+ tick: {
1064
+ ...o.axisTick,
1065
+ fontFamily: o.fontFamily
1066
+ },
1067
+ axisLine: { stroke: v.stroke },
1068
+ tickLine: { stroke: v.stroke },
1069
+ angle: a.angle,
1070
+ textAnchor: a.angle ? "end" : "middle",
1071
+ height: a.angle ? 60 : 30
1072
+ }
1073
+ ),
1074
+ /* @__PURE__ */ t(
1075
+ et,
1076
+ {
1077
+ hide: u.hide,
1078
+ domain: u.domain,
1079
+ tickFormatter: u.tickFormatter,
1080
+ tick: {
1081
+ ...o.axisTick,
1082
+ fontFamily: o.fontFamily
1083
+ },
1084
+ axisLine: { stroke: v.stroke },
1085
+ tickLine: { stroke: v.stroke },
1086
+ tickCount: u.tickCount,
1087
+ unit: u.unit
1088
+ }
1089
+ )
1090
+ ] }),
1091
+ x.show !== !1 && /* @__PURE__ */ t(
1092
+ nt,
1093
+ {
1094
+ content: /* @__PURE__ */ t(
1095
+ ht,
1096
+ {
1097
+ labelFormatter: x.labelFormatter,
1098
+ valueFormatter: x.formatter,
1099
+ showTotal: w === "stacked" || w === "stacked-percent"
1100
+ }
1101
+ ),
1102
+ cursor: { fill: "rgba(0, 0, 0, 0.04)" }
1103
+ }
1104
+ ),
1105
+ F.show !== !1 && /* @__PURE__ */ t(
1106
+ st,
1107
+ {
1108
+ content: /* @__PURE__ */ t(ct, { formatter: F.formatter }),
1109
+ verticalAlign: F.position === "top" ? "top" : "bottom",
1110
+ align: F.align || "center"
1111
+ }
1112
+ ),
1113
+ p.map((k, q) => /* @__PURE__ */ t(
1114
+ tt,
1115
+ {
1116
+ y: k.axis === "y" && !h ? k.value : void 0,
1117
+ x: k.axis === "x" || k.axis === "y" && h ? k.value : void 0,
1118
+ stroke: k.color || M[0],
1119
+ strokeDasharray: k.strokeDasharray || "5 5",
1120
+ label: k.label ? {
1121
+ value: k.label,
1122
+ position: "insideTopRight",
1123
+ style: {
1124
+ ...o.dataLabel,
1125
+ fontFamily: o.fontFamily
1126
+ }
1127
+ } : void 0
1128
+ },
1129
+ `ref-${q}`
1130
+ )),
1131
+ r.map((k, q) => {
1132
+ const ot = k.color || n[q % n.length] || P(q);
1133
+ return /* @__PURE__ */ t(
1134
+ kt,
1135
+ {
1136
+ dataKey: k.dataKey,
1137
+ name: k.name || k.dataKey,
1138
+ fill: ot,
1139
+ stackId: D(k),
1140
+ radius: I(q, r.length),
1141
+ maxBarSize: O,
1142
+ isAnimationActive: j,
1143
+ animationDuration: R,
1144
+ onClick: $ ? (Lt, Wt) => $(Lt, Wt) : void 0,
1145
+ style: $ ? { cursor: "pointer" } : void 0
1146
+ },
1147
+ k.dataKey
1148
+ );
1149
+ })
1150
+ ]
1151
+ }
1152
+ ) })
1153
+ }
1154
+ );
1155
+ }, oe = ({
1156
+ data: e,
1157
+ series: r,
1158
+ height: d = N.defaultHeight,
1159
+ width: c = "100%",
1160
+ title: f,
1161
+ subtitle: i,
1162
+ margin: b = { top: 20, right: 30, left: 20, bottom: 20 },
1163
+ colors: n = M,
1164
+ showGrid: g = !0,
1165
+ gridDirection: m = "horizontal",
1166
+ xAxis: a = {},
1167
+ yAxis: u = {},
1168
+ legend: F = { show: !0, position: "bottom" },
1169
+ tooltip: x = { show: !0 },
1170
+ animate: j = !0,
1171
+ animationDuration: R = Y.duration,
1172
+ loading: A = !1,
1173
+ emptyMessage: L,
1174
+ error: y,
1175
+ sx: C,
1176
+ curveType: W = "monotone",
1177
+ gradient: w = !0,
1178
+ stacked: T = !1,
1179
+ connectNulls: O = !1,
1180
+ referenceLines: B = [],
1181
+ onDataPointClick: H,
1182
+ ariaLabel: p
1183
+ }) => {
1184
+ const $ = Ft(), E = Q(
1185
+ () => r.map((h, D) => `area-gradient-${D}-${$.replace(/:/g, "-")}`),
1186
+ [r, $]
1187
+ ), S = !e || e.length === 0;
1188
+ return /* @__PURE__ */ t(
1189
+ U,
1190
+ {
1191
+ title: f,
1192
+ subtitle: i,
1193
+ height: d,
1194
+ loading: A,
1195
+ error: y,
1196
+ empty: S,
1197
+ emptyMessage: L,
1198
+ sx: C,
1199
+ children: /* @__PURE__ */ t(Z, { width: c, height: d, children: /* @__PURE__ */ s(
1200
+ St,
1201
+ {
1202
+ data: e,
1203
+ margin: b,
1204
+ "aria-label": p || f || "Area chart",
1205
+ children: [
1206
+ w && /* @__PURE__ */ t("defs", { children: r.map((h, D) => {
1207
+ const I = h.color || n[D % n.length] || P(D);
1208
+ return /* @__PURE__ */ s(
1209
+ "linearGradient",
1210
+ {
1211
+ id: E[D],
1212
+ x1: "0",
1213
+ y1: "0",
1214
+ x2: "0",
1215
+ y2: "1",
1216
+ children: [
1217
+ /* @__PURE__ */ t("stop", { offset: "5%", stopColor: I, stopOpacity: 0.4 }),
1218
+ /* @__PURE__ */ t("stop", { offset: "95%", stopColor: I, stopOpacity: 0.05 })
1219
+ ]
1220
+ },
1221
+ E[D]
1222
+ );
1223
+ }) }),
1224
+ g && /* @__PURE__ */ t(
1225
+ lt,
1226
+ {
1227
+ strokeDasharray: X.strokeDasharray,
1228
+ stroke: X.stroke,
1229
+ vertical: m === "vertical" || m === "both",
1230
+ horizontal: m === "horizontal" || m === "both"
1231
+ }
1232
+ ),
1233
+ /* @__PURE__ */ t(
1234
+ at,
1235
+ {
1236
+ dataKey: a.dataKey || "name",
1237
+ hide: a.hide,
1238
+ tickFormatter: a.tickFormatter,
1239
+ tick: {
1240
+ ...o.axisTick,
1241
+ fontFamily: o.fontFamily
1242
+ },
1243
+ axisLine: { stroke: v.stroke },
1244
+ tickLine: { stroke: v.stroke },
1245
+ angle: a.angle,
1246
+ textAnchor: a.angle ? "end" : "middle",
1247
+ height: a.angle ? 60 : 30
1248
+ }
1249
+ ),
1250
+ /* @__PURE__ */ t(
1251
+ et,
1252
+ {
1253
+ hide: u.hide,
1254
+ domain: u.domain,
1255
+ tickFormatter: u.tickFormatter,
1256
+ tick: {
1257
+ ...o.axisTick,
1258
+ fontFamily: o.fontFamily
1259
+ },
1260
+ axisLine: { stroke: v.stroke },
1261
+ tickLine: { stroke: v.stroke },
1262
+ tickCount: u.tickCount,
1263
+ unit: u.unit,
1264
+ width: u.label ? 60 : 50,
1265
+ label: u.label ? {
1266
+ value: u.label,
1267
+ angle: -90,
1268
+ position: "insideLeft",
1269
+ style: {
1270
+ ...o.axisLabel,
1271
+ fontFamily: o.fontFamily
1272
+ }
1273
+ } : void 0
1274
+ }
1275
+ ),
1276
+ x.show !== !1 && /* @__PURE__ */ t(
1277
+ nt,
1278
+ {
1279
+ content: /* @__PURE__ */ t(
1280
+ ht,
1281
+ {
1282
+ labelFormatter: x.labelFormatter,
1283
+ valueFormatter: x.formatter,
1284
+ showTotal: T
1285
+ }
1286
+ ),
1287
+ cursor: { stroke: X.stroke }
1288
+ }
1289
+ ),
1290
+ F.show !== !1 && /* @__PURE__ */ t(
1291
+ st,
1292
+ {
1293
+ content: /* @__PURE__ */ t(ct, { formatter: F.formatter }),
1294
+ verticalAlign: F.position === "top" ? "top" : "bottom",
1295
+ align: F.align || "center"
1296
+ }
1297
+ ),
1298
+ B.map((h, D) => /* @__PURE__ */ t(
1299
+ tt,
1300
+ {
1301
+ y: h.axis === "y" ? h.value : void 0,
1302
+ x: h.axis === "x" ? h.value : void 0,
1303
+ stroke: h.color || M[0],
1304
+ strokeDasharray: h.strokeDasharray || "5 5",
1305
+ label: h.label ? {
1306
+ value: h.label,
1307
+ position: "insideTopRight",
1308
+ style: {
1309
+ ...o.dataLabel,
1310
+ fontFamily: o.fontFamily
1311
+ }
1312
+ } : void 0
1313
+ },
1314
+ `ref-${D}`
1315
+ )),
1316
+ r.map((h, D) => {
1317
+ const I = h.color || n[D % n.length] || P(D), k = h.fillOpacity ?? (w ? 1 : 0.3);
1318
+ return /* @__PURE__ */ t(
1319
+ dt,
1320
+ {
1321
+ type: W,
1322
+ dataKey: h.dataKey,
1323
+ name: h.name || h.dataKey,
1324
+ "aria-label": `${h.name || h.dataKey} data series`,
1325
+ stroke: I,
1326
+ strokeWidth: N.strokeWidth.default,
1327
+ fill: w ? `url(#${E[D]})` : I,
1328
+ fillOpacity: k,
1329
+ stackId: T ? "stack" : void 0,
1330
+ isAnimationActive: j,
1331
+ animationDuration: R,
1332
+ connectNulls: O,
1333
+ activeDot: {
1334
+ r: N.dotSize.default,
1335
+ fill: I,
1336
+ strokeWidth: 2,
1337
+ // eslint-disable-next-line no-restricted-syntax
1338
+ stroke: "#FFFFFF",
1339
+ // @intentional-color: white outline for visual emphasis
1340
+ onClick: H ? (q, ot) => {
1341
+ ot && ot.payload && H(ot.payload, ot.index || 0);
1342
+ } : void 0,
1343
+ style: H ? { cursor: "pointer" } : void 0
1344
+ }
1345
+ },
1346
+ h.dataKey
1347
+ );
1348
+ })
1349
+ ]
1350
+ }
1351
+ ) })
1352
+ }
1353
+ );
1354
+ }, Gt = (e) => {
1355
+ const {
1356
+ cx: r,
1357
+ cy: d,
1358
+ innerRadius: c,
1359
+ outerRadius: f,
1360
+ startAngle: i,
1361
+ endAngle: b,
1362
+ fill: n
1363
+ } = e;
1364
+ return /* @__PURE__ */ t("g", { children: /* @__PURE__ */ t(
1365
+ Dt,
1366
+ {
1367
+ cx: r,
1368
+ cy: d,
1369
+ innerRadius: c,
1370
+ outerRadius: f + 8,
1371
+ startAngle: i,
1372
+ endAngle: b,
1373
+ fill: n,
1374
+ style: { filter: "drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15))" }
1375
+ }
1376
+ ) });
1377
+ }, Ht = ({
1378
+ active: e,
1379
+ payload: r,
1380
+ total: d
1381
+ }) => {
1382
+ if (!e || !r || r.length === 0)
1383
+ return null;
1384
+ const c = r[0], f = d > 0 ? (c.value / d * 100).toFixed(1) : "0";
1385
+ return /* @__PURE__ */ s(
1386
+ l,
1387
+ {
1388
+ sx: {
1389
+ backgroundColor: _.backgroundColor,
1390
+ border: `1px solid ${_.borderColor}`,
1391
+ borderRadius: `${_.borderRadius}px`,
1392
+ boxShadow: _.boxShadow,
1393
+ padding: _.padding,
1394
+ minWidth: 120
1395
+ },
1396
+ children: [
1397
+ /* @__PURE__ */ s(l, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 0.5 }, children: [
1398
+ /* @__PURE__ */ t(
1399
+ l,
1400
+ {
1401
+ sx: {
1402
+ width: 10,
1403
+ height: 10,
1404
+ borderRadius: `${G.borders.radius.circle}px`,
1405
+ // Perfect circle
1406
+ backgroundColor: c.payload?.fill || c.color
1407
+ }
1408
+ }
1409
+ ),
1410
+ /* @__PURE__ */ t(
1411
+ z,
1412
+ {
1413
+ sx: {
1414
+ ...o.tooltipLabel,
1415
+ fontFamily: o.fontFamily
1416
+ },
1417
+ children: c.name
1418
+ }
1419
+ )
1420
+ ] }),
1421
+ /* @__PURE__ */ s(
1422
+ z,
1423
+ {
1424
+ sx: {
1425
+ ...o.tooltip,
1426
+ fontFamily: o.fontFamily,
1427
+ fontWeight: 600
1428
+ },
1429
+ children: [
1430
+ c.value.toLocaleString(),
1431
+ " (",
1432
+ f,
1433
+ "%)"
1434
+ ]
1435
+ }
1436
+ )
1437
+ ]
1438
+ }
1439
+ );
1440
+ }, Vt = (e, r, d, c) => {
1441
+ if (!d) return null;
1442
+ const f = r > 0 ? (e.value / r * 100).toFixed(0) : "0";
1443
+ switch (c) {
1444
+ case "value":
1445
+ return e.value.toLocaleString();
1446
+ case "name":
1447
+ return e.name;
1448
+ default:
1449
+ return `${f}%`;
1450
+ }
1451
+ }, Pt = ({
1452
+ data: e,
1453
+ height: r = 300,
1454
+ width: d = "100%",
1455
+ title: c,
1456
+ subtitle: f,
1457
+ innerRadius: i = 0,
1458
+ paddingAngle: b = 2,
1459
+ cornerRadius: n = 4,
1460
+ startAngle: g = 90,
1461
+ endAngle: m = -270,
1462
+ showLabels: a = !1,
1463
+ labelType: u = "percent",
1464
+ colors: F = M,
1465
+ legend: x = { show: !0, position: "right" },
1466
+ tooltip: j = { show: !0 },
1467
+ animate: R = !0,
1468
+ animationDuration: A = Y.duration,
1469
+ loading: L = !1,
1470
+ emptyMessage: y,
1471
+ error: C,
1472
+ centerContent: W,
1473
+ sx: w,
1474
+ onSegmentClick: T,
1475
+ ariaLabel: O
1476
+ }) => {
1477
+ const [B, H] = It(null), p = !e || e.length === 0, $ = Q(
1478
+ () => e?.reduce((I, k) => I + k.value, 0) || 0,
1479
+ [e]
1480
+ ), E = pt(
1481
+ (I) => /* @__PURE__ */ t(Ht, { ...I, total: $ }),
1482
+ [$]
1483
+ ), S = pt(
1484
+ (I) => Vt(I, $, a, u),
1485
+ [$, a, u]
1486
+ ), h = i > 0, D = x.position === "left" || x.position === "right";
1487
+ return /* @__PURE__ */ t(
1488
+ U,
1489
+ {
1490
+ title: c,
1491
+ subtitle: f,
1492
+ height: r,
1493
+ loading: L,
1494
+ error: C,
1495
+ empty: p,
1496
+ emptyMessage: y,
1497
+ sx: w,
1498
+ children: /* @__PURE__ */ s(
1499
+ l,
1500
+ {
1501
+ sx: {
1502
+ display: "flex",
1503
+ flexDirection: D ? "row" : "column",
1504
+ alignItems: "center",
1505
+ height: "100%"
1506
+ },
1507
+ children: [
1508
+ x.show !== !1 && x.position === "left" && /* @__PURE__ */ t(l, { sx: { flexShrink: 0, pr: 2 }, children: /* @__PURE__ */ t(
1509
+ mt,
1510
+ {
1511
+ payload: e?.map((I, k) => ({
1512
+ value: I.name,
1513
+ color: I.color || F[k % F.length] || P(k)
1514
+ })),
1515
+ data: e,
1516
+ direction: "vertical",
1517
+ showValues: !0,
1518
+ showPercent: !0
1519
+ }
1520
+ ) }),
1521
+ /* @__PURE__ */ s(l, { sx: { flex: 1, position: "relative", minWidth: 0, height: "100%" }, children: [
1522
+ /* @__PURE__ */ t(Z, { width: "100%", height: r, children: /* @__PURE__ */ s(Kt, { "aria-label": O || c || "Pie chart", children: [
1523
+ /* @__PURE__ */ t(
1524
+ Rt,
1525
+ {
1526
+ data: e,
1527
+ cx: "50%",
1528
+ cy: "50%",
1529
+ innerRadius: h ? `${i * 100}%` : 0,
1530
+ outerRadius: "80%",
1531
+ paddingAngle: b,
1532
+ cornerRadius: n,
1533
+ startAngle: g,
1534
+ endAngle: m,
1535
+ dataKey: "value",
1536
+ nameKey: "name",
1537
+ label: a ? S : !1,
1538
+ labelLine: a ? { stroke: "#9CA3AF" } : !1,
1539
+ activeIndex: B ?? void 0,
1540
+ activeShape: Gt,
1541
+ onMouseEnter: (I, k) => H(k),
1542
+ onMouseLeave: () => H(null),
1543
+ onClick: T ? (I, k) => T(I, k) : void 0,
1544
+ isAnimationActive: R,
1545
+ animationDuration: A,
1546
+ style: T ? { cursor: "pointer" } : void 0,
1547
+ children: e?.map((I, k) => /* @__PURE__ */ t(
1548
+ gt,
1549
+ {
1550
+ fill: I.color || F[k % F.length] || P(k)
1551
+ },
1552
+ `cell-${k}`
1553
+ ))
1554
+ }
1555
+ ),
1556
+ j.show !== !1 && /* @__PURE__ */ t(nt, { content: E })
1557
+ ] }) }),
1558
+ h && W && /* @__PURE__ */ t(
1559
+ l,
1560
+ {
1561
+ sx: {
1562
+ position: "absolute",
1563
+ top: "50%",
1564
+ left: "50%",
1565
+ transform: "translate(-50%, -50%)",
1566
+ textAlign: "center",
1567
+ pointerEvents: "none"
1568
+ },
1569
+ children: W
1570
+ }
1571
+ )
1572
+ ] }),
1573
+ x.show !== !1 && x.position === "right" && /* @__PURE__ */ t(l, { sx: { flexShrink: 0, pl: 2 }, children: /* @__PURE__ */ t(
1574
+ mt,
1575
+ {
1576
+ payload: e?.map((I, k) => ({
1577
+ value: I.name,
1578
+ color: I.color || F[k % F.length] || P(k)
1579
+ })),
1580
+ data: e,
1581
+ direction: "vertical",
1582
+ showValues: !0,
1583
+ showPercent: !0
1584
+ }
1585
+ ) }),
1586
+ x.show !== !1 && x.position === "bottom" && /* @__PURE__ */ t(l, { sx: { pt: 2, width: "100%" }, children: /* @__PURE__ */ t(
1587
+ mt,
1588
+ {
1589
+ payload: e?.map((I, k) => ({
1590
+ value: I.name,
1591
+ color: I.color || F[k % F.length] || P(k)
1592
+ })),
1593
+ data: e,
1594
+ direction: "horizontal",
1595
+ showValues: !1,
1596
+ showPercent: !0
1597
+ }
1598
+ ) })
1599
+ ]
1600
+ }
1601
+ )
1602
+ }
1603
+ );
1604
+ }, re = (e) => /* @__PURE__ */ t(Pt, { ...e, innerRadius: e.innerRadius || 0.6 }), Mt = ({
1605
+ active: e,
1606
+ payload: r,
1607
+ xAxisLabel: d = "X",
1608
+ yAxisLabel: c = "Y",
1609
+ hasBubble: f
1610
+ }) => {
1611
+ if (!e || !r || r.length === 0)
1612
+ return null;
1613
+ const i = r[0].payload;
1614
+ return /* @__PURE__ */ s(
1615
+ l,
1616
+ {
1617
+ sx: {
1618
+ backgroundColor: _.backgroundColor,
1619
+ border: `1px solid ${_.borderColor}`,
1620
+ borderRadius: `${_.borderRadius}px`,
1621
+ boxShadow: _.boxShadow,
1622
+ padding: _.padding,
1623
+ minWidth: 140
1624
+ },
1625
+ children: [
1626
+ i.name && /* @__PURE__ */ t(
1627
+ z,
1628
+ {
1629
+ sx: {
1630
+ ...o.tooltipLabel,
1631
+ fontFamily: o.fontFamily,
1632
+ mb: 1
1633
+ },
1634
+ children: i.name
1635
+ }
1636
+ ),
1637
+ /* @__PURE__ */ s(l, { sx: { display: "flex", flexDirection: "column", gap: 0.5 }, children: [
1638
+ /* @__PURE__ */ s(l, { sx: { display: "flex", justifyContent: "space-between", gap: 2 }, children: [
1639
+ /* @__PURE__ */ t(
1640
+ z,
1641
+ {
1642
+ sx: {
1643
+ ...o.tooltip,
1644
+ fontFamily: o.fontFamily,
1645
+ color: "text.secondary"
1646
+ // @intentional: Use MUI theme for tooltip labels
1647
+ },
1648
+ children: d
1649
+ }
1650
+ ),
1651
+ /* @__PURE__ */ t(
1652
+ z,
1653
+ {
1654
+ sx: {
1655
+ ...o.tooltip,
1656
+ fontFamily: o.fontFamily,
1657
+ fontWeight: 600
1658
+ },
1659
+ children: i.x?.toLocaleString()
1660
+ }
1661
+ )
1662
+ ] }),
1663
+ /* @__PURE__ */ s(l, { sx: { display: "flex", justifyContent: "space-between", gap: 2 }, children: [
1664
+ /* @__PURE__ */ t(
1665
+ z,
1666
+ {
1667
+ sx: {
1668
+ ...o.tooltip,
1669
+ fontFamily: o.fontFamily,
1670
+ color: "text.secondary"
1671
+ // @intentional: Use MUI theme for tooltip labels
1672
+ },
1673
+ children: c
1674
+ }
1675
+ ),
1676
+ /* @__PURE__ */ t(
1677
+ z,
1678
+ {
1679
+ sx: {
1680
+ ...o.tooltip,
1681
+ fontFamily: o.fontFamily,
1682
+ fontWeight: 600
1683
+ },
1684
+ children: i.y?.toLocaleString()
1685
+ }
1686
+ )
1687
+ ] }),
1688
+ f && i.z !== void 0 && /* @__PURE__ */ s(l, { sx: { display: "flex", justifyContent: "space-between", gap: 2 }, children: [
1689
+ /* @__PURE__ */ t(
1690
+ z,
1691
+ {
1692
+ sx: {
1693
+ ...o.tooltip,
1694
+ fontFamily: o.fontFamily,
1695
+ color: "text.secondary"
1696
+ // @intentional: Use MUI theme for tooltip labels
1697
+ },
1698
+ children: "Size"
1699
+ }
1700
+ ),
1701
+ /* @__PURE__ */ t(
1702
+ z,
1703
+ {
1704
+ sx: {
1705
+ ...o.tooltip,
1706
+ fontFamily: o.fontFamily,
1707
+ fontWeight: 600
1708
+ },
1709
+ children: i.z?.toLocaleString()
1710
+ }
1711
+ )
1712
+ ] })
1713
+ ] })
1714
+ ]
1715
+ }
1716
+ );
1717
+ }, Xt = ({
1718
+ data: e,
1719
+ height: r = N.defaultHeight,
1720
+ width: d = "100%",
1721
+ title: c,
1722
+ subtitle: f,
1723
+ xAxis: i = {},
1724
+ yAxis: b = {},
1725
+ zAxis: n = {},
1726
+ colors: g = M,
1727
+ showGrid: m = !0,
1728
+ legend: a = { show: !0, position: "bottom" },
1729
+ tooltip: u = { show: !0 },
1730
+ animate: F = !0,
1731
+ animationDuration: x = Y.duration,
1732
+ loading: j = !1,
1733
+ emptyMessage: R,
1734
+ error: A,
1735
+ sx: L,
1736
+ onPointClick: y,
1737
+ ariaLabel: C
1738
+ }) => {
1739
+ const W = $t.useMemo(() => !e || e.length === 0 ? [] : "data" in e[0] ? e : [{
1740
+ name: "Data",
1741
+ data: e,
1742
+ color: g[0]
1743
+ }], [e, g]), w = !e || e.length === 0, T = W.some((B) => B.data.some((H) => H.z !== void 0)), O = pt(
1744
+ (B) => /* @__PURE__ */ t(
1745
+ Mt,
1746
+ {
1747
+ ...B,
1748
+ xAxisLabel: i.label || "X",
1749
+ yAxisLabel: b.label || "Y",
1750
+ hasBubble: T
1751
+ }
1752
+ ),
1753
+ [i.label, b.label, T]
1754
+ );
1755
+ return /* @__PURE__ */ t(
1756
+ U,
1757
+ {
1758
+ title: c,
1759
+ subtitle: f,
1760
+ height: r,
1761
+ loading: j,
1762
+ error: A,
1763
+ empty: w,
1764
+ emptyMessage: R,
1765
+ sx: L,
1766
+ children: /* @__PURE__ */ t(Z, { width: d, height: r, children: /* @__PURE__ */ s(
1767
+ Tt,
1768
+ {
1769
+ margin: { top: 20, right: 30, bottom: 20, left: 20 },
1770
+ "aria-label": C || c || "Scatter chart",
1771
+ children: [
1772
+ m && /* @__PURE__ */ t(
1773
+ lt,
1774
+ {
1775
+ strokeDasharray: X.strokeDasharray,
1776
+ stroke: X.stroke
1777
+ }
1778
+ ),
1779
+ /* @__PURE__ */ t(
1780
+ at,
1781
+ {
1782
+ type: "number",
1783
+ dataKey: "x",
1784
+ name: i.label || "X",
1785
+ hide: i.hide,
1786
+ domain: i.domain,
1787
+ tickFormatter: i.tickFormatter,
1788
+ tick: {
1789
+ ...o.axisTick,
1790
+ fontFamily: o.fontFamily
1791
+ },
1792
+ axisLine: { stroke: v.stroke },
1793
+ tickLine: { stroke: v.stroke },
1794
+ label: i.label ? {
1795
+ value: i.label,
1796
+ position: "insideBottom",
1797
+ offset: -10,
1798
+ style: {
1799
+ ...o.axisLabel,
1800
+ fontFamily: o.fontFamily
1801
+ }
1802
+ } : void 0
1803
+ }
1804
+ ),
1805
+ /* @__PURE__ */ t(
1806
+ et,
1807
+ {
1808
+ type: "number",
1809
+ dataKey: "y",
1810
+ name: b.label || "Y",
1811
+ hide: b.hide,
1812
+ domain: b.domain,
1813
+ tickFormatter: b.tickFormatter,
1814
+ tick: {
1815
+ ...o.axisTick,
1816
+ fontFamily: o.fontFamily
1817
+ },
1818
+ axisLine: { stroke: v.stroke },
1819
+ tickLine: { stroke: v.stroke },
1820
+ label: b.label ? {
1821
+ value: b.label,
1822
+ angle: -90,
1823
+ position: "insideLeft",
1824
+ style: {
1825
+ ...o.axisLabel,
1826
+ fontFamily: o.fontFamily
1827
+ }
1828
+ } : void 0
1829
+ }
1830
+ ),
1831
+ T && /* @__PURE__ */ t(
1832
+ Ot,
1833
+ {
1834
+ type: "number",
1835
+ dataKey: "z",
1836
+ domain: n.domain || [0, "auto"],
1837
+ range: n.range || [50, 400]
1838
+ }
1839
+ ),
1840
+ u.show !== !1 && /* @__PURE__ */ t(nt, { content: O }),
1841
+ a.show !== !1 && W.length > 1 && /* @__PURE__ */ t(
1842
+ st,
1843
+ {
1844
+ content: /* @__PURE__ */ t(ct, { formatter: a.formatter }),
1845
+ verticalAlign: a.position === "top" ? "top" : "bottom",
1846
+ align: a.align || "center"
1847
+ }
1848
+ ),
1849
+ W.map((B, H) => {
1850
+ const p = B.color || g[H % g.length] || P(H);
1851
+ return /* @__PURE__ */ t(
1852
+ Bt,
1853
+ {
1854
+ name: B.name,
1855
+ data: B.data,
1856
+ fill: p,
1857
+ isAnimationActive: F,
1858
+ animationDuration: x,
1859
+ onClick: y ? ($) => y($, 0) : void 0,
1860
+ style: y ? { cursor: "pointer" } : void 0,
1861
+ children: B.data.map(($, E) => /* @__PURE__ */ t(
1862
+ gt,
1863
+ {
1864
+ fill: p,
1865
+ fillOpacity: 0.8
1866
+ },
1867
+ `cell-${E}`
1868
+ ))
1869
+ },
1870
+ B.name
1871
+ );
1872
+ })
1873
+ ]
1874
+ }
1875
+ ) })
1876
+ }
1877
+ );
1878
+ }, ae = (e) => /* @__PURE__ */ t(
1879
+ Xt,
1880
+ {
1881
+ ...e,
1882
+ zAxis: e.zAxis || { range: [50, 400] }
1883
+ }
1884
+ ), ie = ({
1885
+ data: e,
1886
+ height: r = 300,
1887
+ width: d = "100%",
1888
+ title: c,
1889
+ subtitle: f,
1890
+ innerRadius: i = "30%",
1891
+ outerRadius: b = "90%",
1892
+ startAngle: n = 90,
1893
+ endAngle: g = -270,
1894
+ colors: m = M,
1895
+ showLabels: a = !0,
1896
+ legend: u = { show: !0, position: "right" },
1897
+ animate: F = !0,
1898
+ sx: x,
1899
+ ariaLabel: j
1900
+ }) => {
1901
+ const R = Q(
1902
+ () => e.map((y, C) => ({
1903
+ ...y,
1904
+ fill: m[C % m.length] || P(C)
1905
+ })),
1906
+ [e, m]
1907
+ ), A = !e || e.length === 0, L = () => u.show ? /* @__PURE__ */ t(
1908
+ l,
1909
+ {
1910
+ sx: {
1911
+ display: "flex",
1912
+ flexDirection: "column",
1913
+ gap: 1.5,
1914
+ py: 1
1915
+ },
1916
+ children: R.map((y, C) => /* @__PURE__ */ s(
1917
+ l,
1918
+ {
1919
+ sx: {
1920
+ display: "flex",
1921
+ alignItems: "center",
1922
+ gap: 1.5
1923
+ },
1924
+ children: [
1925
+ /* @__PURE__ */ t(
1926
+ l,
1927
+ {
1928
+ sx: {
1929
+ width: 12,
1930
+ height: 12,
1931
+ borderRadius: `${G.borders.radius.circle}px`,
1932
+ // Perfect circle
1933
+ backgroundColor: y.fill,
1934
+ flexShrink: 0
1935
+ }
1936
+ }
1937
+ ),
1938
+ /* @__PURE__ */ s(l, { sx: { flex: 1, minWidth: 0 }, children: [
1939
+ /* @__PURE__ */ t(
1940
+ z,
1941
+ {
1942
+ sx: {
1943
+ ...o.legend,
1944
+ fontFamily: o.fontFamily
1945
+ },
1946
+ children: y.name
1947
+ }
1948
+ ),
1949
+ /* @__PURE__ */ t(
1950
+ z,
1951
+ {
1952
+ sx: {
1953
+ fontSize: 11,
1954
+ color: K.neutral.gray500,
1955
+ fontFamily: o.fontFamily
1956
+ },
1957
+ children: y.value.toLocaleString()
1958
+ }
1959
+ )
1960
+ ] })
1961
+ ]
1962
+ },
1963
+ C
1964
+ ))
1965
+ }
1966
+ ) : null;
1967
+ return /* @__PURE__ */ t(
1968
+ U,
1969
+ {
1970
+ title: c,
1971
+ subtitle: f,
1972
+ height: r,
1973
+ empty: A,
1974
+ sx: x,
1975
+ children: /* @__PURE__ */ s(
1976
+ l,
1977
+ {
1978
+ sx: {
1979
+ display: "flex",
1980
+ alignItems: "center",
1981
+ height: "100%"
1982
+ },
1983
+ children: [
1984
+ /* @__PURE__ */ t(l, { sx: { flex: 1, height: "100%" }, children: /* @__PURE__ */ t(Z, { width: "100%", height: r, children: /* @__PURE__ */ t(
1985
+ Ct,
1986
+ {
1987
+ cx: "50%",
1988
+ cy: "50%",
1989
+ innerRadius: i,
1990
+ outerRadius: b,
1991
+ barSize: 20,
1992
+ data: R,
1993
+ startAngle: n,
1994
+ endAngle: g,
1995
+ "aria-label": j || c || "Radial bar chart",
1996
+ children: /* @__PURE__ */ t(
1997
+ zt,
1998
+ {
1999
+ background: { fill: K.neutral.gray100 },
2000
+ dataKey: "value",
2001
+ cornerRadius: 10,
2002
+ isAnimationActive: F,
2003
+ animationDuration: Y.duration,
2004
+ label: a ? {
2005
+ position: "insideStart",
2006
+ // eslint-disable-next-line no-restricted-syntax
2007
+ fill: "#FFFFFF",
2008
+ // @intentional-color: white text for contrast on colored bars
2009
+ fontFamily: o.fontFamily,
2010
+ fontSize: 11,
2011
+ fontWeight: 600
2012
+ } : !1
2013
+ }
2014
+ )
2015
+ }
2016
+ ) }) }),
2017
+ u.show && /* @__PURE__ */ t(l, { sx: { flexShrink: 0, pl: 2, minWidth: 120 }, children: L() })
2018
+ ]
2019
+ }
2020
+ )
2021
+ }
2022
+ );
2023
+ }, ne = ({
2024
+ value: e,
2025
+ min: r = 0,
2026
+ max: d = 100,
2027
+ height: c = 200,
2028
+ width: f = "100%",
2029
+ title: i,
2030
+ valueLabel: b,
2031
+ unit: n = "",
2032
+ thresholds: g,
2033
+ color: m = M[0],
2034
+ showValue: a = !0,
2035
+ valueFormatter: u,
2036
+ animate: F = !0,
2037
+ sx: x,
2038
+ ariaLabel: j
2039
+ }) => {
2040
+ const R = Q(() => {
2041
+ if (!g || g.length === 0) return m;
2042
+ const C = [...g].sort((W, w) => W.value - w.value);
2043
+ for (const W of C)
2044
+ if (e <= W.value)
2045
+ return W.color;
2046
+ return C[C.length - 1].color;
2047
+ }, [e, g, m]), L = [
2048
+ { name: "Value", value: Math.min(100, Math.max(0, (e - r) / (d - r) * 100)), fill: R }
2049
+ ], y = u ? u(e) : e.toLocaleString();
2050
+ return /* @__PURE__ */ t(U, { title: i, height: c, sx: x, children: /* @__PURE__ */ s(l, { sx: { position: "relative", width: "100%", height: "100%" }, children: [
2051
+ /* @__PURE__ */ t(Z, { width: "100%", height: c, children: /* @__PURE__ */ s(
2052
+ Ct,
2053
+ {
2054
+ cx: "50%",
2055
+ cy: "50%",
2056
+ innerRadius: "60%",
2057
+ outerRadius: "90%",
2058
+ barSize: 16,
2059
+ data: L,
2060
+ startAngle: 180,
2061
+ endAngle: 0,
2062
+ "aria-label": j || i || `Gauge showing ${e}${n}`,
2063
+ children: [
2064
+ /* @__PURE__ */ t(
2065
+ Et,
2066
+ {
2067
+ type: "number",
2068
+ domain: [0, 100],
2069
+ angleAxisId: 0,
2070
+ tick: !1
2071
+ }
2072
+ ),
2073
+ /* @__PURE__ */ t(
2074
+ zt,
2075
+ {
2076
+ background: { fill: K.neutral.gray100 },
2077
+ dataKey: "value",
2078
+ cornerRadius: 8,
2079
+ isAnimationActive: F,
2080
+ animationDuration: Y.duration
2081
+ }
2082
+ )
2083
+ ]
2084
+ }
2085
+ ) }),
2086
+ a && /* @__PURE__ */ s(
2087
+ l,
2088
+ {
2089
+ sx: {
2090
+ position: "absolute",
2091
+ top: "50%",
2092
+ left: "50%",
2093
+ transform: "translate(-50%, -30%)",
2094
+ textAlign: "center"
2095
+ },
2096
+ children: [
2097
+ /* @__PURE__ */ s(
2098
+ z,
2099
+ {
2100
+ sx: {
2101
+ fontSize: c / 6,
2102
+ fontWeight: 700,
2103
+ fontFamily: o.fontFamily,
2104
+ color: R,
2105
+ lineHeight: 1
2106
+ },
2107
+ children: [
2108
+ y,
2109
+ n && /* @__PURE__ */ t(
2110
+ l,
2111
+ {
2112
+ component: "span",
2113
+ sx: {
2114
+ fontSize: "0.5em",
2115
+ fontWeight: 500,
2116
+ color: K.neutral.gray500
2117
+ },
2118
+ children: n
2119
+ }
2120
+ )
2121
+ ]
2122
+ }
2123
+ ),
2124
+ b && /* @__PURE__ */ t(
2125
+ z,
2126
+ {
2127
+ sx: {
2128
+ fontSize: 12,
2129
+ fontFamily: o.fontFamily,
2130
+ color: K.neutral.gray500,
2131
+ mt: 0.5
2132
+ },
2133
+ children: b
2134
+ }
2135
+ )
2136
+ ]
2137
+ }
2138
+ ),
2139
+ /* @__PURE__ */ s(
2140
+ l,
2141
+ {
2142
+ sx: {
2143
+ position: "absolute",
2144
+ bottom: c * 0.25,
2145
+ left: 0,
2146
+ right: 0,
2147
+ display: "flex",
2148
+ justifyContent: "space-between",
2149
+ px: 3
2150
+ },
2151
+ children: [
2152
+ /* @__PURE__ */ t(
2153
+ z,
2154
+ {
2155
+ sx: {
2156
+ fontSize: 11,
2157
+ fontFamily: o.fontFamily,
2158
+ color: K.neutral.gray400
2159
+ },
2160
+ children: r
2161
+ }
2162
+ ),
2163
+ /* @__PURE__ */ t(
2164
+ z,
2165
+ {
2166
+ sx: {
2167
+ fontSize: 11,
2168
+ fontFamily: o.fontFamily,
2169
+ color: K.neutral.gray400
2170
+ },
2171
+ children: d
2172
+ }
2173
+ )
2174
+ ]
2175
+ }
2176
+ )
2177
+ ] }) });
2178
+ }, rt = {
2179
+ light: "#FFFFFF",
2180
+ dark: "#1F2937",
2181
+ // gray-800
2182
+ refLine: "#9CA3AF",
2183
+ // gray-400
2184
+ refLineLabel: "#6B7280"
2185
+ // gray-500
2186
+ }, le = ({
2187
+ data: e,
2188
+ xAxisKey: r,
2189
+ series: d,
2190
+ height: c = 400,
2191
+ width: f = "100%",
2192
+ title: i,
2193
+ subtitle: b,
2194
+ xAxis: n,
2195
+ yAxis: g,
2196
+ yAxisRight: m,
2197
+ grid: a = { show: !0 },
2198
+ legend: u = { show: !0, position: "bottom" },
2199
+ tooltip: F = { show: !0 },
2200
+ animate: x = !0,
2201
+ referenceLines: j,
2202
+ colors: R = M,
2203
+ barGap: A = 4,
2204
+ barCategoryGap: L = "20%",
2205
+ sx: y,
2206
+ ariaLabel: C
2207
+ }) => {
2208
+ const w = _t().palette.mode === "dark", T = !e || e.length === 0, O = w ? "dark" : "light", B = Q(() => d.map((p, $) => `composed-gradient-${p.key}-${$}`), [d]), H = (p, $) => {
2209
+ const E = p.color || R[$ % R.length] || P($), S = B[$], h = {
2210
+ key: p.key,
2211
+ name: p.name || p.key,
2212
+ dataKey: p.key,
2213
+ isAnimationActive: x,
2214
+ animationDuration: Y.duration,
2215
+ animationEasing: Y.easing,
2216
+ yAxisId: p.yAxisId || "left"
2217
+ };
2218
+ switch (p.type) {
2219
+ case "line":
2220
+ return /* @__PURE__ */ t(
2221
+ yt,
2222
+ {
2223
+ ...h,
2224
+ type: p.curve || "monotone",
2225
+ stroke: E,
2226
+ strokeWidth: p.strokeWidth || 2,
2227
+ dot: p.showDots !== !1 ? {
2228
+ fill: w ? rt.dark : rt.light,
2229
+ // @intentional-color: white/dark fill for mode contrast
2230
+ stroke: E,
2231
+ strokeWidth: 2,
2232
+ r: 4
2233
+ } : !1,
2234
+ activeDot: {
2235
+ r: 6,
2236
+ fill: E,
2237
+ stroke: w ? rt.dark : rt.light,
2238
+ // @intentional-color: white/dark stroke for mode contrast
2239
+ strokeWidth: 2
2240
+ },
2241
+ strokeDasharray: p.strokeDasharray
2242
+ }
2243
+ );
2244
+ case "bar":
2245
+ return /* @__PURE__ */ t(
2246
+ kt,
2247
+ {
2248
+ ...h,
2249
+ fill: E,
2250
+ radius: [4, 4, 0, 0],
2251
+ maxBarSize: p.maxBarSize || 40
2252
+ }
2253
+ );
2254
+ case "area":
2255
+ return /* @__PURE__ */ t(
2256
+ dt,
2257
+ {
2258
+ ...h,
2259
+ "aria-label": `${p.name || p.key} area series`,
2260
+ type: p.curve || "monotone",
2261
+ fill: `url(#${S})`,
2262
+ stroke: E,
2263
+ strokeWidth: p.strokeWidth || 2,
2264
+ fillOpacity: p.fillOpacity || 0.6
2265
+ }
2266
+ );
2267
+ default:
2268
+ return null;
2269
+ }
2270
+ };
2271
+ return /* @__PURE__ */ t(
2272
+ U,
2273
+ {
2274
+ title: i,
2275
+ subtitle: b,
2276
+ height: c,
2277
+ empty: T,
2278
+ sx: y,
2279
+ children: /* @__PURE__ */ t(Z, { width: f, height: c, children: /* @__PURE__ */ s(
2280
+ jt,
2281
+ {
2282
+ data: e,
2283
+ margin: {
2284
+ top: 10,
2285
+ right: m ? 20 : 10,
2286
+ left: 10,
2287
+ bottom: n?.angle ? 40 : 20
2288
+ },
2289
+ barGap: A,
2290
+ barCategoryGap: L,
2291
+ "aria-label": C || i || "Composed chart",
2292
+ children: [
2293
+ /* @__PURE__ */ t("defs", { children: d.filter((p) => p.type === "area").map((p, $) => {
2294
+ const E = d.findIndex((D) => D.key === p.key), S = p.color || R[E % R.length] || P(E), h = B[E];
2295
+ return /* @__PURE__ */ s(
2296
+ "linearGradient",
2297
+ {
2298
+ id: h,
2299
+ x1: "0",
2300
+ y1: "0",
2301
+ x2: "0",
2302
+ y2: "1",
2303
+ children: [
2304
+ /* @__PURE__ */ t(
2305
+ "stop",
2306
+ {
2307
+ offset: "5%",
2308
+ stopColor: S,
2309
+ stopOpacity: w ? 0.4 : 0.8
2310
+ }
2311
+ ),
2312
+ /* @__PURE__ */ t(
2313
+ "stop",
2314
+ {
2315
+ offset: "95%",
2316
+ stopColor: S,
2317
+ stopOpacity: w ? 0.05 : 0.1
2318
+ }
2319
+ )
2320
+ ]
2321
+ },
2322
+ h
2323
+ );
2324
+ }) }),
2325
+ a.show && /* @__PURE__ */ t(
2326
+ lt,
2327
+ {
2328
+ strokeDasharray: X.strokeDasharray,
2329
+ stroke: X[O].stroke,
2330
+ strokeOpacity: X[O].strokeOpacity,
2331
+ horizontal: a.horizontal !== !1,
2332
+ vertical: a.vertical !== !1
2333
+ }
2334
+ ),
2335
+ /* @__PURE__ */ t(
2336
+ at,
2337
+ {
2338
+ dataKey: r,
2339
+ axisLine: {
2340
+ stroke: v[O].lineColor,
2341
+ strokeOpacity: v[O].lineOpacity
2342
+ },
2343
+ tickLine: !1,
2344
+ tick: {
2345
+ fill: v[O].tickColor,
2346
+ fontSize: v.tickFontSize,
2347
+ fontFamily: o.fontFamily
2348
+ },
2349
+ label: n?.label ? {
2350
+ value: n.label,
2351
+ position: "bottom",
2352
+ offset: 0,
2353
+ style: {
2354
+ fill: v[O].tickColor,
2355
+ fontSize: v.labelFontSize,
2356
+ fontFamily: o.fontFamily
2357
+ }
2358
+ } : void 0,
2359
+ angle: n?.angle,
2360
+ textAnchor: n?.angle ? "end" : "middle",
2361
+ tickFormatter: n?.tickFormatter,
2362
+ interval: n?.interval
2363
+ }
2364
+ ),
2365
+ /* @__PURE__ */ t(
2366
+ et,
2367
+ {
2368
+ yAxisId: "left",
2369
+ axisLine: {
2370
+ stroke: v[O].lineColor,
2371
+ strokeOpacity: v[O].lineOpacity
2372
+ },
2373
+ tickLine: !1,
2374
+ tick: {
2375
+ fill: v[O].tickColor,
2376
+ fontSize: v.tickFontSize,
2377
+ fontFamily: o.fontFamily
2378
+ },
2379
+ label: g?.label ? {
2380
+ value: g.label,
2381
+ angle: -90,
2382
+ position: "insideLeft",
2383
+ style: {
2384
+ fill: v[O].tickColor,
2385
+ fontSize: v.labelFontSize,
2386
+ fontFamily: o.fontFamily,
2387
+ textAnchor: "middle"
2388
+ }
2389
+ } : void 0,
2390
+ tickFormatter: g?.tickFormatter,
2391
+ domain: g?.domain
2392
+ }
2393
+ ),
2394
+ m && /* @__PURE__ */ t(
2395
+ et,
2396
+ {
2397
+ yAxisId: "right",
2398
+ orientation: "right",
2399
+ axisLine: {
2400
+ stroke: v[O].lineColor,
2401
+ strokeOpacity: v[O].lineOpacity
2402
+ },
2403
+ tickLine: !1,
2404
+ tick: {
2405
+ fill: v[O].tickColor,
2406
+ fontSize: v.tickFontSize,
2407
+ fontFamily: o.fontFamily
2408
+ },
2409
+ label: m.label ? {
2410
+ value: m.label,
2411
+ angle: 90,
2412
+ position: "insideRight",
2413
+ style: {
2414
+ fill: v[O].tickColor,
2415
+ fontSize: v.labelFontSize,
2416
+ fontFamily: o.fontFamily,
2417
+ textAnchor: "middle"
2418
+ }
2419
+ } : void 0,
2420
+ tickFormatter: m.tickFormatter,
2421
+ domain: m.domain
2422
+ }
2423
+ ),
2424
+ j?.map((p, $) => /* @__PURE__ */ t(
2425
+ tt,
2426
+ {
2427
+ y: p.y,
2428
+ x: p.x,
2429
+ stroke: p.color || rt.refLine,
2430
+ strokeDasharray: p.strokeDasharray || "4 4",
2431
+ strokeWidth: p.strokeWidth || 1,
2432
+ yAxisId: p.yAxisId || "left",
2433
+ label: p.label ? {
2434
+ value: p.label,
2435
+ position: p.labelPosition || "right",
2436
+ fill: p.color || rt.refLineLabel,
2437
+ // @intentional-color: reference line label
2438
+ fontSize: 11,
2439
+ fontFamily: o.fontFamily
2440
+ } : void 0
2441
+ },
2442
+ $
2443
+ )),
2444
+ F.show && /* @__PURE__ */ t(
2445
+ nt,
2446
+ {
2447
+ content: /* @__PURE__ */ t(ht, {}),
2448
+ cursor: {
2449
+ fill: w ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)"
2450
+ }
2451
+ }
2452
+ ),
2453
+ u.show && /* @__PURE__ */ t(
2454
+ st,
2455
+ {
2456
+ content: /* @__PURE__ */ t(ct, {}),
2457
+ verticalAlign: u.position === "top" ? "top" : u.position === "bottom" ? "bottom" : "middle",
2458
+ align: u.position === "left" ? "left" : u.position === "right" ? "right" : "center"
2459
+ }
2460
+ ),
2461
+ d.map((p, $) => H(p, $))
2462
+ ]
2463
+ }
2464
+ ) })
2465
+ }
2466
+ );
2467
+ }, se = ({
2468
+ data: e,
2469
+ type: r = "line",
2470
+ width: d = 100,
2471
+ height: c = 32,
2472
+ color: f = M[0],
2473
+ referenceLine: i,
2474
+ referenceLineColor: b = ft.neutral,
2475
+ showMinMax: n = !1,
2476
+ minColor: g = ft.error,
2477
+ maxColor: m = ft.success,
2478
+ animate: a = !0,
2479
+ sx: u
2480
+ }) => {
2481
+ const F = Q(
2482
+ () => e.map((L, y) => ({ index: y, value: L })),
2483
+ [e]
2484
+ ), x = Q(() => {
2485
+ if (i === void 0) return null;
2486
+ if (typeof i == "number") return i;
2487
+ const L = e.filter((y) => y != null);
2488
+ if (L.length === 0) return null;
2489
+ if (i === "average")
2490
+ return L.reduce((y, C) => y + C, 0) / L.length;
2491
+ if (i === "median") {
2492
+ const y = [...L].sort((W, w) => W - w), C = Math.floor(y.length / 2);
2493
+ return y.length % 2 !== 0 ? y[C] : (y[C - 1] + y[C]) / 2;
2494
+ }
2495
+ return null;
2496
+ }, [e, i]), { minIndex: j, maxIndex: R } = Q(() => {
2497
+ if (!n || e.length === 0)
2498
+ return { minIndex: -1, maxIndex: -1 };
2499
+ let L = e[0], y = e[0], C = 0, W = 0;
2500
+ return e.forEach((w, T) => {
2501
+ w < L && (L = w, C = T), w > y && (y = w, W = T);
2502
+ }), { minIndex: C, maxIndex: W };
2503
+ }, [e, n]), A = {
2504
+ display: "inline-flex",
2505
+ alignItems: "center",
2506
+ ...u
2507
+ };
2508
+ return r === "line" ? /* @__PURE__ */ t(l, { sx: A, children: /* @__PURE__ */ t(Z, { width: d, height: c, children: /* @__PURE__ */ s(xt, { data: F, margin: { top: 2, right: 2, bottom: 2, left: 2 }, children: [
2509
+ x !== null && /* @__PURE__ */ t(
2510
+ tt,
2511
+ {
2512
+ y: x,
2513
+ stroke: b,
2514
+ strokeDasharray: "2 2",
2515
+ strokeWidth: 1
2516
+ }
2517
+ ),
2518
+ /* @__PURE__ */ t(
2519
+ yt,
2520
+ {
2521
+ type: "monotone",
2522
+ dataKey: "value",
2523
+ stroke: f,
2524
+ strokeWidth: 1.5,
2525
+ dot: n ? (L) => {
2526
+ const { cx: y, cy: C, index: W } = L;
2527
+ return W === j ? /* @__PURE__ */ t(
2528
+ "circle",
2529
+ {
2530
+ cx: y,
2531
+ cy: C,
2532
+ r: 3,
2533
+ fill: g,
2534
+ stroke: "#FFFFFF",
2535
+ strokeWidth: 1
2536
+ }
2537
+ ) : W === R ? /* @__PURE__ */ t(
2538
+ "circle",
2539
+ {
2540
+ cx: y,
2541
+ cy: C,
2542
+ r: 3,
2543
+ fill: m,
2544
+ stroke: "#FFFFFF",
2545
+ strokeWidth: 1
2546
+ }
2547
+ ) : null;
2548
+ } : !1,
2549
+ isAnimationActive: a,
2550
+ animationDuration: Y.duration
2551
+ }
2552
+ )
2553
+ ] }) }) }) : r === "bar" ? /* @__PURE__ */ t(l, { sx: A, children: /* @__PURE__ */ t(Z, { width: d, height: c, children: /* @__PURE__ */ s(vt, { data: F, margin: { top: 2, right: 2, bottom: 2, left: 2 }, children: [
2554
+ x !== null && /* @__PURE__ */ t(
2555
+ tt,
2556
+ {
2557
+ y: x,
2558
+ stroke: b,
2559
+ strokeDasharray: "2 2",
2560
+ strokeWidth: 1
2561
+ }
2562
+ ),
2563
+ /* @__PURE__ */ t(
2564
+ kt,
2565
+ {
2566
+ dataKey: "value",
2567
+ radius: [1, 1, 0, 0],
2568
+ isAnimationActive: a,
2569
+ animationDuration: Y.duration,
2570
+ children: F.map((L, y) => /* @__PURE__ */ t(
2571
+ gt,
2572
+ {
2573
+ fill: n && y === j ? g : n && y === R ? m : f
2574
+ },
2575
+ `cell-${y}`
2576
+ ))
2577
+ }
2578
+ )
2579
+ ] }) }) }) : /* @__PURE__ */ t(l, { sx: A, children: /* @__PURE__ */ t(Z, { width: d, height: c, children: /* @__PURE__ */ s(St, { data: F, margin: { top: 2, right: 2, bottom: 2, left: 2 }, children: [
2580
+ /* @__PURE__ */ t("defs", { children: /* @__PURE__ */ s("linearGradient", { id: "sparkline-gradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
2581
+ /* @__PURE__ */ t("stop", { offset: "5%", stopColor: f, stopOpacity: 0.3 }),
2582
+ /* @__PURE__ */ t("stop", { offset: "95%", stopColor: f, stopOpacity: 0 })
2583
+ ] }) }),
2584
+ x !== null && /* @__PURE__ */ t(
2585
+ tt,
2586
+ {
2587
+ y: x,
2588
+ stroke: b,
2589
+ strokeDasharray: "2 2",
2590
+ strokeWidth: 1
2591
+ }
2592
+ ),
2593
+ /* @__PURE__ */ t(
2594
+ dt,
2595
+ {
2596
+ type: "monotone",
2597
+ dataKey: "value",
2598
+ "aria-label": "Sparkline area data visualization",
2599
+ stroke: f,
2600
+ strokeWidth: 1.5,
2601
+ fill: "url(#sparkline-gradient)",
2602
+ dot: n ? (L) => {
2603
+ const { cx: y, cy: C, index: W } = L;
2604
+ return W === j ? /* @__PURE__ */ t(
2605
+ "circle",
2606
+ {
2607
+ cx: y,
2608
+ cy: C,
2609
+ r: 3,
2610
+ fill: g,
2611
+ stroke: "#FFFFFF",
2612
+ strokeWidth: 1
2613
+ }
2614
+ ) : W === R ? /* @__PURE__ */ t(
2615
+ "circle",
2616
+ {
2617
+ cx: y,
2618
+ cy: C,
2619
+ r: 3,
2620
+ fill: m,
2621
+ stroke: "#FFFFFF",
2622
+ strokeWidth: 1
2623
+ }
2624
+ ) : null;
2625
+ } : !1,
2626
+ isAnimationActive: a,
2627
+ animationDuration: Y.duration
2628
+ }
2629
+ )
2630
+ ] }) }) });
2631
+ };
2632
+ export {
2633
+ oe as A,
2634
+ ee as B,
2635
+ le as C,
2636
+ re as D,
2637
+ ne as G,
2638
+ Ut as I,
2639
+ te as L,
2640
+ Pt as P,
2641
+ ie as R,
2642
+ Xt as S,
2643
+ ae as a,
2644
+ se as b,
2645
+ U as c,
2646
+ ht as d,
2647
+ Qt as e,
2648
+ ct as f,
2649
+ mt as g
2650
+ };