import { useState as i, useEffect as v } from "react";
function d(u, s = 0) {
  const [m, n] = i(!1);
  let o = null;
  const r = () => {
    s > 0 ? o = setTimeout(() => n(!0), s) : n(!0);
  }, t = () => {
    o && (clearTimeout(o), o = null), n(!1);
  };
  return v(() => {
    const e = u.current;
    if (e)
      return e.addEventListener ? (e.addEventListener("mouseover", r), e.addEventListener("mouseout", t)) : e.addListener ? (e.addListener("mouseover", r), e.addListener("mouseout", t)) : e.marker && (e.marker.addListener("mouseover", r), e.marker.addListener("mouseout", t)), () => {
        e.removeEventListener ? (e.removeEventListener("mouseover", r), e.removeEventListener("mouseout", t)) : e.marker && e.marker.removeListener && (e.marker.removeListener("mouseover", r), e.marker.removeListener("mouseout", t));
      };
  }, [u.current, s]), m;
}
export {
  d as useHover
};
