import { mix as C } from "./mix.es.js";
import { invariant as c } from "../../../../hey-listen/dist/hey-listen.es.es.js";
import { hslaToRgba as f } from "./hsla-to-rgba.es.js";
import { hsla as s } from "../../../../style-value-types/dist/es/color/hsla.es.js";
import { rgba as m } from "../../../../style-value-types/dist/es/color/rgba.es.js";
import { hex as b } from "../../../../style-value-types/dist/es/color/hex.es.js";
const d = (o, t, r) => {
  const a = o * o, e = t * t;
  return Math.sqrt(Math.max(0, r * (e - a) + a));
}, y = [b, m, s], h = (o) => y.find((t) => t.test(o)), x = (o) => `'${o}' is not an animatable color. Use the equivalent color code instead.`, j = (o, t) => {
  let r = h(o), a = h(t);
  c(!!r, x(o)), c(!!a, x(t));
  let e = r.parse(o), n = a.parse(t);
  r === s && (e = f(e), r = m), a === s && (n = f(n), a = m);
  const l = Object.assign({}, e);
  return (p) => {
    for (const i in l)
      i !== "alpha" && (l[i] = d(e[i], n[i], p));
    return l.alpha = C(e.alpha, n.alpha, p), r.transform(l);
  };
};
export {
  j as mixColor,
  d as mixLinearColor
};
//# sourceMappingURL=mix-color.es.js.map
