I looked into this myself recently and here is what I came up with:
1l water
1,5g NaCl (sodium chloride aka salt)
0,5g KCl (potassium chloride)
optional: ca 32g dextrose
I came across a study that used a variety of the following:
1l water (or tea, or sirup-drink)
1,5g NaCl
50g Maltodextrin
https://sgsm.ch/fileadmin/user_upload/Zeitschrift/54-2006-3/Osmolality_54_3_06.pdfSweat composition is:
Mineral mg/L
Sodium 460-1840
Chloride 710-2840
Potassium 160-390
Magnesium 0-36
Calcium 0-120
Magnesium and Calcium are in small enough amounts not to be relevant in an electrolyte drink.
Many commercial products are too low in sodium.