import { interpolate as c } from "../../utils/interpolate.es.js";
import { defaultOffset as p } from "../keyframes/offsets/default.es.js";
import { convertOffsetToTimes as u } from "../keyframes/offsets/time.es.js";
import { isEasingArray as l } from "../../../../../../../motion-utils@12.36.0/node_modules/motion-utils/dist/es/easing/utils/is-easing-array.es.js";
import { easingDefinitionToFunction as m } from "../../../../../../../motion-utils@12.36.0/node_modules/motion-utils/dist/es/easing/utils/map.es.js";
import { easeInOut as g } from "../../../../../../../motion-utils@12.36.0/node_modules/motion-utils/dist/es/easing/ease.es.js";
function T(n, t) {
  return n.map(() => t || g).splice(0, n.length - 1);
}
function y({ duration: n = 300, keyframes: t, times: o, ease: r = "easeInOut" }) {
  const e = l(r) ? r.map(m) : m(r), i = {
    done: !1,
    value: t[0]
  }, s = u(
    // Only use the provided offsets if they're the correct length
    // TODO Maybe we should warn here if there's a length mismatch
    o && o.length === t.length ? o : p(t),
    n
  ), a = c(s, t, {
    ease: Array.isArray(e) ? e : T(t, e)
  });
  return {
    calculatedDuration: n,
    next: (f) => (i.value = a(f), i.done = f >= n, i)
  };
}
export {
  T as defaultEasing,
  y as keyframes
};
//# sourceMappingURL=keyframes.es.js.map
