import { animate as u, makeEaseOut as h } from "./utils.js";
function d(t, e) {
  const o = t.scrollTop, n = t.getBoundingClientRect().height, i = e.offsetTop, c = e.getBoundingClientRect().height;
  return i + c < n + o && i > o;
}
function T(t, e) {
  const o = t.scrollTop, n = t.getBoundingClientRect().height, i = e.offsetTop, c = e.getBoundingClientRect().height;
  return i + c < n + o ? "ceil" : i > o ? "floor" : "visible";
}
function m(t, e, o = {}) {
  const n = t.scrollTop, i = t.getBoundingClientRect().height, c = e.getBoundingClientRect().height, l = e.offsetTop, r = T(t, e);
  if (r === "visible")
    return;
  const g = (s) => {
    const f = r === "floor" ? l - (i - c) : l;
    t.scrollTop = n + s * (f - n);
  };
  d(t, e) || u({
    duration: o.duration || 100,
    timing: h((s) => s),
    draw: g
  });
}
function B(t, e, o, n) {
  return t.addEventListener(e, o, n), function() {
    t.removeEventListener(e, o);
  };
}
function C(t, e) {
  const o = e.getBoundingClientRect();
  return t.x < o.x || t.x > o.x + o.width || t.y < o.y || t.y > o.y + o.height;
}
export {
  C as detectOutside,
  B as eventListener,
  T as getElementScrollPosition,
  d as isElementVisible,
  m as scrollIntoView
};
//# sourceMappingURL=dom.js.map
