import { w as r } from "./index2.js";
function p(n, i, c, l) {
  const e = c - i;
  return n /= l / 2, n < 1 ? e / 2 * n * n * n + i : e / 2 * ((n -= 2) * n * n + 2) + i;
}
function u(n) {
  return n != null && n === n.window;
}
function a(n, i) {
  var c, l;
  if (typeof window == "undefined")
    return 0;
  const e = "scrollTop";
  let o = 0;
  return u(n) ? o = n.scrollY : n instanceof Document ? o = n.documentElement[e] : (n instanceof HTMLElement || n) && (o = n[e]), n && !u(n) && typeof o != "number" && (o = (l = ((c = n.ownerDocument) !== null && c !== void 0 ? c : n).documentElement) === null || l === void 0 ? void 0 : l[e]), o;
}
function D(n) {
  let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  const {
    getContainer: c = () => window,
    callback: l,
    duration: e = 450
  } = i, o = c(), m = a(o), d = Date.now(), f = () => {
    const s = Date.now() - d, t = p(s > e ? e : s, m, n, e);
    u(o) ? o.scrollTo(window.scrollX, t) : o instanceof Document ? o.documentElement.scrollTop = t : o.scrollTop = t, s < e ? r(f) : typeof l == "function" && l();
  };
  r(f);
}
export {
  a as g,
  D as s
};
