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

// ../node_modules/refractor/lang/markdown.js
var S = $((E, k) => {
  k.exports = h;
  h.displayName = "markdown";
  h.aliases = ["md"];
  function h(_) {
    (function(e) {
      var m = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
      function g(n) {
        return n = n.replace(/<inner>/g, function() {
          return m;
        }), RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + "(?:" + n + ")");
      }
      d(g, "createInline");
      var c = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source, p = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(
        /__/g,
        function() {
          return c;
        }
      ), b = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
      e.languages.markdown = e.languages.extend("markup", {}), e.languages.insertBefore("markdown", "prolog", {
        "front-matter-block": {
          pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
          lookbehind: !0,
          greedy: !0,
          inside: {
            punctuation: /^---|---$/,
            "front-matter": {
              pattern: /\S+(?:\s+\S+)*/,
              alias: ["yaml", "language-yaml"],
              inside: e.languages.yaml
            }
          }
        },
        blockquote: {
          // > ...
          pattern: /^>(?:[\t ]*>)*/m,
          alias: "punctuation"
        },
        table: {
          pattern: RegExp(
            "^" + p + b + "(?:" + p + ")*",
            "m"
          ),
          inside: {
            "table-data-rows": {
              pattern: RegExp(
                "^(" + p + b + ")(?:" + p + ")*$"
              ),
              lookbehind: !0,
              inside: {
                "table-data": {
                  pattern: RegExp(c),
                  inside: e.languages.markdown
                },
                punctuation: /\|/
              }
            },
            "table-line": {
              pattern: RegExp("^(" + p + ")" + b + "$"),
              lookbehind: !0,
              inside: {
                punctuation: /\||:?-{3,}:?/
              }
            },
            "table-header-row": {
              pattern: RegExp("^" + p + "$"),
              inside: {
                "table-header": {
                  pattern: RegExp(c),
                  alias: "important",
                  inside: e.languages.markdown
                },
                punctuation: /\|/
              }
            }
          }
        },
        code: [
          {
            // Prefixed by 4 spaces or 1 tab and preceded by an empty line
            pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
            lookbehind: !0,
            alias: "keyword"
          },
          {
            // ```optional language
            // code block
            // ```
            pattern: /^```[\s\S]*?^```$/m,
            greedy: !0,
            inside: {
              "code-block": {
                pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
                lookbehind: !0
              },
              "code-language": {
                pattern: /^(```).+/,
                lookbehind: !0
              },
              punctuation: /```/
            }
          }
        ],
        title: [
          {
            // title 1
            // =======
            // title 2
            // -------
            pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
            alias: "important",
            inside: {
              punctuation: /==+$|--+$/
            }
          },
          {
            // # title 1
            // ###### title 6
            pattern: /(^\s*)#.+/m,
            lookbehind: !0,
            alias: "important",
            inside: {
              punctuation: /^#+|#+$/
            }
          }
        ],
        hr: {
          // ***
          // ---
          // * * *
          // -----------
          pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
          lookbehind: !0,
          alias: "punctuation"
        },
        list: {
          // * item
          // + item
          // - item
          // 1. item
          pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
          lookbehind: !0,
          alias: "punctuation"
        },
        "url-reference": {
          // [id]: http://example.com "Optional title"
          // [id]: http://example.com 'Optional title'
          // [id]: http://example.com (Optional title)
          // [id]: <http://example.com> "Optional title"
          pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
          inside: {
            variable: {
              pattern: /^(!?\[)[^\]]+/,
              lookbehind: !0
            },
            string: /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
            punctuation: /^[\[\]!:]|[<>]/
          },
          alias: "url"
        },
        bold: {
          // **strong**
          // __strong__
          // allow one nested instance of italic text using the same delimiter
          pattern: g(
            /\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source
          ),
          lookbehind: !0,
          greedy: !0,
          inside: {
            content: {
              pattern: /(^..)[\s\S]+(?=..$)/,
              lookbehind: !0,
              inside: {}
              // see below
            },
            punctuation: /\*\*|__/
          }
        },
        italic: {
          // *em*
          // _em_
          // allow one nested instance of bold text using the same delimiter
          pattern: g(
            /\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source
          ),
          lookbehind: !0,
          greedy: !0,
          inside: {
            content: {
              pattern: /(^.)[\s\S]+(?=.$)/,
              lookbehind: !0,
              inside: {}
              // see below
            },
            punctuation: /[*_]/
          }
        },
        strike: {
          // ~~strike through~~
          // ~strike~
          // eslint-disable-next-line regexp/strict
          pattern: g(/(~~?)(?:(?!~)<inner>)+\2/.source),
          lookbehind: !0,
          greedy: !0,
          inside: {
            content: {
              pattern: /(^~~?)[\s\S]+(?=\1$)/,
              lookbehind: !0,
              inside: {}
              // see below
            },
            punctuation: /~~?/
          }
        },
        "code-snippet": {
          // `code`
          // ``code``
          pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
          lookbehind: !0,
          greedy: !0,
          alias: ["code", "keyword"]
        },
        url: {
          // [example](http://example.com "Optional title")
          // [example][id]
          // [example] [id]
          pattern: g(
            /!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source
          ),
          lookbehind: !0,
          greedy: !0,
          inside: {
            operator: /^!/,
            content: {
              pattern: /(^\[)[^\]]+(?=\])/,
              lookbehind: !0,
              inside: {}
              // see below
            },
            variable: {
              pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
              lookbehind: !0
            },
            url: {
              pattern: /(^\]\()[^\s)]+/,
              lookbehind: !0
            },
            string: {
              pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
              lookbehind: !0
            }
          }
        }
      }), ["url", "bold", "italic", "strike"].forEach(function(n) {
        ["url", "bold", "italic", "strike", "code-snippet"].forEach(function(t) {
          n !== t && (e.languages.markdown[n].inside.content.inside[t] = e.languages.markdown[t]);
        });
      }), e.hooks.add("after-tokenize", function(n) {
        if (n.language !== "markdown" && n.language !== "md")
          return;
        function t(i) {
          if (!(!i || typeof i == "string"))
            for (var a = 0, u = i.length; a < u; a++) {
              var o = i[a];
              if (o.type !== "code") {
                t(o.content);
                continue;
              }
              var l = o.content[1], r = o.content[3];
              if (l && r && l.type === "code-language" && r.type === "code-block" && typeof l.content == "string") {
                var s = l.content.replace(/\b#/g, "sharp").replace(/\b\+\+/g, "pp");
                s = (/[a-z][\w-]*/i.exec(s) || [""])[0].toLowerCase();
                var f = "language-" + s;
                r.alias ? typeof r.alias == "string" ? r.alias = [r.alias, f] : r.alias.push(f) : r.alias = [f];
              }
            }
        }
        d(t, "walkTokens"), t(n.tokens);
      }), e.hooks.add("wrap", function(n) {
        if (n.type === "code-block") {
          for (var t = "", i = 0, a = n.classes.length; i < a; i++) {
            var u = n.classes[i], o = /language-(.+)/.exec(u);
            if (o) {
              t = o[1];
              break;
            }
          }
          var l = e.languages[t];
          if (l)
            n.content = e.highlight(
              x(n.content.value),
              l,
              t
            );
          else if (t && t !== "none" && e.plugins.autoloader) {
            var r = "md-" + (/* @__PURE__ */ new Date()).valueOf() + "-" + Math.floor(Math.random() * 1e16);
            n.attributes.id = r, e.plugins.autoloader.loadLanguages(t, function() {
              var s = document.getElementById(r);
              s && (s.innerHTML = e.highlight(
                s.textContent,
                e.languages[t],
                t
              ));
            });
          }
        }
      });
      var w = RegExp(e.languages.markup.tag.pattern.source, "gi"), y = {
        amp: "&",
        lt: "<",
        gt: ">",
        quot: '"'
      }, v = String.fromCodePoint || String.fromCharCode;
      function x(n) {
        var t = n.replace(w, "");
        return t = t.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function(i, a) {
          if (a = a.toLowerCase(), a[0] === "#") {
            var u;
            return a[1] === "x" ? u = parseInt(a.slice(2), 16) : u = Number(a.slice(1)), v(u);
          } else {
            var o = y[a];
            return o || i;
          }
        }), t;
      }
      d(x, "textContent"), e.languages.md = e.languages.markdown;
    })(_);
  }
  d(h, "markdown");
});

export {
  S as a
};
