monobill-mintui 0.6.612 → 0.6.613

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 (623) hide show
  1. package/README.md +76 -302
  2. package/bin/component-dependencies.json +131 -0
  3. package/bin/mint-ui.js +446 -0
  4. package/dist/alert.css +3 -0
  5. package/dist/back-button.css +3 -0
  6. package/dist/bottom-navigation.css +3 -0
  7. package/dist/button.css +3 -0
  8. package/dist/card.css +3 -0
  9. package/dist/chart.css +3 -0
  10. package/dist/checkbox.css +3 -0
  11. package/dist/chip.css +3 -0
  12. package/dist/choice.css +3 -0
  13. package/dist/clickable.css +3 -0
  14. package/dist/collapsible.css +3 -0
  15. package/dist/components/alert/Alert.d.ts +1 -32
  16. package/dist/components/alert/Alert.d.ts.map +10 -1
  17. package/dist/components/alert/browser.js +167 -0
  18. package/dist/components/alert/index.cjs +1 -0
  19. package/dist/components/alert/index.d.ts +1 -3
  20. package/dist/components/alert/index.d.ts.map +10 -1
  21. package/dist/components/alert/index.js +155 -0
  22. package/dist/components/back-button/BackButton.d.ts +1 -18
  23. package/dist/components/back-button/BackButton.d.ts.map +10 -1
  24. package/dist/components/back-button/browser.js +241 -0
  25. package/dist/components/back-button/index.cjs +1 -0
  26. package/dist/components/back-button/index.d.ts +1 -3
  27. package/dist/components/back-button/index.d.ts.map +10 -1
  28. package/dist/components/back-button/index.js +229 -0
  29. package/dist/components/bottom-navigation/BottomNavigation.d.ts +1 -10
  30. package/dist/components/bottom-navigation/BottomNavigation.d.ts.map +10 -1
  31. package/dist/components/bottom-navigation/browser.js +97 -0
  32. package/dist/components/bottom-navigation/index.cjs +1 -0
  33. package/dist/components/bottom-navigation/index.d.ts +2 -5
  34. package/dist/components/bottom-navigation/index.d.ts.map +10 -1
  35. package/dist/components/bottom-navigation/index.js +85 -0
  36. package/dist/components/button/Button.d.ts +1 -57
  37. package/dist/components/button/Button.d.ts.map +10 -1
  38. package/dist/components/button/browser.js +18 -0
  39. package/dist/components/button/index.cjs +1 -0
  40. package/dist/components/button/index.d.ts +1 -3
  41. package/dist/components/button/index.d.ts.map +10 -1
  42. package/dist/components/button/index.js +6 -0
  43. package/dist/components/card/Card.d.ts +1 -17
  44. package/dist/components/card/Card.d.ts.map +10 -1
  45. package/dist/components/card/browser.js +25 -0
  46. package/dist/components/card/index.cjs +1 -0
  47. package/dist/components/card/index.d.ts +1 -3
  48. package/dist/components/card/index.d.ts.map +10 -1
  49. package/dist/components/card/index.js +13 -0
  50. package/dist/components/chart/Chart.d.ts +1 -291
  51. package/dist/components/chart/Chart.d.ts.map +10 -1
  52. package/dist/components/chart/browser.js +1331 -0
  53. package/dist/components/chart/index.cjs +37 -0
  54. package/dist/components/chart/index.d.ts +1 -3
  55. package/dist/components/chart/index.d.ts.map +10 -1
  56. package/dist/components/chart/index.js +1319 -0
  57. package/dist/components/checkbox/Checkbox.d.ts +1 -41
  58. package/dist/components/checkbox/Checkbox.d.ts.map +10 -1
  59. package/dist/components/checkbox/browser.js +162 -0
  60. package/dist/components/checkbox/index.cjs +1 -0
  61. package/dist/components/checkbox/index.d.ts +1 -3
  62. package/dist/components/checkbox/index.d.ts.map +10 -1
  63. package/dist/components/checkbox/index.js +150 -0
  64. package/dist/components/chip/Chip.d.ts +1 -16
  65. package/dist/components/chip/Chip.d.ts.map +10 -1
  66. package/dist/components/chip/browser.js +17 -0
  67. package/dist/components/chip/index.cjs +1 -0
  68. package/dist/components/chip/index.d.ts +1 -3
  69. package/dist/components/chip/index.d.ts.map +10 -1
  70. package/dist/components/chip/index.js +5 -0
  71. package/dist/components/choice/Choice.d.ts +1 -27
  72. package/dist/components/choice/Choice.d.ts.map +10 -1
  73. package/dist/components/choice/browser.js +272 -0
  74. package/dist/components/choice/index.cjs +1 -0
  75. package/dist/components/choice/index.d.ts +1 -5
  76. package/dist/components/choice/index.d.ts.map +10 -1
  77. package/dist/components/choice/index.js +260 -0
  78. package/dist/components/chunks/button-B0Yt0MX1.js +380 -0
  79. package/dist/components/chunks/button-BlbLHMts.js +1 -0
  80. package/dist/components/chunks/caret-down-BN9cl4o4.js +1 -0
  81. package/dist/components/chunks/caret-down-Ch6IfR7r.js +9 -0
  82. package/dist/components/chunks/caret-right-CDUwqoen.js +1 -0
  83. package/dist/components/chunks/caret-right-CVOgr4nk.js +9 -0
  84. package/dist/components/chunks/caret-up-3XCuTXSE.js +1 -0
  85. package/dist/components/chunks/caret-up-D_6oa7o1.js +9 -0
  86. package/dist/components/chunks/chip-B04bJM4r.js +1 -0
  87. package/dist/components/chunks/chip-B9whjEvW.js +54 -0
  88. package/dist/components/chunks/close-5tYlQdkk.js +1 -0
  89. package/dist/components/chunks/close-Dg6U0IjZ.js +10 -0
  90. package/dist/components/chunks/icon-C0OLmjDY.js +1 -0
  91. package/dist/components/chunks/icon-CyzR9aVl.js +1 -0
  92. package/dist/components/chunks/icon-dG8sLTBn.js +27 -0
  93. package/dist/components/chunks/icon-gQAtsERy.js +1324 -0
  94. package/dist/components/chunks/input-8bbXzpa5.js +334 -0
  95. package/dist/components/chunks/input-BoiREc6Y.js +1 -0
  96. package/dist/components/chunks/link-BxhPnVaz.js +1 -0
  97. package/dist/components/chunks/link-DKgtBYK6.js +38 -0
  98. package/dist/components/chunks/modal-B8gNdwEl.js +153 -0
  99. package/dist/components/chunks/modal-WYWvk2lZ.js +1 -0
  100. package/dist/components/chunks/popover-BeaGf_JC.js +1 -0
  101. package/dist/components/chunks/popover-gviDCspV.js +188 -0
  102. package/dist/components/chunks/register-element-BFYmIynH.js +53 -0
  103. package/dist/components/chunks/register-element-tCL_F1YI.js +1 -0
  104. package/dist/components/chunks/search-ANUKQi0r.js +9 -0
  105. package/dist/components/chunks/search-B3egXuw4.js +1 -0
  106. package/dist/components/chunks/spinner-BsaFHuS6.js +108 -0
  107. package/dist/components/chunks/spinner-DbTohC6i.js +63 -0
  108. package/dist/components/chunks/stack-D1uh4L79.js +1 -0
  109. package/dist/components/chunks/stack-DyQfjPDh.js +53 -0
  110. package/dist/components/chunks/table-BgboosRK.js +65 -0
  111. package/dist/components/chunks/table-DDUNUwGd.js +1 -0
  112. package/dist/components/chunks/text-BHkEs8U5.js +67 -0
  113. package/dist/components/chunks/text-BmHZbBMo.js +1 -0
  114. package/dist/components/clickable/Clickable.d.ts +1 -14
  115. package/dist/components/clickable/Clickable.d.ts.map +10 -1
  116. package/dist/components/clickable/browser.js +78 -0
  117. package/dist/components/clickable/index.cjs +1 -0
  118. package/dist/components/clickable/index.d.ts +1 -3
  119. package/dist/components/clickable/index.d.ts.map +10 -1
  120. package/dist/components/clickable/index.js +66 -0
  121. package/dist/components/collapsible/Collapsible.d.ts +1 -28
  122. package/dist/components/collapsible/Collapsible.d.ts.map +10 -1
  123. package/dist/components/collapsible/browser.js +170 -0
  124. package/dist/components/collapsible/index.cjs +1 -0
  125. package/dist/components/collapsible/index.d.ts +1 -3
  126. package/dist/components/collapsible/index.d.ts.map +10 -1
  127. package/dist/components/collapsible/index.js +158 -0
  128. package/dist/components/confirm-action/ConfirmAction.d.ts +1 -27
  129. package/dist/components/confirm-action/ConfirmAction.d.ts.map +10 -1
  130. package/dist/components/confirm-action/browser.js +130 -0
  131. package/dist/components/confirm-action/index.cjs +1 -0
  132. package/dist/components/confirm-action/index.d.ts +2 -3
  133. package/dist/components/confirm-action/index.d.ts.map +10 -1
  134. package/dist/components/confirm-action/index.js +118 -0
  135. package/dist/components/date-picker/DatePicker.d.ts +1 -130
  136. package/dist/components/date-picker/DatePicker.d.ts.map +10 -1
  137. package/dist/components/date-picker/browser.js +1288 -0
  138. package/dist/components/date-picker/index.cjs +1 -0
  139. package/dist/components/date-picker/index.d.ts +1 -3
  140. package/dist/components/date-picker/index.d.ts.map +10 -1
  141. package/dist/components/date-picker/index.js +1276 -0
  142. package/dist/components/dropzone/Dropzone.d.ts +1 -59
  143. package/dist/components/dropzone/Dropzone.d.ts.map +10 -1
  144. package/dist/components/dropzone/browser.js +355 -0
  145. package/dist/components/dropzone/index.cjs +1 -0
  146. package/dist/components/dropzone/index.d.ts +1 -3
  147. package/dist/components/dropzone/index.d.ts.map +10 -1
  148. package/dist/components/dropzone/index.js +343 -0
  149. package/dist/components/form/Form.d.ts +1 -133
  150. package/dist/components/form/Form.d.ts.map +10 -1
  151. package/dist/components/form/browser.js +1002 -0
  152. package/dist/components/form/index.cjs +1 -0
  153. package/dist/components/form/index.d.ts +1 -3
  154. package/dist/components/form/index.d.ts.map +10 -1
  155. package/dist/components/form/index.js +990 -0
  156. package/dist/components/grid/Grid.d.ts +1 -16
  157. package/dist/components/grid/Grid.d.ts.map +10 -1
  158. package/dist/components/grid/browser.js +24 -0
  159. package/dist/components/grid/index.cjs +1 -0
  160. package/dist/components/grid/index.d.ts +1 -3
  161. package/dist/components/grid/index.d.ts.map +10 -1
  162. package/dist/components/grid/index.js +12 -0
  163. package/dist/components/icon/Icon.d.ts +1 -16
  164. package/dist/components/icon/Icon.d.ts.map +10 -1
  165. package/dist/components/icon/browser.js +16 -0
  166. package/dist/components/icon/index.cjs +1 -0
  167. package/dist/components/icon/index.d.ts +2 -3
  168. package/dist/components/icon/index.d.ts.map +10 -1
  169. package/dist/components/icon/index.js +4 -0
  170. package/dist/components/input/Input.d.ts +1 -68
  171. package/dist/components/input/Input.d.ts.map +10 -1
  172. package/dist/components/input/browser.js +17 -0
  173. package/dist/components/input/index.cjs +1 -0
  174. package/dist/components/input/index.d.ts +1 -3
  175. package/dist/components/input/index.d.ts.map +10 -1
  176. package/dist/components/input/index.js +5 -0
  177. package/dist/components/link/Link.d.ts +1 -16
  178. package/dist/components/link/Link.d.ts.map +10 -1
  179. package/dist/components/link/browser.js +16 -0
  180. package/dist/components/link/index.cjs +1 -0
  181. package/dist/components/link/index.d.ts +1 -3
  182. package/dist/components/link/index.d.ts.map +10 -1
  183. package/dist/components/link/index.js +4 -0
  184. package/dist/components/modal/Modal.d.ts +1 -38
  185. package/dist/components/modal/Modal.d.ts.map +10 -1
  186. package/dist/components/modal/browser.js +21 -0
  187. package/dist/components/modal/index.cjs +1 -0
  188. package/dist/components/modal/index.d.ts +1 -3
  189. package/dist/components/modal/index.d.ts.map +10 -1
  190. package/dist/components/modal/index.js +9 -0
  191. package/dist/components/navigation/Navigation.d.ts +1 -0
  192. package/dist/components/navigation/Navigation.d.ts.map +10 -0
  193. package/dist/components/navigation/browser.js +198 -0
  194. package/dist/components/navigation/index.cjs +1 -0
  195. package/dist/components/navigation/index.d.ts +1 -0
  196. package/dist/components/navigation/index.d.ts.map +10 -0
  197. package/dist/components/navigation/index.js +186 -0
  198. package/dist/components/off-canvas/OffCanvas.d.ts +1 -46
  199. package/dist/components/off-canvas/OffCanvas.d.ts.map +10 -1
  200. package/dist/components/off-canvas/browser.js +192 -0
  201. package/dist/components/off-canvas/index.cjs +1 -0
  202. package/dist/components/off-canvas/index.d.ts +1 -3
  203. package/dist/components/off-canvas/index.d.ts.map +10 -1
  204. package/dist/components/off-canvas/index.js +180 -0
  205. package/dist/components/page/Page.d.ts +1 -37
  206. package/dist/components/page/Page.d.ts.map +10 -1
  207. package/dist/components/page/browser.js +74 -0
  208. package/dist/components/page/index.cjs +16 -0
  209. package/dist/components/page/index.d.ts +1 -3
  210. package/dist/components/page/index.d.ts.map +10 -1
  211. package/dist/components/page/index.js +62 -0
  212. package/dist/components/popover/Popover.d.ts +1 -64
  213. package/dist/components/popover/Popover.d.ts.map +10 -1
  214. package/dist/components/popover/browser.js +17 -0
  215. package/dist/components/popover/index.cjs +1 -0
  216. package/dist/components/popover/index.d.ts +1 -3
  217. package/dist/components/popover/index.d.ts.map +10 -1
  218. package/dist/components/popover/index.js +5 -0
  219. package/dist/components/resource-table/ResourceTable.d.ts +1 -327
  220. package/dist/components/resource-table/ResourceTable.d.ts.map +10 -1
  221. package/dist/components/resource-table/browser.js +1457 -0
  222. package/dist/components/resource-table/index.cjs +2 -0
  223. package/dist/components/resource-table/index.d.ts +1 -4
  224. package/dist/components/resource-table/index.d.ts.map +10 -1
  225. package/dist/components/resource-table/index.js +1445 -0
  226. package/dist/components/search/Search.d.ts +1 -151
  227. package/dist/components/search/Search.d.ts.map +10 -1
  228. package/dist/components/search/browser.js +681 -0
  229. package/dist/components/search/index.cjs +1 -0
  230. package/dist/components/search/index.d.ts +1 -3
  231. package/dist/components/search/index.d.ts.map +10 -1
  232. package/dist/components/search/index.js +669 -0
  233. package/dist/components/select/Select.d.ts +1 -37
  234. package/dist/components/select/Select.d.ts.map +10 -1
  235. package/dist/components/select/browser.js +285 -0
  236. package/dist/components/select/index.cjs +1 -0
  237. package/dist/components/select/index.d.ts +1 -3
  238. package/dist/components/select/index.d.ts.map +10 -1
  239. package/dist/components/select/index.js +273 -0
  240. package/dist/components/side-navigation/SideNavigation.d.ts +1 -52
  241. package/dist/components/side-navigation/SideNavigation.d.ts.map +10 -1
  242. package/dist/components/side-navigation/browser.js +466 -0
  243. package/dist/components/side-navigation/index.cjs +1 -0
  244. package/dist/components/side-navigation/index.d.ts +5 -8
  245. package/dist/components/side-navigation/index.d.ts.map +10 -1
  246. package/dist/components/side-navigation/index.js +454 -0
  247. package/dist/components/sortable/Sortable.d.ts +1 -62
  248. package/dist/components/sortable/Sortable.d.ts.map +10 -1
  249. package/dist/components/sortable/browser.js +340 -0
  250. package/dist/components/sortable/index.cjs +1 -0
  251. package/dist/components/sortable/index.d.ts +1 -3
  252. package/dist/components/sortable/index.d.ts.map +10 -1
  253. package/dist/components/sortable/index.js +328 -0
  254. package/dist/components/spinner/Spinner.d.ts +1 -13
  255. package/dist/components/spinner/Spinner.d.ts.map +10 -1
  256. package/dist/components/spinner/browser.js +16 -0
  257. package/dist/components/spinner/index.cjs +1 -0
  258. package/dist/components/spinner/index.d.ts +1 -3
  259. package/dist/components/spinner/index.d.ts.map +10 -1
  260. package/dist/components/spinner/index.js +4 -0
  261. package/dist/components/stack/Stack.d.ts +1 -23
  262. package/dist/components/stack/Stack.d.ts.map +10 -1
  263. package/dist/components/stack/browser.js +16 -0
  264. package/dist/components/stack/index.cjs +1 -0
  265. package/dist/components/stack/index.d.ts +1 -3
  266. package/dist/components/stack/index.d.ts.map +10 -1
  267. package/dist/components/stack/index.js +4 -0
  268. package/dist/components/switch/Switch.d.ts +1 -33
  269. package/dist/components/switch/Switch.d.ts.map +10 -1
  270. package/dist/components/switch/browser.js +203 -0
  271. package/dist/components/switch/index.cjs +1 -0
  272. package/dist/components/switch/index.d.ts +1 -3
  273. package/dist/components/switch/index.d.ts.map +10 -1
  274. package/dist/components/switch/index.js +191 -0
  275. package/dist/components/table/Table.d.ts +1 -11
  276. package/dist/components/table/Table.d.ts.map +10 -1
  277. package/dist/components/table/browser.js +16 -0
  278. package/dist/components/table/index.cjs +1 -0
  279. package/dist/components/table/index.d.ts +1 -3
  280. package/dist/components/table/index.d.ts.map +10 -1
  281. package/dist/components/table/index.js +4 -0
  282. package/dist/components/tabs/Tabs.d.ts +1 -20
  283. package/dist/components/tabs/Tabs.d.ts.map +10 -1
  284. package/dist/components/tabs/browser.js +251 -0
  285. package/dist/components/tabs/index.cjs +1 -0
  286. package/dist/components/tabs/index.d.ts +4 -9
  287. package/dist/components/tabs/index.d.ts.map +10 -1
  288. package/dist/components/tabs/index.js +239 -0
  289. package/dist/components/tags/Tags.d.ts +1 -82
  290. package/dist/components/tags/Tags.d.ts.map +10 -1
  291. package/dist/components/tags/browser.js +416 -0
  292. package/dist/components/tags/index.cjs +1 -0
  293. package/dist/components/tags/index.d.ts +1 -3
  294. package/dist/components/tags/index.d.ts.map +10 -1
  295. package/dist/components/tags/index.js +404 -0
  296. package/dist/components/text/Text.d.ts +1 -25
  297. package/dist/components/text/Text.d.ts.map +10 -1
  298. package/dist/components/text/browser.js +16 -0
  299. package/dist/components/text/index.cjs +1 -0
  300. package/dist/components/text/index.d.ts +1 -3
  301. package/dist/components/text/index.d.ts.map +10 -1
  302. package/dist/components/text/index.js +4 -0
  303. package/dist/components/time-picker/TimePicker.d.ts +1 -61
  304. package/dist/components/time-picker/TimePicker.d.ts.map +10 -1
  305. package/dist/components/time-picker/browser.js +366 -0
  306. package/dist/components/time-picker/index.cjs +1 -0
  307. package/dist/components/time-picker/index.d.ts +1 -3
  308. package/dist/components/time-picker/index.d.ts.map +10 -1
  309. package/dist/components/time-picker/index.js +354 -0
  310. package/dist/components/toast/Toast.d.ts +1 -21
  311. package/dist/components/toast/Toast.d.ts.map +10 -1
  312. package/dist/components/toast/browser.js +147 -0
  313. package/dist/components/toast/index.cjs +3 -0
  314. package/dist/components/toast/index.d.ts +3 -3
  315. package/dist/components/toast/index.d.ts.map +10 -1
  316. package/dist/components/toast/index.js +135 -0
  317. package/dist/confirm-action.css +3 -0
  318. package/dist/date-picker.css +3 -0
  319. package/dist/dropzone.css +3 -0
  320. package/dist/form.css +3 -0
  321. package/dist/grid.css +3 -0
  322. package/dist/icon.css +3 -0
  323. package/dist/icons/ai.svg +5 -6
  324. package/dist/icons/bank.svg +1 -1
  325. package/dist/icons/barcode.svg +1 -1
  326. package/dist/icons/basket.svg +1 -1
  327. package/dist/icons/building.svg +1 -1
  328. package/dist/icons/buildings.svg +1 -1
  329. package/dist/icons/calendar.svg +1 -1
  330. package/dist/icons/cash.svg +3 -0
  331. package/dist/icons/check.svg +1 -1
  332. package/dist/icons/close.svg +1 -1
  333. package/dist/icons/coupon.svg +3 -0
  334. package/dist/icons/delivery-location.svg +3 -0
  335. package/dist/icons/desktop.svg +3 -0
  336. package/dist/icons/dollar-sign.svg +1 -1
  337. package/dist/icons/edit.svg +1 -1
  338. package/dist/icons/gift.svg +3 -0
  339. package/dist/icons/grip-lines.svg +2 -2
  340. package/dist/icons/heart.svg +3 -0
  341. package/dist/icons/installments.svg +3 -0
  342. package/dist/icons/inventory.svg +3 -0
  343. package/dist/icons/invoice.svg +3 -0
  344. package/dist/icons/loyalty-points.svg +3 -0
  345. package/dist/icons/membership.svg +3 -0
  346. package/dist/icons/mobile.svg +3 -0
  347. package/dist/icons/order-tracking.svg +7 -0
  348. package/dist/icons/out-of-stock.svg +3 -0
  349. package/dist/icons/package.svg +3 -0
  350. package/dist/icons/percent-discount.svg +3 -0
  351. package/dist/icons/pickup.svg +3 -0
  352. package/dist/icons/plus.svg +1 -1
  353. package/dist/icons/price-label.svg +3 -0
  354. package/dist/icons/product-review.svg +3 -0
  355. package/dist/icons/receipt.svg +3 -0
  356. package/dist/icons/refund.svg +3 -0
  357. package/dist/icons/remove.svg +1 -1
  358. package/dist/icons/return.svg +3 -0
  359. package/dist/icons/sale-burst.svg +3 -0
  360. package/dist/icons/secure-checkout.svg +3 -0
  361. package/dist/icons/shopping-bag.svg +3 -0
  362. package/dist/icons/shopping-cart.svg +3 -0
  363. package/dist/icons/storefront.svg +3 -0
  364. package/dist/icons/support.svg +3 -0
  365. package/dist/icons/tablet.svg +3 -0
  366. package/dist/icons/wallet.svg +3 -0
  367. package/dist/icons/warehouse.svg +3 -0
  368. package/dist/index.cjs +83 -79
  369. package/dist/index.css +253 -0
  370. package/dist/index.d.ts +94 -91
  371. package/dist/index.d.ts.map +10 -1
  372. package/dist/index.js +10695 -10239
  373. package/dist/input.css +3 -0
  374. package/dist/link.css +3 -0
  375. package/dist/mintui-elements.d.ts +156 -0
  376. package/dist/mintui-elements.d.ts.map +10 -0
  377. package/dist/modal.css +3 -0
  378. package/dist/navigation.css +3 -0
  379. package/dist/off-canvas.css +3 -0
  380. package/dist/page.css +3 -0
  381. package/dist/popover.css +3 -0
  382. package/dist/resource-table.css +3 -0
  383. package/dist/search.css +3 -0
  384. package/dist/select.css +3 -0
  385. package/dist/side-navigation.css +3 -0
  386. package/dist/sortable.css +3 -0
  387. package/dist/spinner.css +3 -0
  388. package/dist/stack.css +3 -0
  389. package/dist/switch.css +3 -0
  390. package/dist/table.css +3 -0
  391. package/dist/tabs.css +3 -0
  392. package/dist/tags.css +3 -0
  393. package/dist/text.css +3 -0
  394. package/dist/theme.css +101 -0
  395. package/dist/time-picker.css +3 -0
  396. package/dist/toast.css +3 -0
  397. package/package.json +379 -30
  398. package/dist/components/bottom-navigation/BottomNavItem.d.ts +0 -14
  399. package/dist/components/bottom-navigation/BottomNavItem.d.ts.map +0 -1
  400. package/dist/components/choice/ChoiceOption.d.ts +0 -30
  401. package/dist/components/choice/ChoiceOption.d.ts.map +0 -1
  402. package/dist/components/confirm-action/ConfirmActionApi.d.ts +0 -17
  403. package/dist/components/confirm-action/ConfirmActionApi.d.ts.map +0 -1
  404. package/dist/components/icon/build-icons.d.ts +0 -2
  405. package/dist/components/icon/build-icons.d.ts.map +0 -1
  406. package/dist/components/icon/icons/ai.d.ts +0 -3
  407. package/dist/components/icon/icons/ai.d.ts.map +0 -1
  408. package/dist/components/icon/icons/archive.d.ts +0 -3
  409. package/dist/components/icon/icons/archive.d.ts.map +0 -1
  410. package/dist/components/icon/icons/arrow-down.d.ts +0 -3
  411. package/dist/components/icon/icons/arrow-down.d.ts.map +0 -1
  412. package/dist/components/icon/icons/arrow-left.d.ts +0 -3
  413. package/dist/components/icon/icons/arrow-left.d.ts.map +0 -1
  414. package/dist/components/icon/icons/arrow-right.d.ts +0 -3
  415. package/dist/components/icon/icons/arrow-right.d.ts.map +0 -1
  416. package/dist/components/icon/icons/arrow-up.d.ts +0 -3
  417. package/dist/components/icon/icons/arrow-up.d.ts.map +0 -1
  418. package/dist/components/icon/icons/attach.d.ts +0 -3
  419. package/dist/components/icon/icons/attach.d.ts.map +0 -1
  420. package/dist/components/icon/icons/bank.d.ts +0 -3
  421. package/dist/components/icon/icons/bank.d.ts.map +0 -1
  422. package/dist/components/icon/icons/barcode.d.ts +0 -3
  423. package/dist/components/icon/icons/barcode.d.ts.map +0 -1
  424. package/dist/components/icon/icons/basket.d.ts +0 -3
  425. package/dist/components/icon/icons/basket.d.ts.map +0 -1
  426. package/dist/components/icon/icons/bookmark.d.ts +0 -3
  427. package/dist/components/icon/icons/bookmark.d.ts.map +0 -1
  428. package/dist/components/icon/icons/building.d.ts +0 -3
  429. package/dist/components/icon/icons/building.d.ts.map +0 -1
  430. package/dist/components/icon/icons/buildings.d.ts +0 -3
  431. package/dist/components/icon/icons/buildings.d.ts.map +0 -1
  432. package/dist/components/icon/icons/bullhorn.d.ts +0 -3
  433. package/dist/components/icon/icons/bullhorn.d.ts.map +0 -1
  434. package/dist/components/icon/icons/calendar-day.d.ts +0 -3
  435. package/dist/components/icon/icons/calendar-day.d.ts.map +0 -1
  436. package/dist/components/icon/icons/calendar-empty.d.ts +0 -3
  437. package/dist/components/icon/icons/calendar-empty.d.ts.map +0 -1
  438. package/dist/components/icon/icons/calendar-week.d.ts +0 -3
  439. package/dist/components/icon/icons/calendar-week.d.ts.map +0 -1
  440. package/dist/components/icon/icons/calendar.d.ts +0 -3
  441. package/dist/components/icon/icons/calendar.d.ts.map +0 -1
  442. package/dist/components/icon/icons/caret-down.d.ts +0 -3
  443. package/dist/components/icon/icons/caret-down.d.ts.map +0 -1
  444. package/dist/components/icon/icons/caret-left.d.ts +0 -3
  445. package/dist/components/icon/icons/caret-left.d.ts.map +0 -1
  446. package/dist/components/icon/icons/caret-right.d.ts +0 -3
  447. package/dist/components/icon/icons/caret-right.d.ts.map +0 -1
  448. package/dist/components/icon/icons/caret-up.d.ts +0 -3
  449. package/dist/components/icon/icons/caret-up.d.ts.map +0 -1
  450. package/dist/components/icon/icons/chart-bar.d.ts +0 -3
  451. package/dist/components/icon/icons/chart-bar.d.ts.map +0 -1
  452. package/dist/components/icon/icons/chart-line.d.ts +0 -3
  453. package/dist/components/icon/icons/chart-line.d.ts.map +0 -1
  454. package/dist/components/icon/icons/chat.d.ts +0 -3
  455. package/dist/components/icon/icons/chat.d.ts.map +0 -1
  456. package/dist/components/icon/icons/check.d.ts +0 -3
  457. package/dist/components/icon/icons/check.d.ts.map +0 -1
  458. package/dist/components/icon/icons/clock.d.ts +0 -3
  459. package/dist/components/icon/icons/clock.d.ts.map +0 -1
  460. package/dist/components/icon/icons/close.d.ts +0 -3
  461. package/dist/components/icon/icons/close.d.ts.map +0 -1
  462. package/dist/components/icon/icons/copy.d.ts +0 -3
  463. package/dist/components/icon/icons/copy.d.ts.map +0 -1
  464. package/dist/components/icon/icons/credit-card.d.ts +0 -3
  465. package/dist/components/icon/icons/credit-card.d.ts.map +0 -1
  466. package/dist/components/icon/icons/delete.d.ts +0 -3
  467. package/dist/components/icon/icons/delete.d.ts.map +0 -1
  468. package/dist/components/icon/icons/desktop-screen.d.ts +0 -3
  469. package/dist/components/icon/icons/desktop-screen.d.ts.map +0 -1
  470. package/dist/components/icon/icons/documentation.d.ts +0 -3
  471. package/dist/components/icon/icons/documentation.d.ts.map +0 -1
  472. package/dist/components/icon/icons/dollar-sign.d.ts +0 -3
  473. package/dist/components/icon/icons/dollar-sign.d.ts.map +0 -1
  474. package/dist/components/icon/icons/download.d.ts +0 -3
  475. package/dist/components/icon/icons/download.d.ts.map +0 -1
  476. package/dist/components/icon/icons/duplicate.d.ts +0 -3
  477. package/dist/components/icon/icons/duplicate.d.ts.map +0 -1
  478. package/dist/components/icon/icons/edit.d.ts +0 -3
  479. package/dist/components/icon/icons/edit.d.ts.map +0 -1
  480. package/dist/components/icon/icons/ellipsis.d.ts +0 -3
  481. package/dist/components/icon/icons/ellipsis.d.ts.map +0 -1
  482. package/dist/components/icon/icons/error.d.ts +0 -3
  483. package/dist/components/icon/icons/error.d.ts.map +0 -1
  484. package/dist/components/icon/icons/external-link.d.ts +0 -3
  485. package/dist/components/icon/icons/external-link.d.ts.map +0 -1
  486. package/dist/components/icon/icons/eye.d.ts +0 -3
  487. package/dist/components/icon/icons/eye.d.ts.map +0 -1
  488. package/dist/components/icon/icons/file.d.ts +0 -3
  489. package/dist/components/icon/icons/file.d.ts.map +0 -1
  490. package/dist/components/icon/icons/filter.d.ts +0 -3
  491. package/dist/components/icon/icons/filter.d.ts.map +0 -1
  492. package/dist/components/icon/icons/folder.d.ts +0 -3
  493. package/dist/components/icon/icons/folder.d.ts.map +0 -1
  494. package/dist/components/icon/icons/gavel.d.ts +0 -3
  495. package/dist/components/icon/icons/gavel.d.ts.map +0 -1
  496. package/dist/components/icon/icons/globe.d.ts +0 -3
  497. package/dist/components/icon/icons/globe.d.ts.map +0 -1
  498. package/dist/components/icon/icons/grid.d.ts +0 -3
  499. package/dist/components/icon/icons/grid.d.ts.map +0 -1
  500. package/dist/components/icon/icons/grip-lines.d.ts +0 -3
  501. package/dist/components/icon/icons/grip-lines.d.ts.map +0 -1
  502. package/dist/components/icon/icons/help.d.ts +0 -3
  503. package/dist/components/icon/icons/help.d.ts.map +0 -1
  504. package/dist/components/icon/icons/home.d.ts +0 -3
  505. package/dist/components/icon/icons/home.d.ts.map +0 -1
  506. package/dist/components/icon/icons/image.d.ts +0 -3
  507. package/dist/components/icon/icons/image.d.ts.map +0 -1
  508. package/dist/components/icon/icons/index.cjs +0 -34
  509. package/dist/components/icon/icons/index.d.ts +0 -92
  510. package/dist/components/icon/icons/index.d.ts.map +0 -1
  511. package/dist/components/icon/icons/index.js +0 -752
  512. package/dist/components/icon/icons/info.d.ts +0 -3
  513. package/dist/components/icon/icons/info.d.ts.map +0 -1
  514. package/dist/components/icon/icons/language.d.ts +0 -3
  515. package/dist/components/icon/icons/language.d.ts.map +0 -1
  516. package/dist/components/icon/icons/line-chart.d.ts +0 -3
  517. package/dist/components/icon/icons/line-chart.d.ts.map +0 -1
  518. package/dist/components/icon/icons/link.d.ts +0 -3
  519. package/dist/components/icon/icons/link.d.ts.map +0 -1
  520. package/dist/components/icon/icons/list.d.ts +0 -3
  521. package/dist/components/icon/icons/list.d.ts.map +0 -1
  522. package/dist/components/icon/icons/location.d.ts +0 -3
  523. package/dist/components/icon/icons/location.d.ts.map +0 -1
  524. package/dist/components/icon/icons/lock.d.ts +0 -3
  525. package/dist/components/icon/icons/lock.d.ts.map +0 -1
  526. package/dist/components/icon/icons/login.d.ts +0 -3
  527. package/dist/components/icon/icons/login.d.ts.map +0 -1
  528. package/dist/components/icon/icons/logout.d.ts +0 -3
  529. package/dist/components/icon/icons/logout.d.ts.map +0 -1
  530. package/dist/components/icon/icons/mail.d.ts +0 -3
  531. package/dist/components/icon/icons/mail.d.ts.map +0 -1
  532. package/dist/components/icon/icons/map.d.ts +0 -3
  533. package/dist/components/icon/icons/map.d.ts.map +0 -1
  534. package/dist/components/icon/icons/menu.d.ts +0 -3
  535. package/dist/components/icon/icons/menu.d.ts.map +0 -1
  536. package/dist/components/icon/icons/moon.d.ts +0 -3
  537. package/dist/components/icon/icons/moon.d.ts.map +0 -1
  538. package/dist/components/icon/icons/notifications.d.ts +0 -3
  539. package/dist/components/icon/icons/notifications.d.ts.map +0 -1
  540. package/dist/components/icon/icons/paste.d.ts +0 -3
  541. package/dist/components/icon/icons/paste.d.ts.map +0 -1
  542. package/dist/components/icon/icons/pin.d.ts +0 -3
  543. package/dist/components/icon/icons/pin.d.ts.map +0 -1
  544. package/dist/components/icon/icons/plus.d.ts +0 -3
  545. package/dist/components/icon/icons/plus.d.ts.map +0 -1
  546. package/dist/components/icon/icons/print.d.ts +0 -3
  547. package/dist/components/icon/icons/print.d.ts.map +0 -1
  548. package/dist/components/icon/icons/refresh.d.ts +0 -3
  549. package/dist/components/icon/icons/refresh.d.ts.map +0 -1
  550. package/dist/components/icon/icons/remove.d.ts +0 -3
  551. package/dist/components/icon/icons/remove.d.ts.map +0 -1
  552. package/dist/components/icon/icons/save.d.ts +0 -3
  553. package/dist/components/icon/icons/save.d.ts.map +0 -1
  554. package/dist/components/icon/icons/search.d.ts +0 -3
  555. package/dist/components/icon/icons/search.d.ts.map +0 -1
  556. package/dist/components/icon/icons/settings.d.ts +0 -3
  557. package/dist/components/icon/icons/settings.d.ts.map +0 -1
  558. package/dist/components/icon/icons/share.d.ts +0 -3
  559. package/dist/components/icon/icons/share.d.ts.map +0 -1
  560. package/dist/components/icon/icons/sort-arrows.d.ts +0 -3
  561. package/dist/components/icon/icons/sort-arrows.d.ts.map +0 -1
  562. package/dist/components/icon/icons/sort.d.ts +0 -3
  563. package/dist/components/icon/icons/sort.d.ts.map +0 -1
  564. package/dist/components/icon/icons/star.d.ts +0 -3
  565. package/dist/components/icon/icons/star.d.ts.map +0 -1
  566. package/dist/components/icon/icons/success.d.ts +0 -3
  567. package/dist/components/icon/icons/success.d.ts.map +0 -1
  568. package/dist/components/icon/icons/sun.d.ts +0 -3
  569. package/dist/components/icon/icons/sun.d.ts.map +0 -1
  570. package/dist/components/icon/icons/table.d.ts +0 -3
  571. package/dist/components/icon/icons/table.d.ts.map +0 -1
  572. package/dist/components/icon/icons/tag.d.ts +0 -3
  573. package/dist/components/icon/icons/tag.d.ts.map +0 -1
  574. package/dist/components/icon/icons/trash.d.ts +0 -3
  575. package/dist/components/icon/icons/trash.d.ts.map +0 -1
  576. package/dist/components/icon/icons/truck.d.ts +0 -3
  577. package/dist/components/icon/icons/truck.d.ts.map +0 -1
  578. package/dist/components/icon/icons/unlock.d.ts +0 -3
  579. package/dist/components/icon/icons/unlock.d.ts.map +0 -1
  580. package/dist/components/icon/icons/upload.d.ts +0 -3
  581. package/dist/components/icon/icons/upload.d.ts.map +0 -1
  582. package/dist/components/icon/icons/user-add.d.ts +0 -3
  583. package/dist/components/icon/icons/user-add.d.ts.map +0 -1
  584. package/dist/components/icon/icons/user.d.ts +0 -3
  585. package/dist/components/icon/icons/user.d.ts.map +0 -1
  586. package/dist/components/icon/icons/users.d.ts +0 -3
  587. package/dist/components/icon/icons/users.d.ts.map +0 -1
  588. package/dist/components/icon/icons/video.d.ts +0 -3
  589. package/dist/components/icon/icons/video.d.ts.map +0 -1
  590. package/dist/components/icon/icons/warning.d.ts +0 -3
  591. package/dist/components/icon/icons/warning.d.ts.map +0 -1
  592. package/dist/components/icon/registry.d.ts +0 -15
  593. package/dist/components/icon/registry.d.ts.map +0 -1
  594. package/dist/components/resource-table/ResourceTableContextMenu.d.ts +0 -40
  595. package/dist/components/resource-table/ResourceTableContextMenu.d.ts.map +0 -1
  596. package/dist/components/side-navigation/SideNavigationActionHeader.d.ts +0 -2
  597. package/dist/components/side-navigation/SideNavigationActionHeader.d.ts.map +0 -1
  598. package/dist/components/side-navigation/SideNavigationActionLinks.d.ts +0 -9
  599. package/dist/components/side-navigation/SideNavigationActionLinks.d.ts.map +0 -1
  600. package/dist/components/side-navigation/SideNavigationActionMenu.d.ts +0 -26
  601. package/dist/components/side-navigation/SideNavigationActionMenu.d.ts.map +0 -1
  602. package/dist/components/side-navigation/SideNavigationLink.d.ts +0 -38
  603. package/dist/components/side-navigation/SideNavigationLink.d.ts.map +0 -1
  604. package/dist/components/side-navigation/SideNavigationLinks.d.ts +0 -38
  605. package/dist/components/side-navigation/SideNavigationLinks.d.ts.map +0 -1
  606. package/dist/components/tabs/Tab.d.ts +0 -19
  607. package/dist/components/tabs/Tab.d.ts.map +0 -1
  608. package/dist/components/tabs/TabContent.d.ts +0 -13
  609. package/dist/components/tabs/TabContent.d.ts.map +0 -1
  610. package/dist/components/tabs/TabList.d.ts +0 -12
  611. package/dist/components/tabs/TabList.d.ts.map +0 -1
  612. package/dist/components/toast/ToastApi.d.ts +0 -21
  613. package/dist/components/toast/ToastApi.d.ts.map +0 -1
  614. package/dist/components/top-navigation/TopNavigation.d.ts +0 -65
  615. package/dist/components/top-navigation/TopNavigation.d.ts.map +0 -1
  616. package/dist/components/top-navigation/index.d.ts +0 -4
  617. package/dist/components/top-navigation/index.d.ts.map +0 -1
  618. package/dist/icons/truck.svg +0 -13
  619. package/dist/search-CM-OgatF.js +0 -179
  620. package/dist/search-C_vLUsm7.cjs +0 -1
  621. package/dist/styles.css +0 -3
  622. package/tailwind.preset.cjs +0 -75
  623. package/tailwind.preset.js +0 -97
@@ -0,0 +1,1331 @@
1
+
2
+ const __mintLoadStyle = (key, url) => {
3
+ if (typeof document === 'undefined') return
4
+ const href = new URL(url, import.meta.url).href
5
+ if ([...document.querySelectorAll('link[rel="stylesheet"]')].some(link => link.href === href)) return
6
+ if (document.querySelector('style[data-mint-ui-style="' + key + '"]') || document.querySelector('link[data-mint-ui-style="' + key + '"]')) return
7
+ const link = document.createElement('link')
8
+ link.rel = 'stylesheet'
9
+ link.href = href
10
+ link.dataset.mintUiStyle = key
11
+ document.head.append(link)
12
+ }
13
+ __mintLoadStyle('theme', '../../theme.css')
14
+ __mintLoadStyle('chart', '../../chart.css')
15
+ import { t as e } from "../chunks/register-element-BFYmIynH.js";
16
+ //#region src/components/chart/Chart.ts
17
+ var t = class e extends HTMLElement {
18
+ static get observedAttributes() {
19
+ return [
20
+ "type",
21
+ "data",
22
+ "width",
23
+ "height",
24
+ "show-legend",
25
+ "show-grid",
26
+ "show-tooltip",
27
+ "curve-tension"
28
+ ];
29
+ }
30
+ static {
31
+ this.MAX_CACHE_SIZE = 100;
32
+ }
33
+ constructor() {
34
+ super(), this._chartContainer = null, this._svg = null, this._tooltip = null, this._chartType = "line", this._chartData = null, this._width = 800, this._height = 400, this._padding = {
35
+ top: 20,
36
+ right: 20,
37
+ bottom: 60,
38
+ left: 60
39
+ }, this._showLegend = !0, this._showGrid = !0, this._showTooltip = !0, this._curveTension = .5, this._dataObserver = null, this._darkModeObserver = null, this._tooltipHideTimeout = null, this._lastTooltipContent = "", this._activeXValue = null, this._pinnedXValue = null, this._tooltipAnimationFrame = null, this._cachedTooltipContent = /* @__PURE__ */ new Map(), this._cachedXPositions = /* @__PURE__ */ new Map(), this._verticalLine = null, this._plotPoints = /* @__PURE__ */ new Map(), this._resizeObserver = null, this._windowResizeHandler = null, this._pieChartTimeouts = /* @__PURE__ */ new Set(), this._pieChartTooltipShown = !1, this._pieChartClickOutsideHandler = null, this._pieChartGroup = null, this._chartClickOutsideHandler = null, this._chartTooltipScrollHandler = null, this._cachedBounds = {
40
+ bounds: null,
41
+ dataHash: ""
42
+ }, this._cachedYRange = {
43
+ range: null,
44
+ dataHash: ""
45
+ }, this._cachedXValues = {
46
+ values: null,
47
+ dataHash: ""
48
+ }, this._renderScheduled = !1, this._animateNextRender = !1, this._observedDataReference = null, this._observedDataFingerprint = "", this._datasetVisibility = /* @__PURE__ */ new Map(), this._widthValue = "100%", this._heightValue = 400, this._defaultColors = [
49
+ "#2563eb",
50
+ "#3b82f6",
51
+ "#0d9488",
52
+ "#7c3aed",
53
+ "#d97706",
54
+ "#059669",
55
+ "#dc2626",
56
+ "#c026d3"
57
+ ], this._legendHeight = 0, this._rotatedLabelHeight = 0;
58
+ }
59
+ connectedCallback() {
60
+ this.classList.add("box-border", "m-0", "p-0", "border-0", "align-baseline", "block", "w-full"), this._setupDataObserver(), this._setupDarkModeObserver(), this._setupResizeObserver(), requestAnimationFrame(() => {
61
+ requestAnimationFrame(() => {
62
+ this.render();
63
+ });
64
+ });
65
+ }
66
+ _setupDataObserver() {
67
+ let e = () => {
68
+ if (!this.isConnected) return;
69
+ let e = this.data, t = null;
70
+ e && typeof e == "object" && !Array.isArray(e) && "datasets" in e && (t = e);
71
+ let n = "";
72
+ if (t) try {
73
+ n = JSON.stringify(t);
74
+ } catch {
75
+ n = "";
76
+ }
77
+ t && (t !== this._observedDataReference || n && n !== this._observedDataFingerprint) && (this._observedDataReference = t, this._observedDataFingerprint = n, this._chartData = t, this._animateNextRender = !0, this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this.render());
78
+ };
79
+ requestAnimationFrame(() => {
80
+ e(), requestAnimationFrame(() => {
81
+ e();
82
+ });
83
+ });
84
+ let t = setInterval(() => {
85
+ if (!this.isConnected) {
86
+ clearInterval(t);
87
+ return;
88
+ }
89
+ e();
90
+ }, 250);
91
+ this._dataCheckInterval = t;
92
+ }
93
+ _setupDarkModeObserver() {
94
+ this._darkModeObserver = new MutationObserver(() => {
95
+ this.isConnected && this.render();
96
+ }), this._darkModeObserver.observe(document.documentElement, {
97
+ attributes: !0,
98
+ attributeFilter: ["class"]
99
+ });
100
+ }
101
+ disconnectedCallback() {
102
+ if (this._tooltip && this._tooltip.parentNode && (this._tooltip.parentNode.removeChild(this._tooltip), this._tooltip = null), this._tooltipHideTimeout !== null && (clearTimeout(this._tooltipHideTimeout), this._tooltipHideTimeout = null), this._pieChartTimeouts.forEach((e) => clearTimeout(e)), this._pieChartTimeouts.clear(), this._pieChartClickOutsideHandler &&= (document.removeEventListener("click", this._pieChartClickOutsideHandler, !0), null), this._chartClickOutsideHandler &&= (document.removeEventListener("click", this._chartClickOutsideHandler, !0), null), this._pieChartTooltipShown = !1, this._pieChartGroup = null, this._pinnedXValue = null, this._tooltipAnimationFrame !== null && (cancelAnimationFrame(this._tooltipAnimationFrame), this._tooltipAnimationFrame = null), this._dataObserver &&= (this._dataObserver.disconnect(), null), this._darkModeObserver &&= (this._darkModeObserver.disconnect(), null), this._dataCheckInterval &&= (clearInterval(this._dataCheckInterval), null), this._svg && (this._chartTooltipMouseMove &&= (this._svg.removeEventListener("mousemove", this._chartTooltipMouseMove), null), this._chartTooltipMouseLeave &&= (this._svg.removeEventListener("mouseleave", this._chartTooltipMouseLeave), null), this._chartTooltipTouchStart &&= (this._svg.removeEventListener("touchstart", this._chartTooltipTouchStart), null), this._chartTooltipTouchMove &&= (this._svg.removeEventListener("touchmove", this._chartTooltipTouchMove), null), this._chartTooltipTouchEnd &&= (this._svg.removeEventListener("touchend", this._chartTooltipTouchEnd), null)), this._chartTooltipScrollHandler) {
103
+ window.removeEventListener("scroll", this._chartTooltipScrollHandler, !0), this._chartContainer && this._chartContainer.removeEventListener("scroll", this._chartTooltipScrollHandler, !0);
104
+ let e = this.parentElement;
105
+ for (; e;) e.removeEventListener("scroll", this._chartTooltipScrollHandler, !0), e = e.parentElement;
106
+ this._chartTooltipScrollHandler = null;
107
+ }
108
+ this._resizeObserver &&= (this._resizeObserver.disconnect(), null), this._windowResizeHandler &&= (window.removeEventListener("resize", this._windowResizeHandler), null), this._cachedTooltipContent.clear(), this._cachedXPositions.clear(), this._plotPoints.clear(), this._cachedBounds = {
109
+ bounds: null,
110
+ dataHash: ""
111
+ }, this._cachedYRange = {
112
+ range: null,
113
+ dataHash: ""
114
+ }, this._cachedXValues = {
115
+ values: null,
116
+ dataHash: ""
117
+ };
118
+ }
119
+ _handleResize() {
120
+ if (!this.isConnected) return;
121
+ let e = this.getBoundingClientRect(), t = e.width || this.parentElement?.clientWidth || 800, n = e.height || this.parentElement?.clientHeight || 400, r = this._calculateDimension(this._widthValue, t, t), i = this._calculateDimension(this._heightValue, n, 400);
122
+ (r !== this._width || i !== this._height) && (this._width = r, this._height = i, this.render());
123
+ }
124
+ _setupResizeObserver() {
125
+ this._resizeObserver &&= (this._resizeObserver.disconnect(), null), this._windowResizeHandler &&= (window.removeEventListener("resize", this._windowResizeHandler), null);
126
+ let e = null, t = () => {
127
+ e && clearTimeout(e), e = window.setTimeout(() => {
128
+ this._handleResize();
129
+ }, 100);
130
+ };
131
+ this._windowResizeHandler = t, this._resizeObserver = new ResizeObserver(() => {
132
+ t();
133
+ }), this._resizeObserver.observe(this), window.addEventListener("resize", t);
134
+ }
135
+ attributeChangedCallback(e, t, n) {
136
+ if (t !== n) {
137
+ if (e === "data") {
138
+ if (n) try {
139
+ this._chartData = JSON.parse(n);
140
+ } catch (e) {
141
+ console.error("mint-chart: Invalid data JSON", e), this._chartData = null;
142
+ }
143
+ else this._chartData = null;
144
+ this._invalidateDataCaches(), this._animateNextRender = !0;
145
+ }
146
+ (e === "width" || e === "height") && this.isConnected && (t && t.endsWith("%")) !== (n && n.endsWith("%")) && this._setupResizeObserver(), this.isConnected && requestAnimationFrame(() => {
147
+ this.render();
148
+ });
149
+ }
150
+ }
151
+ get type() {
152
+ let e = this.getAttribute("type") || "line";
153
+ return e === "line" || e === "bar" || e === "area" || e === "pie" ? e : "line";
154
+ }
155
+ set type(e) {
156
+ this.setAttribute("type", e);
157
+ }
158
+ get data() {
159
+ return this._chartData;
160
+ }
161
+ set data(e) {
162
+ if (typeof e == "string") try {
163
+ this._chartData = JSON.parse(e);
164
+ } catch (e) {
165
+ console.error("mint-chart: Invalid data JSON", e), this._chartData = null;
166
+ }
167
+ else this._chartData = e;
168
+ this._invalidateDataCaches(), this._animateNextRender = !0, this.isConnected && requestAnimationFrame(() => {
169
+ this.render();
170
+ });
171
+ }
172
+ get width() {
173
+ let e = this.getAttribute("width");
174
+ if (!e) return this._widthValue;
175
+ if (e.endsWith("%")) return e;
176
+ let t = parseInt(e, 10);
177
+ return isNaN(t) ? this._widthValue : t;
178
+ }
179
+ set width(e) {
180
+ this.setAttribute("width", e.toString());
181
+ }
182
+ get height() {
183
+ let e = this.getAttribute("height");
184
+ if (!e) return this._heightValue;
185
+ if (e.endsWith("%")) return e;
186
+ let t = parseInt(e, 10);
187
+ return isNaN(t) ? this._heightValue : t;
188
+ }
189
+ set height(e) {
190
+ this.setAttribute("height", e.toString());
191
+ }
192
+ _calculateDimension(e, t, n) {
193
+ if (typeof e == "number") return e;
194
+ if (typeof e == "string" && e.endsWith("%")) {
195
+ let n = parseFloat(e);
196
+ if (!isNaN(n)) return t * n / 100;
197
+ }
198
+ return n;
199
+ }
200
+ _scheduleRender() {
201
+ this._animateNextRender = !0, this._syncObservedData(), !this._renderScheduled && (this._renderScheduled = !0, requestAnimationFrame(() => {
202
+ this._renderScheduled = !1, this.render();
203
+ }));
204
+ }
205
+ _invalidateDataCaches() {
206
+ this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent?.clear();
207
+ }
208
+ _syncObservedData() {
209
+ this._observedDataReference = this._chartData;
210
+ try {
211
+ this._observedDataFingerprint = this._chartData ? JSON.stringify(this._chartData) : "";
212
+ } catch {
213
+ this._observedDataFingerprint = "";
214
+ }
215
+ }
216
+ _isDatasetVisible(e, t) {
217
+ if (e.id) {
218
+ let t = this._datasetVisibility.get(e.id);
219
+ if (t !== void 0) return t;
220
+ }
221
+ return e.visible !== !1;
222
+ }
223
+ _initializeDatasetVisibility() {
224
+ this._chartData && this._chartData.datasets.forEach((e, t) => {
225
+ e.id && (this._datasetVisibility.has(e.id) || this._datasetVisibility.set(e.id, e.visible !== !1));
226
+ });
227
+ }
228
+ render() {
229
+ if (!this.isConnected) return;
230
+ let e = this._animateNextRender && !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches && this._svg ? this._svg.cloneNode(!0) : null;
231
+ this._animateNextRender = !1, this._plotPoints.clear(), this._activeXValue = null, this._cachedTooltipContent?.clear(), this._cachedXPositions?.clear(), this._chartType = this.type;
232
+ let t = this.data;
233
+ if (t && typeof t == "object" && !Array.isArray(t) && "datasets" in t && (this._chartData = t), !this._chartData) {
234
+ let e = this.getAttribute("data");
235
+ if (e) try {
236
+ this._chartData = JSON.parse(e);
237
+ } catch (e) {
238
+ console.error("mint-chart: Invalid data JSON", e), this._chartData = null;
239
+ }
240
+ }
241
+ this._widthValue = this.width, this._heightValue = this.height;
242
+ let n = this.getBoundingClientRect(), r = n.width || this.parentElement?.clientWidth || 800, i = n.height || this.parentElement?.clientHeight || 400;
243
+ this._width = this._calculateDimension(this._widthValue, r, r), this._height = this._calculateDimension(this._heightValue, i, 400), this._showLegend = this.getAttribute("show-legend") !== "false", this._showGrid = this.getAttribute("show-grid") !== "false", this._showTooltip = this.getAttribute("show-tooltip") !== "false";
244
+ let a = this.getAttribute("curve-tension");
245
+ if (a !== null) {
246
+ let e = parseFloat(a);
247
+ this._curveTension = isNaN(e) ? .5 : Math.max(0, Math.min(1, e));
248
+ } else this._curveTension = .5;
249
+ if (!this._chartData || !this._chartData.datasets || this._chartData.datasets.length === 0) {
250
+ this.innerHTML = "<div class=\"p-4 text-gray-500\">No chart data provided</div>";
251
+ return;
252
+ }
253
+ this.innerHTML = "", this._chartContainer = document.createElement("div"), this._chartContainer.className = "relative w-full", this._chartContainer.style.position = "relative", typeof this._widthValue == "string" && this._widthValue.endsWith("%") ? this._chartContainer.style.width = this._widthValue : this._chartContainer.style.width = `${this._width}px`, typeof this._heightValue == "string" && this._heightValue.endsWith("%") ? this._chartContainer.style.height = this._heightValue : this._chartContainer.style.height = `${this._height}px`, this.appendChild(this._chartContainer), this._svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._svg.setAttribute("width", this._width.toString()), this._svg.setAttribute("height", this._height.toString()), this._svg.setAttribute("viewBox", `0 0 ${this._width} ${this._height}`), this._svg.setAttribute("class", "w-full h-full"), this._svg.setAttribute("role", "img");
254
+ let o = this._chartData.datasets.map((e) => e.name).filter(Boolean), s = this.getAttribute("aria-label")?.trim() || `${this.type} chart${o.length ? ` showing ${o.join(", ")}` : ""}. ${Math.max(0, ...this._chartData.datasets.map((e) => e.data.length))} data points.`, c = `${this.id || `mint-chart-${Math.random().toString(36).slice(2, 10)}`}-data`;
255
+ this._svg.setAttribute("aria-label", s), this._svg.setAttribute("aria-describedby", c), this._chartContainer && this._svg && (e && (e.style.position = "absolute", e.style.inset = "0", e.style.width = "100%", e.style.height = "100%", e.style.pointerEvents = "none", e.style.zIndex = "1", e.style.opacity = "1", e.style.transition = "opacity 260ms ease", this._chartContainer.appendChild(e), this._svg.style.position = "relative", this._svg.style.zIndex = "0", this._svg.style.opacity = "0", this._svg.style.transition = "opacity 260ms ease"), this._chartContainer.appendChild(this._svg));
256
+ let l = document.createElement("table");
257
+ l.id = c, Object.assign(l.style, {
258
+ position: "absolute",
259
+ width: "1px",
260
+ height: "1px",
261
+ padding: "0",
262
+ margin: "-1px",
263
+ overflow: "hidden",
264
+ clip: "rect(0, 0, 0, 0)",
265
+ whiteSpace: "nowrap",
266
+ border: "0"
267
+ });
268
+ let u = document.createElement("caption");
269
+ u.textContent = `Data for ${s}`, l.appendChild(u);
270
+ let d = document.createElement("thead"), f = document.createElement("tr"), p = document.createElement("th");
271
+ p.scope = "col", p.textContent = "Category", f.appendChild(p), this._chartData.datasets.forEach((e) => {
272
+ let t = document.createElement("th");
273
+ t.scope = "col", t.textContent = e.name || "Series", f.appendChild(t);
274
+ }), d.appendChild(f), l.appendChild(d);
275
+ let m = document.createElement("tbody"), h = Math.max(0, ...this._chartData.datasets.map((e) => e.data.length));
276
+ for (let e = 0; e < h; e += 1) {
277
+ let t = document.createElement("tr"), n = document.createElement("th");
278
+ n.scope = "row", n.textContent = String(this._chartData.datasets.find((t) => t.data[e])?.data[e]?.x ?? e + 1), t.appendChild(n), this._chartData.datasets.forEach((n) => {
279
+ let r = document.createElement("td"), i = n.data[e];
280
+ r.textContent = i ? this._formatValue(i.y, n) : "", t.appendChild(r);
281
+ }), m.appendChild(t);
282
+ }
283
+ switch (l.appendChild(m), this.appendChild(l), this._showTooltip && this._createTooltip(), this._initializeDatasetVisibility(), this._calculateRotatedLabelHeight(), this._showLegend ? this._legendHeight = this._calculateLegendHeight() : this._legendHeight = 0, this._showLegend && this._renderLegend(), this._chartType !== "pie" && this._pieChartClickOutsideHandler && (document.removeEventListener("click", this._pieChartClickOutsideHandler, !0), this._pieChartClickOutsideHandler = null, this._pieChartTooltipShown = !1, this._pieChartGroup = null), this._pinnedXValue = null, this._chartType) {
284
+ case "line":
285
+ this._renderLineChart();
286
+ break;
287
+ case "bar":
288
+ this._renderBarChart();
289
+ break;
290
+ case "area":
291
+ this._renderAreaChart();
292
+ break;
293
+ case "pie":
294
+ this._renderPieChart();
295
+ break;
296
+ }
297
+ if (this._showTooltip && this._chartType !== "pie" && (this._setupChartTooltip(), this._setupTooltipScrollHandler()), this._createVerticalLine(), e && this._svg) {
298
+ let t = this._svg;
299
+ requestAnimationFrame(() => requestAnimationFrame(() => {
300
+ t.isConnected && (e.style.opacity = "0", t.style.opacity = "1", window.setTimeout(() => e.remove(), 280));
301
+ }));
302
+ }
303
+ }
304
+ _createTooltip() {
305
+ this._tooltip && this._tooltip.parentNode && this._tooltip.parentNode.removeChild(this._tooltip), this._tooltip = document.createElement("div"), this._tooltip.className = "fixed pointer-events-none z-50 bg-gray-900 dark:bg-mint-elevated text-white text-xs rounded px-2 py-1 shadow-lg opacity-0", this._tooltip.style.display = "none", document.body.appendChild(this._tooltip);
306
+ }
307
+ _showTooltipAt(e, t, n) {
308
+ if (!this._tooltip) return;
309
+ this._tooltipHideTimeout !== null && (clearTimeout(this._tooltipHideTimeout), this._tooltipHideTimeout = null), this._lastTooltipContent !== n && (this._tooltip.innerHTML = n, this._lastTooltipContent = n), (this._tooltip.style.display === "none" || this._tooltip.style.opacity === "0") && (this._tooltip.style.display = "block", this._tooltip.style.opacity = "1", this._tooltip.style.padding = "8px 12px");
310
+ let r = this._tooltip.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight, o = e + 10, s = t - r.height - 8;
311
+ o + r.width > i && (o = e - r.width - 10), o < 0 && (o = 10), s < 0 && (s = t + 20), s + r.height > a && (s = t - r.height - 8, s < 0 && (s = 10));
312
+ let c = `${o}px`, l = `${s}px`;
313
+ this._tooltip.style.left !== c && (this._tooltip.style.left = c), this._tooltip.style.top !== l && (this._tooltip.style.top = l);
314
+ }
315
+ _hideTooltip() {
316
+ this._tooltip && (this._tooltipHideTimeout !== null && (clearTimeout(this._tooltipHideTimeout), this._tooltipHideTimeout = null), this._tooltip.style.opacity = "0", this._tooltipHideTimeout = window.setTimeout(() => {
317
+ this._tooltip && (this._tooltip.style.display = "none"), this._tooltipHideTimeout = null;
318
+ }, 200));
319
+ }
320
+ _createVerticalLine() {
321
+ if (!this._svg) return;
322
+ this._verticalLine && this._verticalLine.parentNode && this._verticalLine.parentNode.removeChild(this._verticalLine), this._verticalLine = document.createElementNS("http://www.w3.org/2000/svg", "line");
323
+ let e = document.documentElement.classList.contains("dark");
324
+ this._verticalLine.setAttribute("stroke", e ? "#9ca3af" : "#6b7280"), this._verticalLine.setAttribute("stroke-width", "1"), this._verticalLine.setAttribute("stroke-dasharray", "4,2"), this._verticalLine.style.opacity = "0", this._verticalLine.style.pointerEvents = "none";
325
+ let t = this._svg.querySelector(".chart-legend");
326
+ t && t.parentNode ? t.parentNode.insertBefore(this._verticalLine, t) : this._svg.appendChild(this._verticalLine);
327
+ }
328
+ _showVerticalLineAtX(e, t) {
329
+ if (!this._verticalLine) return;
330
+ let n = this._chartType === "bar" ? this._scaleXForBarChart(e, t) : this._scaleX(e, t);
331
+ this._verticalLine.setAttribute("x1", n.toString()), this._verticalLine.setAttribute("y1", t.y.toString()), this._verticalLine.setAttribute("x2", n.toString()), this._verticalLine.setAttribute("y2", (t.y + t.height).toString()), this._verticalLine.style.opacity = "1";
332
+ }
333
+ _hideVerticalLine() {
334
+ this._verticalLine && (this._verticalLine.style.opacity = "0");
335
+ }
336
+ _showPlotPointsForX(e) {
337
+ this._plotPoints.forEach((e) => {
338
+ e.forEach((e) => {
339
+ e.style.opacity = "0";
340
+ });
341
+ });
342
+ let t = String(e), n = this._plotPoints.get(t);
343
+ n && n.forEach((e) => {
344
+ e.style.opacity = "1";
345
+ });
346
+ }
347
+ _hidePlotPoints() {
348
+ this._plotPoints.forEach((e) => {
349
+ e.forEach((e) => {
350
+ e.style.opacity = "0";
351
+ });
352
+ });
353
+ }
354
+ _calculateMaxYAxisLabelWidth() {
355
+ if (!this._showGrid || !this._chartData) return 0;
356
+ let e = document.createElement("canvas").getContext("2d");
357
+ if (!e) return 60;
358
+ e.font = "12px system-ui, -apple-system, sans-serif";
359
+ let t = this._showLegend ? Math.max(this._legendHeight, 60) : 0, n = this._height - t, r = Math.floor(n / 35), i = Math.min(5, r), a = 0;
360
+ for (let t = 0; t <= i; t++) {
361
+ let n = this._getYRange(), r = n.max - (n.max - n.min) / i * t, o = this._formatYAxisValue(r), s = e.measureText(o);
362
+ a = Math.max(a, s.width);
363
+ }
364
+ return Math.ceil(a) + 20;
365
+ }
366
+ _getChartBounds() {
367
+ let e = this._calculateMaxYAxisLabelWidth(), t = `${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;
368
+ if (this._cachedBounds.bounds && this._cachedBounds.dataHash === t) return this._cachedBounds.bounds;
369
+ let n = 0, r = 0;
370
+ this._showGrid && (n = e + 10);
371
+ let i = (this._rotatedLabelHeight > 0 ? 30 : 20) + this._rotatedLabelHeight + 12, a = i;
372
+ this._showLegend && (a = i + 20 + Math.max(this._legendHeight, 60));
373
+ let o = this._height - 0 - n - 0, s = o - a, c = 1;
374
+ if (s < 100 && a > 0) {
375
+ let e = o - 100;
376
+ e > 0 ? (c = Math.min(1, e / a), c = Math.max(.5, c)) : c = .5;
377
+ }
378
+ r = a * c;
379
+ let l = this._width * .3, u = n, d = 1;
380
+ n > l && (d = l / n, u = l);
381
+ let f = {
382
+ width: (this._width - u - 0) * d,
383
+ height: this._height - 0 - r,
384
+ x: u,
385
+ y: 0
386
+ };
387
+ return this._cachedBounds = {
388
+ bounds: f,
389
+ dataHash: t
390
+ }, f;
391
+ }
392
+ _getAllDataPoints() {
393
+ if (!this._chartData) return [];
394
+ let e = [];
395
+ return this._chartData.datasets.forEach((t, n) => {
396
+ this._isDatasetVisible(t, n) && e.push(...t.data);
397
+ }), e;
398
+ }
399
+ _getXValues() {
400
+ if (!this._chartData) return [];
401
+ let e = JSON.stringify(this._chartData.labels) + JSON.stringify(this._chartData.datasets.map((e) => e.data.map((e) => e.x)));
402
+ if (this._cachedXValues.values && this._cachedXValues.dataHash === e) return this._cachedXValues.values;
403
+ if (this._chartData.labels && this._chartData.labels.length > 0) return this._cachedXValues = {
404
+ values: this._chartData.labels,
405
+ dataHash: e
406
+ }, this._chartData.labels;
407
+ let t = /* @__PURE__ */ new Set();
408
+ this._chartData.datasets.forEach((e, n) => {
409
+ this._isDatasetVisible(e, n) && e.data.forEach((e) => {
410
+ t.add(e.x);
411
+ });
412
+ });
413
+ let n = Array.from(t).sort((e, t) => {
414
+ if (typeof e == "number" && typeof t == "number") return e - t;
415
+ let n = String(e), r = String(t), i = /^([A-Za-z]{3})\s+(\d{4})$/, a = n.match(i), o = r.match(i);
416
+ if (a && o) {
417
+ let e = [
418
+ "Jan",
419
+ "Feb",
420
+ "Mar",
421
+ "Apr",
422
+ "May",
423
+ "Jun",
424
+ "Jul",
425
+ "Aug",
426
+ "Sep",
427
+ "Oct",
428
+ "Nov",
429
+ "Dec"
430
+ ], t = e.indexOf(a[1]), n = e.indexOf(o[1]), r = parseInt(a[2]), i = parseInt(o[2]);
431
+ return r === i ? t - n : r - i;
432
+ }
433
+ return n.localeCompare(r);
434
+ });
435
+ return this._cachedXValues = {
436
+ values: n,
437
+ dataHash: e
438
+ }, n;
439
+ }
440
+ _getYRange() {
441
+ if (!this._chartData) return {
442
+ min: 0,
443
+ max: 100
444
+ };
445
+ let e = JSON.stringify(this._chartData.datasets.map((e) => e.data.map((e) => e.y)));
446
+ if (this._cachedYRange.range && this._cachedYRange.dataHash === e) return this._cachedYRange.range;
447
+ let t = this._getAllDataPoints();
448
+ if (t.length === 0) {
449
+ let t = {
450
+ min: 0,
451
+ max: 100
452
+ };
453
+ return this._cachedYRange = {
454
+ range: t,
455
+ dataHash: e
456
+ }, t;
457
+ }
458
+ let n = t.map((e) => e.y), r = Math.min(...n), i = Math.max(...n), a = (i - r) * .1, o = {
459
+ min: Math.max(0, r - a),
460
+ max: i + a
461
+ };
462
+ return this._cachedYRange = {
463
+ range: o,
464
+ dataHash: e
465
+ }, o;
466
+ }
467
+ _hasDecimalValues() {
468
+ return this._getAllDataPoints().some((e) => e.y % 1 != 0);
469
+ }
470
+ _formatValueByString(e, t) {
471
+ switch (t.toLowerCase()) {
472
+ case "currency":
473
+ case "currency-usd": return new Intl.NumberFormat("en-US", {
474
+ style: "currency",
475
+ currency: "USD"
476
+ }).format(e);
477
+ case "currency-eur": return new Intl.NumberFormat("en-US", {
478
+ style: "currency",
479
+ currency: "EUR"
480
+ }).format(e);
481
+ case "currency-gbp": return new Intl.NumberFormat("en-US", {
482
+ style: "currency",
483
+ currency: "GBP"
484
+ }).format(e);
485
+ case "number":
486
+ case "number-with-commas": return new Intl.NumberFormat("en-US").format(e);
487
+ case "percent": return new Intl.NumberFormat("en-US", {
488
+ style: "percent",
489
+ minimumFractionDigits: 1
490
+ }).format(e / 100);
491
+ default: return this._hasDecimalValues() && e % 1 != 0 ? e.toFixed(1) : Math.round(e).toString();
492
+ }
493
+ }
494
+ _formatXAxisValue(e) {
495
+ if (this._chartData?.formatXAxis) {
496
+ if (typeof this._chartData.formatXAxis == "function") return this._chartData.formatXAxis(e);
497
+ if (typeof this._chartData.formatXAxis == "string") return String(e);
498
+ }
499
+ return String(e);
500
+ }
501
+ _escapeHtmlForTooltip(e) {
502
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
503
+ }
504
+ _tooltipXHeadingHtml(e) {
505
+ return `<strong>${this._escapeHtmlForTooltip(this._formatXAxisValue(e))}</strong><br/>`;
506
+ }
507
+ _formatYAxisValue(e) {
508
+ if (this._chartData?.formatYAxis) {
509
+ if (typeof this._chartData.formatYAxis == "function") return this._chartData.formatYAxis(e);
510
+ if (typeof this._chartData.formatYAxis == "string") return this._formatValueByString(e, this._chartData.formatYAxis);
511
+ }
512
+ if (this._chartData?.datasets?.[0]?.formatValue) {
513
+ if (typeof this._chartData.datasets[0].formatValue == "function") return this._chartData.datasets[0].formatValue(e);
514
+ if (typeof this._chartData.datasets[0].formatValue == "string") return this._formatValueByString(e, this._chartData.datasets[0].formatValue);
515
+ }
516
+ return this._hasDecimalValues() && e % 1 != 0 ? e.toFixed(1) : Math.round(e).toString();
517
+ }
518
+ _formatValue(e, t) {
519
+ if (t.formatValue) {
520
+ if (typeof t.formatValue == "function") return t.formatValue(e);
521
+ if (typeof t.formatValue == "string") return this._formatValueByString(e, t.formatValue);
522
+ }
523
+ return String(e);
524
+ }
525
+ _getAllDatasetsAtX(e) {
526
+ if (!this._chartData) return [];
527
+ let t = [];
528
+ return this._chartData.datasets.forEach((n, r) => {
529
+ if (!this._isDatasetVisible(n, r)) return;
530
+ let i = n.data.find((t) => String(t.x) === String(e));
531
+ if (i) {
532
+ let e = this._getDatasetColor(n, r), a = this._formatValue(i.y, n);
533
+ t.push({
534
+ name: n.name,
535
+ value: i.y,
536
+ color: e,
537
+ formattedValue: a
538
+ });
539
+ }
540
+ }), t;
541
+ }
542
+ _findNearestXValue(e) {
543
+ if (!this._chartData) return null;
544
+ let t = this._getChartBounds(), n = this._getXValues();
545
+ if (n.length === 0) return null;
546
+ let r = this._chartType === "bar", i = null, a = Infinity;
547
+ return n.forEach((n) => {
548
+ let o = r ? this._scaleXForBarChart(n, t) : this._scaleX(n, t), s = Math.abs(e - o);
549
+ s < a && (a = s, i = n);
550
+ }), i;
551
+ }
552
+ _setupTooltipScrollHandler() {
553
+ if (this._chartTooltipScrollHandler) {
554
+ window.removeEventListener("scroll", this._chartTooltipScrollHandler, !0), this._chartContainer && this._chartContainer.removeEventListener("scroll", this._chartTooltipScrollHandler, !0);
555
+ let e = this.parentElement;
556
+ for (; e;) e.removeEventListener("scroll", this._chartTooltipScrollHandler, !0), e = e.parentElement;
557
+ }
558
+ this._chartTooltipScrollHandler = () => {
559
+ this._hideTooltip(), this._pinnedXValue = null;
560
+ }, window.addEventListener("scroll", this._chartTooltipScrollHandler, !0), this._chartContainer && this._chartContainer.addEventListener("scroll", this._chartTooltipScrollHandler, !0);
561
+ let e = this.parentElement;
562
+ for (; e;) {
563
+ let t = window.getComputedStyle(e), n = t.overflow, r = t.overflowY;
564
+ (n === "auto" || n === "scroll" || r === "auto" || r === "scroll") && e.addEventListener("scroll", this._chartTooltipScrollHandler, !0), e = e.parentElement;
565
+ }
566
+ }
567
+ _setupChartTooltip() {
568
+ if (!this._svg || !this._showTooltip) return;
569
+ this._chartTooltipMouseMove && this._svg.removeEventListener("mousemove", this._chartTooltipMouseMove), this._chartTooltipMouseLeave && this._svg.removeEventListener("mouseleave", this._chartTooltipMouseLeave), this._chartTooltipClick && this._svg.removeEventListener("click", this._chartTooltipClick), this._chartTooltipTouchStart && this._svg.removeEventListener("touchstart", this._chartTooltipTouchStart), this._chartTooltipTouchMove && this._svg.removeEventListener("touchmove", this._chartTooltipTouchMove), this._chartTooltipTouchEnd && this._svg.removeEventListener("touchend", this._chartTooltipTouchEnd), this._cachedTooltipContent.clear(), this._cachedXPositions.clear();
570
+ let t = this._getChartBounds(), n = 0, r = 0, i = (i) => {
571
+ !this._chartContainer || !this._svg || (n = i.clientX, r = i.clientY, this._tooltipAnimationFrame !== null && cancelAnimationFrame(this._tooltipAnimationFrame), this._tooltipAnimationFrame = requestAnimationFrame(() => {
572
+ if (this._tooltipAnimationFrame = null, !this._svg) return;
573
+ let i = this._svg.getBoundingClientRect(), a = n - i.left, o = r - i.top;
574
+ if (a < t.x || a > t.x + t.width || o < t.y || o > t.y + t.height) {
575
+ this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null;
576
+ return;
577
+ }
578
+ let s = this._findNearestXValue(a);
579
+ if (!s) {
580
+ this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null;
581
+ return;
582
+ }
583
+ if (this._pinnedXValue !== null && this._pinnedXValue === s) {
584
+ let e = this._pinnedXValue, i = this._getAllDatasetsAtX(e);
585
+ if (i.length > 0) {
586
+ this._activeXValue = e, this._showPlotPointsForX(e), this._showVerticalLineAtX(e, t);
587
+ let a = this._cachedTooltipContent.get(e);
588
+ a || (a = this._tooltipXHeadingHtml(e), i.forEach((e) => {
589
+ a += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
590
+ <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
591
+ <span>${e.name}: ${e.formattedValue}</span>
592
+ </div>`;
593
+ }), this._cachedTooltipContent.set(e, a)), this._updateTooltipPosition(n, r), this._lastTooltipContent !== a && this._showTooltipAt(n, r, a);
594
+ return;
595
+ }
596
+ }
597
+ if (this._activeXValue === s) {
598
+ this._updateTooltipPosition(n, r);
599
+ return;
600
+ }
601
+ let c = this._getAllDatasetsAtX(s);
602
+ if (c.length === 0) {
603
+ this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine();
604
+ return;
605
+ }
606
+ this._activeXValue = s, this._showPlotPointsForX(s), this._showVerticalLineAtX(s, t);
607
+ let l = this._cachedTooltipContent.get(s);
608
+ if (!l) {
609
+ if (l = this._tooltipXHeadingHtml(s), c.forEach((e) => {
610
+ l += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
611
+ <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
612
+ <span>${e.name}: ${e.formattedValue}</span>
613
+ </div>`;
614
+ }), this._cachedTooltipContent.size >= e.MAX_CACHE_SIZE) {
615
+ let e = this._cachedTooltipContent.keys().next().value;
616
+ e !== void 0 && this._cachedTooltipContent.delete(e);
617
+ }
618
+ this._cachedTooltipContent.set(s, l);
619
+ }
620
+ this._showTooltipAt(n, r, l);
621
+ }));
622
+ }, a = () => {
623
+ this._tooltipAnimationFrame !== null && (cancelAnimationFrame(this._tooltipAnimationFrame), this._tooltipAnimationFrame = null), this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null;
624
+ }, o = (e) => {
625
+ if (!this._chartContainer || !this._svg) return;
626
+ e.stopPropagation();
627
+ let n = this._svg.getBoundingClientRect(), r = e.clientX - n.left, i = e.clientY - n.top;
628
+ if (r < t.x || r > t.x + t.width || i < t.y || i > t.y + t.height) return;
629
+ let a = this._findNearestXValue(r);
630
+ if (a) if (this._pinnedXValue === a) this._pinnedXValue = null, this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null;
631
+ else {
632
+ this._pinnedXValue = a, this._activeXValue = a;
633
+ let n = this._getAllDatasetsAtX(a);
634
+ if (n.length === 0) return;
635
+ this._showPlotPointsForX(a), this._showVerticalLineAtX(a, t);
636
+ let r = this._cachedTooltipContent.get(a);
637
+ r || (r = this._tooltipXHeadingHtml(a), n.forEach((e) => {
638
+ r += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
639
+ <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
640
+ <span>${e.name}: ${e.formattedValue}</span>
641
+ </div>`;
642
+ }), this._cachedTooltipContent.set(a, r)), this._showTooltipAt(e.clientX, e.clientY, r);
643
+ }
644
+ }, s = (e) => {
645
+ if (!this._chartContainer || !this._svg) return;
646
+ let n = e.touches[0];
647
+ if (!n) return;
648
+ let r = this._svg.getBoundingClientRect(), i = n.clientX - r.left, a = n.clientY - r.top;
649
+ if (i < t.x || i > t.x + t.width || a < t.y || a > t.y + t.height) {
650
+ this._pinnedXValue === null && (this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null);
651
+ return;
652
+ }
653
+ let o = this._findNearestXValue(i);
654
+ if (!o) {
655
+ this._pinnedXValue === null && (this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null);
656
+ return;
657
+ }
658
+ if (this._pinnedXValue === o) this._pinnedXValue = null, this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null;
659
+ else {
660
+ this._pinnedXValue = o, this._activeXValue = o;
661
+ let e = this._getAllDatasetsAtX(o);
662
+ if (e.length === 0) return;
663
+ this._showPlotPointsForX(o), this._showVerticalLineAtX(o, t);
664
+ let r = this._cachedTooltipContent.get(o);
665
+ r || (r = this._tooltipXHeadingHtml(o), e.forEach((e) => {
666
+ r += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
667
+ <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
668
+ <span>${e.name}: ${e.formattedValue}</span>
669
+ </div>`;
670
+ }), this._cachedTooltipContent.set(o, r)), this._showTooltipAt(n.clientX, n.clientY, r);
671
+ }
672
+ }, c = (n) => {
673
+ if (!this._chartContainer || !this._svg) return;
674
+ let r = n.touches[0];
675
+ r && (this._tooltipAnimationFrame !== null && cancelAnimationFrame(this._tooltipAnimationFrame), this._tooltipAnimationFrame = requestAnimationFrame(() => {
676
+ if (this._tooltipAnimationFrame = null, !this._svg) return;
677
+ let n = this._svg.getBoundingClientRect(), i = r.clientX - n.left, a = r.clientY - n.top;
678
+ if (i < t.x || i > t.x + t.width || a < t.y || a > t.y + t.height) {
679
+ if (this._pinnedXValue === null) this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null;
680
+ else {
681
+ let e = this._pinnedXValue, n = this._getAllDatasetsAtX(e);
682
+ if (n.length > 0) {
683
+ this._activeXValue = e, this._showPlotPointsForX(e), this._showVerticalLineAtX(e, t);
684
+ let i = this._cachedTooltipContent.get(e);
685
+ i || (i = this._tooltipXHeadingHtml(e), n.forEach((e) => {
686
+ i += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
687
+ <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
688
+ <span>${e.name}: ${e.formattedValue}</span>
689
+ </div>`;
690
+ }), this._cachedTooltipContent.set(e, i)), this._updateTooltipPosition(r.clientX, r.clientY), this._lastTooltipContent !== i && this._showTooltipAt(r.clientX, r.clientY, i);
691
+ }
692
+ }
693
+ return;
694
+ }
695
+ if (this._pinnedXValue !== null) {
696
+ let e = this._pinnedXValue, n = this._getAllDatasetsAtX(e);
697
+ if (n.length > 0) {
698
+ this._activeXValue = e, this._showPlotPointsForX(e), this._showVerticalLineAtX(e, t);
699
+ let i = this._cachedTooltipContent.get(e);
700
+ i || (i = this._tooltipXHeadingHtml(e), n.forEach((e) => {
701
+ i += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
702
+ <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
703
+ <span>${e.name}: ${e.formattedValue}</span>
704
+ </div>`;
705
+ }), this._cachedTooltipContent.set(e, i)), this._updateTooltipPosition(r.clientX, r.clientY), this._lastTooltipContent !== i && this._showTooltipAt(r.clientX, r.clientY, i);
706
+ return;
707
+ }
708
+ }
709
+ let o = this._findNearestXValue(i);
710
+ if (!o) {
711
+ this._pinnedXValue === null && (this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null);
712
+ return;
713
+ }
714
+ if (this._activeXValue === o) {
715
+ this._updateTooltipPosition(r.clientX, r.clientY);
716
+ return;
717
+ }
718
+ let s = this._getAllDatasetsAtX(o);
719
+ if (s.length === 0) {
720
+ this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine();
721
+ return;
722
+ }
723
+ this._activeXValue = o, this._showPlotPointsForX(o), this._showVerticalLineAtX(o, t);
724
+ let c = this._cachedTooltipContent.get(o);
725
+ if (!c) {
726
+ if (c = this._tooltipXHeadingHtml(o), s.forEach((e) => {
727
+ c += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
728
+ <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
729
+ <span>${e.name}: ${e.formattedValue}</span>
730
+ </div>`;
731
+ }), this._cachedTooltipContent.size >= e.MAX_CACHE_SIZE) {
732
+ let e = this._cachedTooltipContent.keys().next().value;
733
+ e !== void 0 && this._cachedTooltipContent.delete(e);
734
+ }
735
+ this._cachedTooltipContent.set(o, c);
736
+ }
737
+ this._showTooltipAt(r.clientX, r.clientY, c);
738
+ }));
739
+ }, l = () => {
740
+ this._tooltipAnimationFrame !== null && (cancelAnimationFrame(this._tooltipAnimationFrame), this._tooltipAnimationFrame = null), this._pinnedXValue === null && setTimeout(() => {
741
+ this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null;
742
+ }, 500);
743
+ };
744
+ this._chartClickOutsideHandler || (this._chartClickOutsideHandler = (e) => {
745
+ if (this._pinnedXValue === null) return;
746
+ let t = e.target;
747
+ this._svg && !this._svg.contains(t) && (this._pinnedXValue = null, this._hideTooltip(), this._hidePlotPoints(), this._hideVerticalLine(), this._activeXValue = null);
748
+ }, document.addEventListener("click", this._chartClickOutsideHandler, !0)), this._svg.addEventListener("mousemove", i), this._svg.addEventListener("mouseleave", a), this._svg.addEventListener("click", o), this._svg.addEventListener("touchstart", s, { passive: !0 }), this._svg.addEventListener("touchmove", c, { passive: !0 }), this._svg.addEventListener("touchend", l), this._chartTooltipMouseMove = i, this._chartTooltipMouseLeave = a, this._chartTooltipClick = o, this._chartTooltipTouchStart = s, this._chartTooltipTouchMove = c, this._chartTooltipTouchEnd = l;
749
+ }
750
+ _updateTooltipPosition(e, t) {
751
+ if (!this._tooltip || this._tooltip.style.display === "none" || this._tooltip.style.opacity === "0") return;
752
+ let n = this._tooltip.getBoundingClientRect(), r = window.innerWidth, i = window.innerHeight, a = e + 10, o = t - n.height - 8;
753
+ a + n.width > r && (a = e - n.width - 10), a < 0 && (a = 10), o < 0 && (o = t + 20), o + n.height > i && (o = t - n.height - 8, o < 0 && (o = 10));
754
+ let s = `${a}px`, c = `${o}px`;
755
+ this._tooltip.style.left !== s && (this._tooltip.style.left = s), this._tooltip.style.top !== c && (this._tooltip.style.top = c);
756
+ }
757
+ _scaleX(e, t) {
758
+ let n = this._getXValues();
759
+ if (n.length === 0) return t.x;
760
+ let r = n.indexOf(e);
761
+ if (r === -1) return t.x;
762
+ let i = t.width / Math.max(1, n.length - 1);
763
+ return t.x + r * i;
764
+ }
765
+ _scaleY(e, t) {
766
+ let n = this._getYRange();
767
+ if (n.max === n.min) return t.y + t.height / 2;
768
+ let r = (e - n.min) / (n.max - n.min);
769
+ return t.y + t.height - r * t.height;
770
+ }
771
+ _getDatasetColor(e, t, n) {
772
+ return n === void 0 ? e.color || this._defaultColors[t % this._defaultColors.length] : e.color || this._defaultColors[n % this._defaultColors.length];
773
+ }
774
+ _getContrastColor(e) {
775
+ let t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16), r = parseInt(t.substring(2, 4), 16), i = parseInt(t.substring(4, 6), 16);
776
+ return (.299 * n + .587 * r + .114 * i) / 255 > .5 ? "#000000" : "#ffffff";
777
+ }
778
+ _calculateRotatedLabelHeight() {
779
+ if (this._rotatedLabelHeight = 0, !this._chartData || !this._showGrid) return;
780
+ let e = this._getXValues();
781
+ if (e.length <= 1) return;
782
+ let t = {
783
+ width: this._width - (this._showGrid ? 60 : 0) - 0,
784
+ height: this._height - (this._showLegend ? Math.max(this._legendHeight, 60) : 0) - 0,
785
+ x: this._showGrid ? 60 : 0,
786
+ y: 0
787
+ }, n = this._chartType === "bar", r = [];
788
+ e.forEach((e) => {
789
+ let i = n ? this._scaleXForBarChart(e, t) : this._scaleX(e, t);
790
+ r.push(i);
791
+ });
792
+ let i = document.createElement("canvas").getContext("2d");
793
+ if (!i) return;
794
+ i.font = "12px system-ui, -apple-system, sans-serif";
795
+ let a = [];
796
+ e.forEach((e) => {
797
+ let t = this._formatXAxisValue(e), n = i.measureText(t);
798
+ a.push(n.width);
799
+ });
800
+ let o = !0;
801
+ for (let t = 1; t < e.length; t++) {
802
+ let e = r[t] - r[t - 1], n = a[t - 1] / 2 + a[t] / 2 + 10;
803
+ if (e < Math.max(n, 80)) {
804
+ o = !1;
805
+ break;
806
+ }
807
+ }
808
+ if (!o) {
809
+ let e = (Math.max(...a) + 12 * 1.2) * .707;
810
+ this._rotatedLabelHeight = Math.ceil(e) + 10;
811
+ }
812
+ }
813
+ _renderGrid(e) {
814
+ if (!this._svg || !this._showGrid) return;
815
+ let t = document.createElementNS("http://www.w3.org/2000/svg", "g");
816
+ t.setAttribute("class", "chart-grid");
817
+ let n = this._getYRange(), r = Math.floor(e.height / 35), i = Math.min(5, r);
818
+ for (let r = 0; r <= i; r++) {
819
+ let a = e.y + e.height / i * r, o = document.createElementNS("http://www.w3.org/2000/svg", "line");
820
+ o.setAttribute("x1", e.x.toString()), o.setAttribute("y1", a.toString()), o.setAttribute("x2", (e.x + e.width).toString()), o.setAttribute("y2", a.toString()), o.setAttribute("stroke", "#e5e7eb"), o.setAttribute("stroke-width", "1"), o.setAttribute("stroke-dasharray", "2,2"), document.documentElement.classList.contains("dark") && o.setAttribute("stroke", "#374151"), t.appendChild(o);
821
+ let s = n.max - (n.max - n.min) / i * r, c = document.createElementNS("http://www.w3.org/2000/svg", "text"), l = a + 4;
822
+ r === 0 && (l = a + 12), c.setAttribute("x", "5"), c.setAttribute("y", l.toString()), c.setAttribute("text-anchor", "start"), c.setAttribute("fill", "#6b7280"), c.setAttribute("font-size", "12"), c.textContent = this._formatYAxisValue(s), document.documentElement.classList.contains("dark") && c.setAttribute("fill", "#9ca3af"), t.appendChild(c);
823
+ }
824
+ let a = this._getXValues();
825
+ if (a.length === 0) {
826
+ this._svg.appendChild(t);
827
+ return;
828
+ }
829
+ let o = this._chartType === "bar", s = [];
830
+ a.forEach((t) => {
831
+ let n = o ? this._scaleXForBarChart(t, e) : this._scaleX(t, e);
832
+ s.push(n);
833
+ });
834
+ let c = document.createElement("canvas").getContext("2d"), l = !1, u = Array(a.length).fill(!0);
835
+ if (c && a.length > 1) {
836
+ c.font = "12px system-ui, -apple-system, sans-serif";
837
+ let e = [];
838
+ a.forEach((t) => {
839
+ let n = this._formatXAxisValue(t), r = c.measureText(n);
840
+ e.push(r.width);
841
+ });
842
+ let t = !0;
843
+ for (let n = 1; n < a.length; n++) {
844
+ let r = s[n] - s[n - 1], i = e[n - 1] / 2 + e[n] / 2 + 10;
845
+ if (r < Math.max(i, 80)) {
846
+ t = !1;
847
+ break;
848
+ }
849
+ }
850
+ if (!t) {
851
+ l = !0;
852
+ let t = 12 * 1.2;
853
+ if (this._rotatedLabelHeight === 0) {
854
+ let n = (Math.max(...e) + t) * .707;
855
+ this._rotatedLabelHeight = Math.ceil(n) + 10;
856
+ }
857
+ let n = t * 1.5, r = !0;
858
+ for (let e = 1; e < a.length; e++) if (s[e] - s[e - 1] < n) {
859
+ r = !1;
860
+ break;
861
+ }
862
+ if (!r) {
863
+ let e = n;
864
+ u = Array(a.length).fill(!1);
865
+ let t = -Infinity;
866
+ a.length > 0 && (u[0] = !0, t = s[0]);
867
+ for (let n = 1; n < a.length - 1; n++) {
868
+ let r = s[n];
869
+ r - t >= e && (u[n] = !0, t = r);
870
+ }
871
+ if (a.length > 1) {
872
+ let n = s[a.length - 1];
873
+ if (n - t >= e) u[a.length - 1] = !0;
874
+ else {
875
+ for (; n - t < e;) {
876
+ let e = !1;
877
+ for (let n = a.length - 2; n >= 0; n--) if (u[n]) {
878
+ if (u[n] = !1, n > 0) {
879
+ for (let r = n - 1; r >= 0; r--) if (u[r]) {
880
+ t = s[r], e = !0;
881
+ break;
882
+ }
883
+ e || (t = s[0]);
884
+ } else t = s[0];
885
+ e = !0;
886
+ break;
887
+ }
888
+ if (!e) break;
889
+ }
890
+ n - t >= e && (u[a.length - 1] = !0);
891
+ }
892
+ }
893
+ }
894
+ }
895
+ } else u = Array(a.length).fill(!1), a.length > 0 && (u[0] = !0), a.length > 1 && (u[a.length - 1] = !0), this._rotatedLabelHeight = 0;
896
+ l || (this._rotatedLabelHeight = 0), a.forEach((n, r) => {
897
+ if (u[r]) {
898
+ let i = s[r], o = document.createElementNS("http://www.w3.org/2000/svg", "line");
899
+ o.setAttribute("x1", i.toString()), o.setAttribute("y1", e.y.toString()), o.setAttribute("x2", i.toString()), o.setAttribute("y2", (e.y + e.height).toString()), o.setAttribute("stroke", "#e5e7eb"), o.setAttribute("stroke-width", "1"), o.setAttribute("stroke-dasharray", "2,2"), document.documentElement.classList.contains("dark") && o.setAttribute("stroke", "#374151"), t.appendChild(o);
900
+ let c = document.createElementNS("http://www.w3.org/2000/svg", "text"), u = i, d = "middle";
901
+ if (!l) {
902
+ if (r === 0) {
903
+ let t = e.x;
904
+ u = Math.max(i, t), d = "start";
905
+ } else if (r === a.length - 1) {
906
+ let t = e.x + e.width;
907
+ u = Math.min(i, t), d = "end";
908
+ }
909
+ } else if (d = "end", r === a.length - 1) {
910
+ let t = document.createElement("canvas").getContext("2d");
911
+ if (t) {
912
+ t.font = "12px system-ui, -apple-system, sans-serif";
913
+ let r = this._formatXAxisValue(n), a = t.measureText(r).width * .707, o = e.x + e.width + 100;
914
+ u = Math.min(i, o - a);
915
+ }
916
+ }
917
+ c.setAttribute("x", u.toString());
918
+ let f = (this._rotatedLabelHeight > 0 ? 30 : 20) + this._rotatedLabelHeight + 12, p = f;
919
+ this._showLegend && (p = f + 20 + Math.max(this._legendHeight, 60));
920
+ let m = (this._height - e.y - e.height) / p, h = (l ? 30 : 20) * m, g = e.y + e.height + h;
921
+ c.setAttribute("y", g.toString()), c.setAttribute("text-anchor", d), c.setAttribute("fill", "#6b7280"), c.setAttribute("font-size", "12"), l && c.setAttribute("transform", `rotate(-45 ${u} ${g})`), c.textContent = this._formatXAxisValue(n), document.documentElement.classList.contains("dark") && c.setAttribute("fill", "#9ca3af"), t.appendChild(c);
922
+ }
923
+ }), this._svg.appendChild(t);
924
+ }
925
+ _buildMonotoneXLinePathD(e) {
926
+ let t = (e) => e < 0 ? -1 : 1, n = (e, n, r, i, a, o) => {
927
+ let s = r - e, c = a - r, l = (i - n) / (s || c < 0 && -0), u = (o - i) / (c || s < 0 && -0), d = (l * c + u * s) / (s + c || 1e-12);
928
+ return (t(l) + t(u)) * Math.min(Math.abs(l), Math.abs(u), .5 * Math.abs(d)) || 0;
929
+ }, r = (e, t, n, r, i) => {
930
+ let a = n - e;
931
+ return a ? (3 * ((r - t) / a) - i) / 2 : i;
932
+ }, i = (e, t, n, r, i, a, o) => {
933
+ let s = (r - t) / 3;
934
+ e.push(`C ${t + s} ${n + s * a} ${r - s} ${i - s * o} ${r} ${i}`);
935
+ }, a = [];
936
+ for (let t of e) {
937
+ let e = a[a.length - 1];
938
+ (!e || e.x !== t.x || e.y !== t.y) && a.push(t);
939
+ }
940
+ if (a.length === 0) return "";
941
+ if (a.length === 1) return `M ${a[0].x} ${a[0].y}`;
942
+ let o = [], s = NaN, c = NaN, l = NaN, u = NaN, d = NaN, f = 0;
943
+ for (let e of a) {
944
+ let t = e.x, a = e.y;
945
+ if (!(t === l && a === u)) switch (f) {
946
+ case 0:
947
+ o.push(`M ${t} ${a}`), s = t, c = a, l = t, u = a, f = 1;
948
+ break;
949
+ case 1:
950
+ l = t, u = a, f = 2;
951
+ break;
952
+ case 2: {
953
+ let e = n(s, c, l, u, t, a);
954
+ i(o, s, c, l, u, r(s, c, l, u, e), e), s = l, c = u, l = t, u = a, d = e, f = 3;
955
+ break;
956
+ }
957
+ default: {
958
+ let e = n(s, c, l, u, t, a);
959
+ i(o, s, c, l, u, d, e), s = l, c = u, l = t, u = a, d = e;
960
+ }
961
+ }
962
+ }
963
+ return f === 2 ? o.push(`L ${l} ${u}`) : f === 3 && i(o, s, c, l, u, d, r(s, c, l, u, d)), o.join(" ");
964
+ }
965
+ _stripLeadingMoveTo(e) {
966
+ return e.replace(/^M\s+[\d.-]+\s+[\d.-]+\s*/i, "").trim();
967
+ }
968
+ _buildAreaFillPathD(e, t) {
969
+ if (e.length === 0) return "";
970
+ let n = e[e.length - 1];
971
+ if (e.length === 1) return `M ${e[0].x} ${t} L ${e[0].x} ${e[0].y} L ${e[0].x} ${t} Z`;
972
+ if (this._curveTension <= 0) {
973
+ let r = [`M ${e[0].x} ${t}`, `L ${e[0].x} ${e[0].y}`];
974
+ for (let t = 1; t < e.length; t++) r.push(`L ${e[t].x} ${e[t].y}`);
975
+ return r.push(`L ${n.x} ${t}`, "Z"), r.join(" ");
976
+ }
977
+ let r = this._buildMonotoneXLinePathD(e), i = this._stripLeadingMoveTo(r);
978
+ return `M ${e[0].x} ${t} L ${e[0].x} ${e[0].y} ${i} L ${n.x} ${t} Z`;
979
+ }
980
+ _buildSmoothLinePathD(e) {
981
+ if (e.length === 0) return "";
982
+ if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
983
+ if (this._curveTension <= 0) {
984
+ let t = [`M ${e[0].x} ${e[0].y}`];
985
+ for (let n = 1; n < e.length; n++) t.push(`L ${e[n].x} ${e[n].y}`);
986
+ return t.join(" ");
987
+ }
988
+ return this._buildMonotoneXLinePathD(e);
989
+ }
990
+ _renderLineChart() {
991
+ if (!this._svg || !this._chartData) return;
992
+ let e = this._getChartBounds();
993
+ this._renderGrid(e);
994
+ let t = document.createElementNS("http://www.w3.org/2000/svg", "g");
995
+ t.setAttribute("class", "chart-data");
996
+ let n = document.createDocumentFragment();
997
+ this._chartData.datasets.forEach((t, r) => {
998
+ if (!this._isDatasetVisible(t, r)) return;
999
+ let i = this._getDatasetColor(t, r), a = document.createElementNS("http://www.w3.org/2000/svg", "path"), o = t.data.map((t) => ({
1000
+ x: this._scaleX(t.x, e),
1001
+ y: this._scaleY(t.y, e)
1002
+ }));
1003
+ o.length !== 0 && (a.setAttribute("d", this._buildSmoothLinePathD(o)), a.setAttribute("fill", "none"), a.setAttribute("stroke", i), a.setAttribute("stroke-width", "2"), a.setAttribute("stroke-linecap", "round"), a.setAttribute("stroke-linejoin", "round"), n.appendChild(a), t.data.forEach((a) => {
1004
+ let o = document.createElementNS("http://www.w3.org/2000/svg", "circle"), s = this._scaleX(a.x, e), c = this._scaleY(a.y, e);
1005
+ o.setAttribute("cx", s.toString()), o.setAttribute("cy", c.toString()), o.setAttribute("r", "4"), o.setAttribute("fill", i);
1006
+ let l = document.documentElement.classList.contains("dark");
1007
+ o.setAttribute("stroke", l ? "#1f2937" : "#fff"), o.setAttribute("stroke-width", "2"), o.setAttribute("class", "chart-point"), o.setAttribute("data-dataset", r.toString()), o.setAttribute("data-x", String(a.x)), o.setAttribute("data-y", a.y.toString()), o.setAttribute("data-name", t.name), o.style.opacity = "0", o.style.pointerEvents = "none";
1008
+ let u = String(a.x);
1009
+ this._plotPoints.has(u) || this._plotPoints.set(u, []), this._plotPoints.get(u).push(o), n.appendChild(o);
1010
+ }));
1011
+ }), t.appendChild(n), this._svg.appendChild(t);
1012
+ }
1013
+ _scaleXForBarChart(e, t) {
1014
+ let n = this._getXValues();
1015
+ if (n.length === 0) return t.x;
1016
+ let r = n.indexOf(e);
1017
+ if (r === -1) return t.x;
1018
+ let i = n.length + 1, a = t.width / i;
1019
+ return t.x + (r + 1) * a;
1020
+ }
1021
+ _renderBarChart() {
1022
+ if (!this._svg || !this._chartData) return;
1023
+ let e = this._getChartBounds();
1024
+ this._renderGrid(e);
1025
+ let t = document.createElementNS("http://www.w3.org/2000/svg", "g");
1026
+ t.setAttribute("class", "chart-data");
1027
+ let n = document.createDocumentFragment(), r = this._getXValues(), i = this._chartData.datasets.filter((e, t) => this._isDatasetVisible(e, t)).length, a = r.length;
1028
+ if (a === 0) return;
1029
+ let o = [];
1030
+ r.forEach((t) => {
1031
+ o.push(this._scaleXForBarChart(t, e));
1032
+ }), o.sort((e, t) => e - t);
1033
+ let s = e.width;
1034
+ if (a > 1) for (let e = 0; e < o.length - 1; e++) {
1035
+ let t = o[e + 1] - o[e];
1036
+ t > 0 && t < s && (s = t);
1037
+ }
1038
+ else s = e.width * .5;
1039
+ let c = s * .7, l = .2, u = c / ((1 + l) * i - l), d = u * l, f = (u + d) * i - d;
1040
+ if (f > c) {
1041
+ let e = c / f;
1042
+ u *= e, d = u * l, f = (u + d) * i - d;
1043
+ }
1044
+ let p = 0;
1045
+ this._chartData.datasets.forEach((t, r) => {
1046
+ if (!this._isDatasetVisible(t, r)) return;
1047
+ let i = this._getDatasetColor(t, r), a = -f / 2 + (u + d) * p;
1048
+ p++, t.data.forEach((o) => {
1049
+ let s = this._scaleXForBarChart(o.x, e), c = this._scaleY(o.y, e), l = e.y + e.height - c, d = s + a, f = document.createElementNS("http://www.w3.org/2000/svg", "rect");
1050
+ f.setAttribute("x", d.toString()), f.setAttribute("y", c.toString()), f.setAttribute("width", u.toString()), f.setAttribute("height", l.toString()), f.setAttribute("fill", i), f.setAttribute("rx", "2"), f.setAttribute("class", "chart-bar"), f.setAttribute("data-dataset", r.toString()), f.setAttribute("data-x", String(o.x)), f.setAttribute("data-y", o.y.toString()), f.setAttribute("data-name", t.name), f.style.cursor = "pointer", this._showTooltip && f.addEventListener("mouseenter", (e) => {
1051
+ let t = this._getAllDatasetsAtX(o.x), n = this._tooltipXHeadingHtml(o.x);
1052
+ t.forEach((e) => {
1053
+ n += `<div style="display: flex; align-items: center; gap: 6px; margin-top: 4px;">
1054
+ <span style="display: inline-block; width: 12px; height: 12px; background-color: ${e.color}; border-radius: 2px;"></span>
1055
+ <span>${e.name}: ${e.formattedValue}</span>
1056
+ </div>`;
1057
+ }), this._showTooltipAt(e.clientX, e.clientY, n);
1058
+ }), n.appendChild(f);
1059
+ });
1060
+ }), t.appendChild(n), this._svg.appendChild(t);
1061
+ }
1062
+ _renderAreaChart() {
1063
+ if (!this._svg || !this._chartData) return;
1064
+ let e = this._getChartBounds();
1065
+ this._renderGrid(e);
1066
+ let t = document.createElementNS("http://www.w3.org/2000/svg", "g");
1067
+ t.setAttribute("class", "chart-data");
1068
+ let n = document.createDocumentFragment();
1069
+ this._chartData.datasets.forEach((t, r) => {
1070
+ if (!this._isDatasetVisible(t, r)) return;
1071
+ let i = this._getDatasetColor(t, r), a = t.data.map((t) => ({
1072
+ x: this._scaleX(t.x, e),
1073
+ y: this._scaleY(t.y, e)
1074
+ }));
1075
+ if (a.length === 0) return;
1076
+ let o = e.y + e.height, s = document.createElementNS("http://www.w3.org/2000/svg", "path");
1077
+ s.setAttribute("d", this._buildAreaFillPathD(a, o)), s.setAttribute("fill", i), s.setAttribute("fill-opacity", "0.3"), n.appendChild(s);
1078
+ let c = document.createElementNS("http://www.w3.org/2000/svg", "path");
1079
+ c.setAttribute("d", this._buildSmoothLinePathD(a)), c.setAttribute("fill", "none"), c.setAttribute("stroke", i), c.setAttribute("stroke-width", "2"), c.setAttribute("stroke-linecap", "round"), c.setAttribute("stroke-linejoin", "round"), n.appendChild(c), t.data.forEach((a) => {
1080
+ let o = document.createElementNS("http://www.w3.org/2000/svg", "circle"), s = this._scaleX(a.x, e), c = this._scaleY(a.y, e);
1081
+ o.setAttribute("cx", s.toString()), o.setAttribute("cy", c.toString()), o.setAttribute("r", "4"), o.setAttribute("fill", i);
1082
+ let l = document.documentElement.classList.contains("dark");
1083
+ o.setAttribute("stroke", l ? "#1f2937" : "#fff"), o.setAttribute("stroke-width", "2"), o.setAttribute("class", "chart-point"), o.setAttribute("data-dataset", r.toString()), o.setAttribute("data-x", String(a.x)), o.setAttribute("data-y", a.y.toString()), o.setAttribute("data-name", t.name), o.style.opacity = "0", o.style.pointerEvents = "none";
1084
+ let u = String(a.x);
1085
+ this._plotPoints.has(u) || this._plotPoints.set(u, []), this._plotPoints.get(u).push(o), n.appendChild(o);
1086
+ });
1087
+ }), t.appendChild(n), this._svg.appendChild(t);
1088
+ }
1089
+ _renderPieChart() {
1090
+ if (!this._svg || !this._chartData) return;
1091
+ let e = this._getChartBounds(), t = e.x + e.width / 2, n = e.y + e.height / 2, r = Math.min(e.width, e.height) / 2 - 20, i = this._chartData.datasets[0];
1092
+ if (!i || !i.data || i.data.length === 0) return;
1093
+ let a = i.data.reduce((e, t) => e + t.y, 0);
1094
+ if (a === 0) return;
1095
+ let o = document.createElementNS("http://www.w3.org/2000/svg", "g");
1096
+ o.setAttribute("class", "chart-data"), this._pieChartGroup = o, this._pieChartClickOutsideHandler || (this._pieChartClickOutsideHandler = (e) => {
1097
+ if (!this._pieChartTooltipShown) return;
1098
+ let t = e.target;
1099
+ this._pieChartGroup && !this._pieChartGroup.contains(t) && (this._pieChartTooltipShown = !1, this._hideTooltip());
1100
+ }, document.addEventListener("click", this._pieChartClickOutsideHandler, !0));
1101
+ let s = document.createElementNS("http://www.w3.org/2000/svg", "circle");
1102
+ s.setAttribute("cx", t.toString()), s.setAttribute("cy", n.toString()), s.setAttribute("r", r.toString()), s.setAttribute("fill", "transparent"), s.setAttribute("pointer-events", "none"), o.appendChild(s);
1103
+ let c = -Math.PI / 2;
1104
+ i.data.forEach((e, s) => {
1105
+ let l = e.y, u = l / a * 100, d = l / a * 2 * Math.PI, f = e.color || this._getDatasetColor(i, 0, s), p = document.createElementNS("http://www.w3.org/2000/svg", "g");
1106
+ p.setAttribute("class", "chart-pie-slice-group"), p.setAttribute("data-index", s.toString()), p.style.cursor = "pointer", p.style.transition = "transform 0.2s ease-out";
1107
+ let m = document.createElementNS("http://www.w3.org/2000/svg", "path"), h = r + 2, g = t + h * Math.cos(c), _ = n + h * Math.sin(c), v = t + h * Math.cos(c + d), y = n + h * Math.sin(c + d), b = d > Math.PI ? 1 : 0, x = [
1108
+ `M ${t} ${n}`,
1109
+ `L ${g} ${_}`,
1110
+ `A ${h} ${h} 0 ${b} 1 ${v} ${y}`,
1111
+ "Z"
1112
+ ].join(" ");
1113
+ m.setAttribute("d", x), m.setAttribute("fill", f), m.setAttribute("class", "chart-pie-slice"), m.setAttribute("data-index", s.toString()), m.setAttribute("data-x", String(e.x)), m.setAttribute("data-y", e.y.toString()), m.setAttribute("data-name", i.name), m.setAttribute("data-percentage", u.toFixed(1)), p.appendChild(m);
1114
+ let S = c + d / 2, C = Math.cos(S) * 10, w = Math.sin(S) * 10, T = null, E = null, D = !1;
1115
+ if (p.__chartInstance = this, p.addEventListener("mouseenter", function() {
1116
+ if (E !== null && (clearTimeout(E), E = null), !D) {
1117
+ T !== null && clearTimeout(T);
1118
+ let e = window.setTimeout(() => {
1119
+ D = !0, this.setAttribute("transform", `translate(${C}, ${w})`), T = null, this.__chartInstance && this.__chartInstance._pieChartTimeouts.delete(e);
1120
+ }, 150);
1121
+ T = e, this.__chartInstance && this.__chartInstance._pieChartTimeouts.add(e);
1122
+ }
1123
+ }), p.addEventListener("mouseleave", function() {
1124
+ if (T !== null && (clearTimeout(T), T = null), D) {
1125
+ E !== null && clearTimeout(E);
1126
+ let e = window.setTimeout(() => {
1127
+ D = !1, this.setAttribute("transform", "translate(0, 0)"), E = null, this.__chartInstance && this.__chartInstance._pieChartTimeouts.delete(e);
1128
+ }, 200);
1129
+ E = e, this.__chartInstance && this.__chartInstance._pieChartTimeouts.add(e);
1130
+ }
1131
+ }), p.addEventListener("click", function() {
1132
+ T !== null && (clearTimeout(T), T = null), E !== null && (clearTimeout(E), E = null), D = !0, this.setAttribute("transform", `translate(${C}, ${w})`);
1133
+ }), this._showTooltip) {
1134
+ let t = this._formatValue(l, i), n = `${this._tooltipXHeadingHtml(e.x)}${i.name}: ${t}<br/>${u.toFixed(1)}%`, r = (e) => {
1135
+ this._pieChartTooltipShown = !0, this._showTooltipAt(e.clientX, e.clientY, n);
1136
+ };
1137
+ p.addEventListener("mouseenter", r), p.addEventListener("mousemove", r), p.addEventListener("click", (e) => {
1138
+ e.stopPropagation(), r(e);
1139
+ }), p.addEventListener("mouseleave", () => {
1140
+ this._tooltipHideTimeout = window.setTimeout(() => {
1141
+ this._pieChartTooltipShown = !1, this._hideTooltip();
1142
+ }, 90);
1143
+ });
1144
+ }
1145
+ if (u > 5) {
1146
+ let e = c + d / 2, i = r * .7, a = t + i * Math.cos(e), o = n + i * Math.sin(e), s = this._getContrastColor(f), l = document.createElementNS("http://www.w3.org/2000/svg", "text");
1147
+ l.setAttribute("x", a.toString()), l.setAttribute("y", o.toString()), l.setAttribute("text-anchor", "middle"), l.setAttribute("dominant-baseline", "middle"), l.setAttribute("fill", s), l.setAttribute("font-size", "12"), l.setAttribute("font-weight", "500"), l.textContent = `${u.toFixed(1)}%`, p.appendChild(l);
1148
+ }
1149
+ o.appendChild(p), c += d;
1150
+ }), this._svg.appendChild(o), this._showTooltip && (this._svg.addEventListener("mousemove", (e) => {
1151
+ this._pieChartTooltipShown && this._lastTooltipContent && this._showTooltipAt(e.clientX, e.clientY, this._lastTooltipContent);
1152
+ }), this._svg.addEventListener("mouseleave", () => {
1153
+ this._pieChartTooltipShown = !1, this._hideTooltip();
1154
+ }));
1155
+ }
1156
+ _calculateLegendHeight() {
1157
+ if (!this._chartData) return 0;
1158
+ let e = this._width - 40, t = [];
1159
+ this._chartType === "pie" && this._chartData.datasets.length > 0 ? this._chartData.datasets[0].data.forEach((e) => {
1160
+ t.push({
1161
+ name: String(e.x),
1162
+ row: 0
1163
+ });
1164
+ }) : this._chartData.datasets.forEach((e) => {
1165
+ t.push({
1166
+ name: e.name,
1167
+ row: 0
1168
+ });
1169
+ });
1170
+ let n = 0, r = [];
1171
+ return t.forEach((t) => {
1172
+ let i = 20 + Math.min(t.name.length * 7.5, 150);
1173
+ r[n] || (r[n] = []), r[n].reduce((e, t) => e + (20 + Math.min(t.name.length * 7.5, 150)) + 32, 0) + i > e && r[n].length > 0 && (n++, r[n] = []), t.row = n, r[n].push(t);
1174
+ }), r.length * 36;
1175
+ }
1176
+ _renderLegend() {
1177
+ if (!this._chartData || !this._svg) return { height: 0 };
1178
+ let e = this._svg.querySelector(".chart-legend");
1179
+ e && e.remove();
1180
+ let t = document.createElementNS("http://www.w3.org/2000/svg", "g");
1181
+ if (t.setAttribute("class", "chart-legend"), !this._chartData) return { height: 0 };
1182
+ let n = this._chartData, r = this._width - 40, i = [];
1183
+ if (this._chartType === "pie" && n.datasets.length > 0) {
1184
+ let e = n.datasets[0];
1185
+ e.data.forEach((t, n) => {
1186
+ let r = t.color || this._getDatasetColor(e, 0, n), a = String(t.x);
1187
+ i.push({
1188
+ name: a,
1189
+ color: r,
1190
+ x: 0,
1191
+ textX: 0,
1192
+ row: 0
1193
+ });
1194
+ });
1195
+ } else n.datasets.forEach((e, t) => {
1196
+ if (!this._isDatasetVisible(e, t)) return;
1197
+ let n = this._getDatasetColor(e, t);
1198
+ i.push({
1199
+ name: e.name,
1200
+ color: n,
1201
+ x: 0,
1202
+ textX: 0,
1203
+ row: 0
1204
+ });
1205
+ });
1206
+ let a = 0, o = [];
1207
+ i.forEach((e) => {
1208
+ let t = 20 + Math.min(e.name.length * 7.5, 150);
1209
+ o[a] || (o[a] = []), o[a].reduce((e, t) => e + (20 + Math.min(t.name.length * 7.5, 150)) + 32, 0) + t > r && o[a].length > 0 && (a++, o[a] = []), e.row = a, o[a].push(e);
1210
+ }), o.forEach((e) => {
1211
+ let t = e.reduce((e, t) => e + (20 + Math.min(t.name.length * 7.5, 150)), 0) + (e.length - 1) * 32, n = (this._width - t) / 2;
1212
+ e.forEach((e) => {
1213
+ let t = Math.min(e.name.length * 7.5, 150);
1214
+ e.x = n, e.textX = n + 6 + 8, n += 20 + t + 32;
1215
+ });
1216
+ }), o.length * 36;
1217
+ let s = this._getChartBounds(), c = (this._rotatedLabelHeight > 0 ? 30 : 20) + this._rotatedLabelHeight + 12, l = c;
1218
+ this._showLegend && (l = c + 20 + Math.max(this._legendHeight, 60));
1219
+ let u = this._height - s.y - s.height, d = l > 0 ? u / l : 1, f = (this._rotatedLabelHeight > 0 ? 30 : 20) * d, p = 12 * d, m = this._rotatedLabelHeight * d, h = s.y + s.height + f + (this._rotatedLabelHeight > 0 ? m : p) + 20 * d;
1220
+ return i.forEach((e) => {
1221
+ let n = h + e.row * 36 + 16 / 2, r = document.createElementNS("http://www.w3.org/2000/svg", "circle");
1222
+ r.setAttribute("cx", e.x.toString()), r.setAttribute("cy", n.toString()), r.setAttribute("r", "6"), r.setAttribute("fill", e.color), t.appendChild(r);
1223
+ let i = document.createElementNS("http://www.w3.org/2000/svg", "foreignObject");
1224
+ i.setAttribute("x", e.textX.toString()), i.setAttribute("y", (n - 12).toString()), i.setAttribute("width", "150"), i.setAttribute("height", "24");
1225
+ let a = document.createElement("div");
1226
+ a.style.cssText = `
1227
+ font-size: 12px;
1228
+ font-family: system-ui, -apple-system, sans-serif;
1229
+ color: ${document.documentElement.classList.contains("dark") ? "#d1d5db" : "#374151"};
1230
+ line-height: 1.2;
1231
+ word-wrap: break-word;
1232
+ overflow-wrap: break-word;
1233
+ white-space: normal;
1234
+ max-width: 150px;
1235
+ display: flex;
1236
+ align-items: center;
1237
+ height: 100%;
1238
+ `, a.textContent = e.name, i.appendChild(a), t.appendChild(i);
1239
+ }), this._svg.appendChild(t), { height: this._legendHeight + 50 };
1240
+ }
1241
+ async addDataPoint(e, t) {
1242
+ return !this._chartData || !this._chartData.datasets[e] ? (console.error(`Dataset at index ${e} does not exist`), Promise.reject(/* @__PURE__ */ Error(`Dataset at index ${e} does not exist`))) : (this._chartData.datasets[e].data.push(t), this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender(), new Promise((e) => requestAnimationFrame(() => e())));
1243
+ }
1244
+ async batchAddDataPoints(e) {
1245
+ if (!this._chartData) return Promise.resolve();
1246
+ let t = !1;
1247
+ for (let { datasetIndex: n, point: r } of e) this._chartData.datasets[n] && (this._chartData.datasets[n].data.push(r), t = !0);
1248
+ return t && (this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender()), new Promise((e) => requestAnimationFrame(() => e()));
1249
+ }
1250
+ async updateDatasetData(e, t) {
1251
+ return !this._chartData || !this._chartData.datasets[e] ? (console.error(`Dataset at index ${e} does not exist`), Promise.reject(/* @__PURE__ */ Error(`Dataset at index ${e} does not exist`))) : (this._chartData.datasets[e].data = t, this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender(), new Promise((e) => requestAnimationFrame(() => e())));
1252
+ }
1253
+ async addDataset(e) {
1254
+ return this._chartData ? (this._chartData.datasets.push(e), e.id && this._datasetVisibility.set(e.id, e.visible !== !1), this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender(), new Promise((e) => requestAnimationFrame(() => e()))) : (console.error("Chart data not initialized"), Promise.reject(/* @__PURE__ */ Error("Chart data not initialized")));
1255
+ }
1256
+ async removeDataset(e) {
1257
+ return !this._chartData || !this._chartData.datasets[e] ? (console.error(`Dataset at index ${e} does not exist`), Promise.reject(/* @__PURE__ */ Error(`Dataset at index ${e} does not exist`))) : (this._chartData.datasets.splice(e, 1), this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender(), new Promise((e) => requestAnimationFrame(() => e())));
1258
+ }
1259
+ async updateDataPoint(e, t, n) {
1260
+ return !this._chartData || !this._chartData.datasets[e] ? (console.error(`Dataset at index ${e} does not exist`), Promise.reject(/* @__PURE__ */ Error(`Dataset at index ${e} does not exist`))) : this._chartData.datasets[e].data[t] ? (this._chartData.datasets[e].data[t] = n, this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender(), new Promise((e) => requestAnimationFrame(() => e()))) : (console.error(`Data point at index ${t} does not exist`), Promise.reject(/* @__PURE__ */ Error(`Data point at index ${t} does not exist`)));
1261
+ }
1262
+ async batchUpdateDataPoints(e) {
1263
+ if (!this._chartData) return Promise.resolve();
1264
+ let t = !1;
1265
+ for (let { datasetIndex: n, pointIndex: r, point: i } of e) this._chartData.datasets[n]?.data[r] && (this._chartData.datasets[n].data[r] = i, t = !0);
1266
+ return t && (this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender()), new Promise((e) => requestAnimationFrame(() => e()));
1267
+ }
1268
+ async removeDataPoint(e, t) {
1269
+ return !this._chartData || !this._chartData.datasets[e] ? (console.error(`Dataset at index ${e} does not exist`), Promise.reject(/* @__PURE__ */ Error(`Dataset at index ${e} does not exist`))) : (this._chartData.datasets[e].data.splice(t, 1), this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender(), new Promise((e) => requestAnimationFrame(() => e())));
1270
+ }
1271
+ async batchRemoveDataPoints(e) {
1272
+ if (!this._chartData) return Promise.resolve();
1273
+ let t = !1;
1274
+ for (let { datasetIndex: n, pointIndex: r } of e) this._chartData.datasets[n]?.data[r] && (this._chartData.datasets[n].data.splice(r, 1), t = !0);
1275
+ return t && (this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender()), new Promise((e) => requestAnimationFrame(() => e()));
1276
+ }
1277
+ async showDataset(e) {
1278
+ return this._datasetVisibility.set(e, !0), this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender(), new Promise((e) => requestAnimationFrame(() => e()));
1279
+ }
1280
+ async hideDataset(e) {
1281
+ return this._datasetVisibility.set(e, !1), this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender(), new Promise((e) => requestAnimationFrame(() => e()));
1282
+ }
1283
+ async toggleDataset(e) {
1284
+ let t = !(this._datasetVisibility.get(e) ?? !0);
1285
+ return this._datasetVisibility.set(e, t), this._cachedBounds.dataHash = "", this._cachedYRange.dataHash = "", this._cachedXValues.dataHash = "", this._cachedTooltipContent.clear(), this._scheduleRender(), await new Promise((e) => requestAnimationFrame(() => e())), t;
1286
+ }
1287
+ isDatasetVisible(e) {
1288
+ return this._datasetVisibility.get(e);
1289
+ }
1290
+ async downloadAsPNG(e = "chart.png") {
1291
+ if (!this._svg) return console.error("Chart SVG not found"), Promise.reject(/* @__PURE__ */ Error("Chart SVG not found"));
1292
+ let t = this._svg.cloneNode(!0), n = this._width, r = this._height;
1293
+ t.querySelectorAll("text").forEach((e) => {
1294
+ let t = e.getAttribute("font-family");
1295
+ (!t || t.includes("system-ui") || t.includes("apple-system")) && e.setAttribute("font-family", "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif");
1296
+ }), t.setAttribute("width", n.toString()), t.setAttribute("height", r.toString()), t.setAttribute("xmlns", "http://www.w3.org/2000/svg"), t.querySelectorAll("foreignObject").forEach((e) => {
1297
+ let t = e.querySelector("div");
1298
+ if (t) {
1299
+ let n = document.createElementNS("http://www.w3.org/2000/svg", "text"), r = e.getAttribute("x") || "0", i = e.getAttribute("y") || "0";
1300
+ n.setAttribute("x", r), n.setAttribute("y", (parseFloat(i) + 12).toString()), n.setAttribute("fill", t.style.color || "#374151"), n.setAttribute("font-size", "12"), n.setAttribute("font-family", t.style.fontFamily || "system-ui, -apple-system, sans-serif"), n.textContent = t.textContent || "", e.parentNode && e.parentNode.replaceChild(n, e);
1301
+ }
1302
+ });
1303
+ let i = new XMLSerializer().serializeToString(t), a = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(i), o = new Image();
1304
+ return o.crossOrigin = "anonymous", new Promise((t, i) => {
1305
+ o.onload = () => {
1306
+ setTimeout(() => {
1307
+ let a = document.createElement("canvas");
1308
+ a.width = n + 60, a.height = r + 60;
1309
+ let s = a.getContext("2d");
1310
+ if (!s) {
1311
+ console.error("Could not get canvas context"), i(/* @__PURE__ */ Error("Could not get canvas context"));
1312
+ return;
1313
+ }
1314
+ s.fillStyle = document.documentElement.classList.contains("dark") ? "#111827" : "#ffffff", s.fillRect(0, 0, a.width, a.height), s.drawImage(o, 30, 30), a.toBlob((n) => {
1315
+ if (!n) {
1316
+ console.error("Could not create blob from canvas"), i(/* @__PURE__ */ Error("Could not create blob from canvas"));
1317
+ return;
1318
+ }
1319
+ let r = URL.createObjectURL(n), a = document.createElement("a");
1320
+ a.href = r, a.download = e, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(r), t();
1321
+ }, "image/png");
1322
+ }, 0);
1323
+ }, o.onerror = () => {
1324
+ console.error("Error loading SVG image"), i(/* @__PURE__ */ Error("Error loading SVG image"));
1325
+ }, o.src = a;
1326
+ });
1327
+ }
1328
+ };
1329
+ customElements.get("mint-chart") || e("mint-chart", t);
1330
+ //#endregion
1331
+ export { t as default };