Obviously she didn't fear that he was likely to do either of things otherwise she would surely have run like hell, which seem the sensible and natural thing to do if you are fearful of someone.
No, that's not how fight or flight works.
My gut reaction is anger when I'm threatened.
I have been in a fight because someone broke into my house. Believe me when I tell you that you do not "think" in a genuine fight like that, you just "do". If you are to the point of needing to exchange blows, instincts and adrenaline kick in. OP could very well have given an instinctual reaction, then again she might not have. Only she will know.
When I talked about it, I did crack jokes and down play it. A guy broke into my house with the intention of raping me and he was the one who got his ass kicked and was terrorized instead, it's pretty comical schadenfreude in my opinion. I'm not obligated to act the part of a sniveling victim, neither is OP. He's the one that should be somberly reflecting on what happened, not me. You might have taken a flashing seriously, I would have cracked jokes about how tiny his dick was after. Different people react differently.
She was sexually harassed and acted accordingly. Would I recommend hitting someone? Not unless you have to. But do find it pretty comical that he got what was coming to him. He deserved it.
Did she break the law? Technically debatable, depending on why he was within slapping reach in the first place. If he's close enough to be slapped, he was probably a short second away from a grope. If she walked up to him, well he didn't exactly take her serious and back off did he?