@nice2dev/ui-3d 1.0.5 → 1.0.6

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 (95) hide show
  1. package/dist/cjs/core/i18n.js +3 -3
  2. package/dist/cjs/dance/DanceBridge.js +13 -13
  3. package/dist/cjs/dance/DanceScoreEngine.js +8 -8
  4. package/dist/cjs/dance/PoseDetector.js +20 -20
  5. package/dist/cjs/material/NiceMaterialEditor.js +19 -19
  6. package/dist/cjs/model/ModelEditorLeftPanel.js +5 -5
  7. package/dist/cjs/model/ModelEditorLeftPanel.js.map +1 -1
  8. package/dist/cjs/model/ModelEditorMenuBar.js +6 -5
  9. package/dist/cjs/model/ModelEditorMenuBar.js.map +1 -1
  10. package/dist/cjs/model/ModelEditorRightPanel.js +19 -17
  11. package/dist/cjs/model/ModelEditorRightPanel.js.map +1 -1
  12. package/dist/cjs/model/ModelEditorSubComponents.js +10 -9
  13. package/dist/cjs/model/ModelEditorSubComponents.js.map +1 -1
  14. package/dist/cjs/model/ModelEditorTimeline.js +6 -5
  15. package/dist/cjs/model/ModelEditorTimeline.js.map +1 -1
  16. package/dist/cjs/model/ModelEditorToolbar.js +4 -4
  17. package/dist/cjs/model/ModelEditorToolbar.js.map +1 -1
  18. package/dist/cjs/model/ModelEditorViewport.js +2 -2
  19. package/dist/cjs/model/ModelViewer.js +14 -13
  20. package/dist/cjs/model/ModelViewer.js.map +1 -1
  21. package/dist/cjs/model/NiceArmatureEditor.js +18 -18
  22. package/dist/cjs/model/NiceMorphTargetEditor.js +18 -18
  23. package/dist/cjs/model/NiceOctree.js +16 -16
  24. package/dist/cjs/model/NicePhysicsSimulation.js +24 -24
  25. package/dist/cjs/model/NiceProceduralGeometry.js +8 -8
  26. package/dist/cjs/model/NiceTerrainEditor.js +19 -19
  27. package/dist/cjs/model/NiceWeightPainter.js +14 -14
  28. package/dist/cjs/model/NiceXRPreview.js +18 -18
  29. package/dist/cjs/model/useModelEditor.js +127 -127
  30. package/dist/cjs/model/useModelViewer.js +61 -61
  31. package/dist/cjs/particle/NiceParticleEditor.js +11 -11
  32. package/dist/cjs/rendering/NiceCascadedShadows.js +12 -12
  33. package/dist/cjs/rendering/NiceRenderExport.js +5 -5
  34. package/dist/cjs/rendering/NiceSSAO.js +18 -18
  35. package/dist/cjs/rendering/NiceSSR.js +14 -14
  36. package/dist/cjs/rendering/NiceWebGPURenderer.js +21 -21
  37. package/dist/cjs/ui/dist/NiceButton-DmTHNHet.js +453 -0
  38. package/dist/cjs/ui/dist/NiceButton-DmTHNHet.js.map +1 -0
  39. package/dist/cjs/ui/dist/NiceErrorBoundary-D1hh5GGe.js +543 -0
  40. package/dist/cjs/ui/dist/NiceErrorBoundary-D1hh5GGe.js.map +1 -0
  41. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-BapdidD6.js +4772 -0
  42. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-BapdidD6.js.map +1 -0
  43. package/dist/cjs/ui/dist/NicePinCodeInput-4q8yULuo.js +11329 -0
  44. package/dist/cjs/ui/dist/NicePinCodeInput-4q8yULuo.js.map +1 -0
  45. package/dist/cjs/ui/dist/NiceSavedQueryPanel-DUw8plYP.js +5544 -0
  46. package/dist/cjs/ui/dist/NiceSavedQueryPanel-DUw8plYP.js.map +1 -0
  47. package/dist/cjs/ui/dist/NiceStockChart-Cpmv9_Cc.js +2244 -0
  48. package/dist/cjs/ui/dist/NiceStockChart-Cpmv9_Cc.js.map +1 -0
  49. package/dist/cjs/ui/dist/NiceToggle-C1UKGXmJ.js +212 -0
  50. package/dist/cjs/ui/dist/NiceToggle-C1UKGXmJ.js.map +1 -0
  51. package/dist/cjs/ui/dist/NiceWindow-D1awkyFl.js +697 -0
  52. package/dist/cjs/ui/dist/NiceWindow-D1awkyFl.js.map +1 -0
  53. package/dist/cjs/ui/dist/core-CfXsl755.js +9597 -0
  54. package/dist/cjs/ui/dist/core-CfXsl755.js.map +1 -0
  55. package/dist/cjs/ui/dist/index-CNwVELPJ.js +31214 -0
  56. package/dist/cjs/ui/dist/index-CNwVELPJ.js.map +1 -0
  57. package/dist/cjs/ui/dist/index-x8mRM4Jc.js +20 -0
  58. package/dist/cjs/ui/dist/index-x8mRM4Jc.js.map +1 -0
  59. package/dist/cjs/uv/NiceUVEditor.js +24 -24
  60. package/dist/esm/model/ModelEditorLeftPanel.js +5 -5
  61. package/dist/esm/model/ModelEditorMenuBar.js +6 -5
  62. package/dist/esm/model/ModelEditorMenuBar.js.map +1 -1
  63. package/dist/esm/model/ModelEditorRightPanel.js +19 -17
  64. package/dist/esm/model/ModelEditorRightPanel.js.map +1 -1
  65. package/dist/esm/model/ModelEditorSubComponents.js +7 -6
  66. package/dist/esm/model/ModelEditorSubComponents.js.map +1 -1
  67. package/dist/esm/model/ModelEditorTimeline.js +6 -5
  68. package/dist/esm/model/ModelEditorTimeline.js.map +1 -1
  69. package/dist/esm/model/ModelEditorToolbar.js +4 -4
  70. package/dist/esm/model/ModelEditorViewport.js +2 -2
  71. package/dist/esm/model/ModelViewer.js +6 -5
  72. package/dist/esm/model/ModelViewer.js.map +1 -1
  73. package/dist/esm/ui/dist/NiceButton-DmTHNHet.js +448 -0
  74. package/dist/esm/ui/dist/NiceButton-DmTHNHet.js.map +1 -0
  75. package/dist/esm/ui/dist/NiceErrorBoundary-D1hh5GGe.js +533 -0
  76. package/dist/esm/ui/dist/NiceErrorBoundary-D1hh5GGe.js.map +1 -0
  77. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-BapdidD6.js +4731 -0
  78. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-BapdidD6.js.map +1 -0
  79. package/dist/esm/ui/dist/NicePinCodeInput-4q8yULuo.js +11259 -0
  80. package/dist/esm/ui/dist/NicePinCodeInput-4q8yULuo.js.map +1 -0
  81. package/dist/esm/ui/dist/NiceSavedQueryPanel-DUw8plYP.js +5527 -0
  82. package/dist/esm/ui/dist/NiceSavedQueryPanel-DUw8plYP.js.map +1 -0
  83. package/dist/esm/ui/dist/NiceStockChart-Cpmv9_Cc.js +2222 -0
  84. package/dist/esm/ui/dist/NiceStockChart-Cpmv9_Cc.js.map +1 -0
  85. package/dist/esm/ui/dist/NiceToggle-C1UKGXmJ.js +208 -0
  86. package/dist/esm/ui/dist/NiceToggle-C1UKGXmJ.js.map +1 -0
  87. package/dist/esm/ui/dist/NiceWindow-D1awkyFl.js +686 -0
  88. package/dist/esm/ui/dist/NiceWindow-D1awkyFl.js.map +1 -0
  89. package/dist/esm/ui/dist/core-CfXsl755.js +9419 -0
  90. package/dist/esm/ui/dist/core-CfXsl755.js.map +1 -0
  91. package/dist/esm/ui/dist/index-CNwVELPJ.js +31110 -0
  92. package/dist/esm/ui/dist/index-CNwVELPJ.js.map +1 -0
  93. package/dist/esm/ui/dist/index-x8mRM4Jc.js +18 -0
  94. package/dist/esm/ui/dist/index-x8mRM4Jc.js.map +1 -0
  95. package/package.json +1 -1
@@ -0,0 +1,2244 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var we = require('react');
5
+ var coreCfXsl755 = require('./core-CfXsl755.js');
6
+ var indexX8mRM4Jc = require('./index-x8mRM4Jc.js');
7
+
8
+ const Ne = ["#3b82f6", "#ef4444", "#22c55e", "#f59e0b", "#8b5cf6", "#ec4899", "#06b6d4", "#84cc16"], De = ({
9
+ series: t,
10
+ categories: a,
11
+ width: d = 600,
12
+ height: c = 400,
13
+ title: r,
14
+ showLegend: u = true,
15
+ showGrid: i = true,
16
+ yAxisLabel: m,
17
+ xAxisLabel: C,
18
+ stacked: l,
19
+ zoomable: v,
20
+ crosshair: f,
21
+ annotations: S,
22
+ legendInteractive: y,
23
+ onDataPointClick: p,
24
+ exportable: o,
25
+ className: s,
26
+ style: h
27
+ }) => {
28
+ const w = we.useRef(null), [b, A] = we.useState(/* @__PURE__ */ new Set()), [N, I] = we.useState(null), [g, T] = we.useState(null), [x, O] = we.useState(false), B = we.useRef(null), R = we.useMemo(
29
+ () => t.filter(($) => !b.has($.name)),
30
+ [t, b]
31
+ ), G = we.useCallback(($) => {
32
+ y && A((E) => {
33
+ const Y = new Set(E);
34
+ return Y.has($) ? Y.delete($) : Y.add($), Y;
35
+ });
36
+ }, [y]), j = { top: r ? 40 : 20, right: 20, bottom: C ? 60 : 40, left: m ? 60 : 50 }, W = d - j.left - j.right, U = c - j.top - j.bottom, Z = R[0]?.data.length ?? t[0]?.data.length ?? 0, X = g?.start ?? 0, K = g?.end ?? Z, ee = K - X, he = we.useMemo(
37
+ () => R.map(($) => ({ ...$, data: $.data.slice(X, K) })),
38
+ [R, X, K]
39
+ ), ne = we.useMemo(
40
+ () => a?.slice(X, K),
41
+ [a, X, K]
42
+ ), { minY: D, maxY: P, yTicks: re } = we.useMemo(() => {
43
+ let $;
44
+ if (l) {
45
+ $ = [];
46
+ for (let _ = 0; _ < ee; _++)
47
+ $.push(he.reduce((V, ae) => V + (ae.data[_] || 0), 0));
48
+ } else
49
+ $ = he.flatMap((_) => _.data);
50
+ $.length === 0 && ($ = [0]);
51
+ const E = Math.min(0, ...$), Y = Math.max(0, ...$), ce = Y - E || 1, oe = Math.pow(10, Math.floor(Math.log10(ce))) || 1, n = Math.floor(E / oe) * oe, M = Math.ceil(Y / oe) * oe, z = [];
52
+ for (let _ = n; _ <= M; _ += oe) z.push(Math.round(_ * 1e6) / 1e6);
53
+ return z.length < 2 && z.push(M), { minY: n, maxY: M, yTicks: z };
54
+ }, [he, ee, l]), F = ($) => U - ($ - D) / (P - D || 1) * U, q = ($) => ($ + 0.5) / ee * W, de = ee > 0 ? W / ee / (l ? 1.5 : Math.max(R.length, 1) * 1.5) : 20, xe = we.useCallback(($) => {
55
+ if (!v) return;
56
+ $.preventDefault();
57
+ const E = g ?? { start: 0, end: Z }, Y = E.end - E.start, ce = (E.start + E.end) / 2, oe = $.deltaY > 0 ? 1.2 : 0.8, n = Math.max(2, Math.min(Z, Math.round(Y * oe))), M = Math.max(0, Math.round(ce - n / 2)), z = Math.min(Z, M + n);
58
+ T({ start: M, end: z });
59
+ }, [v, g, Z]), ye = we.useCallback(($) => {
60
+ v && (O(true), B.current = { x: $.clientX, range: g ?? { start: 0, end: Z } });
61
+ }, [v, g, Z]), L = we.useCallback(($) => {
62
+ const E = w.current?.getBoundingClientRect();
63
+ if (E && I({ x: $.clientX - E.left - j.left, y: $.clientY - E.top - j.top }), x && B.current && v) {
64
+ const Y = $.clientX - B.current.x, ce = W / ee, oe = -Math.round(Y / ce), n = B.current.range, M = n.end - n.start;
65
+ let z = n.start + oe;
66
+ z < 0 && (z = 0), z + M > Z && (z = Z - M), T({ start: z, end: z + M });
67
+ }
68
+ }, [x, v, W, ee, Z, j.left, j.top]), H = we.useCallback(() => {
69
+ O(false), B.current = null;
70
+ }, []), J = we.useCallback(() => {
71
+ I(null), O(false), B.current = null;
72
+ }, []), pe = we.useCallback(() => {
73
+ const $ = w.current;
74
+ if (!$) return;
75
+ const E = new XMLSerializer().serializeToString($), Y = document.createElement("canvas");
76
+ Y.width = d, Y.height = c + (u ? 30 : 0);
77
+ const ce = Y.getContext("2d");
78
+ if (!ce) return;
79
+ const oe = new Image();
80
+ oe.onload = () => {
81
+ ce.fillStyle = "#fff", ce.fillRect(0, 0, Y.width, Y.height), ce.drawImage(oe, 0, 0);
82
+ const n = document.createElement("a");
83
+ n.download = "chart.png", n.href = Y.toDataURL("image/png"), n.click();
84
+ }, oe.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(E);
85
+ }, [d, c, u]);
86
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `nice-chart ${s || ""}`, style: h, children: [
87
+ o && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "nice-chart__export-btn", onClick: pe, title: "Export PNG", children: "📷" }),
88
+ /* @__PURE__ */ jsxRuntime.jsxs(
89
+ "svg",
90
+ {
91
+ ref: w,
92
+ width: d,
93
+ height: c + (u ? 30 : 0),
94
+ className: "nice-chart__svg",
95
+ onWheel: xe,
96
+ onMouseDown: ye,
97
+ onMouseMove: L,
98
+ onMouseUp: H,
99
+ onMouseLeave: J,
100
+ children: [
101
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${j.left},${j.top})`, children: [
102
+ r && /* @__PURE__ */ jsxRuntime.jsx("text", { x: W / 2, y: -10, textAnchor: "middle", className: "nice-chart__title", children: r }),
103
+ i && re.map(($) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
104
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 0, y1: F($), x2: W, y2: F($), className: "nice-chart__grid-line" }),
105
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: -8, y: F($) + 4, textAnchor: "end", className: "nice-chart__axis-label", children: $ })
106
+ ] }, $)),
107
+ ne && ne.map(($, E) => /* @__PURE__ */ jsxRuntime.jsx("text", { x: q(E), y: U + 20, textAnchor: "middle", className: "nice-chart__axis-label", children: $ }, E)),
108
+ m && /* @__PURE__ */ jsxRuntime.jsx("text", { x: -j.left + 14, y: U / 2, textAnchor: "middle", transform: `rotate(-90, -${j.left - 14}, ${U / 2})`, className: "nice-chart__axis-title", children: m }),
109
+ C && /* @__PURE__ */ jsxRuntime.jsx("text", { x: W / 2, y: U + 45, textAnchor: "middle", className: "nice-chart__axis-title", children: C }),
110
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 0, y1: 0, x2: 0, y2: U, className: "nice-chart__axis" }),
111
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 0, y1: U, x2: W, y2: U, className: "nice-chart__axis" }),
112
+ S?.map(($, E) => {
113
+ if ($.type === "line") {
114
+ const Y = F($.value);
115
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
116
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 0, y1: Y, x2: W, y2: Y, stroke: $.color || "#ef4444", strokeWidth: 1.5, strokeDasharray: $.dash || "6,3" }),
117
+ $.label && /* @__PURE__ */ jsxRuntime.jsx("text", { x: W + 4, y: Y + 4, className: "nice-chart__annotation-label", fill: $.color || "#ef4444", children: $.label })
118
+ ] }, E);
119
+ }
120
+ return /* @__PURE__ */ jsxRuntime.jsx("text", { x: q($.value), y: -4, textAnchor: "middle", className: "nice-chart__annotation-label", fill: $.color || "#6b7280", children: $.label }, E);
121
+ }),
122
+ f && N && N.x >= 0 && N.x <= W && N.y >= 0 && N.y <= U && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
123
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: N.x, y1: 0, x2: N.x, y2: U, stroke: "#9ca3af", strokeWidth: 1, strokeDasharray: "4,2" }),
124
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 0, y1: N.y, x2: W, y2: N.y, stroke: "#9ca3af", strokeWidth: 1, strokeDasharray: "4,2" })
125
+ ] }),
126
+ he.map(($, E) => {
127
+ const Y = $.color || Ne[E % Ne.length], ce = $.type || "bar";
128
+ if (ce === "bar")
129
+ return /* @__PURE__ */ jsxRuntime.jsx("g", { children: $.data.map((n, M) => {
130
+ let z, _;
131
+ if (l) {
132
+ const ae = he.slice(0, E).reduce((ue, se) => ue + (se.data[M] || 0), 0);
133
+ z = F(ae + n), _ = F(ae) - z;
134
+ } else
135
+ z = F(Math.max(0, n)), _ = Math.abs(F(n) - F(0));
136
+ const V = l ? q(M) - de / 2 : q(M) - he.length * de / 2 + E * de;
137
+ return /* @__PURE__ */ jsxRuntime.jsx(
138
+ "rect",
139
+ {
140
+ x: V,
141
+ y: z,
142
+ width: de * 0.9,
143
+ height: Math.max(0, _),
144
+ fill: Y,
145
+ rx: 2,
146
+ style: p ? { cursor: "pointer" } : void 0,
147
+ onClick: p ? () => p($.name, X + M, n) : void 0,
148
+ children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: `${$.name}: ${n}` })
149
+ },
150
+ M
151
+ );
152
+ }) }, $.name);
153
+ const oe = $.data.map((n, M) => `${q(M)},${F(n)}`);
154
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
155
+ ce === "area" && /* @__PURE__ */ jsxRuntime.jsx(
156
+ "polygon",
157
+ {
158
+ points: `${q(0)},${F(0)} ${oe.join(" ")} ${q(ee - 1)},${F(0)}`,
159
+ fill: Y,
160
+ opacity: 0.15
161
+ }
162
+ ),
163
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: oe.join(" "), fill: "none", stroke: Y, strokeWidth: 2 }),
164
+ $.data.map((n, M) => /* @__PURE__ */ jsxRuntime.jsx(
165
+ "circle",
166
+ {
167
+ cx: q(M),
168
+ cy: F(n),
169
+ r: 3,
170
+ fill: Y,
171
+ style: p ? { cursor: "pointer" } : void 0,
172
+ onClick: p ? () => p($.name, X + M, n) : void 0,
173
+ children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: `${$.name}: ${n}` })
174
+ },
175
+ M
176
+ ))
177
+ ] }, $.name);
178
+ })
179
+ ] }),
180
+ u && /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(${j.left}, ${c})`, children: t.map(($, E) => {
181
+ const Y = E * 120, ce = b.has($.name);
182
+ return /* @__PURE__ */ jsxRuntime.jsxs(
183
+ "g",
184
+ {
185
+ transform: `translate(${Y}, 10)`,
186
+ style: y ? { cursor: "pointer" } : void 0,
187
+ onClick: () => G($.name),
188
+ opacity: ce ? 0.35 : 1,
189
+ children: [
190
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: 12, height: 12, rx: 2, fill: $.color || Ne[E % Ne.length] }),
191
+ /* @__PURE__ */ jsxRuntime.jsx(
192
+ "text",
193
+ {
194
+ x: 16,
195
+ y: 10,
196
+ className: "nice-chart__legend-text",
197
+ style: ce ? { textDecoration: "line-through" } : void 0,
198
+ children: $.name
199
+ }
200
+ )
201
+ ]
202
+ },
203
+ $.name
204
+ );
205
+ }) })
206
+ ]
207
+ }
208
+ )
209
+ ] });
210
+ }, rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
211
+ __proto__: null,
212
+ NiceChart: De
213
+ }, Symbol.toStringTag, { value: "Module" }));
214
+ function Re(t) {
215
+ if (!t.length)
216
+ return { categories: [], numericFields: [], sampleValues: {} };
217
+ const a = t[0], d = [], c = {};
218
+ let r = null;
219
+ for (const [i, m] of Object.entries(a))
220
+ typeof m == "number" ? (d.push(i), c[i] = t.map((C) => Number(C[i]) || 0)) : !r && (typeof m == "string" || m instanceof Date) && (r = i);
221
+ return { categories: r ? t.map((i) => String(i[r] || "")) : t.map((i, m) => `Item ${m + 1}`), numericFields: d, sampleValues: c };
222
+ }
223
+ function je(t, a) {
224
+ const { categories: d, numericFields: c, sampleValues: r } = Re(t);
225
+ return { series: c.map((i, m) => ({
226
+ name: i.replace(/([A-Z])/g, " $1").replace(/^./, (C) => C.toUpperCase()).trim(),
227
+ data: r[i],
228
+ type: a === "area" ? "area" : a === "line" ? "line" : "bar"
229
+ })), categories: d };
230
+ }
231
+ we.forwardRef(function(a, d) {
232
+ const {
233
+ rawData: c,
234
+ enableAI: r = true,
235
+ aiModel: u,
236
+ enableAutoType: i = true,
237
+ enableInsights: m = true,
238
+ dataDescription: C,
239
+ onChartSuggestion: l,
240
+ onInsights: v,
241
+ showAIToolbar: f = true,
242
+ showInsightsOnLoad: S = false,
243
+ series: y,
244
+ categories: p,
245
+ ...o
246
+ } = a, [s, h] = we.useState("bar"), [w, b] = we.useState(null), [A, N] = we.useState([]), [I, g] = we.useState(S), [T, x] = we.useState(null), { t: O } = indexX8mRM4Jc.N(), B = coreCfXsl755.k(), { suggestChartType: R, generateInsights: G, isLoading: j } = coreCfXsl755.n(), W = r && B.isConfigured, { series: U, categories: Z } = c ? je(c, T || s) : { series: y || [], categories: p }, X = we.useCallback(async () => {
247
+ if (!W || !i)
248
+ return { type: "bar", reason: "Default", config: {} };
249
+ const D = c || (y?.length ? y.flatMap((P) => P.data.map((re, F) => ({ [P.name]: re, index: F }))) : []);
250
+ try {
251
+ const P = await R(D, C), re = {
252
+ type: P.type,
253
+ reason: P.reason,
254
+ config: P.config
255
+ };
256
+ return b(re), h(re.type), l?.(re), re;
257
+ } catch {
258
+ return { type: "bar", reason: "Default fallback", config: {} };
259
+ }
260
+ }, [W, i, c, y, C, R, l]), K = we.useCallback(async () => {
261
+ if (!W || !m) return [];
262
+ const D = c || (y?.length ? y.flatMap((P) => P.data.map((re, F) => ({ [P.name]: re, category: p?.[F] || F }))) : []);
263
+ try {
264
+ const P = await G(D, T || s);
265
+ return N(P), v?.(P), P;
266
+ } catch {
267
+ return [];
268
+ }
269
+ }, [W, m, c, y, p, s, T, G, v]), ee = we.useCallback(() => T || s, [T, s]);
270
+ we.useEffect(() => {
271
+ W && i && (c?.length || y?.length) && X();
272
+ }, [W, i, c, y]), we.useImperativeHandle(d, () => ({
273
+ getSuggestion: X,
274
+ generateInsights: K,
275
+ getCurrentType: ee
276
+ }));
277
+ const he = [
278
+ { type: "bar", icon: "📊", label: "Bar" },
279
+ { type: "line", icon: "📈", label: "Line" },
280
+ { type: "area", icon: "🏔️", label: "Area" },
281
+ { type: "pie", icon: "🥧", label: "Pie" },
282
+ { type: "donut", icon: "🍩", label: "Donut" },
283
+ { type: "scatter", icon: "⭐", label: "Scatter" }
284
+ ], ne = T || s;
285
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-chart-ai", "data-testid": a["data-testid"], children: [
286
+ f && W && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-chart-ai__toolbar", children: [
287
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-chart-ai__toolbar-left", children: [
288
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-chart-ai__badge", children: "AI" }),
289
+ w && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-chart-ai__suggestion", children: [
290
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-chart-ai__suggestion-icon", children: "💡" }),
291
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "nice-chart-ai__suggestion-text", children: [
292
+ O("chartAI.suggestedType", "Suggested:"),
293
+ " ",
294
+ w.type
295
+ ] }),
296
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "nice-chart-ai__suggestion-reason", title: w.reason, children: [
297
+ "(",
298
+ w.reason,
299
+ ")"
300
+ ] })
301
+ ] }),
302
+ j && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-chart-ai__loading", children: O("chartAI.analyzing", "Analyzing...") })
303
+ ] }),
304
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-chart-ai__toolbar-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-chart-ai__type-selector", children: he.filter((D) => ["bar", "line", "area"].includes(D.type)).map(({ type: D, icon: P, label: re }) => /* @__PURE__ */ jsxRuntime.jsx(
305
+ "button",
306
+ {
307
+ type: "button",
308
+ className: `nice-chart-ai__type-btn ${ne === D ? "nice-chart-ai__type-btn--active" : ""}`,
309
+ onClick: () => x(D),
310
+ title: re,
311
+ children: P
312
+ },
313
+ D
314
+ )) }) }),
315
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-chart-ai__toolbar-right", children: [
316
+ /* @__PURE__ */ jsxRuntime.jsxs(
317
+ "button",
318
+ {
319
+ type: "button",
320
+ className: "nice-chart-ai__auto-btn",
321
+ onClick: () => X(),
322
+ disabled: j,
323
+ title: O("chartAI.autoDetect", "Auto-detect best chart type"),
324
+ children: [
325
+ "🔮 ",
326
+ O("chartAI.auto", "Auto")
327
+ ]
328
+ }
329
+ ),
330
+ m && /* @__PURE__ */ jsxRuntime.jsxs(
331
+ "button",
332
+ {
333
+ type: "button",
334
+ className: "nice-chart-ai__insights-btn",
335
+ onClick: () => {
336
+ A.length || K(), g(!I);
337
+ },
338
+ disabled: j,
339
+ title: O("chartAI.showInsights", "Show data insights"),
340
+ children: [
341
+ "💡 ",
342
+ O("chartAI.insights", "Insights")
343
+ ]
344
+ }
345
+ )
346
+ ] })
347
+ ] }),
348
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-chart-ai__chart-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx(
349
+ De,
350
+ {
351
+ series: U,
352
+ categories: Z,
353
+ ...o
354
+ }
355
+ ) }),
356
+ I && A.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-chart-ai__insights", children: [
357
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-chart-ai__insights-header", children: [
358
+ /* @__PURE__ */ jsxRuntime.jsxs("h4", { children: [
359
+ "💡 ",
360
+ O("chartAI.dataInsights", "Data Insights")
361
+ ] }),
362
+ /* @__PURE__ */ jsxRuntime.jsx(
363
+ "button",
364
+ {
365
+ type: "button",
366
+ className: "nice-chart-ai__insights-close",
367
+ onClick: () => g(false),
368
+ children: "✕"
369
+ }
370
+ )
371
+ ] }),
372
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "nice-chart-ai__insights-list", children: A.map((D, P) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "nice-chart-ai__insight", children: [
373
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-chart-ai__insight-icon", children: "•" }),
374
+ D
375
+ ] }, P)) }),
376
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-chart-ai__insights-footer", children: /* @__PURE__ */ jsxRuntime.jsxs(
377
+ "button",
378
+ {
379
+ type: "button",
380
+ className: "nice-chart-ai__refresh",
381
+ onClick: () => K(),
382
+ disabled: j,
383
+ children: [
384
+ "🔄 ",
385
+ O("chartAI.refresh", "Refresh")
386
+ ]
387
+ }
388
+ ) })
389
+ ] }),
390
+ I && j && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-chart-ai__insights nice-chart-ai__insights--loading", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-chart-ai__loading-content", children: [
391
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-chart-ai__spinner" }),
392
+ O("chartAI.generatingInsights", "Generating insights...")
393
+ ] }) })
394
+ ] });
395
+ });
396
+ function He(t, a) {
397
+ const d = t ? typeof t == "number" ? new Date(t) : new Date(t) : /* @__PURE__ */ new Date(), c = (C) => C.toString().padStart(2, "0"), r = c(d.getHours()), u = c(d.getMinutes()), i = c(d.getSeconds()), m = d.getMilliseconds().toString().padStart(3, "0");
398
+ switch (a) {
399
+ case "HH:mm:ss":
400
+ return `${r}:${u}:${i}`;
401
+ case "HH:mm":
402
+ return `${r}:${u}`;
403
+ case "mm:ss":
404
+ return `${u}:${i}`;
405
+ case "ss.SSS":
406
+ return `${i}.${m}`;
407
+ case "ISO":
408
+ return d.toISOString();
409
+ default:
410
+ return `${r}:${u}:${i}`;
411
+ }
412
+ }
413
+ function Te(t) {
414
+ if (t.length === 0) return null;
415
+ const a = Math.min(...t), d = Math.max(...t), c = t.reduce((u, i) => u + i, 0) / t.length, r = t[t.length - 1];
416
+ return { min: a, max: d, avg: c, current: r, count: t.length };
417
+ }
418
+ const Fe = we.forwardRef(
419
+ ({
420
+ series: t,
421
+ maxPoints: a = 100,
422
+ slidingWindow: d = true,
423
+ refreshRate: c = 16,
424
+ dataSource: r,
425
+ width: u = 600,
426
+ height: i = 400,
427
+ title: m,
428
+ showLegend: C = true,
429
+ showGrid: l = true,
430
+ yAxisLabel: v,
431
+ xAxisLabel: f,
432
+ stacked: S,
433
+ zoomable: y,
434
+ crosshair: p,
435
+ annotations: o = [],
436
+ legendInteractive: s,
437
+ onDataPointClick: h,
438
+ exportable: w,
439
+ showControls: b = true,
440
+ showStatus: A = true,
441
+ initialPaused: N = false,
442
+ onDataReceived: I,
443
+ onDataDropped: g,
444
+ timeFormat: T = "HH:mm:ss",
445
+ showStats: x,
446
+ thresholds: O = [],
447
+ className: B,
448
+ style: R
449
+ }, G) => {
450
+ const [j, W] = we.useState(() => {
451
+ const L = /* @__PURE__ */ new Map();
452
+ for (const H of t)
453
+ L.set(H.name, H.initialData?.slice() ?? []);
454
+ return L;
455
+ }), [U, Z] = we.useState([]), [X, K] = we.useState(N), [ee, he] = we.useState(false), ne = we.useRef([]), D = we.useRef(Date.now()), P = we.useRef(null), re = we.useCallback(() => {
456
+ const L = ne.current;
457
+ L.length !== 0 && (ne.current = [], W((H) => {
458
+ const J = new Map(H);
459
+ for (const pe of L) {
460
+ const $ = J.get(pe.series);
461
+ if (!$) continue;
462
+ const E = [...$, pe.value];
463
+ if (d && E.length > a) {
464
+ const Y = E.length - a;
465
+ g?.(Y, pe.series), E.splice(0, Y);
466
+ }
467
+ J.set(pe.series, E);
468
+ }
469
+ return J;
470
+ }), L.length > 0 && Z((H) => {
471
+ const J = [...H];
472
+ for (const pe of L) {
473
+ const $ = pe.category ?? He(pe.timestamp, T);
474
+ J.push($);
475
+ }
476
+ return d && J.length > a && J.splice(0, J.length - a), J;
477
+ }));
478
+ }, [d, a, T, g]), F = we.useCallback(() => {
479
+ const L = Date.now();
480
+ L - D.current >= c && (re(), D.current = L), P.current = requestAnimationFrame(F);
481
+ }, [c, re]);
482
+ we.useEffect(() => (X || (P.current = requestAnimationFrame(F)), () => {
483
+ P.current !== null && (cancelAnimationFrame(P.current), P.current = null);
484
+ }), [X, F]);
485
+ const q = we.useCallback(
486
+ (L) => {
487
+ if (X) return;
488
+ const H = "points" in L ? L.points : [L];
489
+ for (const J of H)
490
+ j.has(J.series) && (ne.current.push(J), I?.(J));
491
+ },
492
+ [X, j, I]
493
+ );
494
+ we.useEffect(() => {
495
+ if (!r) return;
496
+ const L = r.subscribe(q);
497
+ let H;
498
+ return r.onStatusChange ? H = r.onStatusChange(he) : he(true), r.fetchHistory && r.fetchHistory(a).then((J) => {
499
+ for (const pe of J)
500
+ ne.current.push(pe);
501
+ re();
502
+ }), () => {
503
+ L(), H?.();
504
+ };
505
+ }, [r, q, a, re]);
506
+ const de = we.useMemo(() => t.map((L) => ({
507
+ name: L.name,
508
+ color: L.color,
509
+ type: L.type,
510
+ data: j.get(L.name) ?? []
511
+ })), [t, j]), xe = we.useMemo(() => {
512
+ const L = [...o];
513
+ for (const H of O)
514
+ L.push({
515
+ type: "line",
516
+ value: H.value,
517
+ color: H.color,
518
+ label: H.label,
519
+ dash: H.style === "dashed" ? "5,5" : H.style === "dotted" ? "2,2" : void 0
520
+ });
521
+ return L;
522
+ }, [o, O]);
523
+ we.useImperativeHandle(
524
+ G,
525
+ () => ({
526
+ pause() {
527
+ K(true);
528
+ },
529
+ resume() {
530
+ K(false);
531
+ },
532
+ isPaused() {
533
+ return X;
534
+ },
535
+ clear() {
536
+ W((L) => {
537
+ const H = new Map(L);
538
+ for (const J of H.keys())
539
+ H.set(J, []);
540
+ return H;
541
+ }), Z([]), ne.current = [];
542
+ },
543
+ addPoint(L) {
544
+ q(L);
545
+ },
546
+ addPoints(L) {
547
+ q({ points: L });
548
+ },
549
+ getData(L) {
550
+ return j.get(L) ?? [];
551
+ },
552
+ getCategories() {
553
+ return U;
554
+ },
555
+ exportData() {
556
+ return { series: de, categories: U };
557
+ },
558
+ getStats(L) {
559
+ const H = j.get(L);
560
+ return H ? Te(H) : null;
561
+ }
562
+ }),
563
+ [X, j, U, de, q]
564
+ );
565
+ const ye = we.useMemo(() => {
566
+ if (!x) return null;
567
+ const L = {};
568
+ for (const [H, J] of j)
569
+ L[H] = Te(J);
570
+ return L;
571
+ }, [x, j]);
572
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: B, style: { position: "relative", ...R }, children: [
573
+ A && /* @__PURE__ */ jsxRuntime.jsxs(
574
+ "div",
575
+ {
576
+ style: {
577
+ position: "absolute",
578
+ top: 8,
579
+ right: 8,
580
+ display: "flex",
581
+ alignItems: "center",
582
+ gap: 4,
583
+ fontSize: 12,
584
+ color: ee ? "#22c55e" : "#ef4444",
585
+ zIndex: 10
586
+ },
587
+ children: [
588
+ /* @__PURE__ */ jsxRuntime.jsx(
589
+ "span",
590
+ {
591
+ style: {
592
+ width: 8,
593
+ height: 8,
594
+ borderRadius: "50%",
595
+ backgroundColor: ee ? "#22c55e" : "#ef4444"
596
+ }
597
+ }
598
+ ),
599
+ ee ? "Live" : "Disconnected"
600
+ ]
601
+ }
602
+ ),
603
+ b && /* @__PURE__ */ jsxRuntime.jsx(
604
+ "div",
605
+ {
606
+ style: {
607
+ position: "absolute",
608
+ top: 8,
609
+ left: 8,
610
+ display: "flex",
611
+ gap: 4,
612
+ zIndex: 10
613
+ },
614
+ children: /* @__PURE__ */ jsxRuntime.jsx(
615
+ "button",
616
+ {
617
+ onClick: () => K((L) => !L),
618
+ style: {
619
+ padding: "4px 8px",
620
+ fontSize: 12,
621
+ border: "1px solid #ddd",
622
+ borderRadius: 4,
623
+ background: X ? "#fef3c7" : "#fff",
624
+ cursor: "pointer"
625
+ },
626
+ title: X ? "Resume" : "Pause",
627
+ children: X ? "▶" : "⏸"
628
+ }
629
+ )
630
+ }
631
+ ),
632
+ x && ye && /* @__PURE__ */ jsxRuntime.jsx(
633
+ "div",
634
+ {
635
+ style: {
636
+ position: "absolute",
637
+ bottom: 50,
638
+ right: 8,
639
+ background: "rgba(255,255,255,0.9)",
640
+ border: "1px solid #ddd",
641
+ borderRadius: 4,
642
+ padding: 8,
643
+ fontSize: 11,
644
+ zIndex: 10
645
+ },
646
+ children: Object.entries(ye).map(
647
+ ([L, H]) => H ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: 4 }, children: [
648
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: L }),
649
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
650
+ "Min: ",
651
+ H.min.toFixed(2),
652
+ " | Max: ",
653
+ H.max.toFixed(2)
654
+ ] }),
655
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
656
+ "Avg: ",
657
+ H.avg.toFixed(2),
658
+ " | Now: ",
659
+ H.current.toFixed(2)
660
+ ] })
661
+ ] }, L) : null
662
+ )
663
+ }
664
+ ),
665
+ /* @__PURE__ */ jsxRuntime.jsx(
666
+ De,
667
+ {
668
+ series: de,
669
+ categories: U,
670
+ width: u,
671
+ height: i,
672
+ title: m,
673
+ showLegend: C,
674
+ showGrid: l,
675
+ yAxisLabel: v,
676
+ xAxisLabel: f,
677
+ stacked: S,
678
+ zoomable: y,
679
+ crosshair: p,
680
+ annotations: xe,
681
+ legendInteractive: s,
682
+ onDataPointClick: h,
683
+ exportable: w
684
+ }
685
+ )
686
+ ] });
687
+ }
688
+ );
689
+ Fe.displayName = "NiceLiveChart";
690
+ const fe = ["#3b82f6", "#ef4444", "#22c55e", "#f59e0b", "#8b5cf6", "#ec4899", "#06b6d4", "#84cc16"], it = ({
691
+ data: t,
692
+ width: a = 400,
693
+ height: d = 400,
694
+ innerRadius: c = 0,
695
+ title: r,
696
+ showLegend: u = true,
697
+ showLabels: i = true,
698
+ className: m,
699
+ style: C
700
+ }) => {
701
+ const l = a / 2, v = (d - (u ? 30 : 0)) / 2 + (r ? 10 : 0), f = Math.min(l, v) - 40, S = t.reduce((o, s) => o + s.value, 0);
702
+ let y = -Math.PI / 2;
703
+ const p = t.map((o, s) => {
704
+ const h = o.value / (S || 1) * Math.PI * 2, w = y;
705
+ y += h;
706
+ const b = y, A = (w + b) / 2, N = l + f * Math.cos(w), I = v + f * Math.sin(w), g = l + f * Math.cos(b), T = v + f * Math.sin(b), x = h > Math.PI ? 1 : 0, O = o.color || fe[s % fe.length];
707
+ let B;
708
+ if (c > 0) {
709
+ const W = l + c * Math.cos(w), U = v + c * Math.sin(w), Z = l + c * Math.cos(b), X = v + c * Math.sin(b);
710
+ B = `M${N},${I} A${f},${f} 0 ${x},1 ${g},${T} L${Z},${X} A${c},${c} 0 ${x},0 ${W},${U} Z`;
711
+ } else
712
+ B = `M${l},${v} L${N},${I} A${f},${f} 0 ${x},1 ${g},${T} Z`;
713
+ const R = l + f * 0.7 * Math.cos(A), G = v + f * 0.7 * Math.sin(A), j = S > 0 ? Math.round(o.value / S * 100) : 0;
714
+ return { ...o, path: B, labelX: R, labelY: G, pct: j, color: O };
715
+ });
716
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-piechart ${m || ""}`, style: C, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: a, height: d, className: "nice-piechart__svg", children: [
717
+ r && /* @__PURE__ */ jsxRuntime.jsx("text", { x: l, y: 20, textAnchor: "middle", className: "nice-chart__title", children: r }),
718
+ p.map((o, s) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
719
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: o.path, fill: o.color, stroke: "var(--bg-primary, #fff)", strokeWidth: 2, children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: `${o.label}: ${o.value} (${o.pct}%)` }) }),
720
+ i && o.pct >= 5 && /* @__PURE__ */ jsxRuntime.jsxs("text", { x: o.labelX, y: o.labelY, textAnchor: "middle", dominantBaseline: "middle", className: "nice-piechart__label", children: [
721
+ o.pct,
722
+ "%"
723
+ ] })
724
+ ] }, s)),
725
+ u && /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(10, ${d - 25})`, children: t.map((o, s) => /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${s * 100}, 0)`, children: [
726
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: 10, height: 10, rx: 2, fill: o.color || fe[s % fe.length] }),
727
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: 14, y: 9, className: "nice-chart__legend-text", children: o.label })
728
+ ] }, s)) })
729
+ ] }) });
730
+ }, lt = ({
731
+ series: t,
732
+ categories: a,
733
+ width: d = 400,
734
+ height: c = 400,
735
+ maxValue: r,
736
+ title: u,
737
+ showLegend: i = true,
738
+ className: m,
739
+ style: C
740
+ }) => {
741
+ const l = d / 2, v = (c - (i ? 30 : 0)) / 2 + (u ? 10 : 0), f = Math.min(l, v) - 40, S = a.length, y = r ?? Math.max(...t.flatMap((h) => h.data), 1), p = Math.PI * 2 / S, o = 5, s = (h, w) => {
742
+ const b = h * p - Math.PI / 2, A = w / y * f;
743
+ return { x: l + A * Math.cos(b), y: v + A * Math.sin(b) };
744
+ };
745
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-polarchart ${m || ""}`, style: C, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: d, height: c, className: "nice-polarchart__svg", children: [
746
+ u && /* @__PURE__ */ jsxRuntime.jsx("text", { x: l, y: 20, textAnchor: "middle", className: "nice-chart__title", children: u }),
747
+ Array.from({ length: o }, (h, w) => {
748
+ const b = f * ((w + 1) / o);
749
+ return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: l, cy: v, r: b, fill: "none", stroke: "var(--border-color, #ddd)", strokeWidth: 0.5 }, w);
750
+ }),
751
+ a.map((h, w) => {
752
+ const b = s(w, y), A = s(w, y * 1.12);
753
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
754
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: l, y1: v, x2: b.x, y2: b.y, stroke: "var(--border-color, #ddd)", strokeWidth: 0.5 }),
755
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: A.x, y: A.y, textAnchor: "middle", dominantBaseline: "middle", className: "nice-chart__axis-label", children: h })
756
+ ] }, w);
757
+ }),
758
+ t.map((h, w) => {
759
+ const b = h.color || fe[w % fe.length], A = h.data.map((N, I) => {
760
+ const g = s(I, N);
761
+ return `${g.x},${g.y}`;
762
+ }).join(" ");
763
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
764
+ /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: A, fill: h.fill !== false ? b : "none", fillOpacity: 0.15, stroke: b, strokeWidth: 2 }),
765
+ h.data.map((N, I) => {
766
+ const g = s(I, N);
767
+ return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: g.x, cy: g.y, r: 3, fill: b, children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: `${h.name} - ${a[I]}: ${N}` }) }, I);
768
+ })
769
+ ] }, h.name);
770
+ }),
771
+ i && /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(10, ${c - 25})`, children: t.map((h, w) => /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${w * 100}, 0)`, children: [
772
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: 10, height: 10, rx: 2, fill: h.color || fe[w % fe.length] }),
773
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: 14, y: 9, className: "nice-chart__legend-text", children: h.name })
774
+ ] }, w)) })
775
+ ] }) });
776
+ }, ht = ({
777
+ value: t,
778
+ min: a = 0,
779
+ max: d = 100,
780
+ width: c = 200,
781
+ height: r = 200,
782
+ startAngle: u = 225,
783
+ endAngle: i = -45,
784
+ color: m = "#3b82f6",
785
+ trackColor: C,
786
+ label: l,
787
+ formatValue: v,
788
+ ranges: f,
789
+ className: S,
790
+ style: y
791
+ }) => {
792
+ const p = c / 2, o = r / 2, s = Math.min(p, o) - 20, h = Math.max(0, Math.min(1, (t - a) / (d - a || 1))), w = (x) => x * Math.PI / 180, b = (u - i + 360) % 360 || 360, A = (x) => ({
793
+ x: p + s * Math.cos(w(x)),
794
+ y: o - s * Math.sin(w(x))
795
+ }), N = (x, O) => {
796
+ const B = A(x), R = A(O), j = (x - O + 360) % 360 > 180 ? 1 : 0;
797
+ return `M${B.x},${B.y} A${s},${s} 0 ${j},1 ${R.x},${R.y}`;
798
+ }, I = u - h * b, g = A(I);
799
+ let T = m;
800
+ if (f) {
801
+ for (const x of f)
802
+ if (t >= x.start && t <= x.end) {
803
+ T = x.color;
804
+ break;
805
+ }
806
+ }
807
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-gauge nice-gauge--circular ${S || ""}`, style: y, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: c, height: r, children: [
808
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: N(u, i), fill: "none", stroke: C || "var(--border-color, #e2e8f0)", strokeWidth: 12, strokeLinecap: "round" }),
809
+ h > 0 && /* @__PURE__ */ jsxRuntime.jsx("path", { d: N(u, I), fill: "none", stroke: T, strokeWidth: 12, strokeLinecap: "round" }),
810
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: p, y1: o, x2: g.x, y2: g.y, stroke: "var(--text-primary, #333)", strokeWidth: 2, strokeLinecap: "round" }),
811
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: p, cy: o, r: 4, fill: "var(--text-primary, #333)" }),
812
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: p, y: o + s * 0.35, textAnchor: "middle", className: "nice-gauge__value", children: v ? v(t) : t }),
813
+ l && /* @__PURE__ */ jsxRuntime.jsx("text", { x: p, y: o + s * 0.55, textAnchor: "middle", className: "nice-gauge__label", children: l })
814
+ ] }) });
815
+ }, dt = ({
816
+ value: t,
817
+ min: a = 0,
818
+ max: d = 100,
819
+ width: c = 300,
820
+ height: r = 60,
821
+ orientation: u = "horizontal",
822
+ color: i = "#3b82f6",
823
+ label: m,
824
+ formatValue: C,
825
+ ranges: l,
826
+ showTicks: v = true,
827
+ tickCount: f = 5,
828
+ className: S,
829
+ style: y
830
+ }) => {
831
+ const p = u === "horizontal", o = p ? c - 40 : r - 40, s = Math.max(0, Math.min(1, (t - a) / (d - a || 1))), h = 10;
832
+ let w = i;
833
+ if (l) {
834
+ for (const A of l)
835
+ if (t >= A.start && t <= A.end) {
836
+ w = A.color;
837
+ break;
838
+ }
839
+ }
840
+ const b = Array.from({ length: f }, (A, N) => a + (d - a) * (N / (f - 1)));
841
+ return p ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-gauge nice-gauge--linear ${S || ""}`, style: y, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: c, height: r, children: [
842
+ m && /* @__PURE__ */ jsxRuntime.jsx("text", { x: c / 2, y: 14, textAnchor: "middle", className: "nice-gauge__label", children: m }),
843
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 20, y: r / 2 - h / 2, width: o, height: h, rx: 5, fill: "var(--border-color, #e2e8f0)" }),
844
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 20, y: r / 2 - h / 2, width: o * s, height: h, rx: 5, fill: w }),
845
+ /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: `${20 + o * s},${r / 2 - h / 2 - 2} ${20 + o * s - 5},${r / 2 - h / 2 - 10} ${20 + o * s + 5},${r / 2 - h / 2 - 10}`, fill: "var(--text-primary, #333)" }),
846
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: 20 + o * s, y: r / 2 - h / 2 - 12, textAnchor: "middle", className: "nice-gauge__value", style: { fontSize: 11 }, children: C ? C(t) : t }),
847
+ v && b.map((A, N) => {
848
+ const I = 20 + (A - a) / (d - a) * o;
849
+ return /* @__PURE__ */ jsxRuntime.jsx("text", { x: I, y: r / 2 + h / 2 + 14, textAnchor: "middle", className: "nice-gauge__tick", children: A }, N);
850
+ })
851
+ ] }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-gauge nice-gauge--linear nice-gauge--vertical ${S || ""}`, style: y, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: c, height: r, children: [
852
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: c / 2 - h / 2, y: 20, width: h, height: o, rx: 5, fill: "var(--border-color, #e2e8f0)" }),
853
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: c / 2 - h / 2, y: 20 + o * (1 - s), width: h, height: o * s, rx: 5, fill: w }),
854
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: c / 2, y: 14, textAnchor: "middle", className: "nice-gauge__value", children: C ? C(t) : t }),
855
+ m && /* @__PURE__ */ jsxRuntime.jsx("text", { x: c / 2, y: r - 4, textAnchor: "middle", className: "nice-gauge__label", children: m })
856
+ ] }) });
857
+ }, ft = ({
858
+ items: t,
859
+ min: a = 0,
860
+ max: d = 100,
861
+ width: c = 300,
862
+ height: r = 300,
863
+ startAngle: u = 225,
864
+ endAngle: i = -45,
865
+ formatValue: m,
866
+ title: C,
867
+ className: l,
868
+ style: v
869
+ }) => {
870
+ const f = c / 2, S = r / 2, y = Math.min(f, S) - 30, p = Math.min(20, y / (t.length + 1)), o = 4, s = (b) => b * Math.PI / 180, h = (u - i + 360) % 360 || 360, w = (b, A, N) => {
871
+ const I = f + b * Math.cos(s(A)), g = S - b * Math.sin(s(A)), T = f + b * Math.cos(s(N)), x = S - b * Math.sin(s(N)), O = (A - N + 360) % 360;
872
+ return `M${I},${g} A${b},${b} 0 ${O > 180 ? 1 : 0},1 ${T},${x}`;
873
+ };
874
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-bargauge ${l || ""}`, style: v, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: c, height: r, children: [
875
+ C && /* @__PURE__ */ jsxRuntime.jsx("text", { x: f, y: 20, textAnchor: "middle", className: "nice-chart__title", children: C }),
876
+ t.map((b, A) => {
877
+ const N = y - A * (p + o), I = Math.max(0, Math.min(1, (b.value - a) / (d - a || 1))), g = u - I * h, T = b.color || fe[A % fe.length];
878
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
879
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: w(N, u, i), fill: "none", stroke: "var(--border-color, #e2e8f0)", strokeWidth: p, strokeLinecap: "round" }),
880
+ I > 0 && /* @__PURE__ */ jsxRuntime.jsx("path", { d: w(N, u, g), fill: "none", stroke: T, strokeWidth: p, strokeLinecap: "round" })
881
+ ] }, A);
882
+ }),
883
+ /* @__PURE__ */ jsxRuntime.jsx("g", { children: t.map((b, A) => /* @__PURE__ */ jsxRuntime.jsxs("text", { x: f, y: S - ((t.length - 1) / 2 - A) * 16, textAnchor: "middle", dominantBaseline: "middle", className: "nice-gauge__value", style: { fontSize: 12 }, children: [
884
+ b.label ? `${b.label}: ` : "",
885
+ m ? m(b.value) : b.value
886
+ ] }, A)) })
887
+ ] }) });
888
+ }, ut = ({
889
+ data: t,
890
+ width: a = 120,
891
+ height: d = 30,
892
+ type: c = "line",
893
+ color: r = "#3b82f6",
894
+ showMinMax: u,
895
+ showLastPoint: i = true,
896
+ className: m,
897
+ style: C
898
+ }) => {
899
+ if (t.length === 0) return null;
900
+ const l = 2, v = Math.min(...t), f = Math.max(...t), S = f - v || 1, y = a - l * 2, p = d - l * 2, o = (N) => l + N / (t.length - 1 || 1) * y, s = (N) => l + p - (N - v) / S * p;
901
+ if (c === "bar") {
902
+ const N = Math.max(1, y / t.length - 1);
903
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: a, height: d, className: `nice-sparkline ${m || ""}`, style: C, children: t.map((I, g) => /* @__PURE__ */ jsxRuntime.jsx("rect", { x: l + g / t.length * y, y: s(I), width: N, height: p - (s(I) - l), fill: r, rx: 1 }, g)) });
904
+ }
905
+ const h = t.map((N, I) => `${o(I)},${s(N)}`).join(" "), w = t.indexOf(v), b = t.indexOf(f), A = t.length - 1;
906
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: a, height: d, className: `nice-sparkline ${m || ""}`, style: C, children: [
907
+ c === "area" && /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: `${o(0)},${l + p} ${h} ${o(A)},${l + p}`, fill: r, opacity: 0.15 }),
908
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: h, fill: "none", stroke: r, strokeWidth: 1.5 }),
909
+ u && /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: o(w), cy: s(v), r: 2, fill: "#ef4444" }),
910
+ u && /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: o(b), cy: s(f), r: 2, fill: "#22c55e" }),
911
+ i && /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: o(A), cy: s(t[A]), r: 2, fill: r })
912
+ ] });
913
+ }, mt = ({
914
+ value: t,
915
+ target: a,
916
+ min: d = 0,
917
+ max: c = 100,
918
+ width: r = 200,
919
+ height: u = 30,
920
+ color: i = "#3b82f6",
921
+ targetColor: m = "#ef4444",
922
+ className: C,
923
+ style: l
924
+ }) => {
925
+ const f = r - 8, S = u - 8, y = Math.max(0, Math.min(1, (t - d) / (c - d || 1))), p = a != null ? Math.max(0, Math.min(1, (a - d) / (c - d || 1))) : null;
926
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: r, height: u, className: `nice-bullet ${C || ""}`, style: l, children: [
927
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 4, y: 4, width: f, height: S, rx: 3, fill: "var(--border-color, #e2e8f0)" }),
928
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: 4, y: 4 + S * 0.2, width: f * y, height: S * 0.6, rx: 2, fill: i }),
929
+ p != null && /* @__PURE__ */ jsxRuntime.jsx("line", { x1: 4 + f * p, y1: 6, x2: 4 + f * p, y2: 4 + S - 2, stroke: m, strokeWidth: 2 })
930
+ ] });
931
+ }, pt = ({
932
+ data: t,
933
+ width: a = 400,
934
+ height: d = 300,
935
+ inverted: c,
936
+ showLabels: r = true,
937
+ showValues: u = true,
938
+ title: i,
939
+ className: m,
940
+ style: C
941
+ }) => {
942
+ const l = { top: i ? 30 : 10, bottom: 10, x: 40 }, v = a - l.x * 2, f = d - l.top - l.bottom, S = c ? [...t].reverse() : t, y = Math.max(...S.map((o) => o.value), 1), p = f / S.length;
943
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-funnel ${m || ""}`, style: C, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: a, height: d, children: [
944
+ i && /* @__PURE__ */ jsxRuntime.jsx("text", { x: a / 2, y: 20, textAnchor: "middle", className: "nice-chart__title", children: i }),
945
+ S.map((o, s) => {
946
+ const h = o.value / y * v, w = s < S.length - 1 ? S[s + 1].value / y * v : h * 0.3, b = l.top + s * p, A = b + p, N = a / 2, I = `${N - h / 2},${b} ${N + h / 2},${b} ${N + w / 2},${A} ${N - w / 2},${A}`, g = o.color || fe[s % fe.length];
947
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
948
+ /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: I, fill: g, stroke: "var(--bg-primary, #fff)", strokeWidth: 1, children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: `${o.label}: ${o.value}` }) }),
949
+ r && /* @__PURE__ */ jsxRuntime.jsx("text", { x: N, y: b + p / 2 - (u ? 4 : 0), textAnchor: "middle", dominantBaseline: "middle", className: "nice-funnel__label", children: o.label }),
950
+ u && /* @__PURE__ */ jsxRuntime.jsx("text", { x: N, y: b + p / 2 + 10, textAnchor: "middle", dominantBaseline: "middle", className: "nice-funnel__value", children: o.value })
951
+ ] }, s);
952
+ })
953
+ ] }) });
954
+ }, Ee = ({
955
+ nodes: t,
956
+ links: a,
957
+ width: d = 600,
958
+ height: c = 400,
959
+ nodeWidth: r = 20,
960
+ nodePadding: u = 10,
961
+ title: i,
962
+ className: m,
963
+ style: C
964
+ }) => {
965
+ const l = { top: i ? 40 : 20, bottom: 20, left: 20, right: 20 }, v = d - l.left - l.right, f = c - l.top - l.bottom, S = new Set(a.map((x) => x.source)), y = new Set(a.map((x) => x.target)), p = t.filter((x) => S.has(x.id) && !y.has(x.id)), o = t.filter((x) => y.has(x.id)), s = t.filter((x) => S.has(x.id) && y.has(x.id)), h = [p, ...s.length ? [s] : [], o].filter((x) => x.length > 0), w = h.length, b = /* @__PURE__ */ new Map();
966
+ t.forEach((x) => {
967
+ const O = a.filter((R) => R.source === x.id).reduce((R, G) => R + G.value, 0), B = a.filter((R) => R.target === x.id).reduce((R, G) => R + G.value, 0);
968
+ b.set(x.id, Math.max(O, B));
969
+ });
970
+ const A = h.map((x) => x.reduce((O, B) => O + (b.get(B.id) || 0), 0) + (x.length - 1) * u), N = Math.max(...A, 1), I = /* @__PURE__ */ new Map();
971
+ h.forEach((x, O) => {
972
+ const B = l.left + O / (w - 1 || 1) * (v - r);
973
+ let R = 0;
974
+ x.forEach((G) => {
975
+ const j = (b.get(G.id) || 0) / N * f;
976
+ I.set(G.id, { x: B, y: l.top + R, h: j }), R += j + u;
977
+ });
978
+ });
979
+ const g = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map();
980
+ return t.forEach((x) => {
981
+ g.set(x.id, 0), T.set(x.id, 0);
982
+ }), /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-sankey ${m || ""}`, style: C, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: d, height: c, children: [
983
+ i && /* @__PURE__ */ jsxRuntime.jsx("text", { x: d / 2, y: 20, textAnchor: "middle", className: "nice-chart__title", children: i }),
984
+ a.map((x, O) => {
985
+ const B = I.get(x.source), R = I.get(x.target);
986
+ if (!B || !R) return null;
987
+ const G = g.get(x.source) || 0, j = T.get(x.target) || 0, W = x.value / N * f;
988
+ g.set(x.source, G + W), T.set(x.target, j + W);
989
+ const U = B.x + r, Z = B.y + G, X = R.x, K = R.y + j, ee = (U + X) / 2, ne = t.find((D) => D.id === x.source)?.color || fe[O % fe.length];
990
+ return /* @__PURE__ */ jsxRuntime.jsx(
991
+ "path",
992
+ {
993
+ d: `M${U},${Z} C${ee},${Z} ${ee},${K} ${X},${K} L${X},${K + W} C${ee},${K + W} ${ee},${Z + W} ${U},${Z + W} Z`,
994
+ fill: ne,
995
+ fillOpacity: 0.3,
996
+ stroke: ne,
997
+ strokeOpacity: 0.5,
998
+ strokeWidth: 0.5,
999
+ children: /* @__PURE__ */ jsxRuntime.jsx("title", { children: `${x.source} → ${x.target}: ${x.value}` })
1000
+ },
1001
+ O
1002
+ );
1003
+ }),
1004
+ t.map((x, O) => {
1005
+ const B = I.get(x.id);
1006
+ if (!B) return null;
1007
+ const R = x.color || fe[O % fe.length];
1008
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
1009
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: B.x, y: B.y, width: r, height: Math.max(B.h, 2), fill: R, rx: 2 }),
1010
+ /* @__PURE__ */ jsxRuntime.jsx(
1011
+ "text",
1012
+ {
1013
+ x: B.x < v / 2 ? B.x + r + 4 : B.x - 4,
1014
+ y: B.y + B.h / 2,
1015
+ textAnchor: B.x < v / 2 ? "start" : "end",
1016
+ dominantBaseline: "middle",
1017
+ className: "nice-chart__legend-text",
1018
+ children: x.label
1019
+ }
1020
+ )
1021
+ ] }, x.id);
1022
+ })
1023
+ ] }) });
1024
+ }, gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1025
+ __proto__: null,
1026
+ NiceSankey: Ee
1027
+ }, Symbol.toStringTag, { value: "Module" })), xt = ({
1028
+ data: t,
1029
+ min: a,
1030
+ max: d,
1031
+ start: c,
1032
+ end: r,
1033
+ onChange: u,
1034
+ width: i = 500,
1035
+ height: m = 100,
1036
+ step: C = 1,
1037
+ formatValue: l,
1038
+ chartColor: v = "#3b82f6",
1039
+ className: f,
1040
+ style: S
1041
+ }) => {
1042
+ const y = { top: 10, bottom: 30, left: 10, right: 10 }, p = i - y.left - y.right, o = m - y.top - y.bottom, s = (I) => y.left + (I - a) / (d - a || 1) * p, h = (I) => {
1043
+ const g = Math.max(0, Math.min(1, (I - y.left) / p)), T = a + g * (d - a);
1044
+ return Math.round(T / C) * C;
1045
+ }, w = (I, g) => {
1046
+ g.preventDefault();
1047
+ const T = g.target.closest("svg");
1048
+ if (!T) return;
1049
+ const x = (B) => {
1050
+ const R = T.getBoundingClientRect(), G = h(B.clientX - R.left);
1051
+ I === "start" ? u(Math.min(G, r), r) : u(c, Math.max(G, c));
1052
+ }, O = () => {
1053
+ document.removeEventListener("pointermove", x), document.removeEventListener("pointerup", O);
1054
+ };
1055
+ document.addEventListener("pointermove", x), document.addEventListener("pointerup", O);
1056
+ }, b = t ? Math.min(...t) : 0, N = (t ? Math.max(...t) : 1) - b || 1;
1057
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-rangeselector ${f || ""}`, style: S, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: i, height: m, children: [
1058
+ t && t.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
1059
+ "polygon",
1060
+ {
1061
+ points: `${y.left},${y.top + o} ${t.map((I, g) => `${y.left + g / (t.length - 1) * p},${y.top + o - (I - b) / N * o}`).join(" ")} ${y.left + p},${y.top + o}`,
1062
+ fill: v,
1063
+ opacity: 0.15
1064
+ }
1065
+ ),
1066
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: s(c), y: y.top, width: s(r) - s(c), height: o, fill: v, opacity: 0.1 }),
1067
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: y.left, y: y.top, width: s(c) - y.left, height: o, fill: "var(--bg-secondary, #f5f5f5)", opacity: 0.6 }),
1068
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: s(r), y: y.top, width: y.left + p - s(r), height: o, fill: "var(--bg-secondary, #f5f5f5)", opacity: 0.6 }),
1069
+ /* @__PURE__ */ jsxRuntime.jsx(
1070
+ "rect",
1071
+ {
1072
+ x: s(c) - 4,
1073
+ y: y.top,
1074
+ width: 8,
1075
+ height: o,
1076
+ fill: v,
1077
+ rx: 2,
1078
+ cursor: "ew-resize",
1079
+ onPointerDown: (I) => w("start", I)
1080
+ }
1081
+ ),
1082
+ /* @__PURE__ */ jsxRuntime.jsx(
1083
+ "rect",
1084
+ {
1085
+ x: s(r) - 4,
1086
+ y: y.top,
1087
+ width: 8,
1088
+ height: o,
1089
+ fill: v,
1090
+ rx: 2,
1091
+ cursor: "ew-resize",
1092
+ onPointerDown: (I) => w("end", I)
1093
+ }
1094
+ ),
1095
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: s(c), y: y.top + o + 18, textAnchor: "middle", className: "nice-chart__axis-label", children: l ? l(c) : c }),
1096
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: s(r), y: y.top + o + 18, textAnchor: "middle", className: "nice-chart__axis-label", children: l ? l(r) : r })
1097
+ ] }) });
1098
+ }, Ye = ({
1099
+ regions: t,
1100
+ width: a = 600,
1101
+ height: d = 400,
1102
+ viewBox: c = "0 0 1000 600",
1103
+ colorRange: r = ["#dbeafe", "#1d4ed8"],
1104
+ maxValue: u,
1105
+ onRegionClick: i,
1106
+ selectedRegionId: m,
1107
+ title: C,
1108
+ showTooltip: l = true,
1109
+ className: v,
1110
+ style: f
1111
+ }) => {
1112
+ const S = u ?? Math.max(...t.map((p) => p.value ?? 0), 1), y = (p) => {
1113
+ const o = (x) => [parseInt(x.slice(1, 3), 16), parseInt(x.slice(3, 5), 16), parseInt(x.slice(5, 7), 16)], [s, h, w] = o(r[0]), [b, A, N] = o(r[1]), I = Math.round(s + (b - s) * p), g = Math.round(h + (A - h) * p), T = Math.round(w + (N - w) * p);
1114
+ return `rgb(${I},${g},${T})`;
1115
+ };
1116
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `nice-vectormap ${v || ""}`, style: f, children: [
1117
+ C && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-vectormap__title", children: C }),
1118
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: a, height: d, viewBox: c, children: t.map((p) => {
1119
+ const o = p.value != null ? Math.max(0, Math.min(1, p.value / S)) : 0, s = p.value != null ? y(o) : "var(--bg-tertiary, #e5e7eb)", h = p.id === m;
1120
+ return /* @__PURE__ */ jsxRuntime.jsx(
1121
+ "path",
1122
+ {
1123
+ d: p.path,
1124
+ fill: s,
1125
+ stroke: h ? "var(--color-primary, #3b82f6)" : "var(--border-color, #d1d5db)",
1126
+ strokeWidth: h ? 2 : 0.5,
1127
+ cursor: i ? "pointer" : void 0,
1128
+ onClick: () => i?.(p),
1129
+ children: l && /* @__PURE__ */ jsxRuntime.jsx("title", { children: `${p.name}${p.value != null ? `: ${p.value}` : ""}` })
1130
+ },
1131
+ p.id
1132
+ );
1133
+ }) })
1134
+ ] });
1135
+ }, yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1136
+ __proto__: null,
1137
+ NiceVectorMap: Ye
1138
+ }, Symbol.toStringTag, { value: "Module" })), Ve = `
1139
+ .nice-forecast-chart {
1140
+ display: flex;
1141
+ flex-direction: column;
1142
+ background: var(--nice-bg-primary, #ffffff);
1143
+ border: 1px solid var(--nice-border-color, #e5e7eb);
1144
+ border-radius: 0.5rem;
1145
+ overflow: hidden;
1146
+ }
1147
+
1148
+ .nice-forecast-chart__header {
1149
+ display: flex;
1150
+ align-items: center;
1151
+ justify-content: space-between;
1152
+ padding: 0.75rem 1rem;
1153
+ border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
1154
+ }
1155
+
1156
+ .nice-forecast-chart__title {
1157
+ font-size: 1rem;
1158
+ font-weight: 600;
1159
+ color: var(--nice-text-primary);
1160
+ margin: 0;
1161
+ }
1162
+
1163
+ .nice-forecast-chart__actions {
1164
+ display: flex;
1165
+ gap: 0.5rem;
1166
+ }
1167
+
1168
+ .nice-forecast-chart__btn {
1169
+ display: inline-flex;
1170
+ align-items: center;
1171
+ justify-content: center;
1172
+ width: 2rem;
1173
+ height: 2rem;
1174
+ font-size: 1rem;
1175
+ border-radius: 0.375rem;
1176
+ cursor: pointer;
1177
+ transition: all 0.15s ease;
1178
+ border: 1px solid var(--nice-border-color, #d1d5db);
1179
+ background: var(--nice-bg-primary, #ffffff);
1180
+ color: var(--nice-text-secondary);
1181
+ }
1182
+
1183
+ .nice-forecast-chart__btn:hover {
1184
+ background: var(--nice-bg-hover, #f3f4f6);
1185
+ color: var(--nice-text-primary);
1186
+ }
1187
+
1188
+ .nice-forecast-chart__btn:disabled {
1189
+ opacity: 0.5;
1190
+ cursor: not-allowed;
1191
+ }
1192
+
1193
+ .nice-forecast-chart__container {
1194
+ position: relative;
1195
+ width: 100%;
1196
+ padding: 1rem;
1197
+ }
1198
+
1199
+ .nice-forecast-chart__svg {
1200
+ width: 100%;
1201
+ overflow: visible;
1202
+ }
1203
+
1204
+ .nice-forecast-chart__grid-line {
1205
+ stroke: var(--nice-border-divider, #f3f4f6);
1206
+ stroke-width: 1;
1207
+ }
1208
+
1209
+ .nice-forecast-chart__axis-line {
1210
+ stroke: var(--nice-border-color, #e5e7eb);
1211
+ stroke-width: 1;
1212
+ }
1213
+
1214
+ .nice-forecast-chart__axis-label {
1215
+ font-size: 0.6875rem;
1216
+ fill: var(--nice-text-secondary);
1217
+ }
1218
+
1219
+ .nice-forecast-chart__axis-title {
1220
+ font-size: 0.75rem;
1221
+ font-weight: 500;
1222
+ fill: var(--nice-text-primary);
1223
+ }
1224
+
1225
+ .nice-forecast-chart__historical-line {
1226
+ fill: none;
1227
+ stroke-width: 2;
1228
+ stroke-linecap: round;
1229
+ stroke-linejoin: round;
1230
+ }
1231
+
1232
+ .nice-forecast-chart__forecast-line {
1233
+ fill: none;
1234
+ stroke-width: 2;
1235
+ stroke-linecap: round;
1236
+ stroke-linejoin: round;
1237
+ stroke-dasharray: 6, 4;
1238
+ }
1239
+
1240
+ .nice-forecast-chart__confidence-band {
1241
+ opacity: 0.2;
1242
+ }
1243
+
1244
+ .nice-forecast-chart__forecast-region {
1245
+ fill: var(--nice-bg-secondary, #f9fafb);
1246
+ opacity: 0.5;
1247
+ }
1248
+
1249
+ .nice-forecast-chart__point {
1250
+ cursor: pointer;
1251
+ transition: r 0.15s ease;
1252
+ }
1253
+
1254
+ .nice-forecast-chart__point:hover {
1255
+ r: 6;
1256
+ }
1257
+
1258
+ .nice-forecast-chart__annotation-line {
1259
+ stroke-dasharray: 4, 2;
1260
+ stroke-width: 1;
1261
+ }
1262
+
1263
+ .nice-forecast-chart__annotation-marker {
1264
+ cursor: pointer;
1265
+ transition: transform 0.15s ease;
1266
+ }
1267
+
1268
+ .nice-forecast-chart__annotation-marker:hover {
1269
+ transform: scale(1.2);
1270
+ }
1271
+
1272
+ .nice-forecast-chart__reference-line {
1273
+ stroke-width: 1;
1274
+ }
1275
+
1276
+ .nice-forecast-chart__reference-label {
1277
+ font-size: 0.625rem;
1278
+ fill: var(--nice-text-secondary);
1279
+ }
1280
+
1281
+ .nice-forecast-chart__cash-runway {
1282
+ pointer-events: none;
1283
+ }
1284
+
1285
+ .nice-forecast-chart__cash-runway-line {
1286
+ stroke: #ef4444;
1287
+ stroke-width: 2;
1288
+ stroke-dasharray: 8, 4;
1289
+ }
1290
+
1291
+ .nice-forecast-chart__cash-runway-label-bg {
1292
+ fill: #ef4444;
1293
+ rx: 4;
1294
+ }
1295
+
1296
+ .nice-forecast-chart__cash-runway-label {
1297
+ font-size: 0.6875rem;
1298
+ font-weight: 600;
1299
+ fill: #ffffff;
1300
+ }
1301
+
1302
+ .nice-forecast-chart__cash-runway-date {
1303
+ font-size: 0.625rem;
1304
+ fill: #ef4444;
1305
+ font-weight: 500;
1306
+ }
1307
+
1308
+ .nice-forecast-chart__tooltip {
1309
+ position: absolute;
1310
+ pointer-events: none;
1311
+ z-index: 100;
1312
+ padding: 0.75rem;
1313
+ background: var(--nice-bg-primary, #ffffff);
1314
+ border: 1px solid var(--nice-border-color, #e5e7eb);
1315
+ border-radius: 0.5rem;
1316
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
1317
+ font-size: 0.8125rem;
1318
+ max-width: 250px;
1319
+ }
1320
+
1321
+ .nice-forecast-chart__tooltip-date {
1322
+ font-weight: 600;
1323
+ color: var(--nice-text-primary);
1324
+ margin-bottom: 0.5rem;
1325
+ padding-bottom: 0.5rem;
1326
+ border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
1327
+ }
1328
+
1329
+ .nice-forecast-chart__tooltip-item {
1330
+ display: flex;
1331
+ align-items: center;
1332
+ gap: 0.5rem;
1333
+ margin-bottom: 0.25rem;
1334
+ }
1335
+
1336
+ .nice-forecast-chart__tooltip-color {
1337
+ width: 10px;
1338
+ height: 10px;
1339
+ border-radius: 2px;
1340
+ flex-shrink: 0;
1341
+ }
1342
+
1343
+ .nice-forecast-chart__tooltip-label {
1344
+ color: var(--nice-text-secondary);
1345
+ flex: 1;
1346
+ }
1347
+
1348
+ .nice-forecast-chart__tooltip-value {
1349
+ font-weight: 600;
1350
+ color: var(--nice-text-primary);
1351
+ font-variant-numeric: tabular-nums;
1352
+ }
1353
+
1354
+ .nice-forecast-chart__tooltip-confidence {
1355
+ font-size: 0.75rem;
1356
+ color: var(--nice-text-tertiary);
1357
+ }
1358
+
1359
+ .nice-forecast-chart__legend {
1360
+ display: flex;
1361
+ flex-wrap: wrap;
1362
+ gap: 1rem;
1363
+ padding: 0.75rem 1rem;
1364
+ border-top: 1px solid var(--nice-border-color, #e5e7eb);
1365
+ }
1366
+
1367
+ .nice-forecast-chart__legend-item {
1368
+ display: flex;
1369
+ align-items: center;
1370
+ gap: 0.375rem;
1371
+ font-size: 0.8125rem;
1372
+ color: var(--nice-text-secondary);
1373
+ cursor: pointer;
1374
+ user-select: none;
1375
+ transition: opacity 0.15s ease;
1376
+ }
1377
+
1378
+ .nice-forecast-chart__legend-item:hover {
1379
+ color: var(--nice-text-primary);
1380
+ }
1381
+
1382
+ .nice-forecast-chart__legend-item--hidden {
1383
+ opacity: 0.4;
1384
+ }
1385
+
1386
+ .nice-forecast-chart__legend-color {
1387
+ width: 16px;
1388
+ height: 3px;
1389
+ border-radius: 1px;
1390
+ }
1391
+
1392
+ .nice-forecast-chart__legend-color--dashed {
1393
+ background: repeating-linear-gradient(
1394
+ 90deg,
1395
+ currentColor,
1396
+ currentColor 4px,
1397
+ transparent 4px,
1398
+ transparent 6px
1399
+ );
1400
+ }
1401
+
1402
+ .nice-forecast-chart__empty {
1403
+ display: flex;
1404
+ align-items: center;
1405
+ justify-content: center;
1406
+ height: 300px;
1407
+ color: var(--nice-text-secondary);
1408
+ }
1409
+
1410
+ /* Dark mode */
1411
+ .dark .nice-forecast-chart {
1412
+ background: var(--nice-bg-primary-dark, #111827);
1413
+ border-color: var(--nice-border-color-dark, #374151);
1414
+ }
1415
+
1416
+ .dark .nice-forecast-chart__tooltip {
1417
+ background: var(--nice-bg-secondary-dark, #1f2937);
1418
+ border-color: var(--nice-border-color-dark, #374151);
1419
+ }
1420
+
1421
+ .dark .nice-forecast-chart__forecast-region {
1422
+ fill: var(--nice-bg-secondary-dark, #1f2937);
1423
+ }
1424
+ `, ze = [
1425
+ "#3b82f6",
1426
+ // blue
1427
+ "#10b981",
1428
+ // green
1429
+ "#f59e0b",
1430
+ // amber
1431
+ "#ef4444",
1432
+ // red
1433
+ "#8b5cf6",
1434
+ // purple
1435
+ "#ec4899",
1436
+ // pink
1437
+ "#06b6d4",
1438
+ // cyan
1439
+ "#f97316"
1440
+ // orange
1441
+ ];
1442
+ function le(t) {
1443
+ return t instanceof Date ? t : new Date(t);
1444
+ }
1445
+ function Ae(t, a = "pl-PL") {
1446
+ return t.toLocaleDateString(a, {
1447
+ year: "numeric",
1448
+ month: "short",
1449
+ day: "numeric"
1450
+ });
1451
+ }
1452
+ function Me(t, a = "pl-PL") {
1453
+ return new Intl.NumberFormat(a, {
1454
+ minimumFractionDigits: 0,
1455
+ maximumFractionDigits: 2
1456
+ }).format(t);
1457
+ }
1458
+ we.forwardRef(
1459
+ function(a, d) {
1460
+ const {
1461
+ scenarios: c,
1462
+ annotations: r = [],
1463
+ referenceLines: u = [],
1464
+ forecastStartDate: i,
1465
+ cashRunway: m,
1466
+ xAxis: C,
1467
+ yAxis: l,
1468
+ confidenceBands: v = [{ level: 95, color: "#3b82f6", opacity: 0.15 }],
1469
+ tooltip: f,
1470
+ legend: S = { enabled: true, position: "bottom", interactive: true },
1471
+ height: y = 350,
1472
+ showForecastRegion: p = true,
1473
+ lineWidth: o = 2,
1474
+ showPoints: s = false,
1475
+ pointRadius: h = 4,
1476
+ enableZoom: w = false,
1477
+ animationDuration: b = 300,
1478
+ responsive: A = true,
1479
+ onPointClick: N,
1480
+ onAnnotationClick: I,
1481
+ onScenarioToggle: g,
1482
+ onViewportChange: T,
1483
+ size: x = "medium",
1484
+ disabled: O = false,
1485
+ labels: B = {},
1486
+ locale: R = "pl-PL",
1487
+ className: G,
1488
+ style: j
1489
+ } = a, [W, U] = we.useState(
1490
+ () => c.map((n, M) => ({
1491
+ ...n,
1492
+ color: n.color ?? ze[M % ze.length],
1493
+ visible: n.visible !== false
1494
+ }))
1495
+ ), [Z, X] = we.useState(null), [K, ee] = we.useState({ x: 0, y: 0 }), he = we.useRef(null), ne = we.useRef(null), D = { top: 20, right: 30, bottom: 40, left: 60 }, [P, re] = we.useState({
1496
+ width: 600,
1497
+ height: typeof y == "number" ? y : 350
1498
+ });
1499
+ we.useEffect(() => {
1500
+ if (!A || !he.current) return;
1501
+ const n = new ResizeObserver((M) => {
1502
+ for (const z of M)
1503
+ re((_) => ({
1504
+ width: z.contentRect.width,
1505
+ height: _.height
1506
+ }));
1507
+ });
1508
+ return n.observe(he.current), () => n.disconnect();
1509
+ }, [A]), we.useEffect(() => {
1510
+ const n = "nice-forecast-chart-styles";
1511
+ if (!document.getElementById(n)) {
1512
+ const M = document.createElement("style");
1513
+ M.id = n, M.textContent = Ve, document.head.appendChild(M);
1514
+ }
1515
+ }, []);
1516
+ const { xScale: F, yScale: q, allDates: de, minY: xe, maxY: ye } = we.useMemo(() => {
1517
+ const M = W.filter((Q) => Q.visible !== false).flatMap((Q) => Q.data);
1518
+ if (M.length === 0)
1519
+ return { xScale: () => 0, yScale: () => 0, allDates: [], minY: 0, maxY: 100 };
1520
+ const z = M.map((Q) => le(Q.date).getTime()), _ = Math.min(...z), V = Math.max(...z), ae = M.flatMap((Q) => [Q.value, Q.forecast, Q.lowerBound, Q.upperBound]).filter((Q) => Q != null), ue = l?.min ?? Math.min(...ae) * 0.95, se = l?.max ?? Math.max(...ae) * 1.05, ge = P.width - D.left - D.right, _e = P.height - D.top - D.bottom, we = (Q) => {
1521
+ const Ce = typeof Q == "number" ? Q : Q.getTime();
1522
+ return D.left + (Ce - _) / (V - _) * ge;
1523
+ }, Se = (Q) => D.top + _e - (Q - ue) / (se - ue) * _e, Oe = [...new Set(z)].sort((Q, Ce) => Q - Ce).map((Q) => new Date(Q));
1524
+ return {
1525
+ xScale: we,
1526
+ yScale: Se,
1527
+ allDates: Oe,
1528
+ minY: ue,
1529
+ maxY: se
1530
+ };
1531
+ }, [W, P, D, l]), L = i ? le(i) : null, H = we.useMemo(() => {
1532
+ if (!m?.enabled) return null;
1533
+ const n = m.threshold ?? 0, M = m.scenarioId ? W.find((_) => _.id === m.scenarioId && _.visible !== false) : W.find((_) => _.visible !== false);
1534
+ if (!M) return null;
1535
+ const z = M.data.sort(
1536
+ (_, V) => le(_.date).getTime() - le(V.date).getTime()
1537
+ );
1538
+ for (let _ = 1; _ < z.length; _++) {
1539
+ const V = z[_ - 1], ae = z[_], ue = V.forecast ?? V.value, se = ae.forecast ?? ae.value;
1540
+ if (ue != null && se != null && ue > n && se <= n) {
1541
+ const ge = (ue - n) / (ue - se), _e = le(V.date).getTime(), we = le(ae.date).getTime(), Se = _e + ge * (we - _e);
1542
+ return new Date(Se);
1543
+ }
1544
+ }
1545
+ return null;
1546
+ }, [m, W]), J = we.useCallback(
1547
+ (n, M) => {
1548
+ const z = n.filter((_) => _[M] != null).map((_) => ({ x: F(le(_.date)), y: q(_[M]) }));
1549
+ return z.length === 0 ? "" : `M ${z.map((_) => `${_.x},${_.y}`).join(" L ")}`;
1550
+ },
1551
+ [F, q]
1552
+ ), pe = we.useCallback(
1553
+ (n) => {
1554
+ const M = n.filter((V) => V.lowerBound != null && V.upperBound != null);
1555
+ if (M.length === 0) return "";
1556
+ const z = M.map((V) => ({
1557
+ x: F(le(V.date)),
1558
+ y: q(V.upperBound)
1559
+ })), _ = M.map((V) => ({ x: F(le(V.date)), y: q(V.lowerBound) })).reverse();
1560
+ return `M ${z.map((V) => `${V.x},${V.y}`).join(" L ")} L ${_.map((V) => `${V.x},${V.y}`).join(" L ")} Z`;
1561
+ },
1562
+ [F, q]
1563
+ ), $ = we.useCallback(
1564
+ (n) => {
1565
+ if (!ne.current || f?.enabled === false) return;
1566
+ const M = ne.current.getBoundingClientRect(), z = n.clientX - M.left;
1567
+ n.clientY - M.top;
1568
+ let _ = null, V = 1 / 0;
1569
+ for (const ae of de) {
1570
+ const ue = F(ae), se = Math.abs(ue - z);
1571
+ se < V && (V = se, _ = ae);
1572
+ }
1573
+ if (_ && V < 50) {
1574
+ const ae = W.filter((se) => se.visible !== false).map((se) => {
1575
+ const ge = se.data.find((_e) => le(_e.date).getTime() === _.getTime());
1576
+ return {
1577
+ scenario: se,
1578
+ value: ge?.value,
1579
+ forecast: ge?.forecast,
1580
+ lowerBound: ge?.lowerBound,
1581
+ upperBound: ge?.upperBound
1582
+ };
1583
+ }), ue = r.filter(
1584
+ (se) => Math.abs(le(se.date).getTime() - _.getTime()) < 864e5
1585
+ );
1586
+ X({ date: _, values: ae, annotations: ue }), ee({ x: n.clientX - M.left + 10, y: n.clientY - M.top - 10 });
1587
+ } else
1588
+ X(null);
1589
+ },
1590
+ [F, de, W, r, f]
1591
+ ), E = we.useCallback(
1592
+ (n) => {
1593
+ if (!S.interactive) return;
1594
+ U((z) => z.map((_) => _.id === n ? { ..._, visible: !_.visible } : _));
1595
+ const M = W.find((z) => z.id === n);
1596
+ M && g?.(n, !M.visible);
1597
+ },
1598
+ [S.interactive, W, g]
1599
+ );
1600
+ we.useImperativeHandle(
1601
+ d,
1602
+ () => ({
1603
+ getScenarios: () => W,
1604
+ updateScenario: (n, M) => {
1605
+ U((z) => z.map((_) => _.id === n ? { ..._, data: M } : _));
1606
+ },
1607
+ toggleScenario: E,
1608
+ setZoomRange: () => {
1609
+ },
1610
+ // Would need pan/zoom implementation
1611
+ resetZoom: () => {
1612
+ },
1613
+ exportImage: (n) => {
1614
+ if (!ne.current) return null;
1615
+ const M = ne.current, _ = new XMLSerializer().serializeToString(M);
1616
+ return `data:image/svg+xml;base64,${btoa(_)}`;
1617
+ },
1618
+ getDataAtDate: (n) => {
1619
+ const M = W.filter((z) => z.visible !== false).map((z) => {
1620
+ const _ = z.data.find((V) => le(V.date).getTime() === n.getTime());
1621
+ return {
1622
+ scenario: z,
1623
+ value: _?.value,
1624
+ forecast: _?.forecast,
1625
+ lowerBound: _?.lowerBound,
1626
+ upperBound: _?.upperBound
1627
+ };
1628
+ });
1629
+ return {
1630
+ date: n,
1631
+ values: M,
1632
+ annotations: r.filter((z) => le(z.date).getTime() === n.getTime())
1633
+ };
1634
+ }
1635
+ }),
1636
+ [W, r, E]
1637
+ ), P.width - D.left - D.right;
1638
+ const Y = P.height - D.top - D.bottom, ce = we.useMemo(() => {
1639
+ const n = l?.tickCount ?? 5, M = [], z = (ye - xe) / (n - 1);
1640
+ for (let _ = 0; _ < n; _++)
1641
+ M.push(xe + z * _);
1642
+ return M;
1643
+ }, [xe, ye, l?.tickCount]), oe = we.useMemo(() => {
1644
+ const n = C?.tickCount ?? 6;
1645
+ if (de.length === 0) return [];
1646
+ const M = Math.max(1, Math.floor(de.length / (n - 1)));
1647
+ return de.filter((z, _) => _ % M === 0 || _ === de.length - 1);
1648
+ }, [de, C?.tickCount]);
1649
+ return W.length === 0 || W.every((n) => n.data.length === 0) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `nice-forecast-chart ${G ?? ""}`, style: j, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-forecast-chart__empty", children: B.noData ?? "No data available" }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `nice-forecast-chart ${G ?? ""}`, style: { ...j, height: y }, children: [
1650
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: he, className: "nice-forecast-chart__container", children: [
1651
+ /* @__PURE__ */ jsxRuntime.jsxs(
1652
+ "svg",
1653
+ {
1654
+ ref: ne,
1655
+ className: "nice-forecast-chart__svg",
1656
+ width: P.width,
1657
+ height: P.height,
1658
+ onMouseMove: $,
1659
+ onMouseLeave: () => X(null),
1660
+ children: [
1661
+ l?.showGrid !== false && ce.map((n) => /* @__PURE__ */ jsxRuntime.jsx(
1662
+ "line",
1663
+ {
1664
+ className: "nice-forecast-chart__grid-line",
1665
+ x1: D.left,
1666
+ x2: P.width - D.right,
1667
+ y1: q(n),
1668
+ y2: q(n)
1669
+ },
1670
+ n
1671
+ )),
1672
+ p && L && /* @__PURE__ */ jsxRuntime.jsx(
1673
+ "rect",
1674
+ {
1675
+ className: "nice-forecast-chart__forecast-region",
1676
+ x: F(L),
1677
+ y: D.top,
1678
+ width: P.width - D.right - F(L),
1679
+ height: Y
1680
+ }
1681
+ ),
1682
+ u.map((n) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
1683
+ /* @__PURE__ */ jsxRuntime.jsx(
1684
+ "line",
1685
+ {
1686
+ className: "nice-forecast-chart__reference-line",
1687
+ x1: D.left,
1688
+ x2: P.width - D.right,
1689
+ y1: q(n.value),
1690
+ y2: q(n.value),
1691
+ stroke: n.color ?? "#9ca3af",
1692
+ strokeDasharray: n.dashArray ?? "4,2"
1693
+ }
1694
+ ),
1695
+ n.label && /* @__PURE__ */ jsxRuntime.jsx(
1696
+ "text",
1697
+ {
1698
+ className: "nice-forecast-chart__reference-label",
1699
+ x: P.width - D.right - 4,
1700
+ y: q(n.value) - 4,
1701
+ textAnchor: "end",
1702
+ children: n.label
1703
+ }
1704
+ )
1705
+ ] }, n.id)),
1706
+ H && m?.enabled && /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "nice-forecast-chart__cash-runway", children: [
1707
+ /* @__PURE__ */ jsxRuntime.jsx(
1708
+ "line",
1709
+ {
1710
+ className: "nice-forecast-chart__cash-runway-line",
1711
+ x1: F(H),
1712
+ x2: F(H),
1713
+ y1: D.top,
1714
+ y2: P.height - D.bottom,
1715
+ stroke: m.color ?? "#ef4444"
1716
+ }
1717
+ ),
1718
+ m.showLabel !== false && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1719
+ /* @__PURE__ */ jsxRuntime.jsx(
1720
+ "rect",
1721
+ {
1722
+ className: "nice-forecast-chart__cash-runway-label-bg",
1723
+ x: F(H) - 60,
1724
+ y: D.top - 2,
1725
+ width: 120,
1726
+ height: m.showDate !== false ? 32 : 20,
1727
+ fill: m.color ?? "#ef4444",
1728
+ rx: 4
1729
+ }
1730
+ ),
1731
+ /* @__PURE__ */ jsxRuntime.jsx(
1732
+ "text",
1733
+ {
1734
+ className: "nice-forecast-chart__cash-runway-label",
1735
+ x: F(H),
1736
+ y: D.top + 12,
1737
+ textAnchor: "middle",
1738
+ fill: "#ffffff",
1739
+ children: m.label ?? B.cashRunsOut ?? "💰 Cash runs out"
1740
+ }
1741
+ ),
1742
+ m.showDate !== false && /* @__PURE__ */ jsxRuntime.jsx(
1743
+ "text",
1744
+ {
1745
+ className: "nice-forecast-chart__cash-runway-label",
1746
+ x: F(H),
1747
+ y: D.top + 26,
1748
+ textAnchor: "middle",
1749
+ fill: "#ffffff",
1750
+ style: { fontSize: "0.625rem", opacity: 0.9 },
1751
+ children: Ae(H, R)
1752
+ }
1753
+ )
1754
+ ] })
1755
+ ] }),
1756
+ W.filter((n) => n.visible !== false && n.showConfidenceBand).map((n) => /* @__PURE__ */ jsxRuntime.jsx(
1757
+ "path",
1758
+ {
1759
+ className: "nice-forecast-chart__confidence-band",
1760
+ d: pe(n.data),
1761
+ fill: n.color
1762
+ },
1763
+ `band-${n.id}`
1764
+ )),
1765
+ W.filter((n) => n.visible !== false).map((n) => {
1766
+ const M = L ? n.data.filter((_) => le(_.date) < L) : n.data.filter((_) => _.value != null), z = L ? n.data.filter((_) => le(_.date) >= L) : n.data.filter((_) => _.forecast != null);
1767
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
1768
+ /* @__PURE__ */ jsxRuntime.jsx(
1769
+ "path",
1770
+ {
1771
+ className: "nice-forecast-chart__historical-line",
1772
+ d: J(M, "value"),
1773
+ stroke: n.color,
1774
+ strokeWidth: o
1775
+ }
1776
+ ),
1777
+ /* @__PURE__ */ jsxRuntime.jsx(
1778
+ "path",
1779
+ {
1780
+ className: "nice-forecast-chart__forecast-line",
1781
+ d: J(z, L ? "value" : "forecast"),
1782
+ stroke: n.color,
1783
+ strokeWidth: o
1784
+ }
1785
+ ),
1786
+ z.length > 0 && n.data.some((_) => _.forecast != null) && /* @__PURE__ */ jsxRuntime.jsx(
1787
+ "path",
1788
+ {
1789
+ className: "nice-forecast-chart__forecast-line",
1790
+ d: J(n.data, "forecast"),
1791
+ stroke: n.color,
1792
+ strokeWidth: o
1793
+ }
1794
+ ),
1795
+ s && n.data.map((_, V) => {
1796
+ const ae = _.value ?? _.forecast;
1797
+ return ae == null ? null : /* @__PURE__ */ jsxRuntime.jsx(
1798
+ "circle",
1799
+ {
1800
+ className: "nice-forecast-chart__point",
1801
+ cx: F(le(_.date)),
1802
+ cy: q(ae),
1803
+ r: h,
1804
+ fill: n.color,
1805
+ onClick: () => N?.(_, n)
1806
+ },
1807
+ V
1808
+ );
1809
+ })
1810
+ ] }, n.id);
1811
+ }),
1812
+ r.map((n) => {
1813
+ const M = F(le(n.date));
1814
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1815
+ "g",
1816
+ {
1817
+ className: "nice-forecast-chart__annotation-marker",
1818
+ onClick: () => I?.(n),
1819
+ children: [
1820
+ n.showLine !== false && /* @__PURE__ */ jsxRuntime.jsx(
1821
+ "line",
1822
+ {
1823
+ className: "nice-forecast-chart__annotation-line",
1824
+ x1: M,
1825
+ x2: M,
1826
+ y1: D.top,
1827
+ y2: P.height - D.bottom,
1828
+ stroke: n.color ?? "#9ca3af"
1829
+ }
1830
+ ),
1831
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: M, cy: D.top + 10, r: 8, fill: n.color ?? "#9ca3af" }),
1832
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: M, y: D.top + 14, textAnchor: "middle", fill: "white", fontSize: "10", children: n.icon ?? "!" })
1833
+ ]
1834
+ },
1835
+ n.id
1836
+ );
1837
+ }),
1838
+ /* @__PURE__ */ jsxRuntime.jsx(
1839
+ "line",
1840
+ {
1841
+ className: "nice-forecast-chart__axis-line",
1842
+ x1: D.left,
1843
+ x2: D.left,
1844
+ y1: D.top,
1845
+ y2: P.height - D.bottom
1846
+ }
1847
+ ),
1848
+ /* @__PURE__ */ jsxRuntime.jsx(
1849
+ "line",
1850
+ {
1851
+ className: "nice-forecast-chart__axis-line",
1852
+ x1: D.left,
1853
+ x2: P.width - D.right,
1854
+ y1: P.height - D.bottom,
1855
+ y2: P.height - D.bottom
1856
+ }
1857
+ ),
1858
+ ce.map((n) => /* @__PURE__ */ jsxRuntime.jsx(
1859
+ "text",
1860
+ {
1861
+ className: "nice-forecast-chart__axis-label",
1862
+ x: D.left - 8,
1863
+ y: q(n) + 4,
1864
+ textAnchor: "end",
1865
+ children: l?.format ? l.format(n) : Me(n, R)
1866
+ },
1867
+ n
1868
+ )),
1869
+ oe.map((n) => /* @__PURE__ */ jsxRuntime.jsx(
1870
+ "text",
1871
+ {
1872
+ className: "nice-forecast-chart__axis-label",
1873
+ x: F(n),
1874
+ y: P.height - D.bottom + 16,
1875
+ textAnchor: "middle",
1876
+ children: C?.format ? C.format(n) : Ae(n, R)
1877
+ },
1878
+ n.getTime()
1879
+ )),
1880
+ l?.title && /* @__PURE__ */ jsxRuntime.jsx(
1881
+ "text",
1882
+ {
1883
+ className: "nice-forecast-chart__axis-title",
1884
+ x: 15,
1885
+ y: P.height / 2,
1886
+ textAnchor: "middle",
1887
+ transform: `rotate(-90, 15, ${P.height / 2})`,
1888
+ children: l.title
1889
+ }
1890
+ )
1891
+ ]
1892
+ }
1893
+ ),
1894
+ Z && /* @__PURE__ */ jsxRuntime.jsxs(
1895
+ "div",
1896
+ {
1897
+ className: "nice-forecast-chart__tooltip",
1898
+ style: { left: K.x, top: K.y },
1899
+ children: [
1900
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-forecast-chart__tooltip-date", children: Ae(Z.date, R) }),
1901
+ Z.values.map((n) => {
1902
+ const M = n.value ?? n.forecast;
1903
+ return M == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-forecast-chart__tooltip-item", children: [
1904
+ /* @__PURE__ */ jsxRuntime.jsx(
1905
+ "span",
1906
+ {
1907
+ className: "nice-forecast-chart__tooltip-color",
1908
+ style: { background: n.scenario.color }
1909
+ }
1910
+ ),
1911
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-forecast-chart__tooltip-label", children: n.scenario.name }),
1912
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-forecast-chart__tooltip-value", children: Me(M, R) })
1913
+ ] }, n.scenario.id);
1914
+ }),
1915
+ Z.values.some((n) => n.lowerBound != null) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-forecast-chart__tooltip-confidence", children: [
1916
+ B.confidence ?? "CI",
1917
+ ":",
1918
+ " ",
1919
+ Me(Z.values[0]?.lowerBound ?? 0, R),
1920
+ " –",
1921
+ " ",
1922
+ Me(Z.values[0]?.upperBound ?? 0, R)
1923
+ ] })
1924
+ ]
1925
+ }
1926
+ )
1927
+ ] }),
1928
+ S.enabled && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-forecast-chart__legend", children: W.map((n) => /* @__PURE__ */ jsxRuntime.jsxs(
1929
+ "div",
1930
+ {
1931
+ className: `nice-forecast-chart__legend-item ${n.visible === false ? "nice-forecast-chart__legend-item--hidden" : ""}`,
1932
+ onClick: () => E(n.id),
1933
+ children: [
1934
+ /* @__PURE__ */ jsxRuntime.jsx(
1935
+ "span",
1936
+ {
1937
+ className: `nice-forecast-chart__legend-color ${n.isBase ? "" : "nice-forecast-chart__legend-color--dashed"}`,
1938
+ style: { background: n.color }
1939
+ }
1940
+ ),
1941
+ n.name
1942
+ ]
1943
+ },
1944
+ n.id
1945
+ )) })
1946
+ ] });
1947
+ }
1948
+ ); const Xe = we.forwardRef(({
1949
+ data: t,
1950
+ renderNode: a,
1951
+ selectable: d,
1952
+ selectedKey: c,
1953
+ onSelect: r,
1954
+ direction: u = "top-down",
1955
+ collapsible: i = true,
1956
+ className: m,
1957
+ style: C,
1958
+ id: l
1959
+ }, v) => {
1960
+ const f = coreCfXsl755.u(l), [S, y] = we.useState(/* @__PURE__ */ new Set()), p = we.useCallback((h) => {
1961
+ y((w) => {
1962
+ const b = new Set(w);
1963
+ return b.has(h) ? b.delete(h) : b.add(h), b;
1964
+ });
1965
+ }, []), o = we.useCallback((h) => {
1966
+ d && r?.(h);
1967
+ }, [d, r]), s = we.useCallback((h) => {
1968
+ const w = S.has(h.key), b = h.children && h.children.length > 0;
1969
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "nice-org-chart__item", children: [
1970
+ /* @__PURE__ */ jsxRuntime.jsxs(
1971
+ "div",
1972
+ {
1973
+ className: `nice-org-chart__node${c === h.key ? " nice-org-chart__node--selected" : ""}`,
1974
+ onClick: () => o(h.key),
1975
+ role: d ? "button" : void 0,
1976
+ children: [
1977
+ a ? a(h) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: h.label }),
1978
+ i && b && /* @__PURE__ */ jsxRuntime.jsx(
1979
+ "button",
1980
+ {
1981
+ type: "button",
1982
+ className: "nice-org-chart__toggle",
1983
+ onClick: (A) => {
1984
+ A.stopPropagation(), p(h.key);
1985
+ },
1986
+ "aria-label": w ? "Expand" : "Collapse",
1987
+ children: w ? "+" : "−"
1988
+ }
1989
+ )
1990
+ ]
1991
+ }
1992
+ ),
1993
+ b && !w && /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "nice-org-chart__children", children: h.children.map((A) => s(A)) })
1994
+ ] }, h.key);
1995
+ }, [S, c, a, d, i, o, p]);
1996
+ return /* @__PURE__ */ jsxRuntime.jsx(
1997
+ "div",
1998
+ {
1999
+ ref: v,
2000
+ id: f,
2001
+ className: `nice-org-chart nice-org-chart--${u} ${m || ""}`,
2002
+ style: C,
2003
+ children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "nice-org-chart__root", children: s(t) })
2004
+ }
2005
+ );
2006
+ });
2007
+ Xe.displayName = "NiceOrganizationChart";
2008
+ function Ze(t, a, d) {
2009
+ const c = (y) => {
2010
+ const p = y.replace("#", "");
2011
+ return [parseInt(p.slice(0, 2), 16), parseInt(p.slice(2, 4), 16), parseInt(p.slice(4, 6), 16)];
2012
+ }, [r, u, i] = c(t), [m, C, l] = c(a), v = Math.round(r + (m - r) * d), f = Math.round(u + (C - u) * d), S = Math.round(i + (l - i) * d);
2013
+ return `rgb(${v},${f},${S})`;
2014
+ }
2015
+ const Ge = we.forwardRef(({
2016
+ data: t,
2017
+ xLabels: a,
2018
+ yLabels: d,
2019
+ colors: c = ["#e0f2fe", "#1d4ed8"],
2020
+ onCellClick: r,
2021
+ cellSize: u = 40,
2022
+ showValues: i = true,
2023
+ className: m,
2024
+ style: C,
2025
+ id: l
2026
+ }, v) => {
2027
+ const f = coreCfXsl755.u(l), { minVal: S, maxVal: y } = we.useMemo(() => {
2028
+ let o = 1 / 0, s = -1 / 0;
2029
+ for (const h of t) for (const w of h)
2030
+ w < o && (o = w), w > s && (s = w);
2031
+ return { minVal: o, maxVal: s };
2032
+ }, [t]), p = we.useCallback((o) => y === S ? 0.5 : (o - S) / (y - S), [S, y]);
2033
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: v, id: f, className: `nice-heatmap ${m || ""}`, style: C, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "nice-heatmap__table", children: [
2034
+ a && /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
2035
+ d && /* @__PURE__ */ jsxRuntime.jsx("th", {}),
2036
+ a.map((o, s) => /* @__PURE__ */ jsxRuntime.jsx("th", { className: "nice-heatmap__header", children: o }, s))
2037
+ ] }) }),
2038
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: t.map((o, s) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
2039
+ d && /* @__PURE__ */ jsxRuntime.jsx("th", { className: "nice-heatmap__row-label", children: d[s] }),
2040
+ o.map((h, w) => /* @__PURE__ */ jsxRuntime.jsx(
2041
+ "td",
2042
+ {
2043
+ className: "nice-heatmap__cell",
2044
+ style: {
2045
+ background: Ze(c[0], c[1], p(h)),
2046
+ width: u,
2047
+ height: u,
2048
+ textAlign: "center",
2049
+ color: p(h) > 0.6 ? "#fff" : "#333",
2050
+ cursor: r ? "pointer" : void 0
2051
+ },
2052
+ onClick: () => r?.(s, w, h),
2053
+ title: String(h),
2054
+ children: i ? h : ""
2055
+ },
2056
+ w
2057
+ ))
2058
+ ] }, s)) })
2059
+ ] }) });
2060
+ });
2061
+ Ge.displayName = "NiceHeatMap";
2062
+ function Ue(t, a) {
2063
+ const d = t.reduce((l, v) => l + v.value, 0);
2064
+ if (d === 0 || t.length === 0) return [];
2065
+ const c = [];
2066
+ let { x: r, y: u, w: i, h: m } = a;
2067
+ const C = [...t].sort((l, v) => v.value - l.value);
2068
+ for (const l of C) {
2069
+ const v = l.value / d;
2070
+ if (i >= m) {
2071
+ const f = i * v;
2072
+ c.push({ x: r, y: u, w: f, h: m, node: l }), r += f, i -= f;
2073
+ } else {
2074
+ const f = m * v;
2075
+ c.push({ x: r, y: u, w: i, h: f, node: l }), u += f, m -= f;
2076
+ }
2077
+ }
2078
+ return c;
2079
+ }
2080
+ const qe = ["#3b82f6", "#10b981", "#f59e0b", "#ef4444", "#8b5cf6", "#06b6d4", "#ec4899", "#84cc16"], Je = we.forwardRef(({
2081
+ data: t,
2082
+ width: a = 600,
2083
+ height: d = 400,
2084
+ onNodeClick: c,
2085
+ colors: r = qe,
2086
+ className: u,
2087
+ style: i,
2088
+ id: m
2089
+ }, C) => {
2090
+ const l = coreCfXsl755.u(m), v = we.useMemo(() => {
2091
+ const f = t.children ?? [t];
2092
+ return Ue(f, { x: 0, y: 0, w: a, h: d });
2093
+ }, [t, a, d]);
2094
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: C, id: l, className: `nice-treemap ${u || ""}`, style: i, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: a, height: d, className: "nice-treemap__svg", children: v.map((f, S) => /* @__PURE__ */ jsxRuntime.jsxs("g", { onClick: () => c?.(f.node), style: { cursor: c ? "pointer" : void 0 }, children: [
2095
+ /* @__PURE__ */ jsxRuntime.jsx(
2096
+ "rect",
2097
+ {
2098
+ x: f.x,
2099
+ y: f.y,
2100
+ width: Math.max(f.w - 1, 0),
2101
+ height: Math.max(f.h - 1, 0),
2102
+ fill: f.node.color ?? r[S % r.length],
2103
+ rx: 2
2104
+ }
2105
+ ),
2106
+ f.w > 40 && f.h > 20 && /* @__PURE__ */ jsxRuntime.jsx(
2107
+ "text",
2108
+ {
2109
+ x: f.x + f.w / 2,
2110
+ y: f.y + f.h / 2,
2111
+ textAnchor: "middle",
2112
+ dominantBaseline: "central",
2113
+ fill: "#fff",
2114
+ fontSize: Math.min(12, f.w / 6),
2115
+ className: "nice-treemap__label",
2116
+ children: f.node.label
2117
+ }
2118
+ )
2119
+ ] }, f.node.key)) }) });
2120
+ });
2121
+ Je.displayName = "NiceTreeMap";
2122
+ const Qe = we.forwardRef(({
2123
+ data: t,
2124
+ type: a = "candlestick",
2125
+ showVolume: d = true,
2126
+ width: c = 800,
2127
+ height: r = 400,
2128
+ bullColor: u = "#22c55e",
2129
+ bearColor: i = "#ef4444",
2130
+ className: m,
2131
+ style: C,
2132
+ id: l
2133
+ }, v) => {
2134
+ const f = coreCfXsl755.u(l), S = { top: 20, right: 20, bottom: d ? 80 : 30, left: 60 }, y = c - S.left - S.right, p = d ? 50 : 0, o = r - S.top - S.bottom - p, { minP: s, maxP: h, maxVol: w } = we.useMemo(() => {
2135
+ let g = 1 / 0, T = -1 / 0, x = 0;
2136
+ for (const O of t)
2137
+ O.low < g && (g = O.low), O.high > T && (T = O.high), O.volume && O.volume > x && (x = O.volume);
2138
+ return { minP: g, maxP: T, maxVol: x };
2139
+ }, [t]), b = Math.max(1, y / t.length * 0.7), A = (g) => S.left + (g + 0.5) * (y / t.length), N = (g) => S.top + o - (g - s) / (h - s || 1) * o, I = (g) => r - S.bottom - p + p * (1 - g / (w || 1));
2140
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: v, id: f, className: `nice-stock-chart ${m || ""}`, style: C, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: c, height: r, className: "nice-stock-chart__svg", children: [
2141
+ [0, 0.25, 0.5, 0.75, 1].map((g) => {
2142
+ const T = s + g * (h - s);
2143
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
2144
+ /* @__PURE__ */ jsxRuntime.jsx(
2145
+ "line",
2146
+ {
2147
+ x1: S.left,
2148
+ x2: c - S.right,
2149
+ y1: N(T),
2150
+ y2: N(T),
2151
+ stroke: "#e5e7eb",
2152
+ strokeDasharray: "2,2"
2153
+ }
2154
+ ),
2155
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: S.left - 4, y: N(T) + 4, textAnchor: "end", fontSize: 10, fill: "#888", children: T.toFixed(2) })
2156
+ ] }, g);
2157
+ }),
2158
+ a === "line" ? /* @__PURE__ */ jsxRuntime.jsx(
2159
+ "polyline",
2160
+ {
2161
+ points: t.map((g, T) => `${A(T)},${N(g.close)}`).join(" "),
2162
+ fill: "none",
2163
+ stroke: u,
2164
+ strokeWidth: 1.5
2165
+ }
2166
+ ) : t.map((g, T) => {
2167
+ const x = g.close >= g.open, O = x ? u : i, B = A(T);
2168
+ if (a === "ohlc")
2169
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
2170
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: B, x2: B, y1: N(g.high), y2: N(g.low), stroke: O, strokeWidth: 1 }),
2171
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: B - b / 2, x2: B, y1: N(g.open), y2: N(g.open), stroke: O, strokeWidth: 1.5 }),
2172
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: B, x2: B + b / 2, y1: N(g.close), y2: N(g.close), stroke: O, strokeWidth: 1.5 })
2173
+ ] }, T);
2174
+ const R = N(Math.max(g.open, g.close)), G = N(Math.min(g.open, g.close));
2175
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
2176
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: B, x2: B, y1: N(g.high), y2: N(g.low), stroke: O, strokeWidth: 1 }),
2177
+ /* @__PURE__ */ jsxRuntime.jsx(
2178
+ "rect",
2179
+ {
2180
+ x: B - b / 2,
2181
+ y: R,
2182
+ width: b,
2183
+ height: Math.max(G - R, 1),
2184
+ fill: x ? "transparent" : O,
2185
+ stroke: O,
2186
+ strokeWidth: 1
2187
+ }
2188
+ )
2189
+ ] }, T);
2190
+ }),
2191
+ d && t.map((g, T) => {
2192
+ if (!g.volume) return null;
2193
+ const x = g.close >= g.open;
2194
+ return /* @__PURE__ */ jsxRuntime.jsx(
2195
+ "rect",
2196
+ {
2197
+ x: A(T) - b / 2,
2198
+ y: I(g.volume),
2199
+ width: b,
2200
+ height: r - S.bottom - I(g.volume),
2201
+ fill: x ? u : i,
2202
+ opacity: 0.3
2203
+ },
2204
+ `v${T}`
2205
+ );
2206
+ }),
2207
+ t.map((g, T) => T % Math.max(1, Math.floor(t.length / 8)) !== 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
2208
+ "text",
2209
+ {
2210
+ x: A(T),
2211
+ y: r - S.bottom + p + 14,
2212
+ textAnchor: "middle",
2213
+ fontSize: 9,
2214
+ fill: "#888",
2215
+ children: g.date
2216
+ },
2217
+ `l${T}`
2218
+ ))
2219
+ ] }) });
2220
+ });
2221
+ Qe.displayName = "NiceStockChart";
2222
+
2223
+ exports.C = fe;
2224
+ exports.N = ft;
2225
+ exports.a = mt;
2226
+ exports.b = De;
2227
+ exports.d = ht;
2228
+ exports.f = pt;
2229
+ exports.g = Ge;
2230
+ exports.h = dt;
2231
+ exports.i = Fe;
2232
+ exports.j = Xe;
2233
+ exports.k = it;
2234
+ exports.l = lt;
2235
+ exports.m = xt;
2236
+ exports.n = Ee;
2237
+ exports.o = ut;
2238
+ exports.p = Qe;
2239
+ exports.q = Je;
2240
+ exports.r = Ye;
2241
+ exports.v = rt;
2242
+ exports.w = gt;
2243
+ exports.x = yt;
2244
+ //# sourceMappingURL=NiceStockChart-Cpmv9_Cc.js.map