var _, h;
function Q() {
  if (h)
    return _;
  h = 1;
  const A = "[A-Za-z$_][0-9A-Za-z$_]*", x = [
    "as",
    // for exports
    "in",
    "of",
    "if",
    "for",
    "while",
    "finally",
    "var",
    "new",
    "function",
    "do",
    "return",
    "void",
    "else",
    "break",
    "catch",
    "instanceof",
    "with",
    "throw",
    "case",
    "default",
    "try",
    "switch",
    "continue",
    "typeof",
    "delete",
    "let",
    "yield",
    "const",
    "class",
    // JS handles these with a special rule
    // "get",
    // "set",
    "debugger",
    "async",
    "await",
    "static",
    "import",
    "from",
    "export",
    "extends"
  ], U = [
    "true",
    "false",
    "null",
    "undefined",
    "NaN",
    "Infinity"
  ], N = [
    // Fundamental objects
    "Object",
    "Function",
    "Boolean",
    "Symbol",
    // numbers and dates
    "Math",
    "Date",
    "Number",
    "BigInt",
    // text
    "String",
    "RegExp",
    // Indexed collections
    "Array",
    "Float32Array",
    "Float64Array",
    "Int8Array",
    "Uint8Array",
    "Uint8ClampedArray",
    "Int16Array",
    "Int32Array",
    "Uint16Array",
    "Uint32Array",
    "BigInt64Array",
    "BigUint64Array",
    // Keyed collections
    "Set",
    "Map",
    "WeakSet",
    "WeakMap",
    // Structured data
    "ArrayBuffer",
    "SharedArrayBuffer",
    "Atomics",
    "DataView",
    "JSON",
    // Control abstraction objects
    "Promise",
    "Generator",
    "GeneratorFunction",
    "AsyncFunction",
    // Reflection
    "Reflect",
    "Proxy",
    // Internationalization
    "Intl",
    // WebAssembly
    "WebAssembly"
  ], S = [
    "Error",
    "EvalError",
    "InternalError",
    "RangeError",
    "ReferenceError",
    "SyntaxError",
    "TypeError",
    "URIError"
  ], m = [
    "setInterval",
    "setTimeout",
    "clearInterval",
    "clearTimeout",
    "require",
    "exports",
    "eval",
    "isFinite",
    "isNaN",
    "parseFloat",
    "parseInt",
    "decodeURI",
    "decodeURIComponent",
    "encodeURI",
    "encodeURIComponent",
    "escape",
    "unescape"
  ], D = [
    "arguments",
    "this",
    "super",
    "console",
    "window",
    "document",
    "localStorage",
    "sessionStorage",
    "module",
    "global"
    // Node.js
  ], k = [].concat(
    m,
    N,
    S
  );
  function P(e) {
    const t = e.regex, $ = (a, { after: r }) => {
      const l = "</" + a[0].slice(1);
      return a.input.indexOf(l, r) !== -1;
    }, n = A, T = {
      begin: "<>",
      end: "</>"
    }, Z = /<[A-Za-z0-9\\._:-]+\s*\/>/, i = {
      begin: /<[A-Za-z0-9\\._:-]+/,
      end: /\/[A-Za-z0-9\\._:-]+>|\/>/,
      /**
       * @param {RegExpMatchArray} match
       * @param {CallbackResponse} response
       */
      isTrulyOpeningTag: (a, r) => {
        const l = a[0].length + a.index, d = a.input[l];
        if (
          // HTML should not include another raw `<` inside a tag
          // nested type?
          // `<Array<Array<number>>`, etc.
          d === "<" || // the , gives away that this is not HTML
          // `<T, A extends keyof T, V>`
          d === ","
        ) {
          r.ignoreMatch();
          return;
        }
        d === ">" && ($(a, { after: l }) || r.ignoreMatch());
        let g;
        const B = a.input.substring(l);
        if (g = B.match(/^\s*=/)) {
          r.ignoreMatch();
          return;
        }
        if ((g = B.match(/^\s+extends\s+/)) && g.index === 0) {
          r.ignoreMatch();
          return;
        }
      }
    }, s = {
      $pattern: A,
      keyword: x,
      literal: U,
      built_in: k,
      "variable.language": D
    }, f = "[0-9](_?[0-9])*", E = `\\.(${f})`, R = "0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*", y = {
      className: "number",
      variants: [
        // DecimalLiteral
        { begin: `(\\b(${R})((${E})|\\.)?|(${E}))[eE][+-]?(${f})\\b` },
        { begin: `\\b(${R})\\b((${E})\\b|\\.)?|(${E})\\b` },
        // DecimalBigIntegerLiteral
        { begin: "\\b(0|[1-9](_?[0-9])*)n\\b" },
        // NonDecimalIntegerLiteral
        { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" },
        { begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" },
        { begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" },
        // LegacyOctalIntegerLiteral (does not include underscore separators)
        // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals
        { begin: "\\b0[0-7]+n?\\b" }
      ],
      relevance: 0
    }, c = {
      className: "subst",
      begin: "\\$\\{",
      end: "\\}",
      keywords: s,
      contains: []
      // defined later
    }, I = {
      begin: ".?html`",
      end: "",
      starts: {
        end: "`",
        returnEnd: !1,
        contains: [
          e.BACKSLASH_ESCAPE,
          c
        ],
        subLanguage: "xml"
      }
    }, O = {
      begin: ".?css`",
      end: "",
      starts: {
        end: "`",
        returnEnd: !1,
        contains: [
          e.BACKSLASH_ESCAPE,
          c
        ],
        subLanguage: "css"
      }
    }, C = {
      begin: ".?gql`",
      end: "",
      starts: {
        end: "`",
        returnEnd: !1,
        contains: [
          e.BACKSLASH_ESCAPE,
          c
        ],
        subLanguage: "graphql"
      }
    }, p = {
      className: "string",
      begin: "`",
      end: "`",
      contains: [
        e.BACKSLASH_ESCAPE,
        c
      ]
    }, u = {
      className: "comment",
      variants: [
        e.COMMENT(
          /\/\*\*(?!\/)/,
          "\\*/",
          {
            relevance: 0,
            contains: [
              {
                begin: "(?=@[A-Za-z]+)",
                relevance: 0,
                contains: [
                  {
                    className: "doctag",
                    begin: "@[A-Za-z]+"
                  },
                  {
                    className: "type",
                    begin: "\\{",
                    end: "\\}",
                    excludeEnd: !0,
                    excludeBegin: !0,
                    relevance: 0
                  },
                  {
                    className: "variable",
                    begin: n + "(?=\\s*(-)|$)",
                    endsParent: !0,
                    relevance: 0
                  },
                  // eat spaces (not newlines) so we can find
                  // types or variables
                  {
                    begin: /(?=[^\n])\s/,
                    relevance: 0
                  }
                ]
              }
            ]
          }
        ),
        e.C_BLOCK_COMMENT_MODE,
        e.C_LINE_COMMENT_MODE
      ]
    }, v = [
      e.APOS_STRING_MODE,
      e.QUOTE_STRING_MODE,
      I,
      O,
      C,
      p,
      // Skip numbers when they are part of a variable name
      { match: /\$\d+/ },
      y
      // This is intentional:
      // See https://github.com/highlightjs/highlight.js/issues/3288
      // hljs.REGEXP_MODE
    ];
    c.contains = v.concat({
      // we need to pair up {} inside our subst to prevent
      // it from ending too early by matching another }
      begin: /\{/,
      end: /\}/,
      keywords: s,
      contains: [
        "self"
      ].concat(v)
    });
    const M = [].concat(u, c.contains), b = M.concat([
      // eat recursive parens in sub expressions
      {
        begin: /(\s*)\(/,
        end: /\)/,
        keywords: s,
        contains: ["self"].concat(M)
      }
    ]), o = {
      className: "params",
      // convert this to negative lookbehind in v12
      begin: /(\s*)\(/,
      // to match the parms with 
      end: /\)/,
      excludeBegin: !0,
      excludeEnd: !0,
      keywords: s,
      contains: b
    }, F = {
      variants: [
        // class Car extends vehicle
        {
          match: [
            /class/,
            /\s+/,
            n,
            /\s+/,
            /extends/,
            /\s+/,
            t.concat(n, "(", t.concat(/\./, n), ")*")
          ],
          scope: {
            1: "keyword",
            3: "title.class",
            5: "keyword",
            7: "title.class.inherited"
          }
        },
        // class Car
        {
          match: [
            /class/,
            /\s+/,
            n
          ],
          scope: {
            1: "keyword",
            3: "title.class"
          }
        }
      ]
    }, L = {
      relevance: 0,
      match: t.either(
        // Hard coded exceptions
        /\bJSON/,
        // Float32Array, OutT
        /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,
        // CSSFactory, CSSFactoryT
        /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,
        // FPs, FPsT
        /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/
        // P
        // single letters are not highlighted
        // BLAH
        // this will be flagged as a UPPER_CASE_CONSTANT instead
      ),
      className: "title.class",
      keywords: {
        _: [
          // se we still get relevance credit for JS library classes
          ...N,
          ...S
        ]
      }
    }, z = {
      label: "use_strict",
      className: "meta",
      relevance: 10,
      begin: /^\s*['"]use (strict|asm)['"]/
    }, G = {
      variants: [
        {
          match: [
            /function/,
            /\s+/,
            n,
            /(?=\s*\()/
          ]
        },
        // anonymous function
        {
          match: [
            /function/,
            /\s*(?=\()/
          ]
        }
      ],
      className: {
        1: "keyword",
        3: "title.function"
      },
      label: "func.def",
      contains: [o],
      illegal: /%/
    }, K = {
      relevance: 0,
      match: /\b[A-Z][A-Z_0-9]+\b/,
      className: "variable.constant"
    };
    function H(a) {
      return t.concat("(?!", a.join("|"), ")");
    }
    const J = {
      match: t.concat(
        /\b/,
        H([
          ...m,
          "super",
          "import"
        ].map((a) => `${a}\\s*\\(`)),
        n,
        t.lookahead(/\s*\(/)
      ),
      className: "title.function",
      relevance: 0
    }, q = {
      begin: t.concat(/\./, t.lookahead(
        t.concat(n, /(?![0-9A-Za-z$_(])/)
      )),
      end: n,
      excludeBegin: !0,
      keywords: "prototype",
      className: "property",
      relevance: 0
    }, W = {
      match: [
        /get|set/,
        /\s+/,
        n,
        /(?=\()/
      ],
      className: {
        1: "keyword",
        3: "title.function"
      },
      contains: [
        {
          // eat to avoid empty params
          begin: /\(\)/
        },
        o
      ]
    }, w = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + e.UNDERSCORE_IDENT_RE + ")\\s*=>", X = {
      match: [
        /const|var|let/,
        /\s+/,
        n,
        /\s*/,
        /=\s*/,
        /(async\s*)?/,
        // async is optional
        t.lookahead(w)
      ],
      keywords: "async",
      className: {
        1: "keyword",
        3: "title.function"
      },
      contains: [
        o
      ]
    };
    return {
      name: "JavaScript",
      aliases: ["js", "jsx", "mjs", "cjs"],
      keywords: s,
      // this will be extended by TypeScript
      exports: { PARAMS_CONTAINS: b, CLASS_REFERENCE: L },
      illegal: /#(?![$_A-z])/,
      contains: [
        e.SHEBANG({
          label: "shebang",
          binary: "node",
          relevance: 5
        }),
        z,
        e.APOS_STRING_MODE,
        e.QUOTE_STRING_MODE,
        I,
        O,
        C,
        p,
        u,
        // Skip numbers when they are part of a variable name
        { match: /\$\d+/ },
        y,
        L,
        {
          className: "attr",
          begin: n + t.lookahead(":"),
          relevance: 0
        },
        X,
        {
          // "value" container
          begin: "(" + e.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*",
          keywords: "return throw case",
          relevance: 0,
          contains: [
            u,
            e.REGEXP_MODE,
            {
              className: "function",
              // we have to count the parens to make sure we actually have the
              // correct bounding ( ) before the =>.  There could be any number of
              // sub-expressions inside also surrounded by parens.
              begin: w,
              returnBegin: !0,
              end: "\\s*=>",
              contains: [
                {
                  className: "params",
                  variants: [
                    {
                      begin: e.UNDERSCORE_IDENT_RE,
                      relevance: 0
                    },
                    {
                      className: null,
                      begin: /\(\s*\)/,
                      skip: !0
                    },
                    {
                      begin: /(\s*)\(/,
                      end: /\)/,
                      excludeBegin: !0,
                      excludeEnd: !0,
                      keywords: s,
                      contains: b
                    }
                  ]
                }
              ]
            },
            {
              // could be a comma delimited list of params to a function call
              begin: /,/,
              relevance: 0
            },
            {
              match: /\s+/,
              relevance: 0
            },
            {
              // JSX
              variants: [
                { begin: T.begin, end: T.end },
                { match: Z },
                {
                  begin: i.begin,
                  // we carefully check the opening tag to see if it truly
                  // is a tag and not a false positive
                  "on:begin": i.isTrulyOpeningTag,
                  end: i.end
                }
              ],
              subLanguage: "xml",
              contains: [
                {
                  begin: i.begin,
                  end: i.end,
                  skip: !0,
                  contains: ["self"]
                }
              ]
            }
          ]
        },
        G,
        {
          // prevent this from getting swallowed up by function
          // since they appear "function like"
          beginKeywords: "while if switch catch for"
        },
        {
          // we have to count the parens to make sure we actually have the correct
          // bounding ( ).  There could be any number of sub-expressions inside
          // also surrounded by parens.
          begin: "\\b(?!function)" + e.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",
          // end parens
          returnBegin: !0,
          label: "func.def",
          contains: [
            o,
            e.inherit(e.TITLE_MODE, { begin: n, className: "title.function" })
          ]
        },
        // catch ... so it won't trigger the property rule below
        {
          match: /\.\.\./,
          relevance: 0
        },
        q,
        // hack: prevents detection of keywords in some circumstances
        // .keyword()
        // $keyword = x
        {
          match: "\\$" + n,
          relevance: 0
        },
        {
          match: [/\bconstructor(?=\s*\()/],
          className: { 1: "title.function" },
          contains: [o]
        },
        J,
        K,
        F,
        W,
        {
          match: /\$[(.]/
          // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
        }
      ]
    };
  }
  return _ = P, _;
}
export {
  Q as __require
};
