@incodetech/web 0.0.0-dev-20260320-c9bdba0 → 0.0.0-dev-20260320-e46eb90
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/{Trans-Cm7gi0st.js → Trans-Bw5n8KhH.js} +2 -2
- package/dist/{addressAutocomplete-BIQwiDWk.js → addressAutocomplete-D7g-naeA.js} +6 -6
- package/dist/authentication/authentication.es.js +5 -5
- package/dist/base.css +93 -0
- package/dist/{button-zCdeDeEB.js → button-Yr39X4SE.js} +2 -2
- package/dist/{captureFooter-SNtyUXrI.js → captureFooter-Dum5qpdZ.js} +4 -4
- package/dist/checkbox-BkW6ZbEQ.js +137 -0
- package/dist/{chevronDown-DRVnB275.js → chevronDown-CsZysK60.js} +1 -1
- package/dist/{closeIcon-D2dmrZca.js → closeIcon-DrD_JWne.js} +1 -1
- package/dist/consent/consent.es.js +1889 -0
- package/dist/consent/styles.css +113 -0
- package/dist/curp-validation/curp-validation.es.js +11 -11
- package/dist/{dateInputComposed-C8WTSu9L.js → dateInputComposed-CjfYBUJj.js} +4 -4
- package/dist/{documentCapture-DWNK3phM.js → documentCapture-DGJU-4sT.js} +10 -10
- package/dist/{dropdownComposed-Cg6lQD2C.js → dropdownComposed-DLZ4R_VD.js} +5 -5
- package/dist/{ekybModule-DtMbgF08.js → ekybModule-CnuxaZ9k.js} +10 -10
- package/dist/{ekycModule-DEMkVZr2.js → ekycModule-BggwsBOH.js} +11 -11
- package/dist/email/email.es.js +6 -6
- package/dist/{errorContent-B3YzH-UQ.js → errorContent-LcOhVnBZ.js} +6 -6
- package/dist/{errorIcon-bIXk9nAy.js → errorIcon-DOyZZgsP.js} +1 -1
- package/dist/extensibility.es.js +56 -55
- package/dist/{faceMatch-BdMwIeBs.js → faceMatch-C5Sgst55.js} +5 -5
- package/dist/{fileIcon-E4B7hd8V.js → fileIcon--4cgz7hZ.js} +1 -1
- package/dist/{flipAnimation-CnXEIDH1.js → flipAnimation-CJfs4vnz.js} +379 -509
- package/dist/flow/flow.es.js +290 -275
- package/dist/flow/styles.css +149 -0
- package/dist/{formField-hlgxOSE6.js → formField-6BHE59Av.js} +8 -8
- package/dist/geolocation/geolocation.es.js +6 -6
- package/dist/governmentValidation/governmentValidation.es.js +10 -10
- package/dist/id/id.es.js +15 -15
- package/dist/{incodeModule-aE-LkKwM.js → incodeModule-Bxzkb7nW.js} +1 -1
- package/dist/index.es.js +3 -3
- package/dist/{inputComposed-CyGtRLzv.js → inputComposed-n2VIh213.js} +5 -5
- package/dist/{manualCaptureButton-iYqQECzn.js → manualCaptureButton-CtHbJjgz.js} +9 -9
- package/dist/{otpInput-B3iNW8b5.js → otpInput-2bT7uNnk.js} +4 -4
- package/dist/{page-Dv0s0RPn.js → page-DO2rYslN.js} +2 -2
- package/dist/phone/phone.es.js +7 -7
- package/dist/{phoneInput-NVIE7YFb.js → phoneInput-B7gKhoUa.js} +3 -3
- package/dist/{phoneInputComposed-DNfU__MR.js → phoneInputComposed-C66n6e7L.js} +114 -100
- package/dist/{processing-BhY0-0xy.js → processing-BGKugkCh.js} +4 -4
- package/dist/selfie/selfie.es.js +6 -6
- package/dist/{spinner-BbVGMG-G.js → spinner-Djok6FY8.js} +2 -2
- package/dist/{successIcon-DN8LMqE2.js → successIcon-CjkBWk8J.js} +1 -1
- package/dist/{tutorial-CDJugc5j.js → tutorial-Dptz5zyj.js} +8 -8
- package/dist/types/consent.d.ts +36 -0
- package/dist/{uiConfig-Z6RT23Sl.js → uiConfig-CKJmKRCo.js} +1 -1
- package/dist/{useMediaQuery-CiSMgDyi.js → useMediaQuery-DSN9IIfj.js} +1 -1
- package/dist/{vendor-preact-BXf0bkEs.js → vendor-preact--mDTxXnt.js} +2 -1
- package/dist/{warningIcon-BBoCroUd.js → warningIcon-DgHOtF9T.js} +1 -1
- package/package.json +12 -2
|
@@ -0,0 +1,1889 @@
|
|
|
1
|
+
var Yn = Object.defineProperty;
|
|
2
|
+
var Xn = (r, e, t) => e in r ? Yn(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var A = (r, e, t) => Xn(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { u as v, I as Qn, b as Vn, a as Kn, B as Jn } from "../button-Yr39X4SE.js";
|
|
5
|
+
import { createConsentManager as er } from "@incodetech/core/consent";
|
|
6
|
+
import "../uiConfig-CKJmKRCo.js";
|
|
7
|
+
import { _ as tr, x as nr } from "../vendor-preact--mDTxXnt.js";
|
|
8
|
+
import "@incodetech/core";
|
|
9
|
+
import { C as rr } from "../checkbox-BkW6ZbEQ.js";
|
|
10
|
+
import { P as on } from "../page-DO2rYslN.js";
|
|
11
|
+
import { S as sr } from "../spinner-Djok6FY8.js";
|
|
12
|
+
import { r as ir } from "../incodeModule-Bxzkb7nW.js";
|
|
13
|
+
const {
|
|
14
|
+
entries: Sn,
|
|
15
|
+
setPrototypeOf: cn,
|
|
16
|
+
isFrozen: lr,
|
|
17
|
+
getPrototypeOf: ar,
|
|
18
|
+
getOwnPropertyDescriptor: or
|
|
19
|
+
} = Object;
|
|
20
|
+
let {
|
|
21
|
+
freeze: $,
|
|
22
|
+
seal: Z,
|
|
23
|
+
create: Ke
|
|
24
|
+
} = Object, {
|
|
25
|
+
apply: yt,
|
|
26
|
+
construct: Et
|
|
27
|
+
} = typeof Reflect < "u" && Reflect;
|
|
28
|
+
$ || ($ = function(e) {
|
|
29
|
+
return e;
|
|
30
|
+
});
|
|
31
|
+
Z || (Z = function(e) {
|
|
32
|
+
return e;
|
|
33
|
+
});
|
|
34
|
+
yt || (yt = function(e, t) {
|
|
35
|
+
for (var s = arguments.length, n = new Array(s > 2 ? s - 2 : 0), l = 2; l < s; l++)
|
|
36
|
+
n[l - 2] = arguments[l];
|
|
37
|
+
return e.apply(t, n);
|
|
38
|
+
});
|
|
39
|
+
Et || (Et = function(e) {
|
|
40
|
+
for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
41
|
+
s[n - 1] = arguments[n];
|
|
42
|
+
return new e(...s);
|
|
43
|
+
});
|
|
44
|
+
const Ye = U(Array.prototype.forEach), cr = U(Array.prototype.lastIndexOf), pn = U(Array.prototype.pop), Ie = U(Array.prototype.push), pr = U(Array.prototype.splice), Je = U(String.prototype.toLowerCase), bt = U(String.prototype.toString), xt = U(String.prototype.match), De = U(String.prototype.replace), ur = U(String.prototype.indexOf), hr = U(String.prototype.trim), W = U(Object.prototype.hasOwnProperty), M = U(RegExp.prototype.test), Oe = fr(TypeError);
|
|
45
|
+
function U(r) {
|
|
46
|
+
return function(e) {
|
|
47
|
+
e instanceof RegExp && (e.lastIndex = 0);
|
|
48
|
+
for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
49
|
+
s[n - 1] = arguments[n];
|
|
50
|
+
return yt(r, e, s);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function fr(r) {
|
|
54
|
+
return function() {
|
|
55
|
+
for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
|
|
56
|
+
t[s] = arguments[s];
|
|
57
|
+
return Et(r, t);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function k(r, e) {
|
|
61
|
+
let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Je;
|
|
62
|
+
cn && cn(r, null);
|
|
63
|
+
let s = e.length;
|
|
64
|
+
for (; s--; ) {
|
|
65
|
+
let n = e[s];
|
|
66
|
+
if (typeof n == "string") {
|
|
67
|
+
const l = t(n);
|
|
68
|
+
l !== n && (lr(e) || (e[s] = l), n = l);
|
|
69
|
+
}
|
|
70
|
+
r[n] = !0;
|
|
71
|
+
}
|
|
72
|
+
return r;
|
|
73
|
+
}
|
|
74
|
+
function gr(r) {
|
|
75
|
+
for (let e = 0; e < r.length; e++)
|
|
76
|
+
W(r, e) || (r[e] = null);
|
|
77
|
+
return r;
|
|
78
|
+
}
|
|
79
|
+
function ee(r) {
|
|
80
|
+
const e = Ke(null);
|
|
81
|
+
for (const [t, s] of Sn(r))
|
|
82
|
+
W(r, t) && (Array.isArray(s) ? e[t] = gr(s) : s && typeof s == "object" && s.constructor === Object ? e[t] = ee(s) : e[t] = s);
|
|
83
|
+
return e;
|
|
84
|
+
}
|
|
85
|
+
function ve(r, e) {
|
|
86
|
+
for (; r !== null; ) {
|
|
87
|
+
const s = or(r, e);
|
|
88
|
+
if (s) {
|
|
89
|
+
if (s.get)
|
|
90
|
+
return U(s.get);
|
|
91
|
+
if (typeof s.value == "function")
|
|
92
|
+
return U(s.value);
|
|
93
|
+
}
|
|
94
|
+
r = ar(r);
|
|
95
|
+
}
|
|
96
|
+
function t() {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
return t;
|
|
100
|
+
}
|
|
101
|
+
const un = $(["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"]), Tt = $(["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"]), wt = $(["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"]), dr = $(["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"]), At = $(["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"]), mr = $(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), hn = $(["#text"]), fn = $(["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"]), _t = $(["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"]), gn = $(["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"]), Xe = $(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), kr = Z(/\{\{[\w\W]*|[\w\W]*\}\}/gm), br = Z(/<%[\w\W]*|[\w\W]*%>/gm), xr = Z(/\$\{[\w\W]*/gm), Tr = Z(/^data-[\-\w.\u00B7-\uFFFF]+$/), wr = Z(/^aria-[\-\w]+$/), Rn = Z(
|
|
102
|
+
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
103
|
+
// eslint-disable-line no-useless-escape
|
|
104
|
+
), Ar = Z(/^(?:\w+script|data):/i), _r = Z(
|
|
105
|
+
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
106
|
+
// eslint-disable-line no-control-regex
|
|
107
|
+
), Cn = Z(/^html$/i), yr = Z(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
108
|
+
var dn = /* @__PURE__ */ Object.freeze({
|
|
109
|
+
__proto__: null,
|
|
110
|
+
ARIA_ATTR: wr,
|
|
111
|
+
ATTR_WHITESPACE: _r,
|
|
112
|
+
CUSTOM_ELEMENT: yr,
|
|
113
|
+
DATA_ATTR: Tr,
|
|
114
|
+
DOCTYPE_NAME: Cn,
|
|
115
|
+
ERB_EXPR: br,
|
|
116
|
+
IS_ALLOWED_URI: Rn,
|
|
117
|
+
IS_SCRIPT_OR_DATA: Ar,
|
|
118
|
+
MUSTACHE_EXPR: kr,
|
|
119
|
+
TMPLIT_EXPR: xr
|
|
120
|
+
});
|
|
121
|
+
const Ne = {
|
|
122
|
+
element: 1,
|
|
123
|
+
text: 3,
|
|
124
|
+
// Deprecated
|
|
125
|
+
progressingInstruction: 7,
|
|
126
|
+
comment: 8,
|
|
127
|
+
document: 9
|
|
128
|
+
}, Er = function() {
|
|
129
|
+
return typeof window > "u" ? null : window;
|
|
130
|
+
}, Sr = function(e, t) {
|
|
131
|
+
if (typeof e != "object" || typeof e.createPolicy != "function")
|
|
132
|
+
return null;
|
|
133
|
+
let s = null;
|
|
134
|
+
const n = "data-tt-policy-suffix";
|
|
135
|
+
t && t.hasAttribute(n) && (s = t.getAttribute(n));
|
|
136
|
+
const l = "dompurify" + (s ? "#" + s : "");
|
|
137
|
+
try {
|
|
138
|
+
return e.createPolicy(l, {
|
|
139
|
+
createHTML(a) {
|
|
140
|
+
return a;
|
|
141
|
+
},
|
|
142
|
+
createScriptURL(a) {
|
|
143
|
+
return a;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
} catch {
|
|
147
|
+
return console.warn("TrustedTypes policy " + l + " could not be created."), null;
|
|
148
|
+
}
|
|
149
|
+
}, mn = function() {
|
|
150
|
+
return {
|
|
151
|
+
afterSanitizeAttributes: [],
|
|
152
|
+
afterSanitizeElements: [],
|
|
153
|
+
afterSanitizeShadowDOM: [],
|
|
154
|
+
beforeSanitizeAttributes: [],
|
|
155
|
+
beforeSanitizeElements: [],
|
|
156
|
+
beforeSanitizeShadowDOM: [],
|
|
157
|
+
uponSanitizeAttribute: [],
|
|
158
|
+
uponSanitizeElement: [],
|
|
159
|
+
uponSanitizeShadowNode: []
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
function Ln() {
|
|
163
|
+
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Er();
|
|
164
|
+
const e = (g) => Ln(g);
|
|
165
|
+
if (e.version = "3.3.3", e.removed = [], !r || !r.document || r.document.nodeType !== Ne.document || !r.Element)
|
|
166
|
+
return e.isSupported = !1, e;
|
|
167
|
+
let {
|
|
168
|
+
document: t
|
|
169
|
+
} = r;
|
|
170
|
+
const s = t, n = s.currentScript, {
|
|
171
|
+
DocumentFragment: l,
|
|
172
|
+
HTMLTemplateElement: a,
|
|
173
|
+
Node: c,
|
|
174
|
+
Element: o,
|
|
175
|
+
NodeFilter: h,
|
|
176
|
+
NamedNodeMap: u = r.NamedNodeMap || r.MozNamedAttrMap,
|
|
177
|
+
HTMLFormElement: m,
|
|
178
|
+
DOMParser: d,
|
|
179
|
+
trustedTypes: T
|
|
180
|
+
} = r, b = o.prototype, I = ve(b, "cloneNode"), ie = ve(b, "remove"), j = ve(b, "nextSibling"), B = ve(b, "childNodes"), V = ve(b, "parentNode");
|
|
181
|
+
if (typeof a == "function") {
|
|
182
|
+
const g = t.createElement("template");
|
|
183
|
+
g.content && g.content.ownerDocument && (t = g.content.ownerDocument);
|
|
184
|
+
}
|
|
185
|
+
let y, N = "";
|
|
186
|
+
const {
|
|
187
|
+
implementation: Y,
|
|
188
|
+
createNodeIterator: le,
|
|
189
|
+
createDocumentFragment: Ue,
|
|
190
|
+
getElementsByTagName: Ee
|
|
191
|
+
} = t, {
|
|
192
|
+
importNode: ue
|
|
193
|
+
} = s;
|
|
194
|
+
let E = mn();
|
|
195
|
+
e.isSupported = typeof Sn == "function" && typeof V == "function" && Y && Y.createHTMLDocument !== void 0;
|
|
196
|
+
const {
|
|
197
|
+
MUSTACHE_EXPR: H,
|
|
198
|
+
ERB_EXPR: ae,
|
|
199
|
+
TMPLIT_EXPR: oe,
|
|
200
|
+
DATA_ATTR: Se,
|
|
201
|
+
ARIA_ATTR: lt,
|
|
202
|
+
IS_SCRIPT_OR_DATA: he,
|
|
203
|
+
ATTR_WHITESPACE: G,
|
|
204
|
+
CUSTOM_ELEMENT: ce
|
|
205
|
+
} = dn;
|
|
206
|
+
let {
|
|
207
|
+
IS_ALLOWED_URI: $t
|
|
208
|
+
} = dn, L = null;
|
|
209
|
+
const Ut = k({}, [...un, ...Tt, ...wt, ...At, ...hn]);
|
|
210
|
+
let D = null;
|
|
211
|
+
const Ft = k({}, [...fn, ..._t, ...gn, ...Xe]);
|
|
212
|
+
let S = Object.seal(Ke(null, {
|
|
213
|
+
tagNameCheck: {
|
|
214
|
+
writable: !0,
|
|
215
|
+
configurable: !1,
|
|
216
|
+
enumerable: !0,
|
|
217
|
+
value: null
|
|
218
|
+
},
|
|
219
|
+
attributeNameCheck: {
|
|
220
|
+
writable: !0,
|
|
221
|
+
configurable: !1,
|
|
222
|
+
enumerable: !0,
|
|
223
|
+
value: null
|
|
224
|
+
},
|
|
225
|
+
allowCustomizedBuiltInElements: {
|
|
226
|
+
writable: !0,
|
|
227
|
+
configurable: !1,
|
|
228
|
+
enumerable: !0,
|
|
229
|
+
value: !1
|
|
230
|
+
}
|
|
231
|
+
})), Re = null, Fe = null;
|
|
232
|
+
const pe = Object.seal(Ke(null, {
|
|
233
|
+
tagCheck: {
|
|
234
|
+
writable: !0,
|
|
235
|
+
configurable: !1,
|
|
236
|
+
enumerable: !0,
|
|
237
|
+
value: null
|
|
238
|
+
},
|
|
239
|
+
attributeCheck: {
|
|
240
|
+
writable: !0,
|
|
241
|
+
configurable: !1,
|
|
242
|
+
enumerable: !0,
|
|
243
|
+
value: null
|
|
244
|
+
}
|
|
245
|
+
}));
|
|
246
|
+
let Bt = !0, at = !0, Ht = !1, Gt = !0, be = !1, Be = !0, fe = !1, ot = !1, ct = !1, xe = !1, He = !1, Ge = !1, Wt = !0, qt = !1;
|
|
247
|
+
const Fn = "user-content-";
|
|
248
|
+
let pt = !0, Ce = !1, Te = {}, K = null;
|
|
249
|
+
const ut = k({}, ["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"]);
|
|
250
|
+
let Zt = null;
|
|
251
|
+
const jt = k({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
252
|
+
let ht = null;
|
|
253
|
+
const Yt = k({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), We = "http://www.w3.org/1998/Math/MathML", qe = "http://www.w3.org/2000/svg", ne = "http://www.w3.org/1999/xhtml";
|
|
254
|
+
let we = ne, ft = !1, gt = null;
|
|
255
|
+
const Bn = k({}, [We, qe, ne], bt);
|
|
256
|
+
let Ze = k({}, ["mi", "mo", "mn", "ms", "mtext"]), je = k({}, ["annotation-xml"]);
|
|
257
|
+
const Hn = k({}, ["title", "style", "font", "a", "script"]);
|
|
258
|
+
let Le = null;
|
|
259
|
+
const Gn = ["application/xhtml+xml", "text/html"], Wn = "text/html";
|
|
260
|
+
let C = null, Ae = null;
|
|
261
|
+
const qn = t.createElement("form"), Xt = function(i) {
|
|
262
|
+
return i instanceof RegExp || i instanceof Function;
|
|
263
|
+
}, dt = function() {
|
|
264
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
265
|
+
if (!(Ae && Ae === i)) {
|
|
266
|
+
if ((!i || typeof i != "object") && (i = {}), i = ee(i), Le = // eslint-disable-next-line unicorn/prefer-includes
|
|
267
|
+
Gn.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? Wn : i.PARSER_MEDIA_TYPE, C = Le === "application/xhtml+xml" ? bt : Je, L = W(i, "ALLOWED_TAGS") ? k({}, i.ALLOWED_TAGS, C) : Ut, D = W(i, "ALLOWED_ATTR") ? k({}, i.ALLOWED_ATTR, C) : Ft, gt = W(i, "ALLOWED_NAMESPACES") ? k({}, i.ALLOWED_NAMESPACES, bt) : Bn, ht = W(i, "ADD_URI_SAFE_ATTR") ? k(ee(Yt), i.ADD_URI_SAFE_ATTR, C) : Yt, Zt = W(i, "ADD_DATA_URI_TAGS") ? k(ee(jt), i.ADD_DATA_URI_TAGS, C) : jt, K = W(i, "FORBID_CONTENTS") ? k({}, i.FORBID_CONTENTS, C) : ut, Re = W(i, "FORBID_TAGS") ? k({}, i.FORBID_TAGS, C) : ee({}), Fe = W(i, "FORBID_ATTR") ? k({}, i.FORBID_ATTR, C) : ee({}), Te = W(i, "USE_PROFILES") ? i.USE_PROFILES : !1, Bt = i.ALLOW_ARIA_ATTR !== !1, at = i.ALLOW_DATA_ATTR !== !1, Ht = i.ALLOW_UNKNOWN_PROTOCOLS || !1, Gt = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, be = i.SAFE_FOR_TEMPLATES || !1, Be = i.SAFE_FOR_XML !== !1, fe = i.WHOLE_DOCUMENT || !1, xe = i.RETURN_DOM || !1, He = i.RETURN_DOM_FRAGMENT || !1, Ge = i.RETURN_TRUSTED_TYPE || !1, ct = i.FORCE_BODY || !1, Wt = i.SANITIZE_DOM !== !1, qt = i.SANITIZE_NAMED_PROPS || !1, pt = i.KEEP_CONTENT !== !1, Ce = i.IN_PLACE || !1, $t = i.ALLOWED_URI_REGEXP || Rn, we = i.NAMESPACE || ne, Ze = i.MATHML_TEXT_INTEGRATION_POINTS || Ze, je = i.HTML_INTEGRATION_POINTS || je, S = i.CUSTOM_ELEMENT_HANDLING || {}, i.CUSTOM_ELEMENT_HANDLING && Xt(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (S.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && Xt(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (S.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (S.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), be && (at = !1), He && (xe = !0), Te && (L = k({}, hn), D = Ke(null), Te.html === !0 && (k(L, un), k(D, fn)), Te.svg === !0 && (k(L, Tt), k(D, _t), k(D, Xe)), Te.svgFilters === !0 && (k(L, wt), k(D, _t), k(D, Xe)), Te.mathMl === !0 && (k(L, At), k(D, gn), k(D, Xe))), W(i, "ADD_TAGS") || (pe.tagCheck = null), W(i, "ADD_ATTR") || (pe.attributeCheck = null), i.ADD_TAGS && (typeof i.ADD_TAGS == "function" ? pe.tagCheck = i.ADD_TAGS : (L === Ut && (L = ee(L)), k(L, i.ADD_TAGS, C))), i.ADD_ATTR && (typeof i.ADD_ATTR == "function" ? pe.attributeCheck = i.ADD_ATTR : (D === Ft && (D = ee(D)), k(D, i.ADD_ATTR, C))), i.ADD_URI_SAFE_ATTR && k(ht, i.ADD_URI_SAFE_ATTR, C), i.FORBID_CONTENTS && (K === ut && (K = ee(K)), k(K, i.FORBID_CONTENTS, C)), i.ADD_FORBID_CONTENTS && (K === ut && (K = ee(K)), k(K, i.ADD_FORBID_CONTENTS, C)), pt && (L["#text"] = !0), fe && k(L, ["html", "head", "body"]), L.table && (k(L, ["tbody"]), delete Re.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
268
|
+
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
269
|
+
throw Oe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
270
|
+
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
271
|
+
throw Oe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
272
|
+
y = i.TRUSTED_TYPES_POLICY, N = y.createHTML("");
|
|
273
|
+
} else
|
|
274
|
+
y === void 0 && (y = Sr(T, n)), y !== null && typeof N == "string" && (N = y.createHTML(""));
|
|
275
|
+
$ && $(i), Ae = i;
|
|
276
|
+
}
|
|
277
|
+
}, Qt = k({}, [...Tt, ...wt, ...dr]), Vt = k({}, [...At, ...mr]), Zn = function(i) {
|
|
278
|
+
let p = V(i);
|
|
279
|
+
(!p || !p.tagName) && (p = {
|
|
280
|
+
namespaceURI: we,
|
|
281
|
+
tagName: "template"
|
|
282
|
+
});
|
|
283
|
+
const f = Je(i.tagName), _ = Je(p.tagName);
|
|
284
|
+
return gt[i.namespaceURI] ? i.namespaceURI === qe ? p.namespaceURI === ne ? f === "svg" : p.namespaceURI === We ? f === "svg" && (_ === "annotation-xml" || Ze[_]) : !!Qt[f] : i.namespaceURI === We ? p.namespaceURI === ne ? f === "math" : p.namespaceURI === qe ? f === "math" && je[_] : !!Vt[f] : i.namespaceURI === ne ? p.namespaceURI === qe && !je[_] || p.namespaceURI === We && !Ze[_] ? !1 : !Vt[f] && (Hn[f] || !Qt[f]) : !!(Le === "application/xhtml+xml" && gt[i.namespaceURI]) : !1;
|
|
285
|
+
}, J = function(i) {
|
|
286
|
+
Ie(e.removed, {
|
|
287
|
+
element: i
|
|
288
|
+
});
|
|
289
|
+
try {
|
|
290
|
+
V(i).removeChild(i);
|
|
291
|
+
} catch {
|
|
292
|
+
ie(i);
|
|
293
|
+
}
|
|
294
|
+
}, ge = function(i, p) {
|
|
295
|
+
try {
|
|
296
|
+
Ie(e.removed, {
|
|
297
|
+
attribute: p.getAttributeNode(i),
|
|
298
|
+
from: p
|
|
299
|
+
});
|
|
300
|
+
} catch {
|
|
301
|
+
Ie(e.removed, {
|
|
302
|
+
attribute: null,
|
|
303
|
+
from: p
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
if (p.removeAttribute(i), i === "is")
|
|
307
|
+
if (xe || He)
|
|
308
|
+
try {
|
|
309
|
+
J(p);
|
|
310
|
+
} catch {
|
|
311
|
+
}
|
|
312
|
+
else
|
|
313
|
+
try {
|
|
314
|
+
p.setAttribute(i, "");
|
|
315
|
+
} catch {
|
|
316
|
+
}
|
|
317
|
+
}, Kt = function(i) {
|
|
318
|
+
let p = null, f = null;
|
|
319
|
+
if (ct)
|
|
320
|
+
i = "<remove></remove>" + i;
|
|
321
|
+
else {
|
|
322
|
+
const R = xt(i, /^[\r\n\t ]+/);
|
|
323
|
+
f = R && R[0];
|
|
324
|
+
}
|
|
325
|
+
Le === "application/xhtml+xml" && we === ne && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
326
|
+
const _ = y ? y.createHTML(i) : i;
|
|
327
|
+
if (we === ne)
|
|
328
|
+
try {
|
|
329
|
+
p = new d().parseFromString(_, Le);
|
|
330
|
+
} catch {
|
|
331
|
+
}
|
|
332
|
+
if (!p || !p.documentElement) {
|
|
333
|
+
p = Y.createDocument(we, "template", null);
|
|
334
|
+
try {
|
|
335
|
+
p.documentElement.innerHTML = ft ? N : _;
|
|
336
|
+
} catch {
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
const P = p.body || p.documentElement;
|
|
340
|
+
return i && f && P.insertBefore(t.createTextNode(f), P.childNodes[0] || null), we === ne ? Ee.call(p, fe ? "html" : "body")[0] : fe ? p.documentElement : P;
|
|
341
|
+
}, Jt = function(i) {
|
|
342
|
+
return le.call(
|
|
343
|
+
i.ownerDocument || i,
|
|
344
|
+
i,
|
|
345
|
+
// eslint-disable-next-line no-bitwise
|
|
346
|
+
h.SHOW_ELEMENT | h.SHOW_COMMENT | h.SHOW_TEXT | h.SHOW_PROCESSING_INSTRUCTION | h.SHOW_CDATA_SECTION,
|
|
347
|
+
null
|
|
348
|
+
);
|
|
349
|
+
}, mt = function(i) {
|
|
350
|
+
return i instanceof m && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof u) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
351
|
+
}, en = function(i) {
|
|
352
|
+
return typeof c == "function" && i instanceof c;
|
|
353
|
+
};
|
|
354
|
+
function re(g, i, p) {
|
|
355
|
+
Ye(g, (f) => {
|
|
356
|
+
f.call(e, i, p, Ae);
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
const tn = function(i) {
|
|
360
|
+
let p = null;
|
|
361
|
+
if (re(E.beforeSanitizeElements, i, null), mt(i))
|
|
362
|
+
return J(i), !0;
|
|
363
|
+
const f = C(i.nodeName);
|
|
364
|
+
if (re(E.uponSanitizeElement, i, {
|
|
365
|
+
tagName: f,
|
|
366
|
+
allowedTags: L
|
|
367
|
+
}), Be && i.hasChildNodes() && !en(i.firstElementChild) && M(/<[/\w!]/g, i.innerHTML) && M(/<[/\w!]/g, i.textContent) || i.nodeType === Ne.progressingInstruction || Be && i.nodeType === Ne.comment && M(/<[/\w]/g, i.data))
|
|
368
|
+
return J(i), !0;
|
|
369
|
+
if (!(pe.tagCheck instanceof Function && pe.tagCheck(f)) && (!L[f] || Re[f])) {
|
|
370
|
+
if (!Re[f] && rn(f) && (S.tagNameCheck instanceof RegExp && M(S.tagNameCheck, f) || S.tagNameCheck instanceof Function && S.tagNameCheck(f)))
|
|
371
|
+
return !1;
|
|
372
|
+
if (pt && !K[f]) {
|
|
373
|
+
const _ = V(i) || i.parentNode, P = B(i) || i.childNodes;
|
|
374
|
+
if (P && _) {
|
|
375
|
+
const R = P.length;
|
|
376
|
+
for (let F = R - 1; F >= 0; --F) {
|
|
377
|
+
const se = I(P[F], !0);
|
|
378
|
+
se.__removalCount = (i.__removalCount || 0) + 1, _.insertBefore(se, j(i));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return J(i), !0;
|
|
383
|
+
}
|
|
384
|
+
return i instanceof o && !Zn(i) || (f === "noscript" || f === "noembed" || f === "noframes") && M(/<\/no(script|embed|frames)/i, i.innerHTML) ? (J(i), !0) : (be && i.nodeType === Ne.text && (p = i.textContent, Ye([H, ae, oe], (_) => {
|
|
385
|
+
p = De(p, _, " ");
|
|
386
|
+
}), i.textContent !== p && (Ie(e.removed, {
|
|
387
|
+
element: i.cloneNode()
|
|
388
|
+
}), i.textContent = p)), re(E.afterSanitizeElements, i, null), !1);
|
|
389
|
+
}, nn = function(i, p, f) {
|
|
390
|
+
if (Fe[p] || Wt && (p === "id" || p === "name") && (f in t || f in qn))
|
|
391
|
+
return !1;
|
|
392
|
+
if (!(at && !Fe[p] && M(Se, p))) {
|
|
393
|
+
if (!(Bt && M(lt, p))) {
|
|
394
|
+
if (!(pe.attributeCheck instanceof Function && pe.attributeCheck(p, i))) {
|
|
395
|
+
if (!D[p] || Fe[p]) {
|
|
396
|
+
if (
|
|
397
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
398
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
399
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
400
|
+
!(rn(i) && (S.tagNameCheck instanceof RegExp && M(S.tagNameCheck, i) || S.tagNameCheck instanceof Function && S.tagNameCheck(i)) && (S.attributeNameCheck instanceof RegExp && M(S.attributeNameCheck, p) || S.attributeNameCheck instanceof Function && S.attributeNameCheck(p, i)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
401
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
402
|
+
p === "is" && S.allowCustomizedBuiltInElements && (S.tagNameCheck instanceof RegExp && M(S.tagNameCheck, f) || S.tagNameCheck instanceof Function && S.tagNameCheck(f)))
|
|
403
|
+
) return !1;
|
|
404
|
+
} else if (!ht[p]) {
|
|
405
|
+
if (!M($t, De(f, G, ""))) {
|
|
406
|
+
if (!((p === "src" || p === "xlink:href" || p === "href") && i !== "script" && ur(f, "data:") === 0 && Zt[i])) {
|
|
407
|
+
if (!(Ht && !M(he, De(f, G, "")))) {
|
|
408
|
+
if (f)
|
|
409
|
+
return !1;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return !0;
|
|
418
|
+
}, rn = function(i) {
|
|
419
|
+
return i !== "annotation-xml" && xt(i, ce);
|
|
420
|
+
}, sn = function(i) {
|
|
421
|
+
re(E.beforeSanitizeAttributes, i, null);
|
|
422
|
+
const {
|
|
423
|
+
attributes: p
|
|
424
|
+
} = i;
|
|
425
|
+
if (!p || mt(i))
|
|
426
|
+
return;
|
|
427
|
+
const f = {
|
|
428
|
+
attrName: "",
|
|
429
|
+
attrValue: "",
|
|
430
|
+
keepAttr: !0,
|
|
431
|
+
allowedAttributes: D,
|
|
432
|
+
forceKeepAttr: void 0
|
|
433
|
+
};
|
|
434
|
+
let _ = p.length;
|
|
435
|
+
for (; _--; ) {
|
|
436
|
+
const P = p[_], {
|
|
437
|
+
name: R,
|
|
438
|
+
namespaceURI: F,
|
|
439
|
+
value: se
|
|
440
|
+
} = P, _e = C(R), kt = se;
|
|
441
|
+
let O = R === "value" ? kt : hr(kt);
|
|
442
|
+
if (f.attrName = _e, f.attrValue = O, f.keepAttr = !0, f.forceKeepAttr = void 0, re(E.uponSanitizeAttribute, i, f), O = f.attrValue, qt && (_e === "id" || _e === "name") && (ge(R, i), O = Fn + O), Be && M(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, O)) {
|
|
443
|
+
ge(R, i);
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
if (_e === "attributename" && xt(O, "href")) {
|
|
447
|
+
ge(R, i);
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
450
|
+
if (f.forceKeepAttr)
|
|
451
|
+
continue;
|
|
452
|
+
if (!f.keepAttr) {
|
|
453
|
+
ge(R, i);
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
if (!Gt && M(/\/>/i, O)) {
|
|
457
|
+
ge(R, i);
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
be && Ye([H, ae, oe], (an) => {
|
|
461
|
+
O = De(O, an, " ");
|
|
462
|
+
});
|
|
463
|
+
const ln = C(i.nodeName);
|
|
464
|
+
if (!nn(ln, _e, O)) {
|
|
465
|
+
ge(R, i);
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
if (y && typeof T == "object" && typeof T.getAttributeType == "function" && !F)
|
|
469
|
+
switch (T.getAttributeType(ln, _e)) {
|
|
470
|
+
case "TrustedHTML": {
|
|
471
|
+
O = y.createHTML(O);
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
case "TrustedScriptURL": {
|
|
475
|
+
O = y.createScriptURL(O);
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
if (O !== kt)
|
|
480
|
+
try {
|
|
481
|
+
F ? i.setAttributeNS(F, R, O) : i.setAttribute(R, O), mt(i) ? J(i) : pn(e.removed);
|
|
482
|
+
} catch {
|
|
483
|
+
ge(R, i);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
re(E.afterSanitizeAttributes, i, null);
|
|
487
|
+
}, jn = function g(i) {
|
|
488
|
+
let p = null;
|
|
489
|
+
const f = Jt(i);
|
|
490
|
+
for (re(E.beforeSanitizeShadowDOM, i, null); p = f.nextNode(); )
|
|
491
|
+
re(E.uponSanitizeShadowNode, p, null), tn(p), sn(p), p.content instanceof l && g(p.content);
|
|
492
|
+
re(E.afterSanitizeShadowDOM, i, null);
|
|
493
|
+
};
|
|
494
|
+
return e.sanitize = function(g) {
|
|
495
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, p = null, f = null, _ = null, P = null;
|
|
496
|
+
if (ft = !g, ft && (g = "<!-->"), typeof g != "string" && !en(g))
|
|
497
|
+
if (typeof g.toString == "function") {
|
|
498
|
+
if (g = g.toString(), typeof g != "string")
|
|
499
|
+
throw Oe("dirty is not a string, aborting");
|
|
500
|
+
} else
|
|
501
|
+
throw Oe("toString is not a function");
|
|
502
|
+
if (!e.isSupported)
|
|
503
|
+
return g;
|
|
504
|
+
if (ot || dt(i), e.removed = [], typeof g == "string" && (Ce = !1), Ce) {
|
|
505
|
+
if (g.nodeName) {
|
|
506
|
+
const se = C(g.nodeName);
|
|
507
|
+
if (!L[se] || Re[se])
|
|
508
|
+
throw Oe("root node is forbidden and cannot be sanitized in-place");
|
|
509
|
+
}
|
|
510
|
+
} else if (g instanceof c)
|
|
511
|
+
p = Kt("<!---->"), f = p.ownerDocument.importNode(g, !0), f.nodeType === Ne.element && f.nodeName === "BODY" || f.nodeName === "HTML" ? p = f : p.appendChild(f);
|
|
512
|
+
else {
|
|
513
|
+
if (!xe && !be && !fe && // eslint-disable-next-line unicorn/prefer-includes
|
|
514
|
+
g.indexOf("<") === -1)
|
|
515
|
+
return y && Ge ? y.createHTML(g) : g;
|
|
516
|
+
if (p = Kt(g), !p)
|
|
517
|
+
return xe ? null : Ge ? N : "";
|
|
518
|
+
}
|
|
519
|
+
p && ct && J(p.firstChild);
|
|
520
|
+
const R = Jt(Ce ? g : p);
|
|
521
|
+
for (; _ = R.nextNode(); )
|
|
522
|
+
tn(_), sn(_), _.content instanceof l && jn(_.content);
|
|
523
|
+
if (Ce)
|
|
524
|
+
return g;
|
|
525
|
+
if (xe) {
|
|
526
|
+
if (He)
|
|
527
|
+
for (P = Ue.call(p.ownerDocument); p.firstChild; )
|
|
528
|
+
P.appendChild(p.firstChild);
|
|
529
|
+
else
|
|
530
|
+
P = p;
|
|
531
|
+
return (D.shadowroot || D.shadowrootmode) && (P = ue.call(s, P, !0)), P;
|
|
532
|
+
}
|
|
533
|
+
let F = fe ? p.outerHTML : p.innerHTML;
|
|
534
|
+
return fe && L["!doctype"] && p.ownerDocument && p.ownerDocument.doctype && p.ownerDocument.doctype.name && M(Cn, p.ownerDocument.doctype.name) && (F = "<!DOCTYPE " + p.ownerDocument.doctype.name + `>
|
|
535
|
+
` + F), be && Ye([H, ae, oe], (se) => {
|
|
536
|
+
F = De(F, se, " ");
|
|
537
|
+
}), y && Ge ? y.createHTML(F) : F;
|
|
538
|
+
}, e.setConfig = function() {
|
|
539
|
+
let g = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
540
|
+
dt(g), ot = !0;
|
|
541
|
+
}, e.clearConfig = function() {
|
|
542
|
+
Ae = null, ot = !1;
|
|
543
|
+
}, e.isValidAttribute = function(g, i, p) {
|
|
544
|
+
Ae || dt({});
|
|
545
|
+
const f = C(g), _ = C(i);
|
|
546
|
+
return nn(f, _, p);
|
|
547
|
+
}, e.addHook = function(g, i) {
|
|
548
|
+
typeof i == "function" && Ie(E[g], i);
|
|
549
|
+
}, e.removeHook = function(g, i) {
|
|
550
|
+
if (i !== void 0) {
|
|
551
|
+
const p = cr(E[g], i);
|
|
552
|
+
return p === -1 ? void 0 : pr(E[g], p, 1)[0];
|
|
553
|
+
}
|
|
554
|
+
return pn(E[g]);
|
|
555
|
+
}, e.removeHooks = function(g) {
|
|
556
|
+
E[g] = [];
|
|
557
|
+
}, e.removeAllHooks = function() {
|
|
558
|
+
E = mn();
|
|
559
|
+
}, e;
|
|
560
|
+
}
|
|
561
|
+
var Rr = Ln(), kn, Cr = {};
|
|
562
|
+
function q(r, e, t) {
|
|
563
|
+
if (r.nodeType === 3) {
|
|
564
|
+
var s = "textContent" in r ? r.textContent : r.nodeValue || "";
|
|
565
|
+
if (q.options.trim !== !1) {
|
|
566
|
+
var n = e === 0 || e === t.length - 1;
|
|
567
|
+
if ((!(s = s.match(/^[\s\n]+$/g) && q.options.trim !== "all" ? " " : s.replace(/(^[\s\n]+|[\s\n]+$)/g, q.options.trim === "all" || n ? "" : " ")) || s === " ") && t.length > 1 && n) return null;
|
|
568
|
+
}
|
|
569
|
+
return s;
|
|
570
|
+
}
|
|
571
|
+
if (r.nodeType !== 1) return null;
|
|
572
|
+
var l = String(r.nodeName).toLowerCase();
|
|
573
|
+
if (l === "script" && !q.options.allowScripts) return null;
|
|
574
|
+
var a, c, o = q.h(l, (function(h) {
|
|
575
|
+
var u = h && h.length;
|
|
576
|
+
if (!u) return null;
|
|
577
|
+
for (var m = {}, d = 0; d < u; d++) {
|
|
578
|
+
var T = h[d], b = T.name, I = T.value;
|
|
579
|
+
b.substring(0, 2) === "on" && q.options.allowEvents && (I = new Function(I)), m[b] = I;
|
|
580
|
+
}
|
|
581
|
+
return m;
|
|
582
|
+
})(r.attributes), (c = (a = r.childNodes) && Array.prototype.map.call(a, q).filter(Lr)) && c.length ? c : null);
|
|
583
|
+
return q.visitor && q.visitor(o), o;
|
|
584
|
+
}
|
|
585
|
+
var bn, Lr = function(r) {
|
|
586
|
+
return r;
|
|
587
|
+
}, Ir = {};
|
|
588
|
+
function et(r) {
|
|
589
|
+
var e = (r.type || "").toLowerCase(), t = et.map;
|
|
590
|
+
t && t.hasOwnProperty(e) ? (r.type = t[e], r.props = Object.keys(r.props || {}).reduce(function(s, n) {
|
|
591
|
+
var l;
|
|
592
|
+
return s[l = n, l.replace(/-(.)/g, function(a, c) {
|
|
593
|
+
return c.toUpperCase();
|
|
594
|
+
})] = r.props[n], s;
|
|
595
|
+
}, {})) : r.type = e.replace(/[^a-z0-9-]/i, "");
|
|
596
|
+
}
|
|
597
|
+
const Dr = (function(r) {
|
|
598
|
+
function e() {
|
|
599
|
+
r.apply(this, arguments);
|
|
600
|
+
}
|
|
601
|
+
return r && (e.__proto__ = r), (e.prototype = Object.create(r && r.prototype)).constructor = e, e.setReviver = function(t) {
|
|
602
|
+
bn = t;
|
|
603
|
+
}, e.prototype.shouldComponentUpdate = function(t) {
|
|
604
|
+
var s = this.props;
|
|
605
|
+
return t.wrap !== s.wrap || t.type !== s.type || t.markup !== s.markup;
|
|
606
|
+
}, e.prototype.setComponents = function(t) {
|
|
607
|
+
if (this.map = {}, t) {
|
|
608
|
+
for (var s in t) if (t.hasOwnProperty(s)) {
|
|
609
|
+
var n = s.replace(/([A-Z]+)([A-Z][a-z0-9])|([a-z0-9]+)([A-Z])/g, "$1$3-$2$4").toLowerCase();
|
|
610
|
+
this.map[n] = t[s];
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}, e.prototype.render = function(t) {
|
|
614
|
+
var s = t.wrap;
|
|
615
|
+
s === void 0 && (s = !0);
|
|
616
|
+
var n, l = t.type, a = t.markup, c = t.components, o = t.reviver, h = t.onError, u = t["allow-scripts"], m = t["allow-events"], d = t.trim, T = (function(B, V) {
|
|
617
|
+
var y = {};
|
|
618
|
+
for (var N in B) Object.prototype.hasOwnProperty.call(B, N) && V.indexOf(N) === -1 && (y[N] = B[N]);
|
|
619
|
+
return y;
|
|
620
|
+
})(t, ["wrap", "type", "markup", "components", "reviver", "onError", "allow-scripts", "allow-events", "trim"]), b = o || this.reviver || this.constructor.prototype.reviver || bn || tr;
|
|
621
|
+
this.setComponents(c);
|
|
622
|
+
var I = { allowScripts: u, allowEvents: m, trim: d };
|
|
623
|
+
try {
|
|
624
|
+
n = (function(B, V, y, N, Y) {
|
|
625
|
+
var le = (function(ue, E) {
|
|
626
|
+
var H, ae, oe, Se, lt = E === "html" ? "text/html" : "application/xml";
|
|
627
|
+
E === "html" ? (Se = "body", oe = `<!DOCTYPE html>
|
|
628
|
+
<html><body>` + ue + "</body></html>") : (Se = "xml", oe = `<?xml version="1.0" encoding="UTF-8"?>
|
|
629
|
+
<xml>` + ue + "</xml>");
|
|
630
|
+
try {
|
|
631
|
+
H = new DOMParser().parseFromString(oe, lt);
|
|
632
|
+
} catch (ce) {
|
|
633
|
+
ae = ce;
|
|
634
|
+
}
|
|
635
|
+
if (H || E !== "html" || ((H = kn || (kn = (function() {
|
|
636
|
+
if (document.implementation && document.implementation.createHTMLDocument) return document.implementation.createHTMLDocument("");
|
|
637
|
+
var ce = document.createElement("iframe");
|
|
638
|
+
return ce.style.cssText = "position:absolute; left:0; top:-999em; width:1px; height:1px; overflow:hidden;", ce.setAttribute("sandbox", "allow-forms"), document.body.appendChild(ce), ce.contentWindow.document;
|
|
639
|
+
})())).open(), H.write(oe), H.close()), H) {
|
|
640
|
+
var he = H.getElementsByTagName(Se)[0], G = he.firstChild;
|
|
641
|
+
return ue && !G && (he.error = "Document parse failed."), G && String(G.nodeName).toLowerCase() === "parsererror" && (G.removeChild(G.firstChild), G.removeChild(G.lastChild), he.error = G.textContent || G.nodeValue || ae || "Unknown error", he.removeChild(G)), he;
|
|
642
|
+
}
|
|
643
|
+
})(B, V);
|
|
644
|
+
if (le && le.error) throw new Error(le.error);
|
|
645
|
+
var Ue = le && le.body || le;
|
|
646
|
+
et.map = N || Ir;
|
|
647
|
+
var Ee = Ue && (function(ue, E, H, ae) {
|
|
648
|
+
return q.visitor = E, q.h = H, q.options = ae || Cr, q(ue);
|
|
649
|
+
})(Ue, et, y, Y);
|
|
650
|
+
return et.map = null, Ee && Ee.props && Ee.props.children || null;
|
|
651
|
+
})(a, l, b, this.map, I);
|
|
652
|
+
} catch (B) {
|
|
653
|
+
h ? h({ error: B }) : typeof console < "u" && console.error && console.error("preact-markup: " + B);
|
|
654
|
+
}
|
|
655
|
+
if (s === !1) return n || null;
|
|
656
|
+
var ie = T.hasOwnProperty("className") ? "className" : "class", j = T[ie];
|
|
657
|
+
return j ? j.splice ? j.splice(0, 0, "markup") : typeof j == "string" ? T[ie] += " markup" : typeof j == "object" && (j.markup = !0) : T[ie] = "markup", b("div", T, n || null);
|
|
658
|
+
}, e;
|
|
659
|
+
})(nr);
|
|
660
|
+
function Lt() {
|
|
661
|
+
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
662
|
+
}
|
|
663
|
+
var ke = Lt();
|
|
664
|
+
function In(r) {
|
|
665
|
+
ke = r;
|
|
666
|
+
}
|
|
667
|
+
var de = { exec: () => null };
|
|
668
|
+
function x(r, e = "") {
|
|
669
|
+
let t = typeof r == "string" ? r : r.source, s = { replace: (n, l) => {
|
|
670
|
+
let a = typeof l == "string" ? l : l.source;
|
|
671
|
+
return a = a.replace(z.caret, "$1"), t = t.replace(n, a), s;
|
|
672
|
+
}, getRegex: () => new RegExp(t, e) };
|
|
673
|
+
return s;
|
|
674
|
+
}
|
|
675
|
+
var Or = (() => {
|
|
676
|
+
try {
|
|
677
|
+
return !!new RegExp("(?<=1)(?<!1)");
|
|
678
|
+
} catch {
|
|
679
|
+
return !1;
|
|
680
|
+
}
|
|
681
|
+
})(), z = { 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, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (r) => new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}#`), htmlBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}>`) }, vr = /^(?:[ \t]*(?:\n|$))+/, Nr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Pr = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, $e = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Mr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, It = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Dn = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, On = x(Dn).replace(/bull/g, It).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(), zr = x(Dn).replace(/bull/g, It).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(), Dt = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, $r = /^[^\n]+/, Ot = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Ur = x(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ot).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Fr = x(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, It).getRegex(), st = "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", vt = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Br = x("^ {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", vt).replace("tag", st).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), vn = x(Dt).replace("hr", $e).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", st).getRegex(), Hr = x(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", vn).getRegex(), Nt = { blockquote: Hr, code: Nr, def: Ur, fences: Pr, heading: Mr, hr: $e, html: Br, lheading: On, list: Fr, newline: vr, paragraph: vn, table: de, text: $r }, xn = x("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", $e).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", st).getRegex(), Gr = { ...Nt, lheading: zr, table: xn, paragraph: x(Dt).replace("hr", $e).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", xn).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", st).getRegex() }, Wr = { ...Nt, html: x(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", vt).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: de, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: x(Dt).replace("hr", $e).replace("heading", ` *#{1,6} *[^
|
|
682
|
+
]`).replace("lheading", On).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, qr = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Zr = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Nn = /^( {2,}|\\)\n(?!\s*$)/, jr = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, ye = /[\p{P}\p{S}]/u, it = /[\s\p{P}\p{S}]/u, Pt = /[^\s\p{P}\p{S}]/u, Yr = x(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, it).getRegex(), Pn = /(?!~)[\p{P}\p{S}]/u, Xr = /(?!~)[\s\p{P}\p{S}]/u, Qr = /(?:[^\s\p{P}\p{S}]|~)/u, Vr = x(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Or ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Mn = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Kr = x(Mn, "u").replace(/punct/g, ye).getRegex(), Jr = x(Mn, "u").replace(/punct/g, Pn).getRegex(), zn = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", es = x(zn, "gu").replace(/notPunctSpace/g, Pt).replace(/punctSpace/g, it).replace(/punct/g, ye).getRegex(), ts = x(zn, "gu").replace(/notPunctSpace/g, Qr).replace(/punctSpace/g, Xr).replace(/punct/g, Pn).getRegex(), ns = x("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Pt).replace(/punctSpace/g, it).replace(/punct/g, ye).getRegex(), rs = x(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, ye).getRegex(), ss = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", is = x(ss, "gu").replace(/notPunctSpace/g, Pt).replace(/punctSpace/g, it).replace(/punct/g, ye).getRegex(), ls = x(/\\(punct)/, "gu").replace(/punct/g, ye).getRegex(), as = x(/^<(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(), os = x(vt).replace("(?:-->|$)", "-->").getRegex(), cs = x("^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", os).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), tt = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, ps = x(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", tt).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), $n = x(/^!?\[(label)\]\[(ref)\]/).replace("label", tt).replace("ref", Ot).getRegex(), Un = x(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ot).getRegex(), us = x("reflink|nolink(?!\\()", "g").replace("reflink", $n).replace("nolink", Un).getRegex(), Tn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Mt = { _backpedal: de, anyPunctuation: ls, autolink: as, blockSkip: Vr, br: Nn, code: Zr, del: de, delLDelim: de, delRDelim: de, emStrongLDelim: Kr, emStrongRDelimAst: es, emStrongRDelimUnd: ns, escape: qr, link: ps, nolink: Un, punctuation: Yr, reflink: $n, reflinkSearch: us, tag: cs, text: jr, url: de }, hs = { ...Mt, link: x(/^!?\[(label)\]\((.*?)\)/).replace("label", tt).getRegex(), reflink: x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", tt).getRegex() }, St = { ...Mt, emStrongRDelimAst: ts, emStrongLDelim: Jr, delLDelim: rs, delRDelim: is, url: x(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Tn).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: x(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Tn).getRegex() }, fs = { ...St, br: x(Nn).replace("{2,}", "*").getRegex(), text: x(St.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, Qe = { normal: Nt, gfm: Gr, pedantic: Wr }, Pe = { normal: Mt, gfm: St, breaks: fs, pedantic: hs }, gs = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, wn = (r) => gs[r];
|
|
683
|
+
function te(r, e) {
|
|
684
|
+
if (e) {
|
|
685
|
+
if (z.escapeTest.test(r)) return r.replace(z.escapeReplace, wn);
|
|
686
|
+
} else if (z.escapeTestNoEncode.test(r)) return r.replace(z.escapeReplaceNoEncode, wn);
|
|
687
|
+
return r;
|
|
688
|
+
}
|
|
689
|
+
function An(r) {
|
|
690
|
+
try {
|
|
691
|
+
r = encodeURI(r).replace(z.percentDecode, "%");
|
|
692
|
+
} catch {
|
|
693
|
+
return null;
|
|
694
|
+
}
|
|
695
|
+
return r;
|
|
696
|
+
}
|
|
697
|
+
function _n(r, e) {
|
|
698
|
+
let t = r.replace(z.findPipe, (l, a, c) => {
|
|
699
|
+
let o = !1, h = a;
|
|
700
|
+
for (; --h >= 0 && c[h] === "\\"; ) o = !o;
|
|
701
|
+
return o ? "|" : " |";
|
|
702
|
+
}), s = t.split(z.splitPipe), n = 0;
|
|
703
|
+
if (s[0].trim() || s.shift(), s.length > 0 && !s.at(-1)?.trim() && s.pop(), e) if (s.length > e) s.splice(e);
|
|
704
|
+
else for (; s.length < e; ) s.push("");
|
|
705
|
+
for (; n < s.length; n++) s[n] = s[n].trim().replace(z.slashPipe, "|");
|
|
706
|
+
return s;
|
|
707
|
+
}
|
|
708
|
+
function Me(r, e, t) {
|
|
709
|
+
let s = r.length;
|
|
710
|
+
if (s === 0) return "";
|
|
711
|
+
let n = 0;
|
|
712
|
+
for (; n < s && r.charAt(s - n - 1) === e; )
|
|
713
|
+
n++;
|
|
714
|
+
return r.slice(0, s - n);
|
|
715
|
+
}
|
|
716
|
+
function ds(r, e) {
|
|
717
|
+
if (r.indexOf(e[1]) === -1) return -1;
|
|
718
|
+
let t = 0;
|
|
719
|
+
for (let s = 0; s < r.length; s++) if (r[s] === "\\") s++;
|
|
720
|
+
else if (r[s] === e[0]) t++;
|
|
721
|
+
else if (r[s] === e[1] && (t--, t < 0)) return s;
|
|
722
|
+
return t > 0 ? -2 : -1;
|
|
723
|
+
}
|
|
724
|
+
function ms(r, e = 0) {
|
|
725
|
+
let t = e, s = "";
|
|
726
|
+
for (let n of r) if (n === " ") {
|
|
727
|
+
let l = 4 - t % 4;
|
|
728
|
+
s += " ".repeat(l), t += l;
|
|
729
|
+
} else s += n, t++;
|
|
730
|
+
return s;
|
|
731
|
+
}
|
|
732
|
+
function yn(r, e, t, s, n) {
|
|
733
|
+
let l = e.href, a = e.title || null, c = r[1].replace(n.other.outputLinkReplace, "$1");
|
|
734
|
+
s.state.inLink = !0;
|
|
735
|
+
let o = { type: r[0].charAt(0) === "!" ? "image" : "link", raw: t, href: l, title: a, text: c, tokens: s.inlineTokens(c) };
|
|
736
|
+
return s.state.inLink = !1, o;
|
|
737
|
+
}
|
|
738
|
+
function ks(r, e, t) {
|
|
739
|
+
let s = r.match(t.other.indentCodeCompensation);
|
|
740
|
+
if (s === null) return e;
|
|
741
|
+
let n = s[1];
|
|
742
|
+
return e.split(`
|
|
743
|
+
`).map((l) => {
|
|
744
|
+
let a = l.match(t.other.beginningSpace);
|
|
745
|
+
if (a === null) return l;
|
|
746
|
+
let [c] = a;
|
|
747
|
+
return c.length >= n.length ? l.slice(n.length) : l;
|
|
748
|
+
}).join(`
|
|
749
|
+
`);
|
|
750
|
+
}
|
|
751
|
+
var nt = class {
|
|
752
|
+
constructor(r) {
|
|
753
|
+
A(this, "options");
|
|
754
|
+
A(this, "rules");
|
|
755
|
+
A(this, "lexer");
|
|
756
|
+
this.options = r || ke;
|
|
757
|
+
}
|
|
758
|
+
space(r) {
|
|
759
|
+
let e = this.rules.block.newline.exec(r);
|
|
760
|
+
if (e && e[0].length > 0) return { type: "space", raw: e[0] };
|
|
761
|
+
}
|
|
762
|
+
code(r) {
|
|
763
|
+
let e = this.rules.block.code.exec(r);
|
|
764
|
+
if (e) {
|
|
765
|
+
let t = e[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
766
|
+
return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? t : Me(t, `
|
|
767
|
+
`) };
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
fences(r) {
|
|
771
|
+
let e = this.rules.block.fences.exec(r);
|
|
772
|
+
if (e) {
|
|
773
|
+
let t = e[0], s = ks(t, e[3] || "", this.rules);
|
|
774
|
+
return { type: "code", raw: t, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
heading(r) {
|
|
778
|
+
let e = this.rules.block.heading.exec(r);
|
|
779
|
+
if (e) {
|
|
780
|
+
let t = e[2].trim();
|
|
781
|
+
if (this.rules.other.endingHash.test(t)) {
|
|
782
|
+
let s = Me(t, "#");
|
|
783
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (t = s.trim());
|
|
784
|
+
}
|
|
785
|
+
return { type: "heading", raw: e[0], depth: e[1].length, text: t, tokens: this.lexer.inline(t) };
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
hr(r) {
|
|
789
|
+
let e = this.rules.block.hr.exec(r);
|
|
790
|
+
if (e) return { type: "hr", raw: Me(e[0], `
|
|
791
|
+
`) };
|
|
792
|
+
}
|
|
793
|
+
blockquote(r) {
|
|
794
|
+
let e = this.rules.block.blockquote.exec(r);
|
|
795
|
+
if (e) {
|
|
796
|
+
let t = Me(e[0], `
|
|
797
|
+
`).split(`
|
|
798
|
+
`), s = "", n = "", l = [];
|
|
799
|
+
for (; t.length > 0; ) {
|
|
800
|
+
let a = !1, c = [], o;
|
|
801
|
+
for (o = 0; o < t.length; o++) if (this.rules.other.blockquoteStart.test(t[o])) c.push(t[o]), a = !0;
|
|
802
|
+
else if (!a) c.push(t[o]);
|
|
803
|
+
else break;
|
|
804
|
+
t = t.slice(o);
|
|
805
|
+
let h = c.join(`
|
|
806
|
+
`), u = h.replace(this.rules.other.blockquoteSetextReplace, `
|
|
807
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
808
|
+
s = s ? `${s}
|
|
809
|
+
${h}` : h, n = n ? `${n}
|
|
810
|
+
${u}` : u;
|
|
811
|
+
let m = this.lexer.state.top;
|
|
812
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(u, l, !0), this.lexer.state.top = m, t.length === 0) break;
|
|
813
|
+
let d = l.at(-1);
|
|
814
|
+
if (d?.type === "code") break;
|
|
815
|
+
if (d?.type === "blockquote") {
|
|
816
|
+
let T = d, b = T.raw + `
|
|
817
|
+
` + t.join(`
|
|
818
|
+
`), I = this.blockquote(b);
|
|
819
|
+
l[l.length - 1] = I, s = s.substring(0, s.length - T.raw.length) + I.raw, n = n.substring(0, n.length - T.text.length) + I.text;
|
|
820
|
+
break;
|
|
821
|
+
} else if (d?.type === "list") {
|
|
822
|
+
let T = d, b = T.raw + `
|
|
823
|
+
` + t.join(`
|
|
824
|
+
`), I = this.list(b);
|
|
825
|
+
l[l.length - 1] = I, s = s.substring(0, s.length - d.raw.length) + I.raw, n = n.substring(0, n.length - T.raw.length) + I.raw, t = b.substring(l.at(-1).raw.length).split(`
|
|
826
|
+
`);
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
return { type: "blockquote", raw: s, tokens: l, text: n };
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
list(r) {
|
|
834
|
+
let e = this.rules.block.list.exec(r);
|
|
835
|
+
if (e) {
|
|
836
|
+
let t = e[1].trim(), s = t.length > 1, n = { type: "list", raw: "", ordered: s, start: s ? +t.slice(0, -1) : "", loose: !1, items: [] };
|
|
837
|
+
t = s ? `\\d{1,9}\\${t.slice(-1)}` : `\\${t}`, this.options.pedantic && (t = s ? t : "[*+-]");
|
|
838
|
+
let l = this.rules.other.listItemRegex(t), a = !1;
|
|
839
|
+
for (; r; ) {
|
|
840
|
+
let o = !1, h = "", u = "";
|
|
841
|
+
if (!(e = l.exec(r)) || this.rules.block.hr.test(r)) break;
|
|
842
|
+
h = e[0], r = r.substring(h.length);
|
|
843
|
+
let m = ms(e[2].split(`
|
|
844
|
+
`, 1)[0], e[1].length), d = r.split(`
|
|
845
|
+
`, 1)[0], T = !m.trim(), b = 0;
|
|
846
|
+
if (this.options.pedantic ? (b = 2, u = m.trimStart()) : T ? b = e[1].length + 1 : (b = m.search(this.rules.other.nonSpaceChar), b = b > 4 ? 1 : b, u = m.slice(b), b += e[1].length), T && this.rules.other.blankLine.test(d) && (h += d + `
|
|
847
|
+
`, r = r.substring(d.length + 1), o = !0), !o) {
|
|
848
|
+
let I = this.rules.other.nextBulletRegex(b), ie = this.rules.other.hrRegex(b), j = this.rules.other.fencesBeginRegex(b), B = this.rules.other.headingBeginRegex(b), V = this.rules.other.htmlBeginRegex(b), y = this.rules.other.blockquoteBeginRegex(b);
|
|
849
|
+
for (; r; ) {
|
|
850
|
+
let N = r.split(`
|
|
851
|
+
`, 1)[0], Y;
|
|
852
|
+
if (d = N, this.options.pedantic ? (d = d.replace(this.rules.other.listReplaceNesting, " "), Y = d) : Y = d.replace(this.rules.other.tabCharGlobal, " "), j.test(d) || B.test(d) || V.test(d) || y.test(d) || I.test(d) || ie.test(d)) break;
|
|
853
|
+
if (Y.search(this.rules.other.nonSpaceChar) >= b || !d.trim()) u += `
|
|
854
|
+
` + Y.slice(b);
|
|
855
|
+
else {
|
|
856
|
+
if (T || m.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || j.test(m) || B.test(m) || ie.test(m)) break;
|
|
857
|
+
u += `
|
|
858
|
+
` + d;
|
|
859
|
+
}
|
|
860
|
+
T = !d.trim(), h += N + `
|
|
861
|
+
`, r = r.substring(N.length + 1), m = Y.slice(b);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
n.loose || (a ? n.loose = !0 : this.rules.other.doubleBlankLine.test(h) && (a = !0)), n.items.push({ type: "list_item", raw: h, task: !!this.options.gfm && this.rules.other.listIsTask.test(u), loose: !1, text: u, tokens: [] }), n.raw += h;
|
|
865
|
+
}
|
|
866
|
+
let c = n.items.at(-1);
|
|
867
|
+
if (c) c.raw = c.raw.trimEnd(), c.text = c.text.trimEnd();
|
|
868
|
+
else return;
|
|
869
|
+
n.raw = n.raw.trimEnd();
|
|
870
|
+
for (let o of n.items) {
|
|
871
|
+
if (this.lexer.state.top = !1, o.tokens = this.lexer.blockTokens(o.text, []), o.task) {
|
|
872
|
+
if (o.text = o.text.replace(this.rules.other.listReplaceTask, ""), o.tokens[0]?.type === "text" || o.tokens[0]?.type === "paragraph") {
|
|
873
|
+
o.tokens[0].raw = o.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), o.tokens[0].text = o.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
874
|
+
for (let u = this.lexer.inlineQueue.length - 1; u >= 0; u--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)) {
|
|
875
|
+
this.lexer.inlineQueue[u].src = this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask, "");
|
|
876
|
+
break;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
let h = this.rules.other.listTaskCheckbox.exec(o.raw);
|
|
880
|
+
if (h) {
|
|
881
|
+
let u = { type: "checkbox", raw: h[0] + " ", checked: h[0] !== "[ ]" };
|
|
882
|
+
o.checked = u.checked, n.loose ? o.tokens[0] && ["paragraph", "text"].includes(o.tokens[0].type) && "tokens" in o.tokens[0] && o.tokens[0].tokens ? (o.tokens[0].raw = u.raw + o.tokens[0].raw, o.tokens[0].text = u.raw + o.tokens[0].text, o.tokens[0].tokens.unshift(u)) : o.tokens.unshift({ type: "paragraph", raw: u.raw, text: u.raw, tokens: [u] }) : o.tokens.unshift(u);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
if (!n.loose) {
|
|
886
|
+
let h = o.tokens.filter((m) => m.type === "space"), u = h.length > 0 && h.some((m) => this.rules.other.anyLine.test(m.raw));
|
|
887
|
+
n.loose = u;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
if (n.loose) for (let o of n.items) {
|
|
891
|
+
o.loose = !0;
|
|
892
|
+
for (let h of o.tokens) h.type === "text" && (h.type = "paragraph");
|
|
893
|
+
}
|
|
894
|
+
return n;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
html(r) {
|
|
898
|
+
let e = this.rules.block.html.exec(r);
|
|
899
|
+
if (e) return { type: "html", block: !0, raw: e[0], pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: e[0] };
|
|
900
|
+
}
|
|
901
|
+
def(r) {
|
|
902
|
+
let e = this.rules.block.def.exec(r);
|
|
903
|
+
if (e) {
|
|
904
|
+
let t = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", n = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
|
|
905
|
+
return { type: "def", tag: t, raw: e[0], href: s, title: n };
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
table(r) {
|
|
909
|
+
let e = this.rules.block.table.exec(r);
|
|
910
|
+
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
911
|
+
let t = _n(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), n = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
912
|
+
`) : [], l = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
913
|
+
if (t.length === s.length) {
|
|
914
|
+
for (let a of s) this.rules.other.tableAlignRight.test(a) ? l.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? l.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? l.align.push("left") : l.align.push(null);
|
|
915
|
+
for (let a = 0; a < t.length; a++) l.header.push({ text: t[a], tokens: this.lexer.inline(t[a]), header: !0, align: l.align[a] });
|
|
916
|
+
for (let a of n) l.rows.push(_n(a, l.header.length).map((c, o) => ({ text: c, tokens: this.lexer.inline(c), header: !1, align: l.align[o] })));
|
|
917
|
+
return l;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
lheading(r) {
|
|
921
|
+
let e = this.rules.block.lheading.exec(r);
|
|
922
|
+
if (e) {
|
|
923
|
+
let t = e[1].trim();
|
|
924
|
+
return { type: "heading", raw: e[0], depth: e[2].charAt(0) === "=" ? 1 : 2, text: t, tokens: this.lexer.inline(t) };
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
paragraph(r) {
|
|
928
|
+
let e = this.rules.block.paragraph.exec(r);
|
|
929
|
+
if (e) {
|
|
930
|
+
let t = e[1].charAt(e[1].length - 1) === `
|
|
931
|
+
` ? e[1].slice(0, -1) : e[1];
|
|
932
|
+
return { type: "paragraph", raw: e[0], text: t, tokens: this.lexer.inline(t) };
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
text(r) {
|
|
936
|
+
let e = this.rules.block.text.exec(r);
|
|
937
|
+
if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
|
|
938
|
+
}
|
|
939
|
+
escape(r) {
|
|
940
|
+
let e = this.rules.inline.escape.exec(r);
|
|
941
|
+
if (e) return { type: "escape", raw: e[0], text: e[1] };
|
|
942
|
+
}
|
|
943
|
+
tag(r) {
|
|
944
|
+
let e = this.rules.inline.tag.exec(r);
|
|
945
|
+
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] };
|
|
946
|
+
}
|
|
947
|
+
link(r) {
|
|
948
|
+
let e = this.rules.inline.link.exec(r);
|
|
949
|
+
if (e) {
|
|
950
|
+
let t = e[2].trim();
|
|
951
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(t)) {
|
|
952
|
+
if (!this.rules.other.endAngleBracket.test(t)) return;
|
|
953
|
+
let l = Me(t.slice(0, -1), "\\");
|
|
954
|
+
if ((t.length - l.length) % 2 === 0) return;
|
|
955
|
+
} else {
|
|
956
|
+
let l = ds(e[2], "()");
|
|
957
|
+
if (l === -2) return;
|
|
958
|
+
if (l > -1) {
|
|
959
|
+
let a = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + l;
|
|
960
|
+
e[2] = e[2].substring(0, l), e[0] = e[0].substring(0, a).trim(), e[3] = "";
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
let s = e[2], n = "";
|
|
964
|
+
if (this.options.pedantic) {
|
|
965
|
+
let l = this.rules.other.pedanticHrefTitle.exec(s);
|
|
966
|
+
l && (s = l[1], n = l[3]);
|
|
967
|
+
} else n = e[3] ? e[3].slice(1, -1) : "";
|
|
968
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(t) ? s = s.slice(1) : s = s.slice(1, -1)), yn(e, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: n && n.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
reflink(r, e) {
|
|
972
|
+
let t;
|
|
973
|
+
if ((t = this.rules.inline.reflink.exec(r)) || (t = this.rules.inline.nolink.exec(r))) {
|
|
974
|
+
let s = (t[2] || t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = e[s.toLowerCase()];
|
|
975
|
+
if (!n) {
|
|
976
|
+
let l = t[0].charAt(0);
|
|
977
|
+
return { type: "text", raw: l, text: l };
|
|
978
|
+
}
|
|
979
|
+
return yn(t, n, t[0], this.lexer, this.rules);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
emStrong(r, e, t = "") {
|
|
983
|
+
let s = this.rules.inline.emStrongLDelim.exec(r);
|
|
984
|
+
if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && t.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[3]) || !t || this.rules.inline.punctuation.exec(t))) {
|
|
985
|
+
let n = [...s[0]].length - 1, l, a, c = n, o = 0, h = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
986
|
+
for (h.lastIndex = 0, e = e.slice(-1 * r.length + n); (s = h.exec(e)) != null; ) {
|
|
987
|
+
if (l = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !l) continue;
|
|
988
|
+
if (a = [...l].length, s[3] || s[4]) {
|
|
989
|
+
c += a;
|
|
990
|
+
continue;
|
|
991
|
+
} else if ((s[5] || s[6]) && n % 3 && !((n + a) % 3)) {
|
|
992
|
+
o += a;
|
|
993
|
+
continue;
|
|
994
|
+
}
|
|
995
|
+
if (c -= a, c > 0) continue;
|
|
996
|
+
a = Math.min(a, a + c + o);
|
|
997
|
+
let u = [...s[0]][0].length, m = r.slice(0, n + s.index + u + a);
|
|
998
|
+
if (Math.min(n, a) % 2) {
|
|
999
|
+
let T = m.slice(1, -1);
|
|
1000
|
+
return { type: "em", raw: m, text: T, tokens: this.lexer.inlineTokens(T) };
|
|
1001
|
+
}
|
|
1002
|
+
let d = m.slice(2, -2);
|
|
1003
|
+
return { type: "strong", raw: m, text: d, tokens: this.lexer.inlineTokens(d) };
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
codespan(r) {
|
|
1008
|
+
let e = this.rules.inline.code.exec(r);
|
|
1009
|
+
if (e) {
|
|
1010
|
+
let t = e[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(t), n = this.rules.other.startingSpaceChar.test(t) && this.rules.other.endingSpaceChar.test(t);
|
|
1011
|
+
return s && n && (t = t.substring(1, t.length - 1)), { type: "codespan", raw: e[0], text: t };
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
br(r) {
|
|
1015
|
+
let e = this.rules.inline.br.exec(r);
|
|
1016
|
+
if (e) return { type: "br", raw: e[0] };
|
|
1017
|
+
}
|
|
1018
|
+
del(r, e, t = "") {
|
|
1019
|
+
let s = this.rules.inline.delLDelim.exec(r);
|
|
1020
|
+
if (s && (!s[1] || !t || this.rules.inline.punctuation.exec(t))) {
|
|
1021
|
+
let n = [...s[0]].length - 1, l, a, c = n, o = this.rules.inline.delRDelim;
|
|
1022
|
+
for (o.lastIndex = 0, e = e.slice(-1 * r.length + n); (s = o.exec(e)) != null; ) {
|
|
1023
|
+
if (l = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !l || (a = [...l].length, a !== n)) continue;
|
|
1024
|
+
if (s[3] || s[4]) {
|
|
1025
|
+
c += a;
|
|
1026
|
+
continue;
|
|
1027
|
+
}
|
|
1028
|
+
if (c -= a, c > 0) continue;
|
|
1029
|
+
a = Math.min(a, a + c);
|
|
1030
|
+
let h = [...s[0]][0].length, u = r.slice(0, n + s.index + h + a), m = u.slice(n, -n);
|
|
1031
|
+
return { type: "del", raw: u, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
autolink(r) {
|
|
1036
|
+
let e = this.rules.inline.autolink.exec(r);
|
|
1037
|
+
if (e) {
|
|
1038
|
+
let t, s;
|
|
1039
|
+
return e[2] === "@" ? (t = e[1], s = "mailto:" + t) : (t = e[1], s = t), { type: "link", raw: e[0], text: t, href: s, tokens: [{ type: "text", raw: t, text: t }] };
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
url(r) {
|
|
1043
|
+
let e;
|
|
1044
|
+
if (e = this.rules.inline.url.exec(r)) {
|
|
1045
|
+
let t, s;
|
|
1046
|
+
if (e[2] === "@") t = e[0], s = "mailto:" + t;
|
|
1047
|
+
else {
|
|
1048
|
+
let n;
|
|
1049
|
+
do
|
|
1050
|
+
n = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
|
|
1051
|
+
while (n !== e[0]);
|
|
1052
|
+
t = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
|
|
1053
|
+
}
|
|
1054
|
+
return { type: "link", raw: e[0], text: t, href: s, tokens: [{ type: "text", raw: t, text: t }] };
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
inlineText(r) {
|
|
1058
|
+
let e = this.rules.inline.text.exec(r);
|
|
1059
|
+
if (e) {
|
|
1060
|
+
let t = this.lexer.state.inRawBlock;
|
|
1061
|
+
return { type: "text", raw: e[0], text: e[0], escaped: t };
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}, X = class Rt {
|
|
1065
|
+
constructor(e) {
|
|
1066
|
+
A(this, "tokens");
|
|
1067
|
+
A(this, "options");
|
|
1068
|
+
A(this, "state");
|
|
1069
|
+
A(this, "inlineQueue");
|
|
1070
|
+
A(this, "tokenizer");
|
|
1071
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || ke, this.options.tokenizer = this.options.tokenizer || new nt(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
|
|
1072
|
+
let t = { other: z, block: Qe.normal, inline: Pe.normal };
|
|
1073
|
+
this.options.pedantic ? (t.block = Qe.pedantic, t.inline = Pe.pedantic) : this.options.gfm && (t.block = Qe.gfm, this.options.breaks ? t.inline = Pe.breaks : t.inline = Pe.gfm), this.tokenizer.rules = t;
|
|
1074
|
+
}
|
|
1075
|
+
static get rules() {
|
|
1076
|
+
return { block: Qe, inline: Pe };
|
|
1077
|
+
}
|
|
1078
|
+
static lex(e, t) {
|
|
1079
|
+
return new Rt(t).lex(e);
|
|
1080
|
+
}
|
|
1081
|
+
static lexInline(e, t) {
|
|
1082
|
+
return new Rt(t).inlineTokens(e);
|
|
1083
|
+
}
|
|
1084
|
+
lex(e) {
|
|
1085
|
+
e = e.replace(z.carriageReturn, `
|
|
1086
|
+
`), this.blockTokens(e, this.tokens);
|
|
1087
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
1088
|
+
let s = this.inlineQueue[t];
|
|
1089
|
+
this.inlineTokens(s.src, s.tokens);
|
|
1090
|
+
}
|
|
1091
|
+
return this.inlineQueue = [], this.tokens;
|
|
1092
|
+
}
|
|
1093
|
+
blockTokens(e, t = [], s = !1) {
|
|
1094
|
+
for (this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(z.tabCharGlobal, " ").replace(z.spaceLine, "")); e; ) {
|
|
1095
|
+
let n;
|
|
1096
|
+
if (this.options.extensions?.block?.some((a) => (n = a.call({ lexer: this }, e, t)) ? (e = e.substring(n.raw.length), t.push(n), !0) : !1)) continue;
|
|
1097
|
+
if (n = this.tokenizer.space(e)) {
|
|
1098
|
+
e = e.substring(n.raw.length);
|
|
1099
|
+
let a = t.at(-1);
|
|
1100
|
+
n.raw.length === 1 && a !== void 0 ? a.raw += `
|
|
1101
|
+
` : t.push(n);
|
|
1102
|
+
continue;
|
|
1103
|
+
}
|
|
1104
|
+
if (n = this.tokenizer.code(e)) {
|
|
1105
|
+
e = e.substring(n.raw.length);
|
|
1106
|
+
let a = t.at(-1);
|
|
1107
|
+
a?.type === "paragraph" || a?.type === "text" ? (a.raw += (a.raw.endsWith(`
|
|
1108
|
+
`) ? "" : `
|
|
1109
|
+
`) + n.raw, a.text += `
|
|
1110
|
+
` + n.text, this.inlineQueue.at(-1).src = a.text) : t.push(n);
|
|
1111
|
+
continue;
|
|
1112
|
+
}
|
|
1113
|
+
if (n = this.tokenizer.fences(e)) {
|
|
1114
|
+
e = e.substring(n.raw.length), t.push(n);
|
|
1115
|
+
continue;
|
|
1116
|
+
}
|
|
1117
|
+
if (n = this.tokenizer.heading(e)) {
|
|
1118
|
+
e = e.substring(n.raw.length), t.push(n);
|
|
1119
|
+
continue;
|
|
1120
|
+
}
|
|
1121
|
+
if (n = this.tokenizer.hr(e)) {
|
|
1122
|
+
e = e.substring(n.raw.length), t.push(n);
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
if (n = this.tokenizer.blockquote(e)) {
|
|
1126
|
+
e = e.substring(n.raw.length), t.push(n);
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
if (n = this.tokenizer.list(e)) {
|
|
1130
|
+
e = e.substring(n.raw.length), t.push(n);
|
|
1131
|
+
continue;
|
|
1132
|
+
}
|
|
1133
|
+
if (n = this.tokenizer.html(e)) {
|
|
1134
|
+
e = e.substring(n.raw.length), t.push(n);
|
|
1135
|
+
continue;
|
|
1136
|
+
}
|
|
1137
|
+
if (n = this.tokenizer.def(e)) {
|
|
1138
|
+
e = e.substring(n.raw.length);
|
|
1139
|
+
let a = t.at(-1);
|
|
1140
|
+
a?.type === "paragraph" || a?.type === "text" ? (a.raw += (a.raw.endsWith(`
|
|
1141
|
+
`) ? "" : `
|
|
1142
|
+
`) + n.raw, a.text += `
|
|
1143
|
+
` + n.raw, this.inlineQueue.at(-1).src = a.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = { href: n.href, title: n.title }, t.push(n));
|
|
1144
|
+
continue;
|
|
1145
|
+
}
|
|
1146
|
+
if (n = this.tokenizer.table(e)) {
|
|
1147
|
+
e = e.substring(n.raw.length), t.push(n);
|
|
1148
|
+
continue;
|
|
1149
|
+
}
|
|
1150
|
+
if (n = this.tokenizer.lheading(e)) {
|
|
1151
|
+
e = e.substring(n.raw.length), t.push(n);
|
|
1152
|
+
continue;
|
|
1153
|
+
}
|
|
1154
|
+
let l = e;
|
|
1155
|
+
if (this.options.extensions?.startBlock) {
|
|
1156
|
+
let a = 1 / 0, c = e.slice(1), o;
|
|
1157
|
+
this.options.extensions.startBlock.forEach((h) => {
|
|
1158
|
+
o = h.call({ lexer: this }, c), typeof o == "number" && o >= 0 && (a = Math.min(a, o));
|
|
1159
|
+
}), a < 1 / 0 && a >= 0 && (l = e.substring(0, a + 1));
|
|
1160
|
+
}
|
|
1161
|
+
if (this.state.top && (n = this.tokenizer.paragraph(l))) {
|
|
1162
|
+
let a = t.at(-1);
|
|
1163
|
+
s && a?.type === "paragraph" ? (a.raw += (a.raw.endsWith(`
|
|
1164
|
+
`) ? "" : `
|
|
1165
|
+
`) + n.raw, a.text += `
|
|
1166
|
+
` + n.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(n), s = l.length !== e.length, e = e.substring(n.raw.length);
|
|
1167
|
+
continue;
|
|
1168
|
+
}
|
|
1169
|
+
if (n = this.tokenizer.text(e)) {
|
|
1170
|
+
e = e.substring(n.raw.length);
|
|
1171
|
+
let a = t.at(-1);
|
|
1172
|
+
a?.type === "text" ? (a.raw += (a.raw.endsWith(`
|
|
1173
|
+
`) ? "" : `
|
|
1174
|
+
`) + n.raw, a.text += `
|
|
1175
|
+
` + n.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(n);
|
|
1176
|
+
continue;
|
|
1177
|
+
}
|
|
1178
|
+
if (e) {
|
|
1179
|
+
let a = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1180
|
+
if (this.options.silent) {
|
|
1181
|
+
console.error(a);
|
|
1182
|
+
break;
|
|
1183
|
+
} else throw new Error(a);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
return this.state.top = !0, t;
|
|
1187
|
+
}
|
|
1188
|
+
inline(e, t = []) {
|
|
1189
|
+
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
1190
|
+
}
|
|
1191
|
+
inlineTokens(e, t = []) {
|
|
1192
|
+
this.tokenizer.lexer = this;
|
|
1193
|
+
let s = e, n = null;
|
|
1194
|
+
if (this.tokens.links) {
|
|
1195
|
+
let o = Object.keys(this.tokens.links);
|
|
1196
|
+
if (o.length > 0) for (; (n = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; ) o.includes(n[0].slice(n[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, n.index) + "[" + "a".repeat(n[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
1197
|
+
}
|
|
1198
|
+
for (; (n = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; ) s = s.slice(0, n.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1199
|
+
let l;
|
|
1200
|
+
for (; (n = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; ) l = n[2] ? n[2].length : 0, s = s.slice(0, n.index + l) + "[" + "a".repeat(n[0].length - l - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1201
|
+
s = this.options.hooks?.emStrongMask?.call({ lexer: this }, s) ?? s;
|
|
1202
|
+
let a = !1, c = "";
|
|
1203
|
+
for (; e; ) {
|
|
1204
|
+
a || (c = ""), a = !1;
|
|
1205
|
+
let o;
|
|
1206
|
+
if (this.options.extensions?.inline?.some((u) => (o = u.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1)) continue;
|
|
1207
|
+
if (o = this.tokenizer.escape(e)) {
|
|
1208
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1209
|
+
continue;
|
|
1210
|
+
}
|
|
1211
|
+
if (o = this.tokenizer.tag(e)) {
|
|
1212
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1213
|
+
continue;
|
|
1214
|
+
}
|
|
1215
|
+
if (o = this.tokenizer.link(e)) {
|
|
1216
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1217
|
+
continue;
|
|
1218
|
+
}
|
|
1219
|
+
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
1220
|
+
e = e.substring(o.raw.length);
|
|
1221
|
+
let u = t.at(-1);
|
|
1222
|
+
o.type === "text" && u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
|
|
1223
|
+
continue;
|
|
1224
|
+
}
|
|
1225
|
+
if (o = this.tokenizer.emStrong(e, s, c)) {
|
|
1226
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1227
|
+
continue;
|
|
1228
|
+
}
|
|
1229
|
+
if (o = this.tokenizer.codespan(e)) {
|
|
1230
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1231
|
+
continue;
|
|
1232
|
+
}
|
|
1233
|
+
if (o = this.tokenizer.br(e)) {
|
|
1234
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1235
|
+
continue;
|
|
1236
|
+
}
|
|
1237
|
+
if (o = this.tokenizer.del(e, s, c)) {
|
|
1238
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1239
|
+
continue;
|
|
1240
|
+
}
|
|
1241
|
+
if (o = this.tokenizer.autolink(e)) {
|
|
1242
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1243
|
+
continue;
|
|
1244
|
+
}
|
|
1245
|
+
if (!this.state.inLink && (o = this.tokenizer.url(e))) {
|
|
1246
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1247
|
+
continue;
|
|
1248
|
+
}
|
|
1249
|
+
let h = e;
|
|
1250
|
+
if (this.options.extensions?.startInline) {
|
|
1251
|
+
let u = 1 / 0, m = e.slice(1), d;
|
|
1252
|
+
this.options.extensions.startInline.forEach((T) => {
|
|
1253
|
+
d = T.call({ lexer: this }, m), typeof d == "number" && d >= 0 && (u = Math.min(u, d));
|
|
1254
|
+
}), u < 1 / 0 && u >= 0 && (h = e.substring(0, u + 1));
|
|
1255
|
+
}
|
|
1256
|
+
if (o = this.tokenizer.inlineText(h)) {
|
|
1257
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (c = o.raw.slice(-1)), a = !0;
|
|
1258
|
+
let u = t.at(-1);
|
|
1259
|
+
u?.type === "text" ? (u.raw += o.raw, u.text += o.text) : t.push(o);
|
|
1260
|
+
continue;
|
|
1261
|
+
}
|
|
1262
|
+
if (e) {
|
|
1263
|
+
let u = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1264
|
+
if (this.options.silent) {
|
|
1265
|
+
console.error(u);
|
|
1266
|
+
break;
|
|
1267
|
+
} else throw new Error(u);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
return t;
|
|
1271
|
+
}
|
|
1272
|
+
}, rt = class {
|
|
1273
|
+
constructor(r) {
|
|
1274
|
+
A(this, "options");
|
|
1275
|
+
A(this, "parser");
|
|
1276
|
+
this.options = r || ke;
|
|
1277
|
+
}
|
|
1278
|
+
space(r) {
|
|
1279
|
+
return "";
|
|
1280
|
+
}
|
|
1281
|
+
code({ text: r, lang: e, escaped: t }) {
|
|
1282
|
+
let s = (e || "").match(z.notSpaceStart)?.[0], n = r.replace(z.endingNewline, "") + `
|
|
1283
|
+
`;
|
|
1284
|
+
return s ? '<pre><code class="language-' + te(s) + '">' + (t ? n : te(n, !0)) + `</code></pre>
|
|
1285
|
+
` : "<pre><code>" + (t ? n : te(n, !0)) + `</code></pre>
|
|
1286
|
+
`;
|
|
1287
|
+
}
|
|
1288
|
+
blockquote({ tokens: r }) {
|
|
1289
|
+
return `<blockquote>
|
|
1290
|
+
${this.parser.parse(r)}</blockquote>
|
|
1291
|
+
`;
|
|
1292
|
+
}
|
|
1293
|
+
html({ text: r }) {
|
|
1294
|
+
return r;
|
|
1295
|
+
}
|
|
1296
|
+
def(r) {
|
|
1297
|
+
return "";
|
|
1298
|
+
}
|
|
1299
|
+
heading({ tokens: r, depth: e }) {
|
|
1300
|
+
return `<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
1301
|
+
`;
|
|
1302
|
+
}
|
|
1303
|
+
hr(r) {
|
|
1304
|
+
return `<hr>
|
|
1305
|
+
`;
|
|
1306
|
+
}
|
|
1307
|
+
list(r) {
|
|
1308
|
+
let e = r.ordered, t = r.start, s = "";
|
|
1309
|
+
for (let a = 0; a < r.items.length; a++) {
|
|
1310
|
+
let c = r.items[a];
|
|
1311
|
+
s += this.listitem(c);
|
|
1312
|
+
}
|
|
1313
|
+
let n = e ? "ol" : "ul", l = e && t !== 1 ? ' start="' + t + '"' : "";
|
|
1314
|
+
return "<" + n + l + `>
|
|
1315
|
+
` + s + "</" + n + `>
|
|
1316
|
+
`;
|
|
1317
|
+
}
|
|
1318
|
+
listitem(r) {
|
|
1319
|
+
return `<li>${this.parser.parse(r.tokens)}</li>
|
|
1320
|
+
`;
|
|
1321
|
+
}
|
|
1322
|
+
checkbox({ checked: r }) {
|
|
1323
|
+
return "<input " + (r ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
1324
|
+
}
|
|
1325
|
+
paragraph({ tokens: r }) {
|
|
1326
|
+
return `<p>${this.parser.parseInline(r)}</p>
|
|
1327
|
+
`;
|
|
1328
|
+
}
|
|
1329
|
+
table(r) {
|
|
1330
|
+
let e = "", t = "";
|
|
1331
|
+
for (let n = 0; n < r.header.length; n++) t += this.tablecell(r.header[n]);
|
|
1332
|
+
e += this.tablerow({ text: t });
|
|
1333
|
+
let s = "";
|
|
1334
|
+
for (let n = 0; n < r.rows.length; n++) {
|
|
1335
|
+
let l = r.rows[n];
|
|
1336
|
+
t = "";
|
|
1337
|
+
for (let a = 0; a < l.length; a++) t += this.tablecell(l[a]);
|
|
1338
|
+
s += this.tablerow({ text: t });
|
|
1339
|
+
}
|
|
1340
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
1341
|
+
<thead>
|
|
1342
|
+
` + e + `</thead>
|
|
1343
|
+
` + s + `</table>
|
|
1344
|
+
`;
|
|
1345
|
+
}
|
|
1346
|
+
tablerow({ text: r }) {
|
|
1347
|
+
return `<tr>
|
|
1348
|
+
${r}</tr>
|
|
1349
|
+
`;
|
|
1350
|
+
}
|
|
1351
|
+
tablecell(r) {
|
|
1352
|
+
let e = this.parser.parseInline(r.tokens), t = r.header ? "th" : "td";
|
|
1353
|
+
return (r.align ? `<${t} align="${r.align}">` : `<${t}>`) + e + `</${t}>
|
|
1354
|
+
`;
|
|
1355
|
+
}
|
|
1356
|
+
strong({ tokens: r }) {
|
|
1357
|
+
return `<strong>${this.parser.parseInline(r)}</strong>`;
|
|
1358
|
+
}
|
|
1359
|
+
em({ tokens: r }) {
|
|
1360
|
+
return `<em>${this.parser.parseInline(r)}</em>`;
|
|
1361
|
+
}
|
|
1362
|
+
codespan({ text: r }) {
|
|
1363
|
+
return `<code>${te(r, !0)}</code>`;
|
|
1364
|
+
}
|
|
1365
|
+
br(r) {
|
|
1366
|
+
return "<br>";
|
|
1367
|
+
}
|
|
1368
|
+
del({ tokens: r }) {
|
|
1369
|
+
return `<del>${this.parser.parseInline(r)}</del>`;
|
|
1370
|
+
}
|
|
1371
|
+
link({ href: r, title: e, tokens: t }) {
|
|
1372
|
+
let s = this.parser.parseInline(t), n = An(r);
|
|
1373
|
+
if (n === null) return s;
|
|
1374
|
+
r = n;
|
|
1375
|
+
let l = '<a href="' + r + '"';
|
|
1376
|
+
return e && (l += ' title="' + te(e) + '"'), l += ">" + s + "</a>", l;
|
|
1377
|
+
}
|
|
1378
|
+
image({ href: r, title: e, text: t, tokens: s }) {
|
|
1379
|
+
s && (t = this.parser.parseInline(s, this.parser.textRenderer));
|
|
1380
|
+
let n = An(r);
|
|
1381
|
+
if (n === null) return te(t);
|
|
1382
|
+
r = n;
|
|
1383
|
+
let l = `<img src="${r}" alt="${te(t)}"`;
|
|
1384
|
+
return e && (l += ` title="${te(e)}"`), l += ">", l;
|
|
1385
|
+
}
|
|
1386
|
+
text(r) {
|
|
1387
|
+
return "tokens" in r && r.tokens ? this.parser.parseInline(r.tokens) : "escaped" in r && r.escaped ? r.text : te(r.text);
|
|
1388
|
+
}
|
|
1389
|
+
}, zt = class {
|
|
1390
|
+
strong({ text: r }) {
|
|
1391
|
+
return r;
|
|
1392
|
+
}
|
|
1393
|
+
em({ text: r }) {
|
|
1394
|
+
return r;
|
|
1395
|
+
}
|
|
1396
|
+
codespan({ text: r }) {
|
|
1397
|
+
return r;
|
|
1398
|
+
}
|
|
1399
|
+
del({ text: r }) {
|
|
1400
|
+
return r;
|
|
1401
|
+
}
|
|
1402
|
+
html({ text: r }) {
|
|
1403
|
+
return r;
|
|
1404
|
+
}
|
|
1405
|
+
text({ text: r }) {
|
|
1406
|
+
return r;
|
|
1407
|
+
}
|
|
1408
|
+
link({ text: r }) {
|
|
1409
|
+
return "" + r;
|
|
1410
|
+
}
|
|
1411
|
+
image({ text: r }) {
|
|
1412
|
+
return "" + r;
|
|
1413
|
+
}
|
|
1414
|
+
br() {
|
|
1415
|
+
return "";
|
|
1416
|
+
}
|
|
1417
|
+
checkbox({ raw: r }) {
|
|
1418
|
+
return r;
|
|
1419
|
+
}
|
|
1420
|
+
}, Q = class Ct {
|
|
1421
|
+
constructor(e) {
|
|
1422
|
+
A(this, "options");
|
|
1423
|
+
A(this, "renderer");
|
|
1424
|
+
A(this, "textRenderer");
|
|
1425
|
+
this.options = e || ke, this.options.renderer = this.options.renderer || new rt(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new zt();
|
|
1426
|
+
}
|
|
1427
|
+
static parse(e, t) {
|
|
1428
|
+
return new Ct(t).parse(e);
|
|
1429
|
+
}
|
|
1430
|
+
static parseInline(e, t) {
|
|
1431
|
+
return new Ct(t).parseInline(e);
|
|
1432
|
+
}
|
|
1433
|
+
parse(e) {
|
|
1434
|
+
this.renderer.parser = this;
|
|
1435
|
+
let t = "";
|
|
1436
|
+
for (let s = 0; s < e.length; s++) {
|
|
1437
|
+
let n = e[s];
|
|
1438
|
+
if (this.options.extensions?.renderers?.[n.type]) {
|
|
1439
|
+
let a = n, c = this.options.extensions.renderers[a.type].call({ parser: this }, a);
|
|
1440
|
+
if (c !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(a.type)) {
|
|
1441
|
+
t += c || "";
|
|
1442
|
+
continue;
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
let l = n;
|
|
1446
|
+
switch (l.type) {
|
|
1447
|
+
case "space": {
|
|
1448
|
+
t += this.renderer.space(l);
|
|
1449
|
+
break;
|
|
1450
|
+
}
|
|
1451
|
+
case "hr": {
|
|
1452
|
+
t += this.renderer.hr(l);
|
|
1453
|
+
break;
|
|
1454
|
+
}
|
|
1455
|
+
case "heading": {
|
|
1456
|
+
t += this.renderer.heading(l);
|
|
1457
|
+
break;
|
|
1458
|
+
}
|
|
1459
|
+
case "code": {
|
|
1460
|
+
t += this.renderer.code(l);
|
|
1461
|
+
break;
|
|
1462
|
+
}
|
|
1463
|
+
case "table": {
|
|
1464
|
+
t += this.renderer.table(l);
|
|
1465
|
+
break;
|
|
1466
|
+
}
|
|
1467
|
+
case "blockquote": {
|
|
1468
|
+
t += this.renderer.blockquote(l);
|
|
1469
|
+
break;
|
|
1470
|
+
}
|
|
1471
|
+
case "list": {
|
|
1472
|
+
t += this.renderer.list(l);
|
|
1473
|
+
break;
|
|
1474
|
+
}
|
|
1475
|
+
case "checkbox": {
|
|
1476
|
+
t += this.renderer.checkbox(l);
|
|
1477
|
+
break;
|
|
1478
|
+
}
|
|
1479
|
+
case "html": {
|
|
1480
|
+
t += this.renderer.html(l);
|
|
1481
|
+
break;
|
|
1482
|
+
}
|
|
1483
|
+
case "def": {
|
|
1484
|
+
t += this.renderer.def(l);
|
|
1485
|
+
break;
|
|
1486
|
+
}
|
|
1487
|
+
case "paragraph": {
|
|
1488
|
+
t += this.renderer.paragraph(l);
|
|
1489
|
+
break;
|
|
1490
|
+
}
|
|
1491
|
+
case "text": {
|
|
1492
|
+
t += this.renderer.text(l);
|
|
1493
|
+
break;
|
|
1494
|
+
}
|
|
1495
|
+
default: {
|
|
1496
|
+
let a = 'Token with "' + l.type + '" type was not found.';
|
|
1497
|
+
if (this.options.silent) return console.error(a), "";
|
|
1498
|
+
throw new Error(a);
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
return t;
|
|
1503
|
+
}
|
|
1504
|
+
parseInline(e, t = this.renderer) {
|
|
1505
|
+
this.renderer.parser = this;
|
|
1506
|
+
let s = "";
|
|
1507
|
+
for (let n = 0; n < e.length; n++) {
|
|
1508
|
+
let l = e[n];
|
|
1509
|
+
if (this.options.extensions?.renderers?.[l.type]) {
|
|
1510
|
+
let c = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
1511
|
+
if (c !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
|
|
1512
|
+
s += c || "";
|
|
1513
|
+
continue;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
let a = l;
|
|
1517
|
+
switch (a.type) {
|
|
1518
|
+
case "escape": {
|
|
1519
|
+
s += t.text(a);
|
|
1520
|
+
break;
|
|
1521
|
+
}
|
|
1522
|
+
case "html": {
|
|
1523
|
+
s += t.html(a);
|
|
1524
|
+
break;
|
|
1525
|
+
}
|
|
1526
|
+
case "link": {
|
|
1527
|
+
s += t.link(a);
|
|
1528
|
+
break;
|
|
1529
|
+
}
|
|
1530
|
+
case "image": {
|
|
1531
|
+
s += t.image(a);
|
|
1532
|
+
break;
|
|
1533
|
+
}
|
|
1534
|
+
case "checkbox": {
|
|
1535
|
+
s += t.checkbox(a);
|
|
1536
|
+
break;
|
|
1537
|
+
}
|
|
1538
|
+
case "strong": {
|
|
1539
|
+
s += t.strong(a);
|
|
1540
|
+
break;
|
|
1541
|
+
}
|
|
1542
|
+
case "em": {
|
|
1543
|
+
s += t.em(a);
|
|
1544
|
+
break;
|
|
1545
|
+
}
|
|
1546
|
+
case "codespan": {
|
|
1547
|
+
s += t.codespan(a);
|
|
1548
|
+
break;
|
|
1549
|
+
}
|
|
1550
|
+
case "br": {
|
|
1551
|
+
s += t.br(a);
|
|
1552
|
+
break;
|
|
1553
|
+
}
|
|
1554
|
+
case "del": {
|
|
1555
|
+
s += t.del(a);
|
|
1556
|
+
break;
|
|
1557
|
+
}
|
|
1558
|
+
case "text": {
|
|
1559
|
+
s += t.text(a);
|
|
1560
|
+
break;
|
|
1561
|
+
}
|
|
1562
|
+
default: {
|
|
1563
|
+
let c = 'Token with "' + a.type + '" type was not found.';
|
|
1564
|
+
if (this.options.silent) return console.error(c), "";
|
|
1565
|
+
throw new Error(c);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
return s;
|
|
1570
|
+
}
|
|
1571
|
+
}, Ve, ze = (Ve = class {
|
|
1572
|
+
constructor(r) {
|
|
1573
|
+
A(this, "options");
|
|
1574
|
+
A(this, "block");
|
|
1575
|
+
this.options = r || ke;
|
|
1576
|
+
}
|
|
1577
|
+
preprocess(r) {
|
|
1578
|
+
return r;
|
|
1579
|
+
}
|
|
1580
|
+
postprocess(r) {
|
|
1581
|
+
return r;
|
|
1582
|
+
}
|
|
1583
|
+
processAllTokens(r) {
|
|
1584
|
+
return r;
|
|
1585
|
+
}
|
|
1586
|
+
emStrongMask(r) {
|
|
1587
|
+
return r;
|
|
1588
|
+
}
|
|
1589
|
+
provideLexer() {
|
|
1590
|
+
return this.block ? X.lex : X.lexInline;
|
|
1591
|
+
}
|
|
1592
|
+
provideParser() {
|
|
1593
|
+
return this.block ? Q.parse : Q.parseInline;
|
|
1594
|
+
}
|
|
1595
|
+
}, A(Ve, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), A(Ve, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Ve), bs = class {
|
|
1596
|
+
constructor(...r) {
|
|
1597
|
+
A(this, "defaults", Lt());
|
|
1598
|
+
A(this, "options", this.setOptions);
|
|
1599
|
+
A(this, "parse", this.parseMarkdown(!0));
|
|
1600
|
+
A(this, "parseInline", this.parseMarkdown(!1));
|
|
1601
|
+
A(this, "Parser", Q);
|
|
1602
|
+
A(this, "Renderer", rt);
|
|
1603
|
+
A(this, "TextRenderer", zt);
|
|
1604
|
+
A(this, "Lexer", X);
|
|
1605
|
+
A(this, "Tokenizer", nt);
|
|
1606
|
+
A(this, "Hooks", ze);
|
|
1607
|
+
this.use(...r);
|
|
1608
|
+
}
|
|
1609
|
+
walkTokens(r, e) {
|
|
1610
|
+
let t = [];
|
|
1611
|
+
for (let s of r) switch (t = t.concat(e.call(this, s)), s.type) {
|
|
1612
|
+
case "table": {
|
|
1613
|
+
let n = s;
|
|
1614
|
+
for (let l of n.header) t = t.concat(this.walkTokens(l.tokens, e));
|
|
1615
|
+
for (let l of n.rows) for (let a of l) t = t.concat(this.walkTokens(a.tokens, e));
|
|
1616
|
+
break;
|
|
1617
|
+
}
|
|
1618
|
+
case "list": {
|
|
1619
|
+
let n = s;
|
|
1620
|
+
t = t.concat(this.walkTokens(n.items, e));
|
|
1621
|
+
break;
|
|
1622
|
+
}
|
|
1623
|
+
default: {
|
|
1624
|
+
let n = s;
|
|
1625
|
+
this.defaults.extensions?.childTokens?.[n.type] ? this.defaults.extensions.childTokens[n.type].forEach((l) => {
|
|
1626
|
+
let a = n[l].flat(1 / 0);
|
|
1627
|
+
t = t.concat(this.walkTokens(a, e));
|
|
1628
|
+
}) : n.tokens && (t = t.concat(this.walkTokens(n.tokens, e)));
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
return t;
|
|
1632
|
+
}
|
|
1633
|
+
use(...r) {
|
|
1634
|
+
let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1635
|
+
return r.forEach((t) => {
|
|
1636
|
+
let s = { ...t };
|
|
1637
|
+
if (s.async = this.defaults.async || s.async || !1, t.extensions && (t.extensions.forEach((n) => {
|
|
1638
|
+
if (!n.name) throw new Error("extension name required");
|
|
1639
|
+
if ("renderer" in n) {
|
|
1640
|
+
let l = e.renderers[n.name];
|
|
1641
|
+
l ? e.renderers[n.name] = function(...a) {
|
|
1642
|
+
let c = n.renderer.apply(this, a);
|
|
1643
|
+
return c === !1 && (c = l.apply(this, a)), c;
|
|
1644
|
+
} : e.renderers[n.name] = n.renderer;
|
|
1645
|
+
}
|
|
1646
|
+
if ("tokenizer" in n) {
|
|
1647
|
+
if (!n.level || n.level !== "block" && n.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1648
|
+
let l = e[n.level];
|
|
1649
|
+
l ? l.unshift(n.tokenizer) : e[n.level] = [n.tokenizer], n.start && (n.level === "block" ? e.startBlock ? e.startBlock.push(n.start) : e.startBlock = [n.start] : n.level === "inline" && (e.startInline ? e.startInline.push(n.start) : e.startInline = [n.start]));
|
|
1650
|
+
}
|
|
1651
|
+
"childTokens" in n && n.childTokens && (e.childTokens[n.name] = n.childTokens);
|
|
1652
|
+
}), s.extensions = e), t.renderer) {
|
|
1653
|
+
let n = this.defaults.renderer || new rt(this.defaults);
|
|
1654
|
+
for (let l in t.renderer) {
|
|
1655
|
+
if (!(l in n)) throw new Error(`renderer '${l}' does not exist`);
|
|
1656
|
+
if (["options", "parser"].includes(l)) continue;
|
|
1657
|
+
let a = l, c = t.renderer[a], o = n[a];
|
|
1658
|
+
n[a] = (...h) => {
|
|
1659
|
+
let u = c.apply(n, h);
|
|
1660
|
+
return u === !1 && (u = o.apply(n, h)), u || "";
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
s.renderer = n;
|
|
1664
|
+
}
|
|
1665
|
+
if (t.tokenizer) {
|
|
1666
|
+
let n = this.defaults.tokenizer || new nt(this.defaults);
|
|
1667
|
+
for (let l in t.tokenizer) {
|
|
1668
|
+
if (!(l in n)) throw new Error(`tokenizer '${l}' does not exist`);
|
|
1669
|
+
if (["options", "rules", "lexer"].includes(l)) continue;
|
|
1670
|
+
let a = l, c = t.tokenizer[a], o = n[a];
|
|
1671
|
+
n[a] = (...h) => {
|
|
1672
|
+
let u = c.apply(n, h);
|
|
1673
|
+
return u === !1 && (u = o.apply(n, h)), u;
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
s.tokenizer = n;
|
|
1677
|
+
}
|
|
1678
|
+
if (t.hooks) {
|
|
1679
|
+
let n = this.defaults.hooks || new ze();
|
|
1680
|
+
for (let l in t.hooks) {
|
|
1681
|
+
if (!(l in n)) throw new Error(`hook '${l}' does not exist`);
|
|
1682
|
+
if (["options", "block"].includes(l)) continue;
|
|
1683
|
+
let a = l, c = t.hooks[a], o = n[a];
|
|
1684
|
+
ze.passThroughHooks.has(l) ? n[a] = (h) => {
|
|
1685
|
+
if (this.defaults.async && ze.passThroughHooksRespectAsync.has(l)) return (async () => {
|
|
1686
|
+
let m = await c.call(n, h);
|
|
1687
|
+
return o.call(n, m);
|
|
1688
|
+
})();
|
|
1689
|
+
let u = c.call(n, h);
|
|
1690
|
+
return o.call(n, u);
|
|
1691
|
+
} : n[a] = (...h) => {
|
|
1692
|
+
if (this.defaults.async) return (async () => {
|
|
1693
|
+
let m = await c.apply(n, h);
|
|
1694
|
+
return m === !1 && (m = await o.apply(n, h)), m;
|
|
1695
|
+
})();
|
|
1696
|
+
let u = c.apply(n, h);
|
|
1697
|
+
return u === !1 && (u = o.apply(n, h)), u;
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
s.hooks = n;
|
|
1701
|
+
}
|
|
1702
|
+
if (t.walkTokens) {
|
|
1703
|
+
let n = this.defaults.walkTokens, l = t.walkTokens;
|
|
1704
|
+
s.walkTokens = function(a) {
|
|
1705
|
+
let c = [];
|
|
1706
|
+
return c.push(l.call(this, a)), n && (c = c.concat(n.call(this, a))), c;
|
|
1707
|
+
};
|
|
1708
|
+
}
|
|
1709
|
+
this.defaults = { ...this.defaults, ...s };
|
|
1710
|
+
}), this;
|
|
1711
|
+
}
|
|
1712
|
+
setOptions(r) {
|
|
1713
|
+
return this.defaults = { ...this.defaults, ...r }, this;
|
|
1714
|
+
}
|
|
1715
|
+
lexer(r, e) {
|
|
1716
|
+
return X.lex(r, e ?? this.defaults);
|
|
1717
|
+
}
|
|
1718
|
+
parser(r, e) {
|
|
1719
|
+
return Q.parse(r, e ?? this.defaults);
|
|
1720
|
+
}
|
|
1721
|
+
parseMarkdown(r) {
|
|
1722
|
+
return (e, t) => {
|
|
1723
|
+
let s = { ...t }, n = { ...this.defaults, ...s }, l = this.onError(!!n.silent, !!n.async);
|
|
1724
|
+
if (this.defaults.async === !0 && s.async === !1) return l(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."));
|
|
1725
|
+
if (typeof e > "u" || e === null) return l(new Error("marked(): input parameter is undefined or null"));
|
|
1726
|
+
if (typeof e != "string") return l(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
1727
|
+
if (n.hooks && (n.hooks.options = n, n.hooks.block = r), n.async) return (async () => {
|
|
1728
|
+
let a = n.hooks ? await n.hooks.preprocess(e) : e, c = await (n.hooks ? await n.hooks.provideLexer() : r ? X.lex : X.lexInline)(a, n), o = n.hooks ? await n.hooks.processAllTokens(c) : c;
|
|
1729
|
+
n.walkTokens && await Promise.all(this.walkTokens(o, n.walkTokens));
|
|
1730
|
+
let h = await (n.hooks ? await n.hooks.provideParser() : r ? Q.parse : Q.parseInline)(o, n);
|
|
1731
|
+
return n.hooks ? await n.hooks.postprocess(h) : h;
|
|
1732
|
+
})().catch(l);
|
|
1733
|
+
try {
|
|
1734
|
+
n.hooks && (e = n.hooks.preprocess(e));
|
|
1735
|
+
let a = (n.hooks ? n.hooks.provideLexer() : r ? X.lex : X.lexInline)(e, n);
|
|
1736
|
+
n.hooks && (a = n.hooks.processAllTokens(a)), n.walkTokens && this.walkTokens(a, n.walkTokens);
|
|
1737
|
+
let c = (n.hooks ? n.hooks.provideParser() : r ? Q.parse : Q.parseInline)(a, n);
|
|
1738
|
+
return n.hooks && (c = n.hooks.postprocess(c)), c;
|
|
1739
|
+
} catch (a) {
|
|
1740
|
+
return l(a);
|
|
1741
|
+
}
|
|
1742
|
+
};
|
|
1743
|
+
}
|
|
1744
|
+
onError(r, e) {
|
|
1745
|
+
return (t) => {
|
|
1746
|
+
if (t.message += `
|
|
1747
|
+
Please report this to https://github.com/markedjs/marked.`, r) {
|
|
1748
|
+
let s = "<p>An error occurred:</p><pre>" + te(t.message + "", !0) + "</pre>";
|
|
1749
|
+
return e ? Promise.resolve(s) : s;
|
|
1750
|
+
}
|
|
1751
|
+
if (e) return Promise.reject(t);
|
|
1752
|
+
throw t;
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1755
|
+
}, me = new bs();
|
|
1756
|
+
function w(r, e) {
|
|
1757
|
+
return me.parse(r, e);
|
|
1758
|
+
}
|
|
1759
|
+
w.options = w.setOptions = function(r) {
|
|
1760
|
+
return me.setOptions(r), w.defaults = me.defaults, In(w.defaults), w;
|
|
1761
|
+
};
|
|
1762
|
+
w.getDefaults = Lt;
|
|
1763
|
+
w.defaults = ke;
|
|
1764
|
+
w.use = function(...r) {
|
|
1765
|
+
return me.use(...r), w.defaults = me.defaults, In(w.defaults), w;
|
|
1766
|
+
};
|
|
1767
|
+
w.walkTokens = function(r, e) {
|
|
1768
|
+
return me.walkTokens(r, e);
|
|
1769
|
+
};
|
|
1770
|
+
w.parseInline = me.parseInline;
|
|
1771
|
+
w.Parser = Q;
|
|
1772
|
+
w.parser = Q.parse;
|
|
1773
|
+
w.Renderer = rt;
|
|
1774
|
+
w.TextRenderer = zt;
|
|
1775
|
+
w.Lexer = X;
|
|
1776
|
+
w.lexer = X.lex;
|
|
1777
|
+
w.Tokenizer = nt;
|
|
1778
|
+
w.Hooks = ze;
|
|
1779
|
+
w.parse = w;
|
|
1780
|
+
w.options;
|
|
1781
|
+
w.setOptions;
|
|
1782
|
+
w.use;
|
|
1783
|
+
w.walkTokens;
|
|
1784
|
+
w.parseInline;
|
|
1785
|
+
Q.parse;
|
|
1786
|
+
X.lex;
|
|
1787
|
+
function xs(r) {
|
|
1788
|
+
return r.replace(/([^\s>])(<a\b)/gu, "$1 $2").replace(/(<\/a>)([\p{L}\p{N}])/gu, "$1 $2");
|
|
1789
|
+
}
|
|
1790
|
+
function Ts(r) {
|
|
1791
|
+
const t = new DOMParser().parseFromString(r, "text/html"), s = t.querySelectorAll("a");
|
|
1792
|
+
for (const n of s)
|
|
1793
|
+
n.setAttribute("target", "_blank"), n.setAttribute("rel", "noopener noreferrer");
|
|
1794
|
+
return t.body.innerHTML;
|
|
1795
|
+
}
|
|
1796
|
+
function ws(r, e) {
|
|
1797
|
+
const t = xs(r), s = w.parse(t), n = Rr.sanitize(s, {
|
|
1798
|
+
FORBID_TAGS: e
|
|
1799
|
+
});
|
|
1800
|
+
return Ts(n);
|
|
1801
|
+
}
|
|
1802
|
+
function En({
|
|
1803
|
+
content: r,
|
|
1804
|
+
class: e,
|
|
1805
|
+
disallowedTags: t = []
|
|
1806
|
+
}) {
|
|
1807
|
+
if (!r)
|
|
1808
|
+
return null;
|
|
1809
|
+
const s = ws(r, t);
|
|
1810
|
+
return /* @__PURE__ */ v("div", { class: e, children: /* @__PURE__ */ v(Dr, { markup: s, type: "html", trim: !1 }) });
|
|
1811
|
+
}
|
|
1812
|
+
const As = ({
|
|
1813
|
+
config: r,
|
|
1814
|
+
manager: e,
|
|
1815
|
+
onFinish: t,
|
|
1816
|
+
onError: s
|
|
1817
|
+
}) => {
|
|
1818
|
+
const { t: n } = Vn(), [l, a] = Kn(
|
|
1819
|
+
() => {
|
|
1820
|
+
if (e) return e;
|
|
1821
|
+
if (!r)
|
|
1822
|
+
throw new Error("Consent config is required");
|
|
1823
|
+
return er({ config: r });
|
|
1824
|
+
},
|
|
1825
|
+
{ manageLifecycle: !e }
|
|
1826
|
+
);
|
|
1827
|
+
return l.status === "finished" ? (t?.(), null) : l.status === "error" ? (s?.(l.error), null) : l.status === "idle" || l.status === "loading" ? /* @__PURE__ */ v(on, { className: "IncodeConsentPage", children: /* @__PURE__ */ v("div", { class: "IncodeConsentCentered", children: /* @__PURE__ */ v(sr, {}) }) }) : /* @__PURE__ */ v(on, { className: "IncodeConsentPage", hideFooterBranding: !0, hideHeader: !0, children: /* @__PURE__ */ v("div", { class: "IncodeConsentContent", children: [
|
|
1828
|
+
/* @__PURE__ */ v("div", { class: "IncodeConsentBody", children: [
|
|
1829
|
+
/* @__PURE__ */ v("h1", { class: "IncodeConsentTitle", children: l.title }),
|
|
1830
|
+
/* @__PURE__ */ v(En, { content: l.richText, class: "IncodeRichText" }),
|
|
1831
|
+
/* @__PURE__ */ v("div", { class: "IncodeConsentCheckboxList", children: l.checkboxes.map((c) => /* @__PURE__ */ v(
|
|
1832
|
+
rr,
|
|
1833
|
+
{
|
|
1834
|
+
id: `consent-checkbox-${c.id}`,
|
|
1835
|
+
class: "IncodeConsentCheckbox",
|
|
1836
|
+
size: "s",
|
|
1837
|
+
checked: c.checked,
|
|
1838
|
+
required: c.required,
|
|
1839
|
+
onChange: () => a.toggleCheckbox(c.id),
|
|
1840
|
+
label: /* @__PURE__ */ v(
|
|
1841
|
+
"span",
|
|
1842
|
+
{
|
|
1843
|
+
class: "IncodeConsentCheckboxLabel",
|
|
1844
|
+
onClick: (o) => {
|
|
1845
|
+
o.target.closest("a") && o.stopPropagation();
|
|
1846
|
+
},
|
|
1847
|
+
children: /* @__PURE__ */ v(
|
|
1848
|
+
En,
|
|
1849
|
+
{
|
|
1850
|
+
content: c.label,
|
|
1851
|
+
class: "IncodeRichText",
|
|
1852
|
+
disallowedTags: ["img"]
|
|
1853
|
+
}
|
|
1854
|
+
)
|
|
1855
|
+
}
|
|
1856
|
+
)
|
|
1857
|
+
},
|
|
1858
|
+
c.id
|
|
1859
|
+
)) })
|
|
1860
|
+
] }),
|
|
1861
|
+
/* @__PURE__ */ v(
|
|
1862
|
+
Jn,
|
|
1863
|
+
{
|
|
1864
|
+
"data-testid": "consent-submit",
|
|
1865
|
+
onClick: () => a.submit(),
|
|
1866
|
+
disabled: !l.canSubmit,
|
|
1867
|
+
isLoading: l.status === "submitting",
|
|
1868
|
+
children: n("biometricConsent.button.continue")
|
|
1869
|
+
}
|
|
1870
|
+
)
|
|
1871
|
+
] }) });
|
|
1872
|
+
}, _s = ({
|
|
1873
|
+
config: r,
|
|
1874
|
+
manager: e,
|
|
1875
|
+
onFinish: t,
|
|
1876
|
+
onError: s
|
|
1877
|
+
}) => /* @__PURE__ */ v(Qn, { children: r ? /* @__PURE__ */ v(
|
|
1878
|
+
As,
|
|
1879
|
+
{
|
|
1880
|
+
config: r,
|
|
1881
|
+
manager: e,
|
|
1882
|
+
onFinish: t,
|
|
1883
|
+
onError: s
|
|
1884
|
+
}
|
|
1885
|
+
) : null });
|
|
1886
|
+
ir(_s, "incode-consent");
|
|
1887
|
+
export {
|
|
1888
|
+
_s as Consent
|
|
1889
|
+
};
|