@nice2dev/ui 1.1.10 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/README.md +12 -20
  3. package/dist/NiceApiExplorer.doc-CFJndg5h.js +25 -0
  4. package/dist/NiceApiExplorer.doc-TEx67kV5.cjs +1 -0
  5. package/dist/NiceBPMNDesigner.doc-6lK1pXRq.js +32 -0
  6. package/dist/NiceBPMNDesigner.doc-BY8t7qOi.cjs +8 -0
  7. package/dist/NiceBackupDiffViewer.doc-CYvOeX19.js +25 -0
  8. package/dist/NiceBackupDiffViewer.doc-ChQaZCg1.cjs +1 -0
  9. package/dist/NiceBackupList.doc-BdQCw0_D.cjs +1 -0
  10. package/dist/NiceBackupList.doc-BwjIAoqz.js +25 -0
  11. package/dist/NiceBackupRestoreDialog.doc-B2iiqTps.cjs +1 -0
  12. package/dist/NiceBackupRestoreDialog.doc-DuXSGJiD.js +25 -0
  13. package/dist/NiceBackupScheduler.doc-BpY45181.js +31 -0
  14. package/dist/NiceBackupScheduler.doc-ByeL3iH1.cjs +7 -0
  15. package/dist/NiceBackupStatusBadge.doc-BA3dYgiW.cjs +1 -0
  16. package/dist/NiceBackupStatusBadge.doc-CxwkVarP.js +25 -0
  17. package/dist/NiceBackupTagEditor.doc-Bej1KHco.cjs +7 -0
  18. package/dist/NiceBackupTagEditor.doc-CNy4uNws.js +31 -0
  19. package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +8 -0
  20. package/dist/NiceBottomSheet.doc-v-UPUKQk.js +32 -0
  21. package/dist/NiceBranchManager.doc-BTyRjX7X.cjs +6 -0
  22. package/dist/NiceBranchManager.doc-Cz4SyEqE.js +30 -0
  23. package/dist/NiceButton-3AcJJ15c.cjs +1 -0
  24. package/dist/NiceButton-5tWvfXKl.cjs +1 -0
  25. package/dist/NiceButton-DHSgQT1_.js +112 -0
  26. package/dist/NiceButton-vkI07DP0.js +88 -0
  27. package/dist/NiceCodeEditor-B8At55f5.js +1179 -0
  28. package/dist/NiceCodeEditor-BJSEzhcY.cjs +260 -0
  29. package/dist/NiceCodeEditor-VGIDWSkS.js +1181 -0
  30. package/dist/NiceCodeEditor-qX39PSnQ.cjs +260 -0
  31. package/dist/NiceColorPicker-CQhhjZ8w.cjs +1 -0
  32. package/dist/NiceColorPicker-Cbop7VMu.js +491 -0
  33. package/dist/NiceColorPicker-DCgmE-3H.cjs +1 -0
  34. package/dist/NiceColorPicker-DK30kJgy.js +486 -0
  35. package/dist/NiceColorPicker-DtPFxDKM.cjs +1 -0
  36. package/dist/NiceColorPicker-bNJBAU_c.js +598 -0
  37. package/dist/NiceConnectorConfigForm.doc-BKrDuhXw.cjs +7 -0
  38. package/dist/NiceConnectorConfigForm.doc-BsHeXz3M.js +31 -0
  39. package/dist/NiceDataBranchGraph.doc-Axidz41W.js +29 -0
  40. package/dist/NiceDataBranchGraph.doc-sjLmrrtE.cjs +5 -0
  41. package/dist/NiceDataBranchManager.doc-B1-Rp2X4.cjs +6 -0
  42. package/dist/NiceDataBranchManager.doc-GUqfTFvW.js +30 -0
  43. package/dist/NiceDataConflictResolver.doc-CjQryrTu.cjs +5 -0
  44. package/dist/NiceDataConflictResolver.doc-L-TcnQMX.js +29 -0
  45. package/dist/NiceDataDiffViewer.doc-BzGrf0U-.cjs +6 -0
  46. package/dist/NiceDataDiffViewer.doc-goxhSldH.js +30 -0
  47. package/dist/NiceDataGrid-BDEIbuBS.js +2218 -0
  48. package/dist/NiceDataGrid-BOCJr6XF.js +2217 -0
  49. package/dist/NiceDataGrid-BV5Oh-gy.cjs +10 -0
  50. package/dist/NiceDataGrid-CS5aB-EN.cjs +10 -0
  51. package/dist/NiceDataGrid-Dd7SI-M6.cjs +10 -0
  52. package/dist/NiceDataGrid-DjZchXYG.js +2217 -0
  53. package/dist/NiceDataMapper.doc-QmnmnvVq.js +30 -0
  54. package/dist/NiceDataMapper.doc-ytGVtYVr.cjs +6 -0
  55. package/dist/NiceDataMergeBuilder.doc-BcmzKxh2.cjs +6 -0
  56. package/dist/NiceDataMergeBuilder.doc-BvYa4aUJ.js +30 -0
  57. package/dist/NiceDataSnapshot.doc-C73K1biG.cjs +6 -0
  58. package/dist/NiceDataSnapshot.doc-hU7wnOzM.js +30 -0
  59. package/dist/NiceDesktopViews.doc-DJjYlyP2.cjs +1 -0
  60. package/dist/NiceDesktopViews.doc-ly-VUAJj.js +25 -0
  61. package/dist/NiceDeviceControlCard.doc-BZIo92-w.cjs +1 -0
  62. package/dist/NiceDeviceControlCard.doc-DIzZcW9L.js +25 -0
  63. package/dist/NiceDocumentViewer-B9VIVKyw.js +726 -0
  64. package/dist/NiceDocumentViewer-CDXAmPp7.cjs +180 -0
  65. package/dist/NiceDocumentationViewer.doc-BSNGa7a_.js +25 -0
  66. package/dist/NiceDocumentationViewer.doc-CrwlvPFg.cjs +1 -0
  67. package/dist/NiceEnergyChart.doc-DW-jllDV.cjs +1 -0
  68. package/dist/NiceEnergyChart.doc-DnEehTff.js +25 -0
  69. package/dist/NiceFeatureGate.doc-DN17uS_B.cjs +3 -0
  70. package/dist/NiceFeatureGate.doc-DNfFSRrh.js +27 -0
  71. package/dist/NiceForm-BCEXovJR.cjs +1 -0
  72. package/dist/NiceForm-BcN4p2kG.cjs +1 -0
  73. package/dist/NiceForm-D7oyWHXg.js +4820 -0
  74. package/dist/NiceForm-DUhxXArr.js +4817 -0
  75. package/dist/NiceForm-tIXS-M6b.js +4770 -0
  76. package/dist/NiceForm-uCeVmTrD.cjs +1 -0
  77. package/dist/NiceFormItem.doc-BJwEnDz2.js +36 -0
  78. package/dist/NiceFormItem.doc-Ck3PgaPD.cjs +12 -0
  79. package/dist/NiceGantt-CTbqCuwv.cjs +1 -0
  80. package/dist/NiceGantt-Dao7pN9z.js +328 -0
  81. package/dist/NiceGantt.doc-B6YZcJvG.cjs +11 -0
  82. package/dist/NiceGantt.doc-DsI1QXly.js +48 -0
  83. package/dist/NiceGitBlame.doc-BQ2KvGkD.js +30 -0
  84. package/dist/NiceGitBlame.doc-DuTSjZVN.cjs +6 -0
  85. package/dist/NiceGitDiffViewer.doc-D24AGos_.js +30 -0
  86. package/dist/NiceGitDiffViewer.doc-D9FVquBC.cjs +6 -0
  87. package/dist/NiceGitGraph.doc-C-8VGMIz.js +29 -0
  88. package/dist/NiceGitGraph.doc-eRvTmefl.cjs +5 -0
  89. package/dist/NiceGitHooks.doc-DCTVw7HX.cjs +5 -0
  90. package/dist/NiceGitHooks.doc-OCFj5w6v.js +29 -0
  91. package/dist/NiceHtmlEditor-BYk1roA4.cjs +10 -0
  92. package/dist/NiceHtmlEditor-C5kLeF9H.cjs +10 -0
  93. package/dist/NiceHtmlEditor-CFVMIC5L.js +848 -0
  94. package/dist/NiceHtmlEditor-DUwcqj5N.cjs +10 -0
  95. package/dist/NiceHtmlEditor-DiAphF1k.js +889 -0
  96. package/dist/NiceHtmlEditor-mWebBmy1.js +849 -0
  97. package/dist/NiceInstanceMonitor.doc-BSDZp5xa.js +31 -0
  98. package/dist/NiceInstanceMonitor.doc-HVbLufnh.cjs +7 -0
  99. package/dist/NiceLocaleManager.doc-CbVHDEWu.js +25 -0
  100. package/dist/NiceLocaleManager.doc-XH6hMW0Z.cjs +1 -0
  101. package/dist/NiceLockButton.doc-BMhSj3TB.cjs +1 -0
  102. package/dist/NiceLockButton.doc-DvHGhcfm.js +25 -0
  103. package/dist/NiceLoginForm-BHyDY7br.cjs +1 -0
  104. package/dist/NiceLoginForm-BuxFY2Rk.js +750 -0
  105. package/dist/NiceLoginForm-DQe77Isv.js +747 -0
  106. package/dist/NiceLoginForm-NBCo-DUZ.cjs +1 -0
  107. package/dist/NiceLoginForm.css +1 -0
  108. package/dist/NiceMAM.doc-CsQ57saR.cjs +8 -0
  109. package/dist/NiceMAM.doc-hjW7buTH.js +32 -0
  110. package/dist/NiceMention--3P3vO-W.cjs +430 -0
  111. package/dist/NiceMention-CA7CL5BI.js +11263 -0
  112. package/dist/NiceMention-CHcKRl-L.cjs +430 -0
  113. package/dist/NiceMention-Co2cqkVM.js +11316 -0
  114. package/dist/NiceMention-DJD0BLcp.js +11269 -0
  115. package/dist/NiceMention-DcaUEMSg.cjs +430 -0
  116. package/dist/NiceMention.css +1 -1
  117. package/dist/NiceModal-C4p8a82e.cjs +1 -0
  118. package/dist/NiceModal-TNlkaL_i.js +85 -0
  119. package/dist/NiceModuleLifecyclePanel-BWbKdVC_.js +7054 -0
  120. package/dist/NiceModuleLifecyclePanel-CZHIzvkE.cjs +1 -0
  121. package/dist/NiceModuleLifecyclePanel-DV3F_QdI.cjs +1 -0
  122. package/dist/NiceModuleLifecyclePanel-OC9YK2kG.js +7052 -0
  123. package/dist/NiceModuleLifecyclePanel-_OcfDmtC.cjs +1 -0
  124. package/dist/NiceModuleLifecyclePanel-gaZkIEtK.js +6825 -0
  125. package/dist/NiceModuleLifecyclePanel.css +1 -1
  126. package/dist/NiceNetworkDiscoveryPanel.doc-B0RtGaS3.js +25 -0
  127. package/dist/NiceNetworkDiscoveryPanel.doc-BFgFZI5G.cjs +1 -0
  128. package/dist/NicePagination-8XsBbMNx.js +165 -0
  129. package/dist/NicePagination-B3nZDZem.js +165 -0
  130. package/dist/NicePagination-B8rg1Y67.cjs +1 -0
  131. package/dist/NicePagination-CkOoXf0f.js +165 -0
  132. package/dist/NicePagination-D7lek1G7.cjs +1 -0
  133. package/dist/NicePagination-OjTEfZJE.cjs +1 -0
  134. package/dist/NicePipelineEditor.doc-CjqDKe2x.js +29 -0
  135. package/dist/NicePipelineEditor.doc-DZ0pTVTp.cjs +5 -0
  136. package/dist/NicePipelineMonitor.doc-C88-TagI.cjs +5 -0
  137. package/dist/NicePipelineMonitor.doc-CFtH4XJx.js +29 -0
  138. package/dist/NicePivotGrid-BJRSciWl.js +1183 -0
  139. package/dist/NicePivotGrid-BaZa2YZW.js +1157 -0
  140. package/dist/NicePivotGrid-CS1dPmNI.cjs +152 -0
  141. package/dist/NicePivotGrid-D2AxqDzJ.js +1183 -0
  142. package/dist/NicePivotGrid-DxQ6Py9D.cjs +152 -0
  143. package/dist/NicePivotGrid-DyOPhPO8.cjs +152 -0
  144. package/dist/NiceRoomGrid.doc-DJPVUQVg.cjs +8 -0
  145. package/dist/NiceRoomGrid.doc-DLHJS_Wb.js +32 -0
  146. package/dist/NiceSavedQueryPanel-B5HhqlAI.cjs +586 -0
  147. package/dist/NiceSavedQueryPanel-BC84uRfh.cjs +586 -0
  148. package/dist/NiceSavedQueryPanel-CMStDOKe.js +5125 -0
  149. package/dist/NiceSavedQueryPanel-CMfcODIO.js +5120 -0
  150. package/dist/NiceSavedQueryPanel-D2i34e_b.cjs +586 -0
  151. package/dist/NiceSavedQueryPanel-mPO2THs7.js +5142 -0
  152. package/dist/NiceSavedQueryPanel.css +1 -1
  153. package/dist/NiceSceneBar.doc-09sc3yuF.cjs +1 -0
  154. package/dist/NiceSceneBar.doc-DLePMuVU.js +25 -0
  155. package/dist/NiceSceneSelector.doc-CPzCAy-d.cjs +7 -0
  156. package/dist/NiceSceneSelector.doc-FCLZvPc0.js +31 -0
  157. package/dist/NiceScheduler-7gP7vcLy.cjs +5 -0
  158. package/dist/NiceScheduler-BAJRzFQN.js +1690 -0
  159. package/dist/NiceScheduler-Cy7F9tgH.js +1693 -0
  160. package/dist/NiceScheduler-DquRUZxD.cjs +5 -0
  161. package/dist/NiceScheduler-dJ7gHDv7.cjs +5 -0
  162. package/dist/NiceScheduler-l8N4yCWd.js +1716 -0
  163. package/dist/NiceSchedulerViews.doc-C9opZpgg.cjs +1 -0
  164. package/dist/NiceSchedulerViews.doc-Dy7ZH1iL.js +25 -0
  165. package/dist/NiceSelect-CZR8Zu_k.js +420 -0
  166. package/dist/NiceSelect-DIKGbaJo.cjs +1 -0
  167. package/dist/NiceSelect-DZB1Rs9x.js +435 -0
  168. package/dist/NiceSelect-tMz9QQUs.cjs +1 -0
  169. package/dist/NiceSensorGaugePanel.doc-BHirbWLn.cjs +8 -0
  170. package/dist/NiceSensorGaugePanel.doc-DjKmooI6.js +32 -0
  171. package/dist/NiceSpotlight.doc-BVZFfDVI.cjs +10 -0
  172. package/dist/NiceSpotlight.doc-JqwkzrEm.js +34 -0
  173. package/dist/NiceStateDesigner.doc-CfnwiwfU.js +29 -0
  174. package/dist/NiceStateDesigner.doc-DV4zEC50.cjs +5 -0
  175. package/dist/NiceStepper.doc-5VjaLM6r.js +31 -0
  176. package/dist/NiceStepper.doc-f8lYpr33.cjs +7 -0
  177. package/dist/NiceStreamDashboard.doc-74KUXya1.cjs +8 -0
  178. package/dist/NiceStreamDashboard.doc-k8PQfCM0.js +32 -0
  179. package/dist/NiceTaskInbox.doc-CHrxthqp.js +32 -0
  180. package/dist/NiceTaskInbox.doc-CdCTfgBq.cjs +8 -0
  181. package/dist/NiceTestBuilder.doc-BoBzLfa0.js +30 -0
  182. package/dist/NiceTestBuilder.doc-Cj1fNTvk.cjs +6 -0
  183. package/dist/NiceTranscoder.doc-Dnirl3wg.cjs +7 -0
  184. package/dist/NiceTranscoder.doc-cInCYZh7.js +31 -0
  185. package/dist/NiceVideoAnnotator.doc-C1iEi7OM.cjs +7 -0
  186. package/dist/NiceVideoAnnotator.doc-C8zyfKH_.js +31 -0
  187. package/dist/NiceVideoEditor.doc-C6mhEb-q.cjs +7 -0
  188. package/dist/NiceVideoEditor.doc-lrwmKjqj.js +31 -0
  189. package/dist/NiceWindow-BEov3s9F.js +2094 -0
  190. package/dist/NiceWindow-CDt6PCEg.cjs +1 -0
  191. package/dist/NiceWindow-CWN8OCHF.js +2109 -0
  192. package/dist/NiceWindow-Dd8qjkIW.cjs +1 -0
  193. package/dist/NiceWindow.css +1 -1
  194. package/dist/charts-Bo2WAI5T.cjs +768 -0
  195. package/dist/charts-ByrdMeQP.js +4767 -0
  196. package/dist/charts-C047IMVn.cjs +768 -0
  197. package/dist/charts-CCXSb3xk.js +4752 -0
  198. package/dist/charts-CqETcUhH.js +4752 -0
  199. package/dist/charts-DouiiHOT.cjs +768 -0
  200. package/dist/charts.cjs +1 -1
  201. package/dist/charts.css +1 -1
  202. package/dist/charts.d.ts +28 -18
  203. package/dist/charts.mjs +1 -1
  204. package/dist/core-B8eBUE4m.js +438 -0
  205. package/dist/core-BL-KmGYC.js +795 -0
  206. package/dist/core-Chg-oYCr.cjs +1 -0
  207. package/dist/core-CxBnKAhs.cjs +1 -0
  208. package/dist/core-D_LRh59n.js +795 -0
  209. package/dist/core-lBFqvT0V.cjs +1 -0
  210. package/dist/core-lazy-Bh2yg4Et.js +351 -0
  211. package/dist/core-lazy-CkWKjfc6.cjs +1 -0
  212. package/dist/data-branching-Dak1_ZKR.cjs +1 -0
  213. package/dist/data-branching-DiLAO4Qt.js +6386 -0
  214. package/dist/data-branching-Km4lc8P_.cjs +1 -0
  215. package/dist/data-branching-YQtJJEtn.js +6273 -0
  216. package/dist/data-branching.cjs +1 -1
  217. package/dist/data-branching.mjs +1 -1
  218. package/dist/data.cjs +1 -1
  219. package/dist/data.d.ts +22 -69
  220. package/dist/data.mjs +3 -3
  221. package/dist/devops-D5yIDM3e.js +8312 -0
  222. package/dist/devops-DkVluHBp.cjs +17 -0
  223. package/dist/devops-rVpB0ZAX.cjs +17 -0
  224. package/dist/devops-zsMUueTd.js +8648 -0
  225. package/dist/devops.cjs +1 -1
  226. package/dist/devops.d.ts +3 -3
  227. package/dist/devops.mjs +1 -1
  228. package/dist/editors.cjs +1 -1
  229. package/dist/editors.d.ts +106 -63
  230. package/dist/editors.mjs +55 -54
  231. package/dist/feedback.cjs +1 -1
  232. package/dist/feedback.d.ts +76 -2
  233. package/dist/feedback.mjs +10 -9
  234. package/dist/index.cjs +261 -261
  235. package/dist/index.css +1 -1
  236. package/dist/index.d.ts +831 -433
  237. package/dist/index.mjs +27339 -26540
  238. package/dist/injectStyleOnce-BzC_BCs_.js +9 -0
  239. package/dist/injectStyleOnce-DeWaxcdf.cjs +1 -0
  240. package/dist/lazy.cjs +1 -1
  241. package/dist/lazy.d.ts +9 -7
  242. package/dist/lazy.mjs +55 -55
  243. package/dist/navigation.cjs +1 -1
  244. package/dist/navigation.css +1 -0
  245. package/dist/navigation.d.ts +99 -43
  246. package/dist/navigation.mjs +504 -547
  247. package/dist/no-code-6WyYb3hL.cjs +331 -0
  248. package/dist/no-code-BH5oVFC6.js +8186 -0
  249. package/dist/no-code-CnHG5_Vn.js +8186 -0
  250. package/dist/no-code-DMKlg1Zl.cjs +331 -0
  251. package/dist/no-code-DiTEnuRv.js +8288 -0
  252. package/dist/no-code-wG9c0z_T.cjs +331 -0
  253. package/dist/no-code.cjs +1 -1
  254. package/dist/no-code.css +1 -1
  255. package/dist/no-code.d.ts +25 -18
  256. package/dist/no-code.mjs +3 -3
  257. package/dist/overlays.cjs +1 -1
  258. package/dist/overlays.d.ts +36 -30
  259. package/dist/overlays.mjs +24 -490
  260. package/dist/pickerCommons-0vyK1Knv.js +547 -0
  261. package/dist/pickerCommons-BCRiHDE_.cjs +1 -0
  262. package/dist/pickerCommons-BFbItm8o.cjs +1 -0
  263. package/dist/pickerCommons-BHirHJyn.js +548 -0
  264. package/dist/pickerCommons-Bt8JIaTN.cjs +1 -0
  265. package/dist/pickerCommons-DkumQ3KE.js +548 -0
  266. package/dist/pickerCommons.css +1 -1
  267. package/dist/style.css +15 -9
  268. package/package.json +4 -6
  269. package/css/legacy-bg-text-aliases.css +0 -87
@@ -0,0 +1,768 @@
1
+ "use strict";const e=require("react/jsx-runtime"),he=require("@nice2dev/ui-core"),a=require("react"),Pe=require("@nice2dev/i18n"),Be=[],Me=["var(--nice-color-primary, #3b82f6)","var(--nice-color-error, #ef4444)","var(--nice-color-success, #22c55e)","var(--nice-color-warning, #f59e0b)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-color-info, #06b6d4)","var(--nice-success, #84cc16)"],ke=({series:t=Be,categories:s,width:m=600,height:r=400,title:i,showLegend:b=!0,showGrid:M=!0,axisLabels:C=!0,yAxisLabel:T,xAxisLabel:k,stacked:p,animated:N,zoomable:E,crosshair:I,annotations:w,legendInteractive:l,onDataPointClick:o,exportable:f,className:z,style:v})=>{const{t:S}=he.useNiceTranslation(),$=a.useRef(null),[L,c]=a.useState(new Set),[R,h]=a.useState(null),[_,y]=a.useState(null),[B,Y]=a.useState(!1),U=a.useRef(null),Z=a.useMemo(()=>t.filter(d=>!L.has(d.name)),[t,L]),O=a.useCallback(d=>{l&&c(K=>{const te=new Set(K);return te.has(d)?te.delete(d):te.add(d),te})},[l]),F={top:i?40:20,right:20,bottom:k?60:40,left:T?60:50},H=m-F.left-F.right,q=r-F.top-F.bottom,u=Z[0]?.data.length??t[0]?.data.length??0,re=_?.start??0,ce=_?.end??u,ee=ce-re,V=a.useMemo(()=>Z.map(d=>({...d,data:d.data.slice(re,ce)})),[Z,re,ce]),se=a.useMemo(()=>s?.slice(re,ce),[s,re,ce]),{minY:P,maxY:x,yTicks:j}=a.useMemo(()=>{let d;if(p){d=[];for(let G=0;G<ee;G++)d.push(V.reduce((oe,le)=>oe+(le.data[G]||0),0))}else d=V.flatMap(G=>G.data);d.length===0&&(d=[0]);const K=Math.min(0,...d),te=Math.max(0,...d),ne=te-K||1,n=Math.pow(10,Math.floor(Math.log10(ne)))||1,D=Math.floor(K/n)*n;let W=Math.ceil(te/n)*n;const g=[];for(let G=D;G<=W;G+=n)g.push(Math.round(G*1e6)/1e6);return g.length<2&&(W=D+n,g.push(Math.round(W*1e6)/1e6)),{minY:D,maxY:W,yTicks:g}},[V,ee,p]),A=d=>q-(d-P)/(x-P||1)*q,Q=d=>(d+.5)/ee*H,ae=ee>0?H/ee/(p?1.5:Math.max(Z.length,1)*1.5):20,X=a.useCallback(d=>{if(!E)return;d.preventDefault();const K=_??{start:0,end:u},te=K.end-K.start,ne=(K.start+K.end)/2,n=d.deltaY>0?1.2:.8,D=Math.max(2,Math.min(u,Math.round(te*n))),W=Math.max(0,Math.round(ne-D/2)),g=Math.min(u,W+D);y({start:W,end:g})},[E,_,u]),ie=a.useCallback(d=>{E&&(Y(!0),U.current={x:d.clientX,range:_??{start:0,end:u}})},[E,_,u]),ue=a.useCallback(d=>{const K=$.current?.getBoundingClientRect();if(K&&h({x:d.clientX-K.left-F.left,y:d.clientY-K.top-F.top}),B&&U.current&&E){const te=d.clientX-U.current.x,ne=H/ee,n=-Math.round(te/ne),D=U.current.range,W=D.end-D.start;let g=D.start+n;g<0&&(g=0),g+W>u&&(g=u-W),y({start:g,end:g+W})}},[B,E,H,ee,u,F.left,F.top]),ge=a.useCallback(()=>{Y(!1),U.current=null},[]),xe=a.useCallback(()=>{h(null),Y(!1),U.current=null},[]),ve=a.useCallback(()=>{const d=$.current;if(!d)return;const K=new XMLSerializer().serializeToString(d),te=document.createElement("canvas");te.width=m,te.height=r+(b?30:0);const ne=te.getContext("2d");if(!ne)return;const n=new Image;n.onload=()=>{ne.fillStyle=he.resolveCssColor("var(--nice-bg-primary, #fff)",ne.canvas),ne.fillRect(0,0,te.width,te.height),ne.drawImage(n,0,0);const D=document.createElement("a");D.download="chart.png",D.href=te.toDataURL("image/png"),D.click()},n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(K)},[m,r,b]),be=r+(b?30:0),_e=V.length>0&&V.every(d=>d.type==="radar"),J=a.useMemo(()=>{if(!_e)return 1;const d=V.flatMap(K=>K.data);return Math.max(1,...d)},[_e,V]);if(_e){const d=m/2,K=(r-F.top-F.bottom)/2+F.top,te=Math.min(H,r-F.top-F.bottom)/2-10,ne=se?.length??V[0]?.data.length??0,n=g=>g/ne*Math.PI*2-Math.PI/2,D=(g,G)=>{const oe=G/J*te;return[d+Math.cos(n(g))*oe,K+Math.sin(n(g))*oe]},W=4;return e.jsx("div",{className:`nice-chart nice-chart--radar ${z||""}`,style:v,children:e.jsxs("svg",{ref:$,viewBox:`0 0 ${m} ${be}`,preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%",className:"nice-chart__svg",style:{display:"block",maxWidth:"100%",maxHeight:"100%"},children:[i&&e.jsx("text",{x:m/2,y:20,textAnchor:"middle",className:"nice-chart__title",children:i}),M&&Array.from({length:W},(g,G)=>{const oe=(G+1)/W*te,le=[];for(let de=0;de<ne;de++)le.push(`${d+Math.cos(n(de))*oe},${K+Math.sin(n(de))*oe}`);return e.jsx("polygon",{points:le.join(" "),fill:"none",className:"nice-chart__grid-line"},G)}),Array.from({length:ne},(g,G)=>{const[oe,le]=D(G,J);return e.jsx("line",{x1:d,y1:K,x2:oe,y2:le,className:"nice-chart__grid-line"},G)}),C&&se?.map((g,G)=>{const[oe,le]=D(G,J*1.12);return e.jsx("text",{x:oe,y:le,textAnchor:"middle",dominantBaseline:"middle",className:"nice-chart__axis-label",children:g},G)}),V.map((g,G)=>{const oe=g.color||Me[G%Me.length],le=g.data.map((de,ye)=>D(ye,de).join(",")).join(" ");return e.jsxs("g",{className:N?"nice-chart__series nice-chart__series--radar nice-chart__series--anim":"nice-chart__series nice-chart__series--radar",children:[e.jsx("polygon",{points:le,fill:oe,fillOpacity:.2,stroke:oe,strokeWidth:2}),g.data.map((de,ye)=>{const[je,Ne]=D(ye,de);return e.jsx("circle",{cx:je,cy:Ne,r:3,fill:oe,children:e.jsx("title",{children:`${g.name}: ${de}`})},ye)})]},g.name)}),b&&e.jsx("g",{transform:`translate(${F.left}, ${r})`,children:t.map((g,G)=>{const oe=G*120,le=L.has(g.name);return e.jsxs("g",{transform:`translate(${oe}, 10)`,style:l?{cursor:"pointer"}:void 0,onClick:()=>O(g.name),opacity:le?.35:1,children:[e.jsx("rect",{width:12,height:12,rx:2,fill:g.color||Me[G%Me.length]}),e.jsx("text",{x:16,y:10,className:"nice-chart__legend-text",children:g.name})]},g.name)})})]})})}return e.jsxs("div",{className:`nice-chart ${z||""}`,style:v,children:[f&&e.jsx("button",{type:"button",className:"nice-chart__export-btn",onClick:ve,title:S("chart.exportPng","Export PNG"),"aria-label":S("chart.exportPng","Export PNG"),children:e.jsx(he.NiceIcon,{name:"camera",size:16})}),e.jsxs("svg",{ref:$,viewBox:`0 0 ${m} ${be}`,preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%",style:{display:"block",maxWidth:"100%",maxHeight:"100%"},className:"nice-chart__svg",onWheel:X,onMouseDown:ie,onMouseMove:ue,onMouseUp:ge,onMouseLeave:xe,children:[e.jsxs("g",{transform:`translate(${F.left},${F.top})`,children:[i&&e.jsx("text",{x:H/2,y:-10,textAnchor:"middle",className:"nice-chart__title",children:i}),M&&j.map(d=>e.jsx("line",{x1:0,y1:A(d),x2:H,y2:A(d),className:"nice-chart__grid-line"},`grid-${d}`)),C&&j.map(d=>e.jsx("text",{x:-8,y:A(d)+4,textAnchor:"end",className:"nice-chart__axis-label",children:d},`ylabel-${d}`)),C&&se&&se.map((d,K)=>e.jsx("text",{x:Q(K),y:q+20,textAnchor:"middle",className:"nice-chart__axis-label",children:d},K)),T&&e.jsx("text",{x:-F.left+14,y:q/2,textAnchor:"middle",transform:`rotate(-90, -${F.left-14}, ${q/2})`,className:"nice-chart__axis-title",children:T}),k&&e.jsx("text",{x:H/2,y:q+45,textAnchor:"middle",className:"nice-chart__axis-title",children:k}),e.jsx("line",{x1:0,y1:0,x2:0,y2:q,className:"nice-chart__axis"}),e.jsx("line",{x1:0,y1:q,x2:H,y2:q,className:"nice-chart__axis"}),w?.map((d,K)=>{if(d.type==="line"){const te=A(d.value);return e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:te,x2:H,y2:te,stroke:d.color||"var(--nice-color-error, #ef4444)",strokeWidth:1.5,strokeDasharray:d.dash||"6,3"}),d.label&&e.jsx("text",{x:H+4,y:te+4,className:"nice-chart__annotation-label",fill:d.color||"var(--nice-color-error, #ef4444)",children:d.label})]},K)}return e.jsx("text",{x:Q(d.value),y:-4,textAnchor:"middle",className:"nice-chart__annotation-label",fill:d.color||"var(--nice-text-muted, #6b7280)",children:d.label},K)}),I&&R&&R.x>=0&&R.x<=H&&R.y>=0&&R.y<=q&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:R.x,y1:0,x2:R.x,y2:q,stroke:"var(--nice-text-muted, #9ca3af)",strokeWidth:1,strokeDasharray:"4,2"}),e.jsx("line",{x1:0,y1:R.y,x2:H,y2:R.y,stroke:"var(--nice-text-muted, #9ca3af)",strokeWidth:1,strokeDasharray:"4,2"})]}),V.map((d,K)=>{const te=d.color||Me[K%Me.length],ne=d.type||"bar";if(ne==="bar")return e.jsx("g",{className:N?"nice-chart__series nice-chart__series--bar nice-chart__series--anim":"nice-chart__series nice-chart__series--bar",children:d.data.map((D,W)=>{let g,G;if(p){const le=V.slice(0,K).reduce((de,ye)=>de+(ye.data[W]||0),0);g=A(le+D),G=A(le)-g}else g=A(Math.max(0,D)),G=Math.abs(A(D)-A(0));const oe=p?Q(W)-ae/2:Q(W)-V.length*ae/2+K*ae;return e.jsx("rect",{x:oe,y:g,width:ae*.9,height:Math.max(0,G),fill:te,rx:2,style:{transformOrigin:`${oe+ae*.9/2}px ${A(0)}px`,...o?{cursor:"pointer"}:{}},onClick:o?()=>o(d.name,re+W,D):void 0,children:e.jsx("title",{children:`${d.name}: ${D}`})},W)})},d.name);if(ne==="scatter")return e.jsx("g",{className:N?"nice-chart__series nice-chart__series--scatter nice-chart__series--anim":"nice-chart__series nice-chart__series--scatter",children:d.data.map((D,W)=>e.jsx("circle",{cx:Q(W),cy:A(D),r:5,fill:te,fillOpacity:.7,stroke:te,strokeWidth:1.5,style:o?{cursor:"pointer"}:void 0,onClick:o?()=>o(d.name,re+W,D):void 0,children:e.jsx("title",{children:`${d.name}: ${D}`})},W))},d.name);const n=d.data.map((D,W)=>`${Q(W)},${A(D)}`);return e.jsxs("g",{className:N?`nice-chart__series nice-chart__series--${ne} nice-chart__series--anim`:`nice-chart__series nice-chart__series--${ne}`,children:[ne==="area"&&ee>0&&e.jsx("polygon",{points:`${Q(0)},${A(0)} ${n.join(" ")} ${Q(ee-1)},${A(0)}`,fill:te,opacity:.15}),e.jsx("polyline",{points:n.join(" "),fill:"none",stroke:te,strokeWidth:2,className:N?"nice-chart__line":void 0}),d.data.map((D,W)=>e.jsx("circle",{cx:Q(W),cy:A(D),r:3,fill:te,style:o?{cursor:"pointer"}:void 0,onClick:o?()=>o(d.name,re+W,D):void 0,children:e.jsx("title",{children:`${d.name}: ${D}`})},W))]},d.name)})]}),b&&e.jsx("g",{transform:`translate(${F.left}, ${r})`,children:t.map((d,K)=>{const te=K*120,ne=L.has(d.name);return e.jsxs("g",{transform:`translate(${te}, 10)`,style:l?{cursor:"pointer"}:void 0,onClick:()=>O(d.name),opacity:ne?.35:1,children:[e.jsx("rect",{width:12,height:12,rx:2,fill:d.color||Me[K%Me.length]}),e.jsx("text",{x:16,y:10,className:"nice-chart__legend-text",style:ne?{textDecoration:"line-through"}:void 0,children:d.name})]},d.name)})})]})]})},Oe=Object.freeze(Object.defineProperty({__proto__:null,NiceChart:ke},Symbol.toStringTag,{value:"Module"})),We=({value:t,min:s=0,max:m=100,width:r=200,height:i=200,startAngle:b=225,endAngle:M=-45,color:C="var(--nice-color-primary, #3b82f6)",trackColor:T,label:k,formatValue:p,ranges:N,className:E,style:I})=>{const w=r/2,l=i/2,o=Math.min(w,l)-20,f=Math.max(0,Math.min(1,(t-s)/(m-s||1))),z=h=>h*Math.PI/180,v=(b-M+360)%360||360,S=h=>({x:w+o*Math.cos(z(h)),y:l-o*Math.sin(z(h))}),$=(h,_)=>{const y=S(h),B=S(_),U=(h-_+360)%360>180?1:0;return`M${y.x},${y.y} A${o},${o} 0 ${U},1 ${B.x},${B.y}`},L=b-f*v,c=S(L);let R=C;if(N){for(const h of N)if(t>=h.start&&t<=h.end){R=h.color;break}}return e.jsx("div",{className:`nice-gauge nice-gauge--circular ${E||""}`,style:I,children:e.jsxs("svg",{width:r,height:i,children:[e.jsx("path",{d:$(b,M),fill:"none",stroke:T||"var(--nice-border-color, #e2e8f0)",strokeWidth:12,strokeLinecap:"round"}),f>0&&e.jsx("path",{d:$(b,L),fill:"none",stroke:R,strokeWidth:12,strokeLinecap:"round"}),e.jsx("line",{x1:w,y1:l,x2:c.x,y2:c.y,stroke:"var(--nice-text-primary, #333)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("circle",{cx:w,cy:l,r:4,fill:"var(--nice-text-primary, #333)"}),e.jsx("text",{x:w,y:l+o*.6,textAnchor:"middle",className:"nice-gauge__value",children:p?p(t):t}),k&&e.jsx("text",{x:w,y:l+o*.95,textAnchor:"middle",className:"nice-gauge__label",children:k})]})})},Ye=({value:t,min:s=0,max:m=100,width:r=300,height:i=60,orientation:b="horizontal",color:M="var(--nice-color-primary, #3b82f6)",label:C,formatValue:T,ranges:k,showTicks:p=!0,tickCount:N=5,className:E,style:I})=>{const w=b==="horizontal",l=w?r-40:i-40,o=Math.max(0,Math.min(1,(t-s)/(m-s||1))),f=10;let z=M;if(k){for(const S of k)if(t>=S.start&&t<=S.end){z=S.color;break}}const v=Array.from({length:N},(S,$)=>s+(m-s)*($/(N-1)));return w?e.jsx("div",{className:`nice-gauge nice-gauge--linear ${E||""}`,style:I,children:e.jsxs("svg",{width:r,height:i,children:[e.jsx("text",{x:20+l*o,y:14,textAnchor:"middle",className:"nice-gauge__value",style:{fontSize:12},children:T?T(t):t}),e.jsx("rect",{x:20,y:i/2-f/2,width:l,height:f,rx:5,fill:"var(--nice-border-color, #e2e8f0)"}),e.jsx("rect",{x:20,y:i/2-f/2,width:l*o,height:f,rx:5,fill:z}),e.jsx("polygon",{points:`${20+l*o},${i/2-f/2-2} ${20+l*o-5},${i/2-f/2-8} ${20+l*o+5},${i/2-f/2-8}`,fill:"var(--nice-text-primary, #333)"}),p&&v.map((S,$)=>{const L=20+(S-s)/(m-s)*l;return e.jsx("text",{x:L,y:i/2+f/2+12,textAnchor:"middle",className:"nice-gauge__tick",children:S},$)}),C&&e.jsx("text",{x:r/2,y:i-2,textAnchor:"middle",className:"nice-gauge__label",children:C})]})}):e.jsx("div",{className:`nice-gauge nice-gauge--linear nice-gauge--vertical ${E||""}`,style:I,children:e.jsxs("svg",{width:r,height:i,children:[e.jsx("rect",{x:r/2-f/2,y:20,width:f,height:l,rx:5,fill:"var(--nice-border-color, #e2e8f0)"}),e.jsx("rect",{x:r/2-f/2,y:20+l*(1-o),width:f,height:l*o,rx:5,fill:z}),e.jsx("text",{x:r/2,y:14,textAnchor:"middle",className:"nice-gauge__value",children:T?T(t):t}),C&&e.jsx("text",{x:r/2,y:i-4,textAnchor:"middle",className:"nice-gauge__label",children:C})]})})},pe=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#06b6d4","#84cc16"],Fe=[],He=({items:t=Fe,min:s=0,max:m=100,width:r=300,height:i=300,startAngle:b=225,endAngle:M=-45,formatValue:C,title:T,className:k,style:p})=>{const N=r/2,E=i/2,I=Math.min(N,E)-30,w=Math.min(20,I/(t.length+1)),l=4,o=v=>v*Math.PI/180,f=(b-M+360)%360||360,z=(v,S,$)=>{const L=N+v*Math.cos(o(S)),c=E-v*Math.sin(o(S)),R=N+v*Math.cos(o($)),h=E-v*Math.sin(o($)),_=(S-$+360)%360;return`M${L},${c} A${v},${v} 0 ${_>180?1:0},1 ${R},${h}`};return e.jsx("div",{className:`nice-bargauge ${k||""}`,style:p,children:e.jsxs("svg",{width:r,height:i,children:[T&&e.jsx("text",{x:N,y:20,textAnchor:"middle",className:"nice-chart__title",children:T}),t.map((v,S)=>{const $=I-S*(w+l),L=Math.max(0,Math.min(1,(v.value-s)/(m-s||1))),c=b-L*f,R=v.color||pe[S%pe.length];return e.jsxs("g",{children:[e.jsx("path",{d:z($,b,M),fill:"none",stroke:"var(--nice-border-color, #e2e8f0)",strokeWidth:w,strokeLinecap:"round"}),L>0&&e.jsx("path",{d:z($,b,c),fill:"none",stroke:R,strokeWidth:w,strokeLinecap:"round"})]},S)}),e.jsx("g",{children:t.map((v,S)=>e.jsxs("text",{x:N,y:E-((t.length-1)/2-S)*16,textAnchor:"middle",dominantBaseline:"middle",className:"nice-gauge__value",style:{fontSize:12},children:[v.label?`${v.label}: `:"",C?C(v.value):v.value]},S))})]})})},Ve={sm:{width:160,height:22,fontSize:11},md:{width:220,height:32,fontSize:12},lg:{width:320,height:44,fontSize:14}},Xe=({value:t,target:s,min:m=0,max:r=100,width:i,height:b,color:M="var(--nice-color-primary, #3b82f6)",targetColor:C="var(--nice-color-error, #ef4444)",size:T="md",label:k,labelPlacement:p="top",showValue:N=!1,showTarget:E=!1,formatValue:I=z=>String(z),state:w="normal",errorMessage:l,className:o,style:f})=>{const{t:z}=he.useNiceTranslation(),v=Ve[T],S=i??v.width,$=b??v.height,L=v.fontSize,c=4,R=S-c*2,h=E&&s!=null?L+4:c,_=E&&s!=null?$+(h-c):$,y=_-h-c,B=Math.max(0,Math.min(1,(t-m)/(r-m||1))),Y=s!=null?Math.max(0,Math.min(1,(s-m)/(r-m||1))):null,U=()=>w==="error"?e.jsx("div",{role:"alert",style:{width:S,height:_,display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed var(--nice-color-error, #ef4444)",borderRadius:4,color:"var(--nice-color-error, #ef4444)",fontSize:L,padding:"0 8px",boxSizing:"border-box"},children:l??"Error"}):w==="loading"?e.jsx("div",{role:"status","aria-label":z("bullet.loading","Loading"),className:"nice-bullet__skeleton",style:{width:S,height:_,borderRadius:4,background:"linear-gradient(90deg, var(--nice-bg-tertiary, #e5e7eb) 25%, var(--nice-bg-secondary, #f3f4f6) 50%, var(--nice-bg-tertiary, #e5e7eb) 75%)",backgroundSize:"200% 100%",animation:"nice-bullet-shimmer 1.4s linear infinite"}}):e.jsxs("svg",{width:S,height:_,role:"img","aria-label":typeof k=="string"?k:void 0,children:[e.jsx("rect",{x:c,y:h,width:R,height:y,rx:3,fill:"var(--nice-border-color, #e2e8f0)"}),e.jsx("rect",{x:c,y:h+y*.2,width:R*B,height:y*.6,rx:2,fill:M}),Y!=null&&e.jsx("line",{x1:c+R*Y,y1:h+2,x2:c+R*Y,y2:h+y-2,stroke:C,strokeWidth:2}),N&&e.jsx("text",{x:c+Math.max(R*B,4),y:h+y/2,dx:R*B>24?-4:4,textAnchor:R*B>24?"end":"start",dominantBaseline:"middle",fontSize:L,fill:R*B>24?"var(--nice-color-white, #ffffff)":"var(--nice-text-primary)",fontWeight:600,children:I(t)}),E&&Y!=null&&e.jsx("text",{x:c+R*Y,y:h-2,textAnchor:"middle",fontSize:L-1,fill:C,fontWeight:600,children:I(s)})]});if(p==="none"||!k)return e.jsxs("div",{className:`nice-bullet ${o||""}`,style:f,children:[U(),e.jsx("style",{children:Ae})]});const Z=p==="top"||p==="bottom",O=e.jsx("span",{className:"nice-bullet__label",style:{fontSize:L,fontWeight:600,color:"var(--nice-text-primary)",...Z?{marginBottom:p==="top"?4:0,marginTop:p==="bottom"?4:0}:{},...p==="left"?{marginRight:8}:{},...p==="right"?{marginLeft:8}:{}},children:k});return e.jsxs("div",{className:`nice-bullet nice-bullet--${p} ${o||""}`,style:{display:"inline-flex",flexDirection:Z?"column":"row",alignItems:Z?"flex-start":"center",...f},children:[(p==="top"||p==="left")&&O,U(),(p==="bottom"||p==="right")&&O,e.jsx("style",{children:Ae})]})},Ae=`
2
+ @keyframes nice-bullet-shimmer {
3
+ 0% { background-position: 200% 0; }
4
+ 100% { background-position: -200% 0; }
5
+ }
6
+ `,Ze=[],Ue=({data:t=Ze,width:s=400,height:m=400,innerRadius:r=0,title:i,showLegend:b=!0,showLabels:M=!0,className:C,style:T})=>{const k=s/2,p=(m-(b?30:0))/2+(i?10:0),N=Math.min(k,p)-40,E=t.reduce((l,o)=>l+o.value,0);let I=-Math.PI/2;const w=t.map((l,o)=>{const f=l.value/(E||1)*Math.PI*2,z=I;I+=f;const v=I,S=(z+v)/2,$=k+N*Math.cos(z),L=p+N*Math.sin(z),c=k+N*Math.cos(v),R=p+N*Math.sin(v),h=f>Math.PI?1:0,_=l.color||pe[o%pe.length],y=f>=Math.PI*2-1e-9;let B;if(y){const O=(F,H)=>`M${k-F},${p} A${F},${F} 0 1,${H} ${k+F},${p} A${F},${F} 0 1,${H} ${k-F},${p} Z`;B=r>0?`${O(N,1)} ${O(r,0)}`:O(N,1)}else if(r>0){const O=k+r*Math.cos(z),F=p+r*Math.sin(z),H=k+r*Math.cos(v),q=p+r*Math.sin(v);B=`M${$},${L} A${N},${N} 0 ${h},1 ${c},${R} L${H},${q} A${r},${r} 0 ${h},0 ${O},${F} Z`}else B=`M${k},${p} L${$},${L} A${N},${N} 0 ${h},1 ${c},${R} Z`;const Y=y?k:k+N*.7*Math.cos(S),U=y?p:p+N*.7*Math.sin(S),Z=E>0?Math.round(l.value/E*100):0;return{...l,path:B,labelX:Y,labelY:U,pct:Z,color:_}});return e.jsx("div",{className:`nice-piechart ${C||""}`,style:T,children:e.jsxs("svg",{viewBox:`0 0 ${s} ${m}`,preserveAspectRatio:"xMidYMid meet",width:"100%",height:"100%",style:{display:"block",maxWidth:"100%",maxHeight:"100%"},className:"nice-piechart__svg",children:[i&&e.jsx("text",{x:k,y:20,textAnchor:"middle",className:"nice-chart__title",children:i}),w.map((l,o)=>e.jsxs("g",{children:[e.jsx("path",{d:l.path,fill:l.color,stroke:"var(--nice-bg-primary, #fff)",strokeWidth:2,children:e.jsx("title",{children:`${l.label}: ${l.value} (${l.pct}%)`})}),M&&l.pct>=5&&e.jsxs("text",{x:l.labelX,y:l.labelY,textAnchor:"middle",dominantBaseline:"middle",className:"nice-piechart__label",children:[l.pct,"%"]})]},o)),b&&e.jsx("g",{transform:`translate(10, ${m-25})`,children:t.map((l,o)=>e.jsxs("g",{transform:`translate(${o*100}, 0)`,children:[e.jsx("rect",{width:10,height:10,rx:2,fill:l.color||pe[o%pe.length]}),e.jsx("text",{x:14,y:9,className:"nice-chart__legend-text",children:l.label})]},o))})]})})},Ge=[],qe=({data:t=Ge,width:s=400,height:m=300,inverted:r,showLabels:i=!0,showValues:b=!0,title:M,className:C,style:T})=>{const k={top:M?30:10,bottom:10,x:40},p=s-k.x*2,N=m-k.top-k.bottom,E=r?[...t].reverse():t,I=Math.max(...E.map(l=>l.value),1),w=N/E.length;return e.jsx("div",{className:`nice-funnel ${C||""}`,style:T,children:e.jsxs("svg",{width:s,height:m,children:[M&&e.jsx("text",{x:s/2,y:20,textAnchor:"middle",className:"nice-chart__title",children:M}),E.map((l,o)=>{const f=l.value/I*p,z=o<E.length-1?E[o+1].value/I*p:f*.3,v=k.top+o*w,S=v+w,$=s/2,L=`${$-f/2},${v} ${$+f/2},${v} ${$+z/2},${S} ${$-z/2},${S}`,c=l.color||pe[o%pe.length];return e.jsxs("g",{children:[e.jsx("polygon",{points:L,fill:c,stroke:"var(--nice-bg-primary, #fff)",strokeWidth:1,children:e.jsx("title",{children:`${l.label}: ${l.value}`})}),i&&e.jsx("text",{x:$,y:v+w/2-(b?4:0),textAnchor:"middle",dominantBaseline:"middle",className:"nice-funnel__label",children:l.label}),b&&e.jsx("text",{x:$,y:v+w/2+10,textAnchor:"middle",dominantBaseline:"middle",className:"nice-funnel__value",children:l.value})]},o)})]})})},Je=[];function Ke(t,s,m){const r=I=>{const w=I.replace("#","");return[parseInt(w.slice(0,2),16),parseInt(w.slice(2,4),16),parseInt(w.slice(4,6),16)]},[i,b,M]=r(t),[C,T,k]=r(s),p=Math.round(i+(C-i)*m),N=Math.round(b+(T-b)*m),E=Math.round(M+(k-M)*m);return`rgb(${p},${N},${E})`}const Qe=Object.assign(a.forwardRef(({data:t=Je,xLabels:s,yLabels:m,colors:r=["var(--nice-primary-bg, #e0f2fe)","var(--nice-color-primary-active, #1d4ed8)"],onCellClick:i,cellSize:b=40,showValues:M=!0,className:C,style:T,id:k},p)=>{const N=he.useControlId(k),{minVal:E,maxVal:I}=a.useMemo(()=>{let l=1/0,o=-1/0;for(const f of t)for(const z of f)z<l&&(l=z),z>o&&(o=z);return{minVal:l,maxVal:o}},[t]),w=a.useCallback(l=>I===E?.5:(l-E)/(I-E),[E,I]);return e.jsx("div",{ref:p,id:N,className:`nice-heatmap ${C||""}`,style:T,children:e.jsxs("table",{className:"nice-heatmap__table",children:[s&&e.jsx("thead",{children:e.jsxs("tr",{children:[m&&e.jsx("th",{}),s.map((l,o)=>e.jsx("th",{className:"nice-heatmap__header",children:l},o))]})}),e.jsx("tbody",{children:t.map((l,o)=>e.jsxs("tr",{children:[m&&e.jsx("th",{className:"nice-heatmap__row-label",children:m[o]}),l.map((f,z)=>e.jsx("td",{className:"nice-heatmap__cell",style:{background:Ke(r[0],r[1],w(f)),width:b,height:b,textAlign:"center",color:w(f)>.6?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #333)",cursor:i?"pointer":void 0},onClick:()=>i?.(o,z,f),title:String(f),children:M?f:""},z))]},o))})]})})}),{displayName:"NiceHeatMap"}),et=[],tt=[],Te=({nodes:t=et,links:s=tt,width:m=600,height:r=400,nodeWidth:i=20,nodePadding:b=10,title:M,className:C,style:T})=>{const k={top:M?40:20,bottom:20,left:20,right:20},p=m-k.left-k.right,N=r-k.top-k.bottom,E=new Set(s.map(h=>h.source)),I=new Set(s.map(h=>h.target)),w=t.filter(h=>E.has(h.id)&&!I.has(h.id)),l=t.filter(h=>I.has(h.id)),o=t.filter(h=>E.has(h.id)&&I.has(h.id)),f=[w,...o.length?[o]:[],l].filter(h=>h.length>0),z=f.length,v=new Map;t.forEach(h=>{const _=s.filter(B=>B.source===h.id).reduce((B,Y)=>B+Y.value,0),y=s.filter(B=>B.target===h.id).reduce((B,Y)=>B+Y.value,0);v.set(h.id,Math.max(_,y))});const S=f.map(h=>h.reduce((_,y)=>_+(v.get(y.id)||0),0)+(h.length-1)*b),$=Math.max(...S,1),L=new Map;f.forEach((h,_)=>{const y=k.left+_/(z-1||1)*(p-i);let B=0;h.forEach(Y=>{const U=(v.get(Y.id)||0)/$*N;L.set(Y.id,{x:y,y:k.top+B,h:U}),B+=U+b})});const c=new Map,R=new Map;return t.forEach(h=>{c.set(h.id,0),R.set(h.id,0)}),e.jsx("div",{className:`nice-sankey ${C||""}`,style:T,children:e.jsxs("svg",{width:m,height:r,children:[M&&e.jsx("text",{x:m/2,y:20,textAnchor:"middle",className:"nice-chart__title",children:M}),s.map((h,_)=>{const y=L.get(h.source),B=L.get(h.target);if(!y||!B)return null;const Y=c.get(h.source)||0,U=R.get(h.target)||0,Z=h.value/$*N;c.set(h.source,Y+Z),R.set(h.target,U+Z);const O=y.x+i,F=y.y+Y,H=B.x,q=B.y+U,u=(O+H)/2,ce=t.find(ee=>ee.id===h.source)?.color||pe[_%pe.length];return e.jsx("path",{d:`M${O},${F} C${u},${F} ${u},${q} ${H},${q} L${H},${q+Z} C${u},${q+Z} ${u},${F+Z} ${O},${F+Z} Z`,fill:ce,fillOpacity:.3,stroke:ce,strokeOpacity:.5,strokeWidth:.5,children:e.jsx("title",{children:`${h.source} → ${h.target}: ${h.value}`})},_)}),t.map((h,_)=>{const y=L.get(h.id);if(!y)return null;const B=h.color||pe[_%pe.length];return e.jsxs("g",{children:[e.jsx("rect",{x:y.x,y:y.y,width:i,height:Math.max(y.h,2),fill:B,rx:2}),e.jsx("text",{x:y.x<p/2?y.x+i+4:y.x-4,y:y.y+y.h/2,textAnchor:y.x<p/2?"start":"end",dominantBaseline:"middle",className:"nice-chart__legend-text",children:h.label})]},h.id)})]})})},nt=Object.freeze(Object.defineProperty({__proto__:null,NiceSankey:Te},Symbol.toStringTag,{value:"Module"}));function rt(t,s){const m=t.reduce((k,p)=>k+p.value,0);if(m===0||t.length===0)return[];const r=[];let{x:i,y:b,w:M,h:C}=s;const T=[...t].sort((k,p)=>p.value-k.value);for(const k of T){const p=k.value/m;if(M>=C){const N=M*p;r.push({x:i,y:b,w:N,h:C,node:k}),i+=N,M-=N}else{const N=C*p;r.push({x:i,y:b,w:M,h:N,node:k}),b+=N,C-=N}}return r}const at=["var(--nice-color-primary, #3b82f6)","var(--nice-color-success, #10b981)","var(--nice-color-warning, #f59e0b)","var(--nice-color-error, #ef4444)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-info, #06b6d4)","var(--nice-color-accent-pink, #ec4899)","var(--nice-success, #84cc16)"],ze=Object.assign(a.forwardRef(({data:t,width:s=600,height:m=400,onNodeClick:r,colors:i=at,className:b,style:M,id:C},T)=>{const k=he.useControlId(C),p=a.useMemo(()=>{const N=t.children??[t];return rt(N,{x:0,y:0,w:s,h:m})},[t,s,m]);return e.jsx("div",{ref:T,id:k,className:`nice-treemap ${b||""}`,style:M,children:e.jsx("svg",{width:s,height:m,className:"nice-treemap__svg",children:p.map((N,E)=>e.jsxs("g",{onClick:()=>r?.(N.node),style:{cursor:r?"pointer":void 0},children:[e.jsx("rect",{x:N.x,y:N.y,width:Math.max(N.w-1,0),height:Math.max(N.h-1,0),fill:N.node.color??i[E%i.length],rx:2}),N.w>40&&N.h>20&&e.jsx("text",{x:N.x+N.w/2,y:N.y+N.h/2,textAnchor:"middle",dominantBaseline:"central",fill:"var(--nice-color-white, #fff)",fontSize:Math.min(12,N.w/6),className:"nice-treemap__label",children:N.node.label})]},N.node.key))})})}),{displayName:"NiceTreeMap"}),ct=Object.freeze(Object.defineProperty({__proto__:null,NiceTreeMap:ze},Symbol.toStringTag,{value:"Module"})),st=[],Le=({regions:t=st,width:s=600,height:m=400,viewBox:r="0 0 1000 600",colorRange:i=["#dbeafe","#1d4ed8"],maxValue:b,onRegionClick:M,selectedRegionId:C,title:T,showTooltip:k=!0,className:p,style:N})=>{const E=b??Math.max(...t.map(w=>w.value??0),1),I=w=>{const l=h=>[parseInt(h.slice(1,3),16),parseInt(h.slice(3,5),16),parseInt(h.slice(5,7),16)],[o,f,z]=l(i[0]),[v,S,$]=l(i[1]),L=Math.round(o+(v-o)*w),c=Math.round(f+(S-f)*w),R=Math.round(z+($-z)*w);return`rgb(${L},${c},${R})`};return e.jsxs("div",{className:`nice-vectormap ${p||""}`,style:N,children:[T&&e.jsx("div",{className:"nice-vectormap__title",children:T}),e.jsx("svg",{width:s,height:m,viewBox:r,children:t.map(w=>{const l=w.value!=null?Math.max(0,Math.min(1,w.value/E)):0,o=w.value!=null?I(l):"var(--nice-bg-tertiary, #e5e7eb)",f=w.id===C;return e.jsx("path",{d:w.path,fill:o,stroke:f?"var(--nice-color-primary, #3b82f6)":"var(--nice-border-color, #d1d5db)",strokeWidth:f?2:.5,cursor:M?"pointer":void 0,onClick:()=>M?.(w),children:k&&e.jsx("title",{children:`${w.name}${w.value!=null?`: ${w.value}`:""}`})},w.id)})})]})},it=Object.freeze(Object.defineProperty({__proto__:null,NiceVectorMap:Le},Symbol.toStringTag,{value:"Module"})),ot=Object.assign(a.forwardRef(({data:t,renderNode:s,selectable:m,selectedKey:r,onSelect:i,direction:b="top-down",collapsible:M=!0,className:C,style:T,id:k},p)=>{const N=he.useControlId(k),[E,I]=a.useState(new Set),w=a.useCallback(f=>{I(z=>{const v=new Set(z);return v.has(f)?v.delete(f):v.add(f),v})},[]),l=a.useCallback(f=>{m&&i?.(f)},[m,i]),o=a.useCallback(f=>{const z=E.has(f.key),v=f.children&&f.children.length>0;return e.jsxs("li",{className:"nice-org-chart__item",children:[e.jsxs("div",{className:`nice-org-chart__node${r===f.key?" nice-org-chart__node--selected":""}`,onClick:()=>l(f.key),role:m?"button":void 0,children:[s?s(f):e.jsx("span",{children:f.label}),M&&v&&e.jsx("button",{type:"button",className:"nice-org-chart__toggle",onClick:S=>{S.stopPropagation(),w(f.key)},"aria-label":z?"Expand":"Collapse",children:e.jsx(he.NiceIcon,{name:z?"plus":"minus",size:14})})]}),v&&!z&&e.jsx("ul",{className:"nice-org-chart__children",children:f.children.map(S=>o(S))})]},f.key)},[E,r,s,m,M,l,w]);return e.jsx("div",{ref:p,id:N,className:`nice-org-chart nice-org-chart--${b} ${C||""}`,style:T,children:e.jsx("ul",{className:"nice-org-chart__root",children:o(t)})})}),{displayName:"NiceOrganizationChart"}),lt=[],dt=Object.assign(a.forwardRef(({data:t=lt,type:s="candlestick",showVolume:m=!0,width:r=800,height:i=400,bullColor:b="var(--nice-color-success, #22c55e)",bearColor:M="var(--nice-color-error, #ef4444)",className:C,style:T,id:k},p)=>{const N=he.useControlId(k),E={top:20,right:20,bottom:m?80:30,left:60},I=r-E.left-E.right,w=m?50:0,l=i-E.top-E.bottom-w,{minP:o,maxP:f,maxVol:z}=a.useMemo(()=>{if(t.length===0)return{minP:0,maxP:1,maxVol:0};let c=1/0,R=-1/0,h=0;for(const _ of t)_.low<c&&(c=_.low),_.high>R&&(R=_.high),_.volume&&_.volume>h&&(h=_.volume);return{minP:c,maxP:R,maxVol:h}},[t]),v=Math.max(1,I/t.length*.7),S=c=>E.left+(c+.5)*(I/t.length),$=c=>E.top+l-(c-o)/(f-o||1)*l,L=c=>i-E.bottom-w+w*(1-c/(z||1));return e.jsx("div",{ref:p,id:N,className:`nice-stock-chart ${C||""}`,style:T,children:e.jsxs("svg",{width:r,height:i,className:"nice-stock-chart__svg",children:[[0,.25,.5,.75,1].map(c=>{const R=o+c*(f-o);return e.jsxs("g",{children:[e.jsx("line",{x1:E.left,x2:r-E.right,y1:$(R),y2:$(R),stroke:"var(--nice-border, #e5e7eb)",strokeDasharray:"2,2"}),t.length>0&&e.jsx("text",{x:E.left-4,y:$(R)+4,textAnchor:"end",fontSize:10,fill:"var(--nice-text-secondary, #888)",children:R.toFixed(2)})]},c)}),s==="line"?e.jsx("polyline",{points:t.map((c,R)=>`${S(R)},${$(c.close)}`).join(" "),fill:"none",stroke:b,strokeWidth:1.5}):t.map((c,R)=>{const h=c.close>=c.open,_=h?b:M,y=S(R);if(s==="ohlc")return e.jsxs("g",{children:[e.jsx("line",{x1:y,x2:y,y1:$(c.high),y2:$(c.low),stroke:_,strokeWidth:1}),e.jsx("line",{x1:y-v/2,x2:y,y1:$(c.open),y2:$(c.open),stroke:_,strokeWidth:1.5}),e.jsx("line",{x1:y,x2:y+v/2,y1:$(c.close),y2:$(c.close),stroke:_,strokeWidth:1.5})]},R);const B=$(Math.max(c.open,c.close)),Y=$(Math.min(c.open,c.close));return e.jsxs("g",{children:[e.jsx("line",{x1:y,x2:y,y1:$(c.high),y2:$(c.low),stroke:_,strokeWidth:1}),e.jsx("rect",{x:y-v/2,y:B,width:v,height:Math.max(Y-B,1),fill:h?"transparent":_,stroke:_,strokeWidth:1})]},R)}),m&&t.map((c,R)=>{if(!c.volume)return null;const h=c.close>=c.open;return e.jsx("rect",{x:S(R)-v/2,y:L(c.volume),width:v,height:i-E.bottom-L(c.volume),fill:h?b:M,opacity:.3},`v${R}`)}),t.map((c,R)=>R%Math.max(1,Math.floor(t.length/8))!==0?null:e.jsx("text",{x:S(R),y:i-E.bottom+w+14,textAnchor:"middle",fontSize:9,fill:"var(--nice-text-secondary, #888)",children:c.date},`l${R}`))]})})}),{displayName:"NiceStockChart"}),ht=[],ut=({data:t=ht,width:s=120,height:m=30,type:r="line",color:i="var(--nice-color-primary, #3b82f6)",showMinMax:b,showLastPoint:M=!0,className:C,style:T})=>{if(t.length===0)return null;const k=2,p=Math.min(...t),N=Math.max(...t),E=N-p||1,I=s-k*2,w=m-k*2,l=$=>k+$/(t.length-1||1)*I,o=$=>k+w-($-p)/E*w;if(r==="bar"){const $=Math.max(1,I/t.length-1);return e.jsx("svg",{width:s,height:m,className:`nice-sparkline ${C||""}`,style:T,children:t.map((L,c)=>e.jsx("rect",{x:k+c/t.length*I,y:o(L),width:$,height:w-(o(L)-k),fill:i,rx:1},c))})}const f=t.map(($,L)=>`${l(L)},${o($)}`).join(" "),z=t.indexOf(p),v=t.indexOf(N),S=t.length-1;return e.jsxs("svg",{width:s,height:m,className:`nice-sparkline ${C||""}`,style:T,children:[r==="area"&&e.jsx("polygon",{points:`${l(0)},${k+w} ${f} ${l(S)},${k+w}`,fill:i,opacity:.15}),e.jsx("polyline",{points:f,fill:"none",stroke:i,strokeWidth:1.5}),b&&e.jsx("circle",{cx:l(z),cy:o(p),r:2,fill:"var(--nice-danger, #ef4444)"}),b&&e.jsx("circle",{cx:l(v),cy:o(N),r:2,fill:"var(--nice-success, #22c55e)"}),M&&e.jsx("circle",{cx:l(S),cy:o(t[S]),r:2,fill:i})]})},ft=[],xt=[],mt=({series:t=ft,categories:s=xt,width:m=400,height:r=400,maxValue:i,title:b,showLegend:M=!0,className:C,style:T})=>{const k=m/2,p=(r-(M?30:0))/2+(b?10:0),N=Math.min(k,p)-60,E=s.length,I=i??Math.max(...t.flatMap(f=>f.data),1),w=Math.PI*2/E,l=5,o=(f,z)=>{const v=f*w-Math.PI/2,S=z/I*N;return{x:k+S*Math.cos(v),y:p+S*Math.sin(v)}};return e.jsx("div",{className:`nice-polarchart ${C||""}`,style:T,children:e.jsxs("svg",{width:m,height:r,className:"nice-polarchart__svg",children:[b&&e.jsx("text",{x:k,y:20,textAnchor:"middle",className:"nice-chart__title",children:b}),Array.from({length:l},(f,z)=>{const v=N*((z+1)/l);return e.jsx("circle",{cx:k,cy:p,r:v,fill:"none",stroke:"var(--nice-border-color, #ddd)",strokeWidth:.5},z)}),s.map((f,z)=>{const v=o(z,I),S=o(z,I*1.22),$=z*w-Math.PI/2,L=Math.cos($),c=Math.sin($),R=L>.2?"start":L<-.2?"end":"middle",h=c>.2?"hanging":c<-.2?"auto":"middle";return e.jsxs("g",{children:[e.jsx("line",{x1:k,y1:p,x2:v.x,y2:v.y,stroke:"var(--nice-border-color, #ddd)",strokeWidth:.5}),e.jsx("text",{x:S.x,y:S.y,textAnchor:R,dominantBaseline:h,className:"nice-chart__axis-label nice-chart__axis-label--polar",children:f})]},z)}),t.map((f,z)=>{const v=f.color||pe[z%pe.length],S=f.data.map(($,L)=>{const c=o(L,$);return`${c.x},${c.y}`}).join(" ");return e.jsxs("g",{children:[e.jsx("polygon",{points:S,fill:f.fill!==!1?v:"none",fillOpacity:.15,stroke:v,strokeWidth:2}),f.data.map(($,L)=>{const c=o(L,$);return e.jsx("circle",{cx:c.x,cy:c.y,r:3,fill:v,children:e.jsx("title",{children:`${f.name} - ${s[L]}: ${$}`})},L)})]},f.name)}),M&&e.jsx("g",{transform:`translate(10, ${r-25})`,children:t.map((f,z)=>e.jsxs("g",{transform:`translate(${z*100}, 0)`,children:[e.jsx("rect",{width:10,height:10,rx:2,fill:f.color||pe[z%pe.length]}),e.jsx("text",{x:14,y:9,className:"nice-chart__legend-text",children:f.name})]},z))})]})})},pt=({data:t,min:s,max:m,start:r,end:i,onChange:b,width:M=500,height:C=100,step:T=1,formatValue:k,chartColor:p="var(--nice-color-primary, #3b82f6)",className:N,style:E})=>{const I={top:10,bottom:30,left:10,right:10},w=M-I.left-I.right,l=C-I.top-I.bottom,o=L=>I.left+(L-s)/(m-s||1)*w,f=L=>{const c=Math.max(0,Math.min(1,(L-I.left)/w)),R=s+c*(m-s);return Math.round(R/T)*T},z=(L,c)=>{c.preventDefault();const R=c.target.closest("svg");if(!R)return;const h=y=>{const B=R.getBoundingClientRect(),Y=f(y.clientX-B.left);L==="start"?b(Math.min(Y,i),i):b(r,Math.max(Y,r))},_=()=>{document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",_)};document.addEventListener("pointermove",h),document.addEventListener("pointerup",_)},v=t?Math.min(...t):0,$=(t?Math.max(...t):1)-v||1;return e.jsx("div",{className:`nice-rangeselector ${N||""}`,style:E,children:e.jsxs("svg",{width:M,height:C,children:[t&&t.length>1&&e.jsx("polygon",{points:`${I.left},${I.top+l} ${t.map((L,c)=>`${I.left+c/(t.length-1)*w},${I.top+l-(L-v)/$*l}`).join(" ")} ${I.left+w},${I.top+l}`,fill:p,opacity:.15}),e.jsx("rect",{x:o(r),y:I.top,width:o(i)-o(r),height:l,fill:p,opacity:.1}),e.jsx("rect",{x:I.left,y:I.top,width:o(r)-I.left,height:l,fill:"var(--nice-bg-secondary, #f5f5f5)",opacity:.6}),e.jsx("rect",{x:o(i),y:I.top,width:I.left+w-o(i),height:l,fill:"var(--nice-bg-secondary, #f5f5f5)",opacity:.6}),e.jsx("rect",{x:o(r)-4,y:I.top,width:8,height:l,fill:p,rx:2,cursor:"ew-resize",onPointerDown:L=>z("start",L)}),e.jsx("rect",{x:o(i)-4,y:I.top,width:8,height:l,fill:p,rx:2,cursor:"ew-resize",onPointerDown:L=>z("end",L)}),e.jsx("text",{x:o(r),y:I.top+l+18,textAnchor:"middle",className:"nice-chart__axis-label",children:k?k(r):r}),e.jsx("text",{x:o(i),y:I.top+l+18,textAnchor:"middle",className:"nice-chart__axis-label",children:k?k(i):i})]})})},gt=`
7
+ .nice-forecast-chart {
8
+ display: flex;
9
+ flex-direction: column;
10
+ background: var(--nice-bg-primary, #ffffff);
11
+ border: 1px solid var(--nice-border-color, #e5e7eb);
12
+ border-radius: var(--nice-radius-lg, 0.5rem);
13
+ overflow: hidden;
14
+ }
15
+
16
+ .nice-forecast-chart__header {
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: space-between;
20
+ padding: 0.75rem 1rem;
21
+ border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
22
+ }
23
+
24
+ .nice-forecast-chart__title {
25
+ font-size: 1rem;
26
+ font-weight: 600;
27
+ color: var(--nice-text-primary);
28
+ margin: 0;
29
+ }
30
+
31
+ .nice-forecast-chart__actions {
32
+ display: flex;
33
+ gap: 0.5rem;
34
+ }
35
+
36
+ .nice-forecast-chart__btn {
37
+ display: inline-flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+ width: 2rem;
41
+ height: 2rem;
42
+ font-size: 1rem;
43
+ border-radius: var(--nice-radius-md, 0.375rem);
44
+ cursor: pointer;
45
+ transition: all 0.15s ease;
46
+ border: 1px solid var(--nice-border-color, #d1d5db);
47
+ background: var(--nice-bg-primary, #ffffff);
48
+ color: var(--nice-text-secondary);
49
+ }
50
+
51
+ .nice-forecast-chart__btn:hover {
52
+ background: var(--nice-bg-hover, #f3f4f6);
53
+ color: var(--nice-text-primary);
54
+ }
55
+
56
+ .nice-forecast-chart__btn:disabled {
57
+ opacity: 0.5;
58
+ cursor: not-allowed;
59
+ }
60
+
61
+ .nice-forecast-chart__container {
62
+ position: relative;
63
+ width: 100%;
64
+ padding: 1rem;
65
+ }
66
+
67
+ .nice-forecast-chart__svg {
68
+ width: 100%;
69
+ overflow: visible;
70
+ }
71
+
72
+ .nice-forecast-chart__grid-line {
73
+ stroke: var(--nice-border-divider, #f3f4f6);
74
+ stroke-width: 1;
75
+ }
76
+
77
+ .nice-forecast-chart__axis-line {
78
+ stroke: var(--nice-border-color, #e5e7eb);
79
+ stroke-width: 1;
80
+ }
81
+
82
+ .nice-forecast-chart__axis-label {
83
+ font-size: 0.6875rem;
84
+ fill: var(--nice-text-secondary);
85
+ }
86
+
87
+ .nice-forecast-chart__axis-title {
88
+ font-size: 0.75rem;
89
+ font-weight: 500;
90
+ fill: var(--nice-text-primary);
91
+ }
92
+
93
+ .nice-forecast-chart__historical-line {
94
+ fill: none;
95
+ stroke-width: 2;
96
+ stroke-linecap: round;
97
+ stroke-linejoin: round;
98
+ }
99
+
100
+ .nice-forecast-chart__forecast-line {
101
+ fill: none;
102
+ stroke-width: 2;
103
+ stroke-linecap: round;
104
+ stroke-linejoin: round;
105
+ stroke-dasharray: 6, 4;
106
+ }
107
+
108
+ .nice-forecast-chart__confidence-band {
109
+ opacity: 0.2;
110
+ }
111
+
112
+ .nice-forecast-chart__forecast-region {
113
+ fill: var(--nice-bg-secondary, #f9fafb);
114
+ opacity: 0.5;
115
+ }
116
+
117
+ .nice-forecast-chart__point {
118
+ cursor: pointer;
119
+ transition: r 0.15s ease;
120
+ }
121
+
122
+ .nice-forecast-chart__point:hover {
123
+ r: 6;
124
+ }
125
+
126
+ .nice-forecast-chart__annotation-line {
127
+ stroke-dasharray: 4, 2;
128
+ stroke-width: 1;
129
+ }
130
+
131
+ .nice-forecast-chart__annotation-marker {
132
+ cursor: pointer;
133
+ transition: transform 0.15s ease;
134
+ }
135
+
136
+ .nice-forecast-chart__annotation-marker:hover {
137
+ transform: scale(1.2);
138
+ }
139
+
140
+ .nice-forecast-chart__reference-line {
141
+ stroke-width: 1;
142
+ }
143
+
144
+ .nice-forecast-chart__reference-label {
145
+ font-size: 0.625rem;
146
+ fill: var(--nice-text-secondary);
147
+ }
148
+
149
+ .nice-forecast-chart__cash-runway {
150
+ pointer-events: none;
151
+ }
152
+
153
+ .nice-forecast-chart__cash-runway-line {
154
+ stroke: var(--nice-danger, #ef4444);
155
+ stroke-width: 2;
156
+ stroke-dasharray: 8, 4;
157
+ }
158
+
159
+ .nice-forecast-chart__cash-runway-label-bg {
160
+ fill: var(--nice-danger, #ef4444);
161
+ rx: 4;
162
+ }
163
+
164
+ .nice-forecast-chart__cash-runway-label {
165
+ font-size: 0.6875rem;
166
+ font-weight: 600;
167
+ fill: var(--nice-bg, #FFFFFF);
168
+ }
169
+
170
+ .nice-forecast-chart__cash-runway-date {
171
+ font-size: 0.625rem;
172
+ fill: var(--nice-danger, #ef4444);
173
+ font-weight: 500;
174
+ }
175
+
176
+ .nice-forecast-chart__tooltip {
177
+ position: absolute;
178
+ pointer-events: none;
179
+ z-index: 100;
180
+ padding: 0.75rem;
181
+ background: var(--nice-bg-primary, #ffffff);
182
+ border: 1px solid var(--nice-border-color, #e5e7eb);
183
+ border-radius: var(--nice-radius-lg, 0.5rem);
184
+ box-shadow: 0 4px 12px var(--nice-overlay-10, rgba(0, 0, 0, 0.1));
185
+ font-size: 0.8125rem;
186
+ max-width: 250px;
187
+ }
188
+
189
+ .nice-forecast-chart__tooltip-date {
190
+ font-weight: 600;
191
+ color: var(--nice-text-primary);
192
+ margin-bottom: 0.5rem;
193
+ padding-bottom: 0.5rem;
194
+ border-bottom: 1px solid var(--nice-border-divider, #f3f4f6);
195
+ }
196
+
197
+ .nice-forecast-chart__tooltip-item {
198
+ display: flex;
199
+ align-items: center;
200
+ gap: 0.5rem;
201
+ margin-bottom: 0.25rem;
202
+ }
203
+
204
+ .nice-forecast-chart__tooltip-color {
205
+ width: 10px;
206
+ height: 10px;
207
+ border-radius: var(--nice-radius-sm, 2px);
208
+ flex-shrink: 0;
209
+ }
210
+
211
+ .nice-forecast-chart__tooltip-label {
212
+ color: var(--nice-text-secondary);
213
+ flex: 1;
214
+ }
215
+
216
+ .nice-forecast-chart__tooltip-value {
217
+ font-weight: 600;
218
+ color: var(--nice-text-primary);
219
+ font-variant-numeric: tabular-nums;
220
+ }
221
+
222
+ .nice-forecast-chart__tooltip-confidence {
223
+ font-size: 0.75rem;
224
+ color: var(--nice-text-tertiary);
225
+ }
226
+
227
+ .nice-forecast-chart__legend {
228
+ display: flex;
229
+ flex-wrap: wrap;
230
+ gap: 1rem;
231
+ padding: 0.75rem 1rem;
232
+ border-top: 1px solid var(--nice-border-color, #e5e7eb);
233
+ }
234
+
235
+ .nice-forecast-chart__legend-item {
236
+ display: flex;
237
+ align-items: center;
238
+ gap: 0.375rem;
239
+ font-size: 0.8125rem;
240
+ color: var(--nice-text-secondary);
241
+ cursor: pointer;
242
+ user-select: none;
243
+ transition: opacity 0.15s ease;
244
+ }
245
+
246
+ .nice-forecast-chart__legend-item:hover {
247
+ color: var(--nice-text-primary);
248
+ }
249
+
250
+ .nice-forecast-chart__legend-item--hidden {
251
+ opacity: 0.4;
252
+ }
253
+
254
+ .nice-forecast-chart__legend-color {
255
+ width: 16px;
256
+ height: 3px;
257
+ border-radius: var(--nice-radius-xs, 1px);
258
+ }
259
+
260
+ .nice-forecast-chart__legend-color--dashed {
261
+ background: repeating-linear-gradient(
262
+ 90deg,
263
+ currentColor,
264
+ currentColor 4px,
265
+ transparent 4px,
266
+ transparent 6px
267
+ );
268
+ }
269
+
270
+ .nice-forecast-chart__empty {
271
+ display: flex;
272
+ align-items: center;
273
+ justify-content: center;
274
+ height: 300px;
275
+ color: var(--nice-text-secondary);
276
+ }
277
+
278
+ /* Dark mode */
279
+ .dark .nice-forecast-chart {
280
+ background: var(--nice-bg-primary-dark, #111827);
281
+ border-color: var(--nice-border-color-dark, #374151);
282
+ }
283
+
284
+ .dark .nice-forecast-chart__tooltip {
285
+ background: var(--nice-bg-secondary-dark, #1f2937);
286
+ border-color: var(--nice-border-color-dark, #374151);
287
+ }
288
+
289
+ .dark .nice-forecast-chart__forecast-region {
290
+ fill: var(--nice-bg-secondary-dark, #1f2937);
291
+ }
292
+ `,Ie=["var(--nice-color-primary, #3b82f6)","var(--nice-color-success, #10b981)","var(--nice-color-warning, #f59e0b)","var(--nice-color-error, #ef4444)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-color-info, #06b6d4)","var(--nice-warning, #f97316)"];function me(t){return t instanceof Date?t:new Date(t)}function Ce(t,s="pl-PL"){return t.toLocaleDateString(s,{year:"numeric",month:"short",day:"numeric"})}function we(t,s="pl-PL"){return new Intl.NumberFormat(s,{minimumFractionDigits:0,maximumFractionDigits:2}).format(t)}const vt=a.forwardRef(function(s,m){const{scenarios:r,data:i,annotations:b=[],referenceLines:M=[],forecastStartDate:C,cashRunway:T,xAxis:k,yAxis:p,confidenceBands:N=[{level:95,color:"var(--nice-color-primary, #3b82f6)",opacity:.15}],tooltip:E,legend:I={enabled:!0,position:"bottom",interactive:!0},height:w=350,showForecastRegion:l=!0,lineWidth:o=2,showPoints:f=!1,pointRadius:z=4,enableZoom:v=!1,zoomEnabled:S,animationDuration:$=300,showLegend:L,responsive:c=!0,onPointClick:R,onAnnotationClick:h,onScenarioToggle:_,onViewportChange:y,size:B="medium",disabled:Y=!1,labels:U={},locale:Z="pl-PL",className:O,style:F}=s,H=r&&r.length>0?r:i?[{id:"default",name:"Series",data:i}]:[],q={...I,enabled:L??I.enabled},[u,re]=a.useState(()=>H.map((n,D)=>({...n,color:n.color??Ie[D%Ie.length],visible:n.visible!==!1}))),[ce,ee]=a.useState(null),[V,se]=a.useState({x:0,y:0}),P=a.useRef(null),x=a.useRef(null),j={top:20,right:30,bottom:40,left:60},[A,Q]=a.useState({width:600,height:typeof w=="number"?w:350});a.useEffect(()=>{if(!c||!P.current)return;const n=new ResizeObserver(D=>{for(const W of D)Q(g=>({width:W.contentRect.width,height:g.height}))});return n.observe(P.current),()=>n.disconnect()},[c]),a.useEffect(()=>{const n="nice-forecast-chart-styles";if(!document.getElementById(n)){const D=document.createElement("style");D.id=n,D.textContent=gt,document.head.appendChild(D)}},[]);const{xScale:ae,yScale:X,allDates:ie,minY:ue,maxY:ge}=a.useMemo(()=>{const D=u.filter(fe=>fe.visible!==!1).flatMap(fe=>fe.data);if(D.length===0)return{xScale:()=>0,yScale:()=>0,allDates:[],minY:0,maxY:100};const W=D.map(fe=>me(fe.date).getTime()),g=Math.min(...W),G=Math.max(...W),oe=D.flatMap(fe=>[fe.value,fe.forecast,fe.lowerBound,fe.upperBound]).filter(fe=>fe!=null),le=p?.min??Math.min(...oe)*.95,de=p?.max??Math.max(...oe)*1.05,ye=A.width-j.left-j.right,je=A.height-j.top-j.bottom,Ne=fe=>{const Se=typeof fe=="number"?fe:fe.getTime();return j.left+(Se-g)/(G-g)*ye},$e=fe=>j.top+je-(fe-le)/(de-le)*je,Ee=[...new Set(W)].sort((fe,Se)=>fe-Se).map(fe=>new Date(fe));return{xScale:Ne,yScale:$e,allDates:Ee,minY:le,maxY:de}},[u,A,j,p]),xe=C?me(C):null,ve=a.useMemo(()=>{if(!T?.enabled)return null;const n=T.threshold??0,D=T.scenarioId?u.find(g=>g.id===T.scenarioId&&g.visible!==!1):u.find(g=>g.visible!==!1);if(!D)return null;const W=D.data.sort((g,G)=>me(g.date).getTime()-me(G.date).getTime());for(let g=1;g<W.length;g++){const G=W[g-1],oe=W[g],le=G.forecast??G.value,de=oe.forecast??oe.value;if(le!=null&&de!=null&&le>n&&de<=n){const ye=(le-n)/(le-de),je=me(G.date).getTime(),Ne=me(oe.date).getTime(),$e=je+ye*(Ne-je);return new Date($e)}}return null},[T,u]),be=a.useCallback((n,D)=>{const W=n.filter(g=>g[D]!=null).map(g=>({x:ae(me(g.date)),y:X(g[D])}));return W.length===0?"":`M ${W.map(g=>`${g.x},${g.y}`).join(" L ")}`},[ae,X]),_e=a.useCallback(n=>{const D=n.filter(G=>G.lowerBound!=null&&G.upperBound!=null);if(D.length===0)return"";const W=D.map(G=>({x:ae(me(G.date)),y:X(G.upperBound)})),g=D.map(G=>({x:ae(me(G.date)),y:X(G.lowerBound)})).reverse();return`M ${W.map(G=>`${G.x},${G.y}`).join(" L ")} L ${g.map(G=>`${G.x},${G.y}`).join(" L ")} Z`},[ae,X]),J=a.useCallback(n=>{if(!x.current||E?.enabled===!1)return;const D=x.current.getBoundingClientRect(),W=n.clientX-D.left;n.clientY-D.top;let g=null,G=1/0;for(const oe of ie){const le=ae(oe),de=Math.abs(le-W);de<G&&(G=de,g=oe)}if(g&&G<50){const oe=u.filter(de=>de.visible!==!1).map(de=>{const ye=de.data.find(je=>me(je.date).getTime()===g.getTime());return{scenario:de,value:ye?.value,forecast:ye?.forecast,lowerBound:ye?.lowerBound,upperBound:ye?.upperBound}}),le=b.filter(de=>Math.abs(me(de.date).getTime()-g.getTime())<864e5);ee({date:g,values:oe,annotations:le}),se({x:n.clientX-D.left+10,y:n.clientY-D.top-10})}else ee(null)},[ae,ie,u,b,E]),d=a.useCallback(n=>{if(!q.interactive)return;re(W=>W.map(g=>g.id===n?{...g,visible:!g.visible}:g));const D=u.find(W=>W.id===n);D&&_?.(n,!D.visible)},[q.interactive,u,_]);a.useImperativeHandle(m,()=>({getScenarios:()=>u,updateScenario:(n,D)=>{re(W=>W.map(g=>g.id===n?{...g,data:D}:g))},toggleScenario:d,setZoomRange:()=>{},resetZoom:()=>{},exportImage:n=>{if(!x.current)return null;const D=x.current,g=new XMLSerializer().serializeToString(D);return`data:image/svg+xml;base64,${btoa(g)}`},getDataAtDate:n=>{const D=u.filter(W=>W.visible!==!1).map(W=>{const g=W.data.find(G=>me(G.date).getTime()===n.getTime());return{scenario:W,value:g?.value,forecast:g?.forecast,lowerBound:g?.lowerBound,upperBound:g?.upperBound}});return{date:n,values:D,annotations:b.filter(W=>me(W.date).getTime()===n.getTime())}}}),[u,b,d]),A.width-j.left-j.right;const K=A.height-j.top-j.bottom,te=a.useMemo(()=>{const n=p?.tickCount??5,D=[],W=(ge-ue)/(n-1);for(let g=0;g<n;g++)D.push(ue+W*g);return D},[ue,ge,p?.tickCount]),ne=a.useMemo(()=>{const n=k?.tickCount??6;if(ie.length===0)return[];const D=Math.max(1,Math.floor(ie.length/(n-1)));return ie.filter((W,g)=>g%D===0||g===ie.length-1)},[ie,k?.tickCount]);return u.length===0||u.every(n=>n.data.length===0)?e.jsx("div",{className:`nice-forecast-chart ${O??""}`,style:F,children:e.jsx("div",{className:"nice-forecast-chart__empty",children:U.noData??"No data available"})}):e.jsxs("div",{className:`nice-forecast-chart ${O??""}`,style:{...F,height:w},children:[e.jsxs("div",{ref:P,className:"nice-forecast-chart__container",children:[e.jsxs("svg",{ref:x,className:"nice-forecast-chart__svg",width:A.width,height:A.height,onMouseMove:J,onMouseLeave:()=>ee(null),children:[p?.showGrid!==!1&&te.map(n=>e.jsx("line",{className:"nice-forecast-chart__grid-line",x1:j.left,x2:A.width-j.right,y1:X(n),y2:X(n)},n)),l&&xe&&e.jsx("rect",{className:"nice-forecast-chart__forecast-region",x:ae(xe),y:j.top,width:A.width-j.right-ae(xe),height:K}),M.map(n=>e.jsxs("g",{children:[e.jsx("line",{className:"nice-forecast-chart__reference-line",x1:j.left,x2:A.width-j.right,y1:X(n.value),y2:X(n.value),stroke:n.color??"var(--nice-text-muted, #9ca3af)",strokeDasharray:n.dashArray??"4,2"}),n.label&&e.jsx("text",{className:"nice-forecast-chart__reference-label",x:A.width-j.right-4,y:X(n.value)-4,textAnchor:"end",children:n.label})]},n.id)),ve&&T?.enabled&&e.jsxs("g",{className:"nice-forecast-chart__cash-runway",children:[e.jsx("line",{className:"nice-forecast-chart__cash-runway-line",x1:ae(ve),x2:ae(ve),y1:j.top,y2:A.height-j.bottom,stroke:T.color??"var(--nice-color-error, #ef4444)"}),T.showLabel!==!1&&e.jsxs(e.Fragment,{children:[e.jsx("rect",{className:"nice-forecast-chart__cash-runway-label-bg",x:ae(ve)-60,y:j.top-2,width:120,height:T.showDate!==!1?32:20,fill:T.color??"var(--nice-color-error, #ef4444)",rx:4}),e.jsx("text",{className:"nice-forecast-chart__cash-runway-label",x:ae(ve),y:j.top+12,textAnchor:"middle",fill:"var(--nice-color-white, #fff)",children:T.label??U.cashRunsOut??"Cash runs out"}),T.showDate!==!1&&e.jsx("text",{className:"nice-forecast-chart__cash-runway-label",x:ae(ve),y:j.top+26,textAnchor:"middle",fill:"var(--nice-color-white, #fff)",style:{fontSize:"0.625rem",opacity:.9},children:Ce(ve,Z)})]})]}),u.filter(n=>n.visible!==!1&&n.showConfidenceBand).map(n=>e.jsx("path",{className:"nice-forecast-chart__confidence-band",d:_e(n.data),fill:n.color},`band-${n.id}`)),u.filter(n=>n.visible!==!1).map(n=>{const D=xe?n.data.filter(g=>me(g.date)<xe):n.data.filter(g=>g.value!=null),W=xe?n.data.filter(g=>me(g.date)>=xe):n.data.filter(g=>g.forecast!=null);return e.jsxs("g",{children:[e.jsx("path",{className:"nice-forecast-chart__historical-line",d:be(D,"value"),stroke:n.color,strokeWidth:o}),e.jsx("path",{className:"nice-forecast-chart__forecast-line",d:be(W,xe?"value":"forecast"),stroke:n.color,strokeWidth:o}),W.length>0&&n.data.some(g=>g.forecast!=null)&&e.jsx("path",{className:"nice-forecast-chart__forecast-line",d:be(n.data,"forecast"),stroke:n.color,strokeWidth:o}),f&&n.data.map((g,G)=>{const oe=g.value??g.forecast;return oe==null?null:e.jsx("circle",{className:"nice-forecast-chart__point",cx:ae(me(g.date)),cy:X(oe),r:z,fill:n.color,onClick:()=>R?.(g,n)},G)})]},n.id)}),b.map(n=>{const D=ae(me(n.date));return e.jsxs("g",{className:"nice-forecast-chart__annotation-marker",onClick:()=>h?.(n),children:[n.showLine!==!1&&e.jsx("line",{className:"nice-forecast-chart__annotation-line",x1:D,x2:D,y1:j.top,y2:A.height-j.bottom,stroke:n.color??"var(--nice-text-muted, #9ca3af)"}),e.jsx("circle",{cx:D,cy:j.top+10,r:8,fill:n.color??"var(--nice-text-muted, #9ca3af)"}),e.jsx("text",{x:D,y:j.top+14,textAnchor:"middle",fill:"white",fontSize:"10",children:n.icon??"!"})]},n.id)}),e.jsx("line",{className:"nice-forecast-chart__axis-line",x1:j.left,x2:j.left,y1:j.top,y2:A.height-j.bottom}),e.jsx("line",{className:"nice-forecast-chart__axis-line",x1:j.left,x2:A.width-j.right,y1:A.height-j.bottom,y2:A.height-j.bottom}),te.map(n=>e.jsx("text",{className:"nice-forecast-chart__axis-label",x:j.left-8,y:X(n)+4,textAnchor:"end",children:p?.format?p.format(n):we(n,Z)},n)),ne.map(n=>e.jsx("text",{className:"nice-forecast-chart__axis-label",x:ae(n),y:A.height-j.bottom+16,textAnchor:"middle",children:k?.format?k.format(n):Ce(n,Z)},n.getTime())),p?.title&&e.jsx("text",{className:"nice-forecast-chart__axis-title",x:15,y:A.height/2,textAnchor:"middle",transform:`rotate(-90, 15, ${A.height/2})`,children:p.title})]}),ce&&e.jsxs("div",{className:"nice-forecast-chart__tooltip",style:{left:V.x,top:V.y},children:[e.jsx("div",{className:"nice-forecast-chart__tooltip-date",children:Ce(ce.date,Z)}),ce.values.map(n=>{const D=n.value??n.forecast;return D==null?null:e.jsxs("div",{className:"nice-forecast-chart__tooltip-item",children:[e.jsx("span",{className:"nice-forecast-chart__tooltip-color",style:{background:n.scenario.color}}),e.jsx("span",{className:"nice-forecast-chart__tooltip-label",children:n.scenario.name}),e.jsx("span",{className:"nice-forecast-chart__tooltip-value",children:we(D,Z)})]},n.scenario.id)}),ce.values.some(n=>n.lowerBound!=null)&&e.jsxs("div",{className:"nice-forecast-chart__tooltip-confidence",children:[U.confidence??"CI",":"," ",we(ce.values[0]?.lowerBound??0,Z)," –"," ",we(ce.values[0]?.upperBound??0,Z)]})]})]}),q.enabled&&e.jsx("div",{className:"nice-forecast-chart__legend",children:u.map(n=>e.jsxs("div",{className:`nice-forecast-chart__legend-item ${n.visible===!1?"nice-forecast-chart__legend-item--hidden":""}`,onClick:()=>d(n.id),children:[e.jsx("span",{className:`nice-forecast-chart__legend-color ${n.isBase?"":"nice-forecast-chart__legend-color--dashed"}`,style:{background:n.color}}),n.name]},n.id))})]})}),yt=[];function bt(t,s){const m=t?typeof t=="number"?new Date(t):new Date(t):new Date,r=T=>T.toString().padStart(2,"0"),i=r(m.getHours()),b=r(m.getMinutes()),M=r(m.getSeconds()),C=m.getMilliseconds().toString().padStart(3,"0");switch(s){case"HH:mm:ss":return`${i}:${b}:${M}`;case"HH:mm":return`${i}:${b}`;case"mm:ss":return`${b}:${M}`;case"ss.SSS":return`${M}.${C}`;case"ISO":return m.toISOString();default:return`${i}:${b}:${M}`}}function Re(t){if(t.length===0)return null;const s=Math.min(...t),m=Math.max(...t),r=t.reduce((b,M)=>b+M,0)/t.length,i=t[t.length-1];return{min:s,max:m,avg:r,current:i,count:t.length}}const _t=Object.assign(a.forwardRef(({series:t=yt,maxPoints:s=100,slidingWindow:m=!0,refreshRate:r=16,dataSource:i,width:b=600,height:M=400,title:C,showLegend:T=!0,showGrid:k=!0,yAxisLabel:p,xAxisLabel:N,stacked:E,zoomable:I,crosshair:w,annotations:l=[],legendInteractive:o,onDataPointClick:f,exportable:z,showControls:v=!0,showStatus:S=!0,initialPaused:$=!1,onDataReceived:L,onDataDropped:c,timeFormat:R="HH:mm:ss",showStats:h,thresholds:_=[],className:y,style:B},Y)=>{const[U,Z]=a.useState(()=>{const J=new Map;for(const d of t)J.set(d.name,d.initialData?.slice()??[]);return J}),[O,F]=a.useState([]),{t:H}=he.useNiceTranslation(),[q,u]=a.useState($),[re,ce]=a.useState(!1),ee=a.useRef([]),V=a.useRef(Date.now()),se=a.useRef(null),P=a.useRef(new Map),x=a.useRef(0),j=JSON.stringify(t.map(J=>J.name)),A=a.useMemo(()=>new Set(JSON.parse(j)),[j]),Q=a.useRef(q),ae=a.useRef(L),X=a.useRef(c);a.useEffect(()=>{Q.current=q,ae.current=L,X.current=c});const ie=a.useRef(null);ie.current===null&&(ie.current=new Map(t.map(J=>[J.name,J.initialData?.length??0])));const ue=a.useCallback(()=>{const J=ee.current;if(J.length===0)return;ee.current=[];const d=ie.current??new Map,K=[];for(const ne of J){const n=d.get(ne.series);n!==void 0&&(m&&n+1>s?(K.push([ne.series,n+1-s]),d.set(ne.series,s)):d.set(ne.series,n+1))}Z(ne=>{const n=new Map(ne);for(const D of J){const W=n.get(D.series);if(!W)continue;const g=[...W,D.value];m&&g.length>s&&g.splice(0,g.length-s),n.set(D.series,g)}return n});for(const[ne,n]of K)X.current?.(n,ne);const te=[];for(const ne of J){if(!A.has(ne.series))continue;const n=(P.current.get(ne.series)??0)+1;P.current.set(ne.series,n),n>x.current&&(x.current=n,te.push(ne.category??bt(ne.timestamp,R)))}te.length>0&&F(ne=>{const n=[...ne,...te];return m&&n.length>s&&n.splice(0,n.length-s),n})},[m,s,R,A]),ge=a.useCallback(()=>{const J=Date.now();J-V.current>=r&&(ue(),V.current=J),se.current=requestAnimationFrame(ge)},[r,ue]);a.useEffect(()=>(q||(se.current=requestAnimationFrame(ge)),()=>{se.current!==null&&(cancelAnimationFrame(se.current),se.current=null)}),[q,ge]);const xe=a.useCallback(J=>{if(Q.current)return;const d="points"in J?J.points:[J];for(const K of d)A.has(K.series)&&(ee.current.push(K),ae.current?.(K))},[A]);a.useEffect(()=>{if(!i)return;const J=i.subscribe(xe);let d;return i.onStatusChange?d=i.onStatusChange(ce):ce(!0),i.fetchHistory&&i.fetchHistory(s).then(K=>{for(const te of K)ee.current.push(te);ue()}),()=>{J(),d?.()}},[i,xe,s,ue]);const ve=a.useMemo(()=>t.map(J=>({name:J.name,color:J.color,type:J.type,data:U.get(J.name)??[]})),[t,U]),be=a.useMemo(()=>{const J=[...l];for(const d of _)J.push({type:"line",value:d.value,color:d.color,label:d.label,dash:d.style==="dashed"?"5,5":d.style==="dotted"?"2,2":void 0});return J},[l,_]);a.useImperativeHandle(Y,()=>({pause(){u(!0)},resume(){u(!1)},isPaused(){return q},clear(){Z(d=>{const K=new Map(d);for(const te of K.keys())K.set(te,[]);return K}),F([]),P.current=new Map,x.current=0,ee.current=[];const J=ie.current;if(J)for(const d of J.keys())J.set(d,0)},addPoint(J){xe(J)},addPoints(J){xe({points:J})},getData(J){return U.get(J)??[]},getCategories(){return O},exportData(){return{series:ve,categories:O}},getStats(J){const d=U.get(J);return d?Re(d):null}}),[q,U,O,ve,xe]);const _e=a.useMemo(()=>{if(!h)return null;const J={};for(const[d,K]of U)J[d]=Re(K);return J},[h,U]);return e.jsxs("div",{className:y,style:{position:"relative",...B},children:[S&&e.jsxs("div",{style:{position:"absolute",top:8,right:8,display:"flex",alignItems:"center",gap:4,fontSize:12,color:re?"var(--nice-color-success, #22c55e)":"var(--nice-color-error, #ef4444)",zIndex:10},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:re?"var(--nice-color-success, #22c55e)":"var(--nice-color-error, #ef4444)"}}),re?H("charts.live","Live"):H("charts.disconnected","Disconnected")]}),v&&e.jsx("div",{style:{position:"absolute",top:8,left:8,display:"flex",gap:4,zIndex:10},children:e.jsx("button",{onClick:()=>u(J=>!J),style:{padding:"4px 8px",fontSize:12,border:"1px solid var(--nice-border-color, #ddd)",borderRadius:4,background:q?"var(--nice-warning-bg, #fef3c7)":"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"},title:q?H("charts.resume","Resume"):H("charts.pause","Pause"),"aria-label":q?H("charts.resume","Resume"):H("charts.pause","Pause"),children:e.jsx(he.NiceIcon,{name:q?"play":"pause",size:14})})}),h&&_e&&e.jsx("div",{style:{position:"absolute",bottom:50,right:8,background:"color-mix(in srgb, var(--nice-bg-elevated, #fff) 92%, transparent)",color:"var(--nice-text-primary, #0f172a)",border:"1px solid var(--nice-border-color, #ddd)",borderRadius:4,padding:8,fontSize:11,zIndex:10},children:Object.entries(_e).map(([J,d])=>d?e.jsxs("div",{style:{marginBottom:4},children:[e.jsx("strong",{children:J}),e.jsxs("div",{children:[H("charts.stats.min","Min"),": ",d.min.toFixed(2)," |"," ",H("charts.stats.max","Max"),": ",d.max.toFixed(2)]}),e.jsxs("div",{children:[H("charts.stats.avg","Avg"),": ",d.avg.toFixed(2)," |"," ",H("charts.stats.now","Now"),": ",d.current.toFixed(2)]})]},J):null)}),e.jsx(ke,{series:ve,categories:O,width:b,height:M,title:C,showLegend:T,showGrid:k,yAxisLabel:p,xAxisLabel:N,stacked:E,zoomable:I,crosshair:w,annotations:be,legendInteractive:o,onDataPointClick:f,exportable:z})]})}),{displayName:"NiceLiveChart"});function jt(t){const{hubConnection:s,eventName:m="DataPoint",subscribeMethod:r="SubscribeToMetrics",historyMethod:i="GetMetricHistory",metricName:b}=t;return{subscribe(M){const C=T=>{M(T)};return s.on(m,C),s.state==="Connected"&&s.invoke(r,b).catch(()=>{}),()=>{s.off(m,C)}},async fetchHistory(M){try{return await s.invoke(i,b,M)}catch{return[]}},onStatusChange(M){const C=()=>M(s.state==="Connected");return s.onclose(()=>M(!1)),s.onreconnected(()=>M(!0)),C(),()=>{}}}}function Mt(t){const{url:s,autoReconnect:m=!0,reconnectDelay:r=3e3,parseMessage:i=p=>JSON.parse(p)}=t;let b=null,M=null,C=null,T=null;const k=()=>{b=new WebSocket(s),b.onopen=()=>{M?.(!0)},b.onclose=()=>{M?.(!1),m&&(T=setTimeout(k,r))},b.onerror=()=>{b?.close()},b.onmessage=p=>{try{const N=i(p.data);N&&C&&C(N)}catch{}}};return{subscribe(p){return C=p,k(),()=>{C=null,T&&clearTimeout(T),b?.close(),b=null}},onStatusChange(p){return M=p,()=>{M=null}}}}function Nt(t){const{seriesNames:s,interval:m=1e3,generateValue:r=()=>Math.random()*100}=t;let i=null,b=0;return{subscribe(M){return i=setInterval(()=>{for(const C of s)M({series:C,value:r(C,b),timestamp:Date.now()});b++},m),()=>{i&&clearInterval(i)}},onStatusChange(M){return M(!0),()=>{}}}}const wt=[];function kt(t){if(!t.length)return{categories:[],numericFields:[],sampleValues:{}};const s=t[0],m=[],r={};let i=null;for(const[M,C]of Object.entries(s))typeof C=="number"?(m.push(M),r[M]=t.map(T=>Number(T[M])||0)):!i&&(typeof C=="string"||C instanceof Date)&&(i=M);return{categories:i?t.map(M=>String(M[i]||"")):t.map((M,C)=>`Item ${C+1}`),numericFields:m,sampleValues:r}}function $t(t,s){const{categories:m,numericFields:r,sampleValues:i}=kt(t);return{series:r.map((M,C)=>({name:M.replace(/([A-Z])/g," $1").replace(/^./,T=>T.toUpperCase()).trim(),data:i[M],type:s==="area"?"area":s==="line"?"line":"bar"})),categories:m}}const St=a.forwardRef(function(s,m){const{rawData:r,enableAI:i=!0,aiModel:b,enableAutoType:M=!0,enableInsights:C=!0,dataDescription:T,onChartSuggestion:k,onInsights:p,showAIToolbar:N=!0,showInsightsOnLoad:E=!1,series:I=wt,categories:w,...l}=s,[o,f]=a.useState("bar"),[z,v]=a.useState(null),[S,$]=a.useState([]),[L,c]=a.useState(E),[R,h]=a.useState(null),{t:_}=Pe.useNiceTranslation(),y=he.useNiceAI(),{suggestChartType:B,generateInsights:Y,isLoading:U}=he.useChartSuggestion(),Z=i&&y.isConfigured,{series:O,categories:F}=r?$t(r,R||o):{series:I||[],categories:w},H=a.useCallback(async()=>{if(!Z||!M)return{type:"bar",reason:"Default",config:{}};const ee=r||(I?.length?I.flatMap(V=>V.data.map((se,P)=>({[V.name]:se,index:P}))):[]);try{const V=await B(ee,T),se={type:V.type,reason:V.reason,config:V.config};return v(se),f(se.type),k?.(se),se}catch{return{type:"bar",reason:"Default fallback",config:{}}}},[Z,M,r,I,T,B,k]),q=a.useCallback(async()=>{if(!Z||!C)return[];const ee=r||(I?.length?I.flatMap(V=>V.data.map((se,P)=>({[V.name]:se,category:w?.[P]||P}))):[]);try{const V=await Y(ee,R||o);return $(V),p?.(V),V}catch{return[]}},[Z,C,r,I,w,o,R,Y,p]),u=a.useCallback(()=>R||o,[R,o]);a.useEffect(()=>{Z&&M&&(r?.length||I?.length)&&H()},[Z,M,r,I]),a.useImperativeHandle(m,()=>({getSuggestion:H,generateInsights:q,getCurrentType:u}));const re=[{type:"bar",icon:"bar-chart",label:"Bar"},{type:"line",icon:"line-chart",label:"Line"},{type:"area",icon:"area-chart",label:"Area"},{type:"pie",icon:"pie-chart",label:"Pie"},{type:"donut",icon:"donut-chart",label:"Donut"},{type:"scatter",icon:"scatter-chart",label:"Scatter"}],ce=R||o;return e.jsxs("div",{className:"nice-chart-ai","data-testid":s["data-testid"],children:[N&&Z&&e.jsxs("div",{className:"nice-chart-ai__toolbar",children:[e.jsxs("div",{className:"nice-chart-ai__toolbar-left",children:[e.jsx("span",{className:"nice-chart-ai__badge",children:"AI"}),z&&e.jsxs("div",{className:"nice-chart-ai__suggestion",children:[e.jsx("span",{className:"nice-chart-ai__suggestion-icon",children:e.jsx(he.NiceIcon,{name:"lightbulb",size:14})}),e.jsxs("span",{className:"nice-chart-ai__suggestion-text",children:[_("chartAI.suggestedType","Suggested:")," ",z.type]}),e.jsxs("span",{className:"nice-chart-ai__suggestion-reason",title:z.reason,children:["(",z.reason,")"]})]}),U&&e.jsx("span",{className:"nice-chart-ai__loading",children:_("chartAI.analyzing","Analyzing...")})]}),e.jsx("div",{className:"nice-chart-ai__toolbar-center",children:e.jsx("div",{className:"nice-chart-ai__type-selector",children:re.filter(ee=>["bar","line","area"].includes(ee.type)).map(({type:ee,icon:V,label:se})=>e.jsx("button",{type:"button",className:`nice-chart-ai__type-btn ${ce===ee?"nice-chart-ai__type-btn--active":""}`,onClick:()=>h(ee),title:se,children:e.jsx(he.NiceIcon,{name:V,size:16})},ee))})}),e.jsxs("div",{className:"nice-chart-ai__toolbar-right",children:[e.jsxs("button",{type:"button",className:"nice-chart-ai__auto-btn",onClick:()=>H(),disabled:U,title:_("chartAI.autoDetect","Auto-detect best chart type"),children:[e.jsx(he.NiceIcon,{name:"zap",size:14})," ",_("chartAI.auto","Auto")]}),C&&e.jsxs("button",{type:"button",className:"nice-chart-ai__insights-btn",onClick:()=>{S.length||q(),c(!L)},disabled:U,title:_("chartAI.showInsights","Show data insights"),children:[e.jsx(he.NiceIcon,{name:"lightbulb",size:14})," ",_("chartAI.insights","Insights")]})]})]}),e.jsx("div",{className:"nice-chart-ai__chart-wrapper",children:e.jsx(ke,{series:O,categories:F,...l})}),L&&S.length>0&&e.jsxs("div",{className:"nice-chart-ai__insights",children:[e.jsxs("div",{className:"nice-chart-ai__insights-header",children:[e.jsxs("h4",{children:[e.jsx(he.NiceIcon,{name:"lightbulb",size:14})," ",_("chartAI.dataInsights","Data Insights")]}),e.jsx("button",{type:"button",className:"nice-chart-ai__insights-close",onClick:()=>c(!1),"aria-label":_("chartAI.close","Close"),children:e.jsx(he.NiceIcon,{name:"close",size:14})})]}),e.jsx("ul",{className:"nice-chart-ai__insights-list",children:S.map((ee,V)=>e.jsxs("li",{className:"nice-chart-ai__insight",children:[e.jsx("span",{className:"nice-chart-ai__insight-icon",children:"•"}),ee]},V))}),e.jsx("div",{className:"nice-chart-ai__insights-footer",children:e.jsxs("button",{type:"button",className:"nice-chart-ai__refresh",onClick:()=>q(),disabled:U,children:[e.jsx(he.NiceIcon,{name:"refresh",size:14})," ",_("chartAI.refresh","Refresh")]})})]}),L&&U&&e.jsx("div",{className:"nice-chart-ai__insights nice-chart-ai__insights--loading",children:e.jsxs("div",{className:"nice-chart-ai__loading-content",children:[e.jsx("span",{className:"nice-chart-ai__spinner"}),_("chartAI.generatingInsights","Generating insights...")]})})]})}),Ct=[],At=[],It=[],De=["var(--nice-color-primary, #3b82f6)","var(--nice-color-error, #ef4444)","var(--nice-color-success, #22c55e)","var(--nice-color-warning, #f59e0b)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-color-info, #06b6d4)","var(--nice-color-success, #10b981)","var(--nice-color-warning, #f59e0b)","var(--nice-color-accent, #6366f1)"],Rt=Object.assign(a.forwardRef((t,s)=>{const{t:m}=he.useNiceTranslation(),{levels:r=It,initialLevelId:i,levelId:b,chartType:M="bar",width:C=600,height:T=400,showBreadcrumbs:k=!0,showBackButton:p=!0,animationDuration:N=300,onLevelChange:E,onItemClick:I,colors:w=De,showValues:l=!0,showLegend:o=!0,className:f,style:z,...v}=t,S=b!==void 0,[$,L]=a.useState(i||r[0]?.id),[c,R]=a.useState([i||r[0]?.id]),h=a.useCallback(P=>{const x=[];let j=r.find(A=>A.id===P);for(;j&&!x.includes(j.id);){x.unshift(j.id);const A=j.parentId;j=A?r.find(Q=>Q.id===A):void 0}return x.length>0?x:[P]},[r]),_=b??$,y=a.useMemo(()=>b!==void 0?h(b):c,[b,c,h]),[B,Y]=a.useState(!1),[U,Z]=a.useState("in"),O=a.useMemo(()=>r.find(P=>P.id===_),[r,_]),F=a.useCallback(P=>{r.find(j=>j.id===P)&&(Z("in"),Y(!0),setTimeout(()=>{S||(L(P),R(j=>[...j,P])),E?.(P,S?h(P):[...y,P]),Y(!1)},N/2))},[r,y,N,E,S,h]),H=a.useCallback(()=>{if(y.length<=1)return;Z("out"),Y(!0);const P=y.slice(0,-1),x=P[P.length-1];setTimeout(()=>{S||(L(x),R(P)),E?.(x,P),Y(!1)},N/2)},[y,N,E,S]),q=a.useCallback(()=>{const P=r[0]?.id;P&&(Z("out"),Y(!0),setTimeout(()=>{S||(L(P),R([P])),E?.(P,[P]),Y(!1)},N/2))},[r,N,E,S]);a.useImperativeHandle(s,()=>({drillDown:F,drillUp:H,resetToRoot:q,getCurrentLevel:()=>_,getPath:()=>y}),[F,H,q,_,y]);const u=a.useCallback((P,x)=>{I?.(P,_);const j=r.find(A=>A.parentId===_&&A.id===P.metadata?.childLevelId);j&&F(j.id)},[_,r,F,I]),re=a.useMemo(()=>O?.data.reduce((P,x)=>P+x.value,0)||0,[O]),ce=a.useMemo(()=>y.map(P=>r.find(x=>x.id===P)?.label||P),[y,r]),ee=()=>{if(!O)return null;const P=O.data,x=Math.max(...P.map(A=>A.value)),j=Math.min(40,(T-100)/P.length-8);return e.jsx("div",{className:"nice-drilldown-bars",children:P.map((A,Q)=>{const ae=A.value/x*100;return e.jsxs("div",{className:"nice-drilldown-bar-row",onClick:()=>u(A,Q),children:[e.jsx("span",{className:"nice-drilldown-bar-label",children:A.label||`Item ${Q+1}`}),e.jsx("div",{className:"nice-drilldown-bar-track",children:e.jsx("div",{className:"nice-drilldown-bar-fill",style:{width:`${ae}%`,backgroundColor:A.color||w[Q%w.length],height:j}})}),l&&e.jsx("span",{className:"nice-drilldown-bar-value",children:A.value.toLocaleString()})]},Q)})})},V=()=>{if(!O)return null;const P=O.data,x=C/2,j=(T-60)/2+30,A=Math.min(x,j)-40;let Q=-90;const ae=P.map((X,ie)=>{const ue=X.value/re*360,ge=Q+ue,xe=ue>180?1:0,ve=Q*Math.PI/180,be=ge*Math.PI/180,_e=x+A*Math.cos(ve),J=j+A*Math.sin(ve),d=x+A*Math.cos(be),K=j+A*Math.sin(be),te=(Q+ue/2)*Math.PI/180,ne=x+A*.7*Math.cos(te),n=j+A*.7*Math.sin(te),D=`M ${x} ${j} L ${_e} ${J} A ${A} ${A} 0 ${xe} 1 ${d} ${K} Z`;return Q=ge,{path:D,color:X.color||w[ie%w.length],label:X.label||`Item ${ie+1}`,value:X.value,percentage:(X.value/re*100).toFixed(1),labelX:ne,labelY:n,item:X,index:ie}});return e.jsx("svg",{width:C,height:T-40,className:"nice-drilldown-pie",children:e.jsx("g",{children:ae.map((X,ie)=>e.jsxs("g",{onClick:()=>u(X.item,X.index),children:[e.jsx("path",{d:X.path,fill:X.color,stroke:"white",strokeWidth:2,className:"nice-drilldown-pie-slice"}),l&&parseFloat(X.percentage)>5&&e.jsxs("text",{x:X.labelX,y:X.labelY,textAnchor:"middle",dominantBaseline:"middle",fill:"white",fontSize:"12",fontWeight:"600",children:[X.percentage,"%"]})]},ie))})})},se=()=>{if(!O)return null;const P=O.data,x=Math.max(...P.map(Q=>Q.value)),j=Math.min(60,(C-100)/P.length-8),A=T-100;return e.jsx("svg",{width:C,height:T-40,className:"nice-drilldown-columns",children:e.jsxs("g",{transform:"translate(50, 20)",children:[[0,.25,.5,.75,1].map((Q,ae)=>e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:A*(1-Q),x2:C-80,y2:A*(1-Q),stroke:"var(--nice-border-color, #e5e7eb)",strokeDasharray:Q===0?void 0:"4"}),e.jsx("text",{x:-8,y:A*(1-Q),textAnchor:"end",dominantBaseline:"middle",fontSize:"11",fill:"var(--nice-text-secondary, #6b7280)",children:Math.round(x*Q).toLocaleString()})]},ae)),P.map((Q,ae)=>{const X=Q.value/x*A,ie=ae*((C-100)/P.length)+((C-100)/P.length-j)/2;return e.jsxs("g",{onClick:()=>u(Q,ae),children:[e.jsx("rect",{x:ie,y:A-X,width:j,height:X,fill:Q.color||w[ae%w.length],rx:4,className:"nice-drilldown-column-bar"}),e.jsx("text",{x:ie+j/2,y:A+16,textAnchor:"middle",fontSize:"11",fill:"var(--nice-text-primary, #374151)",children:(Q.label||`${ae+1}`).slice(0,10)}),l&&e.jsx("text",{x:ie+j/2,y:A-X-8,textAnchor:"middle",fontSize:"11",fill:"var(--nice-text-primary, #374151)",fontWeight:"500",children:Q.value.toLocaleString()})]},ae)})]})})};return e.jsxs("div",{className:`nice-drilldown-chart ${B?`animating ${U}`:""} ${f||""}`,style:{width:C,...z},...v,children:[e.jsxs("div",{className:"nice-drilldown-header",children:[p&&y.length>1&&e.jsxs("button",{className:"nice-drilldown-back",onClick:H,children:[e.jsx(he.NiceIcon,{name:"arrow-left",size:14})," ",m("charts.back","Back")]}),k&&e.jsx("div",{className:"nice-drilldown-breadcrumbs",children:ce.map((P,x)=>e.jsxs(a.Fragment,{children:[x>0&&e.jsx("span",{className:"nice-drilldown-separator",children:"/"}),e.jsx("span",{className:`nice-drilldown-crumb ${x===ce.length-1?"active":""}`,onClick:()=>{if(x<ce.length-1){const j=y.slice(0,x+1),A=j[j.length-1];S||(R(j),L(A)),E?.(A,j)}},children:P})]},x))})]}),e.jsxs("div",{className:"nice-drilldown-content",style:{height:T-40},children:[M==="bar"&&ee(),M==="pie"&&V(),M==="column"&&se()]}),o&&O&&e.jsx("div",{className:"nice-drilldown-legend",children:O.data.map((P,x)=>e.jsxs("div",{className:"nice-drilldown-legend-item",children:[e.jsx("span",{className:"nice-drilldown-legend-color",style:{backgroundColor:P.color||w[x%w.length]}}),e.jsx("span",{className:"nice-drilldown-legend-label",children:P.label||`Item ${x+1}`})]},x))}),e.jsx("style",{children:`
293
+ .nice-drilldown-chart {
294
+ font-family: inherit;
295
+ color: var(--nice-text-primary, #111827);
296
+ background: var(--nice-bg-elevated, #ffffff);
297
+ border-radius: 8px;
298
+ overflow: hidden;
299
+ }
300
+
301
+ .nice-drilldown-header {
302
+ display: flex;
303
+ align-items: center;
304
+ gap: 12px;
305
+ padding: 12px 16px;
306
+ border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
307
+ min-height: 40px;
308
+ }
309
+
310
+ .nice-drilldown-back {
311
+ background: var(--nice-bg-secondary, #f3f4f6);
312
+ border: none;
313
+ padding: 6px 12px;
314
+ border-radius: 6px;
315
+ cursor: pointer;
316
+ font-size: 13px;
317
+ font-family: inherit;
318
+ color: var(--nice-text-primary, #374151);
319
+ transition: background 0.2s;
320
+ }
321
+
322
+ .nice-drilldown-back:hover {
323
+ background: var(--nice-hover-bg, #e5e7eb);
324
+ }
325
+
326
+ .nice-drilldown-breadcrumbs {
327
+ display: flex;
328
+ align-items: center;
329
+ gap: 4px;
330
+ font-size: 13px;
331
+ font-family: inherit;
332
+ }
333
+
334
+ .nice-drilldown-separator {
335
+ color: var(--nice-text-muted, #9ca3af);
336
+ }
337
+
338
+ .nice-drilldown-crumb {
339
+ color: var(--nice-text-secondary, #6b7280);
340
+ cursor: pointer;
341
+ }
342
+
343
+ .nice-drilldown-crumb:hover:not(.active) {
344
+ color: var(--nice-color-primary, #3b82f6);
345
+ }
346
+
347
+ .nice-drilldown-crumb.active {
348
+ color: var(--nice-text-primary, #111827);
349
+ font-weight: 500;
350
+ cursor: default;
351
+ }
352
+
353
+ .nice-drilldown-content {
354
+ padding: 16px;
355
+ transition: opacity 0.15s, transform 0.15s;
356
+ }
357
+
358
+ .nice-drilldown-chart.animating .nice-drilldown-content {
359
+ opacity: 0;
360
+ }
361
+
362
+ .nice-drilldown-chart.animating.in .nice-drilldown-content {
363
+ transform: translateX(20px);
364
+ }
365
+
366
+ .nice-drilldown-chart.animating.out .nice-drilldown-content {
367
+ transform: translateX(-20px);
368
+ }
369
+
370
+ .nice-drilldown-bars {
371
+ display: flex;
372
+ flex-direction: column;
373
+ gap: 8px;
374
+ }
375
+
376
+ .nice-drilldown-bar-row {
377
+ display: flex;
378
+ align-items: center;
379
+ gap: 12px;
380
+ cursor: pointer;
381
+ padding: 4px 8px;
382
+ margin: -4px -8px;
383
+ border-radius: 6px;
384
+ transition: background 0.2s;
385
+ }
386
+
387
+ .nice-drilldown-bar-row:hover {
388
+ background: var(--nice-hover-bg, #f9fafb);
389
+ }
390
+
391
+ .nice-drilldown-bar-label {
392
+ width: 120px;
393
+ font-size: 13px;
394
+ font-family: inherit;
395
+ color: var(--nice-text-primary, #374151);
396
+ overflow: hidden;
397
+ text-overflow: ellipsis;
398
+ white-space: nowrap;
399
+ }
400
+
401
+ .nice-drilldown-bar-track {
402
+ flex: 1;
403
+ background: var(--nice-bg-tertiary, #f3f4f6);
404
+ border-radius: 6px;
405
+ overflow: hidden;
406
+ }
407
+
408
+ .nice-drilldown-bar-fill {
409
+ transition: width 0.3s ease;
410
+ border-radius: 6px;
411
+ }
412
+
413
+ .nice-drilldown-bar-value {
414
+ width: 80px;
415
+ text-align: right;
416
+ font-size: 13px;
417
+ font-family: inherit;
418
+ font-weight: 500;
419
+ color: var(--nice-text-primary, #111827);
420
+ }
421
+
422
+ .nice-drilldown-pie-slice {
423
+ cursor: pointer;
424
+ transition: transform 0.2s, opacity 0.2s;
425
+ transform-origin: center;
426
+ }
427
+
428
+ .nice-drilldown-pie-slice:hover {
429
+ opacity: 0.85;
430
+ transform: scale(1.02);
431
+ }
432
+
433
+ .nice-drilldown-column-bar {
434
+ cursor: pointer;
435
+ transition: opacity 0.2s;
436
+ }
437
+
438
+ .nice-drilldown-column-bar:hover {
439
+ opacity: 0.8;
440
+ }
441
+
442
+ .nice-drilldown-legend {
443
+ display: flex;
444
+ flex-wrap: wrap;
445
+ gap: 16px;
446
+ padding: 12px 16px;
447
+ border-top: 1px solid var(--nice-border-color, #e5e7eb);
448
+ }
449
+
450
+ .nice-drilldown-legend-item {
451
+ display: flex;
452
+ align-items: center;
453
+ gap: 6px;
454
+ }
455
+
456
+ .nice-drilldown-legend-color {
457
+ width: 12px;
458
+ height: 12px;
459
+ border-radius: 3px;
460
+ }
461
+
462
+ .nice-drilldown-legend-label {
463
+ font-size: 12px;
464
+ font-family: inherit;
465
+ color: var(--nice-text-secondary, #6b7280);
466
+ }
467
+ `})]})}),{displayName:"NiceDrillDownChart"}),Tt=["var(--nice-info-bg, #dbeafe)","var(--nice-color-primary-light, #93c5fd)","var(--nice-color-primary, #3b82f6)","var(--nice-color-primary-active, #1d4ed8)","var(--nice-color-primary, #6366f1)"],zt=({type:t="choropleth",regions:s=[],bubbles:m=[],width:r=800,height:i=500,viewBox:b="0 0 800 500",colorScale:M,colorRange:C,minValue:T,maxValue:k,showTooltip:p=!0,showLegend:N=!0,onRegionClick:E,onBubbleClick:I,onRegionHover:w,title:l,mapSvg:o,zoomable:f=!1,className:z,style:v,...S})=>{const $=M??C??Tt,{t:L}=he.useNiceTranslation(),[c,R]=a.useState(null),[h,_]=a.useState(1),[y,B]=a.useState({x:0,y:0}),Y=a.useRef(null),U=a.useRef(!1),Z=a.useRef({x:0,y:0}),O=T??Math.min(...s.map(x=>x.value),...m.map(x=>x.value)),F=k??Math.max(...s.map(x=>x.value),...m.map(x=>x.value)),H=a.useCallback(x=>{const j=(x-O)/(F-O),A=Math.min(Math.floor(j*$.length),$.length-1);return $[Math.max(0,A)]},[O,F,$]),q=a.useCallback(x=>{if(!p||!c)return;const j=Y.current?.getBoundingClientRect();j&&R(A=>A?{...A,x:x.clientX-j.left,y:x.clientY-j.top}:null)},[p,c]),u=a.useCallback((x,j)=>{const A=Y.current?.getBoundingClientRect();A&&p&&R({x:j.clientX-A.left,y:j.clientY-A.top,content:`${x.name}: ${x.value.toLocaleString()}`}),w?.(x)},[p,w]),re=a.useCallback(()=>{R(null),w?.(null)},[w]),ce=a.useCallback(x=>{if(!f)return;x.preventDefault();const j=x.deltaY>0?.9:1.1;_(A=>Math.min(Math.max(A*j,.5),4))},[f]),ee=a.useCallback(x=>{f&&(U.current=!0,Z.current={x:x.clientX-y.x,y:x.clientY-y.y})},[f,y]),V=a.useCallback(()=>{U.current=!1},[]),se=a.useCallback(x=>{U.current&&B({x:x.clientX-Z.current.x,y:x.clientY-Z.current.y})},[]),P=a.useMemo(()=>s.length>0?s:[{id:"mazowieckie",name:"Mazowieckie",value:100,path:"M400,200 L450,200 L460,250 L420,280 L380,250 Z"},{id:"slaskie",name:"Śląskie",value:80,path:"M350,280 L400,280 L390,330 L340,320 Z"},{id:"wielkopolskie",name:"Wielkopolskie",value:70,path:"M300,200 L350,200 L360,260 L310,270 L280,230 Z"}],[s]);return e.jsxs("div",{className:`nice-map-chart ${z||""}`,style:{width:r,...v},...S,children:[l&&e.jsx("div",{className:"nice-map-title",children:l}),e.jsx("svg",{ref:Y,width:r,height:i,viewBox:b,className:"nice-map-svg",onWheel:ce,onMouseDown:ee,onMouseUp:V,onMouseLeave:V,onMouseMove:x=>{q(x),se(x)},children:e.jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${h})`,children:[o&&e.jsx("g",{dangerouslySetInnerHTML:{__html:o}}),t==="choropleth"&&P.map(x=>e.jsx("path",{d:x.path,fill:x.color||H(x.value),stroke:"var(--nice-bg-primary, #ffffff)",strokeWidth:1,className:"nice-map-region",onClick:()=>E?.(x),onMouseEnter:j=>u(x,j),onMouseLeave:re},x.id)),(t==="bubble"||m.length>0)&&m.map(x=>{const j=Math.sqrt((x.value-O)/(F-O))*30+5;return e.jsx("circle",{cx:x.lng,cy:x.lat,r:j,fill:x.color||"var(--nice-color-primary, #3b82f6)",fillOpacity:.7,stroke:"var(--nice-bg-primary, #ffffff)",strokeWidth:1,className:"nice-map-bubble",onClick:()=>I?.(x),onMouseEnter:A=>{const Q=Y.current?.getBoundingClientRect();Q&&p&&R({x:A.clientX-Q.left,y:A.clientY-Q.top,content:`${x.label||x.id}: ${x.value.toLocaleString()}`})},onMouseLeave:re,children:x.label&&e.jsxs("title",{children:[x.label,": ",x.value]})},x.id)})]})}),c&&e.jsx("div",{className:"nice-map-tooltip",style:{left:c.x+10,top:c.y-30},children:c.content}),N&&e.jsxs("div",{className:"nice-map-legend",children:[e.jsx("span",{className:"nice-map-legend-title",children:L("charts.value","Value")}),e.jsx("div",{className:"nice-map-legend-scale",children:$.map((x,j)=>e.jsx("div",{className:"nice-map-legend-item",style:{backgroundColor:x}},j))}),e.jsxs("div",{className:"nice-map-legend-labels",children:[e.jsx("span",{children:O.toLocaleString()}),e.jsx("span",{children:F.toLocaleString()})]})]}),e.jsx("style",{children:`
468
+ .nice-map-chart {
469
+ font-family: system-ui, -apple-system, sans-serif;
470
+ background: var(--nice-bg-primary, #ffffff);
471
+ border-radius: var(--nice-radius-lg, 8px);
472
+ overflow: hidden;
473
+ position: relative;
474
+ }
475
+
476
+ .nice-map-title {
477
+ padding: var(--nice-space-3, 12px) var(--nice-space-4, 16px);
478
+ font-size: 16px;
479
+ font-weight: 600;
480
+ color: var(--nice-text-primary, #0f172a);
481
+ border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
482
+ }
483
+
484
+ .nice-map-svg {
485
+ display: block;
486
+ cursor: grab;
487
+ }
488
+
489
+ .nice-map-svg:active {
490
+ cursor: grabbing;
491
+ }
492
+
493
+ .nice-map-region {
494
+ cursor: pointer;
495
+ transition: opacity 0.2s, stroke-width 0.2s;
496
+ }
497
+
498
+ .nice-map-region:hover {
499
+ opacity: 0.8;
500
+ stroke-width: 2;
501
+ }
502
+
503
+ .nice-map-bubble {
504
+ cursor: pointer;
505
+ transition: transform 0.2s, opacity 0.2s;
506
+ }
507
+
508
+ .nice-map-bubble:hover {
509
+ opacity: 1;
510
+ transform: scale(1.1);
511
+ }
512
+
513
+ .nice-map-tooltip {
514
+ position: absolute;
515
+ /* audit-allow: token-role — inverted chip like .nice-tooltip: the text colour is the
516
+ fill and the label uses --nice-text-inverse, so the pair flips together. */
517
+ background: var(--nice-text-primary, #0f172a);
518
+ color: var(--nice-text-inverse, #ffffff);
519
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
520
+ border-radius: var(--nice-radius-sm, 4px);
521
+ font-size: 12px;
522
+ pointer-events: none;
523
+ z-index: 10;
524
+ white-space: nowrap;
525
+ }
526
+
527
+ .nice-map-legend {
528
+ position: absolute;
529
+ right: 16px;
530
+ bottom: 16px;
531
+ background: var(--nice-bg-elevated, #ffffff);
532
+ padding: var(--nice-space-3, 12px);
533
+ border-radius: var(--nice-radius-md, 6px);
534
+ box-shadow: 0 2px 8px var(--nice-overlay-10, color-mix(in srgb, var(--nice-text-primary, #000) 10%, transparent));
535
+ }
536
+
537
+ .nice-map-legend-title {
538
+ display: block;
539
+ font-size: 11px;
540
+ color: var(--nice-text-secondary, #475569);
541
+ margin-bottom: var(--nice-space-1-5, 6px);
542
+ }
543
+
544
+ .nice-map-legend-scale {
545
+ display: flex;
546
+ height: 12px;
547
+ border-radius: var(--nice-radius-sm, 2px);
548
+ overflow: hidden;
549
+ }
550
+
551
+ .nice-map-legend-item {
552
+ flex: 1;
553
+ min-width: 24px;
554
+ }
555
+
556
+ .nice-map-legend-labels {
557
+ display: flex;
558
+ justify-content: space-between;
559
+ font-size: 10px;
560
+ color: var(--nice-text-secondary, #475569);
561
+ margin-top: var(--nice-space-1, 4px);
562
+ }
563
+ `})]})},Lt=({nodes:t=Ct,links:s=At,width:m=800,height:r=500,nodeWidth:i=20,nodePadding:b=10,showValues:M=!0,showTooltip:C=!0,onNodeClick:T,onLinkClick:k,title:p,className:N,style:E,...I})=>{const[w,l]=a.useState(null),o=a.useRef(null),f=a.useMemo(()=>{const v=new Map;t.forEach(u=>v.set(u.id,u));const S=new Set(s.map(u=>u.target)),$=new Set(s.map(u=>u.source)),L=[],c=new Map,R=t.filter(u=>$.has(u.id)&&!S.has(u.id));R.length>0&&(L.push(R.map(u=>u.id)),R.forEach(u=>c.set(u.id,0)));const h=t.filter(u=>$.has(u.id)&&S.has(u.id));h.length>0&&(L.push(h.map(u=>u.id)),h.forEach(u=>c.set(u.id,1)));const _=t.filter(u=>!$.has(u.id)&&S.has(u.id));_.length>0&&(L.push(_.map(u=>u.id)),_.forEach(u=>c.set(u.id,2))),L.length===0&&(L.push(t.map(u=>u.id)),t.forEach(u=>c.set(u.id,0)));const y=new Map;s.forEach(u=>{y.set(u.source,(y.get(u.source)||0)+u.value),y.set(u.target,(y.get(u.target)||0)+u.value)});const B=40,Y=m-B*2,U=r-B*2,Z=L.length>1?Y/(L.length-1):Y,O=new Map;Math.max(...Array.from(y.values())),L.forEach((u,re)=>{const ce=u.reduce((se,P)=>se+(y.get(P)||0),0),ee=(U-(u.length-1)*b)/ce;let V=B;u.forEach(se=>{const x=(y.get(se)||0)*ee,j=B+re*Z;O.set(se,{x:j,y:V,height:x}),V+=x+b})});const F=[],H=new Map,q=new Map;return s.forEach(u=>{const re=O.get(u.source),ce=O.get(u.target);if(!re||!ce)return;const ee=y.get(u.source)||1;y.get(u.target);const V=u.value/ee*re.height,se=re.y+(H.get(u.source)||0),P=ce.y+(q.get(u.target)||0);H.set(u.source,(H.get(u.source)||0)+V),q.set(u.target,(q.get(u.target)||0)+V);const x=re.x+i,j=ce.x,A=(j-x)*.5,Q=`
564
+ M ${x} ${se}
565
+ C ${x+A} ${se},
566
+ ${j-A} ${P},
567
+ ${j} ${P}
568
+ L ${j} ${P+V}
569
+ C ${j-A} ${P+V},
570
+ ${x+A} ${se+V},
571
+ ${x} ${se+V}
572
+ Z
573
+ `;F.push({path:Q,link:u,sourcePos:re,targetPos:ce})}),{nodePositions:O,linkPaths:F,nodeMap:v,nodeValues:y}},[t,s,m,r,i,b]),z=a.useCallback((v,S)=>{const $=o.current?.getBoundingClientRect();$&&C&&l({x:S.clientX-$.left,y:S.clientY-$.top,content:v})},[C]);return e.jsxs("div",{className:`nice-sankey-chart ${N||""}`,style:{width:m,...E},...I,children:[p&&e.jsx("div",{className:"nice-sankey-title",children:p}),e.jsxs("svg",{ref:o,width:m,height:r,className:"nice-sankey-svg",children:[e.jsx("defs",{children:f.linkPaths.map((v,S)=>e.jsxs("linearGradient",{id:`sankey-gradient-${S}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[e.jsx("stop",{offset:"0%",stopColor:f.nodeMap.get(v.link.source)?.color||"var(--nice-color-primary, #3b82f6)"}),e.jsx("stop",{offset:"100%",stopColor:f.nodeMap.get(v.link.target)?.color||"var(--nice-color-error, #ef4444)"})]},S))}),e.jsx("g",{className:"nice-sankey-links",children:f.linkPaths.map((v,S)=>e.jsx("path",{d:v.path,fill:v.link.color||`url(#sankey-gradient-${S})`,fillOpacity:.4,className:"nice-sankey-link",onClick:()=>k?.(v.link),onMouseEnter:$=>z(`${f.nodeMap.get(v.link.source)?.name} → ${f.nodeMap.get(v.link.target)?.name}: ${v.link.value.toLocaleString()}`,$),onMouseLeave:()=>l(null)},S))}),e.jsx("g",{className:"nice-sankey-nodes",children:Array.from(f.nodePositions.entries()).map(([v,S])=>{const $=f.nodeMap.get(v);return $?e.jsxs("g",{children:[e.jsx("rect",{x:S.x,y:S.y,width:i,height:S.height,fill:$.color||"var(--nice-color-primary, #3b82f6)",rx:2,className:"nice-sankey-node",onClick:()=>T?.($),onMouseEnter:L=>z(`${$.label??$.name??$.id}: ${f.nodeValues.get(v)?.toLocaleString()||0}`,L),onMouseLeave:()=>l(null)}),e.jsxs("text",{x:S.x+i+6,y:S.y+S.height/2,dominantBaseline:"middle",fontSize:"12",fill:"var(--nice-text-primary, #0f172a)",children:[$.label??$.name??$.id,M&&` (${f.nodeValues.get(v)?.toLocaleString()||0})`]})]},v):null})})]}),w&&e.jsx("div",{className:"nice-sankey-tooltip",style:{left:w.x+10,top:w.y-30},children:w.content}),e.jsx("style",{children:`
574
+ .nice-sankey-chart {
575
+ font-family: system-ui, -apple-system, sans-serif;
576
+ background: var(--nice-bg-primary, #ffffff);
577
+ border-radius: var(--nice-radius-lg, 8px);
578
+ position: relative;
579
+ }
580
+
581
+ .nice-sankey-title {
582
+ padding: var(--nice-space-3, 12px) var(--nice-space-4, 16px);
583
+ font-size: 16px;
584
+ font-weight: 600;
585
+ color: var(--nice-text-primary, #0f172a);
586
+ border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
587
+ }
588
+
589
+ .nice-sankey-link {
590
+ cursor: pointer;
591
+ transition: fill-opacity 0.2s;
592
+ }
593
+
594
+ .nice-sankey-link:hover {
595
+ fill-opacity: 0.7;
596
+ }
597
+
598
+ .nice-sankey-node {
599
+ cursor: pointer;
600
+ transition: opacity 0.2s;
601
+ }
602
+
603
+ .nice-sankey-node:hover {
604
+ opacity: 0.8;
605
+ }
606
+
607
+ .nice-sankey-tooltip {
608
+ position: absolute;
609
+ /* audit-allow: token-role — inverted chip like .nice-tooltip: the text colour is the
610
+ fill and the label uses --nice-text-inverse, so the pair flips together. */
611
+ background: var(--nice-text-primary, #0f172a);
612
+ color: var(--nice-text-inverse, #ffffff);
613
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
614
+ border-radius: var(--nice-radius-sm, 4px);
615
+ font-size: 12px;
616
+ pointer-events: none;
617
+ z-index: 10;
618
+ white-space: nowrap;
619
+ }
620
+ `})]})},Dt=Object.assign(a.forwardRef((t,s)=>{const{t:m}=he.useNiceTranslation(),{initialData:r,data:i,maxPoints:b=60,updateInterval:M=1e3,fetchData:C,width:T=600,height:k=200,chartType:p="line",color:N="var(--nice-color-primary, #3b82f6)",showGrid:E=!0,showTimeAxis:I=!0,showCurrentValue:w=!0,title:l,valueFormatter:o=X=>X.toFixed(2),timeFormatter:f=X=>new Date(X).toLocaleTimeString(),onDataUpdate:z,paused:v,className:S,style:$,...L}=t,[c,R]=a.useState(r??i??[]),[h,_]=a.useState(v||!1),y=a.useRef(void 0);a.useEffect(()=>{v!==void 0&&_(v)},[v]),a.useEffect(()=>{if(h||!C)return;const X=async()=>{try{const ie=await C();R(ue=>{const ge=[...ue,ie].slice(-b);return z?.(ge),ge})}catch(ie){console.error("Failed to fetch realtime data:",ie)}};return y.current=setInterval(X,M),()=>{y.current&&clearInterval(y.current)}},[h,C,M,b,z]);const B=a.useCallback(X=>{R(ie=>{const ue=[...ie,X].slice(-b);return z?.(ue),ue})},[b,z]),Y=a.useCallback(()=>{R([]),z?.([])},[z]),U=a.useCallback(()=>_(!0),[]),Z=a.useCallback(()=>_(!1),[]);a.useImperativeHandle(s,()=>({addDataPoint:B,clearData:Y,pause:U,resume:Z,getData:()=>c}),[B,Y,c]);const O={top:20,right:60,bottom:I?40:20,left:50},F=T-O.left-O.right,H=k-O.top-O.bottom,q=c.map(X=>X.value),u=q.length?Math.min(...q):0,re=q.length?Math.max(...q):100,ee=(re-u||1)*.1,V=u-ee,P=re+ee-V,x=X=>{const ie=C?b-1:Math.max(1,c.length-1);return O.left+X/ie*F},j=X=>O.top+H-(X-V)/P*H,A=c.map((X,ie)=>`${x(ie)},${j(X.value)}`).join(" "),Q=c.length>0?`M ${x(0)},${O.top+H} L ${A} L ${x(c.length-1)},${O.top+H} Z`:"",ae=c.length>0?c[c.length-1].value:null;return e.jsxs("div",{className:`nice-realtime-chart ${S||""}`,style:{width:T,...$},...L,children:[e.jsxs("div",{className:"nice-realtime-header",children:[e.jsx("span",{className:"nice-realtime-title",children:l}),e.jsxs("div",{className:"nice-realtime-controls",children:[e.jsxs("span",{className:`nice-realtime-status ${h?"paused":"live"}`,children:[e.jsx("span",{className:"nice-realtime-status-dot"}),e.jsx("span",{children:h?m("charts.paused","Paused"):m("charts.live","Live")})]}),e.jsx("button",{className:`nice-realtime-btn ${h?"paused":""}`,onClick:()=>_(!h),"aria-label":h?m("charts.resume","Resume"):m("charts.pause","Pause"),children:e.jsx(he.NiceIcon,{name:h?"play":"pause",size:14})}),w&&ae!==null&&e.jsx("span",{className:"nice-realtime-value",children:o(ae)})]})]}),e.jsxs("svg",{width:T,height:k,className:"nice-realtime-svg",children:[E&&e.jsx("g",{className:"nice-realtime-grid",children:[0,.25,.5,.75,1].map((X,ie)=>{const ue=O.top+H*(1-X),ge=V+P*X;return e.jsxs("g",{children:[e.jsx("line",{x1:O.left,y1:ue,x2:T-O.right,y2:ue,stroke:"var(--nice-border-color, #e5e7eb)",strokeDasharray:X===0?void 0:"3"}),e.jsx("text",{x:O.left-8,y:ue,textAnchor:"end",dominantBaseline:"middle",fontSize:"10",fill:"var(--nice-text-secondary, #6b7280)",children:Math.round(ge).toLocaleString()})]},ie)})}),p==="area"&&c.length>0&&e.jsx("path",{d:Q,fill:N,fillOpacity:.2}),c.length>1&&e.jsx("polyline",{points:A,fill:"none",stroke:N,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),c.length>0&&e.jsx("circle",{cx:x(c.length-1),cy:j(c[c.length-1].value),r:3,fill:N,className:"nice-realtime-point"}),I&&c.length>0&&e.jsx("g",{className:"nice-realtime-time-axis",children:Array.from(new Set([0,Math.floor(c.length/2),c.length-1].filter(X=>c[X]))).map(X=>e.jsx("text",{x:x(X),y:k-8,textAnchor:"middle",fontSize:"10",fill:"var(--nice-text-secondary, #6b7280)",children:f(c[X].timestamp)},`tx-${X}`))})]}),e.jsx("style",{children:`
621
+ .nice-realtime-chart {
622
+ font-family: inherit;
623
+ color: var(--nice-text-primary, #111827);
624
+ background: var(--nice-bg-elevated, #ffffff);
625
+ border-radius: 8px;
626
+ position: relative;
627
+ }
628
+
629
+ .nice-realtime-header {
630
+ display: flex;
631
+ justify-content: space-between;
632
+ align-items: center;
633
+ padding: 12px 16px;
634
+ border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
635
+ }
636
+
637
+ .nice-realtime-title {
638
+ font-size: 14px;
639
+ font-weight: 600;
640
+ color: var(--nice-text-primary, #111827);
641
+ }
642
+
643
+ .nice-realtime-controls {
644
+ display: flex;
645
+ align-items: center;
646
+ gap: 12px;
647
+ }
648
+
649
+ .nice-realtime-btn {
650
+ background: none;
651
+ border: none;
652
+ cursor: pointer;
653
+ font-size: 16px;
654
+ padding: 4px;
655
+ font-family: inherit;
656
+ color: inherit;
657
+ }
658
+
659
+ .nice-realtime-value {
660
+ font-size: 18px;
661
+ font-weight: 600;
662
+ color: ${N};
663
+ font-variant-numeric: tabular-nums;
664
+ }
665
+
666
+ /* Static current-value dot — no pulsing animation (was distracting) */
667
+
668
+ .nice-realtime-status {
669
+ display: inline-flex;
670
+ align-items: center;
671
+ gap: 6px;
672
+ font-size: 11px;
673
+ font-family: inherit;
674
+ color: var(--nice-text-secondary, #6b7280);
675
+ background: var(--nice-bg-secondary, #f3f4f6);
676
+ padding: 2px 10px;
677
+ border-radius: 999px;
678
+ }
679
+
680
+ .nice-realtime-status-dot {
681
+ width: 8px;
682
+ height: 8px;
683
+ border-radius: 50%;
684
+ background: var(--nice-color-success, #22c55e);
685
+ }
686
+
687
+ .nice-realtime-status.paused .nice-realtime-status-dot {
688
+ background: var(--nice-color-warning, #f59e0b);
689
+ }
690
+
691
+ .nice-realtime-status.live .nice-realtime-status-dot {
692
+ animation: live-pulse 2s ease-in-out infinite;
693
+ }
694
+
695
+ @keyframes live-pulse {
696
+ 0%, 100% { opacity: 1; }
697
+ 50% { opacity: 0.4; }
698
+ }
699
+ `})]})}),{displayName:"NiceRealtimeChart"}),Et=({data:t,width:s=600,height:m=400,showLabels:r=!0,showValues:i=!0,onNodeClick:b,drilldownEnabled:M=!0,colors:C=De,tilePadding:T=2,className:k,style:p,...N})=>{const{t:E}=he.useNiceTranslation(),I=a.useMemo(()=>Array.isArray(t)?{id:"root",name:"Root",value:t.reduce((_,y)=>_+(y.value||0),0),children:t.map((_,y)=>({id:`${y}`,name:_.label??_.name??`Item ${y+1}`,value:_.value,color:_.color}))}:t,[t]),[w,l]=a.useState(I),[o,f]=a.useState([I.name]),[z,v]=a.useState(null),S=a.useRef(null),$=a.useMemo(()=>{const y=w.children||[];if(y.length===0)return[];const B=y.reduce((u,re)=>u+re.value,0),Y=y.map(u=>({node:u,area:u.value/B*s*m}));Y.sort((u,re)=>re.area-u.area);const U=[];let Z=0,O=0,F=s,H=m,q=0;for(;q<Y.length;){const u=F<H;let re=0,ce=[];const ee=u?H:F;for(let P=q;P<Y.length;P++){const x=[...ce,Y[P]],j=x.reduce((Q,ae)=>Q+ae.area,0),A=L(x,j,ee);if(ce.length===0)ce=x,re=j;else{const Q=L(ce,re,ee);if(A<=Q)ce=x,re=j;else break}}const V=re/ee;let se=0;ce.forEach((P,x)=>{const j=P.area/V;U.push({node:P.node,x:u?Z:Z+se,y:u?O+se:O,w:u?V:j,h:u?j:V,color:P.node.color||C[(q+x)%C.length]}),se+=j}),u?(Z+=V,F-=V):(O+=V,H-=V),q+=ce.length}return U},[w,s,m,C]);function L(_,y,B){const Y=y/B;let U=0;for(const Z of _){const O=Z.area/Y,F=Math.max(Y/O,O/Y);U=Math.max(U,F)}return U}const c=_=>{b?.(_,[...o,_.name]),M&&_.children&&_.children.length>0&&(l(_),f(y=>[...y,_.name]))},R=()=>{if(o.length<=1)return;let _=I;const y=o.slice(0,-1);for(let B=1;B<y.length;B++){const Y=_.children?.find(U=>U.name===y[B]);Y&&(_=Y)}l(_),f(y)},h=(_,y)=>{const B=S.current?.getBoundingClientRect();B&&v({x:y.clientX-B.left,y:y.clientY-B.top,content:_})};return e.jsxs("div",{className:`nice-treemap-chart ${k||""}`,style:{width:s,...p},...N,children:[e.jsxs("div",{className:"nice-treemap-nav",children:[o.length>1&&e.jsxs("button",{className:"nice-treemap-back",onClick:R,children:[e.jsx(he.NiceIcon,{name:"arrow-left",size:14})," ",E("charts.back","Back")]}),e.jsx("div",{className:"nice-treemap-breadcrumbs",children:o.map((_,y)=>e.jsxs(a.Fragment,{children:[y>0&&e.jsx("span",{className:"nice-treemap-sep",children:"/"}),e.jsx("span",{className:y===o.length-1?"current":"",children:_})]},y))})]}),e.jsx("svg",{ref:S,width:s,height:m,className:"nice-treemap-svg",children:$.map((_,y)=>{const{node:B,x:Y,y:U,w:Z,h:O,color:F}=_,H=Math.min(14,Math.max(10,Math.min(Z,O)/6)),q=Z>40&&O>30;return e.jsxs("g",{onClick:()=>c(B),onMouseEnter:u=>h(`${B.name}: ${B.value.toLocaleString()}`,u),onMouseLeave:()=>v(null),children:[e.jsx("rect",{x:Y+T/2,y:U+T/2,width:Math.max(0,Z-T),height:Math.max(0,O-T),fill:F,rx:4,className:"nice-treemap-tile"}),r&&q&&e.jsx("text",{x:Y+Z/2,y:U+O/2-(i?6:0),textAnchor:"middle",dominantBaseline:"middle",fontSize:H,fill:"white",fontWeight:"500",style:{pointerEvents:"none"},children:B.name.length>Z/H+2?B.name.slice(0,Math.floor(Z/H))+"...":B.name}),i&&q&&e.jsx("text",{x:Y+Z/2,y:U+O/2+10,textAnchor:"middle",dominantBaseline:"middle",fontSize:H-2,fill:"var(--nice-overlay-light-80, rgba(255, 255, 255, 0.8))",style:{pointerEvents:"none"},children:B.value.toLocaleString()})]},y)})}),z&&e.jsx("div",{className:"nice-treemap-tooltip",style:{left:z.x+10,top:z.y-30},children:z.content}),e.jsx("style",{children:`
700
+ .nice-treemap-chart {
701
+ font-family: system-ui, -apple-system, sans-serif;
702
+ background: var(--nice-bg-primary, #ffffff);
703
+ border-radius: var(--nice-radius-lg, 8px);
704
+ position: relative;
705
+ }
706
+
707
+ .nice-treemap-nav {
708
+ display: flex;
709
+ align-items: center;
710
+ gap: var(--nice-space-3, 12px);
711
+ padding: var(--nice-space-3, 12px) var(--nice-space-4, 16px);
712
+ border-bottom: 1px solid var(--nice-border-color, #e5e7eb);
713
+ }
714
+
715
+ .nice-treemap-back {
716
+ background: var(--nice-bg-secondary, #f8fafc);
717
+ color: var(--nice-text-primary, #0f172a);
718
+ border: none;
719
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-3, 12px);
720
+ border-radius: var(--nice-radius-md, 6px);
721
+ cursor: pointer;
722
+ font-size: 13px;
723
+ }
724
+
725
+ .nice-treemap-back:hover {
726
+ background: var(--nice-border-color, #e5e7eb);
727
+ }
728
+
729
+ .nice-treemap-breadcrumbs {
730
+ display: flex;
731
+ align-items: center;
732
+ gap: var(--nice-space-1, 4px);
733
+ font-size: 13px;
734
+ color: var(--nice-text-secondary, #475569);
735
+ }
736
+
737
+ .nice-treemap-breadcrumbs .current {
738
+ color: var(--nice-text-primary, #0f172a);
739
+ font-weight: 500;
740
+ }
741
+
742
+ .nice-treemap-sep {
743
+ color: var(--nice-text-muted, #94a3b8);
744
+ }
745
+
746
+ .nice-treemap-tile {
747
+ cursor: pointer;
748
+ transition: opacity 0.2s, transform 0.1s;
749
+ }
750
+
751
+ .nice-treemap-tile:hover {
752
+ opacity: 0.85;
753
+ }
754
+
755
+ .nice-treemap-tooltip {
756
+ position: absolute;
757
+ /* audit-allow: token-role — inverted chip like .nice-tooltip: the text colour is the
758
+ fill and the label uses --nice-text-inverse, so the pair flips together. */
759
+ background: var(--nice-text-primary, #0f172a);
760
+ color: var(--nice-text-inverse, #ffffff);
761
+ padding: var(--nice-space-1-5, 6px) var(--nice-space-2-5, 10px);
762
+ border-radius: var(--nice-radius-sm, 4px);
763
+ font-size: 12px;
764
+ pointer-events: none;
765
+ z-index: 10;
766
+ white-space: nowrap;
767
+ }
768
+ `})]})};exports.CHART_COLORS=pe;exports.NiceBarGauge=He;exports.NiceBullet=Xe;exports.NiceChart=ke;exports.NiceChart$1=Oe;exports.NiceChartAI=St;exports.NiceCircularGauge=We;exports.NiceDrillDownChart=Rt;exports.NiceForecastChart=vt;exports.NiceFunnel=qe;exports.NiceHeatMap=Qe;exports.NiceLinearGauge=Ye;exports.NiceLiveChart=_t;exports.NiceMapChart=zt;exports.NiceOrganizationChart=ot;exports.NicePieChart=Ue;exports.NicePolarChart=mt;exports.NiceRangeSelector=pt;exports.NiceRealtimeChart=Dt;exports.NiceSankey=Te;exports.NiceSankey$1=nt;exports.NiceSankeyChart=Lt;exports.NiceSparkline=ut;exports.NiceStockChart=dt;exports.NiceTreeMap=ze;exports.NiceTreeMap$1=ct;exports.NiceTreeMapChart=Et;exports.NiceVectorMap=Le;exports.NiceVectorMap$1=it;exports.createMockLiveChartSource=Nt;exports.createSignalRLiveChartSource=jt;exports.createWebSocketLiveChartSource=Mt;