"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const React = require("react");
const PresenceContext = require("../../context/PresenceContext.js");
const useId = require("../../utils/use-id.js");
function usePresence() {
  var context = React.useContext(PresenceContext.PresenceContext);
  if (context === null)
    return [true, null];
  var isPresent = context.isPresent, onExitComplete = context.onExitComplete, register = context.register;
  var id = useId.useId();
  React.useEffect(function() {
    return register(id);
  }, []);
  var safeToRemove = function() {
    return onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete(id);
  };
  return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
}
exports.usePresence = usePresence;
//# sourceMappingURL=use-presence.js.map
