src/vs/base/common/observableImpl/logging.ts/process
function consoleTextToArgs(text: ConsoleText): unknown[] {
	const styles = new Array<any>();
	const initial = {};
	const data = initial;
	let firstArg = '';

	function process(t: ConsoleText): void {
		if ('length' in t) {
			for (const item of t) {
				if (item) {
					process(item);
				}
			}
		} else if ('text' in t) {
			firstArg += `%c${t.text}`;
			styles.push(t.style);
			if (t.data) {
				Object.assign(data, t.data);
			}
		} else if ('data' in t) {
			Object.assign(data, t.data);
		}
	}

	process(text);

	const result = [firstArg, ...styles];
	if (Object.keys(data).length > 0) {
		result.push(data);
	}

	return result;
}