import { onMounted, onBeforeUnmount } from "vue";
import { EVENT_CODE as e$1 } from "../../constants/aria.mjs";
import { isClient as f } from "../../../../@vueuse/shared/index.mjs";
let e = [];
const r = (n) => {
  const o = n;
  o.key === e$1.esc && e.forEach((i) => i(o));
}, p = (n) => {
  onMounted(() => {
    e.length === 0 && document.addEventListener("keydown", r), f && e.push(n);
  }), onBeforeUnmount(() => {
    e = e.filter((o) => o !== n), e.length === 0 && f && document.removeEventListener("keydown", r);
  });
};
export {
  p as useEscapeKeydown
};
