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AY,EAAgB,GAEhD,KAAK,OAAO,SAAS,GACrB,KAAK,OAAO,MAAM,EACpB,CAEA,IAAA,GACE,KAAK,KAAK,KACV,KAAK,OAAO,MAAM,KACpB,EAGF,OAAO,QAAU","file":"/npm/node-progress-loader@1.0.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/node-progress-loader@1.0.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const chalk = require('chalk');\nconst helper = require('./helper');\nconst CONSTANTS = require('./constants');\n\nclass SiccProgressBar {\n  constructor({\n    size,\n    stream = process.stdout,\n    complete_char = '\\u2588',\n    incomplete_char = '\\u2591',\n  } = {}) {\n    this.stream = stream;\n    this.MAX = size | stream.columns;\n    this.DONE_CHAR = chalk.green(complete_char);\n    this.TODO_CHAR = chalk.green(incomplete_char);\n    this.MESSAGE_LENGTH = 20;\n    this.PERCENTAGE_LENGTH = 4;\n    this.OUTPUT_PADDING = 7;\n  }\n\n  getProgressBarWidth() {\n    return this.MAX - this.PERCENTAGE_LENGTH - this.MESSAGE_LENGTH - this.OUTPUT_PADDING;\n  }\n\n  getPercentageString(currentPercent) {\n    return helper.padStringLeft(currentPercent, this.PERCENTAGE_LENGTH - 1).concat('%');\n  }\n\n  getCurrentTaskString(message) {\n    return helper.padStringRight(message, this.MESSAGE_LENGTH);\n  }\n\n  getFinishedTasksString() {\n    const str = `${CONSTANTS.SPACE_CHAR}Done!`;\n\n    return helper.padStringRight(str, this.MESSAGE_LENGTH);\n  }\n\n  start() {    \n    this.draw();\n  }\n\n  mapToWidth(percent) {\n    return this.getProgressBarWidth() / 100 * percent;\n  }\n\n  composeLine(currentPercent = 0, message = '') {\n    const isFinished = currentPercent === 100;\n    const progressPoint = currentPercent ? this.mapToWidth(currentPercent) : 0;\n    const percentageString = this.getPercentageString(currentPercent);\n    const currentTaskString = isFinished\n      ? this.getFinishedTasksString('Done!')\n      : this.getCurrentTaskString(message);\n    const progressBarWidth = this.getProgressBarWidth();\n    const progressBar = new Array(progressBarWidth)\n      .fill(this.DONE_CHAR, 0, progressPoint)\n      .fill(this.TODO_CHAR, progressPoint, progressBarWidth)\n      .join('');\n    \n    return `${percentageString} | ${progressBar} | ${currentTaskString}`;\n  }\n  \n  draw(currentPercent, message) {\n    const toDraw = this.composeLine(currentPercent, message);\n  \n    this.stream.cursorTo(0);\n    this.stream.write(toDraw);\n  }\n\n  stop() {\n    this.draw(100);\n    this.stream.write('\\n');\n  }\n}\n\nmodule.exports = SiccProgressBar;"]}