@syntrologie/runtime-sdk 2.10.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CAPABILITIES.md +176 -117
- package/README.md +2 -0
- package/dist/actions/schema.d.ts +7 -7
- package/dist/actions/schema.js +1 -1
- package/dist/actions/types.d.ts +1 -1
- package/dist/actions/validation-core.d.ts +24 -0
- package/dist/actions/validation-rules.d.ts +74 -0
- package/dist/actions/validation.d.ts +5 -11
- package/dist/bootstrap-init.d.ts +33 -0
- package/dist/bootstrap-runtime.d.ts +7 -0
- package/dist/bootstrap-types.d.ts +90 -0
- package/dist/bootstrap.d.ts +17 -83
- package/dist/{chunk-OIDBMIRB.js → chunk-J2LGX2PV.js} +1282 -488
- package/dist/chunk-J2LGX2PV.js.map +7 -0
- package/dist/{chunk-R5DNAIRI.js → chunk-L6RJMBR2.js} +2 -2
- package/dist/{chunk-R5DNAIRI.js.map → chunk-L6RJMBR2.js.map} +2 -2
- package/dist/events/EventBus.d.ts +27 -1
- package/dist/events/history.d.ts +9 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/normalizers/posthog.d.ts +4 -50
- package/dist/events/types.d.ts +30 -23
- package/dist/events/validation.d.ts +7 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1125 -2027
- package/dist/index.js.map +4 -4
- package/dist/overlays/runtime/overlay/overlay-runner.d.ts +4 -0
- package/dist/overlays/runtime/overlay/overlay-state.d.ts +21 -0
- package/dist/overlays/types.d.ts +3 -1
- package/dist/react.js +4 -2
- package/dist/react.js.map +2 -2
- package/dist/smart-canvas.esm.js +92 -108
- package/dist/smart-canvas.esm.js.map +4 -4
- package/dist/smart-canvas.js +5225 -5012
- package/dist/smart-canvas.js.map +4 -4
- package/dist/smart-canvas.min.js +92 -108
- package/dist/smart-canvas.min.js.map +4 -4
- package/dist/telemetry/adapters/posthog.d.ts +30 -4
- package/dist/test/setup.d.ts +1 -0
- package/dist/token.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/package.json +23 -28
- package/schema/canvas-config.schema.json +1 -1
- package/scripts/syntroReactPlugin.mjs +3 -0
- package/scripts/validate-config.mjs +42 -0
- package/dist/chunk-OIDBMIRB.js.map +0 -7
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
DEFAULT_TTL,
|
|
8
8
|
EVENT_SCHEMA_VERSION,
|
|
9
9
|
EventBus,
|
|
10
|
+
EventHistory,
|
|
10
11
|
ExecutorRegistry,
|
|
11
12
|
MAX_VISIBLE_TOASTS,
|
|
12
13
|
NavigationMonitor,
|
|
@@ -99,8 +100,10 @@ import {
|
|
|
99
100
|
useViewportContext,
|
|
100
101
|
validateAction,
|
|
101
102
|
validateActions,
|
|
103
|
+
validateEventName,
|
|
104
|
+
validateProps,
|
|
102
105
|
widgetRegistry
|
|
103
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-J2LGX2PV.js";
|
|
104
107
|
import {
|
|
105
108
|
AddClassZ,
|
|
106
109
|
AnchorIdZ,
|
|
@@ -134,7 +137,7 @@ import {
|
|
|
134
137
|
WaitZ,
|
|
135
138
|
WidgetConfigZ,
|
|
136
139
|
coreActionStepSchemas
|
|
137
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-L6RJMBR2.js";
|
|
138
141
|
import "./chunk-XDYJ64IN.js";
|
|
139
142
|
import {
|
|
140
143
|
ActivationConfigZ,
|
|
@@ -257,8 +260,8 @@ var nextId = 0;
|
|
|
257
260
|
function generateId() {
|
|
258
261
|
return `msg-${Date.now()}-${++nextId}`;
|
|
259
262
|
}
|
|
260
|
-
function useChat(
|
|
261
|
-
const { backendUrl, tileId, runtime: runtime7, greeting, maxHistory = 20, mlflowRunId, config } =
|
|
263
|
+
function useChat(options) {
|
|
264
|
+
const { backendUrl, tileId, runtime: runtime7, greeting, maxHistory = 20, mlflowRunId, config } = options;
|
|
262
265
|
const [messages, setMessages] = useState(() => {
|
|
263
266
|
if (greeting) {
|
|
264
267
|
return [
|
|
@@ -291,9 +294,9 @@ function useChat(options2) {
|
|
|
291
294
|
setIsLoading(true);
|
|
292
295
|
try {
|
|
293
296
|
const currentMessages = [...messages, userMessage];
|
|
294
|
-
const historySlice = currentMessages.slice(-maxHistory).map((
|
|
295
|
-
role:
|
|
296
|
-
content:
|
|
297
|
+
const historySlice = currentMessages.slice(-maxHistory).map((m2) => ({
|
|
298
|
+
role: m2.role,
|
|
299
|
+
content: m2.text
|
|
297
300
|
}));
|
|
298
301
|
const response = await sendMessage(backendUrl, {
|
|
299
302
|
message: trimmed,
|
|
@@ -632,2186 +635,1224 @@ var executorDefinitions = [
|
|
|
632
635
|
import { jsx as _jsx2, jsxs as _jsxs2 } from "react/jsx-runtime";
|
|
633
636
|
|
|
634
637
|
// ../../node_modules/marked/lib/marked.esm.js
|
|
635
|
-
function
|
|
636
|
-
return {
|
|
637
|
-
async: false,
|
|
638
|
-
breaks: false,
|
|
639
|
-
extensions: null,
|
|
640
|
-
gfm: true,
|
|
641
|
-
hooks: null,
|
|
642
|
-
pedantic: false,
|
|
643
|
-
renderer: null,
|
|
644
|
-
silent: false,
|
|
645
|
-
tokenizer: null,
|
|
646
|
-
walkTokens: null
|
|
647
|
-
};
|
|
638
|
+
function M() {
|
|
639
|
+
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
648
640
|
}
|
|
649
|
-
var
|
|
650
|
-
function
|
|
651
|
-
|
|
641
|
+
var T = M();
|
|
642
|
+
function G(u3) {
|
|
643
|
+
T = u3;
|
|
652
644
|
}
|
|
653
|
-
var
|
|
654
|
-
function
|
|
655
|
-
let
|
|
656
|
-
|
|
657
|
-
replace
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
source = source.replace(name, valSource);
|
|
661
|
-
return obj;
|
|
662
|
-
},
|
|
663
|
-
getRegex: () => {
|
|
664
|
-
return new RegExp(source, opt);
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
return obj;
|
|
645
|
+
var _ = { exec: () => null };
|
|
646
|
+
function k(u3, e = "") {
|
|
647
|
+
let t = typeof u3 == "string" ? u3 : u3.source, n = { replace: (r, i) => {
|
|
648
|
+
let s = typeof i == "string" ? i : i.source;
|
|
649
|
+
return s = s.replace(m.caret, "$1"), t = t.replace(r, s), n;
|
|
650
|
+
}, getRegex: () => new RegExp(t, e) };
|
|
651
|
+
return n;
|
|
668
652
|
}
|
|
669
|
-
var
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
endingHash: /#$/,
|
|
675
|
-
startingSpaceChar: /^ /,
|
|
676
|
-
endingSpaceChar: / $/,
|
|
677
|
-
nonSpaceChar: /[^ ]/,
|
|
678
|
-
newLineCharGlobal: /\n/g,
|
|
679
|
-
tabCharGlobal: /\t/g,
|
|
680
|
-
multipleSpaceGlobal: /\s+/g,
|
|
681
|
-
blankLine: /^[ \t]*$/,
|
|
682
|
-
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
683
|
-
blockquoteStart: /^ {0,3}>/,
|
|
684
|
-
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
685
|
-
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
686
|
-
listReplaceTabs: /^\t+/,
|
|
687
|
-
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
688
|
-
listIsTask: /^\[[ xX]\] /,
|
|
689
|
-
listReplaceTask: /^\[[ xX]\] +/,
|
|
690
|
-
anyLine: /\n.*\n/,
|
|
691
|
-
hrefBrackets: /^<(.*)>$/,
|
|
692
|
-
tableDelimiter: /[:|]/,
|
|
693
|
-
tableAlignChars: /^\||\| *$/g,
|
|
694
|
-
tableRowBlankLine: /\n[ \t]*$/,
|
|
695
|
-
tableAlignRight: /^ *-+: *$/,
|
|
696
|
-
tableAlignCenter: /^ *:-+: *$/,
|
|
697
|
-
tableAlignLeft: /^ *:-+ *$/,
|
|
698
|
-
startATag: /^<a /i,
|
|
699
|
-
endATag: /^<\/a>/i,
|
|
700
|
-
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
701
|
-
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
702
|
-
startAngleBracket: /^</,
|
|
703
|
-
endAngleBracket: />$/,
|
|
704
|
-
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
705
|
-
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
706
|
-
escapeTest: /[&<>"']/,
|
|
707
|
-
escapeReplace: /[&<>"']/g,
|
|
708
|
-
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
709
|
-
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
710
|
-
unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
|
|
711
|
-
caret: /(^|[^\[])\^/g,
|
|
712
|
-
percentDecode: /%25/g,
|
|
713
|
-
findPipe: /\|/g,
|
|
714
|
-
splitPipe: / \|/,
|
|
715
|
-
slashPipe: /\\\|/g,
|
|
716
|
-
carriageReturn: /\r\n|\r/g,
|
|
717
|
-
spaceLine: /^ +$/gm,
|
|
718
|
-
notSpaceStart: /^\S*/,
|
|
719
|
-
endingNewline: /\n$/,
|
|
720
|
-
listItemRegex: (bull) => new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
721
|
-
nextBulletRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
722
|
-
hrRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
|
|
723
|
-
fencesBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`),
|
|
724
|
-
headingBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`),
|
|
725
|
-
htmlBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
726
|
-
};
|
|
727
|
-
var newline = /^(?:[ \t]*(?:\n|$))+/;
|
|
728
|
-
var blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
729
|
-
var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
730
|
-
var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
731
|
-
var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
732
|
-
var bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
733
|
-
var lheadingCore = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
734
|
-
var lheading = edit(lheadingCore).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
|
|
735
|
-
var lheadingGfm = edit(lheadingCore).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
|
|
736
|
-
var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
737
|
-
var blockText = /^[^\n]+/;
|
|
738
|
-
var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
739
|
-
var def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
740
|
-
var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
|
|
741
|
-
var _tag = "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";
|
|
742
|
-
var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
743
|
-
var html = edit(
|
|
744
|
-
"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))",
|
|
745
|
-
"i"
|
|
746
|
-
).replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
747
|
-
var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
748
|
-
var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
|
|
749
|
-
var blockNormal = {
|
|
750
|
-
blockquote,
|
|
751
|
-
code: blockCode,
|
|
752
|
-
def,
|
|
753
|
-
fences,
|
|
754
|
-
heading,
|
|
755
|
-
hr,
|
|
756
|
-
html,
|
|
757
|
-
lheading,
|
|
758
|
-
list,
|
|
759
|
-
newline,
|
|
760
|
-
paragraph,
|
|
761
|
-
table: noopTest,
|
|
762
|
-
text: blockText
|
|
763
|
-
};
|
|
764
|
-
var gfmTable = edit(
|
|
765
|
-
"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
|
|
766
|
-
).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
|
767
|
-
var blockGfm = {
|
|
768
|
-
...blockNormal,
|
|
769
|
-
lheading: lheadingGfm,
|
|
770
|
-
table: gfmTable,
|
|
771
|
-
paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex()
|
|
772
|
-
};
|
|
773
|
-
var blockPedantic = {
|
|
774
|
-
...blockNormal,
|
|
775
|
-
html: edit(
|
|
776
|
-
`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
|
|
777
|
-
).replace("comment", _comment).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(),
|
|
778
|
-
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
779
|
-
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
780
|
-
fences: noopTest,
|
|
781
|
-
// fences not supported
|
|
782
|
-
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
783
|
-
paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
784
|
-
};
|
|
785
|
-
var escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
786
|
-
var inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
787
|
-
var br = /^( {2,}|\\)\n(?!\s*$)/;
|
|
788
|
-
var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
789
|
-
var _punctuation = /[\p{P}\p{S}]/u;
|
|
790
|
-
var _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
|
|
791
|
-
var _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
|
|
792
|
-
var punctuation = edit(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, _punctuationOrSpace).getRegex();
|
|
793
|
-
var _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u;
|
|
794
|
-
var _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
|
|
795
|
-
var _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
796
|
-
var blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
|
|
797
|
-
var emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
|
|
798
|
-
var emStrongLDelim = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuation).getRegex();
|
|
799
|
-
var emStrongLDelimGfm = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuationGfmStrongEm).getRegex();
|
|
800
|
-
var emStrongRDelimAstCore = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
801
|
-
var emStrongRDelimAst = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
|
|
802
|
-
var emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm).replace(/punct/g, _punctuationGfmStrongEm).getRegex();
|
|
803
|
-
var emStrongRDelimUnd = edit(
|
|
804
|
-
"^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
|
|
805
|
-
"gu"
|
|
806
|
-
).replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
|
|
807
|
-
var anyPunctuation = edit(/\\(punct)/, "gu").replace(/punct/g, _punctuation).getRegex();
|
|
808
|
-
var autolink = edit(/^<(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();
|
|
809
|
-
var _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
|
|
810
|
-
var tag = edit(
|
|
811
|
-
"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
|
|
812
|
-
).replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
813
|
-
var _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
814
|
-
var link = edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
815
|
-
var reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
|
|
816
|
-
var nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
|
|
817
|
-
var reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
|
|
818
|
-
var inlineNormal = {
|
|
819
|
-
_backpedal: noopTest,
|
|
820
|
-
// only used for GFM url
|
|
821
|
-
anyPunctuation,
|
|
822
|
-
autolink,
|
|
823
|
-
blockSkip,
|
|
824
|
-
br,
|
|
825
|
-
code: inlineCode,
|
|
826
|
-
del: noopTest,
|
|
827
|
-
emStrongLDelim,
|
|
828
|
-
emStrongRDelimAst,
|
|
829
|
-
emStrongRDelimUnd,
|
|
830
|
-
escape,
|
|
831
|
-
link,
|
|
832
|
-
nolink,
|
|
833
|
-
punctuation,
|
|
834
|
-
reflink,
|
|
835
|
-
reflinkSearch,
|
|
836
|
-
tag,
|
|
837
|
-
text: inlineText,
|
|
838
|
-
url: noopTest
|
|
839
|
-
};
|
|
840
|
-
var inlinePedantic = {
|
|
841
|
-
...inlineNormal,
|
|
842
|
-
link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
|
|
843
|
-
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
|
|
844
|
-
};
|
|
845
|
-
var inlineGfm = {
|
|
846
|
-
...inlineNormal,
|
|
847
|
-
emStrongRDelimAst: emStrongRDelimAstGfm,
|
|
848
|
-
emStrongLDelim: emStrongLDelimGfm,
|
|
849
|
-
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
850
|
-
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
851
|
-
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
852
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
853
|
-
};
|
|
854
|
-
var inlineBreaks = {
|
|
855
|
-
...inlineGfm,
|
|
856
|
-
br: edit(br).replace("{2,}", "*").getRegex(),
|
|
857
|
-
text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
858
|
-
};
|
|
859
|
-
var block = {
|
|
860
|
-
normal: blockNormal,
|
|
861
|
-
gfm: blockGfm,
|
|
862
|
-
pedantic: blockPedantic
|
|
863
|
-
};
|
|
864
|
-
var inline = {
|
|
865
|
-
normal: inlineNormal,
|
|
866
|
-
gfm: inlineGfm,
|
|
867
|
-
breaks: inlineBreaks,
|
|
868
|
-
pedantic: inlinePedantic
|
|
869
|
-
};
|
|
870
|
-
var escapeReplacements = {
|
|
871
|
-
"&": "&",
|
|
872
|
-
"<": "<",
|
|
873
|
-
">": ">",
|
|
874
|
-
'"': """,
|
|
875
|
-
"'": "'"
|
|
876
|
-
};
|
|
877
|
-
var getEscapeReplacement = (ch) => escapeReplacements[ch];
|
|
878
|
-
function escape2(html2, encode) {
|
|
879
|
-
if (encode) {
|
|
880
|
-
if (other.escapeTest.test(html2)) {
|
|
881
|
-
return html2.replace(other.escapeReplace, getEscapeReplacement);
|
|
882
|
-
}
|
|
883
|
-
} else {
|
|
884
|
-
if (other.escapeTestNoEncode.test(html2)) {
|
|
885
|
-
return html2.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
|
|
886
|
-
}
|
|
653
|
+
var Re = (() => {
|
|
654
|
+
try {
|
|
655
|
+
return !!new RegExp("(?<=1)(?<!1)");
|
|
656
|
+
} catch {
|
|
657
|
+
return false;
|
|
887
658
|
}
|
|
888
|
-
|
|
659
|
+
})();
|
|
660
|
+
var m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (u3) => new RegExp(`^( {0,3}${u3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}#`), htmlBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (u3) => new RegExp(`^ {0,${Math.min(3, u3 - 1)}}>`) };
|
|
661
|
+
var Te = /^(?:[ \t]*(?:\n|$))+/;
|
|
662
|
+
var Oe = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
663
|
+
var we = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
664
|
+
var A = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
665
|
+
var ye = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
666
|
+
var N = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
|
|
667
|
+
var re = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
668
|
+
var se = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
|
|
669
|
+
var Pe = k(re).replace(/bull/g, N).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
|
|
670
|
+
var Q = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
671
|
+
var Se = /^[^\n]+/;
|
|
672
|
+
var j = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
|
|
673
|
+
var $e = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", j).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
674
|
+
var _e = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex();
|
|
675
|
+
var q = "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";
|
|
676
|
+
var F = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
677
|
+
var Le = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", F).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
678
|
+
var ie = k(Q).replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex();
|
|
679
|
+
var Me = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ie).getRegex();
|
|
680
|
+
var U = { blockquote: Me, code: Oe, def: $e, fences: we, heading: ye, hr: A, html: Le, lheading: se, list: _e, newline: Te, paragraph: ie, table: _, text: Se };
|
|
681
|
+
var te = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex();
|
|
682
|
+
var ze = { ...U, lheading: Pe, table: te, paragraph: k(Q).replace("hr", A).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", te).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex() };
|
|
683
|
+
var Ee = { ...U, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", F).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: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(Q).replace("hr", A).replace("heading", ` *#{1,6} *[^
|
|
684
|
+
]`).replace("lheading", se).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
|
|
685
|
+
var Ie = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
686
|
+
var Ae = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
687
|
+
var oe = /^( {2,}|\\)\n(?!\s*$)/;
|
|
688
|
+
var Ce = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
689
|
+
var v = /[\p{P}\p{S}]/u;
|
|
690
|
+
var K = /[\s\p{P}\p{S}]/u;
|
|
691
|
+
var ae = /[^\s\p{P}\p{S}]/u;
|
|
692
|
+
var Be = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex();
|
|
693
|
+
var le = /(?!~)[\p{P}\p{S}]/u;
|
|
694
|
+
var De = /(?!~)[\s\p{P}\p{S}]/u;
|
|
695
|
+
var qe = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
696
|
+
var ue = /(?![*_])[\p{P}\p{S}]/u;
|
|
697
|
+
var ve = /(?![*_])[\s\p{P}\p{S}]/u;
|
|
698
|
+
var He = /(?:[^\s\p{P}\p{S}]|[*_])/u;
|
|
699
|
+
var Ge = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Re ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
|
|
700
|
+
var pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
|
|
701
|
+
var Ze = k(pe, "u").replace(/punct/g, v).getRegex();
|
|
702
|
+
var Ne = k(pe, "u").replace(/punct/g, le).getRegex();
|
|
703
|
+
var ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
704
|
+
var Qe = k(ce, "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, v).getRegex();
|
|
705
|
+
var je = k(ce, "gu").replace(/notPunctSpace/g, qe).replace(/punctSpace/g, De).replace(/punct/g, le).getRegex();
|
|
706
|
+
var Fe = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ae).replace(/punctSpace/g, K).replace(/punct/g, v).getRegex();
|
|
707
|
+
var Ue = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, ue).getRegex();
|
|
708
|
+
var Ke = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
|
|
709
|
+
var We = k(Ke, "gu").replace(/notPunctSpace/g, He).replace(/punctSpace/g, ve).replace(/punct/g, ue).getRegex();
|
|
710
|
+
var Xe = k(/\\(punct)/, "gu").replace(/punct/g, v).getRegex();
|
|
711
|
+
var Je = k(/^<(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();
|
|
712
|
+
var Ve = k(F).replace("(?:-->|$)", "-->").getRegex();
|
|
713
|
+
var Ye = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Ve).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
714
|
+
var D = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/;
|
|
715
|
+
var et = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", D).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
716
|
+
var he = k(/^!?\[(label)\]\[(ref)\]/).replace("label", D).replace("ref", j).getRegex();
|
|
717
|
+
var ke = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", j).getRegex();
|
|
718
|
+
var tt = k("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", ke).getRegex();
|
|
719
|
+
var ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
|
|
720
|
+
var W = { _backpedal: _, anyPunctuation: Xe, autolink: Je, blockSkip: Ge, br: oe, code: Ae, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Ze, emStrongRDelimAst: Qe, emStrongRDelimUnd: Fe, escape: Ie, link: et, nolink: ke, punctuation: Be, reflink: he, reflinkSearch: tt, tag: Ye, text: Ce, url: _ };
|
|
721
|
+
var nt = { ...W, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", D).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", D).getRegex() };
|
|
722
|
+
var Z = { ...W, emStrongRDelimAst: je, emStrongLDelim: Ne, delLDelim: Ue, delRDelim: We, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex() };
|
|
723
|
+
var rt = { ...Z, br: k(oe).replace("{2,}", "*").getRegex(), text: k(Z.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
|
|
724
|
+
var C = { normal: U, gfm: ze, pedantic: Ee };
|
|
725
|
+
var z = { normal: W, gfm: Z, breaks: rt, pedantic: nt };
|
|
726
|
+
var st = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
727
|
+
var de = (u3) => st[u3];
|
|
728
|
+
function O(u3, e) {
|
|
729
|
+
if (e) {
|
|
730
|
+
if (m.escapeTest.test(u3)) return u3.replace(m.escapeReplace, de);
|
|
731
|
+
} else if (m.escapeTestNoEncode.test(u3)) return u3.replace(m.escapeReplaceNoEncode, de);
|
|
732
|
+
return u3;
|
|
889
733
|
}
|
|
890
|
-
function
|
|
734
|
+
function X(u3) {
|
|
891
735
|
try {
|
|
892
|
-
|
|
736
|
+
u3 = encodeURI(u3).replace(m.percentDecode, "%");
|
|
893
737
|
} catch {
|
|
894
738
|
return null;
|
|
895
739
|
}
|
|
896
|
-
return
|
|
740
|
+
return u3;
|
|
897
741
|
}
|
|
898
|
-
function
|
|
742
|
+
function J(u3, e) {
|
|
899
743
|
var _a2;
|
|
900
|
-
|
|
901
|
-
let
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
}), cells = row.split(other.splitPipe);
|
|
910
|
-
let i = 0;
|
|
911
|
-
if (!cells[0].trim()) {
|
|
912
|
-
cells.shift();
|
|
913
|
-
}
|
|
914
|
-
if (cells.length > 0 && !((_a2 = cells.at(-1)) == null ? void 0 : _a2.trim())) {
|
|
915
|
-
cells.pop();
|
|
916
|
-
}
|
|
917
|
-
if (count) {
|
|
918
|
-
if (cells.length > count) {
|
|
919
|
-
cells.splice(count);
|
|
920
|
-
} else {
|
|
921
|
-
while (cells.length < count) cells.push("");
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
for (; i < cells.length; i++) {
|
|
925
|
-
cells[i] = cells[i].trim().replace(other.slashPipe, "|");
|
|
926
|
-
}
|
|
927
|
-
return cells;
|
|
744
|
+
let t = u3.replace(m.findPipe, (i, s, a) => {
|
|
745
|
+
let o = false, l = s;
|
|
746
|
+
for (; --l >= 0 && a[l] === "\\"; ) o = !o;
|
|
747
|
+
return o ? "|" : " |";
|
|
748
|
+
}), n = t.split(m.splitPipe), r = 0;
|
|
749
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !((_a2 = n.at(-1)) == null ? void 0 : _a2.trim()) && n.pop(), e) if (n.length > e) n.splice(e);
|
|
750
|
+
else for (; n.length < e; ) n.push("");
|
|
751
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(m.slashPipe, "|");
|
|
752
|
+
return n;
|
|
928
753
|
}
|
|
929
|
-
function
|
|
930
|
-
|
|
931
|
-
if (
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
suffLen++;
|
|
941
|
-
} else {
|
|
942
|
-
break;
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
return str.slice(0, l - suffLen);
|
|
754
|
+
function E(u3, e, t) {
|
|
755
|
+
let n = u3.length;
|
|
756
|
+
if (n === 0) return "";
|
|
757
|
+
let r = 0;
|
|
758
|
+
for (; r < n; ) {
|
|
759
|
+
let i = u3.charAt(n - r - 1);
|
|
760
|
+
if (i === e && !t) r++;
|
|
761
|
+
else if (i !== e && t) r++;
|
|
762
|
+
else break;
|
|
763
|
+
}
|
|
764
|
+
return u3.slice(0, n - r);
|
|
946
765
|
}
|
|
947
|
-
function
|
|
948
|
-
if (
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
i++;
|
|
955
|
-
} else if (str[i] === b[0]) {
|
|
956
|
-
level++;
|
|
957
|
-
} else if (str[i] === b[1]) {
|
|
958
|
-
level--;
|
|
959
|
-
if (level < 0) {
|
|
960
|
-
return i;
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
if (level > 0) {
|
|
965
|
-
return -2;
|
|
966
|
-
}
|
|
967
|
-
return -1;
|
|
766
|
+
function ge(u3, e) {
|
|
767
|
+
if (u3.indexOf(e[1]) === -1) return -1;
|
|
768
|
+
let t = 0;
|
|
769
|
+
for (let n = 0; n < u3.length; n++) if (u3[n] === "\\") n++;
|
|
770
|
+
else if (u3[n] === e[0]) t++;
|
|
771
|
+
else if (u3[n] === e[1] && (t--, t < 0)) return n;
|
|
772
|
+
return t > 0 ? -2 : -1;
|
|
968
773
|
}
|
|
969
|
-
function
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
raw,
|
|
977
|
-
href,
|
|
978
|
-
title,
|
|
979
|
-
text,
|
|
980
|
-
tokens: lexer2.inlineTokens(text)
|
|
981
|
-
};
|
|
982
|
-
lexer2.state.inLink = false;
|
|
983
|
-
return token;
|
|
774
|
+
function fe(u3, e = 0) {
|
|
775
|
+
let t = e, n = "";
|
|
776
|
+
for (let r of u3) if (r === " ") {
|
|
777
|
+
let i = 4 - t % 4;
|
|
778
|
+
n += " ".repeat(i), t += i;
|
|
779
|
+
} else n += r, t++;
|
|
780
|
+
return n;
|
|
984
781
|
}
|
|
985
|
-
function
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
return
|
|
1001
|
-
}).join(
|
|
782
|
+
function me(u3, e, t, n, r) {
|
|
783
|
+
let i = e.href, s = e.title || null, a = u3[1].replace(r.other.outputLinkReplace, "$1");
|
|
784
|
+
n.state.inLink = true;
|
|
785
|
+
let o = { type: u3[0].charAt(0) === "!" ? "image" : "link", raw: t, href: i, title: s, text: a, tokens: n.inlineTokens(a) };
|
|
786
|
+
return n.state.inLink = false, o;
|
|
787
|
+
}
|
|
788
|
+
function it(u3, e, t) {
|
|
789
|
+
let n = u3.match(t.other.indentCodeCompensation);
|
|
790
|
+
if (n === null) return e;
|
|
791
|
+
let r = n[1];
|
|
792
|
+
return e.split(`
|
|
793
|
+
`).map((i) => {
|
|
794
|
+
let s = i.match(t.other.beginningSpace);
|
|
795
|
+
if (s === null) return i;
|
|
796
|
+
let [a] = s;
|
|
797
|
+
return a.length >= r.length ? i.slice(r.length) : i;
|
|
798
|
+
}).join(`
|
|
799
|
+
`);
|
|
1002
800
|
}
|
|
1003
|
-
var
|
|
1004
|
-
|
|
1005
|
-
constructor(options2) {
|
|
801
|
+
var w = class {
|
|
802
|
+
constructor(e) {
|
|
1006
803
|
__publicField(this, "options");
|
|
1007
804
|
__publicField(this, "rules");
|
|
1008
|
-
// set by the lexer
|
|
1009
805
|
__publicField(this, "lexer");
|
|
1010
|
-
this.options =
|
|
1011
|
-
}
|
|
1012
|
-
space(
|
|
1013
|
-
|
|
1014
|
-
if (
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
blockquote(src) {
|
|
1077
|
-
const cap = this.rules.block.blockquote.exec(src);
|
|
1078
|
-
if (cap) {
|
|
1079
|
-
let lines = rtrim(cap[0], "\n").split("\n");
|
|
1080
|
-
let raw = "";
|
|
1081
|
-
let text = "";
|
|
1082
|
-
const tokens = [];
|
|
1083
|
-
while (lines.length > 0) {
|
|
1084
|
-
let inBlockquote = false;
|
|
1085
|
-
const currentLines = [];
|
|
1086
|
-
let i;
|
|
1087
|
-
for (i = 0; i < lines.length; i++) {
|
|
1088
|
-
if (this.rules.other.blockquoteStart.test(lines[i])) {
|
|
1089
|
-
currentLines.push(lines[i]);
|
|
1090
|
-
inBlockquote = true;
|
|
1091
|
-
} else if (!inBlockquote) {
|
|
1092
|
-
currentLines.push(lines[i]);
|
|
1093
|
-
} else {
|
|
1094
|
-
break;
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
lines = lines.slice(i);
|
|
1098
|
-
const currentRaw = currentLines.join("\n");
|
|
1099
|
-
const currentText = currentRaw.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
1100
|
-
raw = raw ? `${raw}
|
|
1101
|
-
${currentRaw}` : currentRaw;
|
|
1102
|
-
text = text ? `${text}
|
|
1103
|
-
${currentText}` : currentText;
|
|
1104
|
-
const top = this.lexer.state.top;
|
|
1105
|
-
this.lexer.state.top = true;
|
|
1106
|
-
this.lexer.blockTokens(currentText, tokens, true);
|
|
1107
|
-
this.lexer.state.top = top;
|
|
1108
|
-
if (lines.length === 0) {
|
|
806
|
+
this.options = e || T;
|
|
807
|
+
}
|
|
808
|
+
space(e) {
|
|
809
|
+
let t = this.rules.block.newline.exec(e);
|
|
810
|
+
if (t && t[0].length > 0) return { type: "space", raw: t[0] };
|
|
811
|
+
}
|
|
812
|
+
code(e) {
|
|
813
|
+
let t = this.rules.block.code.exec(e);
|
|
814
|
+
if (t) {
|
|
815
|
+
let n = t[0].replace(this.rules.other.codeRemoveIndent, "");
|
|
816
|
+
return { type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : E(n, `
|
|
817
|
+
`) };
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
fences(e) {
|
|
821
|
+
let t = this.rules.block.fences.exec(e);
|
|
822
|
+
if (t) {
|
|
823
|
+
let n = t[0], r = it(n, t[3] || "", this.rules);
|
|
824
|
+
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: r };
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
heading(e) {
|
|
828
|
+
let t = this.rules.block.heading.exec(e);
|
|
829
|
+
if (t) {
|
|
830
|
+
let n = t[2].trim();
|
|
831
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
832
|
+
let r = E(n, "#");
|
|
833
|
+
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
834
|
+
}
|
|
835
|
+
return { type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
hr(e) {
|
|
839
|
+
let t = this.rules.block.hr.exec(e);
|
|
840
|
+
if (t) return { type: "hr", raw: E(t[0], `
|
|
841
|
+
`) };
|
|
842
|
+
}
|
|
843
|
+
blockquote(e) {
|
|
844
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
845
|
+
if (t) {
|
|
846
|
+
let n = E(t[0], `
|
|
847
|
+
`).split(`
|
|
848
|
+
`), r = "", i = "", s = [];
|
|
849
|
+
for (; n.length > 0; ) {
|
|
850
|
+
let a = false, o = [], l;
|
|
851
|
+
for (l = 0; l < n.length; l++) if (this.rules.other.blockquoteStart.test(n[l])) o.push(n[l]), a = true;
|
|
852
|
+
else if (!a) o.push(n[l]);
|
|
853
|
+
else break;
|
|
854
|
+
n = n.slice(l);
|
|
855
|
+
let p = o.join(`
|
|
856
|
+
`), c = p.replace(this.rules.other.blockquoteSetextReplace, `
|
|
857
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
858
|
+
r = r ? `${r}
|
|
859
|
+
${p}` : p, i = i ? `${i}
|
|
860
|
+
${c}` : c;
|
|
861
|
+
let d = this.lexer.state.top;
|
|
862
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(c, s, true), this.lexer.state.top = d, n.length === 0) break;
|
|
863
|
+
let h = s.at(-1);
|
|
864
|
+
if ((h == null ? void 0 : h.type) === "code") break;
|
|
865
|
+
if ((h == null ? void 0 : h.type) === "blockquote") {
|
|
866
|
+
let R = h, f = R.raw + `
|
|
867
|
+
` + n.join(`
|
|
868
|
+
`), S = this.blockquote(f);
|
|
869
|
+
s[s.length - 1] = S, r = r.substring(0, r.length - R.raw.length) + S.raw, i = i.substring(0, i.length - R.text.length) + S.text;
|
|
1109
870
|
break;
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
const newText = oldToken.raw + "\n" + lines.join("\n");
|
|
1117
|
-
const newToken = this.blockquote(newText);
|
|
1118
|
-
tokens[tokens.length - 1] = newToken;
|
|
1119
|
-
raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
|
|
1120
|
-
text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
|
|
1121
|
-
break;
|
|
1122
|
-
} else if ((lastToken == null ? void 0 : lastToken.type) === "list") {
|
|
1123
|
-
const oldToken = lastToken;
|
|
1124
|
-
const newText = oldToken.raw + "\n" + lines.join("\n");
|
|
1125
|
-
const newToken = this.list(newText);
|
|
1126
|
-
tokens[tokens.length - 1] = newToken;
|
|
1127
|
-
raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
|
|
1128
|
-
text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
|
|
1129
|
-
lines = newText.substring(tokens.at(-1).raw.length).split("\n");
|
|
871
|
+
} else if ((h == null ? void 0 : h.type) === "list") {
|
|
872
|
+
let R = h, f = R.raw + `
|
|
873
|
+
` + n.join(`
|
|
874
|
+
`), S = this.list(f);
|
|
875
|
+
s[s.length - 1] = S, r = r.substring(0, r.length - h.raw.length) + S.raw, i = i.substring(0, i.length - R.raw.length) + S.raw, n = f.substring(s.at(-1).raw.length).split(`
|
|
876
|
+
`);
|
|
1130
877
|
continue;
|
|
1131
878
|
}
|
|
1132
879
|
}
|
|
1133
|
-
return {
|
|
1134
|
-
type: "blockquote",
|
|
1135
|
-
raw,
|
|
1136
|
-
tokens,
|
|
1137
|
-
text
|
|
1138
|
-
};
|
|
880
|
+
return { type: "blockquote", raw: r, tokens: s, text: i };
|
|
1139
881
|
}
|
|
1140
882
|
}
|
|
1141
|
-
list(
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
break;
|
|
1169
|
-
}
|
|
1170
|
-
raw = cap[0];
|
|
1171
|
-
src = src.substring(raw.length);
|
|
1172
|
-
let line = cap[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (t) => " ".repeat(3 * t.length));
|
|
1173
|
-
let nextLine = src.split("\n", 1)[0];
|
|
1174
|
-
let blankLine = !line.trim();
|
|
1175
|
-
let indent = 0;
|
|
1176
|
-
if (this.options.pedantic) {
|
|
1177
|
-
indent = 2;
|
|
1178
|
-
itemContents = line.trimStart();
|
|
1179
|
-
} else if (blankLine) {
|
|
1180
|
-
indent = cap[1].length + 1;
|
|
1181
|
-
} else {
|
|
1182
|
-
indent = cap[2].search(this.rules.other.nonSpaceChar);
|
|
1183
|
-
indent = indent > 4 ? 1 : indent;
|
|
1184
|
-
itemContents = line.slice(indent);
|
|
1185
|
-
indent += cap[1].length;
|
|
1186
|
-
}
|
|
1187
|
-
if (blankLine && this.rules.other.blankLine.test(nextLine)) {
|
|
1188
|
-
raw += nextLine + "\n";
|
|
1189
|
-
src = src.substring(nextLine.length + 1);
|
|
1190
|
-
endEarly = true;
|
|
1191
|
-
}
|
|
1192
|
-
if (!endEarly) {
|
|
1193
|
-
const nextBulletRegex = this.rules.other.nextBulletRegex(indent);
|
|
1194
|
-
const hrRegex = this.rules.other.hrRegex(indent);
|
|
1195
|
-
const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent);
|
|
1196
|
-
const headingBeginRegex = this.rules.other.headingBeginRegex(indent);
|
|
1197
|
-
const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent);
|
|
1198
|
-
while (src) {
|
|
1199
|
-
const rawLine = src.split("\n", 1)[0];
|
|
1200
|
-
let nextLineWithoutTabs;
|
|
1201
|
-
nextLine = rawLine;
|
|
1202
|
-
if (this.options.pedantic) {
|
|
1203
|
-
nextLine = nextLine.replace(this.rules.other.listReplaceNesting, " ");
|
|
1204
|
-
nextLineWithoutTabs = nextLine;
|
|
1205
|
-
} else {
|
|
1206
|
-
nextLineWithoutTabs = nextLine.replace(this.rules.other.tabCharGlobal, " ");
|
|
1207
|
-
}
|
|
1208
|
-
if (fencesBeginRegex.test(nextLine)) {
|
|
1209
|
-
break;
|
|
1210
|
-
}
|
|
1211
|
-
if (headingBeginRegex.test(nextLine)) {
|
|
1212
|
-
break;
|
|
1213
|
-
}
|
|
1214
|
-
if (htmlBeginRegex.test(nextLine)) {
|
|
1215
|
-
break;
|
|
1216
|
-
}
|
|
1217
|
-
if (nextBulletRegex.test(nextLine)) {
|
|
1218
|
-
break;
|
|
1219
|
-
}
|
|
1220
|
-
if (hrRegex.test(nextLine)) {
|
|
1221
|
-
break;
|
|
1222
|
-
}
|
|
1223
|
-
if (nextLineWithoutTabs.search(this.rules.other.nonSpaceChar) >= indent || !nextLine.trim()) {
|
|
1224
|
-
itemContents += "\n" + nextLineWithoutTabs.slice(indent);
|
|
1225
|
-
} else {
|
|
1226
|
-
if (blankLine) {
|
|
1227
|
-
break;
|
|
1228
|
-
}
|
|
1229
|
-
if (line.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4) {
|
|
1230
|
-
break;
|
|
1231
|
-
}
|
|
1232
|
-
if (fencesBeginRegex.test(line)) {
|
|
1233
|
-
break;
|
|
1234
|
-
}
|
|
1235
|
-
if (headingBeginRegex.test(line)) {
|
|
1236
|
-
break;
|
|
1237
|
-
}
|
|
1238
|
-
if (hrRegex.test(line)) {
|
|
1239
|
-
break;
|
|
1240
|
-
}
|
|
1241
|
-
itemContents += "\n" + nextLine;
|
|
1242
|
-
}
|
|
1243
|
-
if (!blankLine && !nextLine.trim()) {
|
|
1244
|
-
blankLine = true;
|
|
883
|
+
list(e) {
|
|
884
|
+
var _a2, _b;
|
|
885
|
+
let t = this.rules.block.list.exec(e);
|
|
886
|
+
if (t) {
|
|
887
|
+
let n = t[1].trim(), r = n.length > 1, i = { type: "list", raw: "", ordered: r, start: r ? +n.slice(0, -1) : "", loose: false, items: [] };
|
|
888
|
+
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
889
|
+
let s = this.rules.other.listItemRegex(n), a = false;
|
|
890
|
+
for (; e; ) {
|
|
891
|
+
let l = false, p = "", c = "";
|
|
892
|
+
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
893
|
+
p = t[0], e = e.substring(p.length);
|
|
894
|
+
let d = fe(t[2].split(`
|
|
895
|
+
`, 1)[0], t[1].length), h = e.split(`
|
|
896
|
+
`, 1)[0], R = !d.trim(), f = 0;
|
|
897
|
+
if (this.options.pedantic ? (f = 2, c = d.trimStart()) : R ? f = t[1].length + 1 : (f = d.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = d.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (p += h + `
|
|
898
|
+
`, e = e.substring(h.length + 1), l = true), !l) {
|
|
899
|
+
let S = this.rules.other.nextBulletRegex(f), V = this.rules.other.hrRegex(f), Y = this.rules.other.fencesBeginRegex(f), ee = this.rules.other.headingBeginRegex(f), xe = this.rules.other.htmlBeginRegex(f), be = this.rules.other.blockquoteBeginRegex(f);
|
|
900
|
+
for (; e; ) {
|
|
901
|
+
let H = e.split(`
|
|
902
|
+
`, 1)[0], I;
|
|
903
|
+
if (h = H, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), I = h) : I = h.replace(this.rules.other.tabCharGlobal, " "), Y.test(h) || ee.test(h) || xe.test(h) || be.test(h) || S.test(h) || V.test(h)) break;
|
|
904
|
+
if (I.search(this.rules.other.nonSpaceChar) >= f || !h.trim()) c += `
|
|
905
|
+
` + I.slice(f);
|
|
906
|
+
else {
|
|
907
|
+
if (R || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Y.test(d) || ee.test(d) || V.test(d)) break;
|
|
908
|
+
c += `
|
|
909
|
+
` + h;
|
|
1245
910
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
line = nextLineWithoutTabs.slice(indent);
|
|
911
|
+
R = !h.trim(), p += H + `
|
|
912
|
+
`, e = e.substring(H.length + 1), d = I.slice(f);
|
|
1249
913
|
}
|
|
1250
914
|
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
915
|
+
i.loose || (a ? i.loose = true : this.rules.other.doubleBlankLine.test(p) && (a = true)), i.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), i.raw += p;
|
|
916
|
+
}
|
|
917
|
+
let o = i.items.at(-1);
|
|
918
|
+
if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
|
|
919
|
+
else return;
|
|
920
|
+
i.raw = i.raw.trimEnd();
|
|
921
|
+
for (let l of i.items) {
|
|
922
|
+
if (this.lexer.state.top = false, l.tokens = this.lexer.blockTokens(l.text, []), l.task) {
|
|
923
|
+
if (l.text = l.text.replace(this.rules.other.listReplaceTask, ""), ((_a2 = l.tokens[0]) == null ? void 0 : _a2.type) === "text" || ((_b = l.tokens[0]) == null ? void 0 : _b.type) === "paragraph") {
|
|
924
|
+
l.tokens[0].raw = l.tokens[0].raw.replace(this.rules.other.listReplaceTask, ""), l.tokens[0].text = l.tokens[0].text.replace(this.rules.other.listReplaceTask, "");
|
|
925
|
+
for (let c = this.lexer.inlineQueue.length - 1; c >= 0; c--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)) {
|
|
926
|
+
this.lexer.inlineQueue[c].src = this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask, "");
|
|
927
|
+
break;
|
|
928
|
+
}
|
|
1256
929
|
}
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
istask = this.rules.other.listIsTask.exec(itemContents);
|
|
1262
|
-
if (istask) {
|
|
1263
|
-
ischecked = istask[0] !== "[ ] ";
|
|
1264
|
-
itemContents = itemContents.replace(this.rules.other.listReplaceTask, "");
|
|
930
|
+
let p = this.rules.other.listTaskCheckbox.exec(l.raw);
|
|
931
|
+
if (p) {
|
|
932
|
+
let c = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
|
|
933
|
+
l.checked = c.checked, i.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = c.raw + l.tokens[0].raw, l.tokens[0].text = c.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(c)) : l.tokens.unshift({ type: "paragraph", raw: c.raw, text: c.raw, tokens: [c] }) : l.tokens.unshift(c);
|
|
1265
934
|
}
|
|
1266
935
|
}
|
|
1267
|
-
|
|
1268
|
-
type
|
|
1269
|
-
|
|
1270
|
-
task: !!istask,
|
|
1271
|
-
checked: ischecked,
|
|
1272
|
-
loose: false,
|
|
1273
|
-
text: itemContents,
|
|
1274
|
-
tokens: []
|
|
1275
|
-
});
|
|
1276
|
-
list2.raw += raw;
|
|
1277
|
-
}
|
|
1278
|
-
const lastItem = list2.items.at(-1);
|
|
1279
|
-
if (lastItem) {
|
|
1280
|
-
lastItem.raw = lastItem.raw.trimEnd();
|
|
1281
|
-
lastItem.text = lastItem.text.trimEnd();
|
|
1282
|
-
} else {
|
|
1283
|
-
return;
|
|
1284
|
-
}
|
|
1285
|
-
list2.raw = list2.raw.trimEnd();
|
|
1286
|
-
for (let i = 0; i < list2.items.length; i++) {
|
|
1287
|
-
this.lexer.state.top = false;
|
|
1288
|
-
list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []);
|
|
1289
|
-
if (!list2.loose) {
|
|
1290
|
-
const spacers = list2.items[i].tokens.filter((t) => t.type === "space");
|
|
1291
|
-
const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t) => this.rules.other.anyLine.test(t.raw));
|
|
1292
|
-
list2.loose = hasMultipleLineBreaks;
|
|
936
|
+
if (!i.loose) {
|
|
937
|
+
let p = l.tokens.filter((d) => d.type === "space"), c = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
|
|
938
|
+
i.loose = c;
|
|
1293
939
|
}
|
|
1294
940
|
}
|
|
1295
|
-
if (
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
}
|
|
941
|
+
if (i.loose) for (let l of i.items) {
|
|
942
|
+
l.loose = true;
|
|
943
|
+
for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
|
|
1299
944
|
}
|
|
1300
|
-
return
|
|
945
|
+
return i;
|
|
1301
946
|
}
|
|
1302
947
|
}
|
|
1303
|
-
html(
|
|
1304
|
-
|
|
1305
|
-
if (
|
|
1306
|
-
const token = {
|
|
1307
|
-
type: "html",
|
|
1308
|
-
block: true,
|
|
1309
|
-
raw: cap[0],
|
|
1310
|
-
pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
|
|
1311
|
-
text: cap[0]
|
|
1312
|
-
};
|
|
1313
|
-
return token;
|
|
1314
|
-
}
|
|
948
|
+
html(e) {
|
|
949
|
+
let t = this.rules.block.html.exec(e);
|
|
950
|
+
if (t) return { type: "html", block: true, raw: t[0], pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: t[0] };
|
|
1315
951
|
}
|
|
1316
|
-
def(
|
|
1317
|
-
|
|
1318
|
-
if (
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
|
|
1322
|
-
return {
|
|
1323
|
-
type: "def",
|
|
1324
|
-
tag: tag2,
|
|
1325
|
-
raw: cap[0],
|
|
1326
|
-
href,
|
|
1327
|
-
title
|
|
1328
|
-
};
|
|
952
|
+
def(e) {
|
|
953
|
+
let t = this.rules.block.def.exec(e);
|
|
954
|
+
if (t) {
|
|
955
|
+
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
956
|
+
return { type: "def", tag: n, raw: t[0], href: r, title: i };
|
|
1329
957
|
}
|
|
1330
958
|
}
|
|
1331
|
-
table(
|
|
959
|
+
table(e) {
|
|
1332
960
|
var _a2;
|
|
1333
|
-
|
|
1334
|
-
if (!
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
if (
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
if (
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
tokens: this.lexer.inline(cell),
|
|
1377
|
-
header: false,
|
|
1378
|
-
align: item.align[i]
|
|
1379
|
-
};
|
|
1380
|
-
}));
|
|
1381
|
-
}
|
|
1382
|
-
return item;
|
|
1383
|
-
}
|
|
1384
|
-
lheading(src) {
|
|
1385
|
-
const cap = this.rules.block.lheading.exec(src);
|
|
1386
|
-
if (cap) {
|
|
1387
|
-
return {
|
|
1388
|
-
type: "heading",
|
|
1389
|
-
raw: cap[0],
|
|
1390
|
-
depth: cap[2].charAt(0) === "=" ? 1 : 2,
|
|
1391
|
-
text: cap[1],
|
|
1392
|
-
tokens: this.lexer.inline(cap[1])
|
|
1393
|
-
};
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
paragraph(src) {
|
|
1397
|
-
const cap = this.rules.block.paragraph.exec(src);
|
|
1398
|
-
if (cap) {
|
|
1399
|
-
const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
|
|
1400
|
-
return {
|
|
1401
|
-
type: "paragraph",
|
|
1402
|
-
raw: cap[0],
|
|
1403
|
-
text,
|
|
1404
|
-
tokens: this.lexer.inline(text)
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
text(src) {
|
|
1409
|
-
const cap = this.rules.block.text.exec(src);
|
|
1410
|
-
if (cap) {
|
|
1411
|
-
return {
|
|
1412
|
-
type: "text",
|
|
1413
|
-
raw: cap[0],
|
|
1414
|
-
text: cap[0],
|
|
1415
|
-
tokens: this.lexer.inline(cap[0])
|
|
1416
|
-
};
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
escape(src) {
|
|
1420
|
-
const cap = this.rules.inline.escape.exec(src);
|
|
1421
|
-
if (cap) {
|
|
1422
|
-
return {
|
|
1423
|
-
type: "escape",
|
|
1424
|
-
raw: cap[0],
|
|
1425
|
-
text: cap[1]
|
|
1426
|
-
};
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
tag(src) {
|
|
1430
|
-
const cap = this.rules.inline.tag.exec(src);
|
|
1431
|
-
if (cap) {
|
|
1432
|
-
if (!this.lexer.state.inLink && this.rules.other.startATag.test(cap[0])) {
|
|
1433
|
-
this.lexer.state.inLink = true;
|
|
1434
|
-
} else if (this.lexer.state.inLink && this.rules.other.endATag.test(cap[0])) {
|
|
1435
|
-
this.lexer.state.inLink = false;
|
|
1436
|
-
}
|
|
1437
|
-
if (!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(cap[0])) {
|
|
1438
|
-
this.lexer.state.inRawBlock = true;
|
|
1439
|
-
} else if (this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(cap[0])) {
|
|
1440
|
-
this.lexer.state.inRawBlock = false;
|
|
1441
|
-
}
|
|
1442
|
-
return {
|
|
1443
|
-
type: "html",
|
|
1444
|
-
raw: cap[0],
|
|
1445
|
-
inLink: this.lexer.state.inLink,
|
|
1446
|
-
inRawBlock: this.lexer.state.inRawBlock,
|
|
1447
|
-
block: false,
|
|
1448
|
-
text: cap[0]
|
|
1449
|
-
};
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
link(src) {
|
|
1453
|
-
const cap = this.rules.inline.link.exec(src);
|
|
1454
|
-
if (cap) {
|
|
1455
|
-
const trimmedUrl = cap[2].trim();
|
|
1456
|
-
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(trimmedUrl)) {
|
|
1457
|
-
if (!this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
1458
|
-
return;
|
|
1459
|
-
}
|
|
1460
|
-
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
|
|
1461
|
-
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
1462
|
-
return;
|
|
1463
|
-
}
|
|
961
|
+
let t = this.rules.block.table.exec(e);
|
|
962
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
963
|
+
let n = J(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = ((_a2 = t[3]) == null ? void 0 : _a2.trim()) ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
964
|
+
`) : [], s = { type: "table", raw: t[0], header: [], align: [], rows: [] };
|
|
965
|
+
if (n.length === r.length) {
|
|
966
|
+
for (let a of r) this.rules.other.tableAlignRight.test(a) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? s.align.push("left") : s.align.push(null);
|
|
967
|
+
for (let a = 0; a < n.length; a++) s.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: true, align: s.align[a] });
|
|
968
|
+
for (let a of i) s.rows.push(J(a, s.header.length).map((o, l) => ({ text: o, tokens: this.lexer.inline(o), header: false, align: s.align[l] })));
|
|
969
|
+
return s;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
lheading(e) {
|
|
973
|
+
let t = this.rules.block.lheading.exec(e);
|
|
974
|
+
if (t) return { type: "heading", raw: t[0], depth: t[2].charAt(0) === "=" ? 1 : 2, text: t[1], tokens: this.lexer.inline(t[1]) };
|
|
975
|
+
}
|
|
976
|
+
paragraph(e) {
|
|
977
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
978
|
+
if (t) {
|
|
979
|
+
let n = t[1].charAt(t[1].length - 1) === `
|
|
980
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
981
|
+
return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
text(e) {
|
|
985
|
+
let t = this.rules.block.text.exec(e);
|
|
986
|
+
if (t) return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) };
|
|
987
|
+
}
|
|
988
|
+
escape(e) {
|
|
989
|
+
let t = this.rules.inline.escape.exec(e);
|
|
990
|
+
if (t) return { type: "escape", raw: t[0], text: t[1] };
|
|
991
|
+
}
|
|
992
|
+
tag(e) {
|
|
993
|
+
let t = this.rules.inline.tag.exec(e);
|
|
994
|
+
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
|
|
995
|
+
}
|
|
996
|
+
link(e) {
|
|
997
|
+
let t = this.rules.inline.link.exec(e);
|
|
998
|
+
if (t) {
|
|
999
|
+
let n = t[2].trim();
|
|
1000
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
1001
|
+
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
1002
|
+
let s = E(n.slice(0, -1), "\\");
|
|
1003
|
+
if ((n.length - s.length) % 2 === 0) return;
|
|
1464
1004
|
} else {
|
|
1465
|
-
|
|
1466
|
-
if (
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
const start = cap[0].indexOf("!") === 0 ? 5 : 4;
|
|
1471
|
-
const linkLen = start + cap[1].length + lastParenIndex;
|
|
1472
|
-
cap[2] = cap[2].substring(0, lastParenIndex);
|
|
1473
|
-
cap[0] = cap[0].substring(0, linkLen).trim();
|
|
1474
|
-
cap[3] = "";
|
|
1005
|
+
let s = ge(t[2], "()");
|
|
1006
|
+
if (s === -2) return;
|
|
1007
|
+
if (s > -1) {
|
|
1008
|
+
let o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
1009
|
+
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, o).trim(), t[3] = "";
|
|
1475
1010
|
}
|
|
1476
1011
|
}
|
|
1477
|
-
let
|
|
1478
|
-
let title = "";
|
|
1012
|
+
let r = t[2], i = "";
|
|
1479
1013
|
if (this.options.pedantic) {
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1014
|
+
let s = this.rules.other.pedanticHrefTitle.exec(r);
|
|
1015
|
+
s && (r = s[1], i = s[3]);
|
|
1016
|
+
} else i = t[3] ? t[3].slice(1, -1) : "";
|
|
1017
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), me(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
reflink(e, t) {
|
|
1021
|
+
let n;
|
|
1022
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
1023
|
+
let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[r.toLowerCase()];
|
|
1024
|
+
if (!i) {
|
|
1025
|
+
let s = n[0].charAt(0);
|
|
1026
|
+
return { type: "text", raw: s, text: s };
|
|
1027
|
+
}
|
|
1028
|
+
return me(n, i, n[0], this.lexer, this.rules);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
emStrong(e, t, n = "") {
|
|
1032
|
+
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
1033
|
+
if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
1034
|
+
if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
1035
|
+
let s = [...r[0]].length - 1, a, o, l = s, p = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
1036
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = c.exec(t)) != null; ) {
|
|
1037
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
|
|
1038
|
+
if (o = [...a].length, r[3] || r[4]) {
|
|
1039
|
+
l += o;
|
|
1040
|
+
continue;
|
|
1041
|
+
} else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
|
|
1042
|
+
p += o;
|
|
1043
|
+
continue;
|
|
1484
1044
|
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
href = href.slice(1);
|
|
1492
|
-
} else {
|
|
1493
|
-
href = href.slice(1, -1);
|
|
1045
|
+
if (l -= o, l > 0) continue;
|
|
1046
|
+
o = Math.min(o, o + l + p);
|
|
1047
|
+
let d = [...r[0]][0].length, h = e.slice(0, s + r.index + d + o);
|
|
1048
|
+
if (Math.min(s, o) % 2) {
|
|
1049
|
+
let f = h.slice(1, -1);
|
|
1050
|
+
return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
1494
1051
|
}
|
|
1052
|
+
let R = h.slice(2, -2);
|
|
1053
|
+
return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
|
|
1495
1054
|
}
|
|
1496
|
-
return outputLink(cap, {
|
|
1497
|
-
href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
|
|
1498
|
-
title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
|
|
1499
|
-
}, cap[0], this.lexer, this.rules);
|
|
1500
1055
|
}
|
|
1501
1056
|
}
|
|
1502
|
-
|
|
1503
|
-
let
|
|
1504
|
-
if (
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
if (!link2) {
|
|
1508
|
-
const text = cap[0].charAt(0);
|
|
1509
|
-
return {
|
|
1510
|
-
type: "text",
|
|
1511
|
-
raw: text,
|
|
1512
|
-
text
|
|
1513
|
-
};
|
|
1514
|
-
}
|
|
1515
|
-
return outputLink(cap, link2, cap[0], this.lexer, this.rules);
|
|
1057
|
+
codespan(e) {
|
|
1058
|
+
let t = this.rules.inline.code.exec(e);
|
|
1059
|
+
if (t) {
|
|
1060
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), r = this.rules.other.nonSpaceChar.test(n), i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
1061
|
+
return r && i && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
|
|
1516
1062
|
}
|
|
1517
1063
|
}
|
|
1518
|
-
|
|
1519
|
-
let
|
|
1520
|
-
if (
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
if (!rDelim) continue;
|
|
1532
|
-
rLength = [...rDelim].length;
|
|
1533
|
-
if (match[3] || match[4]) {
|
|
1534
|
-
delimTotal += rLength;
|
|
1064
|
+
br(e) {
|
|
1065
|
+
let t = this.rules.inline.br.exec(e);
|
|
1066
|
+
if (t) return { type: "br", raw: t[0] };
|
|
1067
|
+
}
|
|
1068
|
+
del(e, t, n = "") {
|
|
1069
|
+
let r = this.rules.inline.delLDelim.exec(e);
|
|
1070
|
+
if (!r) return;
|
|
1071
|
+
if (!(r[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
1072
|
+
let s = [...r[0]].length - 1, a, o, l = s, p = this.rules.inline.delRDelim;
|
|
1073
|
+
for (p.lastIndex = 0, t = t.slice(-1 * e.length + s); (r = p.exec(t)) != null; ) {
|
|
1074
|
+
if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a || (o = [...a].length, o !== s)) continue;
|
|
1075
|
+
if (r[3] || r[4]) {
|
|
1076
|
+
l += o;
|
|
1535
1077
|
continue;
|
|
1536
|
-
} else if (match[5] || match[6]) {
|
|
1537
|
-
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
|
1538
|
-
midDelimTotal += rLength;
|
|
1539
|
-
continue;
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
delimTotal -= rLength;
|
|
1543
|
-
if (delimTotal > 0) continue;
|
|
1544
|
-
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
1545
|
-
const lastCharLength = [...match[0]][0].length;
|
|
1546
|
-
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
|
1547
|
-
if (Math.min(lLength, rLength) % 2) {
|
|
1548
|
-
const text2 = raw.slice(1, -1);
|
|
1549
|
-
return {
|
|
1550
|
-
type: "em",
|
|
1551
|
-
raw,
|
|
1552
|
-
text: text2,
|
|
1553
|
-
tokens: this.lexer.inlineTokens(text2)
|
|
1554
|
-
};
|
|
1555
1078
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
text,
|
|
1561
|
-
tokens: this.lexer.inlineTokens(text)
|
|
1562
|
-
};
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
codespan(src) {
|
|
1567
|
-
const cap = this.rules.inline.code.exec(src);
|
|
1568
|
-
if (cap) {
|
|
1569
|
-
let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
|
|
1570
|
-
const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
|
|
1571
|
-
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
|
|
1572
|
-
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
1573
|
-
text = text.substring(1, text.length - 1);
|
|
1079
|
+
if (l -= o, l > 0) continue;
|
|
1080
|
+
o = Math.min(o, o + l);
|
|
1081
|
+
let c = [...r[0]][0].length, d = e.slice(0, s + r.index + c + o), h = d.slice(s, -s);
|
|
1082
|
+
return { type: "del", raw: d, text: h, tokens: this.lexer.inlineTokens(h) };
|
|
1574
1083
|
}
|
|
1575
|
-
return {
|
|
1576
|
-
type: "codespan",
|
|
1577
|
-
raw: cap[0],
|
|
1578
|
-
text
|
|
1579
|
-
};
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
br(src) {
|
|
1583
|
-
const cap = this.rules.inline.br.exec(src);
|
|
1584
|
-
if (cap) {
|
|
1585
|
-
return {
|
|
1586
|
-
type: "br",
|
|
1587
|
-
raw: cap[0]
|
|
1588
|
-
};
|
|
1589
1084
|
}
|
|
1590
1085
|
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
if (
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
raw: cap[0],
|
|
1597
|
-
text: cap[2],
|
|
1598
|
-
tokens: this.lexer.inlineTokens(cap[2])
|
|
1599
|
-
};
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
autolink(src) {
|
|
1603
|
-
const cap = this.rules.inline.autolink.exec(src);
|
|
1604
|
-
if (cap) {
|
|
1605
|
-
let text, href;
|
|
1606
|
-
if (cap[2] === "@") {
|
|
1607
|
-
text = cap[1];
|
|
1608
|
-
href = "mailto:" + text;
|
|
1609
|
-
} else {
|
|
1610
|
-
text = cap[1];
|
|
1611
|
-
href = text;
|
|
1612
|
-
}
|
|
1613
|
-
return {
|
|
1614
|
-
type: "link",
|
|
1615
|
-
raw: cap[0],
|
|
1616
|
-
text,
|
|
1617
|
-
href,
|
|
1618
|
-
tokens: [
|
|
1619
|
-
{
|
|
1620
|
-
type: "text",
|
|
1621
|
-
raw: text,
|
|
1622
|
-
text
|
|
1623
|
-
}
|
|
1624
|
-
]
|
|
1625
|
-
};
|
|
1086
|
+
autolink(e) {
|
|
1087
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
1088
|
+
if (t) {
|
|
1089
|
+
let n, r;
|
|
1090
|
+
return t[2] === "@" ? (n = t[1], r = "mailto:" + n) : (n = t[1], r = n), { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
|
|
1626
1091
|
}
|
|
1627
1092
|
}
|
|
1628
|
-
url(
|
|
1093
|
+
url(e) {
|
|
1629
1094
|
var _a2, _b;
|
|
1630
|
-
let
|
|
1631
|
-
if (
|
|
1632
|
-
let
|
|
1633
|
-
if (
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
cap[0] = (_b = (_a2 = this.rules.inline._backpedal.exec(cap[0])) == null ? void 0 : _a2[0]) != null ? _b : "";
|
|
1641
|
-
} while (prevCapZero !== cap[0]);
|
|
1642
|
-
text = cap[0];
|
|
1643
|
-
if (cap[1] === "www.") {
|
|
1644
|
-
href = "http://" + cap[0];
|
|
1645
|
-
} else {
|
|
1646
|
-
href = cap[0];
|
|
1647
|
-
}
|
|
1095
|
+
let t;
|
|
1096
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
1097
|
+
let n, r;
|
|
1098
|
+
if (t[2] === "@") n = t[0], r = "mailto:" + n;
|
|
1099
|
+
else {
|
|
1100
|
+
let i;
|
|
1101
|
+
do
|
|
1102
|
+
i = t[0], t[0] = (_b = (_a2 = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : _a2[0]) != null ? _b : "";
|
|
1103
|
+
while (i !== t[0]);
|
|
1104
|
+
n = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
|
|
1648
1105
|
}
|
|
1649
|
-
return {
|
|
1650
|
-
type: "link",
|
|
1651
|
-
raw: cap[0],
|
|
1652
|
-
text,
|
|
1653
|
-
href,
|
|
1654
|
-
tokens: [
|
|
1655
|
-
{
|
|
1656
|
-
type: "text",
|
|
1657
|
-
raw: text,
|
|
1658
|
-
text
|
|
1659
|
-
}
|
|
1660
|
-
]
|
|
1661
|
-
};
|
|
1106
|
+
return { type: "link", raw: t[0], text: n, href: r, tokens: [{ type: "text", raw: n, text: n }] };
|
|
1662
1107
|
}
|
|
1663
1108
|
}
|
|
1664
|
-
inlineText(
|
|
1665
|
-
|
|
1666
|
-
if (
|
|
1667
|
-
|
|
1668
|
-
return {
|
|
1669
|
-
type: "text",
|
|
1670
|
-
raw: cap[0],
|
|
1671
|
-
text: cap[0],
|
|
1672
|
-
escaped
|
|
1673
|
-
};
|
|
1109
|
+
inlineText(e) {
|
|
1110
|
+
let t = this.rules.inline.text.exec(e);
|
|
1111
|
+
if (t) {
|
|
1112
|
+
let n = this.lexer.state.inRawBlock;
|
|
1113
|
+
return { type: "text", raw: t[0], text: t[0], escaped: n };
|
|
1674
1114
|
}
|
|
1675
1115
|
}
|
|
1676
1116
|
};
|
|
1677
|
-
var
|
|
1678
|
-
constructor(
|
|
1117
|
+
var x = class u {
|
|
1118
|
+
constructor(e) {
|
|
1679
1119
|
__publicField(this, "tokens");
|
|
1680
1120
|
__publicField(this, "options");
|
|
1681
1121
|
__publicField(this, "state");
|
|
1682
|
-
__publicField(this, "tokenizer");
|
|
1683
1122
|
__publicField(this, "inlineQueue");
|
|
1684
|
-
this
|
|
1685
|
-
this.tokens.links = /* @__PURE__ */ Object.create(null);
|
|
1686
|
-
|
|
1687
|
-
this.options.
|
|
1688
|
-
this.tokenizer = this.options.tokenizer;
|
|
1689
|
-
this.tokenizer.options = this.options;
|
|
1690
|
-
this.tokenizer.lexer = this;
|
|
1691
|
-
this.inlineQueue = [];
|
|
1692
|
-
this.state = {
|
|
1693
|
-
inLink: false,
|
|
1694
|
-
inRawBlock: false,
|
|
1695
|
-
top: true
|
|
1696
|
-
};
|
|
1697
|
-
const rules = {
|
|
1698
|
-
other,
|
|
1699
|
-
block: block.normal,
|
|
1700
|
-
inline: inline.normal
|
|
1701
|
-
};
|
|
1702
|
-
if (this.options.pedantic) {
|
|
1703
|
-
rules.block = block.pedantic;
|
|
1704
|
-
rules.inline = inline.pedantic;
|
|
1705
|
-
} else if (this.options.gfm) {
|
|
1706
|
-
rules.block = block.gfm;
|
|
1707
|
-
if (this.options.breaks) {
|
|
1708
|
-
rules.inline = inline.breaks;
|
|
1709
|
-
} else {
|
|
1710
|
-
rules.inline = inline.gfm;
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
this.tokenizer.rules = rules;
|
|
1123
|
+
__publicField(this, "tokenizer");
|
|
1124
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
|
|
1125
|
+
let t = { other: m, block: C.normal, inline: z.normal };
|
|
1126
|
+
this.options.pedantic ? (t.block = C.pedantic, t.inline = z.pedantic) : this.options.gfm && (t.block = C.gfm, this.options.breaks ? t.inline = z.breaks : t.inline = z.gfm), this.tokenizer.rules = t;
|
|
1714
1127
|
}
|
|
1715
|
-
/**
|
|
1716
|
-
* Expose Rules
|
|
1717
|
-
*/
|
|
1718
1128
|
static get rules() {
|
|
1719
|
-
return {
|
|
1720
|
-
block,
|
|
1721
|
-
inline
|
|
1722
|
-
};
|
|
1129
|
+
return { block: C, inline: z };
|
|
1723
1130
|
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
*/
|
|
1727
|
-
static lex(src, options2) {
|
|
1728
|
-
const lexer2 = new __Lexer(options2);
|
|
1729
|
-
return lexer2.lex(src);
|
|
1131
|
+
static lex(e, t) {
|
|
1132
|
+
return new u(t).lex(e);
|
|
1730
1133
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
*/
|
|
1734
|
-
static lexInline(src, options2) {
|
|
1735
|
-
const lexer2 = new __Lexer(options2);
|
|
1736
|
-
return lexer2.inlineTokens(src);
|
|
1134
|
+
static lexInline(e, t) {
|
|
1135
|
+
return new u(t).inlineTokens(e);
|
|
1737
1136
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
for (let i = 0; i < this.inlineQueue.length; i++) {
|
|
1745
|
-
const next = this.inlineQueue[i];
|
|
1746
|
-
this.inlineTokens(next.src, next.tokens);
|
|
1137
|
+
lex(e) {
|
|
1138
|
+
e = e.replace(m.carriageReturn, `
|
|
1139
|
+
`), this.blockTokens(e, this.tokens);
|
|
1140
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
1141
|
+
let n = this.inlineQueue[t];
|
|
1142
|
+
this.inlineTokens(n.src, n.tokens);
|
|
1747
1143
|
}
|
|
1748
|
-
this.inlineQueue = [];
|
|
1749
|
-
return this.tokens;
|
|
1144
|
+
return this.inlineQueue = [], this.tokens;
|
|
1750
1145
|
}
|
|
1751
|
-
blockTokens(
|
|
1146
|
+
blockTokens(e, t = [], n = false) {
|
|
1752
1147
|
var _a2, _b, _c;
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
tokens.push(token);
|
|
1762
|
-
return true;
|
|
1763
|
-
}
|
|
1764
|
-
return false;
|
|
1765
|
-
})) {
|
|
1766
|
-
continue;
|
|
1767
|
-
}
|
|
1768
|
-
if (token = this.tokenizer.space(src)) {
|
|
1769
|
-
src = src.substring(token.raw.length);
|
|
1770
|
-
const lastToken = tokens.at(-1);
|
|
1771
|
-
if (token.raw.length === 1 && lastToken !== void 0) {
|
|
1772
|
-
lastToken.raw += "\n";
|
|
1773
|
-
} else {
|
|
1774
|
-
tokens.push(token);
|
|
1775
|
-
}
|
|
1148
|
+
for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e; ) {
|
|
1149
|
+
let r;
|
|
1150
|
+
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false)) continue;
|
|
1151
|
+
if (r = this.tokenizer.space(e)) {
|
|
1152
|
+
e = e.substring(r.raw.length);
|
|
1153
|
+
let s = t.at(-1);
|
|
1154
|
+
r.raw.length === 1 && s !== void 0 ? s.raw += `
|
|
1155
|
+
` : t.push(r);
|
|
1776
1156
|
continue;
|
|
1777
1157
|
}
|
|
1778
|
-
if (
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
} else {
|
|
1786
|
-
tokens.push(token);
|
|
1787
|
-
}
|
|
1158
|
+
if (r = this.tokenizer.code(e)) {
|
|
1159
|
+
e = e.substring(r.raw.length);
|
|
1160
|
+
let s = t.at(-1);
|
|
1161
|
+
(s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
|
|
1162
|
+
`) ? "" : `
|
|
1163
|
+
`) + r.raw, s.text += `
|
|
1164
|
+
` + r.text, this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
1788
1165
|
continue;
|
|
1789
1166
|
}
|
|
1790
|
-
if (
|
|
1791
|
-
|
|
1792
|
-
tokens.push(token);
|
|
1167
|
+
if (r = this.tokenizer.fences(e)) {
|
|
1168
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1793
1169
|
continue;
|
|
1794
1170
|
}
|
|
1795
|
-
if (
|
|
1796
|
-
|
|
1797
|
-
tokens.push(token);
|
|
1171
|
+
if (r = this.tokenizer.heading(e)) {
|
|
1172
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1798
1173
|
continue;
|
|
1799
1174
|
}
|
|
1800
|
-
if (
|
|
1801
|
-
|
|
1802
|
-
tokens.push(token);
|
|
1175
|
+
if (r = this.tokenizer.hr(e)) {
|
|
1176
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1803
1177
|
continue;
|
|
1804
1178
|
}
|
|
1805
|
-
if (
|
|
1806
|
-
|
|
1807
|
-
tokens.push(token);
|
|
1179
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
1180
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1808
1181
|
continue;
|
|
1809
1182
|
}
|
|
1810
|
-
if (
|
|
1811
|
-
|
|
1812
|
-
tokens.push(token);
|
|
1183
|
+
if (r = this.tokenizer.list(e)) {
|
|
1184
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1813
1185
|
continue;
|
|
1814
1186
|
}
|
|
1815
|
-
if (
|
|
1816
|
-
|
|
1817
|
-
tokens.push(token);
|
|
1187
|
+
if (r = this.tokenizer.html(e)) {
|
|
1188
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1818
1189
|
continue;
|
|
1819
1190
|
}
|
|
1820
|
-
if (
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
} else if (!this.tokens.links[token.tag]) {
|
|
1828
|
-
this.tokens.links[token.tag] = {
|
|
1829
|
-
href: token.href,
|
|
1830
|
-
title: token.title
|
|
1831
|
-
};
|
|
1832
|
-
}
|
|
1191
|
+
if (r = this.tokenizer.def(e)) {
|
|
1192
|
+
e = e.substring(r.raw.length);
|
|
1193
|
+
let s = t.at(-1);
|
|
1194
|
+
(s == null ? void 0 : s.type) === "paragraph" || (s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
|
|
1195
|
+
`) ? "" : `
|
|
1196
|
+
`) + r.raw, s.text += `
|
|
1197
|
+
` + r.raw, this.inlineQueue.at(-1).src = s.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
|
|
1833
1198
|
continue;
|
|
1834
1199
|
}
|
|
1835
|
-
if (
|
|
1836
|
-
|
|
1837
|
-
tokens.push(token);
|
|
1200
|
+
if (r = this.tokenizer.table(e)) {
|
|
1201
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1838
1202
|
continue;
|
|
1839
1203
|
}
|
|
1840
|
-
if (
|
|
1841
|
-
|
|
1842
|
-
tokens.push(token);
|
|
1204
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
1205
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
1843
1206
|
continue;
|
|
1844
1207
|
}
|
|
1845
|
-
let
|
|
1208
|
+
let i = e;
|
|
1846
1209
|
if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
|
|
1847
|
-
let
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
|
1861
|
-
const lastToken = tokens.at(-1);
|
|
1862
|
-
if (lastParagraphClipped && (lastToken == null ? void 0 : lastToken.type) === "paragraph") {
|
|
1863
|
-
lastToken.raw += "\n" + token.raw;
|
|
1864
|
-
lastToken.text += "\n" + token.text;
|
|
1865
|
-
this.inlineQueue.pop();
|
|
1866
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
1867
|
-
} else {
|
|
1868
|
-
tokens.push(token);
|
|
1869
|
-
}
|
|
1870
|
-
lastParagraphClipped = cutSrc.length !== src.length;
|
|
1871
|
-
src = src.substring(token.raw.length);
|
|
1210
|
+
let s = 1 / 0, a = e.slice(1), o;
|
|
1211
|
+
this.options.extensions.startBlock.forEach((l) => {
|
|
1212
|
+
o = l.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (s = Math.min(s, o));
|
|
1213
|
+
}), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1));
|
|
1214
|
+
}
|
|
1215
|
+
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
1216
|
+
let s = t.at(-1);
|
|
1217
|
+
n && (s == null ? void 0 : s.type) === "paragraph" ? (s.raw += (s.raw.endsWith(`
|
|
1218
|
+
`) ? "" : `
|
|
1219
|
+
`) + r.raw, s.text += `
|
|
1220
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
1872
1221
|
continue;
|
|
1873
1222
|
}
|
|
1874
|
-
if (
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
this.inlineQueue.at(-1).src = lastToken.text;
|
|
1882
|
-
} else {
|
|
1883
|
-
tokens.push(token);
|
|
1884
|
-
}
|
|
1223
|
+
if (r = this.tokenizer.text(e)) {
|
|
1224
|
+
e = e.substring(r.raw.length);
|
|
1225
|
+
let s = t.at(-1);
|
|
1226
|
+
(s == null ? void 0 : s.type) === "text" ? (s.raw += (s.raw.endsWith(`
|
|
1227
|
+
`) ? "" : `
|
|
1228
|
+
`) + r.raw, s.text += `
|
|
1229
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s.text) : t.push(r);
|
|
1885
1230
|
continue;
|
|
1886
1231
|
}
|
|
1887
|
-
if (
|
|
1888
|
-
|
|
1232
|
+
if (e) {
|
|
1233
|
+
let s = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
1889
1234
|
if (this.options.silent) {
|
|
1890
|
-
console.error(
|
|
1235
|
+
console.error(s);
|
|
1891
1236
|
break;
|
|
1892
|
-
} else
|
|
1893
|
-
throw new Error(errMsg);
|
|
1894
|
-
}
|
|
1237
|
+
} else throw new Error(s);
|
|
1895
1238
|
}
|
|
1896
1239
|
}
|
|
1897
|
-
this.state.top = true;
|
|
1898
|
-
return tokens;
|
|
1240
|
+
return this.state.top = true, t;
|
|
1899
1241
|
}
|
|
1900
|
-
inline(
|
|
1901
|
-
this.inlineQueue.push({ src, tokens });
|
|
1902
|
-
return tokens;
|
|
1242
|
+
inline(e, t = []) {
|
|
1243
|
+
return this.inlineQueue.push({ src: e, tokens: t }), t;
|
|
1903
1244
|
}
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
inlineTokens(src, tokens = []) {
|
|
1908
|
-
var _a2, _b, _c;
|
|
1909
|
-
let maskedSrc = src;
|
|
1910
|
-
let match = null;
|
|
1245
|
+
inlineTokens(e, t = []) {
|
|
1246
|
+
var _a2, _b, _c, _d, _e2, _f;
|
|
1247
|
+
let n = e, r = null;
|
|
1911
1248
|
if (this.tokens.links) {
|
|
1912
|
-
|
|
1913
|
-
if (
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
}
|
|
1927
|
-
let keepPrevChar = false;
|
|
1928
|
-
let prevChar = "";
|
|
1929
|
-
while (src) {
|
|
1930
|
-
if (!keepPrevChar) {
|
|
1931
|
-
prevChar = "";
|
|
1932
|
-
}
|
|
1933
|
-
keepPrevChar = false;
|
|
1934
|
-
let token;
|
|
1935
|
-
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.inline) == null ? void 0 : _b.some((extTokenizer) => {
|
|
1936
|
-
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
1937
|
-
src = src.substring(token.raw.length);
|
|
1938
|
-
tokens.push(token);
|
|
1939
|
-
return true;
|
|
1940
|
-
}
|
|
1941
|
-
return false;
|
|
1942
|
-
})) {
|
|
1249
|
+
let o = Object.keys(this.tokens.links);
|
|
1250
|
+
if (o.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; ) o.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
1251
|
+
}
|
|
1252
|
+
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; ) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1253
|
+
let i;
|
|
1254
|
+
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; ) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1255
|
+
n = (_c = (_b = (_a2 = this.options.hooks) == null ? void 0 : _a2.emStrongMask) == null ? void 0 : _b.call({ lexer: this }, n)) != null ? _c : n;
|
|
1256
|
+
let s = false, a = "";
|
|
1257
|
+
for (; e; ) {
|
|
1258
|
+
s || (a = ""), s = false;
|
|
1259
|
+
let o;
|
|
1260
|
+
if ((_e2 = (_d = this.options.extensions) == null ? void 0 : _d.inline) == null ? void 0 : _e2.some((p) => (o = p.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), true) : false)) continue;
|
|
1261
|
+
if (o = this.tokenizer.escape(e)) {
|
|
1262
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1943
1263
|
continue;
|
|
1944
1264
|
}
|
|
1945
|
-
if (
|
|
1946
|
-
|
|
1947
|
-
tokens.push(token);
|
|
1265
|
+
if (o = this.tokenizer.tag(e)) {
|
|
1266
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1948
1267
|
continue;
|
|
1949
1268
|
}
|
|
1950
|
-
if (
|
|
1951
|
-
|
|
1952
|
-
tokens.push(token);
|
|
1269
|
+
if (o = this.tokenizer.link(e)) {
|
|
1270
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1953
1271
|
continue;
|
|
1954
1272
|
}
|
|
1955
|
-
if (
|
|
1956
|
-
|
|
1957
|
-
|
|
1273
|
+
if (o = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
1274
|
+
e = e.substring(o.raw.length);
|
|
1275
|
+
let p = t.at(-1);
|
|
1276
|
+
o.type === "text" && (p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
1958
1277
|
continue;
|
|
1959
1278
|
}
|
|
1960
|
-
if (
|
|
1961
|
-
|
|
1962
|
-
const lastToken = tokens.at(-1);
|
|
1963
|
-
if (token.type === "text" && (lastToken == null ? void 0 : lastToken.type) === "text") {
|
|
1964
|
-
lastToken.raw += token.raw;
|
|
1965
|
-
lastToken.text += token.text;
|
|
1966
|
-
} else {
|
|
1967
|
-
tokens.push(token);
|
|
1968
|
-
}
|
|
1279
|
+
if (o = this.tokenizer.emStrong(e, n, a)) {
|
|
1280
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1969
1281
|
continue;
|
|
1970
1282
|
}
|
|
1971
|
-
if (
|
|
1972
|
-
|
|
1973
|
-
tokens.push(token);
|
|
1283
|
+
if (o = this.tokenizer.codespan(e)) {
|
|
1284
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1974
1285
|
continue;
|
|
1975
1286
|
}
|
|
1976
|
-
if (
|
|
1977
|
-
|
|
1978
|
-
tokens.push(token);
|
|
1287
|
+
if (o = this.tokenizer.br(e)) {
|
|
1288
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1979
1289
|
continue;
|
|
1980
1290
|
}
|
|
1981
|
-
if (
|
|
1982
|
-
|
|
1983
|
-
tokens.push(token);
|
|
1291
|
+
if (o = this.tokenizer.del(e, n, a)) {
|
|
1292
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1984
1293
|
continue;
|
|
1985
1294
|
}
|
|
1986
|
-
if (
|
|
1987
|
-
|
|
1988
|
-
tokens.push(token);
|
|
1295
|
+
if (o = this.tokenizer.autolink(e)) {
|
|
1296
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1989
1297
|
continue;
|
|
1990
1298
|
}
|
|
1991
|
-
if (
|
|
1992
|
-
|
|
1993
|
-
tokens.push(token);
|
|
1299
|
+
if (!this.state.inLink && (o = this.tokenizer.url(e))) {
|
|
1300
|
+
e = e.substring(o.raw.length), t.push(o);
|
|
1994
1301
|
continue;
|
|
1995
1302
|
}
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1303
|
+
let l = e;
|
|
1304
|
+
if ((_f = this.options.extensions) == null ? void 0 : _f.startInline) {
|
|
1305
|
+
let p = 1 / 0, c = e.slice(1), d;
|
|
1306
|
+
this.options.extensions.startInline.forEach((h) => {
|
|
1307
|
+
d = h.call({ lexer: this }, c), typeof d == "number" && d >= 0 && (p = Math.min(p, d));
|
|
1308
|
+
}), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
|
|
1309
|
+
}
|
|
1310
|
+
if (o = this.tokenizer.inlineText(l)) {
|
|
1311
|
+
e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), s = true;
|
|
1312
|
+
let p = t.at(-1);
|
|
1313
|
+
(p == null ? void 0 : p.type) === "text" ? (p.raw += o.raw, p.text += o.text) : t.push(o);
|
|
1999
1314
|
continue;
|
|
2000
1315
|
}
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
let startIndex = Infinity;
|
|
2004
|
-
const tempSrc = src.slice(1);
|
|
2005
|
-
let tempStart;
|
|
2006
|
-
this.options.extensions.startInline.forEach((getStartIndex) => {
|
|
2007
|
-
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
2008
|
-
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
2009
|
-
startIndex = Math.min(startIndex, tempStart);
|
|
2010
|
-
}
|
|
2011
|
-
});
|
|
2012
|
-
if (startIndex < Infinity && startIndex >= 0) {
|
|
2013
|
-
cutSrc = src.substring(0, startIndex + 1);
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
if (token = this.tokenizer.inlineText(cutSrc)) {
|
|
2017
|
-
src = src.substring(token.raw.length);
|
|
2018
|
-
if (token.raw.slice(-1) !== "_") {
|
|
2019
|
-
prevChar = token.raw.slice(-1);
|
|
2020
|
-
}
|
|
2021
|
-
keepPrevChar = true;
|
|
2022
|
-
const lastToken = tokens.at(-1);
|
|
2023
|
-
if ((lastToken == null ? void 0 : lastToken.type) === "text") {
|
|
2024
|
-
lastToken.raw += token.raw;
|
|
2025
|
-
lastToken.text += token.text;
|
|
2026
|
-
} else {
|
|
2027
|
-
tokens.push(token);
|
|
2028
|
-
}
|
|
2029
|
-
continue;
|
|
2030
|
-
}
|
|
2031
|
-
if (src) {
|
|
2032
|
-
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
1316
|
+
if (e) {
|
|
1317
|
+
let p = "Infinite loop on byte: " + e.charCodeAt(0);
|
|
2033
1318
|
if (this.options.silent) {
|
|
2034
|
-
console.error(
|
|
1319
|
+
console.error(p);
|
|
2035
1320
|
break;
|
|
2036
|
-
} else
|
|
2037
|
-
throw new Error(errMsg);
|
|
2038
|
-
}
|
|
1321
|
+
} else throw new Error(p);
|
|
2039
1322
|
}
|
|
2040
1323
|
}
|
|
2041
|
-
return
|
|
1324
|
+
return t;
|
|
2042
1325
|
}
|
|
2043
1326
|
};
|
|
2044
|
-
var
|
|
2045
|
-
|
|
2046
|
-
constructor(options2) {
|
|
1327
|
+
var y = class {
|
|
1328
|
+
constructor(e) {
|
|
2047
1329
|
__publicField(this, "options");
|
|
2048
1330
|
__publicField(this, "parser");
|
|
2049
|
-
this.options =
|
|
1331
|
+
this.options = e || T;
|
|
2050
1332
|
}
|
|
2051
|
-
space(
|
|
1333
|
+
space(e) {
|
|
2052
1334
|
return "";
|
|
2053
1335
|
}
|
|
2054
|
-
code({ text, lang, escaped }) {
|
|
1336
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
2055
1337
|
var _a2;
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
return '<pre><code class="language-' + escape2(langString) + '">' + (escaped ? code : escape2(code, true)) + "</code></pre>\n";
|
|
1338
|
+
let r = (_a2 = (t || "").match(m.notSpaceStart)) == null ? void 0 : _a2[0], i = e.replace(m.endingNewline, "") + `
|
|
1339
|
+
`;
|
|
1340
|
+
return r ? '<pre><code class="language-' + O(r) + '">' + (n ? i : O(i, true)) + `</code></pre>
|
|
1341
|
+
` : "<pre><code>" + (n ? i : O(i, true)) + `</code></pre>
|
|
1342
|
+
`;
|
|
2062
1343
|
}
|
|
2063
|
-
blockquote({ tokens }) {
|
|
2064
|
-
const body = this.parser.parse(tokens);
|
|
1344
|
+
blockquote({ tokens: e }) {
|
|
2065
1345
|
return `<blockquote>
|
|
2066
|
-
${
|
|
1346
|
+
${this.parser.parse(e)}</blockquote>
|
|
2067
1347
|
`;
|
|
2068
1348
|
}
|
|
2069
|
-
html({ text }) {
|
|
2070
|
-
return
|
|
1349
|
+
html({ text: e }) {
|
|
1350
|
+
return e;
|
|
1351
|
+
}
|
|
1352
|
+
def(e) {
|
|
1353
|
+
return "";
|
|
2071
1354
|
}
|
|
2072
|
-
heading({ tokens, depth }) {
|
|
2073
|
-
return `<h${
|
|
1355
|
+
heading({ tokens: e, depth: t }) {
|
|
1356
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
2074
1357
|
`;
|
|
2075
1358
|
}
|
|
2076
|
-
hr(
|
|
2077
|
-
return
|
|
1359
|
+
hr(e) {
|
|
1360
|
+
return `<hr>
|
|
1361
|
+
`;
|
|
2078
1362
|
}
|
|
2079
|
-
list(
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
const item = token.items[j];
|
|
2085
|
-
body += this.listitem(item);
|
|
1363
|
+
list(e) {
|
|
1364
|
+
let t = e.ordered, n = e.start, r = "";
|
|
1365
|
+
for (let a = 0; a < e.items.length; a++) {
|
|
1366
|
+
let o = e.items[a];
|
|
1367
|
+
r += this.listitem(o);
|
|
2086
1368
|
}
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
1369
|
+
let i = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
1370
|
+
return "<" + i + s + `>
|
|
1371
|
+
` + r + "</" + i + `>
|
|
1372
|
+
`;
|
|
2090
1373
|
}
|
|
2091
|
-
listitem(
|
|
2092
|
-
|
|
2093
|
-
let itemBody = "";
|
|
2094
|
-
if (item.task) {
|
|
2095
|
-
const checkbox = this.checkbox({ checked: !!item.checked });
|
|
2096
|
-
if (item.loose) {
|
|
2097
|
-
if (((_a2 = item.tokens[0]) == null ? void 0 : _a2.type) === "paragraph") {
|
|
2098
|
-
item.tokens[0].text = checkbox + " " + item.tokens[0].text;
|
|
2099
|
-
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
|
|
2100
|
-
item.tokens[0].tokens[0].text = checkbox + " " + escape2(item.tokens[0].tokens[0].text);
|
|
2101
|
-
item.tokens[0].tokens[0].escaped = true;
|
|
2102
|
-
}
|
|
2103
|
-
} else {
|
|
2104
|
-
item.tokens.unshift({
|
|
2105
|
-
type: "text",
|
|
2106
|
-
raw: checkbox + " ",
|
|
2107
|
-
text: checkbox + " ",
|
|
2108
|
-
escaped: true
|
|
2109
|
-
});
|
|
2110
|
-
}
|
|
2111
|
-
} else {
|
|
2112
|
-
itemBody += checkbox + " ";
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2115
|
-
itemBody += this.parser.parse(item.tokens, !!item.loose);
|
|
2116
|
-
return `<li>${itemBody}</li>
|
|
1374
|
+
listitem(e) {
|
|
1375
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
2117
1376
|
`;
|
|
2118
1377
|
}
|
|
2119
|
-
checkbox({ checked }) {
|
|
2120
|
-
return "<input " + (
|
|
1378
|
+
checkbox({ checked: e }) {
|
|
1379
|
+
return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
2121
1380
|
}
|
|
2122
|
-
paragraph({ tokens }) {
|
|
2123
|
-
return `<p>${this.parser.parseInline(
|
|
1381
|
+
paragraph({ tokens: e }) {
|
|
1382
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
2124
1383
|
`;
|
|
2125
1384
|
}
|
|
2126
|
-
table(
|
|
2127
|
-
let
|
|
2128
|
-
let
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
if (body) body = `<tbody>${body}</tbody>`;
|
|
2143
|
-
return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
|
|
1385
|
+
table(e) {
|
|
1386
|
+
let t = "", n = "";
|
|
1387
|
+
for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]);
|
|
1388
|
+
t += this.tablerow({ text: n });
|
|
1389
|
+
let r = "";
|
|
1390
|
+
for (let i = 0; i < e.rows.length; i++) {
|
|
1391
|
+
let s = e.rows[i];
|
|
1392
|
+
n = "";
|
|
1393
|
+
for (let a = 0; a < s.length; a++) n += this.tablecell(s[a]);
|
|
1394
|
+
r += this.tablerow({ text: n });
|
|
1395
|
+
}
|
|
1396
|
+
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
1397
|
+
<thead>
|
|
1398
|
+
` + t + `</thead>
|
|
1399
|
+
` + r + `</table>
|
|
1400
|
+
`;
|
|
2144
1401
|
}
|
|
2145
|
-
tablerow({ text }) {
|
|
1402
|
+
tablerow({ text: e }) {
|
|
2146
1403
|
return `<tr>
|
|
2147
|
-
${
|
|
1404
|
+
${e}</tr>
|
|
2148
1405
|
`;
|
|
2149
1406
|
}
|
|
2150
|
-
tablecell(
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
const tag2 = token.align ? `<${type} align="${token.align}">` : `<${type}>`;
|
|
2154
|
-
return tag2 + content + `</${type}>
|
|
1407
|
+
tablecell(e) {
|
|
1408
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
1409
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
2155
1410
|
`;
|
|
2156
1411
|
}
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
*/
|
|
2160
|
-
strong({ tokens }) {
|
|
2161
|
-
return `<strong>${this.parser.parseInline(tokens)}</strong>`;
|
|
1412
|
+
strong({ tokens: e }) {
|
|
1413
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
2162
1414
|
}
|
|
2163
|
-
em({ tokens }) {
|
|
2164
|
-
return `<em>${this.parser.parseInline(
|
|
1415
|
+
em({ tokens: e }) {
|
|
1416
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
2165
1417
|
}
|
|
2166
|
-
codespan({ text }) {
|
|
2167
|
-
return `<code>${
|
|
1418
|
+
codespan({ text: e }) {
|
|
1419
|
+
return `<code>${O(e, true)}</code>`;
|
|
2168
1420
|
}
|
|
2169
|
-
br(
|
|
1421
|
+
br(e) {
|
|
2170
1422
|
return "<br>";
|
|
2171
1423
|
}
|
|
2172
|
-
del({ tokens }) {
|
|
2173
|
-
return `<del>${this.parser.parseInline(
|
|
1424
|
+
del({ tokens: e }) {
|
|
1425
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
2174
1426
|
}
|
|
2175
|
-
link({ href, title, tokens }) {
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
href = cleanHref;
|
|
2182
|
-
let out = '<a href="' + href + '"';
|
|
2183
|
-
if (title) {
|
|
2184
|
-
out += ' title="' + escape2(title) + '"';
|
|
2185
|
-
}
|
|
2186
|
-
out += ">" + text + "</a>";
|
|
2187
|
-
return out;
|
|
1427
|
+
link({ href: e, title: t, tokens: n }) {
|
|
1428
|
+
let r = this.parser.parseInline(n), i = X(e);
|
|
1429
|
+
if (i === null) return r;
|
|
1430
|
+
e = i;
|
|
1431
|
+
let s = '<a href="' + e + '"';
|
|
1432
|
+
return t && (s += ' title="' + O(t) + '"'), s += ">" + r + "</a>", s;
|
|
2188
1433
|
}
|
|
2189
|
-
image({ href, title, text, tokens }) {
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
}
|
|
2197
|
-
href = cleanHref;
|
|
2198
|
-
let out = `<img src="${href}" alt="${text}"`;
|
|
2199
|
-
if (title) {
|
|
2200
|
-
out += ` title="${escape2(title)}"`;
|
|
2201
|
-
}
|
|
2202
|
-
out += ">";
|
|
2203
|
-
return out;
|
|
1434
|
+
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1435
|
+
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1436
|
+
let i = X(e);
|
|
1437
|
+
if (i === null) return O(n);
|
|
1438
|
+
e = i;
|
|
1439
|
+
let s = `<img src="${e}" alt="${O(n)}"`;
|
|
1440
|
+
return t && (s += ` title="${O(t)}"`), s += ">", s;
|
|
2204
1441
|
}
|
|
2205
|
-
text(
|
|
2206
|
-
return "tokens" in
|
|
1442
|
+
text(e) {
|
|
1443
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
|
|
2207
1444
|
}
|
|
2208
1445
|
};
|
|
2209
|
-
var
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
return text;
|
|
1446
|
+
var $ = class {
|
|
1447
|
+
strong({ text: e }) {
|
|
1448
|
+
return e;
|
|
2213
1449
|
}
|
|
2214
|
-
em({ text }) {
|
|
2215
|
-
return
|
|
1450
|
+
em({ text: e }) {
|
|
1451
|
+
return e;
|
|
2216
1452
|
}
|
|
2217
|
-
codespan({ text }) {
|
|
2218
|
-
return
|
|
1453
|
+
codespan({ text: e }) {
|
|
1454
|
+
return e;
|
|
2219
1455
|
}
|
|
2220
|
-
del({ text }) {
|
|
2221
|
-
return
|
|
1456
|
+
del({ text: e }) {
|
|
1457
|
+
return e;
|
|
2222
1458
|
}
|
|
2223
|
-
html({ text }) {
|
|
2224
|
-
return
|
|
1459
|
+
html({ text: e }) {
|
|
1460
|
+
return e;
|
|
2225
1461
|
}
|
|
2226
|
-
text({ text }) {
|
|
2227
|
-
return
|
|
1462
|
+
text({ text: e }) {
|
|
1463
|
+
return e;
|
|
2228
1464
|
}
|
|
2229
|
-
link({ text }) {
|
|
2230
|
-
return "" +
|
|
1465
|
+
link({ text: e }) {
|
|
1466
|
+
return "" + e;
|
|
2231
1467
|
}
|
|
2232
|
-
image({ text }) {
|
|
2233
|
-
return "" +
|
|
1468
|
+
image({ text: e }) {
|
|
1469
|
+
return "" + e;
|
|
2234
1470
|
}
|
|
2235
1471
|
br() {
|
|
2236
1472
|
return "";
|
|
2237
1473
|
}
|
|
1474
|
+
checkbox({ raw: e }) {
|
|
1475
|
+
return e;
|
|
1476
|
+
}
|
|
2238
1477
|
};
|
|
2239
|
-
var
|
|
2240
|
-
constructor(
|
|
1478
|
+
var b = class u2 {
|
|
1479
|
+
constructor(e) {
|
|
2241
1480
|
__publicField(this, "options");
|
|
2242
1481
|
__publicField(this, "renderer");
|
|
2243
1482
|
__publicField(this, "textRenderer");
|
|
2244
|
-
this.options =
|
|
2245
|
-
this.options.renderer = this.options.renderer || new _Renderer();
|
|
2246
|
-
this.renderer = this.options.renderer;
|
|
2247
|
-
this.renderer.options = this.options;
|
|
2248
|
-
this.renderer.parser = this;
|
|
2249
|
-
this.textRenderer = new _TextRenderer();
|
|
1483
|
+
this.options = e || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new $();
|
|
2250
1484
|
}
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
*/
|
|
2254
|
-
static parse(tokens, options2) {
|
|
2255
|
-
const parser2 = new __Parser(options2);
|
|
2256
|
-
return parser2.parse(tokens);
|
|
1485
|
+
static parse(e, t) {
|
|
1486
|
+
return new u2(t).parse(e);
|
|
2257
1487
|
}
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
*/
|
|
2261
|
-
static parseInline(tokens, options2) {
|
|
2262
|
-
const parser2 = new __Parser(options2);
|
|
2263
|
-
return parser2.parseInline(tokens);
|
|
1488
|
+
static parseInline(e, t) {
|
|
1489
|
+
return new u2(t).parseInline(e);
|
|
2264
1490
|
}
|
|
2265
|
-
|
|
2266
|
-
* Parse Loop
|
|
2267
|
-
*/
|
|
2268
|
-
parse(tokens, top = true) {
|
|
1491
|
+
parse(e) {
|
|
2269
1492
|
var _a2, _b;
|
|
2270
|
-
let
|
|
2271
|
-
for (let
|
|
2272
|
-
|
|
2273
|
-
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
out += ret || "";
|
|
1493
|
+
let t = "";
|
|
1494
|
+
for (let n = 0; n < e.length; n++) {
|
|
1495
|
+
let r = e[n];
|
|
1496
|
+
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[r.type]) {
|
|
1497
|
+
let s = r, a = this.options.extensions.renderers[s.type].call({ parser: this }, s);
|
|
1498
|
+
if (a !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(s.type)) {
|
|
1499
|
+
t += a || "";
|
|
2278
1500
|
continue;
|
|
2279
1501
|
}
|
|
2280
1502
|
}
|
|
2281
|
-
|
|
2282
|
-
switch (
|
|
1503
|
+
let i = r;
|
|
1504
|
+
switch (i.type) {
|
|
2283
1505
|
case "space": {
|
|
2284
|
-
|
|
2285
|
-
|
|
1506
|
+
t += this.renderer.space(i);
|
|
1507
|
+
break;
|
|
2286
1508
|
}
|
|
2287
1509
|
case "hr": {
|
|
2288
|
-
|
|
2289
|
-
|
|
1510
|
+
t += this.renderer.hr(i);
|
|
1511
|
+
break;
|
|
2290
1512
|
}
|
|
2291
1513
|
case "heading": {
|
|
2292
|
-
|
|
2293
|
-
|
|
1514
|
+
t += this.renderer.heading(i);
|
|
1515
|
+
break;
|
|
2294
1516
|
}
|
|
2295
1517
|
case "code": {
|
|
2296
|
-
|
|
2297
|
-
|
|
1518
|
+
t += this.renderer.code(i);
|
|
1519
|
+
break;
|
|
2298
1520
|
}
|
|
2299
1521
|
case "table": {
|
|
2300
|
-
|
|
2301
|
-
|
|
1522
|
+
t += this.renderer.table(i);
|
|
1523
|
+
break;
|
|
2302
1524
|
}
|
|
2303
1525
|
case "blockquote": {
|
|
2304
|
-
|
|
2305
|
-
|
|
1526
|
+
t += this.renderer.blockquote(i);
|
|
1527
|
+
break;
|
|
2306
1528
|
}
|
|
2307
1529
|
case "list": {
|
|
2308
|
-
|
|
2309
|
-
|
|
1530
|
+
t += this.renderer.list(i);
|
|
1531
|
+
break;
|
|
1532
|
+
}
|
|
1533
|
+
case "checkbox": {
|
|
1534
|
+
t += this.renderer.checkbox(i);
|
|
1535
|
+
break;
|
|
2310
1536
|
}
|
|
2311
1537
|
case "html": {
|
|
2312
|
-
|
|
2313
|
-
|
|
1538
|
+
t += this.renderer.html(i);
|
|
1539
|
+
break;
|
|
1540
|
+
}
|
|
1541
|
+
case "def": {
|
|
1542
|
+
t += this.renderer.def(i);
|
|
1543
|
+
break;
|
|
2314
1544
|
}
|
|
2315
1545
|
case "paragraph": {
|
|
2316
|
-
|
|
2317
|
-
|
|
1546
|
+
t += this.renderer.paragraph(i);
|
|
1547
|
+
break;
|
|
2318
1548
|
}
|
|
2319
1549
|
case "text": {
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
|
|
2323
|
-
textToken = tokens[++i];
|
|
2324
|
-
body += "\n" + this.renderer.text(textToken);
|
|
2325
|
-
}
|
|
2326
|
-
if (top) {
|
|
2327
|
-
out += this.renderer.paragraph({
|
|
2328
|
-
type: "paragraph",
|
|
2329
|
-
raw: body,
|
|
2330
|
-
text: body,
|
|
2331
|
-
tokens: [{ type: "text", raw: body, text: body, escaped: true }]
|
|
2332
|
-
});
|
|
2333
|
-
} else {
|
|
2334
|
-
out += body;
|
|
2335
|
-
}
|
|
2336
|
-
continue;
|
|
1550
|
+
t += this.renderer.text(i);
|
|
1551
|
+
break;
|
|
2337
1552
|
}
|
|
2338
1553
|
default: {
|
|
2339
|
-
|
|
2340
|
-
if (this.options.silent)
|
|
2341
|
-
|
|
2342
|
-
return "";
|
|
2343
|
-
} else {
|
|
2344
|
-
throw new Error(errMsg);
|
|
2345
|
-
}
|
|
1554
|
+
let s = 'Token with "' + i.type + '" type was not found.';
|
|
1555
|
+
if (this.options.silent) return console.error(s), "";
|
|
1556
|
+
throw new Error(s);
|
|
2346
1557
|
}
|
|
2347
1558
|
}
|
|
2348
1559
|
}
|
|
2349
|
-
return
|
|
1560
|
+
return t;
|
|
2350
1561
|
}
|
|
2351
|
-
|
|
2352
|
-
* Parse Inline Tokens
|
|
2353
|
-
*/
|
|
2354
|
-
parseInline(tokens, renderer = this.renderer) {
|
|
1562
|
+
parseInline(e, t = this.renderer) {
|
|
2355
1563
|
var _a2, _b;
|
|
2356
|
-
let
|
|
2357
|
-
for (let
|
|
2358
|
-
|
|
2359
|
-
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[
|
|
2360
|
-
|
|
2361
|
-
if (
|
|
2362
|
-
|
|
1564
|
+
let n = "";
|
|
1565
|
+
for (let r = 0; r < e.length; r++) {
|
|
1566
|
+
let i = e[r];
|
|
1567
|
+
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[i.type]) {
|
|
1568
|
+
let a = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
1569
|
+
if (a !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
|
|
1570
|
+
n += a || "";
|
|
2363
1571
|
continue;
|
|
2364
1572
|
}
|
|
2365
1573
|
}
|
|
2366
|
-
|
|
2367
|
-
switch (
|
|
1574
|
+
let s = i;
|
|
1575
|
+
switch (s.type) {
|
|
2368
1576
|
case "escape": {
|
|
2369
|
-
|
|
1577
|
+
n += t.text(s);
|
|
2370
1578
|
break;
|
|
2371
1579
|
}
|
|
2372
1580
|
case "html": {
|
|
2373
|
-
|
|
1581
|
+
n += t.html(s);
|
|
2374
1582
|
break;
|
|
2375
1583
|
}
|
|
2376
1584
|
case "link": {
|
|
2377
|
-
|
|
1585
|
+
n += t.link(s);
|
|
2378
1586
|
break;
|
|
2379
1587
|
}
|
|
2380
1588
|
case "image": {
|
|
2381
|
-
|
|
1589
|
+
n += t.image(s);
|
|
1590
|
+
break;
|
|
1591
|
+
}
|
|
1592
|
+
case "checkbox": {
|
|
1593
|
+
n += t.checkbox(s);
|
|
2382
1594
|
break;
|
|
2383
1595
|
}
|
|
2384
1596
|
case "strong": {
|
|
2385
|
-
|
|
1597
|
+
n += t.strong(s);
|
|
2386
1598
|
break;
|
|
2387
1599
|
}
|
|
2388
1600
|
case "em": {
|
|
2389
|
-
|
|
1601
|
+
n += t.em(s);
|
|
2390
1602
|
break;
|
|
2391
1603
|
}
|
|
2392
1604
|
case "codespan": {
|
|
2393
|
-
|
|
1605
|
+
n += t.codespan(s);
|
|
2394
1606
|
break;
|
|
2395
1607
|
}
|
|
2396
1608
|
case "br": {
|
|
2397
|
-
|
|
1609
|
+
n += t.br(s);
|
|
2398
1610
|
break;
|
|
2399
1611
|
}
|
|
2400
1612
|
case "del": {
|
|
2401
|
-
|
|
1613
|
+
n += t.del(s);
|
|
2402
1614
|
break;
|
|
2403
1615
|
}
|
|
2404
1616
|
case "text": {
|
|
2405
|
-
|
|
1617
|
+
n += t.text(s);
|
|
2406
1618
|
break;
|
|
2407
1619
|
}
|
|
2408
1620
|
default: {
|
|
2409
|
-
|
|
2410
|
-
if (this.options.silent)
|
|
2411
|
-
|
|
2412
|
-
return "";
|
|
2413
|
-
} else {
|
|
2414
|
-
throw new Error(errMsg);
|
|
2415
|
-
}
|
|
1621
|
+
let a = 'Token with "' + s.type + '" type was not found.';
|
|
1622
|
+
if (this.options.silent) return console.error(a), "";
|
|
1623
|
+
throw new Error(a);
|
|
2416
1624
|
}
|
|
2417
1625
|
}
|
|
2418
1626
|
}
|
|
2419
|
-
return
|
|
1627
|
+
return n;
|
|
2420
1628
|
}
|
|
2421
1629
|
};
|
|
2422
1630
|
var _a;
|
|
2423
|
-
var
|
|
2424
|
-
constructor(
|
|
1631
|
+
var P = (_a = class {
|
|
1632
|
+
constructor(e) {
|
|
2425
1633
|
__publicField(this, "options");
|
|
2426
1634
|
__publicField(this, "block");
|
|
2427
|
-
this.options =
|
|
1635
|
+
this.options = e || T;
|
|
2428
1636
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
*/
|
|
2432
|
-
preprocess(markdown) {
|
|
2433
|
-
return markdown;
|
|
1637
|
+
preprocess(e) {
|
|
1638
|
+
return e;
|
|
2434
1639
|
}
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
*/
|
|
2438
|
-
postprocess(html2) {
|
|
2439
|
-
return html2;
|
|
1640
|
+
postprocess(e) {
|
|
1641
|
+
return e;
|
|
2440
1642
|
}
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
return
|
|
1643
|
+
processAllTokens(e) {
|
|
1644
|
+
return e;
|
|
1645
|
+
}
|
|
1646
|
+
emStrongMask(e) {
|
|
1647
|
+
return e;
|
|
2446
1648
|
}
|
|
2447
|
-
/**
|
|
2448
|
-
* Provide function to tokenize markdown
|
|
2449
|
-
*/
|
|
2450
1649
|
provideLexer() {
|
|
2451
|
-
return this.block ?
|
|
1650
|
+
return this.block ? x.lex : x.lexInline;
|
|
2452
1651
|
}
|
|
2453
|
-
/**
|
|
2454
|
-
* Provide function to parse tokens
|
|
2455
|
-
*/
|
|
2456
1652
|
provideParser() {
|
|
2457
|
-
return this.block ?
|
|
2458
|
-
}
|
|
2459
|
-
}, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
])), _a);
|
|
2464
|
-
var Marked = class {
|
|
2465
|
-
constructor(...args) {
|
|
2466
|
-
__publicField(this, "defaults", _getDefaults());
|
|
1653
|
+
return this.block ? b.parse : b.parseInline;
|
|
1654
|
+
}
|
|
1655
|
+
}, __publicField(_a, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), __publicField(_a, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), _a);
|
|
1656
|
+
var B = class {
|
|
1657
|
+
constructor(...e) {
|
|
1658
|
+
__publicField(this, "defaults", M());
|
|
2467
1659
|
__publicField(this, "options", this.setOptions);
|
|
2468
1660
|
__publicField(this, "parse", this.parseMarkdown(true));
|
|
2469
1661
|
__publicField(this, "parseInline", this.parseMarkdown(false));
|
|
2470
|
-
__publicField(this, "Parser",
|
|
2471
|
-
__publicField(this, "Renderer",
|
|
2472
|
-
__publicField(this, "TextRenderer",
|
|
2473
|
-
__publicField(this, "Lexer",
|
|
2474
|
-
__publicField(this, "Tokenizer",
|
|
2475
|
-
__publicField(this, "Hooks",
|
|
2476
|
-
this.use(...
|
|
2477
|
-
}
|
|
2478
|
-
|
|
2479
|
-
* Run callback for every token
|
|
2480
|
-
*/
|
|
2481
|
-
walkTokens(tokens, callback) {
|
|
1662
|
+
__publicField(this, "Parser", b);
|
|
1663
|
+
__publicField(this, "Renderer", y);
|
|
1664
|
+
__publicField(this, "TextRenderer", $);
|
|
1665
|
+
__publicField(this, "Lexer", x);
|
|
1666
|
+
__publicField(this, "Tokenizer", w);
|
|
1667
|
+
__publicField(this, "Hooks", P);
|
|
1668
|
+
this.use(...e);
|
|
1669
|
+
}
|
|
1670
|
+
walkTokens(e, t) {
|
|
2482
1671
|
var _a2, _b;
|
|
2483
|
-
let
|
|
2484
|
-
for (
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
}
|
|
2529
|
-
if ("
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
if (ret === false) {
|
|
2535
|
-
ret = prevRenderer.apply(this, args2);
|
|
2536
|
-
}
|
|
2537
|
-
return ret;
|
|
2538
|
-
};
|
|
2539
|
-
} else {
|
|
2540
|
-
extensions.renderers[ext.name] = ext.renderer;
|
|
2541
|
-
}
|
|
2542
|
-
}
|
|
2543
|
-
if ("tokenizer" in ext) {
|
|
2544
|
-
if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
|
|
2545
|
-
throw new Error("extension level must be 'block' or 'inline'");
|
|
2546
|
-
}
|
|
2547
|
-
const extLevel = extensions[ext.level];
|
|
2548
|
-
if (extLevel) {
|
|
2549
|
-
extLevel.unshift(ext.tokenizer);
|
|
2550
|
-
} else {
|
|
2551
|
-
extensions[ext.level] = [ext.tokenizer];
|
|
2552
|
-
}
|
|
2553
|
-
if (ext.start) {
|
|
2554
|
-
if (ext.level === "block") {
|
|
2555
|
-
if (extensions.startBlock) {
|
|
2556
|
-
extensions.startBlock.push(ext.start);
|
|
2557
|
-
} else {
|
|
2558
|
-
extensions.startBlock = [ext.start];
|
|
2559
|
-
}
|
|
2560
|
-
} else if (ext.level === "inline") {
|
|
2561
|
-
if (extensions.startInline) {
|
|
2562
|
-
extensions.startInline.push(ext.start);
|
|
2563
|
-
} else {
|
|
2564
|
-
extensions.startInline = [ext.start];
|
|
2565
|
-
}
|
|
2566
|
-
}
|
|
2567
|
-
}
|
|
2568
|
-
}
|
|
2569
|
-
if ("childTokens" in ext && ext.childTokens) {
|
|
2570
|
-
extensions.childTokens[ext.name] = ext.childTokens;
|
|
2571
|
-
}
|
|
2572
|
-
});
|
|
2573
|
-
opts.extensions = extensions;
|
|
2574
|
-
}
|
|
2575
|
-
if (pack.renderer) {
|
|
2576
|
-
const renderer = this.defaults.renderer || new _Renderer(this.defaults);
|
|
2577
|
-
for (const prop in pack.renderer) {
|
|
2578
|
-
if (!(prop in renderer)) {
|
|
2579
|
-
throw new Error(`renderer '${prop}' does not exist`);
|
|
2580
|
-
}
|
|
2581
|
-
if (["options", "parser"].includes(prop)) {
|
|
2582
|
-
continue;
|
|
2583
|
-
}
|
|
2584
|
-
const rendererProp = prop;
|
|
2585
|
-
const rendererFunc = pack.renderer[rendererProp];
|
|
2586
|
-
const prevRenderer = renderer[rendererProp];
|
|
2587
|
-
renderer[rendererProp] = (...args2) => {
|
|
2588
|
-
let ret = rendererFunc.apply(renderer, args2);
|
|
2589
|
-
if (ret === false) {
|
|
2590
|
-
ret = prevRenderer.apply(renderer, args2);
|
|
2591
|
-
}
|
|
2592
|
-
return ret || "";
|
|
1672
|
+
let n = [];
|
|
1673
|
+
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
1674
|
+
case "table": {
|
|
1675
|
+
let i = r;
|
|
1676
|
+
for (let s of i.header) n = n.concat(this.walkTokens(s.tokens, t));
|
|
1677
|
+
for (let s of i.rows) for (let a of s) n = n.concat(this.walkTokens(a.tokens, t));
|
|
1678
|
+
break;
|
|
1679
|
+
}
|
|
1680
|
+
case "list": {
|
|
1681
|
+
let i = r;
|
|
1682
|
+
n = n.concat(this.walkTokens(i.items, t));
|
|
1683
|
+
break;
|
|
1684
|
+
}
|
|
1685
|
+
default: {
|
|
1686
|
+
let i = r;
|
|
1687
|
+
((_b = (_a2 = this.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[i.type]) ? this.defaults.extensions.childTokens[i.type].forEach((s) => {
|
|
1688
|
+
let a = i[s].flat(1 / 0);
|
|
1689
|
+
n = n.concat(this.walkTokens(a, t));
|
|
1690
|
+
}) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
return n;
|
|
1694
|
+
}
|
|
1695
|
+
use(...e) {
|
|
1696
|
+
let t = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
1697
|
+
return e.forEach((n) => {
|
|
1698
|
+
let r = { ...n };
|
|
1699
|
+
if (r.async = this.defaults.async || r.async || false, n.extensions && (n.extensions.forEach((i) => {
|
|
1700
|
+
if (!i.name) throw new Error("extension name required");
|
|
1701
|
+
if ("renderer" in i) {
|
|
1702
|
+
let s = t.renderers[i.name];
|
|
1703
|
+
s ? t.renderers[i.name] = function(...a) {
|
|
1704
|
+
let o = i.renderer.apply(this, a);
|
|
1705
|
+
return o === false && (o = s.apply(this, a)), o;
|
|
1706
|
+
} : t.renderers[i.name] = i.renderer;
|
|
1707
|
+
}
|
|
1708
|
+
if ("tokenizer" in i) {
|
|
1709
|
+
if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
1710
|
+
let s = t[i.level];
|
|
1711
|
+
s ? s.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start]));
|
|
1712
|
+
}
|
|
1713
|
+
"childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens);
|
|
1714
|
+
}), r.extensions = t), n.renderer) {
|
|
1715
|
+
let i = this.defaults.renderer || new y(this.defaults);
|
|
1716
|
+
for (let s in n.renderer) {
|
|
1717
|
+
if (!(s in i)) throw new Error(`renderer '${s}' does not exist`);
|
|
1718
|
+
if (["options", "parser"].includes(s)) continue;
|
|
1719
|
+
let a = s, o = n.renderer[a], l = i[a];
|
|
1720
|
+
i[a] = (...p) => {
|
|
1721
|
+
let c = o.apply(i, p);
|
|
1722
|
+
return c === false && (c = l.apply(i, p)), c || "";
|
|
2593
1723
|
};
|
|
2594
1724
|
}
|
|
2595
|
-
|
|
2596
|
-
}
|
|
2597
|
-
if (
|
|
2598
|
-
|
|
2599
|
-
for (
|
|
2600
|
-
if (!(
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
const tokenizerProp = prop;
|
|
2607
|
-
const tokenizerFunc = pack.tokenizer[tokenizerProp];
|
|
2608
|
-
const prevTokenizer = tokenizer[tokenizerProp];
|
|
2609
|
-
tokenizer[tokenizerProp] = (...args2) => {
|
|
2610
|
-
let ret = tokenizerFunc.apply(tokenizer, args2);
|
|
2611
|
-
if (ret === false) {
|
|
2612
|
-
ret = prevTokenizer.apply(tokenizer, args2);
|
|
2613
|
-
}
|
|
2614
|
-
return ret;
|
|
1725
|
+
r.renderer = i;
|
|
1726
|
+
}
|
|
1727
|
+
if (n.tokenizer) {
|
|
1728
|
+
let i = this.defaults.tokenizer || new w(this.defaults);
|
|
1729
|
+
for (let s in n.tokenizer) {
|
|
1730
|
+
if (!(s in i)) throw new Error(`tokenizer '${s}' does not exist`);
|
|
1731
|
+
if (["options", "rules", "lexer"].includes(s)) continue;
|
|
1732
|
+
let a = s, o = n.tokenizer[a], l = i[a];
|
|
1733
|
+
i[a] = (...p) => {
|
|
1734
|
+
let c = o.apply(i, p);
|
|
1735
|
+
return c === false && (c = l.apply(i, p)), c;
|
|
2615
1736
|
};
|
|
2616
1737
|
}
|
|
2617
|
-
|
|
2618
|
-
}
|
|
2619
|
-
if (
|
|
2620
|
-
|
|
2621
|
-
for (
|
|
2622
|
-
if (!(
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
};
|
|
2641
|
-
} else {
|
|
2642
|
-
hooks[hooksProp] = (...args2) => {
|
|
2643
|
-
let ret = hooksFunc.apply(hooks, args2);
|
|
2644
|
-
if (ret === false) {
|
|
2645
|
-
ret = prevHook.apply(hooks, args2);
|
|
2646
|
-
}
|
|
2647
|
-
return ret;
|
|
2648
|
-
};
|
|
2649
|
-
}
|
|
1738
|
+
r.tokenizer = i;
|
|
1739
|
+
}
|
|
1740
|
+
if (n.hooks) {
|
|
1741
|
+
let i = this.defaults.hooks || new P();
|
|
1742
|
+
for (let s in n.hooks) {
|
|
1743
|
+
if (!(s in i)) throw new Error(`hook '${s}' does not exist`);
|
|
1744
|
+
if (["options", "block"].includes(s)) continue;
|
|
1745
|
+
let a = s, o = n.hooks[a], l = i[a];
|
|
1746
|
+
P.passThroughHooks.has(s) ? i[a] = (p) => {
|
|
1747
|
+
if (this.defaults.async && P.passThroughHooksRespectAsync.has(s)) return (async () => {
|
|
1748
|
+
let d = await o.call(i, p);
|
|
1749
|
+
return l.call(i, d);
|
|
1750
|
+
})();
|
|
1751
|
+
let c = o.call(i, p);
|
|
1752
|
+
return l.call(i, c);
|
|
1753
|
+
} : i[a] = (...p) => {
|
|
1754
|
+
if (this.defaults.async) return (async () => {
|
|
1755
|
+
let d = await o.apply(i, p);
|
|
1756
|
+
return d === false && (d = await l.apply(i, p)), d;
|
|
1757
|
+
})();
|
|
1758
|
+
let c = o.apply(i, p);
|
|
1759
|
+
return c === false && (c = l.apply(i, p)), c;
|
|
1760
|
+
};
|
|
2650
1761
|
}
|
|
2651
|
-
|
|
1762
|
+
r.hooks = i;
|
|
2652
1763
|
}
|
|
2653
|
-
if (
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
values.push(packWalktokens.call(this, token));
|
|
2659
|
-
if (walkTokens2) {
|
|
2660
|
-
values = values.concat(walkTokens2.call(this, token));
|
|
2661
|
-
}
|
|
2662
|
-
return values;
|
|
1764
|
+
if (n.walkTokens) {
|
|
1765
|
+
let i = this.defaults.walkTokens, s = n.walkTokens;
|
|
1766
|
+
r.walkTokens = function(a) {
|
|
1767
|
+
let o = [];
|
|
1768
|
+
return o.push(s.call(this, a)), i && (o = o.concat(i.call(this, a))), o;
|
|
2663
1769
|
};
|
|
2664
1770
|
}
|
|
2665
|
-
this.defaults = { ...this.defaults, ...
|
|
2666
|
-
});
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
}
|
|
2690
|
-
if (typeof src !== "string") {
|
|
2691
|
-
return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
|
|
2692
|
-
}
|
|
2693
|
-
if (opt.hooks) {
|
|
2694
|
-
opt.hooks.options = opt;
|
|
2695
|
-
opt.hooks.block = blockType;
|
|
2696
|
-
}
|
|
2697
|
-
const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
|
|
2698
|
-
const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
|
|
2699
|
-
if (opt.async) {
|
|
2700
|
-
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
|
|
2701
|
-
}
|
|
1771
|
+
this.defaults = { ...this.defaults, ...r };
|
|
1772
|
+
}), this;
|
|
1773
|
+
}
|
|
1774
|
+
setOptions(e) {
|
|
1775
|
+
return this.defaults = { ...this.defaults, ...e }, this;
|
|
1776
|
+
}
|
|
1777
|
+
lexer(e, t) {
|
|
1778
|
+
return x.lex(e, t != null ? t : this.defaults);
|
|
1779
|
+
}
|
|
1780
|
+
parser(e, t) {
|
|
1781
|
+
return b.parse(e, t != null ? t : this.defaults);
|
|
1782
|
+
}
|
|
1783
|
+
parseMarkdown(e) {
|
|
1784
|
+
return (n, r) => {
|
|
1785
|
+
let i = { ...r }, s = { ...this.defaults, ...i }, a = this.onError(!!s.silent, !!s.async);
|
|
1786
|
+
if (this.defaults.async === true && i.async === false) return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
1787
|
+
if (typeof n > "u" || n === null) return a(new Error("marked(): input parameter is undefined or null"));
|
|
1788
|
+
if (typeof n != "string") return a(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1789
|
+
if (s.hooks && (s.hooks.options = s, s.hooks.block = e), s.async) return (async () => {
|
|
1790
|
+
let o = s.hooks ? await s.hooks.preprocess(n) : n, p = await (s.hooks ? await s.hooks.provideLexer() : e ? x.lex : x.lexInline)(o, s), c = s.hooks ? await s.hooks.processAllTokens(p) : p;
|
|
1791
|
+
s.walkTokens && await Promise.all(this.walkTokens(c, s.walkTokens));
|
|
1792
|
+
let h = await (s.hooks ? await s.hooks.provideParser() : e ? b.parse : b.parseInline)(c, s);
|
|
1793
|
+
return s.hooks ? await s.hooks.postprocess(h) : h;
|
|
1794
|
+
})().catch(a);
|
|
2702
1795
|
try {
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
let
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
if (opt.walkTokens) {
|
|
2711
|
-
this.walkTokens(tokens, opt.walkTokens);
|
|
2712
|
-
}
|
|
2713
|
-
let html2 = parser2(tokens, opt);
|
|
2714
|
-
if (opt.hooks) {
|
|
2715
|
-
html2 = opt.hooks.postprocess(html2);
|
|
2716
|
-
}
|
|
2717
|
-
return html2;
|
|
2718
|
-
} catch (e) {
|
|
2719
|
-
return throwError(e);
|
|
1796
|
+
s.hooks && (n = s.hooks.preprocess(n));
|
|
1797
|
+
let l = (s.hooks ? s.hooks.provideLexer() : e ? x.lex : x.lexInline)(n, s);
|
|
1798
|
+
s.hooks && (l = s.hooks.processAllTokens(l)), s.walkTokens && this.walkTokens(l, s.walkTokens);
|
|
1799
|
+
let c = (s.hooks ? s.hooks.provideParser() : e ? b.parse : b.parseInline)(l, s);
|
|
1800
|
+
return s.hooks && (c = s.hooks.postprocess(c)), c;
|
|
1801
|
+
} catch (o) {
|
|
1802
|
+
return a(o);
|
|
2720
1803
|
}
|
|
2721
1804
|
};
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
if (async) {
|
|
2730
|
-
return Promise.resolve(msg);
|
|
2731
|
-
}
|
|
2732
|
-
return msg;
|
|
2733
|
-
}
|
|
2734
|
-
if (async) {
|
|
2735
|
-
return Promise.reject(e);
|
|
1805
|
+
}
|
|
1806
|
+
onError(e, t) {
|
|
1807
|
+
return (n) => {
|
|
1808
|
+
if (n.message += `
|
|
1809
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
1810
|
+
let r = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
|
|
1811
|
+
return t ? Promise.resolve(r) : r;
|
|
2736
1812
|
}
|
|
2737
|
-
|
|
1813
|
+
if (t) return Promise.reject(n);
|
|
1814
|
+
throw n;
|
|
2738
1815
|
};
|
|
2739
1816
|
}
|
|
2740
1817
|
};
|
|
2741
|
-
var
|
|
2742
|
-
function
|
|
2743
|
-
return
|
|
1818
|
+
var L = new B();
|
|
1819
|
+
function g(u3, e) {
|
|
1820
|
+
return L.parse(u3, e);
|
|
2744
1821
|
}
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
marked.defaults = markedInstance.defaults;
|
|
2748
|
-
changeDefaults(marked.defaults);
|
|
2749
|
-
return marked;
|
|
1822
|
+
g.options = g.setOptions = function(u3) {
|
|
1823
|
+
return L.setOptions(u3), g.defaults = L.defaults, G(g.defaults), g;
|
|
2750
1824
|
};
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
marked.defaults = markedInstance.defaults;
|
|
2756
|
-
changeDefaults(marked.defaults);
|
|
2757
|
-
return marked;
|
|
1825
|
+
g.getDefaults = M;
|
|
1826
|
+
g.defaults = T;
|
|
1827
|
+
g.use = function(...u3) {
|
|
1828
|
+
return L.use(...u3), g.defaults = L.defaults, G(g.defaults), g;
|
|
2758
1829
|
};
|
|
2759
|
-
|
|
2760
|
-
return
|
|
1830
|
+
g.walkTokens = function(u3, e) {
|
|
1831
|
+
return L.walkTokens(u3, e);
|
|
2761
1832
|
};
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
var
|
|
2773
|
-
var
|
|
2774
|
-
var
|
|
2775
|
-
var
|
|
2776
|
-
var
|
|
2777
|
-
var
|
|
2778
|
-
var
|
|
1833
|
+
g.parseInline = L.parseInline;
|
|
1834
|
+
g.Parser = b;
|
|
1835
|
+
g.parser = b.parse;
|
|
1836
|
+
g.Renderer = y;
|
|
1837
|
+
g.TextRenderer = $;
|
|
1838
|
+
g.Lexer = x;
|
|
1839
|
+
g.lexer = x.lex;
|
|
1840
|
+
g.Tokenizer = w;
|
|
1841
|
+
g.Hooks = P;
|
|
1842
|
+
g.parse = g;
|
|
1843
|
+
var Ut = g.options;
|
|
1844
|
+
var Kt = g.setOptions;
|
|
1845
|
+
var Wt = g.use;
|
|
1846
|
+
var Xt = g.walkTokens;
|
|
1847
|
+
var Jt = g.parseInline;
|
|
1848
|
+
var Yt = b.parse;
|
|
1849
|
+
var en = x.lex;
|
|
2779
1850
|
|
|
2780
1851
|
// ../adaptives/adaptive-faq/dist/FAQWidget.js
|
|
2781
1852
|
import React2, { useCallback as useCallback2, useEffect as useEffect2, useMemo, useReducer, useState as useState2 } from "react";
|
|
2782
1853
|
import { createRoot as createRoot2 } from "react-dom/client";
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
if (typeof answer === "string")
|
|
2786
|
-
return answer;
|
|
2787
|
-
if (answer.type === "rich")
|
|
2788
|
-
return answer.html;
|
|
2789
|
-
return answer.content;
|
|
2790
|
-
}
|
|
2791
|
-
function renderAnswer(answer) {
|
|
2792
|
-
if (typeof answer === "string") {
|
|
2793
|
-
return _jsx2("p", { style: { margin: 0 }, children: answer });
|
|
2794
|
-
}
|
|
2795
|
-
if (answer.type === "rich") {
|
|
2796
|
-
return _jsx2("div", { style: { margin: 0 }, dangerouslySetInnerHTML: { __html: answer.html } });
|
|
2797
|
-
}
|
|
2798
|
-
const html2 = marked2.parse(answer.content);
|
|
2799
|
-
return (
|
|
2800
|
-
// biome-ignore lint/security/noDangerouslySetInnerHtml: markdown content is CMS/config content, not user-controlled input
|
|
2801
|
-
_jsx2("div", { style: { margin: 0 }, "data-faq-markdown": "", dangerouslySetInnerHTML: { __html: html2 } })
|
|
2802
|
-
);
|
|
2803
|
-
}
|
|
2804
|
-
function resolveFeedbackConfig(feedback) {
|
|
2805
|
-
if (!feedback)
|
|
2806
|
-
return null;
|
|
2807
|
-
if (feedback === true) {
|
|
2808
|
-
return { style: "thumbs" };
|
|
2809
|
-
}
|
|
2810
|
-
return feedback;
|
|
2811
|
-
}
|
|
2812
|
-
function getFeedbackPrompt(feedbackConfig) {
|
|
2813
|
-
return feedbackConfig.prompt || "Was this helpful?";
|
|
2814
|
-
}
|
|
1854
|
+
|
|
1855
|
+
// ../adaptives/adaptive-faq/dist/faq-styles.js
|
|
2815
1856
|
var baseStyles = {
|
|
2816
1857
|
container: {
|
|
2817
1858
|
fontFamily: "var(--sc-font-family, system-ui, -apple-system, sans-serif)",
|
|
@@ -3003,6 +2044,44 @@ var themeStyles = {
|
|
|
3003
2044
|
}
|
|
3004
2045
|
}
|
|
3005
2046
|
};
|
|
2047
|
+
|
|
2048
|
+
// ../adaptives/adaptive-faq/dist/FAQWidget.js
|
|
2049
|
+
var marked = new B({ async: false, gfm: true, breaks: true });
|
|
2050
|
+
function getAnswerText(answer) {
|
|
2051
|
+
if (typeof answer === "string")
|
|
2052
|
+
return answer;
|
|
2053
|
+
if (answer.type === "rich")
|
|
2054
|
+
return answer.html;
|
|
2055
|
+
return answer.content;
|
|
2056
|
+
}
|
|
2057
|
+
function renderAnswer(answer) {
|
|
2058
|
+
if (typeof answer === "string") {
|
|
2059
|
+
const html2 = marked.parse(answer);
|
|
2060
|
+
return (
|
|
2061
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: content is CMS/config content, not user-controlled input
|
|
2062
|
+
_jsx2("div", { style: { margin: 0 }, "data-faq-markdown": "", dangerouslySetInnerHTML: { __html: html2 } })
|
|
2063
|
+
);
|
|
2064
|
+
}
|
|
2065
|
+
if (answer.type === "rich") {
|
|
2066
|
+
return _jsx2("div", { style: { margin: 0 }, dangerouslySetInnerHTML: { __html: answer.html } });
|
|
2067
|
+
}
|
|
2068
|
+
const html = marked.parse(answer.content);
|
|
2069
|
+
return (
|
|
2070
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: markdown content is CMS/config content, not user-controlled input
|
|
2071
|
+
_jsx2("div", { style: { margin: 0 }, "data-faq-markdown": "", dangerouslySetInnerHTML: { __html: html } })
|
|
2072
|
+
);
|
|
2073
|
+
}
|
|
2074
|
+
function resolveFeedbackConfig(feedback) {
|
|
2075
|
+
if (!feedback)
|
|
2076
|
+
return null;
|
|
2077
|
+
if (feedback === true) {
|
|
2078
|
+
return { style: "thumbs" };
|
|
2079
|
+
}
|
|
2080
|
+
return feedback;
|
|
2081
|
+
}
|
|
2082
|
+
function getFeedbackPrompt(feedbackConfig) {
|
|
2083
|
+
return feedbackConfig.prompt || "Was this helpful?";
|
|
2084
|
+
}
|
|
3006
2085
|
function FAQItem({ item, isExpanded, isHighlighted, isLast, onToggle, theme, feedbackConfig, feedbackValue, onFeedback }) {
|
|
3007
2086
|
const [isHovered, setIsHovered] = useState2(false);
|
|
3008
2087
|
const colors = themeStyles[theme];
|
|
@@ -3012,7 +2091,8 @@ function FAQItem({ item, isExpanded, isHighlighted, isLast, onToggle, theme, fee
|
|
|
3012
2091
|
...colors.item,
|
|
3013
2092
|
...isExpanded ? colors.itemExpanded : {},
|
|
3014
2093
|
...isHighlighted ? {
|
|
3015
|
-
|
|
2094
|
+
// purple[4] = #6a59ce — design system primary purple
|
|
2095
|
+
boxShadow: `0 0 0 2px ${purple[4]}, 0 0 12px rgba(106, 89, 206, 0.4)`,
|
|
3016
2096
|
transition: "box-shadow 0.3s ease"
|
|
3017
2097
|
} : {},
|
|
3018
2098
|
...!isLast ? { borderBottom: "var(--sc-content-item-divider, none)" } : {}
|
|
@@ -3045,7 +2125,7 @@ function FAQItem({ item, isExpanded, isHighlighted, isLast, onToggle, theme, fee
|
|
|
3045
2125
|
}, "aria-label": "Thumbs down", onClick: () => onFeedback(item.config.id, question, "down"), children: "\u{1F44E}" })] })] })] });
|
|
3046
2126
|
}
|
|
3047
2127
|
function FAQWidget({ config, runtime: runtime7, instanceId }) {
|
|
3048
|
-
const [renderTick, forceUpdate] = useReducer((
|
|
2128
|
+
const [renderTick, forceUpdate] = useReducer((x2) => x2 + 1, 0);
|
|
3049
2129
|
const [expandedIds, setExpandedIds] = useState2(/* @__PURE__ */ new Set());
|
|
3050
2130
|
const [highlightId, setHighlightId] = useState2(null);
|
|
3051
2131
|
const [searchQuery, setSearchQuery] = useState2("");
|
|
@@ -3134,17 +2214,20 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
|
|
|
3134
2214
|
const unsubscribe = runtime7.events.subscribe({ names: ["notification.deep_link"] }, handleDeepLink);
|
|
3135
2215
|
return unsubscribe;
|
|
3136
2216
|
}, [runtime7, instanceId]);
|
|
3137
|
-
const visibleQuestions = useMemo(() =>
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
2217
|
+
const visibleQuestions = useMemo(() => {
|
|
2218
|
+
var _a2;
|
|
2219
|
+
return ((_a2 = config.actions) != null ? _a2 : []).filter((q2) => {
|
|
2220
|
+
if (!q2.triggerWhen)
|
|
2221
|
+
return true;
|
|
2222
|
+
const result = runtime7.evaluateSync(q2.triggerWhen);
|
|
2223
|
+
return result.value;
|
|
2224
|
+
});
|
|
2225
|
+
}, [config.actions, runtime7, renderTick]);
|
|
3143
2226
|
const orderedQuestions = useMemo(() => {
|
|
3144
2227
|
if (config.ordering === "priority") {
|
|
3145
|
-
return [...visibleQuestions].sort((a,
|
|
2228
|
+
return [...visibleQuestions].sort((a, b2) => {
|
|
3146
2229
|
var _a2, _b;
|
|
3147
|
-
return ((_a2 =
|
|
2230
|
+
return ((_a2 = b2.config.priority) != null ? _a2 : 0) - ((_b = a.config.priority) != null ? _b : 0);
|
|
3148
2231
|
});
|
|
3149
2232
|
}
|
|
3150
2233
|
return visibleQuestions;
|
|
@@ -3154,23 +2237,23 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
|
|
|
3154
2237
|
return orderedQuestions;
|
|
3155
2238
|
}
|
|
3156
2239
|
const query = searchQuery.toLowerCase();
|
|
3157
|
-
return orderedQuestions.filter((
|
|
2240
|
+
return orderedQuestions.filter((q2) => {
|
|
3158
2241
|
var _a2;
|
|
3159
|
-
return
|
|
2242
|
+
return q2.config.question.toLowerCase().includes(query) || getAnswerText(q2.config.answer).toLowerCase().includes(query) || ((_a2 = q2.config.category) == null ? void 0 : _a2.toLowerCase().includes(query));
|
|
3160
2243
|
});
|
|
3161
2244
|
}, [orderedQuestions, searchQuery, config.searchable]);
|
|
3162
2245
|
const categoryGroups = useMemo(() => {
|
|
3163
2246
|
const groups = /* @__PURE__ */ new Map();
|
|
3164
|
-
for (const
|
|
3165
|
-
const cat =
|
|
2247
|
+
for (const q2 of filteredQuestions) {
|
|
2248
|
+
const cat = q2.config.category;
|
|
3166
2249
|
if (!groups.has(cat)) {
|
|
3167
2250
|
groups.set(cat, []);
|
|
3168
2251
|
}
|
|
3169
|
-
groups.get(cat).push(
|
|
2252
|
+
groups.get(cat).push(q2);
|
|
3170
2253
|
}
|
|
3171
2254
|
return groups;
|
|
3172
2255
|
}, [filteredQuestions]);
|
|
3173
|
-
const hasCategories = useMemo(() => filteredQuestions.some((
|
|
2256
|
+
const hasCategories = useMemo(() => filteredQuestions.some((q2) => q2.config.category), [filteredQuestions]);
|
|
3174
2257
|
const resolvedTheme = useMemo(() => {
|
|
3175
2258
|
var _a2;
|
|
3176
2259
|
if (config.theme && config.theme !== "auto")
|
|
@@ -3231,7 +2314,7 @@ function FAQWidget({ config, runtime: runtime7, instanceId }) {
|
|
|
3231
2314
|
...baseStyles.categoryHeader,
|
|
3232
2315
|
...themeStyles[resolvedTheme].categoryHeader
|
|
3233
2316
|
};
|
|
3234
|
-
const renderItems = (items) => items.map((
|
|
2317
|
+
const renderItems = (items) => items.map((q2, index) => _jsx2(FAQItem, { item: q2, isExpanded: expandedIds.has(q2.config.id), isHighlighted: highlightId === q2.config.id, isLast: index === items.length - 1, onToggle: () => handleToggle(q2.config.id), theme: resolvedTheme, feedbackConfig, feedbackValue: feedbackState.get(q2.config.id), onFeedback: handleFeedback }, q2.config.id));
|
|
3235
2318
|
if (visibleQuestions.length === 0) {
|
|
3236
2319
|
return _jsx2("div", { style: containerStyle, "data-adaptive-id": instanceId, "data-adaptive-type": "adaptive-faq", children: _jsx2("div", { style: emptyStateStyle, children: "You're all set for now! We'll surface answers here when they're relevant to what you're doing." }) });
|
|
3237
2320
|
}
|
|
@@ -3256,20 +2339,6 @@ var FAQMountableWidget = {
|
|
|
3256
2339
|
root.unmount();
|
|
3257
2340
|
};
|
|
3258
2341
|
}
|
|
3259
|
-
const questions = faqConfig.actions || [];
|
|
3260
|
-
container.innerHTML = `
|
|
3261
|
-
<div style="font-family: system-ui; max-width: 800px;">
|
|
3262
|
-
${questions.map((q) => `
|
|
3263
|
-
<div style="margin-bottom: 8px; padding: 16px; background: ${slateGrey[12]}; border-radius: 8px;">
|
|
3264
|
-
<strong>${q.config.question}</strong>
|
|
3265
|
-
<p style="margin-top: 8px; color: ${slateGrey[6]};">${getAnswerText(q.config.answer)}</p>
|
|
3266
|
-
</div>
|
|
3267
|
-
`).join("")}
|
|
3268
|
-
</div>
|
|
3269
|
-
`;
|
|
3270
|
-
return () => {
|
|
3271
|
-
container.innerHTML = "";
|
|
3272
|
-
};
|
|
3273
2342
|
}
|
|
3274
2343
|
};
|
|
3275
2344
|
|
|
@@ -3489,7 +2558,8 @@ var themeStyles2 = {
|
|
|
3489
2558
|
color: "var(--sc-content-text-secondary-color)"
|
|
3490
2559
|
},
|
|
3491
2560
|
linkButton: {
|
|
3492
|
-
|
|
2561
|
+
// purple[4] = #6a59ce — design system primary purple, used as fallback when --sc-color-primary is not set
|
|
2562
|
+
backgroundColor: `var(--sc-color-primary, ${purple[4]})`,
|
|
3493
2563
|
color: "#ffffff"
|
|
3494
2564
|
},
|
|
3495
2565
|
categoryHeader: {
|
|
@@ -3522,7 +2592,8 @@ var themeStyles2 = {
|
|
|
3522
2592
|
color: "var(--sc-content-text-secondary-color)"
|
|
3523
2593
|
},
|
|
3524
2594
|
linkButton: {
|
|
3525
|
-
|
|
2595
|
+
// purple[4] = #6a59ce — design system primary purple, used as fallback when --sc-color-primary is not set
|
|
2596
|
+
backgroundColor: `var(--sc-color-primary, ${purple[4]})`,
|
|
3526
2597
|
color: "#ffffff"
|
|
3527
2598
|
},
|
|
3528
2599
|
categoryHeader: {
|
|
@@ -3592,10 +2663,11 @@ function NavTipItem({ item, isExpanded, isLast, onToggle, onNavigate, onFocusAnc
|
|
|
3592
2663
|
}
|
|
3593
2664
|
};
|
|
3594
2665
|
const ctaLabel = isFocusAction ? `Focus \u2192` : external ? `Go \u2197` : `Go \u2192`;
|
|
3595
|
-
return _jsxs3("div", { style: itemStyle, "data-nav-tip-id": item.config.id, children: [_jsxs3("button", { type: "button", style: headerStyle, onClick: onToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-expanded": isExpanded, children: [icon &&
|
|
2666
|
+
return _jsxs3("div", { style: itemStyle, "data-nav-tip-id": item.config.id, children: [_jsxs3("button", { type: "button", style: headerStyle, onClick: onToggle, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-expanded": isExpanded, children: [icon && // biome-ignore lint/security/noDangerouslySetInnerHtml: renderIcon returns sanitized SVG from EMOJI_SVG_MAP or escapeHtml
|
|
2667
|
+
_jsx3("span", { style: baseStyles2.icon, dangerouslySetInnerHTML: { __html: renderIcon(icon) } }), _jsx3("span", { children: title }), _jsx3("span", { style: chevronStyle, children: "\u203A" })] }), _jsxs3("div", { style: bodyStyle, "aria-hidden": !isExpanded, children: [_jsx3("p", { style: baseStyles2.description, children: description }), hasAction && _jsx3("a", { href: effectiveHref || "#", onClick: handleLinkClick, style: { ...baseStyles2.linkButton, ...colors.linkButton }, target: external ? "_blank" : void 0, rel: external ? "noopener noreferrer" : void 0, children: ctaLabel })] })] });
|
|
3596
2668
|
}
|
|
3597
2669
|
function NavWidget({ config, runtime: runtime7, instanceId }) {
|
|
3598
|
-
const [renderTick, forceUpdate] = useReducer2((
|
|
2670
|
+
const [renderTick, forceUpdate] = useReducer2((x2) => x2 + 1, 0);
|
|
3599
2671
|
const [expandedIds, setExpandedIds] = useState3(/* @__PURE__ */ new Set());
|
|
3600
2672
|
useEffect3(() => {
|
|
3601
2673
|
const unsubscribe = runtime7.context.subscribe(() => {
|
|
@@ -3691,8 +2763,10 @@ function NavWidget({ config, runtime: runtime7, instanceId }) {
|
|
|
3691
2763
|
} else {
|
|
3692
2764
|
const url = new URL(href, window.location.origin);
|
|
3693
2765
|
url.search = window.location.search;
|
|
3694
|
-
|
|
3695
|
-
|
|
2766
|
+
if (!navigateWithFrameworkRouter(url.toString())) {
|
|
2767
|
+
window.history.pushState(null, "", url.toString());
|
|
2768
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2769
|
+
}
|
|
3696
2770
|
}
|
|
3697
2771
|
}, [runtime7.events, instanceId]);
|
|
3698
2772
|
const handleFocusAnchor = useCallback3((anchor) => {
|
|
@@ -3745,21 +2819,6 @@ var NavMountableWidget = {
|
|
|
3745
2819
|
root.unmount();
|
|
3746
2820
|
};
|
|
3747
2821
|
}
|
|
3748
|
-
const tips = navConfig.actions || [];
|
|
3749
|
-
container.innerHTML = `
|
|
3750
|
-
<div style="font-family: system-ui; max-width: 100%;">
|
|
3751
|
-
${tips.map((tip) => `
|
|
3752
|
-
<div style="margin-bottom: 4px; padding: 12px 16px; background: ${slateGrey[12]}; border-radius: 8px;">
|
|
3753
|
-
${tip.config.icon ? `<span>${renderIcon(tip.config.icon)}</span> ` : ""}<strong>${escapeHtml(tip.config.title)}</strong>
|
|
3754
|
-
<p style="margin-top: 8px; color: ${slateGrey[6]}; font-size: 13px;">${escapeHtml(tip.config.description)}</p>
|
|
3755
|
-
${tip.config.href ? `<a href="${escapeHtml(tip.config.href)}" style="color: ${purple[2]}; font-size: 13px;">Go →</a>` : ""}
|
|
3756
|
-
</div>
|
|
3757
|
-
`).join("")}
|
|
3758
|
-
</div>
|
|
3759
|
-
`;
|
|
3760
|
-
return () => {
|
|
3761
|
-
container.innerHTML = "";
|
|
3762
|
-
};
|
|
3763
2822
|
}
|
|
3764
2823
|
};
|
|
3765
2824
|
|
|
@@ -3788,6 +2847,40 @@ var executeScrollTo = async (action, context) => {
|
|
|
3788
2847
|
}
|
|
3789
2848
|
};
|
|
3790
2849
|
};
|
|
2850
|
+
function navigateWithFrameworkRouter(url) {
|
|
2851
|
+
var _a2, _b, _c, _d;
|
|
2852
|
+
if (typeof window === "undefined")
|
|
2853
|
+
return false;
|
|
2854
|
+
const w2 = window;
|
|
2855
|
+
try {
|
|
2856
|
+
const nextRouter = (_a2 = w2.next) == null ? void 0 : _a2.router;
|
|
2857
|
+
if (nextRouter == null ? void 0 : nextRouter.push) {
|
|
2858
|
+
nextRouter.push(url);
|
|
2859
|
+
return true;
|
|
2860
|
+
}
|
|
2861
|
+
} catch {
|
|
2862
|
+
}
|
|
2863
|
+
try {
|
|
2864
|
+
if ((_c = (_b = w2.$nuxt) == null ? void 0 : _b.$router) == null ? void 0 : _c.push) {
|
|
2865
|
+
w2.$nuxt.$router.push(url);
|
|
2866
|
+
return true;
|
|
2867
|
+
}
|
|
2868
|
+
} catch {
|
|
2869
|
+
}
|
|
2870
|
+
if (w2.ng || w2.getAllAngularRootElements || document.querySelector("[ng-version]")) {
|
|
2871
|
+
window.location.href = url;
|
|
2872
|
+
return true;
|
|
2873
|
+
}
|
|
2874
|
+
if (w2.__SVELTEKIT_DATA__ || ((_d = document.body) == null ? void 0 : _d.hasAttribute("data-sveltekit"))) {
|
|
2875
|
+
window.location.href = url;
|
|
2876
|
+
return true;
|
|
2877
|
+
}
|
|
2878
|
+
if (document.querySelector("[data-astro-transition-fallback]")) {
|
|
2879
|
+
window.location.href = url;
|
|
2880
|
+
return true;
|
|
2881
|
+
}
|
|
2882
|
+
return false;
|
|
2883
|
+
}
|
|
3791
2884
|
function isSameOrigin(url) {
|
|
3792
2885
|
try {
|
|
3793
2886
|
const parsed = new URL(url, window.location.origin);
|
|
@@ -3812,8 +2905,10 @@ var executeNavigate = async (action, context) => {
|
|
|
3812
2905
|
if (target === "_blank") {
|
|
3813
2906
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
3814
2907
|
} else if (!action.forceFullNavigation && isSameOrigin(url)) {
|
|
3815
|
-
|
|
3816
|
-
|
|
2908
|
+
if (!navigateWithFrameworkRouter(url)) {
|
|
2909
|
+
window.history.pushState(null, "", url);
|
|
2910
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2911
|
+
}
|
|
3817
2912
|
} else {
|
|
3818
2913
|
window.location.href = url;
|
|
3819
2914
|
}
|
|
@@ -3904,9 +2999,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3904
2999
|
function TileWheel({ tiles, intervalMs = 7e3, telemetry }) {
|
|
3905
3000
|
const [index, setIndex] = useState4(0);
|
|
3906
3001
|
const ordered = useMemo3(
|
|
3907
|
-
() => [...tiles].sort((a,
|
|
3002
|
+
() => [...tiles].sort((a, b2) => {
|
|
3908
3003
|
var _a2, _b;
|
|
3909
|
-
return ((_a2 = a.priority) != null ? _a2 : 0) - ((_b =
|
|
3004
|
+
return ((_a2 = a.priority) != null ? _a2 : 0) - ((_b = b2.priority) != null ? _b : 0);
|
|
3910
3005
|
}),
|
|
3911
3006
|
[tiles]
|
|
3912
3007
|
);
|
|
@@ -4074,50 +3169,50 @@ function needsMigration(config) {
|
|
|
4074
3169
|
}
|
|
4075
3170
|
|
|
4076
3171
|
// src/overlays/schema.ts
|
|
4077
|
-
import { z } from "zod";
|
|
4078
|
-
var SelectorZ =
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
3172
|
+
import { z as z2 } from "zod";
|
|
3173
|
+
var SelectorZ = z2.union([
|
|
3174
|
+
z2.object({ type: z2.literal("data"), key: z2.string(), value: z2.string().optional() }),
|
|
3175
|
+
z2.object({ type: z2.literal("css"), value: z2.string() }),
|
|
3176
|
+
z2.object({ type: z2.literal("aria"), role: z2.string().optional(), label: z2.string().optional() }),
|
|
3177
|
+
z2.object({ type: z2.literal("shadow-css"), value: z2.string() }),
|
|
3178
|
+
z2.object({ type: z2.literal("ref"), el: z2.any() })
|
|
4084
3179
|
// runtime-only
|
|
4085
3180
|
]);
|
|
4086
|
-
var TooltipStepZ =
|
|
4087
|
-
kind:
|
|
4088
|
-
id:
|
|
3181
|
+
var TooltipStepZ = z2.object({
|
|
3182
|
+
kind: z2.literal("tooltip"),
|
|
3183
|
+
id: z2.string(),
|
|
4089
3184
|
anchor: SelectorZ,
|
|
4090
|
-
content:
|
|
4091
|
-
placement:
|
|
4092
|
-
offsetPx:
|
|
4093
|
-
blocking:
|
|
4094
|
-
trigger:
|
|
4095
|
-
dismiss:
|
|
4096
|
-
onEsc:
|
|
4097
|
-
closeButton:
|
|
4098
|
-
timeoutMs:
|
|
3185
|
+
content: z2.object({ title: z2.string().optional(), body: z2.string() }),
|
|
3186
|
+
placement: z2.enum(["top", "bottom", "left", "right", "auto"]).optional(),
|
|
3187
|
+
offsetPx: z2.number().optional(),
|
|
3188
|
+
blocking: z2.boolean().optional(),
|
|
3189
|
+
trigger: z2.enum(["immediate", "hover", "click"]).optional(),
|
|
3190
|
+
dismiss: z2.object({
|
|
3191
|
+
onEsc: z2.boolean().optional(),
|
|
3192
|
+
closeButton: z2.boolean().optional(),
|
|
3193
|
+
timeoutMs: z2.number().optional()
|
|
4099
3194
|
}).optional()
|
|
4100
3195
|
});
|
|
4101
|
-
var HighlightStepZ =
|
|
4102
|
-
kind:
|
|
4103
|
-
id:
|
|
3196
|
+
var HighlightStepZ = z2.object({
|
|
3197
|
+
kind: z2.literal("highlight"),
|
|
3198
|
+
id: z2.string(),
|
|
4104
3199
|
anchor: SelectorZ,
|
|
4105
|
-
copy:
|
|
4106
|
-
ring:
|
|
4107
|
-
scrim:
|
|
4108
|
-
ringColor:
|
|
4109
|
-
blocking:
|
|
4110
|
-
dismiss:
|
|
4111
|
-
onClickOutside:
|
|
4112
|
-
onEsc:
|
|
4113
|
-
timeoutMs:
|
|
3200
|
+
copy: z2.string().optional(),
|
|
3201
|
+
ring: z2.object({ paddingPx: z2.number().optional(), radiusPx: z2.number().optional() }).optional(),
|
|
3202
|
+
scrim: z2.object({ opacity: z2.number().optional() }).optional(),
|
|
3203
|
+
ringColor: z2.string().optional(),
|
|
3204
|
+
blocking: z2.boolean().optional(),
|
|
3205
|
+
dismiss: z2.object({
|
|
3206
|
+
onClickOutside: z2.boolean().optional(),
|
|
3207
|
+
onEsc: z2.boolean().optional(),
|
|
3208
|
+
timeoutMs: z2.number().optional()
|
|
4114
3209
|
}).optional()
|
|
4115
3210
|
});
|
|
4116
|
-
var CanvasRecipeZ =
|
|
4117
|
-
id:
|
|
4118
|
-
version:
|
|
4119
|
-
routes:
|
|
4120
|
-
steps:
|
|
3211
|
+
var CanvasRecipeZ = z2.object({
|
|
3212
|
+
id: z2.string(),
|
|
3213
|
+
version: z2.number(),
|
|
3214
|
+
routes: z2.array(z2.string()).optional(),
|
|
3215
|
+
steps: z2.array(z2.union([TooltipStepZ, HighlightStepZ]))
|
|
4121
3216
|
});
|
|
4122
3217
|
function validateRecipe(json) {
|
|
4123
3218
|
return CanvasRecipeZ.parse(json);
|
|
@@ -4160,47 +3255,47 @@ function SmartCanvasPortal({ element, children }) {
|
|
|
4160
3255
|
}
|
|
4161
3256
|
|
|
4162
3257
|
// src/context/schema.ts
|
|
4163
|
-
import { z as
|
|
4164
|
-
var PageContextZ =
|
|
4165
|
-
url:
|
|
4166
|
-
routeId:
|
|
4167
|
-
title:
|
|
4168
|
-
locale:
|
|
3258
|
+
import { z as z3 } from "zod";
|
|
3259
|
+
var PageContextZ = z3.object({
|
|
3260
|
+
url: z3.string(),
|
|
3261
|
+
routeId: z3.string().optional(),
|
|
3262
|
+
title: z3.string().optional(),
|
|
3263
|
+
locale: z3.string().optional()
|
|
4169
3264
|
});
|
|
4170
|
-
var PageHistoryEntryZ =
|
|
4171
|
-
url:
|
|
4172
|
-
ts:
|
|
3265
|
+
var PageHistoryEntryZ = z3.object({
|
|
3266
|
+
url: z3.string(),
|
|
3267
|
+
ts: z3.number()
|
|
4173
3268
|
});
|
|
4174
|
-
var SessionContextZ =
|
|
4175
|
-
sessionId:
|
|
4176
|
-
startTs:
|
|
4177
|
-
pageHistory:
|
|
3269
|
+
var SessionContextZ = z3.object({
|
|
3270
|
+
sessionId: z3.string(),
|
|
3271
|
+
startTs: z3.number(),
|
|
3272
|
+
pageHistory: z3.array(PageHistoryEntryZ).optional()
|
|
4178
3273
|
});
|
|
4179
|
-
var ViewportContextZ =
|
|
4180
|
-
width:
|
|
4181
|
-
height:
|
|
3274
|
+
var ViewportContextZ = z3.object({
|
|
3275
|
+
width: z3.number(),
|
|
3276
|
+
height: z3.number()
|
|
4182
3277
|
});
|
|
4183
|
-
var BoundingBoxZ =
|
|
4184
|
-
x:
|
|
4185
|
-
y:
|
|
4186
|
-
w:
|
|
4187
|
-
h:
|
|
3278
|
+
var BoundingBoxZ = z3.object({
|
|
3279
|
+
x: z3.number(),
|
|
3280
|
+
y: z3.number(),
|
|
3281
|
+
w: z3.number(),
|
|
3282
|
+
h: z3.number()
|
|
4188
3283
|
});
|
|
4189
|
-
var AnchorStateZ =
|
|
4190
|
-
anchorId:
|
|
4191
|
-
present:
|
|
4192
|
-
visible:
|
|
3284
|
+
var AnchorStateZ = z3.object({
|
|
3285
|
+
anchorId: z3.string(),
|
|
3286
|
+
present: z3.boolean(),
|
|
3287
|
+
visible: z3.boolean().optional(),
|
|
4193
3288
|
boundingBox: BoundingBoxZ.optional()
|
|
4194
3289
|
});
|
|
4195
|
-
var AugmentationZ =
|
|
4196
|
-
|
|
4197
|
-
|
|
3290
|
+
var AugmentationZ = z3.record(
|
|
3291
|
+
z3.string(),
|
|
3292
|
+
z3.union([z3.number(), z3.string(), z3.boolean(), z3.undefined()])
|
|
4198
3293
|
);
|
|
4199
|
-
var RuntimeContextZ =
|
|
3294
|
+
var RuntimeContextZ = z3.object({
|
|
4200
3295
|
page: PageContextZ,
|
|
4201
3296
|
session: SessionContextZ,
|
|
4202
3297
|
viewport: ViewportContextZ,
|
|
4203
|
-
anchors:
|
|
3298
|
+
anchors: z3.array(AnchorStateZ).optional(),
|
|
4204
3299
|
augmented: AugmentationZ.optional()
|
|
4205
3300
|
});
|
|
4206
3301
|
function validateRuntimeContext(data) {
|
|
@@ -4208,19 +3303,19 @@ function validateRuntimeContext(data) {
|
|
|
4208
3303
|
}
|
|
4209
3304
|
|
|
4210
3305
|
// src/events/schema.ts
|
|
4211
|
-
import { z as
|
|
4212
|
-
var EventSourceZ =
|
|
4213
|
-
var NormalizedEventZ =
|
|
4214
|
-
ts:
|
|
4215
|
-
name:
|
|
3306
|
+
import { z as z4 } from "zod";
|
|
3307
|
+
var EventSourceZ = z4.enum(["posthog", "canvas", "derived"]);
|
|
3308
|
+
var NormalizedEventZ = z4.object({
|
|
3309
|
+
ts: z4.number(),
|
|
3310
|
+
name: z4.string(),
|
|
4216
3311
|
source: EventSourceZ,
|
|
4217
|
-
props:
|
|
4218
|
-
schemaVersion:
|
|
3312
|
+
props: z4.record(z4.string(), z4.unknown()).optional(),
|
|
3313
|
+
schemaVersion: z4.string()
|
|
4219
3314
|
});
|
|
4220
|
-
var EventFilterZ =
|
|
4221
|
-
names:
|
|
4222
|
-
patterns:
|
|
4223
|
-
sources:
|
|
3315
|
+
var EventFilterZ = z4.object({
|
|
3316
|
+
names: z4.array(z4.string()).optional(),
|
|
3317
|
+
patterns: z4.array(z4.string()).optional(),
|
|
3318
|
+
sources: z4.array(EventSourceZ).optional()
|
|
4224
3319
|
});
|
|
4225
3320
|
function validateNormalizedEvent(data) {
|
|
4226
3321
|
return NormalizedEventZ.safeParse(data);
|
|
@@ -4230,14 +3325,14 @@ function validateEventFilter(data) {
|
|
|
4230
3325
|
}
|
|
4231
3326
|
|
|
4232
3327
|
// src/state/schema.ts
|
|
4233
|
-
import { z as
|
|
4234
|
-
var StoredValueZ =
|
|
4235
|
-
value:
|
|
4236
|
-
expiresAt:
|
|
3328
|
+
import { z as z5 } from "zod";
|
|
3329
|
+
var StoredValueZ = z5.object({
|
|
3330
|
+
value: z5.unknown(),
|
|
3331
|
+
expiresAt: z5.number().optional()
|
|
4237
3332
|
});
|
|
4238
|
-
var FrequencyEntryZ =
|
|
4239
|
-
count:
|
|
4240
|
-
resetAt:
|
|
3333
|
+
var FrequencyEntryZ = z5.object({
|
|
3334
|
+
count: z5.number(),
|
|
3335
|
+
resetAt: z5.number().optional()
|
|
4241
3336
|
});
|
|
4242
3337
|
function validateStoredValue(data) {
|
|
4243
3338
|
return StoredValueZ.safeParse(data);
|
|
@@ -4288,6 +3383,7 @@ export {
|
|
|
4288
3383
|
EventBus,
|
|
4289
3384
|
EventCountConditionZ,
|
|
4290
3385
|
EventFilterZ,
|
|
3386
|
+
EventHistory,
|
|
4291
3387
|
EventOccurredConditionZ,
|
|
4292
3388
|
EventSourceZ,
|
|
4293
3389
|
ExecutorRegistry,
|
|
@@ -4441,8 +3537,10 @@ export {
|
|
|
4441
3537
|
validateCondition,
|
|
4442
3538
|
validateConfig,
|
|
4443
3539
|
validateEventFilter,
|
|
3540
|
+
validateEventName,
|
|
4444
3541
|
validateFrequencyEntry,
|
|
4445
3542
|
validateNormalizedEvent,
|
|
3543
|
+
validateProps,
|
|
4446
3544
|
validateRecipe,
|
|
4447
3545
|
validateRuntimeContext,
|
|
4448
3546
|
validateStoredValue,
|