spell 0.8.7 → 0.8.8
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/README-epics.md +96 -36
- package/app/package.json +25 -1
- package/dist/cli/publish/PublishedPackage.d.ts +2 -1
- package/dist/cli/publish/PublishedPackage.js +6 -3
- package/dist/cli/publish/ScratchInstall.d.ts +14 -3
- package/dist/cli/publish/ScratchInstall.js +69 -8
- package/dist/epic/cli/EpicProgram.js +7 -1
- package/dist/epic/cli/epicGroups.js +2 -1
- package/dist/epic/command/BaseBranch.d.ts +35 -0
- package/dist/epic/command/BaseBranch.js +58 -0
- package/dist/epic/command/EpicCheckout.d.ts +1 -1
- package/dist/epic/command/EpicCheckout.js +4 -4
- package/dist/epic/command/EpicGuide.js +3 -2
- package/dist/epic/command/EpicTools.d.ts +5 -0
- package/dist/epic/command/EpicTools.js +14 -3
- package/dist/epic/command/MainMerge.d.ts +26 -15
- package/dist/epic/command/MainMerge.js +60 -16
- package/dist/epic/command/RepoInit.d.ts +116 -8
- package/dist/epic/command/RepoInit.js +308 -13
- package/dist/epic/command/Requests.d.ts +1 -0
- package/dist/epic/command/Requests.js +6 -1
- package/dist/epic/command/SessionMoves.js +2 -1
- package/dist/epic/command/SkillsCheck.js +3 -2
- package/dist/epic/command/Stock.js +3 -1
- package/dist/epic/command/TurnEnd.d.ts +1 -1
- package/dist/epic/command/TurnEnd.js +4 -3
- package/dist/epic/command/Worktrees.d.ts +18 -3
- package/dist/epic/command/Worktrees.js +38 -7
- package/dist/epic/command/command.types.d.ts +3 -0
- package/dist/epic/components/__pack/epics.entry.js +43 -43
- package/dist/epic/components/__pack/epics.pack.js +36 -12794
- package/dist/epic/config/EngineFiles.mjs +60 -0
- package/dist/epic/config/EpicConfig.d.ts +12 -2
- package/dist/epic/config/EpicConfig.js +9 -1
- package/dist/epic/config/GitHub.d.ts +41 -1
- package/dist/epic/config/GitHub.js +75 -3
- package/dist/epic/config/LayeredSettings.js +3 -2
- package/dist/epic/server/EpicServer.d.ts +1 -1
- package/dist/epic/server/EpicServer.js +26 -12
- package/dist/epic/tool/InboxPoller.mjs +2 -1
- package/dist/epic/tool/MigrateCommands.js +6 -8
- package/dist/epic/tool/PlanDocFiles.js +3 -2
- package/dist/epic/tool/ServedFolders.d.ts +1 -1
- package/dist/epic/tool/ServedFolders.js +4 -4
- package/dist/epic/tools/PageInboxes.js +3 -3
- package/dist/epic/tools/_assets/commands.entry.js +149 -68
- package/dist/epic/tools/_assets/commands.js +20 -2073
- package/dist/epic/tools/_assets/core-reference.entry.js +244 -124
- package/dist/epic/tools/_assets/core-reference.js +20 -2142
- package/dist/epic/tools/_assets/emoji/cldr/0.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/a.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/b.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/c.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/d.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/e.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/f.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/g.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/h.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/i.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/j.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/k.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/l.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/m.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/n.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/o.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/p.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/r.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/s.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/t.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/u.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/v.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/w.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/x.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/y.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/z.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/0.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/a.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/b.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/c.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/d.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/e.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/f.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/g.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/h.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/i.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/j.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/k.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/l.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/m.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/n.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/o.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/p.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/q.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/r.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/s.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/t.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/u.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/v.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/w.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/x.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/y.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/z.js +2 -2
- package/dist/epic/tools/_assets/goals-live.js +318 -210
- package/dist/epic/tools/_assets/highlight.min.js +5764 -5269
- package/dist/epic/tools/_assets/lazy/code-engine.js +5 -1270
- package/dist/epic/tools/_assets/lazy/markdown-engine.js +67 -1513
- package/dist/epic/tools/_assets/lazy/markdown-sanitizer.js +3 -753
- package/dist/epic/tools/_assets/spell-comments.entry.js +282 -159
- package/dist/epic/tools/_assets/spell-comments.js +24 -3716
- package/dist/epic/tools/_assets/spell-doc-comments.js +1243 -816
- package/dist/epic/tools/_assets/spell-doc-helpers.js +298 -165
- package/dist/epic/tools/_assets/spell-doc-runtime.js +2760 -1415
- package/dist/epic/tools/_assets/spell-doc-toolbar.js +396 -227
- package/dist/epic/tools/_assets/spell-syntax.entry.js +505 -285
- package/dist/epic/tools/_assets/spell-syntax.js +22 -2916
- package/dist/epic/tools/_assets/spell-ui-sources.js +102 -60
- package/dist/epic/tools/_assets/spell-ui.entry.js +108 -40
- package/dist/epic/tools/_assets/spell-ui.js +3131 -46465
- package/dist/epic/tools/pages.d.ts +5 -6
- package/dist/epic/tools/pages.js +7 -6
- package/dist/epic/window.mjs +2 -3
- package/dist/ui/components/ui-accordion/UIAccordion.d.ts +1 -0
- package/dist/ui/components/ui-ad/UIAd.d.ts +1 -0
- package/dist/ui/components/ui-breadcrumbs/UIBreadcrumb.d.ts +1 -0
- package/dist/ui/components/ui-breadcrumbs/UIBreadcrumbs.d.ts +1 -0
- package/dist/ui/components/ui-button/UIButton.d.ts +8 -3
- package/dist/ui/components/ui-button/UIButton.fallback.d.ts +8 -3
- package/dist/ui/components/ui-button/UIButtons.d.ts +1 -0
- package/dist/ui/components/ui-button/UIOr.d.ts +1 -0
- package/dist/ui/components/ui-calendar/UICalendar.d.ts +6 -0
- package/dist/ui/components/ui-calendar/UICalendar.fallback.d.ts +6 -0
- package/dist/ui/components/ui-card/UICards.d.ts +31 -0
- package/dist/ui/components/ui-checkbox/UICheckbox.d.ts +7 -0
- package/dist/ui/components/ui-checkbox/UICheckbox.fallback.d.ts +7 -0
- package/dist/ui/components/ui-comment/UIComment.d.ts +1 -0
- package/dist/ui/components/ui-comment/UIComments.d.ts +1 -0
- package/dist/ui/components/ui-components/UIComponents.d.ts +1 -0
- package/dist/ui/components/ui-dimmer/UIDimmer.d.ts +1 -0
- package/dist/ui/components/ui-divider/UIDivider.d.ts +2 -0
- package/dist/ui/components/ui-dropdown/UIDropdown.d.ts +6 -0
- package/dist/ui/components/ui-dropdown/UIDropdown.fallback.d.ts +6 -0
- package/dist/ui/components/ui-embed/UIEmbed.d.ts +1 -0
- package/dist/ui/components/ui-emoji/UIEmoji.d.ts +1 -0
- package/dist/ui/components/ui-feed/UIFeed.d.ts +1 -0
- package/dist/ui/components/ui-feed/UIFeedEvent.d.ts +1 -0
- package/dist/ui/components/ui-flag/UIFlag.d.ts +1 -0
- package/dist/ui/components/ui-flyout/UIFlyout.d.ts +1 -0
- package/dist/ui/components/ui-form/UIFields.d.ts +1 -0
- package/dist/ui/components/ui-form/UIRepeat.d.ts +1 -0
- package/dist/ui/components/ui-grid/UIColumn.d.ts +1 -0
- package/dist/ui/components/ui-grid/UIGrid.d.ts +1 -0
- package/dist/ui/components/ui-grid/UIRow.d.ts +1 -0
- package/dist/ui/components/ui-icon/UIIcon.d.ts +3 -2
- package/dist/ui/components/ui-icon/UIIcons.d.ts +1 -0
- package/dist/ui/components/ui-icon-picker/UIIconPicker.d.ts +6 -0
- package/dist/ui/components/ui-icon-picker/UIIconPicker.fallback.d.ts +6 -0
- package/dist/ui/components/ui-image/UIImages.d.ts +1 -0
- package/dist/ui/components/ui-include/UIInclude.d.ts +1 -0
- package/dist/ui/components/ui-input/UIInput.fallback.d.ts +9 -2
- package/dist/ui/components/ui-items/UIItems.d.ts +1 -0
- package/dist/ui/components/ui-keys/UIKeys.d.ts +1 -0
- package/dist/ui/components/ui-label/UILabel.d.ts +2 -0
- package/dist/ui/components/ui-label/UILabels.d.ts +1 -0
- package/dist/ui/components/ui-list/UIList.d.ts +2 -0
- package/dist/ui/components/ui-loader/UILoader.d.ts +1 -0
- package/dist/ui/components/ui-message/UIMessage.d.ts +2 -0
- package/dist/ui/components/ui-modal/UIModal.d.ts +1 -0
- package/dist/ui/components/ui-nag/UINag.d.ts +1 -0
- package/dist/ui/components/ui-page/UIPage.d.ts +15 -0
- package/dist/ui/components/ui-page/UIPage.es.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIActions.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIAuthor.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIAvatar.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIContent.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIDate.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIDescription.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIDetail.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIExtra.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIHeader.d.ts +3 -1
- package/dist/ui/components/ui-parts/UIMeta.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIParts.types.d.ts +15 -1
- package/dist/ui/components/ui-parts/UISummary.d.ts +1 -0
- package/dist/ui/components/ui-parts/UITitle.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIValue.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholder.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderHeader.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderImage.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderLine.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderParagraph.d.ts +1 -0
- package/dist/ui/components/ui-progress/UIProgress.d.ts +2 -0
- package/dist/ui/components/ui-quote/UIQuote.d.ts +1 -0
- package/dist/ui/components/ui-rail/UIRail.d.ts +1 -0
- package/dist/ui/components/ui-rating/UIRating.d.ts +6 -0
- package/dist/ui/components/ui-rating/UIRating.fallback.d.ts +6 -0
- package/dist/ui/components/ui-reveal/UIReveal.d.ts +1 -0
- package/dist/ui/components/ui-search/UISearch.fallback.d.ts +13 -1
- package/dist/ui/components/ui-section/UISections.d.ts +1 -0
- package/dist/ui/components/ui-segment/UISegment.d.ts +2 -0
- package/dist/ui/components/ui-segment/UISegments.d.ts +1 -0
- package/dist/ui/components/ui-select/UISelect.d.ts +6 -0
- package/dist/ui/components/ui-select/UISelect.fallback.d.ts +6 -0
- package/dist/ui/components/ui-shape/UISide.d.ts +4 -0
- package/dist/ui/components/ui-sidebar/UIPushable.d.ts +1 -0
- package/dist/ui/components/ui-sidebar/UIPusher.d.ts +1 -0
- package/dist/ui/components/ui-sidebar/UISidebar.d.ts +1 -0
- package/dist/ui/components/ui-sides/UISides.d.ts +6 -0
- package/dist/ui/components/ui-sides/UISides.fallback.d.ts +6 -0
- package/dist/ui/components/ui-slider/UISlider.d.ts +7 -0
- package/dist/ui/components/ui-slider/UISlider.fallback.d.ts +7 -0
- package/dist/ui/components/ui-space/UISpace.d.ts +1 -0
- package/dist/ui/components/ui-statistic/UIStatistic.d.ts +1 -0
- package/dist/ui/components/ui-statistic/UIStatistics.d.ts +1 -0
- package/dist/ui/components/ui-step/UIStep.d.ts +1 -0
- package/dist/ui/components/ui-step/UISteps.d.ts +1 -0
- package/dist/ui/components/ui-table/UICell.d.ts +1 -0
- package/dist/ui/components/ui-terms/UITerm.d.ts +1 -0
- package/dist/ui/components/ui-terms/UITerms.d.ts +1 -0
- package/dist/ui/components/ui-theme-editor/UIColorChip.d.ts +1 -0
- package/dist/ui/components/ui-theme-editor/UIThemeToken.d.ts +1 -0
- package/dist/ui/components/ui-toast/UIToast.d.ts +1 -0
- package/dist/ui/components/ui-toc/UIToc.d.ts +1 -0
- package/dist/ui/components/ui-transition/UITransition.d.ts +1 -0
- package/dist/ui/components/ui-video/UIAudio.d.ts +1 -0
- package/dist/ui/components/ui-video/UIVideo.d.ts +1 -0
- package/dist/ui/components/ui-visibility/UIVisibility.d.ts +1 -0
- package/dist/ui/components/ui-zoom/UIZoom.d.ts +1 -0
- package/dist/util/spell/constants.js +1 -1
- package/epic/.claude-plugin/plugin.json +1 -1
- package/epic/.codex-plugin/plugin.json +1 -1
- package/epic/hooks/handoff.mjs +4 -3
- package/epic/hooks/worktree.mjs +22 -3
- package/epic/package.json +41 -2
- package/epic/skills/details/SKILL.md +2 -1
- package/epic/skills/epic/SKILL.md +7 -1
- package/epic/skills/epic/guide.md +4 -0
- package/epic/skills/isolate/SKILL.md +35 -0
- package/epic/src/AGENTS.md +6 -2
- package/epic/templates/durable.html +1 -1
- package/epic/vscode/package.json +1 -1
- package/epic/vscode/spell-epic.vsix +0 -0
- package/package.json +1 -1
- package/parser/package.json +1 -1
- package/ui/package.json +15 -2
|
@@ -1,1518 +1,72 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var De = Object.prototype.hasOwnProperty;
|
|
10
|
-
var h = /* @__PURE__ */ __name((n, e) => Z(n, "name", { value: e, configurable: true }), "h");
|
|
11
|
-
var qe = /* @__PURE__ */ __name((n, e) => {
|
|
12
|
-
for (var t in e) Z(n, t, { get: e[t], enumerable: true });
|
|
13
|
-
}, "qe"), Be = /* @__PURE__ */ __name((n, e, t, s) => {
|
|
14
|
-
if (e && typeof e == "object" || typeof e == "function") for (let r of Me(e)) !De.call(n, r) && r !== t && Z(n, r, { get: /* @__PURE__ */ __name(() => e[r], "get"), enumerable: !(s = Oe(e, r)) || s.enumerable });
|
|
15
|
-
return n;
|
|
16
|
-
}, "Be");
|
|
17
|
-
var Ne = /* @__PURE__ */ __name((n) => Be(Z({}, "__esModule", { value: true }), n), "Ne");
|
|
18
|
-
var Xt = {};
|
|
19
|
-
qe(Xt, { MarkdownEngine: /* @__PURE__ */ __name(() => ae, "MarkdownEngine") });
|
|
20
|
-
function ee() {
|
|
21
|
-
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
22
|
-
}
|
|
23
|
-
__name(ee, "ee");
|
|
24
|
-
h(ee, "I");
|
|
25
|
-
var v = ee();
|
|
26
|
-
function we(n) {
|
|
27
|
-
v = n;
|
|
28
|
-
}
|
|
29
|
-
__name(we, "we");
|
|
30
|
-
h(we, "W");
|
|
31
|
-
var E = { exec: h(() => null, "exec") };
|
|
32
|
-
function z(n) {
|
|
33
|
-
let e = [];
|
|
34
|
-
return (t) => {
|
|
35
|
-
let s = Math.max(0, Math.min(3, t - 1)), r = e[s];
|
|
36
|
-
return r || (r = n(s), e[s] = r), r;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
__name(z, "z");
|
|
40
|
-
h(z, "C");
|
|
41
|
-
function g(n, e = "") {
|
|
42
|
-
let t = typeof n == "string" ? n : n.source, s = { replace: h((r, i) => {
|
|
43
|
-
let l = typeof i == "string" ? i : i.source;
|
|
44
|
-
return l = l.replace(x.caret, "$1"), t = t.replace(r, l), s;
|
|
45
|
-
}, "replace"), getRegex: h(() => new RegExp(t, e), "getRegex") };
|
|
46
|
-
return s;
|
|
47
|
-
}
|
|
48
|
-
__name(g, "g");
|
|
49
|
-
h(g, "h");
|
|
50
|
-
var He = ((n = "") => {
|
|
51
|
-
try {
|
|
52
|
-
return !!new RegExp("(?<=1)(?<!1)" + n);
|
|
53
|
-
} catch {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
})(), x = { codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, endingSpaceTabChar: /[ \t]$/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, leadingSpaceTab: /^[ \t]+/, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, numericCharacterReference: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: h((n) => new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: z((n) => new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: z((n) => new RegExp(`^ {0,${n}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)), fencesBeginRegex: z((n) => new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)), headingBeginRegex: z((n) => new RegExp(`^ {0,${n}}#`)), htmlBeginRegex: z((n) => new RegExp(`^ {0,${n}}(?:</?(?:${N})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")), blockquoteBeginRegex: z((n) => new RegExp(`^ {0,${n}}>`)) }, Ve = /^(?:[ \t]*(?:\n|$))+/, Ze = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Ke = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, B = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Fe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, te = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ye = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Se = g(ye).replace(/bull/g, te).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Ue = g(ye).replace(/bull/g, te).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), ne = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, je = /^[^\n]+/, re = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Qe = g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", re).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ge = g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, te).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", se = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, We = g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", se).replace("tag", N).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Re = h((n) => g(ne).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", n).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex(), "de"), Xe = Re(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), Ye = Re(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), Je = g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Ye).getRegex(), ie = { blockquote: Je, code: Ze, def: Qe, fences: Ke, heading: Fe, hr: B, html: We, lheading: Se, list: Ge, newline: Ve, paragraph: Xe, table: E, text: je }, pe = g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex(), et = { ...ie, lheading: Ue, table: pe, paragraph: g(ne).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", pe).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex() }, tt = { ...ie, html: g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", se).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: E, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: g(ne).replace("hr", B).replace("heading", ` *#{1,6} *[^
|
|
57
|
-
]`).replace("lheading", Se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, nt = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, rt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Te = /^( {2,}|\\)\n(?!\s*$)[ \t]*/, st = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, T = /[\p{P}\p{S}]/u, L = /[\s\p{P}\p{S}]/u, H = /[^\s\p{P}\p{S}]/u, it = g(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, L).getRegex(), ot = /[\p{Pi}\p{Ps}"']/u, $e = /(?!~)[\p{P}\p{S}]/u, lt = /(?!~)[\s\p{P}\p{S}]/u, at = /(?:[^\s\p{P}\p{S}]|~)/u, ct = g(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", He ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Ae = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, pt = g(Ae, "u").replace(/punct/g, T).getRegex(), ut = g(Ae, "u").replace(/punct/g, $e).getRegex(), ht = /^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, gt = g(ht, "u").replace(/openQuote/g, ot).replace(/punct/g, T).getRegex(), Ee = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", dt = g(Ee, "gu").replace(/notPunctSpace/g, H).replace(/punctSpace/g, L).replace(/punct/g, T).getRegex(), ft = g(Ee, "gu").replace(/notPunctSpace/g, at).replace(/punctSpace/g, lt).replace(/punct/g, $e).getRegex(), kt = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", bt = g(kt, "gu").replace(/notPunctSpace/g, H).replace(/punctSpace/g, L).replace(/punct/g, T).getRegex(), mt = g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, H).replace(/punctSpace/g, L).replace(/punct/g, T).getRegex(), xt = "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", wt = g(xt, "gu").replace(/notPunctSpace/g, H).replace(/punctSpace/g, L).replace(/punct/g, T).getRegex(), yt = g(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, T).getRegex(), St = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Rt = g(St, "gu").replace(/notPunctSpace/g, H).replace(/punctSpace/g, L).replace(/punct/g, T).getRegex(), Tt = g(/\\(punct)/, "gu").replace(/punct/g, T).getRegex(), $t = g(/^<(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(), At = g(se).replace("(?:-->|$)", "-->").getRegex(), Et = g("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", At).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Pe = /\[(?:\\[\s\S]|[^\[\]\\])*\]/, F = g(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Pe).getRegex(), Pt = g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", F).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), vt = g(/^!?\[(label)\]\[(ref)\]/).replace("label", F).replace("ref", re).getRegex(), Ct = g(/^!?\[(ref)\](?:\[\])?/).replace("ref", re).getRegex(), ue = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/, zt = g(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Pe).getRegex(), Lt = g("reflink|nolink(?!\\()", "g").replace("reflink", g(/^!?\[(label)\]\[(ref)\]/).replace("label", zt).replace("ref", ue).getRegex()).replace("nolink", g(/^!?\[(ref)\](?:\[\])?/).replace("ref", ue).getRegex()).getRegex(), he = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, It = /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/, _t = g(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, It).getRegex(), oe = { _backpedal: E, anyPunctuation: Tt, autolink: $t, blockSkip: ct, br: Te, code: rt, del: E, delLDelim: E, delRDelim: E, emStrongLDelim: pt, emStrongRDelimAst: dt, emStrongRDelimUnd: mt, escape: nt, link: Pt, nolink: Ct, punctuation: it, reflink: vt, reflinkSearch: Lt, tag: Et, text: st, url: E }, Ot = { ...oe, emStrongLDelim: gt, emStrongRDelimAst: bt, emStrongRDelimUnd: wt, link: g(/^!?\[(label)\]\((.*?)\)/).replace("label", F).getRegex(), reflink: g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", F).getRegex() }, X = { ...oe, emStrongRDelimAst: ft, emStrongLDelim: ut, delLDelim: yt, delRDelim: Rt, url: g(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", _t).replace("protocol", he).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: g(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", he).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex() }, Mt = { ...X, br: g(Te).replace("{2,}", "*").getRegex(), text: g(X.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, K = { normal: ie, gfm: et, pedantic: tt }, D = { normal: oe, gfm: X, breaks: Mt, pedantic: Ot }, Dt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, ge = h((n) => Dt[n], "be");
|
|
58
|
-
function y(n, e) {
|
|
59
|
-
if (e) {
|
|
60
|
-
if (x.escapeTest.test(n)) return n.replace(x.escapeReplace, ge);
|
|
61
|
-
} else if (x.escapeTestNoEncode.test(n)) return n.replace(x.escapeReplaceNoEncode, ge);
|
|
62
|
-
return n;
|
|
63
|
-
}
|
|
64
|
-
__name(y, "y");
|
|
65
|
-
h(y, "O");
|
|
66
|
-
function qt(n) {
|
|
67
|
-
return n.replace(x.numericCharacterReference, (e, t, s) => {
|
|
68
|
-
let r = t === void 0 ? Number.parseInt(s, 16) : Number.parseInt(t, 10);
|
|
69
|
-
return r === 0 || r > 1114111 || r >= 55296 && r <= 57343 ? "�" : String.fromCodePoint(r);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
__name(qt, "qt");
|
|
73
|
-
h(qt, "Re");
|
|
74
|
-
function de(n) {
|
|
75
|
-
try {
|
|
76
|
-
n = encodeURI(n).replace(x.percentDecode, "%");
|
|
77
|
-
} catch {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
return n;
|
|
81
|
-
}
|
|
82
|
-
__name(de, "de");
|
|
83
|
-
h(de, "re");
|
|
84
|
-
function fe(n, e) {
|
|
85
|
-
let t = n.replace(x.findPipe, (i, l, o) => {
|
|
86
|
-
let c = false, a = l;
|
|
87
|
-
for (; --a >= 0 && o[a] === "\\"; ) c = !c;
|
|
88
|
-
return c ? "|" : " |";
|
|
89
|
-
}), s = t.split(x.splitPipe), r = 0;
|
|
90
|
-
if (s[0].trim() || s.shift(), s.length > 0 && !s.at(-1)?.trim() && s.pop(), e) if (s.length > e) s.splice(e);
|
|
91
|
-
else for (; s.length < e; ) s.push("");
|
|
92
|
-
for (; r < s.length; r++) s[r] = s[r].trim().replace(x.slashPipe, "|");
|
|
93
|
-
return s;
|
|
94
|
-
}
|
|
95
|
-
__name(fe, "fe");
|
|
96
|
-
h(fe, "se");
|
|
97
|
-
function $(n, e, t) {
|
|
98
|
-
let s = n.length;
|
|
99
|
-
if (s === 0) return "";
|
|
100
|
-
let r = 0;
|
|
101
|
-
for (; r < s; ) {
|
|
102
|
-
let i = n.charAt(s - r - 1);
|
|
103
|
-
if (i === e && !t) r++;
|
|
104
|
-
else if (i !== e && t) r++;
|
|
105
|
-
else break;
|
|
106
|
-
}
|
|
107
|
-
return n.slice(0, s - r);
|
|
108
|
-
}
|
|
109
|
-
__name($, "$");
|
|
110
|
-
h($, "L");
|
|
111
|
-
function ke(n) {
|
|
112
|
-
let e = n.split(`
|
|
113
|
-
`), t = e.length - 1;
|
|
114
|
-
for (; t >= 0 && x.blankLine.test(e[t]); ) t--;
|
|
115
|
-
return e.length - t <= 2 ? n : e.slice(0, t + 1).join(`
|
|
116
|
-
`);
|
|
117
|
-
}
|
|
118
|
-
__name(ke, "ke");
|
|
119
|
-
h(ke, "ie");
|
|
120
|
-
function U(n) {
|
|
121
|
-
return n.trim().toLowerCase().toUpperCase().toLowerCase();
|
|
122
|
-
}
|
|
123
|
-
__name(U, "U");
|
|
124
|
-
h(U, "q");
|
|
125
|
-
function Bt(n, e) {
|
|
126
|
-
if (n.indexOf(e[1]) === -1) return -1;
|
|
127
|
-
let t = 0;
|
|
128
|
-
for (let s = 0; s < n.length; s++) if (n[s] === "\\") s++;
|
|
129
|
-
else if (n[s] === e[0]) t++;
|
|
130
|
-
else if (n[s] === e[1] && (t--, t < 0)) return s;
|
|
131
|
-
return t > 0 ? -2 : -1;
|
|
132
|
-
}
|
|
133
|
-
__name(Bt, "Bt");
|
|
134
|
-
h(Bt, "Te");
|
|
135
|
-
function be(n, e = 0) {
|
|
136
|
-
let t = e, s = "";
|
|
137
|
-
for (let r of n) if (r === " ") {
|
|
138
|
-
let i = 4 - t % 4;
|
|
139
|
-
s += " ".repeat(i), t += i;
|
|
140
|
-
} else s += r, t++;
|
|
141
|
-
return s;
|
|
142
|
-
}
|
|
143
|
-
__name(be, "be");
|
|
144
|
-
h(be, "oe");
|
|
145
|
-
function me(n, e, t, s, r) {
|
|
146
|
-
let i = e.href, l = e.title || null, o = n[1].replace(r.other.outputLinkReplace, "$1"), c = n[0].charAt(0) === "!";
|
|
147
|
-
s.state.inLink = true;
|
|
148
|
-
let a = s.state.linkEmitted, p = s.state.inRawBlock;
|
|
149
|
-
s.state.linkEmitted = false;
|
|
150
|
-
let u = s.inlineTokens(o), m = s.state.linkEmitted;
|
|
151
|
-
if (s.state.linkEmitted = a, s.state.inLink = false, !c) {
|
|
152
|
-
if (m) {
|
|
153
|
-
s.state.inRawBlock = p;
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
s.state.linkEmitted = true;
|
|
157
|
-
}
|
|
158
|
-
return { type: c ? "image" : "link", raw: t, href: i, title: l, text: o, tokens: u };
|
|
159
|
-
}
|
|
160
|
-
__name(me, "me");
|
|
161
|
-
h(me, "Oe");
|
|
162
|
-
function Nt(n, e, t) {
|
|
163
|
-
let s = n.match(t.other.indentCodeCompensation);
|
|
164
|
-
if (s === null) return e;
|
|
165
|
-
let r = s[1];
|
|
166
|
-
return e.split(`
|
|
167
|
-
`).map((i) => {
|
|
168
|
-
let l = i.match(t.other.beginningSpace);
|
|
169
|
-
if (l === null) return i;
|
|
170
|
-
let [o] = l;
|
|
171
|
-
return i.slice(Math.min(o.length, r.length));
|
|
172
|
-
}).join(`
|
|
173
|
-
`);
|
|
174
|
-
}
|
|
175
|
-
__name(Nt, "Nt");
|
|
176
|
-
h(Nt, "yt");
|
|
177
|
-
function xe(n, e, t, s) {
|
|
178
|
-
if (!e.includes("<")) return false;
|
|
179
|
-
for (let r = 0; r < e.length; r++) {
|
|
180
|
-
if (e[r] === "\\") {
|
|
181
|
-
r++;
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
if (e[r] === "`") {
|
|
185
|
-
let o = s.inline.code.exec(e.slice(r));
|
|
186
|
-
if (o) {
|
|
187
|
-
r += o[0].length - 1;
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
if (e[r] !== "<") continue;
|
|
192
|
-
let i = n.slice(t + r), l = s.inline.tag.exec(i) || s.inline.autolink.exec(i);
|
|
193
|
-
if (l) {
|
|
194
|
-
if (l[0].length > e.length - r) return true;
|
|
195
|
-
r += l[0].length - 1;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return false;
|
|
199
|
-
}
|
|
200
|
-
__name(xe, "xe");
|
|
201
|
-
h(xe, "we");
|
|
202
|
-
var j = class {
|
|
203
|
-
static {
|
|
204
|
-
__name(this, "j");
|
|
205
|
-
}
|
|
206
|
-
static {
|
|
207
|
-
h(this, "P");
|
|
208
|
-
}
|
|
209
|
-
options;
|
|
210
|
-
rules;
|
|
211
|
-
lexer;
|
|
212
|
-
constructor(n) {
|
|
213
|
-
this.options = n || v;
|
|
214
|
-
}
|
|
215
|
-
space(n) {
|
|
216
|
-
let e = this.rules.block.newline.exec(n);
|
|
217
|
-
if (e && e[0].length > 0) return { type: "space", raw: e[0] };
|
|
218
|
-
}
|
|
219
|
-
code(n) {
|
|
220
|
-
let e = this.rules.block.code.exec(n);
|
|
221
|
-
if (e) {
|
|
222
|
-
let t = this.options.pedantic ? e[0] : ke(e[0]), s = t.replace(this.rules.other.codeRemoveIndent, "");
|
|
223
|
-
return { type: "code", raw: t, codeBlockStyle: "indented", text: s };
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
fences(n) {
|
|
227
|
-
let e = this.rules.block.fences.exec(n);
|
|
228
|
-
if (e) {
|
|
229
|
-
let t = e[0], s = Nt(t, e[3] || "", this.rules);
|
|
230
|
-
return { type: "code", raw: t, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
heading(n) {
|
|
234
|
-
let e = this.rules.block.heading.exec(n);
|
|
235
|
-
if (e) {
|
|
236
|
-
let t = e[2].trim();
|
|
237
|
-
if (this.rules.other.endingHash.test(t)) {
|
|
238
|
-
let s = $(t, "#");
|
|
239
|
-
(this.options.pedantic || !s || this.rules.other.endingSpaceTabChar.test(s)) && (t = s.trim());
|
|
240
|
-
}
|
|
241
|
-
return { type: "heading", raw: $(e[0], `
|
|
242
|
-
`), depth: e[1].length, text: t, tokens: this.lexer.inline(t) };
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
hr(n) {
|
|
246
|
-
let e = this.rules.block.hr.exec(n);
|
|
247
|
-
if (e) return { type: "hr", raw: $(e[0], `
|
|
248
|
-
`) };
|
|
249
|
-
}
|
|
250
|
-
blockquote(n) {
|
|
251
|
-
let e = this.rules.block.blockquote.exec(n);
|
|
252
|
-
if (e) {
|
|
253
|
-
let t = $(e[0], `
|
|
1
|
+
"use strict";var __spellMarkdownEngine=(()=>{var Z=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Me=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var h=(n,e)=>Z(n,"name",{value:e,configurable:!0});var qe=(n,e)=>{for(var t in e)Z(n,t,{get:e[t],enumerable:!0})},Be=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Me(e))!De.call(n,r)&&r!==t&&Z(n,r,{get:()=>e[r],enumerable:!(s=Oe(e,r))||s.enumerable});return n};var Ne=n=>Be(Z({},"__esModule",{value:!0}),n);var Xt={};qe(Xt,{MarkdownEngine:()=>ae});function ee(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}h(ee,"I");var v=ee();function we(n){v=n}h(we,"W");var E={exec:h(()=>null,"exec")};function z(n){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),r=e[s];return r||(r=n(s),e[s]=r),r}}h(z,"C");function g(n,e=""){let t=typeof n=="string"?n:n.source,s={replace:h((r,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(x.caret,"$1"),t=t.replace(r,l),s},"replace"),getRegex:h(()=>new RegExp(t,e),"getRegex")};return s}h(g,"h");var He=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return!1}})(),x={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:h(n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),"listItemRegex"),nextBulletRegex:z(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:z(n=>new RegExp(`^ {0,${n}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:z(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:z(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:z(n=>new RegExp(`^ {0,${n}}(?:</?(?:${N})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,"i")),blockquoteBeginRegex:z(n=>new RegExp(`^ {0,${n}}>`))},Ve=/^(?:[ \t]*(?:\n|$))+/,Ze=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ke=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,B=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Fe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,te=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ye=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Se=g(ye).replace(/bull/g,te).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ue=g(ye).replace(/bull/g,te).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ne=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,je=/^[^\n]+/,re=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Qe=g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",re).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ge=g(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,te).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",se=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,We=g("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",se).replace("tag",N).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Re=h(n=>g(ne).replace("hr",B).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N).getRegex(),"de"),Xe=Re(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ye=Re(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Je=g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ye).getRegex(),ie={blockquote:Je,code:Ze,def:Qe,fences:Ke,heading:Fe,hr:B,html:We,lheading:Se,list:Ge,newline:Ve,paragraph:Xe,table:E,text:je},pe=g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",B).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N).getRegex(),et={...ie,lheading:Ue,table:pe,paragraph:g(ne).replace("hr",B).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",pe).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N).getRegex()},tt={...ie,html:g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",se).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:E,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:g(ne).replace("hr",B).replace("heading",` *#{1,6} *[^
|
|
2
|
+
]`).replace("lheading",Se).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},nt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,rt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Te=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,st=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,L=/[\s\p{P}\p{S}]/u,H=/[^\s\p{P}\p{S}]/u,it=g(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,L).getRegex(),ot=/[\p{Pi}\p{Ps}"']/u,$e=/(?!~)[\p{P}\p{S}]/u,lt=/(?!~)[\s\p{P}\p{S}]/u,at=/(?:[^\s\p{P}\p{S}]|~)/u,ct=g(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",He?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ae=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,pt=g(Ae,"u").replace(/punct/g,T).getRegex(),ut=g(Ae,"u").replace(/punct/g,$e).getRegex(),ht=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,gt=g(ht,"u").replace(/openQuote/g,ot).replace(/punct/g,T).getRegex(),Ee="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",dt=g(Ee,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,L).replace(/punct/g,T).getRegex(),ft=g(Ee,"gu").replace(/notPunctSpace/g,at).replace(/punctSpace/g,lt).replace(/punct/g,$e).getRegex(),kt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",bt=g(kt,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,L).replace(/punct/g,T).getRegex(),mt=g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,L).replace(/punct/g,T).getRegex(),xt="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",wt=g(xt,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,L).replace(/punct/g,T).getRegex(),yt=g(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),St="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Rt=g(St,"gu").replace(/notPunctSpace/g,H).replace(/punctSpace/g,L).replace(/punct/g,T).getRegex(),Tt=g(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),$t=g(/^<(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(),At=g(se).replace("(?:-->|$)","-->").getRegex(),Et=g("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",At).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pe=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,F=g(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Pe).getRegex(),Pt=g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",F).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),vt=g(/^!?\[(label)\]\[(ref)\]/).replace("label",F).replace("ref",re).getRegex(),Ct=g(/^!?\[(ref)\](?:\[\])?/).replace("ref",re).getRegex(),ue=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,zt=g(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Pe).getRegex(),Lt=g("reflink|nolink(?!\\()","g").replace("reflink",g(/^!?\[(label)\]\[(ref)\]/).replace("label",zt).replace("ref",ue).getRegex()).replace("nolink",g(/^!?\[(ref)\](?:\[\])?/).replace("ref",ue).getRegex()).getRegex(),he=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,It=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,_t=g(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,It).getRegex(),oe={_backpedal:E,anyPunctuation:Tt,autolink:$t,blockSkip:ct,br:Te,code:rt,del:E,delLDelim:E,delRDelim:E,emStrongLDelim:pt,emStrongRDelimAst:dt,emStrongRDelimUnd:mt,escape:nt,link:Pt,nolink:Ct,punctuation:it,reflink:vt,reflinkSearch:Lt,tag:Et,text:st,url:E},Ot={...oe,emStrongLDelim:gt,emStrongRDelimAst:bt,emStrongRDelimUnd:wt,link:g(/^!?\[(label)\]\((.*?)\)/).replace("label",F).getRegex(),reflink:g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",F).getRegex()},X={...oe,emStrongRDelimAst:ft,emStrongLDelim:ut,delLDelim:yt,delRDelim:Rt,url:g(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",_t).replace("protocol",he).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:g(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",he).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Mt={...X,br:g(Te).replace("{2,}","*").getRegex(),text:g(X.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},K={normal:ie,gfm:et,pedantic:tt},D={normal:oe,gfm:X,breaks:Mt,pedantic:Ot},Dt={"&":"&","<":"<",">":">",'"':""","'":"'"},ge=h(n=>Dt[n],"be");function y(n,e){if(e){if(x.escapeTest.test(n))return n.replace(x.escapeReplace,ge)}else if(x.escapeTestNoEncode.test(n))return n.replace(x.escapeReplaceNoEncode,ge);return n}h(y,"O");function qt(n){return n.replace(x.numericCharacterReference,(e,t,s)=>{let r=t===void 0?Number.parseInt(s,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?"\uFFFD":String.fromCodePoint(r)})}h(qt,"Re");function de(n){try{n=encodeURI(n).replace(x.percentDecode,"%")}catch{return null}return n}h(de,"re");function fe(n,e){let t=n.replace(x.findPipe,(i,l,o)=>{let c=!1,a=l;for(;--a>=0&&o[a]==="\\";)c=!c;return c?"|":" |"}),s=t.split(x.splitPipe),r=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;r<s.length;r++)s[r]=s[r].trim().replace(x.slashPipe,"|");return s}h(fe,"se");function $(n,e,t){let s=n.length;if(s===0)return"";let r=0;for(;r<s;){let i=n.charAt(s-r-1);if(i===e&&!t)r++;else if(i!==e&&t)r++;else break}return n.slice(0,s-r)}h($,"L");function ke(n){let e=n.split(`
|
|
3
|
+
`),t=e.length-1;for(;t>=0&&x.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
|
|
4
|
+
`)}h(ke,"ie");function U(n){return n.trim().toLowerCase().toUpperCase().toLowerCase()}h(U,"q");function Bt(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])t++;else if(n[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}h(Bt,"Te");function be(n,e=0){let t=e,s="";for(let r of n)if(r===" "){let i=4-t%4;s+=" ".repeat(i),t+=i}else s+=r,t++;return s}h(be,"oe");function me(n,e,t,s,r){let i=e.href,l=e.title||null,o=n[1].replace(r.other.outputLinkReplace,"$1"),c=n[0].charAt(0)==="!";s.state.inLink=!0;let a=s.state.linkEmitted,p=s.state.inRawBlock;s.state.linkEmitted=!1;let u=s.inlineTokens(o),m=s.state.linkEmitted;if(s.state.linkEmitted=a,s.state.inLink=!1,!c){if(m){s.state.inRawBlock=p;return}s.state.linkEmitted=!0}return{type:c?"image":"link",raw:t,href:i,title:l,text:o,tokens:u}}h(me,"Oe");function Nt(n,e,t){let s=n.match(t.other.indentCodeCompensation);if(s===null)return e;let r=s[1];return e.split(`
|
|
5
|
+
`).map(i=>{let l=i.match(t.other.beginningSpace);if(l===null)return i;let[o]=l;return i.slice(Math.min(o.length,r.length))}).join(`
|
|
6
|
+
`)}h(Nt,"yt");function xe(n,e,t,s){if(!e.includes("<"))return!1;for(let r=0;r<e.length;r++){if(e[r]==="\\"){r++;continue}if(e[r]==="`"){let o=s.inline.code.exec(e.slice(r));if(o){r+=o[0].length-1;continue}}if(e[r]!=="<")continue;let i=n.slice(t+r),l=s.inline.tag.exec(i)||s.inline.autolink.exec(i);if(l){if(l[0].length>e.length-r)return!0;r+=l[0].length-1}}return!1}h(xe,"we");var j=class{static{h(this,"P")}options;rules;lexer;constructor(n){this.options=n||v}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:ke(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],s=Nt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=$(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceTabChar.test(s))&&(t=s.trim())}return{type:"heading",raw:$(e[0],`
|
|
7
|
+
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:$(e[0],`
|
|
8
|
+
`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=$(e[0],`
|
|
254
9
|
`).split(`
|
|
255
|
-
`),
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
`), p = a.replace(this.rules.other.blockquoteSetextReplace, `
|
|
264
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
265
|
-
s = s ? `${s}
|
|
266
|
-
${a}` : a, r = r ? `${r}
|
|
267
|
-
${p}` : p;
|
|
268
|
-
let u = this.lexer.state.top;
|
|
269
|
-
if (this.lexer.state.top = true, this.lexer.blockTokens(p, i, true), this.lexer.state.top = u, t.length === 0) break;
|
|
270
|
-
let m = i.at(-1);
|
|
271
|
-
if (m?.type === "code") break;
|
|
272
|
-
if (m?.type === "blockquote") {
|
|
273
|
-
let f = m, k = t.join(`
|
|
274
|
-
`), w = f.raw + `
|
|
275
|
-
` + k.replace(this.rules.other.blockquoteSetextReplace2, ""), d = this.blockquote(w);
|
|
276
|
-
i[i.length - 1] = d;
|
|
277
|
-
let C = w.substring(d.raw.length).replace(/^\n/, ""), _ = C ? C.split(`
|
|
278
|
-
`).length : 0, O = _ ? t.slice(0, -_) : t;
|
|
279
|
-
O.length > 0 && (s = `${s}
|
|
10
|
+
`),s="",r="",i=[];for(;t.length>0;){let l=!1,o=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))o.push(t[c]),l=!0;else if(!l)o.push(t[c]);else break;t=t.slice(c);let a=o.join(`
|
|
11
|
+
`),p=a.replace(this.rules.other.blockquoteSetextReplace,`
|
|
12
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
13
|
+
${a}`:a,r=r?`${r}
|
|
14
|
+
${p}`:p;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,i,!0),this.lexer.state.top=u,t.length===0)break;let m=i.at(-1);if(m?.type==="code")break;if(m?.type==="blockquote"){let f=m,k=t.join(`
|
|
15
|
+
`),w=f.raw+`
|
|
16
|
+
`+k.replace(this.rules.other.blockquoteSetextReplace2,""),d=this.blockquote(w);i[i.length-1]=d;let C=w.substring(d.raw.length).replace(/^\n/,""),_=C?C.split(`
|
|
17
|
+
`).length:0,O=_?t.slice(0,-_):t;O.length>0&&(s=`${s}
|
|
280
18
|
${O.join(`
|
|
281
|
-
`)}`),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (k = W, this.options.pedantic ? (k = k.replace(this.rules.other.listReplaceNesting, " "), M = k) : M = k.replace(this.rules.other.leadingSpaceTab, (_e) => _e.replace(this.rules.other.tabCharGlobal, " ")), O.test(k) || ce.test(k) || Le.test(k) || Ie.test(k) || C.test(k) || _.test(k)) break;
|
|
315
|
-
if (M.search(this.rules.other.nonSpaceChar) >= d || !k.trim()) p += `
|
|
316
|
-
` + M.slice(d);
|
|
317
|
-
else {
|
|
318
|
-
if (w || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || O.test(f) || ce.test(f) || _.test(f)) break;
|
|
319
|
-
p += `
|
|
320
|
-
` + k;
|
|
321
|
-
}
|
|
322
|
-
w = !k.trim(), a += W + `
|
|
323
|
-
`, n = n.substring(W.length + 1), f = M.slice(d);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
r.loose || (l ? r.loose = true : this.rules.other.doubleBlankLine.test(a) && (l = true)), r.items.push({ type: "list_item", raw: a, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: false, text: p, tokens: [] }), r.raw += a;
|
|
327
|
-
}
|
|
328
|
-
let o = r.items.at(-1);
|
|
329
|
-
if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
|
|
330
|
-
else return;
|
|
331
|
-
r.raw = r.raw.trimEnd();
|
|
332
|
-
for (let c of r.items) if (this.lexer.state.top = false, c.tokens = this.lexer.blockTokens(c.text, []), !r.loose) {
|
|
333
|
-
let a = c.tokens.filter((u) => u.type === "space"), p = a.length > 0 && a.some((u) => this.rules.other.anyLine.test(u.raw));
|
|
334
|
-
r.loose = p;
|
|
335
|
-
}
|
|
336
|
-
for (let c of r.items) {
|
|
337
|
-
let a = c.tokens[0];
|
|
338
|
-
if (c.task && (a?.type === "text" || a?.type === "paragraph")) {
|
|
339
|
-
c.text = c.text.replace(this.rules.other.listReplaceTask, ""), a.raw = a.raw.replace(this.rules.other.listReplaceTask, ""), a.text = a.text.replace(this.rules.other.listReplaceTask, "");
|
|
340
|
-
for (let u = this.lexer.inlineQueue.length - 1; u >= 0; u--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)) {
|
|
341
|
-
this.lexer.inlineQueue[u].src = this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask, "");
|
|
342
|
-
break;
|
|
343
|
-
}
|
|
344
|
-
let p = this.rules.other.listTaskCheckbox.exec(c.raw);
|
|
345
|
-
if (p) {
|
|
346
|
-
let u = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
|
|
347
|
-
c.checked = u.checked, r.loose ? c.tokens[0] && ["paragraph", "text"].includes(c.tokens[0].type) && "tokens" in c.tokens[0] && c.tokens[0].tokens ? (c.tokens[0].raw = u.raw + c.tokens[0].raw, c.tokens[0].text = u.raw + c.tokens[0].text, c.tokens[0].tokens.unshift(u)) : c.tokens.unshift({ type: "paragraph", raw: u.raw, text: u.raw, tokens: [u] }) : c.tokens.unshift(u);
|
|
348
|
-
}
|
|
349
|
-
} else c.task && (c.task = false);
|
|
350
|
-
}
|
|
351
|
-
if (r.loose) for (let c of r.items) {
|
|
352
|
-
c.loose = true;
|
|
353
|
-
for (let a of c.tokens) a.type === "text" && (a.type = "paragraph");
|
|
354
|
-
}
|
|
355
|
-
return r;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
html(n) {
|
|
359
|
-
let e = this.rules.block.html.exec(n);
|
|
360
|
-
if (e) {
|
|
361
|
-
let t = ke(e[0]);
|
|
362
|
-
return { type: "html", block: true, raw: t, pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: t };
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
def(n) {
|
|
366
|
-
let e = this.rules.block.def.exec(n);
|
|
367
|
-
if (e) {
|
|
368
|
-
let t = U(e[1]).replace(this.rules.other.multipleSpaceGlobal, " "), s = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
|
|
369
|
-
return { type: "def", tag: t, raw: $(e[0], `
|
|
370
|
-
`), href: s, title: r };
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
table(n) {
|
|
374
|
-
let e = this.rules.block.table.exec(n);
|
|
375
|
-
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
376
|
-
let t = fe(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
377
|
-
`) : [], i = { type: "table", raw: $(e[0], `
|
|
378
|
-
`), header: [], align: [], rows: [] };
|
|
379
|
-
if (t.length === s.length) {
|
|
380
|
-
for (let l of s) this.rules.other.tableAlignRight.test(l) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(l) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(l) ? i.align.push("left") : i.align.push(null);
|
|
381
|
-
for (let l = 0; l < t.length; l++) i.header.push({ text: t[l], tokens: this.lexer.inline(t[l]), header: true, align: i.align[l] });
|
|
382
|
-
for (let l of r) i.rows.push(fe(l, i.header.length).map((o, c) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: i.align[c] })));
|
|
383
|
-
return i;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
lheading(n) {
|
|
387
|
-
let e = this.rules.block.lheading.exec(n);
|
|
388
|
-
if (e) {
|
|
389
|
-
let t = e[1].trim();
|
|
390
|
-
return { type: "heading", raw: $(e[0], `
|
|
391
|
-
`), depth: e[2].charAt(0) === "=" ? 1 : 2, text: t, tokens: this.lexer.inline(t) };
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
paragraph(n) {
|
|
395
|
-
let e = this.rules.block.paragraph.exec(n);
|
|
396
|
-
if (e) {
|
|
397
|
-
let t = e[1].charAt(e[1].length - 1) === `
|
|
398
|
-
` ? e[1].slice(0, -1) : e[1];
|
|
399
|
-
return { type: "paragraph", raw: e[0], text: t, tokens: this.lexer.inline(t) };
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
text(n) {
|
|
403
|
-
let e = this.rules.block.text.exec(n);
|
|
404
|
-
if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
|
|
405
|
-
}
|
|
406
|
-
escape(n) {
|
|
407
|
-
let e = this.rules.inline.escape.exec(n);
|
|
408
|
-
if (e) return { type: "escape", raw: e[0], text: e[1] };
|
|
409
|
-
}
|
|
410
|
-
tag(n) {
|
|
411
|
-
let e = this.rules.inline.tag.exec(n);
|
|
412
|
-
if (e) return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: e[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: e[0] };
|
|
413
|
-
}
|
|
414
|
-
link(n) {
|
|
415
|
-
let e = this.rules.inline.link.exec(n);
|
|
416
|
-
if (e) {
|
|
417
|
-
let t = e[0].charAt(0) === "!" ? 2 : 1;
|
|
418
|
-
if (!this.options.pedantic && xe(n, e[1], t, this.rules)) return;
|
|
419
|
-
let s = e[2].trim();
|
|
420
|
-
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(s)) {
|
|
421
|
-
if (!this.rules.other.endAngleBracket.test(s)) return;
|
|
422
|
-
let l = $(s.slice(0, -1), "\\");
|
|
423
|
-
if ((s.length - l.length) % 2 === 0) return;
|
|
424
|
-
} else {
|
|
425
|
-
let l = Bt(e[2], "()");
|
|
426
|
-
if (l === -2) return;
|
|
427
|
-
if (l > -1) {
|
|
428
|
-
let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + l;
|
|
429
|
-
e[2] = e[2].substring(0, l), e[0] = e[0].substring(0, o).trim(), e[3] = "";
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
let r = e[2], i = "";
|
|
433
|
-
if (this.options.pedantic) {
|
|
434
|
-
let l = this.rules.other.pedanticHrefTitle.exec(r);
|
|
435
|
-
l && (r = l[1], i = l[3]);
|
|
436
|
-
} else i = e[3] ? e[3].slice(1, -1) : "";
|
|
437
|
-
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(s) ? r = r.slice(1) : r = r.slice(1, -1)), me(e, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
reflink(n, e) {
|
|
441
|
-
let t;
|
|
442
|
-
if ((t = this.rules.inline.reflink.exec(n)) || (t = this.rules.inline.nolink.exec(n))) {
|
|
443
|
-
let s = t[0].charAt(0) === "!" ? 2 : 1;
|
|
444
|
-
if (!this.options.pedantic && xe(n, t[1], s, this.rules)) return;
|
|
445
|
-
let r = (t[2] || t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = e[U(r)];
|
|
446
|
-
if (!i) {
|
|
447
|
-
let l = t[0].charAt(0);
|
|
448
|
-
return { type: "text", raw: l, text: l };
|
|
449
|
-
}
|
|
450
|
-
return me(t, i, t[0], this.lexer, this.rules);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
emStrong(n, e, t = "") {
|
|
454
|
-
let s = this.rules.inline.emStrongLDelim.exec(n);
|
|
455
|
-
if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && t.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[3]) || !t || this.rules.inline.punctuation.exec(t))) {
|
|
456
|
-
let r = [...s[0]].length - 1, i, l, o = r, c = 0, a = s[0][0], p = t === a, u = a === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
457
|
-
for (u.lastIndex = 0, e = e.slice(-1 * n.length + r); (s = u.exec(e)) !== null; ) {
|
|
458
|
-
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
|
|
459
|
-
if (l = [...i].length, s[3] || s[4]) {
|
|
460
|
-
o += l;
|
|
461
|
-
continue;
|
|
462
|
-
} else if (s[5] || s[6]) {
|
|
463
|
-
if (r % 3 && !((r + l) % 3)) {
|
|
464
|
-
c += l;
|
|
465
|
-
continue;
|
|
466
|
-
}
|
|
467
|
-
if (p) break;
|
|
468
|
-
}
|
|
469
|
-
if (o -= l, o > 0) continue;
|
|
470
|
-
l = Math.min(l, l + o + c);
|
|
471
|
-
let m = [...s[0]][0].length, f = n.slice(0, r + s.index + m + l);
|
|
472
|
-
if (Math.min(r, l) % 2) {
|
|
473
|
-
let w = f.slice(1, -1);
|
|
474
|
-
return { type: "em", raw: f, text: w, tokens: this.lexer.inlineTokens(w) };
|
|
475
|
-
}
|
|
476
|
-
let k = f.slice(2, -2);
|
|
477
|
-
return { type: "strong", raw: f, text: k, tokens: this.lexer.inlineTokens(k) };
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
codespan(n) {
|
|
482
|
-
let e = this.rules.inline.code.exec(n);
|
|
483
|
-
if (e) {
|
|
484
|
-
let t = e[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(t), r = this.rules.other.startingSpaceChar.test(t) && this.rules.other.endingSpaceChar.test(t);
|
|
485
|
-
return s && r && (t = t.substring(1, t.length - 1)), { type: "codespan", raw: e[0], text: t };
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
br(n) {
|
|
489
|
-
let e = this.rules.inline.br.exec(n);
|
|
490
|
-
if (e) return { type: "br", raw: e[0] };
|
|
491
|
-
}
|
|
492
|
-
del(n, e, t = "") {
|
|
493
|
-
let s = this.rules.inline.delLDelim.exec(n);
|
|
494
|
-
if (s && (!s[1] || !t || this.rules.inline.punctuation.exec(t))) {
|
|
495
|
-
let r = [...s[0]].length - 1, i, l, o = r, c = this.rules.inline.delRDelim;
|
|
496
|
-
for (c.lastIndex = 0, e = e.slice(-1 * n.length + r); (s = c.exec(e)) !== null; ) {
|
|
497
|
-
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (l = [...i].length, l !== r)) continue;
|
|
498
|
-
if (s[3] || s[4]) {
|
|
499
|
-
o += l;
|
|
500
|
-
continue;
|
|
501
|
-
}
|
|
502
|
-
if (o -= l, o > 0) continue;
|
|
503
|
-
l = Math.min(l, l + o);
|
|
504
|
-
let a = [...s[0]][0].length, p = n.slice(0, r + s.index + a + l), u = p.slice(r, -r);
|
|
505
|
-
return { type: "del", raw: p, text: u, tokens: this.lexer.inlineTokens(u) };
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
autolink(n) {
|
|
510
|
-
let e = this.rules.inline.autolink.exec(n);
|
|
511
|
-
if (e) {
|
|
512
|
-
let t, s;
|
|
513
|
-
return e[2] === "@" ? (t = e[1], s = "mailto:" + t) : (t = e[1], s = t), { type: "link", raw: e[0], text: t, href: s, autolink: true, tokens: [{ type: "text", raw: t, text: t }] };
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
url(n) {
|
|
517
|
-
let e;
|
|
518
|
-
if (e = this.rules.inline.url.exec(n)) {
|
|
519
|
-
let t, s;
|
|
520
|
-
if (e[2] === "@") t = e[0], s = "mailto:" + t;
|
|
521
|
-
else {
|
|
522
|
-
let r;
|
|
523
|
-
do
|
|
524
|
-
r = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
|
|
525
|
-
while (r !== e[0]);
|
|
526
|
-
t = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
|
|
527
|
-
}
|
|
528
|
-
return { type: "link", raw: e[0], text: t, href: s, autolink: true, tokens: [{ type: "text", raw: t, text: t }] };
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
inlineText(n) {
|
|
532
|
-
let e = this.rules.inline.text.exec(n);
|
|
533
|
-
if (e) {
|
|
534
|
-
let t = this.lexer.state.inRawBlock;
|
|
535
|
-
return { type: "text", raw: e[0], text: t ? e[0] : qt(e[0]), escaped: t };
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}, S = class Y {
|
|
539
|
-
static {
|
|
540
|
-
__name(this, "Y");
|
|
541
|
-
}
|
|
542
|
-
static {
|
|
543
|
-
h(this, "l");
|
|
544
|
-
}
|
|
545
|
-
tokens;
|
|
546
|
-
options;
|
|
547
|
-
state;
|
|
548
|
-
inlineQueue;
|
|
549
|
-
tokenizer;
|
|
550
|
-
constructor(e) {
|
|
551
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || v, this.options.tokenizer = this.options.tokenizer || new j(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, linkEmitted: false, top: true };
|
|
552
|
-
let t = { other: x, block: K.normal, inline: D.normal };
|
|
553
|
-
this.options.pedantic ? (t.block = K.pedantic, t.inline = D.pedantic) : this.options.gfm && (t.block = K.gfm, this.options.breaks ? t.inline = D.breaks : t.inline = D.gfm), this.tokenizer.rules = t;
|
|
554
|
-
}
|
|
555
|
-
static get rules() {
|
|
556
|
-
return { block: K, inline: D };
|
|
557
|
-
}
|
|
558
|
-
static lex(e, t) {
|
|
559
|
-
return new Y(t).lex(e);
|
|
560
|
-
}
|
|
561
|
-
static lexInline(e, t) {
|
|
562
|
-
return new Y(t).inlineTokens(e);
|
|
563
|
-
}
|
|
564
|
-
lex(e) {
|
|
565
|
-
e = e.replace(x.carriageReturn, `
|
|
566
|
-
`), this.blockTokens(e, this.tokens);
|
|
567
|
-
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
568
|
-
let s = this.inlineQueue[t];
|
|
569
|
-
this.inlineTokens(s.src, s.tokens);
|
|
570
|
-
}
|
|
571
|
-
return this.inlineQueue = [], this.tokens;
|
|
572
|
-
}
|
|
573
|
-
blockTokens(e, t = [], s = false) {
|
|
574
|
-
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(x.tabCharGlobal, " ").replace(x.spaceLine, ""));
|
|
575
|
-
let r = 1 / 0;
|
|
576
|
-
for (; e; ) {
|
|
577
|
-
if (e.length < r) r = e.length;
|
|
578
|
-
else {
|
|
579
|
-
this.infiniteLoopError(e.charCodeAt(0));
|
|
580
|
-
break;
|
|
581
|
-
}
|
|
582
|
-
let i;
|
|
583
|
-
if (this.options.extensions?.block?.some((o) => (i = o.call({ lexer: this }, e, t)) ? (e = e.substring(i.raw.length), t.push(i), true) : false)) continue;
|
|
584
|
-
if (i = this.tokenizer.space(e)) {
|
|
585
|
-
e = e.substring(i.raw.length);
|
|
586
|
-
let o = t.at(-1);
|
|
587
|
-
i.raw.length === 1 && o !== void 0 ? o.raw += `
|
|
588
|
-
` : t.push(i);
|
|
589
|
-
continue;
|
|
590
|
-
}
|
|
591
|
-
if (i = this.tokenizer.code(e)) {
|
|
592
|
-
e = e.substring(i.raw.length);
|
|
593
|
-
let o = t.at(-1);
|
|
594
|
-
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
595
|
-
`) ? "" : `
|
|
596
|
-
`) + i.raw, o.text += `
|
|
597
|
-
` + i.text, this.inlineQueue.at(-1).src = o.text) : t.push(i);
|
|
598
|
-
continue;
|
|
599
|
-
}
|
|
600
|
-
if (i = this.tokenizer.fences(e)) {
|
|
601
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
602
|
-
continue;
|
|
603
|
-
}
|
|
604
|
-
if (i = this.tokenizer.heading(e)) {
|
|
605
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
606
|
-
continue;
|
|
607
|
-
}
|
|
608
|
-
if (i = this.tokenizer.hr(e)) {
|
|
609
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
610
|
-
continue;
|
|
611
|
-
}
|
|
612
|
-
if (i = this.tokenizer.blockquote(e)) {
|
|
613
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
614
|
-
continue;
|
|
615
|
-
}
|
|
616
|
-
if (i = this.tokenizer.list(e)) {
|
|
617
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
618
|
-
continue;
|
|
619
|
-
}
|
|
620
|
-
if (i = this.tokenizer.html(e)) {
|
|
621
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
622
|
-
continue;
|
|
623
|
-
}
|
|
624
|
-
if (i = this.tokenizer.def(e)) {
|
|
625
|
-
e = e.substring(i.raw.length);
|
|
626
|
-
let o = t.at(-1);
|
|
627
|
-
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
628
|
-
`) ? "" : `
|
|
629
|
-
`) + i.raw, o.text += `
|
|
630
|
-
` + i.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[i.tag] || (this.tokens.links[i.tag] = { href: i.href, title: i.title }, t.push(i));
|
|
631
|
-
continue;
|
|
632
|
-
}
|
|
633
|
-
if (i = this.tokenizer.table(e)) {
|
|
634
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
635
|
-
continue;
|
|
636
|
-
}
|
|
637
|
-
if (i = this.tokenizer.lheading(e)) {
|
|
638
|
-
e = e.substring(i.raw.length), t.push(i);
|
|
639
|
-
continue;
|
|
640
|
-
}
|
|
641
|
-
let l = e;
|
|
642
|
-
if (this.options.extensions?.startBlock) {
|
|
643
|
-
let o = 1 / 0, c = e.slice(1), a;
|
|
644
|
-
this.options.extensions.startBlock.forEach((p) => {
|
|
645
|
-
a = p.call({ lexer: this }, c), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
|
|
646
|
-
}), o < 1 / 0 && o >= 0 && (l = e.substring(0, o + 1));
|
|
647
|
-
}
|
|
648
|
-
if (this.state.top && (i = this.tokenizer.paragraph(l))) {
|
|
649
|
-
let o = t.at(-1);
|
|
650
|
-
s && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`
|
|
651
|
-
`) ? "" : `
|
|
652
|
-
`) + i.raw, o.text += `
|
|
653
|
-
` + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(i), s = l.length !== e.length, e = e.substring(i.raw.length);
|
|
654
|
-
continue;
|
|
655
|
-
}
|
|
656
|
-
if (i = this.tokenizer.text(e)) {
|
|
657
|
-
e = e.substring(i.raw.length);
|
|
658
|
-
let o = t.at(-1);
|
|
659
|
-
o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
660
|
-
`) ? "" : `
|
|
661
|
-
`) + i.raw, o.text += `
|
|
662
|
-
` + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(i);
|
|
663
|
-
continue;
|
|
664
|
-
}
|
|
665
|
-
if (e) {
|
|
666
|
-
this.infiniteLoopError(e.charCodeAt(0));
|
|
667
|
-
break;
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
return this.state.top = true, t;
|
|
671
|
-
}
|
|
672
|
-
inline(e, t = []) {
|
|
673
|
-
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
674
|
-
}
|
|
675
|
-
linkInText(e) {
|
|
676
|
-
if (!e.includes("[")) return false;
|
|
677
|
-
let t = this.tokenizer.rules.inline.link;
|
|
678
|
-
for (let s of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(s[0]) && e.charAt(s.index - 1) !== "!") return true;
|
|
679
|
-
for (let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
|
|
680
|
-
let r = s[0], i = r.lastIndexOf("[");
|
|
681
|
-
if (!(r.charAt(0) === "!" || !Object.hasOwn(this.tokens.links, U(r.slice(i + 1, -1)))) && !(i > 1 && this.linkInText(r.slice(1, i - 1)))) return true;
|
|
682
|
-
}
|
|
683
|
-
return false;
|
|
684
|
-
}
|
|
685
|
-
inlineTokens(e, t = []) {
|
|
686
|
-
this.tokenizer.lexer = this;
|
|
687
|
-
let s = e;
|
|
688
|
-
if (this.tokens.links && e.includes("[")) {
|
|
689
|
-
let o = this.tokenizer.rules.inline.reflinkSearch, c = h((a) => {
|
|
690
|
-
let p = a.lastIndexOf("[");
|
|
691
|
-
if (!Object.hasOwn(this.tokens.links, U(a.slice(p + 1, -1)))) return a;
|
|
692
|
-
if (p > 1 && a.charAt(0) !== "!") {
|
|
693
|
-
let u = a.slice(1, p - 1);
|
|
694
|
-
if (this.linkInText(u)) return "[" + u.replace(o, c) + "][" + "a".repeat(a.length - p - 2) + "]";
|
|
695
|
-
}
|
|
696
|
-
return "[" + "a".repeat(a.length - 2) + "]";
|
|
697
|
-
}, "u");
|
|
698
|
-
s = s.replace(o, c);
|
|
699
|
-
}
|
|
700
|
-
s = s.replace(this.tokenizer.rules.inline.anyPunctuation, (o) => "+".repeat(o.length)), s = s.replace(this.tokenizer.rules.inline.blockSkip, (o, c, a) => {
|
|
701
|
-
let p = a ? a.length : 0;
|
|
702
|
-
return o.slice(0, p) + "[" + "a".repeat(o.length - p - 2) + "]";
|
|
703
|
-
}), s = this.options.hooks?.emStrongMask?.call({ lexer: this }, s) ?? s;
|
|
704
|
-
let r = false, i = "", l = 1 / 0;
|
|
705
|
-
for (; e; ) {
|
|
706
|
-
if (e.length < l) l = e.length;
|
|
707
|
-
else {
|
|
708
|
-
this.infiniteLoopError(e.charCodeAt(0));
|
|
709
|
-
break;
|
|
710
|
-
}
|
|
711
|
-
r || (i = ""), r = false;
|
|
712
|
-
let o;
|
|
713
|
-
if (this.options.extensions?.inline?.some((a) => (o = a.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
|
|
714
|
-
if (o = this.tokenizer.escape(e)) {
|
|
715
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
716
|
-
continue;
|
|
717
|
-
}
|
|
718
|
-
if (o = this.tokenizer.tag(e)) {
|
|
719
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
720
|
-
continue;
|
|
721
|
-
}
|
|
722
|
-
if (o = this.tokenizer.link(e)) {
|
|
723
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
724
|
-
continue;
|
|
725
|
-
}
|
|
726
|
-
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
727
|
-
e = e.substring(o.raw.length);
|
|
728
|
-
let a = t.at(-1);
|
|
729
|
-
o.type === "text" && a?.type === "text" ? (a.raw += o.raw, a.text += o.text) : t.push(o);
|
|
730
|
-
continue;
|
|
731
|
-
}
|
|
732
|
-
if (o = this.tokenizer.emStrong(e, s, i)) {
|
|
733
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
734
|
-
continue;
|
|
735
|
-
}
|
|
736
|
-
if (o = this.tokenizer.codespan(e)) {
|
|
737
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
738
|
-
continue;
|
|
739
|
-
}
|
|
740
|
-
if (o = this.tokenizer.br(e)) {
|
|
741
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
742
|
-
continue;
|
|
743
|
-
}
|
|
744
|
-
if (o = this.tokenizer.del(e, s, i)) {
|
|
745
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
746
|
-
continue;
|
|
747
|
-
}
|
|
748
|
-
if (o = this.tokenizer.autolink(e)) {
|
|
749
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
750
|
-
continue;
|
|
751
|
-
}
|
|
752
|
-
if (!this.state.inLink && (o = this.tokenizer.url(e))) {
|
|
753
|
-
e = e.substring(o.raw.length), t.push(o);
|
|
754
|
-
continue;
|
|
755
|
-
}
|
|
756
|
-
let c = e;
|
|
757
|
-
if (this.options.extensions?.startInline) {
|
|
758
|
-
let a = 1 / 0, p = e.slice(1), u;
|
|
759
|
-
this.options.extensions.startInline.forEach((m) => {
|
|
760
|
-
u = m.call({ lexer: this }, p), typeof u == "number" && u >= 0 && (a = Math.min(a, u));
|
|
761
|
-
}), a < 1 / 0 && a >= 0 && (c = e.substring(0, a + 1));
|
|
762
|
-
}
|
|
763
|
-
if (o = this.tokenizer.inlineText(c)) {
|
|
764
|
-
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (i = o.raw.slice(-1)), r = true;
|
|
765
|
-
let a = t.at(-1);
|
|
766
|
-
a?.type === "text" ? (a.raw += o.raw, a.text += o.text) : t.push(o);
|
|
767
|
-
continue;
|
|
768
|
-
}
|
|
769
|
-
if (e) {
|
|
770
|
-
this.infiniteLoopError(e.charCodeAt(0));
|
|
771
|
-
break;
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
return t;
|
|
775
|
-
}
|
|
776
|
-
infiniteLoopError(e) {
|
|
777
|
-
let t = "Infinite loop on byte: " + e;
|
|
778
|
-
if (this.options.silent) console.error(t);
|
|
779
|
-
else throw new Error(t);
|
|
780
|
-
}
|
|
781
|
-
}, A = class {
|
|
782
|
-
static {
|
|
783
|
-
__name(this, "A");
|
|
784
|
-
}
|
|
785
|
-
static {
|
|
786
|
-
h(this, "S");
|
|
787
|
-
}
|
|
788
|
-
options;
|
|
789
|
-
parser;
|
|
790
|
-
constructor(n) {
|
|
791
|
-
this.options = n || v;
|
|
792
|
-
}
|
|
793
|
-
space(n) {
|
|
794
|
-
return "";
|
|
795
|
-
}
|
|
796
|
-
code({ text: n, lang: e, escaped: t }) {
|
|
797
|
-
let s = (e || "").match(x.notSpaceStart)?.[0], r = n ? n.replace(x.endingNewline, "") + `
|
|
798
|
-
` : "";
|
|
799
|
-
return s ? '<pre><code class="language-' + y(s) + '">' + (t ? r : y(r, true)) + `</code></pre>
|
|
800
|
-
` : "<pre><code>" + (t ? r : y(r, true)) + `</code></pre>
|
|
801
|
-
`;
|
|
802
|
-
}
|
|
803
|
-
blockquote({ tokens: n }) {
|
|
804
|
-
return `<blockquote>
|
|
19
|
+
`)}`),r=r.substring(0,r.length-f.text.length)+d.text;break}else if(m?.type==="list"){let f=m,k=f.raw+`
|
|
20
|
+
`+t.join(`
|
|
21
|
+
`),w=this.list(k);i[i.length-1]=w,s=s.substring(0,s.length-m.raw.length)+w.raw,r=r.substring(0,r.length-f.raw.length)+w.raw,t=k.substring(i.at(-1).raw.length).split(`
|
|
22
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:r}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),s=t.length>1,r={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let i=this.rules.other.listItemRegex(t),l=!1;for(;n;){let c=!1,a="",p="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;a=e[0],n=n.substring(a.length);let u=e[2].split(`
|
|
23
|
+
`,1)[0],m=e[1].length,f=this.options.pedantic?be(u,m):u.replace(this.rules.other.leadingSpaceTab,C=>be(C,m)),k=n.split(`
|
|
24
|
+
`,1)[0],w=!f.trim(),d=0;if(this.options.pedantic?(d=2,p=f.trimStart()):w?d=m+1:(d=f.search(this.rules.other.nonSpaceChar),d=d>4?1:d,p=f.slice(d),d+=m),w&&this.rules.other.blankLine.test(k)&&(a+=k+`
|
|
25
|
+
`,n=n.substring(k.length+1),c=!0),!c){let C=this.rules.other.nextBulletRegex(d),_=this.rules.other.hrRegex(d),O=this.rules.other.fencesBeginRegex(d),ce=this.rules.other.headingBeginRegex(d),Le=this.rules.other.htmlBeginRegex(d),Ie=this.rules.other.blockquoteBeginRegex(d);for(;n;){let W=n.split(`
|
|
26
|
+
`,1)[0],M;if(k=W,this.options.pedantic?(k=k.replace(this.rules.other.listReplaceNesting," "),M=k):M=k.replace(this.rules.other.leadingSpaceTab,_e=>_e.replace(this.rules.other.tabCharGlobal," ")),O.test(k)||ce.test(k)||Le.test(k)||Ie.test(k)||C.test(k)||_.test(k))break;if(M.search(this.rules.other.nonSpaceChar)>=d||!k.trim())p+=`
|
|
27
|
+
`+M.slice(d);else{if(w||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||O.test(f)||ce.test(f)||_.test(f))break;p+=`
|
|
28
|
+
`+k}w=!k.trim(),a+=W+`
|
|
29
|
+
`,n=n.substring(W.length+1),f=M.slice(d)}}r.loose||(l?r.loose=!0:this.rules.other.doubleBlankLine.test(a)&&(l=!0)),r.items.push({type:"list_item",raw:a,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),r.raw+=a}let o=r.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let c of r.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!r.loose){let a=c.tokens.filter(u=>u.type==="space"),p=a.length>0&&a.some(u=>this.rules.other.anyLine.test(u.raw));r.loose=p}for(let c of r.items){let a=c.tokens[0];if(c.task&&(a?.type==="text"||a?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),a.raw=a.raw.replace(this.rules.other.listReplaceTask,""),a.text=a.text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let u={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=u.checked,r.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=u.raw+c.tokens[0].raw,c.tokens[0].text=u.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(u)):c.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):c.tokens.unshift(u)}}else c.task&&(c.task=!1)}if(r.loose)for(let c of r.items){c.loose=!0;for(let a of c.tokens)a.type==="text"&&(a.type="paragraph")}return r}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=ke(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=U(e[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:$(e[0],`
|
|
30
|
+
`),href:s,title:r}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=fe(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
31
|
+
`):[],i={type:"table",raw:$(e[0],`
|
|
32
|
+
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<t.length;l++)i.header.push({text:t[l],tokens:this.lexer.inline(t[l]),header:!0,align:i.align[l]});for(let l of r)i.rows.push(fe(l,i.header.length).map((o,c)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:i.align[c]})));return i}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:$(e[0],`
|
|
33
|
+
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
34
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&xe(n,e[1],t,this.rules))return;let s=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(s)){if(!this.rules.other.endAngleBracket.test(s))return;let l=$(s.slice(0,-1),"\\");if((s.length-l.length)%2===0)return}else{let l=Bt(e[2],"()");if(l===-2)return;if(l>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+l;e[2]=e[2].substring(0,l),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(r);l&&(r=l[1],i=l[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(s)?r=r.slice(1):r=r.slice(1,-1)),me(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let s=t[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&xe(n,t[1],s,this.rules))return;let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[U(r)];if(!i){let l=t[0].charAt(0);return{type:"text",raw:l,text:l}}return me(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,i,l,o=r,c=0,a=s[0][0],p=t===a,u=a==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*n.length+r);(s=u.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(l=[...i].length,s[3]||s[4]){o+=l;continue}else if(s[5]||s[6]){if(r%3&&!((r+l)%3)){c+=l;continue}if(p)break}if(o-=l,o>0)continue;l=Math.min(l,l+o+c);let m=[...s[0]][0].length,f=n.slice(0,r+s.index+m+l);if(Math.min(r,l)%2){let w=f.slice(1,-1);return{type:"em",raw:f,text:w,tokens:this.lexer.inlineTokens(w)}}let k=f.slice(2,-2);return{type:"strong",raw:f,text:k,tokens:this.lexer.inlineTokens(k)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let r=[...s[0]].length-1,i,l,o=r,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*n.length+r);(s=c.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==r))continue;if(s[3]||s[4]){o+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o);let a=[...s[0]][0].length,p=n.slice(0,r+s.index+a+l),u=p.slice(r,-r);return{type:"del",raw:p,text:u,tokens:this.lexer.inlineTokens(u)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,autolink:!0,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,autolink:!0,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:t?e[0]:qt(e[0]),escaped:t}}}},S=class Y{static{h(this,"l")}tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||v,this.options.tokenizer=this.options.tokenizer||new j,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:x,block:K.normal,inline:D.normal};this.options.pedantic?(t.block=K.pedantic,t.inline=D.pedantic):this.options.gfm&&(t.block=K.gfm,this.options.breaks?t.inline=D.breaks:t.inline=D.gfm),this.tokenizer.rules=t}static get rules(){return{block:K,inline:D}}static lex(e,t){return new Y(t).lex(e)}static lexInline(e,t){return new Y(t).inlineTokens(e)}lex(e){e=e.replace(x.carriageReturn,`
|
|
35
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(x.tabCharGlobal," ").replace(x.spaceLine,""));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(o=>(i=o.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let o=t.at(-1);i.raw.length===1&&o!==void 0?o.raw+=`
|
|
36
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
37
|
+
`)?"":`
|
|
38
|
+
`)+i.raw,o.text+=`
|
|
39
|
+
`+i.text,this.inlineQueue.at(-1).src=o.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
40
|
+
`)?"":`
|
|
41
|
+
`)+i.raw,o.text+=`
|
|
42
|
+
`+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let l=e;if(this.options.extensions?.startBlock){let o=1/0,c=e.slice(1),a;this.options.extensions.startBlock.forEach(p=>{a=p.call({lexer:this},c),typeof a=="number"&&a>=0&&(o=Math.min(o,a))}),o<1/0&&o>=0&&(l=e.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(l))){let o=t.at(-1);s&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(`
|
|
43
|
+
`)?"":`
|
|
44
|
+
`)+i.raw,o.text+=`
|
|
45
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(i),s=l.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(`
|
|
46
|
+
`)?"":`
|
|
47
|
+
`)+i.raw,o.text+=`
|
|
48
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let s of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(s[0])&&e.charAt(s.index-1)!=="!")return!0;for(let s of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let r=s[0],i=r.lastIndexOf("[");if(!(r.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,U(r.slice(i+1,-1))))&&!(i>1&&this.linkInText(r.slice(1,i-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links&&e.includes("[")){let o=this.tokenizer.rules.inline.reflinkSearch,c=h(a=>{let p=a.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,U(a.slice(p+1,-1))))return a;if(p>1&&a.charAt(0)!=="!"){let u=a.slice(1,p-1);if(this.linkInText(u))return"["+u.replace(o,c)+"]["+"a".repeat(a.length-p-2)+"]"}return"["+"a".repeat(a.length-2)+"]"},"u");s=s.replace(o,c)}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,o=>"+".repeat(o.length)),s=s.replace(this.tokenizer.rules.inline.blockSkip,(o,c,a)=>{let p=a?a.length:0;return o.slice(0,p)+"["+"a".repeat(o.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let r=!1,i="",l=1/0;for(;e;){if(e.length<l)l=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=""),r=!1;let o;if(this.options.extensions?.inline?.some(a=>(o=a.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let a=t.at(-1);o.type==="text"&&a?.type==="text"?(a.raw+=o.raw,a.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,s,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,s,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let c=e;if(this.options.extensions?.startInline){let a=1/0,p=e.slice(1),u;this.options.extensions.startInline.forEach(m=>{u=m.call({lexer:this},p),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(c=e.substring(0,a+1))}if(o=this.tokenizer.inlineText(c)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(i=o.raw.slice(-1)),r=!0;let a=t.at(-1);a?.type==="text"?(a.raw+=o.raw,a.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},A=class{static{h(this,"S")}options;parser;constructor(n){this.options=n||v}space(n){return""}code({text:n,lang:e,escaped:t}){let s=(e||"").match(x.notSpaceStart)?.[0],r=n?n.replace(x.endingNewline,"")+`
|
|
49
|
+
`:"";return s?'<pre><code class="language-'+y(s)+'">'+(t?r:y(r,!0))+`</code></pre>
|
|
50
|
+
`:"<pre><code>"+(t?r:y(r,!0))+`</code></pre>
|
|
51
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
805
52
|
${this.parser.parse(n)}</blockquote>
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
}
|
|
814
|
-
heading({ tokens: n, depth: e }) {
|
|
815
|
-
return `<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
816
|
-
`;
|
|
817
|
-
}
|
|
818
|
-
hr(n) {
|
|
819
|
-
return `<hr>
|
|
820
|
-
`;
|
|
821
|
-
}
|
|
822
|
-
list(n) {
|
|
823
|
-
let e = n.ordered, t = n.start, s = "";
|
|
824
|
-
for (let l = 0; l < n.items.length; l++) {
|
|
825
|
-
let o = n.items[l];
|
|
826
|
-
s += this.listitem(o);
|
|
827
|
-
}
|
|
828
|
-
let r = e ? "ol" : "ul", i = e && t !== 1 ? ' start="' + t + '"' : "";
|
|
829
|
-
return "<" + r + i + `>
|
|
830
|
-
` + s + "</" + r + `>
|
|
831
|
-
`;
|
|
832
|
-
}
|
|
833
|
-
listitem(n) {
|
|
834
|
-
return `<li>${this.parser.parse(n.tokens)}</li>
|
|
835
|
-
`;
|
|
836
|
-
}
|
|
837
|
-
checkbox({ checked: n }) {
|
|
838
|
-
return "<input " + (n ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
839
|
-
}
|
|
840
|
-
paragraph({ tokens: n }) {
|
|
841
|
-
return `<p>${this.parser.parseInline(n)}</p>
|
|
842
|
-
`;
|
|
843
|
-
}
|
|
844
|
-
table(n) {
|
|
845
|
-
let e = "", t = "";
|
|
846
|
-
for (let r = 0; r < n.header.length; r++) t += this.tablecell(n.header[r]);
|
|
847
|
-
e += this.tablerow({ text: t });
|
|
848
|
-
let s = "";
|
|
849
|
-
for (let r = 0; r < n.rows.length; r++) {
|
|
850
|
-
let i = n.rows[r];
|
|
851
|
-
t = "";
|
|
852
|
-
for (let l = 0; l < i.length; l++) t += this.tablecell(i[l]);
|
|
853
|
-
s += this.tablerow({ text: t });
|
|
854
|
-
}
|
|
855
|
-
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
53
|
+
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
|
|
54
|
+
`}hr(n){return`<hr>
|
|
55
|
+
`}list(n){let e=n.ordered,t=n.start,s="";for(let l=0;l<n.items.length;l++){let o=n.items[l];s+=this.listitem(o)}let r=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+r+i+`>
|
|
56
|
+
`+s+"</"+r+`>
|
|
57
|
+
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
|
58
|
+
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
59
|
+
`}table(n){let e="",t="";for(let r=0;r<n.header.length;r++)t+=this.tablecell(n.header[r]);e+=this.tablerow({text:t});let s="";for(let r=0;r<n.rows.length;r++){let i=n.rows[r];t="";for(let l=0;l<i.length;l++)t+=this.tablecell(i[l]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
856
60
|
<thead>
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
}
|
|
861
|
-
tablerow({ text: n }) {
|
|
862
|
-
return `<tr>
|
|
61
|
+
`+e+`</thead>
|
|
62
|
+
`+s+`</table>
|
|
63
|
+
`}tablerow({text:n}){return`<tr>
|
|
863
64
|
${n}</tr>
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
return `<strong>${this.parser.parseInline(n)}</strong>`;
|
|
873
|
-
}
|
|
874
|
-
em({ tokens: n }) {
|
|
875
|
-
return `<em>${this.parser.parseInline(n)}</em>`;
|
|
876
|
-
}
|
|
877
|
-
codespan({ text: n }) {
|
|
878
|
-
return `<code>${y(n, true)}</code>`;
|
|
879
|
-
}
|
|
880
|
-
br(n) {
|
|
881
|
-
return "<br>";
|
|
882
|
-
}
|
|
883
|
-
del({ tokens: n }) {
|
|
884
|
-
return `<del>${this.parser.parseInline(n)}</del>`;
|
|
885
|
-
}
|
|
886
|
-
link({ href: n, title: e, text: t, tokens: s, autolink: r }) {
|
|
887
|
-
let i = r ? y(t, true) : this.parser.parseInline(s), l = de(n);
|
|
888
|
-
if (l === null) return i;
|
|
889
|
-
n = y(l, r);
|
|
890
|
-
let o = '<a href="' + n + '"';
|
|
891
|
-
return e && (o += ' title="' + y(e) + '"'), o += ">" + i + "</a>", o;
|
|
892
|
-
}
|
|
893
|
-
image({ href: n, title: e, text: t, tokens: s }) {
|
|
894
|
-
s && (t = this.parser.parseInline(s, this.parser.textRenderer));
|
|
895
|
-
let r = de(n);
|
|
896
|
-
if (r === null) return y(t);
|
|
897
|
-
n = r;
|
|
898
|
-
let i = `<img src="${y(n)}" alt="${y(t)}"`;
|
|
899
|
-
return e && (i += ` title="${y(e)}"`), i += ">", i;
|
|
900
|
-
}
|
|
901
|
-
text(n) {
|
|
902
|
-
return "tokens" in n && n.tokens ? this.parser.parseInline(n.tokens) : "escaped" in n && n.escaped ? n.text : y(n.text);
|
|
903
|
-
}
|
|
904
|
-
}, le = class {
|
|
905
|
-
static {
|
|
906
|
-
__name(this, "le");
|
|
907
|
-
}
|
|
908
|
-
static {
|
|
909
|
-
h(this, "z");
|
|
910
|
-
}
|
|
911
|
-
strong({ text: n }) {
|
|
912
|
-
return n;
|
|
913
|
-
}
|
|
914
|
-
em({ text: n }) {
|
|
915
|
-
return n;
|
|
916
|
-
}
|
|
917
|
-
codespan({ text: n }) {
|
|
918
|
-
return n;
|
|
919
|
-
}
|
|
920
|
-
del({ text: n }) {
|
|
921
|
-
return n;
|
|
922
|
-
}
|
|
923
|
-
html({ text: n }) {
|
|
924
|
-
return n;
|
|
925
|
-
}
|
|
926
|
-
text({ text: n }) {
|
|
927
|
-
return n;
|
|
928
|
-
}
|
|
929
|
-
link({ text: n }) {
|
|
930
|
-
return "" + n;
|
|
931
|
-
}
|
|
932
|
-
image({ text: n }) {
|
|
933
|
-
return "" + n;
|
|
934
|
-
}
|
|
935
|
-
br() {
|
|
936
|
-
return "";
|
|
937
|
-
}
|
|
938
|
-
checkbox({ raw: n }) {
|
|
939
|
-
return n;
|
|
940
|
-
}
|
|
941
|
-
}, R = class J {
|
|
942
|
-
static {
|
|
943
|
-
__name(this, "J");
|
|
944
|
-
}
|
|
945
|
-
static {
|
|
946
|
-
h(this, "l");
|
|
947
|
-
}
|
|
948
|
-
options;
|
|
949
|
-
renderer;
|
|
950
|
-
textRenderer;
|
|
951
|
-
constructor(e) {
|
|
952
|
-
this.options = e || v, this.options.renderer = this.options.renderer || new A(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new le();
|
|
953
|
-
}
|
|
954
|
-
static parse(e, t) {
|
|
955
|
-
return new J(t).parse(e);
|
|
956
|
-
}
|
|
957
|
-
static parseInline(e, t) {
|
|
958
|
-
return new J(t).parseInline(e);
|
|
959
|
-
}
|
|
960
|
-
parse(e) {
|
|
961
|
-
this.renderer.parser = this;
|
|
962
|
-
let t = "";
|
|
963
|
-
for (let s = 0; s < e.length; s++) {
|
|
964
|
-
let r = e[s];
|
|
965
|
-
if (this.options.extensions?.renderers?.[r.type]) {
|
|
966
|
-
let l = r, o = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
967
|
-
if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "checkbox", "html", "def", "paragraph", "text"].includes(l.type)) {
|
|
968
|
-
t += o || "";
|
|
969
|
-
continue;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
let i = r;
|
|
973
|
-
switch (i.type) {
|
|
974
|
-
case "space": {
|
|
975
|
-
t += this.renderer.space(i);
|
|
976
|
-
break;
|
|
977
|
-
}
|
|
978
|
-
case "hr": {
|
|
979
|
-
t += this.renderer.hr(i);
|
|
980
|
-
break;
|
|
981
|
-
}
|
|
982
|
-
case "heading": {
|
|
983
|
-
t += this.renderer.heading(i);
|
|
984
|
-
break;
|
|
985
|
-
}
|
|
986
|
-
case "code": {
|
|
987
|
-
t += this.renderer.code(i);
|
|
988
|
-
break;
|
|
989
|
-
}
|
|
990
|
-
case "table": {
|
|
991
|
-
t += this.renderer.table(i);
|
|
992
|
-
break;
|
|
993
|
-
}
|
|
994
|
-
case "blockquote": {
|
|
995
|
-
t += this.renderer.blockquote(i);
|
|
996
|
-
break;
|
|
997
|
-
}
|
|
998
|
-
case "list": {
|
|
999
|
-
t += this.renderer.list(i);
|
|
1000
|
-
break;
|
|
1001
|
-
}
|
|
1002
|
-
case "checkbox": {
|
|
1003
|
-
t += this.renderer.checkbox(i);
|
|
1004
|
-
break;
|
|
1005
|
-
}
|
|
1006
|
-
case "html": {
|
|
1007
|
-
t += this.renderer.html(i);
|
|
1008
|
-
break;
|
|
1009
|
-
}
|
|
1010
|
-
case "def": {
|
|
1011
|
-
t += this.renderer.def(i);
|
|
1012
|
-
break;
|
|
1013
|
-
}
|
|
1014
|
-
case "paragraph": {
|
|
1015
|
-
t += this.renderer.paragraph(i);
|
|
1016
|
-
break;
|
|
1017
|
-
}
|
|
1018
|
-
case "text": {
|
|
1019
|
-
t += this.renderer.text(i);
|
|
1020
|
-
break;
|
|
1021
|
-
}
|
|
1022
|
-
default: {
|
|
1023
|
-
let l = 'Token with "' + i.type + '" type was not found.';
|
|
1024
|
-
if (this.options.silent) return console.error(l), "";
|
|
1025
|
-
throw new Error(l);
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
return t;
|
|
1030
|
-
}
|
|
1031
|
-
parseInline(e, t = this.renderer) {
|
|
1032
|
-
this.renderer.parser = this;
|
|
1033
|
-
let s = "";
|
|
1034
|
-
for (let r = 0; r < e.length; r++) {
|
|
1035
|
-
let i = e[r];
|
|
1036
|
-
if (this.options.extensions?.renderers?.[i.type]) {
|
|
1037
|
-
let o = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
1038
|
-
if (o !== false || !["escape", "html", "link", "image", "checkbox", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
1039
|
-
s += o || "";
|
|
1040
|
-
continue;
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
let l = i;
|
|
1044
|
-
switch (l.type) {
|
|
1045
|
-
case "escape": {
|
|
1046
|
-
s += t.text(l);
|
|
1047
|
-
break;
|
|
1048
|
-
}
|
|
1049
|
-
case "html": {
|
|
1050
|
-
s += t.html(l);
|
|
1051
|
-
break;
|
|
1052
|
-
}
|
|
1053
|
-
case "link": {
|
|
1054
|
-
s += t.link(l);
|
|
1055
|
-
break;
|
|
1056
|
-
}
|
|
1057
|
-
case "image": {
|
|
1058
|
-
s += t.image(l);
|
|
1059
|
-
break;
|
|
1060
|
-
}
|
|
1061
|
-
case "checkbox": {
|
|
1062
|
-
s += t.checkbox(l);
|
|
1063
|
-
break;
|
|
1064
|
-
}
|
|
1065
|
-
case "strong": {
|
|
1066
|
-
s += t.strong(l);
|
|
1067
|
-
break;
|
|
1068
|
-
}
|
|
1069
|
-
case "em": {
|
|
1070
|
-
s += t.em(l);
|
|
1071
|
-
break;
|
|
1072
|
-
}
|
|
1073
|
-
case "codespan": {
|
|
1074
|
-
s += t.codespan(l);
|
|
1075
|
-
break;
|
|
1076
|
-
}
|
|
1077
|
-
case "br": {
|
|
1078
|
-
s += t.br(l);
|
|
1079
|
-
break;
|
|
1080
|
-
}
|
|
1081
|
-
case "del": {
|
|
1082
|
-
s += t.del(l);
|
|
1083
|
-
break;
|
|
1084
|
-
}
|
|
1085
|
-
case "text": {
|
|
1086
|
-
s += t.text(l);
|
|
1087
|
-
break;
|
|
1088
|
-
}
|
|
1089
|
-
default: {
|
|
1090
|
-
let o = 'Token with "' + l.type + '" type was not found.';
|
|
1091
|
-
if (this.options.silent) return console.error(o), "";
|
|
1092
|
-
throw new Error(o);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
return s;
|
|
1097
|
-
}
|
|
1098
|
-
}, q = class {
|
|
1099
|
-
static {
|
|
1100
|
-
__name(this, "q");
|
|
1101
|
-
}
|
|
1102
|
-
static {
|
|
1103
|
-
h(this, "_");
|
|
1104
|
-
}
|
|
1105
|
-
options;
|
|
1106
|
-
block;
|
|
1107
|
-
constructor(n) {
|
|
1108
|
-
this.options = n || v;
|
|
1109
|
-
}
|
|
1110
|
-
static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
1111
|
-
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
1112
|
-
preprocess(n) {
|
|
1113
|
-
return n;
|
|
1114
|
-
}
|
|
1115
|
-
postprocess(n) {
|
|
1116
|
-
return n;
|
|
1117
|
-
}
|
|
1118
|
-
processAllTokens(n) {
|
|
1119
|
-
return n;
|
|
1120
|
-
}
|
|
1121
|
-
emStrongMask(n) {
|
|
1122
|
-
return n;
|
|
1123
|
-
}
|
|
1124
|
-
provideLexer(n = this.block) {
|
|
1125
|
-
return n ? S.lex : S.lexInline;
|
|
1126
|
-
}
|
|
1127
|
-
provideParser(n = this.block) {
|
|
1128
|
-
return n ? R.parse : R.parseInline;
|
|
1129
|
-
}
|
|
1130
|
-
}, Q = class {
|
|
1131
|
-
static {
|
|
1132
|
-
__name(this, "Q");
|
|
1133
|
-
}
|
|
1134
|
-
static {
|
|
1135
|
-
h(this, "F");
|
|
1136
|
-
}
|
|
1137
|
-
defaults = ee();
|
|
1138
|
-
options = this.setOptions;
|
|
1139
|
-
parse = this.parseMarkdown(true);
|
|
1140
|
-
parseInline = this.parseMarkdown(false);
|
|
1141
|
-
Parser = R;
|
|
1142
|
-
Renderer = A;
|
|
1143
|
-
TextRenderer = le;
|
|
1144
|
-
Lexer = S;
|
|
1145
|
-
Tokenizer = j;
|
|
1146
|
-
Hooks = q;
|
|
1147
|
-
constructor(...n) {
|
|
1148
|
-
this.use(...n);
|
|
1149
|
-
}
|
|
1150
|
-
walkTokens(n, e) {
|
|
1151
|
-
let t = [];
|
|
1152
|
-
for (let s of n) switch (t = t.concat(e.call(this, s)), s.type) {
|
|
1153
|
-
case "table": {
|
|
1154
|
-
let r = s;
|
|
1155
|
-
for (let i of r.header) t = t.concat(this.walkTokens(i.tokens, e));
|
|
1156
|
-
for (let i of r.rows) for (let l of i) t = t.concat(this.walkTokens(l.tokens, e));
|
|
1157
|
-
break;
|
|
1158
|
-
}
|
|
1159
|
-
case "list": {
|
|
1160
|
-
let r = s;
|
|
1161
|
-
t = t.concat(this.walkTokens(r.items, e));
|
|
1162
|
-
break;
|
|
1163
|
-
}
|
|
1164
|
-
default: {
|
|
1165
|
-
let r = s;
|
|
1166
|
-
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((i) => {
|
|
1167
|
-
let l = r[i].flat(1 / 0);
|
|
1168
|
-
t = t.concat(this.walkTokens(l, e));
|
|
1169
|
-
}) : r.tokens && (t = t.concat(this.walkTokens(r.tokens, e)));
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
return t;
|
|
1173
|
-
}
|
|
1174
|
-
use(...n) {
|
|
1175
|
-
let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1176
|
-
return n.forEach((t) => {
|
|
1177
|
-
let s = { ...t };
|
|
1178
|
-
if (s.async = this.defaults.async || s.async || false, t.extensions && (t.extensions.forEach((r) => {
|
|
1179
|
-
if (!r.name) throw new Error("extension name required");
|
|
1180
|
-
if ("renderer" in r) {
|
|
1181
|
-
let i = e.renderers[r.name];
|
|
1182
|
-
i ? e.renderers[r.name] = function(...l) {
|
|
1183
|
-
let o = r.renderer.apply(this, l);
|
|
1184
|
-
return o === false && (o = i.apply(this, l)), o;
|
|
1185
|
-
} : e.renderers[r.name] = r.renderer;
|
|
1186
|
-
}
|
|
1187
|
-
if ("tokenizer" in r) {
|
|
1188
|
-
if (!r.level || r.level !== "block" && r.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1189
|
-
let i = e[r.level];
|
|
1190
|
-
i ? i.unshift(r.tokenizer) : e[r.level] = [r.tokenizer], r.start && (r.level === "block" ? e.startBlock ? e.startBlock.push(r.start) : e.startBlock = [r.start] : r.level === "inline" && (e.startInline ? e.startInline.push(r.start) : e.startInline = [r.start]));
|
|
1191
|
-
}
|
|
1192
|
-
"childTokens" in r && r.childTokens && (e.childTokens[r.name] = r.childTokens);
|
|
1193
|
-
}), s.extensions = e), t.renderer) {
|
|
1194
|
-
let r = this.defaults.renderer || new A(this.defaults);
|
|
1195
|
-
for (let i in t.renderer) {
|
|
1196
|
-
if (!(i in r)) throw new Error(`renderer '${i}' does not exist`);
|
|
1197
|
-
if (["options", "parser"].includes(i)) continue;
|
|
1198
|
-
let l = i, o = t.renderer[l], c = r[l];
|
|
1199
|
-
r[l] = (...a) => {
|
|
1200
|
-
let p = o.apply(r, a);
|
|
1201
|
-
return p === false && (p = c.apply(r, a)), p || "";
|
|
1202
|
-
};
|
|
1203
|
-
}
|
|
1204
|
-
s.renderer = r;
|
|
1205
|
-
}
|
|
1206
|
-
if (t.tokenizer) {
|
|
1207
|
-
let r = this.defaults.tokenizer || new j(this.defaults);
|
|
1208
|
-
for (let i in t.tokenizer) {
|
|
1209
|
-
if (!(i in r)) throw new Error(`tokenizer '${i}' does not exist`);
|
|
1210
|
-
if (["options", "rules", "lexer"].includes(i)) continue;
|
|
1211
|
-
let l = i, o = t.tokenizer[l], c = r[l];
|
|
1212
|
-
r[l] = (...a) => {
|
|
1213
|
-
let p = o.apply(r, a);
|
|
1214
|
-
return p === false && (p = c.apply(r, a)), p;
|
|
1215
|
-
};
|
|
1216
|
-
}
|
|
1217
|
-
s.tokenizer = r;
|
|
1218
|
-
}
|
|
1219
|
-
if (t.hooks) {
|
|
1220
|
-
let r = this.defaults.hooks || new q();
|
|
1221
|
-
for (let i in t.hooks) {
|
|
1222
|
-
if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
|
|
1223
|
-
if (["options", "block"].includes(i)) continue;
|
|
1224
|
-
let l = i, o = t.hooks[l], c = r[l];
|
|
1225
|
-
q.passThroughHooks.has(i) ? r[l] = (a) => {
|
|
1226
|
-
if (this.defaults.async && q.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
1227
|
-
let u = await o.call(r, a);
|
|
1228
|
-
return c.call(r, u);
|
|
1229
|
-
})();
|
|
1230
|
-
let p = o.call(r, a);
|
|
1231
|
-
return c.call(r, p);
|
|
1232
|
-
} : r[l] = (...a) => {
|
|
1233
|
-
if (this.defaults.async) return (async () => {
|
|
1234
|
-
let u = await o.apply(r, a);
|
|
1235
|
-
return u === false && (u = await c.apply(r, a)), u;
|
|
1236
|
-
})();
|
|
1237
|
-
let p = o.apply(r, a);
|
|
1238
|
-
return p === false && (p = c.apply(r, a)), p;
|
|
1239
|
-
};
|
|
1240
|
-
}
|
|
1241
|
-
s.hooks = r;
|
|
1242
|
-
}
|
|
1243
|
-
if (t.walkTokens) {
|
|
1244
|
-
let r = this.defaults.walkTokens, i = t.walkTokens;
|
|
1245
|
-
s.walkTokens = function(l) {
|
|
1246
|
-
let o = [];
|
|
1247
|
-
return o.push(i.call(this, l)), r && (o = o.concat(r.call(this, l))), o;
|
|
1248
|
-
};
|
|
1249
|
-
}
|
|
1250
|
-
this.defaults = { ...this.defaults, ...s };
|
|
1251
|
-
}), this;
|
|
1252
|
-
}
|
|
1253
|
-
setOptions(n) {
|
|
1254
|
-
return this.defaults = { ...this.defaults, ...n }, this;
|
|
1255
|
-
}
|
|
1256
|
-
lexer(n, e) {
|
|
1257
|
-
return S.lex(n, e ?? this.defaults);
|
|
1258
|
-
}
|
|
1259
|
-
parser(n, e) {
|
|
1260
|
-
return R.parse(n, e ?? this.defaults);
|
|
1261
|
-
}
|
|
1262
|
-
parseMarkdown(n) {
|
|
1263
|
-
return (e, t) => {
|
|
1264
|
-
let s = { ...t }, r = { ...this.defaults, ...s }, i = this.onError(!!r.silent, !!r.async);
|
|
1265
|
-
if (this.defaults.async === true && s.async === false) return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
1266
|
-
if (typeof e > "u" || e === null) return i(new Error("marked(): input parameter is undefined or null"));
|
|
1267
|
-
if (typeof e != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
|
|
1268
|
-
if (r.hooks && (r.hooks.options = r, r.hooks.block = n), r.async) return (async () => {
|
|
1269
|
-
let l = r.hooks ? await r.hooks.preprocess(e) : e, o = await (r.hooks ? await r.hooks.provideLexer(n) : n ? S.lex : S.lexInline)(l, r), c = r.hooks ? await r.hooks.processAllTokens(o) : o;
|
|
1270
|
-
r.walkTokens && await Promise.all(this.walkTokens(c, r.walkTokens));
|
|
1271
|
-
let a = await (r.hooks ? await r.hooks.provideParser(n) : n ? R.parse : R.parseInline)(c, r);
|
|
1272
|
-
return r.hooks ? await r.hooks.postprocess(a) : a;
|
|
1273
|
-
})().catch(i);
|
|
1274
|
-
try {
|
|
1275
|
-
r.hooks && (e = r.hooks.preprocess(e));
|
|
1276
|
-
let l = (r.hooks ? r.hooks.provideLexer(n) : n ? S.lex : S.lexInline)(e, r);
|
|
1277
|
-
r.hooks && (l = r.hooks.processAllTokens(l)), r.walkTokens && this.walkTokens(l, r.walkTokens);
|
|
1278
|
-
let o = (r.hooks ? r.hooks.provideParser(n) : n ? R.parse : R.parseInline)(l, r);
|
|
1279
|
-
return r.hooks && (o = r.hooks.postprocess(o)), o;
|
|
1280
|
-
} catch (l) {
|
|
1281
|
-
return i(l);
|
|
1282
|
-
}
|
|
1283
|
-
};
|
|
1284
|
-
}
|
|
1285
|
-
onError(n, e) {
|
|
1286
|
-
return (t) => {
|
|
1287
|
-
if (t.message += `
|
|
1288
|
-
Please report this to https://github.com/markedjs/marked.`, n) {
|
|
1289
|
-
let s = "<p>An error occurred:</p><pre>" + y(t.message + "", true) + "</pre>";
|
|
1290
|
-
return e ? Promise.resolve(s) : s;
|
|
1291
|
-
}
|
|
1292
|
-
if (e) return Promise.reject(t);
|
|
1293
|
-
throw t;
|
|
1294
|
-
};
|
|
1295
|
-
}
|
|
1296
|
-
}, P = new Q();
|
|
1297
|
-
function b(n, e) {
|
|
1298
|
-
return P.parse(n, e);
|
|
1299
|
-
}
|
|
1300
|
-
__name(b, "b");
|
|
1301
|
-
h(b, "k");
|
|
1302
|
-
b.options = b.setOptions = function(n) {
|
|
1303
|
-
return P.setOptions(n), b.defaults = P.defaults, we(b.defaults), b;
|
|
1304
|
-
};
|
|
1305
|
-
b.getDefaults = ee;
|
|
1306
|
-
b.defaults = v;
|
|
1307
|
-
function Ht(...n) {
|
|
1308
|
-
return P.use(...n), b.defaults = P.defaults, we(b.defaults), b;
|
|
1309
|
-
}
|
|
1310
|
-
__name(Ht, "Ht");
|
|
1311
|
-
h(Ht, "Pt");
|
|
1312
|
-
b.use = Ht;
|
|
1313
|
-
b.walkTokens = function(n, e) {
|
|
1314
|
-
return P.walkTokens(n, e);
|
|
1315
|
-
};
|
|
1316
|
-
b.parseInline = P.parseInline;
|
|
1317
|
-
b.Parser = R;
|
|
1318
|
-
b.parser = R.parse;
|
|
1319
|
-
b.Renderer = A;
|
|
1320
|
-
b.TextRenderer = le;
|
|
1321
|
-
b.Lexer = S;
|
|
1322
|
-
b.lexer = S.lex;
|
|
1323
|
-
b.Tokenizer = j;
|
|
1324
|
-
b.Hooks = q;
|
|
1325
|
-
b.parse = b;
|
|
1326
|
-
var Jt = b.options, en = b.setOptions, tn = b.walkTokens, nn = b.parseInline;
|
|
1327
|
-
var rn = R.parse, sn = S.lex;
|
|
1328
|
-
function ve(n, e, t) {
|
|
1329
|
-
return Math.min(t, Math.max(e, n));
|
|
1330
|
-
}
|
|
1331
|
-
__name(ve, "ve");
|
|
1332
|
-
h(ve, "clamp");
|
|
1333
|
-
function Ce(n, { as: e = "id", fallback: t = "" } = {}) {
|
|
1334
|
-
return (e === "github" ? n.trim().toLowerCase().replace(/[^\p{L}\p{M}\p{N}\p{Pc}\- ]/gu, "").replace(/ /g, "-") : Vt(n.normalize("NFKD")).toLowerCase().replace(/['’]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")) || t;
|
|
1335
|
-
}
|
|
1336
|
-
__name(Ce, "Ce");
|
|
1337
|
-
h(Ce, "slug");
|
|
1338
|
-
function Vt(n, { keep: e = "" } = {}) {
|
|
1339
|
-
let t = e.normalize("NFC").toLowerCase();
|
|
1340
|
-
return n.normalize("NFC").replace(/\P{ASCII}/gu, (s) => t.includes(s.toLowerCase()) ? s : s.normalize("NFD").replace(/\p{M}+/gu, ""));
|
|
1341
|
-
}
|
|
1342
|
-
__name(Vt, "Vt");
|
|
1343
|
-
h(Vt, "withoutAccents");
|
|
1344
|
-
var G = class extends Error {
|
|
1345
|
-
static {
|
|
1346
|
-
__name(this, "G");
|
|
1347
|
-
}
|
|
1348
|
-
static {
|
|
1349
|
-
h(this, "ApiError");
|
|
1350
|
-
}
|
|
1351
|
-
get status() {
|
|
1352
|
-
return this.cause?.response.status;
|
|
1353
|
-
}
|
|
1354
|
-
get response() {
|
|
1355
|
-
return this.cause?.response;
|
|
1356
|
-
}
|
|
1357
|
-
};
|
|
1358
|
-
G.prototype.name = "ApiError";
|
|
1359
|
-
var Zt = ["load", "cross-origin", "file-protocol", "save", "conflict", "no-saver", "render"], I = class n extends Error {
|
|
1360
|
-
static {
|
|
1361
|
-
__name(this, "n");
|
|
1362
|
-
}
|
|
1363
|
-
static {
|
|
1364
|
-
h(this, "SourceError");
|
|
1365
|
-
}
|
|
1366
|
-
get kind() {
|
|
1367
|
-
return this.cause?.kind;
|
|
1368
|
-
}
|
|
1369
|
-
get status() {
|
|
1370
|
-
return this.cause?.status;
|
|
1371
|
-
}
|
|
1372
|
-
static kindFor(e, t) {
|
|
1373
|
-
return e instanceof n && e.kind || t;
|
|
1374
|
-
}
|
|
1375
|
-
static isKind(e) {
|
|
1376
|
-
return Zt.includes(e);
|
|
1377
|
-
}
|
|
1378
|
-
};
|
|
1379
|
-
I.prototype.name = "SourceError";
|
|
1380
|
-
var V = class n {
|
|
1381
|
-
static {
|
|
1382
|
-
__name(this, "n");
|
|
1383
|
-
}
|
|
1384
|
-
static {
|
|
1385
|
-
h(this, "MarkdownSource");
|
|
1386
|
-
}
|
|
1387
|
-
static placesOf(e, t) {
|
|
1388
|
-
let s = [], r = h((l, o, c, a) => {
|
|
1389
|
-
l[ze] = s.length, s.push({ kind: o, start: c, end: a });
|
|
1390
|
-
}, "add"), i = 0;
|
|
1391
|
-
for (let l of e) {
|
|
1392
|
-
let o = t.startsWith(l.raw, i) ? i : t.indexOf(l.raw, i);
|
|
1393
|
-
if (o < 0) break;
|
|
1394
|
-
n.visit(l, t, o, r), i = o + l.raw.length;
|
|
1395
|
-
}
|
|
1396
|
-
return s;
|
|
1397
|
-
}
|
|
1398
|
-
static placeOf(e) {
|
|
1399
|
-
return e[ze];
|
|
1400
|
-
}
|
|
1401
|
-
static replace(e, t, s) {
|
|
1402
|
-
let r = t.kind === "paragraph" ? s.replace(/\s+$/, "") : s.replace(/\s*\n\s*/g, " ").trim(), i = t.kind === "cell" ? r.replace(jt, "\\|") : r;
|
|
1403
|
-
return e.slice(0, t.start) + i + e.slice(t.end);
|
|
1404
|
-
}
|
|
1405
|
-
static visit(e, t, s, r) {
|
|
1406
|
-
e.type === "paragraph" ? n.paragraph(e, s, r) : e.type === "heading" ? n.heading(e, s, r) : e.type === "table" ? n.table(e, s, r) : e.type === "list" && n.list(e, t, s, s + e.raw.length, r);
|
|
1407
|
-
}
|
|
1408
|
-
static paragraph(e, t, s) {
|
|
1409
|
-
let { from: r, to: i } = n.trimmed(e.raw);
|
|
1410
|
-
i > r && s(e, "paragraph", t + r, t + i);
|
|
1411
|
-
}
|
|
1412
|
-
static heading(e, t, s) {
|
|
1413
|
-
let r = Kt.exec(e.raw.split(`
|
|
1414
|
-
`)[0]);
|
|
1415
|
-
if (r) {
|
|
1416
|
-
let c = r[2];
|
|
1417
|
-
c && s(e, "heading", t + r[1].length, t + r[1].length + c.length);
|
|
1418
|
-
return;
|
|
1419
|
-
}
|
|
1420
|
-
let i = Ft.exec(e.raw);
|
|
1421
|
-
if (!i) return;
|
|
1422
|
-
let { from: l, to: o } = n.trimmed(e.raw.slice(0, i.index));
|
|
1423
|
-
o > l && s(e, "heading", t + l, t + o);
|
|
1424
|
-
}
|
|
1425
|
-
static table(e, t, s) {
|
|
1426
|
-
let r = n.linesOf(e.raw), i = [e.header, null, ...e.rows];
|
|
1427
|
-
for (let [l, o] of r.entries()) {
|
|
1428
|
-
let c = i[l];
|
|
1429
|
-
if (c) for (let [a, p] of n.cellsOf(o.text).entries()) {
|
|
1430
|
-
let u = c[a];
|
|
1431
|
-
u && s(u, "cell", t + o.start + p.from, t + o.start + p.to);
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
static list(e, t, s, r, i) {
|
|
1436
|
-
let l = s;
|
|
1437
|
-
for (let o of e.items) {
|
|
1438
|
-
let c = o.raw.split(`
|
|
1439
|
-
`)[0].trim(), a = t.indexOf(c, l);
|
|
1440
|
-
if (a < 0 || a >= r) return;
|
|
1441
|
-
l = a + c.length;
|
|
1442
|
-
let p = o.tokens.filter((d) => d.type !== "space" && d.type !== "checkbox"), [u, ...m] = p, f = Ut.exec(c), k = !!u && !u.raw.trim().includes(`
|
|
1443
|
-
`), w = m.every((d) => d.type === "list");
|
|
1444
|
-
if (f && k && w && (u.type === "text" || u.type === "paragraph")) {
|
|
1445
|
-
let d = c.slice(f[0].length).replace(/\s+$/, "");
|
|
1446
|
-
d && i(o, "item", a + f[0].length, a + f[0].length + d.length);
|
|
1447
|
-
}
|
|
1448
|
-
for (let d of m) {
|
|
1449
|
-
if (d.type !== "list") break;
|
|
1450
|
-
n.list(d, t, l, r, i);
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
static trimmed(e) {
|
|
1455
|
-
return { from: e.length - e.trimStart().length, to: e.trimEnd().length };
|
|
1456
|
-
}
|
|
1457
|
-
static linesOf(e) {
|
|
1458
|
-
let t = [], s = 0;
|
|
1459
|
-
for (let r of e.split(`
|
|
1460
|
-
`)) r.trim() && t.push({ text: r, start: s }), s += r.length + 1;
|
|
1461
|
-
return t;
|
|
1462
|
-
}
|
|
1463
|
-
static cellsOf(e) {
|
|
1464
|
-
let t = [];
|
|
1465
|
-
for (let i = 0; i < e.length; i++) e[i] === "\\" ? i++ : e[i] === "|" && t.push(i);
|
|
1466
|
-
let s = [-1, ...t, e.length], r = [];
|
|
1467
|
-
for (let i = 0; i < s.length - 1; i++) {
|
|
1468
|
-
let l = s[i] + 1, o = s[i + 1], c = e.slice(l, o);
|
|
1469
|
-
if ((i === 0 || i === s.length - 2) && !c.trim() && t.length) continue;
|
|
1470
|
-
let p = c.length - c.trimStart().length, u = c.trim().length;
|
|
1471
|
-
r.push(u ? { from: l + p, to: l + p + u } : { from: l + Math.min(1, c.length), to: l + Math.min(1, c.length) });
|
|
1472
|
-
}
|
|
1473
|
-
return r;
|
|
1474
|
-
}
|
|
1475
|
-
}, ze = "uiPlace", Kt = /^( {0,3}#{1,6}(?:[ \t]+|$))(.*?)(?:[ \t]+#+)?[ \t]*$/, Ft = /\n {0,3}(?:=+|-+)[ \t]*\n*$/, Ut = /^(?:[*+-]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/, jt = /(?<!\\)\|/g;
|
|
1476
|
-
var ae = class n {
|
|
1477
|
-
static {
|
|
1478
|
-
__name(this, "n");
|
|
1479
|
-
}
|
|
1480
|
-
static {
|
|
1481
|
-
h(this, "MarkdownEngine");
|
|
1482
|
-
}
|
|
1483
|
-
static instance = new n();
|
|
1484
|
-
render(e, t) {
|
|
1485
|
-
let s = [], r = /* @__PURE__ */ new Map(), i = new Q({ gfm: true, breaks: t.breaks, renderer: { heading(a) {
|
|
1486
|
-
let p = this.parser.parseInline(a.tokens), u = n.plainText(p), m = n.unique(Ce(u, { as: "github" }), r), f = ve(a.depth + t.headingOffset, 1, Qt);
|
|
1487
|
-
return s.push({ level: f, text: u, id: m }), n.placed(`<h${f} id="${m}">${p}</h${f}>
|
|
1488
|
-
`, a);
|
|
1489
|
-
}, paragraph(a) {
|
|
1490
|
-
return n.placed(A.prototype.paragraph.call(this, a), a);
|
|
1491
|
-
}, listitem(a) {
|
|
1492
|
-
return n.placed(A.prototype.listitem.call(this, a), a);
|
|
1493
|
-
}, tablecell(a) {
|
|
1494
|
-
return n.placed(A.prototype.tablecell.call(this, a), a);
|
|
1495
|
-
} } }), l = i.lexer(e), o = t.places ? V.placesOf(l, e) : void 0, c = i.parser(l);
|
|
1496
|
-
if (typeof c != "string") throw new I("MarkdownEngine.render(): marked rendered asynchronously; drop its async extensions", { cause: { kind: "render" } });
|
|
1497
|
-
return { html: c, headings: s, ...o && { places: o } };
|
|
1498
|
-
}
|
|
1499
|
-
renderInline(e) {
|
|
1500
|
-
let t = new Q({ gfm: true }).parseInline(e, { async: false });
|
|
1501
|
-
if (typeof t != "string") throw new I("MarkdownEngine.renderInline(): rendered asynchronously", { cause: { kind: "render" } });
|
|
1502
|
-
return t;
|
|
1503
|
-
}
|
|
1504
|
-
static placed(e, t) {
|
|
1505
|
-
let s = V.placeOf(t);
|
|
1506
|
-
return s === void 0 ? e : e.replace(Wt, `$& ${Gt}="${s}"`);
|
|
1507
|
-
}
|
|
1508
|
-
static unique(e, t) {
|
|
1509
|
-
let s = t.get(e);
|
|
1510
|
-
return t.set(e, (s ?? -1) + 1), s === void 0 ? e : `${e}-${s + 1}`;
|
|
1511
|
-
}
|
|
1512
|
-
static plainText(e) {
|
|
1513
|
-
let t = document.createElement("template");
|
|
1514
|
-
return t.innerHTML = e, t.content.textContent ?? "";
|
|
1515
|
-
}
|
|
1516
|
-
}, Qt = 6, Gt = "data-ui-place", Wt = /^<[a-z][a-z0-9]*/;
|
|
1517
|
-
return Ne(Xt);
|
|
1518
|
-
})();
|
|
65
|
+
`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
|
|
66
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${y(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,text:t,tokens:s,autolink:r}){let i=r?y(t,!0):this.parser.parseInline(s),l=de(n);if(l===null)return i;n=y(l,r);let o='<a href="'+n+'"';return e&&(o+=' title="'+y(e)+'"'),o+=">"+i+"</a>",o}image({href:n,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let r=de(n);if(r===null)return y(t);n=r;let i=`<img src="${y(n)}" alt="${y(t)}"`;return e&&(i+=` title="${y(e)}"`),i+=">",i}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:y(n.text)}},le=class{static{h(this,"z")}strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},R=class J{static{h(this,"l")}options;renderer;textRenderer;constructor(e){this.options=e||v,this.options.renderer=this.options.renderer||new A,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new le}static parse(e,t){return new J(t).parse(e)}static parseInline(e,t){return new J(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let r=e[s];if(this.options.extensions?.renderers?.[r.type]){let l=r,o=this.options.extensions.renderers[l.type].call({parser:this},l);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(l.type)){t+=o||"";continue}}let i=r;switch(i.type){case"space":{t+=this.renderer.space(i);break}case"hr":{t+=this.renderer.hr(i);break}case"heading":{t+=this.renderer.heading(i);break}case"code":{t+=this.renderer.code(i);break}case"table":{t+=this.renderer.table(i);break}case"blockquote":{t+=this.renderer.blockquote(i);break}case"list":{t+=this.renderer.list(i);break}case"checkbox":{t+=this.renderer.checkbox(i);break}case"html":{t+=this.renderer.html(i);break}case"def":{t+=this.renderer.def(i);break}case"paragraph":{t+=this.renderer.paragraph(i);break}case"text":{t+=this.renderer.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(i.type)){s+=o||"";continue}}let l=i;switch(l.type){case"escape":{s+=t.text(l);break}case"html":{s+=t.html(l);break}case"link":{s+=t.link(l);break}case"image":{s+=t.image(l);break}case"checkbox":{s+=t.checkbox(l);break}case"strong":{s+=t.strong(l);break}case"em":{s+=t.em(l);break}case"codespan":{s+=t.codespan(l);break}case"br":{s+=t.br(l);break}case"del":{s+=t.del(l);break}case"text":{s+=t.text(l);break}default:{let o='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},q=class{static{h(this,"_")}options;block;constructor(n){this.options=n||v}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?S.lex:S.lexInline}provideParser(n=this.block){return n?R.parse:R.parseInline}},Q=class{static{h(this,"F")}defaults=ee();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=R;Renderer=A;TextRenderer=le;Lexer=S;Tokenizer=j;Hooks=q;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let r=s;for(let i of r.header)t=t.concat(this.walkTokens(i.tokens,e));for(let i of r.rows)for(let l of i)t=t.concat(this.walkTokens(l.tokens,e));break}case"list":{let r=s;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=s;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(i=>{let l=r[i].flat(1/0);t=t.concat(this.walkTokens(l,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let i=e.renderers[r.name];i?e.renderers[r.name]=function(...l){let o=r.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),o}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[r.level];i?i.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),s.extensions=e),t.renderer){let r=this.defaults.renderer||new A(this.defaults);for(let i in t.renderer){if(!(i in r))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,o=t.renderer[l],c=r[l];r[l]=(...a)=>{let p=o.apply(r,a);return p===!1&&(p=c.apply(r,a)),p||""}}s.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new j(this.defaults);for(let i in t.tokenizer){if(!(i in r))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,o=t.tokenizer[l],c=r[l];r[l]=(...a)=>{let p=o.apply(r,a);return p===!1&&(p=c.apply(r,a)),p}}s.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new q;for(let i in t.hooks){if(!(i in r))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,o=t.hooks[l],c=r[l];q.passThroughHooks.has(i)?r[l]=a=>{if(this.defaults.async&&q.passThroughHooksRespectAsync.has(i))return(async()=>{let u=await o.call(r,a);return c.call(r,u)})();let p=o.call(r,a);return c.call(r,p)}:r[l]=(...a)=>{if(this.defaults.async)return(async()=>{let u=await o.apply(r,a);return u===!1&&(u=await c.apply(r,a)),u})();let p=o.apply(r,a);return p===!1&&(p=c.apply(r,a)),p}}s.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),r&&(o=o.concat(r.call(this,l))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return S.lex(n,e??this.defaults)}parser(n,e){return R.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let s={...t},r={...this.defaults,...s},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=n),r.async)return(async()=>{let l=r.hooks?await r.hooks.preprocess(e):e,o=await(r.hooks?await r.hooks.provideLexer(n):n?S.lex:S.lexInline)(l,r),c=r.hooks?await r.hooks.processAllTokens(o):o;r.walkTokens&&await Promise.all(this.walkTokens(c,r.walkTokens));let a=await(r.hooks?await r.hooks.provideParser(n):n?R.parse:R.parseInline)(c,r);return r.hooks?await r.hooks.postprocess(a):a})().catch(i);try{r.hooks&&(e=r.hooks.preprocess(e));let l=(r.hooks?r.hooks.provideLexer(n):n?S.lex:S.lexInline)(e,r);r.hooks&&(l=r.hooks.processAllTokens(l)),r.walkTokens&&this.walkTokens(l,r.walkTokens);let o=(r.hooks?r.hooks.provideParser(n):n?R.parse:R.parseInline)(l,r);return r.hooks&&(o=r.hooks.postprocess(o)),o}catch(l){return i(l)}}}onError(n,e){return t=>{if(t.message+=`
|
|
67
|
+
Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+y(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},P=new Q;function b(n,e){return P.parse(n,e)}h(b,"k");b.options=b.setOptions=function(n){return P.setOptions(n),b.defaults=P.defaults,we(b.defaults),b};b.getDefaults=ee;b.defaults=v;function Ht(...n){return P.use(...n),b.defaults=P.defaults,we(b.defaults),b}h(Ht,"Pt");b.use=Ht;b.walkTokens=function(n,e){return P.walkTokens(n,e)};b.parseInline=P.parseInline;b.Parser=R;b.parser=R.parse;b.Renderer=A;b.TextRenderer=le;b.Lexer=S;b.lexer=S.lex;b.Tokenizer=j;b.Hooks=q;b.parse=b;var Jt=b.options,en=b.setOptions,tn=b.walkTokens,nn=b.parseInline;var rn=R.parse,sn=S.lex;function ve(n,e,t){return Math.min(t,Math.max(e,n))}h(ve,"clamp");function Ce(n,{as:e="id",fallback:t=""}={}){return(e==="github"?n.trim().toLowerCase().replace(/[^\p{L}\p{M}\p{N}\p{Pc}\- ]/gu,"").replace(/ /g,"-"):Vt(n.normalize("NFKD")).toLowerCase().replace(/['’]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""))||t}h(Ce,"slug");function Vt(n,{keep:e=""}={}){let t=e.normalize("NFC").toLowerCase();return n.normalize("NFC").replace(/\P{ASCII}/gu,s=>t.includes(s.toLowerCase())?s:s.normalize("NFD").replace(/\p{M}+/gu,""))}h(Vt,"withoutAccents");var G=class extends Error{static{h(this,"ApiError")}get status(){return this.cause?.response.status}get response(){return this.cause?.response}};G.prototype.name="ApiError";var Zt=["load","cross-origin","file-protocol","save","conflict","no-saver","render"],I=class n extends Error{static{h(this,"SourceError")}get kind(){return this.cause?.kind}get status(){return this.cause?.status}static kindFor(e,t){return e instanceof n&&e.kind||t}static isKind(e){return Zt.includes(e)}};I.prototype.name="SourceError";var V=class n{static{h(this,"MarkdownSource")}static placesOf(e,t){let s=[],r=h((l,o,c,a)=>{l[ze]=s.length,s.push({kind:o,start:c,end:a})},"add"),i=0;for(let l of e){let o=t.startsWith(l.raw,i)?i:t.indexOf(l.raw,i);if(o<0)break;n.visit(l,t,o,r),i=o+l.raw.length}return s}static placeOf(e){return e[ze]}static replace(e,t,s){let r=t.kind==="paragraph"?s.replace(/\s+$/,""):s.replace(/\s*\n\s*/g," ").trim(),i=t.kind==="cell"?r.replace(jt,"\\|"):r;return e.slice(0,t.start)+i+e.slice(t.end)}static visit(e,t,s,r){e.type==="paragraph"?n.paragraph(e,s,r):e.type==="heading"?n.heading(e,s,r):e.type==="table"?n.table(e,s,r):e.type==="list"&&n.list(e,t,s,s+e.raw.length,r)}static paragraph(e,t,s){let{from:r,to:i}=n.trimmed(e.raw);i>r&&s(e,"paragraph",t+r,t+i)}static heading(e,t,s){let r=Kt.exec(e.raw.split(`
|
|
68
|
+
`)[0]);if(r){let c=r[2];c&&s(e,"heading",t+r[1].length,t+r[1].length+c.length);return}let i=Ft.exec(e.raw);if(!i)return;let{from:l,to:o}=n.trimmed(e.raw.slice(0,i.index));o>l&&s(e,"heading",t+l,t+o)}static table(e,t,s){let r=n.linesOf(e.raw),i=[e.header,null,...e.rows];for(let[l,o]of r.entries()){let c=i[l];if(c)for(let[a,p]of n.cellsOf(o.text).entries()){let u=c[a];u&&s(u,"cell",t+o.start+p.from,t+o.start+p.to)}}}static list(e,t,s,r,i){let l=s;for(let o of e.items){let c=o.raw.split(`
|
|
69
|
+
`)[0].trim(),a=t.indexOf(c,l);if(a<0||a>=r)return;l=a+c.length;let p=o.tokens.filter(d=>d.type!=="space"&&d.type!=="checkbox"),[u,...m]=p,f=Ut.exec(c),k=!!u&&!u.raw.trim().includes(`
|
|
70
|
+
`),w=m.every(d=>d.type==="list");if(f&&k&&w&&(u.type==="text"||u.type==="paragraph")){let d=c.slice(f[0].length).replace(/\s+$/,"");d&&i(o,"item",a+f[0].length,a+f[0].length+d.length)}for(let d of m){if(d.type!=="list")break;n.list(d,t,l,r,i)}}}static trimmed(e){return{from:e.length-e.trimStart().length,to:e.trimEnd().length}}static linesOf(e){let t=[],s=0;for(let r of e.split(`
|
|
71
|
+
`))r.trim()&&t.push({text:r,start:s}),s+=r.length+1;return t}static cellsOf(e){let t=[];for(let i=0;i<e.length;i++)e[i]==="\\"?i++:e[i]==="|"&&t.push(i);let s=[-1,...t,e.length],r=[];for(let i=0;i<s.length-1;i++){let l=s[i]+1,o=s[i+1],c=e.slice(l,o);if((i===0||i===s.length-2)&&!c.trim()&&t.length)continue;let p=c.length-c.trimStart().length,u=c.trim().length;r.push(u?{from:l+p,to:l+p+u}:{from:l+Math.min(1,c.length),to:l+Math.min(1,c.length)})}return r}},ze="uiPlace",Kt=/^( {0,3}#{1,6}(?:[ \t]+|$))(.*?)(?:[ \t]+#+)?[ \t]*$/,Ft=/\n {0,3}(?:=+|-+)[ \t]*\n*$/,Ut=/^(?:[*+-]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,jt=/(?<!\\)\|/g;var ae=class n{static{h(this,"MarkdownEngine")}static instance=new n;render(e,t){let s=[],r=new Map,i=new Q({gfm:!0,breaks:t.breaks,renderer:{heading(a){let p=this.parser.parseInline(a.tokens),u=n.plainText(p),m=n.unique(Ce(u,{as:"github"}),r),f=ve(a.depth+t.headingOffset,1,Qt);return s.push({level:f,text:u,id:m}),n.placed(`<h${f} id="${m}">${p}</h${f}>
|
|
72
|
+
`,a)},paragraph(a){return n.placed(A.prototype.paragraph.call(this,a),a)},listitem(a){return n.placed(A.prototype.listitem.call(this,a),a)},tablecell(a){return n.placed(A.prototype.tablecell.call(this,a),a)}}}),l=i.lexer(e),o=t.places?V.placesOf(l,e):void 0,c=i.parser(l);if(typeof c!="string")throw new I("MarkdownEngine.render(): marked rendered asynchronously; drop its async extensions",{cause:{kind:"render"}});return{html:c,headings:s,...o&&{places:o}}}renderInline(e){let t=new Q({gfm:!0}).parseInline(e,{async:!1});if(typeof t!="string")throw new I("MarkdownEngine.renderInline(): rendered asynchronously",{cause:{kind:"render"}});return t}static placed(e,t){let s=V.placeOf(t);return s===void 0?e:e.replace(Wt,`$& ${Gt}="${s}"`)}static unique(e,t){let s=t.get(e);return t.set(e,(s??-1)+1),s===void 0?e:`${e}-${s+1}`}static plainText(e){let t=document.createElement("template");return t.innerHTML=e,t.content.textContent??""}},Qt=6,Gt="data-ui-place",Wt=/^<[a-z][a-z0-9]*/;return Ne(Xt);})();
|