Confidence-Aware Imitation Learning from Demonstrations with Varying Optimality