@mintplayer/web-components 2.12.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,179 +0,0 @@
1
- function E(t) {
2
- const s = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = (o, l) => {
3
- s.set(o.id, o), e.set(o.id, l);
4
- const d = o.children?.length ? o.children.map((a) => i(a, o)).reduce((a, u) => a + u, 0) : o.value ?? 0;
5
- n.set(o.id, d);
6
- const c = (o.children ?? []).filter((a) => r.get(a.id) !== void 0), h = c.map((a) => n.get(a.id) ?? 0).reduce((a, u) => a + u, 0);
7
- return r.set(
8
- o.id,
9
- o.colorValue !== void 0 ? o.colorValue : h > 0 ? c.map((a) => (r.get(a.id) ?? 0) * (n.get(a.id) ?? 0)).reduce((a, u) => a + u, 0) / h : void 0
10
- ), d;
11
- };
12
- return i(t, null), { root: t, byId: s, parents: e, values: n, colorValues: r };
13
- }
14
- function Z(t, s) {
15
- const e = (n) => n ? [...e(t.parents.get(n.id)), n] : [];
16
- return e(s);
17
- }
18
- function S(t, s) {
19
- return Z(t, s).length;
20
- }
21
- const T = (t) => !!(t.children?.length || t.hasChildren);
22
- function V(t, s) {
23
- return [...s.children ?? []].sort(
24
- (e, n) => (t.values.get(n.id) ?? 0) - (t.values.get(e.id) ?? 0)
25
- );
26
- }
27
- function q(t, s) {
28
- return s !== void 0 && t.byId.get(s) || t.root;
29
- }
30
- function F(t, s) {
31
- const e = (n) => n.children?.length ? 1 + Math.max(...n.children.map(e)) : 0;
32
- return e(q(t, s));
33
- }
34
- function U(t, s, e = {}) {
35
- const { maxDepth: n = 2, minFraction: r = 0 } = e, i = q(t, s), o = [], l = (d, c, h, a, u) => {
36
- if (a > n) return;
37
- const $ = V(t, d);
38
- if (!$.length) return;
39
- const p = $.map((m) => t.values.get(m.id) ?? 0).reduce((m, g) => m + g, 0);
40
- $.reduce((m, g, x) => {
41
- const w = p > 0 ? (t.values.get(g.id) ?? 0) / p : 1 / $.length, M = m + (h - c) * w;
42
- return M - m >= r && M > m && (o.push({
43
- node: g,
44
- x0: m,
45
- x1: M,
46
- depth: a,
47
- level: u + 1,
48
- setsize: $.length,
49
- posinset: x + 1,
50
- hasChildren: T(g)
51
- }), l(g, m, M, a + 1, u + 1)), M;
52
- }, c);
53
- };
54
- return l(i, 0, 1, 1, S(t, i)), o;
55
- }
56
- function N(t, s) {
57
- const e = t.reduce((l, d) => l + d, 0);
58
- if (e === 0 || s === 0) return 1 / 0;
59
- const n = Math.max(...t), r = Math.min(...t), i = e * e, o = s * s;
60
- return Math.max(o * n / i, i / (o * r));
61
- }
62
- function D(t, s) {
63
- const e = /* @__PURE__ */ new Map();
64
- let n = { ...s }, r = t.filter((l) => l.area > 0);
65
- const i = (l) => {
66
- const d = l.reduce((a, u) => a + u.area, 0), c = n.x1 - n.x0, h = n.y1 - n.y0;
67
- if (!(d <= 0 || c <= 0 || h <= 0))
68
- if (c >= h) {
69
- const a = d / h;
70
- l.reduce((u, $) => {
71
- const p = $.area / a;
72
- return e.set($.id, { x0: n.x0, y0: u, x1: n.x0 + a, y1: u + p }), u + p;
73
- }, n.y0), n = { ...n, x0: n.x0 + a };
74
- } else {
75
- const a = d / c;
76
- l.reduce((u, $) => {
77
- const p = $.area / a;
78
- return e.set($.id, { x0: u, y0: n.y0, x1: u + p, y1: n.y0 + a }), u + p;
79
- }, n.x0), n = { ...n, y0: n.y0 + a };
80
- }
81
- };
82
- let o = [];
83
- for (; r.length; ) {
84
- const l = Math.min(n.x1 - n.x0, n.y1 - n.y0), d = [...o, r[0]];
85
- !o.length || N(d.map((c) => c.area), l) <= N(o.map((c) => c.area), l) ? (o = d, r = r.slice(1)) : (i(o), o = []);
86
- }
87
- return i(o), e;
88
- }
89
- function W(t, s, e = {}) {
90
- const { maxDepth: n = 2, minArea: r = 0, childPadding: i = 0, childHeaderSpace: o = 0 } = e, l = q(t, s), d = [], c = (a) => {
91
- const u = {
92
- x0: a.x0 + i,
93
- y0: a.y0 + i + o,
94
- x1: a.x1 - i,
95
- y1: a.y1 - i
96
- };
97
- return u.x1 - u.x0 > 0 && u.y1 - u.y0 > 0 ? u : null;
98
- }, h = (a, u, $, p) => {
99
- if ($ > n) return;
100
- const m = $ === 1 ? u : c(u);
101
- if (!m) return;
102
- const g = V(t, a);
103
- if (!g.length) return;
104
- const x = (m.x1 - m.x0) * (m.y1 - m.y0), w = g.map((f) => t.values.get(f.id) ?? 0).reduce((f, P) => f + P, 0), M = g.map((f) => ({
105
- id: f.id,
106
- area: w > 0 ? (t.values.get(f.id) ?? 0) / w * x : x / g.length
107
- })), A = D(M, m);
108
- g.map((f, P) => ({ kid: f, i: P, r: A.get(f.id) })).filter((f) => !!f.r && (f.r.x1 - f.r.x0) * (f.r.y1 - f.r.y0) >= r).map((f) => (d.push({
109
- node: f.kid,
110
- ...f.r,
111
- depth: $,
112
- level: p + 1,
113
- setsize: g.length,
114
- posinset: f.i + 1,
115
- hasChildren: T(f.kid)
116
- }), h(f.kid, f.r, $ + 1, p + 1), f));
117
- };
118
- return h(l, { x0: 0, y0: 0, x1: 1, y1: 1 }, 1, S(t, l)), d;
119
- }
120
- const k = 2 * Math.PI, v = 1e-6, y = (t, s, e) => I(t + s * Math.sin(e)), b = (t, s, e) => I(t - s * Math.cos(e)), I = (t) => Math.round(t * 1e3) / 1e3;
121
- function z(t, s, e, n) {
122
- const r = `M ${y(t, n, 0)} ${b(s, n, 0)} A ${n} ${n} 0 1 1 ${y(t, n, Math.PI)} ${b(s, n, Math.PI)} A ${n} ${n} 0 1 1 ${y(t, n, 0)} ${b(s, n, 0)} Z`;
123
- if (e <= v) return r;
124
- const i = `M ${y(t, e, 0)} ${b(s, e, 0)} A ${e} ${e} 0 1 0 ${y(t, e, Math.PI)} ${b(s, e, Math.PI)} A ${e} ${e} 0 1 0 ${y(t, e, 0)} ${b(s, e, 0)} Z`;
125
- return `${r} ${i}`;
126
- }
127
- function j(t, s, e, n, r, i, o = {}) {
128
- const { padAngle: l = 0, ringGap: d = 1 } = o, c = Math.max(0, e), h = Math.max(c, n - d);
129
- if (h - c <= v || i - r <= v) return "";
130
- if (i - r >= k - v) return z(t, s, c, h);
131
- const a = Math.min((i - r) / 2, l) / 2, u = a > 0 ? o.padRadius ?? Math.sqrt(c * c + h * h) : 0, $ = (L) => L > v ? Math.asin(Math.min(1, u * Math.sin(a) / L)) : 0, p = (r + i) / 2, m = (L, H) => H > L ? [L, H] : [p, p + v], [g, x] = m(r + $(h), i - $(h)), w = x - g > Math.PI ? 1 : 0, M = `M ${y(t, h, g)} ${b(s, h, g)} A ${h} ${h} 0 ${w} 1 ${y(t, h, x)} ${b(s, h, x)}`;
132
- if (c <= v) return `${M} L ${I(t)} ${I(s)} Z`;
133
- const [A, f] = m(r + $(c), i - $(c)), P = f - A > Math.PI ? 1 : 0;
134
- return `${M} L ${y(t, c, f)} ${b(s, c, f)} A ${c} ${c} 0 ${P} 0 ${y(t, c, A)} ${b(s, c, A)} Z`;
135
- }
136
- function G(t, s, e) {
137
- const n = (t + s) / 2 * 360 % 360;
138
- return `rotate(${I(n - 90)}) translate(${I(e)},0) rotate(${n < 180 ? 0 : 180})`;
139
- }
140
- function K(t, s, e, n = 0.03) {
141
- return e * (s - t) > n;
142
- }
143
- function O(t) {
144
- const s = t.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i)?.[1];
145
- if (s) {
146
- const n = s.length === 3 ? [...s].map((r) => r + r).join("") : s;
147
- return [0, 2, 4].map((r) => parseInt(n.slice(r, r + 2), 16));
148
- }
149
- const e = t.trim().match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
150
- if (e) return [Number(e[1]), Number(e[2]), Number(e[3])];
151
- throw new Error(`Unsupported color: "${t}" (use #rrggbb or rgb(r, g, b))`);
152
- }
153
- function R([t, s, e]) {
154
- const n = t / 255, r = s / 255, i = e / 255, o = Math.max(n, r, i), l = Math.min(n, r, i), d = (o + l) / 2;
155
- if (o === l) return { h: 0, s: 0, l: d };
156
- const c = o - l, h = d > 0.5 ? c / (2 - o - l) : c / (o + l);
157
- return { h: (o === n ? (r - i) / c + (r < i ? 6 : 0) : o === r ? (i - n) / c + 2 : (n - r) / c + 4) * 60, s: h, l: d };
158
- }
159
- function B(t, s, e, n) {
160
- const r = R(O(e)), i = R(O(n)), o = s - t;
161
- return (l) => {
162
- const d = o === 0 ? 0 : Math.min(1, Math.max(0, (l - t) / o)), c = r.h + (i.h - r.h) * d, h = r.s + (i.s - r.s) * d, a = r.l + (i.l - r.l) * d;
163
- return `hsl(${C(c)}, ${C(h * 100)}%, ${C(a * 100)}%)`;
164
- };
165
- }
166
- const C = (t) => Math.round(t * 10) / 10;
167
- export {
168
- G as a,
169
- K as b,
170
- j as c,
171
- E as d,
172
- B as e,
173
- Z as f,
174
- F as g,
175
- S as l,
176
- U as p,
177
- q as r,
178
- W as s
179
- };