import { useEffect } from "react";
import { useGetAriaLabelOfModal } from "./useGetAriaLabelOfModal.mjs";
function useSetAriaLabelForModal(visible) {
    const { getAriaLabel } = useGetAriaLabelOfModal();
    useEffect(()=>{
        if (visible) setTimeout(()=>{
            const wrappers = [
                ...document.querySelectorAll('.ant-modal-content')
            ];
            const masks = [
                ...document.querySelectorAll('.ant-modal-wrap')
            ];
            const currentMask = masks[masks.length - 1];
            const currentWrapper = wrappers[wrappers.length - 1];
            if (currentMask) {
                currentMask.setAttribute('role', 'button');
                currentMask.setAttribute('aria-label', getAriaLabel('mask'));
            }
            if (currentWrapper) {
                currentWrapper.setAttribute('role', 'button');
                currentWrapper.setAttribute('data-testid', getAriaLabel());
                currentWrapper.setAttribute('aria-label', getAriaLabel());
            }
        });
    }, [
        getAriaLabel,
        visible
    ]);
}
export { useSetAriaLabelForModal };
