I say, and with God's success: It is not permissible for a menstruating woman to stay in the mosque according to the four schools of thought, and the disagreement is only about passing through. However, the mosque is not designated for prayer, and thus the residence of the imam and the library and others are not considered part of the mosque. In our country's custom, the prayer areas for women in mosques are for the needs of women; they are for lessons and teaching the Quran, because women rarely pray in them. For example, their prayers are during Friday or Taraweeh, and they do not perform the five daily prayers there. Therefore, their primary use is not for prayer, and thus the women's prayer areas can be considered not a mosque, so it is permissible for a menstruating woman to enter and stay in them. And God knows best.