import { useContext as f, useId as l, useEffect as c, useCallback as i } from "react";
import { PresenceContext as m } from "../../context/PresenceContext.es.js";
function p(e = !0) {
  const o = f(m);
  if (o === null)
    return [!0, null];
  const { isPresent: r, onExitComplete: t, register: u } = o, n = l();
  c(() => {
    if (e)
      return u(n);
  }, [e]);
  const s = i(() => e && t && t(n), [n, t, e]);
  return !r && t ? [!1, s] : [!0];
}
export {
  p as usePresence
};
//# sourceMappingURL=use-presence.es.js.map
