"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.stripAnsi = void 0;
const ansi_regex_1 = __importDefault(require("ansi-regex"));
const regex = (0, ansi_regex_1.default)();
// from https://github.com/chalk/strip-ansi/blob/main/index.js
// due to pure ESM incompatibility
function stripAnsi(string) {
    if (typeof string !== "string") {
        throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
    }
    // Even though the regex is global, we don't need to reset the `.lastIndex`
    // because unlike `.exec()` and `.test()`, `.replace()` does it automatically
    // and doing it manually has a performance penalty.
    return string.replace(regex, "");
}
exports.stripAnsi = stripAnsi;
