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

//# sourceMappingURL=useScroll.js.map