import { ref } from 'vue'; const usePopperContentFocusTrap = (props, emit) => { const trapped = ref(false); const focusStartRef = ref(); const onFocusAfterTrapped = () => { emit("focus"); }; const onFocusAfterReleased = (event) => { var _a; if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") { focusStartRef.value = "first"; emit("blur"); } }; const onFocusInTrap = (event) => { if (props.visible && !trapped.value) { if (event.target) { focusStartRef.value = event.target; } trapped.value = true; } }; const onFocusoutPrevented = (event) => { if (!props.trapping) { if (event.detail.focusReason === "pointer") { event.preventDefault(); } trapped.value = false; } }; const onReleaseRequested = () => { trapped.value = false; emit("close"); }; return { focusStartRef, trapped, onFocusAfterReleased, onFocusAfterTrapped, onFocusInTrap, onFocusoutPrevented, onReleaseRequested }; }; export { usePopperContentFocusTrap }; //# sourceMappingURL=use-focus-trap.mjs.map