Brazil's former president Jair Bolsonaro has been permitted to leave prison for surgery on Christmas Day, with the Supreme Court's approval.