"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const error = require("../../utils/error.js");
const index$1 = require("../use-namespace/index.js");
const Vue = require("vue");
const index = require("../../../node_modules/@vueuse/shared/index.js");
const defaultIdInjection = {
  prefix: Math.floor(Math.random() * 1e4),
  current: 0
};
const ID_INJECTION_KEY = Symbol("elIdInjection");
const useIdInjection = () => {
  return Vue.getCurrentInstance() ? Vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
};
const useId = (deterministicId) => {
  const idInjection = useIdInjection();
  if (!index.isClient && idInjection === defaultIdInjection) error.debugWarn("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
usage: app.provide(ID_INJECTION_KEY, {
  prefix: number,
  current: number,
})`);
  const namespace = index$1.useGetDerivedNamespace();
  return index.computedEager(() => Vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
};
exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
exports.useId = useId;
exports.useIdInjection = useIdInjection;
