Building a basic, nested accessor

Let's say you have a number of UI elements with managed z-indexes across your app. Since z-indexes are relative to others in the stack, a complex z-index stack can be hard to parse — where are these values being set? Why are they so high on modals? Why is there a 5 and a 7, but not a 6?

Z-indexes are a great case for maps, simplifying your whole stack into a nice tree: