@contentstudio/ui 0.2.15 → 0.2.16-rc.12
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.
- package/dist/index.d.ts +6776 -0
- package/dist/index.js +40860 -0
- package/dist/index.umd.cjs +8112 -0
- package/dist/style.css +1 -0
- package/dist/tailwind-151a5d8c.js +2261 -0
- package/dist/tailwind-e7334431.cjs +66 -0
- package/dist/tailwind.d.ts +107 -0
- package/dist/tailwind.js +12 -0
- package/dist/tailwind.umd.cjs +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,2261 @@
|
|
|
1
|
+
const X = (e, t = 0, n = 1) => Ce(Ae(t, e), n), ve = (e) => {
|
|
2
|
+
e._clipped = !1, e._unclipped = e.slice(0);
|
|
3
|
+
for (let t = 0; t <= 3; t++)
|
|
4
|
+
t < 3 ? ((e[t] < 0 || e[t] > 255) && (e._clipped = !0), e[t] = X(e[t], 0, 255)) : t === 3 && (e[t] = X(e[t], 0, 1));
|
|
5
|
+
return e;
|
|
6
|
+
}, Ie = {};
|
|
7
|
+
for (let e of [
|
|
8
|
+
"Boolean",
|
|
9
|
+
"Number",
|
|
10
|
+
"String",
|
|
11
|
+
"Function",
|
|
12
|
+
"Array",
|
|
13
|
+
"Date",
|
|
14
|
+
"RegExp",
|
|
15
|
+
"Undefined",
|
|
16
|
+
"Null"
|
|
17
|
+
])
|
|
18
|
+
Ie[`[object ${e}]`] = e.toLowerCase();
|
|
19
|
+
function x(e) {
|
|
20
|
+
return Ie[Object.prototype.toString.call(e)] || "object";
|
|
21
|
+
}
|
|
22
|
+
const N = (e, t = null) => e.length >= 3 ? Array.prototype.slice.call(e) : x(e[0]) == "object" && t ? t.split("").filter((n) => e[0][n] !== void 0).map((n) => e[0][n]) : e[0], oe = (e) => {
|
|
23
|
+
if (e.length < 2)
|
|
24
|
+
return null;
|
|
25
|
+
const t = e.length - 1;
|
|
26
|
+
return x(e[t]) == "string" ? e[t].toLowerCase() : null;
|
|
27
|
+
}, { PI: fe, min: Ce, max: Ae } = Math, S = fe * 2, ue = fe / 3, wt = fe / 180, kt = 180 / fe, m = {
|
|
28
|
+
format: {},
|
|
29
|
+
autodetect: []
|
|
30
|
+
};
|
|
31
|
+
class l {
|
|
32
|
+
constructor(...t) {
|
|
33
|
+
const n = this;
|
|
34
|
+
if (x(t[0]) === "object" && t[0].constructor && t[0].constructor === this.constructor)
|
|
35
|
+
return t[0];
|
|
36
|
+
let r = oe(t), s = !1;
|
|
37
|
+
if (!r) {
|
|
38
|
+
s = !0, m.sorted || (m.autodetect = m.autodetect.sort((c, o) => o.p - c.p), m.sorted = !0);
|
|
39
|
+
for (let c of m.autodetect)
|
|
40
|
+
if (r = c.test(...t), r)
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
if (m.format[r]) {
|
|
44
|
+
const c = m.format[r].apply(
|
|
45
|
+
null,
|
|
46
|
+
s ? t : t.slice(0, -1)
|
|
47
|
+
);
|
|
48
|
+
n._rgb = ve(c);
|
|
49
|
+
} else
|
|
50
|
+
throw new Error("unknown format: " + t);
|
|
51
|
+
n._rgb.length === 3 && n._rgb.push(1);
|
|
52
|
+
}
|
|
53
|
+
toString() {
|
|
54
|
+
return x(this.hex) == "function" ? this.hex() : `[${this._rgb.join(",")}]`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const _t = "2.6.0", _ = (...e) => new _.Color(...e);
|
|
58
|
+
_.Color = l;
|
|
59
|
+
_.version = _t;
|
|
60
|
+
const $t = (...e) => {
|
|
61
|
+
e = N(e, "cmyk");
|
|
62
|
+
const [t, n, r, s] = e, c = e.length > 4 ? e[4] : 1;
|
|
63
|
+
return s === 1 ? [0, 0, 0, c] : [
|
|
64
|
+
t >= 1 ? 0 : 255 * (1 - t) * (1 - s),
|
|
65
|
+
// r
|
|
66
|
+
n >= 1 ? 0 : 255 * (1 - n) * (1 - s),
|
|
67
|
+
// g
|
|
68
|
+
r >= 1 ? 0 : 255 * (1 - r) * (1 - s),
|
|
69
|
+
// b
|
|
70
|
+
c
|
|
71
|
+
];
|
|
72
|
+
}, { max: Te } = Math, xt = (...e) => {
|
|
73
|
+
let [t, n, r] = N(e, "rgb");
|
|
74
|
+
t = t / 255, n = n / 255, r = r / 255;
|
|
75
|
+
const s = 1 - Te(t, Te(n, r)), c = s < 1 ? 1 / (1 - s) : 0, o = (1 - t - s) * c, f = (1 - n - s) * c, a = (1 - r - s) * c;
|
|
76
|
+
return [o, f, a, s];
|
|
77
|
+
};
|
|
78
|
+
l.prototype.cmyk = function() {
|
|
79
|
+
return xt(this._rgb);
|
|
80
|
+
};
|
|
81
|
+
_.cmyk = (...e) => new l(...e, "cmyk");
|
|
82
|
+
m.format.cmyk = $t;
|
|
83
|
+
m.autodetect.push({
|
|
84
|
+
p: 2,
|
|
85
|
+
test: (...e) => {
|
|
86
|
+
if (e = N(e, "cmyk"), x(e) === "array" && e.length === 4)
|
|
87
|
+
return "cmyk";
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const le = (e) => Math.round(e * 100) / 100, Nt = (...e) => {
|
|
91
|
+
const t = N(e, "hsla");
|
|
92
|
+
let n = oe(e) || "lsa";
|
|
93
|
+
return t[0] = le(t[0] || 0), t[1] = le(t[1] * 100) + "%", t[2] = le(t[2] * 100) + "%", n === "hsla" || t.length > 3 && t[3] < 1 ? (t[3] = t.length > 3 ? t[3] : 1, n = "hsla") : t.length = 3, `${n}(${t.join(",")})`;
|
|
94
|
+
}, De = (...e) => {
|
|
95
|
+
e = N(e, "rgba");
|
|
96
|
+
let [t, n, r] = e;
|
|
97
|
+
t /= 255, n /= 255, r /= 255;
|
|
98
|
+
const s = Ce(t, n, r), c = Ae(t, n, r), o = (c + s) / 2;
|
|
99
|
+
let f, a;
|
|
100
|
+
return c === s ? (f = 0, a = Number.NaN) : f = o < 0.5 ? (c - s) / (c + s) : (c - s) / (2 - c - s), t == c ? a = (n - r) / (c - s) : n == c ? a = 2 + (r - t) / (c - s) : r == c && (a = 4 + (t - n) / (c - s)), a *= 60, a < 0 && (a += 360), e.length > 3 && e[3] !== void 0 ? [a, f, o, e[3]] : [a, f, o];
|
|
101
|
+
}, { round: ie } = Math, Et = (...e) => {
|
|
102
|
+
const t = N(e, "rgba");
|
|
103
|
+
let n = oe(e) || "rgb";
|
|
104
|
+
return n.substr(0, 3) == "hsl" ? Nt(De(t), n) : (t[0] = ie(t[0]), t[1] = ie(t[1]), t[2] = ie(t[2]), (n === "rgba" || t.length > 3 && t[3] < 1) && (t[3] = t.length > 3 ? t[3] : 1, n = "rgba"), `${n}(${t.slice(0, n === "rgb" ? 3 : 4).join(",")})`);
|
|
105
|
+
}, { round: de } = Math, Ee = (...e) => {
|
|
106
|
+
e = N(e, "hsl");
|
|
107
|
+
const [t, n, r] = e;
|
|
108
|
+
let s, c, o;
|
|
109
|
+
if (n === 0)
|
|
110
|
+
s = c = o = r * 255;
|
|
111
|
+
else {
|
|
112
|
+
const f = [0, 0, 0], a = [0, 0, 0], i = r < 0.5 ? r * (1 + n) : r + n - r * n, h = 2 * r - i, d = t / 360;
|
|
113
|
+
f[0] = d + 1 / 3, f[1] = d, f[2] = d - 1 / 3;
|
|
114
|
+
for (let b = 0; b < 3; b++)
|
|
115
|
+
f[b] < 0 && (f[b] += 1), f[b] > 1 && (f[b] -= 1), 6 * f[b] < 1 ? a[b] = h + (i - h) * 6 * f[b] : 2 * f[b] < 1 ? a[b] = i : 3 * f[b] < 2 ? a[b] = h + (i - h) * (2 / 3 - f[b]) * 6 : a[b] = h;
|
|
116
|
+
[s, c, o] = [de(a[0] * 255), de(a[1] * 255), de(a[2] * 255)];
|
|
117
|
+
}
|
|
118
|
+
return e.length > 3 ? [s, c, o, e[3]] : [s, c, o, 1];
|
|
119
|
+
}, Ye = /^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/, He = /^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/, Xe = /^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/, Ue = /^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/, Ve = /^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/, Ze = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/, { round: Oe } = Math, Me = (e) => {
|
|
120
|
+
e = e.toLowerCase().trim();
|
|
121
|
+
let t;
|
|
122
|
+
if (m.format.named)
|
|
123
|
+
try {
|
|
124
|
+
return m.format.named(e);
|
|
125
|
+
} catch {
|
|
126
|
+
}
|
|
127
|
+
if (t = e.match(Ye)) {
|
|
128
|
+
const n = t.slice(1, 4);
|
|
129
|
+
for (let r = 0; r < 3; r++)
|
|
130
|
+
n[r] = +n[r];
|
|
131
|
+
return n[3] = 1, n;
|
|
132
|
+
}
|
|
133
|
+
if (t = e.match(He)) {
|
|
134
|
+
const n = t.slice(1, 5);
|
|
135
|
+
for (let r = 0; r < 4; r++)
|
|
136
|
+
n[r] = +n[r];
|
|
137
|
+
return n;
|
|
138
|
+
}
|
|
139
|
+
if (t = e.match(Xe)) {
|
|
140
|
+
const n = t.slice(1, 4);
|
|
141
|
+
for (let r = 0; r < 3; r++)
|
|
142
|
+
n[r] = Oe(n[r] * 2.55);
|
|
143
|
+
return n[3] = 1, n;
|
|
144
|
+
}
|
|
145
|
+
if (t = e.match(Ue)) {
|
|
146
|
+
const n = t.slice(1, 5);
|
|
147
|
+
for (let r = 0; r < 3; r++)
|
|
148
|
+
n[r] = Oe(n[r] * 2.55);
|
|
149
|
+
return n[3] = +n[3], n;
|
|
150
|
+
}
|
|
151
|
+
if (t = e.match(Ve)) {
|
|
152
|
+
const n = t.slice(1, 4);
|
|
153
|
+
n[1] *= 0.01, n[2] *= 0.01;
|
|
154
|
+
const r = Ee(n);
|
|
155
|
+
return r[3] = 1, r;
|
|
156
|
+
}
|
|
157
|
+
if (t = e.match(Ze)) {
|
|
158
|
+
const n = t.slice(1, 4);
|
|
159
|
+
n[1] *= 0.01, n[2] *= 0.01;
|
|
160
|
+
const r = Ee(n);
|
|
161
|
+
return r[3] = +t[4], r;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
Me.test = (e) => Ye.test(e) || He.test(e) || Xe.test(e) || Ue.test(e) || Ve.test(e) || Ze.test(e);
|
|
165
|
+
l.prototype.css = function(e) {
|
|
166
|
+
return Et(this._rgb, e);
|
|
167
|
+
};
|
|
168
|
+
_.css = (...e) => new l(...e, "css");
|
|
169
|
+
m.format.css = Me;
|
|
170
|
+
m.autodetect.push({
|
|
171
|
+
p: 5,
|
|
172
|
+
test: (e, ...t) => {
|
|
173
|
+
if (!t.length && x(e) === "string" && Me.test(e))
|
|
174
|
+
return "css";
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
m.format.gl = (...e) => {
|
|
178
|
+
const t = N(e, "rgba");
|
|
179
|
+
return t[0] *= 255, t[1] *= 255, t[2] *= 255, t;
|
|
180
|
+
};
|
|
181
|
+
_.gl = (...e) => new l(...e, "gl");
|
|
182
|
+
l.prototype.gl = function() {
|
|
183
|
+
const e = this._rgb;
|
|
184
|
+
return [e[0] / 255, e[1] / 255, e[2] / 255, e[3]];
|
|
185
|
+
};
|
|
186
|
+
const { floor: vt } = Math, Ct = (...e) => {
|
|
187
|
+
e = N(e, "hcg");
|
|
188
|
+
let [t, n, r] = e, s, c, o;
|
|
189
|
+
r = r * 255;
|
|
190
|
+
const f = n * 255;
|
|
191
|
+
if (n === 0)
|
|
192
|
+
s = c = o = r;
|
|
193
|
+
else {
|
|
194
|
+
t === 360 && (t = 0), t > 360 && (t -= 360), t < 0 && (t += 360), t /= 60;
|
|
195
|
+
const a = vt(t), i = t - a, h = r * (1 - n), d = h + f * (1 - i), b = h + f * i, y = h + f;
|
|
196
|
+
switch (a) {
|
|
197
|
+
case 0:
|
|
198
|
+
[s, c, o] = [y, b, h];
|
|
199
|
+
break;
|
|
200
|
+
case 1:
|
|
201
|
+
[s, c, o] = [d, y, h];
|
|
202
|
+
break;
|
|
203
|
+
case 2:
|
|
204
|
+
[s, c, o] = [h, y, b];
|
|
205
|
+
break;
|
|
206
|
+
case 3:
|
|
207
|
+
[s, c, o] = [h, d, y];
|
|
208
|
+
break;
|
|
209
|
+
case 4:
|
|
210
|
+
[s, c, o] = [b, h, y];
|
|
211
|
+
break;
|
|
212
|
+
case 5:
|
|
213
|
+
[s, c, o] = [y, h, d];
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return [s, c, o, e.length > 3 ? e[3] : 1];
|
|
218
|
+
}, At = (...e) => {
|
|
219
|
+
const [t, n, r] = N(e, "rgb"), s = Ce(t, n, r), c = Ae(t, n, r), o = c - s, f = o * 100 / 255, a = s / (255 - o) * 100;
|
|
220
|
+
let i;
|
|
221
|
+
return o === 0 ? i = Number.NaN : (t === c && (i = (n - r) / o), n === c && (i = 2 + (r - t) / o), r === c && (i = 4 + (t - n) / o), i *= 60, i < 0 && (i += 360)), [i, f, a];
|
|
222
|
+
};
|
|
223
|
+
l.prototype.hcg = function() {
|
|
224
|
+
return At(this._rgb);
|
|
225
|
+
};
|
|
226
|
+
_.hcg = (...e) => new l(...e, "hcg");
|
|
227
|
+
m.format.hcg = Ct;
|
|
228
|
+
m.autodetect.push({
|
|
229
|
+
p: 1,
|
|
230
|
+
test: (...e) => {
|
|
231
|
+
if (e = N(e, "hcg"), x(e) === "array" && e.length === 3)
|
|
232
|
+
return "hcg";
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
const Mt = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, jt = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/, Je = (e) => {
|
|
236
|
+
if (e.match(Mt)) {
|
|
237
|
+
(e.length === 4 || e.length === 7) && (e = e.substr(1)), e.length === 3 && (e = e.split(""), e = e[0] + e[0] + e[1] + e[1] + e[2] + e[2]);
|
|
238
|
+
const t = parseInt(e, 16), n = t >> 16, r = t >> 8 & 255, s = t & 255;
|
|
239
|
+
return [n, r, s, 1];
|
|
240
|
+
}
|
|
241
|
+
if (e.match(jt)) {
|
|
242
|
+
(e.length === 5 || e.length === 9) && (e = e.substr(1)), e.length === 4 && (e = e.split(""), e = e[0] + e[0] + e[1] + e[1] + e[2] + e[2] + e[3] + e[3]);
|
|
243
|
+
const t = parseInt(e, 16), n = t >> 24 & 255, r = t >> 16 & 255, s = t >> 8 & 255, c = Math.round((t & 255) / 255 * 100) / 100;
|
|
244
|
+
return [n, r, s, c];
|
|
245
|
+
}
|
|
246
|
+
throw new Error(`unknown hex color: ${e}`);
|
|
247
|
+
}, { round: ee } = Math, Ke = (...e) => {
|
|
248
|
+
let [t, n, r, s] = N(e, "rgba"), c = oe(e) || "auto";
|
|
249
|
+
s === void 0 && (s = 1), c === "auto" && (c = s < 1 ? "rgba" : "rgb"), t = ee(t), n = ee(n), r = ee(r);
|
|
250
|
+
let f = "000000" + (t << 16 | n << 8 | r).toString(16);
|
|
251
|
+
f = f.substr(f.length - 6);
|
|
252
|
+
let a = "0" + ee(s * 255).toString(16);
|
|
253
|
+
switch (a = a.substr(a.length - 2), c.toLowerCase()) {
|
|
254
|
+
case "rgba":
|
|
255
|
+
return `#${f}${a}`;
|
|
256
|
+
case "argb":
|
|
257
|
+
return `#${a}${f}`;
|
|
258
|
+
default:
|
|
259
|
+
return `#${f}`;
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
l.prototype.hex = function(e) {
|
|
263
|
+
return Ke(this._rgb, e);
|
|
264
|
+
};
|
|
265
|
+
_.hex = (...e) => new l(...e, "hex");
|
|
266
|
+
m.format.hex = Je;
|
|
267
|
+
m.autodetect.push({
|
|
268
|
+
p: 4,
|
|
269
|
+
test: (e, ...t) => {
|
|
270
|
+
if (!t.length && x(e) === "string" && [3, 4, 5, 6, 7, 8, 9].indexOf(e.length) >= 0)
|
|
271
|
+
return "hex";
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
const { cos: Y } = Math, Tt = (...e) => {
|
|
275
|
+
e = N(e, "hsi");
|
|
276
|
+
let [t, n, r] = e, s, c, o;
|
|
277
|
+
return isNaN(t) && (t = 0), isNaN(n) && (n = 0), t > 360 && (t -= 360), t < 0 && (t += 360), t /= 360, t < 1 / 3 ? (o = (1 - n) / 3, s = (1 + n * Y(S * t) / Y(ue - S * t)) / 3, c = 1 - (o + s)) : t < 2 / 3 ? (t -= 1 / 3, s = (1 - n) / 3, c = (1 + n * Y(S * t) / Y(ue - S * t)) / 3, o = 1 - (s + c)) : (t -= 2 / 3, c = (1 - n) / 3, o = (1 + n * Y(S * t) / Y(ue - S * t)) / 3, s = 1 - (c + o)), s = X(r * s * 3), c = X(r * c * 3), o = X(r * o * 3), [s * 255, c * 255, o * 255, e.length > 3 ? e[3] : 1];
|
|
278
|
+
}, { min: Ot, sqrt: Rt, acos: Pt } = Math, Bt = (...e) => {
|
|
279
|
+
let [t, n, r] = N(e, "rgb");
|
|
280
|
+
t /= 255, n /= 255, r /= 255;
|
|
281
|
+
let s;
|
|
282
|
+
const c = Ot(t, n, r), o = (t + n + r) / 3, f = o > 0 ? 1 - c / o : 0;
|
|
283
|
+
return f === 0 ? s = NaN : (s = (t - n + (t - r)) / 2, s /= Rt((t - n) * (t - n) + (t - r) * (n - r)), s = Pt(s), r > n && (s = S - s), s /= S), [s * 360, f, o];
|
|
284
|
+
};
|
|
285
|
+
l.prototype.hsi = function() {
|
|
286
|
+
return Bt(this._rgb);
|
|
287
|
+
};
|
|
288
|
+
_.hsi = (...e) => new l(...e, "hsi");
|
|
289
|
+
m.format.hsi = Tt;
|
|
290
|
+
m.autodetect.push({
|
|
291
|
+
p: 2,
|
|
292
|
+
test: (...e) => {
|
|
293
|
+
if (e = N(e, "hsi"), x(e) === "array" && e.length === 3)
|
|
294
|
+
return "hsi";
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
l.prototype.hsl = function() {
|
|
298
|
+
return De(this._rgb);
|
|
299
|
+
};
|
|
300
|
+
_.hsl = (...e) => new l(...e, "hsl");
|
|
301
|
+
m.format.hsl = Ee;
|
|
302
|
+
m.autodetect.push({
|
|
303
|
+
p: 2,
|
|
304
|
+
test: (...e) => {
|
|
305
|
+
if (e = N(e, "hsl"), x(e) === "array" && e.length === 3)
|
|
306
|
+
return "hsl";
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
const { floor: Lt } = Math, zt = (...e) => {
|
|
310
|
+
e = N(e, "hsv");
|
|
311
|
+
let [t, n, r] = e, s, c, o;
|
|
312
|
+
if (r *= 255, n === 0)
|
|
313
|
+
s = c = o = r;
|
|
314
|
+
else {
|
|
315
|
+
t === 360 && (t = 0), t > 360 && (t -= 360), t < 0 && (t += 360), t /= 60;
|
|
316
|
+
const f = Lt(t), a = t - f, i = r * (1 - n), h = r * (1 - n * a), d = r * (1 - n * (1 - a));
|
|
317
|
+
switch (f) {
|
|
318
|
+
case 0:
|
|
319
|
+
[s, c, o] = [r, d, i];
|
|
320
|
+
break;
|
|
321
|
+
case 1:
|
|
322
|
+
[s, c, o] = [h, r, i];
|
|
323
|
+
break;
|
|
324
|
+
case 2:
|
|
325
|
+
[s, c, o] = [i, r, d];
|
|
326
|
+
break;
|
|
327
|
+
case 3:
|
|
328
|
+
[s, c, o] = [i, h, r];
|
|
329
|
+
break;
|
|
330
|
+
case 4:
|
|
331
|
+
[s, c, o] = [d, i, r];
|
|
332
|
+
break;
|
|
333
|
+
case 5:
|
|
334
|
+
[s, c, o] = [r, i, h];
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return [s, c, o, e.length > 3 ? e[3] : 1];
|
|
339
|
+
}, { min: St, max: qt } = Math, Ft = (...e) => {
|
|
340
|
+
e = N(e, "rgb");
|
|
341
|
+
let [t, n, r] = e;
|
|
342
|
+
const s = St(t, n, r), c = qt(t, n, r), o = c - s;
|
|
343
|
+
let f, a, i;
|
|
344
|
+
return i = c / 255, c === 0 ? (f = Number.NaN, a = 0) : (a = o / c, t === c && (f = (n - r) / o), n === c && (f = 2 + (r - t) / o), r === c && (f = 4 + (t - n) / o), f *= 60, f < 0 && (f += 360)), [f, a, i];
|
|
345
|
+
};
|
|
346
|
+
l.prototype.hsv = function() {
|
|
347
|
+
return Ft(this._rgb);
|
|
348
|
+
};
|
|
349
|
+
_.hsv = (...e) => new l(...e, "hsv");
|
|
350
|
+
m.format.hsv = zt;
|
|
351
|
+
m.autodetect.push({
|
|
352
|
+
p: 2,
|
|
353
|
+
test: (...e) => {
|
|
354
|
+
if (e = N(e, "hsv"), x(e) === "array" && e.length === 3)
|
|
355
|
+
return "hsv";
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
const R = {
|
|
359
|
+
// Corresponds roughly to RGB brighter/darker
|
|
360
|
+
Kn: 18,
|
|
361
|
+
// D65 standard referent
|
|
362
|
+
Xn: 0.95047,
|
|
363
|
+
Yn: 1,
|
|
364
|
+
Zn: 1.08883,
|
|
365
|
+
t0: 0.137931034,
|
|
366
|
+
// 4 / 29
|
|
367
|
+
t1: 0.206896552,
|
|
368
|
+
// 6 / 29
|
|
369
|
+
t2: 0.12841855,
|
|
370
|
+
// 3 * t1 * t1
|
|
371
|
+
t3: 8856452e-9
|
|
372
|
+
// t1 * t1 * t1
|
|
373
|
+
}, { pow: Gt } = Math, We = (...e) => {
|
|
374
|
+
e = N(e, "lab");
|
|
375
|
+
const [t, n, r] = e;
|
|
376
|
+
let s, c, o, f, a, i;
|
|
377
|
+
return c = (t + 16) / 116, s = isNaN(n) ? c : c + n / 500, o = isNaN(r) ? c : c - r / 200, c = R.Yn * he(c), s = R.Xn * he(s), o = R.Zn * he(o), f = be(3.2404542 * s - 1.5371385 * c - 0.4985314 * o), a = be(-0.969266 * s + 1.8760108 * c + 0.041556 * o), i = be(0.0556434 * s - 0.2040259 * c + 1.0572252 * o), [f, a, i, e.length > 3 ? e[3] : 1];
|
|
378
|
+
}, be = (e) => 255 * (e <= 304e-5 ? 12.92 * e : 1.055 * Gt(e, 1 / 2.4) - 0.055), he = (e) => e > R.t1 ? e * e * e : R.t2 * (e - R.t0), { pow: Qe } = Math, et = (...e) => {
|
|
379
|
+
const [t, n, r] = N(e, "rgb"), [s, c, o] = It(t, n, r), f = 116 * c - 16;
|
|
380
|
+
return [f < 0 ? 0 : f, 500 * (s - c), 200 * (c - o)];
|
|
381
|
+
}, ge = (e) => (e /= 255) <= 0.04045 ? e / 12.92 : Qe((e + 0.055) / 1.055, 2.4), pe = (e) => e > R.t3 ? Qe(e, 1 / 3) : e / R.t2 + R.t0, It = (e, t, n) => {
|
|
382
|
+
e = ge(e), t = ge(t), n = ge(n);
|
|
383
|
+
const r = pe(
|
|
384
|
+
(0.4124564 * e + 0.3575761 * t + 0.1804375 * n) / R.Xn
|
|
385
|
+
), s = pe(
|
|
386
|
+
(0.2126729 * e + 0.7151522 * t + 0.072175 * n) / R.Yn
|
|
387
|
+
), c = pe(
|
|
388
|
+
(0.0193339 * e + 0.119192 * t + 0.9503041 * n) / R.Zn
|
|
389
|
+
);
|
|
390
|
+
return [r, s, c];
|
|
391
|
+
};
|
|
392
|
+
l.prototype.lab = function() {
|
|
393
|
+
return et(this._rgb);
|
|
394
|
+
};
|
|
395
|
+
_.lab = (...e) => new l(...e, "lab");
|
|
396
|
+
m.format.lab = We;
|
|
397
|
+
m.autodetect.push({
|
|
398
|
+
p: 2,
|
|
399
|
+
test: (...e) => {
|
|
400
|
+
if (e = N(e, "lab"), x(e) === "array" && e.length === 3)
|
|
401
|
+
return "lab";
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
const { sin: Dt, cos: Yt } = Math, tt = (...e) => {
|
|
405
|
+
let [t, n, r] = N(e, "lch");
|
|
406
|
+
return isNaN(r) && (r = 0), r = r * wt, [t, Yt(r) * n, Dt(r) * n];
|
|
407
|
+
}, nt = (...e) => {
|
|
408
|
+
e = N(e, "lch");
|
|
409
|
+
const [t, n, r] = e, [s, c, o] = tt(t, n, r), [f, a, i] = We(s, c, o);
|
|
410
|
+
return [f, a, i, e.length > 3 ? e[3] : 1];
|
|
411
|
+
}, Ht = (...e) => {
|
|
412
|
+
const t = N(e, "hcl").reverse();
|
|
413
|
+
return nt(...t);
|
|
414
|
+
}, { sqrt: Xt, atan2: Ut, round: Vt } = Math, rt = (...e) => {
|
|
415
|
+
const [t, n, r] = N(e, "lab"), s = Xt(n * n + r * r);
|
|
416
|
+
let c = (Ut(r, n) * kt + 360) % 360;
|
|
417
|
+
return Vt(s * 1e4) === 0 && (c = Number.NaN), [t, s, c];
|
|
418
|
+
}, st = (...e) => {
|
|
419
|
+
const [t, n, r] = N(e, "rgb"), [s, c, o] = et(t, n, r);
|
|
420
|
+
return rt(s, c, o);
|
|
421
|
+
};
|
|
422
|
+
l.prototype.lch = function() {
|
|
423
|
+
return st(this._rgb);
|
|
424
|
+
};
|
|
425
|
+
l.prototype.hcl = function() {
|
|
426
|
+
return st(this._rgb).reverse();
|
|
427
|
+
};
|
|
428
|
+
_.lch = (...e) => new l(...e, "lch");
|
|
429
|
+
_.hcl = (...e) => new l(...e, "hcl");
|
|
430
|
+
m.format.lch = nt;
|
|
431
|
+
m.format.hcl = Ht;
|
|
432
|
+
["lch", "hcl"].forEach(
|
|
433
|
+
(e) => m.autodetect.push({
|
|
434
|
+
p: 2,
|
|
435
|
+
test: (...t) => {
|
|
436
|
+
if (t = N(t, e), x(t) === "array" && t.length === 3)
|
|
437
|
+
return e;
|
|
438
|
+
}
|
|
439
|
+
})
|
|
440
|
+
);
|
|
441
|
+
const U = {
|
|
442
|
+
aliceblue: "#f0f8ff",
|
|
443
|
+
antiquewhite: "#faebd7",
|
|
444
|
+
aqua: "#00ffff",
|
|
445
|
+
aquamarine: "#7fffd4",
|
|
446
|
+
azure: "#f0ffff",
|
|
447
|
+
beige: "#f5f5dc",
|
|
448
|
+
bisque: "#ffe4c4",
|
|
449
|
+
black: "#000000",
|
|
450
|
+
blanchedalmond: "#ffebcd",
|
|
451
|
+
blue: "#0000ff",
|
|
452
|
+
blueviolet: "#8a2be2",
|
|
453
|
+
brown: "#a52a2a",
|
|
454
|
+
burlywood: "#deb887",
|
|
455
|
+
cadetblue: "#5f9ea0",
|
|
456
|
+
chartreuse: "#7fff00",
|
|
457
|
+
chocolate: "#d2691e",
|
|
458
|
+
coral: "#ff7f50",
|
|
459
|
+
cornflowerblue: "#6495ed",
|
|
460
|
+
cornsilk: "#fff8dc",
|
|
461
|
+
crimson: "#dc143c",
|
|
462
|
+
cyan: "#00ffff",
|
|
463
|
+
darkblue: "#00008b",
|
|
464
|
+
darkcyan: "#008b8b",
|
|
465
|
+
darkgoldenrod: "#b8860b",
|
|
466
|
+
darkgray: "#a9a9a9",
|
|
467
|
+
darkgreen: "#006400",
|
|
468
|
+
darkgrey: "#a9a9a9",
|
|
469
|
+
darkkhaki: "#bdb76b",
|
|
470
|
+
darkmagenta: "#8b008b",
|
|
471
|
+
darkolivegreen: "#556b2f",
|
|
472
|
+
darkorange: "#ff8c00",
|
|
473
|
+
darkorchid: "#9932cc",
|
|
474
|
+
darkred: "#8b0000",
|
|
475
|
+
darksalmon: "#e9967a",
|
|
476
|
+
darkseagreen: "#8fbc8f",
|
|
477
|
+
darkslateblue: "#483d8b",
|
|
478
|
+
darkslategray: "#2f4f4f",
|
|
479
|
+
darkslategrey: "#2f4f4f",
|
|
480
|
+
darkturquoise: "#00ced1",
|
|
481
|
+
darkviolet: "#9400d3",
|
|
482
|
+
deeppink: "#ff1493",
|
|
483
|
+
deepskyblue: "#00bfff",
|
|
484
|
+
dimgray: "#696969",
|
|
485
|
+
dimgrey: "#696969",
|
|
486
|
+
dodgerblue: "#1e90ff",
|
|
487
|
+
firebrick: "#b22222",
|
|
488
|
+
floralwhite: "#fffaf0",
|
|
489
|
+
forestgreen: "#228b22",
|
|
490
|
+
fuchsia: "#ff00ff",
|
|
491
|
+
gainsboro: "#dcdcdc",
|
|
492
|
+
ghostwhite: "#f8f8ff",
|
|
493
|
+
gold: "#ffd700",
|
|
494
|
+
goldenrod: "#daa520",
|
|
495
|
+
gray: "#808080",
|
|
496
|
+
green: "#008000",
|
|
497
|
+
greenyellow: "#adff2f",
|
|
498
|
+
grey: "#808080",
|
|
499
|
+
honeydew: "#f0fff0",
|
|
500
|
+
hotpink: "#ff69b4",
|
|
501
|
+
indianred: "#cd5c5c",
|
|
502
|
+
indigo: "#4b0082",
|
|
503
|
+
ivory: "#fffff0",
|
|
504
|
+
khaki: "#f0e68c",
|
|
505
|
+
laserlemon: "#ffff54",
|
|
506
|
+
lavender: "#e6e6fa",
|
|
507
|
+
lavenderblush: "#fff0f5",
|
|
508
|
+
lawngreen: "#7cfc00",
|
|
509
|
+
lemonchiffon: "#fffacd",
|
|
510
|
+
lightblue: "#add8e6",
|
|
511
|
+
lightcoral: "#f08080",
|
|
512
|
+
lightcyan: "#e0ffff",
|
|
513
|
+
lightgoldenrod: "#fafad2",
|
|
514
|
+
lightgoldenrodyellow: "#fafad2",
|
|
515
|
+
lightgray: "#d3d3d3",
|
|
516
|
+
lightgreen: "#90ee90",
|
|
517
|
+
lightgrey: "#d3d3d3",
|
|
518
|
+
lightpink: "#ffb6c1",
|
|
519
|
+
lightsalmon: "#ffa07a",
|
|
520
|
+
lightseagreen: "#20b2aa",
|
|
521
|
+
lightskyblue: "#87cefa",
|
|
522
|
+
lightslategray: "#778899",
|
|
523
|
+
lightslategrey: "#778899",
|
|
524
|
+
lightsteelblue: "#b0c4de",
|
|
525
|
+
lightyellow: "#ffffe0",
|
|
526
|
+
lime: "#00ff00",
|
|
527
|
+
limegreen: "#32cd32",
|
|
528
|
+
linen: "#faf0e6",
|
|
529
|
+
magenta: "#ff00ff",
|
|
530
|
+
maroon: "#800000",
|
|
531
|
+
maroon2: "#7f0000",
|
|
532
|
+
maroon3: "#b03060",
|
|
533
|
+
mediumaquamarine: "#66cdaa",
|
|
534
|
+
mediumblue: "#0000cd",
|
|
535
|
+
mediumorchid: "#ba55d3",
|
|
536
|
+
mediumpurple: "#9370db",
|
|
537
|
+
mediumseagreen: "#3cb371",
|
|
538
|
+
mediumslateblue: "#7b68ee",
|
|
539
|
+
mediumspringgreen: "#00fa9a",
|
|
540
|
+
mediumturquoise: "#48d1cc",
|
|
541
|
+
mediumvioletred: "#c71585",
|
|
542
|
+
midnightblue: "#191970",
|
|
543
|
+
mintcream: "#f5fffa",
|
|
544
|
+
mistyrose: "#ffe4e1",
|
|
545
|
+
moccasin: "#ffe4b5",
|
|
546
|
+
navajowhite: "#ffdead",
|
|
547
|
+
navy: "#000080",
|
|
548
|
+
oldlace: "#fdf5e6",
|
|
549
|
+
olive: "#808000",
|
|
550
|
+
olivedrab: "#6b8e23",
|
|
551
|
+
orange: "#ffa500",
|
|
552
|
+
orangered: "#ff4500",
|
|
553
|
+
orchid: "#da70d6",
|
|
554
|
+
palegoldenrod: "#eee8aa",
|
|
555
|
+
palegreen: "#98fb98",
|
|
556
|
+
paleturquoise: "#afeeee",
|
|
557
|
+
palevioletred: "#db7093",
|
|
558
|
+
papayawhip: "#ffefd5",
|
|
559
|
+
peachpuff: "#ffdab9",
|
|
560
|
+
peru: "#cd853f",
|
|
561
|
+
pink: "#ffc0cb",
|
|
562
|
+
plum: "#dda0dd",
|
|
563
|
+
powderblue: "#b0e0e6",
|
|
564
|
+
purple: "#800080",
|
|
565
|
+
purple2: "#7f007f",
|
|
566
|
+
purple3: "#a020f0",
|
|
567
|
+
rebeccapurple: "#663399",
|
|
568
|
+
red: "#ff0000",
|
|
569
|
+
rosybrown: "#bc8f8f",
|
|
570
|
+
royalblue: "#4169e1",
|
|
571
|
+
saddlebrown: "#8b4513",
|
|
572
|
+
salmon: "#fa8072",
|
|
573
|
+
sandybrown: "#f4a460",
|
|
574
|
+
seagreen: "#2e8b57",
|
|
575
|
+
seashell: "#fff5ee",
|
|
576
|
+
sienna: "#a0522d",
|
|
577
|
+
silver: "#c0c0c0",
|
|
578
|
+
skyblue: "#87ceeb",
|
|
579
|
+
slateblue: "#6a5acd",
|
|
580
|
+
slategray: "#708090",
|
|
581
|
+
slategrey: "#708090",
|
|
582
|
+
snow: "#fffafa",
|
|
583
|
+
springgreen: "#00ff7f",
|
|
584
|
+
steelblue: "#4682b4",
|
|
585
|
+
tan: "#d2b48c",
|
|
586
|
+
teal: "#008080",
|
|
587
|
+
thistle: "#d8bfd8",
|
|
588
|
+
tomato: "#ff6347",
|
|
589
|
+
turquoise: "#40e0d0",
|
|
590
|
+
violet: "#ee82ee",
|
|
591
|
+
wheat: "#f5deb3",
|
|
592
|
+
white: "#ffffff",
|
|
593
|
+
whitesmoke: "#f5f5f5",
|
|
594
|
+
yellow: "#ffff00",
|
|
595
|
+
yellowgreen: "#9acd32"
|
|
596
|
+
};
|
|
597
|
+
l.prototype.name = function() {
|
|
598
|
+
const e = Ke(this._rgb, "rgb");
|
|
599
|
+
for (let t of Object.keys(U))
|
|
600
|
+
if (U[t] === e)
|
|
601
|
+
return t.toLowerCase();
|
|
602
|
+
return e;
|
|
603
|
+
};
|
|
604
|
+
m.format.named = (e) => {
|
|
605
|
+
if (e = e.toLowerCase(), U[e])
|
|
606
|
+
return Je(U[e]);
|
|
607
|
+
throw new Error("unknown color name: " + e);
|
|
608
|
+
};
|
|
609
|
+
m.autodetect.push({
|
|
610
|
+
p: 5,
|
|
611
|
+
test: (e, ...t) => {
|
|
612
|
+
if (!t.length && x(e) === "string" && U[e.toLowerCase()])
|
|
613
|
+
return "named";
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
const Zt = (e) => {
|
|
617
|
+
if (x(e) == "number" && e >= 0 && e <= 16777215) {
|
|
618
|
+
const t = e >> 16, n = e >> 8 & 255, r = e & 255;
|
|
619
|
+
return [t, n, r, 1];
|
|
620
|
+
}
|
|
621
|
+
throw new Error("unknown num color: " + e);
|
|
622
|
+
}, Jt = (...e) => {
|
|
623
|
+
const [t, n, r] = N(e, "rgb");
|
|
624
|
+
return (t << 16) + (n << 8) + r;
|
|
625
|
+
};
|
|
626
|
+
l.prototype.num = function() {
|
|
627
|
+
return Jt(this._rgb);
|
|
628
|
+
};
|
|
629
|
+
_.num = (...e) => new l(...e, "num");
|
|
630
|
+
m.format.num = Zt;
|
|
631
|
+
m.autodetect.push({
|
|
632
|
+
p: 5,
|
|
633
|
+
test: (...e) => {
|
|
634
|
+
if (e.length === 1 && x(e[0]) === "number" && e[0] >= 0 && e[0] <= 16777215)
|
|
635
|
+
return "num";
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
const { round: ct } = Math;
|
|
639
|
+
l.prototype.rgb = function(e = !0) {
|
|
640
|
+
return e === !1 ? this._rgb.slice(0, 3) : this._rgb.slice(0, 3).map(ct);
|
|
641
|
+
};
|
|
642
|
+
l.prototype.rgba = function(e = !0) {
|
|
643
|
+
return this._rgb.slice(0, 4).map((t, n) => n < 3 ? e === !1 ? t : ct(t) : t);
|
|
644
|
+
};
|
|
645
|
+
_.rgb = (...e) => new l(...e, "rgb");
|
|
646
|
+
m.format.rgb = (...e) => {
|
|
647
|
+
const t = N(e, "rgba");
|
|
648
|
+
return t[3] === void 0 && (t[3] = 1), t;
|
|
649
|
+
};
|
|
650
|
+
m.autodetect.push({
|
|
651
|
+
p: 3,
|
|
652
|
+
test: (...e) => {
|
|
653
|
+
if (e = N(e, "rgba"), x(e) === "array" && (e.length === 3 || e.length === 4 && x(e[3]) == "number" && e[3] >= 0 && e[3] <= 1))
|
|
654
|
+
return "rgb";
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
const { log: te } = Math, ot = (e) => {
|
|
658
|
+
const t = e / 100;
|
|
659
|
+
let n, r, s;
|
|
660
|
+
return t < 66 ? (n = 255, r = t < 6 ? 0 : -155.25485562709179 - 0.44596950469579133 * (r = t - 2) + 104.49216199393888 * te(r), s = t < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (s = t - 10) + 115.67994401066147 * te(s)) : (n = 351.97690566805693 + 0.114206453784165 * (n = t - 55) - 40.25366309332127 * te(n), r = 325.4494125711974 + 0.07943456536662342 * (r = t - 50) - 28.0852963507957 * te(r), s = 255), [n, r, s, 1];
|
|
661
|
+
}, { round: Kt } = Math, Wt = (...e) => {
|
|
662
|
+
const t = N(e, "rgb"), n = t[0], r = t[2];
|
|
663
|
+
let s = 1e3, c = 4e4;
|
|
664
|
+
const o = 0.4;
|
|
665
|
+
let f;
|
|
666
|
+
for (; c - s > o; ) {
|
|
667
|
+
f = (c + s) * 0.5;
|
|
668
|
+
const a = ot(f);
|
|
669
|
+
a[2] / a[0] >= r / n ? c = f : s = f;
|
|
670
|
+
}
|
|
671
|
+
return Kt(f);
|
|
672
|
+
};
|
|
673
|
+
l.prototype.temp = l.prototype.kelvin = l.prototype.temperature = function() {
|
|
674
|
+
return Wt(this._rgb);
|
|
675
|
+
};
|
|
676
|
+
_.temp = _.kelvin = _.temperature = (...e) => new l(...e, "temp");
|
|
677
|
+
m.format.temp = m.format.kelvin = m.format.temperature = ot;
|
|
678
|
+
const { pow: re, sign: Qt } = Math, ft = (...e) => {
|
|
679
|
+
e = N(e, "lab");
|
|
680
|
+
const [t, n, r] = e, s = re(t + 0.3963377774 * n + 0.2158037573 * r, 3), c = re(t - 0.1055613458 * n - 0.0638541728 * r, 3), o = re(t - 0.0894841775 * n - 1.291485548 * r, 3);
|
|
681
|
+
return [
|
|
682
|
+
255 * me(4.0767416621 * s - 3.3077115913 * c + 0.2309699292 * o),
|
|
683
|
+
255 * me(-1.2684380046 * s + 2.6097574011 * c - 0.3413193965 * o),
|
|
684
|
+
255 * me(-0.0041960863 * s - 0.7034186147 * c + 1.707614701 * o),
|
|
685
|
+
e.length > 3 ? e[3] : 1
|
|
686
|
+
];
|
|
687
|
+
};
|
|
688
|
+
function me(e) {
|
|
689
|
+
const t = Math.abs(e);
|
|
690
|
+
return t > 31308e-7 ? (Qt(e) || 1) * (1.055 * re(t, 1 / 2.4) - 0.055) : e * 12.92;
|
|
691
|
+
}
|
|
692
|
+
const { cbrt: ye, pow: e0, sign: t0 } = Math, at = (...e) => {
|
|
693
|
+
const [t, n, r] = N(e, "rgb"), [s, c, o] = [
|
|
694
|
+
we(t / 255),
|
|
695
|
+
we(n / 255),
|
|
696
|
+
we(r / 255)
|
|
697
|
+
], f = ye(0.4122214708 * s + 0.5363325363 * c + 0.0514459929 * o), a = ye(0.2119034982 * s + 0.6806995451 * c + 0.1073969566 * o), i = ye(0.0883024619 * s + 0.2817188376 * c + 0.6299787005 * o);
|
|
698
|
+
return [
|
|
699
|
+
0.2104542553 * f + 0.793617785 * a - 0.0040720468 * i,
|
|
700
|
+
1.9779984951 * f - 2.428592205 * a + 0.4505937099 * i,
|
|
701
|
+
0.0259040371 * f + 0.7827717662 * a - 0.808675766 * i
|
|
702
|
+
];
|
|
703
|
+
};
|
|
704
|
+
function we(e) {
|
|
705
|
+
const t = Math.abs(e);
|
|
706
|
+
return t < 0.04045 ? e / 12.92 : (t0(e) || 1) * e0((t + 0.055) / 1.055, 2.4);
|
|
707
|
+
}
|
|
708
|
+
l.prototype.oklab = function() {
|
|
709
|
+
return at(this._rgb);
|
|
710
|
+
};
|
|
711
|
+
_.oklab = (...e) => new l(...e, "oklab");
|
|
712
|
+
m.format.oklab = ft;
|
|
713
|
+
m.autodetect.push({
|
|
714
|
+
p: 3,
|
|
715
|
+
test: (...e) => {
|
|
716
|
+
if (e = N(e, "oklab"), x(e) === "array" && e.length === 3)
|
|
717
|
+
return "oklab";
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
const n0 = (...e) => {
|
|
721
|
+
e = N(e, "lch");
|
|
722
|
+
const [t, n, r] = e, [s, c, o] = tt(t, n, r), [f, a, i] = ft(s, c, o);
|
|
723
|
+
return [f, a, i, e.length > 3 ? e[3] : 1];
|
|
724
|
+
}, r0 = (...e) => {
|
|
725
|
+
const [t, n, r] = N(e, "rgb"), [s, c, o] = at(t, n, r);
|
|
726
|
+
return rt(s, c, o);
|
|
727
|
+
};
|
|
728
|
+
l.prototype.oklch = function() {
|
|
729
|
+
return r0(this._rgb);
|
|
730
|
+
};
|
|
731
|
+
_.oklch = (...e) => new l(...e, "oklch");
|
|
732
|
+
m.format.oklch = n0;
|
|
733
|
+
m.autodetect.push({
|
|
734
|
+
p: 3,
|
|
735
|
+
test: (...e) => {
|
|
736
|
+
if (e = N(e, "oklch"), x(e) === "array" && e.length === 3)
|
|
737
|
+
return "oklch";
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
l.prototype.alpha = function(e, t = !1) {
|
|
741
|
+
return e !== void 0 && x(e) === "number" ? t ? (this._rgb[3] = e, this) : new l([this._rgb[0], this._rgb[1], this._rgb[2], e], "rgb") : this._rgb[3];
|
|
742
|
+
};
|
|
743
|
+
l.prototype.clipped = function() {
|
|
744
|
+
return this._rgb._clipped || !1;
|
|
745
|
+
};
|
|
746
|
+
l.prototype.darken = function(e = 1) {
|
|
747
|
+
const t = this, n = t.lab();
|
|
748
|
+
return n[0] -= R.Kn * e, new l(n, "lab").alpha(t.alpha(), !0);
|
|
749
|
+
};
|
|
750
|
+
l.prototype.brighten = function(e = 1) {
|
|
751
|
+
return this.darken(-e);
|
|
752
|
+
};
|
|
753
|
+
l.prototype.darker = l.prototype.darken;
|
|
754
|
+
l.prototype.brighter = l.prototype.brighten;
|
|
755
|
+
l.prototype.get = function(e) {
|
|
756
|
+
const [t, n] = e.split("."), r = this[t]();
|
|
757
|
+
if (n) {
|
|
758
|
+
const s = t.indexOf(n) - (t.substr(0, 2) === "ok" ? 2 : 0);
|
|
759
|
+
if (s > -1)
|
|
760
|
+
return r[s];
|
|
761
|
+
throw new Error(`unknown channel ${n} in mode ${t}`);
|
|
762
|
+
} else
|
|
763
|
+
return r;
|
|
764
|
+
};
|
|
765
|
+
const { pow: s0 } = Math, c0 = 1e-7, o0 = 20;
|
|
766
|
+
l.prototype.luminance = function(e, t = "rgb") {
|
|
767
|
+
if (e !== void 0 && x(e) === "number") {
|
|
768
|
+
if (e === 0)
|
|
769
|
+
return new l([0, 0, 0, this._rgb[3]], "rgb");
|
|
770
|
+
if (e === 1)
|
|
771
|
+
return new l([255, 255, 255, this._rgb[3]], "rgb");
|
|
772
|
+
let n = this.luminance(), r = o0;
|
|
773
|
+
const s = (o, f) => {
|
|
774
|
+
const a = o.interpolate(f, 0.5, t), i = a.luminance();
|
|
775
|
+
return Math.abs(e - i) < c0 || !r-- ? a : i > e ? s(o, a) : s(a, f);
|
|
776
|
+
}, c = (n > e ? s(new l([0, 0, 0]), this) : s(this, new l([255, 255, 255]))).rgb();
|
|
777
|
+
return new l([...c, this._rgb[3]]);
|
|
778
|
+
}
|
|
779
|
+
return f0(...this._rgb.slice(0, 3));
|
|
780
|
+
};
|
|
781
|
+
const f0 = (e, t, n) => (e = ke(e), t = ke(t), n = ke(n), 0.2126 * e + 0.7152 * t + 0.0722 * n), ke = (e) => (e /= 255, e <= 0.03928 ? e / 12.92 : s0((e + 0.055) / 1.055, 2.4)), O = {}, K = (e, t, n = 0.5, ...r) => {
|
|
782
|
+
let s = r[0] || "lrgb";
|
|
783
|
+
if (!O[s] && !r.length && (s = Object.keys(O)[0]), !O[s])
|
|
784
|
+
throw new Error(`interpolation mode ${s} is not defined`);
|
|
785
|
+
return x(e) !== "object" && (e = new l(e)), x(t) !== "object" && (t = new l(t)), O[s](e, t, n).alpha(
|
|
786
|
+
e.alpha() + n * (t.alpha() - e.alpha())
|
|
787
|
+
);
|
|
788
|
+
};
|
|
789
|
+
l.prototype.mix = l.prototype.interpolate = function(e, t = 0.5, ...n) {
|
|
790
|
+
return K(this, e, t, ...n);
|
|
791
|
+
};
|
|
792
|
+
l.prototype.premultiply = function(e = !1) {
|
|
793
|
+
const t = this._rgb, n = t[3];
|
|
794
|
+
return e ? (this._rgb = [t[0] * n, t[1] * n, t[2] * n, n], this) : new l([t[0] * n, t[1] * n, t[2] * n, n], "rgb");
|
|
795
|
+
};
|
|
796
|
+
l.prototype.saturate = function(e = 1) {
|
|
797
|
+
const t = this, n = t.lch();
|
|
798
|
+
return n[1] += R.Kn * e, n[1] < 0 && (n[1] = 0), new l(n, "lch").alpha(t.alpha(), !0);
|
|
799
|
+
};
|
|
800
|
+
l.prototype.desaturate = function(e = 1) {
|
|
801
|
+
return this.saturate(-e);
|
|
802
|
+
};
|
|
803
|
+
l.prototype.set = function(e, t, n = !1) {
|
|
804
|
+
const [r, s] = e.split("."), c = this[r]();
|
|
805
|
+
if (s) {
|
|
806
|
+
const o = r.indexOf(s) - (r.substr(0, 2) === "ok" ? 2 : 0);
|
|
807
|
+
if (o > -1) {
|
|
808
|
+
if (x(t) == "string")
|
|
809
|
+
switch (t.charAt(0)) {
|
|
810
|
+
case "+":
|
|
811
|
+
c[o] += +t;
|
|
812
|
+
break;
|
|
813
|
+
case "-":
|
|
814
|
+
c[o] += +t;
|
|
815
|
+
break;
|
|
816
|
+
case "*":
|
|
817
|
+
c[o] *= +t.substr(1);
|
|
818
|
+
break;
|
|
819
|
+
case "/":
|
|
820
|
+
c[o] /= +t.substr(1);
|
|
821
|
+
break;
|
|
822
|
+
default:
|
|
823
|
+
c[o] = +t;
|
|
824
|
+
}
|
|
825
|
+
else if (x(t) === "number")
|
|
826
|
+
c[o] = t;
|
|
827
|
+
else
|
|
828
|
+
throw new Error("unsupported value for Color.set");
|
|
829
|
+
const f = new l(c, r);
|
|
830
|
+
return n ? (this._rgb = f._rgb, this) : f;
|
|
831
|
+
}
|
|
832
|
+
throw new Error(`unknown channel ${s} in mode ${r}`);
|
|
833
|
+
} else
|
|
834
|
+
return c;
|
|
835
|
+
};
|
|
836
|
+
l.prototype.tint = function(e = 0.5, ...t) {
|
|
837
|
+
return K(this, "white", e, ...t);
|
|
838
|
+
};
|
|
839
|
+
l.prototype.shade = function(e = 0.5, ...t) {
|
|
840
|
+
return K(this, "black", e, ...t);
|
|
841
|
+
};
|
|
842
|
+
const a0 = (e, t, n) => {
|
|
843
|
+
const r = e._rgb, s = t._rgb;
|
|
844
|
+
return new l(
|
|
845
|
+
r[0] + n * (s[0] - r[0]),
|
|
846
|
+
r[1] + n * (s[1] - r[1]),
|
|
847
|
+
r[2] + n * (s[2] - r[2]),
|
|
848
|
+
"rgb"
|
|
849
|
+
);
|
|
850
|
+
};
|
|
851
|
+
O.rgb = a0;
|
|
852
|
+
const { sqrt: _e, pow: H } = Math, u0 = (e, t, n) => {
|
|
853
|
+
const [r, s, c] = e._rgb, [o, f, a] = t._rgb;
|
|
854
|
+
return new l(
|
|
855
|
+
_e(H(r, 2) * (1 - n) + H(o, 2) * n),
|
|
856
|
+
_e(H(s, 2) * (1 - n) + H(f, 2) * n),
|
|
857
|
+
_e(H(c, 2) * (1 - n) + H(a, 2) * n),
|
|
858
|
+
"rgb"
|
|
859
|
+
);
|
|
860
|
+
};
|
|
861
|
+
O.lrgb = u0;
|
|
862
|
+
const l0 = (e, t, n) => {
|
|
863
|
+
const r = e.lab(), s = t.lab();
|
|
864
|
+
return new l(
|
|
865
|
+
r[0] + n * (s[0] - r[0]),
|
|
866
|
+
r[1] + n * (s[1] - r[1]),
|
|
867
|
+
r[2] + n * (s[2] - r[2]),
|
|
868
|
+
"lab"
|
|
869
|
+
);
|
|
870
|
+
};
|
|
871
|
+
O.lab = l0;
|
|
872
|
+
const V = (e, t, n, r) => {
|
|
873
|
+
let s, c;
|
|
874
|
+
r === "hsl" ? (s = e.hsl(), c = t.hsl()) : r === "hsv" ? (s = e.hsv(), c = t.hsv()) : r === "hcg" ? (s = e.hcg(), c = t.hcg()) : r === "hsi" ? (s = e.hsi(), c = t.hsi()) : r === "lch" || r === "hcl" ? (r = "hcl", s = e.hcl(), c = t.hcl()) : r === "oklch" && (s = e.oklch().reverse(), c = t.oklch().reverse());
|
|
875
|
+
let o, f, a, i, h, d;
|
|
876
|
+
(r.substr(0, 1) === "h" || r === "oklch") && ([o, a, h] = s, [f, i, d] = c);
|
|
877
|
+
let b, y, C, M;
|
|
878
|
+
return !isNaN(o) && !isNaN(f) ? (f > o && f - o > 180 ? M = f - (o + 360) : f < o && o - f > 180 ? M = f + 360 - o : M = f - o, y = o + n * M) : isNaN(o) ? isNaN(f) ? y = Number.NaN : (y = f, (h == 1 || h == 0) && r != "hsv" && (b = i)) : (y = o, (d == 1 || d == 0) && r != "hsv" && (b = a)), b === void 0 && (b = a + n * (i - a)), C = h + n * (d - h), r === "oklch" ? new l([C, b, y], r) : new l([y, b, C], r);
|
|
879
|
+
}, ut = (e, t, n) => V(e, t, n, "lch");
|
|
880
|
+
O.lch = ut;
|
|
881
|
+
O.hcl = ut;
|
|
882
|
+
const i0 = (e, t, n) => {
|
|
883
|
+
const r = e.num(), s = t.num();
|
|
884
|
+
return new l(r + n * (s - r), "num");
|
|
885
|
+
};
|
|
886
|
+
O.num = i0;
|
|
887
|
+
const d0 = (e, t, n) => V(e, t, n, "hcg");
|
|
888
|
+
O.hcg = d0;
|
|
889
|
+
const b0 = (e, t, n) => V(e, t, n, "hsi");
|
|
890
|
+
O.hsi = b0;
|
|
891
|
+
const h0 = (e, t, n) => V(e, t, n, "hsl");
|
|
892
|
+
O.hsl = h0;
|
|
893
|
+
const g0 = (e, t, n) => V(e, t, n, "hsv");
|
|
894
|
+
O.hsv = g0;
|
|
895
|
+
const p0 = (e, t, n) => {
|
|
896
|
+
const r = e.oklab(), s = t.oklab();
|
|
897
|
+
return new l(
|
|
898
|
+
r[0] + n * (s[0] - r[0]),
|
|
899
|
+
r[1] + n * (s[1] - r[1]),
|
|
900
|
+
r[2] + n * (s[2] - r[2]),
|
|
901
|
+
"oklab"
|
|
902
|
+
);
|
|
903
|
+
};
|
|
904
|
+
O.oklab = p0;
|
|
905
|
+
const m0 = (e, t, n) => V(e, t, n, "oklch");
|
|
906
|
+
O.oklch = m0;
|
|
907
|
+
const { pow: $e, sqrt: xe, PI: Ne, cos: Re, sin: Pe, atan2: y0 } = Math, w0 = (e, t = "lrgb", n = null) => {
|
|
908
|
+
const r = e.length;
|
|
909
|
+
n || (n = Array.from(new Array(r)).map(() => 1));
|
|
910
|
+
const s = r / n.reduce(function(d, b) {
|
|
911
|
+
return d + b;
|
|
912
|
+
});
|
|
913
|
+
if (n.forEach((d, b) => {
|
|
914
|
+
n[b] *= s;
|
|
915
|
+
}), e = e.map((d) => new l(d)), t === "lrgb")
|
|
916
|
+
return k0(e, n);
|
|
917
|
+
const c = e.shift(), o = c.get(t), f = [];
|
|
918
|
+
let a = 0, i = 0;
|
|
919
|
+
for (let d = 0; d < o.length; d++)
|
|
920
|
+
if (o[d] = (o[d] || 0) * n[0], f.push(isNaN(o[d]) ? 0 : n[0]), t.charAt(d) === "h" && !isNaN(o[d])) {
|
|
921
|
+
const b = o[d] / 180 * Ne;
|
|
922
|
+
a += Re(b) * n[0], i += Pe(b) * n[0];
|
|
923
|
+
}
|
|
924
|
+
let h = c.alpha() * n[0];
|
|
925
|
+
e.forEach((d, b) => {
|
|
926
|
+
const y = d.get(t);
|
|
927
|
+
h += d.alpha() * n[b + 1];
|
|
928
|
+
for (let C = 0; C < o.length; C++)
|
|
929
|
+
if (!isNaN(y[C]))
|
|
930
|
+
if (f[C] += n[b + 1], t.charAt(C) === "h") {
|
|
931
|
+
const M = y[C] / 180 * Ne;
|
|
932
|
+
a += Re(M) * n[b + 1], i += Pe(M) * n[b + 1];
|
|
933
|
+
} else
|
|
934
|
+
o[C] += y[C] * n[b + 1];
|
|
935
|
+
});
|
|
936
|
+
for (let d = 0; d < o.length; d++)
|
|
937
|
+
if (t.charAt(d) === "h") {
|
|
938
|
+
let b = y0(i / f[d], a / f[d]) / Ne * 180;
|
|
939
|
+
for (; b < 0; )
|
|
940
|
+
b += 360;
|
|
941
|
+
for (; b >= 360; )
|
|
942
|
+
b -= 360;
|
|
943
|
+
o[d] = b;
|
|
944
|
+
} else
|
|
945
|
+
o[d] = o[d] / f[d];
|
|
946
|
+
return h /= r, new l(o, t).alpha(h > 0.99999 ? 1 : h, !0);
|
|
947
|
+
}, k0 = (e, t) => {
|
|
948
|
+
const n = e.length, r = [0, 0, 0, 0];
|
|
949
|
+
for (let s = 0; s < e.length; s++) {
|
|
950
|
+
const c = e[s], o = t[s] / n, f = c._rgb;
|
|
951
|
+
r[0] += $e(f[0], 2) * o, r[1] += $e(f[1], 2) * o, r[2] += $e(f[2], 2) * o, r[3] += f[3] * o;
|
|
952
|
+
}
|
|
953
|
+
return r[0] = xe(r[0]), r[1] = xe(r[1]), r[2] = xe(r[2]), r[3] > 0.9999999 && (r[3] = 1), new l(ve(r));
|
|
954
|
+
}, { pow: _0 } = Math;
|
|
955
|
+
function ce(e) {
|
|
956
|
+
let t = "rgb", n = _("#ccc"), r = 0, s = [0, 1], c = [], o = [0, 0], f = !1, a = [], i = !1, h = 0, d = 1, b = !1, y = {}, C = !0, M = 1;
|
|
957
|
+
const $ = function(u) {
|
|
958
|
+
if (u = u || ["#fff", "#000"], u && x(u) === "string" && _.brewer && _.brewer[u.toLowerCase()] && (u = _.brewer[u.toLowerCase()]), x(u) === "array") {
|
|
959
|
+
u.length === 1 && (u = [u[0], u[0]]), u = u.slice(0);
|
|
960
|
+
for (let g = 0; g < u.length; g++)
|
|
961
|
+
u[g] = _(u[g]);
|
|
962
|
+
c.length = 0;
|
|
963
|
+
for (let g = 0; g < u.length; g++)
|
|
964
|
+
c.push(g / (u.length - 1));
|
|
965
|
+
}
|
|
966
|
+
return B(), a = u;
|
|
967
|
+
}, w = function(u) {
|
|
968
|
+
if (f != null) {
|
|
969
|
+
const g = f.length - 1;
|
|
970
|
+
let k = 0;
|
|
971
|
+
for (; k < g && u >= f[k]; )
|
|
972
|
+
k++;
|
|
973
|
+
return k - 1;
|
|
974
|
+
}
|
|
975
|
+
return 0;
|
|
976
|
+
};
|
|
977
|
+
let q = (u) => u, F = (u) => u;
|
|
978
|
+
const P = function(u, g) {
|
|
979
|
+
let k, p;
|
|
980
|
+
if (g == null && (g = !1), isNaN(u) || u === null)
|
|
981
|
+
return n;
|
|
982
|
+
g ? p = u : f && f.length > 2 ? p = w(u) / (f.length - 2) : d !== h ? p = (u - h) / (d - h) : p = 1, p = F(p), g || (p = q(p)), M !== 1 && (p = _0(p, M)), p = o[0] + p * (1 - o[0] - o[1]), p = X(p, 0, 1);
|
|
983
|
+
const A = Math.floor(p * 1e4);
|
|
984
|
+
if (C && y[A])
|
|
985
|
+
k = y[A];
|
|
986
|
+
else {
|
|
987
|
+
if (x(a) === "array")
|
|
988
|
+
for (let E = 0; E < c.length; E++) {
|
|
989
|
+
const j = c[E];
|
|
990
|
+
if (p <= j) {
|
|
991
|
+
k = a[E];
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
if (p >= j && E === c.length - 1) {
|
|
995
|
+
k = a[E];
|
|
996
|
+
break;
|
|
997
|
+
}
|
|
998
|
+
if (p > j && p < c[E + 1]) {
|
|
999
|
+
p = (p - j) / (c[E + 1] - j), k = _.interpolate(
|
|
1000
|
+
a[E],
|
|
1001
|
+
a[E + 1],
|
|
1002
|
+
p,
|
|
1003
|
+
t
|
|
1004
|
+
);
|
|
1005
|
+
break;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
else
|
|
1009
|
+
x(a) === "function" && (k = a(p));
|
|
1010
|
+
C && (y[A] = k);
|
|
1011
|
+
}
|
|
1012
|
+
return k;
|
|
1013
|
+
};
|
|
1014
|
+
var B = () => y = {};
|
|
1015
|
+
$(e);
|
|
1016
|
+
const v = function(u) {
|
|
1017
|
+
const g = _(P(u));
|
|
1018
|
+
return i && g[i] ? g[i]() : g;
|
|
1019
|
+
};
|
|
1020
|
+
return v.classes = function(u) {
|
|
1021
|
+
if (u != null) {
|
|
1022
|
+
if (x(u) === "array")
|
|
1023
|
+
f = u, s = [u[0], u[u.length - 1]];
|
|
1024
|
+
else {
|
|
1025
|
+
const g = _.analyze(s);
|
|
1026
|
+
u === 0 ? f = [g.min, g.max] : f = _.limits(g, "e", u);
|
|
1027
|
+
}
|
|
1028
|
+
return v;
|
|
1029
|
+
}
|
|
1030
|
+
return f;
|
|
1031
|
+
}, v.domain = function(u) {
|
|
1032
|
+
if (!arguments.length)
|
|
1033
|
+
return s;
|
|
1034
|
+
h = u[0], d = u[u.length - 1], c = [];
|
|
1035
|
+
const g = a.length;
|
|
1036
|
+
if (u.length === g && h !== d)
|
|
1037
|
+
for (let k of Array.from(u))
|
|
1038
|
+
c.push((k - h) / (d - h));
|
|
1039
|
+
else {
|
|
1040
|
+
for (let k = 0; k < g; k++)
|
|
1041
|
+
c.push(k / (g - 1));
|
|
1042
|
+
if (u.length > 2) {
|
|
1043
|
+
const k = u.map((A, E) => E / (u.length - 1)), p = u.map((A) => (A - h) / (d - h));
|
|
1044
|
+
p.every((A, E) => k[E] === A) || (F = (A) => {
|
|
1045
|
+
if (A <= 0 || A >= 1)
|
|
1046
|
+
return A;
|
|
1047
|
+
let E = 0;
|
|
1048
|
+
for (; A >= p[E + 1]; )
|
|
1049
|
+
E++;
|
|
1050
|
+
const j = (A - p[E]) / (p[E + 1] - p[E]);
|
|
1051
|
+
return k[E] + j * (k[E + 1] - k[E]);
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
return s = [h, d], v;
|
|
1056
|
+
}, v.mode = function(u) {
|
|
1057
|
+
return arguments.length ? (t = u, B(), v) : t;
|
|
1058
|
+
}, v.range = function(u, g) {
|
|
1059
|
+
return $(u), v;
|
|
1060
|
+
}, v.out = function(u) {
|
|
1061
|
+
return i = u, v;
|
|
1062
|
+
}, v.spread = function(u) {
|
|
1063
|
+
return arguments.length ? (r = u, v) : r;
|
|
1064
|
+
}, v.correctLightness = function(u) {
|
|
1065
|
+
return u == null && (u = !0), b = u, B(), b ? q = function(g) {
|
|
1066
|
+
const k = P(0, !0).lab()[0], p = P(1, !0).lab()[0], A = k > p;
|
|
1067
|
+
let E = P(g, !0).lab()[0];
|
|
1068
|
+
const j = k + (p - k) * g;
|
|
1069
|
+
let D = E - j, Z = 0, W = 1, Q = 20;
|
|
1070
|
+
for (; Math.abs(D) > 0.01 && Q-- > 0; )
|
|
1071
|
+
(function() {
|
|
1072
|
+
return A && (D *= -1), D < 0 ? (Z = g, g += (W - g) * 0.5) : (W = g, g += (Z - g) * 0.5), E = P(g, !0).lab()[0], D = E - j;
|
|
1073
|
+
})();
|
|
1074
|
+
return g;
|
|
1075
|
+
} : q = (g) => g, v;
|
|
1076
|
+
}, v.padding = function(u) {
|
|
1077
|
+
return u != null ? (x(u) === "number" && (u = [u, u]), o = u, v) : o;
|
|
1078
|
+
}, v.colors = function(u, g) {
|
|
1079
|
+
arguments.length < 2 && (g = "hex");
|
|
1080
|
+
let k = [];
|
|
1081
|
+
if (arguments.length === 0)
|
|
1082
|
+
k = a.slice(0);
|
|
1083
|
+
else if (u === 1)
|
|
1084
|
+
k = [v(0.5)];
|
|
1085
|
+
else if (u > 1) {
|
|
1086
|
+
const p = s[0], A = s[1] - p;
|
|
1087
|
+
k = $0(0, u, !1).map(
|
|
1088
|
+
(E) => v(p + E / (u - 1) * A)
|
|
1089
|
+
);
|
|
1090
|
+
} else {
|
|
1091
|
+
e = [];
|
|
1092
|
+
let p = [];
|
|
1093
|
+
if (f && f.length > 2)
|
|
1094
|
+
for (let A = 1, E = f.length, j = 1 <= E; j ? A < E : A > E; j ? A++ : A--)
|
|
1095
|
+
p.push((f[A - 1] + f[A]) * 0.5);
|
|
1096
|
+
else
|
|
1097
|
+
p = s;
|
|
1098
|
+
k = p.map((A) => v(A));
|
|
1099
|
+
}
|
|
1100
|
+
return _[g] && (k = k.map((p) => p[g]())), k;
|
|
1101
|
+
}, v.cache = function(u) {
|
|
1102
|
+
return u != null ? (C = u, v) : C;
|
|
1103
|
+
}, v.gamma = function(u) {
|
|
1104
|
+
return u != null ? (M = u, v) : M;
|
|
1105
|
+
}, v.nodata = function(u) {
|
|
1106
|
+
return u != null ? (n = _(u), v) : n;
|
|
1107
|
+
}, v;
|
|
1108
|
+
}
|
|
1109
|
+
function $0(e, t, n) {
|
|
1110
|
+
let r = [], s = e < t, c = n ? s ? t + 1 : t - 1 : t;
|
|
1111
|
+
for (let o = e; s ? o < c : o > c; s ? o++ : o--)
|
|
1112
|
+
r.push(o);
|
|
1113
|
+
return r;
|
|
1114
|
+
}
|
|
1115
|
+
const x0 = function(e) {
|
|
1116
|
+
let t = [1, 1];
|
|
1117
|
+
for (let n = 1; n < e; n++) {
|
|
1118
|
+
let r = [1];
|
|
1119
|
+
for (let s = 1; s <= t.length; s++)
|
|
1120
|
+
r[s] = (t[s] || 0) + t[s - 1];
|
|
1121
|
+
t = r;
|
|
1122
|
+
}
|
|
1123
|
+
return t;
|
|
1124
|
+
}, N0 = function(e) {
|
|
1125
|
+
let t, n, r, s;
|
|
1126
|
+
if (e = e.map((c) => new l(c)), e.length === 2)
|
|
1127
|
+
[n, r] = e.map((c) => c.lab()), t = function(c) {
|
|
1128
|
+
const o = [0, 1, 2].map((f) => n[f] + c * (r[f] - n[f]));
|
|
1129
|
+
return new l(o, "lab");
|
|
1130
|
+
};
|
|
1131
|
+
else if (e.length === 3)
|
|
1132
|
+
[n, r, s] = e.map((c) => c.lab()), t = function(c) {
|
|
1133
|
+
const o = [0, 1, 2].map(
|
|
1134
|
+
(f) => (1 - c) * (1 - c) * n[f] + 2 * (1 - c) * c * r[f] + c * c * s[f]
|
|
1135
|
+
);
|
|
1136
|
+
return new l(o, "lab");
|
|
1137
|
+
};
|
|
1138
|
+
else if (e.length === 4) {
|
|
1139
|
+
let c;
|
|
1140
|
+
[n, r, s, c] = e.map((o) => o.lab()), t = function(o) {
|
|
1141
|
+
const f = [0, 1, 2].map(
|
|
1142
|
+
(a) => (1 - o) * (1 - o) * (1 - o) * n[a] + 3 * (1 - o) * (1 - o) * o * r[a] + 3 * (1 - o) * o * o * s[a] + o * o * o * c[a]
|
|
1143
|
+
);
|
|
1144
|
+
return new l(f, "lab");
|
|
1145
|
+
};
|
|
1146
|
+
} else if (e.length >= 5) {
|
|
1147
|
+
let c, o, f;
|
|
1148
|
+
c = e.map((a) => a.lab()), f = e.length - 1, o = x0(f), t = function(a) {
|
|
1149
|
+
const i = 1 - a, h = [0, 1, 2].map(
|
|
1150
|
+
(d) => c.reduce(
|
|
1151
|
+
(b, y, C) => b + o[C] * i ** (f - C) * a ** C * y[d],
|
|
1152
|
+
0
|
|
1153
|
+
)
|
|
1154
|
+
);
|
|
1155
|
+
return new l(h, "lab");
|
|
1156
|
+
};
|
|
1157
|
+
} else
|
|
1158
|
+
throw new RangeError("No point in running bezier with only one color.");
|
|
1159
|
+
return t;
|
|
1160
|
+
}, E0 = (e) => {
|
|
1161
|
+
const t = N0(e);
|
|
1162
|
+
return t.scale = () => ce(t), t;
|
|
1163
|
+
}, L = (e, t, n) => {
|
|
1164
|
+
if (!L[n])
|
|
1165
|
+
throw new Error("unknown blend mode " + n);
|
|
1166
|
+
return L[n](e, t);
|
|
1167
|
+
}, G = (e) => (t, n) => {
|
|
1168
|
+
const r = _(n).rgb(), s = _(t).rgb();
|
|
1169
|
+
return _.rgb(e(r, s));
|
|
1170
|
+
}, I = (e) => (t, n) => {
|
|
1171
|
+
const r = [];
|
|
1172
|
+
return r[0] = e(t[0], n[0]), r[1] = e(t[1], n[1]), r[2] = e(t[2], n[2]), r;
|
|
1173
|
+
}, v0 = (e) => e, C0 = (e, t) => e * t / 255, A0 = (e, t) => e > t ? t : e, M0 = (e, t) => e > t ? e : t, j0 = (e, t) => 255 * (1 - (1 - e / 255) * (1 - t / 255)), T0 = (e, t) => t < 128 ? 2 * e * t / 255 : 255 * (1 - 2 * (1 - e / 255) * (1 - t / 255)), O0 = (e, t) => 255 * (1 - (1 - t / 255) / (e / 255)), R0 = (e, t) => e === 255 ? 255 : (e = 255 * (t / 255) / (1 - e / 255), e > 255 ? 255 : e);
|
|
1174
|
+
L.normal = G(I(v0));
|
|
1175
|
+
L.multiply = G(I(C0));
|
|
1176
|
+
L.screen = G(I(j0));
|
|
1177
|
+
L.overlay = G(I(T0));
|
|
1178
|
+
L.darken = G(I(A0));
|
|
1179
|
+
L.lighten = G(I(M0));
|
|
1180
|
+
L.dodge = G(I(R0));
|
|
1181
|
+
L.burn = G(I(O0));
|
|
1182
|
+
const { pow: P0, sin: B0, cos: L0 } = Math;
|
|
1183
|
+
function z0(e = 300, t = -1.5, n = 1, r = 1, s = [0, 1]) {
|
|
1184
|
+
let c = 0, o;
|
|
1185
|
+
x(s) === "array" ? o = s[1] - s[0] : (o = 0, s = [s, s]);
|
|
1186
|
+
const f = function(a) {
|
|
1187
|
+
const i = S * ((e + 120) / 360 + t * a), h = P0(s[0] + o * a, r), b = (c !== 0 ? n[0] + a * c : n) * h * (1 - h) / 2, y = L0(i), C = B0(i), M = h + b * (-0.14861 * y + 1.78277 * C), $ = h + b * (-0.29227 * y - 0.90649 * C), w = h + b * (1.97294 * y);
|
|
1188
|
+
return _(ve([M * 255, $ * 255, w * 255, 1]));
|
|
1189
|
+
};
|
|
1190
|
+
return f.start = function(a) {
|
|
1191
|
+
return a == null ? e : (e = a, f);
|
|
1192
|
+
}, f.rotations = function(a) {
|
|
1193
|
+
return a == null ? t : (t = a, f);
|
|
1194
|
+
}, f.gamma = function(a) {
|
|
1195
|
+
return a == null ? r : (r = a, f);
|
|
1196
|
+
}, f.hue = function(a) {
|
|
1197
|
+
return a == null ? n : (n = a, x(n) === "array" ? (c = n[1] - n[0], c === 0 && (n = n[1])) : c = 0, f);
|
|
1198
|
+
}, f.lightness = function(a) {
|
|
1199
|
+
return a == null ? s : (x(a) === "array" ? (s = a, o = a[1] - a[0]) : (s = [a, a], o = 0), f);
|
|
1200
|
+
}, f.scale = () => _.scale(f), f.hue(n), f;
|
|
1201
|
+
}
|
|
1202
|
+
const S0 = "0123456789abcdef", { floor: q0, random: F0 } = Math, G0 = () => {
|
|
1203
|
+
let e = "#";
|
|
1204
|
+
for (let t = 0; t < 6; t++)
|
|
1205
|
+
e += S0.charAt(q0(F0() * 16));
|
|
1206
|
+
return new l(e, "hex");
|
|
1207
|
+
}, { log: Be, pow: I0, floor: D0, abs: Y0 } = Math;
|
|
1208
|
+
function lt(e, t = null) {
|
|
1209
|
+
const n = {
|
|
1210
|
+
min: Number.MAX_VALUE,
|
|
1211
|
+
max: Number.MAX_VALUE * -1,
|
|
1212
|
+
sum: 0,
|
|
1213
|
+
values: [],
|
|
1214
|
+
count: 0
|
|
1215
|
+
};
|
|
1216
|
+
return x(e) === "object" && (e = Object.values(e)), e.forEach((r) => {
|
|
1217
|
+
t && x(r) === "object" && (r = r[t]), r != null && !isNaN(r) && (n.values.push(r), n.sum += r, r < n.min && (n.min = r), r > n.max && (n.max = r), n.count += 1);
|
|
1218
|
+
}), n.domain = [n.min, n.max], n.limits = (r, s) => it(n, r, s), n;
|
|
1219
|
+
}
|
|
1220
|
+
function it(e, t = "equal", n = 7) {
|
|
1221
|
+
x(e) == "array" && (e = lt(e));
|
|
1222
|
+
const { min: r, max: s } = e, c = e.values.sort((f, a) => f - a);
|
|
1223
|
+
if (n === 1)
|
|
1224
|
+
return [r, s];
|
|
1225
|
+
const o = [];
|
|
1226
|
+
if (t.substr(0, 1) === "c" && (o.push(r), o.push(s)), t.substr(0, 1) === "e") {
|
|
1227
|
+
o.push(r);
|
|
1228
|
+
for (let f = 1; f < n; f++)
|
|
1229
|
+
o.push(r + f / n * (s - r));
|
|
1230
|
+
o.push(s);
|
|
1231
|
+
} else if (t.substr(0, 1) === "l") {
|
|
1232
|
+
if (r <= 0)
|
|
1233
|
+
throw new Error(
|
|
1234
|
+
"Logarithmic scales are only possible for values > 0"
|
|
1235
|
+
);
|
|
1236
|
+
const f = Math.LOG10E * Be(r), a = Math.LOG10E * Be(s);
|
|
1237
|
+
o.push(r);
|
|
1238
|
+
for (let i = 1; i < n; i++)
|
|
1239
|
+
o.push(I0(10, f + i / n * (a - f)));
|
|
1240
|
+
o.push(s);
|
|
1241
|
+
} else if (t.substr(0, 1) === "q") {
|
|
1242
|
+
o.push(r);
|
|
1243
|
+
for (let f = 1; f < n; f++) {
|
|
1244
|
+
const a = (c.length - 1) * f / n, i = D0(a);
|
|
1245
|
+
if (i === a)
|
|
1246
|
+
o.push(c[i]);
|
|
1247
|
+
else {
|
|
1248
|
+
const h = a - i;
|
|
1249
|
+
o.push(c[i] * (1 - h) + c[i + 1] * h);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
o.push(s);
|
|
1253
|
+
} else if (t.substr(0, 1) === "k") {
|
|
1254
|
+
let f;
|
|
1255
|
+
const a = c.length, i = new Array(a), h = new Array(n);
|
|
1256
|
+
let d = !0, b = 0, y = null;
|
|
1257
|
+
y = [], y.push(r);
|
|
1258
|
+
for (let $ = 1; $ < n; $++)
|
|
1259
|
+
y.push(r + $ / n * (s - r));
|
|
1260
|
+
for (y.push(s); d; ) {
|
|
1261
|
+
for (let w = 0; w < n; w++)
|
|
1262
|
+
h[w] = 0;
|
|
1263
|
+
for (let w = 0; w < a; w++) {
|
|
1264
|
+
const q = c[w];
|
|
1265
|
+
let F = Number.MAX_VALUE, P;
|
|
1266
|
+
for (let B = 0; B < n; B++) {
|
|
1267
|
+
const v = Y0(y[B] - q);
|
|
1268
|
+
v < F && (F = v, P = B), h[P]++, i[w] = P;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
const $ = new Array(n);
|
|
1272
|
+
for (let w = 0; w < n; w++)
|
|
1273
|
+
$[w] = null;
|
|
1274
|
+
for (let w = 0; w < a; w++)
|
|
1275
|
+
f = i[w], $[f] === null ? $[f] = c[w] : $[f] += c[w];
|
|
1276
|
+
for (let w = 0; w < n; w++)
|
|
1277
|
+
$[w] *= 1 / h[w];
|
|
1278
|
+
d = !1;
|
|
1279
|
+
for (let w = 0; w < n; w++)
|
|
1280
|
+
if ($[w] !== y[w]) {
|
|
1281
|
+
d = !0;
|
|
1282
|
+
break;
|
|
1283
|
+
}
|
|
1284
|
+
y = $, b++, b > 200 && (d = !1);
|
|
1285
|
+
}
|
|
1286
|
+
const C = {};
|
|
1287
|
+
for (let $ = 0; $ < n; $++)
|
|
1288
|
+
C[$] = [];
|
|
1289
|
+
for (let $ = 0; $ < a; $++)
|
|
1290
|
+
f = i[$], C[f].push(c[$]);
|
|
1291
|
+
let M = [];
|
|
1292
|
+
for (let $ = 0; $ < n; $++)
|
|
1293
|
+
M.push(C[$][0]), M.push(C[$][C[$].length - 1]);
|
|
1294
|
+
M = M.sort(($, w) => $ - w), o.push(M[0]);
|
|
1295
|
+
for (let $ = 1; $ < M.length; $ += 2) {
|
|
1296
|
+
const w = M[$];
|
|
1297
|
+
!isNaN(w) && o.indexOf(w) === -1 && o.push(w);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
return o;
|
|
1301
|
+
}
|
|
1302
|
+
const H0 = (e, t) => {
|
|
1303
|
+
e = new l(e), t = new l(t);
|
|
1304
|
+
const n = e.luminance(), r = t.luminance();
|
|
1305
|
+
return n > r ? (n + 0.05) / (r + 0.05) : (r + 0.05) / (n + 0.05);
|
|
1306
|
+
}, { sqrt: z, pow: T, min: X0, max: U0, atan2: Le, abs: ze, cos: ne, sin: Se, exp: V0, PI: qe } = Math;
|
|
1307
|
+
function Z0(e, t, n = 1, r = 1, s = 1) {
|
|
1308
|
+
var c = function(ae) {
|
|
1309
|
+
return 360 * ae / (2 * qe);
|
|
1310
|
+
}, o = function(ae) {
|
|
1311
|
+
return 2 * qe * ae / 360;
|
|
1312
|
+
};
|
|
1313
|
+
e = new l(e), t = new l(t);
|
|
1314
|
+
const [f, a, i] = Array.from(e.lab()), [h, d, b] = Array.from(t.lab()), y = (f + h) / 2, C = z(T(a, 2) + T(i, 2)), M = z(T(d, 2) + T(b, 2)), $ = (C + M) / 2, w = 0.5 * (1 - z(T($, 7) / (T($, 7) + T(25, 7)))), q = a * (1 + w), F = d * (1 + w), P = z(T(q, 2) + T(i, 2)), B = z(T(F, 2) + T(b, 2)), v = (P + B) / 2, u = c(Le(i, q)), g = c(Le(b, F)), k = u >= 0 ? u : u + 360, p = g >= 0 ? g : g + 360, A = ze(k - p) > 180 ? (k + p + 360) / 2 : (k + p) / 2, E = 1 - 0.17 * ne(o(A - 30)) + 0.24 * ne(o(2 * A)) + 0.32 * ne(o(3 * A + 6)) - 0.2 * ne(o(4 * A - 63));
|
|
1315
|
+
let j = p - k;
|
|
1316
|
+
j = ze(j) <= 180 ? j : p <= k ? j + 360 : j - 360, j = 2 * z(P * B) * Se(o(j) / 2);
|
|
1317
|
+
const D = h - f, Z = B - P, W = 1 + 0.015 * T(y - 50, 2) / z(20 + T(y - 50, 2)), Q = 1 + 0.045 * v, je = 1 + 0.015 * v * E, pt = 30 * V0(-T((A - 275) / 25, 2)), mt = -(2 * z(T(v, 7) / (T(v, 7) + T(25, 7)))) * Se(2 * o(pt)), yt = z(
|
|
1318
|
+
T(D / (n * W), 2) + T(Z / (r * Q), 2) + T(j / (s * je), 2) + mt * (Z / (r * Q)) * (j / (s * je))
|
|
1319
|
+
);
|
|
1320
|
+
return U0(0, X0(100, yt));
|
|
1321
|
+
}
|
|
1322
|
+
function J0(e, t, n = "lab") {
|
|
1323
|
+
e = new l(e), t = new l(t);
|
|
1324
|
+
const r = e.get(n), s = t.get(n);
|
|
1325
|
+
let c = 0;
|
|
1326
|
+
for (let o in r) {
|
|
1327
|
+
const f = (r[o] || 0) - (s[o] || 0);
|
|
1328
|
+
c += f * f;
|
|
1329
|
+
}
|
|
1330
|
+
return Math.sqrt(c);
|
|
1331
|
+
}
|
|
1332
|
+
const K0 = (...e) => {
|
|
1333
|
+
try {
|
|
1334
|
+
return new l(...e), !0;
|
|
1335
|
+
} catch {
|
|
1336
|
+
return !1;
|
|
1337
|
+
}
|
|
1338
|
+
}, W0 = {
|
|
1339
|
+
cool() {
|
|
1340
|
+
return ce([_.hsl(180, 1, 0.9), _.hsl(250, 0.7, 0.4)]);
|
|
1341
|
+
},
|
|
1342
|
+
hot() {
|
|
1343
|
+
return ce(["#000", "#f00", "#ff0", "#fff"]).mode(
|
|
1344
|
+
"rgb"
|
|
1345
|
+
);
|
|
1346
|
+
}
|
|
1347
|
+
}, se = {
|
|
1348
|
+
// sequential
|
|
1349
|
+
OrRd: ["#fff7ec", "#fee8c8", "#fdd49e", "#fdbb84", "#fc8d59", "#ef6548", "#d7301f", "#b30000", "#7f0000"],
|
|
1350
|
+
PuBu: ["#fff7fb", "#ece7f2", "#d0d1e6", "#a6bddb", "#74a9cf", "#3690c0", "#0570b0", "#045a8d", "#023858"],
|
|
1351
|
+
BuPu: ["#f7fcfd", "#e0ecf4", "#bfd3e6", "#9ebcda", "#8c96c6", "#8c6bb1", "#88419d", "#810f7c", "#4d004b"],
|
|
1352
|
+
Oranges: ["#fff5eb", "#fee6ce", "#fdd0a2", "#fdae6b", "#fd8d3c", "#f16913", "#d94801", "#a63603", "#7f2704"],
|
|
1353
|
+
BuGn: ["#f7fcfd", "#e5f5f9", "#ccece6", "#99d8c9", "#66c2a4", "#41ae76", "#238b45", "#006d2c", "#00441b"],
|
|
1354
|
+
YlOrBr: ["#ffffe5", "#fff7bc", "#fee391", "#fec44f", "#fe9929", "#ec7014", "#cc4c02", "#993404", "#662506"],
|
|
1355
|
+
YlGn: ["#ffffe5", "#f7fcb9", "#d9f0a3", "#addd8e", "#78c679", "#41ab5d", "#238443", "#006837", "#004529"],
|
|
1356
|
+
Reds: ["#fff5f0", "#fee0d2", "#fcbba1", "#fc9272", "#fb6a4a", "#ef3b2c", "#cb181d", "#a50f15", "#67000d"],
|
|
1357
|
+
RdPu: ["#fff7f3", "#fde0dd", "#fcc5c0", "#fa9fb5", "#f768a1", "#dd3497", "#ae017e", "#7a0177", "#49006a"],
|
|
1358
|
+
Greens: ["#f7fcf5", "#e5f5e0", "#c7e9c0", "#a1d99b", "#74c476", "#41ab5d", "#238b45", "#006d2c", "#00441b"],
|
|
1359
|
+
YlGnBu: ["#ffffd9", "#edf8b1", "#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#253494", "#081d58"],
|
|
1360
|
+
Purples: ["#fcfbfd", "#efedf5", "#dadaeb", "#bcbddc", "#9e9ac8", "#807dba", "#6a51a3", "#54278f", "#3f007d"],
|
|
1361
|
+
GnBu: ["#f7fcf0", "#e0f3db", "#ccebc5", "#a8ddb5", "#7bccc4", "#4eb3d3", "#2b8cbe", "#0868ac", "#084081"],
|
|
1362
|
+
Greys: ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525", "#000000"],
|
|
1363
|
+
YlOrRd: ["#ffffcc", "#ffeda0", "#fed976", "#feb24c", "#fd8d3c", "#fc4e2a", "#e31a1c", "#bd0026", "#800026"],
|
|
1364
|
+
PuRd: ["#f7f4f9", "#e7e1ef", "#d4b9da", "#c994c7", "#df65b0", "#e7298a", "#ce1256", "#980043", "#67001f"],
|
|
1365
|
+
Blues: ["#f7fbff", "#deebf7", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#08519c", "#08306b"],
|
|
1366
|
+
PuBuGn: ["#fff7fb", "#ece2f0", "#d0d1e6", "#a6bddb", "#67a9cf", "#3690c0", "#02818a", "#016c59", "#014636"],
|
|
1367
|
+
Viridis: ["#440154", "#482777", "#3f4a8a", "#31678e", "#26838f", "#1f9d8a", "#6cce5a", "#b6de2b", "#fee825"],
|
|
1368
|
+
// diverging
|
|
1369
|
+
Spectral: ["#9e0142", "#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#e6f598", "#abdda4", "#66c2a5", "#3288bd", "#5e4fa2"],
|
|
1370
|
+
RdYlGn: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850", "#006837"],
|
|
1371
|
+
RdBu: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#f7f7f7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac", "#053061"],
|
|
1372
|
+
PiYG: ["#8e0152", "#c51b7d", "#de77ae", "#f1b6da", "#fde0ef", "#f7f7f7", "#e6f5d0", "#b8e186", "#7fbc41", "#4d9221", "#276419"],
|
|
1373
|
+
PRGn: ["#40004b", "#762a83", "#9970ab", "#c2a5cf", "#e7d4e8", "#f7f7f7", "#d9f0d3", "#a6dba0", "#5aae61", "#1b7837", "#00441b"],
|
|
1374
|
+
RdYlBu: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee090", "#ffffbf", "#e0f3f8", "#abd9e9", "#74add1", "#4575b4", "#313695"],
|
|
1375
|
+
BrBG: ["#543005", "#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#f5f5f5", "#c7eae5", "#80cdc1", "#35978f", "#01665e", "#003c30"],
|
|
1376
|
+
RdGy: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#ffffff", "#e0e0e0", "#bababa", "#878787", "#4d4d4d", "#1a1a1a"],
|
|
1377
|
+
PuOr: ["#7f3b08", "#b35806", "#e08214", "#fdb863", "#fee0b6", "#f7f7f7", "#d8daeb", "#b2abd2", "#8073ac", "#542788", "#2d004b"],
|
|
1378
|
+
// qualitative
|
|
1379
|
+
Set2: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f", "#e5c494", "#b3b3b3"],
|
|
1380
|
+
Accent: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17", "#666666"],
|
|
1381
|
+
Set1: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999"],
|
|
1382
|
+
Set3: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5", "#ffed6f"],
|
|
1383
|
+
Dark2: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d", "#666666"],
|
|
1384
|
+
Paired: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928"],
|
|
1385
|
+
Pastel2: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4", "#e6f5c9", "#fff2ae", "#f1e2cc", "#cccccc"],
|
|
1386
|
+
Pastel1: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6", "#ffffcc", "#e5d8bd", "#fddaec", "#f2f2f2"]
|
|
1387
|
+
};
|
|
1388
|
+
for (let e of Object.keys(se))
|
|
1389
|
+
se[e.toLowerCase()] = se[e];
|
|
1390
|
+
Object.assign(_, {
|
|
1391
|
+
average: w0,
|
|
1392
|
+
bezier: E0,
|
|
1393
|
+
blend: L,
|
|
1394
|
+
cubehelix: z0,
|
|
1395
|
+
mix: K,
|
|
1396
|
+
interpolate: K,
|
|
1397
|
+
random: G0,
|
|
1398
|
+
scale: ce,
|
|
1399
|
+
analyze: lt,
|
|
1400
|
+
contrast: H0,
|
|
1401
|
+
deltaE: Z0,
|
|
1402
|
+
distance: J0,
|
|
1403
|
+
limits: it,
|
|
1404
|
+
valid: K0,
|
|
1405
|
+
scales: W0,
|
|
1406
|
+
input: m,
|
|
1407
|
+
colors: U,
|
|
1408
|
+
brewer: se
|
|
1409
|
+
});
|
|
1410
|
+
const dt = [
|
|
1411
|
+
50,
|
|
1412
|
+
100,
|
|
1413
|
+
200,
|
|
1414
|
+
250,
|
|
1415
|
+
300,
|
|
1416
|
+
400,
|
|
1417
|
+
450,
|
|
1418
|
+
500,
|
|
1419
|
+
550,
|
|
1420
|
+
575,
|
|
1421
|
+
600,
|
|
1422
|
+
700,
|
|
1423
|
+
800,
|
|
1424
|
+
900
|
|
1425
|
+
], Q0 = [
|
|
1426
|
+
0.96,
|
|
1427
|
+
// 50
|
|
1428
|
+
0.907,
|
|
1429
|
+
// 100
|
|
1430
|
+
0.805,
|
|
1431
|
+
// 200
|
|
1432
|
+
0.75,
|
|
1433
|
+
// 250
|
|
1434
|
+
0.697,
|
|
1435
|
+
// 300
|
|
1436
|
+
0.605,
|
|
1437
|
+
// 400
|
|
1438
|
+
0.567,
|
|
1439
|
+
// 450
|
|
1440
|
+
0.576,
|
|
1441
|
+
// 500
|
|
1442
|
+
0.529,
|
|
1443
|
+
// 550
|
|
1444
|
+
0.526,
|
|
1445
|
+
// 575
|
|
1446
|
+
0.523,
|
|
1447
|
+
// 600
|
|
1448
|
+
0.41,
|
|
1449
|
+
// 700
|
|
1450
|
+
0.318,
|
|
1451
|
+
// 800
|
|
1452
|
+
0.243
|
|
1453
|
+
// 900
|
|
1454
|
+
], Fe = [
|
|
1455
|
+
0.32,
|
|
1456
|
+
// 50
|
|
1457
|
+
0.16,
|
|
1458
|
+
// 100
|
|
1459
|
+
0.08,
|
|
1460
|
+
// 200
|
|
1461
|
+
0.06,
|
|
1462
|
+
// 250
|
|
1463
|
+
0.04,
|
|
1464
|
+
// 300
|
|
1465
|
+
0.02,
|
|
1466
|
+
// 400
|
|
1467
|
+
0,
|
|
1468
|
+
// 450
|
|
1469
|
+
0,
|
|
1470
|
+
// 500
|
|
1471
|
+
0.04,
|
|
1472
|
+
// 550
|
|
1473
|
+
0.06,
|
|
1474
|
+
// 575
|
|
1475
|
+
0.08,
|
|
1476
|
+
// 600
|
|
1477
|
+
0.16,
|
|
1478
|
+
// 700
|
|
1479
|
+
0.24,
|
|
1480
|
+
// 800
|
|
1481
|
+
0.32
|
|
1482
|
+
// 900
|
|
1483
|
+
], Ge = dt.indexOf(500);
|
|
1484
|
+
function en(e) {
|
|
1485
|
+
let t = e.replace("#", "");
|
|
1486
|
+
t.length === 3 && (t = t.split("").map((r) => r + r).join(""));
|
|
1487
|
+
const n = parseInt(t, 16);
|
|
1488
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
1489
|
+
}
|
|
1490
|
+
function tn(e) {
|
|
1491
|
+
const t = e;
|
|
1492
|
+
typeof t.clamp == "function" ? e = t.clamp() : typeof t.clip == "function" && (e = t.clip());
|
|
1493
|
+
const [n, r, s] = en(e.hex());
|
|
1494
|
+
return `${n} ${r} ${s}`;
|
|
1495
|
+
}
|
|
1496
|
+
function nn(e) {
|
|
1497
|
+
const t = _(e);
|
|
1498
|
+
return dt.reduce((n, r, s) => {
|
|
1499
|
+
let c = t;
|
|
1500
|
+
if (s !== Ge) {
|
|
1501
|
+
c = c.set("hsl.l", Q0[s]);
|
|
1502
|
+
const o = Fe[s] - Fe[Ge];
|
|
1503
|
+
c = o >= 0 ? c.saturate(o) : c.desaturate(-o);
|
|
1504
|
+
}
|
|
1505
|
+
return n[r] = tn(c), n;
|
|
1506
|
+
}, {});
|
|
1507
|
+
}
|
|
1508
|
+
const rn = {
|
|
1509
|
+
primary: {
|
|
1510
|
+
50: "240 247 255",
|
|
1511
|
+
// #F0F7FF
|
|
1512
|
+
100: "189 211 254",
|
|
1513
|
+
// #BDD3FE
|
|
1514
|
+
200: "157 189 254",
|
|
1515
|
+
// #9DBDFE
|
|
1516
|
+
250: "134 166 254",
|
|
1517
|
+
// #83B8FE
|
|
1518
|
+
300: "112 159 253",
|
|
1519
|
+
// #709FFD
|
|
1520
|
+
400: "85 141 253",
|
|
1521
|
+
// #558DFD
|
|
1522
|
+
450: "34 148 255",
|
|
1523
|
+
// #2294FF
|
|
1524
|
+
500: "42 112 252",
|
|
1525
|
+
// #2A70FC
|
|
1526
|
+
550: "37 102 233",
|
|
1527
|
+
// #2566E9
|
|
1528
|
+
575: "36 92 220",
|
|
1529
|
+
// #2458DC
|
|
1530
|
+
600: "38 102 229",
|
|
1531
|
+
// #2666E5
|
|
1532
|
+
700: "30 80 179",
|
|
1533
|
+
// #1E50B3
|
|
1534
|
+
800: "23 62 139",
|
|
1535
|
+
// #173E8B
|
|
1536
|
+
900: "18 47 106"
|
|
1537
|
+
// #122F6A
|
|
1538
|
+
},
|
|
1539
|
+
secondary: {
|
|
1540
|
+
50: "251 252 252",
|
|
1541
|
+
// #FBFCFC
|
|
1542
|
+
100: "248 248 248",
|
|
1543
|
+
// #F8F8F8
|
|
1544
|
+
200: "236 238 245",
|
|
1545
|
+
// #ECEEF5
|
|
1546
|
+
250: "236 236 236",
|
|
1547
|
+
// #ECECEC
|
|
1548
|
+
300: "134 134 134",
|
|
1549
|
+
// #868686
|
|
1550
|
+
400: "110 110 110",
|
|
1551
|
+
// #6E6E6E
|
|
1552
|
+
450: "96 96 96",
|
|
1553
|
+
// #606060
|
|
1554
|
+
500: "74 74 74",
|
|
1555
|
+
// #4A4A4A
|
|
1556
|
+
550: "58 69 87",
|
|
1557
|
+
// #3A4557
|
|
1558
|
+
575: "60 69 73",
|
|
1559
|
+
// #3C4549
|
|
1560
|
+
600: "67 67 67",
|
|
1561
|
+
// #434343
|
|
1562
|
+
700: "53 53 53",
|
|
1563
|
+
// #353535
|
|
1564
|
+
800: "41 41 41",
|
|
1565
|
+
// #292929
|
|
1566
|
+
900: "31 31 31"
|
|
1567
|
+
// #1F1F1F
|
|
1568
|
+
},
|
|
1569
|
+
success: {
|
|
1570
|
+
50: "238 249 243",
|
|
1571
|
+
// #EEF9F3
|
|
1572
|
+
100: "203 236 218",
|
|
1573
|
+
// #CBECDA
|
|
1574
|
+
200: "177 227 200",
|
|
1575
|
+
// #B1E3C8
|
|
1576
|
+
250: "160 221 188",
|
|
1577
|
+
// #A0DDBC
|
|
1578
|
+
300: "142 214 175",
|
|
1579
|
+
// #8ED6AF
|
|
1580
|
+
400: "120 206 160",
|
|
1581
|
+
// #78CEA0
|
|
1582
|
+
450: "103 200 148",
|
|
1583
|
+
// #67C894
|
|
1584
|
+
500: "86 194 136",
|
|
1585
|
+
// #56C288
|
|
1586
|
+
550: "82 186 130",
|
|
1587
|
+
// #52BA82
|
|
1588
|
+
575: "80 182 127",
|
|
1589
|
+
// #50B67F
|
|
1590
|
+
600: "78 177 124",
|
|
1591
|
+
// #4EB17C
|
|
1592
|
+
700: "61 138 97",
|
|
1593
|
+
// #3D8A61
|
|
1594
|
+
800: "47 107 75",
|
|
1595
|
+
// #2F6B4B
|
|
1596
|
+
900: "36 81 57"
|
|
1597
|
+
// #245139
|
|
1598
|
+
},
|
|
1599
|
+
warning: {
|
|
1600
|
+
50: "255 244 234",
|
|
1601
|
+
/* #FFF4EA */
|
|
1602
|
+
100: "255 221 189",
|
|
1603
|
+
/* #FFDDBD */
|
|
1604
|
+
200: "255 205 157",
|
|
1605
|
+
/* #FFCD9D */
|
|
1606
|
+
250: "255 194 135",
|
|
1607
|
+
/* #FFC287 */
|
|
1608
|
+
300: "255 182 113",
|
|
1609
|
+
/* #FFB671 */
|
|
1610
|
+
400: "255 168 85",
|
|
1611
|
+
/* #FFA855 */
|
|
1612
|
+
450: "255 157 64",
|
|
1613
|
+
/* #FF9D40 */
|
|
1614
|
+
500: "255 146 43",
|
|
1615
|
+
/* #FF922B */
|
|
1616
|
+
550: "244 140 41",
|
|
1617
|
+
/* #F48C29 */
|
|
1618
|
+
575: "238 136 40",
|
|
1619
|
+
/* #EE8828 */
|
|
1620
|
+
600: "232 133 39",
|
|
1621
|
+
/* #E88527 */
|
|
1622
|
+
700: "181 104 31",
|
|
1623
|
+
/* #B5681F */
|
|
1624
|
+
800: "140 80 24",
|
|
1625
|
+
/* #8C5018 */
|
|
1626
|
+
900: "107 61 18"
|
|
1627
|
+
/* #6B3D12 */
|
|
1628
|
+
},
|
|
1629
|
+
danger: {
|
|
1630
|
+
50: "254 232 237",
|
|
1631
|
+
// #FEE8ED
|
|
1632
|
+
100: "252 182 200",
|
|
1633
|
+
// #FCB6C8
|
|
1634
|
+
200: "250 147 173",
|
|
1635
|
+
// #FA93AD
|
|
1636
|
+
250: "248 98 135",
|
|
1637
|
+
// #F86287
|
|
1638
|
+
300: "248 98 135",
|
|
1639
|
+
// #F86287
|
|
1640
|
+
400: "247 67 112",
|
|
1641
|
+
// #F74370
|
|
1642
|
+
450: "246 44 94",
|
|
1643
|
+
// #F62C5E
|
|
1644
|
+
500: "245 20 76",
|
|
1645
|
+
// #F5144C
|
|
1646
|
+
550: "223 18 69",
|
|
1647
|
+
// #DF1245
|
|
1648
|
+
575: "208 16 63",
|
|
1649
|
+
// #D0103F
|
|
1650
|
+
600: "223 18 69",
|
|
1651
|
+
// #DF1245
|
|
1652
|
+
700: "174 14 54",
|
|
1653
|
+
// #AE0E36
|
|
1654
|
+
800: "135 11 42",
|
|
1655
|
+
// #870B2A
|
|
1656
|
+
900: "103 8 32"
|
|
1657
|
+
// #670820
|
|
1658
|
+
},
|
|
1659
|
+
info: {
|
|
1660
|
+
50: "240 247 255",
|
|
1661
|
+
// #F0F7FF
|
|
1662
|
+
100: "189 211 254",
|
|
1663
|
+
// #BDD3FE
|
|
1664
|
+
200: "157 189 254",
|
|
1665
|
+
// #9DBDFE
|
|
1666
|
+
250: "134 166 254",
|
|
1667
|
+
// #83B8FE
|
|
1668
|
+
300: "112 159 253",
|
|
1669
|
+
// #709FFD
|
|
1670
|
+
400: "85 141 253",
|
|
1671
|
+
// #558DFD
|
|
1672
|
+
450: "34 148 255",
|
|
1673
|
+
// #2294FF
|
|
1674
|
+
500: "42 112 252",
|
|
1675
|
+
// #2A70FC
|
|
1676
|
+
550: "37 102 233",
|
|
1677
|
+
// #2566E9
|
|
1678
|
+
575: "36 92 220",
|
|
1679
|
+
// #2458DC
|
|
1680
|
+
600: "38 102 229",
|
|
1681
|
+
// #2666E5
|
|
1682
|
+
700: "30 80 179",
|
|
1683
|
+
// #1E50B3
|
|
1684
|
+
800: "23 62 139",
|
|
1685
|
+
// #173E8B
|
|
1686
|
+
900: "18 47 106"
|
|
1687
|
+
// #122F6A
|
|
1688
|
+
},
|
|
1689
|
+
// Legacy colors - using appropriate defaults
|
|
1690
|
+
green: {
|
|
1691
|
+
50: "238 249 243",
|
|
1692
|
+
// Same as success
|
|
1693
|
+
100: "203 236 218",
|
|
1694
|
+
200: "177 227 200",
|
|
1695
|
+
250: "160 221 188",
|
|
1696
|
+
300: "142 214 175",
|
|
1697
|
+
400: "120 206 160",
|
|
1698
|
+
450: "103 200 148",
|
|
1699
|
+
500: "86 194 136",
|
|
1700
|
+
550: "82 186 130",
|
|
1701
|
+
575: "80 182 127",
|
|
1702
|
+
600: "78 177 124",
|
|
1703
|
+
700: "61 138 97",
|
|
1704
|
+
800: "47 107 75",
|
|
1705
|
+
900: "36 81 57"
|
|
1706
|
+
},
|
|
1707
|
+
yellow: {
|
|
1708
|
+
50: "255 249 238",
|
|
1709
|
+
// Same as warning
|
|
1710
|
+
100: "255 237 202",
|
|
1711
|
+
200: "255 228 177",
|
|
1712
|
+
250: "255 216 141",
|
|
1713
|
+
300: "255 216 141",
|
|
1714
|
+
400: "255 209 119",
|
|
1715
|
+
450: "255 197 85",
|
|
1716
|
+
500: "255 197 85",
|
|
1717
|
+
550: "232 179 77",
|
|
1718
|
+
575: "224 172 74",
|
|
1719
|
+
600: "232 179 77",
|
|
1720
|
+
700: "181 140 60",
|
|
1721
|
+
800: "140 108 47",
|
|
1722
|
+
900: "107 83 36"
|
|
1723
|
+
},
|
|
1724
|
+
orange: {
|
|
1725
|
+
50: "255 247 237",
|
|
1726
|
+
// Orange palette
|
|
1727
|
+
100: "255 237 213",
|
|
1728
|
+
200: "254 215 170",
|
|
1729
|
+
250: "253 186 116",
|
|
1730
|
+
300: "251 146 60",
|
|
1731
|
+
400: "249 115 22",
|
|
1732
|
+
450: "234 88 12",
|
|
1733
|
+
500: "194 65 12",
|
|
1734
|
+
550: "154 52 18",
|
|
1735
|
+
575: "124 45 18",
|
|
1736
|
+
600: "154 52 18",
|
|
1737
|
+
700: "124 45 18",
|
|
1738
|
+
800: "154 52 18",
|
|
1739
|
+
900: "67 20 7"
|
|
1740
|
+
},
|
|
1741
|
+
red: {
|
|
1742
|
+
50: "254 232 237",
|
|
1743
|
+
// Same as danger
|
|
1744
|
+
100: "252 182 200",
|
|
1745
|
+
200: "250 147 173",
|
|
1746
|
+
250: "248 98 135",
|
|
1747
|
+
300: "248 98 135",
|
|
1748
|
+
400: "247 67 112",
|
|
1749
|
+
450: "246 44 94",
|
|
1750
|
+
500: "245 20 76",
|
|
1751
|
+
550: "223 18 69",
|
|
1752
|
+
575: "208 16 63",
|
|
1753
|
+
600: "223 18 69",
|
|
1754
|
+
700: "174 14 54",
|
|
1755
|
+
800: "135 11 42",
|
|
1756
|
+
900: "103 8 32"
|
|
1757
|
+
}
|
|
1758
|
+
}, bt = {
|
|
1759
|
+
primary: "#2a70fc",
|
|
1760
|
+
secondary: "#6b7280",
|
|
1761
|
+
success: "#56c288",
|
|
1762
|
+
// matches green-500 from style.css
|
|
1763
|
+
warning: "#ff922b",
|
|
1764
|
+
// matches yellow-500 from style.css
|
|
1765
|
+
danger: "#f5144c",
|
|
1766
|
+
// matches red-500 from style.css
|
|
1767
|
+
info: "#3b82f6"
|
|
1768
|
+
};
|
|
1769
|
+
function ht(e) {
|
|
1770
|
+
const {
|
|
1771
|
+
primary: t = "default",
|
|
1772
|
+
secondary: n = "default",
|
|
1773
|
+
success: r = "default",
|
|
1774
|
+
warning: s = "default",
|
|
1775
|
+
danger: c = "default",
|
|
1776
|
+
info: o = "default",
|
|
1777
|
+
// Legacy color support
|
|
1778
|
+
green: f = "default",
|
|
1779
|
+
yellow: a = "default",
|
|
1780
|
+
orange: i = "default",
|
|
1781
|
+
red: h = "default"
|
|
1782
|
+
} = e, d = (y, C) => y === "default" ? rn[C] : nn(y), b = {
|
|
1783
|
+
primary: d(t, "primary"),
|
|
1784
|
+
secondary: d(n, "secondary"),
|
|
1785
|
+
success: d(r, "success"),
|
|
1786
|
+
warning: d(s, "warning"),
|
|
1787
|
+
danger: d(c, "danger"),
|
|
1788
|
+
info: d(o, "info")
|
|
1789
|
+
};
|
|
1790
|
+
return f !== r && (b.green = d(f, "green")), a !== s && (b.yellow = d(a, "yellow")), i && (b.orange = d(i, "orange")), h !== c && (b.red = d(h, "red")), b;
|
|
1791
|
+
}
|
|
1792
|
+
function gn(e) {
|
|
1793
|
+
const t = [];
|
|
1794
|
+
Object.keys(e).forEach((s) => {
|
|
1795
|
+
const c = e[s];
|
|
1796
|
+
c && Object.entries(c).forEach(([o, f]) => {
|
|
1797
|
+
t.push(` --cstu-${s}-${o}: ${f};`);
|
|
1798
|
+
});
|
|
1799
|
+
});
|
|
1800
|
+
const n = `:root {
|
|
1801
|
+
${t.join(`
|
|
1802
|
+
`)}
|
|
1803
|
+
}`;
|
|
1804
|
+
let r = document.getElementById("cstu-theme-vars");
|
|
1805
|
+
r || (r = document.createElement("style"), r.id = "cstu-theme-vars", document.head.appendChild(r)), r.textContent = n;
|
|
1806
|
+
}
|
|
1807
|
+
function sn(e) {
|
|
1808
|
+
return /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e);
|
|
1809
|
+
}
|
|
1810
|
+
function pn(e) {
|
|
1811
|
+
const t = [];
|
|
1812
|
+
return Object.entries(e).forEach(([n, r]) => {
|
|
1813
|
+
r && !sn(r) && t.push(`Invalid hex color for ${n}: ${r}`);
|
|
1814
|
+
}), {
|
|
1815
|
+
valid: t.length === 0,
|
|
1816
|
+
errors: t
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
function cn(e, t) {
|
|
1820
|
+
const n = { ...e };
|
|
1821
|
+
return Object.entries(t).forEach(([r, s]) => {
|
|
1822
|
+
s !== void 0 && (n[r] = s);
|
|
1823
|
+
}), n;
|
|
1824
|
+
}
|
|
1825
|
+
function on(e) {
|
|
1826
|
+
return cn(bt, e);
|
|
1827
|
+
}
|
|
1828
|
+
function J(e, t) {
|
|
1829
|
+
return {
|
|
1830
|
+
name: e,
|
|
1831
|
+
theme: on(t),
|
|
1832
|
+
metadata: {
|
|
1833
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1834
|
+
version: "1.0.0"
|
|
1835
|
+
}
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
const gt = {
|
|
1839
|
+
default: J("Default", bt),
|
|
1840
|
+
purple: J("Purple", {
|
|
1841
|
+
primary: "#8B5CF6",
|
|
1842
|
+
secondary: "#6B7280",
|
|
1843
|
+
success: "#10B981",
|
|
1844
|
+
warning: "#F59E0B",
|
|
1845
|
+
danger: "#EF4444",
|
|
1846
|
+
info: "#3B82F6"
|
|
1847
|
+
}),
|
|
1848
|
+
emerald: J("Emerald", {
|
|
1849
|
+
primary: "#10B981",
|
|
1850
|
+
secondary: "#6B7280",
|
|
1851
|
+
success: "#059669",
|
|
1852
|
+
warning: "#D97706",
|
|
1853
|
+
danger: "#DC2626",
|
|
1854
|
+
info: "#0891B2"
|
|
1855
|
+
}),
|
|
1856
|
+
rose: J("Rose", {
|
|
1857
|
+
primary: "#F43F5E",
|
|
1858
|
+
secondary: "#6B7280",
|
|
1859
|
+
success: "#10B981",
|
|
1860
|
+
warning: "#F59E0B",
|
|
1861
|
+
danger: "#EF4444",
|
|
1862
|
+
info: "#3B82F6"
|
|
1863
|
+
}),
|
|
1864
|
+
amber: J("Amber", {
|
|
1865
|
+
primary: "#F59E0B",
|
|
1866
|
+
secondary: "#6B7280",
|
|
1867
|
+
success: "#10B981",
|
|
1868
|
+
warning: "#D97706",
|
|
1869
|
+
danger: "#EF4444",
|
|
1870
|
+
info: "#3B82F6"
|
|
1871
|
+
})
|
|
1872
|
+
};
|
|
1873
|
+
function mn(e) {
|
|
1874
|
+
return gt[e] || null;
|
|
1875
|
+
}
|
|
1876
|
+
function yn() {
|
|
1877
|
+
return Object.values(gt);
|
|
1878
|
+
}
|
|
1879
|
+
function wn(e) {
|
|
1880
|
+
const t = [], n = [];
|
|
1881
|
+
return Object.entries(e).forEach(([r, s]) => {
|
|
1882
|
+
s && typeof s == "string" && (fn(s) || t.push(`Invalid hex color for ${r}: ${s}`));
|
|
1883
|
+
}), e.primary && e.secondary, {
|
|
1884
|
+
isValid: t.length === 0,
|
|
1885
|
+
errors: t,
|
|
1886
|
+
warnings: n
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
function fn(e) {
|
|
1890
|
+
return /^#([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(e);
|
|
1891
|
+
}
|
|
1892
|
+
function an(e) {
|
|
1893
|
+
const t = ht(e);
|
|
1894
|
+
return {
|
|
1895
|
+
colors: un(t),
|
|
1896
|
+
safelist: ln(t),
|
|
1897
|
+
plugins: dn()
|
|
1898
|
+
};
|
|
1899
|
+
}
|
|
1900
|
+
function un(e) {
|
|
1901
|
+
const t = {};
|
|
1902
|
+
return Object.entries(e).forEach(([n, r]) => {
|
|
1903
|
+
t[n] = {}, Object.entries(r).forEach(([s, c]) => {
|
|
1904
|
+
t[n][s] = `rgb(${c} / <alpha-value>)`;
|
|
1905
|
+
});
|
|
1906
|
+
}), t;
|
|
1907
|
+
}
|
|
1908
|
+
function kn() {
|
|
1909
|
+
const e = (t) => `rgb(var(${t}) / <alpha-value>)`;
|
|
1910
|
+
return {
|
|
1911
|
+
// === SEMANTIC COLORS ===
|
|
1912
|
+
"cstu-primary": {
|
|
1913
|
+
50: e("--cstu-primary-50"),
|
|
1914
|
+
100: e("--cstu-primary-100"),
|
|
1915
|
+
200: e("--cstu-primary-200"),
|
|
1916
|
+
300: e("--cstu-primary-300"),
|
|
1917
|
+
400: e("--cstu-primary-400"),
|
|
1918
|
+
450: e("--cstu-primary-450"),
|
|
1919
|
+
500: e("--cstu-primary-500"),
|
|
1920
|
+
550: e("--cstu-primary-550"),
|
|
1921
|
+
600: e("--cstu-primary-600"),
|
|
1922
|
+
700: e("--cstu-primary-700"),
|
|
1923
|
+
800: e("--cstu-primary-800"),
|
|
1924
|
+
900: e("--cstu-primary-900")
|
|
1925
|
+
},
|
|
1926
|
+
"cstu-secondary": {
|
|
1927
|
+
50: e("--cstu-secondary-50"),
|
|
1928
|
+
100: e("--cstu-secondary-100"),
|
|
1929
|
+
200: e("--cstu-secondary-200"),
|
|
1930
|
+
250: e("--cstu-secondary-250"),
|
|
1931
|
+
300: e("--cstu-secondary-300"),
|
|
1932
|
+
400: e("--cstu-secondary-400"),
|
|
1933
|
+
500: e("--cstu-secondary-500"),
|
|
1934
|
+
550: e("--cstu-secondary-550"),
|
|
1935
|
+
575: e("--cstu-secondary-575"),
|
|
1936
|
+
600: e("--cstu-secondary-600"),
|
|
1937
|
+
700: e("--cstu-secondary-700"),
|
|
1938
|
+
800: e("--cstu-secondary-800"),
|
|
1939
|
+
900: e("--cstu-secondary-900")
|
|
1940
|
+
},
|
|
1941
|
+
"cstu-success": {
|
|
1942
|
+
50: e("--cstu-success-50"),
|
|
1943
|
+
100: e("--cstu-success-100"),
|
|
1944
|
+
200: e("--cstu-success-200"),
|
|
1945
|
+
250: e("--cstu-success-250"),
|
|
1946
|
+
300: e("--cstu-success-300"),
|
|
1947
|
+
400: e("--cstu-success-400"),
|
|
1948
|
+
450: e("--cstu-success-450"),
|
|
1949
|
+
500: e("--cstu-success-500"),
|
|
1950
|
+
550: e("--cstu-success-550"),
|
|
1951
|
+
575: e("--cstu-success-575"),
|
|
1952
|
+
600: e("--cstu-success-600"),
|
|
1953
|
+
700: e("--cstu-success-700"),
|
|
1954
|
+
800: e("--cstu-success-800"),
|
|
1955
|
+
900: e("--cstu-success-900")
|
|
1956
|
+
},
|
|
1957
|
+
"cstu-warning": {
|
|
1958
|
+
50: e("--cstu-warning-50"),
|
|
1959
|
+
100: e("--cstu-warning-100"),
|
|
1960
|
+
200: e("--cstu-warning-200"),
|
|
1961
|
+
250: e("--cstu-warning-250"),
|
|
1962
|
+
300: e("--cstu-warning-300"),
|
|
1963
|
+
400: e("--cstu-warning-400"),
|
|
1964
|
+
450: e("--cstu-warning-450"),
|
|
1965
|
+
500: e("--cstu-warning-500"),
|
|
1966
|
+
550: e("--cstu-warning-550"),
|
|
1967
|
+
575: e("--cstu-warning-575"),
|
|
1968
|
+
600: e("--cstu-warning-600"),
|
|
1969
|
+
700: e("--cstu-warning-700"),
|
|
1970
|
+
800: e("--cstu-warning-800"),
|
|
1971
|
+
900: e("--cstu-warning-900")
|
|
1972
|
+
},
|
|
1973
|
+
"cstu-danger": {
|
|
1974
|
+
50: e("--cstu-danger-50"),
|
|
1975
|
+
100: e("--cstu-danger-100"),
|
|
1976
|
+
200: e("--cstu-danger-200"),
|
|
1977
|
+
250: e("--cstu-danger-250"),
|
|
1978
|
+
300: e("--cstu-danger-300"),
|
|
1979
|
+
400: e("--cstu-danger-400"),
|
|
1980
|
+
450: e("--cstu-danger-450"),
|
|
1981
|
+
500: e("--cstu-danger-500"),
|
|
1982
|
+
550: e("--cstu-danger-550"),
|
|
1983
|
+
575: e("--cstu-danger-575"),
|
|
1984
|
+
600: e("--cstu-danger-600"),
|
|
1985
|
+
700: e("--cstu-danger-700"),
|
|
1986
|
+
800: e("--cstu-danger-800"),
|
|
1987
|
+
900: e("--cstu-danger-900")
|
|
1988
|
+
},
|
|
1989
|
+
"cstu-info": {
|
|
1990
|
+
50: e("--cstu-info-50"),
|
|
1991
|
+
100: e("--cstu-info-100"),
|
|
1992
|
+
200: e("--cstu-info-200"),
|
|
1993
|
+
250: e("--cstu-info-250"),
|
|
1994
|
+
300: e("--cstu-info-300"),
|
|
1995
|
+
400: e("--cstu-info-400"),
|
|
1996
|
+
450: e("--cstu-info-450"),
|
|
1997
|
+
500: e("--cstu-info-500"),
|
|
1998
|
+
550: e("--cstu-info-550"),
|
|
1999
|
+
575: e("--cstu-info-575"),
|
|
2000
|
+
600: e("--cstu-info-600"),
|
|
2001
|
+
700: e("--cstu-info-700"),
|
|
2002
|
+
800: e("--cstu-info-800"),
|
|
2003
|
+
900: e("--cstu-info-900")
|
|
2004
|
+
},
|
|
2005
|
+
// === LEGACY COLORS ===
|
|
2006
|
+
"cstu-blue": {
|
|
2007
|
+
50: e("--cstu-blue-50"),
|
|
2008
|
+
100: e("--cstu-blue-100"),
|
|
2009
|
+
200: e("--cstu-blue-200"),
|
|
2010
|
+
300: e("--cstu-blue-300"),
|
|
2011
|
+
400: e("--cstu-blue-400"),
|
|
2012
|
+
450: e("--cstu-blue-450"),
|
|
2013
|
+
500: e("--cstu-blue-500"),
|
|
2014
|
+
550: e("--cstu-blue-550"),
|
|
2015
|
+
600: e("--cstu-blue-600"),
|
|
2016
|
+
700: e("--cstu-blue-700"),
|
|
2017
|
+
800: e("--cstu-blue-800"),
|
|
2018
|
+
900: e("--cstu-blue-900")
|
|
2019
|
+
},
|
|
2020
|
+
"cstu-gray": {
|
|
2021
|
+
50: e("--cstu-gray-50"),
|
|
2022
|
+
100: e("--cstu-gray-100"),
|
|
2023
|
+
200: e("--cstu-gray-200"),
|
|
2024
|
+
250: e("--cstu-gray-250"),
|
|
2025
|
+
300: e("--cstu-gray-300"),
|
|
2026
|
+
400: e("--cstu-gray-400"),
|
|
2027
|
+
500: e("--cstu-gray-500"),
|
|
2028
|
+
550: e("--cstu-gray-550"),
|
|
2029
|
+
575: e("--cstu-gray-575"),
|
|
2030
|
+
600: e("--cstu-gray-600"),
|
|
2031
|
+
700: e("--cstu-gray-700"),
|
|
2032
|
+
800: e("--cstu-gray-800"),
|
|
2033
|
+
900: e("--cstu-gray-900")
|
|
2034
|
+
},
|
|
2035
|
+
"cstu-sea-blue": {
|
|
2036
|
+
50: e("--cstu-sea-blue-50"),
|
|
2037
|
+
100: e("--cstu-sea-blue-100"),
|
|
2038
|
+
200: e("--cstu-sea-blue-200"),
|
|
2039
|
+
300: e("--cstu-sea-blue-300"),
|
|
2040
|
+
400: e("--cstu-sea-blue-400"),
|
|
2041
|
+
500: e("--cstu-sea-blue-500"),
|
|
2042
|
+
600: e("--cstu-sea-blue-600"),
|
|
2043
|
+
700: e("--cstu-sea-blue-700"),
|
|
2044
|
+
800: e("--cstu-sea-blue-800"),
|
|
2045
|
+
900: e("--cstu-sea-blue-900")
|
|
2046
|
+
},
|
|
2047
|
+
"cstu-purple": {
|
|
2048
|
+
50: e("--cstu-purple-50"),
|
|
2049
|
+
100: e("--cstu-purple-100"),
|
|
2050
|
+
200: e("--cstu-purple-200"),
|
|
2051
|
+
300: e("--cstu-purple-300"),
|
|
2052
|
+
400: e("--cstu-purple-400"),
|
|
2053
|
+
500: e("--cstu-purple-500"),
|
|
2054
|
+
600: e("--cstu-purple-600"),
|
|
2055
|
+
700: e("--cstu-purple-700"),
|
|
2056
|
+
800: e("--cstu-purple-800"),
|
|
2057
|
+
900: e("--cstu-purple-900")
|
|
2058
|
+
},
|
|
2059
|
+
"cstu-green": {
|
|
2060
|
+
50: e("--cstu-green-50"),
|
|
2061
|
+
100: e("--cstu-green-100"),
|
|
2062
|
+
200: e("--cstu-green-200"),
|
|
2063
|
+
300: e("--cstu-green-300"),
|
|
2064
|
+
400: e("--cstu-green-400"),
|
|
2065
|
+
500: e("--cstu-green-500"),
|
|
2066
|
+
600: e("--cstu-green-600"),
|
|
2067
|
+
700: e("--cstu-green-700"),
|
|
2068
|
+
800: e("--cstu-green-800"),
|
|
2069
|
+
900: e("--cstu-green-900")
|
|
2070
|
+
},
|
|
2071
|
+
"cstu-yellow": {
|
|
2072
|
+
50: e("--cstu-yellow-50"),
|
|
2073
|
+
100: e("--cstu-yellow-100"),
|
|
2074
|
+
200: e("--cstu-yellow-200"),
|
|
2075
|
+
300: e("--cstu-yellow-300"),
|
|
2076
|
+
400: e("--cstu-yellow-400"),
|
|
2077
|
+
500: e("--cstu-yellow-500"),
|
|
2078
|
+
600: e("--cstu-yellow-600"),
|
|
2079
|
+
700: e("--cstu-yellow-700"),
|
|
2080
|
+
800: e("--cstu-yellow-800"),
|
|
2081
|
+
900: e("--cstu-yellow-900")
|
|
2082
|
+
},
|
|
2083
|
+
"cstu-orange": {
|
|
2084
|
+
50: e("--cstu-orange-50"),
|
|
2085
|
+
100: e("--cstu-orange-100"),
|
|
2086
|
+
200: e("--cstu-orange-200"),
|
|
2087
|
+
300: e("--cstu-orange-300"),
|
|
2088
|
+
400: e("--cstu-orange-400"),
|
|
2089
|
+
500: e("--cstu-orange-500"),
|
|
2090
|
+
600: e("--cstu-orange-600"),
|
|
2091
|
+
700: e("--cstu-orange-700"),
|
|
2092
|
+
800: e("--cstu-orange-800"),
|
|
2093
|
+
900: e("--cstu-orange-900")
|
|
2094
|
+
},
|
|
2095
|
+
"cstu-red": {
|
|
2096
|
+
50: e("--cstu-red-50"),
|
|
2097
|
+
100: e("--cstu-red-100"),
|
|
2098
|
+
200: e("--cstu-red-200"),
|
|
2099
|
+
300: e("--cstu-red-300"),
|
|
2100
|
+
400: e("--cstu-red-400"),
|
|
2101
|
+
500: e("--cstu-red-500"),
|
|
2102
|
+
600: e("--cstu-red-600"),
|
|
2103
|
+
700: e("--cstu-red-700"),
|
|
2104
|
+
800: e("--cstu-red-800"),
|
|
2105
|
+
900: e("--cstu-red-900")
|
|
2106
|
+
}
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
function ln(e) {
|
|
2110
|
+
const t = [], n = Object.keys(e), r = n[0], s = Object.keys(e[r] || {}), c = [
|
|
2111
|
+
"bg",
|
|
2112
|
+
"text",
|
|
2113
|
+
"border",
|
|
2114
|
+
"ring",
|
|
2115
|
+
"shadow",
|
|
2116
|
+
"hover:bg",
|
|
2117
|
+
"hover:text",
|
|
2118
|
+
"hover:border",
|
|
2119
|
+
"focus:bg",
|
|
2120
|
+
"focus:text",
|
|
2121
|
+
"focus:border",
|
|
2122
|
+
"focus:ring",
|
|
2123
|
+
"dark:bg",
|
|
2124
|
+
"dark:text",
|
|
2125
|
+
"dark:border"
|
|
2126
|
+
];
|
|
2127
|
+
return n.forEach((o) => {
|
|
2128
|
+
s.forEach((f) => {
|
|
2129
|
+
c.forEach((a) => {
|
|
2130
|
+
t.push(`${a}-${o}-${f}`);
|
|
2131
|
+
});
|
|
2132
|
+
});
|
|
2133
|
+
}), t;
|
|
2134
|
+
}
|
|
2135
|
+
function dn(e) {
|
|
2136
|
+
return [
|
|
2137
|
+
`
|
|
2138
|
+
plugin(function({ addUtilities, theme }) {
|
|
2139
|
+
const colors = theme('colors')
|
|
2140
|
+
const utilities = {}
|
|
2141
|
+
|
|
2142
|
+
// Generate cstu- prefixed utilities
|
|
2143
|
+
Object.entries(colors).forEach(([colorName, shades]) => {
|
|
2144
|
+
if (typeof shades === 'object') {
|
|
2145
|
+
Object.entries(shades).forEach(([shade, value]) => {
|
|
2146
|
+
utilities[\`.cstu-bg-\${colorName}-\${shade}\`] = {
|
|
2147
|
+
backgroundColor: value
|
|
2148
|
+
}
|
|
2149
|
+
utilities[\`.cstu-text-\${colorName}-\${shade}\`] = {
|
|
2150
|
+
color: value
|
|
2151
|
+
}
|
|
2152
|
+
utilities[\`.cstu-border-\${colorName}-\${shade}\`] = {
|
|
2153
|
+
borderColor: value
|
|
2154
|
+
}
|
|
2155
|
+
})
|
|
2156
|
+
}
|
|
2157
|
+
})
|
|
2158
|
+
|
|
2159
|
+
addUtilities(utilities)
|
|
2160
|
+
})
|
|
2161
|
+
`
|
|
2162
|
+
];
|
|
2163
|
+
}
|
|
2164
|
+
function bn(e, t = {}) {
|
|
2165
|
+
const n = an(e);
|
|
2166
|
+
return {
|
|
2167
|
+
content: t.content || ["./src/**/*.{js,ts,jsx,tsx,vue}"],
|
|
2168
|
+
darkMode: t.darkMode || "class",
|
|
2169
|
+
theme: {
|
|
2170
|
+
extend: {
|
|
2171
|
+
colors: n.colors,
|
|
2172
|
+
...t.extendTheme || {}
|
|
2173
|
+
}
|
|
2174
|
+
},
|
|
2175
|
+
plugins: [
|
|
2176
|
+
// Add the plugin functions here
|
|
2177
|
+
...t.plugins || []
|
|
2178
|
+
],
|
|
2179
|
+
safelist: n.safelist
|
|
2180
|
+
};
|
|
2181
|
+
}
|
|
2182
|
+
function _n(e, t = {}) {
|
|
2183
|
+
const n = bn(e, t);
|
|
2184
|
+
return `const withOpacity = (hex) => \`rgb(var(\${hex}) / <alpha-value>)\`
|
|
2185
|
+
|
|
2186
|
+
/** @type {import('tailwindcss').Config} */
|
|
2187
|
+
module.exports = ${JSON.stringify(n, null, 2)}
|
|
2188
|
+
`;
|
|
2189
|
+
}
|
|
2190
|
+
function $n(e) {
|
|
2191
|
+
const t = ht(e);
|
|
2192
|
+
let n = `:root {
|
|
2193
|
+
`;
|
|
2194
|
+
return Object.entries(t).forEach(([r, s]) => {
|
|
2195
|
+
Object.entries(s).forEach(([c, o]) => {
|
|
2196
|
+
n += ` --cstu-${r}-${c}: ${o};
|
|
2197
|
+
`;
|
|
2198
|
+
});
|
|
2199
|
+
}), n += `}
|
|
2200
|
+
`, n += `
|
|
2201
|
+
.dark {
|
|
2202
|
+
`, n += `}
|
|
2203
|
+
`, n;
|
|
2204
|
+
}
|
|
2205
|
+
function xn(e) {
|
|
2206
|
+
return `import { ThemeProvider } from '@your-org/design-system'
|
|
2207
|
+
import { useTheme } from '@your-org/design-system'
|
|
2208
|
+
|
|
2209
|
+
// Your custom theme
|
|
2210
|
+
const customTheme = ${JSON.stringify(e, null, 2)}
|
|
2211
|
+
|
|
2212
|
+
// In your main app file
|
|
2213
|
+
export default function App() {
|
|
2214
|
+
return (
|
|
2215
|
+
<ThemeProvider initialTheme={customTheme}>
|
|
2216
|
+
<YourApp />
|
|
2217
|
+
</ThemeProvider>
|
|
2218
|
+
)
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
// In your components
|
|
2222
|
+
export function MyComponent() {
|
|
2223
|
+
const { theme, setColors } = useTheme()
|
|
2224
|
+
|
|
2225
|
+
// Access theme colors
|
|
2226
|
+
const primaryColor = theme.value.primary
|
|
2227
|
+
|
|
2228
|
+
return (
|
|
2229
|
+
<div className="bg-primary-500 text-white">
|
|
2230
|
+
Your content here
|
|
2231
|
+
</div>
|
|
2232
|
+
)
|
|
2233
|
+
}
|
|
2234
|
+
`;
|
|
2235
|
+
}
|
|
2236
|
+
export {
|
|
2237
|
+
gn as a,
|
|
2238
|
+
J as b,
|
|
2239
|
+
_ as c,
|
|
2240
|
+
bt as d,
|
|
2241
|
+
on as e,
|
|
2242
|
+
mn as f,
|
|
2243
|
+
ht as g,
|
|
2244
|
+
yn as h,
|
|
2245
|
+
an as i,
|
|
2246
|
+
un as j,
|
|
2247
|
+
kn as k,
|
|
2248
|
+
ln as l,
|
|
2249
|
+
cn as m,
|
|
2250
|
+
dn as n,
|
|
2251
|
+
bn as o,
|
|
2252
|
+
_n as p,
|
|
2253
|
+
$n as q,
|
|
2254
|
+
xn as r,
|
|
2255
|
+
nn as s,
|
|
2256
|
+
gt as t,
|
|
2257
|
+
rn as u,
|
|
2258
|
+
wn as v,
|
|
2259
|
+
sn as w,
|
|
2260
|
+
pn as x
|
|
2261
|
+
};
|