Calculation & Aggregation
Build a "flattened" array of all items regardless of whether they are a main or sub item. The order of output items should be "depth-first" meaning the array needs to show the first main line item followed by all of its sub items before the second main line item appears.
Hint: This requires understanding array functions