var te = (t) => { throw TypeError(t); }; var ee = (t, e, n) => e.has(t) || te("Cannot " + n); var R = (t, e, n) => (ee(t, e, "read from private field"), n ? n.call(t) : e.get(t)), ct = (t, e, n) => e.has(t) ? te("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), H = (t, e, n, r) => (ee(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n); const { min: Fe, max: Ue } = Math, ot = (t, e = 0, n = 1) => Fe(Ue(e, t), n), Tt = (t) => { t._clipped = !1, t._unclipped = t.slice(0); for (let e = 0; e <= 3; e++) e < 3 ? ((t[e] < 0 || t[e] > 255) && (t._clipped = !0), t[e] = ot(t[e], 0, 255)) : e === 3 && (t[e] = ot(t[e], 0, 1)); return t; }, ge = {}; for (let t of [ "Boolean", "Number", "String", "Function", "Array", "Date", "RegExp", "Undefined", "Null" ]) ge[`[object ${t}]`] = t.toLowerCase(); function A(t) { return ge[Object.prototype.toString.call(t)] || "object"; } const M = (t, e = null) => t.length >= 3 ? Array.prototype.slice.call(t) : A(t[0]) == "object" && e ? e.split("").filter((n) => t[0][n] !== void 0).map((n) => t[0][n]) : t[0].slice(0), ut = (t) => { if (t.length < 2) return null; const e = t.length - 1; return A(t[e]) == "string" ? t[e].toLowerCase() : null; }, { PI: Rt, min: me, max: we } = Math, T = (t) => Math.round(t * 100) / 100, qt = (t) => Math.round(t * 100) / 100, V = Rt * 2, Ct = Rt / 3, Ve = Rt / 180, Je = 180 / Rt; function ye(t) { return [...t.slice(0, 3).reverse(), ...t.slice(3)]; } const k = { format: {}, autodetect: [] }; let i = class { constructor(...e) { const n = this; if (A(e[0]) === "object" && e[0].constructor && e[0].constructor === this.constructor) return e[0]; let r = ut(e), o = !1; if (!r) { o = !0, k.sorted || (k.autodetect = k.autodetect.sort((c, s) => s.p - c.p), k.sorted = !0); for (let c of k.autodetect) if (r = c.test(...e), r) break; } if (k.format[r]) { const c = k.format[r].apply( null, o ? e : e.slice(0, -1) ); n._rgb = Tt(c); } else throw new Error("unknown format: " + e); n._rgb.length === 3 && n._rgb.push(1); } toString() { return A(this.hex) == "function" ? this.hex() : `[${this._rgb.join(",")}]`; } }; const Qe = "3.1.2", x = (...t) => new i(...t); x.version = Qe; const lt = { aliceblue: "#f0f8ff", antiquewhite: "#faebd7", aqua: "#00ffff", aquamarine: "#7fffd4", azure: "#f0ffff", beige: "#f5f5dc", bisque: "#ffe4c4", black: "#000000", blanchedalmond: "#ffebcd", blue: "#0000ff", blueviolet: "#8a2be2", brown: "#a52a2a", burlywood: "#deb887", cadetblue: "#5f9ea0", chartreuse: "#7fff00", chocolate: "#d2691e", coral: "#ff7f50", cornflowerblue: "#6495ed", cornsilk: "#fff8dc", crimson: "#dc143c", cyan: "#00ffff", darkblue: "#00008b", darkcyan: "#008b8b", darkgoldenrod: "#b8860b", darkgray: "#a9a9a9", darkgreen: "#006400", darkgrey: "#a9a9a9", darkkhaki: "#bdb76b", darkmagenta: "#8b008b", darkolivegreen: "#556b2f", darkorange: "#ff8c00", darkorchid: "#9932cc", darkred: "#8b0000", darksalmon: "#e9967a", darkseagreen: "#8fbc8f", darkslateblue: "#483d8b", darkslategray: "#2f4f4f", darkslategrey: "#2f4f4f", darkturquoise: "#00ced1", darkviolet: "#9400d3", deeppink: "#ff1493", deepskyblue: "#00bfff", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1e90ff", firebrick: "#b22222", floralwhite: "#fffaf0", forestgreen: "#228b22", fuchsia: "#ff00ff", gainsboro: "#dcdcdc", ghostwhite: "#f8f8ff", gold: "#ffd700", goldenrod: "#daa520", gray: "#808080", green: "#008000", greenyellow: "#adff2f", grey: "#808080", honeydew: "#f0fff0", hotpink: "#ff69b4", indianred: "#cd5c5c", indigo: "#4b0082", ivory: "#fffff0", khaki: "#f0e68c", laserlemon: "#ffff54", lavender: "#e6e6fa", lavenderblush: "#fff0f5", lawngreen: "#7cfc00", lemonchiffon: "#fffacd", lightblue: "#add8e6", lightcoral: "#f08080", lightcyan: "#e0ffff", lightgoldenrod: "#fafad2", lightgoldenrodyellow: "#fafad2", lightgray: "#d3d3d3", lightgreen: "#90ee90", lightgrey: "#d3d3d3", lightpink: "#ffb6c1", lightsalmon: "#ffa07a", lightseagreen: "#20b2aa", lightskyblue: "#87cefa", lightslategray: "#778899", lightslategrey: "#778899", lightsteelblue: "#b0c4de", lightyellow: "#ffffe0", lime: "#00ff00", limegreen: "#32cd32", linen: "#faf0e6", magenta: "#ff00ff", maroon: "#800000", maroon2: "#7f0000", maroon3: "#b03060", mediumaquamarine: "#66cdaa", mediumblue: "#0000cd", mediumorchid: "#ba55d3", mediumpurple: "#9370db", mediumseagreen: "#3cb371", mediumslateblue: "#7b68ee", mediumspringgreen: "#00fa9a", mediumturquoise: "#48d1cc", mediumvioletred: "#c71585", midnightblue: "#191970", mintcream: "#f5fffa", mistyrose: "#ffe4e1", moccasin: "#ffe4b5", navajowhite: "#ffdead", navy: "#000080", oldlace: "#fdf5e6", olive: "#808000", olivedrab: "#6b8e23", orange: "#ffa500", orangered: "#ff4500", orchid: "#da70d6", palegoldenrod: "#eee8aa", palegreen: "#98fb98", paleturquoise: "#afeeee", palevioletred: "#db7093", papayawhip: "#ffefd5", peachpuff: "#ffdab9", peru: "#cd853f", pink: "#ffc0cb", plum: "#dda0dd", powderblue: "#b0e0e6", purple: "#800080", purple2: "#7f007f", purple3: "#a020f0", rebeccapurple: "#663399", red: "#ff0000", rosybrown: "#bc8f8f", royalblue: "#4169e1", saddlebrown: "#8b4513", salmon: "#fa8072", sandybrown: "#f4a460", seagreen: "#2e8b57", seashell: "#fff5ee", sienna: "#a0522d", silver: "#c0c0c0", skyblue: "#87ceeb", slateblue: "#6a5acd", slategray: "#708090", slategrey: "#708090", snow: "#fffafa", springgreen: "#00ff7f", steelblue: "#4682b4", tan: "#d2b48c", teal: "#008080", thistle: "#d8bfd8", tomato: "#ff6347", turquoise: "#40e0d0", violet: "#ee82ee", wheat: "#f5deb3", white: "#ffffff", whitesmoke: "#f5f5f5", yellow: "#ffff00", yellowgreen: "#9acd32" }, tn = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/, en = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/, ke = (t) => { if (t.match(tn)) { (t.length === 4 || t.length === 7) && (t = t.substr(1)), t.length === 3 && (t = t.split(""), t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2]); const e = parseInt(t, 16), n = e >> 16, r = e >> 8 & 255, o = e & 255; return [n, r, o, 1]; } if (t.match(en)) { (t.length === 5 || t.length === 9) && (t = t.substr(1)), t.length === 4 && (t = t.split(""), t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2] + t[3] + t[3]); const e = parseInt(t, 16), n = e >> 24 & 255, r = e >> 16 & 255, o = e >> 8 & 255, c = Math.round((e & 255) / 255 * 100) / 100; return [n, r, o, c]; } throw new Error(`unknown hex color: ${t}`); }, { round: kt } = Math, _e = (...t) => { let [e, n, r, o] = M(t, "rgba"), c = ut(t) || "auto"; o === void 0 && (o = 1), c === "auto" && (c = o < 1 ? "rgba" : "rgb"), e = kt(e), n = kt(n), r = kt(r); let f = "000000" + (e << 16 | n << 8 | r).toString(16); f = f.substr(f.length - 6); let a = "0" + kt(o * 255).toString(16); switch (a = a.substr(a.length - 2), c.toLowerCase()) { case "rgba": return `#${f}${a}`; case "argb": return `#${a}${f}`; default: return `#${f}`; } }; i.prototype.name = function() { const t = _e(this._rgb, "rgb"); for (let e of Object.keys(lt)) if (lt[e] === t) return e.toLowerCase(); return t; }; k.format.named = (t) => { if (t = t.toLowerCase(), lt[t]) return ke(lt[t]); throw new Error("unknown color name: " + t); }; k.autodetect.push({ p: 5, test: (t, ...e) => { if (!e.length && A(t) === "string" && lt[t.toLowerCase()]) return "named"; } }); i.prototype.alpha = function(t, e = !1) { return t !== void 0 && A(t) === "number" ? e ? (this._rgb[3] = t, this) : new i([this._rgb[0], this._rgb[1], this._rgb[2], t], "rgb") : this._rgb[3]; }; i.prototype.clipped = function() { return this._rgb._clipped || !1; }; const F = { // Corresponds roughly to RGB brighter/darker Kn: 18, // D65 standard referent labWhitePoint: "d65", Xn: 0.95047, Yn: 1, Zn: 1.08883, kE: 216 / 24389, kKE: 8, kK: 24389 / 27, RefWhiteRGB: { // sRGB X: 0.95047, Y: 1, Z: 1.08883 }, MtxRGB2XYZ: { m00: 0.4124564390896922, m01: 0.21267285140562253, m02: 0.0193338955823293, m10: 0.357576077643909, m11: 0.715152155287818, m12: 0.11919202588130297, m20: 0.18043748326639894, m21: 0.07217499330655958, m22: 0.9503040785363679 }, MtxXYZ2RGB: { m00: 3.2404541621141045, m01: -0.9692660305051868, m02: 0.055643430959114726, m10: -1.5371385127977166, m11: 1.8760108454466942, m12: -0.2040259135167538, m20: -0.498531409556016, m21: 0.041556017530349834, m22: 1.0572251882231791 }, // used in rgb2xyz As: 0.9414285350000001, Bs: 1.040417467, Cs: 1.089532651, MtxAdaptMa: { m00: 0.8951, m01: -0.7502, m02: 0.0389, m10: 0.2664, m11: 1.7135, m12: -0.0685, m20: -0.1614, m21: 0.0367, m22: 1.0296 }, MtxAdaptMaI: { m00: 0.9869929054667123, m01: 0.43230526972339456, m02: -0.008528664575177328, m10: -0.14705425642099013, m11: 0.5183602715367776, m12: 0.04004282165408487, m20: 0.15996265166373125, m21: 0.0492912282128556, m22: 0.9684866957875502 } }, nn = /* @__PURE__ */ new Map([ // ASTM E308-01 ["a", [1.0985, 0.35585]], // Wyszecki & Stiles, p. 769 ["b", [1.0985, 0.35585]], // C ASTM E308-01 ["c", [0.98074, 1.18232]], // D50 (ASTM E308-01) ["d50", [0.96422, 0.82521]], // D55 (ASTM E308-01) ["d55", [0.95682, 0.92149]], // D65 (ASTM E308-01) ["d65", [0.95047, 1.08883]], // E (ASTM E308-01) ["e", [1, 1, 1]], // F2 (ASTM E308-01) ["f2", [0.99186, 0.67393]], // F7 (ASTM E308-01) ["f7", [0.95041, 1.08747]], // F11 (ASTM E308-01) ["f11", [1.00962, 0.6435]], ["icc", [0.96422, 0.82521]] ]); function Q(t) { const e = nn.get(String(t).toLowerCase()); if (!e) throw new Error("unknown Lab illuminant " + t); F.labWhitePoint = t, F.Xn = e[0], F.Zn = e[1]; } function mt() { return F.labWhitePoint; } const Kt = (...t) => { t = M(t, "lab"); const [e, n, r] = t, [o, c, s] = rn(e, n, r), [f, a, l] = Me(o, c, s); return [f, a, l, t.length > 3 ? t[3] : 1]; }, rn = (t, e, n) => { const { kE: r, kK: o, kKE: c, Xn: s, Yn: f, Zn: a } = F, l = (t + 16) / 116, b = 2e-3 * e + l, d = l - 5e-3 * n, h = b * b * b, p = d * d * d, _ = h > r ? h : (116 * b - 16) / o, C = t > c ? Math.pow((t + 16) / 116, 3) : t / o, w = p > r ? p : (116 * d - 16) / o, m = _ * s, G = C * f, B = w * a; return [m, G, B]; }, vt = (t) => { const e = Math.sign(t); return t = Math.abs(t), (t <= 31308e-7 ? t * 12.92 : 1.055 * Math.pow(t, 1 / 2.4) - 0.055) * e; }, Me = (t, e, n) => { const { MtxAdaptMa: r, MtxAdaptMaI: o, MtxXYZ2RGB: c, RefWhiteRGB: s, Xn: f, Yn: a, Zn: l } = F, b = f * r.m00 + a * r.m10 + l * r.m20, d = f * r.m01 + a * r.m11 + l * r.m21, h = f * r.m02 + a * r.m12 + l * r.m22, p = s.X * r.m00 + s.Y * r.m10 + s.Z * r.m20, _ = s.X * r.m01 + s.Y * r.m11 + s.Z * r.m21, C = s.X * r.m02 + s.Y * r.m12 + s.Z * r.m22, w = (t * r.m00 + e * r.m10 + n * r.m20) * (p / b), m = (t * r.m01 + e * r.m11 + n * r.m21) * (_ / d), G = (t * r.m02 + e * r.m12 + n * r.m22) * (C / h), B = w * o.m00 + m * o.m10 + G * o.m20, j = w * o.m01 + m * o.m11 + G * o.m21, S = w * o.m02 + m * o.m12 + G * o.m22, L = vt( B * c.m00 + j * c.m10 + S * c.m20 ), u = vt( B * c.m01 + j * c.m11 + S * c.m21 ), g = vt( B * c.m02 + j * c.m12 + S * c.m22 ); return [L * 255, u * 255, g * 255]; }, Ht = (...t) => { const [e, n, r, ...o] = M(t, "rgb"), [c, s, f] = $e(e, n, r), [a, l, b] = on(c, s, f); return [a, l, b, ...o.length > 0 && o[0] < 1 ? [o[0]] : []]; }; function on(t, e, n) { const { Xn: r, Yn: o, Zn: c, kE: s, kK: f } = F, a = t / r, l = e / o, b = n / c, d = a > s ? Math.pow(a, 1 / 3) : (f * a + 16) / 116, h = l > s ? Math.pow(l, 1 / 3) : (f * l + 16) / 116, p = b > s ? Math.pow(b, 1 / 3) : (f * b + 16) / 116; return [116 * h - 16, 500 * (d - h), 200 * (h - p)]; } function jt(t) { const e = Math.sign(t); return t = Math.abs(t), (t <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4)) * e; } const $e = (t, e, n) => { t = jt(t / 255), e = jt(e / 255), n = jt(n / 255); const { MtxRGB2XYZ: r, MtxAdaptMa: o, MtxAdaptMaI: c, Xn: s, Yn: f, Zn: a, As: l, Bs: b, Cs: d } = F; let h = t * r.m00 + e * r.m10 + n * r.m20, p = t * r.m01 + e * r.m11 + n * r.m21, _ = t * r.m02 + e * r.m12 + n * r.m22; const C = s * o.m00 + f * o.m10 + a * o.m20, w = s * o.m01 + f * o.m11 + a * o.m21, m = s * o.m02 + f * o.m12 + a * o.m22; let G = h * o.m00 + p * o.m10 + _ * o.m20, B = h * o.m01 + p * o.m11 + _ * o.m21, j = h * o.m02 + p * o.m12 + _ * o.m22; return G *= C / l, B *= w / b, j *= m / d, h = G * c.m00 + B * c.m10 + j * c.m20, p = G * c.m01 + B * c.m11 + j * c.m21, _ = G * c.m02 + B * c.m12 + j * c.m22, [h, p, _]; }; i.prototype.lab = function() { return Ht(this._rgb); }; const cn = (...t) => new i(...t, "lab"); Object.assign(x, { lab: cn, getLabWhitePoint: mt, setLabWhitePoint: Q }); k.format.lab = Kt; k.autodetect.push({ p: 2, test: (...t) => { if (t = M(t, "lab"), A(t) === "array" && t.length === 3) return "lab"; } }); i.prototype.darken = function(t = 1) { const e = this, n = e.lab(); return n[0] -= F.Kn * t, new i(n, "lab").alpha(e.alpha(), !0); }; i.prototype.brighten = function(t = 1) { return this.darken(-t); }; i.prototype.darker = i.prototype.darken; i.prototype.brighter = i.prototype.brighten; i.prototype.get = function(t) { const [e, n] = t.split("."), r = this[e](); if (n) { const o = e.indexOf(n) - (e.substr(0, 2) === "ok" ? 2 : 0); if (o > -1) return r[o]; throw new Error(`unknown channel ${n} in mode ${e}`); } else return r; }; const { pow: sn } = Math, fn = 1e-7, an = 20; i.prototype.luminance = function(t, e = "rgb") { if (t !== void 0 && A(t) === "number") { if (t === 0) return new i([0, 0, 0, this._rgb[3]], "rgb"); if (t === 1) return new i([255, 255, 255, this._rgb[3]], "rgb"); let n = this.luminance(), r = an; const o = (s, f) => { const a = s.interpolate(f, 0.5, e), l = a.luminance(); return Math.abs(t - l) < fn || !r-- ? a : l > t ? o(s, a) : o(a, f); }, c = (n > t ? o(new i([0, 0, 0]), this) : o(this, new i([255, 255, 255]))).rgb(); return new i([...c, this._rgb[3]]); } return ln(...this._rgb.slice(0, 3)); }; const ln = (t, e, n) => (t = Pt(t), e = Pt(e), n = Pt(n), 0.2126 * t + 0.7152 * e + 0.0722 * n), Pt = (t) => (t /= 255, t <= 0.03928 ? t / 12.92 : sn((t + 0.055) / 1.055, 2.4)), Y = {}, it = (t, e, n = 0.5, ...r) => { let o = r[0] || "lrgb"; if (!Y[o] && !r.length && (o = Object.keys(Y)[0]), !Y[o]) throw new Error(`interpolation mode ${o} is not defined`); return A(t) !== "object" && (t = new i(t)), A(e) !== "object" && (e = new i(e)), Y[o](t, e, n).alpha( t.alpha() + n * (e.alpha() - t.alpha()) ); }; i.prototype.mix = i.prototype.interpolate = function(t, e = 0.5, ...n) { return it(this, t, e, ...n); }; i.prototype.premultiply = function(t = !1) { const e = this._rgb, n = e[3]; return t ? (this._rgb = [e[0] * n, e[1] * n, e[2] * n, n], this) : new i([e[0] * n, e[1] * n, e[2] * n, n], "rgb"); }; const { sin: un, cos: bn } = Math, xe = (...t) => { let [e, n, r] = M(t, "lch"); return isNaN(r) && (r = 0), r = r * Ve, [e, bn(r) * n, un(r) * n]; }, Wt = (...t) => { t = M(t, "lch"); const [e, n, r] = t, [o, c, s] = xe(e, n, r), [f, a, l] = Kt(o, c, s); return [f, a, l, t.length > 3 ? t[3] : 1]; }, hn = (...t) => { const e = ye(M(t, "hcl")); return Wt(...e); }, { sqrt: dn, atan2: pn, round: gn } = Math, Ae = (...t) => { const [e, n, r] = M(t, "lab"), o = dn(n * n + r * r); let c = (pn(r, n) * Je + 360) % 360; return gn(o * 1e4) === 0 && (c = Number.NaN), [e, o, c]; }, Dt = (...t) => { const [e, n, r, ...o] = M(t, "rgb"), [c, s, f] = Ht(e, n, r), [a, l, b] = Ae(c, s, f); return [a, l, b, ...o.length > 0 && o[0] < 1 ? [o[0]] : []]; }; i.prototype.lch = function() { return Dt(this._rgb); }; i.prototype.hcl = function() { return ye(Dt(this._rgb)); }; const mn = (...t) => new i(...t, "lch"), wn = (...t) => new i(...t, "hcl"); Object.assign(x, { lch: mn, hcl: wn }); k.format.lch = Wt; k.format.hcl = hn; ["lch", "hcl"].forEach( (t) => k.autodetect.push({ p: 2, test: (...e) => { if (e = M(e, t), A(e) === "array" && e.length === 3) return t; } }) ); i.prototype.saturate = function(t = 1) { const e = this, n = e.lch(); return n[1] += F.Kn * t, n[1] < 0 && (n[1] = 0), new i(n, "lch").alpha(e.alpha(), !0); }; i.prototype.desaturate = function(t = 1) { return this.saturate(-t); }; i.prototype.set = function(t, e, n = !1) { const [r, o] = t.split("."), c = this[r](); if (o) { const s = r.indexOf(o) - (r.substr(0, 2) === "ok" ? 2 : 0); if (s > -1) { if (A(e) == "string") switch (e.charAt(0)) { case "+": c[s] += +e; break; case "-": c[s] += +e; break; case "*": c[s] *= +e.substr(1); break; case "/": c[s] /= +e.substr(1); break; default: c[s] = +e; } else if (A(e) === "number") c[s] = e; else throw new Error("unsupported value for Color.set"); const f = new i(c, r); return n ? (this._rgb = f._rgb, this) : f; } throw new Error(`unknown channel ${o} in mode ${r}`); } else return c; }; i.prototype.tint = function(t = 0.5, ...e) { return it(this, "white", t, ...e); }; i.prototype.shade = function(t = 0.5, ...e) { return it(this, "black", t, ...e); }; const yn = (t, e, n) => { const r = t._rgb, o = e._rgb; return new i( r[0] + n * (o[0] - r[0]), r[1] + n * (o[1] - r[1]), r[2] + n * (o[2] - r[2]), "rgb" ); }; Y.rgb = yn; const { sqrt: Ot, pow: st } = Math, kn = (t, e, n) => { const [r, o, c] = t._rgb, [s, f, a] = e._rgb; return new i( Ot(st(r, 2) * (1 - n) + st(s, 2) * n), Ot(st(o, 2) * (1 - n) + st(f, 2) * n), Ot(st(c, 2) * (1 - n) + st(a, 2) * n), "rgb" ); }; Y.lrgb = kn; const _n = (t, e, n) => { const r = t.lab(), o = e.lab(); return new i( r[0] + n * (o[0] - r[0]), r[1] + n * (o[1] - r[1]), r[2] + n * (o[2] - r[2]), "lab" ); }; Y.lab = _n; const bt = (t, e, n, r) => { let o, c; r === "hsl" ? (o = t.hsl(), c = e.hsl()) : r === "hsv" ? (o = t.hsv(), c = e.hsv()) : r === "hcg" ? (o = t.hcg(), c = e.hcg()) : r === "hsi" ? (o = t.hsi(), c = e.hsi()) : r === "lch" || r === "hcl" ? (r = "hcl", o = t.hcl(), c = e.hcl()) : r === "oklch" && (o = t.oklch().reverse(), c = e.oklch().reverse()); let s, f, a, l, b, d; (r.substr(0, 1) === "h" || r === "oklch") && ([s, a, b] = o, [f, l, d] = c); let h, p, _, C; return !isNaN(s) && !isNaN(f) ? (f > s && f - s > 180 ? C = f - (s + 360) : f < s && s - f > 180 ? C = f + 360 - s : C = f - s, p = s + n * C) : isNaN(s) ? isNaN(f) ? p = Number.NaN : (p = f, (b == 1 || b == 0) && r != "hsv" && (h = l)) : (p = s, (d == 1 || d == 0) && r != "hsv" && (h = a)), h === void 0 && (h = a + n * (l - a)), _ = b + n * (d - b), r === "oklch" ? new i([_, h, p], r) : new i([p, h, _], r); }, Le = (t, e, n) => bt(t, e, n, "lch"); Y.lch = Le; Y.hcl = Le; const Mn = (t) => { if (A(t) == "number" && t >= 0 && t <= 16777215) { const e = t >> 16, n = t >> 8 & 255, r = t & 255; return [e, n, r, 1]; } throw new Error("unknown num color: " + t); }, $n = (...t) => { const [e, n, r] = M(t, "rgb"); return (e << 16) + (n << 8) + r; }; i.prototype.num = function() { return $n(this._rgb); }; const xn = (...t) => new i(...t, "num"); Object.assign(x, { num: xn }); k.format.num = Mn; k.autodetect.push({ p: 5, test: (...t) => { if (t.length === 1 && A(t[0]) === "number" && t[0] >= 0 && t[0] <= 16777215) return "num"; } }); const An = (t, e, n) => { const r = t.num(), o = e.num(); return new i(r + n * (o - r), "num"); }; Y.num = An; const { floor: Ln } = Math, Rn = (...t) => { t = M(t, "hcg"); let [e, n, r] = t, o, c, s; r = r * 255; const f = n * 255; if (n === 0) o = c = s = r; else { e === 360 && (e = 0), e > 360 && (e -= 360), e < 0 && (e += 360), e /= 60; const a = Ln(e), l = e - a, b = r * (1 - n), d = b + f * (1 - l), h = b + f * l, p = b + f; switch (a) { case 0: [o, c, s] = [p, h, b]; break; case 1: [o, c, s] = [d, p, b]; break; case 2: [o, c, s] = [b, p, h]; break; case 3: [o, c, s] = [b, d, p]; break; case 4: [o, c, s] = [h, b, p]; break; case 5: [o, c, s] = [p, b, d]; break; } } return [o, c, s, t.length > 3 ? t[3] : 1]; }, En = (...t) => { const [e, n, r] = M(t, "rgb"), o = me(e, n, r), c = we(e, n, r), s = c - o, f = s * 100 / 255, a = o / (255 - s) * 100; let l; return s === 0 ? l = Number.NaN : (e === c && (l = (n - r) / s), n === c && (l = 2 + (r - e) / s), r === c && (l = 4 + (e - n) / s), l *= 60, l < 0 && (l += 360)), [l, f, a]; }; i.prototype.hcg = function() { return En(this._rgb); }; const Nn = (...t) => new i(...t, "hcg"); x.hcg = Nn; k.format.hcg = Rn; k.autodetect.push({ p: 1, test: (...t) => { if (t = M(t, "hcg"), A(t) === "array" && t.length === 3) return "hcg"; } }); const Cn = (t, e, n) => bt(t, e, n, "hcg"); Y.hcg = Cn; const { cos: ft } = Math, vn = (...t) => { t = M(t, "hsi"); let [e, n, r] = t, o, c, s; return isNaN(e) && (e = 0), isNaN(n) && (n = 0), e > 360 && (e -= 360), e < 0 && (e += 360), e /= 360, e < 1 / 3 ? (s = (1 - n) / 3, o = (1 + n * ft(V * e) / ft(Ct - V * e)) / 3, c = 1 - (s + o)) : e < 2 / 3 ? (e -= 1 / 3, o = (1 - n) / 3, c = (1 + n * ft(V * e) / ft(Ct - V * e)) / 3, s = 1 - (o + c)) : (e -= 2 / 3, c = (1 - n) / 3, s = (1 + n * ft(V * e) / ft(Ct - V * e)) / 3, o = 1 - (c + s)), o = ot(r * o * 3), c = ot(r * c * 3), s = ot(r * s * 3), [o * 255, c * 255, s * 255, t.length > 3 ? t[3] : 1]; }, { min: jn, sqrt: Pn, acos: On } = Math, Gn = (...t) => { let [e, n, r] = M(t, "rgb"); e /= 255, n /= 255, r /= 255; let o; const c = jn(e, n, r), s = (e + n + r) / 3, f = s > 0 ? 1 - c / s : 0; return f === 0 ? o = NaN : (o = (e - n + (e - r)) / 2, o /= Pn((e - n) * (e - n) + (e - r) * (n - r)), o = On(o), r > n && (o = V - o), o /= V), [o * 360, f, s]; }; i.prototype.hsi = function() { return Gn(this._rgb); }; const Bn = (...t) => new i(...t, "hsi"); x.hsi = Bn; k.format.hsi = vn; k.autodetect.push({ p: 2, test: (...t) => { if (t = M(t, "hsi"), A(t) === "array" && t.length === 3) return "hsi"; } }); const Sn = (t, e, n) => bt(t, e, n, "hsi"); Y.hsi = Sn; const Zt = (...t) => { t = M(t, "hsl"); const [e, n, r] = t; let o, c, s; if (n === 0) o = c = s = r * 255; else { const f = [0, 0, 0], a = [0, 0, 0], l = r < 0.5 ? r * (1 + n) : r + n - r * n, b = 2 * r - l, d = e / 360; f[0] = d + 1 / 3, f[1] = d, f[2] = d - 1 / 3; for (let h = 0; h < 3; h++) f[h] < 0 && (f[h] += 1), f[h] > 1 && (f[h] -= 1), 6 * f[h] < 1 ? a[h] = b + (l - b) * 6 * f[h] : 2 * f[h] < 1 ? a[h] = l : 3 * f[h] < 2 ? a[h] = b + (l - b) * (2 / 3 - f[h]) * 6 : a[h] = b; [o, c, s] = [a[0] * 255, a[1] * 255, a[2] * 255]; } return t.length > 3 ? [o, c, s, t[3]] : [o, c, s, 1]; }, Re = (...t) => { t = M(t, "rgba"); let [e, n, r] = t; e /= 255, n /= 255, r /= 255; const o = me(e, n, r), c = we(e, n, r), s = (c + o) / 2; let f, a; return c === o ? (f = 0, a = Number.NaN) : f = s < 0.5 ? (c - o) / (c + o) : (c - o) / (2 - c - o), e == c ? a = (n - r) / (c - o) : n == c ? a = 2 + (r - e) / (c - o) : r == c && (a = 4 + (e - n) / (c - o)), a *= 60, a < 0 && (a += 360), t.length > 3 && t[3] !== void 0 ? [a, f, s, t[3]] : [a, f, s]; }; i.prototype.hsl = function() { return Re(this._rgb); }; const Yn = (...t) => new i(...t, "hsl"); x.hsl = Yn; k.format.hsl = Zt; k.autodetect.push({ p: 2, test: (...t) => { if (t = M(t, "hsl"), A(t) === "array" && t.length === 3) return "hsl"; } }); const zn = (t, e, n) => bt(t, e, n, "hsl"); Y.hsl = zn; const { floor: Xn } = Math, qn = (...t) => { t = M(t, "hsv"); let [e, n, r] = t, o, c, s; if (r *= 255, n === 0) o = c = s = r; else { e === 360 && (e = 0), e > 360 && (e -= 360), e < 0 && (e += 360), e /= 60; const f = Xn(e), a = e - f, l = r * (1 - n), b = r * (1 - n * a), d = r * (1 - n * (1 - a)); switch (f) { case 0: [o, c, s] = [r, d, l]; break; case 1: [o, c, s] = [b, r, l]; break; case 2: [o, c, s] = [l, r, d]; break; case 3: [o, c, s] = [l, b, r]; break; case 4: [o, c, s] = [d, l, r]; break; case 5: [o, c, s] = [r, l, b]; break; } } return [o, c, s, t.length > 3 ? t[3] : 1]; }, { min: Zn, max: In } = Math, Tn = (...t) => { t = M(t, "rgb"); let [e, n, r] = t; const o = Zn(e, n, r), c = In(e, n, r), s = c - o; let f, a, l; return l = c / 255, c === 0 ? (f = Number.NaN, a = 0) : (a = s / c, e === c && (f = (n - r) / s), n === c && (f = 2 + (r - e) / s), r === c && (f = 4 + (e - n) / s), f *= 60, f < 0 && (f += 360)), [f, a, l]; }; i.prototype.hsv = function() { return Tn(this._rgb); }; const Kn = (...t) => new i(...t, "hsv"); x.hsv = Kn; k.format.hsv = qn; k.autodetect.push({ p: 2, test: (...t) => { if (t = M(t, "hsv"), A(t) === "array" && t.length === 3) return "hsv"; } }); const Hn = (t, e, n) => bt(t, e, n, "hsv"); Y.hsv = Hn; function xt(t, e) { let n = t.length; Array.isArray(t[0]) || (t = [t]), Array.isArray(e[0]) || (e = e.map((s) => [s])); let r = e[0].length, o = e[0].map((s, f) => e.map((a) => a[f])), c = t.map( (s) => o.map((f) => Array.isArray(s) ? s.reduce((a, l, b) => a + l * (f[b] || 0), 0) : f.reduce((a, l) => a + l * s, 0)) ); return n === 1 && (c = c[0]), r === 1 ? c.map((s) => s[0]) : c; } const Ft = (...t) => { t = M(t, "lab"); const [e, n, r, ...o] = t, [c, s, f] = Wn([e, n, r]), [a, l, b] = Me(c, s, f); return [a, l, b, ...o.length > 0 && o[0] < 1 ? [o[0]] : []]; }; function Wn(t) { var e = [ [1.2268798758459243, -0.5578149944602171, 0.2813910456659647], [-0.0405757452148008, 1.112286803280317, -0.0717110580655164], [-0.0763729366746601, -0.4214933324022432, 1.5869240198367816] ], n = [ [1, 0.3963377773761749, 0.2158037573099136], [1, -0.1055613458156586, -0.0638541728258133], [1, -0.0894841775298119, -1.2914855480194092] ], r = xt(n, t); return xt( e, r.map((o) => o ** 3) ); } const Ut = (...t) => { const [e, n, r, ...o] = M(t, "rgb"), c = $e(e, n, r); return [...Dn(c), ...o.length > 0 && o[0] < 1 ? [o[0]] : []]; }; function Dn(t) { const e = [ [0.819022437996703, 0.3619062600528904, -0.1288737815209879], [0.0329836539323885, 0.9292868615863434, 0.0361446663506424], [0.0481771893596242, 0.2642395317527308, 0.6335478284694309] ], n = [ [0.210454268309314, 0.7936177747023054, -0.0040720430116193], [1.9779985324311684, -2.42859224204858, 0.450593709617411], [0.0259040424655478, 0.7827717124575296, -0.8086757549230774] ], r = xt(e, t); return xt( n, r.map((o) => Math.cbrt(o)) ); } i.prototype.oklab = function() { return Ut(this._rgb); }; const Fn = (...t) => new i(...t, "oklab"); Object.assign(x, { oklab: Fn }); k.format.oklab = Ft; k.autodetect.push({ p: 2, test: (...t) => { if (t = M(t, "oklab"), A(t) === "array" && t.length === 3) return "oklab"; } }); const Un = (t, e, n) => { const r = t.oklab(), o = e.oklab(); return new i( r[0] + n * (o[0] - r[0]), r[1] + n * (o[1] - r[1]), r[2] + n * (o[2] - r[2]), "oklab" ); }; Y.oklab = Un; const Vn = (t, e, n) => bt(t, e, n, "oklch"); Y.oklch = Vn; const { pow: Gt, sqrt: Bt, PI: St, cos: ne, sin: re, atan2: Jn } = Math, Qn = (t, e = "lrgb", n = null) => { const r = t.length; n || (n = Array.from(new Array(r)).map(() => 1)); const o = r / n.reduce(function(d, h) { return d + h; }); if (n.forEach((d, h) => { n[h] *= o; }), t = t.map((d) => new i(d)), e === "lrgb") return tr(t, n); const c = t.shift(), s = c.get(e), f = []; let a = 0, l = 0; for (let d = 0; d < s.length; d++) if (s[d] = (s[d] || 0) * n[0], f.push(isNaN(s[d]) ? 0 : n[0]), e.charAt(d) === "h" && !isNaN(s[d])) { const h = s[d] / 180 * St; a += ne(h) * n[0], l += re(h) * n[0]; } let b = c.alpha() * n[0]; t.forEach((d, h) => { const p = d.get(e); b += d.alpha() * n[h + 1]; for (let _ = 0; _ < s.length; _++) if (!isNaN(p[_])) if (f[_] += n[h + 1], e.charAt(_) === "h") { const C = p[_] / 180 * St; a += ne(C) * n[h + 1], l += re(C) * n[h + 1]; } else s[_] += p[_] * n[h + 1]; }); for (let d = 0; d < s.length; d++) if (e.charAt(d) === "h") { let h = Jn(l / f[d], a / f[d]) / St * 180; for (; h < 0; ) h += 360; for (; h >= 360; ) h -= 360; s[d] = h; } else s[d] = s[d] / f[d]; return b /= r, new i(s, e).alpha(b > 0.99999 ? 1 : b, !0); }, tr = (t, e) => { const n = t.length, r = [0, 0, 0, 0]; for (let o = 0; o < t.length; o++) { const c = t[o], s = e[o] / n, f = c._rgb; r[0] += Gt(f[0], 2) * s, r[1] += Gt(f[1], 2) * s, r[2] += Gt(f[2], 2) * s, r[3] += f[3] * s; } return r[0] = Bt(r[0]), r[1] = Bt(r[1]), r[2] = Bt(r[2]), r[3] > 0.9999999 && (r[3] = 1), new i(Tt(r)); }, { pow: er } = Math; function At(t) { let e = "rgb", n = x("#ccc"), r = 0, o = [0, 1], c = [], s = [0, 0], f = !1, a = [], l = !1, b = 0, d = 1, h = !1, p = {}, _ = !0, C = 1; const w = function(u) { if (u = u || ["#fff", "#000"], u && A(u) === "string" && x.brewer && x.brewer[u.toLowerCase()] && (u = x.brewer[u.toLowerCase()]), A(u) === "array") { u.length === 1 && (u = [u[0], u[0]]), u = u.slice(0); for (let g = 0; g < u.length; g++) u[g] = x(u[g]); c.length = 0; for (let g = 0; g < u.length; g++) c.push(g / (u.length - 1)); } return S(), a = u; }, m = function(u) { if (f != null) { const g = f.length - 1; let $ = 0; for (; $ < g && u >= f[$]; ) $++; return $ - 1; } return 0; }; let G = (u) => u, B = (u) => u; const j = function(u, g) { let $, y; if (g == null && (g = !1), isNaN(u) || u === null) return n; g ? y = u : f && f.length > 2 ? y = m(u) / (f.length - 2) : d !== b ? y = (u - b) / (d - b) : y = 1, y = B(y), g || (y = G(y)), C !== 1 && (y = er(y, C)), y = s[0] + y * (1 - s[0] - s[1]), y = ot(y, 0, 1); const N = Math.floor(y * 1e4); if (_ && p[N]) $ = p[N]; else { if (A(a) === "array") for (let E = 0; E < c.length; E++) { const v = c[E]; if (y <= v) { $ = a[E]; break; } if (y >= v && E === c.length - 1) { $ = a[E]; break; } if (y > v && y < c[E + 1]) { y = (y - v) / (c[E + 1] - v), $ = x.interpolate( a[E], a[E + 1], y, e ); break; } } else A(a) === "function" && ($ = a(y)); _ && (p[N] = $); } return $; }; var S = () => p = {}; w(t); const L = function(u) { const g = x(j(u)); return l && g[l] ? g[l]() : g; }; return L.classes = function(u) { if (u != null) { if (A(u) === "array") f = u, o = [u[0], u[u.length - 1]]; else { const g = x.analyze(o); u === 0 ? f = [g.min, g.max] : f = x.limits(g, "e", u); } return L; } return f; }, L.domain = function(u) { if (!arguments.length) return o; b = u[0], d = u[u.length - 1], c = []; const g = a.length; if (u.length === g && b !== d) for (let $ of Array.from(u)) c.push(($ - b) / (d - b)); else { for (let $ = 0; $ < g; $++) c.push($ / (g - 1)); if (u.length > 2) { const $ = u.map((N, E) => E / (u.length - 1)), y = u.map((N) => (N - b) / (d - b)); y.every((N, E) => $[E] === N) || (B = (N) => { if (N <= 0 || N >= 1) return N; let E = 0; for (; N >= y[E + 1]; ) E++; const v = (N - y[E]) / (y[E + 1] - y[E]); return $[E] + v * ($[E + 1] - $[E]); }); } } return o = [b, d], L; }, L.mode = function(u) { return arguments.length ? (e = u, S(), L) : e; }, L.range = function(u, g) { return w(u), L; }, L.out = function(u) { return l = u, L; }, L.spread = function(u) { return arguments.length ? (r = u, L) : r; }, L.correctLightness = function(u) { return u == null && (u = !0), h = u, S(), h ? G = function(g) { const $ = j(0, !0).lab()[0], y = j(1, !0).lab()[0], N = $ > y; let E = j(g, !0).lab()[0]; const v = $ + (y - $) * g; let rt = E - v, pt = 0, wt = 1, yt = 20; for (; Math.abs(rt) > 0.01 && yt-- > 0; ) (function() { return N && (rt *= -1), rt < 0 ? (pt = g, g += (wt - g) * 0.5) : (wt = g, g += (pt - g) * 0.5), E = j(g, !0).lab()[0], rt = E - v; })(); return g; } : G = (g) => g, L; }, L.padding = function(u) { return u != null ? (A(u) === "number" && (u = [u, u]), s = u, L) : s; }, L.colors = function(u, g) { arguments.length < 2 && (g = "hex"); let $ = []; if (arguments.length === 0) $ = a.slice(0); else if (u === 1) $ = [L(0.5)]; else if (u > 1) { const y = o[0], N = o[1] - y; $ = nr(0, u).map( (E) => L(y + E / (u - 1) * N) ); } else { t = []; let y = []; if (f && f.length > 2) for (let N = 1, E = f.length, v = 1 <= E; v ? N < E : N > E; v ? N++ : N--) y.push((f[N - 1] + f[N]) * 0.5); else y = o; $ = y.map((N) => L(N)); } return x[g] && ($ = $.map((y) => y[g]())), $; }, L.cache = function(u) { return u != null ? (_ = u, L) : _; }, L.gamma = function(u) { return u != null ? (C = u, L) : C; }, L.nodata = function(u) { return u != null ? (n = x(u), L) : n; }, L; } function nr(t, e, n) { let r = [], o = t < e, c = e; for (let s = t; o ? s < c : s > c; o ? s++ : s--) r.push(s); return r; } const rr = function(t) { let e = [1, 1]; for (let n = 1; n < t; n++) { let r = [1]; for (let o = 1; o <= e.length; o++) r[o] = (e[o] || 0) + e[o - 1]; e = r; } return e; }, or = function(t) { let e, n, r, o; if (t = t.map((c) => new i(c)), t.length === 2) [n, r] = t.map((c) => c.lab()), e = function(c) { const s = [0, 1, 2].map((f) => n[f] + c * (r[f] - n[f])); return new i(s, "lab"); }; else if (t.length === 3) [n, r, o] = t.map((c) => c.lab()), e = function(c) { const s = [0, 1, 2].map( (f) => (1 - c) * (1 - c) * n[f] + 2 * (1 - c) * c * r[f] + c * c * o[f] ); return new i(s, "lab"); }; else if (t.length === 4) { let c; [n, r, o, c] = t.map((s) => s.lab()), e = function(s) { const f = [0, 1, 2].map( (a) => (1 - s) * (1 - s) * (1 - s) * n[a] + 3 * (1 - s) * (1 - s) * s * r[a] + 3 * (1 - s) * s * s * o[a] + s * s * s * c[a] ); return new i(f, "lab"); }; } else if (t.length >= 5) { let c, s, f; c = t.map((a) => a.lab()), f = t.length - 1, s = rr(f), e = function(a) { const l = 1 - a, b = [0, 1, 2].map( (d) => c.reduce( (h, p, _) => h + s[_] * l ** (f - _) * a ** _ * p[d], 0 ) ); return new i(b, "lab"); }; } else throw new RangeError("No point in running bezier with only one color."); return e; }, cr = (t) => { const e = or(t); return e.scale = () => At(e), e; }, { round: Ee } = Math; i.prototype.rgb = function(t = !0) { return t === !1 ? this._rgb.slice(0, 3) : this._rgb.slice(0, 3).map(Ee); }; i.prototype.rgba = function(t = !0) { return this._rgb.slice(0, 4).map((e, n) => n < 3 ? t === !1 ? e : Ee(e) : e); }; const sr = (...t) => new i(...t, "rgb"); Object.assign(x, { rgb: sr }); k.format.rgb = (...t) => { const e = M(t, "rgba"); return e[3] === void 0 && (e[3] = 1), e; }; k.autodetect.push({ p: 3, test: (...t) => { if (t = M(t, "rgba"), A(t) === "array" && (t.length === 3 || t.length === 4 && A(t[3]) == "number" && t[3] >= 0 && t[3] <= 1)) return "rgb"; } }); const D = (t, e, n) => { if (!D[n]) throw new Error("unknown blend mode " + n); return D[n](t, e); }, et = (t) => (e, n) => { const r = x(n).rgb(), o = x(e).rgb(); return x.rgb(t(r, o)); }, nt = (t) => (e, n) => { const r = []; return r[0] = t(e[0], n[0]), r[1] = t(e[1], n[1]), r[2] = t(e[2], n[2]), r; }, fr = (t) => t, ar = (t, e) => t * e / 255, lr = (t, e) => t > e ? e : t, ir = (t, e) => t > e ? t : e, ur = (t, e) => 255 * (1 - (1 - t / 255) * (1 - e / 255)), br = (t, e) => e < 128 ? 2 * t * e / 255 : 255 * (1 - 2 * (1 - t / 255) * (1 - e / 255)), hr = (t, e) => 255 * (1 - (1 - e / 255) / (t / 255)), dr = (t, e) => t === 255 ? 255 : (t = 255 * (e / 255) / (1 - t / 255), t > 255 ? 255 : t); D.normal = et(nt(fr)); D.multiply = et(nt(ar)); D.screen = et(nt(ur)); D.overlay = et(nt(br)); D.darken = et(nt(lr)); D.lighten = et(nt(ir)); D.dodge = et(nt(dr)); D.burn = et(nt(hr)); const { pow: pr, sin: gr, cos: mr } = Math; function wr(t = 300, e = -1.5, n = 1, r = 1, o = [0, 1]) { let c = 0, s; A(o) === "array" ? s = o[1] - o[0] : (s = 0, o = [o, o]); const f = function(a) { const l = V * ((t + 120) / 360 + e * a), b = pr(o[0] + s * a, r), h = (c !== 0 ? n[0] + a * c : n) * b * (1 - b) / 2, p = mr(l), _ = gr(l), C = b + h * (-0.14861 * p + 1.78277 * _), w = b + h * (-0.29227 * p - 0.90649 * _), m = b + h * (1.97294 * p); return x(Tt([C * 255, w * 255, m * 255, 1])); }; return f.start = function(a) { return a == null ? t : (t = a, f); }, f.rotations = function(a) { return a == null ? e : (e = a, f); }, f.gamma = function(a) { return a == null ? r : (r = a, f); }, f.hue = function(a) { return a == null ? n : (n = a, A(n) === "array" ? (c = n[1] - n[0], c === 0 && (n = n[1])) : c = 0, f); }, f.lightness = function(a) { return a == null ? o : (A(a) === "array" ? (o = a, s = a[1] - a[0]) : (o = [a, a], s = 0), f); }, f.scale = () => x.scale(f), f.hue(n), f; } const yr = "0123456789abcdef", { floor: kr, random: _r } = Math, Mr = () => { let t = "#"; for (let e = 0; e < 6; e++) t += yr.charAt(kr(_r() * 16)); return new i(t, "hex"); }, { log: oe, pow: $r, floor: xr, abs: Ar } = Math; function Ne(t, e = null) { const n = { min: Number.MAX_VALUE, max: Number.MAX_VALUE * -1, sum: 0, values: [], count: 0 }; return A(t) === "object" && (t = Object.values(t)), t.forEach((r) => { e && A(r) === "object" && (r = r[e]), 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); }), n.domain = [n.min, n.max], n.limits = (r, o) => Ce(n, r, o), n; } function Ce(t, e = "equal", n = 7) { A(t) == "array" && (t = Ne(t)); const { min: r, max: o } = t, c = t.values.sort((f, a) => f - a); if (n === 1) return [r, o]; const s = []; if (e.substr(0, 1) === "c" && (s.push(r), s.push(o)), e.substr(0, 1) === "e") { s.push(r); for (let f = 1; f < n; f++) s.push(r + f / n * (o - r)); s.push(o); } else if (e.substr(0, 1) === "l") { if (r <= 0) throw new Error( "Logarithmic scales are only possible for values > 0" ); const f = Math.LOG10E * oe(r), a = Math.LOG10E * oe(o); s.push(r); for (let l = 1; l < n; l++) s.push($r(10, f + l / n * (a - f))); s.push(o); } else if (e.substr(0, 1) === "q") { s.push(r); for (let f = 1; f < n; f++) { const a = (c.length - 1) * f / n, l = xr(a); if (l === a) s.push(c[l]); else { const b = a - l; s.push(c[l] * (1 - b) + c[l + 1] * b); } } s.push(o); } else if (e.substr(0, 1) === "k") { let f; const a = c.length, l = new Array(a), b = new Array(n); let d = !0, h = 0, p = null; p = [], p.push(r); for (let w = 1; w < n; w++) p.push(r + w / n * (o - r)); for (p.push(o); d; ) { for (let m = 0; m < n; m++) b[m] = 0; for (let m = 0; m < a; m++) { const G = c[m]; let B = Number.MAX_VALUE, j; for (let S = 0; S < n; S++) { const L = Ar(p[S] - G); L < B && (B = L, j = S), b[j]++, l[m] = j; } } const w = new Array(n); for (let m = 0; m < n; m++) w[m] = null; for (let m = 0; m < a; m++) f = l[m], w[f] === null ? w[f] = c[m] : w[f] += c[m]; for (let m = 0; m < n; m++) w[m] *= 1 / b[m]; d = !1; for (let m = 0; m < n; m++) if (w[m] !== p[m]) { d = !0; break; } p = w, h++, h > 200 && (d = !1); } const _ = {}; for (let w = 0; w < n; w++) _[w] = []; for (let w = 0; w < a; w++) f = l[w], _[f].push(c[w]); let C = []; for (let w = 0; w < n; w++) C.push(_[w][0]), C.push(_[w][_[w].length - 1]); C = C.sort((w, m) => w - m), s.push(C[0]); for (let w = 1; w < C.length; w += 2) { const m = C[w]; !isNaN(m) && s.indexOf(m) === -1 && s.push(m); } } return s; } const Lr = (t, e) => { t = new i(t), e = new i(e); const n = t.luminance(), r = e.luminance(); return n > r ? (n + 0.05) / (r + 0.05) : (r + 0.05) / (n + 0.05); }; /** * @license * * The APCA contrast prediction algorithm is based of the formulas published * in the APCA-1.0.98G specification by Myndex. The specification is available at: * https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg * * Note that the APCA implementation is still beta, so please update to * future versions of chroma.js when they become available. * * You can read more about the APCA Readability Criterion at * https://readtech.org/ARC/ */ const ce = 0.027, Rr = 5e-4, Er = 0.1, se = 1.14, _t = 0.022, fe = 1.414, Nr = (t, e) => { t = new i(t), e = new i(e), t.alpha() < 1 && (t = it(e, t, t.alpha(), "rgb")); const n = ae(...t.rgb()), r = ae(...e.rgb()), o = n >= _t ? n : n + Math.pow(_t - n, fe), c = r >= _t ? r : r + Math.pow(_t - r, fe), s = Math.pow(c, 0.56) - Math.pow(o, 0.57), f = Math.pow(c, 0.65) - Math.pow(o, 0.62), a = Math.abs(c - o) < Rr ? 0 : o < c ? s * se : f * se; return (Math.abs(a) < Er ? 0 : a > 0 ? a - ce : a + ce) * 100; }; function ae(t, e, n) { return 0.2126729 * Math.pow(t / 255, 2.4) + 0.7151522 * Math.pow(e / 255, 2.4) + 0.072175 * Math.pow(n / 255, 2.4); } const { sqrt: U, pow: P, min: Cr, max: vr, atan2: le, abs: ie, cos: Mt, sin: ue, exp: jr, PI: be } = Math; function Pr(t, e, n = 1, r = 1, o = 1) { var c = function(Nt) { return 360 * Nt / (2 * be); }, s = function(Nt) { return 2 * be * Nt / 360; }; t = new i(t), e = new i(e); const [f, a, l] = Array.from(t.lab()), [b, d, h] = Array.from(e.lab()), p = (f + b) / 2, _ = U(P(a, 2) + P(l, 2)), C = U(P(d, 2) + P(h, 2)), w = (_ + C) / 2, m = 0.5 * (1 - U(P(w, 7) / (P(w, 7) + P(25, 7)))), G = a * (1 + m), B = d * (1 + m), j = U(P(G, 2) + P(l, 2)), S = U(P(B, 2) + P(h, 2)), L = (j + S) / 2, u = c(le(l, G)), g = c(le(h, B)), $ = u >= 0 ? u : u + 360, y = g >= 0 ? g : g + 360, N = ie($ - y) > 180 ? ($ + y + 360) / 2 : ($ + y) / 2, E = 1 - 0.17 * Mt(s(N - 30)) + 0.24 * Mt(s(2 * N)) + 0.32 * Mt(s(3 * N + 6)) - 0.2 * Mt(s(4 * N - 63)); let v = y - $; v = ie(v) <= 180 ? v : y <= $ ? v + 360 : v - 360, v = 2 * U(j * S) * ue(s(v) / 2); const rt = b - f, pt = S - j, wt = 1 + 0.015 * P(p - 50, 2) / U(20 + P(p - 50, 2)), yt = 1 + 0.045 * L, Qt = 1 + 0.015 * L * E, He = 30 * jr(-P((N - 275) / 25, 2)), We = -(2 * U(P(L, 7) / (P(L, 7) + P(25, 7)))) * ue(2 * s(He)), De = U( P(rt / (n * wt), 2) + P(pt / (r * yt), 2) + P(v / (o * Qt), 2) + We * (pt / (r * yt)) * (v / (o * Qt)) ); return vr(0, Cr(100, De)); } function Or(t, e, n = "lab") { t = new i(t), e = new i(e); const r = t.get(n), o = e.get(n); let c = 0; for (let s in r) { const f = (r[s] || 0) - (o[s] || 0); c += f * f; } return Math.sqrt(c); } const Gr = (...t) => { try { return new i(...t), !0; } catch { return !1; } }, Br = { cool() { return At([x.hsl(180, 1, 0.9), x.hsl(250, 0.7, 0.4)]); }, hot() { return At(["#000", "#f00", "#ff0", "#fff"]).mode( "rgb" ); } }, It = { // sequential OrRd: ["#fff7ec", "#fee8c8", "#fdd49e", "#fdbb84", "#fc8d59", "#ef6548", "#d7301f", "#b30000", "#7f0000"], PuBu: ["#fff7fb", "#ece7f2", "#d0d1e6", "#a6bddb", "#74a9cf", "#3690c0", "#0570b0", "#045a8d", "#023858"], BuPu: ["#f7fcfd", "#e0ecf4", "#bfd3e6", "#9ebcda", "#8c96c6", "#8c6bb1", "#88419d", "#810f7c", "#4d004b"], Oranges: ["#fff5eb", "#fee6ce", "#fdd0a2", "#fdae6b", "#fd8d3c", "#f16913", "#d94801", "#a63603", "#7f2704"], BuGn: ["#f7fcfd", "#e5f5f9", "#ccece6", "#99d8c9", "#66c2a4", "#41ae76", "#238b45", "#006d2c", "#00441b"], YlOrBr: ["#ffffe5", "#fff7bc", "#fee391", "#fec44f", "#fe9929", "#ec7014", "#cc4c02", "#993404", "#662506"], YlGn: ["#ffffe5", "#f7fcb9", "#d9f0a3", "#addd8e", "#78c679", "#41ab5d", "#238443", "#006837", "#004529"], Reds: ["#fff5f0", "#fee0d2", "#fcbba1", "#fc9272", "#fb6a4a", "#ef3b2c", "#cb181d", "#a50f15", "#67000d"], RdPu: ["#fff7f3", "#fde0dd", "#fcc5c0", "#fa9fb5", "#f768a1", "#dd3497", "#ae017e", "#7a0177", "#49006a"], Greens: ["#f7fcf5", "#e5f5e0", "#c7e9c0", "#a1d99b", "#74c476", "#41ab5d", "#238b45", "#006d2c", "#00441b"], YlGnBu: ["#ffffd9", "#edf8b1", "#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#253494", "#081d58"], Purples: ["#fcfbfd", "#efedf5", "#dadaeb", "#bcbddc", "#9e9ac8", "#807dba", "#6a51a3", "#54278f", "#3f007d"], GnBu: ["#f7fcf0", "#e0f3db", "#ccebc5", "#a8ddb5", "#7bccc4", "#4eb3d3", "#2b8cbe", "#0868ac", "#084081"], Greys: ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525", "#000000"], YlOrRd: ["#ffffcc", "#ffeda0", "#fed976", "#feb24c", "#fd8d3c", "#fc4e2a", "#e31a1c", "#bd0026", "#800026"], PuRd: ["#f7f4f9", "#e7e1ef", "#d4b9da", "#c994c7", "#df65b0", "#e7298a", "#ce1256", "#980043", "#67001f"], Blues: ["#f7fbff", "#deebf7", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#08519c", "#08306b"], PuBuGn: ["#fff7fb", "#ece2f0", "#d0d1e6", "#a6bddb", "#67a9cf", "#3690c0", "#02818a", "#016c59", "#014636"], Viridis: ["#440154", "#482777", "#3f4a8a", "#31678e", "#26838f", "#1f9d8a", "#6cce5a", "#b6de2b", "#fee825"], // diverging Spectral: ["#9e0142", "#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#e6f598", "#abdda4", "#66c2a5", "#3288bd", "#5e4fa2"], RdYlGn: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850", "#006837"], RdBu: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#f7f7f7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac", "#053061"], PiYG: ["#8e0152", "#c51b7d", "#de77ae", "#f1b6da", "#fde0ef", "#f7f7f7", "#e6f5d0", "#b8e186", "#7fbc41", "#4d9221", "#276419"], PRGn: ["#40004b", "#762a83", "#9970ab", "#c2a5cf", "#e7d4e8", "#f7f7f7", "#d9f0d3", "#a6dba0", "#5aae61", "#1b7837", "#00441b"], RdYlBu: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee090", "#ffffbf", "#e0f3f8", "#abd9e9", "#74add1", "#4575b4", "#313695"], BrBG: ["#543005", "#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#f5f5f5", "#c7eae5", "#80cdc1", "#35978f", "#01665e", "#003c30"], RdGy: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#ffffff", "#e0e0e0", "#bababa", "#878787", "#4d4d4d", "#1a1a1a"], PuOr: ["#7f3b08", "#b35806", "#e08214", "#fdb863", "#fee0b6", "#f7f7f7", "#d8daeb", "#b2abd2", "#8073ac", "#542788", "#2d004b"], // qualitative Set2: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f", "#e5c494", "#b3b3b3"], Accent: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17", "#666666"], Set1: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999"], Set3: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5", "#ffed6f"], Dark2: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d", "#666666"], Paired: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928"], Pastel2: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4", "#e6f5c9", "#fff2ae", "#f1e2cc", "#cccccc"], Pastel1: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6", "#ffffcc", "#e5d8bd", "#fddaec", "#f2f2f2"] }, ve = Object.keys(It), he = new Map(ve.map((t) => [t.toLowerCase(), t])), Sr = typeof Proxy == "function" ? new Proxy(It, { get(t, e) { const n = e.toLowerCase(); if (he.has(n)) return t[he.get(n)]; }, getOwnPropertyNames() { return Object.getOwnPropertyNames(ve); } }) : It, Yr = (...t) => { t = M(t, "cmyk"); const [e, n, r, o] = t, c = t.length > 4 ? t[4] : 1; return o === 1 ? [0, 0, 0, c] : [ e >= 1 ? 0 : 255 * (1 - e) * (1 - o), // r n >= 1 ? 0 : 255 * (1 - n) * (1 - o), // g r >= 1 ? 0 : 255 * (1 - r) * (1 - o), // b c ]; }, { max: de } = Math, zr = (...t) => { let [e, n, r] = M(t, "rgb"); e = e / 255, n = n / 255, r = r / 255; const o = 1 - de(e, de(n, r)), c = o < 1 ? 1 / (1 - o) : 0, s = (1 - e - o) * c, f = (1 - n - o) * c, a = (1 - r - o) * c; return [s, f, a, o]; }; i.prototype.cmyk = function() { return zr(this._rgb); }; const Xr = (...t) => new i(...t, "cmyk"); Object.assign(x, { cmyk: Xr }); k.format.cmyk = Yr; k.autodetect.push({ p: 2, test: (...t) => { if (t = M(t, "cmyk"), A(t) === "array" && t.length === 4) return "cmyk"; } }); const qr = (...t) => { const e = M(t, "hsla"); let n = ut(t) || "lsa"; return e[0] = T(e[0] || 0) + "deg", e[1] = T(e[1] * 100) + "%", e[2] = T(e[2] * 100) + "%", n === "hsla" || e.length > 3 && e[3] < 1 ? (e[3] = "/ " + (e.length > 3 ? e[3] : 1), n = "hsla") : e.length = 3, `${n.substr(0, 3)}(${e.join(" ")})`; }, Zr = (...t) => { const e = M(t, "lab"); let n = ut(t) || "lab"; return e[0] = T(e[0]) + "%", e[1] = T(e[1]), e[2] = T(e[2]), n === "laba" || e.length > 3 && e[3] < 1 ? e[3] = "/ " + (e.length > 3 ? e[3] : 1) : e.length = 3, `lab(${e.join(" ")})`; }, Ir = (...t) => { const e = M(t, "lch"); let n = ut(t) || "lab"; return e[0] = T(e[0]) + "%", e[1] = T(e[1]), e[2] = isNaN(e[2]) ? "none" : T(e[2]) + "deg", n === "lcha" || e.length > 3 && e[3] < 1 ? e[3] = "/ " + (e.length > 3 ? e[3] : 1) : e.length = 3, `lch(${e.join(" ")})`; }, Tr = (...t) => { const e = M(t, "lab"); return e[0] = T(e[0] * 100) + "%", e[1] = qt(e[1]), e[2] = qt(e[2]), e.length > 3 && e[3] < 1 ? e[3] = "/ " + (e.length > 3 ? e[3] : 1) : e.length = 3, `oklab(${e.join(" ")})`; }, je = (...t) => { const [e, n, r, ...o] = M(t, "rgb"), [c, s, f] = Ut(e, n, r), [a, l, b] = Ae(c, s, f); return [a, l, b, ...o.length > 0 && o[0] < 1 ? [o[0]] : []]; }, Kr = (...t) => { const e = M(t, "lch"); return e[0] = T(e[0] * 100) + "%", e[1] = qt(e[1]), e[2] = isNaN(e[2]) ? "none" : T(e[2]) + "deg", e.length > 3 && e[3] < 1 ? e[3] = "/ " + (e.length > 3 ? e[3] : 1) : e.length = 3, `oklch(${e.join(" ")})`; }, { round: Yt } = Math, Hr = (...t) => { const e = M(t, "rgba"); let n = ut(t) || "rgb"; if (n.substr(0, 3) === "hsl") return qr(Re(e), n); if (n.substr(0, 3) === "lab") { const r = mt(); Q("d50"); const o = Zr(Ht(e), n); return Q(r), o; } if (n.substr(0, 3) === "lch") { const r = mt(); Q("d50"); const o = Ir(Dt(e), n); return Q(r), o; } return n.substr(0, 5) === "oklab" ? Tr(Ut(e)) : n.substr(0, 5) === "oklch" ? Kr(je(e)) : (e[0] = Yt(e[0]), e[1] = Yt(e[1]), e[2] = Yt(e[2]), (n === "rgba" || e.length > 3 && e[3] < 1) && (e[3] = "/ " + (e.length > 3 ? e[3] : 1), n = "rgba"), `${n.substr(0, 3)}(${e.slice(0, n === "rgb" ? 3 : 4).join(" ")})`); }, Pe = (...t) => { t = M(t, "lch"); const [e, n, r, ...o] = t, [c, s, f] = xe(e, n, r), [a, l, b] = Ft(c, s, f); return [a, l, b, ...o.length > 0 && o[0] < 1 ? [o[0]] : []]; }, tt = /((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source, W = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source, Lt = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source, K = /\s*/.source, ht = /\s+/.source, Vt = /\s*,\s*/.source, Et = /((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source, dt = /\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source, Oe = new RegExp( "^rgba?\\(" + K + [tt, tt, tt].join(ht) + dt + "\\)$" ), Ge = new RegExp( "^rgb\\(" + K + [tt, tt, tt].join(Vt) + K + "\\)$" ), Be = new RegExp( "^rgba\\(" + K + [tt, tt, tt, W].join(Vt) + K + "\\)$" ), Se = new RegExp( "^hsla?\\(" + K + [Et, Lt, Lt].join(ht) + dt + "\\)$" ), Ye = new RegExp( "^hsl?\\(" + K + [Et, Lt, Lt].join(Vt) + K + "\\)$" ), ze = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/, Xe = new RegExp( "^lab\\(" + K + [W, W, W].join(ht) + dt + "\\)$" ), qe = new RegExp( "^lch\\(" + K + [W, W, Et].join(ht) + dt + "\\)$" ), Ze = new RegExp( "^oklab\\(" + K + [W, W, W].join(ht) + dt + "\\)$" ), Ie = new RegExp( "^oklch\\(" + K + [W, W, Et].join(ht) + dt + "\\)$" ), { round: Te } = Math, at = (t) => t.map((e, n) => n <= 2 ? ot(Te(e), 0, 255) : e), O = (t, e = 0, n = 100, r = !1) => (typeof t == "string" && t.endsWith("%") && (t = parseFloat(t.substring(0, t.length - 1)) / 100, r ? t = e + (t + 1) * 0.5 * (n - e) : t = e + t * (n - e)), +t), z = (t, e) => t === "none" ? e : t, Jt = (t) => { if (t = t.toLowerCase().trim(), t === "transparent") return [0, 0, 0, 0]; let e; if (k.format.named) try { return k.format.named(t); } catch { } if ((e = t.match(Oe)) || (e = t.match(Ge))) { let n = e.slice(1, 4); for (let o = 0; o < 3; o++) n[o] = +O(z(n[o], 0), 0, 255); n = at(n); const r = e[4] !== void 0 ? +O(e[4], 0, 1) : 1; return n[3] = r, n; } if (e = t.match(Be)) { const n = e.slice(1, 5); for (let r = 0; r < 4; r++) n[r] = +O(n[r], 0, 255); return n; } if ((e = t.match(Se)) || (e = t.match(Ye))) { const n = e.slice(1, 4); n[0] = +z(n[0].replace("deg", ""), 0), n[1] = +O(z(n[1], 0), 0, 100) * 0.01, n[2] = +O(z(n[2], 0), 0, 100) * 0.01; const r = at(Zt(n)), o = e[4] !== void 0 ? +O(e[4], 0, 1) : 1; return r[3] = o, r; } if (e = t.match(ze)) { const n = e.slice(1, 4); n[1] *= 0.01, n[2] *= 0.01; const r = Zt(n); for (let o = 0; o < 3; o++) r[o] = Te(r[o]); return r[3] = +e[4], r; } if (e = t.match(Xe)) { const n = e.slice(1, 4); n[0] = O(z(n[0], 0), 0, 100), n[1] = O(z(n[1], 0), -125, 125, !0), n[2] = O(z(n[2], 0), -125, 125, !0); const r = mt(); Q("d50"); const o = at(Kt(n)); Q(r); const c = e[4] !== void 0 ? +O(e[4], 0, 1) : 1; return o[3] = c, o; } if (e = t.match(qe)) { const n = e.slice(1, 4); n[0] = O(n[0], 0, 100), n[1] = O(z(n[1], 0), 0, 150, !1), n[2] = +z(n[2].replace("deg", ""), 0); const r = mt(); Q("d50"); const o = at(Wt(n)); Q(r); const c = e[4] !== void 0 ? +O(e[4], 0, 1) : 1; return o[3] = c, o; } if (e = t.match(Ze)) { const n = e.slice(1, 4); n[0] = O(z(n[0], 0), 0, 1), n[1] = O(z(n[1], 0), -0.4, 0.4, !0), n[2] = O(z(n[2], 0), -0.4, 0.4, !0); const r = at(Ft(n)), o = e[4] !== void 0 ? +O(e[4], 0, 1) : 1; return r[3] = o, r; } if (e = t.match(Ie)) { const n = e.slice(1, 4); n[0] = O(z(n[0], 0), 0, 1), n[1] = O(z(n[1], 0), 0, 0.4, !1), n[2] = +z(n[2].replace("deg", ""), 0); const r = at(Pe(n)), o = e[4] !== void 0 ? +O(e[4], 0, 1) : 1; return r[3] = o, r; } }; Jt.test = (t) => ( // modern Oe.test(t) || Se.test(t) || Xe.test(t) || qe.test(t) || Ze.test(t) || Ie.test(t) || // legacy Ge.test(t) || Be.test(t) || Ye.test(t) || ze.test(t) || t === "transparent" ); i.prototype.css = function(t) { return Hr(this._rgb, t); }; const Wr = (...t) => new i(...t, "css"); x.css = Wr; k.format.css = Jt; k.autodetect.push({ p: 5, test: (t, ...e) => { if (!e.length && A(t) === "string" && Jt.test(t)) return "css"; } }); k.format.gl = (...t) => { const e = M(t, "rgba"); return e[0] *= 255, e[1] *= 255, e[2] *= 255, e; }; const Dr = (...t) => new i(...t, "gl"); x.gl = Dr; i.prototype.gl = function() { const t = this._rgb; return [t[0] / 255, t[1] / 255, t[2] / 255, t[3]]; }; i.prototype.hex = function(t) { return _e(this._rgb, t); }; const Fr = (...t) => new i(...t, "hex"); x.hex = Fr; k.format.hex = ke; k.autodetect.push({ p: 4, test: (t, ...e) => { if (!e.length && A(t) === "string" && [3, 4, 5, 6, 7, 8, 9].indexOf(t.length) >= 0) return "hex"; } }); const { log: $t } = Math, Ke = (t) => { const e = t / 100; let n, r, o; return e < 66 ? (n = 255, r = e < 6 ? 0 : -155.25485562709179 - 0.44596950469579133 * (r = e - 2) + 104.49216199393888 * $t(r), o = e < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (o = e - 10) + 115.67994401066147 * $t(o)) : (n = 351.97690566805693 + 0.114206453784165 * (n = e - 55) - 40.25366309332127 * $t(n), r = 325.4494125711974 + 0.07943456536662342 * (r = e - 50) - 28.0852963507957 * $t(r), o = 255), [n, r, o, 1]; }, { round: Ur } = Math, Vr = (...t) => { const e = M(t, "rgb"), n = e[0], r = e[2]; let o = 1e3, c = 4e4; const s = 0.4; let f; for (; c - o > s; ) { f = (c + o) * 0.5; const a = Ke(f); a[2] / a[0] >= r / n ? c = f : o = f; } return Ur(f); }; i.prototype.temp = i.prototype.kelvin = i.prototype.temperature = function() { return Vr(this._rgb); }; const zt = (...t) => new i(...t, "temp"); Object.assign(x, { temp: zt, kelvin: zt, temperature: zt }); k.format.temp = k.format.kelvin = k.format.temperature = Ke; i.prototype.oklch = function() { return je(this._rgb); }; const Jr = (...t) => new i(...t, "oklch"); Object.assign(x, { oklch: Jr }); k.format.oklch = Pe; k.autodetect.push({ p: 2, test: (...t) => { if (t = M(t, "oklch"), A(t) === "array" && t.length === 3) return "oklch"; } }); Object.assign(x, { analyze: Ne, average: Qn, bezier: cr, blend: D, brewer: Sr, Color: i, colors: lt, contrast: Lr, contrastAPCA: Nr, cubehelix: wr, deltaE: Pr, distance: Or, input: k, interpolate: it, limits: Ce, mix: it, random: Mr, scale: At, scales: Br, valid: Gr }); const Xt = (t, e, n) => Math.min(Math.max(e, t), n), Qr = (t) => t && typeof t.gl == "function"; var X, q, Z, J, I; const gt = class gt { // biome-ignore lint/suspicious/noExplicitAny: overloadでしてるのでOK constructor(...e) { ct(this, X); ct(this, q); ct(this, Z); ct(this, J); ct(this, I); if (e.length === 1) { H(this, I, e[0] && Qr(e[0]) ? e[0] : x(e[0])); const [n, r, o, c] = R(this, I).rgba(); H(this, X, n), H(this, q, r), H(this, Z, o), H(this, J, c); } else if (e.length >= 3) { const [n, r, o, c = 1] = e; H(this, X, Xt(n, 0, 255)), H(this, q, Xt(r, 0, 255)), H(this, Z, Xt(o, 0, 255)), H(this, J, c ?? 1), H(this, I, x(R(this, X), R(this, q), R(this, Z), R(this, J))); } else throw new Error("Invalid constructor arguments for Color class"); } /** * 文字列からの初期化 * CSS のスタイル等からそのまま変換できます * * @param style e.g. "#ffffff", "white", "rgb(255, 255, 255)" * @param [alpha] 透明度 */ static fromString(e, n) { let r = x(e); return n !== void 0 && (r = r.alpha(n)), new gt(r); } /** * 透明度 0-1 */ get alpha() { return R(this, J); } /** * red の 0-255 の値 (8-bit RGB) */ get red() { return R(this, X); } /** * green の 0-255 の値 (8-bit RGB) */ get green() { return R(this, q); } /** * blue の 0-255 の値 (8-bit RGB) */ get blue() { return R(this, Z); } /** * red の 0-1 の値 (Normalized RGB) */ get r() { return R(this, I).gl()[0]; } /** * green の 0-1 の値 (Normalized RGB) */ get g() { return R(this, I).gl()[1]; } /** * blue の 0-1 の値 (Normalized RGB) */ get b() { return R(this, I).gl()[2]; } /** * 輝度(明るさ) */ get luminance() { return R(this, I).luminance(); } /** * 内部で使用している chroma オブジェクトを返す */ get chroma() { return R(this, I); } /** * 16進数のカラーコードを返す */ toHexString() { return R(this, I).hex().toLowerCase(); } /** * 同じ色かどうか */ isSame(e) { return this.r === e.r && this.g === e.g && this.b === e.b; } /** * RGB の文字列を返す */ toRGBString() { return `rgb(${R(this, X)}, ${R(this, q)}, ${R(this, Z)})`; } /** * RGBA の文字列を返す */ toRGBAString() { return `rgba(${R(this, X)}, ${R(this, q)}, ${R(this, Z)}, ${R(this, J)})`; } /** * 明るい色味かどうか * * HACK: 輝度ではなく、単純に RGB の平均値で明るさを判定しています */ isLight() { return (R(this, X) + R(this, q) + R(this, Z)) / 3 > 160; } /** * カラーを明るくまたは暗くします * * @param percent 変更する度合い * * 例: * color.shade(0.1) 少し明るくする * color.shade(-0.1) 少し暗くする */ shade(e) { const n = e < 0 ? 0 : 255, r = Math.abs(e), o = Math.round((n - R(this, X)) * r) + R(this, X), c = Math.round((n - R(this, q)) * r) + R(this, q), s = Math.round((n - R(this, Z)) * r) + R(this, Z); return new gt(o, c, s, R(this, J)); } /** * 透明度を変更します * * @param alpha 透明度 */ alphaTo(e) { return new gt(R(this, X), R(this, q), R(this, Z), e); } /** * コントラスト比を返す * * @param color 比較対象の Color */ contrast(e) { return x.contrast(R(this, I), e.chroma); } }; X = new WeakMap(), q = new WeakMap(), Z = new WeakMap(), J = new WeakMap(), I = new WeakMap(); let pe = gt; export { pe as C };