'use strict'; var tty = require('tty'); const env = process.env; const isDisabled = "NO_COLOR" in env; const isForced = "FORCE_COLOR" in env; const isWindows = process.platform === "win32"; const isCompatibleTerminal = tty && tty.isatty(1) && env.TERM && env.TERM !== "dumb"; const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env); const isColorSupported = !isDisabled && (isForced || isWindows || isCompatibleTerminal || isCI); const raw = (open, close, searchRegex, replaceValue) => (s) => open + (~(s += "").indexOf(close, 4) // skip opening \x1b[ ? s.replace(searchRegex, replaceValue) : s) + close; const init = (open, close) => raw( `\x1b[${open}m`, `\x1b[${close}m`, new RegExp(`\\x1b\\[${close}m`, "g"), `\x1b[${open}m` ); const reset = init(0, 0); const bold = raw("\x1b[1m", "\x1b[22m", /\x1b\[22m/g, "\x1b[22m\x1b[1m"); const dim = raw("\x1b[2m", "\x1b[22m", /\x1b\[22m/g, "\x1b[22m\x1b[2m"); const italic = init(3, 23); const underline = init(4, 24); const inverse = init(7, 27); const hidden = init(8, 28); const strikethrough = init(9, 29); const black = init(30, 39); const red = init(31, 39); const green = init(32, 39); const yellow = init(33, 39); const blue = init(34, 39); const magenta = init(35, 39); const cyan = init(36, 39); const white = init(37, 39); const gray = init(90, 39); const bgBlack = init(40, 49); const bgRed = init(41, 49); const bgGreen = init(42, 49); const bgYellow = init(43, 49); const bgBlue = init(44, 49); const bgMagenta = init(45, 49); const bgCyan = init(46, 49); const bgWhite = init(47, 49); const blackBright = init(90, 39); const redBright = init(91, 39); const greenBright = init(92, 39); const yellowBright = init(93, 39); const blueBright = init(94, 39); const magentaBright = init(95, 39); const cyanBright = init(96, 39); const whiteBright = init(97, 39); const bgBlackBright = init(100, 49); const bgRedBright = init(101, 49); const bgGreenBright = init(102, 49); const bgYellowBright = init(103, 49); const bgBlueBright = init(104, 49); const bgMagentaBright = init(105, 49); const bgCyanBright = init(106, 49); const bgWhiteBright = init(107, 49); const none = (any) => any; const createColors = ({ useColor = isColorSupported } = {}) => ({ ...Object.entries({ reset, bold, dim, italic, underline, inverse, hidden, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright, }).reduce((colorMap, [key, color]) => ({ ...colorMap, [key]: useColor ? color : none, })), }); exports.bgBlack = bgBlack; exports.bgBlackBright = bgBlackBright; exports.bgBlue = bgBlue; exports.bgBlueBright = bgBlueBright; exports.bgCyan = bgCyan; exports.bgCyanBright = bgCyanBright; exports.bgGreen = bgGreen; exports.bgGreenBright = bgGreenBright; exports.bgMagenta = bgMagenta; exports.bgMagentaBright = bgMagentaBright; exports.bgRed = bgRed; exports.bgRedBright = bgRedBright; exports.bgWhite = bgWhite; exports.bgWhiteBright = bgWhiteBright; exports.bgYellow = bgYellow; exports.bgYellowBright = bgYellowBright; exports.black = black; exports.blackBright = blackBright; exports.blue = blue; exports.blueBright = blueBright; exports.bold = bold; exports.createColors = createColors; exports.cyan = cyan; exports.cyanBright = cyanBright; exports.dim = dim; exports.gray = gray; exports.green = green; exports.greenBright = greenBright; exports.hidden = hidden; exports.inverse = inverse; exports.isColorSupported = isColorSupported; exports.italic = italic; exports.magenta = magenta; exports.magentaBright = magentaBright; exports.red = red; exports.redBright = redBright; exports.reset = reset; exports.strikethrough = strikethrough; exports.underline = underline; exports.white = white; exports.whiteBright = whiteBright; exports.yellow = yellow; exports.yellowBright = yellowBright;