import i from "../Color.js";
import c from "../utils/type.js";
i.prototype.set = function(f, r, b = !1) {
  const [e, o] = f.split("."), t = this[e]();
  if (o) {
    const s = e.indexOf(o) - (e.substr(0, 2) === "ok" ? 2 : 0);
    if (s > -1) {
      if (c(r) == "string")
        switch (r.charAt(0)) {
          case "+":
            t[s] += +r;
            break;
          case "-":
            t[s] += +r;
            break;
          case "*":
            t[s] *= +r.substr(1);
            break;
          case "/":
            t[s] /= +r.substr(1);
            break;
          default:
            t[s] = +r;
        }
      else if (c(r) === "number")
        t[s] = r;
      else
        throw new Error("unsupported value for Color.set");
      const n = new i(t, e);
      return b ? (this._rgb = n._rgb, this) : n;
    }
    throw new Error(`unknown channel ${o} in mode ${e}`);
  } else
    return t;
};
//# sourceMappingURL=set.js.map
