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