import { TokenDict } from "../token" ; import { ProgressBarState } from "../ProgressBar" ; import { MultiProgressBarRenderer , ProgressBarRenderer } from "./ProgressBarRenderer" ; /**
 * Used to render a  ProgressBarState to a Buffer.
 *
 * Writes the string representation of the bar to the buffer, followed by a CR (`\r`) character.
 *
 *  category see https export class BufferProgressBarRenderer extends ProgressBarRenderer { constructor ( template , tokens , public readonly buffer ) { super ( template , tokens ) ; } param bar public render ( bar ) { this . buffer . write ( this . makeString ( bar ) + '\r' ) ; } } /**
 * Used to render multiple  ProgressBarState s to a Buffer.
 *
 * Writes the string representation of the bar to the buffer, separated by an EOL (`\n`) character.
 * The sequence of bars written are followed by a CR (`\r`) character.
 *
 *  category see https see https export class BufferMultiProgressBarRenderer extends MultiProgressBarRenderer { constructor ( template , tokens , bars , public readonly buffer ) { super ( template , tokens , bars ) ; } /**
     * Write the bars to the buffer, split by EOL and followed by CR.
     *
     * Example: `"[===>      ] 40%\n[====>     ] 50%\n[=>        ] 20%\r"`
     */ public render ( ) { this . buffer . write ( this . bars . map ( it => this . makeString ( it ) ) . join ( '\n' ) + '\r' ) ; } }