@dotss/tictoccroc 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +143 -122
- package/dist/parent/b2b/components/ActionButtons/ActionButtons.d.ts +13 -0
- package/dist/parent/b2b/components/ActionButtons/ActionButtons.mjs +30 -0
- package/dist/parent/b2b/components/ActionButtons/index.d.ts +3 -0
- package/dist/parent/b2b/components/ActionButtons/index.mjs +4 -0
- package/dist/parent/b2b/components/BottomNotes/BottomNotes.d.ts +6 -0
- package/dist/parent/b2b/components/BottomNotes/BottomNotes.mjs +37 -0
- package/dist/parent/b2b/components/BottomNotes/index.d.ts +3 -0
- package/dist/parent/b2b/components/BottomNotes/index.mjs +4 -0
- package/dist/parent/b2b/components/EmployeeNumberField/EmployeeNumberField.d.ts +4 -0
- package/dist/parent/b2b/components/EmployeeNumberField/EmployeeNumberField.mjs +16 -0
- package/dist/parent/b2b/components/EmployeeNumberField/index.d.ts +3 -0
- package/dist/parent/b2b/components/EmployeeNumberField/index.mjs +4 -0
- package/dist/parent/b2b/components/NameField/NameField.d.ts +4 -0
- package/dist/parent/b2b/components/NameField/NameField.mjs +8 -0
- package/dist/parent/b2b/components/NameField/index.d.ts +3 -0
- package/dist/parent/b2b/components/NameField/index.mjs +4 -0
- package/dist/parent/b2b/components/PhoneNumberField/PhoneNumberField.d.ts +4 -0
- package/dist/parent/b2b/components/PhoneNumberField/PhoneNumberField.mjs +31 -0
- package/dist/parent/b2b/components/PhoneNumberField/PhoneNumberField.utils.d.ts +2 -0
- package/dist/parent/b2b/components/PhoneNumberField/PhoneNumberField.utils.mjs +10 -0
- package/dist/parent/b2b/components/PhoneNumberField/index.d.ts +4 -0
- package/dist/parent/b2b/components/PhoneNumberField/index.mjs +7 -0
- package/dist/parent/b2b/components/Title/Title.d.ts +4 -0
- package/dist/parent/b2b/components/Title/Title.mjs +19 -0
- package/dist/parent/b2b/components/Title/index.d.ts +3 -0
- package/dist/parent/b2b/components/Title/index.mjs +4 -0
- package/dist/parent/b2b/components/TopLogo/TopLogo.d.ts +11 -0
- package/dist/parent/b2b/components/TopLogo/TopLogo.mjs +94 -0
- package/dist/parent/b2b/components/TopLogo/index.d.ts +3 -0
- package/dist/parent/b2b/components/TopLogo/index.mjs +4 -0
- package/dist/parent/b2b/components/index.d.ts +14 -0
- package/dist/parent/b2b/components/index.mjs +19 -0
- package/dist/parent/b2b/utils/convertMdToHtml/convertMdToHtml.d.ts +1 -0
- package/dist/parent/b2b/utils/convertMdToHtml/convertMdToHtml.mjs +1692 -0
- package/dist/parent/b2b/utils/convertMdToHtml/convertMdToHtml.test.d.ts +1 -0
- package/dist/parent/b2b/utils/index.d.ts +1 -0
- package/dist/parent/b2b/utils/index.mjs +4 -0
- package/dist/shared/components/TextField/TextField.d.ts +14 -0
- package/dist/shared/components/TextField/TextField.mjs +56 -0
- package/dist/shared/components/TextField/index.d.ts +3 -0
- package/dist/shared/components/TextField/index.mjs +4 -0
- package/dist/shared/components/index.d.ts +2 -0
- package/dist/shared/components/index.mjs +8 -6
- package/dist/teacher/home/components/BannerAccount/BannerAccount.mjs +6 -7
- package/package.json +21 -3
|
@@ -0,0 +1,1692 @@
|
|
|
1
|
+
var Hn = Object.defineProperty;
|
|
2
|
+
var Gn = (n, e, t) => e in n ? Hn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var _ = (n, e, t) => Gn(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
|
|
5
|
+
const {
|
|
6
|
+
entries: hn,
|
|
7
|
+
setPrototypeOf: Vt,
|
|
8
|
+
isFrozen: Wn,
|
|
9
|
+
getPrototypeOf: qn,
|
|
10
|
+
getOwnPropertyDescriptor: Zn
|
|
11
|
+
} = Object;
|
|
12
|
+
let {
|
|
13
|
+
freeze: z,
|
|
14
|
+
seal: F,
|
|
15
|
+
create: ht
|
|
16
|
+
} = Object, {
|
|
17
|
+
apply: ft,
|
|
18
|
+
construct: gt
|
|
19
|
+
} = typeof Reflect < "u" && Reflect;
|
|
20
|
+
z || (z = function(e) {
|
|
21
|
+
return e;
|
|
22
|
+
});
|
|
23
|
+
F || (F = function(e) {
|
|
24
|
+
return e;
|
|
25
|
+
});
|
|
26
|
+
ft || (ft = function(e, t) {
|
|
27
|
+
for (var r = arguments.length, s = new Array(r > 2 ? r - 2 : 0), a = 2; a < r; a++)
|
|
28
|
+
s[a - 2] = arguments[a];
|
|
29
|
+
return e.apply(t, s);
|
|
30
|
+
});
|
|
31
|
+
gt || (gt = function(e) {
|
|
32
|
+
for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++)
|
|
33
|
+
r[s - 1] = arguments[s];
|
|
34
|
+
return new e(...r);
|
|
35
|
+
});
|
|
36
|
+
const Me = $(Array.prototype.forEach), Yn = $(Array.prototype.lastIndexOf), Kt = $(Array.prototype.pop), xe = $(Array.prototype.push), jn = $(Array.prototype.splice), Ue = $(String.prototype.toLowerCase), lt = $(String.prototype.toString), at = $(String.prototype.match), Te = $(String.prototype.replace), Xn = $(String.prototype.indexOf), Qn = $(String.prototype.trim), B = $(Object.prototype.hasOwnProperty), M = $(RegExp.prototype.test), we = Vn(TypeError);
|
|
37
|
+
function $(n) {
|
|
38
|
+
return function(e) {
|
|
39
|
+
e instanceof RegExp && (e.lastIndex = 0);
|
|
40
|
+
for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++)
|
|
41
|
+
r[s - 1] = arguments[s];
|
|
42
|
+
return ft(n, e, r);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function Vn(n) {
|
|
46
|
+
return function() {
|
|
47
|
+
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
48
|
+
t[r] = arguments[r];
|
|
49
|
+
return gt(n, t);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function b(n, e) {
|
|
53
|
+
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ue;
|
|
54
|
+
Vt && Vt(n, null);
|
|
55
|
+
let r = e.length;
|
|
56
|
+
for (; r--; ) {
|
|
57
|
+
let s = e[r];
|
|
58
|
+
if (typeof s == "string") {
|
|
59
|
+
const a = t(s);
|
|
60
|
+
a !== s && (Wn(e) || (e[r] = a), s = a);
|
|
61
|
+
}
|
|
62
|
+
n[s] = !0;
|
|
63
|
+
}
|
|
64
|
+
return n;
|
|
65
|
+
}
|
|
66
|
+
function Kn(n) {
|
|
67
|
+
for (let e = 0; e < n.length; e++)
|
|
68
|
+
B(n, e) || (n[e] = null);
|
|
69
|
+
return n;
|
|
70
|
+
}
|
|
71
|
+
function Z(n) {
|
|
72
|
+
const e = ht(null);
|
|
73
|
+
for (const [t, r] of hn(n))
|
|
74
|
+
B(n, t) && (Array.isArray(r) ? e[t] = Kn(r) : r && typeof r == "object" && r.constructor === Object ? e[t] = Z(r) : e[t] = r);
|
|
75
|
+
return e;
|
|
76
|
+
}
|
|
77
|
+
function Ae(n, e) {
|
|
78
|
+
for (; n !== null; ) {
|
|
79
|
+
const r = Zn(n, e);
|
|
80
|
+
if (r) {
|
|
81
|
+
if (r.get)
|
|
82
|
+
return $(r.get);
|
|
83
|
+
if (typeof r.value == "function")
|
|
84
|
+
return $(r.value);
|
|
85
|
+
}
|
|
86
|
+
n = qn(n);
|
|
87
|
+
}
|
|
88
|
+
function t() {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return t;
|
|
92
|
+
}
|
|
93
|
+
const Jt = z(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), ot = z(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), ct = z(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Jn = z(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), ut = z(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), er = z(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), en = z(["#text"]), tn = z(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), pt = z(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), nn = z(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), ve = z(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), tr = F(/\{\{[\w\W]*|[\w\W]*\}\}/gm), nr = F(/<%[\w\W]*|[\w\W]*%>/gm), rr = F(/\$\{[\w\W]*/gm), sr = F(/^data-[\-\w.\u00B7-\uFFFF]+$/), ir = F(/^aria-[\-\w]+$/), fn = F(
|
|
94
|
+
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
95
|
+
// eslint-disable-line no-useless-escape
|
|
96
|
+
), lr = F(/^(?:\w+script|data):/i), ar = F(
|
|
97
|
+
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
98
|
+
// eslint-disable-line no-control-regex
|
|
99
|
+
), gn = F(/^html$/i), or = F(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
100
|
+
var rn = /* @__PURE__ */ Object.freeze({
|
|
101
|
+
__proto__: null,
|
|
102
|
+
ARIA_ATTR: ir,
|
|
103
|
+
ATTR_WHITESPACE: ar,
|
|
104
|
+
CUSTOM_ELEMENT: or,
|
|
105
|
+
DATA_ATTR: sr,
|
|
106
|
+
DOCTYPE_NAME: gn,
|
|
107
|
+
ERB_EXPR: nr,
|
|
108
|
+
IS_ALLOWED_URI: fn,
|
|
109
|
+
IS_SCRIPT_OR_DATA: lr,
|
|
110
|
+
MUSTACHE_EXPR: tr,
|
|
111
|
+
TMPLIT_EXPR: rr
|
|
112
|
+
});
|
|
113
|
+
const _e = {
|
|
114
|
+
element: 1,
|
|
115
|
+
text: 3,
|
|
116
|
+
// Deprecated
|
|
117
|
+
progressingInstruction: 7,
|
|
118
|
+
comment: 8,
|
|
119
|
+
document: 9
|
|
120
|
+
}, cr = function() {
|
|
121
|
+
return typeof window > "u" ? null : window;
|
|
122
|
+
}, ur = function(e, t) {
|
|
123
|
+
if (typeof e != "object" || typeof e.createPolicy != "function")
|
|
124
|
+
return null;
|
|
125
|
+
let r = null;
|
|
126
|
+
const s = "data-tt-policy-suffix";
|
|
127
|
+
t && t.hasAttribute(s) && (r = t.getAttribute(s));
|
|
128
|
+
const a = "dompurify" + (r ? "#" + r : "");
|
|
129
|
+
try {
|
|
130
|
+
return e.createPolicy(a, {
|
|
131
|
+
createHTML(o) {
|
|
132
|
+
return o;
|
|
133
|
+
},
|
|
134
|
+
createScriptURL(o) {
|
|
135
|
+
return o;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
} catch {
|
|
139
|
+
return console.warn("TrustedTypes policy " + a + " could not be created."), null;
|
|
140
|
+
}
|
|
141
|
+
}, sn = function() {
|
|
142
|
+
return {
|
|
143
|
+
afterSanitizeAttributes: [],
|
|
144
|
+
afterSanitizeElements: [],
|
|
145
|
+
afterSanitizeShadowDOM: [],
|
|
146
|
+
beforeSanitizeAttributes: [],
|
|
147
|
+
beforeSanitizeElements: [],
|
|
148
|
+
beforeSanitizeShadowDOM: [],
|
|
149
|
+
uponSanitizeAttribute: [],
|
|
150
|
+
uponSanitizeElement: [],
|
|
151
|
+
uponSanitizeShadowNode: []
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
function dn() {
|
|
155
|
+
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : cr();
|
|
156
|
+
const e = (d) => dn(d);
|
|
157
|
+
if (e.version = "3.3.1", e.removed = [], !n || !n.document || n.document.nodeType !== _e.document || !n.Element)
|
|
158
|
+
return e.isSupported = !1, e;
|
|
159
|
+
let {
|
|
160
|
+
document: t
|
|
161
|
+
} = n;
|
|
162
|
+
const r = t, s = r.currentScript, {
|
|
163
|
+
DocumentFragment: a,
|
|
164
|
+
HTMLTemplateElement: o,
|
|
165
|
+
Node: l,
|
|
166
|
+
Element: h,
|
|
167
|
+
NodeFilter: c,
|
|
168
|
+
NamedNodeMap: f = n.NamedNodeMap || n.MozNamedAttrMap,
|
|
169
|
+
HTMLFormElement: k,
|
|
170
|
+
DOMParser: m,
|
|
171
|
+
trustedTypes: p
|
|
172
|
+
} = n, w = h.prototype, x = Ae(w, "cloneNode"), S = Ae(w, "remove"), V = Ae(w, "nextSibling"), le = Ae(w, "childNodes"), K = Ae(w, "parentNode");
|
|
173
|
+
if (typeof o == "function") {
|
|
174
|
+
const d = t.createElement("template");
|
|
175
|
+
d.content && d.content.ownerDocument && (t = d.content.ownerDocument);
|
|
176
|
+
}
|
|
177
|
+
let I, J = "";
|
|
178
|
+
const {
|
|
179
|
+
implementation: ge,
|
|
180
|
+
createNodeIterator: de,
|
|
181
|
+
createDocumentFragment: ee,
|
|
182
|
+
getElementsByTagName: Ln
|
|
183
|
+
} = t, {
|
|
184
|
+
importNode: In
|
|
185
|
+
} = r;
|
|
186
|
+
let P = sn();
|
|
187
|
+
e.isSupported = typeof hn == "function" && typeof K == "function" && ge && ge.createHTMLDocument !== void 0;
|
|
188
|
+
const {
|
|
189
|
+
MUSTACHE_EXPR: qe,
|
|
190
|
+
ERB_EXPR: Ze,
|
|
191
|
+
TMPLIT_EXPR: Ye,
|
|
192
|
+
DATA_ATTR: Dn,
|
|
193
|
+
ARIA_ATTR: Cn,
|
|
194
|
+
IS_SCRIPT_OR_DATA: On,
|
|
195
|
+
ATTR_WHITESPACE: yt,
|
|
196
|
+
CUSTOM_ELEMENT: Nn
|
|
197
|
+
} = rn;
|
|
198
|
+
let {
|
|
199
|
+
IS_ALLOWED_URI: Lt
|
|
200
|
+
} = rn, D = null;
|
|
201
|
+
const It = b({}, [...Jt, ...ot, ...ct, ...ut, ...en]);
|
|
202
|
+
let C = null;
|
|
203
|
+
const Dt = b({}, [...tn, ...pt, ...nn, ...ve]);
|
|
204
|
+
let R = Object.seal(ht(null, {
|
|
205
|
+
tagNameCheck: {
|
|
206
|
+
writable: !0,
|
|
207
|
+
configurable: !1,
|
|
208
|
+
enumerable: !0,
|
|
209
|
+
value: null
|
|
210
|
+
},
|
|
211
|
+
attributeNameCheck: {
|
|
212
|
+
writable: !0,
|
|
213
|
+
configurable: !1,
|
|
214
|
+
enumerable: !0,
|
|
215
|
+
value: null
|
|
216
|
+
},
|
|
217
|
+
allowCustomizedBuiltInElements: {
|
|
218
|
+
writable: !0,
|
|
219
|
+
configurable: !1,
|
|
220
|
+
enumerable: !0,
|
|
221
|
+
value: !1
|
|
222
|
+
}
|
|
223
|
+
})), me = null, je = null;
|
|
224
|
+
const ae = Object.seal(ht(null, {
|
|
225
|
+
tagCheck: {
|
|
226
|
+
writable: !0,
|
|
227
|
+
configurable: !1,
|
|
228
|
+
enumerable: !0,
|
|
229
|
+
value: null
|
|
230
|
+
},
|
|
231
|
+
attributeCheck: {
|
|
232
|
+
writable: !0,
|
|
233
|
+
configurable: !1,
|
|
234
|
+
enumerable: !0,
|
|
235
|
+
value: null
|
|
236
|
+
}
|
|
237
|
+
}));
|
|
238
|
+
let Ct = !0, Xe = !0, Ot = !1, Nt = !0, oe = !1, Le = !0, te = !1, Qe = !1, Ve = !1, ce = !1, Ie = !1, De = !1, Pt = !0, Mt = !1;
|
|
239
|
+
const Pn = "user-content-";
|
|
240
|
+
let Ke = !0, ke = !1, ue = {}, W = null;
|
|
241
|
+
const Je = b({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
242
|
+
let vt = null;
|
|
243
|
+
const zt = b({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
244
|
+
let et = null;
|
|
245
|
+
const $t = b({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Ce = "http://www.w3.org/1998/Math/MathML", Oe = "http://www.w3.org/2000/svg", j = "http://www.w3.org/1999/xhtml";
|
|
246
|
+
let pe = j, tt = !1, nt = null;
|
|
247
|
+
const Mn = b({}, [Ce, Oe, j], lt);
|
|
248
|
+
let Ne = b({}, ["mi", "mo", "mn", "ms", "mtext"]), Pe = b({}, ["annotation-xml"]);
|
|
249
|
+
const vn = b({}, ["title", "style", "font", "a", "script"]);
|
|
250
|
+
let be = null;
|
|
251
|
+
const zn = ["application/xhtml+xml", "text/html"], $n = "text/html";
|
|
252
|
+
let L = null, he = null;
|
|
253
|
+
const Un = t.createElement("form"), Ut = function(i) {
|
|
254
|
+
return i instanceof RegExp || i instanceof Function;
|
|
255
|
+
}, rt = function() {
|
|
256
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
257
|
+
if (!(he && he === i)) {
|
|
258
|
+
if ((!i || typeof i != "object") && (i = {}), i = Z(i), be = // eslint-disable-next-line unicorn/prefer-includes
|
|
259
|
+
zn.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? $n : i.PARSER_MEDIA_TYPE, L = be === "application/xhtml+xml" ? lt : Ue, D = B(i, "ALLOWED_TAGS") ? b({}, i.ALLOWED_TAGS, L) : It, C = B(i, "ALLOWED_ATTR") ? b({}, i.ALLOWED_ATTR, L) : Dt, nt = B(i, "ALLOWED_NAMESPACES") ? b({}, i.ALLOWED_NAMESPACES, lt) : Mn, et = B(i, "ADD_URI_SAFE_ATTR") ? b(Z($t), i.ADD_URI_SAFE_ATTR, L) : $t, vt = B(i, "ADD_DATA_URI_TAGS") ? b(Z(zt), i.ADD_DATA_URI_TAGS, L) : zt, W = B(i, "FORBID_CONTENTS") ? b({}, i.FORBID_CONTENTS, L) : Je, me = B(i, "FORBID_TAGS") ? b({}, i.FORBID_TAGS, L) : Z({}), je = B(i, "FORBID_ATTR") ? b({}, i.FORBID_ATTR, L) : Z({}), ue = B(i, "USE_PROFILES") ? i.USE_PROFILES : !1, Ct = i.ALLOW_ARIA_ATTR !== !1, Xe = i.ALLOW_DATA_ATTR !== !1, Ot = i.ALLOW_UNKNOWN_PROTOCOLS || !1, Nt = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, oe = i.SAFE_FOR_TEMPLATES || !1, Le = i.SAFE_FOR_XML !== !1, te = i.WHOLE_DOCUMENT || !1, ce = i.RETURN_DOM || !1, Ie = i.RETURN_DOM_FRAGMENT || !1, De = i.RETURN_TRUSTED_TYPE || !1, Ve = i.FORCE_BODY || !1, Pt = i.SANITIZE_DOM !== !1, Mt = i.SANITIZE_NAMED_PROPS || !1, Ke = i.KEEP_CONTENT !== !1, ke = i.IN_PLACE || !1, Lt = i.ALLOWED_URI_REGEXP || fn, pe = i.NAMESPACE || j, Ne = i.MATHML_TEXT_INTEGRATION_POINTS || Ne, Pe = i.HTML_INTEGRATION_POINTS || Pe, R = i.CUSTOM_ELEMENT_HANDLING || {}, i.CUSTOM_ELEMENT_HANDLING && Ut(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (R.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && Ut(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (R.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (R.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), oe && (Xe = !1), Ie && (ce = !0), ue && (D = b({}, en), C = [], ue.html === !0 && (b(D, Jt), b(C, tn)), ue.svg === !0 && (b(D, ot), b(C, pt), b(C, ve)), ue.svgFilters === !0 && (b(D, ct), b(C, pt), b(C, ve)), ue.mathMl === !0 && (b(D, ut), b(C, nn), b(C, ve))), i.ADD_TAGS && (typeof i.ADD_TAGS == "function" ? ae.tagCheck = i.ADD_TAGS : (D === It && (D = Z(D)), b(D, i.ADD_TAGS, L))), i.ADD_ATTR && (typeof i.ADD_ATTR == "function" ? ae.attributeCheck = i.ADD_ATTR : (C === Dt && (C = Z(C)), b(C, i.ADD_ATTR, L))), i.ADD_URI_SAFE_ATTR && b(et, i.ADD_URI_SAFE_ATTR, L), i.FORBID_CONTENTS && (W === Je && (W = Z(W)), b(W, i.FORBID_CONTENTS, L)), i.ADD_FORBID_CONTENTS && (W === Je && (W = Z(W)), b(W, i.ADD_FORBID_CONTENTS, L)), Ke && (D["#text"] = !0), te && b(D, ["html", "head", "body"]), D.table && (b(D, ["tbody"]), delete me.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
260
|
+
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
261
|
+
throw we('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
262
|
+
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
263
|
+
throw we('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
264
|
+
I = i.TRUSTED_TYPES_POLICY, J = I.createHTML("");
|
|
265
|
+
} else
|
|
266
|
+
I === void 0 && (I = ur(p, s)), I !== null && typeof J == "string" && (J = I.createHTML(""));
|
|
267
|
+
z && z(i), he = i;
|
|
268
|
+
}
|
|
269
|
+
}, Ft = b({}, [...ot, ...ct, ...Jn]), Bt = b({}, [...ut, ...er]), Fn = function(i) {
|
|
270
|
+
let u = K(i);
|
|
271
|
+
(!u || !u.tagName) && (u = {
|
|
272
|
+
namespaceURI: pe,
|
|
273
|
+
tagName: "template"
|
|
274
|
+
});
|
|
275
|
+
const g = Ue(i.tagName), E = Ue(u.tagName);
|
|
276
|
+
return nt[i.namespaceURI] ? i.namespaceURI === Oe ? u.namespaceURI === j ? g === "svg" : u.namespaceURI === Ce ? g === "svg" && (E === "annotation-xml" || Ne[E]) : !!Ft[g] : i.namespaceURI === Ce ? u.namespaceURI === j ? g === "math" : u.namespaceURI === Oe ? g === "math" && Pe[E] : !!Bt[g] : i.namespaceURI === j ? u.namespaceURI === Oe && !Pe[E] || u.namespaceURI === Ce && !Ne[E] ? !1 : !Bt[g] && (vn[g] || !Ft[g]) : !!(be === "application/xhtml+xml" && nt[i.namespaceURI]) : !1;
|
|
277
|
+
}, q = function(i) {
|
|
278
|
+
xe(e.removed, {
|
|
279
|
+
element: i
|
|
280
|
+
});
|
|
281
|
+
try {
|
|
282
|
+
K(i).removeChild(i);
|
|
283
|
+
} catch {
|
|
284
|
+
S(i);
|
|
285
|
+
}
|
|
286
|
+
}, ne = function(i, u) {
|
|
287
|
+
try {
|
|
288
|
+
xe(e.removed, {
|
|
289
|
+
attribute: u.getAttributeNode(i),
|
|
290
|
+
from: u
|
|
291
|
+
});
|
|
292
|
+
} catch {
|
|
293
|
+
xe(e.removed, {
|
|
294
|
+
attribute: null,
|
|
295
|
+
from: u
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
if (u.removeAttribute(i), i === "is")
|
|
299
|
+
if (ce || Ie)
|
|
300
|
+
try {
|
|
301
|
+
q(u);
|
|
302
|
+
} catch {
|
|
303
|
+
}
|
|
304
|
+
else
|
|
305
|
+
try {
|
|
306
|
+
u.setAttribute(i, "");
|
|
307
|
+
} catch {
|
|
308
|
+
}
|
|
309
|
+
}, Ht = function(i) {
|
|
310
|
+
let u = null, g = null;
|
|
311
|
+
if (Ve)
|
|
312
|
+
i = "<remove></remove>" + i;
|
|
313
|
+
else {
|
|
314
|
+
const y = at(i, /^[\r\n\t ]+/);
|
|
315
|
+
g = y && y[0];
|
|
316
|
+
}
|
|
317
|
+
be === "application/xhtml+xml" && pe === j && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
318
|
+
const E = I ? I.createHTML(i) : i;
|
|
319
|
+
if (pe === j)
|
|
320
|
+
try {
|
|
321
|
+
u = new m().parseFromString(E, be);
|
|
322
|
+
} catch {
|
|
323
|
+
}
|
|
324
|
+
if (!u || !u.documentElement) {
|
|
325
|
+
u = ge.createDocument(pe, "template", null);
|
|
326
|
+
try {
|
|
327
|
+
u.documentElement.innerHTML = tt ? J : E;
|
|
328
|
+
} catch {
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const N = u.body || u.documentElement;
|
|
332
|
+
return i && g && N.insertBefore(t.createTextNode(g), N.childNodes[0] || null), pe === j ? Ln.call(u, te ? "html" : "body")[0] : te ? u.documentElement : N;
|
|
333
|
+
}, Gt = function(i) {
|
|
334
|
+
return de.call(
|
|
335
|
+
i.ownerDocument || i,
|
|
336
|
+
i,
|
|
337
|
+
// eslint-disable-next-line no-bitwise
|
|
338
|
+
c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION,
|
|
339
|
+
null
|
|
340
|
+
);
|
|
341
|
+
}, st = function(i) {
|
|
342
|
+
return i instanceof k && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof f) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
343
|
+
}, Wt = function(i) {
|
|
344
|
+
return typeof l == "function" && i instanceof l;
|
|
345
|
+
};
|
|
346
|
+
function X(d, i, u) {
|
|
347
|
+
Me(d, (g) => {
|
|
348
|
+
g.call(e, i, u, he);
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
const qt = function(i) {
|
|
352
|
+
let u = null;
|
|
353
|
+
if (X(P.beforeSanitizeElements, i, null), st(i))
|
|
354
|
+
return q(i), !0;
|
|
355
|
+
const g = L(i.nodeName);
|
|
356
|
+
if (X(P.uponSanitizeElement, i, {
|
|
357
|
+
tagName: g,
|
|
358
|
+
allowedTags: D
|
|
359
|
+
}), Le && i.hasChildNodes() && !Wt(i.firstElementChild) && M(/<[/\w!]/g, i.innerHTML) && M(/<[/\w!]/g, i.textContent) || i.nodeType === _e.progressingInstruction || Le && i.nodeType === _e.comment && M(/<[/\w]/g, i.data))
|
|
360
|
+
return q(i), !0;
|
|
361
|
+
if (!(ae.tagCheck instanceof Function && ae.tagCheck(g)) && (!D[g] || me[g])) {
|
|
362
|
+
if (!me[g] && Yt(g) && (R.tagNameCheck instanceof RegExp && M(R.tagNameCheck, g) || R.tagNameCheck instanceof Function && R.tagNameCheck(g)))
|
|
363
|
+
return !1;
|
|
364
|
+
if (Ke && !W[g]) {
|
|
365
|
+
const E = K(i) || i.parentNode, N = le(i) || i.childNodes;
|
|
366
|
+
if (N && E) {
|
|
367
|
+
const y = N.length;
|
|
368
|
+
for (let U = y - 1; U >= 0; --U) {
|
|
369
|
+
const Q = x(N[U], !0);
|
|
370
|
+
Q.__removalCount = (i.__removalCount || 0) + 1, E.insertBefore(Q, V(i));
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return q(i), !0;
|
|
375
|
+
}
|
|
376
|
+
return i instanceof h && !Fn(i) || (g === "noscript" || g === "noembed" || g === "noframes") && M(/<\/no(script|embed|frames)/i, i.innerHTML) ? (q(i), !0) : (oe && i.nodeType === _e.text && (u = i.textContent, Me([qe, Ze, Ye], (E) => {
|
|
377
|
+
u = Te(u, E, " ");
|
|
378
|
+
}), i.textContent !== u && (xe(e.removed, {
|
|
379
|
+
element: i.cloneNode()
|
|
380
|
+
}), i.textContent = u)), X(P.afterSanitizeElements, i, null), !1);
|
|
381
|
+
}, Zt = function(i, u, g) {
|
|
382
|
+
if (Pt && (u === "id" || u === "name") && (g in t || g in Un))
|
|
383
|
+
return !1;
|
|
384
|
+
if (!(Xe && !je[u] && M(Dn, u))) {
|
|
385
|
+
if (!(Ct && M(Cn, u))) {
|
|
386
|
+
if (!(ae.attributeCheck instanceof Function && ae.attributeCheck(u, i))) {
|
|
387
|
+
if (!C[u] || je[u]) {
|
|
388
|
+
if (
|
|
389
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
390
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
391
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
392
|
+
!(Yt(i) && (R.tagNameCheck instanceof RegExp && M(R.tagNameCheck, i) || R.tagNameCheck instanceof Function && R.tagNameCheck(i)) && (R.attributeNameCheck instanceof RegExp && M(R.attributeNameCheck, u) || R.attributeNameCheck instanceof Function && R.attributeNameCheck(u, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
393
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
394
|
+
u === "is" && R.allowCustomizedBuiltInElements && (R.tagNameCheck instanceof RegExp && M(R.tagNameCheck, g) || R.tagNameCheck instanceof Function && R.tagNameCheck(g)))
|
|
395
|
+
) return !1;
|
|
396
|
+
} else if (!et[u]) {
|
|
397
|
+
if (!M(Lt, Te(g, yt, ""))) {
|
|
398
|
+
if (!((u === "src" || u === "xlink:href" || u === "href") && i !== "script" && Xn(g, "data:") === 0 && vt[i])) {
|
|
399
|
+
if (!(Ot && !M(On, Te(g, yt, "")))) {
|
|
400
|
+
if (g)
|
|
401
|
+
return !1;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return !0;
|
|
410
|
+
}, Yt = function(i) {
|
|
411
|
+
return i !== "annotation-xml" && at(i, Nn);
|
|
412
|
+
}, jt = function(i) {
|
|
413
|
+
X(P.beforeSanitizeAttributes, i, null);
|
|
414
|
+
const {
|
|
415
|
+
attributes: u
|
|
416
|
+
} = i;
|
|
417
|
+
if (!u || st(i))
|
|
418
|
+
return;
|
|
419
|
+
const g = {
|
|
420
|
+
attrName: "",
|
|
421
|
+
attrValue: "",
|
|
422
|
+
keepAttr: !0,
|
|
423
|
+
allowedAttributes: C,
|
|
424
|
+
forceKeepAttr: void 0
|
|
425
|
+
};
|
|
426
|
+
let E = u.length;
|
|
427
|
+
for (; E--; ) {
|
|
428
|
+
const N = u[E], {
|
|
429
|
+
name: y,
|
|
430
|
+
namespaceURI: U,
|
|
431
|
+
value: Q
|
|
432
|
+
} = N, fe = L(y), it = Q;
|
|
433
|
+
let O = y === "value" ? it : Qn(it);
|
|
434
|
+
if (g.attrName = fe, g.attrValue = O, g.keepAttr = !0, g.forceKeepAttr = void 0, X(P.uponSanitizeAttribute, i, g), O = g.attrValue, Mt && (fe === "id" || fe === "name") && (ne(y, i), O = Pn + O), Le && M(/((--!?|])>)|<\/(style|title|textarea)/i, O)) {
|
|
435
|
+
ne(y, i);
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
if (fe === "attributename" && at(O, "href")) {
|
|
439
|
+
ne(y, i);
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
if (g.forceKeepAttr)
|
|
443
|
+
continue;
|
|
444
|
+
if (!g.keepAttr) {
|
|
445
|
+
ne(y, i);
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
448
|
+
if (!Nt && M(/\/>/i, O)) {
|
|
449
|
+
ne(y, i);
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
oe && Me([qe, Ze, Ye], (Qt) => {
|
|
453
|
+
O = Te(O, Qt, " ");
|
|
454
|
+
});
|
|
455
|
+
const Xt = L(i.nodeName);
|
|
456
|
+
if (!Zt(Xt, fe, O)) {
|
|
457
|
+
ne(y, i);
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
if (I && typeof p == "object" && typeof p.getAttributeType == "function" && !U)
|
|
461
|
+
switch (p.getAttributeType(Xt, fe)) {
|
|
462
|
+
case "TrustedHTML": {
|
|
463
|
+
O = I.createHTML(O);
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
case "TrustedScriptURL": {
|
|
467
|
+
O = I.createScriptURL(O);
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
if (O !== it)
|
|
472
|
+
try {
|
|
473
|
+
U ? i.setAttributeNS(U, y, O) : i.setAttribute(y, O), st(i) ? q(i) : Kt(e.removed);
|
|
474
|
+
} catch {
|
|
475
|
+
ne(y, i);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
X(P.afterSanitizeAttributes, i, null);
|
|
479
|
+
}, Bn = function d(i) {
|
|
480
|
+
let u = null;
|
|
481
|
+
const g = Gt(i);
|
|
482
|
+
for (X(P.beforeSanitizeShadowDOM, i, null); u = g.nextNode(); )
|
|
483
|
+
X(P.uponSanitizeShadowNode, u, null), qt(u), jt(u), u.content instanceof a && d(u.content);
|
|
484
|
+
X(P.afterSanitizeShadowDOM, i, null);
|
|
485
|
+
};
|
|
486
|
+
return e.sanitize = function(d) {
|
|
487
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, u = null, g = null, E = null, N = null;
|
|
488
|
+
if (tt = !d, tt && (d = "<!-->"), typeof d != "string" && !Wt(d))
|
|
489
|
+
if (typeof d.toString == "function") {
|
|
490
|
+
if (d = d.toString(), typeof d != "string")
|
|
491
|
+
throw we("dirty is not a string, aborting");
|
|
492
|
+
} else
|
|
493
|
+
throw we("toString is not a function");
|
|
494
|
+
if (!e.isSupported)
|
|
495
|
+
return d;
|
|
496
|
+
if (Qe || rt(i), e.removed = [], typeof d == "string" && (ke = !1), ke) {
|
|
497
|
+
if (d.nodeName) {
|
|
498
|
+
const Q = L(d.nodeName);
|
|
499
|
+
if (!D[Q] || me[Q])
|
|
500
|
+
throw we("root node is forbidden and cannot be sanitized in-place");
|
|
501
|
+
}
|
|
502
|
+
} else if (d instanceof l)
|
|
503
|
+
u = Ht("<!---->"), g = u.ownerDocument.importNode(d, !0), g.nodeType === _e.element && g.nodeName === "BODY" || g.nodeName === "HTML" ? u = g : u.appendChild(g);
|
|
504
|
+
else {
|
|
505
|
+
if (!ce && !oe && !te && // eslint-disable-next-line unicorn/prefer-includes
|
|
506
|
+
d.indexOf("<") === -1)
|
|
507
|
+
return I && De ? I.createHTML(d) : d;
|
|
508
|
+
if (u = Ht(d), !u)
|
|
509
|
+
return ce ? null : De ? J : "";
|
|
510
|
+
}
|
|
511
|
+
u && Ve && q(u.firstChild);
|
|
512
|
+
const y = Gt(ke ? d : u);
|
|
513
|
+
for (; E = y.nextNode(); )
|
|
514
|
+
qt(E), jt(E), E.content instanceof a && Bn(E.content);
|
|
515
|
+
if (ke)
|
|
516
|
+
return d;
|
|
517
|
+
if (ce) {
|
|
518
|
+
if (Ie)
|
|
519
|
+
for (N = ee.call(u.ownerDocument); u.firstChild; )
|
|
520
|
+
N.appendChild(u.firstChild);
|
|
521
|
+
else
|
|
522
|
+
N = u;
|
|
523
|
+
return (C.shadowroot || C.shadowrootmode) && (N = In.call(r, N, !0)), N;
|
|
524
|
+
}
|
|
525
|
+
let U = te ? u.outerHTML : u.innerHTML;
|
|
526
|
+
return te && D["!doctype"] && u.ownerDocument && u.ownerDocument.doctype && u.ownerDocument.doctype.name && M(gn, u.ownerDocument.doctype.name) && (U = "<!DOCTYPE " + u.ownerDocument.doctype.name + `>
|
|
527
|
+
` + U), oe && Me([qe, Ze, Ye], (Q) => {
|
|
528
|
+
U = Te(U, Q, " ");
|
|
529
|
+
}), I && De ? I.createHTML(U) : U;
|
|
530
|
+
}, e.setConfig = function() {
|
|
531
|
+
let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
532
|
+
rt(d), Qe = !0;
|
|
533
|
+
}, e.clearConfig = function() {
|
|
534
|
+
he = null, Qe = !1;
|
|
535
|
+
}, e.isValidAttribute = function(d, i, u) {
|
|
536
|
+
he || rt({});
|
|
537
|
+
const g = L(d), E = L(i);
|
|
538
|
+
return Zt(g, E, u);
|
|
539
|
+
}, e.addHook = function(d, i) {
|
|
540
|
+
typeof i == "function" && xe(P[d], i);
|
|
541
|
+
}, e.removeHook = function(d, i) {
|
|
542
|
+
if (i !== void 0) {
|
|
543
|
+
const u = Yn(P[d], i);
|
|
544
|
+
return u === -1 ? void 0 : jn(P[d], u, 1)[0];
|
|
545
|
+
}
|
|
546
|
+
return Kt(P[d]);
|
|
547
|
+
}, e.removeHooks = function(d) {
|
|
548
|
+
P[d] = [];
|
|
549
|
+
}, e.removeAllHooks = function() {
|
|
550
|
+
P = sn();
|
|
551
|
+
}, e;
|
|
552
|
+
}
|
|
553
|
+
var pr = dn();
|
|
554
|
+
function bt() {
|
|
555
|
+
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
556
|
+
}
|
|
557
|
+
var ie = bt();
|
|
558
|
+
function mn(n) {
|
|
559
|
+
ie = n;
|
|
560
|
+
}
|
|
561
|
+
var re = { exec: () => null };
|
|
562
|
+
function T(n, e = "") {
|
|
563
|
+
let t = typeof n == "string" ? n : n.source, r = { replace: (s, a) => {
|
|
564
|
+
let o = typeof a == "string" ? a : a.source;
|
|
565
|
+
return o = o.replace(v.caret, "$1"), t = t.replace(s, o), r;
|
|
566
|
+
}, getRegex: () => new RegExp(t, e) };
|
|
567
|
+
return r;
|
|
568
|
+
}
|
|
569
|
+
var hr = (() => {
|
|
570
|
+
try {
|
|
571
|
+
return !!new RegExp("(?<=1)(?<!1)");
|
|
572
|
+
} catch {
|
|
573
|
+
return !1;
|
|
574
|
+
}
|
|
575
|
+
})(), v = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (n) => new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}#`), htmlBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}>`) }, fr = /^(?:[ \t]*(?:\n|$))+/, gr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, dr = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, ye = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, mr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, xt = / {0,3}(?:[*+-]|\d{1,9}[.)])/, kn = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, bn = T(kn).replace(/bull/g, xt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), kr = T(kn).replace(/bull/g, xt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Tt = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, br = /^[^\n]+/, wt = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, xr = T(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", wt).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Tr = T(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, xt).getRegex(), Ge = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", At = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, wr = T("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", At).replace("tag", Ge).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), xn = T(Tt).replace("hr", ye).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ge).getRegex(), Ar = T(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", xn).getRegex(), _t = { blockquote: Ar, code: gr, def: xr, fences: dr, heading: mr, hr: ye, html: wr, lheading: bn, list: Tr, newline: fr, paragraph: xn, table: re, text: br }, ln = T("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ye).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ge).getRegex(), _r = { ..._t, lheading: kr, table: ln, paragraph: T(Tt).replace("hr", ye).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ln).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ge).getRegex() }, Er = { ..._t, html: T(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", At).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: re, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: T(Tt).replace("hr", ye).replace("heading", ` *#{1,6} *[^
|
|
576
|
+
]`).replace("lheading", bn).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Sr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Rr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Tn = /^( {2,}|\\)\n(?!\s*$)/, yr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, We = /[\p{P}\p{S}]/u, Et = /[\s\p{P}\p{S}]/u, wn = /[^\s\p{P}\p{S}]/u, Lr = T(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Et).getRegex(), An = /(?!~)[\p{P}\p{S}]/u, Ir = /(?!~)[\s\p{P}\p{S}]/u, Dr = /(?:[^\s\p{P}\p{S}]|~)/u, _n = /(?![*_])[\p{P}\p{S}]/u, Cr = /(?![*_])[\s\p{P}\p{S}]/u, Or = /(?:[^\s\p{P}\p{S}]|[*_])/u, Nr = T(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", hr ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), En = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Pr = T(En, "u").replace(/punct/g, We).getRegex(), Mr = T(En, "u").replace(/punct/g, An).getRegex(), Sn = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", vr = T(Sn, "gu").replace(/notPunctSpace/g, wn).replace(/punctSpace/g, Et).replace(/punct/g, We).getRegex(), zr = T(Sn, "gu").replace(/notPunctSpace/g, Dr).replace(/punctSpace/g, Ir).replace(/punct/g, An).getRegex(), $r = T("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, wn).replace(/punctSpace/g, Et).replace(/punct/g, We).getRegex(), Ur = T(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, _n).getRegex(), Fr = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Br = T(Fr, "gu").replace(/notPunctSpace/g, Or).replace(/punctSpace/g, Cr).replace(/punct/g, _n).getRegex(), Hr = T(/\\(punct)/, "gu").replace(/punct/g, We).getRegex(), Gr = T(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Wr = T(At).replace("(?:-->|$)", "-->").getRegex(), qr = T("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Wr).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Fe = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Zr = T(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Fe).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Rn = T(/^!?\[(label)\]\[(ref)\]/).replace("label", Fe).replace("ref", wt).getRegex(), yn = T(/^!?\[(ref)\](?:\[\])?/).replace("ref", wt).getRegex(), Yr = T("reflink|nolink(?!\\()", "g").replace("reflink", Rn).replace("nolink", yn).getRegex(), an = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, St = { _backpedal: re, anyPunctuation: Hr, autolink: Gr, blockSkip: Nr, br: Tn, code: Rr, del: re, delLDelim: re, delRDelim: re, emStrongLDelim: Pr, emStrongRDelimAst: vr, emStrongRDelimUnd: $r, escape: Sr, link: Zr, nolink: yn, punctuation: Lr, reflink: Rn, reflinkSearch: Yr, tag: qr, text: yr, url: re }, jr = { ...St, link: T(/^!?\[(label)\]\((.*?)\)/).replace("label", Fe).getRegex(), reflink: T(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Fe).getRegex() }, dt = { ...St, emStrongRDelimAst: zr, emStrongLDelim: Mr, delLDelim: Ur, delRDelim: Br, url: T(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", an).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: T(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", an).getRegex() }, Xr = { ...dt, br: T(Tn).replace("{2,}", "*").getRegex(), text: T(dt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, ze = { normal: _t, gfm: _r, pedantic: Er }, Ee = { normal: St, gfm: dt, breaks: Xr, pedantic: jr }, Qr = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, on = (n) => Qr[n];
|
|
577
|
+
function Y(n, e) {
|
|
578
|
+
if (e) {
|
|
579
|
+
if (v.escapeTest.test(n)) return n.replace(v.escapeReplace, on);
|
|
580
|
+
} else if (v.escapeTestNoEncode.test(n)) return n.replace(v.escapeReplaceNoEncode, on);
|
|
581
|
+
return n;
|
|
582
|
+
}
|
|
583
|
+
function cn(n) {
|
|
584
|
+
try {
|
|
585
|
+
n = encodeURI(n).replace(v.percentDecode, "%");
|
|
586
|
+
} catch {
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
return n;
|
|
590
|
+
}
|
|
591
|
+
function un(n, e) {
|
|
592
|
+
var a;
|
|
593
|
+
let t = n.replace(v.findPipe, (o, l, h) => {
|
|
594
|
+
let c = !1, f = l;
|
|
595
|
+
for (; --f >= 0 && h[f] === "\\"; ) c = !c;
|
|
596
|
+
return c ? "|" : " |";
|
|
597
|
+
}), r = t.split(v.splitPipe), s = 0;
|
|
598
|
+
if (r[0].trim() || r.shift(), r.length > 0 && !((a = r.at(-1)) != null && a.trim()) && r.pop(), e) if (r.length > e) r.splice(e);
|
|
599
|
+
else for (; r.length < e; ) r.push("");
|
|
600
|
+
for (; s < r.length; s++) r[s] = r[s].trim().replace(v.slashPipe, "|");
|
|
601
|
+
return r;
|
|
602
|
+
}
|
|
603
|
+
function Se(n, e, t) {
|
|
604
|
+
let r = n.length;
|
|
605
|
+
if (r === 0) return "";
|
|
606
|
+
let s = 0;
|
|
607
|
+
for (; s < r && n.charAt(r - s - 1) === e; )
|
|
608
|
+
s++;
|
|
609
|
+
return n.slice(0, r - s);
|
|
610
|
+
}
|
|
611
|
+
function Vr(n, e) {
|
|
612
|
+
if (n.indexOf(e[1]) === -1) return -1;
|
|
613
|
+
let t = 0;
|
|
614
|
+
for (let r = 0; r < n.length; r++) if (n[r] === "\\") r++;
|
|
615
|
+
else if (n[r] === e[0]) t++;
|
|
616
|
+
else if (n[r] === e[1] && (t--, t < 0)) return r;
|
|
617
|
+
return t > 0 ? -2 : -1;
|
|
618
|
+
}
|
|
619
|
+
function Kr(n, e = 0) {
|
|
620
|
+
let t = e, r = "";
|
|
621
|
+
for (let s of n) if (s === " ") {
|
|
622
|
+
let a = 4 - t % 4;
|
|
623
|
+
r += " ".repeat(a), t += a;
|
|
624
|
+
} else r += s, t++;
|
|
625
|
+
return r;
|
|
626
|
+
}
|
|
627
|
+
function pn(n, e, t, r, s) {
|
|
628
|
+
let a = e.href, o = e.title || null, l = n[1].replace(s.other.outputLinkReplace, "$1");
|
|
629
|
+
r.state.inLink = !0;
|
|
630
|
+
let h = { type: n[0].charAt(0) === "!" ? "image" : "link", raw: t, href: a, title: o, text: l, tokens: r.inlineTokens(l) };
|
|
631
|
+
return r.state.inLink = !1, h;
|
|
632
|
+
}
|
|
633
|
+
function Jr(n, e, t) {
|
|
634
|
+
let r = n.match(t.other.indentCodeCompensation);
|
|
635
|
+
if (r === null) return e;
|
|
636
|
+
let s = r[1];
|
|
637
|
+
return e.split(`
|
|
638
|
+
`).map((a) => {
|
|
639
|
+
let o = a.match(t.other.beginningSpace);
|
|
640
|
+
if (o === null) return a;
|
|
641
|
+
let [l] = o;
|
|
642
|
+
return l.length >= s.length ? a.slice(s.length) : a;
|
|
643
|
+
}).join(`
|
|
644
|
+
`);
|
|
645
|
+
}
|
|
646
|
+
var Be = class {
|
|
647
|
+
constructor(n) {
|
|
648
|
+
_(this, "options");
|
|
649
|
+
_(this, "rules");
|
|
650
|
+
_(this, "lexer");
|
|
651
|
+
this.options = n || ie;
|
|
652
|
+
}
|
|
653
|
+
space(n) {
|
|
654
|
+
let e = this.rules.block.newline.exec(n);
|
|
655
|
+
if (e && e[0].length > 0) return { type: "space", raw: e[0] };
|
|
656
|
+
}
|
|
657
|
+
code(n) {
|
|
658
|
+
let e = this.rules.block.code.exec(n);
|
|
659
|
+
if (e) {
|
|
660
|
+
let t = e[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
661
|
+
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? t : Se(t, `
|
|
662
|
+
`) };
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
fences(n) {
|
|
666
|
+
let e = this.rules.block.fences.exec(n);
|
|
667
|
+
if (e) {
|
|
668
|
+
let t = e[0], r = Jr(t, e[3] || "", this.rules);
|
|
669
|
+
return { type: "code", raw: t, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: r };
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
heading(n) {
|
|
673
|
+
let e = this.rules.block.heading.exec(n);
|
|
674
|
+
if (e) {
|
|
675
|
+
let t = e[2].trim();
|
|
676
|
+
if (this.rules.other.endingHash.test(t)) {
|
|
677
|
+
let r = Se(t, "#");
|
|
678
|
+
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (t = r.trim());
|
|
679
|
+
}
|
|
680
|
+
return { type: "heading", raw: e[0], depth: e[1].length, text: t, tokens: this.lexer.inline(t) };
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
hr(n) {
|
|
684
|
+
let e = this.rules.block.hr.exec(n);
|
|
685
|
+
if (e) return { type: "hr", raw: Se(e[0], `
|
|
686
|
+
`) };
|
|
687
|
+
}
|
|
688
|
+
blockquote(n) {
|
|
689
|
+
let e = this.rules.block.blockquote.exec(n);
|
|
690
|
+
if (e) {
|
|
691
|
+
let t = Se(e[0], `
|
|
692
|
+
`).split(`
|
|
693
|
+
`), r = "", s = "", a = [];
|
|
694
|
+
for (; t.length > 0; ) {
|
|
695
|
+
let o = !1, l = [], h;
|
|
696
|
+
for (h = 0; h < t.length; h++) if (this.rules.other.blockquoteStart.test(t[h])) l.push(t[h]), o = !0;
|
|
697
|
+
else if (!o) l.push(t[h]);
|
|
698
|
+
else break;
|
|
699
|
+
t = t.slice(h);
|
|
700
|
+
let c = l.join(`
|
|
701
|
+
`), f = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
702
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
703
|
+
r = r ? `${r}
|
|
704
|
+
${c}` : c, s = s ? `${s}
|
|
705
|
+
${f}` : f;
|
|
706
|
+
let k = this.lexer.state.top;
|
|
707
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(f, a, !0), this.lexer.state.top = k, t.length === 0) break;
|
|
708
|
+
let m = a.at(-1);
|
|
709
|
+
if ((m == null ? void 0 : m.type) === "code") break;
|
|
710
|
+
if ((m == null ? void 0 : m.type) === "blockquote") {
|
|
711
|
+
let p = m, w = p.raw + `
|
|
712
|
+
` + t.join(`
|
|
713
|
+
`), x = this.blockquote(w);
|
|
714
|
+
a[a.length - 1] = x, r = r.substring(0, r.length - p.raw.length) + x.raw, s = s.substring(0, s.length - p.text.length) + x.text;
|
|
715
|
+
break;
|
|
716
|
+
} else if ((m == null ? void 0 : m.type) === "list") {
|
|
717
|
+
let p = m, w = p.raw + `
|
|
718
|
+
` + t.join(`
|
|
719
|
+
`), x = this.list(w);
|
|
720
|
+
a[a.length - 1] = x, r = r.substring(0, r.length - m.raw.length) + x.raw, s = s.substring(0, s.length - p.raw.length) + x.raw, t = w.substring(a.at(-1).raw.length).split(`
|
|
721
|
+
`);
|
|
722
|
+
continue;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
return { type: "blockquote", raw: r, tokens: a, text: s };
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
list(n) {
|
|
729
|
+
var t, r;
|
|
730
|
+
let e = this.rules.block.list.exec(n);
|
|
731
|
+
if (e) {
|
|
732
|
+
let s = e[1].trim(), a = s.length > 1, o = { type: "list", raw: "", ordered: a, start: a ? +s.slice(0, -1) : "", loose: !1, items: [] };
|
|
733
|
+
s = a ? `\\d{1,9}\\${s.slice(-1)}` : `\\${s}`, this.options.pedantic && (s = a ? s : "[*+-]");
|
|
734
|
+
let l = this.rules.other.listItemRegex(s), h = !1;
|
|
735
|
+
for (; n; ) {
|
|
736
|
+
let f = !1, k = "", m = "";
|
|
737
|
+
if (!(e = l.exec(n)) || this.rules.block.hr.test(n)) break;
|
|
738
|
+
k = e[0], n = n.substring(k.length);
|
|
739
|
+
let p = Kr(e[2].split(`
|
|
740
|
+
`, 1)[0], e[1].length), w = n.split(`
|
|
741
|
+
`, 1)[0], x = !p.trim(), S = 0;
|
|
742
|
+
if (this.options.pedantic ? (S = 2, m = p.trimStart()) : x ? S = e[1].length + 1 : (S = p.search(this.rules.other.nonSpaceChar), S = S > 4 ? 1 : S, m = p.slice(S), S += e[1].length), x && this.rules.other.blankLine.test(w) && (k += w + `
|
|
743
|
+
`, n = n.substring(w.length + 1), f = !0), !f) {
|
|
744
|
+
let V = this.rules.other.nextBulletRegex(S), le = this.rules.other.hrRegex(S), K = this.rules.other.fencesBeginRegex(S), I = this.rules.other.headingBeginRegex(S), J = this.rules.other.htmlBeginRegex(S), ge = this.rules.other.blockquoteBeginRegex(S);
|
|
745
|
+
for (; n; ) {
|
|
746
|
+
let de = n.split(`
|
|
747
|
+
`, 1)[0], ee;
|
|
748
|
+
if (w = de, this.options.pedantic ? (w = w.replace(this.rules.other.listReplaceNesting, " "), ee = w) : ee = w.replace(this.rules.other.tabCharGlobal, " "), K.test(w) || I.test(w) || J.test(w) || ge.test(w) || V.test(w) || le.test(w)) break;
|
|
749
|
+
if (ee.search(this.rules.other.nonSpaceChar) >= S || !w.trim()) m += `
|
|
750
|
+
` + ee.slice(S);
|
|
751
|
+
else {
|
|
752
|
+
if (x || p.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || K.test(p) || I.test(p) || le.test(p)) break;
|
|
753
|
+
m += `
|
|
754
|
+
` + w;
|
|
755
|
+
}
|
|
756
|
+
x = !w.trim(), k += de + `
|
|
757
|
+
`, n = n.substring(de.length + 1), p = ee.slice(S);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
o.loose || (h ? o.loose = !0 : this.rules.other.doubleBlankLine.test(k) && (h = !0)), o.items.push({ type: "list_item", raw: k, task: !!this.options.gfm && this.rules.other.listIsTask.test(m), loose: !1, text: m, tokens: [] }), o.raw += k;
|
|
761
|
+
}
|
|
762
|
+
let c = o.items.at(-1);
|
|
763
|
+
if (c) c.raw = c.raw.trimEnd(), c.text = c.text.trimEnd();
|
|
764
|
+
else return;
|
|
765
|
+
o.raw = o.raw.trimEnd();
|
|
766
|
+
for (let f of o.items) {
|
|
767
|
+
if (this.lexer.state.top = !1, f.tokens = this.lexer.blockTokens(f.text, []), f.task) {
|
|
768
|
+
if (f.text = f.text.replace(this.rules.other.listReplaceTask, ""), ((t = f.tokens[0]) == null ? void 0 : t.type) === "text" || ((r = f.tokens[0]) == null ? void 0 : r.type) === "paragraph") {
|
|
769
|
+
f.tokens[0].raw = f.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), f.tokens[0].text = f.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
770
|
+
for (let m = this.lexer.inlineQueue.length - 1; m >= 0; m--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[m].src)) {
|
|
771
|
+
this.lexer.inlineQueue[m].src = this.lexer.inlineQueue[m].src.replace(this.rules.other.listReplaceTask, "");
|
|
772
|
+
break;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
let k = this.rules.other.listTaskCheckbox.exec(f.raw);
|
|
776
|
+
if (k) {
|
|
777
|
+
let m = { type: "checkbox", raw: k[0] + " ", checked: k[0] !== "[ ]" };
|
|
778
|
+
f.checked = m.checked, o.loose ? f.tokens[0] && ["paragraph", "text"].includes(f.tokens[0].type) && "tokens" in f.tokens[0] && f.tokens[0].tokens ? (f.tokens[0].raw = m.raw + f.tokens[0].raw, f.tokens[0].text = m.raw + f.tokens[0].text, f.tokens[0].tokens.unshift(m)) : f.tokens.unshift({ type: "paragraph", raw: m.raw, text: m.raw, tokens: [m] }) : f.tokens.unshift(m);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
if (!o.loose) {
|
|
782
|
+
let k = f.tokens.filter((p) => p.type === "space"), m = k.length > 0 && k.some((p) => this.rules.other.anyLine.test(p.raw));
|
|
783
|
+
o.loose = m;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
if (o.loose) for (let f of o.items) {
|
|
787
|
+
f.loose = !0;
|
|
788
|
+
for (let k of f.tokens) k.type === "text" && (k.type = "paragraph");
|
|
789
|
+
}
|
|
790
|
+
return o;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
html(n) {
|
|
794
|
+
let e = this.rules.block.html.exec(n);
|
|
795
|
+
if (e) return { type: "html", block: !0, raw: e[0], pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: e[0] };
|
|
796
|
+
}
|
|
797
|
+
def(n) {
|
|
798
|
+
let e = this.rules.block.def.exec(n);
|
|
799
|
+
if (e) {
|
|
800
|
+
let t = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", s = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
|
|
801
|
+
return { type: "def", tag: t, raw: e[0], href: r, title: s };
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
table(n) {
|
|
805
|
+
var o;
|
|
806
|
+
let e = this.rules.block.table.exec(n);
|
|
807
|
+
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
808
|
+
let t = un(e[1]), r = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = (o = e[3]) != null && o.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
809
|
+
`) : [], a = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
810
|
+
if (t.length === r.length) {
|
|
811
|
+
for (let l of r) this.rules.other.tableAlignRight.test(l) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(l) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(l) ? a.align.push("left") : a.align.push(null);
|
|
812
|
+
for (let l = 0; l < t.length; l++) a.header.push({ text: t[l], tokens: this.lexer.inline(t[l]), header: !0, align: a.align[l] });
|
|
813
|
+
for (let l of s) a.rows.push(un(l, a.header.length).map((h, c) => ({ text: h, tokens: this.lexer.inline(h), header: !1, align: a.align[c] })));
|
|
814
|
+
return a;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
lheading(n) {
|
|
818
|
+
let e = this.rules.block.lheading.exec(n);
|
|
819
|
+
if (e) return { type: "heading", raw: e[0], depth: e[2].charAt(0) === "=" ? 1 : 2, text: e[1], tokens: this.lexer.inline(e[1]) };
|
|
820
|
+
}
|
|
821
|
+
paragraph(n) {
|
|
822
|
+
let e = this.rules.block.paragraph.exec(n);
|
|
823
|
+
if (e) {
|
|
824
|
+
let t = e[1].charAt(e[1].length - 1) === `
|
|
825
|
+
` ? e[1].slice(0, -1) : e[1];
|
|
826
|
+
return { type: "paragraph", raw: e[0], text: t, tokens: this.lexer.inline(t) };
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
text(n) {
|
|
830
|
+
let e = this.rules.block.text.exec(n);
|
|
831
|
+
if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
|
|
832
|
+
}
|
|
833
|
+
escape(n) {
|
|
834
|
+
let e = this.rules.inline.escape.exec(n);
|
|
835
|
+
if (e) return { type: "escape", raw: e[0], text: e[1] };
|
|
836
|
+
}
|
|
837
|
+
tag(n) {
|
|
838
|
+
let e = this.rules.inline.tag.exec(n);
|
|
839
|
+
if (e) return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = !1), { type: "html", raw: e[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: !1, text: e[0] };
|
|
840
|
+
}
|
|
841
|
+
link(n) {
|
|
842
|
+
let e = this.rules.inline.link.exec(n);
|
|
843
|
+
if (e) {
|
|
844
|
+
let t = e[2].trim();
|
|
845
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(t)) {
|
|
846
|
+
if (!this.rules.other.endAngleBracket.test(t)) return;
|
|
847
|
+
let a = Se(t.slice(0, -1), "\\");
|
|
848
|
+
if ((t.length - a.length) % 2 === 0) return;
|
|
849
|
+
} else {
|
|
850
|
+
let a = Vr(e[2], "()");
|
|
851
|
+
if (a === -2) return;
|
|
852
|
+
if (a > -1) {
|
|
853
|
+
let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + a;
|
|
854
|
+
e[2] = e[2].substring(0, a), e[0] = e[0].substring(0, o).trim(), e[3] = "";
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
let r = e[2], s = "";
|
|
858
|
+
if (this.options.pedantic) {
|
|
859
|
+
let a = this.rules.other.pedanticHrefTitle.exec(r);
|
|
860
|
+
a && (r = a[1], s = a[3]);
|
|
861
|
+
} else s = e[3] ? e[3].slice(1, -1) : "";
|
|
862
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(t) ? r = r.slice(1) : r = r.slice(1, -1)), pn(e, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: s && s.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
reflink(n, e) {
|
|
866
|
+
let t;
|
|
867
|
+
if ((t = this.rules.inline.reflink.exec(n)) || (t = this.rules.inline.nolink.exec(n))) {
|
|
868
|
+
let r = (t[2] || t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), s = e[r.toLowerCase()];
|
|
869
|
+
if (!s) {
|
|
870
|
+
let a = t[0].charAt(0);
|
|
871
|
+
return { type: "text", raw: a, text: a };
|
|
872
|
+
}
|
|
873
|
+
return pn(t, s, t[0], this.lexer, this.rules);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
emStrong(n, e, t = "") {
|
|
877
|
+
let r = this.rules.inline.emStrongLDelim.exec(n);
|
|
878
|
+
if (!(!r || r[3] && t.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[2]) || !t || this.rules.inline.punctuation.exec(t))) {
|
|
879
|
+
let s = [...r[0]].length - 1, a, o, l = s, h = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
880
|
+
for (c.lastIndex = 0, e = e.slice(-1 * n.length + s); (r = c.exec(e)) != null; ) {
|
|
881
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
|
|
882
|
+
if (o = [...a].length, r[3] || r[4]) {
|
|
883
|
+
l += o;
|
|
884
|
+
continue;
|
|
885
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
|
|
886
|
+
h += o;
|
|
887
|
+
continue;
|
|
888
|
+
}
|
|
889
|
+
if (l -= o, l > 0) continue;
|
|
890
|
+
o = Math.min(o, o + l + h);
|
|
891
|
+
let f = [...r[0]][0].length, k = n.slice(0, s + r.index + f + o);
|
|
892
|
+
if (Math.min(s, o) % 2) {
|
|
893
|
+
let p = k.slice(1, -1);
|
|
894
|
+
return { type: "em", raw: k, text: p, tokens: this.lexer.inlineTokens(p) };
|
|
895
|
+
}
|
|
896
|
+
let m = k.slice(2, -2);
|
|
897
|
+
return { type: "strong", raw: k, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
codespan(n) {
|
|
902
|
+
let e = this.rules.inline.code.exec(n);
|
|
903
|
+
if (e) {
|
|
904
|
+
let t = e[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(t), s = this.rules.other.startingSpaceChar.test(t) && this.rules.other.endingSpaceChar.test(t);
|
|
905
|
+
return r && s && (t = t.substring(1, t.length - 1)), { type: "codespan", raw: e[0], text: t };
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
br(n) {
|
|
909
|
+
let e = this.rules.inline.br.exec(n);
|
|
910
|
+
if (e) return { type: "br", raw: e[0] };
|
|
911
|
+
}
|
|
912
|
+
del(n, e, t = "") {
|
|
913
|
+
let r = this.rules.inline.delLDelim.exec(n);
|
|
914
|
+
if (r && (!r[1] || !t || this.rules.inline.punctuation.exec(t))) {
|
|
915
|
+
let s = [...r[0]].length - 1, a, o, l = s, h = this.rules.inline.delRDelim;
|
|
916
|
+
for (h.lastIndex = 0, e = e.slice(-1 * n.length + s); (r = h.exec(e)) != null; ) {
|
|
917
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a || (o = [...a].length, o !== s)) continue;
|
|
918
|
+
if (r[3] || r[4]) {
|
|
919
|
+
l += o;
|
|
920
|
+
continue;
|
|
921
|
+
}
|
|
922
|
+
if (l -= o, l > 0) continue;
|
|
923
|
+
o = Math.min(o, o + l);
|
|
924
|
+
let c = [...r[0]][0].length, f = n.slice(0, s + r.index + c + o), k = f.slice(s, -s);
|
|
925
|
+
return { type: "del", raw: f, text: k, tokens: this.lexer.inlineTokens(k) };
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
autolink(n) {
|
|
930
|
+
let e = this.rules.inline.autolink.exec(n);
|
|
931
|
+
if (e) {
|
|
932
|
+
let t, r;
|
|
933
|
+
return e[2] === "@" ? (t = e[1], r = "mailto:" + t) : (t = e[1], r = t), { type: "link", raw: e[0], text: t, href: r, tokens: [{ type: "text", raw: t, text: t }] };
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
url(n) {
|
|
937
|
+
var t;
|
|
938
|
+
let e;
|
|
939
|
+
if (e = this.rules.inline.url.exec(n)) {
|
|
940
|
+
let r, s;
|
|
941
|
+
if (e[2] === "@") r = e[0], s = "mailto:" + r;
|
|
942
|
+
else {
|
|
943
|
+
let a;
|
|
944
|
+
do
|
|
945
|
+
a = e[0], e[0] = ((t = this.rules.inline._backpedal.exec(e[0])) == null ? void 0 : t[0]) ?? "";
|
|
946
|
+
while (a !== e[0]);
|
|
947
|
+
r = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
|
|
948
|
+
}
|
|
949
|
+
return { type: "link", raw: e[0], text: r, href: s, tokens: [{ type: "text", raw: r, text: r }] };
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
inlineText(n) {
|
|
953
|
+
let e = this.rules.inline.text.exec(n);
|
|
954
|
+
if (e) {
|
|
955
|
+
let t = this.lexer.state.inRawBlock;
|
|
956
|
+
return { type: "text", raw: e[0], text: e[0], escaped: t };
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
}, H = class mt {
|
|
960
|
+
constructor(e) {
|
|
961
|
+
_(this, "tokens");
|
|
962
|
+
_(this, "options");
|
|
963
|
+
_(this, "state");
|
|
964
|
+
_(this, "inlineQueue");
|
|
965
|
+
_(this, "tokenizer");
|
|
966
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || ie, this.options.tokenizer = this.options.tokenizer || new Be(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
967
|
+
let t = { other: v, block: ze.normal, inline: Ee.normal };
|
|
968
|
+
this.options.pedantic ? (t.block = ze.pedantic, t.inline = Ee.pedantic) : this.options.gfm && (t.block = ze.gfm, this.options.breaks ? t.inline = Ee.breaks : t.inline = Ee.gfm), this.tokenizer.rules = t;
|
|
969
|
+
}
|
|
970
|
+
static get rules() {
|
|
971
|
+
return { block: ze, inline: Ee };
|
|
972
|
+
}
|
|
973
|
+
static lex(e, t) {
|
|
974
|
+
return new mt(t).lex(e);
|
|
975
|
+
}
|
|
976
|
+
static lexInline(e, t) {
|
|
977
|
+
return new mt(t).inlineTokens(e);
|
|
978
|
+
}
|
|
979
|
+
lex(e) {
|
|
980
|
+
e = e.replace(v.carriageReturn, `
|
|
981
|
+
`), this.blockTokens(e, this.tokens);
|
|
982
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
983
|
+
let r = this.inlineQueue[t];
|
|
984
|
+
this.inlineTokens(r.src, r.tokens);
|
|
985
|
+
}
|
|
986
|
+
return this.inlineQueue = [], this.tokens;
|
|
987
|
+
}
|
|
988
|
+
blockTokens(e, t = [], r = !1) {
|
|
989
|
+
var s, a, o;
|
|
990
|
+
for (this.options.pedantic && (e = e.replace(v.tabCharGlobal, " ").replace(v.spaceLine, "")); e; ) {
|
|
991
|
+
let l;
|
|
992
|
+
if ((a = (s = this.options.extensions) == null ? void 0 : s.block) != null && a.some((c) => (l = c.call({ lexer: this }, e, t)) ? (e = e.substring(l.raw.length), t.push(l), !0) : !1)) continue;
|
|
993
|
+
if (l = this.tokenizer.space(e)) {
|
|
994
|
+
e = e.substring(l.raw.length);
|
|
995
|
+
let c = t.at(-1);
|
|
996
|
+
l.raw.length === 1 && c !== void 0 ? c.raw += `
|
|
997
|
+
` : t.push(l);
|
|
998
|
+
continue;
|
|
999
|
+
}
|
|
1000
|
+
if (l = this.tokenizer.code(e)) {
|
|
1001
|
+
e = e.substring(l.raw.length);
|
|
1002
|
+
let c = t.at(-1);
|
|
1003
|
+
(c == null ? void 0 : c.type) === "paragraph" || (c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
|
|
1004
|
+
`) ? "" : `
|
|
1005
|
+
`) + l.raw, c.text += `
|
|
1006
|
+
` + l.text, this.inlineQueue.at(-1).src = c.text) : t.push(l);
|
|
1007
|
+
continue;
|
|
1008
|
+
}
|
|
1009
|
+
if (l = this.tokenizer.fences(e)) {
|
|
1010
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
1011
|
+
continue;
|
|
1012
|
+
}
|
|
1013
|
+
if (l = this.tokenizer.heading(e)) {
|
|
1014
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
1015
|
+
continue;
|
|
1016
|
+
}
|
|
1017
|
+
if (l = this.tokenizer.hr(e)) {
|
|
1018
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
1019
|
+
continue;
|
|
1020
|
+
}
|
|
1021
|
+
if (l = this.tokenizer.blockquote(e)) {
|
|
1022
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
1023
|
+
continue;
|
|
1024
|
+
}
|
|
1025
|
+
if (l = this.tokenizer.list(e)) {
|
|
1026
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
1027
|
+
continue;
|
|
1028
|
+
}
|
|
1029
|
+
if (l = this.tokenizer.html(e)) {
|
|
1030
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
1031
|
+
continue;
|
|
1032
|
+
}
|
|
1033
|
+
if (l = this.tokenizer.def(e)) {
|
|
1034
|
+
e = e.substring(l.raw.length);
|
|
1035
|
+
let c = t.at(-1);
|
|
1036
|
+
(c == null ? void 0 : c.type) === "paragraph" || (c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
|
|
1037
|
+
`) ? "" : `
|
|
1038
|
+
`) + l.raw, c.text += `
|
|
1039
|
+
` + l.raw, this.inlineQueue.at(-1).src = c.text) : this.tokens.links[l.tag] || (this.tokens.links[l.tag] = { href: l.href, title: l.title }, t.push(l));
|
|
1040
|
+
continue;
|
|
1041
|
+
}
|
|
1042
|
+
if (l = this.tokenizer.table(e)) {
|
|
1043
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
1044
|
+
continue;
|
|
1045
|
+
}
|
|
1046
|
+
if (l = this.tokenizer.lheading(e)) {
|
|
1047
|
+
e = e.substring(l.raw.length), t.push(l);
|
|
1048
|
+
continue;
|
|
1049
|
+
}
|
|
1050
|
+
let h = e;
|
|
1051
|
+
if ((o = this.options.extensions) != null && o.startBlock) {
|
|
1052
|
+
let c = 1 / 0, f = e.slice(1), k;
|
|
1053
|
+
this.options.extensions.startBlock.forEach((m) => {
|
|
1054
|
+
k = m.call({ lexer: this }, f), typeof k == "number" && k >= 0 && (c = Math.min(c, k));
|
|
1055
|
+
}), c < 1 / 0 && c >= 0 && (h = e.substring(0, c + 1));
|
|
1056
|
+
}
|
|
1057
|
+
if (this.state.top && (l = this.tokenizer.paragraph(h))) {
|
|
1058
|
+
let c = t.at(-1);
|
|
1059
|
+
r && (c == null ? void 0 : c.type) === "paragraph" ? (c.raw += (c.raw.endsWith(`
|
|
1060
|
+
`) ? "" : `
|
|
1061
|
+
`) + l.raw, c.text += `
|
|
1062
|
+
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : t.push(l), r = h.length !== e.length, e = e.substring(l.raw.length);
|
|
1063
|
+
continue;
|
|
1064
|
+
}
|
|
1065
|
+
if (l = this.tokenizer.text(e)) {
|
|
1066
|
+
e = e.substring(l.raw.length);
|
|
1067
|
+
let c = t.at(-1);
|
|
1068
|
+
(c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
|
|
1069
|
+
`) ? "" : `
|
|
1070
|
+
`) + l.raw, c.text += `
|
|
1071
|
+
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : t.push(l);
|
|
1072
|
+
continue;
|
|
1073
|
+
}
|
|
1074
|
+
if (e) {
|
|
1075
|
+
let c = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1076
|
+
if (this.options.silent) {
|
|
1077
|
+
console.error(c);
|
|
1078
|
+
break;
|
|
1079
|
+
} else throw new Error(c);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
return this.state.top = !0, t;
|
|
1083
|
+
}
|
|
1084
|
+
inline(e, t = []) {
|
|
1085
|
+
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
1086
|
+
}
|
|
1087
|
+
inlineTokens(e, t = []) {
|
|
1088
|
+
var h, c, f, k, m;
|
|
1089
|
+
let r = e, s = null;
|
|
1090
|
+
if (this.tokens.links) {
|
|
1091
|
+
let p = Object.keys(this.tokens.links);
|
|
1092
|
+
if (p.length > 0) for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(r)) != null; ) p.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
1093
|
+
}
|
|
1094
|
+
for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(r)) != null; ) r = r.slice(0, s.index) + "++" + r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1095
|
+
let a;
|
|
1096
|
+
for (; (s = this.tokenizer.rules.inline.blockSkip.exec(r)) != null; ) a = s[2] ? s[2].length : 0, r = r.slice(0, s.index + a) + "[" + "a".repeat(s[0].length - a - 2) + "]" + r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1097
|
+
r = ((c = (h = this.options.hooks) == null ? void 0 : h.emStrongMask) == null ? void 0 : c.call({ lexer: this }, r)) ?? r;
|
|
1098
|
+
let o = !1, l = "";
|
|
1099
|
+
for (; e; ) {
|
|
1100
|
+
o || (l = ""), o = !1;
|
|
1101
|
+
let p;
|
|
1102
|
+
if ((k = (f = this.options.extensions) == null ? void 0 : f.inline) != null && k.some((x) => (p = x.call({ lexer: this }, e, t)) ? (e = e.substring(p.raw.length), t.push(p), !0) : !1)) continue;
|
|
1103
|
+
if (p = this.tokenizer.escape(e)) {
|
|
1104
|
+
e = e.substring(p.raw.length), t.push(p);
|
|
1105
|
+
continue;
|
|
1106
|
+
}
|
|
1107
|
+
if (p = this.tokenizer.tag(e)) {
|
|
1108
|
+
e = e.substring(p.raw.length), t.push(p);
|
|
1109
|
+
continue;
|
|
1110
|
+
}
|
|
1111
|
+
if (p = this.tokenizer.link(e)) {
|
|
1112
|
+
e = e.substring(p.raw.length), t.push(p);
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
if (p = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
1116
|
+
e = e.substring(p.raw.length);
|
|
1117
|
+
let x = t.at(-1);
|
|
1118
|
+
p.type === "text" && (x == null ? void 0 : x.type) === "text" ? (x.raw += p.raw, x.text += p.text) : t.push(p);
|
|
1119
|
+
continue;
|
|
1120
|
+
}
|
|
1121
|
+
if (p = this.tokenizer.emStrong(e, r, l)) {
|
|
1122
|
+
e = e.substring(p.raw.length), t.push(p);
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
if (p = this.tokenizer.codespan(e)) {
|
|
1126
|
+
e = e.substring(p.raw.length), t.push(p);
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
if (p = this.tokenizer.br(e)) {
|
|
1130
|
+
e = e.substring(p.raw.length), t.push(p);
|
|
1131
|
+
continue;
|
|
1132
|
+
}
|
|
1133
|
+
if (p = this.tokenizer.del(e, r, l)) {
|
|
1134
|
+
e = e.substring(p.raw.length), t.push(p);
|
|
1135
|
+
continue;
|
|
1136
|
+
}
|
|
1137
|
+
if (p = this.tokenizer.autolink(e)) {
|
|
1138
|
+
e = e.substring(p.raw.length), t.push(p);
|
|
1139
|
+
continue;
|
|
1140
|
+
}
|
|
1141
|
+
if (!this.state.inLink && (p = this.tokenizer.url(e))) {
|
|
1142
|
+
e = e.substring(p.raw.length), t.push(p);
|
|
1143
|
+
continue;
|
|
1144
|
+
}
|
|
1145
|
+
let w = e;
|
|
1146
|
+
if ((m = this.options.extensions) != null && m.startInline) {
|
|
1147
|
+
let x = 1 / 0, S = e.slice(1), V;
|
|
1148
|
+
this.options.extensions.startInline.forEach((le) => {
|
|
1149
|
+
V = le.call({ lexer: this }, S), typeof V == "number" && V >= 0 && (x = Math.min(x, V));
|
|
1150
|
+
}), x < 1 / 0 && x >= 0 && (w = e.substring(0, x + 1));
|
|
1151
|
+
}
|
|
1152
|
+
if (p = this.tokenizer.inlineText(w)) {
|
|
1153
|
+
e = e.substring(p.raw.length), p.raw.slice(-1) !== "_" && (l = p.raw.slice(-1)), o = !0;
|
|
1154
|
+
let x = t.at(-1);
|
|
1155
|
+
(x == null ? void 0 : x.type) === "text" ? (x.raw += p.raw, x.text += p.text) : t.push(p);
|
|
1156
|
+
continue;
|
|
1157
|
+
}
|
|
1158
|
+
if (e) {
|
|
1159
|
+
let x = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1160
|
+
if (this.options.silent) {
|
|
1161
|
+
console.error(x);
|
|
1162
|
+
break;
|
|
1163
|
+
} else throw new Error(x);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
return t;
|
|
1167
|
+
}
|
|
1168
|
+
}, He = class {
|
|
1169
|
+
constructor(n) {
|
|
1170
|
+
_(this, "options");
|
|
1171
|
+
_(this, "parser");
|
|
1172
|
+
this.options = n || ie;
|
|
1173
|
+
}
|
|
1174
|
+
space(n) {
|
|
1175
|
+
return "";
|
|
1176
|
+
}
|
|
1177
|
+
code({ text: n, lang: e, escaped: t }) {
|
|
1178
|
+
var a;
|
|
1179
|
+
let r = (a = (e || "").match(v.notSpaceStart)) == null ? void 0 : a[0], s = n.replace(v.endingNewline, "") + `
|
|
1180
|
+
`;
|
|
1181
|
+
return r ? '<pre><code class="language-' + Y(r) + '">' + (t ? s : Y(s, !0)) + `</code></pre>
|
|
1182
|
+
` : "<pre><code>" + (t ? s : Y(s, !0)) + `</code></pre>
|
|
1183
|
+
`;
|
|
1184
|
+
}
|
|
1185
|
+
blockquote({ tokens: n }) {
|
|
1186
|
+
return `<blockquote>
|
|
1187
|
+
${this.parser.parse(n)}</blockquote>
|
|
1188
|
+
`;
|
|
1189
|
+
}
|
|
1190
|
+
html({ text: n }) {
|
|
1191
|
+
return n;
|
|
1192
|
+
}
|
|
1193
|
+
def(n) {
|
|
1194
|
+
return "";
|
|
1195
|
+
}
|
|
1196
|
+
heading({ tokens: n, depth: e }) {
|
|
1197
|
+
return `<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
1198
|
+
`;
|
|
1199
|
+
}
|
|
1200
|
+
hr(n) {
|
|
1201
|
+
return `<hr>
|
|
1202
|
+
`;
|
|
1203
|
+
}
|
|
1204
|
+
list(n) {
|
|
1205
|
+
let e = n.ordered, t = n.start, r = "";
|
|
1206
|
+
for (let o = 0; o < n.items.length; o++) {
|
|
1207
|
+
let l = n.items[o];
|
|
1208
|
+
r += this.listitem(l);
|
|
1209
|
+
}
|
|
1210
|
+
let s = e ? "ol" : "ul", a = e && t !== 1 ? ' start="' + t + '"' : "";
|
|
1211
|
+
return "<" + s + a + `>
|
|
1212
|
+
` + r + "</" + s + `>
|
|
1213
|
+
`;
|
|
1214
|
+
}
|
|
1215
|
+
listitem(n) {
|
|
1216
|
+
return `<li>${this.parser.parse(n.tokens)}</li>
|
|
1217
|
+
`;
|
|
1218
|
+
}
|
|
1219
|
+
checkbox({ checked: n }) {
|
|
1220
|
+
return "<input " + (n ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
1221
|
+
}
|
|
1222
|
+
paragraph({ tokens: n }) {
|
|
1223
|
+
return `<p>${this.parser.parseInline(n)}</p>
|
|
1224
|
+
`;
|
|
1225
|
+
}
|
|
1226
|
+
table(n) {
|
|
1227
|
+
let e = "", t = "";
|
|
1228
|
+
for (let s = 0; s < n.header.length; s++) t += this.tablecell(n.header[s]);
|
|
1229
|
+
e += this.tablerow({ text: t });
|
|
1230
|
+
let r = "";
|
|
1231
|
+
for (let s = 0; s < n.rows.length; s++) {
|
|
1232
|
+
let a = n.rows[s];
|
|
1233
|
+
t = "";
|
|
1234
|
+
for (let o = 0; o < a.length; o++) t += this.tablecell(a[o]);
|
|
1235
|
+
r += this.tablerow({ text: t });
|
|
1236
|
+
}
|
|
1237
|
+
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
1238
|
+
<thead>
|
|
1239
|
+
` + e + `</thead>
|
|
1240
|
+
` + r + `</table>
|
|
1241
|
+
`;
|
|
1242
|
+
}
|
|
1243
|
+
tablerow({ text: n }) {
|
|
1244
|
+
return `<tr>
|
|
1245
|
+
${n}</tr>
|
|
1246
|
+
`;
|
|
1247
|
+
}
|
|
1248
|
+
tablecell(n) {
|
|
1249
|
+
let e = this.parser.parseInline(n.tokens), t = n.header ? "th" : "td";
|
|
1250
|
+
return (n.align ? `<${t} align="${n.align}">` : `<${t}>`) + e + `</${t}>
|
|
1251
|
+
`;
|
|
1252
|
+
}
|
|
1253
|
+
strong({ tokens: n }) {
|
|
1254
|
+
return `<strong>${this.parser.parseInline(n)}</strong>`;
|
|
1255
|
+
}
|
|
1256
|
+
em({ tokens: n }) {
|
|
1257
|
+
return `<em>${this.parser.parseInline(n)}</em>`;
|
|
1258
|
+
}
|
|
1259
|
+
codespan({ text: n }) {
|
|
1260
|
+
return `<code>${Y(n, !0)}</code>`;
|
|
1261
|
+
}
|
|
1262
|
+
br(n) {
|
|
1263
|
+
return "<br>";
|
|
1264
|
+
}
|
|
1265
|
+
del({ tokens: n }) {
|
|
1266
|
+
return `<del>${this.parser.parseInline(n)}</del>`;
|
|
1267
|
+
}
|
|
1268
|
+
link({ href: n, title: e, tokens: t }) {
|
|
1269
|
+
let r = this.parser.parseInline(t), s = cn(n);
|
|
1270
|
+
if (s === null) return r;
|
|
1271
|
+
n = s;
|
|
1272
|
+
let a = '<a href="' + n + '"';
|
|
1273
|
+
return e && (a += ' title="' + Y(e) + '"'), a += ">" + r + "</a>", a;
|
|
1274
|
+
}
|
|
1275
|
+
image({ href: n, title: e, text: t, tokens: r }) {
|
|
1276
|
+
r && (t = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1277
|
+
let s = cn(n);
|
|
1278
|
+
if (s === null) return Y(t);
|
|
1279
|
+
n = s;
|
|
1280
|
+
let a = `<img src="${n}" alt="${Y(t)}"`;
|
|
1281
|
+
return e && (a += ` title="${Y(e)}"`), a += ">", a;
|
|
1282
|
+
}
|
|
1283
|
+
text(n) {
|
|
1284
|
+
return "tokens" in n && n.tokens ? this.parser.parseInline(n.tokens) : "escaped" in n && n.escaped ? n.text : Y(n.text);
|
|
1285
|
+
}
|
|
1286
|
+
}, Rt = class {
|
|
1287
|
+
strong({ text: n }) {
|
|
1288
|
+
return n;
|
|
1289
|
+
}
|
|
1290
|
+
em({ text: n }) {
|
|
1291
|
+
return n;
|
|
1292
|
+
}
|
|
1293
|
+
codespan({ text: n }) {
|
|
1294
|
+
return n;
|
|
1295
|
+
}
|
|
1296
|
+
del({ text: n }) {
|
|
1297
|
+
return n;
|
|
1298
|
+
}
|
|
1299
|
+
html({ text: n }) {
|
|
1300
|
+
return n;
|
|
1301
|
+
}
|
|
1302
|
+
text({ text: n }) {
|
|
1303
|
+
return n;
|
|
1304
|
+
}
|
|
1305
|
+
link({ text: n }) {
|
|
1306
|
+
return "" + n;
|
|
1307
|
+
}
|
|
1308
|
+
image({ text: n }) {
|
|
1309
|
+
return "" + n;
|
|
1310
|
+
}
|
|
1311
|
+
br() {
|
|
1312
|
+
return "";
|
|
1313
|
+
}
|
|
1314
|
+
checkbox({ raw: n }) {
|
|
1315
|
+
return n;
|
|
1316
|
+
}
|
|
1317
|
+
}, G = class kt {
|
|
1318
|
+
constructor(e) {
|
|
1319
|
+
_(this, "options");
|
|
1320
|
+
_(this, "renderer");
|
|
1321
|
+
_(this, "textRenderer");
|
|
1322
|
+
this.options = e || ie, this.options.renderer = this.options.renderer || new He(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Rt();
|
|
1323
|
+
}
|
|
1324
|
+
static parse(e, t) {
|
|
1325
|
+
return new kt(t).parse(e);
|
|
1326
|
+
}
|
|
1327
|
+
static parseInline(e, t) {
|
|
1328
|
+
return new kt(t).parseInline(e);
|
|
1329
|
+
}
|
|
1330
|
+
parse(e) {
|
|
1331
|
+
var r, s;
|
|
1332
|
+
let t = "";
|
|
1333
|
+
for (let a = 0; a < e.length; a++) {
|
|
1334
|
+
let o = e[a];
|
|
1335
|
+
if ((s = (r = this.options.extensions) == null ? void 0 : r.renderers) != null && s[o.type]) {
|
|
1336
|
+
let h = o, c = this.options.extensions.renderers[h.type].call({ parser: this }, h);
|
|
1337
|
+
if (c !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(h.type)) {
|
|
1338
|
+
t += c || "";
|
|
1339
|
+
continue;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
let l = o;
|
|
1343
|
+
switch (l.type) {
|
|
1344
|
+
case "space": {
|
|
1345
|
+
t += this.renderer.space(l);
|
|
1346
|
+
break;
|
|
1347
|
+
}
|
|
1348
|
+
case "hr": {
|
|
1349
|
+
t += this.renderer.hr(l);
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
case "heading": {
|
|
1353
|
+
t += this.renderer.heading(l);
|
|
1354
|
+
break;
|
|
1355
|
+
}
|
|
1356
|
+
case "code": {
|
|
1357
|
+
t += this.renderer.code(l);
|
|
1358
|
+
break;
|
|
1359
|
+
}
|
|
1360
|
+
case "table": {
|
|
1361
|
+
t += this.renderer.table(l);
|
|
1362
|
+
break;
|
|
1363
|
+
}
|
|
1364
|
+
case "blockquote": {
|
|
1365
|
+
t += this.renderer.blockquote(l);
|
|
1366
|
+
break;
|
|
1367
|
+
}
|
|
1368
|
+
case "list": {
|
|
1369
|
+
t += this.renderer.list(l);
|
|
1370
|
+
break;
|
|
1371
|
+
}
|
|
1372
|
+
case "checkbox": {
|
|
1373
|
+
t += this.renderer.checkbox(l);
|
|
1374
|
+
break;
|
|
1375
|
+
}
|
|
1376
|
+
case "html": {
|
|
1377
|
+
t += this.renderer.html(l);
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
case "def": {
|
|
1381
|
+
t += this.renderer.def(l);
|
|
1382
|
+
break;
|
|
1383
|
+
}
|
|
1384
|
+
case "paragraph": {
|
|
1385
|
+
t += this.renderer.paragraph(l);
|
|
1386
|
+
break;
|
|
1387
|
+
}
|
|
1388
|
+
case "text": {
|
|
1389
|
+
t += this.renderer.text(l);
|
|
1390
|
+
break;
|
|
1391
|
+
}
|
|
1392
|
+
default: {
|
|
1393
|
+
let h = 'Token with "' + l.type + '" type was not found.';
|
|
1394
|
+
if (this.options.silent) return console.error(h), "";
|
|
1395
|
+
throw new Error(h);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
return t;
|
|
1400
|
+
}
|
|
1401
|
+
parseInline(e, t = this.renderer) {
|
|
1402
|
+
var s, a;
|
|
1403
|
+
let r = "";
|
|
1404
|
+
for (let o = 0; o < e.length; o++) {
|
|
1405
|
+
let l = e[o];
|
|
1406
|
+
if ((a = (s = this.options.extensions) == null ? void 0 : s.renderers) != null && a[l.type]) {
|
|
1407
|
+
let c = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
1408
|
+
if (c !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
|
|
1409
|
+
r += c || "";
|
|
1410
|
+
continue;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
let h = l;
|
|
1414
|
+
switch (h.type) {
|
|
1415
|
+
case "escape": {
|
|
1416
|
+
r += t.text(h);
|
|
1417
|
+
break;
|
|
1418
|
+
}
|
|
1419
|
+
case "html": {
|
|
1420
|
+
r += t.html(h);
|
|
1421
|
+
break;
|
|
1422
|
+
}
|
|
1423
|
+
case "link": {
|
|
1424
|
+
r += t.link(h);
|
|
1425
|
+
break;
|
|
1426
|
+
}
|
|
1427
|
+
case "image": {
|
|
1428
|
+
r += t.image(h);
|
|
1429
|
+
break;
|
|
1430
|
+
}
|
|
1431
|
+
case "checkbox": {
|
|
1432
|
+
r += t.checkbox(h);
|
|
1433
|
+
break;
|
|
1434
|
+
}
|
|
1435
|
+
case "strong": {
|
|
1436
|
+
r += t.strong(h);
|
|
1437
|
+
break;
|
|
1438
|
+
}
|
|
1439
|
+
case "em": {
|
|
1440
|
+
r += t.em(h);
|
|
1441
|
+
break;
|
|
1442
|
+
}
|
|
1443
|
+
case "codespan": {
|
|
1444
|
+
r += t.codespan(h);
|
|
1445
|
+
break;
|
|
1446
|
+
}
|
|
1447
|
+
case "br": {
|
|
1448
|
+
r += t.br(h);
|
|
1449
|
+
break;
|
|
1450
|
+
}
|
|
1451
|
+
case "del": {
|
|
1452
|
+
r += t.del(h);
|
|
1453
|
+
break;
|
|
1454
|
+
}
|
|
1455
|
+
case "text": {
|
|
1456
|
+
r += t.text(h);
|
|
1457
|
+
break;
|
|
1458
|
+
}
|
|
1459
|
+
default: {
|
|
1460
|
+
let c = 'Token with "' + h.type + '" type was not found.';
|
|
1461
|
+
if (this.options.silent) return console.error(c), "";
|
|
1462
|
+
throw new Error(c);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
return r;
|
|
1467
|
+
}
|
|
1468
|
+
}, $e, Re = ($e = class {
|
|
1469
|
+
constructor(n) {
|
|
1470
|
+
_(this, "options");
|
|
1471
|
+
_(this, "block");
|
|
1472
|
+
this.options = n || ie;
|
|
1473
|
+
}
|
|
1474
|
+
preprocess(n) {
|
|
1475
|
+
return n;
|
|
1476
|
+
}
|
|
1477
|
+
postprocess(n) {
|
|
1478
|
+
return n;
|
|
1479
|
+
}
|
|
1480
|
+
processAllTokens(n) {
|
|
1481
|
+
return n;
|
|
1482
|
+
}
|
|
1483
|
+
emStrongMask(n) {
|
|
1484
|
+
return n;
|
|
1485
|
+
}
|
|
1486
|
+
provideLexer() {
|
|
1487
|
+
return this.block ? H.lex : H.lexInline;
|
|
1488
|
+
}
|
|
1489
|
+
provideParser() {
|
|
1490
|
+
return this.block ? G.parse : G.parseInline;
|
|
1491
|
+
}
|
|
1492
|
+
}, _($e, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), _($e, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), $e), es = class {
|
|
1493
|
+
constructor(...n) {
|
|
1494
|
+
_(this, "defaults", bt());
|
|
1495
|
+
_(this, "options", this.setOptions);
|
|
1496
|
+
_(this, "parse", this.parseMarkdown(!0));
|
|
1497
|
+
_(this, "parseInline", this.parseMarkdown(!1));
|
|
1498
|
+
_(this, "Parser", G);
|
|
1499
|
+
_(this, "Renderer", He);
|
|
1500
|
+
_(this, "TextRenderer", Rt);
|
|
1501
|
+
_(this, "Lexer", H);
|
|
1502
|
+
_(this, "Tokenizer", Be);
|
|
1503
|
+
_(this, "Hooks", Re);
|
|
1504
|
+
this.use(...n);
|
|
1505
|
+
}
|
|
1506
|
+
walkTokens(n, e) {
|
|
1507
|
+
var r, s;
|
|
1508
|
+
let t = [];
|
|
1509
|
+
for (let a of n) switch (t = t.concat(e.call(this, a)), a.type) {
|
|
1510
|
+
case "table": {
|
|
1511
|
+
let o = a;
|
|
1512
|
+
for (let l of o.header) t = t.concat(this.walkTokens(l.tokens, e));
|
|
1513
|
+
for (let l of o.rows) for (let h of l) t = t.concat(this.walkTokens(h.tokens, e));
|
|
1514
|
+
break;
|
|
1515
|
+
}
|
|
1516
|
+
case "list": {
|
|
1517
|
+
let o = a;
|
|
1518
|
+
t = t.concat(this.walkTokens(o.items, e));
|
|
1519
|
+
break;
|
|
1520
|
+
}
|
|
1521
|
+
default: {
|
|
1522
|
+
let o = a;
|
|
1523
|
+
(s = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && s[o.type] ? this.defaults.extensions.childTokens[o.type].forEach((l) => {
|
|
1524
|
+
let h = o[l].flat(1 / 0);
|
|
1525
|
+
t = t.concat(this.walkTokens(h, e));
|
|
1526
|
+
}) : o.tokens && (t = t.concat(this.walkTokens(o.tokens, e)));
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
return t;
|
|
1530
|
+
}
|
|
1531
|
+
use(...n) {
|
|
1532
|
+
let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1533
|
+
return n.forEach((t) => {
|
|
1534
|
+
let r = { ...t };
|
|
1535
|
+
if (r.async = this.defaults.async || r.async || !1, t.extensions && (t.extensions.forEach((s) => {
|
|
1536
|
+
if (!s.name) throw new Error("extension name required");
|
|
1537
|
+
if ("renderer" in s) {
|
|
1538
|
+
let a = e.renderers[s.name];
|
|
1539
|
+
a ? e.renderers[s.name] = function(...o) {
|
|
1540
|
+
let l = s.renderer.apply(this, o);
|
|
1541
|
+
return l === !1 && (l = a.apply(this, o)), l;
|
|
1542
|
+
} : e.renderers[s.name] = s.renderer;
|
|
1543
|
+
}
|
|
1544
|
+
if ("tokenizer" in s) {
|
|
1545
|
+
if (!s.level || s.level !== "block" && s.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1546
|
+
let a = e[s.level];
|
|
1547
|
+
a ? a.unshift(s.tokenizer) : e[s.level] = [s.tokenizer], s.start && (s.level === "block" ? e.startBlock ? e.startBlock.push(s.start) : e.startBlock = [s.start] : s.level === "inline" && (e.startInline ? e.startInline.push(s.start) : e.startInline = [s.start]));
|
|
1548
|
+
}
|
|
1549
|
+
"childTokens" in s && s.childTokens && (e.childTokens[s.name] = s.childTokens);
|
|
1550
|
+
}), r.extensions = e), t.renderer) {
|
|
1551
|
+
let s = this.defaults.renderer || new He(this.defaults);
|
|
1552
|
+
for (let a in t.renderer) {
|
|
1553
|
+
if (!(a in s)) throw new Error(`renderer '${a}' does not exist`);
|
|
1554
|
+
if (["options", "parser"].includes(a)) continue;
|
|
1555
|
+
let o = a, l = t.renderer[o], h = s[o];
|
|
1556
|
+
s[o] = (...c) => {
|
|
1557
|
+
let f = l.apply(s, c);
|
|
1558
|
+
return f === !1 && (f = h.apply(s, c)), f || "";
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
r.renderer = s;
|
|
1562
|
+
}
|
|
1563
|
+
if (t.tokenizer) {
|
|
1564
|
+
let s = this.defaults.tokenizer || new Be(this.defaults);
|
|
1565
|
+
for (let a in t.tokenizer) {
|
|
1566
|
+
if (!(a in s)) throw new Error(`tokenizer '${a}' does not exist`);
|
|
1567
|
+
if (["options", "rules", "lexer"].includes(a)) continue;
|
|
1568
|
+
let o = a, l = t.tokenizer[o], h = s[o];
|
|
1569
|
+
s[o] = (...c) => {
|
|
1570
|
+
let f = l.apply(s, c);
|
|
1571
|
+
return f === !1 && (f = h.apply(s, c)), f;
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
r.tokenizer = s;
|
|
1575
|
+
}
|
|
1576
|
+
if (t.hooks) {
|
|
1577
|
+
let s = this.defaults.hooks || new Re();
|
|
1578
|
+
for (let a in t.hooks) {
|
|
1579
|
+
if (!(a in s)) throw new Error(`hook '${a}' does not exist`);
|
|
1580
|
+
if (["options", "block"].includes(a)) continue;
|
|
1581
|
+
let o = a, l = t.hooks[o], h = s[o];
|
|
1582
|
+
Re.passThroughHooks.has(a) ? s[o] = (c) => {
|
|
1583
|
+
if (this.defaults.async && Re.passThroughHooksRespectAsync.has(a)) return (async () => {
|
|
1584
|
+
let k = await l.call(s, c);
|
|
1585
|
+
return h.call(s, k);
|
|
1586
|
+
})();
|
|
1587
|
+
let f = l.call(s, c);
|
|
1588
|
+
return h.call(s, f);
|
|
1589
|
+
} : s[o] = (...c) => {
|
|
1590
|
+
if (this.defaults.async) return (async () => {
|
|
1591
|
+
let k = await l.apply(s, c);
|
|
1592
|
+
return k === !1 && (k = await h.apply(s, c)), k;
|
|
1593
|
+
})();
|
|
1594
|
+
let f = l.apply(s, c);
|
|
1595
|
+
return f === !1 && (f = h.apply(s, c)), f;
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
r.hooks = s;
|
|
1599
|
+
}
|
|
1600
|
+
if (t.walkTokens) {
|
|
1601
|
+
let s = this.defaults.walkTokens, a = t.walkTokens;
|
|
1602
|
+
r.walkTokens = function(o) {
|
|
1603
|
+
let l = [];
|
|
1604
|
+
return l.push(a.call(this, o)), s && (l = l.concat(s.call(this, o))), l;
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
this.defaults = { ...this.defaults, ...r };
|
|
1608
|
+
}), this;
|
|
1609
|
+
}
|
|
1610
|
+
setOptions(n) {
|
|
1611
|
+
return this.defaults = { ...this.defaults, ...n }, this;
|
|
1612
|
+
}
|
|
1613
|
+
lexer(n, e) {
|
|
1614
|
+
return H.lex(n, e ?? this.defaults);
|
|
1615
|
+
}
|
|
1616
|
+
parser(n, e) {
|
|
1617
|
+
return G.parse(n, e ?? this.defaults);
|
|
1618
|
+
}
|
|
1619
|
+
parseMarkdown(n) {
|
|
1620
|
+
return (e, t) => {
|
|
1621
|
+
let r = { ...t }, s = { ...this.defaults, ...r }, a = this.onError(!!s.silent, !!s.async);
|
|
1622
|
+
if (this.defaults.async === !0 && r.async === !1) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
1623
|
+
if (typeof e > "u" || e === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
1624
|
+
if (typeof e != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
1625
|
+
if (s.hooks && (s.hooks.options = s, s.hooks.block = n), s.async) return (async () => {
|
|
1626
|
+
let o = s.hooks ? await s.hooks.preprocess(e) : e, l = await (s.hooks ? await s.hooks.provideLexer() : n ? H.lex : H.lexInline)(o, s), h = s.hooks ? await s.hooks.processAllTokens(l) : l;
|
|
1627
|
+
s.walkTokens && await Promise.all(this.walkTokens(h, s.walkTokens));
|
|
1628
|
+
let c = await (s.hooks ? await s.hooks.provideParser() : n ? G.parse : G.parseInline)(h, s);
|
|
1629
|
+
return s.hooks ? await s.hooks.postprocess(c) : c;
|
|
1630
|
+
})().catch(a);
|
|
1631
|
+
try {
|
|
1632
|
+
s.hooks && (e = s.hooks.preprocess(e));
|
|
1633
|
+
let o = (s.hooks ? s.hooks.provideLexer() : n ? H.lex : H.lexInline)(e, s);
|
|
1634
|
+
s.hooks && (o = s.hooks.processAllTokens(o)), s.walkTokens && this.walkTokens(o, s.walkTokens);
|
|
1635
|
+
let l = (s.hooks ? s.hooks.provideParser() : n ? G.parse : G.parseInline)(o, s);
|
|
1636
|
+
return s.hooks && (l = s.hooks.postprocess(l)), l;
|
|
1637
|
+
} catch (o) {
|
|
1638
|
+
return a(o);
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
onError(n, e) {
|
|
1643
|
+
return (t) => {
|
|
1644
|
+
if (t.message += `
|
|
1645
|
+
Please report this to https://github.com/markedjs/marked.`, n) {
|
|
1646
|
+
let r = "<p>An error occurred:</p><pre>" + Y(t.message + "", !0) + "</pre>";
|
|
1647
|
+
return e ? Promise.resolve(r) : r;
|
|
1648
|
+
}
|
|
1649
|
+
if (e) return Promise.reject(t);
|
|
1650
|
+
throw t;
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1653
|
+
}, se = new es();
|
|
1654
|
+
function A(n, e) {
|
|
1655
|
+
return se.parse(n, e);
|
|
1656
|
+
}
|
|
1657
|
+
A.options = A.setOptions = function(n) {
|
|
1658
|
+
return se.setOptions(n), A.defaults = se.defaults, mn(A.defaults), A;
|
|
1659
|
+
};
|
|
1660
|
+
A.getDefaults = bt;
|
|
1661
|
+
A.defaults = ie;
|
|
1662
|
+
A.use = function(...n) {
|
|
1663
|
+
return se.use(...n), A.defaults = se.defaults, mn(A.defaults), A;
|
|
1664
|
+
};
|
|
1665
|
+
A.walkTokens = function(n, e) {
|
|
1666
|
+
return se.walkTokens(n, e);
|
|
1667
|
+
};
|
|
1668
|
+
A.parseInline = se.parseInline;
|
|
1669
|
+
A.Parser = G;
|
|
1670
|
+
A.parser = G.parse;
|
|
1671
|
+
A.Renderer = He;
|
|
1672
|
+
A.TextRenderer = Rt;
|
|
1673
|
+
A.Lexer = H;
|
|
1674
|
+
A.lexer = H.lex;
|
|
1675
|
+
A.Tokenizer = Be;
|
|
1676
|
+
A.Hooks = Re;
|
|
1677
|
+
A.parse = A;
|
|
1678
|
+
A.options;
|
|
1679
|
+
A.setOptions;
|
|
1680
|
+
A.use;
|
|
1681
|
+
A.walkTokens;
|
|
1682
|
+
A.parseInline;
|
|
1683
|
+
G.parse;
|
|
1684
|
+
H.lex;
|
|
1685
|
+
function ns(n) {
|
|
1686
|
+
if (!n) return "";
|
|
1687
|
+
const e = A.parse(n);
|
|
1688
|
+
return pr.sanitize(e);
|
|
1689
|
+
}
|
|
1690
|
+
export {
|
|
1691
|
+
ns as default
|
|
1692
|
+
};
|