import { onMounted as y } from "vue";
import { useEventListener as p } from "./useEventListener.js";
import { requestTick as b } from "../helpers/utils.js";
function S(m, s = null, e = null) {
  function f(t) {
    const { scrollTop: o, scrollHeight: n, clientHeight: r } = t;
    if (!(n > r) || !s)
      return null;
    const c = n - o - r, l = o > s ? s : 0, i = c > s ? r - s - l : r;
    return `linear-gradient(
        to bottom,
        transparent,
        black ${l}px,
        black ${i}px,
        transparent 100%
      )`;
  }
  function k(t) {
    const { scrollLeft: o, scrollWidth: n, clientWidth: r } = t;
    if (!(n > r) || !e)
      return null;
    const c = n - o - r, l = o > e ? e : 0, i = c > e ? r - e - l : r;
    return `linear-gradient(
        to right,
        transparent,
        black ${l}px,
        black ${i}px,
        transparent 100%
      )`;
  }
  function a() {
    const t = m.value;
    if (!t)
      return;
    const o = [f(t), k(t)].filter((n) => n !== null);
    t.style.setProperty("-webkit-mask-image", o.join(",")), t.style.setProperty("mask-image", o.join(",")), o.length > 1 && (t.style.setProperty("-webkit-mask-composite", "source-in"), t.style.setProperty("mask-composite", "source-in"));
  }
  const u = b(a);
  y(a), p(window, "scroll", u, !0), p(window, "resize", u, !0);
}
export {
  S as useScroll
};
//# sourceMappingURL=useScroll.js.map
