Model Barbara Palvin has undergone surgery to treat endometriosis after suffering years of pain and "sleepless nights on the bathroom floor".