( entries: readonly TranscriptEntry[], children: readonly Component[], maxCount: number, )
| 245 | } |
| 246 | |
| 247 | function createUndoChoices( |
| 248 | entries: readonly TranscriptEntry[], |
| 249 | children: readonly Component[], |
| 250 | maxCount: number, |
| 251 | ): readonly UndoChoice[] { |
| 252 | if (maxCount <= 0) return []; |
| 253 | const anchors = activeUndoAnchorEntries(entries, children).anchors.slice(-maxCount); |
| 254 | return anchors.map((entry, index) => ({ |
| 255 | id: entry.id, |
| 256 | count: anchors.length - index, |
| 257 | input: formatUndoChoiceInput(entry), |
| 258 | label: formatUndoChoiceLabel(entry), |
| 259 | })); |
| 260 | } |
| 261 | |
| 262 | function activeUndoAnchorEntries( |
| 263 | entries: readonly TranscriptEntry[], |
no test coverage detected