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