@nice2dev/ui 1.0.16 → 1.0.17

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 (42) hide show
  1. package/dist/NiceErrorBoundary-B1Y6X3Ya.js +762 -0
  2. package/dist/NiceErrorBoundary-DM5IMdOr.cjs +1 -0
  3. package/dist/NiceForm-BSkm9-yP.js +5357 -0
  4. package/dist/NiceForm-DDN-yf30.cjs +382 -0
  5. package/dist/NiceModal-9uxWPAE_.cjs +1 -0
  6. package/dist/NiceModal-BPDP1Fi-.js +95 -0
  7. package/dist/NiceModuleLifecyclePanel-DF0Ay1oH.js +6349 -0
  8. package/dist/NiceModuleLifecyclePanel-g_ZVFzoE.cjs +1 -0
  9. package/dist/NicePagination-D829pF7A.cjs +1 -0
  10. package/dist/NicePagination-D89Kst8b.js +171 -0
  11. package/dist/NicePinCodeInput-Bf_QcaPW.cjs +419 -0
  12. package/dist/NicePinCodeInput-Co42gC9R.js +11875 -0
  13. package/dist/NiceSavedQueryPanel-BuvMBwIf.cjs +596 -0
  14. package/dist/NiceSavedQueryPanel-DR-j6eA5.js +6446 -0
  15. package/dist/NiceTabs-B6E7-er3.cjs +1 -0
  16. package/dist/NiceTabs-J2zAw8vC.js +1624 -0
  17. package/dist/NiceWindow-6F_z4_18.js +1409 -0
  18. package/dist/NiceWindow-Bnh6rKt4.cjs +1 -0
  19. package/dist/charts-DXkFBiD4.cjs +761 -0
  20. package/dist/charts-SHnY1_oD.js +4645 -0
  21. package/dist/charts.cjs +1 -1
  22. package/dist/charts.mjs +1 -1
  23. package/dist/core-Dpfb_THi.js +22316 -0
  24. package/dist/core-DqlrEV-9.cjs +96 -0
  25. package/dist/data.cjs +1 -1
  26. package/dist/data.mjs +1 -1
  27. package/dist/editors.cjs +1 -1
  28. package/dist/editors.mjs +3 -3
  29. package/dist/feedback.cjs +1 -1
  30. package/dist/feedback.mjs +2 -2
  31. package/dist/index-GIkNMdRp.js +61439 -0
  32. package/dist/index-pQGuLKEE.cjs +5194 -0
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.mjs +12 -12
  35. package/dist/lazy.cjs +1 -1
  36. package/dist/lazy.mjs +3 -3
  37. package/dist/navigation.cjs +1 -1
  38. package/dist/navigation.mjs +4 -4
  39. package/dist/overlays.cjs +1 -1
  40. package/dist/overlays.mjs +2 -2
  41. package/dist/style.css +22 -7
  42. package/package.json +3 -3
@@ -0,0 +1,4645 @@
1
+ import { jsx as e, jsxs as $, Fragment as Pe } from "react/jsx-runtime";
2
+ import Fe, { useRef as be, useState as oe, useMemo as pe, useCallback as ae, forwardRef as Ne, useEffect as Ce, useImperativeHandle as Ae } from "react";
3
+ import { $ as Ve, i as Xe, C as Ze, k as ze } from "./core-Dpfb_THi.js";
4
+ const ke = [
5
+ "var(--color-primary, #3b82f6)",
6
+ "var(--color-error, #ef4444)",
7
+ "var(--color-success, #22c55e)",
8
+ "var(--color-warning, #f59e0b)",
9
+ "var(--color-accent, #8b5cf6)",
10
+ "var(--color-accent-pink, #ec4899)",
11
+ "var(--color-info, #06b6d4)",
12
+ "var(--nice-success, #84cc16)"
13
+ ], Re = ({
14
+ series: t,
15
+ categories: o,
16
+ width: i = 600,
17
+ height: s = 400,
18
+ title: c,
19
+ showLegend: v = !0,
20
+ showGrid: p = !0,
21
+ axisLabels: I = !0,
22
+ yAxisLabel: T,
23
+ xAxisLabel: w,
24
+ stacked: f,
25
+ animated: N,
26
+ zoomable: z,
27
+ crosshair: C,
28
+ annotations: k,
29
+ legendInteractive: l,
30
+ onDataPointClick: d,
31
+ exportable: u,
32
+ className: S,
33
+ style: g
34
+ }) => {
35
+ const x = be(null), [y, b] = oe(/* @__PURE__ */ new Set()), [h, D] = oe(null), [a, _] = oe(null), [A, O] = oe(!1), U = be(null), V = pe(
36
+ () => t.filter((B) => !y.has(B.name)),
37
+ [t, y]
38
+ ), j = ae(
39
+ (B) => {
40
+ l && b((re) => {
41
+ const ce = new Set(re);
42
+ return ce.has(B) ? ce.delete(B) : ce.add(B), ce;
43
+ });
44
+ },
45
+ [l]
46
+ ), G = {
47
+ top: c ? 40 : 20,
48
+ right: 20,
49
+ bottom: w ? 60 : 40,
50
+ left: T ? 60 : 50
51
+ }, Q = i - G.left - G.right, q = s - G.top - G.bottom, J = V[0]?.data.length ?? t[0]?.data.length ?? 0, n = a?.start ?? 0, X = a?.end ?? J, H = X - n, W = pe(
52
+ () => V.map((B) => ({ ...B, data: B.data.slice(n, X) })),
53
+ [V, n, X]
54
+ ), m = pe(
55
+ () => o?.slice(n, X),
56
+ [o, n, X]
57
+ ), { minY: F, maxY: Y, yTicks: ee } = pe(() => {
58
+ let B;
59
+ if (f) {
60
+ B = [];
61
+ for (let M = 0; M < H; M++)
62
+ B.push(W.reduce((K, ie) => K + (ie.data[M] || 0), 0));
63
+ } else
64
+ B = W.flatMap((M) => M.data);
65
+ B.length === 0 && (B = [0]);
66
+ const re = Math.min(0, ...B), ce = Math.max(0, ...B), se = ce - re || 1, de = Math.pow(10, Math.floor(Math.log10(se))) || 1, r = Math.floor(re / de) * de, R = Math.ceil(ce / de) * de, E = [];
67
+ for (let M = r; M <= R; M += de)
68
+ E.push(Math.round(M * 1e6) / 1e6);
69
+ return E.length < 2 && E.push(R), { minY: r, maxY: R, yTicks: E };
70
+ }, [W, H, f]), P = (B) => q - (B - F) / (Y - F || 1) * q, te = (B) => (B + 0.5) / H * Q, fe = H > 0 ? Q / H / (f ? 1.5 : Math.max(V.length, 1) * 1.5) : 20, L = ae(
71
+ (B) => {
72
+ if (!z)
73
+ return;
74
+ B.preventDefault();
75
+ const re = a ?? { start: 0, end: J }, ce = re.end - re.start, se = (re.start + re.end) / 2, de = B.deltaY > 0 ? 1.2 : 0.8, r = Math.max(2, Math.min(J, Math.round(ce * de))), R = Math.max(0, Math.round(se - r / 2)), E = Math.min(J, R + r);
76
+ _({ start: R, end: E });
77
+ },
78
+ [z, a, J]
79
+ ), Z = ae(
80
+ (B) => {
81
+ z && (O(!0), U.current = { x: B.clientX, range: a ?? { start: 0, end: J } });
82
+ },
83
+ [z, a, J]
84
+ ), ne = ae(
85
+ (B) => {
86
+ const re = x.current?.getBoundingClientRect();
87
+ if (re && D({ x: B.clientX - re.left - G.left, y: B.clientY - re.top - G.top }), A && U.current && z) {
88
+ const ce = B.clientX - U.current.x, se = Q / H, de = -Math.round(ce / se), r = U.current.range, R = r.end - r.start;
89
+ let E = r.start + de;
90
+ E < 0 && (E = 0), E + R > J && (E = J - R), _({ start: E, end: E + R });
91
+ }
92
+ },
93
+ [A, z, Q, H, J, G.left, G.top]
94
+ ), ue = ae(() => {
95
+ O(!1), U.current = null;
96
+ }, []), _e = ae(() => {
97
+ D(null), O(!1), U.current = null;
98
+ }, []), ge = ae(() => {
99
+ const B = x.current;
100
+ if (!B)
101
+ return;
102
+ const re = new XMLSerializer().serializeToString(B), ce = document.createElement("canvas");
103
+ ce.width = i, ce.height = s + (v ? 30 : 0);
104
+ const se = ce.getContext("2d");
105
+ if (!se)
106
+ return;
107
+ const de = new Image();
108
+ de.onload = () => {
109
+ se.fillStyle = "var(--bg-primary, #fff)", se.fillRect(0, 0, ce.width, ce.height), se.drawImage(de, 0, 0);
110
+ const r = document.createElement("a");
111
+ r.download = "chart.png", r.href = ce.toDataURL("image/png"), r.click();
112
+ }, de.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(re);
113
+ }, [i, s, v]), ye = s + (v ? 30 : 0), $e = W.length > 0 && W.every((B) => B.type === "radar"), Se = pe(() => {
114
+ if (!$e)
115
+ return 1;
116
+ const B = W.flatMap((re) => re.data);
117
+ return Math.max(1, ...B);
118
+ }, [$e, W]);
119
+ if ($e) {
120
+ const B = i / 2, re = (s - G.top - G.bottom) / 2 + G.top, ce = Math.min(Q, s - G.top - G.bottom) / 2 - 10, se = m?.length ?? W[0]?.data.length ?? 0, de = (E) => E / se * Math.PI * 2 - Math.PI / 2, r = (E, M) => {
121
+ const K = M / Se * ce;
122
+ return [B + Math.cos(de(E)) * K, re + Math.sin(de(E)) * K];
123
+ }, R = 4;
124
+ return /* @__PURE__ */ e("div", { className: `nice-chart nice-chart--radar ${S || ""}`, style: g, children: /* @__PURE__ */ $(
125
+ "svg",
126
+ {
127
+ ref: x,
128
+ viewBox: `0 0 ${i} ${ye}`,
129
+ preserveAspectRatio: "xMidYMid meet",
130
+ width: "100%",
131
+ height: "100%",
132
+ className: "nice-chart__svg",
133
+ style: { display: "block", maxWidth: "100%", maxHeight: "100%" },
134
+ children: [
135
+ c && /* @__PURE__ */ e("text", { x: i / 2, y: 20, textAnchor: "middle", className: "nice-chart__title", children: c }),
136
+ p && Array.from({ length: R }, (E, M) => {
137
+ const K = (M + 1) / R * ce, ie = [];
138
+ for (let le = 0; le < se; le++)
139
+ ie.push(`${B + Math.cos(de(le)) * K},${re + Math.sin(de(le)) * K}`);
140
+ return /* @__PURE__ */ e(
141
+ "polygon",
142
+ {
143
+ points: ie.join(" "),
144
+ fill: "none",
145
+ className: "nice-chart__grid-line"
146
+ },
147
+ M
148
+ );
149
+ }),
150
+ Array.from({ length: se }, (E, M) => {
151
+ const [K, ie] = r(M, Se);
152
+ return /* @__PURE__ */ e("line", { x1: B, y1: re, x2: K, y2: ie, className: "nice-chart__grid-line" }, M);
153
+ }),
154
+ I && m?.map((E, M) => {
155
+ const [K, ie] = r(M, Se * 1.12);
156
+ return /* @__PURE__ */ e(
157
+ "text",
158
+ {
159
+ x: K,
160
+ y: ie,
161
+ textAnchor: "middle",
162
+ dominantBaseline: "middle",
163
+ className: "nice-chart__axis-label",
164
+ children: E
165
+ },
166
+ M
167
+ );
168
+ }),
169
+ W.map((E, M) => {
170
+ const K = E.color || ke[M % ke.length], ie = E.data.map((le, he) => r(he, le).join(",")).join(" ");
171
+ return /* @__PURE__ */ $(
172
+ "g",
173
+ {
174
+ className: N ? "nice-chart__series nice-chart__series--radar nice-chart__series--anim" : "nice-chart__series nice-chart__series--radar",
175
+ children: [
176
+ /* @__PURE__ */ e(
177
+ "polygon",
178
+ {
179
+ points: ie,
180
+ fill: K,
181
+ fillOpacity: 0.2,
182
+ stroke: K,
183
+ strokeWidth: 2
184
+ }
185
+ ),
186
+ E.data.map((le, he) => {
187
+ const [we, Me] = r(he, le);
188
+ return /* @__PURE__ */ e("circle", { cx: we, cy: Me, r: 3, fill: K, children: /* @__PURE__ */ e("title", { children: `${E.name}: ${le}` }) }, he);
189
+ })
190
+ ]
191
+ },
192
+ E.name
193
+ );
194
+ }),
195
+ v && /* @__PURE__ */ e("g", { transform: `translate(${G.left}, ${s})`, children: t.map((E, M) => {
196
+ const K = M * 120, ie = y.has(E.name);
197
+ return /* @__PURE__ */ $(
198
+ "g",
199
+ {
200
+ transform: `translate(${K}, 10)`,
201
+ style: l ? { cursor: "pointer" } : void 0,
202
+ onClick: () => j(E.name),
203
+ opacity: ie ? 0.35 : 1,
204
+ children: [
205
+ /* @__PURE__ */ e(
206
+ "rect",
207
+ {
208
+ width: 12,
209
+ height: 12,
210
+ rx: 2,
211
+ fill: E.color || ke[M % ke.length]
212
+ }
213
+ ),
214
+ /* @__PURE__ */ e("text", { x: 16, y: 10, className: "nice-chart__legend-text", children: E.name })
215
+ ]
216
+ },
217
+ E.name
218
+ );
219
+ }) })
220
+ ]
221
+ }
222
+ ) });
223
+ }
224
+ return /* @__PURE__ */ $("div", { className: `nice-chart ${S || ""}`, style: g, children: [
225
+ u && /* @__PURE__ */ e(
226
+ "button",
227
+ {
228
+ type: "button",
229
+ className: "nice-chart__export-btn",
230
+ onClick: ge,
231
+ title: "Export PNG",
232
+ children: "📷"
233
+ }
234
+ ),
235
+ /* @__PURE__ */ $(
236
+ "svg",
237
+ {
238
+ ref: x,
239
+ viewBox: `0 0 ${i} ${ye}`,
240
+ preserveAspectRatio: "xMidYMid meet",
241
+ width: "100%",
242
+ height: "100%",
243
+ style: { display: "block", maxWidth: "100%", maxHeight: "100%" },
244
+ className: "nice-chart__svg",
245
+ onWheel: L,
246
+ onMouseDown: Z,
247
+ onMouseMove: ne,
248
+ onMouseUp: ue,
249
+ onMouseLeave: _e,
250
+ children: [
251
+ /* @__PURE__ */ $("g", { transform: `translate(${G.left},${G.top})`, children: [
252
+ c && /* @__PURE__ */ e("text", { x: Q / 2, y: -10, textAnchor: "middle", className: "nice-chart__title", children: c }),
253
+ p && ee.map((B) => /* @__PURE__ */ e(
254
+ "line",
255
+ {
256
+ x1: 0,
257
+ y1: P(B),
258
+ x2: Q,
259
+ y2: P(B),
260
+ className: "nice-chart__grid-line"
261
+ },
262
+ `grid-${B}`
263
+ )),
264
+ I && ee.map((B) => /* @__PURE__ */ e(
265
+ "text",
266
+ {
267
+ x: -8,
268
+ y: P(B) + 4,
269
+ textAnchor: "end",
270
+ className: "nice-chart__axis-label",
271
+ children: B
272
+ },
273
+ `ylabel-${B}`
274
+ )),
275
+ I && m && m.map((B, re) => /* @__PURE__ */ e(
276
+ "text",
277
+ {
278
+ x: te(re),
279
+ y: q + 20,
280
+ textAnchor: "middle",
281
+ className: "nice-chart__axis-label",
282
+ children: B
283
+ },
284
+ re
285
+ )),
286
+ T && /* @__PURE__ */ e(
287
+ "text",
288
+ {
289
+ x: -G.left + 14,
290
+ y: q / 2,
291
+ textAnchor: "middle",
292
+ transform: `rotate(-90, -${G.left - 14}, ${q / 2})`,
293
+ className: "nice-chart__axis-title",
294
+ children: T
295
+ }
296
+ ),
297
+ w && /* @__PURE__ */ e("text", { x: Q / 2, y: q + 45, textAnchor: "middle", className: "nice-chart__axis-title", children: w }),
298
+ /* @__PURE__ */ e("line", { x1: 0, y1: 0, x2: 0, y2: q, className: "nice-chart__axis" }),
299
+ /* @__PURE__ */ e("line", { x1: 0, y1: q, x2: Q, y2: q, className: "nice-chart__axis" }),
300
+ k?.map((B, re) => {
301
+ if (B.type === "line") {
302
+ const ce = P(B.value);
303
+ return /* @__PURE__ */ $("g", { children: [
304
+ /* @__PURE__ */ e(
305
+ "line",
306
+ {
307
+ x1: 0,
308
+ y1: ce,
309
+ x2: Q,
310
+ y2: ce,
311
+ stroke: B.color || "var(--color-error, #ef4444)",
312
+ strokeWidth: 1.5,
313
+ strokeDasharray: B.dash || "6,3"
314
+ }
315
+ ),
316
+ B.label && /* @__PURE__ */ e(
317
+ "text",
318
+ {
319
+ x: Q + 4,
320
+ y: ce + 4,
321
+ className: "nice-chart__annotation-label",
322
+ fill: B.color || "var(--color-error, #ef4444)",
323
+ children: B.label
324
+ }
325
+ )
326
+ ] }, re);
327
+ }
328
+ return /* @__PURE__ */ e(
329
+ "text",
330
+ {
331
+ x: te(B.value),
332
+ y: -4,
333
+ textAnchor: "middle",
334
+ className: "nice-chart__annotation-label",
335
+ fill: B.color || "var(--text-muted, #6b7280)",
336
+ children: B.label
337
+ },
338
+ re
339
+ );
340
+ }),
341
+ C && h && h.x >= 0 && h.x <= Q && h.y >= 0 && h.y <= q && /* @__PURE__ */ $(Pe, { children: [
342
+ /* @__PURE__ */ e(
343
+ "line",
344
+ {
345
+ x1: h.x,
346
+ y1: 0,
347
+ x2: h.x,
348
+ y2: q,
349
+ stroke: "var(--nice-text-muted, #9ca3af)",
350
+ strokeWidth: 1,
351
+ strokeDasharray: "4,2"
352
+ }
353
+ ),
354
+ /* @__PURE__ */ e(
355
+ "line",
356
+ {
357
+ x1: 0,
358
+ y1: h.y,
359
+ x2: Q,
360
+ y2: h.y,
361
+ stroke: "var(--nice-text-muted, #9ca3af)",
362
+ strokeWidth: 1,
363
+ strokeDasharray: "4,2"
364
+ }
365
+ )
366
+ ] }),
367
+ W.map((B, re) => {
368
+ const ce = B.color || ke[re % ke.length], se = B.type || "bar";
369
+ if (se === "bar")
370
+ return /* @__PURE__ */ e(
371
+ "g",
372
+ {
373
+ className: N ? "nice-chart__series nice-chart__series--bar nice-chart__series--anim" : "nice-chart__series nice-chart__series--bar",
374
+ children: B.data.map((r, R) => {
375
+ let E, M;
376
+ if (f) {
377
+ const ie = W.slice(0, re).reduce((le, he) => le + (he.data[R] || 0), 0);
378
+ E = P(ie + r), M = P(ie) - E;
379
+ } else
380
+ E = P(Math.max(0, r)), M = Math.abs(P(r) - P(0));
381
+ const K = f ? te(R) - fe / 2 : te(R) - W.length * fe / 2 + re * fe;
382
+ return /* @__PURE__ */ e(
383
+ "rect",
384
+ {
385
+ x: K,
386
+ y: E,
387
+ width: fe * 0.9,
388
+ height: Math.max(0, M),
389
+ fill: ce,
390
+ rx: 2,
391
+ style: {
392
+ transformOrigin: `${K + fe * 0.9 / 2}px ${P(0)}px`,
393
+ ...d ? { cursor: "pointer" } : {}
394
+ },
395
+ onClick: d ? () => d(B.name, n + R, r) : void 0,
396
+ children: /* @__PURE__ */ e("title", { children: `${B.name}: ${r}` })
397
+ },
398
+ R
399
+ );
400
+ })
401
+ },
402
+ B.name
403
+ );
404
+ if (se === "scatter")
405
+ return /* @__PURE__ */ e(
406
+ "g",
407
+ {
408
+ className: N ? "nice-chart__series nice-chart__series--scatter nice-chart__series--anim" : "nice-chart__series nice-chart__series--scatter",
409
+ children: B.data.map((r, R) => /* @__PURE__ */ e(
410
+ "circle",
411
+ {
412
+ cx: te(R),
413
+ cy: P(r),
414
+ r: 5,
415
+ fill: ce,
416
+ fillOpacity: 0.7,
417
+ stroke: ce,
418
+ strokeWidth: 1.5,
419
+ style: d ? { cursor: "pointer" } : void 0,
420
+ onClick: d ? () => d(B.name, n + R, r) : void 0,
421
+ children: /* @__PURE__ */ e("title", { children: `${B.name}: ${r}` })
422
+ },
423
+ R
424
+ ))
425
+ },
426
+ B.name
427
+ );
428
+ const de = B.data.map((r, R) => `${te(R)},${P(r)}`);
429
+ return /* @__PURE__ */ $(
430
+ "g",
431
+ {
432
+ className: N ? `nice-chart__series nice-chart__series--${se} nice-chart__series--anim` : `nice-chart__series nice-chart__series--${se}`,
433
+ children: [
434
+ se === "area" && /* @__PURE__ */ e(
435
+ "polygon",
436
+ {
437
+ points: `${te(0)},${P(0)} ${de.join(" ")} ${te(H - 1)},${P(0)}`,
438
+ fill: ce,
439
+ opacity: 0.15
440
+ }
441
+ ),
442
+ /* @__PURE__ */ e(
443
+ "polyline",
444
+ {
445
+ points: de.join(" "),
446
+ fill: "none",
447
+ stroke: ce,
448
+ strokeWidth: 2,
449
+ className: N ? "nice-chart__line" : void 0
450
+ }
451
+ ),
452
+ B.data.map((r, R) => /* @__PURE__ */ e(
453
+ "circle",
454
+ {
455
+ cx: te(R),
456
+ cy: P(r),
457
+ r: 3,
458
+ fill: ce,
459
+ style: d ? { cursor: "pointer" } : void 0,
460
+ onClick: d ? () => d(B.name, n + R, r) : void 0,
461
+ children: /* @__PURE__ */ e("title", { children: `${B.name}: ${r}` })
462
+ },
463
+ R
464
+ ))
465
+ ]
466
+ },
467
+ B.name
468
+ );
469
+ })
470
+ ] }),
471
+ v && /* @__PURE__ */ e("g", { transform: `translate(${G.left}, ${s})`, children: t.map((B, re) => {
472
+ const ce = re * 120, se = y.has(B.name);
473
+ return /* @__PURE__ */ $(
474
+ "g",
475
+ {
476
+ transform: `translate(${ce}, 10)`,
477
+ style: l ? { cursor: "pointer" } : void 0,
478
+ onClick: () => j(B.name),
479
+ opacity: se ? 0.35 : 1,
480
+ children: [
481
+ /* @__PURE__ */ e("rect", { width: 12, height: 12, rx: 2, fill: B.color || ke[re % ke.length] }),
482
+ /* @__PURE__ */ e(
483
+ "text",
484
+ {
485
+ x: 16,
486
+ y: 10,
487
+ className: "nice-chart__legend-text",
488
+ style: se ? { textDecoration: "line-through" } : void 0,
489
+ children: B.name
490
+ }
491
+ )
492
+ ]
493
+ },
494
+ B.name
495
+ );
496
+ }) })
497
+ ]
498
+ }
499
+ )
500
+ ] });
501
+ }, mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
502
+ __proto__: null,
503
+ NiceChart: Re
504
+ }, Symbol.toStringTag, { value: "Module" }));
505
+ function Ue(t) {
506
+ if (!t.length)
507
+ return { categories: [], numericFields: [], sampleValues: {} };
508
+ const o = t[0], i = [], s = {};
509
+ let c = null;
510
+ for (const [p, I] of Object.entries(o))
511
+ typeof I == "number" ? (i.push(p), s[p] = t.map((T) => Number(T[p]) || 0)) : !c && (typeof I == "string" || I instanceof Date) && (c = p);
512
+ return { categories: c ? t.map((p) => String(p[c] || "")) : t.map((p, I) => `Item ${I + 1}`), numericFields: i, sampleValues: s };
513
+ }
514
+ function Ge(t, o) {
515
+ const { categories: i, numericFields: s, sampleValues: c } = Ue(t);
516
+ return { series: s.map((p, I) => ({
517
+ name: p.replace(/([A-Z])/g, " $1").replace(/^./, (T) => T.toUpperCase()).trim(),
518
+ data: c[p],
519
+ type: o === "area" ? "area" : o === "line" ? "line" : "bar"
520
+ })), categories: i };
521
+ }
522
+ const pt = Ne(
523
+ function(o, i) {
524
+ const {
525
+ rawData: s,
526
+ enableAI: c = !0,
527
+ aiModel: v,
528
+ enableAutoType: p = !0,
529
+ enableInsights: I = !0,
530
+ dataDescription: T,
531
+ onChartSuggestion: w,
532
+ onInsights: f,
533
+ showAIToolbar: N = !0,
534
+ showInsightsOnLoad: z = !1,
535
+ series: C,
536
+ categories: k,
537
+ ...l
538
+ } = o, [d, u] = oe("bar"), [S, g] = oe(null), [x, y] = oe([]), [b, h] = oe(z), [D, a] = oe(null), { t: _ } = Ve(), A = Xe(), {
539
+ suggestChartType: O,
540
+ generateInsights: U,
541
+ isLoading: V
542
+ } = Ze(), j = c && A.isConfigured, { series: G, categories: Q } = s ? Ge(s, D || d) : { series: C || [], categories: k }, q = ae(async () => {
543
+ if (!j || !p)
544
+ return { type: "bar", reason: "Default", config: {} };
545
+ const W = s || (C?.length ? C.flatMap((m) => m.data.map((F, Y) => ({ [m.name]: F, index: Y }))) : []);
546
+ try {
547
+ const m = await O(W, T), F = {
548
+ type: m.type,
549
+ reason: m.reason,
550
+ config: m.config
551
+ };
552
+ return g(F), u(F.type), w?.(F), F;
553
+ } catch {
554
+ return { type: "bar", reason: "Default fallback", config: {} };
555
+ }
556
+ }, [
557
+ j,
558
+ p,
559
+ s,
560
+ C,
561
+ T,
562
+ O,
563
+ w
564
+ ]), J = ae(async () => {
565
+ if (!j || !I)
566
+ return [];
567
+ const W = s || (C?.length ? C.flatMap(
568
+ (m) => m.data.map((F, Y) => ({ [m.name]: F, category: k?.[Y] || Y }))
569
+ ) : []);
570
+ try {
571
+ const m = await U(W, D || d);
572
+ return y(m), f?.(m), m;
573
+ } catch {
574
+ return [];
575
+ }
576
+ }, [
577
+ j,
578
+ I,
579
+ s,
580
+ C,
581
+ k,
582
+ d,
583
+ D,
584
+ U,
585
+ f
586
+ ]), n = ae(
587
+ () => D || d,
588
+ [D, d]
589
+ );
590
+ Ce(() => {
591
+ j && p && (s?.length || C?.length) && q();
592
+ }, [j, p, s, C]), Ae(i, () => ({
593
+ getSuggestion: q,
594
+ generateInsights: J,
595
+ getCurrentType: n
596
+ }));
597
+ const X = [
598
+ { type: "bar", icon: "📊", label: "Bar" },
599
+ { type: "line", icon: "📈", label: "Line" },
600
+ { type: "area", icon: "🏔️", label: "Area" },
601
+ { type: "pie", icon: "🥧", label: "Pie" },
602
+ { type: "donut", icon: "🍩", label: "Donut" },
603
+ { type: "scatter", icon: "⭐", label: "Scatter" }
604
+ ], H = D || d;
605
+ return /* @__PURE__ */ $("div", { className: "nice-chart-ai", "data-testid": o["data-testid"], children: [
606
+ N && j && /* @__PURE__ */ $("div", { className: "nice-chart-ai__toolbar", children: [
607
+ /* @__PURE__ */ $("div", { className: "nice-chart-ai__toolbar-left", children: [
608
+ /* @__PURE__ */ e("span", { className: "nice-chart-ai__badge", children: "AI" }),
609
+ S && /* @__PURE__ */ $("div", { className: "nice-chart-ai__suggestion", children: [
610
+ /* @__PURE__ */ e("span", { className: "nice-chart-ai__suggestion-icon", children: "💡" }),
611
+ /* @__PURE__ */ $("span", { className: "nice-chart-ai__suggestion-text", children: [
612
+ _("chartAI.suggestedType", "Suggested:"),
613
+ " ",
614
+ S.type
615
+ ] }),
616
+ /* @__PURE__ */ $("span", { className: "nice-chart-ai__suggestion-reason", title: S.reason, children: [
617
+ "(",
618
+ S.reason,
619
+ ")"
620
+ ] })
621
+ ] }),
622
+ V && /* @__PURE__ */ e("span", { className: "nice-chart-ai__loading", children: _("chartAI.analyzing", "Analyzing...") })
623
+ ] }),
624
+ /* @__PURE__ */ e("div", { className: "nice-chart-ai__toolbar-center", children: /* @__PURE__ */ e("div", { className: "nice-chart-ai__type-selector", children: X.filter((W) => ["bar", "line", "area"].includes(W.type)).map(({ type: W, icon: m, label: F }) => /* @__PURE__ */ e(
625
+ "button",
626
+ {
627
+ type: "button",
628
+ className: `nice-chart-ai__type-btn ${H === W ? "nice-chart-ai__type-btn--active" : ""}`,
629
+ onClick: () => a(W),
630
+ title: F,
631
+ children: m
632
+ },
633
+ W
634
+ )) }) }),
635
+ /* @__PURE__ */ $("div", { className: "nice-chart-ai__toolbar-right", children: [
636
+ /* @__PURE__ */ $(
637
+ "button",
638
+ {
639
+ type: "button",
640
+ className: "nice-chart-ai__auto-btn",
641
+ onClick: () => q(),
642
+ disabled: V,
643
+ title: _("chartAI.autoDetect", "Auto-detect best chart type"),
644
+ children: [
645
+ "🔮 ",
646
+ _("chartAI.auto", "Auto")
647
+ ]
648
+ }
649
+ ),
650
+ I && /* @__PURE__ */ $(
651
+ "button",
652
+ {
653
+ type: "button",
654
+ className: "nice-chart-ai__insights-btn",
655
+ onClick: () => {
656
+ x.length || J(), h(!b);
657
+ },
658
+ disabled: V,
659
+ title: _("chartAI.showInsights", "Show data insights"),
660
+ children: [
661
+ "💡 ",
662
+ _("chartAI.insights", "Insights")
663
+ ]
664
+ }
665
+ )
666
+ ] })
667
+ ] }),
668
+ /* @__PURE__ */ e("div", { className: "nice-chart-ai__chart-wrapper", children: /* @__PURE__ */ e(Re, { series: G, categories: Q, ...l }) }),
669
+ b && x.length > 0 && /* @__PURE__ */ $("div", { className: "nice-chart-ai__insights", children: [
670
+ /* @__PURE__ */ $("div", { className: "nice-chart-ai__insights-header", children: [
671
+ /* @__PURE__ */ $("h4", { children: [
672
+ "💡 ",
673
+ _("chartAI.dataInsights", "Data Insights")
674
+ ] }),
675
+ /* @__PURE__ */ e(
676
+ "button",
677
+ {
678
+ type: "button",
679
+ className: "nice-chart-ai__insights-close",
680
+ onClick: () => h(!1),
681
+ children: "✕"
682
+ }
683
+ )
684
+ ] }),
685
+ /* @__PURE__ */ e("ul", { className: "nice-chart-ai__insights-list", children: x.map((W, m) => /* @__PURE__ */ $("li", { className: "nice-chart-ai__insight", children: [
686
+ /* @__PURE__ */ e("span", { className: "nice-chart-ai__insight-icon", children: "•" }),
687
+ W
688
+ ] }, m)) }),
689
+ /* @__PURE__ */ e("div", { className: "nice-chart-ai__insights-footer", children: /* @__PURE__ */ $(
690
+ "button",
691
+ {
692
+ type: "button",
693
+ className: "nice-chart-ai__refresh",
694
+ onClick: () => J(),
695
+ disabled: V,
696
+ children: [
697
+ "🔄 ",
698
+ _("chartAI.refresh", "Refresh")
699
+ ]
700
+ }
701
+ ) })
702
+ ] }),
703
+ b && V && /* @__PURE__ */ e("div", { className: "nice-chart-ai__insights nice-chart-ai__insights--loading", children: /* @__PURE__ */ $("div", { className: "nice-chart-ai__loading-content", children: [
704
+ /* @__PURE__ */ e("span", { className: "nice-chart-ai__spinner" }),
705
+ _("chartAI.generatingInsights", "Generating insights...")
706
+ ] }) })
707
+ ] });
708
+ }
709
+ );
710
+ function qe(t, o) {
711
+ const i = t ? typeof t == "number" ? new Date(t) : new Date(t) : /* @__PURE__ */ new Date(), s = (T) => T.toString().padStart(2, "0"), c = s(i.getHours()), v = s(i.getMinutes()), p = s(i.getSeconds()), I = i.getMilliseconds().toString().padStart(3, "0");
712
+ switch (o) {
713
+ case "HH:mm:ss":
714
+ return `${c}:${v}:${p}`;
715
+ case "HH:mm":
716
+ return `${c}:${v}`;
717
+ case "mm:ss":
718
+ return `${v}:${p}`;
719
+ case "ss.SSS":
720
+ return `${p}.${I}`;
721
+ case "ISO":
722
+ return i.toISOString();
723
+ default:
724
+ return `${c}:${v}:${p}`;
725
+ }
726
+ }
727
+ function We(t) {
728
+ if (t.length === 0)
729
+ return null;
730
+ const o = Math.min(...t), i = Math.max(...t), s = t.reduce((v, p) => v + p, 0) / t.length, c = t[t.length - 1];
731
+ return { min: o, max: i, avg: s, current: c, count: t.length };
732
+ }
733
+ const Je = Ne(
734
+ ({
735
+ series: t,
736
+ maxPoints: o = 100,
737
+ slidingWindow: i = !0,
738
+ refreshRate: s = 16,
739
+ dataSource: c,
740
+ width: v = 600,
741
+ height: p = 400,
742
+ title: I,
743
+ showLegend: T = !0,
744
+ showGrid: w = !0,
745
+ yAxisLabel: f,
746
+ xAxisLabel: N,
747
+ stacked: z,
748
+ zoomable: C,
749
+ crosshair: k,
750
+ annotations: l = [],
751
+ legendInteractive: d,
752
+ onDataPointClick: u,
753
+ exportable: S,
754
+ showControls: g = !0,
755
+ showStatus: x = !0,
756
+ initialPaused: y = !1,
757
+ onDataReceived: b,
758
+ onDataDropped: h,
759
+ timeFormat: D = "HH:mm:ss",
760
+ showStats: a,
761
+ thresholds: _ = [],
762
+ className: A,
763
+ style: O
764
+ }, U) => {
765
+ const [V, j] = oe(() => {
766
+ const L = /* @__PURE__ */ new Map();
767
+ for (const Z of t)
768
+ L.set(Z.name, Z.initialData?.slice() ?? []);
769
+ return L;
770
+ }), [G, Q] = oe([]), [q, J] = oe(y), [n, X] = oe(!1), H = be([]), W = be(Date.now()), m = be(null), F = ae(() => {
771
+ const L = H.current;
772
+ L.length !== 0 && (H.current = [], j((Z) => {
773
+ const ne = new Map(Z);
774
+ for (const ue of L) {
775
+ const _e = ne.get(ue.series);
776
+ if (!_e)
777
+ continue;
778
+ const ge = [..._e, ue.value];
779
+ if (i && ge.length > o) {
780
+ const ye = ge.length - o;
781
+ h?.(ye, ue.series), ge.splice(0, ye);
782
+ }
783
+ ne.set(ue.series, ge);
784
+ }
785
+ return ne;
786
+ }), L.length > 0 && Q((Z) => {
787
+ const ne = [...Z];
788
+ for (const ue of L) {
789
+ const _e = ue.category ?? qe(ue.timestamp, D);
790
+ ne.push(_e);
791
+ }
792
+ return i && ne.length > o && ne.splice(0, ne.length - o), ne;
793
+ }));
794
+ }, [i, o, D, h]), Y = ae(() => {
795
+ const L = Date.now();
796
+ L - W.current >= s && (F(), W.current = L), m.current = requestAnimationFrame(Y);
797
+ }, [s, F]);
798
+ Ce(() => (q || (m.current = requestAnimationFrame(Y)), () => {
799
+ m.current !== null && (cancelAnimationFrame(m.current), m.current = null);
800
+ }), [q, Y]);
801
+ const ee = ae(
802
+ (L) => {
803
+ if (q)
804
+ return;
805
+ const Z = "points" in L ? L.points : [L];
806
+ for (const ne of Z)
807
+ V.has(ne.series) && (H.current.push(ne), b?.(ne));
808
+ },
809
+ [q, V, b]
810
+ );
811
+ Ce(() => {
812
+ if (!c)
813
+ return;
814
+ const L = c.subscribe(ee);
815
+ let Z;
816
+ return c.onStatusChange ? Z = c.onStatusChange(X) : X(!0), c.fetchHistory && c.fetchHistory(o).then((ne) => {
817
+ for (const ue of ne)
818
+ H.current.push(ue);
819
+ F();
820
+ }), () => {
821
+ L(), Z?.();
822
+ };
823
+ }, [c, ee, o, F]);
824
+ const P = pe(() => t.map((L) => ({
825
+ name: L.name,
826
+ color: L.color,
827
+ type: L.type,
828
+ data: V.get(L.name) ?? []
829
+ })), [t, V]), te = pe(() => {
830
+ const L = [...l];
831
+ for (const Z of _)
832
+ L.push({
833
+ type: "line",
834
+ value: Z.value,
835
+ color: Z.color,
836
+ label: Z.label,
837
+ dash: Z.style === "dashed" ? "5,5" : Z.style === "dotted" ? "2,2" : void 0
838
+ });
839
+ return L;
840
+ }, [l, _]);
841
+ Ae(
842
+ U,
843
+ () => ({
844
+ pause() {
845
+ J(!0);
846
+ },
847
+ resume() {
848
+ J(!1);
849
+ },
850
+ isPaused() {
851
+ return q;
852
+ },
853
+ clear() {
854
+ j((L) => {
855
+ const Z = new Map(L);
856
+ for (const ne of Z.keys())
857
+ Z.set(ne, []);
858
+ return Z;
859
+ }), Q([]), H.current = [];
860
+ },
861
+ addPoint(L) {
862
+ ee(L);
863
+ },
864
+ addPoints(L) {
865
+ ee({ points: L });
866
+ },
867
+ getData(L) {
868
+ return V.get(L) ?? [];
869
+ },
870
+ getCategories() {
871
+ return G;
872
+ },
873
+ exportData() {
874
+ return { series: P, categories: G };
875
+ },
876
+ getStats(L) {
877
+ const Z = V.get(L);
878
+ return Z ? We(Z) : null;
879
+ }
880
+ }),
881
+ [q, V, G, P, ee]
882
+ );
883
+ const fe = pe(() => {
884
+ if (!a)
885
+ return null;
886
+ const L = {};
887
+ for (const [Z, ne] of V)
888
+ L[Z] = We(ne);
889
+ return L;
890
+ }, [a, V]);
891
+ return /* @__PURE__ */ $("div", { className: A, style: { position: "relative", ...O }, children: [
892
+ x && /* @__PURE__ */ $(
893
+ "div",
894
+ {
895
+ style: {
896
+ position: "absolute",
897
+ top: 8,
898
+ right: 8,
899
+ display: "flex",
900
+ alignItems: "center",
901
+ gap: 4,
902
+ fontSize: 12,
903
+ color: n ? "var(--color-success, #22c55e)" : "var(--color-error, #ef4444)",
904
+ zIndex: 10
905
+ },
906
+ children: [
907
+ /* @__PURE__ */ e(
908
+ "span",
909
+ {
910
+ style: {
911
+ width: 8,
912
+ height: 8,
913
+ borderRadius: "50%",
914
+ backgroundColor: n ? "var(--color-success, #22c55e)" : "var(--color-error, #ef4444)"
915
+ }
916
+ }
917
+ ),
918
+ n ? "Live" : "Disconnected"
919
+ ]
920
+ }
921
+ ),
922
+ g && /* @__PURE__ */ e(
923
+ "div",
924
+ {
925
+ style: {
926
+ position: "absolute",
927
+ top: 8,
928
+ left: 8,
929
+ display: "flex",
930
+ gap: 4,
931
+ zIndex: 10
932
+ },
933
+ children: /* @__PURE__ */ e(
934
+ "button",
935
+ {
936
+ onClick: () => J((L) => !L),
937
+ style: {
938
+ padding: "4px 8px",
939
+ fontSize: 12,
940
+ border: "1px solid var(--border-color, #ddd)",
941
+ borderRadius: 4,
942
+ background: q ? "var(--warning-bg, #fef3c7)" : "var(--bg-primary, #fff)",
943
+ cursor: "pointer"
944
+ },
945
+ title: q ? "Resume" : "Pause",
946
+ children: q ? "▶" : "⏸"
947
+ }
948
+ )
949
+ }
950
+ ),
951
+ a && fe && /* @__PURE__ */ e(
952
+ "div",
953
+ {
954
+ style: {
955
+ position: "absolute",
956
+ bottom: 50,
957
+ right: 8,
958
+ background: "var(--nice-overlay-light-90, rgba(255, 255, 255, 0.9))",
959
+ border: "1px solid var(--border-color, #ddd)",
960
+ borderRadius: 4,
961
+ padding: 8,
962
+ fontSize: 11,
963
+ zIndex: 10
964
+ },
965
+ children: Object.entries(fe).map(
966
+ ([L, Z]) => Z ? /* @__PURE__ */ $("div", { style: { marginBottom: 4 }, children: [
967
+ /* @__PURE__ */ e("strong", { children: L }),
968
+ /* @__PURE__ */ $("div", { children: [
969
+ "Min: ",
970
+ Z.min.toFixed(2),
971
+ " | Max: ",
972
+ Z.max.toFixed(2)
973
+ ] }),
974
+ /* @__PURE__ */ $("div", { children: [
975
+ "Avg: ",
976
+ Z.avg.toFixed(2),
977
+ " | Now: ",
978
+ Z.current.toFixed(2)
979
+ ] })
980
+ ] }, L) : null
981
+ )
982
+ }
983
+ ),
984
+ /* @__PURE__ */ e(
985
+ Re,
986
+ {
987
+ series: P,
988
+ categories: G,
989
+ width: v,
990
+ height: p,
991
+ title: I,
992
+ showLegend: T,
993
+ showGrid: w,
994
+ yAxisLabel: f,
995
+ xAxisLabel: N,
996
+ stacked: z,
997
+ zoomable: C,
998
+ crosshair: k,
999
+ annotations: te,
1000
+ legendInteractive: d,
1001
+ onDataPointClick: u,
1002
+ exportable: S
1003
+ }
1004
+ )
1005
+ ] });
1006
+ }
1007
+ );
1008
+ Je.displayName = "NiceLiveChart";
1009
+ function ft(t) {
1010
+ const {
1011
+ hubConnection: o,
1012
+ eventName: i = "DataPoint",
1013
+ subscribeMethod: s = "SubscribeToMetrics",
1014
+ historyMethod: c = "GetMetricHistory",
1015
+ metricName: v
1016
+ } = t;
1017
+ return {
1018
+ subscribe(p) {
1019
+ const I = (T) => {
1020
+ p(T);
1021
+ };
1022
+ return o.on(i, I), o.state === "Connected" && o.invoke(s, v).catch(() => {
1023
+ }), () => {
1024
+ o.off(i, I);
1025
+ };
1026
+ },
1027
+ async fetchHistory(p) {
1028
+ try {
1029
+ return await o.invoke(c, v, p);
1030
+ } catch {
1031
+ return [];
1032
+ }
1033
+ },
1034
+ onStatusChange(p) {
1035
+ const I = () => p(o.state === "Connected");
1036
+ return o.onclose(() => p(!1)), o.onreconnected(() => p(!0)), I(), () => {
1037
+ };
1038
+ }
1039
+ };
1040
+ }
1041
+ function gt(t) {
1042
+ const {
1043
+ url: o,
1044
+ autoReconnect: i = !0,
1045
+ reconnectDelay: s = 3e3,
1046
+ parseMessage: c = (f) => JSON.parse(f)
1047
+ } = t;
1048
+ let v = null, p = null, I = null, T = null;
1049
+ const w = () => {
1050
+ v = new WebSocket(o), v.onopen = () => {
1051
+ p?.(!0);
1052
+ }, v.onclose = () => {
1053
+ p?.(!1), i && (T = setTimeout(w, s));
1054
+ }, v.onerror = () => {
1055
+ v?.close();
1056
+ }, v.onmessage = (f) => {
1057
+ try {
1058
+ const N = c(f.data);
1059
+ N && I && I(N);
1060
+ } catch {
1061
+ }
1062
+ };
1063
+ };
1064
+ return {
1065
+ subscribe(f) {
1066
+ return I = f, w(), () => {
1067
+ I = null, T && clearTimeout(T), v?.close(), v = null;
1068
+ };
1069
+ },
1070
+ onStatusChange(f) {
1071
+ return p = f, () => {
1072
+ p = null;
1073
+ };
1074
+ }
1075
+ };
1076
+ }
1077
+ function xt(t) {
1078
+ const { seriesNames: o, interval: i = 1e3, generateValue: s = () => Math.random() * 100 } = t;
1079
+ let c = null, v = 0;
1080
+ return {
1081
+ subscribe(p) {
1082
+ return c = setInterval(() => {
1083
+ for (const I of o)
1084
+ p({
1085
+ series: I,
1086
+ value: s(I, v),
1087
+ timestamp: Date.now()
1088
+ });
1089
+ v++;
1090
+ }, i), () => {
1091
+ c && clearInterval(c);
1092
+ };
1093
+ },
1094
+ onStatusChange(p) {
1095
+ return p(!0), () => {
1096
+ };
1097
+ }
1098
+ };
1099
+ }
1100
+ const ve = ["#3b82f6", "#ef4444", "#22c55e", "#f59e0b", "#8b5cf6", "#ec4899", "#06b6d4", "#84cc16"], yt = ({
1101
+ data: t,
1102
+ width: o = 400,
1103
+ height: i = 400,
1104
+ innerRadius: s = 0,
1105
+ title: c,
1106
+ showLegend: v = !0,
1107
+ showLabels: p = !0,
1108
+ className: I,
1109
+ style: T
1110
+ }) => {
1111
+ const w = o / 2, f = (i - (v ? 30 : 0)) / 2 + (c ? 10 : 0), N = Math.min(w, f) - 40, z = t.reduce((l, d) => l + d.value, 0);
1112
+ let C = -Math.PI / 2;
1113
+ const k = t.map((l, d) => {
1114
+ const u = l.value / (z || 1) * Math.PI * 2, S = C;
1115
+ C += u;
1116
+ const g = C, x = (S + g) / 2, y = w + N * Math.cos(S), b = f + N * Math.sin(S), h = w + N * Math.cos(g), D = f + N * Math.sin(g), a = u > Math.PI ? 1 : 0, _ = l.color || ve[d % ve.length];
1117
+ let A;
1118
+ if (s > 0) {
1119
+ const j = w + s * Math.cos(S), G = f + s * Math.sin(S), Q = w + s * Math.cos(g), q = f + s * Math.sin(g);
1120
+ A = `M${y},${b} A${N},${N} 0 ${a},1 ${h},${D} L${Q},${q} A${s},${s} 0 ${a},0 ${j},${G} Z`;
1121
+ } else
1122
+ A = `M${w},${f} L${y},${b} A${N},${N} 0 ${a},1 ${h},${D} Z`;
1123
+ const O = w + N * 0.7 * Math.cos(x), U = f + N * 0.7 * Math.sin(x), V = z > 0 ? Math.round(l.value / z * 100) : 0;
1124
+ return { ...l, path: A, labelX: O, labelY: U, pct: V, color: _ };
1125
+ });
1126
+ return /* @__PURE__ */ e("div", { className: `nice-piechart ${I || ""}`, style: T, children: /* @__PURE__ */ $(
1127
+ "svg",
1128
+ {
1129
+ viewBox: `0 0 ${o} ${i}`,
1130
+ preserveAspectRatio: "xMidYMid meet",
1131
+ width: "100%",
1132
+ height: "100%",
1133
+ style: { display: "block", maxWidth: "100%", maxHeight: "100%" },
1134
+ className: "nice-piechart__svg",
1135
+ children: [
1136
+ c && /* @__PURE__ */ e("text", { x: w, y: 20, textAnchor: "middle", className: "nice-chart__title", children: c }),
1137
+ k.map((l, d) => /* @__PURE__ */ $("g", { children: [
1138
+ /* @__PURE__ */ e("path", { d: l.path, fill: l.color, stroke: "var(--bg-primary, #fff)", strokeWidth: 2, children: /* @__PURE__ */ e("title", { children: `${l.label}: ${l.value} (${l.pct}%)` }) }),
1139
+ p && l.pct >= 5 && /* @__PURE__ */ $(
1140
+ "text",
1141
+ {
1142
+ x: l.labelX,
1143
+ y: l.labelY,
1144
+ textAnchor: "middle",
1145
+ dominantBaseline: "middle",
1146
+ className: "nice-piechart__label",
1147
+ children: [
1148
+ l.pct,
1149
+ "%"
1150
+ ]
1151
+ }
1152
+ )
1153
+ ] }, d)),
1154
+ v && /* @__PURE__ */ e("g", { transform: `translate(10, ${i - 25})`, children: t.map((l, d) => /* @__PURE__ */ $("g", { transform: `translate(${d * 100}, 0)`, children: [
1155
+ /* @__PURE__ */ e("rect", { width: 10, height: 10, rx: 2, fill: l.color || ve[d % ve.length] }),
1156
+ /* @__PURE__ */ e("text", { x: 14, y: 9, className: "nice-chart__legend-text", children: l.label })
1157
+ ] }, d)) })
1158
+ ]
1159
+ }
1160
+ ) });
1161
+ }, vt = ({
1162
+ series: t,
1163
+ categories: o,
1164
+ width: i = 400,
1165
+ height: s = 400,
1166
+ maxValue: c,
1167
+ title: v,
1168
+ showLegend: p = !0,
1169
+ className: I,
1170
+ style: T
1171
+ }) => {
1172
+ const w = i / 2, f = (s - (p ? 30 : 0)) / 2 + (v ? 10 : 0), N = Math.min(w, f) - 60, z = o.length, C = c ?? Math.max(...t.flatMap((u) => u.data), 1), k = Math.PI * 2 / z, l = 5, d = (u, S) => {
1173
+ const g = u * k - Math.PI / 2, x = S / C * N;
1174
+ return { x: w + x * Math.cos(g), y: f + x * Math.sin(g) };
1175
+ };
1176
+ return /* @__PURE__ */ e("div", { className: `nice-polarchart ${I || ""}`, style: T, children: /* @__PURE__ */ $("svg", { width: i, height: s, className: "nice-polarchart__svg", children: [
1177
+ v && /* @__PURE__ */ e("text", { x: w, y: 20, textAnchor: "middle", className: "nice-chart__title", children: v }),
1178
+ Array.from({ length: l }, (u, S) => {
1179
+ const g = N * ((S + 1) / l);
1180
+ return /* @__PURE__ */ e(
1181
+ "circle",
1182
+ {
1183
+ cx: w,
1184
+ cy: f,
1185
+ r: g,
1186
+ fill: "none",
1187
+ stroke: "var(--border-color, #ddd)",
1188
+ strokeWidth: 0.5
1189
+ },
1190
+ S
1191
+ );
1192
+ }),
1193
+ o.map((u, S) => {
1194
+ const g = d(S, C), x = d(S, C * 1.22), y = S * k - Math.PI / 2, b = Math.cos(y), h = Math.sin(y), D = b > 0.2 ? "start" : b < -0.2 ? "end" : "middle", a = h > 0.2 ? "hanging" : h < -0.2 ? "auto" : "middle";
1195
+ return /* @__PURE__ */ $("g", { children: [
1196
+ /* @__PURE__ */ e(
1197
+ "line",
1198
+ {
1199
+ x1: w,
1200
+ y1: f,
1201
+ x2: g.x,
1202
+ y2: g.y,
1203
+ stroke: "var(--border-color, #ddd)",
1204
+ strokeWidth: 0.5
1205
+ }
1206
+ ),
1207
+ /* @__PURE__ */ e(
1208
+ "text",
1209
+ {
1210
+ x: x.x,
1211
+ y: x.y,
1212
+ textAnchor: D,
1213
+ dominantBaseline: a,
1214
+ className: "nice-chart__axis-label nice-chart__axis-label--polar",
1215
+ children: u
1216
+ }
1217
+ )
1218
+ ] }, S);
1219
+ }),
1220
+ t.map((u, S) => {
1221
+ const g = u.color || ve[S % ve.length], x = u.data.map((y, b) => {
1222
+ const h = d(b, y);
1223
+ return `${h.x},${h.y}`;
1224
+ }).join(" ");
1225
+ return /* @__PURE__ */ $("g", { children: [
1226
+ /* @__PURE__ */ e(
1227
+ "polygon",
1228
+ {
1229
+ points: x,
1230
+ fill: u.fill !== !1 ? g : "none",
1231
+ fillOpacity: 0.15,
1232
+ stroke: g,
1233
+ strokeWidth: 2
1234
+ }
1235
+ ),
1236
+ u.data.map((y, b) => {
1237
+ const h = d(b, y);
1238
+ return /* @__PURE__ */ e("circle", { cx: h.x, cy: h.y, r: 3, fill: g, children: /* @__PURE__ */ e("title", { children: `${u.name} - ${o[b]}: ${y}` }) }, b);
1239
+ })
1240
+ ] }, u.name);
1241
+ }),
1242
+ p && /* @__PURE__ */ e("g", { transform: `translate(10, ${s - 25})`, children: t.map((u, S) => /* @__PURE__ */ $("g", { transform: `translate(${S * 100}, 0)`, children: [
1243
+ /* @__PURE__ */ e("rect", { width: 10, height: 10, rx: 2, fill: u.color || ve[S % ve.length] }),
1244
+ /* @__PURE__ */ e("text", { x: 14, y: 9, className: "nice-chart__legend-text", children: u.name })
1245
+ ] }, S)) })
1246
+ ] }) });
1247
+ }, bt = ({
1248
+ value: t,
1249
+ min: o = 0,
1250
+ max: i = 100,
1251
+ width: s = 200,
1252
+ height: c = 200,
1253
+ startAngle: v = 225,
1254
+ endAngle: p = -45,
1255
+ color: I = "var(--color-primary, #3b82f6)",
1256
+ trackColor: T,
1257
+ label: w,
1258
+ formatValue: f,
1259
+ ranges: N,
1260
+ className: z,
1261
+ style: C
1262
+ }) => {
1263
+ const k = s / 2, l = c / 2, d = Math.min(k, l) - 20, u = Math.max(0, Math.min(1, (t - o) / (i - o || 1))), S = (a) => a * Math.PI / 180, g = (v - p + 360) % 360 || 360, x = (a) => ({
1264
+ x: k + d * Math.cos(S(a)),
1265
+ y: l - d * Math.sin(S(a))
1266
+ }), y = (a, _) => {
1267
+ const A = x(a), O = x(_), V = (a - _ + 360) % 360 > 180 ? 1 : 0;
1268
+ return `M${A.x},${A.y} A${d},${d} 0 ${V},1 ${O.x},${O.y}`;
1269
+ }, b = v - u * g, h = x(b);
1270
+ let D = I;
1271
+ if (N) {
1272
+ for (const a of N)
1273
+ if (t >= a.start && t <= a.end) {
1274
+ D = a.color;
1275
+ break;
1276
+ }
1277
+ }
1278
+ return /* @__PURE__ */ e("div", { className: `nice-gauge nice-gauge--circular ${z || ""}`, style: C, children: /* @__PURE__ */ $("svg", { width: s, height: c, children: [
1279
+ /* @__PURE__ */ e(
1280
+ "path",
1281
+ {
1282
+ d: y(v, p),
1283
+ fill: "none",
1284
+ stroke: T || "var(--border-color, #e2e8f0)",
1285
+ strokeWidth: 12,
1286
+ strokeLinecap: "round"
1287
+ }
1288
+ ),
1289
+ u > 0 && /* @__PURE__ */ e(
1290
+ "path",
1291
+ {
1292
+ d: y(v, b),
1293
+ fill: "none",
1294
+ stroke: D,
1295
+ strokeWidth: 12,
1296
+ strokeLinecap: "round"
1297
+ }
1298
+ ),
1299
+ /* @__PURE__ */ e(
1300
+ "line",
1301
+ {
1302
+ x1: k,
1303
+ y1: l,
1304
+ x2: h.x,
1305
+ y2: h.y,
1306
+ stroke: "var(--text-primary, #333)",
1307
+ strokeWidth: 2,
1308
+ strokeLinecap: "round"
1309
+ }
1310
+ ),
1311
+ /* @__PURE__ */ e("circle", { cx: k, cy: l, r: 4, fill: "var(--text-primary, #333)" }),
1312
+ /* @__PURE__ */ e("text", { x: k, y: l + d * 0.6, textAnchor: "middle", className: "nice-gauge__value", children: f ? f(t) : t }),
1313
+ w && /* @__PURE__ */ e("text", { x: k, y: l + d * 0.95, textAnchor: "middle", className: "nice-gauge__label", children: w })
1314
+ ] }) });
1315
+ }, _t = ({
1316
+ value: t,
1317
+ min: o = 0,
1318
+ max: i = 100,
1319
+ width: s = 300,
1320
+ height: c = 60,
1321
+ orientation: v = "horizontal",
1322
+ color: p = "var(--color-primary, #3b82f6)",
1323
+ label: I,
1324
+ formatValue: T,
1325
+ ranges: w,
1326
+ showTicks: f = !0,
1327
+ tickCount: N = 5,
1328
+ className: z,
1329
+ style: C
1330
+ }) => {
1331
+ const k = v === "horizontal", l = k ? s - 40 : c - 40, d = Math.max(0, Math.min(1, (t - o) / (i - o || 1))), u = 10;
1332
+ let S = p;
1333
+ if (w) {
1334
+ for (const x of w)
1335
+ if (t >= x.start && t <= x.end) {
1336
+ S = x.color;
1337
+ break;
1338
+ }
1339
+ }
1340
+ const g = Array.from(
1341
+ { length: N },
1342
+ (x, y) => o + (i - o) * (y / (N - 1))
1343
+ );
1344
+ return k ? /* @__PURE__ */ e("div", { className: `nice-gauge nice-gauge--linear ${z || ""}`, style: C, children: /* @__PURE__ */ $("svg", { width: s, height: c, children: [
1345
+ /* @__PURE__ */ e(
1346
+ "text",
1347
+ {
1348
+ x: 20 + l * d,
1349
+ y: 14,
1350
+ textAnchor: "middle",
1351
+ className: "nice-gauge__value",
1352
+ style: { fontSize: 12 },
1353
+ children: T ? T(t) : t
1354
+ }
1355
+ ),
1356
+ /* @__PURE__ */ e(
1357
+ "rect",
1358
+ {
1359
+ x: 20,
1360
+ y: c / 2 - u / 2,
1361
+ width: l,
1362
+ height: u,
1363
+ rx: 5,
1364
+ fill: "var(--border-color, #e2e8f0)"
1365
+ }
1366
+ ),
1367
+ /* @__PURE__ */ e(
1368
+ "rect",
1369
+ {
1370
+ x: 20,
1371
+ y: c / 2 - u / 2,
1372
+ width: l * d,
1373
+ height: u,
1374
+ rx: 5,
1375
+ fill: S
1376
+ }
1377
+ ),
1378
+ /* @__PURE__ */ e(
1379
+ "polygon",
1380
+ {
1381
+ points: `${20 + l * d},${c / 2 - u / 2 - 2} ${20 + l * d - 5},${c / 2 - u / 2 - 8} ${20 + l * d + 5},${c / 2 - u / 2 - 8}`,
1382
+ fill: "var(--text-primary, #333)"
1383
+ }
1384
+ ),
1385
+ f && g.map((x, y) => {
1386
+ const b = 20 + (x - o) / (i - o) * l;
1387
+ return /* @__PURE__ */ e(
1388
+ "text",
1389
+ {
1390
+ x: b,
1391
+ y: c / 2 + u / 2 + 12,
1392
+ textAnchor: "middle",
1393
+ className: "nice-gauge__tick",
1394
+ children: x
1395
+ },
1396
+ y
1397
+ );
1398
+ }),
1399
+ I && /* @__PURE__ */ e("text", { x: s / 2, y: c - 2, textAnchor: "middle", className: "nice-gauge__label", children: I })
1400
+ ] }) }) : /* @__PURE__ */ e(
1401
+ "div",
1402
+ {
1403
+ className: `nice-gauge nice-gauge--linear nice-gauge--vertical ${z || ""}`,
1404
+ style: C,
1405
+ children: /* @__PURE__ */ $("svg", { width: s, height: c, children: [
1406
+ /* @__PURE__ */ e(
1407
+ "rect",
1408
+ {
1409
+ x: s / 2 - u / 2,
1410
+ y: 20,
1411
+ width: u,
1412
+ height: l,
1413
+ rx: 5,
1414
+ fill: "var(--border-color, #e2e8f0)"
1415
+ }
1416
+ ),
1417
+ /* @__PURE__ */ e(
1418
+ "rect",
1419
+ {
1420
+ x: s / 2 - u / 2,
1421
+ y: 20 + l * (1 - d),
1422
+ width: u,
1423
+ height: l * d,
1424
+ rx: 5,
1425
+ fill: S
1426
+ }
1427
+ ),
1428
+ /* @__PURE__ */ e("text", { x: s / 2, y: 14, textAnchor: "middle", className: "nice-gauge__value", children: T ? T(t) : t }),
1429
+ I && /* @__PURE__ */ e("text", { x: s / 2, y: c - 4, textAnchor: "middle", className: "nice-gauge__label", children: I })
1430
+ ] })
1431
+ }
1432
+ );
1433
+ }, wt = ({
1434
+ items: t,
1435
+ min: o = 0,
1436
+ max: i = 100,
1437
+ width: s = 300,
1438
+ height: c = 300,
1439
+ startAngle: v = 225,
1440
+ endAngle: p = -45,
1441
+ formatValue: I,
1442
+ title: T,
1443
+ className: w,
1444
+ style: f
1445
+ }) => {
1446
+ const N = s / 2, z = c / 2, C = Math.min(N, z) - 30, k = Math.min(20, C / (t.length + 1)), l = 4, d = (g) => g * Math.PI / 180, u = (v - p + 360) % 360 || 360, S = (g, x, y) => {
1447
+ const b = N + g * Math.cos(d(x)), h = z - g * Math.sin(d(x)), D = N + g * Math.cos(d(y)), a = z - g * Math.sin(d(y)), _ = (x - y + 360) % 360;
1448
+ return `M${b},${h} A${g},${g} 0 ${_ > 180 ? 1 : 0},1 ${D},${a}`;
1449
+ };
1450
+ return /* @__PURE__ */ e("div", { className: `nice-bargauge ${w || ""}`, style: f, children: /* @__PURE__ */ $("svg", { width: s, height: c, children: [
1451
+ T && /* @__PURE__ */ e("text", { x: N, y: 20, textAnchor: "middle", className: "nice-chart__title", children: T }),
1452
+ t.map((g, x) => {
1453
+ const y = C - x * (k + l), b = Math.max(0, Math.min(1, (g.value - o) / (i - o || 1))), h = v - b * u, D = g.color || ve[x % ve.length];
1454
+ return /* @__PURE__ */ $("g", { children: [
1455
+ /* @__PURE__ */ e(
1456
+ "path",
1457
+ {
1458
+ d: S(y, v, p),
1459
+ fill: "none",
1460
+ stroke: "var(--border-color, #e2e8f0)",
1461
+ strokeWidth: k,
1462
+ strokeLinecap: "round"
1463
+ }
1464
+ ),
1465
+ b > 0 && /* @__PURE__ */ e(
1466
+ "path",
1467
+ {
1468
+ d: S(y, v, h),
1469
+ fill: "none",
1470
+ stroke: D,
1471
+ strokeWidth: k,
1472
+ strokeLinecap: "round"
1473
+ }
1474
+ )
1475
+ ] }, x);
1476
+ }),
1477
+ /* @__PURE__ */ e("g", { children: t.map((g, x) => /* @__PURE__ */ $(
1478
+ "text",
1479
+ {
1480
+ x: N,
1481
+ y: z - ((t.length - 1) / 2 - x) * 16,
1482
+ textAnchor: "middle",
1483
+ dominantBaseline: "middle",
1484
+ className: "nice-gauge__value",
1485
+ style: { fontSize: 12 },
1486
+ children: [
1487
+ g.label ? `${g.label}: ` : "",
1488
+ I ? I(g.value) : g.value
1489
+ ]
1490
+ },
1491
+ x
1492
+ )) })
1493
+ ] }) });
1494
+ }, $t = ({
1495
+ data: t,
1496
+ width: o = 120,
1497
+ height: i = 30,
1498
+ type: s = "line",
1499
+ color: c = "var(--color-primary, #3b82f6)",
1500
+ showMinMax: v,
1501
+ showLastPoint: p = !0,
1502
+ className: I,
1503
+ style: T
1504
+ }) => {
1505
+ if (t.length === 0)
1506
+ return null;
1507
+ const w = 2, f = Math.min(...t), N = Math.max(...t), z = N - f || 1, C = o - w * 2, k = i - w * 2, l = (y) => w + y / (t.length - 1 || 1) * C, d = (y) => w + k - (y - f) / z * k;
1508
+ if (s === "bar") {
1509
+ const y = Math.max(1, C / t.length - 1);
1510
+ return /* @__PURE__ */ e(
1511
+ "svg",
1512
+ {
1513
+ width: o,
1514
+ height: i,
1515
+ className: `nice-sparkline ${I || ""}`,
1516
+ style: T,
1517
+ children: t.map((b, h) => /* @__PURE__ */ e(
1518
+ "rect",
1519
+ {
1520
+ x: w + h / t.length * C,
1521
+ y: d(b),
1522
+ width: y,
1523
+ height: k - (d(b) - w),
1524
+ fill: c,
1525
+ rx: 1
1526
+ },
1527
+ h
1528
+ ))
1529
+ }
1530
+ );
1531
+ }
1532
+ const u = t.map((y, b) => `${l(b)},${d(y)}`).join(" "), S = t.indexOf(f), g = t.indexOf(N), x = t.length - 1;
1533
+ return /* @__PURE__ */ $(
1534
+ "svg",
1535
+ {
1536
+ width: o,
1537
+ height: i,
1538
+ className: `nice-sparkline ${I || ""}`,
1539
+ style: T,
1540
+ children: [
1541
+ s === "area" && /* @__PURE__ */ e(
1542
+ "polygon",
1543
+ {
1544
+ points: `${l(0)},${w + k} ${u} ${l(x)},${w + k}`,
1545
+ fill: c,
1546
+ opacity: 0.15
1547
+ }
1548
+ ),
1549
+ /* @__PURE__ */ e("polyline", { points: u, fill: "none", stroke: c, strokeWidth: 1.5 }),
1550
+ v && /* @__PURE__ */ e("circle", { cx: l(S), cy: d(f), r: 2, fill: "var(--nice-danger, #ef4444)" }),
1551
+ v && /* @__PURE__ */ e("circle", { cx: l(g), cy: d(N), r: 2, fill: "var(--nice-success, #22c55e)" }),
1552
+ p && /* @__PURE__ */ e("circle", { cx: l(x), cy: d(t[x]), r: 2, fill: c })
1553
+ ]
1554
+ }
1555
+ );
1556
+ }, Ke = {
1557
+ sm: { width: 160, height: 22, fontSize: 11 },
1558
+ md: { width: 220, height: 32, fontSize: 12 },
1559
+ lg: { width: 320, height: 44, fontSize: 14 }
1560
+ }, Mt = ({
1561
+ value: t,
1562
+ target: o,
1563
+ min: i = 0,
1564
+ max: s = 100,
1565
+ width: c,
1566
+ height: v,
1567
+ color: p = "var(--color-primary, #3b82f6)",
1568
+ targetColor: I = "var(--color-error, #ef4444)",
1569
+ size: T = "md",
1570
+ label: w,
1571
+ labelPlacement: f = "top",
1572
+ showValue: N = !1,
1573
+ showTarget: z = !1,
1574
+ formatValue: C = (S) => String(S),
1575
+ state: k = "normal",
1576
+ errorMessage: l,
1577
+ className: d,
1578
+ style: u
1579
+ }) => {
1580
+ const S = Ke[T], g = c ?? S.width, x = v ?? S.height, y = S.fontSize, b = 4, h = g - b * 2, D = z && o != null ? y + 4 : b, a = z && o != null ? x + (D - b) : x, _ = a - D - b, A = Math.max(0, Math.min(1, (t - i) / (s - i || 1))), O = o != null ? Math.max(0, Math.min(1, (o - i) / (s - i || 1))) : null, U = () => k === "error" ? /* @__PURE__ */ e(
1581
+ "div",
1582
+ {
1583
+ role: "alert",
1584
+ style: {
1585
+ width: g,
1586
+ height: a,
1587
+ display: "flex",
1588
+ alignItems: "center",
1589
+ justifyContent: "center",
1590
+ border: "1px dashed var(--color-error, #ef4444)",
1591
+ borderRadius: 4,
1592
+ color: "var(--color-error, #ef4444)",
1593
+ fontSize: y,
1594
+ padding: "0 8px",
1595
+ boxSizing: "border-box"
1596
+ },
1597
+ children: l ?? "Error"
1598
+ }
1599
+ ) : k === "loading" ? /* @__PURE__ */ e(
1600
+ "div",
1601
+ {
1602
+ role: "status",
1603
+ "aria-label": "Loading",
1604
+ className: "nice-bullet__skeleton",
1605
+ style: {
1606
+ width: g,
1607
+ height: a,
1608
+ borderRadius: 4,
1609
+ background: "linear-gradient(90deg, var(--bg-tertiary, #e5e7eb) 25%, var(--bg-secondary, #f3f4f6) 50%, var(--bg-tertiary, #e5e7eb) 75%)",
1610
+ backgroundSize: "200% 100%",
1611
+ animation: "nice-bullet-shimmer 1.4s linear infinite"
1612
+ }
1613
+ }
1614
+ ) : /* @__PURE__ */ $(
1615
+ "svg",
1616
+ {
1617
+ width: g,
1618
+ height: a,
1619
+ role: "img",
1620
+ "aria-label": typeof w == "string" ? w : void 0,
1621
+ children: [
1622
+ /* @__PURE__ */ e(
1623
+ "rect",
1624
+ {
1625
+ x: b,
1626
+ y: D,
1627
+ width: h,
1628
+ height: _,
1629
+ rx: 3,
1630
+ fill: "var(--border-color, #e2e8f0)"
1631
+ }
1632
+ ),
1633
+ /* @__PURE__ */ e(
1634
+ "rect",
1635
+ {
1636
+ x: b,
1637
+ y: D + _ * 0.2,
1638
+ width: h * A,
1639
+ height: _ * 0.6,
1640
+ rx: 2,
1641
+ fill: p
1642
+ }
1643
+ ),
1644
+ O != null && /* @__PURE__ */ e(
1645
+ "line",
1646
+ {
1647
+ x1: b + h * O,
1648
+ y1: D + 2,
1649
+ x2: b + h * O,
1650
+ y2: D + _ - 2,
1651
+ stroke: I,
1652
+ strokeWidth: 2
1653
+ }
1654
+ ),
1655
+ N && /* @__PURE__ */ e(
1656
+ "text",
1657
+ {
1658
+ x: b + Math.max(h * A, 4),
1659
+ y: D + _ / 2,
1660
+ dx: h * A > 24 ? -4 : 4,
1661
+ textAnchor: h * A > 24 ? "end" : "start",
1662
+ dominantBaseline: "middle",
1663
+ fontSize: y,
1664
+ fill: h * A > 24 ? "var(--text-on-primary, #ffffff)" : "var(--text-primary)",
1665
+ fontWeight: 600,
1666
+ children: C(t)
1667
+ }
1668
+ ),
1669
+ z && O != null && /* @__PURE__ */ $(
1670
+ "text",
1671
+ {
1672
+ x: b + h * O,
1673
+ y: D - 2,
1674
+ textAnchor: "middle",
1675
+ fontSize: y - 1,
1676
+ fill: I,
1677
+ fontWeight: 600,
1678
+ children: [
1679
+ "▼",
1680
+ C(o)
1681
+ ]
1682
+ }
1683
+ )
1684
+ ]
1685
+ }
1686
+ );
1687
+ if (f === "none" || !w)
1688
+ return /* @__PURE__ */ $("div", { className: `nice-bullet ${d || ""}`, style: u, children: [
1689
+ U(),
1690
+ /* @__PURE__ */ e("style", { children: Ee })
1691
+ ] });
1692
+ const V = f === "top" || f === "bottom", j = /* @__PURE__ */ e(
1693
+ "span",
1694
+ {
1695
+ className: "nice-bullet__label",
1696
+ style: {
1697
+ fontSize: y,
1698
+ fontWeight: 600,
1699
+ color: "var(--text-primary)",
1700
+ ...V ? {
1701
+ marginBottom: f === "top" ? 4 : 0,
1702
+ marginTop: f === "bottom" ? 4 : 0
1703
+ } : {},
1704
+ ...f === "left" ? { marginRight: 8 } : {},
1705
+ ...f === "right" ? { marginLeft: 8 } : {}
1706
+ },
1707
+ children: w
1708
+ }
1709
+ );
1710
+ return /* @__PURE__ */ $(
1711
+ "div",
1712
+ {
1713
+ className: `nice-bullet nice-bullet--${f} ${d || ""}`,
1714
+ style: {
1715
+ display: "inline-flex",
1716
+ flexDirection: V ? "column" : "row",
1717
+ alignItems: V ? "flex-start" : "center",
1718
+ ...u
1719
+ },
1720
+ children: [
1721
+ (f === "top" || f === "left") && j,
1722
+ U(),
1723
+ (f === "bottom" || f === "right") && j,
1724
+ /* @__PURE__ */ e("style", { children: Ee })
1725
+ ]
1726
+ }
1727
+ );
1728
+ }, Ee = `
1729
+ @keyframes nice-bullet-shimmer {
1730
+ 0% { background-position: 200% 0; }
1731
+ 100% { background-position: -200% 0; }
1732
+ }
1733
+ `, Nt = ({
1734
+ data: t,
1735
+ width: o = 400,
1736
+ height: i = 300,
1737
+ inverted: s,
1738
+ showLabels: c = !0,
1739
+ showValues: v = !0,
1740
+ title: p,
1741
+ className: I,
1742
+ style: T
1743
+ }) => {
1744
+ const w = { top: p ? 30 : 10, bottom: 10, x: 40 }, f = o - w.x * 2, N = i - w.top - w.bottom, z = s ? [...t].reverse() : t, C = Math.max(...z.map((l) => l.value), 1), k = N / z.length;
1745
+ return /* @__PURE__ */ e("div", { className: `nice-funnel ${I || ""}`, style: T, children: /* @__PURE__ */ $("svg", { width: o, height: i, children: [
1746
+ p && /* @__PURE__ */ e("text", { x: o / 2, y: 20, textAnchor: "middle", className: "nice-chart__title", children: p }),
1747
+ z.map((l, d) => {
1748
+ const u = l.value / C * f, S = d < z.length - 1 ? z[d + 1].value / C * f : u * 0.3, g = w.top + d * k, x = g + k, y = o / 2, b = `${y - u / 2},${g} ${y + u / 2},${g} ${y + S / 2},${x} ${y - S / 2},${x}`, h = l.color || ve[d % ve.length];
1749
+ return /* @__PURE__ */ $("g", { children: [
1750
+ /* @__PURE__ */ e(
1751
+ "polygon",
1752
+ {
1753
+ points: b,
1754
+ fill: h,
1755
+ stroke: "var(--bg-primary, #fff)",
1756
+ strokeWidth: 1,
1757
+ children: /* @__PURE__ */ e("title", { children: `${l.label}: ${l.value}` })
1758
+ }
1759
+ ),
1760
+ c && /* @__PURE__ */ e(
1761
+ "text",
1762
+ {
1763
+ x: y,
1764
+ y: g + k / 2 - (v ? 4 : 0),
1765
+ textAnchor: "middle",
1766
+ dominantBaseline: "middle",
1767
+ className: "nice-funnel__label",
1768
+ children: l.label
1769
+ }
1770
+ ),
1771
+ v && /* @__PURE__ */ e(
1772
+ "text",
1773
+ {
1774
+ x: y,
1775
+ y: g + k / 2 + 10,
1776
+ textAnchor: "middle",
1777
+ dominantBaseline: "middle",
1778
+ className: "nice-funnel__value",
1779
+ children: l.value
1780
+ }
1781
+ )
1782
+ ] }, d);
1783
+ })
1784
+ ] }) });
1785
+ }, Qe = ({
1786
+ nodes: t,
1787
+ links: o,
1788
+ width: i = 600,
1789
+ height: s = 400,
1790
+ nodeWidth: c = 20,
1791
+ nodePadding: v = 10,
1792
+ title: p,
1793
+ className: I,
1794
+ style: T
1795
+ }) => {
1796
+ const w = { top: p ? 40 : 20, bottom: 20, left: 20, right: 20 }, f = i - w.left - w.right, N = s - w.top - w.bottom, z = new Set(o.map((a) => a.source)), C = new Set(o.map((a) => a.target)), k = t.filter((a) => z.has(a.id) && !C.has(a.id)), l = t.filter((a) => C.has(a.id)), d = t.filter((a) => z.has(a.id) && C.has(a.id)), u = [k, ...d.length ? [d] : [], l].filter(
1797
+ (a) => a.length > 0
1798
+ ), S = u.length, g = /* @__PURE__ */ new Map();
1799
+ t.forEach((a) => {
1800
+ const _ = o.filter((O) => O.source === a.id).reduce((O, U) => O + U.value, 0), A = o.filter((O) => O.target === a.id).reduce((O, U) => O + U.value, 0);
1801
+ g.set(a.id, Math.max(_, A));
1802
+ });
1803
+ const x = u.map(
1804
+ (a) => a.reduce((_, A) => _ + (g.get(A.id) || 0), 0) + (a.length - 1) * v
1805
+ ), y = Math.max(...x, 1), b = /* @__PURE__ */ new Map();
1806
+ u.forEach((a, _) => {
1807
+ const A = w.left + _ / (S - 1 || 1) * (f - c);
1808
+ let O = 0;
1809
+ a.forEach((U) => {
1810
+ const V = (g.get(U.id) || 0) / y * N;
1811
+ b.set(U.id, { x: A, y: w.top + O, h: V }), O += V + v;
1812
+ });
1813
+ });
1814
+ const h = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map();
1815
+ return t.forEach((a) => {
1816
+ h.set(a.id, 0), D.set(a.id, 0);
1817
+ }), /* @__PURE__ */ e("div", { className: `nice-sankey ${I || ""}`, style: T, children: /* @__PURE__ */ $("svg", { width: i, height: s, children: [
1818
+ p && /* @__PURE__ */ e("text", { x: i / 2, y: 20, textAnchor: "middle", className: "nice-chart__title", children: p }),
1819
+ o.map((a, _) => {
1820
+ const A = b.get(a.source), O = b.get(a.target);
1821
+ if (!A || !O)
1822
+ return null;
1823
+ const U = h.get(a.source) || 0, V = D.get(a.target) || 0, j = a.value / y * N;
1824
+ h.set(a.source, U + j), D.set(a.target, V + j);
1825
+ const G = A.x + c, Q = A.y + U, q = O.x, J = O.y + V, n = (G + q) / 2, H = t.find((W) => W.id === a.source)?.color || ve[_ % ve.length];
1826
+ return /* @__PURE__ */ e(
1827
+ "path",
1828
+ {
1829
+ d: `M${G},${Q} C${n},${Q} ${n},${J} ${q},${J} L${q},${J + j} C${n},${J + j} ${n},${Q + j} ${G},${Q + j} Z`,
1830
+ fill: H,
1831
+ fillOpacity: 0.3,
1832
+ stroke: H,
1833
+ strokeOpacity: 0.5,
1834
+ strokeWidth: 0.5,
1835
+ children: /* @__PURE__ */ e("title", { children: `${a.source} → ${a.target}: ${a.value}` })
1836
+ },
1837
+ _
1838
+ );
1839
+ }),
1840
+ t.map((a, _) => {
1841
+ const A = b.get(a.id);
1842
+ if (!A)
1843
+ return null;
1844
+ const O = a.color || ve[_ % ve.length];
1845
+ return /* @__PURE__ */ $("g", { children: [
1846
+ /* @__PURE__ */ e(
1847
+ "rect",
1848
+ {
1849
+ x: A.x,
1850
+ y: A.y,
1851
+ width: c,
1852
+ height: Math.max(A.h, 2),
1853
+ fill: O,
1854
+ rx: 2
1855
+ }
1856
+ ),
1857
+ /* @__PURE__ */ e(
1858
+ "text",
1859
+ {
1860
+ x: A.x < f / 2 ? A.x + c + 4 : A.x - 4,
1861
+ y: A.y + A.h / 2,
1862
+ textAnchor: A.x < f / 2 ? "start" : "end",
1863
+ dominantBaseline: "middle",
1864
+ className: "nice-chart__legend-text",
1865
+ children: a.label
1866
+ }
1867
+ )
1868
+ ] }, a.id);
1869
+ })
1870
+ ] }) });
1871
+ }, kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1872
+ __proto__: null,
1873
+ NiceSankey: Qe
1874
+ }, Symbol.toStringTag, { value: "Module" })), St = ({
1875
+ data: t,
1876
+ min: o,
1877
+ max: i,
1878
+ start: s,
1879
+ end: c,
1880
+ onChange: v,
1881
+ width: p = 500,
1882
+ height: I = 100,
1883
+ step: T = 1,
1884
+ formatValue: w,
1885
+ chartColor: f = "var(--color-primary, #3b82f6)",
1886
+ className: N,
1887
+ style: z
1888
+ }) => {
1889
+ const C = { top: 10, bottom: 30, left: 10, right: 10 }, k = p - C.left - C.right, l = I - C.top - C.bottom, d = (b) => C.left + (b - o) / (i - o || 1) * k, u = (b) => {
1890
+ const h = Math.max(0, Math.min(1, (b - C.left) / k)), D = o + h * (i - o);
1891
+ return Math.round(D / T) * T;
1892
+ }, S = (b, h) => {
1893
+ h.preventDefault();
1894
+ const D = h.target.closest("svg");
1895
+ if (!D)
1896
+ return;
1897
+ const a = (A) => {
1898
+ const O = D.getBoundingClientRect(), U = u(A.clientX - O.left);
1899
+ b === "start" ? v(Math.min(U, c), c) : v(s, Math.max(U, s));
1900
+ }, _ = () => {
1901
+ document.removeEventListener("pointermove", a), document.removeEventListener("pointerup", _);
1902
+ };
1903
+ document.addEventListener("pointermove", a), document.addEventListener("pointerup", _);
1904
+ }, g = t ? Math.min(...t) : 0, y = (t ? Math.max(...t) : 1) - g || 1;
1905
+ return /* @__PURE__ */ e("div", { className: `nice-rangeselector ${N || ""}`, style: z, children: /* @__PURE__ */ $("svg", { width: p, height: I, children: [
1906
+ t && t.length > 1 && /* @__PURE__ */ e(
1907
+ "polygon",
1908
+ {
1909
+ points: `${C.left},${C.top + l} ${t.map((b, h) => `${C.left + h / (t.length - 1) * k},${C.top + l - (b - g) / y * l}`).join(" ")} ${C.left + k},${C.top + l}`,
1910
+ fill: f,
1911
+ opacity: 0.15
1912
+ }
1913
+ ),
1914
+ /* @__PURE__ */ e(
1915
+ "rect",
1916
+ {
1917
+ x: d(s),
1918
+ y: C.top,
1919
+ width: d(c) - d(s),
1920
+ height: l,
1921
+ fill: f,
1922
+ opacity: 0.1
1923
+ }
1924
+ ),
1925
+ /* @__PURE__ */ e(
1926
+ "rect",
1927
+ {
1928
+ x: C.left,
1929
+ y: C.top,
1930
+ width: d(s) - C.left,
1931
+ height: l,
1932
+ fill: "var(--bg-secondary, #f5f5f5)",
1933
+ opacity: 0.6
1934
+ }
1935
+ ),
1936
+ /* @__PURE__ */ e(
1937
+ "rect",
1938
+ {
1939
+ x: d(c),
1940
+ y: C.top,
1941
+ width: C.left + k - d(c),
1942
+ height: l,
1943
+ fill: "var(--bg-secondary, #f5f5f5)",
1944
+ opacity: 0.6
1945
+ }
1946
+ ),
1947
+ /* @__PURE__ */ e(
1948
+ "rect",
1949
+ {
1950
+ x: d(s) - 4,
1951
+ y: C.top,
1952
+ width: 8,
1953
+ height: l,
1954
+ fill: f,
1955
+ rx: 2,
1956
+ cursor: "ew-resize",
1957
+ onPointerDown: (b) => S("start", b)
1958
+ }
1959
+ ),
1960
+ /* @__PURE__ */ e(
1961
+ "rect",
1962
+ {
1963
+ x: d(c) - 4,
1964
+ y: C.top,
1965
+ width: 8,
1966
+ height: l,
1967
+ fill: f,
1968
+ rx: 2,
1969
+ cursor: "ew-resize",
1970
+ onPointerDown: (b) => S("end", b)
1971
+ }
1972
+ ),
1973
+ /* @__PURE__ */ e(
1974
+ "text",
1975
+ {
1976
+ x: d(s),
1977
+ y: C.top + l + 18,
1978
+ textAnchor: "middle",
1979
+ className: "nice-chart__axis-label",
1980
+ children: w ? w(s) : s
1981
+ }
1982
+ ),
1983
+ /* @__PURE__ */ e(
1984
+ "text",
1985
+ {
1986
+ x: d(c),
1987
+ y: C.top + l + 18,
1988
+ textAnchor: "middle",
1989
+ className: "nice-chart__axis-label",
1990
+ children: w ? w(c) : c
1991
+ }
1992
+ )
1993
+ ] }) });
1994
+ }, et = ({
1995
+ regions: t,
1996
+ width: o = 600,
1997
+ height: i = 400,
1998
+ viewBox: s = "0 0 1000 600",
1999
+ colorRange: c = ["var(--info-bg, #dbeafe)", "var(--color-primary-active, #1d4ed8)"],
2000
+ maxValue: v,
2001
+ onRegionClick: p,
2002
+ selectedRegionId: I,
2003
+ title: T,
2004
+ showTooltip: w = !0,
2005
+ className: f,
2006
+ style: N
2007
+ }) => {
2008
+ const z = v ?? Math.max(...t.map((k) => k.value ?? 0), 1), C = (k) => {
2009
+ const l = (a) => [
2010
+ parseInt(a.slice(1, 3), 16),
2011
+ parseInt(a.slice(3, 5), 16),
2012
+ parseInt(a.slice(5, 7), 16)
2013
+ ], [d, u, S] = l(c[0]), [g, x, y] = l(c[1]), b = Math.round(d + (g - d) * k), h = Math.round(u + (x - u) * k), D = Math.round(S + (y - S) * k);
2014
+ return `rgb(${b},${h},${D})`;
2015
+ };
2016
+ return /* @__PURE__ */ $("div", { className: `nice-vectormap ${f || ""}`, style: N, children: [
2017
+ T && /* @__PURE__ */ e("div", { className: "nice-vectormap__title", children: T }),
2018
+ /* @__PURE__ */ e("svg", { width: o, height: i, viewBox: s, children: t.map((k) => {
2019
+ const l = k.value != null ? Math.max(0, Math.min(1, k.value / z)) : 0, d = k.value != null ? C(l) : "var(--bg-tertiary, #e5e7eb)", u = k.id === I;
2020
+ return /* @__PURE__ */ e(
2021
+ "path",
2022
+ {
2023
+ d: k.path,
2024
+ fill: d,
2025
+ stroke: u ? "var(--color-primary, #3b82f6)" : "var(--border-color, #d1d5db)",
2026
+ strokeWidth: u ? 2 : 0.5,
2027
+ cursor: p ? "pointer" : void 0,
2028
+ onClick: () => p?.(k),
2029
+ children: w && /* @__PURE__ */ e("title", { children: `${k.name}${k.value != null ? `: ${k.value}` : ""}` })
2030
+ },
2031
+ k.id
2032
+ );
2033
+ }) })
2034
+ ] });
2035
+ }, Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2036
+ __proto__: null,
2037
+ NiceVectorMap: et
2038
+ }, Symbol.toStringTag, { value: "Module" })), tt = `
2039
+ .nice-forecast-chart {
2040
+ display: flex;
2041
+ flex-direction: column;
2042
+ background: var(--nice-bg-primary, #ffffff);
2043
+ border: 1px solid var(--nice-border-color, #e5e7eb);
2044
+ border-radius: var(--nice-radius-lg, 0.5rem);
2045
+ overflow: hidden;
2046
+ }
2047
+
2048
+ .nice-forecast-chart__header {
2049
+ display: flex;
2050
+ align-items: center;
2051
+ justify-content: space-between;
2052
+ padding: 0.75rem 1rem;
2053
+ border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
2054
+ }
2055
+
2056
+ .nice-forecast-chart__title {
2057
+ font-size: 1rem;
2058
+ font-weight: 600;
2059
+ color: var(--nice-text-primary);
2060
+ margin: 0;
2061
+ }
2062
+
2063
+ .nice-forecast-chart__actions {
2064
+ display: flex;
2065
+ gap: 0.5rem;
2066
+ }
2067
+
2068
+ .nice-forecast-chart__btn {
2069
+ display: inline-flex;
2070
+ align-items: center;
2071
+ justify-content: center;
2072
+ width: 2rem;
2073
+ height: 2rem;
2074
+ font-size: 1rem;
2075
+ border-radius: var(--nice-radius-md, 0.375rem);
2076
+ cursor: pointer;
2077
+ transition: all 0.15s ease;
2078
+ border: 1px solid var(--nice-border-color, #d1d5db);
2079
+ background: var(--nice-bg-primary, #ffffff);
2080
+ color: var(--nice-text-secondary);
2081
+ }
2082
+
2083
+ .nice-forecast-chart__btn:hover {
2084
+ background: var(--nice-bg-hover, #f3f4f6);
2085
+ color: var(--nice-text-primary);
2086
+ }
2087
+
2088
+ .nice-forecast-chart__btn:disabled {
2089
+ opacity: 0.5;
2090
+ cursor: not-allowed;
2091
+ }
2092
+
2093
+ .nice-forecast-chart__container {
2094
+ position: relative;
2095
+ width: 100%;
2096
+ padding: 1rem;
2097
+ }
2098
+
2099
+ .nice-forecast-chart__svg {
2100
+ width: 100%;
2101
+ overflow: visible;
2102
+ }
2103
+
2104
+ .nice-forecast-chart__grid-line {
2105
+ stroke: var(--nice-border-divider, #f3f4f6);
2106
+ stroke-width: 1;
2107
+ }
2108
+
2109
+ .nice-forecast-chart__axis-line {
2110
+ stroke: var(--nice-border-color, #e5e7eb);
2111
+ stroke-width: 1;
2112
+ }
2113
+
2114
+ .nice-forecast-chart__axis-label {
2115
+ font-size: 0.6875rem;
2116
+ fill: var(--nice-text-secondary);
2117
+ }
2118
+
2119
+ .nice-forecast-chart__axis-title {
2120
+ font-size: 0.75rem;
2121
+ font-weight: 500;
2122
+ fill: var(--nice-text-primary);
2123
+ }
2124
+
2125
+ .nice-forecast-chart__historical-line {
2126
+ fill: none;
2127
+ stroke-width: 2;
2128
+ stroke-linecap: round;
2129
+ stroke-linejoin: round;
2130
+ }
2131
+
2132
+ .nice-forecast-chart__forecast-line {
2133
+ fill: none;
2134
+ stroke-width: 2;
2135
+ stroke-linecap: round;
2136
+ stroke-linejoin: round;
2137
+ stroke-dasharray: 6, 4;
2138
+ }
2139
+
2140
+ .nice-forecast-chart__confidence-band {
2141
+ opacity: 0.2;
2142
+ }
2143
+
2144
+ .nice-forecast-chart__forecast-region {
2145
+ fill: var(--nice-bg-secondary, #f9fafb);
2146
+ opacity: 0.5;
2147
+ }
2148
+
2149
+ .nice-forecast-chart__point {
2150
+ cursor: pointer;
2151
+ transition: r 0.15s ease;
2152
+ }
2153
+
2154
+ .nice-forecast-chart__point:hover {
2155
+ r: 6;
2156
+ }
2157
+
2158
+ .nice-forecast-chart__annotation-line {
2159
+ stroke-dasharray: 4, 2;
2160
+ stroke-width: 1;
2161
+ }
2162
+
2163
+ .nice-forecast-chart__annotation-marker {
2164
+ cursor: pointer;
2165
+ transition: transform 0.15s ease;
2166
+ }
2167
+
2168
+ .nice-forecast-chart__annotation-marker:hover {
2169
+ transform: scale(1.2);
2170
+ }
2171
+
2172
+ .nice-forecast-chart__reference-line {
2173
+ stroke-width: 1;
2174
+ }
2175
+
2176
+ .nice-forecast-chart__reference-label {
2177
+ font-size: 0.625rem;
2178
+ fill: var(--nice-text-secondary);
2179
+ }
2180
+
2181
+ .nice-forecast-chart__cash-runway {
2182
+ pointer-events: none;
2183
+ }
2184
+
2185
+ .nice-forecast-chart__cash-runway-line {
2186
+ stroke: var(--nice-danger, #ef4444);
2187
+ stroke-width: 2;
2188
+ stroke-dasharray: 8, 4;
2189
+ }
2190
+
2191
+ .nice-forecast-chart__cash-runway-label-bg {
2192
+ fill: var(--nice-danger, #ef4444);
2193
+ rx: 4;
2194
+ }
2195
+
2196
+ .nice-forecast-chart__cash-runway-label {
2197
+ font-size: 0.6875rem;
2198
+ font-weight: 600;
2199
+ fill: var(--nice-bg, #FFFFFF);
2200
+ }
2201
+
2202
+ .nice-forecast-chart__cash-runway-date {
2203
+ font-size: 0.625rem;
2204
+ fill: var(--nice-danger, #ef4444);
2205
+ font-weight: 500;
2206
+ }
2207
+
2208
+ .nice-forecast-chart__tooltip {
2209
+ position: absolute;
2210
+ pointer-events: none;
2211
+ z-index: 100;
2212
+ padding: 0.75rem;
2213
+ background: var(--nice-bg-primary, #ffffff);
2214
+ border: 1px solid var(--nice-border-color, #e5e7eb);
2215
+ border-radius: var(--nice-radius-lg, 0.5rem);
2216
+ box-shadow: 0 4px 12px var(--nice-overlay-10, rgba(0, 0, 0, 0.1));
2217
+ font-size: 0.8125rem;
2218
+ max-width: 250px;
2219
+ }
2220
+
2221
+ .nice-forecast-chart__tooltip-date {
2222
+ font-weight: 600;
2223
+ color: var(--nice-text-primary);
2224
+ margin-bottom: 0.5rem;
2225
+ padding-bottom: 0.5rem;
2226
+ border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
2227
+ }
2228
+
2229
+ .nice-forecast-chart__tooltip-item {
2230
+ display: flex;
2231
+ align-items: center;
2232
+ gap: 0.5rem;
2233
+ margin-bottom: 0.25rem;
2234
+ }
2235
+
2236
+ .nice-forecast-chart__tooltip-color {
2237
+ width: 10px;
2238
+ height: 10px;
2239
+ border-radius: var(--nice-radius-sm, 2px);
2240
+ flex-shrink: 0;
2241
+ }
2242
+
2243
+ .nice-forecast-chart__tooltip-label {
2244
+ color: var(--nice-text-secondary);
2245
+ flex: 1;
2246
+ }
2247
+
2248
+ .nice-forecast-chart__tooltip-value {
2249
+ font-weight: 600;
2250
+ color: var(--nice-text-primary);
2251
+ font-variant-numeric: tabular-nums;
2252
+ }
2253
+
2254
+ .nice-forecast-chart__tooltip-confidence {
2255
+ font-size: 0.75rem;
2256
+ color: var(--nice-text-tertiary);
2257
+ }
2258
+
2259
+ .nice-forecast-chart__legend {
2260
+ display: flex;
2261
+ flex-wrap: wrap;
2262
+ gap: 1rem;
2263
+ padding: 0.75rem 1rem;
2264
+ border-top: 1px solid var(--nice-border-color, #e5e7eb);
2265
+ }
2266
+
2267
+ .nice-forecast-chart__legend-item {
2268
+ display: flex;
2269
+ align-items: center;
2270
+ gap: 0.375rem;
2271
+ font-size: 0.8125rem;
2272
+ color: var(--nice-text-secondary);
2273
+ cursor: pointer;
2274
+ user-select: none;
2275
+ transition: opacity 0.15s ease;
2276
+ }
2277
+
2278
+ .nice-forecast-chart__legend-item:hover {
2279
+ color: var(--nice-text-primary);
2280
+ }
2281
+
2282
+ .nice-forecast-chart__legend-item--hidden {
2283
+ opacity: 0.4;
2284
+ }
2285
+
2286
+ .nice-forecast-chart__legend-color {
2287
+ width: 16px;
2288
+ height: 3px;
2289
+ border-radius: var(--nice-radius-xs, 1px);
2290
+ }
2291
+
2292
+ .nice-forecast-chart__legend-color--dashed {
2293
+ background: repeating-linear-gradient(
2294
+ 90deg,
2295
+ currentColor,
2296
+ currentColor 4px,
2297
+ transparent 4px,
2298
+ transparent 6px
2299
+ );
2300
+ }
2301
+
2302
+ .nice-forecast-chart__empty {
2303
+ display: flex;
2304
+ align-items: center;
2305
+ justify-content: center;
2306
+ height: 300px;
2307
+ color: var(--nice-text-secondary);
2308
+ }
2309
+
2310
+ /* Dark mode */
2311
+ .dark .nice-forecast-chart {
2312
+ background: var(--nice-bg-primary-dark, #111827);
2313
+ border-color: var(--nice-border-color-dark, #374151);
2314
+ }
2315
+
2316
+ .dark .nice-forecast-chart__tooltip {
2317
+ background: var(--nice-bg-secondary-dark, #1f2937);
2318
+ border-color: var(--nice-border-color-dark, #374151);
2319
+ }
2320
+
2321
+ .dark .nice-forecast-chart__forecast-region {
2322
+ fill: var(--nice-bg-secondary-dark, #1f2937);
2323
+ }
2324
+ `, Oe = [
2325
+ "var(--color-primary, #3b82f6)",
2326
+ // blue
2327
+ "var(--color-success, #10b981)",
2328
+ // green
2329
+ "var(--color-warning, #f59e0b)",
2330
+ // amber
2331
+ "var(--color-error, #ef4444)",
2332
+ // red
2333
+ "var(--color-accent, #8b5cf6)",
2334
+ // purple
2335
+ "var(--color-accent-pink, #ec4899)",
2336
+ // pink
2337
+ "var(--color-info, #06b6d4)",
2338
+ // cyan
2339
+ "var(--nice-warning, #f97316)"
2340
+ // orange
2341
+ ];
2342
+ function xe(t) {
2343
+ return t instanceof Date ? t : new Date(t);
2344
+ }
2345
+ function Be(t, o = "pl-PL") {
2346
+ return t.toLocaleDateString(o, {
2347
+ year: "numeric",
2348
+ month: "short",
2349
+ day: "numeric"
2350
+ });
2351
+ }
2352
+ function Ie(t, o = "pl-PL") {
2353
+ return new Intl.NumberFormat(o, {
2354
+ minimumFractionDigits: 0,
2355
+ maximumFractionDigits: 2
2356
+ }).format(t);
2357
+ }
2358
+ const At = Ne(
2359
+ function(o, i) {
2360
+ const {
2361
+ scenarios: s,
2362
+ data: c,
2363
+ annotations: v = [],
2364
+ referenceLines: p = [],
2365
+ forecastStartDate: I,
2366
+ cashRunway: T,
2367
+ xAxis: w,
2368
+ yAxis: f,
2369
+ confidenceBands: N = [{ level: 95, color: "var(--color-primary, #3b82f6)", opacity: 0.15 }],
2370
+ tooltip: z,
2371
+ legend: C = { enabled: !0, position: "bottom", interactive: !0 },
2372
+ height: k = 350,
2373
+ showForecastRegion: l = !0,
2374
+ lineWidth: d = 2,
2375
+ showPoints: u = !1,
2376
+ pointRadius: S = 4,
2377
+ enableZoom: g = !1,
2378
+ zoomEnabled: x,
2379
+ animationDuration: y = 300,
2380
+ showLegend: b,
2381
+ responsive: h = !0,
2382
+ onPointClick: D,
2383
+ onAnnotationClick: a,
2384
+ onScenarioToggle: _,
2385
+ onViewportChange: A,
2386
+ size: O = "medium",
2387
+ disabled: U = !1,
2388
+ labels: V = {},
2389
+ locale: j = "pl-PL",
2390
+ className: G,
2391
+ style: Q
2392
+ } = o, q = s && s.length > 0 ? s : c ? [
2393
+ {
2394
+ id: "default",
2395
+ name: "Series",
2396
+ data: c
2397
+ }
2398
+ ] : [], J = {
2399
+ ...C,
2400
+ enabled: b ?? C.enabled
2401
+ }, [n, X] = oe(
2402
+ () => q.map((r, R) => ({
2403
+ ...r,
2404
+ color: r.color ?? Oe[R % Oe.length],
2405
+ visible: r.visible !== !1
2406
+ }))
2407
+ ), [H, W] = oe(null), [m, F] = oe({ x: 0, y: 0 }), Y = be(null), ee = be(null), P = { top: 20, right: 30, bottom: 40, left: 60 }, [te, fe] = oe({
2408
+ width: 600,
2409
+ height: typeof k == "number" ? k : 350
2410
+ });
2411
+ Ce(() => {
2412
+ if (!h || !Y.current)
2413
+ return;
2414
+ const r = new ResizeObserver((R) => {
2415
+ for (const E of R)
2416
+ fe((M) => ({
2417
+ width: E.contentRect.width,
2418
+ height: M.height
2419
+ }));
2420
+ });
2421
+ return r.observe(Y.current), () => r.disconnect();
2422
+ }, [h]), Ce(() => {
2423
+ const r = "nice-forecast-chart-styles";
2424
+ if (!document.getElementById(r)) {
2425
+ const R = document.createElement("style");
2426
+ R.id = r, R.textContent = tt, document.head.appendChild(R);
2427
+ }
2428
+ }, []);
2429
+ const { xScale: L, yScale: Z, allDates: ne, minY: ue, maxY: _e } = pe(() => {
2430
+ const R = n.filter((me) => me.visible !== !1).flatMap((me) => me.data);
2431
+ if (R.length === 0)
2432
+ return { xScale: () => 0, yScale: () => 0, allDates: [], minY: 0, maxY: 100 };
2433
+ const E = R.map((me) => xe(me.date).getTime()), M = Math.min(...E), K = Math.max(...E), ie = R.flatMap((me) => [me.value, me.forecast, me.lowerBound, me.upperBound]).filter((me) => me != null), le = f?.min ?? Math.min(...ie) * 0.95, he = f?.max ?? Math.max(...ie) * 1.05, we = te.width - P.left - P.right, Me = te.height - P.top - P.bottom, Le = (me) => {
2434
+ const Te = typeof me == "number" ? me : me.getTime();
2435
+ return P.left + (Te - M) / (K - M) * we;
2436
+ }, De = (me) => P.top + Me - (me - le) / (he - le) * Me, He = [...new Set(E)].sort((me, Te) => me - Te).map((me) => new Date(me));
2437
+ return {
2438
+ xScale: Le,
2439
+ yScale: De,
2440
+ allDates: He,
2441
+ minY: le,
2442
+ maxY: he
2443
+ };
2444
+ }, [n, te, P, f]), ge = I ? xe(I) : null, ye = pe(() => {
2445
+ if (!T?.enabled)
2446
+ return null;
2447
+ const r = T.threshold ?? 0, R = T.scenarioId ? n.find((M) => M.id === T.scenarioId && M.visible !== !1) : n.find((M) => M.visible !== !1);
2448
+ if (!R)
2449
+ return null;
2450
+ const E = R.data.sort(
2451
+ (M, K) => xe(M.date).getTime() - xe(K.date).getTime()
2452
+ );
2453
+ for (let M = 1; M < E.length; M++) {
2454
+ const K = E[M - 1], ie = E[M], le = K.forecast ?? K.value, he = ie.forecast ?? ie.value;
2455
+ if (le != null && he != null && le > r && he <= r) {
2456
+ const we = (le - r) / (le - he), Me = xe(K.date).getTime(), Le = xe(ie.date).getTime(), De = Me + we * (Le - Me);
2457
+ return new Date(De);
2458
+ }
2459
+ }
2460
+ return null;
2461
+ }, [T, n]), $e = ae(
2462
+ (r, R) => {
2463
+ const E = r.filter((M) => M[R] != null).map((M) => ({ x: L(xe(M.date)), y: Z(M[R]) }));
2464
+ return E.length === 0 ? "" : `M ${E.map((M) => `${M.x},${M.y}`).join(" L ")}`;
2465
+ },
2466
+ [L, Z]
2467
+ ), Se = ae(
2468
+ (r) => {
2469
+ const R = r.filter((K) => K.lowerBound != null && K.upperBound != null);
2470
+ if (R.length === 0)
2471
+ return "";
2472
+ const E = R.map((K) => ({
2473
+ x: L(xe(K.date)),
2474
+ y: Z(K.upperBound)
2475
+ })), M = R.map((K) => ({ x: L(xe(K.date)), y: Z(K.lowerBound) })).reverse();
2476
+ return `M ${E.map((K) => `${K.x},${K.y}`).join(" L ")} L ${M.map((K) => `${K.x},${K.y}`).join(" L ")} Z`;
2477
+ },
2478
+ [L, Z]
2479
+ ), B = ae(
2480
+ (r) => {
2481
+ if (!ee.current || z?.enabled === !1)
2482
+ return;
2483
+ const R = ee.current.getBoundingClientRect(), E = r.clientX - R.left;
2484
+ r.clientY - R.top;
2485
+ let M = null, K = 1 / 0;
2486
+ for (const ie of ne) {
2487
+ const le = L(ie), he = Math.abs(le - E);
2488
+ he < K && (K = he, M = ie);
2489
+ }
2490
+ if (M && K < 50) {
2491
+ const ie = n.filter((he) => he.visible !== !1).map((he) => {
2492
+ const we = he.data.find((Me) => xe(Me.date).getTime() === M.getTime());
2493
+ return {
2494
+ scenario: he,
2495
+ value: we?.value,
2496
+ forecast: we?.forecast,
2497
+ lowerBound: we?.lowerBound,
2498
+ upperBound: we?.upperBound
2499
+ };
2500
+ }), le = v.filter(
2501
+ (he) => Math.abs(xe(he.date).getTime() - M.getTime()) < 864e5
2502
+ );
2503
+ W({ date: M, values: ie, annotations: le }), F({ x: r.clientX - R.left + 10, y: r.clientY - R.top - 10 });
2504
+ } else
2505
+ W(null);
2506
+ },
2507
+ [L, ne, n, v, z]
2508
+ ), re = ae(
2509
+ (r) => {
2510
+ if (!J.interactive)
2511
+ return;
2512
+ X((E) => E.map((M) => M.id === r ? { ...M, visible: !M.visible } : M));
2513
+ const R = n.find((E) => E.id === r);
2514
+ R && _?.(r, !R.visible);
2515
+ },
2516
+ [J.interactive, n, _]
2517
+ );
2518
+ Ae(
2519
+ i,
2520
+ () => ({
2521
+ getScenarios: () => n,
2522
+ updateScenario: (r, R) => {
2523
+ X((E) => E.map((M) => M.id === r ? { ...M, data: R } : M));
2524
+ },
2525
+ toggleScenario: re,
2526
+ setZoomRange: () => {
2527
+ },
2528
+ // Would need pan/zoom implementation
2529
+ resetZoom: () => {
2530
+ },
2531
+ exportImage: (r) => {
2532
+ if (!ee.current)
2533
+ return null;
2534
+ const R = ee.current, M = new XMLSerializer().serializeToString(R);
2535
+ return `data:image/svg+xml;base64,${btoa(M)}`;
2536
+ },
2537
+ getDataAtDate: (r) => {
2538
+ const R = n.filter((E) => E.visible !== !1).map((E) => {
2539
+ const M = E.data.find((K) => xe(K.date).getTime() === r.getTime());
2540
+ return {
2541
+ scenario: E,
2542
+ value: M?.value,
2543
+ forecast: M?.forecast,
2544
+ lowerBound: M?.lowerBound,
2545
+ upperBound: M?.upperBound
2546
+ };
2547
+ });
2548
+ return {
2549
+ date: r,
2550
+ values: R,
2551
+ annotations: v.filter((E) => xe(E.date).getTime() === r.getTime())
2552
+ };
2553
+ }
2554
+ }),
2555
+ [n, v, re]
2556
+ ), te.width - P.left - P.right;
2557
+ const ce = te.height - P.top - P.bottom, se = pe(() => {
2558
+ const r = f?.tickCount ?? 5, R = [], E = (_e - ue) / (r - 1);
2559
+ for (let M = 0; M < r; M++)
2560
+ R.push(ue + E * M);
2561
+ return R;
2562
+ }, [ue, _e, f?.tickCount]), de = pe(() => {
2563
+ const r = w?.tickCount ?? 6;
2564
+ if (ne.length === 0)
2565
+ return [];
2566
+ const R = Math.max(1, Math.floor(ne.length / (r - 1)));
2567
+ return ne.filter((E, M) => M % R === 0 || M === ne.length - 1);
2568
+ }, [ne, w?.tickCount]);
2569
+ return n.length === 0 || n.every((r) => r.data.length === 0) ? /* @__PURE__ */ e("div", { className: `nice-forecast-chart ${G ?? ""}`, style: Q, children: /* @__PURE__ */ e("div", { className: "nice-forecast-chart__empty", children: V.noData ?? "No data available" }) }) : /* @__PURE__ */ $("div", { className: `nice-forecast-chart ${G ?? ""}`, style: { ...Q, height: k }, children: [
2570
+ /* @__PURE__ */ $("div", { ref: Y, className: "nice-forecast-chart__container", children: [
2571
+ /* @__PURE__ */ $(
2572
+ "svg",
2573
+ {
2574
+ ref: ee,
2575
+ className: "nice-forecast-chart__svg",
2576
+ width: te.width,
2577
+ height: te.height,
2578
+ onMouseMove: B,
2579
+ onMouseLeave: () => W(null),
2580
+ children: [
2581
+ f?.showGrid !== !1 && se.map((r) => /* @__PURE__ */ e(
2582
+ "line",
2583
+ {
2584
+ className: "nice-forecast-chart__grid-line",
2585
+ x1: P.left,
2586
+ x2: te.width - P.right,
2587
+ y1: Z(r),
2588
+ y2: Z(r)
2589
+ },
2590
+ r
2591
+ )),
2592
+ l && ge && /* @__PURE__ */ e(
2593
+ "rect",
2594
+ {
2595
+ className: "nice-forecast-chart__forecast-region",
2596
+ x: L(ge),
2597
+ y: P.top,
2598
+ width: te.width - P.right - L(ge),
2599
+ height: ce
2600
+ }
2601
+ ),
2602
+ p.map((r) => /* @__PURE__ */ $("g", { children: [
2603
+ /* @__PURE__ */ e(
2604
+ "line",
2605
+ {
2606
+ className: "nice-forecast-chart__reference-line",
2607
+ x1: P.left,
2608
+ x2: te.width - P.right,
2609
+ y1: Z(r.value),
2610
+ y2: Z(r.value),
2611
+ stroke: r.color ?? "var(--text-muted, #9ca3af)",
2612
+ strokeDasharray: r.dashArray ?? "4,2"
2613
+ }
2614
+ ),
2615
+ r.label && /* @__PURE__ */ e(
2616
+ "text",
2617
+ {
2618
+ className: "nice-forecast-chart__reference-label",
2619
+ x: te.width - P.right - 4,
2620
+ y: Z(r.value) - 4,
2621
+ textAnchor: "end",
2622
+ children: r.label
2623
+ }
2624
+ )
2625
+ ] }, r.id)),
2626
+ ye && T?.enabled && /* @__PURE__ */ $("g", { className: "nice-forecast-chart__cash-runway", children: [
2627
+ /* @__PURE__ */ e(
2628
+ "line",
2629
+ {
2630
+ className: "nice-forecast-chart__cash-runway-line",
2631
+ x1: L(ye),
2632
+ x2: L(ye),
2633
+ y1: P.top,
2634
+ y2: te.height - P.bottom,
2635
+ stroke: T.color ?? "var(--color-error, #ef4444)"
2636
+ }
2637
+ ),
2638
+ T.showLabel !== !1 && /* @__PURE__ */ $(Pe, { children: [
2639
+ /* @__PURE__ */ e(
2640
+ "rect",
2641
+ {
2642
+ className: "nice-forecast-chart__cash-runway-label-bg",
2643
+ x: L(ye) - 60,
2644
+ y: P.top - 2,
2645
+ width: 120,
2646
+ height: T.showDate !== !1 ? 32 : 20,
2647
+ fill: T.color ?? "var(--color-error, #ef4444)",
2648
+ rx: 4
2649
+ }
2650
+ ),
2651
+ /* @__PURE__ */ e(
2652
+ "text",
2653
+ {
2654
+ className: "nice-forecast-chart__cash-runway-label",
2655
+ x: L(ye),
2656
+ y: P.top + 12,
2657
+ textAnchor: "middle",
2658
+ fill: "var(--nice-bg, #fff)",
2659
+ children: T.label ?? V.cashRunsOut ?? "💰 Cash runs out"
2660
+ }
2661
+ ),
2662
+ T.showDate !== !1 && /* @__PURE__ */ e(
2663
+ "text",
2664
+ {
2665
+ className: "nice-forecast-chart__cash-runway-label",
2666
+ x: L(ye),
2667
+ y: P.top + 26,
2668
+ textAnchor: "middle",
2669
+ fill: "var(--nice-bg, #fff)",
2670
+ style: { fontSize: "0.625rem", opacity: 0.9 },
2671
+ children: Be(ye, j)
2672
+ }
2673
+ )
2674
+ ] })
2675
+ ] }),
2676
+ n.filter((r) => r.visible !== !1 && r.showConfidenceBand).map((r) => /* @__PURE__ */ e(
2677
+ "path",
2678
+ {
2679
+ className: "nice-forecast-chart__confidence-band",
2680
+ d: Se(r.data),
2681
+ fill: r.color
2682
+ },
2683
+ `band-${r.id}`
2684
+ )),
2685
+ n.filter((r) => r.visible !== !1).map((r) => {
2686
+ const R = ge ? r.data.filter((M) => xe(M.date) < ge) : r.data.filter((M) => M.value != null), E = ge ? r.data.filter((M) => xe(M.date) >= ge) : r.data.filter((M) => M.forecast != null);
2687
+ return /* @__PURE__ */ $("g", { children: [
2688
+ /* @__PURE__ */ e(
2689
+ "path",
2690
+ {
2691
+ className: "nice-forecast-chart__historical-line",
2692
+ d: $e(R, "value"),
2693
+ stroke: r.color,
2694
+ strokeWidth: d
2695
+ }
2696
+ ),
2697
+ /* @__PURE__ */ e(
2698
+ "path",
2699
+ {
2700
+ className: "nice-forecast-chart__forecast-line",
2701
+ d: $e(E, ge ? "value" : "forecast"),
2702
+ stroke: r.color,
2703
+ strokeWidth: d
2704
+ }
2705
+ ),
2706
+ E.length > 0 && r.data.some((M) => M.forecast != null) && /* @__PURE__ */ e(
2707
+ "path",
2708
+ {
2709
+ className: "nice-forecast-chart__forecast-line",
2710
+ d: $e(r.data, "forecast"),
2711
+ stroke: r.color,
2712
+ strokeWidth: d
2713
+ }
2714
+ ),
2715
+ u && r.data.map((M, K) => {
2716
+ const ie = M.value ?? M.forecast;
2717
+ return ie == null ? null : /* @__PURE__ */ e(
2718
+ "circle",
2719
+ {
2720
+ className: "nice-forecast-chart__point",
2721
+ cx: L(xe(M.date)),
2722
+ cy: Z(ie),
2723
+ r: S,
2724
+ fill: r.color,
2725
+ onClick: () => D?.(M, r)
2726
+ },
2727
+ K
2728
+ );
2729
+ })
2730
+ ] }, r.id);
2731
+ }),
2732
+ v.map((r) => {
2733
+ const R = L(xe(r.date));
2734
+ return /* @__PURE__ */ $(
2735
+ "g",
2736
+ {
2737
+ className: "nice-forecast-chart__annotation-marker",
2738
+ onClick: () => a?.(r),
2739
+ children: [
2740
+ r.showLine !== !1 && /* @__PURE__ */ e(
2741
+ "line",
2742
+ {
2743
+ className: "nice-forecast-chart__annotation-line",
2744
+ x1: R,
2745
+ x2: R,
2746
+ y1: P.top,
2747
+ y2: te.height - P.bottom,
2748
+ stroke: r.color ?? "var(--text-muted, #9ca3af)"
2749
+ }
2750
+ ),
2751
+ /* @__PURE__ */ e(
2752
+ "circle",
2753
+ {
2754
+ cx: R,
2755
+ cy: P.top + 10,
2756
+ r: 8,
2757
+ fill: r.color ?? "var(--text-muted, #9ca3af)"
2758
+ }
2759
+ ),
2760
+ /* @__PURE__ */ e("text", { x: R, y: P.top + 14, textAnchor: "middle", fill: "white", fontSize: "10", children: r.icon ?? "!" })
2761
+ ]
2762
+ },
2763
+ r.id
2764
+ );
2765
+ }),
2766
+ /* @__PURE__ */ e(
2767
+ "line",
2768
+ {
2769
+ className: "nice-forecast-chart__axis-line",
2770
+ x1: P.left,
2771
+ x2: P.left,
2772
+ y1: P.top,
2773
+ y2: te.height - P.bottom
2774
+ }
2775
+ ),
2776
+ /* @__PURE__ */ e(
2777
+ "line",
2778
+ {
2779
+ className: "nice-forecast-chart__axis-line",
2780
+ x1: P.left,
2781
+ x2: te.width - P.right,
2782
+ y1: te.height - P.bottom,
2783
+ y2: te.height - P.bottom
2784
+ }
2785
+ ),
2786
+ se.map((r) => /* @__PURE__ */ e(
2787
+ "text",
2788
+ {
2789
+ className: "nice-forecast-chart__axis-label",
2790
+ x: P.left - 8,
2791
+ y: Z(r) + 4,
2792
+ textAnchor: "end",
2793
+ children: f?.format ? f.format(r) : Ie(r, j)
2794
+ },
2795
+ r
2796
+ )),
2797
+ de.map((r) => /* @__PURE__ */ e(
2798
+ "text",
2799
+ {
2800
+ className: "nice-forecast-chart__axis-label",
2801
+ x: L(r),
2802
+ y: te.height - P.bottom + 16,
2803
+ textAnchor: "middle",
2804
+ children: w?.format ? w.format(r) : Be(r, j)
2805
+ },
2806
+ r.getTime()
2807
+ )),
2808
+ f?.title && /* @__PURE__ */ e(
2809
+ "text",
2810
+ {
2811
+ className: "nice-forecast-chart__axis-title",
2812
+ x: 15,
2813
+ y: te.height / 2,
2814
+ textAnchor: "middle",
2815
+ transform: `rotate(-90, 15, ${te.height / 2})`,
2816
+ children: f.title
2817
+ }
2818
+ )
2819
+ ]
2820
+ }
2821
+ ),
2822
+ H && /* @__PURE__ */ $(
2823
+ "div",
2824
+ {
2825
+ className: "nice-forecast-chart__tooltip",
2826
+ style: { left: m.x, top: m.y },
2827
+ children: [
2828
+ /* @__PURE__ */ e("div", { className: "nice-forecast-chart__tooltip-date", children: Be(H.date, j) }),
2829
+ H.values.map((r) => {
2830
+ const R = r.value ?? r.forecast;
2831
+ return R == null ? null : /* @__PURE__ */ $("div", { className: "nice-forecast-chart__tooltip-item", children: [
2832
+ /* @__PURE__ */ e(
2833
+ "span",
2834
+ {
2835
+ className: "nice-forecast-chart__tooltip-color",
2836
+ style: { background: r.scenario.color }
2837
+ }
2838
+ ),
2839
+ /* @__PURE__ */ e("span", { className: "nice-forecast-chart__tooltip-label", children: r.scenario.name }),
2840
+ /* @__PURE__ */ e("span", { className: "nice-forecast-chart__tooltip-value", children: Ie(R, j) })
2841
+ ] }, r.scenario.id);
2842
+ }),
2843
+ H.values.some((r) => r.lowerBound != null) && /* @__PURE__ */ $("div", { className: "nice-forecast-chart__tooltip-confidence", children: [
2844
+ V.confidence ?? "CI",
2845
+ ":",
2846
+ " ",
2847
+ Ie(H.values[0]?.lowerBound ?? 0, j),
2848
+ " –",
2849
+ " ",
2850
+ Ie(H.values[0]?.upperBound ?? 0, j)
2851
+ ] })
2852
+ ]
2853
+ }
2854
+ )
2855
+ ] }),
2856
+ J.enabled && /* @__PURE__ */ e("div", { className: "nice-forecast-chart__legend", children: n.map((r) => /* @__PURE__ */ $(
2857
+ "div",
2858
+ {
2859
+ className: `nice-forecast-chart__legend-item ${r.visible === !1 ? "nice-forecast-chart__legend-item--hidden" : ""}`,
2860
+ onClick: () => re(r.id),
2861
+ children: [
2862
+ /* @__PURE__ */ e(
2863
+ "span",
2864
+ {
2865
+ className: `nice-forecast-chart__legend-color ${r.isBase ? "" : "nice-forecast-chart__legend-color--dashed"}`,
2866
+ style: { background: r.color }
2867
+ }
2868
+ ),
2869
+ r.name
2870
+ ]
2871
+ },
2872
+ r.id
2873
+ )) })
2874
+ ] });
2875
+ }
2876
+ ), Ye = [
2877
+ "var(--color-primary, #3b82f6)",
2878
+ "var(--color-error, #ef4444)",
2879
+ "var(--color-success, #22c55e)",
2880
+ "var(--color-warning, #f59e0b)",
2881
+ "var(--color-accent, #8b5cf6)",
2882
+ "var(--color-accent-pink, #ec4899)",
2883
+ "var(--color-info, #06b6d4)",
2884
+ "var(--nice-success, #84cc16)",
2885
+ "var(--nice-warning, #f97316)",
2886
+ "var(--color-accent, #6366f1)"
2887
+ ], nt = Ne(
2888
+ (t, o) => {
2889
+ const {
2890
+ levels: i,
2891
+ initialLevelId: s,
2892
+ chartType: c = "bar",
2893
+ width: v = 600,
2894
+ height: p = 400,
2895
+ showBreadcrumbs: I = !0,
2896
+ showBackButton: T = !0,
2897
+ animationDuration: w = 300,
2898
+ onLevelChange: f,
2899
+ onItemClick: N,
2900
+ colors: z = Ye,
2901
+ showValues: C = !0,
2902
+ showLegend: k = !0,
2903
+ className: l,
2904
+ style: d,
2905
+ ...u
2906
+ } = t, [S, g] = oe(s || i[0]?.id), [x, y] = oe([s || i[0]?.id]), [b, h] = oe(!1), [D, a] = oe("in"), _ = pe(
2907
+ () => i.find((n) => n.id === S),
2908
+ [i, S]
2909
+ ), A = ae(
2910
+ (n) => {
2911
+ i.find((H) => H.id === n) && (a("in"), h(!0), setTimeout(() => {
2912
+ g(n), y((H) => [...H, n]), f?.(n, [...x, n]), h(!1);
2913
+ }, w / 2));
2914
+ },
2915
+ [i, x, w, f]
2916
+ ), O = ae(() => {
2917
+ if (x.length <= 1)
2918
+ return;
2919
+ a("out"), h(!0);
2920
+ const n = x.slice(0, -1), X = n[n.length - 1];
2921
+ setTimeout(() => {
2922
+ g(X), y(n), f?.(X, n), h(!1);
2923
+ }, w / 2);
2924
+ }, [x, w, f]), U = ae(() => {
2925
+ const n = i[0]?.id;
2926
+ n && (a("out"), h(!0), setTimeout(() => {
2927
+ g(n), y([n]), f?.(n, [n]), h(!1);
2928
+ }, w / 2));
2929
+ }, [i, w, f]);
2930
+ Ae(
2931
+ o,
2932
+ () => ({
2933
+ drillDown: A,
2934
+ drillUp: O,
2935
+ resetToRoot: U,
2936
+ getCurrentLevel: () => S,
2937
+ getPath: () => x
2938
+ }),
2939
+ [A, O, U, S, x]
2940
+ );
2941
+ const V = ae(
2942
+ (n, X) => {
2943
+ N?.(n, S);
2944
+ const H = i.find(
2945
+ (W) => W.parentId === S && W.id === n.metadata?.childLevelId
2946
+ );
2947
+ H && A(H.id);
2948
+ },
2949
+ [S, i, A, N]
2950
+ ), j = pe(
2951
+ () => _?.data.reduce((n, X) => n + X.value, 0) || 0,
2952
+ [_]
2953
+ ), G = pe(
2954
+ () => x.map((n) => i.find((X) => X.id === n)?.label || n),
2955
+ [x, i]
2956
+ ), Q = () => {
2957
+ if (!_)
2958
+ return null;
2959
+ const n = _.data, X = Math.max(...n.map((W) => W.value)), H = Math.min(40, (p - 100) / n.length - 8);
2960
+ return /* @__PURE__ */ e("div", { className: "nice-drilldown-bars", children: n.map((W, m) => {
2961
+ const F = W.value / X * 100;
2962
+ return /* @__PURE__ */ $(
2963
+ "div",
2964
+ {
2965
+ className: "nice-drilldown-bar-row",
2966
+ onClick: () => V(W, m),
2967
+ children: [
2968
+ /* @__PURE__ */ e("span", { className: "nice-drilldown-bar-label", children: W.label || `Item ${m + 1}` }),
2969
+ /* @__PURE__ */ e("div", { className: "nice-drilldown-bar-track", children: /* @__PURE__ */ e(
2970
+ "div",
2971
+ {
2972
+ className: "nice-drilldown-bar-fill",
2973
+ style: {
2974
+ width: `${F}%`,
2975
+ backgroundColor: W.color || z[m % z.length],
2976
+ height: H
2977
+ }
2978
+ }
2979
+ ) }),
2980
+ C && /* @__PURE__ */ e("span", { className: "nice-drilldown-bar-value", children: W.value.toLocaleString() })
2981
+ ]
2982
+ },
2983
+ m
2984
+ );
2985
+ }) });
2986
+ }, q = () => {
2987
+ if (!_)
2988
+ return null;
2989
+ const n = _.data, X = v / 2, H = (p - 60) / 2 + 30, W = Math.min(X, H) - 40;
2990
+ let m = -90;
2991
+ const F = n.map((Y, ee) => {
2992
+ const P = Y.value / j * 360, te = m + P, fe = P > 180 ? 1 : 0, L = m * Math.PI / 180, Z = te * Math.PI / 180, ne = X + W * Math.cos(L), ue = H + W * Math.sin(L), _e = X + W * Math.cos(Z), ge = H + W * Math.sin(Z), ye = (m + P / 2) * Math.PI / 180, $e = X + W * 0.7 * Math.cos(ye), Se = H + W * 0.7 * Math.sin(ye), B = `M ${X} ${H} L ${ne} ${ue} A ${W} ${W} 0 ${fe} 1 ${_e} ${ge} Z`;
2993
+ return m = te, {
2994
+ path: B,
2995
+ color: Y.color || z[ee % z.length],
2996
+ label: Y.label || `Item ${ee + 1}`,
2997
+ value: Y.value,
2998
+ percentage: (Y.value / j * 100).toFixed(1),
2999
+ labelX: $e,
3000
+ labelY: Se,
3001
+ item: Y,
3002
+ index: ee
3003
+ };
3004
+ });
3005
+ return /* @__PURE__ */ e("svg", { width: v, height: p - 40, className: "nice-drilldown-pie", children: /* @__PURE__ */ e("g", { children: F.map((Y, ee) => /* @__PURE__ */ $("g", { onClick: () => V(Y.item, Y.index), children: [
3006
+ /* @__PURE__ */ e(
3007
+ "path",
3008
+ {
3009
+ d: Y.path,
3010
+ fill: Y.color,
3011
+ stroke: "white",
3012
+ strokeWidth: 2,
3013
+ className: "nice-drilldown-pie-slice"
3014
+ }
3015
+ ),
3016
+ C && parseFloat(Y.percentage) > 5 && /* @__PURE__ */ $(
3017
+ "text",
3018
+ {
3019
+ x: Y.labelX,
3020
+ y: Y.labelY,
3021
+ textAnchor: "middle",
3022
+ dominantBaseline: "middle",
3023
+ fill: "white",
3024
+ fontSize: "12",
3025
+ fontWeight: "600",
3026
+ children: [
3027
+ Y.percentage,
3028
+ "%"
3029
+ ]
3030
+ }
3031
+ )
3032
+ ] }, ee)) }) });
3033
+ }, J = () => {
3034
+ if (!_)
3035
+ return null;
3036
+ const n = _.data, X = Math.max(...n.map((m) => m.value)), H = Math.min(60, (v - 100) / n.length - 8), W = p - 100;
3037
+ return /* @__PURE__ */ e("svg", { width: v, height: p - 40, className: "nice-drilldown-columns", children: /* @__PURE__ */ $("g", { transform: "translate(50, 20)", children: [
3038
+ [0, 0.25, 0.5, 0.75, 1].map((m, F) => /* @__PURE__ */ $("g", { children: [
3039
+ /* @__PURE__ */ e(
3040
+ "line",
3041
+ {
3042
+ x1: 0,
3043
+ y1: W * (1 - m),
3044
+ x2: v - 80,
3045
+ y2: W * (1 - m),
3046
+ stroke: "var(--border-color, #e5e7eb)",
3047
+ strokeDasharray: m === 0 ? void 0 : "4"
3048
+ }
3049
+ ),
3050
+ /* @__PURE__ */ e(
3051
+ "text",
3052
+ {
3053
+ x: -8,
3054
+ y: W * (1 - m),
3055
+ textAnchor: "end",
3056
+ dominantBaseline: "middle",
3057
+ fontSize: "11",
3058
+ fill: "var(--text-secondary, #6b7280)",
3059
+ children: Math.round(X * m).toLocaleString()
3060
+ }
3061
+ )
3062
+ ] }, F)),
3063
+ n.map((m, F) => {
3064
+ const Y = m.value / X * W, ee = F * ((v - 100) / n.length) + ((v - 100) / n.length - H) / 2;
3065
+ return /* @__PURE__ */ $("g", { onClick: () => V(m, F), children: [
3066
+ /* @__PURE__ */ e(
3067
+ "rect",
3068
+ {
3069
+ x: ee,
3070
+ y: W - Y,
3071
+ width: H,
3072
+ height: Y,
3073
+ fill: m.color || z[F % z.length],
3074
+ rx: 4,
3075
+ className: "nice-drilldown-column-bar"
3076
+ }
3077
+ ),
3078
+ /* @__PURE__ */ e(
3079
+ "text",
3080
+ {
3081
+ x: ee + H / 2,
3082
+ y: W + 16,
3083
+ textAnchor: "middle",
3084
+ fontSize: "11",
3085
+ fill: "var(--text-primary, #374151)",
3086
+ children: (m.label || `${F + 1}`).slice(0, 10)
3087
+ }
3088
+ ),
3089
+ C && /* @__PURE__ */ e(
3090
+ "text",
3091
+ {
3092
+ x: ee + H / 2,
3093
+ y: W - Y - 8,
3094
+ textAnchor: "middle",
3095
+ fontSize: "11",
3096
+ fill: "var(--text-primary, #374151)",
3097
+ fontWeight: "500",
3098
+ children: m.value.toLocaleString()
3099
+ }
3100
+ )
3101
+ ] }, F);
3102
+ })
3103
+ ] }) });
3104
+ };
3105
+ return /* @__PURE__ */ $(
3106
+ "div",
3107
+ {
3108
+ className: `nice-drilldown-chart ${b ? `animating ${D}` : ""} ${l || ""}`,
3109
+ style: { width: v, ...d },
3110
+ ...u,
3111
+ children: [
3112
+ /* @__PURE__ */ $("div", { className: "nice-drilldown-header", children: [
3113
+ T && x.length > 1 && /* @__PURE__ */ e("button", { className: "nice-drilldown-back", onClick: O, children: "← Wstecz" }),
3114
+ I && /* @__PURE__ */ e("div", { className: "nice-drilldown-breadcrumbs", children: G.map((n, X) => /* @__PURE__ */ $(Fe.Fragment, { children: [
3115
+ X > 0 && /* @__PURE__ */ e("span", { className: "nice-drilldown-separator", children: "/" }),
3116
+ /* @__PURE__ */ e(
3117
+ "span",
3118
+ {
3119
+ className: `nice-drilldown-crumb ${X === G.length - 1 ? "active" : ""}`,
3120
+ onClick: () => {
3121
+ if (X < G.length - 1) {
3122
+ const H = x.slice(0, X + 1);
3123
+ y(H), g(H[H.length - 1]);
3124
+ }
3125
+ },
3126
+ children: n
3127
+ }
3128
+ )
3129
+ ] }, X)) })
3130
+ ] }),
3131
+ /* @__PURE__ */ $("div", { className: "nice-drilldown-content", style: { height: p - 40 }, children: [
3132
+ c === "bar" && Q(),
3133
+ c === "pie" && q(),
3134
+ c === "column" && J()
3135
+ ] }),
3136
+ k && _ && /* @__PURE__ */ e("div", { className: "nice-drilldown-legend", children: _.data.map((n, X) => /* @__PURE__ */ $("div", { className: "nice-drilldown-legend-item", children: [
3137
+ /* @__PURE__ */ e(
3138
+ "span",
3139
+ {
3140
+ className: "nice-drilldown-legend-color",
3141
+ style: { backgroundColor: n.color || z[X % z.length] }
3142
+ }
3143
+ ),
3144
+ /* @__PURE__ */ e("span", { className: "nice-drilldown-legend-label", children: n.label || `Item ${X + 1}` })
3145
+ ] }, X)) }),
3146
+ /* @__PURE__ */ e("style", { children: `
3147
+ .nice-drilldown-chart {
3148
+ font-family: inherit;
3149
+ color: var(--text-primary, #111827);
3150
+ background: var(--bg-elevated, #ffffff);
3151
+ border-radius: 8px;
3152
+ overflow: hidden;
3153
+ }
3154
+
3155
+ .nice-drilldown-header {
3156
+ display: flex;
3157
+ align-items: center;
3158
+ gap: 12px;
3159
+ padding: 12px 16px;
3160
+ border-bottom: 1px solid var(--border-color, #e5e7eb);
3161
+ min-height: 40px;
3162
+ }
3163
+
3164
+ .nice-drilldown-back {
3165
+ background: var(--bg-secondary, #f3f4f6);
3166
+ border: none;
3167
+ padding: 6px 12px;
3168
+ border-radius: 6px;
3169
+ cursor: pointer;
3170
+ font-size: 13px;
3171
+ font-family: inherit;
3172
+ color: var(--text-primary, #374151);
3173
+ transition: background 0.2s;
3174
+ }
3175
+
3176
+ .nice-drilldown-back:hover {
3177
+ background: var(--hover-bg, #e5e7eb);
3178
+ }
3179
+
3180
+ .nice-drilldown-breadcrumbs {
3181
+ display: flex;
3182
+ align-items: center;
3183
+ gap: 4px;
3184
+ font-size: 13px;
3185
+ font-family: inherit;
3186
+ }
3187
+
3188
+ .nice-drilldown-separator {
3189
+ color: var(--text-muted, #9ca3af);
3190
+ }
3191
+
3192
+ .nice-drilldown-crumb {
3193
+ color: var(--text-secondary, #6b7280);
3194
+ cursor: pointer;
3195
+ }
3196
+
3197
+ .nice-drilldown-crumb:hover:not(.active) {
3198
+ color: var(--color-primary, #3b82f6);
3199
+ }
3200
+
3201
+ .nice-drilldown-crumb.active {
3202
+ color: var(--text-primary, #111827);
3203
+ font-weight: 500;
3204
+ cursor: default;
3205
+ }
3206
+
3207
+ .nice-drilldown-content {
3208
+ padding: 16px;
3209
+ transition: opacity 0.15s, transform 0.15s;
3210
+ }
3211
+
3212
+ .nice-drilldown-chart.animating .nice-drilldown-content {
3213
+ opacity: 0;
3214
+ }
3215
+
3216
+ .nice-drilldown-chart.animating.in .nice-drilldown-content {
3217
+ transform: translateX(20px);
3218
+ }
3219
+
3220
+ .nice-drilldown-chart.animating.out .nice-drilldown-content {
3221
+ transform: translateX(-20px);
3222
+ }
3223
+
3224
+ .nice-drilldown-bars {
3225
+ display: flex;
3226
+ flex-direction: column;
3227
+ gap: 8px;
3228
+ }
3229
+
3230
+ .nice-drilldown-bar-row {
3231
+ display: flex;
3232
+ align-items: center;
3233
+ gap: 12px;
3234
+ cursor: pointer;
3235
+ padding: 4px 8px;
3236
+ margin: -4px -8px;
3237
+ border-radius: 6px;
3238
+ transition: background 0.2s;
3239
+ }
3240
+
3241
+ .nice-drilldown-bar-row:hover {
3242
+ background: var(--hover-bg, #f9fafb);
3243
+ }
3244
+
3245
+ .nice-drilldown-bar-label {
3246
+ width: 120px;
3247
+ font-size: 13px;
3248
+ font-family: inherit;
3249
+ color: var(--text-primary, #374151);
3250
+ overflow: hidden;
3251
+ text-overflow: ellipsis;
3252
+ white-space: nowrap;
3253
+ }
3254
+
3255
+ .nice-drilldown-bar-track {
3256
+ flex: 1;
3257
+ background: var(--bg-tertiary, #f3f4f6);
3258
+ border-radius: 6px;
3259
+ overflow: hidden;
3260
+ }
3261
+
3262
+ .nice-drilldown-bar-fill {
3263
+ transition: width 0.3s ease;
3264
+ border-radius: 6px;
3265
+ }
3266
+
3267
+ .nice-drilldown-bar-value {
3268
+ width: 80px;
3269
+ text-align: right;
3270
+ font-size: 13px;
3271
+ font-family: inherit;
3272
+ font-weight: 500;
3273
+ color: var(--text-primary, #111827);
3274
+ }
3275
+
3276
+ .nice-drilldown-pie-slice {
3277
+ cursor: pointer;
3278
+ transition: transform 0.2s, opacity 0.2s;
3279
+ transform-origin: center;
3280
+ }
3281
+
3282
+ .nice-drilldown-pie-slice:hover {
3283
+ opacity: 0.85;
3284
+ transform: scale(1.02);
3285
+ }
3286
+
3287
+ .nice-drilldown-column-bar {
3288
+ cursor: pointer;
3289
+ transition: opacity 0.2s;
3290
+ }
3291
+
3292
+ .nice-drilldown-column-bar:hover {
3293
+ opacity: 0.8;
3294
+ }
3295
+
3296
+ .nice-drilldown-legend {
3297
+ display: flex;
3298
+ flex-wrap: wrap;
3299
+ gap: 16px;
3300
+ padding: 12px 16px;
3301
+ border-top: 1px solid var(--border-color, #e5e7eb);
3302
+ }
3303
+
3304
+ .nice-drilldown-legend-item {
3305
+ display: flex;
3306
+ align-items: center;
3307
+ gap: 6px;
3308
+ }
3309
+
3310
+ .nice-drilldown-legend-color {
3311
+ width: 12px;
3312
+ height: 12px;
3313
+ border-radius: 3px;
3314
+ }
3315
+
3316
+ .nice-drilldown-legend-label {
3317
+ font-size: 12px;
3318
+ font-family: inherit;
3319
+ color: var(--text-secondary, #6b7280);
3320
+ }
3321
+ ` })
3322
+ ]
3323
+ }
3324
+ );
3325
+ }
3326
+ );
3327
+ nt.displayName = "NiceDrillDownChart";
3328
+ const It = ({
3329
+ type: t = "choropleth",
3330
+ regions: o = [],
3331
+ bubbles: i = [],
3332
+ width: s = 800,
3333
+ height: c = 500,
3334
+ viewBox: v = "0 0 800 500",
3335
+ colorScale: p = [
3336
+ "var(--info-bg, #dbeafe)",
3337
+ "var(--color-primary-light, #93c5fd)",
3338
+ "var(--color-primary, #3b82f6)",
3339
+ "var(--color-primary-active, #1d4ed8)",
3340
+ "var(--nice-primary-dark, #1E3A8A)"
3341
+ ],
3342
+ minValue: I,
3343
+ maxValue: T,
3344
+ showTooltip: w = !0,
3345
+ showLegend: f = !0,
3346
+ onRegionClick: N,
3347
+ onBubbleClick: z,
3348
+ onRegionHover: C,
3349
+ title: k,
3350
+ mapSvg: l,
3351
+ zoomable: d = !1,
3352
+ className: u,
3353
+ style: S,
3354
+ ...g
3355
+ }) => {
3356
+ const [x, y] = oe(null), [b, h] = oe(1), [D, a] = oe({ x: 0, y: 0 }), _ = be(null), A = be(!1), O = be({ x: 0, y: 0 }), U = I ?? Math.min(...o.map((m) => m.value), ...i.map((m) => m.value)), V = T ?? Math.max(...o.map((m) => m.value), ...i.map((m) => m.value)), j = ae(
3357
+ (m) => {
3358
+ const F = (m - U) / (V - U), Y = Math.min(Math.floor(F * p.length), p.length - 1);
3359
+ return p[Math.max(0, Y)];
3360
+ },
3361
+ [U, V, p]
3362
+ ), G = ae(
3363
+ (m) => {
3364
+ if (!w || !x)
3365
+ return;
3366
+ const F = _.current?.getBoundingClientRect();
3367
+ F && y(
3368
+ (Y) => Y ? { ...Y, x: m.clientX - F.left, y: m.clientY - F.top } : null
3369
+ );
3370
+ },
3371
+ [w, x]
3372
+ ), Q = ae(
3373
+ (m, F) => {
3374
+ const Y = _.current?.getBoundingClientRect();
3375
+ Y && w && y({
3376
+ x: F.clientX - Y.left,
3377
+ y: F.clientY - Y.top,
3378
+ content: `${m.name}: ${m.value.toLocaleString()}`
3379
+ }), C?.(m);
3380
+ },
3381
+ [w, C]
3382
+ ), q = ae(() => {
3383
+ y(null), C?.(null);
3384
+ }, [C]), J = ae(
3385
+ (m) => {
3386
+ if (!d)
3387
+ return;
3388
+ m.preventDefault();
3389
+ const F = m.deltaY > 0 ? 0.9 : 1.1;
3390
+ h((Y) => Math.min(Math.max(Y * F, 0.5), 4));
3391
+ },
3392
+ [d]
3393
+ ), n = ae(
3394
+ (m) => {
3395
+ d && (A.current = !0, O.current = { x: m.clientX - D.x, y: m.clientY - D.y });
3396
+ },
3397
+ [d, D]
3398
+ ), X = ae(() => {
3399
+ A.current = !1;
3400
+ }, []), H = ae((m) => {
3401
+ A.current && a({
3402
+ x: m.clientX - O.current.x,
3403
+ y: m.clientY - O.current.y
3404
+ });
3405
+ }, []), W = pe(() => o.length > 0 ? o : [
3406
+ {
3407
+ id: "mazowieckie",
3408
+ name: "Mazowieckie",
3409
+ value: 100,
3410
+ path: "M400,200 L450,200 L460,250 L420,280 L380,250 Z"
3411
+ },
3412
+ { id: "slaskie", name: "Śląskie", value: 80, path: "M350,280 L400,280 L390,330 L340,320 Z" },
3413
+ {
3414
+ id: "wielkopolskie",
3415
+ name: "Wielkopolskie",
3416
+ value: 70,
3417
+ path: "M300,200 L350,200 L360,260 L310,270 L280,230 Z"
3418
+ }
3419
+ ], [o]);
3420
+ return /* @__PURE__ */ $("div", { className: `nice-map-chart ${u || ""}`, style: { width: s, ...S }, ...g, children: [
3421
+ k && /* @__PURE__ */ e("div", { className: "nice-map-title", children: k }),
3422
+ /* @__PURE__ */ e(
3423
+ "svg",
3424
+ {
3425
+ ref: _,
3426
+ width: s,
3427
+ height: c,
3428
+ viewBox: v,
3429
+ className: "nice-map-svg",
3430
+ onWheel: J,
3431
+ onMouseDown: n,
3432
+ onMouseUp: X,
3433
+ onMouseLeave: X,
3434
+ onMouseMove: (m) => {
3435
+ G(m), H(m);
3436
+ },
3437
+ children: /* @__PURE__ */ $("g", { transform: `translate(${D.x}, ${D.y}) scale(${b})`, children: [
3438
+ l && /* @__PURE__ */ e("g", { dangerouslySetInnerHTML: { __html: l } }),
3439
+ t === "choropleth" && W.map((m) => /* @__PURE__ */ e(
3440
+ "path",
3441
+ {
3442
+ d: m.path,
3443
+ fill: m.color || j(m.value),
3444
+ stroke: "var(--nice-bg, #fff)",
3445
+ strokeWidth: 1,
3446
+ className: "nice-map-region",
3447
+ onClick: () => N?.(m),
3448
+ onMouseEnter: (F) => Q(m, F),
3449
+ onMouseLeave: q
3450
+ },
3451
+ m.id
3452
+ )),
3453
+ (t === "bubble" || i.length > 0) && i.map((m) => {
3454
+ const F = Math.sqrt((m.value - U) / (V - U)) * 30 + 5;
3455
+ return /* @__PURE__ */ e(
3456
+ "circle",
3457
+ {
3458
+ cx: m.lng,
3459
+ cy: m.lat,
3460
+ r: F,
3461
+ fill: m.color || "var(--color-primary, #3b82f6)",
3462
+ fillOpacity: 0.7,
3463
+ stroke: "var(--nice-bg, #fff)",
3464
+ strokeWidth: 1,
3465
+ className: "nice-map-bubble",
3466
+ onClick: () => z?.(m),
3467
+ onMouseEnter: (Y) => {
3468
+ const ee = _.current?.getBoundingClientRect();
3469
+ ee && w && y({
3470
+ x: Y.clientX - ee.left,
3471
+ y: Y.clientY - ee.top,
3472
+ content: `${m.label || m.id}: ${m.value.toLocaleString()}`
3473
+ });
3474
+ },
3475
+ onMouseLeave: q,
3476
+ children: m.label && /* @__PURE__ */ $("title", { children: [
3477
+ m.label,
3478
+ ": ",
3479
+ m.value
3480
+ ] })
3481
+ },
3482
+ m.id
3483
+ );
3484
+ })
3485
+ ] })
3486
+ }
3487
+ ),
3488
+ x && /* @__PURE__ */ e("div", { className: "nice-map-tooltip", style: { left: x.x + 10, top: x.y - 30 }, children: x.content }),
3489
+ f && /* @__PURE__ */ $("div", { className: "nice-map-legend", children: [
3490
+ /* @__PURE__ */ e("span", { className: "nice-map-legend-title", children: "Wartość" }),
3491
+ /* @__PURE__ */ e("div", { className: "nice-map-legend-scale", children: p.map((m, F) => /* @__PURE__ */ e("div", { className: "nice-map-legend-item", style: { backgroundColor: m } }, F)) }),
3492
+ /* @__PURE__ */ $("div", { className: "nice-map-legend-labels", children: [
3493
+ /* @__PURE__ */ e("span", { children: U.toLocaleString() }),
3494
+ /* @__PURE__ */ e("span", { children: V.toLocaleString() })
3495
+ ] })
3496
+ ] }),
3497
+ /* @__PURE__ */ e("style", { children: `
3498
+ .nice-map-chart {
3499
+ font-family: system-ui, -apple-system, sans-serif;
3500
+ background: white;
3501
+ border-radius: var(--nice-radius-lg, 8px);
3502
+ overflow: hidden;
3503
+ position: relative;
3504
+ }
3505
+
3506
+ .nice-map-title {
3507
+ padding: var(--nice-space-3, 12px) var(--nice-space-4, 16px);
3508
+ font-size: 16px;
3509
+ font-weight: 600;
3510
+ color: var(--nice-text, #111827);
3511
+ border-bottom: 1px solid var(--border-color, #e5e7eb);
3512
+ }
3513
+
3514
+ .nice-map-svg {
3515
+ display: block;
3516
+ cursor: grab;
3517
+ }
3518
+
3519
+ .nice-map-svg:active {
3520
+ cursor: grabbing;
3521
+ }
3522
+
3523
+ .nice-map-region {
3524
+ cursor: pointer;
3525
+ transition: opacity 0.2s, stroke-width 0.2s;
3526
+ }
3527
+
3528
+ .nice-map-region:hover {
3529
+ opacity: 0.8;
3530
+ stroke-width: 2;
3531
+ }
3532
+
3533
+ .nice-map-bubble {
3534
+ cursor: pointer;
3535
+ transition: transform 0.2s, opacity 0.2s;
3536
+ }
3537
+
3538
+ .nice-map-bubble:hover {
3539
+ opacity: 1;
3540
+ transform: scale(1.1);
3541
+ }
3542
+
3543
+ .nice-map-tooltip {
3544
+ position: absolute;
3545
+ background: var(--nice-text, #1f2937);
3546
+ color: white;
3547
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
3548
+ border-radius: var(--nice-radius-sm, 4px);
3549
+ font-size: 12px;
3550
+ pointer-events: none;
3551
+ z-index: 10;
3552
+ white-space: nowrap;
3553
+ }
3554
+
3555
+ .nice-map-legend {
3556
+ position: absolute;
3557
+ right: 16px;
3558
+ bottom: 16px;
3559
+ background: white;
3560
+ padding: var(--nice-space-3, 12px);
3561
+ border-radius: var(--nice-radius-md, 6px);
3562
+ box-shadow: 0 2px 8px var(--nice-overlay-10, rgba(0, 0, 0, 0.1));
3563
+ }
3564
+
3565
+ .nice-map-legend-title {
3566
+ display: block;
3567
+ font-size: 11px;
3568
+ color: var(--nice-text-secondary, #6b7280);
3569
+ margin-bottom: var(--nice-space-1-5, 6px);
3570
+ }
3571
+
3572
+ .nice-map-legend-scale {
3573
+ display: flex;
3574
+ height: 12px;
3575
+ border-radius: var(--nice-radius-sm, 2px);
3576
+ overflow: hidden;
3577
+ }
3578
+
3579
+ .nice-map-legend-item {
3580
+ flex: 1;
3581
+ min-width: 24px;
3582
+ }
3583
+
3584
+ .nice-map-legend-labels {
3585
+ display: flex;
3586
+ justify-content: space-between;
3587
+ font-size: 10px;
3588
+ color: var(--nice-text-secondary, #6b7280);
3589
+ margin-top: var(--nice-space-1, 4px);
3590
+ }
3591
+ ` })
3592
+ ] });
3593
+ }, zt = ({
3594
+ nodes: t,
3595
+ links: o,
3596
+ width: i = 800,
3597
+ height: s = 500,
3598
+ nodeWidth: c = 20,
3599
+ nodePadding: v = 10,
3600
+ showValues: p = !0,
3601
+ showTooltip: I = !0,
3602
+ onNodeClick: T,
3603
+ onLinkClick: w,
3604
+ title: f,
3605
+ className: N,
3606
+ style: z,
3607
+ ...C
3608
+ }) => {
3609
+ const [k, l] = oe(null), d = be(null), u = pe(() => {
3610
+ const g = /* @__PURE__ */ new Map();
3611
+ t.forEach((n) => g.set(n.id, n));
3612
+ const x = new Set(o.map((n) => n.target)), y = new Set(o.map((n) => n.source)), b = [], h = /* @__PURE__ */ new Map(), D = t.filter((n) => y.has(n.id) && !x.has(n.id));
3613
+ D.length > 0 && (b.push(D.map((n) => n.id)), D.forEach((n) => h.set(n.id, 0)));
3614
+ const a = t.filter((n) => y.has(n.id) && x.has(n.id));
3615
+ a.length > 0 && (b.push(a.map((n) => n.id)), a.forEach((n) => h.set(n.id, 1)));
3616
+ const _ = t.filter((n) => !y.has(n.id) && x.has(n.id));
3617
+ _.length > 0 && (b.push(_.map((n) => n.id)), _.forEach((n) => h.set(n.id, 2))), b.length === 0 && (b.push(t.map((n) => n.id)), t.forEach((n) => h.set(n.id, 0)));
3618
+ const A = /* @__PURE__ */ new Map();
3619
+ o.forEach((n) => {
3620
+ A.set(n.source, (A.get(n.source) || 0) + n.value), A.set(n.target, (A.get(n.target) || 0) + n.value);
3621
+ });
3622
+ const O = 40, U = i - O * 2, V = s - O * 2, j = b.length > 1 ? U / (b.length - 1) : U, G = /* @__PURE__ */ new Map();
3623
+ Math.max(...Array.from(A.values())), b.forEach((n, X) => {
3624
+ const H = n.reduce((F, Y) => F + (A.get(Y) || 0), 0), W = (V - (n.length - 1) * v) / H;
3625
+ let m = O;
3626
+ n.forEach((F) => {
3627
+ const ee = (A.get(F) || 0) * W, P = O + X * j;
3628
+ G.set(F, { x: P, y: m, height: ee }), m += ee + v;
3629
+ });
3630
+ });
3631
+ const Q = [], q = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map();
3632
+ return o.forEach((n) => {
3633
+ const X = G.get(n.source), H = G.get(n.target);
3634
+ if (!X || !H)
3635
+ return;
3636
+ const W = A.get(n.source) || 1;
3637
+ A.get(n.target);
3638
+ const m = n.value / W * X.height, F = X.y + (q.get(n.source) || 0), Y = H.y + (J.get(n.target) || 0);
3639
+ q.set(n.source, (q.get(n.source) || 0) + m), J.set(n.target, (J.get(n.target) || 0) + m);
3640
+ const ee = X.x + c, P = H.x, te = (P - ee) * 0.5, fe = `
3641
+ M ${ee} ${F}
3642
+ C ${ee + te} ${F},
3643
+ ${P - te} ${Y},
3644
+ ${P} ${Y}
3645
+ L ${P} ${Y + m}
3646
+ C ${P - te} ${Y + m},
3647
+ ${ee + te} ${F + m},
3648
+ ${ee} ${F + m}
3649
+ Z
3650
+ `;
3651
+ Q.push({
3652
+ path: fe,
3653
+ link: n,
3654
+ sourcePos: X,
3655
+ targetPos: H
3656
+ });
3657
+ }), { nodePositions: G, linkPaths: Q, nodeMap: g, nodeValues: A };
3658
+ }, [t, o, i, s, c, v]), S = ae(
3659
+ (g, x) => {
3660
+ const y = d.current?.getBoundingClientRect();
3661
+ y && I && l({
3662
+ x: x.clientX - y.left,
3663
+ y: x.clientY - y.top,
3664
+ content: g
3665
+ });
3666
+ },
3667
+ [I]
3668
+ );
3669
+ return /* @__PURE__ */ $("div", { className: `nice-sankey-chart ${N || ""}`, style: { width: i, ...z }, ...C, children: [
3670
+ f && /* @__PURE__ */ e("div", { className: "nice-sankey-title", children: f }),
3671
+ /* @__PURE__ */ $("svg", { ref: d, width: i, height: s, className: "nice-sankey-svg", children: [
3672
+ /* @__PURE__ */ e("defs", { children: u.linkPaths.map((g, x) => /* @__PURE__ */ $("linearGradient", { id: `sankey-gradient-${x}`, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
3673
+ /* @__PURE__ */ e(
3674
+ "stop",
3675
+ {
3676
+ offset: "0%",
3677
+ stopColor: u.nodeMap.get(g.link.source)?.color || "var(--color-primary, #3b82f6)"
3678
+ }
3679
+ ),
3680
+ /* @__PURE__ */ e(
3681
+ "stop",
3682
+ {
3683
+ offset: "100%",
3684
+ stopColor: u.nodeMap.get(g.link.target)?.color || "var(--color-error, #ef4444)"
3685
+ }
3686
+ )
3687
+ ] }, x)) }),
3688
+ /* @__PURE__ */ e("g", { className: "nice-sankey-links", children: u.linkPaths.map((g, x) => /* @__PURE__ */ e(
3689
+ "path",
3690
+ {
3691
+ d: g.path,
3692
+ fill: g.link.color || `url(#sankey-gradient-${x})`,
3693
+ fillOpacity: 0.4,
3694
+ className: "nice-sankey-link",
3695
+ onClick: () => w?.(g.link),
3696
+ onMouseEnter: (y) => S(
3697
+ `${u.nodeMap.get(g.link.source)?.name} → ${u.nodeMap.get(g.link.target)?.name}: ${g.link.value.toLocaleString()}`,
3698
+ y
3699
+ ),
3700
+ onMouseLeave: () => l(null)
3701
+ },
3702
+ x
3703
+ )) }),
3704
+ /* @__PURE__ */ e("g", { className: "nice-sankey-nodes", children: Array.from(u.nodePositions.entries()).map(([g, x]) => {
3705
+ const y = u.nodeMap.get(g);
3706
+ return y ? /* @__PURE__ */ $("g", { children: [
3707
+ /* @__PURE__ */ e(
3708
+ "rect",
3709
+ {
3710
+ x: x.x,
3711
+ y: x.y,
3712
+ width: c,
3713
+ height: x.height,
3714
+ fill: y.color || "var(--color-primary, #3b82f6)",
3715
+ rx: 2,
3716
+ className: "nice-sankey-node",
3717
+ onClick: () => T?.(y),
3718
+ onMouseEnter: (b) => S(
3719
+ `${y.label ?? y.name ?? y.id}: ${u.nodeValues.get(g)?.toLocaleString() || 0}`,
3720
+ b
3721
+ ),
3722
+ onMouseLeave: () => l(null)
3723
+ }
3724
+ ),
3725
+ /* @__PURE__ */ $(
3726
+ "text",
3727
+ {
3728
+ x: x.x + c + 6,
3729
+ y: x.y + x.height / 2,
3730
+ dominantBaseline: "middle",
3731
+ fontSize: "12",
3732
+ fill: "var(--nice-text, #374151)",
3733
+ children: [
3734
+ y.label ?? y.name ?? y.id,
3735
+ p && ` (${u.nodeValues.get(g)?.toLocaleString() || 0})`
3736
+ ]
3737
+ }
3738
+ )
3739
+ ] }, g) : null;
3740
+ }) })
3741
+ ] }),
3742
+ k && /* @__PURE__ */ e("div", { className: "nice-sankey-tooltip", style: { left: k.x + 10, top: k.y - 30 }, children: k.content }),
3743
+ /* @__PURE__ */ e("style", { children: `
3744
+ .nice-sankey-chart {
3745
+ font-family: system-ui, -apple-system, sans-serif;
3746
+ background: white;
3747
+ border-radius: var(--nice-radius-lg, 8px);
3748
+ position: relative;
3749
+ }
3750
+
3751
+ .nice-sankey-title {
3752
+ padding: var(--nice-space-3, 12px) var(--nice-space-4, 16px);
3753
+ font-size: 16px;
3754
+ font-weight: 600;
3755
+ color: var(--nice-text, #111827);
3756
+ border-bottom: 1px solid var(--border-color, #e5e7eb);
3757
+ }
3758
+
3759
+ .nice-sankey-link {
3760
+ cursor: pointer;
3761
+ transition: fill-opacity 0.2s;
3762
+ }
3763
+
3764
+ .nice-sankey-link:hover {
3765
+ fill-opacity: 0.7;
3766
+ }
3767
+
3768
+ .nice-sankey-node {
3769
+ cursor: pointer;
3770
+ transition: opacity 0.2s;
3771
+ }
3772
+
3773
+ .nice-sankey-node:hover {
3774
+ opacity: 0.8;
3775
+ }
3776
+
3777
+ .nice-sankey-tooltip {
3778
+ position: absolute;
3779
+ background: var(--nice-text, #1f2937);
3780
+ color: white;
3781
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
3782
+ border-radius: var(--nice-radius-sm, 4px);
3783
+ font-size: 12px;
3784
+ pointer-events: none;
3785
+ z-index: 10;
3786
+ white-space: nowrap;
3787
+ }
3788
+ ` })
3789
+ ] });
3790
+ }, rt = Ne(
3791
+ (t, o) => {
3792
+ const {
3793
+ initialData: i,
3794
+ data: s,
3795
+ maxPoints: c = 60,
3796
+ updateInterval: v = 1e3,
3797
+ fetchData: p,
3798
+ width: I = 600,
3799
+ height: T = 200,
3800
+ chartType: w = "line",
3801
+ color: f = "var(--color-primary, #3b82f6)",
3802
+ showGrid: N = !0,
3803
+ showTimeAxis: z = !0,
3804
+ showCurrentValue: C = !0,
3805
+ title: k,
3806
+ valueFormatter: l = (L) => L.toFixed(2),
3807
+ timeFormatter: d = (L) => new Date(L).toLocaleTimeString(),
3808
+ onDataUpdate: u,
3809
+ paused: S,
3810
+ className: g,
3811
+ style: x,
3812
+ ...y
3813
+ } = t, [b, h] = oe(i ?? s ?? []), [D, a] = oe(S || !1), _ = be();
3814
+ Ce(() => {
3815
+ S !== void 0 && a(S);
3816
+ }, [S]), Ce(() => {
3817
+ if (D || !p)
3818
+ return;
3819
+ const L = async () => {
3820
+ try {
3821
+ const Z = await p();
3822
+ h((ne) => {
3823
+ const ue = [...ne, Z].slice(-c);
3824
+ return u?.(ue), ue;
3825
+ });
3826
+ } catch (Z) {
3827
+ console.error("Failed to fetch realtime data:", Z);
3828
+ }
3829
+ };
3830
+ return _.current = setInterval(L, v), () => {
3831
+ _.current && clearInterval(_.current);
3832
+ };
3833
+ }, [D, p, v, c, u]);
3834
+ const A = ae(
3835
+ (L) => {
3836
+ h((Z) => {
3837
+ const ne = [...Z, L].slice(-c);
3838
+ return u?.(ne), ne;
3839
+ });
3840
+ },
3841
+ [c, u]
3842
+ ), O = ae(() => {
3843
+ h([]), u?.([]);
3844
+ }, [u]), U = ae(() => a(!0), []), V = ae(() => a(!1), []);
3845
+ Ae(
3846
+ o,
3847
+ () => ({
3848
+ addDataPoint: A,
3849
+ clearData: O,
3850
+ pause: U,
3851
+ resume: V,
3852
+ getData: () => b
3853
+ }),
3854
+ [A, O, b]
3855
+ );
3856
+ const j = { top: 20, right: 60, bottom: z ? 40 : 20, left: 50 }, G = I - j.left - j.right, Q = T - j.top - j.bottom, q = b.map((L) => L.value), J = q.length ? Math.min(...q) : 0, n = q.length ? Math.max(...q) : 100, H = (n - J || 1) * 0.1, W = J - H, F = n + H - W, Y = (L) => {
3857
+ const Z = p ? c - 1 : Math.max(1, b.length - 1);
3858
+ return j.left + L / Z * G;
3859
+ }, ee = (L) => j.top + Q - (L - W) / F * Q, P = b.map((L, Z) => `${Y(Z)},${ee(L.value)}`).join(" "), te = b.length > 0 ? `M ${Y(0)},${j.top + Q} L ${P} L ${Y(b.length - 1)},${j.top + Q} Z` : "", fe = b.length > 0 ? b[b.length - 1].value : null;
3860
+ return /* @__PURE__ */ $(
3861
+ "div",
3862
+ {
3863
+ className: `nice-realtime-chart ${g || ""}`,
3864
+ style: { width: I, ...x },
3865
+ ...y,
3866
+ children: [
3867
+ /* @__PURE__ */ $("div", { className: "nice-realtime-header", children: [
3868
+ /* @__PURE__ */ e("span", { className: "nice-realtime-title", children: k }),
3869
+ /* @__PURE__ */ $("div", { className: "nice-realtime-controls", children: [
3870
+ /* @__PURE__ */ $("span", { className: `nice-realtime-status ${D ? "paused" : "live"}`, children: [
3871
+ /* @__PURE__ */ e("span", { className: "nice-realtime-status-dot" }),
3872
+ /* @__PURE__ */ e("span", { children: D ? "Wstrzymano" : "Na żywo" })
3873
+ ] }),
3874
+ /* @__PURE__ */ e(
3875
+ "button",
3876
+ {
3877
+ className: `nice-realtime-btn ${D ? "paused" : ""}`,
3878
+ onClick: () => a(!D),
3879
+ children: D ? "▶️" : "⏸️"
3880
+ }
3881
+ ),
3882
+ C && fe !== null && /* @__PURE__ */ e("span", { className: "nice-realtime-value", children: l(fe) })
3883
+ ] })
3884
+ ] }),
3885
+ /* @__PURE__ */ $("svg", { width: I, height: T, className: "nice-realtime-svg", children: [
3886
+ N && /* @__PURE__ */ e("g", { className: "nice-realtime-grid", children: [0, 0.25, 0.5, 0.75, 1].map((L, Z) => {
3887
+ const ne = j.top + Q * (1 - L), ue = W + F * L;
3888
+ return /* @__PURE__ */ $("g", { children: [
3889
+ /* @__PURE__ */ e(
3890
+ "line",
3891
+ {
3892
+ x1: j.left,
3893
+ y1: ne,
3894
+ x2: I - j.right,
3895
+ y2: ne,
3896
+ stroke: "var(--border-color, #e5e7eb)",
3897
+ strokeDasharray: L === 0 ? void 0 : "3"
3898
+ }
3899
+ ),
3900
+ /* @__PURE__ */ e(
3901
+ "text",
3902
+ {
3903
+ x: j.left - 8,
3904
+ y: ne,
3905
+ textAnchor: "end",
3906
+ dominantBaseline: "middle",
3907
+ fontSize: "10",
3908
+ fill: "var(--text-secondary, #6b7280)",
3909
+ children: Math.round(ue).toLocaleString()
3910
+ }
3911
+ )
3912
+ ] }, Z);
3913
+ }) }),
3914
+ w === "area" && b.length > 0 && /* @__PURE__ */ e("path", { d: te, fill: f, fillOpacity: 0.2 }),
3915
+ b.length > 1 && /* @__PURE__ */ e(
3916
+ "polyline",
3917
+ {
3918
+ points: P,
3919
+ fill: "none",
3920
+ stroke: f,
3921
+ strokeWidth: 2,
3922
+ strokeLinecap: "round",
3923
+ strokeLinejoin: "round"
3924
+ }
3925
+ ),
3926
+ b.length > 0 && /* @__PURE__ */ e(
3927
+ "circle",
3928
+ {
3929
+ cx: Y(b.length - 1),
3930
+ cy: ee(b[b.length - 1].value),
3931
+ r: 3,
3932
+ fill: f,
3933
+ className: "nice-realtime-point"
3934
+ }
3935
+ ),
3936
+ z && b.length > 0 && /* @__PURE__ */ e("g", { className: "nice-realtime-time-axis", children: Array.from(
3937
+ new Set([0, Math.floor(b.length / 2), b.length - 1].filter((L) => b[L]))
3938
+ ).map((L) => /* @__PURE__ */ e(
3939
+ "text",
3940
+ {
3941
+ x: Y(L),
3942
+ y: T - 8,
3943
+ textAnchor: "middle",
3944
+ fontSize: "10",
3945
+ fill: "var(--text-secondary, #6b7280)",
3946
+ children: d(b[L].timestamp)
3947
+ },
3948
+ `tx-${L}`
3949
+ )) })
3950
+ ] }),
3951
+ /* @__PURE__ */ e("style", { children: `
3952
+ .nice-realtime-chart {
3953
+ font-family: inherit;
3954
+ color: var(--text-primary, #111827);
3955
+ background: var(--bg-elevated, #ffffff);
3956
+ border-radius: 8px;
3957
+ position: relative;
3958
+ }
3959
+
3960
+ .nice-realtime-header {
3961
+ display: flex;
3962
+ justify-content: space-between;
3963
+ align-items: center;
3964
+ padding: 12px 16px;
3965
+ border-bottom: 1px solid var(--border-color, #e5e7eb);
3966
+ }
3967
+
3968
+ .nice-realtime-title {
3969
+ font-size: 14px;
3970
+ font-weight: 600;
3971
+ color: var(--text-primary, #111827);
3972
+ }
3973
+
3974
+ .nice-realtime-controls {
3975
+ display: flex;
3976
+ align-items: center;
3977
+ gap: 12px;
3978
+ }
3979
+
3980
+ .nice-realtime-btn {
3981
+ background: none;
3982
+ border: none;
3983
+ cursor: pointer;
3984
+ font-size: 16px;
3985
+ padding: 4px;
3986
+ font-family: inherit;
3987
+ color: inherit;
3988
+ }
3989
+
3990
+ .nice-realtime-value {
3991
+ font-size: 18px;
3992
+ font-weight: 600;
3993
+ color: ${f};
3994
+ font-variant-numeric: tabular-nums;
3995
+ }
3996
+
3997
+ /* Static current-value dot — no pulsing animation (was distracting) */
3998
+
3999
+ .nice-realtime-status {
4000
+ display: inline-flex;
4001
+ align-items: center;
4002
+ gap: 6px;
4003
+ font-size: 11px;
4004
+ font-family: inherit;
4005
+ color: var(--text-secondary, #6b7280);
4006
+ background: var(--bg-secondary, #f3f4f6);
4007
+ padding: 2px 10px;
4008
+ border-radius: 999px;
4009
+ }
4010
+
4011
+ .nice-realtime-status-dot {
4012
+ width: 8px;
4013
+ height: 8px;
4014
+ border-radius: 50%;
4015
+ background: var(--color-success, #22c55e);
4016
+ }
4017
+
4018
+ .nice-realtime-status.paused .nice-realtime-status-dot {
4019
+ background: var(--color-warning, #f59e0b);
4020
+ }
4021
+
4022
+ .nice-realtime-status.live .nice-realtime-status-dot {
4023
+ animation: live-pulse 2s ease-in-out infinite;
4024
+ }
4025
+
4026
+ @keyframes live-pulse {
4027
+ 0%, 100% { opacity: 1; }
4028
+ 50% { opacity: 0.4; }
4029
+ }
4030
+ ` })
4031
+ ]
4032
+ }
4033
+ );
4034
+ }
4035
+ );
4036
+ rt.displayName = "NiceRealtimeChart";
4037
+ const Lt = ({
4038
+ data: t,
4039
+ width: o = 600,
4040
+ height: i = 400,
4041
+ showLabels: s = !0,
4042
+ showValues: c = !0,
4043
+ onNodeClick: v,
4044
+ drilldownEnabled: p = !0,
4045
+ colors: I = Ye,
4046
+ tilePadding: T = 2,
4047
+ className: w,
4048
+ style: f,
4049
+ ...N
4050
+ }) => {
4051
+ const z = pe(() => Array.isArray(t) ? {
4052
+ id: "root",
4053
+ name: "Root",
4054
+ value: t.reduce((a, _) => a + (_.value || 0), 0),
4055
+ children: t.map((a, _) => ({
4056
+ id: `${_}`,
4057
+ name: a.label ?? a.name ?? `Item ${_ + 1}`,
4058
+ value: a.value,
4059
+ color: a.color
4060
+ }))
4061
+ } : t, [t]), [C, k] = oe(z), [l, d] = oe([z.name]), [u, S] = oe(null), g = be(null), x = pe(() => {
4062
+ const _ = C.children || [];
4063
+ if (_.length === 0)
4064
+ return [];
4065
+ const A = _.reduce((J, n) => J + n.value, 0), O = _.map((J) => ({
4066
+ node: J,
4067
+ area: J.value / A * o * i
4068
+ }));
4069
+ O.sort((J, n) => n.area - J.area);
4070
+ const U = [];
4071
+ let V = 0, j = 0, G = o, Q = i, q = 0;
4072
+ for (; q < O.length; ) {
4073
+ const J = G < Q;
4074
+ let n = 0, X = [];
4075
+ const H = J ? Q : G;
4076
+ for (let F = q; F < O.length; F++) {
4077
+ const Y = [...X, O[F]], ee = Y.reduce((te, fe) => te + fe.area, 0), P = y(Y, ee, H);
4078
+ if (X.length === 0)
4079
+ X = Y, n = ee;
4080
+ else {
4081
+ const te = y(X, n, H);
4082
+ if (P <= te)
4083
+ X = Y, n = ee;
4084
+ else
4085
+ break;
4086
+ }
4087
+ }
4088
+ const W = n / H;
4089
+ let m = 0;
4090
+ X.forEach((F, Y) => {
4091
+ const ee = F.area / W;
4092
+ U.push({
4093
+ node: F.node,
4094
+ x: J ? V : V + m,
4095
+ y: J ? j + m : j,
4096
+ w: J ? W : ee,
4097
+ h: J ? ee : W,
4098
+ color: F.node.color || I[(q + Y) % I.length]
4099
+ }), m += ee;
4100
+ }), J ? (V += W, G -= W) : (j += W, Q -= W), q += X.length;
4101
+ }
4102
+ return U;
4103
+ }, [C, o, i, I]);
4104
+ function y(a, _, A) {
4105
+ const O = _ / A;
4106
+ let U = 0;
4107
+ for (const V of a) {
4108
+ const j = V.area / O, G = Math.max(O / j, j / O);
4109
+ U = Math.max(U, G);
4110
+ }
4111
+ return U;
4112
+ }
4113
+ const b = (a) => {
4114
+ v?.(a, [...l, a.name]), p && a.children && a.children.length > 0 && (k(a), d((_) => [..._, a.name]));
4115
+ }, h = () => {
4116
+ if (l.length <= 1)
4117
+ return;
4118
+ let a = z;
4119
+ const _ = l.slice(0, -1);
4120
+ for (let A = 1; A < _.length; A++) {
4121
+ const O = a.children?.find((U) => U.name === _[A]);
4122
+ O && (a = O);
4123
+ }
4124
+ k(a), d(_);
4125
+ }, D = (a, _) => {
4126
+ const A = g.current?.getBoundingClientRect();
4127
+ A && S({
4128
+ x: _.clientX - A.left,
4129
+ y: _.clientY - A.top,
4130
+ content: a
4131
+ });
4132
+ };
4133
+ return /* @__PURE__ */ $("div", { className: `nice-treemap-chart ${w || ""}`, style: { width: o, ...f }, ...N, children: [
4134
+ /* @__PURE__ */ $("div", { className: "nice-treemap-nav", children: [
4135
+ l.length > 1 && /* @__PURE__ */ e("button", { className: "nice-treemap-back", onClick: h, children: "← Wstecz" }),
4136
+ /* @__PURE__ */ e("div", { className: "nice-treemap-breadcrumbs", children: l.map((a, _) => /* @__PURE__ */ $(Fe.Fragment, { children: [
4137
+ _ > 0 && /* @__PURE__ */ e("span", { className: "nice-treemap-sep", children: "/" }),
4138
+ /* @__PURE__ */ e("span", { className: _ === l.length - 1 ? "current" : "", children: a })
4139
+ ] }, _)) })
4140
+ ] }),
4141
+ /* @__PURE__ */ e("svg", { ref: g, width: o, height: i, className: "nice-treemap-svg", children: x.map((a, _) => {
4142
+ const { node: A, x: O, y: U, w: V, h: j, color: G } = a, Q = Math.min(14, Math.max(10, Math.min(V, j) / 6)), q = V > 40 && j > 30;
4143
+ return /* @__PURE__ */ $(
4144
+ "g",
4145
+ {
4146
+ onClick: () => b(A),
4147
+ onMouseEnter: (J) => D(`${A.name}: ${A.value.toLocaleString()}`, J),
4148
+ onMouseLeave: () => S(null),
4149
+ children: [
4150
+ /* @__PURE__ */ e(
4151
+ "rect",
4152
+ {
4153
+ x: O + T / 2,
4154
+ y: U + T / 2,
4155
+ width: Math.max(0, V - T),
4156
+ height: Math.max(0, j - T),
4157
+ fill: G,
4158
+ rx: 4,
4159
+ className: "nice-treemap-tile"
4160
+ }
4161
+ ),
4162
+ s && q && /* @__PURE__ */ e(
4163
+ "text",
4164
+ {
4165
+ x: O + V / 2,
4166
+ y: U + j / 2 - (c ? 6 : 0),
4167
+ textAnchor: "middle",
4168
+ dominantBaseline: "middle",
4169
+ fontSize: Q,
4170
+ fill: "white",
4171
+ fontWeight: "500",
4172
+ style: { pointerEvents: "none" },
4173
+ children: A.name.length > V / Q + 2 ? A.name.slice(0, Math.floor(V / Q)) + "..." : A.name
4174
+ }
4175
+ ),
4176
+ c && q && /* @__PURE__ */ e(
4177
+ "text",
4178
+ {
4179
+ x: O + V / 2,
4180
+ y: U + j / 2 + 10,
4181
+ textAnchor: "middle",
4182
+ dominantBaseline: "middle",
4183
+ fontSize: Q - 2,
4184
+ fill: "var(--nice-overlay-light-80, rgba(255, 255, 255, 0.8))",
4185
+ style: { pointerEvents: "none" },
4186
+ children: A.value.toLocaleString()
4187
+ }
4188
+ )
4189
+ ]
4190
+ },
4191
+ _
4192
+ );
4193
+ }) }),
4194
+ u && /* @__PURE__ */ e("div", { className: "nice-treemap-tooltip", style: { left: u.x + 10, top: u.y - 30 }, children: u.content }),
4195
+ /* @__PURE__ */ e("style", { children: `
4196
+ .nice-treemap-chart {
4197
+ font-family: system-ui, -apple-system, sans-serif;
4198
+ background: white;
4199
+ border-radius: var(--nice-radius-lg, 8px);
4200
+ position: relative;
4201
+ }
4202
+
4203
+ .nice-treemap-nav {
4204
+ display: flex;
4205
+ align-items: center;
4206
+ gap: var(--nice-space-3, 12px);
4207
+ padding: var(--nice-space-3, 12px) var(--nice-space-4, 16px);
4208
+ border-bottom: 1px solid var(--border-color, #e5e7eb);
4209
+ }
4210
+
4211
+ .nice-treemap-back {
4212
+ background: var(--nice-bg-secondary, #f3f4f6);
4213
+ border: none;
4214
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-3, 12px);
4215
+ border-radius: var(--nice-radius-md, 6px);
4216
+ cursor: pointer;
4217
+ font-size: 13px;
4218
+ }
4219
+
4220
+ .nice-treemap-back:hover {
4221
+ background: var(--nice-border, #e5e7eb);
4222
+ }
4223
+
4224
+ .nice-treemap-breadcrumbs {
4225
+ display: flex;
4226
+ align-items: center;
4227
+ gap: var(--nice-space-1, 4px);
4228
+ font-size: 13px;
4229
+ color: var(--nice-text-secondary, #6b7280);
4230
+ }
4231
+
4232
+ .nice-treemap-breadcrumbs .current {
4233
+ color: var(--nice-text, #111827);
4234
+ font-weight: 500;
4235
+ }
4236
+
4237
+ .nice-treemap-sep {
4238
+ color: var(--nice-text-muted, #9ca3af);
4239
+ }
4240
+
4241
+ .nice-treemap-tile {
4242
+ cursor: pointer;
4243
+ transition: opacity 0.2s, transform 0.1s;
4244
+ }
4245
+
4246
+ .nice-treemap-tile:hover {
4247
+ opacity: 0.85;
4248
+ }
4249
+
4250
+ .nice-treemap-tooltip {
4251
+ position: absolute;
4252
+ background: var(--nice-text, #1f2937);
4253
+ color: white;
4254
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
4255
+ border-radius: var(--nice-radius-sm, 4px);
4256
+ font-size: 12px;
4257
+ pointer-events: none;
4258
+ z-index: 10;
4259
+ white-space: nowrap;
4260
+ }
4261
+ ` })
4262
+ ] });
4263
+ }, at = Ne(
4264
+ ({
4265
+ data: t,
4266
+ renderNode: o,
4267
+ selectable: i,
4268
+ selectedKey: s,
4269
+ onSelect: c,
4270
+ direction: v = "top-down",
4271
+ collapsible: p = !0,
4272
+ className: I,
4273
+ style: T,
4274
+ id: w
4275
+ }, f) => {
4276
+ const N = ze(w), [z, C] = oe(/* @__PURE__ */ new Set()), k = ae((u) => {
4277
+ C((S) => {
4278
+ const g = new Set(S);
4279
+ return g.has(u) ? g.delete(u) : g.add(u), g;
4280
+ });
4281
+ }, []), l = ae(
4282
+ (u) => {
4283
+ i && c?.(u);
4284
+ },
4285
+ [i, c]
4286
+ ), d = ae(
4287
+ (u) => {
4288
+ const S = z.has(u.key), g = u.children && u.children.length > 0;
4289
+ return /* @__PURE__ */ $("li", { className: "nice-org-chart__item", children: [
4290
+ /* @__PURE__ */ $(
4291
+ "div",
4292
+ {
4293
+ className: `nice-org-chart__node${s === u.key ? " nice-org-chart__node--selected" : ""}`,
4294
+ onClick: () => l(u.key),
4295
+ role: i ? "button" : void 0,
4296
+ children: [
4297
+ o ? o(u) : /* @__PURE__ */ e("span", { children: u.label }),
4298
+ p && g && /* @__PURE__ */ e(
4299
+ "button",
4300
+ {
4301
+ type: "button",
4302
+ className: "nice-org-chart__toggle",
4303
+ onClick: (x) => {
4304
+ x.stopPropagation(), k(u.key);
4305
+ },
4306
+ "aria-label": S ? "Expand" : "Collapse",
4307
+ children: S ? "+" : "−"
4308
+ }
4309
+ )
4310
+ ]
4311
+ }
4312
+ ),
4313
+ g && !S && /* @__PURE__ */ e("ul", { className: "nice-org-chart__children", children: u.children.map((x) => d(x)) })
4314
+ ] }, u.key);
4315
+ },
4316
+ [z, s, o, i, p, l, k]
4317
+ );
4318
+ return /* @__PURE__ */ e(
4319
+ "div",
4320
+ {
4321
+ ref: f,
4322
+ id: N,
4323
+ className: `nice-org-chart nice-org-chart--${v} ${I || ""}`,
4324
+ style: T,
4325
+ children: /* @__PURE__ */ e("ul", { className: "nice-org-chart__root", children: d(t) })
4326
+ }
4327
+ );
4328
+ }
4329
+ );
4330
+ at.displayName = "NiceOrganizationChart";
4331
+ function ct(t, o, i) {
4332
+ const s = (C) => {
4333
+ const k = C.replace("#", "");
4334
+ return [
4335
+ parseInt(k.slice(0, 2), 16),
4336
+ parseInt(k.slice(2, 4), 16),
4337
+ parseInt(k.slice(4, 6), 16)
4338
+ ];
4339
+ }, [c, v, p] = s(t), [I, T, w] = s(o), f = Math.round(c + (I - c) * i), N = Math.round(v + (T - v) * i), z = Math.round(p + (w - p) * i);
4340
+ return `rgb(${f},${N},${z})`;
4341
+ }
4342
+ const ot = Ne(
4343
+ ({
4344
+ data: t,
4345
+ xLabels: o,
4346
+ yLabels: i,
4347
+ colors: s = ["var(--nice-primary-bg, #e0f2fe)", "var(--color-primary-active, #1d4ed8)"],
4348
+ onCellClick: c,
4349
+ cellSize: v = 40,
4350
+ showValues: p = !0,
4351
+ className: I,
4352
+ style: T,
4353
+ id: w
4354
+ }, f) => {
4355
+ const N = ze(w), { minVal: z, maxVal: C } = pe(() => {
4356
+ let l = 1 / 0, d = -1 / 0;
4357
+ for (const u of t)
4358
+ for (const S of u)
4359
+ S < l && (l = S), S > d && (d = S);
4360
+ return { minVal: l, maxVal: d };
4361
+ }, [t]), k = ae(
4362
+ (l) => C === z ? 0.5 : (l - z) / (C - z),
4363
+ [z, C]
4364
+ );
4365
+ return /* @__PURE__ */ e("div", { ref: f, id: N, className: `nice-heatmap ${I || ""}`, style: T, children: /* @__PURE__ */ $("table", { className: "nice-heatmap__table", children: [
4366
+ o && /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ $("tr", { children: [
4367
+ i && /* @__PURE__ */ e("th", {}),
4368
+ o.map((l, d) => /* @__PURE__ */ e("th", { className: "nice-heatmap__header", children: l }, d))
4369
+ ] }) }),
4370
+ /* @__PURE__ */ e("tbody", { children: t.map((l, d) => /* @__PURE__ */ $("tr", { children: [
4371
+ i && /* @__PURE__ */ e("th", { className: "nice-heatmap__row-label", children: i[d] }),
4372
+ l.map((u, S) => /* @__PURE__ */ e(
4373
+ "td",
4374
+ {
4375
+ className: "nice-heatmap__cell",
4376
+ style: {
4377
+ background: ct(s[0], s[1], k(u)),
4378
+ width: v,
4379
+ height: v,
4380
+ textAlign: "center",
4381
+ color: k(u) > 0.6 ? "var(--bg-primary, #fff)" : "var(--bg-tertiary, #333)",
4382
+ cursor: c ? "pointer" : void 0
4383
+ },
4384
+ onClick: () => c?.(d, S, u),
4385
+ title: String(u),
4386
+ children: p ? u : ""
4387
+ },
4388
+ S
4389
+ ))
4390
+ ] }, d)) })
4391
+ ] }) });
4392
+ }
4393
+ );
4394
+ ot.displayName = "NiceHeatMap";
4395
+ function it(t, o) {
4396
+ const i = t.reduce((w, f) => w + f.value, 0);
4397
+ if (i === 0 || t.length === 0)
4398
+ return [];
4399
+ const s = [];
4400
+ let { x: c, y: v, w: p, h: I } = o;
4401
+ const T = [...t].sort((w, f) => f.value - w.value);
4402
+ for (const w of T) {
4403
+ const f = w.value / i;
4404
+ if (p >= I) {
4405
+ const N = p * f;
4406
+ s.push({ x: c, y: v, w: N, h: I, node: w }), c += N, p -= N;
4407
+ } else {
4408
+ const N = I * f;
4409
+ s.push({ x: c, y: v, w: p, h: N, node: w }), v += N, I -= N;
4410
+ }
4411
+ }
4412
+ return s;
4413
+ }
4414
+ const st = [
4415
+ "var(--color-primary, #3b82f6)",
4416
+ "var(--color-success, #10b981)",
4417
+ "var(--color-warning, #f59e0b)",
4418
+ "var(--color-error, #ef4444)",
4419
+ "var(--color-accent, #8b5cf6)",
4420
+ "var(--color-info, #06b6d4)",
4421
+ "var(--color-accent-pink, #ec4899)",
4422
+ "var(--nice-success, #84cc16)"
4423
+ ], je = Ne(
4424
+ ({ data: t, width: o = 600, height: i = 400, onNodeClick: s, colors: c = st, className: v, style: p, id: I }, T) => {
4425
+ const w = ze(I), f = pe(() => {
4426
+ const N = t.children ?? [t];
4427
+ return it(N, { x: 0, y: 0, w: o, h: i });
4428
+ }, [t, o, i]);
4429
+ return /* @__PURE__ */ e("div", { ref: T, id: w, className: `nice-treemap ${v || ""}`, style: p, children: /* @__PURE__ */ e("svg", { width: o, height: i, className: "nice-treemap__svg", children: f.map((N, z) => /* @__PURE__ */ $(
4430
+ "g",
4431
+ {
4432
+ onClick: () => s?.(N.node),
4433
+ style: { cursor: s ? "pointer" : void 0 },
4434
+ children: [
4435
+ /* @__PURE__ */ e(
4436
+ "rect",
4437
+ {
4438
+ x: N.x,
4439
+ y: N.y,
4440
+ width: Math.max(N.w - 1, 0),
4441
+ height: Math.max(N.h - 1, 0),
4442
+ fill: N.node.color ?? c[z % c.length],
4443
+ rx: 2
4444
+ }
4445
+ ),
4446
+ N.w > 40 && N.h > 20 && /* @__PURE__ */ e(
4447
+ "text",
4448
+ {
4449
+ x: N.x + N.w / 2,
4450
+ y: N.y + N.h / 2,
4451
+ textAnchor: "middle",
4452
+ dominantBaseline: "central",
4453
+ fill: "var(--nice-bg, #fff)",
4454
+ fontSize: Math.min(12, N.w / 6),
4455
+ className: "nice-treemap__label",
4456
+ children: N.node.label
4457
+ }
4458
+ )
4459
+ ]
4460
+ },
4461
+ N.node.key
4462
+ )) }) });
4463
+ }
4464
+ );
4465
+ je.displayName = "NiceTreeMap";
4466
+ const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4467
+ __proto__: null,
4468
+ NiceTreeMap: je
4469
+ }, Symbol.toStringTag, { value: "Module" })), lt = Ne(
4470
+ ({
4471
+ data: t,
4472
+ type: o = "candlestick",
4473
+ showVolume: i = !0,
4474
+ width: s = 800,
4475
+ height: c = 400,
4476
+ bullColor: v = "var(--color-success, #22c55e)",
4477
+ bearColor: p = "var(--color-error, #ef4444)",
4478
+ className: I,
4479
+ style: T,
4480
+ id: w
4481
+ }, f) => {
4482
+ const N = ze(w), z = { top: 20, right: 20, bottom: i ? 80 : 30, left: 60 }, C = s - z.left - z.right, k = i ? 50 : 0, l = c - z.top - z.bottom - k, { minP: d, maxP: u, maxVol: S } = pe(() => {
4483
+ let h = 1 / 0, D = -1 / 0, a = 0;
4484
+ for (const _ of t)
4485
+ _.low < h && (h = _.low), _.high > D && (D = _.high), _.volume && _.volume > a && (a = _.volume);
4486
+ return { minP: h, maxP: D, maxVol: a };
4487
+ }, [t]), g = Math.max(1, C / t.length * 0.7), x = (h) => z.left + (h + 0.5) * (C / t.length), y = (h) => z.top + l - (h - d) / (u - d || 1) * l, b = (h) => c - z.bottom - k + k * (1 - h / (S || 1));
4488
+ return /* @__PURE__ */ e("div", { ref: f, id: N, className: `nice-stock-chart ${I || ""}`, style: T, children: /* @__PURE__ */ $("svg", { width: s, height: c, className: "nice-stock-chart__svg", children: [
4489
+ [0, 0.25, 0.5, 0.75, 1].map((h) => {
4490
+ const D = d + h * (u - d);
4491
+ return /* @__PURE__ */ $("g", { children: [
4492
+ /* @__PURE__ */ e(
4493
+ "line",
4494
+ {
4495
+ x1: z.left,
4496
+ x2: s - z.right,
4497
+ y1: y(D),
4498
+ y2: y(D),
4499
+ stroke: "var(--nice-border, #e5e7eb)",
4500
+ strokeDasharray: "2,2"
4501
+ }
4502
+ ),
4503
+ /* @__PURE__ */ e("text", { x: z.left - 4, y: y(D) + 4, textAnchor: "end", fontSize: 10, fill: "var(--nice-text-secondary, #888)", children: D.toFixed(2) })
4504
+ ] }, h);
4505
+ }),
4506
+ o === "line" ? /* @__PURE__ */ e(
4507
+ "polyline",
4508
+ {
4509
+ points: t.map((h, D) => `${x(D)},${y(h.close)}`).join(" "),
4510
+ fill: "none",
4511
+ stroke: v,
4512
+ strokeWidth: 1.5
4513
+ }
4514
+ ) : t.map((h, D) => {
4515
+ const a = h.close >= h.open, _ = a ? v : p, A = x(D);
4516
+ if (o === "ohlc")
4517
+ return /* @__PURE__ */ $("g", { children: [
4518
+ /* @__PURE__ */ e(
4519
+ "line",
4520
+ {
4521
+ x1: A,
4522
+ x2: A,
4523
+ y1: y(h.high),
4524
+ y2: y(h.low),
4525
+ stroke: _,
4526
+ strokeWidth: 1
4527
+ }
4528
+ ),
4529
+ /* @__PURE__ */ e(
4530
+ "line",
4531
+ {
4532
+ x1: A - g / 2,
4533
+ x2: A,
4534
+ y1: y(h.open),
4535
+ y2: y(h.open),
4536
+ stroke: _,
4537
+ strokeWidth: 1.5
4538
+ }
4539
+ ),
4540
+ /* @__PURE__ */ e(
4541
+ "line",
4542
+ {
4543
+ x1: A,
4544
+ x2: A + g / 2,
4545
+ y1: y(h.close),
4546
+ y2: y(h.close),
4547
+ stroke: _,
4548
+ strokeWidth: 1.5
4549
+ }
4550
+ )
4551
+ ] }, D);
4552
+ const O = y(Math.max(h.open, h.close)), U = y(Math.min(h.open, h.close));
4553
+ return /* @__PURE__ */ $("g", { children: [
4554
+ /* @__PURE__ */ e(
4555
+ "line",
4556
+ {
4557
+ x1: A,
4558
+ x2: A,
4559
+ y1: y(h.high),
4560
+ y2: y(h.low),
4561
+ stroke: _,
4562
+ strokeWidth: 1
4563
+ }
4564
+ ),
4565
+ /* @__PURE__ */ e(
4566
+ "rect",
4567
+ {
4568
+ x: A - g / 2,
4569
+ y: O,
4570
+ width: g,
4571
+ height: Math.max(U - O, 1),
4572
+ fill: a ? "transparent" : _,
4573
+ stroke: _,
4574
+ strokeWidth: 1
4575
+ }
4576
+ )
4577
+ ] }, D);
4578
+ }),
4579
+ i && t.map((h, D) => {
4580
+ if (!h.volume)
4581
+ return null;
4582
+ const a = h.close >= h.open;
4583
+ return /* @__PURE__ */ e(
4584
+ "rect",
4585
+ {
4586
+ x: x(D) - g / 2,
4587
+ y: b(h.volume),
4588
+ width: g,
4589
+ height: c - z.bottom - b(h.volume),
4590
+ fill: a ? v : p,
4591
+ opacity: 0.3
4592
+ },
4593
+ `v${D}`
4594
+ );
4595
+ }),
4596
+ t.map((h, D) => D % Math.max(1, Math.floor(t.length / 8)) !== 0 ? null : /* @__PURE__ */ e(
4597
+ "text",
4598
+ {
4599
+ x: x(D),
4600
+ y: c - z.bottom + k + 14,
4601
+ textAnchor: "middle",
4602
+ fontSize: 9,
4603
+ fill: "var(--nice-text-secondary, #888)",
4604
+ children: h.date
4605
+ },
4606
+ `l${D}`
4607
+ ))
4608
+ ] }) });
4609
+ }
4610
+ );
4611
+ lt.displayName = "NiceStockChart";
4612
+ export {
4613
+ mt as A,
4614
+ kt as B,
4615
+ ve as C,
4616
+ Ct as D,
4617
+ Dt as E,
4618
+ et as N,
4619
+ St as a,
4620
+ at as b,
4621
+ lt as c,
4622
+ je as d,
4623
+ ot as e,
4624
+ Qe as f,
4625
+ Nt as g,
4626
+ Mt as h,
4627
+ $t as i,
4628
+ wt as j,
4629
+ _t as k,
4630
+ bt as l,
4631
+ vt as m,
4632
+ yt as n,
4633
+ Re as o,
4634
+ pt as p,
4635
+ nt as q,
4636
+ At as r,
4637
+ Je as s,
4638
+ It as t,
4639
+ rt as u,
4640
+ zt as v,
4641
+ Lt as w,
4642
+ xt as x,
4643
+ ft as y,
4644
+ gt as z
4645
+ };