4D Chern–Simons theory and affine Gaudin models