Endogenous Cartel Formation with Heterogeneous Firms and Differentiated Products