@zwbigi/ink-xy 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/.next/BUILD_ID +1 -0
  2. package/.next/app-path-routes-manifest.json +33 -0
  3. package/.next/build-manifest.json +20 -0
  4. package/.next/diagnostics/build-diagnostics.json +6 -0
  5. package/.next/diagnostics/framework.json +1 -0
  6. package/.next/export-marker.json +6 -0
  7. package/.next/images-manifest.json +68 -0
  8. package/.next/next-minimal-server.js.nft.json +1 -0
  9. package/.next/next-server.js.nft.json +1 -0
  10. package/.next/package.json +1 -0
  11. package/.next/prerender-manifest.json +114 -0
  12. package/.next/react-loadable-manifest.json +1993 -0
  13. package/.next/required-server-files.js +341 -0
  14. package/.next/required-server-files.json +341 -0
  15. package/.next/routes-manifest.json +252 -0
  16. package/.next/server/app/_global-error/page.js +32 -0
  17. package/.next/server/app/_global-error/page.js.nft.json +1 -0
  18. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -0
  19. package/.next/server/app/_global-error.html +1 -0
  20. package/.next/server/app/_global-error.meta +16 -0
  21. package/.next/server/app/_global-error.rsc +14 -0
  22. package/.next/server/app/_global-error.segments/_full.segment.rsc +14 -0
  23. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +5 -0
  24. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +5 -0
  25. package/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
  26. package/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
  27. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  28. package/.next/server/app/_not-found/page.js +2 -0
  29. package/.next/server/app/_not-found/page.js.nft.json +1 -0
  30. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
  31. package/.next/server/app/_not-found.html +1 -0
  32. package/.next/server/app/_not-found.meta +16 -0
  33. package/.next/server/app/_not-found.rsc +16 -0
  34. package/.next/server/app/_not-found.segments/_full.segment.rsc +16 -0
  35. package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
  36. package/.next/server/app/_not-found.segments/_index.segment.rsc +5 -0
  37. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
  38. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +5 -0
  39. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
  40. package/.next/server/app/api/agent/[id]/events/route.js +3 -0
  41. package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -0
  42. package/.next/server/app/api/agent/[id]/events/route_client-reference-manifest.js +1 -0
  43. package/.next/server/app/api/agent/[id]/route.js +1 -0
  44. package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -0
  45. package/.next/server/app/api/agent/[id]/route_client-reference-manifest.js +1 -0
  46. package/.next/server/app/api/agent/describe-image/route.js +15 -0
  47. package/.next/server/app/api/agent/describe-image/route.js.nft.json +1 -0
  48. package/.next/server/app/api/agent/describe-image/route_client-reference-manifest.js +1 -0
  49. package/.next/server/app/api/agent/new/route.js +8 -0
  50. package/.next/server/app/api/agent/new/route.js.nft.json +1 -0
  51. package/.next/server/app/api/agent/new/route_client-reference-manifest.js +1 -0
  52. package/.next/server/app/api/auth/all-providers/route.js +1 -0
  53. package/.next/server/app/api/auth/all-providers/route.js.nft.json +1 -0
  54. package/.next/server/app/api/auth/all-providers/route_client-reference-manifest.js +1 -0
  55. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -0
  56. package/.next/server/app/api/auth/api-key/[provider]/route.js.nft.json +1 -0
  57. package/.next/server/app/api/auth/api-key/[provider]/route_client-reference-manifest.js +1 -0
  58. package/.next/server/app/api/auth/login/[provider]/route.js +3 -0
  59. package/.next/server/app/api/auth/login/[provider]/route.js.nft.json +1 -0
  60. package/.next/server/app/api/auth/login/[provider]/route_client-reference-manifest.js +1 -0
  61. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -0
  62. package/.next/server/app/api/auth/logout/[provider]/route.js.nft.json +1 -0
  63. package/.next/server/app/api/auth/logout/[provider]/route_client-reference-manifest.js +1 -0
  64. package/.next/server/app/api/auth/providers/route.js +1 -0
  65. package/.next/server/app/api/auth/providers/route.js.nft.json +1 -0
  66. package/.next/server/app/api/auth/providers/route_client-reference-manifest.js +1 -0
  67. package/.next/server/app/api/default-cwd/route.js +1 -0
  68. package/.next/server/app/api/default-cwd/route.js.nft.json +1 -0
  69. package/.next/server/app/api/default-cwd/route_client-reference-manifest.js +1 -0
  70. package/.next/server/app/api/files/[...path]/route.js +6 -0
  71. package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -0
  72. package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +1 -0
  73. package/.next/server/app/api/gem-xy/[id]/route.js +1 -0
  74. package/.next/server/app/api/gem-xy/[id]/route.js.nft.json +1 -0
  75. package/.next/server/app/api/gem-xy/[id]/route_client-reference-manifest.js +1 -0
  76. package/.next/server/app/api/gem-xy/route.js +1 -0
  77. package/.next/server/app/api/gem-xy/route.js.nft.json +1 -0
  78. package/.next/server/app/api/gem-xy/route_client-reference-manifest.js +1 -0
  79. package/.next/server/app/api/home/route.js +1 -0
  80. package/.next/server/app/api/home/route.js.nft.json +1 -0
  81. package/.next/server/app/api/home/route_client-reference-manifest.js +1 -0
  82. package/.next/server/app/api/inkos/route.js +13 -0
  83. package/.next/server/app/api/inkos/route.js.nft.json +1 -0
  84. package/.next/server/app/api/inkos/route_client-reference-manifest.js +1 -0
  85. package/.next/server/app/api/models/route.js +1 -0
  86. package/.next/server/app/api/models/route.js.nft.json +1 -0
  87. package/.next/server/app/api/models/route_client-reference-manifest.js +1 -0
  88. package/.next/server/app/api/models-config/route.js +1 -0
  89. package/.next/server/app/api/models-config/route.js.nft.json +1 -0
  90. package/.next/server/app/api/models-config/route_client-reference-manifest.js +1 -0
  91. package/.next/server/app/api/register-cwd/route.js +1 -0
  92. package/.next/server/app/api/register-cwd/route.js.nft.json +1 -0
  93. package/.next/server/app/api/register-cwd/route_client-reference-manifest.js +1 -0
  94. package/.next/server/app/api/sessions/[id]/context/route.js +3 -0
  95. package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -0
  96. package/.next/server/app/api/sessions/[id]/context/route_client-reference-manifest.js +1 -0
  97. package/.next/server/app/api/sessions/[id]/lock/route.js +1 -0
  98. package/.next/server/app/api/sessions/[id]/lock/route.js.nft.json +1 -0
  99. package/.next/server/app/api/sessions/[id]/lock/route_client-reference-manifest.js +1 -0
  100. package/.next/server/app/api/sessions/[id]/route.js +1 -0
  101. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -0
  102. package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -0
  103. package/.next/server/app/api/sessions/new/route.js +1 -0
  104. package/.next/server/app/api/sessions/new/route.js.nft.json +1 -0
  105. package/.next/server/app/api/sessions/new/route_client-reference-manifest.js +1 -0
  106. package/.next/server/app/api/sessions/route.js +3 -0
  107. package/.next/server/app/api/sessions/route.js.nft.json +1 -0
  108. package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -0
  109. package/.next/server/app/api/skills/install/route.js +1 -0
  110. package/.next/server/app/api/skills/install/route.js.nft.json +1 -0
  111. package/.next/server/app/api/skills/install/route_client-reference-manifest.js +1 -0
  112. package/.next/server/app/api/skills/route.js +6 -0
  113. package/.next/server/app/api/skills/route.js.nft.json +1 -0
  114. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -0
  115. package/.next/server/app/api/skills/search/route.js +1 -0
  116. package/.next/server/app/api/skills/search/route.js.nft.json +1 -0
  117. package/.next/server/app/api/skills/search/route_client-reference-manifest.js +1 -0
  118. package/.next/server/app/api/tts/synthesize/route.js +1 -0
  119. package/.next/server/app/api/tts/synthesize/route.js.nft.json +1 -0
  120. package/.next/server/app/api/tts/synthesize/route_client-reference-manifest.js +1 -0
  121. package/.next/server/app/favicon.ico/route.js +1 -0
  122. package/.next/server/app/favicon.ico/route.js.nft.json +1 -0
  123. package/.next/server/app/favicon.ico.body +0 -0
  124. package/.next/server/app/favicon.ico.meta +1 -0
  125. package/.next/server/app/index.html +1 -0
  126. package/.next/server/app/index.meta +14 -0
  127. package/.next/server/app/index.rsc +15 -0
  128. package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -0
  129. package/.next/server/app/index.segments/_full.segment.rsc +15 -0
  130. package/.next/server/app/index.segments/_head.segment.rsc +6 -0
  131. package/.next/server/app/index.segments/_index.segment.rsc +5 -0
  132. package/.next/server/app/index.segments/_tree.segment.rsc +2 -0
  133. package/.next/server/app/page.js +162 -0
  134. package/.next/server/app/page.js.nft.json +1 -0
  135. package/.next/server/app/page_client-reference-manifest.js +1 -0
  136. package/.next/server/app-paths-manifest.json +33 -0
  137. package/.next/server/chunks/162.js +1 -0
  138. package/.next/server/chunks/433.js +6 -0
  139. package/.next/server/chunks/601.js +27 -0
  140. package/.next/server/chunks/63.js +45 -0
  141. package/.next/server/chunks/632.js +1 -0
  142. package/.next/server/chunks/65.js +1 -0
  143. package/.next/server/chunks/741.js +18 -0
  144. package/.next/server/chunks/813.js +1 -0
  145. package/.next/server/functions-config-manifest.json +4 -0
  146. package/.next/server/interception-route-rewrite-manifest.js +1 -0
  147. package/.next/server/middleware-build-manifest.js +1 -0
  148. package/.next/server/middleware-manifest.json +6 -0
  149. package/.next/server/middleware-react-loadable-manifest.js +1 -0
  150. package/.next/server/next-font-manifest.js +1 -0
  151. package/.next/server/next-font-manifest.json +1 -0
  152. package/.next/server/pages/404.html +1 -0
  153. package/.next/server/pages/500.html +1 -0
  154. package/.next/server/pages-manifest.json +4 -0
  155. package/.next/server/prefetch-hints.json +1 -0
  156. package/.next/server/server-reference-manifest.js +1 -0
  157. package/.next/server/server-reference-manifest.json +1 -0
  158. package/.next/server/webpack-runtime.js +1 -0
  159. package/.next/static/BvG0z8aA5rKvDREWCzBf_/_buildManifest.js +1 -0
  160. package/.next/static/BvG0z8aA5rKvDREWCzBf_/_ssgManifest.js +1 -0
  161. package/.next/static/chunks/1966.1560d0f43ac9a41a.js +1 -0
  162. package/.next/static/chunks/2479.43f5228b4208e28b.js +1 -0
  163. package/.next/static/chunks/3794-fa2c7d47374be211.js +32 -0
  164. package/.next/static/chunks/3899.cf10152d8085e352.js +1 -0
  165. package/.next/static/chunks/4bd1b696-c2f6e0877b6c10aa.js +1 -0
  166. package/.next/static/chunks/5f4842b5.50bf54b97ff395f3.js +1 -0
  167. package/.next/static/chunks/7547-9d656d23f0b75f2a.js +1 -0
  168. package/.next/static/chunks/7918f2c1.3a26cf7b64cb2eff.js +6 -0
  169. package/.next/static/chunks/8451.cfb7d6db11fbfb19.js +1 -0
  170. package/.next/static/chunks/app/_global-error/page-7f5e7bebe7a745ed.js +1 -0
  171. package/.next/static/chunks/app/_not-found/page-cba500a03cba1d1e.js +1 -0
  172. package/.next/static/chunks/app/api/agent/[id]/events/route-7f5e7bebe7a745ed.js +1 -0
  173. package/.next/static/chunks/app/api/agent/[id]/route-7f5e7bebe7a745ed.js +1 -0
  174. package/.next/static/chunks/app/api/agent/describe-image/route-7f5e7bebe7a745ed.js +1 -0
  175. package/.next/static/chunks/app/api/agent/new/route-7f5e7bebe7a745ed.js +1 -0
  176. package/.next/static/chunks/app/api/auth/all-providers/route-7f5e7bebe7a745ed.js +1 -0
  177. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-7f5e7bebe7a745ed.js +1 -0
  178. package/.next/static/chunks/app/api/auth/login/[provider]/route-7f5e7bebe7a745ed.js +1 -0
  179. package/.next/static/chunks/app/api/auth/logout/[provider]/route-7f5e7bebe7a745ed.js +1 -0
  180. package/.next/static/chunks/app/api/auth/providers/route-7f5e7bebe7a745ed.js +1 -0
  181. package/.next/static/chunks/app/api/default-cwd/route-7f5e7bebe7a745ed.js +1 -0
  182. package/.next/static/chunks/app/api/files/[...path]/route-7f5e7bebe7a745ed.js +1 -0
  183. package/.next/static/chunks/app/api/gem-xy/[id]/route-7f5e7bebe7a745ed.js +1 -0
  184. package/.next/static/chunks/app/api/gem-xy/route-7f5e7bebe7a745ed.js +1 -0
  185. package/.next/static/chunks/app/api/home/route-7f5e7bebe7a745ed.js +1 -0
  186. package/.next/static/chunks/app/api/inkos/route-7f5e7bebe7a745ed.js +1 -0
  187. package/.next/static/chunks/app/api/models/route-7f5e7bebe7a745ed.js +1 -0
  188. package/.next/static/chunks/app/api/models-config/route-7f5e7bebe7a745ed.js +1 -0
  189. package/.next/static/chunks/app/api/register-cwd/route-7f5e7bebe7a745ed.js +1 -0
  190. package/.next/static/chunks/app/api/sessions/[id]/context/route-7f5e7bebe7a745ed.js +1 -0
  191. package/.next/static/chunks/app/api/sessions/[id]/lock/route-7f5e7bebe7a745ed.js +1 -0
  192. package/.next/static/chunks/app/api/sessions/[id]/route-7f5e7bebe7a745ed.js +1 -0
  193. package/.next/static/chunks/app/api/sessions/new/route-7f5e7bebe7a745ed.js +1 -0
  194. package/.next/static/chunks/app/api/sessions/route-7f5e7bebe7a745ed.js +1 -0
  195. package/.next/static/chunks/app/api/skills/install/route-7f5e7bebe7a745ed.js +1 -0
  196. package/.next/static/chunks/app/api/skills/route-7f5e7bebe7a745ed.js +1 -0
  197. package/.next/static/chunks/app/api/skills/search/route-7f5e7bebe7a745ed.js +1 -0
  198. package/.next/static/chunks/app/api/tts/synthesize/route-7f5e7bebe7a745ed.js +1 -0
  199. package/.next/static/chunks/app/layout-6c9568b1e18484e3.js +1 -0
  200. package/.next/static/chunks/app/page-0e8b420d9a738e0f.js +161 -0
  201. package/.next/static/chunks/ca377847.a378e365b1b60c48.js +1 -0
  202. package/.next/static/chunks/framework-3052651e402fc2ca.js +1 -0
  203. package/.next/static/chunks/main-268a9d5ff935d846.js +5 -0
  204. package/.next/static/chunks/main-app-a115908f58a6cf38.js +1 -0
  205. package/.next/static/chunks/next/dist/client/components/builtin/app-error-7f5e7bebe7a745ed.js +1 -0
  206. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-7f5e7bebe7a745ed.js +1 -0
  207. package/.next/static/chunks/next/dist/client/components/builtin/global-error-2c0ae34a7b36f2f6.js +1 -0
  208. package/.next/static/chunks/next/dist/client/components/builtin/not-found-7f5e7bebe7a745ed.js +1 -0
  209. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-7f5e7bebe7a745ed.js +1 -0
  210. package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  211. package/.next/static/chunks/webpack-a98a562c28a00d6f.js +1 -0
  212. package/.next/static/css/cb335cfd27b5f824.css +3 -0
  213. package/.next/static/media/15605e25b523335c-s.woff2 +0 -0
  214. package/.next/static/media/1a3dce5cfb5f7760-s.woff2 +0 -0
  215. package/.next/static/media/1cdd02902f937a18-s.woff2 +0 -0
  216. package/.next/static/media/4c4b3b30b6bcb2be-s.woff2 +0 -0
  217. package/.next/static/media/641a7b8a5800ee0e-s.woff2 +0 -0
  218. package/.next/static/media/7deddc85b7ffd1dc-s.p.woff2 +0 -0
  219. package/.next/static/media/ec14413c594b3356-s.p.woff2 +0 -0
  220. package/.next/trace +4 -0
  221. package/.next/trace-build +1 -0
  222. package/.next/types/app/api/agent/[id]/events/route.ts +351 -0
  223. package/.next/types/app/api/agent/[id]/route.ts +351 -0
  224. package/.next/types/app/api/agent/describe-image/route.ts +351 -0
  225. package/.next/types/app/api/agent/new/route.ts +351 -0
  226. package/.next/types/app/api/auth/all-providers/route.ts +351 -0
  227. package/.next/types/app/api/auth/api-key/[provider]/route.ts +351 -0
  228. package/.next/types/app/api/auth/login/[provider]/route.ts +351 -0
  229. package/.next/types/app/api/auth/logout/[provider]/route.ts +351 -0
  230. package/.next/types/app/api/auth/providers/route.ts +351 -0
  231. package/.next/types/app/api/default-cwd/route.ts +351 -0
  232. package/.next/types/app/api/files/[...path]/route.ts +351 -0
  233. package/.next/types/app/api/gem-xy/[id]/route.ts +351 -0
  234. package/.next/types/app/api/gem-xy/route.ts +351 -0
  235. package/.next/types/app/api/home/route.ts +351 -0
  236. package/.next/types/app/api/inkos/route.ts +351 -0
  237. package/.next/types/app/api/models/route.ts +351 -0
  238. package/.next/types/app/api/models-config/route.ts +351 -0
  239. package/.next/types/app/api/register-cwd/route.ts +351 -0
  240. package/.next/types/app/api/sessions/[id]/context/route.ts +351 -0
  241. package/.next/types/app/api/sessions/[id]/lock/route.ts +351 -0
  242. package/.next/types/app/api/sessions/[id]/route.ts +351 -0
  243. package/.next/types/app/api/sessions/new/route.ts +351 -0
  244. package/.next/types/app/api/sessions/route.ts +351 -0
  245. package/.next/types/app/api/skills/install/route.ts +351 -0
  246. package/.next/types/app/api/skills/route.ts +351 -0
  247. package/.next/types/app/api/skills/search/route.ts +351 -0
  248. package/.next/types/app/api/tts/synthesize/route.ts +351 -0
  249. package/.next/types/app/layout.ts +87 -0
  250. package/.next/types/app/page.ts +87 -0
  251. package/.next/types/package.json +1 -0
  252. package/.next/types/routes.d.ts +99 -0
  253. package/.next/types/validator.ts +313 -0
  254. package/README.md +183 -0
  255. package/bin/pi-web.js +78 -0
  256. package/electron/main.js +127 -0
  257. package/next.config.ts +13 -0
  258. package/package.json +116 -0
  259. package/public/favicon.ico +0 -0
  260. package/public/file.svg +1 -0
  261. package/public/generate_favicon.py +38 -0
  262. package/public/globe.svg +1 -0
  263. package/public/icon.png +0 -0
  264. package/public/next.svg +1 -0
  265. package/public/vercel.svg +1 -0
  266. package/public/window.svg +1 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2767],{2049:(t,e,i)=>{var s=i(5199);i(2119);class a{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let a=e.listeners[s],n=e.duration;a.forEach(s=>s({chart:t,initial:e.initial,numSteps:n,currentStep:Math.min(i-e.start,n)}))}_refresh(){this._request||(this._running=!0,this._request=s.requestAnimFrame.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{let a;if(!i.running||!i.items.length)return;let n=i.items,r=n.length-1,o=!1;for(;r>=0;--r)(a=n[r])._active?(a._total>i.duration&&(i.duration=a._total),a.tick(t),o=!0):(n[r]=n[n.length-1],n.pop());o&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length}),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((t,e)=>Math.max(t,e._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!!e&&!!e.running&&!!e.items.length}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var n=new a;let r="transparent",o={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){let a=s.color(t||r),n=a.valid&&s.color(e||r);return n&&n.valid?n.mix(a,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class l{constructor(t,e,i,a){const n=e[i];a=s.resolve([t.to,a,n,t.from]);const r=s.resolve([t.from,n,a]);this._active=!0,this._fn=t.fn||o[t.type||typeof r],this._easing=s.effects[t.easing]||s.effects.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=i,this._from=r,this._to=a,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let a=this._target[this._prop],n=i-this._start,r=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=s.resolve([t.to,e,a,t.from]),this._from=s.resolve([t.from,a,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e,i=t-this._start,s=this._duration,a=this._prop,n=this._from,r=this._loop,o=this._to;if(this._active=n!==o&&(r||i<s),!this._active){this._target[a]=o,this._notify(!0);return}if(i<0){this._target[a]=n;return}e=i/s%2,e=r&&e>1?2-e:e,e=this._easing(Math.min(1,Math.max(0,e))),this._target[a]=this._fn(n,o,e)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class h{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!s.isObject(t))return;let e=Object.keys(s.defaults.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(a=>{let n=t[a];if(!s.isObject(n))return;let r={};for(let t of e)r[t]=n[t];(s.isArray(n.properties)&&n.properties||[a]).forEach(t=>{t!==a&&i.has(t)||i.set(t,r)})})}_animateOptions(t,e){let i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i){t.options=e;return}return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i}(t,i);if(!s)return[];let a=this._createAnimations(s,i);return i.$shared&&(function(t,e){let i=[],s=Object.keys(e);for(let e=0;e<s.length;e++){let a=t[s[e]];a&&a.active()&&i.push(a.wait())}return Promise.all(i)})(t.options.$animations,i).then(()=>{t.options=i},()=>{}),a}_createAnimations(t,e){let i,s=this._properties,a=[],n=t.$animations||(t.$animations={}),r=Object.keys(e),o=Date.now();for(i=r.length-1;i>=0;--i){let h=r[i];if("$"===h.charAt(0))continue;if("options"===h){a.push(...this._animateOptions(t,e));continue}let d=e[h],c=n[h],u=s.get(h);if(c)if(u&&c.active()){c.update(u,d,o);continue}else c.cancel();if(!u||!u.duration){t[h]=d;continue}n[h]=c=new l(u,t,h,d),a.push(c)}return a}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);let i=this._createAnimations(t,e);if(i.length)return n.add(this._chart,i),!0}}function d(t,e){let i=t&&t.options||{},s=i.reverse,a=void 0===i.min?e:0,n=void 0===i.max?e:0;return{start:s?n:a,end:s?a:n}}function c(t,e){let i,s,a=[],n=t._getSortedDatasetMetas(e);for(i=0,s=n.length;i<s;++i)a.push(n[i].index);return a}function u(t,e,i,a={}){let n,r,o,l,h=t.keys,d="single"===a.mode;if(null===e)return;let c=!1;for(n=0,r=h.length;n<r;++n){if((o=+h[n])===i){if(c=!0,a.all)continue;break}l=t.values[o],s.isNumberFinite(l)&&(d||0===e||s.sign(e)===s.sign(l))&&(e+=l)}return c||a.all?e:0}function g(t,e){let i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function f(t,e,i,s){for(let a of e.getMatchingVisibleMetas(s).reverse()){let e=t[a.index];if(i&&e>0||!i&&e<0)return a.index}return null}function p(t,e){let i,{chart:s,_cachedMeta:a}=t,n=s._stacks||(s._stacks={}),{iScale:r,vScale:o,index:l}=a,h=r.axis,d=o.axis,c=`${r.id}.${o.id}.${a.stack||a.type}`,u=e.length;for(let t=0;t<u;++t){let s=e[t],{[h]:r,[d]:u}=s;(i=(s._stacks||(s._stacks={}))[d]=function(t,e,i){let s=t[e]||(t[e]={});return s[i]||(s[i]={})}(n,c,r))[l]=u,i._top=f(i,o,!0,a.type),i._bottom=f(i,o,!1,a.type),(i._visualValues||(i._visualValues={}))[l]=u}}function m(t,e){let i=t.scales;return Object.keys(i).filter(t=>i[t].axis===e).shift()}function x(t,e){let i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s)for(let a of e=e||t._parsed){let t=a._stacks;if(!t||void 0===t[s]||void 0===t[s][i])return;delete t[s][i],void 0!==t[s]._visualValues&&void 0!==t[s]._visualValues[i]&&delete t[s]._visualValues[i]}}let b=t=>"reset"===t||"none"===t,_=(t,e)=>e?t:Object.assign({},t);class v{static defaults={};static datasetElementType=null;static dataElementType=null;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(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=g(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&&x(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),a=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=s.valueOrDefault(i.xAxisID,m(t,"x")),r=e.yAxisID=s.valueOrDefault(i.yAxisID,m(t,"y")),o=e.rAxisID=s.valueOrDefault(i.rAxisID,m(t,"r")),l=e.indexAxis,h=e.iAxisID=a(l,n,r,o),d=e.vAxisID=a(l,r,n,o);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(o),e.iScale=this.getScaleForId(h),e.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&s.unlistenArrayEvents(this._data,this),t._stacked&&x(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(s.isObject(e)){let t=this._cachedMeta;this._data=function(t,e){let i,s,a,{iScale:n,vScale:r}=e,o="x"===n.axis?"x":"y",l="x"===r.axis?"x":"y",h=Object.keys(t),d=Array(h.length);for(i=0,s=h.length;i<s;++i)a=h[i],d[i]={[o]:a,[l]:t[a]};return d}(e,t)}else if(i!==e){if(i){s.unlistenArrayEvents(i,this);let t=this._cachedMeta;x(t),t._parsed=[]}e&&Object.isExtensible(e)&&s.listenArrayEvents(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),s=!1;this._dataCheck();let a=e._stacked;e._stacked=g(e.vScale,e),e.stack!==i.stack&&(s=!0,x(e),e.stack=i.stack),this._resyncElements(t),(s||a!==e._stacked)&&(p(this,e._parsed),e._stacked=g(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let i,a,n,{_cachedMeta:r,_data:o}=this,{iScale:l,_stacked:h}=r,d=l.axis,c=0===t&&e===o.length||r._sorted,u=t>0&&r._parsed[t-1];if(!1===this._parsing)r._parsed=o,r._sorted=!0,n=o;else{n=s.isArray(o[t])?this.parseArrayData(r,o,t,e):s.isObject(o[t])?this.parseObjectData(r,o,t,e):this.parsePrimitiveData(r,o,t,e);let l=()=>null===a[d]||u&&a[d]<u[d];for(i=0;i<e;++i)r._parsed[i+t]=a=n[i],c&&(l()&&(c=!1),u=a);r._sorted=c}h&&p(this,n)}parsePrimitiveData(t,e,i,s){let a,n,{iScale:r,vScale:o}=t,l=r.axis,h=o.axis,d=r.getLabels(),c=r===o,u=Array(s);for(a=0;a<s;++a)n=a+i,u[a]={[l]:c||r.parse(d[n],n),[h]:o.parse(e[n],n)};return u}parseArrayData(t,e,i,s){let a,n,r,{xScale:o,yScale:l}=t,h=Array(s);for(a=0;a<s;++a)r=e[n=a+i],h[a]={x:o.parse(r[0],n),y:l.parse(r[1],n)};return h}parseObjectData(t,e,i,a){let n,r,o,{xScale:l,yScale:h}=t,{xAxisKey:d="x",yAxisKey:c="y"}=this._parsing,u=Array(a);for(n=0;n<a;++n)o=e[r=n+i],u[n]={x:l.parse(s.resolveObjectKey(o,d),r),y:h.parse(s.resolveObjectKey(o,c),r)};return u}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){let s=this.chart,a=this._cachedMeta,n=e[t.axis];return u({keys:c(s,!0),values:e._stacks[t.axis]._visualValues},n,a.index,{mode:i})}updateRangeFromParsed(t,e,i,s){let a=i[e.axis],n=null===a?NaN:a,r=s&&i._stacks[e.axis];s&&r&&(s.values=r,n=u(s,a,this._cachedMeta.index)),t.min=Math.min(t.min,n),t.max=Math.max(t.max,n)}getMinMax(t,e){let i,a,n,r=this._cachedMeta,o=r._parsed,l=r._sorted&&t===r.iScale,h=o.length,d=this._getOtherScale(t),u=(n=this.chart,e&&!r.hidden&&r._stacked&&{keys:c(n,!0),values:null}),g={min:1/0,max:-1/0},{min:f,max:p}=function(t){let{min:e,max:i,minDefined:s,maxDefined:a}=t.getUserBounds();return{min:s?e:-1/0,max:a?i:1/0}}(d);function m(){let e=(a=o[i])[d.axis];return!s.isNumberFinite(a[t.axis])||f>e||p<e}for(i=0;i<h&&(m()||(this.updateRangeFromParsed(g,t,a,u),!l));++i);if(l){for(i=h-1;i>=0;--i)if(!m()){this.updateRangeFromParsed(g,t,a,u);break}}return g}getAllParsedValues(t){let e,i,a,n=this._cachedMeta._parsed,r=[];for(e=0,i=n.length;e<i;++e)a=n[e][t.axis],s.isNumberFinite(a)&&r.push(a);return r}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,i=e.iScale,s=e.vScale,a=this.getParsed(t);return{label:i?""+i.getLabelForValue(a[i.axis]):"",value:s?""+s.getLabelForValue(a[s.axis]):""}}_update(t){var e;let i,a,n,r,o=this._cachedMeta;this.update(t||"default"),e=s.valueOrDefault(this.options.clip,function(t,e,i){if(!1===i)return!1;let s=d(t,i),a=d(e,i);return{top:a.end,right:s.end,bottom:a.start,left:s.start}}(o.xScale,o.yScale,this.getMaxOverflow())),s.isObject(e)?(i=e.top,a=e.right,n=e.bottom,r=e.left):i=a=n=r=e,o._clip={top:i,right:a,bottom:n,left:r,disabled:!1===e}}update(t){}draw(){let t,e=this._ctx,i=this.chart,s=this._cachedMeta,a=s.data||[],n=i.chartArea,r=[],o=this._drawStart||0,l=this._drawCount||a.length-o,h=this.options.drawActiveElementsOnTop;for(s.dataset&&s.dataset.draw(e,n,o,l),t=o;t<o+l;++t){let i=a[t];i.hidden||(i.active&&h?r.push(i):i.draw(e,n))}for(t=0;t<r.length;++t)r[t].draw(e,n)}getStyle(t,e){let i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){var a,n,r;let o,l=this.getDataset();if(t>=0&&t<this._cachedMeta.data.length){let e=this._cachedMeta.data[t];(o=e.$context||(a=this.getContext(),e.$context=s.createContext(a,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"}))).parsed=this.getParsed(t),o.raw=l.data[t],o.index=o.dataIndex=t}else(o=this.$context||(this.$context=(n=this.chart.getContext(),r=this.index,s.createContext(n,{active:!1,dataset:void 0,datasetIndex:r,index:r,mode:"default",type:"dataset"})))).dataset=l,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,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",i){let a="active"===e,n=this._cachedDataOpts,r=t+"-"+e,o=n[r],l=this.enableOptionSharing&&s.defined(i);if(o)return _(o,l);let h=this.chart.config,d=h.datasetElementScopeKeys(this._type,t),c=a?[`${t}Hover`,"hover",t,""]:[t,""],u=h.getOptionScopes(this.getDataset(),d),g=Object.keys(s.defaults.elements[t]),f=()=>this.getContext(i,a,e),p=h.resolveNamedOptions(u,g,f,c);return p.$shared&&(p.$shared=l,n[r]=Object.freeze(_(p,l))),p}_resolveAnimations(t,e,i){let s,a=this.chart,n=this._cachedDataOpts,r=`animation-${e}`,o=n[r];if(o)return o;if(!1!==a.options.animation){let a=this.chart.config,n=a.datasetAnimationScopeKeys(this._type,e),r=a.getOptionScopes(this.getDataset(),n);s=a.createResolver(r,this.getContext(t,i,e))}let l=new h(a,s&&s.animations);return s&&s._cacheable&&(n[r]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||b(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,a=this.getSharedOptions(i),n=this.includeOptions(e,a)||a!==s;return this.updateSharedOptions(a,e,i),{sharedOptions:a,includeOptions:n}}updateElement(t,e,i,s){b(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!b(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let a=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(a)||a})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];let s=i.length,a=e.length,n=Math.min(a,s);n&&this.parse(0,n),a>s?this._insertElements(s,a-s,t):a<s&&this._removeElements(a,s-a)}_insertElements(t,e,i=!0){let s,a=this._cachedMeta,n=a.data,r=t+e,o=t=>{for(t.length+=e,s=t.length-1;s>=r;s--)t[s]=t[s-e]};for(o(n),s=t;s<r;++s)n[s]=new this.dataElementType;this._parsing&&o(a._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){let i=this._cachedMeta;if(this._parsing){let s=i._parsed.splice(t,e);i._stacked&&x(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let 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]);let i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function y(t,e,i,a){if(s.isArray(t)){let s,n,r,o,l,h;s=i.parse(t[0],a),r=Math.min(s,n=i.parse(t[1],a)),o=Math.max(s,n),l=r,h=o,Math.abs(r)>Math.abs(o)&&(l=o,h=r),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:s,end:n,min:r,max:o}}else e[i.axis]=i.parse(t,a);return e}function M(t,e,i,s){let a,n,r,o,l=t.iScale,h=t.vScale,d=l.getLabels(),c=l===h,u=[];for(a=i,n=i+s;a<n;++a)o=e[a],(r={})[l.axis]=c||l.parse(d[a],a),u.push(y(o,r,h,a));return u}function w(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function k(t,e,i,s){var a,n,r;return s?D((a=t,n=e,r=i,t=a===n?r:a===r?n:a),i,e):D(t,e,i)}function D(t,e,i){return"start"===t?e:"end"===t?i:t}class P extends v{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return M(t,e,i,s)}parseArrayData(t,e,i,s){return M(t,e,i,s)}parseObjectData(t,e,i,a){let n,r,o,l,{iScale:h,vScale:d}=t,{xAxisKey:c="x",yAxisKey:u="y"}=this._parsing,g="x"===h.axis?c:u,f="x"===d.axis?c:u,p=[];for(n=i,r=i+a;n<r;++n)l=e[n],(o={})[h.axis]=h.parse(s.resolveObjectKey(l,g),n),p.push(y(s.resolveObjectKey(l,f),o,d,n));return p}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);let a=i._custom;a&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,a.min),t.max=Math.max(t.max,a.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let{iScale:e,vScale:i}=this._cachedMeta,s=this.getParsed(t),a=s._custom,n=w(a)?"["+a.start+", "+a.end+"]":""+i.getLabelForValue(s[i.axis]);return{label:""+e.getLabelForValue(s[e.axis]),value:n}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){let e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,a){let n="reset"===a,{index:r,_cachedMeta:{vScale:o}}=this,l=o.getBasePixel(),h=o.isHorizontal(),d=this._getRuler(),{sharedOptions:c,includeOptions:u}=this._getSharedOptions(e,a);for(let g=e;g<e+i;g++){let e=this.getParsed(g),i=n||s.isNullOrUndef(e[o.axis])?{base:l,head:l}:this._calculateBarValuePixels(g),f=this._calculateBarIndexPixels(g,d),p=(e._stacks||{})[o.axis],m={horizontal:h,base:i.base,enableBorderRadius:!p||w(e._custom)||r===p._top||r===p._bottom,x:h?i.head:f.center,y:h?f.center:i.head,height:h?f.size:Math.abs(i.size),width:h?Math.abs(i.size):f.size};u&&(m.options=c||this.resolveDataElementOptions(g,t[g].active?"active":a));let x=m.options||t[g].options;!function(t,e,i,s){let a,n,r,o,l,h=e.borderSkipped,d={};if(!h){t.borderSkipped=d;return}if(!0===h){t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:c,end:u,reverse:g,top:f,bottom:p}=(t.horizontal?(a=t.base>t.x,n="left",r="right"):(a=t.base<t.y,n="bottom",r="top"),a?(o="end",l="start"):(o="start",l="end"),{start:n,end:r,reverse:a,top:o,bottom:l});"middle"===h&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?h=f:(i._bottom||0)===s?h=p:(d[k(p,c,u,g)]=!0,h=f)),d[k(h,c,u,g)]=!0,t.borderSkipped=d}(m,x,p,r),function(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?.33*(1===i):e}(m,x,d.ratio),this.updateElement(t[g],g,m,a)}}_getStacks(t,e){let{iScale:i}=this._cachedMeta,a=i.getMatchingVisibleMetas(this._type).filter(t=>t.controller.options.grouped),n=i.options.stacked,r=[],o=this._cachedMeta.controller.getParsed(e),l=o&&o[i.axis],h=t=>{let e=t._parsed.find(t=>t[i.axis]===l),a=e&&e[t.vScale.axis];if(s.isNullOrUndef(a)||isNaN(a))return!0};for(let i of a)if(!(void 0!==e&&h(i))&&((!1===n||-1===r.indexOf(i.stack)||void 0===n&&void 0===i.stack)&&r.push(i.stack),i.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[s.valueOrDefault("x"===this.chart.options.indexAxis?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let s=this._getStacks(t,i),a=void 0!==e?s.indexOf(e):-1;return -1===a?s.length-1:a}_getRuler(){let t,e,i=this.options,a=this._cachedMeta,n=a.iScale,r=[];for(t=0,e=a.data.length;t<e;++t)r.push(n.getPixelForValue(this.getParsed(t)[n.axis],t));let o=i.barThickness;return{min:o||function(t){let e,i,a,n,r=t.iScale,o=function(t,e){if(!t._cache.$bar){let i=t.getMatchingVisibleMetas(e),a=[];for(let e=0,s=i.length;e<s;e++)a=a.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=s._arrayUnique(a.sort((t,e)=>t-e))}return t._cache.$bar}(r,t.type),l=r._length,h=()=>{32767!==a&&-32768!==a&&(s.defined(n)&&(l=Math.min(l,Math.abs(a-n)||l)),n=a)};for(e=0,i=o.length;e<i;++e)a=r.getPixelForValue(o[e]),h();for(e=0,n=void 0,i=r.ticks.length;e<i;++e)a=r.getPixelForTick(e),h();return l}(a),pixels:r,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:i.grouped,ratio:o?1:i.categoryPercentage*i.barPercentage}}_calculateBarValuePixels(t){let e,i,{_cachedMeta:{vScale:a,_stacked:n,index:r},options:{base:o,minBarLength:l}}=this,h=o||0,d=this.getParsed(t),c=d._custom,u=w(c),g=d[a.axis],f=0,p=n?this.applyStack(a,d,n):g;p!==g&&(f=p-g,p=g),u&&(g=c.barStart,p=c.barEnd-c.barStart,0!==g&&s.sign(g)!==s.sign(c.barEnd)&&(f=0),f+=g);let m=s.isNullOrUndef(o)||u?f:o,x=a.getPixelForValue(m);if(Math.abs(i=(e=this.chart.getDataVisibility(t)?a.getPixelForValue(f+p):x)-x)<l){var b;i=(0!==(b=i)?s.sign(b):(a.isHorizontal()?1:-1)*(a.min>=h?1:-1))*l,g===h&&(x-=i/2);let t=a.getPixelForDecimal(0),o=a.getPixelForDecimal(1),c=Math.min(t,o);e=(x=Math.max(Math.min(x,Math.max(t,o)),c))+i,n&&!u&&(d._stacks[a.axis]._visualValues[r]=a.getValueForPixel(e)-a.getValueForPixel(x))}if(x===a.getPixelForValue(h)){let t=s.sign(i)*a.getLineWidthForValue(h)/2;x+=t,i-=t}return{size:i,base:x,head:e,center:e+i/2}}_calculateBarIndexPixels(t,e){let i,a,n=e.scale,r=this.options,o=r.skipNull,l=s.valueOrDefault(r.maxBarThickness,1/0),h=this._getAxisCount();if(e.grouped){var d,c;let n,u,g,f,p,m,x,b,_,v=o?this._getStackCount(t):e.stackCount,y="flex"===r.barThickness?(d=v*h,u=(n=e.pixels)[t],g=t>0?n[t-1]:null,f=t<n.length-1?n[t+1]:null,p=r.categoryPercentage,null===g&&(g=u-(null===f?e.end-e.start:f-u)),null===f&&(f=u+u-g),m=u-(u-Math.min(g,f))/2*p,{chunk:Math.abs(f-g)/2*p/d,ratio:r.barPercentage,start:m}):(c=v*h,_=r.barThickness,s.isNullOrUndef(_)?(x=e.min*r.categoryPercentage,b=r.barPercentage):(x=_*c,b=1),{chunk:x/c,ratio:b,start:e.pixels[t]-x/2}),M="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,w=this._getAxis().indexOf(s.valueOrDefault(M,this.getFirstScaleIdForIndexAxis())),k=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+w;i=y.start+y.chunk*k+y.chunk/2,a=Math.min(l,y.chunk*y.ratio)}else i=n.getPixelForValue(this.getParsed(t)[n.axis],t),a=Math.min(l,e.min*e.ratio);return{base:i-a/2,head:i+a/2,center:i,size:a}}draw(){let t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length,a=0;for(;a<s;++a)null===this.getParsed(a)[e.axis]||i[a].hidden||i[a].draw(this._ctx)}}class S extends v{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){let a=super.parsePrimitiveData(t,e,i,s);for(let t=0;t<a.length;t++)a[t]._custom=this.resolveDataElementOptions(t+i).radius;return a}parseArrayData(t,e,i,a){let n=super.parseArrayData(t,e,i,a);for(let t=0;t<n.length;t++){let a=e[i+t];n[t]._custom=s.valueOrDefault(a[2],this.resolveDataElementOptions(t+i).radius)}return n}parseObjectData(t,e,i,a){let n=super.parseObjectData(t,e,i,a);for(let t=0;t<n.length;t++){let a=e[i+t];n[t]._custom=s.valueOrDefault(a&&a.r&&+a.r,this.resolveDataElementOptions(t+i).radius)}return n}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:a}=e,n=this.getParsed(t),r=s.getLabelForValue(n.x),o=a.getLabelForValue(n.y),l=n._custom;return{label:i[t]||"",value:"("+r+", "+o+(l?", "+l:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){let a="reset"===s,{iScale:n,vScale:r}=this._cachedMeta,{sharedOptions:o,includeOptions:l}=this._getSharedOptions(e,s),h=n.axis,d=r.axis;for(let c=e;c<e+i;c++){let e=t[c],i=!a&&this.getParsed(c),u={},g=u[h]=a?n.getPixelForDecimal(.5):n.getPixelForValue(i[h]),f=u[d]=a?r.getBasePixel():r.getPixelForValue(i[d]);u.skip=isNaN(g)||isNaN(f),l&&(u.options=o||this.resolveDataElementOptions(c,e.active?"active":s),a&&(u.options.radius=0)),this.updateElement(e,c,u,s)}}resolveDataElementOptions(t,e){let i=this.getParsed(t),a=super.resolveDataElementOptions(t,e);a.$shared&&(a=Object.assign({},a,{$shared:!1}));let n=a.radius;return"active"!==e&&(a.radius=0),a.radius+=s.valueOrDefault(i&&i._custom,n),a}}class O extends v{static id="doughnut";static 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"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:i,textAlign:s,color:a,useBorderRadius:n,borderRadius:r}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((e,o)=>{let l=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:l.backgroundColor,fontColor:a,hidden:!t.getDataVisibility(o),lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:l.borderWidth,strokeStyle:l.borderColor,textAlign:s,pointStyle:i,borderRadius:n&&(r||l.borderRadius),index:o}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};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){let i=this.getDataset().data,a=this._cachedMeta;if(!1===this._parsing)a._parsed=i;else{let n,r,o=t=>+i[t];if(s.isObject(i[t])){let{key:t="value"}=this._parsing;o=e=>+s.resolveObjectKey(i[e],t)}for(n=t,r=t+e;n<r;++n)a._parsed[n]=o(n)}}_getRotation(){return s.toRadians(this.options.rotation-90)}_getCircumference(){return s.toRadians(this.options.circumference)}_getRotationExtents(){let t=s.TAU,e=-s.TAU;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){let s=this.chart.getDatasetMeta(i).controller,a=s._getRotation(),n=s._getCircumference();t=Math.min(t,a),e=Math.max(e,a+n)}return{rotation:t,circumference:e-t}}update(t){let{chartArea:e}=this.chart,i=this._cachedMeta,a=i.data,n=this.getMaxBorderWidth()+this.getMaxOffset(a)+this.options.spacing,r=Math.max((Math.min(e.width,e.height)-n)/2,0),o=Math.min(s.toPercentage(this.options.cutout,r),1),l=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:c,ratioY:u,offsetX:g,offsetY:f}=function(t,e,i){let a=1,n=1,r=0,o=0;if(e<s.TAU){let l=t+e,h=Math.cos(t),d=Math.sin(t),c=Math.cos(l),u=Math.sin(l),g=(e,a,n)=>s._angleBetween(e,t,l,!0)?1:Math.max(a,a*i,n,n*i),f=(e,a,n)=>s._angleBetween(e,t,l,!0)?-1:Math.min(a,a*i,n,n*i),p=g(0,h,c),m=g(s.HALF_PI,d,u),x=f(s.PI,h,c),b=f(s.PI+s.HALF_PI,d,u);a=(p-x)/2,n=(m-b)/2,r=-(p+x)/2,o=-(m+b)/2}return{ratioX:a,ratioY:n,offsetX:r,offsetY:o}}(d,h,o),p=Math.max(Math.min((e.width-n)/c,(e.height-n)/u)/2,0),m=s.toDimension(this.options.radius,p),x=Math.max(m*o,0),b=(m-x)/this._getVisibleDatasetWeightTotal();this.offsetX=g*m,this.offsetY=f*m,i.total=this.calculateTotal(),this.outerRadius=m-b*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-b*l,0),this.updateElements(a,0,a.length,t)}_circumference(t,e){let i=this.options,a=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===a._parsed[t]||a.data[t].hidden?0:this.calculateCircumference(a._parsed[t]*n/s.TAU)}updateElements(t,e,i,s){let a,n="reset"===s,r=this.chart,o=r.chartArea,l=r.options.animation,h=(o.left+o.right)/2,d=(o.top+o.bottom)/2,c=n&&l.animateScale,u=c?0:this.innerRadius,g=c?0:this.outerRadius,{sharedOptions:f,includeOptions:p}=this._getSharedOptions(e,s),m=this._getRotation();for(a=0;a<e;++a)m+=this._circumference(a,n);for(a=e;a<e+i;++a){let e=this._circumference(a,n),i=t[a],r={x:h+this.offsetX,y:d+this.offsetY,startAngle:m,endAngle:m+e,circumference:e,outerRadius:g,innerRadius:u};p&&(r.options=f||this.resolveDataElementOptions(a,i.active?"active":s)),m+=e,this.updateElement(i,a,r,s)}}calculateTotal(){let t,e=this._cachedMeta,i=e.data,s=0;for(t=0;t<i.length;t++){let a=e._parsed[t];null!==a&&!isNaN(a)&&this.chart.getDataVisibility(t)&&!i[t].hidden&&(s+=Math.abs(a))}return s}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?s.TAU*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,a=i.data.labels||[],n=s.formatNumber(e._parsed[t],i.options.locale);return{label:a[t]||"",value:n}}getMaxBorderWidth(t){let e,i,s,a,n,r=0,o=this.chart;if(!t){for(e=0,i=o.data.datasets.length;e<i;++e)if(o.isDatasetVisible(e)){t=(s=o.getDatasetMeta(e)).data,a=s.controller;break}}if(!t)return 0;for(e=0,i=t.length;e<i;++e)"inner"!==(n=a.resolveDataElementOptions(e)).borderAlign&&(r=Math.max(r,n.borderWidth||0,n.hoverBorderWidth||0));return r}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){let t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(s.valueOrDefault(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class A extends v{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:a=[],_dataset:n}=e,r=this.chart._animationsDisabled,{start:o,count:l}=s._getStartAndCountOfVisiblePoints(e,a,r);this._drawStart=o,this._drawCount=l,s._scaleRangesChanged(e)&&(o=0,l=a.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=a;let h=this.resolveDatasetElementOptions(t);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:h},t),this.updateElements(a,o,l,t)}updateElements(t,e,i,a){let n="reset"===a,{iScale:r,vScale:o,_stacked:l,_dataset:h}=this._cachedMeta,{sharedOptions:d,includeOptions:c}=this._getSharedOptions(e,a),u=r.axis,g=o.axis,{spanGaps:f,segment:p}=this.options,m=s.isNumber(f)?f:1/0,x=this.chart._animationsDisabled||n||"none"===a,b=e+i,_=t.length,v=e>0&&this.getParsed(e-1);for(let i=0;i<_;++i){let f=t[i],_=x?f:{};if(i<e||i>=b){_.skip=!0;continue}let y=this.getParsed(i),M=s.isNullOrUndef(y[g]),w=_[u]=r.getPixelForValue(y[u],i),k=_[g]=n||M?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,y,l):y[g],i);_.skip=isNaN(w)||isNaN(k)||M,_.stop=i>0&&Math.abs(y[u]-v[u])>m,p&&(_.parsed=y,_.raw=h.data[i]),c&&(_.options=d||this.resolveDataElementOptions(i,f.active?"active":a)),x||this.updateElement(f,i,_,a),v=y}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];return s.length?Math.max(i,s[0].size(this.resolveDataElementOptions(0)),s[s.length-1].size(this.resolveDataElementOptions(s.length-1)))/2:i}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class C extends v{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((e,a)=>{let n=t.getDatasetMeta(0).controller.getStyle(a);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,fontColor:s,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,a=i.data.labels||[],n=s.formatNumber(e._parsed[t].r,i.options.locale);return{label:a[t]||"",value:n}}parseObjectData(t,e,i,a){return s._parseObjectDataRadialScale.bind(this)(t,e,i,a)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:1/0,max:-1/0};return t.data.forEach((t,i)=>{let s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(s<e.min&&(e.min=s),s>e.max&&(e.max=s))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,s=Math.max(Math.min(e.right-e.left,e.bottom-e.top)/2,0),a=Math.max(i.cutoutPercentage?s/100*i.cutoutPercentage:1,0),n=(s-a)/t.getVisibleDatasetCount();this.outerRadius=s-n*this.index,this.innerRadius=this.outerRadius-n}updateElements(t,e,i,a){let n,r="reset"===a,o=this.chart,l=o.options.animation,h=this._cachedMeta.rScale,d=h.xCenter,c=h.yCenter,u=h.getIndexAngle(0)-.5*s.PI,g=u,f=360/this.countVisibleElements();for(n=0;n<e;++n)g+=this._computeAngle(n,a,f);for(n=e;n<e+i;n++){let e=t[n],i=g,s=g+this._computeAngle(n,a,f),p=o.getDataVisibility(n)?h.getDistanceFromCenterForValue(this.getParsed(n).r):0;g=s,r&&(l.animateScale&&(p=0),l.animateRotate&&(i=s=u));let m={x:d,y:c,innerRadius:0,outerRadius:p,startAngle:i,endAngle:s,options:this.resolveDataElementOptions(n,e.active?"active":a)};this.updateElement(e,n,m,a)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?s.toRadians(this.resolveDataElementOptions(t,e).angle||i):0}}class L extends O{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class T extends v{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,a){return s._parseObjectDataRadialScale.bind(this)(t,e,i,a)}update(t){let e=this._cachedMeta,i=e.dataset,s=e.data||[],a=e.iScale.getLabels();if(i.points=s,"resize"!==t){let e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);let n={_loop:!0,_fullLoop:a.length===s.length,options:e};this.updateElement(i,void 0,n,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){let a=this._cachedMeta.rScale,n="reset"===s;for(let r=e;r<e+i;r++){let e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":s),o=a.getPointPositionForValue(r,this.getParsed(r).r),l=n?a.xCenter:o.x,h=n?a.yCenter:o.y,d={x:l,y:h,angle:o.angle,skip:isNaN(l)||isNaN(h),options:i};this.updateElement(e,r,d,s)}}}class E extends v{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:a}=e,n=this.getParsed(t),r=s.getLabelForValue(n.x),o=a.getLabelForValue(n.y);return{label:i[t]||"",value:"("+r+", "+o+")"}}update(t){let e=this._cachedMeta,{data:i=[]}=e,a=this.chart._animationsDisabled,{start:n,count:r}=s._getStartAndCountOfVisiblePoints(e,i,a);if(this._drawStart=n,this._drawCount=r,s._scaleRangesChanged(e)&&(n=0,r=i.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:s,_dataset:n}=e;s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!n._decimated,s.points=i;let r=this.resolveDatasetElementOptions(t);r.segment=this.options.segment,this.updateElement(s,void 0,{animated:!a,options:r},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,n,r,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,a){let n="reset"===a,{iScale:r,vScale:o,_stacked:l,_dataset:h}=this._cachedMeta,d=this.resolveDataElementOptions(e,a),c=this.getSharedOptions(d),u=this.includeOptions(a,c),g=r.axis,f=o.axis,{spanGaps:p,segment:m}=this.options,x=s.isNumber(p)?p:1/0,b=this.chart._animationsDisabled||n||"none"===a,_=e>0&&this.getParsed(e-1);for(let d=e;d<e+i;++d){let e=t[d],i=this.getParsed(d),p=b?e:{},v=s.isNullOrUndef(i[f]),y=p[g]=r.getPixelForValue(i[g],d),M=p[f]=n||v?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,i,l):i[f],d);p.skip=isNaN(y)||isNaN(M)||v,p.stop=d>0&&Math.abs(i[g]-_[g])>x,m&&(p.parsed=i,p.raw=h.data[d]),u&&(p.options=c||this.resolveDataElementOptions(d,e.active?"active":a)),b||this.updateElement(e,d,p,a),_=i}this.updateSharedOptions(c,a,d)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}let i=t.dataset,s=i.options&&i.options.borderWidth||0;return e.length?Math.max(s,e[0].size(this.resolveDataElementOptions(0)),e[e.length-1].size(this.resolveDataElementOptions(e.length-1)))/2:s}}var R=Object.freeze({__proto__:null,BarController:P,BubbleController:S,DoughnutController:O,LineController:A,PieController:L,PolarAreaController:C,RadarController:T,ScatterController:E});function F(){throw Error("This method is not implemented: Check that a complete date adapter is provided.")}class z{static override(t){Object.assign(z.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return F()}parse(){return F()}format(){return F()}add(){return F()}diff(){return F()}startOf(){return F()}endOf(){return F()}}var V={_date:z};function I(t,e,i,a,n){let r=t.getSortedVisibleDatasetMetas(),o=i[e];for(let t=0,i=r.length;t<i;++t){let{index:i,data:l}=r[t],{lo:h,hi:d}=function(t,e,i,a){let{controller:n,data:r,_sorted:o}=t,l=n._cachedMeta.iScale,h=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(l&&e===l.axis&&"r"!==e&&o&&r.length){let o=l._reversePixels?s._rlookupByKey:s._lookupByKey;if(a){if(n._sharedOptions){let t=r[0],s="function"==typeof t.getRange&&t.getRange(e);if(s){let t=o(r,e,i-s),a=o(r,e,i+s);return{lo:t.lo,hi:a.hi}}}}else{let a=o(r,e,i);if(h){let{vScale:e}=n._cachedMeta,{_parsed:i}=t,r=i.slice(0,a.lo+1).reverse().findIndex(t=>!s.isNullOrUndef(t[e.axis]));a.lo-=Math.max(0,r);let o=i.slice(a.hi).findIndex(t=>!s.isNullOrUndef(t[e.axis]));a.hi+=Math.max(0,o)}return a}}return{lo:0,hi:r.length-1}}(r[t],e,o,n);for(let t=h;t<=d;++t){let e=l[t];e.skip||a(e,i,t)}}}function B(t,e,i,a,n){let r=[];return(n||t.isPointInArea(e))&&I(t,i,e,function(i,o,l){(n||s._isPointInArea(i,t.chartArea,0))&&i.inRange(e.x,e.y,a)&&r.push({element:i,datasetIndex:o,index:l})},!0),r}function N(t,e,i,a,n,r){let o,l,h,d,c,u;return r||t.isPointInArea(e)?"r"!==i||a?(o=[],l=-1!==i.indexOf("x"),h=-1!==i.indexOf("y"),d=function(t,e){return Math.sqrt(Math.pow(l?Math.abs(t.x-e.x):0,2)+Math.pow(h?Math.abs(t.y-e.y):0,2))},c=1/0,I(t,i,e,function(i,s,l){let h=i.inRange(e.x,e.y,n);if(a&&!h)return;let u=i.getCenterPoint(n);if(!(r||t.isPointInArea(u))&&!h)return;let g=d(e,u);g<c?(o=[{element:i,datasetIndex:s,index:l}],c=g):g===c&&o.push({element:i,datasetIndex:s,index:l})}),o):(u=[],I(t,i,e,function(t,i,a){let{startAngle:r,endAngle:o}=t.getProps(["startAngle","endAngle"],n),{angle:l}=s.getAngleFromPoint(t,{x:e.x,y:e.y});s._angleBetween(l,r,o)&&u.push({element:t,datasetIndex:i,index:a})}),u):[]}function H(t,e,i,s,a){let n=[],r="x"===i?"inXRange":"inYRange",o=!1;return(I(t,i,e,(t,s,l)=>{t[r]&&t[r](e[i],a)&&(n.push({element:t,datasetIndex:s,index:l}),o=o||t.inRange(e.x,e.y,a))}),s&&!o)?[]:n}var j={evaluateInteractionItems:I,modes:{index(t,e,i,a){let n=s.getRelativePosition(e,t),r=i.axis||"x",o=i.includeInvisible||!1,l=i.intersect?B(t,n,r,a,o):N(t,n,r,!1,a,o),h=[];return l.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{let e=l[0].index,i=t.data[e];i&&!i.skip&&h.push({element:i,datasetIndex:t.index,index:e})}),h):[]},dataset(t,e,i,a){let n=s.getRelativePosition(e,t),r=i.axis||"xy",o=i.includeInvisible||!1,l=i.intersect?B(t,n,r,a,o):N(t,n,r,!1,a,o);if(l.length>0){let e=l[0].datasetIndex,i=t.getDatasetMeta(e).data;l=[];for(let t=0;t<i.length;++t)l.push({element:i[t],datasetIndex:e,index:t})}return l},point(t,e,i,a){let n=s.getRelativePosition(e,t);return B(t,n,i.axis||"xy",a,i.includeInvisible||!1)},nearest(t,e,i,a){let n=s.getRelativePosition(e,t),r=i.axis||"xy",o=i.includeInvisible||!1;return N(t,n,r,i.intersect,a,o)},x(t,e,i,a){let n=s.getRelativePosition(e,t);return H(t,n,"x",i.intersect,a)},y(t,e,i,a){let n=s.getRelativePosition(e,t);return H(t,n,"y",i.intersect,a)}}};let W=["left","top","right","bottom"];function U(t,e){return t.filter(t=>t.pos===e)}function $(t,e){return t.filter(t=>-1===W.indexOf(t.pos)&&t.box.axis===e)}function q(t,e){return t.sort((t,i)=>{let s=e?i:t,a=e?t:i;return s.weight===a.weight?s.index-a.index:s.weight-a.weight})}function K(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function X(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function J(t,e,i,a){let n,r,o,l,h,d,c=[];for(n=0,r=t.length,h=0;n<r;++n){(l=(o=t[n]).box).update(o.width||e.w,o.height||e.h,function(t,e){let i=e.maxPadding;return function(t){let s={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{s[t]=Math.max(e[t],i[t])}),s}(t?["left","right"]:["top","bottom"])}(o.horizontal,e));let{same:r,other:u}=function(t,e,i,a){let{pos:n,box:r}=i,o=t.maxPadding;if(!s.isObject(n)){i.size&&(t[n]-=i.size);let e=a[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?r.height:r.width),i.size=e.size/e.count,t[n]+=i.size}r.getPadding&&X(o,r.getPadding());let l=Math.max(0,e.outerWidth-K(o,t,"left","right")),h=Math.max(0,e.outerHeight-K(o,t,"top","bottom")),d=l!==t.w,c=h!==t.h;return t.w=l,t.h=h,i.horizontal?{same:d,other:c}:{same:c,other:d}}(e,i,o,a);h|=r&&c.length,d=d||u,l.fullSize||c.push(o)}return h&&J(c,e,i,a)||d}function Y(t,e,i,s,a){t.top=i,t.left=e,t.right=e+s,t.bottom=i+a,t.width=s,t.height=a}function G(t,e,i,a){let n=i.padding,{x:r,y:o}=e;for(let l of t){let t=l.box,h=a[l.stack]||{count:1,placed:0,weight:1},d=l.stackWeight/h.weight||1;if(l.horizontal){let a=e.w*d,r=h.size||t.height;s.defined(h.start)&&(o=h.start),t.fullSize?Y(t,n.left,o,i.outerWidth-n.right-n.left,r):Y(t,e.left+h.placed,o,a,r),h.start=o,h.placed+=a,o=t.bottom}else{let a=e.h*d,o=h.size||t.width;s.defined(h.start)&&(r=h.start),t.fullSize?Y(t,r,n.top,o,i.outerHeight-n.bottom-n.top):Y(t,r,e.top+h.placed,o,a),h.start=r,h.placed+=a,r=t.right}}e.x=r,e.y=o}var Z={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){let i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,a){let n,r,o,l,h,d,c,u;if(!t)return;let g=s.toPadding(t.options.layout.padding),f=Math.max(e-g.width,0),p=Math.max(i-g.height,0),m=(r=q((n=function(t){let e,i,s,a,n,r,o=[];for(e=0,i=(t||[]).length;e<i;++e)s=t[e],({position:a,options:{stack:n,stackWeight:r=1}}=s),o.push({index:e,box:s,pos:a,horizontal:s.isHorizontal(),weight:s.weight,stack:n&&a+n,stackWeight:r});return o}(t.boxes)).filter(t=>t.box.fullSize),!0),o=q(U(n,"left"),!0),l=q(U(n,"right")),h=q(U(n,"top"),!0),d=q(U(n,"bottom")),c=$(n,"x"),u=$(n,"y"),{fullSize:r,leftAndTop:o.concat(h),rightAndBottom:l.concat(u).concat(d).concat(c),chartArea:U(n,"chartArea"),vertical:o.concat(l).concat(u),horizontal:h.concat(d).concat(c)}),x=m.vertical,b=m.horizontal;s.each(t.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()});let _=Object.freeze({outerWidth:e,outerHeight:i,padding:g,availableWidth:f,availableHeight:p,vBoxMaxWidth:f/2/(x.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1),hBoxMaxHeight:p/2}),v=Object.assign({},g);X(v,s.toPadding(a));let y=Object.assign({maxPadding:v,w:f,h:p,x:g.left,y:g.top},g),M=function(t,e){let i,s,a,n=function(t){let e={};for(let i of t){let{stack:t,pos:s,stackWeight:a}=i;if(!t||!W.includes(s))continue;let n=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});n.count++,n.weight+=a}return e}(t),{vBoxMaxWidth:r,hBoxMaxHeight:o}=e;for(i=0,s=t.length;i<s;++i){let{fullSize:s}=(a=t[i]).box,l=n[a.stack],h=l&&a.stackWeight/l.weight;a.horizontal?(a.width=h?h*r:s&&e.availableWidth,a.height=o):(a.width=r,a.height=h?h*o:s&&e.availableHeight)}return n}(x.concat(b),_);J(m.fullSize,y,_,M),J(x,y,_,M),J(b,y,_,M)&&J(x,y,_,M);let w=y.maxPadding;function k(t){let e=Math.max(w[t]-y[t],0);return y[t]+=e,e}y.y+=k("top"),y.x+=k("left"),k("right"),k("bottom"),G(m.leftAndTop,y,_,M),y.x+=y.w,y.y+=y.h,G(m.rightAndBottom,y,_,M),t.chartArea={left:y.left,top:y.top,right:y.left+y.w,bottom:y.top+y.h,height:y.h,width:y.w},s.each(m.chartArea,e=>{let i=e.box;Object.assign(i,t.chartArea),i.update(y.w,y.h,{left:0,top:0,right:0,bottom:0})})}};class Q{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class tt extends Q{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}let te="$chartjs",ti={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ts=t=>null===t||""===t,ta=!!s.supportsEventListenerOptions&&{passive:!0};function tn(t,e){for(let i of t)if(i===e||i.contains(e))return!0}function tr(t,e,i){let s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(let i of t)e=(e=e||tn(i.addedNodes,s))&&!tn(i.removedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}function to(t,e,i){let s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(let i of t)e=(e=e||tn(i.removedNodes,s))&&!tn(i.addedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}let tl=new Map,th=0;function td(){let t=window.devicePixelRatio;t!==th&&(th=t,tl.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function tc(t,e,i){let a=t.canvas,n=a&&s._getParentNode(a);if(!n)return;let r=s.throttled((t,e)=>{let s=n.clientWidth;i(t,e),s<n.clientWidth&&i()},window),o=new ResizeObserver(t=>{let e=t[0],i=e.contentRect.width,s=e.contentRect.height;(0!==i||0!==s)&&r(i,s)});return o.observe(n),tl.size||window.addEventListener("resize",td),tl.set(t,r),o}function tu(t,e,i){i&&i.disconnect(),"resize"===e&&(tl.delete(t),tl.size||window.removeEventListener("resize",td))}function tg(t,e,i){let a=t.canvas,n=s.throttled(e=>{null!==t.ctx&&i(function(t,e){let i=ti[t.type]||t.type,{x:a,y:n}=s.getRelativePosition(t,e);return{type:i,chart:e,native:t,x:void 0!==a?a:null,y:void 0!==n?n:null}}(e,t))},t);return a&&a.addEventListener(e,n,ta),n}class tf extends Q{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(!function(t,e){let i=t.style,a=t.getAttribute("height"),n=t.getAttribute("width");if(t[te]={initial:{height:a,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",ts(n)){let e=s.readUsedSize(t,"width");void 0!==e&&(t.width=e)}if(ts(a))if(""===t.style.height)t.height=t.width/(e||2);else{let e=s.readUsedSize(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[te])return!1;let i=e[te].initial;["height","width"].forEach(t=>{let a=i[t];s.isNullOrUndef(a)?e.removeAttribute(t):e.setAttribute(t,a)});let a=i.style||{};return Object.keys(a).forEach(t=>{e.style[t]=a[t]}),e.width=e.width,delete e[te],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:tr,detach:to,resize:tc}[e]||tg;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];s&&((({attach:tu,detach:tu,resize:tu})[e]||function(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,ta)})(t,e,s),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,a){return s.getMaximumSize(t,e,i,a)}isAttached(t){let e=t&&s._getParentNode(t);return!!(e&&e.isConnected)}}function tp(t){return!s._isDomSupported()||"u">typeof OffscreenCanvas&&t instanceof OffscreenCanvas?tt:tf}class tm{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return s.isNumber(this.x)&&s.isNumber(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),s}}function tx(t,e,i,a,n){let r,o,l,h=s.valueOrDefault(a,0),d=Math.min(s.valueOrDefault(n,t.length),t.length),c=0;for(i=Math.ceil(i),n&&(i=(r=n-a)/Math.floor(r/i)),l=h;l<0;)l=Math.round(h+ ++c*i);for(o=Math.max(h,0);o<d;o++)o===l&&(e.push(t[o]),l=Math.round(h+ ++c*i))}let tb=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,t_=(t,e)=>Math.min(e||t,t);function tv(t,e){let i=[],s=t.length/e,a=t.length,n=0;for(;n<a;n+=s)i.push(t[Math.floor(n)]);return i}function ty(t){return t.drawTicks?t.tickLength:0}function tM(t,e){if(!t.display)return 0;let i=s.toFont(t.font,e),a=s.toPadding(t.padding);return(s.isArray(t.text)?t.text.length:1)*i.lineHeight+a.height}class tw extends tm{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:i,_suggestedMax:a}=this;return t=s.finiteOrDefault(t,1/0),e=s.finiteOrDefault(e,-1/0),i=s.finiteOrDefault(i,1/0),a=s.finiteOrDefault(a,-1/0),{min:s.finiteOrDefault(t,i),max:s.finiteOrDefault(e,a),minDefined:s.isNumberFinite(t),maxDefined:s.isNumberFinite(e)}}getMinMax(t){let e,{min:i,max:a,minDefined:n,maxDefined:r}=this.getUserBounds();if(n&&r)return{min:i,max:a};let o=this.getMatchingVisibleMetas();for(let s=0,l=o.length;s<l;++s)e=o[s].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),r||(a=Math.max(a,e.max));return i=r&&i>a?a:i,a=n&&i>a?i:a,{min:s.finiteOrDefault(i,s.finiteOrDefault(a,i)),max:s.finiteOrDefault(a,s.finiteOrDefault(i,a))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let 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(){s.callback(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:a,grace:n,ticks:r}=this.options,o=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=s._addGrace(this,n,a),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=o<this.ticks.length;this._convertTicksToLabels(l?tv(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||"auto"===r.source)&&(this.ticks=function(t,e){var i;let a,n,r=t.options.ticks,o=(a=(i=t).options.offset,n=i._tickSize(),Math.floor(Math.min(i._length/n+ +!a,i._maxLength/n))),l=Math.min(r.maxTicksLimit||o,o),h=r.major.enabled?function(t){let e,i,s=[];for(e=0,i=t.length;e<i;e++)t[e].major&&s.push(e);return s}(e):[],d=h.length,c=h[0],u=h[d-1],g=[];if(d>l)return function(t,e,i,s){let a,n=0,r=i[0];for(a=0,s=Math.ceil(s);a<t.length;a++)a===r&&(e.push(t[a]),r=i[++n*s])}(e,g,h,d/l),g;let f=function(t,e,i){let a=function(t){let e,i,s=t.length;if(s<2)return!1;for(i=t[0],e=1;e<s;++e)if(t[e]-t[e-1]!==i)return!1;return i}(t),n=e.length/i;if(!a)return Math.max(n,1);let r=s._factorize(a);for(let t=0,e=r.length-1;t<e;t++){let e=r[t];if(e>n)return e}return Math.max(n,1)}(h,e,l);if(d>0){let t,i,a=d>1?Math.round((u-c)/(d-1)):null;for(tx(e,g,f,s.isNullOrUndef(a)?0:c-a,c),t=0,i=d-1;t<i;t++)tx(e,g,f,h[t],h[t+1]);return tx(e,g,f,u,s.isNullOrUndef(a)?e.length:u+a),g}return tx(e,g,f),g}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){s.callback(this.options.afterUpdate,[this])}beforeSetDimensions(){s.callback(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(){s.callback(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),s.callback(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){s.callback(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e,i,a,n=this.options.ticks;for(e=0,i=t.length;e<i;e++)(a=t[e]).label=s.callback(n.callback,[a.value,e,t],this)}afterTickToLabelConversion(){s.callback(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){s.callback(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t,e,i,a=this.options,n=a.ticks,r=t_(this.ticks.length,a.ticks.maxTicksLimit),o=n.minRotation||0,l=n.maxRotation,h=o;if(!this._isVisible()||!n.display||o>=l||r<=1||!this.isHorizontal()){this.labelRotation=o;return}let d=this._getLabelSizes(),c=d.widest.width,u=d.highest.height,g=s._limitValue(this.chart.width-c,0,this.maxWidth);c+6>(t=a.offset?this.maxWidth/r:g/(r-1))&&(t=g/(r-(a.offset?.5:1)),e=this.maxHeight-ty(a.grid)-n.padding-tM(a.title,this.chart.options.font),i=Math.sqrt(c*c+u*u),h=Math.max(o,Math.min(l,h=s.toDegrees(Math.min(Math.asin(s._limitValue((d.highest.height+6)/t,-1,1)),Math.asin(s._limitValue(e/i,-1,1))-Math.asin(s._limitValue(u/i,-1,1))))))),this.labelRotation=h}afterCalculateLabelRotation(){s.callback(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){s.callback(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:a,grid:n}}=this,r=this._isVisible(),o=this.isHorizontal();if(r){let r=tM(a,e.options.font);if(o?(t.width=this.maxWidth,t.height=ty(n)+r):(t.height=this.maxHeight,t.width=ty(n)+r),i.display&&this.ticks.length){let{first:e,last:a,widest:n,highest:r}=this._getLabelSizes(),l=2*i.padding,h=s.toRadians(this.labelRotation),d=Math.cos(h),c=Math.sin(h);if(o){let e=i.mirror?0:c*n.width+d*r.height;t.height=Math.min(this.maxHeight,t.height+e+l)}else{let e=i.mirror?0:d*n.width+c*r.height;t.width=Math.min(this.maxWidth,t.width+e+l)}this._calculatePadding(e,a,c,d)}}this._handleMargins(),o?(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,i,s){let{ticks:{align:a,padding:n},position:r}=this.options,o=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){let r=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),d=0,c=0;o?l?(d=s*t.width,c=i*e.height):(d=i*t.height,c=s*e.width):"start"===a?c=e.width:"end"===a?d=t.width:"inner"!==a&&(d=t.width/2,c=e.width/2),this.paddingLeft=Math.max((d-r+n)*this.width/(this.width-r),0),this.paddingRight=Math.max((c-h+n)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===a?(i=0,s=t.height):"end"===a&&(i=e.height,s=0),this.paddingTop=i+n,this.paddingBottom=s+n}}_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(){s.callback(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)s.isNullOrUndef(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,i=this.ticks;e<i.length&&(i=tv(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){let a,n,r,o,l,h,d,c,u,g,f,{ctx:p,_longestTextCache:m}=this,x=[],b=[],_=Math.floor(e/t_(e,i)),v=0,y=0;for(a=0;a<e;a+=_){if(o=t[a].label,p.font=h=(l=this._resolveTickFontOptions(a)).string,d=m[h]=m[h]||{data:{},gc:[]},c=l.lineHeight,u=g=0,s.isNullOrUndef(o)||s.isArray(o)){if(s.isArray(o))for(n=0,r=o.length;n<r;++n)f=o[n],s.isNullOrUndef(f)||s.isArray(f)||(u=s._measureText(p,d.data,d.gc,u,f),g+=c)}else u=s._measureText(p,d.data,d.gc,u,o),g=c;x.push(u),b.push(g),v=Math.max(u,v),y=Math.max(g,y)}s.each(m,t=>{let i,s=t.gc,a=s.length/2;if(a>e){for(i=0;i<a;++i)delete t.data[s[i]];s.splice(0,a)}});let M=x.indexOf(v),w=b.indexOf(y),k=t=>({width:x[t]||0,height:b[t]||0});return{first:k(0),last:k(e-1),widest:k(M),highest:k(w),widths:x,heights:b}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return s._int16Range(this._alignToPixels?s._alignPixel(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){var e,i;let a=this.ticks||[];if(t>=0&&t<a.length){let i=a[t];return i.$context||(e=this.getContext(),i.$context=s.createContext(e,{tick:i,index:t,type:"tick"}))}return this.$context||(this.$context=(i=this.chart.getContext(),s.createContext(i,{scale:this,type:"scale"})))}_tickSize(){let t=this.options.ticks,e=s.toRadians(this.labelRotation),i=Math.abs(Math.cos(e)),a=Math.abs(Math.sin(e)),n=this._getLabelSizes(),r=t.autoSkipPadding||0,o=n?n.widest.width+r:0,l=n?n.highest.height+r:0;return this.isHorizontal()?l*i>o*a?o/i:l/a:l*a<o*i?l/i:o/a}_isVisible(){let t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e,i,a,n,r,o,l,h,d,c,u,g,f=this.axis,p=this.chart,m=this.options,{grid:x,position:b,border:_}=m,v=x.offset,y=this.isHorizontal(),M=this.ticks.length+ +!!v,w=ty(x),k=[],D=_.setContext(this.getContext()),P=D.display?D.width:0,S=P/2,O=function(t){return s._alignPixel(p,t,P)};if("top"===b)e=O(this.bottom),o=this.bottom-w,h=e-S,c=O(t.top)+S,g=t.bottom;else if("bottom"===b)e=O(this.top),c=t.top,g=O(t.bottom)-S,o=e+S,h=this.top+w;else if("left"===b)e=O(this.right),r=this.right-w,l=e-S,d=O(t.left)+S,u=t.right;else if("right"===b)e=O(this.left),d=t.left,u=O(t.right)-S,r=e+S,l=this.left+w;else if("x"===f){if("center"===b)e=O((t.top+t.bottom)/2+.5);else if(s.isObject(b)){let t=Object.keys(b)[0],i=b[t];e=O(this.chart.scales[t].getPixelForValue(i))}c=t.top,g=t.bottom,h=(o=e+S)+w}else if("y"===f){if("center"===b)e=O((t.left+t.right)/2);else if(s.isObject(b)){let t=Object.keys(b)[0],i=b[t];e=O(this.chart.scales[t].getPixelForValue(i))}l=(r=e-S)-w,d=t.left,u=t.right}let A=s.valueOrDefault(m.ticks.maxTicksLimit,M),C=Math.max(1,Math.ceil(M/A));for(i=0;i<M;i+=C){let t=this.getContext(i),e=x.setContext(t),f=_.setContext(t),m=e.lineWidth,b=e.color,M=f.dash||[],w=f.dashOffset,D=e.tickWidth,P=e.tickColor,S=e.tickBorderDash||[],O=e.tickBorderDashOffset;void 0!==(a=function(t,e,i){let s,a=t.ticks.length,n=Math.min(e,a-1),r=t._startPixel,o=t._endPixel,l=t.getPixelForTick(n);if(!i||(s=1===a?Math.max(l-r,o-l):0===e?(t.getPixelForTick(1)-l)/2:(l-t.getPixelForTick(n-1))/2,!((l+=n<e?s:-s)<r-1e-6)&&!(l>o+1e-6)))return l}(this,i,v))&&(n=s._alignPixel(p,a,m),y?r=l=d=u=n:o=h=c=g=n,k.push({tx1:r,ty1:o,tx2:l,ty2:h,x1:d,y1:c,x2:u,y2:g,width:m,color:b,borderDash:M,borderDashOffset:w,tickWidth:D,tickColor:P,tickBorderDash:S,tickBorderDashOffset:O}))}return this._ticksLength=M,this._borderValue=e,k}_computeLabelItems(t){let e,i,a,n,r,o,l,h,d,c,u,g=this.axis,f=this.options,{position:p,ticks:m}=f,x=this.isHorizontal(),b=this.ticks,{align:_,crossAlign:v,padding:y,mirror:M}=m,w=ty(f.grid),k=w+y,D=M?-y:k,P=-s.toRadians(this.labelRotation),S=[],O="middle";if("top"===p)r=this.bottom-D,o=this._getXAxisLabelAlignment();else if("bottom"===p)r=this.top+D,o=this._getXAxisLabelAlignment();else if("left"===p){let t=this._getYAxisLabelAlignment(w);o=t.textAlign,n=t.x}else if("right"===p){let t=this._getYAxisLabelAlignment(w);o=t.textAlign,n=t.x}else if("x"===g){if("center"===p)r=(t.top+t.bottom)/2+k;else if(s.isObject(p)){let t=Object.keys(p)[0],e=p[t];r=this.chart.scales[t].getPixelForValue(e)+k}o=this._getXAxisLabelAlignment()}else if("y"===g){if("center"===p)n=(t.left+t.right)/2-k;else if(s.isObject(p)){let t=Object.keys(p)[0],e=p[t];n=this.chart.scales[t].getPixelForValue(e)}o=this._getYAxisLabelAlignment(w).textAlign}"y"===g&&("start"===_?O="top":"end"===_&&(O="bottom"));let A=this._getLabelSizes();for(e=0,i=b.length;e<i;++e){let t;a=b[e].label;let g=m.setContext(this.getContext(e));l=this.getPixelForTick(e)+m.labelOffset,d=(h=this._resolveTickFontOptions(e)).lineHeight;let f=(c=s.isArray(a)?a.length:1)/2,_=g.color,y=g.textStrokeColor,w=g.textStrokeWidth,k=o;if(x?(n=l,"inner"===o&&(k=e===i-1?this.options.reverse?"left":"right":0===e?this.options.reverse?"right":"left":"center"),u="top"===p?"near"===v||0!==P?-c*d+d/2:"center"===v?-A.highest.height/2-f*d+d:-A.highest.height+d/2:"near"===v||0!==P?d/2:"center"===v?A.highest.height/2-f*d:A.highest.height-c*d,M&&(u*=-1),0===P||g.showLabelBackdrop||(n+=d/2*Math.sin(P))):(r=l,u=(1-c)*d/2),g.showLabelBackdrop){let a=s.toPadding(g.backdropPadding),n=A.heights[e],r=A.widths[e],l=u-a.top,h=0-a.left;switch(O){case"middle":l-=n/2;break;case"bottom":l-=n}switch(o){case"center":h-=r/2;break;case"right":h-=r;break;case"inner":e===i-1?h-=r:e>0&&(h-=r/2)}t={left:h,top:l,width:r+a.width,height:n+a.height,color:g.backdropColor}}S.push({label:a,font:h,textOffset:u,options:{rotation:P,color:_,strokeColor:y,strokeWidth:w,textAlign:k,textBaseline:O,translation:[n,r],backdrop:t}})}return S}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-s.toRadians(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){let e,i,{position:s,ticks:{crossAlign:a,mirror:n,padding:r}}=this.options,o=this._getLabelSizes(),l=t+r,h=o.widest.width;return"left"===s?n?(i=this.right+r,"near"===a?e="left":"center"===a?(e="center",i+=h/2):(e="right",i+=h)):(i=this.right-l,"near"===a?e="right":"center"===a?(e="center",i-=h/2):(e="left",i=this.left)):"right"===s?n?(i=this.left+r,"near"===a?e="right":"center"===a?(e="center",i-=h/2):(e="left",i-=h)):(i=this.left+l,"near"===a?e="left":"center"===a?(e="center",i+=h/2):(e="right",i=this.right)):e="right",{textAlign:e,x:i}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:s,width:a,height:n}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,a,n),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let i=this.ticks.findIndex(e=>e.value===t);return i>=0?e.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){let e,i,s=this.options.grid,a=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),r=(t,e,i)=>{i.width&&i.color&&(a.save(),a.lineWidth=i.width,a.strokeStyle=i.color,a.setLineDash(i.borderDash||[]),a.lineDashOffset=i.borderDashOffset,a.beginPath(),a.moveTo(t.x,t.y),a.lineTo(e.x,e.y),a.stroke(),a.restore())};if(s.display)for(e=0,i=n.length;e<i;++e){let t=n[e];s.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),s.drawTicks&&r({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){let t,e,i,a,{chart:n,ctx:r,options:{border:o,grid:l}}=this,h=o.setContext(this.getContext()),d=o.display?h.width:0;if(!d)return;let c=l.setContext(this.getContext(0)).lineWidth,u=this._borderValue;this.isHorizontal()?(t=s._alignPixel(n,this.left,d)-d/2,e=s._alignPixel(n,this.right,c)+c/2,i=a=u):(i=s._alignPixel(n,this.top,d)-d/2,a=s._alignPixel(n,this.bottom,c)+c/2,t=e=u),r.save(),r.lineWidth=h.width,r.strokeStyle=h.color,r.beginPath(),r.moveTo(t,i),r.lineTo(e,a),r.stroke(),r.restore()}drawLabels(t){if(!this.options.ticks.display)return;let e=this.ctx,i=this._computeLabelArea();for(let a of(i&&s.clipArea(e,i),this.getLabelItems(t))){let t=a.options,i=a.font,n=a.label,r=a.textOffset;s.renderText(e,n,0,r,i,t)}i&&s.unclipArea(e)}drawTitle(){let t,e,{ctx:i,options:{position:a,title:n,reverse:r}}=this;if(!n.display)return;let o=s.toFont(n.font),l=s.toPadding(n.padding),h=n.align,d=o.lineHeight/2;"bottom"===a||"center"===a||s.isObject(a)?(d+=l.bottom,s.isArray(n.text)&&(d+=o.lineHeight*(n.text.length-1))):d+=l.top;let{titleX:c,titleY:u,maxWidth:g,rotation:f}=function(t,e,i,a){let n,r,o,{top:l,left:h,bottom:d,right:c,chart:u}=t,{chartArea:g,scales:f}=u,p=0,m=d-l,x=c-h;if(t.isHorizontal()){if(r=s._alignStartEnd(a,h,c),s.isObject(i)){let t=Object.keys(i)[0],s=i[t];o=f[t].getPixelForValue(s)+m-e}else o="center"===i?(g.bottom+g.top)/2+m-e:tb(t,i,e);n=c-h}else{if(s.isObject(i)){let t=Object.keys(i)[0],s=i[t];r=f[t].getPixelForValue(s)-x+e}else r="center"===i?(g.left+g.right)/2-x+e:tb(t,i,e);o=s._alignStartEnd(a,d,l),p="left"===i?-s.HALF_PI:s.HALF_PI}return{titleX:r,titleY:o,maxWidth:n,rotation:p}}(this,d,a,h);s.renderText(i,n.text,0,0,o,{color:n.color,maxWidth:g,rotation:f,textAlign:(t=s._toLeftRightCenter(h),(r&&"right"!==a||!r&&"right"===a)&&(t="left"===(e=t)?"right":"right"===e?"left":e),t),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,e=t.ticks&&t.ticks.z||0,i=s.valueOrDefault(t.grid&&t.grid.z,-1),a=s.valueOrDefault(t.border&&t.border.z,0);return this._isVisible()&&this.draw===tw.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:a,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){let e,i,s=this.chart.getSortedVisibleDatasetMetas(),a=this.axis+"AxisID",n=[];for(e=0,i=s.length;e<i;++e){let i=s[e];i[a]!==this.id||t&&i.type!==t||n.push(i)}return n}_resolveTickFontOptions(t){let e=this.options.ticks.setContext(this.getContext(t));return s.toFont(e.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class tk{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){var e,i,a,n,r,o;let l,h,d=Object.getPrototypeOf(t);"id"in(e=d)&&"defaults"in e&&(h=this.register(d));let c=this.items,u=t.id,g=this.scope+"."+u;if(!u)throw Error("class does not have id: "+t);return u in c||(c[u]=t,i=t,a=g,n=h,l=s.merge(Object.create(null),[n?s.defaults.get(n):{},s.defaults.get(a),i.defaults]),s.defaults.set(a,l),i.defaultRoutes&&(r=a,Object.keys(o=i.defaultRoutes).forEach(t=>{let e=t.split("."),i=e.pop(),a=[r].concat(e).join("."),n=o[t].split("."),l=n.pop(),h=n.join(".");s.defaults.route(a,i,h,l)})),i.descriptors&&s.defaults.describe(a,i.descriptors),this.override&&s.defaults.override(t.id,t.overrides)),g}get(t){return this.items[t]}unregister(t){let e=this.items,i=t.id,a=this.scope;i in e&&delete e[i],a&&i in s.defaults[a]&&(delete s.defaults[a][i],this.override&&delete s.overrides[i])}}class tD{constructor(){this.controllers=new tk(v,"datasets",!0),this.elements=new tk(tm,"elements"),this.plugins=new tk(Object,"plugins"),this.scales=new tk(tw,"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,i){[...e].forEach(e=>{let a=i||this._getRegistryForType(e);i||a.isForType(e)||a===this.plugins&&e.id?this._exec(t,a,e):s.each(e,e=>{let s=i||this._getRegistryForType(e);this._exec(t,s,e)})})}_exec(t,e,i){let a=s._capitalize(t);s.callback(i["before"+a],[],i),e[t](i),s.callback(i["after"+a],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){let s=e.get(t);if(void 0===s)throw Error('"'+t+'" is not a registered '+i+".");return s}}var tP=new tD;class tS{constructor(){this._init=void 0}notify(t,e,i,s){if("beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),void 0===this._init)return;let a=s?this._descriptors(t).filter(s):this._descriptors(t),n=this._notify(a,t,e,i);return"afterDestroy"===e&&(this._notify(a,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),n}_notify(t,e,i,a){for(let n of(a=a||{},t)){let t=n.plugin,r=t[i],o=[e,a,n.options];if(!1===s.callback(r,o,t)&&a.cancelable)return!1}return!0}invalidate(){s.isNullOrUndef(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;let e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){let i=t&&t.config,a=s.valueOrDefault(i.options&&i.options.plugins,{}),n=function(t){let e={},i=[],s=Object.keys(tP.plugins.items);for(let t=0;t<s.length;t++)i.push(tP.getPlugin(s[t]));let a=t.plugins||[];for(let t=0;t<a.length;t++){let s=a[t];-1===i.indexOf(s)&&(i.push(s),e[s.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==a||e?function(t,{plugins:e,localIds:i},s,a){let n=[],r=t.getContext();for(let l of e){var o;let e=l.id,h=(o=s[e],a||!1!==o?!0===o?{}:o:null);null!==h&&n.push({plugin:l,options:function(t,{plugin:e,local:i},s,a){let n=t.pluginScopeKeys(e),r=t.getOptionScopes(s,n);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,a,[""],{scriptable:!1,indexable:!1,allKeys:!0})}(t.config,{plugin:l,local:i[e]},h,r)})}return n}(t,n,a,e):[]}_notifyStateChanges(t){let e=this._oldCache||[],i=this._cache,s=(t,e)=>t.filter(t=>!e.some(e=>t.plugin.id===e.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function tO(t,e){let i=s.defaults.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function tA(t){if("x"===t||"y"===t||"r"===t)return t}function tC(t,...e){if(tA(t))return t;for(let s of e){var i;let e=s.axis||("top"===(i=s.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&tA(t[0].toLowerCase());if(e)return e}throw Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function tL(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function tT(t){let e,i,a,n,r=t.options||(t.options={});r.plugins=s.valueOrDefault(r.plugins,{}),e=s.overrides[t.type]||{scales:{}},i=r.scales||{},a=tO(t.type,r),n=Object.create(null),Object.keys(i).forEach(r=>{let o=i[r];if(!s.isObject(o))return console.error(`Invalid scale configuration for scale: ${r}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let l=tC(r,o,function(t,e){if(e.data&&e.data.datasets){let i=e.data.datasets.filter(e=>e.xAxisID===t||e.yAxisID===t);if(i.length)return tL(t,"x",i[0])||tL(t,"y",i[0])}return{}}(r,t),s.defaults.scales[o.type]),h=l===a?"_index_":"_value_",d=e.scales||{};n[r]=s.mergeIf(Object.create(null),[{axis:l},o,d[l],d[h]])}),t.data.datasets.forEach(e=>{let a=e.type||t.type,o=e.indexAxis||tO(a,r),l=(s.overrides[a]||{}).scales||{};Object.keys(l).forEach(t=>{let a,r=(a=t,"_index_"===t?a=o:"_value_"===t&&(a="x"===o?"y":"x"),a),h=e[r+"AxisID"]||r;n[h]=n[h]||Object.create(null),s.mergeIf(n[h],[{axis:r},i[h],l[t]])})}),Object.keys(n).forEach(t=>{let e=n[t];s.mergeIf(e,[s.defaults.scales[e.type],s.defaults.scale])}),r.scales=n}function tE(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}let tR=new Map,tF=new Set;function tz(t,e){let i=tR.get(t);return i||(i=e(),tR.set(t,i),tF.add(i)),i}let tV=(t,e,i)=>{let a=s.resolveObjectKey(e,i);void 0!==a&&t.add(a)};class tI{constructor(t){this._config=function(t){return(t=t||{}).data=tE(t.data),tT(t),t}(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=tE(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),tT(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return tz(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return tz(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return tz(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return tz(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:a,type:n}=this,r=this._cachedScopes(t,i),o=r.get(e);if(o)return o;let l=new Set;e.forEach(e=>{t&&(l.add(t),e.forEach(e=>tV(l,t,e))),e.forEach(t=>tV(l,a,t)),e.forEach(t=>tV(l,s.overrides[n]||{},t)),e.forEach(t=>tV(l,s.defaults,t)),e.forEach(t=>tV(l,s.descriptors,t))});let h=Array.from(l);return 0===h.length&&h.push(Object.create(null)),tF.has(e)&&r.set(e,h),h}chartOptionScopes(){let{options:t,type:e}=this;return[t,s.overrides[e]||{},s.defaults.datasets[e]||{},{type:e},s.defaults,s.descriptors]}resolveNamedOptions(t,e,i,a=[""]){let n={$shared:!0},{resolver:r,subPrefixes:o}=tB(this._resolverCache,t,a),l=r;if(function(t,e){let{isScriptable:i,isIndexable:a}=s._descriptors(t);for(let n of e){let e=i(n),r=a(n),o=(r||e)&&t[n];if(e&&(s.isFunction(o)||tN(o))||r&&s.isArray(o))return!0}return!1}(r,e)){n.$shared=!1,i=s.isFunction(i)?i():i;let e=this.createResolver(t,i,o);l=s._attachContext(r,i,e)}for(let t of e)n[t]=l[t];return n}createResolver(t,e,i=[""],a){let{resolver:n}=tB(this._resolverCache,t,i);return s.isObject(e)?s._attachContext(n,e,void 0,a):n}}function tB(t,e,i){let a=t.get(e);a||(a=new Map,t.set(e,a));let n=i.join(),r=a.get(n);return r||(r={resolver:s._createResolver(e,i),subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},a.set(n,r)),r}let tN=t=>s.isObject(t)&&Object.getOwnPropertyNames(t).some(e=>s.isFunction(t[e])),tH=["top","bottom","left","right","chartArea"];function tj(t,e){return"top"===t||"bottom"===t||-1===tH.indexOf(t)&&"x"===e}function tW(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function tU(t){let e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),s.callback(i&&i.onComplete,[t],e)}function t$(t){let e=t.chart,i=e.options.animation;s.callback(i&&i.onProgress,[t],e)}function tq(t){return s._isDomSupported()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}let tK={},tX=t=>{let e=tq(t);return Object.values(tK).filter(t=>t.canvas===e).pop()};class tJ{static defaults=s.defaults;static instances=tK;static overrides=s.overrides;static registry=tP;static version="4.5.1";static getChart=tX;static register(...t){tP.add(...t),tY()}static unregister(...t){tP.remove(...t),tY()}constructor(t,e){const i=this.config=new tI(e),a=tq(t),r=tX(a);if(r)throw Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||tp(a)),this.platform.updateConfig(i);const l=this.platform.acquireContext(a,o.aspectRatio),h=l&&l.canvas,d=h&&h.height,c=h&&h.width;if(this.id=s.uid(),this.ctx=l,this.canvas=h,this.width=c,this.height=d,this._options=o,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 tS,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=s.debounce(t=>this.update(t),o.resizeDelay||0),this._dataChanges=[],tK[this.id]=this,!l||!h)return void console.error("Failed to create chart: can't acquire context from the given item");n.listen(this,"complete",tU),n.listen(this,"progress",t$),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:a,_aspectRatio:n}=this;return s.isNullOrUndef(t)?e&&n?n:a?i/a: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 tP}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():s.retinaScale(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return s.clearCanvas(this.canvas,this.ctx),this}stop(){return n.stop(this),this}resize(t,e){n.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,a=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(a,t,e,n),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,s.retinaScale(this,o,!0)&&(this.notifyPlugins("resize",{size:r}),s.callback(i.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let t=this.options.scales||{};s.each(t,(t,e)=>{t.id=e})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,a=Object.keys(i).reduce((t,e)=>(t[e]=!1,t),{}),n=[];e&&(n=n.concat(Object.keys(e).map(t=>{let i=e[t],s=tC(t,i),a="r"===s,n="x"===s;return{options:i,dposition:a?"chartArea":n?"bottom":"left",dtype:a?"radialLinear":n?"category":"linear"}}))),s.each(n,e=>{let n=e.options,r=n.id,o=tC(r,n),l=s.valueOrDefault(n.type,e.dtype);(void 0===n.position||tj(n.position,o)!==tj(e.dposition))&&(n.position=e.dposition),a[r]=!0;let h=null;r in i&&i[r].type===l?h=i[r]:i[(h=new(tP.getScale(l))({id:r,type:l,ctx:this.ctx,chart:this})).id]=h,h.init(n,t)}),s.each(a,(t,e)=>{t||delete i[e]}),s.each(i,t=>{Z.configure(this,t,t.options),Z.addBox(this,t)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(tW("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((t,i)=>{0===e.filter(e=>e===t._dataset).length&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){let t,e,i=[],a=this.data.datasets;for(this._removeUnreferencedMetasets(),t=0,e=a.length;t<e;t++){let e=a[t],n=this.getDatasetMeta(t),r=e.type||this.config.type;if(n.type&&n.type!==r&&(this._destroyDatasetMeta(t),n=this.getDatasetMeta(t)),n.type=r,n.indexAxis=e.indexAxis||tO(r,this.options),n.order=e.order||0,n.index=t,n.label=""+e.label,n.visible=this.isDatasetVisible(t),n.controller)n.controller.updateIndex(t),n.controller.linkScales();else{let e=tP.getController(r),{datasetElementType:a,dataElementType:o}=s.defaults.datasets[r];Object.assign(e,{dataElementType:tP.getElement(o),datasetElementType:a&&tP.getElement(a)}),n.controller=new e(this,t),i.push(n.controller)}}return this._updateMetasets(),i}_resetElements(){s.each(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),a=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;let n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let t=0,e=this.data.datasets.length;t<e;t++){let{controller:e}=this.getDatasetMeta(t),i=!a&&-1===n.indexOf(e);e.buildOrUpdateElements(i),r=Math.max(+e.getMaxOverflow(),r)}r=this._minPadding=i.layout.autoPadding?r:0,this._updateLayout(r),a||s.each(n,t=>{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(tW("z","_idx"));let{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){s.each(this.scales,t=>{Z.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);s.setsEqual(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this;for(let{method:i,start:s,count:a}of this._getUniformDataChanges()||[]){var e="_removeElements"===i?-a:a;for(let i of Object.keys(t)){let a=+i;if(a>=s){let n=t[i];delete t[i],(e>0||a>s)&&(t[a+e]=n)}}}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),a=i(0);for(let t=1;t<e;t++)if(!s.setsEqual(a,i(t)))return;return Array.from(a).map(t=>t.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Z.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],s.each(this.boxes,t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,e)=>{t._idx=e}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,s.isFunction(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(n.has(this)?this.attached&&!n.running(this)&&n.start(this):(this.draw(),tU({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0||!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;let 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){let e,i,s=this._sortedMetasets,a=[];for(e=0,i=s.length;e<i;++e){let i=s[e];(!t||i.visible)&&a.push(i)}return a}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;let t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i={meta:t,index:t.index,cancelable:!0},a=s.getDatasetClipArea(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(a&&s.clipArea(e,a),t.controller.draw(),a&&s.unclipArea(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return s._isPointInArea(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let a=j.modes[e];return"function"==typeof a?a(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.filter(t=>t&&t._dataset===e).pop();return s||(s={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},i.push(s)),s}getContext(){return this.$context||(this.$context=s.createContext(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let a=i?"show":"hide",n=this.getDatasetMeta(t),r=n.controller._resolveAnimations(void 0,a);s.defined(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(n,{visible:i}),this.update(e=>e.datasetIndex===t?a:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),n.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),s.clearCanvas(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete tK[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},a=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};s.each(this.options.events,t=>i(t,a))}bindResponsiveEvents(){let t;this._responsiveListeners||(this._responsiveListeners={});let e=this._responsiveListeners,i=this.platform,s=(t,s)=>{i.addEventListener(this,t,s),e[t]=s},a=(t,s)=>{e[t]&&(i.removeEventListener(this,t,s),delete e[t])},n=(t,e)=>{this.canvas&&this.resize(t,e)},r=()=>{a("attach",r),this.attached=!0,this.resize(),s("resize",n),s("detach",t)};t=()=>{this.attached=!1,a("resize",n),this._stop(),this._resize(0,0),s("attach",r)},i.isAttached(this.canvas)?r():t()}unbindEvents(){s.each(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},s.each(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let s,a,n,r=i?"set":"remove";for("dataset"===e&&this.getDatasetMeta(t[0].datasetIndex).controller["_"+r+"DatasetHoverStyle"](),a=0,n=t.length;a<n;++a){let e=(s=t[a])&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[r+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let e=this._active||[],i=t.map(({datasetIndex:t,index:e})=>{let i=this.getDatasetMeta(t);if(!i)throw Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}});s._elementsEqual(i,e)||(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter(e=>e.plugin.id===t).length}_updateHoverStyles(t,e,i){let s=this.options.hover,a=(t,e)=>t.filter(t=>!e.some(e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)),n=a(e,t),r=i?t:a(t,e);n.length&&this.updateHoverStyle(n,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;let a=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(a||i.changed)&&this.render(),this}_handleEvent(t,e,i){var a;let{_active:n=[],options:r}=this,o=this._getActiveElements(t,n,i,e),l=s._isClickEvent(t),h=(a=this._lastEvent,i&&"mouseout"!==t.type?l?a:t:null);i&&(this._lastEvent=null,s.callback(r.onHover,[t,o,this],this),l&&s.callback(r.onClick,[t,o,this],this));let d=!s._elementsEqual(o,n);return(d||e)&&(this._active=o,this._updateHoverStyles(o,n,e)),this._lastEvent=h,d}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;let a=this.options.hover;return this.getElementsAtEventForMode(t,a.mode,a,s)}}function tY(){return s.each(tJ.instances,t=>t._plugins.invalidate())}function tG(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function tZ(t,e,i,a,n,r){var o,l;let h,d,c,u,{x:g,y:f,startAngle:p,pixelMargin:m,innerRadius:x}=e,b=Math.max(e.outerRadius+a+i-m,0),_=x>0?x+a+i+m:0,v=0,y=n-p;if(a){let t=b>0?b-a:0,e=((x>0?x-a:0)+t)/2;v=(y-(0!==e?y*e/(e+a):y))/2}let M=Math.max(.001,y*b-i/s.PI)/b,w=(y-M)/2,k=p+w+v,D=n-w-v,{outerStart:P,outerEnd:S,innerStart:O,innerEnd:A}=(o=D-k,l=e.options.borderRadius,h=s._readValueToProps(l,["outerStart","outerEnd","innerStart","innerEnd"]),c=Math.min(d=(b-_)/2,o*_/2),{outerStart:(u=t=>{let e=(b-Math.min(d,t))*o/2;return s._limitValue(t,0,Math.min(d,e))})(h.outerStart),outerEnd:u(h.outerEnd),innerStart:s._limitValue(h.innerStart,0,c),innerEnd:s._limitValue(h.innerEnd,0,c)}),C=b-P,L=b-S,T=k+P/C,E=D-S/L,R=_+O,F=_+A,z=k+O/R,V=D-A/F;if(t.beginPath(),r){let e=(T+E)/2;if(t.arc(g,f,b,T,e),t.arc(g,f,b,e,E),S>0){let e=tG(L,E,g,f);t.arc(e.x,e.y,S,E,D+s.HALF_PI)}let i=tG(F,D,g,f);if(t.lineTo(i.x,i.y),A>0){let e=tG(F,V,g,f);t.arc(e.x,e.y,A,D+s.HALF_PI,V+Math.PI)}let a=(D-A/_+(k+O/_))/2;if(t.arc(g,f,_,D-A/_,a,!0),t.arc(g,f,_,a,k+O/_,!0),O>0){let e=tG(R,z,g,f);t.arc(e.x,e.y,O,z+Math.PI,k-s.HALF_PI)}let n=tG(C,k,g,f);if(t.lineTo(n.x,n.y),P>0){let e=tG(C,T,g,f);t.arc(e.x,e.y,P,k-s.HALF_PI,T)}}else{t.moveTo(g,f);let e=Math.cos(T)*b+g,i=Math.sin(T)*b+f;t.lineTo(e,i);let s=Math.cos(E)*b+g,a=Math.sin(E)*b+f;t.lineTo(s,a)}t.closePath()}class tQ extends tm{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),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,t&&Object.assign(this,t)}inRange(t,e,i){let a=this.getProps(["x","y"],i),{angle:n,distance:r}=s.getAngleFromPoint(a,{x:t,y:e}),{startAngle:o,endAngle:l,innerRadius:h,outerRadius:d,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,g=s.valueOrDefault(c,l-o),f=s._angleBetween(n,o,l)&&o!==l,p=g>=s.TAU||f,m=s._isBetween(r,h+u,d+u);return p&&m}getCenterPoint(t){let{x:e,y:i,startAngle:s,endAngle:a,innerRadius:n,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:o,spacing:l}=this.options,h=(s+a)/2,d=(n+r+l+o)/2;return{x:e+Math.cos(h)*d,y:i+Math.sin(h)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){let{options:e,circumference:i}=this,a=(e.offset||0)/4,n=(e.spacing||0)/2,r=e.circular;if(this.pixelMargin=.33*("inner"===e.borderAlign),this.fullCircles=i>s.TAU?Math.floor(i/s.TAU):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let o=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(o)*a,Math.sin(o)*a);let l=a*(1-Math.sin(Math.min(s.PI,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,a,n){let{fullCircles:r,startAngle:o,circumference:l}=e,h=e.endAngle;if(r){tZ(t,e,i,a,h,n);for(let e=0;e<r;++e)t.fill();isNaN(l)||(h=o+(l%s.TAU||s.TAU))}tZ(t,e,i,a,h,n),t.fill()}(t,this,l,n,r),function(t,e,i,a,n){let{fullCircles:r,startAngle:o,circumference:l,options:h}=e,{borderWidth:d,borderJoinStyle:c,borderDash:u,borderDashOffset:g,borderRadius:f}=h,p="inner"===h.borderAlign;if(!d)return;t.setLineDash(u||[]),t.lineDashOffset=g,p?(t.lineWidth=2*d,t.lineJoin=c||"round"):(t.lineWidth=d,t.lineJoin=c||"bevel");let m=e.endAngle;if(r){tZ(t,e,i,a,m,n);for(let e=0;e<r;++e)t.stroke();isNaN(l)||(m=o+(l%s.TAU||s.TAU))}p&&function(t,e,i){let{startAngle:a,pixelMargin:n,x:r,y:o,outerRadius:l,innerRadius:h}=e,d=n/l;t.beginPath(),t.arc(r,o,l,a-d,i+d),h>n?(d=n/h,t.arc(r,o,h,i+d,a-d,!0)):t.arc(r,o,n,i+s.HALF_PI,a-s.HALF_PI),t.closePath(),t.clip()}(t,e,m),h.selfJoin&&m-o>=s.PI&&0===f&&"miter"!==c&&function(t,e,i){let{startAngle:a,x:n,y:r,outerRadius:o,innerRadius:l,options:h}=e,{borderWidth:d,borderJoinStyle:c}=h,u=Math.min(d/o,s._normalizeAngle(a-i));if(t.beginPath(),t.arc(n,r,o-d/2,a+u/2,i-u/2),l>0){let e=Math.min(d/l,s._normalizeAngle(a-i));t.arc(n,r,l+d/2,i-e/2,a+e/2,!0)}else{let e=Math.min(d/2,o*s._normalizeAngle(a-i));if("round"===c)t.arc(n,r,e,i-s.PI/2,a+s.PI/2,!0);else if("bevel"===c){let o=2*e*e,l=-o*Math.cos(i+s.PI/2)+n,h=-o*Math.sin(i+s.PI/2)+r,d=o*Math.cos(a+s.PI/2)+n,c=o*Math.sin(a+s.PI/2)+r;t.lineTo(l,h),t.lineTo(d,c)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}(t,e,m),r||(tZ(t,e,i,a,m,n),t.stroke())}(t,this,l,n,r),t.restore()}}function t0(t,e,i=e){t.lineCap=s.valueOrDefault(i.borderCapStyle,e.borderCapStyle),t.setLineDash(s.valueOrDefault(i.borderDash,e.borderDash)),t.lineDashOffset=s.valueOrDefault(i.borderDashOffset,e.borderDashOffset),t.lineJoin=s.valueOrDefault(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=s.valueOrDefault(i.borderWidth,e.borderWidth),t.strokeStyle=s.valueOrDefault(i.borderColor,e.borderColor)}function t1(t,e,i){t.lineTo(i.x,i.y)}function t2(t,e,i={}){let s=t.length,{start:a=0,end:n=s-1}=i,{start:r,end:o}=e,l=Math.max(a,r),h=Math.min(n,o);return{count:s,start:l,loop:e.loop,ilen:h<l&&!(a<r&&n<r||a>o&&n>o)?s+h-l:h-l}}function t5(t,e,i,a){let n,r,o,{points:l,options:h}=e,{count:d,start:c,loop:u,ilen:g}=t2(l,i,a),f=h.stepped?s._steppedLineTo:h.tension||"monotone"===h.cubicInterpolationMode?s._bezierCurveTo:t1,{move:p=!0,reverse:m}=a||{};for(n=0;n<=g;++n)(r=l[(c+(m?g-n:n))%d]).skip||(p?(t.moveTo(r.x,r.y),p=!1):f(t,o,r,m,h.stepped),o=r);return u&&f(t,o,r=l[(c+(m?g:0))%d],m,h.stepped),!!u}function t3(t,e,i,s){let a,n,r,o,l,h,d=e.points,{count:c,start:u,ilen:g}=t2(d,i,s),{move:f=!0,reverse:p}=s||{},m=0,x=0,b=t=>(u+(p?g-t:t))%c,_=()=>{o!==l&&(t.lineTo(m,l),t.lineTo(m,o),t.lineTo(m,h))};for(f&&(n=d[b(0)],t.moveTo(n.x,n.y)),a=0;a<=g;++a){if((n=d[b(a)]).skip)continue;let e=n.x,i=n.y,s=0|e;s===r?(i<o?o=i:i>l&&(l=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),r=s,x=0,o=l=i),h=i}_()}function t6(t){let e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?t5:t3}let t4="function"==typeof Path2D;class t9 extends tm{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};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){let i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){let a=i.spanGaps?this._loop:this._fullLoop;s._updateBezierControlPoints(this._points,i,t,a,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=s._computeSegments(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i,a,n=this.options,r=t[e],o=this.points,l=s._boundSegments(this,{property:e,start:r,end:r});if(!l.length)return;let h=[],d=n.stepped?s._steppedInterpolation:n.tension||"monotone"===n.cubicInterpolationMode?s._bezierInterpolation:s._pointInLine;for(i=0,a=l.length;i<a;++i){let{start:s,end:a}=l[i],c=o[s],u=o[a];if(c===u){h.push(c);continue}let g=Math.abs((r-c[e])/(u[e]-c[e])),f=d(c,u,g,n.stepped);f[e]=t[e],h.push(f)}return 1===h.length?h[0]:h}pathSegment(t,e,i){return t6(this)(t,this,e,i)}path(t,e,i){let s=this.segments,a=t6(this),n=this._loop;for(let r of(e=e||0,i=i||this.points.length-e,s))n&=a(t,this,r,{start:e,end:e+i-1});return!!n}draw(t,e,i,s){let a=this.options||{};(this.points||[]).length&&a.borderWidth&&(t.save(),function(t,e,i,s){if(t4&&!e.options.segment){let a;(a=e._path)||(a=e._path=new Path2D,e.path(a,i,s)&&a.closePath()),t0(t,e.options),t.stroke(a)}else!function(t,e,i,s){let{segments:a,options:n}=e,r=t6(e);for(let o of a)t0(t,n,o.style),t.beginPath(),r(t,e,o,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function t7(t,e,i,s){let a=t.options,{[i]:n}=t.getProps([i],s);return Math.abs(e-n)<a.radius+a.hitRadius}class t8 extends tm{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){let s=this.options,{x:a,y:n}=this.getProps(["x","y"],i);return Math.pow(t-a,2)+Math.pow(e-n,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return t7(this,t,"x",e)}inYRange(t,e){return t7(this,t,"y",e)}getCenterPoint(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0,i=(e=Math.max(e,e&&t.hoverRadius||0))&&t.borderWidth||0;return(e+i)*2}draw(t,e){let i=this.options;!this.skip&&!(i.radius<.1)&&s._isPointInArea(this,e,this.size(i)/2)&&(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,s.drawPoint(t,i,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}}function et(t,e){let i,s,a,n,r,{x:o,y:l,base:h,width:d,height:c}=t.getProps(["x","y","base","width","height"],e);return t.horizontal?(r=c/2,i=Math.min(o,h),s=Math.max(o,h),a=l-r,n=l+r):(i=o-(r=d/2),s=o+r,a=Math.min(l,h),n=Math.max(l,h)),{left:i,top:a,right:s,bottom:n}}function ee(t,e,i,a){return t?0:s._limitValue(e,i,a)}function ei(t,e,i,a){let n=null===e,r=null===i,o=t&&!(n&&r)&&et(t,a);return o&&(n||s._isBetween(e,o.left,o.right))&&(r||s._isBetween(i,o.top,o.bottom))}function es(t,e){t.rect(e.x,e.y,e.w,e.h)}function ea(t,e,i={}){let s=t.x!==i.x?-e:0,a=t.y!==i.y?-e:0,n=(t.x+t.w!==i.x+i.w?e:0)-s,r=(t.y+t.h!==i.y+i.h?e:0)-a;return{x:t.x+s,y:t.y+a,w:t.w+n,h:t.h+r,radius:t.radius}}class en extends tm{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};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){var e,i,a;let n,r,o,l,h,d,c,u,{inflateAmount:g,options:{borderColor:f,backgroundColor:p}}=this,{inner:m,outer:x}=(r=(n=et(this)).right-n.left,o=n.bottom-n.top,e=r/2,i=o/2,l=this.options.borderWidth,h=this.borderSkipped,d=s.toTRBL(l),c={t:ee(h.top,d.top,0,i),r:ee(h.right,d.right,0,e),b:ee(h.bottom,d.bottom,0,i),l:ee(h.left,d.left,0,e)},u=function(t,e,i){let{enableBorderRadius:a}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,r=s.toTRBLCorners(n),o=Math.min(e,i),l=t.borderSkipped,h=a||s.isObject(n);return{topLeft:ee(!h||l.top||l.left,r.topLeft,0,o),topRight:ee(!h||l.top||l.right,r.topRight,0,o),bottomLeft:ee(!h||l.bottom||l.left,r.bottomLeft,0,o),bottomRight:ee(!h||l.bottom||l.right,r.bottomRight,0,o)}}(this,r/2,o/2),{outer:{x:n.left,y:n.top,w:r,h:o,radius:u},inner:{x:n.left+c.l,y:n.top+c.t,w:r-c.l-c.r,h:o-c.t-c.b,radius:{topLeft:Math.max(0,u.topLeft-Math.max(c.t,c.l)),topRight:Math.max(0,u.topRight-Math.max(c.t,c.r)),bottomLeft:Math.max(0,u.bottomLeft-Math.max(c.b,c.l)),bottomRight:Math.max(0,u.bottomRight-Math.max(c.b,c.r))}}}),b=(a=x.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?s.addRoundedRectPath:es;t.save(),(x.w!==m.w||x.h!==m.h)&&(t.beginPath(),b(t,ea(x,g,m)),t.clip(),b(t,ea(m,-g,x)),t.fillStyle=f,t.fill("evenodd")),t.beginPath(),b(t,ea(m,g)),t.fillStyle=p,t.fill(),t.restore()}inRange(t,e,i){return ei(this,t,e,i)}inXRange(t,e){return ei(this,t,null,e)}inYRange(t,e){return ei(this,null,t,e)}getCenterPoint(t){let{x:e,y:i,base:s,horizontal:a}=this.getProps(["x","y","base","horizontal"],t);return{x:a?(e+s)/2:e,y:a?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}var er=Object.freeze({__proto__:null,ArcElement:tQ,BarElement:en,LineElement:t9,PointElement:t8});let eo=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],el=eo.map(t=>t.replace("rgb(","rgba(").replace(")",", 0.5)"));function eh(t){return eo[t%eo.length]}function ed(t){return el[t%el.length]}function ec(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var eu={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){let a;if(!i.enabled)return;let{data:{datasets:n},options:r}=t.config,{elements:o}=r,l=ec(n)||r&&(r.borderColor||r.backgroundColor)||o&&ec(o)||"rgba(0,0,0,0.1)"!==s.defaults.borderColor||"rgba(0,0,0,0.1)"!==s.defaults.backgroundColor;if(!i.forceOverride&&l)return;let h=(a=0,(e,i)=>{var s,n,r;let o=t.getDatasetMeta(i).controller;o instanceof O?(s=a,e.backgroundColor=e.data.map(()=>eh(s++)),a=s):o instanceof C?(n=a,e.backgroundColor=e.data.map(()=>ed(n++)),a=n):o&&(e.borderColor=eh(r=a),e.backgroundColor=ed(r),a=++r)});n.forEach(h)}};function eg(t){if(t._decimated){let e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function ef(t){t.data.datasets.forEach(t=>{eg(t)})}var ep={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void ef(t);let a=t.width;t.data.datasets.forEach((e,n)=>{let r,{_data:o,indexAxis:l}=e,h=t.getDatasetMeta(n),d=o||e.data;if("y"===s.resolve([l,t.options.indexAxis])||!h.controller.supportsDecimation)return;let c=t.scales[h.xAxisID];if("linear"!==c.type&&"time"!==c.type||t.options.parsing)return;let{start:u,count:g}=function(t,e){let i,a=e.length,n=0,{iScale:r}=t,{min:o,max:l,minDefined:h,maxDefined:d}=r.getUserBounds();return h&&(n=s._limitValue(s._lookupByKey(e,r.axis,o).lo,0,a-1)),i=d?s._limitValue(s._lookupByKey(e,r.axis,l).hi+1,n,a)-n:a-n,{start:n,count:i}}(h,d);if(g<=(i.threshold||4*a))return void eg(e);switch(s.isNullOrUndef(o)&&(e._data=d,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":r=function(t,e,i,s,a){let n,r,o,l,h,d=a.samples||s;if(d>=i)return t.slice(e,e+i);let c=[],u=(i-2)/(d-2),g=0,f=e+i-1,p=e;for(n=0,c[g++]=t[p];n<d-2;n++){let s,a=0,d=0,f=Math.floor((n+1)*u)+1+e,m=Math.min(Math.floor((n+2)*u)+1,i)+e,x=m-f;for(s=f;s<m;s++)a+=t[s].x,d+=t[s].y;a/=x,d/=x;let b=Math.floor(n*u)+1+e,_=Math.min(Math.floor((n+1)*u)+1,i)+e,{x:v,y:y}=t[p];for(o=l=-1,s=b;s<_;s++)(l=.5*Math.abs((v-a)*(t[s].y-y)-(v-t[s].x)*(d-y)))>o&&(o=l,r=t[s],h=s);c[g++]=r,p=h}return c[g++]=t[f],c}(d,u,g,a,i);break;case"min-max":r=function(t,e,i,a){let n,r,o,l,h,d,c,u,g,f,p=0,m=0,x=[],b=t[e].x,_=t[e+i-1].x-b;for(n=e;n<e+i;++n){o=((r=t[n]).x-b)/_*a,l=r.y;let e=0|o;if(e===h)l<g?(g=l,d=n):l>f&&(f=l,c=n),p=(m*p+r.x)/++m;else{let i=n-1;if(!s.isNullOrUndef(d)&&!s.isNullOrUndef(c)){let e=Math.min(d,c),s=Math.max(d,c);e!==u&&e!==i&&x.push({...t[e],x:p}),s!==u&&s!==i&&x.push({...t[s],x:p})}n>0&&i!==u&&x.push(t[i]),x.push(r),h=e,m=0,g=f=l,d=c=u=n}}return x}(d,u,g,a);break;default:throw Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=r})},destroy(t){ef(t)}};function em(t,e,i,a){if(a)return;let n=e[t],r=i[t];return"angle"===t&&(n=s._normalizeAngle(n),r=s._normalizeAngle(r)),{property:t,start:n,end:r}}function ex(t,e,i){for(;e>t;e--){let t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function eb(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function e_(t,e){let i=[],a=!1;return s.isArray(t)?(a=!0,i=t):i=function(t,e){let{x:i=null,y:s=null}=t||{},a=e.points,n=[];return e.segments.forEach(({start:t,end:e})=>{e=ex(t,e,a);let r=a[t],o=a[e];null!==s?(n.push({x:r.x,y:s}),n.push({x:o.x,y:s})):null!==i&&(n.push({x:i,y:r.y}),n.push({x:i,y:o.y}))}),n}(t,e),i.length?new t9({points:i,options:{tension:0},_loop:a,_fullLoop:a}):null}function ev(t){return t&&!1!==t.fill}class ey{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){let{x:a,y:n,radius:r}=this;return e=e||{start:0,end:s.TAU},t.arc(a,n,r,e.end,e.start,!0),!i.bounds}interpolate(t){let{x:e,y:i,radius:s}=this,a=t.angle;return{x:e+Math.cos(a)*s,y:i+Math.sin(a)*s,angle:a}}}function eM(t,e,i){let a=function(t){var e,i,a;let{chart:n,fill:r,line:o}=t;if(s.isNumberFinite(r)){let t;return e=n,i=r,(t=e.getDatasetMeta(i))&&e.isDatasetVisible(i)?t.dataset:null}if("stack"===r)return function(t){let{scale:e,index:i,line:a}=t,n=[],r=a.segments,o=a.points,l=function(t,e){let i=[],s=t.getMatchingVisibleMetas("line");for(let t=0;t<s.length;t++){let a=s[t];if(a.index===e)break;a.hidden||i.unshift(a.dataset)}return i}(e,i);l.push(e_({x:null,y:e.bottom},a));for(let t=0;t<r.length;t++){let e=r[t];for(let t=e.start;t<=e.end;t++)!function(t,e,i){let a=[];for(let n=0;n<i.length;n++){let{first:r,last:o,point:l}=function(t,e){let i=t.interpolate(e,"x");if(!i)return{};let a=i.x,n=t.segments,r=t.points,o=!1,l=!1;for(let t=0;t<n.length;t++){let e=n[t],i=r[e.start].x,h=r[e.end].x;if(s._isBetween(a,i,h)){o=a===i,l=a===h;break}}return{first:o,last:l,point:i}}(i[n],e);if(l&&(!r||!o)){if(r)a.unshift(l);else if(t.push(l),!o)break}}t.push(...a)}(n,o[t],l)}return new t9({points:n,options:{}})}(t);if("shape"===r)return!0;let l=((a=t).scale||{}).getPointPositionForValue?function(t){let{scale:e,fill:i}=t,a=e.options,n=e.getLabels().length,r=a.reverse?e.max:e.min,o="start"===i?r:"end"===i?e.options.reverse?e.min:e.max:s.isObject(i)?i.value:e.getBaseValue(),l=[];if(a.grid.circular){let t=e.getPointPositionForValue(0,r);return new ey({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(o)})}for(let t=0;t<n;++t)l.push(e.getPointPositionForValue(t,o));return l}(a):function(t){let e,{scale:i={},fill:a}=t,n=(e=null,"start"===a?e=i.bottom:"end"===a?e=i.top:s.isObject(a)?e=i.getPixelForValue(a.value):i.getBasePixel&&(e=i.getBasePixel()),e);if(s.isNumberFinite(n)){let t=i.isHorizontal();return{x:t?n:null,y:t?null:n}}return null}(a);return l instanceof ey?l:e_(l,o)}(e),{chart:n,index:r,line:o,scale:l,axis:h}=e,d=o.options,c=d.fill,u=d.backgroundColor,{above:g=u,below:f=u}=c||{},p=n.getDatasetMeta(r),m=s.getDatasetClipArea(n,p);a&&o.points.length&&(s.clipArea(t,i),function(t,e){let{line:i,target:s,above:a,below:n,area:r,scale:o,clip:l}=e,h=i._loop?"angle":e.axis;t.save();let d=n;n!==a&&("x"===h?(ew(t,s,r.top),eD(t,{line:i,target:s,color:a,scale:o,property:h,clip:l}),t.restore(),t.save(),ew(t,s,r.bottom)):"y"===h&&(ek(t,s,r.left),eD(t,{line:i,target:s,color:n,scale:o,property:h,clip:l}),t.restore(),t.save(),ek(t,s,r.right),d=a)),eD(t,{line:i,target:s,color:d,scale:o,property:h,clip:l}),t.restore()}(t,{line:o,target:a,above:g,below:f,area:i,scale:l,axis:h,clip:m}),s.unclipArea(t))}function ew(t,e,i){let{segments:s,points:a}=e,n=!0,r=!1;for(let o of(t.beginPath(),s)){let{start:s,end:l}=o,h=a[s],d=a[ex(s,l,a)];n?(t.moveTo(h.x,h.y),n=!1):(t.lineTo(h.x,i),t.lineTo(h.x,h.y)),(r=!!e.pathSegment(t,o,{move:r}))?t.closePath():t.lineTo(d.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function ek(t,e,i){let{segments:s,points:a}=e,n=!0,r=!1;for(let o of(t.beginPath(),s)){let{start:s,end:l}=o,h=a[s],d=a[ex(s,l,a)];n?(t.moveTo(h.x,h.y),n=!1):(t.lineTo(i,h.y),t.lineTo(h.x,h.y)),(r=!!e.pathSegment(t,o,{move:r}))?t.closePath():t.lineTo(i,d.y)}t.lineTo(i,e.first().y),t.closePath(),t.clip()}function eD(t,e){let{line:i,target:a,property:n,color:r,scale:o,clip:l}=e;for(let{source:e,target:h,start:d,end:c}of function(t,e,i){let a=t.segments,n=t.points,r=e.points,o=[];for(let t of a){let{start:a,end:l}=t;l=ex(a,l,n);let h=em(i,n[a],n[l],t.loop);if(!e.segments){o.push({source:t,target:h,start:n[a],end:n[l]});continue}for(let a of s._boundSegments(e,h)){let e=em(i,r[a.start],r[a.end],a.loop);for(let r of s._boundSegment(t,n,e))o.push({source:r,target:a,start:{[i]:eb(h,e,"start",Math.max)},end:{[i]:eb(h,e,"end",Math.min)}})}}return o}(i,a,n)){let s,{style:{backgroundColor:u=r}={}}=e,g=!0!==a;t.save(),t.fillStyle=u,function(t,e,i,s){let a=e.chart.chartArea,{property:n,start:r,end:o}=s||{};if("x"===n||"y"===n){let e,s,l,h;"x"===n?(e=r,s=a.top,l=o,h=a.bottom):(e=a.left,s=r,l=a.right,h=o),t.beginPath(),i&&(e=Math.max(e,i.left),l=Math.min(l,i.right),s=Math.max(s,i.top),h=Math.min(h,i.bottom)),t.rect(e,s,l-e,h-s),t.clip()}}(t,o,l,g&&em(n,d,c)),t.beginPath();let f=!!i.pathSegment(t,e);if(g){f?t.closePath():eP(t,a,c,n);let e=!!a.pathSegment(t,h,{move:f,reverse:!0});(s=f&&e)||eP(t,a,d,n)}t.closePath(),t.fill(s?"evenodd":"nonzero"),t.restore()}}function eP(t,e,i,s){let a=e.interpolate(i,s);a&&t.lineTo(a.x,a.y)}var eS={id:"filler",afterDatasetsUpdate(t,e,i){let a,n,r,o,l=(t.data.datasets||[]).length,h=[];for(n=0;n<l;++n)r=(a=t.getDatasetMeta(n)).dataset,o=null,r&&r.options&&r instanceof t9&&(o={visible:t.isDatasetVisible(n),index:n,fill:function(t,e,i){var a,n,r,o;let l=function(t){let e=t.options,i=e.fill,a=s.valueOrDefault(i&&i.target,i);return void 0===a&&(a=!!e.backgroundColor),!1!==a&&null!==a&&(!0===a?"origin":a)}(t);if(s.isObject(l))return!isNaN(l.value)&&l;let h=parseFloat(l);return s.isNumberFinite(h)&&Math.floor(h)===h?(a=l[0],n=e,r=h,o=i,("-"===a||"+"===a)&&(r=n+r),r!==n&&!(r<0)&&!(r>=o)&&r):["origin","start","end","stack","shape"].indexOf(l)>=0&&l}(r,n,l),chart:t,axis:a.controller.options.indexAxis,scale:a.vScale,line:r}),a.$filler=o,h.push(o);for(n=0;n<l;++n)(o=h[n])&&!1!==o.fill&&(o.fill=function(t,e,i){let a,n=t[e].fill,r=[e];if(!i)return n;for(;!1!==n&&-1===r.indexOf(n);){if(!s.isNumberFinite(n))return n;if(!(a=t[n]))break;if(a.visible)return n;r.push(n),n=a.fill}return!1}(h,n,i.propagate))},beforeDraw(t,e,i){let s="beforeDraw"===i.drawTime,a=t.getSortedVisibleDatasetMetas(),n=t.chartArea;for(let e=a.length-1;e>=0;--e){let i=a[e].$filler;i&&(i.line.updateControlPoints(n,i.axis),s&&i.fill&&eM(t.ctx,i,n))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;let s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){let i=s[e].$filler;ev(i)&&eM(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){let s=e.meta.$filler;ev(s)&&"beforeDatasetDraw"===i.drawTime&&eM(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};let eO=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class eA extends tm{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,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,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(){let t=this.options.labels||{},e=s.callback(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(e=>t.filter(e,this.chart.data))),t.sort&&(e=e.sort((e,i)=>t.sort(e,i,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let t,e,{options:i,ctx:a}=this;if(!i.display){this.width=this.height=0;return}let n=i.labels,r=s.toFont(n.font),o=r.size,l=this._computeTitleHeight(),{boxWidth:h,itemHeight:d}=eO(n,o);a.font=r.string,this.isHorizontal()?(t=this.maxWidth,e=this._fitRows(l,o,h,d)+10):(e=this.maxHeight,t=this._fitCols(l,r,h,d)+10),this.width=Math.min(t,i.maxWidth||this.maxWidth),this.height=Math.min(e,i.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){let{ctx:a,maxWidth:n,options:{labels:{padding:r}}}=this,o=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+r,d=t;a.textAlign="left",a.textBaseline="middle";let c=-1,u=-h;return this.legendItems.forEach((t,g)=>{let f=i+e/2+a.measureText(t.text).width;(0===g||l[l.length-1]+f+2*r>n)&&(d+=h,l[l.length-(g>0?0:1)]=0,u+=h,c++),o[g]={left:0,top:u,row:c,width:f,height:s},l[l.length-1]+=f+r}),d}_fitCols(t,e,i,s){let{ctx:a,maxHeight:n,options:{labels:{padding:r}}}=this,o=this.legendHitBoxes=[],l=this.columnSizes=[],h=n-t,d=r,c=0,u=0,g=0,f=0;return this.legendItems.forEach((t,n)=>{var p,m,x,b,_,v,y,M,w,k,D,P;let S,O,{itemWidth:A,itemHeight:C}=(p=i,m=e,x=a,b=t,_=s,{itemWidth:(v=b,y=p,M=m,w=x,(S=v.text)&&"string"!=typeof S&&(S=S.reduce((t,e)=>t.length>e.length?t:e)),y+M.size/2+w.measureText(S).width),itemHeight:(k=_,D=b,P=m.lineHeight,O=k,"string"!=typeof D.text&&(O=eC(D,P)),O)});n>0&&u+C+2*r>h&&(d+=c+r,l.push({width:c,height:u}),g+=c+r,f++,c=u=0),o[n]={left:g,top:u,col:f,width:A,height:C},c=Math.max(c,A),u+=C+r}),d+=c,l.push({width:c,height:u}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:a},rtl:n}}=this,r=s.getRtlAdapter(n,this.left,this.width);if(this.isHorizontal()){let n=0,o=s._alignStartEnd(i,this.left+a,this.right-this.lineWidths[n]);for(let l of e)n!==l.row&&(n=l.row,o=s._alignStartEnd(i,this.left+a,this.right-this.lineWidths[n])),l.top+=this.top+t+a,l.left=r.leftForLtr(r.x(o),l.width),o+=l.width+a}else{let n=0,o=s._alignStartEnd(i,this.top+t+a,this.bottom-this.columnSizes[n].height);for(let l of e)l.col!==n&&(n=l.col,o=s._alignStartEnd(i,this.top+t+a,this.bottom-this.columnSizes[n].height)),l.top=o,l.left+=this.left+a,l.left=r.leftForLtr(r.x(l.left),l.width),o+=l.height+a}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){let t=this.ctx;s.clipArea(t,this),this._draw(),s.unclipArea(t)}}_draw(){let t,{options:e,columnSizes:i,lineWidths:a,ctx:n}=this,{align:r,labels:o}=e,l=s.defaults.color,h=s.getRtlAdapter(e.rtl,this.left,this.width),d=s.toFont(o.font),{padding:c}=o,u=d.size,g=u/2;this.drawTitle(),n.textAlign=h.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=d.string;let{boxWidth:f,boxHeight:p,itemHeight:m}=eO(o,u),x=function(t,e,i){if(isNaN(f)||f<=0||isNaN(p)||p<0)return;n.save();let a=s.valueOrDefault(i.lineWidth,1);if(n.fillStyle=s.valueOrDefault(i.fillStyle,l),n.lineCap=s.valueOrDefault(i.lineCap,"butt"),n.lineDashOffset=s.valueOrDefault(i.lineDashOffset,0),n.lineJoin=s.valueOrDefault(i.lineJoin,"miter"),n.lineWidth=a,n.strokeStyle=s.valueOrDefault(i.strokeStyle,l),n.setLineDash(s.valueOrDefault(i.lineDash,[])),o.usePointStyle){let r={radius:p*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:a},l=h.xPlus(t,f/2);s.drawPointLegend(n,r,l,e+g,o.pointStyleWidth&&f)}else{let r=e+Math.max((u-p)/2,0),o=h.leftForLtr(t,f),l=s.toTRBLCorners(i.borderRadius);n.beginPath(),Object.values(l).some(t=>0!==t)?s.addRoundedRectPath(n,{x:o,y:r,w:f,h:p,radius:l}):n.rect(o,r,f,p),n.fill(),0!==a&&n.stroke()}n.restore()},b=function(t,e,i){s.renderText(n,i.text,t,e+m/2,d,{strikethrough:i.hidden,textAlign:h.textAlign(i.textAlign)})},_=this.isHorizontal(),v=this._computeTitleHeight();t=_?{x:s._alignStartEnd(r,this.left+c,this.right-a[0]),y:this.top+c+v,line:0}:{x:this.left+c,y:s._alignStartEnd(r,this.top+v+c,this.bottom-i[0].height),line:0},s.overrideTextDirection(this.ctx,e.textDirection);let y=m+c;this.legendItems.forEach((l,u)=>{n.strokeStyle=l.fontColor,n.fillStyle=l.fontColor;let p=n.measureText(l.text).width,m=h.textAlign(l.textAlign||(l.textAlign=o.textAlign)),M=f+g+p,w=t.x,k=t.y;if(h.setWidth(this.width),_?u>0&&w+M+c>this.right&&(k=t.y+=y,t.line++,w=t.x=s._alignStartEnd(r,this.left+c,this.right-a[t.line])):u>0&&k+y>this.bottom&&(w=t.x=w+i[t.line].width+c,t.line++,k=t.y=s._alignStartEnd(r,this.top+v+c,this.bottom-i[t.line].height)),x(h.x(w),k,l),w=s._textX(m,w+f+g,_?w+M:this.right,e.rtl),b(h.x(w),k,l),_)t.x+=M+c;else if("string"!=typeof l.text){let e=d.lineHeight;t.y+=eC(l,e)+c}else t.y+=y}),s.restoreTextDirection(this.ctx,e.textDirection)}drawTitle(){let t,e=this.options,i=e.title,a=s.toFont(i.font),n=s.toPadding(i.padding);if(!i.display)return;let r=s.getRtlAdapter(e.rtl,this.left,this.width),o=this.ctx,l=i.position,h=a.size/2,d=n.top+h,c=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),t=this.top+d,c=s._alignStartEnd(e.align,c,this.right-u);else{let i=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);t=d+s._alignStartEnd(e.align,this.top,this.bottom-i-e.labels.padding-this._computeTitleHeight())}let g=s._alignStartEnd(l,c,c+u);o.textAlign=r.textAlign(s._toLeftRightCenter(l)),o.textBaseline="middle",o.strokeStyle=i.color,o.fillStyle=i.color,o.font=a.string,s.renderText(o,i.text,g,t,a)}_computeTitleHeight(){let t=this.options.title,e=s.toFont(t.font),i=s.toPadding(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,a,n;if(s._isBetween(t,this.left,this.right)&&s._isBetween(e,this.top,this.bottom)){for(i=0,n=this.legendHitBoxes;i<n.length;++i)if(a=n[i],s._isBetween(t,a.left,a.left+a.width)&&s._isBetween(e,a.top,a.top+a.height))return this.legendItems[i]}return null}handleEvent(t){var e,i;let a=this.options;if(e=t.type,i=a,("mousemove"!==e&&"mouseout"!==e||!i.onHover&&!i.onLeave)&&(!i.onClick||"click"!==e&&"mouseup"!==e))return;let n=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){let e=this._hoveredItem,i=null!==e&&null!==n&&e.datasetIndex===n.datasetIndex&&e.index===n.index;e&&!i&&s.callback(a.onLeave,[t,e,this],this),this._hoveredItem=n,n&&!i&&s.callback(a.onHover,[t,n,this],this)}else n&&s.callback(a.onClick,[t,n,this],this)}}function eC(t,e){return e*(t.text?t.text.length:0)}var eL={id:"legend",_element:eA,start(t,e,i){let s=t.legend=new eA({ctx:t.ctx,options:i,chart:t});Z.configure(t,s,i),Z.addBox(t,s)},stop(t){Z.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){let s=t.legend;Z.configure(t,s,i),s.options=i},afterUpdate(t){let e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){let s=e.datasetIndex,a=i.chart;a.isDatasetVisible(s)?(a.hide(s),e.hidden=!0):(a.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){let e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:a,textAlign:n,color:r,useBorderRadius:o,borderRadius:l}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{let h=t.controller.getStyle(i?0:void 0),d=s.toPadding(h.borderWidth);return{text:e[t.index].label,fillStyle:h.backgroundColor,fontColor:r,hidden:!t.visible,lineCap:h.borderCapStyle,lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:h.borderColor,pointStyle:a||h.pointStyle,rotation:h.rotation,textAlign:n||h.textAlign,borderRadius:o&&(l||h.borderRadius),datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class eT extends tm{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){let i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let a=s.isArray(i.text)?i.text.length:1;this._padding=s.toPadding(i.padding);let n=a*s.toFont(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=n:this.width=n}isHorizontal(){let t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){let e,i,a,{top:n,left:r,bottom:o,right:l,options:h}=this,d=h.align,c=0;return this.isHorizontal()?(i=s._alignStartEnd(d,r,l),a=n+t,e=l-r):("left"===h.position?(i=r+t,a=s._alignStartEnd(d,o,n),c=-.5*s.PI):(i=l-t,a=s._alignStartEnd(d,n,o),c=.5*s.PI),e=o-n),{titleX:i,titleY:a,maxWidth:e,rotation:c}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let i=s.toFont(e.font),a=i.lineHeight/2+this._padding.top,{titleX:n,titleY:r,maxWidth:o,rotation:l}=this._drawArgs(a);s.renderText(t,e.text,0,0,i,{color:e.color,maxWidth:o,rotation:l,textAlign:s._toLeftRightCenter(e.align),textBaseline:"middle",translation:[n,r]})}}var eE={id:"title",_element:eT,start(t,e,i){let s;s=new eT({ctx:t.ctx,options:i,chart:t}),Z.configure(t,s,i),Z.addBox(t,s),t.titleBlock=s},stop(t){let e=t.titleBlock;Z.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){let s=t.titleBlock;Z.configure(t,s,i),s.options=i},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}};let eR=new WeakMap;var eF={id:"subtitle",start(t,e,i){let s=new eT({ctx:t.ctx,options:i,chart:t});Z.configure(t,s,i),Z.addBox(t,s),eR.set(t,s)},stop(t){Z.removeBox(t,eR.get(t)),eR.delete(t)},beforeUpdate(t,e,i){let s=eR.get(t);Z.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};let ez={average(t){let e,i;if(!t.length)return!1;let s=new Set,a=0,n=0;for(e=0,i=t.length;e<i;++e){let i=t[e].element;if(i&&i.hasValue()){let t=i.tooltipPosition();s.add(t.x),a+=t.y,++n}}return 0!==n&&0!==s.size&&{x:[...s].reduce((t,e)=>t+e)/s.size,y:a/n}},nearest(t,e){let i,a,n;if(!t.length)return!1;let r=e.x,o=e.y,l=1/0;for(i=0,a=t.length;i<a;++i){let a=t[i].element;if(a&&a.hasValue()){let t=a.getCenterPoint(),i=s.distanceBetweenPoints(e,t);i<l&&(l=i,n=a)}}if(n){let t=n.tooltipPosition();r=t.x,o=t.y}return{x:r,y:o}}};function eV(t,e){return e&&(s.isArray(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function eI(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function eB(t,e){let i=t.chart.ctx,{body:a,footer:n,title:r}=t,{boxWidth:o,boxHeight:l}=e,h=s.toFont(e.bodyFont),d=s.toFont(e.titleFont),c=s.toFont(e.footerFont),u=r.length,g=n.length,f=a.length,p=s.toPadding(e.padding),m=p.height,x=0,b=a.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);b+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*d.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b&&(m+=f*(e.displayColors?Math.max(l,h.lineHeight):h.lineHeight)+(b-f)*h.lineHeight+(b-1)*e.bodySpacing),g&&(m+=e.footerMarginTop+g*c.lineHeight+(g-1)*e.footerSpacing);let _=0,v=function(t){x=Math.max(x,i.measureText(t).width+_)};return i.save(),i.font=d.string,s.each(t.title,v),i.font=h.string,s.each(t.beforeBody.concat(t.afterBody),v),_=e.displayColors?o+2+e.boxPadding:0,s.each(a,t=>{s.each(t.before,v),s.each(t.lines,v),s.each(t.after,v)}),_=0,i.font=c.string,s.each(t.footer,v),i.restore(),{width:x+=p.width,height:m}}function eN(t,e,i){let s=i.yAlign||e.yAlign||function(t,e){let{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||function(t,e,i,s){let{x:a,width:n}=i,{width:r,chartArea:{left:o,right:l}}=t,h="center";return"center"===s?h=a<=(o+l)/2?"left":"right":a<=n/2?h="left":a>=r-n/2&&(h="right"),function(t,e,i,s){let{x:a,width:n}=s,r=i.caretSize+i.caretPadding;if("left"===t&&a+n+r>e.width||"right"===t&&a-n-r<0)return!0}(h,t,e,i)&&(h="center"),h}(t,e,i,s),yAlign:s}}function eH(t,e,i,a){let{caretSize:n,caretPadding:r,cornerRadius:o}=t,{xAlign:l,yAlign:h}=i,d=n+r,{topLeft:c,topRight:u,bottomLeft:g,bottomRight:f}=s.toTRBLCorners(o),p=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,l),m=function(t,e,i){let{y:s,height:a}=t;return"top"===e?s+=i:"bottom"===e?s-=a+i:s-=a/2,s}(e,h,d);return"center"===h?"left"===l?p+=d:"right"===l&&(p-=d):"left"===l?p-=Math.max(c,g)+n:"right"===l&&(p+=Math.max(u,f)+n),{x:s._limitValue(p,0,a.width-e.width),y:s._limitValue(m,0,a.height-e.height)}}function ej(t,e,i){let a=s.toPadding(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-a.right:t.x+a.left}function eW(t,e){let i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}let eU={beforeTitle:s.noop,title(t){if(t.length>0){let e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return i[e.dataIndex]}return""},afterTitle:s.noop,beforeBody:s.noop,beforeLabel:s.noop,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");let i=t.formattedValue;return s.isNullOrUndef(i)||(e+=i),e},labelColor(t){let e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.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(t){let e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:s.noop,afterBody:s.noop,beforeFooter:s.noop,footer:s.noop,afterFooter:s.noop};function e$(t,e,i,s){let a=t[e].call(i,s);return void 0===a?eU[e].call(i,s):a}class eq extends tm{static positioners=ez;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(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,a=new h(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(a)),a}getContext(){var t,e;return this.$context||(this.$context=(t=this.chart.getContext(),e=this._tooltipItems,s.createContext(t,{tooltip:this,tooltipItems:e,type:"tooltip"})))}getTitle(t,e){let{callbacks:i}=e,s=e$(i,"beforeTitle",this,t),a=e$(i,"title",this,t),n=e$(i,"afterTitle",this,t),r=[];return r=eV(r,eI(s)),r=eV(r,eI(a)),r=eV(r,eI(n))}getBeforeBody(t,e){return eV([],eI(e$(e.callbacks,"beforeBody",this,t)))}getBody(t,e){let{callbacks:i}=e,a=[];return s.each(t,t=>{let e={before:[],lines:[],after:[]},s=eW(i,t);eV(e.before,eI(e$(s,"beforeLabel",this,t))),eV(e.lines,e$(s,"label",this,t)),eV(e.after,eI(e$(s,"afterLabel",this,t))),a.push(e)}),a}getAfterBody(t,e){return eV([],eI(e$(e.callbacks,"afterBody",this,t)))}getFooter(t,e){let{callbacks:i}=e,s=e$(i,"beforeFooter",this,t),a=e$(i,"footer",this,t),n=e$(i,"afterFooter",this,t),r=[];return r=eV(r,eI(s)),r=eV(r,eI(a)),r=eV(r,eI(n))}_createItems(t){let e,i,a=this._active,n=this.chart.data,r=[],o=[],l=[],h=[];for(e=0,i=a.length;e<i;++e)h.push(function(t,e){let{element:i,datasetIndex:s,index:a}=e,n=t.getDatasetMeta(s).controller,{label:r,value:o}=n.getLabelAndValue(a);return{chart:t,label:r,parsed:n.getParsed(a),raw:t.data.datasets[s].data[a],formattedValue:o,dataset:n.getDataset(),dataIndex:a,datasetIndex:s,element:i}}(this.chart,a[e]));return t.filter&&(h=h.filter((e,i,s)=>t.filter(e,i,s,n))),t.itemSort&&(h=h.sort((e,i)=>t.itemSort(e,i,n))),s.each(h,e=>{let i=eW(t.callbacks,e);r.push(e$(i,"labelColor",this,e)),o.push(e$(i,"labelPointStyle",this,e)),l.push(e$(i,"labelTextColor",this,e))}),this.labelColors=r,this.labelPointStyles=o,this.labelTextColors=l,this.dataPoints=h,h}update(t,e){let i,s=this.options.setContext(this.getContext()),a=this._active,n=[];if(a.length){let t=ez[s.position].call(this,a,this._eventPosition);n=this._createItems(s),this.title=this.getTitle(n,s),this.beforeBody=this.getBeforeBody(n,s),this.body=this.getBody(n,s),this.afterBody=this.getAfterBody(n,s),this.footer=this.getFooter(n,s);let e=this._size=eB(this,s),r=Object.assign({},t,e),o=eN(this.chart,s,r),l=eH(s,r,o,this.chart);this.xAlign=o.xAlign,this.yAlign=o.yAlign,i={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(i={opacity:0});this._tooltipItems=n,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let a=this.getCaretPosition(t,i,s);e.lineTo(a.x1,a.y1),e.lineTo(a.x2,a.y2),e.lineTo(a.x3,a.y3)}getCaretPosition(t,e,i){let a,n,r,o,l,h,{xAlign:d,yAlign:c}=this,{caretSize:u,cornerRadius:g}=i,{topLeft:f,topRight:p,bottomLeft:m,bottomRight:x}=s.toTRBLCorners(g),{x:b,y:_}=t,{width:v,height:y}=e;return"center"===c?(l=_+y/2,"left"===d?(n=(a=b)-u,o=l+u,h=l-u):(n=(a=b+v)+u,o=l-u,h=l+u),r=a):(n="left"===d?b+Math.max(f,m)+u:"right"===d?b+v-Math.max(p,x)-u:this.caretX,"top"===c?(l=(o=_)-u,a=n-u,r=n+u):(l=(o=_+y)+u,a=n+u,r=n-u),h=o),{x1:a,x2:n,x3:r,y1:o,y2:l,y3:h}}drawTitle(t,e,i){let a,n,r,o=this.title,l=o.length;if(l){let h=s.getRtlAdapter(i.rtl,this.x,this.width);for(r=0,t.x=ej(this,i.titleAlign,i),e.textAlign=h.textAlign(i.titleAlign),e.textBaseline="middle",a=s.toFont(i.titleFont),n=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string;r<l;++r)e.fillText(o[r],h.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+n,r+1===l&&(t.y+=i.titleMarginBottom-n)}}_drawColorBox(t,e,i,a,n){let r=this.labelColors[i],o=this.labelPointStyles[i],{boxHeight:l,boxWidth:h}=n,d=s.toFont(n.bodyFont),c=ej(this,"left",n),u=a.x(c),g=l<d.lineHeight?(d.lineHeight-l)/2:0,f=e.y+g;if(n.usePointStyle){let e={radius:Math.min(h,l)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},i=a.leftForLtr(u,h)+h/2,d=f+l/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,s.drawPoint(t,e,i,d),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,s.drawPoint(t,e,i,d)}else{t.lineWidth=s.isObject(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;let e=a.leftForLtr(u,h),i=a.leftForLtr(a.xPlus(u,1),h-2),o=s.toTRBLCorners(r.borderRadius);Object.values(o).some(t=>0!==t)?(t.beginPath(),t.fillStyle=n.multiKeyBackground,s.addRoundedRectPath(t,{x:e,y:f,w:h,h:l,radius:o}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),s.addRoundedRectPath(t,{x:i,y:f+1,w:h-2,h:l-2,radius:o}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,f,h,l),t.strokeRect(e,f,h,l),t.fillStyle=r.backgroundColor,t.fillRect(i,f+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let a,n,r,o,l,h,{body:d}=this,{bodySpacing:c,bodyAlign:u,displayColors:g,boxHeight:f,boxWidth:p,boxPadding:m}=i,x=s.toFont(i.bodyFont),b=x.lineHeight,_=0,v=s.getRtlAdapter(i.rtl,this.x,this.width),y=function(i){e.fillText(i,v.x(t.x+_),t.y+b/2),t.y+=b+c},M=v.textAlign(u);for(e.textAlign=u,e.textBaseline="middle",e.font=x.string,t.x=ej(this,M,i),e.fillStyle=i.bodyColor,s.each(this.beforeBody,y),_=g&&"right"!==M?"center"===u?p/2+m:p+2+m:0,r=0,l=d.length;r<l;++r){for(a=d[r],e.fillStyle=this.labelTextColors[r],s.each(a.before,y),n=a.lines,g&&n.length&&(this._drawColorBox(e,t,r,v,i),b=Math.max(x.lineHeight,f)),o=0,h=n.length;o<h;++o)y(n[o]),b=x.lineHeight;s.each(a.after,y)}_=0,b=x.lineHeight,s.each(this.afterBody,y),t.y-=c}drawFooter(t,e,i){let a,n,r=this.footer,o=r.length;if(o){let l=s.getRtlAdapter(i.rtl,this.x,this.width);for(t.x=ej(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=s.toFont(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,n=0;n<o;++n)e.fillText(r[n],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,a){let{xAlign:n,yAlign:r}=this,{x:o,y:l}=t,{width:h,height:d}=i,{topLeft:c,topRight:u,bottomLeft:g,bottomRight:f}=s.toTRBLCorners(a.cornerRadius);e.fillStyle=a.backgroundColor,e.strokeStyle=a.borderColor,e.lineWidth=a.borderWidth,e.beginPath(),e.moveTo(o+c,l),"top"===r&&this.drawCaret(t,e,i,a),e.lineTo(o+h-u,l),e.quadraticCurveTo(o+h,l,o+h,l+u),"center"===r&&"right"===n&&this.drawCaret(t,e,i,a),e.lineTo(o+h,l+d-f),e.quadraticCurveTo(o+h,l+d,o+h-f,l+d),"bottom"===r&&this.drawCaret(t,e,i,a),e.lineTo(o+g,l+d),e.quadraticCurveTo(o,l+d,o,l+d-g),"center"===r&&"left"===n&&this.drawCaret(t,e,i,a),e.lineTo(o,l+c),e.quadraticCurveTo(o,l,o+c,l),e.closePath(),e.fill(),a.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,s=i&&i.x,a=i&&i.y;if(s||a){let i=ez[t.position].call(this,this._active,this._eventPosition);if(!i)return;let n=this._size=eB(this,t),r=Object.assign({},i,this._size),o=eN(e,t,r),l=eH(t,r,o,e);(s._to!==l.x||a._to!==l.y)&&(this.xAlign=o.xAlign,this.yAlign=o.yAlign,this.width=n.width,this.height=n.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let a={width:this.width,height:this.height},n={x:this.x,y:this.y};i=.001>Math.abs(i)?0:i;let r=s.toPadding(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,a,e),s.overrideTextDirection(t,e.textDirection),n.y+=r.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),s.restoreTextDirection(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,a=t.map(({datasetIndex:t,index:e})=>{let i=this.chart.getDatasetMeta(t);if(!i)throw Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),n=!s._elementsEqual(i,a),r=this._positionChanged(a,e);(n||r)&&(this._active=a,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let a=this.options,n=this._active||[],r=this._getActiveElements(t,n,e,i),o=this._positionChanged(r,t),l=e||!s._elementsEqual(r,n)||o;return l&&(this._active=r,(a.enabled||a.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){let a=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter(t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index));let n=this.chart.getElementsAtEventForMode(t,a.mode,a,i);return a.reverse&&n.reverse(),n}_positionChanged(t,e){let{caretX:i,caretY:s,options:a}=this,n=ez[a.position].call(this,t,e);return!1!==n&&(i!==n.x||s!==n.y)}}var eK={id:"tooltip",_element:eq,positioners:ez,afterInit(t,e,i){i&&(t.tooltip=new eq({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){let e=t.tooltip;if(e&&e._willRender()){let i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){let i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.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:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.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:eU},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},eX=Object.freeze({__proto__:null,Colors:eu,Decimation:ep,Filler:eS,Legend:eL,SubTitle:eF,Title:eE,Tooltip:eK});function eJ(t){let e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class eY extends tw{static id="category";static defaults={ticks:{callback:eJ}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let t=this.getLabels();for(let{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){let i,a;if(s.isNullOrUndef(t))return null;let n=this.getLabels();return i=e=isFinite(e)&&n[e]===t?e:function(t,e,i,s){let a=t.indexOf(e);if(-1===a){var n;return n=i,"string"==typeof e?(n=t.push(e)-1,s.unshift({index:n,label:e})):isNaN(e)&&(n=null),n}return a!==t.lastIndexOf(e)?i:a}(n,t,s.valueOrDefault(e,t),this._addedLabels),a=n.length-1,null===i?null:s._limitValue(Math.round(i),0,a)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,s=[],a=this.getLabels();a=0===t&&e===a.length-1?a:a.slice(t,e+1),this._valueRange=Math.max(a.length-!i,1),this._startValue=this.min-.5*!!i;for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){return eJ.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let 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}}function eG(t,e,{horizontal:i,minRotation:a}){let n=s.toRadians(a),r=(i?Math.sin(n):Math.cos(n))||.001,o=.75*e*(""+t).length;return Math.min(e/r,o)}class eZ extends tw{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 s.isNullOrUndef(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:a,max:n}=this,r=t=>a=e?a:t,o=t=>n=i?n:t;if(t){let t=s.sign(a),e=s.sign(n);t<0&&e<0?o(0):t>0&&e>0&&r(0)}if(a===n){let e=0===n?1:Math.abs(.05*n);o(n+e),t||r(a-e)}this.min=a,this.max=n}getTickLimit(){let t,{maxTicksLimit:e,stepSize:i}=this.options.ticks;return i?(t=Math.ceil(this.max/i)-Math.floor(this.min/i)+1)>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3):(t=this.computeTickLimit(),e=e||11),e&&(t=Math.min(e,t)),t}computeTickLimit(){return 1/0}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit(),a=function(t,e){let i,a,n,r,o=[],{bounds:l,step:h,min:d,max:c,precision:u,count:g,maxTicks:f,maxDigits:p,includeBounds:m}=t,x=h||1,b=f-1,{min:_,max:v}=e,y=!s.isNullOrUndef(d),M=!s.isNullOrUndef(c),w=!s.isNullOrUndef(g),k=(v-_)/(p+1),D=s.niceNum((v-_)/b/x)*x;if(D<1e-14&&!y&&!M)return[{value:_},{value:v}];(r=Math.ceil(v/D)-Math.floor(_/D))>b&&(D=s.niceNum(r*D/b/x)*x),s.isNullOrUndef(u)||(D=Math.ceil(D*(i=Math.pow(10,u)))/i),"ticks"===l?(a=Math.floor(_/D)*D,n=Math.ceil(v/D)*D):(a=_,n=v),y&&M&&h&&s.almostWhole((c-d)/h,D/1e3)?(r=Math.round(Math.min((c-d)/D,f)),D=(c-d)/r,a=d,n=c):w?(a=y?d:a,D=((n=M?c:n)-a)/(r=g-1)):(r=(n-a)/D,r=s.almostEquals(r,Math.round(r),D/1e3)?Math.round(r):Math.ceil(r));let P=Math.max(s._decimalPlaces(D),s._decimalPlaces(a));a=Math.round(a*(i=Math.pow(10,s.isNullOrUndef(u)?P:u)))/i,n=Math.round(n*i)/i;let S=0;for(y&&(m&&a!==d?(o.push({value:d}),a<d&&S++,s.almostEquals(Math.round((a+S*D)*i)/i,d,eG(d,k,t))&&S++):a<d&&S++);S<r;++S){let t=Math.round((a+S*D)*i)/i;if(M&&t>c)break;o.push({value:t})}return M&&m&&n!==c?o.length&&s.almostEquals(o[o.length-1].value,c,eG(c,k,t))?o[o.length-1].value=c:o.push({value:c}):M&&n!==c||o.push({value:n}),o}({maxTicks:i=Math.max(2,i),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:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&s._setMinAndMaxByKey(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return s.formatNumber(t,this.chart.options.locale,this.options.ticks.format)}}class eQ extends eZ{static id="linear";static defaults={ticks:{callback:s.Ticks.formatters.numeric}};determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=s.isNumberFinite(t)?t:0,this.max=s.isNumberFinite(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=s.toRadians(this.options.ticks.minRotation),a=(t?Math.sin(i):Math.cos(i))||.001;return Math.ceil(e/Math.min(40,this._resolveTickFontOptions(0).lineHeight/a))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}let e0=t=>Math.floor(s.log10(t)),e1=(t,e)=>Math.pow(10,e0(t)+e);function e2(t){return 1==t/Math.pow(10,e0(t))}function e5(t,e,i){let s=Math.pow(10,i),a=Math.floor(t/s);return Math.ceil(e/s)-a}class e3 extends tw{static id="logarithmic";static defaults={ticks:{callback:s.Ticks.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=eZ.prototype.parse.apply(this,[t,e]);if(0===i){this._zero=!0;return}return s.isNumberFinite(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=s.isNumberFinite(t)?Math.max(0,t):null,this.max=s.isNumberFinite(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!s.isNumberFinite(this._userMin)&&(this.min=t===e1(this.min,0)?e1(this.min,-1):e1(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,s=this.max,a=e=>i=t?i:e,n=t=>s=e?s:t;i===s&&(i<=0?(a(1),n(10)):(a(e1(i,-1)),n(e1(s,1)))),i<=0&&a(e1(s,-1)),s<=0&&n(e1(i,1)),this.min=i,this.max=s}buildTicks(){let t=this.options,e=function(t,{min:e,max:i}){e=s.finiteOrDefault(t.min,e);let a=[],n=e0(e),r=function(t,e){let i=e0(e-t);for(;e5(t,e,i)>10;)i++;for(;10>e5(t,e,i);)i--;return Math.min(i,e0(t))}(e,i),o=r<0?Math.pow(10,Math.abs(r)):1,l=Math.pow(10,r),h=n>r?Math.pow(10,n):0,d=Math.round((e-h)*o)/o,c=Math.floor((e-h)/l/10)*l*10,u=Math.floor((d-c)/Math.pow(10,r)),g=s.finiteOrDefault(t.min,Math.round((h+c+u*Math.pow(10,r))*o)/o);for(;g<i;)a.push({value:g,major:e2(g),significand:u}),u>=10?u=u<15?15:20:u++,u>=20&&(u=2,o=++r>=0?1:o),g=Math.round((h+c+u*Math.pow(10,r))*o)/o;let f=s.finiteOrDefault(t.max,g);return a.push({value:f,major:e2(f),significand:u}),a}({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&s._setMinAndMaxByKey(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":s.formatNumber(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=s.log10(t),this._valueRange=s.log10(this.max)-s.log10(t)}getPixelForValue(t){return((void 0===t||0===t)&&(t=this.min),null===t||isNaN(t))?NaN:this.getPixelForDecimal(t===this.min?0:(s.log10(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function e6(t){let e=t.ticks;if(e.display&&t.display){let t=s.toPadding(e.backdropPadding);return s.valueOrDefault(e.font&&e.font.size,s.defaults.font.size)+t.height}return 0}function e4(t,e,i,s,a){return t===s||t===a?{start:e-i/2,end:e+i/2}:t<s||t>a?{start:e-i,end:e}:{start:e,end:e+i}}function e9(t,e,i,a){let{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,s.TAU);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let s=1;s<a;s++)i=t.getPointPosition(s,e),n.lineTo(i.x,i.y)}}class e7 extends eZ{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:s.Ticks.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=s.toPadding(e6(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=s.isNumberFinite(t)&&!isNaN(t)?t:0,this.max=s.isNumberFinite(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/e6(this.options))}generateTickLabels(t){eZ.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,e)=>{let i=s.callback(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){let t=this.options;t.display&&t.pointLabels.display?function(t){let e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),a=[],n=[],r=t._pointLabels.length,o=t.options.pointLabels,l=o.centerPointLabels?s.PI/r:0;for(let c=0;c<r;c++){var h,d;let r=o.setContext(t.getPointLabelContext(c));n[c]=r.padding;let u=t.getPointPosition(c,t.drawingArea+n[c],l),g=s.toFont(r.font),f=(h=t.ctx,d=t._pointLabels[c],d=s.isArray(d)?d:[d],{w:s._longestText(h,g.string,d),h:d.length*g.lineHeight});a[c]=f;let p=s._normalizeAngle(t.getIndexAngle(c)+l),m=Math.round(s.toDegrees(p));!function(t,e,i,s,a){let n=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i)),o=0,l=0;s.start<e.l?(o=(e.l-s.start)/n,t.l=Math.min(t.l,e.l-o)):s.end>e.r&&(o=(s.end-e.r)/n,t.r=Math.max(t.r,e.r+o)),a.start<e.t?(l=(e.t-a.start)/r,t.t=Math.min(t.t,e.t-l)):a.end>e.b&&(l=(a.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}(i,e,p,e4(m,u.x,f.w,0,180),e4(m,u.y,f.h,90,270))}t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){let a,n=[],r=t._pointLabels.length,o=t.options,{centerPointLabels:l,display:h}=o.pointLabels,d={extra:e6(o)/2,additionalAngle:l?s.PI/r:0};for(let o=0;o<r;o++){d.padding=i[o],d.size=e[o];let r=function(t,e,i){var a,n,r,o,l,h,d;let c=t.drawingArea,{extra:u,additionalAngle:g,padding:f,size:p}=i,m=t.getPointPosition(e,c+u+f,g),x=Math.round(s.toDegrees(s._normalizeAngle(m.angle+s.HALF_PI))),b=(a=m.y,n=p.h,90===(r=x)||270===r?a-=n/2:(r>270||r<90)&&(a-=n),a),_=0===(o=x)||180===o?"center":o<180?"left":"right",v=(l=m.x,h=p.w,"right"===(d=_)?l-=h:"center"===d&&(l-=h/2),l);return{visible:!0,x:m.x,y:b,textAlign:_,left:v,top:b,right:v+p.w,bottom:b+p.h}}(t,o,d);n.push(r),"auto"===h&&(r.visible=function(t,e){if(!e)return!0;let{left:i,top:a,right:n,bottom:r}=t;return!(s._isPointInArea({x:i,y:a},e)||s._isPointInArea({x:i,y:r},e)||s._isPointInArea({x:n,y:a},e)||s._isPointInArea({x:n,y:r},e))}(r,a),r.visible&&(a=r))}return n}(t,a,n)}(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){let e=s.TAU/(this._pointLabels.length||1),i=this.options.startAngle||0;return s._normalizeAngle(t*e+s.toRadians(i))}getDistanceFromCenterForValue(t){if(s.isNullOrUndef(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(s.isNullOrUndef(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t<e.length){var i;let a=e[t];return i=this.getContext(),s.createContext(i,{label:a,index:t,type:"pointLabel"})}}getPointPosition(t,e,i=0){let a=this.getIndexAngle(t)-s.HALF_PI+i;return{x:Math.cos(a)*e+this.xCenter,y:Math.sin(a)*e+this.yCenter,angle:a}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:e,top:i,right:s,bottom:a}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:a}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let i=this.ctx;i.save(),i.beginPath(),e9(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){let t,e,i,a=this.ctx,n=this.options,{angleLines:r,grid:o,border:l}=n,h=this._pointLabels.length;if(n.pointLabels.display&&function(t,e){let{ctx:i,options:{pointLabels:a}}=t;for(let n=e-1;n>=0;n--){let e=t._pointLabelItems[n];if(!e.visible)continue;let r=a.setContext(t.getPointLabelContext(n));!function(t,e,i){let{left:a,top:n,right:r,bottom:o}=i,{backdropColor:l}=e;if(!s.isNullOrUndef(l)){let i=s.toTRBLCorners(e.borderRadius),h=s.toPadding(e.backdropPadding);t.fillStyle=l;let d=a-h.left,c=n-h.top,u=r-a+h.width,g=o-n+h.height;Object.values(i).some(t=>0!==t)?(t.beginPath(),s.addRoundedRectPath(t,{x:d,y:c,w:u,h:g,radius:i}),t.fill()):t.fillRect(d,c,u,g)}}(i,r,e);let o=s.toFont(r.font),{x:l,y:h,textAlign:d}=e;s.renderText(i,t._pointLabels[n],l,h+o.lineHeight/2,o,{color:r.color,textAlign:d,textBaseline:"middle"})}}(this,h),o.display&&this.ticks.forEach((t,i)=>{if(0!==i||0===i&&this.min<0){e=this.getDistanceFromCenterForValue(t.value);let s=this.getContext(i),a=o.setContext(s),n=l.setContext(s);!function(t,e,i,s,a){let n=t.ctx,r=e.circular,{color:o,lineWidth:l}=e;(r||s)&&o&&l&&!(i<0)&&(n.save(),n.strokeStyle=o,n.lineWidth=l,n.setLineDash(a.dash||[]),n.lineDashOffset=a.dashOffset,n.beginPath(),e9(t,i,r,s),n.closePath(),n.stroke(),n.restore())}(this,a,e,h,n)}}),r.display){for(a.save(),t=h-1;t>=0;t--){let s=r.setContext(this.getPointLabelContext(t)),{color:o,lineWidth:l}=s;l&&o&&(a.lineWidth=l,a.strokeStyle=o,a.setLineDash(s.borderDash),a.lineDashOffset=s.borderDashOffset,e=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),i=this.getPointPosition(t,e),a.beginPath(),a.moveTo(this.xCenter,this.yCenter),a.lineTo(i.x,i.y),a.stroke())}a.restore()}}drawBorder(){}drawLabels(){let t,e,i=this.ctx,a=this.options,n=a.ticks;if(!n.display)return;let r=this.getIndexAngle(0);i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(r),i.textAlign="center",i.textBaseline="middle",this.ticks.forEach((r,o)=>{if(0===o&&this.min>=0&&!a.reverse)return;let l=n.setContext(this.getContext(o)),h=s.toFont(l.font);if(t=this.getDistanceFromCenterForValue(this.ticks[o].value),l.showLabelBackdrop){i.font=h.string,e=i.measureText(r.label).width,i.fillStyle=l.backdropColor;let a=s.toPadding(l.backdropPadding);i.fillRect(-e/2-a.left,-t-h.size/2-a.top,e+a.width,h.size+a.height)}s.renderText(i,r.label,0,-t,h,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),i.restore()}drawTitle(){}}let e8={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}},it=Object.keys(e8);function ie(t,e){return t-e}function ii(t,e){if(s.isNullOrUndef(e))return null;let i=t._adapter,{parser:a,round:n,isoWeekday:r}=t._parseOpts,o=e;return("function"==typeof a&&(o=a(o)),s.isNumberFinite(o)||(o="string"==typeof a?i.parse(o,a):i.parse(o)),null===o)?null:(n&&(o="week"===n&&(s.isNumber(r)||!0===r)?i.startOf(o,"isoWeek",r):i.startOf(o,n)),+o)}function is(t,e,i,s){let a=it.length;for(let n=it.indexOf(t);n<a-1;++n){let t=e8[it[n]],a=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(a*t.size))<=s)return it[n]}return it[a-1]}function ia(t,e,i){if(i){if(i.length){let{lo:a,hi:n}=s._lookup(i,e);t[i[a]>=e?i[a]:i[n]]=!0}}else t[e]=!0}function ir(t,e,i){let s,a,n=[],r={},o=e.length;for(s=0;s<o;++s)r[a=e[s]]=s,n.push({value:a,major:!1});return 0!==o&&i?function(t,e,i,s){let a,n,r=t._adapter,o=+r.startOf(e[0].value,s),l=e[e.length-1].value;for(a=o;a<=l;a=+r.add(a,1,s))(n=i[a])>=0&&(e[n].major=!0);return e}(t,n,r,i):n}class io extends tw{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};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={}){let i=t.time||(t.time={}),a=this._adapter=new V._date(t.adapters.date);a.init(e),s.mergeIf(i.displayFormats,a.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:ii(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:a,max:n,minDefined:r,maxDefined:o}=this.getUserBounds();function l(t){r||isNaN(t.min)||(a=Math.min(a,t.min)),o||isNaN(t.max)||(n=Math.max(n,t.max))}r&&o||(l(this._getLabelBounds()),("ticks"!==t.bounds||"labels"!==t.ticks.source)&&l(this.getMinMax(!1))),a=s.isNumberFinite(a)&&!isNaN(a)?a:+e.startOf(Date.now(),i),n=s.isNumberFinite(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(a,n-1),this.max=Math.max(a+1,n)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=1/0,i=-1/0;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,a="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&a.length&&(this.min=this._userMin||a[0],this.max=this._userMax||a[a.length-1]);let n=this.min,r=this.max,o=s._filterBetween(a,n,r);return this._unit=e.unit||(i.autoSkip?is(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,a){for(let n=it.length-1;n>=it.indexOf(i);n--){let i=it[n];if(e8[i].common&&t._adapter.diff(a,s,i)>=e-1)return i}return it[i?it.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=it.indexOf(t)+1,i=it.length;e<i;++e)if(e8[it[e]].common)return it[e]}(this._unit):void 0,this.initOffsets(a),t.reverse&&o.reverse(),ir(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e,i,a=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),a=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;a=s._limitValue(a,0,r),n=s._limitValue(n,0,r),this._offsets={start:a,end:n,factor:1/(a+1+n)}}_generate(){let t,e,i=this._adapter,a=this.min,n=this.max,r=this.options,o=r.time,l=o.unit||is(o.minUnit,a,n,this._getLabelCapacity(a)),h=s.valueOrDefault(r.ticks.stepSize,1),d="week"===l&&o.isoWeekday,c=s.isNumber(d)||!0===d,u={},g=a;if(c&&(g=+i.startOf(g,"isoWeek",d)),g=+i.startOf(g,c?"day":l),i.diff(n,a,l)>1e5*h)throw Error(a+" and "+n+" are too far apart with stepSize of "+h+" "+l);let f="data"===r.ticks.source&&this.getDataTimestamps();for(t=g,e=0;t<n;t=+i.add(t,h,l),e++)ia(u,t,f);return(t===n||"ticks"===r.bounds||1===e)&&ia(u,t,f),Object.keys(u).sort(ie).map(t=>+t)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let i=this.options.time.displayFormats,s=this._unit,a=e||i[s];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,a){let n=this.options,r=n.ticks.callback;if(r)return s.callback(r,[t,e,i],this);let o=n.time.displayFormats,l=this._unit,h=this._majorUnit,d=l&&o[l],c=h&&o[h],u=i[e],g=h&&c&&u&&u.major;return this._adapter.format(t,a||(g?c:d))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)(s=t[e]).label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,i=this.ctx.measureText(t).width,a=s.toRadians(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(a),r=Math.sin(a),o=this._resolveTickFontOptions(0).size;return{w:i*n+o*r,h:i*r+o*n}}_getLabelCapacity(t){let e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,a=this._tickFormatFunction(t,0,ir(this,[t],this._majorUnit),s),n=this._getLabelSize(a),r=Math.floor(this.isHorizontal()?this.width/n.w:this.height/n.h)-1;return r>0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t<e;++t)i=i.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){let t,e,i=this._cache.labels||[];if(i.length)return i;let s=this.getLabels();for(t=0,e=s.length;t<e;++t)i.push(ii(this,s[t]));return this._cache.labels=this._normalized?i:this.normalize(i)}normalize(t){return s._arrayUnique(t.sort(ie))}}function il(t,e,i){let a,n,r,o,l=0,h=t.length-1;i?(e>=t[l].pos&&e<=t[h].pos&&({lo:l,hi:h}=s._lookupByKey(t,"pos",e)),{pos:a,time:r}=t[l],{pos:n,time:o}=t[h]):(e>=t[l].time&&e<=t[h].time&&({lo:l,hi:h}=s._lookupByKey(t,"time",e)),{time:a,pos:r}=t[l],{time:n,pos:o}=t[h]);let d=n-a;return d?r+(o-r)*(e-a)/d:r}class ih extends io{static id="timeseries";static defaults=io.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=il(e,this.min),this._tableRange=il(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let e,i,s,{min:a,max:n}=this,r=[],o=[];for(e=0,i=t.length;e<i;++e)(s=t[e])>=a&&s<=n&&r.push(s);if(r.length<2)return[{time:a,pos:0},{time:n,pos:1}];for(e=0,i=r.length;e<i;++e)Math.round((r[e+1]+r[e-1])/2)!==(s=r[e])&&o.push({time:s,pos:e/(i-1)});return o}_generate(){let t=this.min,e=this.max,i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort((t,e)=>t-e)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t}getDecimalForValue(t){return(il(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return il(this._table,i*this._tableRange+this._minPos,!0)}}var id=Object.freeze({__proto__:null,CategoryScale:eY,LinearScale:eQ,LogarithmicScale:e3,RadialLinearScale:e7,TimeScale:io,TimeSeriesScale:ih});let ic=[R,er,eX,id];e.Ticks=s.Ticks,e.defaults=s.defaults,e.Animation=l,e.Animations=h,e.ArcElement=tQ,e.BarController=P,e.BarElement=en,e.BasePlatform=Q,e.BasicPlatform=tt,e.BubbleController=S,e.CategoryScale=eY,e.Chart=tJ,e.Colors=eu,e.DatasetController=v,e.Decimation=ep,e.DomPlatform=tf,e.DoughnutController=O,e.Element=tm,e.Filler=eS,e.Interaction=j,e.Legend=eL,e.LineController=A,e.LineElement=t9,e.LinearScale=eQ,e.LogarithmicScale=e3,e.PieController=L,e.PointElement=t8,e.PolarAreaController=C,e.RadarController=T,e.RadialLinearScale=e7,e.Scale=tw,e.ScatterController=E,e.SubTitle=eF,e.TimeScale=io,e.TimeSeriesScale=ih,e.Title=eE,e.Tooltip=eK,e._adapters=V,e._detectPlatform=tp,e.animator=n,e.controllers=R,e.elements=er,e.layouts=Z,e.plugins=eX,e.registerables=ic,e.registry=tP,e.scales=id}}]);