import { hex as p } from "../../value/types/color/hex.es.js";
import { hsla as l } from "../../value/types/color/hsla.es.js";
import { hslaToRgba as c } from "../../value/types/color/hsla-to-rgba.es.js";
import { rgba as s } from "../../value/types/color/rgba.es.js";
import { mixImmediate as f } from "./immediate.es.js";
import { mixNumber as u } from "./number.es.js";
import { warning as d } from "../../../../../../../motion-utils@12.36.0/node_modules/motion-utils/dist/es/errors.es.js";
const m = (r, o, e) => {
  const t = r * r, n = e * (o * o - t) + t;
  return n < 0 ? 0 : Math.sqrt(n);
}, b = [p, s, l], h = (r) => b.find((o) => o.test(r));
function i(r) {
  const o = h(r);
  if (d(!!o, `'${r}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !o)
    return !1;
  let e = o.parse(r);
  return o === l && (e = c(e)), e;
}
const G = (r, o) => {
  const e = i(r), t = i(o);
  if (!e || !t)
    return f(r, o);
  const n = { ...e };
  return (a) => (n.red = m(e.red, t.red, a), n.green = m(e.green, t.green, a), n.blue = m(e.blue, t.blue, a), n.alpha = u(e.alpha, t.alpha, a), s.transform(n));
};
export {
  G as mixColor,
  m as mixLinearColor
};
//# sourceMappingURL=color.es.js.map
