Chaotic dynamics and basin erosion in nanomagnets subject to time-harmonic magnetic fields