Unified gas-kinetic wave-particle methods VII: Diatomic gas with rotational and vibrational nonequilibrium