@lunora/studio 0.0.0 → 1.0.0-alpha.1

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 (81) hide show
  1. package/LICENSE.md +105 -0
  2. package/README.md +123 -9
  3. package/__assets__/package-og.svg +14 -0
  4. package/dist/index.d.ts +1402 -0
  5. package/dist/index.js +41 -0
  6. package/dist/mount.d.ts +21 -0
  7. package/dist/mount.js +26 -0
  8. package/dist/packem_shared/ADMIN_FUNCTION_PREFIX-DmBqMZ-z.js +45 -0
  9. package/dist/packem_shared/ApiDocsPanel-DpRjJhG5.js +842 -0
  10. package/dist/packem_shared/ApiReferencePanel-DMIUp-kK.js +229 -0
  11. package/dist/packem_shared/ApiTab-DURGU15e.js +251 -0
  12. package/dist/packem_shared/AuditPanel-BC59Nhst.js +212 -0
  13. package/dist/packem_shared/CommandPalette-Dx_CoB9i.js +373 -0
  14. package/dist/packem_shared/ConfirmButton-WQVUoGFb.js +59 -0
  15. package/dist/packem_shared/ConnectionBadge-Bxagrip8.js +111 -0
  16. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +50 -0
  17. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +89 -0
  18. package/dist/packem_shared/DataBrowser-Coz6jJE6.js +4542 -0
  19. package/dist/packem_shared/DataFilters-FNquMaiu.js +249 -0
  20. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +66 -0
  21. package/dist/packem_shared/ExportImportPanel-WO34fJxy.js +193 -0
  22. package/dist/packem_shared/FileBrowser-Zcr-Qgxo.js +2932 -0
  23. package/dist/packem_shared/FunctionRunner-j0Rd5m9t.js +343 -0
  24. package/dist/packem_shared/FunctionStatsPanel-DboBl-XL.js +432 -0
  25. package/dist/packem_shared/GlobalDataBrowser-9MhPEfgN.js +318 -0
  26. package/dist/packem_shared/HealthPanel-DOIgbUtx.js +640 -0
  27. package/dist/packem_shared/HomePanel-bdOCNA-p.js +1273 -0
  28. package/dist/packem_shared/InsightsPanel-DaZPnSgt.js +423 -0
  29. package/dist/packem_shared/LogsPanel-CWdqAGpQ.js +839 -0
  30. package/dist/packem_shared/MailPanel-D_EGtDnS.js +447 -0
  31. package/dist/packem_shared/MetricsPanel-E4Gv6wTO.js +1625 -0
  32. package/dist/packem_shared/MigrationsPanel-DQdPY9io.js +246 -0
  33. package/dist/packem_shared/OpenRpcReferencePanel-j2p3HB0s.js +191 -0
  34. package/dist/packem_shared/PitrPanel-BbBkQR6t.js +252 -0
  35. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +3 -0
  36. package/dist/packem_shared/ScheduledJobs-Ok1CYYwI.js +159 -0
  37. package/dist/packem_shared/SchemaViewer-D8XGnp-X.js +2512 -0
  38. package/dist/packem_shared/SecurityAdvisorPanel-Cdm2IxLW.js +79 -0
  39. package/dist/packem_shared/SettingsPanel-D3WF2mBU.js +176 -0
  40. package/dist/packem_shared/ShardInput-DNCsT1KW.js +107 -0
  41. package/dist/packem_shared/SqlEditorPanel-BuQ7f2Hs.js +13 -0
  42. package/dist/packem_shared/Studio-D36od9Oz.js +33 -0
  43. package/dist/packem_shared/StudioApp-dvywkJ8I.js +383 -0
  44. package/dist/packem_shared/StudioI18nProvider-Dcajsznk.js +48 -0
  45. package/dist/packem_shared/TableEditor-DIVDk3vT.js +371 -0
  46. package/dist/packem_shared/advisor-view-DBlzJi6C.js +159 -0
  47. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +108 -0
  48. package/dist/packem_shared/app.d-CCmwDEVs.d.ts +300 -0
  49. package/dist/packem_shared/badge-B2PKA1-5.js +49 -0
  50. package/dist/packem_shared/bar-chart-CzJAgqkp.js +3245 -0
  51. package/dist/packem_shared/button-BhsN2uZH.js +49 -0
  52. package/dist/packem_shared/card-DURq3ElK.js +175 -0
  53. package/dist/packem_shared/cf-links-BZfRdxSE.js +8 -0
  54. package/dist/packem_shared/checkbox-UNkzAxl-.js +63 -0
  55. package/dist/packem_shared/createStudioI18n-CgvlmDkN.js +27 -0
  56. package/dist/packem_shared/data-grid-CCh2Couo.js +183 -0
  57. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +280 -0
  58. package/dist/packem_shared/empty-state-DY_oe0k6.js +98 -0
  59. package/dist/packem_shared/grid-features-DTjG6Sex.js +840 -0
  60. package/dist/packem_shared/input-XH4r1Pt1.js +53 -0
  61. package/dist/packem_shared/internal-BBZYexre.js +68 -0
  62. package/dist/packem_shared/label-D8ykjn5J.js +46 -0
  63. package/dist/packem_shared/live-status-bPff1O7Y.js +44 -0
  64. package/dist/packem_shared/reference-view-BCKIoai7.js +2180 -0
  65. package/dist/packem_shared/shard-history-DyebH1R5.js +38 -0
  66. package/dist/packem_shared/sparkline-10dG-_f0.js +93 -0
  67. package/dist/packem_shared/sql-editor-panel-CW2y2x9h.js +2562 -0
  68. package/dist/packem_shared/storage-tier-CL98eOvn.js +85 -0
  69. package/dist/packem_shared/studio-BDVd7rIV.js +10303 -0
  70. package/dist/packem_shared/table-_RzNvy3R.js +246 -0
  71. package/dist/packem_shared/table-list-sidebar-aZHLq70w.js +832 -0
  72. package/dist/packem_shared/textarea-D3gaCU_-.js +46 -0
  73. package/dist/packem_shared/use-live-admin-D1h1Fzsd.js +73 -0
  74. package/dist/packem_shared/use-live-shard-seed-B74RYcOy.js +76 -0
  75. package/dist/packem_shared/useDebounced-Dxncpg6z.js +32 -0
  76. package/dist/packem_shared/utils-B05Dmz_H.js +8 -0
  77. package/dist/packem_shared/virtual-rect-CVMUskSm.js +10 -0
  78. package/dist/standalone/studio.js +356 -0
  79. package/dist/styles.css +2 -0
  80. package/package.json +77 -17
  81. package/src/theme.css +59 -0
@@ -0,0 +1,3245 @@
1
+ 'use client';
2
+ import { c } from 'react/compiler-runtime';
3
+ import { useMotionValue, useSpring, useTransform, useMotionValueEvent, motion, useReducedMotion } from 'motion/react';
4
+ import * as React from 'react';
5
+ import { useId, useEffect, useState, use, createContext, useRef } from 'react';
6
+ import * as RechartsPrimitive from 'recharts';
7
+ import { ZIndexLayer, ResponsiveContainer, LineChart, Line, BarChart, Bar as Bar$1, AreaChart, Area, XAxis as XAxis$1, ReferenceLine, Rectangle } from 'recharts';
8
+ import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
9
+ import { c as cn } from './utils-B05Dmz_H.js';
10
+
11
+ const DotsPattern = (t0) => {
12
+ const $ = c(3);
13
+ const {
14
+ id
15
+ } = t0;
16
+ let t1;
17
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
18
+ t1 = /* @__PURE__ */ jsxDEV("circle", {
19
+ className: "text-border dark:text-border",
20
+ cx: "2",
21
+ cy: "2",
22
+ fill: "currentColor",
23
+ r: "1"
24
+ }, void 0, false);
25
+ $[0] = t1;
26
+ } else {
27
+ t1 = $[0];
28
+ }
29
+ let t2;
30
+ if ($[1] !== id) {
31
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
32
+ height: "20",
33
+ id,
34
+ patternUnits: "userSpaceOnUse",
35
+ width: "20",
36
+ x: "0",
37
+ y: "0",
38
+ children: t1
39
+ }, void 0, false);
40
+ $[1] = id;
41
+ $[2] = t2;
42
+ } else {
43
+ t2 = $[2];
44
+ }
45
+ return t2;
46
+ };
47
+ const GridPattern = (t0) => {
48
+ const $ = c(3);
49
+ const {
50
+ id
51
+ } = t0;
52
+ let t1;
53
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
54
+ t1 = /* @__PURE__ */ jsxDEV("path", {
55
+ className: "text-border dark:text-border",
56
+ d: "M 20 0 L 0 0 0 20",
57
+ fill: "none",
58
+ stroke: "currentColor",
59
+ strokeWidth: "0.5"
60
+ }, void 0, false);
61
+ $[0] = t1;
62
+ } else {
63
+ t1 = $[0];
64
+ }
65
+ let t2;
66
+ if ($[1] !== id) {
67
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
68
+ height: "20",
69
+ id,
70
+ patternUnits: "userSpaceOnUse",
71
+ width: "20",
72
+ x: "0",
73
+ y: "0",
74
+ children: t1
75
+ }, void 0, false);
76
+ $[1] = id;
77
+ $[2] = t2;
78
+ } else {
79
+ t2 = $[2];
80
+ }
81
+ return t2;
82
+ };
83
+ const CrossHatchPattern = (t0) => {
84
+ const $ = c(3);
85
+ const {
86
+ id
87
+ } = t0;
88
+ let t1;
89
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
90
+ t1 = /* @__PURE__ */ jsxDEV("path", {
91
+ className: "text-border/60 dark:text-border/50",
92
+ d: "M 0 0 L 20 20 M 20 0 L 0 20",
93
+ fill: "none",
94
+ stroke: "currentColor",
95
+ strokeWidth: "0.5"
96
+ }, void 0, false);
97
+ $[0] = t1;
98
+ } else {
99
+ t1 = $[0];
100
+ }
101
+ let t2;
102
+ if ($[1] !== id) {
103
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
104
+ height: "20",
105
+ id,
106
+ patternUnits: "userSpaceOnUse",
107
+ width: "20",
108
+ x: "0",
109
+ y: "0",
110
+ children: t1
111
+ }, void 0, false);
112
+ $[1] = id;
113
+ $[2] = t2;
114
+ } else {
115
+ t2 = $[2];
116
+ }
117
+ return t2;
118
+ };
119
+ const DiagonalLinesPattern = (t0) => {
120
+ const $ = c(3);
121
+ const {
122
+ id
123
+ } = t0;
124
+ let t1;
125
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
126
+ t1 = /* @__PURE__ */ jsxDEV("line", {
127
+ className: "text-border dark:text-border",
128
+ stroke: "currentColor",
129
+ strokeWidth: "0.5",
130
+ x1: "0",
131
+ x2: "0",
132
+ y1: "0",
133
+ y2: "6"
134
+ }, void 0, false);
135
+ $[0] = t1;
136
+ } else {
137
+ t1 = $[0];
138
+ }
139
+ let t2;
140
+ if ($[1] !== id) {
141
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
142
+ height: "6",
143
+ id,
144
+ patternTransform: "rotate(45)",
145
+ patternUnits: "userSpaceOnUse",
146
+ width: "6",
147
+ x: "0",
148
+ y: "0",
149
+ children: t1
150
+ }, void 0, false);
151
+ $[1] = id;
152
+ $[2] = t2;
153
+ } else {
154
+ t2 = $[2];
155
+ }
156
+ return t2;
157
+ };
158
+ const PlusPattern = (t0) => {
159
+ const $ = c(3);
160
+ const {
161
+ id
162
+ } = t0;
163
+ let t1;
164
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
165
+ t1 = /* @__PURE__ */ jsxDEV("path", {
166
+ className: "text-border dark:text-border",
167
+ d: "M 8 4 L 8 12 M 4 8 L 12 8",
168
+ fill: "none",
169
+ stroke: "currentColor",
170
+ strokeLinecap: "round",
171
+ strokeWidth: "0.5"
172
+ }, void 0, false);
173
+ $[0] = t1;
174
+ } else {
175
+ t1 = $[0];
176
+ }
177
+ let t2;
178
+ if ($[1] !== id) {
179
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
180
+ height: "16",
181
+ id,
182
+ patternUnits: "userSpaceOnUse",
183
+ width: "16",
184
+ x: "0",
185
+ y: "0",
186
+ children: t1
187
+ }, void 0, false);
188
+ $[1] = id;
189
+ $[2] = t2;
190
+ } else {
191
+ t2 = $[2];
192
+ }
193
+ return t2;
194
+ };
195
+ const FallingTrianglesPattern = (t0) => {
196
+ const $ = c(3);
197
+ const {
198
+ id
199
+ } = t0;
200
+ let t1;
201
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
202
+ t1 = /* @__PURE__ */ jsxDEV("path", {
203
+ className: "text-border dark:text-border",
204
+ d: "M2 6h12L8 18 2 6zm18 36h12l-6 12-6-12z",
205
+ fill: "currentColor",
206
+ fillOpacity: "0.4",
207
+ transform: "scale(0.5)"
208
+ }, void 0, false);
209
+ $[0] = t1;
210
+ } else {
211
+ t1 = $[0];
212
+ }
213
+ let t2;
214
+ if ($[1] !== id) {
215
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
216
+ height: "36",
217
+ id,
218
+ patternUnits: "userSpaceOnUse",
219
+ width: "18",
220
+ x: "0",
221
+ y: "0",
222
+ children: t1
223
+ }, void 0, false);
224
+ $[1] = id;
225
+ $[2] = t2;
226
+ } else {
227
+ t2 = $[2];
228
+ }
229
+ return t2;
230
+ };
231
+ const FourPointedStarPattern = (t0) => {
232
+ const $ = c(3);
233
+ const {
234
+ id
235
+ } = t0;
236
+ let t1;
237
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
238
+ t1 = /* @__PURE__ */ jsxDEV("polygon", {
239
+ className: "text-border dark:text-border",
240
+ fill: "currentColor",
241
+ fillOpacity: "0.4",
242
+ fillRule: "evenodd",
243
+ points: "5 3 8 4 5 5 4 8 3 5 0 4 3 3 4 0 5 3"
244
+ }, void 0, false);
245
+ $[0] = t1;
246
+ } else {
247
+ t1 = $[0];
248
+ }
249
+ let t2;
250
+ if ($[1] !== id) {
251
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
252
+ height: "16",
253
+ id,
254
+ patternUnits: "userSpaceOnUse",
255
+ width: "16",
256
+ x: "0",
257
+ y: "0",
258
+ children: t1
259
+ }, void 0, false);
260
+ $[1] = id;
261
+ $[2] = t2;
262
+ } else {
263
+ t2 = $[2];
264
+ }
265
+ return t2;
266
+ };
267
+ const TinyCheckersPattern = (t0) => {
268
+ const $ = c(3);
269
+ const {
270
+ id
271
+ } = t0;
272
+ let t1;
273
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
274
+ t1 = /* @__PURE__ */ jsxDEV("path", {
275
+ className: "text-border dark:text-border",
276
+ d: "M0 0h4v4H0V0zm4 4h4v4H4V4z",
277
+ fill: "currentColor",
278
+ fillOpacity: "0.2",
279
+ fillRule: "evenodd"
280
+ }, void 0, false);
281
+ $[0] = t1;
282
+ } else {
283
+ t1 = $[0];
284
+ }
285
+ let t2;
286
+ if ($[1] !== id) {
287
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
288
+ height: "8",
289
+ id,
290
+ patternUnits: "userSpaceOnUse",
291
+ width: "8",
292
+ x: "0",
293
+ y: "0",
294
+ children: t1
295
+ }, void 0, false);
296
+ $[1] = id;
297
+ $[2] = t2;
298
+ } else {
299
+ t2 = $[2];
300
+ }
301
+ return t2;
302
+ };
303
+ const OverlappingCirclesPattern = (t0) => {
304
+ const $ = c(3);
305
+ const {
306
+ id
307
+ } = t0;
308
+ let t1;
309
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
310
+ t1 = /* @__PURE__ */ jsxDEV("path", {
311
+ className: "text-border dark:text-border",
312
+ d: "M25 25c0-2.762 2.238-5 5-5s5 2.238 5 5-2.238 5-5 5c0 2.762-2.238 5-5 5s-5-2.238-5-5 2.238-5 5-5zM5 5c0-2.762 2.238-5 5-5s5 2.238 5 5-2.238 5-5 5c0 2.762-2.238 5-5 5S0 12.762 0 10s2.238-5 5-5zm5 4c2.209 0 4-1.791 4-4s-1.791-4-4-4-4 1.791-4 4 1.791 4 4 4zm20 20c2.209 0 4-1.791 4-4s-1.791-4-4-4-4 1.791-4 4 1.791 4 4 4z",
313
+ fill: "currentColor",
314
+ fillOpacity: "0.4",
315
+ fillRule: "evenodd"
316
+ }, void 0, false);
317
+ $[0] = t1;
318
+ } else {
319
+ t1 = $[0];
320
+ }
321
+ let t2;
322
+ if ($[1] !== id) {
323
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
324
+ height: "40",
325
+ id,
326
+ patternUnits: "userSpaceOnUse",
327
+ width: "40",
328
+ x: "0",
329
+ y: "0",
330
+ children: t1
331
+ }, void 0, false);
332
+ $[1] = id;
333
+ $[2] = t2;
334
+ } else {
335
+ t2 = $[2];
336
+ }
337
+ return t2;
338
+ };
339
+ const WiggleLinesPattern = (t0) => {
340
+ const $ = c(3);
341
+ const {
342
+ id
343
+ } = t0;
344
+ let t1;
345
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
346
+ t1 = /* @__PURE__ */ jsxDEV("path", {
347
+ className: "text-border dark:text-border",
348
+ d: "M10 10c0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6h2c0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4v2c-3.314 0-6-2.686-6-6 0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6zm25.464-1.95l8.486 8.486-1.414 1.414-8.486-8.486 1.414-1.414z",
349
+ fill: "currentColor",
350
+ fillOpacity: "0.4"
351
+ }, void 0, false);
352
+ $[0] = t1;
353
+ } else {
354
+ t1 = $[0];
355
+ }
356
+ let t2;
357
+ if ($[1] !== id) {
358
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
359
+ height: "26",
360
+ id,
361
+ patternTransform: "scale(0.6)",
362
+ patternUnits: "userSpaceOnUse",
363
+ width: "52",
364
+ x: "0",
365
+ y: "0",
366
+ children: t1
367
+ }, void 0, false);
368
+ $[1] = id;
369
+ $[2] = t2;
370
+ } else {
371
+ t2 = $[2];
372
+ }
373
+ return t2;
374
+ };
375
+ const BubblesPattern = (t0) => {
376
+ const $ = c(3);
377
+ const {
378
+ id
379
+ } = t0;
380
+ let t1;
381
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
382
+ t1 = /* @__PURE__ */ jsxDEV("path", {
383
+ className: "text-border dark:text-border",
384
+ d: "M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z",
385
+ fill: "currentColor",
386
+ fillOpacity: "0.4",
387
+ fillRule: "evenodd"
388
+ }, void 0, false);
389
+ $[0] = t1;
390
+ } else {
391
+ t1 = $[0];
392
+ }
393
+ let t2;
394
+ if ($[1] !== id) {
395
+ t2 = /* @__PURE__ */ jsxDEV("pattern", {
396
+ height: "100",
397
+ id,
398
+ patternTransform: "scale(0.6667)",
399
+ patternUnits: "userSpaceOnUse",
400
+ width: "100",
401
+ x: "0",
402
+ y: "0",
403
+ children: t1
404
+ }, void 0, false);
405
+ $[1] = id;
406
+ $[2] = t2;
407
+ } else {
408
+ t2 = $[2];
409
+ }
410
+ return t2;
411
+ };
412
+ const PATTERN_MAP = {
413
+ dots: DotsPattern,
414
+ grid: GridPattern,
415
+ plus: PlusPattern,
416
+ bubbles: BubblesPattern,
417
+ "cross-hatch": CrossHatchPattern,
418
+ "diagonal-lines": DiagonalLinesPattern,
419
+ "falling-triangles": FallingTrianglesPattern,
420
+ "4-pointed-star": FourPointedStarPattern,
421
+ "tiny-checkers": TinyCheckersPattern,
422
+ "overlapping-circles": OverlappingCirclesPattern,
423
+ "wiggle-lines": WiggleLinesPattern
424
+ };
425
+ const ChartBackground = (t0) => {
426
+ const $ = c(23);
427
+ const {
428
+ variant
429
+ } = t0;
430
+ const t1 = useId();
431
+ let t2;
432
+ if ($[0] !== t1) {
433
+ t2 = t1.replaceAll(":", "");
434
+ $[0] = t1;
435
+ $[1] = t2;
436
+ } else {
437
+ t2 = $[1];
438
+ }
439
+ const baseId = t2;
440
+ const patternId = `${baseId}-bg-${variant}`;
441
+ const maskId = `${baseId}-bg-edge-fade`;
442
+ const filterId = `${baseId}-bg-blur`;
443
+ const PatternComponent = PATTERN_MAP[variant];
444
+ let t3;
445
+ if ($[2] !== PatternComponent || $[3] !== patternId) {
446
+ t3 = /* @__PURE__ */ jsxDEV(PatternComponent, {
447
+ id: patternId
448
+ }, void 0, false);
449
+ $[2] = PatternComponent;
450
+ $[3] = patternId;
451
+ $[4] = t3;
452
+ } else {
453
+ t3 = $[4];
454
+ }
455
+ let t4;
456
+ if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
457
+ t4 = /* @__PURE__ */ jsxDEV("feGaussianBlur", {
458
+ stdDeviation: "25"
459
+ }, void 0, false);
460
+ $[5] = t4;
461
+ } else {
462
+ t4 = $[5];
463
+ }
464
+ let t5;
465
+ if ($[6] !== filterId) {
466
+ t5 = /* @__PURE__ */ jsxDEV("filter", {
467
+ id: filterId,
468
+ children: t4
469
+ }, void 0, false);
470
+ $[6] = filterId;
471
+ $[7] = t5;
472
+ } else {
473
+ t5 = $[7];
474
+ }
475
+ const t6 = `url(#${filterId})`;
476
+ let t7;
477
+ if ($[8] !== t6) {
478
+ t7 = /* @__PURE__ */ jsxDEV("rect", {
479
+ fill: "white",
480
+ filter: t6,
481
+ height: "60%",
482
+ width: "85%",
483
+ x: "8%",
484
+ y: "20%"
485
+ }, void 0, false);
486
+ $[8] = t6;
487
+ $[9] = t7;
488
+ } else {
489
+ t7 = $[9];
490
+ }
491
+ let t8;
492
+ if ($[10] !== maskId || $[11] !== t7) {
493
+ t8 = /* @__PURE__ */ jsxDEV("mask", {
494
+ id: maskId,
495
+ maskUnits: "userSpaceOnUse",
496
+ children: t7
497
+ }, void 0, false);
498
+ $[10] = maskId;
499
+ $[11] = t7;
500
+ $[12] = t8;
501
+ } else {
502
+ t8 = $[12];
503
+ }
504
+ let t9;
505
+ if ($[13] !== t3 || $[14] !== t5 || $[15] !== t8) {
506
+ t9 = /* @__PURE__ */ jsxDEV("defs", {
507
+ children: [t3, t5, t8]
508
+ }, void 0, true);
509
+ $[13] = t3;
510
+ $[14] = t5;
511
+ $[15] = t8;
512
+ $[16] = t9;
513
+ } else {
514
+ t9 = $[16];
515
+ }
516
+ const t10 = `url(#${patternId})`;
517
+ const t11 = `url(#${maskId})`;
518
+ let t12;
519
+ if ($[17] !== t10 || $[18] !== t11) {
520
+ t12 = /* @__PURE__ */ jsxDEV("rect", {
521
+ fill: t10,
522
+ height: "100%",
523
+ mask: t11,
524
+ width: "100%"
525
+ }, void 0, false);
526
+ $[17] = t10;
527
+ $[18] = t11;
528
+ $[19] = t12;
529
+ } else {
530
+ t12 = $[19];
531
+ }
532
+ let t13;
533
+ if ($[20] !== t12 || $[21] !== t9) {
534
+ t13 = /* @__PURE__ */ jsxDEV(ZIndexLayer, {
535
+ zIndex: -1,
536
+ children: [t9, t12]
537
+ }, void 0, true);
538
+ $[20] = t12;
539
+ $[21] = t9;
540
+ $[22] = t13;
541
+ } else {
542
+ t13 = $[22];
543
+ }
544
+ return t13;
545
+ };
546
+
547
+ const THEMES = {
548
+ light: "",
549
+ dark: ".dark"
550
+ };
551
+ const VALID_THEME_KEYS = Object.keys(THEMES);
552
+ function validateChartConfigColors(config) {
553
+ for (const [key, value] of Object.entries(config)) {
554
+ if (value.colors) {
555
+ const hasValidThemeKey = VALID_THEME_KEYS.some((themeKey) => value.colors?.[themeKey] !== void 0);
556
+ if (!hasValidThemeKey) {
557
+ throw new Error(`[EvilCharts] Invalid chart config for "${key}": colors object must have at least one theme key (${VALID_THEME_KEYS.join(", ")}). Received empty object or invalid keys.`);
558
+ }
559
+ }
560
+ }
561
+ }
562
+ const ChartContext = /* @__PURE__ */ React.createContext(null);
563
+ function useChart() {
564
+ const context = React.useContext(ChartContext);
565
+ if (!context) {
566
+ throw new Error("useChart must be used within a <ChartContainer />");
567
+ }
568
+ return context;
569
+ }
570
+ const ChartContainer = ({
571
+ id,
572
+ config,
573
+ initialDimension = {
574
+ width: 320,
575
+ height: 200
576
+ },
577
+ className,
578
+ children,
579
+ footer,
580
+ ...props
581
+ }) => {
582
+ const uniqueId = React.useId();
583
+ const chartId = `chart-${id ?? uniqueId.replaceAll(":", "")}`;
584
+ validateChartConfigColors(config);
585
+ return /* @__PURE__ */ jsxDEV(ChartContext.Provider, {
586
+ value: {
587
+ config
588
+ },
589
+ children: /* @__PURE__ */ jsxDEV("div", {
590
+ className: cn("min-h-0 w-full flex-1", "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-axis-tick_text]:font-mono [&_.recharts-cartesian-axis-tick_text]:text-[11px] [&_.recharts-cartesian-axis-tick_text]:tracking-wide [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border relative flex flex-col justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", !footer && "aspect-video", className),
591
+ "data-chart": chartId,
592
+ "data-slot": "chart",
593
+ ...props,
594
+ children: [/* @__PURE__ */ jsxDEV(ChartStyle, {
595
+ config,
596
+ id: chartId
597
+ }, void 0, false), /* @__PURE__ */ jsxDEV(RechartsPrimitive.ResponsiveContainer, {
598
+ className: "min-h-0 w-full flex-1",
599
+ initialDimension,
600
+ children
601
+ }, void 0, false), footer]
602
+ }, void 0, true)
603
+ }, void 0, false);
604
+ };
605
+ const LoadingIndicator = (t0) => {
606
+ const $ = c(1);
607
+ const {
608
+ isLoading
609
+ } = t0;
610
+ if (!isLoading) {
611
+ return null;
612
+ }
613
+ let t1;
614
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
615
+ t1 = /* @__PURE__ */ jsxDEV("div", {
616
+ className: "pointer-events-none absolute inset-0 z-20 flex items-center justify-center",
617
+ children: /* @__PURE__ */ jsxDEV("div", {
618
+ className: "text-primary bg-background flex items-center justify-center gap-2 rounded-md border px-2 py-0.5 text-sm",
619
+ children: [/* @__PURE__ */ jsxDEV("div", {
620
+ className: "border-border border-t-primary h-3 w-3 animate-spin rounded-full border"
621
+ }, void 0, false), /* @__PURE__ */ jsxDEV("span", {
622
+ children: "Loading"
623
+ }, void 0, false)]
624
+ }, void 0, true)
625
+ }, void 0, false);
626
+ $[0] = t1;
627
+ } else {
628
+ t1 = $[0];
629
+ }
630
+ return t1;
631
+ };
632
+ function distributeColors(colorsArray, maxCount) {
633
+ const availableCount = colorsArray.length;
634
+ if (availableCount >= maxCount) {
635
+ return colorsArray.slice(0, maxCount);
636
+ }
637
+ const result = [];
638
+ const baseSlots = Math.floor(maxCount / availableCount);
639
+ const extraSlots = maxCount % availableCount;
640
+ for (let colorIndex = 0; colorIndex < availableCount; colorIndex++) {
641
+ const isExtraColor = colorIndex >= availableCount - extraSlots;
642
+ const slotsForThisColor = baseSlots + (isExtraColor ? 1 : 0);
643
+ for (let j = 0; j < slotsForThisColor; j++) {
644
+ result.push(colorsArray[colorIndex]);
645
+ }
646
+ }
647
+ return result;
648
+ }
649
+ const ChartStyle = (t0) => {
650
+ const $ = c(6);
651
+ const {
652
+ id,
653
+ config
654
+ } = t0;
655
+ let t1;
656
+ let t2;
657
+ if ($[0] !== config || $[1] !== id) {
658
+ t2 = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
659
+ bb0: {
660
+ const colorConfig = Object.entries(config).filter(_temp$1);
661
+ if (colorConfig.length === 0) {
662
+ t2 = null;
663
+ break bb0;
664
+ }
665
+ const generateCssVariables = (theme) => colorConfig.flatMap((t32) => {
666
+ const [key, itemConfig] = t32;
667
+ const colorsArray = itemConfig.colors?.[theme];
668
+ if (!colorsArray || !Array.isArray(colorsArray) || colorsArray.length === 0) {
669
+ return [];
670
+ }
671
+ const maxCount = getColorsCount(itemConfig);
672
+ const distributedColors = distributeColors(colorsArray, maxCount);
673
+ return distributedColors.map((color, index) => ` --color-${key}-${index}: ${color};`);
674
+ }).filter(Boolean).join("\n");
675
+ t1 = Object.entries(THEMES).map((t4) => {
676
+ const [theme_0, prefix] = t4;
677
+ return `${prefix} [data-chart=${id}] {
678
+ ${generateCssVariables(theme_0)}
679
+ }`;
680
+ });
681
+ }
682
+ $[0] = config;
683
+ $[1] = id;
684
+ $[2] = t1;
685
+ $[3] = t2;
686
+ } else {
687
+ t1 = $[2];
688
+ t2 = $[3];
689
+ }
690
+ if (t2 !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel")) {
691
+ return t2;
692
+ }
693
+ const css = t1.join("\n");
694
+ let t3;
695
+ if ($[4] !== css) {
696
+ t3 = /* @__PURE__ */ jsxDEV("style", {
697
+ dangerouslySetInnerHTML: {
698
+ __html: css
699
+ }
700
+ }, void 0, false);
701
+ $[4] = css;
702
+ $[5] = t3;
703
+ } else {
704
+ t3 = $[5];
705
+ }
706
+ return t3;
707
+ };
708
+ function getPayloadConfigFromPayload(config, payload, key) {
709
+ if (typeof payload !== "object" || payload === null) {
710
+ return void 0;
711
+ }
712
+ const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
713
+ let configLabelKey = key;
714
+ if (key in payload && typeof payload[key] === "string") {
715
+ configLabelKey = payload[key];
716
+ } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
717
+ configLabelKey = payloadPayload[key];
718
+ }
719
+ return configLabelKey in config ? config[configLabelKey] : config[key];
720
+ }
721
+ function getColorsCount(config) {
722
+ if (!config.colors) {
723
+ return 1;
724
+ }
725
+ const counts = VALID_THEME_KEYS.map((theme) => config.colors?.[theme]?.length ?? 0);
726
+ return Math.max(...counts, 1);
727
+ }
728
+ const getLoadingData = (points = 10, min = 0, max = 70) => {
729
+ const range = max - min;
730
+ return Array.from({
731
+ length: points
732
+ }, () => {
733
+ return {
734
+ loading: Math.floor(Math.random() * range) + min
735
+ };
736
+ });
737
+ };
738
+ function _temp$1(t0) {
739
+ const [, config_0] = t0;
740
+ return config_0.colors;
741
+ }
742
+
743
+ const SPRING_CONFIG = {
744
+ stiffness: 300,
745
+ damping: 35,
746
+ mass: 0.8
747
+ };
748
+ function useBrushDrag(t0) {
749
+ const $ = c(16);
750
+ const {
751
+ range,
752
+ totalPoints,
753
+ containerRef,
754
+ commit
755
+ } = t0;
756
+ const dragRef = React.useRef(null);
757
+ const [isDragging, setIsDragging] = React.useState(false);
758
+ let t1;
759
+ if ($[0] !== containerRef || $[1] !== totalPoints) {
760
+ t1 = (px) => {
761
+ if (!containerRef.current || totalPoints <= 1) {
762
+ return 0;
763
+ }
764
+ return Math.round(px / containerRef.current.getBoundingClientRect().width * (totalPoints - 1));
765
+ };
766
+ $[0] = containerRef;
767
+ $[1] = totalPoints;
768
+ $[2] = t1;
769
+ } else {
770
+ t1 = $[2];
771
+ }
772
+ const toIndexDelta = t1;
773
+ let t2;
774
+ if ($[3] !== range) {
775
+ t2 = (e, type) => {
776
+ e.preventDefault();
777
+ e.target.setPointerCapture(e.pointerId);
778
+ dragRef.current = {
779
+ type,
780
+ originX: e.clientX,
781
+ originRange: {
782
+ ...range
783
+ }
784
+ };
785
+ setIsDragging(true);
786
+ };
787
+ $[3] = range;
788
+ $[4] = t2;
789
+ } else {
790
+ t2 = $[4];
791
+ }
792
+ const onPointerDown = t2;
793
+ let t3;
794
+ if ($[5] !== commit || $[6] !== toIndexDelta || $[7] !== totalPoints) {
795
+ t3 = (e_0) => {
796
+ const d = dragRef.current;
797
+ if (!d) {
798
+ return;
799
+ }
800
+ const delta = toIndexDelta(e_0.clientX - d.originX);
801
+ const {
802
+ type: type_0,
803
+ originRange: o
804
+ } = d;
805
+ if (type_0 === "left") {
806
+ commit({
807
+ startIndex: o.startIndex + delta,
808
+ endIndex: o.endIndex
809
+ }, "left");
810
+ } else {
811
+ if (type_0 === "right") {
812
+ commit({
813
+ startIndex: o.startIndex,
814
+ endIndex: o.endIndex + delta
815
+ }, "right");
816
+ } else {
817
+ const span = o.endIndex - o.startIndex;
818
+ let s = o.startIndex + delta;
819
+ let e2 = s + span;
820
+ if (s < 0) {
821
+ s = 0;
822
+ e2 = span;
823
+ }
824
+ if (e2 > totalPoints - 1) {
825
+ e2 = totalPoints - 1;
826
+ s = Math.max(0, e2 - span);
827
+ }
828
+ commit({
829
+ startIndex: s,
830
+ endIndex: e2
831
+ }, "middle");
832
+ }
833
+ }
834
+ };
835
+ $[5] = commit;
836
+ $[6] = toIndexDelta;
837
+ $[7] = totalPoints;
838
+ $[8] = t3;
839
+ } else {
840
+ t3 = $[8];
841
+ }
842
+ const onPointerMove = t3;
843
+ let t4;
844
+ if ($[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
845
+ t4 = (e_1) => {
846
+ e_1.target.releasePointerCapture(e_1.pointerId);
847
+ dragRef.current = null;
848
+ setIsDragging(false);
849
+ };
850
+ $[9] = t4;
851
+ } else {
852
+ t4 = $[9];
853
+ }
854
+ const onPointerUp = t4;
855
+ let t5;
856
+ if ($[10] !== onPointerDown || $[11] !== onPointerMove) {
857
+ t5 = (type_1) => ({
858
+ onPointerDown: (e_2) => {
859
+ onPointerDown(e_2, type_1);
860
+ },
861
+ onPointerMove,
862
+ onPointerUp
863
+ });
864
+ $[10] = onPointerDown;
865
+ $[11] = onPointerMove;
866
+ $[12] = t5;
867
+ } else {
868
+ t5 = $[12];
869
+ }
870
+ const bind = t5;
871
+ let t6;
872
+ if ($[13] !== bind || $[14] !== isDragging) {
873
+ t6 = {
874
+ isDragging,
875
+ bind
876
+ };
877
+ $[13] = bind;
878
+ $[14] = isDragging;
879
+ $[15] = t6;
880
+ } else {
881
+ t6 = $[15];
882
+ }
883
+ return t6;
884
+ }
885
+ const EvilBrush = ({
886
+ data,
887
+ chartConfig,
888
+ dataKeys,
889
+ xDataKey,
890
+ variant = "area",
891
+ height = 56,
892
+ className,
893
+ stacked = false,
894
+ strokeVariant = "solid",
895
+ connectNulls = false,
896
+ barRadius,
897
+ startIndex: controlledStart,
898
+ endIndex: controlledEnd,
899
+ defaultStartIndex = 0,
900
+ defaultEndIndex,
901
+ onChange,
902
+ formatLabel,
903
+ curveType = "monotone",
904
+ minSpan = 2,
905
+ showLabels = true,
906
+ skipStyle = false
907
+ }) => {
908
+ const containerRef = React.useRef(null);
909
+ const keys = dataKeys ?? Object.keys(chartConfig);
910
+ const totalPoints = data.length;
911
+ const chartId = React.useId().replaceAll(":", "");
912
+ const isControlled = controlledStart !== void 0 && controlledEnd !== void 0;
913
+ const [internalRange, setInternalRange] = React.useState(() => {
914
+ return {
915
+ startIndex: Math.max(0, Math.min(defaultStartIndex, totalPoints - 1)),
916
+ endIndex: Math.max(0, Math.min(defaultEndIndex ?? totalPoints - 1, totalPoints - 1))
917
+ };
918
+ });
919
+ const lastCommittedRef = React.useRef(internalRange);
920
+ useEffect(() => {
921
+ if (!isControlled) {
922
+ setInternalRange((previous) => {
923
+ const adjusted = {
924
+ startIndex: Math.min(previous.startIndex, Math.max(0, totalPoints - 1)),
925
+ endIndex: Math.min(previous.endIndex, Math.max(0, totalPoints - 1))
926
+ };
927
+ lastCommittedRef.current = adjusted;
928
+ return adjusted;
929
+ });
930
+ }
931
+ }, [totalPoints, isControlled]);
932
+ const clampRange = (range, mode) => {
933
+ let {
934
+ startIndex,
935
+ endIndex
936
+ } = range;
937
+ const maxIndex = Math.max(0, totalPoints - 1);
938
+ startIndex = Math.max(0, Math.min(startIndex, maxIndex));
939
+ endIndex = Math.max(0, Math.min(endIndex, maxIndex));
940
+ if (mode === "left") {
941
+ const maxStart = Math.max(0, endIndex - minSpan);
942
+ startIndex = Math.min(startIndex, maxStart);
943
+ return {
944
+ startIndex,
945
+ endIndex
946
+ };
947
+ }
948
+ if (mode === "right") {
949
+ const minEnd = Math.min(maxIndex, startIndex + minSpan);
950
+ endIndex = Math.max(endIndex, minEnd);
951
+ return {
952
+ startIndex,
953
+ endIndex
954
+ };
955
+ }
956
+ if (endIndex - startIndex < minSpan) {
957
+ endIndex = Math.min(startIndex + minSpan, maxIndex);
958
+ if (endIndex - startIndex < minSpan) {
959
+ startIndex = Math.max(0, endIndex - minSpan);
960
+ }
961
+ }
962
+ return {
963
+ startIndex,
964
+ endIndex
965
+ };
966
+ };
967
+ const commit = (next, mode_0) => {
968
+ const clamped = clampRange(next, mode_0);
969
+ const last = lastCommittedRef.current;
970
+ if (last.startIndex === clamped.startIndex && last.endIndex === clamped.endIndex) {
971
+ return;
972
+ }
973
+ lastCommittedRef.current = clamped;
974
+ setInternalRange(clamped);
975
+ React.startTransition(() => {
976
+ onChange?.(clamped);
977
+ });
978
+ };
979
+ const {
980
+ isDragging,
981
+ bind
982
+ } = useBrushDrag({
983
+ range: internalRange,
984
+ totalPoints,
985
+ containerRef,
986
+ commit
987
+ });
988
+ const range_0 = internalRange;
989
+ useEffect(() => {
990
+ if (isControlled && !isDragging) {
991
+ const syncedRange = {
992
+ startIndex: controlledStart,
993
+ endIndex: controlledEnd
994
+ };
995
+ setInternalRange(syncedRange);
996
+ lastCommittedRef.current = syncedRange;
997
+ }
998
+ }, [isControlled, controlledStart, controlledEnd, isDragging]);
999
+ const leftPct = totalPoints > 1 ? range_0.startIndex / (totalPoints - 1) * 100 : 0;
1000
+ const rightPct = totalPoints > 1 ? range_0.endIndex / (totalPoints - 1) * 100 : 100;
1001
+ const leftTarget = useMotionValue(leftPct);
1002
+ const rightTarget = useMotionValue(rightPct);
1003
+ if (leftTarget.get() !== leftPct) {
1004
+ leftTarget.set(leftPct);
1005
+ }
1006
+ if (rightTarget.get() !== rightPct) {
1007
+ rightTarget.set(rightPct);
1008
+ }
1009
+ const leftSpring = useSpring(leftTarget, SPRING_CONFIG);
1010
+ const rightSpring = useSpring(rightTarget, SPRING_CONFIG);
1011
+ const leftPosition = useTransform(leftSpring, (v) => `${v}%`);
1012
+ const rightPosition = useTransform(rightSpring, (v_0) => `${v_0}%`);
1013
+ const leftOverlayWidth = useTransform(leftSpring, (v_1) => `${v_1}%`);
1014
+ const rightOverlayWidth = useTransform(rightSpring, (v_2) => `${Math.max(0, 100 - v_2)}%`);
1015
+ const selectedWidth = useMotionValue(`${Math.max(0, rightPct - leftPct)}%`);
1016
+ const updateSelectedWidth = () => {
1017
+ selectedWidth.set(`${Math.max(0, rightSpring.get() - leftSpring.get())}%`);
1018
+ };
1019
+ useMotionValueEvent(leftSpring, "change", updateSelectedWidth);
1020
+ useMotionValueEvent(rightSpring, "change", updateSelectedWidth);
1021
+ const getLabel = (index) => {
1022
+ if (!xDataKey) {
1023
+ return String(index);
1024
+ }
1025
+ const v_3 = data[index]?.[xDataKey];
1026
+ return formatLabel ? formatLabel(v_3, index) : String(v_3 ?? index);
1027
+ };
1028
+ if (totalPoints === 0) {
1029
+ return null;
1030
+ }
1031
+ return /* @__PURE__ */ jsxDEV("div", {
1032
+ className: cn("group relative select-none", className),
1033
+ "data-chart": skipStyle ? void 0 : chartId,
1034
+ ref: containerRef,
1035
+ style: {
1036
+ height
1037
+ },
1038
+ children: [!skipStyle && /* @__PURE__ */ jsxDEV(ChartStyle, {
1039
+ config: chartConfig,
1040
+ id: chartId
1041
+ }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
1042
+ className: "absolute inset-0 overflow-hidden rounded-md",
1043
+ children: /* @__PURE__ */ jsxDEV(MiniChart, {
1044
+ barRadius,
1045
+ chartConfig,
1046
+ chartId,
1047
+ connectNulls,
1048
+ curveType,
1049
+ data,
1050
+ keys,
1051
+ stacked,
1052
+ strokeVariant: strokeVariant === "animated-dashed" ? "dashed" : strokeVariant,
1053
+ variant
1054
+ }, void 0, false)
1055
+ }, void 0, false), /* @__PURE__ */ jsxDEV(motion.div, {
1056
+ className: "bg-background pointer-events-none absolute inset-y-0 start-0 rounded-s-md",
1057
+ style: {
1058
+ width: leftOverlayWidth
1059
+ }
1060
+ }, void 0, false), /* @__PURE__ */ jsxDEV(motion.div, {
1061
+ className: "bg-background pointer-events-none absolute inset-y-0 end-0 rounded-e-md",
1062
+ style: {
1063
+ width: rightOverlayWidth
1064
+ }
1065
+ }, void 0, false), /* @__PURE__ */ jsxDEV(motion.div, {
1066
+ className: "absolute inset-y-0 cursor-grab touch-none rounded-sm border active:cursor-grabbing",
1067
+ style: {
1068
+ left: leftPosition,
1069
+ width: selectedWidth
1070
+ },
1071
+ ...bind("middle")
1072
+ }, void 0, false), /* @__PURE__ */ jsxDEV(BrushHandle, {
1073
+ bind: bind("left"),
1074
+ label: showLabels ? getLabel(range_0.startIndex) : void 0,
1075
+ position: leftPosition,
1076
+ side: "left"
1077
+ }, void 0, false), /* @__PURE__ */ jsxDEV(BrushHandle, {
1078
+ bind: bind("right"),
1079
+ label: showLabels ? getLabel(range_0.endIndex) : void 0,
1080
+ position: rightPosition,
1081
+ side: "right"
1082
+ }, void 0, false)]
1083
+ }, void 0, true);
1084
+ };
1085
+ const BrushHandle = (t0) => {
1086
+ const $ = c(20);
1087
+ const {
1088
+ side,
1089
+ position,
1090
+ label,
1091
+ bind
1092
+ } = t0;
1093
+ const isLeft = side === "left";
1094
+ let t1;
1095
+ if ($[0] !== position) {
1096
+ t1 = {
1097
+ left: position
1098
+ };
1099
+ $[0] = position;
1100
+ $[1] = t1;
1101
+ } else {
1102
+ t1 = $[1];
1103
+ }
1104
+ const t2 = isLeft ? "" : "-translate-x-full rtl:translate-x-full";
1105
+ let t3;
1106
+ if ($[2] !== t2) {
1107
+ t3 = cn("group absolute inset-y-0 flex w-3 cursor-ew-resize touch-none items-center justify-center after:absolute after:inset-y-0 after:-start-4 after:w-11 after:content-['']", t2);
1108
+ $[2] = t2;
1109
+ $[3] = t3;
1110
+ } else {
1111
+ t3 = $[3];
1112
+ }
1113
+ const t4 = isLeft ? "-start-[5.5px]" : "-end-[5.5px]";
1114
+ let t5;
1115
+ if ($[4] !== t4) {
1116
+ t5 = cn("bg-muted-foreground group-hover:bg-foreground relative flex h-4 w-1.5 items-center justify-center rounded-md transition-colors", t4);
1117
+ $[4] = t4;
1118
+ $[5] = t5;
1119
+ } else {
1120
+ t5 = $[5];
1121
+ }
1122
+ let t6;
1123
+ if ($[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1124
+ t6 = /* @__PURE__ */ jsxDEV("div", {
1125
+ className: "flex flex-col gap-[2px]",
1126
+ children: [/* @__PURE__ */ jsxDEV("div", {
1127
+ className: "bg-background h-[2px] w-[2px] rounded-full"
1128
+ }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
1129
+ className: "bg-background h-[2px] w-[2px] rounded-full"
1130
+ }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
1131
+ className: "bg-background h-[2px] w-[2px] rounded-full"
1132
+ }, void 0, false)]
1133
+ }, void 0, true);
1134
+ $[6] = t6;
1135
+ } else {
1136
+ t6 = $[6];
1137
+ }
1138
+ let t7;
1139
+ if ($[7] !== t5) {
1140
+ t7 = /* @__PURE__ */ jsxDEV("div", {
1141
+ className: t5,
1142
+ children: t6
1143
+ }, void 0, false);
1144
+ $[7] = t5;
1145
+ $[8] = t7;
1146
+ } else {
1147
+ t7 = $[8];
1148
+ }
1149
+ let t8;
1150
+ if ($[9] !== bind || $[10] !== t3 || $[11] !== t7) {
1151
+ t8 = /* @__PURE__ */ jsxDEV("div", {
1152
+ className: t3,
1153
+ ...bind,
1154
+ children: t7
1155
+ }, void 0, false);
1156
+ $[9] = bind;
1157
+ $[10] = t3;
1158
+ $[11] = t7;
1159
+ $[12] = t8;
1160
+ } else {
1161
+ t8 = $[12];
1162
+ }
1163
+ let t9;
1164
+ if ($[13] !== isLeft || $[14] !== label) {
1165
+ t9 = label && /* @__PURE__ */ jsxDEV("div", {
1166
+ className: cn("bg-foreground text-background pointer-events-none absolute -bottom-3 -translate-y-1/2 rounded-[3px] px-1 py-px text-[8px] leading-tight font-medium whitespace-nowrap opacity-0 group-hover:opacity-100", isLeft ? "start-1.5" : "end-1.5"),
1167
+ children: label
1168
+ }, void 0, false);
1169
+ $[13] = isLeft;
1170
+ $[14] = label;
1171
+ $[15] = t9;
1172
+ } else {
1173
+ t9 = $[15];
1174
+ }
1175
+ let t10;
1176
+ if ($[16] !== t1 || $[17] !== t8 || $[18] !== t9) {
1177
+ t10 = /* @__PURE__ */ jsxDEV(motion.div, {
1178
+ className: "absolute inset-y-0 z-10",
1179
+ style: t1,
1180
+ children: [t8, t9]
1181
+ }, void 0, true);
1182
+ $[16] = t1;
1183
+ $[17] = t8;
1184
+ $[18] = t9;
1185
+ $[19] = t10;
1186
+ } else {
1187
+ t10 = $[19];
1188
+ }
1189
+ return t10;
1190
+ };
1191
+ const MiniChart = ({
1192
+ data,
1193
+ keys,
1194
+ chartConfig,
1195
+ variant,
1196
+ curveType,
1197
+ chartId,
1198
+ stacked,
1199
+ strokeVariant = "solid",
1200
+ connectNulls = false,
1201
+ barRadius
1202
+ }) => {
1203
+ const gradients = Object.entries(chartConfig).filter(([key]) => keys.includes(key)).map(([dataKey, config]) => {
1204
+ return {
1205
+ dataKey,
1206
+ colorsCount: getColorsCount(config)
1207
+ };
1208
+ });
1209
+ const dashArray = strokeVariant === "dashed" || strokeVariant === "animated-dashed" ? "4 4" : void 0;
1210
+ const defsContent = /* @__PURE__ */ jsxDEV(Fragment, {
1211
+ children: [variant === "area" && /* @__PURE__ */ jsxDEV("linearGradient", {
1212
+ id: `${chartId}-zm-vertical-fade`,
1213
+ x1: "0",
1214
+ x2: "0",
1215
+ y1: "0",
1216
+ y2: "1",
1217
+ children: [/* @__PURE__ */ jsxDEV("stop", {
1218
+ offset: "0%",
1219
+ stopColor: "white",
1220
+ stopOpacity: 0.15
1221
+ }, void 0, false), /* @__PURE__ */ jsxDEV("stop", {
1222
+ offset: "100%",
1223
+ stopColor: "white",
1224
+ stopOpacity: 0
1225
+ }, void 0, false)]
1226
+ }, void 0, true), gradients.map(({
1227
+ dataKey: dataKey_0,
1228
+ colorsCount
1229
+ }) => {
1230
+ const colorStops = colorsCount === 1 ? /* @__PURE__ */ jsxDEV(Fragment, {
1231
+ children: [/* @__PURE__ */ jsxDEV("stop", {
1232
+ offset: "0%",
1233
+ stopColor: `var(--color-${dataKey_0}-0)`
1234
+ }, void 0, false), /* @__PURE__ */ jsxDEV("stop", {
1235
+ offset: "100%",
1236
+ stopColor: `var(--color-${dataKey_0}-0)`
1237
+ }, void 0, false)]
1238
+ }, void 0, true) : Array.from({
1239
+ length: colorsCount
1240
+ }, (_, i) => /* @__PURE__ */ jsxDEV("stop", {
1241
+ offset: `${i / (colorsCount - 1) * 100}%`,
1242
+ stopColor: `var(--color-${dataKey_0}-${i}, var(--color-${dataKey_0}-0))`
1243
+ }, i, false));
1244
+ return /* @__PURE__ */ jsxDEV(React.Fragment, {
1245
+ children: [/* @__PURE__ */ jsxDEV("linearGradient", {
1246
+ id: `${chartId}-zm-${dataKey_0}`,
1247
+ x1: "0",
1248
+ x2: "0",
1249
+ y1: "0",
1250
+ y2: "1",
1251
+ children: colorStops
1252
+ }, void 0, false), variant === "area" && /* @__PURE__ */ jsxDEV(Fragment, {
1253
+ children: [/* @__PURE__ */ jsxDEV("mask", {
1254
+ id: `${chartId}-zm-fill-mask-${dataKey_0}`,
1255
+ children: /* @__PURE__ */ jsxDEV("rect", {
1256
+ fill: `url(#${chartId}-zm-vertical-fade)`,
1257
+ height: "100%",
1258
+ width: "100%"
1259
+ }, void 0, false)
1260
+ }, void 0, false), /* @__PURE__ */ jsxDEV("pattern", {
1261
+ height: "100%",
1262
+ id: `${chartId}-zm-fill-${dataKey_0}`,
1263
+ patternUnits: "userSpaceOnUse",
1264
+ width: "100%",
1265
+ children: /* @__PURE__ */ jsxDEV("rect", {
1266
+ fill: `url(#${chartId}-zm-${dataKey_0})`,
1267
+ height: "100%",
1268
+ mask: `url(#${chartId}-zm-fill-mask-${dataKey_0})`,
1269
+ width: "100%"
1270
+ }, void 0, false)
1271
+ }, void 0, false)]
1272
+ }, void 0, true)]
1273
+ }, dataKey_0, true);
1274
+ })]
1275
+ }, void 0, true);
1276
+ if (variant === "line") {
1277
+ return /* @__PURE__ */ jsxDEV(ResponsiveContainer, {
1278
+ height: "100%",
1279
+ width: "100%",
1280
+ children: /* @__PURE__ */ jsxDEV(LineChart, {
1281
+ data,
1282
+ margin: {
1283
+ top: 4,
1284
+ right: 0,
1285
+ bottom: 0,
1286
+ left: 0
1287
+ },
1288
+ children: [/* @__PURE__ */ jsxDEV("defs", {
1289
+ children: defsContent
1290
+ }, void 0, false), keys.map((dk) => /* @__PURE__ */ jsxDEV(Line, {
1291
+ activeDot: false,
1292
+ connectNulls,
1293
+ dataKey: dk,
1294
+ dot: false,
1295
+ isAnimationActive: false,
1296
+ stroke: `url(#${chartId}-zm-${dk})`,
1297
+ strokeDasharray: dashArray,
1298
+ strokeOpacity: 0.5,
1299
+ strokeWidth: 1,
1300
+ type: curveType
1301
+ }, dk, false))]
1302
+ }, void 0, true)
1303
+ }, void 0, false);
1304
+ }
1305
+ if (variant === "bar") {
1306
+ const r = barRadius ?? 3;
1307
+ return /* @__PURE__ */ jsxDEV(ResponsiveContainer, {
1308
+ height: "100%",
1309
+ width: "100%",
1310
+ children: /* @__PURE__ */ jsxDEV(BarChart, {
1311
+ barGap: 2,
1312
+ barSize: 14,
1313
+ data,
1314
+ margin: {
1315
+ top: 2,
1316
+ right: 0,
1317
+ bottom: 0,
1318
+ left: 0
1319
+ },
1320
+ children: [/* @__PURE__ */ jsxDEV("defs", {
1321
+ children: defsContent
1322
+ }, void 0, false), keys.map((dk_0) => /* @__PURE__ */ jsxDEV(Bar$1, {
1323
+ dataKey: dk_0,
1324
+ fill: `url(#${chartId}-zm-${dk_0})`,
1325
+ fillOpacity: 0.35,
1326
+ isAnimationActive: false,
1327
+ radius: [r, r, r, r],
1328
+ stackId: stacked ? "zm-stack" : void 0
1329
+ }, dk_0, false))]
1330
+ }, void 0, true)
1331
+ }, void 0, false);
1332
+ }
1333
+ return /* @__PURE__ */ jsxDEV(ResponsiveContainer, {
1334
+ height: "100%",
1335
+ width: "100%",
1336
+ children: /* @__PURE__ */ jsxDEV(AreaChart, {
1337
+ data,
1338
+ margin: {
1339
+ top: 4,
1340
+ right: 0,
1341
+ bottom: 0,
1342
+ left: 0
1343
+ },
1344
+ children: [/* @__PURE__ */ jsxDEV("defs", {
1345
+ children: defsContent
1346
+ }, void 0, false), keys.map((dk_1) => /* @__PURE__ */ jsxDEV(Area, {
1347
+ activeDot: false,
1348
+ connectNulls,
1349
+ dataKey: dk_1,
1350
+ dot: false,
1351
+ fill: `url(#${chartId}-zm-fill-${dk_1})`,
1352
+ fillOpacity: 1,
1353
+ isAnimationActive: false,
1354
+ stackId: stacked ? "zm-stack" : void 0,
1355
+ stroke: `url(#${chartId}-zm-${dk_1})`,
1356
+ strokeDasharray: dashArray,
1357
+ strokeOpacity: 0.5,
1358
+ strokeWidth: 1,
1359
+ type: curveType
1360
+ }, dk_1, false))]
1361
+ }, void 0, true)
1362
+ }, void 0, false);
1363
+ };
1364
+ function useEvilBrush({
1365
+ data,
1366
+ defaultStartIndex = 0,
1367
+ defaultEndIndex
1368
+ }) {
1369
+ const [range, setRange] = React.useState({
1370
+ startIndex: defaultStartIndex,
1371
+ endIndex: defaultEndIndex ?? Math.max(0, data.length - 1)
1372
+ });
1373
+ const deferredRange = React.useDeferredValue(range);
1374
+ useEffect(() => {
1375
+ setRange({
1376
+ startIndex: 0,
1377
+ endIndex: Math.max(0, data.length - 1)
1378
+ });
1379
+ }, [data.length]);
1380
+ const visibleData = data.slice(deferredRange.startIndex, deferredRange.endIndex + 1);
1381
+ return {
1382
+ range,
1383
+ visibleData,
1384
+ brushProps: {
1385
+ startIndex: range.startIndex,
1386
+ endIndex: range.endIndex,
1387
+ onChange: setRange
1388
+ }
1389
+ };
1390
+ }
1391
+
1392
+ const roundnessMap = {
1393
+ sm: "rounded-sm",
1394
+ md: "rounded-md",
1395
+ lg: "rounded-lg",
1396
+ xl: "rounded-xl"
1397
+ };
1398
+ const variantMap = {
1399
+ default: "bg-background",
1400
+ "frosted-glass": "bg-background"
1401
+ };
1402
+ const ChartTooltipContent = ({
1403
+ active,
1404
+ payload,
1405
+ className,
1406
+ indicator = "dot",
1407
+ hideLabel = false,
1408
+ hideIndicator = false,
1409
+ label,
1410
+ labelFormatter,
1411
+ labelClassName,
1412
+ formatter,
1413
+ nameKey,
1414
+ labelKey,
1415
+ selected,
1416
+ roundness = "lg",
1417
+ variant = "default"
1418
+ }) => {
1419
+ const {
1420
+ config
1421
+ } = useChart();
1422
+ const tooltipLabel = React.useMemo(() => {
1423
+ if (hideLabel || !payload?.length) {
1424
+ return null;
1425
+ }
1426
+ const [item] = payload;
1427
+ const key = `${labelKey ?? item?.dataKey ?? item?.name ?? "value"}`;
1428
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
1429
+ const value = !labelKey && typeof label === "string" ? config[label]?.label ?? label : itemConfig?.label;
1430
+ if (labelFormatter) {
1431
+ return /* @__PURE__ */ jsxDEV("div", {
1432
+ className: cn("font-medium", labelClassName),
1433
+ children: labelFormatter(value, payload)
1434
+ }, void 0, false);
1435
+ }
1436
+ if (!value) {
1437
+ return null;
1438
+ }
1439
+ return /* @__PURE__ */ jsxDEV("div", {
1440
+ className: cn("font-medium", labelClassName),
1441
+ children: value
1442
+ }, void 0, false);
1443
+ }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
1444
+ if (!active || !payload?.length) {
1445
+ return /* @__PURE__ */ jsxDEV("span", {
1446
+ className: "p-4"
1447
+ }, void 0, false);
1448
+ }
1449
+ const nestLabel = payload.length === 1 && indicator !== "dot";
1450
+ return /* @__PURE__ */ jsxDEV("div", {
1451
+ className: cn("border-border/50 grid min-w-32 items-start gap-1.5 border px-2.5 py-1.5 text-xs", roundnessMap[roundness], variantMap[variant], className),
1452
+ children: [nestLabel ? null : tooltipLabel, /* @__PURE__ */ jsxDEV("div", {
1453
+ className: "grid gap-1.5",
1454
+ children: payload.filter((item_0) => item_0.type !== "none").map((item_1, index) => {
1455
+ const payloadName = nameKey && item_1.payload ? item_1.payload[nameKey] : void 0;
1456
+ const key_0 = `${payloadName ?? item_1.name ?? item_1.dataKey ?? "value"}`;
1457
+ const itemConfig_0 = getPayloadConfigFromPayload(config, item_1, key_0);
1458
+ const colorsCount = itemConfig_0 ? getColorsCount(itemConfig_0) : 1;
1459
+ return /* @__PURE__ */ jsxDEV("div", {
1460
+ className: cn("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", indicator === "dot" && "items-center", selected != null && selected !== item_1.dataKey && "opacity-30"),
1461
+ children: formatter && item_1?.value !== void 0 && item_1.name ? formatter(item_1.value, item_1.name, item_1, index, item_1.payload) : /* @__PURE__ */ jsxDEV(Fragment, {
1462
+ children: [itemConfig_0?.icon ? /* @__PURE__ */ jsxDEV(itemConfig_0.icon, {}, void 0, false) : !hideIndicator && /* @__PURE__ */ jsxDEV("div", {
1463
+ className: cn("shrink-0 rounded-[2px]", {
1464
+ "h-2.5 w-2.5": indicator === "dot",
1465
+ "w-1": indicator === "line",
1466
+ "w-0 border-[1.5px] border-dashed bg-transparent!": indicator === "dashed",
1467
+ "my-0.5": nestLabel && indicator === "dashed"
1468
+ }),
1469
+ style: getIndicatorColorStyle(key_0, colorsCount)
1470
+ }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
1471
+ className: cn("flex flex-1 justify-between gap-4 leading-none", nestLabel ? "items-end" : "items-center"),
1472
+ children: [/* @__PURE__ */ jsxDEV("div", {
1473
+ className: "grid gap-1.5",
1474
+ children: [nestLabel ? tooltipLabel : null, /* @__PURE__ */ jsxDEV("span", {
1475
+ className: "text-muted-foreground",
1476
+ children: itemConfig_0?.label ?? item_1.name
1477
+ }, void 0, false)]
1478
+ }, void 0, true), item_1.value != null && /* @__PURE__ */ jsxDEV("span", {
1479
+ className: "text-foreground font-mono font-medium tabular-nums",
1480
+ children: typeof item_1.value === "number" ? item_1.value.toLocaleString() : String(item_1.value)
1481
+ }, void 0, false)]
1482
+ }, void 0, true)]
1483
+ }, void 0, true)
1484
+ }, index, false);
1485
+ })
1486
+ }, void 0, false)]
1487
+ }, void 0, true);
1488
+ };
1489
+ function getIndicatorColorStyle(dataKey, colorsCount) {
1490
+ if (colorsCount <= 1) {
1491
+ return {
1492
+ background: `var(--color-${dataKey}-0)`
1493
+ };
1494
+ }
1495
+ const stops = Array.from({
1496
+ length: colorsCount
1497
+ }, (_, index) => {
1498
+ const offset = index / (colorsCount - 1) * 100;
1499
+ return `var(--color-${dataKey}-${index}) ${offset}%`;
1500
+ }).join(", ");
1501
+ return {
1502
+ background: `linear-gradient(to right, ${stops})`
1503
+ };
1504
+ }
1505
+ const ChartTooltip = ({
1506
+ animationDuration = 200,
1507
+ ...props
1508
+ }) => /* @__PURE__ */ jsxDEV(RechartsPrimitive.Tooltip, {
1509
+ animationDuration,
1510
+ ...props
1511
+ }, void 0, false);
1512
+
1513
+ const DEFAULT_BAR_RADIUS = 2;
1514
+ const LOADING_BAR_DATA_KEY = "loading";
1515
+ const LOADING_ANIMATION_DURATION = 2e3;
1516
+ const STACK_ID = "evil-stacked";
1517
+ const BAR_GROW_DURATION = 0.5;
1518
+ const BAR_STAGGER = 0.05;
1519
+ const REVEAL_EASE = [0, 0.7, 0.5, 1];
1520
+ const BarChartContext = /* @__PURE__ */ createContext(null);
1521
+ function useBarChart() {
1522
+ const context = use(BarChartContext);
1523
+ if (!context) {
1524
+ throw new Error("Bar chart parts (<Bar />, <XAxis />, …) must be used within <EvilBarChart />");
1525
+ }
1526
+ return context;
1527
+ }
1528
+ const EvilBarChart = ({
1529
+ config,
1530
+ data,
1531
+ children,
1532
+ className,
1533
+ chartProps,
1534
+ stackType = "default",
1535
+ layout = "vertical",
1536
+ barRadius = DEFAULT_BAR_RADIUS,
1537
+ animationType = "left-to-right",
1538
+ barGap,
1539
+ barCategoryGap,
1540
+ backgroundVariant,
1541
+ defaultSelectedDataKey = null,
1542
+ onSelectionChange,
1543
+ isLoading = false,
1544
+ loadingBars,
1545
+ showBrush = false,
1546
+ xDataKey,
1547
+ brushHeight,
1548
+ brushFormatLabel,
1549
+ onBrushChange
1550
+ }) => {
1551
+ const chartId = useId().replaceAll(":", "");
1552
+ const [introStartedAt] = useState(() => Date.now());
1553
+ const [selectedDataKey, setSelectedDataKey] = useState(defaultSelectedDataKey);
1554
+ const [isMouseInChart, setIsMouseInChart] = useState(false);
1555
+ const {
1556
+ loadingData,
1557
+ onShimmerExit
1558
+ } = useLoadingData(isLoading, loadingBars);
1559
+ const {
1560
+ visibleData,
1561
+ brushProps
1562
+ } = useEvilBrush({
1563
+ data
1564
+ });
1565
+ const isStacked = stackType === "stacked" || stackType === "percent";
1566
+ const isHorizontal = layout === "horizontal";
1567
+ const displayData = showBrush && !isLoading ? visibleData : data;
1568
+ const selectDataKey = (newSelectedDataKey) => {
1569
+ setSelectedDataKey(newSelectedDataKey);
1570
+ onSelectionChange?.(newSelectedDataKey);
1571
+ };
1572
+ const contextValue = {
1573
+ config,
1574
+ isStacked,
1575
+ isHorizontal,
1576
+ isLoading,
1577
+ barRadius,
1578
+ animationType,
1579
+ introStartedAt,
1580
+ dataLength: displayData.length,
1581
+ selectedDataKey,
1582
+ selectDataKey,
1583
+ isMouseInChart
1584
+ };
1585
+ return /* @__PURE__ */ jsxDEV(BarChartContext, {
1586
+ value: contextValue,
1587
+ children: /* @__PURE__ */ jsxDEV(ChartContainer, {
1588
+ className,
1589
+ config,
1590
+ footer: showBrush && !isLoading && /* @__PURE__ */ jsxDEV(EvilBrush, {
1591
+ barRadius,
1592
+ chartConfig: config,
1593
+ className: "mt-1",
1594
+ data,
1595
+ formatLabel: brushFormatLabel,
1596
+ height: brushHeight,
1597
+ skipStyle: true,
1598
+ stacked: isStacked,
1599
+ variant: "bar",
1600
+ xDataKey,
1601
+ ...brushProps,
1602
+ onChange: (range) => {
1603
+ brushProps.onChange(range);
1604
+ onBrushChange?.(range);
1605
+ }
1606
+ }, void 0, false),
1607
+ children: [/* @__PURE__ */ jsxDEV(LoadingIndicator, {
1608
+ isLoading
1609
+ }, void 0, false), /* @__PURE__ */ jsxDEV(BarChart, {
1610
+ accessibilityLayer: true,
1611
+ barCategoryGap,
1612
+ barGap,
1613
+ data: isLoading ? loadingData : displayData,
1614
+ id: chartId,
1615
+ layout: isHorizontal ? "vertical" : "horizontal",
1616
+ onMouseEnter: () => {
1617
+ setIsMouseInChart(true);
1618
+ },
1619
+ onMouseLeave: () => {
1620
+ setIsMouseInChart(false);
1621
+ },
1622
+ stackOffset: stackType === "percent" ? "expand" : void 0,
1623
+ ...chartProps,
1624
+ children: [backgroundVariant && /* @__PURE__ */ jsxDEV(ChartBackground, {
1625
+ variant: backgroundVariant
1626
+ }, void 0, false), /* @__PURE__ */ jsxDEV(ReferenceLine, {
1627
+ stroke: "var(--border)"
1628
+ }, void 0, false), children, isLoading && /* @__PURE__ */ jsxDEV(LoadingBar, {
1629
+ chartId,
1630
+ onShimmerExit
1631
+ }, void 0, false)]
1632
+ }, void 0, true)]
1633
+ }, void 0, true)
1634
+ }, void 0, false);
1635
+ };
1636
+ const Bar = ({
1637
+ dataKey,
1638
+ variant = "default",
1639
+ radius,
1640
+ animationType,
1641
+ isClickable = false,
1642
+ enableHoverHighlight = false,
1643
+ glowing = false,
1644
+ bufferBar = false,
1645
+ barProps
1646
+ }) => {
1647
+ const {
1648
+ config,
1649
+ isStacked,
1650
+ isHorizontal,
1651
+ isLoading,
1652
+ barRadius: defaultRadius,
1653
+ animationType: defaultAnimation,
1654
+ introStartedAt,
1655
+ dataLength,
1656
+ selectedDataKey,
1657
+ selectDataKey,
1658
+ isMouseInChart
1659
+ } = useBarChart();
1660
+ const id = useId().replaceAll(":", "");
1661
+ const shouldReduceMotion = useReducedMotion();
1662
+ if (isLoading) {
1663
+ return null;
1664
+ }
1665
+ const resolvedRadius = radius ?? defaultRadius;
1666
+ const isSelected = selectedDataKey === dataKey;
1667
+ const revealType = shouldReduceMotion ? "none" : animationType ?? defaultAnimation;
1668
+ const customBarProps = {
1669
+ id,
1670
+ dataKey,
1671
+ variant,
1672
+ barRadius: resolvedRadius,
1673
+ glowing,
1674
+ bufferBar,
1675
+ isClickable,
1676
+ enableHoverHighlight,
1677
+ isMouseInChart,
1678
+ isHorizontal,
1679
+ introStartedAt,
1680
+ selectedDataKey,
1681
+ dataLength,
1682
+ onClick: () => {
1683
+ if (!isClickable) {
1684
+ return;
1685
+ }
1686
+ selectDataKey(isSelected ? null : dataKey);
1687
+ }
1688
+ };
1689
+ return /* @__PURE__ */ jsxDEV(Fragment, {
1690
+ children: [/* @__PURE__ */ jsxDEV(Bar$1, {
1691
+ activeBar: (props) => (
1692
+ // The active (hovered) bar must never re-run the grow-in animation
1693
+ /* @__PURE__ */ jsxDEV(CustomBar, {
1694
+ ...props,
1695
+ ...customBarProps,
1696
+ animationType: "none"
1697
+ }, void 0, false)
1698
+ ),
1699
+ dataKey,
1700
+ fill: `url(#${id}-colors-${dataKey})`,
1701
+ isAnimationActive: false,
1702
+ radius: resolvedRadius,
1703
+ shape: (props_0) => /* @__PURE__ */ jsxDEV(CustomBar, {
1704
+ ...props_0,
1705
+ ...customBarProps,
1706
+ animationType: revealType
1707
+ }, void 0, false),
1708
+ stackId: isStacked ? STACK_ID : void 0,
1709
+ style: isClickable || enableHoverHighlight ? {
1710
+ cursor: "pointer"
1711
+ } : void 0,
1712
+ ...barProps
1713
+ }, void 0, false), /* @__PURE__ */ jsxDEV("defs", {
1714
+ children: [/* @__PURE__ */ jsxDEV(ColorGradient, {
1715
+ config,
1716
+ dataKey,
1717
+ id
1718
+ }, void 0, false), variant === "hatched" && /* @__PURE__ */ jsxDEV(HatchedPattern, {
1719
+ dataKey,
1720
+ id
1721
+ }, void 0, false), variant === "duotone" && /* @__PURE__ */ jsxDEV(DuotonePattern, {
1722
+ config,
1723
+ dataKey,
1724
+ id
1725
+ }, void 0, false), variant === "duotone-reverse" && /* @__PURE__ */ jsxDEV(DuotoneReversePattern, {
1726
+ config,
1727
+ dataKey,
1728
+ id
1729
+ }, void 0, false), variant === "gradient" && /* @__PURE__ */ jsxDEV(GradientPattern, {
1730
+ dataKey,
1731
+ id
1732
+ }, void 0, false), variant === "stripped" && /* @__PURE__ */ jsxDEV(StrippedPattern, {
1733
+ dataKey,
1734
+ id
1735
+ }, void 0, false), bufferBar && /* @__PURE__ */ jsxDEV(BufferHatchedPattern, {
1736
+ dataKey,
1737
+ id
1738
+ }, void 0, false), glowing && /* @__PURE__ */ jsxDEV(GlowFilter, {
1739
+ dataKey,
1740
+ id
1741
+ }, void 0, false)]
1742
+ }, void 0, true)]
1743
+ }, void 0, true);
1744
+ };
1745
+ const XAxis = ({
1746
+ tickLine = false,
1747
+ axisLine = false,
1748
+ tickMargin = 8,
1749
+ minTickGap = 8,
1750
+ type,
1751
+ ...props
1752
+ }) => {
1753
+ const {
1754
+ isLoading,
1755
+ isHorizontal
1756
+ } = useBarChart();
1757
+ if (isLoading) {
1758
+ return null;
1759
+ }
1760
+ return /* @__PURE__ */ jsxDEV(XAxis$1, {
1761
+ axisLine,
1762
+ minTickGap,
1763
+ tickLine,
1764
+ tickMargin,
1765
+ type: type ?? (isHorizontal ? "number" : "category"),
1766
+ ...props
1767
+ }, void 0, false);
1768
+ };
1769
+ const Tooltip = (t0) => {
1770
+ const $ = c(7);
1771
+ const {
1772
+ variant,
1773
+ roundness,
1774
+ defaultIndex
1775
+ } = t0;
1776
+ const {
1777
+ isLoading,
1778
+ selectedDataKey
1779
+ } = useBarChart();
1780
+ if (isLoading) {
1781
+ return null;
1782
+ }
1783
+ let t1;
1784
+ if ($[0] !== roundness || $[1] !== selectedDataKey || $[2] !== variant) {
1785
+ t1 = /* @__PURE__ */ jsxDEV(ChartTooltipContent, {
1786
+ roundness,
1787
+ selected: selectedDataKey,
1788
+ variant
1789
+ }, void 0, false);
1790
+ $[0] = roundness;
1791
+ $[1] = selectedDataKey;
1792
+ $[2] = variant;
1793
+ $[3] = t1;
1794
+ } else {
1795
+ t1 = $[3];
1796
+ }
1797
+ let t2;
1798
+ if ($[4] !== defaultIndex || $[5] !== t1) {
1799
+ t2 = /* @__PURE__ */ jsxDEV(ChartTooltip, {
1800
+ content: t1,
1801
+ cursor: false,
1802
+ defaultIndex
1803
+ }, void 0, false);
1804
+ $[4] = defaultIndex;
1805
+ $[5] = t1;
1806
+ $[6] = t2;
1807
+ } else {
1808
+ t2 = $[6];
1809
+ }
1810
+ return t2;
1811
+ };
1812
+ const CustomBar = (props) => {
1813
+ const {
1814
+ x = 0,
1815
+ y = 0,
1816
+ width = 0,
1817
+ height = 0,
1818
+ id,
1819
+ dataKey,
1820
+ variant,
1821
+ barRadius,
1822
+ glowing,
1823
+ bufferBar,
1824
+ isClickable,
1825
+ enableHoverHighlight,
1826
+ isMouseInChart,
1827
+ isHorizontal = false,
1828
+ animationType = "none",
1829
+ introStartedAt = 0,
1830
+ selectedDataKey,
1831
+ isActive,
1832
+ dataLength = 0,
1833
+ onClick
1834
+ } = props;
1835
+ const index = typeof props.index === "number" ? props.index : -1;
1836
+ const isLastBar = bufferBar && dataLength > 0 && index === dataLength - 1;
1837
+ const isStripped = variant === "stripped";
1838
+ const grow = getBarGrowAnimation(animationType, index, dataLength, isHorizontal, introStartedAt);
1839
+ const fill = isLastBar ? `url(#${id}-buffer-hatched-${dataKey})` : getVariantFill(variant, id, dataKey);
1840
+ const filter = glowing ? `url(#${id}-bar-glow-${dataKey})` : void 0;
1841
+ const fillOpacity = getBarOpacity({
1842
+ isClickable,
1843
+ selectedDataKey,
1844
+ dataKey,
1845
+ enableHoverHighlight,
1846
+ isMouseInChart,
1847
+ isActive
1848
+ });
1849
+ const cursorStyle = isClickable || enableHoverHighlight ? {
1850
+ cursor: "pointer"
1851
+ } : void 0;
1852
+ const radius = isStripped ? [barRadius, barRadius, 0, 0] : barRadius;
1853
+ const visibleBar = /* @__PURE__ */ jsxDEV(Fragment, {
1854
+ children: [/* @__PURE__ */ jsxDEV(Rectangle, {
1855
+ fill,
1856
+ filter,
1857
+ height: Math.max(0, height - 3),
1858
+ opacity: fillOpacity,
1859
+ radius,
1860
+ stroke: isLastBar ? `url(#${id}-colors-${dataKey})` : void 0,
1861
+ strokeWidth: isLastBar ? 1 : void 0,
1862
+ width,
1863
+ x,
1864
+ y
1865
+ }, void 0, false), isStripped && /* @__PURE__ */ jsxDEV(Rectangle, {
1866
+ fill: `url(#${id}-colors-${dataKey})`,
1867
+ height: 2,
1868
+ radius: 1,
1869
+ width,
1870
+ x,
1871
+ y: y - 4
1872
+ }, void 0, false)]
1873
+ }, void 0, true);
1874
+ return /* @__PURE__ */ jsxDEV("g", {
1875
+ onClick,
1876
+ style: cursorStyle,
1877
+ children: [/* @__PURE__ */ jsxDEV(Rectangle, {
1878
+ ...props,
1879
+ fill: "transparent"
1880
+ }, void 0, false), grow ? /* @__PURE__ */ jsxDEV(motion.g, {
1881
+ animate: grow.animate,
1882
+ initial: grow.initial,
1883
+ style: grow.style,
1884
+ transition: grow.transition,
1885
+ children: visibleBar
1886
+ }, void 0, false) : visibleBar]
1887
+ }, void 0, true);
1888
+ };
1889
+ const getBarGrowAnimation = (animationType, index, dataLength, isHorizontal, introStartedAt) => {
1890
+ if (animationType === "none" || index < 0 || dataLength <= 0) {
1891
+ return null;
1892
+ }
1893
+ const lastIndex = dataLength - 1;
1894
+ const center = lastIndex / 2;
1895
+ let step;
1896
+ switch (animationType) {
1897
+ case "center-out": {
1898
+ step = Math.abs(index - center);
1899
+ break;
1900
+ }
1901
+ case "edges-in": {
1902
+ step = center - Math.abs(index - center);
1903
+ break;
1904
+ }
1905
+ case "right-to-left": {
1906
+ step = lastIndex - index;
1907
+ break;
1908
+ }
1909
+ default: {
1910
+ step = index;
1911
+ }
1912
+ }
1913
+ const startMs = step * BAR_STAGGER * 1e3;
1914
+ const durationMs = BAR_GROW_DURATION * 1e3;
1915
+ const endMs = startMs + durationMs;
1916
+ const elapsed = Date.now() - introStartedAt;
1917
+ if (elapsed >= endMs) {
1918
+ return null;
1919
+ }
1920
+ const from = elapsed <= startMs ? 0 : (elapsed - startMs) / durationMs;
1921
+ const transition = {
1922
+ duration: (endMs - Math.max(elapsed, startMs)) / 1e3,
1923
+ ease: REVEAL_EASE,
1924
+ delay: Math.max(0, startMs - elapsed) / 1e3
1925
+ };
1926
+ return isHorizontal ? {
1927
+ initial: {
1928
+ scaleX: from
1929
+ },
1930
+ animate: {
1931
+ scaleX: 1
1932
+ },
1933
+ transition,
1934
+ style: {
1935
+ originX: 0
1936
+ }
1937
+ } : {
1938
+ initial: {
1939
+ scaleY: from
1940
+ },
1941
+ animate: {
1942
+ scaleY: 1
1943
+ },
1944
+ transition,
1945
+ style: {
1946
+ originY: 1
1947
+ }
1948
+ };
1949
+ };
1950
+ const getVariantFill = (variant, id, dataKey) => {
1951
+ switch (variant) {
1952
+ case "duotone": {
1953
+ return `url(#${id}-duotone-${dataKey})`;
1954
+ }
1955
+ case "duotone-reverse": {
1956
+ return `url(#${id}-duotone-reverse-${dataKey})`;
1957
+ }
1958
+ case "gradient": {
1959
+ return `url(#${id}-gradient-${dataKey})`;
1960
+ }
1961
+ case "hatched": {
1962
+ return `url(#${id}-hatched-${dataKey})`;
1963
+ }
1964
+ case "stripped": {
1965
+ return `url(#${id}-stripped-${dataKey})`;
1966
+ }
1967
+ default: {
1968
+ return `url(#${id}-colors-${dataKey})`;
1969
+ }
1970
+ }
1971
+ };
1972
+ const getBarOpacity = ({
1973
+ isClickable,
1974
+ selectedDataKey,
1975
+ dataKey,
1976
+ enableHoverHighlight,
1977
+ isMouseInChart,
1978
+ isActive
1979
+ }) => {
1980
+ const isSelectedDataKey = selectedDataKey === null || selectedDataKey === dataKey;
1981
+ const clickOpacity = isClickable && selectedDataKey !== null ? isSelectedDataKey ? 1 : 0.3 : 1;
1982
+ if (enableHoverHighlight && isMouseInChart) {
1983
+ return isActive ? clickOpacity : clickOpacity * 0.3;
1984
+ }
1985
+ return clickOpacity;
1986
+ };
1987
+ const ColorGradient = (t0) => {
1988
+ const $ = c(16);
1989
+ const {
1990
+ id,
1991
+ dataKey,
1992
+ config
1993
+ } = t0;
1994
+ let t1;
1995
+ let t2;
1996
+ let t3;
1997
+ let t4;
1998
+ let t5;
1999
+ let t6;
2000
+ if ($[0] !== config || $[1] !== dataKey || $[2] !== id) {
2001
+ const colorsCount = getColorsCount(config[dataKey] ?? {});
2002
+ t1 = `${id}-colors-${dataKey}`;
2003
+ t2 = "0";
2004
+ t3 = "0";
2005
+ t4 = "0";
2006
+ t5 = "1";
2007
+ t6 = colorsCount === 1 ? /* @__PURE__ */ jsxDEV(Fragment, {
2008
+ children: [/* @__PURE__ */ jsxDEV("stop", {
2009
+ offset: "0%",
2010
+ stopColor: `var(--color-${dataKey}-0)`
2011
+ }, void 0, false), /* @__PURE__ */ jsxDEV("stop", {
2012
+ offset: "100%",
2013
+ stopColor: `var(--color-${dataKey}-0)`
2014
+ }, void 0, false)]
2015
+ }, void 0, true) : Array.from({
2016
+ length: colorsCount
2017
+ }, (_, index) => {
2018
+ const offset = `${index / (colorsCount - 1) * 100}%`;
2019
+ return /* @__PURE__ */ jsxDEV("stop", {
2020
+ offset,
2021
+ stopColor: `var(--color-${dataKey}-${index}, var(--color-${dataKey}-0))`
2022
+ }, offset, false);
2023
+ });
2024
+ $[0] = config;
2025
+ $[1] = dataKey;
2026
+ $[2] = id;
2027
+ $[3] = t1;
2028
+ $[4] = t2;
2029
+ $[5] = t3;
2030
+ $[6] = t4;
2031
+ $[7] = t5;
2032
+ $[8] = t6;
2033
+ } else {
2034
+ t1 = $[3];
2035
+ t2 = $[4];
2036
+ t3 = $[5];
2037
+ t4 = $[6];
2038
+ t5 = $[7];
2039
+ t6 = $[8];
2040
+ }
2041
+ let t7;
2042
+ if ($[9] !== t1 || $[10] !== t2 || $[11] !== t3 || $[12] !== t4 || $[13] !== t5 || $[14] !== t6) {
2043
+ t7 = /* @__PURE__ */ jsxDEV("linearGradient", {
2044
+ id: t1,
2045
+ x1: t2,
2046
+ x2: t3,
2047
+ y1: t4,
2048
+ y2: t5,
2049
+ children: t6
2050
+ }, void 0, false);
2051
+ $[9] = t1;
2052
+ $[10] = t2;
2053
+ $[11] = t3;
2054
+ $[12] = t4;
2055
+ $[13] = t5;
2056
+ $[14] = t6;
2057
+ $[15] = t7;
2058
+ } else {
2059
+ t7 = $[15];
2060
+ }
2061
+ return t7;
2062
+ };
2063
+ const HatchedPattern = (t0) => {
2064
+ const $ = c(19);
2065
+ const {
2066
+ id,
2067
+ dataKey
2068
+ } = t0;
2069
+ const t1 = `${id}-hatched-mask-pattern`;
2070
+ let t2;
2071
+ let t3;
2072
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2073
+ t2 = /* @__PURE__ */ jsxDEV("rect", {
2074
+ fill: "white",
2075
+ fillOpacity: 0.3,
2076
+ height: "5",
2077
+ width: "5"
2078
+ }, void 0, false);
2079
+ t3 = /* @__PURE__ */ jsxDEV("rect", {
2080
+ fill: "white",
2081
+ fillOpacity: 1,
2082
+ height: "5",
2083
+ width: "1.5"
2084
+ }, void 0, false);
2085
+ $[0] = t2;
2086
+ $[1] = t3;
2087
+ } else {
2088
+ t2 = $[0];
2089
+ t3 = $[1];
2090
+ }
2091
+ let t4;
2092
+ if ($[2] !== t1) {
2093
+ t4 = /* @__PURE__ */ jsxDEV("pattern", {
2094
+ height: "5",
2095
+ id: t1,
2096
+ patternTransform: "rotate(-45)",
2097
+ patternUnits: "userSpaceOnUse",
2098
+ width: "5",
2099
+ x: "0",
2100
+ y: "0",
2101
+ children: [t2, t3]
2102
+ }, void 0, true);
2103
+ $[2] = t1;
2104
+ $[3] = t4;
2105
+ } else {
2106
+ t4 = $[3];
2107
+ }
2108
+ const t5 = `${id}-hatched-mask-${dataKey}`;
2109
+ const t6 = `url(#${id}-hatched-mask-pattern)`;
2110
+ let t7;
2111
+ if ($[4] !== t6) {
2112
+ t7 = /* @__PURE__ */ jsxDEV("rect", {
2113
+ fill: t6,
2114
+ height: "100%",
2115
+ width: "100%"
2116
+ }, void 0, false);
2117
+ $[4] = t6;
2118
+ $[5] = t7;
2119
+ } else {
2120
+ t7 = $[5];
2121
+ }
2122
+ let t8;
2123
+ if ($[6] !== t5 || $[7] !== t7) {
2124
+ t8 = /* @__PURE__ */ jsxDEV("mask", {
2125
+ id: t5,
2126
+ children: t7
2127
+ }, void 0, false);
2128
+ $[6] = t5;
2129
+ $[7] = t7;
2130
+ $[8] = t8;
2131
+ } else {
2132
+ t8 = $[8];
2133
+ }
2134
+ const t9 = `${id}-hatched-${dataKey}`;
2135
+ const t10 = `url(#${id}-colors-${dataKey})`;
2136
+ const t11 = `url(#${id}-hatched-mask-${dataKey})`;
2137
+ let t12;
2138
+ if ($[9] !== t10 || $[10] !== t11) {
2139
+ t12 = /* @__PURE__ */ jsxDEV("rect", {
2140
+ fill: t10,
2141
+ height: "100%",
2142
+ mask: t11,
2143
+ width: "100%"
2144
+ }, void 0, false);
2145
+ $[9] = t10;
2146
+ $[10] = t11;
2147
+ $[11] = t12;
2148
+ } else {
2149
+ t12 = $[11];
2150
+ }
2151
+ let t13;
2152
+ if ($[12] !== t12 || $[13] !== t9) {
2153
+ t13 = /* @__PURE__ */ jsxDEV("pattern", {
2154
+ height: "100%",
2155
+ id: t9,
2156
+ patternUnits: "userSpaceOnUse",
2157
+ width: "100%",
2158
+ children: t12
2159
+ }, void 0, false);
2160
+ $[12] = t12;
2161
+ $[13] = t9;
2162
+ $[14] = t13;
2163
+ } else {
2164
+ t13 = $[14];
2165
+ }
2166
+ let t14;
2167
+ if ($[15] !== t13 || $[16] !== t4 || $[17] !== t8) {
2168
+ t14 = /* @__PURE__ */ jsxDEV(Fragment, {
2169
+ children: [t4, t8, t13]
2170
+ }, void 0, true);
2171
+ $[15] = t13;
2172
+ $[16] = t4;
2173
+ $[17] = t8;
2174
+ $[18] = t14;
2175
+ } else {
2176
+ t14 = $[18];
2177
+ }
2178
+ return t14;
2179
+ };
2180
+ const BufferHatchedPattern = (t0) => {
2181
+ const $ = c(19);
2182
+ const {
2183
+ id,
2184
+ dataKey
2185
+ } = t0;
2186
+ const t1 = `${id}-buffer-hatched-mask-pattern`;
2187
+ let t2;
2188
+ let t3;
2189
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2190
+ t2 = /* @__PURE__ */ jsxDEV("rect", {
2191
+ fill: "black",
2192
+ fillOpacity: 0,
2193
+ height: "5",
2194
+ width: "5"
2195
+ }, void 0, false);
2196
+ t3 = /* @__PURE__ */ jsxDEV("rect", {
2197
+ fill: "white",
2198
+ fillOpacity: 1,
2199
+ height: "5",
2200
+ width: "1"
2201
+ }, void 0, false);
2202
+ $[0] = t2;
2203
+ $[1] = t3;
2204
+ } else {
2205
+ t2 = $[0];
2206
+ t3 = $[1];
2207
+ }
2208
+ let t4;
2209
+ if ($[2] !== t1) {
2210
+ t4 = /* @__PURE__ */ jsxDEV("pattern", {
2211
+ height: "5",
2212
+ id: t1,
2213
+ patternTransform: "rotate(-45)",
2214
+ patternUnits: "userSpaceOnUse",
2215
+ width: "5",
2216
+ x: "0",
2217
+ y: "0",
2218
+ children: [t2, t3]
2219
+ }, void 0, true);
2220
+ $[2] = t1;
2221
+ $[3] = t4;
2222
+ } else {
2223
+ t4 = $[3];
2224
+ }
2225
+ const t5 = `${id}-buffer-hatched-mask-${dataKey}`;
2226
+ const t6 = `url(#${id}-buffer-hatched-mask-pattern)`;
2227
+ let t7;
2228
+ if ($[4] !== t6) {
2229
+ t7 = /* @__PURE__ */ jsxDEV("rect", {
2230
+ fill: t6,
2231
+ height: "100%",
2232
+ width: "100%"
2233
+ }, void 0, false);
2234
+ $[4] = t6;
2235
+ $[5] = t7;
2236
+ } else {
2237
+ t7 = $[5];
2238
+ }
2239
+ let t8;
2240
+ if ($[6] !== t5 || $[7] !== t7) {
2241
+ t8 = /* @__PURE__ */ jsxDEV("mask", {
2242
+ id: t5,
2243
+ children: t7
2244
+ }, void 0, false);
2245
+ $[6] = t5;
2246
+ $[7] = t7;
2247
+ $[8] = t8;
2248
+ } else {
2249
+ t8 = $[8];
2250
+ }
2251
+ const t9 = `${id}-buffer-hatched-${dataKey}`;
2252
+ const t10 = `url(#${id}-colors-${dataKey})`;
2253
+ const t11 = `url(#${id}-buffer-hatched-mask-${dataKey})`;
2254
+ let t12;
2255
+ if ($[9] !== t10 || $[10] !== t11) {
2256
+ t12 = /* @__PURE__ */ jsxDEV("rect", {
2257
+ fill: t10,
2258
+ height: "100%",
2259
+ mask: t11,
2260
+ width: "100%"
2261
+ }, void 0, false);
2262
+ $[9] = t10;
2263
+ $[10] = t11;
2264
+ $[11] = t12;
2265
+ } else {
2266
+ t12 = $[11];
2267
+ }
2268
+ let t13;
2269
+ if ($[12] !== t12 || $[13] !== t9) {
2270
+ t13 = /* @__PURE__ */ jsxDEV("pattern", {
2271
+ height: "100%",
2272
+ id: t9,
2273
+ patternUnits: "userSpaceOnUse",
2274
+ width: "100%",
2275
+ children: t12
2276
+ }, void 0, false);
2277
+ $[12] = t12;
2278
+ $[13] = t9;
2279
+ $[14] = t13;
2280
+ } else {
2281
+ t13 = $[14];
2282
+ }
2283
+ let t14;
2284
+ if ($[15] !== t13 || $[16] !== t4 || $[17] !== t8) {
2285
+ t14 = /* @__PURE__ */ jsxDEV(Fragment, {
2286
+ children: [t4, t8, t13]
2287
+ }, void 0, true);
2288
+ $[15] = t13;
2289
+ $[16] = t4;
2290
+ $[17] = t8;
2291
+ $[18] = t14;
2292
+ } else {
2293
+ t14 = $[18];
2294
+ }
2295
+ return t14;
2296
+ };
2297
+ const DuotonePattern = (t0) => {
2298
+ const $ = c(39);
2299
+ const {
2300
+ id,
2301
+ dataKey,
2302
+ config
2303
+ } = t0;
2304
+ let t1;
2305
+ let t2;
2306
+ let t3;
2307
+ let t4;
2308
+ let t5;
2309
+ let t6;
2310
+ let t7;
2311
+ let t8;
2312
+ if ($[0] !== config || $[1] !== dataKey || $[2] !== id) {
2313
+ const colorsCount = getColorsCount(config[dataKey] ?? {});
2314
+ const t92 = `${id}-duotone-mask-gradient-${dataKey}`;
2315
+ let t102;
2316
+ let t112;
2317
+ if ($[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2318
+ t102 = /* @__PURE__ */ jsxDEV("stop", {
2319
+ offset: "50%",
2320
+ stopColor: "white",
2321
+ stopOpacity: 0.4
2322
+ }, void 0, false);
2323
+ t112 = /* @__PURE__ */ jsxDEV("stop", {
2324
+ offset: "50%",
2325
+ stopColor: "white",
2326
+ stopOpacity: 1
2327
+ }, void 0, false);
2328
+ $[11] = t102;
2329
+ $[12] = t112;
2330
+ } else {
2331
+ t102 = $[11];
2332
+ t112 = $[12];
2333
+ }
2334
+ if ($[13] !== t92) {
2335
+ t8 = /* @__PURE__ */ jsxDEV("linearGradient", {
2336
+ gradientUnits: "objectBoundingBox",
2337
+ id: t92,
2338
+ x1: "0",
2339
+ x2: "1",
2340
+ y1: "0",
2341
+ y2: "0",
2342
+ children: [t102, t112]
2343
+ }, void 0, true);
2344
+ $[13] = t92;
2345
+ $[14] = t8;
2346
+ } else {
2347
+ t8 = $[14];
2348
+ }
2349
+ t1 = "objectBoundingBox";
2350
+ t2 = `${id}-duotone-colors-${dataKey}`;
2351
+ t3 = "0";
2352
+ t4 = "0";
2353
+ t5 = "0";
2354
+ t6 = "1";
2355
+ t7 = colorsCount === 1 ? /* @__PURE__ */ jsxDEV(Fragment, {
2356
+ children: [/* @__PURE__ */ jsxDEV("stop", {
2357
+ offset: "0%",
2358
+ stopColor: `var(--color-${dataKey}-0)`
2359
+ }, void 0, false), /* @__PURE__ */ jsxDEV("stop", {
2360
+ offset: "100%",
2361
+ stopColor: `var(--color-${dataKey}-0)`
2362
+ }, void 0, false)]
2363
+ }, void 0, true) : Array.from({
2364
+ length: colorsCount
2365
+ }, (_, index) => {
2366
+ const offset = `${index / (colorsCount - 1) * 100}%`;
2367
+ return /* @__PURE__ */ jsxDEV("stop", {
2368
+ offset,
2369
+ stopColor: `var(--color-${dataKey}-${index}, var(--color-${dataKey}-0))`
2370
+ }, offset, false);
2371
+ });
2372
+ $[0] = config;
2373
+ $[1] = dataKey;
2374
+ $[2] = id;
2375
+ $[3] = t1;
2376
+ $[4] = t2;
2377
+ $[5] = t3;
2378
+ $[6] = t4;
2379
+ $[7] = t5;
2380
+ $[8] = t6;
2381
+ $[9] = t7;
2382
+ $[10] = t8;
2383
+ } else {
2384
+ t1 = $[3];
2385
+ t2 = $[4];
2386
+ t3 = $[5];
2387
+ t4 = $[6];
2388
+ t5 = $[7];
2389
+ t6 = $[8];
2390
+ t7 = $[9];
2391
+ t8 = $[10];
2392
+ }
2393
+ let t9;
2394
+ if ($[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6 || $[21] !== t7) {
2395
+ t9 = /* @__PURE__ */ jsxDEV("linearGradient", {
2396
+ gradientUnits: t1,
2397
+ id: t2,
2398
+ x1: t3,
2399
+ x2: t4,
2400
+ y1: t5,
2401
+ y2: t6,
2402
+ children: t7
2403
+ }, void 0, false);
2404
+ $[15] = t1;
2405
+ $[16] = t2;
2406
+ $[17] = t3;
2407
+ $[18] = t4;
2408
+ $[19] = t5;
2409
+ $[20] = t6;
2410
+ $[21] = t7;
2411
+ $[22] = t9;
2412
+ } else {
2413
+ t9 = $[22];
2414
+ }
2415
+ const t10 = `${id}-duotone-mask-${dataKey}`;
2416
+ const t11 = `url(#${id}-duotone-mask-gradient-${dataKey})`;
2417
+ let t12;
2418
+ if ($[23] !== t11) {
2419
+ t12 = /* @__PURE__ */ jsxDEV("rect", {
2420
+ fill: t11,
2421
+ height: "1",
2422
+ width: "1",
2423
+ x: "0",
2424
+ y: "0"
2425
+ }, void 0, false);
2426
+ $[23] = t11;
2427
+ $[24] = t12;
2428
+ } else {
2429
+ t12 = $[24];
2430
+ }
2431
+ let t13;
2432
+ if ($[25] !== t10 || $[26] !== t12) {
2433
+ t13 = /* @__PURE__ */ jsxDEV("mask", {
2434
+ id: t10,
2435
+ maskContentUnits: "objectBoundingBox",
2436
+ children: t12
2437
+ }, void 0, false);
2438
+ $[25] = t10;
2439
+ $[26] = t12;
2440
+ $[27] = t13;
2441
+ } else {
2442
+ t13 = $[27];
2443
+ }
2444
+ const t14 = `${id}-duotone-${dataKey}`;
2445
+ const t15 = `url(#${id}-duotone-colors-${dataKey})`;
2446
+ const t16 = `url(#${id}-duotone-mask-${dataKey})`;
2447
+ let t17;
2448
+ if ($[28] !== t15 || $[29] !== t16) {
2449
+ t17 = /* @__PURE__ */ jsxDEV("rect", {
2450
+ fill: t15,
2451
+ height: "1",
2452
+ mask: t16,
2453
+ width: "1",
2454
+ x: "0",
2455
+ y: "0"
2456
+ }, void 0, false);
2457
+ $[28] = t15;
2458
+ $[29] = t16;
2459
+ $[30] = t17;
2460
+ } else {
2461
+ t17 = $[30];
2462
+ }
2463
+ let t18;
2464
+ if ($[31] !== t14 || $[32] !== t17) {
2465
+ t18 = /* @__PURE__ */ jsxDEV("pattern", {
2466
+ height: "1",
2467
+ id: t14,
2468
+ patternContentUnits: "objectBoundingBox",
2469
+ patternUnits: "objectBoundingBox",
2470
+ width: "1",
2471
+ children: t17
2472
+ }, void 0, false);
2473
+ $[31] = t14;
2474
+ $[32] = t17;
2475
+ $[33] = t18;
2476
+ } else {
2477
+ t18 = $[33];
2478
+ }
2479
+ let t19;
2480
+ if ($[34] !== t13 || $[35] !== t18 || $[36] !== t8 || $[37] !== t9) {
2481
+ t19 = /* @__PURE__ */ jsxDEV(Fragment, {
2482
+ children: [t8, t9, t13, t18]
2483
+ }, void 0, true);
2484
+ $[34] = t13;
2485
+ $[35] = t18;
2486
+ $[36] = t8;
2487
+ $[37] = t9;
2488
+ $[38] = t19;
2489
+ } else {
2490
+ t19 = $[38];
2491
+ }
2492
+ return t19;
2493
+ };
2494
+ const DuotoneReversePattern = (t0) => {
2495
+ const $ = c(39);
2496
+ const {
2497
+ id,
2498
+ dataKey,
2499
+ config
2500
+ } = t0;
2501
+ let t1;
2502
+ let t2;
2503
+ let t3;
2504
+ let t4;
2505
+ let t5;
2506
+ let t6;
2507
+ let t7;
2508
+ let t8;
2509
+ if ($[0] !== config || $[1] !== dataKey || $[2] !== id) {
2510
+ const colorsCount = getColorsCount(config[dataKey] ?? {});
2511
+ const t92 = `${id}-duotone-reverse-mask-gradient-${dataKey}`;
2512
+ let t102;
2513
+ let t112;
2514
+ if ($[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2515
+ t102 = /* @__PURE__ */ jsxDEV("stop", {
2516
+ offset: "50%",
2517
+ stopColor: "white",
2518
+ stopOpacity: 1
2519
+ }, void 0, false);
2520
+ t112 = /* @__PURE__ */ jsxDEV("stop", {
2521
+ offset: "50%",
2522
+ stopColor: "white",
2523
+ stopOpacity: 0.4
2524
+ }, void 0, false);
2525
+ $[11] = t102;
2526
+ $[12] = t112;
2527
+ } else {
2528
+ t102 = $[11];
2529
+ t112 = $[12];
2530
+ }
2531
+ if ($[13] !== t92) {
2532
+ t8 = /* @__PURE__ */ jsxDEV("linearGradient", {
2533
+ gradientUnits: "objectBoundingBox",
2534
+ id: t92,
2535
+ x1: "0",
2536
+ x2: "1",
2537
+ y1: "0",
2538
+ y2: "0",
2539
+ children: [t102, t112]
2540
+ }, void 0, true);
2541
+ $[13] = t92;
2542
+ $[14] = t8;
2543
+ } else {
2544
+ t8 = $[14];
2545
+ }
2546
+ t1 = "objectBoundingBox";
2547
+ t2 = `${id}-duotone-reverse-colors-${dataKey}`;
2548
+ t3 = "0";
2549
+ t4 = "0";
2550
+ t5 = "0";
2551
+ t6 = "1";
2552
+ t7 = colorsCount === 1 ? /* @__PURE__ */ jsxDEV(Fragment, {
2553
+ children: [/* @__PURE__ */ jsxDEV("stop", {
2554
+ offset: "0%",
2555
+ stopColor: `var(--color-${dataKey}-0)`
2556
+ }, void 0, false), /* @__PURE__ */ jsxDEV("stop", {
2557
+ offset: "100%",
2558
+ stopColor: `var(--color-${dataKey}-0)`
2559
+ }, void 0, false)]
2560
+ }, void 0, true) : Array.from({
2561
+ length: colorsCount
2562
+ }, (_, index) => {
2563
+ const offset = `${index / (colorsCount - 1) * 100}%`;
2564
+ return /* @__PURE__ */ jsxDEV("stop", {
2565
+ offset,
2566
+ stopColor: `var(--color-${dataKey}-${index}, var(--color-${dataKey}-0))`
2567
+ }, offset, false);
2568
+ });
2569
+ $[0] = config;
2570
+ $[1] = dataKey;
2571
+ $[2] = id;
2572
+ $[3] = t1;
2573
+ $[4] = t2;
2574
+ $[5] = t3;
2575
+ $[6] = t4;
2576
+ $[7] = t5;
2577
+ $[8] = t6;
2578
+ $[9] = t7;
2579
+ $[10] = t8;
2580
+ } else {
2581
+ t1 = $[3];
2582
+ t2 = $[4];
2583
+ t3 = $[5];
2584
+ t4 = $[6];
2585
+ t5 = $[7];
2586
+ t6 = $[8];
2587
+ t7 = $[9];
2588
+ t8 = $[10];
2589
+ }
2590
+ let t9;
2591
+ if ($[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6 || $[21] !== t7) {
2592
+ t9 = /* @__PURE__ */ jsxDEV("linearGradient", {
2593
+ gradientUnits: t1,
2594
+ id: t2,
2595
+ x1: t3,
2596
+ x2: t4,
2597
+ y1: t5,
2598
+ y2: t6,
2599
+ children: t7
2600
+ }, void 0, false);
2601
+ $[15] = t1;
2602
+ $[16] = t2;
2603
+ $[17] = t3;
2604
+ $[18] = t4;
2605
+ $[19] = t5;
2606
+ $[20] = t6;
2607
+ $[21] = t7;
2608
+ $[22] = t9;
2609
+ } else {
2610
+ t9 = $[22];
2611
+ }
2612
+ const t10 = `${id}-duotone-reverse-mask-${dataKey}`;
2613
+ const t11 = `url(#${id}-duotone-reverse-mask-gradient-${dataKey})`;
2614
+ let t12;
2615
+ if ($[23] !== t11) {
2616
+ t12 = /* @__PURE__ */ jsxDEV("rect", {
2617
+ fill: t11,
2618
+ height: "1",
2619
+ width: "1",
2620
+ x: "0",
2621
+ y: "0"
2622
+ }, void 0, false);
2623
+ $[23] = t11;
2624
+ $[24] = t12;
2625
+ } else {
2626
+ t12 = $[24];
2627
+ }
2628
+ let t13;
2629
+ if ($[25] !== t10 || $[26] !== t12) {
2630
+ t13 = /* @__PURE__ */ jsxDEV("mask", {
2631
+ id: t10,
2632
+ maskContentUnits: "objectBoundingBox",
2633
+ children: t12
2634
+ }, void 0, false);
2635
+ $[25] = t10;
2636
+ $[26] = t12;
2637
+ $[27] = t13;
2638
+ } else {
2639
+ t13 = $[27];
2640
+ }
2641
+ const t14 = `${id}-duotone-reverse-${dataKey}`;
2642
+ const t15 = `url(#${id}-duotone-reverse-colors-${dataKey})`;
2643
+ const t16 = `url(#${id}-duotone-reverse-mask-${dataKey})`;
2644
+ let t17;
2645
+ if ($[28] !== t15 || $[29] !== t16) {
2646
+ t17 = /* @__PURE__ */ jsxDEV("rect", {
2647
+ fill: t15,
2648
+ height: "1",
2649
+ mask: t16,
2650
+ width: "1",
2651
+ x: "0",
2652
+ y: "0"
2653
+ }, void 0, false);
2654
+ $[28] = t15;
2655
+ $[29] = t16;
2656
+ $[30] = t17;
2657
+ } else {
2658
+ t17 = $[30];
2659
+ }
2660
+ let t18;
2661
+ if ($[31] !== t14 || $[32] !== t17) {
2662
+ t18 = /* @__PURE__ */ jsxDEV("pattern", {
2663
+ height: "1",
2664
+ id: t14,
2665
+ patternContentUnits: "objectBoundingBox",
2666
+ patternUnits: "objectBoundingBox",
2667
+ width: "1",
2668
+ children: t17
2669
+ }, void 0, false);
2670
+ $[31] = t14;
2671
+ $[32] = t17;
2672
+ $[33] = t18;
2673
+ } else {
2674
+ t18 = $[33];
2675
+ }
2676
+ let t19;
2677
+ if ($[34] !== t13 || $[35] !== t18 || $[36] !== t8 || $[37] !== t9) {
2678
+ t19 = /* @__PURE__ */ jsxDEV(Fragment, {
2679
+ children: [t8, t9, t13, t18]
2680
+ }, void 0, true);
2681
+ $[34] = t13;
2682
+ $[35] = t18;
2683
+ $[36] = t8;
2684
+ $[37] = t9;
2685
+ $[38] = t19;
2686
+ } else {
2687
+ t19 = $[38];
2688
+ }
2689
+ return t19;
2690
+ };
2691
+ const GradientPattern = (t0) => {
2692
+ const $ = c(19);
2693
+ const {
2694
+ id,
2695
+ dataKey
2696
+ } = t0;
2697
+ const t1 = `${id}-gradient-mask-gradient`;
2698
+ let t2;
2699
+ let t3;
2700
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2701
+ t2 = /* @__PURE__ */ jsxDEV("stop", {
2702
+ offset: "20%",
2703
+ stopColor: "white",
2704
+ stopOpacity: 1
2705
+ }, void 0, false);
2706
+ t3 = /* @__PURE__ */ jsxDEV("stop", {
2707
+ offset: "90%",
2708
+ stopColor: "white",
2709
+ stopOpacity: 0
2710
+ }, void 0, false);
2711
+ $[0] = t2;
2712
+ $[1] = t3;
2713
+ } else {
2714
+ t2 = $[0];
2715
+ t3 = $[1];
2716
+ }
2717
+ let t4;
2718
+ if ($[2] !== t1) {
2719
+ t4 = /* @__PURE__ */ jsxDEV("linearGradient", {
2720
+ id: t1,
2721
+ x1: "0",
2722
+ x2: "0",
2723
+ y1: "0",
2724
+ y2: "1",
2725
+ children: [t2, t3]
2726
+ }, void 0, true);
2727
+ $[2] = t1;
2728
+ $[3] = t4;
2729
+ } else {
2730
+ t4 = $[3];
2731
+ }
2732
+ const t5 = `${id}-gradient-mask-${dataKey}`;
2733
+ const t6 = `url(#${id}-gradient-mask-gradient)`;
2734
+ let t7;
2735
+ if ($[4] !== t6) {
2736
+ t7 = /* @__PURE__ */ jsxDEV("rect", {
2737
+ fill: t6,
2738
+ height: "100%",
2739
+ width: "100%"
2740
+ }, void 0, false);
2741
+ $[4] = t6;
2742
+ $[5] = t7;
2743
+ } else {
2744
+ t7 = $[5];
2745
+ }
2746
+ let t8;
2747
+ if ($[6] !== t5 || $[7] !== t7) {
2748
+ t8 = /* @__PURE__ */ jsxDEV("mask", {
2749
+ id: t5,
2750
+ children: t7
2751
+ }, void 0, false);
2752
+ $[6] = t5;
2753
+ $[7] = t7;
2754
+ $[8] = t8;
2755
+ } else {
2756
+ t8 = $[8];
2757
+ }
2758
+ const t9 = `${id}-gradient-${dataKey}`;
2759
+ const t10 = `url(#${id}-colors-${dataKey})`;
2760
+ const t11 = `url(#${id}-gradient-mask-${dataKey})`;
2761
+ let t12;
2762
+ if ($[9] !== t10 || $[10] !== t11) {
2763
+ t12 = /* @__PURE__ */ jsxDEV("rect", {
2764
+ fill: t10,
2765
+ height: "100%",
2766
+ mask: t11,
2767
+ width: "100%"
2768
+ }, void 0, false);
2769
+ $[9] = t10;
2770
+ $[10] = t11;
2771
+ $[11] = t12;
2772
+ } else {
2773
+ t12 = $[11];
2774
+ }
2775
+ let t13;
2776
+ if ($[12] !== t12 || $[13] !== t9) {
2777
+ t13 = /* @__PURE__ */ jsxDEV("pattern", {
2778
+ height: "100%",
2779
+ id: t9,
2780
+ patternUnits: "userSpaceOnUse",
2781
+ width: "100%",
2782
+ children: t12
2783
+ }, void 0, false);
2784
+ $[12] = t12;
2785
+ $[13] = t9;
2786
+ $[14] = t13;
2787
+ } else {
2788
+ t13 = $[14];
2789
+ }
2790
+ let t14;
2791
+ if ($[15] !== t13 || $[16] !== t4 || $[17] !== t8) {
2792
+ t14 = /* @__PURE__ */ jsxDEV(Fragment, {
2793
+ children: [t4, t8, t13]
2794
+ }, void 0, true);
2795
+ $[15] = t13;
2796
+ $[16] = t4;
2797
+ $[17] = t8;
2798
+ $[18] = t14;
2799
+ } else {
2800
+ t14 = $[18];
2801
+ }
2802
+ return t14;
2803
+ };
2804
+ const StrippedPattern = (t0) => {
2805
+ const $ = c(19);
2806
+ const {
2807
+ id,
2808
+ dataKey
2809
+ } = t0;
2810
+ const t1 = `${id}-stripped-mask-gradient`;
2811
+ let t2;
2812
+ let t3;
2813
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2814
+ t2 = /* @__PURE__ */ jsxDEV("stop", {
2815
+ offset: "0%",
2816
+ stopColor: "white",
2817
+ stopOpacity: 0.2
2818
+ }, void 0, false);
2819
+ t3 = /* @__PURE__ */ jsxDEV("stop", {
2820
+ offset: "100%",
2821
+ stopColor: "white",
2822
+ stopOpacity: 0.2
2823
+ }, void 0, false);
2824
+ $[0] = t2;
2825
+ $[1] = t3;
2826
+ } else {
2827
+ t2 = $[0];
2828
+ t3 = $[1];
2829
+ }
2830
+ let t4;
2831
+ if ($[2] !== t1) {
2832
+ t4 = /* @__PURE__ */ jsxDEV("linearGradient", {
2833
+ id: t1,
2834
+ x1: "0",
2835
+ x2: "0",
2836
+ y1: "0",
2837
+ y2: "1",
2838
+ children: [t2, t3]
2839
+ }, void 0, true);
2840
+ $[2] = t1;
2841
+ $[3] = t4;
2842
+ } else {
2843
+ t4 = $[3];
2844
+ }
2845
+ const t5 = `${id}-stripped-mask-${dataKey}`;
2846
+ const t6 = `url(#${id}-stripped-mask-gradient)`;
2847
+ let t7;
2848
+ if ($[4] !== t6) {
2849
+ t7 = /* @__PURE__ */ jsxDEV("rect", {
2850
+ fill: t6,
2851
+ height: "100%",
2852
+ width: "100%"
2853
+ }, void 0, false);
2854
+ $[4] = t6;
2855
+ $[5] = t7;
2856
+ } else {
2857
+ t7 = $[5];
2858
+ }
2859
+ let t8;
2860
+ if ($[6] !== t5 || $[7] !== t7) {
2861
+ t8 = /* @__PURE__ */ jsxDEV("mask", {
2862
+ id: t5,
2863
+ children: t7
2864
+ }, void 0, false);
2865
+ $[6] = t5;
2866
+ $[7] = t7;
2867
+ $[8] = t8;
2868
+ } else {
2869
+ t8 = $[8];
2870
+ }
2871
+ const t9 = `${id}-stripped-${dataKey}`;
2872
+ const t10 = `url(#${id}-colors-${dataKey})`;
2873
+ const t11 = `url(#${id}-stripped-mask-${dataKey})`;
2874
+ let t12;
2875
+ if ($[9] !== t10 || $[10] !== t11) {
2876
+ t12 = /* @__PURE__ */ jsxDEV("rect", {
2877
+ fill: t10,
2878
+ height: "100%",
2879
+ mask: t11,
2880
+ width: "100%"
2881
+ }, void 0, false);
2882
+ $[9] = t10;
2883
+ $[10] = t11;
2884
+ $[11] = t12;
2885
+ } else {
2886
+ t12 = $[11];
2887
+ }
2888
+ let t13;
2889
+ if ($[12] !== t12 || $[13] !== t9) {
2890
+ t13 = /* @__PURE__ */ jsxDEV("pattern", {
2891
+ height: "100%",
2892
+ id: t9,
2893
+ patternUnits: "userSpaceOnUse",
2894
+ width: "100%",
2895
+ children: t12
2896
+ }, void 0, false);
2897
+ $[12] = t12;
2898
+ $[13] = t9;
2899
+ $[14] = t13;
2900
+ } else {
2901
+ t13 = $[14];
2902
+ }
2903
+ let t14;
2904
+ if ($[15] !== t13 || $[16] !== t4 || $[17] !== t8) {
2905
+ t14 = /* @__PURE__ */ jsxDEV(Fragment, {
2906
+ children: [t4, t8, t13]
2907
+ }, void 0, true);
2908
+ $[15] = t13;
2909
+ $[16] = t4;
2910
+ $[17] = t8;
2911
+ $[18] = t14;
2912
+ } else {
2913
+ t14 = $[18];
2914
+ }
2915
+ return t14;
2916
+ };
2917
+ const GlowFilter = (t0) => {
2918
+ const $ = c(5);
2919
+ const {
2920
+ id,
2921
+ dataKey
2922
+ } = t0;
2923
+ const t1 = `${id}-bar-glow-${dataKey}`;
2924
+ let t2;
2925
+ let t3;
2926
+ let t4;
2927
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
2928
+ t2 = /* @__PURE__ */ jsxDEV("feGaussianBlur", {
2929
+ in: "SourceGraphic",
2930
+ result: "blur",
2931
+ stdDeviation: "8"
2932
+ }, void 0, false);
2933
+ t3 = /* @__PURE__ */ jsxDEV("feColorMatrix", {
2934
+ in: "blur",
2935
+ result: "glow",
2936
+ type: "matrix",
2937
+ values: "1 0 0 0 0\n 0 1 0 0 0\n 0 0 1 0 0\n 0 0 0 0.5 0"
2938
+ }, void 0, false);
2939
+ t4 = /* @__PURE__ */ jsxDEV("feMerge", {
2940
+ children: [/* @__PURE__ */ jsxDEV("feMergeNode", {
2941
+ in: "glow"
2942
+ }, void 0, false), /* @__PURE__ */ jsxDEV("feMergeNode", {
2943
+ in: "SourceGraphic"
2944
+ }, void 0, false)]
2945
+ }, void 0, true);
2946
+ $[0] = t2;
2947
+ $[1] = t3;
2948
+ $[2] = t4;
2949
+ } else {
2950
+ t2 = $[0];
2951
+ t3 = $[1];
2952
+ t4 = $[2];
2953
+ }
2954
+ let t5;
2955
+ if ($[3] !== t1) {
2956
+ t5 = /* @__PURE__ */ jsxDEV("filter", {
2957
+ height: "300%",
2958
+ id: t1,
2959
+ width: "300%",
2960
+ x: "-100%",
2961
+ y: "-100%",
2962
+ children: [t2, t3, t4]
2963
+ }, void 0, true);
2964
+ $[3] = t1;
2965
+ $[4] = t5;
2966
+ } else {
2967
+ t5 = $[4];
2968
+ }
2969
+ return t5;
2970
+ };
2971
+ const generateEasedGradientStops = (steps = 17, minOpacity = 0.05, maxOpacity = 0.9) => Array.from({
2972
+ length: steps
2973
+ }, (_, i) => {
2974
+ const t = i / (steps - 1);
2975
+ const eased = Math.sin(t * Math.PI) ** 2;
2976
+ const opacity = minOpacity + eased * (maxOpacity - minOpacity);
2977
+ return {
2978
+ offset: `${(t * 100).toFixed(0)}%`,
2979
+ opacity: Number(opacity.toFixed(3))
2980
+ };
2981
+ });
2982
+ function useLoadingData(isLoading, t0) {
2983
+ const $ = c(8);
2984
+ const loadingBars = t0 === void 0 ? 12 : t0;
2985
+ const [, setLoadingDataKey] = useState(false);
2986
+ let t1;
2987
+ if ($[0] !== isLoading || $[1] !== setLoadingDataKey) {
2988
+ t1 = () => {
2989
+ if (isLoading) {
2990
+ setLoadingDataKey(_temp);
2991
+ }
2992
+ };
2993
+ $[0] = isLoading;
2994
+ $[1] = setLoadingDataKey;
2995
+ $[2] = t1;
2996
+ } else {
2997
+ t1 = $[2];
2998
+ }
2999
+ const onShimmerExit = t1;
3000
+ let t2;
3001
+ if ($[3] !== loadingBars) {
3002
+ t2 = getLoadingData(loadingBars, 20, 80);
3003
+ $[3] = loadingBars;
3004
+ $[4] = t2;
3005
+ } else {
3006
+ t2 = $[4];
3007
+ }
3008
+ const loadingData = t2;
3009
+ let t3;
3010
+ if ($[5] !== loadingData || $[6] !== onShimmerExit) {
3011
+ t3 = {
3012
+ loadingData,
3013
+ onShimmerExit
3014
+ };
3015
+ $[5] = loadingData;
3016
+ $[6] = onShimmerExit;
3017
+ $[7] = t3;
3018
+ } else {
3019
+ t3 = $[7];
3020
+ }
3021
+ return t3;
3022
+ }
3023
+ function _temp(previous) {
3024
+ return !previous;
3025
+ }
3026
+ const LoadingBar = (t0) => {
3027
+ const $ = c(8);
3028
+ const {
3029
+ chartId,
3030
+ onShimmerExit
3031
+ } = t0;
3032
+ const t1 = `url(#${chartId}-loading-mask)`;
3033
+ let t2;
3034
+ if ($[0] !== t1) {
3035
+ t2 = /* @__PURE__ */ jsxDEV(Bar$1, {
3036
+ dataKey: LOADING_BAR_DATA_KEY,
3037
+ fill: "currentColor",
3038
+ fillOpacity: 0.15,
3039
+ isAnimationActive: false,
3040
+ legendType: "none",
3041
+ radius: DEFAULT_BAR_RADIUS,
3042
+ style: {
3043
+ mask: t1
3044
+ }
3045
+ }, void 0, false);
3046
+ $[0] = t1;
3047
+ $[1] = t2;
3048
+ } else {
3049
+ t2 = $[1];
3050
+ }
3051
+ let t3;
3052
+ if ($[2] !== chartId || $[3] !== onShimmerExit) {
3053
+ t3 = /* @__PURE__ */ jsxDEV("defs", {
3054
+ children: /* @__PURE__ */ jsxDEV(LoadingBarPattern, {
3055
+ chartId,
3056
+ onShimmerExit
3057
+ }, void 0, false)
3058
+ }, void 0, false);
3059
+ $[2] = chartId;
3060
+ $[3] = onShimmerExit;
3061
+ $[4] = t3;
3062
+ } else {
3063
+ t3 = $[4];
3064
+ }
3065
+ let t4;
3066
+ if ($[5] !== t2 || $[6] !== t3) {
3067
+ t4 = /* @__PURE__ */ jsxDEV(Fragment, {
3068
+ children: [t2, t3]
3069
+ }, void 0, true);
3070
+ $[5] = t2;
3071
+ $[6] = t3;
3072
+ $[7] = t4;
3073
+ } else {
3074
+ t4 = $[7];
3075
+ }
3076
+ return t4;
3077
+ };
3078
+ const LoadingBarPattern = (t0) => {
3079
+ const $ = c(23);
3080
+ const {
3081
+ chartId,
3082
+ onShimmerExit
3083
+ } = t0;
3084
+ const gradientStops = generateEasedGradientStops();
3085
+ const lastXRef = useRef(-1);
3086
+ const t1 = `${chartId}-loading-mask-gradient`;
3087
+ const t2 = "0";
3088
+ const t3 = "1";
3089
+ const t4 = "0";
3090
+ const t5 = "0";
3091
+ const t6 = gradientStops.map(_temp2);
3092
+ let t7;
3093
+ if ($[0] !== t1 || $[1] !== t6) {
3094
+ t7 = /* @__PURE__ */ jsxDEV("linearGradient", {
3095
+ id: t1,
3096
+ x1: t2,
3097
+ x2: t3,
3098
+ y1: t4,
3099
+ y2: t5,
3100
+ children: t6
3101
+ }, void 0, false);
3102
+ $[0] = t1;
3103
+ $[1] = t6;
3104
+ $[2] = t7;
3105
+ } else {
3106
+ t7 = $[2];
3107
+ }
3108
+ const t8 = `${chartId}-loading-mask-pattern`;
3109
+ let t9;
3110
+ if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3111
+ t9 = {
3112
+ x: 2
3113
+ };
3114
+ $[3] = t9;
3115
+ } else {
3116
+ t9 = $[3];
3117
+ }
3118
+ const t10 = `url(#${chartId}-loading-mask-gradient)`;
3119
+ let t11;
3120
+ if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3121
+ t11 = {
3122
+ x: -1
3123
+ };
3124
+ $[4] = t11;
3125
+ } else {
3126
+ t11 = $[4];
3127
+ }
3128
+ let t12;
3129
+ if ($[5] !== onShimmerExit) {
3130
+ t12 = (latest) => {
3131
+ const xValue = typeof latest.x === "number" ? latest.x : -1;
3132
+ const lastX = lastXRef.current;
3133
+ if (xValue >= 1 && lastX < 1) {
3134
+ onShimmerExit();
3135
+ }
3136
+ lastXRef.current = xValue;
3137
+ };
3138
+ $[5] = onShimmerExit;
3139
+ $[6] = t12;
3140
+ } else {
3141
+ t12 = $[6];
3142
+ }
3143
+ let t13;
3144
+ if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
3145
+ t13 = {
3146
+ duration: LOADING_ANIMATION_DURATION / 1e3,
3147
+ ease: "linear",
3148
+ repeat: Infinity,
3149
+ repeatType: "loop"
3150
+ };
3151
+ $[7] = t13;
3152
+ } else {
3153
+ t13 = $[7];
3154
+ }
3155
+ let t14;
3156
+ if ($[8] !== t10 || $[9] !== t12) {
3157
+ t14 = /* @__PURE__ */ jsxDEV(motion.rect, {
3158
+ animate: t9,
3159
+ fill: t10,
3160
+ height: "1",
3161
+ initial: t11,
3162
+ onUpdate: t12,
3163
+ transition: t13,
3164
+ width: "1",
3165
+ y: "0"
3166
+ }, void 0, false);
3167
+ $[8] = t10;
3168
+ $[9] = t12;
3169
+ $[10] = t14;
3170
+ } else {
3171
+ t14 = $[10];
3172
+ }
3173
+ let t15;
3174
+ if ($[11] !== t14 || $[12] !== t8) {
3175
+ t15 = /* @__PURE__ */ jsxDEV("pattern", {
3176
+ height: "1",
3177
+ id: t8,
3178
+ patternContentUnits: "objectBoundingBox",
3179
+ patternTransform: "rotate(25)",
3180
+ patternUnits: "objectBoundingBox",
3181
+ width: 3,
3182
+ x: "0",
3183
+ y: "0",
3184
+ children: t14
3185
+ }, void 0, false);
3186
+ $[11] = t14;
3187
+ $[12] = t8;
3188
+ $[13] = t15;
3189
+ } else {
3190
+ t15 = $[13];
3191
+ }
3192
+ const t16 = `${chartId}-loading-mask`;
3193
+ const t17 = `url(#${chartId}-loading-mask-pattern)`;
3194
+ let t18;
3195
+ if ($[14] !== t17) {
3196
+ t18 = /* @__PURE__ */ jsxDEV("rect", {
3197
+ fill: t17,
3198
+ height: "100%",
3199
+ width: "100%"
3200
+ }, void 0, false);
3201
+ $[14] = t17;
3202
+ $[15] = t18;
3203
+ } else {
3204
+ t18 = $[15];
3205
+ }
3206
+ let t19;
3207
+ if ($[16] !== t16 || $[17] !== t18) {
3208
+ t19 = /* @__PURE__ */ jsxDEV("mask", {
3209
+ id: t16,
3210
+ maskUnits: "userSpaceOnUse",
3211
+ children: t18
3212
+ }, void 0, false);
3213
+ $[16] = t16;
3214
+ $[17] = t18;
3215
+ $[18] = t19;
3216
+ } else {
3217
+ t19 = $[18];
3218
+ }
3219
+ let t20;
3220
+ if ($[19] !== t15 || $[20] !== t19 || $[21] !== t7) {
3221
+ t20 = /* @__PURE__ */ jsxDEV(Fragment, {
3222
+ children: [t7, t15, t19]
3223
+ }, void 0, true);
3224
+ $[19] = t15;
3225
+ $[20] = t19;
3226
+ $[21] = t7;
3227
+ $[22] = t20;
3228
+ } else {
3229
+ t20 = $[22];
3230
+ }
3231
+ return t20;
3232
+ };
3233
+ function _temp2(t0) {
3234
+ const {
3235
+ offset,
3236
+ opacity
3237
+ } = t0;
3238
+ return /* @__PURE__ */ jsxDEV("stop", {
3239
+ offset,
3240
+ stopColor: "white",
3241
+ stopOpacity: opacity
3242
+ }, offset, false);
3243
+ }
3244
+
3245
+ export { Bar as B, EvilBarChart as E, Tooltip as T, XAxis as X };