"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = useId;
var _uniqueId = _interopRequireDefault(require("lodash/uniqueId"));
var _compat = require("preact/compat");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
 * Generates a unique id.
 *
 * TODO: Once we're on React 18, we can use the `useId` hook instead of rolling
 * our own with `useRef` and lodash.
 */
function useId(prefix, providedId) {
  return (0, _compat.useRef)(providedId !== null && providedId !== void 0 ? providedId : (0, _uniqueId.default)(prefix)).current;
}