@tabler/charts 0.2.0 → 0.4.0

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 (420) hide show
  1. package/README.md +165 -17
  2. package/dist/{annotations-DdRdeBUB.cjs → annotations--m-HzMBM.cjs} +87 -11
  3. package/dist/annotations--m-HzMBM.cjs.map +1 -0
  4. package/dist/{annotations-B02GR_KU.d.ts → annotations-CCDUC1lW.d.ts} +16 -30
  5. package/dist/{annotations-CHafaGd4.d.cts → annotations-CqZM1z9R.d.cts} +16 -30
  6. package/dist/{annotations-D0YQ0IoA.js → annotations-DGITy6th.js} +87 -11
  7. package/dist/annotations-DGITy6th.js.map +1 -0
  8. package/dist/annotations.cjs +2 -2
  9. package/dist/annotations.d.cts +1 -1
  10. package/dist/annotations.d.ts +1 -1
  11. package/dist/annotations.js +2 -2
  12. package/dist/{area-0-L1bG9B.js → area-BN0uE9R0.js} +4 -3
  13. package/dist/area-BN0uE9R0.js.map +1 -0
  14. package/dist/{area-CJX9219z.d.cts → area-D6LNLk3r.d.cts} +2 -2
  15. package/dist/{area-d11XePuw.d.ts → area-DEFL-Yun.d.ts} +2 -2
  16. package/dist/{area-4eRs3c0K.cjs → area-D_N8b4Ng.cjs} +4 -3
  17. package/dist/area-D_N8b4Ng.cjs.map +1 -0
  18. package/dist/area.cjs +1 -1
  19. package/dist/area.d.cts +1 -1
  20. package/dist/area.d.ts +1 -1
  21. package/dist/area.js +1 -1
  22. package/dist/axis-BzBkkC5X.cjs +305 -0
  23. package/dist/axis-BzBkkC5X.cjs.map +1 -0
  24. package/dist/axis-C5obgdJt.js +240 -0
  25. package/dist/axis-C5obgdJt.js.map +1 -0
  26. package/dist/{bar-Da6dE_nI.cjs → bar-BrmfXugT.cjs} +77 -58
  27. package/dist/bar-BrmfXugT.cjs.map +1 -0
  28. package/dist/{bar-XwzM6Pb0.d.ts → bar-Bs_rPqgR.d.ts} +1 -1
  29. package/dist/{bar-BDLR4p9c.d.cts → bar-CEt8YRxf.d.cts} +2 -2
  30. package/dist/{bar-B5n2oq9-.js → bar-CgpC2EpX.js} +2 -2
  31. package/dist/{bar-B5n2oq9-.js.map → bar-CgpC2EpX.js.map} +1 -1
  32. package/dist/{bar-BNZ3GhIw.js → bar-D_KKd2fL.js} +75 -56
  33. package/dist/bar-D_KKd2fL.js.map +1 -0
  34. package/dist/{bar-LYIF8MEz.cjs → bar-wVykm1us.cjs} +2 -2
  35. package/dist/{bar-LYIF8MEz.cjs.map → bar-wVykm1us.cjs.map} +1 -1
  36. package/dist/bar.cjs +1 -1
  37. package/dist/bar.d.cts +1 -1
  38. package/dist/bar.d.ts +1 -1
  39. package/dist/bar.js +1 -1
  40. package/dist/calendar-B7843sQu.d.cts +106 -0
  41. package/dist/calendar-BG_q_NC_.cjs +507 -0
  42. package/dist/calendar-BG_q_NC_.cjs.map +1 -0
  43. package/dist/calendar-CF3gfDQk.js +502 -0
  44. package/dist/calendar-CF3gfDQk.js.map +1 -0
  45. package/dist/calendar-D10_ki1S.d.ts +106 -0
  46. package/dist/calendar.cjs +3 -0
  47. package/dist/calendar.d.cts +3 -0
  48. package/dist/calendar.d.ts +3 -0
  49. package/dist/calendar.js +1 -0
  50. package/dist/{candlestick-BHQkQfxH.js → candlestick-B1onjo1o.js} +17 -14
  51. package/dist/candlestick-B1onjo1o.js.map +1 -0
  52. package/dist/{candlestick-Dq7qp-F0.d.cts → candlestick-B7YXUVVh.d.cts} +4 -3
  53. package/dist/{candlestick-CYCQXgky.cjs → candlestick-BwrFKak_.cjs} +17 -14
  54. package/dist/candlestick-BwrFKak_.cjs.map +1 -0
  55. package/dist/{candlestick-D0xKkdqd.d.ts → candlestick-XpqJvarq.d.ts} +4 -3
  56. package/dist/candlestick.cjs +3 -3
  57. package/dist/candlestick.d.cts +1 -1
  58. package/dist/candlestick.d.ts +1 -1
  59. package/dist/candlestick.js +3 -3
  60. package/dist/{cartesian-DV02PsBe.cjs → cartesian-B9CrasFJ.cjs} +190 -310
  61. package/dist/cartesian-B9CrasFJ.cjs.map +1 -0
  62. package/dist/{cartesian-CI2x6N7N.js → cartesian-COglz544.js} +161 -251
  63. package/dist/cartesian-COglz544.js.map +1 -0
  64. package/dist/{chart-DWn9v6qw.js → chart-B97FBRCd.js} +114 -72
  65. package/dist/chart-B97FBRCd.js.map +1 -0
  66. package/dist/{chart-QilhWP8Z.d.ts → chart-CE9EVbfV.d.ts} +427 -112
  67. package/dist/{chart-kqFMEwDo.d.cts → chart-Dz4geQZy.d.cts} +427 -112
  68. package/dist/{chart-e2VqomCI.cjs → chart-GUmmjJ7S.cjs} +132 -78
  69. package/dist/chart-GUmmjJ7S.cjs.map +1 -0
  70. package/dist/{core-BKRQvPAT.js → core-7fgM3su0.js} +188 -73
  71. package/dist/core-7fgM3su0.js.map +1 -0
  72. package/dist/{core-DRUCk67j.d.ts → core-BUQzLsRJ.d.ts} +26 -10
  73. package/dist/{core-DIOC61up.cjs → core-BZTrsPxc.cjs} +200 -73
  74. package/dist/core-BZTrsPxc.cjs.map +1 -0
  75. package/dist/{core-PAX5ogLk.d.cts → core-Ck5uHcW8.d.cts} +45 -24
  76. package/dist/core.cjs +45 -31
  77. package/dist/core.d.cts +23 -18
  78. package/dist/core.d.ts +23 -18
  79. package/dist/core.js +28 -23
  80. package/dist/{dates-DurEr9WT.cjs → dates-0YNY49KQ.cjs} +2 -2
  81. package/dist/{dates-DurEr9WT.cjs.map → dates-0YNY49KQ.cjs.map} +1 -1
  82. package/dist/{dates-C2RzY3rE.js → dates-CKDRgpin.js} +2 -2
  83. package/dist/{dates-C2RzY3rE.js.map → dates-CKDRgpin.js.map} +1 -1
  84. package/dist/decimate.cjs +1 -1
  85. package/dist/decimate.js +1 -1
  86. package/dist/{dom-D_g13XWY.cjs → dom-C33zvtPo.cjs} +3 -7
  87. package/dist/dom-C33zvtPo.cjs.map +1 -0
  88. package/dist/{dom-CuceR8gt.js → dom-CTse6Rvd.js} +3 -7
  89. package/dist/dom-CTse6Rvd.js.map +1 -0
  90. package/dist/end-labels-B3oRvjxw.js +114 -0
  91. package/dist/end-labels-B3oRvjxw.js.map +1 -0
  92. package/dist/end-labels-CS-fnpp-.cjs +119 -0
  93. package/dist/end-labels-CS-fnpp-.cjs.map +1 -0
  94. package/dist/end-labels.cjs +11 -0
  95. package/dist/end-labels.cjs.map +1 -0
  96. package/dist/end-labels.d.cts +6 -0
  97. package/dist/end-labels.d.ts +6 -0
  98. package/dist/end-labels.js +11 -0
  99. package/dist/end-labels.js.map +1 -0
  100. package/dist/{export-chart-83UYH48t.js → export-chart-BOH_nfcH.js} +92 -15
  101. package/dist/export-chart-BOH_nfcH.js.map +1 -0
  102. package/dist/{export-chart-mYgEfK-L.cjs → export-chart-Be4T9J3m.cjs} +97 -14
  103. package/dist/export-chart-Be4T9J3m.cjs.map +1 -0
  104. package/dist/export.cjs +5 -3
  105. package/dist/export.cjs.map +1 -1
  106. package/dist/export.d.cts +4 -3
  107. package/dist/export.d.ts +4 -3
  108. package/dist/export.js +5 -4
  109. package/dist/export.js.map +1 -1
  110. package/dist/{fade-GGxcBdss.js → fade-CDrQjnDz.js} +56 -78
  111. package/dist/fade-CDrQjnDz.js.map +1 -0
  112. package/dist/{fade-DVTkhrFU.cjs → fade-CRqcKMWY.cjs} +56 -78
  113. package/dist/fade-CRqcKMWY.cjs.map +1 -0
  114. package/dist/{features-BMxkqCyS.js → features-B55rwpQC.js} +4 -2
  115. package/dist/features-B55rwpQC.js.map +1 -0
  116. package/dist/{features-DCXEvoya.cjs → features-DEDP5CEQ.cjs} +9 -1
  117. package/dist/features-DEDP5CEQ.cjs.map +1 -0
  118. package/dist/fit-BPyPRnsK.js +16 -0
  119. package/dist/fit-BPyPRnsK.js.map +1 -0
  120. package/dist/fit-D4MIIQQz.cjs +21 -0
  121. package/dist/fit-D4MIIQQz.cjs.map +1 -0
  122. package/dist/funnel-B9ridzNx.d.cts +50 -0
  123. package/dist/funnel-CFEEulw_.cjs +244 -0
  124. package/dist/funnel-CFEEulw_.cjs.map +1 -0
  125. package/dist/funnel-CYCv8cq2.js +239 -0
  126. package/dist/funnel-CYCv8cq2.js.map +1 -0
  127. package/dist/funnel-FogM8flk.d.ts +50 -0
  128. package/dist/funnel.cjs +3 -0
  129. package/dist/funnel.d.cts +3 -0
  130. package/dist/funnel.d.ts +3 -0
  131. package/dist/funnel.js +1 -0
  132. package/dist/{gauge-DXkjXNCD.cjs → gauge-6HfDcLMJ.cjs} +28 -28
  133. package/dist/gauge-6HfDcLMJ.cjs.map +1 -0
  134. package/dist/{gauge-BSist7My.d.cts → gauge-BScJ7U6O.d.cts} +2 -2
  135. package/dist/{gauge-0VJuAHWF.d.ts → gauge-D78oq1Lx.d.ts} +2 -2
  136. package/dist/{gauge-ts0kqN1-.js → gauge-DiTk5aWO.js} +28 -28
  137. package/dist/gauge-DiTk5aWO.js.map +1 -0
  138. package/dist/gauge.cjs +1 -1
  139. package/dist/gauge.d.cts +1 -1
  140. package/dist/gauge.d.ts +1 -1
  141. package/dist/gauge.js +1 -1
  142. package/dist/heat-Bsqq4zw9.js +38 -0
  143. package/dist/heat-Bsqq4zw9.js.map +1 -0
  144. package/dist/heat-DYsivvDq.cjs +49 -0
  145. package/dist/heat-DYsivvDq.cjs.map +1 -0
  146. package/dist/{heatmap-CXhlrLTl.cjs → heatmap-Dyzrd4Fd.cjs} +39 -37
  147. package/dist/heatmap-Dyzrd4Fd.cjs.map +1 -0
  148. package/dist/{heatmap-19BGJTKF.js → heatmap-J7fxG7MM.js} +35 -33
  149. package/dist/heatmap-J7fxG7MM.js.map +1 -0
  150. package/dist/{heatmap-Dp_oyEe0.d.cts → heatmap-Jvwo7iFW.d.cts} +2 -2
  151. package/dist/{heatmap-59lmClj9.d.ts → heatmap-mFCnP6aB.d.ts} +2 -2
  152. package/dist/heatmap.cjs +1 -1
  153. package/dist/heatmap.d.cts +1 -1
  154. package/dist/heatmap.d.ts +1 -1
  155. package/dist/heatmap.js +1 -1
  156. package/dist/{hydrate-OA6R2_Pn.js → hydrate-BB3MlR36.js} +2 -2
  157. package/dist/{hydrate-OA6R2_Pn.js.map → hydrate-BB3MlR36.js.map} +1 -1
  158. package/dist/{hydrate-CmN1k8Mo.cjs → hydrate-m0I5m6ue.cjs} +2 -2
  159. package/dist/{hydrate-CmN1k8Mo.cjs.map → hydrate-m0I5m6ue.cjs.map} +1 -1
  160. package/dist/hydrate.cjs +2 -2
  161. package/dist/hydrate.js +2 -2
  162. package/dist/index.cjs +69 -45
  163. package/dist/index.cjs.map +1 -1
  164. package/dist/index.d.cts +24 -19
  165. package/dist/index.d.ts +24 -19
  166. package/dist/index.js +51 -37
  167. package/dist/index.js.map +1 -1
  168. package/dist/interaction-DXYSjgnP.cjs +32 -0
  169. package/dist/interaction-DXYSjgnP.cjs.map +1 -0
  170. package/dist/interaction-En1KlwFO.js +21 -0
  171. package/dist/interaction-En1KlwFO.js.map +1 -0
  172. package/dist/layout-CYerDebD.d.cts +29 -0
  173. package/dist/layout-CYerDebD.d.ts +29 -0
  174. package/dist/{layout-JY2aR-yE.cjs → layout-Cfg9x1k2.cjs} +32 -1
  175. package/dist/layout-Cfg9x1k2.cjs.map +1 -0
  176. package/dist/{layout-DmrrLjwN.js → layout-DqAte3H8.js} +27 -2
  177. package/dist/layout-DqAte3H8.js.map +1 -0
  178. package/dist/{line-DO66LtwH.js → line-CXH0L10d.js} +84 -37
  179. package/dist/line-CXH0L10d.js.map +1 -0
  180. package/dist/{line-_rNdeKmS.d.cts → line-Cu9ctpbv.d.cts} +9 -3
  181. package/dist/{line-Dbt6KFRK.cjs → line-DHbYCQy4.cjs} +84 -37
  182. package/dist/line-DHbYCQy4.cjs.map +1 -0
  183. package/dist/{line-DtSh7HQU.d.ts → line-TkzA7wMK.d.ts} +8 -1
  184. package/dist/line.cjs +3 -3
  185. package/dist/line.d.cts +1 -1
  186. package/dist/line.d.ts +1 -1
  187. package/dist/line.js +3 -3
  188. package/dist/log.cjs +1 -1
  189. package/dist/log.js +1 -1
  190. package/dist/map-BirylCmT.d.cts +156 -0
  191. package/dist/map-CYp6x-uS.js +784 -0
  192. package/dist/map-CYp6x-uS.js.map +1 -0
  193. package/dist/map-ChwSgooH.cjs +795 -0
  194. package/dist/map-ChwSgooH.cjs.map +1 -0
  195. package/dist/map-DNqog2Xs.d.ts +156 -0
  196. package/dist/map.cjs +4 -0
  197. package/dist/map.d.cts +3 -0
  198. package/dist/map.d.ts +3 -0
  199. package/dist/map.js +1 -0
  200. package/dist/maps/world.cjs +875 -0
  201. package/dist/maps/world.cjs.map +1 -0
  202. package/dist/maps/world.d.cts +2 -0
  203. package/dist/maps/world.d.ts +2 -0
  204. package/dist/maps/world.js +874 -0
  205. package/dist/maps/world.js.map +1 -0
  206. package/dist/{morph-9_LJL0ra.cjs → morph-3I1Nf_tR.cjs} +2 -2
  207. package/dist/{morph-9_LJL0ra.cjs.map → morph-3I1Nf_tR.cjs.map} +1 -1
  208. package/dist/{morph-DnRxuwR-.js → morph-GfBab-b3.js} +2 -2
  209. package/dist/{morph-DnRxuwR-.js.map → morph-GfBab-b3.js.map} +1 -1
  210. package/dist/morph.cjs +2 -2
  211. package/dist/morph.js +2 -2
  212. package/dist/others-CuNdpvjd.d.cts +31 -0
  213. package/dist/{others-J7NCAMA0.js → others-DBIGE6jr.js} +11 -3
  214. package/dist/others-DBIGE6jr.js.map +1 -0
  215. package/dist/others-DBO4Kjwl.d.ts +29 -0
  216. package/dist/{others-DWdK7vKp.cjs → others-WfjCsjqT.cjs} +14 -6
  217. package/dist/others-WfjCsjqT.cjs.map +1 -0
  218. package/dist/{parliament-Cru4IcuM.js → parliament-BKN6ikBJ.js} +30 -29
  219. package/dist/parliament-BKN6ikBJ.js.map +1 -0
  220. package/dist/{parliament-CLCI7tUO.d.ts → parliament-CHdf13XU.d.ts} +2 -2
  221. package/dist/{parliament-CgsVnWEe.d.cts → parliament-CsYgh4N2.d.cts} +2 -2
  222. package/dist/{parliament-x5hcFaQ3.cjs → parliament-DhxAaIZ3.cjs} +30 -29
  223. package/dist/parliament-DhxAaIZ3.cjs.map +1 -0
  224. package/dist/parliament.cjs +1 -1
  225. package/dist/parliament.d.cts +1 -1
  226. package/dist/parliament.d.ts +1 -1
  227. package/dist/parliament.js +1 -1
  228. package/dist/{patterns-D3-wQagb.cjs → patterns-BPN1c9qe.cjs} +2 -2
  229. package/dist/{patterns-D3-wQagb.cjs.map → patterns-BPN1c9qe.cjs.map} +1 -1
  230. package/dist/{patterns-CufKZYhm.js → patterns-CVrLrJXg.js} +2 -2
  231. package/dist/{patterns-CufKZYhm.js.map → patterns-CVrLrJXg.js.map} +1 -1
  232. package/dist/patterns.cjs +2 -2
  233. package/dist/patterns.d.cts +1 -1
  234. package/dist/patterns.d.ts +1 -1
  235. package/dist/patterns.js +2 -2
  236. package/dist/{percentage-bar-ybNS3goo.cjs → percentage-bar-BChkTRoz.cjs} +37 -35
  237. package/dist/percentage-bar-BChkTRoz.cjs.map +1 -0
  238. package/dist/{percentage-bar-nhTeakD_.d.ts → percentage-bar-CSAbzDOn.d.ts} +11 -15
  239. package/dist/{percentage-bar-B6tNOqNn.js → percentage-bar-CaInxrL8.js} +37 -35
  240. package/dist/percentage-bar-CaInxrL8.js.map +1 -0
  241. package/dist/{percentage-bar-tepMr7Hd.d.cts → percentage-bar-UZHCRvlK.d.cts} +11 -15
  242. package/dist/percentage-bar.cjs +1 -1
  243. package/dist/percentage-bar.d.cts +1 -1
  244. package/dist/percentage-bar.d.ts +1 -1
  245. package/dist/percentage-bar.js +1 -1
  246. package/dist/{pie-BXg2gNpb.d.cts → pie-AFedsDcF.d.cts} +17 -14
  247. package/dist/{pie-CVsc-6qD.js → pie-Ch6Bx0ih.js} +68 -52
  248. package/dist/pie-Ch6Bx0ih.js.map +1 -0
  249. package/dist/{pie-BpjvSPnz.cjs → pie-Cll1OrVZ.cjs} +68 -52
  250. package/dist/pie-Cll1OrVZ.cjs.map +1 -0
  251. package/dist/{pie-CFptILSm.d.ts → pie-Cn2H3pz8.d.ts} +17 -14
  252. package/dist/pie.cjs +1 -1
  253. package/dist/pie.d.cts +1 -1
  254. package/dist/pie.d.ts +1 -1
  255. package/dist/pie.js +1 -1
  256. package/dist/{point-shapes--_gmdTyK.cjs → point-shapes-BRawRM78.cjs} +23 -22
  257. package/dist/point-shapes-BRawRM78.cjs.map +1 -0
  258. package/dist/{point-shapes-DD2Ektzm.js → point-shapes-DI6GhcI7.js} +18 -23
  259. package/dist/point-shapes-DI6GhcI7.js.map +1 -0
  260. package/dist/point-shapes.cjs +6 -4
  261. package/dist/point-shapes.cjs.map +1 -1
  262. package/dist/point-shapes.d.cts +2 -2
  263. package/dist/point-shapes.d.ts +2 -2
  264. package/dist/point-shapes.js +7 -5
  265. package/dist/point-shapes.js.map +1 -1
  266. package/dist/{radar-BR-mumDd.js → radar-Bg-IiIWB.js} +21 -22
  267. package/dist/radar-Bg-IiIWB.js.map +1 -0
  268. package/dist/{radar-BC9Skgpj.d.ts → radar-DEer2jjd.d.ts} +2 -2
  269. package/dist/{radar-D1-lItDy.d.cts → radar-DxmjXhMc.d.cts} +2 -2
  270. package/dist/{radar-HPDrIdzc.cjs → radar-wDyX17S3.cjs} +22 -23
  271. package/dist/radar-wDyX17S3.cjs.map +1 -0
  272. package/dist/radar.cjs +1 -1
  273. package/dist/radar.d.cts +1 -1
  274. package/dist/radar.d.ts +1 -1
  275. package/dist/radar.js +1 -1
  276. package/dist/range-bar-BnKjJP89.cjs +348 -0
  277. package/dist/range-bar-BnKjJP89.cjs.map +1 -0
  278. package/dist/range-bar-C4cRaaQE.d.ts +123 -0
  279. package/dist/range-bar-D32dIQOY.d.cts +123 -0
  280. package/dist/range-bar-Dx6ce0J1.js +343 -0
  281. package/dist/range-bar-Dx6ce0J1.js.map +1 -0
  282. package/dist/range-bar.cjs +3 -0
  283. package/dist/range-bar.d.cts +3 -0
  284. package/dist/range-bar.d.ts +3 -0
  285. package/dist/range-bar.js +1 -0
  286. package/dist/{rect-DSVmUZrD.js → rect-CZTNvMlf.js} +2 -2
  287. package/dist/{rect-DSVmUZrD.js.map → rect-CZTNvMlf.js.map} +1 -1
  288. package/dist/{rect-D6VhynBM.cjs → rect-DPr9QRxl.cjs} +2 -2
  289. package/dist/{rect-D6VhynBM.cjs.map → rect-DPr9QRxl.cjs.map} +1 -1
  290. package/dist/{sankey-fCoo1cpz.cjs → sankey-0CSp_Er9.cjs} +72 -71
  291. package/dist/sankey-0CSp_Er9.cjs.map +1 -0
  292. package/dist/{sankey-Dk7jUt8x.d.cts → sankey-D-8ATwBT.d.cts} +2 -2
  293. package/dist/{sankey-D6JeZfK5.js → sankey-Dp4CuLVe.js} +72 -71
  294. package/dist/sankey-Dp4CuLVe.js.map +1 -0
  295. package/dist/{sankey-D_v7KxnJ.d.ts → sankey-DpYJsOI4.d.ts} +2 -2
  296. package/dist/sankey.cjs +1 -1
  297. package/dist/sankey.d.cts +1 -1
  298. package/dist/sankey.d.ts +1 -1
  299. package/dist/sankey.js +1 -1
  300. package/dist/{scatter-C0TWjFpW.js → scatter-0Z7K_YUz.js} +94 -46
  301. package/dist/scatter-0Z7K_YUz.js.map +1 -0
  302. package/dist/{scatter-CXEsioOJ.d.ts → scatter-BAL5K9_4.d.ts} +28 -9
  303. package/dist/{scatter-DZeEIfyo.d.cts → scatter-BUGbnRzM.d.cts} +28 -9
  304. package/dist/{scatter-DVqB_fP9.cjs → scatter-CZ8do3Up.cjs} +95 -47
  305. package/dist/scatter-CZ8do3Up.cjs.map +1 -0
  306. package/dist/scatter.cjs +1 -1
  307. package/dist/scatter.d.cts +2 -2
  308. package/dist/scatter.d.ts +2 -2
  309. package/dist/scatter.js +1 -1
  310. package/dist/slice-labels-1TBq7p3q.d.cts +28 -0
  311. package/dist/slice-labels-C9ucsBVW.js +88 -0
  312. package/dist/slice-labels-C9ucsBVW.js.map +1 -0
  313. package/dist/slice-labels-CbFiy46l.cjs +93 -0
  314. package/dist/slice-labels-CbFiy46l.cjs.map +1 -0
  315. package/dist/slice-labels-Cm5CyV7B.d.ts +28 -0
  316. package/dist/slice-labels.cjs +11 -0
  317. package/dist/slice-labels.cjs.map +1 -0
  318. package/dist/slice-labels.d.cts +6 -0
  319. package/dist/slice-labels.d.ts +6 -0
  320. package/dist/slice-labels.js +11 -0
  321. package/dist/slice-labels.js.map +1 -0
  322. package/dist/{sparkline-cbvRkWqS.d.ts → sparkline-CtoBJe-a.d.ts} +2 -2
  323. package/dist/{sparkline-B39NA0Mi.cjs → sparkline-DjR-V6BI.cjs} +13 -15
  324. package/dist/sparkline-DjR-V6BI.cjs.map +1 -0
  325. package/dist/{sparkline-DAP6jtzw.d.cts → sparkline-DwHJfeZz.d.cts} +2 -2
  326. package/dist/{sparkline-XO_TqCNP.js → sparkline-_dxwtdli.js} +13 -15
  327. package/dist/sparkline-_dxwtdli.js.map +1 -0
  328. package/dist/sparkline.cjs +1 -1
  329. package/dist/sparkline.d.cts +1 -1
  330. package/dist/sparkline.d.ts +1 -1
  331. package/dist/sparkline.js +1 -1
  332. package/dist/{stack-Dagxq7l2.d.cts → stack-CcmyALx0.d.cts} +1 -1
  333. package/dist/{stack-2H2Gfs1Q.js → stack-CyVlS7Fr.js} +2 -2
  334. package/dist/{stack-2H2Gfs1Q.js.map → stack-CyVlS7Fr.js.map} +1 -1
  335. package/dist/{stack-BgPzoQmv.cjs → stack-DBhmYNat.cjs} +2 -2
  336. package/dist/{stack-BgPzoQmv.cjs.map → stack-DBhmYNat.cjs.map} +1 -1
  337. package/dist/style.css +1 -1
  338. package/dist/{time-axis-BjZ1bYTK.cjs → time-axis-CVKjQKSS.cjs} +4 -3
  339. package/dist/{time-axis-BjZ1bYTK.cjs.map → time-axis-CVKjQKSS.cjs.map} +1 -1
  340. package/dist/{time-axis-FLONo54E.js → time-axis-CkmbAw4Z.js} +3 -2
  341. package/dist/{time-axis-FLONo54E.js.map → time-axis-CkmbAw4Z.js.map} +1 -1
  342. package/dist/time.cjs +3 -3
  343. package/dist/time.js +3 -3
  344. package/dist/{treemap-BAkhmVQc.d.cts → treemap-C2maqerU.d.cts} +37 -5
  345. package/dist/{treemap-BNpxFBao.d.ts → treemap-D_zbubo3.d.ts} +37 -5
  346. package/dist/{treemap-BWpEUlDh.cjs → treemap-PulGXZv0.cjs} +58 -33
  347. package/dist/treemap-PulGXZv0.cjs.map +1 -0
  348. package/dist/{treemap-CQdavQ9u.js → treemap-lbYxb-7h.js} +57 -32
  349. package/dist/treemap-lbYxb-7h.js.map +1 -0
  350. package/dist/treemap.cjs +1 -1
  351. package/dist/treemap.d.cts +1 -1
  352. package/dist/treemap.d.ts +1 -1
  353. package/dist/treemap.js +1 -1
  354. package/dist/{value-labels-BBuSi4i0.js → value-labels-B0VeheyE.js} +29 -8
  355. package/dist/value-labels-B0VeheyE.js.map +1 -0
  356. package/dist/{value-labels-BV9keAuL.cjs → value-labels-Dcyk3GIY.cjs} +29 -8
  357. package/dist/value-labels-Dcyk3GIY.cjs.map +1 -0
  358. package/dist/value-labels.cjs +2 -2
  359. package/dist/value-labels.d.cts +1 -1
  360. package/dist/value-labels.d.ts +1 -1
  361. package/dist/value-labels.js +2 -2
  362. package/dist/zoom.cjs +810 -0
  363. package/dist/zoom.cjs.map +1 -0
  364. package/dist/zoom.d.cts +34 -0
  365. package/dist/zoom.d.ts +34 -0
  366. package/dist/zoom.js +806 -0
  367. package/dist/zoom.js.map +1 -0
  368. package/package.json +120 -235
  369. package/dist/annotations-D0YQ0IoA.js.map +0 -1
  370. package/dist/annotations-DdRdeBUB.cjs.map +0 -1
  371. package/dist/area-0-L1bG9B.js.map +0 -1
  372. package/dist/area-4eRs3c0K.cjs.map +0 -1
  373. package/dist/bar-BNZ3GhIw.js.map +0 -1
  374. package/dist/bar-Da6dE_nI.cjs.map +0 -1
  375. package/dist/candlestick-BHQkQfxH.js.map +0 -1
  376. package/dist/candlestick-CYCQXgky.cjs.map +0 -1
  377. package/dist/cartesian-CI2x6N7N.js.map +0 -1
  378. package/dist/cartesian-DV02PsBe.cjs.map +0 -1
  379. package/dist/chart-DWn9v6qw.js.map +0 -1
  380. package/dist/chart-e2VqomCI.cjs.map +0 -1
  381. package/dist/core-BKRQvPAT.js.map +0 -1
  382. package/dist/core-DIOC61up.cjs.map +0 -1
  383. package/dist/dom-CuceR8gt.js.map +0 -1
  384. package/dist/dom-D_g13XWY.cjs.map +0 -1
  385. package/dist/export-chart-83UYH48t.js.map +0 -1
  386. package/dist/export-chart-mYgEfK-L.cjs.map +0 -1
  387. package/dist/fade-DVTkhrFU.cjs.map +0 -1
  388. package/dist/fade-GGxcBdss.js.map +0 -1
  389. package/dist/features-BMxkqCyS.js.map +0 -1
  390. package/dist/features-DCXEvoya.cjs.map +0 -1
  391. package/dist/gauge-DXkjXNCD.cjs.map +0 -1
  392. package/dist/gauge-ts0kqN1-.js.map +0 -1
  393. package/dist/heatmap-19BGJTKF.js.map +0 -1
  394. package/dist/heatmap-CXhlrLTl.cjs.map +0 -1
  395. package/dist/layout-DmrrLjwN.js.map +0 -1
  396. package/dist/layout-JY2aR-yE.cjs.map +0 -1
  397. package/dist/line-DO66LtwH.js.map +0 -1
  398. package/dist/line-Dbt6KFRK.cjs.map +0 -1
  399. package/dist/others-DWdK7vKp.cjs.map +0 -1
  400. package/dist/others-J7NCAMA0.js.map +0 -1
  401. package/dist/parliament-Cru4IcuM.js.map +0 -1
  402. package/dist/parliament-x5hcFaQ3.cjs.map +0 -1
  403. package/dist/percentage-bar-B6tNOqNn.js.map +0 -1
  404. package/dist/percentage-bar-ybNS3goo.cjs.map +0 -1
  405. package/dist/pie-BpjvSPnz.cjs.map +0 -1
  406. package/dist/pie-CVsc-6qD.js.map +0 -1
  407. package/dist/point-shapes--_gmdTyK.cjs.map +0 -1
  408. package/dist/point-shapes-DD2Ektzm.js.map +0 -1
  409. package/dist/radar-BR-mumDd.js.map +0 -1
  410. package/dist/radar-HPDrIdzc.cjs.map +0 -1
  411. package/dist/sankey-D6JeZfK5.js.map +0 -1
  412. package/dist/sankey-fCoo1cpz.cjs.map +0 -1
  413. package/dist/scatter-C0TWjFpW.js.map +0 -1
  414. package/dist/scatter-DVqB_fP9.cjs.map +0 -1
  415. package/dist/sparkline-B39NA0Mi.cjs.map +0 -1
  416. package/dist/sparkline-XO_TqCNP.js.map +0 -1
  417. package/dist/treemap-BWpEUlDh.cjs.map +0 -1
  418. package/dist/treemap-CQdavQ9u.js.map +0 -1
  419. package/dist/value-labels-BBuSi4i0.js.map +0 -1
  420. package/dist/value-labels-BV9keAuL.cjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sparkline-_dxwtdli.js","names":[],"sources":["../src/charts/sparkline.ts"],"sourcesContent":["import type { ChartType, RenderContext } from '../chart.ts'\nimport { fadeMask } from '../components/fade.ts'\nimport { formatNumber, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets, round } from '../layout.ts'\nimport { linear } from '../scales/linear.ts'\nimport { barPath } from '../shapes/bar.ts'\nimport { circlePath } from '../shapes/circle.ts'\nimport { areaPath, type Curve, linePath, type Point } from '../shapes/path.ts'\nimport { h } from '../vnode.ts'\nimport { domainOf, type Label, labelKey, markerShape, pointMark } from './cartesian.ts'\nimport { cleanData, label, numbers } from './clean.ts'\n\nexport interface SparklineOptions {\n /** The values; `null` leaves a gap. */\n data: readonly (number | null | undefined)[]\n /** Labels for the tooltip, one per value (e.g. dates). */\n labels?: readonly Label[]\n /** Name shown in the tooltip. Defaults to `'Value'`. */\n name?: string\n /**\n * `'line'` (default), `'area'`, `'bar'`, or `'tristate'`: only the sign\n * counts, as a full bar up (win), down (loss) or a tick on the middle (draw).\n */\n variant?: 'line' | 'area' | 'bar' | 'tristate'\n /** Interpolation for lines and areas. Defaults to `'monotone'`. */\n curve?: Curve\n /** Dot on the last value. Defaults to `'last'`. */\n point?: 'last' | 'none'\n /** Mark the minimum and maximum values. */\n markers?: 'minmax' | 'none'\n /** Dot radius in pixels. Defaults to `3`. */\n pointRadius?: number\n /** Include zero in the value range. Defaults to `true` for areas and bars, `false` for lines. */\n zero?: boolean\n /** Format of values in the tooltip. */\n format?: NumberFormat\n /** Extra space around the plot, in pixels. */\n padding?: InsetsInput\n}\n\nfunction renderSparkline(options: SparklineOptions, ctx: RenderContext) {\n const {\n variant = 'line',\n curve = 'monotone',\n point = 'last',\n markers = 'none',\n pointRadius = 3,\n name = 'Value',\n } = options\n const values = options.data.map((v) => (v == null || !Number.isFinite(v) ? null : v))\n // (No log option on sparklines, so finite is all that matters here.)\n const count = values.length\n const dots = point === 'last' || markers === 'minmax'\n // Room for the stroke and dots so nothing is clipped at the edges.\n const overhang = dots ? pointRadius + 2 : 2\n const pad = insets(options.padding, 0)\n const area = innerRect(ctx.width, ctx.height, {\n top: pad.top + overhang,\n right: pad.right + overhang,\n bottom: pad.bottom + overhang,\n left: pad.left + overhang,\n })\n const tristate = variant === 'tristate'\n const zero = options.zero ?? variant !== 'line'\n // Tristate bars span half the height each way, whatever the magnitude.\n const domain: [number, number] = tristate ? [-1, 1] : domainOf(values, { nice: false }, zero, 2)\n\n const bars = variant === 'bar' || tristate\n const gap = 1\n const slot = count > 0 ? area.width / count : 0\n // Right to left, the values run from the right: value `i` takes the place of its mirror.\n const place = (i: number) => (ctx.rtl ? count - 1 - i : i)\n const xAt = (i: number) =>\n bars\n ? area.x + slot * place(i) + slot / 2\n : area.x + (count > 1 ? (area.width * place(i)) / (count - 1) : area.width / 2)\n const y = linear(domain, [area.y + area.height, area.y])\n const baseline = y(Math.min(Math.max(0, domain[0]), domain[1]))\n const points: Point[] = values.map((v, i) => (v === null ? null : [xAt(i), y(v)]))\n\n const format = formatNumber(options.format, ctx.locale)\n const labelOf = (i: number) => {\n const label = options.labels?.[i]\n return label === undefined ? '' : String(label)\n }\n // Where a value is drawn: a tristate bar ends at its sign, not its magnitude.\n const yOf = (v: number) => y(tristate ? Math.sign(v) : v)\n const hitFor = (i: number): Hit | null => {\n const value = values[i]\n if (value === undefined) return null\n const px = xAt(i)\n const item: HitItem = {\n name,\n seriesIndex: 0,\n value,\n text: value === null ? '–' : format(value),\n x: px,\n y: value === null ? null : yOf(value),\n }\n const hit: Hit = {\n index: i,\n label: labelKey(options.labels?.[i] ?? i + 1),\n title: labelOf(i),\n x: px,\n area,\n items: [item],\n }\n if (value !== null) {\n hit.highlight = { kind: 'halo', d: circlePath(pointRadius + 3), x: px, y: yOf(value) }\n }\n return hit\n }\n const interaction: Interaction = {\n count,\n reversed: ctx.rtl === true,\n hitIndex: (i) => hitFor(i),\n hitTest(px, py) {\n if (count === 0 || py < area.y - overhang || py > area.y + area.height + overhang) return null\n const i = bars\n ? Math.floor((px - area.x) / slot)\n : Math.round(((px - area.x) / Math.max(1, area.width)) * (count - 1))\n return hitFor(place(Math.max(0, Math.min(count - 1, i))))\n },\n }\n\n const marks = []\n if (tristate) {\n const width = Math.max(1, slot - gap)\n marks.push(\n h('line', {\n class: 'tc-sparkline-zero',\n x1: area.x,\n x2: area.x + area.width,\n y1: round(baseline),\n y2: round(baseline),\n }),\n )\n values.forEach((v, i) => {\n if (v === null) return\n const sign = Math.sign(v)\n // A draw is a short tick centered on the middle line.\n const tick = Math.min(2, area.height / 2)\n const [from, to] =\n sign === 0 ? [baseline + tick / 2, baseline - tick / 2] : [baseline, y(sign)]\n marks.push(\n h('path', {\n key: i,\n class: [\n 'tc-bar',\n sign < 0 && 'tc-bar-negative',\n sign < 0 ? 'tc-tristate-loss' : sign > 0 ? 'tc-tristate-win' : 'tc-tristate-draw',\n ],\n d: barPath(xAt(i) - width / 2, width, from, to, sign === 0 ? 0 : Math.min(2, width / 2)),\n }),\n )\n })\n } else if (bars) {\n const width = Math.max(1, slot - gap)\n values.forEach((v, i) => {\n if (v === null) return\n marks.push(\n h('path', {\n key: i,\n class: ['tc-bar', v < 0 && 'tc-bar-negative'],\n d: barPath(xAt(i) - width / 2, width, baseline, y(v), Math.min(2, width / 2)),\n }),\n )\n })\n } else {\n if (variant === 'area') {\n marks.push(\n h('path', {\n class: 'tc-area tc-area-gradient',\n d: areaPath(points, baseline, { curve }),\n mask: `url(#${ctx.id}-fade)`,\n }),\n )\n }\n marks.push(h('path', { class: 'tc-line', d: linePath(points, { curve }) }))\n }\n\n const shape = markerShape(options)\n const dotAt = (i: number, cls: string) => {\n const v = values[i]\n return v == null\n ? null\n : pointMark(\n shape,\n 0,\n `${cls}-${i}`,\n ['tc-point', cls],\n round(xAt(i)),\n round(y(v)),\n pointRadius,\n )\n }\n const extremes = []\n if (markers === 'minmax') {\n let min = -1\n let max = -1\n values.forEach((v, i) => {\n if (v === null) return\n if (min === -1 || v < (values[min] as number)) min = i\n if (max === -1 || v > (values[max] as number)) max = i\n })\n if (min !== -1) extremes.push(dotAt(min, 'tc-point-min'))\n if (max !== -1 && max !== min) extremes.push(dotAt(max, 'tc-point-max'))\n }\n let last = -1\n if (point === 'last') {\n for (let i = count - 1; i >= 0; i--) {\n if (values[i] !== null) {\n last = i\n break\n }\n }\n }\n\n const content = [\n variant === 'area' && h('defs', null, fadeMask(`${ctx.id}-fade`)),\n h(\n 'g',\n { class: 'tc-series tc-series-1 tc-sparkline' },\n marks,\n extremes,\n last !== -1 && !bars && dotAt(last, 'tc-point-last'),\n ),\n ]\n return { content, interaction }\n}\n\n/**\n * Sparkline: a tiny line, area or bar chart without axes, for stat tiles.\n *\n * ```ts\n * new Chart('#el', { type: sparkline, data: [3, 5, 4, 7, 6], height: 40 })\n * ```\n */\nexport const sparkline: ChartType<SparklineOptions> = {\n name: 'sparkline',\n // The labels too: they come from outside like the values.\n clean: (options) => ({\n ...cleanData(numbers)(options),\n labels: Array.isArray(options.labels) ? options.labels.map(label) : undefined,\n }),\n render: renderSparkline,\n // Decorative by default: opt in with `keyboard: true`.\n keyboard: false,\n}\n"],"mappings":";;;;;;;;;AAyCA,SAAS,gBAAgB,SAA2B,KAAoB;CACtE,MAAM,EACJ,UAAU,QACV,QAAQ,YACR,QAAQ,QACR,UAAU,QACV,cAAc,GACd,OAAO,YACL;CACJ,MAAM,SAAS,QAAQ,K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AI,KAAA;CACtE;CACA,QAAQ;CAER,UAAU;AACZ"}
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sparkline = require("./sparkline-B39NA0Mi.cjs");
2
+ const require_sparkline = require("./sparkline-DjR-V6BI.cjs");
3
3
  exports.sparkline = require_sparkline.sparkline;
@@ -1,3 +1,3 @@
1
1
  /** Standalone entry: `import { sparkline } from '@tabler/charts/sparkline'`. */
2
- import { n as sparkline, t as SparklineOptions } from "./sparkline-DAP6jtzw.cjs";
2
+ import { n as sparkline, t as SparklineOptions } from "./sparkline-DwHJfeZz.cjs";
3
3
  export { type SparklineOptions, sparkline };
@@ -1,3 +1,3 @@
1
1
  /** Standalone entry: `import { sparkline } from '@tabler/charts/sparkline'`. */
2
- import { n as sparkline, t as SparklineOptions } from "./sparkline-cbvRkWqS.js";
2
+ import { n as sparkline, t as SparklineOptions } from "./sparkline-CtoBJe-a.js";
3
3
  export { type SparklineOptions, sparkline };
package/dist/sparkline.js CHANGED
@@ -1 +1 @@
1
- export { t as sparkline } from "./sparkline-XO_TqCNP.js";
1
+ export { t as sparkline } from "./sparkline-_dxwtdli.js";
@@ -1,4 +1,4 @@
1
- import "./chart-kqFMEwDo.cjs";
1
+ import "./chart-Dz4geQZy.cjs";
2
2
  /** Stack series on top of each other; `'percent'` normalizes every category to 100%. */
3
3
  type StackMode = boolean | "percent";
4
4
  export { StackMode as t };
@@ -1,4 +1,4 @@
1
- import { f as seriesKey } from "./cartesian-CI2x6N7N.js";
1
+ import { m as seriesKey } from "./cartesian-COglz544.js";
2
2
  // src/charts/stack.ts
3
3
  /**
4
4
  * Stack series per category: positive values grow up from zero and
@@ -62,4 +62,4 @@ function stackBounds(stacks) {
62
62
  }
63
63
  export { stackSeries as n, stackBounds as t };
64
64
 
65
- //# sourceMappingURL=stack-2H2Gfs1Q.js.map
65
+ //# sourceMappingURL=stack-CyVlS7Fr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stack-2H2Gfs1Q.js","names":[],"sources":["../src/charts/stack.ts"],"sourcesContent":["import { type Series, seriesKey } from './cartesian.ts'\n\n/** Stack series on top of each other; `'percent'` normalizes every category to 100%. */\nexport type StackMode = boolean | 'percent'\n\n/** A stacked segment from `y0` to `y1` (in data units). */\nexport interface Segment {\n y0: number\n y1: number\n}\n\nexport interface StackOptions {\n /** Normalize each category by the sum of absolute values. */\n percent?: boolean\n /** Count missing values as zero (areas) instead of leaving no segment (bars). */\n nullAsZero?: boolean\n /** Keys of hidden series, which get no segment and do not stack. */\n hidden?: ReadonlySet<string>\n}\n\n/**\n * Stack series per category: positive values grow up from zero and\n * negative values down from zero, each on their own running total (like\n * d3's diverging offset), so gains and losses never interleave. Returns one\n * array per series with a segment per category, or `null` for no segment.\n */\nexport function stackSeries(\n series: readonly Series[],\n count: number,\n options: StackOptions = {},\n): (Segment | null)[][] {\n const { percent = false, nullAsZero = false, hidden } = options\n const visible = series.map((s) => !hidden?.has(seriesKey(s)))\n const out = series.map(() => new Array<Segment | null>(count).fill(null))\n\n for (let i = 0; i < count; i++) {\n let total = 0\n if (percent) {\n series.forEach((s, j) => {\n const v = s.values[i]\n if (visible[j] && v != null) total += Math.abs(v)\n })\n }\n let up = 0\n let down = 0\n let lastUp: Segment | undefined\n let lastDown: Segment | undefined\n for (let j = 0; j < series.length; j++) {\n const s = series[j] as Series\n if (!visible[j]) continue\n const raw = s.values[i]\n const valid = raw != null\n if (!valid && !nullAsZero) continue\n let v = valid ? (raw as number) : 0\n if (percent) v = total === 0 ? 0 : v / total\n const row = out[j] as (Segment | null)[]\n if (v < 0) {\n const segment: Segment = { y0: down, y1: down + v }\n row[i] = segment\n down += v\n lastDown = segment\n } else {\n const segment: Segment = { y0: up, y1: up + v }\n row[i] = segment\n up += v\n lastUp = segment\n }\n }\n // Shares must end exactly at ±100%: floating point drift (1.0000000000000002)\n // would otherwise make nice() stretch the axis to 120%, or leave a hairline gap.\n if (percent) {\n if (lastUp && Math.abs(up - 1) < 1e-9) lastUp.y1 = 1\n if (lastDown && Math.abs(down + 1) < 1e-9) lastDown.y1 = -1\n }\n }\n return out\n}\n\n/** Every segment boundary, for the value domain. */\nexport function stackBounds(stacks: readonly (Segment | null)[][]): number[] {\n const values: number[] = []\n for (const row of stacks) {\n for (const segment of row) if (segment) values.push(segment.y0, segment.y1)\n }\n return values\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgB,YACd,QACA,OACA,UAAwB,CAAC,GACH;CACtB,MAAM,EAAE,UAAU,OAAO,aAAa,OAAO,WAAW;CACxD,MAAM,UAAU,OAAO,KAAK,MAAM,CAAC,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC;CAC5D,MAAM,MAAM,OAAO,UAAU,IAAI,MAAsB,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;CAExE,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK;EAC9B,IAAI,QAAQ;EACZ,IAAI,SACF,OAAO,SAAS,GAAG,MAAM;GACvB,MAAM,IAAI,EAAE,OAAO;GACnB,IAAI,QAAQ,MAAM,KAAK,MAAM,SAAS,KAAK,IAAI,CAAC;EAClD,CAAC;EAEH,IAAI,KAAK;EACT,IAAI,OAAO;EACX,IAAI;EACJ,IAAI;EACJ,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;GACtC,MAAM,IAAI,OAAO;GACjB,IAAI,CAAC,QAAQ,IAAI;GACjB,MAAM,MAAM,EAAE,OAAO;GACrB,MAAM,QAAQ,OAAO;GACrB,IAAI,CAAC,SAAS,CAAC,YAAY;GAC3B,IAAI,IAAI,QAAS,MAAiB;GAClC,IAAI,SAAS,IAAI,UAAU,IAAI,IAAI,IAAI;GACvC,MAAM,MAAM,IAAI;GAChB,IAAI,IAAI,GAAG;IACT,MAAM,UAAmB;KAAE,IAAI;KAAM,IAAI,OAAO;IAAE;IAClD,IAAI,KAAK;IACT,QAAQ;IACR,WAAW;GACb,OAAO;IACL,MAAM,UAAmB;KAAE,IAAI;KAAI,IAAI,KAAK;IAAE;IAC9C,IAAI,KAAK;IACT,MAAM;IACN,SAAS;GACX;EACF;EAGA,IAAI,SAAS;GACX,IAAI,UAAU,KAAK,IAAI,KAAK,CAAC,IAAI,MAAM,OAAO,KAAK;GACnD,IAAI,YAAY,KAAK,IAAI,OAAO,CAAC,IAAI,MAAM,SAAS,KAAK;EAC3D;CACF;CACA,OAAO;AACT;;AAGA,SAAgB,YAAY,QAAiD;CAC3E,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,OAAO,QAChB,KAAK,MAAM,WAAW,KAAK,IAAI,SAAS,OAAO,KAAK,QAAQ,IAAI,QAAQ,EAAE;CAE5E,OAAO;AACT"}
1
+ {"version":3,"file":"stack-CyVlS7Fr.js","names":[],"sources":["../src/charts/stack.ts"],"sourcesContent":["import { type Series, seriesKey } from './cartesian.ts'\n\n/** Stack series on top of each other; `'percent'` normalizes every category to 100%. */\nexport type StackMode = boolean | 'percent'\n\n/** A stacked segment from `y0` to `y1` (in data units). */\nexport interface Segment {\n y0: number\n y1: number\n}\n\nexport interface StackOptions {\n /** Normalize each category by the sum of absolute values. */\n percent?: boolean\n /** Count missing values as zero (areas) instead of leaving no segment (bars). */\n nullAsZero?: boolean\n /** Keys of hidden series, which get no segment and do not stack. */\n hidden?: ReadonlySet<string>\n}\n\n/**\n * Stack series per category: positive values grow up from zero and\n * negative values down from zero, each on their own running total (like\n * d3's diverging offset), so gains and losses never interleave. Returns one\n * array per series with a segment per category, or `null` for no segment.\n */\nexport function stackSeries(\n series: readonly Series[],\n count: number,\n options: StackOptions = {},\n): (Segment | null)[][] {\n const { percent = false, nullAsZero = false, hidden } = options\n const visible = series.map((s) => !hidden?.has(seriesKey(s)))\n const out = series.map(() => new Array<Segment | null>(count).fill(null))\n\n for (let i = 0; i < count; i++) {\n let total = 0\n if (percent) {\n series.forEach((s, j) => {\n const v = s.values[i]\n if (visible[j] && v != null) total += Math.abs(v)\n })\n }\n let up = 0\n let down = 0\n let lastUp: Segment | undefined\n let lastDown: Segment | undefined\n for (let j = 0; j < series.length; j++) {\n const s = series[j] as Series\n if (!visible[j]) continue\n const raw = s.values[i]\n const valid = raw != null\n if (!valid && !nullAsZero) continue\n let v = valid ? (raw as number) : 0\n if (percent) v = total === 0 ? 0 : v / total\n const row = out[j] as (Segment | null)[]\n if (v < 0) {\n const segment: Segment = { y0: down, y1: down + v }\n row[i] = segment\n down += v\n lastDown = segment\n } else {\n const segment: Segment = { y0: up, y1: up + v }\n row[i] = segment\n up += v\n lastUp = segment\n }\n }\n // Shares must end exactly at ±100%: floating point drift (1.0000000000000002)\n // would otherwise make nice() stretch the axis to 120%, or leave a hairline gap.\n if (percent) {\n if (lastUp && Math.abs(up - 1) < 1e-9) lastUp.y1 = 1\n if (lastDown && Math.abs(down + 1) < 1e-9) lastDown.y1 = -1\n }\n }\n return out\n}\n\n/** Every segment boundary, for the value domain. */\nexport function stackBounds(stacks: readonly (Segment | null)[][]): number[] {\n const values: number[] = []\n for (const row of stacks) {\n for (const segment of row) if (segment) values.push(segment.y0, segment.y1)\n }\n return values\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgB,YACd,QACA,OACA,UAAwB,CAAC,GACH;CACtB,MAAM,EAAE,UAAU,OAAO,aAAa,OAAO,WAAW;CACxD,MAAM,UAAU,OAAO,KAAK,MAAM,CAAC,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC;CAC5D,MAAM,MAAM,OAAO,UAAU,IAAI,MAAsB,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;CAExE,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK;EAC9B,IAAI,QAAQ;EACZ,IAAI,SACF,OAAO,SAAS,GAAG,MAAM;GACvB,MAAM,IAAI,EAAE,OAAO;GACnB,IAAI,QAAQ,MAAM,KAAK,MAAM,SAAS,KAAK,IAAI,CAAC;EAClD,CAAC;EAEH,IAAI,KAAK;EACT,IAAI,OAAO;EACX,IAAI;EACJ,IAAI;EACJ,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;GACtC,MAAM,IAAI,OAAO;GACjB,IAAI,CAAC,QAAQ,IAAI;GACjB,MAAM,MAAM,EAAE,OAAO;GACrB,MAAM,QAAQ,OAAO;GACrB,IAAI,CAAC,SAAS,CAAC,YAAY;GAC3B,IAAI,IAAI,QAAS,MAAiB;GAClC,IAAI,SAAS,IAAI,UAAU,IAAI,IAAI,IAAI;GACvC,MAAM,MAAM,IAAI;GAChB,IAAI,IAAI,GAAG;IACT,MAAM,UAAmB;KAAE,IAAI;KAAM,IAAI,OAAO;IAAE;IAClD,IAAI,KAAK;IACT,QAAQ;IACR,WAAW;GACb,OAAO;IACL,MAAM,UAAmB;KAAE,IAAI;KAAI,IAAI,KAAK;IAAE;IAC9C,IAAI,KAAK;IACT,MAAM;IACN,SAAS;GACX;EACF;EAGA,IAAI,SAAS;GACX,IAAI,UAAU,KAAK,IAAI,KAAK,CAAC,IAAI,MAAM,OAAO,KAAK;GACnD,IAAI,YAAY,KAAK,IAAI,OAAO,CAAC,IAAI,MAAM,SAAS,KAAK;EAC3D;CACF;CACA,OAAO;AACT;;AAGA,SAAgB,YAAY,QAAiD;CAC3E,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,OAAO,QAChB,KAAK,MAAM,WAAW,KAAK,IAAI,SAAS,OAAO,KAAK,QAAQ,IAAI,QAAQ,EAAE;CAE5E,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- const require_cartesian = require("./cartesian-DV02PsBe.cjs");
1
+ const require_cartesian = require("./cartesian-B9CrasFJ.cjs");
2
2
  // src/charts/stack.ts
3
3
  /**
4
4
  * Stack series per category: positive values grow up from zero and
@@ -73,4 +73,4 @@ Object.defineProperty(exports, "stackSeries", {
73
73
  }
74
74
  });
75
75
 
76
- //# sourceMappingURL=stack-BgPzoQmv.cjs.map
76
+ //# sourceMappingURL=stack-DBhmYNat.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"stack-BgPzoQmv.cjs","names":["seriesKey"],"sources":["../src/charts/stack.ts"],"sourcesContent":["import { type Series, seriesKey } from './cartesian.ts'\n\n/** Stack series on top of each other; `'percent'` normalizes every category to 100%. */\nexport type StackMode = boolean | 'percent'\n\n/** A stacked segment from `y0` to `y1` (in data units). */\nexport interface Segment {\n y0: number\n y1: number\n}\n\nexport interface StackOptions {\n /** Normalize each category by the sum of absolute values. */\n percent?: boolean\n /** Count missing values as zero (areas) instead of leaving no segment (bars). */\n nullAsZero?: boolean\n /** Keys of hidden series, which get no segment and do not stack. */\n hidden?: ReadonlySet<string>\n}\n\n/**\n * Stack series per category: positive values grow up from zero and\n * negative values down from zero, each on their own running total (like\n * d3's diverging offset), so gains and losses never interleave. Returns one\n * array per series with a segment per category, or `null` for no segment.\n */\nexport function stackSeries(\n series: readonly Series[],\n count: number,\n options: StackOptions = {},\n): (Segment | null)[][] {\n const { percent = false, nullAsZero = false, hidden } = options\n const visible = series.map((s) => !hidden?.has(seriesKey(s)))\n const out = series.map(() => new Array<Segment | null>(count).fill(null))\n\n for (let i = 0; i < count; i++) {\n let total = 0\n if (percent) {\n series.forEach((s, j) => {\n const v = s.values[i]\n if (visible[j] && v != null) total += Math.abs(v)\n })\n }\n let up = 0\n let down = 0\n let lastUp: Segment | undefined\n let lastDown: Segment | undefined\n for (let j = 0; j < series.length; j++) {\n const s = series[j] as Series\n if (!visible[j]) continue\n const raw = s.values[i]\n const valid = raw != null\n if (!valid && !nullAsZero) continue\n let v = valid ? (raw as number) : 0\n if (percent) v = total === 0 ? 0 : v / total\n const row = out[j] as (Segment | null)[]\n if (v < 0) {\n const segment: Segment = { y0: down, y1: down + v }\n row[i] = segment\n down += v\n lastDown = segment\n } else {\n const segment: Segment = { y0: up, y1: up + v }\n row[i] = segment\n up += v\n lastUp = segment\n }\n }\n // Shares must end exactly at ±100%: floating point drift (1.0000000000000002)\n // would otherwise make nice() stretch the axis to 120%, or leave a hairline gap.\n if (percent) {\n if (lastUp && Math.abs(up - 1) < 1e-9) lastUp.y1 = 1\n if (lastDown && Math.abs(down + 1) < 1e-9) lastDown.y1 = -1\n }\n }\n return out\n}\n\n/** Every segment boundary, for the value domain. */\nexport function stackBounds(stacks: readonly (Segment | null)[][]): number[] {\n const values: number[] = []\n for (const row of stacks) {\n for (const segment of row) if (segment) values.push(segment.y0, segment.y1)\n }\n return values\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgB,YACd,QACA,OACA,UAAwB,CAAC,GACH;CACtB,MAAM,EAAE,UAAU,OAAO,aAAa,OAAO,WAAW;CACxD,MAAM,UAAU,OAAO,KAAK,MAAM,CAAC,QAAQ,IAAIA,kBAAAA,UAAU,CAAC,CAAC,CAAC;CAC5D,MAAM,MAAM,OAAO,UAAU,IAAI,MAAsB,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;CAExE,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK;EAC9B,IAAI,QAAQ;EACZ,IAAI,SACF,OAAO,SAAS,GAAG,MAAM;GACvB,MAAM,IAAI,EAAE,OAAO;GACnB,IAAI,QAAQ,MAAM,KAAK,MAAM,SAAS,KAAK,IAAI,CAAC;EAClD,CAAC;EAEH,IAAI,KAAK;EACT,IAAI,OAAO;EACX,IAAI;EACJ,IAAI;EACJ,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;GACtC,MAAM,IAAI,OAAO;GACjB,IAAI,CAAC,QAAQ,IAAI;GACjB,MAAM,MAAM,EAAE,OAAO;GACrB,MAAM,QAAQ,OAAO;GACrB,IAAI,CAAC,SAAS,CAAC,YAAY;GAC3B,IAAI,IAAI,QAAS,MAAiB;GAClC,IAAI,SAAS,IAAI,UAAU,IAAI,IAAI,IAAI;GACvC,MAAM,MAAM,IAAI;GAChB,IAAI,IAAI,GAAG;IACT,MAAM,UAAmB;KAAE,IAAI;KAAM,IAAI,OAAO;IAAE;IAClD,IAAI,KAAK;IACT,QAAQ;IACR,WAAW;GACb,OAAO;IACL,MAAM,UAAmB;KAAE,IAAI;KAAI,IAAI,KAAK;IAAE;IAC9C,IAAI,KAAK;IACT,MAAM;IACN,SAAS;GACX;EACF;EAGA,IAAI,SAAS;GACX,IAAI,UAAU,KAAK,IAAI,KAAK,CAAC,IAAI,MAAM,OAAO,KAAK;GACnD,IAAI,YAAY,KAAK,IAAI,OAAO,CAAC,IAAI,MAAM,SAAS,KAAK;EAC3D;CACF;CACA,OAAO;AACT;;AAGA,SAAgB,YAAY,QAAiD;CAC3E,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,OAAO,QAChB,KAAK,MAAM,WAAW,KAAK,IAAI,SAAS,OAAO,KAAK,QAAQ,IAAI,QAAQ,EAAE;CAE5E,OAAO;AACT"}
1
+ {"version":3,"file":"stack-DBhmYNat.cjs","names":["seriesKey"],"sources":["../src/charts/stack.ts"],"sourcesContent":["import { type Series, seriesKey } from './cartesian.ts'\n\n/** Stack series on top of each other; `'percent'` normalizes every category to 100%. */\nexport type StackMode = boolean | 'percent'\n\n/** A stacked segment from `y0` to `y1` (in data units). */\nexport interface Segment {\n y0: number\n y1: number\n}\n\nexport interface StackOptions {\n /** Normalize each category by the sum of absolute values. */\n percent?: boolean\n /** Count missing values as zero (areas) instead of leaving no segment (bars). */\n nullAsZero?: boolean\n /** Keys of hidden series, which get no segment and do not stack. */\n hidden?: ReadonlySet<string>\n}\n\n/**\n * Stack series per category: positive values grow up from zero and\n * negative values down from zero, each on their own running total (like\n * d3's diverging offset), so gains and losses never interleave. Returns one\n * array per series with a segment per category, or `null` for no segment.\n */\nexport function stackSeries(\n series: readonly Series[],\n count: number,\n options: StackOptions = {},\n): (Segment | null)[][] {\n const { percent = false, nullAsZero = false, hidden } = options\n const visible = series.map((s) => !hidden?.has(seriesKey(s)))\n const out = series.map(() => new Array<Segment | null>(count).fill(null))\n\n for (let i = 0; i < count; i++) {\n let total = 0\n if (percent) {\n series.forEach((s, j) => {\n const v = s.values[i]\n if (visible[j] && v != null) total += Math.abs(v)\n })\n }\n let up = 0\n let down = 0\n let lastUp: Segment | undefined\n let lastDown: Segment | undefined\n for (let j = 0; j < series.length; j++) {\n const s = series[j] as Series\n if (!visible[j]) continue\n const raw = s.values[i]\n const valid = raw != null\n if (!valid && !nullAsZero) continue\n let v = valid ? (raw as number) : 0\n if (percent) v = total === 0 ? 0 : v / total\n const row = out[j] as (Segment | null)[]\n if (v < 0) {\n const segment: Segment = { y0: down, y1: down + v }\n row[i] = segment\n down += v\n lastDown = segment\n } else {\n const segment: Segment = { y0: up, y1: up + v }\n row[i] = segment\n up += v\n lastUp = segment\n }\n }\n // Shares must end exactly at ±100%: floating point drift (1.0000000000000002)\n // would otherwise make nice() stretch the axis to 120%, or leave a hairline gap.\n if (percent) {\n if (lastUp && Math.abs(up - 1) < 1e-9) lastUp.y1 = 1\n if (lastDown && Math.abs(down + 1) < 1e-9) lastDown.y1 = -1\n }\n }\n return out\n}\n\n/** Every segment boundary, for the value domain. */\nexport function stackBounds(stacks: readonly (Segment | null)[][]): number[] {\n const values: number[] = []\n for (const row of stacks) {\n for (const segment of row) if (segment) values.push(segment.y0, segment.y1)\n }\n return values\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgB,YACd,QACA,OACA,UAAwB,CAAC,GACH;CACtB,MAAM,EAAE,UAAU,OAAO,aAAa,OAAO,WAAW;CACxD,MAAM,UAAU,OAAO,KAAK,MAAM,CAAC,QAAQ,IAAIA,kBAAAA,UAAU,CAAC,CAAC,CAAC;CAC5D,MAAM,MAAM,OAAO,UAAU,IAAI,MAAsB,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;CAExE,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK;EAC9B,IAAI,QAAQ;EACZ,IAAI,SACF,OAAO,SAAS,GAAG,MAAM;GACvB,MAAM,IAAI,EAAE,OAAO;GACnB,IAAI,QAAQ,MAAM,KAAK,MAAM,SAAS,KAAK,IAAI,CAAC;EAClD,CAAC;EAEH,IAAI,KAAK;EACT,IAAI,OAAO;EACX,IAAI;EACJ,IAAI;EACJ,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;GACtC,MAAM,IAAI,OAAO;GACjB,IAAI,CAAC,QAAQ,IAAI;GACjB,MAAM,MAAM,EAAE,OAAO;GACrB,MAAM,QAAQ,OAAO;GACrB,IAAI,CAAC,SAAS,CAAC,YAAY;GAC3B,IAAI,IAAI,QAAS,MAAiB;GAClC,IAAI,SAAS,IAAI,UAAU,IAAI,IAAI,IAAI;GACvC,MAAM,MAAM,IAAI;GAChB,IAAI,IAAI,GAAG;IACT,MAAM,UAAmB;KAAE,IAAI;KAAM,IAAI,OAAO;IAAE;IAClD,IAAI,KAAK;IACT,QAAQ;IACR,WAAW;GACb,OAAO;IACL,MAAM,UAAmB;KAAE,IAAI;KAAI,IAAI,KAAK;IAAE;IAC9C,IAAI,KAAK;IACT,MAAM;IACN,SAAS;GACX;EACF;EAGA,IAAI,SAAS;GACX,IAAI,UAAU,KAAK,IAAI,KAAK,CAAC,IAAI,MAAM,OAAO,KAAK;GACnD,IAAI,YAAY,KAAK,IAAI,OAAO,CAAC,IAAI,MAAM,SAAS,KAAK;EAC3D;CACF;CACA,OAAO;AACT;;AAGA,SAAgB,YAAY,QAAiD;CAC3E,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,OAAO,QAChB,KAAK,MAAM,WAAW,KAAK,IAAI,SAAS,OAAO,KAAK,QAAQ,IAAI,QAAQ,EAAE;CAE5E,OAAO;AACT"}
package/dist/style.css CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! @tabler/charts | MIT */
2
- :where(:root),:where([data-theme=light]){--tc-color-1:var(--tblr-primary,#2a78d6);--tc-color-2:var(--tblr-orange,#eb6834);--tc-color-3:var(--tblr-teal,#1baf7a);--tc-color-4:var(--tblr-yellow,#eda100);--tc-color-5:var(--tblr-pink,#e87ba4);--tc-color-6:var(--tblr-green,#008300);--tc-color-7:var(--tblr-indigo,#4a3aa7);--tc-color-8:var(--tblr-red,#e34948);--tc-color-other:var(--tblr-secondary,#8a8983);--tc-surface:var(--tblr-bg-surface,#fff);--tc-text-color:var(--tblr-body-color,#0b0b0b);--tc-text-muted:var(--tblr-secondary,#6f6e69);--tc-grid-color:var(--tblr-border-color-translucent,#e1e0d9);--tc-baseline-color:var(--tblr-border-color,#c3c2b7);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,11, 11, 11), .04);--tc-tooltip-bg:var(--tblr-dark,#0b0b0b);--tc-tooltip-color:#fff;--tc-tooltip-muted:#ffffffb3;--tc-tooltip-border:#ffffff1f;--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0b0b0b1f);--tc-tooltip-radius:var(--tblr-border-radius,6px);--tc-tooltip-light-bg:#fff;--tc-tooltip-light-color:#0b0b0b;--tc-tooltip-light-muted:#6f6e69;--tc-tooltip-light-border:#0b0b0b1a;--tc-focus-color:var(--tc-color-1);--tc-font-family:var(--tblr-body-font-family,inherit);--tc-font-size:12px;--tc-stroke-width:2px;--tc-grid-width:1px;--tc-area-opacity:.1;--tc-area-gradient-start:.24;--tc-area-gradient-end:0;--tc-pie-value-size:1.75em;--tc-bubble-opacity:.7;--tc-point-ring:2px;--tc-duration:.4s;--tc-duration-fast:.12s;--tc-easing:cubic-bezier(.4, 0, .2, 1)}@media (prefers-color-scheme:dark){:where(:root:not([data-theme=light])){--tc-color-1:var(--tblr-primary,#3987e5);--tc-color-2:var(--tblr-orange,#d95926);--tc-color-3:var(--tblr-teal,#199e70);--tc-color-4:var(--tblr-yellow,#c98500);--tc-color-5:var(--tblr-pink,#d55181);--tc-color-6:var(--tblr-green,#008300);--tc-color-7:var(--tblr-indigo,#9085e9);--tc-color-8:var(--tblr-red,#e66767);--tc-color-other:var(--tblr-secondary,#7c7b76);--tc-surface:var(--tblr-bg-surface,#1a1a19);--tc-text-color:var(--tblr-body-color,#fff);--tc-text-muted:var(--tblr-secondary,#a3a29c);--tc-grid-color:var(--tblr-border-color-translucent,#2c2c2a);--tc-baseline-color:var(--tblr-border-color,#4a4a46);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,255, 255, 255), .06);--tc-tooltip-bg:var(--tblr-dark,#262625);--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0006);--tc-focus-color:var(--tc-color-1)}}:where([data-theme=dark]){--tc-color-1:var(--tblr-primary,#3987e5);--tc-color-2:var(--tblr-orange,#d95926);--tc-color-3:var(--tblr-teal,#199e70);--tc-color-4:var(--tblr-yellow,#c98500);--tc-color-5:var(--tblr-pink,#d55181);--tc-color-6:var(--tblr-green,#008300);--tc-color-7:var(--tblr-indigo,#9085e9);--tc-color-8:var(--tblr-red,#e66767);--tc-color-other:var(--tblr-secondary,#7c7b76);--tc-surface:var(--tblr-bg-surface,#1a1a19);--tc-text-color:var(--tblr-body-color,#fff);--tc-text-muted:var(--tblr-secondary,#a3a29c);--tc-grid-color:var(--tblr-border-color-translucent,#2c2c2a);--tc-baseline-color:var(--tblr-border-color,#4a4a46);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,255, 255, 255), .06);--tc-tooltip-bg:var(--tblr-dark,#262625);--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0006);--tc-focus-color:var(--tc-color-1)}.tc-chart{max-width:100%;height:auto;font-family:var(--tc-font-family);font-size:var(--tc-font-size);letter-spacing:normal;word-spacing:normal;text-transform:none;color:var(--tc-text-color);-webkit-tap-highlight-color:transparent;direction:ltr;display:block;overflow:visible}.tc-chart :where(text){font:inherit}.tc-series{--tc-series-color:var(--tc-color-other);--tc-series-pattern:var(--tc-pattern-other);--tc-pattern-dash:1 3;--tc-pattern-ink:var(--tc-pattern-color,var(--tc-surface));--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1px, #0000 0 3px)}.tc-series-1{--tc-series-color:var(--tc-color-1);--tc-series-pattern:var(--tc-pattern-1);--tc-pattern-dash:none;--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-2{--tc-series-color:var(--tc-color-2);--tc-series-pattern:var(--tc-pattern-2);--tc-pattern-dash:6 3;--tc-swatch-pattern:radial-gradient(var(--tc-pattern-ink) .8px, #0000 1.2px) 0 0 / 4px 4px}.tc-series-3{--tc-series-color:var(--tc-color-3);--tc-series-pattern:var(--tc-pattern-3);--tc-pattern-dash:2 3;--tc-swatch-pattern:repeating-linear-gradient(-45deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-4{--tc-series-color:var(--tc-color-4);--tc-series-pattern:var(--tc-pattern-4);--tc-pattern-dash:10 3 2 3;--tc-swatch-pattern:repeating-linear-gradient(var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-5{--tc-series-color:var(--tc-color-5);--tc-series-pattern:var(--tc-pattern-5);--tc-pattern-dash:4 4;--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px), repeating-linear-gradient(-45deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px)}.tc-series-6{--tc-series-color:var(--tc-color-6);--tc-series-pattern:var(--tc-pattern-6);--tc-pattern-dash:12 4;--tc-swatch-pattern:repeating-linear-gradient(90deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-7{--tc-series-color:var(--tc-color-7);--tc-series-pattern:var(--tc-pattern-7);--tc-pattern-dash:2 2 6 2;--tc-swatch-pattern:repeating-linear-gradient(var(--tc-pattern-ink) 0 1px, #0000 0 4px), repeating-linear-gradient(90deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px)}.tc-series-8{--tc-series-color:var(--tc-color-8);--tc-series-pattern:var(--tc-pattern-8);--tc-pattern-dash:8 2 2 2;--tc-swatch-pattern:linear-gradient(90deg, #0000 50%, var(--tc-series-color) 0) 0 0 / 4px 4px, repeating-linear-gradient(var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-tick-label{fill:var(--tc-text-muted);font-variant-numeric:tabular-nums}.tc-grid-line,.tc-grid-line-zero,.tc-axis-line,.tc-tick-line,.tc-crosshair,.tc-sparkline-zero,.tc-radar-ring,.tc-radar-spoke{stroke:var(--tc-baseline-color);stroke-width:var(--tc-grid-width);shape-rendering:crispedges;vector-effect:non-scaling-stroke}.tc-grid-line,.tc-sparkline-zero,.tc-radar-ring,.tc-radar-spoke{stroke:var(--tc-grid-color)}.tc-grid-line-zero{stroke:var(--tc-baseline-color)}.tc-line{fill:none;stroke:var(--tc-series-color);stroke-width:var(--tc-series-width,var(--tc-stroke-width));stroke-dasharray:var(--tc-series-dash,none);stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke}.tc-area{fill:var(--tc-series-color);fill-opacity:var(--tc-area-opacity);stroke:none}.tc-pie-slices{--tc-pie-gap:0px}.tc-slice{fill:var(--tc-series-color);stroke:var(--tc-surface);stroke-width:var(--tc-pie-gap);stroke-linejoin:round}.tc-pie-track,.tc-gauge-track{fill:var(--tc-grid-color)}.tc-gauge-arc{fill:var(--tc-series-color)}.tc-pie-value,.tc-gauge-value,.tc-parliament-value{font-size:var(--tc-pie-value-size);fill:var(--tc-text-color);font-variant-numeric:tabular-nums;font-weight:600}.tc-pie-label,.tc-gauge-label,.tc-parliament-label{fill:var(--tc-text-muted)}.tc-seat{fill:var(--tc-series-color);transition:transform var(--tc-duration) var(--tc-easing), r var(--tc-duration) var(--tc-easing)}.tc-seat-vacant{fill:var(--tc-grid-color)}.tc-chart-parliament .tc-hover-mark{opacity:.25}.tc-segment{fill:var(--tc-series-color);transition:var(--tc-duration) var(--tc-easing);transition-property:x,width}.tc-percentage-bar-track{fill:var(--tc-grid-color)}.tc-tile{fill:var(--tc-series-color);fill-opacity:var(--tc-treemap-opacity,1);transition:var(--tc-duration) var(--tc-easing);transition-property:x,y,width,height}.tc-treemap-value{font-weight:400}.tc-sankey-node{fill:var(--tc-series-color)}.tc-sankey-link{fill:var(--tc-series-color);fill-opacity:var(--tc-area-opacity);stroke:none}.tc-chart-sankey{--tc-area-opacity:.35}.tc-sankey-value{font-size:.92em}.tc-chart-sankey .tc-hover-mark{opacity:.5}.tc-radar-ring,.tc-radar-spoke,.tc-chart-radar .tc-crosshair{fill:none;shape-rendering:auto}.tc-area-gradient{fill-opacity:1}.tc-fade-start{stop-color:#fff;stop-opacity:var(--tc-area-gradient-start)}.tc-fade-end{stop-color:#fff;stop-opacity:var(--tc-area-gradient-end)}.tc-chart-sparkline{--tc-stroke-width:1.5px;--tc-area-gradient-start:.3}.tc-bubble{fill-opacity:var(--tc-bubble-opacity)}.tc-point{fill:var(--tc-series-color);stroke:var(--tc-surface);stroke-width:var(--tc-point-ring);paint-order:stroke;transition:cx var(--tc-duration) var(--tc-easing), cy var(--tc-duration) var(--tc-easing)}.tc-point-min,.tc-point-max{fill:var(--tc-text-muted)}.tc-annotation{--tc-annotation-color:var(--tc-text-muted)}.tc-annotation-line{stroke:var(--tc-annotation-color);stroke-width:1px;stroke-dasharray:4 3;shape-rendering:crispedges;vector-effect:non-scaling-stroke}.tc-annotation-band{fill:var(--tc-annotation-color);fill-opacity:.1}.tc-annotation-label{fill:var(--tc-annotation-color);font-weight:500}.tc-annotation-label,.tc-radar-value{paint-order:stroke;stroke:var(--tc-surface);stroke-width:3px;stroke-linejoin:round;font-size:.92em}.tc-annotations{pointer-events:none}.tc-value-label,.tc-treemap-label{fill:var(--tc-text-color);font-variant-numeric:tabular-nums;paint-order:stroke;stroke:var(--tc-surface);stroke-width:3px;stroke-linejoin:round;transition:transform var(--tc-duration) var(--tc-easing);animation:tc-fade-in var(--tc-duration) var(--tc-easing);font-weight:500}.tc-marker{transition:d var(--tc-duration) var(--tc-easing)}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){background:var(--tc-series-color);width:10px;height:10px}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) .tc-series-2 :is(.tc-legend-swatch,.tc-tooltip-swatch){border-radius:1px;scale:.8}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) .tc-series-3 :is(.tc-legend-swatch,.tc-tooltip-swatch){clip-path:polygon(50% 3.6%,92.9% 82.1%,7.1% 82.1%);border-radius:0}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) .tc-series-4 :is(.tc-legend-swatch,.tc-tooltip-swatch){clip-path:polygon(50% 3.6%,96.4% 50%,50% 96.4%,3.6% 50%);border-radius:0}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) .tc-series-5 :is(.tc-legend-swatch,.tc-tooltip-swatch){clip-path:polygon(7.1% 17.9%,92.9% 17.9%,50% 96.4%);border-radius:0}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) .tc-series-6 :is(.tc-legend-swatch,.tc-tooltip-swatch){clip-path:polygon(35.7% 7.1%,64.3% 7.1%,64.3% 35.7%,92.9% 35.7%,92.9% 64.3%,64.3% 64.3%,64.3% 92.9%,35.7% 92.9%,35.7% 64.3%,7.1% 64.3%,7.1% 35.7%,35.7% 35.7%);border-radius:0}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) .tc-series-7 :is(.tc-legend-swatch,.tc-tooltip-swatch){clip-path:polygon(25% 7.1%,50% 32.1%,75% 7.1%,92.9% 25%,67.9% 50%,92.9% 75%,75% 92.9%,50% 67.9%,25% 92.9%,7.1% 75%,32.1% 50%,7.1% 25%);border-radius:0}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) .tc-series-8 :is(.tc-legend-swatch,.tc-tooltip-swatch){clip-path:polygon(50% 0%,61.4% 34.3%,97.5% 34.6%,68.6% 56.1%,79.3% 90.4%,50% 69.6%,20.7% 90.4%,31.4% 56.1%,2.5% 34.6%,38.6% 34.3%);border-radius:0}.tc-pattern-bg{fill:var(--tc-series-color)}.tc-pattern-ink{fill:none;stroke:var(--tc-pattern-ink);stroke-width:1.5px;stroke-linecap:round}.tc-patterned :is(.tc-bar,.tc-area,.tc-slice,.tc-gauge-arc,.tc-bubble){fill:var(--tc-series-pattern,var(--tc-series-color))}.tc-patterned .tc-area{fill-opacity:max(var(--tc-area-opacity), .4)}.tc-patterned .tc-line{stroke-dasharray:var(--tc-series-dash,var(--tc-pattern-dash))}:has(>.tc-patterned)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){background:var(--tc-swatch-pattern), var(--tc-series-color)}@keyframes tc-reveal{0%{clip-path:inset(0 var(--tc-reveal,100% 0 0))}to{clip-path:inset(0)}}@keyframes tc-grow{0%{transform:scaleY(0)}}@keyframes tc-grow-x{0%{transform:scaleX(0)}}@keyframes tc-fade-in{0%{opacity:0}}.tc-line,.tc-area,.tc-bar,.tc-radar-ring,.tc-dots{transition:d var(--tc-duration) var(--tc-easing)}.tc-slice,.tc-gauge-arc,.tc-gauge-track{transition:none var(--tc-duration)}.tc-rtl{--tc-reveal:0 0 100%}.tc-chart-line .tc-series-list,.tc-chart-area .tc-series-list{animation:tc-reveal calc(var(--tc-duration) * 2) var(--tc-easing)}.tc-series-list .tc-series,.tc-areas .tc-series,.tc-sankey-links .tc-sankey-link,.tc-sankey-nodes .tc-series,.tc-parliament-seats .tc-series,.tc-parliament-seats .tc-seat,.tc-series-list .tc-point,.tc-heatmap-cells,.tc-treemap-tiles,.tc-percentage-bar,.tc-candles,.tc-tick,.tc-grid-line{animation:tc-fade-in var(--tc-duration) var(--tc-easing)}.tc-bar{fill:var(--tc-series-color);transform-box:fill-box;transform-origin:50% 100%;animation:tc-grow var(--tc-duration) var(--tc-easing)}.tc-bar-negative{transform-origin:50% 0}.tc-cell{fill:var(--tc-cell-fill,var(--tc-heat-color,var(--tc-color-1)));transition:fill var(--tc-duration) var(--tc-easing)}@supports (color:color-mix(in oklab, red 50%, blue)){.tc-cell{fill:var(--tc-cell-fill,color-mix(in oklab, var(--tc-heat-color,var(--tc-color-1)) var(--tc-heat,100%), var(--tc-heat-empty,var(--tc-grid-color))))}}.tc-heatmap-row.tc-series{--tc-heat-color:var(--tc-series-color)}.tc-cell-empty{fill:var(--tc-heat-empty,var(--tc-grid-color));opacity:.5}.tc-candle{--tc-candle-color:var(--tc-up-color,var(--tc-color-6))}.tc-candle-down{--tc-candle-color:var(--tc-negative-color,var(--tc-color-8))}.tc-candle-body{fill:var(--tc-candle-color);transition:d var(--tc-duration) var(--tc-easing), fill var(--tc-duration) var(--tc-easing)}.tc-candle-wick{fill:none;stroke:var(--tc-candle-color);stroke-width:1px;vector-effect:non-scaling-stroke;transition:d var(--tc-duration) var(--tc-easing), stroke var(--tc-duration) var(--tc-easing)}.tc-tristate-loss{fill:var(--tc-negative-color,var(--tc-color-8))}.tc-tristate-draw{fill:var(--tc-baseline-color)}.tc-bar-horizontal{transform-origin:0;animation-name:tc-grow-x}.tc-bar-horizontal.tc-bar-negative,.tc-rtl .tc-bar-horizontal{transform-origin:100%}.tc-rtl .tc-bar-horizontal.tc-bar-negative{transform-origin:0}.tc-tick,.tc-grid-line{transition:transform var(--tc-duration) var(--tc-easing)}@keyframes tc-pie-in{0%{opacity:0;transform:scale(.85)}}.tc-pie-slices,.tc-gauge-rings,.tc-parliament-seats,.tc-radar-series{animation:tc-pie-in calc(var(--tc-duration) * 1.5) var(--tc-easing)}.tc-hover .tc-point{transition:none;animation:none}.tc-static,.tc-chart[data-resizing]{--tc-duration:0s}:where(.tc-container){position:relative}.tc-hover{pointer-events:none}.tc-hover-band{fill:var(--tc-hover-color)}.tc-hover-mark{fill:var(--tc-series-color);opacity:.35}.tc-chart-heatmap .tc-hover-mark,.tc-chart-treemap .tc-hover-mark,.tc-chart-percentage-bar .tc-hover-mark{fill:none;stroke:var(--tc-text-color);stroke-width:2px;opacity:.6}.tc-tooltip{z-index:10;pointer-events:none;opacity:0;min-width:120px;max-width:min(280px,100%);font-family:var(--tc-font-family);font-size:var(--tc-font-size);overflow-wrap:anywhere;color:var(--tc-tooltip-color);background:var(--tc-tooltip-bg);border:1px solid var(--tc-tooltip-border);border-radius:var(--tc-tooltip-radius);box-shadow:var(--tc-tooltip-shadow);transition:opacity var(--tc-duration-fast) var(--tc-easing);padding:8px 10px;line-height:1.4;position:absolute;top:0;left:0}.tc-tooltip-light{--tc-tooltip-bg:var(--tc-tooltip-light-bg);--tc-tooltip-color:var(--tc-tooltip-light-color);--tc-tooltip-muted:var(--tc-tooltip-light-muted);--tc-tooltip-border:var(--tc-tooltip-light-border)}.tc-tooltip .tc-series{--tc-pattern-ink:var(--tc-pattern-color,var(--tc-tooltip-bg))}.tc-tooltip[data-visible]{opacity:1;transition:opacity var(--tc-duration-fast) var(--tc-easing), transform var(--tc-duration-fast) var(--tc-easing)}.tc-tooltip-title{margin-bottom:4px;font-weight:600}.tc-tooltip-item{align-items:center;gap:8px;display:flex}.tc-tooltip-swatch,.tc-legend-swatch{background:var(--tc-series-color);border-radius:50%;flex:none;width:8px;height:8px}.tc-tooltip-name{color:var(--tc-tooltip-muted);flex:1}.tc-tooltip-value{white-space:nowrap;font-variant-numeric:tabular-nums;font-weight:500}.tc-tooltip-footer{border-top:1px solid var(--tc-tooltip-border);margin-top:4px;padding-top:4px}.tc-tooltip-item-active .tc-tooltip-name{color:var(--tc-tooltip-color)}.tc-legend{font-family:var(--tc-font-family);font-size:var(--tc-font-size);margin-bottom:8px;line-height:1.4}.tc-legend[data-position=bottom]{margin:8px 0 0}.tc-legend-items{flex-wrap:wrap;gap:4px 12px;display:flex}.tc-legend-item{appearance:none;font:inherit;text-align:start;color:var(--tc-text-color);cursor:pointer;transition:color var(--tc-duration-fast) var(--tc-easing);background:0 0;border:0;border-radius:4px;align-items:center;gap:6px;margin:0;padding:2px 4px;display:inline-flex}.tc-legend-item:hover{background:var(--tc-hover-color)}.tc-legend-item:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:1px}.tc-legend-item-hidden{color:var(--tc-text-muted)}.tc-legend-item-hidden .tc-legend-swatch{box-shadow:inset 0 0 0 1.5px var(--tc-series-color);background:0 0}.tc-download{z-index:11;font-family:var(--tc-font-family);font-size:var(--tc-font-size);line-height:1.4;position:absolute;top:0;right:0}.tc-download-toggle,.tc-download-item{appearance:none;font:inherit;color:var(--tc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:4px;align-items:center;margin:0;display:flex}.tc-download-toggle{justify-content:center;width:24px;height:24px;padding:0}.tc-download-toggle:hover,.tc-download-toggle[aria-expanded=true],.tc-download-item:hover{color:var(--tc-text-color);background:var(--tc-hover-color)}.tc-download-toggle:focus-visible,.tc-download-item:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:1px}.tc-download-menu{min-width:80px;color:var(--tc-text-color);background:var(--tc-surface);border:1px solid var(--tc-grid-color);border-radius:var(--tc-tooltip-radius);box-shadow:var(--tc-tooltip-shadow);margin-top:2px;padding:4px;position:absolute;top:100%;right:0}.tc-download[dir=rtl],[dir=rtl]>*>.tc-download-menu{left:0;right:auto}.tc-download-item{text-align:start;white-space:nowrap;width:100%;padding:4px 8px}.tc-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.tc-chart:focus{outline:none}.tc-chart:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:2px;border-radius:2px}.tc-table-wrap:not(.tc-sr-only){margin-top:12px;overflow-x:auto}.tc-table{border-collapse:collapse;width:100%;font-family:var(--tc-font-family);font-size:var(--tc-font-size);font-variant-numeric:tabular-nums;color:var(--tc-text-color)}.tc-table caption{text-align:start;margin-bottom:4px;font-weight:600}.tc-table th,.tc-table td{text-align:end;border-bottom:1px solid var(--tc-grid-color);padding:4px 8px}.tc-table th[scope=row],.tc-table thead th:first-child{text-align:start}.tc-table thead th{color:var(--tc-text-muted);border-bottom-color:var(--tc-baseline-color);font-weight:600}@media (prefers-reduced-motion:reduce){.tc-chart,.tc-tooltip{--tc-duration:0s;--tc-duration-fast:0s}}@media (forced-colors:active){.tc-value-label,.tc-treemap-label{fill:canvastext;stroke:canvas}.tc-tick-label{fill:canvastext}.tc-grid-line,.tc-radar-ring,.tc-radar-spoke{stroke:graytext}.tc-grid-line-zero,.tc-axis-line,.tc-tick-line,.tc-line{stroke:canvastext}.tc-area{fill:graytext}.tc-bar,.tc-point{fill:canvastext;stroke:canvas}.tc-crosshair{stroke:highlight}.tc-tooltip{border-color:canvastext}.tc-legend-swatch{background:canvastext}.tc-legend-item-hidden .tc-legend-swatch{background:0 0;box-shadow:inset 0 0 0 1.5px canvastext}.tc-pattern-bg{fill:canvas}.tc-pattern-ink{stroke:canvastext}:is(.tc-patterned,.tc-patterns-auto) :is(.tc-bar,.tc-area,.tc-slice,.tc-gauge-arc,.tc-bubble){fill:var(--tc-series-pattern,CanvasText);fill-opacity:1;stroke:canvastext;stroke-width:1px}.tc-patterns-auto .tc-line{stroke-dasharray:var(--tc-series-dash,var(--tc-pattern-dash))}:has(>:is(.tc-patterned,.tc-patterns-auto))>:is(.tc-legend,.tc-tooltip) .tc-series{--tc-pattern-color:CanvasText;--tc-series-color:Canvas}:has(>:is(.tc-patterned,.tc-patterns-auto))>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){forced-color-adjust:none;background:var(--tc-swatch-pattern), Canvas;box-shadow:inset 0 0 0 1px canvastext}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){box-shadow:none;background:canvastext}}
2
+ :where(:root),:where([data-theme=light]){--tc-color-1:var(--tblr-chart-1,var(--tblr-primary,#2a78d6));--tc-color-2:var(--tblr-chart-2,var(--tblr-orange,#eb6834));--tc-color-3:var(--tblr-chart-3,var(--tblr-teal,#1baf7a));--tc-color-4:var(--tblr-chart-4,var(--tblr-yellow,#eda100));--tc-color-5:var(--tblr-chart-5,var(--tblr-pink,#e87ba4));--tc-color-6:var(--tblr-cyan,#008300);--tc-color-7:var(--tblr-indigo,#4a3aa7);--tc-color-8:var(--tblr-red,#e34948);--tc-color-other:var(--tblr-secondary,#8a8983);--tc-surface:var(--tblr-bg-surface,#fff);--tc-text-color:var(--tblr-body-color,#0b0b0b);--tc-text-muted:var(--tblr-secondary,#6f6e69);--tc-grid-color:var(--tblr-border-color-translucent,#e1e0d9);--tc-baseline-color:var(--tblr-border-color,#c3c2b7);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,11, 11, 11), .04);--tc-tooltip-bg:var(--tblr-dark,#0b0b0b);--tc-tooltip-color:#fff;--tc-tooltip-muted:#ffffffb3;--tc-tooltip-border:#ffffff1f;--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0b0b0b1f);--tc-tooltip-radius:var(--tblr-border-radius,6px);--tc-tooltip-light-bg:#fff;--tc-tooltip-light-color:#0b0b0b;--tc-tooltip-light-muted:#6f6e69;--tc-tooltip-light-border:#0b0b0b1a;--tc-focus-color:var(--tc-color-1);--tc-font-family:var(--tblr-body-font-family,inherit);--tc-font-size:12px;--tc-stroke-width:2px;--tc-grid-width:1px;--tc-area-opacity:.1;--tc-area-gradient-start:.24;--tc-area-gradient-end:0;--tc-pie-value-size:1.75em;--tc-bubble-opacity:.7;--tc-point-ring:2px;--tc-duration:.4s;--tc-duration-fast:.12s;--tc-easing:cubic-bezier(.4, 0, .2, 1)}@media (prefers-color-scheme:dark){:where(:root:not([data-theme=light])){--tc-color-1:var(--tblr-chart-1,var(--tblr-primary,#3987e5));--tc-color-2:var(--tblr-chart-2,var(--tblr-orange,#d95926));--tc-color-3:var(--tblr-chart-3,var(--tblr-teal,#199e70));--tc-color-4:var(--tblr-chart-4,var(--tblr-yellow,#c98500));--tc-color-5:var(--tblr-chart-5,var(--tblr-pink,#d55181));--tc-color-6:var(--tblr-cyan,#008300);--tc-color-7:var(--tblr-indigo,#9085e9);--tc-color-8:var(--tblr-red,#e66767);--tc-color-other:var(--tblr-secondary,#7c7b76);--tc-surface:var(--tblr-bg-surface,#1a1a19);--tc-text-color:var(--tblr-body-color,#fff);--tc-text-muted:var(--tblr-secondary,#a3a29c);--tc-grid-color:var(--tblr-border-color-translucent,#2c2c2a);--tc-baseline-color:var(--tblr-border-color,#4a4a46);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,255, 255, 255), .06);--tc-tooltip-bg:var(--tblr-dark,#262625);--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0006);--tc-focus-color:var(--tc-color-1)}}:where([data-theme=dark]){--tc-color-1:var(--tblr-chart-1,var(--tblr-primary,#3987e5));--tc-color-2:var(--tblr-chart-2,var(--tblr-orange,#d95926));--tc-color-3:var(--tblr-chart-3,var(--tblr-teal,#199e70));--tc-color-4:var(--tblr-chart-4,var(--tblr-yellow,#c98500));--tc-color-5:var(--tblr-chart-5,var(--tblr-pink,#d55181));--tc-color-6:var(--tblr-cyan,#008300);--tc-color-7:var(--tblr-indigo,#9085e9);--tc-color-8:var(--tblr-red,#e66767);--tc-color-other:var(--tblr-secondary,#7c7b76);--tc-surface:var(--tblr-bg-surface,#1a1a19);--tc-text-color:var(--tblr-body-color,#fff);--tc-text-muted:var(--tblr-secondary,#a3a29c);--tc-grid-color:var(--tblr-border-color-translucent,#2c2c2a);--tc-baseline-color:var(--tblr-border-color,#4a4a46);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,255, 255, 255), .06);--tc-tooltip-bg:var(--tblr-dark,#262625);--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0006);--tc-focus-color:var(--tc-color-1)}.tc-chart{max-width:100%;height:auto;font-family:var(--tc-font-family);font-size:var(--tc-font-size);letter-spacing:normal;word-spacing:normal;text-transform:none;color:var(--tc-text-color);-webkit-tap-highlight-color:transparent;direction:ltr;display:block;overflow:visible}.tc-chart :where(text){font:inherit}.tc-series{--tc-series-color:var(--tc-color-other);--tc-series-pattern:var(--tc-pattern-other);--tc-pattern-dash:1 3;--tc-pattern-ink:var(--tc-pattern-color,var(--tc-surface));--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1px, #0000 0 3px)}.tc-series-1{--tc-series-color:var(--tc-color-1);--tc-series-pattern:var(--tc-pattern-1);--tc-pattern-dash:none;--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-2{--tc-series-color:var(--tc-color-2);--tc-series-pattern:var(--tc-pattern-2);--tc-pattern-dash:6 3;--tc-swatch-pattern:radial-gradient(var(--tc-pattern-ink) .8px, #0000 1.2px) 0 0 / 4px 4px}.tc-series-3{--tc-series-color:var(--tc-color-3);--tc-series-pattern:var(--tc-pattern-3);--tc-pattern-dash:2 3;--tc-swatch-pattern:repeating-linear-gradient(-45deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-4{--tc-series-color:var(--tc-color-4);--tc-series-pattern:var(--tc-pattern-4);--tc-pattern-dash:10 3 2 3;--tc-swatch-pattern:repeating-linear-gradient(var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-5{--tc-series-color:var(--tc-color-5);--tc-series-pattern:var(--tc-pattern-5);--tc-pattern-dash:4 4;--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px), repeating-linear-gradient(-45deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px)}.tc-series-6{--tc-series-color:var(--tc-color-6);--tc-series-pattern:var(--tc-pattern-6);--tc-pattern-dash:12 4;--tc-swatch-pattern:repeating-linear-gradient(90deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-7{--tc-series-color:var(--tc-color-7);--tc-series-pattern:var(--tc-pattern-7);--tc-pattern-dash:2 2 6 2;--tc-swatch-pattern:repeating-linear-gradient(var(--tc-pattern-ink) 0 1px, #0000 0 4px), repeating-linear-gradient(90deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px)}.tc-series-8{--tc-series-color:var(--tc-color-8);--tc-series-pattern:var(--tc-pattern-8);--tc-pattern-dash:8 2 2 2;--tc-swatch-pattern:linear-gradient(90deg, #0000 50%, var(--tc-series-color) 0) 0 0 / 4px 4px, repeating-linear-gradient(var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-tick-label{fill:var(--tc-text-muted);font-variant-numeric:tabular-nums}.tc-axis-title{fill:var(--tc-text-muted)}.tc-grid-line,.tc-grid-line-zero,.tc-axis-line,.tc-tick-line,.tc-crosshair,.tc-sparkline-zero,.tc-radar-ring,.tc-radar-spoke{stroke:var(--tc-baseline-color);stroke-width:var(--tc-grid-width);shape-rendering:crispedges;vector-effect:non-scaling-stroke}.tc-grid-line,.tc-sparkline-zero,.tc-radar-ring,.tc-radar-spoke{stroke:var(--tc-grid-color)}.tc-grid-line-zero{stroke:var(--tc-baseline-color)}.tc-line{fill:none;stroke:var(--tc-series-color);stroke-width:var(--tc-series-width,var(--tc-stroke-width));stroke-dasharray:var(--tc-series-dash,none);stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke}.tc-area{fill:var(--tc-series-color);fill-opacity:var(--tc-area-opacity);stroke:none}.tc-pie-slices{--tc-pie-gap:0px}.tc-slice{fill:var(--tc-series-color);stroke:var(--tc-surface);stroke-width:var(--tc-pie-gap);stroke-linejoin:round}.tc-pie-track,.tc-gauge-track{fill:var(--tc-grid-color)}.tc-gauge-arc{fill:var(--tc-series-color)}.tc-pie-value,.tc-gauge-value,.tc-parliament-value{font-size:var(--tc-pie-value-size);fill:var(--tc-text-color);font-variant-numeric:tabular-nums;font-weight:600}.tc-pie-label,.tc-gauge-label,.tc-parliament-label{fill:var(--tc-text-muted)}.tc-seat{fill:var(--tc-series-color);transition:transform var(--tc-duration) var(--tc-easing), r var(--tc-duration) var(--tc-easing)}.tc-seat-vacant{fill:var(--tc-grid-color)}.tc-chart-parliament .tc-hover-mark{opacity:.25}.tc-segment{fill:var(--tc-series-color);transition:var(--tc-duration) var(--tc-easing);transition-property:x,width}.tc-percentage-bar-track{fill:var(--tc-grid-color)}.tc-tile{fill:var(--tc-series-color);fill-opacity:var(--tc-treemap-opacity,1);transition:var(--tc-duration) var(--tc-easing);transition-property:x,y,width,height}.tc-tile-shaded{fill:var(--tc-cell-fill,var(--tc-heat-color,var(--tc-color-1)));transition-property:x,y,width,height,fill}@supports (color:color-mix(in oklab, red 50%, blue)){.tc-tile-shaded{fill:var(--tc-cell-fill,color-mix(in oklab, var(--tc-heat-color,var(--tc-color-1)) var(--tc-heat,100%), var(--tc-heat-empty,var(--tc-grid-color))))}}.tc-treemap-value{font-weight:400}.tc-funnel-stage{fill:var(--tc-funnel-color,var(--tc-color-1));transition:d var(--tc-duration) var(--tc-easing)}@supports (color:color-mix(in oklab, red 50%, blue)){.tc-funnel-stage{fill:color-mix(in oklab, var(--tc-funnel-color,var(--tc-color-1)) var(--tc-funnel-shade,100%), var(--tc-surface))}}.tc-funnel-name,.tc-funnel-share{fill:var(--tc-text-muted)}.tc-funnel-value{fill:var(--tc-text-color);font-weight:600}.tc-funnel-value,.tc-funnel-share{font-variant-numeric:tabular-nums}.tc-sankey-node{fill:var(--tc-series-color)}.tc-sankey-link{fill:var(--tc-series-color);fill-opacity:var(--tc-area-opacity);stroke:none}.tc-chart-sankey{--tc-area-opacity:.35}.tc-sankey-value{font-size:.92em}.tc-chart-sankey .tc-hover-mark{opacity:.5}.tc-radar-ring,.tc-radar-spoke,.tc-chart-radar .tc-crosshair{fill:none;shape-rendering:auto}.tc-area-gradient{fill-opacity:1}.tc-fade-start{stop-color:#fff;stop-opacity:var(--tc-area-gradient-start)}.tc-fade-end{stop-color:#fff;stop-opacity:var(--tc-area-gradient-end)}.tc-chart-sparkline{--tc-stroke-width:1.5px;--tc-area-gradient-start:.3}.tc-bubble{fill-opacity:var(--tc-bubble-opacity)}.tc-point{fill:var(--tc-series-color);stroke:var(--tc-surface);stroke-width:var(--tc-point-ring);paint-order:stroke;transition:cx var(--tc-duration) var(--tc-easing), cy var(--tc-duration) var(--tc-easing)}.tc-point-min,.tc-point-max{fill:var(--tc-text-muted)}.tc-annotation{--tc-annotation-color:var(--tc-text-muted)}.tc-annotation-line{stroke:var(--tc-annotation-color);stroke-width:1px;stroke-dasharray:var(--tc-annotation-dash,4 3);shape-rendering:crispedges;vector-effect:non-scaling-stroke}.tc-annotation-dot{fill:var(--tc-annotation-color);stroke:var(--tc-surface);stroke-width:1.5px}.tc-annotation-band{fill:var(--tc-annotation-color);fill-opacity:.1}.tc-annotation-label{fill:var(--tc-annotation-color);font-weight:500}.tc-annotation-label,.tc-radar-value{paint-order:stroke;stroke:var(--tc-surface);stroke-width:3px;stroke-linejoin:round;font-size:.92em}.tc-annotation-label-bg{fill:var(--tc-surface)}.tc-annotations{pointer-events:none}.tc-value-label,.tc-treemap-label{fill:var(--tc-text-color);font-variant-numeric:tabular-nums;paint-order:stroke;stroke:var(--tc-surface);stroke-width:3px;stroke-linejoin:round;transition:transform var(--tc-duration) var(--tc-easing);animation:tc-fade-in var(--tc-duration) var(--tc-easing);font-weight:500}.tc-end-label-text{fill:var(--tc-text-color);transition:transform var(--tc-duration) var(--tc-easing)}.tc-end-label-value{font-variant-numeric:tabular-nums;font-weight:600}.tc-end-label-line{fill:none;stroke:var(--tc-series-color);stroke-width:1px;transition:d var(--tc-duration) var(--tc-easing)}.tc-slice-label-text{fill:var(--tc-text-color);transition:transform var(--tc-duration) var(--tc-easing)}.tc-slice-label-name{font-weight:600}.tc-slice-label-line{fill:none;stroke:var(--tc-baseline-color);stroke-width:1px;transition:d var(--tc-duration) var(--tc-easing)}.tc-marker{transition:d var(--tc-duration) var(--tc-easing)}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){background:var(--tc-series-color);border-radius:var(--tc-shape-radius,50%);width:10px;height:10px;clip-path:var(--tc-shape,none)}.tc-pattern-bg{fill:var(--tc-series-color)}.tc-pattern-ink{fill:none;stroke:var(--tc-pattern-ink);stroke-width:1.5px;stroke-linecap:round}.tc-patterned :is(.tc-bar,.tc-area,.tc-slice,.tc-gauge-arc,.tc-bubble){fill:var(--tc-series-pattern,var(--tc-series-color))}.tc-patterned .tc-area{fill-opacity:max(var(--tc-area-opacity), .4)}.tc-patterned .tc-line{stroke-dasharray:var(--tc-series-dash,var(--tc-pattern-dash))}:has(>.tc-patterned)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){background:var(--tc-swatch-pattern), var(--tc-series-color)}@keyframes tc-reveal{0%{clip-path:inset(0 var(--tc-reveal,100% 0 0))}to{clip-path:inset(0)}}@keyframes tc-grow{0%{transform:scaleY(0)}}@keyframes tc-grow-x{0%{transform:scaleX(0)}}@keyframes tc-fade-in{0%{opacity:0}}.tc-line,.tc-area,.tc-bar,.tc-radar-ring,.tc-dots{transition:d var(--tc-duration) var(--tc-easing)}.tc-slice,.tc-gauge-arc,.tc-gauge-track{transition:none var(--tc-duration)}.tc-rtl{--tc-reveal:0 0 100%}.tc-chart-line .tc-series-list,.tc-chart-area .tc-series-list{animation:tc-reveal calc(var(--tc-duration) * 2) var(--tc-easing)}.tc-series-list .tc-series,.tc-areas .tc-series,.tc-sankey-links .tc-sankey-link,.tc-sankey-nodes .tc-series,.tc-parliament-seats .tc-series,.tc-parliament-seats .tc-seat,.tc-series-list .tc-point,.tc-heatmap-cells,.tc-calendar-cells,.tc-map-regions,.tc-treemap-tiles,.tc-percentage-bar,.tc-funnel-stages,.tc-candles,.tc-tick,.tc-grid-line{animation:tc-fade-in var(--tc-duration) var(--tc-easing)}.tc-bar{fill:var(--tc-series-color);transform-box:fill-box;transform-origin:50% 100%;animation:tc-grow var(--tc-duration) var(--tc-easing)}.tc-bar-negative{transform-origin:50% 0}.tc-cell{fill:var(--tc-cell-fill,var(--tc-heat-color,var(--tc-color-1)));transition:fill var(--tc-duration) var(--tc-easing)}@supports (color:color-mix(in oklab, red 50%, blue)){.tc-cell{fill:var(--tc-cell-fill,color-mix(in oklab, var(--tc-heat-color,var(--tc-color-1)) var(--tc-heat,100%), var(--tc-heat-empty,var(--tc-grid-color))))}}.tc-heatmap-row.tc-series{--tc-heat-color:var(--tc-series-color)}.tc-cell-empty{fill:var(--tc-heat-empty,var(--tc-grid-color));opacity:.5}.tc-region{stroke:var(--tc-surface);stroke-width:.5px;vector-effect:non-scaling-stroke}.tc-region-empty{fill:var(--tc-heat-empty,var(--tc-grid-color))}.tc-region-point,.tc-map-marker{stroke-width:2px}.tc-map-marker{fill:var(--tc-map-marker-color,var(--tc-color-1));stroke:var(--tc-surface)}.tc-region-selected{stroke:var(--tc-text-color);stroke-width:1.5px}.tc-map-selectable .tc-region{cursor:pointer}.tc-chart-map[data-zoom]{touch-action:none;cursor:grab;user-select:none}.tc-chart-map[data-zoom=drag]{cursor:grabbing}.tc-map-zoom,.tc-zoom{z-index:10;background:var(--tc-surface);border:1px solid var(--tc-grid-color);border-radius:6px;position:absolute;top:0;right:0}.tc-download~.tc-map-zoom{top:28px}.tc-map-zoom svg,.tc-zoom svg{fill:none;stroke:currentColor;stroke-width:2px;stroke-linecap:round}.tc-map-zoom :disabled,.tc-zoom :disabled{opacity:.4;pointer-events:none}.tc-chart[data-zoom-axis]{user-select:none}.tc-chart[data-zoom-axis=x]{touch-action:pan-y}.tc-chart[data-zoom-axis=y]{touch-action:pan-x}.tc-zoom-selection,.tc-brush-selection{fill:var(--tc-focus-color);fill-opacity:.12;stroke:var(--tc-focus-color);stroke-opacity:.4}.tc-zoom-selection{pointer-events:none}.tc-brush-selection{cursor:grab}.tc-brush-handle{fill:var(--tc-focus-color);rx:2px;cursor:ew-resize}[data-zoom-axis=y] .tc-brush-handle{cursor:ns-resize}.tc-zoom{display:flex}.tc-download~.tc-zoom{right:28px}.tc-zoom[dir=rtl]{left:0;right:auto}.tc-download~.tc-zoom[dir=rtl]{left:28px}.tc-map-line{fill:none;stroke:var(--tc-map-line-color,var(--tc-color-1));stroke-width:1.5px;stroke-dasharray:4;animation:tc-map-line calc(var(--tc-duration) * 3) linear infinite}@keyframes tc-map-line{to{stroke-dashoffset:-8px}}.tc-candle{--tc-candle-color:var(--tc-up-color,var(--tc-color-6))}.tc-candle-down{--tc-candle-color:var(--tc-negative-color,var(--tc-color-8))}.tc-candle-body{fill:var(--tc-candle-color);transition:d var(--tc-duration) var(--tc-easing), fill var(--tc-duration) var(--tc-easing)}.tc-candle-wick{fill:none;stroke:var(--tc-candle-color);stroke-width:1px;vector-effect:non-scaling-stroke;transition:d var(--tc-duration) var(--tc-easing), stroke var(--tc-duration) var(--tc-easing)}.tc-tristate-loss{fill:var(--tc-negative-color,var(--tc-color-8))}.tc-tristate-draw{fill:var(--tc-baseline-color)}.tc-bar-horizontal{transform-origin:0;animation-name:tc-grow-x}.tc-bar-horizontal.tc-bar-negative,.tc-rtl .tc-bar-horizontal{transform-origin:100%}.tc-rtl .tc-bar-horizontal.tc-bar-negative{transform-origin:0}.tc-tick,.tc-grid-line{transition:transform var(--tc-duration) var(--tc-easing)}@keyframes tc-pie-in{0%{opacity:0;transform:scale(.85)}}.tc-pie-slices,.tc-gauge-rings,.tc-parliament-seats,.tc-radar-series{animation:tc-pie-in calc(var(--tc-duration) * 1.5) var(--tc-easing)}.tc-hover .tc-point{transition:none;animation:none}.tc-static,.tc-chart[data-resizing]{--tc-duration:0s}:where(.tc-container){position:relative}.tc-hover{pointer-events:none}.tc-hover-band{fill:var(--tc-hover-color)}.tc-crosshair-tag{fill:var(--tc-tooltip-bg)}.tc-crosshair-label{fill:var(--tc-tooltip-color);font-variant-numeric:tabular-nums}.tc-hover-mark{fill:var(--tc-series-color);opacity:.35}.tc-chart-heatmap .tc-hover-mark,.tc-chart-calendar .tc-hover-mark,.tc-chart-map .tc-hover-mark,.tc-chart-treemap .tc-hover-mark,.tc-chart-percentage-bar .tc-hover-mark{fill:none;stroke:var(--tc-text-color);stroke-width:2px;opacity:.6}.tc-tooltip{z-index:10;pointer-events:none;opacity:0;min-width:120px;max-width:min(280px,100%);font-family:var(--tc-font-family);font-size:var(--tc-font-size);overflow-wrap:anywhere;color:var(--tc-tooltip-color);background:var(--tc-tooltip-bg);border:1px solid var(--tc-tooltip-border);border-radius:var(--tc-tooltip-radius);box-shadow:var(--tc-tooltip-shadow);transition:opacity var(--tc-duration-fast) var(--tc-easing);padding:8px 10px;line-height:1.4;position:absolute;top:0;left:0}.tc-tooltip-light{--tc-tooltip-bg:var(--tc-tooltip-light-bg);--tc-tooltip-color:var(--tc-tooltip-light-color);--tc-tooltip-muted:var(--tc-tooltip-light-muted);--tc-tooltip-border:var(--tc-tooltip-light-border)}.tc-tooltip .tc-series{--tc-pattern-ink:var(--tc-pattern-color,var(--tc-tooltip-bg))}.tc-tooltip[data-visible]{opacity:1;transition:opacity var(--tc-duration-fast) var(--tc-easing), transform var(--tc-duration-fast) var(--tc-easing)}.tc-tooltip-title{margin-bottom:4px;font-weight:600}.tc-tooltip-item{align-items:center;gap:8px;display:flex}.tc-tooltip-swatch,.tc-legend-swatch{background:var(--tc-series-color);border-radius:50%;flex:none;width:8px;height:8px}.tc-tooltip-name{color:var(--tc-tooltip-muted);flex:1}.tc-tooltip-value{white-space:nowrap;font-variant-numeric:tabular-nums;font-weight:500}.tc-tooltip-footer{border-top:1px solid var(--tc-tooltip-border);margin-top:4px;padding-top:4px}.tc-tooltip-item-active .tc-tooltip-name{color:var(--tc-tooltip-color)}.tc-legend{font-family:var(--tc-font-family);font-size:var(--tc-font-size);margin-bottom:8px;line-height:1.4}.tc-legend[data-position=bottom]{margin:8px 0 0}:where(.tc-legend-beside){grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:16px;display:grid}:where(.tc-legend-beside.tc-legend-start){grid-template-columns:auto minmax(0,1fr)}:where(.tc-legend-beside)>:not(.tc-legend,svg.tc-chart){grid-column:1/-1}.tc-legend:is([data-position=left],[data-position=right]){justify-self:start;max-width:16em;margin:0}.tc-legend:is([data-position=left],[data-position=right]) .tc-legend-items{flex-flow:column}.tc-legend-items{flex-wrap:wrap;gap:4px 12px;display:flex}.tc-legend-item{appearance:none;font:inherit;text-align:start;color:var(--tc-text-color);cursor:pointer;transition:color var(--tc-duration-fast) var(--tc-easing);background:0 0;border:0;border-radius:4px;align-items:center;gap:6px;margin:0;padding:2px 4px;display:inline-flex}.tc-legend-item:hover{background:var(--tc-hover-color)}.tc-legend-item:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:1px}.tc-legend-item-hidden{color:var(--tc-text-muted)}.tc-legend-item-hidden .tc-legend-swatch{box-shadow:inset 0 0 0 1.5px var(--tc-series-color);background:0 0}.tc-download{z-index:11;font-family:var(--tc-font-family);font-size:var(--tc-font-size);line-height:1.4;position:absolute;top:0;right:0}.tc-download-toggle,.tc-download-item{appearance:none;font:inherit;color:var(--tc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:4px;align-items:center;margin:0;display:flex}.tc-download-toggle{justify-content:center;width:24px;height:24px;padding:0}.tc-download-toggle:hover,.tc-download-toggle[aria-expanded=true],.tc-download-item:hover{color:var(--tc-text-color);background:var(--tc-hover-color)}.tc-download-toggle:focus-visible,.tc-download-item:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:1px}.tc-download-menu{min-width:80px;color:var(--tc-text-color);background:var(--tc-surface);border:1px solid var(--tc-grid-color);border-radius:var(--tc-tooltip-radius);box-shadow:var(--tc-tooltip-shadow);margin-top:2px;padding:4px;position:absolute;top:100%;right:0}.tc-download[dir=rtl],[dir=rtl]>*>.tc-download-menu{left:0;right:auto}.tc-download-item{text-align:start;white-space:nowrap;width:100%;padding:4px 8px}.tc-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.tc-chart:focus{outline:none}.tc-chart:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:2px;border-radius:2px}.tc-table-wrap:not(.tc-sr-only){margin-top:12px;overflow-x:auto}.tc-table{border-collapse:collapse;width:100%;font-family:var(--tc-font-family);font-size:var(--tc-font-size);font-variant-numeric:tabular-nums;color:var(--tc-text-color)}.tc-table caption{text-align:start;margin-bottom:4px;font-weight:600}.tc-table th,.tc-table td{text-align:end;border-bottom:1px solid var(--tc-grid-color);padding:4px 8px}.tc-table th[scope=row],.tc-table thead th:first-child{text-align:start}.tc-table thead th{color:var(--tc-text-muted);border-bottom-color:var(--tc-baseline-color);font-weight:600}@media (prefers-reduced-motion:reduce){.tc-chart,.tc-tooltip{--tc-duration:0s;--tc-duration-fast:0s}}@media (forced-colors:active){.tc-value-label,.tc-treemap-label{fill:canvastext;stroke:canvas}.tc-end-label-text,.tc-slice-label-text{fill:canvastext}.tc-slice-label-line{stroke:graytext}.tc-tick-label,.tc-axis-title,.tc-funnel-labels{fill:canvastext}.tc-grid-line,.tc-radar-ring,.tc-radar-spoke{stroke:graytext}.tc-grid-line-zero,.tc-axis-line,.tc-tick-line,.tc-line{stroke:canvastext}.tc-area{fill:graytext}.tc-bar,.tc-funnel-stage,.tc-point{fill:canvastext;stroke:canvas}.tc-crosshair{stroke:highlight}.tc-tooltip{border-color:canvastext}.tc-legend-swatch{background:canvastext}.tc-legend-item-hidden .tc-legend-swatch{background:0 0;box-shadow:inset 0 0 0 1.5px canvastext}.tc-pattern-bg{fill:canvas}.tc-pattern-ink{stroke:canvastext}:is(.tc-patterned,.tc-patterns-auto) :is(.tc-bar,.tc-area,.tc-slice,.tc-gauge-arc,.tc-bubble){fill:var(--tc-series-pattern,CanvasText);fill-opacity:1;stroke:canvastext;stroke-width:1px}.tc-patterns-auto .tc-line{stroke-dasharray:var(--tc-series-dash,var(--tc-pattern-dash))}:has(>:is(.tc-patterned,.tc-patterns-auto))>:is(.tc-legend,.tc-tooltip) .tc-series{--tc-pattern-color:CanvasText;--tc-series-color:Canvas}:has(>:is(.tc-patterned,.tc-patterns-auto))>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){forced-color-adjust:none;background:var(--tc-swatch-pattern), Canvas;box-shadow:inset 0 0 0 1px canvastext}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){box-shadow:none;background:canvastext}}
@@ -1,6 +1,7 @@
1
1
  const require_format = require("./format-CAE5ruy6.cjs");
2
2
  const require_extent = require("./extent-DuYDcvM9.cjs");
3
- const require_cartesian = require("./cartesian-DV02PsBe.cjs");
3
+ const require_axis = require("./axis-BzBkkC5X.cjs");
4
+ const require_cartesian = require("./cartesian-B9CrasFJ.cjs");
4
5
  // src/scales/time.ts
5
6
  const SECOND = 1e3;
6
7
  const MINUTE = 60 * SECOND;
@@ -173,7 +174,7 @@ function chooseInterval(span, count) {
173
174
  let i = 0;
174
175
  while (i < INTERVALS.length && INTERVALS[i].ms < target) i++;
175
176
  if (i === INTERVALS.length) {
176
- const years = Math.max(1, require_cartesian.tickStep(0, target / YEAR, 1));
177
+ const years = Math.max(1, require_axis.tickStep(0, target / YEAR, 1));
177
178
  return {
178
179
  unit: "year",
179
180
  step: years,
@@ -378,4 +379,4 @@ Object.defineProperty(exports, "timePointScale", {
378
379
  }
379
380
  });
380
381
 
381
- //# sourceMappingURL=time-axis-BjZ1bYTK.cjs.map
382
+ //# sourceMappingURL=time-axis-CVKjQKSS.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"time-axis-BjZ1bYTK.cjs","names":["tickStep","getDateFormat","extent","toMs"],"sources":["../src/scales/time.ts","../src/charts/time-axis.ts"],"sourcesContent":["import { getDateFormat, type Locale } from '../format.ts'\nimport type { BandKey, BandScale } from './band.ts'\nimport { extent } from './extent.ts'\nimport { tickStep } from './ticks.ts'\n\n/** A point in time: a `Date` or a timestamp in milliseconds. */\nexport type TimeValue = Date | number\n\nexport interface TimeScaleOptions {\n /** Align ticks to UTC instead of local time (use it for SSR). Defaults to `false`. */\n utc?: boolean\n /** Clamp output to the range. */\n clamp?: boolean\n}\n\n/** Continuous scale mapping time to a pixel range, with calendar-aware ticks. */\nexport interface TimeScale {\n (value: TimeValue): number\n readonly domain: readonly [number, number]\n readonly range: readonly [number, number]\n readonly utc: boolean\n /** Map a pixel back to a time. */\n invert(pixel: number): Date\n /** Tick dates at calendar boundaries, roughly `count` of them. */\n ticks(count?: number): Date[]\n /** A formatter suited to the tick interval chosen for `count`. */\n tickFormat(count?: number, locale?: Locale): (date: Date) => string\n /** A copy with the domain extended to tick boundaries. */\n nice(count?: number): TimeScale\n}\n\ntype Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'\n\ninterface Interval {\n unit: Unit\n step: number\n /** Approximate duration, for choosing an interval. */\n ms: number\n}\n\nconst SECOND = 1000\nconst MINUTE = 60 * SECOND\nconst HOUR = 60 * MINUTE\nconst DAY = 24 * HOUR\nconst WEEK = 7 * DAY\nconst MONTH = 30 * DAY\nconst YEAR = 365 * DAY\n\nconst INTERVALS: Interval[] = [\n { unit: 'second', step: 1, ms: SECOND },\n { unit: 'second', step: 5, ms: 5 * SECOND },\n { unit: 'second', step: 15, ms: 15 * SECOND },\n { unit: 'second', step: 30, ms: 30 * SECOND },\n { unit: 'minute', step: 1, ms: MINUTE },\n { unit: 'minute', step: 5, ms: 5 * MINUTE },\n { unit: 'minute', step: 15, ms: 15 * MINUTE },\n { unit: 'minute', step: 30, ms: 30 * MINUTE },\n { unit: 'hour', step: 1, ms: HOUR },\n { unit: 'hour', step: 3, ms: 3 * HOUR },\n { unit: 'hour', step: 6, ms: 6 * HOUR },\n { unit: 'hour', step: 12, ms: 12 * HOUR },\n { unit: 'day', step: 1, ms: DAY },\n { unit: 'day', step: 2, ms: 2 * DAY },\n { unit: 'week', step: 1, ms: WEEK },\n { unit: 'month', step: 1, ms: MONTH },\n { unit: 'month', step: 3, ms: 3 * MONTH },\n { unit: 'year', step: 1, ms: YEAR },\n]\n\n/** Calendar arithmetic in local time or UTC. */\nfunction calendar(utc: boolean) {\n const get = (d: Date, unit: Unit): number => {\n switch (unit) {\n case 'year':\n return utc ? d.getUTCFullYear() : d.getFullYear()\n case 'month':\n return utc ? d.getUTCMonth() : d.getMonth()\n case 'day':\n case 'week':\n return utc ? d.getUTCDate() : d.getDate()\n case 'hour':\n return utc ? d.getUTCHours() : d.getHours()\n case 'minute':\n return utc ? d.getUTCMinutes() : d.getMinutes()\n default:\n return utc ? d.getUTCSeconds() : d.getSeconds()\n }\n }\n const make = (y: number, mo: number, d: number, h = 0, mi = 0, s = 0): Date =>\n utc ? new Date(Date.UTC(y, mo, d, h, mi, s)) : new Date(y, mo, d, h, mi, s)\n const weekday = (d: Date): number => (utc ? d.getUTCDay() : d.getDay())\n\n /** Start of the interval containing `date` (weeks start on Monday). */\n const floor = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(Math.floor(y / step) * step, 0, 1)\n case 'month':\n return make(y, Math.floor(mo / step) * step, 1)\n case 'week':\n return make(y, mo, d - ((weekday(date) + 6) % 7))\n case 'day':\n return make(y, mo, Math.floor((d - 1) / step) * step + 1)\n case 'hour':\n return make(y, mo, d, Math.floor(get(date, 'hour') / step) * step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), Math.floor(get(date, 'minute') / step) * step)\n default:\n return make(\n y,\n mo,\n d,\n get(date, 'hour'),\n get(date, 'minute'),\n Math.floor(get(date, 'second') / step) * step,\n )\n }\n }\n\n /** `date` moved forward by one interval. */\n const next = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(y + step, 0, 1)\n case 'month':\n return make(y, mo + step, 1)\n case 'week':\n return make(y, mo, d + 7 * step)\n case 'day': {\n // Day steps restart at the first of each month, so ticks land on the 1st.\n const n = make(y, mo, d + step)\n return get(n, 'month') === mo ? n : make(y, mo + 1, 1)\n }\n case 'hour':\n return make(y, mo, d, get(date, 'hour') + step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute') + step)\n default:\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute'), get(date, 'second') + step)\n }\n }\n\n /** Whether `date` sits on the boundary of the unit above `unit`. */\n const boundary = (date: Date, unit: Unit): boolean => {\n switch (unit) {\n case 'second':\n return get(date, 'second') === 0\n case 'minute':\n return get(date, 'minute') === 0 && get(date, 'second') === 0\n case 'hour':\n return get(date, 'hour') === 0 && get(date, 'minute') === 0\n case 'day':\n case 'week':\n return get(date, 'day') === 1\n case 'month':\n return get(date, 'month') === 0\n default:\n return false\n }\n }\n\n return { floor, next, boundary }\n}\n\n/** Pick the interval whose duration is closest to `span / count`. */\nfunction chooseInterval(span: number, count: number): Interval {\n const target = Math.abs(span) / Math.max(1, count)\n let i = 0\n while (i < INTERVALS.length && (INTERVALS[i] as Interval).ms < target) i++\n if (i === INTERVALS.length) {\n // Beyond one year: multiples of years.\n const years = Math.max(1, tickStep(0, target / YEAR, 1))\n return { unit: 'year', step: years, ms: years * YEAR }\n }\n if (i === 0) return INTERVALS[0] as Interval\n const lo = INTERVALS[i - 1] as Interval\n const hi = INTERVALS[i] as Interval\n return target / lo.ms < hi.ms / target ? lo : hi\n}\n\nconst toMs = (value: TimeValue): number => (value instanceof Date ? value.getTime() : value)\n\n/** Intl options for each tick unit, and for the boundary of the unit above it. */\nconst FORMATS: Record<Unit, [Intl.DateTimeFormatOptions, Intl.DateTimeFormatOptions | null]> = {\n second: [\n { hour: 'numeric', minute: '2-digit', second: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n minute: [\n { hour: 'numeric', minute: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n hour: [\n { hour: 'numeric', minute: '2-digit' },\n { month: 'short', day: 'numeric' },\n ],\n day: [{ month: 'short', day: 'numeric' }, null],\n week: [{ month: 'short', day: 'numeric' }, null],\n month: [{ month: 'short' }, { year: 'numeric' }],\n year: [{ year: 'numeric' }, null],\n}\n\n/**\n * Create a time scale over `[start, end]`.\n *\n * ```ts\n * const x = time([new Date(2026, 0, 1), new Date(2026, 2, 31)], [0, 600])\n * x.ticks() // first of each month, or every week, depending on the range\n * x.tickFormat() // e.g. \"Jan\", \"Feb\"\n * ```\n */\nexport function time(\n domain: readonly [TimeValue, TimeValue],\n range: readonly [number, number],\n options: TimeScaleOptions = {},\n): TimeScale {\n const utc = options.utc === true\n const d0 = toMs(domain[0])\n const d1 = toMs(domain[1])\n const [r0, r1] = range\n const span = d1 - d0\n const k = span === 0 ? 0 : (r1 - r0) / span\n const cal = calendar(utc)\n const clamp = options.clamp === true\n const rMin = Math.min(r0, r1)\n const rMax = Math.max(r0, r1)\n\n const scale = (value: TimeValue): number => {\n if (span === 0) return (r0 + r1) / 2\n const px = r0 + (toMs(value) - d0) * k\n return clamp ? Math.min(rMax, Math.max(rMin, px)) : px\n }\n\n const interval = (count = 5): Interval => chooseInterval(span, count)\n\n return Object.assign(scale, {\n domain: [d0, d1] as const,\n range: [r0, r1] as const,\n utc,\n invert(pixel: number): Date {\n return new Date(span === 0 || r1 === r0 ? d0 : d0 + (pixel - r0) / k)\n },\n ticks(count = 5): Date[] {\n if (!Number.isFinite(d0) || !Number.isFinite(d1)) return []\n const lo = Math.min(d0, d1)\n const hi = Math.max(d0, d1)\n if (lo === hi) return [new Date(lo)]\n const step = interval(count)\n const out: Date[] = []\n let t = cal.floor(new Date(lo), step)\n if (t.getTime() < lo) t = cal.next(t, step)\n while (t.getTime() <= hi && out.length < 1000) {\n out.push(t)\n t = cal.next(t, step)\n }\n return d1 < d0 ? out.reverse() : out\n },\n tickFormat(count = 5, locale?: Locale): (date: Date) => string {\n const { unit } = interval(count)\n const [primary, above] = FORMATS[unit]\n const tz = utc ? { timeZone: 'UTC' } : {}\n const main = getDateFormat(locale, { ...primary, ...tz })\n const upper = above ? getDateFormat(locale, { ...above, ...tz }) : null\n return (date) => (upper && cal.boundary(date, unit) ? upper : main).format(date)\n },\n nice(count = 5): TimeScale {\n if (span === 0 || !Number.isFinite(span)) return time(domain, range, options)\n const step = interval(count)\n const lo = cal.floor(new Date(Math.min(d0, d1)), step)\n let hi = cal.floor(new Date(Math.max(d0, d1)), step)\n if (hi.getTime() < Math.max(d0, d1)) hi = cal.next(hi, step)\n return time(d1 < d0 ? [hi, lo] : [lo, hi], range, options)\n },\n })\n}\n\n/**\n * A point scale over time for category charts: each category sits at its\n * real distance in time. Conforms to `BandScale` (zero bandwidth), so line\n * and area charts and their hit testing work unchanged. `stamps` must be\n * ascending; `keys` are the categories' keys.\n */\nexport function timePointScale(\n stamps: readonly number[],\n keys: readonly BandKey[],\n range: readonly [number, number],\n utc: boolean,\n): { scale: BandScale; time: TimeScale } {\n // Spreading large arrays into Math.min/max overflows the stack, so scan.\n const [lo, hi] = extent(stamps) ?? [0, 1]\n const valid = stamps.filter((t) => Number.isFinite(t))\n const t = time([lo, hi], range, { utc })\n const positions = stamps.map((ms) => t(ms))\n const at = (i: number): number => positions[i] ?? range[0]\n const scale = Object.assign((key: BandKey) => positions[keys.indexOf(key)], {\n domain: keys.slice(),\n range,\n bandwidth: 0,\n step: valid.length > 1 ? (range[1] - range[0]) / (valid.length - 1) : 0,\n at,\n center: (key: BandKey) => positions[keys.indexOf(key)],\n indexAt(pixel: number): number {\n // Stamps are sorted, so the nearest position is found by binary search.\n if (positions.length === 0) return -1\n // (They run down the pixels on a reversed range.)\n const down = range[1] < range[0]\n let a = 0\n let b = positions.length - 1\n while (a < b) {\n const mid = (a + b) >> 1\n if ((positions[mid] as number) < pixel !== down) a = mid + 1\n else b = mid\n }\n const prev = a - 1\n return prev >= 0 &&\n Math.abs(pixel - (positions[prev] as number)) < Math.abs((positions[a] as number) - pixel)\n ? prev\n : a\n },\n })\n return { scale: scale as BandScale, time: t }\n}\n","import type { Tick } from '../components/axis.ts'\nimport type { Locale } from '../format.ts'\nimport type { BandKey } from '../scales/band.ts'\nimport { type TimeScale, timePointScale } from '../scales/time.ts'\nimport { type CategoryAxis, type CategoryAxisOptions, type Label, toMs } from './cartesian.ts'\n\n/**\n * A time category axis: points at their real distance in time, ticks on\n * calendar boundaries labelled for the span (or with `x.format`).\n */\nexport function timeAxis(\n labels: readonly Label[],\n keys: readonly BandKey[],\n options: CategoryAxisOptions,\n count: number,\n locale: Locale,\n): CategoryAxis {\n const stamps = labels.map(toMs)\n const points = (range: readonly [number, number]) =>\n timePointScale(stamps, keys, range, options.utc === true)\n const probe = points([0, 1]).time\n const { format } = options\n const label = format ? (d: Date) => format(d, -1) : probe.tickFormat(count, locale)\n let time: TimeScale = probe\n return {\n // Time ticks come from the scale; their labels are what sits at the edges.\n edges: probe.ticks(count).map(label),\n scale(range) {\n const scaled = points(range)\n time = scaled.time\n return scaled.scale\n },\n ticks: (): Tick[] =>\n time.ticks(count).map((d) => ({ value: d.getTime(), position: time(d), label: label(d) })),\n get time() {\n return time\n },\n }\n}\n"],"mappings":";;;;AAwCA,MAAM,SAAS;AACf,MAAM,SAAS,KAAK;AACpB,MAAM,OAAO,KAAK;AAClB,MAAM,MAAM,KAAK;AACjB,MAAM,OAAO,IAAI;AACjB,MAAM,QAAQ,KAAK;AACnB,MAAM,OAAO,MAAM;AAEnB,MAAM,YAAwB;CAC5B;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI;CAAK;CAClC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI,IAAI;CAAK;CACtC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI,IAAI;CAAK;CACtC;EAAE,MAAM;EAAQ,MAAM;EAAI,IAAI,KAAK;CAAK;CACxC;EAAE,MAAM;EAAO,MAAM;EAAG,IAA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AAI,GAAG;KACZ,MAAM,MAAO,IAAI,KAAM;KACvB,IAAK,UAAU,OAAkB,UAAU,MAAM,IAAI,MAAM;UACtD,IAAI;IACX;IACA,MAAM,OAAO,IAAI;IACjB,OAAO,QAAQ,KACb,KAAK,IAAI,QAAS,UAAU,KAAgB,IAAI,KAAK,IAAK,UAAU,KAAgB,KAAK,IACvF,OACA;GACN;EACF,CACoB;EAAgB,MAAM;CAAE;AAC9C;;;;;;AC7TA,SAAgB,SACd,QACA,MACA,SACA,OACA,QACc;CACd,MAAM,SAAS,OAAO,IAAIC,kBAAAA,IAAI;CAC9B,MAAM,UAAU,UACd,eAAe,QAAQ,MAAM,OAAO,QAAQ,QAAQ,IAAI;CAC1D,MAAM,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC7B,MAAM,EAAE,WAAW;CACnB,MAAM,QAAQ,UAAU,MAAY,OAAO,GAAG,EAAE,IAAI,MAAM,WAAW,OAAO,MAAM;CAClF,IAAI,OAAkB;CACtB,OAAO;EAEL,OAAO,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,KAAK;EACnC,MAAM,OAAO;GACX,MAAM,SAAS,OAAO,KAAK;GAC3B,OAAO,OAAO;GACd,OAAO,OAAO;EAChB;EACA,aACE,KAAK,MAAM,KAAK,CAAC,CAAC,KAAK,OAAO;GAAE,OAAO,EAAE,QAAQ;GAAG,UAAU,KAAK,CAAC;GAAG,OAAO,MAAM,CAAC;EAAE,EAAE;EAC3F,IAAI,OAAO;GACT,OAAO;EACT;CACF;AACF"}
1
+ {"version":3,"file":"time-axis-CVKjQKSS.cjs","names":["tickStep","getDateFormat","extent","toMs"],"sources":["../src/scales/time.ts","../src/charts/time-axis.ts"],"sourcesContent":["import { getDateFormat, type Locale } from '../format.ts'\nimport type { BandKey, BandScale } from './band.ts'\nimport { extent } from './extent.ts'\nimport { tickStep } from './ticks.ts'\n\n/** A point in time: a `Date` or a timestamp in milliseconds. */\nexport type TimeValue = Date | number\n\nexport interface TimeScaleOptions {\n /** Align ticks to UTC instead of local time (use it for SSR). Defaults to `false`. */\n utc?: boolean\n /** Clamp output to the range. */\n clamp?: boolean\n}\n\n/** Continuous scale mapping time to a pixel range, with calendar-aware ticks. */\nexport interface TimeScale {\n (value: TimeValue): number\n readonly domain: readonly [number, number]\n readonly range: readonly [number, number]\n readonly utc: boolean\n /** Map a pixel back to a time. */\n invert(pixel: number): Date\n /** Tick dates at calendar boundaries, roughly `count` of them. */\n ticks(count?: number): Date[]\n /** A formatter suited to the tick interval chosen for `count`. */\n tickFormat(count?: number, locale?: Locale): (date: Date) => string\n /** A copy with the domain extended to tick boundaries. */\n nice(count?: number): TimeScale\n}\n\ntype Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'\n\ninterface Interval {\n unit: Unit\n step: number\n /** Approximate duration, for choosing an interval. */\n ms: number\n}\n\nconst SECOND = 1000\nconst MINUTE = 60 * SECOND\nconst HOUR = 60 * MINUTE\nconst DAY = 24 * HOUR\nconst WEEK = 7 * DAY\nconst MONTH = 30 * DAY\nconst YEAR = 365 * DAY\n\nconst INTERVALS: Interval[] = [\n { unit: 'second', step: 1, ms: SECOND },\n { unit: 'second', step: 5, ms: 5 * SECOND },\n { unit: 'second', step: 15, ms: 15 * SECOND },\n { unit: 'second', step: 30, ms: 30 * SECOND },\n { unit: 'minute', step: 1, ms: MINUTE },\n { unit: 'minute', step: 5, ms: 5 * MINUTE },\n { unit: 'minute', step: 15, ms: 15 * MINUTE },\n { unit: 'minute', step: 30, ms: 30 * MINUTE },\n { unit: 'hour', step: 1, ms: HOUR },\n { unit: 'hour', step: 3, ms: 3 * HOUR },\n { unit: 'hour', step: 6, ms: 6 * HOUR },\n { unit: 'hour', step: 12, ms: 12 * HOUR },\n { unit: 'day', step: 1, ms: DAY },\n { unit: 'day', step: 2, ms: 2 * DAY },\n { unit: 'week', step: 1, ms: WEEK },\n { unit: 'month', step: 1, ms: MONTH },\n { unit: 'month', step: 3, ms: 3 * MONTH },\n { unit: 'year', step: 1, ms: YEAR },\n]\n\n/** Calendar arithmetic in local time or UTC. */\nfunction calendar(utc: boolean) {\n const get = (d: Date, unit: Unit): number => {\n switch (unit) {\n case 'year':\n return utc ? d.getUTCFullYear() : d.getFullYear()\n case 'month':\n return utc ? d.getUTCMonth() : d.getMonth()\n case 'day':\n case 'week':\n return utc ? d.getUTCDate() : d.getDate()\n case 'hour':\n return utc ? d.getUTCHours() : d.getHours()\n case 'minute':\n return utc ? d.getUTCMinutes() : d.getMinutes()\n default:\n return utc ? d.getUTCSeconds() : d.getSeconds()\n }\n }\n const make = (y: number, mo: number, d: number, h = 0, mi = 0, s = 0): Date =>\n utc ? new Date(Date.UTC(y, mo, d, h, mi, s)) : new Date(y, mo, d, h, mi, s)\n const weekday = (d: Date): number => (utc ? d.getUTCDay() : d.getDay())\n\n /** Start of the interval containing `date` (weeks start on Monday). */\n const floor = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(Math.floor(y / step) * step, 0, 1)\n case 'month':\n return make(y, Math.floor(mo / step) * step, 1)\n case 'week':\n return make(y, mo, d - ((weekday(date) + 6) % 7))\n case 'day':\n return make(y, mo, Math.floor((d - 1) / step) * step + 1)\n case 'hour':\n return make(y, mo, d, Math.floor(get(date, 'hour') / step) * step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), Math.floor(get(date, 'minute') / step) * step)\n default:\n return make(\n y,\n mo,\n d,\n get(date, 'hour'),\n get(date, 'minute'),\n Math.floor(get(date, 'second') / step) * step,\n )\n }\n }\n\n /** `date` moved forward by one interval. */\n const next = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(y + step, 0, 1)\n case 'month':\n return make(y, mo + step, 1)\n case 'week':\n return make(y, mo, d + 7 * step)\n case 'day': {\n // Day steps restart at the first of each month, so ticks land on the 1st.\n const n = make(y, mo, d + step)\n return get(n, 'month') === mo ? n : make(y, mo + 1, 1)\n }\n case 'hour':\n return make(y, mo, d, get(date, 'hour') + step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute') + step)\n default:\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute'), get(date, 'second') + step)\n }\n }\n\n /** Whether `date` sits on the boundary of the unit above `unit`. */\n const boundary = (date: Date, unit: Unit): boolean => {\n switch (unit) {\n case 'second':\n return get(date, 'second') === 0\n case 'minute':\n return get(date, 'minute') === 0 && get(date, 'second') === 0\n case 'hour':\n return get(date, 'hour') === 0 && get(date, 'minute') === 0\n case 'day':\n case 'week':\n return get(date, 'day') === 1\n case 'month':\n return get(date, 'month') === 0\n default:\n return false\n }\n }\n\n return { floor, next, boundary }\n}\n\n/** Pick the interval whose duration is closest to `span / count`. */\nfunction chooseInterval(span: number, count: number): Interval {\n const target = Math.abs(span) / Math.max(1, count)\n let i = 0\n while (i < INTERVALS.length && (INTERVALS[i] as Interval).ms < target) i++\n if (i === INTERVALS.length) {\n // Beyond one year: multiples of years.\n const years = Math.max(1, tickStep(0, target / YEAR, 1))\n return { unit: 'year', step: years, ms: years * YEAR }\n }\n if (i === 0) return INTERVALS[0] as Interval\n const lo = INTERVALS[i - 1] as Interval\n const hi = INTERVALS[i] as Interval\n return target / lo.ms < hi.ms / target ? lo : hi\n}\n\nconst toMs = (value: TimeValue): number => (value instanceof Date ? value.getTime() : value)\n\n/** Intl options for each tick unit, and for the boundary of the unit above it. */\nconst FORMATS: Record<Unit, [Intl.DateTimeFormatOptions, Intl.DateTimeFormatOptions | null]> = {\n second: [\n { hour: 'numeric', minute: '2-digit', second: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n minute: [\n { hour: 'numeric', minute: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n hour: [\n { hour: 'numeric', minute: '2-digit' },\n { month: 'short', day: 'numeric' },\n ],\n day: [{ month: 'short', day: 'numeric' }, null],\n week: [{ month: 'short', day: 'numeric' }, null],\n month: [{ month: 'short' }, { year: 'numeric' }],\n year: [{ year: 'numeric' }, null],\n}\n\n/**\n * Create a time scale over `[start, end]`.\n *\n * ```ts\n * const x = time([new Date(2026, 0, 1), new Date(2026, 2, 31)], [0, 600])\n * x.ticks() // first of each month, or every week, depending on the range\n * x.tickFormat() // e.g. \"Jan\", \"Feb\"\n * ```\n */\nexport function time(\n domain: readonly [TimeValue, TimeValue],\n range: readonly [number, number],\n options: TimeScaleOptions = {},\n): TimeScale {\n const utc = options.utc === true\n const d0 = toMs(domain[0])\n const d1 = toMs(domain[1])\n const [r0, r1] = range\n const span = d1 - d0\n const k = span === 0 ? 0 : (r1 - r0) / span\n const cal = calendar(utc)\n const clamp = options.clamp === true\n const rMin = Math.min(r0, r1)\n const rMax = Math.max(r0, r1)\n\n const scale = (value: TimeValue): number => {\n if (span === 0) return (r0 + r1) / 2\n const px = r0 + (toMs(value) - d0) * k\n return clamp ? Math.min(rMax, Math.max(rMin, px)) : px\n }\n\n const interval = (count = 5): Interval => chooseInterval(span, count)\n\n return Object.assign(scale, {\n domain: [d0, d1] as const,\n range: [r0, r1] as const,\n utc,\n invert(pixel: number): Date {\n return new Date(span === 0 || r1 === r0 ? d0 : d0 + (pixel - r0) / k)\n },\n ticks(count = 5): Date[] {\n if (!Number.isFinite(d0) || !Number.isFinite(d1)) return []\n const lo = Math.min(d0, d1)\n const hi = Math.max(d0, d1)\n if (lo === hi) return [new Date(lo)]\n const step = interval(count)\n const out: Date[] = []\n let t = cal.floor(new Date(lo), step)\n if (t.getTime() < lo) t = cal.next(t, step)\n while (t.getTime() <= hi && out.length < 1000) {\n out.push(t)\n t = cal.next(t, step)\n }\n return d1 < d0 ? out.reverse() : out\n },\n tickFormat(count = 5, locale?: Locale): (date: Date) => string {\n const { unit } = interval(count)\n const [primary, above] = FORMATS[unit]\n const tz = utc ? { timeZone: 'UTC' } : {}\n const main = getDateFormat(locale, { ...primary, ...tz })\n const upper = above ? getDateFormat(locale, { ...above, ...tz }) : null\n return (date) => (upper && cal.boundary(date, unit) ? upper : main).format(date)\n },\n nice(count = 5): TimeScale {\n if (span === 0 || !Number.isFinite(span)) return time(domain, range, options)\n const step = interval(count)\n const lo = cal.floor(new Date(Math.min(d0, d1)), step)\n let hi = cal.floor(new Date(Math.max(d0, d1)), step)\n if (hi.getTime() < Math.max(d0, d1)) hi = cal.next(hi, step)\n return time(d1 < d0 ? [hi, lo] : [lo, hi], range, options)\n },\n })\n}\n\n/**\n * A point scale over time for category charts: each category sits at its\n * real distance in time. Conforms to `BandScale` (zero bandwidth), so line\n * and area charts and their hit testing work unchanged. `stamps` must be\n * ascending; `keys` are the categories' keys.\n */\nexport function timePointScale(\n stamps: readonly number[],\n keys: readonly BandKey[],\n range: readonly [number, number],\n utc: boolean,\n): { scale: BandScale; time: TimeScale } {\n // Spreading large arrays into Math.min/max overflows the stack, so scan.\n const [lo, hi] = extent(stamps) ?? [0, 1]\n const valid = stamps.filter((t) => Number.isFinite(t))\n const t = time([lo, hi], range, { utc })\n const positions = stamps.map((ms) => t(ms))\n const at = (i: number): number => positions[i] ?? range[0]\n const scale = Object.assign((key: BandKey) => positions[keys.indexOf(key)], {\n domain: keys.slice(),\n range,\n bandwidth: 0,\n step: valid.length > 1 ? (range[1] - range[0]) / (valid.length - 1) : 0,\n at,\n center: (key: BandKey) => positions[keys.indexOf(key)],\n indexAt(pixel: number): number {\n // Stamps are sorted, so the nearest position is found by binary search.\n if (positions.length === 0) return -1\n // (They run down the pixels on a reversed range.)\n const down = range[1] < range[0]\n let a = 0\n let b = positions.length - 1\n while (a < b) {\n const mid = (a + b) >> 1\n if ((positions[mid] as number) < pixel !== down) a = mid + 1\n else b = mid\n }\n const prev = a - 1\n return prev >= 0 &&\n Math.abs(pixel - (positions[prev] as number)) < Math.abs((positions[a] as number) - pixel)\n ? prev\n : a\n },\n })\n return { scale: scale as BandScale, time: t }\n}\n","import type { Tick } from '../components/axis.ts'\nimport type { Locale } from '../format.ts'\nimport type { BandKey } from '../scales/band.ts'\nimport { type TimeScale, timePointScale } from '../scales/time.ts'\nimport { type CategoryAxis, type CategoryAxisOptions, type Label, toMs } from './cartesian.ts'\n\n/**\n * A time category axis: points at their real distance in time, ticks on\n * calendar boundaries labelled for the span (or with `x.format`).\n */\nexport function timeAxis(\n labels: readonly Label[],\n keys: readonly BandKey[],\n options: CategoryAxisOptions,\n count: number,\n locale: Locale,\n): CategoryAxis {\n const stamps = labels.map(toMs)\n const points = (range: readonly [number, number]) =>\n timePointScale(stamps, keys, range, options.utc === true)\n const probe = points([0, 1]).time\n const { format } = options\n const label = format ? (d: Date) => format(d, -1) : probe.tickFormat(count, locale)\n let time: TimeScale = probe\n return {\n // Time ticks come from the scale; their labels are what sits at the edges.\n edges: probe.ticks(count).map(label),\n scale(range) {\n const scaled = points(range)\n time = scaled.time\n return scaled.scale\n },\n ticks: (): Tick[] =>\n time.ticks(count).map((d) => ({ value: d.getTime(), position: time(d), label: label(d) })),\n get time() {\n return time\n },\n }\n}\n"],"mappings":";;;;;AAwCA,MAAM,SAAS;AACf,MAAM,SAAS,KAAK;AACpB,MAAM,OAAO,KAAK;AAClB,MAAM,MAAM,KAAK;AACjB,MAAM,OAAO,IAAI;AACjB,MAAM,QAAQ,KAAK;AACnB,MAAM,OAAO,MAAM;AAEnB,MAAM,YAAwB;CAC5B;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAA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AAE,EAAE;EAC3F,IAAI,OAAO;GACT,OAAO;EACT;CACF;AACF"}
@@ -1,6 +1,7 @@
1
1
  import { a as getDateFormat } from "./format-it1kepFG.js";
2
2
  import { t as extent } from "./extent-DOV8rs-6.js";
3
- import { g as toMs$1, j as tickStep } from "./cartesian-CI2x6N7N.js";
3
+ import { u as tickStep } from "./axis-C5obgdJt.js";
4
+ import { y as toMs$1 } from "./cartesian-COglz544.js";
4
5
  // src/scales/time.ts
5
6
  const SECOND = 1e3;
6
7
  const MINUTE = 60 * SECOND;
@@ -361,4 +362,4 @@ function timeAxis(labels, keys, options, count, locale) {
361
362
  }
362
363
  export { time as n, timePointScale as r, timeAxis as t };
363
364
 
364
- //# sourceMappingURL=time-axis-FLONo54E.js.map
365
+ //# sourceMappingURL=time-axis-CkmbAw4Z.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"time-axis-FLONo54E.js","names":["toMs"],"sources":["../src/scales/time.ts","../src/charts/time-axis.ts"],"sourcesContent":["import { getDateFormat, type Locale } from '../format.ts'\nimport type { BandKey, BandScale } from './band.ts'\nimport { extent } from './extent.ts'\nimport { tickStep } from './ticks.ts'\n\n/** A point in time: a `Date` or a timestamp in milliseconds. */\nexport type TimeValue = Date | number\n\nexport interface TimeScaleOptions {\n /** Align ticks to UTC instead of local time (use it for SSR). Defaults to `false`. */\n utc?: boolean\n /** Clamp output to the range. */\n clamp?: boolean\n}\n\n/** Continuous scale mapping time to a pixel range, with calendar-aware ticks. */\nexport interface TimeScale {\n (value: TimeValue): number\n readonly domain: readonly [number, number]\n readonly range: readonly [number, number]\n readonly utc: boolean\n /** Map a pixel back to a time. */\n invert(pixel: number): Date\n /** Tick dates at calendar boundaries, roughly `count` of them. */\n ticks(count?: number): Date[]\n /** A formatter suited to the tick interval chosen for `count`. */\n tickFormat(count?: number, locale?: Locale): (date: Date) => string\n /** A copy with the domain extended to tick boundaries. */\n nice(count?: number): TimeScale\n}\n\ntype Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'\n\ninterface Interval {\n unit: Unit\n step: number\n /** Approximate duration, for choosing an interval. */\n ms: number\n}\n\nconst SECOND = 1000\nconst MINUTE = 60 * SECOND\nconst HOUR = 60 * MINUTE\nconst DAY = 24 * HOUR\nconst WEEK = 7 * DAY\nconst MONTH = 30 * DAY\nconst YEAR = 365 * DAY\n\nconst INTERVALS: Interval[] = [\n { unit: 'second', step: 1, ms: SECOND },\n { unit: 'second', step: 5, ms: 5 * SECOND },\n { unit: 'second', step: 15, ms: 15 * SECOND },\n { unit: 'second', step: 30, ms: 30 * SECOND },\n { unit: 'minute', step: 1, ms: MINUTE },\n { unit: 'minute', step: 5, ms: 5 * MINUTE },\n { unit: 'minute', step: 15, ms: 15 * MINUTE },\n { unit: 'minute', step: 30, ms: 30 * MINUTE },\n { unit: 'hour', step: 1, ms: HOUR },\n { unit: 'hour', step: 3, ms: 3 * HOUR },\n { unit: 'hour', step: 6, ms: 6 * HOUR },\n { unit: 'hour', step: 12, ms: 12 * HOUR },\n { unit: 'day', step: 1, ms: DAY },\n { unit: 'day', step: 2, ms: 2 * DAY },\n { unit: 'week', step: 1, ms: WEEK },\n { unit: 'month', step: 1, ms: MONTH },\n { unit: 'month', step: 3, ms: 3 * MONTH },\n { unit: 'year', step: 1, ms: YEAR },\n]\n\n/** Calendar arithmetic in local time or UTC. */\nfunction calendar(utc: boolean) {\n const get = (d: Date, unit: Unit): number => {\n switch (unit) {\n case 'year':\n return utc ? d.getUTCFullYear() : d.getFullYear()\n case 'month':\n return utc ? d.getUTCMonth() : d.getMonth()\n case 'day':\n case 'week':\n return utc ? d.getUTCDate() : d.getDate()\n case 'hour':\n return utc ? d.getUTCHours() : d.getHours()\n case 'minute':\n return utc ? d.getUTCMinutes() : d.getMinutes()\n default:\n return utc ? d.getUTCSeconds() : d.getSeconds()\n }\n }\n const make = (y: number, mo: number, d: number, h = 0, mi = 0, s = 0): Date =>\n utc ? new Date(Date.UTC(y, mo, d, h, mi, s)) : new Date(y, mo, d, h, mi, s)\n const weekday = (d: Date): number => (utc ? d.getUTCDay() : d.getDay())\n\n /** Start of the interval containing `date` (weeks start on Monday). */\n const floor = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(Math.floor(y / step) * step, 0, 1)\n case 'month':\n return make(y, Math.floor(mo / step) * step, 1)\n case 'week':\n return make(y, mo, d - ((weekday(date) + 6) % 7))\n case 'day':\n return make(y, mo, Math.floor((d - 1) / step) * step + 1)\n case 'hour':\n return make(y, mo, d, Math.floor(get(date, 'hour') / step) * step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), Math.floor(get(date, 'minute') / step) * step)\n default:\n return make(\n y,\n mo,\n d,\n get(date, 'hour'),\n get(date, 'minute'),\n Math.floor(get(date, 'second') / step) * step,\n )\n }\n }\n\n /** `date` moved forward by one interval. */\n const next = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(y + step, 0, 1)\n case 'month':\n return make(y, mo + step, 1)\n case 'week':\n return make(y, mo, d + 7 * step)\n case 'day': {\n // Day steps restart at the first of each month, so ticks land on the 1st.\n const n = make(y, mo, d + step)\n return get(n, 'month') === mo ? n : make(y, mo + 1, 1)\n }\n case 'hour':\n return make(y, mo, d, get(date, 'hour') + step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute') + step)\n default:\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute'), get(date, 'second') + step)\n }\n }\n\n /** Whether `date` sits on the boundary of the unit above `unit`. */\n const boundary = (date: Date, unit: Unit): boolean => {\n switch (unit) {\n case 'second':\n return get(date, 'second') === 0\n case 'minute':\n return get(date, 'minute') === 0 && get(date, 'second') === 0\n case 'hour':\n return get(date, 'hour') === 0 && get(date, 'minute') === 0\n case 'day':\n case 'week':\n return get(date, 'day') === 1\n case 'month':\n return get(date, 'month') === 0\n default:\n return false\n }\n }\n\n return { floor, next, boundary }\n}\n\n/** Pick the interval whose duration is closest to `span / count`. */\nfunction chooseInterval(span: number, count: number): Interval {\n const target = Math.abs(span) / Math.max(1, count)\n let i = 0\n while (i < INTERVALS.length && (INTERVALS[i] as Interval).ms < target) i++\n if (i === INTERVALS.length) {\n // Beyond one year: multiples of years.\n const years = Math.max(1, tickStep(0, target / YEAR, 1))\n return { unit: 'year', step: years, ms: years * YEAR }\n }\n if (i === 0) return INTERVALS[0] as Interval\n const lo = INTERVALS[i - 1] as Interval\n const hi = INTERVALS[i] as Interval\n return target / lo.ms < hi.ms / target ? lo : hi\n}\n\nconst toMs = (value: TimeValue): number => (value instanceof Date ? value.getTime() : value)\n\n/** Intl options for each tick unit, and for the boundary of the unit above it. */\nconst FORMATS: Record<Unit, [Intl.DateTimeFormatOptions, Intl.DateTimeFormatOptions | null]> = {\n second: [\n { hour: 'numeric', minute: '2-digit', second: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n minute: [\n { hour: 'numeric', minute: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n hour: [\n { hour: 'numeric', minute: '2-digit' },\n { month: 'short', day: 'numeric' },\n ],\n day: [{ month: 'short', day: 'numeric' }, null],\n week: [{ month: 'short', day: 'numeric' }, null],\n month: [{ month: 'short' }, { year: 'numeric' }],\n year: [{ year: 'numeric' }, null],\n}\n\n/**\n * Create a time scale over `[start, end]`.\n *\n * ```ts\n * const x = time([new Date(2026, 0, 1), new Date(2026, 2, 31)], [0, 600])\n * x.ticks() // first of each month, or every week, depending on the range\n * x.tickFormat() // e.g. \"Jan\", \"Feb\"\n * ```\n */\nexport function time(\n domain: readonly [TimeValue, TimeValue],\n range: readonly [number, number],\n options: TimeScaleOptions = {},\n): TimeScale {\n const utc = options.utc === true\n const d0 = toMs(domain[0])\n const d1 = toMs(domain[1])\n const [r0, r1] = range\n const span = d1 - d0\n const k = span === 0 ? 0 : (r1 - r0) / span\n const cal = calendar(utc)\n const clamp = options.clamp === true\n const rMin = Math.min(r0, r1)\n const rMax = Math.max(r0, r1)\n\n const scale = (value: TimeValue): number => {\n if (span === 0) return (r0 + r1) / 2\n const px = r0 + (toMs(value) - d0) * k\n return clamp ? Math.min(rMax, Math.max(rMin, px)) : px\n }\n\n const interval = (count = 5): Interval => chooseInterval(span, count)\n\n return Object.assign(scale, {\n domain: [d0, d1] as const,\n range: [r0, r1] as const,\n utc,\n invert(pixel: number): Date {\n return new Date(span === 0 || r1 === r0 ? d0 : d0 + (pixel - r0) / k)\n },\n ticks(count = 5): Date[] {\n if (!Number.isFinite(d0) || !Number.isFinite(d1)) return []\n const lo = Math.min(d0, d1)\n const hi = Math.max(d0, d1)\n if (lo === hi) return [new Date(lo)]\n const step = interval(count)\n const out: Date[] = []\n let t = cal.floor(new Date(lo), step)\n if (t.getTime() < lo) t = cal.next(t, step)\n while (t.getTime() <= hi && out.length < 1000) {\n out.push(t)\n t = cal.next(t, step)\n }\n return d1 < d0 ? out.reverse() : out\n },\n tickFormat(count = 5, locale?: Locale): (date: Date) => string {\n const { unit } = interval(count)\n const [primary, above] = FORMATS[unit]\n const tz = utc ? { timeZone: 'UTC' } : {}\n const main = getDateFormat(locale, { ...primary, ...tz })\n const upper = above ? getDateFormat(locale, { ...above, ...tz }) : null\n return (date) => (upper && cal.boundary(date, unit) ? upper : main).format(date)\n },\n nice(count = 5): TimeScale {\n if (span === 0 || !Number.isFinite(span)) return time(domain, range, options)\n const step = interval(count)\n const lo = cal.floor(new Date(Math.min(d0, d1)), step)\n let hi = cal.floor(new Date(Math.max(d0, d1)), step)\n if (hi.getTime() < Math.max(d0, d1)) hi = cal.next(hi, step)\n return time(d1 < d0 ? [hi, lo] : [lo, hi], range, options)\n },\n })\n}\n\n/**\n * A point scale over time for category charts: each category sits at its\n * real distance in time. Conforms to `BandScale` (zero bandwidth), so line\n * and area charts and their hit testing work unchanged. `stamps` must be\n * ascending; `keys` are the categories' keys.\n */\nexport function timePointScale(\n stamps: readonly number[],\n keys: readonly BandKey[],\n range: readonly [number, number],\n utc: boolean,\n): { scale: BandScale; time: TimeScale } {\n // Spreading large arrays into Math.min/max overflows the stack, so scan.\n const [lo, hi] = extent(stamps) ?? [0, 1]\n const valid = stamps.filter((t) => Number.isFinite(t))\n const t = time([lo, hi], range, { utc })\n const positions = stamps.map((ms) => t(ms))\n const at = (i: number): number => positions[i] ?? range[0]\n const scale = Object.assign((key: BandKey) => positions[keys.indexOf(key)], {\n domain: keys.slice(),\n range,\n bandwidth: 0,\n step: valid.length > 1 ? (range[1] - range[0]) / (valid.length - 1) : 0,\n at,\n center: (key: BandKey) => positions[keys.indexOf(key)],\n indexAt(pixel: number): number {\n // Stamps are sorted, so the nearest position is found by binary search.\n if (positions.length === 0) return -1\n // (They run down the pixels on a reversed range.)\n const down = range[1] < range[0]\n let a = 0\n let b = positions.length - 1\n while (a < b) {\n const mid = (a + b) >> 1\n if ((positions[mid] as number) < pixel !== down) a = mid + 1\n else b = mid\n }\n const prev = a - 1\n return prev >= 0 &&\n Math.abs(pixel - (positions[prev] as number)) < Math.abs((positions[a] as number) - pixel)\n ? prev\n : a\n },\n })\n return { scale: scale as BandScale, time: t }\n}\n","import type { Tick } from '../components/axis.ts'\nimport type { Locale } from '../format.ts'\nimport type { BandKey } from '../scales/band.ts'\nimport { type TimeScale, timePointScale } from '../scales/time.ts'\nimport { type CategoryAxis, type CategoryAxisOptions, type Label, toMs } from './cartesian.ts'\n\n/**\n * A time category axis: points at their real distance in time, ticks on\n * calendar boundaries labelled for the span (or with `x.format`).\n */\nexport function timeAxis(\n labels: readonly Label[],\n keys: readonly BandKey[],\n options: CategoryAxisOptions,\n count: number,\n locale: Locale,\n): CategoryAxis {\n const stamps = labels.map(toMs)\n const points = (range: readonly [number, number]) =>\n timePointScale(stamps, keys, range, options.utc === true)\n const probe = points([0, 1]).time\n const { format } = options\n const label = format ? (d: Date) => format(d, -1) : probe.tickFormat(count, locale)\n let time: TimeScale = probe\n return {\n // Time ticks come from the scale; their labels are what sits at the edges.\n edges: probe.ticks(count).map(label),\n scale(range) {\n const scaled = points(range)\n time = scaled.time\n return scaled.scale\n },\n ticks: (): Tick[] =>\n time.ticks(count).map((d) => ({ value: d.getTime(), position: time(d), label: label(d) })),\n get time() {\n return time\n },\n }\n}\n"],"mappings":";;;;AAwCA,MAAM,SAAS;AACf,MAAM,SAAS,KAAK;AACpB,MAAM,OAAO,KAAK;AAClB,MAAM,MAAM,KAAK;AACjB,MAAM,OAAO,IAAI;AACjB,MAAM,QAAQ,KAAK;AACnB,MAAM,OAAO,MAAM;AAEnB,MAAM,YAAwB;CAC5B;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI;CAAK;CAClC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI,IAAI;CAAK;CACtC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI,IAAI;CAAK;CACtC;EAAE,MAAM;EAAQ,MAAM;EAAI,IAAI,KAAK;CAAK;CACxC;EAAE,MAAM;EAAO,MAAM;EAAG,IAAI;CAAI;CAChC;EAAE,MAAM;EAAO,MAAM;EAAG,IAAI,IAAI;CAAI;CACpC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI;CAAK;CAClC;EAAE,MAAM;EAAS,MAA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AAU,KAAgB,IAAI,KAAK,IAAK,UAAU,KAAgB,KAAK,IACvF,OACA;GACN;EACF,CACoB;EAAgB,MAAM;CAAE;AAC9C;;;;;;AC7TA,SAAgB,SACd,QACA,MACA,SACA,OACA,QACc;CACd,MAAM,SAAS,OAAO,IAAIA,MAAI;CAC9B,MAAM,UAAU,UACd,eAAe,QAAQ,MAAM,OAAO,QAAQ,QAAQ,IAAI;CAC1D,MAAM,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC7B,MAAM,EAAE,WAAW;CACnB,MAAM,QAAQ,UAAU,MAAY,OAAO,GAAG,EAAE,IAAI,MAAM,WAAW,OAAO,MAAM;CAClF,IAAI,OAAkB;CACtB,OAAO;EAEL,OAAO,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,KAAK;EACnC,MAAM,OAAO;GACX,MAAM,SAAS,OAAO,KAAK;GAC3B,OAAO,OAAO;GACd,OAAO,OAAO;EAChB;EACA,aACE,KAAK,MAAM,KAAK,CAAC,CAAC,KAAK,OAAO;GAAE,OAAO,EAAE,QAAQ;GAAG,UAAU,KAAK,CAAC;GAAG,OAAO,MAAM,CAAC;EAAE,EAAE;EAC3F,IAAI,OAAO;GACT,OAAO;EACT;CACF;AACF"}
1
+ {"version":3,"file":"time-axis-CkmbAw4Z.js","names":["toMs"],"sources":["../src/scales/time.ts","../src/charts/time-axis.ts"],"sourcesContent":["import { getDateFormat, type Locale } from '../format.ts'\nimport type { BandKey, BandScale } from './band.ts'\nimport { extent } from './extent.ts'\nimport { tickStep } from './ticks.ts'\n\n/** A point in time: a `Date` or a timestamp in milliseconds. */\nexport type TimeValue = Date | number\n\nexport interface TimeScaleOptions {\n /** Align ticks to UTC instead of local time (use it for SSR). Defaults to `false`. */\n utc?: boolean\n /** Clamp output to the range. */\n clamp?: boolean\n}\n\n/** Continuous scale mapping time to a pixel range, with calendar-aware ticks. */\nexport interface TimeScale {\n (value: TimeValue): number\n readonly domain: readonly [number, number]\n readonly range: readonly [number, number]\n readonly utc: boolean\n /** Map a pixel back to a time. */\n invert(pixel: number): Date\n /** Tick dates at calendar boundaries, roughly `count` of them. */\n ticks(count?: number): Date[]\n /** A formatter suited to the tick interval chosen for `count`. */\n tickFormat(count?: number, locale?: Locale): (date: Date) => string\n /** A copy with the domain extended to tick boundaries. */\n nice(count?: number): TimeScale\n}\n\ntype Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'\n\ninterface Interval {\n unit: Unit\n step: number\n /** Approximate duration, for choosing an interval. */\n ms: number\n}\n\nconst SECOND = 1000\nconst MINUTE = 60 * SECOND\nconst HOUR = 60 * MINUTE\nconst DAY = 24 * HOUR\nconst WEEK = 7 * DAY\nconst MONTH = 30 * DAY\nconst YEAR = 365 * DAY\n\nconst INTERVALS: Interval[] = [\n { unit: 'second', step: 1, ms: SECOND },\n { unit: 'second', step: 5, ms: 5 * SECOND },\n { unit: 'second', step: 15, ms: 15 * SECOND },\n { unit: 'second', step: 30, ms: 30 * SECOND },\n { unit: 'minute', step: 1, ms: MINUTE },\n { unit: 'minute', step: 5, ms: 5 * MINUTE },\n { unit: 'minute', step: 15, ms: 15 * MINUTE },\n { unit: 'minute', step: 30, ms: 30 * MINUTE },\n { unit: 'hour', step: 1, ms: HOUR },\n { unit: 'hour', step: 3, ms: 3 * HOUR },\n { unit: 'hour', step: 6, ms: 6 * HOUR },\n { unit: 'hour', step: 12, ms: 12 * HOUR },\n { unit: 'day', step: 1, ms: DAY },\n { unit: 'day', step: 2, ms: 2 * DAY },\n { unit: 'week', step: 1, ms: WEEK },\n { unit: 'month', step: 1, ms: MONTH },\n { unit: 'month', step: 3, ms: 3 * MONTH },\n { unit: 'year', step: 1, ms: YEAR },\n]\n\n/** Calendar arithmetic in local time or UTC. */\nfunction calendar(utc: boolean) {\n const get = (d: Date, unit: Unit): number => {\n switch (unit) {\n case 'year':\n return utc ? d.getUTCFullYear() : d.getFullYear()\n case 'month':\n return utc ? d.getUTCMonth() : d.getMonth()\n case 'day':\n case 'week':\n return utc ? d.getUTCDate() : d.getDate()\n case 'hour':\n return utc ? d.getUTCHours() : d.getHours()\n case 'minute':\n return utc ? d.getUTCMinutes() : d.getMinutes()\n default:\n return utc ? d.getUTCSeconds() : d.getSeconds()\n }\n }\n const make = (y: number, mo: number, d: number, h = 0, mi = 0, s = 0): Date =>\n utc ? new Date(Date.UTC(y, mo, d, h, mi, s)) : new Date(y, mo, d, h, mi, s)\n const weekday = (d: Date): number => (utc ? d.getUTCDay() : d.getDay())\n\n /** Start of the interval containing `date` (weeks start on Monday). */\n const floor = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(Math.floor(y / step) * step, 0, 1)\n case 'month':\n return make(y, Math.floor(mo / step) * step, 1)\n case 'week':\n return make(y, mo, d - ((weekday(date) + 6) % 7))\n case 'day':\n return make(y, mo, Math.floor((d - 1) / step) * step + 1)\n case 'hour':\n return make(y, mo, d, Math.floor(get(date, 'hour') / step) * step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), Math.floor(get(date, 'minute') / step) * step)\n default:\n return make(\n y,\n mo,\n d,\n get(date, 'hour'),\n get(date, 'minute'),\n Math.floor(get(date, 'second') / step) * step,\n )\n }\n }\n\n /** `date` moved forward by one interval. */\n const next = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(y + step, 0, 1)\n case 'month':\n return make(y, mo + step, 1)\n case 'week':\n return make(y, mo, d + 7 * step)\n case 'day': {\n // Day steps restart at the first of each month, so ticks land on the 1st.\n const n = make(y, mo, d + step)\n return get(n, 'month') === mo ? n : make(y, mo + 1, 1)\n }\n case 'hour':\n return make(y, mo, d, get(date, 'hour') + step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute') + step)\n default:\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute'), get(date, 'second') + step)\n }\n }\n\n /** Whether `date` sits on the boundary of the unit above `unit`. */\n const boundary = (date: Date, unit: Unit): boolean => {\n switch (unit) {\n case 'second':\n return get(date, 'second') === 0\n case 'minute':\n return get(date, 'minute') === 0 && get(date, 'second') === 0\n case 'hour':\n return get(date, 'hour') === 0 && get(date, 'minute') === 0\n case 'day':\n case 'week':\n return get(date, 'day') === 1\n case 'month':\n return get(date, 'month') === 0\n default:\n return false\n }\n }\n\n return { floor, next, boundary }\n}\n\n/** Pick the interval whose duration is closest to `span / count`. */\nfunction chooseInterval(span: number, count: number): Interval {\n const target = Math.abs(span) / Math.max(1, count)\n let i = 0\n while (i < INTERVALS.length && (INTERVALS[i] as Interval).ms < target) i++\n if (i === INTERVALS.length) {\n // Beyond one year: multiples of years.\n const years = Math.max(1, tickStep(0, target / YEAR, 1))\n return { unit: 'year', step: years, ms: years * YEAR }\n }\n if (i === 0) return INTERVALS[0] as Interval\n const lo = INTERVALS[i - 1] as Interval\n const hi = INTERVALS[i] as Interval\n return target / lo.ms < hi.ms / target ? lo : hi\n}\n\nconst toMs = (value: TimeValue): number => (value instanceof Date ? value.getTime() : value)\n\n/** Intl options for each tick unit, and for the boundary of the unit above it. */\nconst FORMATS: Record<Unit, [Intl.DateTimeFormatOptions, Intl.DateTimeFormatOptions | null]> = {\n second: [\n { hour: 'numeric', minute: '2-digit', second: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n minute: [\n { hour: 'numeric', minute: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n hour: [\n { hour: 'numeric', minute: '2-digit' },\n { month: 'short', day: 'numeric' },\n ],\n day: [{ month: 'short', day: 'numeric' }, null],\n week: [{ month: 'short', day: 'numeric' }, null],\n month: [{ month: 'short' }, { year: 'numeric' }],\n year: [{ year: 'numeric' }, null],\n}\n\n/**\n * Create a time scale over `[start, end]`.\n *\n * ```ts\n * const x = time([new Date(2026, 0, 1), new Date(2026, 2, 31)], [0, 600])\n * x.ticks() // first of each month, or every week, depending on the range\n * x.tickFormat() // e.g. \"Jan\", \"Feb\"\n * ```\n */\nexport function time(\n domain: readonly [TimeValue, TimeValue],\n range: readonly [number, number],\n options: TimeScaleOptions = {},\n): TimeScale {\n const utc = options.utc === true\n const d0 = toMs(domain[0])\n const d1 = toMs(domain[1])\n const [r0, r1] = range\n const span = d1 - d0\n const k = span === 0 ? 0 : (r1 - r0) / span\n const cal = calendar(utc)\n const clamp = options.clamp === true\n const rMin = Math.min(r0, r1)\n const rMax = Math.max(r0, r1)\n\n const scale = (value: TimeValue): number => {\n if (span === 0) return (r0 + r1) / 2\n const px = r0 + (toMs(value) - d0) * k\n return clamp ? Math.min(rMax, Math.max(rMin, px)) : px\n }\n\n const interval = (count = 5): Interval => chooseInterval(span, count)\n\n return Object.assign(scale, {\n domain: [d0, d1] as const,\n range: [r0, r1] as const,\n utc,\n invert(pixel: number): Date {\n return new Date(span === 0 || r1 === r0 ? d0 : d0 + (pixel - r0) / k)\n },\n ticks(count = 5): Date[] {\n if (!Number.isFinite(d0) || !Number.isFinite(d1)) return []\n const lo = Math.min(d0, d1)\n const hi = Math.max(d0, d1)\n if (lo === hi) return [new Date(lo)]\n const step = interval(count)\n const out: Date[] = []\n let t = cal.floor(new Date(lo), step)\n if (t.getTime() < lo) t = cal.next(t, step)\n while (t.getTime() <= hi && out.length < 1000) {\n out.push(t)\n t = cal.next(t, step)\n }\n return d1 < d0 ? out.reverse() : out\n },\n tickFormat(count = 5, locale?: Locale): (date: Date) => string {\n const { unit } = interval(count)\n const [primary, above] = FORMATS[unit]\n const tz = utc ? { timeZone: 'UTC' } : {}\n const main = getDateFormat(locale, { ...primary, ...tz })\n const upper = above ? getDateFormat(locale, { ...above, ...tz }) : null\n return (date) => (upper && cal.boundary(date, unit) ? upper : main).format(date)\n },\n nice(count = 5): TimeScale {\n if (span === 0 || !Number.isFinite(span)) return time(domain, range, options)\n const step = interval(count)\n const lo = cal.floor(new Date(Math.min(d0, d1)), step)\n let hi = cal.floor(new Date(Math.max(d0, d1)), step)\n if (hi.getTime() < Math.max(d0, d1)) hi = cal.next(hi, step)\n return time(d1 < d0 ? [hi, lo] : [lo, hi], range, options)\n },\n })\n}\n\n/**\n * A point scale over time for category charts: each category sits at its\n * real distance in time. Conforms to `BandScale` (zero bandwidth), so line\n * and area charts and their hit testing work unchanged. `stamps` must be\n * ascending; `keys` are the categories' keys.\n */\nexport function timePointScale(\n stamps: readonly number[],\n keys: readonly BandKey[],\n range: readonly [number, number],\n utc: boolean,\n): { scale: BandScale; time: TimeScale } {\n // Spreading large arrays into Math.min/max overflows the stack, so scan.\n const [lo, hi] = extent(stamps) ?? [0, 1]\n const valid = stamps.filter((t) => Number.isFinite(t))\n const t = time([lo, hi], range, { utc })\n const positions = stamps.map((ms) => t(ms))\n const at = (i: number): number => positions[i] ?? range[0]\n const scale = Object.assign((key: BandKey) => positions[keys.indexOf(key)], {\n domain: keys.slice(),\n range,\n bandwidth: 0,\n step: valid.length > 1 ? (range[1] - range[0]) / (valid.length - 1) : 0,\n at,\n center: (key: BandKey) => positions[keys.indexOf(key)],\n indexAt(pixel: number): number {\n // Stamps are sorted, so the nearest position is found by binary search.\n if (positions.length === 0) return -1\n // (They run down the pixels on a reversed range.)\n const down = range[1] < range[0]\n let a = 0\n let b = positions.length - 1\n while (a < b) {\n const mid = (a + b) >> 1\n if ((positions[mid] as number) < pixel !== down) a = mid + 1\n else b = mid\n }\n const prev = a - 1\n return prev >= 0 &&\n Math.abs(pixel - (positions[prev] as number)) < Math.abs((positions[a] as number) - pixel)\n ? prev\n : a\n },\n })\n return { scale: scale as BandScale, time: t }\n}\n","import type { Tick } from '../components/axis.ts'\nimport type { Locale } from '../format.ts'\nimport type { BandKey } from '../scales/band.ts'\nimport { type TimeScale, timePointScale } from '../scales/time.ts'\nimport { type CategoryAxis, type CategoryAxisOptions, type Label, toMs } from './cartesian.ts'\n\n/**\n * A time category axis: points at their real distance in time, ticks on\n * calendar boundaries labelled for the span (or with `x.format`).\n */\nexport function timeAxis(\n labels: readonly Label[],\n keys: readonly BandKey[],\n options: CategoryAxisOptions,\n count: number,\n locale: Locale,\n): CategoryAxis {\n const stamps = labels.map(toMs)\n const points = (range: readonly [number, number]) =>\n timePointScale(stamps, keys, range, options.utc === true)\n const probe = points([0, 1]).time\n const { format } = options\n const label = format ? (d: Date) => format(d, -1) : probe.tickFormat(count, locale)\n let time: TimeScale = probe\n return {\n // Time ticks come from the scale; their labels are what sits at the edges.\n edges: probe.ticks(count).map(label),\n scale(range) {\n const scaled = points(range)\n time = scaled.time\n return scaled.scale\n },\n ticks: (): Tick[] =>\n time.ticks(count).map((d) => ({ value: d.getTime(), position: time(d), label: label(d) })),\n get time() {\n return time\n },\n }\n}\n"],"mappings":";;;;;AAwCA,MAAM,SAAS;AACf,MAAM,SAAS,KAAK;AACpB,MAAM,OAAO,KAAK;AAClB,MAAM,MAAM,KAAK;AACjB,MAAM,OAAO,IAAI;AACjB,MAAM,QAAQ,KAAK;AACnB,MAAM,OAAO,MAAM;AAEnB,MAAM,YAAwB;CAC5B;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI;CAAK;CAClC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI,IAAI;CAAK;CACtC;EAAE,MAAM;EAAQ,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AAM,OAAO,MAAM,KAAK,MAAM;IAC9B,IAAI,IAAI;IACR,IAAI,IAAI,UAAU,SAAS;IAC3B,OAAO,IAAI,GAAG;KACZ,MAAM,MAAO,IAAI,KAAM;KACvB,IAAK,UAAU,OAAkB,UAAU,MAAM,IAAI,MAAM;UACtD,IAAI;IACX;IACA,MAAM,OAAO,IAAI;IACjB,OAAO,QAAQ,KACb,KAAK,IAAI,QAAS,UAAU,KAAgB,IAAI,KAAK,IAAK,UAAU,KAAgB,KAAK,IACvF,OACA;GACN;EACF,CACoB;EAAgB,MAAM;CAAE;AAC9C;;;;;;AC7TA,SAAgB,SACd,QACA,MACA,SACA,OACA,QACc;CACd,MAAM,SAAS,OAAO,IAAIA,MAAI;CAC9B,MAAM,UAAU,UACd,eAAe,QAAQ,MAAM,OAAO,QAAQ,QAAQ,IAAI;CAC1D,MAAM,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC7B,MAAM,EAAE,WAAW;CACnB,MAAM,QAAQ,UAAU,MAAY,OAAO,GAAG,EAAE,IAAI,MAAM,WAAW,OAAO,MAAM;CAClF,IAAI,OAAkB;CACtB,OAAO;EAEL,OAAO,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,KAAK;EACnC,MAAM,OAAO;GACX,MAAM,SAAS,OAAO,KAAK;GAC3B,OAAO,OAAO;GACd,OAAO,OAAO;EAChB;EACA,aACE,KAAK,MAAM,KAAK,CAAC,CAAC,KAAK,OAAO;GAAE,OAAO,EAAE,QAAQ;GAAG,UAAU,KAAK,CAAC;GAAG,OAAO,MAAM,CAAC;EAAE,EAAE;EAC3F,IAAI,OAAO;GACT,OAAO;EACT;CACF;AACF"}
package/dist/time.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dates = require("./dates-DurEr9WT.cjs");
3
- const require_time_axis = require("./time-axis-BjZ1bYTK.cjs");
2
+ const require_dates = require("./dates-0YNY49KQ.cjs");
3
+ const require_time_axis = require("./time-axis-CVKjQKSS.cjs");
4
4
  // src/time.ts
5
5
  /**
6
6
  * Registers the time axis (`x: { type: 'time' }`):
7
7
  * `import '@tabler/charts/time'`. Also exports the scale itself.
8
8
  */
9
- require("./features-DCXEvoya.cjs").register({
9
+ require("./features-DEDP5CEQ.cjs").register({
10
10
  time: {
11
11
  scale: require_time_axis.time,
12
12
  points: require_time_axis.timePointScale,
package/dist/time.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as dateLabels } from "./dates-C2RzY3rE.js";
2
- import { n as time, r as timePointScale, t as timeAxis } from "./time-axis-FLONo54E.js";
3
- import { i as register } from "./features-BMxkqCyS.js";
1
+ import { t as dateLabels } from "./dates-CKDRgpin.js";
2
+ import { n as time, r as timePointScale, t as timeAxis } from "./time-axis-CkmbAw4Z.js";
3
+ import { i as register } from "./features-B55rwpQC.js";
4
4
  // src/time.ts
5
5
  /**
6
6
  * Registers the time axis (`x: { type: 'time' }`):