import { __exports as C } from "../../../../../../../_virtual/index39.js";
import "../../../../../@babel_highlight@7.18.6/node_modules/@babel/highlight/lib/index.js";
import { __exports as N } from "../../../../../../../_virtual/index40.js";
Object.defineProperty(C, "__esModule", {
  value: !0
});
C.codeFrameColumns = j;
C.default = v;
var $ = N;
let _ = !1;
function D(r) {
  return {
    gutter: r.grey,
    marker: r.red.bold,
    message: r.red.bold
  };
}
const W = /\r\n|[\n\r\u2028\u2029]/;
function O(r, o, e) {
  const c = Object.assign({
    column: 0,
    line: -1
  }, r.start), d = Object.assign({}, c, r.end), {
    linesAbove: s = 2,
    linesBelow: l = 3
  } = e || {}, m = c.line, i = c.column, g = d.line, h = d.column;
  let b = Math.max(m - (s + 1), 0), f = Math.min(o.length, g + l);
  m === -1 && (b = 0), g === -1 && (f = o.length);
  const p = g - m, t = {};
  if (p)
    for (let n = 0; n <= p; n++) {
      const a = n + m;
      if (!i)
        t[a] = !0;
      else if (n === 0) {
        const u = o[a - 1].length;
        t[a] = [i, u - i + 1];
      } else if (n === p)
        t[a] = [0, h];
      else {
        const u = o[a - n].length;
        t[a] = [0, u];
      }
    }
  else
    i === h ? i ? t[m] = [i, 0] : t[m] = !0 : t[m] = [i, h - i];
  return {
    start: b,
    end: f,
    markerLines: t
  };
}
function j(r, o, e = {}) {
  const c = (e.highlightCode || e.forceColor) && (0, $.shouldHighlight)(e), d = (0, $.getChalk)(e), s = D(d), l = (n, a) => c ? n(a) : a, m = r.split(W), {
    start: i,
    end: g,
    markerLines: h
  } = O(o, m, e), b = o.start && typeof o.start.column == "number", f = String(g).length;
  let t = (c ? (0, $.default)(r, e) : r).split(W, g).slice(i, g).map((n, a) => {
    const u = i + 1 + a, k = ` ${` ${u}`.slice(-f)} |`, L = h[u], x = !h[u + 1];
    if (L) {
      let M = "";
      if (Array.isArray(L)) {
        const y = n.slice(0, Math.max(L[0] - 1, 0)).replace(/[^\t]/g, " "), E = L[1] || 1;
        M = [`
 `, l(s.gutter, k.replace(/\d/g, " ")), " ", y, l(s.marker, "^").repeat(E)].join(""), x && e.message && (M += " " + l(s.message, e.message));
      }
      return [l(s.marker, ">"), l(s.gutter, k), n.length > 0 ? ` ${n}` : "", M].join("");
    } else
      return ` ${l(s.gutter, k)}${n.length > 0 ? ` ${n}` : ""}`;
  }).join(`
`);
  return e.message && !b && (t = `${" ".repeat(f + 1)}${e.message}
${t}`), c ? d.reset(t) : t;
}
function v(r, o, e, c = {}) {
  if (!_) {
    _ = !0;
    const s = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
    if (process.emitWarning)
      process.emitWarning(s, "DeprecationWarning");
    else {
      const l = new Error(s);
      l.name = "DeprecationWarning", console.warn(new Error(s));
    }
  }
  return e = Math.max(e, 0), j(r, {
    start: {
      column: e,
      line: o
    }
  }, c);
}
//# sourceMappingURL=index.js.map
