Completed Design Problem. It passes all of Ty's test cases and my own tests.
The only issue is for case-esac commands separated by 1 newline.