mermaid: Fix stack overflow when laying out deeply nested subgraphs (#58325)

Closes FR-49

This PR fixes stack overflow in flowcharts with deeply nested subgraphs.
Rewrote recursive call to iterate with an explicit stack on heap. Added
test which reproduces the overflow.

We use our fork now, with patch on existing v0.4.0:
https://github.com/zed-industries/merman/commit/1c765dcca2ef5092fcde7bebe8374819563623ef

Release Notes:

- Fixed a crash in when rendering Mermaid diagram flowcharts with deeply
nested subgraphs.
4e949a1cc3Smit Barmase committed on 6/2/2026, 1:21:32 PM· committed by GitHubparentb077f41
2 files changedLine totals unavailable