The TL;DR version:
@mattyb says the first things we lose through sweat are ranked from highest to lowest: Chloride, sodium, magnesium, potassium.
I wonder if anyone has ever ventured down the path of crafting your own electrolyte drinks, and if so, what did you end up with in terms of ratios or...