How Did the Sages Arrive at Thirty-Nine Primary Categories of Labor?

From Hilkhot Shabbat by R Yosef Zvi Rimon.