"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const React = require("react");
const useIsomorphicEffect = require("../use-isomorphic-effect/use-isomorphic-effect.cjs");
const randomId = require("../utils/random-id/random-id.cjs");
const useReactId = require("./use-react-id.cjs");
function useId(staticId) {
  const reactId = useReactId.useReactId();
  const [uuid, setUuid] = React.useState(reactId);
  useIsomorphicEffect.useIsomorphicEffect(() => {
    setUuid(randomId.randomId());
  }, []);
  if (typeof staticId === "string") {
    return staticId;
  }
  if (typeof window === "undefined") {
    return reactId;
  }
  return uuid;
}
exports.useId = useId;
