The Nelson-Seiberg Theorem Generalized with Nonpolynomial Superpotentials