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

// ../node_modules/highlight.js/lib/languages/latex.js
var h = z((L, p) => {
  function B(n) {
    return n ? typeof n == "string" ? n : n.source : null;
  }
  a(B, "source");
  function Z(...n) {
    return "(" + n.map((E) => B(E)).join("|") + ")";
  }
  a(Z, "either");
  function D(n) {
    let g = Z(...[
      "(?:NeedsTeXFormat|RequirePackage|GetIdInfo)",
      "Provides(?:Expl)?(?:Package|Class|File)",
      "(?:DeclareOption|ProcessOptions)",
      "(?:documentclass|usepackage|input|include)",
      "makeat(?:letter|other)",
      "ExplSyntax(?:On|Off)",
      "(?:new|renew|provide)?command",
      "(?:re)newenvironment",
      "(?:New|Renew|Provide|Declare)(?:Expandable)?DocumentCommand",
      "(?:New|Renew|Provide|Declare)DocumentEnvironment",
      "(?:(?:e|g|x)?def|let)",
      "(?:begin|end)",
      "(?:part|chapter|(?:sub){0,2}section|(?:sub)?paragraph)",
      "caption",
      "(?:label|(?:eq|page|name)?ref|(?:paren|foot|super)?cite)",
      "(?:alpha|beta|[Gg]amma|[Dd]elta|(?:var)?epsilon|zeta|eta|[Tt]heta|vartheta)",
      "(?:iota|(?:var)?kappa|[Ll]ambda|mu|nu|[Xx]i|[Pp]i|varpi|(?:var)rho)",
      "(?:[Ss]igma|varsigma|tau|[Uu]psilon|[Pp]hi|varphi|chi|[Pp]si|[Oo]mega)",
      "(?:frac|sum|prod|lim|infty|times|sqrt|leq|geq|left|right|middle|[bB]igg?)",
      "(?:[lr]angle|q?quad|[lcvdi]?dots|d?dot|hat|tilde|bar)"
    ].map((e) => e + "(?![a-zA-Z@:_])")), E = new RegExp([
      // A function \module_function_name:signature or \__module_function_name:signature,
      // where both module and function_name need at least two characters and
      // function_name may contain single underscores.
      "(?:__)?[a-zA-Z]{2,}_[a-zA-Z](?:_?[a-zA-Z])+:[a-zA-Z]*",
      // A variable \scope_module_and_name_type or \scope__module_ane_name_type,
      // where scope is one of l, g or c, type needs at least two characters
      // and module_and_name may contain single underscores.
      "[lgc]__?[a-zA-Z](?:_?[a-zA-Z])*_[a-zA-Z]{2,}",
      // A quark \q_the_name or \q__the_name or
      // scan mark \s_the_name or \s__vthe_name,
      // where variable_name needs at least two characters and
      // may contain single underscores.
      "[qs]__?[a-zA-Z](?:_?[a-zA-Z])+",
      // Other LaTeX3 macro names that are not covered by the three rules above.
      "use(?:_i)?:[a-zA-Z]*",
      "(?:else|fi|or):",
      "(?:if|cs|exp):w",
      "(?:hbox|vbox):n",
      "::[a-zA-Z]_unbraced",
      "::[a-zA-Z:]"
    ].map((e) => e + "(?![a-zA-Z:_])").join("|")), v = [
      { begin: /[a-zA-Z@]+/ },
      // control word
      { begin: /[^a-zA-Z@]?/ }
      // control symbol
    ], m = [
      { begin: /\^{6}[0-9a-f]{6}/ },
      { begin: /\^{5}[0-9a-f]{5}/ },
      { begin: /\^{4}[0-9a-f]{4}/ },
      { begin: /\^{3}[0-9a-f]{3}/ },
      { begin: /\^{2}[0-9a-f]{2}/ },
      { begin: /\^{2}[\u0000-\u007f]/ }
    ], N = {
      className: "keyword",
      begin: /\\/,
      relevance: 0,
      contains: [
        {
          endsParent: !0,
          begin: g
        },
        {
          endsParent: !0,
          begin: E
        },
        {
          endsParent: !0,
          variants: m
        },
        {
          endsParent: !0,
          relevance: 0,
          variants: v
        }
      ]
    }, R = {
      className: "params",
      relevance: 0,
      begin: /#+\d?/
    }, T = {
      // relevance: 1
      variants: m
    }, M = {
      className: "built_in",
      relevance: 0,
      begin: /[$&^_]/
    }, f = {
      className: "meta",
      begin: "% !TeX",
      end: "$",
      relevance: 10
    }, C = n.COMMENT(
      "%",
      "$",
      {
        relevance: 0
      }
    ), o = [
      N,
      R,
      T,
      M,
      f,
      C
    ], A = {
      begin: /\{/,
      end: /\}/,
      relevance: 0,
      contains: ["self", ...o]
    }, O = n.inherit(
      A,
      {
        relevance: 0,
        endsParent: !0,
        contains: [A, ...o]
      }
    ), P = {
      begin: /\[/,
      end: /\]/,
      endsParent: !0,
      relevance: 0,
      contains: [A, ...o]
    }, b = {
      begin: /\s+/,
      relevance: 0
    }, s = [O], _ = [P], t = /* @__PURE__ */ a(function(e, r) {
      return {
        contains: [b],
        starts: {
          relevance: 0,
          contains: e,
          starts: r
        }
      };
    }, "ARGUMENT_AND_THEN"), i = /* @__PURE__ */ a(function(e, r) {
      return {
        begin: "\\\\" + e + "(?![a-zA-Z@:_])",
        keywords: { $pattern: /\\[a-zA-Z]+/, keyword: "\\" + e },
        relevance: 0,
        contains: [b],
        starts: r
      };
    }, "CSNAME"), l = /* @__PURE__ */ a(function(e, r) {
      return n.inherit(
        {
          begin: "\\\\begin(?=[ 	]*(\\r?\\n[ 	]*)?\\{" + e + "\\})",
          keywords: { $pattern: /\\[a-zA-Z]+/, keyword: "\\begin" },
          relevance: 0
        },
        t(s, r)
      );
    }, "BEGIN_ENV"), u = /* @__PURE__ */ a((e = "string") => n.END_SAME_AS_BEGIN({
      className: e,
      begin: /(.|\r?\n)/,
      end: /(.|\r?\n)/,
      excludeBegin: !0,
      excludeEnd: !0,
      endsParent: !0
    }), "VERBATIM_DELIMITED_EQUAL"), d = /* @__PURE__ */ a(function(e) {
      return {
        className: "string",
        end: "(?=\\\\end\\{" + e + "\\})"
      };
    }, "VERBATIM_DELIMITED_ENV"), c = /* @__PURE__ */ a((e = "string") => ({
      relevance: 0,
      begin: /\{/,
      starts: {
        endsParent: !0,
        contains: [
          {
            className: e,
            end: /(?=\})/,
            endsParent: !0,
            contains: [
              {
                begin: /\{/,
                end: /\}/,
                relevance: 0,
                contains: ["self"]
              }
            ]
          }
        ]
      }
    }), "VERBATIM_DELIMITED_BRACES"), I = [
      ...["verb", "lstinline"].map((e) => i(e, { contains: [u()] })),
      i("mint", t(s, { contains: [u()] })),
      i("mintinline", t(s, { contains: [c(), u()] })),
      i("url", { contains: [c("link"), c("link")] }),
      i("hyperref", { contains: [c("link")] }),
      i("href", t(_, { contains: [c("link")] })),
      ...[].concat(...["", "\\*"].map((e) => [
        l("verbatim" + e, d("verbatim" + e)),
        l("filecontents" + e, t(s, d("filecontents" + e))),
        ...["", "B", "L"].map(
          (r) => l(r + "Verbatim" + e, t(_, d(r + "Verbatim" + e)))
        )
      ])),
      l("minted", t(_, t(s, d("minted"))))
    ];
    return {
      name: "LaTeX",
      aliases: ["tex"],
      contains: [
        ...I,
        ...o
      ]
    };
  }
  a(D, "latex");
  p.exports = D;
});

export {
  h as a
};
