All manner of hugging goes on in society in the US. For some people it is unwanted regardless of who the other person is. Autism spectrum comes to mind. How aggressive can person A be against person B to avoid the hug? Here is a recent post:
https://interpersonal.stackexchange.com/questions/9016
What is the basis for legal limits on response? I imagine A is allowed by law to aggress against B only to some proportionate extent. But proportionate in what terms? Of society, in which case A can't pepper spray B when B tries to hug A? The idiosyncrasies of A, in which case pepper spray would be justifiable, in my opinion.