import {
  a as i,
  c as z
} from "./chunk-IO47FP3U.js";

// ../node_modules/refractor/lang/graphql.js
var _ = z(($, k) => {
  k.exports = y;
  y.displayName = "graphql";
  y.aliases = [];
  function y(s) {
    s.languages.graphql = {
      comment: /#.*/,
      description: {
        pattern: /(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,
        greedy: !0,
        alias: "string",
        inside: {
          "language-markdown": {
            pattern: /(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,
            lookbehind: !0,
            inside: s.languages.markdown
          }
        }
      },
      string: {
        pattern: /"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,
        greedy: !0
      },
      number: /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
      boolean: /\b(?:false|true)\b/,
      variable: /\$[a-z_]\w*/i,
      directive: {
        pattern: /@[a-z_]\w*/i,
        alias: "function"
      },
      "attr-name": {
        pattern: /\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,
        greedy: !0
      },
      "atom-input": {
        pattern: /\b[A-Z]\w*Input\b/,
        alias: "class-name"
      },
      scalar: /\b(?:Boolean|Float|ID|Int|String)\b/,
      constant: /\b[A-Z][A-Z_\d]*\b/,
      "class-name": {
        pattern: /(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,
        lookbehind: !0
      },
      fragment: {
        pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,
        lookbehind: !0,
        alias: "function"
      },
      "definition-mutation": {
        pattern: /(\bmutation\s+)[a-zA-Z_]\w*/,
        lookbehind: !0,
        alias: "function"
      },
      "definition-query": {
        pattern: /(\bquery\s+)[a-zA-Z_]\w*/,
        lookbehind: !0,
        alias: "function"
      },
      keyword: /\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,
      operator: /[!=|&]|\.{3}/,
      "property-query": /\w+(?=\s*\()/,
      object: /\w+(?=\s*\{)/,
      punctuation: /[!(){}\[\]:=,]/,
      property: /\w+/
    }, s.hooks.add("after-tokenize", /* @__PURE__ */ i(function(m) {
      if (m.language !== "graphql")
        return;
      var o = m.tokens.filter(function(t) {
        return typeof t != "string" && t.type !== "comment" && t.type !== "scalar";
      }), a = 0;
      function u(t) {
        return o[a + t];
      }
      i(u, "getToken");
      function v(t, n) {
        n = n || 0;
        for (var e = 0; e < t.length; e++) {
          var r = u(e + n);
          if (!r || r.type !== t[e])
            return !1;
        }
        return !0;
      }
      i(v, "isTokenType");
      function h(t, n) {
        for (var e = 1, r = a; r < o.length; r++) {
          var A = o[r], d = A.content;
          if (A.type === "punctuation" && typeof d == "string") {
            if (t.test(d))
              e++;
            else if (n.test(d) && (e--, e === 0))
              return r;
          }
        }
        return -1;
      }
      i(h, "findClosingBracket");
      function l(t, n) {
        var e = t.alias;
        e ? Array.isArray(e) || (t.alias = e = [e]) : t.alias = e = [], e.push(n);
      }
      for (i(l, "addAlias"); a < o.length; ) {
        var w = o[a++];
        if (w.type === "keyword" && w.content === "mutation") {
          var p = [];
          if (v(["definition-mutation", "punctuation"]) && u(1).content === "(") {
            a += 2;
            var f = h(/^\($/, /^\)$/);
            if (f === -1)
              continue;
            for (; a < f; a++) {
              var c = u(0);
              c.type === "variable" && (l(c, "variable-input"), p.push(c.content));
            }
            a = f + 1;
          }
          if (v(["punctuation", "property-query"]) && u(0).content === "{" && (a++, l(u(0), "property-mutation"), p.length > 0)) {
            var q = h(/^\{$/, /^\}$/);
            if (q === -1)
              continue;
            for (var b = a; b < q; b++) {
              var g = o[b];
              g.type === "variable" && p.indexOf(g.content) >= 0 && l(g, "variable-input");
            }
          }
        }
      }
    }, "afterTokenizeGraphql"));
  }
  i(y, "graphql");
});

export {
  _ as a
};
