A general theory of nonlinear sufficient dimension reduction: formulation and estimation