import "../../utils/type.js";
import p from "../../utils/unpack.js";
const { floor: m } = Math, _ = (...n) => {
  n = p(n, "hcg");
  let [c, b, r] = n, t, o, s;
  r = r * 255;
  const f = b * 255;
  if (b === 0)
    t = o = s = r;
  else {
    c === 360 && (c = 0), c > 360 && (c -= 360), c < 0 && (c += 360), c /= 60;
    const h = m(c), l = c - h, e = r * (1 - b), i = e + f * (1 - l), k = e + f * l, a = e + f;
    switch (h) {
      case 0:
        [t, o, s] = [a, k, e];
        break;
      case 1:
        [t, o, s] = [i, a, e];
        break;
      case 2:
        [t, o, s] = [e, a, k];
        break;
      case 3:
        [t, o, s] = [e, i, a];
        break;
      case 4:
        [t, o, s] = [k, e, a];
        break;
      case 5:
        [t, o, s] = [a, e, i];
        break;
    }
  }
  return [t, o, s, n.length > 3 ? n[3] : 1];
};
export {
  _ as default
};
//# sourceMappingURL=hcg2rgb.js.map
