chrome-devtools-mcp 1.10.1 → 1.11.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/build/src/BrowserManager.js +132 -13
- package/build/src/McpContext.js +188 -138
- package/build/src/McpPage.js +348 -96
- package/build/src/McpResponse.js +234 -76
- package/build/src/McpWorker.js +66 -0
- package/build/src/SlimMcpResponse.js +5 -1
- package/build/src/TextSnapshot.js +3 -2
- package/build/src/ToolHandler.js +80 -42
- package/build/src/bin/chrome-devtools-mcp-main.js +8 -7
- package/build/src/bin/chrome-devtools-mcp.js +1 -1
- package/build/src/bin/chrome-devtools.js +31 -41
- package/build/src/collectors/ServiceWorkerCollector.js +18 -11
- package/build/src/config/ConfigLocator.js +70 -0
- package/build/src/config/ConfigParser.js +264 -0
- package/build/src/config/ConfigWatcher.js +93 -0
- package/build/src/config/browser-options.js +2 -13
- package/build/src/config/category-options.js +15 -30
- package/build/src/config/cli-commands.js +165 -5
- package/build/src/config/cli-options.js +410 -43
- package/build/src/config/mcp-options.js +156 -234
- package/build/src/config/puppeteer-options.js +65 -0
- package/build/src/config/tool-options.js +60 -0
- package/build/src/daemon/client.js +81 -41
- package/build/src/daemon/daemon.js +55 -45
- package/build/src/daemon/utils.js +44 -11
- package/build/src/devtools/DevToolsCommentBridge.js +43 -6
- package/build/src/devtools/DevtoolsUtils.js +3 -3
- package/build/src/devtools/McpHostBindingAdapter.js +0 -1
- package/build/src/formatters/CommentFormatter.js +4 -13
- package/build/src/formatters/ConsoleFormatter.js +1 -1
- package/build/src/formatters/CssFormatter.js +3 -2
- package/build/src/formatters/HeapSnapshotFormatter.js +104 -46
- package/build/src/formatters/IssueFormatter.js +33 -32
- package/build/src/formatters/NetworkFormatter.js +12 -11
- package/build/src/formatters/SnapshotFormatter.js +31 -4
- package/build/src/index.js +54 -9
- package/build/src/processors/ChunkedTraceParser.js +11 -11
- package/build/src/processors/HeapSnapshotManager.js +121 -84
- package/build/src/processors/PerformanceTrace.js +9 -9
- package/build/src/telemetry/ClearcutLogger.js +1 -1
- package/build/src/telemetry/transformation.js +7 -11
- package/build/src/telemetry/watchdog/main.js +1 -1
- package/build/src/third_party/THIRD_PARTY_NOTICES +10 -397
- package/build/src/third_party/bundled-packages.json +7 -8
- package/build/src/third_party/devtools-formatter-worker.js +1193 -62
- package/build/src/third_party/devtools-heap-snapshot-worker.js +1126 -21
- package/build/src/third_party/index.js +8087 -19419
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +0 -1
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantReadOptOut.md +5 -0
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +0 -1
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSetOptOut.md +5 -0
- package/build/src/third_party/issue-descriptions/deprecation.md +1 -1
- package/build/src/third_party/issue-descriptions/genericGeolocationPromptWithoutUserGesture.md +5 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +2 -0
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +3 -3
- package/build/src/tools/ToolDefinition.js +16 -4
- package/build/src/tools/comments.js +20 -1
- package/build/src/tools/css.js +4 -2
- package/build/src/tools/emulation.js +17 -4
- package/build/src/tools/input.js +8 -3
- package/build/src/tools/lighthouse.js +112 -4
- package/build/src/tools/memory.js +129 -28
- package/build/src/tools/pages.js +5 -2
- package/build/src/tools/performance.js +21 -3
- package/build/src/tools/screencast.js +71 -32
- package/build/src/tools/screenshot.js +29 -14
- package/build/src/tools/script.js +90 -37
- package/build/src/tools/slim/tools.js +6 -8
- package/build/src/tools/thirdPartyDeveloper.js +6 -4
- package/build/src/tools/tools.js +35 -22
- package/build/src/tools/webmcp.js +9 -6
- package/build/src/types.js +11 -0
- package/build/src/utils/WaitForHelper.js +14 -1
- package/build/src/utils/check-for-updates.js +1 -1
- package/build/src/utils/errorHandling.js +20 -0
- package/build/src/utils/logger.js +15 -5
- package/build/src/utils/text.js +15 -0
- package/build/src/utils/url.js +99 -3
- package/build/src/version.js +1 -1
- package/package.json +14 -10
- package/skills/a11y-debugging/SKILL.md +4 -4
- package/skills/chrome-devtools/SKILL.md +2 -2
- package/skills/chrome-devtools-cli/SKILL.md +18 -15
- package/skills/cookie-debugging/SKILL.md +8 -5
- package/skills/debug-optimize-lcp/SKILL.md +1 -1
- package/skills/troubleshooting/SKILL.md +5 -6
|
@@ -143,14 +143,14 @@ async function saveScreenshot(options) {
|
|
|
143
143
|
const screenRectHeight = options.clip.screenRectHeight * scale;
|
|
144
144
|
const contentLeft = options.clip.visiblePageRectLeft * scale;
|
|
145
145
|
const contentTop = options.clip.visiblePageRectTop * scale;
|
|
146
|
-
canvas = new OffscreenCanvas(Math.
|
|
147
|
-
Math.min(1 << 14, Math.
|
|
146
|
+
canvas = new OffscreenCanvas(Math.round(screenRectWidth),
|
|
147
|
+
Math.min(1 << 14, Math.round(screenRectHeight)));
|
|
148
148
|
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
|
149
149
|
if (!ctx) {
|
|
150
150
|
throw new Error('Could not get 2d context from canvas.');
|
|
151
151
|
}
|
|
152
152
|
ctx.imageSmoothingEnabled = false;
|
|
153
|
-
ctx.drawImage(pageImage, Math.
|
|
153
|
+
ctx.drawImage(pageImage, Math.round(contentLeft), Math.round(contentTop));
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
156
|
canvas = new OffscreenCanvas(pageImage.naturalWidth, Math.min(1 << 14, Math.floor(pageImage.naturalHeight)));
|
|
@@ -2952,6 +2952,12 @@ const LAYOUT_LINES_HIGHLIGHT_COLOR = [127, 32, 210];
|
|
|
2952
2952
|
GapBackground: Legacy.fromRGBA([...LAYOUT_LINES_HIGHLIGHT_COLOR, .3]),
|
|
2953
2953
|
GapHatch: Legacy.fromRGBA([...LAYOUT_LINES_HIGHLIGHT_COLOR, .8]),
|
|
2954
2954
|
GridAreaBorder: Legacy.fromRGBA([26, 115, 232, 1]),
|
|
2955
|
+
AnchorIMCB: Legacy.fromRGBA([127, 32, 210, 1]),
|
|
2956
|
+
AnchorIMCBBackground: Legacy.fromRGBA([127, 32, 210, 0.15]),
|
|
2957
|
+
AnchorInsetsBackground: Legacy.fromRGBA([246, 178, 107, 0.25]),
|
|
2958
|
+
AnchorInsetsHatch: Legacy.fromRGBA([246, 178, 107, 0.8]),
|
|
2959
|
+
AnchorTarget: Legacy.fromRGBA([26, 115, 232, 1]),
|
|
2960
|
+
AnchorTargetBackground: Legacy.fromRGBA([26, 115, 232, 0.15]),
|
|
2955
2961
|
});
|
|
2956
2962
|
({
|
|
2957
2963
|
ParentOutline: Legacy.fromRGBA([224, 90, 183, 1]),
|
|
@@ -2972,6 +2978,7 @@ var ExperimentName;
|
|
|
2972
2978
|
ExperimentName["DURABLE_MESSAGES"] = "durable-messages";
|
|
2973
2979
|
ExperimentName["JPEG_XL"] = "jpeg-xl";
|
|
2974
2980
|
ExperimentName["PLUS_BUTTON"] = "plus-button";
|
|
2981
|
+
ExperimentName["SOURCE_MAP_SCOPES_IN_SOURCES_PANEL"] = "source-map-scopes-in-sources-panel";
|
|
2975
2982
|
})(ExperimentName || (ExperimentName = {}));
|
|
2976
2983
|
|
|
2977
2984
|
// Copyright 2021 The Chromium Authors
|
|
@@ -5098,7 +5105,11 @@ class ParsedURL {
|
|
|
5098
5105
|
preEncodedPath = 'file:///' + preEncodedPath;
|
|
5099
5106
|
}
|
|
5100
5107
|
}
|
|
5101
|
-
|
|
5108
|
+
let url = new URL(preEncodedPath).toString();
|
|
5109
|
+
while (url.endsWith('/') && url.length > 'file:///'.length) {
|
|
5110
|
+
url = url.substring(0, url.length - 1);
|
|
5111
|
+
}
|
|
5112
|
+
return url;
|
|
5102
5113
|
}
|
|
5103
5114
|
static relativePathToUrlString(relativePath, baseURL) {
|
|
5104
5115
|
const preEncodedPath = ParsedURL.preEncodeSpecialCharactersInPath(relativePath.replace(/\\/g, '/'));
|
|
@@ -5158,7 +5169,7 @@ class ParsedURL {
|
|
|
5158
5169
|
}
|
|
5159
5170
|
const schemeRegex = /([A-Za-z][A-Za-z0-9+.-]*):\/\//;
|
|
5160
5171
|
const userRegex = /(?:([A-Za-z0-9\-._~%!$&'()*+,;=:]*)@)?/;
|
|
5161
|
-
const hostRegex = /((?:\[
|
|
5172
|
+
const hostRegex = /((?:\[[0-9a-fA-F:.]*:[0-9a-fA-F:.]*\])|(?:[^\s\/:]*))/;
|
|
5162
5173
|
const portRegex = /(?::([\d]+))?/;
|
|
5163
5174
|
const pathRegex = /(\/[^#?]*)?/;
|
|
5164
5175
|
const queryRegex = /(?:\?([^#]*))?/;
|
|
@@ -6421,7 +6432,7 @@ var AllocationProfile$1 = /*#__PURE__*/Object.freeze({
|
|
|
6421
6432
|
function analyzeContexts(snapshot) {
|
|
6422
6433
|
const scopesByScript = parseEmbeddedScopes(snapshot);
|
|
6423
6434
|
const scan = scanHeap(snapshot);
|
|
6424
|
-
const liveFunctionsByScript = buildLiveFunctions(snapshot, scan.liveClosures);
|
|
6435
|
+
const liveFunctionsByScript = buildLiveFunctions(snapshot, scan.liveClosures, scan.finishedModuleFunctionNodeIndexes);
|
|
6425
6436
|
const { scopes, scriptsWithoutScopes } = correlateContextsWithScopes(snapshot, scan, scopesByScript);
|
|
6426
6437
|
const scopeAnalyses = classifyFields(snapshot, scopes, liveFunctionsByScript);
|
|
6427
6438
|
return sortAndBuildResult(scopeAnalyses, scriptsWithoutScopes);
|
|
@@ -6518,6 +6529,8 @@ function scanHeap(snapshot) {
|
|
|
6518
6529
|
const scripts = new Map();
|
|
6519
6530
|
const contextNodes = [];
|
|
6520
6531
|
const liveClosures = [];
|
|
6532
|
+
const finishedModuleFunctionNodeIndexes = new Set();
|
|
6533
|
+
const generatorMapNodeIndexes = new Map();
|
|
6521
6534
|
const scopeInfoScriptNodeIndexes = new Map();
|
|
6522
6535
|
const node = snapshot.createNode();
|
|
6523
6536
|
const nodes = snapshot.nodes;
|
|
@@ -6528,6 +6541,7 @@ function scanHeap(snapshot) {
|
|
|
6528
6541
|
const rawName = node.rawName();
|
|
6529
6542
|
if (rawName.startsWith('system / Script')) {
|
|
6530
6543
|
processScript(scripts, node);
|
|
6544
|
+
processScriptScopeInfos(scopeInfoScriptNodeIndexes, node);
|
|
6531
6545
|
}
|
|
6532
6546
|
else if (snapshot.isContextObject(node)) {
|
|
6533
6547
|
processContext(contextNodes, node);
|
|
@@ -6535,11 +6549,11 @@ function scanHeap(snapshot) {
|
|
|
6535
6549
|
else if (node.rawType() === nodeClosureType) {
|
|
6536
6550
|
processClosure(liveClosures, node);
|
|
6537
6551
|
}
|
|
6538
|
-
else if (
|
|
6539
|
-
|
|
6552
|
+
else if (isGeneratorObject(generatorMapNodeIndexes, node)) {
|
|
6553
|
+
processGeneratorObject(liveClosures, finishedModuleFunctionNodeIndexes, node);
|
|
6540
6554
|
}
|
|
6541
6555
|
}
|
|
6542
|
-
return { scripts, contextNodes, liveClosures, scopeInfoScriptNodeIndexes };
|
|
6556
|
+
return { scripts, contextNodes, liveClosures, finishedModuleFunctionNodeIndexes, scopeInfoScriptNodeIndexes };
|
|
6543
6557
|
}
|
|
6544
6558
|
function processScript(scripts, node) {
|
|
6545
6559
|
const rawName = node.rawName();
|
|
@@ -6554,6 +6568,71 @@ function processScript(scripts, node) {
|
|
|
6554
6568
|
nodeId: node.id(),
|
|
6555
6569
|
});
|
|
6556
6570
|
}
|
|
6571
|
+
function processScriptScopeInfos(scopeInfoScriptNodeIndexes, scriptNode) {
|
|
6572
|
+
const infos = scriptNode.findInternalEdgeTarget('infos');
|
|
6573
|
+
if (!infos) {
|
|
6574
|
+
return;
|
|
6575
|
+
}
|
|
6576
|
+
const scriptNodeIndex = scriptNode.nodeIndex;
|
|
6577
|
+
const scopeInfoNode = scriptNode.snapshot.createNode();
|
|
6578
|
+
const evalFromScopeInfo = scriptNode.findInternalEdgeTarget('eval_from_scope_info');
|
|
6579
|
+
const stopAtNodeIndex = evalFromScopeInfo?.rawName() === 'system / ScopeInfo' ?
|
|
6580
|
+
evalFromScopeInfo.nodeIndex :
|
|
6581
|
+
undefined;
|
|
6582
|
+
for (let iter = infos.edges(); iter.hasNext(); iter.next()) {
|
|
6583
|
+
const info = iter.edge.node();
|
|
6584
|
+
const infoName = info.rawName();
|
|
6585
|
+
if (infoName === 'system / ScopeInfo') {
|
|
6586
|
+
attributeScopeInfoChain(scopeInfoScriptNodeIndexes, info.nodeIndex, stopAtNodeIndex, scriptNodeIndex, scopeInfoNode);
|
|
6587
|
+
continue;
|
|
6588
|
+
}
|
|
6589
|
+
if (!infoName.startsWith('system / SharedFunctionInfo')) {
|
|
6590
|
+
continue;
|
|
6591
|
+
}
|
|
6592
|
+
const sharedFunctionInfo = info;
|
|
6593
|
+
const scopeInfo = sharedFunctionInfo.findInternalEdgeTarget('name_or_scope_info');
|
|
6594
|
+
if (scopeInfo?.rawName() === 'system / ScopeInfo') {
|
|
6595
|
+
attributeScopeInfoChain(scopeInfoScriptNodeIndexes, scopeInfo.nodeIndex, stopAtNodeIndex, scriptNodeIndex, scopeInfoNode);
|
|
6596
|
+
continue;
|
|
6597
|
+
}
|
|
6598
|
+
const scopeId = sharedFunctionInfo.findInternalEdgeTarget('scope_id')?.nodeValueAsInt();
|
|
6599
|
+
if (scopeId === undefined || isScriptRootScopeId(scopeId)) {
|
|
6600
|
+
continue;
|
|
6601
|
+
}
|
|
6602
|
+
const outerScopeInfo = sharedFunctionInfo.findInternalEdgeTarget('raw_outer_scope_info_or_feedback_metadata');
|
|
6603
|
+
if (outerScopeInfo?.rawName() === 'system / ScopeInfo') {
|
|
6604
|
+
attributeScopeInfoChain(scopeInfoScriptNodeIndexes, outerScopeInfo.nodeIndex, stopAtNodeIndex, scriptNodeIndex, scopeInfoNode);
|
|
6605
|
+
}
|
|
6606
|
+
}
|
|
6607
|
+
}
|
|
6608
|
+
function attributeScopeInfoChain(scopeInfoScriptNodeIndexes, scopeInfoNodeIndex, stopAtNodeIndex, scriptNodeIndex, scopeInfoNode) {
|
|
6609
|
+
let currentNodeIndex = scopeInfoNodeIndex;
|
|
6610
|
+
for (;;) {
|
|
6611
|
+
if (currentNodeIndex === stopAtNodeIndex) {
|
|
6612
|
+
return;
|
|
6613
|
+
}
|
|
6614
|
+
if (scopeInfoScriptNodeIndexes.has(currentNodeIndex)) {
|
|
6615
|
+
return;
|
|
6616
|
+
}
|
|
6617
|
+
scopeInfoScriptNodeIndexes.set(currentNodeIndex, scriptNodeIndex);
|
|
6618
|
+
scopeInfoNode.nodeIndex = currentNodeIndex;
|
|
6619
|
+
if (isScriptRootScopeInfo(scopeInfoNode)) {
|
|
6620
|
+
return;
|
|
6621
|
+
}
|
|
6622
|
+
const outerScopeInfo = scopeInfoNode.findInternalEdgeTarget('outer_scope_info');
|
|
6623
|
+
if (!outerScopeInfo) {
|
|
6624
|
+
return;
|
|
6625
|
+
}
|
|
6626
|
+
currentNodeIndex = outerScopeInfo.nodeIndex;
|
|
6627
|
+
}
|
|
6628
|
+
}
|
|
6629
|
+
function isScriptRootScopeInfo(node) {
|
|
6630
|
+
const scopeId = node.findInternalEdgeTarget('scope_id')?.nodeValueAsInt();
|
|
6631
|
+
return scopeId !== undefined && isScriptRootScopeId(scopeId);
|
|
6632
|
+
}
|
|
6633
|
+
function isScriptRootScopeId(scopeId) {
|
|
6634
|
+
return scopeId === -2;
|
|
6635
|
+
}
|
|
6557
6636
|
function processContext(contextNodes, node) {
|
|
6558
6637
|
const scopeInfoNodeIndex = node.findInternalEdgeTarget('scope_info')?.nodeIndex;
|
|
6559
6638
|
if (scopeInfoNodeIndex === undefined) {
|
|
@@ -6571,6 +6650,9 @@ function processClosure(liveClosures, node) {
|
|
|
6571
6650
|
if (!sharedFunctionInfo || !closureContext) {
|
|
6572
6651
|
return;
|
|
6573
6652
|
}
|
|
6653
|
+
addLiveClosure(liveClosures, node, sharedFunctionInfo, closureContext);
|
|
6654
|
+
}
|
|
6655
|
+
function addLiveClosure(liveClosures, ownerNode, sharedFunctionInfo, contextNode) {
|
|
6574
6656
|
const script = sharedFunctionInfo.findInternalEdgeTarget('script');
|
|
6575
6657
|
if (!script) {
|
|
6576
6658
|
return;
|
|
@@ -6578,24 +6660,65 @@ function processClosure(liveClosures, node) {
|
|
|
6578
6660
|
const scopeId = sharedFunctionInfo.findInternalEdgeTarget('scope_id')?.nodeValueAsInt();
|
|
6579
6661
|
if (scopeId !== undefined) {
|
|
6580
6662
|
liveClosures.push({
|
|
6581
|
-
|
|
6663
|
+
ownerNodeIndex: ownerNode.nodeIndex,
|
|
6664
|
+
contextNodeIndex: contextNode.nodeIndex,
|
|
6582
6665
|
scriptNodeIndex: script.nodeIndex,
|
|
6583
6666
|
scopeId,
|
|
6584
6667
|
});
|
|
6585
6668
|
}
|
|
6586
6669
|
}
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
const
|
|
6590
|
-
|
|
6670
|
+
const GENERATOR_CLOSED = -1;
|
|
6671
|
+
function processGeneratorObject(liveClosures, finishedModuleFunctionNodeIndexes, node) {
|
|
6672
|
+
const continuation = node.findInternalEdgeTarget('continuation')?.nodeValueAsInt();
|
|
6673
|
+
const generatorFunction = node.findInternalEdgeTarget('function');
|
|
6674
|
+
if (continuation === undefined || generatorFunction?.rawType() !== node.snapshot.nodeClosureType) {
|
|
6675
|
+
return;
|
|
6676
|
+
}
|
|
6677
|
+
const sharedFunctionInfo = generatorFunction.findInternalEdgeTarget('shared');
|
|
6678
|
+
if (!sharedFunctionInfo) {
|
|
6591
6679
|
return;
|
|
6592
6680
|
}
|
|
6593
|
-
|
|
6681
|
+
if (continuation === GENERATOR_CLOSED) {
|
|
6682
|
+
const scopeId = sharedFunctionInfo.findInternalEdgeTarget('scope_id')?.nodeValueAsInt();
|
|
6683
|
+
if (scopeId !== undefined && isScriptRootScopeId(scopeId)) {
|
|
6684
|
+
finishedModuleFunctionNodeIndexes.add(generatorFunction.nodeIndex);
|
|
6685
|
+
}
|
|
6686
|
+
return;
|
|
6687
|
+
}
|
|
6688
|
+
const generatorContext = node.findInternalEdgeTarget('context');
|
|
6689
|
+
if (generatorContext) {
|
|
6690
|
+
addLiveClosure(liveClosures, node, sharedFunctionInfo, generatorContext);
|
|
6691
|
+
}
|
|
6692
|
+
}
|
|
6693
|
+
const GENERATOR_INSTANCE_TYPE_NAMES = new Set([
|
|
6694
|
+
'JS_GENERATOR_OBJECT_TYPE',
|
|
6695
|
+
'JS_ASYNC_FUNCTION_OBJECT_TYPE',
|
|
6696
|
+
'JS_ASYNC_GENERATOR_OBJECT_TYPE',
|
|
6697
|
+
]);
|
|
6698
|
+
function isGeneratorObject(generatorMapNodeIndexes, node) {
|
|
6699
|
+
if (node.rawType() !== node.snapshot.nodeObjectType) {
|
|
6700
|
+
return false;
|
|
6701
|
+
}
|
|
6702
|
+
const map = node.findInternalEdgeTarget('map');
|
|
6703
|
+
if (!map) {
|
|
6704
|
+
return false;
|
|
6705
|
+
}
|
|
6706
|
+
const mapNodeIndex = map.nodeIndex;
|
|
6707
|
+
let isGenerator = generatorMapNodeIndexes.get(mapNodeIndex);
|
|
6708
|
+
if (isGenerator === undefined) {
|
|
6709
|
+
const instanceTypeName = map.findInternalEdgeTarget('instance_type_name')?.rawName();
|
|
6710
|
+
isGenerator = instanceTypeName !== undefined && GENERATOR_INSTANCE_TYPE_NAMES.has(instanceTypeName);
|
|
6711
|
+
generatorMapNodeIndexes.set(mapNodeIndex, isGenerator);
|
|
6712
|
+
}
|
|
6713
|
+
return isGenerator;
|
|
6594
6714
|
}
|
|
6595
|
-
function buildLiveFunctions(snapshot, liveClosures) {
|
|
6715
|
+
function buildLiveFunctions(snapshot, liveClosures, finishedModuleFunctionNodeIndexes) {
|
|
6596
6716
|
const liveFunctionsByScript = new Map();
|
|
6597
6717
|
const node = snapshot.createNode();
|
|
6598
6718
|
for (const closure of liveClosures) {
|
|
6719
|
+
if (finishedModuleFunctionNodeIndexes.has(closure.ownerNodeIndex)) {
|
|
6720
|
+
continue;
|
|
6721
|
+
}
|
|
6599
6722
|
let scriptFunctions = liveFunctionsByScript.get(closure.scriptNodeIndex);
|
|
6600
6723
|
if (!scriptFunctions) {
|
|
6601
6724
|
scriptFunctions = new Map();
|
|
@@ -6726,6 +6849,9 @@ function resolveScopeInfoScriptNodeIndex(snapshot, scopeInfoScriptNodeIndexes, s
|
|
|
6726
6849
|
seen.add(currentNodeIndex);
|
|
6727
6850
|
visited.push(currentNodeIndex);
|
|
6728
6851
|
node.nodeIndex = currentNodeIndex;
|
|
6852
|
+
if (isScriptRootScopeInfo(node)) {
|
|
6853
|
+
break;
|
|
6854
|
+
}
|
|
6729
6855
|
const outerScopeInfo = node.findInternalEdgeTarget('outer_scope_info');
|
|
6730
6856
|
if (!outerScopeInfo) {
|
|
6731
6857
|
break;
|
|
@@ -10590,6 +10716,979 @@ new FinalizationRegistry(url => {
|
|
|
10590
10716
|
URL.revokeObjectURL(url);
|
|
10591
10717
|
});
|
|
10592
10718
|
|
|
10719
|
+
/**
|
|
10720
|
+
* marked v18.0.4 - a markdown parser
|
|
10721
|
+
* Copyright (c) 2018-2026, MarkedJS. (MIT License)
|
|
10722
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
10723
|
+
* https://github.com/markedjs/marked
|
|
10724
|
+
*/
|
|
10725
|
+
function M() { return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null }; }
|
|
10726
|
+
var T = M();
|
|
10727
|
+
function N(l) { T = l; }
|
|
10728
|
+
var _ = { exec: () => null };
|
|
10729
|
+
function E(l) { let e = []; return t => { let n = Math.max(0, Math.min(3, t - 1)), s = e[n]; return s || (s = l(n), e[n] = s), s; }; }
|
|
10730
|
+
function d(l, e = "") { let t = typeof l == "string" ? l : l.source, n = { replace: (s, r) => { let i = typeof r == "string" ? r : r.source; return i = i.replace(m.caret, "$1"), t = t.replace(s, i), n; }, getRegex: () => new RegExp(t, e) }; return n; }
|
|
10731
|
+
var Te = ((l = "") => { try {
|
|
10732
|
+
return !!new RegExp("(?<=1)(?<!1)" + l);
|
|
10733
|
+
}
|
|
10734
|
+
catch {
|
|
10735
|
+
return false;
|
|
10736
|
+
} })(), 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: l => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: E(l => new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: E(l => new RegExp(`^ {0,${l}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: E(l => new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)), headingBeginRegex: E(l => new RegExp(`^ {0,${l}}#`)), htmlBeginRegex: E(l => new RegExp(`^ {0,${l}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: E(l => new RegExp(`^ {0,${l}}>`)) }, Oe = /^(?:[ \t]*(?:\n|$))+/, we = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, B = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, j = / {0,3}(?:[*+-]|\d{1,9}[.)])/, oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ae = d(oe).replace(/bull/g, j).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(), Se = d(oe).replace(/bull/g, j).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(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, $e = /^[^\n]+/, U = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Le = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), _e = d(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex(), H = "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", K = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ze = d("^ {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", K).replace("tag", H).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), le = d(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex(), Me = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", le).getRegex(), W = { blockquote: Me, code: we, def: Le, fences: ye, heading: Pe, hr: B, html: ze, lheading: ae, list: _e, newline: Oe, paragraph: le, table: _, text: $e }, se = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex(), Ee = { ...W, lheading: Se, table: se, paragraph: d(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).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", H).getRegex() }, Ie = { ...W, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", K).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: d(F).replace("hr", B).replace("heading", ` *#{1,6} *[^
|
|
10737
|
+
]`).replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, Be = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, I = /[\p{P}\p{S}]/u, Z = /[\s\p{P}\p{S}]/u, X = /[^\s\p{P}\p{S}]/u, De = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Z).getRegex(), pe = /(?!~)[\p{P}\p{S}]/u, qe = /(?!~)[\s\p{P}\p{S}]/u, ve = /(?:[^\s\p{P}\p{S}]|~)/u, He = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Te ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ce = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Ze = d(ce, "u").replace(/punct/g, I).getRegex(), Ge = d(ce, "u").replace(/punct/g, pe).getRegex(), he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ne = d(he, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex(), Qe = d(he, "gu").replace(/notPunctSpace/g, ve).replace(/punctSpace/g, qe).replace(/punct/g, pe).getRegex(), je = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex(), Fe = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, I).getRegex(), Ue = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Ke = d(Ue, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex(), We = d(/\\(punct)/, "gu").replace(/punct/g, I).getRegex(), Xe = d(/^<(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(), Je = d(K).replace("(?:-->|$)", "-->").getRegex(), Ve = d("^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", Je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), v = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ye = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", v).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ke = d(/^!?\[(label)\]\[(ref)\]/).replace("label", v).replace("ref", U).getRegex(), de = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex(), et = d("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", de).getRegex(), ie = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, J = { _backpedal: _, anyPunctuation: We, autolink: Xe, blockSkip: He, br: ue, code: Ce, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Ze, emStrongRDelimAst: Ne, emStrongRDelimUnd: je, escape: Ae, link: Ye, nolink: de, punctuation: De, reflink: ke, reflinkSearch: et, tag: Ve, text: Be, url: _ }, tt = { ...J, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", v).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", v).getRegex() }, Q = { ...J, emStrongRDelimAst: Qe, emStrongLDelim: Ge, delLDelim: Fe, delRDelim: Ke, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ie).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: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ie).getRegex() }, nt = { ...Q, br: d(ue).replace("{2,}", "*").getRegex(), text: d(Q.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, D = { normal: W, gfm: Ee, pedantic: Ie }, A = { normal: J, gfm: Q, breaks: nt, pedantic: tt };
|
|
10738
|
+
var rt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, ge = l => rt[l];
|
|
10739
|
+
function O(l, e) { if (e) {
|
|
10740
|
+
if (m.escapeTest.test(l))
|
|
10741
|
+
return l.replace(m.escapeReplace, ge);
|
|
10742
|
+
}
|
|
10743
|
+
else if (m.escapeTestNoEncode.test(l))
|
|
10744
|
+
return l.replace(m.escapeReplaceNoEncode, ge); return l; }
|
|
10745
|
+
function V(l) { try {
|
|
10746
|
+
l = encodeURI(l).replace(m.percentDecode, "%");
|
|
10747
|
+
}
|
|
10748
|
+
catch {
|
|
10749
|
+
return null;
|
|
10750
|
+
} return l; }
|
|
10751
|
+
function Y(l, e) { let t = l.replace(m.findPipe, (r, i, o) => { let u = false, a = i; for (; --a >= 0 && o[a] === "\\";)
|
|
10752
|
+
u = !u; return u ? "|" : " |"; }), n = t.split(m.splitPipe), s = 0; if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e)
|
|
10753
|
+
if (n.length > e)
|
|
10754
|
+
n.splice(e);
|
|
10755
|
+
else
|
|
10756
|
+
for (; n.length < e;)
|
|
10757
|
+
n.push(""); for (; s < n.length; s++)
|
|
10758
|
+
n[s] = n[s].trim().replace(m.slashPipe, "|"); return n; }
|
|
10759
|
+
function $(l, e, t) { let n = l.length; if (n === 0)
|
|
10760
|
+
return ""; let s = 0; for (; s < n;) {
|
|
10761
|
+
let r = l.charAt(n - s - 1);
|
|
10762
|
+
if (r === e && true)
|
|
10763
|
+
s++;
|
|
10764
|
+
else break;
|
|
10765
|
+
} return l.slice(0, n - s); }
|
|
10766
|
+
function ee(l) {
|
|
10767
|
+
let e = l.split(`
|
|
10768
|
+
`), t = e.length - 1;
|
|
10769
|
+
for (; t >= 0 && m.blankLine.test(e[t]);)
|
|
10770
|
+
t--;
|
|
10771
|
+
return e.length - t <= 2 ? l : e.slice(0, t + 1).join(`
|
|
10772
|
+
`);
|
|
10773
|
+
}
|
|
10774
|
+
function fe(l, e) { if (l.indexOf(e[1]) === -1)
|
|
10775
|
+
return -1; let t = 0; for (let n = 0; n < l.length; n++)
|
|
10776
|
+
if (l[n] === "\\")
|
|
10777
|
+
n++;
|
|
10778
|
+
else if (l[n] === e[0])
|
|
10779
|
+
t++;
|
|
10780
|
+
else if (l[n] === e[1] && (t--, t < 0))
|
|
10781
|
+
return n; return t > 0 ? -2 : -1; }
|
|
10782
|
+
function me(l, e = 0) { let t = e, n = ""; for (let s of l)
|
|
10783
|
+
if (s === " ") {
|
|
10784
|
+
let r = 4 - t % 4;
|
|
10785
|
+
n += " ".repeat(r), t += r;
|
|
10786
|
+
}
|
|
10787
|
+
else
|
|
10788
|
+
n += s, t++; return n; }
|
|
10789
|
+
function xe(l, e, t, n, s) { let r = e.href, i = e.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1"); n.state.inLink = true; let u = { type: l[0].charAt(0) === "!" ? "image" : "link", raw: t, href: r, title: i, text: o, tokens: n.inlineTokens(o) }; return n.state.inLink = false, u; }
|
|
10790
|
+
function st(l, e, t) {
|
|
10791
|
+
let n = l.match(t.other.indentCodeCompensation);
|
|
10792
|
+
if (n === null)
|
|
10793
|
+
return e;
|
|
10794
|
+
let s = n[1];
|
|
10795
|
+
return e.split(`
|
|
10796
|
+
`).map(r => { let i = r.match(t.other.beginningSpace); if (i === null)
|
|
10797
|
+
return r; let [o] = i; return o.length >= s.length ? r.slice(s.length) : r; }).join(`
|
|
10798
|
+
`);
|
|
10799
|
+
}
|
|
10800
|
+
var w = class {
|
|
10801
|
+
options;
|
|
10802
|
+
rules;
|
|
10803
|
+
lexer;
|
|
10804
|
+
constructor(e) { this.options = e || T; }
|
|
10805
|
+
space(e) { let t = this.rules.block.newline.exec(e); if (t && t[0].length > 0)
|
|
10806
|
+
return { type: "space", raw: t[0] }; }
|
|
10807
|
+
code(e) { let t = this.rules.block.code.exec(e); if (t) {
|
|
10808
|
+
let n = this.options.pedantic ? t[0] : ee(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
|
|
10809
|
+
return { type: "code", raw: n, codeBlockStyle: "indented", text: s };
|
|
10810
|
+
} }
|
|
10811
|
+
fences(e) { let t = this.rules.block.fences.exec(e); if (t) {
|
|
10812
|
+
let n = t[0], s = st(n, t[3] || "", this.rules);
|
|
10813
|
+
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
|
|
10814
|
+
} }
|
|
10815
|
+
heading(e) {
|
|
10816
|
+
let t = this.rules.block.heading.exec(e);
|
|
10817
|
+
if (t) {
|
|
10818
|
+
let n = t[2].trim();
|
|
10819
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
10820
|
+
let s = $(n, "#");
|
|
10821
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
|
|
10822
|
+
}
|
|
10823
|
+
return { type: "heading", raw: $(t[0], `
|
|
10824
|
+
`), depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
10825
|
+
}
|
|
10826
|
+
}
|
|
10827
|
+
hr(e) {
|
|
10828
|
+
let t = this.rules.block.hr.exec(e);
|
|
10829
|
+
if (t)
|
|
10830
|
+
return { type: "hr", raw: $(t[0], `
|
|
10831
|
+
`) };
|
|
10832
|
+
}
|
|
10833
|
+
blockquote(e) {
|
|
10834
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
10835
|
+
if (t) {
|
|
10836
|
+
let n = $(t[0], `
|
|
10837
|
+
`).split(`
|
|
10838
|
+
`), s = "", r = "", i = [];
|
|
10839
|
+
for (; n.length > 0;) {
|
|
10840
|
+
let o = false, u = [], a;
|
|
10841
|
+
for (a = 0; a < n.length; a++)
|
|
10842
|
+
if (this.rules.other.blockquoteStart.test(n[a]))
|
|
10843
|
+
u.push(n[a]), o = true;
|
|
10844
|
+
else if (!o)
|
|
10845
|
+
u.push(n[a]);
|
|
10846
|
+
else
|
|
10847
|
+
break;
|
|
10848
|
+
n = n.slice(a);
|
|
10849
|
+
let c = u.join(`
|
|
10850
|
+
`), p = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
10851
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
10852
|
+
s = s ? `${s}
|
|
10853
|
+
${c}` : c, r = r ? `${r}
|
|
10854
|
+
${p}` : p;
|
|
10855
|
+
let k = this.lexer.state.top;
|
|
10856
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(p, i, true), this.lexer.state.top = k, n.length === 0)
|
|
10857
|
+
break;
|
|
10858
|
+
let h = i.at(-1);
|
|
10859
|
+
if (h?.type === "code")
|
|
10860
|
+
break;
|
|
10861
|
+
if (h?.type === "blockquote") {
|
|
10862
|
+
let R = h, f = R.raw + `
|
|
10863
|
+
` + n.join(`
|
|
10864
|
+
`), S = this.blockquote(f);
|
|
10865
|
+
i[i.length - 1] = S, s = s.substring(0, s.length - R.raw.length) + S.raw, r = r.substring(0, r.length - R.text.length) + S.text;
|
|
10866
|
+
break;
|
|
10867
|
+
}
|
|
10868
|
+
else if (h?.type === "list") {
|
|
10869
|
+
let R = h, f = R.raw + `
|
|
10870
|
+
` + n.join(`
|
|
10871
|
+
`), S = this.list(f);
|
|
10872
|
+
i[i.length - 1] = S, s = s.substring(0, s.length - h.raw.length) + S.raw, r = r.substring(0, r.length - R.raw.length) + S.raw, n = f.substring(i.at(-1).raw.length).split(`
|
|
10873
|
+
`);
|
|
10874
|
+
continue;
|
|
10875
|
+
}
|
|
10876
|
+
}
|
|
10877
|
+
return { type: "blockquote", raw: s, tokens: i, text: r };
|
|
10878
|
+
}
|
|
10879
|
+
}
|
|
10880
|
+
list(e) {
|
|
10881
|
+
let t = this.rules.block.list.exec(e);
|
|
10882
|
+
if (t) {
|
|
10883
|
+
let n = t[1].trim(), s = n.length > 1, r = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: false, items: [] };
|
|
10884
|
+
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
10885
|
+
let i = this.rules.other.listItemRegex(n), o = false;
|
|
10886
|
+
for (; e;) {
|
|
10887
|
+
let a = false, c = "", p = "";
|
|
10888
|
+
if (!(t = i.exec(e)) || this.rules.block.hr.test(e))
|
|
10889
|
+
break;
|
|
10890
|
+
c = t[0], e = e.substring(c.length);
|
|
10891
|
+
let k = me(t[2].split(`
|
|
10892
|
+
`, 1)[0], t[1].length), h = e.split(`
|
|
10893
|
+
`, 1)[0], R = !k.trim(), f = 0;
|
|
10894
|
+
if (this.options.pedantic ? (f = 2, p = k.trimStart()) : R ? f = t[1].length + 1 : (f = k.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, p = k.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (c += h + `
|
|
10895
|
+
`, e = e.substring(h.length + 1), a = true), !a) {
|
|
10896
|
+
let S = this.rules.other.nextBulletRegex(f), te = this.rules.other.hrRegex(f), ne = this.rules.other.fencesBeginRegex(f), re = this.rules.other.headingBeginRegex(f), be = this.rules.other.htmlBeginRegex(f), Re = this.rules.other.blockquoteBeginRegex(f);
|
|
10897
|
+
for (; e;) {
|
|
10898
|
+
let G = e.split(`
|
|
10899
|
+
`, 1)[0], C;
|
|
10900
|
+
if (h = G, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), C = h) : C = h.replace(this.rules.other.tabCharGlobal, " "), ne.test(h) || re.test(h) || be.test(h) || Re.test(h) || S.test(h) || te.test(h))
|
|
10901
|
+
break;
|
|
10902
|
+
if (C.search(this.rules.other.nonSpaceChar) >= f || !h.trim())
|
|
10903
|
+
p += `
|
|
10904
|
+
` + C.slice(f);
|
|
10905
|
+
else {
|
|
10906
|
+
if (R || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(k) || re.test(k) || te.test(k))
|
|
10907
|
+
break;
|
|
10908
|
+
p += `
|
|
10909
|
+
` + h;
|
|
10910
|
+
}
|
|
10911
|
+
R = !h.trim(), c += G + `
|
|
10912
|
+
`, e = e.substring(G.length + 1), k = C.slice(f);
|
|
10913
|
+
}
|
|
10914
|
+
}
|
|
10915
|
+
r.loose || (o ? r.loose = true : this.rules.other.doubleBlankLine.test(c) && (o = true)), r.items.push({ type: "list_item", raw: c, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: false, text: p, tokens: [] }), r.raw += c;
|
|
10916
|
+
}
|
|
10917
|
+
let u = r.items.at(-1);
|
|
10918
|
+
if (u)
|
|
10919
|
+
u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
|
|
10920
|
+
else
|
|
10921
|
+
return;
|
|
10922
|
+
r.raw = r.raw.trimEnd();
|
|
10923
|
+
for (let a of r.items) {
|
|
10924
|
+
this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []);
|
|
10925
|
+
let c = a.tokens[0];
|
|
10926
|
+
if (a.task && (c?.type === "text" || c?.type === "paragraph")) {
|
|
10927
|
+
a.text = a.text.replace(this.rules.other.listReplaceTask, ""), c.raw = c.raw.replace(this.rules.other.listReplaceTask, ""), c.text = c.text.replace(this.rules.other.listReplaceTask, "");
|
|
10928
|
+
for (let k = this.lexer.inlineQueue.length - 1; k >= 0; k--)
|
|
10929
|
+
if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[k].src)) {
|
|
10930
|
+
this.lexer.inlineQueue[k].src = this.lexer.inlineQueue[k].src.replace(this.rules.other.listReplaceTask, "");
|
|
10931
|
+
break;
|
|
10932
|
+
}
|
|
10933
|
+
let p = this.rules.other.listTaskCheckbox.exec(a.raw);
|
|
10934
|
+
if (p) {
|
|
10935
|
+
let k = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
|
|
10936
|
+
a.checked = k.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = k.raw + a.tokens[0].raw, a.tokens[0].text = k.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(k)) : a.tokens.unshift({ type: "paragraph", raw: k.raw, text: k.raw, tokens: [k] }) : a.tokens.unshift(k);
|
|
10937
|
+
}
|
|
10938
|
+
}
|
|
10939
|
+
else
|
|
10940
|
+
a.task && (a.task = false);
|
|
10941
|
+
if (!r.loose) {
|
|
10942
|
+
let p = a.tokens.filter(h => h.type === "space"), k = p.length > 0 && p.some(h => this.rules.other.anyLine.test(h.raw));
|
|
10943
|
+
r.loose = k;
|
|
10944
|
+
}
|
|
10945
|
+
}
|
|
10946
|
+
if (r.loose)
|
|
10947
|
+
for (let a of r.items) {
|
|
10948
|
+
a.loose = true;
|
|
10949
|
+
for (let c of a.tokens)
|
|
10950
|
+
c.type === "text" && (c.type = "paragraph");
|
|
10951
|
+
}
|
|
10952
|
+
return r;
|
|
10953
|
+
}
|
|
10954
|
+
}
|
|
10955
|
+
html(e) { let t = this.rules.block.html.exec(e); if (t) {
|
|
10956
|
+
let n = ee(t[0]);
|
|
10957
|
+
return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
|
|
10958
|
+
} }
|
|
10959
|
+
def(e) {
|
|
10960
|
+
let t = this.rules.block.def.exec(e);
|
|
10961
|
+
if (t) {
|
|
10962
|
+
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
10963
|
+
return { type: "def", tag: n, raw: $(t[0], `
|
|
10964
|
+
`), href: s, title: r };
|
|
10965
|
+
}
|
|
10966
|
+
}
|
|
10967
|
+
table(e) {
|
|
10968
|
+
let t = this.rules.block.table.exec(e);
|
|
10969
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2]))
|
|
10970
|
+
return;
|
|
10971
|
+
let n = Y(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
10972
|
+
`) : [], i = { type: "table", raw: $(t[0], `
|
|
10973
|
+
`), header: [], align: [], rows: [] };
|
|
10974
|
+
if (n.length === s.length) {
|
|
10975
|
+
for (let o of s)
|
|
10976
|
+
this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
|
|
10977
|
+
for (let o = 0; o < n.length; o++)
|
|
10978
|
+
i.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: true, align: i.align[o] });
|
|
10979
|
+
for (let o of r)
|
|
10980
|
+
i.rows.push(Y(o, i.header.length).map((u, a) => ({ text: u, tokens: this.lexer.inline(u), header: false, align: i.align[a] })));
|
|
10981
|
+
return i;
|
|
10982
|
+
}
|
|
10983
|
+
}
|
|
10984
|
+
lheading(e) {
|
|
10985
|
+
let t = this.rules.block.lheading.exec(e);
|
|
10986
|
+
if (t) {
|
|
10987
|
+
let n = t[1].trim();
|
|
10988
|
+
return { type: "heading", raw: $(t[0], `
|
|
10989
|
+
`), depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
10990
|
+
}
|
|
10991
|
+
}
|
|
10992
|
+
paragraph(e) {
|
|
10993
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
10994
|
+
if (t) {
|
|
10995
|
+
let n = t[1].charAt(t[1].length - 1) === `
|
|
10996
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
10997
|
+
return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
|
|
10998
|
+
}
|
|
10999
|
+
}
|
|
11000
|
+
text(e) { let t = this.rules.block.text.exec(e); if (t)
|
|
11001
|
+
return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) }; }
|
|
11002
|
+
escape(e) { let t = this.rules.inline.escape.exec(e); if (t)
|
|
11003
|
+
return { type: "escape", raw: t[0], text: t[1] }; }
|
|
11004
|
+
tag(e) { let t = this.rules.inline.tag.exec(e); if (t)
|
|
11005
|
+
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] }; }
|
|
11006
|
+
link(e) { let t = this.rules.inline.link.exec(e); if (t) {
|
|
11007
|
+
let n = t[2].trim();
|
|
11008
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
11009
|
+
if (!this.rules.other.endAngleBracket.test(n))
|
|
11010
|
+
return;
|
|
11011
|
+
let i = $(n.slice(0, -1), "\\");
|
|
11012
|
+
if ((n.length - i.length) % 2 === 0)
|
|
11013
|
+
return;
|
|
11014
|
+
}
|
|
11015
|
+
else {
|
|
11016
|
+
let i = fe(t[2], "()");
|
|
11017
|
+
if (i === -2)
|
|
11018
|
+
return;
|
|
11019
|
+
if (i > -1) {
|
|
11020
|
+
let u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
11021
|
+
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, u).trim(), t[3] = "";
|
|
11022
|
+
}
|
|
11023
|
+
}
|
|
11024
|
+
let s = t[2], r = "";
|
|
11025
|
+
if (this.options.pedantic) {
|
|
11026
|
+
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
11027
|
+
i && (s = i[1], r = i[3]);
|
|
11028
|
+
}
|
|
11029
|
+
else
|
|
11030
|
+
r = t[3] ? t[3].slice(1, -1) : "";
|
|
11031
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), xe(t, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
11032
|
+
} }
|
|
11033
|
+
reflink(e, t) { let n; if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
11034
|
+
let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = t[s.toLowerCase()];
|
|
11035
|
+
if (!r) {
|
|
11036
|
+
let i = n[0].charAt(0);
|
|
11037
|
+
return { type: "text", raw: i, text: i };
|
|
11038
|
+
}
|
|
11039
|
+
return xe(n, r, n[0], this.lexer, this.rules);
|
|
11040
|
+
} }
|
|
11041
|
+
emStrong(e, t, n = "") { let s = this.rules.inline.emStrongLDelim.exec(e); if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric))
|
|
11042
|
+
return; if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
11043
|
+
let i = [...s[0]].length - 1, o, u, a = i, c = 0, p = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
11044
|
+
for (p.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = p.exec(t)) !== null;) {
|
|
11045
|
+
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o)
|
|
11046
|
+
continue;
|
|
11047
|
+
if (u = [...o].length, s[3] || s[4]) {
|
|
11048
|
+
a += u;
|
|
11049
|
+
continue;
|
|
11050
|
+
}
|
|
11051
|
+
else if ((s[5] || s[6]) && i % 3 && !((i + u) % 3)) {
|
|
11052
|
+
c += u;
|
|
11053
|
+
continue;
|
|
11054
|
+
}
|
|
11055
|
+
if (a -= u, a > 0)
|
|
11056
|
+
continue;
|
|
11057
|
+
u = Math.min(u, u + a + c);
|
|
11058
|
+
let k = [...s[0]][0].length, h = e.slice(0, i + s.index + k + u);
|
|
11059
|
+
if (Math.min(i, u) % 2) {
|
|
11060
|
+
let f = h.slice(1, -1);
|
|
11061
|
+
return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
11062
|
+
}
|
|
11063
|
+
let R = h.slice(2, -2);
|
|
11064
|
+
return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
|
|
11065
|
+
}
|
|
11066
|
+
} }
|
|
11067
|
+
codespan(e) { let t = this.rules.inline.code.exec(e); if (t) {
|
|
11068
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
11069
|
+
return s && r && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
|
|
11070
|
+
} }
|
|
11071
|
+
br(e) { let t = this.rules.inline.br.exec(e); if (t)
|
|
11072
|
+
return { type: "br", raw: t[0] }; }
|
|
11073
|
+
del(e, t, n = "") { let s = this.rules.inline.delLDelim.exec(e); if (!s)
|
|
11074
|
+
return; if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
11075
|
+
let i = [...s[0]].length - 1, o, u, a = i, c = this.rules.inline.delRDelim;
|
|
11076
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = c.exec(t)) !== null;) {
|
|
11077
|
+
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (u = [...o].length, u !== i))
|
|
11078
|
+
continue;
|
|
11079
|
+
if (s[3] || s[4]) {
|
|
11080
|
+
a += u;
|
|
11081
|
+
continue;
|
|
11082
|
+
}
|
|
11083
|
+
if (a -= u, a > 0)
|
|
11084
|
+
continue;
|
|
11085
|
+
u = Math.min(u, u + a);
|
|
11086
|
+
let p = [...s[0]][0].length, k = e.slice(0, i + s.index + p + u), h = k.slice(i, -i);
|
|
11087
|
+
return { type: "del", raw: k, text: h, tokens: this.lexer.inlineTokens(h) };
|
|
11088
|
+
}
|
|
11089
|
+
} }
|
|
11090
|
+
autolink(e) { let t = this.rules.inline.autolink.exec(e); if (t) {
|
|
11091
|
+
let n, s;
|
|
11092
|
+
return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
|
|
11093
|
+
} }
|
|
11094
|
+
url(e) { let t; if (t = this.rules.inline.url.exec(e)) {
|
|
11095
|
+
let n, s;
|
|
11096
|
+
if (t[2] === "@")
|
|
11097
|
+
n = t[0], s = "mailto:" + n;
|
|
11098
|
+
else {
|
|
11099
|
+
let r;
|
|
11100
|
+
do
|
|
11101
|
+
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
11102
|
+
while (r !== t[0]);
|
|
11103
|
+
n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
|
|
11104
|
+
}
|
|
11105
|
+
return { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
|
|
11106
|
+
} }
|
|
11107
|
+
inlineText(e) { let t = this.rules.inline.text.exec(e); if (t) {
|
|
11108
|
+
let n = this.lexer.state.inRawBlock;
|
|
11109
|
+
return { type: "text", raw: t[0], text: t[0], escaped: n };
|
|
11110
|
+
} }
|
|
11111
|
+
};
|
|
11112
|
+
var x = class l {
|
|
11113
|
+
tokens;
|
|
11114
|
+
options;
|
|
11115
|
+
state;
|
|
11116
|
+
inlineQueue;
|
|
11117
|
+
tokenizer;
|
|
11118
|
+
constructor(e) { this.tokens = [], this.tokens.links = 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 }; let t = { other: m, block: D.normal, inline: A.normal }; this.options.pedantic ? (t.block = D.pedantic, t.inline = A.pedantic) : this.options.gfm && (t.block = D.gfm, this.options.breaks ? t.inline = A.breaks : t.inline = A.gfm), this.tokenizer.rules = t; }
|
|
11119
|
+
static get rules() { return { block: D, inline: A }; }
|
|
11120
|
+
static lex(e, t) { return new l(t).lex(e); }
|
|
11121
|
+
static lexInline(e, t) { return new l(t).inlineTokens(e); }
|
|
11122
|
+
lex(e) {
|
|
11123
|
+
e = e.replace(m.carriageReturn, `
|
|
11124
|
+
`), this.blockTokens(e, this.tokens);
|
|
11125
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
11126
|
+
let n = this.inlineQueue[t];
|
|
11127
|
+
this.inlineTokens(n.src, n.tokens);
|
|
11128
|
+
}
|
|
11129
|
+
return this.inlineQueue = [], this.tokens;
|
|
11130
|
+
}
|
|
11131
|
+
blockTokens(e, t = [], n = false) {
|
|
11132
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, ""));
|
|
11133
|
+
let s = 1 / 0;
|
|
11134
|
+
for (; e;) {
|
|
11135
|
+
if (e.length < s)
|
|
11136
|
+
s = e.length;
|
|
11137
|
+
else {
|
|
11138
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
11139
|
+
break;
|
|
11140
|
+
}
|
|
11141
|
+
let r;
|
|
11142
|
+
if (this.options.extensions?.block?.some(o => (r = o.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false))
|
|
11143
|
+
continue;
|
|
11144
|
+
if (r = this.tokenizer.space(e)) {
|
|
11145
|
+
e = e.substring(r.raw.length);
|
|
11146
|
+
let o = t.at(-1);
|
|
11147
|
+
r.raw.length === 1 && o !== void 0 ? o.raw += `
|
|
11148
|
+
` : t.push(r);
|
|
11149
|
+
continue;
|
|
11150
|
+
}
|
|
11151
|
+
if (r = this.tokenizer.code(e)) {
|
|
11152
|
+
e = e.substring(r.raw.length);
|
|
11153
|
+
let o = t.at(-1);
|
|
11154
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
11155
|
+
`) ? "" : `
|
|
11156
|
+
`) + r.raw, o.text += `
|
|
11157
|
+
` + r.text, this.inlineQueue.at(-1).src = o.text) : t.push(r);
|
|
11158
|
+
continue;
|
|
11159
|
+
}
|
|
11160
|
+
if (r = this.tokenizer.fences(e)) {
|
|
11161
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11162
|
+
continue;
|
|
11163
|
+
}
|
|
11164
|
+
if (r = this.tokenizer.heading(e)) {
|
|
11165
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11166
|
+
continue;
|
|
11167
|
+
}
|
|
11168
|
+
if (r = this.tokenizer.hr(e)) {
|
|
11169
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11170
|
+
continue;
|
|
11171
|
+
}
|
|
11172
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
11173
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11174
|
+
continue;
|
|
11175
|
+
}
|
|
11176
|
+
if (r = this.tokenizer.list(e)) {
|
|
11177
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11178
|
+
continue;
|
|
11179
|
+
}
|
|
11180
|
+
if (r = this.tokenizer.html(e)) {
|
|
11181
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11182
|
+
continue;
|
|
11183
|
+
}
|
|
11184
|
+
if (r = this.tokenizer.def(e)) {
|
|
11185
|
+
e = e.substring(r.raw.length);
|
|
11186
|
+
let o = t.at(-1);
|
|
11187
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
11188
|
+
`) ? "" : `
|
|
11189
|
+
`) + r.raw, o.text += `
|
|
11190
|
+
` + r.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
|
|
11191
|
+
continue;
|
|
11192
|
+
}
|
|
11193
|
+
if (r = this.tokenizer.table(e)) {
|
|
11194
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11195
|
+
continue;
|
|
11196
|
+
}
|
|
11197
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
11198
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11199
|
+
continue;
|
|
11200
|
+
}
|
|
11201
|
+
let i = e;
|
|
11202
|
+
if (this.options.extensions?.startBlock) {
|
|
11203
|
+
let o = 1 / 0, u = e.slice(1), a;
|
|
11204
|
+
this.options.extensions.startBlock.forEach(c => { a = c.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (o = Math.min(o, a)); }), o < 1 / 0 && o >= 0 && (i = e.substring(0, o + 1));
|
|
11205
|
+
}
|
|
11206
|
+
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
11207
|
+
let o = t.at(-1);
|
|
11208
|
+
n && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`
|
|
11209
|
+
`) ? "" : `
|
|
11210
|
+
`) + r.raw, o.text += `
|
|
11211
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
11212
|
+
continue;
|
|
11213
|
+
}
|
|
11214
|
+
if (r = this.tokenizer.text(e)) {
|
|
11215
|
+
e = e.substring(r.raw.length);
|
|
11216
|
+
let o = t.at(-1);
|
|
11217
|
+
o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
11218
|
+
`) ? "" : `
|
|
11219
|
+
`) + r.raw, o.text += `
|
|
11220
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r);
|
|
11221
|
+
continue;
|
|
11222
|
+
}
|
|
11223
|
+
if (e) {
|
|
11224
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
11225
|
+
break;
|
|
11226
|
+
}
|
|
11227
|
+
}
|
|
11228
|
+
return this.state.top = true, t;
|
|
11229
|
+
}
|
|
11230
|
+
inline(e, t = []) { return this.inlineQueue.push({ src: e, tokens: t }), t; }
|
|
11231
|
+
inlineTokens(e, t = []) { this.tokenizer.lexer = this; let n = e, s = null; if (this.tokens.links) {
|
|
11232
|
+
let a = Object.keys(this.tokens.links);
|
|
11233
|
+
if (a.length > 0)
|
|
11234
|
+
for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null;)
|
|
11235
|
+
a.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
11236
|
+
} for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null;)
|
|
11237
|
+
n = n.slice(0, s.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); let r; for (; (s = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null;)
|
|
11238
|
+
r = s[2] ? s[2].length : 0, n = n.slice(0, s.index + r) + "[" + "a".repeat(s[0].length - r - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n; let i = false, o = "", u = 1 / 0; for (; e;) {
|
|
11239
|
+
if (e.length < u)
|
|
11240
|
+
u = e.length;
|
|
11241
|
+
else {
|
|
11242
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
11243
|
+
break;
|
|
11244
|
+
}
|
|
11245
|
+
i || (o = ""), i = false;
|
|
11246
|
+
let a;
|
|
11247
|
+
if (this.options.extensions?.inline?.some(p => (a = p.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), true) : false))
|
|
11248
|
+
continue;
|
|
11249
|
+
if (a = this.tokenizer.escape(e)) {
|
|
11250
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11251
|
+
continue;
|
|
11252
|
+
}
|
|
11253
|
+
if (a = this.tokenizer.tag(e)) {
|
|
11254
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11255
|
+
continue;
|
|
11256
|
+
}
|
|
11257
|
+
if (a = this.tokenizer.link(e)) {
|
|
11258
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11259
|
+
continue;
|
|
11260
|
+
}
|
|
11261
|
+
if (a = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
11262
|
+
e = e.substring(a.raw.length);
|
|
11263
|
+
let p = t.at(-1);
|
|
11264
|
+
a.type === "text" && p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
|
|
11265
|
+
continue;
|
|
11266
|
+
}
|
|
11267
|
+
if (a = this.tokenizer.emStrong(e, n, o)) {
|
|
11268
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11269
|
+
continue;
|
|
11270
|
+
}
|
|
11271
|
+
if (a = this.tokenizer.codespan(e)) {
|
|
11272
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11273
|
+
continue;
|
|
11274
|
+
}
|
|
11275
|
+
if (a = this.tokenizer.br(e)) {
|
|
11276
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11277
|
+
continue;
|
|
11278
|
+
}
|
|
11279
|
+
if (a = this.tokenizer.del(e, n, o)) {
|
|
11280
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11281
|
+
continue;
|
|
11282
|
+
}
|
|
11283
|
+
if (a = this.tokenizer.autolink(e)) {
|
|
11284
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11285
|
+
continue;
|
|
11286
|
+
}
|
|
11287
|
+
if (!this.state.inLink && (a = this.tokenizer.url(e))) {
|
|
11288
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11289
|
+
continue;
|
|
11290
|
+
}
|
|
11291
|
+
let c = e;
|
|
11292
|
+
if (this.options.extensions?.startInline) {
|
|
11293
|
+
let p = 1 / 0, k = e.slice(1), h;
|
|
11294
|
+
this.options.extensions.startInline.forEach(R => { h = R.call({ lexer: this }, k), typeof h == "number" && h >= 0 && (p = Math.min(p, h)); }), p < 1 / 0 && p >= 0 && (c = e.substring(0, p + 1));
|
|
11295
|
+
}
|
|
11296
|
+
if (a = this.tokenizer.inlineText(c)) {
|
|
11297
|
+
e = e.substring(a.raw.length), a.raw.slice(-1) !== "_" && (o = a.raw.slice(-1)), i = true;
|
|
11298
|
+
let p = t.at(-1);
|
|
11299
|
+
p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
|
|
11300
|
+
continue;
|
|
11301
|
+
}
|
|
11302
|
+
if (e) {
|
|
11303
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
11304
|
+
break;
|
|
11305
|
+
}
|
|
11306
|
+
} return t; }
|
|
11307
|
+
infiniteLoopError(e) { let t = "Infinite loop on byte: " + e; if (this.options.silent)
|
|
11308
|
+
console.error(t);
|
|
11309
|
+
else
|
|
11310
|
+
throw new Error(t); }
|
|
11311
|
+
};
|
|
11312
|
+
var y = class {
|
|
11313
|
+
options;
|
|
11314
|
+
parser;
|
|
11315
|
+
constructor(e) { this.options = e || T; }
|
|
11316
|
+
space(e) { return ""; }
|
|
11317
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
11318
|
+
let s = (t || "").match(m.notSpaceStart)?.[0], r = e.replace(m.endingNewline, "") + `
|
|
11319
|
+
`;
|
|
11320
|
+
return s ? '<pre><code class="language-' + O(s) + '">' + (n ? r : O(r, true)) + `</code></pre>
|
|
11321
|
+
` : "<pre><code>" + (n ? r : O(r, true)) + `</code></pre>
|
|
11322
|
+
`;
|
|
11323
|
+
}
|
|
11324
|
+
blockquote({ tokens: e }) {
|
|
11325
|
+
return `<blockquote>
|
|
11326
|
+
${this.parser.parse(e)}</blockquote>
|
|
11327
|
+
`;
|
|
11328
|
+
}
|
|
11329
|
+
html({ text: e }) { return e; }
|
|
11330
|
+
def(e) { return ""; }
|
|
11331
|
+
heading({ tokens: e, depth: t }) {
|
|
11332
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
11333
|
+
`;
|
|
11334
|
+
}
|
|
11335
|
+
hr(e) {
|
|
11336
|
+
return `<hr>
|
|
11337
|
+
`;
|
|
11338
|
+
}
|
|
11339
|
+
list(e) {
|
|
11340
|
+
let t = e.ordered, n = e.start, s = "";
|
|
11341
|
+
for (let o = 0; o < e.items.length; o++) {
|
|
11342
|
+
let u = e.items[o];
|
|
11343
|
+
s += this.listitem(u);
|
|
11344
|
+
}
|
|
11345
|
+
let r = t ? "ol" : "ul", i = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
11346
|
+
return "<" + r + i + `>
|
|
11347
|
+
` + s + "</" + r + `>
|
|
11348
|
+
`;
|
|
11349
|
+
}
|
|
11350
|
+
listitem(e) {
|
|
11351
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
11352
|
+
`;
|
|
11353
|
+
}
|
|
11354
|
+
checkbox({ checked: e }) { return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> '; }
|
|
11355
|
+
paragraph({ tokens: e }) {
|
|
11356
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
11357
|
+
`;
|
|
11358
|
+
}
|
|
11359
|
+
table(e) {
|
|
11360
|
+
let t = "", n = "";
|
|
11361
|
+
for (let r = 0; r < e.header.length; r++)
|
|
11362
|
+
n += this.tablecell(e.header[r]);
|
|
11363
|
+
t += this.tablerow({ text: n });
|
|
11364
|
+
let s = "";
|
|
11365
|
+
for (let r = 0; r < e.rows.length; r++) {
|
|
11366
|
+
let i = e.rows[r];
|
|
11367
|
+
n = "";
|
|
11368
|
+
for (let o = 0; o < i.length; o++)
|
|
11369
|
+
n += this.tablecell(i[o]);
|
|
11370
|
+
s += this.tablerow({ text: n });
|
|
11371
|
+
}
|
|
11372
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
11373
|
+
<thead>
|
|
11374
|
+
` + t + `</thead>
|
|
11375
|
+
` + s + `</table>
|
|
11376
|
+
`;
|
|
11377
|
+
}
|
|
11378
|
+
tablerow({ text: e }) {
|
|
11379
|
+
return `<tr>
|
|
11380
|
+
${e}</tr>
|
|
11381
|
+
`;
|
|
11382
|
+
}
|
|
11383
|
+
tablecell(e) {
|
|
11384
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
11385
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
11386
|
+
`;
|
|
11387
|
+
}
|
|
11388
|
+
strong({ tokens: e }) { return `<strong>${this.parser.parseInline(e)}</strong>`; }
|
|
11389
|
+
em({ tokens: e }) { return `<em>${this.parser.parseInline(e)}</em>`; }
|
|
11390
|
+
codespan({ text: e }) { return `<code>${O(e, true)}</code>`; }
|
|
11391
|
+
br(e) { return "<br>"; }
|
|
11392
|
+
del({ tokens: e }) { return `<del>${this.parser.parseInline(e)}</del>`; }
|
|
11393
|
+
link({ href: e, title: t, tokens: n }) { let s = this.parser.parseInline(n), r = V(e); if (r === null)
|
|
11394
|
+
return s; e = r; let i = '<a href="' + e + '"'; return t && (i += ' title="' + O(t) + '"'), i += ">" + s + "</a>", i; }
|
|
11395
|
+
image({ href: e, title: t, text: n, tokens: s }) { s && (n = this.parser.parseInline(s, this.parser.textRenderer)); let r = V(e); if (r === null)
|
|
11396
|
+
return O(n); e = r; let i = `<img src="${e}" alt="${O(n)}"`; return t && (i += ` title="${O(t)}"`), i += ">", i; }
|
|
11397
|
+
text(e) { return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text); }
|
|
11398
|
+
};
|
|
11399
|
+
var L = class {
|
|
11400
|
+
strong({ text: e }) { return e; }
|
|
11401
|
+
em({ text: e }) { return e; }
|
|
11402
|
+
codespan({ text: e }) { return e; }
|
|
11403
|
+
del({ text: e }) { return e; }
|
|
11404
|
+
html({ text: e }) { return e; }
|
|
11405
|
+
text({ text: e }) { return e; }
|
|
11406
|
+
link({ text: e }) { return "" + e; }
|
|
11407
|
+
image({ text: e }) { return "" + e; }
|
|
11408
|
+
br() { return ""; }
|
|
11409
|
+
checkbox({ raw: e }) { return e; }
|
|
11410
|
+
};
|
|
11411
|
+
var b = class l {
|
|
11412
|
+
options;
|
|
11413
|
+
renderer;
|
|
11414
|
+
textRenderer;
|
|
11415
|
+
constructor(e) { 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 L; }
|
|
11416
|
+
static parse(e, t) { return new l(t).parse(e); }
|
|
11417
|
+
static parseInline(e, t) { return new l(t).parseInline(e); }
|
|
11418
|
+
parse(e) { this.renderer.parser = this; let t = ""; for (let n = 0; n < e.length; n++) {
|
|
11419
|
+
let s = e[n];
|
|
11420
|
+
if (this.options.extensions?.renderers?.[s.type]) {
|
|
11421
|
+
let i = s, o = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
11422
|
+
if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(i.type)) {
|
|
11423
|
+
t += o || "";
|
|
11424
|
+
continue;
|
|
11425
|
+
}
|
|
11426
|
+
}
|
|
11427
|
+
let r = s;
|
|
11428
|
+
switch (r.type) {
|
|
11429
|
+
case "space": {
|
|
11430
|
+
t += this.renderer.space(r);
|
|
11431
|
+
break;
|
|
11432
|
+
}
|
|
11433
|
+
case "hr": {
|
|
11434
|
+
t += this.renderer.hr(r);
|
|
11435
|
+
break;
|
|
11436
|
+
}
|
|
11437
|
+
case "heading": {
|
|
11438
|
+
t += this.renderer.heading(r);
|
|
11439
|
+
break;
|
|
11440
|
+
}
|
|
11441
|
+
case "code": {
|
|
11442
|
+
t += this.renderer.code(r);
|
|
11443
|
+
break;
|
|
11444
|
+
}
|
|
11445
|
+
case "table": {
|
|
11446
|
+
t += this.renderer.table(r);
|
|
11447
|
+
break;
|
|
11448
|
+
}
|
|
11449
|
+
case "blockquote": {
|
|
11450
|
+
t += this.renderer.blockquote(r);
|
|
11451
|
+
break;
|
|
11452
|
+
}
|
|
11453
|
+
case "list": {
|
|
11454
|
+
t += this.renderer.list(r);
|
|
11455
|
+
break;
|
|
11456
|
+
}
|
|
11457
|
+
case "checkbox": {
|
|
11458
|
+
t += this.renderer.checkbox(r);
|
|
11459
|
+
break;
|
|
11460
|
+
}
|
|
11461
|
+
case "html": {
|
|
11462
|
+
t += this.renderer.html(r);
|
|
11463
|
+
break;
|
|
11464
|
+
}
|
|
11465
|
+
case "def": {
|
|
11466
|
+
t += this.renderer.def(r);
|
|
11467
|
+
break;
|
|
11468
|
+
}
|
|
11469
|
+
case "paragraph": {
|
|
11470
|
+
t += this.renderer.paragraph(r);
|
|
11471
|
+
break;
|
|
11472
|
+
}
|
|
11473
|
+
case "text": {
|
|
11474
|
+
t += this.renderer.text(r);
|
|
11475
|
+
break;
|
|
11476
|
+
}
|
|
11477
|
+
default: {
|
|
11478
|
+
let i = 'Token with "' + r.type + '" type was not found.';
|
|
11479
|
+
if (this.options.silent)
|
|
11480
|
+
return console.error(i), "";
|
|
11481
|
+
throw new Error(i);
|
|
11482
|
+
}
|
|
11483
|
+
}
|
|
11484
|
+
} return t; }
|
|
11485
|
+
parseInline(e, t = this.renderer) { this.renderer.parser = this; let n = ""; for (let s = 0; s < e.length; s++) {
|
|
11486
|
+
let r = e[s];
|
|
11487
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
11488
|
+
let o = this.options.extensions.renderers[r.type].call({ parser: this }, r);
|
|
11489
|
+
if (o !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
|
|
11490
|
+
n += o || "";
|
|
11491
|
+
continue;
|
|
11492
|
+
}
|
|
11493
|
+
}
|
|
11494
|
+
let i = r;
|
|
11495
|
+
switch (i.type) {
|
|
11496
|
+
case "escape": {
|
|
11497
|
+
n += t.text(i);
|
|
11498
|
+
break;
|
|
11499
|
+
}
|
|
11500
|
+
case "html": {
|
|
11501
|
+
n += t.html(i);
|
|
11502
|
+
break;
|
|
11503
|
+
}
|
|
11504
|
+
case "link": {
|
|
11505
|
+
n += t.link(i);
|
|
11506
|
+
break;
|
|
11507
|
+
}
|
|
11508
|
+
case "image": {
|
|
11509
|
+
n += t.image(i);
|
|
11510
|
+
break;
|
|
11511
|
+
}
|
|
11512
|
+
case "checkbox": {
|
|
11513
|
+
n += t.checkbox(i);
|
|
11514
|
+
break;
|
|
11515
|
+
}
|
|
11516
|
+
case "strong": {
|
|
11517
|
+
n += t.strong(i);
|
|
11518
|
+
break;
|
|
11519
|
+
}
|
|
11520
|
+
case "em": {
|
|
11521
|
+
n += t.em(i);
|
|
11522
|
+
break;
|
|
11523
|
+
}
|
|
11524
|
+
case "codespan": {
|
|
11525
|
+
n += t.codespan(i);
|
|
11526
|
+
break;
|
|
11527
|
+
}
|
|
11528
|
+
case "br": {
|
|
11529
|
+
n += t.br(i);
|
|
11530
|
+
break;
|
|
11531
|
+
}
|
|
11532
|
+
case "del": {
|
|
11533
|
+
n += t.del(i);
|
|
11534
|
+
break;
|
|
11535
|
+
}
|
|
11536
|
+
case "text": {
|
|
11537
|
+
n += t.text(i);
|
|
11538
|
+
break;
|
|
11539
|
+
}
|
|
11540
|
+
default: {
|
|
11541
|
+
let o = 'Token with "' + i.type + '" type was not found.';
|
|
11542
|
+
if (this.options.silent)
|
|
11543
|
+
return console.error(o), "";
|
|
11544
|
+
throw new Error(o);
|
|
11545
|
+
}
|
|
11546
|
+
}
|
|
11547
|
+
} return n; }
|
|
11548
|
+
};
|
|
11549
|
+
var P = class {
|
|
11550
|
+
options;
|
|
11551
|
+
block;
|
|
11552
|
+
constructor(e) { this.options = e || T; }
|
|
11553
|
+
static passThroughHooks = new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
11554
|
+
static passThroughHooksRespectAsync = new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
11555
|
+
preprocess(e) { return e; }
|
|
11556
|
+
postprocess(e) { return e; }
|
|
11557
|
+
processAllTokens(e) { return e; }
|
|
11558
|
+
emStrongMask(e) { return e; }
|
|
11559
|
+
provideLexer(e = this.block) { return e ? x.lex : x.lexInline; }
|
|
11560
|
+
provideParser(e = this.block) { return e ? b.parse : b.parseInline; }
|
|
11561
|
+
};
|
|
11562
|
+
var q = class {
|
|
11563
|
+
defaults = M();
|
|
11564
|
+
options = this.setOptions;
|
|
11565
|
+
parse = this.parseMarkdown(true);
|
|
11566
|
+
parseInline = this.parseMarkdown(false);
|
|
11567
|
+
Parser = b;
|
|
11568
|
+
Renderer = y;
|
|
11569
|
+
TextRenderer = L;
|
|
11570
|
+
Lexer = x;
|
|
11571
|
+
Tokenizer = w;
|
|
11572
|
+
Hooks = P;
|
|
11573
|
+
constructor(...e) { this.use(...e); }
|
|
11574
|
+
walkTokens(e, t) { let n = []; for (let s of e)
|
|
11575
|
+
switch (n = n.concat(t.call(this, s)), s.type) {
|
|
11576
|
+
case "table": {
|
|
11577
|
+
let r = s;
|
|
11578
|
+
for (let i of r.header)
|
|
11579
|
+
n = n.concat(this.walkTokens(i.tokens, t));
|
|
11580
|
+
for (let i of r.rows)
|
|
11581
|
+
for (let o of i)
|
|
11582
|
+
n = n.concat(this.walkTokens(o.tokens, t));
|
|
11583
|
+
break;
|
|
11584
|
+
}
|
|
11585
|
+
case "list": {
|
|
11586
|
+
let r = s;
|
|
11587
|
+
n = n.concat(this.walkTokens(r.items, t));
|
|
11588
|
+
break;
|
|
11589
|
+
}
|
|
11590
|
+
default: {
|
|
11591
|
+
let r = s;
|
|
11592
|
+
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach(i => { let o = r[i].flat(1 / 0); n = n.concat(this.walkTokens(o, t)); }) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
|
|
11593
|
+
}
|
|
11594
|
+
} return n; }
|
|
11595
|
+
use(...e) { let t = this.defaults.extensions || { renderers: {}, childTokens: {} }; return e.forEach(n => { let s = { ...n }; if (s.async = this.defaults.async || s.async || false, n.extensions && (n.extensions.forEach(r => { if (!r.name)
|
|
11596
|
+
throw new Error("extension name required"); if ("renderer" in r) {
|
|
11597
|
+
let i = t.renderers[r.name];
|
|
11598
|
+
i ? t.renderers[r.name] = function (...o) { let u = r.renderer.apply(this, o); return u === false && (u = i.apply(this, o)), u; } : t.renderers[r.name] = r.renderer;
|
|
11599
|
+
} if ("tokenizer" in r) {
|
|
11600
|
+
if (!r.level || r.level !== "block" && r.level !== "inline")
|
|
11601
|
+
throw new Error("extension level must be 'block' or 'inline'");
|
|
11602
|
+
let i = t[r.level];
|
|
11603
|
+
i ? i.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
|
|
11604
|
+
} "childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens); }), s.extensions = t), n.renderer) {
|
|
11605
|
+
let r = this.defaults.renderer || new y(this.defaults);
|
|
11606
|
+
for (let i in n.renderer) {
|
|
11607
|
+
if (!(i in r))
|
|
11608
|
+
throw new Error(`renderer '${i}' does not exist`);
|
|
11609
|
+
if (["options", "parser"].includes(i))
|
|
11610
|
+
continue;
|
|
11611
|
+
let o = i, u = n.renderer[o], a = r[o];
|
|
11612
|
+
r[o] = (...c) => { let p = u.apply(r, c); return p === false && (p = a.apply(r, c)), p || ""; };
|
|
11613
|
+
}
|
|
11614
|
+
s.renderer = r;
|
|
11615
|
+
} if (n.tokenizer) {
|
|
11616
|
+
let r = this.defaults.tokenizer || new w(this.defaults);
|
|
11617
|
+
for (let i in n.tokenizer) {
|
|
11618
|
+
if (!(i in r))
|
|
11619
|
+
throw new Error(`tokenizer '${i}' does not exist`);
|
|
11620
|
+
if (["options", "rules", "lexer"].includes(i))
|
|
11621
|
+
continue;
|
|
11622
|
+
let o = i, u = n.tokenizer[o], a = r[o];
|
|
11623
|
+
r[o] = (...c) => { let p = u.apply(r, c); return p === false && (p = a.apply(r, c)), p; };
|
|
11624
|
+
}
|
|
11625
|
+
s.tokenizer = r;
|
|
11626
|
+
} if (n.hooks) {
|
|
11627
|
+
let r = this.defaults.hooks || new P;
|
|
11628
|
+
for (let i in n.hooks) {
|
|
11629
|
+
if (!(i in r))
|
|
11630
|
+
throw new Error(`hook '${i}' does not exist`);
|
|
11631
|
+
if (["options", "block"].includes(i))
|
|
11632
|
+
continue;
|
|
11633
|
+
let o = i, u = n.hooks[o], a = r[o];
|
|
11634
|
+
P.passThroughHooks.has(i) ? r[o] = c => { if (this.defaults.async && P.passThroughHooksRespectAsync.has(i))
|
|
11635
|
+
return (async () => { let k = await u.call(r, c); return a.call(r, k); })(); let p = u.call(r, c); return a.call(r, p); } : r[o] = (...c) => { if (this.defaults.async)
|
|
11636
|
+
return (async () => { let k = await u.apply(r, c); return k === false && (k = await a.apply(r, c)), k; })(); let p = u.apply(r, c); return p === false && (p = a.apply(r, c)), p; };
|
|
11637
|
+
}
|
|
11638
|
+
s.hooks = r;
|
|
11639
|
+
} if (n.walkTokens) {
|
|
11640
|
+
let r = this.defaults.walkTokens, i = n.walkTokens;
|
|
11641
|
+
s.walkTokens = function (o) { let u = []; return u.push(i.call(this, o)), r && (u = u.concat(r.call(this, o))), u; };
|
|
11642
|
+
} this.defaults = { ...this.defaults, ...s }; }), this; }
|
|
11643
|
+
setOptions(e) { return this.defaults = { ...this.defaults, ...e }, this; }
|
|
11644
|
+
lexer(e, t) { return x.lex(e, t ?? this.defaults); }
|
|
11645
|
+
parser(e, t) { return b.parse(e, t ?? this.defaults); }
|
|
11646
|
+
parseMarkdown(e) { return (n, s) => { let r = { ...s }, i = { ...this.defaults, ...r }, o = this.onError(!!i.silent, !!i.async); if (this.defaults.async === true && r.async === false)
|
|
11647
|
+
return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.")); if (typeof n > "u" || n === null)
|
|
11648
|
+
return o(new Error("marked(): input parameter is undefined or null")); if (typeof n != "string")
|
|
11649
|
+
return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected")); if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async)
|
|
11650
|
+
return (async () => { let u = i.hooks ? await i.hooks.preprocess(n) : n, c = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(u, i), p = i.hooks ? await i.hooks.processAllTokens(c) : c; i.walkTokens && await Promise.all(this.walkTokens(p, i.walkTokens)); let h = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(p, i); return i.hooks ? await i.hooks.postprocess(h) : h; })().catch(o); try {
|
|
11651
|
+
i.hooks && (n = i.hooks.preprocess(n));
|
|
11652
|
+
let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, i);
|
|
11653
|
+
i.hooks && (a = i.hooks.processAllTokens(a)), i.walkTokens && this.walkTokens(a, i.walkTokens);
|
|
11654
|
+
let p = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
|
|
11655
|
+
return i.hooks && (p = i.hooks.postprocess(p)), p;
|
|
11656
|
+
}
|
|
11657
|
+
catch (u) {
|
|
11658
|
+
return o(u);
|
|
11659
|
+
} }; }
|
|
11660
|
+
onError(e, t) {
|
|
11661
|
+
return n => {
|
|
11662
|
+
if (n.message += `
|
|
11663
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
11664
|
+
let s = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
|
|
11665
|
+
return t ? Promise.resolve(s) : s;
|
|
11666
|
+
}
|
|
11667
|
+
if (t)
|
|
11668
|
+
return Promise.reject(n);
|
|
11669
|
+
throw n;
|
|
11670
|
+
};
|
|
11671
|
+
}
|
|
11672
|
+
};
|
|
11673
|
+
var z = new q;
|
|
11674
|
+
function g(l, e) { return z.parse(l, e); }
|
|
11675
|
+
g.options = g.setOptions = function (l) { return z.setOptions(l), g.defaults = z.defaults, N(g.defaults), g; };
|
|
11676
|
+
g.getDefaults = M;
|
|
11677
|
+
g.defaults = T;
|
|
11678
|
+
g.use = function (...l) { return z.use(...l), g.defaults = z.defaults, N(g.defaults), g; };
|
|
11679
|
+
g.walkTokens = function (l, e) { return z.walkTokens(l, e); };
|
|
11680
|
+
g.parseInline = z.parseInline;
|
|
11681
|
+
g.Parser = b;
|
|
11682
|
+
g.parser = b.parse;
|
|
11683
|
+
g.Renderer = y;
|
|
11684
|
+
g.TextRenderer = L;
|
|
11685
|
+
g.Lexer = x;
|
|
11686
|
+
g.lexer = x.lex;
|
|
11687
|
+
g.Tokenizer = w;
|
|
11688
|
+
g.Hooks = P;
|
|
11689
|
+
g.parse = g;
|
|
11690
|
+
g.options; g.setOptions; g.use; g.walkTokens; g.parseInline; b.parse; x.lex;
|
|
11691
|
+
|
|
10593
11692
|
// Copyright 2013 The Chromium Authors
|
|
10594
11693
|
class BalancedJSONTokenizer {
|
|
10595
11694
|
callback;
|
|
@@ -10703,16 +11802,17 @@ class HeapSnapshotLoader {
|
|
|
10703
11802
|
this.#reset();
|
|
10704
11803
|
return result;
|
|
10705
11804
|
}
|
|
10706
|
-
#
|
|
11805
|
+
#parseIntArray() {
|
|
10707
11806
|
let index = 0;
|
|
10708
11807
|
const char0 = '0'.charCodeAt(0);
|
|
10709
11808
|
const char9 = '9'.charCodeAt(0);
|
|
11809
|
+
const minus = '-'.charCodeAt(0);
|
|
10710
11810
|
const closingBracket = ']'.charCodeAt(0);
|
|
10711
11811
|
const length = this.#json.length;
|
|
10712
11812
|
while (true) {
|
|
10713
11813
|
while (index < length) {
|
|
10714
11814
|
const code = this.#json.charCodeAt(index);
|
|
10715
|
-
if (char0 <= code && code <= char9) {
|
|
11815
|
+
if ((char0 <= code && code <= char9) || code === minus) {
|
|
10716
11816
|
break;
|
|
10717
11817
|
}
|
|
10718
11818
|
else if (code === closingBracket) {
|
|
@@ -10725,8 +11825,13 @@ class HeapSnapshotLoader {
|
|
|
10725
11825
|
this.#json = '';
|
|
10726
11826
|
return true;
|
|
10727
11827
|
}
|
|
10728
|
-
let nextNumber = 0;
|
|
10729
11828
|
const startIndex = index;
|
|
11829
|
+
let negative = false;
|
|
11830
|
+
if (this.#json.charCodeAt(index) === minus) {
|
|
11831
|
+
negative = true;
|
|
11832
|
+
++index;
|
|
11833
|
+
}
|
|
11834
|
+
let nextNumber = 0;
|
|
10730
11835
|
while (index < length) {
|
|
10731
11836
|
const code = this.#json.charCodeAt(index);
|
|
10732
11837
|
if (char0 > code || code > char9) {
|
|
@@ -10743,7 +11848,7 @@ class HeapSnapshotLoader {
|
|
|
10743
11848
|
if (!this.#array) {
|
|
10744
11849
|
throw new Error('Array not instantiated');
|
|
10745
11850
|
}
|
|
10746
|
-
this.#array.setValue(this.#arrayIndex++, nextNumber);
|
|
11851
|
+
this.#array.setValue(this.#arrayIndex++, negative ? -nextNumber : nextNumber);
|
|
10747
11852
|
}
|
|
10748
11853
|
}
|
|
10749
11854
|
#parseStringsArray() {
|
|
@@ -10801,7 +11906,7 @@ class HeapSnapshotLoader {
|
|
|
10801
11906
|
this.#array = length === undefined ? createExpandableBigUint32Array() :
|
|
10802
11907
|
createFixedBigUint32Array(length);
|
|
10803
11908
|
this.#arrayIndex = 0;
|
|
10804
|
-
while (this.#
|
|
11909
|
+
while (this.#parseIntArray()) {
|
|
10805
11910
|
if (length) {
|
|
10806
11911
|
this.#progress.updateProgress(title, this.#arrayIndex, this.#array.length);
|
|
10807
11912
|
}
|