Complementarity Reformulations for the Optimal Design of Distributed Energy Systems with Multiphase Optimal Power Flow