import { l, o, r as r2 } from "./chunk-ZYRIJWLX.js"; import { a } from "./chunk-RYY6632W.js"; import { s } from "./chunk-SQOPWYIT.js"; import { r } from "./chunk-YXWMMD76.js"; // node_modules/@arcgis/core/Color.js function n(t) { return a(s(t), 0, 255); } function o2(t, r3, s2) { return t = Number(t), isNaN(t) ? s2 : t < r3 ? r3 : t > s2 ? s2 : t; } var h = class { constructor(t) { this.r = 255, this.g = 255, this.b = 255, this.a = 1, t && this.setColor(t); } static blendColors(t, r3, s2, i = new h()) { return i.r = Math.round(t.r + (r3.r - t.r) * s2), i.g = Math.round(t.g + (r3.g - t.g) * s2), i.b = Math.round(t.b + (r3.b - t.b) * s2), i.a = t.a + (r3.a - t.a) * s2, i._sanitize(); } static fromRgb(r3, s2) { const i = r3.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/); if (i) { const r4 = i[2].split(/\s*,\s*/), e = i[1]; if ("rgb" === e && 3 === r4.length || "rgba" === e && 4 === r4.length) { const t = r4[0]; if ("%" === t.charAt(t.length - 1)) { const t2 = r4.map((t3) => 2.56 * parseFloat(t3)); return 4 === r4.length && (t2[3] = parseFloat(r4[3])), h.fromArray(t2, s2); } return h.fromArray(r4.map((t2) => parseFloat(t2)), s2); } if ("hsl" === e && 3 === r4.length || "hsla" === e && 4 === r4.length) return h.fromArray(o(parseFloat(r4[0]), parseFloat(r4[1]) / 100, parseFloat(r4[2]) / 100, parseFloat(r4[3])), s2); } return null; } static fromHex(t, r3 = new h()) { if (4 !== t.length && 7 !== t.length || "#" !== t[0]) return null; const s2 = 4 === t.length ? 4 : 8, i = (1 << s2) - 1; let e = Number("0x" + t.substr(1)); return isNaN(e) ? null : (["b", "g", "r"].forEach((t2) => { const a2 = e & i; e >>= s2, r3[t2] = 4 === s2 ? 17 * a2 : a2; }), r3.a = 1, r3); } static fromArray(t, r3 = new h()) { return r3._set(Number(t[0]), Number(t[1]), Number(t[2]), Number(t[3])), isNaN(r3.a) && (r3.a = 1), r3._sanitize(); } static fromString(t, i) { const e = r2(t) ? l(t) : null; return e && h.fromArray(e, i) || h.fromRgb(t, i) || h.fromHex(t, i); } static fromJSON(t) { return t && new h([t[0], t[1], t[2], t[3] / 255]); } static toUnitRGB(t) { return r(t) ? [t.r / 255, t.g / 255, t.b / 255] : null; } static toUnitRGBA(t) { return r(t) ? [t.r / 255, t.g / 255, t.b / 255, null != t.a ? t.a : 1] : null; } get isBright() { return 0.299 * this.r + 0.587 * this.g + 0.114 * this.b >= 127; } setColor(t) { var _a, _b, _c, _d; return "string" == typeof t ? h.fromString(t, this) : Array.isArray(t) ? h.fromArray(t, this) : (this._set((_a = t.r) != null ? _a : 0, (_b = t.g) != null ? _b : 0, (_c = t.b) != null ? _c : 0, (_d = t.a) != null ? _d : 1), t instanceof h || this._sanitize()), this; } toRgb() { return [this.r, this.g, this.b]; } toRgba() { return [this.r, this.g, this.b, this.a]; } toHex() { const t = this.r.toString(16), r3 = this.g.toString(16), s2 = this.b.toString(16); return `#${t.length < 2 ? "0" + t : t}${r3.length < 2 ? "0" + r3 : r3}${s2.length < 2 ? "0" + s2 : s2}`; } toCss(t = false) { const r3 = this.r + ", " + this.g + ", " + this.b; return t ? `rgba(${r3}, ${this.a})` : `rgb(${r3})`; } toString() { return this.toCss(true); } toJSON() { return this.toArray(); } toArray(t = h.AlphaMode.ALWAYS) { const r3 = n(this.r), s2 = n(this.g), i = n(this.b); return t === h.AlphaMode.ALWAYS || 1 !== this.a ? [r3, s2, i, n(255 * this.a)] : [r3, s2, i]; } clone() { return new h(this.toRgba()); } hash() { return this.r << 24 | this.g << 16 | this.b << 8 | 255 * this.a; } equals(t) { return r(t) && t.r === this.r && t.g === this.g && t.b === this.b && t.a === this.a; } _sanitize() { return this.r = Math.round(o2(this.r, 0, 255)), this.g = Math.round(o2(this.g, 0, 255)), this.b = Math.round(o2(this.b, 0, 255)), this.a = o2(this.a, 0, 1), this; } _set(t, r3, s2, i) { this.r = t, this.g = r3, this.b = s2, this.a = i; } }; h.prototype.declaredClass = "esri.Color", function(t) { var r3; (r3 = t.AlphaMode || (t.AlphaMode = {}))[r3.ALWAYS = 0] = "ALWAYS", r3[r3.UNLESS_OPAQUE = 1] = "UNLESS_OPAQUE"; }(h || (h = {})); var l2 = h; export { l2 as l }; //# sourceMappingURL=chunk-X4SA4ELJ.js.map