import { useRef as u } from "react";
const s = function(o, c) {
  var r = u(!1), t = u(null);
  function l() {
    clearTimeout(t.current), r.current = !0, t.current = setTimeout(function() {
      r.current = !1;
    }, 50);
  }
  var e = u({
    top: o,
    bottom: c
  });
  return e.current.top = o, e.current.bottom = c, function(f) {
    var a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, n = (
      // Pass origin wheel when on the top
      f < 0 && e.current.top || // Pass origin wheel when on the bottom
      f > 0 && e.current.bottom
    );
    return a && n ? (clearTimeout(t.current), r.current = !1) : (!n || r.current) && l(), !r.current && n;
  };
};
export {
  s as default
};
