excel-collab 0.0.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +55 -6
  3. package/lib/{Chart-BG1R3R8C.js → Chart-BhTPyGgR.js} +2 -2
  4. package/lib/Chart-BhTPyGgR.js.map +1 -0
  5. package/lib/{Chart-BjEZ5cft.mjs → Chart-HqR126OX.mjs} +3 -3
  6. package/lib/Chart-HqR126OX.mjs.map +1 -0
  7. package/lib/{index-Ban_o3AI.mjs → index-Bg00LkBP.mjs} +7120 -7082
  8. package/lib/index-Bg00LkBP.mjs.map +1 -0
  9. package/lib/{index-aW-pq83D.js → index-T71OXghx.js} +51 -51
  10. package/lib/index-T71OXghx.js.map +1 -0
  11. package/lib/index.cjs.js +1 -1
  12. package/lib/index.es.js +32 -32
  13. package/lib/jszip.min-D8SohXCe.mjs.map +1 -1
  14. package/lib/jszip.min-DnSNaION.js.map +1 -1
  15. package/lib/{__tests__ → src/__tests__}/util.d.ts +2 -2
  16. package/lib/src/containers/__tests__/index.test.d.ts +0 -0
  17. package/lib/src/containers/canvas/__tests__/Collaboration.test.d.ts +0 -0
  18. package/lib/src/containers/canvas/modal/__tests__/index.test.d.ts +0 -0
  19. package/lib/{containers → src/containers}/canvas/modal/index.d.ts +1 -0
  20. package/lib/src/containers/hooks/useClickOutSide.d.ts +1 -0
  21. package/lib/{controller → src/controller}/Controller.d.ts +2 -1
  22. package/lib/src/controller/index.d.ts +2 -0
  23. package/lib/src/controller/init.d.ts +6 -0
  24. package/lib/{model → src/model}/Model.d.ts +1 -0
  25. package/lib/{model → src/model}/worksheet.d.ts +1 -0
  26. package/lib/{types → src/types}/controller.d.ts +1 -1
  27. package/lib/{types → src/types}/model.d.ts +3 -2
  28. package/lib/src/util/__tests__/util.test.d.ts +1 -0
  29. package/lib/{util → src/util}/debug.d.ts +1 -1
  30. package/lib/src/worker.d.ts +1 -0
  31. package/lib/worker-3pTMHwaB.js +12 -0
  32. package/lib/worker-3pTMHwaB.js.map +1 -0
  33. package/lib/worker-Dc15GQe_.mjs +5141 -0
  34. package/lib/worker-Dc15GQe_.mjs.map +1 -0
  35. package/lib/worker.cjs.js +1 -1
  36. package/lib/worker.cjs.js.map +1 -1
  37. package/lib/worker.es.js +2 -4
  38. package/lib/worker.es.js.map +1 -1
  39. package/package.json +21 -17
  40. package/lib/Chart-BG1R3R8C.js.map +0 -1
  41. package/lib/Chart-BjEZ5cft.mjs.map +0 -1
  42. package/lib/containers/hooks/useClickOutSide.d.ts +0 -1
  43. package/lib/controller/index.d.ts +0 -2
  44. package/lib/controller/init.d.ts +0 -3
  45. package/lib/index-Ban_o3AI.mjs.map +0 -1
  46. package/lib/index-aW-pq83D.js.map +0 -1
  47. package/lib/model/mockModel.d.ts +0 -3
  48. package/lib/worker-BJIY2mnb.js +0 -8
  49. package/lib/worker-BJIY2mnb.js.map +0 -1
  50. package/lib/worker-CYX3Y_k3.mjs +0 -4858
  51. package/lib/worker-CYX3Y_k3.mjs.map +0 -1
  52. package/lib/worker.d.ts +0 -2
  53. /package/lib/{canvas/__tests__/MainCanvas.test.d.ts → playground/index.d.ts} +0 -0
  54. /package/lib/{__tests__ → src/__tests__}/Border.test.d.ts +0 -0
  55. /package/lib/{__tests__ → src/__tests__}/Export.test.d.ts +0 -0
  56. /package/lib/{__tests__ → src/__tests__}/Filter.test.d.ts +0 -0
  57. /package/lib/{__tests__ → src/__tests__}/FloatElement.test.d.ts +0 -0
  58. /package/lib/{__tests__ → src/__tests__}/FormularBar.test.d.ts +0 -0
  59. /package/lib/{__tests__ → src/__tests__}/HorizontalAlign.test.d.ts +0 -0
  60. /package/lib/{__tests__ → src/__tests__}/Import.test.d.ts +0 -0
  61. /package/lib/{__tests__ → src/__tests__}/Menubar.test.d.ts +0 -0
  62. /package/lib/{__tests__ → src/__tests__}/MergeCell.test.d.ts +0 -0
  63. /package/lib/{__tests__ → src/__tests__}/NumberFormat.test.d.ts +0 -0
  64. /package/lib/{__tests__ → src/__tests__}/SheetBar.test.d.ts +0 -0
  65. /package/lib/{__tests__ → src/__tests__}/Toolbar.test.d.ts +0 -0
  66. /package/lib/{__tests__ → src/__tests__}/VerticalAlign.test.d.ts +0 -0
  67. /package/lib/{__tests__ → src/__tests__}/canvas.test.d.ts +0 -0
  68. /package/lib/{__tests__ → src/__tests__}/global.mock.d.ts +0 -0
  69. /package/lib/{__tests__ → src/__tests__}/shortcut.test.d.ts +0 -0
  70. /package/lib/{canvas → src/canvas}/MainCanvas.d.ts +0 -0
  71. /package/lib/{canvas/__tests__/border.test.d.ts → src/canvas/__tests__/MainCanvas.test.d.ts} +0 -0
  72. /package/lib/{canvas/__tests__/ccp.test.d.ts → src/canvas/__tests__/border.test.d.ts} +0 -0
  73. /package/lib/{canvas/__tests__/cell-style.test.d.ts → src/canvas/__tests__/ccp.test.d.ts} +0 -0
  74. /package/lib/{canvas/__tests__/cell-value.test.d.ts → src/canvas/__tests__/cell-style.test.d.ts} +0 -0
  75. /package/lib/{canvas/__tests__/filter.test.d.ts → src/canvas/__tests__/cell-value.test.d.ts} +0 -0
  76. /package/lib/{containers/canvas/event → src/canvas}/__tests__/filter.test.d.ts +0 -0
  77. /package/lib/{canvas → src/canvas}/__tests__/merge-cell.test.d.ts +0 -0
  78. /package/lib/{canvas → src/canvas}/__tests__/number-format.test.d.ts +0 -0
  79. /package/lib/{canvas → src/canvas}/__tests__/range.test.d.ts +0 -0
  80. /package/lib/{canvas → src/canvas}/__tests__/shortcut.test.d.ts +0 -0
  81. /package/lib/{canvas → src/canvas}/__tests__/theme.test.d.ts +0 -0
  82. /package/lib/{canvas → src/canvas}/__tests__/util.d.ts +0 -0
  83. /package/lib/{canvas → src/canvas}/__tests__/worker.test.d.ts +0 -0
  84. /package/lib/{canvas → src/canvas}/__tests__/wrap-text.test.d.ts +0 -0
  85. /package/lib/{canvas → src/canvas}/constant.d.ts +0 -0
  86. /package/lib/{canvas → src/canvas}/event.d.ts +0 -0
  87. /package/lib/{canvas → src/canvas}/index.d.ts +0 -0
  88. /package/lib/{canvas → src/canvas}/offScreenWorker.d.ts +0 -0
  89. /package/lib/{canvas → src/canvas}/shortcut.d.ts +0 -0
  90. /package/lib/{canvas → src/canvas}/util.d.ts +0 -0
  91. /package/lib/{canvas → src/canvas}/worker.d.ts +0 -0
  92. /package/lib/{components → src/components}/BaseIcon/BaseIcon.d.ts +0 -0
  93. /package/lib/{components → src/components}/BaseIcon/FillColorIcon.d.ts +0 -0
  94. /package/lib/{components → src/components}/BaseIcon/icon.d.ts +0 -0
  95. /package/lib/{components → src/components}/BaseIcon/index.d.ts +0 -0
  96. /package/lib/{components → src/components}/Button/index.d.ts +0 -0
  97. /package/lib/{components → src/components}/ColorPicker/ColorPickerPanel.d.ts +0 -0
  98. /package/lib/{components → src/components}/ColorPicker/Hue.d.ts +0 -0
  99. /package/lib/{components → src/components}/ColorPicker/Interactive.d.ts +0 -0
  100. /package/lib/{components → src/components}/ColorPicker/Pointer.d.ts +0 -0
  101. /package/lib/{components → src/components}/ColorPicker/Saturation.d.ts +0 -0
  102. /package/lib/{components → src/components}/ColorPicker/clamp.d.ts +0 -0
  103. /package/lib/{components → src/components}/ColorPicker/convert.d.ts +0 -0
  104. /package/lib/{components → src/components}/ColorPicker/index.d.ts +0 -0
  105. /package/lib/{components → src/components}/ColorPicker/round.d.ts +0 -0
  106. /package/lib/{components → src/components}/ColorPicker/types.d.ts +0 -0
  107. /package/lib/{components → src/components}/ColorPicker/useColorManipulation.d.ts +0 -0
  108. /package/lib/{components → src/components}/Dialog/index.d.ts +0 -0
  109. /package/lib/{components → src/components}/Loading/index.d.ts +0 -0
  110. /package/lib/{components → src/components}/Menu/index.d.ts +0 -0
  111. /package/lib/{components → src/components}/Select/index.d.ts +0 -0
  112. /package/lib/{components → src/components}/Toast/index.d.ts +0 -0
  113. /package/lib/{components → src/components}/__tests__/BaseIcon.test.d.ts +0 -0
  114. /package/lib/{components → src/components}/__tests__/Button.test.d.ts +0 -0
  115. /package/lib/{components → src/components}/__tests__/ColorPicker.test.d.ts +0 -0
  116. /package/lib/{components → src/components}/__tests__/Dialog.test.d.ts +0 -0
  117. /package/lib/{components → src/components}/__tests__/Loading.test.d.ts +0 -0
  118. /package/lib/{components → src/components}/__tests__/Menu.test.d.ts +0 -0
  119. /package/lib/{components → src/components}/__tests__/Select.test.d.ts +0 -0
  120. /package/lib/{components → src/components}/__tests__/Toast.test.d.ts +0 -0
  121. /package/lib/{components → src/components}/index.d.ts +0 -0
  122. /package/lib/{containers → src/containers}/Excel/ImportCSV.d.ts +0 -0
  123. /package/lib/{containers → src/containers}/Excel/__tests__/exportCSV.test.d.ts +0 -0
  124. /package/lib/{containers → src/containers}/Excel/__tests__/exportXLSX.test.d.ts +0 -0
  125. /package/lib/{containers → src/containers}/Excel/__tests__/importXLSX.test.d.ts +0 -0
  126. /package/lib/{containers → src/containers}/Excel/exportCSV.d.ts +0 -0
  127. /package/lib/{containers → src/containers}/Excel/exportConfig.d.ts +0 -0
  128. /package/lib/{containers → src/containers}/Excel/exportXLSX.d.ts +0 -0
  129. /package/lib/{containers → src/containers}/Excel/importXLSX.d.ts +0 -0
  130. /package/lib/{containers → src/containers}/Excel/index.d.ts +0 -0
  131. /package/lib/{containers → src/containers}/FloatElement/Chart.d.ts +0 -0
  132. /package/lib/{containers → src/containers}/FloatElement/ContextMenu.d.ts +0 -0
  133. /package/lib/{containers → src/containers}/FloatElement/FloatElement.d.ts +0 -0
  134. /package/lib/{containers → src/containers}/FloatElement/Image.d.ts +0 -0
  135. /package/lib/{containers → src/containers}/FloatElement/Toolbar.d.ts +0 -0
  136. /package/lib/{containers → src/containers}/FloatElement/index.d.ts +0 -0
  137. /package/lib/{containers → src/containers}/FloatElement/util.d.ts +0 -0
  138. /package/lib/{containers → src/containers}/FormulaBar/DefineName.d.ts +0 -0
  139. /package/lib/{containers → src/containers}/FormulaBar/FormulaEditor.d.ts +0 -0
  140. /package/lib/{containers → src/containers}/FormulaBar/index.d.ts +0 -0
  141. /package/lib/{containers → src/containers}/MenuBar/File.d.ts +0 -0
  142. /package/lib/{containers → src/containers}/MenuBar/I18N.d.ts +0 -0
  143. /package/lib/{containers → src/containers}/MenuBar/Theme.d.ts +0 -0
  144. /package/lib/{containers → src/containers}/MenuBar/User.d.ts +0 -0
  145. /package/lib/{containers → src/containers}/MenuBar/index.d.ts +0 -0
  146. /package/lib/{containers → src/containers}/SheetBar/SheetBarContextMenu.d.ts +0 -0
  147. /package/lib/{containers → src/containers}/SheetBar/index.d.ts +0 -0
  148. /package/lib/{containers → src/containers}/ToolBar/Border.d.ts +0 -0
  149. /package/lib/{containers → src/containers}/ToolBar/constant.d.ts +0 -0
  150. /package/lib/{containers → src/containers}/ToolBar/index.d.ts +0 -0
  151. /package/lib/{containers → src/containers}/__tests__/FormulaEditor.test.d.ts +0 -0
  152. /package/lib/{containers → src/containers}/canvas/BottomBar.d.ts +0 -0
  153. /package/lib/{containers → src/containers}/canvas/Collaboration.d.ts +0 -0
  154. /package/lib/{containers → src/containers}/canvas/ContextMenu.d.ts +0 -0
  155. /package/lib/{containers → src/containers}/canvas/ScrollBar.d.ts +0 -0
  156. /package/lib/{containers → src/containers}/canvas/__tests__/isSupportFontFamily.test.d.ts +0 -0
  157. /package/lib/{controller → src/containers/canvas/event}/__tests__/filter.test.d.ts +0 -0
  158. /package/lib/{containers → src/containers}/canvas/event/filter.d.ts +0 -0
  159. /package/lib/{containers → src/containers}/canvas/event/index.d.ts +0 -0
  160. /package/lib/{containers → src/containers}/canvas/event/main.d.ts +0 -0
  161. /package/lib/{containers → src/containers}/canvas/index.d.ts +0 -0
  162. /package/lib/{containers → src/containers}/canvas/isSupportFontFamily.d.ts +0 -0
  163. /package/lib/{containers → src/containers}/canvas/modal/Filter.d.ts +0 -0
  164. /package/lib/{containers → src/containers}/canvas/util.d.ts +0 -0
  165. /package/lib/{containers → src/containers}/hooks/__tests__/useClickOutSide.test.d.ts +0 -0
  166. /package/lib/{containers → src/containers}/hooks/__tests__/useEventCallback.test.d.ts +0 -0
  167. /package/lib/{containers → src/containers}/hooks/index.d.ts +0 -0
  168. /package/lib/{containers → src/containers}/hooks/useEventCallback.d.ts +0 -0
  169. /package/lib/{containers → src/containers}/index.d.ts +0 -0
  170. /package/lib/{containers → src/containers}/store/activeCell.d.ts +0 -0
  171. /package/lib/{containers → src/containers}/store/context.d.ts +0 -0
  172. /package/lib/{containers → src/containers}/store/core.d.ts +0 -0
  173. /package/lib/{containers → src/containers}/store/index.d.ts +0 -0
  174. /package/lib/{containers → src/containers}/store/scroll.d.ts +0 -0
  175. /package/lib/{containers → src/containers}/store/style.d.ts +0 -0
  176. /package/lib/{containers → src/containers}/store/user.d.ts +0 -0
  177. /package/lib/{controller → src/controller}/__tests__/col.test.d.ts +0 -0
  178. /package/lib/{controller → src/controller}/__tests__/controller.test.d.ts +0 -0
  179. /package/lib/{controller → src/controller}/__tests__/definedName.test.d.ts +0 -0
  180. /package/lib/{controller → src/controller}/__tests__/drawing.test.d.ts +0 -0
  181. /package/lib/{controller/__tests__/getHitInfo.test.d.ts → src/controller/__tests__/filter.test.d.ts} +0 -0
  182. /package/lib/{controller/__tests__/mergeCell.test.d.ts → src/controller/__tests__/getHitInfo.test.d.ts} +0 -0
  183. /package/lib/{model → src/controller}/__tests__/mergeCell.test.d.ts +0 -0
  184. /package/lib/{controller → src/controller}/__tests__/rangeMap.test.d.ts +0 -0
  185. /package/lib/{controller → src/controller}/__tests__/row.test.d.ts +0 -0
  186. /package/lib/{controller → src/controller}/__tests__/workbook.test.d.ts +0 -0
  187. /package/lib/{controller → src/controller}/__tests__/worksheet.test.d.ts +0 -0
  188. /package/lib/{controller → src/controller}/decorator.d.ts +0 -0
  189. /package/lib/{formula → src/formula}/__tests__/formula/math.test.d.ts +0 -0
  190. /package/lib/{formula → src/formula}/__tests__/formula/text.test.d.ts +0 -0
  191. /package/lib/{formula → src/formula}/__tests__/interpreter/array.test.d.ts +0 -0
  192. /package/lib/{formula → src/formula}/__tests__/interpreter/error.test.d.ts +0 -0
  193. /package/lib/{formula → src/formula}/__tests__/interpreter/function.test.d.ts +0 -0
  194. /package/lib/{formula → src/formula}/__tests__/interpreter/logical.test.d.ts +0 -0
  195. /package/lib/{formula → src/formula}/__tests__/interpreter/math.test.d.ts +0 -0
  196. /package/lib/{formula → src/formula}/__tests__/interpreter/primary.test.d.ts +0 -0
  197. /package/lib/{formula → src/formula}/__tests__/interpreter/r1c1.test.d.ts +0 -0
  198. /package/lib/{formula → src/formula}/__tests__/interpreter/reference.test.d.ts +0 -0
  199. /package/lib/{formula → src/formula}/__tests__/interpreter/util.d.ts +0 -0
  200. /package/lib/{formula → src/formula}/__tests__/interpreter/variable.test.d.ts +0 -0
  201. /package/lib/{formula → src/formula}/__tests__/numberFormat.test.d.ts +0 -0
  202. /package/lib/{formula → src/formula}/__tests__/parser/basic-expressions.test.d.ts +0 -0
  203. /package/lib/{formula → src/formula}/__tests__/parser/cell-range.test.d.ts +0 -0
  204. /package/lib/{formula → src/formula}/__tests__/parser/function-call.test.d.ts +0 -0
  205. /package/lib/{formula → src/formula}/__tests__/parser/invalid-expressions.test.d.ts +0 -0
  206. /package/lib/{formula → src/formula}/__tests__/parser/operators.test.d.ts +0 -0
  207. /package/lib/{formula → src/formula}/__tests__/parser/util.d.ts +0 -0
  208. /package/lib/{formula → src/formula}/__tests__/scanner/arithmetic-expression.test.d.ts +0 -0
  209. /package/lib/{formula → src/formula}/__tests__/scanner/arrays.test.d.ts +0 -0
  210. /package/lib/{formula → src/formula}/__tests__/scanner/cell-ranges.test.d.ts +0 -0
  211. /package/lib/{formula → src/formula}/__tests__/scanner/comparison-expression.test.d.ts +0 -0
  212. /package/lib/{formula → src/formula}/__tests__/scanner/define-name.test.d.ts +0 -0
  213. /package/lib/{formula → src/formula}/__tests__/scanner/functions.test.d.ts +0 -0
  214. /package/lib/{formula → src/formula}/__tests__/scanner/logical-expression.test.d.ts +0 -0
  215. /package/lib/{formula → src/formula}/__tests__/scanner/primary.test.d.ts +0 -0
  216. /package/lib/{formula → src/formula}/__tests__/scanner/r1c1.test.d.ts +0 -0
  217. /package/lib/{formula → src/formula}/__tests__/scanner/range-operator.test.d.ts +0 -0
  218. /package/lib/{formula → src/formula}/__tests__/scanner/string-expression.test.d.ts +0 -0
  219. /package/lib/{formula → src/formula}/__tests__/scanner/util.d.ts +0 -0
  220. /package/lib/{formula → src/formula}/eval.d.ts +0 -0
  221. /package/lib/{formula → src/formula}/expression.d.ts +0 -0
  222. /package/lib/{formula → src/formula}/formula/error.d.ts +0 -0
  223. /package/lib/{formula → src/formula}/formula/float.d.ts +0 -0
  224. /package/lib/{formula → src/formula}/formula/index.d.ts +0 -0
  225. /package/lib/{formula → src/formula}/formula/math.d.ts +0 -0
  226. /package/lib/{formula → src/formula}/formula/text.d.ts +0 -0
  227. /package/lib/{formula → src/formula}/index.d.ts +0 -0
  228. /package/lib/{formula → src/formula}/interpreter.d.ts +0 -0
  229. /package/lib/{formula → src/formula}/numberFormat.d.ts +0 -0
  230. /package/lib/{formula → src/formula}/parser.d.ts +0 -0
  231. /package/lib/{formula → src/formula}/scanner.d.ts +0 -0
  232. /package/lib/{formula → src/formula}/token.d.ts +0 -0
  233. /package/lib/{i18n → src/i18n}/__tests__/i18n.test.d.ts +0 -0
  234. /package/lib/{i18n → src/i18n}/index.d.ts +0 -0
  235. /package/lib/{i18n → src/i18n}/lang/en.json.d.ts +0 -0
  236. /package/lib/{i18n → src/i18n}/lang/zh.json.d.ts +0 -0
  237. /package/lib/{index.d.ts → src/index.d.ts} +0 -0
  238. /package/lib/{model/__tests__/model.test.d.ts → src/model/__tests__/mergeCell.test.d.ts} +0 -0
  239. /package/lib/{model/__tests__/rangeMap.test.d.ts → src/model/__tests__/model.test.d.ts} +0 -0
  240. /package/lib/{model/__tests__/workbook.test.d.ts → src/model/__tests__/rangeMap.test.d.ts} +0 -0
  241. /package/lib/{model → src/model}/__tests__/util.d.ts +0 -0
  242. /package/lib/{theme/__tests__/theme.test.d.ts → src/model/__tests__/workbook.test.d.ts} +0 -0
  243. /package/lib/{model → src/model}/col.d.ts +0 -0
  244. /package/lib/{model → src/model}/definedName.d.ts +0 -0
  245. /package/lib/{model → src/model}/drawing.d.ts +0 -0
  246. /package/lib/{model → src/model}/filter.d.ts +0 -0
  247. /package/lib/{model → src/model}/index.d.ts +0 -0
  248. /package/lib/{model → src/model}/mergeCell.d.ts +0 -0
  249. /package/lib/{model → src/model}/rangeMap.d.ts +0 -0
  250. /package/lib/{model → src/model}/row.d.ts +0 -0
  251. /package/lib/{model → src/model}/scroll.d.ts +0 -0
  252. /package/lib/{model → src/model}/workbook.d.ts +0 -0
  253. /package/lib/{util/__tests__/EventEmitter.test.d.ts → src/theme/__tests__/theme.test.d.ts} +0 -0
  254. /package/lib/{theme → src/theme}/color.d.ts +0 -0
  255. /package/lib/{theme → src/theme}/convert.d.ts +0 -0
  256. /package/lib/{theme → src/theme}/index.d.ts +0 -0
  257. /package/lib/{theme → src/theme}/size.d.ts +0 -0
  258. /package/lib/{theme → src/theme}/zIndex.d.ts +0 -0
  259. /package/lib/{types → src/types}/canvas.d.ts +0 -0
  260. /package/lib/{types → src/types}/components.d.ts +0 -0
  261. /package/lib/{types → src/types}/event.d.ts +0 -0
  262. /package/lib/{types → src/types}/formula.d.ts +0 -0
  263. /package/lib/{types → src/types}/index.d.ts +0 -0
  264. /package/lib/{types → src/types}/parser.d.ts +0 -0
  265. /package/lib/{types → src/types}/range.d.ts +0 -0
  266. /package/lib/{types → src/types}/yjs.d.ts +0 -0
  267. /package/lib/{util → src/util}/EventEmitter.d.ts +0 -0
  268. /package/lib/{util/__tests__/assert.test.d.ts → src/util/__tests__/EventEmitter.test.d.ts} +0 -0
  269. /package/lib/{util/__tests__/classnames.test.d.ts → src/util/__tests__/assert.test.d.ts} +0 -0
  270. /package/lib/{util/__tests__/color.test.d.ts → src/util/__tests__/classnames.test.d.ts} +0 -0
  271. /package/lib/{util/__tests__/convert.test.d.ts → src/util/__tests__/color.test.d.ts} +0 -0
  272. /package/lib/{util/__tests__/copy.test.d.ts → src/util/__tests__/convert.test.d.ts} +0 -0
  273. /package/lib/{util/__tests__/debug.test.d.ts → src/util/__tests__/copy.test.d.ts} +0 -0
  274. /package/lib/{util/__tests__/deepEqual.test.d.ts → src/util/__tests__/debug.test.d.ts} +0 -0
  275. /package/lib/{util/__tests__/get.test.d.ts → src/util/__tests__/deepEqual.test.d.ts} +0 -0
  276. /package/lib/{util/__tests__/image.test.d.ts → src/util/__tests__/get.test.d.ts} +0 -0
  277. /package/lib/{util/__tests__/isEmpty.test.d.ts → src/util/__tests__/image.test.d.ts} +0 -0
  278. /package/lib/{util/__tests__/lodash.test.d.ts → src/util/__tests__/isEmpty.test.d.ts} +0 -0
  279. /package/lib/{util/__tests__/range.test.d.ts → src/util/__tests__/lodash.test.d.ts} +0 -0
  280. /package/lib/{util/__tests__/reference.test.d.ts → src/util/__tests__/range.test.d.ts} +0 -0
  281. /package/lib/{util/__tests__/saveAs.test.d.ts → src/util/__tests__/reference.test.d.ts} +0 -0
  282. /package/lib/{util/__tests__/split.test.d.ts → src/util/__tests__/saveAs.test.d.ts} +0 -0
  283. /package/lib/{util/__tests__/style.test.d.ts → src/util/__tests__/split.test.d.ts} +0 -0
  284. /package/lib/{util/__tests__/util.test.d.ts → src/util/__tests__/style.test.d.ts} +0 -0
  285. /package/lib/{util → src/util}/assert.d.ts +0 -0
  286. /package/lib/{util → src/util}/classnames.d.ts +0 -0
  287. /package/lib/{util → src/util}/color.d.ts +0 -0
  288. /package/lib/{util → src/util}/constant.d.ts +0 -0
  289. /package/lib/{util → src/util}/convert.d.ts +0 -0
  290. /package/lib/{util → src/util}/copy.d.ts +0 -0
  291. /package/lib/{util → src/util}/dpr.d.ts +0 -0
  292. /package/lib/{util → src/util}/event.d.ts +0 -0
  293. /package/lib/{util → src/util}/font.d.ts +0 -0
  294. /package/lib/{util → src/util}/image.d.ts +0 -0
  295. /package/lib/{util → src/util}/index.d.ts +0 -0
  296. /package/lib/{util → src/util}/lodash.d.ts +0 -0
  297. /package/lib/{util → src/util}/range.d.ts +0 -0
  298. /package/lib/{util → src/util}/reference.d.ts +0 -0
  299. /package/lib/{util → src/util}/saveAs.d.ts +0 -0
  300. /package/lib/{util → src/util}/split.d.ts +0 -0
  301. /package/lib/{util → src/util}/style.d.ts +0 -0
  302. /package/lib/{util → src/util}/util.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.0](https://github.com/nusr/excel/compare/v0.0.8...v0.1.0) (2025-01-27)
4
+
5
+ ### Features
6
+
7
+ * init model ([6b0d06d](https://github.com/nusr/excel/commit/6b0d06d4e45f113c4e266b561837829ad89f290b))
8
+
9
+ ### Bug Fixes
10
+
11
+ * simplify the import of worker ([77982de](https://github.com/nusr/excel/commit/77982de7b286ab3ffca0711120aed95e3d3b9421))
12
+ * update dep ([dc9aa8f](https://github.com/nusr/excel/commit/dc9aa8ff30567f377d4e3ed1e514ac4adf026bbe))
13
+
3
14
  ## [0.0.8](https://github.com/nusr/excel/compare/v0.0.7...v0.0.8) (2025-01-14)
4
15
 
5
16
  ### Features
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # 🌐 Online Collaboration Excel
1
+ # Online Collaboration Excel
2
2
 
3
3
  [![CI](https://github.com/nusr/excel/actions/workflows/main.yml/badge.svg)](https://github.com/nusr/excel/actions/workflows/main.yml)
4
4
  [![codecov](https://codecov.io/gh/nusr/excel/branch/main/graph/badge.svg?token=ZOC8RHD3Z1)](https://codecov.io/gh/nusr/excel)
@@ -11,19 +11,67 @@ English | [中文](./README_zh.md)
11
11
 
12
12
  ![Demo](./scripts/demo.gif)
13
13
 
14
- ## 🚀 Installation
14
+ ## Installation
15
15
 
16
16
  ```bash
17
17
  npm i --save excel-collab
18
18
  ```
19
19
 
20
- ## 📚 Examples
20
+ ## Quick Start
21
+
22
+ 1. Create a React app
23
+
24
+ ```bash
25
+ npm create vite@latest my-app -- --template react-ts
26
+ cd my-app
27
+ npm i
28
+ ```
29
+
30
+ 2. Install the Required Libraries
31
+
32
+ ```bash
33
+ npm i --save excel-collab yjs react@latest react-dom@latest @types/react@latest @types/react-dom@latest
34
+ ```
35
+
36
+ 3. Modify the Main File
37
+
38
+ ```ts src/main.tsx
39
+ // src/main.tsx
40
+ import { createRoot } from 'react-dom/client';
41
+ import { StrictMode } from 'react';
42
+ import { initController, StateContext, Excel } from 'excel-collab';
43
+ import Worker from 'excel-collab/worker?worker';
44
+ import 'excel-collab/style.css';
45
+ import * as Y from 'yjs';
46
+
47
+ const controller = initController({
48
+ worker: new Worker(),
49
+ doc: new Y.Doc(),
50
+ });
51
+
52
+ createRoot(document.getElementById('root')!).render(
53
+ <StrictMode>
54
+ <div style={{ height: '100vh' }}>
55
+ <StateContext value={{ controller }}>
56
+ <Excel />
57
+ </StateContext>
58
+ </div>
59
+ </StrictMode>,
60
+ );
61
+ ```
62
+
63
+ 4. Start the app
64
+
65
+ ```bash
66
+ npm run dev
67
+ ```
68
+
69
+ ## Examples
21
70
 
22
71
  - [Simple Example](https://stackblitz.com/edit/nusr-excel-simple)
23
72
  - [Custom Example](https://stackblitz.com/edit/nusr-excel-custom)
24
- - [Collaboration Example](https://stackblitz.com/edit/nusr-excel-collaboration)
25
73
 
26
- ## 🛠️ Developing
74
+ ## Collaboration Example
27
75
 
28
76
  ```bash
29
77
  git clone https://github.com/nusr/excel.git
@@ -31,12 +79,13 @@ cd excel
31
79
 
32
80
  npm i -g pnpm
33
81
  pnpm i
82
+
34
83
  cd demo/frontend && pnpm i && cd -
35
84
  cd demo/backend && pnpm i && cd -
36
85
  npm run dev
37
86
  ```
38
87
 
39
- ## Supported Features
88
+ ## Supported Features
40
89
 
41
90
  - [x] Online Collaboration
42
91
  - [x] Create File
@@ -1,4 +1,4 @@
1
- "use strict";var ho=Object.defineProperty;var uo=(i,t,e)=>t in i?ho(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var k=(i,t,e)=>uo(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const bt=require("./index-aW-pq83D.js"),Nt=require("react"),Rt=require("./worker-BJIY2mnb.js");/*!
1
+ "use strict";var ho=Object.defineProperty;var uo=(i,t,e)=>t in i?ho(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var k=(i,t,e)=>uo(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const bt=require("./index-T71OXghx.js"),Nt=require("react"),Rt=require("./worker-3pTMHwaB.js");/*!
2
2
  * @kurkle/color v0.3.4
3
3
  * https://github.com/kurkle/color#readme
4
4
  * (c) 2024 Jukka Kurkela
@@ -16,4 +16,4 @@
16
16
  */class Qr{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,s,n){const o=e.listeners[n],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(s-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=wn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var dt=new Qr;const _s="transparent",ta={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=cs(i||_s),n=s.valid&&cs(t||_s);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class ea{constructor(t,e,s,n){const o=e[s];n=Ce([t.to,n,o,t.from]);const r=Ce([t.from,o,n]);this._active=!0,this._fn=t.fn||ta[t.type||typeof r],this._easing=ue[t.easing]||ue.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Ce([t.to,e,n,t.from]),this._from=Ce([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e<s),!this._active){this._target[n]=a,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/s%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n<s.length;n++)s[n][e]()}}class Nn{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!A(t))return;const e=Object.keys(V.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!A(o))return;const r={};for(const a of e)r[a]=o[a];(W(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=sa(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&ia(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const u=s.get(c);if(d)if(u&&d.active()){d.update(u,h,a);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new ea(u,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const s=this._createAnimations(t,e);if(s.length)return dt.add(this._chart,s),!0}}function ia(i,t){const e=[],s=Object.keys(t);for(let n=0;n<s.length;n++){const o=i[s[n]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function sa(i,t){if(!t)return;let e=i.options;if(!e){i.options=t;return}return e.$shared&&(i.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function ys(i,t){const e=i&&i.options||{},s=e.reverse,n=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:s?o:n,end:s?n:o}}function na(i,t,e){if(e===!1)return!1;const s=ys(i,e),n=ys(t,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function oa(i){let t,e,s,n;return A(i)?(t=i.top,e=i.right,s=i.bottom,n=i.left):t=e=s=n=i,{top:t,right:e,bottom:s,left:n,disabled:i===!1}}function jn(i,t){const e=[],s=i._getSortedDatasetMetas(t);let n,o;for(n=0,o=s.length;n<o;++n)e.push(s[n].index);return e}function vs(i,t,e,s={}){const n=i.keys,o=s.mode==="single";let r,a,l,c;if(t===null)return;let h=!1;for(r=0,a=n.length;r<a;++r){if(l=+n[r],l===e){if(h=!0,s.all)continue;break}c=i.values[l],$(c)&&(o||t===0||lt(t)===lt(c))&&(t+=c)}return!h&&!s.all?0:t}function ra(i,t){const{iScale:e,vScale:s}=t,n=e.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",r=Object.keys(i),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[n]:h,[o]:i[h]};return a}function ci(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function aa(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function la(i){const{min:t,max:e,minDefined:s,maxDefined:n}=i.getUserBounds();return{min:s?t:Number.NEGATIVE_INFINITY,max:n?e:Number.POSITIVE_INFINITY}}function ca(i,t,e){const s=i[t]||(i[t]={});return s[e]||(s[e]={})}function ks(i,t,e,s){for(const n of t.getMatchingVisibleMetas(s).reverse()){const o=i[n.index];if(e&&o>0||!e&&o<0)return n.index}return null}function Ms(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=s,l=o.axis,c=r.axis,h=aa(o,r,s),d=t.length;let u;for(let f=0;f<d;++f){const g=t[f],{[l]:p,[c]:m}=g,b=g._stacks||(g._stacks={});u=b[c]=ca(n,h,p),u[a]=m,u._top=ks(u,r,!0,s.type),u._bottom=ks(u,r,!1,s.type);const x=u._visualValues||(u._visualValues={});x[a]=m}}function hi(i,t){const e=i.scales;return Object.keys(e).filter(s=>e[s].axis===t).shift()}function ha(i,t){return wt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function da(i,t,e){return wt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Zt(i,t){const e=i.controller.index,s=i.vScale&&i.vScale.axis;if(s){t=t||i._parsed;for(const n of t){const o=n._stacks;if(!o||o[s]===void 0||o[s][e]===void 0)return;delete o[s][e],o[s]._visualValues!==void 0&&o[s]._visualValues[e]!==void 0&&delete o[s]._visualValues[e]}}}const di=i=>i==="reset"||i==="none",ws=(i,t)=>t?i:Object.assign({},i),ua=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:jn(e,!0),values:null};class ct{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ci(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Zt(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,u,f,g)=>d==="x"?u:d==="r"?g:f,o=e.xAxisID=O(s.xAxisID,hi(t,"x")),r=e.yAxisID=O(s.yAxisID,hi(t,"y")),a=e.rAxisID=O(s.rAxisID,hi(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,r,a),h=e.vAxisID=n(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&rs(this._data,this),t._stacked&&Zt(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(A(e)){const n=this._cachedMeta;this._data=ra(e,n)}else if(s!==e){if(s){rs(s,this);const n=this._cachedMeta;Zt(n),n._parsed=[]}e&&Object.isExtensible(e)&&Zo(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,s=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=ci(e.vScale,e),e.stack!==s.stack&&(n=!0,Zt(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Ms(this,e._parsed),e._stacked=ci(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:r}=s,a=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,d,u;if(this._parsing===!1)s._parsed=n,s._sorted=!0,u=n;else{W(n[t])?u=this.parseArrayData(s,n,t,e):A(n[t])?u=this.parseObjectData(s,n,t,e):u=this.parsePrimitiveData(s,n,t,e);const f=()=>d[a]===null||c&&d[a]<c[a];for(h=0;h<e;++h)s._parsed[h+t]=d=u[h],l&&(f()&&(l=!1),c=d);s._sorted=l}r&&Ms(this,u)}parsePrimitiveData(t,e,s,n){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),h=o===r,d=new Array(n);let u,f,g;for(u=0,f=n;u<f;++u)g=u+s,d[u]={[a]:h||o.parse(c[g],g),[l]:r.parse(e[g],g)};return d}parseArrayData(t,e,s,n){const{xScale:o,yScale:r}=t,a=new Array(n);let l,c,h,d;for(l=0,c=n;l<c;++l)h=l+s,d=e[h],a[l]={x:o.parse(d[0],h),y:r.parse(d[1],h)};return a}parseObjectData(t,e,s,n){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(n);let h,d,u,f;for(h=0,d=n;h<d;++h)u=h+s,f=e[u],c[h]={x:o.parse(kt(f,a),u),y:r.parse(kt(f,l),u)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,s){const n=this.chart,o=this._cachedMeta,r=e[t.axis],a={keys:jn(n,!0),values:e._stacks[t.axis]._visualValues};return vs(a,r,o.index,{mode:s})}updateRangeFromParsed(t,e,s,n){const o=s[e.axis];let r=o===null?NaN:o;const a=n&&s._stacks[e.axis];n&&a&&(n.values=a,r=vs(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,e){const s=this._cachedMeta,n=s._parsed,o=s._sorted&&t===s.iScale,r=n.length,a=this._getOtherScale(t),l=ua(e,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=la(a);let u,f;function g(){f=n[u];const p=f[a.axis];return!$(f[t.axis])||h>p||d<p}for(u=0;u<r&&!(!g()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=r-1;u>=0;--u)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,r;for(n=0,o=e.length;n<o;++n)r=e[n][t.axis],$(r)&&s.push(r);return s}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,s=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:s?""+s.getLabelForValue(o[s.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=oa(O(this.options.clip,na(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,s=this._cachedMeta,n=s.data||[],o=e.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||n.length-a,c=this.options.drawActiveElementsOnTop;let h;for(s.dataset&&s.dataset.draw(t,o,a,l),h=a;h<a+l;++h){const d=n[h];d.hidden||(d.active&&c?r.push(d):d.draw(t,o))}for(h=0;h<r.length;++h)r[h].draw(t,o)}getStyle(t,e){const s=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,e,s){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=da(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=ha(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=s,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",s){const n=e==="active",o=this._cachedDataOpts,r=t+"-"+e,a=o[r],l=this.enableOptionSharing&&me(s);if(a)return ws(a,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),d=n?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),h),f=Object.keys(V.elements[t]),g=()=>this.getContext(s,n,e),p=c.resolveNamedOptions(u,f,g,d);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(ws(p,l))),p}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,s,e))}const c=new Nn(n,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||di(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),r=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:r}}updateElement(t,e,s,n){di(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!di(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,s,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,s=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const n=s.length,o=e.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,s=!0){const n=this._cachedMeta,o=n.data,r=t+e;let a;const l=c=>{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(n._parsed),this.parse(t,e),s&&this.updateElements(o,t,e,"reset")}updateElements(t,e,s,n){}_removeElements(t,e){const s=this._cachedMeta;if(this._parsing){const n=s._parsed.splice(t,e);s._stacked&&Zt(s,n)}s.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,s,n]=t;this[e](s,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}k(ct,"defaults",{}),k(ct,"datasetElementType",null),k(ct,"dataElementType",null);function fa(i,t){if(!i._cache.$bar){const e=i.getMatchingVisibleMetas(t);let s=[];for(let n=0,o=e.length;n<o;n++)s=s.concat(e[n].controller.getAllParsedValues(i));i._cache.$bar=Mn(s.sort((n,o)=>n-o))}return i._cache.$bar}function ga(i){const t=i.iScale,e=fa(t,i.type);let s=t._length,n,o,r,a;const l=()=>{r===32767||r===-32768||(me(a)&&(s=Math.min(s,Math.abs(r-a)||s)),a=r)};for(n=0,o=e.length;n<o;++n)r=t.getPixelForValue(e[n]),l();for(a=void 0,n=0,o=t.ticks.length;n<o;++n)r=t.getPixelForTick(n),l();return s}function pa(i,t,e,s){const n=e.barThickness;let o,r;return L(n)?(o=t.min*e.categoryPercentage,r=e.barPercentage):(o=n*s,r=1),{chunk:o/s,ratio:r,start:t.pixels[i]-o/2}}function ma(i,t,e,s){const n=t.pixels,o=n[i];let r=i>0?n[i-1]:null,a=i<n.length-1?n[i+1]:null;const l=e.categoryPercentage;r===null&&(r=o-(a===null?t.end-t.start:a-o)),a===null&&(a=o+o-r);const c=o-(o-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/s,ratio:e.barPercentage,start:c}}function ba(i,t,e,s){const n=e.parse(i[0],s),o=e.parse(i[1],s),r=Math.min(n,o),a=Math.max(n,o);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:r,max:a}}function $n(i,t,e,s){return W(i)?ba(i,t,e,s):t[e.axis]=e.parse(i,s),t}function Ss(i,t,e,s){const n=i.iScale,o=i.vScale,r=n.getLabels(),a=n===o,l=[];let c,h,d,u;for(c=e,h=e+s;c<h;++c)u=t[c],d={},d[n.axis]=a||n.parse(r[c],c),l.push($n(u,d,o,c));return l}function ui(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function xa(i,t,e){return i!==0?lt(i):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function _a(i){let t,e,s,n,o;return i.horizontal?(t=i.base>i.x,e="left",s="right"):(t=i.base<i.y,e="bottom",s="top"),t?(n="end",o="start"):(n="start",o="end"),{start:e,end:s,reverse:t,top:n,bottom:o}}function ya(i,t,e,s){let n=t.borderSkipped;const o={};if(!n){i.borderSkipped=o;return}if(n===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:r,end:a,reverse:l,top:c,bottom:h}=_a(i);n==="middle"&&e&&(i.enableBorderRadius=!0,(e._top||0)===s?n=c:(e._bottom||0)===s?n=h:(o[Ps(h,r,a,l)]=!0,n=c)),o[Ps(n,r,a,l)]=!0,i.borderSkipped=o}function Ps(i,t,e,s){return s?(i=va(i,t,e),i=Cs(i,e,t)):i=Cs(i,t,e),i}function va(i,t,e){return i===t?e:i===e?t:i}function Cs(i,t,e){return i==="start"?t:i==="end"?e:i}function ka(i,{inflateAmount:t},e){i.inflateAmount=t==="auto"?e===1?.33:0:t}class ze extends ct{parsePrimitiveData(t,e,s,n){return Ss(t,e,s,n)}parseArrayData(t,e,s,n){return Ss(t,e,s,n)}parseObjectData(t,e,s,n){const{iScale:o,vScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?a:l,h=r.axis==="x"?a:l,d=[];let u,f,g,p;for(u=s,f=s+n;u<f;++u)p=e[u],g={},g[o.axis]=o.parse(kt(p,c),u),d.push($n(kt(p,h),g,r,u));return d}updateRangeFromParsed(t,e,s,n){super.updateRangeFromParsed(t,e,s,n);const o=s._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:s,vScale:n}=e,o=this.getParsed(t),r=o._custom,a=ui(r)?"["+r.start+", "+r.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+s.getLabelForValue(o[s.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,s,n){const o=n==="reset",{index:r,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),h=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,n);for(let f=e;f<e+s;f++){const g=this.getParsed(f),p=o||L(g[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),m=this._calculateBarIndexPixels(f,h),b=(g._stacks||{})[a.axis],x={horizontal:c,base:p.base,enableBorderRadius:!b||ui(g._custom)||r===b._top||r===b._bottom,x:c?p.head:m.center,y:c?m.center:p.head,height:c?m.size:Math.abs(p.size),width:c?Math.abs(p.size):m.size};u&&(x.options=d||this.resolveDataElementOptions(f,t[f].active?"active":n));const y=x.options||t[f].options;ya(x,y,b,r),ka(x,y,h.ratio),this.updateElement(t[f],f,x,n)}}_getStacks(t,e){const{iScale:s}=this._cachedMeta,n=s.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=s.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),l=a&&a[s.axis],c=h=>{const d=h._parsed.find(f=>f[s.axis]===l),u=d&&d[h.vScale.axis];if(L(u)||isNaN(u))return!0};for(const h of n)if(!(e!==void 0&&c(h))&&((o===!1||r.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&r.push(h.stack),h.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,s){const n=this._getStacks(t,s),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,n=[];let o,r;for(o=0,r=e.data.length;o<r;++o)n.push(s.getPixelForValue(this.getParsed(o)[s.axis],o));const a=t.barThickness;return{min:a||ga(e),pixels:n,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:s,index:n},options:{base:o,minBarLength:r}}=this,a=o||0,l=this.getParsed(t),c=l._custom,h=ui(c);let d=l[e.axis],u=0,f=s?this.applyStack(e,l,s):d,g,p;f!==d&&(u=f-d,f=d),h&&(d=c.barStart,f=c.barEnd-c.barStart,d!==0&&lt(d)!==lt(c.barEnd)&&(u=0),u+=d);const m=!L(o)&&!h?o:u;let b=e.getPixelForValue(m);if(this.chart.getDataVisibility(t)?g=e.getPixelForValue(u+f):g=b,p=g-b,Math.abs(p)<r){p=xa(p,e,a)*r,d===a&&(b-=p/2);const x=e.getPixelForDecimal(0),y=e.getPixelForDecimal(1),v=Math.min(x,y),_=Math.max(x,y);b=Math.max(Math.min(b,_),v),g=b+p,s&&!h&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(g)-e.getValueForPixel(b))}if(b===e.getPixelForValue(a)){const x=lt(p)*e.getLineWidthForValue(a)/2;b+=x,p-=x}return{size:p,base:b,head:g,center:g+p/2}}_calculateBarIndexPixels(t,e){const s=e.scale,n=this.options,o=n.skipNull,r=O(n.maxBarThickness,1/0);let a,l;if(e.grouped){const c=o?this._getStackCount(t):e.stackCount,h=n.barThickness==="flex"?ma(t,e,n,c):pa(t,e,n,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);a=h.start+h.chunk*d+h.chunk/2,l=Math.min(r,h.chunk*h.ratio)}else a=s.getPixelForValue(this.getParsed(t)[s.axis],t),l=Math.min(r,e.min*e.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,s=t.data,n=s.length;let o=0;for(;o<n;++o)this.getParsed(o)[e.axis]!==null&&!s[o].hidden&&s[o].draw(this._ctx)}}k(ze,"id","bar"),k(ze,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),k(ze,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function Ma(i,t,e){let s=1,n=1,o=0,r=0;if(t<I){const a=i,l=a+t,c=Math.cos(a),h=Math.sin(a),d=Math.cos(l),u=Math.sin(l),f=(y,v,_)=>be(y,a,l,!0)?1:Math.max(v,v*e,_,_*e),g=(y,v,_)=>be(y,a,l,!0)?-1:Math.min(v,v*e,_,_*e),p=f(0,c,d),m=f(N,h,u),b=g(z,c,d),x=g(z+N,h,u);s=(p-b)/2,n=(m-x)/2,o=-(p+b)/2,r=-(m+x)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:r}}class oe extends ct{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const s=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=s;else{let o=l=>+s[l];if(A(s[t])){const{key:l="value"}=this._parsing;o=c=>+kt(s[c],l)}let r,a;for(r=t,a=t+e;r<a;++r)n._parsed[r]=o(r)}}_getRotation(){return st(this.options.rotation-90)}_getCircumference(){return st(this.options.circumference)}_getRotationExtents(){let t=I,e=-I;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){const n=this.chart.getDatasetMeta(s).controller,o=n._getRotation(),r=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+r)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:s}=e,n=this._cachedMeta,o=n.data,r=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,a=Math.max((Math.min(s.width,s.height)-r)/2,0),l=Math.min(Io(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:g,offsetY:p}=Ma(d,h,l),m=(s.width-r)/u,b=(s.height-r)/f,x=Math.max(Math.min(m,b)/2,0),y=_n(this.options.radius,x),v=Math.max(y*l,0),_=(y-v)/this._getVisibleDatasetWeightTotal();this.offsetX=g*y,this.offsetY=p*y,n.total=this.calculateTotal(),this.outerRadius=y-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const s=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&s.animation.animateRotate||!this.chart.getDataVisibility(t)||n._parsed[t]===null||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/I)}updateElements(t,e,s,n){const o=n==="reset",r=this.chart,a=r.chartArea,c=r.options.animation,h=(a.left+a.right)/2,d=(a.top+a.bottom)/2,u=o&&c.animateScale,f=u?0:this.innerRadius,g=u?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(e,n);let b=this._getRotation(),x;for(x=0;x<e;++x)b+=this._circumference(x,o);for(x=e;x<e+s;++x){const y=this._circumference(x,o),v=t[x],_={x:h+this.offsetX,y:d+this.offsetY,startAngle:b,endAngle:b+y,circumference:y,outerRadius:g,innerRadius:f};m&&(_.options=p||this.resolveDataElementOptions(x,v.active?"active":n)),b+=y,this.updateElement(v,x,_,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let s=0,n;for(n=0;n<e.length;n++){const o=t._parsed[n];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(n)&&!e[n].hidden&&(s+=Math.abs(o))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?I*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=ti(e._parsed[t],s.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const s=this.chart;let n,o,r,a,l;if(!t){for(n=0,o=s.data.datasets.length;n<o;++n)if(s.isDatasetVisible(n)){r=s.getDatasetMeta(n),t=r.data,a=r.controller;break}}if(!t)return 0;for(n=0,o=t.length;n<o;++n)l=a.resolveDataElementOptions(n),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let s=0,n=t.length;s<n;++s){const o=this.resolveDataElementOptions(s);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let s=0;s<t;++s)this.chart.isDatasetVisible(s)&&(e+=this._getRingWeight(s));return e}_getRingWeight(t){return Math.max(O(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}k(oe,"id","doughnut"),k(oe,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),k(oe,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),k(oe,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:s,color:n}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}}});class Be extends ct{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:s,data:n=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=Pn(e,n,r);this._drawStart=a,this._drawCount=l,Cn(e)&&(a=0,l=n.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!o._decimated,s.points=n;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(s,void 0,{animated:!r,options:c},t),this.updateElements(n,a,l,t)}updateElements(t,e,s,n){const o=n==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n),u=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=$t(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||n==="none",x=e+s,y=t.length;let v=e>0&&this.getParsed(e-1);for(let _=0;_<y;++_){const M=t[_],w=b?M:{};if(_<e||_>=x){w.skip=!0;continue}const S=this.getParsed(_),P=L(S[f]),C=w[u]=r.getPixelForValue(S[u],_),D=w[f]=o||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,S,l):S[f],_);w.skip=isNaN(C)||isNaN(D)||P,w.stop=_>0&&Math.abs(S[u]-v[u])>m,p&&(w.parsed=S,w.raw=c.data[_]),d&&(w.options=h||this.resolveDataElementOptions(_,M.active?"active":n)),b||this.updateElement(M,_,w,n),v=S}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}k(Be,"id","line"),k(Be,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),k(Be,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class We extends ct{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=ti(e._parsed[t].r,s.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,s,n){return Fn.bind(this)(t,e,s,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((s,n)=>{const o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(o<e.min&&(e.min=o),o>e.max&&(e.max=o))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,s=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),r=Math.max(s.cutoutPercentage?o/100*s.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,s,n){const o=n==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,h=c.xCenter,d=c.yCenter,u=c.getIndexAngle(0)-.5*z;let f=u,g;const p=360/this.countVisibleElements();for(g=0;g<e;++g)f+=this._computeAngle(g,n,p);for(g=e;g<e+s;g++){const m=t[g];let b=f,x=f+this._computeAngle(g,n,p),y=r.getDataVisibility(g)?c.getDistanceFromCenterForValue(this.getParsed(g).r):0;f=x,o&&(l.animateScale&&(y=0),l.animateRotate&&(b=x=u));const v={x:h,y:d,innerRadius:0,outerRadius:y,startAngle:b,endAngle:x,options:this.resolveDataElementOptions(g,m.active?"active":n)};this.updateElement(m,g,v,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((s,n)=>{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&e++}),e}_computeAngle(t,e,s){return this.chart.getDataVisibility(t)?st(this.resolveDataElementOptions(t,e).angle||s):0}}k(We,"id","polarArea"),k(We,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),k(We,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:s,color:n}}=t.legend.options;return e.labels.map((o,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class wi extends oe{}k(wi,"id","pie"),k(wi,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class Ve extends ct{getLabelAndValue(t){const e=this._cachedMeta.vScale,s=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(s[e.axis])}}parseObjectData(t,e,s,n){return Fn.bind(this)(t,e,s,n)}update(t){const e=this._cachedMeta,s=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(s.points=n,t!=="resize"){const r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);const a={_loop:!0,_fullLoop:o.length===n.length,options:r};this.updateElement(s,void 0,a,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,s,n){const o=this._cachedMeta.rScale,r=n==="reset";for(let a=e;a<e+s;a++){const l=t[a],c=this.resolveDataElementOptions(a,l.active?"active":n),h=o.getPointPositionForValue(a,this.getParsed(a).r),d=r?o.xCenter:h.x,u=r?o.yCenter:h.y,f={x:d,y:u,angle:h.angle,skip:isNaN(d)||isNaN(u),options:c};this.updateElement(l,a,f,n)}}}k(Ve,"id","radar"),k(Ve,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),k(Ve,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class He extends ct{getLabelAndValue(t){const e=this._cachedMeta,s=this.chart.data.labels||[],{xScale:n,yScale:o}=e,r=this.getParsed(t),a=n.getLabelForValue(r.x),l=o.getLabelForValue(r.y);return{label:s[t]||"",value:"("+a+", "+l+")"}}update(t){const e=this._cachedMeta,{data:s=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:r}=Pn(e,s,n);if(this._drawStart=o,this._drawCount=r,Cn(e)&&(o=0,r=s.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:l}=e;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!l._decimated,a.points=s;const c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(a,void 0,{animated:!n,options:c},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(s,o,r,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,s,n){const o=n==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,h=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(h),u=this.includeOptions(n,d),f=r.axis,g=a.axis,{spanGaps:p,segment:m}=this.options,b=$t(p)?p:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||n==="none";let y=e>0&&this.getParsed(e-1);for(let v=e;v<e+s;++v){const _=t[v],M=this.getParsed(v),w=x?_:{},S=L(M[g]),P=w[f]=r.getPixelForValue(M[f],v),C=w[g]=o||S?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,M,l):M[g],v);w.skip=isNaN(P)||isNaN(C)||S,w.stop=v>0&&Math.abs(M[f]-y[f])>b,m&&(w.parsed=M,w.raw=c.data[v]),u&&(w.options=d||this.resolveDataElementOptions(v,_.active?"active":n)),x||this.updateElement(_,v,w,n),y=M}this.updateSharedOptions(d,n,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const s=t.dataset,n=s.options&&s.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,r)/2}}k(He,"id","scatter"),k(He,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),k(He,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});function Ot(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class qi{constructor(t){k(this,"options");this.options=t||{}}static override(t){Object.assign(qi.prototype,t)}init(){}formats(){return Ot()}parse(){return Ot()}format(){return Ot()}add(){return Ot()}diff(){return Ot()}startOf(){return Ot()}endOf(){return Ot()}}var wa={_date:qi};function Sa(i,t,e,s){const{controller:n,data:o,_sorted:r}=i,a=n._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?qo:Lt;if(s){if(n._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const d=l(o,t,e-h),u=l(o,t,e+h);return{lo:d.lo,hi:u.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function ve(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:h}=o[a],{lo:d,hi:u}=Sa(o[a],t,r,n);for(let f=d;f<=u;++f){const g=h[f];g.skip||s(g,c,f)}}}function Pa(i){const t=i.indexOf("x")!==-1,e=i.indexOf("y")!==-1;return function(s,n){const o=t?Math.abs(s.x-n.x):0,r=e?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function fi(i,t,e,s,n){const o=[];return!n&&!i.isPointInArea(t)||ve(i,e,t,function(a,l,c){!n&&!pt(a,i.chartArea,0)||a.inRange(t.x,t.y,s)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function Ca(i,t,e,s){let n=[];function o(r,a,l){const{startAngle:c,endAngle:h}=r.getProps(["startAngle","endAngle"],s),{angle:d}=vn(r,{x:t.x,y:t.y});be(d,c,h)&&n.push({element:r,datasetIndex:a,index:l})}return ve(i,e,t,o),n}function Da(i,t,e,s,n,o){let r=[];const a=Pa(e);let l=Number.POSITIVE_INFINITY;function c(h,d,u){const f=h.inRange(t.x,t.y,n);if(s&&!f)return;const g=h.getCenterPoint(n);if(!(!!o||i.isPointInArea(g))&&!f)return;const m=a(t,g);m<l?(r=[{element:h,datasetIndex:d,index:u}],l=m):m===l&&r.push({element:h,datasetIndex:d,index:u})}return ve(i,e,t,c),r}function gi(i,t,e,s,n,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!s?Ca(i,t,e,n):Da(i,t,e,s,n,o)}function Ds(i,t,e,s,n){const o=[],r=e==="x"?"inXRange":"inYRange";let a=!1;return ve(i,e,t,(l,c,h)=>{l[r]&&l[r](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,n))}),s&&!a?[]:o}var Oa={evaluateInteractionItems:ve,modes:{index(i,t,e,s){const n=At(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?fi(i,n,o,s,r):gi(i,n,o,!1,s,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=At(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?fi(i,n,o,s,r):gi(i,n,o,!1,s,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;h<c.length;++h)a.push({element:c[h],datasetIndex:l,index:h})}return a},point(i,t,e,s){const n=At(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return fi(i,n,o,s,r)},nearest(i,t,e,s){const n=At(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return gi(i,n,o,e.intersect,s,r)},x(i,t,e,s){const n=At(t,i);return Ds(i,n,"x",e.intersect,s)},y(i,t,e,s){const n=At(t,i);return Ds(i,n,"y",e.intersect,s)}}};const Yn=["left","top","right","bottom"];function Jt(i,t){return i.filter(e=>e.pos===t)}function Os(i,t){return i.filter(e=>Yn.indexOf(e.pos)===-1&&e.box.axis===t)}function Qt(i,t){return i.sort((e,s)=>{const n=t?s:e,o=t?e:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Aa(i){const t=[];let e,s,n,o,r,a;for(e=0,s=(i||[]).length;e<s;++e)n=i[e],{position:o,options:{stack:r,stackWeight:a=1}}=n,t.push({index:e,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:r&&o+r,stackWeight:a});return t}function Ta(i){const t={};for(const e of i){const{stack:s,pos:n,stackWeight:o}=e;if(!s||!Yn.includes(n))continue;const r=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function La(i,t){const e=Ta(i),{vBoxMaxWidth:s,hBoxMaxHeight:n}=t;let o,r,a;for(o=0,r=i.length;o<r;++o){a=i[o];const{fullSize:l}=a.box,c=e[a.stack],h=c&&a.stackWeight/c.weight;a.horizontal?(a.width=h?h*s:l&&t.availableWidth,a.height=n):(a.width=s,a.height=h?h*n:l&&t.availableHeight)}return e}function Ra(i){const t=Aa(i),e=Qt(t.filter(c=>c.box.fullSize),!0),s=Qt(Jt(t,"left"),!0),n=Qt(Jt(t,"right")),o=Qt(Jt(t,"top"),!0),r=Qt(Jt(t,"bottom")),a=Os(t,"x"),l=Os(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:Jt(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function As(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function Xn(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function Ea(i,t,e,s){const{pos:n,box:o}=e,r=i.maxPadding;if(!A(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&Xn(r,o.getPadding());const a=Math.max(0,t.outerWidth-As(r,i,"left","right")),l=Math.max(0,t.outerHeight-As(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Fa(i){const t=i.maxPadding;function e(s){const n=Math.max(t[s]-i[s],0);return i[s]+=n,n}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function Ia(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return s(i?["left","right"]:["top","bottom"])}function re(i,t,e,s){const n=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o<r;++o){a=i[o],l=a.box,l.update(a.width||t.w,a.height||t.h,Ia(a.horizontal,t));const{same:d,other:u}=Ea(t,e,a,s);c|=d&&n.length,h=h||u,l.fullSize||n.push(a)}return c&&re(n,t,e,s)||h}function Ae(i,t,e,s,n){i.top=e,i.left=t,i.right=t+s,i.bottom=e+n,i.width=s,i.height=n}function Ts(i,t,e,s){const n=e.padding;let{x:o,y:r}=t;for(const a of i){const l=a.box,c=s[a.stack]||{count:1,placed:0,weight:1},h=a.stackWeight/c.weight||1;if(a.horizontal){const d=t.w*h,u=c.size||l.height;me(c.start)&&(r=c.start),l.fullSize?Ae(l,n.left,r,e.outerWidth-n.right-n.left,u):Ae(l,t.left+c.placed,r,d,u),c.start=r,c.placed+=d,r=l.bottom}else{const d=t.h*h,u=c.size||l.width;me(c.start)&&(o=c.start),l.fullSize?Ae(l,o,n.top,u,e.outerHeight-n.bottom-n.top):Ae(l,o,t.top+c.placed,u,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=r}var et={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){const e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,s){if(!i)return;const n=q(i.options.layout.padding),o=Math.max(t-n.width,0),r=Math.max(e-n.height,0),a=Ra(i.boxes),l=a.vertical,c=a.horizontal;R(i.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},n);Xn(u,q(s));const f=Object.assign({maxPadding:u,w:o,h:r,x:n.left,y:n.top},n),g=La(l.concat(c),d);re(a.fullSize,f,d,g),re(l,f,d,g),re(c,f,d,g)&&re(l,f,d,g),Fa(f),Ts(a.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,Ts(a.rightAndBottom,f,d,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},R(a.chartArea,p=>{const m=p.box;Object.assign(m,i.chartArea),m.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Un{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,n){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):s)}}isAttached(t){return!0}updateConfig(t){}}class za extends Un{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ne="$chartjs",Ba={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ls=i=>i===null||i==="";function Wa(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Ne]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ls(n)){const o=ps(i,"width");o!==void 0&&(i.width=o)}if(Ls(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=ps(i,"height");o!==void 0&&(i.height=o)}return i}const Kn=Nr?{passive:!0}:!1;function Va(i,t,e){i&&i.addEventListener(t,e,Kn)}function Ha(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Kn)}function Na(i,t){const e=Ba[i.type]||i.type,{x:s,y:n}=At(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function Ze(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function ja(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ze(a.addedNodes,s),r=r&&!Ze(a.removedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function $a(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ze(a.removedNodes,s),r=r&&!Ze(a.addedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const _e=new Map;let Rs=0;function qn(){const i=window.devicePixelRatio;i!==Rs&&(Rs=i,_e.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Ya(i,t){_e.size||window.addEventListener("resize",qn),_e.set(i,t)}function Xa(i){_e.delete(i),_e.size||window.removeEventListener("resize",qn)}function Ua(i,t,e){const s=i.canvas,n=s&&Ki(s);if(!n)return;const o=Sn((a,l)=>{const c=n.clientWidth;e(a,l),c<n.clientWidth&&e()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(n),Ya(i,o),r}function pi(i,t,e){e&&e.disconnect(),t==="resize"&&Xa(i)}function Ka(i,t,e){const s=i.canvas,n=Sn(o=>{i.ctx!==null&&e(Na(o,i))},i);return Va(s,t,n),n}class qa extends Un{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(Wa(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Ne])return!1;const s=e[Ne].initial;["height","width"].forEach(o=>{const r=s[o];L(r)?e.removeAttribute(o):e.setAttribute(o,r)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Ne],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:ja,detach:$a,resize:Ua}[e]||Ka;n[e]=r(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:pi,detach:pi,resize:pi}[e]||Ha)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return Hr(t,e,s,n)}isAttached(t){const e=t&&Ki(t);return!!(e&&e.isConnected)}}function Ga(i){return!Ui()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?za:qa}class nt{constructor(){k(this,"x");k(this,"y");k(this,"active",!1);k(this,"options");k(this,"$animations")}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return $t(this.x)&&$t(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const n={};return t.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}}k(nt,"defaults",{}),k(nt,"defaultRoutes");function Za(i,t){const e=i.options.ticks,s=Ja(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?tl(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return el(t,c,o,r/n),c;const h=Qa(o,t,n);if(r>0){let d,u;const f=r>1?Math.round((l-a)/(r-1)):null;for(Te(t,c,h,L(f)?0:a-f,a),d=0,u=r-1;d<u;d++)Te(t,c,h,o[d],o[d+1]);return Te(t,c,h,l,L(f)?t.length:l+f),c}return Te(t,c,h),c}function Ja(i){const t=i.options.offset,e=i._tickSize(),s=i._length/e+(t?0:1),n=i._maxLength/e;return Math.floor(Math.min(s,n))}function Qa(i,t,e){const s=il(i),n=t.length/e;if(!s)return Math.max(n,1);const o=$o(s);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>n)return l}return Math.max(n,1)}function tl(i){const t=[];let e,s;for(e=0,s=i.length;e<s;e++)i[e].major&&t.push(e);return t}function el(i,t,e,s){let n=0,o=e[0],r;for(s=Math.ceil(s),r=0;r<i.length;r++)r===o&&(t.push(i[r]),n++,o=e[n*s])}function Te(i,t,e,s,n){const o=O(s,0),r=Math.min(O(n,i.length),i.length);let a=0,l,c,h;for(e=Math.ceil(e),n&&(l=n-s,e=l/Math.floor(l/e)),h=o;h<0;)a++,h=Math.round(o+a*e);for(c=Math.max(o,0);c<r;c++)c===h&&(t.push(i[c]),a++,h=Math.round(o+a*e))}function il(i){const t=i.length;let e,s;if(t<2)return!1;for(s=i[0],e=1;e<t;++e)if(i[e]-i[e-1]!==s)return!1;return s}const sl=i=>i==="left"?"right":i==="right"?"left":i,Es=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Fs=(i,t)=>Math.min(t||i,i);function Is(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;o<n;o+=s)e.push(i[Math.floor(o)]);return e}function nl(i,t,e){const s=i.ticks.length,n=Math.min(t,s-1),o=i._startPixel,r=i._endPixel,a=1e-6;let l=i.getPixelForTick(n),c;if(!(e&&(s===1?c=Math.max(l-o,r-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(n-1))/2,l+=n<t?c:-c,l<o-a||l>r+a)))return l}function ol(i,t){R(i,e=>{const s=e.gc,n=s.length/2;let o;if(n>t){for(o=0;o<n;++o)delete e.data[s[o]];s.splice(0,n)}})}function te(i){return i.drawTicks?i.tickLength:0}function zs(i,t){if(!i.display)return 0;const e=j(i.font,t),s=q(i.padding);return(W(i.text)?i.text.length:1)*e.lineHeight+s.height}function rl(i,t){return wt(i,{scale:t,type:"scale"})}function al(i,t,e){return wt(i,{tick:e,index:t,type:"tick"})}function ll(i,t,e){let s=Vi(i);return(e&&t!=="right"||!e&&t==="right")&&(s=sl(s)),s}function cl(i,t,e,s){const{top:n,left:o,bottom:r,right:a,chart:l}=i,{chartArea:c,scales:h}=l;let d=0,u,f,g;const p=r-n,m=a-o;if(i.isHorizontal()){if(f=U(s,o,a),A(e)){const b=Object.keys(e)[0],x=e[b];g=h[b].getPixelForValue(x)+p-t}else e==="center"?g=(c.bottom+c.top)/2+p-t:g=Es(i,e,t);u=a-o}else{if(A(e)){const b=Object.keys(e)[0],x=e[b];f=h[b].getPixelForValue(x)-m+t}else e==="center"?f=(c.left+c.right)/2-m+t:f=Es(i,e,t);g=U(s,r,n),d=e==="left"?-N:N}return{titleX:f,titleY:g,maxWidth:u,rotation:d}}class Ut extends nt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:s,_suggestedMax:n}=this;return t=ot(t,Number.POSITIVE_INFINITY),e=ot(e,Number.NEGATIVE_INFINITY),s=ot(s,Number.POSITIVE_INFINITY),n=ot(n,Number.NEGATIVE_INFINITY),{min:ot(t,s),max:ot(e,n),minDefined:$(t),maxDefined:$(e)}}getMinMax(t){let{min:e,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),r;if(n&&o)return{min:e,max:s};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),n||(e=Math.min(e,r.min)),o||(s=Math.max(s,r.max));return e=o&&e>s?s:e,s=n&&e>s?e:s,{min:ot(e,ot(s,e)),max:ot(s,ot(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){F(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=_r(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?Is(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=Za(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,s;this.isHorizontal()?(e=this.left,s=this.right):(e=this.top,s=this.bottom,t=!t),this._startPixel=e,this._endPixel=s,this._reversePixels=t,this._length=s-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){F(this.options.afterUpdate,[this])}beforeSetDimensions(){F(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){F(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),F(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){F(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s],o.label=F(e.callback,[o.value,s,t],this)}afterTickToLabelConversion(){F(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){F(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,s=Fs(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let r=n,a,l,c;if(!this._isVisible()||!e.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=K(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/s:f/(s-1),d+6>a&&(a=f/(s-(t.offset?.5:1)),l=this.maxHeight-te(t.grid)-e.padding-zs(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),r=Bi(Math.min(Math.asin(K((h.highest.height+6)/a,-1,1)),Math.asin(K(l/c,-1,1))-Math.asin(K(u/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){F(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){F(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=zs(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=te(o)+l):(t.height=this.maxHeight,t.width=te(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=s.padding*2,g=st(this.labelRotation),p=Math.cos(g),m=Math.sin(g);if(a){const b=s.mirror?0:m*d.width+p*u.height;t.height=Math.min(this.maxHeight,t.height+b+f)}else{const b=s.mirror?0:p*d.width+m*u.height;t.width=Math.min(this.maxWidth,t.width+b+f)}this._calculatePadding(c,h,m,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,n){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,f=0;l?c?(u=n*t.width,f=s*e.height):(u=s*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+r)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+r,this.paddingBottom=d+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){F(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,s;for(e=0,s=t.length;e<s;e++)L(t[e].label)&&(t.splice(e,1),s--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let s=this.ticks;e<s.length&&(s=Is(s,e)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,s){const{ctx:n,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(e/Fs(e,s));let c=0,h=0,d,u,f,g,p,m,b,x,y,v,_;for(d=0;d<e;d+=l){if(g=t[d].label,p=this._resolveTickFontOptions(d),n.font=m=p.string,b=o[m]=o[m]||{data:{},gc:[]},x=p.lineHeight,y=v=0,!L(g)&&!W(g))y=qe(n,b.data,b.gc,y,g),v=x;else if(W(g))for(u=0,f=g.length;u<f;++u)_=g[u],!L(_)&&!W(_)&&(y=qe(n,b.data,b.gc,y,_),v+=x);r.push(y),a.push(v),c=Math.max(y,c),h=Math.max(v,h)}ol(o,e);const M=r.indexOf(c),w=a.indexOf(h),S=P=>({width:r[P]||0,height:a[P]||0});return{first:S(0),last:S(e-1),widest:S(M),highest:S(w),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Ko(this._alignToPixels?Dt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const s=e[t];return s.$context||(s.$context=al(this.getContext(),t,s))}return this.$context||(this.$context=rl(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=st(this.labelRotation),s=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*s>a*n?a/s:l/n:l*n<a*s?l/s:a/n}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,s=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=te(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(B){return Dt(s,B,p)};let x,y,v,_,M,w,S,P,C,D,T,Y;if(r==="top")x=b(this.bottom),w=this.bottom-u,P=x-m,D=b(t.top)+m,Y=t.bottom;else if(r==="bottom")x=b(this.top),D=t.top,Y=b(t.bottom)-m,w=x+m,P=this.top+u;else if(r==="left")x=b(this.right),M=this.right-u,S=x-m,C=b(t.left)+m,T=t.right;else if(r==="right")x=b(this.left),C=t.left,T=b(t.right)-m,M=x+m,S=this.left+u;else if(e==="x"){if(r==="center")x=b((t.top+t.bottom)/2+.5);else if(A(r)){const B=Object.keys(r)[0],H=r[B];x=b(this.chart.scales[B].getPixelForValue(H))}D=t.top,Y=t.bottom,w=x+m,P=w+u}else if(e==="y"){if(r==="center")x=b((t.left+t.right)/2);else if(A(r)){const B=Object.keys(r)[0],H=r[B];x=b(this.chart.scales[B].getPixelForValue(H))}M=x-m,S=M-u,C=t.left,T=t.right}const J=O(n.ticks.maxTicksLimit,d),E=Math.max(1,Math.ceil(d/J));for(y=0;y<d;y+=E){const B=this.getContext(y),H=o.setContext(B),it=a.setContext(B),X=H.lineWidth,Bt=H.color,ke=it.dash||[],Wt=it.dashOffset,qt=H.tickWidth,St=H.tickColor,Gt=H.tickBorderDash||[],Pt=H.tickBorderDashOffset;v=nl(this,y,l),v!==void 0&&(_=Dt(s,v,X),c?M=S=C=T=_:w=P=D=Y=_,f.push({tx1:M,ty1:w,tx2:S,ty2:P,x1:C,y1:D,x2:T,y2:Y,width:X,color:Bt,borderDash:ke,borderDashOffset:Wt,tickWidth:qt,tickColor:St,tickBorderDash:Gt,tickBorderDashOffset:Pt}))}return this._ticksLength=d,this._borderValue=x,f}_computeLabelItems(t){const e=this.axis,s=this.options,{position:n,ticks:o}=s,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,u=te(s.grid),f=u+h,g=d?-h:f,p=-st(this.labelRotation),m=[];let b,x,y,v,_,M,w,S,P,C,D,T,Y="middle";if(n==="top")M=this.bottom-g,w=this._getXAxisLabelAlignment();else if(n==="bottom")M=this.top+g,w=this._getXAxisLabelAlignment();else if(n==="left"){const E=this._getYAxisLabelAlignment(u);w=E.textAlign,_=E.x}else if(n==="right"){const E=this._getYAxisLabelAlignment(u);w=E.textAlign,_=E.x}else if(e==="x"){if(n==="center")M=(t.top+t.bottom)/2+f;else if(A(n)){const E=Object.keys(n)[0],B=n[E];M=this.chart.scales[E].getPixelForValue(B)+f}w=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")_=(t.left+t.right)/2-f;else if(A(n)){const E=Object.keys(n)[0],B=n[E];_=this.chart.scales[E].getPixelForValue(B)}w=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?Y="top":l==="end"&&(Y="bottom"));const J=this._getLabelSizes();for(b=0,x=a.length;b<x;++b){y=a[b],v=y.label;const E=o.setContext(this.getContext(b));S=this.getPixelForTick(b)+o.labelOffset,P=this._resolveTickFontOptions(b),C=P.lineHeight,D=W(v)?v.length:1;const B=D/2,H=E.color,it=E.textStrokeColor,X=E.textStrokeWidth;let Bt=w;r?(_=S,w==="inner"&&(b===x-1?Bt=this.options.reverse?"left":"right":b===0?Bt=this.options.reverse?"right":"left":Bt="center"),n==="top"?c==="near"||p!==0?T=-D*C+C/2:c==="center"?T=-J.highest.height/2-B*C+C:T=-J.highest.height+C/2:c==="near"||p!==0?T=C/2:c==="center"?T=J.highest.height/2-B*C:T=J.highest.height-D*C,d&&(T*=-1),p!==0&&!E.showLabelBackdrop&&(_+=C/2*Math.sin(p))):(M=S,T=(1-D)*C/2);let ke;if(E.showLabelBackdrop){const Wt=q(E.backdropPadding),qt=J.heights[b],St=J.widths[b];let Gt=T-Wt.top,Pt=0-Wt.left;switch(Y){case"middle":Gt-=qt/2;break;case"bottom":Gt-=qt;break}switch(w){case"center":Pt-=St/2;break;case"right":Pt-=St;break;case"inner":b===x-1?Pt-=St:b>0&&(Pt-=St/2);break}ke={left:Pt,top:Gt,width:St+Wt.width,height:qt+Wt.height,color:E.backdropColor}}m.push({label:v,font:P,textOffset:T,options:{rotation:p,color:H,strokeColor:it,strokeWidth:X,textAlign:Bt,textBaseline:Y,translation:[_,M],backdrop:ke}})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-st(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,h;return e==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:n,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(e.display)for(o=0,r=n.length;o<r;++o){const l=n[o];e.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:s,grid:n}}=this,o=s.setContext(this.getContext()),r=s.display?o.width:0;if(!r)return;const a=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,d,u;this.isHorizontal()?(c=Dt(t,this.left,r)-r/2,h=Dt(t,this.right,a)+a/2,d=u=l):(d=Dt(t,this.top,r)-r/2,u=Dt(t,this.bottom,a)+a/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,d),e.lineTo(h,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,n=this._computeLabelArea();n&&ei(s,n);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,h=r.textOffset;zt(s,c,0,h,l,a)}n&&ii(s)}drawTitle(){const{ctx:t,options:{position:e,title:s,reverse:n}}=this;if(!s.display)return;const o=j(s.font),r=q(s.padding),a=s.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||A(e)?(l+=r.bottom,W(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=r.top;const{titleX:c,titleY:h,maxWidth:d,rotation:u}=cl(this,l,e,a);zt(t,s.text,0,0,o,{color:s.color,maxWidth:d,rotation:u,textAlign:ll(a,e,n),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,s=O(t.grid&&t.grid.z,-1),n=O(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Ut.prototype.draw?[{z:e,draw:o=>{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,r;for(o=0,r=e.length;o<r;++o){const a=e[o];a[s]===this.id&&(!t||a.type===t)&&n.push(a)}return n}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return j(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Le{constructor(t,e,s){this.type=t,this.scope=e,this.override=s,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let s;ul(e)&&(s=this.register(e));const n=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,hl(t,r,s),this.override&&V.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const e=this.items,s=t.id,n=this.scope;s in e&&delete e[s],n&&s in V[n]&&(delete V[n][s],this.override&&delete It[s])}}function hl(i,t,e){const s=pe(Object.create(null),[e?V.get(e):{},V.get(t),i.defaults]);V.set(t,s),i.defaultRoutes&&dl(t,i.defaultRoutes),i.descriptors&&V.describe(t,i.descriptors)}function dl(i,t){Object.keys(t).forEach(e=>{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");V.route(o,n,l,a)})}function ul(i){return"id"in i&&"defaults"in i}class fl{constructor(){this.controllers=new Le(ct,"datasets",!0),this.elements=new Le(nt,"elements"),this.plugins=new Le(Object,"plugins"),this.scales=new Le(Ut,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,s){[...e].forEach(n=>{const o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):R(n,r=>{const a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,s){const n=zi(t);F(s["before"+n],[],s),e[t](s),F(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const s=this._typedRegistries[e];if(s.isForType(t))return s}return this.plugins}_get(t,e,s){const n=e.get(t);if(n===void 0)throw new Error('"'+t+'" is not a registered '+s+".");return n}}var at=new fl;class gl{constructor(){this._init=[]}notify(t,e,s,n){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),r=this._notify(o,t,e,s);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),r}_notify(t,e,s,n){n=n||{};for(const o of t){const r=o.plugin,a=r[s],l=[e,n,o.options];if(F(a,l,r)===!1&&n.cancelable)return!1}return!0}invalidate(){L(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const s=t&&t.config,n=O(s.options&&s.options.plugins,{}),o=pl(s);return n===!1&&!e?[]:bl(t,o,n,e)}_notifyStateChanges(t){const e=this._oldCache||[],s=this._cache,n=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function pl(i){const t={},e=[],s=Object.keys(at.plugins.items);for(let o=0;o<s.length;o++)e.push(at.getPlugin(s[o]));const n=i.plugins||[];for(let o=0;o<n.length;o++){const r=n[o];e.indexOf(r)===-1&&(e.push(r),t[r.id]=!0)}return{plugins:e,localIds:t}}function ml(i,t){return!t&&i===!1?null:i===!0?{}:i}function bl(i,{plugins:t,localIds:e},s,n){const o=[],r=i.getContext();for(const a of t){const l=a.id,c=ml(s[l],n);c!==null&&o.push({plugin:a,options:xl(i.config,{plugin:a,local:e[l]},c,r)})}return o}function xl(i,{plugin:t,local:e},s,n){const o=i.pluginScopeKeys(t),r=i.getOptionScopes(s,o);return e&&t.defaults&&r.push(t.defaults),i.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Si(i,t){const e=V.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function _l(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function yl(i,t){return i===t?"_index_":"_value_"}function Bs(i){if(i==="x"||i==="y"||i==="r")return i}function vl(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function Pi(i,...t){if(Bs(i))return i;for(const e of t){const s=e.axis||vl(e.position)||i.length>1&&Bs(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Ws(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function kl(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(e.length)return Ws(i,"x",e[0])||Ws(i,"y",e[0])}return{}}function Ml(i,t){const e=It[i.type]||{scales:{}},s=t.scales||{},n=Si(i.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{const a=s[r];if(!A(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=Pi(r,a,kl(r,i),V.scales[a.type]),c=yl(l,n),h=e.scales||{};o[r]=he(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||Si(a,t),h=(It[a]||{}).scales||{};Object.keys(h).forEach(d=>{const u=_l(d,l),f=r[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),he(o[f],[{axis:u},s[f],h[d]])})}),Object.keys(o).forEach(r=>{const a=o[r];he(a,[V.scales[a.type],V.scale])}),o}function Gn(i){const t=i.options||(i.options={});t.plugins=O(t.plugins,{}),t.scales=Ml(i,t)}function Zn(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function wl(i){return i=i||{},i.data=Zn(i.data),Gn(i),i}const Vs=new Map,Jn=new Set;function Re(i,t){let e=Vs.get(i);return e||(e=t(),Vs.set(i,e),Jn.add(e)),e}const ee=(i,t,e)=>{const s=kt(t,e);s!==void 0&&i.add(s)};class Sl{constructor(t){this._config=wl(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Zn(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Gn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Re(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Re(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Re(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return Re(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let n=s.get(t);return(!n||e)&&(n=new Map,s.set(t,n)),n}getOptionScopes(t,e,s){const{options:n,type:o}=this,r=this._cachedScopes(t,s),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>ee(l,t,d))),h.forEach(d=>ee(l,n,d)),h.forEach(d=>ee(l,It[o]||{},d)),h.forEach(d=>ee(l,V,d)),h.forEach(d=>ee(l,ki,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Jn.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,It[e]||{},V.datasets[e]||{},{type:e},V,ki]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Hs(this._resolverCache,t,n);let l=r;if(Cl(r,e)){o.$shared=!1,s=Mt(s)?s():s;const c=this.createResolver(t,s,a);l=Yt(r,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=Hs(this._resolverCache,t,s);return A(e)?Yt(o,e,void 0,n):o}}function Hs(i,t,e){let s=i.get(t);s||(s=new Map,i.set(t,s));const n=e.join();let o=s.get(n);return o||(o={resolver:$i(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}const Pl=i=>A(i)&&Object.getOwnPropertyNames(i).some(t=>Mt(i[t]));function Cl(i,t){const{isScriptable:e,isIndexable:s}=Tn(i);for(const n of t){const o=e(n),r=s(n),a=(r||o)&&i[n];if(o&&(Mt(a)||Pl(a))||r&&W(a))return!0}return!1}var Dl="4.4.7";const Ol=["top","bottom","left","right","chartArea"];function Ns(i,t){return i==="top"||i==="bottom"||Ol.indexOf(i)===-1&&t==="x"}function js(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function $s(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),F(e&&e.onComplete,[i],t)}function Al(i){const t=i.chart,e=t.options.animation;F(e&&e.onProgress,[i],t)}function Qn(i){return Ui()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const je={},Ys=i=>{const t=Qn(i);return Object.values(je).filter(e=>e.canvas===t).pop()};function Tl(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const r=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=r)}}}function Ll(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}function Ee(i,t,e){return i.options.clip?i[e]:t[e]}function Rl(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:Ee(e,t,"left"),right:Ee(e,t,"right"),top:Ee(s,t,"top"),bottom:Ee(s,t,"bottom")}:t}var mt;let ni=(mt=class{static register(...t){at.add(...t),Xs()}static unregister(...t){at.remove(...t),Xs()}constructor(t,e){const s=this.config=new Sl(e),n=Qn(t),o=Ys(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Ga(n)),this.platform.updateConfig(s);const a=this.platform.acquireContext(n,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=Fo(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new gl,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Jo(d=>this.update(d),r.resizeDelay||0),this._dataChanges=[],je[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}dt.listen(this,"complete",$s),dt.listen(this,"progress",Al),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return L(t)?e&&o?o:n?s/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return at}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():gs(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ds(this.canvas,this.ctx),this}stop(){return dt.stop(this),this}resize(t,e){dt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,n=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,t,e,o),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,gs(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),F(s.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};R(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=Pi(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),R(o,r=>{const a=r.options,l=a.id,c=Pi(l,a),h=O(a.type,r.dtype);(a.position===void 0||Ns(a.position,c)!==Ns(r.dposition))&&(a.position=r.dposition),n[l]=!0;let d=null;if(l in s&&s[l].type===h)d=s[l];else{const u=at.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(a,t)}),R(n,(r,a)=>{r||delete s[a]}),R(s,r=>{et.configure(this,r,r.options),et.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((n,o)=>n.index-o.index),s>e){for(let n=e;n<s;++n)this._destroyDatasetMeta(n);t.splice(e,s-e)}this._sortedMetasets=t.slice(0).sort(js("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s<n;s++){const o=e[s];let r=this.getDatasetMeta(s);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(s),r=this.getDatasetMeta(s)),r.type=a,r.indexAxis=o.indexAxis||Si(a,this.options),r.order=o.order||0,r.index=s,r.label=""+o.label,r.visible=this.isDatasetVisible(s),r.controller)r.controller.updateIndex(s),r.controller.linkScales();else{const l=at.getController(a),{datasetElementType:c,dataElementType:h}=V.datasets[a];Object.assign(l,{dataElementType:at.getElement(h),datasetElementType:c&&at.getElement(c)}),r.controller=new l(this,s),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){R(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c<h;c++){const{controller:d}=this.getDatasetMeta(c),u=!n&&o.indexOf(d)===-1;d.buildOrUpdateElements(u),r=Math.max(+d.getMaxOverflow(),r)}r=this._minPadding=s.layout.autoPadding?r:0,this._updateLayout(r),n||R(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(js("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){R(this.scales,t=>{et.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!is(e,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:n,count:o}of e){const r=s==="_removeElements"?-o:o;Tl(t,n,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=s(0);for(let o=1;o<e;o++)if(!is(n,s(o)))return;return Array.from(n).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;et.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],R(this.boxes,n=>{s&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,s=this.data.datasets.length;e<s;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,s=this.data.datasets.length;e<s;++e)this._updateDataset(e,Mt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const s=this.getDatasetMeta(t),n={meta:s,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",n)!==!1&&(s.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(dt.has(this)?this.attached&&!dt.running(this)&&dt.start(this):(this.draw(),$s({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:n}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,n)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,s=[];let n,o;for(n=0,o=e.length;n<o;++n){const r=e[n];(!t||r.visible)&&s.push(r)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s=t._clip,n=!s.disabled,o=Rl(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(n&&ei(e,{left:s.left===!1?0:o.left-s.left,right:s.right===!1?this.width:o.right+s.right,top:s.top===!1?0:o.top-s.top,bottom:s.bottom===!1?this.height:o.bottom+s.bottom}),t.controller.draw(),n&&ii(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return pt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=Oa.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},s.push(n)),n}getContext(){return this.$context||(this.$context=wt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,n);me(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),r.update(o,{visible:s}),this.update(a=>a.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),dt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),ds(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete je[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,s=(o,r)=>{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};R(this.options.events,o=>s(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),s("resize",o),s("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){R(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},R(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const n=s?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,l=t.length;a<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[n+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],s=t.map(({datasetIndex:o,index:r})=>{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Xe(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),r=o(e,t),a=s?t:o(t,e);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,n)===!1)return;const o=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,n),(o||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:n=[],options:o}=this,r=e,a=this._getActiveElements(t,n,s,r),l=Ho(t),c=Ll(t,this._lastEvent,s,l);s&&(this._lastEvent=null,F(o.onHover,[t,a,this],this),l&&F(o.onClick,[t,a,this],this));const h=!Xe(a,n);return(h||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,s,n){if(t.type==="mouseout")return[];if(!s)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}},k(mt,"defaults",V),k(mt,"instances",je),k(mt,"overrides",It),k(mt,"registry",at),k(mt,"version",Dl),k(mt,"getChart",Ys),mt);function Xs(){return R(ni.instances,i=>i._plugins.invalidate())}function El(i,t,e){const{startAngle:s,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:l}=t;let c=n/a;i.beginPath(),i.arc(o,r,a,s-c,e+c),l>n?(c=n/l,i.arc(o,r,l,e+c,s-c,!0)):i.arc(o,r,n,e+N,s-N),i.closePath(),i.clip()}function Fl(i){return ji(i,["outerStart","outerEnd","innerStart","innerEnd"])}function Il(i,t,e,s){const n=Fl(i.options.borderRadius),o=(e-t)/2,r=Math.min(o,s*t/2),a=l=>{const c=(e-Math.min(o,l))*s/2;return K(l,0,Math.min(o,c))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:K(n.innerStart,0,r),innerEnd:K(n.innerEnd,0,r)}}function Ht(i,t,e,s){return{x:e+i*Math.cos(t),y:s+i*Math.sin(t)}}function Je(i,t,e,s,n,o){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+s+e-c,0),u=h>0?h+s+e+c:0;let f=0;const g=n-l;if(s){const E=h>0?h-s:0,B=d>0?d-s:0,H=(E+B)/2,it=H!==0?g*H/(H+s):g;f=(g-it)/2}const p=Math.max(.001,g*d-e/z)/d,m=(g-p)/2,b=l+m+f,x=n-m-f,{outerStart:y,outerEnd:v,innerStart:_,innerEnd:M}=Il(t,u,d,x-b),w=d-y,S=d-v,P=b+y/w,C=x-v/S,D=u+_,T=u+M,Y=b+_/D,J=x-M/T;if(i.beginPath(),o){const E=(P+C)/2;if(i.arc(r,a,d,P,E),i.arc(r,a,d,E,C),v>0){const X=Ht(S,C,r,a);i.arc(X.x,X.y,v,C,x+N)}const B=Ht(T,x,r,a);if(i.lineTo(B.x,B.y),M>0){const X=Ht(T,J,r,a);i.arc(X.x,X.y,M,x+N,J+Math.PI)}const H=(x-M/u+(b+_/u))/2;if(i.arc(r,a,u,x-M/u,H,!0),i.arc(r,a,u,H,b+_/u,!0),_>0){const X=Ht(D,Y,r,a);i.arc(X.x,X.y,_,Y+Math.PI,b-N)}const it=Ht(w,b,r,a);if(i.lineTo(it.x,it.y),y>0){const X=Ht(w,P,r,a);i.arc(X.x,X.y,y,b-N,P)}}else{i.moveTo(r,a);const E=Math.cos(P)*d+r,B=Math.sin(P)*d+a;i.lineTo(E,B);const H=Math.cos(C)*d+r,it=Math.sin(C)*d+a;i.lineTo(H,it)}i.closePath()}function zl(i,t,e,s,n){const{fullCircles:o,startAngle:r,circumference:a}=t;let l=t.endAngle;if(o){Je(i,t,e,s,l,n);for(let c=0;c<o;++c)i.fill();isNaN(a)||(l=r+(a%I||I))}return Je(i,t,e,s,l,n),i.fill(),l}function Bl(i,t,e,s,n){const{fullCircles:o,startAngle:r,circumference:a,options:l}=t,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,f=l.borderAlign==="inner";if(!c)return;i.setLineDash(d||[]),i.lineDashOffset=u,f?(i.lineWidth=c*2,i.lineJoin=h||"round"):(i.lineWidth=c,i.lineJoin=h||"bevel");let g=t.endAngle;if(o){Je(i,t,e,s,g,n);for(let p=0;p<o;++p)i.stroke();isNaN(a)||(g=r+(a%I||I))}f&&El(i,t,g),o||(Je(i,t,e,s,g,n),i.stroke())}class ae extends nt{constructor(e){super();k(this,"circumference");k(this,"endAngle");k(this,"fullCircles");k(this,"innerRadius");k(this,"outerRadius");k(this,"pixelMargin");k(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,s,n){const o=this.getProps(["x","y"],n),{angle:r,distance:a}=vn(o,{x:e,y:s}),{startAngle:l,endAngle:c,innerRadius:h,outerRadius:d,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),f=(this.options.spacing+this.options.borderWidth)/2,g=O(u,c-l),p=be(r,l,c)&&l!==c,m=g>=I||p,b=gt(a,h+f,d+f);return m&&b}getCenterPoint(e){const{x:s,y:n,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,d=(o+r)/2,u=(a+l+h+c)/2;return{x:s+Math.cos(d)*u,y:n+Math.sin(d)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:s,circumference:n}=this,o=(s.offset||0)/4,r=(s.spacing||0)/2,a=s.circular;if(this.pixelMargin=s.borderAlign==="inner"?.33:0,this.fullCircles=n>I?Math.floor(n/I):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(z,n||0)),h=o*c;e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,zl(e,this,h,r,a),Bl(e,this,h,r,a),e.restore()}}k(ae,"id","arc"),k(ae,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),k(ae,"defaultRoutes",{backgroundColor:"backgroundColor"}),k(ae,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function to(i,t,e=t){i.lineCap=O(e.borderCapStyle,t.borderCapStyle),i.setLineDash(O(e.borderDash,t.borderDash)),i.lineDashOffset=O(e.borderDashOffset,t.borderDashOffset),i.lineJoin=O(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=O(e.borderWidth,t.borderWidth),i.strokeStyle=O(e.borderColor,t.borderColor)}function Wl(i,t,e){i.lineTo(e.x,e.y)}function Vl(i){return i.stepped?hr:i.tension||i.cubicInterpolationMode==="monotone"?dr:Wl}function eo(i,t,e={}){const s=i.length,{start:n=0,end:o=s-1}=e,{start:r,end:a}=t,l=Math.max(n,r),c=Math.min(o,a),h=n<r&&o<r||n>a&&o>a;return{count:s,start:l,loop:t.loop,ilen:c<l&&!h?s+c-l:c-l}}function Hl(i,t,e,s){const{points:n,options:o}=t,{count:r,start:a,loop:l,ilen:c}=eo(n,e,s),h=Vl(o);let{move:d=!0,reverse:u}=s||{},f,g,p;for(f=0;f<=c;++f)g=n[(a+(u?c-f:f))%r],!g.skip&&(d?(i.moveTo(g.x,g.y),d=!1):h(i,p,g,u,o.stepped),p=g);return l&&(g=n[(a+(u?c:0))%r],h(i,p,g,u,o.stepped)),!!l}function Nl(i,t,e,s){const n=t.points,{count:o,start:r,ilen:a}=eo(n,e,s),{move:l=!0,reverse:c}=s||{};let h=0,d=0,u,f,g,p,m,b;const x=v=>(r+(c?a-v:v))%o,y=()=>{p!==m&&(i.lineTo(h,m),i.lineTo(h,p),i.lineTo(h,b))};for(l&&(f=n[x(0)],i.moveTo(f.x,f.y)),u=0;u<=a;++u){if(f=n[x(u)],f.skip)continue;const v=f.x,_=f.y,M=v|0;M===g?(_<p?p=_:_>m&&(m=_),h=(d*h+v)/++d):(y(),i.lineTo(v,_),g=M,d=0,p=m=_),b=_}y()}function Ci(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Nl:Hl}function jl(i){return i.stepped?jr:i.tension||i.cubicInterpolationMode==="monotone"?$r:Tt}function $l(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),to(i,t.options),i.stroke(n)}function Yl(i,t,e,s){const{segments:n,options:o}=t,r=Ci(t);for(const a of n)to(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const Xl=typeof Path2D=="function";function Ul(i,t,e,s){Xl&&!t.options.segment?$l(i,t,e,s):Yl(i,t,e,s)}class _t extends nt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;Fr(this._points,s,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Gr(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,r=Hn(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],l=jl(s);let c,h;for(c=0,h=r.length;c<h;++c){const{start:d,end:u}=r[c],f=o[d],g=o[u];if(f===g){a.push(f);continue}const p=Math.abs((n-f[e])/(g[e]-f[e])),m=l(f,g,p,s.stepped);m[e]=t[e],a.push(m)}return a.length===1?a[0]:a}pathSegment(t,e,s){return Ci(this)(t,this,e,s)}path(t,e,s){const n=this.segments,o=Ci(this);let r=this._loop;e=e||0,s=s||this.points.length-e;for(const a of n)r&=o(t,this,a,{start:e,end:e+s-1});return!!r}draw(t,e,s,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Ul(t,this,s,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}k(_t,"id","line"),k(_t,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),k(_t,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),k(_t,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function Us(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o)<n.radius+n.hitRadius}class $e extends nt{constructor(e){super();k(this,"parsed");k(this,"skip");k(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,s,n){const o=this.options,{x:r,y:a}=this.getProps(["x","y"],n);return Math.pow(e-r,2)+Math.pow(s-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,s){return Us(this,e,"x",s)}inYRange(e,s){return Us(this,e,"y",s)}getCenterPoint(e){const{x:s,y:n}=this.getProps(["x","y"],e);return{x:s,y:n}}size(e){e=e||this.options||{};let s=e.radius||0;s=Math.max(s,s&&e.hoverRadius||0);const n=s&&e.borderWidth||0;return(s+n)*2}draw(e,s){const n=this.options;this.skip||n.radius<.1||!pt(this,s,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,Mi(e,n,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}k($e,"id","point"),k($e,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),k($e,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function io(i,t){const{x:e,y:s,base:n,width:o,height:r}=i.getProps(["x","y","base","width","height"],t);let a,l,c,h,d;return i.horizontal?(d=r/2,a=Math.min(e,n),l=Math.max(e,n),c=s-d,h=s+d):(d=o/2,a=e-d,l=e+d,c=Math.min(s,n),h=Math.max(s,n)),{left:a,top:c,right:l,bottom:h}}function yt(i,t,e,s){return i?0:K(t,e,s)}function Kl(i,t,e){const s=i.options.borderWidth,n=i.borderSkipped,o=An(s);return{t:yt(n.top,o.top,0,e),r:yt(n.right,o.right,0,t),b:yt(n.bottom,o.bottom,0,e),l:yt(n.left,o.left,0,t)}}function ql(i,t,e){const{enableBorderRadius:s}=i.getProps(["enableBorderRadius"]),n=i.options.borderRadius,o=Et(n),r=Math.min(t,e),a=i.borderSkipped,l=s||A(n);return{topLeft:yt(!l||a.top||a.left,o.topLeft,0,r),topRight:yt(!l||a.top||a.right,o.topRight,0,r),bottomLeft:yt(!l||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:yt(!l||a.bottom||a.right,o.bottomRight,0,r)}}function Gl(i){const t=io(i),e=t.right-t.left,s=t.bottom-t.top,n=Kl(i,e/2,s/2),o=ql(i,e/2,s/2);return{outer:{x:t.left,y:t.top,w:e,h:s,radius:o},inner:{x:t.left+n.l,y:t.top+n.t,w:e-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}function mi(i,t,e,s){const n=t===null,o=e===null,a=i&&!(n&&o)&&io(i,s);return a&&(n||gt(t,a.left,a.right))&&(o||gt(e,a.top,a.bottom))}function Zl(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function Jl(i,t){i.rect(t.x,t.y,t.w,t.h)}function bi(i,t,e={}){const s=i.x!==e.x?-t:0,n=i.y!==e.y?-t:0,o=(i.x+i.w!==e.x+e.w?t:0)-s,r=(i.y+i.h!==e.y+e.h?t:0)-n;return{x:i.x+s,y:i.y+n,w:i.w+o,h:i.h+r,radius:i.radius}}class Ye extends nt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:s,backgroundColor:n}}=this,{inner:o,outer:r}=Gl(this),a=Zl(r.radius)?xe:Jl;t.save(),(r.w!==o.w||r.h!==o.h)&&(t.beginPath(),a(t,bi(r,e,o)),t.clip(),a(t,bi(o,-e,r)),t.fillStyle=s,t.fill("evenodd")),t.beginPath(),a(t,bi(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,s){return mi(this,t,e,s)}inXRange(t,e){return mi(this,t,null,e)}inYRange(t,e){return mi(this,null,t,e)}getCenterPoint(t){const{x:e,y:s,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?s:(s+n)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}k(Ye,"id","bar"),k(Ye,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),k(Ye,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Ql(i,t,e){const s=i.segments,n=i.points,o=t.points,r=[];for(const a of s){let{start:l,end:c}=a;c=Gi(l,c,n);const h=Di(e,n[l],n[c],a.loop);if(!t.segments){r.push({source:a,target:h,start:n[l],end:n[c]});continue}const d=Hn(t,h);for(const u of d){const f=Di(e,o[u.start],o[u.end],u.loop),g=Vn(a,n,f);for(const p of g)r.push({source:p,target:u,start:{[e]:Ks(h,f,"start",Math.max)},end:{[e]:Ks(h,f,"end",Math.min)}})}}return r}function Di(i,t,e,s){if(s)return;let n=t[i],o=e[i];return i==="angle"&&(n=Q(n),o=Q(o)),{property:i,start:n,end:o}}function tc(i,t){const{x:e=null,y:s=null}=i||{},n=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=Gi(r,a,n);const l=n[r],c=n[a];s!==null?(o.push({x:l.x,y:s}),o.push({x:c.x,y:s})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function Gi(i,t,e){for(;t>i;t--){const s=e[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function Ks(i,t,e,s){return i&&t?s(i[e],t[e]):i?i[e]:t?t[e]:0}function so(i,t){let e=[],s=!1;return W(i)?(s=!0,e=i):e=tc(i,t),e.length?new _t({points:e,options:{tension:0},_loop:s,_fullLoop:s}):null}function qs(i){return i&&i.fill!==!1}function ec(i,t,e){let n=i[t].fill;const o=[t];let r;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!$(n))return n;if(r=i[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function ic(i,t,e){const s=rc(i);if(A(s))return isNaN(s.value)?!1:s;let n=parseFloat(s);return $(n)&&Math.floor(n)===n?sc(s[0],t,n,e):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function sc(i,t,e,s){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=s?!1:e}function nc(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:A(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function oc(i,t,e){let s;return i==="start"?s=e:i==="end"?s=t.options.reverse?t.min:t.max:A(i)?s=i.value:s=t.getBaseValue(),s}function rc(i){const t=i.options,e=t.fill;let s=O(e&&e.target,e);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function ac(i){const{scale:t,index:e,line:s}=i,n=[],o=s.segments,r=s.points,a=lc(t,e);a.push(so({x:null,y:t.bottom},s));for(let l=0;l<o.length;l++){const c=o[l];for(let h=c.start;h<=c.end;h++)cc(n,r[h],a)}return new _t({points:n,options:{}})}function lc(i,t){const e=[],s=i.getMatchingVisibleMetas("line");for(let n=0;n<s.length;n++){const o=s[n];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function cc(i,t,e){const s=[];for(let n=0;n<e.length;n++){const o=e[n],{first:r,last:a,point:l}=hc(o,t,"x");if(!(!l||r&&a)){if(r)s.unshift(l);else if(i.push(l),!a)break}}i.push(...s)}function hc(i,t,e){const s=i.interpolate(t,e);if(!s)return{};const n=s[e],o=i.segments,r=i.points;let a=!1,l=!1;for(let c=0;c<o.length;c++){const h=o[c],d=r[h.start][e],u=r[h.end][e];if(gt(n,d,u)){a=n===d,l=n===u;break}}return{first:a,last:l,point:s}}class no{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,s){const{x:n,y:o,radius:r}=this;return e=e||{start:0,end:I},t.arc(n,o,r,e.end,e.start,!0),!s.bounds}interpolate(t){const{x:e,y:s,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:s+Math.sin(o)*n,angle:o}}}function dc(i){const{chart:t,fill:e,line:s}=i;if($(e))return uc(t,e);if(e==="stack")return ac(i);if(e==="shape")return!0;const n=fc(i);return n instanceof no?n:so(n,s)}function uc(i,t){const e=i.getDatasetMeta(t);return e&&i.isDatasetVisible(t)?e.dataset:null}function fc(i){return(i.scale||{}).getPointPositionForValue?pc(i):gc(i)}function gc(i){const{scale:t={},fill:e}=i,s=nc(e,t);if($(s)){const n=t.isHorizontal();return{x:n?s:null,y:n?null:s}}return null}function pc(i){const{scale:t,fill:e}=i,s=t.options,n=t.getLabels().length,o=s.reverse?t.max:t.min,r=oc(e,t,o),a=[];if(s.grid.circular){const l=t.getPointPositionForValue(0,o);return new no({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(r)})}for(let l=0;l<n;++l)a.push(t.getPointPositionForValue(l,r));return a}function xi(i,t,e){const s=dc(t),{line:n,scale:o,axis:r}=t,a=n.options,l=a.fill,c=a.backgroundColor,{above:h=c,below:d=c}=l||{};s&&n.points.length&&(ei(i,e),mc(i,{line:n,target:s,above:h,below:d,area:e,scale:o,axis:r}),ii(i))}function mc(i,t){const{line:e,target:s,above:n,below:o,area:r,scale:a}=t,l=e._loop?"angle":t.axis;i.save(),l==="x"&&o!==n&&(Gs(i,s,r.top),Zs(i,{line:e,target:s,color:n,scale:a,property:l}),i.restore(),i.save(),Gs(i,s,r.bottom)),Zs(i,{line:e,target:s,color:o,scale:a,property:l}),i.restore()}function Gs(i,t,e){const{segments:s,points:n}=t;let o=!0,r=!1;i.beginPath();for(const a of s){const{start:l,end:c}=a,h=n[l],d=n[Gi(l,c,n)];o?(i.moveTo(h.x,h.y),o=!1):(i.lineTo(h.x,e),i.lineTo(h.x,h.y)),r=!!t.pathSegment(i,a,{move:r}),r?i.closePath():i.lineTo(d.x,e)}i.lineTo(t.first().x,e),i.closePath(),i.clip()}function Zs(i,t){const{line:e,target:s,property:n,color:o,scale:r}=t,a=Ql(e,s,n);for(const{source:l,target:c,start:h,end:d}of a){const{style:{backgroundColor:u=o}={}}=l,f=s!==!0;i.save(),i.fillStyle=u,bc(i,r,f&&Di(n,h,d)),i.beginPath();const g=!!e.pathSegment(i,l);let p;if(f){g?i.closePath():Js(i,s,d,n);const m=!!s.pathSegment(i,c,{move:g,reverse:!0});p=g&&m,p||Js(i,s,h,n)}i.closePath(),i.fill(p?"evenodd":"nonzero"),i.restore()}}function bc(i,t,e){const{top:s,bottom:n}=t.chart.chartArea,{property:o,start:r,end:a}=e||{};o==="x"&&(i.beginPath(),i.rect(r,s,a-r,n-s),i.clip())}function Js(i,t,e,s){const n=t.interpolate(e,s);n&&i.lineTo(n.x,n.y)}var xc={id:"filler",afterDatasetsUpdate(i,t,e){const s=(i.data.datasets||[]).length,n=[];let o,r,a,l;for(r=0;r<s;++r)o=i.getDatasetMeta(r),a=o.dataset,l=null,a&&a.options&&a instanceof _t&&(l={visible:i.isDatasetVisible(r),index:r,fill:ic(a,r,s),chart:i,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,n.push(l);for(r=0;r<s;++r)l=n[r],!(!l||l.fill===!1)&&(l.fill=ec(n,r,e.propagate))},beforeDraw(i,t,e){const s=e.drawTime==="beforeDraw",n=i.getSortedVisibleDatasetMetas(),o=i.chartArea;for(let r=n.length-1;r>=0;--r){const a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),s&&a.fill&&xi(i.ctx,a,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const s=i.getSortedVisibleDatasetMetas();for(let n=s.length-1;n>=0;--n){const o=s[n].$filler;qs(o)&&xi(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const s=t.meta.$filler;!qs(s)||e.drawTime!=="beforeDatasetDraw"||xi(i.ctx,s,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Qs=(i,t)=>{let{boxHeight:e=t,boxWidth:s=t}=i;return i.usePointStyle&&(e=Math.min(e,t),s=i.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:e,itemHeight:Math.max(t,e)}},_c=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class tn extends nt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=F(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(s=>t.filter(s,this.chart.data))),t.sort&&(e=e.sort((s,n)=>t.sort(s,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,n=j(s.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Qs(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,n,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,n){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+a;let d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((g,p)=>{const m=s+e/2+o.measureText(g.text).width;(p===0||c[c.length-1]+m+2*a>r)&&(d+=h,c[c.length-(p>0?0:1)]=0,f+=h,u++),l[p]={left:0,top:f,row:u,width:m,height:n},c[c.length-1]+=m+a}),d}_fitCols(t,e,s,n){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let d=a,u=0,f=0,g=0,p=0;return this.legendItems.forEach((m,b)=>{const{itemWidth:x,itemHeight:y}=yc(s,e,o,m,n);b>0&&f+y+2*a>h&&(d+=u+a,c.push({width:u,height:f}),g+=u+a,p++,u=f=0),l[b]={left:g,top:f,col:p,width:x,height:y},u=Math.max(u,x),f+=y+a}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,r=jt(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=U(s,this.left+n,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=U(s,this.left+n,this.right-this.lineWidths[a])),c.top+=this.top+t+n,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+n}else{let a=0,l=U(s,this.top+t+n,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=U(s,this.top+t+n,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+n,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;ei(t,this),this._draw(),ii(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:r}=t,a=V.color,l=jt(t.rtl,this.left,this.width),c=j(r.font),{padding:h}=r,d=c.size,u=d/2;let f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=Qs(r,d),b=function(M,w,S){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;n.save();const P=O(S.lineWidth,1);if(n.fillStyle=O(S.fillStyle,a),n.lineCap=O(S.lineCap,"butt"),n.lineDashOffset=O(S.lineDashOffset,0),n.lineJoin=O(S.lineJoin,"miter"),n.lineWidth=P,n.strokeStyle=O(S.strokeStyle,a),n.setLineDash(O(S.lineDash,[])),r.usePointStyle){const C={radius:p*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:P},D=l.xPlus(M,g/2),T=w+u;On(n,C,D,T,r.pointStyleWidth&&g)}else{const C=w+Math.max((d-p)/2,0),D=l.leftForLtr(M,g),T=Et(S.borderRadius);n.beginPath(),Object.values(T).some(Y=>Y!==0)?xe(n,{x:D,y:C,w:g,h:p,radius:T}):n.rect(D,C,g,p),n.fill(),P!==0&&n.stroke()}n.restore()},x=function(M,w,S){zt(n,S.text,M,w+m/2,c,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},y=this.isHorizontal(),v=this._computeTitleHeight();y?f={x:U(o,this.left+h,this.right-s[0]),y:this.top+h+v,line:0}:f={x:this.left+h,y:U(o,this.top+v+h,this.bottom-e[0].height),line:0},zn(this.ctx,t.textDirection);const _=m+h;this.legendItems.forEach((M,w)=>{n.strokeStyle=M.fontColor,n.fillStyle=M.fontColor;const S=n.measureText(M.text).width,P=l.textAlign(M.textAlign||(M.textAlign=r.textAlign)),C=g+u+S;let D=f.x,T=f.y;l.setWidth(this.width),y?w>0&&D+C+h>this.right&&(T=f.y+=_,f.line++,D=f.x=U(o,this.left+h,this.right-s[f.line])):w>0&&T+_>this.bottom&&(D=f.x=D+e[f.line].width+h,f.line++,T=f.y=U(o,this.top+v+h,this.bottom-e[f.line].height));const Y=l.x(D);if(b(Y,T,M),D=Qo(P,D+g+u,y?D+C:this.right,t.rtl),x(l.x(D),T,M),y)f.x+=C+h;else if(typeof M.text!="string"){const J=c.lineHeight;f.y+=oo(M,J)+h}else f.y+=_}),Bn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=j(e.font),n=q(e.padding);if(!e.display)return;const o=jt(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=s.size/2,c=n.top+l;let h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=U(t.align,d,this.right-u);else{const g=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);h=c+U(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=U(a,d,d+u);r.textAlign=o.textAlign(Vi(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=s.string,zt(r,e.text,f,h,s)}_computeTitleHeight(){const t=this.options.title,e=j(t.font),s=q(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(gt(t,this.left,this.right)&&gt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(n=o[s],gt(t,n.left,n.left+n.width)&&gt(e,n.top,n.top+n.height))return this.legendItems[s]}return null}handleEvent(t){const e=this.options;if(!Mc(t.type,e))return;const s=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const n=this._hoveredItem,o=_c(n,s);n&&!o&&F(e.onLeave,[t,n,this],this),this._hoveredItem=s,s&&!o&&F(e.onHover,[t,s,this],this)}else s&&F(e.onClick,[t,s,this],this)}}function yc(i,t,e,s,n){const o=vc(s,i,t,e),r=kc(n,s,t.lineHeight);return{itemWidth:o,itemHeight:r}}function vc(i,t,e,s){let n=i.text;return n&&typeof n!="string"&&(n=n.reduce((o,r)=>o.length>r.length?o:r)),t+e.size/2+s.measureText(n).width}function kc(i,t,e){let s=i;return typeof t.text!="string"&&(s=oo(t,e)),s}function oo(i,t){const e=i.text?i.text.length:0;return t*e}function Mc(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var wc={id:"legend",_element:tn,start(i,t,e){const s=i.legend=new tn({ctx:i.ctx,options:e,chart:i});et.configure(i,s,e),et.addBox(i,s)},stop(i){et.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;et.configure(i,s,e),s.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const s=t.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),t.hidden=!0):(n.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=q(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class ro extends nt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const n=W(s.text)?s.text.length:1;this._padding=q(s.padding);const o=n*j(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:s,bottom:n,right:o,options:r}=this,a=r.align;let l=0,c,h,d;return this.isHorizontal()?(h=U(a,s,o),d=e+t,c=o-s):(r.position==="left"?(h=s+t,d=U(a,n,e),l=z*-.5):(h=o-t,d=U(a,e,n),l=z*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=j(e.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);zt(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:Vi(e.align),textBaseline:"middle",translation:[r,a]})}}function Sc(i,t){const e=new ro({ctx:i.ctx,options:t,chart:i});et.configure(i,e,t),et.addBox(i,e),i.titleBlock=e}var Pc={id:"title",_element:ro,start(i,t,e){Sc(i,e)},stop(i){const t=i.titleBlock;et.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;et.configure(i,s,e),s.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const le={average(i){if(!i.length)return!1;let t,e,s=new Set,n=0,o=0;for(t=0,e=i.length;t<e;++t){const a=i[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();s.add(l.x),n+=l.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((a,l)=>a+l)/s.size,y:n/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,s=t.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=i.length;o<r;++o){const l=i[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=vi(t,c);h<n&&(n=h,a=l)}}if(a){const l=a.tooltipPosition();e=l.x,s=l.y}return{x:e,y:s}}};function rt(i,t){return t&&(W(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function ut(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
17
17
  `)>-1?i.split(`
18
18
  `):i}function Cc(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:i,label:r,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function en(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=j(t.bodyFont),c=j(t.titleFont),h=j(t.footerFont),d=o.length,u=n.length,f=s.length,g=q(t.padding);let p=g.height,m=0,b=s.reduce((v,_)=>v+_.before.length+_.lines.length+_.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,d&&(p+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),b){const v=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*v+(b-f)*l.lineHeight+(b-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let x=0;const y=function(v){m=Math.max(m,e.measureText(v).width+x)};return e.save(),e.font=c.string,R(i.title,y),e.font=l.string,R(i.beforeBody.concat(i.afterBody),y),x=t.displayColors?r+2+t.boxPadding:0,R(s,v=>{R(v.before,y),R(v.lines,y),R(v.after,y)}),x=0,e.font=h.string,R(i.footer,y),e.restore(),m+=g.width,{width:m,height:p}}function Dc(i,t){const{y:e,height:s}=t;return e<s/2?"top":e>i.height-s/2?"bottom":"center"}function Oc(i,t,e,s){const{x:n,width:o}=s,r=e.caretSize+e.caretPadding;if(i==="left"&&n+o+r>t.width||i==="right"&&n-o-r<0)return!0}function Ac(i,t,e,s){const{x:n,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return s==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),Oc(c,i,t,e)&&(c="center"),c}function sn(i,t,e){const s=e.yAlign||t.yAlign||Dc(i,e);return{xAlign:e.xAlign||t.xAlign||Ac(i,t,e,s),yAlign:s}}function Tc(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function Lc(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function nn(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Et(r);let g=Tc(t,a);const p=Lc(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,u)+n:a==="right"&&(g+=Math.max(d,f)+n),{x:K(g,0,s.width-t.width),y:K(p,0,s.height-t.height)}}function Fe(i,t,e){const s=q(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function on(i){return rt([],ut(i))}function Rc(i,t,e){return wt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function rn(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const ao={beforeTitle:ht,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex<s)return e[t.dataIndex]}return""},afterTitle:ht,beforeBody:ht,beforeLabel:ht,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");const e=i.formattedValue;return L(e)||(t+=e),t},labelColor(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:ht,afterBody:ht,beforeFooter:ht,footer:ht,afterFooter:ht};function G(i,t,e,s){const n=i[t].call(e,s);return typeof n>"u"?ao[t].call(e,s):n}class Oi extends nt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new Nn(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Rc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=G(s,"beforeTitle",this,t),o=G(s,"title",this,t),r=G(s,"afterTitle",this,t);let a=[];return a=rt(a,ut(n)),a=rt(a,ut(o)),a=rt(a,ut(r)),a}getBeforeBody(t,e){return on(G(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return R(t,o=>{const r={before:[],lines:[],after:[]},a=rn(s,o);rt(r.before,ut(G(a,"beforeLabel",this,o))),rt(r.lines,G(a,"label",this,o)),rt(r.after,ut(G(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(t,e){return on(G(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=G(s,"beforeFooter",this,t),o=G(s,"footer",this,t),r=G(s,"afterFooter",this,t);let a=[];return a=rt(a,ut(n)),a=rt(a,ut(o)),a=rt(a,ut(r)),a}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;l<c;++l)a.push(Cc(this.chart,e[l]));return t.filter&&(a=a.filter((h,d,u)=>t.filter(h,d,u,s))),t.itemSort&&(a=a.sort((h,d)=>t.itemSort(h,d,s))),R(a,h=>{const d=rn(t.callbacks,h);n.push(G(d,"labelColor",this,h)),o.push(G(d,"labelPointStyle",this,h)),r.push(G(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const a=le[s.position].call(this,n,this._eventPosition);r=this._createItems(s),this.title=this.getTitle(r,s),this.beforeBody=this.getBeforeBody(r,s),this.body=this.getBody(r,s),this.afterBody=this.getAfterBody(r,s),this.footer=this.getFooter(r,s);const l=this._size=en(this,s),c=Object.assign({},a,l),h=sn(this.chart,s,c),d=nn(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,n){const o=this.getCaretPosition(t,s,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,s){const{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Et(a),{x:u,y:f}=t,{width:g,height:p}=e;let m,b,x,y,v,_;return o==="center"?(v=f+p/2,n==="left"?(m=u,b=m-r,y=v+r,_=v-r):(m=u+g,b=m+r,y=v-r,_=v+r),x=m):(n==="left"?b=u+Math.max(l,h)+r:n==="right"?b=u+g-Math.max(c,d)-r:b=this.caretX,o==="top"?(y=f,v=y-r,m=b-r,x=b+r):(y=f+p,v=y+r,m=b+r,x=b-r),_=y),{x1:m,x2:b,x3:x,y1:y,y2:v,y3:_}}drawTitle(t,e,s){const n=this.title,o=n.length;let r,a,l;if(o){const c=jt(s.rtl,this.x,this.width);for(t.x=Fe(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",r=j(s.titleFont),a=s.titleSpacing,e.fillStyle=s.titleColor,e.font=r.string,l=0;l<o;++l)e.fillText(n[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=s.titleMarginBottom-a)}}_drawColorBox(t,e,s,n,o){const r=this.labelColors[s],a=this.labelPointStyles[s],{boxHeight:l,boxWidth:c}=o,h=j(o.bodyFont),d=Fe(this,"left",o),u=n.x(d),f=l<h.lineHeight?(h.lineHeight-l)/2:0,g=e.y+f;if(o.usePointStyle){const p={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=n.leftForLtr(u,c)+c/2,b=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Mi(t,p,m,b),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Mi(t,p,m,b)}else{t.lineWidth=A(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const p=n.leftForLtr(u,c),m=n.leftForLtr(n.xPlus(u,1),c-2),b=Et(r.borderRadius);Object.values(b).some(x=>x!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,xe(t,{x:p,y:g,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),xe(t,{x:m,y:g+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(m,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=s,d=j(s.bodyFont);let u=d.lineHeight,f=0;const g=jt(s.rtl,this.x,this.width),p=function(S){e.fillText(S,g.x(t.x+f),t.y+u/2),t.y+=u+o},m=g.textAlign(r);let b,x,y,v,_,M,w;for(e.textAlign=r,e.textBaseline="middle",e.font=d.string,t.x=Fe(this,m,s),e.fillStyle=s.bodyColor,R(this.beforeBody,p),f=a&&m!=="right"?r==="center"?c/2+h:c+2+h:0,v=0,M=n.length;v<M;++v){for(b=n[v],x=this.labelTextColors[v],e.fillStyle=x,R(b.before,p),y=b.lines,a&&y.length&&(this._drawColorBox(e,t,v,g,s),u=Math.max(d.lineHeight,l)),_=0,w=y.length;_<w;++_)p(y[_]),u=d.lineHeight;R(b.after,p)}f=0,u=d.lineHeight,R(this.afterBody,p),t.y-=o}drawFooter(t,e,s){const n=this.footer,o=n.length;let r,a;if(o){const l=jt(s.rtl,this.x,this.width);for(t.x=Fe(this,s.footerAlign,s),t.y+=s.footerMarginTop,e.textAlign=l.textAlign(s.footerAlign),e.textBaseline="middle",r=j(s.footerFont),e.fillStyle=s.footerColor,e.font=r.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+s.footerSpacing}}drawBackground(t,e,s,n){const{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:h}=s,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=Et(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(a+d,l),r==="top"&&this.drawCaret(t,e,s,n),e.lineTo(a+c-u,l),e.quadraticCurveTo(a+c,l,a+c,l+u),r==="center"&&o==="right"&&this.drawCaret(t,e,s,n),e.lineTo(a+c,l+h-g),e.quadraticCurveTo(a+c,l+h,a+c-g,l+h),r==="bottom"&&this.drawCaret(t,e,s,n),e.lineTo(a+f,l+h),e.quadraticCurveTo(a,l+h,a,l+h-f),r==="center"&&o==="left"&&this.drawCaret(t,e,s,n),e.lineTo(a,l+d),e.quadraticCurveTo(a,l,a+d,l),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const r=le[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=en(this,t),l=Object.assign({},r,this._size),c=sn(e,t,l),h=nn(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const r=q(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),zn(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Bn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Xe(s,n),r=this._positionChanged(n,e);(o||r)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,s),a=this._positionChanged(r,t),l=e||!Xe(r,o)||a;return l&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,s,n){const o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,r=le[o.position].call(this,t,e);return r!==!1&&(s!==r.x||n!==r.y)}}k(Oi,"positioners",le);var Ec={id:"tooltip",_element:Oi,positioners:le,afterInit(i,t,e){e&&(i.tooltip=new Oi({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:ao},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Fc=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Ic(i,t,e,s){const n=i.indexOf(t);if(n===-1)return Fc(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const zc=(i,t)=>i===null?null:K(Math.round(i),0,t);function an(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class Ai extends Ut{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const s=this.getLabels();for(const{index:n,label:o}of e)s[n]===o&&s.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(L(t))return null;const s=this.getLabels();return e=isFinite(e)&&s[e]===t?e:Ic(s,t,O(e,t),this._addedLabels),zc(e,s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:s,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),e||(n=this.getLabels().length-1)),this.min=s,this.max=n}buildTicks(){const t=this.min,e=this.max,s=this.options.offset,n=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let r=t;r<=e;r++)n.push({value:r});return n}getLabelForValue(t){return an.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}k(Ai,"id","category"),k(Ai,"defaults",{ticks:{callback:an}});function Bc(i,t){const e=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=i,f=o||1,g=h-1,{min:p,max:m}=t,b=!L(r),x=!L(a),y=!L(c),v=(m-p)/(d+1);let _=ns((m-p)/g/f)*f,M,w,S,P;if(_<1e-14&&!b&&!x)return[{value:p},{value:m}];P=Math.ceil(m/_)-Math.floor(p/_),P>g&&(_=ns(P*_/g/f)*f),L(l)||(M=Math.pow(10,l),_=Math.ceil(_*M)/M),n==="ticks"?(w=Math.floor(p/_)*_,S=Math.ceil(m/_)*_):(w=p,S=m),b&&x&&o&&Yo((a-r)/o,_/1e3)?(P=Math.round(Math.min((a-r)/_,h)),_=(a-r)/P,w=r,S=a):y?(w=b?r:w,S=x?a:S,P=c-1,_=(S-w)/P):(P=(S-w)/_,de(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const C=Math.max(os(_),os(w));M=Math.pow(10,L(l)?C:l),w=Math.round(w*M)/M,S=Math.round(S*M)/M;let D=0;for(b&&(u&&w!==r?(e.push({value:r}),w<r&&D++,de(Math.round((w+D*_)*M)/M,r,ln(r,v,i))&&D++):w<r&&D++);D<P;++D){const T=Math.round((w+D*_)*M)/M;if(x&&T>a)break;e.push({value:T})}return x&&u&&S!==a?e.length&&de(e[e.length-1].value,a,ln(a,v,i))?e[e.length-1].value=a:e.push({value:a}):(!x||S===a)&&e.push({value:S}),e}function ln(i,t,{horizontal:e,minRotation:s}){const n=st(s),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}class Ti extends Ut{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return L(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:o}=this;const r=l=>n=e?n:l,a=l=>o=s?o:l;if(t){const l=lt(n),c=lt(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(n-l)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:s}=t,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=Bc(n,o);return t.bounds==="ticks"&&Xo(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const n=(s-e)/Math.max(t.length-1,1)/2;e-=n,s+=n}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return ti(t,this.chart.options.locale,this.options.ticks.format)}}class Li extends Ti{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=$(t)?t:0,this.max=$(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=st(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}k(Li,"id","linear"),k(Li,"defaults",{ticks:{callback:Ni.formatters.numeric}});function Ri(i){const t=i.ticks;if(t.display&&i.display){const e=q(t.backdropPadding);return O(t.font&&t.font.size,V.font.size)+e.height}return 0}function Wc(i,t,e){return e=W(e)?e:[e],{w:cr(i,t.string,e),h:e.length*t.lineHeight}}function cn(i,t,e,s,n){return i===s||i===n?{start:t-e/2,end:t+e/2}:i<s||i>n?{start:t-e,end:t}:{start:t,end:t+e}}function Vc(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},e=Object.assign({},t),s=[],n=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?z/o:0;for(let l=0;l<o;l++){const c=r.setContext(i.getPointLabelContext(l));n[l]=c.padding;const h=i.getPointPosition(l,i.drawingArea+n[l],a),d=j(c.font),u=Wc(i.ctx,d,i._pointLabels[l]);s[l]=u;const f=Q(i.getIndexAngle(l)+a),g=Math.round(Bi(f)),p=cn(g,h.x,u.w,0,180),m=cn(g,h.y,u.h,90,270);Hc(e,t,f,p,m)}i.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),i._pointLabelItems=$c(i,s,n)}function Hc(i,t,e,s,n){const o=Math.abs(Math.sin(e)),r=Math.abs(Math.cos(e));let a=0,l=0;s.start<t.l?(a=(t.l-s.start)/o,i.l=Math.min(i.l,t.l-a)):s.end>t.r&&(a=(s.end-t.r)/o,i.r=Math.max(i.r,t.r+a)),n.start<t.t?(l=(t.t-n.start)/r,i.t=Math.min(i.t,t.t-l)):n.end>t.b&&(l=(n.end-t.b)/r,i.b=Math.max(i.b,t.b+l))}function Nc(i,t,e){const s=i.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=e,l=i.getPointPosition(t,s+n+r,o),c=Math.round(Bi(Q(l.angle+N))),h=Uc(l.y,a.h,c),d=Yc(c),u=Xc(l.x,a.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+a.w,bottom:h+a.h}}function jc(i,t){if(!t)return!0;const{left:e,top:s,right:n,bottom:o}=i;return!(pt({x:e,y:s},t)||pt({x:e,y:o},t)||pt({x:n,y:s},t)||pt({x:n,y:o},t))}function $c(i,t,e){const s=[],n=i._pointLabels.length,o=i.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:Ri(o)/2,additionalAngle:r?z/n:0};let c;for(let h=0;h<n;h++){l.padding=e[h],l.size=t[h];const d=Nc(i,h,l);s.push(d),a==="auto"&&(d.visible=jc(d,c),d.visible&&(c=d))}return s}function Yc(i){return i===0||i===180?"center":i<180?"left":"right"}function Xc(i,t,e){return e==="right"?i-=t:e==="center"&&(i-=t/2),i}function Uc(i,t,e){return e===90||e===270?i-=t/2:(e>270||e<90)&&(i-=t),i}function Kc(i,t,e){const{left:s,top:n,right:o,bottom:r}=e,{backdropColor:a}=t;if(!L(a)){const l=Et(t.borderRadius),c=q(t.backdropPadding);i.fillStyle=a;const h=s-c.left,d=n-c.top,u=o-s+c.width,f=r-n+c.height;Object.values(l).some(g=>g!==0)?(i.beginPath(),xe(i,{x:h,y:d,w:u,h:f,radius:l}),i.fill()):i.fillRect(h,d,u,f)}}function qc(i,t){const{ctx:e,options:{pointLabels:s}}=i;for(let n=t-1;n>=0;n--){const o=i._pointLabelItems[n];if(!o.visible)continue;const r=s.setContext(i.getPointLabelContext(n));Kc(e,r,o);const a=j(r.font),{x:l,y:c,textAlign:h}=o;zt(e,i._pointLabels[n],l,c+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function lo(i,t,e,s){const{ctx:n}=i;if(e)n.arc(i.xCenter,i.yCenter,t,0,I);else{let o=i.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let r=1;r<s;r++)o=i.getPointPosition(r,t),n.lineTo(o.x,o.y)}}function Gc(i,t,e,s,n){const o=i.ctx,r=t.circular,{color:a,lineWidth:l}=t;!r&&!s||!a||!l||e<0||(o.save(),o.strokeStyle=a,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),lo(i,e,r,s),o.closePath(),o.stroke(),o.restore())}function Zc(i,t,e){return wt(i,{label:e,index:t,type:"pointLabel"})}class ce extends Ti{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=q(Ri(this.options)/2),e=this.width=this.maxWidth-t.width,s=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+s/2+t.top),this.drawingArea=Math.floor(Math.min(e,s)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=$(t)&&!isNaN(t)?t:0,this.max=$(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Ri(this.options))}generateTickLabels(t){Ti.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,s)=>{const n=F(this.options.pointLabels.callback,[e,s],this);return n||n===0?n:""}).filter((e,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?Vc(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,s,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,s,n))}getIndexAngle(t){const e=I/(this._pointLabels.length||1),s=this.options.startAngle||0;return Q(t*e+st(s))}getDistanceFromCenterForValue(t){if(L(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(L(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const s=e[t];return Zc(this.getContext(),t,s)}}getPointPosition(t,e,s=0){const n=this.getIndexAngle(t)-N+s;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:s,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:s,right:n,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const s=this.ctx;s.save(),s.beginPath(),lo(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),s.closePath(),s.fillStyle=t,s.fill(),s.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:s,grid:n,border:o}=e,r=this._pointLabels.length;let a,l,c;if(e.pointLabels.display&&qc(this,r),n.display&&this.ticks.forEach((h,d)=>{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);const u=this.getContext(d),f=n.setContext(u),g=o.setContext(u);Gc(this,f,l,r,g)}}),s.display){for(t.save(),a=r-1;a>=0;a--){const h=s.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:u}=h;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,s=e.ticks;if(!s.display)return;const n=this.getIndexAngle(0);let o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;const c=s.setContext(this.getContext(l)),h=j(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=h.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const d=q(c.backdropPadding);t.fillRect(-r/2-d.left,-o-h.size/2-d.top,r+d.width,h.size+d.height)}zt(t,a.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}k(ce,"id","radialLinear"),k(ce,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ni.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),k(ce,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),k(ce,"descriptors",{angleLines:{_fallback:"grid"}});const oi={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Z=Object.keys(oi);function hn(i,t){return i-t}function dn(i,t){if(L(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let r=t;return typeof s=="function"&&(r=s(r)),$(r)||(r=typeof s=="string"?e.parse(r,s):e.parse(r)),r===null?null:(n&&(r=n==="week"&&($t(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,n)),+r)}function un(i,t,e,s){const n=Z.length;for(let o=Z.indexOf(i);o<n-1;++o){const r=oi[Z[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((e-t)/(a*r.size))<=s)return Z[o]}return Z[n-1]}function Jc(i,t,e,s,n){for(let o=Z.length-1;o>=Z.indexOf(e);o--){const r=Z[o];if(oi[r].common&&i._adapter.diff(n,s,r)>=t-1)return r}return Z[e?Z.indexOf(e):0]}function Qc(i){for(let t=Z.indexOf(i)+1,e=Z.length;t<e;++t)if(oi[Z[t]].common)return Z[t]}function fn(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:s,hi:n}=Wi(e,t),o=e[s]>=t?e[s]:e[n];i[o]=!0}}function th(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+n.add(a,1,s))l=e[a],l>=0&&(t[l].major=!0);return t}function gn(i,t,e){const s=[],n={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],n[a]=r,s.push({value:a,major:!1});return o===0||!e?s:th(i,s,n,e)}class Qe extends Ut{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const s=t.time||(t.time={}),n=this._adapter=new wa._date(t.adapters.date);n.init(e),he(s.displayFormats,n.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:dn(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,s=t.time.unit||"day";let{min:n,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=$(n)&&!isNaN(n)?n:+e.startOf(Date.now(),s),o=$(o)&&!isNaN(o)?o:+e.endOf(Date.now(),s)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],s=t[t.length-1]),{min:e,max:s}}buildTicks(){const t=this.options,e=t.time,s=t.ticks,n=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,r=this.max,a=Go(n,o,r);return this._unit=e.unit||(s.autoSkip?un(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Jc(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:Qc(this._unit),this.initOffsets(n),t.reverse&&a.reverse(),gn(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,s=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=K(e,0,r),s=K(s,0,r),this._offsets={start:e,end:s,factor:1/(e+1+s)}}_generate(){const t=this._adapter,e=this.min,s=this.max,n=this.options,o=n.time,r=o.unit||un(o.minUnit,e,s,this._getLabelCapacity(e)),a=O(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=$t(l)||l===!0,h={};let d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":r),t.diff(s,e,r)>1e5*a)throw new Error(e+" and "+s+" are too far apart with stepSize of "+a+" "+r);const g=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u<s;u=+t.add(u,a,r),f++)fn(h,u,g);return(u===s||n.bounds==="ticks"||f===1)&&fn(h,u,g),Object.keys(h).sort(hn).map(p=>+p)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,r=e||n[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,s,n){const o=this.options,r=o.ticks.callback;if(r)return F(r,[t,e,s],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],d=c&&a[c],u=s[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e<s;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+s)*e.factor)}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,s=this.ctx.measureText(t).width,n=st(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),r=Math.sin(n),a=this._resolveTickFontOptions(0).size;return{w:s*o+a*r,h:s*r+a*o}}_getLabelCapacity(t){const e=this.options.time,s=e.displayFormats,n=s[e.unit]||s.millisecond,o=this._tickFormatFunction(t,0,gn(this,[t],this._majorUnit),n),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e<s;++e)t=t.concat(n[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,s;if(t.length)return t;const n=this.getLabels();for(e=0,s=n.length;e<s;++e)t.push(dn(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Mn(t.sort(hn))}}k(Qe,"id","time"),k(Qe,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ie(i,t,e){let s=0,n=i.length-1,o,r,a,l;e?(t>=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=Lt(i,"pos",t)),{pos:o,time:a}=i[s],{pos:r,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=Lt(i,"time",t)),{time:o,pos:a}=i[s],{time:r,pos:l}=i[n]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class pn extends Qe{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=Ie(e,this.min),this._tableRange=Ie(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r<a;++r)c=t[r],c>=e&&c<=s&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(r=0,a=n.length;r<a;++r)h=n[r+1],l=n[r-1],c=n[r],Math.round((h+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,e=this.max;let s=super.getDataTimestamps();return(!s.includes(t)||!s.length)&&s.splice(0,0,t),(!s.includes(e)||s.length===1)&&s.push(e),s.sort((n,o)=>n-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),s=this.getLabelTimestamps();return e.length&&s.length?t=this.normalize(e.concat(s)):t=e.length?e:s,t=this._cache.all=t,t}getDecimalForValue(t){return(Ie(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Ie(this._table,s*this._tableRange+this._minPos,!0)}}k(pn,"id","timeseries"),k(pn,"defaults",Qe.defaults);const eh="_chart_j1hte_1",ih={chart:eh};ni.register(Ai,Li,ce,$e,_t,Ye,ae,Pc,Ec,wc);function sh(i){const{height:t=400,width:e=200,type:s,options:n,plugins:o,data:r,redraw:a,updateMode:l,uuid:c}=i,h=Nt.useRef(null),d=Nt.useRef(null);Nt.useEffect(()=>{d.current&&(a?(f(),setTimeout(u)):(Rt.deepEqual(d.current.data,r)||(d.current.data=r),n&&!Rt.deepEqual(d.current.options,n)&&(d.current.options=n),d.current.update(l)))},[a,l,r,n]),Nt.useEffect(()=>(u(),()=>f()),[]);const u=()=>{h.current&&(d.current=new ni(h.current,{type:s,data:r,options:n,plugins:o}))},f=()=>{d.current&&(d.current.destroy(),d.current=null)};return bt.jsxRuntimeExports.jsx("canvas",{ref:h,role:"img",height:t,width:e,"data-uuid":c,className:ih.chart,"data-testid":"float-element-chart"})}function Kt(i,t){return ni.register(t),Nt.memo(e=>bt.jsxRuntimeExports.jsx(sh,{...e,type:i}))}const nh=Kt("line",Be),oh=Kt("bar",ze),rh=Kt("pie",wi),ah=Kt("scatter",He),lh=Kt("radar",Ve),ch=Kt("polarArea",We),hh={elements:{line:{borderWidth:3}}},dh=[xc],ie=5;function se(i){const t=Math.floor(i)%Rt.COLOR_PICKER_COLOR_LIST.length;return Rt.COLOR_PICKER_COLOR_LIST[t]}const co=Nt.memo(i=>{const{chartType:t,width:e,height:s,labels:n,datasets:o,uuid:r,title:a}=i,l={labels:n,datasets:o.map((d,u)=>({...d,backgroundColor:se(u*ie)}))},c={width:e,height:s,redraw:!1,uuid:r,options:{plugins:{title:{display:!0,text:a,padding:{top:16,bottom:16},font:{size:14,weight:"normal"}},legend:{display:!0,position:"bottom"}}}};let h;if(t==="line")h=bt.jsxRuntimeExports.jsx(nh,{...c,data:l});else if(t==="bar")h=bt.jsxRuntimeExports.jsx(oh,{...c,data:l});else if(t==="pie")h=bt.jsxRuntimeExports.jsx(rh,{...c,data:l});else if(t==="radar"){const d={labels:n,datasets:o.map((u,f)=>{const g=se(f*ie+4);return{...u,fill:!0,borderColor:g,pointBackgroundColor:g,pointBorderColor:Rt.getThemeColor("white"),pointHoverBackgroundColor:Rt.getThemeColor("white"),pointHoverBorderColor:g,backgroundColor:se(f*ie)}})};h=bt.jsxRuntimeExports.jsx(lh,{...c,options:hh,plugins:dh,data:d})}else if(t==="scatter"){const d={datasets:o.map((u,f)=>({label:u.label,data:u.data.map((g,p)=>({y:g,x:Rt.parseNumber(n[p])[1]})),backgroundColor:se(f*ie)}))};h=bt.jsxRuntimeExports.jsx(ah,{...c,data:d})}else if(t==="polarArea"){const d={labels:n,datasets:o.map(u=>{const f=Array.from({length:u.data.length}).fill("").map((g,p)=>se(p*ie));return{...u,backgroundColor:f}})};h=bt.jsxRuntimeExports.jsx(ch,{...c,data:d})}else console.error("not support chart type",t);return h});co.displayName="Chart";exports.default=co;
19
- //# sourceMappingURL=Chart-BG1R3R8C.js.map
19
+ //# sourceMappingURL=Chart-BhTPyGgR.js.map