import { c as R } from "../../../../../_virtual/index26.js";
import O from "../../../escape-string-regexp@1.0.5/node_modules/escape-string-regexp/index.js";
import "../../../ansi-styles@3.2.1/node_modules/ansi-styles/index.js";
import x from "../../../supports-color@5.5.0/node_modules/supports-color/browser.js";
import C from "./templates.js";
import { a as j } from "../../../../../_virtual/index37.js";
(function(i) {
  const p = O, o = j.exports, y = x.stdout, b = C, g = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm"), f = ["ansi", "ansi", "ansi256", "ansi16m"], m = /* @__PURE__ */ new Set(["gray"]), n = /* @__PURE__ */ Object.create(null);
  function h(t, e) {
    e = e || {};
    const l = 0;
    t.level = e.level === void 0 ? l : e.level, t.enabled = "enabled" in e ? e.enabled : t.level > 0;
  }
  function c(t) {
    if (!this || !(this instanceof c) || this.template) {
      const e = {};
      return h(e, t), e.template = function() {
        const l = [].slice.call(arguments);
        return _.apply(null, [e.template].concat(l));
      }, Object.setPrototypeOf(e, c.prototype), Object.setPrototypeOf(e.template, e), e.template.constructor = c, e.template;
    }
    h(this, t);
  }
  g && (o.blue.open = "\x1B[94m");
  for (const t of Object.keys(o))
    o[t].closeRe = new RegExp(p(o[t].close), "g"), n[t] = {
      get() {
        const e = o[t];
        return a.call(this, this._styles ? this._styles.concat(e) : [e], this._empty, t);
      }
    };
  n.visible = {
    get() {
      return a.call(this, this._styles || [], !0, "visible");
    }
  }, o.color.closeRe = new RegExp(p(o.color.close), "g");
  for (const t of Object.keys(o.color.ansi))
    m.has(t) || (n[t] = {
      get() {
        const e = this.level;
        return function() {
          const r = {
            open: o.color[f[e]][t].apply(null, arguments),
            close: o.color.close,
            closeRe: o.color.closeRe
          };
          return a.call(this, this._styles ? this._styles.concat(r) : [r], this._empty, t);
        };
      }
    });
  o.bgColor.closeRe = new RegExp(p(o.bgColor.close), "g");
  for (const t of Object.keys(o.bgColor.ansi)) {
    if (m.has(t))
      continue;
    const e = "bg" + t[0].toUpperCase() + t.slice(1);
    n[e] = {
      get() {
        const l = this.level;
        return function() {
          const s = {
            open: o.bgColor[f[l]][t].apply(null, arguments),
            close: o.bgColor.close,
            closeRe: o.bgColor.closeRe
          };
          return a.call(this, this._styles ? this._styles.concat(s) : [s], this._empty, t);
        };
      }
    };
  }
  const d = Object.defineProperties(() => {
  }, n);
  function a(t, e, l) {
    const r = function() {
      return v.apply(r, arguments);
    };
    r._styles = t, r._empty = e;
    const s = this;
    return Object.defineProperty(r, "level", {
      enumerable: !0,
      get() {
        return s.level;
      },
      set(u) {
        s.level = u;
      }
    }), Object.defineProperty(r, "enabled", {
      enumerable: !0,
      get() {
        return s.enabled;
      },
      set(u) {
        s.enabled = u;
      }
    }), r.hasGrey = this.hasGrey || l === "gray" || l === "grey", r.__proto__ = d, r;
  }
  function v() {
    const t = arguments, e = t.length;
    let l = String(arguments[0]);
    if (e === 0)
      return "";
    if (e > 1)
      for (let s = 1; s < e; s++)
        l += " " + t[s];
    if (!this.enabled || this.level <= 0 || !l)
      return this._empty ? "" : l;
    const r = o.dim.open;
    g && this.hasGrey && (o.dim.open = "");
    for (const s of this._styles.slice().reverse())
      l = s.open + l.replace(s.closeRe, s.open) + s.close, l = l.replace(/\r?\n/g, `${s.close}$&${s.open}`);
    return o.dim.open = r, l;
  }
  function _(t, e) {
    if (!Array.isArray(e))
      return [].slice.call(arguments, 1).join(" ");
    const l = [].slice.call(arguments, 2), r = [e.raw[0]];
    for (let s = 1; s < e.length; s++)
      r.push(String(l[s - 1]).replace(/[{}\\]/g, "\\$&")), r.push(String(e.raw[s]));
    return b(t, r.join(""));
  }
  Object.defineProperties(c.prototype, n), i.exports = c(), i.exports.supportsColor = y, i.exports.default = i.exports;
})(R);
//# sourceMappingURL=index.js.map
