PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 1.10.7
Subscriptions for WooCommerce with Stripe Recurring Payments v1.10.7
2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 All 65 releases
subscription / assets / js / chart.js

chart.js in Subscriptions for WooCommerce with Stripe Recurring Payments 1.10.7, at assets/js/chart.js

10,299 lines 326.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*!
2 * Chart.js v4.5.1
3 * https://www.chartjs.org
4 * (c) 2025 Chart.js Contributors
5 * Released under the MIT License
6 */
7 !(function (t, e) {
8 "object" == typeof exports && "undefined" != typeof module
9 ? (module.exports = e())
10 : "function" == typeof define && define.amd
11 ? define(e)
12 : ((t = "undefined" != typeof globalThis ? globalThis : t || self).Chart = e());
13 })(this, function () {
14 "use strict";
15 var t = Object.freeze({
16 __proto__: null,
17 get Colors() {
18 return Jo;
19 },
20 get Decimation() {
21 return ta;
22 },
23 get Filler() {
24 return ba;
25 },
26 get Legend() {
27 return Ma;
28 },
29 get SubTitle() {
30 return Pa;
31 },
32 get Title() {
33 return ka;
34 },
35 get Tooltip() {
36 return Na;
37 },
38 });
39 function e() {}
40 const i = (() => {
41 let t = 0;
42 return () => t++;
43 })();
44 function s(t) {
45 return null == t;
46 }
47 function n(t) {
48 if (Array.isArray && Array.isArray(t)) return !0;
49 const e = Object.prototype.toString.call(t);
50 return "[object" === e.slice(0, 7) && "Array]" === e.slice(-6);
51 }
52 function o(t) {
53 return null !== t && "[object Object]" === Object.prototype.toString.call(t);
54 }
55 function a(t) {
56 return ("number" == typeof t || t instanceof Number) && isFinite(+t);
57 }
58 function r(t, e) {
59 return a(t) ? t : e;
60 }
61 function l(t, e) {
62 return void 0 === t ? e : t;
63 }
64 const h = (t, e) => ("string" == typeof t && t.endsWith("%") ? parseFloat(t) / 100 : +t / e),
65 c = (t, e) => ("string" == typeof t && t.endsWith("%") ? (parseFloat(t) / 100) * e : +t);
66 function d(t, e, i) {
67 if (t && "function" == typeof t.call) return t.apply(i, e);
68 }
69 function u(t, e, i, s) {
70 let a, r, l;
71 if (n(t))
72 if (((r = t.length), s)) for (a = r - 1; a >= 0; a--) e.call(i, t[a], a);
73 else for (a = 0; a < r; a++) e.call(i, t[a], a);
74 else if (o(t)) for (l = Object.keys(t), r = l.length, a = 0; a < r; a++) e.call(i, t[l[a]], l[a]);
75 }
76 function f(t, e) {
77 let i, s, n, o;
78 if (!t || !e || t.length !== e.length) return !1;
79 for (i = 0, s = t.length; i < s; ++i)
80 if (((n = t[i]), (o = e[i]), n.datasetIndex !== o.datasetIndex || n.index !== o.index)) return !1;
81 return !0;
82 }
83 function g(t) {
84 if (n(t)) return t.map(g);
85 if (o(t)) {
86 const e = Object.create(null),
87 i = Object.keys(t),
88 s = i.length;
89 let n = 0;
90 for (; n < s; ++n) e[i[n]] = g(t[i[n]]);
91 return e;
92 }
93 return t;
94 }
95 function p(t) {
96 return -1 === ["__proto__", "prototype", "constructor"].indexOf(t);
97 }
98 function m(t, e, i, s) {
99 if (!p(t)) return;
100 const n = e[t],
101 a = i[t];
102 o(n) && o(a) ? x(n, a, s) : (e[t] = g(a));
103 }
104 function x(t, e, i) {
105 const s = n(e) ? e : [e],
106 a = s.length;
107 if (!o(t)) return t;
108 const r = (i = i || {}).merger || m;
109 let l;
110 for (let e = 0; e < a; ++e) {
111 if (((l = s[e]), !o(l))) continue;
112 const n = Object.keys(l);
113 for (let e = 0, s = n.length; e < s; ++e) r(n[e], t, l, i);
114 }
115 return t;
116 }
117 function b(t, e) {
118 return x(t, e, { merger: _ });
119 }
120 function _(t, e, i) {
121 if (!p(t)) return;
122 const s = e[t],
123 n = i[t];
124 o(s) && o(n) ? b(s, n) : Object.prototype.hasOwnProperty.call(e, t) || (e[t] = g(n));
125 }
126 const y = { "": (t) => t, x: (t) => t.x, y: (t) => t.y };
127 function v(t) {
128 const e = t.split("."),
129 i = [];
130 let s = "";
131 for (const t of e) ((s += t), s.endsWith("\\") ? (s = s.slice(0, -1) + ".") : (i.push(s), (s = "")));
132 return i;
133 }
134 function M(t, e) {
135 const i =
136 y[e] ||
137 (y[e] = (function (t) {
138 const e = v(t);
139 return (t) => {
140 for (const i of e) {
141 if ("" === i) break;
142 t = t && t[i];
143 }
144 return t;
145 };
146 })(e));
147 return i(t);
148 }
149 function w(t) {
150 return t.charAt(0).toUpperCase() + t.slice(1);
151 }
152 const k = (t) => void 0 !== t,
153 S = (t) => "function" == typeof t,
154 P = (t, e) => {
155 if (t.size !== e.size) return !1;
156 for (const i of t) if (!e.has(i)) return !1;
157 return !0;
158 };
159 function D(t) {
160 return "mouseup" === t.type || "click" === t.type || "contextmenu" === t.type;
161 }
162 const C = Math.PI,
163 O = 2 * C,
164 A = O + C,
165 T = Number.POSITIVE_INFINITY,
166 L = C / 180,
167 E = C / 2,
168 R = C / 4,
169 I = (2 * C) / 3,
170 z = Math.log10,
171 F = Math.sign;
172 function V(t, e, i) {
173 return Math.abs(t - e) < i;
174 }
175 function B(t) {
176 const e = Math.round(t);
177 t = V(t, e, t / 1e3) ? e : t;
178 const i = Math.pow(10, Math.floor(z(t))),
179 s = t / i;
180 return (s <= 1 ? 1 : s <= 2 ? 2 : s <= 5 ? 5 : 10) * i;
181 }
182 function W(t) {
183 const e = [],
184 i = Math.sqrt(t);
185 let s;
186 for (s = 1; s < i; s++) t % s == 0 && (e.push(s), e.push(t / s));
187 return (i === (0 | i) && e.push(i), e.sort((t, e) => t - e).pop(), e);
188 }
189 function N(t) {
190 return (
191 !(function (t) {
192 return (
193 "symbol" == typeof t ||
194 ("object" == typeof t && null !== t && !(Symbol.toPrimitive in t || "toString" in t || "valueOf" in t))
195 );
196 })(t) &&
197 !isNaN(parseFloat(t)) &&
198 isFinite(t)
199 );
200 }
201 function H(t, e) {
202 const i = Math.round(t);
203 return i - e <= t && i + e >= t;
204 }
205 function j(t, e, i) {
206 let s, n, o;
207 for (s = 0, n = t.length; s < n; s++)
208 ((o = t[s][i]), isNaN(o) || ((e.min = Math.min(e.min, o)), (e.max = Math.max(e.max, o))));
209 }
210 function $(t) {
211 return t * (C / 180);
212 }
213 function Y(t) {
214 return t * (180 / C);
215 }
216 function U(t) {
217 if (!a(t)) return;
218 let e = 1,
219 i = 0;
220 for (; Math.round(t * e) / e !== t; ) ((e *= 10), i++);
221 return i;
222 }
223 function X(t, e) {
224 const i = e.x - t.x,
225 s = e.y - t.y,
226 n = Math.sqrt(i * i + s * s);
227 let o = Math.atan2(s, i);
228 return (o < -0.5 * C && (o += O), { angle: o, distance: n });
229 }
230 function q(t, e) {
231 return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));
232 }
233 function K(t, e) {
234 return ((t - e + A) % O) - C;
235 }
236 function G(t) {
237 return ((t % O) + O) % O;
238 }
239 function J(t, e, i, s) {
240 const n = G(t),
241 o = G(e),
242 a = G(i),
243 r = G(o - n),
244 l = G(a - n),
245 h = G(n - o),
246 c = G(n - a);
247 return n === o || n === a || (s && o === a) || (r > l && h < c);
248 }
249 function Z(t, e, i) {
250 return Math.max(e, Math.min(i, t));
251 }
252 function Q(t) {
253 return Z(t, -32768, 32767);
254 }
255 function tt(t, e, i, s = 1e-6) {
256 return t >= Math.min(e, i) - s && t <= Math.max(e, i) + s;
257 }
258 function et(t, e, i) {
259 i = i || ((i) => t[i] < e);
260 let s,
261 n = t.length - 1,
262 o = 0;
263 for (; n - o > 1; ) ((s = (o + n) >> 1), i(s) ? (o = s) : (n = s));
264 return { lo: o, hi: n };
265 }
266 const it = (t, e, i, s) =>
267 et(
268 t,
269 i,
270 s
271 ? (s) => {
272 const n = t[s][e];
273 return n < i || (n === i && t[s + 1][e] === i);
274 }
275 : (s) => t[s][e] < i,
276 ),
277 st = (t, e, i) => et(t, i, (s) => t[s][e] >= i);
278 function nt(t, e, i) {
279 let s = 0,
280 n = t.length;
281 for (; s < n && t[s] < e; ) s++;
282 for (; n > s && t[n - 1] > i; ) n--;
283 return s > 0 || n < t.length ? t.slice(s, n) : t;
284 }
285 const ot = ["push", "pop", "shift", "splice", "unshift"];
286 function at(t, e) {
287 t._chartjs
288 ? t._chartjs.listeners.push(e)
289 : (Object.defineProperty(t, "_chartjs", { configurable: !0, enumerable: !1, value: { listeners: [e] } }),
290 ot.forEach((e) => {
291 const i = "_onData" + w(e),
292 s = t[e];
293 Object.defineProperty(t, e, {
294 configurable: !0,
295 enumerable: !1,
296 value(...e) {
297 const n = s.apply(this, e);
298 return (
299 t._chartjs.listeners.forEach((t) => {
300 "function" == typeof t[i] && t[i](...e);
301 }),
302 n
303 );
304 },
305 });
306 }));
307 }
308 function rt(t, e) {
309 const i = t._chartjs;
310 if (!i) return;
311 const s = i.listeners,
312 n = s.indexOf(e);
313 (-1 !== n && s.splice(n, 1),
314 s.length > 0 ||
315 (ot.forEach((e) => {
316 delete t[e];
317 }),
318 delete t._chartjs));
319 }
320 function lt(t) {
321 const e = new Set(t);
322 return e.size === t.length ? t : Array.from(e);
323 }
324 const ht =
325 "undefined" == typeof window
326 ? function (t) {
327 return t();
328 }
329 : window.requestAnimationFrame;
330 function ct(t, e) {
331 let i = [],
332 s = !1;
333 return function (...n) {
334 ((i = n),
335 s ||
336 ((s = !0),
337 ht.call(window, () => {
338 ((s = !1), t.apply(e, i));
339 })));
340 };
341 }
342 function dt(t, e) {
343 let i;
344 return function (...s) {
345 return (e ? (clearTimeout(i), (i = setTimeout(t, e, s))) : t.apply(this, s), e);
346 };
347 }
348 const ut = (t) => ("start" === t ? "left" : "end" === t ? "right" : "center"),
349 ft = (t, e, i) => ("start" === t ? e : "end" === t ? i : (e + i) / 2),
350 gt = (t, e, i, s) => (t === (s ? "left" : "right") ? i : "center" === t ? (e + i) / 2 : e);
351 function pt(t, e, i) {
352 const n = e.length;
353 let o = 0,
354 a = n;
355 if (t._sorted) {
356 const { iScale: r, vScale: l, _parsed: h } = t,
357 c = t.dataset && t.dataset.options ? t.dataset.options.spanGaps : null,
358 d = r.axis,
359 { min: u, max: f, minDefined: g, maxDefined: p } = r.getUserBounds();
360 if (g) {
361 if (((o = Math.min(it(h, d, u).lo, i ? n : it(e, d, r.getPixelForValue(u)).lo)), c)) {
362 const t = h
363 .slice(0, o + 1)
364 .reverse()
365 .findIndex((t) => !s(t[l.axis]));
366 o -= Math.max(0, t);
367 }
368 o = Z(o, 0, n - 1);
369 }
370 if (p) {
371 let t = Math.max(it(h, r.axis, f, !0).hi + 1, i ? 0 : it(e, d, r.getPixelForValue(f), !0).hi + 1);
372 if (c) {
373 const e = h.slice(t - 1).findIndex((t) => !s(t[l.axis]));
374 t += Math.max(0, e);
375 }
376 a = Z(t, o, n) - o;
377 } else a = n - o;
378 }
379 return { start: o, count: a };
380 }
381 function mt(t) {
382 const { xScale: e, yScale: i, _scaleRanges: s } = t,
383 n = { xmin: e.min, xmax: e.max, ymin: i.min, ymax: i.max };
384 if (!s) return ((t._scaleRanges = n), !0);
385 const o = s.xmin !== e.min || s.xmax !== e.max || s.ymin !== i.min || s.ymax !== i.max;
386 return (Object.assign(s, n), o);
387 }
388 class xt {
389 constructor() {
390 ((this._request = null), (this._charts = new Map()), (this._running = !1), (this._lastDate = void 0));
391 }
392 _notify(t, e, i, s) {
393 const n = e.listeners[s],
394 o = e.duration;
395 n.forEach((s) => s({ chart: t, initial: e.initial, numSteps: o, currentStep: Math.min(i - e.start, o) }));
396 }
397 _refresh() {
398 this._request ||
399 ((this._running = !0),
400 (this._request = ht.call(window, () => {
401 (this._update(), (this._request = null), this._running && this._refresh());
402 })));
403 }
404 _update(t = Date.now()) {
405 let e = 0;
406 (this._charts.forEach((i, s) => {
407 if (!i.running || !i.items.length) return;
408 const n = i.items;
409 let o,
410 a = n.length - 1,
411 r = !1;
412 for (; a >= 0; --a)
413 ((o = n[a]),
414 o._active
415 ? (o._total > i.duration && (i.duration = o._total), o.tick(t), (r = !0))
416 : ((n[a] = n[n.length - 1]), n.pop()));
417 (r && (s.draw(), this._notify(s, i, t, "progress")),
418 n.length || ((i.running = !1), this._notify(s, i, t, "complete"), (i.initial = !1)),
419 (e += n.length));
420 }),
421 (this._lastDate = t),
422 0 === e && (this._running = !1));
423 }
424 _getAnims(t) {
425 const e = this._charts;
426 let i = e.get(t);
427 return (
428 i || ((i = { running: !1, initial: !0, items: [], listeners: { complete: [], progress: [] } }), e.set(t, i)),
429 i
430 );
431 }
432 listen(t, e, i) {
433 this._getAnims(t).listeners[e].push(i);
434 }
435 add(t, e) {
436 e && e.length && this._getAnims(t).items.push(...e);
437 }
438 has(t) {
439 return this._getAnims(t).items.length > 0;
440 }
441 start(t) {
442 const e = this._charts.get(t);
443 e &&
444 ((e.running = !0),
445 (e.start = Date.now()),
446 (e.duration = e.items.reduce((t, e) => Math.max(t, e._duration), 0)),
447 this._refresh());
448 }
449 running(t) {
450 if (!this._running) return !1;
451 const e = this._charts.get(t);
452 return !!(e && e.running && e.items.length);
453 }
454 stop(t) {
455 const e = this._charts.get(t);
456 if (!e || !e.items.length) return;
457 const i = e.items;
458 let s = i.length - 1;
459 for (; s >= 0; --s) i[s].cancel();
460 ((e.items = []), this._notify(t, e, Date.now(), "complete"));
461 }
462 remove(t) {
463 return this._charts.delete(t);
464 }
465 }
466 var bt = new xt();
467 /*!
468 * @kurkle/color v0.3.2
469 * https://github.com/kurkle/color#readme
470 * (c) 2023 Jukka Kurkela
471 * Released under the MIT License
472 */ function _t(t) {
473 return (t + 0.5) | 0;
474 }
475 const yt = (t, e, i) => Math.max(Math.min(t, i), e);
476 function vt(t) {
477 return yt(_t(2.55 * t), 0, 255);
478 }
479 function Mt(t) {
480 return yt(_t(255 * t), 0, 255);
481 }
482 function wt(t) {
483 return yt(_t(t / 2.55) / 100, 0, 1);
484 }
485 function kt(t) {
486 return yt(_t(100 * t), 0, 100);
487 }
488 const St = {
489 0: 0,
490 1: 1,
491 2: 2,
492 3: 3,
493 4: 4,
494 5: 5,
495 6: 6,
496 7: 7,
497 8: 8,
498 9: 9,
499 A: 10,
500 B: 11,
501 C: 12,
502 D: 13,
503 E: 14,
504 F: 15,
505 a: 10,
506 b: 11,
507 c: 12,
508 d: 13,
509 e: 14,
510 f: 15,
511 },
512 Pt = [..."0123456789ABCDEF"],
513 Dt = (t) => Pt[15 & t],
514 Ct = (t) => Pt[(240 & t) >> 4] + Pt[15 & t],
515 Ot = (t) => (240 & t) >> 4 == (15 & t);
516 function At(t) {
517 var e = ((t) => Ot(t.r) && Ot(t.g) && Ot(t.b) && Ot(t.a))(t) ? Dt : Ct;
518 return t ? "#" + e(t.r) + e(t.g) + e(t.b) + ((t, e) => (t < 255 ? e(t) : ""))(t.a, e) : void 0;
519 }
520 const Tt =
521 /^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;
522 function Lt(t, e, i) {
523 const s = e * Math.min(i, 1 - i),
524 n = (e, n = (e + t / 30) % 12) => i - s * Math.max(Math.min(n - 3, 9 - n, 1), -1);
525 return [n(0), n(8), n(4)];
526 }
527 function Et(t, e, i) {
528 const s = (s, n = (s + t / 60) % 6) => i - i * e * Math.max(Math.min(n, 4 - n, 1), 0);
529 return [s(5), s(3), s(1)];
530 }
531 function Rt(t, e, i) {
532 const s = Lt(t, 1, 0.5);
533 let n;
534 for (e + i > 1 && ((n = 1 / (e + i)), (e *= n), (i *= n)), n = 0; n < 3; n++) ((s[n] *= 1 - e - i), (s[n] += e));
535 return s;
536 }
537 function It(t) {
538 const e = t.r / 255,
539 i = t.g / 255,
540 s = t.b / 255,
541 n = Math.max(e, i, s),
542 o = Math.min(e, i, s),
543 a = (n + o) / 2;
544 let r, l, h;
545 return (
546 n !== o &&
547 ((h = n - o),
548 (l = a > 0.5 ? h / (2 - n - o) : h / (n + o)),
549 (r = (function (t, e, i, s, n) {
550 return t === n ? (e - i) / s + (e < i ? 6 : 0) : e === n ? (i - t) / s + 2 : (t - e) / s + 4;
551 })(e, i, s, h, n)),
552 (r = 60 * r + 0.5)),
553 [0 | r, l || 0, a]
554 );
555 }
556 function zt(t, e, i, s) {
557 return (Array.isArray(e) ? t(e[0], e[1], e[2]) : t(e, i, s)).map(Mt);
558 }
559 function Ft(t, e, i) {
560 return zt(Lt, t, e, i);
561 }
562 function Vt(t) {
563 return ((t % 360) + 360) % 360;
564 }
565 function Bt(t) {
566 const e = Tt.exec(t);
567 let i,
568 s = 255;
569 if (!e) return;
570 e[5] !== i && (s = e[6] ? vt(+e[5]) : Mt(+e[5]));
571 const n = Vt(+e[2]),
572 o = +e[3] / 100,
573 a = +e[4] / 100;
574 return (
575 (i =
576 "hwb" === e[1]
577 ? (function (t, e, i) {
578 return zt(Rt, t, e, i);
579 })(n, o, a)
580 : "hsv" === e[1]
581 ? (function (t, e, i) {
582 return zt(Et, t, e, i);
583 })(n, o, a)
584 : Ft(n, o, a)),
585 { r: i[0], g: i[1], b: i[2], a: s }
586 );
587 }
588 const Wt = {
589 x: "dark",
590 Z: "light",
591 Y: "re",
592 X: "blu",
593 W: "gr",
594 V: "medium",
595 U: "slate",
596 A: "ee",
597 T: "ol",
598 S: "or",
599 B: "ra",
600 C: "lateg",
601 D: "ights",
602 R: "in",
603 Q: "turquois",
604 E: "hi",
605 P: "ro",
606 O: "al",
607 N: "le",
608 M: "de",
609 L: "yello",
610 F: "en",
611 K: "ch",
612 G: "arks",
613 H: "ea",
614 I: "ightg",
615 J: "wh",
616 },
617 Nt = {
618 OiceXe: "f0f8ff",
619 antiquewEte: "faebd7",
620 aqua: "ffff",
621 aquamarRe: "7fffd4",
622 azuY: "f0ffff",
623 beige: "f5f5dc",
624 bisque: "ffe4c4",
625 black: "0",
626 blanKedOmond: "ffebcd",
627 Xe: "ff",
628 XeviTet: "8a2be2",
629 bPwn: "a52a2a",
630 burlywood: "deb887",
631 caMtXe: "5f9ea0",
632 KartYuse: "7fff00",
633 KocTate: "d2691e",
634 cSO: "ff7f50",
635 cSnflowerXe: "6495ed",
636 cSnsilk: "fff8dc",
637 crimson: "dc143c",
638 cyan: "ffff",
639 xXe: "8b",
640 xcyan: "8b8b",
641 xgTMnPd: "b8860b",
642 xWay: "a9a9a9",
643 xgYF: "6400",
644 xgYy: "a9a9a9",
645 xkhaki: "bdb76b",
646 xmagFta: "8b008b",
647 xTivegYF: "556b2f",
648 xSange: "ff8c00",
649 xScEd: "9932cc",
650 xYd: "8b0000",
651 xsOmon: "e9967a",
652 xsHgYF: "8fbc8f",
653 xUXe: "483d8b",
654 xUWay: "2f4f4f",
655 xUgYy: "2f4f4f",
656 xQe: "ced1",
657 xviTet: "9400d3",
658 dAppRk: "ff1493",
659 dApskyXe: "bfff",
660 dimWay: "696969",
661 dimgYy: "696969",
662 dodgerXe: "1e90ff",
663 fiYbrick: "b22222",
664 flSOwEte: "fffaf0",
665 foYstWAn: "228b22",
666 fuKsia: "ff00ff",
667 gaRsbSo: "dcdcdc",
668 ghostwEte: "f8f8ff",
669 gTd: "ffd700",
670 gTMnPd: "daa520",
671 Way: "808080",
672 gYF: "8000",
673 gYFLw: "adff2f",
674 gYy: "808080",
675 honeyMw: "f0fff0",
676 hotpRk: "ff69b4",
677 RdianYd: "cd5c5c",
678 Rdigo: "4b0082",
679 ivSy: "fffff0",
680 khaki: "f0e68c",
681 lavFMr: "e6e6fa",
682 lavFMrXsh: "fff0f5",
683 lawngYF: "7cfc00",
684 NmoncEffon: "fffacd",
685 ZXe: "add8e6",
686 ZcSO: "f08080",
687 Zcyan: "e0ffff",
688 ZgTMnPdLw: "fafad2",
689 ZWay: "d3d3d3",
690 ZgYF: "90ee90",
691 ZgYy: "d3d3d3",
692 ZpRk: "ffb6c1",
693 ZsOmon: "ffa07a",
694 ZsHgYF: "20b2aa",
695 ZskyXe: "87cefa",
696 ZUWay: "778899",
697 ZUgYy: "778899",
698 ZstAlXe: "b0c4de",
699 ZLw: "ffffe0",
700 lime: "ff00",
701 limegYF: "32cd32",
702 lRF: "faf0e6",
703 magFta: "ff00ff",
704 maPon: "800000",
705 VaquamarRe: "66cdaa",
706 VXe: "cd",
707 VScEd: "ba55d3",
708 VpurpN: "9370db",
709 VsHgYF: "3cb371",
710 VUXe: "7b68ee",
711 VsprRggYF: "fa9a",
712 VQe: "48d1cc",
713 VviTetYd: "c71585",
714 midnightXe: "191970",
715 mRtcYam: "f5fffa",
716 mistyPse: "ffe4e1",
717 moccasR: "ffe4b5",
718 navajowEte: "ffdead",
719 navy: "80",
720 Tdlace: "fdf5e6",
721 Tive: "808000",
722 TivedBb: "6b8e23",
723 Sange: "ffa500",
724 SangeYd: "ff4500",
725 ScEd: "da70d6",
726 pOegTMnPd: "eee8aa",
727 pOegYF: "98fb98",
728 pOeQe: "afeeee",
729 pOeviTetYd: "db7093",
730 papayawEp: "ffefd5",
731 pHKpuff: "ffdab9",
732 peru: "cd853f",
733 pRk: "ffc0cb",
734 plum: "dda0dd",
735 powMrXe: "b0e0e6",
736 purpN: "800080",
737 YbeccapurpN: "663399",
738 Yd: "ff0000",
739 Psybrown: "bc8f8f",
740 PyOXe: "4169e1",
741 saddNbPwn: "8b4513",
742 sOmon: "fa8072",
743 sandybPwn: "f4a460",
744 sHgYF: "2e8b57",
745 sHshell: "fff5ee",
746 siFna: "a0522d",
747 silver: "c0c0c0",
748 skyXe: "87ceeb",
749 UXe: "6a5acd",
750 UWay: "708090",
751 UgYy: "708090",
752 snow: "fffafa",
753 sprRggYF: "ff7f",
754 stAlXe: "4682b4",
755 tan: "d2b48c",
756 teO: "8080",
757 tEstN: "d8bfd8",
758 tomato: "ff6347",
759 Qe: "40e0d0",
760 viTet: "ee82ee",
761 JHt: "f5deb3",
762 wEte: "ffffff",
763 wEtesmoke: "f5f5f5",
764 Lw: "ffff00",
765 LwgYF: "9acd32",
766 };
767 let Ht;
768 function jt(t) {
769 Ht ||
770 ((Ht = (function () {
771 const t = {},
772 e = Object.keys(Nt),
773 i = Object.keys(Wt);
774 let s, n, o, a, r;
775 for (s = 0; s < e.length; s++) {
776 for (a = r = e[s], n = 0; n < i.length; n++) ((o = i[n]), (r = r.replace(o, Wt[o])));
777 ((o = parseInt(Nt[a], 16)), (t[r] = [(o >> 16) & 255, (o >> 8) & 255, 255 & o]));
778 }
779 return t;
780 })()),
781 (Ht.transparent = [0, 0, 0, 0]));
782 const e = Ht[t.toLowerCase()];
783 return e && { r: e[0], g: e[1], b: e[2], a: 4 === e.length ? e[3] : 255 };
784 }
785 const $t = /^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;
786 const Yt = (t) => (t <= 0.0031308 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - 0.055),
787 Ut = (t) => (t <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4));
788 function Xt(t, e, i) {
789 if (t) {
790 let s = It(t);
791 ((s[e] = Math.max(0, Math.min(s[e] + s[e] * i, 0 === e ? 360 : 1))),
792 (s = Ft(s)),
793 (t.r = s[0]),
794 (t.g = s[1]),
795 (t.b = s[2]));
796 }
797 }
798 function qt(t, e) {
799 return t ? Object.assign(e || {}, t) : t;
800 }
801 function Kt(t) {
802 var e = { r: 0, g: 0, b: 0, a: 255 };
803 return (
804 Array.isArray(t)
805 ? t.length >= 3 && ((e = { r: t[0], g: t[1], b: t[2], a: 255 }), t.length > 3 && (e.a = Mt(t[3])))
806 : ((e = qt(t, { r: 0, g: 0, b: 0, a: 1 })).a = Mt(e.a)),
807 e
808 );
809 }
810 function Gt(t) {
811 return "r" === t.charAt(0)
812 ? (function (t) {
813 const e = $t.exec(t);
814 let i,
815 s,
816 n,
817 o = 255;
818 if (e) {
819 if (e[7] !== i) {
820 const t = +e[7];
821 o = e[8] ? vt(t) : yt(255 * t, 0, 255);
822 }
823 return (
824 (i = +e[1]),
825 (s = +e[3]),
826 (n = +e[5]),
827 (i = 255 & (e[2] ? vt(i) : yt(i, 0, 255))),
828 (s = 255 & (e[4] ? vt(s) : yt(s, 0, 255))),
829 (n = 255 & (e[6] ? vt(n) : yt(n, 0, 255))),
830 { r: i, g: s, b: n, a: o }
831 );
832 }
833 })(t)
834 : Bt(t);
835 }
836 class Jt {
837 constructor(t) {
838 if (t instanceof Jt) return t;
839 const e = typeof t;
840 let i;
841 var s, n, o;
842 ("object" === e
843 ? (i = Kt(t))
844 : "string" === e &&
845 ((o = (s = t).length),
846 "#" === s[0] &&
847 (4 === o || 5 === o
848 ? (n = {
849 r: 255 & (17 * St[s[1]]),
850 g: 255 & (17 * St[s[2]]),
851 b: 255 & (17 * St[s[3]]),
852 a: 5 === o ? 17 * St[s[4]] : 255,
853 })
854 : (7 !== o && 9 !== o) ||
855 (n = {
856 r: (St[s[1]] << 4) | St[s[2]],
857 g: (St[s[3]] << 4) | St[s[4]],
858 b: (St[s[5]] << 4) | St[s[6]],
859 a: 9 === o ? (St[s[7]] << 4) | St[s[8]] : 255,
860 })),
861 (i = n || jt(t) || Gt(t))),
862 (this._rgb = i),
863 (this._valid = !!i));
864 }
865 get valid() {
866 return this._valid;
867 }
868 get rgb() {
869 var t = qt(this._rgb);
870 return (t && (t.a = wt(t.a)), t);
871 }
872 set rgb(t) {
873 this._rgb = Kt(t);
874 }
875 rgbString() {
876 return this._valid
877 ? (t = this._rgb) && (t.a < 255 ? `rgba(${t.r}, ${t.g}, ${t.b}, ${wt(t.a)})` : `rgb(${t.r}, ${t.g}, ${t.b})`)
878 : void 0;
879 var t;
880 }
881 hexString() {
882 return this._valid ? At(this._rgb) : void 0;
883 }
884 hslString() {
885 return this._valid
886 ? (function (t) {
887 if (!t) return;
888 const e = It(t),
889 i = e[0],
890 s = kt(e[1]),
891 n = kt(e[2]);
892 return t.a < 255 ? `hsla(${i}, ${s}%, ${n}%, ${wt(t.a)})` : `hsl(${i}, ${s}%, ${n}%)`;
893 })(this._rgb)
894 : void 0;
895 }
896 mix(t, e) {
897 if (t) {
898 const i = this.rgb,
899 s = t.rgb;
900 let n;
901 const o = e === n ? 0.5 : e,
902 a = 2 * o - 1,
903 r = i.a - s.a,
904 l = ((a * r == -1 ? a : (a + r) / (1 + a * r)) + 1) / 2;
905 ((n = 1 - l),
906 (i.r = 255 & (l * i.r + n * s.r + 0.5)),
907 (i.g = 255 & (l * i.g + n * s.g + 0.5)),
908 (i.b = 255 & (l * i.b + n * s.b + 0.5)),
909 (i.a = o * i.a + (1 - o) * s.a),
910 (this.rgb = i));
911 }
912 return this;
913 }
914 interpolate(t, e) {
915 return (
916 t &&
917 (this._rgb = (function (t, e, i) {
918 const s = Ut(wt(t.r)),
919 n = Ut(wt(t.g)),
920 o = Ut(wt(t.b));
921 return {
922 r: Mt(Yt(s + i * (Ut(wt(e.r)) - s))),
923 g: Mt(Yt(n + i * (Ut(wt(e.g)) - n))),
924 b: Mt(Yt(o + i * (Ut(wt(e.b)) - o))),
925 a: t.a + i * (e.a - t.a),
926 };
927 })(this._rgb, t._rgb, e)),
928 this
929 );
930 }
931 clone() {
932 return new Jt(this.rgb);
933 }
934 alpha(t) {
935 return ((this._rgb.a = Mt(t)), this);
936 }
937 clearer(t) {
938 return ((this._rgb.a *= 1 - t), this);
939 }
940 greyscale() {
941 const t = this._rgb,
942 e = _t(0.3 * t.r + 0.59 * t.g + 0.11 * t.b);
943 return ((t.r = t.g = t.b = e), this);
944 }
945 opaquer(t) {
946 return ((this._rgb.a *= 1 + t), this);
947 }
948 negate() {
949 const t = this._rgb;
950 return ((t.r = 255 - t.r), (t.g = 255 - t.g), (t.b = 255 - t.b), this);
951 }
952 lighten(t) {
953 return (Xt(this._rgb, 2, t), this);
954 }
955 darken(t) {
956 return (Xt(this._rgb, 2, -t), this);
957 }
958 saturate(t) {
959 return (Xt(this._rgb, 1, t), this);
960 }
961 desaturate(t) {
962 return (Xt(this._rgb, 1, -t), this);
963 }
964 rotate(t) {
965 return (
966 (function (t, e) {
967 var i = It(t);
968 ((i[0] = Vt(i[0] + e)), (i = Ft(i)), (t.r = i[0]), (t.g = i[1]), (t.b = i[2]));
969 })(this._rgb, t),
970 this
971 );
972 }
973 }
974 function Zt(t) {
975 if (t && "object" == typeof t) {
976 const e = t.toString();
977 return "[object CanvasPattern]" === e || "[object CanvasGradient]" === e;
978 }
979 return !1;
980 }
981 function Qt(t) {
982 return Zt(t) ? t : new Jt(t);
983 }
984 function te(t) {
985 return Zt(t) ? t : new Jt(t).saturate(0.5).darken(0.1).hexString();
986 }
987 const ee = ["x", "y", "borderWidth", "radius", "tension"],
988 ie = ["color", "borderColor", "backgroundColor"];
989 const se = new Map();
990 function ne(t, e, i) {
991 return (function (t, e) {
992 e = e || {};
993 const i = t + JSON.stringify(e);
994 let s = se.get(i);
995 return (s || ((s = new Intl.NumberFormat(t, e)), se.set(i, s)), s);
996 })(e, i).format(t);
997 }
998 const oe = {
999 values: (t) => (n(t) ? t : "" + t),
1000 numeric(t, e, i) {
1001 if (0 === t) return "0";
1002 const s = this.chart.options.locale;
1003 let n,
1004 o = t;
1005 if (i.length > 1) {
1006 const e = Math.max(Math.abs(i[0].value), Math.abs(i[i.length - 1].value));
1007 ((e < 1e-4 || e > 1e15) && (n = "scientific"),
1008 (o = (function (t, e) {
1009 let i = e.length > 3 ? e[2].value - e[1].value : e[1].value - e[0].value;
1010 Math.abs(i) >= 1 && t !== Math.floor(t) && (i = t - Math.floor(t));
1011 return i;
1012 })(t, i)));
1013 }
1014 const a = z(Math.abs(o)),
1015 r = isNaN(a) ? 1 : Math.max(Math.min(-1 * Math.floor(a), 20), 0),
1016 l = { notation: n, minimumFractionDigits: r, maximumFractionDigits: r };
1017 return (Object.assign(l, this.options.ticks.format), ne(t, s, l));
1018 },
1019 logarithmic(t, e, i) {
1020 if (0 === t) return "0";
1021 const s = i[e].significand || t / Math.pow(10, Math.floor(z(t)));
1022 return [1, 2, 3, 5, 10, 15].includes(s) || e > 0.8 * i.length ? oe.numeric.call(this, t, e, i) : "";
1023 },
1024 };
1025 var ae = { formatters: oe };
1026 const re = Object.create(null),
1027 le = Object.create(null);
1028 function he(t, e) {
1029 if (!e) return t;
1030 const i = e.split(".");
1031 for (let e = 0, s = i.length; e < s; ++e) {
1032 const s = i[e];
1033 t = t[s] || (t[s] = Object.create(null));
1034 }
1035 return t;
1036 }
1037 function ce(t, e, i) {
1038 return "string" == typeof e ? x(he(t, e), i) : x(he(t, ""), e);
1039 }
1040 class de {
1041 constructor(t, e) {
1042 ((this.animation = void 0),
1043 (this.backgroundColor = "rgba(0,0,0,0.1)"),
1044 (this.borderColor = "rgba(0,0,0,0.1)"),
1045 (this.color = "#666"),
1046 (this.datasets = {}),
1047 (this.devicePixelRatio = (t) => t.chart.platform.getDevicePixelRatio()),
1048 (this.elements = {}),
1049 (this.events = ["mousemove", "mouseout", "click", "touchstart", "touchmove"]),
1050 (this.font = {
1051 family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
1052 size: 12,
1053 style: "normal",
1054 lineHeight: 1.2,
1055 weight: null,
1056 }),
1057 (this.hover = {}),
1058 (this.hoverBackgroundColor = (t, e) => te(e.backgroundColor)),
1059 (this.hoverBorderColor = (t, e) => te(e.borderColor)),
1060 (this.hoverColor = (t, e) => te(e.color)),
1061 (this.indexAxis = "x"),
1062 (this.interaction = { mode: "nearest", intersect: !0, includeInvisible: !1 }),
1063 (this.maintainAspectRatio = !0),
1064 (this.onHover = null),
1065 (this.onClick = null),
1066 (this.parsing = !0),
1067 (this.plugins = {}),
1068 (this.responsive = !0),
1069 (this.scale = void 0),
1070 (this.scales = {}),
1071 (this.showLine = !0),
1072 (this.drawActiveElementsOnTop = !0),
1073 this.describe(t),
1074 this.apply(e));
1075 }
1076 set(t, e) {
1077 return ce(this, t, e);
1078 }
1079 get(t) {
1080 return he(this, t);
1081 }
1082 describe(t, e) {
1083 return ce(le, t, e);
1084 }
1085 override(t, e) {
1086 return ce(re, t, e);
1087 }
1088 route(t, e, i, s) {
1089 const n = he(this, t),
1090 a = he(this, i),
1091 r = "_" + e;
1092 Object.defineProperties(n, {
1093 [r]: { value: n[e], writable: !0 },
1094 [e]: {
1095 enumerable: !0,
1096 get() {
1097 const t = this[r],
1098 e = a[s];
1099 return o(t) ? Object.assign({}, e, t) : l(t, e);
1100 },
1101 set(t) {
1102 this[r] = t;
1103 },
1104 },
1105 });
1106 }
1107 apply(t) {
1108 t.forEach((t) => t(this));
1109 }
1110 }
1111 var ue = new de(
1112 {
1113 _scriptable: (t) => !t.startsWith("on"),
1114 _indexable: (t) => "events" !== t,
1115 hover: { _fallback: "interaction" },
1116 interaction: { _scriptable: !1, _indexable: !1 },
1117 },
1118 [
1119 function (t) {
1120 (t.set("animation", {
1121 delay: void 0,
1122 duration: 1e3,
1123 easing: "easeOutQuart",
1124 fn: void 0,
1125 from: void 0,
1126 loop: void 0,
1127 to: void 0,
1128 type: void 0,
1129 }),
1130 t.describe("animation", {
1131 _fallback: !1,
1132 _indexable: !1,
1133 _scriptable: (t) => "onProgress" !== t && "onComplete" !== t && "fn" !== t,
1134 }),
1135 t.set("animations", {
1136 colors: { type: "color", properties: ie },
1137 numbers: { type: "number", properties: ee },
1138 }),
1139 t.describe("animations", { _fallback: "animation" }),
1140 t.set("transitions", {
1141 active: { animation: { duration: 400 } },
1142 resize: { animation: { duration: 0 } },
1143 show: { animations: { colors: { from: "transparent" }, visible: { type: "boolean", duration: 0 } } },
1144 hide: {
1145 animations: {
1146 colors: { to: "transparent" },
1147 visible: { type: "boolean", easing: "linear", fn: (t) => 0 | t },
1148 },
1149 },
1150 }));
1151 },
1152 function (t) {
1153 t.set("layout", { autoPadding: !0, padding: { top: 0, right: 0, bottom: 0, left: 0 } });
1154 },
1155 function (t) {
1156 (t.set("scale", {
1157 display: !0,
1158 offset: !1,
1159 reverse: !1,
1160 beginAtZero: !1,
1161 bounds: "ticks",
1162 clip: !0,
1163 grace: 0,
1164 grid: {
1165 display: !0,
1166 lineWidth: 1,
1167 drawOnChartArea: !0,
1168 drawTicks: !0,
1169 tickLength: 8,
1170 tickWidth: (t, e) => e.lineWidth,
1171 tickColor: (t, e) => e.color,
1172 offset: !1,
1173 },
1174 border: { display: !0, dash: [], dashOffset: 0, width: 1 },
1175 title: { display: !1, text: "", padding: { top: 4, bottom: 4 } },
1176 ticks: {
1177 minRotation: 0,
1178 maxRotation: 50,
1179 mirror: !1,
1180 textStrokeWidth: 0,
1181 textStrokeColor: "",
1182 padding: 3,
1183 display: !0,
1184 autoSkip: !0,
1185 autoSkipPadding: 3,
1186 labelOffset: 0,
1187 callback: ae.formatters.values,
1188 minor: {},
1189 major: {},
1190 align: "center",
1191 crossAlign: "near",
1192 showLabelBackdrop: !1,
1193 backdropColor: "rgba(255, 255, 255, 0.75)",
1194 backdropPadding: 2,
1195 },
1196 }),
1197 t.route("scale.ticks", "color", "", "color"),
1198 t.route("scale.grid", "color", "", "borderColor"),
1199 t.route("scale.border", "color", "", "borderColor"),
1200 t.route("scale.title", "color", "", "color"),
1201 t.describe("scale", {
1202 _fallback: !1,
1203 _scriptable: (t) => !t.startsWith("before") && !t.startsWith("after") && "callback" !== t && "parser" !== t,
1204 _indexable: (t) => "borderDash" !== t && "tickBorderDash" !== t && "dash" !== t,
1205 }),
1206 t.describe("scales", { _fallback: "scale" }),
1207 t.describe("scale.ticks", {
1208 _scriptable: (t) => "backdropPadding" !== t && "callback" !== t,
1209 _indexable: (t) => "backdropPadding" !== t,
1210 }));
1211 },
1212 ],
1213 );
1214 function fe() {
1215 return "undefined" != typeof window && "undefined" != typeof document;
1216 }
1217 function ge(t) {
1218 let e = t.parentNode;
1219 return (e && "[object ShadowRoot]" === e.toString() && (e = e.host), e);
1220 }
1221 function pe(t, e, i) {
1222 let s;
1223 return (
1224 "string" == typeof t
1225 ? ((s = parseInt(t, 10)), -1 !== t.indexOf("%") && (s = (s / 100) * e.parentNode[i]))
1226 : (s = t),
1227 s
1228 );
1229 }
1230 const me = (t) => t.ownerDocument.defaultView.getComputedStyle(t, null);
1231 function xe(t, e) {
1232 return me(t).getPropertyValue(e);
1233 }
1234 const be = ["top", "right", "bottom", "left"];
1235 function _e(t, e, i) {
1236 const s = {};
1237 i = i ? "-" + i : "";
1238 for (let n = 0; n < 4; n++) {
1239 const o = be[n];
1240 s[o] = parseFloat(t[e + "-" + o + i]) || 0;
1241 }
1242 return ((s.width = s.left + s.right), (s.height = s.top + s.bottom), s);
1243 }
1244 const ye = (t, e, i) => (t > 0 || e > 0) && (!i || !i.shadowRoot);
1245 function ve(t, e) {
1246 if ("native" in t) return t;
1247 const { canvas: i, currentDevicePixelRatio: s } = e,
1248 n = me(i),
1249 o = "border-box" === n.boxSizing,
1250 a = _e(n, "padding"),
1251 r = _e(n, "border", "width"),
1252 {
1253 x: l,
1254 y: h,
1255 box: c,
1256 } = (function (t, e) {
1257 const i = t.touches,
1258 s = i && i.length ? i[0] : t,
1259 { offsetX: n, offsetY: o } = s;
1260 let a,
1261 r,
1262 l = !1;
1263 if (ye(n, o, t.target)) ((a = n), (r = o));
1264 else {
1265 const t = e.getBoundingClientRect();
1266 ((a = s.clientX - t.left), (r = s.clientY - t.top), (l = !0));
1267 }
1268 return { x: a, y: r, box: l };
1269 })(t, i),
1270 d = a.left + (c && r.left),
1271 u = a.top + (c && r.top);
1272 let { width: f, height: g } = e;
1273 return (
1274 o && ((f -= a.width + r.width), (g -= a.height + r.height)),
1275 { x: Math.round((((l - d) / f) * i.width) / s), y: Math.round((((h - u) / g) * i.height) / s) }
1276 );
1277 }
1278 const Me = (t) => Math.round(10 * t) / 10;
1279 function we(t, e, i, s) {
1280 const n = me(t),
1281 o = _e(n, "margin"),
1282 a = pe(n.maxWidth, t, "clientWidth") || T,
1283 r = pe(n.maxHeight, t, "clientHeight") || T,
1284 l = (function (t, e, i) {
1285 let s, n;
1286 if (void 0 === e || void 0 === i) {
1287 const o = t && ge(t);
1288 if (o) {
1289 const t = o.getBoundingClientRect(),
1290 a = me(o),
1291 r = _e(a, "border", "width"),
1292 l = _e(a, "padding");
1293 ((e = t.width - l.width - r.width),
1294 (i = t.height - l.height - r.height),
1295 (s = pe(a.maxWidth, o, "clientWidth")),
1296 (n = pe(a.maxHeight, o, "clientHeight")));
1297 } else ((e = t.clientWidth), (i = t.clientHeight));
1298 }
1299 return { width: e, height: i, maxWidth: s || T, maxHeight: n || T };
1300 })(t, e, i);
1301 let { width: h, height: c } = l;
1302 if ("content-box" === n.boxSizing) {
1303 const t = _e(n, "border", "width"),
1304 e = _e(n, "padding");
1305 ((h -= e.width + t.width), (c -= e.height + t.height));
1306 }
1307 ((h = Math.max(0, h - o.width)),
1308 (c = Math.max(0, s ? h / s : c - o.height)),
1309 (h = Me(Math.min(h, a, l.maxWidth))),
1310 (c = Me(Math.min(c, r, l.maxHeight))),
1311 h && !c && (c = Me(h / 2)));
1312 return (
1313 (void 0 !== e || void 0 !== i) && s && l.height && c > l.height && ((c = l.height), (h = Me(Math.floor(c * s)))),
1314 { width: h, height: c }
1315 );
1316 }
1317 function ke(t, e, i) {
1318 const s = e || 1,
1319 n = Me(t.height * s),
1320 o = Me(t.width * s);
1321 ((t.height = Me(t.height)), (t.width = Me(t.width)));
1322 const a = t.canvas;
1323 return (
1324 a.style &&
1325 (i || (!a.style.height && !a.style.width)) &&
1326 ((a.style.height = `${t.height}px`), (a.style.width = `${t.width}px`)),
1327 (t.currentDevicePixelRatio !== s || a.height !== n || a.width !== o) &&
1328 ((t.currentDevicePixelRatio = s), (a.height = n), (a.width = o), t.ctx.setTransform(s, 0, 0, s, 0, 0), !0)
1329 );
1330 }
1331 const Se = (function () {
1332 let t = !1;
1333 try {
1334 const e = {
1335 get passive() {
1336 return ((t = !0), !1);
1337 },
1338 };
1339 fe() && (window.addEventListener("test", null, e), window.removeEventListener("test", null, e));
1340 } catch (t) {}
1341 return t;
1342 })();
1343 function Pe(t, e) {
1344 const i = xe(t, e),
1345 s = i && i.match(/^(\d+)(\.\d+)?px$/);
1346 return s ? +s[1] : void 0;
1347 }
1348 function De(t) {
1349 return !t || s(t.size) || s(t.family)
1350 ? null
1351 : (t.style ? t.style + " " : "") + (t.weight ? t.weight + " " : "") + t.size + "px " + t.family;
1352 }
1353 function Ce(t, e, i, s, n) {
1354 let o = e[n];
1355 return (o || ((o = e[n] = t.measureText(n).width), i.push(n)), o > s && (s = o), s);
1356 }
1357 function Oe(t, e, i, s) {
1358 let o = ((s = s || {}).data = s.data || {}),
1359 a = (s.garbageCollect = s.garbageCollect || []);
1360 (s.font !== e && ((o = s.data = {}), (a = s.garbageCollect = []), (s.font = e)), t.save(), (t.font = e));
1361 let r = 0;
1362 const l = i.length;
1363 let h, c, d, u, f;
1364 for (h = 0; h < l; h++)
1365 if (((u = i[h]), null == u || n(u))) {
1366 if (n(u)) for (c = 0, d = u.length; c < d; c++) ((f = u[c]), null == f || n(f) || (r = Ce(t, o, a, r, f)));
1367 } else r = Ce(t, o, a, r, u);
1368 t.restore();
1369 const g = a.length / 2;
1370 if (g > i.length) {
1371 for (h = 0; h < g; h++) delete o[a[h]];
1372 a.splice(0, g);
1373 }
1374 return r;
1375 }
1376 function Ae(t, e, i) {
1377 const s = t.currentDevicePixelRatio,
1378 n = 0 !== i ? Math.max(i / 2, 0.5) : 0;
1379 return Math.round((e - n) * s) / s + n;
1380 }
1381 function Te(t, e) {
1382 (e || t) &&
1383 ((e = e || t.getContext("2d")).save(), e.resetTransform(), e.clearRect(0, 0, t.width, t.height), e.restore());
1384 }
1385 function Le(t, e, i, s) {
1386 Ee(t, e, i, s, null);
1387 }
1388 function Ee(t, e, i, s, n) {
1389 let o, a, r, l, h, c, d, u;
1390 const f = e.pointStyle,
1391 g = e.rotation,
1392 p = e.radius;
1393 let m = (g || 0) * L;
1394 if (
1395 f &&
1396 "object" == typeof f &&
1397 ((o = f.toString()), "[object HTMLImageElement]" === o || "[object HTMLCanvasElement]" === o)
1398 )
1399 return (
1400 t.save(),
1401 t.translate(i, s),
1402 t.rotate(m),
1403 t.drawImage(f, -f.width / 2, -f.height / 2, f.width, f.height),
1404 void t.restore()
1405 );
1406 if (!(isNaN(p) || p <= 0)) {
1407 switch ((t.beginPath(), f)) {
1408 default:
1409 (n ? t.ellipse(i, s, n / 2, p, 0, 0, O) : t.arc(i, s, p, 0, O), t.closePath());
1410 break;
1411 case "triangle":
1412 ((c = n ? n / 2 : p),
1413 t.moveTo(i + Math.sin(m) * c, s - Math.cos(m) * p),
1414 (m += I),
1415 t.lineTo(i + Math.sin(m) * c, s - Math.cos(m) * p),
1416 (m += I),
1417 t.lineTo(i + Math.sin(m) * c, s - Math.cos(m) * p),
1418 t.closePath());
1419 break;
1420 case "rectRounded":
1421 ((h = 0.516 * p),
1422 (l = p - h),
1423 (a = Math.cos(m + R) * l),
1424 (d = Math.cos(m + R) * (n ? n / 2 - h : l)),
1425 (r = Math.sin(m + R) * l),
1426 (u = Math.sin(m + R) * (n ? n / 2 - h : l)),
1427 t.arc(i - d, s - r, h, m - C, m - E),
1428 t.arc(i + u, s - a, h, m - E, m),
1429 t.arc(i + d, s + r, h, m, m + E),
1430 t.arc(i - u, s + a, h, m + E, m + C),
1431 t.closePath());
1432 break;
1433 case "rect":
1434 if (!g) {
1435 ((l = Math.SQRT1_2 * p), (c = n ? n / 2 : l), t.rect(i - c, s - l, 2 * c, 2 * l));
1436 break;
1437 }
1438 m += R;
1439 case "rectRot":
1440 ((d = Math.cos(m) * (n ? n / 2 : p)),
1441 (a = Math.cos(m) * p),
1442 (r = Math.sin(m) * p),
1443 (u = Math.sin(m) * (n ? n / 2 : p)),
1444 t.moveTo(i - d, s - r),
1445 t.lineTo(i + u, s - a),
1446 t.lineTo(i + d, s + r),
1447 t.lineTo(i - u, s + a),
1448 t.closePath());
1449 break;
1450 case "crossRot":
1451 m += R;
1452 case "cross":
1453 ((d = Math.cos(m) * (n ? n / 2 : p)),
1454 (a = Math.cos(m) * p),
1455 (r = Math.sin(m) * p),
1456 (u = Math.sin(m) * (n ? n / 2 : p)),
1457 t.moveTo(i - d, s - r),
1458 t.lineTo(i + d, s + r),
1459 t.moveTo(i + u, s - a),
1460 t.lineTo(i - u, s + a));
1461 break;
1462 case "star":
1463 ((d = Math.cos(m) * (n ? n / 2 : p)),
1464 (a = Math.cos(m) * p),
1465 (r = Math.sin(m) * p),
1466 (u = Math.sin(m) * (n ? n / 2 : p)),
1467 t.moveTo(i - d, s - r),
1468 t.lineTo(i + d, s + r),
1469 t.moveTo(i + u, s - a),
1470 t.lineTo(i - u, s + a),
1471 (m += R),
1472 (d = Math.cos(m) * (n ? n / 2 : p)),
1473 (a = Math.cos(m) * p),
1474 (r = Math.sin(m) * p),
1475 (u = Math.sin(m) * (n ? n / 2 : p)),
1476 t.moveTo(i - d, s - r),
1477 t.lineTo(i + d, s + r),
1478 t.moveTo(i + u, s - a),
1479 t.lineTo(i - u, s + a));
1480 break;
1481 case "line":
1482 ((a = n ? n / 2 : Math.cos(m) * p), (r = Math.sin(m) * p), t.moveTo(i - a, s - r), t.lineTo(i + a, s + r));
1483 break;
1484 case "dash":
1485 (t.moveTo(i, s), t.lineTo(i + Math.cos(m) * (n ? n / 2 : p), s + Math.sin(m) * p));
1486 break;
1487 case !1:
1488 t.closePath();
1489 }
1490 (t.fill(), e.borderWidth > 0 && t.stroke());
1491 }
1492 }
1493 function Re(t, e, i) {
1494 return (
1495 (i = i || 0.5),
1496 !e || (t && t.x > e.left - i && t.x < e.right + i && t.y > e.top - i && t.y < e.bottom + i)
1497 );
1498 }
1499 function Ie(t, e) {
1500 (t.save(), t.beginPath(), t.rect(e.left, e.top, e.right - e.left, e.bottom - e.top), t.clip());
1501 }
1502 function ze(t) {
1503 t.restore();
1504 }
1505 function Fe(t, e, i, s, n) {
1506 if (!e) return t.lineTo(i.x, i.y);
1507 if ("middle" === n) {
1508 const s = (e.x + i.x) / 2;
1509 (t.lineTo(s, e.y), t.lineTo(s, i.y));
1510 } else ("after" === n) != !!s ? t.lineTo(e.x, i.y) : t.lineTo(i.x, e.y);
1511 t.lineTo(i.x, i.y);
1512 }
1513 function Ve(t, e, i, s) {
1514 if (!e) return t.lineTo(i.x, i.y);
1515 t.bezierCurveTo(s ? e.cp1x : e.cp2x, s ? e.cp1y : e.cp2y, s ? i.cp2x : i.cp1x, s ? i.cp2y : i.cp1y, i.x, i.y);
1516 }
1517 function Be(t, e, i, s, n) {
1518 if (n.strikethrough || n.underline) {
1519 const o = t.measureText(s),
1520 a = e - o.actualBoundingBoxLeft,
1521 r = e + o.actualBoundingBoxRight,
1522 l = i - o.actualBoundingBoxAscent,
1523 h = i + o.actualBoundingBoxDescent,
1524 c = n.strikethrough ? (l + h) / 2 : h;
1525 ((t.strokeStyle = t.fillStyle),
1526 t.beginPath(),
1527 (t.lineWidth = n.decorationWidth || 2),
1528 t.moveTo(a, c),
1529 t.lineTo(r, c),
1530 t.stroke());
1531 }
1532 }
1533 function We(t, e) {
1534 const i = t.fillStyle;
1535 ((t.fillStyle = e.color), t.fillRect(e.left, e.top, e.width, e.height), (t.fillStyle = i));
1536 }
1537 function Ne(t, e, i, o, a, r = {}) {
1538 const l = n(e) ? e : [e],
1539 h = r.strokeWidth > 0 && "" !== r.strokeColor;
1540 let c, d;
1541 for (
1542 t.save(),
1543 t.font = a.string,
1544 (function (t, e) {
1545 (e.translation && t.translate(e.translation[0], e.translation[1]),
1546 s(e.rotation) || t.rotate(e.rotation),
1547 e.color && (t.fillStyle = e.color),
1548 e.textAlign && (t.textAlign = e.textAlign),
1549 e.textBaseline && (t.textBaseline = e.textBaseline));
1550 })(t, r),
1551 c = 0;
1552 c < l.length;
1553 ++c
1554 )
1555 ((d = l[c]),
1556 r.backdrop && We(t, r.backdrop),
1557 h &&
1558 (r.strokeColor && (t.strokeStyle = r.strokeColor),
1559 s(r.strokeWidth) || (t.lineWidth = r.strokeWidth),
1560 t.strokeText(d, i, o, r.maxWidth)),
1561 t.fillText(d, i, o, r.maxWidth),
1562 Be(t, i, o, d, r),
1563 (o += Number(a.lineHeight)));
1564 t.restore();
1565 }
1566 function He(t, e) {
1567 const { x: i, y: s, w: n, h: o, radius: a } = e;
1568 (t.arc(i + a.topLeft, s + a.topLeft, a.topLeft, 1.5 * C, C, !0),
1569 t.lineTo(i, s + o - a.bottomLeft),
1570 t.arc(i + a.bottomLeft, s + o - a.bottomLeft, a.bottomLeft, C, E, !0),
1571 t.lineTo(i + n - a.bottomRight, s + o),
1572 t.arc(i + n - a.bottomRight, s + o - a.bottomRight, a.bottomRight, E, 0, !0),
1573 t.lineTo(i + n, s + a.topRight),
1574 t.arc(i + n - a.topRight, s + a.topRight, a.topRight, 0, -E, !0),
1575 t.lineTo(i + a.topLeft, s));
1576 }
1577 function je(t, e = [""], i, s, n = () => t[0]) {
1578 const o = i || t;
1579 void 0 === s && (s = ti("_fallback", t));
1580 const a = {
1581 [Symbol.toStringTag]: "Object",
1582 _cacheable: !0,
1583 _scopes: t,
1584 _rootScopes: o,
1585 _fallback: s,
1586 _getTarget: n,
1587 override: (i) => je([i, ...t], e, o, s),
1588 };
1589 return new Proxy(a, {
1590 deleteProperty: (e, i) => (delete e[i], delete e._keys, delete t[0][i], !0),
1591 get: (i, s) =>
1592 qe(i, s, () =>
1593 (function (t, e, i, s) {
1594 let n;
1595 for (const o of e) if (((n = ti(Ue(o, t), i)), void 0 !== n)) return Xe(t, n) ? Ze(i, s, t, n) : n;
1596 })(s, e, t, i),
1597 ),
1598 getOwnPropertyDescriptor: (t, e) => Reflect.getOwnPropertyDescriptor(t._scopes[0], e),
1599 getPrototypeOf: () => Reflect.getPrototypeOf(t[0]),
1600 has: (t, e) => ei(t).includes(e),
1601 ownKeys: (t) => ei(t),
1602 set(t, e, i) {
1603 const s = t._storage || (t._storage = n());
1604 return ((t[e] = s[e] = i), delete t._keys, !0);
1605 },
1606 });
1607 }
1608 function $e(t, e, i, s) {
1609 const a = {
1610 _cacheable: !1,
1611 _proxy: t,
1612 _context: e,
1613 _subProxy: i,
1614 _stack: new Set(),
1615 _descriptors: Ye(t, s),
1616 setContext: (e) => $e(t, e, i, s),
1617 override: (n) => $e(t.override(n), e, i, s),
1618 };
1619 return new Proxy(a, {
1620 deleteProperty: (e, i) => (delete e[i], delete t[i], !0),
1621 get: (t, e, i) =>
1622 qe(t, e, () =>
1623 (function (t, e, i) {
1624 const { _proxy: s, _context: a, _subProxy: r, _descriptors: l } = t;
1625 let h = s[e];
1626 S(h) &&
1627 l.isScriptable(e) &&
1628 (h = (function (t, e, i, s) {
1629 const { _proxy: n, _context: o, _subProxy: a, _stack: r } = i;
1630 if (r.has(t)) throw new Error("Recursion detected: " + Array.from(r).join("->") + "->" + t);
1631 r.add(t);
1632 let l = e(o, a || s);
1633 (r.delete(t), Xe(t, l) && (l = Ze(n._scopes, n, t, l)));
1634 return l;
1635 })(e, h, t, i));
1636 n(h) &&
1637 h.length &&
1638 (h = (function (t, e, i, s) {
1639 const { _proxy: n, _context: a, _subProxy: r, _descriptors: l } = i;
1640 if (void 0 !== a.index && s(t)) return e[a.index % e.length];
1641 if (o(e[0])) {
1642 const i = e,
1643 s = n._scopes.filter((t) => t !== i);
1644 e = [];
1645 for (const o of i) {
1646 const i = Ze(s, n, t, o);
1647 e.push($e(i, a, r && r[t], l));
1648 }
1649 }
1650 return e;
1651 })(e, h, t, l.isIndexable));
1652 Xe(e, h) && (h = $e(h, a, r && r[e], l));
1653 return h;
1654 })(t, e, i),
1655 ),
1656 getOwnPropertyDescriptor: (e, i) =>
1657 e._descriptors.allKeys
1658 ? Reflect.has(t, i)
1659 ? { enumerable: !0, configurable: !0 }
1660 : void 0
1661 : Reflect.getOwnPropertyDescriptor(t, i),
1662 getPrototypeOf: () => Reflect.getPrototypeOf(t),
1663 has: (e, i) => Reflect.has(t, i),
1664 ownKeys: () => Reflect.ownKeys(t),
1665 set: (e, i, s) => ((t[i] = s), delete e[i], !0),
1666 });
1667 }
1668 function Ye(t, e = { scriptable: !0, indexable: !0 }) {
1669 const { _scriptable: i = e.scriptable, _indexable: s = e.indexable, _allKeys: n = e.allKeys } = t;
1670 return {
1671 allKeys: n,
1672 scriptable: i,
1673 indexable: s,
1674 isScriptable: S(i) ? i : () => i,
1675 isIndexable: S(s) ? s : () => s,
1676 };
1677 }
1678 const Ue = (t, e) => (t ? t + w(e) : e),
1679 Xe = (t, e) => o(e) && "adapters" !== t && (null === Object.getPrototypeOf(e) || e.constructor === Object);
1680 function qe(t, e, i) {
1681 if (Object.prototype.hasOwnProperty.call(t, e) || "constructor" === e) return t[e];
1682 const s = i();
1683 return ((t[e] = s), s);
1684 }
1685 function Ke(t, e, i) {
1686 return S(t) ? t(e, i) : t;
1687 }
1688 const Ge = (t, e) => (!0 === t ? e : "string" == typeof t ? M(e, t) : void 0);
1689 function Je(t, e, i, s, n) {
1690 for (const o of e) {
1691 const e = Ge(i, o);
1692 if (e) {
1693 t.add(e);
1694 const o = Ke(e._fallback, i, n);
1695 if (void 0 !== o && o !== i && o !== s) return o;
1696 } else if (!1 === e && void 0 !== s && i !== s) return null;
1697 }
1698 return !1;
1699 }
1700 function Ze(t, e, i, s) {
1701 const a = e._rootScopes,
1702 r = Ke(e._fallback, i, s),
1703 l = [...t, ...a],
1704 h = new Set();
1705 h.add(s);
1706 let c = Qe(h, l, i, r || i, s);
1707 return (
1708 null !== c &&
1709 (void 0 === r || r === i || ((c = Qe(h, l, r, c, s)), null !== c)) &&
1710 je(Array.from(h), [""], a, r, () =>
1711 (function (t, e, i) {
1712 const s = t._getTarget();
1713 e in s || (s[e] = {});
1714 const a = s[e];
1715 if (n(a) && o(i)) return i;
1716 return a || {};
1717 })(e, i, s),
1718 )
1719 );
1720 }
1721 function Qe(t, e, i, s, n) {
1722 for (; i; ) i = Je(t, e, i, s, n);
1723 return i;
1724 }
1725 function ti(t, e) {
1726 for (const i of e) {
1727 if (!i) continue;
1728 const e = i[t];
1729 if (void 0 !== e) return e;
1730 }
1731 }
1732 function ei(t) {
1733 let e = t._keys;
1734 return (
1735 e ||
1736 (e = t._keys =
1737 (function (t) {
1738 const e = new Set();
1739 for (const i of t) for (const t of Object.keys(i).filter((t) => !t.startsWith("_"))) e.add(t);
1740 return Array.from(e);
1741 })(t._scopes)),
1742 e
1743 );
1744 }
1745 function ii(t, e, i, s) {
1746 const { iScale: n } = t,
1747 { key: o = "r" } = this._parsing,
1748 a = new Array(s);
1749 let r, l, h, c;
1750 for (r = 0, l = s; r < l; ++r) ((h = r + i), (c = e[h]), (a[r] = { r: n.parse(M(c, o), h) }));
1751 return a;
1752 }
1753 const si = Number.EPSILON || 1e-14,
1754 ni = (t, e) => e < t.length && !t[e].skip && t[e],
1755 oi = (t) => ("x" === t ? "y" : "x");
1756 function ai(t, e, i, s) {
1757 const n = t.skip ? e : t,
1758 o = e,
1759 a = i.skip ? e : i,
1760 r = q(o, n),
1761 l = q(a, o);
1762 let h = r / (r + l),
1763 c = l / (r + l);
1764 ((h = isNaN(h) ? 0 : h), (c = isNaN(c) ? 0 : c));
1765 const d = s * h,
1766 u = s * c;
1767 return {
1768 previous: { x: o.x - d * (a.x - n.x), y: o.y - d * (a.y - n.y) },
1769 next: { x: o.x + u * (a.x - n.x), y: o.y + u * (a.y - n.y) },
1770 };
1771 }
1772 function ri(t, e = "x") {
1773 const i = oi(e),
1774 s = t.length,
1775 n = Array(s).fill(0),
1776 o = Array(s);
1777 let a,
1778 r,
1779 l,
1780 h = ni(t, 0);
1781 for (a = 0; a < s; ++a)
1782 if (((r = l), (l = h), (h = ni(t, a + 1)), l)) {
1783 if (h) {
1784 const t = h[e] - l[e];
1785 n[a] = 0 !== t ? (h[i] - l[i]) / t : 0;
1786 }
1787 o[a] = r ? (h ? (F(n[a - 1]) !== F(n[a]) ? 0 : (n[a - 1] + n[a]) / 2) : n[a - 1]) : n[a];
1788 }
1789 (!(function (t, e, i) {
1790 const s = t.length;
1791 let n,
1792 o,
1793 a,
1794 r,
1795 l,
1796 h = ni(t, 0);
1797 for (let c = 0; c < s - 1; ++c)
1798 ((l = h),
1799 (h = ni(t, c + 1)),
1800 l &&
1801 h &&
1802 (V(e[c], 0, si)
1803 ? (i[c] = i[c + 1] = 0)
1804 : ((n = i[c] / e[c]),
1805 (o = i[c + 1] / e[c]),
1806 (r = Math.pow(n, 2) + Math.pow(o, 2)),
1807 r <= 9 || ((a = 3 / Math.sqrt(r)), (i[c] = n * a * e[c]), (i[c + 1] = o * a * e[c])))));
1808 })(t, n, o),
1809 (function (t, e, i = "x") {
1810 const s = oi(i),
1811 n = t.length;
1812 let o,
1813 a,
1814 r,
1815 l = ni(t, 0);
1816 for (let h = 0; h < n; ++h) {
1817 if (((a = r), (r = l), (l = ni(t, h + 1)), !r)) continue;
1818 const n = r[i],
1819 c = r[s];
1820 (a && ((o = (n - a[i]) / 3), (r[`cp1${i}`] = n - o), (r[`cp1${s}`] = c - o * e[h])),
1821 l && ((o = (l[i] - n) / 3), (r[`cp2${i}`] = n + o), (r[`cp2${s}`] = c + o * e[h])));
1822 }
1823 })(t, o, e));
1824 }
1825 function li(t, e, i) {
1826 return Math.max(Math.min(t, i), e);
1827 }
1828 function hi(t, e, i, s, n) {
1829 let o, a, r, l;
1830 if ((e.spanGaps && (t = t.filter((t) => !t.skip)), "monotone" === e.cubicInterpolationMode)) ri(t, n);
1831 else {
1832 let i = s ? t[t.length - 1] : t[0];
1833 for (o = 0, a = t.length; o < a; ++o)
1834 ((r = t[o]),
1835 (l = ai(i, r, t[Math.min(o + 1, a - (s ? 0 : 1)) % a], e.tension)),
1836 (r.cp1x = l.previous.x),
1837 (r.cp1y = l.previous.y),
1838 (r.cp2x = l.next.x),
1839 (r.cp2y = l.next.y),
1840 (i = r));
1841 }
1842 e.capBezierPoints &&
1843 (function (t, e) {
1844 let i,
1845 s,
1846 n,
1847 o,
1848 a,
1849 r = Re(t[0], e);
1850 for (i = 0, s = t.length; i < s; ++i)
1851 ((a = o),
1852 (o = r),
1853 (r = i < s - 1 && Re(t[i + 1], e)),
1854 o &&
1855 ((n = t[i]),
1856 a && ((n.cp1x = li(n.cp1x, e.left, e.right)), (n.cp1y = li(n.cp1y, e.top, e.bottom))),
1857 r && ((n.cp2x = li(n.cp2x, e.left, e.right)), (n.cp2y = li(n.cp2y, e.top, e.bottom)))));
1858 })(t, i);
1859 }
1860 const ci = (t) => 0 === t || 1 === t,
1861 di = (t, e, i) => -Math.pow(2, 10 * (t -= 1)) * Math.sin(((t - e) * O) / i),
1862 ui = (t, e, i) => Math.pow(2, -10 * t) * Math.sin(((t - e) * O) / i) + 1,
1863 fi = {
1864 linear: (t) => t,
1865 easeInQuad: (t) => t * t,
1866 easeOutQuad: (t) => -t * (t - 2),
1867 easeInOutQuad: (t) => ((t /= 0.5) < 1 ? 0.5 * t * t : -0.5 * (--t * (t - 2) - 1)),
1868 easeInCubic: (t) => t * t * t,
1869 easeOutCubic: (t) => (t -= 1) * t * t + 1,
1870 easeInOutCubic: (t) => ((t /= 0.5) < 1 ? 0.5 * t * t * t : 0.5 * ((t -= 2) * t * t + 2)),
1871 easeInQuart: (t) => t * t * t * t,
1872 easeOutQuart: (t) => -((t -= 1) * t * t * t - 1),
1873 easeInOutQuart: (t) => ((t /= 0.5) < 1 ? 0.5 * t * t * t * t : -0.5 * ((t -= 2) * t * t * t - 2)),
1874 easeInQuint: (t) => t * t * t * t * t,
1875 easeOutQuint: (t) => (t -= 1) * t * t * t * t + 1,
1876 easeInOutQuint: (t) => ((t /= 0.5) < 1 ? 0.5 * t * t * t * t * t : 0.5 * ((t -= 2) * t * t * t * t + 2)),
1877 easeInSine: (t) => 1 - Math.cos(t * E),
1878 easeOutSine: (t) => Math.sin(t * E),
1879 easeInOutSine: (t) => -0.5 * (Math.cos(C * t) - 1),
1880 easeInExpo: (t) => (0 === t ? 0 : Math.pow(2, 10 * (t - 1))),
1881 easeOutExpo: (t) => (1 === t ? 1 : 1 - Math.pow(2, -10 * t)),
1882 easeInOutExpo: (t) =>
1883 ci(t) ? t : t < 0.5 ? 0.5 * Math.pow(2, 10 * (2 * t - 1)) : 0.5 * (2 - Math.pow(2, -10 * (2 * t - 1))),
1884 easeInCirc: (t) => (t >= 1 ? t : -(Math.sqrt(1 - t * t) - 1)),
1885 easeOutCirc: (t) => Math.sqrt(1 - (t -= 1) * t),
1886 easeInOutCirc: (t) =>
1887 (t /= 0.5) < 1 ? -0.5 * (Math.sqrt(1 - t * t) - 1) : 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1),
1888 easeInElastic: (t) => (ci(t) ? t : di(t, 0.075, 0.3)),
1889 easeOutElastic: (t) => (ci(t) ? t : ui(t, 0.075, 0.3)),
1890 easeInOutElastic(t) {
1891 const e = 0.1125;
1892 return ci(t) ? t : t < 0.5 ? 0.5 * di(2 * t, e, 0.45) : 0.5 + 0.5 * ui(2 * t - 1, e, 0.45);
1893 },
1894 easeInBack(t) {
1895 const e = 1.70158;
1896 return t * t * ((e + 1) * t - e);
1897 },
1898 easeOutBack(t) {
1899 const e = 1.70158;
1900 return (t -= 1) * t * ((e + 1) * t + e) + 1;
1901 },
1902 easeInOutBack(t) {
1903 let e = 1.70158;
1904 return (t /= 0.5) < 1
1905 ? t * t * ((1 + (e *= 1.525)) * t - e) * 0.5
1906 : 0.5 * ((t -= 2) * t * ((1 + (e *= 1.525)) * t + e) + 2);
1907 },
1908 easeInBounce: (t) => 1 - fi.easeOutBounce(1 - t),
1909 easeOutBounce(t) {
1910 const e = 7.5625,
1911 i = 2.75;
1912 return t < 1 / i
1913 ? e * t * t
1914 : t < 2 / i
1915 ? e * (t -= 1.5 / i) * t + 0.75
1916 : t < 2.5 / i
1917 ? e * (t -= 2.25 / i) * t + 0.9375
1918 : e * (t -= 2.625 / i) * t + 0.984375;
1919 },
1920 easeInOutBounce: (t) => (t < 0.5 ? 0.5 * fi.easeInBounce(2 * t) : 0.5 * fi.easeOutBounce(2 * t - 1) + 0.5),
1921 };
1922 function gi(t, e, i, s) {
1923 return { x: t.x + i * (e.x - t.x), y: t.y + i * (e.y - t.y) };
1924 }
1925 function pi(t, e, i, s) {
1926 return {
1927 x: t.x + i * (e.x - t.x),
1928 y: "middle" === s ? (i < 0.5 ? t.y : e.y) : "after" === s ? (i < 1 ? t.y : e.y) : i > 0 ? e.y : t.y,
1929 };
1930 }
1931 function mi(t, e, i, s) {
1932 const n = { x: t.cp2x, y: t.cp2y },
1933 o = { x: e.cp1x, y: e.cp1y },
1934 a = gi(t, n, i),
1935 r = gi(n, o, i),
1936 l = gi(o, e, i),
1937 h = gi(a, r, i),
1938 c = gi(r, l, i);
1939 return gi(h, c, i);
1940 }
1941 const xi = /^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,
1942 bi = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;
1943 function _i(t, e) {
1944 const i = ("" + t).match(xi);
1945 if (!i || "normal" === i[1]) return 1.2 * e;
1946 switch (((t = +i[2]), i[3])) {
1947 case "px":
1948 return t;
1949 case "%":
1950 t /= 100;
1951 }
1952 return e * t;
1953 }
1954 const yi = (t) => +t || 0;
1955 function vi(t, e) {
1956 const i = {},
1957 s = o(e),
1958 n = s ? Object.keys(e) : e,
1959 a = o(t) ? (s ? (i) => l(t[i], t[e[i]]) : (e) => t[e]) : () => t;
1960 for (const t of n) i[t] = yi(a(t));
1961 return i;
1962 }
1963 function Mi(t) {
1964 return vi(t, { top: "y", right: "x", bottom: "y", left: "x" });
1965 }
1966 function wi(t) {
1967 return vi(t, ["topLeft", "topRight", "bottomLeft", "bottomRight"]);
1968 }
1969 function ki(t) {
1970 const e = Mi(t);
1971 return ((e.width = e.left + e.right), (e.height = e.top + e.bottom), e);
1972 }
1973 function Si(t, e) {
1974 ((t = t || {}), (e = e || ue.font));
1975 let i = l(t.size, e.size);
1976 "string" == typeof i && (i = parseInt(i, 10));
1977 let s = l(t.style, e.style);
1978 s && !("" + s).match(bi) && (console.warn('Invalid font style specified: "' + s + '"'), (s = void 0));
1979 const n = {
1980 family: l(t.family, e.family),
1981 lineHeight: _i(l(t.lineHeight, e.lineHeight), i),
1982 size: i,
1983 style: s,
1984 weight: l(t.weight, e.weight),
1985 string: "",
1986 };
1987 return ((n.string = De(n)), n);
1988 }
1989 function Pi(t, e, i, s) {
1990 let o,
1991 a,
1992 r,
1993 l = !0;
1994 for (o = 0, a = t.length; o < a; ++o)
1995 if (
1996 ((r = t[o]),
1997 void 0 !== r &&
1998 (void 0 !== e && "function" == typeof r && ((r = r(e)), (l = !1)),
1999 void 0 !== i && n(r) && ((r = r[i % r.length]), (l = !1)),
2000 void 0 !== r))
2001 )
2002 return (s && !l && (s.cacheable = !1), r);
2003 }
2004 function Di(t, e, i) {
2005 const { min: s, max: n } = t,
2006 o = c(e, (n - s) / 2),
2007 a = (t, e) => (i && 0 === t ? 0 : t + e);
2008 return { min: a(s, -Math.abs(o)), max: a(n, o) };
2009 }
2010 function Ci(t, e) {
2011 return Object.assign(Object.create(t), e);
2012 }
2013 function Oi(t, e, i) {
2014 return t
2015 ? (function (t, e) {
2016 return {
2017 x: (i) => t + t + e - i,
2018 setWidth(t) {
2019 e = t;
2020 },
2021 textAlign: (t) => ("center" === t ? t : "right" === t ? "left" : "right"),
2022 xPlus: (t, e) => t - e,
2023 leftForLtr: (t, e) => t - e,
2024 };
2025 })(e, i)
2026 : { x: (t) => t, setWidth(t) {}, textAlign: (t) => t, xPlus: (t, e) => t + e, leftForLtr: (t, e) => t };
2027 }
2028 function Ai(t, e) {
2029 let i, s;
2030 ("ltr" !== e && "rtl" !== e) ||
2031 ((i = t.canvas.style),
2032 (s = [i.getPropertyValue("direction"), i.getPropertyPriority("direction")]),
2033 i.setProperty("direction", e, "important"),
2034 (t.prevTextDirection = s));
2035 }
2036 function Ti(t, e) {
2037 void 0 !== e && (delete t.prevTextDirection, t.canvas.style.setProperty("direction", e[0], e[1]));
2038 }
2039 function Li(t) {
2040 return "angle" === t
2041 ? { between: J, compare: K, normalize: G }
2042 : { between: tt, compare: (t, e) => t - e, normalize: (t) => t };
2043 }
2044 function Ei({ start: t, end: e, count: i, loop: s, style: n }) {
2045 return { start: t % i, end: e % i, loop: s && (e - t + 1) % i == 0, style: n };
2046 }
2047 function Ri(t, e, i) {
2048 if (!i) return [t];
2049 const { property: s, start: n, end: o } = i,
2050 a = e.length,
2051 { compare: r, between: l, normalize: h } = Li(s),
2052 {
2053 start: c,
2054 end: d,
2055 loop: u,
2056 style: f,
2057 } = (function (t, e, i) {
2058 const { property: s, start: n, end: o } = i,
2059 { between: a, normalize: r } = Li(s),
2060 l = e.length;
2061 let h,
2062 c,
2063 { start: d, end: u, loop: f } = t;
2064 if (f) {
2065 for (d += l, u += l, h = 0, c = l; h < c && a(r(e[d % l][s]), n, o); ++h) (d--, u--);
2066 ((d %= l), (u %= l));
2067 }
2068 return (u < d && (u += l), { start: d, end: u, loop: f, style: t.style });
2069 })(t, e, i),
2070 g = [];
2071 let p,
2072 m,
2073 x,
2074 b = !1,
2075 _ = null;
2076 const y = () => b || (l(n, x, p) && 0 !== r(n, x)),
2077 v = () => !b || 0 === r(o, p) || l(o, x, p);
2078 for (let t = c, i = c; t <= d; ++t)
2079 ((m = e[t % a]),
2080 m.skip ||
2081 ((p = h(m[s])),
2082 p !== x &&
2083 ((b = l(p, n, o)),
2084 null === _ && y() && (_ = 0 === r(p, n) ? t : i),
2085 null !== _ && v() && (g.push(Ei({ start: _, end: t, loop: u, count: a, style: f })), (_ = null)),
2086 (i = t),
2087 (x = p))));
2088 return (null !== _ && g.push(Ei({ start: _, end: d, loop: u, count: a, style: f })), g);
2089 }
2090 function Ii(t, e) {
2091 const i = [],
2092 s = t.segments;
2093 for (let n = 0; n < s.length; n++) {
2094 const o = Ri(s[n], t.points, e);
2095 o.length && i.push(...o);
2096 }
2097 return i;
2098 }
2099 function zi(t, e) {
2100 const i = t.points,
2101 s = t.options.spanGaps,
2102 n = i.length;
2103 if (!n) return [];
2104 const o = !!t._loop,
2105 { start: a, end: r } = (function (t, e, i, s) {
2106 let n = 0,
2107 o = e - 1;
2108 if (i && !s) for (; n < e && !t[n].skip; ) n++;
2109 for (; n < e && t[n].skip; ) n++;
2110 for (n %= e, i && (o += n); o > n && t[o % e].skip; ) o--;
2111 return ((o %= e), { start: n, end: o });
2112 })(i, n, o, s);
2113 if (!0 === s) return Fi(t, [{ start: a, end: r, loop: o }], i, e);
2114 return Fi(
2115 t,
2116 (function (t, e, i, s) {
2117 const n = t.length,
2118 o = [];
2119 let a,
2120 r = e,
2121 l = t[e];
2122 for (a = e + 1; a <= i; ++a) {
2123 const i = t[a % n];
2124 (i.skip || i.stop
2125 ? l.skip || ((s = !1), o.push({ start: e % n, end: (a - 1) % n, loop: s }), (e = r = i.stop ? a : null))
2126 : ((r = a), l.skip && (e = a)),
2127 (l = i));
2128 }
2129 return (null !== r && o.push({ start: e % n, end: r % n, loop: s }), o);
2130 })(i, a, r < a ? r + n : r, !!t._fullLoop && 0 === a && r === n - 1),
2131 i,
2132 e,
2133 );
2134 }
2135 function Fi(t, e, i, s) {
2136 return s && s.setContext && i
2137 ? (function (t, e, i, s) {
2138 const n = t._chart.getContext(),
2139 o = Vi(t.options),
2140 {
2141 _datasetIndex: a,
2142 options: { spanGaps: r },
2143 } = t,
2144 l = i.length,
2145 h = [];
2146 let c = o,
2147 d = e[0].start,
2148 u = d;
2149 function f(t, e, s, n) {
2150 const o = r ? -1 : 1;
2151 if (t !== e) {
2152 for (t += l; i[t % l].skip; ) t -= o;
2153 for (; i[e % l].skip; ) e += o;
2154 t % l != e % l && (h.push({ start: t % l, end: e % l, loop: s, style: n }), (c = n), (d = e % l));
2155 }
2156 }
2157 for (const t of e) {
2158 d = r ? d : t.start;
2159 let e,
2160 o = i[d % l];
2161 for (u = d + 1; u <= t.end; u++) {
2162 const r = i[u % l];
2163 ((e = Vi(
2164 s.setContext(
2165 Ci(n, {
2166 type: "segment",
2167 p0: o,
2168 p1: r,
2169 p0DataIndex: (u - 1) % l,
2170 p1DataIndex: u % l,
2171 datasetIndex: a,
2172 }),
2173 ),
2174 )),
2175 Bi(e, c) && f(d, u - 1, t.loop, c),
2176 (o = r),
2177 (c = e));
2178 }
2179 d < u - 1 && f(d, u - 1, t.loop, c);
2180 }
2181 return h;
2182 })(t, e, i, s)
2183 : e;
2184 }
2185 function Vi(t) {
2186 return {
2187 backgroundColor: t.backgroundColor,
2188 borderCapStyle: t.borderCapStyle,
2189 borderDash: t.borderDash,
2190 borderDashOffset: t.borderDashOffset,
2191 borderJoinStyle: t.borderJoinStyle,
2192 borderWidth: t.borderWidth,
2193 borderColor: t.borderColor,
2194 };
2195 }
2196 function Bi(t, e) {
2197 if (!e) return !1;
2198 const i = [],
2199 s = function (t, e) {
2200 return Zt(e) ? (i.includes(e) || i.push(e), i.indexOf(e)) : e;
2201 };
2202 return JSON.stringify(t, s) !== JSON.stringify(e, s);
2203 }
2204 function Wi(t, e, i) {
2205 return t.options.clip ? t[i] : e[i];
2206 }
2207 function Ni(t, e) {
2208 const i = e._clip;
2209 if (i.disabled) return !1;
2210 const s = (function (t, e) {
2211 const { xScale: i, yScale: s } = t;
2212 return i && s
2213 ? { left: Wi(i, e, "left"), right: Wi(i, e, "right"), top: Wi(s, e, "top"), bottom: Wi(s, e, "bottom") }
2214 : e;
2215 })(e, t.chartArea);
2216 return {
2217 left: !1 === i.left ? 0 : s.left - (!0 === i.left ? 0 : i.left),
2218 right: !1 === i.right ? t.width : s.right + (!0 === i.right ? 0 : i.right),
2219 top: !1 === i.top ? 0 : s.top - (!0 === i.top ? 0 : i.top),
2220 bottom: !1 === i.bottom ? t.height : s.bottom + (!0 === i.bottom ? 0 : i.bottom),
2221 };
2222 }
2223 var Hi = Object.freeze({
2224 __proto__: null,
2225 HALF_PI: E,
2226 INFINITY: T,
2227 PI: C,
2228 PITAU: A,
2229 QUARTER_PI: R,
2230 RAD_PER_DEG: L,
2231 TAU: O,
2232 TWO_THIRDS_PI: I,
2233 _addGrace: Di,
2234 _alignPixel: Ae,
2235 _alignStartEnd: ft,
2236 _angleBetween: J,
2237 _angleDiff: K,
2238 _arrayUnique: lt,
2239 _attachContext: $e,
2240 _bezierCurveTo: Ve,
2241 _bezierInterpolation: mi,
2242 _boundSegment: Ri,
2243 _boundSegments: Ii,
2244 _capitalize: w,
2245 _computeSegments: zi,
2246 _createResolver: je,
2247 _decimalPlaces: U,
2248 _deprecated: function (t, e, i, s) {
2249 void 0 !== e && console.warn(t + ': "' + i + '" is deprecated. Please use "' + s + '" instead');
2250 },
2251 _descriptors: Ye,
2252 _elementsEqual: f,
2253 _factorize: W,
2254 _filterBetween: nt,
2255 _getParentNode: ge,
2256 _getStartAndCountOfVisiblePoints: pt,
2257 _int16Range: Q,
2258 _isBetween: tt,
2259 _isClickEvent: D,
2260 _isDomSupported: fe,
2261 _isPointInArea: Re,
2262 _limitValue: Z,
2263 _longestText: Oe,
2264 _lookup: et,
2265 _lookupByKey: it,
2266 _measureText: Ce,
2267 _merger: m,
2268 _mergerIf: _,
2269 _normalizeAngle: G,
2270 _parseObjectDataRadialScale: ii,
2271 _pointInLine: gi,
2272 _readValueToProps: vi,
2273 _rlookupByKey: st,
2274 _scaleRangesChanged: mt,
2275 _setMinAndMaxByKey: j,
2276 _splitKey: v,
2277 _steppedInterpolation: pi,
2278 _steppedLineTo: Fe,
2279 _textX: gt,
2280 _toLeftRightCenter: ut,
2281 _updateBezierControlPoints: hi,
2282 addRoundedRectPath: He,
2283 almostEquals: V,
2284 almostWhole: H,
2285 callback: d,
2286 clearCanvas: Te,
2287 clipArea: Ie,
2288 clone: g,
2289 color: Qt,
2290 createContext: Ci,
2291 debounce: dt,
2292 defined: k,
2293 distanceBetweenPoints: q,
2294 drawPoint: Le,
2295 drawPointLegend: Ee,
2296 each: u,
2297 easingEffects: fi,
2298 finiteOrDefault: r,
2299 fontString: function (t, e, i) {
2300 return e + " " + t + "px " + i;
2301 },
2302 formatNumber: ne,
2303 getAngleFromPoint: X,
2304 getDatasetClipArea: Ni,
2305 getHoverColor: te,
2306 getMaximumSize: we,
2307 getRelativePosition: ve,
2308 getRtlAdapter: Oi,
2309 getStyle: xe,
2310 isArray: n,
2311 isFinite: a,
2312 isFunction: S,
2313 isNullOrUndef: s,
2314 isNumber: N,
2315 isObject: o,
2316 isPatternOrGradient: Zt,
2317 listenArrayEvents: at,
2318 log10: z,
2319 merge: x,
2320 mergeIf: b,
2321 niceNum: B,
2322 noop: e,
2323 overrideTextDirection: Ai,
2324 readUsedSize: Pe,
2325 renderText: Ne,
2326 requestAnimFrame: ht,
2327 resolve: Pi,
2328 resolveObjectKey: M,
2329 restoreTextDirection: Ti,
2330 retinaScale: ke,
2331 setsEqual: P,
2332 sign: F,
2333 splineCurve: ai,
2334 splineCurveMonotone: ri,
2335 supportsEventListenerOptions: Se,
2336 throttled: ct,
2337 toDegrees: Y,
2338 toDimension: c,
2339 toFont: Si,
2340 toFontString: De,
2341 toLineHeight: _i,
2342 toPadding: ki,
2343 toPercentage: h,
2344 toRadians: $,
2345 toTRBL: Mi,
2346 toTRBLCorners: wi,
2347 uid: i,
2348 unclipArea: ze,
2349 unlistenArrayEvents: rt,
2350 valueOrDefault: l,
2351 });
2352 function ji(t, e, i, n) {
2353 const { controller: o, data: a, _sorted: r } = t,
2354 l = o._cachedMeta.iScale,
2355 h = t.dataset && t.dataset.options ? t.dataset.options.spanGaps : null;
2356 if (l && e === l.axis && "r" !== e && r && a.length) {
2357 const r = l._reversePixels ? st : it;
2358 if (!n) {
2359 const n = r(a, e, i);
2360 if (h) {
2361 const { vScale: e } = o._cachedMeta,
2362 { _parsed: i } = t,
2363 a = i
2364 .slice(0, n.lo + 1)
2365 .reverse()
2366 .findIndex((t) => !s(t[e.axis]));
2367 n.lo -= Math.max(0, a);
2368 const r = i.slice(n.hi).findIndex((t) => !s(t[e.axis]));
2369 n.hi += Math.max(0, r);
2370 }
2371 return n;
2372 }
2373 if (o._sharedOptions) {
2374 const t = a[0],
2375 s = "function" == typeof t.getRange && t.getRange(e);
2376 if (s) {
2377 const t = r(a, e, i - s),
2378 n = r(a, e, i + s);
2379 return { lo: t.lo, hi: n.hi };
2380 }
2381 }
2382 }
2383 return { lo: 0, hi: a.length - 1 };
2384 }
2385 function $i(t, e, i, s, n) {
2386 const o = t.getSortedVisibleDatasetMetas(),
2387 a = i[e];
2388 for (let t = 0, i = o.length; t < i; ++t) {
2389 const { index: i, data: r } = o[t],
2390 { lo: l, hi: h } = ji(o[t], e, a, n);
2391 for (let t = l; t <= h; ++t) {
2392 const e = r[t];
2393 e.skip || s(e, i, t);
2394 }
2395 }
2396 }
2397 function Yi(t, e, i, s, n) {
2398 const o = [];
2399 if (!n && !t.isPointInArea(e)) return o;
2400 return (
2401 $i(
2402 t,
2403 i,
2404 e,
2405 function (i, a, r) {
2406 (n || Re(i, t.chartArea, 0)) && i.inRange(e.x, e.y, s) && o.push({ element: i, datasetIndex: a, index: r });
2407 },
2408 !0,
2409 ),
2410 o
2411 );
2412 }
2413 function Ui(t, e, i, s, n, o) {
2414 let a = [];
2415 const r = (function (t) {
2416 const e = -1 !== t.indexOf("x"),
2417 i = -1 !== t.indexOf("y");
2418 return function (t, s) {
2419 const n = e ? Math.abs(t.x - s.x) : 0,
2420 o = i ? Math.abs(t.y - s.y) : 0;
2421 return Math.sqrt(Math.pow(n, 2) + Math.pow(o, 2));
2422 };
2423 })(i);
2424 let l = Number.POSITIVE_INFINITY;
2425 return (
2426 $i(t, i, e, function (i, h, c) {
2427 const d = i.inRange(e.x, e.y, n);
2428 if (s && !d) return;
2429 const u = i.getCenterPoint(n);
2430 if (!(!!o || t.isPointInArea(u)) && !d) return;
2431 const f = r(e, u);
2432 f < l
2433 ? ((a = [{ element: i, datasetIndex: h, index: c }]), (l = f))
2434 : f === l && a.push({ element: i, datasetIndex: h, index: c });
2435 }),
2436 a
2437 );
2438 }
2439 function Xi(t, e, i, s, n, o) {
2440 return o || t.isPointInArea(e)
2441 ? "r" !== i || s
2442 ? Ui(t, e, i, s, n, o)
2443 : (function (t, e, i, s) {
2444 let n = [];
2445 return (
2446 $i(t, i, e, function (t, i, o) {
2447 const { startAngle: a, endAngle: r } = t.getProps(["startAngle", "endAngle"], s),
2448 { angle: l } = X(t, { x: e.x, y: e.y });
2449 J(l, a, r) && n.push({ element: t, datasetIndex: i, index: o });
2450 }),
2451 n
2452 );
2453 })(t, e, i, n)
2454 : [];
2455 }
2456 function qi(t, e, i, s, n) {
2457 const o = [],
2458 a = "x" === i ? "inXRange" : "inYRange";
2459 let r = !1;
2460 return (
2461 $i(t, i, e, (t, s, l) => {
2462 t[a] && t[a](e[i], n) && (o.push({ element: t, datasetIndex: s, index: l }), (r = r || t.inRange(e.x, e.y, n)));
2463 }),
2464 s && !r ? [] : o
2465 );
2466 }
2467 var Ki = {
2468 evaluateInteractionItems: $i,
2469 modes: {
2470 index(t, e, i, s) {
2471 const n = ve(e, t),
2472 o = i.axis || "x",
2473 a = i.includeInvisible || !1,
2474 r = i.intersect ? Yi(t, n, o, s, a) : Xi(t, n, o, !1, s, a),
2475 l = [];
2476 return r.length
2477 ? (t.getSortedVisibleDatasetMetas().forEach((t) => {
2478 const e = r[0].index,
2479 i = t.data[e];
2480 i && !i.skip && l.push({ element: i, datasetIndex: t.index, index: e });
2481 }),
2482 l)
2483 : [];
2484 },
2485 dataset(t, e, i, s) {
2486 const n = ve(e, t),
2487 o = i.axis || "xy",
2488 a = i.includeInvisible || !1;
2489 let r = i.intersect ? Yi(t, n, o, s, a) : Xi(t, n, o, !1, s, a);
2490 if (r.length > 0) {
2491 const e = r[0].datasetIndex,
2492 i = t.getDatasetMeta(e).data;
2493 r = [];
2494 for (let t = 0; t < i.length; ++t) r.push({ element: i[t], datasetIndex: e, index: t });
2495 }
2496 return r;
2497 },
2498 point: (t, e, i, s) => Yi(t, ve(e, t), i.axis || "xy", s, i.includeInvisible || !1),
2499 nearest(t, e, i, s) {
2500 const n = ve(e, t),
2501 o = i.axis || "xy",
2502 a = i.includeInvisible || !1;
2503 return Xi(t, n, o, i.intersect, s, a);
2504 },
2505 x: (t, e, i, s) => qi(t, ve(e, t), "x", i.intersect, s),
2506 y: (t, e, i, s) => qi(t, ve(e, t), "y", i.intersect, s),
2507 },
2508 };
2509 const Gi = ["left", "top", "right", "bottom"];
2510 function Ji(t, e) {
2511 return t.filter((t) => t.pos === e);
2512 }
2513 function Zi(t, e) {
2514 return t.filter((t) => -1 === Gi.indexOf(t.pos) && t.box.axis === e);
2515 }
2516 function Qi(t, e) {
2517 return t.sort((t, i) => {
2518 const s = e ? i : t,
2519 n = e ? t : i;
2520 return s.weight === n.weight ? s.index - n.index : s.weight - n.weight;
2521 });
2522 }
2523 function ts(t, e) {
2524 const i = (function (t) {
2525 const e = {};
2526 for (const i of t) {
2527 const { stack: t, pos: s, stackWeight: n } = i;
2528 if (!t || !Gi.includes(s)) continue;
2529 const o = e[t] || (e[t] = { count: 0, placed: 0, weight: 0, size: 0 });
2530 (o.count++, (o.weight += n));
2531 }
2532 return e;
2533 })(t),
2534 { vBoxMaxWidth: s, hBoxMaxHeight: n } = e;
2535 let o, a, r;
2536 for (o = 0, a = t.length; o < a; ++o) {
2537 r = t[o];
2538 const { fullSize: a } = r.box,
2539 l = i[r.stack],
2540 h = l && r.stackWeight / l.weight;
2541 r.horizontal
2542 ? ((r.width = h ? h * s : a && e.availableWidth), (r.height = n))
2543 : ((r.width = s), (r.height = h ? h * n : a && e.availableHeight));
2544 }
2545 return i;
2546 }
2547 function es(t, e, i, s) {
2548 return Math.max(t[i], e[i]) + Math.max(t[s], e[s]);
2549 }
2550 function is(t, e) {
2551 ((t.top = Math.max(t.top, e.top)),
2552 (t.left = Math.max(t.left, e.left)),
2553 (t.bottom = Math.max(t.bottom, e.bottom)),
2554 (t.right = Math.max(t.right, e.right)));
2555 }
2556 function ss(t, e, i, s) {
2557 const { pos: n, box: a } = i,
2558 r = t.maxPadding;
2559 if (!o(n)) {
2560 i.size && (t[n] -= i.size);
2561 const e = s[i.stack] || { size: 0, count: 1 };
2562 ((e.size = Math.max(e.size, i.horizontal ? a.height : a.width)), (i.size = e.size / e.count), (t[n] += i.size));
2563 }
2564 a.getPadding && is(r, a.getPadding());
2565 const l = Math.max(0, e.outerWidth - es(r, t, "left", "right")),
2566 h = Math.max(0, e.outerHeight - es(r, t, "top", "bottom")),
2567 c = l !== t.w,
2568 d = h !== t.h;
2569 return ((t.w = l), (t.h = h), i.horizontal ? { same: c, other: d } : { same: d, other: c });
2570 }
2571 function ns(t, e) {
2572 const i = e.maxPadding;
2573 function s(t) {
2574 const s = { left: 0, top: 0, right: 0, bottom: 0 };
2575 return (
2576 t.forEach((t) => {
2577 s[t] = Math.max(e[t], i[t]);
2578 }),
2579 s
2580 );
2581 }
2582 return s(t ? ["left", "right"] : ["top", "bottom"]);
2583 }
2584 function os(t, e, i, s) {
2585 const n = [];
2586 let o, a, r, l, h, c;
2587 for (o = 0, a = t.length, h = 0; o < a; ++o) {
2588 ((r = t[o]), (l = r.box), l.update(r.width || e.w, r.height || e.h, ns(r.horizontal, e)));
2589 const { same: a, other: d } = ss(e, i, r, s);
2590 ((h |= a && n.length), (c = c || d), l.fullSize || n.push(r));
2591 }
2592 return (h && os(n, e, i, s)) || c;
2593 }
2594 function as(t, e, i, s, n) {
2595 ((t.top = i), (t.left = e), (t.right = e + s), (t.bottom = i + n), (t.width = s), (t.height = n));
2596 }
2597 function rs(t, e, i, s) {
2598 const n = i.padding;
2599 let { x: o, y: a } = e;
2600 for (const r of t) {
2601 const t = r.box,
2602 l = s[r.stack] || { count: 1, placed: 0, weight: 1 },
2603 h = r.stackWeight / l.weight || 1;
2604 if (r.horizontal) {
2605 const s = e.w * h,
2606 o = l.size || t.height;
2607 (k(l.start) && (a = l.start),
2608 t.fullSize ? as(t, n.left, a, i.outerWidth - n.right - n.left, o) : as(t, e.left + l.placed, a, s, o),
2609 (l.start = a),
2610 (l.placed += s),
2611 (a = t.bottom));
2612 } else {
2613 const s = e.h * h,
2614 a = l.size || t.width;
2615 (k(l.start) && (o = l.start),
2616 t.fullSize ? as(t, o, n.top, a, i.outerHeight - n.bottom - n.top) : as(t, o, e.top + l.placed, a, s),
2617 (l.start = o),
2618 (l.placed += s),
2619 (o = t.right));
2620 }
2621 }
2622 ((e.x = o), (e.y = a));
2623 }
2624 var ls = {
2625 addBox(t, e) {
2626 (t.boxes || (t.boxes = []),
2627 (e.fullSize = e.fullSize || !1),
2628 (e.position = e.position || "top"),
2629 (e.weight = e.weight || 0),
2630 (e._layers =
2631 e._layers ||
2632 function () {
2633 return [
2634 {
2635 z: 0,
2636 draw(t) {
2637 e.draw(t);
2638 },
2639 },
2640 ];
2641 }),
2642 t.boxes.push(e));
2643 },
2644 removeBox(t, e) {
2645 const i = t.boxes ? t.boxes.indexOf(e) : -1;
2646 -1 !== i && t.boxes.splice(i, 1);
2647 },
2648 configure(t, e, i) {
2649 ((e.fullSize = i.fullSize), (e.position = i.position), (e.weight = i.weight));
2650 },
2651 update(t, e, i, s) {
2652 if (!t) return;
2653 const n = ki(t.options.layout.padding),
2654 o = Math.max(e - n.width, 0),
2655 a = Math.max(i - n.height, 0),
2656 r = (function (t) {
2657 const e = (function (t) {
2658 const e = [];
2659 let i, s, n, o, a, r;
2660 for (i = 0, s = (t || []).length; i < s; ++i)
2661 ((n = t[i]),
2662 ({
2663 position: o,
2664 options: { stack: a, stackWeight: r = 1 },
2665 } = n),
2666 e.push({
2667 index: i,
2668 box: n,
2669 pos: o,
2670 horizontal: n.isHorizontal(),
2671 weight: n.weight,
2672 stack: a && o + a,
2673 stackWeight: r,
2674 }));
2675 return e;
2676 })(t),
2677 i = Qi(
2678 e.filter((t) => t.box.fullSize),
2679 !0,
2680 ),
2681 s = Qi(Ji(e, "left"), !0),
2682 n = Qi(Ji(e, "right")),
2683 o = Qi(Ji(e, "top"), !0),
2684 a = Qi(Ji(e, "bottom")),
2685 r = Zi(e, "x"),
2686 l = Zi(e, "y");
2687 return {
2688 fullSize: i,
2689 leftAndTop: s.concat(o),
2690 rightAndBottom: n.concat(l).concat(a).concat(r),
2691 chartArea: Ji(e, "chartArea"),
2692 vertical: s.concat(n).concat(l),
2693 horizontal: o.concat(a).concat(r),
2694 };
2695 })(t.boxes),
2696 l = r.vertical,
2697 h = r.horizontal;
2698 u(t.boxes, (t) => {
2699 "function" == typeof t.beforeLayout && t.beforeLayout();
2700 });
2701 const c = l.reduce((t, e) => (e.box.options && !1 === e.box.options.display ? t : t + 1), 0) || 1,
2702 d = Object.freeze({
2703 outerWidth: e,
2704 outerHeight: i,
2705 padding: n,
2706 availableWidth: o,
2707 availableHeight: a,
2708 vBoxMaxWidth: o / 2 / c,
2709 hBoxMaxHeight: a / 2,
2710 }),
2711 f = Object.assign({}, n);
2712 is(f, ki(s));
2713 const g = Object.assign({ maxPadding: f, w: o, h: a, x: n.left, y: n.top }, n),
2714 p = ts(l.concat(h), d);
2715 (os(r.fullSize, g, d, p),
2716 os(l, g, d, p),
2717 os(h, g, d, p) && os(l, g, d, p),
2718 (function (t) {
2719 const e = t.maxPadding;
2720 function i(i) {
2721 const s = Math.max(e[i] - t[i], 0);
2722 return ((t[i] += s), s);
2723 }
2724 ((t.y += i("top")), (t.x += i("left")), i("right"), i("bottom"));
2725 })(g),
2726 rs(r.leftAndTop, g, d, p),
2727 (g.x += g.w),
2728 (g.y += g.h),
2729 rs(r.rightAndBottom, g, d, p),
2730 (t.chartArea = { left: g.left, top: g.top, right: g.left + g.w, bottom: g.top + g.h, height: g.h, width: g.w }),
2731 u(r.chartArea, (e) => {
2732 const i = e.box;
2733 (Object.assign(i, t.chartArea), i.update(g.w, g.h, { left: 0, top: 0, right: 0, bottom: 0 }));
2734 }));
2735 },
2736 };
2737 class hs {
2738 acquireContext(t, e) {}
2739 releaseContext(t) {
2740 return !1;
2741 }
2742 addEventListener(t, e, i) {}
2743 removeEventListener(t, e, i) {}
2744 getDevicePixelRatio() {
2745 return 1;
2746 }
2747 getMaximumSize(t, e, i, s) {
2748 return (
2749 (e = Math.max(0, e || t.width)),
2750 (i = i || t.height),
2751 { width: e, height: Math.max(0, s ? Math.floor(e / s) : i) }
2752 );
2753 }
2754 isAttached(t) {
2755 return !0;
2756 }
2757 updateConfig(t) {}
2758 }
2759 class cs extends hs {
2760 acquireContext(t) {
2761 return (t && t.getContext && t.getContext("2d")) || null;
2762 }
2763 updateConfig(t) {
2764 t.options.animation = !1;
2765 }
2766 }
2767 const ds = "$chartjs",
2768 us = {
2769 touchstart: "mousedown",
2770 touchmove: "mousemove",
2771 touchend: "mouseup",
2772 pointerenter: "mouseenter",
2773 pointerdown: "mousedown",
2774 pointermove: "mousemove",
2775 pointerup: "mouseup",
2776 pointerleave: "mouseout",
2777 pointerout: "mouseout",
2778 },
2779 fs = (t) => null === t || "" === t;
2780 const gs = !!Se && { passive: !0 };
2781 function ps(t, e, i) {
2782 t && t.canvas && t.canvas.removeEventListener(e, i, gs);
2783 }
2784 function ms(t, e) {
2785 for (const i of t) if (i === e || i.contains(e)) return !0;
2786 }
2787 function xs(t, e, i) {
2788 const s = t.canvas,
2789 n = new MutationObserver((t) => {
2790 let e = !1;
2791 for (const i of t) ((e = e || ms(i.addedNodes, s)), (e = e && !ms(i.removedNodes, s)));
2792 e && i();
2793 });
2794 return (n.observe(document, { childList: !0, subtree: !0 }), n);
2795 }
2796 function bs(t, e, i) {
2797 const s = t.canvas,
2798 n = new MutationObserver((t) => {
2799 let e = !1;
2800 for (const i of t) ((e = e || ms(i.removedNodes, s)), (e = e && !ms(i.addedNodes, s)));
2801 e && i();
2802 });
2803 return (n.observe(document, { childList: !0, subtree: !0 }), n);
2804 }
2805 const _s = new Map();
2806 let ys = 0;
2807 function vs() {
2808 const t = window.devicePixelRatio;
2809 t !== ys &&
2810 ((ys = t),
2811 _s.forEach((e, i) => {
2812 i.currentDevicePixelRatio !== t && e();
2813 }));
2814 }
2815 function Ms(t, e, i) {
2816 const s = t.canvas,
2817 n = s && ge(s);
2818 if (!n) return;
2819 const o = ct((t, e) => {
2820 const s = n.clientWidth;
2821 (i(t, e), s < n.clientWidth && i());
2822 }, window),
2823 a = new ResizeObserver((t) => {
2824 const e = t[0],
2825 i = e.contentRect.width,
2826 s = e.contentRect.height;
2827 (0 === i && 0 === s) || o(i, s);
2828 });
2829 return (
2830 a.observe(n),
2831 (function (t, e) {
2832 (_s.size || window.addEventListener("resize", vs), _s.set(t, e));
2833 })(t, o),
2834 a
2835 );
2836 }
2837 function ws(t, e, i) {
2838 (i && i.disconnect(),
2839 "resize" === e &&
2840 (function (t) {
2841 (_s.delete(t), _s.size || window.removeEventListener("resize", vs));
2842 })(t));
2843 }
2844 function ks(t, e, i) {
2845 const s = t.canvas,
2846 n = ct((e) => {
2847 null !== t.ctx &&
2848 i(
2849 (function (t, e) {
2850 const i = us[t.type] || t.type,
2851 { x: s, y: n } = ve(t, e);
2852 return { type: i, chart: e, native: t, x: void 0 !== s ? s : null, y: void 0 !== n ? n : null };
2853 })(e, t),
2854 );
2855 }, t);
2856 return (
2857 (function (t, e, i) {
2858 t && t.addEventListener(e, i, gs);
2859 })(s, e, n),
2860 n
2861 );
2862 }
2863 class Ss extends hs {
2864 acquireContext(t, e) {
2865 const i = t && t.getContext && t.getContext("2d");
2866 return i && i.canvas === t
2867 ? ((function (t, e) {
2868 const i = t.style,
2869 s = t.getAttribute("height"),
2870 n = t.getAttribute("width");
2871 if (
2872 ((t[ds] = {
2873 initial: { height: s, width: n, style: { display: i.display, height: i.height, width: i.width } },
2874 }),
2875 (i.display = i.display || "block"),
2876 (i.boxSizing = i.boxSizing || "border-box"),
2877 fs(n))
2878 ) {
2879 const e = Pe(t, "width");
2880 void 0 !== e && (t.width = e);
2881 }
2882 if (fs(s))
2883 if ("" === t.style.height) t.height = t.width / (e || 2);
2884 else {
2885 const e = Pe(t, "height");
2886 void 0 !== e && (t.height = e);
2887 }
2888 })(t, e),
2889 i)
2890 : null;
2891 }
2892 releaseContext(t) {
2893 const e = t.canvas;
2894 if (!e[ds]) return !1;
2895 const i = e[ds].initial;
2896 ["height", "width"].forEach((t) => {
2897 const n = i[t];
2898 s(n) ? e.removeAttribute(t) : e.setAttribute(t, n);
2899 });
2900 const n = i.style || {};
2901 return (
2902 Object.keys(n).forEach((t) => {
2903 e.style[t] = n[t];
2904 }),
2905 (e.width = e.width),
2906 delete e[ds],
2907 !0
2908 );
2909 }
2910 addEventListener(t, e, i) {
2911 this.removeEventListener(t, e);
2912 const s = t.$proxies || (t.$proxies = {}),
2913 n = { attach: xs, detach: bs, resize: Ms }[e] || ks;
2914 s[e] = n(t, e, i);
2915 }
2916 removeEventListener(t, e) {
2917 const i = t.$proxies || (t.$proxies = {}),
2918 s = i[e];
2919 if (!s) return;
2920 ((({ attach: ws, detach: ws, resize: ws })[e] || ps)(t, e, s), (i[e] = void 0));
2921 }
2922 getDevicePixelRatio() {
2923 return window.devicePixelRatio;
2924 }
2925 getMaximumSize(t, e, i, s) {
2926 return we(t, e, i, s);
2927 }
2928 isAttached(t) {
2929 const e = t && ge(t);
2930 return !(!e || !e.isConnected);
2931 }
2932 }
2933 function Ps(t) {
2934 return !fe() || ("undefined" != typeof OffscreenCanvas && t instanceof OffscreenCanvas) ? cs : Ss;
2935 }
2936 var Ds = Object.freeze({
2937 __proto__: null,
2938 BasePlatform: hs,
2939 BasicPlatform: cs,
2940 DomPlatform: Ss,
2941 _detectPlatform: Ps,
2942 });
2943 const Cs = "transparent",
2944 Os = {
2945 boolean: (t, e, i) => (i > 0.5 ? e : t),
2946 color(t, e, i) {
2947 const s = Qt(t || Cs),
2948 n = s.valid && Qt(e || Cs);
2949 return n && n.valid ? n.mix(s, i).hexString() : e;
2950 },
2951 number: (t, e, i) => t + (e - t) * i,
2952 };
2953 class As {
2954 constructor(t, e, i, s) {
2955 const n = e[i];
2956 s = Pi([t.to, s, n, t.from]);
2957 const o = Pi([t.from, n, s]);
2958 ((this._active = !0),
2959 (this._fn = t.fn || Os[t.type || typeof o]),
2960 (this._easing = fi[t.easing] || fi.linear),
2961 (this._start = Math.floor(Date.now() + (t.delay || 0))),
2962 (this._duration = this._total = Math.floor(t.duration)),
2963 (this._loop = !!t.loop),
2964 (this._target = e),
2965 (this._prop = i),
2966 (this._from = o),
2967 (this._to = s),
2968 (this._promises = void 0));
2969 }
2970 active() {
2971 return this._active;
2972 }
2973 update(t, e, i) {
2974 if (this._active) {
2975 this._notify(!1);
2976 const s = this._target[this._prop],
2977 n = i - this._start,
2978 o = this._duration - n;
2979 ((this._start = i),
2980 (this._duration = Math.floor(Math.max(o, t.duration))),
2981 (this._total += n),
2982 (this._loop = !!t.loop),
2983 (this._to = Pi([t.to, e, s, t.from])),
2984 (this._from = Pi([t.from, s, e])));
2985 }
2986 }
2987 cancel() {
2988 this._active && (this.tick(Date.now()), (this._active = !1), this._notify(!1));
2989 }
2990 tick(t) {
2991 const e = t - this._start,
2992 i = this._duration,
2993 s = this._prop,
2994 n = this._from,
2995 o = this._loop,
2996 a = this._to;
2997 let r;
2998 if (((this._active = n !== a && (o || e < i)), !this._active))
2999 return ((this._target[s] = a), void this._notify(!0));
3000 e < 0
3001 ? (this._target[s] = n)
3002 : ((r = (e / i) % 2),
3003 (r = o && r > 1 ? 2 - r : r),
3004 (r = this._easing(Math.min(1, Math.max(0, r)))),
3005 (this._target[s] = this._fn(n, a, r)));
3006 }
3007 wait() {
3008 const t = this._promises || (this._promises = []);
3009 return new Promise((e, i) => {
3010 t.push({ res: e, rej: i });
3011 });
3012 }
3013 _notify(t) {
3014 const e = t ? "res" : "rej",
3015 i = this._promises || [];
3016 for (let t = 0; t < i.length; t++) i[t][e]();
3017 }
3018 }
3019 class Ts {
3020 constructor(t, e) {
3021 ((this._chart = t), (this._properties = new Map()), this.configure(e));
3022 }
3023 configure(t) {
3024 if (!o(t)) return;
3025 const e = Object.keys(ue.animation),
3026 i = this._properties;
3027 Object.getOwnPropertyNames(t).forEach((s) => {
3028 const a = t[s];
3029 if (!o(a)) return;
3030 const r = {};
3031 for (const t of e) r[t] = a[t];
3032 ((n(a.properties) && a.properties) || [s]).forEach((t) => {
3033 (t !== s && i.has(t)) || i.set(t, r);
3034 });
3035 });
3036 }
3037 _animateOptions(t, e) {
3038 const i = e.options,
3039 s = (function (t, e) {
3040 if (!e) return;
3041 let i = t.options;
3042 if (!i) return void (t.options = e);
3043 i.$shared && (t.options = i = Object.assign({}, i, { $shared: !1, $animations: {} }));
3044 return i;
3045 })(t, i);
3046 if (!s) return [];
3047 const n = this._createAnimations(s, i);
3048 return (
3049 i.$shared &&
3050 (function (t, e) {
3051 const i = [],
3052 s = Object.keys(e);
3053 for (let e = 0; e < s.length; e++) {
3054 const n = t[s[e]];
3055 n && n.active() && i.push(n.wait());
3056 }
3057 return Promise.all(i);
3058 })(t.options.$animations, i).then(
3059 () => {
3060 t.options = i;
3061 },
3062 () => {},
3063 ),
3064 n
3065 );
3066 }
3067 _createAnimations(t, e) {
3068 const i = this._properties,
3069 s = [],
3070 n = t.$animations || (t.$animations = {}),
3071 o = Object.keys(e),
3072 a = Date.now();
3073 let r;
3074 for (r = o.length - 1; r >= 0; --r) {
3075 const l = o[r];
3076 if ("$" === l.charAt(0)) continue;
3077 if ("options" === l) {
3078 s.push(...this._animateOptions(t, e));
3079 continue;
3080 }
3081 const h = e[l];
3082 let c = n[l];
3083 const d = i.get(l);
3084 if (c) {
3085 if (d && c.active()) {
3086 c.update(d, h, a);
3087 continue;
3088 }
3089 c.cancel();
3090 }
3091 d && d.duration ? ((n[l] = c = new As(d, t, l, h)), s.push(c)) : (t[l] = h);
3092 }
3093 return s;
3094 }
3095 update(t, e) {
3096 if (0 === this._properties.size) return void Object.assign(t, e);
3097 const i = this._createAnimations(t, e);
3098 return i.length ? (bt.add(this._chart, i), !0) : void 0;
3099 }
3100 }
3101 function Ls(t, e) {
3102 const i = (t && t.options) || {},
3103 s = i.reverse,
3104 n = void 0 === i.min ? e : 0,
3105 o = void 0 === i.max ? e : 0;
3106 return { start: s ? o : n, end: s ? n : o };
3107 }
3108 function Es(t, e) {
3109 const i = [],
3110 s = t._getSortedDatasetMetas(e);
3111 let n, o;
3112 for (n = 0, o = s.length; n < o; ++n) i.push(s[n].index);
3113 return i;
3114 }
3115 function Rs(t, e, i, s = {}) {
3116 const n = t.keys,
3117 o = "single" === s.mode;
3118 let r, l, h, c;
3119 if (null === e) return;
3120 let d = !1;
3121 for (r = 0, l = n.length; r < l; ++r) {
3122 if (((h = +n[r]), h === i)) {
3123 if (((d = !0), s.all)) continue;
3124 break;
3125 }
3126 ((c = t.values[h]), a(c) && (o || 0 === e || F(e) === F(c)) && (e += c));
3127 }
3128 return d || s.all ? e : 0;
3129 }
3130 function Is(t, e) {
3131 const i = t && t.options.stacked;
3132 return i || (void 0 === i && void 0 !== e.stack);
3133 }
3134 function zs(t, e, i) {
3135 const s = t[e] || (t[e] = {});
3136 return s[i] || (s[i] = {});
3137 }
3138 function Fs(t, e, i, s) {
3139 for (const n of e.getMatchingVisibleMetas(s).reverse()) {
3140 const e = t[n.index];
3141 if ((i && e > 0) || (!i && e < 0)) return n.index;
3142 }
3143 return null;
3144 }
3145 function Vs(t, e) {
3146 const { chart: i, _cachedMeta: s } = t,
3147 n = i._stacks || (i._stacks = {}),
3148 { iScale: o, vScale: a, index: r } = s,
3149 l = o.axis,
3150 h = a.axis,
3151 c = (function (t, e, i) {
3152 return `${t.id}.${e.id}.${i.stack || i.type}`;
3153 })(o, a, s),
3154 d = e.length;
3155 let u;
3156 for (let t = 0; t < d; ++t) {
3157 const i = e[t],
3158 { [l]: o, [h]: d } = i;
3159 ((u = (i._stacks || (i._stacks = {}))[h] = zs(n, c, o)),
3160 (u[r] = d),
3161 (u._top = Fs(u, a, !0, s.type)),
3162 (u._bottom = Fs(u, a, !1, s.type)));
3163 (u._visualValues || (u._visualValues = {}))[r] = d;
3164 }
3165 }
3166 function Bs(t, e) {
3167 const i = t.scales;
3168 return Object.keys(i)
3169 .filter((t) => i[t].axis === e)
3170 .shift();
3171 }
3172 function Ws(t, e) {
3173 const i = t.controller.index,
3174 s = t.vScale && t.vScale.axis;
3175 if (s) {
3176 e = e || t._parsed;
3177 for (const t of e) {
3178 const e = t._stacks;
3179 if (!e || void 0 === e[s] || void 0 === e[s][i]) return;
3180 (delete e[s][i],
3181 void 0 !== e[s]._visualValues && void 0 !== e[s]._visualValues[i] && delete e[s]._visualValues[i]);
3182 }
3183 }
3184 }
3185 const Ns = (t) => "reset" === t || "none" === t,
3186 Hs = (t, e) => (e ? t : Object.assign({}, t));
3187 class js {
3188 static defaults = {};
3189 static datasetElementType = null;
3190 static dataElementType = null;
3191 constructor(t, e) {
3192 ((this.chart = t),
3193 (this._ctx = t.ctx),
3194 (this.index = e),
3195 (this._cachedDataOpts = {}),
3196 (this._cachedMeta = this.getMeta()),
3197 (this._type = this._cachedMeta.type),
3198 (this.options = void 0),
3199 (this._parsing = !1),
3200 (this._data = void 0),
3201 (this._objectData = void 0),
3202 (this._sharedOptions = void 0),
3203 (this._drawStart = void 0),
3204 (this._drawCount = void 0),
3205 (this.enableOptionSharing = !1),
3206 (this.supportsDecimation = !1),
3207 (this.$context = void 0),
3208 (this._syncList = []),
3209 (this.datasetElementType = new.target.datasetElementType),
3210 (this.dataElementType = new.target.dataElementType),
3211 this.initialize());
3212 }
3213 initialize() {
3214 const t = this._cachedMeta;
3215 (this.configure(),
3216 this.linkScales(),
3217 (t._stacked = Is(t.vScale, t)),
3218 this.addElements(),
3219 this.options.fill &&
3220 !this.chart.isPluginEnabled("filler") &&
3221 console.warn(
3222 "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",
3223 ));
3224 }
3225 updateIndex(t) {
3226 (this.index !== t && Ws(this._cachedMeta), (this.index = t));
3227 }
3228 linkScales() {
3229 const t = this.chart,
3230 e = this._cachedMeta,
3231 i = this.getDataset(),
3232 s = (t, e, i, s) => ("x" === t ? e : "r" === t ? s : i),
3233 n = (e.xAxisID = l(i.xAxisID, Bs(t, "x"))),
3234 o = (e.yAxisID = l(i.yAxisID, Bs(t, "y"))),
3235 a = (e.rAxisID = l(i.rAxisID, Bs(t, "r"))),
3236 r = e.indexAxis,
3237 h = (e.iAxisID = s(r, n, o, a)),
3238 c = (e.vAxisID = s(r, o, n, a));
3239 ((e.xScale = this.getScaleForId(n)),
3240 (e.yScale = this.getScaleForId(o)),
3241 (e.rScale = this.getScaleForId(a)),
3242 (e.iScale = this.getScaleForId(h)),
3243 (e.vScale = this.getScaleForId(c)));
3244 }
3245 getDataset() {
3246 return this.chart.data.datasets[this.index];
3247 }
3248 getMeta() {
3249 return this.chart.getDatasetMeta(this.index);
3250 }
3251 getScaleForId(t) {
3252 return this.chart.scales[t];
3253 }
3254 _getOtherScale(t) {
3255 const e = this._cachedMeta;
3256 return t === e.iScale ? e.vScale : e.iScale;
3257 }
3258 reset() {
3259 this._update("reset");
3260 }
3261 _destroy() {
3262 const t = this._cachedMeta;
3263 (this._data && rt(this._data, this), t._stacked && Ws(t));
3264 }
3265 _dataCheck() {
3266 const t = this.getDataset(),
3267 e = t.data || (t.data = []),
3268 i = this._data;
3269 if (o(e)) {
3270 const t = this._cachedMeta;
3271 this._data = (function (t, e) {
3272 const { iScale: i, vScale: s } = e,
3273 n = "x" === i.axis ? "x" : "y",
3274 o = "x" === s.axis ? "x" : "y",
3275 a = Object.keys(t),
3276 r = new Array(a.length);
3277 let l, h, c;
3278 for (l = 0, h = a.length; l < h; ++l) ((c = a[l]), (r[l] = { [n]: c, [o]: t[c] }));
3279 return r;
3280 })(e, t);
3281 } else if (i !== e) {
3282 if (i) {
3283 rt(i, this);
3284 const t = this._cachedMeta;
3285 (Ws(t), (t._parsed = []));
3286 }
3287 (e && Object.isExtensible(e) && at(e, this), (this._syncList = []), (this._data = e));
3288 }
3289 }
3290 addElements() {
3291 const t = this._cachedMeta;
3292 (this._dataCheck(), this.datasetElementType && (t.dataset = new this.datasetElementType()));
3293 }
3294 buildOrUpdateElements(t) {
3295 const e = this._cachedMeta,
3296 i = this.getDataset();
3297 let s = !1;
3298 this._dataCheck();
3299 const n = e._stacked;
3300 ((e._stacked = Is(e.vScale, e)),
3301 e.stack !== i.stack && ((s = !0), Ws(e), (e.stack = i.stack)),
3302 this._resyncElements(t),
3303 (s || n !== e._stacked) && (Vs(this, e._parsed), (e._stacked = Is(e.vScale, e))));
3304 }
3305 configure() {
3306 const t = this.chart.config,
3307 e = t.datasetScopeKeys(this._type),
3308 i = t.getOptionScopes(this.getDataset(), e, !0);
3309 ((this.options = t.createResolver(i, this.getContext())),
3310 (this._parsing = this.options.parsing),
3311 (this._cachedDataOpts = {}));
3312 }
3313 parse(t, e) {
3314 const { _cachedMeta: i, _data: s } = this,
3315 { iScale: a, _stacked: r } = i,
3316 l = a.axis;
3317 let h,
3318 c,
3319 d,
3320 u = (0 === t && e === s.length) || i._sorted,
3321 f = t > 0 && i._parsed[t - 1];
3322 if (!1 === this._parsing) ((i._parsed = s), (i._sorted = !0), (d = s));
3323 else {
3324 d = n(s[t])
3325 ? this.parseArrayData(i, s, t, e)
3326 : o(s[t])
3327 ? this.parseObjectData(i, s, t, e)
3328 : this.parsePrimitiveData(i, s, t, e);
3329 const a = () => null === c[l] || (f && c[l] < f[l]);
3330 for (h = 0; h < e; ++h) ((i._parsed[h + t] = c = d[h]), u && (a() && (u = !1), (f = c)));
3331 i._sorted = u;
3332 }
3333 r && Vs(this, d);
3334 }
3335 parsePrimitiveData(t, e, i, s) {
3336 const { iScale: n, vScale: o } = t,
3337 a = n.axis,
3338 r = o.axis,
3339 l = n.getLabels(),
3340 h = n === o,
3341 c = new Array(s);
3342 let d, u, f;
3343 for (d = 0, u = s; d < u; ++d) ((f = d + i), (c[d] = { [a]: h || n.parse(l[f], f), [r]: o.parse(e[f], f) }));
3344 return c;
3345 }
3346 parseArrayData(t, e, i, s) {
3347 const { xScale: n, yScale: o } = t,
3348 a = new Array(s);
3349 let r, l, h, c;
3350 for (r = 0, l = s; r < l; ++r) ((h = r + i), (c = e[h]), (a[r] = { x: n.parse(c[0], h), y: o.parse(c[1], h) }));
3351 return a;
3352 }
3353 parseObjectData(t, e, i, s) {
3354 const { xScale: n, yScale: o } = t,
3355 { xAxisKey: a = "x", yAxisKey: r = "y" } = this._parsing,
3356 l = new Array(s);
3357 let h, c, d, u;
3358 for (h = 0, c = s; h < c; ++h)
3359 ((d = h + i), (u = e[d]), (l[h] = { x: n.parse(M(u, a), d), y: o.parse(M(u, r), d) }));
3360 return l;
3361 }
3362 getParsed(t) {
3363 return this._cachedMeta._parsed[t];
3364 }
3365 getDataElement(t) {
3366 return this._cachedMeta.data[t];
3367 }
3368 applyStack(t, e, i) {
3369 const s = this.chart,
3370 n = this._cachedMeta,
3371 o = e[t.axis];
3372 return Rs({ keys: Es(s, !0), values: e._stacks[t.axis]._visualValues }, o, n.index, { mode: i });
3373 }
3374 updateRangeFromParsed(t, e, i, s) {
3375 const n = i[e.axis];
3376 let o = null === n ? NaN : n;
3377 const a = s && i._stacks[e.axis];
3378 (s && a && ((s.values = a), (o = Rs(s, n, this._cachedMeta.index))),
3379 (t.min = Math.min(t.min, o)),
3380 (t.max = Math.max(t.max, o)));
3381 }
3382 getMinMax(t, e) {
3383 const i = this._cachedMeta,
3384 s = i._parsed,
3385 n = i._sorted && t === i.iScale,
3386 o = s.length,
3387 r = this._getOtherScale(t),
3388 l = ((t, e, i) => t && !e.hidden && e._stacked && { keys: Es(i, !0), values: null })(e, i, this.chart),
3389 h = { min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY },
3390 { min: c, max: d } = (function (t) {
3391 const { min: e, max: i, minDefined: s, maxDefined: n } = t.getUserBounds();
3392 return { min: s ? e : Number.NEGATIVE_INFINITY, max: n ? i : Number.POSITIVE_INFINITY };
3393 })(r);
3394 let u, f;
3395 function g() {
3396 f = s[u];
3397 const e = f[r.axis];
3398 return !a(f[t.axis]) || c > e || d < e;
3399 }
3400 for (u = 0; u < o && (g() || (this.updateRangeFromParsed(h, t, f, l), !n)); ++u);
3401 if (n)
3402 for (u = o - 1; u >= 0; --u)
3403 if (!g()) {
3404 this.updateRangeFromParsed(h, t, f, l);
3405 break;
3406 }
3407 return h;
3408 }
3409 getAllParsedValues(t) {
3410 const e = this._cachedMeta._parsed,
3411 i = [];
3412 let s, n, o;
3413 for (s = 0, n = e.length; s < n; ++s) ((o = e[s][t.axis]), a(o) && i.push(o));
3414 return i;
3415 }
3416 getMaxOverflow() {
3417 return !1;
3418 }
3419 getLabelAndValue(t) {
3420 const e = this._cachedMeta,
3421 i = e.iScale,
3422 s = e.vScale,
3423 n = this.getParsed(t);
3424 return { label: i ? "" + i.getLabelForValue(n[i.axis]) : "", value: s ? "" + s.getLabelForValue(n[s.axis]) : "" };
3425 }
3426 _update(t) {
3427 const e = this._cachedMeta;
3428 (this.update(t || "default"),
3429 (e._clip = (function (t) {
3430 let e, i, s, n;
3431 return (
3432 o(t) ? ((e = t.top), (i = t.right), (s = t.bottom), (n = t.left)) : (e = i = s = n = t),
3433 { top: e, right: i, bottom: s, left: n, disabled: !1 === t }
3434 );
3435 })(
3436 l(
3437 this.options.clip,
3438 (function (t, e, i) {
3439 if (!1 === i) return !1;
3440 const s = Ls(t, i),
3441 n = Ls(e, i);
3442 return { top: n.end, right: s.end, bottom: n.start, left: s.start };
3443 })(e.xScale, e.yScale, this.getMaxOverflow()),
3444 ),
3445 )));
3446 }
3447 update(t) {}
3448 draw() {
3449 const t = this._ctx,
3450 e = this.chart,
3451 i = this._cachedMeta,
3452 s = i.data || [],
3453 n = e.chartArea,
3454 o = [],
3455 a = this._drawStart || 0,
3456 r = this._drawCount || s.length - a,
3457 l = this.options.drawActiveElementsOnTop;
3458 let h;
3459 for (i.dataset && i.dataset.draw(t, n, a, r), h = a; h < a + r; ++h) {
3460 const e = s[h];
3461 e.hidden || (e.active && l ? o.push(e) : e.draw(t, n));
3462 }
3463 for (h = 0; h < o.length; ++h) o[h].draw(t, n);
3464 }
3465 getStyle(t, e) {
3466 const i = e ? "active" : "default";
3467 return void 0 === t && this._cachedMeta.dataset
3468 ? this.resolveDatasetElementOptions(i)
3469 : this.resolveDataElementOptions(t || 0, i);
3470 }
3471 getContext(t, e, i) {
3472 const s = this.getDataset();
3473 let n;
3474 if (t >= 0 && t < this._cachedMeta.data.length) {
3475 const e = this._cachedMeta.data[t];
3476 ((n =
3477 e.$context ||
3478 (e.$context = (function (t, e, i) {
3479 return Ci(t, {
3480 active: !1,
3481 dataIndex: e,
3482 parsed: void 0,
3483 raw: void 0,
3484 element: i,
3485 index: e,
3486 mode: "default",
3487 type: "data",
3488 });
3489 })(this.getContext(), t, e))),
3490 (n.parsed = this.getParsed(t)),
3491 (n.raw = s.data[t]),
3492 (n.index = n.dataIndex = t));
3493 } else
3494 ((n =
3495 this.$context ||
3496 (this.$context = (function (t, e) {
3497 return Ci(t, { active: !1, dataset: void 0, datasetIndex: e, index: e, mode: "default", type: "dataset" });
3498 })(this.chart.getContext(), this.index))),
3499 (n.dataset = s),
3500 (n.index = n.datasetIndex = this.index));
3501 return ((n.active = !!e), (n.mode = i), n);
3502 }
3503 resolveDatasetElementOptions(t) {
3504 return this._resolveElementOptions(this.datasetElementType.id, t);
3505 }
3506 resolveDataElementOptions(t, e) {
3507 return this._resolveElementOptions(this.dataElementType.id, e, t);
3508 }
3509 _resolveElementOptions(t, e = "default", i) {
3510 const s = "active" === e,
3511 n = this._cachedDataOpts,
3512 o = t + "-" + e,
3513 a = n[o],
3514 r = this.enableOptionSharing && k(i);
3515 if (a) return Hs(a, r);
3516 const l = this.chart.config,
3517 h = l.datasetElementScopeKeys(this._type, t),
3518 c = s ? [`${t}Hover`, "hover", t, ""] : [t, ""],
3519 d = l.getOptionScopes(this.getDataset(), h),
3520 u = Object.keys(ue.elements[t]),
3521 f = l.resolveNamedOptions(d, u, () => this.getContext(i, s, e), c);
3522 return (f.$shared && ((f.$shared = r), (n[o] = Object.freeze(Hs(f, r)))), f);
3523 }
3524 _resolveAnimations(t, e, i) {
3525 const s = this.chart,
3526 n = this._cachedDataOpts,
3527 o = `animation-${e}`,
3528 a = n[o];
3529 if (a) return a;
3530 let r;
3531 if (!1 !== s.options.animation) {
3532 const s = this.chart.config,
3533 n = s.datasetAnimationScopeKeys(this._type, e),
3534 o = s.getOptionScopes(this.getDataset(), n);
3535 r = s.createResolver(o, this.getContext(t, i, e));
3536 }
3537 const l = new Ts(s, r && r.animations);
3538 return (r && r._cacheable && (n[o] = Object.freeze(l)), l);
3539 }
3540 getSharedOptions(t) {
3541 if (t.$shared) return this._sharedOptions || (this._sharedOptions = Object.assign({}, t));
3542 }
3543 includeOptions(t, e) {
3544 return !e || Ns(t) || this.chart._animationsDisabled;
3545 }
3546 _getSharedOptions(t, e) {
3547 const i = this.resolveDataElementOptions(t, e),
3548 s = this._sharedOptions,
3549 n = this.getSharedOptions(i),
3550 o = this.includeOptions(e, n) || n !== s;
3551 return (this.updateSharedOptions(n, e, i), { sharedOptions: n, includeOptions: o });
3552 }
3553 updateElement(t, e, i, s) {
3554 Ns(s) ? Object.assign(t, i) : this._resolveAnimations(e, s).update(t, i);
3555 }
3556 updateSharedOptions(t, e, i) {
3557 t && !Ns(e) && this._resolveAnimations(void 0, e).update(t, i);
3558 }
3559 _setStyle(t, e, i, s) {
3560 t.active = s;
3561 const n = this.getStyle(e, s);
3562 this._resolveAnimations(e, i, s).update(t, { options: (!s && this.getSharedOptions(n)) || n });
3563 }
3564 removeHoverStyle(t, e, i) {
3565 this._setStyle(t, i, "active", !1);
3566 }
3567 setHoverStyle(t, e, i) {
3568 this._setStyle(t, i, "active", !0);
3569 }
3570 _removeDatasetHoverStyle() {
3571 const t = this._cachedMeta.dataset;
3572 t && this._setStyle(t, void 0, "active", !1);
3573 }
3574 _setDatasetHoverStyle() {
3575 const t = this._cachedMeta.dataset;
3576 t && this._setStyle(t, void 0, "active", !0);
3577 }
3578 _resyncElements(t) {
3579 const e = this._data,
3580 i = this._cachedMeta.data;
3581 for (const [t, e, i] of this._syncList) this[t](e, i);
3582 this._syncList = [];
3583 const s = i.length,
3584 n = e.length,
3585 o = Math.min(n, s);
3586 (o && this.parse(0, o), n > s ? this._insertElements(s, n - s, t) : n < s && this._removeElements(n, s - n));
3587 }
3588 _insertElements(t, e, i = !0) {
3589 const s = this._cachedMeta,
3590 n = s.data,
3591 o = t + e;
3592 let a;
3593 const r = (t) => {
3594 for (t.length += e, a = t.length - 1; a >= o; a--) t[a] = t[a - e];
3595 };
3596 for (r(n), a = t; a < o; ++a) n[a] = new this.dataElementType();
3597 (this._parsing && r(s._parsed), this.parse(t, e), i && this.updateElements(n, t, e, "reset"));
3598 }
3599 updateElements(t, e, i, s) {}
3600 _removeElements(t, e) {
3601 const i = this._cachedMeta;
3602 if (this._parsing) {
3603 const s = i._parsed.splice(t, e);
3604 i._stacked && Ws(i, s);
3605 }
3606 i.data.splice(t, e);
3607 }
3608 _sync(t) {
3609 if (this._parsing) this._syncList.push(t);
3610 else {
3611 const [e, i, s] = t;
3612 this[e](i, s);
3613 }
3614 this.chart._dataChanges.push([this.index, ...t]);
3615 }
3616 _onDataPush() {
3617 const t = arguments.length;
3618 this._sync(["_insertElements", this.getDataset().data.length - t, t]);
3619 }
3620 _onDataPop() {
3621 this._sync(["_removeElements", this._cachedMeta.data.length - 1, 1]);
3622 }
3623 _onDataShift() {
3624 this._sync(["_removeElements", 0, 1]);
3625 }
3626 _onDataSplice(t, e) {
3627 e && this._sync(["_removeElements", t, e]);
3628 const i = arguments.length - 2;
3629 i && this._sync(["_insertElements", t, i]);
3630 }
3631 _onDataUnshift() {
3632 this._sync(["_insertElements", 0, arguments.length]);
3633 }
3634 }
3635 class $s {
3636 static defaults = {};
3637 static defaultRoutes = void 0;
3638 x;
3639 y;
3640 active = !1;
3641 options;
3642 $animations;
3643 tooltipPosition(t) {
3644 const { x: e, y: i } = this.getProps(["x", "y"], t);
3645 return { x: e, y: i };
3646 }
3647 hasValue() {
3648 return N(this.x) && N(this.y);
3649 }
3650 getProps(t, e) {
3651 const i = this.$animations;
3652 if (!e || !i) return this;
3653 const s = {};
3654 return (
3655 t.forEach((t) => {
3656 s[t] = i[t] && i[t].active() ? i[t]._to : this[t];
3657 }),
3658 s
3659 );
3660 }
3661 }
3662 function Ys(t, e) {
3663 const i = t.options.ticks,
3664 n = (function (t) {
3665 const e = t.options.offset,
3666 i = t._tickSize(),
3667 s = t._length / i + (e ? 0 : 1),
3668 n = t._maxLength / i;
3669 return Math.floor(Math.min(s, n));
3670 })(t),
3671 o = Math.min(i.maxTicksLimit || n, n),
3672 a = i.major.enabled
3673 ? (function (t) {
3674 const e = [];
3675 let i, s;
3676 for (i = 0, s = t.length; i < s; i++) t[i].major && e.push(i);
3677 return e;
3678 })(e)
3679 : [],
3680 r = a.length,
3681 l = a[0],
3682 h = a[r - 1],
3683 c = [];
3684 if (r > o)
3685 return (
3686 (function (t, e, i, s) {
3687 let n,
3688 o = 0,
3689 a = i[0];
3690 for (s = Math.ceil(s), n = 0; n < t.length; n++) n === a && (e.push(t[n]), o++, (a = i[o * s]));
3691 })(e, c, a, r / o),
3692 c
3693 );
3694 const d = (function (t, e, i) {
3695 const s = (function (t) {
3696 const e = t.length;
3697 let i, s;
3698 if (e < 2) return !1;
3699 for (s = t[0], i = 1; i < e; ++i) if (t[i] - t[i - 1] !== s) return !1;
3700 return s;
3701 })(t),
3702 n = e.length / i;
3703 if (!s) return Math.max(n, 1);
3704 const o = W(s);
3705 for (let t = 0, e = o.length - 1; t < e; t++) {
3706 const e = o[t];
3707 if (e > n) return e;
3708 }
3709 return Math.max(n, 1);
3710 })(a, e, o);
3711 if (r > 0) {
3712 let t, i;
3713 const n = r > 1 ? Math.round((h - l) / (r - 1)) : null;
3714 for (Us(e, c, d, s(n) ? 0 : l - n, l), t = 0, i = r - 1; t < i; t++) Us(e, c, d, a[t], a[t + 1]);
3715 return (Us(e, c, d, h, s(n) ? e.length : h + n), c);
3716 }
3717 return (Us(e, c, d), c);
3718 }
3719 function Us(t, e, i, s, n) {
3720 const o = l(s, 0),
3721 a = Math.min(l(n, t.length), t.length);
3722 let r,
3723 h,
3724 c,
3725 d = 0;
3726 for (i = Math.ceil(i), n && ((r = n - s), (i = r / Math.floor(r / i))), c = o; c < 0; )
3727 (d++, (c = Math.round(o + d * i)));
3728 for (h = Math.max(o, 0); h < a; h++) h === c && (e.push(t[h]), d++, (c = Math.round(o + d * i)));
3729 }
3730 const Xs = (t, e, i) => ("top" === e || "left" === e ? t[e] + i : t[e] - i),
3731 qs = (t, e) => Math.min(e || t, t);
3732 function Ks(t, e) {
3733 const i = [],
3734 s = t.length / e,
3735 n = t.length;
3736 let o = 0;
3737 for (; o < n; o += s) i.push(t[Math.floor(o)]);
3738 return i;
3739 }
3740 function Gs(t, e, i) {
3741 const s = t.ticks.length,
3742 n = Math.min(e, s - 1),
3743 o = t._startPixel,
3744 a = t._endPixel,
3745 r = 1e-6;
3746 let l,
3747 h = t.getPixelForTick(n);
3748 if (
3749 !(
3750 i &&
3751 ((l =
3752 1 === s
3753 ? Math.max(h - o, a - h)
3754 : 0 === e
3755 ? (t.getPixelForTick(1) - h) / 2
3756 : (h - t.getPixelForTick(n - 1)) / 2),
3757 (h += n < e ? l : -l),
3758 h < o - r || h > a + r)
3759 )
3760 )
3761 return h;
3762 }
3763 function Js(t) {
3764 return t.drawTicks ? t.tickLength : 0;
3765 }
3766 function Zs(t, e) {
3767 if (!t.display) return 0;
3768 const i = Si(t.font, e),
3769 s = ki(t.padding);
3770 return (n(t.text) ? t.text.length : 1) * i.lineHeight + s.height;
3771 }
3772 function Qs(t, e, i) {
3773 let s = ut(t);
3774 return (
3775 ((i && "right" !== e) || (!i && "right" === e)) &&
3776 (s = ((t) => ("left" === t ? "right" : "right" === t ? "left" : t))(s)),
3777 s
3778 );
3779 }
3780 class tn extends $s {
3781 constructor(t) {
3782 (super(),
3783 (this.id = t.id),
3784 (this.type = t.type),
3785 (this.options = void 0),
3786 (this.ctx = t.ctx),
3787 (this.chart = t.chart),
3788 (this.top = void 0),
3789 (this.bottom = void 0),
3790 (this.left = void 0),
3791 (this.right = void 0),
3792 (this.width = void 0),
3793 (this.height = void 0),
3794 (this._margins = { left: 0, right: 0, top: 0, bottom: 0 }),
3795 (this.maxWidth = void 0),
3796 (this.maxHeight = void 0),
3797 (this.paddingTop = void 0),
3798 (this.paddingBottom = void 0),
3799 (this.paddingLeft = void 0),
3800 (this.paddingRight = void 0),
3801 (this.axis = void 0),
3802 (this.labelRotation = void 0),
3803 (this.min = void 0),
3804 (this.max = void 0),
3805 (this._range = void 0),
3806 (this.ticks = []),
3807 (this._gridLineItems = null),
3808 (this._labelItems = null),
3809 (this._labelSizes = null),
3810 (this._length = 0),
3811 (this._maxLength = 0),
3812 (this._longestTextCache = {}),
3813 (this._startPixel = void 0),
3814 (this._endPixel = void 0),
3815 (this._reversePixels = !1),
3816 (this._userMax = void 0),
3817 (this._userMin = void 0),
3818 (this._suggestedMax = void 0),
3819 (this._suggestedMin = void 0),
3820 (this._ticksLength = 0),
3821 (this._borderValue = 0),
3822 (this._cache = {}),
3823 (this._dataLimitsCached = !1),
3824 (this.$context = void 0));
3825 }
3826 init(t) {
3827 ((this.options = t.setContext(this.getContext())),
3828 (this.axis = t.axis),
3829 (this._userMin = this.parse(t.min)),
3830 (this._userMax = this.parse(t.max)),
3831 (this._suggestedMin = this.parse(t.suggestedMin)),
3832 (this._suggestedMax = this.parse(t.suggestedMax)));
3833 }
3834 parse(t, e) {
3835 return t;
3836 }
3837 getUserBounds() {
3838 let { _userMin: t, _userMax: e, _suggestedMin: i, _suggestedMax: s } = this;
3839 return (
3840 (t = r(t, Number.POSITIVE_INFINITY)),
3841 (e = r(e, Number.NEGATIVE_INFINITY)),
3842 (i = r(i, Number.POSITIVE_INFINITY)),
3843 (s = r(s, Number.NEGATIVE_INFINITY)),
3844 { min: r(t, i), max: r(e, s), minDefined: a(t), maxDefined: a(e) }
3845 );
3846 }
3847 getMinMax(t) {
3848 let e,
3849 { min: i, max: s, minDefined: n, maxDefined: o } = this.getUserBounds();
3850 if (n && o) return { min: i, max: s };
3851 const a = this.getMatchingVisibleMetas();
3852 for (let r = 0, l = a.length; r < l; ++r)
3853 ((e = a[r].controller.getMinMax(this, t)), n || (i = Math.min(i, e.min)), o || (s = Math.max(s, e.max)));
3854 return ((i = o && i > s ? s : i), (s = n && i > s ? i : s), { min: r(i, r(s, i)), max: r(s, r(i, s)) });
3855 }
3856 getPadding() {
3857 return {
3858 left: this.paddingLeft || 0,
3859 top: this.paddingTop || 0,
3860 right: this.paddingRight || 0,
3861 bottom: this.paddingBottom || 0,
3862 };
3863 }
3864 getTicks() {
3865 return this.ticks;
3866 }
3867 getLabels() {
3868 const t = this.chart.data;
3869 return this.options.labels || (this.isHorizontal() ? t.xLabels : t.yLabels) || t.labels || [];
3870 }
3871 getLabelItems(t = this.chart.chartArea) {
3872 return this._labelItems || (this._labelItems = this._computeLabelItems(t));
3873 }
3874 beforeLayout() {
3875 ((this._cache = {}), (this._dataLimitsCached = !1));
3876 }
3877 beforeUpdate() {
3878 d(this.options.beforeUpdate, [this]);
3879 }
3880 update(t, e, i) {
3881 const { beginAtZero: s, grace: n, ticks: o } = this.options,
3882 a = o.sampleSize;
3883 (this.beforeUpdate(),
3884 (this.maxWidth = t),
3885 (this.maxHeight = e),
3886 (this._margins = i = Object.assign({ left: 0, right: 0, top: 0, bottom: 0 }, i)),
3887 (this.ticks = null),
3888 (this._labelSizes = null),
3889 (this._gridLineItems = null),
3890 (this._labelItems = null),
3891 this.beforeSetDimensions(),
3892 this.setDimensions(),
3893 this.afterSetDimensions(),
3894 (this._maxLength = this.isHorizontal() ? this.width + i.left + i.right : this.height + i.top + i.bottom),
3895 this._dataLimitsCached ||
3896 (this.beforeDataLimits(),
3897 this.determineDataLimits(),
3898 this.afterDataLimits(),
3899 (this._range = Di(this, n, s)),
3900 (this._dataLimitsCached = !0)),
3901 this.beforeBuildTicks(),
3902 (this.ticks = this.buildTicks() || []),
3903 this.afterBuildTicks());
3904 const r = a < this.ticks.length;
3905 (this._convertTicksToLabels(r ? Ks(this.ticks, a) : this.ticks),
3906 this.configure(),
3907 this.beforeCalculateLabelRotation(),
3908 this.calculateLabelRotation(),
3909 this.afterCalculateLabelRotation(),
3910 o.display &&
3911 (o.autoSkip || "auto" === o.source) &&
3912 ((this.ticks = Ys(this, this.ticks)), (this._labelSizes = null), this.afterAutoSkip()),
3913 r && this._convertTicksToLabels(this.ticks),
3914 this.beforeFit(),
3915 this.fit(),
3916 this.afterFit(),
3917 this.afterUpdate());
3918 }
3919 configure() {
3920 let t,
3921 e,
3922 i = this.options.reverse;
3923 (this.isHorizontal() ? ((t = this.left), (e = this.right)) : ((t = this.top), (e = this.bottom), (i = !i)),
3924 (this._startPixel = t),
3925 (this._endPixel = e),
3926 (this._reversePixels = i),
3927 (this._length = e - t),
3928 (this._alignToPixels = this.options.alignToPixels));
3929 }
3930 afterUpdate() {
3931 d(this.options.afterUpdate, [this]);
3932 }
3933 beforeSetDimensions() {
3934 d(this.options.beforeSetDimensions, [this]);
3935 }
3936 setDimensions() {
3937 (this.isHorizontal()
3938 ? ((this.width = this.maxWidth), (this.left = 0), (this.right = this.width))
3939 : ((this.height = this.maxHeight), (this.top = 0), (this.bottom = this.height)),
3940 (this.paddingLeft = 0),
3941 (this.paddingTop = 0),
3942 (this.paddingRight = 0),
3943 (this.paddingBottom = 0));
3944 }
3945 afterSetDimensions() {
3946 d(this.options.afterSetDimensions, [this]);
3947 }
3948 _callHooks(t) {
3949 (this.chart.notifyPlugins(t, this.getContext()), d(this.options[t], [this]));
3950 }
3951 beforeDataLimits() {
3952 this._callHooks("beforeDataLimits");
3953 }
3954 determineDataLimits() {}
3955 afterDataLimits() {
3956 this._callHooks("afterDataLimits");
3957 }
3958 beforeBuildTicks() {
3959 this._callHooks("beforeBuildTicks");
3960 }
3961 buildTicks() {
3962 return [];
3963 }
3964 afterBuildTicks() {
3965 this._callHooks("afterBuildTicks");
3966 }
3967 beforeTickToLabelConversion() {
3968 d(this.options.beforeTickToLabelConversion, [this]);
3969 }
3970 generateTickLabels(t) {
3971 const e = this.options.ticks;
3972 let i, s, n;
3973 for (i = 0, s = t.length; i < s; i++) ((n = t[i]), (n.label = d(e.callback, [n.value, i, t], this)));
3974 }
3975 afterTickToLabelConversion() {
3976 d(this.options.afterTickToLabelConversion, [this]);
3977 }
3978 beforeCalculateLabelRotation() {
3979 d(this.options.beforeCalculateLabelRotation, [this]);
3980 }
3981 calculateLabelRotation() {
3982 const t = this.options,
3983 e = t.ticks,
3984 i = qs(this.ticks.length, t.ticks.maxTicksLimit),
3985 s = e.minRotation || 0,
3986 n = e.maxRotation;
3987 let o,
3988 a,
3989 r,
3990 l = s;
3991 if (!this._isVisible() || !e.display || s >= n || i <= 1 || !this.isHorizontal())
3992 return void (this.labelRotation = s);
3993 const h = this._getLabelSizes(),
3994 c = h.widest.width,
3995 d = h.highest.height,
3996 u = Z(this.chart.width - c, 0, this.maxWidth);
3997 ((o = t.offset ? this.maxWidth / i : u / (i - 1)),
3998 c + 6 > o &&
3999 ((o = u / (i - (t.offset ? 0.5 : 1))),
4000 (a = this.maxHeight - Js(t.grid) - e.padding - Zs(t.title, this.chart.options.font)),
4001 (r = Math.sqrt(c * c + d * d)),
4002 (l = Y(
4003 Math.min(
4004 Math.asin(Z((h.highest.height + 6) / o, -1, 1)),
4005 Math.asin(Z(a / r, -1, 1)) - Math.asin(Z(d / r, -1, 1)),
4006 ),
4007 )),
4008 (l = Math.max(s, Math.min(n, l)))),
4009 (this.labelRotation = l));
4010 }
4011 afterCalculateLabelRotation() {
4012 d(this.options.afterCalculateLabelRotation, [this]);
4013 }
4014 afterAutoSkip() {}
4015 beforeFit() {
4016 d(this.options.beforeFit, [this]);
4017 }
4018 fit() {
4019 const t = { width: 0, height: 0 },
4020 {
4021 chart: e,
4022 options: { ticks: i, title: s, grid: n },
4023 } = this,
4024 o = this._isVisible(),
4025 a = this.isHorizontal();
4026 if (o) {
4027 const o = Zs(s, e.options.font);
4028 if (
4029 (a
4030 ? ((t.width = this.maxWidth), (t.height = Js(n) + o))
4031 : ((t.height = this.maxHeight), (t.width = Js(n) + o)),
4032 i.display && this.ticks.length)
4033 ) {
4034 const { first: e, last: s, widest: n, highest: o } = this._getLabelSizes(),
4035 r = 2 * i.padding,
4036 l = $(this.labelRotation),
4037 h = Math.cos(l),
4038 c = Math.sin(l);
4039 if (a) {
4040 const e = i.mirror ? 0 : c * n.width + h * o.height;
4041 t.height = Math.min(this.maxHeight, t.height + e + r);
4042 } else {
4043 const e = i.mirror ? 0 : h * n.width + c * o.height;
4044 t.width = Math.min(this.maxWidth, t.width + e + r);
4045 }
4046 this._calculatePadding(e, s, c, h);
4047 }
4048 }
4049 (this._handleMargins(),
4050 a
4051 ? ((this.width = this._length = e.width - this._margins.left - this._margins.right), (this.height = t.height))
4052 : ((this.width = t.width),
4053 (this.height = this._length = e.height - this._margins.top - this._margins.bottom)));
4054 }
4055 _calculatePadding(t, e, i, s) {
4056 const {
4057 ticks: { align: n, padding: o },
4058 position: a,
4059 } = this.options,
4060 r = 0 !== this.labelRotation,
4061 l = "top" !== a && "x" === this.axis;
4062 if (this.isHorizontal()) {
4063 const a = this.getPixelForTick(0) - this.left,
4064 h = this.right - this.getPixelForTick(this.ticks.length - 1);
4065 let c = 0,
4066 d = 0;
4067 (r
4068 ? l
4069 ? ((c = s * t.width), (d = i * e.height))
4070 : ((c = i * t.height), (d = s * e.width))
4071 : "start" === n
4072 ? (d = e.width)
4073 : "end" === n
4074 ? (c = t.width)
4075 : "inner" !== n && ((c = t.width / 2), (d = e.width / 2)),
4076 (this.paddingLeft = Math.max(((c - a + o) * this.width) / (this.width - a), 0)),
4077 (this.paddingRight = Math.max(((d - h + o) * this.width) / (this.width - h), 0)));
4078 } else {
4079 let i = e.height / 2,
4080 s = t.height / 2;
4081 ("start" === n ? ((i = 0), (s = t.height)) : "end" === n && ((i = e.height), (s = 0)),
4082 (this.paddingTop = i + o),
4083 (this.paddingBottom = s + o));
4084 }
4085 }
4086 _handleMargins() {
4087 this._margins &&
4088 ((this._margins.left = Math.max(this.paddingLeft, this._margins.left)),
4089 (this._margins.top = Math.max(this.paddingTop, this._margins.top)),
4090 (this._margins.right = Math.max(this.paddingRight, this._margins.right)),
4091 (this._margins.bottom = Math.max(this.paddingBottom, this._margins.bottom)));
4092 }
4093 afterFit() {
4094 d(this.options.afterFit, [this]);
4095 }
4096 isHorizontal() {
4097 const { axis: t, position: e } = this.options;
4098 return "top" === e || "bottom" === e || "x" === t;
4099 }
4100 isFullSize() {
4101 return this.options.fullSize;
4102 }
4103 _convertTicksToLabels(t) {
4104 let e, i;
4105 for (this.beforeTickToLabelConversion(), this.generateTickLabels(t), e = 0, i = t.length; e < i; e++)
4106 s(t[e].label) && (t.splice(e, 1), i--, e--);
4107 this.afterTickToLabelConversion();
4108 }
4109 _getLabelSizes() {
4110 let t = this._labelSizes;
4111 if (!t) {
4112 const e = this.options.ticks.sampleSize;
4113 let i = this.ticks;
4114 (e < i.length && (i = Ks(i, e)),
4115 (this._labelSizes = t = this._computeLabelSizes(i, i.length, this.options.ticks.maxTicksLimit)));
4116 }
4117 return t;
4118 }
4119 _computeLabelSizes(t, e, i) {
4120 const { ctx: o, _longestTextCache: a } = this,
4121 r = [],
4122 l = [],
4123 h = Math.floor(e / qs(e, i));
4124 let c,
4125 d,
4126 f,
4127 g,
4128 p,
4129 m,
4130 x,
4131 b,
4132 _,
4133 y,
4134 v,
4135 M = 0,
4136 w = 0;
4137 for (c = 0; c < e; c += h) {
4138 if (
4139 ((g = t[c].label),
4140 (p = this._resolveTickFontOptions(c)),
4141 (o.font = m = p.string),
4142 (x = a[m] = a[m] || { data: {}, gc: [] }),
4143 (b = p.lineHeight),
4144 (_ = y = 0),
4145 s(g) || n(g))
4146 ) {
4147 if (n(g))
4148 for (d = 0, f = g.length; d < f; ++d)
4149 ((v = g[d]), s(v) || n(v) || ((_ = Ce(o, x.data, x.gc, _, v)), (y += b)));
4150 } else ((_ = Ce(o, x.data, x.gc, _, g)), (y = b));
4151 (r.push(_), l.push(y), (M = Math.max(_, M)), (w = Math.max(y, w)));
4152 }
4153 !(function (t, e) {
4154 u(t, (t) => {
4155 const i = t.gc,
4156 s = i.length / 2;
4157 let n;
4158 if (s > e) {
4159 for (n = 0; n < s; ++n) delete t.data[i[n]];
4160 i.splice(0, s);
4161 }
4162 });
4163 })(a, e);
4164 const k = r.indexOf(M),
4165 S = l.indexOf(w),
4166 P = (t) => ({ width: r[t] || 0, height: l[t] || 0 });
4167 return { first: P(0), last: P(e - 1), widest: P(k), highest: P(S), widths: r, heights: l };
4168 }
4169 getLabelForValue(t) {
4170 return t;
4171 }
4172 getPixelForValue(t, e) {
4173 return NaN;
4174 }
4175 getValueForPixel(t) {}
4176 getPixelForTick(t) {
4177 const e = this.ticks;
4178 return t < 0 || t > e.length - 1 ? null : this.getPixelForValue(e[t].value);
4179 }
4180 getPixelForDecimal(t) {
4181 this._reversePixels && (t = 1 - t);
4182 const e = this._startPixel + t * this._length;
4183 return Q(this._alignToPixels ? Ae(this.chart, e, 0) : e);
4184 }
4185 getDecimalForPixel(t) {
4186 const e = (t - this._startPixel) / this._length;
4187 return this._reversePixels ? 1 - e : e;
4188 }
4189 getBasePixel() {
4190 return this.getPixelForValue(this.getBaseValue());
4191 }
4192 getBaseValue() {
4193 const { min: t, max: e } = this;
4194 return t < 0 && e < 0 ? e : t > 0 && e > 0 ? t : 0;
4195 }
4196 getContext(t) {
4197 const e = this.ticks || [];
4198 if (t >= 0 && t < e.length) {
4199 const i = e[t];
4200 return (
4201 i.$context ||
4202 (i.$context = (function (t, e, i) {
4203 return Ci(t, { tick: i, index: e, type: "tick" });
4204 })(this.getContext(), t, i))
4205 );
4206 }
4207 return this.$context || (this.$context = Ci(this.chart.getContext(), { scale: this, type: "scale" }));
4208 }
4209 _tickSize() {
4210 const t = this.options.ticks,
4211 e = $(this.labelRotation),
4212 i = Math.abs(Math.cos(e)),
4213 s = Math.abs(Math.sin(e)),
4214 n = this._getLabelSizes(),
4215 o = t.autoSkipPadding || 0,
4216 a = n ? n.widest.width + o : 0,
4217 r = n ? n.highest.height + o : 0;
4218 return this.isHorizontal() ? (r * i > a * s ? a / i : r / s) : r * s < a * i ? r / i : a / s;
4219 }
4220 _isVisible() {
4221 const t = this.options.display;
4222 return "auto" !== t ? !!t : this.getMatchingVisibleMetas().length > 0;
4223 }
4224 _computeGridLineItems(t) {
4225 const e = this.axis,
4226 i = this.chart,
4227 s = this.options,
4228 { grid: n, position: a, border: r } = s,
4229 h = n.offset,
4230 c = this.isHorizontal(),
4231 d = this.ticks.length + (h ? 1 : 0),
4232 u = Js(n),
4233 f = [],
4234 g = r.setContext(this.getContext()),
4235 p = g.display ? g.width : 0,
4236 m = p / 2,
4237 x = function (t) {
4238 return Ae(i, t, p);
4239 };
4240 let b, _, y, v, M, w, k, S, P, D, C, O;
4241 if ("top" === a) ((b = x(this.bottom)), (w = this.bottom - u), (S = b - m), (D = x(t.top) + m), (O = t.bottom));
4242 else if ("bottom" === a) ((b = x(this.top)), (D = t.top), (O = x(t.bottom) - m), (w = b + m), (S = this.top + u));
4243 else if ("left" === a)
4244 ((b = x(this.right)), (M = this.right - u), (k = b - m), (P = x(t.left) + m), (C = t.right));
4245 else if ("right" === a)
4246 ((b = x(this.left)), (P = t.left), (C = x(t.right) - m), (M = b + m), (k = this.left + u));
4247 else if ("x" === e) {
4248 if ("center" === a) b = x((t.top + t.bottom) / 2 + 0.5);
4249 else if (o(a)) {
4250 const t = Object.keys(a)[0],
4251 e = a[t];
4252 b = x(this.chart.scales[t].getPixelForValue(e));
4253 }
4254 ((D = t.top), (O = t.bottom), (w = b + m), (S = w + u));
4255 } else if ("y" === e) {
4256 if ("center" === a) b = x((t.left + t.right) / 2);
4257 else if (o(a)) {
4258 const t = Object.keys(a)[0],
4259 e = a[t];
4260 b = x(this.chart.scales[t].getPixelForValue(e));
4261 }
4262 ((M = b - m), (k = M - u), (P = t.left), (C = t.right));
4263 }
4264 const A = l(s.ticks.maxTicksLimit, d),
4265 T = Math.max(1, Math.ceil(d / A));
4266 for (_ = 0; _ < d; _ += T) {
4267 const t = this.getContext(_),
4268 e = n.setContext(t),
4269 s = r.setContext(t),
4270 o = e.lineWidth,
4271 a = e.color,
4272 l = s.dash || [],
4273 d = s.dashOffset,
4274 u = e.tickWidth,
4275 g = e.tickColor,
4276 p = e.tickBorderDash || [],
4277 m = e.tickBorderDashOffset;
4278 ((y = Gs(this, _, h)),
4279 void 0 !== y &&
4280 ((v = Ae(i, y, o)),
4281 c ? (M = k = P = C = v) : (w = S = D = O = v),
4282 f.push({
4283 tx1: M,
4284 ty1: w,
4285 tx2: k,
4286 ty2: S,
4287 x1: P,
4288 y1: D,
4289 x2: C,
4290 y2: O,
4291 width: o,
4292 color: a,
4293 borderDash: l,
4294 borderDashOffset: d,
4295 tickWidth: u,
4296 tickColor: g,
4297 tickBorderDash: p,
4298 tickBorderDashOffset: m,
4299 })));
4300 }
4301 return ((this._ticksLength = d), (this._borderValue = b), f);
4302 }
4303 _computeLabelItems(t) {
4304 const e = this.axis,
4305 i = this.options,
4306 { position: s, ticks: a } = i,
4307 r = this.isHorizontal(),
4308 l = this.ticks,
4309 { align: h, crossAlign: c, padding: d, mirror: u } = a,
4310 f = Js(i.grid),
4311 g = f + d,
4312 p = u ? -d : g,
4313 m = -$(this.labelRotation),
4314 x = [];
4315 let b,
4316 _,
4317 y,
4318 v,
4319 M,
4320 w,
4321 k,
4322 S,
4323 P,
4324 D,
4325 C,
4326 O,
4327 A = "middle";
4328 if ("top" === s) ((w = this.bottom - p), (k = this._getXAxisLabelAlignment()));
4329 else if ("bottom" === s) ((w = this.top + p), (k = this._getXAxisLabelAlignment()));
4330 else if ("left" === s) {
4331 const t = this._getYAxisLabelAlignment(f);
4332 ((k = t.textAlign), (M = t.x));
4333 } else if ("right" === s) {
4334 const t = this._getYAxisLabelAlignment(f);
4335 ((k = t.textAlign), (M = t.x));
4336 } else if ("x" === e) {
4337 if ("center" === s) w = (t.top + t.bottom) / 2 + g;
4338 else if (o(s)) {
4339 const t = Object.keys(s)[0],
4340 e = s[t];
4341 w = this.chart.scales[t].getPixelForValue(e) + g;
4342 }
4343 k = this._getXAxisLabelAlignment();
4344 } else if ("y" === e) {
4345 if ("center" === s) M = (t.left + t.right) / 2 - g;
4346 else if (o(s)) {
4347 const t = Object.keys(s)[0],
4348 e = s[t];
4349 M = this.chart.scales[t].getPixelForValue(e);
4350 }
4351 k = this._getYAxisLabelAlignment(f).textAlign;
4352 }
4353 "y" === e && ("start" === h ? (A = "top") : "end" === h && (A = "bottom"));
4354 const T = this._getLabelSizes();
4355 for (b = 0, _ = l.length; b < _; ++b) {
4356 ((y = l[b]), (v = y.label));
4357 const t = a.setContext(this.getContext(b));
4358 ((S = this.getPixelForTick(b) + a.labelOffset),
4359 (P = this._resolveTickFontOptions(b)),
4360 (D = P.lineHeight),
4361 (C = n(v) ? v.length : 1));
4362 const e = C / 2,
4363 i = t.color,
4364 o = t.textStrokeColor,
4365 h = t.textStrokeWidth;
4366 let d,
4367 f = k;
4368 if (
4369 (r
4370 ? ((M = S),
4371 "inner" === k &&
4372 (f =
4373 b === _ - 1
4374 ? this.options.reverse
4375 ? "left"
4376 : "right"
4377 : 0 === b
4378 ? this.options.reverse
4379 ? "right"
4380 : "left"
4381 : "center"),
4382 (O =
4383 "top" === s
4384 ? "near" === c || 0 !== m
4385 ? -C * D + D / 2
4386 : "center" === c
4387 ? -T.highest.height / 2 - e * D + D
4388 : -T.highest.height + D / 2
4389 : "near" === c || 0 !== m
4390 ? D / 2
4391 : "center" === c
4392 ? T.highest.height / 2 - e * D
4393 : T.highest.height - C * D),
4394 u && (O *= -1),
4395 0 === m || t.showLabelBackdrop || (M += (D / 2) * Math.sin(m)))
4396 : ((w = S), (O = ((1 - C) * D) / 2)),
4397 t.showLabelBackdrop)
4398 ) {
4399 const e = ki(t.backdropPadding),
4400 i = T.heights[b],
4401 s = T.widths[b];
4402 let n = O - e.top,
4403 o = 0 - e.left;
4404 switch (A) {
4405 case "middle":
4406 n -= i / 2;
4407 break;
4408 case "bottom":
4409 n -= i;
4410 }
4411 switch (k) {
4412 case "center":
4413 o -= s / 2;
4414 break;
4415 case "right":
4416 o -= s;
4417 break;
4418 case "inner":
4419 b === _ - 1 ? (o -= s) : b > 0 && (o -= s / 2);
4420 }
4421 d = { left: o, top: n, width: s + e.width, height: i + e.height, color: t.backdropColor };
4422 }
4423 x.push({
4424 label: v,
4425 font: P,
4426 textOffset: O,
4427 options: {
4428 rotation: m,
4429 color: i,
4430 strokeColor: o,
4431 strokeWidth: h,
4432 textAlign: f,
4433 textBaseline: A,
4434 translation: [M, w],
4435 backdrop: d,
4436 },
4437 });
4438 }
4439 return x;
4440 }
4441 _getXAxisLabelAlignment() {
4442 const { position: t, ticks: e } = this.options;
4443 if (-$(this.labelRotation)) return "top" === t ? "left" : "right";
4444 let i = "center";
4445 return (
4446 "start" === e.align ? (i = "left") : "end" === e.align ? (i = "right") : "inner" === e.align && (i = "inner"),
4447 i
4448 );
4449 }
4450 _getYAxisLabelAlignment(t) {
4451 const {
4452 position: e,
4453 ticks: { crossAlign: i, mirror: s, padding: n },
4454 } = this.options,
4455 o = t + n,
4456 a = this._getLabelSizes().widest.width;
4457 let r, l;
4458 return (
4459 "left" === e
4460 ? s
4461 ? ((l = this.right + n),
4462 "near" === i ? (r = "left") : "center" === i ? ((r = "center"), (l += a / 2)) : ((r = "right"), (l += a)))
4463 : ((l = this.right - o),
4464 "near" === i
4465 ? (r = "right")
4466 : "center" === i
4467 ? ((r = "center"), (l -= a / 2))
4468 : ((r = "left"), (l = this.left)))
4469 : "right" === e
4470 ? s
4471 ? ((l = this.left + n),
4472 "near" === i
4473 ? (r = "right")
4474 : "center" === i
4475 ? ((r = "center"), (l -= a / 2))
4476 : ((r = "left"), (l -= a)))
4477 : ((l = this.left + o),
4478 "near" === i
4479 ? (r = "left")
4480 : "center" === i
4481 ? ((r = "center"), (l += a / 2))
4482 : ((r = "right"), (l = this.right)))
4483 : (r = "right"),
4484 { textAlign: r, x: l }
4485 );
4486 }
4487 _computeLabelArea() {
4488 if (this.options.ticks.mirror) return;
4489 const t = this.chart,
4490 e = this.options.position;
4491 return "left" === e || "right" === e
4492 ? { top: 0, left: this.left, bottom: t.height, right: this.right }
4493 : "top" === e || "bottom" === e
4494 ? { top: this.top, left: 0, bottom: this.bottom, right: t.width }
4495 : void 0;
4496 }
4497 drawBackground() {
4498 const {
4499 ctx: t,
4500 options: { backgroundColor: e },
4501 left: i,
4502 top: s,
4503 width: n,
4504 height: o,
4505 } = this;
4506 e && (t.save(), (t.fillStyle = e), t.fillRect(i, s, n, o), t.restore());
4507 }
4508 getLineWidthForValue(t) {
4509 const e = this.options.grid;
4510 if (!this._isVisible() || !e.display) return 0;
4511 const i = this.ticks.findIndex((e) => e.value === t);
4512 if (i >= 0) {
4513 return e.setContext(this.getContext(i)).lineWidth;
4514 }
4515 return 0;
4516 }
4517 drawGrid(t) {
4518 const e = this.options.grid,
4519 i = this.ctx,
4520 s = this._gridLineItems || (this._gridLineItems = this._computeGridLineItems(t));
4521 let n, o;
4522 const a = (t, e, s) => {
4523 s.width &&
4524 s.color &&
4525 (i.save(),
4526 (i.lineWidth = s.width),
4527 (i.strokeStyle = s.color),
4528 i.setLineDash(s.borderDash || []),
4529 (i.lineDashOffset = s.borderDashOffset),
4530 i.beginPath(),
4531 i.moveTo(t.x, t.y),
4532 i.lineTo(e.x, e.y),
4533 i.stroke(),
4534 i.restore());
4535 };
4536 if (e.display)
4537 for (n = 0, o = s.length; n < o; ++n) {
4538 const t = s[n];
4539 (e.drawOnChartArea && a({ x: t.x1, y: t.y1 }, { x: t.x2, y: t.y2 }, t),
4540 e.drawTicks &&
4541 a(
4542 { x: t.tx1, y: t.ty1 },
4543 { x: t.tx2, y: t.ty2 },
4544 {
4545 color: t.tickColor,
4546 width: t.tickWidth,
4547 borderDash: t.tickBorderDash,
4548 borderDashOffset: t.tickBorderDashOffset,
4549 },
4550 ));
4551 }
4552 }
4553 drawBorder() {
4554 const {
4555 chart: t,
4556 ctx: e,
4557 options: { border: i, grid: s },
4558 } = this,
4559 n = i.setContext(this.getContext()),
4560 o = i.display ? n.width : 0;
4561 if (!o) return;
4562 const a = s.setContext(this.getContext(0)).lineWidth,
4563 r = this._borderValue;
4564 let l, h, c, d;
4565 (this.isHorizontal()
4566 ? ((l = Ae(t, this.left, o) - o / 2), (h = Ae(t, this.right, a) + a / 2), (c = d = r))
4567 : ((c = Ae(t, this.top, o) - o / 2), (d = Ae(t, this.bottom, a) + a / 2), (l = h = r)),
4568 e.save(),
4569 (e.lineWidth = n.width),
4570 (e.strokeStyle = n.color),
4571 e.beginPath(),
4572 e.moveTo(l, c),
4573 e.lineTo(h, d),
4574 e.stroke(),
4575 e.restore());
4576 }
4577 drawLabels(t) {
4578 if (!this.options.ticks.display) return;
4579 const e = this.ctx,
4580 i = this._computeLabelArea();
4581 i && Ie(e, i);
4582 const s = this.getLabelItems(t);
4583 for (const t of s) {
4584 const i = t.options,
4585 s = t.font;
4586 Ne(e, t.label, 0, t.textOffset, s, i);
4587 }
4588 i && ze(e);
4589 }
4590 drawTitle() {
4591 const {
4592 ctx: t,
4593 options: { position: e, title: i, reverse: s },
4594 } = this;
4595 if (!i.display) return;
4596 const a = Si(i.font),
4597 r = ki(i.padding),
4598 l = i.align;
4599 let h = a.lineHeight / 2;
4600 "bottom" === e || "center" === e || o(e)
4601 ? ((h += r.bottom), n(i.text) && (h += a.lineHeight * (i.text.length - 1)))
4602 : (h += r.top);
4603 const {
4604 titleX: c,
4605 titleY: d,
4606 maxWidth: u,
4607 rotation: f,
4608 } = (function (t, e, i, s) {
4609 const { top: n, left: a, bottom: r, right: l, chart: h } = t,
4610 { chartArea: c, scales: d } = h;
4611 let u,
4612 f,
4613 g,
4614 p = 0;
4615 const m = r - n,
4616 x = l - a;
4617 if (t.isHorizontal()) {
4618 if (((f = ft(s, a, l)), o(i))) {
4619 const t = Object.keys(i)[0],
4620 s = i[t];
4621 g = d[t].getPixelForValue(s) + m - e;
4622 } else g = "center" === i ? (c.bottom + c.top) / 2 + m - e : Xs(t, i, e);
4623 u = l - a;
4624 } else {
4625 if (o(i)) {
4626 const t = Object.keys(i)[0],
4627 s = i[t];
4628 f = d[t].getPixelForValue(s) - x + e;
4629 } else f = "center" === i ? (c.left + c.right) / 2 - x + e : Xs(t, i, e);
4630 ((g = ft(s, r, n)), (p = "left" === i ? -E : E));
4631 }
4632 return { titleX: f, titleY: g, maxWidth: u, rotation: p };
4633 })(this, h, e, l);
4634 Ne(t, i.text, 0, 0, a, {
4635 color: i.color,
4636 maxWidth: u,
4637 rotation: f,
4638 textAlign: Qs(l, e, s),
4639 textBaseline: "middle",
4640 translation: [c, d],
4641 });
4642 }
4643 draw(t) {
4644 this._isVisible() &&
4645 (this.drawBackground(), this.drawGrid(t), this.drawBorder(), this.drawTitle(), this.drawLabels(t));
4646 }
4647 _layers() {
4648 const t = this.options,
4649 e = (t.ticks && t.ticks.z) || 0,
4650 i = l(t.grid && t.grid.z, -1),
4651 s = l(t.border && t.border.z, 0);
4652 return this._isVisible() && this.draw === tn.prototype.draw
4653 ? [
4654 {
4655 z: i,
4656 draw: (t) => {
4657 (this.drawBackground(), this.drawGrid(t), this.drawTitle());
4658 },
4659 },
4660 {
4661 z: s,
4662 draw: () => {
4663 this.drawBorder();
4664 },
4665 },
4666 {
4667 z: e,
4668 draw: (t) => {
4669 this.drawLabels(t);
4670 },
4671 },
4672 ]
4673 : [
4674 {
4675 z: e,
4676 draw: (t) => {
4677 this.draw(t);
4678 },
4679 },
4680 ];
4681 }
4682 getMatchingVisibleMetas(t) {
4683 const e = this.chart.getSortedVisibleDatasetMetas(),
4684 i = this.axis + "AxisID",
4685 s = [];
4686 let n, o;
4687 for (n = 0, o = e.length; n < o; ++n) {
4688 const o = e[n];
4689 o[i] !== this.id || (t && o.type !== t) || s.push(o);
4690 }
4691 return s;
4692 }
4693 _resolveTickFontOptions(t) {
4694 return Si(this.options.ticks.setContext(this.getContext(t)).font);
4695 }
4696 _maxDigits() {
4697 const t = this._resolveTickFontOptions(0).lineHeight;
4698 return (this.isHorizontal() ? this.width : this.height) / t;
4699 }
4700 }
4701 class en {
4702 constructor(t, e, i) {
4703 ((this.type = t), (this.scope = e), (this.override = i), (this.items = Object.create(null)));
4704 }
4705 isForType(t) {
4706 return Object.prototype.isPrototypeOf.call(this.type.prototype, t.prototype);
4707 }
4708 register(t) {
4709 const e = Object.getPrototypeOf(t);
4710 let i;
4711 (function (t) {
4712 return "id" in t && "defaults" in t;
4713 })(e) && (i = this.register(e));
4714 const s = this.items,
4715 n = t.id,
4716 o = this.scope + "." + n;
4717 if (!n) throw new Error("class does not have id: " + t);
4718 return (
4719 n in s ||
4720 ((s[n] = t),
4721 (function (t, e, i) {
4722 const s = x(Object.create(null), [i ? ue.get(i) : {}, ue.get(e), t.defaults]);
4723 (ue.set(e, s),
4724 t.defaultRoutes &&
4725 (function (t, e) {
4726 Object.keys(e).forEach((i) => {
4727 const s = i.split("."),
4728 n = s.pop(),
4729 o = [t].concat(s).join("."),
4730 a = e[i].split("."),
4731 r = a.pop(),
4732 l = a.join(".");
4733 ue.route(o, n, l, r);
4734 });
4735 })(e, t.defaultRoutes));
4736 t.descriptors && ue.describe(e, t.descriptors);
4737 })(t, o, i),
4738 this.override && ue.override(t.id, t.overrides)),
4739 o
4740 );
4741 }
4742 get(t) {
4743 return this.items[t];
4744 }
4745 unregister(t) {
4746 const e = this.items,
4747 i = t.id,
4748 s = this.scope;
4749 (i in e && delete e[i], s && i in ue[s] && (delete ue[s][i], this.override && delete re[i]));
4750 }
4751 }
4752 class sn {
4753 constructor() {
4754 ((this.controllers = new en(js, "datasets", !0)),
4755 (this.elements = new en($s, "elements")),
4756 (this.plugins = new en(Object, "plugins")),
4757 (this.scales = new en(tn, "scales")),
4758 (this._typedRegistries = [this.controllers, this.scales, this.elements]));
4759 }
4760 add(...t) {
4761 this._each("register", t);
4762 }
4763 remove(...t) {
4764 this._each("unregister", t);
4765 }
4766 addControllers(...t) {
4767 this._each("register", t, this.controllers);
4768 }
4769 addElements(...t) {
4770 this._each("register", t, this.elements);
4771 }
4772 addPlugins(...t) {
4773 this._each("register", t, this.plugins);
4774 }
4775 addScales(...t) {
4776 this._each("register", t, this.scales);
4777 }
4778 getController(t) {
4779 return this._get(t, this.controllers, "controller");
4780 }
4781 getElement(t) {
4782 return this._get(t, this.elements, "element");
4783 }
4784 getPlugin(t) {
4785 return this._get(t, this.plugins, "plugin");
4786 }
4787 getScale(t) {
4788 return this._get(t, this.scales, "scale");
4789 }
4790 removeControllers(...t) {
4791 this._each("unregister", t, this.controllers);
4792 }
4793 removeElements(...t) {
4794 this._each("unregister", t, this.elements);
4795 }
4796 removePlugins(...t) {
4797 this._each("unregister", t, this.plugins);
4798 }
4799 removeScales(...t) {
4800 this._each("unregister", t, this.scales);
4801 }
4802 _each(t, e, i) {
4803 [...e].forEach((e) => {
4804 const s = i || this._getRegistryForType(e);
4805 i || s.isForType(e) || (s === this.plugins && e.id)
4806 ? this._exec(t, s, e)
4807 : u(e, (e) => {
4808 const s = i || this._getRegistryForType(e);
4809 this._exec(t, s, e);
4810 });
4811 });
4812 }
4813 _exec(t, e, i) {
4814 const s = w(t);
4815 (d(i["before" + s], [], i), e[t](i), d(i["after" + s], [], i));
4816 }
4817 _getRegistryForType(t) {
4818 for (let e = 0; e < this._typedRegistries.length; e++) {
4819 const i = this._typedRegistries[e];
4820 if (i.isForType(t)) return i;
4821 }
4822 return this.plugins;
4823 }
4824 _get(t, e, i) {
4825 const s = e.get(t);
4826 if (void 0 === s) throw new Error('"' + t + '" is not a registered ' + i + ".");
4827 return s;
4828 }
4829 }
4830 var nn = new sn();
4831 class on {
4832 constructor() {
4833 this._init = void 0;
4834 }
4835 notify(t, e, i, s) {
4836 if (
4837 ("beforeInit" === e && ((this._init = this._createDescriptors(t, !0)), this._notify(this._init, t, "install")),
4838 void 0 === this._init)
4839 )
4840 return;
4841 const n = s ? this._descriptors(t).filter(s) : this._descriptors(t),
4842 o = this._notify(n, t, e, i);
4843 return (
4844 "afterDestroy" === e &&
4845 (this._notify(n, t, "stop"), this._notify(this._init, t, "uninstall"), (this._init = void 0)),
4846 o
4847 );
4848 }
4849 _notify(t, e, i, s) {
4850 s = s || {};
4851 for (const n of t) {
4852 const t = n.plugin;
4853 if (!1 === d(t[i], [e, s, n.options], t) && s.cancelable) return !1;
4854 }
4855 return !0;
4856 }
4857 invalidate() {
4858 s(this._cache) || ((this._oldCache = this._cache), (this._cache = void 0));
4859 }
4860 _descriptors(t) {
4861 if (this._cache) return this._cache;
4862 const e = (this._cache = this._createDescriptors(t));
4863 return (this._notifyStateChanges(t), e);
4864 }
4865 _createDescriptors(t, e) {
4866 const i = t && t.config,
4867 s = l(i.options && i.options.plugins, {}),
4868 n = (function (t) {
4869 const e = {},
4870 i = [],
4871 s = Object.keys(nn.plugins.items);
4872 for (let t = 0; t < s.length; t++) i.push(nn.getPlugin(s[t]));
4873 const n = t.plugins || [];
4874 for (let t = 0; t < n.length; t++) {
4875 const s = n[t];
4876 -1 === i.indexOf(s) && (i.push(s), (e[s.id] = !0));
4877 }
4878 return { plugins: i, localIds: e };
4879 })(i);
4880 return !1 !== s || e
4881 ? (function (t, { plugins: e, localIds: i }, s, n) {
4882 const o = [],
4883 a = t.getContext();
4884 for (const r of e) {
4885 const e = r.id,
4886 l = an(s[e], n);
4887 null !== l && o.push({ plugin: r, options: rn(t.config, { plugin: r, local: i[e] }, l, a) });
4888 }
4889 return o;
4890 })(t, n, s, e)
4891 : [];
4892 }
4893 _notifyStateChanges(t) {
4894 const e = this._oldCache || [],
4895 i = this._cache,
4896 s = (t, e) => t.filter((t) => !e.some((e) => t.plugin.id === e.plugin.id));
4897 (this._notify(s(e, i), t, "stop"), this._notify(s(i, e), t, "start"));
4898 }
4899 }
4900 function an(t, e) {
4901 return e || !1 !== t ? (!0 === t ? {} : t) : null;
4902 }
4903 function rn(t, { plugin: e, local: i }, s, n) {
4904 const o = t.pluginScopeKeys(e),
4905 a = t.getOptionScopes(s, o);
4906 return (
4907 i && e.defaults && a.push(e.defaults),
4908 t.createResolver(a, n, [""], { scriptable: !1, indexable: !1, allKeys: !0 })
4909 );
4910 }
4911 function ln(t, e) {
4912 const i = ue.datasets[t] || {};
4913 return ((e.datasets || {})[t] || {}).indexAxis || e.indexAxis || i.indexAxis || "x";
4914 }
4915 function hn(t) {
4916 if ("x" === t || "y" === t || "r" === t) return t;
4917 }
4918 function cn(t, ...e) {
4919 if (hn(t)) return t;
4920 for (const s of e) {
4921 const e =
4922 s.axis ||
4923 ("top" === (i = s.position) || "bottom" === i ? "x" : "left" === i || "right" === i ? "y" : void 0) ||
4924 (t.length > 1 && hn(t[0].toLowerCase()));
4925 if (e) return e;
4926 }
4927 var i;
4928 throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`);
4929 }
4930 function dn(t, e, i) {
4931 if (i[e + "AxisID"] === t) return { axis: e };
4932 }
4933 function un(t, e) {
4934 const i = re[t.type] || { scales: {} },
4935 s = e.scales || {},
4936 n = ln(t.type, e),
4937 a = Object.create(null);
4938 return (
4939 Object.keys(s).forEach((e) => {
4940 const r = s[e];
4941 if (!o(r)) return console.error(`Invalid scale configuration for scale: ${e}`);
4942 if (r._proxy) return console.warn(`Ignoring resolver passed as options for scale: ${e}`);
4943 const l = cn(
4944 e,
4945 r,
4946 (function (t, e) {
4947 if (e.data && e.data.datasets) {
4948 const i = e.data.datasets.filter((e) => e.xAxisID === t || e.yAxisID === t);
4949 if (i.length) return dn(t, "x", i[0]) || dn(t, "y", i[0]);
4950 }
4951 return {};
4952 })(e, t),
4953 ue.scales[r.type],
4954 ),
4955 h = (function (t, e) {
4956 return t === e ? "_index_" : "_value_";
4957 })(l, n),
4958 c = i.scales || {};
4959 a[e] = b(Object.create(null), [{ axis: l }, r, c[l], c[h]]);
4960 }),
4961 t.data.datasets.forEach((i) => {
4962 const n = i.type || t.type,
4963 o = i.indexAxis || ln(n, e),
4964 r = (re[n] || {}).scales || {};
4965 Object.keys(r).forEach((t) => {
4966 const e = (function (t, e) {
4967 let i = t;
4968 return ("_index_" === t ? (i = e) : "_value_" === t && (i = "x" === e ? "y" : "x"), i);
4969 })(t, o),
4970 n = i[e + "AxisID"] || e;
4971 ((a[n] = a[n] || Object.create(null)), b(a[n], [{ axis: e }, s[n], r[t]]));
4972 });
4973 }),
4974 Object.keys(a).forEach((t) => {
4975 const e = a[t];
4976 b(e, [ue.scales[e.type], ue.scale]);
4977 }),
4978 a
4979 );
4980 }
4981 function fn(t) {
4982 const e = t.options || (t.options = {});
4983 ((e.plugins = l(e.plugins, {})), (e.scales = un(t, e)));
4984 }
4985 function gn(t) {
4986 return (((t = t || {}).datasets = t.datasets || []), (t.labels = t.labels || []), t);
4987 }
4988 const pn = new Map(),
4989 mn = new Set();
4990 function xn(t, e) {
4991 let i = pn.get(t);
4992 return (i || ((i = e()), pn.set(t, i), mn.add(i)), i);
4993 }
4994 const bn = (t, e, i) => {
4995 const s = M(e, i);
4996 void 0 !== s && t.add(s);
4997 };
4998 class _n {
4999 constructor(t) {
5000 ((this._config = (function (t) {
5001 return (((t = t || {}).data = gn(t.data)), fn(t), t);
5002 })(t)),
5003 (this._scopeCache = new Map()),
5004 (this._resolverCache = new Map()));
5005 }
5006 get platform() {
5007 return this._config.platform;
5008 }
5009 get type() {
5010 return this._config.type;
5011 }
5012 set type(t) {
5013 this._config.type = t;
5014 }
5015 get data() {
5016 return this._config.data;
5017 }
5018 set data(t) {
5019 this._config.data = gn(t);
5020 }
5021 get options() {
5022 return this._config.options;
5023 }
5024 set options(t) {
5025 this._config.options = t;
5026 }
5027 get plugins() {
5028 return this._config.plugins;
5029 }
5030 update() {
5031 const t = this._config;
5032 (this.clearCache(), fn(t));
5033 }
5034 clearCache() {
5035 (this._scopeCache.clear(), this._resolverCache.clear());
5036 }
5037 datasetScopeKeys(t) {
5038 return xn(t, () => [[`datasets.${t}`, ""]]);
5039 }
5040 datasetAnimationScopeKeys(t, e) {
5041 return xn(`${t}.transition.${e}`, () => [
5042 [`datasets.${t}.transitions.${e}`, `transitions.${e}`],
5043 [`datasets.${t}`, ""],
5044 ]);
5045 }
5046 datasetElementScopeKeys(t, e) {
5047 return xn(`${t}-${e}`, () => [[`datasets.${t}.elements.${e}`, `datasets.${t}`, `elements.${e}`, ""]]);
5048 }
5049 pluginScopeKeys(t) {
5050 const e = t.id;
5051 return xn(`${this.type}-plugin-${e}`, () => [[`plugins.${e}`, ...(t.additionalOptionScopes || [])]]);
5052 }
5053 _cachedScopes(t, e) {
5054 const i = this._scopeCache;
5055 let s = i.get(t);
5056 return ((s && !e) || ((s = new Map()), i.set(t, s)), s);
5057 }
5058 getOptionScopes(t, e, i) {
5059 const { options: s, type: n } = this,
5060 o = this._cachedScopes(t, i),
5061 a = o.get(e);
5062 if (a) return a;
5063 const r = new Set();
5064 e.forEach((e) => {
5065 (t && (r.add(t), e.forEach((e) => bn(r, t, e))),
5066 e.forEach((t) => bn(r, s, t)),
5067 e.forEach((t) => bn(r, re[n] || {}, t)),
5068 e.forEach((t) => bn(r, ue, t)),
5069 e.forEach((t) => bn(r, le, t)));
5070 });
5071 const l = Array.from(r);
5072 return (0 === l.length && l.push(Object.create(null)), mn.has(e) && o.set(e, l), l);
5073 }
5074 chartOptionScopes() {
5075 const { options: t, type: e } = this;
5076 return [t, re[e] || {}, ue.datasets[e] || {}, { type: e }, ue, le];
5077 }
5078 resolveNamedOptions(t, e, i, s = [""]) {
5079 const o = { $shared: !0 },
5080 { resolver: a, subPrefixes: r } = yn(this._resolverCache, t, s);
5081 let l = a;
5082 if (
5083 (function (t, e) {
5084 const { isScriptable: i, isIndexable: s } = Ye(t);
5085 for (const o of e) {
5086 const e = i(o),
5087 a = s(o),
5088 r = (a || e) && t[o];
5089 if ((e && (S(r) || vn(r))) || (a && n(r))) return !0;
5090 }
5091 return !1;
5092 })(a, e)
5093 ) {
5094 o.$shared = !1;
5095 l = $e(a, (i = S(i) ? i() : i), this.createResolver(t, i, r));
5096 }
5097 for (const t of e) o[t] = l[t];
5098 return o;
5099 }
5100 createResolver(t, e, i = [""], s) {
5101 const { resolver: n } = yn(this._resolverCache, t, i);
5102 return o(e) ? $e(n, e, void 0, s) : n;
5103 }
5104 }
5105 function yn(t, e, i) {
5106 let s = t.get(e);
5107 s || ((s = new Map()), t.set(e, s));
5108 const n = i.join();
5109 let o = s.get(n);
5110 if (!o) {
5111 ((o = { resolver: je(e, i), subPrefixes: i.filter((t) => !t.toLowerCase().includes("hover")) }), s.set(n, o));
5112 }
5113 return o;
5114 }
5115 const vn = (t) => o(t) && Object.getOwnPropertyNames(t).some((e) => S(t[e]));
5116 const Mn = ["top", "bottom", "left", "right", "chartArea"];
5117 function wn(t, e) {
5118 return "top" === t || "bottom" === t || (-1 === Mn.indexOf(t) && "x" === e);
5119 }
5120 function kn(t, e) {
5121 return function (i, s) {
5122 return i[t] === s[t] ? i[e] - s[e] : i[t] - s[t];
5123 };
5124 }
5125 function Sn(t) {
5126 const e = t.chart,
5127 i = e.options.animation;
5128 (e.notifyPlugins("afterRender"), d(i && i.onComplete, [t], e));
5129 }
5130 function Pn(t) {
5131 const e = t.chart,
5132 i = e.options.animation;
5133 d(i && i.onProgress, [t], e);
5134 }
5135 function Dn(t) {
5136 return (
5137 fe() && "string" == typeof t ? (t = document.getElementById(t)) : t && t.length && (t = t[0]),
5138 t && t.canvas && (t = t.canvas),
5139 t
5140 );
5141 }
5142 const Cn = {},
5143 On = (t) => {
5144 const e = Dn(t);
5145 return Object.values(Cn)
5146 .filter((t) => t.canvas === e)
5147 .pop();
5148 };
5149 function An(t, e, i) {
5150 const s = Object.keys(t);
5151 for (const n of s) {
5152 const s = +n;
5153 if (s >= e) {
5154 const o = t[n];
5155 (delete t[n], (i > 0 || s > e) && (t[s + i] = o));
5156 }
5157 }
5158 }
5159 class Tn {
5160 static defaults = ue;
5161 static instances = Cn;
5162 static overrides = re;
5163 static registry = nn;
5164 static version = "4.5.1";
5165 static getChart = On;
5166 static register(...t) {
5167 (nn.add(...t), Ln());
5168 }
5169 static unregister(...t) {
5170 (nn.remove(...t), Ln());
5171 }
5172 constructor(t, e) {
5173 const s = (this.config = new _n(e)),
5174 n = Dn(t),
5175 o = On(n);
5176 if (o)
5177 throw new Error(
5178 "Canvas is already in use. Chart with ID '" +
5179 o.id +
5180 "' must be destroyed before the canvas with ID '" +
5181 o.canvas.id +
5182 "' can be reused.",
5183 );
5184 const a = s.createResolver(s.chartOptionScopes(), this.getContext());
5185 ((this.platform = new (s.platform || Ps(n))()), this.platform.updateConfig(s));
5186 const r = this.platform.acquireContext(n, a.aspectRatio),
5187 l = r && r.canvas,
5188 h = l && l.height,
5189 c = l && l.width;
5190 ((this.id = i()),
5191 (this.ctx = r),
5192 (this.canvas = l),
5193 (this.width = c),
5194 (this.height = h),
5195 (this._options = a),
5196 (this._aspectRatio = this.aspectRatio),
5197 (this._layers = []),
5198 (this._metasets = []),
5199 (this._stacks = void 0),
5200 (this.boxes = []),
5201 (this.currentDevicePixelRatio = void 0),
5202 (this.chartArea = void 0),
5203 (this._active = []),
5204 (this._lastEvent = void 0),
5205 (this._listeners = {}),
5206 (this._responsiveListeners = void 0),
5207 (this._sortedMetasets = []),
5208 (this.scales = {}),
5209 (this._plugins = new on()),
5210 (this.$proxies = {}),
5211 (this._hiddenIndices = {}),
5212 (this.attached = !1),
5213 (this._animationsDisabled = void 0),
5214 (this.$context = void 0),
5215 (this._doResize = dt((t) => this.update(t), a.resizeDelay || 0)),
5216 (this._dataChanges = []),
5217 (Cn[this.id] = this),
5218 r && l
5219 ? (bt.listen(this, "complete", Sn),
5220 bt.listen(this, "progress", Pn),
5221 this._initialize(),
5222 this.attached && this.update())
5223 : console.error("Failed to create chart: can't acquire context from the given item"));
5224 }
5225 get aspectRatio() {
5226 const {
5227 options: { aspectRatio: t, maintainAspectRatio: e },
5228 width: i,
5229 height: n,
5230 _aspectRatio: o,
5231 } = this;
5232 return s(t) ? (e && o ? o : n ? i / n : null) : t;
5233 }
5234 get data() {
5235 return this.config.data;
5236 }
5237 set data(t) {
5238 this.config.data = t;
5239 }
5240 get options() {
5241 return this._options;
5242 }
5243 set options(t) {
5244 this.config.options = t;
5245 }
5246 get registry() {
5247 return nn;
5248 }
5249 _initialize() {
5250 return (
5251 this.notifyPlugins("beforeInit"),
5252 this.options.responsive ? this.resize() : ke(this, this.options.devicePixelRatio),
5253 this.bindEvents(),
5254 this.notifyPlugins("afterInit"),
5255 this
5256 );
5257 }
5258 clear() {
5259 return (Te(this.canvas, this.ctx), this);
5260 }
5261 stop() {
5262 return (bt.stop(this), this);
5263 }
5264 resize(t, e) {
5265 bt.running(this) ? (this._resizeBeforeDraw = { width: t, height: e }) : this._resize(t, e);
5266 }
5267 _resize(t, e) {
5268 const i = this.options,
5269 s = this.canvas,
5270 n = i.maintainAspectRatio && this.aspectRatio,
5271 o = this.platform.getMaximumSize(s, t, e, n),
5272 a = i.devicePixelRatio || this.platform.getDevicePixelRatio(),
5273 r = this.width ? "resize" : "attach";
5274 ((this.width = o.width),
5275 (this.height = o.height),
5276 (this._aspectRatio = this.aspectRatio),
5277 ke(this, a, !0) &&
5278 (this.notifyPlugins("resize", { size: o }),
5279 d(i.onResize, [this, o], this),
5280 this.attached && this._doResize(r) && this.render()));
5281 }
5282 ensureScalesHaveIDs() {
5283 u(this.options.scales || {}, (t, e) => {
5284 t.id = e;
5285 });
5286 }
5287 buildOrUpdateScales() {
5288 const t = this.options,
5289 e = t.scales,
5290 i = this.scales,
5291 s = Object.keys(i).reduce((t, e) => ((t[e] = !1), t), {});
5292 let n = [];
5293 (e &&
5294 (n = n.concat(
5295 Object.keys(e).map((t) => {
5296 const i = e[t],
5297 s = cn(t, i),
5298 n = "r" === s,
5299 o = "x" === s;
5300 return {
5301 options: i,
5302 dposition: n ? "chartArea" : o ? "bottom" : "left",
5303 dtype: n ? "radialLinear" : o ? "category" : "linear",
5304 };
5305 }),
5306 )),
5307 u(n, (e) => {
5308 const n = e.options,
5309 o = n.id,
5310 a = cn(o, n),
5311 r = l(n.type, e.dtype);
5312 ((void 0 !== n.position && wn(n.position, a) === wn(e.dposition)) || (n.position = e.dposition), (s[o] = !0));
5313 let h = null;
5314 if (o in i && i[o].type === r) h = i[o];
5315 else {
5316 ((h = new (nn.getScale(r))({ id: o, type: r, ctx: this.ctx, chart: this })), (i[h.id] = h));
5317 }
5318 h.init(n, t);
5319 }),
5320 u(s, (t, e) => {
5321 t || delete i[e];
5322 }),
5323 u(i, (t) => {
5324 (ls.configure(this, t, t.options), ls.addBox(this, t));
5325 }));
5326 }
5327 _updateMetasets() {
5328 const t = this._metasets,
5329 e = this.data.datasets.length,
5330 i = t.length;
5331 if ((t.sort((t, e) => t.index - e.index), i > e)) {
5332 for (let t = e; t < i; ++t) this._destroyDatasetMeta(t);
5333 t.splice(e, i - e);
5334 }
5335 this._sortedMetasets = t.slice(0).sort(kn("order", "index"));
5336 }
5337 _removeUnreferencedMetasets() {
5338 const {
5339 _metasets: t,
5340 data: { datasets: e },
5341 } = this;
5342 (t.length > e.length && delete this._stacks,
5343 t.forEach((t, i) => {
5344 0 === e.filter((e) => e === t._dataset).length && this._destroyDatasetMeta(i);
5345 }));
5346 }
5347 buildOrUpdateControllers() {
5348 const t = [],
5349 e = this.data.datasets;
5350 let i, s;
5351 for (this._removeUnreferencedMetasets(), i = 0, s = e.length; i < s; i++) {
5352 const s = e[i];
5353 let n = this.getDatasetMeta(i);
5354 const o = s.type || this.config.type;
5355 if (
5356 (n.type && n.type !== o && (this._destroyDatasetMeta(i), (n = this.getDatasetMeta(i))),
5357 (n.type = o),
5358 (n.indexAxis = s.indexAxis || ln(o, this.options)),
5359 (n.order = s.order || 0),
5360 (n.index = i),
5361 (n.label = "" + s.label),
5362 (n.visible = this.isDatasetVisible(i)),
5363 n.controller)
5364 )
5365 (n.controller.updateIndex(i), n.controller.linkScales());
5366 else {
5367 const e = nn.getController(o),
5368 { datasetElementType: s, dataElementType: a } = ue.datasets[o];
5369 (Object.assign(e, { dataElementType: nn.getElement(a), datasetElementType: s && nn.getElement(s) }),
5370 (n.controller = new e(this, i)),
5371 t.push(n.controller));
5372 }
5373 }
5374 return (this._updateMetasets(), t);
5375 }
5376 _resetElements() {
5377 u(
5378 this.data.datasets,
5379 (t, e) => {
5380 this.getDatasetMeta(e).controller.reset();
5381 },
5382 this,
5383 );
5384 }
5385 reset() {
5386 (this._resetElements(), this.notifyPlugins("reset"));
5387 }
5388 update(t) {
5389 const e = this.config;
5390 e.update();
5391 const i = (this._options = e.createResolver(e.chartOptionScopes(), this.getContext())),
5392 s = (this._animationsDisabled = !i.animation);
5393 if (
5394 (this._updateScales(),
5395 this._checkEventBindings(),
5396 this._updateHiddenIndices(),
5397 this._plugins.invalidate(),
5398 !1 === this.notifyPlugins("beforeUpdate", { mode: t, cancelable: !0 }))
5399 )
5400 return;
5401 const n = this.buildOrUpdateControllers();
5402 this.notifyPlugins("beforeElementsUpdate");
5403 let o = 0;
5404 for (let t = 0, e = this.data.datasets.length; t < e; t++) {
5405 const { controller: e } = this.getDatasetMeta(t),
5406 i = !s && -1 === n.indexOf(e);
5407 (e.buildOrUpdateElements(i), (o = Math.max(+e.getMaxOverflow(), o)));
5408 }
5409 ((o = this._minPadding = i.layout.autoPadding ? o : 0),
5410 this._updateLayout(o),
5411 s ||
5412 u(n, (t) => {
5413 t.reset();
5414 }),
5415 this._updateDatasets(t),
5416 this.notifyPlugins("afterUpdate", { mode: t }),
5417 this._layers.sort(kn("z", "_idx")));
5418 const { _active: a, _lastEvent: r } = this;
5419 (r ? this._eventHandler(r, !0) : a.length && this._updateHoverStyles(a, a, !0), this.render());
5420 }
5421 _updateScales() {
5422 (u(this.scales, (t) => {
5423 ls.removeBox(this, t);
5424 }),
5425 this.ensureScalesHaveIDs(),
5426 this.buildOrUpdateScales());
5427 }
5428 _checkEventBindings() {
5429 const t = this.options,
5430 e = new Set(Object.keys(this._listeners)),
5431 i = new Set(t.events);
5432 (P(e, i) && !!this._responsiveListeners === t.responsive) || (this.unbindEvents(), this.bindEvents());
5433 }
5434 _updateHiddenIndices() {
5435 const { _hiddenIndices: t } = this,
5436 e = this._getUniformDataChanges() || [];
5437 for (const { method: i, start: s, count: n } of e) {
5438 An(t, s, "_removeElements" === i ? -n : n);
5439 }
5440 }
5441 _getUniformDataChanges() {
5442 const t = this._dataChanges;
5443 if (!t || !t.length) return;
5444 this._dataChanges = [];
5445 const e = this.data.datasets.length,
5446 i = (e) => new Set(t.filter((t) => t[0] === e).map((t, e) => e + "," + t.splice(1).join(","))),
5447 s = i(0);
5448 for (let t = 1; t < e; t++) if (!P(s, i(t))) return;
5449 return Array.from(s)
5450 .map((t) => t.split(","))
5451 .map((t) => ({ method: t[1], start: +t[2], count: +t[3] }));
5452 }
5453 _updateLayout(t) {
5454 if (!1 === this.notifyPlugins("beforeLayout", { cancelable: !0 })) return;
5455 ls.update(this, this.width, this.height, t);
5456 const e = this.chartArea,
5457 i = e.width <= 0 || e.height <= 0;
5458 ((this._layers = []),
5459 u(
5460 this.boxes,
5461 (t) => {
5462 (i && "chartArea" === t.position) || (t.configure && t.configure(), this._layers.push(...t._layers()));
5463 },
5464 this,
5465 ),
5466 this._layers.forEach((t, e) => {
5467 t._idx = e;
5468 }),
5469 this.notifyPlugins("afterLayout"));
5470 }
5471 _updateDatasets(t) {
5472 if (!1 !== this.notifyPlugins("beforeDatasetsUpdate", { mode: t, cancelable: !0 })) {
5473 for (let t = 0, e = this.data.datasets.length; t < e; ++t) this.getDatasetMeta(t).controller.configure();
5474 for (let e = 0, i = this.data.datasets.length; e < i; ++e)
5475 this._updateDataset(e, S(t) ? t({ datasetIndex: e }) : t);
5476 this.notifyPlugins("afterDatasetsUpdate", { mode: t });
5477 }
5478 }
5479 _updateDataset(t, e) {
5480 const i = this.getDatasetMeta(t),
5481 s = { meta: i, index: t, mode: e, cancelable: !0 };
5482 !1 !== this.notifyPlugins("beforeDatasetUpdate", s) &&
5483 (i.controller._update(e), (s.cancelable = !1), this.notifyPlugins("afterDatasetUpdate", s));
5484 }
5485 render() {
5486 !1 !== this.notifyPlugins("beforeRender", { cancelable: !0 }) &&
5487 (bt.has(this) ? this.attached && !bt.running(this) && bt.start(this) : (this.draw(), Sn({ chart: this })));
5488 }
5489 draw() {
5490 let t;
5491 if (this._resizeBeforeDraw) {
5492 const { width: t, height: e } = this._resizeBeforeDraw;
5493 ((this._resizeBeforeDraw = null), this._resize(t, e));
5494 }
5495 if ((this.clear(), this.width <= 0 || this.height <= 0)) return;
5496 if (!1 === this.notifyPlugins("beforeDraw", { cancelable: !0 })) return;
5497 const e = this._layers;
5498 for (t = 0; t < e.length && e[t].z <= 0; ++t) e[t].draw(this.chartArea);
5499 for (this._drawDatasets(); t < e.length; ++t) e[t].draw(this.chartArea);
5500 this.notifyPlugins("afterDraw");
5501 }
5502 _getSortedDatasetMetas(t) {
5503 const e = this._sortedMetasets,
5504 i = [];
5505 let s, n;
5506 for (s = 0, n = e.length; s < n; ++s) {
5507 const n = e[s];
5508 (t && !n.visible) || i.push(n);
5509 }
5510 return i;
5511 }
5512 getSortedVisibleDatasetMetas() {
5513 return this._getSortedDatasetMetas(!0);
5514 }
5515 _drawDatasets() {
5516 if (!1 === this.notifyPlugins("beforeDatasetsDraw", { cancelable: !0 })) return;
5517 const t = this.getSortedVisibleDatasetMetas();
5518 for (let e = t.length - 1; e >= 0; --e) this._drawDataset(t[e]);
5519 this.notifyPlugins("afterDatasetsDraw");
5520 }
5521 _drawDataset(t) {
5522 const e = this.ctx,
5523 i = { meta: t, index: t.index, cancelable: !0 },
5524 s = Ni(this, t);
5525 !1 !== this.notifyPlugins("beforeDatasetDraw", i) &&
5526 (s && Ie(e, s),
5527 t.controller.draw(),
5528 s && ze(e),
5529 (i.cancelable = !1),
5530 this.notifyPlugins("afterDatasetDraw", i));
5531 }
5532 isPointInArea(t) {
5533 return Re(t, this.chartArea, this._minPadding);
5534 }
5535 getElementsAtEventForMode(t, e, i, s) {
5536 const n = Ki.modes[e];
5537 return "function" == typeof n ? n(this, t, i, s) : [];
5538 }
5539 getDatasetMeta(t) {
5540 const e = this.data.datasets[t],
5541 i = this._metasets;
5542 let s = i.filter((t) => t && t._dataset === e).pop();
5543 return (
5544 s ||
5545 ((s = {
5546 type: null,
5547 data: [],
5548 dataset: null,
5549 controller: null,
5550 hidden: null,
5551 xAxisID: null,
5552 yAxisID: null,
5553 order: (e && e.order) || 0,
5554 index: t,
5555 _dataset: e,
5556 _parsed: [],
5557 _sorted: !1,
5558 }),
5559 i.push(s)),
5560 s
5561 );
5562 }
5563 getContext() {
5564 return this.$context || (this.$context = Ci(null, { chart: this, type: "chart" }));
5565 }
5566 getVisibleDatasetCount() {
5567 return this.getSortedVisibleDatasetMetas().length;
5568 }
5569 isDatasetVisible(t) {
5570 const e = this.data.datasets[t];
5571 if (!e) return !1;
5572 const i = this.getDatasetMeta(t);
5573 return "boolean" == typeof i.hidden ? !i.hidden : !e.hidden;
5574 }
5575 setDatasetVisibility(t, e) {
5576 this.getDatasetMeta(t).hidden = !e;
5577 }
5578 toggleDataVisibility(t) {
5579 this._hiddenIndices[t] = !this._hiddenIndices[t];
5580 }
5581 getDataVisibility(t) {
5582 return !this._hiddenIndices[t];
5583 }
5584 _updateVisibility(t, e, i) {
5585 const s = i ? "show" : "hide",
5586 n = this.getDatasetMeta(t),
5587 o = n.controller._resolveAnimations(void 0, s);
5588 k(e)
5589 ? ((n.data[e].hidden = !i), this.update())
5590 : (this.setDatasetVisibility(t, i),
5591 o.update(n, { visible: i }),
5592 this.update((e) => (e.datasetIndex === t ? s : void 0)));
5593 }
5594 hide(t, e) {
5595 this._updateVisibility(t, e, !1);
5596 }
5597 show(t, e) {
5598 this._updateVisibility(t, e, !0);
5599 }
5600 _destroyDatasetMeta(t) {
5601 const e = this._metasets[t];
5602 (e && e.controller && e.controller._destroy(), delete this._metasets[t]);
5603 }
5604 _stop() {
5605 let t, e;
5606 for (this.stop(), bt.remove(this), t = 0, e = this.data.datasets.length; t < e; ++t) this._destroyDatasetMeta(t);
5607 }
5608 destroy() {
5609 this.notifyPlugins("beforeDestroy");
5610 const { canvas: t, ctx: e } = this;
5611 (this._stop(),
5612 this.config.clearCache(),
5613 t && (this.unbindEvents(), Te(t, e), this.platform.releaseContext(e), (this.canvas = null), (this.ctx = null)),
5614 delete Cn[this.id],
5615 this.notifyPlugins("afterDestroy"));
5616 }
5617 toBase64Image(...t) {
5618 return this.canvas.toDataURL(...t);
5619 }
5620 bindEvents() {
5621 (this.bindUserEvents(), this.options.responsive ? this.bindResponsiveEvents() : (this.attached = !0));
5622 }
5623 bindUserEvents() {
5624 const t = this._listeners,
5625 e = this.platform,
5626 i = (i, s) => {
5627 (e.addEventListener(this, i, s), (t[i] = s));
5628 },
5629 s = (t, e, i) => {
5630 ((t.offsetX = e), (t.offsetY = i), this._eventHandler(t));
5631 };
5632 u(this.options.events, (t) => i(t, s));
5633 }
5634 bindResponsiveEvents() {
5635 this._responsiveListeners || (this._responsiveListeners = {});
5636 const t = this._responsiveListeners,
5637 e = this.platform,
5638 i = (i, s) => {
5639 (e.addEventListener(this, i, s), (t[i] = s));
5640 },
5641 s = (i, s) => {
5642 t[i] && (e.removeEventListener(this, i, s), delete t[i]);
5643 },
5644 n = (t, e) => {
5645 this.canvas && this.resize(t, e);
5646 };
5647 let o;
5648 const a = () => {
5649 (s("attach", a), (this.attached = !0), this.resize(), i("resize", n), i("detach", o));
5650 };
5651 ((o = () => {
5652 ((this.attached = !1), s("resize", n), this._stop(), this._resize(0, 0), i("attach", a));
5653 }),
5654 e.isAttached(this.canvas) ? a() : o());
5655 }
5656 unbindEvents() {
5657 (u(this._listeners, (t, e) => {
5658 this.platform.removeEventListener(this, e, t);
5659 }),
5660 (this._listeners = {}),
5661 u(this._responsiveListeners, (t, e) => {
5662 this.platform.removeEventListener(this, e, t);
5663 }),
5664 (this._responsiveListeners = void 0));
5665 }
5666 updateHoverStyle(t, e, i) {
5667 const s = i ? "set" : "remove";
5668 let n, o, a, r;
5669 for (
5670 "dataset" === e &&
5671 ((n = this.getDatasetMeta(t[0].datasetIndex)), n.controller["_" + s + "DatasetHoverStyle"]()),
5672 a = 0,
5673 r = t.length;
5674 a < r;
5675 ++a
5676 ) {
5677 o = t[a];
5678 const e = o && this.getDatasetMeta(o.datasetIndex).controller;
5679 e && e[s + "HoverStyle"](o.element, o.datasetIndex, o.index);
5680 }
5681 }
5682 getActiveElements() {
5683 return this._active || [];
5684 }
5685 setActiveElements(t) {
5686 const e = this._active || [],
5687 i = t.map(({ datasetIndex: t, index: e }) => {
5688 const i = this.getDatasetMeta(t);
5689 if (!i) throw new Error("No dataset found at index " + t);
5690 return { datasetIndex: t, element: i.data[e], index: e };
5691 });
5692 !f(i, e) && ((this._active = i), (this._lastEvent = null), this._updateHoverStyles(i, e));
5693 }
5694 notifyPlugins(t, e, i) {
5695 return this._plugins.notify(this, t, e, i);
5696 }
5697 isPluginEnabled(t) {
5698 return 1 === this._plugins._cache.filter((e) => e.plugin.id === t).length;
5699 }
5700 _updateHoverStyles(t, e, i) {
5701 const s = this.options.hover,
5702 n = (t, e) => t.filter((t) => !e.some((e) => t.datasetIndex === e.datasetIndex && t.index === e.index)),
5703 o = n(e, t),
5704 a = i ? t : n(t, e);
5705 (o.length && this.updateHoverStyle(o, s.mode, !1), a.length && s.mode && this.updateHoverStyle(a, s.mode, !0));
5706 }
5707 _eventHandler(t, e) {
5708 const i = { event: t, replay: e, cancelable: !0, inChartArea: this.isPointInArea(t) },
5709 s = (e) => (e.options.events || this.options.events).includes(t.native.type);
5710 if (!1 === this.notifyPlugins("beforeEvent", i, s)) return;
5711 const n = this._handleEvent(t, e, i.inChartArea);
5712 return ((i.cancelable = !1), this.notifyPlugins("afterEvent", i, s), (n || i.changed) && this.render(), this);
5713 }
5714 _handleEvent(t, e, i) {
5715 const { _active: s = [], options: n } = this,
5716 o = e,
5717 a = this._getActiveElements(t, s, i, o),
5718 r = D(t),
5719 l = (function (t, e, i, s) {
5720 return i && "mouseout" !== t.type ? (s ? e : t) : null;
5721 })(t, this._lastEvent, i, r);
5722 i && ((this._lastEvent = null), d(n.onHover, [t, a, this], this), r && d(n.onClick, [t, a, this], this));
5723 const h = !f(a, s);
5724 return ((h || e) && ((this._active = a), this._updateHoverStyles(a, s, e)), (this._lastEvent = l), h);
5725 }
5726 _getActiveElements(t, e, i, s) {
5727 if ("mouseout" === t.type) return [];
5728 if (!i) return e;
5729 const n = this.options.hover;
5730 return this.getElementsAtEventForMode(t, n.mode, n, s);
5731 }
5732 }
5733 function Ln() {
5734 return u(Tn.instances, (t) => t._plugins.invalidate());
5735 }
5736 function En() {
5737 throw new Error("This method is not implemented: Check that a complete date adapter is provided.");
5738 }
5739 class Rn {
5740 static override(t) {
5741 Object.assign(Rn.prototype, t);
5742 }
5743 options;
5744 constructor(t) {
5745 this.options = t || {};
5746 }
5747 init() {}
5748 formats() {
5749 return En();
5750 }
5751 parse() {
5752 return En();
5753 }
5754 format() {
5755 return En();
5756 }
5757 add() {
5758 return En();
5759 }
5760 diff() {
5761 return En();
5762 }
5763 startOf() {
5764 return En();
5765 }
5766 endOf() {
5767 return En();
5768 }
5769 }
5770 var In = { _date: Rn };
5771 function zn(t) {
5772 const e = t.iScale,
5773 i = (function (t, e) {
5774 if (!t._cache.$bar) {
5775 const i = t.getMatchingVisibleMetas(e);
5776 let s = [];
5777 for (let e = 0, n = i.length; e < n; e++) s = s.concat(i[e].controller.getAllParsedValues(t));
5778 t._cache.$bar = lt(s.sort((t, e) => t - e));
5779 }
5780 return t._cache.$bar;
5781 })(e, t.type);
5782 let s,
5783 n,
5784 o,
5785 a,
5786 r = e._length;
5787 const l = () => {
5788 32767 !== o && -32768 !== o && (k(a) && (r = Math.min(r, Math.abs(o - a) || r)), (a = o));
5789 };
5790 for (s = 0, n = i.length; s < n; ++s) ((o = e.getPixelForValue(i[s])), l());
5791 for (a = void 0, s = 0, n = e.ticks.length; s < n; ++s) ((o = e.getPixelForTick(s)), l());
5792 return r;
5793 }
5794 function Fn(t, e, i, s) {
5795 return (
5796 n(t)
5797 ? (function (t, e, i, s) {
5798 const n = i.parse(t[0], s),
5799 o = i.parse(t[1], s),
5800 a = Math.min(n, o),
5801 r = Math.max(n, o);
5802 let l = a,
5803 h = r;
5804 (Math.abs(a) > Math.abs(r) && ((l = r), (h = a)),
5805 (e[i.axis] = h),
5806 (e._custom = { barStart: l, barEnd: h, start: n, end: o, min: a, max: r }));
5807 })(t, e, i, s)
5808 : (e[i.axis] = i.parse(t, s)),
5809 e
5810 );
5811 }
5812 function Vn(t, e, i, s) {
5813 const n = t.iScale,
5814 o = t.vScale,
5815 a = n.getLabels(),
5816 r = n === o,
5817 l = [];
5818 let h, c, d, u;
5819 for (h = i, c = i + s; h < c; ++h)
5820 ((u = e[h]), (d = {}), (d[n.axis] = r || n.parse(a[h], h)), l.push(Fn(u, d, o, h)));
5821 return l;
5822 }
5823 function Bn(t) {
5824 return t && void 0 !== t.barStart && void 0 !== t.barEnd;
5825 }
5826 function Wn(t, e, i, s) {
5827 let n = e.borderSkipped;
5828 const o = {};
5829 if (!n) return void (t.borderSkipped = o);
5830 if (!0 === n) return void (t.borderSkipped = { top: !0, right: !0, bottom: !0, left: !0 });
5831 const {
5832 start: a,
5833 end: r,
5834 reverse: l,
5835 top: h,
5836 bottom: c,
5837 } = (function (t) {
5838 let e, i, s, n, o;
5839 return (
5840 t.horizontal
5841 ? ((e = t.base > t.x), (i = "left"), (s = "right"))
5842 : ((e = t.base < t.y), (i = "bottom"), (s = "top")),
5843 e ? ((n = "end"), (o = "start")) : ((n = "start"), (o = "end")),
5844 { start: i, end: s, reverse: e, top: n, bottom: o }
5845 );
5846 })(t);
5847 ("middle" === n &&
5848 i &&
5849 ((t.enableBorderRadius = !0),
5850 (i._top || 0) === s ? (n = h) : (i._bottom || 0) === s ? (n = c) : ((o[Nn(c, a, r, l)] = !0), (n = h))),
5851 (o[Nn(n, a, r, l)] = !0),
5852 (t.borderSkipped = o));
5853 }
5854 function Nn(t, e, i, s) {
5855 var n, o, a;
5856 return (s ? ((a = i), (t = Hn((t = (n = t) === (o = e) ? a : n === a ? o : n), i, e))) : (t = Hn(t, e, i)), t);
5857 }
5858 function Hn(t, e, i) {
5859 return "start" === t ? e : "end" === t ? i : t;
5860 }
5861 function jn(t, { inflateAmount: e }, i) {
5862 t.inflateAmount = "auto" === e ? (1 === i ? 0.33 : 0) : e;
5863 }
5864 class $n extends js {
5865 static id = "doughnut";
5866 static defaults = {
5867 datasetElementType: !1,
5868 dataElementType: "arc",
5869 animation: { animateRotate: !0, animateScale: !1 },
5870 animations: {
5871 numbers: {
5872 type: "number",
5873 properties: [
5874 "circumference",
5875 "endAngle",
5876 "innerRadius",
5877 "outerRadius",
5878 "startAngle",
5879 "x",
5880 "y",
5881 "offset",
5882 "borderWidth",
5883 "spacing",
5884 ],
5885 },
5886 },
5887 cutout: "50%",
5888 rotation: 0,
5889 circumference: 360,
5890 radius: "100%",
5891 spacing: 0,
5892 indexAxis: "r",
5893 };
5894 static descriptors = {
5895 _scriptable: (t) => "spacing" !== t,
5896 _indexable: (t) => "spacing" !== t && !t.startsWith("borderDash") && !t.startsWith("hoverBorderDash"),
5897 };
5898 static overrides = {
5899 aspectRatio: 1,
5900 plugins: {
5901 legend: {
5902 labels: {
5903 generateLabels(t) {
5904 const e = t.data,
5905 {
5906 labels: { pointStyle: i, textAlign: s, color: n, useBorderRadius: o, borderRadius: a },
5907 } = t.legend.options;
5908 return e.labels.length && e.datasets.length
5909 ? e.labels.map((e, r) => {
5910 const l = t.getDatasetMeta(0).controller.getStyle(r);
5911 return {
5912 text: e,
5913 fillStyle: l.backgroundColor,
5914 fontColor: n,
5915 hidden: !t.getDataVisibility(r),
5916 lineDash: l.borderDash,
5917 lineDashOffset: l.borderDashOffset,
5918 lineJoin: l.borderJoinStyle,
5919 lineWidth: l.borderWidth,
5920 strokeStyle: l.borderColor,
5921 textAlign: s,
5922 pointStyle: i,
5923 borderRadius: o && (a || l.borderRadius),
5924 index: r,
5925 };
5926 })
5927 : [];
5928 },
5929 },
5930 onClick(t, e, i) {
5931 (i.chart.toggleDataVisibility(e.index), i.chart.update());
5932 },
5933 },
5934 },
5935 };
5936 constructor(t, e) {
5937 (super(t, e),
5938 (this.enableOptionSharing = !0),
5939 (this.innerRadius = void 0),
5940 (this.outerRadius = void 0),
5941 (this.offsetX = void 0),
5942 (this.offsetY = void 0));
5943 }
5944 linkScales() {}
5945 parse(t, e) {
5946 const i = this.getDataset().data,
5947 s = this._cachedMeta;
5948 if (!1 === this._parsing) s._parsed = i;
5949 else {
5950 let n,
5951 a,
5952 r = (t) => +i[t];
5953 if (o(i[t])) {
5954 const { key: t = "value" } = this._parsing;
5955 r = (e) => +M(i[e], t);
5956 }
5957 for (n = t, a = t + e; n < a; ++n) s._parsed[n] = r(n);
5958 }
5959 }
5960 _getRotation() {
5961 return $(this.options.rotation - 90);
5962 }
5963 _getCircumference() {
5964 return $(this.options.circumference);
5965 }
5966 _getRotationExtents() {
5967 let t = O,
5968 e = -O;
5969 for (let i = 0; i < this.chart.data.datasets.length; ++i)
5970 if (this.chart.isDatasetVisible(i) && this.chart.getDatasetMeta(i).type === this._type) {
5971 const s = this.chart.getDatasetMeta(i).controller,
5972 n = s._getRotation(),
5973 o = s._getCircumference();
5974 ((t = Math.min(t, n)), (e = Math.max(e, n + o)));
5975 }
5976 return { rotation: t, circumference: e - t };
5977 }
5978 update(t) {
5979 const e = this.chart,
5980 { chartArea: i } = e,
5981 s = this._cachedMeta,
5982 n = s.data,
5983 o = this.getMaxBorderWidth() + this.getMaxOffset(n) + this.options.spacing,
5984 a = Math.max((Math.min(i.width, i.height) - o) / 2, 0),
5985 r = Math.min(h(this.options.cutout, a), 1),
5986 l = this._getRingWeight(this.index),
5987 { circumference: d, rotation: u } = this._getRotationExtents(),
5988 {
5989 ratioX: f,
5990 ratioY: g,
5991 offsetX: p,
5992 offsetY: m,
5993 } = (function (t, e, i) {
5994 let s = 1,
5995 n = 1,
5996 o = 0,
5997 a = 0;
5998 if (e < O) {
5999 const r = t,
6000 l = r + e,
6001 h = Math.cos(r),
6002 c = Math.sin(r),
6003 d = Math.cos(l),
6004 u = Math.sin(l),
6005 f = (t, e, s) => (J(t, r, l, !0) ? 1 : Math.max(e, e * i, s, s * i)),
6006 g = (t, e, s) => (J(t, r, l, !0) ? -1 : Math.min(e, e * i, s, s * i)),
6007 p = f(0, h, d),
6008 m = f(E, c, u),
6009 x = g(C, h, d),
6010 b = g(C + E, c, u);
6011 ((s = (p - x) / 2), (n = (m - b) / 2), (o = -(p + x) / 2), (a = -(m + b) / 2));
6012 }
6013 return { ratioX: s, ratioY: n, offsetX: o, offsetY: a };
6014 })(u, d, r),
6015 x = (i.width - o) / f,
6016 b = (i.height - o) / g,
6017 _ = Math.max(Math.min(x, b) / 2, 0),
6018 y = c(this.options.radius, _),
6019 v = (y - Math.max(y * r, 0)) / this._getVisibleDatasetWeightTotal();
6020 ((this.offsetX = p * y),
6021 (this.offsetY = m * y),
6022 (s.total = this.calculateTotal()),
6023 (this.outerRadius = y - v * this._getRingWeightOffset(this.index)),
6024 (this.innerRadius = Math.max(this.outerRadius - v * l, 0)),
6025 this.updateElements(n, 0, n.length, t));
6026 }
6027 _circumference(t, e) {
6028 const i = this.options,
6029 s = this._cachedMeta,
6030 n = this._getCircumference();
6031 return (e && i.animation.animateRotate) ||
6032 !this.chart.getDataVisibility(t) ||
6033 null === s._parsed[t] ||
6034 s.data[t].hidden
6035 ? 0
6036 : this.calculateCircumference((s._parsed[t] * n) / O);
6037 }
6038 updateElements(t, e, i, s) {
6039 const n = "reset" === s,
6040 o = this.chart,
6041 a = o.chartArea,
6042 r = o.options.animation,
6043 l = (a.left + a.right) / 2,
6044 h = (a.top + a.bottom) / 2,
6045 c = n && r.animateScale,
6046 d = c ? 0 : this.innerRadius,
6047 u = c ? 0 : this.outerRadius,
6048 { sharedOptions: f, includeOptions: g } = this._getSharedOptions(e, s);
6049 let p,
6050 m = this._getRotation();
6051 for (p = 0; p < e; ++p) m += this._circumference(p, n);
6052 for (p = e; p < e + i; ++p) {
6053 const e = this._circumference(p, n),
6054 i = t[p],
6055 o = {
6056 x: l + this.offsetX,
6057 y: h + this.offsetY,
6058 startAngle: m,
6059 endAngle: m + e,
6060 circumference: e,
6061 outerRadius: u,
6062 innerRadius: d,
6063 };
6064 (g && (o.options = f || this.resolveDataElementOptions(p, i.active ? "active" : s)),
6065 (m += e),
6066 this.updateElement(i, p, o, s));
6067 }
6068 }
6069 calculateTotal() {
6070 const t = this._cachedMeta,
6071 e = t.data;
6072 let i,
6073 s = 0;
6074 for (i = 0; i < e.length; i++) {
6075 const n = t._parsed[i];
6076 null === n || isNaN(n) || !this.chart.getDataVisibility(i) || e[i].hidden || (s += Math.abs(n));
6077 }
6078 return s;
6079 }
6080 calculateCircumference(t) {
6081 const e = this._cachedMeta.total;
6082 return e > 0 && !isNaN(t) ? O * (Math.abs(t) / e) : 0;
6083 }
6084 getLabelAndValue(t) {
6085 const e = this._cachedMeta,
6086 i = this.chart,
6087 s = i.data.labels || [],
6088 n = ne(e._parsed[t], i.options.locale);
6089 return { label: s[t] || "", value: n };
6090 }
6091 getMaxBorderWidth(t) {
6092 let e = 0;
6093 const i = this.chart;
6094 let s, n, o, a, r;
6095 if (!t)
6096 for (s = 0, n = i.data.datasets.length; s < n; ++s)
6097 if (i.isDatasetVisible(s)) {
6098 ((o = i.getDatasetMeta(s)), (t = o.data), (a = o.controller));
6099 break;
6100 }
6101 if (!t) return 0;
6102 for (s = 0, n = t.length; s < n; ++s)
6103 ((r = a.resolveDataElementOptions(s)),
6104 "inner" !== r.borderAlign && (e = Math.max(e, r.borderWidth || 0, r.hoverBorderWidth || 0)));
6105 return e;
6106 }
6107 getMaxOffset(t) {
6108 let e = 0;
6109 for (let i = 0, s = t.length; i < s; ++i) {
6110 const t = this.resolveDataElementOptions(i);
6111 e = Math.max(e, t.offset || 0, t.hoverOffset || 0);
6112 }
6113 return e;
6114 }
6115 _getRingWeightOffset(t) {
6116 let e = 0;
6117 for (let i = 0; i < t; ++i) this.chart.isDatasetVisible(i) && (e += this._getRingWeight(i));
6118 return e;
6119 }
6120 _getRingWeight(t) {
6121 return Math.max(l(this.chart.data.datasets[t].weight, 1), 0);
6122 }
6123 _getVisibleDatasetWeightTotal() {
6124 return this._getRingWeightOffset(this.chart.data.datasets.length) || 1;
6125 }
6126 }
6127 class Yn extends js {
6128 static id = "polarArea";
6129 static defaults = {
6130 dataElementType: "arc",
6131 animation: { animateRotate: !0, animateScale: !0 },
6132 animations: {
6133 numbers: { type: "number", properties: ["x", "y", "startAngle", "endAngle", "innerRadius", "outerRadius"] },
6134 },
6135 indexAxis: "r",
6136 startAngle: 0,
6137 };
6138 static overrides = {
6139 aspectRatio: 1,
6140 plugins: {
6141 legend: {
6142 labels: {
6143 generateLabels(t) {
6144 const e = t.data;
6145 if (e.labels.length && e.datasets.length) {
6146 const {
6147 labels: { pointStyle: i, color: s },
6148 } = t.legend.options;
6149 return e.labels.map((e, n) => {
6150 const o = t.getDatasetMeta(0).controller.getStyle(n);
6151 return {
6152 text: e,
6153 fillStyle: o.backgroundColor,
6154 strokeStyle: o.borderColor,
6155 fontColor: s,
6156 lineWidth: o.borderWidth,
6157 pointStyle: i,
6158 hidden: !t.getDataVisibility(n),
6159 index: n,
6160 };
6161 });
6162 }
6163 return [];
6164 },
6165 },
6166 onClick(t, e, i) {
6167 (i.chart.toggleDataVisibility(e.index), i.chart.update());
6168 },
6169 },
6170 },
6171 scales: {
6172 r: {
6173 type: "radialLinear",
6174 angleLines: { display: !1 },
6175 beginAtZero: !0,
6176 grid: { circular: !0 },
6177 pointLabels: { display: !1 },
6178 startAngle: 0,
6179 },
6180 },
6181 };
6182 constructor(t, e) {
6183 (super(t, e), (this.innerRadius = void 0), (this.outerRadius = void 0));
6184 }
6185 getLabelAndValue(t) {
6186 const e = this._cachedMeta,
6187 i = this.chart,
6188 s = i.data.labels || [],
6189 n = ne(e._parsed[t].r, i.options.locale);
6190 return { label: s[t] || "", value: n };
6191 }
6192 parseObjectData(t, e, i, s) {
6193 return ii.bind(this)(t, e, i, s);
6194 }
6195 update(t) {
6196 const e = this._cachedMeta.data;
6197 (this._updateRadius(), this.updateElements(e, 0, e.length, t));
6198 }
6199 getMinMax() {
6200 const t = this._cachedMeta,
6201 e = { min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY };
6202 return (
6203 t.data.forEach((t, i) => {
6204 const s = this.getParsed(i).r;
6205 !isNaN(s) && this.chart.getDataVisibility(i) && (s < e.min && (e.min = s), s > e.max && (e.max = s));
6206 }),
6207 e
6208 );
6209 }
6210 _updateRadius() {
6211 const t = this.chart,
6212 e = t.chartArea,
6213 i = t.options,
6214 s = Math.min(e.right - e.left, e.bottom - e.top),
6215 n = Math.max(s / 2, 0),
6216 o = (n - Math.max(i.cutoutPercentage ? (n / 100) * i.cutoutPercentage : 1, 0)) / t.getVisibleDatasetCount();
6217 ((this.outerRadius = n - o * this.index), (this.innerRadius = this.outerRadius - o));
6218 }
6219 updateElements(t, e, i, s) {
6220 const n = "reset" === s,
6221 o = this.chart,
6222 a = o.options.animation,
6223 r = this._cachedMeta.rScale,
6224 l = r.xCenter,
6225 h = r.yCenter,
6226 c = r.getIndexAngle(0) - 0.5 * C;
6227 let d,
6228 u = c;
6229 const f = 360 / this.countVisibleElements();
6230 for (d = 0; d < e; ++d) u += this._computeAngle(d, s, f);
6231 for (d = e; d < e + i; d++) {
6232 const e = t[d];
6233 let i = u,
6234 g = u + this._computeAngle(d, s, f),
6235 p = o.getDataVisibility(d) ? r.getDistanceFromCenterForValue(this.getParsed(d).r) : 0;
6236 ((u = g), n && (a.animateScale && (p = 0), a.animateRotate && (i = g = c)));
6237 const m = {
6238 x: l,
6239 y: h,
6240 innerRadius: 0,
6241 outerRadius: p,
6242 startAngle: i,
6243 endAngle: g,
6244 options: this.resolveDataElementOptions(d, e.active ? "active" : s),
6245 };
6246 this.updateElement(e, d, m, s);
6247 }
6248 }
6249 countVisibleElements() {
6250 const t = this._cachedMeta;
6251 let e = 0;
6252 return (
6253 t.data.forEach((t, i) => {
6254 !isNaN(this.getParsed(i).r) && this.chart.getDataVisibility(i) && e++;
6255 }),
6256 e
6257 );
6258 }
6259 _computeAngle(t, e, i) {
6260 return this.chart.getDataVisibility(t) ? $(this.resolveDataElementOptions(t, e).angle || i) : 0;
6261 }
6262 }
6263 var Un = Object.freeze({
6264 __proto__: null,
6265 BarController: class extends js {
6266 static id = "bar";
6267 static defaults = {
6268 datasetElementType: !1,
6269 dataElementType: "bar",
6270 categoryPercentage: 0.8,
6271 barPercentage: 0.9,
6272 grouped: !0,
6273 animations: { numbers: { type: "number", properties: ["x", "y", "base", "width", "height"] } },
6274 };
6275 static overrides = {
6276 scales: {
6277 _index_: { type: "category", offset: !0, grid: { offset: !0 } },
6278 _value_: { type: "linear", beginAtZero: !0 },
6279 },
6280 };
6281 parsePrimitiveData(t, e, i, s) {
6282 return Vn(t, e, i, s);
6283 }
6284 parseArrayData(t, e, i, s) {
6285 return Vn(t, e, i, s);
6286 }
6287 parseObjectData(t, e, i, s) {
6288 const { iScale: n, vScale: o } = t,
6289 { xAxisKey: a = "x", yAxisKey: r = "y" } = this._parsing,
6290 l = "x" === n.axis ? a : r,
6291 h = "x" === o.axis ? a : r,
6292 c = [];
6293 let d, u, f, g;
6294 for (d = i, u = i + s; d < u; ++d)
6295 ((g = e[d]), (f = {}), (f[n.axis] = n.parse(M(g, l), d)), c.push(Fn(M(g, h), f, o, d)));
6296 return c;
6297 }
6298 updateRangeFromParsed(t, e, i, s) {
6299 super.updateRangeFromParsed(t, e, i, s);
6300 const n = i._custom;
6301 n && e === this._cachedMeta.vScale && ((t.min = Math.min(t.min, n.min)), (t.max = Math.max(t.max, n.max)));
6302 }
6303 getMaxOverflow() {
6304 return 0;
6305 }
6306 getLabelAndValue(t) {
6307 const e = this._cachedMeta,
6308 { iScale: i, vScale: s } = e,
6309 n = this.getParsed(t),
6310 o = n._custom,
6311 a = Bn(o) ? "[" + o.start + ", " + o.end + "]" : "" + s.getLabelForValue(n[s.axis]);
6312 return { label: "" + i.getLabelForValue(n[i.axis]), value: a };
6313 }
6314 initialize() {
6315 ((this.enableOptionSharing = !0), super.initialize());
6316 this._cachedMeta.stack = this.getDataset().stack;
6317 }
6318 update(t) {
6319 const e = this._cachedMeta;
6320 this.updateElements(e.data, 0, e.data.length, t);
6321 }
6322 updateElements(t, e, i, n) {
6323 const o = "reset" === n,
6324 {
6325 index: a,
6326 _cachedMeta: { vScale: r },
6327 } = this,
6328 l = r.getBasePixel(),
6329 h = r.isHorizontal(),
6330 c = this._getRuler(),
6331 { sharedOptions: d, includeOptions: u } = this._getSharedOptions(e, n);
6332 for (let f = e; f < e + i; f++) {
6333 const e = this.getParsed(f),
6334 i = o || s(e[r.axis]) ? { base: l, head: l } : this._calculateBarValuePixels(f),
6335 g = this._calculateBarIndexPixels(f, c),
6336 p = (e._stacks || {})[r.axis],
6337 m = {
6338 horizontal: h,
6339 base: i.base,
6340 enableBorderRadius: !p || Bn(e._custom) || a === p._top || a === p._bottom,
6341 x: h ? i.head : g.center,
6342 y: h ? g.center : i.head,
6343 height: h ? g.size : Math.abs(i.size),
6344 width: h ? Math.abs(i.size) : g.size,
6345 };
6346 u && (m.options = d || this.resolveDataElementOptions(f, t[f].active ? "active" : n));
6347 const x = m.options || t[f].options;
6348 (Wn(m, x, p, a), jn(m, x, c.ratio), this.updateElement(t[f], f, m, n));
6349 }
6350 }
6351 _getStacks(t, e) {
6352 const { iScale: i } = this._cachedMeta,
6353 n = i.getMatchingVisibleMetas(this._type).filter((t) => t.controller.options.grouped),
6354 o = i.options.stacked,
6355 a = [],
6356 r = this._cachedMeta.controller.getParsed(e),
6357 l = r && r[i.axis],
6358 h = (t) => {
6359 const e = t._parsed.find((t) => t[i.axis] === l),
6360 n = e && e[t.vScale.axis];
6361 if (s(n) || isNaN(n)) return !0;
6362 };
6363 for (const i of n)
6364 if (
6365 (void 0 === e || !h(i)) &&
6366 ((!1 === o || -1 === a.indexOf(i.stack) || (void 0 === o && void 0 === i.stack)) && a.push(i.stack),
6367 i.index === t)
6368 )
6369 break;
6370 return (a.length || a.push(void 0), a);
6371 }
6372 _getStackCount(t) {
6373 return this._getStacks(void 0, t).length;
6374 }
6375 _getAxisCount() {
6376 return this._getAxis().length;
6377 }
6378 getFirstScaleIdForIndexAxis() {
6379 const t = this.chart.scales,
6380 e = this.chart.options.indexAxis;
6381 return Object.keys(t)
6382 .filter((i) => t[i].axis === e)
6383 .shift();
6384 }
6385 _getAxis() {
6386 const t = {},
6387 e = this.getFirstScaleIdForIndexAxis();
6388 for (const i of this.chart.data.datasets)
6389 t[l("x" === this.chart.options.indexAxis ? i.xAxisID : i.yAxisID, e)] = !0;
6390 return Object.keys(t);
6391 }
6392 _getStackIndex(t, e, i) {
6393 const s = this._getStacks(t, i),
6394 n = void 0 !== e ? s.indexOf(e) : -1;
6395 return -1 === n ? s.length - 1 : n;
6396 }
6397 _getRuler() {
6398 const t = this.options,
6399 e = this._cachedMeta,
6400 i = e.iScale,
6401 s = [];
6402 let n, o;
6403 for (n = 0, o = e.data.length; n < o; ++n) s.push(i.getPixelForValue(this.getParsed(n)[i.axis], n));
6404 const a = t.barThickness;
6405 return {
6406 min: a || zn(e),
6407 pixels: s,
6408 start: i._startPixel,
6409 end: i._endPixel,
6410 stackCount: this._getStackCount(),
6411 scale: i,
6412 grouped: t.grouped,
6413 ratio: a ? 1 : t.categoryPercentage * t.barPercentage,
6414 };
6415 }
6416 _calculateBarValuePixels(t) {
6417 const {
6418 _cachedMeta: { vScale: e, _stacked: i, index: n },
6419 options: { base: o, minBarLength: a },
6420 } = this,
6421 r = o || 0,
6422 l = this.getParsed(t),
6423 h = l._custom,
6424 c = Bn(h);
6425 let d,
6426 u,
6427 f = l[e.axis],
6428 g = 0,
6429 p = i ? this.applyStack(e, l, i) : f;
6430 (p !== f && ((g = p - f), (p = f)),
6431 c && ((f = h.barStart), (p = h.barEnd - h.barStart), 0 !== f && F(f) !== F(h.barEnd) && (g = 0), (g += f)));
6432 const m = s(o) || c ? g : o;
6433 let x = e.getPixelForValue(m);
6434 if (((d = this.chart.getDataVisibility(t) ? e.getPixelForValue(g + p) : x), (u = d - x), Math.abs(u) < a)) {
6435 ((u =
6436 (function (t, e, i) {
6437 return 0 !== t ? F(t) : (e.isHorizontal() ? 1 : -1) * (e.min >= i ? 1 : -1);
6438 })(u, e, r) * a),
6439 f === r && (x -= u / 2));
6440 const t = e.getPixelForDecimal(0),
6441 s = e.getPixelForDecimal(1),
6442 o = Math.min(t, s),
6443 h = Math.max(t, s);
6444 ((x = Math.max(Math.min(x, h), o)),
6445 (d = x + u),
6446 i && !c && (l._stacks[e.axis]._visualValues[n] = e.getValueForPixel(d) - e.getValueForPixel(x)));
6447 }
6448 if (x === e.getPixelForValue(r)) {
6449 const t = (F(u) * e.getLineWidthForValue(r)) / 2;
6450 ((x += t), (u -= t));
6451 }
6452 return { size: u, base: x, head: d, center: d + u / 2 };
6453 }
6454 _calculateBarIndexPixels(t, e) {
6455 const i = e.scale,
6456 n = this.options,
6457 o = n.skipNull,
6458 a = l(n.maxBarThickness, 1 / 0);
6459 let r, h;
6460 const c = this._getAxisCount();
6461 if (e.grouped) {
6462 const i = o ? this._getStackCount(t) : e.stackCount,
6463 d =
6464 "flex" === n.barThickness
6465 ? (function (t, e, i, s) {
6466 const n = e.pixels,
6467 o = n[t];
6468 let a = t > 0 ? n[t - 1] : null,
6469 r = t < n.length - 1 ? n[t + 1] : null;
6470 const l = i.categoryPercentage;
6471 (null === a && (a = o - (null === r ? e.end - e.start : r - o)), null === r && (r = o + o - a));
6472 const h = o - ((o - Math.min(a, r)) / 2) * l;
6473 return { chunk: ((Math.abs(r - a) / 2) * l) / s, ratio: i.barPercentage, start: h };
6474 })(t, e, n, i * c)
6475 : (function (t, e, i, n) {
6476 const o = i.barThickness;
6477 let a, r;
6478 return (
6479 s(o) ? ((a = e.min * i.categoryPercentage), (r = i.barPercentage)) : ((a = o * n), (r = 1)),
6480 { chunk: a / n, ratio: r, start: e.pixels[t] - a / 2 }
6481 );
6482 })(t, e, n, i * c),
6483 u = "x" === this.chart.options.indexAxis ? this.getDataset().xAxisID : this.getDataset().yAxisID,
6484 f = this._getAxis().indexOf(l(u, this.getFirstScaleIdForIndexAxis())),
6485 g = this._getStackIndex(this.index, this._cachedMeta.stack, o ? t : void 0) + f;
6486 ((r = d.start + d.chunk * g + d.chunk / 2), (h = Math.min(a, d.chunk * d.ratio)));
6487 } else ((r = i.getPixelForValue(this.getParsed(t)[i.axis], t)), (h = Math.min(a, e.min * e.ratio)));
6488 return { base: r - h / 2, head: r + h / 2, center: r, size: h };
6489 }
6490 draw() {
6491 const t = this._cachedMeta,
6492 e = t.vScale,
6493 i = t.data,
6494 s = i.length;
6495 let n = 0;
6496 for (; n < s; ++n) null === this.getParsed(n)[e.axis] || i[n].hidden || i[n].draw(this._ctx);
6497 }
6498 },
6499 BubbleController: class extends js {
6500 static id = "bubble";
6501 static defaults = {
6502 datasetElementType: !1,
6503 dataElementType: "point",
6504 animations: { numbers: { type: "number", properties: ["x", "y", "borderWidth", "radius"] } },
6505 };
6506 static overrides = { scales: { x: { type: "linear" }, y: { type: "linear" } } };
6507 initialize() {
6508 ((this.enableOptionSharing = !0), super.initialize());
6509 }
6510 parsePrimitiveData(t, e, i, s) {
6511 const n = super.parsePrimitiveData(t, e, i, s);
6512 for (let t = 0; t < n.length; t++) n[t]._custom = this.resolveDataElementOptions(t + i).radius;
6513 return n;
6514 }
6515 parseArrayData(t, e, i, s) {
6516 const n = super.parseArrayData(t, e, i, s);
6517 for (let t = 0; t < n.length; t++) {
6518 const s = e[i + t];
6519 n[t]._custom = l(s[2], this.resolveDataElementOptions(t + i).radius);
6520 }
6521 return n;
6522 }
6523 parseObjectData(t, e, i, s) {
6524 const n = super.parseObjectData(t, e, i, s);
6525 for (let t = 0; t < n.length; t++) {
6526 const s = e[i + t];
6527 n[t]._custom = l(s && s.r && +s.r, this.resolveDataElementOptions(t + i).radius);
6528 }
6529 return n;
6530 }
6531 getMaxOverflow() {
6532 const t = this._cachedMeta.data;
6533 let e = 0;
6534 for (let i = t.length - 1; i >= 0; --i) e = Math.max(e, t[i].size(this.resolveDataElementOptions(i)) / 2);
6535 return e > 0 && e;
6536 }
6537 getLabelAndValue(t) {
6538 const e = this._cachedMeta,
6539 i = this.chart.data.labels || [],
6540 { xScale: s, yScale: n } = e,
6541 o = this.getParsed(t),
6542 a = s.getLabelForValue(o.x),
6543 r = n.getLabelForValue(o.y),
6544 l = o._custom;
6545 return { label: i[t] || "", value: "(" + a + ", " + r + (l ? ", " + l : "") + ")" };
6546 }
6547 update(t) {
6548 const e = this._cachedMeta.data;
6549 this.updateElements(e, 0, e.length, t);
6550 }
6551 updateElements(t, e, i, s) {
6552 const n = "reset" === s,
6553 { iScale: o, vScale: a } = this._cachedMeta,
6554 { sharedOptions: r, includeOptions: l } = this._getSharedOptions(e, s),
6555 h = o.axis,
6556 c = a.axis;
6557 for (let d = e; d < e + i; d++) {
6558 const e = t[d],
6559 i = !n && this.getParsed(d),
6560 u = {},
6561 f = (u[h] = n ? o.getPixelForDecimal(0.5) : o.getPixelForValue(i[h])),
6562 g = (u[c] = n ? a.getBasePixel() : a.getPixelForValue(i[c]));
6563 ((u.skip = isNaN(f) || isNaN(g)),
6564 l &&
6565 ((u.options = r || this.resolveDataElementOptions(d, e.active ? "active" : s)),
6566 n && (u.options.radius = 0)),
6567 this.updateElement(e, d, u, s));
6568 }
6569 }
6570 resolveDataElementOptions(t, e) {
6571 const i = this.getParsed(t);
6572 let s = super.resolveDataElementOptions(t, e);
6573 s.$shared && (s = Object.assign({}, s, { $shared: !1 }));
6574 const n = s.radius;
6575 return ("active" !== e && (s.radius = 0), (s.radius += l(i && i._custom, n)), s);
6576 }
6577 },
6578 DoughnutController: $n,
6579 LineController: class extends js {
6580 static id = "line";
6581 static defaults = { datasetElementType: "line", dataElementType: "point", showLine: !0, spanGaps: !1 };
6582 static overrides = { scales: { _index_: { type: "category" }, _value_: { type: "linear" } } };
6583 initialize() {
6584 ((this.enableOptionSharing = !0), (this.supportsDecimation = !0), super.initialize());
6585 }
6586 update(t) {
6587 const e = this._cachedMeta,
6588 { dataset: i, data: s = [], _dataset: n } = e,
6589 o = this.chart._animationsDisabled;
6590 let { start: a, count: r } = pt(e, s, o);
6591 ((this._drawStart = a),
6592 (this._drawCount = r),
6593 mt(e) && ((a = 0), (r = s.length)),
6594 (i._chart = this.chart),
6595 (i._datasetIndex = this.index),
6596 (i._decimated = !!n._decimated),
6597 (i.points = s));
6598 const l = this.resolveDatasetElementOptions(t);
6599 (this.options.showLine || (l.borderWidth = 0),
6600 (l.segment = this.options.segment),
6601 this.updateElement(i, void 0, { animated: !o, options: l }, t),
6602 this.updateElements(s, a, r, t));
6603 }
6604 updateElements(t, e, i, n) {
6605 const o = "reset" === n,
6606 { iScale: a, vScale: r, _stacked: l, _dataset: h } = this._cachedMeta,
6607 { sharedOptions: c, includeOptions: d } = this._getSharedOptions(e, n),
6608 u = a.axis,
6609 f = r.axis,
6610 { spanGaps: g, segment: p } = this.options,
6611 m = N(g) ? g : Number.POSITIVE_INFINITY,
6612 x = this.chart._animationsDisabled || o || "none" === n,
6613 b = e + i,
6614 _ = t.length;
6615 let y = e > 0 && this.getParsed(e - 1);
6616 for (let i = 0; i < _; ++i) {
6617 const g = t[i],
6618 _ = x ? g : {};
6619 if (i < e || i >= b) {
6620 _.skip = !0;
6621 continue;
6622 }
6623 const v = this.getParsed(i),
6624 M = s(v[f]),
6625 w = (_[u] = a.getPixelForValue(v[u], i)),
6626 k = (_[f] = o || M ? r.getBasePixel() : r.getPixelForValue(l ? this.applyStack(r, v, l) : v[f], i));
6627 ((_.skip = isNaN(w) || isNaN(k) || M),
6628 (_.stop = i > 0 && Math.abs(v[u] - y[u]) > m),
6629 p && ((_.parsed = v), (_.raw = h.data[i])),
6630 d && (_.options = c || this.resolveDataElementOptions(i, g.active ? "active" : n)),
6631 x || this.updateElement(g, i, _, n),
6632 (y = v));
6633 }
6634 }
6635 getMaxOverflow() {
6636 const t = this._cachedMeta,
6637 e = t.dataset,
6638 i = (e.options && e.options.borderWidth) || 0,
6639 s = t.data || [];
6640 if (!s.length) return i;
6641 const n = s[0].size(this.resolveDataElementOptions(0)),
6642 o = s[s.length - 1].size(this.resolveDataElementOptions(s.length - 1));
6643 return Math.max(i, n, o) / 2;
6644 }
6645 draw() {
6646 const t = this._cachedMeta;
6647 (t.dataset.updateControlPoints(this.chart.chartArea, t.iScale.axis), super.draw());
6648 }
6649 },
6650 PieController: class extends $n {
6651 static id = "pie";
6652 static defaults = { cutout: 0, rotation: 0, circumference: 360, radius: "100%" };
6653 },
6654 PolarAreaController: Yn,
6655 RadarController: class extends js {
6656 static id = "radar";
6657 static defaults = {
6658 datasetElementType: "line",
6659 dataElementType: "point",
6660 indexAxis: "r",
6661 showLine: !0,
6662 elements: { line: { fill: "start" } },
6663 };
6664 static overrides = { aspectRatio: 1, scales: { r: { type: "radialLinear" } } };
6665 getLabelAndValue(t) {
6666 const e = this._cachedMeta.vScale,
6667 i = this.getParsed(t);
6668 return { label: e.getLabels()[t], value: "" + e.getLabelForValue(i[e.axis]) };
6669 }
6670 parseObjectData(t, e, i, s) {
6671 return ii.bind(this)(t, e, i, s);
6672 }
6673 update(t) {
6674 const e = this._cachedMeta,
6675 i = e.dataset,
6676 s = e.data || [],
6677 n = e.iScale.getLabels();
6678 if (((i.points = s), "resize" !== t)) {
6679 const e = this.resolveDatasetElementOptions(t);
6680 this.options.showLine || (e.borderWidth = 0);
6681 const o = { _loop: !0, _fullLoop: n.length === s.length, options: e };
6682 this.updateElement(i, void 0, o, t);
6683 }
6684 this.updateElements(s, 0, s.length, t);
6685 }
6686 updateElements(t, e, i, s) {
6687 const n = this._cachedMeta.rScale,
6688 o = "reset" === s;
6689 for (let a = e; a < e + i; a++) {
6690 const e = t[a],
6691 i = this.resolveDataElementOptions(a, e.active ? "active" : s),
6692 r = n.getPointPositionForValue(a, this.getParsed(a).r),
6693 l = o ? n.xCenter : r.x,
6694 h = o ? n.yCenter : r.y,
6695 c = { x: l, y: h, angle: r.angle, skip: isNaN(l) || isNaN(h), options: i };
6696 this.updateElement(e, a, c, s);
6697 }
6698 }
6699 },
6700 ScatterController: class extends js {
6701 static id = "scatter";
6702 static defaults = { datasetElementType: !1, dataElementType: "point", showLine: !1, fill: !1 };
6703 static overrides = { interaction: { mode: "point" }, scales: { x: { type: "linear" }, y: { type: "linear" } } };
6704 getLabelAndValue(t) {
6705 const e = this._cachedMeta,
6706 i = this.chart.data.labels || [],
6707 { xScale: s, yScale: n } = e,
6708 o = this.getParsed(t),
6709 a = s.getLabelForValue(o.x),
6710 r = n.getLabelForValue(o.y);
6711 return { label: i[t] || "", value: "(" + a + ", " + r + ")" };
6712 }
6713 update(t) {
6714 const e = this._cachedMeta,
6715 { data: i = [] } = e,
6716 s = this.chart._animationsDisabled;
6717 let { start: n, count: o } = pt(e, i, s);
6718 if (((this._drawStart = n), (this._drawCount = o), mt(e) && ((n = 0), (o = i.length)), this.options.showLine)) {
6719 this.datasetElementType || this.addElements();
6720 const { dataset: n, _dataset: o } = e;
6721 ((n._chart = this.chart), (n._datasetIndex = this.index), (n._decimated = !!o._decimated), (n.points = i));
6722 const a = this.resolveDatasetElementOptions(t);
6723 ((a.segment = this.options.segment), this.updateElement(n, void 0, { animated: !s, options: a }, t));
6724 } else this.datasetElementType && (delete e.dataset, (this.datasetElementType = !1));
6725 this.updateElements(i, n, o, t);
6726 }
6727 addElements() {
6728 const { showLine: t } = this.options;
6729 (!this.datasetElementType && t && (this.datasetElementType = this.chart.registry.getElement("line")),
6730 super.addElements());
6731 }
6732 updateElements(t, e, i, n) {
6733 const o = "reset" === n,
6734 { iScale: a, vScale: r, _stacked: l, _dataset: h } = this._cachedMeta,
6735 c = this.resolveDataElementOptions(e, n),
6736 d = this.getSharedOptions(c),
6737 u = this.includeOptions(n, d),
6738 f = a.axis,
6739 g = r.axis,
6740 { spanGaps: p, segment: m } = this.options,
6741 x = N(p) ? p : Number.POSITIVE_INFINITY,
6742 b = this.chart._animationsDisabled || o || "none" === n;
6743 let _ = e > 0 && this.getParsed(e - 1);
6744 for (let c = e; c < e + i; ++c) {
6745 const e = t[c],
6746 i = this.getParsed(c),
6747 p = b ? e : {},
6748 y = s(i[g]),
6749 v = (p[f] = a.getPixelForValue(i[f], c)),
6750 M = (p[g] = o || y ? r.getBasePixel() : r.getPixelForValue(l ? this.applyStack(r, i, l) : i[g], c));
6751 ((p.skip = isNaN(v) || isNaN(M) || y),
6752 (p.stop = c > 0 && Math.abs(i[f] - _[f]) > x),
6753 m && ((p.parsed = i), (p.raw = h.data[c])),
6754 u && (p.options = d || this.resolveDataElementOptions(c, e.active ? "active" : n)),
6755 b || this.updateElement(e, c, p, n),
6756 (_ = i));
6757 }
6758 this.updateSharedOptions(d, n, c);
6759 }
6760 getMaxOverflow() {
6761 const t = this._cachedMeta,
6762 e = t.data || [];
6763 if (!this.options.showLine) {
6764 let t = 0;
6765 for (let i = e.length - 1; i >= 0; --i) t = Math.max(t, e[i].size(this.resolveDataElementOptions(i)) / 2);
6766 return t > 0 && t;
6767 }
6768 const i = t.dataset,
6769 s = (i.options && i.options.borderWidth) || 0;
6770 if (!e.length) return s;
6771 const n = e[0].size(this.resolveDataElementOptions(0)),
6772 o = e[e.length - 1].size(this.resolveDataElementOptions(e.length - 1));
6773 return Math.max(s, n, o) / 2;
6774 }
6775 },
6776 });
6777 function Xn(t, e, i, s) {
6778 const n = vi(t.options.borderRadius, ["outerStart", "outerEnd", "innerStart", "innerEnd"]);
6779 const o = (i - e) / 2,
6780 a = Math.min(o, (s * e) / 2),
6781 r = (t) => {
6782 const e = ((i - Math.min(o, t)) * s) / 2;
6783 return Z(t, 0, Math.min(o, e));
6784 };
6785 return {
6786 outerStart: r(n.outerStart),
6787 outerEnd: r(n.outerEnd),
6788 innerStart: Z(n.innerStart, 0, a),
6789 innerEnd: Z(n.innerEnd, 0, a),
6790 };
6791 }
6792 function qn(t, e, i, s) {
6793 return { x: i + t * Math.cos(e), y: s + t * Math.sin(e) };
6794 }
6795 function Kn(t, e, i, s, n, o) {
6796 const { x: a, y: r, startAngle: l, pixelMargin: h, innerRadius: c } = e,
6797 d = Math.max(e.outerRadius + s + i - h, 0),
6798 u = c > 0 ? c + s + i + h : 0;
6799 let f = 0;
6800 const g = n - l;
6801 if (s) {
6802 const t = ((c > 0 ? c - s : 0) + (d > 0 ? d - s : 0)) / 2;
6803 f = (g - (0 !== t ? (g * t) / (t + s) : g)) / 2;
6804 }
6805 const p = (g - Math.max(0.001, g * d - i / C) / d) / 2,
6806 m = l + p + f,
6807 x = n - p - f,
6808 { outerStart: b, outerEnd: _, innerStart: y, innerEnd: v } = Xn(e, u, d, x - m),
6809 M = d - b,
6810 w = d - _,
6811 k = m + b / M,
6812 S = x - _ / w,
6813 P = u + y,
6814 D = u + v,
6815 O = m + y / P,
6816 A = x - v / D;
6817 if ((t.beginPath(), o)) {
6818 const e = (k + S) / 2;
6819 if ((t.arc(a, r, d, k, e), t.arc(a, r, d, e, S), _ > 0)) {
6820 const e = qn(w, S, a, r);
6821 t.arc(e.x, e.y, _, S, x + E);
6822 }
6823 const i = qn(D, x, a, r);
6824 if ((t.lineTo(i.x, i.y), v > 0)) {
6825 const e = qn(D, A, a, r);
6826 t.arc(e.x, e.y, v, x + E, A + Math.PI);
6827 }
6828 const s = (x - v / u + (m + y / u)) / 2;
6829 if ((t.arc(a, r, u, x - v / u, s, !0), t.arc(a, r, u, s, m + y / u, !0), y > 0)) {
6830 const e = qn(P, O, a, r);
6831 t.arc(e.x, e.y, y, O + Math.PI, m - E);
6832 }
6833 const n = qn(M, m, a, r);
6834 if ((t.lineTo(n.x, n.y), b > 0)) {
6835 const e = qn(M, k, a, r);
6836 t.arc(e.x, e.y, b, m - E, k);
6837 }
6838 } else {
6839 t.moveTo(a, r);
6840 const e = Math.cos(k) * d + a,
6841 i = Math.sin(k) * d + r;
6842 t.lineTo(e, i);
6843 const s = Math.cos(S) * d + a,
6844 n = Math.sin(S) * d + r;
6845 t.lineTo(s, n);
6846 }
6847 t.closePath();
6848 }
6849 function Gn(t, e, i, s, n) {
6850 const { fullCircles: o, startAngle: a, circumference: r, options: l } = e,
6851 { borderWidth: h, borderJoinStyle: c, borderDash: d, borderDashOffset: u, borderRadius: f } = l,
6852 g = "inner" === l.borderAlign;
6853 if (!h) return;
6854 (t.setLineDash(d || []),
6855 (t.lineDashOffset = u),
6856 g ? ((t.lineWidth = 2 * h), (t.lineJoin = c || "round")) : ((t.lineWidth = h), (t.lineJoin = c || "bevel")));
6857 let p = e.endAngle;
6858 if (o) {
6859 Kn(t, e, i, s, p, n);
6860 for (let e = 0; e < o; ++e) t.stroke();
6861 isNaN(r) || (p = a + (r % O || O));
6862 }
6863 (g &&
6864 (function (t, e, i) {
6865 const { startAngle: s, pixelMargin: n, x: o, y: a, outerRadius: r, innerRadius: l } = e;
6866 let h = n / r;
6867 (t.beginPath(),
6868 t.arc(o, a, r, s - h, i + h),
6869 l > n ? ((h = n / l), t.arc(o, a, l, i + h, s - h, !0)) : t.arc(o, a, n, i + E, s - E),
6870 t.closePath(),
6871 t.clip());
6872 })(t, e, p),
6873 l.selfJoin &&
6874 p - a >= C &&
6875 0 === f &&
6876 "miter" !== c &&
6877 (function (t, e, i) {
6878 const { startAngle: s, x: n, y: o, outerRadius: a, innerRadius: r, options: l } = e,
6879 { borderWidth: h, borderJoinStyle: c } = l,
6880 d = Math.min(h / a, G(s - i));
6881 if ((t.beginPath(), t.arc(n, o, a - h / 2, s + d / 2, i - d / 2), r > 0)) {
6882 const e = Math.min(h / r, G(s - i));
6883 t.arc(n, o, r + h / 2, i - e / 2, s + e / 2, !0);
6884 } else {
6885 const e = Math.min(h / 2, a * G(s - i));
6886 if ("round" === c) t.arc(n, o, e, i - C / 2, s + C / 2, !0);
6887 else if ("bevel" === c) {
6888 const a = 2 * e * e,
6889 r = -a * Math.cos(i + C / 2) + n,
6890 l = -a * Math.sin(i + C / 2) + o,
6891 h = a * Math.cos(s + C / 2) + n,
6892 c = a * Math.sin(s + C / 2) + o;
6893 (t.lineTo(r, l), t.lineTo(h, c));
6894 }
6895 }
6896 (t.closePath(), t.moveTo(0, 0), t.rect(0, 0, t.canvas.width, t.canvas.height), t.clip("evenodd"));
6897 })(t, e, p),
6898 o || (Kn(t, e, i, s, p, n), t.stroke()));
6899 }
6900 function Jn(t, e, i = e) {
6901 ((t.lineCap = l(i.borderCapStyle, e.borderCapStyle)),
6902 t.setLineDash(l(i.borderDash, e.borderDash)),
6903 (t.lineDashOffset = l(i.borderDashOffset, e.borderDashOffset)),
6904 (t.lineJoin = l(i.borderJoinStyle, e.borderJoinStyle)),
6905 (t.lineWidth = l(i.borderWidth, e.borderWidth)),
6906 (t.strokeStyle = l(i.borderColor, e.borderColor)));
6907 }
6908 function Zn(t, e, i) {
6909 t.lineTo(i.x, i.y);
6910 }
6911 function Qn(t, e, i = {}) {
6912 const s = t.length,
6913 { start: n = 0, end: o = s - 1 } = i,
6914 { start: a, end: r } = e,
6915 l = Math.max(n, a),
6916 h = Math.min(o, r),
6917 c = (n < a && o < a) || (n > r && o > r);
6918 return { count: s, start: l, loop: e.loop, ilen: h < l && !c ? s + h - l : h - l };
6919 }
6920 function to(t, e, i, s) {
6921 const { points: n, options: o } = e,
6922 { count: a, start: r, loop: l, ilen: h } = Qn(n, i, s),
6923 c = (function (t) {
6924 return t.stepped ? Fe : t.tension || "monotone" === t.cubicInterpolationMode ? Ve : Zn;
6925 })(o);
6926 let d,
6927 u,
6928 f,
6929 { move: g = !0, reverse: p } = s || {};
6930 for (d = 0; d <= h; ++d)
6931 ((u = n[(r + (p ? h - d : d)) % a]),
6932 u.skip || (g ? (t.moveTo(u.x, u.y), (g = !1)) : c(t, f, u, p, o.stepped), (f = u)));
6933 return (l && ((u = n[(r + (p ? h : 0)) % a]), c(t, f, u, p, o.stepped)), !!l);
6934 }
6935 function eo(t, e, i, s) {
6936 const n = e.points,
6937 { count: o, start: a, ilen: r } = Qn(n, i, s),
6938 { move: l = !0, reverse: h } = s || {};
6939 let c,
6940 d,
6941 u,
6942 f,
6943 g,
6944 p,
6945 m = 0,
6946 x = 0;
6947 const b = (t) => (a + (h ? r - t : t)) % o,
6948 _ = () => {
6949 f !== g && (t.lineTo(m, g), t.lineTo(m, f), t.lineTo(m, p));
6950 };
6951 for (l && ((d = n[b(0)]), t.moveTo(d.x, d.y)), c = 0; c <= r; ++c) {
6952 if (((d = n[b(c)]), d.skip)) continue;
6953 const e = d.x,
6954 i = d.y,
6955 s = 0 | e;
6956 (s === u
6957 ? (i < f ? (f = i) : i > g && (g = i), (m = (x * m + e) / ++x))
6958 : (_(), t.lineTo(e, i), (u = s), (x = 0), (f = g = i)),
6959 (p = i));
6960 }
6961 _();
6962 }
6963 function io(t) {
6964 const e = t.options,
6965 i = e.borderDash && e.borderDash.length;
6966 return !(t._decimated || t._loop || e.tension || "monotone" === e.cubicInterpolationMode || e.stepped || i)
6967 ? eo
6968 : to;
6969 }
6970 const so = "function" == typeof Path2D;
6971 function no(t, e, i, s) {
6972 so && !e.options.segment
6973 ? (function (t, e, i, s) {
6974 let n = e._path;
6975 (n || ((n = e._path = new Path2D()), e.path(n, i, s) && n.closePath()), Jn(t, e.options), t.stroke(n));
6976 })(t, e, i, s)
6977 : (function (t, e, i, s) {
6978 const { segments: n, options: o } = e,
6979 a = io(e);
6980 for (const r of n)
6981 (Jn(t, o, r.style), t.beginPath(), a(t, e, r, { start: i, end: i + s - 1 }) && t.closePath(), t.stroke());
6982 })(t, e, i, s);
6983 }
6984 class oo extends $s {
6985 static id = "line";
6986 static defaults = {
6987 borderCapStyle: "butt",
6988 borderDash: [],
6989 borderDashOffset: 0,
6990 borderJoinStyle: "miter",
6991 borderWidth: 3,
6992 capBezierPoints: !0,
6993 cubicInterpolationMode: "default",
6994 fill: !1,
6995 spanGaps: !1,
6996 stepped: !1,
6997 tension: 0,
6998 };
6999 static defaultRoutes = { backgroundColor: "backgroundColor", borderColor: "borderColor" };
7000 static descriptors = { _scriptable: !0, _indexable: (t) => "borderDash" !== t && "fill" !== t };
7001 constructor(t) {
7002 (super(),
7003 (this.animated = !0),
7004 (this.options = void 0),
7005 (this._chart = void 0),
7006 (this._loop = void 0),
7007 (this._fullLoop = void 0),
7008 (this._path = void 0),
7009 (this._points = void 0),
7010 (this._segments = void 0),
7011 (this._decimated = !1),
7012 (this._pointsUpdated = !1),
7013 (this._datasetIndex = void 0),
7014 t && Object.assign(this, t));
7015 }
7016 updateControlPoints(t, e) {
7017 const i = this.options;
7018 if ((i.tension || "monotone" === i.cubicInterpolationMode) && !i.stepped && !this._pointsUpdated) {
7019 const s = i.spanGaps ? this._loop : this._fullLoop;
7020 (hi(this._points, i, t, s, e), (this._pointsUpdated = !0));
7021 }
7022 }
7023 set points(t) {
7024 ((this._points = t), delete this._segments, delete this._path, (this._pointsUpdated = !1));
7025 }
7026 get points() {
7027 return this._points;
7028 }
7029 get segments() {
7030 return this._segments || (this._segments = zi(this, this.options.segment));
7031 }
7032 first() {
7033 const t = this.segments,
7034 e = this.points;
7035 return t.length && e[t[0].start];
7036 }
7037 last() {
7038 const t = this.segments,
7039 e = this.points,
7040 i = t.length;
7041 return i && e[t[i - 1].end];
7042 }
7043 interpolate(t, e) {
7044 const i = this.options,
7045 s = t[e],
7046 n = this.points,
7047 o = Ii(this, { property: e, start: s, end: s });
7048 if (!o.length) return;
7049 const a = [],
7050 r = (function (t) {
7051 return t.stepped ? pi : t.tension || "monotone" === t.cubicInterpolationMode ? mi : gi;
7052 })(i);
7053 let l, h;
7054 for (l = 0, h = o.length; l < h; ++l) {
7055 const { start: h, end: c } = o[l],
7056 d = n[h],
7057 u = n[c];
7058 if (d === u) {
7059 a.push(d);
7060 continue;
7061 }
7062 const f = r(d, u, Math.abs((s - d[e]) / (u[e] - d[e])), i.stepped);
7063 ((f[e] = t[e]), a.push(f));
7064 }
7065 return 1 === a.length ? a[0] : a;
7066 }
7067 pathSegment(t, e, i) {
7068 return io(this)(t, this, e, i);
7069 }
7070 path(t, e, i) {
7071 const s = this.segments,
7072 n = io(this);
7073 let o = this._loop;
7074 ((e = e || 0), (i = i || this.points.length - e));
7075 for (const a of s) o &= n(t, this, a, { start: e, end: e + i - 1 });
7076 return !!o;
7077 }
7078 draw(t, e, i, s) {
7079 const n = this.options || {};
7080 ((this.points || []).length && n.borderWidth && (t.save(), no(t, this, i, s), t.restore()),
7081 this.animated && ((this._pointsUpdated = !1), (this._path = void 0)));
7082 }
7083 }
7084 function ao(t, e, i, s) {
7085 const n = t.options,
7086 { [i]: o } = t.getProps([i], s);
7087 return Math.abs(e - o) < n.radius + n.hitRadius;
7088 }
7089 function ro(t, e) {
7090 const { x: i, y: s, base: n, width: o, height: a } = t.getProps(["x", "y", "base", "width", "height"], e);
7091 let r, l, h, c, d;
7092 return (
7093 t.horizontal
7094 ? ((d = a / 2), (r = Math.min(i, n)), (l = Math.max(i, n)), (h = s - d), (c = s + d))
7095 : ((d = o / 2), (r = i - d), (l = i + d), (h = Math.min(s, n)), (c = Math.max(s, n))),
7096 { left: r, top: h, right: l, bottom: c }
7097 );
7098 }
7099 function lo(t, e, i, s) {
7100 return t ? 0 : Z(e, i, s);
7101 }
7102 function ho(t) {
7103 const e = ro(t),
7104 i = e.right - e.left,
7105 s = e.bottom - e.top,
7106 n = (function (t, e, i) {
7107 const s = t.options.borderWidth,
7108 n = t.borderSkipped,
7109 o = Mi(s);
7110 return {
7111 t: lo(n.top, o.top, 0, i),
7112 r: lo(n.right, o.right, 0, e),
7113 b: lo(n.bottom, o.bottom, 0, i),
7114 l: lo(n.left, o.left, 0, e),
7115 };
7116 })(t, i / 2, s / 2),
7117 a = (function (t, e, i) {
7118 const { enableBorderRadius: s } = t.getProps(["enableBorderRadius"]),
7119 n = t.options.borderRadius,
7120 a = wi(n),
7121 r = Math.min(e, i),
7122 l = t.borderSkipped,
7123 h = s || o(n);
7124 return {
7125 topLeft: lo(!h || l.top || l.left, a.topLeft, 0, r),
7126 topRight: lo(!h || l.top || l.right, a.topRight, 0, r),
7127 bottomLeft: lo(!h || l.bottom || l.left, a.bottomLeft, 0, r),
7128 bottomRight: lo(!h || l.bottom || l.right, a.bottomRight, 0, r),
7129 };
7130 })(t, i / 2, s / 2);
7131 return {
7132 outer: { x: e.left, y: e.top, w: i, h: s, radius: a },
7133 inner: {
7134 x: e.left + n.l,
7135 y: e.top + n.t,
7136 w: i - n.l - n.r,
7137 h: s - n.t - n.b,
7138 radius: {
7139 topLeft: Math.max(0, a.topLeft - Math.max(n.t, n.l)),
7140 topRight: Math.max(0, a.topRight - Math.max(n.t, n.r)),
7141 bottomLeft: Math.max(0, a.bottomLeft - Math.max(n.b, n.l)),
7142 bottomRight: Math.max(0, a.bottomRight - Math.max(n.b, n.r)),
7143 },
7144 },
7145 };
7146 }
7147 function co(t, e, i, s) {
7148 const n = null === e,
7149 o = null === i,
7150 a = t && !(n && o) && ro(t, s);
7151 return a && (n || tt(e, a.left, a.right)) && (o || tt(i, a.top, a.bottom));
7152 }
7153 function uo(t, e) {
7154 t.rect(e.x, e.y, e.w, e.h);
7155 }
7156 function fo(t, e, i = {}) {
7157 const s = t.x !== i.x ? -e : 0,
7158 n = t.y !== i.y ? -e : 0,
7159 o = (t.x + t.w !== i.x + i.w ? e : 0) - s,
7160 a = (t.y + t.h !== i.y + i.h ? e : 0) - n;
7161 return { x: t.x + s, y: t.y + n, w: t.w + o, h: t.h + a, radius: t.radius };
7162 }
7163 var go = Object.freeze({
7164 __proto__: null,
7165 ArcElement: class extends $s {
7166 static id = "arc";
7167 static defaults = {
7168 borderAlign: "center",
7169 borderColor: "#fff",
7170 borderDash: [],
7171 borderDashOffset: 0,
7172 borderJoinStyle: void 0,
7173 borderRadius: 0,
7174 borderWidth: 2,
7175 offset: 0,
7176 spacing: 0,
7177 angle: void 0,
7178 circular: !0,
7179 selfJoin: !1,
7180 };
7181 static defaultRoutes = { backgroundColor: "backgroundColor" };
7182 static descriptors = { _scriptable: !0, _indexable: (t) => "borderDash" !== t };
7183 circumference;
7184 endAngle;
7185 fullCircles;
7186 innerRadius;
7187 outerRadius;
7188 pixelMargin;
7189 startAngle;
7190 constructor(t) {
7191 (super(),
7192 (this.options = void 0),
7193 (this.circumference = void 0),
7194 (this.startAngle = void 0),
7195 (this.endAngle = void 0),
7196 (this.innerRadius = void 0),
7197 (this.outerRadius = void 0),
7198 (this.pixelMargin = 0),
7199 (this.fullCircles = 0),
7200 t && Object.assign(this, t));
7201 }
7202 inRange(t, e, i) {
7203 const s = this.getProps(["x", "y"], i),
7204 { angle: n, distance: o } = X(s, { x: t, y: e }),
7205 {
7206 startAngle: a,
7207 endAngle: r,
7208 innerRadius: h,
7209 outerRadius: c,
7210 circumference: d,
7211 } = this.getProps(["startAngle", "endAngle", "innerRadius", "outerRadius", "circumference"], i),
7212 u = (this.options.spacing + this.options.borderWidth) / 2,
7213 f = l(d, r - a),
7214 g = J(n, a, r) && a !== r,
7215 p = f >= O || g,
7216 m = tt(o, h + u, c + u);
7217 return p && m;
7218 }
7219 getCenterPoint(t) {
7220 const {
7221 x: e,
7222 y: i,
7223 startAngle: s,
7224 endAngle: n,
7225 innerRadius: o,
7226 outerRadius: a,
7227 } = this.getProps(["x", "y", "startAngle", "endAngle", "innerRadius", "outerRadius"], t),
7228 { offset: r, spacing: l } = this.options,
7229 h = (s + n) / 2,
7230 c = (o + a + l + r) / 2;
7231 return { x: e + Math.cos(h) * c, y: i + Math.sin(h) * c };
7232 }
7233 tooltipPosition(t) {
7234 return this.getCenterPoint(t);
7235 }
7236 draw(t) {
7237 const { options: e, circumference: i } = this,
7238 s = (e.offset || 0) / 4,
7239 n = (e.spacing || 0) / 2,
7240 o = e.circular;
7241 if (
7242 ((this.pixelMargin = "inner" === e.borderAlign ? 0.33 : 0),
7243 (this.fullCircles = i > O ? Math.floor(i / O) : 0),
7244 0 === i || this.innerRadius < 0 || this.outerRadius < 0)
7245 )
7246 return;
7247 t.save();
7248 const a = (this.startAngle + this.endAngle) / 2;
7249 t.translate(Math.cos(a) * s, Math.sin(a) * s);
7250 const r = s * (1 - Math.sin(Math.min(C, i || 0)));
7251 ((t.fillStyle = e.backgroundColor),
7252 (t.strokeStyle = e.borderColor),
7253 (function (t, e, i, s, n) {
7254 const { fullCircles: o, startAngle: a, circumference: r } = e;
7255 let l = e.endAngle;
7256 if (o) {
7257 Kn(t, e, i, s, l, n);
7258 for (let e = 0; e < o; ++e) t.fill();
7259 isNaN(r) || (l = a + (r % O || O));
7260 }
7261 (Kn(t, e, i, s, l, n), t.fill());
7262 })(t, this, r, n, o),
7263 Gn(t, this, r, n, o),
7264 t.restore());
7265 }
7266 },
7267 BarElement: class extends $s {
7268 static id = "bar";
7269 static defaults = {
7270 borderSkipped: "start",
7271 borderWidth: 0,
7272 borderRadius: 0,
7273 inflateAmount: "auto",
7274 pointStyle: void 0,
7275 };
7276 static defaultRoutes = { backgroundColor: "backgroundColor", borderColor: "borderColor" };
7277 constructor(t) {
7278 (super(),
7279 (this.options = void 0),
7280 (this.horizontal = void 0),
7281 (this.base = void 0),
7282 (this.width = void 0),
7283 (this.height = void 0),
7284 (this.inflateAmount = void 0),
7285 t && Object.assign(this, t));
7286 }
7287 draw(t) {
7288 const {
7289 inflateAmount: e,
7290 options: { borderColor: i, backgroundColor: s },
7291 } = this,
7292 { inner: n, outer: o } = ho(this),
7293 a = (r = o.radius).topLeft || r.topRight || r.bottomLeft || r.bottomRight ? He : uo;
7294 var r;
7295 (t.save(),
7296 (o.w === n.w && o.h === n.h) ||
7297 (t.beginPath(), a(t, fo(o, e, n)), t.clip(), a(t, fo(n, -e, o)), (t.fillStyle = i), t.fill("evenodd")),
7298 t.beginPath(),
7299 a(t, fo(n, e)),
7300 (t.fillStyle = s),
7301 t.fill(),
7302 t.restore());
7303 }
7304 inRange(t, e, i) {
7305 return co(this, t, e, i);
7306 }
7307 inXRange(t, e) {
7308 return co(this, t, null, e);
7309 }
7310 inYRange(t, e) {
7311 return co(this, null, t, e);
7312 }
7313 getCenterPoint(t) {
7314 const { x: e, y: i, base: s, horizontal: n } = this.getProps(["x", "y", "base", "horizontal"], t);
7315 return { x: n ? (e + s) / 2 : e, y: n ? i : (i + s) / 2 };
7316 }
7317 getRange(t) {
7318 return "x" === t ? this.width / 2 : this.height / 2;
7319 }
7320 },
7321 LineElement: oo,
7322 PointElement: class extends $s {
7323 static id = "point";
7324 parsed;
7325 skip;
7326 stop;
7327 static defaults = {
7328 borderWidth: 1,
7329 hitRadius: 1,
7330 hoverBorderWidth: 1,
7331 hoverRadius: 4,
7332 pointStyle: "circle",
7333 radius: 3,
7334 rotation: 0,
7335 };
7336 static defaultRoutes = { backgroundColor: "backgroundColor", borderColor: "borderColor" };
7337 constructor(t) {
7338 (super(),
7339 (this.options = void 0),
7340 (this.parsed = void 0),
7341 (this.skip = void 0),
7342 (this.stop = void 0),
7343 t && Object.assign(this, t));
7344 }
7345 inRange(t, e, i) {
7346 const s = this.options,
7347 { x: n, y: o } = this.getProps(["x", "y"], i);
7348 return Math.pow(t - n, 2) + Math.pow(e - o, 2) < Math.pow(s.hitRadius + s.radius, 2);
7349 }
7350 inXRange(t, e) {
7351 return ao(this, t, "x", e);
7352 }
7353 inYRange(t, e) {
7354 return ao(this, t, "y", e);
7355 }
7356 getCenterPoint(t) {
7357 const { x: e, y: i } = this.getProps(["x", "y"], t);
7358 return { x: e, y: i };
7359 }
7360 size(t) {
7361 let e = (t = t || this.options || {}).radius || 0;
7362 e = Math.max(e, (e && t.hoverRadius) || 0);
7363 return 2 * (e + ((e && t.borderWidth) || 0));
7364 }
7365 draw(t, e) {
7366 const i = this.options;
7367 this.skip ||
7368 i.radius < 0.1 ||
7369 !Re(this, e, this.size(i) / 2) ||
7370 ((t.strokeStyle = i.borderColor),
7371 (t.lineWidth = i.borderWidth),
7372 (t.fillStyle = i.backgroundColor),
7373 Le(t, i, this.x, this.y));
7374 }
7375 getRange() {
7376 const t = this.options || {};
7377 return t.radius + t.hitRadius;
7378 }
7379 },
7380 });
7381 function po(t, e, i, s) {
7382 const n = t.indexOf(e);
7383 if (-1 === n)
7384 return ((t, e, i, s) => (
7385 "string" == typeof e ? ((i = t.push(e) - 1), s.unshift({ index: i, label: e })) : isNaN(e) && (i = null),
7386 i
7387 ))(t, e, i, s);
7388 return n !== t.lastIndexOf(e) ? i : n;
7389 }
7390 function mo(t) {
7391 const e = this.getLabels();
7392 return t >= 0 && t < e.length ? e[t] : t;
7393 }
7394 function xo(t, e, { horizontal: i, minRotation: s }) {
7395 const n = $(s),
7396 o = (i ? Math.sin(n) : Math.cos(n)) || 0.001,
7397 a = 0.75 * e * ("" + t).length;
7398 return Math.min(e / o, a);
7399 }
7400 class bo extends tn {
7401 constructor(t) {
7402 (super(t),
7403 (this.start = void 0),
7404 (this.end = void 0),
7405 (this._startValue = void 0),
7406 (this._endValue = void 0),
7407 (this._valueRange = 0));
7408 }
7409 parse(t, e) {
7410 return s(t) || (("number" == typeof t || t instanceof Number) && !isFinite(+t)) ? null : +t;
7411 }
7412 handleTickRangeOptions() {
7413 const { beginAtZero: t } = this.options,
7414 { minDefined: e, maxDefined: i } = this.getUserBounds();
7415 let { min: s, max: n } = this;
7416 const o = (t) => (s = e ? s : t),
7417 a = (t) => (n = i ? n : t);
7418 if (t) {
7419 const t = F(s),
7420 e = F(n);
7421 t < 0 && e < 0 ? a(0) : t > 0 && e > 0 && o(0);
7422 }
7423 if (s === n) {
7424 let e = 0 === n ? 1 : Math.abs(0.05 * n);
7425 (a(n + e), t || o(s - e));
7426 }
7427 ((this.min = s), (this.max = n));
7428 }
7429 getTickLimit() {
7430 const t = this.options.ticks;
7431 let e,
7432 { maxTicksLimit: i, stepSize: s } = t;
7433 return (
7434 s
7435 ? ((e = Math.ceil(this.max / s) - Math.floor(this.min / s) + 1),
7436 e > 1e3 &&
7437 (console.warn(
7438 `scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`,
7439 ),
7440 (e = 1e3)))
7441 : ((e = this.computeTickLimit()), (i = i || 11)),
7442 i && (e = Math.min(i, e)),
7443 e
7444 );
7445 }
7446 computeTickLimit() {
7447 return Number.POSITIVE_INFINITY;
7448 }
7449 buildTicks() {
7450 const t = this.options,
7451 e = t.ticks;
7452 let i = this.getTickLimit();
7453 i = Math.max(2, i);
7454 const n = (function (t, e) {
7455 const i = [],
7456 {
7457 bounds: n,
7458 step: o,
7459 min: a,
7460 max: r,
7461 precision: l,
7462 count: h,
7463 maxTicks: c,
7464 maxDigits: d,
7465 includeBounds: u,
7466 } = t,
7467 f = o || 1,
7468 g = c - 1,
7469 { min: p, max: m } = e,
7470 x = !s(a),
7471 b = !s(r),
7472 _ = !s(h),
7473 y = (m - p) / (d + 1);
7474 let v,
7475 M,
7476 w,
7477 k,
7478 S = B((m - p) / g / f) * f;
7479 if (S < 1e-14 && !x && !b) return [{ value: p }, { value: m }];
7480 ((k = Math.ceil(m / S) - Math.floor(p / S)),
7481 k > g && (S = B((k * S) / g / f) * f),
7482 s(l) || ((v = Math.pow(10, l)), (S = Math.ceil(S * v) / v)),
7483 "ticks" === n ? ((M = Math.floor(p / S) * S), (w = Math.ceil(m / S) * S)) : ((M = p), (w = m)),
7484 x && b && o && H((r - a) / o, S / 1e3)
7485 ? ((k = Math.round(Math.min((r - a) / S, c))), (S = (r - a) / k), (M = a), (w = r))
7486 : _
7487 ? ((M = x ? a : M), (w = b ? r : w), (k = h - 1), (S = (w - M) / k))
7488 : ((k = (w - M) / S), (k = V(k, Math.round(k), S / 1e3) ? Math.round(k) : Math.ceil(k))));
7489 const P = Math.max(U(S), U(M));
7490 ((v = Math.pow(10, s(l) ? P : l)), (M = Math.round(M * v) / v), (w = Math.round(w * v) / v));
7491 let D = 0;
7492 for (
7493 x &&
7494 (u && M !== a
7495 ? (i.push({ value: a }), M < a && D++, V(Math.round((M + D * S) * v) / v, a, xo(a, y, t)) && D++)
7496 : M < a && D++);
7497 D < k;
7498 ++D
7499 ) {
7500 const t = Math.round((M + D * S) * v) / v;
7501 if (b && t > r) break;
7502 i.push({ value: t });
7503 }
7504 return (
7505 b && u && w !== r
7506 ? i.length && V(i[i.length - 1].value, r, xo(r, y, t))
7507 ? (i[i.length - 1].value = r)
7508 : i.push({ value: r })
7509 : (b && w !== r) || i.push({ value: w }),
7510 i
7511 );
7512 })(
7513 {
7514 maxTicks: i,
7515 bounds: t.bounds,
7516 min: t.min,
7517 max: t.max,
7518 precision: e.precision,
7519 step: e.stepSize,
7520 count: e.count,
7521 maxDigits: this._maxDigits(),
7522 horizontal: this.isHorizontal(),
7523 minRotation: e.minRotation || 0,
7524 includeBounds: !1 !== e.includeBounds,
7525 },
7526 this._range || this,
7527 );
7528 return (
7529 "ticks" === t.bounds && j(n, this, "value"),
7530 t.reverse
7531 ? (n.reverse(), (this.start = this.max), (this.end = this.min))
7532 : ((this.start = this.min), (this.end = this.max)),
7533 n
7534 );
7535 }
7536 configure() {
7537 const t = this.ticks;
7538 let e = this.min,
7539 i = this.max;
7540 if ((super.configure(), this.options.offset && t.length)) {
7541 const s = (i - e) / Math.max(t.length - 1, 1) / 2;
7542 ((e -= s), (i += s));
7543 }
7544 ((this._startValue = e), (this._endValue = i), (this._valueRange = i - e));
7545 }
7546 getLabelForValue(t) {
7547 return ne(t, this.chart.options.locale, this.options.ticks.format);
7548 }
7549 }
7550 class _o extends bo {
7551 static id = "linear";
7552 static defaults = { ticks: { callback: ae.formatters.numeric } };
7553 determineDataLimits() {
7554 const { min: t, max: e } = this.getMinMax(!0);
7555 ((this.min = a(t) ? t : 0), (this.max = a(e) ? e : 1), this.handleTickRangeOptions());
7556 }
7557 computeTickLimit() {
7558 const t = this.isHorizontal(),
7559 e = t ? this.width : this.height,
7560 i = $(this.options.ticks.minRotation),
7561 s = (t ? Math.sin(i) : Math.cos(i)) || 0.001,
7562 n = this._resolveTickFontOptions(0);
7563 return Math.ceil(e / Math.min(40, n.lineHeight / s));
7564 }
7565 getPixelForValue(t) {
7566 return null === t ? NaN : this.getPixelForDecimal((t - this._startValue) / this._valueRange);
7567 }
7568 getValueForPixel(t) {
7569 return this._startValue + this.getDecimalForPixel(t) * this._valueRange;
7570 }
7571 }
7572 const yo = (t) => Math.floor(z(t)),
7573 vo = (t, e) => Math.pow(10, yo(t) + e);
7574 function Mo(t) {
7575 return 1 === t / Math.pow(10, yo(t));
7576 }
7577 function wo(t, e, i) {
7578 const s = Math.pow(10, i),
7579 n = Math.floor(t / s);
7580 return Math.ceil(e / s) - n;
7581 }
7582 function ko(t, { min: e, max: i }) {
7583 e = r(t.min, e);
7584 const s = [],
7585 n = yo(e);
7586 let o = (function (t, e) {
7587 let i = yo(e - t);
7588 for (; wo(t, e, i) > 10; ) i++;
7589 for (; wo(t, e, i) < 10; ) i--;
7590 return Math.min(i, yo(t));
7591 })(e, i),
7592 a = o < 0 ? Math.pow(10, Math.abs(o)) : 1;
7593 const l = Math.pow(10, o),
7594 h = n > o ? Math.pow(10, n) : 0,
7595 c = Math.round((e - h) * a) / a,
7596 d = Math.floor((e - h) / l / 10) * l * 10;
7597 let u = Math.floor((c - d) / Math.pow(10, o)),
7598 f = r(t.min, Math.round((h + d + u * Math.pow(10, o)) * a) / a);
7599 for (; f < i; )
7600 (s.push({ value: f, major: Mo(f), significand: u }),
7601 u >= 10 ? (u = u < 15 ? 15 : 20) : u++,
7602 u >= 20 && (o++, (u = 2), (a = o >= 0 ? 1 : a)),
7603 (f = Math.round((h + d + u * Math.pow(10, o)) * a) / a));
7604 const g = r(t.max, f);
7605 return (s.push({ value: g, major: Mo(g), significand: u }), s);
7606 }
7607 class So extends tn {
7608 static id = "logarithmic";
7609 static defaults = { ticks: { callback: ae.formatters.logarithmic, major: { enabled: !0 } } };
7610 constructor(t) {
7611 (super(t), (this.start = void 0), (this.end = void 0), (this._startValue = void 0), (this._valueRange = 0));
7612 }
7613 parse(t, e) {
7614 const i = bo.prototype.parse.apply(this, [t, e]);
7615 if (0 !== i) return a(i) && i > 0 ? i : null;
7616 this._zero = !0;
7617 }
7618 determineDataLimits() {
7619 const { min: t, max: e } = this.getMinMax(!0);
7620 ((this.min = a(t) ? Math.max(0, t) : null),
7621 (this.max = a(e) ? Math.max(0, e) : null),
7622 this.options.beginAtZero && (this._zero = !0),
7623 this._zero &&
7624 this.min !== this._suggestedMin &&
7625 !a(this._userMin) &&
7626 (this.min = t === vo(this.min, 0) ? vo(this.min, -1) : vo(this.min, 0)),
7627 this.handleTickRangeOptions());
7628 }
7629 handleTickRangeOptions() {
7630 const { minDefined: t, maxDefined: e } = this.getUserBounds();
7631 let i = this.min,
7632 s = this.max;
7633 const n = (e) => (i = t ? i : e),
7634 o = (t) => (s = e ? s : t);
7635 (i === s && (i <= 0 ? (n(1), o(10)) : (n(vo(i, -1)), o(vo(s, 1)))),
7636 i <= 0 && n(vo(s, -1)),
7637 s <= 0 && o(vo(i, 1)),
7638 (this.min = i),
7639 (this.max = s));
7640 }
7641 buildTicks() {
7642 const t = this.options,
7643 e = ko({ min: this._userMin, max: this._userMax }, this);
7644 return (
7645 "ticks" === t.bounds && j(e, this, "value"),
7646 t.reverse
7647 ? (e.reverse(), (this.start = this.max), (this.end = this.min))
7648 : ((this.start = this.min), (this.end = this.max)),
7649 e
7650 );
7651 }
7652 getLabelForValue(t) {
7653 return void 0 === t ? "0" : ne(t, this.chart.options.locale, this.options.ticks.format);
7654 }
7655 configure() {
7656 const t = this.min;
7657 (super.configure(), (this._startValue = z(t)), (this._valueRange = z(this.max) - z(t)));
7658 }
7659 getPixelForValue(t) {
7660 return (
7661 (void 0 !== t && 0 !== t) || (t = this.min),
7662 null === t || isNaN(t)
7663 ? NaN
7664 : this.getPixelForDecimal(t === this.min ? 0 : (z(t) - this._startValue) / this._valueRange)
7665 );
7666 }
7667 getValueForPixel(t) {
7668 const e = this.getDecimalForPixel(t);
7669 return Math.pow(10, this._startValue + e * this._valueRange);
7670 }
7671 }
7672 function Po(t) {
7673 const e = t.ticks;
7674 if (e.display && t.display) {
7675 const t = ki(e.backdropPadding);
7676 return l(e.font && e.font.size, ue.font.size) + t.height;
7677 }
7678 return 0;
7679 }
7680 function Do(t, e, i, s, n) {
7681 return t === s || t === n
7682 ? { start: e - i / 2, end: e + i / 2 }
7683 : t < s || t > n
7684 ? { start: e - i, end: e }
7685 : { start: e, end: e + i };
7686 }
7687 function Co(t) {
7688 const e = {
7689 l: t.left + t._padding.left,
7690 r: t.right - t._padding.right,
7691 t: t.top + t._padding.top,
7692 b: t.bottom - t._padding.bottom,
7693 },
7694 i = Object.assign({}, e),
7695 s = [],
7696 o = [],
7697 a = t._pointLabels.length,
7698 r = t.options.pointLabels,
7699 l = r.centerPointLabels ? C / a : 0;
7700 for (let u = 0; u < a; u++) {
7701 const a = r.setContext(t.getPointLabelContext(u));
7702 o[u] = a.padding;
7703 const f = t.getPointPosition(u, t.drawingArea + o[u], l),
7704 g = Si(a.font),
7705 p =
7706 ((h = t.ctx),
7707 (c = g),
7708 (d = n((d = t._pointLabels[u])) ? d : [d]),
7709 { w: Oe(h, c.string, d), h: d.length * c.lineHeight });
7710 s[u] = p;
7711 const m = G(t.getIndexAngle(u) + l),
7712 x = Math.round(Y(m));
7713 Oo(i, e, m, Do(x, f.x, p.w, 0, 180), Do(x, f.y, p.h, 90, 270));
7714 }
7715 var h, c, d;
7716 (t.setCenterPoint(e.l - i.l, i.r - e.r, e.t - i.t, i.b - e.b),
7717 (t._pointLabelItems = (function (t, e, i) {
7718 const s = [],
7719 n = t._pointLabels.length,
7720 o = t.options,
7721 { centerPointLabels: a, display: r } = o.pointLabels,
7722 l = { extra: Po(o) / 2, additionalAngle: a ? C / n : 0 };
7723 let h;
7724 for (let o = 0; o < n; o++) {
7725 ((l.padding = i[o]), (l.size = e[o]));
7726 const n = Ao(t, o, l);
7727 (s.push(n), "auto" === r && ((n.visible = To(n, h)), n.visible && (h = n)));
7728 }
7729 return s;
7730 })(t, s, o)));
7731 }
7732 function Oo(t, e, i, s, n) {
7733 const o = Math.abs(Math.sin(i)),
7734 a = Math.abs(Math.cos(i));
7735 let r = 0,
7736 l = 0;
7737 (s.start < e.l
7738 ? ((r = (e.l - s.start) / o), (t.l = Math.min(t.l, e.l - r)))
7739 : s.end > e.r && ((r = (s.end - e.r) / o), (t.r = Math.max(t.r, e.r + r))),
7740 n.start < e.t
7741 ? ((l = (e.t - n.start) / a), (t.t = Math.min(t.t, e.t - l)))
7742 : n.end > e.b && ((l = (n.end - e.b) / a), (t.b = Math.max(t.b, e.b + l))));
7743 }
7744 function Ao(t, e, i) {
7745 const s = t.drawingArea,
7746 { extra: n, additionalAngle: o, padding: a, size: r } = i,
7747 l = t.getPointPosition(e, s + n + a, o),
7748 h = Math.round(Y(G(l.angle + E))),
7749 c = (function (t, e, i) {
7750 90 === i || 270 === i ? (t -= e / 2) : (i > 270 || i < 90) && (t -= e);
7751 return t;
7752 })(l.y, r.h, h),
7753 d = (function (t) {
7754 if (0 === t || 180 === t) return "center";
7755 if (t < 180) return "left";
7756 return "right";
7757 })(h),
7758 u = (function (t, e, i) {
7759 "right" === i ? (t -= e) : "center" === i && (t -= e / 2);
7760 return t;
7761 })(l.x, r.w, d);
7762 return { visible: !0, x: l.x, y: c, textAlign: d, left: u, top: c, right: u + r.w, bottom: c + r.h };
7763 }
7764 function To(t, e) {
7765 if (!e) return !0;
7766 const { left: i, top: s, right: n, bottom: o } = t;
7767 return !(Re({ x: i, y: s }, e) || Re({ x: i, y: o }, e) || Re({ x: n, y: s }, e) || Re({ x: n, y: o }, e));
7768 }
7769 function Lo(t, e, i) {
7770 const { left: n, top: o, right: a, bottom: r } = i,
7771 { backdropColor: l } = e;
7772 if (!s(l)) {
7773 const i = wi(e.borderRadius),
7774 s = ki(e.backdropPadding);
7775 t.fillStyle = l;
7776 const h = n - s.left,
7777 c = o - s.top,
7778 d = a - n + s.width,
7779 u = r - o + s.height;
7780 Object.values(i).some((t) => 0 !== t)
7781 ? (t.beginPath(), He(t, { x: h, y: c, w: d, h: u, radius: i }), t.fill())
7782 : t.fillRect(h, c, d, u);
7783 }
7784 }
7785 function Eo(t, e, i, s) {
7786 const { ctx: n } = t;
7787 if (i) n.arc(t.xCenter, t.yCenter, e, 0, O);
7788 else {
7789 let i = t.getPointPosition(0, e);
7790 n.moveTo(i.x, i.y);
7791 for (let o = 1; o < s; o++) ((i = t.getPointPosition(o, e)), n.lineTo(i.x, i.y));
7792 }
7793 }
7794 class Ro extends bo {
7795 static id = "radialLinear";
7796 static defaults = {
7797 display: !0,
7798 animate: !0,
7799 position: "chartArea",
7800 angleLines: { display: !0, lineWidth: 1, borderDash: [], borderDashOffset: 0 },
7801 grid: { circular: !1 },
7802 startAngle: 0,
7803 ticks: { showLabelBackdrop: !0, callback: ae.formatters.numeric },
7804 pointLabels: {
7805 backdropColor: void 0,
7806 backdropPadding: 2,
7807 display: !0,
7808 font: { size: 10 },
7809 callback: (t) => t,
7810 padding: 5,
7811 centerPointLabels: !1,
7812 },
7813 };
7814 static defaultRoutes = { "angleLines.color": "borderColor", "pointLabels.color": "color", "ticks.color": "color" };
7815 static descriptors = { angleLines: { _fallback: "grid" } };
7816 constructor(t) {
7817 (super(t),
7818 (this.xCenter = void 0),
7819 (this.yCenter = void 0),
7820 (this.drawingArea = void 0),
7821 (this._pointLabels = []),
7822 (this._pointLabelItems = []));
7823 }
7824 setDimensions() {
7825 const t = (this._padding = ki(Po(this.options) / 2)),
7826 e = (this.width = this.maxWidth - t.width),
7827 i = (this.height = this.maxHeight - t.height);
7828 ((this.xCenter = Math.floor(this.left + e / 2 + t.left)),
7829 (this.yCenter = Math.floor(this.top + i / 2 + t.top)),
7830 (this.drawingArea = Math.floor(Math.min(e, i) / 2)));
7831 }
7832 determineDataLimits() {
7833 const { min: t, max: e } = this.getMinMax(!1);
7834 ((this.min = a(t) && !isNaN(t) ? t : 0), (this.max = a(e) && !isNaN(e) ? e : 0), this.handleTickRangeOptions());
7835 }
7836 computeTickLimit() {
7837 return Math.ceil(this.drawingArea / Po(this.options));
7838 }
7839 generateTickLabels(t) {
7840 (bo.prototype.generateTickLabels.call(this, t),
7841 (this._pointLabels = this.getLabels()
7842 .map((t, e) => {
7843 const i = d(this.options.pointLabels.callback, [t, e], this);
7844 return i || 0 === i ? i : "";
7845 })
7846 .filter((t, e) => this.chart.getDataVisibility(e))));
7847 }
7848 fit() {
7849 const t = this.options;
7850 t.display && t.pointLabels.display ? Co(this) : this.setCenterPoint(0, 0, 0, 0);
7851 }
7852 setCenterPoint(t, e, i, s) {
7853 ((this.xCenter += Math.floor((t - e) / 2)),
7854 (this.yCenter += Math.floor((i - s) / 2)),
7855 (this.drawingArea -= Math.min(this.drawingArea / 2, Math.max(t, e, i, s))));
7856 }
7857 getIndexAngle(t) {
7858 return G(t * (O / (this._pointLabels.length || 1)) + $(this.options.startAngle || 0));
7859 }
7860 getDistanceFromCenterForValue(t) {
7861 if (s(t)) return NaN;
7862 const e = this.drawingArea / (this.max - this.min);
7863 return this.options.reverse ? (this.max - t) * e : (t - this.min) * e;
7864 }
7865 getValueForDistanceFromCenter(t) {
7866 if (s(t)) return NaN;
7867 const e = t / (this.drawingArea / (this.max - this.min));
7868 return this.options.reverse ? this.max - e : this.min + e;
7869 }
7870 getPointLabelContext(t) {
7871 const e = this._pointLabels || [];
7872 if (t >= 0 && t < e.length) {
7873 const i = e[t];
7874 return (function (t, e, i) {
7875 return Ci(t, { label: i, index: e, type: "pointLabel" });
7876 })(this.getContext(), t, i);
7877 }
7878 }
7879 getPointPosition(t, e, i = 0) {
7880 const s = this.getIndexAngle(t) - E + i;
7881 return { x: Math.cos(s) * e + this.xCenter, y: Math.sin(s) * e + this.yCenter, angle: s };
7882 }
7883 getPointPositionForValue(t, e) {
7884 return this.getPointPosition(t, this.getDistanceFromCenterForValue(e));
7885 }
7886 getBasePosition(t) {
7887 return this.getPointPositionForValue(t || 0, this.getBaseValue());
7888 }
7889 getPointLabelPosition(t) {
7890 const { left: e, top: i, right: s, bottom: n } = this._pointLabelItems[t];
7891 return { left: e, top: i, right: s, bottom: n };
7892 }
7893 drawBackground() {
7894 const {
7895 backgroundColor: t,
7896 grid: { circular: e },
7897 } = this.options;
7898 if (t) {
7899 const i = this.ctx;
7900 (i.save(),
7901 i.beginPath(),
7902 Eo(this, this.getDistanceFromCenterForValue(this._endValue), e, this._pointLabels.length),
7903 i.closePath(),
7904 (i.fillStyle = t),
7905 i.fill(),
7906 i.restore());
7907 }
7908 }
7909 drawGrid() {
7910 const t = this.ctx,
7911 e = this.options,
7912 { angleLines: i, grid: s, border: n } = e,
7913 o = this._pointLabels.length;
7914 let a, r, l;
7915 if (
7916 (e.pointLabels.display &&
7917 (function (t, e) {
7918 const {
7919 ctx: i,
7920 options: { pointLabels: s },
7921 } = t;
7922 for (let n = e - 1; n >= 0; n--) {
7923 const e = t._pointLabelItems[n];
7924 if (!e.visible) continue;
7925 const o = s.setContext(t.getPointLabelContext(n));
7926 Lo(i, o, e);
7927 const a = Si(o.font),
7928 { x: r, y: l, textAlign: h } = e;
7929 Ne(i, t._pointLabels[n], r, l + a.lineHeight / 2, a, {
7930 color: o.color,
7931 textAlign: h,
7932 textBaseline: "middle",
7933 });
7934 }
7935 })(this, o),
7936 s.display &&
7937 this.ticks.forEach((t, e) => {
7938 if (0 !== e || (0 === e && this.min < 0)) {
7939 r = this.getDistanceFromCenterForValue(t.value);
7940 const i = this.getContext(e),
7941 a = s.setContext(i),
7942 l = n.setContext(i);
7943 !(function (t, e, i, s, n) {
7944 const o = t.ctx,
7945 a = e.circular,
7946 { color: r, lineWidth: l } = e;
7947 (!a && !s) ||
7948 !r ||
7949 !l ||
7950 i < 0 ||
7951 (o.save(),
7952 (o.strokeStyle = r),
7953 (o.lineWidth = l),
7954 o.setLineDash(n.dash || []),
7955 (o.lineDashOffset = n.dashOffset),
7956 o.beginPath(),
7957 Eo(t, i, a, s),
7958 o.closePath(),
7959 o.stroke(),
7960 o.restore());
7961 })(this, a, r, o, l);
7962 }
7963 }),
7964 i.display)
7965 ) {
7966 for (t.save(), a = o - 1; a >= 0; a--) {
7967 const s = i.setContext(this.getPointLabelContext(a)),
7968 { color: n, lineWidth: o } = s;
7969 o &&
7970 n &&
7971 ((t.lineWidth = o),
7972 (t.strokeStyle = n),
7973 t.setLineDash(s.borderDash),
7974 (t.lineDashOffset = s.borderDashOffset),
7975 (r = this.getDistanceFromCenterForValue(e.reverse ? this.min : this.max)),
7976 (l = this.getPointPosition(a, r)),
7977 t.beginPath(),
7978 t.moveTo(this.xCenter, this.yCenter),
7979 t.lineTo(l.x, l.y),
7980 t.stroke());
7981 }
7982 t.restore();
7983 }
7984 }
7985 drawBorder() {}
7986 drawLabels() {
7987 const t = this.ctx,
7988 e = this.options,
7989 i = e.ticks;
7990 if (!i.display) return;
7991 const s = this.getIndexAngle(0);
7992 let n, o;
7993 (t.save(),
7994 t.translate(this.xCenter, this.yCenter),
7995 t.rotate(s),
7996 (t.textAlign = "center"),
7997 (t.textBaseline = "middle"),
7998 this.ticks.forEach((s, a) => {
7999 if (0 === a && this.min >= 0 && !e.reverse) return;
8000 const r = i.setContext(this.getContext(a)),
8001 l = Si(r.font);
8002 if (((n = this.getDistanceFromCenterForValue(this.ticks[a].value)), r.showLabelBackdrop)) {
8003 ((t.font = l.string), (o = t.measureText(s.label).width), (t.fillStyle = r.backdropColor));
8004 const e = ki(r.backdropPadding);
8005 t.fillRect(-o / 2 - e.left, -n - l.size / 2 - e.top, o + e.width, l.size + e.height);
8006 }
8007 Ne(t, s.label, 0, -n, l, { color: r.color, strokeColor: r.textStrokeColor, strokeWidth: r.textStrokeWidth });
8008 }),
8009 t.restore());
8010 }
8011 drawTitle() {}
8012 }
8013 const Io = {
8014 millisecond: { common: !0, size: 1, steps: 1e3 },
8015 second: { common: !0, size: 1e3, steps: 60 },
8016 minute: { common: !0, size: 6e4, steps: 60 },
8017 hour: { common: !0, size: 36e5, steps: 24 },
8018 day: { common: !0, size: 864e5, steps: 30 },
8019 week: { common: !1, size: 6048e5, steps: 4 },
8020 month: { common: !0, size: 2628e6, steps: 12 },
8021 quarter: { common: !1, size: 7884e6, steps: 4 },
8022 year: { common: !0, size: 3154e7 },
8023 },
8024 zo = Object.keys(Io);
8025 function Fo(t, e) {
8026 return t - e;
8027 }
8028 function Vo(t, e) {
8029 if (s(e)) return null;
8030 const i = t._adapter,
8031 { parser: n, round: o, isoWeekday: r } = t._parseOpts;
8032 let l = e;
8033 return (
8034 "function" == typeof n && (l = n(l)),
8035 a(l) || (l = "string" == typeof n ? i.parse(l, n) : i.parse(l)),
8036 null === l
8037 ? null
8038 : (o && (l = "week" !== o || (!N(r) && !0 !== r) ? i.startOf(l, o) : i.startOf(l, "isoWeek", r)), +l)
8039 );
8040 }
8041 function Bo(t, e, i, s) {
8042 const n = zo.length;
8043 for (let o = zo.indexOf(t); o < n - 1; ++o) {
8044 const t = Io[zo[o]],
8045 n = t.steps ? t.steps : Number.MAX_SAFE_INTEGER;
8046 if (t.common && Math.ceil((i - e) / (n * t.size)) <= s) return zo[o];
8047 }
8048 return zo[n - 1];
8049 }
8050 function Wo(t, e, i) {
8051 if (i) {
8052 if (i.length) {
8053 const { lo: s, hi: n } = et(i, e);
8054 t[i[s] >= e ? i[s] : i[n]] = !0;
8055 }
8056 } else t[e] = !0;
8057 }
8058 function No(t, e, i) {
8059 const s = [],
8060 n = {},
8061 o = e.length;
8062 let a, r;
8063 for (a = 0; a < o; ++a) ((r = e[a]), (n[r] = a), s.push({ value: r, major: !1 }));
8064 return 0 !== o && i
8065 ? (function (t, e, i, s) {
8066 const n = t._adapter,
8067 o = +n.startOf(e[0].value, s),
8068 a = e[e.length - 1].value;
8069 let r, l;
8070 for (r = o; r <= a; r = +n.add(r, 1, s)) ((l = i[r]), l >= 0 && (e[l].major = !0));
8071 return e;
8072 })(t, s, n, i)
8073 : s;
8074 }
8075 class Ho extends tn {
8076 static id = "time";
8077 static defaults = {
8078 bounds: "data",
8079 adapters: {},
8080 time: { parser: !1, unit: !1, round: !1, isoWeekday: !1, minUnit: "millisecond", displayFormats: {} },
8081 ticks: { source: "auto", callback: !1, major: { enabled: !1 } },
8082 };
8083 constructor(t) {
8084 (super(t),
8085 (this._cache = { data: [], labels: [], all: [] }),
8086 (this._unit = "day"),
8087 (this._majorUnit = void 0),
8088 (this._offsets = {}),
8089 (this._normalized = !1),
8090 (this._parseOpts = void 0));
8091 }
8092 init(t, e = {}) {
8093 const i = t.time || (t.time = {}),
8094 s = (this._adapter = new In._date(t.adapters.date));
8095 (s.init(e),
8096 b(i.displayFormats, s.formats()),
8097 (this._parseOpts = { parser: i.parser, round: i.round, isoWeekday: i.isoWeekday }),
8098 super.init(t),
8099 (this._normalized = e.normalized));
8100 }
8101 parse(t, e) {
8102 return void 0 === t ? null : Vo(this, t);
8103 }
8104 beforeLayout() {
8105 (super.beforeLayout(), (this._cache = { data: [], labels: [], all: [] }));
8106 }
8107 determineDataLimits() {
8108 const t = this.options,
8109 e = this._adapter,
8110 i = t.time.unit || "day";
8111 let { min: s, max: n, minDefined: o, maxDefined: r } = this.getUserBounds();
8112 function l(t) {
8113 (o || isNaN(t.min) || (s = Math.min(s, t.min)), r || isNaN(t.max) || (n = Math.max(n, t.max)));
8114 }
8115 ((o && r) ||
8116 (l(this._getLabelBounds()), ("ticks" === t.bounds && "labels" === t.ticks.source) || l(this.getMinMax(!1))),
8117 (s = a(s) && !isNaN(s) ? s : +e.startOf(Date.now(), i)),
8118 (n = a(n) && !isNaN(n) ? n : +e.endOf(Date.now(), i) + 1),
8119 (this.min = Math.min(s, n - 1)),
8120 (this.max = Math.max(s + 1, n)));
8121 }
8122 _getLabelBounds() {
8123 const t = this.getLabelTimestamps();
8124 let e = Number.POSITIVE_INFINITY,
8125 i = Number.NEGATIVE_INFINITY;
8126 return (t.length && ((e = t[0]), (i = t[t.length - 1])), { min: e, max: i });
8127 }
8128 buildTicks() {
8129 const t = this.options,
8130 e = t.time,
8131 i = t.ticks,
8132 s = "labels" === i.source ? this.getLabelTimestamps() : this._generate();
8133 "ticks" === t.bounds &&
8134 s.length &&
8135 ((this.min = this._userMin || s[0]), (this.max = this._userMax || s[s.length - 1]));
8136 const n = this.min,
8137 o = nt(s, n, this.max);
8138 return (
8139 (this._unit =
8140 e.unit ||
8141 (i.autoSkip
8142 ? Bo(e.minUnit, this.min, this.max, this._getLabelCapacity(n))
8143 : (function (t, e, i, s, n) {
8144 for (let o = zo.length - 1; o >= zo.indexOf(i); o--) {
8145 const i = zo[o];
8146 if (Io[i].common && t._adapter.diff(n, s, i) >= e - 1) return i;
8147 }
8148 return zo[i ? zo.indexOf(i) : 0];
8149 })(this, o.length, e.minUnit, this.min, this.max))),
8150 (this._majorUnit =
8151 i.major.enabled && "year" !== this._unit
8152 ? (function (t) {
8153 for (let e = zo.indexOf(t) + 1, i = zo.length; e < i; ++e) if (Io[zo[e]].common) return zo[e];
8154 })(this._unit)
8155 : void 0),
8156 this.initOffsets(s),
8157 t.reverse && o.reverse(),
8158 No(this, o, this._majorUnit)
8159 );
8160 }
8161 afterAutoSkip() {
8162 this.options.offsetAfterAutoskip && this.initOffsets(this.ticks.map((t) => +t.value));
8163 }
8164 initOffsets(t = []) {
8165 let e,
8166 i,
8167 s = 0,
8168 n = 0;
8169 this.options.offset &&
8170 t.length &&
8171 ((e = this.getDecimalForValue(t[0])),
8172 (s = 1 === t.length ? 1 - e : (this.getDecimalForValue(t[1]) - e) / 2),
8173 (i = this.getDecimalForValue(t[t.length - 1])),
8174 (n = 1 === t.length ? i : (i - this.getDecimalForValue(t[t.length - 2])) / 2));
8175 const o = t.length < 3 ? 0.5 : 0.25;
8176 ((s = Z(s, 0, o)), (n = Z(n, 0, o)), (this._offsets = { start: s, end: n, factor: 1 / (s + 1 + n) }));
8177 }
8178 _generate() {
8179 const t = this._adapter,
8180 e = this.min,
8181 i = this.max,
8182 s = this.options,
8183 n = s.time,
8184 o = n.unit || Bo(n.minUnit, e, i, this._getLabelCapacity(e)),
8185 a = l(s.ticks.stepSize, 1),
8186 r = "week" === o && n.isoWeekday,
8187 h = N(r) || !0 === r,
8188 c = {};
8189 let d,
8190 u,
8191 f = e;
8192 if ((h && (f = +t.startOf(f, "isoWeek", r)), (f = +t.startOf(f, h ? "day" : o)), t.diff(i, e, o) > 1e5 * a))
8193 throw new Error(e + " and " + i + " are too far apart with stepSize of " + a + " " + o);
8194 const g = "data" === s.ticks.source && this.getDataTimestamps();
8195 for (d = f, u = 0; d < i; d = +t.add(d, a, o), u++) Wo(c, d, g);
8196 return (
8197 (d !== i && "ticks" !== s.bounds && 1 !== u) || Wo(c, d, g),
8198 Object.keys(c)
8199 .sort(Fo)
8200 .map((t) => +t)
8201 );
8202 }
8203 getLabelForValue(t) {
8204 const e = this._adapter,
8205 i = this.options.time;
8206 return i.tooltipFormat ? e.format(t, i.tooltipFormat) : e.format(t, i.displayFormats.datetime);
8207 }
8208 format(t, e) {
8209 const i = this.options.time.displayFormats,
8210 s = this._unit,
8211 n = e || i[s];
8212 return this._adapter.format(t, n);
8213 }
8214 _tickFormatFunction(t, e, i, s) {
8215 const n = this.options,
8216 o = n.ticks.callback;
8217 if (o) return d(o, [t, e, i], this);
8218 const a = n.time.displayFormats,
8219 r = this._unit,
8220 l = this._majorUnit,
8221 h = r && a[r],
8222 c = l && a[l],
8223 u = i[e],
8224 f = l && c && u && u.major;
8225 return this._adapter.format(t, s || (f ? c : h));
8226 }
8227 generateTickLabels(t) {
8228 let e, i, s;
8229 for (e = 0, i = t.length; e < i; ++e) ((s = t[e]), (s.label = this._tickFormatFunction(s.value, e, t)));
8230 }
8231 getDecimalForValue(t) {
8232 return null === t ? NaN : (t - this.min) / (this.max - this.min);
8233 }
8234 getPixelForValue(t) {
8235 const e = this._offsets,
8236 i = this.getDecimalForValue(t);
8237 return this.getPixelForDecimal((e.start + i) * e.factor);
8238 }
8239 getValueForPixel(t) {
8240 const e = this._offsets,
8241 i = this.getDecimalForPixel(t) / e.factor - e.end;
8242 return this.min + i * (this.max - this.min);
8243 }
8244 _getLabelSize(t) {
8245 const e = this.options.ticks,
8246 i = this.ctx.measureText(t).width,
8247 s = $(this.isHorizontal() ? e.maxRotation : e.minRotation),
8248 n = Math.cos(s),
8249 o = Math.sin(s),
8250 a = this._resolveTickFontOptions(0).size;
8251 return { w: i * n + a * o, h: i * o + a * n };
8252 }
8253 _getLabelCapacity(t) {
8254 const e = this.options.time,
8255 i = e.displayFormats,
8256 s = i[e.unit] || i.millisecond,
8257 n = this._tickFormatFunction(t, 0, No(this, [t], this._majorUnit), s),
8258 o = this._getLabelSize(n),
8259 a = Math.floor(this.isHorizontal() ? this.width / o.w : this.height / o.h) - 1;
8260 return a > 0 ? a : 1;
8261 }
8262 getDataTimestamps() {
8263 let t,
8264 e,
8265 i = this._cache.data || [];
8266 if (i.length) return i;
8267 const s = this.getMatchingVisibleMetas();
8268 if (this._normalized && s.length) return (this._cache.data = s[0].controller.getAllParsedValues(this));
8269 for (t = 0, e = s.length; t < e; ++t) i = i.concat(s[t].controller.getAllParsedValues(this));
8270 return (this._cache.data = this.normalize(i));
8271 }
8272 getLabelTimestamps() {
8273 const t = this._cache.labels || [];
8274 let e, i;
8275 if (t.length) return t;
8276 const s = this.getLabels();
8277 for (e = 0, i = s.length; e < i; ++e) t.push(Vo(this, s[e]));
8278 return (this._cache.labels = this._normalized ? t : this.normalize(t));
8279 }
8280 normalize(t) {
8281 return lt(t.sort(Fo));
8282 }
8283 }
8284 function jo(t, e, i) {
8285 let s,
8286 n,
8287 o,
8288 a,
8289 r = 0,
8290 l = t.length - 1;
8291 i
8292 ? (e >= t[r].pos && e <= t[l].pos && ({ lo: r, hi: l } = it(t, "pos", e)),
8293 ({ pos: s, time: o } = t[r]),
8294 ({ pos: n, time: a } = t[l]))
8295 : (e >= t[r].time && e <= t[l].time && ({ lo: r, hi: l } = it(t, "time", e)),
8296 ({ time: s, pos: o } = t[r]),
8297 ({ time: n, pos: a } = t[l]));
8298 const h = n - s;
8299 return h ? o + ((a - o) * (e - s)) / h : o;
8300 }
8301 var $o = Object.freeze({
8302 __proto__: null,
8303 CategoryScale: class extends tn {
8304 static id = "category";
8305 static defaults = { ticks: { callback: mo } };
8306 constructor(t) {
8307 (super(t), (this._startValue = void 0), (this._valueRange = 0), (this._addedLabels = []));
8308 }
8309 init(t) {
8310 const e = this._addedLabels;
8311 if (e.length) {
8312 const t = this.getLabels();
8313 for (const { index: i, label: s } of e) t[i] === s && t.splice(i, 1);
8314 this._addedLabels = [];
8315 }
8316 super.init(t);
8317 }
8318 parse(t, e) {
8319 if (s(t)) return null;
8320 const i = this.getLabels();
8321 return ((t, e) => (null === t ? null : Z(Math.round(t), 0, e)))(
8322 (e = isFinite(e) && i[e] === t ? e : po(i, t, l(e, t), this._addedLabels)),
8323 i.length - 1,
8324 );
8325 }
8326 determineDataLimits() {
8327 const { minDefined: t, maxDefined: e } = this.getUserBounds();
8328 let { min: i, max: s } = this.getMinMax(!0);
8329 ("ticks" === this.options.bounds && (t || (i = 0), e || (s = this.getLabels().length - 1)),
8330 (this.min = i),
8331 (this.max = s));
8332 }
8333 buildTicks() {
8334 const t = this.min,
8335 e = this.max,
8336 i = this.options.offset,
8337 s = [];
8338 let n = this.getLabels();
8339 ((n = 0 === t && e === n.length - 1 ? n : n.slice(t, e + 1)),
8340 (this._valueRange = Math.max(n.length - (i ? 0 : 1), 1)),
8341 (this._startValue = this.min - (i ? 0.5 : 0)));
8342 for (let i = t; i <= e; i++) s.push({ value: i });
8343 return s;
8344 }
8345 getLabelForValue(t) {
8346 return mo.call(this, t);
8347 }
8348 configure() {
8349 (super.configure(), this.isHorizontal() || (this._reversePixels = !this._reversePixels));
8350 }
8351 getPixelForValue(t) {
8352 return (
8353 "number" != typeof t && (t = this.parse(t)),
8354 null === t ? NaN : this.getPixelForDecimal((t - this._startValue) / this._valueRange)
8355 );
8356 }
8357 getPixelForTick(t) {
8358 const e = this.ticks;
8359 return t < 0 || t > e.length - 1 ? null : this.getPixelForValue(e[t].value);
8360 }
8361 getValueForPixel(t) {
8362 return Math.round(this._startValue + this.getDecimalForPixel(t) * this._valueRange);
8363 }
8364 getBasePixel() {
8365 return this.bottom;
8366 }
8367 },
8368 LinearScale: _o,
8369 LogarithmicScale: So,
8370 RadialLinearScale: Ro,
8371 TimeScale: Ho,
8372 TimeSeriesScale: class extends Ho {
8373 static id = "timeseries";
8374 static defaults = Ho.defaults;
8375 constructor(t) {
8376 (super(t), (this._table = []), (this._minPos = void 0), (this._tableRange = void 0));
8377 }
8378 initOffsets() {
8379 const t = this._getTimestampsForTable(),
8380 e = (this._table = this.buildLookupTable(t));
8381 ((this._minPos = jo(e, this.min)), (this._tableRange = jo(e, this.max) - this._minPos), super.initOffsets(t));
8382 }
8383 buildLookupTable(t) {
8384 const { min: e, max: i } = this,
8385 s = [],
8386 n = [];
8387 let o, a, r, l, h;
8388 for (o = 0, a = t.length; o < a; ++o) ((l = t[o]), l >= e && l <= i && s.push(l));
8389 if (s.length < 2)
8390 return [
8391 { time: e, pos: 0 },
8392 { time: i, pos: 1 },
8393 ];
8394 for (o = 0, a = s.length; o < a; ++o)
8395 ((h = s[o + 1]),
8396 (r = s[o - 1]),
8397 (l = s[o]),
8398 Math.round((h + r) / 2) !== l && n.push({ time: l, pos: o / (a - 1) }));
8399 return n;
8400 }
8401 _generate() {
8402 const t = this.min,
8403 e = this.max;
8404 let i = super.getDataTimestamps();
8405 return (
8406 (i.includes(t) && i.length) || i.splice(0, 0, t),
8407 (i.includes(e) && 1 !== i.length) || i.push(e),
8408 i.sort((t, e) => t - e)
8409 );
8410 }
8411 _getTimestampsForTable() {
8412 let t = this._cache.all || [];
8413 if (t.length) return t;
8414 const e = this.getDataTimestamps(),
8415 i = this.getLabelTimestamps();
8416 return (
8417 (t = e.length && i.length ? this.normalize(e.concat(i)) : e.length ? e : i),
8418 (t = this._cache.all = t),
8419 t
8420 );
8421 }
8422 getDecimalForValue(t) {
8423 return (jo(this._table, t) - this._minPos) / this._tableRange;
8424 }
8425 getValueForPixel(t) {
8426 const e = this._offsets,
8427 i = this.getDecimalForPixel(t) / e.factor - e.end;
8428 return jo(this._table, i * this._tableRange + this._minPos, !0);
8429 }
8430 },
8431 });
8432 const Yo = [
8433 "rgb(54, 162, 235)",
8434 "rgb(255, 99, 132)",
8435 "rgb(255, 159, 64)",
8436 "rgb(255, 205, 86)",
8437 "rgb(75, 192, 192)",
8438 "rgb(153, 102, 255)",
8439 "rgb(201, 203, 207)",
8440 ],
8441 Uo = Yo.map((t) => t.replace("rgb(", "rgba(").replace(")", ", 0.5)"));
8442 function Xo(t) {
8443 return Yo[t % Yo.length];
8444 }
8445 function qo(t) {
8446 return Uo[t % Uo.length];
8447 }
8448 function Ko(t) {
8449 let e = 0;
8450 return (i, s) => {
8451 const n = t.getDatasetMeta(s).controller;
8452 n instanceof $n
8453 ? (e = (function (t, e) {
8454 return ((t.backgroundColor = t.data.map(() => Xo(e++))), e);
8455 })(i, e))
8456 : n instanceof Yn
8457 ? (e = (function (t, e) {
8458 return ((t.backgroundColor = t.data.map(() => qo(e++))), e);
8459 })(i, e))
8460 : n &&
8461 (e = (function (t, e) {
8462 return ((t.borderColor = Xo(e)), (t.backgroundColor = qo(e)), ++e);
8463 })(i, e));
8464 };
8465 }
8466 function Go(t) {
8467 let e;
8468 for (e in t) if (t[e].borderColor || t[e].backgroundColor) return !0;
8469 return !1;
8470 }
8471 var Jo = {
8472 id: "colors",
8473 defaults: { enabled: !0, forceOverride: !1 },
8474 beforeLayout(t, e, i) {
8475 if (!i.enabled) return;
8476 const {
8477 data: { datasets: s },
8478 options: n,
8479 } = t.config,
8480 { elements: o } = n,
8481 a =
8482 Go(s) ||
8483 ((r = n) && (r.borderColor || r.backgroundColor)) ||
8484 (o && Go(o)) ||
8485 "rgba(0,0,0,0.1)" !== ue.borderColor ||
8486 "rgba(0,0,0,0.1)" !== ue.backgroundColor;
8487 var r;
8488 if (!i.forceOverride && a) return;
8489 const l = Ko(t);
8490 s.forEach(l);
8491 },
8492 };
8493 function Zo(t) {
8494 if (t._decimated) {
8495 const e = t._data;
8496 (delete t._decimated,
8497 delete t._data,
8498 Object.defineProperty(t, "data", { configurable: !0, enumerable: !0, writable: !0, value: e }));
8499 }
8500 }
8501 function Qo(t) {
8502 t.data.datasets.forEach((t) => {
8503 Zo(t);
8504 });
8505 }
8506 var ta = {
8507 id: "decimation",
8508 defaults: { algorithm: "min-max", enabled: !1 },
8509 beforeElementsUpdate: (t, e, i) => {
8510 if (!i.enabled) return void Qo(t);
8511 const n = t.width;
8512 t.data.datasets.forEach((e, o) => {
8513 const { _data: a, indexAxis: r } = e,
8514 l = t.getDatasetMeta(o),
8515 h = a || e.data;
8516 if ("y" === Pi([r, t.options.indexAxis])) return;
8517 if (!l.controller.supportsDecimation) return;
8518 const c = t.scales[l.xAxisID];
8519 if ("linear" !== c.type && "time" !== c.type) return;
8520 if (t.options.parsing) return;
8521 let { start: d, count: u } = (function (t, e) {
8522 const i = e.length;
8523 let s,
8524 n = 0;
8525 const { iScale: o } = t,
8526 { min: a, max: r, minDefined: l, maxDefined: h } = o.getUserBounds();
8527 return (
8528 l && (n = Z(it(e, o.axis, a).lo, 0, i - 1)),
8529 (s = h ? Z(it(e, o.axis, r).hi + 1, n, i) - n : i - n),
8530 { start: n, count: s }
8531 );
8532 })(l, h);
8533 if (u <= (i.threshold || 4 * n)) return void Zo(e);
8534 let f;
8535 switch (
8536 (s(a) &&
8537 ((e._data = h),
8538 delete e.data,
8539 Object.defineProperty(e, "data", {
8540 configurable: !0,
8541 enumerable: !0,
8542 get: function () {
8543 return this._decimated;
8544 },
8545 set: function (t) {
8546 this._data = t;
8547 },
8548 })),
8549 i.algorithm)
8550 ) {
8551 case "lttb":
8552 f = (function (t, e, i, s, n) {
8553 const o = n.samples || s;
8554 if (o >= i) return t.slice(e, e + i);
8555 const a = [],
8556 r = (i - 2) / (o - 2);
8557 let l = 0;
8558 const h = e + i - 1;
8559 let c,
8560 d,
8561 u,
8562 f,
8563 g,
8564 p = e;
8565 for (a[l++] = t[p], c = 0; c < o - 2; c++) {
8566 let s,
8567 n = 0,
8568 o = 0;
8569 const h = Math.floor((c + 1) * r) + 1 + e,
8570 m = Math.min(Math.floor((c + 2) * r) + 1, i) + e,
8571 x = m - h;
8572 for (s = h; s < m; s++) ((n += t[s].x), (o += t[s].y));
8573 ((n /= x), (o /= x));
8574 const b = Math.floor(c * r) + 1 + e,
8575 _ = Math.min(Math.floor((c + 1) * r) + 1, i) + e,
8576 { x: y, y: v } = t[p];
8577 for (u = f = -1, s = b; s < _; s++)
8578 ((f = 0.5 * Math.abs((y - n) * (t[s].y - v) - (y - t[s].x) * (o - v))),
8579 f > u && ((u = f), (d = t[s]), (g = s)));
8580 ((a[l++] = d), (p = g));
8581 }
8582 return ((a[l++] = t[h]), a);
8583 })(h, d, u, n, i);
8584 break;
8585 case "min-max":
8586 f = (function (t, e, i, n) {
8587 let o,
8588 a,
8589 r,
8590 l,
8591 h,
8592 c,
8593 d,
8594 u,
8595 f,
8596 g,
8597 p = 0,
8598 m = 0;
8599 const x = [],
8600 b = e + i - 1,
8601 _ = t[e].x,
8602 y = t[b].x - _;
8603 for (o = e; o < e + i; ++o) {
8604 ((a = t[o]), (r = ((a.x - _) / y) * n), (l = a.y));
8605 const e = 0 | r;
8606 if (e === h) (l < f ? ((f = l), (c = o)) : l > g && ((g = l), (d = o)), (p = (m * p + a.x) / ++m));
8607 else {
8608 const i = o - 1;
8609 if (!s(c) && !s(d)) {
8610 const e = Math.min(c, d),
8611 s = Math.max(c, d);
8612 (e !== u && e !== i && x.push({ ...t[e], x: p }), s !== u && s !== i && x.push({ ...t[s], x: p }));
8613 }
8614 (o > 0 && i !== u && x.push(t[i]), x.push(a), (h = e), (m = 0), (f = g = l), (c = d = u = o));
8615 }
8616 }
8617 return x;
8618 })(h, d, u, n);
8619 break;
8620 default:
8621 throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`);
8622 }
8623 e._decimated = f;
8624 });
8625 },
8626 destroy(t) {
8627 Qo(t);
8628 },
8629 };
8630 function ea(t, e, i, s) {
8631 if (s) return;
8632 let n = e[t],
8633 o = i[t];
8634 return ("angle" === t && ((n = G(n)), (o = G(o))), { property: t, start: n, end: o });
8635 }
8636 function ia(t, e, i) {
8637 for (; e > t; e--) {
8638 const t = i[e];
8639 if (!isNaN(t.x) && !isNaN(t.y)) break;
8640 }
8641 return e;
8642 }
8643 function sa(t, e, i, s) {
8644 return t && e ? s(t[i], e[i]) : t ? t[i] : e ? e[i] : 0;
8645 }
8646 function na(t, e) {
8647 let i = [],
8648 s = !1;
8649 return (
8650 n(t)
8651 ? ((s = !0), (i = t))
8652 : (i = (function (t, e) {
8653 const { x: i = null, y: s = null } = t || {},
8654 n = e.points,
8655 o = [];
8656 return (
8657 e.segments.forEach(({ start: t, end: e }) => {
8658 e = ia(t, e, n);
8659 const a = n[t],
8660 r = n[e];
8661 null !== s
8662 ? (o.push({ x: a.x, y: s }), o.push({ x: r.x, y: s }))
8663 : null !== i && (o.push({ x: i, y: a.y }), o.push({ x: i, y: r.y }));
8664 }),
8665 o
8666 );
8667 })(t, e)),
8668 i.length ? new oo({ points: i, options: { tension: 0 }, _loop: s, _fullLoop: s }) : null
8669 );
8670 }
8671 function oa(t) {
8672 return t && !1 !== t.fill;
8673 }
8674 function aa(t, e, i) {
8675 let s = t[e].fill;
8676 const n = [e];
8677 let o;
8678 if (!i) return s;
8679 for (; !1 !== s && -1 === n.indexOf(s); ) {
8680 if (!a(s)) return s;
8681 if (((o = t[s]), !o)) return !1;
8682 if (o.visible) return s;
8683 (n.push(s), (s = o.fill));
8684 }
8685 return !1;
8686 }
8687 function ra(t, e, i) {
8688 const s = (function (t) {
8689 const e = t.options,
8690 i = e.fill;
8691 let s = l(i && i.target, i);
8692 void 0 === s && (s = !!e.backgroundColor);
8693 if (!1 === s || null === s) return !1;
8694 if (!0 === s) return "origin";
8695 return s;
8696 })(t);
8697 if (o(s)) return !isNaN(s.value) && s;
8698 let n = parseFloat(s);
8699 return a(n) && Math.floor(n) === n
8700 ? (function (t, e, i, s) {
8701 ("-" !== t && "+" !== t) || (i = e + i);
8702 if (i === e || i < 0 || i >= s) return !1;
8703 return i;
8704 })(s[0], e, n, i)
8705 : ["origin", "start", "end", "stack", "shape"].indexOf(s) >= 0 && s;
8706 }
8707 function la(t, e, i) {
8708 const s = [];
8709 for (let n = 0; n < i.length; n++) {
8710 const o = i[n],
8711 { first: a, last: r, point: l } = ha(o, e, "x");
8712 if (!(!l || (a && r)))
8713 if (a) s.unshift(l);
8714 else if ((t.push(l), !r)) break;
8715 }
8716 t.push(...s);
8717 }
8718 function ha(t, e, i) {
8719 const s = t.interpolate(e, i);
8720 if (!s) return {};
8721 const n = s[i],
8722 o = t.segments,
8723 a = t.points;
8724 let r = !1,
8725 l = !1;
8726 for (let t = 0; t < o.length; t++) {
8727 const e = o[t],
8728 s = a[e.start][i],
8729 h = a[e.end][i];
8730 if (tt(n, s, h)) {
8731 ((r = n === s), (l = n === h));
8732 break;
8733 }
8734 }
8735 return { first: r, last: l, point: s };
8736 }
8737 class ca {
8738 constructor(t) {
8739 ((this.x = t.x), (this.y = t.y), (this.radius = t.radius));
8740 }
8741 pathSegment(t, e, i) {
8742 const { x: s, y: n, radius: o } = this;
8743 return ((e = e || { start: 0, end: O }), t.arc(s, n, o, e.end, e.start, !0), !i.bounds);
8744 }
8745 interpolate(t) {
8746 const { x: e, y: i, radius: s } = this,
8747 n = t.angle;
8748 return { x: e + Math.cos(n) * s, y: i + Math.sin(n) * s, angle: n };
8749 }
8750 }
8751 function da(t) {
8752 const { chart: e, fill: i, line: s } = t;
8753 if (a(i))
8754 return (function (t, e) {
8755 const i = t.getDatasetMeta(e),
8756 s = i && t.isDatasetVisible(e);
8757 return s ? i.dataset : null;
8758 })(e, i);
8759 if ("stack" === i)
8760 return (function (t) {
8761 const { scale: e, index: i, line: s } = t,
8762 n = [],
8763 o = s.segments,
8764 a = s.points,
8765 r = (function (t, e) {
8766 const i = [],
8767 s = t.getMatchingVisibleMetas("line");
8768 for (let t = 0; t < s.length; t++) {
8769 const n = s[t];
8770 if (n.index === e) break;
8771 n.hidden || i.unshift(n.dataset);
8772 }
8773 return i;
8774 })(e, i);
8775 r.push(na({ x: null, y: e.bottom }, s));
8776 for (let t = 0; t < o.length; t++) {
8777 const e = o[t];
8778 for (let t = e.start; t <= e.end; t++) la(n, a[t], r);
8779 }
8780 return new oo({ points: n, options: {} });
8781 })(t);
8782 if ("shape" === i) return !0;
8783 const n = (function (t) {
8784 const e = t.scale || {};
8785 if (e.getPointPositionForValue)
8786 return (function (t) {
8787 const { scale: e, fill: i } = t,
8788 s = e.options,
8789 n = e.getLabels().length,
8790 a = s.reverse ? e.max : e.min,
8791 r = (function (t, e, i) {
8792 let s;
8793 return (
8794 (s =
8795 "start" === t
8796 ? i
8797 : "end" === t
8798 ? e.options.reverse
8799 ? e.min
8800 : e.max
8801 : o(t)
8802 ? t.value
8803 : e.getBaseValue()),
8804 s
8805 );
8806 })(i, e, a),
8807 l = [];
8808 if (s.grid.circular) {
8809 const t = e.getPointPositionForValue(0, a);
8810 return new ca({ x: t.x, y: t.y, radius: e.getDistanceFromCenterForValue(r) });
8811 }
8812 for (let t = 0; t < n; ++t) l.push(e.getPointPositionForValue(t, r));
8813 return l;
8814 })(t);
8815 return (function (t) {
8816 const { scale: e = {}, fill: i } = t,
8817 s = (function (t, e) {
8818 let i = null;
8819 return (
8820 "start" === t
8821 ? (i = e.bottom)
8822 : "end" === t
8823 ? (i = e.top)
8824 : o(t)
8825 ? (i = e.getPixelForValue(t.value))
8826 : e.getBasePixel && (i = e.getBasePixel()),
8827 i
8828 );
8829 })(i, e);
8830 if (a(s)) {
8831 const t = e.isHorizontal();
8832 return { x: t ? s : null, y: t ? null : s };
8833 }
8834 return null;
8835 })(t);
8836 })(t);
8837 return n instanceof ca ? n : na(n, s);
8838 }
8839 function ua(t, e, i) {
8840 const s = da(e),
8841 { chart: n, index: o, line: a, scale: r, axis: l } = e,
8842 h = a.options,
8843 c = h.fill,
8844 d = h.backgroundColor,
8845 { above: u = d, below: f = d } = c || {},
8846 g = n.getDatasetMeta(o),
8847 p = Ni(n, g);
8848 s &&
8849 a.points.length &&
8850 (Ie(t, i),
8851 (function (t, e) {
8852 const { line: i, target: s, above: n, below: o, area: a, scale: r, clip: l } = e,
8853 h = i._loop ? "angle" : e.axis;
8854 t.save();
8855 let c = o;
8856 o !== n &&
8857 ("x" === h
8858 ? (fa(t, s, a.top),
8859 pa(t, { line: i, target: s, color: n, scale: r, property: h, clip: l }),
8860 t.restore(),
8861 t.save(),
8862 fa(t, s, a.bottom))
8863 : "y" === h &&
8864 (ga(t, s, a.left),
8865 pa(t, { line: i, target: s, color: o, scale: r, property: h, clip: l }),
8866 t.restore(),
8867 t.save(),
8868 ga(t, s, a.right),
8869 (c = n)));
8870 (pa(t, { line: i, target: s, color: c, scale: r, property: h, clip: l }), t.restore());
8871 })(t, { line: a, target: s, above: u, below: f, area: i, scale: r, axis: l, clip: p }),
8872 ze(t));
8873 }
8874 function fa(t, e, i) {
8875 const { segments: s, points: n } = e;
8876 let o = !0,
8877 a = !1;
8878 t.beginPath();
8879 for (const r of s) {
8880 const { start: s, end: l } = r,
8881 h = n[s],
8882 c = n[ia(s, l, n)];
8883 (o ? (t.moveTo(h.x, h.y), (o = !1)) : (t.lineTo(h.x, i), t.lineTo(h.x, h.y)),
8884 (a = !!e.pathSegment(t, r, { move: a })),
8885 a ? t.closePath() : t.lineTo(c.x, i));
8886 }
8887 (t.lineTo(e.first().x, i), t.closePath(), t.clip());
8888 }
8889 function ga(t, e, i) {
8890 const { segments: s, points: n } = e;
8891 let o = !0,
8892 a = !1;
8893 t.beginPath();
8894 for (const r of s) {
8895 const { start: s, end: l } = r,
8896 h = n[s],
8897 c = n[ia(s, l, n)];
8898 (o ? (t.moveTo(h.x, h.y), (o = !1)) : (t.lineTo(i, h.y), t.lineTo(h.x, h.y)),
8899 (a = !!e.pathSegment(t, r, { move: a })),
8900 a ? t.closePath() : t.lineTo(i, c.y));
8901 }
8902 (t.lineTo(i, e.first().y), t.closePath(), t.clip());
8903 }
8904 function pa(t, e) {
8905 const { line: i, target: s, property: n, color: o, scale: a, clip: r } = e,
8906 l = (function (t, e, i) {
8907 const s = t.segments,
8908 n = t.points,
8909 o = e.points,
8910 a = [];
8911 for (const t of s) {
8912 let { start: s, end: r } = t;
8913 r = ia(s, r, n);
8914 const l = ea(i, n[s], n[r], t.loop);
8915 if (!e.segments) {
8916 a.push({ source: t, target: l, start: n[s], end: n[r] });
8917 continue;
8918 }
8919 const h = Ii(e, l);
8920 for (const e of h) {
8921 const s = ea(i, o[e.start], o[e.end], e.loop),
8922 r = Ri(t, n, s);
8923 for (const t of r)
8924 a.push({
8925 source: t,
8926 target: e,
8927 start: { [i]: sa(l, s, "start", Math.max) },
8928 end: { [i]: sa(l, s, "end", Math.min) },
8929 });
8930 }
8931 }
8932 return a;
8933 })(i, s, n);
8934 for (const { source: e, target: h, start: c, end: d } of l) {
8935 const { style: { backgroundColor: l = o } = {} } = e,
8936 u = !0 !== s;
8937 (t.save(), (t.fillStyle = l), ma(t, a, r, u && ea(n, c, d)), t.beginPath());
8938 const f = !!i.pathSegment(t, e);
8939 let g;
8940 if (u) {
8941 f ? t.closePath() : xa(t, s, d, n);
8942 const e = !!s.pathSegment(t, h, { move: f, reverse: !0 });
8943 ((g = f && e), g || xa(t, s, c, n));
8944 }
8945 (t.closePath(), t.fill(g ? "evenodd" : "nonzero"), t.restore());
8946 }
8947 }
8948 function ma(t, e, i, s) {
8949 const n = e.chart.chartArea,
8950 { property: o, start: a, end: r } = s || {};
8951 if ("x" === o || "y" === o) {
8952 let e, s, l, h;
8953 ("x" === o ? ((e = a), (s = n.top), (l = r), (h = n.bottom)) : ((e = n.left), (s = a), (l = n.right), (h = r)),
8954 t.beginPath(),
8955 i &&
8956 ((e = Math.max(e, i.left)),
8957 (l = Math.min(l, i.right)),
8958 (s = Math.max(s, i.top)),
8959 (h = Math.min(h, i.bottom))),
8960 t.rect(e, s, l - e, h - s),
8961 t.clip());
8962 }
8963 }
8964 function xa(t, e, i, s) {
8965 const n = e.interpolate(i, s);
8966 n && t.lineTo(n.x, n.y);
8967 }
8968 var ba = {
8969 id: "filler",
8970 afterDatasetsUpdate(t, e, i) {
8971 const s = (t.data.datasets || []).length,
8972 n = [];
8973 let o, a, r, l;
8974 for (a = 0; a < s; ++a)
8975 ((o = t.getDatasetMeta(a)),
8976 (r = o.dataset),
8977 (l = null),
8978 r &&
8979 r.options &&
8980 r instanceof oo &&
8981 (l = {
8982 visible: t.isDatasetVisible(a),
8983 index: a,
8984 fill: ra(r, a, s),
8985 chart: t,
8986 axis: o.controller.options.indexAxis,
8987 scale: o.vScale,
8988 line: r,
8989 }),
8990 (o.$filler = l),
8991 n.push(l));
8992 for (a = 0; a < s; ++a) ((l = n[a]), l && !1 !== l.fill && (l.fill = aa(n, a, i.propagate)));
8993 },
8994 beforeDraw(t, e, i) {
8995 const s = "beforeDraw" === i.drawTime,
8996 n = t.getSortedVisibleDatasetMetas(),
8997 o = t.chartArea;
8998 for (let e = n.length - 1; e >= 0; --e) {
8999 const i = n[e].$filler;
9000 i && (i.line.updateControlPoints(o, i.axis), s && i.fill && ua(t.ctx, i, o));
9001 }
9002 },
9003 beforeDatasetsDraw(t, e, i) {
9004 if ("beforeDatasetsDraw" !== i.drawTime) return;
9005 const s = t.getSortedVisibleDatasetMetas();
9006 for (let e = s.length - 1; e >= 0; --e) {
9007 const i = s[e].$filler;
9008 oa(i) && ua(t.ctx, i, t.chartArea);
9009 }
9010 },
9011 beforeDatasetDraw(t, e, i) {
9012 const s = e.meta.$filler;
9013 oa(s) && "beforeDatasetDraw" === i.drawTime && ua(t.ctx, s, t.chartArea);
9014 },
9015 defaults: { propagate: !0, drawTime: "beforeDatasetDraw" },
9016 };
9017 const _a = (t, e) => {
9018 let { boxHeight: i = e, boxWidth: s = e } = t;
9019 return (
9020 t.usePointStyle && ((i = Math.min(i, e)), (s = t.pointStyleWidth || Math.min(s, e))),
9021 { boxWidth: s, boxHeight: i, itemHeight: Math.max(e, i) }
9022 );
9023 };
9024 class ya extends $s {
9025 constructor(t) {
9026 (super(),
9027 (this._added = !1),
9028 (this.legendHitBoxes = []),
9029 (this._hoveredItem = null),
9030 (this.doughnutMode = !1),
9031 (this.chart = t.chart),
9032 (this.options = t.options),
9033 (this.ctx = t.ctx),
9034 (this.legendItems = void 0),
9035 (this.columnSizes = void 0),
9036 (this.lineWidths = void 0),
9037 (this.maxHeight = void 0),
9038 (this.maxWidth = void 0),
9039 (this.top = void 0),
9040 (this.bottom = void 0),
9041 (this.left = void 0),
9042 (this.right = void 0),
9043 (this.height = void 0),
9044 (this.width = void 0),
9045 (this._margins = void 0),
9046 (this.position = void 0),
9047 (this.weight = void 0),
9048 (this.fullSize = void 0));
9049 }
9050 update(t, e, i) {
9051 ((this.maxWidth = t),
9052 (this.maxHeight = e),
9053 (this._margins = i),
9054 this.setDimensions(),
9055 this.buildLabels(),
9056 this.fit());
9057 }
9058 setDimensions() {
9059 this.isHorizontal()
9060 ? ((this.width = this.maxWidth), (this.left = this._margins.left), (this.right = this.width))
9061 : ((this.height = this.maxHeight), (this.top = this._margins.top), (this.bottom = this.height));
9062 }
9063 buildLabels() {
9064 const t = this.options.labels || {};
9065 let e = d(t.generateLabels, [this.chart], this) || [];
9066 (t.filter && (e = e.filter((e) => t.filter(e, this.chart.data))),
9067 t.sort && (e = e.sort((e, i) => t.sort(e, i, this.chart.data))),
9068 this.options.reverse && e.reverse(),
9069 (this.legendItems = e));
9070 }
9071 fit() {
9072 const { options: t, ctx: e } = this;
9073 if (!t.display) return void (this.width = this.height = 0);
9074 const i = t.labels,
9075 s = Si(i.font),
9076 n = s.size,
9077 o = this._computeTitleHeight(),
9078 { boxWidth: a, itemHeight: r } = _a(i, n);
9079 let l, h;
9080 ((e.font = s.string),
9081 this.isHorizontal()
9082 ? ((l = this.maxWidth), (h = this._fitRows(o, n, a, r) + 10))
9083 : ((h = this.maxHeight), (l = this._fitCols(o, s, a, r) + 10)),
9084 (this.width = Math.min(l, t.maxWidth || this.maxWidth)),
9085 (this.height = Math.min(h, t.maxHeight || this.maxHeight)));
9086 }
9087 _fitRows(t, e, i, s) {
9088 const {
9089 ctx: n,
9090 maxWidth: o,
9091 options: {
9092 labels: { padding: a },
9093 },
9094 } = this,
9095 r = (this.legendHitBoxes = []),
9096 l = (this.lineWidths = [0]),
9097 h = s + a;
9098 let c = t;
9099 ((n.textAlign = "left"), (n.textBaseline = "middle"));
9100 let d = -1,
9101 u = -h;
9102 return (
9103 this.legendItems.forEach((t, f) => {
9104 const g = i + e / 2 + n.measureText(t.text).width;
9105 ((0 === f || l[l.length - 1] + g + 2 * a > o) &&
9106 ((c += h), (l[l.length - (f > 0 ? 0 : 1)] = 0), (u += h), d++),
9107 (r[f] = { left: 0, top: u, row: d, width: g, height: s }),
9108 (l[l.length - 1] += g + a));
9109 }),
9110 c
9111 );
9112 }
9113 _fitCols(t, e, i, s) {
9114 const {
9115 ctx: n,
9116 maxHeight: o,
9117 options: {
9118 labels: { padding: a },
9119 },
9120 } = this,
9121 r = (this.legendHitBoxes = []),
9122 l = (this.columnSizes = []),
9123 h = o - t;
9124 let c = a,
9125 d = 0,
9126 u = 0,
9127 f = 0,
9128 g = 0;
9129 return (
9130 this.legendItems.forEach((t, o) => {
9131 const { itemWidth: p, itemHeight: m } = (function (t, e, i, s, n) {
9132 const o = (function (t, e, i, s) {
9133 let n = t.text;
9134 n && "string" != typeof n && (n = n.reduce((t, e) => (t.length > e.length ? t : e)));
9135 return e + i.size / 2 + s.measureText(n).width;
9136 })(s, t, e, i),
9137 a = (function (t, e, i) {
9138 let s = t;
9139 "string" != typeof e.text && (s = va(e, i));
9140 return s;
9141 })(n, s, e.lineHeight);
9142 return { itemWidth: o, itemHeight: a };
9143 })(i, e, n, t, s);
9144 (o > 0 &&
9145 u + m + 2 * a > h &&
9146 ((c += d + a), l.push({ width: d, height: u }), (f += d + a), g++, (d = u = 0)),
9147 (r[o] = { left: f, top: u, col: g, width: p, height: m }),
9148 (d = Math.max(d, p)),
9149 (u += m + a));
9150 }),
9151 (c += d),
9152 l.push({ width: d, height: u }),
9153 c
9154 );
9155 }
9156 adjustHitBoxes() {
9157 if (!this.options.display) return;
9158 const t = this._computeTitleHeight(),
9159 {
9160 legendHitBoxes: e,
9161 options: {
9162 align: i,
9163 labels: { padding: s },
9164 rtl: n,
9165 },
9166 } = this,
9167 o = Oi(n, this.left, this.width);
9168 if (this.isHorizontal()) {
9169 let n = 0,
9170 a = ft(i, this.left + s, this.right - this.lineWidths[n]);
9171 for (const r of e)
9172 (n !== r.row && ((n = r.row), (a = ft(i, this.left + s, this.right - this.lineWidths[n]))),
9173 (r.top += this.top + t + s),
9174 (r.left = o.leftForLtr(o.x(a), r.width)),
9175 (a += r.width + s));
9176 } else {
9177 let n = 0,
9178 a = ft(i, this.top + t + s, this.bottom - this.columnSizes[n].height);
9179 for (const r of e)
9180 (r.col !== n && ((n = r.col), (a = ft(i, this.top + t + s, this.bottom - this.columnSizes[n].height))),
9181 (r.top = a),
9182 (r.left += this.left + s),
9183 (r.left = o.leftForLtr(o.x(r.left), r.width)),
9184 (a += r.height + s));
9185 }
9186 }
9187 isHorizontal() {
9188 return "top" === this.options.position || "bottom" === this.options.position;
9189 }
9190 draw() {
9191 if (this.options.display) {
9192 const t = this.ctx;
9193 (Ie(t, this), this._draw(), ze(t));
9194 }
9195 }
9196 _draw() {
9197 const { options: t, columnSizes: e, lineWidths: i, ctx: s } = this,
9198 { align: n, labels: o } = t,
9199 a = ue.color,
9200 r = Oi(t.rtl, this.left, this.width),
9201 h = Si(o.font),
9202 { padding: c } = o,
9203 d = h.size,
9204 u = d / 2;
9205 let f;
9206 (this.drawTitle(),
9207 (s.textAlign = r.textAlign("left")),
9208 (s.textBaseline = "middle"),
9209 (s.lineWidth = 0.5),
9210 (s.font = h.string));
9211 const { boxWidth: g, boxHeight: p, itemHeight: m } = _a(o, d),
9212 x = this.isHorizontal(),
9213 b = this._computeTitleHeight();
9214 ((f = x
9215 ? { x: ft(n, this.left + c, this.right - i[0]), y: this.top + c + b, line: 0 }
9216 : { x: this.left + c, y: ft(n, this.top + b + c, this.bottom - e[0].height), line: 0 }),
9217 Ai(this.ctx, t.textDirection));
9218 const _ = m + c;
9219 (this.legendItems.forEach((y, v) => {
9220 ((s.strokeStyle = y.fontColor), (s.fillStyle = y.fontColor));
9221 const M = s.measureText(y.text).width,
9222 w = r.textAlign(y.textAlign || (y.textAlign = o.textAlign)),
9223 k = g + u + M;
9224 let S = f.x,
9225 P = f.y;
9226 (r.setWidth(this.width),
9227 x
9228 ? v > 0 &&
9229 S + k + c > this.right &&
9230 ((P = f.y += _), f.line++, (S = f.x = ft(n, this.left + c, this.right - i[f.line])))
9231 : v > 0 &&
9232 P + _ > this.bottom &&
9233 ((S = f.x = S + e[f.line].width + c),
9234 f.line++,
9235 (P = f.y = ft(n, this.top + b + c, this.bottom - e[f.line].height))));
9236 if (
9237 ((function (t, e, i) {
9238 if (isNaN(g) || g <= 0 || isNaN(p) || p < 0) return;
9239 s.save();
9240 const n = l(i.lineWidth, 1);
9241 if (
9242 ((s.fillStyle = l(i.fillStyle, a)),
9243 (s.lineCap = l(i.lineCap, "butt")),
9244 (s.lineDashOffset = l(i.lineDashOffset, 0)),
9245 (s.lineJoin = l(i.lineJoin, "miter")),
9246 (s.lineWidth = n),
9247 (s.strokeStyle = l(i.strokeStyle, a)),
9248 s.setLineDash(l(i.lineDash, [])),
9249 o.usePointStyle)
9250 ) {
9251 const a = {
9252 radius: (p * Math.SQRT2) / 2,
9253 pointStyle: i.pointStyle,
9254 rotation: i.rotation,
9255 borderWidth: n,
9256 },
9257 l = r.xPlus(t, g / 2);
9258 Ee(s, a, l, e + u, o.pointStyleWidth && g);
9259 } else {
9260 const o = e + Math.max((d - p) / 2, 0),
9261 a = r.leftForLtr(t, g),
9262 l = wi(i.borderRadius);
9263 (s.beginPath(),
9264 Object.values(l).some((t) => 0 !== t)
9265 ? He(s, { x: a, y: o, w: g, h: p, radius: l })
9266 : s.rect(a, o, g, p),
9267 s.fill(),
9268 0 !== n && s.stroke());
9269 }
9270 s.restore();
9271 })(r.x(S), P, y),
9272 (S = gt(w, S + g + u, x ? S + k : this.right, t.rtl)),
9273 (function (t, e, i) {
9274 Ne(s, i.text, t, e + m / 2, h, { strikethrough: i.hidden, textAlign: r.textAlign(i.textAlign) });
9275 })(r.x(S), P, y),
9276 x)
9277 )
9278 f.x += k + c;
9279 else if ("string" != typeof y.text) {
9280 const t = h.lineHeight;
9281 f.y += va(y, t) + c;
9282 } else f.y += _;
9283 }),
9284 Ti(this.ctx, t.textDirection));
9285 }
9286 drawTitle() {
9287 const t = this.options,
9288 e = t.title,
9289 i = Si(e.font),
9290 s = ki(e.padding);
9291 if (!e.display) return;
9292 const n = Oi(t.rtl, this.left, this.width),
9293 o = this.ctx,
9294 a = e.position,
9295 r = i.size / 2,
9296 l = s.top + r;
9297 let h,
9298 c = this.left,
9299 d = this.width;
9300 if (this.isHorizontal())
9301 ((d = Math.max(...this.lineWidths)), (h = this.top + l), (c = ft(t.align, c, this.right - d)));
9302 else {
9303 const e = this.columnSizes.reduce((t, e) => Math.max(t, e.height), 0);
9304 h = l + ft(t.align, this.top, this.bottom - e - t.labels.padding - this._computeTitleHeight());
9305 }
9306 const u = ft(a, c, c + d);
9307 ((o.textAlign = n.textAlign(ut(a))),
9308 (o.textBaseline = "middle"),
9309 (o.strokeStyle = e.color),
9310 (o.fillStyle = e.color),
9311 (o.font = i.string),
9312 Ne(o, e.text, u, h, i));
9313 }
9314 _computeTitleHeight() {
9315 const t = this.options.title,
9316 e = Si(t.font),
9317 i = ki(t.padding);
9318 return t.display ? e.lineHeight + i.height : 0;
9319 }
9320 _getLegendItemAt(t, e) {
9321 let i, s, n;
9322 if (tt(t, this.left, this.right) && tt(e, this.top, this.bottom))
9323 for (n = this.legendHitBoxes, i = 0; i < n.length; ++i)
9324 if (((s = n[i]), tt(t, s.left, s.left + s.width) && tt(e, s.top, s.top + s.height)))
9325 return this.legendItems[i];
9326 return null;
9327 }
9328 handleEvent(t) {
9329 const e = this.options;
9330 if (
9331 !(function (t, e) {
9332 if (("mousemove" === t || "mouseout" === t) && (e.onHover || e.onLeave)) return !0;
9333 if (e.onClick && ("click" === t || "mouseup" === t)) return !0;
9334 return !1;
9335 })(t.type, e)
9336 )
9337 return;
9338 const i = this._getLegendItemAt(t.x, t.y);
9339 if ("mousemove" === t.type || "mouseout" === t.type) {
9340 const o = this._hoveredItem,
9341 a = ((n = i), null !== (s = o) && null !== n && s.datasetIndex === n.datasetIndex && s.index === n.index);
9342 (o && !a && d(e.onLeave, [t, o, this], this),
9343 (this._hoveredItem = i),
9344 i && !a && d(e.onHover, [t, i, this], this));
9345 } else i && d(e.onClick, [t, i, this], this);
9346 var s, n;
9347 }
9348 }
9349 function va(t, e) {
9350 return e * (t.text ? t.text.length : 0);
9351 }
9352 var Ma = {
9353 id: "legend",
9354 _element: ya,
9355 start(t, e, i) {
9356 const s = (t.legend = new ya({ ctx: t.ctx, options: i, chart: t }));
9357 (ls.configure(t, s, i), ls.addBox(t, s));
9358 },
9359 stop(t) {
9360 (ls.removeBox(t, t.legend), delete t.legend);
9361 },
9362 beforeUpdate(t, e, i) {
9363 const s = t.legend;
9364 (ls.configure(t, s, i), (s.options = i));
9365 },
9366 afterUpdate(t) {
9367 const e = t.legend;
9368 (e.buildLabels(), e.adjustHitBoxes());
9369 },
9370 afterEvent(t, e) {
9371 e.replay || t.legend.handleEvent(e.event);
9372 },
9373 defaults: {
9374 display: !0,
9375 position: "top",
9376 align: "center",
9377 fullSize: !0,
9378 reverse: !1,
9379 weight: 1e3,
9380 onClick(t, e, i) {
9381 const s = e.datasetIndex,
9382 n = i.chart;
9383 n.isDatasetVisible(s) ? (n.hide(s), (e.hidden = !0)) : (n.show(s), (e.hidden = !1));
9384 },
9385 onHover: null,
9386 onLeave: null,
9387 labels: {
9388 color: (t) => t.chart.options.color,
9389 boxWidth: 40,
9390 padding: 10,
9391 generateLabels(t) {
9392 const e = t.data.datasets,
9393 {
9394 labels: { usePointStyle: i, pointStyle: s, textAlign: n, color: o, useBorderRadius: a, borderRadius: r },
9395 } = t.legend.options;
9396 return t._getSortedDatasetMetas().map((t) => {
9397 const l = t.controller.getStyle(i ? 0 : void 0),
9398 h = ki(l.borderWidth);
9399 return {
9400 text: e[t.index].label,
9401 fillStyle: l.backgroundColor,
9402 fontColor: o,
9403 hidden: !t.visible,
9404 lineCap: l.borderCapStyle,
9405 lineDash: l.borderDash,
9406 lineDashOffset: l.borderDashOffset,
9407 lineJoin: l.borderJoinStyle,
9408 lineWidth: (h.width + h.height) / 4,
9409 strokeStyle: l.borderColor,
9410 pointStyle: s || l.pointStyle,
9411 rotation: l.rotation,
9412 textAlign: n || l.textAlign,
9413 borderRadius: a && (r || l.borderRadius),
9414 datasetIndex: t.index,
9415 };
9416 }, this);
9417 },
9418 },
9419 title: { color: (t) => t.chart.options.color, display: !1, position: "center", text: "" },
9420 },
9421 descriptors: {
9422 _scriptable: (t) => !t.startsWith("on"),
9423 labels: { _scriptable: (t) => !["generateLabels", "filter", "sort"].includes(t) },
9424 },
9425 };
9426 class wa extends $s {
9427 constructor(t) {
9428 (super(),
9429 (this.chart = t.chart),
9430 (this.options = t.options),
9431 (this.ctx = t.ctx),
9432 (this._padding = void 0),
9433 (this.top = void 0),
9434 (this.bottom = void 0),
9435 (this.left = void 0),
9436 (this.right = void 0),
9437 (this.width = void 0),
9438 (this.height = void 0),
9439 (this.position = void 0),
9440 (this.weight = void 0),
9441 (this.fullSize = void 0));
9442 }
9443 update(t, e) {
9444 const i = this.options;
9445 if (((this.left = 0), (this.top = 0), !i.display))
9446 return void (this.width = this.height = this.right = this.bottom = 0);
9447 ((this.width = this.right = t), (this.height = this.bottom = e));
9448 const s = n(i.text) ? i.text.length : 1;
9449 this._padding = ki(i.padding);
9450 const o = s * Si(i.font).lineHeight + this._padding.height;
9451 this.isHorizontal() ? (this.height = o) : (this.width = o);
9452 }
9453 isHorizontal() {
9454 const t = this.options.position;
9455 return "top" === t || "bottom" === t;
9456 }
9457 _drawArgs(t) {
9458 const { top: e, left: i, bottom: s, right: n, options: o } = this,
9459 a = o.align;
9460 let r,
9461 l,
9462 h,
9463 c = 0;
9464 return (
9465 this.isHorizontal()
9466 ? ((l = ft(a, i, n)), (h = e + t), (r = n - i))
9467 : ("left" === o.position
9468 ? ((l = i + t), (h = ft(a, s, e)), (c = -0.5 * C))
9469 : ((l = n - t), (h = ft(a, e, s)), (c = 0.5 * C)),
9470 (r = s - e)),
9471 { titleX: l, titleY: h, maxWidth: r, rotation: c }
9472 );
9473 }
9474 draw() {
9475 const t = this.ctx,
9476 e = this.options;
9477 if (!e.display) return;
9478 const i = Si(e.font),
9479 s = i.lineHeight / 2 + this._padding.top,
9480 { titleX: n, titleY: o, maxWidth: a, rotation: r } = this._drawArgs(s);
9481 Ne(t, e.text, 0, 0, i, {
9482 color: e.color,
9483 maxWidth: a,
9484 rotation: r,
9485 textAlign: ut(e.align),
9486 textBaseline: "middle",
9487 translation: [n, o],
9488 });
9489 }
9490 }
9491 var ka = {
9492 id: "title",
9493 _element: wa,
9494 start(t, e, i) {
9495 !(function (t, e) {
9496 const i = new wa({ ctx: t.ctx, options: e, chart: t });
9497 (ls.configure(t, i, e), ls.addBox(t, i), (t.titleBlock = i));
9498 })(t, i);
9499 },
9500 stop(t) {
9501 const e = t.titleBlock;
9502 (ls.removeBox(t, e), delete t.titleBlock);
9503 },
9504 beforeUpdate(t, e, i) {
9505 const s = t.titleBlock;
9506 (ls.configure(t, s, i), (s.options = i));
9507 },
9508 defaults: {
9509 align: "center",
9510 display: !1,
9511 font: { weight: "bold" },
9512 fullSize: !0,
9513 padding: 10,
9514 position: "top",
9515 text: "",
9516 weight: 2e3,
9517 },
9518 defaultRoutes: { color: "color" },
9519 descriptors: { _scriptable: !0, _indexable: !1 },
9520 };
9521 const Sa = new WeakMap();
9522 var Pa = {
9523 id: "subtitle",
9524 start(t, e, i) {
9525 const s = new wa({ ctx: t.ctx, options: i, chart: t });
9526 (ls.configure(t, s, i), ls.addBox(t, s), Sa.set(t, s));
9527 },
9528 stop(t) {
9529 (ls.removeBox(t, Sa.get(t)), Sa.delete(t));
9530 },
9531 beforeUpdate(t, e, i) {
9532 const s = Sa.get(t);
9533 (ls.configure(t, s, i), (s.options = i));
9534 },
9535 defaults: {
9536 align: "center",
9537 display: !1,
9538 font: { weight: "normal" },
9539 fullSize: !0,
9540 padding: 0,
9541 position: "top",
9542 text: "",
9543 weight: 1500,
9544 },
9545 defaultRoutes: { color: "color" },
9546 descriptors: { _scriptable: !0, _indexable: !1 },
9547 };
9548 const Da = {
9549 average(t) {
9550 if (!t.length) return !1;
9551 let e,
9552 i,
9553 s = new Set(),
9554 n = 0,
9555 o = 0;
9556 for (e = 0, i = t.length; e < i; ++e) {
9557 const i = t[e].element;
9558 if (i && i.hasValue()) {
9559 const t = i.tooltipPosition();
9560 (s.add(t.x), (n += t.y), ++o);
9561 }
9562 }
9563 if (0 === o || 0 === s.size) return !1;
9564 return { x: [...s].reduce((t, e) => t + e) / s.size, y: n / o };
9565 },
9566 nearest(t, e) {
9567 if (!t.length) return !1;
9568 let i,
9569 s,
9570 n,
9571 o = e.x,
9572 a = e.y,
9573 r = Number.POSITIVE_INFINITY;
9574 for (i = 0, s = t.length; i < s; ++i) {
9575 const s = t[i].element;
9576 if (s && s.hasValue()) {
9577 const t = q(e, s.getCenterPoint());
9578 t < r && ((r = t), (n = s));
9579 }
9580 }
9581 if (n) {
9582 const t = n.tooltipPosition();
9583 ((o = t.x), (a = t.y));
9584 }
9585 return { x: o, y: a };
9586 },
9587 };
9588 function Ca(t, e) {
9589 return (e && (n(e) ? Array.prototype.push.apply(t, e) : t.push(e)), t);
9590 }
9591 function Oa(t) {
9592 return ("string" == typeof t || t instanceof String) && t.indexOf("\n") > -1 ? t.split("\n") : t;
9593 }
9594 function Aa(t, e) {
9595 const { element: i, datasetIndex: s, index: n } = e,
9596 o = t.getDatasetMeta(s).controller,
9597 { label: a, value: r } = o.getLabelAndValue(n);
9598 return {
9599 chart: t,
9600 label: a,
9601 parsed: o.getParsed(n),
9602 raw: t.data.datasets[s].data[n],
9603 formattedValue: r,
9604 dataset: o.getDataset(),
9605 dataIndex: n,
9606 datasetIndex: s,
9607 element: i,
9608 };
9609 }
9610 function Ta(t, e) {
9611 const i = t.chart.ctx,
9612 { body: s, footer: n, title: o } = t,
9613 { boxWidth: a, boxHeight: r } = e,
9614 l = Si(e.bodyFont),
9615 h = Si(e.titleFont),
9616 c = Si(e.footerFont),
9617 d = o.length,
9618 f = n.length,
9619 g = s.length,
9620 p = ki(e.padding);
9621 let m = p.height,
9622 x = 0,
9623 b = s.reduce((t, e) => t + e.before.length + e.lines.length + e.after.length, 0);
9624 if (
9625 ((b += t.beforeBody.length + t.afterBody.length),
9626 d && (m += d * h.lineHeight + (d - 1) * e.titleSpacing + e.titleMarginBottom),
9627 b)
9628 ) {
9629 m +=
9630 g * (e.displayColors ? Math.max(r, l.lineHeight) : l.lineHeight) +
9631 (b - g) * l.lineHeight +
9632 (b - 1) * e.bodySpacing;
9633 }
9634 f && (m += e.footerMarginTop + f * c.lineHeight + (f - 1) * e.footerSpacing);
9635 let _ = 0;
9636 const y = function (t) {
9637 x = Math.max(x, i.measureText(t).width + _);
9638 };
9639 return (
9640 i.save(),
9641 (i.font = h.string),
9642 u(t.title, y),
9643 (i.font = l.string),
9644 u(t.beforeBody.concat(t.afterBody), y),
9645 (_ = e.displayColors ? a + 2 + e.boxPadding : 0),
9646 u(s, (t) => {
9647 (u(t.before, y), u(t.lines, y), u(t.after, y));
9648 }),
9649 (_ = 0),
9650 (i.font = c.string),
9651 u(t.footer, y),
9652 i.restore(),
9653 (x += p.width),
9654 { width: x, height: m }
9655 );
9656 }
9657 function La(t, e, i, s) {
9658 const { x: n, width: o } = i,
9659 {
9660 width: a,
9661 chartArea: { left: r, right: l },
9662 } = t;
9663 let h = "center";
9664 return (
9665 "center" === s
9666 ? (h = n <= (r + l) / 2 ? "left" : "right")
9667 : n <= o / 2
9668 ? (h = "left")
9669 : n >= a - o / 2 && (h = "right"),
9670 (function (t, e, i, s) {
9671 const { x: n, width: o } = s,
9672 a = i.caretSize + i.caretPadding;
9673 return ("left" === t && n + o + a > e.width) || ("right" === t && n - o - a < 0) || void 0;
9674 })(h, t, e, i) && (h = "center"),
9675 h
9676 );
9677 }
9678 function Ea(t, e, i) {
9679 const s =
9680 i.yAlign ||
9681 e.yAlign ||
9682 (function (t, e) {
9683 const { y: i, height: s } = e;
9684 return i < s / 2 ? "top" : i > t.height - s / 2 ? "bottom" : "center";
9685 })(t, i);
9686 return { xAlign: i.xAlign || e.xAlign || La(t, e, i, s), yAlign: s };
9687 }
9688 function Ra(t, e, i, s) {
9689 const { caretSize: n, caretPadding: o, cornerRadius: a } = t,
9690 { xAlign: r, yAlign: l } = i,
9691 h = n + o,
9692 { topLeft: c, topRight: d, bottomLeft: u, bottomRight: f } = wi(a);
9693 let g = (function (t, e) {
9694 let { x: i, width: s } = t;
9695 return ("right" === e ? (i -= s) : "center" === e && (i -= s / 2), i);
9696 })(e, r);
9697 const p = (function (t, e, i) {
9698 let { y: s, height: n } = t;
9699 return ("top" === e ? (s += i) : (s -= "bottom" === e ? n + i : n / 2), s);
9700 })(e, l, h);
9701 return (
9702 "center" === l
9703 ? "left" === r
9704 ? (g += h)
9705 : "right" === r && (g -= h)
9706 : "left" === r
9707 ? (g -= Math.max(c, u) + n)
9708 : "right" === r && (g += Math.max(d, f) + n),
9709 { x: Z(g, 0, s.width - e.width), y: Z(p, 0, s.height - e.height) }
9710 );
9711 }
9712 function Ia(t, e, i) {
9713 const s = ki(i.padding);
9714 return "center" === e ? t.x + t.width / 2 : "right" === e ? t.x + t.width - s.right : t.x + s.left;
9715 }
9716 function za(t) {
9717 return Ca([], Oa(t));
9718 }
9719 function Fa(t, e) {
9720 const i = e && e.dataset && e.dataset.tooltip && e.dataset.tooltip.callbacks;
9721 return i ? t.override(i) : t;
9722 }
9723 const Va = {
9724 beforeTitle: e,
9725 title(t) {
9726 if (t.length > 0) {
9727 const e = t[0],
9728 i = e.chart.data.labels,
9729 s = i ? i.length : 0;
9730 if (this && this.options && "dataset" === this.options.mode) return e.dataset.label || "";
9731 if (e.label) return e.label;
9732 if (s > 0 && e.dataIndex < s) return i[e.dataIndex];
9733 }
9734 return "";
9735 },
9736 afterTitle: e,
9737 beforeBody: e,
9738 beforeLabel: e,
9739 label(t) {
9740 if (this && this.options && "dataset" === this.options.mode)
9741 return t.label + ": " + t.formattedValue || t.formattedValue;
9742 let e = t.dataset.label || "";
9743 e && (e += ": ");
9744 const i = t.formattedValue;
9745 return (s(i) || (e += i), e);
9746 },
9747 labelColor(t) {
9748 const e = t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);
9749 return {
9750 borderColor: e.borderColor,
9751 backgroundColor: e.backgroundColor,
9752 borderWidth: e.borderWidth,
9753 borderDash: e.borderDash,
9754 borderDashOffset: e.borderDashOffset,
9755 borderRadius: 0,
9756 };
9757 },
9758 labelTextColor() {
9759 return this.options.bodyColor;
9760 },
9761 labelPointStyle(t) {
9762 const e = t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);
9763 return { pointStyle: e.pointStyle, rotation: e.rotation };
9764 },
9765 afterLabel: e,
9766 afterBody: e,
9767 beforeFooter: e,
9768 footer: e,
9769 afterFooter: e,
9770 };
9771 function Ba(t, e, i, s) {
9772 const n = t[e].call(i, s);
9773 return void 0 === n ? Va[e].call(i, s) : n;
9774 }
9775 class Wa extends $s {
9776 static positioners = Da;
9777 constructor(t) {
9778 (super(),
9779 (this.opacity = 0),
9780 (this._active = []),
9781 (this._eventPosition = void 0),
9782 (this._size = void 0),
9783 (this._cachedAnimations = void 0),
9784 (this._tooltipItems = []),
9785 (this.$animations = void 0),
9786 (this.$context = void 0),
9787 (this.chart = t.chart),
9788 (this.options = t.options),
9789 (this.dataPoints = void 0),
9790 (this.title = void 0),
9791 (this.beforeBody = void 0),
9792 (this.body = void 0),
9793 (this.afterBody = void 0),
9794 (this.footer = void 0),
9795 (this.xAlign = void 0),
9796 (this.yAlign = void 0),
9797 (this.x = void 0),
9798 (this.y = void 0),
9799 (this.height = void 0),
9800 (this.width = void 0),
9801 (this.caretX = void 0),
9802 (this.caretY = void 0),
9803 (this.labelColors = void 0),
9804 (this.labelPointStyles = void 0),
9805 (this.labelTextColors = void 0));
9806 }
9807 initialize(t) {
9808 ((this.options = t), (this._cachedAnimations = void 0), (this.$context = void 0));
9809 }
9810 _resolveAnimations() {
9811 const t = this._cachedAnimations;
9812 if (t) return t;
9813 const e = this.chart,
9814 i = this.options.setContext(this.getContext()),
9815 s = i.enabled && e.options.animation && i.animations,
9816 n = new Ts(this.chart, s);
9817 return (s._cacheable && (this._cachedAnimations = Object.freeze(n)), n);
9818 }
9819 getContext() {
9820 return (
9821 this.$context ||
9822 (this.$context =
9823 ((t = this.chart.getContext()),
9824 (e = this),
9825 (i = this._tooltipItems),
9826 Ci(t, { tooltip: e, tooltipItems: i, type: "tooltip" })))
9827 );
9828 var t, e, i;
9829 }
9830 getTitle(t, e) {
9831 const { callbacks: i } = e,
9832 s = Ba(i, "beforeTitle", this, t),
9833 n = Ba(i, "title", this, t),
9834 o = Ba(i, "afterTitle", this, t);
9835 let a = [];
9836 return ((a = Ca(a, Oa(s))), (a = Ca(a, Oa(n))), (a = Ca(a, Oa(o))), a);
9837 }
9838 getBeforeBody(t, e) {
9839 return za(Ba(e.callbacks, "beforeBody", this, t));
9840 }
9841 getBody(t, e) {
9842 const { callbacks: i } = e,
9843 s = [];
9844 return (
9845 u(t, (t) => {
9846 const e = { before: [], lines: [], after: [] },
9847 n = Fa(i, t);
9848 (Ca(e.before, Oa(Ba(n, "beforeLabel", this, t))),
9849 Ca(e.lines, Ba(n, "label", this, t)),
9850 Ca(e.after, Oa(Ba(n, "afterLabel", this, t))),
9851 s.push(e));
9852 }),
9853 s
9854 );
9855 }
9856 getAfterBody(t, e) {
9857 return za(Ba(e.callbacks, "afterBody", this, t));
9858 }
9859 getFooter(t, e) {
9860 const { callbacks: i } = e,
9861 s = Ba(i, "beforeFooter", this, t),
9862 n = Ba(i, "footer", this, t),
9863 o = Ba(i, "afterFooter", this, t);
9864 let a = [];
9865 return ((a = Ca(a, Oa(s))), (a = Ca(a, Oa(n))), (a = Ca(a, Oa(o))), a);
9866 }
9867 _createItems(t) {
9868 const e = this._active,
9869 i = this.chart.data,
9870 s = [],
9871 n = [],
9872 o = [];
9873 let a,
9874 r,
9875 l = [];
9876 for (a = 0, r = e.length; a < r; ++a) l.push(Aa(this.chart, e[a]));
9877 return (
9878 t.filter && (l = l.filter((e, s, n) => t.filter(e, s, n, i))),
9879 t.itemSort && (l = l.sort((e, s) => t.itemSort(e, s, i))),
9880 u(l, (e) => {
9881 const i = Fa(t.callbacks, e);
9882 (s.push(Ba(i, "labelColor", this, e)),
9883 n.push(Ba(i, "labelPointStyle", this, e)),
9884 o.push(Ba(i, "labelTextColor", this, e)));
9885 }),
9886 (this.labelColors = s),
9887 (this.labelPointStyles = n),
9888 (this.labelTextColors = o),
9889 (this.dataPoints = l),
9890 l
9891 );
9892 }
9893 update(t, e) {
9894 const i = this.options.setContext(this.getContext()),
9895 s = this._active;
9896 let n,
9897 o = [];
9898 if (s.length) {
9899 const t = Da[i.position].call(this, s, this._eventPosition);
9900 ((o = this._createItems(i)),
9901 (this.title = this.getTitle(o, i)),
9902 (this.beforeBody = this.getBeforeBody(o, i)),
9903 (this.body = this.getBody(o, i)),
9904 (this.afterBody = this.getAfterBody(o, i)),
9905 (this.footer = this.getFooter(o, i)));
9906 const e = (this._size = Ta(this, i)),
9907 a = Object.assign({}, t, e),
9908 r = Ea(this.chart, i, a),
9909 l = Ra(i, a, r, this.chart);
9910 ((this.xAlign = r.xAlign),
9911 (this.yAlign = r.yAlign),
9912 (n = { opacity: 1, x: l.x, y: l.y, width: e.width, height: e.height, caretX: t.x, caretY: t.y }));
9913 } else 0 !== this.opacity && (n = { opacity: 0 });
9914 ((this._tooltipItems = o),
9915 (this.$context = void 0),
9916 n && this._resolveAnimations().update(this, n),
9917 t && i.external && i.external.call(this, { chart: this.chart, tooltip: this, replay: e }));
9918 }
9919 drawCaret(t, e, i, s) {
9920 const n = this.getCaretPosition(t, i, s);
9921 (e.lineTo(n.x1, n.y1), e.lineTo(n.x2, n.y2), e.lineTo(n.x3, n.y3));
9922 }
9923 getCaretPosition(t, e, i) {
9924 const { xAlign: s, yAlign: n } = this,
9925 { caretSize: o, cornerRadius: a } = i,
9926 { topLeft: r, topRight: l, bottomLeft: h, bottomRight: c } = wi(a),
9927 { x: d, y: u } = t,
9928 { width: f, height: g } = e;
9929 let p, m, x, b, _, y;
9930 return (
9931 "center" === n
9932 ? ((_ = u + g / 2),
9933 "left" === s
9934 ? ((p = d), (m = p - o), (b = _ + o), (y = _ - o))
9935 : ((p = d + f), (m = p + o), (b = _ - o), (y = _ + o)),
9936 (x = p))
9937 : ((m = "left" === s ? d + Math.max(r, h) + o : "right" === s ? d + f - Math.max(l, c) - o : this.caretX),
9938 "top" === n
9939 ? ((b = u), (_ = b - o), (p = m - o), (x = m + o))
9940 : ((b = u + g), (_ = b + o), (p = m + o), (x = m - o)),
9941 (y = b)),
9942 { x1: p, x2: m, x3: x, y1: b, y2: _, y3: y }
9943 );
9944 }
9945 drawTitle(t, e, i) {
9946 const s = this.title,
9947 n = s.length;
9948 let o, a, r;
9949 if (n) {
9950 const l = Oi(i.rtl, this.x, this.width);
9951 for (
9952 t.x = Ia(this, i.titleAlign, i),
9953 e.textAlign = l.textAlign(i.titleAlign),
9954 e.textBaseline = "middle",
9955 o = Si(i.titleFont),
9956 a = i.titleSpacing,
9957 e.fillStyle = i.titleColor,
9958 e.font = o.string,
9959 r = 0;
9960 r < n;
9961 ++r
9962 )
9963 (e.fillText(s[r], l.x(t.x), t.y + o.lineHeight / 2),
9964 (t.y += o.lineHeight + a),
9965 r + 1 === n && (t.y += i.titleMarginBottom - a));
9966 }
9967 }
9968 _drawColorBox(t, e, i, s, n) {
9969 const a = this.labelColors[i],
9970 r = this.labelPointStyles[i],
9971 { boxHeight: l, boxWidth: h } = n,
9972 c = Si(n.bodyFont),
9973 d = Ia(this, "left", n),
9974 u = s.x(d),
9975 f = l < c.lineHeight ? (c.lineHeight - l) / 2 : 0,
9976 g = e.y + f;
9977 if (n.usePointStyle) {
9978 const e = { radius: Math.min(h, l) / 2, pointStyle: r.pointStyle, rotation: r.rotation, borderWidth: 1 },
9979 i = s.leftForLtr(u, h) + h / 2,
9980 o = g + l / 2;
9981 ((t.strokeStyle = n.multiKeyBackground),
9982 (t.fillStyle = n.multiKeyBackground),
9983 Le(t, e, i, o),
9984 (t.strokeStyle = a.borderColor),
9985 (t.fillStyle = a.backgroundColor),
9986 Le(t, e, i, o));
9987 } else {
9988 ((t.lineWidth = o(a.borderWidth) ? Math.max(...Object.values(a.borderWidth)) : a.borderWidth || 1),
9989 (t.strokeStyle = a.borderColor),
9990 t.setLineDash(a.borderDash || []),
9991 (t.lineDashOffset = a.borderDashOffset || 0));
9992 const e = s.leftForLtr(u, h),
9993 i = s.leftForLtr(s.xPlus(u, 1), h - 2),
9994 r = wi(a.borderRadius);
9995 Object.values(r).some((t) => 0 !== t)
9996 ? (t.beginPath(),
9997 (t.fillStyle = n.multiKeyBackground),
9998 He(t, { x: e, y: g, w: h, h: l, radius: r }),
9999 t.fill(),
10000 t.stroke(),
10001 (t.fillStyle = a.backgroundColor),
10002 t.beginPath(),
10003 He(t, { x: i, y: g + 1, w: h - 2, h: l - 2, radius: r }),
10004 t.fill())
10005 : ((t.fillStyle = n.multiKeyBackground),
10006 t.fillRect(e, g, h, l),
10007 t.strokeRect(e, g, h, l),
10008 (t.fillStyle = a.backgroundColor),
10009 t.fillRect(i, g + 1, h - 2, l - 2));
10010 }
10011 t.fillStyle = this.labelTextColors[i];
10012 }
10013 drawBody(t, e, i) {
10014 const { body: s } = this,
10015 { bodySpacing: n, bodyAlign: o, displayColors: a, boxHeight: r, boxWidth: l, boxPadding: h } = i,
10016 c = Si(i.bodyFont);
10017 let d = c.lineHeight,
10018 f = 0;
10019 const g = Oi(i.rtl, this.x, this.width),
10020 p = function (i) {
10021 (e.fillText(i, g.x(t.x + f), t.y + d / 2), (t.y += d + n));
10022 },
10023 m = g.textAlign(o);
10024 let x, b, _, y, v, M, w;
10025 for (
10026 e.textAlign = o,
10027 e.textBaseline = "middle",
10028 e.font = c.string,
10029 t.x = Ia(this, m, i),
10030 e.fillStyle = i.bodyColor,
10031 u(this.beforeBody, p),
10032 f = a && "right" !== m ? ("center" === o ? l / 2 + h : l + 2 + h) : 0,
10033 y = 0,
10034 M = s.length;
10035 y < M;
10036 ++y
10037 ) {
10038 for (
10039 x = s[y],
10040 b = this.labelTextColors[y],
10041 e.fillStyle = b,
10042 u(x.before, p),
10043 _ = x.lines,
10044 a && _.length && (this._drawColorBox(e, t, y, g, i), (d = Math.max(c.lineHeight, r))),
10045 v = 0,
10046 w = _.length;
10047 v < w;
10048 ++v
10049 )
10050 (p(_[v]), (d = c.lineHeight));
10051 u(x.after, p);
10052 }
10053 ((f = 0), (d = c.lineHeight), u(this.afterBody, p), (t.y -= n));
10054 }
10055 drawFooter(t, e, i) {
10056 const s = this.footer,
10057 n = s.length;
10058 let o, a;
10059 if (n) {
10060 const r = Oi(i.rtl, this.x, this.width);
10061 for (
10062 t.x = Ia(this, i.footerAlign, i),
10063 t.y += i.footerMarginTop,
10064 e.textAlign = r.textAlign(i.footerAlign),
10065 e.textBaseline = "middle",
10066 o = Si(i.footerFont),
10067 e.fillStyle = i.footerColor,
10068 e.font = o.string,
10069 a = 0;
10070 a < n;
10071 ++a
10072 )
10073 (e.fillText(s[a], r.x(t.x), t.y + o.lineHeight / 2), (t.y += o.lineHeight + i.footerSpacing));
10074 }
10075 }
10076 drawBackground(t, e, i, s) {
10077 const { xAlign: n, yAlign: o } = this,
10078 { x: a, y: r } = t,
10079 { width: l, height: h } = i,
10080 { topLeft: c, topRight: d, bottomLeft: u, bottomRight: f } = wi(s.cornerRadius);
10081 ((e.fillStyle = s.backgroundColor),
10082 (e.strokeStyle = s.borderColor),
10083 (e.lineWidth = s.borderWidth),
10084 e.beginPath(),
10085 e.moveTo(a + c, r),
10086 "top" === o && this.drawCaret(t, e, i, s),
10087 e.lineTo(a + l - d, r),
10088 e.quadraticCurveTo(a + l, r, a + l, r + d),
10089 "center" === o && "right" === n && this.drawCaret(t, e, i, s),
10090 e.lineTo(a + l, r + h - f),
10091 e.quadraticCurveTo(a + l, r + h, a + l - f, r + h),
10092 "bottom" === o && this.drawCaret(t, e, i, s),
10093 e.lineTo(a + u, r + h),
10094 e.quadraticCurveTo(a, r + h, a, r + h - u),
10095 "center" === o && "left" === n && this.drawCaret(t, e, i, s),
10096 e.lineTo(a, r + c),
10097 e.quadraticCurveTo(a, r, a + c, r),
10098 e.closePath(),
10099 e.fill(),
10100 s.borderWidth > 0 && e.stroke());
10101 }
10102 _updateAnimationTarget(t) {
10103 const e = this.chart,
10104 i = this.$animations,
10105 s = i && i.x,
10106 n = i && i.y;
10107 if (s || n) {
10108 const i = Da[t.position].call(this, this._active, this._eventPosition);
10109 if (!i) return;
10110 const o = (this._size = Ta(this, t)),
10111 a = Object.assign({}, i, this._size),
10112 r = Ea(e, t, a),
10113 l = Ra(t, a, r, e);
10114 (s._to === l.x && n._to === l.y) ||
10115 ((this.xAlign = r.xAlign),
10116 (this.yAlign = r.yAlign),
10117 (this.width = o.width),
10118 (this.height = o.height),
10119 (this.caretX = i.x),
10120 (this.caretY = i.y),
10121 this._resolveAnimations().update(this, l));
10122 }
10123 }
10124 _willRender() {
10125 return !!this.opacity;
10126 }
10127 draw(t) {
10128 const e = this.options.setContext(this.getContext());
10129 let i = this.opacity;
10130 if (!i) return;
10131 this._updateAnimationTarget(e);
10132 const s = { width: this.width, height: this.height },
10133 n = { x: this.x, y: this.y };
10134 i = Math.abs(i) < 0.001 ? 0 : i;
10135 const o = ki(e.padding),
10136 a =
10137 this.title.length ||
10138 this.beforeBody.length ||
10139 this.body.length ||
10140 this.afterBody.length ||
10141 this.footer.length;
10142 e.enabled &&
10143 a &&
10144 (t.save(),
10145 (t.globalAlpha = i),
10146 this.drawBackground(n, t, s, e),
10147 Ai(t, e.textDirection),
10148 (n.y += o.top),
10149 this.drawTitle(n, t, e),
10150 this.drawBody(n, t, e),
10151 this.drawFooter(n, t, e),
10152 Ti(t, e.textDirection),
10153 t.restore());
10154 }
10155 getActiveElements() {
10156 return this._active || [];
10157 }
10158 setActiveElements(t, e) {
10159 const i = this._active,
10160 s = t.map(({ datasetIndex: t, index: e }) => {
10161 const i = this.chart.getDatasetMeta(t);
10162 if (!i) throw new Error("Cannot find a dataset at index " + t);
10163 return { datasetIndex: t, element: i.data[e], index: e };
10164 }),
10165 n = !f(i, s),
10166 o = this._positionChanged(s, e);
10167 (n || o) && ((this._active = s), (this._eventPosition = e), (this._ignoreReplayEvents = !0), this.update(!0));
10168 }
10169 handleEvent(t, e, i = !0) {
10170 if (e && this._ignoreReplayEvents) return !1;
10171 this._ignoreReplayEvents = !1;
10172 const s = this.options,
10173 n = this._active || [],
10174 o = this._getActiveElements(t, n, e, i),
10175 a = this._positionChanged(o, t),
10176 r = e || !f(o, n) || a;
10177 return (
10178 r &&
10179 ((this._active = o),
10180 (s.enabled || s.external) && ((this._eventPosition = { x: t.x, y: t.y }), this.update(!0, e))),
10181 r
10182 );
10183 }
10184 _getActiveElements(t, e, i, s) {
10185 const n = this.options;
10186 if ("mouseout" === t.type) return [];
10187 if (!s)
10188 return e.filter(
10189 (t) =>
10190 this.chart.data.datasets[t.datasetIndex] &&
10191 void 0 !== this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index),
10192 );
10193 const o = this.chart.getElementsAtEventForMode(t, n.mode, n, i);
10194 return (n.reverse && o.reverse(), o);
10195 }
10196 _positionChanged(t, e) {
10197 const { caretX: i, caretY: s, options: n } = this,
10198 o = Da[n.position].call(this, t, e);
10199 return !1 !== o && (i !== o.x || s !== o.y);
10200 }
10201 }
10202 var Na = {
10203 id: "tooltip",
10204 _element: Wa,
10205 positioners: Da,
10206 afterInit(t, e, i) {
10207 i && (t.tooltip = new Wa({ chart: t, options: i }));
10208 },
10209 beforeUpdate(t, e, i) {
10210 t.tooltip && t.tooltip.initialize(i);
10211 },
10212 reset(t, e, i) {
10213 t.tooltip && t.tooltip.initialize(i);
10214 },
10215 afterDraw(t) {
10216 const e = t.tooltip;
10217 if (e && e._willRender()) {
10218 const i = { tooltip: e };
10219 if (!1 === t.notifyPlugins("beforeTooltipDraw", { ...i, cancelable: !0 })) return;
10220 (e.draw(t.ctx), t.notifyPlugins("afterTooltipDraw", i));
10221 }
10222 },
10223 afterEvent(t, e) {
10224 if (t.tooltip) {
10225 const i = e.replay;
10226 t.tooltip.handleEvent(e.event, i, e.inChartArea) && (e.changed = !0);
10227 }
10228 },
10229 defaults: {
10230 enabled: !0,
10231 external: null,
10232 position: "average",
10233 backgroundColor: "rgba(0,0,0,0.8)",
10234 titleColor: "#fff",
10235 titleFont: { weight: "bold" },
10236 titleSpacing: 2,
10237 titleMarginBottom: 6,
10238 titleAlign: "left",
10239 bodyColor: "#fff",
10240 bodySpacing: 2,
10241 bodyFont: {},
10242 bodyAlign: "left",
10243 footerColor: "#fff",
10244 footerSpacing: 2,
10245 footerMarginTop: 6,
10246 footerFont: { weight: "bold" },
10247 footerAlign: "left",
10248 padding: 6,
10249 caretPadding: 2,
10250 caretSize: 5,
10251 cornerRadius: 6,
10252 boxHeight: (t, e) => e.bodyFont.size,
10253 boxWidth: (t, e) => e.bodyFont.size,
10254 multiKeyBackground: "#fff",
10255 displayColors: !0,
10256 boxPadding: 0,
10257 borderColor: "rgba(0,0,0,0)",
10258 borderWidth: 0,
10259 animation: { duration: 400, easing: "easeOutQuart" },
10260 animations: {
10261 numbers: { type: "number", properties: ["x", "y", "width", "height", "caretX", "caretY"] },
10262 opacity: { easing: "linear", duration: 200 },
10263 },
10264 callbacks: Va,
10265 },
10266 defaultRoutes: { bodyFont: "font", footerFont: "font", titleFont: "font" },
10267 descriptors: {
10268 _scriptable: (t) => "filter" !== t && "itemSort" !== t && "external" !== t,
10269 _indexable: !1,
10270 callbacks: { _scriptable: !1, _indexable: !1 },
10271 animation: { _fallback: !1 },
10272 animations: { _fallback: "animation" },
10273 },
10274 additionalOptionScopes: ["interaction"],
10275 };
10276 return (
10277 Tn.register(Un, $o, go, t),
10278 (Tn.helpers = { ...Hi }),
10279 (Tn._adapters = In),
10280 (Tn.Animation = As),
10281 (Tn.Animations = Ts),
10282 (Tn.animator = bt),
10283 (Tn.controllers = nn.controllers.items),
10284 (Tn.DatasetController = js),
10285 (Tn.Element = $s),
10286 (Tn.elements = go),
10287 (Tn.Interaction = Ki),
10288 (Tn.layouts = ls),
10289 (Tn.platforms = Ds),
10290 (Tn.Scale = tn),
10291 (Tn.Ticks = ae),
10292 Object.assign(Tn, Un, $o, go, t, Ds),
10293 (Tn.Chart = Tn),
10294 "undefined" != typeof window && (window.Chart = Tn),
10295 Tn
10296 );
10297 });
10298 //# sourceMappingURL=chart.umd.min.js.map
10299