@nice2dev/ui 1.2.0 → 1.2.2

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