UNPKG

@konstructio/ui

Version:

A set of reusable and customizable React components built for konstruct.io

1,861 lines 155 kB
import { jsx as ve } from "react/jsx-runtime"; import { forwardRef as Cs, useRef as Ie, useEffect as dt, useMemo as re } from "react"; function It(e) { return e + 0.5 | 0; } const Q = (e, t, s) => Math.max(Math.min(e, s), t); function kt(e) { return Q(It(e * 2.55), 0, 255); } function et(e) { return Q(It(e * 255), 0, 255); } function G(e) { return Q(It(e / 2.55) / 100, 0, 1); } function Te(e) { return Q(It(e * 100), 0, 100); } const N = { 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, A: 10, B: 11, C: 12, D: 13, E: 14, F: 15, a: 10, b: 11, c: 12, d: 13, e: 14, f: 15 }, me = [..."0123456789ABCDEF"], ci = (e) => me[e & 15], li = (e) => me[(e & 240) >> 4] + me[e & 15], zt = (e) => (e & 240) >> 4 === (e & 15), hi = (e) => zt(e.r) && zt(e.g) && zt(e.b) && zt(e.a); function di(e) { var t = e.length, s; return e[0] === "#" && (t === 4 || t === 5 ? s = { r: 255 & N[e[1]] * 17, g: 255 & N[e[2]] * 17, b: 255 & N[e[3]] * 17, a: t === 5 ? N[e[4]] * 17 : 255 } : (t === 7 || t === 9) && (s = { r: N[e[1]] << 4 | N[e[2]], g: N[e[3]] << 4 | N[e[4]], b: N[e[5]] << 4 | N[e[6]], a: t === 9 ? N[e[7]] << 4 | N[e[8]] : 255 })), s; } const fi = (e, t) => e < 255 ? t(e) : ""; function ui(e) { var t = hi(e) ? ci : li; return e ? "#" + t(e.r) + t(e.g) + t(e.b) + fi(e.a, t) : void 0; } const gi = /^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/; function As(e, t, s) { const i = t * Math.min(s, 1 - s), n = (o, r = (o + e / 30) % 12) => s - i * Math.max(Math.min(r - 3, 9 - r, 1), -1); return [n(0), n(8), n(4)]; } function pi(e, t, s) { const i = (n, o = (n + e / 60) % 6) => s - s * t * Math.max(Math.min(o, 4 - o, 1), 0); return [i(5), i(3), i(1)]; } function mi(e, t, s) { const i = As(e, 1, 0.5); let n; for (t + s > 1 && (n = 1 / (t + s), t *= n, s *= n), n = 0; n < 3; n++) i[n] *= 1 - t - s, i[n] += t; return i; } function _i(e, t, s, i, n) { return e === n ? (t - s) / i + (t < s ? 6 : 0) : t === n ? (s - e) / i + 2 : (e - t) / i + 4; } function we(e) { const s = e.r / 255, i = e.g / 255, n = e.b / 255, o = Math.max(s, i, n), r = Math.min(s, i, n), a = (o + r) / 2; let c, l, h; return o !== r && (h = o - r, l = a > 0.5 ? h / (2 - o - r) : h / (o + r), c = _i(s, i, n, h, o), c = c * 60 + 0.5), [c | 0, l || 0, a]; } function Me(e, t, s, i) { return (Array.isArray(t) ? e(t[0], t[1], t[2]) : e(t, s, i)).map(et); } function ke(e, t, s) { return Me(As, e, t, s); } function bi(e, t, s) { return Me(mi, e, t, s); } function xi(e, t, s) { return Me(pi, e, t, s); } function Ps(e) { return (e % 360 + 360) % 360; } function yi(e) { const t = gi.exec(e); let s = 255, i; if (!t) return; t[5] !== i && (s = t[6] ? kt(+t[5]) : et(+t[5])); const n = Ps(+t[2]), o = +t[3] / 100, r = +t[4] / 100; return t[1] === "hwb" ? i = bi(n, o, r) : t[1] === "hsv" ? i = xi(n, o, r) : i = ke(n, o, r), { r: i[0], g: i[1], b: i[2], a: s }; } function vi(e, t) { var s = we(e); s[0] = Ps(s[0] + t), s = ke(s), e.r = s[0], e.g = s[1], e.b = s[2]; } function wi(e) { if (!e) return; const t = we(e), s = t[0], i = Te(t[1]), n = Te(t[2]); return e.a < 255 ? `hsla(${s}, ${i}%, ${n}%, ${G(e.a)})` : `hsl(${s}, ${i}%, ${n}%)`; } const Le = { x: "dark", Z: "light", Y: "re", X: "blu", W: "gr", V: "medium", U: "slate", A: "ee", T: "ol", S: "or", B: "ra", C: "lateg", D: "ights", R: "in", Q: "turquois", E: "hi", P: "ro", O: "al", N: "le", M: "de", L: "yello", F: "en", K: "ch", G: "arks", H: "ea", I: "ightg", J: "wh" }, ze = { OiceXe: "f0f8ff", antiquewEte: "faebd7", aqua: "ffff", aquamarRe: "7fffd4", azuY: "f0ffff", beige: "f5f5dc", bisque: "ffe4c4", black: "0", blanKedOmond: "ffebcd", Xe: "ff", XeviTet: "8a2be2", bPwn: "a52a2a", burlywood: "deb887", caMtXe: "5f9ea0", KartYuse: "7fff00", KocTate: "d2691e", cSO: "ff7f50", cSnflowerXe: "6495ed", cSnsilk: "fff8dc", crimson: "dc143c", cyan: "ffff", xXe: "8b", xcyan: "8b8b", xgTMnPd: "b8860b", xWay: "a9a9a9", xgYF: "6400", xgYy: "a9a9a9", xkhaki: "bdb76b", xmagFta: "8b008b", xTivegYF: "556b2f", xSange: "ff8c00", xScEd: "9932cc", xYd: "8b0000", xsOmon: "e9967a", xsHgYF: "8fbc8f", xUXe: "483d8b", xUWay: "2f4f4f", xUgYy: "2f4f4f", xQe: "ced1", xviTet: "9400d3", dAppRk: "ff1493", dApskyXe: "bfff", dimWay: "696969", dimgYy: "696969", dodgerXe: "1e90ff", fiYbrick: "b22222", flSOwEte: "fffaf0", foYstWAn: "228b22", fuKsia: "ff00ff", gaRsbSo: "dcdcdc", ghostwEte: "f8f8ff", gTd: "ffd700", gTMnPd: "daa520", Way: "808080", gYF: "8000", gYFLw: "adff2f", gYy: "808080", honeyMw: "f0fff0", hotpRk: "ff69b4", RdianYd: "cd5c5c", Rdigo: "4b0082", ivSy: "fffff0", khaki: "f0e68c", lavFMr: "e6e6fa", lavFMrXsh: "fff0f5", lawngYF: "7cfc00", NmoncEffon: "fffacd", ZXe: "add8e6", ZcSO: "f08080", Zcyan: "e0ffff", ZgTMnPdLw: "fafad2", ZWay: "d3d3d3", ZgYF: "90ee90", ZgYy: "d3d3d3", ZpRk: "ffb6c1", ZsOmon: "ffa07a", ZsHgYF: "20b2aa", ZskyXe: "87cefa", ZUWay: "778899", ZUgYy: "778899", ZstAlXe: "b0c4de", ZLw: "ffffe0", lime: "ff00", limegYF: "32cd32", lRF: "faf0e6", magFta: "ff00ff", maPon: "800000", VaquamarRe: "66cdaa", VXe: "cd", VScEd: "ba55d3", VpurpN: "9370db", VsHgYF: "3cb371", VUXe: "7b68ee", VsprRggYF: "fa9a", VQe: "48d1cc", VviTetYd: "c71585", midnightXe: "191970", mRtcYam: "f5fffa", mistyPse: "ffe4e1", moccasR: "ffe4b5", navajowEte: "ffdead", navy: "80", Tdlace: "fdf5e6", Tive: "808000", TivedBb: "6b8e23", Sange: "ffa500", SangeYd: "ff4500", ScEd: "da70d6", pOegTMnPd: "eee8aa", pOegYF: "98fb98", pOeQe: "afeeee", pOeviTetYd: "db7093", papayawEp: "ffefd5", pHKpuff: "ffdab9", peru: "cd853f", pRk: "ffc0cb", plum: "dda0dd", powMrXe: "b0e0e6", purpN: "800080", YbeccapurpN: "663399", Yd: "ff0000", Psybrown: "bc8f8f", PyOXe: "4169e1", saddNbPwn: "8b4513", sOmon: "fa8072", sandybPwn: "f4a460", sHgYF: "2e8b57", sHshell: "fff5ee", siFna: "a0522d", silver: "c0c0c0", skyXe: "87ceeb", UXe: "6a5acd", UWay: "708090", UgYy: "708090", snow: "fffafa", sprRggYF: "ff7f", stAlXe: "4682b4", tan: "d2b48c", teO: "8080", tEstN: "d8bfd8", tomato: "ff6347", Qe: "40e0d0", viTet: "ee82ee", JHt: "f5deb3", wEte: "ffffff", wEtesmoke: "f5f5f5", Lw: "ffff00", LwgYF: "9acd32" }; function Mi() { const e = {}, t = Object.keys(ze), s = Object.keys(Le); let i, n, o, r, a; for (i = 0; i < t.length; i++) { for (r = a = t[i], n = 0; n < s.length; n++) o = s[n], a = a.replace(o, Le[o]); o = parseInt(ze[r], 16), e[a] = [o >> 16 & 255, o >> 8 & 255, o & 255]; } return e; } let Ft; function ki(e) { Ft || (Ft = Mi(), Ft.transparent = [0, 0, 0, 0]); const t = Ft[e.toLowerCase()]; return t && { r: t[0], g: t[1], b: t[2], a: t.length === 4 ? t[3] : 255 }; } const Si = /^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/; function Oi(e) { const t = Si.exec(e); let s = 255, i, n, o; if (t) { if (t[7] !== i) { const r = +t[7]; s = t[8] ? kt(r) : Q(r * 255, 0, 255); } return i = +t[1], n = +t[3], o = +t[5], i = 255 & (t[2] ? kt(i) : Q(i, 0, 255)), n = 255 & (t[4] ? kt(n) : Q(n, 0, 255)), o = 255 & (t[6] ? kt(o) : Q(o, 0, 255)), { r: i, g: n, b: o, a: s }; } } function Di(e) { return e && (e.a < 255 ? `rgba(${e.r}, ${e.g}, ${e.b}, ${G(e.a)})` : `rgb(${e.r}, ${e.g}, ${e.b})`); } const ae = (e) => e <= 31308e-7 ? e * 12.92 : Math.pow(e, 1 / 2.4) * 1.055 - 0.055, ft = (e) => e <= 0.04045 ? e / 12.92 : Math.pow((e + 0.055) / 1.055, 2.4); function Ci(e, t, s) { const i = ft(G(e.r)), n = ft(G(e.g)), o = ft(G(e.b)); return { r: et(ae(i + s * (ft(G(t.r)) - i))), g: et(ae(n + s * (ft(G(t.g)) - n))), b: et(ae(o + s * (ft(G(t.b)) - o))), a: e.a + s * (t.a - e.a) }; } function jt(e, t, s) { if (e) { let i = we(e); i[t] = Math.max(0, Math.min(i[t] + i[t] * s, t === 0 ? 360 : 1)), i = ke(i), e.r = i[0], e.g = i[1], e.b = i[2]; } } function Es(e, t) { return e && Object.assign(t || {}, e); } function Fe(e) { var t = { r: 0, g: 0, b: 0, a: 255 }; return Array.isArray(e) ? e.length >= 3 && (t = { r: e[0], g: e[1], b: e[2], a: 255 }, e.length > 3 && (t.a = et(e[3]))) : (t = Es(e, { r: 0, g: 0, b: 0, a: 1 }), t.a = et(t.a)), t; } function Ai(e) { return e.charAt(0) === "r" ? Oi(e) : yi(e); } class Ct { constructor(t) { if (t instanceof Ct) return t; const s = typeof t; let i; s === "object" ? i = Fe(t) : s === "string" && (i = di(t) || ki(t) || Ai(t)), this._rgb = i, this._valid = !!i; } get valid() { return this._valid; } get rgb() { var t = Es(this._rgb); return t && (t.a = G(t.a)), t; } set rgb(t) { this._rgb = Fe(t); } rgbString() { return this._valid ? Di(this._rgb) : void 0; } hexString() { return this._valid ? ui(this._rgb) : void 0; } hslString() { return this._valid ? wi(this._rgb) : void 0; } mix(t, s) { if (t) { const i = this.rgb, n = t.rgb; let o; const r = s === o ? 0.5 : s, a = 2 * r - 1, c = i.a - n.a, l = ((a * c === -1 ? a : (a + c) / (1 + a * c)) + 1) / 2; o = 1 - l, i.r = 255 & l * i.r + o * n.r + 0.5, i.g = 255 & l * i.g + o * n.g + 0.5, i.b = 255 & l * i.b + o * n.b + 0.5, i.a = r * i.a + (1 - r) * n.a, this.rgb = i; } return this; } interpolate(t, s) { return t && (this._rgb = Ci(this._rgb, t._rgb, s)), this; } clone() { return new Ct(this.rgb); } alpha(t) { return this._rgb.a = et(t), this; } clearer(t) { const s = this._rgb; return s.a *= 1 - t, this; } greyscale() { const t = this._rgb, s = It(t.r * 0.3 + t.g * 0.59 + t.b * 0.11); return t.r = t.g = t.b = s, this; } opaquer(t) { const s = this._rgb; return s.a *= 1 + t, this; } negate() { const t = this._rgb; return t.r = 255 - t.r, t.g = 255 - t.g, t.b = 255 - t.b, this; } lighten(t) { return jt(this._rgb, 2, t), this; } darken(t) { return jt(this._rgb, 2, -t), this; } saturate(t) { return jt(this._rgb, 1, t), this; } desaturate(t) { return jt(this._rgb, 1, -t), this; } rotate(t) { return vi(this._rgb, t), this; } } const Pi = /* @__PURE__ */ (() => { let e = 0; return () => e++; })(); function W(e) { return e == null; } function B(e) { if (Array.isArray && Array.isArray(e)) return !0; const t = Object.prototype.toString.call(e); return t.slice(0, 7) === "[object" && t.slice(-6) === "Array]"; } function w(e) { return e !== null && Object.prototype.toString.call(e) === "[object Object]"; } function pt(e) { return (typeof e == "number" || e instanceof Number) && isFinite(+e); } function K(e, t) { return pt(e) ? e : t; } function A(e, t) { return typeof e > "u" ? t : e; } const Ei = (e, t) => typeof e == "string" && e.endsWith("%") ? parseFloat(e) / 100 : +e / t, Rs = (e, t) => typeof e == "string" && e.endsWith("%") ? parseFloat(e) / 100 * t : +e; function E(e, t, s) { if (e && typeof e.call == "function") return e.apply(s, t); } function j(e, t, s, i) { let n, o, r; if (B(e)) for (o = e.length, n = 0; n < o; n++) t.call(s, e[n], n); else if (w(e)) for (r = Object.keys(e), o = r.length, n = 0; n < o; n++) t.call(s, e[r[n]], r[n]); } function je(e, t) { let s, i, n, o; if (!e || !t || e.length !== t.length) return !1; for (s = 0, i = e.length; s < i; ++s) if (n = e[s], o = t[s], n.datasetIndex !== o.datasetIndex || n.index !== o.index) return !1; return !0; } function Zt(e) { if (B(e)) return e.map(Zt); if (w(e)) { const t = /* @__PURE__ */ Object.create(null), s = Object.keys(e), i = s.length; let n = 0; for (; n < i; ++n) t[s[n]] = Zt(e[s[n]]); return t; } return e; } function Is(e) { return [ "__proto__", "prototype", "constructor" ].indexOf(e) === -1; } function Ri(e, t, s, i) { if (!Is(e)) return; const n = t[e], o = s[e]; w(n) && w(o) ? At(n, o, i) : t[e] = Zt(o); } function At(e, t, s) { const i = B(t) ? t : [ t ], n = i.length; if (!w(e)) return e; s = s || {}; const o = s.merger || Ri; let r; for (let a = 0; a < n; ++a) { if (r = i[a], !w(r)) continue; const c = Object.keys(r); for (let l = 0, h = c.length; l < h; ++l) o(c[l], e, r, s); } return e; } function Kt(e, t) { return At(e, t, { merger: Ii }); } function Ii(e, t, s) { if (!Is(e)) return; const i = t[e], n = s[e]; w(i) && w(n) ? Kt(i, n) : Object.prototype.hasOwnProperty.call(t, e) || (t[e] = Zt(n)); } const Be = { // Chart.helpers.core resolveObjectKey should resolve empty key to root object "": (e) => e, // default resolvers x: (e) => e.x, y: (e) => e.y }; function Ti(e) { const t = e.split("."), s = []; let i = ""; for (const n of t) i += n, i.endsWith("\\") ? i = i.slice(0, -1) + "." : (s.push(i), i = ""); return s; } function Li(e) { const t = Ti(e); return (s) => { for (const i of t) { if (i === "") break; s = s && s[i]; } return s; }; } function Pt(e, t) { return (Be[t] || (Be[t] = Li(t)))(e); } function Se(e) { return e.charAt(0).toUpperCase() + e.slice(1); } const Gt = (e) => typeof e < "u", st = (e) => typeof e == "function", He = (e, t) => { if (e.size !== t.size) return !1; for (const s of e) if (!t.has(s)) return !1; return !0; }; function zi(e) { return e.type === "mouseup" || e.type === "click" || e.type === "contextmenu"; } const z = Math.PI, T = 2 * z, Qt = Number.POSITIVE_INFINITY, $ = z / 2, We = Math.sign; function Fi(e) { const t = [], s = Math.sqrt(e); let i; for (i = 1; i < s; i++) e % i === 0 && (t.push(i), t.push(e / i)); return s === (s | 0) && t.push(s), t.sort((n, o) => n - o).pop(), t; } function ji(e) { return typeof e == "symbol" || typeof e == "object" && e !== null && !(Symbol.toPrimitive in e || "toString" in e || "valueOf" in e); } function Ve(e) { return !ji(e) && !isNaN(parseFloat(e)) && isFinite(e); } function gt(e) { return e * (z / 180); } function Bi(e) { return e * (180 / z); } function Ts(e, t) { const s = t.x - e.x, i = t.y - e.y, n = Math.sqrt(s * s + i * i); let o = Math.atan2(i, s); return o < -0.5 * z && (o += T), { angle: o, distance: n }; } function q(e) { return (e % T + T) % T; } function Jt(e, t, s, i) { const n = q(e), o = q(t), r = q(s), a = q(o - n), c = q(r - n), l = q(n - o), h = q(n - r); return n === o || n === r || i && o === r || a > c && l < h; } function J(e, t, s) { return Math.max(t, Math.min(s, e)); } function Hi(e) { return J(e, -32768, 32767); } function Wi(e, t, s, i = 1e-6) { return e >= Math.min(t, s) - i && e <= Math.max(t, s) + i; } function Ls(e, t, s) { s = s || ((r) => e[r] < t); let i = e.length - 1, n = 0, o; for (; i - n > 1; ) o = n + i >> 1, s(o) ? n = o : i = o; return { lo: n, hi: i }; } const Vi = (e, t, s, i) => Ls(e, s, i ? (n) => { const o = e[n][t]; return o < s || o === s && e[n + 1][t] === s; } : (n) => e[n][t] < s), Ni = (e, t, s) => Ls(e, s, (i) => e[i][t] >= s), zs = [ "push", "pop", "shift", "splice", "unshift" ]; function $i(e, t) { if (e._chartjs) { e._chartjs.listeners.push(t); return; } Object.defineProperty(e, "_chartjs", { configurable: !0, enumerable: !1, value: { listeners: [ t ] } }), zs.forEach((s) => { const i = "_onData" + Se(s), n = e[s]; Object.defineProperty(e, s, { configurable: !0, enumerable: !1, value(...o) { const r = n.apply(this, o); return e._chartjs.listeners.forEach((a) => { typeof a[i] == "function" && a[i](...o); }), r; } }); }); } function Ne(e, t) { const s = e._chartjs; if (!s) return; const i = s.listeners, n = i.indexOf(t); n !== -1 && i.splice(n, 1), !(i.length > 0) && (zs.forEach((o) => { delete e[o]; }), delete e._chartjs); } const Fs = (function() { return typeof window > "u" ? function(e) { return e(); } : window.requestAnimationFrame; })(); function js(e, t) { let s = [], i = !1; return function(...n) { s = n, i || (i = !0, Fs.call(window, () => { i = !1, e.apply(t, s); })); }; } function Yi(e, t) { let s; return function(...i) { return t ? (clearTimeout(s), s = setTimeout(e, t, i)) : e.apply(this, i), t; }; } const Xi = (e) => e === "start" ? "left" : e === "end" ? "right" : "center", $e = (e, t, s) => e === "start" ? t : e === "end" ? s : (t + s) / 2, Bt = (e) => e === 0 || e === 1, Ye = (e, t, s) => -(Math.pow(2, 10 * (e -= 1)) * Math.sin((e - t) * T / s)), Xe = (e, t, s) => Math.pow(2, -10 * e) * Math.sin((e - t) * T / s) + 1, Ot = { linear: (e) => e, easeInQuad: (e) => e * e, easeOutQuad: (e) => -e * (e - 2), easeInOutQuad: (e) => (e /= 0.5) < 1 ? 0.5 * e * e : -0.5 * (--e * (e - 2) - 1), easeInCubic: (e) => e * e * e, easeOutCubic: (e) => (e -= 1) * e * e + 1, easeInOutCubic: (e) => (e /= 0.5) < 1 ? 0.5 * e * e * e : 0.5 * ((e -= 2) * e * e + 2), easeInQuart: (e) => e * e * e * e, easeOutQuart: (e) => -((e -= 1) * e * e * e - 1), easeInOutQuart: (e) => (e /= 0.5) < 1 ? 0.5 * e * e * e * e : -0.5 * ((e -= 2) * e * e * e - 2), easeInQuint: (e) => e * e * e * e * e, easeOutQuint: (e) => (e -= 1) * e * e * e * e + 1, easeInOutQuint: (e) => (e /= 0.5) < 1 ? 0.5 * e * e * e * e * e : 0.5 * ((e -= 2) * e * e * e * e + 2), easeInSine: (e) => -Math.cos(e * $) + 1, easeOutSine: (e) => Math.sin(e * $), easeInOutSine: (e) => -0.5 * (Math.cos(z * e) - 1), easeInExpo: (e) => e === 0 ? 0 : Math.pow(2, 10 * (e - 1)), easeOutExpo: (e) => e === 1 ? 1 : -Math.pow(2, -10 * e) + 1, easeInOutExpo: (e) => Bt(e) ? e : e < 0.5 ? 0.5 * Math.pow(2, 10 * (e * 2 - 1)) : 0.5 * (-Math.pow(2, -10 * (e * 2 - 1)) + 2), easeInCirc: (e) => e >= 1 ? e : -(Math.sqrt(1 - e * e) - 1), easeOutCirc: (e) => Math.sqrt(1 - (e -= 1) * e), easeInOutCirc: (e) => (e /= 0.5) < 1 ? -0.5 * (Math.sqrt(1 - e * e) - 1) : 0.5 * (Math.sqrt(1 - (e -= 2) * e) + 1), easeInElastic: (e) => Bt(e) ? e : Ye(e, 0.075, 0.3), easeOutElastic: (e) => Bt(e) ? e : Xe(e, 0.075, 0.3), easeInOutElastic(e) { return Bt(e) ? e : e < 0.5 ? 0.5 * Ye(e * 2, 0.1125, 0.45) : 0.5 + 0.5 * Xe(e * 2 - 1, 0.1125, 0.45); }, easeInBack(e) { return e * e * ((1.70158 + 1) * e - 1.70158); }, easeOutBack(e) { return (e -= 1) * e * ((1.70158 + 1) * e + 1.70158) + 1; }, easeInOutBack(e) { let t = 1.70158; return (e /= 0.5) < 1 ? 0.5 * (e * e * (((t *= 1.525) + 1) * e - t)) : 0.5 * ((e -= 2) * e * (((t *= 1.525) + 1) * e + t) + 2); }, easeInBounce: (e) => 1 - Ot.easeOutBounce(1 - e), easeOutBounce(e) { return e < 1 / 2.75 ? 7.5625 * e * e : e < 2 / 2.75 ? 7.5625 * (e -= 1.5 / 2.75) * e + 0.75 : e < 2.5 / 2.75 ? 7.5625 * (e -= 2.25 / 2.75) * e + 0.9375 : 7.5625 * (e -= 2.625 / 2.75) * e + 0.984375; }, easeInOutBounce: (e) => e < 0.5 ? Ot.easeInBounce(e * 2) * 0.5 : Ot.easeOutBounce(e * 2 - 1) * 0.5 + 0.5 }; function Bs(e) { if (e && typeof e == "object") { const t = e.toString(); return t === "[object CanvasPattern]" || t === "[object CanvasGradient]"; } return !1; } function Ke(e) { return Bs(e) ? e : new Ct(e); } function ce(e) { return Bs(e) ? e : new Ct(e).saturate(0.5).darken(0.1).hexString(); } const Ki = [ "x", "y", "borderWidth", "radius", "tension" ], Ui = [ "color", "borderColor", "backgroundColor" ]; function qi(e) { e.set("animation", { delay: void 0, duration: 1e3, easing: "easeOutQuart", fn: void 0, from: void 0, loop: void 0, to: void 0, type: void 0 }), e.describe("animation", { _fallback: !1, _indexable: !1, _scriptable: (t) => t !== "onProgress" && t !== "onComplete" && t !== "fn" }), e.set("animations", { colors: { type: "color", properties: Ui }, numbers: { type: "number", properties: Ki } }), e.describe("animations", { _fallback: "animation" }), e.set("transitions", { active: { animation: { duration: 400 } }, resize: { animation: { duration: 0 } }, show: { animations: { colors: { from: "transparent" }, visible: { type: "boolean", duration: 0 } } }, hide: { animations: { colors: { to: "transparent" }, visible: { type: "boolean", easing: "linear", fn: (t) => t | 0 } } } }); } function Zi(e) { e.set("layout", { autoPadding: !0, padding: { top: 0, right: 0, bottom: 0, left: 0 } }); } const Ue = /* @__PURE__ */ new Map(); function Gi(e, t) { t = t || {}; const s = e + JSON.stringify(t); let i = Ue.get(s); return i || (i = new Intl.NumberFormat(e, t), Ue.set(s, i)), i; } function Qi(e, t, s) { return Gi(t, s).format(e); } const Ji = { values(e) { return B(e) ? e : "" + e; } }; var tn = { formatters: Ji }; function en(e) { e.set("scale", { display: !0, offset: !1, reverse: !1, beginAtZero: !1, bounds: "ticks", clip: !0, grace: 0, grid: { display: !0, lineWidth: 1, drawOnChartArea: !0, drawTicks: !0, tickLength: 8, tickWidth: (t, s) => s.lineWidth, tickColor: (t, s) => s.color, offset: !1 }, border: { display: !0, dash: [], dashOffset: 0, width: 1 }, title: { display: !1, text: "", padding: { top: 4, bottom: 4 } }, ticks: { minRotation: 0, maxRotation: 50, mirror: !1, textStrokeWidth: 0, textStrokeColor: "", padding: 3, display: !0, autoSkip: !0, autoSkipPadding: 3, labelOffset: 0, callback: tn.formatters.values, minor: {}, major: {}, align: "center", crossAlign: "near", showLabelBackdrop: !1, backdropColor: "rgba(255, 255, 255, 0.75)", backdropPadding: 2 } }), e.route("scale.ticks", "color", "", "color"), e.route("scale.grid", "color", "", "borderColor"), e.route("scale.border", "color", "", "borderColor"), e.route("scale.title", "color", "", "color"), e.describe("scale", { _fallback: !1, _scriptable: (t) => !t.startsWith("before") && !t.startsWith("after") && t !== "callback" && t !== "parser", _indexable: (t) => t !== "borderDash" && t !== "tickBorderDash" && t !== "dash" }), e.describe("scales", { _fallback: "scale" }), e.describe("scale.ticks", { _scriptable: (t) => t !== "backdropPadding" && t !== "callback", _indexable: (t) => t !== "backdropPadding" }); } const ct = /* @__PURE__ */ Object.create(null), _e = /* @__PURE__ */ Object.create(null); function Dt(e, t) { if (!t) return e; const s = t.split("."); for (let i = 0, n = s.length; i < n; ++i) { const o = s[i]; e = e[o] || (e[o] = /* @__PURE__ */ Object.create(null)); } return e; } function le(e, t, s) { return typeof t == "string" ? At(Dt(e, t), s) : At(Dt(e, ""), t); } class sn { constructor(t, s) { this.animation = void 0, this.backgroundColor = "rgba(0,0,0,0.1)", this.borderColor = "rgba(0,0,0,0.1)", this.color = "#666", this.datasets = {}, this.devicePixelRatio = (i) => i.chart.platform.getDevicePixelRatio(), this.elements = {}, this.events = [ "mousemove", "mouseout", "click", "touchstart", "touchmove" ], this.font = { family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif", size: 12, style: "normal", lineHeight: 1.2, weight: null }, this.hover = {}, this.hoverBackgroundColor = (i, n) => ce(n.backgroundColor), this.hoverBorderColor = (i, n) => ce(n.borderColor), this.hoverColor = (i, n) => ce(n.color), this.indexAxis = "x", this.interaction = { mode: "nearest", intersect: !0, includeInvisible: !1 }, this.maintainAspectRatio = !0, this.onHover = null, this.onClick = null, this.parsing = !0, this.plugins = {}, this.responsive = !0, this.scale = void 0, this.scales = {}, this.showLine = !0, this.drawActiveElementsOnTop = !0, this.describe(t), this.apply(s); } set(t, s) { return le(this, t, s); } get(t) { return Dt(this, t); } describe(t, s) { return le(_e, t, s); } override(t, s) { return le(ct, t, s); } route(t, s, i, n) { const o = Dt(this, t), r = Dt(this, i), a = "_" + s; Object.defineProperties(o, { [a]: { value: o[s], writable: !0 }, [s]: { enumerable: !0, get() { const c = this[a], l = r[n]; return w(c) ? Object.assign({}, l, c) : A(c, l); }, set(c) { this[a] = c; } } }); } apply(t) { t.forEach((s) => s(this)); } } var R = /* @__PURE__ */ new sn({ _scriptable: (e) => !e.startsWith("on"), _indexable: (e) => e !== "events", hover: { _fallback: "interaction" }, interaction: { _scriptable: !1, _indexable: !1 } }, [ qi, Zi, en ]); function nn(e) { return !e || W(e.size) || W(e.family) ? null : (e.style ? e.style + " " : "") + (e.weight ? e.weight + " " : "") + e.size + "px " + e.family; } function qe(e, t, s, i, n) { let o = t[n]; return o || (o = t[n] = e.measureText(n).width, s.push(n)), o > i && (i = o), i; } function ot(e, t, s) { const i = e.currentDevicePixelRatio, n = s !== 0 ? Math.max(s / 2, 0.5) : 0; return Math.round((t - n) * i) / i + n; } function Ze(e, t) { !t && !e || (t = t || e.getContext("2d"), t.save(), t.resetTransform(), t.clearRect(0, 0, e.width, e.height), t.restore()); } function Hs(e, t, s) { return s = s || 0.5, !t || e && e.x > t.left - s && e.x < t.right + s && e.y > t.top - s && e.y < t.bottom + s; } function Ws(e, t) { e.save(), e.beginPath(), e.rect(t.left, t.top, t.right - t.left, t.bottom - t.top), e.clip(); } function Vs(e) { e.restore(); } function on(e, t) { t.translation && e.translate(t.translation[0], t.translation[1]), W(t.rotation) || e.rotate(t.rotation), t.color && (e.fillStyle = t.color), t.textAlign && (e.textAlign = t.textAlign), t.textBaseline && (e.textBaseline = t.textBaseline); } function rn(e, t, s, i, n) { if (n.strikethrough || n.underline) { const o = e.measureText(i), r = t - o.actualBoundingBoxLeft, a = t + o.actualBoundingBoxRight, c = s - o.actualBoundingBoxAscent, l = s + o.actualBoundingBoxDescent, h = n.strikethrough ? (c + l) / 2 : l; e.strokeStyle = e.fillStyle, e.beginPath(), e.lineWidth = n.decorationWidth || 2, e.moveTo(r, h), e.lineTo(a, h), e.stroke(); } } function an(e, t) { const s = e.fillStyle; e.fillStyle = t.color, e.fillRect(t.left, t.top, t.width, t.height), e.fillStyle = s; } function Ge(e, t, s, i, n, o = {}) { const r = B(t) ? t : [ t ], a = o.strokeWidth > 0 && o.strokeColor !== ""; let c, l; for (e.save(), e.font = n.string, on(e, o), c = 0; c < r.length; ++c) l = r[c], o.backdrop && an(e, o.backdrop), a && (o.strokeColor && (e.strokeStyle = o.strokeColor), W(o.strokeWidth) || (e.lineWidth = o.strokeWidth), e.strokeText(l, s, i, o.maxWidth)), e.fillText(l, s, i, o.maxWidth), rn(e, s, i, l, o), i += Number(n.lineHeight); e.restore(); } const cn = /^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/, ln = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/; function hn(e, t) { const s = ("" + e).match(cn); if (!s || s[1] === "normal") return t * 1.2; switch (e = +s[2], s[3]) { case "px": return e; case "%": e /= 100; break; } return t * e; } const dn = (e) => +e || 0; function Ns(e, t) { const s = {}, i = w(t), n = i ? Object.keys(t) : t, o = w(e) ? i ? (r) => A(e[r], e[t[r]]) : (r) => e[r] : () => e; for (const r of n) s[r] = dn(o(r)); return s; } function fn(e) { return Ns(e, { top: "y", right: "x", bottom: "y", left: "x" }); } function Et(e) { const t = fn(e); return t.width = t.left + t.right, t.height = t.top + t.bottom, t; } function be(e, t) { e = e || {}, t = t || R.font; let s = A(e.size, t.size); typeof s == "string" && (s = parseInt(s, 10)); let i = A(e.style, t.style); i && !("" + i).match(ln) && (console.warn('Invalid font style specified: "' + i + '"'), i = void 0); const n = { family: A(e.family, t.family), lineHeight: hn(A(e.lineHeight, t.lineHeight), s), size: s, style: i, weight: A(e.weight, t.weight), string: "" }; return n.string = nn(n), n; } function Ht(e, t, s, i) { let n, o, r; for (n = 0, o = e.length; n < o; ++n) if (r = e[n], r !== void 0 && r !== void 0) return r; } function un(e, t, s) { const { min: i, max: n } = e, o = Rs(t, (n - i) / 2), r = (a, c) => s && a === 0 ? 0 : a + c; return { min: r(i, -Math.abs(o)), max: r(n, o) }; } function Tt(e, t) { return Object.assign(Object.create(e), t); } function Oe(e, t = [ "" ], s, i, n = () => e[0]) { const o = s || e; typeof i > "u" && (i = Ks("_fallback", e)); const r = { [Symbol.toStringTag]: "Object", _cacheable: !0, _scopes: e, _rootScopes: o, _fallback: i, _getTarget: n, override: (a) => Oe([ a, ...e ], t, o, i) }; return new Proxy(r, { /** * A trap for the delete operator. */ deleteProperty(a, c) { return delete a[c], delete a._keys, delete e[0][c], !0; }, /** * A trap for getting property values. */ get(a, c) { return Ys(a, c, () => vn(c, t, e, a)); }, /** * A trap for Object.getOwnPropertyDescriptor. * Also used by Object.hasOwnProperty. */ getOwnPropertyDescriptor(a, c) { return Reflect.getOwnPropertyDescriptor(a._scopes[0], c); }, /** * A trap for Object.getPrototypeOf. */ getPrototypeOf() { return Reflect.getPrototypeOf(e[0]); }, /** * A trap for the in operator. */ has(a, c) { return Je(a).includes(c); }, /** * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols. */ ownKeys(a) { return Je(a); }, /** * A trap for setting property values. */ set(a, c, l) { const h = a._storage || (a._storage = n()); return a[c] = h[c] = l, delete a._keys, !0; } }); } function mt(e, t, s, i) { const n = { _cacheable: !1, _proxy: e, _context: t, _subProxy: s, _stack: /* @__PURE__ */ new Set(), _descriptors: $s(e, i), setContext: (o) => mt(e, o, s, i), override: (o) => mt(e.override(o), t, s, i) }; return new Proxy(n, { /** * A trap for the delete operator. */ deleteProperty(o, r) { return delete o[r], delete e[r], !0; }, /** * A trap for getting property values. */ get(o, r, a) { return Ys(o, r, () => pn(o, r, a)); }, /** * A trap for Object.getOwnPropertyDescriptor. * Also used by Object.hasOwnProperty. */ getOwnPropertyDescriptor(o, r) { return o._descriptors.allKeys ? Reflect.has(e, r) ? { enumerable: !0, configurable: !0 } : void 0 : Reflect.getOwnPropertyDescriptor(e, r); }, /** * A trap for Object.getPrototypeOf. */ getPrototypeOf() { return Reflect.getPrototypeOf(e); }, /** * A trap for the in operator. */ has(o, r) { return Reflect.has(e, r); }, /** * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols. */ ownKeys() { return Reflect.ownKeys(e); }, /** * A trap for setting property values. */ set(o, r, a) { return e[r] = a, delete o[r], !0; } }); } function $s(e, t = { scriptable: !0, indexable: !0 }) { const { _scriptable: s = t.scriptable, _indexable: i = t.indexable, _allKeys: n = t.allKeys } = e; return { allKeys: n, scriptable: s, indexable: i, isScriptable: st(s) ? s : () => s, isIndexable: st(i) ? i : () => i }; } const gn = (e, t) => e ? e + Se(t) : t, De = (e, t) => w(t) && e !== "adapters" && (Object.getPrototypeOf(t) === null || t.constructor === Object); function Ys(e, t, s) { if (Object.prototype.hasOwnProperty.call(e, t) || t === "constructor") return e[t]; const i = s(); return e[t] = i, i; } function pn(e, t, s) { const { _proxy: i, _context: n, _subProxy: o, _descriptors: r } = e; let a = i[t]; return st(a) && r.isScriptable(t) && (a = mn(t, a, e, s)), B(a) && a.length && (a = _n(t, a, e, r.isIndexable)), De(t, a) && (a = mt(a, n, o && o[t], r)), a; } function mn(e, t, s, i) { const { _proxy: n, _context: o, _subProxy: r, _stack: a } = s; if (a.has(e)) throw new Error("Recursion detected: " + Array.from(a).join("->") + "->" + e); a.add(e); let c = t(o, r || i); return a.delete(e), De(e, c) && (c = Ce(n._scopes, n, e, c)), c; } function _n(e, t, s, i) { const { _proxy: n, _context: o, _subProxy: r, _descriptors: a } = s; if (typeof o.index < "u" && i(e)) return t[o.index % t.length]; if (w(t[0])) { const c = t, l = n._scopes.filter((h) => h !== c); t = []; for (const h of c) { const d = Ce(l, n, e, h); t.push(mt(d, o, r && r[e], a)); } } return t; } function Xs(e, t, s) { return st(e) ? e(t, s) : e; } const bn = (e, t) => e === !0 ? t : typeof e == "string" ? Pt(t, e) : void 0; function xn(e, t, s, i, n) { for (const o of t) { const r = bn(s, o); if (r) { e.add(r); const a = Xs(r._fallback, s, n); if (typeof a < "u" && a !== s && a !== i) return a; } else if (r === !1 && typeof i < "u" && s !== i) return null; } return !1; } function Ce(e, t, s, i) { const n = t._rootScopes, o = Xs(t._fallback, s, i), r = [ ...e, ...n ], a = /* @__PURE__ */ new Set(); a.add(i); let c = Qe(a, r, s, o || s, i); return c === null || typeof o < "u" && o !== s && (c = Qe(a, r, o, c, i), c === null) ? !1 : Oe(Array.from(a), [ "" ], n, o, () => yn(t, s, i)); } function Qe(e, t, s, i, n) { for (; s; ) s = xn(e, t, s, i, n); return s; } function yn(e, t, s) { const i = e._getTarget(); t in i || (i[t] = {}); const n = i[t]; return B(n) && w(s) ? s : n || {}; } function vn(e, t, s, i) { let n; for (const o of t) if (n = Ks(gn(o, e), s), typeof n < "u") return De(e, n) ? Ce(s, i, e, n) : n; } function Ks(e, t) { for (const s of t) { if (!s) continue; const i = s[e]; if (typeof i < "u") return i; } } function Je(e) { let t = e._keys; return t || (t = e._keys = wn(e._scopes)), t; } function wn(e) { const t = /* @__PURE__ */ new Set(); for (const s of e) for (const i of Object.keys(s).filter((n) => !n.startsWith("_"))) t.add(i); return Array.from(t); } function Ae() { return typeof window < "u" && typeof document < "u"; } function Pe(e) { let t = e.parentNode; return t && t.toString() === "[object ShadowRoot]" && (t = t.host), t; } function te(e, t, s) { let i; return typeof e == "string" ? (i = parseInt(e, 10), e.indexOf("%") !== -1 && (i = i / 100 * t.parentNode[s])) : i = e, i; } const ie = (e) => e.ownerDocument.defaultView.getComputedStyle(e, null); function Mn(e, t) { return ie(e).getPropertyValue(t); } const kn = [ "top", "right", "bottom", "left" ]; function at(e, t, s) { const i = {}; s = s ? "-" + s : ""; for (let n = 0; n < 4; n++) { const o = kn[n]; i[o] = parseFloat(e[t + "-" + o + s]) || 0; } return i.width = i.left + i.right, i.height = i.top + i.bottom, i; } const Sn = (e, t, s) => (e > 0 || t > 0) && (!s || !s.shadowRoot); function On(e, t) { const s = e.touches, i = s && s.length ? s[0] : e, { offsetX: n, offsetY: o } = i; let r = !1, a, c; if (Sn(n, o, e.target)) a = n, c = o; else { const l = t.getBoundingClientRect(); a = i.clientX - l.left, c = i.clientY - l.top, r = !0; } return { x: a, y: c, box: r }; } function rt(e, t) { if ("native" in e) return e; const { canvas: s, currentDevicePixelRatio: i } = t, n = ie(s), o = n.boxSizing === "border-box", r = at(n, "padding"), a = at(n, "border", "width"), { x: c, y: l, box: h } = On(e, s), d = r.left + (h && a.left), f = r.top + (h && a.top); let { width: u, height: g } = t; return o && (u -= r.width + a.width, g -= r.height + a.height), { x: Math.round((c - d) / u * s.width / i), y: Math.round((l - f) / g * s.height / i) }; } function Dn(e, t, s) { let i, n; if (t === void 0 || s === void 0) { const o = e && Pe(e); if (!o) t = e.clientWidth, s = e.clientHeight; else { const r = o.getBoundingClientRect(), a = ie(o), c = at(a, "border", "width"), l = at(a, "padding"); t = r.width - l.width - c.width, s = r.height - l.height - c.height, i = te(a.maxWidth, o, "clientWidth"), n = te(a.maxHeight, o, "clientHeight"); } } return { width: t, height: s, maxWidth: i || Qt, maxHeight: n || Qt }; } const tt = (e) => Math.round(e * 10) / 10; function Cn(e, t, s, i) { const n = ie(e), o = at(n, "margin"), r = te(n.maxWidth, e, "clientWidth") || Qt, a = te(n.maxHeight, e, "clientHeight") || Qt, c = Dn(e, t, s); let { width: l, height: h } = c; if (n.boxSizing === "content-box") { const f = at(n, "border", "width"), u = at(n, "padding"); l -= u.width + f.width, h -= u.height + f.height; } return l = Math.max(0, l - o.width), h = Math.max(0, i ? l / i : h - o.height), l = tt(Math.min(l, r, c.maxWidth)), h = tt(Math.min(h, a, c.maxHeight)), l && !h && (h = tt(l / 2)), (t !== void 0 || s !== void 0) && i && c.height && h > c.height && (h = c.height, l = tt(Math.floor(h * i))), { width: l, height: h }; } function ts(e, t, s) { const i = t || 1, n = tt(e.height * i), o = tt(e.width * i); e.height = tt(e.height), e.width = tt(e.width); const r = e.canvas; return r.style && (s || !r.style.height && !r.style.width) && (r.style.height = `${e.height}px`, r.style.width = `${e.width}px`), e.currentDevicePixelRatio !== i || r.height !== n || r.width !== o ? (e.currentDevicePixelRatio = i, r.height = n, r.width = o, e.ctx.setTransform(i, 0, 0, i, 0, 0), !0) : !1; } const An = (function() { let e = !1; try { const t = { get passive() { return e = !0, !1; } }; Ae() && (window.addEventListener("test", null, t), window.removeEventListener("test", null, t)); } catch { } return e; })(); function es(e, t) { const s = Mn(e, t), i = s && s.match(/^(\d+)(\.\d+)?px$/); return i ? +i[1] : void 0; } function Wt(e, t, s) { return e.options.clip ? e[s] : t[s]; } function Pn(e, t) { const { xScale: s, yScale: i } = e; return s && i ? { left: Wt(s, t, "left"), right: Wt(s, t, "right"), top: Wt(i, t, "top"), bottom: Wt(i, t, "bottom") } : t; } function En(e, t) { const s = t._clip; if (s.disabled) return !1; const i = Pn(t, e.chartArea); return { left: s.left === !1 ? 0 : i.left - (s.left === !0 ? 0 : s.left), right: s.right === !1 ? e.width : i.right + (s.right === !0 ? 0 : s.right), top: s.top === !1 ? 0 : i.top - (s.top === !0 ? 0 : s.top), bottom: s.bottom === !1 ? e.height : i.bottom + (s.bottom === !0 ? 0 : s.bottom) }; } class Rn { constructor() { this._request = null, this._charts = /* @__PURE__ */ new Map(), this._running = !1, this._lastDate = void 0; } _notify(t, s, i, n) { const o = s.listeners[n], r = s.duration; o.forEach((a) => a({ chart: t, initial: s.initial, numSteps: r, currentStep: Math.min(i - s.start, r) })); } _refresh() { this._request || (this._running = !0, this._request = Fs.call(window, () => { this._update(), this._request = null, this._running && this._refresh(); })); } _update(t = Date.now()) { let s = 0; this._charts.forEach((i, n) => { if (!i.running || !i.items.length) return; const o = i.items; let r = o.length - 1, a = !1, c; for (; r >= 0; --r) c = o[r], c._active ? (c._total > i.duration && (i.duration = c._total), c.tick(t), a = !0) : (o[r] = o[o.length - 1], o.pop()); a && (n.draw(), this._notify(n, i, t, "progress")), o.length || (i.running = !1, this._notify(n, i, t, "complete"), i.initial = !1), s += o.length; }), this._lastDate = t, s === 0 && (this._running = !1); } _getAnims(t) { const s = this._charts; let i = s.get(t); return i || (i = { running: !1, initial: !0, items: [], listeners: { complete: [], progress: [] } }, s.set(t, i)), i; } listen(t, s, i) { this._getAnims(t).listeners[s].push(i); } add(t, s) { !s || !s.length || this._getAnims(t).items.push(...s); } has(t) { return this._getAnims(t).items.length > 0; } start(t) { const s = this._charts.get(t); s && (s.running = !0, s.start = Date.now(), s.duration = s.items.reduce((i, n) => Math.max(i, n._duration), 0), this._refresh()); } running(t) { if (!this._running) return !1; const s = this._charts.get(t); return !(!s || !s.running || !s.items.length); } stop(t) { const s = this._charts.get(t); if (!s || !s.items.length) return; const i = s.items; let n = i.length - 1; for (; n >= 0; --n) i[n].cancel(); s.items = [], this._notify(t, s, Date.now(), "complete"); } remove(t) { return this._charts.delete(t); } } var Z = /* @__PURE__ */ new Rn(); const ss = "transparent", In = { boolean(e, t, s) { return s > 0.5 ? t : e; }, color(e, t, s) { const i = Ke(e || ss), n = i.valid && Ke(t || ss); return n && n.valid ? n.mix(i, s).hexString() : t; }, number(e, t, s) { return e + (t - e) * s; } }; class Tn { constructor(t, s, i, n) { const o = s[i]; n = Ht([ t.to, n, o, t.from ]); const r = Ht([ t.from, o, n ]); this._active = !0, this._fn = t.fn || In[t.type || typeof r], this._easing = Ot[t.easing] || Ot.linear, this._start = Math.floor(Date.now() + (t.delay || 0)), this._duration = this._total = Math.floor(t.duration), this._loop = !!t.loop, this._target = s, this._prop = i, this._from = r, this._to = n, this._promises = void 0; } active() { return this._active; } update(t, s, i) { if (this._active) { this._notify(!1); const n = this._target[this._prop], o = i - this._start, r = this._duration - o; this._start = i, this._duration = Math.floor(Math.max(r, t.duration)), this._total += o, this._loop = !!t.loop, this._to = Ht([ t.to, s, n, t.from ]), this._from = Ht([ t.from, n, s ]); } } cancel() { this._active && (this.tick(Date.now()), this._active = !1, this._notify(!1)); } tick(t) { const s = t - this._start, i = this._duration, n = this._prop, o = this._from, r = this._loop, a = this._to; let c; if (this._active = o !== a && (r || s < i), !this._active) { this._target[n] = a, this._notify(!0); return; } if (s < 0) { this._target[n] = o; return; } c = s / i % 2, c = r && c > 1 ? 2 - c : c, c = this._easing(Math.min(1, Math.max(0, c))), this._target[n] = this._fn(o, a, c); } wait() { const t = this._promises || (this._promises = []); return new Promise((s, i) => { t.push({ res: s, rej: i }); }); } _notify(t) { const s = t ? "res" : "rej", i = this._promises || []; for (let n = 0; n < i.length; n++) i[n][s](); } } class Ln { constructor(t, s) { this._chart = t, this._properties = /* @__PURE__ */ new Map(), this.configure(s); } configure(t) { if (!w(t)) return; const s = Object.keys(R.animation), i = this._properties; Object.getOwnPropertyNames(t).forEach((n) => { const o = t[n]; if (!w(o)) return; const r = {}; for (const a of s) r[a] = o[a]; (B(o.properties) && o.properties || [ n ]).forEach((a) => { (a === n || !i.has(a)) && i.set(a, r); }); }); } _animateOptions(t, s) { const i = s.options, n = Fn(t, i); if (!n) return []; const o = this._createAnimations(n, i); return i.$shared && zn(t.options.$animations, i).then(() => { t.options = i; }, () => { }), o; } _createAnimations(t, s) { const i = this._properties, n = [], o = t.$animations || (t.$animations = {}), r = Object.keys(s), a = Date.now(); let c; for (c = r.length - 1; c >= 0; --c) { const l = r[c]; if (l.charAt(0) === "$") continue; if (l === "options") { n.push(...this._animateOptions(t, s)); continue; } const h = s[l]; let d = o[l]; const f = i.get(l); if (d) if (f && d.active()) { d.update(f, h, a); continue; } else d.cancel(); if (!f || !f.duration) { t[l] = h; continue; } o[l] = d = new Tn(f, t, l, h), n.push(d); } return n; } update(t, s) { if (this._properties.size === 0) { Object.assign(t, s); return; } const i = this._createAnimations(t, s); if (i.length) return Z.add(this._chart, i), !0; } } function zn(e, t) { const s = [], i = Object.keys(t); for (let n = 0; n < i.length; n++) { const o = e[i[n]]; o && o.active() && s.push(o.wait()); } return Promise.all(s); } function Fn(e, t) { if (!t) return; let s = e.options; if (!s) { e.options = t; return; } return s.$shared && (e.options = s = Object.assign({}, s, { $shared: !1, $animations: {} })), s; } function is(e, t) { const s = e && e.options || {}, i = s.reverse, n = s.min === void 0 ? t : 0, o = s.max === void 0 ? t : 0; return { start: i ? o : n, end: i ? n : o }; } function jn(e, t, s) { if (s === !1) return !1; const i = is(e, s), n = is(t, s); return { top: n.end, right: i.end, bottom: n.start, left: i.start }; } function Bn(e) { let t, s, i, n; return w(e) ? (t = e.top, s = e.right, i = e.bottom, n = e.left) : t = s = i = n = e, { top: t, right: s, bottom: i, left: n, disabled: e === !1 }; } function Us(e, t) { const s = [], i = e._getSortedDatasetMetas(t); let n, o; for (n = 0, o = i.length; n < o; ++n) s.push(i[n].index); return s; } function ns(e, t, s, i = {}) { const n = e.keys, o = i.mode === "single"; let r, a, c, l; if (t === null) return; let h = !1; for (r = 0, a = n.length; r < a; ++r) { if (c = +n[r], c === s) { if (h = !0, i.all) continue; break; } l = e.values[c], pt(l) && (o || t === 0 || We(t) === We(l)) && (t += l); } return !h && !i.all ? 0 : t; } function Hn(e, t) { const { iScale: s, vScale: i } = t, n = s.axis === "x" ? "x" : "y", o = i.axis === "x" ? "x" : "y", r = Object.keys(e), a = new Array(r.length); let c, l, h; for (c = 0, l = r.length; c < l; ++c) h = r[c], a[c] = { [n]: h, [o]: e[h] }; return a; } function he(e, t) { const s = e && e.options.stacked; return s || s === void 0 && t.stack !== void 0; } function Wn(e, t, s) { return `${e.id}.${t.id}.${s.stack || s.type}`; } function Vn(e) { const { min: t, max: s, minDefined: i, maxDefined: n } = e.getUserBounds(); return { min: i ? t : Number.NEGATIVE_INFINITY, max: n ? s : Number.POSITIVE_INFINITY }; } function Nn(e, t, s) { const i = e[t] || (e[t] = {}); return i[s] || (i[s] = {}); } function os(e, t, s, i) { for (const n of t.getMatchingVisibleMetas(i).reverse()) { const o = e[n.index]; if (s && o > 0 || !s && o < 0) return n.index; } return null; } function rs(e, t) { const { chart: s, _cachedMeta: i } = e, n = s._stacks || (s._stacks = {}), { iScale: o, vScale: r, index: a } = i, c = o.axis, l = r.axis, h = Wn(o, r, i), d = t.length; let f; for (let u = 0; u < d; ++u) { const g = t[u], { [c]: m, [l]: b } = g, p = g._stacks || (g._stacks = {}); f = p[l] = Nn(n, h, m), f[a] = b, f._top = os(f, r, !0, i.type), f._bottom = os(f, r, !1, i.type); const _ = f._visualValues || (f._visualValues = {}); _[a] = b; } } function de(e, t) { const s = e.scales; return Object.keys(s).filter((i) => s[i].axis === t).shift(); } function $n(e, t) { return Tt(e, { active: !1, dataset: void 0, datasetIndex: t, index: t, mode: "default", type: "dataset" }); } function Yn(e, t, s) { return Tt(e, { active: !1, dataIndex: t, parsed: void 0, raw: void 0, element: s, index: t, mode: "default", type: "data" }); } function xt(e, t) { const s = e.controller.index, i = e.vScale && e.vScale.axis; if (i) { t = t || e._parsed; for (const n of t) { const o = n._stacks; if (!o || o[i] === void 0 || o[i][s] === void 0) return; delete o[i][s], o[i]._visualValues !== void 0 && o[i]._visualValues[s] !== void 0 && delete o[i]._visualValues[s]; } } } const fe = (e) => e === "reset" || e === "none", as = (e, t) => t ? e : Object.assign({}, e), Xn = (e, t, s) => e && !t.hidden && t._stacked && { keys: Us(s, !0), values: null }; class qs { static defaults = {}; static datasetElementType = null; static dataEleme