function h(n) {
  return (1 + Math.sin(Math.PI * n - Math.PI / 2)) / 2;
}
function A(n, a, i, f = {}, t = () => {
}) {
  const {
    ease: m = h,
    duration: d = 300
    // standard
  } = f;
  let e = null;
  const r = a[n];
  let u = !1;
  const l = () => {
    u = !0;
  }, o = (s) => {
    if (u) {
      t(new Error("Animation cancelled"));
      return;
    }
    e === null && (e = s);
    const c = Math.min(1, (s - e) / d);
    if (a[n] = m(c) * (i - r) + r, c >= 1) {
      requestAnimationFrame(() => {
        t(null);
      });
      return;
    }
    requestAnimationFrame(o);
  };
  return r === i ? (t(new Error("Element already at target position")), l) : (requestAnimationFrame(o), l);
}
export {
  A as default
};
