"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const index$1 = require("../use-namespace/index.js");
const index$2 = require("../use-id/index.js");
const vue = require("vue");
const index = require("../../../node_modules/@vueuse/shared/index.js");
const usePopperContainerId = () => {
  const namespace = index$1.useGetDerivedNamespace();
  const idInjection = index$2.useIdInjection();
  const id = vue.computed(() => {
    return `${namespace.value}-popper-container-${idInjection.prefix}`;
  });
  return {
    id,
    selector: vue.computed(() => `#${id.value}`)
  };
};
const createContainer = (id) => {
  const container = document.createElement("div");
  container.id = id;
  document.body.appendChild(container);
  return container;
};
const usePopperContainer = () => {
  const { id, selector } = usePopperContainerId();
  vue.onBeforeMount(() => {
    if (!index.isClient) return;
    if (!document.body.querySelector(selector.value)) createContainer(id.value);
  });
  return {
    id,
    selector
  };
};
exports.usePopperContainer = usePopperContainer;
exports.usePopperContainerId = usePopperContainerId;
