The primaries were so skewed in her favour that she'd have had to completely choke to lose them, and she nearly managed it regardless. The amount of groundwork that they did before the primaries had even started was incredible, and yet within months she still managed to burn a vast part of the goodwill that she'd built up during her SoS stint.
I think people generally don't recognize quite how huge an advantage she went into that primary with, the endorsements, the connections, the DNC ties, the mass market recognition and much more. For her to be taken to almost a tie by an old self described socialist who 90% of Americans had never even heard of was unbelievable. But then again it shouldn't have been really, because she's a really, really terrible campaigner. The elephant in the room with Trump winning was that if it had been anyone BUT Trump she'd have lost by a truly staggering margin.