UNPKG

vue-data-ui

Version:

A user-empowering data visualization Vue 3 components library for eloquent data storytelling

1,687 lines 57.7 kB
import { unref as tt, isRef as nt, toRaw as ft } from "vue"; const ht = "#COMP# dataset prop is either missing, undefined or empty.", Ft = "#COMP# dataset is missing the '#ATTR#' attribute.", gt = "#COMP# dataset '#ATTR#' attribute cannot be empty.", dt = "#COMP# dataset #KEY# item at index #INDX# is missing the '#ATTR#' attribute.", pt = "#COMP# : Chart could not be built. Dataset is not formatted correctly", Et = "#COMP# : A wrong value was provided to the #ATTR# attribute (#KEY# is not a valid value).", At = { dataset: ht, datasetAttribute: Ft, datasetAttributeEmpty: gt, datasetSerieAttribute: dt, notBuildable: pt, attributeWrongValue: Et }; function Ht(t, n, e, o, r, s = 1.99999, c = 2, i = 1.45, l = 360, u = 105.25, a = 0) { const { series: f } = t; if (!f || f.length === 0) return []; const h = f.reduce((p, y) => p + y.value, 0), F = []; let g = 0; for (let p = 0; p < f.length; p++) { const y = f[p].value, x = f.length === 1, E = x ? 1 : h > 0 ? y / h : 0, M = E * (Math.PI * s), O = (x ? 0.5 : h > 0 ? y / 2 / h : 0.5) * (Math.PI * c), { startX: L, startY: m, endX: $, endY: C, path: D } = Z( [n, e], [o, r], [g, M], u, l, c ), d = Z( [n, e], [o - a, r - a], [g, M], u, l, c, !0 ), I = Z( [n, e], [o * i, r * i], [g, O], u, l, c ); F.push({ arcSlice: `${D} L ${d.startX} ${d.startY} ${d.path} L ${L} ${m}`, cx: A(n), cy: A(e), ...f[p], proportion: A(E), ratio: A(M), path: D.replaceAll("NaN", "0"), startX: A(L), startY: A(m), endX: A($), endY: A(C), separator: { x: d.startX, y: d.startY }, firstSeparator: { x: Number(d.path.split(" ").at(-2)), y: Number(d.path.split(" ").at(-1)) }, center: I }), g += M; } return F; } function rt([t, n], [e, o]) { return [t + e, n + o]; } function st([[t, n], [e, o]], [r, s]) { return [t * r + n * s, e * r + o * s]; } function yt(t) { return [ [Math.cos(t), -Math.sin(t)], [Math.sin(t), Math.cos(t)] ]; } function Z([t, n], [e, o], [r, s], c, i = 360, l = 2, u = !1) { s = s % (l * Math.PI); const a = yt(c), [f, h] = rt( st(a, [ e * Math.cos(r), o * Math.sin(r) ]), [t, n] ), [F, g] = rt( st(a, [ e * Math.cos(r + s), o * Math.sin(r + s) ]), [t, n] ), p = s > Math.PI ? 1 : 0, y = s > 0 ? u ? 0 : 1 : u ? 1 : 0; return { startX: A(u ? F : f), startY: A(u ? g : h), endX: A(u ? f : F), endY: A(u ? h : g), path: `M${A(u ? F : f)} ${A(u ? g : h)} A ${[ A(e), A(o), A(c / (l * Math.PI) * i), A(p), A(y), A(u ? f : F), A(u ? h : g) ].join(" ")}` }; } function xt({ defaultConfig: t, userConfig: n }) { const e = { ...t }; return Object.keys(e).forEach((o) => { if (Object.hasOwn(n, o)) { const r = n[o]; r === null ? e[o] = null : ["boolean", "function"].includes(typeof r) ? e[o] = r : ["string", "number"].includes(typeof r) ? et(r) && (e[o] = r) : Array.isArray(e[o]) ? mt({ userConfig: n, key: o }) && (e[o] = r) : bt({ userConfig: n, key: o }) && (e[o] = xt({ defaultConfig: e[o], userConfig: r })); } }), Object.keys(n).forEach((o) => { if (!Object.hasOwn(e, o)) { const r = n[o]; e[o] = r && typeof r == "object" && !Array.isArray(r) ? { ...r } : r; } }), e; } function mt({ userConfig: t, key: n }) { return Object.hasOwn(t, n) && Array.isArray(t[n]) && t[n].length >= 0; } function bt({ userConfig: t, key: n }) { return Object.hasOwn(t, n) && !Array.isArray(t[n]) && typeof t[n] == "object"; } function et(t) { return ![null, void 0, NaN, 1 / 0, -1 / 0].includes(t); } function Ut(t) { return ![void 0, NaN, 1 / 0, -1 / 0].includes(t); } function Gt(t, n = 0) { return et(t) ? t : n; } function A(t, n = 0) { return isNaN(t) ? n : t; } const ot = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5", "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ]; function vt(t = "default") { switch (t) { case "hack": return v.hack; case "zen": return v.zen; case "concrete": return v.concrete; case "celebration": return v.celebration; case "celebrationNight": return v.celebrationNight; default: return v.default; } } const v = { default: ot, dark: ot, celebration: [ "#D32F2F", "#E64A19", "#F57C00", "#FF9800", "#FF5722", "#FFC107", "#FFEB3B", "#FFD54F", "#FF6F00", "#D84315", "#BF360C", "#C62828", "#B71C1C", "#FF7043", "#FF8A65", "#FFB74D", "#FFA726", "#FFCC80", "#FFE082", "#FFECB3" ], celebrationNight: [ "#D32F2F", "#E64A19", "#F57C00", "#FF9800", "#FF5722", "#FFC947", "#FFEB3B", "#FFD95B", "#FF8800", "#FF5722", "#DD2C00", "#F44336", "#C62828", "#FF6E6E", "#FF867C", "#FFB547", "#FFA837", "#FFD180", "#FFE57F", "#FFF59D" ], concrete: [ "#4A6A75", "#6C94A0", "#7DA9B5", "#8EBFCA", "#9FD4E0", "#B0E9F5", "#C1FFFF", "#5C6B5B", "#6D7D6D", "#7E8F7E", "#8FA290", "#A1B5A3", "#B2C7B5", "#C3DAC8", "#D4ECDA", "#E6FFF0", "#8A9CA5", "#9AA7B0", "#ABB1BC", "#BBCBC7", "#CCD6D3", "#DEE1DE", "#EFECEC", "#404C4D", "#50605F", "#617472", "#718885", "#829C98", "#92B0AB", "#A3C4BE", "#B3D8D2", "#C4EDE5", "#D4F1E8", "#404C5A", "#50606C", "#61747E", "#718890", "#829CA2", "#92B0B5" ], hack: [ "#004C00", "#006600", "#008000", "#009900", "#00B300", "#00CC00", "#00E600", "#00FF00", "#33FF33", "#33E633", "#33CC33", "#33B333", "#339933", "#338033", "#336633", "#334C33", "#333333", "#00AF19", "#19E619", "#19CC19", "#19B319", "#199919", "#198019", "#196619", "#194C19", "#193319", "#191919", "#66FF66", "#66E666", "#66CC66", "#66B366", "#669966", "#668066", "#666666", "#4CFF4C", "#4CE64C", "#4CCC4C", "#4CB34C" ], zen: [ "#B9B99D", "#E0CFC3", "#DFCA99", "#DCB482", "#C09E85", "#8F837A", "#858480", "#B0B9A8", "#606C5A", "#5E5E5E", "#4F5B75", "#647393", "#818EA9", "#9FA9BE", "#BBC4D3", "#DCDFE7", "#928A98", "#8A9892", "#B1A7AD", "#C5B8A7", "#EBD6CC", "#D7E0D2", "#E0D2D7", "#E0DBD2", "#D2E0DB", "#DBD2E0", "#C1B7A5", "#A5AFC1", "#E0DBD2", "#D2D7E0", "#F7EDE2", "#97ACB7", "#C4CBBC", "#C3C5C5", "#A0AC94" ] }, it = ["00", "03", "05", "08", "0A", "0D", "0F", "12", "14", "17", "1A", "1C", "1F", "21", "24", "26", "29", "2B", "2E", "30", "33", "36", "38", "3B", "3D", "40", "42", "45", "47", "4A", "4D", "4F", "52", "54", "57", "59", "5C", "5E", "61", "63", "66", "69", "6B", "6E", "70", "73", "75", "78", "7A", "7D", "80", "82", "85", "87", "8A", "8C", "8F", "91", "94", "96", "99", "9C", "9E", "A1", "A3", "A6", "A8", "AB", "AD", "B0", "B3", "B5", "B8", "BA", "BD", "BF", "C2", "C4", "C7", "C9", "CC", "CF", "D1", "D4", "D6", "D9", "DB", "DE", "E0", "E3", "E6", "E8", "EB", "ED", "F0", "F2", "F5", "F7", "FA", "FC", "FF"]; function ut(t) { const n = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i, e = /^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i, o = /^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)$/i, r = /^hsla?\((\d+),\s*([\d.]+)%,\s*([\d.]+)%(?:,\s*([\d.]+))?\)$/i; if (t == null || typeof t == "number" && isNaN(t)) return null; if (t = nt?.(t) ? tt(t) : t, t = It(t), Array.isArray(t)) { const [i, l, u, a = 1] = t; t = `rgba(${i},${l},${u},${a})`; } else if (typeof t == "object") if (Number.isFinite(t.r) && Number.isFinite(t.g) && Number.isFinite(t.b)) { const i = Number.isFinite(t.a) ? t.a : 1; t = `rgba(${t.r},${t.g},${t.b},${i})`; } else return null; else if (typeof t == "number") { const i = t >>> 0, l = i.toString(16).padStart(i <= 16777215 ? 6 : 8, "0"); return `#${l.length === 6 ? l + "ff" : l}`; } else if (typeof t != "string") return null; if (t = t.trim(), t.toLowerCase() === "transparent") return "#FFFFFF00"; t = t.replace(e, (i, l, u, a, f) => `#${l}${l}${u}${u}${a}${a}${f ? f + f : ""}`); let s, c = 1; if (s = t.match(n)) { const [, i, l, u, a] = s; return c = a ? parseInt(a, 16) / 255 : 1, `#${i}${l}${u}${G(Math.round(c * 255))}`; } else if (s = t.match(o)) { const [, i, l, u, a] = s; return c = a ? parseFloat(a) : 1, `#${G(i)}${G(l)}${G(u)}${G(Math.round(c * 255))}`; } else if (s = t.match(r)) { const [, i, l, u, a] = s; c = a ? parseFloat(a) : 1; const [f, h, F] = Ct(Number(i), Number(l), Number(u)); return `#${G(f)}${G(h)}${G(F)}${G(Math.round(c * 255))}`; } return null; } function G(t) { const n = Number(t).toString(16); return n.length === 1 ? "0" + n : n; } function Ct(t, n, e, o = 1) { t /= 360, n /= 100, e /= 100; let r, s, c; if (n === 0) r = s = c = e; else { const i = (a, f, h) => (h < 0 && (h += 1), h > 1 && (h -= 1), h < 0.16666666666666666 ? a + (f - a) * 6 * h : h < 0.5 ? f : h < 0.6666666666666666 ? a + (f - a) * (0.6666666666666666 - h) * 6 : a), l = e < 0.5 ? e * (1 + n) : e + n - e * n, u = 2 * e - l; r = i(u, l, t + 1 / 3), s = i(u, l, t), c = i(u, l, t - 1 / 3); } return [ Math.round(r * 255), Math.round(s * 255), Math.round(c * 255), o ]; } function Xt(t, n) { const e = t.length === 9 ? t.substring(0, 7) : t, o = t.length === 9 ? t.substring(7, 9) : null, r = (f) => ({ r: parseInt(f.substring(1, 3), 16), g: parseInt(f.substring(3, 5), 16), b: parseInt(f.substring(5, 7), 16) }), s = ({ r: f, g: h, b: F }) => { f /= 255, h /= 255, F /= 255; const g = Math.max(f, h, F), p = Math.min(f, h, F); let y, x, E = (g + p) / 2; if (g === p) y = x = 0; else { const M = g - p; switch (x = E > 0.5 ? M / (2 - g - p) : M / (g + p), g) { case f: y = (h - F) / M + (h < F ? 6 : 0); break; case h: y = (F - f) / M + 2; break; case F: y = (f - h) / M + 4; break; } y /= 6; } return { h: y, s: x, l: E }; }, c = ({ h: f, s: h, l: F }) => { let g, p, y; if (h === 0) g = p = y = F; else { const x = (R, O, L) => (L < 0 && (L += 1), L > 1 && (L -= 1), L < 0.16666666666666666 ? R + (O - R) * 6 * L : L < 0.5 ? O : L < 0.6666666666666666 ? R + (O - R) * (0.6666666666666666 - L) * 6 : R), E = F < 0.5 ? F * (1 + h) : F + h - F * h, M = 2 * F - E; g = x(M, E, f + 1 / 3), p = x(M, E, f), y = x(M, E, f - 1 / 3); } return { r: Math.round(g * 255), g: Math.round(p * 255), b: Math.round(y * 255) }; }, i = r(e || "#000000"), l = s(i); l.h += n, l.h = (l.h + 1) % 1; const u = c(l); return `#${(u.r << 16 | u.g << 8 | u.b).toString(16).padStart(6, "0")}` + (o || ""); } function Mt({ centerX: t, centerY: n, outerPoints: e, radius: o, rotation: r }) { const s = Math.PI / e, c = r; let i = ""; const l = []; for (let u = 0; u < e * 2; u += 1) { let a = t + Math.cos(u * s + c) * o, f = n + Math.sin(u * s + c) * o; i += `${a},${f} `, l.push({ x: a, y: f }); } return { path: `M${i}Z`, coordinates: l }; } function jt({ plot: t, radius: n, sides: e, rotation: o = 0 }) { const r = t.x, s = t.y, c = e / 2; return Mt({ centerX: r, centerY: s, outerPoints: c, radius: n + 1, rotation: o }); } function $t({ centerX: t, centerY: n, innerCirclePoints: e, innerRadius: o, outerRadius: r }) { const s = Math.PI / e, c = 60, i = e * 2; let l = ""; for (let u = 0; u < i; u += 1) { let f = u % 2 == 0 ? r : o, h = t + Math.cos(u * s + c) * f, F = n + Math.sin(u * s + c) * f; l += `${h},${F} `; } return l; } function Kt({ plot: t, radius: n, apexes: e = 5 }) { const o = t.x, r = t.y, s = e, c = n * 3.5 / s, l = c * 2; return $t({ centerX: o, centerY: r, innerCirclePoints: s, innerRadius: c, outerRadius: l }); } function Wt({ series: t }) { if (!Array.isArray(t) || t.length === 0) return ""; const n = Array.from( new Map( t.filter((a) => a && Number.isFinite(a.x) && Number.isFinite(a.y)).map((a) => [`${a.x},${a.y}`, { x: +a.x, y: +a.y }]) ).values() ); if (n.length === 0) return ""; if (n.length === 1) return `${Math.round(n[0].x)},${Math.round(n[0].y)} `; const e = (a, f) => { const h = a.x - f.x, F = a.y - f.y; return h * h + F * F; }, o = (a, f, h) => (f.x - a.x) * (h.y - a.y) - (f.y - a.y) * (h.x - a.x); let r = n[0]; for (const a of n) (a.x < r.x || a.x === r.x && a.y < r.y) && (r = a); const s = [r]; let c = r; const i = n.length + 2; let l = 0; for (; !(++l > i); ) { let a = n[0] === c ? n[1] : n[0]; for (const f of n) { if (f === c || f === a) continue; const h = o(c, a, f); h < 0 || (h > 0 || e(c, f) > e(c, a)) && (a = f); } if (a === r) break; s.push(a), c = a; } let u = ""; for (const a of s) u += `${Math.round(a.x)},${Math.round(a.y)} `; return u; } function X(t) { return t * Math.PI / 180; } function Vt(t) { if (t) { let n = t, e = 1; if (n.startsWith("rgba")) { const u = n.match(/rgba?\((\d+), (\d+), (\d+), ([\d.]+)\)/); if (u) { const [, a, f, h, F] = u; e = parseFloat(F), n = `#${parseInt(a).toString(16).padStart(2, "0")}${parseInt(f).toString(16).padStart(2, "0")}${parseInt(h).toString(16).padStart(2, "0")}`; } } n.charAt(0) !== "#" && (n = this.rgbToHex(t)), n = n.substring(1, 7); let o = parseInt(n.substring(0, 2), 16), r = parseInt(n.substring(2, 4), 16), s = parseInt(n.substring(4, 6), 16), i = [o / 255, r / 255, s / 255].map((u) => u <= 0.03928 ? u / 12.92 : Math.pow((u + 0.055) / 1.055, 2.4)), l = 0.2126 * i[0] + 0.7152 * i[1] + 0.0722 * i[2]; return e < 1 ? e * l + (1 - e) * 1 > 0.3 ? "#000000" : "#FFFFFF" : l > 0.3 ? "#000000" : "#FFFFFF"; } return "#000000"; } function K(t) { return t !== null && typeof t == "object" && Object.prototype.toString.call(t) === "[object Object]" && (t.constructor === Object || t.constructor == null); } function Q(t) { return !!t && (t.__v_isRef || t.__v_isReactive || t.__v_isReadonly || t.effect || t.dep || t.deps || t.subs); } function ct(t) { return t === "" ? "#000000" : t === "transparent" ? "#FFFFFF00" : ut(t) ?? t; } function q(t, n = /* @__PURE__ */ new WeakSet()) { const e = ft(t); if (!K(e) || n.has(e)) return e; n.add(e); for (const o in e) { const r = nt(e[o]) ? tt(e[o]) : e[o]; if (o === "color" || o === "backgroundColor") { typeof r == "string" && (e[o] = ct(r)); continue; } if (o === "stroke") { typeof r == "string" ? e[o] = ct(r) : K(r) && !Q(r) && q(r, n); continue; } if (Array.isArray(r)) { for (const s of r) K(s) && !Q(s) && q(s, n); continue; } K(r) && !Q(r) && q(r, n); } return e; } function _t(t) { const n = t?.length ?? 0; if (n < 2) return { x1: 0, y1: 0, x2: 0, y2: 0, slope: 0, trend: 0 }; let e = 0, o = 0, r = 0, s = 0; for (const { x: C, y: D } of t) e += C, o += D, r += C * D, s += C * C; const c = n * s - e * e || 1, i = (n * r - e * o) / c, l = (o - i * e) / n, u = t[0].x, a = t[n - 1].x, f = i * u + l, h = i * a + l; let F = 0, g = 0, p = 0, y = 0; for (let C = 0; C < n; C += 1) F += C, g += t[C].value, p += C * t[C].value, y += C * C; const x = n * y - F * F || 1, E = (n * p - F * g) / x, M = (g - E * F) / n, R = M, O = E * (n - 1) + M, m = Math.max(Math.abs(R), Math.abs(g / n), Math.abs(O), 1e-9), $ = (O - R) / m; return { x1: u, y1: f, x2: a, y2: h, slope: i, trend: $ }; } function zt(t) { const n = Math.floor(t.length / 2), e = [...t].sort((o, r) => o - r); return t.length % 2 !== 0 ? e[n] : (e[n - 1] + e[n]) / 2; } function Zt(t) { let n = []; for (let e = 0; e < t.length; e += 1) n.push(`${A(t[e].x)},${A(t[e].y)} `); return n.join(" ").trim(); } function Qt(t) { if (t.length < 2) return "0,0"; const n = t.length - 1, e = [`${A(t[0].x)},${A(t[0].y)}`], o = [], r = [], s = [], c = []; for (let i = 0; i < n; i += 1) o[i] = t[i + 1].x - t[i].x, r[i] = t[i + 1].y - t[i].y, s[i] = r[i] / o[i]; c[0] = s[0], c[n] = s[n - 1]; for (let i = 1; i < n; i += 1) if (s[i - 1] * s[i] <= 0) c[i] = 0; else { const l = 2 * s[i - 1] * s[i] / (s[i - 1] + s[i]); c[i] = l; } for (let i = 0; i < n; i += 1) { const l = t[i].x, u = t[i].y, a = t[i + 1].x, f = t[i + 1].y, h = c[i], F = c[i + 1], g = l + (a - l) / 3, p = u + h * (a - l) / 3, y = a - (a - l) / 3, x = f - F * (a - l) / 3; e.push(`C ${A(g)},${A(p)} ${A(y)},${A(x)} ${A(a)},${A(f)}`); } return e.join(" "); } function qt(t, n = 0.2) { function e(c, i) { const l = i.x - c.x, u = i.y - c.y; return { length: Math.sqrt(Math.pow(l, 2) + Math.pow(u, 2)), angle: Math.atan2(u, l) }; } function o(c, i, l, u) { const h = e(i || c, l || c), F = h.angle + (u ? Math.PI : 0), g = h.length * n, p = c.x + Math.cos(F) * g, y = c.y + Math.sin(F) * g; return { x: p, y }; } function r(c, i, l) { const u = o(l[i - 1], l[i - 2], c), a = o(c, l[i - 1], l[i + 1], !0); return `C ${A(u.x)},${A(u.y)} ${A(a.x)},${A(a.y)} ${A(c.x)},${A(c.y)}`; } return t.filter((c) => !!c).reduce( (c, i, l, u) => l === 0 ? `${A(i.x)},${A(i.y)} ` : `${c} ${r(i, l, u)} `, "" ); } function Jt() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(t) { const n = Math.random() * 16 | 0; return (t == "x" ? n : n & 3 | 8).toString(16); }); } function W(t, n = !1, e = 16, o = !1) { let r = 0, s = n ? e : 0, c = o ? "center" : "middle"; return t.center.endX > t.cx ? (r = t.center.endX + e + s, c = o ? "left" : "start") : t.center.endX < t.cx ? (r = t.center.endX - e - s, c = o ? "right" : "end") : (r = t.centerX + s, c = o ? "center" : "middle"), { x: r, anchor: c }; } function V(t, n = 16, e = 16) { return t.center.endY > t.cy ? t.center.endY + e : t.center.endY < t.cy ? t.center.endY - n : t.center.endY; } function tn({ initX: t, initY: n, offset: e, centerX: o, centerY: r }) { const s = Math.atan2(n - r, t - o); return { x: t + e * Math.cos(s), y: n + e * Math.sin(s) }; } function Dt(t) { const n = document.createElementNS("http://www.w3.org/2000/svg", "path"); n.setAttribute("d", t); const e = n.getTotalLength(); let o = 0, r = e, s = e / 2; const c = 0.01; for (; r - o > c; ) { const u = (o + r) / 2, f = n.getPointAtLength(u).x; if (Math.abs(f - s) < c) { s = u; break; } else f < s ? o = u : r = u; } const { x: i, y: l } = n.getPointAtLength(s); return { x: i, y: l }; } function nn(t, n = !1, e = 16, o = 16, r = !1, s = !1, c = 0, i = 12, l = !1) { const { x: u } = Dt(t.path), a = `${W(t).x},${V(t, e, o) - 4} `; let f = "", h, F; u > t.cx ? (h = W(t).x - i, F = V(t, e, o) - 4, f = `${h},${F}`) : u < t.cx ? (h = W(t).x + i, F = V(t, e, o) - 4, f = `${h},${F}`) : (h = W(t).x + i, F = V(t, e, o) - 4, f = `${h},${F}`); const g = ` ${t.center.endX},${t.center.endY}`; return l ? s ? `M${f} Q${f} ${g}` : `M${a} Q${f} ${g}` : `M${s ? "" : a}${f}${g}`; } function en(t) { return ![null, void 0, NaN].includes(t); } function rn(t, n) { return [...t].map((e) => e[n]).reduce((e, o) => e + o, 0); } function sn(t, n = !0, e = !1) { if (!t.length) return "M0,0"; let o = ""; return t.forEach((r) => { if (!r) return ""; o += `${r.x},${r.y} `; }), e ? o.trim() : `M${o}${n ? "Z" : ""}`; } function on({ csvContent: t, title: n = "vue-data-ui" }) { const e = encodeURI(t), o = document.createElement("a"); o.setAttribute("href", e), o.setAttribute("download", `${n}.csv`), document.body.appendChild(o), o.click(), o.remove(), window.URL.revokeObjectURL(e); } function cn(t) { return `data:text/csv;charset=utf-8,${t.map((n) => n.join(",")).join(` `)}`; } function an(t, n) { if (!/^#([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(t)) return console.warn("lightenHexColor : Invalid hex color format"), "#000000"; let e = t.replace("#", ""); e.length === 3 && (e = e.split("").map((a) => a + a).join("")); const o = parseInt(e.substring(0, 2), 16), r = parseInt(e.substring(2, 4), 16), s = parseInt(e.substring(4, 6), 16), c = Math.min(255, o + (255 - o) * n), i = Math.min(255, r + (255 - r) * n), l = Math.min(255, s + (255 - s) * n), u = `#${Math.round(c).toString(16).padStart(2, "0")}${Math.round(i).toString(16).padStart(2, "0")}${Math.round(l).toString(16).padStart(2, "0")}`; if (e.length === 8) { const a = e.substring(6, 8); return u + a; } return u; } function ln(t, n) { if (!/^#([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(t)) return console.warn("darkenHexColor: Invalid hex color format"), "#000000"; let e = t.replace("#", ""); e.length === 3 && (e = e.split("").map((a) => a + a).join("")); const o = parseInt(e.substring(0, 2), 16), r = parseInt(e.substring(2, 4), 16), s = parseInt(e.substring(4, 6), 16), c = Math.max(0, o - o * n), i = Math.max(0, r - r * n), l = Math.max(0, s - s * n), u = `#${Math.round(c).toString(16).padStart(2, "0")}${Math.round(i).toString(16).padStart(2, "0")}${Math.round(l).toString(16).padStart(2, "0")}`; if (e.length === 8) { const a = e.substring(6, 8); return u + a; } return u; } function z(t, n) { const e = Math.floor(Math.log10(t)), o = t / Math.pow(10, e); let r; return n ? o < 1.5 ? r = 1 : o < 3 ? r = 2 : o < 7 ? r = 5 : r = 10 : o <= 1 ? r = 1 : o <= 2 ? r = 2 : o <= 5 ? r = 5 : r = 10, r * Math.pow(10, e); } function un(t, n, e, o = !1) { const r = o ? n - t : z(n - t, !1), s = o ? r / (e - 1) : z(r / (e - 1), !0), c = Math.floor(t / s) * s, i = Math.ceil(n / s) * s, l = []; for (let u = c; u <= i; u += s) l.push(u); return { min: c, max: i, tickSize: s, ticks: l }; } function fn(t, n, e, o = !1) { const r = o ? n - t : z(n - t, !1), s = o ? r / (e - 1) : z(r / (e - 1), !0), c = Math.floor(t / s) * s, i = Math.ceil(n / s) * s; let l = [], u = c; for (; u <= i; ) u >= t && u <= n && l.push(u), u += s; return l[0] !== t && (l[0] = t), l[l.length - 1] !== n && (l[l.length - 1] = n), { min: t, max: n, tickSize: s, ticks: l }; } function hn(t, n, e, o, r) { const s = (h) => { let F = parseInt(h.substring(1, 3), 16), g = parseInt(h.substring(3, 5), 16), p = parseInt(h.substring(5, 7), 16), y = 1; return h.length === 9 && (y = parseInt(h.substring(7, 9), 16) / 255), { r: F, g, b: p, a: y }; }, c = ({ r: h, g: F, b: g, a: p }) => { const y = (E) => E.toString(16).padStart(2, "0"), x = `#${y(h)}${y(F)}${y(g)}`; if (p !== 1) { const E = Math.round(p * 255).toString(16).padStart(2, "0"); return x + E; } return x; }, i = s(t), l = s(n); r = Math.min(Math.max(r, e), o); const u = (r - e) / (o - e), a = { r: Math.round(i.r + (l.r - i.r) * u), g: Math.round(i.g + (l.g - i.g) * u), b: Math.round(i.b + (l.b - i.b) * u) }, f = i.a + (l.a - i.a) * u; return c({ ...a, a: f }); } function Fn({ p: t = "", v: n, s: e = "", r: o = 0, space: r = !1, isAnimating: s = !1, regex: c = /[^%]/g, replacement: i = "-", locale: l = null }) { const u = l ? Number(Number(n).toFixed(o)).toLocaleString(l) : Number(Number(n).toFixed(o)).toLocaleString(), a = u === 1 / 0 ? "∞" : u === -1 / 0 ? "-∞" : u, f = `${t ?? ""}${r ? " " : ""}${[void 0, null].includes(n) ? "-" : a}${r ? " " : ""}${e ?? ""}`; return s ? f.replace(c, i) : f; } function gn({ source: t, length: n = 3 }) { if (!t && t !== 0) return ""; t = String(t); const e = t.length > 1 ? t.split(" ") : [t]; if (e.length === 1 && e[0].length === 1) return String(t).toUpperCase(); if (e.length === 1) return t.slice(0, n).toUpperCase(); { const o = []; return e.forEach((r, s) => { s < n && o.push(r.slice(0, 1)); }), o.join().replaceAll(",", "").toUpperCase(); } } function dn(t) { return !!t && typeof t == "function"; } function pn(t) { return typeof t.apply(null, arguments) == "string"; } function En(t) { return Array.isArray(t) ? t.length === 0 : t ? Object.keys(t).length === 0 : !0; } function An({ componentName: t, type: n, property: e = "", index: o = "", key: r = "", warn: s = !0, debug: c = !0 }) { if (!c) return; const i = ` > ${At[n].replace("#COMP#", t).replace("#ATTR#", e).replace("#INDX#", o).replace("#KEY#", r)} `; if (s) console.warn(i); else throw new Error(i); } function St({ points: t, a: n, b: e, angleStep: o, startX: r, startY: s }) { const c = []; for (let i = 0; i < t; i++) { const l = o * i, u = n + e * l, a = u * Math.cos(l) + r, f = u * Math.sin(l) + s; c.push({ x: a, y: f }); } return c; } function Rt(t) { let n = 1 / 0, e = 1 / 0, o = -1 / 0, r = -1 / 0; for (const s of t) s.x < n && (n = s.x), s.y < e && (e = s.y), s.x > o && (o = s.x), s.y > r && (r = s.y); return { minX: n, minY: e, maxX: o, maxY: r, width: o - n || 1, height: r - e || 1 }; } function Bt(t) { if (!t.length) return ""; let n = `M${t[0].x} ${t[0].y}`; for (let e = 1; e < t.length - 2; e += 2) { const o = t[e - 1], r = t[e], s = t[e + 1], c = t[e + 2], i = (o.x + r.x) / 2, l = (o.y + r.y) / 2, u = (r.x + s.x) / 2, a = (r.y + s.y) / 2, f = (s.x + c.x) / 2, h = (s.y + c.y) / 2; n += ` C${i} ${l}, ${u} ${a}, ${f} ${h}`; } return n; } function yn({ maxPoints: t, a: n = 6, b: e = 6, angleStep: o = 0.07, startX: r, startY: s, boxWidth: c, boxHeight: i, padding: l = 12 }) { const u = St({ points: t, a: n, b: e, angleStep: o, startX: 0, startY: 0 }), { minX: a, minY: f, maxX: h, maxY: F, width: g, height: p } = Rt(u), y = (a + h) / 2, x = (f + F) / 2, E = Math.max(1, c - 2 * l), M = Math.max(1, i - 2 * l), R = Math.min(E / g, M / p), O = r - y * R, L = s - x * R; return function($) { const C = Math.max(2, Math.min(Math.round($), u.length)), D = u.slice(0, C).map((d) => ({ x: d.x * R + O, y: d.y * R + L })); return Bt(D); }; } function xn({ datasetObject: t, requiredAttributes: n }) { let e = []; return n.forEach((o) => { Object.hasOwn(t, o) || e.push(o); }), e; } const at = { ALICEBLUE: "#F0F8FF", ANTIQUEWHITE: "#FAEBD7", AQUA: "#00FFFF", AQUAMARINE: "#7FFFD4", AZURE: "#F0FFFF", BEIGE: "#F5F5DC", BISQUE: "#FFE4C4", BLACK: "#000000", BLANCHEDALMOND: "#FFEBCD", BLUE: "#0000FF", BLUEVIOLET: "#8A2BE2", BROWN: "#A52A2A", BURLYWOOD: "#DEB887", CADETBLUE: "#5F9EA0", CHARTREUSE: "#7FFF00", CHOCOLATE: "#D2691E", CORAL: "#FF7F50", CORNFLOWERBLUE: "#6495ED", CORNSILK: "#FFF8DC", CRIMSON: "#DC143C", CYAN: "#00FFFF", DARKBLUE: "#00008B", DARKCYAN: "#008B8B", DARKGOLDENROD: "#B8860B", DARKGREY: "#A9A9A9", DARKGREEN: "#006400", DARKKHAKI: "#BDB76B", DARKMAGENTA: "#8B008B", DARKOLIVEGREEN: "#556B2F", DARKORANGE: "#FF8C00", DARKORCHID: "#9932CC", DARKRED: "#8B0000", DARKSALMON: "#E9967A", DARKSEAGREEN: "#8FBC8F", DARKSLATEBLUE: "#483D8B", DARKSLATEGREY: "#2F4F4F", DARKTURQUOISE: "#00CED1", DARKVIOLET: "#9400D3", DEEPPINK: "#FF1493", DEEPSKYBLUE: "#00BFFF", DIMGRAY: "#696969", DODGERBLUE: "#1E90FF", FIREBRICK: "#B22222", FLORALWHITE: "#FFFAF0", FORESTGREEN: "#228B22", FUCHSIA: "#FF00FF", GAINSBORO: "#DCDCDC", GHOSTWHITE: "#F8F8FF", GOLD: "#FFD700", GOLDENROD: "#DAA520", GREY: "#808080", GREEN: "#008000", GREENYELLOW: "#ADFF2F", HONEYDEW: "#F0FFF0", HOTPINK: "#FF69B4", INDIANRED: "#CD5C5C", INDIGO: "#4B0082", IVORY: "#FFFFF0", KHAKI: "#F0E68C", LAVENDER: "#E6E6FA", LAVENDERBLUSH: "#FFF0F5", LAWNGREEN: "#7CFC00", LEMONCHIFFON: "#FFFACD", LIGHTBLUE: "#ADD8E6", LIGHTCORAL: "#F08080", LIGHTCYAN: "#E0FFFF", LIGHTGOLDENRODYELLOW: "#FAFAD2", LIGHTGREY: "#D3D3D3", LIGHTGREEN: "#90EE90", LIGHTPINK: "#FFB6C1", LIGHTSALMON: "#FFA07A", LIGHTSEAGREEN: "#20B2AA", LIGHTSKYBLUE: "#87CEFA", LIGHTSLATEGREY: "#778899", LIGHTSTEELBLUE: "#B0C4DE", LIGHTYELLOW: "#FFFFE0", LIME: "#00FF00", LIMEGREEN: "#32CD32", LINEN: "#FAF0E6", MAGENTA: "#FF00FF", MAROON: "#800000", MEDIUMAQUAMARINE: "#66CDAA", MEDIUMBLUE: "#0000CD", MEDIUMORCHID: "#BA55D3", MEDIUMPURPLE: "#9370D8", MEDIUMSEAGREEN: "#3CB371", MEDIUMSLATEBLUE: "#7B68EE", MEDIUMSPRINGGREEN: "#00FA9A", MEDIUMTURQUOISE: "#48D1CC", MEDIUMVIOLETRED: "#C71585", MIDNIGHTBLUE: "#191970", MINTCREAM: "#F5FFFA", MISTYROSE: "#FFE4E1", MOCCASIN: "#FFE4B5", NAVAJOWHITE: "#FFDEAD", NAVY: "#000080", OLDLACE: "#FDF5E6", OLIVE: "#808000", OLIVEDRAB: "#6B8E23", ORANGE: "#FFA500", ORANGERED: "#FF4500", ORCHID: "#DA70D6", PALEGOLDENROD: "#EEE8AA", PALEGREEN: "#98FB98", PALETURQUOISE: "#AFEEEE", PALEVIOLETRED: "#D87093", PAPAYAWHIP: "#FFEFD5", PEACHPUFF: "#FFDAB9", PERU: "#CD853F", PINK: "#FFC0CB", PLUM: "#DDA0DD", POWDERBLUE: "#B0E0E6", PURPLE: "#800080", RED: "#FF0000", ROSYBROWN: "#BC8F8F", ROYALBLUE: "#4169E1", SADDLEBROWN: "#8B4513", SALMON: "#FA8072", SANDYBROWN: "#F4A460", SEAGREEN: "#2E8B57", SEASHELL: "#FFF5EE", SIENNA: "#A0522D", SILVER: "#C0C0C0", SKYBLUE: "#87CEEB", SLATEBLUE: "#6A5ACD", SLATEGREY: "#708090", SNOW: "#FFFAFA", SPRINGGREEN: "#00FF7F", STEELBLUE: "#4682B4", TAN: "#D2B48C", TEAL: "#008080", THISTLE: "#D8BFD8", TOMATO: "#FF6347", TURQUOISE: "#40E0D0", VIOLET: "#EE82EE", WHEAT: "#F5DEB3", WHITE: "#FFFFFF", WHITESMOKE: "#F5F5F5", YELLOW: "#FFFF00", YELLOWGREEN: "#9ACD32", REBECCAPURPLE: "#663399" }; function It(t) { const n = nt?.(t) ? tt(t) : t; if (typeof n != "string") return n; const e = n.trim(); if (e === "" || e[0] === "#") return e; if (e.toLowerCase() === "transparent") return "#FFFFFF00"; const o = e.toUpperCase(), r = o.replace(/GRAY/g, "GREY"); return at[o] || at[r] || e; } const J = "http://www.w3.org/2000/svg"; function mn(t) { if (t.length < 2) return 0; let n = 0, e = 0; for (let r = 1; r < t.length; r++) { const s = t[r - 1], c = t[r]; if ([null, void 0, 0, 1 / 0, -1 / 0].includes(s)) continue; const i = (c - s) / Math.abs(s) * 100; n += i, e++; } return e === 0 ? 0 : n / e; } function Lt({ content: t, fontSize: n, fill: e, x: o, y: r, translateY: s = !1 }) { const c = t.split(` `), l = c.length * n, u = s ? (l - n) / 2 : 0; return c.map( (a, f) => `<tspan x="${o}" y="${r - u + f * n}" fill="${e}">${a}</tspan>` ).join(""); } function bn(t) { return et(t) ? (Lt({ content: t, fontSize: 1, fill: "", x: 0, y: 0 }).match(/<tspan\b/g) || []).length : 1; } function Cn({ content: t, fontSize: n, fill: e, x: o, autoOffset: r = !1 }) { const s = t.split(` `), c = r ? (s.length - 1) * n / 2 : 0; return s.map((i, l) => { const u = l === 0 ? -c : n; return `<tspan x="${o}" dy="${u}" fill="${e}">${i}</tspan>`; }).join(""); } function Mn({ content: t, fontSize: n, fill: e, maxWords: o, x: r, y: s }) { function c(u, a) { const f = u.split(" "), h = []; for (let F = 0; F < f.length; F += a) h.push(f.slice(F, F + a).join(" ")); return h; } let i = ""; return c(t, o).forEach((u, a) => { const f = `<tspan x="${r}" y="${s + a * n}" fill="${e}">${u}</tspan>`; i += f; }), i; } function $n(t) { return t.length ? t.map((n) => ut(n)) : []; } function Dn(t, n = null) { const e = t.replace(/[\p{P}\p{S}]+/gu, " ").trim(), c = (/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Tibetan}\p{Script=Myanmar}\p{Script=Devanagari}]/u.test(t) ? [...e] : e.split(/\s+/)).filter((i) => i.trim().length > 0).reduce((i, l) => (i[l] ? i[l] += 1 : i[l] = 1, i), {}); return Object.keys(c).map((i) => { let l = i; return typeof n == "function" && typeof n(i) == "string" && (l = n(i)), { name: l, value: c[i] }; }); } function Sn(t) { let n = t.reduce((i, l) => i + (l.stackRatio || 0), 0), e = t.filter((i) => i.stackRatio === void 0).length, o = 1 - n, r = e > 0 ? o / e : 0, s = t.map((i) => ({ ...i, stackRatio: i.stackRatio !== void 0 ? i.stackRatio : r })), c = 0; return s = s.map((i, l) => (c += i.stackRatio, { ...i, stackIndex: l, cumulatedStackRatio: c })), s; } function Rn(t) { function n(u, a, f, h) { const F = f - u, g = h - a; return Math.sqrt(F * F + g * g); } function e(u, a, f, h) { let g = 0, p = u.x, y = u.y; for (let x = 1; x <= 100; x += 1) { const E = x / 100, M = 1 - E, R = M * M, O = E * E, L = R * M * u.x + 3 * R * E * a.x + 3 * M * O * f.x + O * E * h.x, m = R * M * u.y + 3 * R * E * a.y + 3 * M * O * f.y + O * E * h.y; g += n(p, y, L, m), p = L, y = m; } return g; } const o = t.match(/[a-zA-Z][^a-zA-Z]*/g); let r = 0, s = 0, c = 0, i = 0, l = 0; return o.forEach((u) => { const a = u[0], f = u.slice(1).trim().split(/[\s,]+/).map(Number); let h = 0; switch (a) { case "M": for (r = f[h++], s = f[h++], c = r, i = s; h < f.length; ) l += n(r, s, f[h], f[h + 1]), r = f[h++], s = f[h++]; break; case "L": for (; h < f.length; ) l += n(r, s, f[h], f[h + 1]), r = f[h++], s = f[h++]; break; case "H": for (; h < f.length; ) l += n(r, s, f[h], s), r = f[h++]; break; case "V": for (; h < f.length; ) l += n(r, s, r, f[h]), s = f[h++]; break; case "C": for (; h < f.length; ) l += e( { x: r, y: s }, { x: f[h], y: f[h + 1] }, { x: f[h + 2], y: f[h + 3] }, { x: f[h + 4], y: f[h + 5] } ), r = f[h + 4], s = f[h + 5], h += 6; break; case "Z": l += n(r, s, c, i), r = c, s = i; break; } }), l; } function Bn({ relator: t, adjuster: n, source: e, threshold: o = 0, fallback: r, max: s = 24 }) { const c = t / (n / e); return c > s ? s : c < o ? r : c; } function In(t) { return t.reduce((n, e) => (e.series.forEach((o, r) => { ![void 0, null, 1 / 0, -1 / 0].includes(o) && !isNaN(o) && (n[r] = (n[r] || 0) + o); }), n), []); } function Nt(t, { value: n, config: e }) { let o = !1, r = n; if (typeof t == "function") try { r = t({ value: n, config: e }), ["number", "string"].includes(typeof r) ? o = !0 : r = n; } catch (s) { console.warn("Formatter could not be applied:", s), o = !1; } return { isValid: o, value: r }; } function Ln(t, n, e, o) { const { isValid: r, value: s } = Nt(t, { value: n, config: o }); return r ? s : e; } function Nn(t, n) { return n.split(".").every((e) => t !== null && typeof t == "object" && e in t ? (t = t[e], !0) : !1); } function On(t, n = [], e = !1) { function o(s) { return e && s === null ? null : typeof s == "string" && isNaN(Number(s)) || typeof s == "number" && isFinite(s) ? s : 0; } function r(s) { if (Array.isArray(s)) return s.map((c) => r(c)); if (typeof s == "object" && s !== null) { let c = { ...s }; return n.forEach((i) => { c.hasOwnProperty(i) && ![ "NAME", "name", "TITLE", "title", "DESCRIPTION", "description", "LABEL", "label", "TIME", "time", "PERIOD", "period", "MONTH", "month", "YEAR", "year", "MONTHS", "months", "YEARS", "years", "DAY", "day", "DAYS", "days", "HOUR", "hour", "HOURS", "hours" ].includes(i) && Array.isArray(c[i]) && (c[i] = r(c[i])); }), Object.fromEntries( Object.entries(c).map(([i, l]) => [i, r(l)]) ); } else return o(s); } return r(t); } function wn(t, n = 100) { return t.length === 9 ? t.substring(0, 7) + it[n] : t + it[n]; } function Tn({ series: t, center: n, maxRadius: e, hasGhost: o = !1 }) { const s = 360 / (t.length - (o ? 1 : 0)); return t.map((i, l) => { const a = i * e, f = l * s, h = f + s, F = f + s / 2, g = X(f) - X(90), p = X(h) - X(90), y = X(F) - X(90), x = n.x + a * Math.cos(g), E = n.y + a * Math.sin(g), M = n.x + a * Math.cos(p), R = n.y + a * Math.sin(p), O = n.x + a * Math.cos(y), L = n.y + a * Math.sin(y); return { path: ` M ${n.x} ${n.y} L ${x} ${E} A ${a} ${a} 0 0 1 ${M} ${R} Z `.trim(), middlePoint: { x: O, y: L }, radius: a }; }); } function Pn({ data: t, threshold: n }) { if (n >= t.length || n < 3) return t; const e = [], o = (t.length - 2) / (n - 2); let r = 0; e.push(t[r]); for (let s = 0; s < n - 2; s += 1) { const c = Math.floor((s + 1) * o) + 1, i = Math.min(Math.floor((s + 2) * o) + 1, t.length), l = t.slice(c, i); let u = 0, a = 0; for (const F of l) u += F.x, a += F.y; u /= l.length, a /= l.length; let f = -1, h = r; for (let F = c; F < i; F += 1) { const g = Math.abs( (t[r].x - u) * (t[F].y - t[r].y) - (t[r].x - t[F].x) * (a - t[r].y) ); g > f && (f = g, h = F); } e.push(t[h]), r = h; } return e.push(t[t.length - 1]), e; } function kn({ data: t, threshold: n }) { if (n >= t.length || n < 3) return t; const e = [], o = (t.length - 2) / (n - 2); let r = 0; e.push(t[r]); for (let s = 0; s < n - 2; s += 1) { const c = Math.floor((s + 1) * o) + 1, i = Math.min(Math.floor((s + 2) * o) + 1, t.length), l = t.slice(c, i), u = l.reduce((h, F) => h + F, 0) / l.length; let a = -1, f = r; for (let h = c; h < i; h += 1) { const F = Math.abs((t[r] - u) * (h - r)); F > a && (a = F, f = h); } e.push(t[f]), r = f; } return e.push(t[t.length - 1]), e; } function Yn({ data: t, threshold: n, key: e = "value" }) { if (n >= t.length || n < 3) return t; const o = [], r = (t.length - 2) / (n - 2); let s = 0; o.push(t[s]); for (let c = 0; c < n - 2; c += 1) { const i = Math.floor((c + 1) * r) + 1, l = Math.min(Math.floor((c + 2) * r) + 1, t.length), u = t.slice(i, l), a = u.reduce((F, g) => F + g[e], 0) / u.length; let f = -1, h = s; for (let F = i; F < l; F += 1) { const g = Math.abs((t[s][e] - a) * (F - s)); g > f && (f = g, h = F); } o.push(t[h]), s = h; } return o.push(t[t.length - 1]), o; } function Hn({ radius: t, centerX: n, centerY: e, percentage: o }) { o = Math.max(0, Math.min(1, o)); const r = o * Math.PI, s = n - t, c = e, i = n - t * Math.cos(r), l = e - t * Math.sin(r); return `M ${n},${e} L ${s},${c} A ${t},${t} 0 0 1 ${i},${l} Z`.trim(); } function Un({ svgElement: t, x: n, y: e, offsetY: o = 0, element: r }) { if (!t || !r) return { top: 0, left: 0 }; const s = t.createSVGPoint(); s.x = n, s.y = e; const c = s.matrixTransform(t.getScreenCTM()), i = t.getBoundingClientRect(), l = r.getBoundingClientRect(); let u = 0, a = 0; return c.x - l.width / 2 < i.left ? u = 0 : c.x + l.width > i.right ? u = -l.width : u = -l.width / 2, c.y - o - l.height < i.top ? a = o : a = -l.height - o, { top: c.y + a, left: c.x + u }; } function Gn({ svgElement: t, x: n, y: e, element: o, position: r }) { if (!t || !o) return { top: 0, left: 0 }; const s = t.createSVGPoint(); s.x = n, s.y = e; const c = s.matrixTransform(t.getScreenCTM()), { height: i, width: l } = o.getBoundingClientRect(); let u = r === "right" ? 0 : -l, a = -(i / 2); return { top: c.y + a, left: c.x + u }; } function _(t) { if (t === null || typeof t != "object") return t; if (t instanceof Date) return new Date(t.getTime()); if (t instanceof RegExp) return new RegExp(t.source, t.flags); if (t instanceof Map) { const e = /* @__PURE__ */ new Map(); for (const [o, r] of t.entries()) e.set(o, _(r)); return e; } if (t instanceof Set) { const e = /* @__PURE__ */ new Set(); for (const o of t.values()) e.add(_(o)); return e; } if (Array.isArray(t)) return t.map((e) => _(e)); const n = {}; for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && (n[e] = _(t[e])); return n; } function Ot(t) { const n = []; let e = []; for (const o of t) !o || o.value == null || Number.isNaN(o.x) || Number.isNaN(o.y) ? (e.length && n.push(e), e = []) : e.push(o); return e.length && n.push(e), n; } function vn(t, n) { const e = t.filter((c) => !!c); if (!e[0]) return [-10, -10, "", -10, -10].toString(); const o = { x: e[0].x, y: n }, r = { x: e.at(-1).x, y: n }, s = []; return e.forEach((c) => { s.push(`${c.x},${c.y} `); }), [o.x, o.y, ...s, r.x, r.y].toString(); } function Xn(t, n) { if (!t[0]) return [-10, -10, "", -10, -10].toString(); const e = Ot(t); return e.length ? e.map((o) => { const r = { x: o[0].x, y: n }, s = { x: o.at(-1).x, y: n }, c = []; return o.forEach((i) => { c.push(`${i.x},${i.y} `); }), [r.x, r.y, ...c, s.x, s.y].toString(); }).join(";") : ""; } function wt(t) { const n = []; let e = []; for (const o of t) o.value == null || Number.isNaN(o.x) || Number.isNaN(o.y) ? (e.length > 1 && n.push(e), e = []) : e.push(o); return e.length > 1 && n.push(e), n; } function jn(t) { let n = "", e = !1; const o = (r) => r.value != null && Number.isFinite(r.x) && Number.isFinite(r.y); for (let r = 0; r < t.length; r++) { const s = t[r]; if (!o(s)) continue; const c = `${A(s.x)},${A(s.y)}`; if (!e) n += c, e = !0; else { const i = t[r - 1], l = o(i) ? "L" : "M"; n += `${l}${c}`; } n += " "; } return n.trim(); } function Kn(t) { const n = wt(t); if (!n.length) return ""; let e = ""; for (const [o, r] of n.entries()) { if (r.length < 2) continue; const s = r.length - 1, c = [], i = [], l = [], u = []; for (let a = 0; a < s; a += 1) c[a] = r[a + 1].x - r[a].x, i[a] = r[a + 1].y - r[a].y, l[a] = i[a] / c[a]; u[0] = l[0], u[s] = l[s - 1]; for (let a = 1; a < s; a += 1) if (l[a - 1] * l[a] <= 0) u[a] = 0; else { const f = 2 * l[a - 1] * l[a] / (l[a - 1] + l[a]); u[a] = f; } e += `${o === 0 ? "" : "M"}${A(r[0].x)},${A(r[0].y)} `; for (let a = 0; a < s; a += 1) { const f = r[a].x, h = r[a].y, F = r[a + 1].x, g = r[a + 1].y, p = u[a], y = u[a + 1], x = f + (F - f) / 3, E = h + p * (F - f) / 3, M = F - (F - f) / 3, R = g - y * (F - f) / 3; e += `C${A(x)},${A(E)} ${A(M)},${A(R)} ${A(F)},${A(g)} `; } } return e.trim(); } function Wn(t, n, e = !1, o = !0) { function r(c) { const i = []; let l = []; for (const u of c) !u || u.value == null || Number.isNaN(u.x) || Number.isNaN(u.y) ? (l.length > 1 && i.push(l), l = []) : l.push(u); return l.length > 1 && i.push(l), i; } return (e ? r(t) : [t]).map((c) => { if (c.length < 2) return ""; const i = c.length - 1, l = [], u = [], a = [], f = []; for (let F = 0; F < i; F += 1) l[F] = c[F + 1].x - c[F].x, u[F] = c[F + 1].y - c[F].y, a[F] = u[F] / l[F]; f[0] = a[0], f[i] = a[i - 1]; for (let F = 1; F < i; F += 1) if (a[F - 1] * a[F] <= 0) f[F] = 0; else { const g = 2 * a[F - 1] * a[F] / (a[F - 1] + a[F]); f[F] = g; } let h = `M${c[0].x},${n}`; h += ` L${c[0].x},${c[0].y}`; for (let F = 0; F < i; F += 1) { const g = c[F].x, p = c[F].y, y = c[F + 1].x, x = c[F + 1].y, E = f[F], M = f[F + 1], R = g + (y - g) / 3, O = p + E * (y - g) / 3, L = y - (y - g) / 3, m = x - M * (y - g) / 3; h += ` C${R},${O} ${L},${m} ${y},${x}`; } return h += ` L${c[i].x},${n} ${o ? "Z" : ""}`, h; }).filter(Boolean); } function Vn(t) { return t.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, ""); } function Tt(t) { return t && typeof t == "object" && !Array.isArray(t) && Object.keys(t).length === 0 ? null : t; } function lt(t) { if (Array.isArray(t)) return t.map(lt); if (t && typeof t == "object" && !Array.isArray(t)) { const n = {}; for (const e in t) Object.hasOwn(t, e) && (n[e] = lt(t[e])); return Tt(n); } return t; } function _n(t) { return 1 - Math.pow(1 - t, 3); } function zn({ values: t, config: n = {} }) { const { keepInvalid: e = !0, convertInvalidToZero: o = !1 } = n, r = []; let s = 0, c = 0; function i(u) { return typeof u != "number" || !Number.isFinite(u); } function l(u) { s += u, c += 1, r.push(s / c); } for (const u of t) i(u) ? o && e ? l(0) : !o && e && r.push(u) : l(u); return r; } function Zn({ values: t, config: n = {} }) { const { keepInvalid: e = !0, convertInvalidToZero: o = !1 } = n, r = [], s = []; function c(l) { return typeof l != "number" || !Number.isFinite(l); } function i(l) { s.push(l), s.sort((f, h) => f - h); const u = s.length, a = u >> 1; u % 2 === 1 ? r.push(s[a]) : r.push((s[a - 1] + s[a]) / 2); } for (const l of t) c(l) ? o && e ? i(0) : !o && e && r.push(l) : i(l); return r; } function Qn({ el: t, bounds: n, currentFontSize: e, minFontSize: o = 6, attempts: r = 200, padding: s = 1 }) { if (!t || !e) return 0; let c = e; t.setAttribute("font-size", c); const { x: i, y: l, width: u, height: a } = n, f = i + s, h = l + s, F = i + u - s, g = l + a - s; let p = t.getBBox(); if (p.x >= f + s && p.y >= h + s && p.x + p.width <= F - s && p.y + p.height <= g - s) return c; let y = r; for (; y-- > 0 && c > o && (c--, t.setAttribute("font-size", c), p = t.getBBox(), !(p.x >= f + s && p.y >= h + s && p.x + p.width <= F - s && p.y + p.height <= g - s)); ) ; return c < o && (c = 0, t.setAttribute("font-size", c)), c; } function qn({ value: t, maxDecimals: n = 4, fallbackFormatter: e, removeTrailingZero: o = !0 }) { if (t === 0) return "0"; const r = Math.abs(t); if (r >= 1 && typeof e == "function") { const i = e(t); return String(i); } let s; if (r < 1) { const i = Math.floor(Math.log10(r)); s = Math.min(Math.max(1 - i, 1), n); } else s = n; let c = t.toFixed(s); return o && (c = c.replace(/(\.\d*?[1-9])0+$/, "$1").replace(/\.0+$/, "")), c; } function Jn(t) { const n = []; for (let e = 0; e < t; e += 1) n.push(e === 0 ? 0 : e === 1 ? 1 : n[e - 1] + n[e - 2]); return n; } function te(t, n = 20) { t = t.replace(/[\r\n]+/g, " "); const e = t.split(" "); let o = "", r = ""; for (let s of e) (o + (o ? " " : "") + s).length <= n ? o += (o ? " " : "") + s : (o && (r += (r ? ` ` : "") + o), o = s); return o && (r += (r ? ` ` : "") + o), r; } function ne(t) { const { lineA: n, lineB: e, colorLineA: o, // fill when A is above colorLineB: r, // fill when B is above smoothA: s = !1, smoothB: c = !1, sampleStepPx: i = 2, cutNullValues: l = !0, // break across gaps merge: u = !0 // merge into large polygons } = t || {}; if (!Array.isArray(n) || !Array.isArray(e) || !n.length || !e.length) return []; const a = (m) => Number.isFinite(m); function f(m) { if (!l) return [m.filter((D) => D && a(D.x) && a(D.y))]; const $ = []; let C = []; for (const D of m) D && a(D.x) && a(D.y) && D.value != null ? C.push({ x: D.x, y: D.y }) : (C.length > 1 && $.push(C), C = []); return C.length > 1 && $.push(C), $; } function h(m) { const $ = m.length - 1, C = new Array($), D = new Array($), d = new Array($), I = new Array(m.length); for (let b = 0; b < $; b += 1) C[b] = m[b + 1].x - m[b].x, D[b] = m[b + 1].y - m[b].y, d[b] = D[b] / C[b]; I[0] = d[0], I[$] = d[$ - 1]; for (let b = 1; b < $; b += 1) d[b - 1] * d[b] <= 0 ? I[b] = 0 : I[b] = 2 * d[b - 1] * d[b] / (d[b - 1] + d[b]); return I; } function F(m, $, C, D, d) { const I = m.x, b = $.x, w = m.y, S = $.y, T = b - I; if (T === 0) return w; const P = (d - I) / T, N = P * P, Y = N * P, H = 2 * Y - 3 * N + 1, B = Y - 2 * N + P, k = -2 * Y + 3 * N, U = Y - N; return H * w + B * (C * T) + k * S + U * (D * T); } function g(m, $) { const C = f(m); if (!C.length) return []; let D = 1 / 0, d = -1 / 0; for (const S of C) D = Math.min(D, S[0].x), d = Math.max(d, S[S.length - 1].x); if (!a(D) || !a(d) || d <= D) return []; const I = Math.max(1, i), b = []; for (let S = D; S <= d; S += I) b.push(S); b[b.length - 1] < d && b.push(d); const w = []; for (const S of b) { let T = null, P = !1; for (const N of C) { const Y = N.length - 1; if (!(S < N[0].x - 1e-9 || S > N[Y].x + 1e-9)) { for (let H = 0; H < Y; H += 1) { const B = N[H], k = N[H