import r from "../../../rc-util/es/raf.mjs";
import { easeInOutCubic as u } from "./easings.mjs";
import p, { isWindow as d } from "./getScroll.mjs";
function b(i) {
  let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  const {
    getContainer: a = () => window,
    callback: s,
    duration: t = 450
  } = l, o = a(), m = p(o, !0), f = Date.now(), c = () => {
    const e = Date.now() - f, n = u(e > t ? t : e, m, i, t);
    d(o) ? o.scrollTo(window.pageXOffset, n) : o instanceof Document || o.constructor.name === "HTMLDocument" ? o.documentElement.scrollTop = n : o.scrollTop = n, e < t ? r(c) : typeof s == "function" && s();
  };
  r(c);
}
export {
  b as default
};
