@salty-css/core 0.0.1-alpha.297 → 0.0.1-alpha.299

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/helpers/index.js CHANGED
@@ -1,8 +1,8 @@
1
- var A = Object.defineProperty;
2
- var P = (e, t, n) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var _ = (e, t, n) => P(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { d as Q } from "../viewport-clamp-CaYwREKc.js";
5
- const w = {
1
+ var P = Object.defineProperty;
2
+ var S = (t, e, n) => e in t ? P(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var N = (t, e, n) => S(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { d as X } from "../viewport-clamp-CaYwREKc.js";
5
+ const v = {
6
6
  aliceblue: [240, 248, 255],
7
7
  antiquewhite: [250, 235, 215],
8
8
  aqua: [0, 255, 255],
@@ -151,108 +151,108 @@ const w = {
151
151
  whitesmoke: [245, 245, 245],
152
152
  yellow: [255, 255, 0],
153
153
  yellowgreen: [154, 205, 50]
154
- }, O = /* @__PURE__ */ Object.create(null);
155
- for (const e in w)
156
- Object.hasOwn(w, e) && (O[w[e]] = e);
154
+ }, C = /* @__PURE__ */ Object.create(null);
155
+ for (const t in v)
156
+ Object.hasOwn(v, t) && (C[v[t]] = t);
157
157
  const d = {
158
158
  to: {},
159
159
  get: {}
160
160
  };
161
- d.get = function(e) {
162
- const t = e.slice(0, 3).toLowerCase();
161
+ d.get = function(t) {
162
+ const e = t.slice(0, 3).toLowerCase();
163
163
  let n, r;
164
- switch (t) {
164
+ switch (e) {
165
165
  case "hsl": {
166
- n = d.get.hsl(e), r = "hsl";
166
+ n = d.get.hsl(t), r = "hsl";
167
167
  break;
168
168
  }
169
169
  case "hwb": {
170
- n = d.get.hwb(e), r = "hwb";
170
+ n = d.get.hwb(t), r = "hwb";
171
171
  break;
172
172
  }
173
173
  default: {
174
- n = d.get.rgb(e), r = "rgb";
174
+ n = d.get.rgb(t), r = "rgb";
175
175
  break;
176
176
  }
177
177
  }
178
178
  return n ? { model: r, value: n } : null;
179
179
  };
180
- d.get.rgb = function(e) {
181
- if (!e)
180
+ d.get.rgb = function(t) {
181
+ if (!t)
182
182
  return null;
183
- const t = /^#([a-f\d]{3,4})$/i, n = /^#([a-f\d]{6})([a-f\d]{2})?$/i, r = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/, o = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/, l = /^(\w+)$/;
184
- let s = [0, 0, 0, 1], a, i, u;
185
- if (a = e.match(n)) {
186
- for (u = a[2], a = a[1], i = 0; i < 3; i++) {
187
- const m = i * 2;
188
- s[i] = Number.parseInt(a.slice(m, m + 2), 16);
183
+ const e = /^#([a-f\d]{3,4})$/i, n = /^#([a-f\d]{6})([a-f\d]{2})?$/i, r = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/, o = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/, l = /^(\w+)$/;
184
+ let s = [0, 0, 0, 1], a, c, u;
185
+ if (a = t.match(n)) {
186
+ for (u = a[2], a = a[1], c = 0; c < 3; c++) {
187
+ const m = c * 2;
188
+ s[c] = Number.parseInt(a.slice(m, m + 2), 16);
189
189
  }
190
190
  u && (s[3] = Number.parseInt(u, 16) / 255);
191
- } else if (a = e.match(t)) {
192
- for (a = a[1], u = a[3], i = 0; i < 3; i++)
193
- s[i] = Number.parseInt(a[i] + a[i], 16);
191
+ } else if (a = t.match(e)) {
192
+ for (a = a[1], u = a[3], c = 0; c < 3; c++)
193
+ s[c] = Number.parseInt(a[c] + a[c], 16);
194
194
  u && (s[3] = Number.parseInt(u + u, 16) / 255);
195
- } else if (a = e.match(r)) {
196
- for (i = 0; i < 3; i++)
197
- s[i] = Number.parseInt(a[i + 1], 10);
195
+ } else if (a = t.match(r)) {
196
+ for (c = 0; c < 3; c++)
197
+ s[c] = Number.parseInt(a[c + 1], 10);
198
198
  a[4] && (s[3] = a[5] ? Number.parseFloat(a[4]) * 0.01 : Number.parseFloat(a[4]));
199
- } else if (a = e.match(o)) {
200
- for (i = 0; i < 3; i++)
201
- s[i] = Math.round(Number.parseFloat(a[i + 1]) * 2.55);
199
+ } else if (a = t.match(o)) {
200
+ for (c = 0; c < 3; c++)
201
+ s[c] = Math.round(Number.parseFloat(a[c + 1]) * 2.55);
202
202
  a[4] && (s[3] = a[5] ? Number.parseFloat(a[4]) * 0.01 : Number.parseFloat(a[4]));
203
- } else return (a = e.match(l)) ? a[1] === "transparent" ? [0, 0, 0, 0] : Object.hasOwn(w, a[1]) ? (s = w[a[1]], s[3] = 1, s) : null : null;
204
- for (i = 0; i < 3; i++)
205
- s[i] = k(s[i], 0, 255);
206
- return s[3] = k(s[3], 0, 1), s;
203
+ } else return (a = t.match(l)) ? a[1] === "transparent" ? [0, 0, 0, 0] : Object.hasOwn(v, a[1]) ? (s = v[a[1]], s[3] = 1, s) : null : null;
204
+ for (c = 0; c < 3; c++)
205
+ s[c] = y(s[c], 0, 255);
206
+ return s[3] = y(s[3], 0, 1), s;
207
207
  };
208
- d.get.hsl = function(e) {
209
- if (!e)
208
+ d.get.hsl = function(t) {
209
+ if (!t)
210
210
  return null;
211
- const t = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, n = e.match(t);
211
+ const e = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, n = t.match(e);
212
212
  if (n) {
213
- const r = Number.parseFloat(n[4]), o = (Number.parseFloat(n[1]) % 360 + 360) % 360, l = k(Number.parseFloat(n[2]), 0, 100), s = k(Number.parseFloat(n[3]), 0, 100), a = k(Number.isNaN(r) ? 1 : r, 0, 1);
213
+ const r = Number.parseFloat(n[4]), o = (Number.parseFloat(n[1]) % 360 + 360) % 360, l = y(Number.parseFloat(n[2]), 0, 100), s = y(Number.parseFloat(n[3]), 0, 100), a = y(Number.isNaN(r) ? 1 : r, 0, 1);
214
214
  return [o, l, s, a];
215
215
  }
216
216
  return null;
217
217
  };
218
- d.get.hwb = function(e) {
219
- if (!e)
218
+ d.get.hwb = function(t) {
219
+ if (!t)
220
220
  return null;
221
- const t = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, n = e.match(t);
221
+ const e = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/, n = t.match(e);
222
222
  if (n) {
223
- const r = Number.parseFloat(n[4]), o = (Number.parseFloat(n[1]) % 360 + 360) % 360, l = k(Number.parseFloat(n[2]), 0, 100), s = k(Number.parseFloat(n[3]), 0, 100), a = k(Number.isNaN(r) ? 1 : r, 0, 1);
223
+ const r = Number.parseFloat(n[4]), o = (Number.parseFloat(n[1]) % 360 + 360) % 360, l = y(Number.parseFloat(n[2]), 0, 100), s = y(Number.parseFloat(n[3]), 0, 100), a = y(Number.isNaN(r) ? 1 : r, 0, 1);
224
224
  return [o, l, s, a];
225
225
  }
226
226
  return null;
227
227
  };
228
- d.to.hex = function(...e) {
229
- return "#" + x(e[0]) + x(e[1]) + x(e[2]) + (e[3] < 1 ? x(Math.round(e[3] * 255)) : "");
228
+ d.to.hex = function(...t) {
229
+ return "#" + F(t[0]) + F(t[1]) + F(t[2]) + (t[3] < 1 ? F(Math.round(t[3] * 255)) : "");
230
230
  };
231
- d.to.rgb = function(...e) {
232
- return e.length < 4 || e[3] === 1 ? "rgb(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ")" : "rgba(" + Math.round(e[0]) + ", " + Math.round(e[1]) + ", " + Math.round(e[2]) + ", " + e[3] + ")";
231
+ d.to.rgb = function(...t) {
232
+ return t.length < 4 || t[3] === 1 ? "rgb(" + Math.round(t[0]) + ", " + Math.round(t[1]) + ", " + Math.round(t[2]) + ")" : "rgba(" + Math.round(t[0]) + ", " + Math.round(t[1]) + ", " + Math.round(t[2]) + ", " + t[3] + ")";
233
233
  };
234
- d.to.rgb.percent = function(...e) {
235
- const t = Math.round(e[0] / 255 * 100), n = Math.round(e[1] / 255 * 100), r = Math.round(e[2] / 255 * 100);
236
- return e.length < 4 || e[3] === 1 ? "rgb(" + t + "%, " + n + "%, " + r + "%)" : "rgba(" + t + "%, " + n + "%, " + r + "%, " + e[3] + ")";
234
+ d.to.rgb.percent = function(...t) {
235
+ const e = Math.round(t[0] / 255 * 100), n = Math.round(t[1] / 255 * 100), r = Math.round(t[2] / 255 * 100);
236
+ return t.length < 4 || t[3] === 1 ? "rgb(" + e + "%, " + n + "%, " + r + "%)" : "rgba(" + e + "%, " + n + "%, " + r + "%, " + t[3] + ")";
237
237
  };
238
- d.to.hsl = function(...e) {
239
- return e.length < 4 || e[3] === 1 ? "hsl(" + e[0] + ", " + e[1] + "%, " + e[2] + "%)" : "hsla(" + e[0] + ", " + e[1] + "%, " + e[2] + "%, " + e[3] + ")";
238
+ d.to.hsl = function(...t) {
239
+ return t.length < 4 || t[3] === 1 ? "hsl(" + t[0] + ", " + t[1] + "%, " + t[2] + "%)" : "hsla(" + t[0] + ", " + t[1] + "%, " + t[2] + "%, " + t[3] + ")";
240
240
  };
241
- d.to.hwb = function(...e) {
242
- let t = "";
243
- return e.length >= 4 && e[3] !== 1 && (t = ", " + e[3]), "hwb(" + e[0] + ", " + e[1] + "%, " + e[2] + "%" + t + ")";
241
+ d.to.hwb = function(...t) {
242
+ let e = "";
243
+ return t.length >= 4 && t[3] !== 1 && (e = ", " + t[3]), "hwb(" + t[0] + ", " + t[1] + "%, " + t[2] + "%" + e + ")";
244
244
  };
245
- d.to.keyword = function(...e) {
246
- return O[e.slice(0, 3)];
245
+ d.to.keyword = function(...t) {
246
+ return C[t.slice(0, 3)];
247
247
  };
248
- function k(e, t, n) {
249
- return Math.min(Math.max(t, e), n);
248
+ function y(t, e, n) {
249
+ return Math.min(Math.max(e, t), n);
250
250
  }
251
- function x(e) {
252
- const t = Math.round(e).toString(16).toUpperCase();
253
- return t.length < 2 ? "0" + t : t;
251
+ function F(t) {
252
+ const e = Math.round(t).toString(16).toUpperCase();
253
+ return e.length < 2 ? "0" + e : e;
254
254
  }
255
- const M = {
255
+ const x = {
256
256
  aliceblue: [240, 248, 255],
257
257
  antiquewhite: [250, 235, 215],
258
258
  aqua: [0, 255, 255],
@@ -401,10 +401,10 @@ const M = {
401
401
  whitesmoke: [245, 245, 245],
402
402
  yellow: [255, 255, 0],
403
403
  yellowgreen: [154, 205, 50]
404
- }, q = {};
405
- for (const e of Object.keys(M))
406
- q[M[e]] = e;
407
- const c = {
404
+ }, z = {};
405
+ for (const t of Object.keys(x))
406
+ z[x[t]] = t;
407
+ const i = {
408
408
  rgb: { channels: 3, labels: "rgb" },
409
409
  hsl: { channels: 3, labels: "hsl" },
410
410
  hsv: { channels: 3, labels: "hsv" },
@@ -412,7 +412,9 @@ const c = {
412
412
  cmyk: { channels: 4, labels: "cmyk" },
413
413
  xyz: { channels: 3, labels: "xyz" },
414
414
  lab: { channels: 3, labels: "lab" },
415
+ oklab: { channels: 3, labels: ["okl", "oka", "okb"] },
415
416
  lch: { channels: 3, labels: "lch" },
417
+ oklch: { channels: 3, labels: ["okl", "okc", "okh"] },
416
418
  hex: { channels: 1, labels: ["hex"] },
417
419
  keyword: { channels: 1, labels: ["keyword"] },
418
420
  ansi16: { channels: 1, labels: ["ansi16"] },
@@ -420,61 +422,68 @@ const c = {
420
422
  hcg: { channels: 3, labels: ["h", "c", "g"] },
421
423
  apple: { channels: 3, labels: ["r16", "g16", "b16"] },
422
424
  gray: { channels: 1, labels: ["gray"] }
423
- }, y = (6 / 29) ** 3;
424
- for (const e of Object.keys(c)) {
425
- if (!("channels" in c[e]))
426
- throw new Error("missing channels property: " + e);
427
- if (!("labels" in c[e]))
428
- throw new Error("missing channel labels property: " + e);
429
- if (c[e].labels.length !== c[e].channels)
430
- throw new Error("channel and label counts mismatch: " + e);
431
- const { channels: t, labels: n } = c[e];
432
- delete c[e].channels, delete c[e].labels, Object.defineProperty(c[e], "channels", { value: t }), Object.defineProperty(c[e], "labels", { value: n });
425
+ }, p = (6 / 29) ** 3;
426
+ function k(t) {
427
+ const e = t > 31308e-7 ? 1.055 * t ** 0.4166666666666667 - 0.055 : t * 12.92;
428
+ return Math.min(Math.max(0, e), 1);
429
+ }
430
+ function w(t) {
431
+ return t > 0.04045 ? ((t + 0.055) / 1.055) ** 2.4 : t / 12.92;
433
432
  }
434
- c.rgb.hsl = function(e) {
435
- const t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, o = Math.min(t, n, r), l = Math.max(t, n, r), s = l - o;
436
- let a, i;
433
+ for (const t of Object.keys(i)) {
434
+ if (!("channels" in i[t]))
435
+ throw new Error("missing channels property: " + t);
436
+ if (!("labels" in i[t]))
437
+ throw new Error("missing channel labels property: " + t);
438
+ if (i[t].labels.length !== i[t].channels)
439
+ throw new Error("channel and label counts mismatch: " + t);
440
+ const { channels: e, labels: n } = i[t];
441
+ delete i[t].channels, delete i[t].labels, Object.defineProperty(i[t], "channels", { value: e }), Object.defineProperty(i[t], "labels", { value: n });
442
+ }
443
+ i.rgb.hsl = function(t) {
444
+ const e = t[0] / 255, n = t[1] / 255, r = t[2] / 255, o = Math.min(e, n, r), l = Math.max(e, n, r), s = l - o;
445
+ let a, c;
437
446
  switch (l) {
438
447
  case o: {
439
448
  a = 0;
440
449
  break;
441
450
  }
442
- case t: {
451
+ case e: {
443
452
  a = (n - r) / s;
444
453
  break;
445
454
  }
446
455
  case n: {
447
- a = 2 + (r - t) / s;
456
+ a = 2 + (r - e) / s;
448
457
  break;
449
458
  }
450
459
  case r: {
451
- a = 4 + (t - n) / s;
460
+ a = 4 + (e - n) / s;
452
461
  break;
453
462
  }
454
463
  }
455
464
  a = Math.min(a * 60, 360), a < 0 && (a += 360);
456
465
  const u = (o + l) / 2;
457
- return l === o ? i = 0 : u <= 0.5 ? i = s / (l + o) : i = s / (2 - l - o), [a, i * 100, u * 100];
466
+ return l === o ? c = 0 : u <= 0.5 ? c = s / (l + o) : c = s / (2 - l - o), [a, c * 100, u * 100];
458
467
  };
459
- c.rgb.hsv = function(e) {
460
- let t, n, r, o, l;
461
- const s = e[0] / 255, a = e[1] / 255, i = e[2] / 255, u = Math.max(s, a, i), m = u - Math.min(s, a, i), p = function(z) {
462
- return (u - z) / 6 / m + 1 / 2;
468
+ i.rgb.hsv = function(t) {
469
+ let e, n, r, o, l;
470
+ const s = t[0] / 255, a = t[1] / 255, c = t[2] / 255, u = Math.max(s, a, c), m = u - Math.min(s, a, c), _ = function(I) {
471
+ return (u - I) / 6 / m + 1 / 2;
463
472
  };
464
473
  if (m === 0)
465
474
  o = 0, l = 0;
466
475
  else {
467
- switch (l = m / u, t = p(s), n = p(a), r = p(i), u) {
476
+ switch (l = m / u, e = _(s), n = _(a), r = _(c), u) {
468
477
  case s: {
469
478
  o = r - n;
470
479
  break;
471
480
  }
472
481
  case a: {
473
- o = 1 / 3 + t - r;
482
+ o = 1 / 3 + e - r;
474
483
  break;
475
484
  }
476
- case i: {
477
- o = 2 / 3 + n - t;
485
+ case c: {
486
+ o = 2 / 3 + n - e;
478
487
  break;
479
488
  }
480
489
  }
@@ -486,231 +495,251 @@ c.rgb.hsv = function(e) {
486
495
  u * 100
487
496
  ];
488
497
  };
489
- c.rgb.hwb = function(e) {
490
- const t = e[0], n = e[1];
491
- let r = e[2];
492
- const o = c.rgb.hsl(e)[0], l = 1 / 255 * Math.min(t, Math.min(n, r));
493
- return r = 1 - 1 / 255 * Math.max(t, Math.max(n, r)), [o, l * 100, r * 100];
498
+ i.rgb.hwb = function(t) {
499
+ const e = t[0], n = t[1];
500
+ let r = t[2];
501
+ const o = i.rgb.hsl(t)[0], l = 1 / 255 * Math.min(e, Math.min(n, r));
502
+ return r = 1 - 1 / 255 * Math.max(e, Math.max(n, r)), [o, l * 100, r * 100];
503
+ };
504
+ i.rgb.oklab = function(t) {
505
+ const e = w(t[0] / 255), n = w(t[1] / 255), r = w(t[2] / 255), o = Math.cbrt(0.4122214708 * e + 0.5363325363 * n + 0.0514459929 * r), l = Math.cbrt(0.2119034982 * e + 0.6806995451 * n + 0.1073969566 * r), s = Math.cbrt(0.0883024619 * e + 0.2817188376 * n + 0.6299787005 * r), a = 0.2104542553 * o + 0.793617785 * l - 0.0040720468 * s, c = 1.9779984951 * o - 2.428592205 * l + 0.4505937099 * s, u = 0.0259040371 * o + 0.7827717662 * l - 0.808675766 * s;
506
+ return [a * 100, c * 100, u * 100];
494
507
  };
495
- c.rgb.cmyk = function(e) {
496
- const t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, o = Math.min(1 - t, 1 - n, 1 - r), l = (1 - t - o) / (1 - o) || 0, s = (1 - n - o) / (1 - o) || 0, a = (1 - r - o) / (1 - o) || 0;
508
+ i.rgb.cmyk = function(t) {
509
+ const e = t[0] / 255, n = t[1] / 255, r = t[2] / 255, o = Math.min(1 - e, 1 - n, 1 - r), l = (1 - e - o) / (1 - o) || 0, s = (1 - n - o) / (1 - o) || 0, a = (1 - r - o) / (1 - o) || 0;
497
510
  return [l * 100, s * 100, a * 100, o * 100];
498
511
  };
499
- function S(e, t) {
500
- return (e[0] - t[0]) ** 2 + (e[1] - t[1]) ** 2 + (e[2] - t[2]) ** 2;
512
+ function j(t, e) {
513
+ return (t[0] - e[0]) ** 2 + (t[1] - e[1]) ** 2 + (t[2] - e[2]) ** 2;
501
514
  }
502
- c.rgb.keyword = function(e) {
503
- const t = q[e];
504
- if (t)
505
- return t;
515
+ i.rgb.keyword = function(t) {
516
+ const e = z[t];
517
+ if (e)
518
+ return e;
506
519
  let n = Number.POSITIVE_INFINITY, r;
507
- for (const o of Object.keys(M)) {
508
- const l = M[o], s = S(e, l);
520
+ for (const o of Object.keys(x)) {
521
+ const l = x[o], s = j(t, l);
509
522
  s < n && (n = s, r = o);
510
523
  }
511
524
  return r;
512
525
  };
513
- c.keyword.rgb = function(e) {
514
- return M[e];
526
+ i.keyword.rgb = function(t) {
527
+ return x[t];
515
528
  };
516
- c.rgb.xyz = function(e) {
517
- let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255;
518
- t = t > 0.04045 ? ((t + 0.055) / 1.055) ** 2.4 : t / 12.92, n = n > 0.04045 ? ((n + 0.055) / 1.055) ** 2.4 : n / 12.92, r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
519
- const o = t * 0.4124564 + n * 0.3575761 + r * 0.1804375, l = t * 0.2126729 + n * 0.7151522 + r * 0.072175, s = t * 0.0193339 + n * 0.119192 + r * 0.9503041;
529
+ i.rgb.xyz = function(t) {
530
+ const e = w(t[0] / 255), n = w(t[1] / 255), r = w(t[2] / 255), o = e * 0.4124564 + n * 0.3575761 + r * 0.1804375, l = e * 0.2126729 + n * 0.7151522 + r * 0.072175, s = e * 0.0193339 + n * 0.119192 + r * 0.9503041;
520
531
  return [o * 100, l * 100, s * 100];
521
532
  };
522
- c.rgb.lab = function(e) {
523
- const t = c.rgb.xyz(e);
524
- let n = t[0], r = t[1], o = t[2];
525
- n /= 95.047, r /= 100, o /= 108.883, n = n > y ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > y ? r ** (1 / 3) : 7.787 * r + 16 / 116, o = o > y ? o ** (1 / 3) : 7.787 * o + 16 / 116;
533
+ i.rgb.lab = function(t) {
534
+ const e = i.rgb.xyz(t);
535
+ let n = e[0], r = e[1], o = e[2];
536
+ n /= 95.047, r /= 100, o /= 108.883, n = n > p ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > p ? r ** (1 / 3) : 7.787 * r + 16 / 116, o = o > p ? o ** (1 / 3) : 7.787 * o + 16 / 116;
526
537
  const l = 116 * r - 16, s = 500 * (n - r), a = 200 * (r - o);
527
538
  return [l, s, a];
528
539
  };
529
- c.hsl.rgb = function(e) {
530
- const t = e[0] / 360, n = e[1] / 100, r = e[2] / 100;
540
+ i.hsl.rgb = function(t) {
541
+ const e = t[0] / 360, n = t[1] / 100, r = t[2] / 100;
531
542
  let o, l;
532
543
  if (n === 0)
533
544
  return l = r * 255, [l, l, l];
534
- const s = r < 0.5 ? r * (1 + n) : r + n - r * n, a = 2 * r - s, i = [0, 0, 0];
545
+ const s = r < 0.5 ? r * (1 + n) : r + n - r * n, a = 2 * r - s, c = [0, 0, 0];
535
546
  for (let u = 0; u < 3; u++)
536
- o = t + 1 / 3 * -(u - 1), o < 0 && o++, o > 1 && o--, 6 * o < 1 ? l = a + (s - a) * 6 * o : 2 * o < 1 ? l = s : 3 * o < 2 ? l = a + (s - a) * (2 / 3 - o) * 6 : l = a, i[u] = l * 255;
537
- return i;
547
+ o = e + 1 / 3 * -(u - 1), o < 0 && o++, o > 1 && o--, 6 * o < 1 ? l = a + (s - a) * 6 * o : 2 * o < 1 ? l = s : 3 * o < 2 ? l = a + (s - a) * (2 / 3 - o) * 6 : l = a, c[u] = l * 255;
548
+ return c;
538
549
  };
539
- c.hsl.hsv = function(e) {
540
- const t = e[0];
541
- let n = e[1] / 100, r = e[2] / 100, o = n;
550
+ i.hsl.hsv = function(t) {
551
+ const e = t[0];
552
+ let n = t[1] / 100, r = t[2] / 100, o = n;
542
553
  const l = Math.max(r, 0.01);
543
554
  r *= 2, n *= r <= 1 ? r : 2 - r, o *= l <= 1 ? l : 2 - l;
544
555
  const s = (r + n) / 2, a = r === 0 ? 2 * o / (l + o) : 2 * n / (r + n);
545
- return [t, a * 100, s * 100];
556
+ return [e, a * 100, s * 100];
546
557
  };
547
- c.hsv.rgb = function(e) {
548
- const t = e[0] / 60, n = e[1] / 100;
549
- let r = e[2] / 100;
550
- const o = Math.floor(t) % 6, l = t - Math.floor(t), s = 255 * r * (1 - n), a = 255 * r * (1 - n * l), i = 255 * r * (1 - n * (1 - l));
558
+ i.hsv.rgb = function(t) {
559
+ const e = t[0] / 60, n = t[1] / 100;
560
+ let r = t[2] / 100;
561
+ const o = Math.floor(e) % 6, l = e - Math.floor(e), s = 255 * r * (1 - n), a = 255 * r * (1 - n * l), c = 255 * r * (1 - n * (1 - l));
551
562
  switch (r *= 255, o) {
552
563
  case 0:
553
- return [r, i, s];
564
+ return [r, c, s];
554
565
  case 1:
555
566
  return [a, r, s];
556
567
  case 2:
557
- return [s, r, i];
568
+ return [s, r, c];
558
569
  case 3:
559
570
  return [s, a, r];
560
571
  case 4:
561
- return [i, s, r];
572
+ return [c, s, r];
562
573
  case 5:
563
574
  return [r, s, a];
564
575
  }
565
576
  };
566
- c.hsv.hsl = function(e) {
567
- const t = e[0], n = e[1] / 100, r = e[2] / 100, o = Math.max(r, 0.01);
577
+ i.hsv.hsl = function(t) {
578
+ const e = t[0], n = t[1] / 100, r = t[2] / 100, o = Math.max(r, 0.01);
568
579
  let l, s;
569
580
  s = (2 - n) * r;
570
581
  const a = (2 - n) * o;
571
- return l = n * o, l /= a <= 1 ? a : 2 - a, l = l || 0, s /= 2, [t, l * 100, s * 100];
582
+ return l = n * o, l /= a <= 1 ? a : 2 - a, l = l || 0, s /= 2, [e, l * 100, s * 100];
572
583
  };
573
- c.hwb.rgb = function(e) {
574
- const t = e[0] / 360;
575
- let n = e[1] / 100, r = e[2] / 100;
584
+ i.hwb.rgb = function(t) {
585
+ const e = t[0] / 360;
586
+ let n = t[1] / 100, r = t[2] / 100;
576
587
  const o = n + r;
577
588
  let l;
578
589
  o > 1 && (n /= o, r /= o);
579
- const s = Math.floor(6 * t), a = 1 - r;
580
- l = 6 * t - s, (s & 1) !== 0 && (l = 1 - l);
581
- const i = n + l * (a - n);
582
- let u, m, p;
590
+ const s = Math.floor(6 * e), a = 1 - r;
591
+ l = 6 * e - s, (s & 1) !== 0 && (l = 1 - l);
592
+ const c = n + l * (a - n);
593
+ let u, m, _;
583
594
  switch (s) {
584
595
  default:
585
596
  case 6:
586
597
  case 0: {
587
- u = a, m = i, p = n;
598
+ u = a, m = c, _ = n;
588
599
  break;
589
600
  }
590
601
  case 1: {
591
- u = i, m = a, p = n;
602
+ u = c, m = a, _ = n;
592
603
  break;
593
604
  }
594
605
  case 2: {
595
- u = n, m = a, p = i;
606
+ u = n, m = a, _ = c;
596
607
  break;
597
608
  }
598
609
  case 3: {
599
- u = n, m = i, p = a;
610
+ u = n, m = c, _ = a;
600
611
  break;
601
612
  }
602
613
  case 4: {
603
- u = i, m = n, p = a;
614
+ u = c, m = n, _ = a;
604
615
  break;
605
616
  }
606
617
  case 5: {
607
- u = a, m = n, p = i;
618
+ u = a, m = n, _ = c;
608
619
  break;
609
620
  }
610
621
  }
611
- return [u * 255, m * 255, p * 255];
622
+ return [u * 255, m * 255, _ * 255];
612
623
  };
613
- c.cmyk.rgb = function(e) {
614
- const t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, o = e[3] / 100, l = 1 - Math.min(1, t * (1 - o) + o), s = 1 - Math.min(1, n * (1 - o) + o), a = 1 - Math.min(1, r * (1 - o) + o);
624
+ i.cmyk.rgb = function(t) {
625
+ const e = t[0] / 100, n = t[1] / 100, r = t[2] / 100, o = t[3] / 100, l = 1 - Math.min(1, e * (1 - o) + o), s = 1 - Math.min(1, n * (1 - o) + o), a = 1 - Math.min(1, r * (1 - o) + o);
615
626
  return [l * 255, s * 255, a * 255];
616
627
  };
617
- c.xyz.rgb = function(e) {
618
- const t = e[0] / 100, n = e[1] / 100, r = e[2] / 100;
628
+ i.xyz.rgb = function(t) {
629
+ const e = t[0] / 100, n = t[1] / 100, r = t[2] / 100;
619
630
  let o, l, s;
620
- return o = t * 3.2404542 + n * -1.5371385 + r * -0.4985314, l = t * -0.969266 + n * 1.8760108 + r * 0.041556, s = t * 0.0556434 + n * -0.2040259 + r * 1.0572252, o = o > 31308e-7 ? 1.055 * o ** (1 / 2.4) - 0.055 : o * 12.92, l = l > 31308e-7 ? 1.055 * l ** (1 / 2.4) - 0.055 : l * 12.92, s = s > 31308e-7 ? 1.055 * s ** (1 / 2.4) - 0.055 : s * 12.92, o = Math.min(Math.max(0, o), 1), l = Math.min(Math.max(0, l), 1), s = Math.min(Math.max(0, s), 1), [o * 255, l * 255, s * 255];
631
+ return o = e * 3.2404542 + n * -1.5371385 + r * -0.4985314, l = e * -0.969266 + n * 1.8760108 + r * 0.041556, s = e * 0.0556434 + n * -0.2040259 + r * 1.0572252, o = k(o), l = k(l), s = k(s), [o * 255, l * 255, s * 255];
621
632
  };
622
- c.xyz.lab = function(e) {
623
- let t = e[0], n = e[1], r = e[2];
624
- t /= 95.047, n /= 100, r /= 108.883, t = t > y ? t ** (1 / 3) : 7.787 * t + 16 / 116, n = n > y ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > y ? r ** (1 / 3) : 7.787 * r + 16 / 116;
625
- const o = 116 * n - 16, l = 500 * (t - n), s = 200 * (n - r);
633
+ i.xyz.lab = function(t) {
634
+ let e = t[0], n = t[1], r = t[2];
635
+ e /= 95.047, n /= 100, r /= 108.883, e = e > p ? e ** (1 / 3) : 7.787 * e + 16 / 116, n = n > p ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > p ? r ** (1 / 3) : 7.787 * r + 16 / 116;
636
+ const o = 116 * n - 16, l = 500 * (e - n), s = 200 * (n - r);
626
637
  return [o, l, s];
627
638
  };
628
- c.lab.xyz = function(e) {
629
- const t = e[0], n = e[1], r = e[2];
639
+ i.xyz.oklab = function(t) {
640
+ const e = t[0] / 100, n = t[1] / 100, r = t[2] / 100, o = Math.cbrt(0.8189330101 * e + 0.3618667424 * n - 0.1288597137 * r), l = Math.cbrt(0.0329845436 * e + 0.9293118715 * n + 0.0361456387 * r), s = Math.cbrt(0.0482003018 * e + 0.2643662691 * n + 0.633851707 * r), a = 0.2104542553 * o + 0.793617785 * l - 0.0040720468 * s, c = 1.9779984951 * o - 2.428592205 * l + 0.4505937099 * s, u = 0.0259040371 * o + 0.7827717662 * l - 0.808675766 * s;
641
+ return [a * 100, c * 100, u * 100];
642
+ };
643
+ i.oklab.oklch = function(t) {
644
+ return i.lab.lch(t);
645
+ };
646
+ i.oklab.xyz = function(t) {
647
+ const e = t[0] / 100, n = t[1] / 100, r = t[2] / 100, o = (0.999999998 * e + 0.396337792 * n + 0.215803758 * r) ** 3, l = (1.000000008 * e - 0.105561342 * n - 0.063854175 * r) ** 3, s = (1.000000055 * e - 0.089484182 * n - 1.291485538 * r) ** 3, a = 1.227013851 * o - 0.55779998 * l + 0.281256149 * s, c = -0.040580178 * o + 1.11225687 * l - 0.071676679 * s, u = -0.076381285 * o - 0.421481978 * l + 1.58616322 * s;
648
+ return [a * 100, c * 100, u * 100];
649
+ };
650
+ i.oklab.rgb = function(t) {
651
+ const e = t[0] / 100, n = t[1] / 100, r = t[2] / 100, o = (e + 0.3963377774 * n + 0.2158037573 * r) ** 3, l = (e - 0.1055613458 * n - 0.0638541728 * r) ** 3, s = (e - 0.0894841775 * n - 1.291485548 * r) ** 3, a = k(4.0767416621 * o - 3.3077115913 * l + 0.2309699292 * s), c = k(-1.2684380046 * o + 2.6097574011 * l - 0.3413193965 * s), u = k(-0.0041960863 * o - 0.7034186147 * l + 1.707614701 * s);
652
+ return [a * 255, c * 255, u * 255];
653
+ };
654
+ i.oklch.oklab = function(t) {
655
+ return i.lch.lab(t);
656
+ };
657
+ i.lab.xyz = function(t) {
658
+ const e = t[0], n = t[1], r = t[2];
630
659
  let o, l, s;
631
- l = (t + 16) / 116, o = n / 500 + l, s = l - r / 200;
632
- const a = l ** 3, i = o ** 3, u = s ** 3;
633
- return l = a > y ? a : (l - 16 / 116) / 7.787, o = i > y ? i : (o - 16 / 116) / 7.787, s = u > y ? u : (s - 16 / 116) / 7.787, o *= 95.047, l *= 100, s *= 108.883, [o, l, s];
660
+ l = (e + 16) / 116, o = n / 500 + l, s = l - r / 200;
661
+ const a = l ** 3, c = o ** 3, u = s ** 3;
662
+ return l = a > p ? a : (l - 16 / 116) / 7.787, o = c > p ? c : (o - 16 / 116) / 7.787, s = u > p ? u : (s - 16 / 116) / 7.787, o *= 95.047, l *= 100, s *= 108.883, [o, l, s];
634
663
  };
635
- c.lab.lch = function(e) {
636
- const t = e[0], n = e[1], r = e[2];
664
+ i.lab.lch = function(t) {
665
+ const e = t[0], n = t[1], r = t[2];
637
666
  let o;
638
667
  o = Math.atan2(r, n) * 360 / 2 / Math.PI, o < 0 && (o += 360);
639
668
  const s = Math.sqrt(n * n + r * r);
640
- return [t, s, o];
669
+ return [e, s, o];
641
670
  };
642
- c.lch.lab = function(e) {
643
- const t = e[0], n = e[1], o = e[2] / 360 * 2 * Math.PI, l = n * Math.cos(o), s = n * Math.sin(o);
644
- return [t, l, s];
671
+ i.lch.lab = function(t) {
672
+ const e = t[0], n = t[1], o = t[2] / 360 * 2 * Math.PI, l = n * Math.cos(o), s = n * Math.sin(o);
673
+ return [e, l, s];
645
674
  };
646
- c.rgb.ansi16 = function(e, t = null) {
647
- const [n, r, o] = e;
648
- let l = t === null ? c.rgb.hsv(e)[2] : t;
675
+ i.rgb.ansi16 = function(t, e = null) {
676
+ const [n, r, o] = t;
677
+ let l = e === null ? i.rgb.hsv(t)[2] : e;
649
678
  if (l = Math.round(l / 50), l === 0)
650
679
  return 30;
651
680
  let s = 30 + (Math.round(o / 255) << 2 | Math.round(r / 255) << 1 | Math.round(n / 255));
652
681
  return l === 2 && (s += 60), s;
653
682
  };
654
- c.hsv.ansi16 = function(e) {
655
- return c.rgb.ansi16(c.hsv.rgb(e), e[2]);
683
+ i.hsv.ansi16 = function(t) {
684
+ return i.rgb.ansi16(i.hsv.rgb(t), t[2]);
656
685
  };
657
- c.rgb.ansi256 = function(e) {
658
- const t = e[0], n = e[1], r = e[2];
659
- return t >> 4 === n >> 4 && n >> 4 === r >> 4 ? t < 8 ? 16 : t > 248 ? 231 : Math.round((t - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(t / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(r / 255 * 5);
686
+ i.rgb.ansi256 = function(t) {
687
+ const e = t[0], n = t[1], r = t[2];
688
+ return e >> 4 === n >> 4 && n >> 4 === r >> 4 ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(r / 255 * 5);
660
689
  };
661
- c.ansi16.rgb = function(e) {
662
- e = e[0];
663
- let t = e % 10;
664
- if (t === 0 || t === 7)
665
- return e > 50 && (t += 3.5), t = t / 10.5 * 255, [t, t, t];
666
- const n = (Math.trunc(e > 50) + 1) * 0.5, r = (t & 1) * n * 255, o = (t >> 1 & 1) * n * 255, l = (t >> 2 & 1) * n * 255;
690
+ i.ansi16.rgb = function(t) {
691
+ t = t[0];
692
+ let e = t % 10;
693
+ if (e === 0 || e === 7)
694
+ return t > 50 && (e += 3.5), e = e / 10.5 * 255, [e, e, e];
695
+ const n = (Math.trunc(t > 50) + 1) * 0.5, r = (e & 1) * n * 255, o = (e >> 1 & 1) * n * 255, l = (e >> 2 & 1) * n * 255;
667
696
  return [r, o, l];
668
697
  };
669
- c.ansi256.rgb = function(e) {
670
- if (e = e[0], e >= 232) {
671
- const l = (e - 232) * 10 + 8;
698
+ i.ansi256.rgb = function(t) {
699
+ if (t = t[0], t >= 232) {
700
+ const l = (t - 232) * 10 + 8;
672
701
  return [l, l, l];
673
702
  }
674
- e -= 16;
675
- let t;
676
- const n = Math.floor(e / 36) / 5 * 255, r = Math.floor((t = e % 36) / 6) / 5 * 255, o = t % 6 / 5 * 255;
703
+ t -= 16;
704
+ let e;
705
+ const n = Math.floor(t / 36) / 5 * 255, r = Math.floor((e = t % 36) / 6) / 5 * 255, o = e % 6 / 5 * 255;
677
706
  return [n, r, o];
678
707
  };
679
- c.rgb.hex = function(e) {
680
- const n = (((Math.round(e[0]) & 255) << 16) + ((Math.round(e[1]) & 255) << 8) + (Math.round(e[2]) & 255)).toString(16).toUpperCase();
708
+ i.rgb.hex = function(t) {
709
+ const n = (((Math.round(t[0]) & 255) << 16) + ((Math.round(t[1]) & 255) << 8) + (Math.round(t[2]) & 255)).toString(16).toUpperCase();
681
710
  return "000000".slice(n.length) + n;
682
711
  };
683
- c.hex.rgb = function(e) {
684
- const t = e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);
685
- if (!t)
712
+ i.hex.rgb = function(t) {
713
+ const e = t.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);
714
+ if (!e)
686
715
  return [0, 0, 0];
687
- let n = t[0];
688
- t[0].length === 3 && (n = [...n].map((a) => a + a).join(""));
716
+ let n = e[0];
717
+ e[0].length === 3 && (n = [...n].map((a) => a + a).join(""));
689
718
  const r = Number.parseInt(n, 16), o = r >> 16 & 255, l = r >> 8 & 255, s = r & 255;
690
719
  return [o, l, s];
691
720
  };
692
- c.rgb.hcg = function(e) {
693
- const t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, o = Math.max(Math.max(t, n), r), l = Math.min(Math.min(t, n), r), s = o - l;
721
+ i.rgb.hcg = function(t) {
722
+ const e = t[0] / 255, n = t[1] / 255, r = t[2] / 255, o = Math.max(Math.max(e, n), r), l = Math.min(Math.min(e, n), r), s = o - l;
694
723
  let a;
695
- const i = s < 1 ? l / (1 - s) : 0;
696
- return s <= 0 ? a = 0 : o === t ? a = (n - r) / s % 6 : o === n ? a = 2 + (r - t) / s : a = 4 + (t - n) / s, a /= 6, a %= 1, [a * 360, s * 100, i * 100];
724
+ const c = s < 1 ? l / (1 - s) : 0;
725
+ return s <= 0 ? a = 0 : o === e ? a = (n - r) / s % 6 : o === n ? a = 2 + (r - e) / s : a = 4 + (e - n) / s, a /= 6, a %= 1, [a * 360, s * 100, c * 100];
697
726
  };
698
- c.hsl.hcg = function(e) {
699
- const t = e[1] / 100, n = e[2] / 100, r = n < 0.5 ? 2 * t * n : 2 * t * (1 - n);
727
+ i.hsl.hcg = function(t) {
728
+ const e = t[1] / 100, n = t[2] / 100, r = n < 0.5 ? 2 * e * n : 2 * e * (1 - n);
700
729
  let o = 0;
701
- return r < 1 && (o = (n - 0.5 * r) / (1 - r)), [e[0], r * 100, o * 100];
730
+ return r < 1 && (o = (n - 0.5 * r) / (1 - r)), [t[0], r * 100, o * 100];
702
731
  };
703
- c.hsv.hcg = function(e) {
704
- const t = e[1] / 100, n = e[2] / 100, r = t * n;
732
+ i.hsv.hcg = function(t) {
733
+ const e = t[1] / 100, n = t[2] / 100, r = e * n;
705
734
  let o = 0;
706
- return r < 1 && (o = (n - r) / (1 - r)), [e[0], r * 100, o * 100];
735
+ return r < 1 && (o = (n - r) / (1 - r)), [t[0], r * 100, o * 100];
707
736
  };
708
- c.hcg.rgb = function(e) {
709
- const t = e[0] / 360, n = e[1] / 100, r = e[2] / 100;
737
+ i.hcg.rgb = function(t) {
738
+ const e = t[0] / 360, n = t[1] / 100, r = t[2] / 100;
710
739
  if (n === 0)
711
740
  return [r * 255, r * 255, r * 255];
712
- const o = [0, 0, 0], l = t % 1 * 6, s = l % 1, a = 1 - s;
713
- let i = 0;
741
+ const o = [0, 0, 0], l = e % 1 * 6, s = l % 1, a = 1 - s;
742
+ let c = 0;
714
743
  switch (Math.floor(l)) {
715
744
  case 0: {
716
745
  o[0] = 1, o[1] = s, o[2] = 0;
@@ -735,184 +764,184 @@ c.hcg.rgb = function(e) {
735
764
  default:
736
765
  o[0] = 1, o[1] = 0, o[2] = a;
737
766
  }
738
- return i = (1 - n) * r, [
739
- (n * o[0] + i) * 255,
740
- (n * o[1] + i) * 255,
741
- (n * o[2] + i) * 255
767
+ return c = (1 - n) * r, [
768
+ (n * o[0] + c) * 255,
769
+ (n * o[1] + c) * 255,
770
+ (n * o[2] + c) * 255
742
771
  ];
743
772
  };
744
- c.hcg.hsv = function(e) {
745
- const t = e[1] / 100, n = e[2] / 100, r = t + n * (1 - t);
773
+ i.hcg.hsv = function(t) {
774
+ const e = t[1] / 100, n = t[2] / 100, r = e + n * (1 - e);
746
775
  let o = 0;
747
- return r > 0 && (o = t / r), [e[0], o * 100, r * 100];
776
+ return r > 0 && (o = e / r), [t[0], o * 100, r * 100];
748
777
  };
749
- c.hcg.hsl = function(e) {
750
- const t = e[1] / 100, r = e[2] / 100 * (1 - t) + 0.5 * t;
778
+ i.hcg.hsl = function(t) {
779
+ const e = t[1] / 100, r = t[2] / 100 * (1 - e) + 0.5 * e;
751
780
  let o = 0;
752
- return r > 0 && r < 0.5 ? o = t / (2 * r) : r >= 0.5 && r < 1 && (o = t / (2 * (1 - r))), [e[0], o * 100, r * 100];
781
+ return r > 0 && r < 0.5 ? o = e / (2 * r) : r >= 0.5 && r < 1 && (o = e / (2 * (1 - r))), [t[0], o * 100, r * 100];
753
782
  };
754
- c.hcg.hwb = function(e) {
755
- const t = e[1] / 100, n = e[2] / 100, r = t + n * (1 - t);
756
- return [e[0], (r - t) * 100, (1 - r) * 100];
783
+ i.hcg.hwb = function(t) {
784
+ const e = t[1] / 100, n = t[2] / 100, r = e + n * (1 - e);
785
+ return [t[0], (r - e) * 100, (1 - r) * 100];
757
786
  };
758
- c.hwb.hcg = function(e) {
759
- const t = e[1] / 100, r = 1 - e[2] / 100, o = r - t;
787
+ i.hwb.hcg = function(t) {
788
+ const e = t[1] / 100, r = 1 - t[2] / 100, o = r - e;
760
789
  let l = 0;
761
- return o < 1 && (l = (r - o) / (1 - o)), [e[0], o * 100, l * 100];
790
+ return o < 1 && (l = (r - o) / (1 - o)), [t[0], o * 100, l * 100];
762
791
  };
763
- c.apple.rgb = function(e) {
764
- return [e[0] / 65535 * 255, e[1] / 65535 * 255, e[2] / 65535 * 255];
792
+ i.apple.rgb = function(t) {
793
+ return [t[0] / 65535 * 255, t[1] / 65535 * 255, t[2] / 65535 * 255];
765
794
  };
766
- c.rgb.apple = function(e) {
767
- return [e[0] / 255 * 65535, e[1] / 255 * 65535, e[2] / 255 * 65535];
795
+ i.rgb.apple = function(t) {
796
+ return [t[0] / 255 * 65535, t[1] / 255 * 65535, t[2] / 255 * 65535];
768
797
  };
769
- c.gray.rgb = function(e) {
770
- return [e[0] / 100 * 255, e[0] / 100 * 255, e[0] / 100 * 255];
798
+ i.gray.rgb = function(t) {
799
+ return [t[0] / 100 * 255, t[0] / 100 * 255, t[0] / 100 * 255];
771
800
  };
772
- c.gray.hsl = function(e) {
773
- return [0, 0, e[0]];
801
+ i.gray.hsl = function(t) {
802
+ return [0, 0, t[0]];
774
803
  };
775
- c.gray.hsv = c.gray.hsl;
776
- c.gray.hwb = function(e) {
777
- return [0, 100, e[0]];
804
+ i.gray.hsv = i.gray.hsl;
805
+ i.gray.hwb = function(t) {
806
+ return [0, 100, t[0]];
778
807
  };
779
- c.gray.cmyk = function(e) {
780
- return [0, 0, 0, e[0]];
808
+ i.gray.cmyk = function(t) {
809
+ return [0, 0, 0, t[0]];
781
810
  };
782
- c.gray.lab = function(e) {
783
- return [e[0], 0, 0];
811
+ i.gray.lab = function(t) {
812
+ return [t[0], 0, 0];
784
813
  };
785
- c.gray.hex = function(e) {
786
- const t = Math.round(e[0] / 100 * 255) & 255, r = ((t << 16) + (t << 8) + t).toString(16).toUpperCase();
814
+ i.gray.hex = function(t) {
815
+ const e = Math.round(t[0] / 100 * 255) & 255, r = ((e << 16) + (e << 8) + e).toString(16).toUpperCase();
787
816
  return "000000".slice(r.length) + r;
788
817
  };
789
- c.rgb.gray = function(e) {
790
- return [(e[0] + e[1] + e[2]) / 3 / 255 * 100];
818
+ i.rgb.gray = function(t) {
819
+ return [(t[0] + t[1] + t[2]) / 3 / 255 * 100];
791
820
  };
792
- function I() {
793
- const e = {}, t = Object.keys(c);
794
- for (let { length: n } = t, r = 0; r < n; r++)
795
- e[t[r]] = {
821
+ function E() {
822
+ const t = {}, e = Object.keys(i);
823
+ for (let { length: n } = e, r = 0; r < n; r++)
824
+ t[e[r]] = {
796
825
  // http://jsperf.com/1-vs-infinity
797
826
  // micro-opt, but this is simple.
798
827
  distance: -1,
799
828
  parent: null
800
829
  };
801
- return e;
830
+ return t;
802
831
  }
803
- function j(e) {
804
- const t = I(), n = [e];
805
- for (t[e].distance = 0; n.length > 0; ) {
806
- const r = n.pop(), o = Object.keys(c[r]);
832
+ function $(t) {
833
+ const e = E(), n = [t];
834
+ for (e[t].distance = 0; n.length > 0; ) {
835
+ const r = n.pop(), o = Object.keys(i[r]);
807
836
  for (let { length: l } = o, s = 0; s < l; s++) {
808
- const a = o[s], i = t[a];
809
- i.distance === -1 && (i.distance = t[r].distance + 1, i.parent = r, n.unshift(a));
837
+ const a = o[s], c = e[a];
838
+ c.distance === -1 && (c.distance = e[r].distance + 1, c.parent = r, n.unshift(a));
810
839
  }
811
840
  }
812
- return t;
841
+ return e;
813
842
  }
814
- function E(e, t) {
843
+ function T(t, e) {
815
844
  return function(n) {
816
- return t(e(n));
845
+ return e(t(n));
817
846
  };
818
847
  }
819
- function $(e, t) {
820
- const n = [t[e].parent, e];
821
- let r = c[t[e].parent][e], o = t[e].parent;
822
- for (; t[o].parent; )
823
- n.unshift(t[o].parent), r = E(c[t[o].parent][o], r), o = t[o].parent;
848
+ function U(t, e) {
849
+ const n = [e[t].parent, t];
850
+ let r = i[e[t].parent][t], o = e[t].parent;
851
+ for (; e[o].parent; )
852
+ n.unshift(e[o].parent), r = T(i[e[o].parent][o], r), o = e[o].parent;
824
853
  return r.conversion = n, r;
825
854
  }
826
- function T(e) {
827
- const t = j(e), n = {}, r = Object.keys(t);
855
+ function D(t) {
856
+ const e = $(t), n = {}, r = Object.keys(e);
828
857
  for (let { length: o } = r, l = 0; l < o; l++) {
829
858
  const s = r[l];
830
- t[s].parent !== null && (n[s] = $(s, t));
859
+ e[s].parent !== null && (n[s] = U(s, e));
831
860
  }
832
861
  return n;
833
862
  }
834
- const g = {}, U = Object.keys(c);
835
- function D(e) {
836
- const t = function(...n) {
863
+ const g = {}, K = Object.keys(i);
864
+ function B(t) {
865
+ const e = function(...n) {
837
866
  const r = n[0];
838
- return r == null ? r : (r.length > 1 && (n = r), e(n));
867
+ return r == null ? r : (r.length > 1 && (n = r), t(n));
839
868
  };
840
- return "conversion" in e && (t.conversion = e.conversion), t;
869
+ return "conversion" in t && (e.conversion = t.conversion), e;
841
870
  }
842
- function K(e) {
843
- const t = function(...n) {
871
+ function V(t) {
872
+ const e = function(...n) {
844
873
  const r = n[0];
845
874
  if (r == null)
846
875
  return r;
847
876
  r.length > 1 && (n = r);
848
- const o = e(n);
877
+ const o = t(n);
849
878
  if (typeof o == "object")
850
879
  for (let { length: l } = o, s = 0; s < l; s++)
851
880
  o[s] = Math.round(o[s]);
852
881
  return o;
853
882
  };
854
- return "conversion" in e && (t.conversion = e.conversion), t;
883
+ return "conversion" in t && (e.conversion = t.conversion), e;
855
884
  }
856
- for (const e of U) {
857
- g[e] = {}, Object.defineProperty(g[e], "channels", { value: c[e].channels }), Object.defineProperty(g[e], "labels", { value: c[e].labels });
858
- const t = T(e), n = Object.keys(t);
885
+ for (const t of K) {
886
+ g[t] = {}, Object.defineProperty(g[t], "channels", { value: i[t].channels }), Object.defineProperty(g[t], "labels", { value: i[t].labels });
887
+ const e = D(t), n = Object.keys(e);
859
888
  for (const r of n) {
860
- const o = t[r];
861
- g[e][r] = K(o), g[e][r].raw = D(o);
889
+ const o = e[r];
890
+ g[t][r] = V(o), g[t][r].raw = B(o);
862
891
  }
863
892
  }
864
- const C = [
893
+ const A = [
865
894
  // To be honest, I don't really feel like keyword belongs in color convert, but eh.
866
895
  "keyword",
867
896
  // Gray conflicts with some method names, and has its own method defined.
868
897
  "gray",
869
898
  // Shouldn't really be in color-convert either...
870
899
  "hex"
871
- ], F = {};
872
- for (const e of Object.keys(g))
873
- F[[...g[e].labels].sort().join("")] = e;
874
- const v = {};
875
- function b(e, t) {
900
+ ], O = {};
901
+ for (const t of Object.keys(g))
902
+ O[[...g[t].labels].sort().join("")] = t;
903
+ const M = {};
904
+ function b(t, e) {
876
905
  if (!(this instanceof b))
877
- return new b(e, t);
878
- if (t && t in C && (t = null), t && !(t in g))
879
- throw new Error("Unknown model: " + t);
906
+ return new b(t, e);
907
+ if (e && e in A && (e = null), e && !(e in g))
908
+ throw new Error("Unknown model: " + e);
880
909
  let n, r;
881
- if (e == null)
910
+ if (t == null)
882
911
  this.model = "rgb", this.color = [0, 0, 0], this.valpha = 1;
883
- else if (e instanceof b)
884
- this.model = e.model, this.color = [...e.color], this.valpha = e.valpha;
885
- else if (typeof e == "string") {
886
- const o = d.get(e);
912
+ else if (t instanceof b)
913
+ this.model = t.model, this.color = [...t.color], this.valpha = t.valpha;
914
+ else if (typeof t == "string") {
915
+ const o = d.get(t);
887
916
  if (o === null)
888
- throw new Error("Unable to parse color from string: " + e);
917
+ throw new Error("Unable to parse color from string: " + t);
889
918
  this.model = o.model, r = g[this.model].channels, this.color = o.value.slice(0, r), this.valpha = typeof o.value[r] == "number" ? o.value[r] : 1;
890
- } else if (e.length > 0) {
891
- this.model = t || "rgb", r = g[this.model].channels;
892
- const o = Array.prototype.slice.call(e, 0, r);
893
- this.color = N(o, r), this.valpha = typeof e[r] == "number" ? e[r] : 1;
894
- } else if (typeof e == "number")
919
+ } else if (t.length > 0) {
920
+ this.model = e || "rgb", r = g[this.model].channels;
921
+ const o = Array.prototype.slice.call(t, 0, r);
922
+ this.color = q(o, r), this.valpha = typeof t[r] == "number" ? t[r] : 1;
923
+ } else if (typeof t == "number")
895
924
  this.model = "rgb", this.color = [
896
- e >> 16 & 255,
897
- e >> 8 & 255,
898
- e & 255
925
+ t >> 16 & 255,
926
+ t >> 8 & 255,
927
+ t & 255
899
928
  ], this.valpha = 1;
900
929
  else {
901
930
  this.valpha = 1;
902
- const o = Object.keys(e);
903
- "alpha" in e && (o.splice(o.indexOf("alpha"), 1), this.valpha = typeof e.alpha == "number" ? e.alpha : 0);
931
+ const o = Object.keys(t);
932
+ "alpha" in t && (o.splice(o.indexOf("alpha"), 1), this.valpha = typeof t.alpha == "number" ? t.alpha : 0);
904
933
  const l = o.sort().join("");
905
- if (!(l in F))
906
- throw new Error("Unable to parse color from object: " + JSON.stringify(e));
907
- this.model = F[l];
934
+ if (!(l in O))
935
+ throw new Error("Unable to parse color from object: " + JSON.stringify(t));
936
+ this.model = O[l];
908
937
  const { labels: s } = g[this.model], a = [];
909
938
  for (n = 0; n < s.length; n++)
910
- a.push(e[s[n]]);
911
- this.color = N(a);
939
+ a.push(t[s[n]]);
940
+ this.color = q(a);
912
941
  }
913
- if (v[this.model])
942
+ if (M[this.model])
914
943
  for (r = g[this.model].channels, n = 0; n < r; n++) {
915
- const o = v[this.model][n];
944
+ const o = M[this.model][n];
916
945
  o && (this.color[n] = o(this.color[n]));
917
946
  }
918
947
  this.valpha = Math.max(0, Math.min(1, this.valpha)), Object.freeze && Object.freeze(this);
@@ -924,44 +953,44 @@ b.prototype = {
924
953
  toJSON() {
925
954
  return this[this.model]();
926
955
  },
927
- string(e) {
928
- let t = this.model in d.to ? this : this.rgb();
929
- t = t.round(typeof e == "number" ? e : 1);
930
- const n = t.valpha === 1 ? t.color : [...t.color, this.valpha];
931
- return d.to[t.model](...n);
956
+ string(t) {
957
+ let e = this.model in d.to ? this : this.rgb();
958
+ e = e.round(typeof t == "number" ? t : 1);
959
+ const n = e.valpha === 1 ? e.color : [...e.color, this.valpha];
960
+ return d.to[e.model](...n);
932
961
  },
933
- percentString(e) {
934
- const t = this.rgb().round(typeof e == "number" ? e : 1), n = t.valpha === 1 ? t.color : [...t.color, this.valpha];
962
+ percentString(t) {
963
+ const e = this.rgb().round(typeof t == "number" ? t : 1), n = e.valpha === 1 ? e.color : [...e.color, this.valpha];
935
964
  return d.to.rgb.percent(...n);
936
965
  },
937
966
  array() {
938
967
  return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
939
968
  },
940
969
  object() {
941
- const e = {}, { channels: t } = g[this.model], { labels: n } = g[this.model];
942
- for (let r = 0; r < t; r++)
943
- e[n[r]] = this.color[r];
944
- return this.valpha !== 1 && (e.alpha = this.valpha), e;
970
+ const t = {}, { channels: e } = g[this.model], { labels: n } = g[this.model];
971
+ for (let r = 0; r < e; r++)
972
+ t[n[r]] = this.color[r];
973
+ return this.valpha !== 1 && (t.alpha = this.valpha), t;
945
974
  },
946
975
  unitArray() {
947
- const e = this.rgb().color;
948
- return e[0] /= 255, e[1] /= 255, e[2] /= 255, this.valpha !== 1 && e.push(this.valpha), e;
976
+ const t = this.rgb().color;
977
+ return t[0] /= 255, t[1] /= 255, t[2] /= 255, this.valpha !== 1 && t.push(this.valpha), t;
949
978
  },
950
979
  unitObject() {
951
- const e = this.rgb().object();
952
- return e.r /= 255, e.g /= 255, e.b /= 255, this.valpha !== 1 && (e.alpha = this.valpha), e;
980
+ const t = this.rgb().object();
981
+ return t.r /= 255, t.g /= 255, t.b /= 255, this.valpha !== 1 && (t.alpha = this.valpha), t;
953
982
  },
954
- round(e) {
955
- return e = Math.max(e || 0, 0), new b([...this.color.map(V(e)), this.valpha], this.model);
983
+ round(t) {
984
+ return t = Math.max(t || 0, 0), new b([...this.color.map(R(t)), this.valpha], this.model);
956
985
  },
957
- alpha(e) {
958
- return e !== void 0 ? new b([...this.color, Math.max(0, Math.min(1, e))], this.model) : this.valpha;
986
+ alpha(t) {
987
+ return t !== void 0 ? new b([...this.color, Math.max(0, Math.min(1, t))], this.model) : this.valpha;
959
988
  },
960
989
  // Rgb
961
990
  red: h("rgb", 0, f(255)),
962
991
  green: h("rgb", 1, f(255)),
963
992
  blue: h("rgb", 2, f(255)),
964
- hue: h(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, (e) => (e % 360 + 360) % 360),
993
+ hue: h(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, (t) => (t % 360 + 360) % 360),
965
994
  saturationl: h("hsl", 1, f(100)),
966
995
  lightness: h("hsl", 2, f(100)),
967
996
  saturationv: h("hsv", 1, f(100)),
@@ -980,175 +1009,175 @@ b.prototype = {
980
1009
  l: h("lab", 0, f(100)),
981
1010
  a: h("lab", 1),
982
1011
  b: h("lab", 2),
983
- keyword(e) {
984
- return e !== void 0 ? new b(e) : g[this.model].keyword(this.color);
1012
+ keyword(t) {
1013
+ return t !== void 0 ? new b(t) : g[this.model].keyword(this.color);
985
1014
  },
986
- hex(e) {
987
- return e !== void 0 ? new b(e) : d.to.hex(...this.rgb().round().color);
1015
+ hex(t) {
1016
+ return t !== void 0 ? new b(t) : d.to.hex(...this.rgb().round().color);
988
1017
  },
989
- hexa(e) {
990
- if (e !== void 0)
991
- return new b(e);
992
- const t = this.rgb().round().color;
1018
+ hexa(t) {
1019
+ if (t !== void 0)
1020
+ return new b(t);
1021
+ const e = this.rgb().round().color;
993
1022
  let n = Math.round(this.valpha * 255).toString(16).toUpperCase();
994
- return n.length === 1 && (n = "0" + n), d.to.hex(...t) + n;
1023
+ return n.length === 1 && (n = "0" + n), d.to.hex(...e) + n;
995
1024
  },
996
1025
  rgbNumber() {
997
- const e = this.rgb().color;
998
- return (e[0] & 255) << 16 | (e[1] & 255) << 8 | e[2] & 255;
1026
+ const t = this.rgb().color;
1027
+ return (t[0] & 255) << 16 | (t[1] & 255) << 8 | t[2] & 255;
999
1028
  },
1000
1029
  luminosity() {
1001
- const e = this.rgb().color, t = [];
1002
- for (const [n, r] of e.entries()) {
1030
+ const t = this.rgb().color, e = [];
1031
+ for (const [n, r] of t.entries()) {
1003
1032
  const o = r / 255;
1004
- t[n] = o <= 0.04045 ? o / 12.92 : ((o + 0.055) / 1.055) ** 2.4;
1033
+ e[n] = o <= 0.04045 ? o / 12.92 : ((o + 0.055) / 1.055) ** 2.4;
1005
1034
  }
1006
- return 0.2126 * t[0] + 0.7152 * t[1] + 0.0722 * t[2];
1035
+ return 0.2126 * e[0] + 0.7152 * e[1] + 0.0722 * e[2];
1007
1036
  },
1008
- contrast(e) {
1009
- const t = this.luminosity(), n = e.luminosity();
1010
- return t > n ? (t + 0.05) / (n + 0.05) : (n + 0.05) / (t + 0.05);
1037
+ contrast(t) {
1038
+ const e = this.luminosity(), n = t.luminosity();
1039
+ return e > n ? (e + 0.05) / (n + 0.05) : (n + 0.05) / (e + 0.05);
1011
1040
  },
1012
- level(e) {
1013
- const t = this.contrast(e);
1014
- return t >= 7 ? "AAA" : t >= 4.5 ? "AA" : "";
1041
+ level(t) {
1042
+ const e = this.contrast(t);
1043
+ return e >= 7 ? "AAA" : e >= 4.5 ? "AA" : "";
1015
1044
  },
1016
1045
  isDark() {
1017
- const e = this.rgb().color;
1018
- return (e[0] * 2126 + e[1] * 7152 + e[2] * 722) / 1e4 < 128;
1046
+ const t = this.rgb().color;
1047
+ return (t[0] * 2126 + t[1] * 7152 + t[2] * 722) / 1e4 < 128;
1019
1048
  },
1020
1049
  isLight() {
1021
1050
  return !this.isDark();
1022
1051
  },
1023
1052
  negate() {
1024
- const e = this.rgb();
1025
- for (let t = 0; t < 3; t++)
1026
- e.color[t] = 255 - e.color[t];
1027
- return e;
1053
+ const t = this.rgb();
1054
+ for (let e = 0; e < 3; e++)
1055
+ t.color[e] = 255 - t.color[e];
1056
+ return t;
1028
1057
  },
1029
- lighten(e) {
1030
- const t = this.hsl();
1031
- return t.color[2] += t.color[2] * e, t;
1058
+ lighten(t) {
1059
+ const e = this.hsl();
1060
+ return e.color[2] += e.color[2] * t, e;
1032
1061
  },
1033
- darken(e) {
1034
- const t = this.hsl();
1035
- return t.color[2] -= t.color[2] * e, t;
1062
+ darken(t) {
1063
+ const e = this.hsl();
1064
+ return e.color[2] -= e.color[2] * t, e;
1036
1065
  },
1037
- saturate(e) {
1038
- const t = this.hsl();
1039
- return t.color[1] += t.color[1] * e, t;
1066
+ saturate(t) {
1067
+ const e = this.hsl();
1068
+ return e.color[1] += e.color[1] * t, e;
1040
1069
  },
1041
- desaturate(e) {
1042
- const t = this.hsl();
1043
- return t.color[1] -= t.color[1] * e, t;
1070
+ desaturate(t) {
1071
+ const e = this.hsl();
1072
+ return e.color[1] -= e.color[1] * t, e;
1044
1073
  },
1045
- whiten(e) {
1046
- const t = this.hwb();
1047
- return t.color[1] += t.color[1] * e, t;
1074
+ whiten(t) {
1075
+ const e = this.hwb();
1076
+ return e.color[1] += e.color[1] * t, e;
1048
1077
  },
1049
- blacken(e) {
1050
- const t = this.hwb();
1051
- return t.color[2] += t.color[2] * e, t;
1078
+ blacken(t) {
1079
+ const e = this.hwb();
1080
+ return e.color[2] += e.color[2] * t, e;
1052
1081
  },
1053
1082
  grayscale() {
1054
- const e = this.rgb().color, t = e[0] * 0.3 + e[1] * 0.59 + e[2] * 0.11;
1055
- return b.rgb(t, t, t);
1083
+ const t = this.rgb().color, e = t[0] * 0.3 + t[1] * 0.59 + t[2] * 0.11;
1084
+ return b.rgb(e, e, e);
1056
1085
  },
1057
- fade(e) {
1058
- return this.alpha(this.valpha - this.valpha * e);
1086
+ fade(t) {
1087
+ return this.alpha(this.valpha - this.valpha * t);
1059
1088
  },
1060
- opaquer(e) {
1061
- return this.alpha(this.valpha + this.valpha * e);
1089
+ opaquer(t) {
1090
+ return this.alpha(this.valpha + this.valpha * t);
1062
1091
  },
1063
- rotate(e) {
1064
- const t = this.hsl();
1065
- let n = t.color[0];
1066
- return n = (n + e) % 360, n = n < 0 ? 360 + n : n, t.color[0] = n, t;
1092
+ rotate(t) {
1093
+ const e = this.hsl();
1094
+ let n = e.color[0];
1095
+ return n = (n + t) % 360, n = n < 0 ? 360 + n : n, e.color[0] = n, e;
1067
1096
  },
1068
- mix(e, t) {
1069
- if (!e || !e.rgb)
1070
- throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof e);
1071
- const n = e.rgb(), r = this.rgb(), o = t === void 0 ? 0.5 : t, l = 2 * o - 1, s = n.alpha() - r.alpha(), a = ((l * s === -1 ? l : (l + s) / (1 + l * s)) + 1) / 2, i = 1 - a;
1097
+ mix(t, e) {
1098
+ if (!t || !t.rgb)
1099
+ throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof t);
1100
+ const n = t.rgb(), r = this.rgb(), o = e === void 0 ? 0.5 : e, l = 2 * o - 1, s = n.alpha() - r.alpha(), a = ((l * s === -1 ? l : (l + s) / (1 + l * s)) + 1) / 2, c = 1 - a;
1072
1101
  return b.rgb(
1073
- a * n.red() + i * r.red(),
1074
- a * n.green() + i * r.green(),
1075
- a * n.blue() + i * r.blue(),
1102
+ a * n.red() + c * r.red(),
1103
+ a * n.green() + c * r.green(),
1104
+ a * n.blue() + c * r.blue(),
1076
1105
  n.alpha() * o + r.alpha() * (1 - o)
1077
1106
  );
1078
1107
  }
1079
1108
  };
1080
- for (const e of Object.keys(g)) {
1081
- if (C.includes(e))
1109
+ for (const t of Object.keys(g)) {
1110
+ if (A.includes(t))
1082
1111
  continue;
1083
- const { channels: t } = g[e];
1084
- b.prototype[e] = function(...n) {
1085
- return this.model === e ? new b(this) : n.length > 0 ? new b(n, e) : new b([...L(g[this.model][e].raw(this.color)), this.valpha], e);
1086
- }, b[e] = function(...n) {
1112
+ const { channels: e } = g[t];
1113
+ b.prototype[t] = function(...n) {
1114
+ return this.model === t ? new b(this) : n.length > 0 ? new b(n, t) : new b([...J(g[this.model][t].raw(this.color)), this.valpha], t);
1115
+ }, b[t] = function(...n) {
1087
1116
  let r = n[0];
1088
- return typeof r == "number" && (r = N(n, t)), new b(r, e);
1117
+ return typeof r == "number" && (r = q(n, e)), new b(r, t);
1089
1118
  };
1090
1119
  }
1091
- function B(e, t) {
1092
- return Number(e.toFixed(t));
1120
+ function L(t, e) {
1121
+ return Number(t.toFixed(e));
1093
1122
  }
1094
- function V(e) {
1095
- return function(t) {
1096
- return B(t, e);
1123
+ function R(t) {
1124
+ return function(e) {
1125
+ return L(e, t);
1097
1126
  };
1098
1127
  }
1099
- function h(e, t, n) {
1100
- e = Array.isArray(e) ? e : [e];
1101
- for (const r of e)
1102
- (v[r] || (v[r] = []))[t] = n;
1103
- return e = e[0], function(r) {
1128
+ function h(t, e, n) {
1129
+ t = Array.isArray(t) ? t : [t];
1130
+ for (const r of t)
1131
+ (M[r] || (M[r] = []))[e] = n;
1132
+ return t = t[0], function(r) {
1104
1133
  let o;
1105
- return r !== void 0 ? (n && (r = n(r)), o = this[e](), o.color[t] = r, o) : (o = this[e]().color[t], n && (o = n(o)), o);
1134
+ return r !== void 0 ? (n && (r = n(r)), o = this[t](), o.color[e] = r, o) : (o = this[t]().color[e], n && (o = n(o)), o);
1106
1135
  };
1107
1136
  }
1108
- function f(e) {
1109
- return function(t) {
1110
- return Math.max(0, Math.min(e, t));
1137
+ function f(t) {
1138
+ return function(e) {
1139
+ return Math.max(0, Math.min(t, e));
1111
1140
  };
1112
1141
  }
1113
- function L(e) {
1114
- return Array.isArray(e) ? e : [e];
1142
+ function J(t) {
1143
+ return Array.isArray(t) ? t : [t];
1115
1144
  }
1116
- function N(e, t) {
1117
- for (let n = 0; n < t; n++)
1118
- typeof e[n] != "number" && (e[n] = 0);
1119
- return e;
1145
+ function q(t, e) {
1146
+ for (let n = 0; n < e; n++)
1147
+ typeof t[n] != "number" && (t[n] = 0);
1148
+ return t;
1120
1149
  }
1121
- class R {
1122
- constructor(t) {
1123
- _(this, "isColor", !0);
1124
- _(this, "currentColor");
1125
- this.base = t;
1126
- const n = this._resolveBaseColor(t);
1150
+ class G {
1151
+ constructor(e) {
1152
+ N(this, "isColor", !0);
1153
+ N(this, "currentColor");
1154
+ this.base = e;
1155
+ const n = this._resolveBaseColor(e);
1127
1156
  return this.currentColor = b(n), this._createProxy();
1128
1157
  }
1129
1158
  _createProxy() {
1130
1159
  return new Proxy(this, {
1131
- get(t, n) {
1132
- return n in t ? t[n] : n in t.currentColor ? t._handleColorMethod(n) : t[n];
1160
+ get(e, n) {
1161
+ return n in e ? e[n] : n in e.currentColor ? e._handleColorMethod(n) : e[n];
1133
1162
  }
1134
1163
  });
1135
1164
  }
1136
- _resolveBaseColor(t) {
1137
- if (typeof t != "string" || !/\{[^{}]+\}/g.test(t)) return t;
1165
+ _resolveBaseColor(e) {
1166
+ if (typeof e != "string" || !/\{[^{}]+\}/g.test(e)) return e;
1138
1167
  if (typeof saltyConfig > "u") return "transparent";
1139
1168
  const { staticVariables: r } = saltyConfig;
1140
- return r ? t.replace(/^\{|\}$/g, "").split(".").reduce((s, a) => s[a], r) : "transparent";
1169
+ return r ? e.replace(/^\{|\}$/g, "").split(".").reduce((s, a) => s[a], r) : "transparent";
1141
1170
  }
1142
- _handleColorMethod(t) {
1171
+ _handleColorMethod(e) {
1143
1172
  const n = this.currentColor;
1144
- return typeof n[t] != "function" ? n[t] : (...r) => (this.currentColor = n[t](...r), this._createProxy());
1173
+ return typeof n[e] != "function" ? n[e] : (...r) => (this.currentColor = n[e](...r), this._createProxy());
1145
1174
  }
1146
1175
  toString() {
1147
1176
  return this.currentColor.toString();
1148
1177
  }
1149
1178
  }
1150
- const G = (e) => new R(e);
1179
+ const Y = (t) => new G(t);
1151
1180
  export {
1152
- G as color,
1153
- Q as defineViewportClamp
1181
+ Y as color,
1182
+ X as defineViewportClamp
1154
1183
  };