var ot = Object.defineProperty;
var at = (r, e, t) => e in r ? ot(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
var ye = (r, e, t) => at(r, typeof e != "symbol" ? e + "" : e, t);
import { c as x, b as Y, a as st } from "./index-DJ0PRCgU.js";
import { l as ut } from "./monaco-editor-B-mw0Oij.js";
import "vue";
var ue = {}, V = {}, ce = {}, I = {}, B = {};
Object.defineProperty(B, "__esModule", { value: !0 });
function ct(r) {
  return he(r);
}
B.clone = ct;
function he(r) {
  return Array.isArray(r) ? ht(r) : typeof r == "object" ? lt(r) : r;
}
function ht(r) {
  for (var e = [], t = 0, n = r.length; t < n; t++)
    e[t] = he(r[t]);
  return e;
}
function lt(r) {
  var e = {};
  for (var t in r)
    e[t] = he(r[t]);
  return e;
}
function ft(r) {
  for (var e = [], t = 1; t < arguments.length; t++)
    e[t - 1] = arguments[t];
  return e.forEach(function(n) {
    for (var i in n)
      r[i] = n[i];
  }), r;
}
B.mergeObjects = ft;
var Re = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/, pt = (
  /** @class */
  function() {
    function r() {
    }
    return r.hasCaptures = function(e) {
      return Re.test(e);
    }, r.replaceCaptures = function(e, t, n) {
      return e.replace(Re, function(i, o, a, s) {
        var u = n[parseInt(o || a, 10)];
        if (u) {
          for (var c = t.substring(u.start, u.end); c[0] === "."; )
            c = c.substring(1);
          switch (s) {
            case "downcase":
              return c.toLowerCase();
            case "upcase":
              return c.toUpperCase();
            default:
              return c;
          }
        } else
          return i;
      });
    }, r;
  }()
);
B.RegexSource = pt;
var w = {};
const dt = {}, gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: dt
}, Symbol.toStringTag, { value: "Module" })), vt = /* @__PURE__ */ st(gt);
var H = x && x.__extends || function() {
  var r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
    e.__proto__ = t;
  } || function(e, t) {
    for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
  };
  return function(e, t) {
    r(e, t);
    function n() {
      this.constructor = e;
    }
    e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
  };
}();
Object.defineProperty(w, "__esModule", { value: !0 });
var _t = vt, U = B, Pe = ut, mt = /\\(\d+)/, Ce = /\\(\d+)/g, N = (
  /** @class */
  function() {
    function r(e, t, n, i) {
      this.$location = e, this.id = t, this._name = n || null, this._nameIsCapturing = U.RegexSource.hasCaptures(this._name), this._contentName = i || null, this._contentNameIsCapturing = U.RegexSource.hasCaptures(this._contentName);
    }
    return Object.defineProperty(r.prototype, "debugName", {
      get: function() {
        return this.constructor.name + "#" + this.id + " @ " + _t.basename(this.$location.filename) + ":" + this.$location.line;
      },
      enumerable: !0,
      configurable: !0
    }), r.prototype.getName = function(e, t) {
      return this._nameIsCapturing ? U.RegexSource.replaceCaptures(this._name, e, t) : this._name;
    }, r.prototype.getContentName = function(e, t) {
      return this._contentNameIsCapturing ? U.RegexSource.replaceCaptures(this._contentName, e, t) : this._contentName;
    }, r.prototype.collectPatternsRecursive = function(e, t, n) {
      throw new Error("Implement me!");
    }, r.prototype.compile = function(e, t, n, i) {
      throw new Error("Implement me!");
    }, r;
  }()
);
w.Rule = N;
var Ge = (
  /** @class */
  function(r) {
    H(e, r);
    function e(t, n, i, o, a) {
      var s = r.call(this, t, n, i, o) || this;
      return s.retokenizeCapturedWithRuleId = a, s;
    }
    return e;
  }(N)
);
w.CaptureRule = Ge;
var j = (
  /** @class */
  function() {
    function r(e, t, n) {
      n === void 0 && (n = !0), n ? this._handleAnchors(e) : (this.source = e, this.hasAnchor = !1), this.hasAnchor && (this._anchorCache = this._buildAnchorCache()), this.ruleId = t, this.hasBackReferences = mt.test(this.source);
    }
    return r.prototype.clone = function() {
      return new r(this.source, this.ruleId, !0);
    }, r.prototype.setSource = function(e) {
      this.source !== e && (this.source = e, this.hasAnchor && (this._anchorCache = this._buildAnchorCache()));
    }, r.prototype._handleAnchors = function(e) {
      if (e) {
        var t = void 0, n = void 0, i = void 0, o = void 0, a = 0, s = [], u = !1;
        for (t = 0, n = e.length; t < n; t++)
          i = e.charAt(t), i === "\\" && t + 1 < n && (o = e.charAt(t + 1), o === "z" ? (s.push(e.substring(a, t)), s.push("$(?!\\n)(?<!\\n)"), a = t + 2) : (o === "A" || o === "G") && (u = !0), t++);
        this.hasAnchor = u, a === 0 ? this.source = e : (s.push(e.substring(a, n)), this.source = s.join(""));
      } else
        this.hasAnchor = !1, this.source = e;
    }, r.prototype.resolveBackReferences = function(e, t) {
      var n = t.map(function(i) {
        return e.substring(i.start, i.end);
      });
      return Ce.lastIndex = 0, this.source.replace(Ce, function(i, o) {
        return Ct(n[parseInt(o, 10)] || "");
      });
    }, r.prototype._buildAnchorCache = function() {
      var e = [], t = [], n = [], i = [], o, a, s, u;
      for (o = 0, a = this.source.length; o < a; o++)
        s = this.source.charAt(o), e[o] = s, t[o] = s, n[o] = s, i[o] = s, s === "\\" && o + 1 < a && (u = this.source.charAt(o + 1), u === "A" ? (e[o + 1] = "", t[o + 1] = "", n[o + 1] = "A", i[o + 1] = "A") : u === "G" ? (e[o + 1] = "", t[o + 1] = "G", n[o + 1] = "", i[o + 1] = "G") : (e[o + 1] = u, t[o + 1] = u, n[o + 1] = u, i[o + 1] = u), o++);
      return {
        A0_G0: e.join(""),
        A0_G1: t.join(""),
        A1_G0: n.join(""),
        A1_G1: i.join("")
      };
    }, r.prototype.resolveAnchors = function(e, t) {
      return this.hasAnchor ? e ? t ? this._anchorCache.A1_G1 : this._anchorCache.A1_G0 : t ? this._anchorCache.A0_G1 : this._anchorCache.A0_G0 : this.source;
    }, r;
  }()
);
w.RegExpSource = j;
function Se(r) {
  return new Pe.OnigScanner(r);
}
function yt(r) {
  var e = new Pe.OnigString(r);
  return e.$str = r, e;
}
w.createOnigString = yt;
function Rt(r) {
  return r.$str;
}
w.getString = Rt;
var L = (
  /** @class */
  function() {
    function r() {
      this._items = [], this._hasAnchors = !1, this._cached = null, this._cachedSources = null, this._anchorCache = {
        A0_G0: null,
        A0_G1: null,
        A1_G0: null,
        A1_G1: null
      };
    }
    return r.prototype.push = function(e) {
      this._items.push(e), this._hasAnchors = this._hasAnchors || e.hasAnchor;
    }, r.prototype.unshift = function(e) {
      this._items.unshift(e), this._hasAnchors = this._hasAnchors || e.hasAnchor;
    }, r.prototype.length = function() {
      return this._items.length;
    }, r.prototype.setSource = function(e, t) {
      this._items[e].source !== t && (this._cached = null, this._anchorCache.A0_G0 = null, this._anchorCache.A0_G1 = null, this._anchorCache.A1_G0 = null, this._anchorCache.A1_G1 = null, this._items[e].setSource(t));
    }, r.prototype.compile = function(e, t, n) {
      if (this._hasAnchors)
        return this._anchorCache = {
          A0_G0: this._anchorCache.A0_G0 || (t === !1 && n === !1 ? this._resolveAnchors(t, n) : null),
          A0_G1: this._anchorCache.A0_G1 || (t === !1 && n === !0 ? this._resolveAnchors(t, n) : null),
          A1_G0: this._anchorCache.A1_G0 || (t === !0 && n === !1 ? this._resolveAnchors(t, n) : null),
          A1_G1: this._anchorCache.A1_G1 || (t === !0 && n === !0 ? this._resolveAnchors(t, n) : null)
        }, t ? n ? this._anchorCache.A1_G1 : this._anchorCache.A1_G0 : n ? this._anchorCache.A0_G1 : this._anchorCache.A0_G0;
      if (!this._cached) {
        var i = this._items.map(function(o) {
          return o.source;
        });
        this._cached = {
          scanner: Se(i),
          rules: this._items.map(function(o) {
            return o.ruleId;
          }),
          debugRegExps: i
        };
      }
      return this._cached;
    }, r.prototype._resolveAnchors = function(e, t) {
      var n = this._items.map(function(i) {
        return i.resolveAnchors(e, t);
      });
      return {
        scanner: Se(n),
        rules: this._items.map(function(i) {
          return i.ruleId;
        }),
        debugRegExps: n
      };
    }, r;
  }()
);
w.RegExpSourceList = L;
var Oe = (
  /** @class */
  function(r) {
    H(e, r);
    function e(t, n, i, o, a) {
      var s = r.call(this, t, n, i, null) || this;
      return s._match = new j(o, s.id), s.captures = a, s._cachedCompiledPatterns = null, s;
    }
    return Object.defineProperty(e.prototype, "debugMatchRegExp", {
      get: function() {
        return "" + this._match.source;
      },
      enumerable: !0,
      configurable: !0
    }), e.prototype.collectPatternsRecursive = function(t, n, i) {
      n.push(this._match);
    }, e.prototype.compile = function(t, n, i, o) {
      return this._cachedCompiledPatterns || (this._cachedCompiledPatterns = new L(), this.collectPatternsRecursive(t, this._cachedCompiledPatterns, !0)), this._cachedCompiledPatterns.compile(t, i, o);
    }, e;
  }(N)
);
w.MatchRule = Oe;
var ne = (
  /** @class */
  function(r) {
    H(e, r);
    function e(t, n, i, o, a) {
      var s = r.call(this, t, n, i, o) || this;
      return s.patterns = a.patterns, s.hasMissingPatterns = a.hasMissingPatterns, s._cachedCompiledPatterns = null, s;
    }
    return e.prototype.collectPatternsRecursive = function(t, n, i) {
      var o, a, s;
      for (o = 0, a = this.patterns.length; o < a; o++)
        s = t.getRule(this.patterns[o]), s.collectPatternsRecursive(t, n, !1);
    }, e.prototype.compile = function(t, n, i, o) {
      return this._cachedCompiledPatterns || (this._cachedCompiledPatterns = new L(), this.collectPatternsRecursive(t, this._cachedCompiledPatterns, !0)), this._cachedCompiledPatterns.compile(t, i, o);
    }, e;
  }(N)
);
w.IncludeOnlyRule = ne;
function Ct(r) {
  return r.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, "\\$&");
}
var ie = (
  /** @class */
  function(r) {
    H(e, r);
    function e(t, n, i, o, a, s, u, c, h, f) {
      var l = r.call(this, t, n, i, o) || this;
      return l._begin = new j(a, l.id), l.beginCaptures = s, l._end = new j(u, -1), l.endHasBackReferences = l._end.hasBackReferences, l.endCaptures = c, l.applyEndPatternLast = h || !1, l.patterns = f.patterns, l.hasMissingPatterns = f.hasMissingPatterns, l._cachedCompiledPatterns = null, l;
    }
    return Object.defineProperty(e.prototype, "debugBeginRegExp", {
      get: function() {
        return "" + this._begin.source;
      },
      enumerable: !0,
      configurable: !0
    }), Object.defineProperty(e.prototype, "debugEndRegExp", {
      get: function() {
        return "" + this._end.source;
      },
      enumerable: !0,
      configurable: !0
    }), e.prototype.getEndWithResolvedBackReferences = function(t, n) {
      return this._end.resolveBackReferences(t, n);
    }, e.prototype.collectPatternsRecursive = function(t, n, i) {
      if (i) {
        var o = void 0, a = void 0, s = void 0;
        for (o = 0, a = this.patterns.length; o < a; o++)
          s = t.getRule(this.patterns[o]), s.collectPatternsRecursive(t, n, !1);
      } else
        n.push(this._begin);
    }, e.prototype.compile = function(t, n, i, o) {
      var a = this._precompile(t);
      return this._end.hasBackReferences && (this.applyEndPatternLast ? a.setSource(a.length() - 1, n) : a.setSource(0, n)), this._cachedCompiledPatterns.compile(t, i, o);
    }, e.prototype._precompile = function(t) {
      return this._cachedCompiledPatterns || (this._cachedCompiledPatterns = new L(), this.collectPatternsRecursive(t, this._cachedCompiledPatterns, !0), this.applyEndPatternLast ? this._cachedCompiledPatterns.push(this._end.hasBackReferences ? this._end.clone() : this._end) : this._cachedCompiledPatterns.unshift(this._end.hasBackReferences ? this._end.clone() : this._end)), this._cachedCompiledPatterns;
    }, e;
  }(N)
);
w.BeginEndRule = ie;
var oe = (
  /** @class */
  function(r) {
    H(e, r);
    function e(t, n, i, o, a, s, u, c, h) {
      var f = r.call(this, t, n, i, o) || this;
      return f._begin = new j(a, f.id), f.beginCaptures = s, f.whileCaptures = c, f._while = new j(u, -2), f.whileHasBackReferences = f._while.hasBackReferences, f.patterns = h.patterns, f.hasMissingPatterns = h.hasMissingPatterns, f._cachedCompiledPatterns = null, f._cachedCompiledWhilePatterns = null, f;
    }
    return e.prototype.getWhileWithResolvedBackReferences = function(t, n) {
      return this._while.resolveBackReferences(t, n);
    }, e.prototype.collectPatternsRecursive = function(t, n, i) {
      if (i) {
        var o = void 0, a = void 0, s = void 0;
        for (o = 0, a = this.patterns.length; o < a; o++)
          s = t.getRule(this.patterns[o]), s.collectPatternsRecursive(t, n, !1);
      } else
        n.push(this._begin);
    }, e.prototype.compile = function(t, n, i, o) {
      return this._precompile(t), this._cachedCompiledPatterns.compile(t, i, o);
    }, e.prototype._precompile = function(t) {
      this._cachedCompiledPatterns || (this._cachedCompiledPatterns = new L(), this.collectPatternsRecursive(t, this._cachedCompiledPatterns, !0));
    }, e.prototype.compileWhile = function(t, n, i, o) {
      return this._precompileWhile(t), this._while.hasBackReferences && this._cachedCompiledWhilePatterns.setSource(0, n), this._cachedCompiledWhilePatterns.compile(t, i, o);
    }, e.prototype._precompileWhile = function(t) {
      this._cachedCompiledWhilePatterns || (this._cachedCompiledWhilePatterns = new L(), this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences ? this._while.clone() : this._while));
    }, e;
  }(N)
);
w.BeginWhileRule = oe;
var St = (
  /** @class */
  function() {
    function r() {
    }
    return r.createCaptureRule = function(e, t, n, i, o) {
      return e.registerRule(function(a) {
        return new Ge(t, a, n, i, o);
      });
    }, r.getCompiledRuleId = function(e, t, n) {
      return e.id || t.registerRule(function(i) {
        return e.id = i, e.match ? new Oe(e.$vscodeTextmateLocation, e.id, e.name, e.match, r._compileCaptures(e.captures, t, n)) : e.begin ? e.while ? new oe(e.$vscodeTextmateLocation, e.id, e.name, e.contentName, e.begin, r._compileCaptures(e.beginCaptures || e.captures, t, n), e.while, r._compileCaptures(e.whileCaptures || e.captures, t, n), r._compilePatterns(e.patterns, t, n)) : new ie(e.$vscodeTextmateLocation, e.id, e.name, e.contentName, e.begin, r._compileCaptures(e.beginCaptures || e.captures, t, n), e.end, r._compileCaptures(e.endCaptures || e.captures, t, n), e.applyEndPatternLast, r._compilePatterns(e.patterns, t, n)) : (e.repository && (n = U.mergeObjects({}, n, e.repository)), new ne(e.$vscodeTextmateLocation, e.id, e.name, e.contentName, r._compilePatterns(e.patterns, t, n)));
      }), e.id;
    }, r._compileCaptures = function(e, t, n) {
      var i = [], o, a, s, u;
      if (e) {
        a = 0;
        for (u in e)
          u !== "$vscodeTextmateLocation" && (o = parseInt(u, 10), o > a && (a = o));
        for (s = 0; s <= a; s++)
          i[s] = null;
        for (u in e)
          if (u !== "$vscodeTextmateLocation") {
            o = parseInt(u, 10);
            var c = 0;
            e[u].patterns && (c = r.getCompiledRuleId(e[u], t, n)), i[o] = r.createCaptureRule(t, e[u].$vscodeTextmateLocation, e[u].name, e[u].contentName, c);
          }
      }
      return i;
    }, r._compilePatterns = function(e, t, n) {
      var i = [], o, a, s, u, c, h, f;
      if (e)
        for (a = 0, s = e.length; a < s; a++) {
          if (o = e[a], u = -1, o.include)
            if (o.include.charAt(0) === "#") {
              var l = n[o.include.substr(1)];
              l && (u = r.getCompiledRuleId(l, t, n));
            } else if (o.include === "$base" || o.include === "$self")
              u = r.getCompiledRuleId(n[o.include], t, n);
            else {
              var d = null, g = null, m = o.include.indexOf("#");
              if (m >= 0 ? (d = o.include.substring(0, m), g = o.include.substring(m + 1)) : d = o.include, c = t.getExternalGrammar(d, n), c)
                if (g) {
                  var R = c.repository[g];
                  R && (u = r.getCompiledRuleId(R, t, c.repository));
                } else
                  u = r.getCompiledRuleId(c.repository.$self, t, c.repository);
            }
          else
            u = r.getCompiledRuleId(o, t, n);
          if (u !== -1) {
            if (h = t.getRule(u), f = !1, (h instanceof ne || h instanceof ie || h instanceof oe) && h.hasMissingPatterns && h.patterns.length === 0 && (f = !0), f)
              continue;
            i.push(u);
          }
        }
      return {
        patterns: i,
        hasMissingPatterns: (e ? e.length : 0) !== i.length
      };
    }, r;
  }()
);
w.RuleFactory = St;
var le = {};
Object.defineProperty(le, "__esModule", { value: !0 });
function bt(r, e) {
  for (var t = [], n = wt(r), i = n.next(); i !== null; ) {
    var o = 0;
    if (i.length === 2 && i.charAt(1) === ":") {
      switch (i.charAt(0)) {
        case "R":
          o = 1;
          break;
        case "L":
          o = -1;
          break;
        default:
          console.log("Unknown priority " + i + " in scope selector");
      }
      i = n.next();
    }
    var a = u();
    if (a && t.push({ matcher: a, priority: o }), i !== ",")
      break;
    i = n.next();
  }
  return t;
  function s() {
    if (i === "-") {
      i = n.next();
      var h = s();
      return function(d) {
        return h && !h(d);
      };
    }
    if (i === "(") {
      i = n.next();
      var f = c();
      return i === ")" && (i = n.next()), f;
    }
    if (be(i)) {
      var l = [];
      do
        l.push(i), i = n.next();
      while (be(i));
      return function(d) {
        return e(l, d);
      };
    }
    return null;
  }
  function u() {
    for (var h = [], f = s(); f; )
      h.push(f), f = s();
    return function(l) {
      return h.every(function(d) {
        return d(l);
      });
    };
  }
  function c() {
    for (var h = [], f = u(); f && (h.push(f), i === "|" || i === ","); ) {
      do
        i = n.next();
      while (i === "|" || i === ",");
      f = u();
    }
    return function(l) {
      return h.some(function(d) {
        return d(l);
      });
    };
  }
}
le.createMatchers = bt;
function be(r) {
  return r && r.match(/[\w\.:]+/);
}
function wt(r) {
  var e = /([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g, t = e.exec(r);
  return {
    next: function() {
      if (!t)
        return null;
      var n = t[0];
      return t = e.exec(r), n;
    }
  };
}
var X = {};
Object.defineProperty(X, "__esModule", { value: !0 });
X.CAPTURE_METADATA = typeof Y > "u" ? !1 : !!Y.env.VSCODE_TEXTMATE_DEBUG;
X.IN_DEBUG_MODE = typeof Y > "u" ? !1 : !!Y.env.VSCODE_TEXTMATE_DEBUG;
Object.defineProperty(I, "__esModule", { value: !0 });
var At = B, C = w, xe = le, E = X;
function Et(r, e, t, n, i) {
  return new De(r, e, t, n, i);
}
I.createGrammar = Et;
function fe(r, e) {
  for (var t = 0, n = e.length; t < n; t++) {
    Array.isArray(e[t].patterns) && fe(r, e[t].patterns);
    var i = e[t].include;
    if (i && !(i === "$base" || i === "$self") && i.charAt(0) !== "#") {
      var o = i.indexOf("#");
      o >= 0 ? r[i.substring(0, o)] = !0 : r[i] = !0;
    }
  }
}
function je(r, e) {
  for (var t in e) {
    var n = e[t];
    n.patterns && Array.isArray(n.patterns) && fe(r, n.patterns), n.repository && je(r, n.repository);
  }
}
function It(r, e) {
  e.patterns && Array.isArray(e.patterns) && fe(r, e.patterns), e.repository && je(r, e.repository), delete r[e.scopeName];
}
I.collectIncludedScopes = It;
function Tt(r, e) {
  if (!r)
    return !1;
  if (r === e)
    return !0;
  var t = e.length;
  return r.length > t && r.substr(0, t) === e && r[t] === ".";
}
function Le(r, e) {
  if (e.length < r.length)
    return !1;
  var t = 0;
  return r.every(function(n) {
    for (var i = t; i < e.length; i++)
      if (Tt(e[i], n))
        return t = i + 1, !0;
    return !1;
  });
}
function we(r, e, t, n, i) {
  for (var o = xe.createMatchers(e, Le), a = C.RuleFactory.getCompiledRuleId(t, n, i.repository), s = 0, u = o; s < u.length; s++) {
    var c = u[s];
    r.push({
      matcher: c.matcher,
      ruleId: a,
      grammar: i,
      priority: c.priority
    });
  }
}
var Q = (
  /** @class */
  /* @__PURE__ */ function() {
    function r(e, t, n, i) {
      this.scopeName = e, this.languageId = t, this.tokenType = n, this.themeData = i;
    }
    return r;
  }()
);
I.ScopeMetadata = Q;
var kt = (
  /** @class */
  function() {
    function r(e, t, n) {
      if (this._initialLanguage = e, this._themeProvider = t, this.onDidChangeTheme(), this._embeddedLanguages = /* @__PURE__ */ Object.create(null), n)
        for (var i = Object.keys(n), o = 0, a = i.length; o < a; o++) {
          var s = i[o], u = n[s];
          if (typeof u != "number" || u === 0) {
            console.warn("Invalid embedded language found at scope " + s + ": <<" + u + ">>");
            continue;
          }
          this._embeddedLanguages[s] = u;
        }
      var c = Object.keys(this._embeddedLanguages).map(function(h) {
        return r._escapeRegExpCharacters(h);
      });
      c.length === 0 ? this._embeddedLanguagesRegex = null : (c.sort(), c.reverse(), this._embeddedLanguagesRegex = new RegExp("^((" + c.join(")|(") + "))($|\\.)", ""));
    }
    return r.prototype.onDidChangeTheme = function() {
      this._cache = /* @__PURE__ */ Object.create(null), this._defaultMetaData = new Q("", this._initialLanguage, 0, [this._themeProvider.getDefaults()]);
    }, r.prototype.getDefaultMetadata = function() {
      return this._defaultMetaData;
    }, r._escapeRegExpCharacters = function(e) {
      return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, "\\$&");
    }, r.prototype.getMetadataForScope = function(e) {
      if (e === null)
        return r._NULL_SCOPE_METADATA;
      var t = this._cache[e];
      return t || (t = this._doGetMetadataForScope(e), this._cache[e] = t, t);
    }, r.prototype._doGetMetadataForScope = function(e) {
      var t = this._scopeToLanguage(e), n = this._toStandardTokenType(e), i = this._themeProvider.themeMatch(e);
      return new Q(e, t, n, i);
    }, r.prototype._scopeToLanguage = function(e) {
      if (!e || !this._embeddedLanguagesRegex)
        return 0;
      var t = e.match(this._embeddedLanguagesRegex);
      if (!t)
        return 0;
      var n = this._embeddedLanguages[t[1]] || 0;
      return n || 0;
    }, r.prototype._toStandardTokenType = function(e) {
      var t = e.match(r.STANDARD_TOKEN_TYPE_REGEXP);
      if (!t)
        return 0;
      switch (t[1]) {
        case "comment":
          return 1;
        case "string":
          return 2;
        case "regex":
          return 4;
        case "meta.embedded":
          return 8;
      }
      throw new Error("Unexpected match for standard token type!");
    }, r._NULL_SCOPE_METADATA = new Q("", 0, 0, null), r.STANDARD_TOKEN_TYPE_REGEXP = /\b(comment|string|regex|meta\.embedded)\b/, r;
  }()
), De = (
  /** @class */
  function() {
    function r(e, t, n, i, o) {
      if (this._scopeMetadataProvider = new kt(t, o, n), this._rootId = -1, this._lastRuleId = 0, this._ruleId2desc = [], this._includedGrammars = {}, this._grammarRepository = o, this._grammar = Ae(e, null), this._tokenTypeMatchers = [], i)
        for (var a = 0, s = Object.keys(i); a < s.length; a++)
          for (var u = s[a], c = xe.createMatchers(u, Le), h = 0, f = c; h < f.length; h++) {
            var l = f[h];
            this._tokenTypeMatchers.push({
              matcher: l.matcher,
              type: i[u]
            });
          }
    }
    return r.prototype.onDidChangeTheme = function() {
      this._scopeMetadataProvider.onDidChangeTheme();
    }, r.prototype.getMetadataForScope = function(e) {
      return this._scopeMetadataProvider.getMetadataForScope(e);
    }, r.prototype.getInjections = function() {
      var e = this;
      if (!this._injections) {
        this._injections = [];
        var t = this._grammar.injections;
        if (t)
          for (var n in t)
            we(this._injections, n, t[n], this, this._grammar);
        if (this._grammarRepository) {
          var i = this._grammarRepository.injections(this._grammar.scopeName);
          i && i.forEach(function(o) {
            var a = e.getExternalGrammar(o);
            if (a) {
              var s = a.injectionSelector;
              s && we(e._injections, s, a, e, a);
            }
          });
        }
        this._injections.sort(function(o, a) {
          return o.priority - a.priority;
        });
      }
      return this._injections.length === 0 ? this._injections : this._injections;
    }, r.prototype.registerRule = function(e) {
      var t = ++this._lastRuleId, n = e(t);
      return this._ruleId2desc[t] = n, n;
    }, r.prototype.getRule = function(e) {
      return this._ruleId2desc[e];
    }, r.prototype.getExternalGrammar = function(e, t) {
      if (this._includedGrammars[e])
        return this._includedGrammars[e];
      if (this._grammarRepository) {
        var n = this._grammarRepository.lookup(e);
        if (n)
          return this._includedGrammars[e] = Ae(n, t && t.$base), this._includedGrammars[e];
      }
    }, r.prototype.tokenizeLine = function(e, t) {
      var n = this._tokenize(e, t, !1);
      return {
        tokens: n.lineTokens.getResult(n.ruleStack, n.lineLength),
        ruleStack: n.ruleStack
      };
    }, r.prototype.tokenizeLine2 = function(e, t) {
      var n = this._tokenize(e, t, !0);
      return {
        tokens: n.lineTokens.getBinaryResult(n.ruleStack, n.lineLength),
        ruleStack: n.ruleStack
      };
    }, r.prototype._tokenize = function(e, t, n) {
      this._rootId === -1 && (this._rootId = C.RuleFactory.getCompiledRuleId(this._grammar.repository.$self, this, this._grammar.repository));
      var i;
      if (!t || t === se.NULL) {
        i = !0;
        var o = this._scopeMetadataProvider.getDefaultMetadata(), a = o.themeData[0], s = Z.set(0, o.languageId, o.tokenType, a.fontStyle, a.foreground, a.background), u = this.getRule(this._rootId).getName(null, null), c = this._scopeMetadataProvider.getMetadataForScope(u), h = ae.mergeMetadata(s, null, c), f = new ae(null, u, h);
        t = new se(null, this._rootId, -1, null, f, f);
      } else
        i = !1, t.reset();
      e = e + `
`;
      var l = C.createOnigString(e), d = C.getString(l).length, g = new xt(n, e, this._tokenTypeMatchers), m = Be(this, l, i, 0, t, g);
      return {
        lineLength: d,
        lineTokens: g,
        ruleStack: m
      };
    }, r;
  }()
);
I.Grammar = De;
function Ae(r, e) {
  return r = At.clone(r), r.repository = r.repository || {}, r.repository.$self = {
    $vscodeTextmateLocation: r.$vscodeTextmateLocation,
    patterns: r.patterns,
    name: r.scopeName
  }, r.repository.$base = e || r.repository.$self, r;
}
function q(r, e, t, n, i, o, a) {
  if (o.length !== 0) {
    for (var s = Math.min(o.length, a.length), u = [], c = a[0].end, h = 0; h < s; h++) {
      var f = o[h];
      if (f !== null) {
        var l = a[h];
        if (l.length !== 0) {
          if (l.start > c)
            break;
          for (; u.length > 0 && u[u.length - 1].endPos <= l.start; )
            i.produceFromScopes(u[u.length - 1].scopes, u[u.length - 1].endPos), u.pop();
          if (u.length > 0 ? i.produceFromScopes(u[u.length - 1].scopes, l.start) : i.produce(n, l.start), f.retokenizeCapturedWithRuleId) {
            var d = f.getName(C.getString(e), a), g = n.contentNameScopesList.push(r, d), m = f.getContentName(C.getString(e), a), R = g.push(r, m), v = n.push(f.retokenizeCapturedWithRuleId, l.start, null, g, R);
            Be(r, C.createOnigString(C.getString(e).substring(0, l.end)), t && l.start === 0, l.start, v, i);
            continue;
          }
          var A = f.getName(C.getString(e), a);
          if (A !== null) {
            var P = u.length > 0 ? u[u.length - 1].scopes : n.contentNameScopesList, _ = P.push(r, A);
            u.push(new Ne(_, l.end));
          }
        }
      }
    }
    for (; u.length > 0; )
      i.produceFromScopes(u[u.length - 1].scopes, u[u.length - 1].endPos), u.pop();
  }
}
function pe(r) {
  for (var e = [], t = 0, n = r.rules.length; t < n; t++)
    e.push("   - " + r.rules[t] + ": " + r.debugRegExps[t]);
  return e.join(`
`);
}
function Mt(r, e, t, n, i, o, a) {
  for (var s = Number.MAX_VALUE, u = null, c, h = 0, f = o.contentNameScopesList.generateScopes(), l = 0, d = r.length; l < d; l++) {
    var g = r[l];
    if (g.matcher(f)) {
      var m = e.getRule(g.ruleId).compile(e, null, n, i === a), R = m.scanner.findNextMatchSync(t, i);
      if (E.IN_DEBUG_MODE && (console.log("  scanning for injections"), console.log(pe(m))), !!R) {
        var v = R.captureIndices[0].start;
        if (!(v >= s) && (s = v, u = R.captureIndices, c = m.rules[R.index], h = g.priority, s === i))
          break;
      }
    }
  }
  return u ? {
    priorityMatch: h === -1,
    captureIndices: u,
    matchedRuleId: c
  } : null;
}
function Pt(r, e, t, n, i, o) {
  var a = i.getRule(r), s = a.compile(r, i.endRule, t, n === o), u = s.scanner.findNextMatchSync(e, n);
  return E.IN_DEBUG_MODE && (console.log("  scanning for"), console.log(pe(s))), u ? {
    captureIndices: u.captureIndices,
    matchedRuleId: s.rules[u.index]
  } : null;
}
function Gt(r, e, t, n, i, o) {
  var a = Pt(r, e, t, n, i, o), s = r.getInjections();
  if (s.length === 0)
    return a;
  var u = Mt(s, r, e, t, n, i, o);
  if (!u)
    return a;
  if (!a)
    return u;
  var c = a.captureIndices[0].start, h = u.captureIndices[0].start;
  return h < c || u.priorityMatch && h === c ? u : a;
}
function Ot(r, e, t, n, i, o) {
  for (var a = -1, s = [], u = i; u; u = u.pop()) {
    var c = u.getRule(r);
    c instanceof C.BeginWhileRule && s.push({
      rule: c,
      stack: u
    });
  }
  for (var h = s.pop(); h; h = s.pop()) {
    var f = h.rule.compileWhile(r, h.stack.endRule, t, a === n), l = f.scanner.findNextMatchSync(e, n);
    if (E.IN_DEBUG_MODE && (console.log("  scanning for while rule"), console.log(pe(f))), l) {
      var d = f.rules[l.index];
      if (d !== -2) {
        i = h.stack.pop();
        break;
      }
      l.captureIndices && l.captureIndices.length && (o.produce(h.stack, l.captureIndices[0].start), q(r, e, t, h.stack, o, h.rule.whileCaptures, l.captureIndices), o.produce(h.stack, l.captureIndices[0].end), a = l.captureIndices[0].end, l.captureIndices[0].end > n && (n = l.captureIndices[0].end, t = !1));
    } else {
      i = h.stack.pop();
      break;
    }
  }
  return { stack: i, linePos: n, anchorPosition: a, isFirstLine: t };
}
function Be(r, e, t, n, i, o) {
  var a = C.getString(e).length, s = !1, u = Ot(r, e, t, n, i, o);
  i = u.stack, n = u.linePos, t = u.isFirstLine;
  for (var c = u.anchorPosition; !s; )
    h();
  function h() {
    E.IN_DEBUG_MODE && (console.log(""), console.log("@@scanNext: |" + C.getString(e).replace(/\n$/, "\\n").substr(n) + "|"));
    var f = Gt(r, e, t, n, i, c);
    if (!f) {
      E.IN_DEBUG_MODE && console.log("  no more matches."), o.produce(i, a), s = !0;
      return;
    }
    var l = f.captureIndices, d = f.matchedRuleId, g = l && l.length > 0 ? l[0].end > n : !1;
    if (d === -1) {
      var m = i.getRule(r);
      E.IN_DEBUG_MODE && console.log("  popping " + m.debugName + " - " + m.debugEndRegExp), o.produce(i, l[0].start), i = i.setContentNameScopesList(i.nameScopesList), q(r, e, t, i, o, m.endCaptures, l), o.produce(i, l[0].end);
      var R = i;
      if (i = i.pop(), !g && R.getEnterPos() === n) {
        console.error("[1] - Grammar is in an endless loop - Grammar pushed & popped a rule without advancing"), i = R, o.produce(i, a), s = !0;
        return;
      }
    } else {
      var v = r.getRule(d);
      o.produce(i, l[0].start);
      var A = i, P = v.getName(C.getString(e), l), _ = i.contentNameScopesList.push(r, P);
      if (i = i.push(d, n, null, _, _), v instanceof C.BeginEndRule) {
        var S = v;
        E.IN_DEBUG_MODE && console.log("  pushing " + S.debugName + " - " + S.debugBeginRegExp), q(r, e, t, i, o, S.beginCaptures, l), o.produce(i, l[0].end), c = l[0].end;
        var G = S.getContentName(C.getString(e), l), F = _.push(r, G);
        if (i = i.setContentNameScopesList(F), S.endHasBackReferences && (i = i.setEndRule(S.getEndWithResolvedBackReferences(C.getString(e), l))), !g && A.hasSameRuleAs(i)) {
          console.error("[2] - Grammar is in an endless loop - Grammar pushed the same rule without advancing"), i = i.pop(), o.produce(i, a), s = !0;
          return;
        }
      } else if (v instanceof C.BeginWhileRule) {
        var S = v;
        E.IN_DEBUG_MODE && console.log("  pushing " + S.debugName), q(r, e, t, i, o, S.beginCaptures, l), o.produce(i, l[0].end), c = l[0].end;
        var G = S.getContentName(C.getString(e), l), F = _.push(r, G);
        if (i = i.setContentNameScopesList(F), S.whileHasBackReferences && (i = i.setEndRule(S.getWhileWithResolvedBackReferences(C.getString(e), l))), !g && A.hasSameRuleAs(i)) {
          console.error("[3] - Grammar is in an endless loop - Grammar pushed the same rule without advancing"), i = i.pop(), o.produce(i, a), s = !0;
          return;
        }
      } else {
        var O = v;
        if (E.IN_DEBUG_MODE && console.log("  matched " + O.debugName + " - " + O.debugMatchRegExp), q(r, e, t, i, o, O.captures, l), o.produce(i, l[0].end), i = i.pop(), !g) {
          console.error("[4] - Grammar is in an endless loop - Grammar is not advancing, nor is it pushing/popping"), i = i.safePop(), o.produce(i, a), s = !0;
          return;
        }
      }
    }
    l[0].end > n && (n = l[0].end, t = !1);
  }
  return i;
}
var Z = (
  /** @class */
  function() {
    function r() {
    }
    return r.toBinaryStr = function(e) {
      for (var t = e.toString(2); t.length < 32; )
        t = "0" + t;
      return t;
    }, r.printMetadata = function(e) {
      var t = r.getLanguageId(e), n = r.getTokenType(e), i = r.getFontStyle(e), o = r.getForeground(e), a = r.getBackground(e);
      console.log({
        languageId: t,
        tokenType: n,
        fontStyle: i,
        foreground: o,
        background: a
      });
    }, r.getLanguageId = function(e) {
      return (e & 255) >>> 0;
    }, r.getTokenType = function(e) {
      return (e & 1792) >>> 8;
    }, r.getFontStyle = function(e) {
      return (e & 14336) >>> 11;
    }, r.getForeground = function(e) {
      return (e & 8372224) >>> 14;
    }, r.getBackground = function(e) {
      return (e & 4286578688) >>> 23;
    }, r.set = function(e, t, n, i, o, a) {
      var s = r.getLanguageId(e), u = r.getTokenType(e), c = r.getFontStyle(e), h = r.getForeground(e), f = r.getBackground(e);
      return t !== 0 && (s = t), n !== 0 && (u = n === 8 ? 0 : n), i !== -1 && (c = i), o !== 0 && (h = o), a !== 0 && (f = a), (s << 0 | u << 8 | c << 11 | h << 14 | f << 23) >>> 0;
    }, r;
  }()
);
I.StackElementMetadata = Z;
var ae = (
  /** @class */
  function() {
    function r(e, t, n) {
      this.parent = e, this.scope = t, this.metadata = n;
    }
    return r._equals = function(e, t) {
      do {
        if (e === t)
          return !0;
        if (e.scope !== t.scope || e.metadata !== t.metadata)
          return !1;
        if (e = e.parent, t = t.parent, !e && !t)
          return !0;
        if (!e || !t)
          return !1;
      } while (!0);
    }, r.prototype.equals = function(e) {
      return r._equals(this, e);
    }, r._matchesScope = function(e, t, n) {
      return t === e || e.substring(0, n.length) === n;
    }, r._matches = function(e, t) {
      if (t === null)
        return !0;
      for (var n = t.length, i = 0, o = t[i], a = o + "."; e; ) {
        if (this._matchesScope(e.scope, o, a)) {
          if (i++, i === n)
            return !0;
          o = t[i], a = o + ".";
        }
        e = e.parent;
      }
      return !1;
    }, r.mergeMetadata = function(e, t, n) {
      if (n === null)
        return e;
      var i = -1, o = 0, a = 0;
      if (n.themeData !== null)
        for (var s = 0, u = n.themeData.length; s < u; s++) {
          var c = n.themeData[s];
          if (this._matches(t, c.parentScopes)) {
            i = c.fontStyle, o = c.foreground, a = c.background;
            break;
          }
        }
      return Z.set(e, n.languageId, n.tokenType, i, o, a);
    }, r._push = function(e, t, n) {
      for (var i = 0, o = n.length; i < o; i++) {
        var a = n[i], s = t.getMetadataForScope(a), u = r.mergeMetadata(e.metadata, e, s);
        e = new r(e, a, u);
      }
      return e;
    }, r.prototype.push = function(e, t) {
      return t === null ? this : t.indexOf(" ") >= 0 ? r._push(this, e, t.split(/ /g)) : r._push(this, e, [t]);
    }, r._generateScopes = function(e) {
      for (var t = [], n = 0; e; )
        t[n++] = e.scope, e = e.parent;
      return t.reverse(), t;
    }, r.prototype.generateScopes = function() {
      return r._generateScopes(this);
    }, r;
  }()
);
I.ScopeListElement = ae;
var se = (
  /** @class */
  function() {
    function r(e, t, n, i, o, a) {
      this.parent = e, this.depth = this.parent ? this.parent.depth + 1 : 1, this.ruleId = t, this._enterPos = n, this.endRule = i, this.nameScopesList = o, this.contentNameScopesList = a;
    }
    return r._structuralEquals = function(e, t) {
      do {
        if (e === t)
          return !0;
        if (e.depth !== t.depth || e.ruleId !== t.ruleId || e.endRule !== t.endRule)
          return !1;
        if (e = e.parent, t = t.parent, !e && !t)
          return !0;
        if (!e || !t)
          return !1;
      } while (!0);
    }, r._equals = function(e, t) {
      return e === t ? !0 : this._structuralEquals(e, t) ? e.contentNameScopesList.equals(t.contentNameScopesList) : !1;
    }, r.prototype.clone = function() {
      return this;
    }, r.prototype.equals = function(e) {
      return e === null ? !1 : r._equals(this, e);
    }, r._reset = function(e) {
      for (; e; )
        e._enterPos = -1, e = e.parent;
    }, r.prototype.reset = function() {
      r._reset(this);
    }, r.prototype.pop = function() {
      return this.parent;
    }, r.prototype.safePop = function() {
      return this.parent ? this.parent : this;
    }, r.prototype.push = function(e, t, n, i, o) {
      return new r(this, e, t, n, i, o);
    }, r.prototype.getEnterPos = function() {
      return this._enterPos;
    }, r.prototype.getRule = function(e) {
      return e.getRule(this.ruleId);
    }, r.prototype._writeString = function(e, t) {
      return this.parent && (t = this.parent._writeString(e, t)), e[t++] = "(" + this.ruleId + ", TODO-" + this.nameScopesList + ", TODO-" + this.contentNameScopesList + ")", t;
    }, r.prototype.toString = function() {
      var e = [];
      return this._writeString(e, 0), "[" + e.join(",") + "]";
    }, r.prototype.setContentNameScopesList = function(e) {
      return this.contentNameScopesList === e ? this : this.parent.push(this.ruleId, this._enterPos, this.endRule, this.nameScopesList, e);
    }, r.prototype.setEndRule = function(e) {
      return this.endRule === e ? this : new r(this.parent, this.ruleId, this._enterPos, e, this.nameScopesList, this.contentNameScopesList);
    }, r.prototype.hasSameRuleAs = function(e) {
      return this.ruleId === e.ruleId;
    }, r.NULL = new r(null, 0, 0, null, null, null), r;
  }()
);
I.StackElement = se;
var Ne = (
  /** @class */
  /* @__PURE__ */ function() {
    function r(e, t) {
      this.scopes = e, this.endPos = t;
    }
    return r;
  }()
);
I.LocalStackElement = Ne;
var xt = (
  /** @class */
  function() {
    function r(e, t, n) {
      this._emitBinaryTokens = e, this._tokenTypeOverrides = n, E.IN_DEBUG_MODE && (this._lineText = t), this._emitBinaryTokens ? this._binaryTokens = [] : this._tokens = [], this._lastTokenEndIndex = 0;
    }
    return r.prototype.produce = function(e, t) {
      this.produceFromScopes(e.contentNameScopesList, t);
    }, r.prototype.produceFromScopes = function(e, t) {
      if (!(this._lastTokenEndIndex >= t)) {
        if (this._emitBinaryTokens) {
          for (var n = e.metadata, i = 0, o = this._tokenTypeOverrides; i < o.length; i++) {
            var a = o[i];
            a.matcher(e.generateScopes()) && (n = Z.set(n, 0, jt(a.type), -1, 0, 0));
          }
          if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 1] === n) {
            this._lastTokenEndIndex = t;
            return;
          }
          this._binaryTokens.push(this._lastTokenEndIndex), this._binaryTokens.push(n), this._lastTokenEndIndex = t;
          return;
        }
        var s = e.generateScopes();
        if (E.IN_DEBUG_MODE) {
          console.log("  token: |" + this._lineText.substring(this._lastTokenEndIndex, t).replace(/\n$/, "\\n") + "|");
          for (var u = 0; u < s.length; u++)
            console.log("      * " + s[u]);
        }
        this._tokens.push({
          startIndex: this._lastTokenEndIndex,
          endIndex: t,
          // value: lineText.substring(lastTokenEndIndex, endIndex),
          scopes: s
        }), this._lastTokenEndIndex = t;
      }
    }, r.prototype.getResult = function(e, t) {
      return this._tokens.length > 0 && this._tokens[this._tokens.length - 1].startIndex === t - 1 && this._tokens.pop(), this._tokens.length === 0 && (this._lastTokenEndIndex = -1, this.produce(e, t), this._tokens[this._tokens.length - 1].startIndex = 0), this._tokens;
    }, r.prototype.getBinaryResult = function(e, t) {
      this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 2] === t - 1 && (this._binaryTokens.pop(), this._binaryTokens.pop()), this._binaryTokens.length === 0 && (this._lastTokenEndIndex = -1, this.produce(e, t), this._binaryTokens[this._binaryTokens.length - 2] = 0);
      for (var n = new Uint32Array(this._binaryTokens.length), i = 0, o = this._binaryTokens.length; i < o; i++)
        n[i] = this._binaryTokens[i];
      return n;
    }, r;
  }()
);
function jt(r) {
  switch (r) {
    case 4:
      return 4;
    case 2:
      return 2;
    case 1:
      return 1;
    case 0:
    default:
      return 8;
  }
}
Object.defineProperty(ce, "__esModule", { value: !0 });
var Ee = I, Lt = (
  /** @class */
  function() {
    function r(e) {
      this._theme = e, this._grammars = {}, this._rawGrammars = {}, this._injectionGrammars = {};
    }
    return r.prototype.setTheme = function(e) {
      var t = this;
      this._theme = e, Object.keys(this._grammars).forEach(function(n) {
        var i = t._grammars[n];
        i.onDidChangeTheme();
      });
    }, r.prototype.getColorMap = function() {
      return this._theme.getColorMap();
    }, r.prototype.addGrammar = function(e, t) {
      this._rawGrammars[e.scopeName] = e;
      var n = {};
      return Ee.collectIncludedScopes(n, e), t && (this._injectionGrammars[e.scopeName] = t, t.forEach(function(i) {
        n[i] = !0;
      })), Object.keys(n);
    }, r.prototype.lookup = function(e) {
      return this._rawGrammars[e];
    }, r.prototype.injections = function(e) {
      return this._injectionGrammars[e];
    }, r.prototype.getDefaults = function() {
      return this._theme.getDefaults();
    }, r.prototype.themeMatch = function(e) {
      return this._theme.match(e);
    }, r.prototype.grammarForScopeName = function(e, t, n, i) {
      if (!this._grammars[e]) {
        var o = this._rawGrammars[e];
        if (!o)
          return null;
        this._grammars[e] = Ee.createGrammar(o, t, n, i, this);
      }
      return this._grammars[e];
    }, r;
  }()
);
ce.SyncRegistry = Lt;
var K = {}, D = {};
D.__esModule = !0;
D.parse = D.parseWithLocation = void 0;
function Dt(r, e, t) {
  return Fe(r, e, t);
}
D.parseWithLocation = Dt;
function Bt(r) {
  return Fe(r, null, null);
}
D.parse = Bt;
function Fe(r, e, t) {
  var n = r.length, i = 0, o = 1, a = 0;
  n > 0 && r.charCodeAt(0) === 65279 && (i = 1);
  function s(p) {
    if (t === null)
      i = i + p;
    else
      for (; p > 0; ) {
        var y = r.charCodeAt(i);
        y === 10 ? (i++, o++, a = 0) : (i++, a++), p--;
      }
  }
  function u(p) {
    t === null ? i = p : s(p - i);
  }
  function c() {
    for (; i < n; ) {
      var p = r.charCodeAt(i);
      if (p !== 32 && p !== 9 && p !== 13 && p !== 10)
        break;
      s(1);
    }
  }
  function h(p) {
    return r.substr(i, p.length) === p ? (s(p.length), !0) : !1;
  }
  function f(p) {
    var y = r.indexOf(p, i);
    u(y !== -1 ? y + p.length : n);
  }
  function l(p) {
    var y = r.indexOf(p, i);
    if (y !== -1) {
      var M = r.substring(i, y);
      return u(y + p.length), M;
    } else {
      var M = r.substr(i);
      return u(n), M;
    }
  }
  var d = 0, g = null, m = [], R = [], v = null;
  function A(p, y) {
    m.push(d), R.push(g), d = p, g = y;
  }
  function P() {
    if (m.length === 0)
      return _("illegal state stack");
    d = m.pop(), g = R.pop();
  }
  function _(p) {
    throw new Error("Near offset " + i + ": " + p + " ~~~" + r.substr(i, 50) + "~~~");
  }
  var S = {
    enterDict: function() {
      if (v === null)
        return _("missing <key>");
      var p = {};
      t !== null && (p[t] = {
        filename: e,
        line: o,
        char: a
      }), g[v] = p, v = null, A(1, p);
    },
    enterArray: function() {
      if (v === null)
        return _("missing <key>");
      var p = [];
      g[v] = p, v = null, A(2, p);
    }
  }, G = {
    enterDict: function() {
      var p = {};
      t !== null && (p[t] = {
        filename: e,
        line: o,
        char: a
      }), g.push(p), A(1, p);
    },
    enterArray: function() {
      var p = [];
      g.push(p), A(2, p);
    }
  };
  function F() {
    d === 1 ? S.enterDict() : d === 2 ? G.enterDict() : (g = {}, t !== null && (g[t] = {
      filename: e,
      line: o,
      char: a
    }), A(1, g));
  }
  function O() {
    if (d === 1)
      P();
    else return _("unexpected </dict>");
  }
  function Qe() {
    d === 1 ? S.enterArray() : d === 2 ? G.enterArray() : (g = [], A(2, g));
  }
  function _e() {
    if (d === 1)
      return _("unexpected </array>");
    if (d === 2)
      P();
    else
      return _("unexpected </array>");
  }
  function Ye(p) {
    if (d === 1) {
      if (v !== null)
        return _("too many <key>");
      v = p;
    } else return _("unexpected <key>");
  }
  function Ve(p) {
    if (d === 1) {
      if (v === null)
        return _("missing <key>");
      g[v] = p, v = null;
    } else d === 2 ? g.push(p) : g = p;
  }
  function Ze(p) {
    if (isNaN(p))
      return _("cannot parse float");
    if (d === 1) {
      if (v === null)
        return _("missing <key>");
      g[v] = p, v = null;
    } else d === 2 ? g.push(p) : g = p;
  }
  function Ke(p) {
    if (isNaN(p))
      return _("cannot parse integer");
    if (d === 1) {
      if (v === null)
        return _("missing <key>");
      g[v] = p, v = null;
    } else d === 2 ? g.push(p) : g = p;
  }
  function et(p) {
    if (d === 1) {
      if (v === null)
        return _("missing <key>");
      g[v] = p, v = null;
    } else d === 2 ? g.push(p) : g = p;
  }
  function tt(p) {
    if (d === 1) {
      if (v === null)
        return _("missing <key>");
      g[v] = p, v = null;
    } else d === 2 ? g.push(p) : g = p;
  }
  function me(p) {
    if (d === 1) {
      if (v === null)
        return _("missing <key>");
      g[v] = p, v = null;
    } else d === 2 ? g.push(p) : g = p;
  }
  function rt(p) {
    return p.replace(/&#([0-9]+);/g, function(y, M) {
      return String.fromCodePoint(parseInt(M, 10));
    }).replace(/&#x([0-9a-f]+);/g, function(y, M) {
      return String.fromCodePoint(parseInt(M, 16));
    }).replace(/&amp;|&lt;|&gt;|&quot;|&apos;/g, function(y) {
      switch (y) {
        case "&amp;":
          return "&";
        case "&lt;":
          return "<";
        case "&gt;":
          return ">";
        case "&quot;":
          return '"';
        case "&apos;":
          return "'";
      }
      return y;
    });
  }
  function nt() {
    var p = l(">"), y = !1;
    return p.charCodeAt(p.length - 1) === 47 && (y = !0, p = p.substring(0, p.length - 1)), {
      name: p.trim(),
      isClosed: y
    };
  }
  function k(p) {
    if (p.isClosed)
      return "";
    var y = l("</");
    return f(">"), rt(y);
  }
  for (; i < n && (c(), !(i >= n)); ) {
    var it = r.charCodeAt(i);
    if (s(1), it !== 60)
      return _("expected <");
    if (i >= n)
      return _("unexpected end of input");
    var te = r.charCodeAt(i);
    if (te === 63) {
      s(1), f("?>");
      continue;
    }
    if (te === 33) {
      if (s(1), h("--")) {
        f("-->");
        continue;
      }
      f(">");
      continue;
    }
    if (te === 47) {
      if (s(1), c(), h("plist")) {
        f(">");
        continue;
      }
      if (h("dict")) {
        f(">"), O();
        continue;
      }
      if (h("array")) {
        f(">"), _e();
        continue;
      }
      return _("unexpected closed tag");
    }
    var b = nt();
    switch (b.name) {
      case "dict":
        F(), b.isClosed && O();
        continue;
      case "array":
        Qe(), b.isClosed && _e();
        continue;
      case "key":
        Ye(k(b));
        continue;
      case "string":
        Ve(k(b));
        continue;
      case "real":
        Ze(parseFloat(k(b)));
        continue;
      case "integer":
        Ke(parseInt(k(b), 10));
        continue;
      case "date":
        et(new Date(k(b)));
        continue;
      case "data":
        tt(k(b));
        continue;
      case "true":
        k(b), me(!0);
        continue;
      case "false":
        k(b), me(!1);
        continue;
    }
    if (!/^plist/.test(b.name))
      return _("unexpected opened tag " + b.name);
  }
  return g;
}
var de = {};
Object.defineProperty(de, "__esModule", { value: !0 });
function $e(r, e) {
  throw new Error("Near offset " + r.pos + ": " + e + " ~~~" + r.source.substr(r.pos, 50) + "~~~");
}
function Nt(r, e, t) {
  var n = new Ft(r), i = new $t(), o = 0, a = null, s = [], u = [];
  function c() {
    s.push(o), u.push(a);
  }
  function h() {
    o = s.pop(), a = u.pop();
  }
  function f(m) {
    $e(n, m);
  }
  for (; re(n, i); ) {
    if (o === 0) {
      if (a !== null && f("too many constructs in root"), i.type === 3) {
        a = {}, t && (a.$vscodeTextmateLocation = i.toLocation(e)), c(), o = 1;
        continue;
      }
      if (i.type === 2) {
        a = [], c(), o = 4;
        continue;
      }
      f("unexpected token in root");
    }
    if (o === 2) {
      if (i.type === 5) {
        h();
        continue;
      }
      if (i.type === 7) {
        o = 3;
        continue;
      }
      f("expected , or }");
    }
    if (o === 1 || o === 3) {
      if (o === 1 && i.type === 5) {
        h();
        continue;
      }
      if (i.type === 1) {
        var l = i.value;
        if ((!re(n, i) || i.type !== 6) && f("expected colon"), re(n, i) || f("expected value"), o = 2, i.type === 1) {
          a[l] = i.value;
          continue;
        }
        if (i.type === 8) {
          a[l] = null;
          continue;
        }
        if (i.type === 9) {
          a[l] = !0;
          continue;
        }
        if (i.type === 10) {
          a[l] = !1;
          continue;
        }
        if (i.type === 11) {
          a[l] = parseFloat(i.value);
          continue;
        }
        if (i.type === 2) {
          var d = [];
          a[l] = d, c(), o = 4, a = d;
          continue;
        }
        if (i.type === 3) {
          var g = {};
          t && (g.$vscodeTextmateLocation = i.toLocation(e)), a[l] = g, c(), o = 1, a = g;
          continue;
        }
      }
      f("unexpected token in dict");
    }
    if (o === 5) {
      if (i.type === 4) {
        h();
        continue;
      }
      if (i.type === 7) {
        o = 6;
        continue;
      }
      f("expected , or ]");
    }
    if (o === 4 || o === 6) {
      if (o === 4 && i.type === 4) {
        h();
        continue;
      }
      if (o = 5, i.type === 1) {
        a.push(i.value);
        continue;
      }
      if (i.type === 8) {
        a.push(null);
        continue;
      }
      if (i.type === 9) {
        a.push(!0);
        continue;
      }
      if (i.type === 10) {
        a.push(!1);
        continue;
      }
      if (i.type === 11) {
        a.push(parseFloat(i.value));
        continue;
      }
      if (i.type === 2) {
        var d = [];
        a.push(d), c(), o = 4, a = d;
        continue;
      }
      if (i.type === 3) {
        var g = {};
        t && (g.$vscodeTextmateLocation = i.toLocation(e)), a.push(g), c(), o = 1, a = g;
        continue;
      }
      f("unexpected token in array");
    }
    f("unknown state");
  }
  return u.length !== 0 && f("unclosed constructs"), a;
}
de.parse = Nt;
var Ft = (
  /** @class */
  /* @__PURE__ */ function() {
    function r(e) {
      this.source = e, this.pos = 0, this.len = e.length, this.line = 1, this.char = 0;
    }
    return r;
  }()
), $t = (
  /** @class */
  function() {
    function r() {
      this.value = null, this.offset = -1, this.len = -1, this.line = -1, this.char = -1;
    }
    return r.prototype.toLocation = function(e) {
      return {
        filename: e,
        line: this.line,
        char: this.char
      };
    }, r;
  }()
);
function re(r, e) {
  e.value = null, e.type = 0, e.offset = -1, e.len = -1, e.line = -1, e.char = -1;
  var t = r.source, n = r.pos, i = r.len, o = r.line, a = r.char, s;
  do {
    if (n >= i)
      return !1;
    if (s = t.charCodeAt(n), s === 32 || s === 9 || s === 13) {
      n++, a++;
      continue;
    }
    if (s === 10) {
      n++, o++, a = 0;
      continue;
    }
    break;
  } while (!0);
  if (e.offset = n, e.line = o, e.char = a, s === 34) {
    e.type = 1, n++, a++;
    do {
      if (n >= i)
        return !1;
      if (s = t.charCodeAt(n), n++, a++, s === 92) {
        n++, a++;
        continue;
      }
      if (s === 34)
        break;
    } while (!0);
    e.value = t.substring(e.offset + 1, n - 1).replace(/\\u([0-9A-Fa-f]{4})/g, function(u, c) {
      return String.fromCodePoint(parseInt(c, 16));
    }).replace(/\\(.)/g, function(u, c) {
      switch (c) {
        case '"':
          return '"';
        case "\\":
          return "\\";
        case "/":
          return "/";
        case "b":
          return "\b";
        case "f":
          return "\f";
        case "n":
          return `
`;
        case "r":
          return "\r";
        case "t":
          return "	";
        default:
          $e(r, "invalid escape sequence");
      }
    });
  } else if (s === 91)
    e.type = 2, n++, a++;
  else if (s === 123)
    e.type = 3, n++, a++;
  else if (s === 93)
    e.type = 4, n++, a++;
  else if (s === 125)
    e.type = 5, n++, a++;
  else if (s === 58)
    e.type = 6, n++, a++;
  else if (s === 44)
    e.type = 7, n++, a++;
  else if (s === 110) {
    if (e.type = 8, n++, a++, s = t.charCodeAt(n), s !== 117 || (n++, a++, s = t.charCodeAt(n), s !== 108) || (n++, a++, s = t.charCodeAt(n), s !== 108))
      return !1;
    n++, a++;
  } else if (s === 116) {
    if (e.type = 9, n++, a++, s = t.charCodeAt(n), s !== 114 || (n++, a++, s = t.charCodeAt(n), s !== 117) || (n++, a++, s = t.charCodeAt(n), s !== 101))
      return !1;
    n++, a++;
  } else if (s === 102) {
    if (e.type = 10, n++, a++, s = t.charCodeAt(n), s !== 97 || (n++, a++, s = t.charCodeAt(n), s !== 108) || (n++, a++, s = t.charCodeAt(n), s !== 115) || (n++, a++, s = t.charCodeAt(n), s !== 101))
      return !1;
    n++, a++;
  } else {
    e.type = 11;
    do {
      if (n >= i)
        return !1;
      if (s = t.charCodeAt(n), s === 46 || s >= 48 && s <= 57 || s === 101 || s === 69 || s === 45 || s === 43) {
        n++, a++;
        continue;
      }
      break;
    } while (!0);
  }
  return e.len = n - e.offset, e.value === null && (e.value = t.substr(e.offset, e.len)), r.pos = n, r.line = o, r.char = a, !0;
}
Object.defineProperty(K, "__esModule", { value: !0 });
var Ie = D, We = X, Wt = de;
function Ut(r, e) {
  return We.CAPTURE_METADATA ? Wt.parse(r, e, !0) : JSON.parse(r);
}
K.parseJSONGrammar = Ut;
function qt(r, e) {
  return We.CAPTURE_METADATA ? Ie.parseWithLocation(r, e, "$vscodeTextmateLocation") : Ie.parse(r);
}
K.parsePLISTGrammar = qt;
var T = {};
Object.defineProperty(T, "__esModule", { value: !0 });
var Ue = (
  /** @class */
  /* @__PURE__ */ function() {
    function r(e, t, n, i, o, a) {
      this.scope = e, this.parentScopes = t, this.index = n, this.fontStyle = i, this.foreground = o, this.background = a;
    }
    return r;
  }()
);
T.ParsedThemeRule = Ue;
function Te(r) {
  return !!(/^#[0-9a-f]{6}$/i.test(r) || /^#[0-9a-f]{8}$/i.test(r) || /^#[0-9a-f]{3}$/i.test(r) || /^#[0-9a-f]{4}$/i.test(r));
}
function qe(r) {
  if (!r)
    return [];
  if (!r.settings || !Array.isArray(r.settings))
    return [];
  for (var e = r.settings, t = [], n = 0, i = 0, o = e.length; i < o; i++) {
    var a = e[i];
    if (a.settings) {
      var s = void 0;
      if (typeof a.scope == "string") {
        var u = a.scope;
        u = u.replace(/^[,]+/, ""), u = u.replace(/[,]+$/, ""), s = u.split(",");
      } else Array.isArray(a.scope) ? s = a.scope : s = [""];
      var c = -1;
      if (typeof a.settings.fontStyle == "string") {
        c = 0;
        for (var h = a.settings.fontStyle.split(" "), f = 0, l = h.length; f < l; f++) {
          var d = h[f];
          switch (d) {
            case "italic":
              c = c | 1;
              break;
            case "bold":
              c = c | 2;
              break;
            case "underline":
              c = c | 4;
              break;
          }
        }
      }
      var g = null;
      typeof a.settings.foreground == "string" && Te(a.settings.foreground) && (g = a.settings.foreground);
      var m = null;
      typeof a.settings.background == "string" && Te(a.settings.background) && (m = a.settings.background);
      for (var f = 0, l = s.length; f < l; f++) {
        var u = s[f].trim(), h = u.split(" "), R = h[h.length - 1], v = null;
        h.length > 1 && (v = h.slice(0, h.length - 1), v.reverse()), t[n++] = new Ue(R, v, i, c, g, m);
      }
    }
  }
  return t;
}
T.parseTheme = qe;
function zt(r) {
  r.sort(function(f, l) {
    var d = ge(f.scope, l.scope);
    return d !== 0 || (d = ve(f.parentScopes, l.parentScopes), d !== 0) ? d : f.index - l.index;
  });
  for (var e = 0, t = "#000000", n = "#ffffff"; r.length >= 1 && r[0].scope === ""; ) {
    var i = r.shift();
    i.fontStyle !== -1 && (e = i.fontStyle), i.foreground !== null && (t = i.foreground), i.background !== null && (n = i.background);
  }
  for (var o = new ze(), a = new z(0, null, e, o.getId(t), o.getId(n)), s = new He(new z(0, null, -1, 0, 0), []), u = 0, c = r.length; u < c; u++) {
    var h = r[u];
    s.insert(0, h.scope, h.parentScopes, h.fontStyle, o.getId(h.foreground), o.getId(h.background));
  }
  return new Je(o, a, s);
}
var ze = (
  /** @class */
  function() {
    function r() {
      this._lastColorId = 0, this._id2color = [], this._color2id = /* @__PURE__ */ Object.create(null);
    }
    return r.prototype.getId = function(e) {
      if (e === null)
        return 0;
      e = e.toUpperCase();
      var t = this._color2id[e];
      return t || (t = ++this._lastColorId, this._color2id[e] = t, this._id2color[t] = e, t);
    }, r.prototype.getColorMap = function() {
      return this._id2color.slice(0);
    }, r;
  }()
);
T.ColorMap = ze;
var Je = (
  /** @class */
  function() {
    function r(e, t, n) {
      this._colorMap = e, this._root = n, this._defaults = t, this._cache = {};
    }
    return r.createFromRawTheme = function(e) {
      return this.createFromParsedTheme(qe(e));
    }, r.createFromParsedTheme = function(e) {
      return zt(e);
    }, r.prototype.getColorMap = function() {
      return this._colorMap.getColorMap();
    }, r.prototype.getDefaults = function() {
      return this._defaults;
    }, r.prototype.match = function(e) {
      return this._cache.hasOwnProperty(e) || (this._cache[e] = this._root.match(e)), this._cache[e];
    }, r;
  }()
);
T.Theme = Je;
function ge(r, e) {
  return r < e ? -1 : r > e ? 1 : 0;
}
T.strcmp = ge;
function ve(r, e) {
  if (r === null && e === null)
    return 0;
  if (!r)
    return -1;
  if (!e)
    return 1;
  var t = r.length, n = e.length;
  if (t === n) {
    for (var i = 0; i < t; i++) {
      var o = ge(r[i], e[i]);
      if (o !== 0)
        return o;
    }
    return 0;
  }
  return t - n;
}
T.strArrCmp = ve;
var z = (
  /** @class */
  function() {
    function r(e, t, n, i, o) {
      this.scopeDepth = e, this.parentScopes = t, this.fontStyle = n, this.foreground = i, this.background = o;
    }
    return r.prototype.clone = function() {
      return new r(this.scopeDepth, this.parentScopes, this.fontStyle, this.foreground, this.background);
    }, r.cloneArr = function(e) {
      for (var t = [], n = 0, i = e.length; n < i; n++)
        t[n] = e[n].clone();
      return t;
    }, r.prototype.acceptOverwrite = function(e, t, n, i) {
      this.scopeDepth > e ? console.log("how did this happen?") : this.scopeDepth = e, t !== -1 && (this.fontStyle = t), n !== 0 && (this.foreground = n), i !== 0 && (this.background = i);
    }, r;
  }()
);
T.ThemeTrieElementRule = z;
var He = (
  /** @class */
  function() {
    function r(e, t, n) {
      t === void 0 && (t = []), n === void 0 && (n = {}), this._mainRule = e, this._rulesWithParentScopes = t, this._children = n;
    }
    return r._sortBySpecificity = function(e) {
      return e.length === 1 || e.sort(this._cmpBySpecificity), e;
    }, r._cmpBySpecificity = function(e, t) {
      if (e.scopeDepth === t.scopeDepth) {
        var n = e.parentScopes, i = t.parentScopes, o = n === null ? 0 : n.length, a = i === null ? 0 : i.length;
        if (o === a)
          for (var s = 0; s < o; s++) {
            var u = n[s].length, c = i[s].length;
            if (u !== c)
              return c - u;
          }
        return a - o;
      }
      return t.scopeDepth - e.scopeDepth;
    }, r.prototype.match = function(e) {
      if (e === "")
        return r._sortBySpecificity([].concat(this._mainRule).concat(this._rulesWithParentScopes));
      var t = e.indexOf("."), n, i;
      return t === -1 ? (n = e, i = "") : (n = e.substring(0, t), i = e.substring(t + 1)), this._children.hasOwnProperty(n) ? this._children[n].match(i) : r._sortBySpecificity([].concat(this._mainRule).concat(this._rulesWithParentScopes));
    }, r.prototype.insert = function(e, t, n, i, o, a) {
      if (t === "") {
        this._doInsertHere(e, n, i, o, a);
        return;
      }
      var s = t.indexOf("."), u, c;
      s === -1 ? (u = t, c = "") : (u = t.substring(0, s), c = t.substring(s + 1));
      var h;
      this._children.hasOwnProperty(u) ? h = this._children[u] : (h = new r(this._mainRule.clone(), z.cloneArr(this._rulesWithParentScopes)), this._children[u] = h), h.insert(e + 1, c, n, i, o, a);
    }, r.prototype._doInsertHere = function(e, t, n, i, o) {
      if (t === null) {
        this._mainRule.acceptOverwrite(e, n, i, o);
        return;
      }
      for (var a = 0, s = this._rulesWithParentScopes.length; a < s; a++) {
        var u = this._rulesWithParentScopes[a];
        if (ve(u.parentScopes, t) === 0) {
          u.acceptOverwrite(e, n, i, o);
          return;
        }
      }
      n === -1 && (n = this._mainRule.fontStyle), i === 0 && (i = this._mainRule.foreground), o === 0 && (o = this._mainRule.background), this._rulesWithParentScopes.push(new z(e, t, n, i, o));
    }, r;
  }()
);
T.ThemeTrieElement = He;
var $ = x && x.__awaiter || function(r, e, t, n) {
  return new (t || (t = Promise))(function(i, o) {
    function a(c) {
      try {
        u(n.next(c));
      } catch (h) {
        o(h);
      }
    }
    function s(c) {
      try {
        u(n.throw(c));
      } catch (h) {
        o(h);
      }
    }
    function u(c) {
      c.done ? i(c.value) : new t(function(h) {
        h(c.value);
      }).then(a, s);
    }
    u((n = n.apply(r, e || [])).next());
  });
}, W = x && x.__generator || function(r, e) {
  var t = { label: 0, sent: function() {
    if (o[0] & 1) throw o[1];
    return o[1];
  }, trys: [], ops: [] }, n, i, o, a;
  return a = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
    return this;
  }), a;
  function s(c) {
    return function(h) {
      return u([c, h]);
    };
  }
  function u(c) {
    if (n) throw new TypeError("Generator is already executing.");
    for (; t; ) try {
      if (n = 1, i && (o = c[0] & 2 ? i.return : c[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, c[1])).done) return o;
      switch (i = 0, o && (c = [c[0] & 2, o.value]), c[0]) {
        case 0:
        case 1:
          o = c;
          break;
        case 4:
          return t.label++, { value: c[1], done: !1 };
        case 5:
          t.label++, i = c[1], c = [0];
          continue;
        case 7:
          c = t.ops.pop(), t.trys.pop();
          continue;
        default:
          if (o = t.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) {
            t = 0;
            continue;
          }
          if (c[0] === 3 && (!o || c[1] > o[0] && c[1] < o[3])) {
            t.label = c[1];
            break;
          }
          if (c[0] === 6 && t.label < o[1]) {
            t.label = o[1], o = c;
            break;
          }
          if (o && t.label < o[2]) {
            t.label = o[2], t.ops.push(c);
            break;
          }
          o[2] && t.ops.pop(), t.trys.pop();
          continue;
      }
      c = e.call(r, t);
    } catch (h) {
      c = [6, h], i = 0;
    } finally {
      n = o = 0;
    }
    if (c[0] & 5) throw c[1];
    return { value: c[0] ? c[1] : void 0, done: !0 };
  }
};
Object.defineProperty(V, "__esModule", { value: !0 });
var Jt = ce, ke = K, Me = T, Ht = I, Xt = {
  getGrammarDefinition: function(r) {
    return null;
  },
  getInjections: function(r) {
    return null;
  }
}, Qt = (
  /** @class */
  function() {
    function r(e) {
      e === void 0 && (e = Xt), this._locator = e, this._syncRegistry = new Jt.SyncRegistry(Me.Theme.createFromRawTheme(e.theme)), this.installationQueue = /* @__PURE__ */ new Map();
    }
    return r.prototype.setTheme = function(e) {
      this._syncRegistry.setTheme(Me.Theme.createFromRawTheme(e));
    }, r.prototype.getColorMap = function() {
      return this._syncRegistry.getColorMap();
    }, r.prototype.loadGrammarWithEmbeddedLanguages = function(e, t, n) {
      return this.loadGrammarWithConfiguration(e, t, { embeddedLanguages: n });
    }, r.prototype.loadGrammarWithConfiguration = function(e, t, n) {
      return $(this, void 0, void 0, function() {
        return W(this, function(i) {
          switch (i.label) {
            case 0:
              return [4, this._loadGrammar(e)];
            case 1:
              return i.sent(), [2, this.grammarForScopeName(e, t, n.embeddedLanguages, n.tokenTypes)];
          }
        });
      });
    }, r.prototype.loadGrammar = function(e) {
      return $(this, void 0, void 0, function() {
        return W(this, function(t) {
          return [2, this._loadGrammar(e)];
        });
      });
    }, r.prototype._loadGrammar = function(e, t) {
      return t === void 0 && (t = null), $(this, void 0, void 0, function() {
        var n, i = this;
        return W(this, function(o) {
          switch (o.label) {
            case 0:
              return this._syncRegistry.lookup(e) ? [2, this.grammarForScopeName(e)] : this.installationQueue.has(e) ? [2, this.installationQueue.get(e)] : (n = new Promise(function(a, s) {
                return $(i, void 0, void 0, function() {
                  var u, c, h, f, l = this;
                  return W(this, function(d) {
                    switch (d.label) {
                      case 0:
                        return [4, this._locator.getGrammarDefinition(e, t)];
                      case 1:
                        if (u = d.sent(), !u)
                          throw new Error("A tmGrammar load was requested but registry host failed to provide grammar definition");
                        if (u.format !== "json" && u.format !== "plist" || u.format === "json" && typeof u.content != "object" && typeof u.content != "string" || u.format === "plist" && typeof u.content != "string")
                          throw new TypeError('Grammar definition must be an object, either `{ content: string | object, format: "json" }` OR `{ content: string, format: "plist" }`)');
                        return c = u.format === "json" ? typeof u.content == "string" ? ke.parseJSONGrammar(u.content, "c://fakepath/grammar.json") : u.content : ke.parsePLISTGrammar(u.content, "c://fakepath/grammar.plist"), h = typeof this._locator.getInjections == "function" && this._locator.getInjections(e), c.scopeName = e, f = this._syncRegistry.addGrammar(c, h), [4, Promise.all(f.map(function(g) {
                          return $(l, void 0, void 0, function() {
                            return W(this, function(m) {
                              try {
                                return [2, this._loadGrammar(g, e)];
                              } catch (R) {
                                throw new Error("While trying to load tmGrammar with scopeId: '" + e + "', it's dependency (scopeId: " + g + ") loading errored: " + R.message);
                              }
                              return [
                                2
                                /*return*/
                              ];
                            });
                          });
                        }))];
                      case 2:
                        return d.sent(), a(this.grammarForScopeName(e)), [
                          2
                          /*return*/
                        ];
                    }
                  });
                });
              }), this.installationQueue.set(e, n), [4, n]);
            case 1:
              return o.sent(), this.installationQueue.delete(e), [2, n];
          }
        });
      });
    }, r.prototype.grammarForScopeName = function(e, t, n, i) {
      return t === void 0 && (t = 0), n === void 0 && (n = null), i === void 0 && (i = null), this._syncRegistry.grammarForScopeName(e, t, n, i);
    }, r;
  }()
), Yt = V.Registry = Qt;
V.INITIAL = Ht.StackElement.NULL;
var ee = {};
Object.defineProperty(ee, "__esModule", { value: !0 });
ee.TMToMonacoToken = void 0;
const Vt = (r, e) => {
  let t = "";
  for (let n = e[0].length - 1; n >= 0; n -= 1) {
    const i = e[0][n];
    if (i === ".")
      break;
    t = i + t;
  }
  for (let n = e.length - 1; n >= 0; n -= 1) {
    const i = e[n];
    for (let o = i.length - 1; o >= 0; o -= 1)
      if (i[o] === ".") {
        const s = i.slice(0, o);
        if (r._themeService._theme._tokenTheme._match(s + "." + t)._foreground > 1)
          return s + "." + t;
        if (r._themeService._theme._tokenTheme._match(s)._foreground > 1)
          return s;
      }
  }
  return "";
};
ee.TMToMonacoToken = Vt;
Object.defineProperty(ue, "__esModule", { value: !0 });
var Xe = ue.wireTmGrammars = void 0;
const Zt = V, Kt = ee;
class J {
  constructor(e) {
    ye(this, "_ruleStack");
    this._ruleStack = e;
  }
  get ruleStack() {
    return this._ruleStack;
  }
  clone() {
    return new J(this._ruleStack);
  }
  equals(e) {
    return !(!e || !(e instanceof J) || e !== this || e._ruleStack !== this._ruleStack);
  }
}
function er(r, e, t, n) {
  return Promise.all(Array.from(t.keys()).map(async (i) => {
    const o = await e.loadGrammar(t.get(i));
    r.languages.setTokensProvider(i, {
      getInitialState: () => new J(Zt.INITIAL),
      tokenize: (a, s) => {
        const u = o.tokenizeLine(a, s.ruleStack);
        return {
          endState: new J(u.ruleStack),
          tokens: u.tokens.map((c) => ({
            ...c,
            // TODO: At the moment, monaco-editor doesn't seem to accept array of scopes
            scopes: n ? (0, Kt.TMToMonacoToken)(n, c.scopes) : c.scopes[c.scopes.length - 1]
          }))
        };
      }
    });
  }));
}
Xe = ue.wireTmGrammars = er;
async function tr(r) {
  switch (r) {
    case "source.vue":
      return {
        format: "json",
        content: await import("./vue.tmLanguage-Kr_zPmBa-B0r6-JkJ.js")
      };
    case "source.ts":
      return {
        format: "json",
        content: await import("./TypeScript.tmLanguage-_NQwMFax-DBcUNw8D.js")
      };
    case "source.js":
      return {
        format: "json",
        content: await import("./JavaScript.tmLanguage-G00wHuuU-aXNN1HvG.js")
      };
    case "text.html.basic":
      return {
        format: "json",
        content: await import("./html.tmLanguage-oTCPp0OK-tf6GJYQK.js")
      };
    case "source.css":
      return {
        format: "json",
        content: await import("./css.tmLanguage-v2BEZnO6-B3W8dnZD.js")
      };
    default:
      return {
        format: "json",
        content: {
          scopeName: "source",
          patterns: []
        }
      };
  }
}
async function ar(r, e) {
  const t = new Yt({
    getGrammarDefinition: async (i) => {
      const o = await tr(i);
      return JSON.parse(JSON.stringify(o));
    }
  }), n = /* @__PURE__ */ new Map();
  n.set("vue", "source.vue"), n.set("javascript", "source.js"), n.set("typescript", "source.ts"), n.set("css", "source.css"), n.set("html", "text.html.basic");
  for (const i of n.keys())
    r.languages.register({
      id: i
    });
  await Xe(r, t, n, e);
}
export {
  ar as loadGrammars
};
//# sourceMappingURL=index3-GVWuX-bz-4R7rEw-s.js.map
