Parse ANSI escape codes from text, strip them, and return decoration segments.
The raw text potentially containing ANSI escape codes
The ANSI state carried over from a previous parse call
The stripped text, decoration segments, and the final ANSI state
Parse ANSI escape codes from text, strip them, and return decoration segments.