Files
discord-decomp/_bundle/Module3888.js
T
2026-11-01 12:12:55 +02:00

1637 lines
47 KiB
JavaScript

// Metro module 3888 (f3889).
function $mk103388($env) {
return function(a0, a1) {
const r4 = $env;
if (a0.type === "tableSeparator") {
const r31 = r4[0];
if (r31 ? a1 !== 0 && a1 !== r4[1].length - 1 : !r31) {
r4[2].push([]);
}
} else {
let r2 = a0.type !== "text";
if (!r2) {
const r12 = r4[1];
r2 = r12[a1 + 1] != null && r12[a1 + 1].type !== "tableSeparator";
}
if (!r2) {
a0.content = a0.content.replace($env.$parent[1], "");
}
const r24 = r4[2];
r24[r24.length - 1].push(a0);
}
};
}
function $mk114419($env) {
return function(a0) {
let env31327;
const r1 = $env.$parent;
let r5 = $env[0];
const r7 = env31327 = {
$parent: r1
};
env31327[0] = r5;
if (!r5) {
r5 = {};
}
env31327[0] = r5;
return Array.isArray(a0) ? a0.map($mk114419(r7)).join("") : (0, r1[0])(a0, r1[1], r5);
};
}
const t = function t() {
"use strict";
let $mk103387 = function() {
return function(a0) {
return env13716[16][a0];
};
};
let env13716 = {};
env13716[7] = /\r\n?/g;
env13716[8] = /\t/g;
env13716[9] = /\f/g;
const Symbol2 = globalThis.Symbol;
env13716[10] = (typeof Symbol2 === "function" ? Symbol.for : typeof Symbol2 === "function") && Symbol.for("react.transitional.element") || 60103;
const reactElement = function reactElement(a0, a1, a2) {
return {
$$typeof: env13716[10],
type: a0,
key: a1 == null ? void 0 : a1,
ref: null,
props: a2,
_owner: null
};
};
env13716[11] = reactElement;
const htmlTag = function htmlTag(a0, a1, a2, a3) {
let r17;
const r13 = a2 ? a2 : {};
const r4 = a3 === void 0 || a3;
let r5 = "";
let r8 = "";
for (const key in r13) {
r17 = r5;
r8 = r17;
const r18 = r13[key];
const r27 = Object.prototype.hasOwnProperty.call(r13, key) && r18;
r5 = r17;
if (r27) {
const r28 = env13716[17];
const r21 = String(key);
const r20 = env13716[15];
r5 = HermesInternal.concat.call(r17, " " + r21.replace(r20, $mk103387()) + "=\"" + String(r18).replace(r20, $mk103387()), "\"");
}
}
r17 = r5;
r8 = r17;
const r52 = HermesInternal.concat.call("<" + a0, r8, ">");
return r4 ? r52 + a1 + "</" + a0 + ">" : r52;
};
env13716[12] = htmlTag;
env13716[13] = {};
const sanitizeUrl = function sanitizeUrl(a0) {
if (a0 == null) {
return null;
}
L5: {
try {
const protocol = new URL(a0, "https://localhost").protocol;
if (protocol.indexOf("javascript:") === 0) {
break L5;
}
if (protocol.indexOf("vbscript:") === 0) {
break L5;
}
if (protocol.indexOf("data:") === 0) {
break L5;
}
} catch ($e) {
return null;
}
return a0;
}
return null;
};
env13716[14] = sanitizeUrl;
env13716[15] = /[<>&"']/g;
env13716[16] = {
"<": "&lt;",
">": "&gt;",
"&": "&amp;",
"\"": "&quot;",
"'": "&#x27;",
"/": "&#x2F;",
"`": "&#96;"
};
const sanitizeText = function sanitizeText(a0) {
return String(a0).replace(env13716[15], $mk103387());
};
env13716[17] = sanitizeText;
env13716[18] = /\\([^0-9A-Za-z\s])/g;
const unescapeUrl = function unescapeUrl(a0) {
return a0.replace(env13716[18], "$1");
};
env13716[19] = unescapeUrl;
const parseInline = function parseInline(a0, a1, a2) {
const inline = a2.inline || false;
a2.inline = true;
const r6 = a0(a1, a2);
a2.inline = inline;
return r6;
};
env13716[20] = parseInline;
env13716[21] = new RegExp("^( *)((?:[*+-]|\\d+\\.)) +");
env13716[22] = new RegExp("( *)((?:[*+-]|\\d+\\.)) +[^\\n]*(?:\\n(?!\\1(?:[*+-]|\\d+\\.) )[^\\n]*)*(\n|$)", "gm");
const r44 = /\n{2,}$/;
env13716[23] = r44;
env13716[24] = /^ (?= *`)|(` *) $/g;
env13716[25] = r44;
env13716[26] = / *\n+$/;
env13716[27] = new RegExp("^( *)((?:[*+-]|\\d+\\.)) [\\s\\S]+?(?:\n{2,}(?! )(?!\\1(?:[*+-]|\\d+\\.) )\\n*|\\s*\n*$)");
env13716[28] = /(?:^|\n)( *)$/;
env13716[0] = /^ *\| *| *\| *$/g;
env13716[1] = / *$/;
env13716[2] = /^ *-+: *$/;
env13716[3] = /^ *:-+: *$/;
env13716[4] = /^ *:-+ *$/;
env13716[5] = function l(a0) {
return env13716[2].test(a0) ? "right" : env13716[3].test(a0) ? "center" : env13716[4].test(a0) ? "left" : null;
};
env13716[6] = function(a0, a1, a2, a3) {};
const i = function i(c24880_0) {
return function(a0, a1, a2) {
a2.inline = true;
const r3 = env13716;
const r4 = env13716[6];
const r9 = a0[1];
let env29237;
const r15 = env29237 = {
$parent: r3
};
env29237[0] = c24880_0;
const inTable = a2.inTable;
a2.inTable = true;
const r19 = a1(r9.trim(), a2);
env29237[1] = r19;
a2.inTable = inTable;
const header = [[]];
env29237[2] = header;
r19.forEach($mk103388(r15));
const r11 = a0[2];
const r25 = c24880_0 ? r11.replace(env13716[0], "") : r11;
const align = r25.trim().split("|").map(env13716[5]);
const r36 = a0[3];
let c29238_0 = a1;
let c29238_1 = a2;
let c29238_2 = c24880_0;
const cells = r36.trim().split("\n").map(function(item) {
const r1 = env13716;
const r2 = env13716[6];
let env31921;
const r10 = env31921 = {
$parent: r1
};
env31921[0] = c29238_2;
const inTable = c29238_1.inTable;
c29238_1.inTable = true;
const r16 = c29238_0(item.trim(), c29238_1);
env31921[1] = r16;
c29238_1.inTable = inTable;
const r18 = [[]];
env31921[2] = r18;
r16.forEach($mk103388(r10));
return r18;
});
a2.inline = false;
return {
type: "table",
header,
align,
cells
};
};
};
const parse3 = i(true);
const parse2 = i(false);
env13716[29] = /mailto:/i;
env13716[30] = function parseRef(a0, a1, a2) {};
try {
new RegExp("(?<=a)");
new RegExp("(?<!a)");
} catch ($e) {}
const inlineRegex = function inlineRegex(a0) {
let c24877_0 = a0;
const match2 = function match(a0, a1) {
return a1.inline ? c24877_0.exec(a0) : null;
};
match2.regex = a0;
return match2;
};
const blockRegex = function blockRegex(a0) {
let c24878_0 = a0;
const match2 = function match(a0, a1) {
return a1.inline ? null : c24878_0.exec(a0);
};
match2.regex = a0;
return match2;
};
const parseCaptureInline = function parseCaptureInline(a0, a1, a2) {
const r8 = env13716[20];
const r5 = a0[1];
const inline = a2.inline || false;
a2.inline = true;
const content = a1(r5, a2);
a2.inline = inline;
return {
content
};
};
const ignoreCapture = function ignoreCapture() {
return {};
};
const r79 = /^ *(\|.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/;
const r16 = /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/;
const defaultRules = {
Array: {
react: function react(a0, a1, a2) {
let type3;
const key = a2.key;
const r10 = [];
const length = a0.length;
let r5 = 0;
const r9 = 0 < length;
let r6 = 0;
if (r9) {
do {
a2.key = "" + r5;
const r17 = a0[r5];
const type = r17.type;
const r7 = r6;
const r1 = r5;
let r21 = r17;
let r2 = r1;
if (type === "text") {
const r23 = {
type: "text",
content: r17.content
};
const r0 = r1 + 1;
const length2 = a0.length;
r21 = r23;
r2 = r1;
if (r0 < length2) {
const type2 = a0[r0].type;
let r27 = r1;
r21 = r23;
r2 = r27;
if (type2 === "text") {
do {
const content = r23.content;
const r28 = r27 + 1;
r23.content = content + a0[r28].content;
const r4 = r28 + 1;
const length3 = a0.length;
r21 = r23;
r2 = r28;
if (!(r4 < length3)) {
break;
}
type3 = a0[r4].type;
r27 = r28;
r21 = r23;
r2 = r27;
} while (type3 === "text");
}
}
}
r10.push(a1(r21, a2));
r5 = r2 + 1;
r6 = r7 + 1;
} while (r5 < a0.length);
}
a2.key = key;
return r10;
},
html: function html(a0, a1, a2) {
let length4, type3;
const length = a0.length;
let r5 = 0;
const r7 = 0 < length;
let r10 = "";
let r19 = "";
if (r7) {
do {
const r16 = a0[r5];
const type = r16.type;
const r1 = r5;
const r15 = r10;
let r9 = r16;
let r2 = r1;
if (type === "text") {
const r21 = {
type: "text",
content: r16.content
};
const r0 = r1 + 1;
const length2 = a0.length;
r9 = r21;
r2 = r1;
if (r0 < length2) {
const type2 = a0[r0].type;
let r25 = r1;
r9 = r21;
r2 = r25;
if (type2 === "text") {
do {
const content = r21.content;
const r26 = r25 + 1;
r21.content = content + a0[r26].content;
const r4 = r26 + 1;
const length3 = a0.length;
r9 = r21;
r2 = r26;
if (!(r4 < length3)) {
break;
}
type3 = a0[r4].type;
r25 = r26;
r9 = r21;
r2 = r25;
} while (type3 === "text");
}
}
}
r10 = r15 + a1(r9, a2);
r5 = r2 + 1;
length4 = a0.length;
r19 = r10;
} while (r5 < length4);
}
return r19;
}
},
heading: {
order: 0,
match: blockRegex(/^ *(#{1,6})([^\n]+?)#* *(?:\n *)+\n/),
parse: function parse(a0, a1, a2) {
const r10 = env13716[20];
const r5 = a0[2].trim();
const inline = a2.inline || false;
a2.inline = true;
const content = a1(r5, a2);
a2.inline = inline;
return {
level: a0[1].length,
content
};
},
react: function react(a0, a1, a2) {
const r2 = env13716[11];
const type = "h" + a0.level;
const key = a2.key;
return {
$$typeof: env13716[10],
type,
key: key == null ? void 0 : key,
ref: null,
props: {
children: a1(a0.content, a2)
},
_owner: null
};
},
html: function html(a0, a1, a2) {
return (0, env13716[12])("h" + a0.level, a1(a0.content, a2));
}
},
nptable: {
order: 1,
match: blockRegex(r16),
parse: parse2,
react: null,
html: null
},
lheading: {
order: 2,
match: blockRegex(/^([^\n]+)\n *(=|-){3,} *(?:\n *)+\n/),
parse: function parse(a0, a1, a2) {
const level = a0[2] === "=" ? 1 : 2;
const r12 = env13716[20];
const r7 = a0[1];
const inline = a2.inline || false;
a2.inline = true;
const content = a1(r7, a2);
a2.inline = inline;
return {
type: "heading",
level,
content
};
},
react: null,
html: null
},
hr: {
order: 3,
match: blockRegex(/^( *[-*_]){3,} *(?:\n *)+\n/),
parse: ignoreCapture,
react: function react(a0, a1, a2) {
const r1 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "hr",
key: key == null ? void 0 : key,
ref: null,
props: env13716[13],
_owner: null
};
},
html: function html(a0, a1, a2) {
return "<hr>";
}
},
codeBlock: {
order: 4,
match: blockRegex(/^(?: [^\n]+\n*)+(?:\n *)+\n/),
parse: function parse(a0, a1, a2) {
return {
lang: void 0,
content: a0[0].replace(/^ /gm, "").replace(/\n+$/, "")
};
},
react: function react(a0, a1, a2) {
const className = a0.lang ? "markdown-code-" + a0.lang : void 0;
const r11 = env13716[11];
const key = a2.key;
const props = {
className,
children: a0.content
};
const r15 = env13716[10];
return {
$$typeof: r15,
type: "pre",
key: key == null ? void 0 : key,
ref: null,
props: {
children: {
$$typeof: r15,
type: "code",
key: void 0,
ref: null,
props,
_owner: null
}
},
_owner: null
};
},
html: function html(a0, a1, a2) {
const class2 = a0.lang ? "markdown-code-" + a0.lang : void 0;
const r12 = env13716[12];
const r4 = env13716[17];
return r12("pre", r12("code", String(a0.content).replace(env13716[15], $mk103387()), {
class: class2
}));
}
},
fence: {
order: 5,
match: blockRegex(/^ *(`{3,}|~{3,}) *(?:(\S+) *)?\n([\s\S]+?)\n?\1 *(?:\n *)+\n/),
parse: function parse(a0, a1, a2) {
return {
type: "codeBlock",
lang: a0[2] || void 0,
content: a0[3]
};
},
react: null,
html: null
},
blockQuote: {
order: 6,
match: blockRegex(/^( *>[^\n]+(\n[^\n]+)*\n*)+\n{2,}/),
parse: function parse(a0, a1, a2) {
return {
content: a1(a0[0].replace(/^ *> ?/gm, ""), a2)
};
},
react: function react(a0, a1, a2) {
const r2 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "blockquote",
key: key == null ? void 0 : key,
ref: null,
props: {
children: a1(a0.content, a2)
},
_owner: null
};
},
html: function html(a0, a1, a2) {
return (0, env13716[12])("blockquote", a1(a0.content, a2));
}
},
list: {
order: 7,
match: function match(a0, a1) {
const r9 = env13716[28].exec(a1.prevCapture == null ? "" : a1.prevCapture[0]);
const r10 = a1._list || !a1.inline;
return r9 ? r10 ? env13716[27].exec(r9[1] + a0) : null : null;
},
parse: function parse(a0, c24881_0, c24881_1) {
const r11 = a0[2];
const ordered = r11.length > 1;
const start = ordered ? +r11 : void 0;
const r18 = a0[0].replace(env13716[25], "\n").match(env13716[22]);
let c24881_2 = r18;
let c24881_3 = false;
return {
ordered,
start,
items: r18.map(function(item, index) {
let r42;
const r8 = env13716[21];
const r18 = r8.exec(item);
const r28 = item.replace(new RegExp("^ {1," + (r18 ? r18[0].length : 0) + "}", "gm"), "").replace(r8, "");
const r31 = c24881_2.length - 1;
const r3 = r28.indexOf("\n\n") !== -1 || index === r31 && c24881_3;
c24881_3 = r3;
const { inline, _list } = c24881_1;
c24881_1._list = true;
if (r3) {
c24881_1.inline = false;
r42 = r28.replace(env13716[26], "\n\n");
} else {
c24881_1.inline = true;
r42 = r28.replace(env13716[26], "");
}
const r48 = c24881_0(r42, c24881_1);
c24881_1.inline = inline;
c24881_1._list = _list;
return r48;
})
};
},
react: function react(a0, c24882_0, a2) {
const type = a0.ordered ? "ol" : "ul";
const r11 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type,
key: key == null ? void 0 : key,
ref: null,
props: {
start: a0.start,
children: a0.items.map(function(item, index) {
const r1 = env13716[11];
return {
$$typeof: env13716[10],
type: "li",
key: "" + index,
ref: null,
props: {
children: c24882_0(item, a2)
},
_owner: null
};
})
},
_owner: null
};
},
html: function html(a0, c24883_0, c24883_1) {
return (0, env13716[12])(a0.ordered ? "ol" : "ul", a0.items.map(function(item) {
return (0, env13716[12])("li", c24883_0(item, c24883_1));
}).join(""), {
start: a0.start
});
}
},
def: {
order: 8,
match: blockRegex(/^ *\[([^\]]+)\]: *<?([^\s>]*)>?(?: +["(]([^\n]+)[")])? *\n(?: *\n)*/),
parse: function parse(a0, a1, a2) {
const def = a0[1].replace(/\s+/g, " ").toLowerCase();
const target = a0[2];
const title = a0[3];
if (a2._refs && a2._refs[def]) {
a2._refs[def].forEach(function(item) {
item.target = target;
item.title = title;
});
}
a2._defs = a2._defs || {};
a2._defs[def] = {
target,
title
};
return {
def,
target,
title
};
},
react: function react() {
return null;
},
html: function html() {
return "";
}
},
table: {
order: 9,
match: blockRegex(r79),
parse: parse3,
react: function react(a0, c24885_1, a2) {
const children = a0.header.map(function(item, index) {
const r1 = env13716[11];
const key = "" + index;
return {
$$typeof: env13716[10],
type: "th",
key,
ref: null,
props: {
style: a0.align[index] == null ? {} : {
textAlign: a0.align[index]
},
scope: "col",
children: c24885_1(item, a2)
},
_owner: null
};
});
const children2 = a0.cells.map(function(cell, a1) {
const r0 = env13716[11];
return {
$$typeof: env13716[10],
type: "tr",
key: "" + a1,
ref: null,
props: {
children: cell.map(function(item, index) {
const r1 = env13716[11];
const key = "" + index;
return {
$$typeof: env13716[10],
type: "td",
key,
ref: null,
props: {
style: a0.align[index] == null ? {} : {
textAlign: a0.align[index]
},
children: c24885_1(item, a2)
},
_owner: null
};
})
},
_owner: null
};
});
const r17 = env13716[11];
const key = a2.key;
const props = {
children
};
const r20 = env13716[10];
return {
$$typeof: r20,
type: "table",
key: key == null ? void 0 : key,
ref: null,
props: {
children: [{
$$typeof: r20,
type: "thead",
key: "thead",
ref: null,
props: {
children: {
$$typeof: r20,
type: "tr",
key: void 0,
ref: null,
props,
_owner: null
}
},
_owner: null
}, {
$$typeof: r20,
type: "tbody",
key: "tbody",
ref: null,
props: {
children: children2
},
_owner: null
}]
},
_owner: null
};
},
html: function html(a0, c24886_1, c24886_2) {
const r11 = a0.header.map(function(item, index) {
const r5 = env13716[12];
const r9 = c24886_1(item, c24886_2);
return r5("th", r9, {
style: a0.align[index] == null ? "" : "text-align:" + a0.align[index] + ";",
scope: "col"
});
}).join("");
const r17 = a0.cells.map(function(cell) {
return (0, env13716[12])("tr", cell.map(function(item, index) {
const r5 = env13716[12];
const r9 = c24886_1(item, c24886_2);
return r5("td", r9, {
style: a0.align[index] == null ? "" : "text-align:" + a0.align[index] + ";"
});
}).join(""));
}).join("");
const r19 = env13716[12];
return r19("table", r19("thead", r19("tr", r11)) + r19("tbody", r17));
}
},
newline: {
order: 10,
requiredFirstCharacters: ["\n"],
match: blockRegex(/^(?:\n *)*\n/),
parse: ignoreCapture,
react: function react(a0, a1, a2) {
return "\n";
},
html: function html(a0, a1, a2) {
return "\n";
}
},
paragraph: {
order: 11,
match: blockRegex(/^((?:[^\n]|\n(?! *\n))+)(?:\n *)+\n/),
parse: parseCaptureInline,
react: function react(a0, a1, a2) {
const r2 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "div",
key: key == null ? void 0 : key,
ref: null,
props: {
className: "paragraph",
children: a1(a0.content, a2)
},
_owner: null
};
},
html: function html(a0, a1, a2) {
return (0, env13716[12])("div", a1(a0.content, a2), {
class: "paragraph"
});
}
},
escape: {
order: 12,
requiredFirstCharacters: ["\\"],
match: inlineRegex(/^\\([^0-9A-Za-z\s])/),
parse: function parse(a0, a1, a2) {
return {
type: "text",
content: a0[1]
};
},
react: null,
html: null
},
tableSeparator: {
order: 13,
match: function match(a0, a1) {
return a1.inTable ? /^ *\| */.exec(a0) : null;
},
parse: function parse() {
return {
type: "tableSeparator"
};
},
react: function react() {
return " | ";
},
html: function html() {
return " &vert; ";
}
},
autolink: {
order: 14,
requiredFirstCharacters: ["<"],
match: inlineRegex(/^<([^: >]+:\/[^ >]+)>/),
parse: function parse(a0, a1, a2) {
return {
type: "link",
content: [{
type: "text",
content: a0[1]
}],
target: a0[1]
};
},
react: null,
html: null
},
mailto: {
order: 15,
match: inlineRegex(/^<([^ >]+@[^ >]+)>/),
parse: function parse(a0, a1, a2) {
const content = a0[1];
const r3 = a0[1];
return {
type: "link",
content: [{
type: "text",
content
}],
target: env13716[29].test(r3) ? r3 : "mailto:" + r3
};
},
react: null,
html: null
},
url: {
order: 16,
requiredFirstCharacters: ["h"],
match: inlineRegex(/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/),
parse: function parse(a0, a1, a2) {
return {
type: "link",
content: [{
type: "text",
content: a0[1]
}],
target: a0[1],
title: void 0
};
},
react: null,
html: null
},
link: {
order: 17,
requiredFirstCharacters: ["["],
match: inlineRegex(new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\()]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)")),
parse: function parse(a0, a1, a2) {
const r1 = {
content: a1(a0[1], a2),
target: null,
title: null
};
const r10 = env13716[19];
r1.target = a0[2].replace(env13716[18], "$1");
r1.title = a0[3];
return r1;
},
react: function react(a0, a1, a2) {
const r2 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "a",
key: key == null ? void 0 : key,
ref: null,
props: {
href: (0, env13716[14])(a0.target),
title: a0.title,
children: a1(a0.content, a2)
},
_owner: null
};
},
html: function html(a0, a1, a2) {
const r4 = {
href: (0, env13716[14])(a0.target),
title: a0.title
};
return (0, env13716[12])("a", a1(a0.content, a2), r4);
}
},
image: {
order: 18,
match: inlineRegex(new RegExp("^!\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\()]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)")),
parse: function parse(a0, a1, a2) {
const r8 = env13716[19];
return {
alt: a0[1],
target: a0[2].replace(env13716[18], "$1"),
title: a0[3]
};
},
react: function react(a0, a1, a2) {
const r2 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "img",
key: key == null ? void 0 : key,
ref: null,
props: {
src: (0, env13716[14])(a0.target),
alt: a0.alt,
title: a0.title
},
_owner: null
};
},
html: function html(a0, a1, a2) {
return (0, env13716[12])("img", "", {
src: (0, env13716[14])(a0.target),
alt: a0.alt,
title: a0.title
}, false);
}
},
reflink: {
order: 19,
match: inlineRegex(new RegExp("^\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\s*\\[([^\\]]*)\\]")),
parse: function parse(a0, a1, a2) {
const r4 = env13716[30];
const r10 = {
type: "link",
content: a1(a0[1], a2)
};
const r18 = (a0[2] || a0[1]).replace(/\s+/g, " ").toLowerCase();
if (a2._defs && a2._defs[r18]) {
const r23 = a2._defs[r18];
r10.target = r23.target;
r10.title = r23.title;
}
a2._refs = a2._refs || {};
a2._refs[r18] = a2._refs[r18] || [];
a2._refs[r18].push(r10);
return r10;
},
react: null,
html: null
},
refimage: {
order: 20,
match: inlineRegex(new RegExp("^!\\[((?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*)\\]\\s*\\[([^\\]]*)\\]")),
parse: function parse(a0, a1, a2) {
const r2 = env13716[30];
const r8 = {
type: "image",
alt: a0[1]
};
const r15 = (a0[2] || a0[1]).replace(/\s+/g, " ").toLowerCase();
if (a2._defs && a2._defs[r15]) {
const r20 = a2._defs[r15];
r8.target = r20.target;
r8.title = r20.title;
}
a2._refs = a2._refs || {};
a2._refs[r15] = a2._refs[r15] || [];
a2._refs[r15].push(r8);
return r8;
},
react: null,
html: null
},
em: null,
strong: null,
u: null,
del: null,
inlineCode: null,
br: null,
text: null
};
const r228 = RegExp;
const r229 = "^\\b_((?:__|\\\\[\\s\\S]|[^\\\\_])+?)_\\b";
const preprocess = function preprocess(a0) {
return a0.replace(env13716[7], "\n").replace(env13716[9], "").replace(env13716[8], " ");
};
const parserFor = function parserFor(a0, c24876_1) {
let c24876_2, c24876_3, c24876_4, c24876_5, c24876_6, nestedParse2;
let c24876_0 = a0;
const r18 = Object.keys(a0).filter(function(item) {
const r8 = c24876_0[item];
if (r8 != null && r8.match != null) {
const order = r8.order;
if (!((typeof order === "number" ? isFinite(order) : typeof order === "number") || typeof globalThis.console === "undefined")) {
console.warn("simple-markdown: Invalid order for rule `" + item + "`: " + String(order));
}
return true;
}
return false;
});
c24876_2 = r18;
r18.sort(function(a, b) {
const r11 = c24876_0[a];
const r10 = c24876_0[b];
const order = r11.order;
const order2 = r10.order;
if (order !== order2) {
return order - order2;
}
const r2 = r11.quality ? 0 : 1;
const r3 = r10.quality ? 0 : 1;
return r2 !== r3 ? r2 - r3 : a < b ? -1 : a > b ? 1 : 0;
});
c24876_4 = new Map();
const r26 = [];
c24876_5 = r26;
const length = r18.length;
let r0 = 0;
if (0 < length) {
do {
const r28 = r18[r0];
c24876_6 = r28;
const requiredFirstCharacters = a0[r28].requiredFirstCharacters;
const r1 = r0;
if (requiredFirstCharacters == null) {
r26.push(r28);
} else {
requiredFirstCharacters.map((requiredFirstCharacter) => {
const r5 = requiredFirstCharacter.charCodeAt(0);
if (!c24876_4.has(r5)) {
c24876_4.set(r5, []);
}
c24876_4.get(r5).push(c24876_6);
});
}
r0 = r1 + 1;
} while (r0 < r18.length);
}
nestedParse2 = function nestedParse(a0, a1) {
let length, length2;
const r19 = a1 ? a1 : c24876_3;
c24876_3 = r19;
let _parseDepth = r19._parseDepth;
if (_parseDepth == null) {
_parseDepth = 0;
}
const r11 = [];
const _parseDepth2 = _parseDepth + 1;
if (_parseDepth2 > 1000) {
if (a0) {
r11.push({
type: "text",
content: a0
});
}
return r11;
}
const r62 = {
...r19,
_parseDepth: _parseDepth2
};
c24876_3 = r62;
let r65 = a0;
if (a0) {
while (true) {
const r28 = [c24876_4.get(r65.charCodeAt(0)), c24876_5];
const r8 = 0 < r28.length;
const r72 = r65;
let r4 = 0;
let r27 = 100000;
let r26 = -100000;
let r25 = null;
let r24 = null;
let r22 = null;
let prevCapture = null;
let r23 = null;
let type = null;
if (r8) {
do {
const r39 = r28[r4];
const r5 = r4;
const r43 = r27;
const r42 = r26;
const r41 = r25;
const r40 = r24;
const r21 = r22;
let r33 = r43;
let r32 = r42;
let r31 = r41;
let r30 = r40;
let r29 = r21;
if (r39 != null) {
const r75 = 0 < r39.length;
let r0 = 0;
let r38 = r43;
let r37 = r42;
let r36 = r41;
let r35 = r40;
let r76 = r21;
r33 = r38;
r32 = r37;
r31 = r36;
r30 = r35;
r29 = r76;
if (r75) {
do {
const r77 = r39[r0];
const r45 = c24876_0[r77];
const order = r45.order;
const r1 = r0;
const r53 = r38;
const r52 = r37;
const r51 = r36;
const r50 = r35;
const r49 = r76;
r32 = r52;
r31 = r51;
r30 = r50;
r29 = r49;
r33 = r53;
if (order > r33) {
break;
}
const r81 = r62.prevCapture == null ? "" : r62.prevCapture[0];
const r46 = r45.match(r72, r62, r81);
let r44 = r53;
let r84 = r52;
let r85 = r51;
let r86 = r50;
let r87 = r49;
if (r46) {
const r47 = r45.quality ? r45.quality(r46, r62, r81) : 0;
const r89 = order < r53 || r47 > r52;
r44 = r53;
r84 = r52;
r85 = r51;
r86 = r50;
r87 = r49;
if (r89) {
r44 = order;
r84 = r47;
r85 = r46;
r86 = r45;
r87 = r77;
}
}
r0 = r1 + 1;
length = r39.length;
r38 = r44;
r37 = r84;
r36 = r85;
r35 = r86;
r76 = r87;
r33 = r38;
r32 = r37;
r31 = r36;
r30 = r35;
r29 = r76;
} while (r0 < length);
}
}
r4 = r5 + 1;
length2 = r28.length;
r27 = r33;
r26 = r32;
r25 = r31;
r24 = r30;
r22 = r29;
prevCapture = r25;
r23 = r24;
type = r22;
} while (r4 < length2);
}
if (r23 != null && prevCapture != null) {
if (prevCapture.index) {
throw new Error("`match` must return a capture starting at index 0 (the current parse index). Did you forget a ^ at the start of the RegExp?");
}
const r95 = r23.parse(prevCapture, nestedParse2, r62);
if (Array.isArray(r95)) {
Array.prototype.push.apply(r11, r95);
} else {
if (r95.type == null) {
r95.type = type;
}
r11.push(r95);
}
r62.prevCapture = prevCapture;
r65 = r72.substring(r62.prevCapture[0].length);
if (r65) {
continue;
}
break;
}
const r115 = Error;
throw new r115("Could not find a matching rule for the below content. The rule with highest `order` should always match content provided to it. Check the definition of `match` for '" + c24876_2[c24876_2.length - 1] + "'. It seems to not match the following source:\n" + r72);
}
}
return r11;
};
const outerParse = function outerParse(a0, a1) {
let r4 = a1;
if (!a1) {
r4 = {};
}
if (c24876_1 != null) {
for (const key in c24876_1) {
if (Object.prototype.hasOwnProperty.call(c24876_1, key)) {
r4[key] = c24876_1[key];
}
}
}
c24876_3 = r4;
const r20 = r4.inline || c24876_3.disableAutoBlockNewlines ? a0 : a0 + "\n\n";
c24876_3.prevCapture = null;
return nestedParse2(r20.replace(env13716[7], "\n").replace(env13716[9], "").replace(env13716[8], " "), c24876_3);
};
nestedParse2.rules = a0;
outerParse.rules = a0;
return outerParse;
};
const anyScopeRegex = function anyScopeRegex(a0) {
let c24879_0 = a0;
const match2 = function match(a0, a1) {
return c24879_0.exec(a0);
};
match2.regex = a0;
return match2;
};
defaultRules.em = {
order: 21,
match: inlineRegex(new r228(r229 + "|^\\*(?=\\S)((?:\\*\\*|\\\\[\\s\\S]|\\s+(?:\\\\[\\s\\S]|[^\\s\\*\\\\]|\\*\\*)|[^\\s\\*\\\\])+?)\\*(?!\\*)")),
quality: function quality(a0) {
return a0[0].length + 0.2;
},
parse: function parse(a0, a1, a2) {
return {
content: a1(a0[2] || a0[1], a2)
};
},
react: function react(a0, a1, a2) {
const r2 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "em",
key: key == null ? void 0 : key,
ref: null,
props: {
children: a1(a0.content, a2)
},
_owner: null
};
},
html: function html(a0, a1, a2) {
return (0, env13716[12])("em", a1(a0.content, a2));
}
};
defaultRules.strong = {
order: 21,
requiredFirstCharacters: ["*"],
match: inlineRegex(/^\*\*((?:\\[\s\S]|[^\\])+?)\*\*(?!\*)/),
quality: function quality(a0) {
return a0[0].length + 0.1;
},
parse: parseCaptureInline,
react: function react(a0, a1, a2) {
const r2 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "strong",
key: key == null ? void 0 : key,
ref: null,
props: {
children: a1(a0.content, a2)
},
_owner: null
};
},
html: function html(a0, a1, a2) {
return (0, env13716[12])("strong", a1(a0.content, a2));
}
};
defaultRules.u = {
order: 21,
requiredFirstCharacters: ["_"],
match: inlineRegex(/^__((?:\\[\s\S]|[^\\])+?)__(?!_)/),
quality: function quality(a0) {
return a0[0].length;
},
parse: parseCaptureInline,
react: function react(a0, a1, a2) {
const r2 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "u",
key: key == null ? void 0 : key,
ref: null,
props: {
children: a1(a0.content, a2)
},
_owner: null
};
},
html: function html(a0, a1, a2) {
return (0, env13716[12])("u", a1(a0.content, a2));
}
};
defaultRules.del = {
order: 22,
requiredFirstCharacters: ["~"],
match: inlineRegex(/^~~(?=\S)((?:\\[\s\S]|~(?!~)|[^\s~]|\s(?!~~))+?)~~/),
parse: parseCaptureInline,
react: function react(a0, a1, a2) {
const r2 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "del",
key: key == null ? void 0 : key,
ref: null,
props: {
children: a1(a0.content, a2)
},
_owner: null
};
},
html: function html(a0, a1, a2) {
return (0, env13716[12])("del", a1(a0.content, a2));
}
};
defaultRules.inlineCode = {
order: 23,
requiredFirstCharacters: ["`"],
match: inlineRegex(/^(`+)([\s\S]*?[^`])\1(?!`)/),
parse: function parse(a0, a1, a2) {
return {
content: a0[2].replace(env13716[24], "$1")
};
},
react: function react(a0, a1, a2) {
const r1 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "code",
key: key == null ? void 0 : key,
ref: null,
props: {
children: a0.content
},
_owner: null
};
},
html: function html(a0, a1, a2) {
const r3 = env13716[12];
const r2 = env13716[17];
return r3("code", String(a0.content).replace(env13716[15], $mk103387()));
}
};
defaultRules.br = {
order: 24,
requiredFirstCharacters: [" "],
match: anyScopeRegex(/^ {2,}\n/),
parse: ignoreCapture,
react: function react(a0, a1, a2) {
const r1 = env13716[11];
const key = a2.key;
return {
$$typeof: env13716[10],
type: "br",
key: key == null ? void 0 : key,
ref: null,
props: env13716[13],
_owner: null
};
},
html: function html(a0, a1, a2) {
return "<br>";
}
};
defaultRules.text = {
order: 25,
match: anyScopeRegex(/^[\s\S]+?(?=[^0-9A-Za-z\s\u00c0-\uffff]|\n\n| {2,}\n|\w+:\S|$)/),
parse: function parse(a0, a1, a2) {
return {
content: a0[0]
};
},
react: function react(a0, a1, a2) {
return a0.content;
},
html: function html(a0, a1, a2) {
const r2 = env13716[17];
return String(a0.content).replace(env13716[15], $mk103387());
}
};
env13716[31] = defaultRules;
const outputFor = function outputFor(a0, a1, c24887_2) {
let c24887_3, c24887_4, nestedOutput2;
let c24887_0 = a0;
let c24887_1 = a1;
if (a1) {
const r14 = (a0.Array || env13716[31].Array)[a1];
if (r14) {
c24887_4 = r14;
nestedOutput2 = function nestedOutput(a0, a1) {
const r5 = a1 ? a1 : c24887_3;
c24887_3 = r5;
return Array.isArray(a0) ? c24887_4(a0, nestedOutput2, r5) : c24887_0[a0.type][c24887_1](a0, nestedOutput2, r5);
};
return function(a0, a1) {
let r7 = a1;
if (!a1) {
r7 = {};
}
if (c24887_2 != null) {
for (const key in c24887_2) {
if (Object.prototype.hasOwnProperty.call(c24887_2, key)) {
r7[key] = c24887_2[key];
}
}
}
c24887_3 = r7;
c24887_3 = r7;
return Array.isArray(a0) ? c24887_4(a0, nestedOutput2, r7) : c24887_0[a0.type][c24887_1](a0, nestedOutput2, r7);
};
}
throw new Error("simple-markdown: outputFor: to join nodes of type `" + a1 + "` you must provide an `Array:` joiner rule with that type, Please see the docs for details on specifying an Array rule.");
}
throw new Error("simple-markdown: outputFor: `property` must be defined. if you just upgraded, you probably need to replace `outputFor` with `reactFor`");
};
const defaultRawParse = parserFor(defaultRules);
env13716[32] = defaultRawParse;
const defaultBlockParse = function defaultBlockParse(a0, a1) {
const r3 = a1 ? a1 : {};
r3.inline = false;
return (0, env13716[32])(a0, r3);
};
env13716[33] = defaultBlockParse;
const defaultImplicitParse = function defaultImplicitParse(a0, a1) {
let r2 = a1;
const r6 = env13716[23].test(a0);
if (!a1) {
r2 = {};
}
r2.inline = !r6;
return (0, env13716[32])(a0, r2);
};
env13716[34] = defaultImplicitParse;
const defaultReactOutput = outputFor(defaultRules, "react");
env13716[35] = defaultReactOutput;
const defaultHtmlOutput = outputFor(defaultRules, "html");
env13716[36] = defaultHtmlOutput;
const markdownToReact = function markdownToReact(a0, a1) {
const r3 = env13716[35];
const r5 = a1 ? a1 : {};
r5.inline = false;
return r3((0, env13716[32])(a0, r5), a1);
};
env13716[37] = markdownToReact;
return {
defaultRules,
parserFor,
outputFor,
inlineRegex,
blockRegex,
anyScopeRegex,
parseInline,
parseBlock: function parseBlock(a0, a1, a2) {
const inline = a2.inline || false;
a2.inline = false;
const r8 = a0(a1 + "\n\n", a2);
a2.inline = inline;
return r8;
},
markdownToReact,
markdownToHtml: function markdownToHtml(a0, a1) {
const r3 = env13716[36];
const r5 = a1 ? a1 : {};
r5.inline = false;
return r3((0, env13716[32])(a0, r5), a1);
},
ReactMarkdown: function ReactMarkdown(a0) {
const props = {};
for (const key in a0) {
if (key !== "source" && Object.prototype.hasOwnProperty.call(a0, key)) {
props[key] = a0[key];
}
}
const r21 = env13716[37];
props.children = env13716[35]((0, env13716[32])(a0.source, {
inline: false
}), void 0);
return {
$$typeof: env13716[10],
type: "div",
key: void 0,
ref: null,
props,
_owner: null
};
},
defaultBlockParse,
defaultInlineParse: function defaultInlineParse(a0, a1) {
const r3 = a1 ? a1 : {};
r3.inline = true;
return (0, env13716[32])(a0, r3);
},
defaultImplicitParse,
defaultReactOutput,
defaultHtmlOutput,
preprocess,
sanitizeText,
sanitizeUrl,
unescapeUrl,
htmlTag,
reactElement,
defaultRawParse,
ruleOutput: function ruleOutput(c24888_0, a1) {
let r5 = a1;
let c24888_1 = a1;
if (!a1) {
r5 = typeof globalThis.console === "undefined";
}
if (!r5) {
console.warn("simple-markdown ruleOutput should take 'react' or 'html' as the second argument.");
}
return function(a0, a1, a2) {
return c24888_0[a0.type][c24888_1](a0, a1, a2);
};
},
reactFor: function reactFor(c24889_0) {
const nestedOutput3 = function nestedOutput(a0, a1) {
let r28, length2;
const r8 = a1 ? a1 : {};
if (Array.isArray(a0)) {
const key = r8.key;
const r21 = [];
const length = a0.length;
let r0 = 0;
const r5 = 0 < length;
let r10 = null;
if (r5) {
do {
r8.key = "" + r0;
const r14 = nestedOutput3(a0[r0], r8);
const r2 = r0;
const r25 = r10;
if (typeof r14 === "string" && typeof r25 === "string") {
const r29 = r25 + r14;
r21[r21.length - 1] = r29;
r28 = r29;
} else {
r21.push(r14);
r28 = r14;
}
r0 = r2 + 1;
length2 = a0.length;
r10 = r28;
} while (r0 < length2);
}
r8.key = key;
return r21;
}
return c24889_0(a0, nestedOutput3, r8);
};
return nestedOutput3;
},
htmlFor: function htmlFor(a0) {
let env24890 = {};
env24890[0] = a0;
const nestedOutput4 = function nestedOutput(a0, a1) {
let env29239;
const r2 = env29239 = {
$parent: env24890
};
let r5 = a1;
env29239[0] = a1;
if (!a1) {
r5 = {};
}
env29239[0] = r5;
return Array.isArray(a0) ? a0.map($mk114419(r2)).join("") : (0, env24890[0])(a0, env24890[1], r5);
};
env24890[1] = nestedOutput4;
return nestedOutput4;
},
defaultParse: function defaultParse() {
if (typeof globalThis.console !== "undefined") {
console.warn("defaultParse is deprecated, please use `defaultImplicitParse`");
}
return env13716[34].apply(null, arguments);
},
defaultOutput: function defaultOutput() {
if (typeof globalThis.console !== "undefined") {
console.warn("defaultOutput is deprecated, please use `defaultReactOutput`");
}
return env13716[35].apply(null, arguments);
}
};
};
if (typeof exports === "object" && module !== void 0) {
module.exports = t();
} else if (typeof globalThis.define === "function" && define.amd) {
define(t);
} else {
this.SimpleMarkdown = t();
}