Ritt's theorem and the Heins map in hyperbolic complex manifolds