Theory of the Ergodic Divertor