Total primary energy supply (TPES) is the total amount of primary energy that a country has at their disposal. This includes imported energy, exported energy (subtracted off) and energy extracted from natural resources (energy production). Usually TPES is thought of as being the sum of all primary energy sources, but some end use energy must be taken into consideration. This comes from the fact that TPES includes both imports and exports. The net amount of electricity traded (imports - exports) and the net secondary fuels (for example amount of gasoline imported - amount of gasoline exported) become part of the TPES.
In the data visualization below, click on different countries to see what the energy mix looks like. Be aware that some countries (like Canada, or OPEC countries like Kuwait) export energy (like electricity or gasoline), which shows up as a negative amount on the line chart. Often these exports would normally be part of total final consumption (see figure 1), but because they're exported, they're part of the total primary energy supply.