@jxsuite/parser 1.8.2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/serialize.js CHANGED
@@ -923,6 +923,102 @@ var init_guards = __esm(() => {
923
923
  ]);
924
924
  });
925
925
 
926
+ // ../../node_modules/unist-util-is/lib/index.js
927
+ function anyFactory(tests) {
928
+ const checks = [];
929
+ let index = -1;
930
+ while (++index < tests.length) {
931
+ checks[index] = convert(tests[index]);
932
+ }
933
+ return castFactory(any);
934
+ function any(...parameters) {
935
+ let index = -1;
936
+ while (++index < checks.length) {
937
+ if (checks[index].apply(this, parameters))
938
+ return true;
939
+ }
940
+ return false;
941
+ }
942
+ }
943
+ function propertiesFactory(check) {
944
+ const checkAsRecord = check;
945
+ return castFactory(all);
946
+ function all(node) {
947
+ const nodeAsRecord = node;
948
+ let key;
949
+ for (key in check) {
950
+ if (nodeAsRecord[key] !== checkAsRecord[key])
951
+ return false;
952
+ }
953
+ return true;
954
+ }
955
+ }
956
+ function typeFactory(check) {
957
+ return castFactory(type);
958
+ function type(node) {
959
+ return node && node.type === check;
960
+ }
961
+ }
962
+ function castFactory(testFunction) {
963
+ return check;
964
+ function check(value, index, parent) {
965
+ return Boolean(looksLikeANode(value) && testFunction.call(this, value, typeof index === "number" ? index : undefined, parent || undefined));
966
+ }
967
+ }
968
+ function ok2() {
969
+ return true;
970
+ }
971
+ function looksLikeANode(value) {
972
+ return value !== null && typeof value === "object" && "type" in value;
973
+ }
974
+ var convert = function(test) {
975
+ if (test === null || test === undefined) {
976
+ return ok2;
977
+ }
978
+ if (typeof test === "function") {
979
+ return castFactory(test);
980
+ }
981
+ if (typeof test === "object") {
982
+ return Array.isArray(test) ? anyFactory(test) : propertiesFactory(test);
983
+ }
984
+ if (typeof test === "string") {
985
+ return typeFactory(test);
986
+ }
987
+ throw new Error("Expected function, string, or object as test");
988
+ };
989
+
990
+ // ../../node_modules/unist-util-is/index.js
991
+ var init_unist_util_is = () => {};
992
+
993
+ // ../../node_modules/mdast-util-phrasing/lib/index.js
994
+ var phrasing;
995
+ var init_lib4 = __esm(() => {
996
+ init_unist_util_is();
997
+ phrasing = convert([
998
+ "break",
999
+ "delete",
1000
+ "emphasis",
1001
+ "footnote",
1002
+ "footnoteReference",
1003
+ "image",
1004
+ "imageReference",
1005
+ "inlineCode",
1006
+ "inlineMath",
1007
+ "link",
1008
+ "linkReference",
1009
+ "mdxJsxTextElement",
1010
+ "mdxTextExpression",
1011
+ "strong",
1012
+ "text",
1013
+ "textDirective"
1014
+ ]);
1015
+ });
1016
+
1017
+ // ../../node_modules/mdast-util-phrasing/index.js
1018
+ var init_mdast_util_phrasing = __esm(() => {
1019
+ init_lib4();
1020
+ });
1021
+
926
1022
  // ../../node_modules/zwitch/index.js
927
1023
  function zwitch(key, options) {
928
1024
  const settings = options || {};
@@ -1035,9 +1131,10 @@ function listInScope(stack, list, none) {
1035
1131
  function hardBreak(_, _1, state, info) {
1036
1132
  let index = -1;
1037
1133
  while (++index < state.unsafe.length) {
1038
- if (state.unsafe[index].character === `
1039
- ` && patternInScope(state.stack, state.unsafe[index])) {
1040
- return /[ \t]/.test(info.before) ? "" : " ";
1134
+ const pattern = state.unsafe[index];
1135
+ if (pattern.character === `
1136
+ ` && !pattern.before && !pattern.after && patternInScope(state.stack, pattern)) {
1137
+ return /[\t ]/.test(info.before) ? "" : " ";
1041
1138
  }
1042
1139
  }
1043
1140
  return "\\\n";
@@ -1070,7 +1167,7 @@ function longestStreak(value, substring) {
1070
1167
 
1071
1168
  // ../../node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
1072
1169
  function formatCodeAsIndented(node, state) {
1073
- return Boolean(state.options.fences === false && node.value && !node.lang && /[^ \r\n]/.test(node.value) && !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value));
1170
+ return Boolean(state.options.fences === false && node.value && !node.lang && /[^\n\r ]/.test(node.value) && !/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(node.value));
1074
1171
  }
1075
1172
 
1076
1173
  // ../../node_modules/mdast-util-to-markdown/lib/util/check-fence.js
@@ -1086,7 +1183,6 @@ function checkFence(state) {
1086
1183
  function code(node, _, state, info) {
1087
1184
  const marker = checkFence(state);
1088
1185
  const raw = node.value || "";
1089
- const suffix = marker === "`" ? "GraveAccent" : "Tilde";
1090
1186
  if (formatCodeAsIndented(node, state)) {
1091
1187
  const exit = state.enter("codeIndented");
1092
1188
  const value = state.indentLines(raw, map3);
@@ -1096,6 +1192,7 @@ function code(node, _, state, info) {
1096
1192
  const tracker = state.createTracker(info);
1097
1193
  const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
1098
1194
  const exit = state.enter("codeFenced");
1195
+ const suffix = marker === "`" ? "GraveAccent" : "Tilde";
1099
1196
  let value = tracker.move(sequence);
1100
1197
  if (node.lang) {
1101
1198
  const subexit = state.enter(`codeFencedLang${suffix}`);
@@ -1198,691 +1295,139 @@ function checkEmphasis(state) {
1198
1295
  return marker;
1199
1296
  }
1200
1297
 
1298
+ // ../../node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
1299
+ function emphasis(node, _, state, info) {
1300
+ const exit = state.enter("phrasing");
1301
+ const value = state.containerPhrasing({ type: "root", children: [node] }, info);
1302
+ exit();
1303
+ return value;
1304
+ }
1305
+ function attention(_, state) {
1306
+ const marker = checkEmphasis(state);
1307
+ return {
1308
+ construct: "emphasis",
1309
+ markers: marker === "*" ? ["*", "_"] : ["_", "*"],
1310
+ sizes: [1]
1311
+ };
1312
+ }
1313
+ function peek(_, _1, state) {
1314
+ return state.options.emphasis || "*";
1315
+ }
1316
+ var init_emphasis = __esm(() => {
1317
+ emphasis.attention = attention;
1318
+ emphasis.peek = peek;
1319
+ });
1320
+
1201
1321
  // ../../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
1202
1322
  function encodeCharacterReference(code) {
1203
1323
  return "&#x" + code.toString(16).toUpperCase() + ";";
1204
1324
  }
1205
1325
 
1206
- // ../../node_modules/micromark-util-symbol/lib/codes.js
1207
- var codes;
1208
- var init_codes = __esm(() => {
1209
- codes = {
1210
- carriageReturn: -5,
1211
- lineFeed: -4,
1212
- carriageReturnLineFeed: -3,
1213
- horizontalTab: -2,
1214
- virtualSpace: -1,
1215
- eof: null,
1216
- nul: 0,
1217
- soh: 1,
1218
- stx: 2,
1219
- etx: 3,
1220
- eot: 4,
1221
- enq: 5,
1222
- ack: 6,
1223
- bel: 7,
1224
- bs: 8,
1225
- ht: 9,
1226
- lf: 10,
1227
- vt: 11,
1228
- ff: 12,
1229
- cr: 13,
1230
- so: 14,
1231
- si: 15,
1232
- dle: 16,
1233
- dc1: 17,
1234
- dc2: 18,
1235
- dc3: 19,
1236
- dc4: 20,
1237
- nak: 21,
1238
- syn: 22,
1239
- etb: 23,
1240
- can: 24,
1241
- em: 25,
1242
- sub: 26,
1243
- esc: 27,
1244
- fs: 28,
1245
- gs: 29,
1246
- rs: 30,
1247
- us: 31,
1248
- space: 32,
1249
- exclamationMark: 33,
1250
- quotationMark: 34,
1251
- numberSign: 35,
1252
- dollarSign: 36,
1253
- percentSign: 37,
1254
- ampersand: 38,
1255
- apostrophe: 39,
1256
- leftParenthesis: 40,
1257
- rightParenthesis: 41,
1258
- asterisk: 42,
1259
- plusSign: 43,
1260
- comma: 44,
1261
- dash: 45,
1262
- dot: 46,
1263
- slash: 47,
1264
- digit0: 48,
1265
- digit1: 49,
1266
- digit2: 50,
1267
- digit3: 51,
1268
- digit4: 52,
1269
- digit5: 53,
1270
- digit6: 54,
1271
- digit7: 55,
1272
- digit8: 56,
1273
- digit9: 57,
1274
- colon: 58,
1275
- semicolon: 59,
1276
- lessThan: 60,
1277
- equalsTo: 61,
1278
- greaterThan: 62,
1279
- questionMark: 63,
1280
- atSign: 64,
1281
- uppercaseA: 65,
1282
- uppercaseB: 66,
1283
- uppercaseC: 67,
1284
- uppercaseD: 68,
1285
- uppercaseE: 69,
1286
- uppercaseF: 70,
1287
- uppercaseG: 71,
1288
- uppercaseH: 72,
1289
- uppercaseI: 73,
1290
- uppercaseJ: 74,
1291
- uppercaseK: 75,
1292
- uppercaseL: 76,
1293
- uppercaseM: 77,
1294
- uppercaseN: 78,
1295
- uppercaseO: 79,
1296
- uppercaseP: 80,
1297
- uppercaseQ: 81,
1298
- uppercaseR: 82,
1299
- uppercaseS: 83,
1300
- uppercaseT: 84,
1301
- uppercaseU: 85,
1302
- uppercaseV: 86,
1303
- uppercaseW: 87,
1304
- uppercaseX: 88,
1305
- uppercaseY: 89,
1306
- uppercaseZ: 90,
1307
- leftSquareBracket: 91,
1308
- backslash: 92,
1309
- rightSquareBracket: 93,
1310
- caret: 94,
1311
- underscore: 95,
1312
- graveAccent: 96,
1313
- lowercaseA: 97,
1314
- lowercaseB: 98,
1315
- lowercaseC: 99,
1316
- lowercaseD: 100,
1317
- lowercaseE: 101,
1318
- lowercaseF: 102,
1319
- lowercaseG: 103,
1320
- lowercaseH: 104,
1321
- lowercaseI: 105,
1322
- lowercaseJ: 106,
1323
- lowercaseK: 107,
1324
- lowercaseL: 108,
1325
- lowercaseM: 109,
1326
- lowercaseN: 110,
1327
- lowercaseO: 111,
1328
- lowercaseP: 112,
1329
- lowercaseQ: 113,
1330
- lowercaseR: 114,
1331
- lowercaseS: 115,
1332
- lowercaseT: 116,
1333
- lowercaseU: 117,
1334
- lowercaseV: 118,
1335
- lowercaseW: 119,
1336
- lowercaseX: 120,
1337
- lowercaseY: 121,
1338
- lowercaseZ: 122,
1339
- leftCurlyBrace: 123,
1340
- verticalBar: 124,
1341
- rightCurlyBrace: 125,
1342
- tilde: 126,
1343
- del: 127,
1344
- byteOrderMarker: 65279,
1345
- replacementCharacter: 65533
1346
- };
1326
+ // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/color.node.js
1327
+ function color(d) {
1328
+ return "\x1B[33m" + d + "\x1B[39m";
1329
+ }
1330
+
1331
+ // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/index.js
1332
+ function visitParents(tree, test, visitor, reverse) {
1333
+ let check;
1334
+ if (typeof test === "function" && typeof visitor !== "function") {
1335
+ reverse = visitor;
1336
+ visitor = test;
1337
+ } else {
1338
+ check = test;
1339
+ }
1340
+ const is = convert(check);
1341
+ const step = reverse ? -1 : 1;
1342
+ factory(tree, undefined, [])();
1343
+ function factory(node, index, parents) {
1344
+ const value = node && typeof node === "object" ? node : {};
1345
+ if (typeof value.type === "string") {
1346
+ const name = typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : undefined;
1347
+ Object.defineProperty(visit, "name", {
1348
+ value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")"
1349
+ });
1350
+ }
1351
+ return visit;
1352
+ function visit() {
1353
+ let result = empty;
1354
+ let subresult;
1355
+ let offset;
1356
+ let grandparents;
1357
+ if (!test || is(node, index, parents[parents.length - 1] || undefined)) {
1358
+ result = toResult(visitor(node, parents));
1359
+ if (result[0] === EXIT) {
1360
+ return result;
1361
+ }
1362
+ }
1363
+ if ("children" in node && node.children) {
1364
+ const nodeAsParent = node;
1365
+ if (nodeAsParent.children && result[0] !== SKIP) {
1366
+ offset = (reverse ? nodeAsParent.children.length : -1) + step;
1367
+ grandparents = parents.concat(nodeAsParent);
1368
+ while (offset > -1 && offset < nodeAsParent.children.length) {
1369
+ const child = nodeAsParent.children[offset];
1370
+ subresult = factory(child, offset, grandparents)();
1371
+ if (subresult[0] === EXIT) {
1372
+ return subresult;
1373
+ }
1374
+ offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
1375
+ }
1376
+ }
1377
+ }
1378
+ return result;
1379
+ }
1380
+ }
1381
+ }
1382
+ function toResult(value) {
1383
+ if (Array.isArray(value)) {
1384
+ return value;
1385
+ }
1386
+ if (typeof value === "number") {
1387
+ return [CONTINUE, value];
1388
+ }
1389
+ return value === null || value === undefined ? empty : [value];
1390
+ }
1391
+ var empty, CONTINUE = true, EXIT = false, SKIP = "skip";
1392
+ var init_lib5 = __esm(() => {
1393
+ init_unist_util_is();
1394
+ empty = [];
1347
1395
  });
1348
1396
 
1349
- // ../../node_modules/micromark-util-symbol/lib/constants.js
1350
- var constants;
1351
- var init_constants = __esm(() => {
1352
- constants = {
1353
- attentionSideAfter: 2,
1354
- attentionSideBefore: 1,
1355
- atxHeadingOpeningFenceSizeMax: 6,
1356
- autolinkDomainSizeMax: 63,
1357
- autolinkSchemeSizeMax: 32,
1358
- cdataOpeningString: "CDATA[",
1359
- characterGroupPunctuation: 2,
1360
- characterGroupWhitespace: 1,
1361
- characterReferenceDecimalSizeMax: 7,
1362
- characterReferenceHexadecimalSizeMax: 6,
1363
- characterReferenceNamedSizeMax: 31,
1364
- codeFencedSequenceSizeMin: 3,
1365
- contentTypeContent: "content",
1366
- contentTypeDocument: "document",
1367
- contentTypeFlow: "flow",
1368
- contentTypeString: "string",
1369
- contentTypeText: "text",
1370
- hardBreakPrefixSizeMin: 2,
1371
- htmlBasic: 6,
1372
- htmlCdata: 5,
1373
- htmlComment: 2,
1374
- htmlComplete: 7,
1375
- htmlDeclaration: 4,
1376
- htmlInstruction: 3,
1377
- htmlRawSizeMax: 8,
1378
- htmlRaw: 1,
1379
- linkResourceDestinationBalanceMax: 32,
1380
- linkReferenceSizeMax: 999,
1381
- listItemValueSizeMax: 10,
1382
- numericBaseDecimal: 10,
1383
- numericBaseHexadecimal: 16,
1384
- tabSize: 4,
1385
- thematicBreakMarkerCountMin: 3,
1386
- v8MaxSafeChunkSize: 1e4
1387
- };
1397
+ // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
1398
+ var init_unist_util_visit_parents = __esm(() => {
1399
+ init_lib5();
1388
1400
  });
1389
1401
 
1390
- // ../../node_modules/micromark-util-symbol/lib/types.js
1391
- var types;
1392
- var init_types = __esm(() => {
1393
- types = {
1394
- data: "data",
1395
- whitespace: "whitespace",
1396
- lineEnding: "lineEnding",
1397
- lineEndingBlank: "lineEndingBlank",
1398
- linePrefix: "linePrefix",
1399
- lineSuffix: "lineSuffix",
1400
- atxHeading: "atxHeading",
1401
- atxHeadingSequence: "atxHeadingSequence",
1402
- atxHeadingText: "atxHeadingText",
1403
- autolink: "autolink",
1404
- autolinkEmail: "autolinkEmail",
1405
- autolinkMarker: "autolinkMarker",
1406
- autolinkProtocol: "autolinkProtocol",
1407
- characterEscape: "characterEscape",
1408
- characterEscapeValue: "characterEscapeValue",
1409
- characterReference: "characterReference",
1410
- characterReferenceMarker: "characterReferenceMarker",
1411
- characterReferenceMarkerNumeric: "characterReferenceMarkerNumeric",
1412
- characterReferenceMarkerHexadecimal: "characterReferenceMarkerHexadecimal",
1413
- characterReferenceValue: "characterReferenceValue",
1414
- codeFenced: "codeFenced",
1415
- codeFencedFence: "codeFencedFence",
1416
- codeFencedFenceSequence: "codeFencedFenceSequence",
1417
- codeFencedFenceInfo: "codeFencedFenceInfo",
1418
- codeFencedFenceMeta: "codeFencedFenceMeta",
1419
- codeFlowValue: "codeFlowValue",
1420
- codeIndented: "codeIndented",
1421
- codeText: "codeText",
1422
- codeTextData: "codeTextData",
1423
- codeTextPadding: "codeTextPadding",
1424
- codeTextSequence: "codeTextSequence",
1425
- content: "content",
1426
- definition: "definition",
1427
- definitionDestination: "definitionDestination",
1428
- definitionDestinationLiteral: "definitionDestinationLiteral",
1429
- definitionDestinationLiteralMarker: "definitionDestinationLiteralMarker",
1430
- definitionDestinationRaw: "definitionDestinationRaw",
1431
- definitionDestinationString: "definitionDestinationString",
1432
- definitionLabel: "definitionLabel",
1433
- definitionLabelMarker: "definitionLabelMarker",
1434
- definitionLabelString: "definitionLabelString",
1435
- definitionMarker: "definitionMarker",
1436
- definitionTitle: "definitionTitle",
1437
- definitionTitleMarker: "definitionTitleMarker",
1438
- definitionTitleString: "definitionTitleString",
1439
- emphasis: "emphasis",
1440
- emphasisSequence: "emphasisSequence",
1441
- emphasisText: "emphasisText",
1442
- escapeMarker: "escapeMarker",
1443
- hardBreakEscape: "hardBreakEscape",
1444
- hardBreakTrailing: "hardBreakTrailing",
1445
- htmlFlow: "htmlFlow",
1446
- htmlFlowData: "htmlFlowData",
1447
- htmlText: "htmlText",
1448
- htmlTextData: "htmlTextData",
1449
- image: "image",
1450
- label: "label",
1451
- labelText: "labelText",
1452
- labelLink: "labelLink",
1453
- labelImage: "labelImage",
1454
- labelMarker: "labelMarker",
1455
- labelImageMarker: "labelImageMarker",
1456
- labelEnd: "labelEnd",
1457
- link: "link",
1458
- paragraph: "paragraph",
1459
- reference: "reference",
1460
- referenceMarker: "referenceMarker",
1461
- referenceString: "referenceString",
1462
- resource: "resource",
1463
- resourceDestination: "resourceDestination",
1464
- resourceDestinationLiteral: "resourceDestinationLiteral",
1465
- resourceDestinationLiteralMarker: "resourceDestinationLiteralMarker",
1466
- resourceDestinationRaw: "resourceDestinationRaw",
1467
- resourceDestinationString: "resourceDestinationString",
1468
- resourceMarker: "resourceMarker",
1469
- resourceTitle: "resourceTitle",
1470
- resourceTitleMarker: "resourceTitleMarker",
1471
- resourceTitleString: "resourceTitleString",
1472
- setextHeading: "setextHeading",
1473
- setextHeadingText: "setextHeadingText",
1474
- setextHeadingLine: "setextHeadingLine",
1475
- setextHeadingLineSequence: "setextHeadingLineSequence",
1476
- strong: "strong",
1477
- strongSequence: "strongSequence",
1478
- strongText: "strongText",
1479
- thematicBreak: "thematicBreak",
1480
- thematicBreakSequence: "thematicBreakSequence",
1481
- blockQuote: "blockQuote",
1482
- blockQuotePrefix: "blockQuotePrefix",
1483
- blockQuoteMarker: "blockQuoteMarker",
1484
- blockQuotePrefixWhitespace: "blockQuotePrefixWhitespace",
1485
- listOrdered: "listOrdered",
1486
- listUnordered: "listUnordered",
1487
- listItemIndent: "listItemIndent",
1488
- listItemMarker: "listItemMarker",
1489
- listItemPrefix: "listItemPrefix",
1490
- listItemPrefixWhitespace: "listItemPrefixWhitespace",
1491
- listItemValue: "listItemValue",
1492
- chunkDocument: "chunkDocument",
1493
- chunkContent: "chunkContent",
1494
- chunkFlow: "chunkFlow",
1495
- chunkText: "chunkText",
1496
- chunkString: "chunkString"
1497
- };
1498
- });
1499
-
1500
- // ../../node_modules/micromark-util-symbol/lib/values.js
1501
- var values;
1502
- var init_values = __esm(() => {
1503
- values = {
1504
- ht: "\t",
1505
- lf: `
1506
- `,
1507
- cr: "\r",
1508
- space: " ",
1509
- exclamationMark: "!",
1510
- quotationMark: '"',
1511
- numberSign: "#",
1512
- dollarSign: "$",
1513
- percentSign: "%",
1514
- ampersand: "&",
1515
- apostrophe: "'",
1516
- leftParenthesis: "(",
1517
- rightParenthesis: ")",
1518
- asterisk: "*",
1519
- plusSign: "+",
1520
- comma: ",",
1521
- dash: "-",
1522
- dot: ".",
1523
- slash: "/",
1524
- digit0: "0",
1525
- digit1: "1",
1526
- digit2: "2",
1527
- digit3: "3",
1528
- digit4: "4",
1529
- digit5: "5",
1530
- digit6: "6",
1531
- digit7: "7",
1532
- digit8: "8",
1533
- digit9: "9",
1534
- colon: ":",
1535
- semicolon: ";",
1536
- lessThan: "<",
1537
- equalsTo: "=",
1538
- greaterThan: ">",
1539
- questionMark: "?",
1540
- atSign: "@",
1541
- uppercaseA: "A",
1542
- uppercaseB: "B",
1543
- uppercaseC: "C",
1544
- uppercaseD: "D",
1545
- uppercaseE: "E",
1546
- uppercaseF: "F",
1547
- uppercaseG: "G",
1548
- uppercaseH: "H",
1549
- uppercaseI: "I",
1550
- uppercaseJ: "J",
1551
- uppercaseK: "K",
1552
- uppercaseL: "L",
1553
- uppercaseM: "M",
1554
- uppercaseN: "N",
1555
- uppercaseO: "O",
1556
- uppercaseP: "P",
1557
- uppercaseQ: "Q",
1558
- uppercaseR: "R",
1559
- uppercaseS: "S",
1560
- uppercaseT: "T",
1561
- uppercaseU: "U",
1562
- uppercaseV: "V",
1563
- uppercaseW: "W",
1564
- uppercaseX: "X",
1565
- uppercaseY: "Y",
1566
- uppercaseZ: "Z",
1567
- leftSquareBracket: "[",
1568
- backslash: "\\",
1569
- rightSquareBracket: "]",
1570
- caret: "^",
1571
- underscore: "_",
1572
- graveAccent: "`",
1573
- lowercaseA: "a",
1574
- lowercaseB: "b",
1575
- lowercaseC: "c",
1576
- lowercaseD: "d",
1577
- lowercaseE: "e",
1578
- lowercaseF: "f",
1579
- lowercaseG: "g",
1580
- lowercaseH: "h",
1581
- lowercaseI: "i",
1582
- lowercaseJ: "j",
1583
- lowercaseK: "k",
1584
- lowercaseL: "l",
1585
- lowercaseM: "m",
1586
- lowercaseN: "n",
1587
- lowercaseO: "o",
1588
- lowercaseP: "p",
1589
- lowercaseQ: "q",
1590
- lowercaseR: "r",
1591
- lowercaseS: "s",
1592
- lowercaseT: "t",
1593
- lowercaseU: "u",
1594
- lowercaseV: "v",
1595
- lowercaseW: "w",
1596
- lowercaseX: "x",
1597
- lowercaseY: "y",
1598
- lowercaseZ: "z",
1599
- leftCurlyBrace: "{",
1600
- verticalBar: "|",
1601
- rightCurlyBrace: "}",
1602
- tilde: "~",
1603
- replacementCharacter: "�"
1604
- };
1605
- });
1606
-
1607
- // ../../node_modules/micromark-util-symbol/lib/default.js
1608
- var init_default = __esm(() => {
1609
- init_codes();
1610
- init_constants();
1611
- init_types();
1612
- init_values();
1613
- });
1614
-
1615
- // ../../node_modules/micromark-util-character/dev/index.js
1616
- function asciiControl(code) {
1617
- return code !== null && (code < codes.space || code === codes.del);
1618
- }
1619
- function markdownLineEnding(code) {
1620
- return code !== null && code < codes.horizontalTab;
1621
- }
1622
- function markdownLineEndingOrSpace(code) {
1623
- return code !== null && (code < codes.nul || code === codes.space);
1624
- }
1625
- function markdownSpace(code) {
1626
- return code === codes.horizontalTab || code === codes.virtualSpace || code === codes.space;
1627
- }
1628
- function regexCheck(regex) {
1629
- return check;
1630
- function check(code) {
1631
- return code !== null && code > -1 && regex.test(String.fromCharCode(code));
1632
- }
1633
- }
1634
- var asciiAlpha, asciiAlphanumeric, asciiAtext, asciiDigit, asciiHexDigit, asciiPunctuation, unicodePunctuation, unicodeWhitespace;
1635
- var init_dev = __esm(() => {
1636
- init_default();
1637
- asciiAlpha = regexCheck(/[A-Za-z]/);
1638
- asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
1639
- asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
1640
- asciiDigit = regexCheck(/\d/);
1641
- asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
1642
- asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
1643
- unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
1644
- unicodeWhitespace = regexCheck(/\s/);
1645
- });
1646
-
1647
- // ../../node_modules/micromark-util-classify-character/dev/index.js
1648
- function classifyCharacter(code) {
1649
- if (code === codes.eof || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {
1650
- return constants.characterGroupWhitespace;
1651
- }
1652
- if (unicodePunctuation(code)) {
1653
- return constants.characterGroupPunctuation;
1654
- }
1655
- }
1656
- var init_dev2 = __esm(() => {
1657
- init_dev();
1658
- init_default();
1659
- });
1660
-
1661
- // ../../node_modules/mdast-util-to-markdown/lib/util/encode-info.js
1662
- function encodeInfo(outside, inside, marker) {
1663
- const outsideKind = classifyCharacter(outside);
1664
- const insideKind = classifyCharacter(inside);
1665
- if (outsideKind === undefined) {
1666
- return insideKind === undefined ? marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: true };
1667
- }
1668
- if (outsideKind === 1) {
1669
- return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: false };
1670
- }
1671
- return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: false } : { inside: false, outside: false };
1672
- }
1673
- var init_encode_info = __esm(() => {
1674
- init_dev2();
1675
- });
1676
-
1677
- // ../../node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
1678
- function emphasis(node, _, state, info) {
1679
- const marker = checkEmphasis(state);
1680
- const exit = state.enter("emphasis");
1681
- const tracker = state.createTracker(info);
1682
- const before = tracker.move(marker);
1683
- let between = tracker.move(state.containerPhrasing(node, {
1684
- after: marker,
1685
- before,
1686
- ...tracker.current()
1687
- }));
1688
- const betweenHead = between.charCodeAt(0);
1689
- const open = encodeInfo(info.before.charCodeAt(info.before.length - 1), betweenHead, marker);
1690
- if (open.inside) {
1691
- between = encodeCharacterReference(betweenHead) + between.slice(1);
1692
- }
1693
- const betweenTail = between.charCodeAt(between.length - 1);
1694
- const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
1695
- if (close.inside) {
1696
- between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
1697
- }
1698
- const after = tracker.move(marker);
1699
- exit();
1700
- state.attentionEncodeSurroundingInfo = {
1701
- after: close.outside,
1702
- before: open.outside
1703
- };
1704
- return before + between + after;
1705
- }
1706
- function emphasisPeek(_, _1, state) {
1707
- return state.options.emphasis || "*";
1708
- }
1709
- var init_emphasis = __esm(() => {
1710
- init_encode_info();
1711
- emphasis.peek = emphasisPeek;
1712
- });
1713
-
1714
- // ../../node_modules/unist-util-is/lib/index.js
1715
- function anyFactory(tests) {
1716
- const checks = [];
1717
- let index = -1;
1718
- while (++index < tests.length) {
1719
- checks[index] = convert(tests[index]);
1720
- }
1721
- return castFactory(any);
1722
- function any(...parameters) {
1723
- let index = -1;
1724
- while (++index < checks.length) {
1725
- if (checks[index].apply(this, parameters))
1726
- return true;
1727
- }
1728
- return false;
1729
- }
1730
- }
1731
- function propertiesFactory(check) {
1732
- const checkAsRecord = check;
1733
- return castFactory(all);
1734
- function all(node) {
1735
- const nodeAsRecord = node;
1736
- let key;
1737
- for (key in check) {
1738
- if (nodeAsRecord[key] !== checkAsRecord[key])
1739
- return false;
1740
- }
1741
- return true;
1742
- }
1743
- }
1744
- function typeFactory(check) {
1745
- return castFactory(type);
1746
- function type(node) {
1747
- return node && node.type === check;
1748
- }
1749
- }
1750
- function castFactory(testFunction) {
1751
- return check;
1752
- function check(value, index, parent) {
1753
- return Boolean(looksLikeANode(value) && testFunction.call(this, value, typeof index === "number" ? index : undefined, parent || undefined));
1754
- }
1755
- }
1756
- function ok2() {
1757
- return true;
1758
- }
1759
- function looksLikeANode(value) {
1760
- return value !== null && typeof value === "object" && "type" in value;
1761
- }
1762
- var convert = function(test) {
1763
- if (test === null || test === undefined) {
1764
- return ok2;
1765
- }
1766
- if (typeof test === "function") {
1767
- return castFactory(test);
1768
- }
1769
- if (typeof test === "object") {
1770
- return Array.isArray(test) ? anyFactory(test) : propertiesFactory(test);
1771
- }
1772
- if (typeof test === "string") {
1773
- return typeFactory(test);
1774
- }
1775
- throw new Error("Expected function, string, or object as test");
1776
- };
1777
-
1778
- // ../../node_modules/unist-util-is/index.js
1779
- var init_unist_util_is = () => {};
1780
-
1781
- // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/color.node.js
1782
- function color(d) {
1783
- return "\x1B[33m" + d + "\x1B[39m";
1784
- }
1785
-
1786
- // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/index.js
1787
- function visitParents(tree, test, visitor, reverse) {
1788
- let check;
1789
- if (typeof test === "function" && typeof visitor !== "function") {
1790
- reverse = visitor;
1791
- visitor = test;
1792
- } else {
1793
- check = test;
1794
- }
1795
- const is = convert(check);
1796
- const step = reverse ? -1 : 1;
1797
- factory(tree, undefined, [])();
1798
- function factory(node, index, parents) {
1799
- const value = node && typeof node === "object" ? node : {};
1800
- if (typeof value.type === "string") {
1801
- const name = typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : undefined;
1802
- Object.defineProperty(visit, "name", {
1803
- value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")"
1804
- });
1805
- }
1806
- return visit;
1807
- function visit() {
1808
- let result = empty;
1809
- let subresult;
1810
- let offset;
1811
- let grandparents;
1812
- if (!test || is(node, index, parents[parents.length - 1] || undefined)) {
1813
- result = toResult(visitor(node, parents));
1814
- if (result[0] === EXIT) {
1815
- return result;
1816
- }
1817
- }
1818
- if ("children" in node && node.children) {
1819
- const nodeAsParent = node;
1820
- if (nodeAsParent.children && result[0] !== SKIP) {
1821
- offset = (reverse ? nodeAsParent.children.length : -1) + step;
1822
- grandparents = parents.concat(nodeAsParent);
1823
- while (offset > -1 && offset < nodeAsParent.children.length) {
1824
- const child = nodeAsParent.children[offset];
1825
- subresult = factory(child, offset, grandparents)();
1826
- if (subresult[0] === EXIT) {
1827
- return subresult;
1828
- }
1829
- offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
1830
- }
1831
- }
1832
- }
1833
- return result;
1834
- }
1835
- }
1836
- }
1837
- function toResult(value) {
1838
- if (Array.isArray(value)) {
1839
- return value;
1840
- }
1841
- if (typeof value === "number") {
1842
- return [CONTINUE, value];
1843
- }
1844
- return value === null || value === undefined ? empty : [value];
1845
- }
1846
- var empty, CONTINUE = true, EXIT = false, SKIP = "skip";
1847
- var init_lib4 = __esm(() => {
1848
- init_unist_util_is();
1849
- empty = [];
1850
- });
1851
-
1852
- // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
1853
- var init_unist_util_visit_parents = __esm(() => {
1854
- init_lib4();
1855
- });
1856
-
1857
- // ../../node_modules/unist-util-visit/lib/index.js
1858
- function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
1859
- let reverse;
1860
- let test;
1861
- let visitor;
1862
- if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
1863
- test = undefined;
1864
- visitor = testOrVisitor;
1865
- reverse = visitorOrReverse;
1866
- } else {
1867
- test = testOrVisitor;
1868
- visitor = visitorOrReverse;
1869
- reverse = maybeReverse;
1870
- }
1871
- visitParents(tree, test, overload, reverse);
1872
- function overload(node, parents) {
1873
- const parent = parents[parents.length - 1];
1874
- const index = parent ? parent.children.indexOf(node) : undefined;
1875
- return visitor(node, index, parent);
1876
- }
1877
- }
1878
- var init_lib5 = __esm(() => {
1879
- init_unist_util_visit_parents();
1880
- init_unist_util_visit_parents();
1402
+ // ../../node_modules/unist-util-visit/lib/index.js
1403
+ function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
1404
+ let reverse;
1405
+ let test;
1406
+ let visitor;
1407
+ if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
1408
+ test = undefined;
1409
+ visitor = testOrVisitor;
1410
+ reverse = visitorOrReverse;
1411
+ } else {
1412
+ test = testOrVisitor;
1413
+ visitor = visitorOrReverse;
1414
+ reverse = maybeReverse;
1415
+ }
1416
+ visitParents(tree, test, overload, reverse);
1417
+ function overload(node, parents) {
1418
+ const parent = parents[parents.length - 1];
1419
+ const index = parent ? parent.children.indexOf(node) : undefined;
1420
+ return visitor(node, index, parent);
1421
+ }
1422
+ }
1423
+ var init_lib6 = __esm(() => {
1424
+ init_unist_util_visit_parents();
1425
+ init_unist_util_visit_parents();
1881
1426
  });
1882
1427
 
1883
1428
  // ../../node_modules/unist-util-visit/index.js
1884
1429
  var init_unist_util_visit = __esm(() => {
1885
- init_lib5();
1430
+ init_lib6();
1886
1431
  });
1887
1432
 
1888
1433
  // ../../node_modules/mdast-util-to-string/lib/index.js
@@ -1921,13 +1466,13 @@ function node(value) {
1921
1466
  return Boolean(value && typeof value === "object");
1922
1467
  }
1923
1468
  var emptyOptions;
1924
- var init_lib6 = __esm(() => {
1469
+ var init_lib7 = __esm(() => {
1925
1470
  emptyOptions = {};
1926
1471
  });
1927
1472
 
1928
1473
  // ../../node_modules/mdast-util-to-string/index.js
1929
1474
  var init_mdast_util_to_string = __esm(() => {
1930
- init_lib6();
1475
+ init_lib7();
1931
1476
  });
1932
1477
 
1933
1478
  // ../../node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
@@ -1976,8 +1521,9 @@ function heading(node, _, state, info) {
1976
1521
  `,
1977
1522
  ...tracker.current()
1978
1523
  });
1979
- if (/^[\t ]/.test(value)) {
1980
- value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);
1524
+ const head = value.charCodeAt(0);
1525
+ if (head === 9 || head === 32) {
1526
+ value = encodeCharacterReference(head) + value.slice(1);
1981
1527
  }
1982
1528
  value = value ? sequence + " " + value : sequence;
1983
1529
  if (state.options.closeAtx) {
@@ -2064,7 +1610,9 @@ function imageReference(node, _, state, info) {
2064
1610
  value += tracker.move(alt + "][");
2065
1611
  subexit();
2066
1612
  const stack = state.stack;
2067
- state.stack = [];
1613
+ state.stack = stack.filter(function(d) {
1614
+ return d !== "phrasing";
1615
+ });
2068
1616
  subexit = state.enter("reference");
2069
1617
  const reference = state.safe(state.associationId(node), {
2070
1618
  before: value,
@@ -2098,15 +1646,15 @@ function inlineCode(node, _, state) {
2098
1646
  while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
2099
1647
  sequence += "`";
2100
1648
  }
2101
- if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) {
1649
+ if (/[^\n\r ]/.test(value) && (/^[\n\r ]/.test(value) && /[\n\r ]$/.test(value) || /^`|`$/.test(value))) {
2102
1650
  value = " " + value + " ";
2103
1651
  }
2104
1652
  while (++index < state.unsafe.length) {
2105
1653
  const pattern = state.unsafe[index];
2106
1654
  const expression = state.compilePattern(pattern);
2107
- let match;
2108
1655
  if (!pattern.atBreak)
2109
1656
  continue;
1657
+ let match;
2110
1658
  while (match = expression.exec(value)) {
2111
1659
  let position = match.index;
2112
1660
  if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {
@@ -2127,7 +1675,7 @@ var init_inline_code = __esm(() => {
2127
1675
  // ../../node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
2128
1676
  function formatLinkAsAutolink(node, state) {
2129
1677
  const raw = toString(node);
2130
- return Boolean(!state.options.resourceLink && node.url && !node.title && node.children && node.children.length === 1 && node.children[0].type === "text" && (raw === node.url || "mailto:" + raw === node.url) && /^[a-z][a-z+.-]+:/i.test(node.url) && !/[\0- <>\u007F]/.test(node.url));
1678
+ return Boolean(!state.options.resourceLink && node.url && !node.title && node.children && node.children.length === 1 && node.children[0].type === "text" && (raw === node.url || "mailto:" + raw === node.url) && /^[a-z][+\-.a-z]+:/i.test(node.url) && !/[\0- <>\u007F]/.test(node.url));
2131
1679
  }
2132
1680
  var init_format_link_as_autolink = __esm(() => {
2133
1681
  init_mdast_util_to_string();
@@ -2138,12 +1686,12 @@ function link(node, _, state, info) {
2138
1686
  const quote = checkQuote(state);
2139
1687
  const suffix = quote === '"' ? "Quote" : "Apostrophe";
2140
1688
  const tracker = state.createTracker(info);
2141
- let exit;
2142
- let subexit;
2143
1689
  if (formatLinkAsAutolink(node, state)) {
2144
1690
  const stack = state.stack;
2145
- state.stack = [];
2146
- exit = state.enter("autolink");
1691
+ state.stack = stack.filter(function(d) {
1692
+ return d !== "phrasing";
1693
+ });
1694
+ const exit = state.enter("autolink");
2147
1695
  let value = tracker.move("<");
2148
1696
  value += tracker.move(state.containerPhrasing(node, {
2149
1697
  before: value,
@@ -2155,8 +1703,8 @@ function link(node, _, state, info) {
2155
1703
  state.stack = stack;
2156
1704
  return value;
2157
1705
  }
2158
- exit = state.enter("link");
2159
- subexit = state.enter("label");
1706
+ const exit = state.enter("link");
1707
+ let subexit = state.enter("label");
2160
1708
  let value = tracker.move("[");
2161
1709
  value += tracker.move(state.containerPhrasing(node, {
2162
1710
  before: value,
@@ -2217,7 +1765,9 @@ function linkReference(node, _, state, info) {
2217
1765
  value += tracker.move(text + "][");
2218
1766
  subexit();
2219
1767
  const stack = state.stack;
2220
- state.stack = [];
1768
+ state.stack = stack.filter(function(d) {
1769
+ return d !== "phrasing";
1770
+ });
2221
1771
  subexit = state.enter("reference");
2222
1772
  const reference = state.safe(state.associationId(node), {
2223
1773
  before: value,
@@ -2324,201 +1874,716 @@ var init_list = __esm(() => {
2324
1874
  init_check_bullet_other();
2325
1875
  });
2326
1876
 
2327
- // ../../node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
2328
- function checkListItemIndent(state) {
2329
- const style = state.options.listItemIndent || "one";
2330
- if (style !== "tab" && style !== "one" && style !== "mixed") {
2331
- throw new Error("Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");
2332
- }
2333
- return style;
2334
- }
1877
+ // ../../node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
1878
+ function checkListItemIndent(state) {
1879
+ const style = state.options.listItemIndent || "one";
1880
+ if (style !== "tab" && style !== "one" && style !== "mixed") {
1881
+ throw new Error("Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");
1882
+ }
1883
+ return style;
1884
+ }
1885
+
1886
+ // ../../node_modules/mdast-util-to-markdown/lib/handle/list-item.js
1887
+ function listItem(node, parent, state, info) {
1888
+ const listItemIndent = checkListItemIndent(state);
1889
+ let bullet = state.bulletCurrent || checkBullet(state);
1890
+ if (parent && parent.type === "list" && parent.ordered) {
1891
+ bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node)) + bullet;
1892
+ }
1893
+ let size = bullet.length + 1;
1894
+ if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node.spread)) {
1895
+ size = Math.ceil(size / 4) * 4;
1896
+ }
1897
+ const tracker = state.createTracker(info);
1898
+ tracker.move(bullet + " ".repeat(size - bullet.length));
1899
+ tracker.shift(size);
1900
+ const exit = state.enter("listItem");
1901
+ const value = state.indentLines(state.containerFlow(node, tracker.current()), map);
1902
+ exit();
1903
+ return value;
1904
+ function map(line, index, blank) {
1905
+ if (index) {
1906
+ return (blank ? "" : " ".repeat(size)) + line;
1907
+ }
1908
+ return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line;
1909
+ }
1910
+ }
1911
+ var init_list_item = () => {};
1912
+
1913
+ // ../../node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
1914
+ function paragraph(node, _, state, info) {
1915
+ const exit = state.enter("paragraph");
1916
+ const subexit = state.enter("phrasing");
1917
+ const value = state.containerPhrasing(node, info);
1918
+ subexit();
1919
+ exit();
1920
+ return value;
1921
+ }
1922
+
1923
+ // ../../node_modules/mdast-util-to-markdown/lib/handle/root.js
1924
+ function root(node, _, state, info) {
1925
+ const hasPhrasing = node.children.some(function(d) {
1926
+ return phrasing(d);
1927
+ });
1928
+ if (!hasPhrasing)
1929
+ return state.containerFlow(node, info);
1930
+ const exit = state.enter("phrasing");
1931
+ const value = state.containerPhrasing(node, info);
1932
+ exit();
1933
+ return value;
1934
+ }
1935
+ var init_root = __esm(() => {
1936
+ init_mdast_util_phrasing();
1937
+ });
1938
+
1939
+ // ../../node_modules/mdast-util-to-markdown/lib/util/check-strong.js
1940
+ function checkStrong(state) {
1941
+ const marker = state.options.strong || "*";
1942
+ if (marker !== "*" && marker !== "_") {
1943
+ throw new Error("Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`");
1944
+ }
1945
+ return marker;
1946
+ }
1947
+
1948
+ // ../../node_modules/mdast-util-to-markdown/lib/handle/strong.js
1949
+ function strong(node, _, state, info) {
1950
+ const exit = state.enter("phrasing");
1951
+ const value = state.containerPhrasing({ type: "root", children: [node] }, info);
1952
+ exit();
1953
+ return value;
1954
+ }
1955
+ function attention2(_, state) {
1956
+ const marker = checkStrong(state);
1957
+ return {
1958
+ construct: "strong",
1959
+ markers: marker === "*" ? ["*", "_"] : ["_", "*"],
1960
+ sizes: [2]
1961
+ };
1962
+ }
1963
+ function peek2(_, _1, state) {
1964
+ return state.options.strong || "*";
1965
+ }
1966
+ var init_strong = __esm(() => {
1967
+ strong.attention = attention2;
1968
+ strong.peek = peek2;
1969
+ });
1970
+
1971
+ // ../../node_modules/mdast-util-to-markdown/lib/handle/text.js
1972
+ function text(node, parent, state, info) {
1973
+ const siblings = parent ? parent.children : [];
1974
+ const index = siblings.indexOf(node);
1975
+ return state.safe(node.value, {
1976
+ ...info,
1977
+ afterNode: siblings[index + 1],
1978
+ beforeNode: siblings[index - 1]
1979
+ });
1980
+ }
1981
+
1982
+ // ../../node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
1983
+ function checkRuleRepetition(state) {
1984
+ const repetition = state.options.ruleRepetition || 3;
1985
+ if (repetition < 3) {
1986
+ throw new Error("Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more");
1987
+ }
1988
+ return repetition;
1989
+ }
1990
+
1991
+ // ../../node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
1992
+ function thematicBreak(_, _1, state) {
1993
+ const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
1994
+ return state.options.ruleSpaces ? value.slice(0, -1) : value;
1995
+ }
1996
+ var init_thematic_break = () => {};
1997
+
1998
+ // ../../node_modules/mdast-util-to-markdown/lib/handle/index.js
1999
+ var handle;
2000
+ var init_handle = __esm(() => {
2001
+ init_break();
2002
+ init_code();
2003
+ init_definition();
2004
+ init_emphasis();
2005
+ init_heading();
2006
+ init_html();
2007
+ init_image();
2008
+ init_image_reference();
2009
+ init_inline_code();
2010
+ init_link();
2011
+ init_link_reference();
2012
+ init_list();
2013
+ init_list_item();
2014
+ init_root();
2015
+ init_strong();
2016
+ init_thematic_break();
2017
+ handle = {
2018
+ blockquote,
2019
+ break: hardBreak,
2020
+ code,
2021
+ definition,
2022
+ emphasis,
2023
+ hardBreak,
2024
+ heading,
2025
+ html,
2026
+ image,
2027
+ imageReference,
2028
+ inlineCode,
2029
+ link,
2030
+ linkReference,
2031
+ list: list2,
2032
+ listItem,
2033
+ paragraph,
2034
+ root,
2035
+ strong,
2036
+ text,
2037
+ thematicBreak
2038
+ };
2039
+ });
2040
+
2041
+ // ../../node_modules/micromark-util-symbol/lib/codes.js
2042
+ var codes;
2043
+ var init_codes = __esm(() => {
2044
+ codes = {
2045
+ carriageReturn: -5,
2046
+ lineFeed: -4,
2047
+ carriageReturnLineFeed: -3,
2048
+ horizontalTab: -2,
2049
+ virtualSpace: -1,
2050
+ eof: null,
2051
+ nul: 0,
2052
+ soh: 1,
2053
+ stx: 2,
2054
+ etx: 3,
2055
+ eot: 4,
2056
+ enq: 5,
2057
+ ack: 6,
2058
+ bel: 7,
2059
+ bs: 8,
2060
+ ht: 9,
2061
+ lf: 10,
2062
+ vt: 11,
2063
+ ff: 12,
2064
+ cr: 13,
2065
+ so: 14,
2066
+ si: 15,
2067
+ dle: 16,
2068
+ dc1: 17,
2069
+ dc2: 18,
2070
+ dc3: 19,
2071
+ dc4: 20,
2072
+ nak: 21,
2073
+ syn: 22,
2074
+ etb: 23,
2075
+ can: 24,
2076
+ em: 25,
2077
+ sub: 26,
2078
+ esc: 27,
2079
+ fs: 28,
2080
+ gs: 29,
2081
+ rs: 30,
2082
+ us: 31,
2083
+ space: 32,
2084
+ exclamationMark: 33,
2085
+ quotationMark: 34,
2086
+ numberSign: 35,
2087
+ dollarSign: 36,
2088
+ percentSign: 37,
2089
+ ampersand: 38,
2090
+ apostrophe: 39,
2091
+ leftParenthesis: 40,
2092
+ rightParenthesis: 41,
2093
+ asterisk: 42,
2094
+ plusSign: 43,
2095
+ comma: 44,
2096
+ dash: 45,
2097
+ dot: 46,
2098
+ slash: 47,
2099
+ digit0: 48,
2100
+ digit1: 49,
2101
+ digit2: 50,
2102
+ digit3: 51,
2103
+ digit4: 52,
2104
+ digit5: 53,
2105
+ digit6: 54,
2106
+ digit7: 55,
2107
+ digit8: 56,
2108
+ digit9: 57,
2109
+ colon: 58,
2110
+ semicolon: 59,
2111
+ lessThan: 60,
2112
+ equalsTo: 61,
2113
+ greaterThan: 62,
2114
+ questionMark: 63,
2115
+ atSign: 64,
2116
+ uppercaseA: 65,
2117
+ uppercaseB: 66,
2118
+ uppercaseC: 67,
2119
+ uppercaseD: 68,
2120
+ uppercaseE: 69,
2121
+ uppercaseF: 70,
2122
+ uppercaseG: 71,
2123
+ uppercaseH: 72,
2124
+ uppercaseI: 73,
2125
+ uppercaseJ: 74,
2126
+ uppercaseK: 75,
2127
+ uppercaseL: 76,
2128
+ uppercaseM: 77,
2129
+ uppercaseN: 78,
2130
+ uppercaseO: 79,
2131
+ uppercaseP: 80,
2132
+ uppercaseQ: 81,
2133
+ uppercaseR: 82,
2134
+ uppercaseS: 83,
2135
+ uppercaseT: 84,
2136
+ uppercaseU: 85,
2137
+ uppercaseV: 86,
2138
+ uppercaseW: 87,
2139
+ uppercaseX: 88,
2140
+ uppercaseY: 89,
2141
+ uppercaseZ: 90,
2142
+ leftSquareBracket: 91,
2143
+ backslash: 92,
2144
+ rightSquareBracket: 93,
2145
+ caret: 94,
2146
+ underscore: 95,
2147
+ graveAccent: 96,
2148
+ lowercaseA: 97,
2149
+ lowercaseB: 98,
2150
+ lowercaseC: 99,
2151
+ lowercaseD: 100,
2152
+ lowercaseE: 101,
2153
+ lowercaseF: 102,
2154
+ lowercaseG: 103,
2155
+ lowercaseH: 104,
2156
+ lowercaseI: 105,
2157
+ lowercaseJ: 106,
2158
+ lowercaseK: 107,
2159
+ lowercaseL: 108,
2160
+ lowercaseM: 109,
2161
+ lowercaseN: 110,
2162
+ lowercaseO: 111,
2163
+ lowercaseP: 112,
2164
+ lowercaseQ: 113,
2165
+ lowercaseR: 114,
2166
+ lowercaseS: 115,
2167
+ lowercaseT: 116,
2168
+ lowercaseU: 117,
2169
+ lowercaseV: 118,
2170
+ lowercaseW: 119,
2171
+ lowercaseX: 120,
2172
+ lowercaseY: 121,
2173
+ lowercaseZ: 122,
2174
+ leftCurlyBrace: 123,
2175
+ verticalBar: 124,
2176
+ rightCurlyBrace: 125,
2177
+ tilde: 126,
2178
+ del: 127,
2179
+ byteOrderMarker: 65279,
2180
+ replacementCharacter: 65533
2181
+ };
2182
+ });
2183
+
2184
+ // ../../node_modules/micromark-util-symbol/lib/constants.js
2185
+ var constants;
2186
+ var init_constants = __esm(() => {
2187
+ constants = {
2188
+ attentionSideAfter: 2,
2189
+ attentionSideBefore: 1,
2190
+ atxHeadingOpeningFenceSizeMax: 6,
2191
+ autolinkDomainSizeMax: 63,
2192
+ autolinkSchemeSizeMax: 32,
2193
+ cdataOpeningString: "CDATA[",
2194
+ characterGroupPunctuation: 2,
2195
+ characterGroupWhitespace: 1,
2196
+ characterReferenceDecimalSizeMax: 7,
2197
+ characterReferenceHexadecimalSizeMax: 6,
2198
+ characterReferenceNamedSizeMax: 31,
2199
+ codeFencedSequenceSizeMin: 3,
2200
+ contentTypeContent: "content",
2201
+ contentTypeDocument: "document",
2202
+ contentTypeFlow: "flow",
2203
+ contentTypeString: "string",
2204
+ contentTypeText: "text",
2205
+ hardBreakPrefixSizeMin: 2,
2206
+ htmlBasic: 6,
2207
+ htmlCdata: 5,
2208
+ htmlComment: 2,
2209
+ htmlComplete: 7,
2210
+ htmlDeclaration: 4,
2211
+ htmlInstruction: 3,
2212
+ htmlRawSizeMax: 8,
2213
+ htmlRaw: 1,
2214
+ linkResourceDestinationBalanceMax: 32,
2215
+ linkReferenceSizeMax: 999,
2216
+ listItemValueSizeMax: 10,
2217
+ numericBaseDecimal: 10,
2218
+ numericBaseHexadecimal: 16,
2219
+ tabSize: 4,
2220
+ thematicBreakMarkerCountMin: 3,
2221
+ v8MaxSafeChunkSize: 1e4
2222
+ };
2223
+ });
2224
+
2225
+ // ../../node_modules/micromark-util-symbol/lib/types.js
2226
+ var types;
2227
+ var init_types = __esm(() => {
2228
+ types = {
2229
+ data: "data",
2230
+ whitespace: "whitespace",
2231
+ lineEnding: "lineEnding",
2232
+ lineEndingBlank: "lineEndingBlank",
2233
+ linePrefix: "linePrefix",
2234
+ lineSuffix: "lineSuffix",
2235
+ atxHeading: "atxHeading",
2236
+ atxHeadingSequence: "atxHeadingSequence",
2237
+ atxHeadingText: "atxHeadingText",
2238
+ autolink: "autolink",
2239
+ autolinkEmail: "autolinkEmail",
2240
+ autolinkMarker: "autolinkMarker",
2241
+ autolinkProtocol: "autolinkProtocol",
2242
+ characterEscape: "characterEscape",
2243
+ characterEscapeValue: "characterEscapeValue",
2244
+ characterReference: "characterReference",
2245
+ characterReferenceMarker: "characterReferenceMarker",
2246
+ characterReferenceMarkerNumeric: "characterReferenceMarkerNumeric",
2247
+ characterReferenceMarkerHexadecimal: "characterReferenceMarkerHexadecimal",
2248
+ characterReferenceValue: "characterReferenceValue",
2249
+ codeFenced: "codeFenced",
2250
+ codeFencedFence: "codeFencedFence",
2251
+ codeFencedFenceSequence: "codeFencedFenceSequence",
2252
+ codeFencedFenceInfo: "codeFencedFenceInfo",
2253
+ codeFencedFenceMeta: "codeFencedFenceMeta",
2254
+ codeFlowValue: "codeFlowValue",
2255
+ codeIndented: "codeIndented",
2256
+ codeText: "codeText",
2257
+ codeTextData: "codeTextData",
2258
+ codeTextPadding: "codeTextPadding",
2259
+ codeTextSequence: "codeTextSequence",
2260
+ content: "content",
2261
+ definition: "definition",
2262
+ definitionDestination: "definitionDestination",
2263
+ definitionDestinationLiteral: "definitionDestinationLiteral",
2264
+ definitionDestinationLiteralMarker: "definitionDestinationLiteralMarker",
2265
+ definitionDestinationRaw: "definitionDestinationRaw",
2266
+ definitionDestinationString: "definitionDestinationString",
2267
+ definitionLabel: "definitionLabel",
2268
+ definitionLabelMarker: "definitionLabelMarker",
2269
+ definitionLabelString: "definitionLabelString",
2270
+ definitionMarker: "definitionMarker",
2271
+ definitionTitle: "definitionTitle",
2272
+ definitionTitleMarker: "definitionTitleMarker",
2273
+ definitionTitleString: "definitionTitleString",
2274
+ emphasis: "emphasis",
2275
+ emphasisSequence: "emphasisSequence",
2276
+ emphasisText: "emphasisText",
2277
+ escapeMarker: "escapeMarker",
2278
+ hardBreakEscape: "hardBreakEscape",
2279
+ hardBreakTrailing: "hardBreakTrailing",
2280
+ htmlFlow: "htmlFlow",
2281
+ htmlFlowData: "htmlFlowData",
2282
+ htmlText: "htmlText",
2283
+ htmlTextData: "htmlTextData",
2284
+ image: "image",
2285
+ label: "label",
2286
+ labelText: "labelText",
2287
+ labelLink: "labelLink",
2288
+ labelImage: "labelImage",
2289
+ labelMarker: "labelMarker",
2290
+ labelImageMarker: "labelImageMarker",
2291
+ labelEnd: "labelEnd",
2292
+ link: "link",
2293
+ paragraph: "paragraph",
2294
+ reference: "reference",
2295
+ referenceMarker: "referenceMarker",
2296
+ referenceString: "referenceString",
2297
+ resource: "resource",
2298
+ resourceDestination: "resourceDestination",
2299
+ resourceDestinationLiteral: "resourceDestinationLiteral",
2300
+ resourceDestinationLiteralMarker: "resourceDestinationLiteralMarker",
2301
+ resourceDestinationRaw: "resourceDestinationRaw",
2302
+ resourceDestinationString: "resourceDestinationString",
2303
+ resourceMarker: "resourceMarker",
2304
+ resourceTitle: "resourceTitle",
2305
+ resourceTitleMarker: "resourceTitleMarker",
2306
+ resourceTitleString: "resourceTitleString",
2307
+ setextHeading: "setextHeading",
2308
+ setextHeadingText: "setextHeadingText",
2309
+ setextHeadingLine: "setextHeadingLine",
2310
+ setextHeadingLineSequence: "setextHeadingLineSequence",
2311
+ strong: "strong",
2312
+ strongSequence: "strongSequence",
2313
+ strongText: "strongText",
2314
+ thematicBreak: "thematicBreak",
2315
+ thematicBreakSequence: "thematicBreakSequence",
2316
+ blockQuote: "blockQuote",
2317
+ blockQuotePrefix: "blockQuotePrefix",
2318
+ blockQuoteMarker: "blockQuoteMarker",
2319
+ blockQuotePrefixWhitespace: "blockQuotePrefixWhitespace",
2320
+ listOrdered: "listOrdered",
2321
+ listUnordered: "listUnordered",
2322
+ listItemIndent: "listItemIndent",
2323
+ listItemMarker: "listItemMarker",
2324
+ listItemPrefix: "listItemPrefix",
2325
+ listItemPrefixWhitespace: "listItemPrefixWhitespace",
2326
+ listItemValue: "listItemValue",
2327
+ chunkDocument: "chunkDocument",
2328
+ chunkContent: "chunkContent",
2329
+ chunkFlow: "chunkFlow",
2330
+ chunkText: "chunkText",
2331
+ chunkString: "chunkString"
2332
+ };
2333
+ });
2334
+
2335
+ // ../../node_modules/micromark-util-symbol/lib/values.js
2336
+ var values;
2337
+ var init_values = __esm(() => {
2338
+ values = {
2339
+ ht: "\t",
2340
+ lf: `
2341
+ `,
2342
+ cr: "\r",
2343
+ space: " ",
2344
+ exclamationMark: "!",
2345
+ quotationMark: '"',
2346
+ numberSign: "#",
2347
+ dollarSign: "$",
2348
+ percentSign: "%",
2349
+ ampersand: "&",
2350
+ apostrophe: "'",
2351
+ leftParenthesis: "(",
2352
+ rightParenthesis: ")",
2353
+ asterisk: "*",
2354
+ plusSign: "+",
2355
+ comma: ",",
2356
+ dash: "-",
2357
+ dot: ".",
2358
+ slash: "/",
2359
+ digit0: "0",
2360
+ digit1: "1",
2361
+ digit2: "2",
2362
+ digit3: "3",
2363
+ digit4: "4",
2364
+ digit5: "5",
2365
+ digit6: "6",
2366
+ digit7: "7",
2367
+ digit8: "8",
2368
+ digit9: "9",
2369
+ colon: ":",
2370
+ semicolon: ";",
2371
+ lessThan: "<",
2372
+ equalsTo: "=",
2373
+ greaterThan: ">",
2374
+ questionMark: "?",
2375
+ atSign: "@",
2376
+ uppercaseA: "A",
2377
+ uppercaseB: "B",
2378
+ uppercaseC: "C",
2379
+ uppercaseD: "D",
2380
+ uppercaseE: "E",
2381
+ uppercaseF: "F",
2382
+ uppercaseG: "G",
2383
+ uppercaseH: "H",
2384
+ uppercaseI: "I",
2385
+ uppercaseJ: "J",
2386
+ uppercaseK: "K",
2387
+ uppercaseL: "L",
2388
+ uppercaseM: "M",
2389
+ uppercaseN: "N",
2390
+ uppercaseO: "O",
2391
+ uppercaseP: "P",
2392
+ uppercaseQ: "Q",
2393
+ uppercaseR: "R",
2394
+ uppercaseS: "S",
2395
+ uppercaseT: "T",
2396
+ uppercaseU: "U",
2397
+ uppercaseV: "V",
2398
+ uppercaseW: "W",
2399
+ uppercaseX: "X",
2400
+ uppercaseY: "Y",
2401
+ uppercaseZ: "Z",
2402
+ leftSquareBracket: "[",
2403
+ backslash: "\\",
2404
+ rightSquareBracket: "]",
2405
+ caret: "^",
2406
+ underscore: "_",
2407
+ graveAccent: "`",
2408
+ lowercaseA: "a",
2409
+ lowercaseB: "b",
2410
+ lowercaseC: "c",
2411
+ lowercaseD: "d",
2412
+ lowercaseE: "e",
2413
+ lowercaseF: "f",
2414
+ lowercaseG: "g",
2415
+ lowercaseH: "h",
2416
+ lowercaseI: "i",
2417
+ lowercaseJ: "j",
2418
+ lowercaseK: "k",
2419
+ lowercaseL: "l",
2420
+ lowercaseM: "m",
2421
+ lowercaseN: "n",
2422
+ lowercaseO: "o",
2423
+ lowercaseP: "p",
2424
+ lowercaseQ: "q",
2425
+ lowercaseR: "r",
2426
+ lowercaseS: "s",
2427
+ lowercaseT: "t",
2428
+ lowercaseU: "u",
2429
+ lowercaseV: "v",
2430
+ lowercaseW: "w",
2431
+ lowercaseX: "x",
2432
+ lowercaseY: "y",
2433
+ lowercaseZ: "z",
2434
+ leftCurlyBrace: "{",
2435
+ verticalBar: "|",
2436
+ rightCurlyBrace: "}",
2437
+ tilde: "~",
2438
+ replacementCharacter: "�"
2439
+ };
2440
+ });
2441
+
2442
+ // ../../node_modules/micromark-util-symbol/lib/default.js
2443
+ var init_default = __esm(() => {
2444
+ init_codes();
2445
+ init_constants();
2446
+ init_types();
2447
+ init_values();
2448
+ });
2335
2449
 
2336
- // ../../node_modules/mdast-util-to-markdown/lib/handle/list-item.js
2337
- function listItem(node, parent, state, info) {
2338
- const listItemIndent = checkListItemIndent(state);
2339
- let bullet = state.bulletCurrent || checkBullet(state);
2340
- if (parent && parent.type === "list" && parent.ordered) {
2341
- bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node)) + bullet;
2342
- }
2343
- let size = bullet.length + 1;
2344
- if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node.spread)) {
2345
- size = Math.ceil(size / 4) * 4;
2346
- }
2347
- const tracker = state.createTracker(info);
2348
- tracker.move(bullet + " ".repeat(size - bullet.length));
2349
- tracker.shift(size);
2350
- const exit = state.enter("listItem");
2351
- const value = state.indentLines(state.containerFlow(node, tracker.current()), map);
2352
- exit();
2353
- return value;
2354
- function map(line, index, blank) {
2355
- if (index) {
2356
- return (blank ? "" : " ".repeat(size)) + line;
2357
- }
2358
- return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line;
2359
- }
2450
+ // ../../node_modules/micromark-util-character/dev/index.js
2451
+ function asciiControl(code) {
2452
+ return code !== null && (code < codes.space || code === codes.del);
2360
2453
  }
2361
- var init_list_item = () => {};
2362
-
2363
- // ../../node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
2364
- function paragraph(node, _, state, info) {
2365
- const exit = state.enter("paragraph");
2366
- const subexit = state.enter("phrasing");
2367
- const value = state.containerPhrasing(node, info);
2368
- subexit();
2369
- exit();
2370
- return value;
2454
+ function markdownLineEnding(code) {
2455
+ return code !== null && code < codes.horizontalTab;
2371
2456
  }
2372
-
2373
- // ../../node_modules/mdast-util-phrasing/lib/index.js
2374
- var phrasing;
2375
- var init_lib7 = __esm(() => {
2376
- init_unist_util_is();
2377
- phrasing = convert([
2378
- "break",
2379
- "delete",
2380
- "emphasis",
2381
- "footnote",
2382
- "footnoteReference",
2383
- "image",
2384
- "imageReference",
2385
- "inlineCode",
2386
- "inlineMath",
2387
- "link",
2388
- "linkReference",
2389
- "mdxJsxTextElement",
2390
- "mdxTextExpression",
2391
- "strong",
2392
- "text",
2393
- "textDirective"
2394
- ]);
2395
- });
2396
-
2397
- // ../../node_modules/mdast-util-phrasing/index.js
2398
- var init_mdast_util_phrasing = __esm(() => {
2399
- init_lib7();
2400
- });
2401
-
2402
- // ../../node_modules/mdast-util-to-markdown/lib/handle/root.js
2403
- function root(node, _, state, info) {
2404
- const hasPhrasing = node.children.some(function(d) {
2405
- return phrasing(d);
2406
- });
2407
- const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;
2408
- return container.call(state, node, info);
2457
+ function markdownLineEndingOrSpace(code) {
2458
+ return code !== null && (code < codes.nul || code === codes.space);
2409
2459
  }
2410
- var init_root = __esm(() => {
2411
- init_mdast_util_phrasing();
2412
- });
2413
-
2414
- // ../../node_modules/mdast-util-to-markdown/lib/util/check-strong.js
2415
- function checkStrong(state) {
2416
- const marker = state.options.strong || "*";
2417
- if (marker !== "*" && marker !== "_") {
2418
- throw new Error("Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`");
2419
- }
2420
- return marker;
2460
+ function markdownSpace(code) {
2461
+ return code === codes.horizontalTab || code === codes.virtualSpace || code === codes.space;
2421
2462
  }
2422
-
2423
- // ../../node_modules/mdast-util-to-markdown/lib/handle/strong.js
2424
- function strong(node, _, state, info) {
2425
- const marker = checkStrong(state);
2426
- const exit = state.enter("strong");
2427
- const tracker = state.createTracker(info);
2428
- const before = tracker.move(marker + marker);
2429
- let between = tracker.move(state.containerPhrasing(node, {
2430
- after: marker,
2431
- before,
2432
- ...tracker.current()
2433
- }));
2434
- const betweenHead = between.charCodeAt(0);
2435
- const open = encodeInfo(info.before.charCodeAt(info.before.length - 1), betweenHead, marker);
2436
- if (open.inside) {
2437
- between = encodeCharacterReference(betweenHead) + between.slice(1);
2438
- }
2439
- const betweenTail = between.charCodeAt(between.length - 1);
2440
- const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
2441
- if (close.inside) {
2442
- between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
2463
+ function regexCheck(regex) {
2464
+ return check;
2465
+ function check(code) {
2466
+ return code !== null && code > -1 && regex.test(String.fromCharCode(code));
2443
2467
  }
2444
- const after = tracker.move(marker + marker);
2445
- exit();
2446
- state.attentionEncodeSurroundingInfo = {
2447
- after: close.outside,
2448
- before: open.outside
2449
- };
2450
- return before + between + after;
2451
- }
2452
- function strongPeek(_, _1, state) {
2453
- return state.options.strong || "*";
2454
2468
  }
2455
- var init_strong = __esm(() => {
2456
- init_encode_info();
2457
- strong.peek = strongPeek;
2469
+ var asciiAlpha, asciiAlphanumeric, asciiAtext, asciiDigit, asciiHexDigit, asciiPunctuation, unicodePunctuation, unicodeWhitespace;
2470
+ var init_dev = __esm(() => {
2471
+ init_default();
2472
+ asciiAlpha = regexCheck(/[A-Za-z]/);
2473
+ asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
2474
+ asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
2475
+ asciiDigit = regexCheck(/\d/);
2476
+ asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
2477
+ asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
2478
+ unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
2479
+ unicodeWhitespace = regexCheck(/\s/);
2458
2480
  });
2459
2481
 
2460
- // ../../node_modules/mdast-util-to-markdown/lib/handle/text.js
2461
- function text(node, _, state, info) {
2462
- return state.safe(node.value, info);
2463
- }
2482
+ // ../../node_modules/micromark-util-html-tag-name/index.js
2483
+ var htmlBlockNames, htmlRawNames;
2484
+ var init_micromark_util_html_tag_name = __esm(() => {
2485
+ htmlBlockNames = [
2486
+ "address",
2487
+ "article",
2488
+ "aside",
2489
+ "base",
2490
+ "basefont",
2491
+ "blockquote",
2492
+ "body",
2493
+ "caption",
2494
+ "center",
2495
+ "col",
2496
+ "colgroup",
2497
+ "dd",
2498
+ "details",
2499
+ "dialog",
2500
+ "dir",
2501
+ "div",
2502
+ "dl",
2503
+ "dt",
2504
+ "fieldset",
2505
+ "figcaption",
2506
+ "figure",
2507
+ "footer",
2508
+ "form",
2509
+ "frame",
2510
+ "frameset",
2511
+ "h1",
2512
+ "h2",
2513
+ "h3",
2514
+ "h4",
2515
+ "h5",
2516
+ "h6",
2517
+ "head",
2518
+ "header",
2519
+ "hr",
2520
+ "html",
2521
+ "iframe",
2522
+ "legend",
2523
+ "li",
2524
+ "link",
2525
+ "main",
2526
+ "menu",
2527
+ "menuitem",
2528
+ "nav",
2529
+ "noframes",
2530
+ "ol",
2531
+ "optgroup",
2532
+ "option",
2533
+ "p",
2534
+ "param",
2535
+ "search",
2536
+ "section",
2537
+ "summary",
2538
+ "table",
2539
+ "tbody",
2540
+ "td",
2541
+ "tfoot",
2542
+ "th",
2543
+ "thead",
2544
+ "title",
2545
+ "tr",
2546
+ "track",
2547
+ "ul"
2548
+ ];
2549
+ htmlRawNames = ["pre", "script", "style", "textarea"];
2550
+ });
2464
2551
 
2465
- // ../../node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
2466
- function checkRuleRepetition(state) {
2467
- const repetition = state.options.ruleRepetition || 3;
2468
- if (repetition < 3) {
2469
- throw new Error("Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more");
2552
+ // ../../node_modules/mdast-util-to-markdown/lib/util/html-kind.js
2553
+ function htmlKind(value) {
2554
+ if (value.charCodeAt(0) !== 60)
2555
+ return;
2556
+ const next = value.charCodeAt(1);
2557
+ if (next === 33) {
2558
+ const code = value.charCodeAt(2);
2559
+ if (code === 45)
2560
+ return 2;
2561
+ if (code === 91)
2562
+ return 5;
2563
+ if (asciiAlpha(code))
2564
+ return 4;
2565
+ return;
2470
2566
  }
2471
- return repetition;
2472
- }
2473
-
2474
- // ../../node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
2475
- function thematicBreak(_, _1, state) {
2476
- const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
2477
- return state.options.ruleSpaces ? value.slice(0, -1) : value;
2567
+ if (next === 63)
2568
+ return 3;
2569
+ const closing = next === 47;
2570
+ const start = closing ? 2 : 1;
2571
+ let end = start;
2572
+ let code = value.charCodeAt(end);
2573
+ if (!asciiAlpha(code))
2574
+ return;
2575
+ while (code === 45 || asciiAlphanumeric(code)) {
2576
+ code = value.charCodeAt(++end);
2577
+ }
2578
+ const name = value.slice(start, end).toLowerCase();
2579
+ if (!closing && code !== 47 && htmlRawNames.includes(name)) {
2580
+ return 1;
2581
+ }
2582
+ return htmlBlockNames.includes(name) ? 6 : 7;
2478
2583
  }
2479
- var init_thematic_break = () => {};
2480
-
2481
- // ../../node_modules/mdast-util-to-markdown/lib/handle/index.js
2482
- var handle;
2483
- var init_handle = __esm(() => {
2484
- init_break();
2485
- init_code();
2486
- init_definition();
2487
- init_emphasis();
2488
- init_heading();
2489
- init_html();
2490
- init_image();
2491
- init_image_reference();
2492
- init_inline_code();
2493
- init_link();
2494
- init_link_reference();
2495
- init_list();
2496
- init_list_item();
2497
- init_root();
2498
- init_strong();
2499
- init_thematic_break();
2500
- handle = {
2501
- blockquote,
2502
- break: hardBreak,
2503
- code,
2504
- definition,
2505
- emphasis,
2506
- hardBreak,
2507
- heading,
2508
- html,
2509
- image,
2510
- imageReference,
2511
- inlineCode,
2512
- link,
2513
- linkReference,
2514
- list: list2,
2515
- listItem,
2516
- paragraph,
2517
- root,
2518
- strong,
2519
- text,
2520
- thematicBreak
2521
- };
2584
+ var init_html_kind = __esm(() => {
2585
+ init_dev();
2586
+ init_micromark_util_html_tag_name();
2522
2587
  });
2523
2588
 
2524
2589
  // ../../node_modules/mdast-util-to-markdown/lib/join.js
@@ -2530,17 +2595,28 @@ function joinDefaults(left, right, parent, state) {
2530
2595
  if (left.type === "paragraph" && (left.type === right.type || right.type === "definition" || right.type === "heading" && formatHeadingAsSetext(right, state))) {
2531
2596
  return;
2532
2597
  }
2598
+ if (left.type === "html") {
2599
+ const kind = htmlKind(left.value);
2600
+ if (kind === undefined || kind === 6 || kind === 7)
2601
+ return 1;
2602
+ }
2603
+ if (left.type === "paragraph" && right.type === "html") {
2604
+ const kind = htmlKind(right.value);
2605
+ if (kind === undefined || kind === 7)
2606
+ return 1;
2607
+ }
2533
2608
  return parent.spread ? 1 : 0;
2534
2609
  }
2535
2610
  }
2536
2611
  var join;
2537
2612
  var init_join = __esm(() => {
2538
2613
  init_format_heading_as_setext();
2614
+ init_html_kind();
2539
2615
  join = [joinDefaults];
2540
2616
  });
2541
2617
 
2542
2618
  // ../../node_modules/mdast-util-to-markdown/lib/unsafe.js
2543
- var fullPhrasingSpans, unsafe;
2619
+ var fullPhrasingSpans, unsafe, code2 = -1;
2544
2620
  var init_unsafe = __esm(() => {
2545
2621
  fullPhrasingSpans = [
2546
2622
  "autolink",
@@ -2580,6 +2656,12 @@ var init_unsafe = __esm(() => {
2580
2656
  "headingAtx"
2581
2657
  ]
2582
2658
  },
2659
+ { character: "\r", before: "[\\r\\n]", inConstruct: "phrasing" },
2660
+ { character: "\r", after: "\\r", inConstruct: "phrasing" },
2661
+ { character: `
2662
+ `, before: "\\n", inConstruct: "phrasing" },
2663
+ { character: `
2664
+ `, after: "[\\r\\n]", inConstruct: "phrasing" },
2583
2665
  { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" },
2584
2666
  { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" },
2585
2667
  {
@@ -2640,8 +2722,14 @@ var init_unsafe = __esm(() => {
2640
2722
  inConstruct: ["codeFencedLangGraveAccent", "codeFencedMetaGraveAccent"]
2641
2723
  },
2642
2724
  { character: "`", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans },
2643
- { atBreak: true, character: "~" }
2725
+ { atBreak: true, character: "~" },
2726
+ { character: "<", inConstruct: "autolink" },
2727
+ { character: ">", inConstruct: "autolink" },
2728
+ { character: "", inConstruct: "autolink" }
2644
2729
  ];
2730
+ while (++code2 < 33) {
2731
+ unsafe.push({ character: String.fromCharCode(code2), inConstruct: "autolink" });
2732
+ }
2645
2733
  });
2646
2734
 
2647
2735
  // ../../node_modules/character-entities/index.js
@@ -4795,7 +4883,7 @@ function decodeNumericCharacterReference(value, base) {
4795
4883
  }
4796
4884
  return String.fromCodePoint(code);
4797
4885
  }
4798
- var init_dev3 = __esm(() => {
4886
+ var init_dev2 = __esm(() => {
4799
4887
  init_default();
4800
4888
  });
4801
4889
 
@@ -4816,9 +4904,9 @@ function decode($0, $1, $2) {
4816
4904
  return decodeNamedCharacterReference($2) || $0;
4817
4905
  }
4818
4906
  var characterEscapeOrReference;
4819
- var init_dev4 = __esm(() => {
4907
+ var init_dev3 = __esm(() => {
4820
4908
  init_decode_named_character_reference();
4821
- init_dev3();
4909
+ init_dev2();
4822
4910
  init_default();
4823
4911
  characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
4824
4912
  });
@@ -4831,26 +4919,222 @@ function association(node) {
4831
4919
  return decodeString(node.identifier);
4832
4920
  }
4833
4921
  var init_association = __esm(() => {
4834
- init_dev4();
4922
+ init_dev3();
4835
4923
  });
4836
4924
 
4837
4925
  // ../../node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js
4838
4926
  function compilePattern(pattern) {
4839
4927
  if (!pattern._compiled) {
4840
4928
  const before = (pattern.atBreak ? "[\\r\\n][\\t ]*" : "") + (pattern.before ? "(?:" + pattern.before + ")" : "");
4841
- pattern._compiled = new RegExp((before ? "(" + before + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.after ? "(?:" + pattern.after + ")" : ""), "g");
4929
+ pattern._compiled = new RegExp((pattern.beforeNode ? "^" : before ? "(" + before + ")" : "") + (/[$()*+.?[\\\]^{|}]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.afterNode ? "$" : pattern.after ? "(?:" + pattern.after + ")" : ""), pattern.unicode ? "gu" : "g");
4842
4930
  }
4843
4931
  return pattern._compiled;
4844
4932
  }
4845
4933
 
4934
+ // ../../node_modules/micromark-util-classify-character/dev/index.js
4935
+ function classifyCharacter(code) {
4936
+ if (code === codes.eof || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {
4937
+ return constants.characterGroupWhitespace;
4938
+ }
4939
+ if (unicodePunctuation(code)) {
4940
+ return constants.characterGroupPunctuation;
4941
+ }
4942
+ }
4943
+ var init_dev4 = __esm(() => {
4944
+ init_dev();
4945
+ init_default();
4946
+ });
4947
+
4948
+ // ../../node_modules/mdast-util-to-markdown/lib/util/character.js
4949
+ function firstCharacter(value) {
4950
+ const code = value.codePointAt(0);
4951
+ return code === undefined ? "" : String.fromCodePoint(code);
4952
+ }
4953
+ function lastCharacter(value) {
4954
+ const code = value.codePointAt(value.length - 2);
4955
+ return code !== undefined && code > 65535 ? value.slice(-2) : value.slice(-1);
4956
+ }
4957
+
4958
+ // ../../node_modules/mdast-util-to-markdown/lib/util/encode-info.js
4959
+ function encodeInfo(outside, inside, marker) {
4960
+ const outsideKind = classifyCharacter(outside);
4961
+ const insideKind = classifyCharacter(inside);
4962
+ if (outsideKind === undefined) {
4963
+ return insideKind === undefined ? marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: true };
4964
+ }
4965
+ if (outsideKind === 1) {
4966
+ return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: false };
4967
+ }
4968
+ return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: false } : { inside: false, outside: false };
4969
+ }
4970
+ var init_encode_info = __esm(() => {
4971
+ init_dev4();
4972
+ });
4973
+
4846
4974
  // ../../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
4975
+ function candidates(tokens, involved, runOf) {
4976
+ const related = new Set;
4977
+ for (const token of tokens) {
4978
+ const siblings = runOf.get(token);
4979
+ if (siblings && token.attention && involved.some((d) => d.attention === token.attention)) {
4980
+ for (const sibling of siblings.tokens) {
4981
+ related.add(sibling.attention);
4982
+ }
4983
+ }
4984
+ }
4985
+ const ordered = [];
4986
+ for (const token of tokens) {
4987
+ if (token.attention && related.delete(token.attention)) {
4988
+ ordered.push(token.attention);
4989
+ }
4990
+ }
4991
+ ordered.reverse();
4992
+ return ordered;
4993
+ }
4994
+ function check(tokens, before, after) {
4995
+ const runs = [];
4996
+ const wrong = new Map;
4997
+ const runOf = new Map;
4998
+ let index = 0;
4999
+ while (index < tokens.length) {
5000
+ if (!tokens[index].attention) {
5001
+ index++;
5002
+ continue;
5003
+ }
5004
+ const marker = tokens[index].value.charAt(0);
5005
+ const strict = builtins.get(marker);
5006
+ let end = index + 1;
5007
+ while (end < tokens.length && tokens[end].attention && tokens[end].value.charAt(0) === marker) {
5008
+ end++;
5009
+ }
5010
+ const head = index ? tokens[index - 1].value : before;
5011
+ const previous = classifyCharacter(head.charCodeAt(head.length - 1));
5012
+ const next = classifyCharacter((end < tokens.length ? tokens[end].value : after).charCodeAt(0));
5013
+ const open = !next || next === 2 && Boolean(previous);
5014
+ const close = !previous || previous === 2 && Boolean(next);
5015
+ const run = {
5016
+ tokens: tokens.slice(index, end),
5017
+ markers: [],
5018
+ start: 0,
5019
+ end: 0,
5020
+ open: strict ? open && (Boolean(previous) || !close) : open,
5021
+ close: strict ? close && (Boolean(next) || !open) : close,
5022
+ split: strict !== undefined
5023
+ };
5024
+ for (const token of run.tokens) {
5025
+ wrong.set(token, [...run.tokens]);
5026
+ runOf.set(token, run);
5027
+ let size = token.value.length;
5028
+ while (size--)
5029
+ run.markers.push(token);
5030
+ }
5031
+ run.end = run.markers.length;
5032
+ runs.push(run);
5033
+ index = end;
5034
+ }
5035
+ pair(runs, wrong);
5036
+ index = -1;
5037
+ while (++index < tokens.length) {
5038
+ const involved = wrong.get(tokens[index]);
5039
+ if (involved)
5040
+ return { attention: candidates(tokens, involved, runOf), index };
5041
+ }
5042
+ }
4847
5043
  function containerPhrasing(parent, state, info) {
5044
+ return serialize(phrasing2(parent, state, info), info.before, info.after);
5045
+ }
5046
+ function encode(tokens, start) {
5047
+ const token = tokens[start ? 0 : tokens.length - 1];
5048
+ if (!token || token.attention)
5049
+ return;
5050
+ const character = start ? firstCharacter(token.value) : lastCharacter(token.value);
5051
+ const reference = encodeCharacterReference(character.codePointAt(0));
5052
+ token.value = start ? reference + token.value.slice(character.length) : token.value.slice(0, token.value.length - character.length) + reference;
5053
+ }
5054
+ function improve(items, chosen, mistake, before, after) {
5055
+ for (const attention of mistake.attention) {
5056
+ const current = chosen.get(attention) || attention.sequences[0];
5057
+ for (const sequence of attention.sequences) {
5058
+ if (sequence === current)
5059
+ continue;
5060
+ const trial = new Map(chosen);
5061
+ trial.set(attention, sequence);
5062
+ const tokens = render(items, trial, before, after);
5063
+ const next = check(tokens, before, after);
5064
+ if (!next || next.index > mistake.index) {
5065
+ return { chosen: trial, mistake: next, tokens };
5066
+ }
5067
+ }
5068
+ }
5069
+ }
5070
+ function pair(runs, wrong) {
5071
+ let index = 0;
5072
+ while (index < runs.length) {
5073
+ const closer = runs[index];
5074
+ const marker = closer.tokens[0].value.charAt(0);
5075
+ const closerSize = closer.end - closer.start;
5076
+ let open = closer.close && closerSize ? index : 0;
5077
+ while (open--) {
5078
+ const opener = runs[open];
5079
+ const openerSize = opener.end - opener.start;
5080
+ if (opener.tokens[0].value.charAt(0) === marker && opener.open && openerSize && (closer.split ? !((opener.close || closer.open) && closerSize % 3) || (openerSize + closerSize) % 3 : openerSize === opener.markers.length && openerSize === closerSize)) {
5081
+ const size = closer.split ? openerSize > 1 && closerSize > 1 ? 2 : 1 : closerSize;
5082
+ const opening = opener.markers.slice(opener.end - size, opener.end);
5083
+ const closing = closer.markers.slice(closer.start, closer.start + size);
5084
+ const openToken = opening[0];
5085
+ const closeToken = closing[0];
5086
+ if (openToken === opening[size - 1] && openToken.value.length === size && closeToken === closing[size - 1] && closeToken.value.length === size && openToken.attention === closeToken.attention) {
5087
+ wrong.delete(openToken);
5088
+ wrong.delete(closeToken);
5089
+ } else {
5090
+ const involved = [...new Set([...opening, ...closing])];
5091
+ for (const token of involved) {
5092
+ const list = wrong.get(token);
5093
+ if (list)
5094
+ list.push(...involved);
5095
+ }
5096
+ }
5097
+ opener.end -= size;
5098
+ closer.start += size;
5099
+ break;
5100
+ }
5101
+ }
5102
+ if (open === -1 || closer.start === closer.end)
5103
+ index++;
5104
+ }
5105
+ }
5106
+ function attentionSequences(type, markers, sizes) {
5107
+ if (markers.length === 0) {
5108
+ throw new Error("Cannot serialize `" + type + "` as attention without markers, expected one or more markers");
5109
+ }
5110
+ if (sizes.length === 0) {
5111
+ throw new Error("Cannot serialize `" + type + "` as attention without sizes, expected one or more sizes");
5112
+ }
5113
+ for (const size of sizes) {
5114
+ if (!Number.isSafeInteger(size) || size < 1) {
5115
+ throw new Error("Cannot serialize `" + type + "` as attention with `" + size + "` as size, expected positive integer");
5116
+ }
5117
+ }
5118
+ const sequences = [];
5119
+ for (const marker of markers) {
5120
+ if (marker.length !== 1) {
5121
+ throw new Error("Cannot serialize `" + type + "` as attention with `" + marker + "` as marker, expected a single ascii character");
5122
+ }
5123
+ if (!asciiPunctuation(marker.charCodeAt(0))) {
5124
+ throw new Error("Cannot serialize `" + type + "` as attention with `" + marker + "` as marker, expected ascii punctuation");
5125
+ }
5126
+ for (const size of sizes) {
5127
+ sequences.push(marker.repeat(size));
5128
+ }
5129
+ }
5130
+ return sequences;
5131
+ }
5132
+ function phrasing2(parent, state, info) {
4848
5133
  const indexStack = state.indexStack;
4849
5134
  const children = parent.children || [];
4850
5135
  const results = [];
4851
5136
  let index = -1;
4852
5137
  let before = info.before;
4853
- let encodeAfter;
4854
5138
  indexStack.push(-1);
4855
5139
  let tracker = state.createTracker(info);
4856
5140
  while (++index < children.length) {
@@ -4861,47 +5145,132 @@ function containerPhrasing(parent, state, info) {
4861
5145
  let handle = state.handle.handlers[children[index + 1].type];
4862
5146
  if (handle && handle.peek)
4863
5147
  handle = handle.peek;
4864
- after = handle ? handle(children[index + 1], parent, state, {
5148
+ after = handle ? firstCharacter(handle(children[index + 1], parent, state, {
4865
5149
  before: "",
4866
5150
  after: "",
4867
5151
  ...tracker.current()
4868
- }).charAt(0) : "";
5152
+ })) : "";
4869
5153
  } else {
4870
5154
  after = info.after;
4871
5155
  }
4872
- if (results.length > 0 && (before === "\r" || before === `
4873
- `) && child.type === "html") {
4874
- results[results.length - 1] = results[results.length - 1].replace(/(\r?\n|\r)$/, " ");
5156
+ const previous = results[results.length - 1];
5157
+ if (typeof previous === "string" && (before === "\r" || before === `
5158
+ `) && child.type === "html" && htmlKind(child.value) !== 7) {
5159
+ results[results.length - 1] = previous.replace(/(\r?\n|\r)$/, " ");
4875
5160
  before = " ";
4876
5161
  tracker = state.createTracker(info);
4877
- tracker.move(results.join(""));
5162
+ tracker.move(serialize(results, info.before, info.after));
5163
+ }
5164
+ const handle = state.handle.handlers[child.type];
5165
+ if (handle && handle.attention) {
5166
+ const { construct, markers, sizes } = handle.attention(child, state);
5167
+ const sequences = attentionSequences(child.type, markers, sizes);
5168
+ const sequence = sequences[0];
5169
+ const exit = state.enter(construct);
5170
+ tracker.move(sequence);
5171
+ const inside = phrasing2(child, state, {
5172
+ ...tracker.current(),
5173
+ before: sequence,
5174
+ after: sequence
5175
+ });
5176
+ tracker.move(serialize(inside, sequence, sequence));
5177
+ tracker.move(sequence);
5178
+ exit();
5179
+ results.push({ children: inside, sequences });
5180
+ before = sequence.charAt(sequence.length - 1);
5181
+ } else {
5182
+ const value = state.handle(child, parent, state, {
5183
+ ...tracker.current(),
5184
+ after,
5185
+ before
5186
+ });
5187
+ if (!value)
5188
+ continue;
5189
+ tracker.move(value);
5190
+ results.push(value);
5191
+ before = lastCharacter(value);
4878
5192
  }
4879
- let value = state.handle(child, parent, state, {
4880
- ...tracker.current(),
4881
- after,
4882
- before
4883
- });
4884
- if (encodeAfter && encodeAfter === value.slice(0, 1)) {
4885
- value = encodeCharacterReference(encodeAfter.charCodeAt(0)) + value.slice(1);
5193
+ }
5194
+ indexStack.pop();
5195
+ return results;
5196
+ }
5197
+ function render(items, chosen, before, after) {
5198
+ const tokens = [];
5199
+ let encodeAfter;
5200
+ let previous = lastCharacter(before);
5201
+ let index = -1;
5202
+ while (++index < items.length) {
5203
+ const item = items[index];
5204
+ if (typeof item === "string") {
5205
+ const token = { value: item, attention: undefined };
5206
+ if (encodeAfter && encodeAfter === firstCharacter(item)) {
5207
+ encode([token], true);
5208
+ }
5209
+ encodeAfter = undefined;
5210
+ tokens.push(token);
5211
+ if (token.value)
5212
+ previous = lastCharacter(token.value);
5213
+ continue;
4886
5214
  }
4887
- const encodingInfo = state.attentionEncodeSurroundingInfo;
4888
- state.attentionEncodeSurroundingInfo = undefined;
4889
- encodeAfter = undefined;
4890
- if (encodingInfo) {
4891
- if (results.length > 0 && encodingInfo.before && before === results[results.length - 1].slice(-1)) {
4892
- results[results.length - 1] = results[results.length - 1].slice(0, -1) + encodeCharacterReference(before.charCodeAt(0));
4893
- }
4894
- if (encodingInfo.after)
4895
- encodeAfter = after;
5215
+ const sequence = chosen.get(item) || item.sequences[0];
5216
+ const marker = sequence.charAt(0);
5217
+ const next = items[index + 1];
5218
+ const outsideBefore = previous;
5219
+ const outsideAfter = firstCharacter(next === undefined ? after : typeof next === "string" ? next : chosen.get(next) || next.sequences[0]);
5220
+ const inside = render(item.children, chosen, sequence, sequence);
5221
+ const head = inside.length > 0 ? inside[0].value : "";
5222
+ const open = encodeInfo(outsideBefore.charCodeAt(outsideBefore.length - 1), head.charCodeAt(0), marker);
5223
+ if (open.inside)
5224
+ encode(inside, true);
5225
+ const tail = inside.length > 0 ? lastCharacter(inside[inside.length - 1].value) : "";
5226
+ const close = encodeInfo(outsideAfter.charCodeAt(0), tail.charCodeAt(tail.length - 1), marker);
5227
+ if (close.inside)
5228
+ encode(inside, false);
5229
+ if (open.outside && outsideBefore !== `
5230
+ ` && outsideBefore !== "\r") {
5231
+ encode(tokens, false);
5232
+ }
5233
+ if (close.outside)
5234
+ encodeAfter = outsideAfter;
5235
+ tokens.push({ value: sequence, attention: item }, ...inside, {
5236
+ value: sequence,
5237
+ attention: item
5238
+ });
5239
+ previous = sequence.charAt(sequence.length - 1);
5240
+ }
5241
+ return tokens;
5242
+ }
5243
+ function serialize(items, before, after) {
5244
+ let chosen = new Map;
5245
+ const initial = render(items, chosen, before, after);
5246
+ let tokens = initial;
5247
+ let mistake = check(tokens, before, after);
5248
+ while (mistake) {
5249
+ const next = improve(items, chosen, mistake, before, after);
5250
+ if (!next) {
5251
+ tokens = initial;
5252
+ break;
4896
5253
  }
4897
- tracker.move(value);
4898
- results.push(value);
4899
- before = value.slice(-1);
5254
+ chosen = next.chosen;
5255
+ tokens = next.tokens;
5256
+ mistake = next.mistake;
4900
5257
  }
4901
- indexStack.pop();
4902
- return results.join("");
5258
+ let result = "";
5259
+ for (const token of tokens)
5260
+ result += token.value;
5261
+ return result;
4903
5262
  }
4904
- var init_container_phrasing = () => {};
5263
+ var builtins;
5264
+ var init_container_phrasing = __esm(() => {
5265
+ init_dev();
5266
+ init_dev4();
5267
+ init_encode_info();
5268
+ init_html_kind();
5269
+ builtins = new Map([
5270
+ ["*", false],
5271
+ ["_", true]
5272
+ ]);
5273
+ });
4905
5274
 
4906
5275
  // ../../node_modules/mdast-util-to-markdown/lib/util/container-flow.js
4907
5276
  function containerFlow(parent, state, info) {
@@ -4984,19 +5353,24 @@ function safe(state, input, config) {
4984
5353
  const positions = [];
4985
5354
  const result = [];
4986
5355
  const infos = {};
5356
+ const percentEncode = state.stack.includes("autolink");
5357
+ const offset = config.before ? config.before.length : 0;
5358
+ const end = value.length - (config.after ? config.after.length : 0);
4987
5359
  let index = -1;
4988
5360
  while (++index < state.unsafe.length) {
4989
5361
  const pattern = state.unsafe[index];
4990
- if (!patternInScope(state.stack, pattern)) {
5362
+ if (!patternInScope(state.stack, pattern) || !nodeInScope(pattern.beforeNode, config.beforeNode) || !nodeInScope(pattern.afterNode, config.afterNode)) {
4991
5363
  continue;
4992
5364
  }
4993
5365
  const expression = state.compilePattern(pattern);
5366
+ const from = pattern.beforeNode ? offset : 0;
5367
+ const subject = value.slice(from, pattern.afterNode ? end : undefined);
4994
5368
  let match;
4995
- while (match = expression.exec(value)) {
5369
+ while (match = expression.exec(subject)) {
4996
5370
  const before = "before" in pattern || Boolean(pattern.atBreak);
4997
5371
  const after = "after" in pattern;
4998
- const position = match.index + (before ? match[1].length : 0);
4999
- if (positions.includes(position)) {
5372
+ const position = from + match.index + (before ? match[1].length : 0);
5373
+ if (own5.call(infos, position)) {
5000
5374
  if (infos[position].before && !before) {
5001
5375
  infos[position].before = false;
5002
5376
  }
@@ -5010,31 +5384,53 @@ function safe(state, input, config) {
5010
5384
  }
5011
5385
  }
5012
5386
  positions.sort(numerical);
5013
- let start = config.before ? config.before.length : 0;
5014
- const end = value.length - (config.after ? config.after.length : 0);
5387
+ let start = offset;
5015
5388
  index = -1;
5016
5389
  while (++index < positions.length) {
5017
5390
  const position = positions[index];
5018
5391
  if (position < start || position >= end) {
5019
5392
  continue;
5020
5393
  }
5394
+ if (value.charAt(position) === "_" && position > 0 && classifyCharacter(value.charCodeAt(position - 1)) === undefined && !own5.call(infos, position - 1) && !(position - 1 === offset && /[*_]/.test(value.charAt(offset - 1)))) {
5395
+ let sequenceEnd = position + 1;
5396
+ while (sequenceEnd < end && value.charAt(sequenceEnd) === "_") {
5397
+ sequenceEnd++;
5398
+ }
5399
+ const skip = sequenceEnd - position - 1;
5400
+ if (positions[index + skip] === sequenceEnd - 1 && sequenceEnd < value.length && classifyCharacter(value.charCodeAt(sequenceEnd)) === undefined && !own5.call(infos, sequenceEnd) && !(sequenceEnd === end - 1 && /[*_]/.test(value.charAt(end)))) {
5401
+ index += skip;
5402
+ continue;
5403
+ }
5404
+ }
5021
5405
  if (position + 1 < end && positions[index + 1] === position + 1 && infos[position].after && !infos[position + 1].before && !infos[position + 1].after || positions[index - 1] === position - 1 && infos[position].before && !infos[position - 1].before && !infos[position - 1].after) {
5022
5406
  continue;
5023
5407
  }
5024
5408
  if (start !== position) {
5025
- result.push(escapeBackslashes(value.slice(start, position), "\\"));
5409
+ const slice = value.slice(start, position);
5410
+ result.push(percentEncode ? slice : escapeBackslashes(slice, "\\"));
5026
5411
  }
5027
5412
  start = position;
5028
- if (/[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || !config.encode.includes(value.charAt(position)))) {
5413
+ if (percentEncode) {
5414
+ result.push("%" + value.charCodeAt(position).toString(16).toUpperCase().padStart(2, "0"));
5415
+ start++;
5416
+ } else if (/[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || !config.encode.includes(value.charAt(position)))) {
5029
5417
  result.push("\\");
5030
5418
  } else {
5031
5419
  result.push(encodeCharacterReference(value.charCodeAt(position)));
5032
5420
  start++;
5033
5421
  }
5034
5422
  }
5035
- result.push(escapeBackslashes(value.slice(start, end), config.after));
5423
+ const rest = value.slice(start, end);
5424
+ result.push(percentEncode ? rest : escapeBackslashes(rest, config.after));
5036
5425
  return result.join("");
5037
5426
  }
5427
+ function nodeInScope(types, node) {
5428
+ if (!types)
5429
+ return true;
5430
+ if (!node)
5431
+ return false;
5432
+ return typeof types === "string" ? types === node.type : types.includes(node.type);
5433
+ }
5038
5434
  function numerical(a, b) {
5039
5435
  return a - b;
5040
5436
  }
@@ -5059,7 +5455,11 @@ function escapeBackslashes(value, after) {
5059
5455
  results.push(value.slice(start));
5060
5456
  return results.join("");
5061
5457
  }
5062
- var init_safe = () => {};
5458
+ var own5;
5459
+ var init_safe = __esm(() => {
5460
+ init_dev4();
5461
+ own5 = {}.hasOwnProperty;
5462
+ });
5063
5463
 
5064
5464
  // ../../node_modules/mdast-util-to-markdown/lib/util/track.js
5065
5465
  function track(config) {
@@ -5090,6 +5490,8 @@ function toMarkdown(tree, options) {
5090
5490
  const settings = options || {};
5091
5491
  const state = {
5092
5492
  associationId: association,
5493
+ bulletCurrent: undefined,
5494
+ bulletLastUsed: undefined,
5093
5495
  containerPhrasing: containerPhrasingBound,
5094
5496
  containerFlow: containerFlowBound,
5095
5497
  createTracker: track,
@@ -5114,14 +5516,9 @@ function toMarkdown(tree, options) {
5114
5516
  unknown,
5115
5517
  handlers: state.handlers
5116
5518
  });
5117
- let result = state.handle(tree, undefined, state, {
5118
- before: `
5119
- `,
5120
- after: `
5121
- `,
5122
- now: { line: 1, column: 1 },
5123
- lineShift: 0
5124
- });
5519
+ let result = state.handle(phrasing(tree) ? { type: "root", children: [tree] } : tree, undefined, state, { before: `
5520
+ `, after: `
5521
+ `, now: { line: 1, column: 1 }, lineShift: 0 });
5125
5522
  if (result && result.charCodeAt(result.length - 1) !== 10 && result.charCodeAt(result.length - 1) !== 13) {
5126
5523
  result += `
5127
5524
  `;
@@ -5157,6 +5554,7 @@ function safeBound(value, config) {
5157
5554
  return safe(this, value, config);
5158
5555
  }
5159
5556
  var init_lib8 = __esm(() => {
5557
+ init_mdast_util_phrasing();
5160
5558
  init_zwitch();
5161
5559
  init_configure();
5162
5560
  init_handle();
@@ -5942,7 +6340,7 @@ var init_dangerous = __esm(() => {
5942
6340
  // ../../node_modules/stringify-entities/lib/util/to-named.js
5943
6341
  function toNamed(code, next, omit, attribute) {
5944
6342
  const character = String.fromCharCode(code);
5945
- if (own5.call(characters, character)) {
6343
+ if (own6.call(characters, character)) {
5946
6344
  const name = characters[character];
5947
6345
  const value = "&" + name;
5948
6346
  if (omit && characterEntitiesLegacy.includes(name) && !dangerous.includes(name) && (!attribute || next && next !== 61 && notAlphanumericRegex.test(String.fromCharCode(next)))) {
@@ -5952,15 +6350,15 @@ function toNamed(code, next, omit, attribute) {
5952
6350
  }
5953
6351
  return "";
5954
6352
  }
5955
- var own5, characters, key, notAlphanumericRegex;
6353
+ var own6, characters, key, notAlphanumericRegex;
5956
6354
  var init_to_named = __esm(() => {
5957
6355
  init_character_entities_legacy();
5958
6356
  init_character_entities_html4();
5959
6357
  init_dangerous();
5960
- own5 = {}.hasOwnProperty;
6358
+ own6 = {}.hasOwnProperty;
5961
6359
  characters = {};
5962
6360
  for (key in characterEntitiesHtml4) {
5963
- if (own5.call(characterEntitiesHtml4, key)) {
6361
+ if (own6.call(characterEntitiesHtml4, key)) {
5964
6362
  characters[characterEntitiesHtml4[key]] = key;
5965
6363
  }
5966
6364
  }
@@ -6148,12 +6546,14 @@ function directiveToMarkdown(options) {
6148
6546
  inConstruct: ["leafDirectiveLabel", "containerDirectiveLabel"]
6149
6547
  },
6150
6548
  {
6549
+ after: "[^\\s\\p{P}\\p{S}]",
6151
6550
  before: "[^:]",
6152
6551
  character: ":",
6153
- after: "[A-Za-z]",
6154
- inConstruct: ["phrasing"]
6552
+ inConstruct: ["phrasing"],
6553
+ unicode: true
6155
6554
  },
6156
- { atBreak: true, character: ":", after: ":" }
6555
+ { afterNode: "textDirective", character: ":", inConstruct: ["phrasing"] },
6556
+ { atBreak: true, before: ":+", character: ":" }
6157
6557
  ]
6158
6558
  };
6159
6559
  function handleDirective(node, _, state, info) {
@@ -6161,6 +6561,8 @@ function directiveToMarkdown(options) {
6161
6561
  const sequence = fence(node);
6162
6562
  const exit = state.enter(node.type);
6163
6563
  let value = tracker.move(sequence + (node.name || ""));
6564
+ const attributesValue = attributes(node, state);
6565
+ const after = info.after.charCodeAt(0);
6164
6566
  let label;
6165
6567
  if (node.type === "containerDirective") {
6166
6568
  const head = (node.children || [])[0];
@@ -6181,8 +6583,10 @@ function directiveToMarkdown(options) {
6181
6583
  value += tracker.move("]");
6182
6584
  subexit();
6183
6585
  exit();
6586
+ } else if (!attributesValue && (after === 45 || after === 95 || !(unicodePunctuation(after) || unicodeWhitespace(after)))) {
6587
+ value += tracker.move("[]");
6184
6588
  }
6185
- value += tracker.move(attributes(node, state));
6589
+ value += tracker.move(attributesValue || (after === 123 ? "{}" : ""));
6186
6590
  if (node.type === "containerDirective") {
6187
6591
  const head = (node.children || [])[0];
6188
6592
  let shallow = node;
@@ -6208,12 +6612,12 @@ function directiveToMarkdown(options) {
6208
6612
  let id;
6209
6613
  let key;
6210
6614
  for (key in attributes) {
6211
- if (own6.call(attributes, key) && attributes[key] !== undefined && attributes[key] !== null) {
6615
+ if (own7.call(attributes, key) && attributes[key] !== undefined && attributes[key] !== null) {
6212
6616
  const value = String(attributes[key]);
6213
6617
  if (key === "id") {
6214
6618
  id = settings.preferShortcut !== false && shortcut.test(value) ? "#" + value : quoted("id", value, node, state);
6215
6619
  } else if (key === "class") {
6216
- const list = value.split(/[\t\n\r ]+/g);
6620
+ const list = value.split(/[\t\n\r ]+/);
6217
6621
  const classesFullList = [];
6218
6622
  const classesList = [];
6219
6623
  let index = -1;
@@ -6359,13 +6763,14 @@ function fence(node) {
6359
6763
  }
6360
6764
  return ":".repeat(size);
6361
6765
  }
6362
- var own6, emptyOptions2, shortcut, unquoted;
6766
+ var own7, emptyOptions2, shortcut, unquoted;
6363
6767
  var init_lib13 = __esm(() => {
6364
6768
  init_development();
6769
+ init_dev();
6365
6770
  init_parse_entities();
6366
6771
  init_stringify_entities();
6367
6772
  init_unist_util_visit_parents2();
6368
- own6 = {}.hasOwnProperty;
6773
+ own7 = {}.hasOwnProperty;
6369
6774
  emptyOptions2 = {};
6370
6775
  shortcut = /^[^\t\n\r "#'.<=>`}]+$/;
6371
6776
  unquoted = /^[^\t\n\r "'<=>`}]+$/;
@@ -6378,7 +6783,7 @@ var init_mdast_util_directive = __esm(() => {
6378
6783
 
6379
6784
  // ../../node_modules/micromark-factory-space/dev/index.js
6380
6785
  function factorySpace(effects, ok, type, max) {
6381
- const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
6786
+ const limit = max ? max - 1 : Infinity;
6382
6787
  let size = 0;
6383
6788
  return start;
6384
6789
  function start(code) {
@@ -6397,6 +6802,29 @@ function factorySpace(effects, ok, type, max) {
6397
6802
  return ok(code);
6398
6803
  }
6399
6804
  }
6805
+ function factorySpaceMinMax(effects, ok, nok, type, min, max) {
6806
+ let size = 0;
6807
+ return start;
6808
+ function start(code) {
6809
+ if (max > 0 && markdownSpace(code)) {
6810
+ effects.enter(type);
6811
+ return prefix(code);
6812
+ }
6813
+ return after(code);
6814
+ }
6815
+ function prefix(code) {
6816
+ if (markdownSpace(code) && size < max) {
6817
+ effects.consume(code);
6818
+ size++;
6819
+ return prefix;
6820
+ }
6821
+ effects.exit(type);
6822
+ return after(code);
6823
+ }
6824
+ function after(code) {
6825
+ return size >= min ? ok(code) : nok(code);
6826
+ }
6827
+ }
6400
6828
  var init_dev5 = __esm(() => {
6401
6829
  init_dev();
6402
6830
  });
@@ -7182,15 +7610,13 @@ function findAndReplace(tree, list, options) {
7182
7610
  find.lastIndex = position + 1;
7183
7611
  } else {
7184
7612
  if (start !== position) {
7185
- nodes.push({
7186
- type: "text",
7187
- value: node.value.slice(start, position)
7188
- });
7613
+ add({ type: "text", value: node.value.slice(start, position) });
7189
7614
  }
7190
7615
  if (Array.isArray(value)) {
7191
- nodes.push(...value);
7616
+ for (const child of value)
7617
+ add(child);
7192
7618
  } else if (value) {
7193
- nodes.push(value);
7619
+ add(value);
7194
7620
  }
7195
7621
  start = position + match[0].length;
7196
7622
  change = true;
@@ -7202,20 +7628,28 @@ function findAndReplace(tree, list, options) {
7202
7628
  }
7203
7629
  if (change) {
7204
7630
  if (start < node.value.length) {
7205
- nodes.push({ type: "text", value: node.value.slice(start) });
7631
+ add({ type: "text", value: node.value.slice(start) });
7206
7632
  }
7207
7633
  parent.children.splice(index, 1, ...nodes);
7208
7634
  } else {
7209
7635
  nodes = [node];
7210
7636
  }
7211
7637
  return index + nodes.length;
7638
+ function add(child) {
7639
+ const previous = nodes[nodes.length - 1];
7640
+ if (previous && previous.type === "text" && child.type === "text") {
7641
+ previous.value += child.value;
7642
+ } else {
7643
+ nodes.push(child);
7644
+ }
7645
+ }
7212
7646
  }
7213
7647
  }
7214
7648
  function toPairs(tupleOrList) {
7215
- const result = [];
7216
7649
  if (!Array.isArray(tupleOrList)) {
7217
7650
  throw new TypeError("Expected find and replace tuple or list of tuples");
7218
7651
  }
7652
+ const result = [];
7219
7653
  const list = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
7220
7654
  let index = -1;
7221
7655
  while (++index < list.length) {
@@ -7518,35 +7952,39 @@ function gfmStrikethroughFromMarkdown() {
7518
7952
  }
7519
7953
  function gfmStrikethroughToMarkdown() {
7520
7954
  return {
7955
+ handlers: { delete: handleDelete },
7521
7956
  unsafe: [
7522
7957
  {
7523
7958
  character: "~",
7524
7959
  inConstruct: "phrasing",
7525
7960
  notInConstruct: constructsWithoutStrikethrough
7526
7961
  }
7527
- ],
7528
- handlers: { delete: handleDelete }
7962
+ ]
7529
7963
  };
7530
7964
  }
7531
7965
  function enterStrikethrough(token) {
7532
- this.enter({ type: "delete", children: [] }, token);
7966
+ this.enter({ type: "delete", children: [], position: undefined }, token);
7533
7967
  }
7534
7968
  function exitStrikethrough(token) {
7535
7969
  this.exit(token);
7536
7970
  }
7537
7971
  function handleDelete(node, _, state, info) {
7538
7972
  const tracker = state.createTracker(info);
7973
+ const sequence = state.stack.includes("strikethrough") ? "~" : "~~";
7539
7974
  const exit = state.enter("strikethrough");
7540
- let value = tracker.move("~~");
7975
+ let value = tracker.move(sequence);
7541
7976
  value += state.containerPhrasing(node, {
7542
7977
  ...tracker.current(),
7543
7978
  before: value,
7544
7979
  after: "~"
7545
7980
  });
7546
- value += tracker.move("~~");
7981
+ value += tracker.move(sequence);
7547
7982
  exit();
7548
7983
  return value;
7549
7984
  }
7985
+ function attentionDelete() {
7986
+ return { construct: "strikethrough", markers: ["~"], sizes: [2, 1] };
7987
+ }
7550
7988
  function peekDelete() {
7551
7989
  return "~";
7552
7990
  }
@@ -7560,6 +7998,7 @@ var init_lib19 = __esm(() => {
7560
7998
  "titleQuote",
7561
7999
  "titleApostrophe"
7562
8000
  ];
8001
+ handleDelete.attention = attentionDelete;
7563
8002
  handleDelete.peek = peekDelete;
7564
8003
  });
7565
8004
 
@@ -7590,7 +8029,7 @@ function markdownTable(table, options) {
7590
8029
  mostCellsPerRow = table[rowIndex].length;
7591
8030
  }
7592
8031
  while (++columnIndex < table[rowIndex].length) {
7593
- const cell = serialize(table[rowIndex][columnIndex]);
8032
+ const cell = serialize2(table[rowIndex][columnIndex]);
7594
8033
  if (settings.alignDelimiters !== false) {
7595
8034
  const size = stringLength(cell);
7596
8035
  sizes[columnIndex] = size;
@@ -7695,7 +8134,7 @@ function markdownTable(table, options) {
7695
8134
  return lines.join(`
7696
8135
  `);
7697
8136
  }
7698
- function serialize(value) {
8137
+ function serialize2(value) {
7699
8138
  return value === null || value === undefined ? "" : String(value);
7700
8139
  }
7701
8140
  function toAlignment(value) {
@@ -8329,7 +8768,7 @@ function previousUnbalanced(events) {
8329
8768
  }
8330
8769
  return result;
8331
8770
  }
8332
- var wwwPrefix, domain, path, trail, emailDomainDotTrail, wwwAutolink, protocolAutolink, emailAutolink, text2, code2;
8771
+ var wwwPrefix, domain, path, trail, emailDomainDotTrail, wwwAutolink, protocolAutolink, emailAutolink, text2, code3;
8333
8772
  var init_syntax2 = __esm(() => {
8334
8773
  init_dev();
8335
8774
  init_default();
@@ -8357,14 +8796,14 @@ var init_syntax2 = __esm(() => {
8357
8796
  previous: previousEmail
8358
8797
  };
8359
8798
  text2 = {};
8360
- code2 = codes.digit0;
8361
- while (code2 < codes.leftCurlyBrace) {
8362
- text2[code2] = emailAutolink;
8363
- code2++;
8364
- if (code2 === codes.colon)
8365
- code2 = codes.uppercaseA;
8366
- else if (code2 === codes.leftSquareBracket)
8367
- code2 = codes.lowercaseA;
8799
+ code3 = codes.digit0;
8800
+ while (code3 < codes.leftCurlyBrace) {
8801
+ text2[code3] = emailAutolink;
8802
+ code3++;
8803
+ if (code3 === codes.colon)
8804
+ code3 = codes.uppercaseA;
8805
+ else if (code3 === codes.leftSquareBracket)
8806
+ code3 = codes.lowercaseA;
8368
8807
  }
8369
8808
  text2[codes.plusSign] = emailAutolink;
8370
8809
  text2[codes.dash] = emailAutolink;
@@ -8398,43 +8837,36 @@ function resolveAll(constructs, events, context) {
8398
8837
  // ../../node_modules/micromark-core-commonmark/dev/lib/attention.js
8399
8838
  function resolveAllAttention(events, context) {
8400
8839
  let index = -1;
8401
- let open;
8402
- let group;
8403
- let text;
8404
- let openingSequence;
8405
- let closingSequence;
8406
- let use;
8407
8840
  let nextEvents;
8408
- let offset;
8409
8841
  while (++index < events.length) {
8410
8842
  if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
8411
- open = index;
8843
+ let open = index;
8412
8844
  while (open--) {
8413
8845
  if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
8414
8846
  if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) {
8415
8847
  continue;
8416
8848
  }
8417
- use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
8849
+ const use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
8418
8850
  const start = { ...events[open][1].end };
8419
8851
  const end = { ...events[index][1].start };
8420
8852
  movePoint(start, -use);
8421
8853
  movePoint(end, use);
8422
- openingSequence = {
8854
+ const openingSequence = {
8423
8855
  type: use > 1 ? types.strongSequence : types.emphasisSequence,
8424
8856
  start,
8425
8857
  end: { ...events[open][1].end }
8426
8858
  };
8427
- closingSequence = {
8859
+ const closingSequence = {
8428
8860
  type: use > 1 ? types.strongSequence : types.emphasisSequence,
8429
8861
  start: { ...events[index][1].start },
8430
8862
  end
8431
8863
  };
8432
- text = {
8864
+ const text = {
8433
8865
  type: use > 1 ? types.strongText : types.emphasisText,
8434
8866
  start: { ...events[open][1].end },
8435
8867
  end: { ...events[index][1].start }
8436
8868
  };
8437
- group = {
8869
+ const group = {
8438
8870
  type: use > 1 ? types.strong : types.emphasis,
8439
8871
  start: { ...openingSequence.start },
8440
8872
  end: { ...closingSequence.end }
@@ -8462,14 +8894,13 @@ function resolveAllAttention(events, context) {
8462
8894
  ["exit", closingSequence, context],
8463
8895
  ["exit", group, context]
8464
8896
  ]);
8897
+ let offset = 0;
8465
8898
  if (events[index][1].end.offset - events[index][1].start.offset) {
8466
8899
  offset = 2;
8467
8900
  nextEvents = push(nextEvents, [
8468
8901
  ["enter", events[index][1], context],
8469
8902
  ["exit", events[index][1], context]
8470
8903
  ]);
8471
- } else {
8472
- offset = 0;
8473
8904
  }
8474
8905
  splice(events, open - 1, index - open + 3, nextEvents);
8475
8906
  index = open + nextEvents.length - offset - 2;
@@ -8506,8 +8937,8 @@ function tokenizeAttention(effects, ok2) {
8506
8937
  const token = effects.exit("attentionSequence");
8507
8938
  const after = classifyCharacter(code);
8508
8939
  ok(attentionMarkers, "expected `attentionMarkers` to be populated");
8509
- const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers.includes(code);
8510
- const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers.includes(previous);
8940
+ const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers.includes(code) && code !== codes.asterisk && code !== codes.underscore;
8941
+ const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers.includes(previous) && previous !== codes.asterisk && previous !== codes.underscore;
8511
8942
  token._open = Boolean(marker === codes.asterisk ? open : open && (before || !close));
8512
8943
  token._close = Boolean(marker === codes.asterisk ? close : close && (after || !open));
8513
8944
  return ok2(code);
@@ -8518,13 +8949,13 @@ function movePoint(point, offset) {
8518
8949
  point.offset += offset;
8519
8950
  point._bufferIndex += offset;
8520
8951
  }
8521
- var attention;
8952
+ var attention3;
8522
8953
  var init_attention = __esm(() => {
8523
8954
  init_development();
8524
8955
  init_dev9();
8525
- init_dev2();
8956
+ init_dev4();
8526
8957
  init_default();
8527
- attention = {
8958
+ attention3 = {
8528
8959
  name: "attention",
8529
8960
  resolveAll: resolveAllAttention,
8530
8961
  tokenize: tokenizeAttention
@@ -8823,6 +9254,35 @@ var init_character_reference = __esm(() => {
8823
9254
  };
8824
9255
  });
8825
9256
 
9257
+ // ../../node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js
9258
+ function tokenizeNonLazyContinuation(effects, ok2, nok) {
9259
+ const self2 = this;
9260
+ return start;
9261
+ function start(code) {
9262
+ if (code === codes.eof) {
9263
+ return nok(code);
9264
+ }
9265
+ ok(markdownLineEnding(code), "expected eol");
9266
+ effects.enter(types.lineEnding);
9267
+ effects.consume(code);
9268
+ effects.exit(types.lineEnding);
9269
+ return after;
9270
+ }
9271
+ function after(code) {
9272
+ return self2.parser.lazy[self2.now().line] ? nok(code) : ok2(code);
9273
+ }
9274
+ }
9275
+ var nonLazyContinuation;
9276
+ var init_partial_non_lazy_continuation = __esm(() => {
9277
+ init_development();
9278
+ init_dev();
9279
+ init_default();
9280
+ nonLazyContinuation = {
9281
+ partial: true,
9282
+ tokenize: tokenizeNonLazyContinuation
9283
+ };
9284
+ });
9285
+
8826
9286
  // ../../node_modules/micromark-core-commonmark/dev/lib/code-fenced.js
8827
9287
  function tokenizeCodeFenced(effects, ok2, nok) {
8828
9288
  const self2 = this;
@@ -8978,33 +9438,13 @@ function tokenizeCodeFenced(effects, ok2, nok) {
8978
9438
  }
8979
9439
  }
8980
9440
  }
8981
- function tokenizeNonLazyContinuation(effects, ok2, nok) {
8982
- const self2 = this;
8983
- return start;
8984
- function start(code) {
8985
- if (code === codes.eof) {
8986
- return nok(code);
8987
- }
8988
- ok(markdownLineEnding(code), "expected eol");
8989
- effects.enter(types.lineEnding);
8990
- effects.consume(code);
8991
- effects.exit(types.lineEnding);
8992
- return lineStart;
8993
- }
8994
- function lineStart(code) {
8995
- return self2.parser.lazy[self2.now().line] ? nok(code) : ok2(code);
8996
- }
8997
- }
8998
- var nonLazyContinuation, codeFenced;
9441
+ var codeFenced;
8999
9442
  var init_code_fenced = __esm(() => {
9000
9443
  init_development();
9001
9444
  init_dev5();
9002
9445
  init_dev();
9003
9446
  init_default();
9004
- nonLazyContinuation = {
9005
- partial: true,
9006
- tokenize: tokenizeNonLazyContinuation
9007
- };
9447
+ init_partial_non_lazy_continuation();
9008
9448
  codeFenced = {
9009
9449
  concrete: true,
9010
9450
  name: "codeFenced",
@@ -9014,16 +9454,11 @@ var init_code_fenced = __esm(() => {
9014
9454
 
9015
9455
  // ../../node_modules/micromark-core-commonmark/dev/lib/code-indented.js
9016
9456
  function tokenizeCodeIndented(effects, ok2, nok) {
9017
- const self2 = this;
9018
9457
  return start;
9019
9458
  function start(code) {
9020
9459
  ok(markdownSpace(code));
9021
9460
  effects.enter(types.codeIndented);
9022
- return factorySpace(effects, afterPrefix, types.linePrefix, constants.tabSize + 1)(code);
9023
- }
9024
- function afterPrefix(code) {
9025
- const tail = self2.events[self2.events.length - 1];
9026
- return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? atBreak(code) : nok(code);
9461
+ return factorySpaceMinMax(effects, atBreak, nok, types.linePrefix, constants.tabSize, constants.tabSize)(code);
9027
9462
  }
9028
9463
  function atBreak(code) {
9029
9464
  if (code === codes.eof) {
@@ -9061,11 +9496,10 @@ function tokenizeFurtherStart(effects, ok, nok) {
9061
9496
  effects.exit(types.lineEnding);
9062
9497
  return furtherStart;
9063
9498
  }
9064
- return factorySpace(effects, afterPrefix, types.linePrefix, constants.tabSize + 1)(code);
9499
+ return factorySpaceMinMax(effects, ok, onNotEnoughPrefix, types.linePrefix, constants.tabSize, constants.tabSize)(code);
9065
9500
  }
9066
- function afterPrefix(code) {
9067
- const tail = self2.events[self2.events.length - 1];
9068
- return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code);
9501
+ function onNotEnoughPrefix(code) {
9502
+ return markdownLineEnding(code) ? furtherStart(code) : nok(code);
9069
9503
  }
9070
9504
  }
9071
9505
  var codeIndented, furtherStart;
@@ -9851,8 +10285,6 @@ var init_hard_break_escape = __esm(() => {
9851
10285
  function resolveHeadingAtx(events, context) {
9852
10286
  let contentEnd = events.length - 2;
9853
10287
  let contentStart = 3;
9854
- let content;
9855
- let text;
9856
10288
  if (events[contentStart][1].type === types.whitespace) {
9857
10289
  contentStart += 2;
9858
10290
  }
@@ -9863,12 +10295,12 @@ function resolveHeadingAtx(events, context) {
9863
10295
  contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
9864
10296
  }
9865
10297
  if (contentEnd > contentStart) {
9866
- content = {
10298
+ const content = {
9867
10299
  type: types.atxHeadingText,
9868
10300
  start: events[contentStart][1].start,
9869
10301
  end: events[contentEnd][1].end
9870
10302
  };
9871
- text = {
10303
+ const text = {
9872
10304
  type: types.chunkText,
9873
10305
  start: events[contentStart][1].start,
9874
10306
  end: events[contentEnd][1].end,
@@ -9952,76 +10384,6 @@ var init_heading_atx = __esm(() => {
9952
10384
  };
9953
10385
  });
9954
10386
 
9955
- // ../../node_modules/micromark-util-html-tag-name/index.js
9956
- var htmlBlockNames, htmlRawNames;
9957
- var init_micromark_util_html_tag_name = __esm(() => {
9958
- htmlBlockNames = [
9959
- "address",
9960
- "article",
9961
- "aside",
9962
- "base",
9963
- "basefont",
9964
- "blockquote",
9965
- "body",
9966
- "caption",
9967
- "center",
9968
- "col",
9969
- "colgroup",
9970
- "dd",
9971
- "details",
9972
- "dialog",
9973
- "dir",
9974
- "div",
9975
- "dl",
9976
- "dt",
9977
- "fieldset",
9978
- "figcaption",
9979
- "figure",
9980
- "footer",
9981
- "form",
9982
- "frame",
9983
- "frameset",
9984
- "h1",
9985
- "h2",
9986
- "h3",
9987
- "h4",
9988
- "h5",
9989
- "h6",
9990
- "head",
9991
- "header",
9992
- "hr",
9993
- "html",
9994
- "iframe",
9995
- "legend",
9996
- "li",
9997
- "link",
9998
- "main",
9999
- "menu",
10000
- "menuitem",
10001
- "nav",
10002
- "noframes",
10003
- "ol",
10004
- "optgroup",
10005
- "option",
10006
- "p",
10007
- "param",
10008
- "search",
10009
- "section",
10010
- "summary",
10011
- "table",
10012
- "tbody",
10013
- "td",
10014
- "tfoot",
10015
- "th",
10016
- "thead",
10017
- "title",
10018
- "tr",
10019
- "track",
10020
- "ul"
10021
- ];
10022
- htmlRawNames = ["pre", "script", "style", "textarea"];
10023
- });
10024
-
10025
10387
  // ../../node_modules/micromark-core-commonmark/dev/lib/html-flow.js
10026
10388
  function resolveToHtmlFlow(events) {
10027
10389
  let index = events.length;
@@ -10287,7 +10649,7 @@ function tokenizeHtmlFlow(effects, ok2, nok) {
10287
10649
  return continuation;
10288
10650
  }
10289
10651
  function continuationStart(code) {
10290
- return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
10652
+ return effects.check(nonLazyContinuation, continuationStartNonLazy, continuationAfter)(code);
10291
10653
  }
10292
10654
  function continuationStartNonLazy(code) {
10293
10655
  ok(markdownLineEnding(code));
@@ -10366,22 +10728,6 @@ function tokenizeHtmlFlow(effects, ok2, nok) {
10366
10728
  return ok2(code);
10367
10729
  }
10368
10730
  }
10369
- function tokenizeNonLazyContinuationStart(effects, ok, nok) {
10370
- const self2 = this;
10371
- return start;
10372
- function start(code) {
10373
- if (markdownLineEnding(code)) {
10374
- effects.enter(types.lineEnding);
10375
- effects.consume(code);
10376
- effects.exit(types.lineEnding);
10377
- return after;
10378
- }
10379
- return nok(code);
10380
- }
10381
- function after(code) {
10382
- return self2.parser.lazy[self2.now().line] ? nok(code) : ok(code);
10383
- }
10384
- }
10385
10731
  function tokenizeBlankLineBefore(effects, ok2, nok) {
10386
10732
  return start;
10387
10733
  function start(code) {
@@ -10392,13 +10738,14 @@ function tokenizeBlankLineBefore(effects, ok2, nok) {
10392
10738
  return effects.attempt(blankLine, ok2, nok);
10393
10739
  }
10394
10740
  }
10395
- var htmlFlow, blankLineBefore, nonLazyContinuationStart;
10741
+ var htmlFlow, blankLineBefore;
10396
10742
  var init_html_flow = __esm(() => {
10397
10743
  init_development();
10398
10744
  init_dev();
10399
10745
  init_micromark_util_html_tag_name();
10400
10746
  init_default();
10401
10747
  init_blank_line();
10748
+ init_partial_non_lazy_continuation();
10402
10749
  htmlFlow = {
10403
10750
  concrete: true,
10404
10751
  name: "htmlFlow",
@@ -10406,10 +10753,6 @@ var init_html_flow = __esm(() => {
10406
10753
  tokenize: tokenizeHtmlFlow
10407
10754
  };
10408
10755
  blankLineBefore = { partial: true, tokenize: tokenizeBlankLineBefore };
10409
- nonLazyContinuationStart = {
10410
- partial: true,
10411
- tokenize: tokenizeNonLazyContinuationStart
10412
- };
10413
10756
  });
10414
10757
 
10415
10758
  // ../../node_modules/micromark-core-commonmark/dev/lib/html-text.js
@@ -10747,12 +11090,11 @@ function resolveAllLabelEnd(events) {
10747
11090
  function resolveToLabelEnd(events, context) {
10748
11091
  let index = events.length;
10749
11092
  let offset = 0;
10750
- let token;
10751
11093
  let open;
10752
11094
  let close;
10753
11095
  let media;
10754
11096
  while (index--) {
10755
- token = events[index][1];
11097
+ const token = events[index][1];
10756
11098
  if (open) {
10757
11099
  if (token.type === types.link || token.type === types.labelLink && token._inactive) {
10758
11100
  break;
@@ -10810,14 +11152,14 @@ function resolveToLabelEnd(events, context) {
10810
11152
  }
10811
11153
  function tokenizeLabelEnd(effects, ok2, nok) {
10812
11154
  const self2 = this;
10813
- let index = self2.events.length;
11155
+ const labelStarts = self2._labelStarts;
10814
11156
  let labelStart;
10815
11157
  let defined;
10816
- while (index--) {
10817
- if ((self2.events[index][1].type === types.labelImage || self2.events[index][1].type === types.labelLink) && !self2.events[index][1]._balanced) {
10818
- labelStart = self2.events[index][1];
10819
- break;
11158
+ if (labelStarts) {
11159
+ while (labelStarts.length > 0 && labelStarts[labelStarts.length - 1]._balanced) {
11160
+ labelStarts.pop();
10820
11161
  }
11162
+ labelStart = labelStarts[labelStarts.length - 1];
10821
11163
  }
10822
11164
  return start;
10823
11165
  function start(code) {
@@ -10849,6 +11191,8 @@ function tokenizeLabelEnd(effects, ok2, nok) {
10849
11191
  return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);
10850
11192
  }
10851
11193
  function labelEndOk(code) {
11194
+ ok(labelStarts, "expected `labelStarts` to be populated");
11195
+ labelStarts.pop();
10852
11196
  return ok2(code);
10853
11197
  }
10854
11198
  function labelEndNok(code) {
@@ -10961,6 +11305,7 @@ var init_label_end = __esm(() => {
10961
11305
  // ../../node_modules/micromark-core-commonmark/dev/lib/label-start-image.js
10962
11306
  function tokenizeLabelStartImage(effects, ok2, nok) {
10963
11307
  const self2 = this;
11308
+ let labelImage;
10964
11309
  return start;
10965
11310
  function start(code) {
10966
11311
  ok(code === codes.exclamationMark, "expected `!`");
@@ -10975,13 +11320,18 @@ function tokenizeLabelStartImage(effects, ok2, nok) {
10975
11320
  effects.enter(types.labelMarker);
10976
11321
  effects.consume(code);
10977
11322
  effects.exit(types.labelMarker);
10978
- effects.exit(types.labelImage);
11323
+ labelImage = effects.exit(types.labelImage);
10979
11324
  return after;
10980
11325
  }
10981
11326
  return nok(code);
10982
11327
  }
10983
11328
  function after(code) {
10984
- return code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code) : ok2(code);
11329
+ if (code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs) {
11330
+ return nok(code);
11331
+ }
11332
+ self2._labelStarts = self2._labelStarts || [];
11333
+ self2._labelStarts.push(labelImage);
11334
+ return ok2(code);
10985
11335
  }
10986
11336
  }
10987
11337
  var labelStartImage;
@@ -10999,6 +11349,7 @@ var init_label_start_image = __esm(() => {
10999
11349
  // ../../node_modules/micromark-core-commonmark/dev/lib/label-start-link.js
11000
11350
  function tokenizeLabelStartLink(effects, ok2, nok) {
11001
11351
  const self2 = this;
11352
+ let labelLink;
11002
11353
  return start;
11003
11354
  function start(code) {
11004
11355
  ok(code === codes.leftSquareBracket, "expected `[`");
@@ -11006,11 +11357,16 @@ function tokenizeLabelStartLink(effects, ok2, nok) {
11006
11357
  effects.enter(types.labelMarker);
11007
11358
  effects.consume(code);
11008
11359
  effects.exit(types.labelMarker);
11009
- effects.exit(types.labelLink);
11360
+ labelLink = effects.exit(types.labelLink);
11010
11361
  return after;
11011
11362
  }
11012
11363
  function after(code) {
11013
- return code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code) : ok2(code);
11364
+ if (code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs) {
11365
+ return nok(code);
11366
+ }
11367
+ self2._labelStarts = self2._labelStarts || [];
11368
+ self2._labelStarts.push(labelLink);
11369
+ return ok2(code);
11014
11370
  }
11015
11371
  }
11016
11372
  var labelStartLink;
@@ -11237,8 +11593,68 @@ var init_list2 = __esm(() => {
11237
11593
  indentConstruct = { partial: true, tokenize: tokenizeIndent };
11238
11594
  });
11239
11595
 
11596
+ // ../../node_modules/micromark-util-edit-map/dev/index.js
11597
+ class EditMap {
11598
+ constructor() {
11599
+ this.index = new Map;
11600
+ this.map = [];
11601
+ }
11602
+ add(index, remove, add) {
11603
+ addImplementation(this, index, remove, add, false);
11604
+ }
11605
+ addBefore(index, remove, add) {
11606
+ addImplementation(this, index, remove, add, true);
11607
+ }
11608
+ consume(events) {
11609
+ this.map.sort(function(a, b) {
11610
+ return a[0] - b[0];
11611
+ });
11612
+ if (this.map.length === 0) {
11613
+ return;
11614
+ }
11615
+ let index = this.map.length;
11616
+ const vecs = [];
11617
+ while (index > 0) {
11618
+ index -= 1;
11619
+ vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);
11620
+ events.length = this.map[index][0];
11621
+ }
11622
+ vecs.push(events.slice());
11623
+ events.length = 0;
11624
+ let slice = vecs.pop();
11625
+ while (slice) {
11626
+ for (const element of slice) {
11627
+ events.push(element);
11628
+ }
11629
+ slice = vecs.pop();
11630
+ }
11631
+ this.map.length = 0;
11632
+ this.index.clear();
11633
+ }
11634
+ }
11635
+ function addImplementation(editMap, at, remove, add, before) {
11636
+ if (remove === 0 && add.length === 0) {
11637
+ return;
11638
+ }
11639
+ const existing = editMap.index.get(at);
11640
+ if (existing) {
11641
+ existing[1] += remove;
11642
+ if (before) {
11643
+ add.push(...existing[2]);
11644
+ existing[2] = add;
11645
+ } else {
11646
+ existing[2].push(...add);
11647
+ }
11648
+ return;
11649
+ }
11650
+ const change = [at, remove, add];
11651
+ editMap.map.push(change);
11652
+ editMap.index.set(at, change);
11653
+ }
11654
+
11240
11655
  // ../../node_modules/micromark-core-commonmark/dev/lib/setext-underline.js
11241
11656
  function resolveToSetextUnderline(events, context) {
11657
+ const editMap = new EditMap;
11242
11658
  let index = events.length;
11243
11659
  let content;
11244
11660
  let text;
@@ -11254,7 +11670,7 @@ function resolveToSetextUnderline(events, context) {
11254
11670
  }
11255
11671
  } else {
11256
11672
  if (events[index][1].type === types.content) {
11257
- events.splice(index, 1);
11673
+ editMap.add(index, 1, []);
11258
11674
  }
11259
11675
  if (!definition && events[index][1].type === types.definition) {
11260
11676
  definition = index;
@@ -11272,13 +11688,14 @@ function resolveToSetextUnderline(events, context) {
11272
11688
  };
11273
11689
  events[text][1].type = types.setextHeadingText;
11274
11690
  if (definition) {
11275
- events.splice(text, 0, ["enter", heading, context]);
11276
- events.splice(definition + 1, 0, ["exit", events[content][1], context]);
11691
+ editMap.add(text, 0, [["enter", heading, context]]);
11692
+ editMap.add(definition + 1, 0, [["exit", events[content][1], context]]);
11277
11693
  events[content][1].end = { ...events[definition][1].end };
11278
11694
  } else {
11279
11695
  events[content][1] = heading;
11280
11696
  }
11281
- events.push(["exit", heading, context]);
11697
+ editMap.add(events.length, 0, [["exit", heading, context]]);
11698
+ editMap.consume(events);
11282
11699
  return events;
11283
11700
  }
11284
11701
  function tokenizeSetextUnderline(effects, ok2, nok) {
@@ -11732,7 +12149,7 @@ function gfmStrikethrough(options) {
11732
12149
  var init_syntax4 = __esm(() => {
11733
12150
  init_development();
11734
12151
  init_dev9();
11735
- init_dev2();
12152
+ init_dev4();
11736
12153
  init_default();
11737
12154
  });
11738
12155
 
@@ -11742,12 +12159,13 @@ var init_dev17 = __esm(() => {
11742
12159
  });
11743
12160
 
11744
12161
  // ../../node_modules/micromark-extension-gfm-table/dev/lib/edit-map.js
11745
- class EditMap {
12162
+ class EditMap2 {
11746
12163
  constructor() {
11747
12164
  this.map = [];
12165
+ this.index = new Map;
11748
12166
  }
11749
12167
  add(index, remove, add) {
11750
- addImplementation(this, index, remove, add);
12168
+ addImplementation2(this, index, remove, add);
11751
12169
  }
11752
12170
  consume(events) {
11753
12171
  this.map.sort(function(a, b) {
@@ -11773,22 +12191,22 @@ class EditMap {
11773
12191
  slice = vecs.pop();
11774
12192
  }
11775
12193
  this.map.length = 0;
12194
+ this.index.clear();
11776
12195
  }
11777
12196
  }
11778
- function addImplementation(editMap, at, remove, add) {
11779
- let index = 0;
12197
+ function addImplementation2(editMap, at, remove, add) {
11780
12198
  if (remove === 0 && add.length === 0) {
11781
12199
  return;
11782
12200
  }
11783
- while (index < editMap.map.length) {
11784
- if (editMap.map[index][0] === at) {
11785
- editMap.map[index][1] += remove;
11786
- editMap.map[index][2].push(...add);
11787
- return;
11788
- }
11789
- index += 1;
12201
+ const existing = editMap.index.get(at);
12202
+ if (existing) {
12203
+ existing[1] += remove;
12204
+ existing[2].push(...add);
12205
+ return;
11790
12206
  }
11791
- editMap.map.push([at, remove, add]);
12207
+ const change = [at, remove, add];
12208
+ editMap.map.push(change);
12209
+ editMap.index.set(at, change);
11792
12210
  }
11793
12211
 
11794
12212
  // ../../node_modules/micromark-extension-gfm-table/dev/lib/infer.js
@@ -11839,11 +12257,12 @@ function tokenizeTable(effects, ok2, nok) {
11839
12257
  function start(code) {
11840
12258
  let index = self2.events.length - 1;
11841
12259
  while (index > -1) {
11842
- const type = self2.events[index][1].type;
11843
- if (type === types.lineEnding || type === types.linePrefix)
12260
+ const { type } = self2.events[index][1];
12261
+ if (type === types.lineEnding || type === types.linePrefix) {
11844
12262
  index--;
11845
- else
12263
+ } else {
11846
12264
  break;
12265
+ }
11847
12266
  }
11848
12267
  const tail = index > -1 ? self2.events[index][1].type : null;
11849
12268
  const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
@@ -12058,7 +12477,7 @@ function resolveTable(events, context) {
12058
12477
  let currentTable;
12059
12478
  let currentBody;
12060
12479
  let currentCell;
12061
- const map = new EditMap;
12480
+ const map = new EditMap2;
12062
12481
  while (++index < events.length) {
12063
12482
  const event = events[index];
12064
12483
  const token = event[1];
@@ -20952,7 +21371,7 @@ function element(state, node) {
20952
21371
  while (++index < node.attrs.length) {
20953
21372
  const attribute = node.attrs[index];
20954
21373
  const name = (attribute.prefix ? attribute.prefix + ":" : "") + attribute.name;
20955
- if (!own7.call(proto, name)) {
21374
+ if (!own8.call(proto, name)) {
20956
21375
  properties[name] = attribute.value;
20957
21376
  }
20958
21377
  }
@@ -20994,7 +21413,7 @@ function createLocation(state, node, location) {
20994
21413
  let key;
20995
21414
  if (location.attrs) {
20996
21415
  for (key in location.attrs) {
20997
- if (own7.call(location.attrs, key)) {
21416
+ if (own8.call(location.attrs, key)) {
20998
21417
  properties[find(state.schema, key).property] = position2(location.attrs[key]);
20999
21418
  }
21000
21419
  }
@@ -21027,14 +21446,14 @@ function position2(loc) {
21027
21446
  function point2(point) {
21028
21447
  return point.line && point.column ? point : undefined;
21029
21448
  }
21030
- var own7, proto;
21449
+ var own8, proto;
21031
21450
  var init_lib26 = __esm(() => {
21032
21451
  init_development();
21033
21452
  init_hastscript();
21034
21453
  init_property_information();
21035
21454
  init_vfile_location();
21036
21455
  init_web_namespaces();
21037
- own7 = {}.hasOwnProperty;
21456
+ own8 = {}.hasOwnProperty;
21038
21457
  proto = Object.prototype;
21039
21458
  });
21040
21459
 
@@ -29153,8 +29572,10 @@ function initializeDocument(effects) {
29153
29572
  self2.events[index][1].end = { ...point };
29154
29573
  index++;
29155
29574
  }
29156
- splice(self2.events, indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
29157
- self2.events.length = index;
29575
+ const editMap = new EditMap;
29576
+ editMap.add(indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
29577
+ editMap.add(indexBeforeExits, index - indexBeforeExits, []);
29578
+ editMap.consume(self2.events);
29158
29579
  return checkNewContainers(code);
29159
29580
  }
29160
29581
  return start(code);
@@ -29173,8 +29594,9 @@ function initializeDocument(effects) {
29173
29594
  return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code);
29174
29595
  }
29175
29596
  function thereIsANewContainer(code) {
29176
- if (childFlow)
29597
+ if (childFlow) {
29177
29598
  closeFlow();
29599
+ }
29178
29600
  exitContainers(continued);
29179
29601
  return documentContinued(code);
29180
29602
  }
@@ -29196,8 +29618,9 @@ function initializeDocument(effects) {
29196
29618
  }
29197
29619
  function flowStart(code) {
29198
29620
  if (code === codes.eof) {
29199
- if (childFlow)
29621
+ if (childFlow) {
29200
29622
  closeFlow();
29623
+ }
29201
29624
  exitContainers(0);
29202
29625
  effects.consume(code);
29203
29626
  return;
@@ -29230,11 +29653,13 @@ function initializeDocument(effects) {
29230
29653
  function writeToChild(token, endOfFile) {
29231
29654
  ok(childFlow, "expected `childFlow` to be defined when continuing");
29232
29655
  const stream = self2.sliceStream(token);
29233
- if (endOfFile)
29656
+ if (endOfFile) {
29234
29657
  stream.push(null);
29658
+ }
29235
29659
  token.previous = childToken;
29236
- if (childToken)
29660
+ if (childToken) {
29237
29661
  childToken.next = token;
29662
+ }
29238
29663
  childToken = token;
29239
29664
  childFlow.defineSkip(token.start);
29240
29665
  childFlow.write(stream);
@@ -29265,8 +29690,10 @@ function initializeDocument(effects) {
29265
29690
  self2.events[index][1].end = { ...point };
29266
29691
  index++;
29267
29692
  }
29268
- splice(self2.events, indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
29269
- self2.events.length = index;
29693
+ const editMap = new EditMap;
29694
+ editMap.add(indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
29695
+ editMap.add(indexBeforeExits, index - indexBeforeExits, []);
29696
+ editMap.consume(self2.events);
29270
29697
  }
29271
29698
  }
29272
29699
  function exitContainers(size) {
@@ -29297,7 +29724,6 @@ var init_document = __esm(() => {
29297
29724
  init_development();
29298
29725
  init_dev5();
29299
29726
  init_dev();
29300
- init_dev9();
29301
29727
  init_default();
29302
29728
  document2 = { tokenize: initializeDocument };
29303
29729
  containerConstruct = { tokenize: tokenizeContainer };
@@ -29417,6 +29843,7 @@ function createResolver(extraResolver) {
29417
29843
  }
29418
29844
  }
29419
29845
  function resolveAllLineSuffixes(events, context) {
29846
+ const editMap = new EditMap;
29420
29847
  let eventIndex = 0;
29421
29848
  while (++eventIndex <= events.length) {
29422
29849
  if ((eventIndex === events.length || events[eventIndex][1].type === types.lineEnding) && events[eventIndex - 1][1].type === types.data) {
@@ -29434,8 +29861,9 @@ function resolveAllLineSuffixes(events, context) {
29434
29861
  size++;
29435
29862
  bufferIndex--;
29436
29863
  }
29437
- if (bufferIndex)
29864
+ if (bufferIndex) {
29438
29865
  break;
29866
+ }
29439
29867
  bufferIndex = -1;
29440
29868
  } else if (chunk === codes.horizontalTab) {
29441
29869
  tabs = true;
@@ -29464,13 +29892,16 @@ function resolveAllLineSuffixes(events, context) {
29464
29892
  if (data.start.offset === data.end.offset) {
29465
29893
  Object.assign(data, token);
29466
29894
  } else {
29467
- events.splice(eventIndex, 0, ["enter", token, context], ["exit", token, context]);
29468
- eventIndex += 2;
29895
+ editMap.add(eventIndex, 0, [
29896
+ ["enter", token, context],
29897
+ ["exit", token, context]
29898
+ ]);
29469
29899
  }
29470
29900
  }
29471
29901
  eventIndex++;
29472
29902
  }
29473
29903
  }
29904
+ editMap.consume(events);
29474
29905
  return events;
29475
29906
  }
29476
29907
  var resolver, string, text3;
@@ -29544,15 +29975,15 @@ var init_constructs = __esm(() => {
29544
29975
  [codes.carriageReturnLineFeed]: lineEnding,
29545
29976
  [codes.exclamationMark]: labelStartImage,
29546
29977
  [codes.ampersand]: characterReference,
29547
- [codes.asterisk]: attention,
29978
+ [codes.asterisk]: attention3,
29548
29979
  [codes.lessThan]: [autolink, htmlText],
29549
29980
  [codes.leftSquareBracket]: labelStartLink,
29550
29981
  [codes.backslash]: [hardBreakEscape, characterEscape],
29551
29982
  [codes.rightSquareBracket]: labelEnd,
29552
- [codes.underscore]: attention,
29983
+ [codes.underscore]: attention3,
29553
29984
  [codes.graveAccent]: codeText
29554
29985
  };
29555
- insideSpan = { null: [attention, resolver] };
29986
+ insideSpan = { null: [attention3, resolver] };
29556
29987
  attentionMarkers = { null: [codes.asterisk, codes.underscore] };
29557
29988
  disable = { null: [] };
29558
29989
  });
@@ -30357,11 +30788,10 @@ function createTokenizer(parser, initialize, from) {
30357
30788
  debug("position: define skip: `%j`", point);
30358
30789
  }
30359
30790
  function main() {
30360
- let chunkIndex;
30361
30791
  while (point._index < chunks.length) {
30362
30792
  const chunk = chunks[point._index];
30363
30793
  if (typeof chunk === "string") {
30364
- chunkIndex = point._index;
30794
+ const chunkIndex = point._index;
30365
30795
  if (point._bufferIndex < 0) {
30366
30796
  point._bufferIndex = 0;
30367
30797
  }
@@ -30570,7 +31000,7 @@ function serializeChunks(chunks, expandTabs) {
30570
31000
  let value;
30571
31001
  if (typeof chunk === "string") {
30572
31002
  value = chunk;
30573
- } else
31003
+ } else {
30574
31004
  switch (chunk) {
30575
31005
  case codes.carriageReturn: {
30576
31006
  value = values.cr;
@@ -30589,8 +31019,9 @@ function serializeChunks(chunks, expandTabs) {
30589
31019
  break;
30590
31020
  }
30591
31021
  case codes.virtualSpace: {
30592
- if (!expandTabs && atTab)
31022
+ if (!expandTabs && atTab) {
30593
31023
  continue;
31024
+ }
30594
31025
  value = values.space;
30595
31026
  break;
30596
31027
  }
@@ -30599,6 +31030,7 @@ function serializeChunks(chunks, expandTabs) {
30599
31030
  value = String.fromCharCode(chunk);
30600
31031
  }
30601
31032
  }
31033
+ }
30602
31034
  atTab = chunk === codes.horizontalTab;
30603
31035
  result.push(value);
30604
31036
  }
@@ -30663,14 +31095,9 @@ function preprocess() {
30663
31095
  let atCarriageReturn;
30664
31096
  return preprocessor;
30665
31097
  function preprocessor(value, encoding, end) {
30666
- const chunks = [];
30667
- let match;
30668
- let next;
30669
- let startPosition;
30670
- let endPosition;
30671
- let code;
30672
31098
  value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || undefined).decode(value));
30673
- startPosition = 0;
31099
+ const chunks = [];
31100
+ let startPosition = 0;
30674
31101
  buffer = "";
30675
31102
  if (start) {
30676
31103
  if (value.charCodeAt(0) === codes.byteOrderMarker) {
@@ -30680,9 +31107,9 @@ function preprocess() {
30680
31107
  }
30681
31108
  while (startPosition < value.length) {
30682
31109
  search2.lastIndex = startPosition;
30683
- match = search2.exec(value);
30684
- endPosition = match && match.index !== undefined ? match.index : value.length;
30685
- code = value.charCodeAt(endPosition);
31110
+ const match = search2.exec(value);
31111
+ const endPosition = match && match.index !== undefined ? match.index : value.length;
31112
+ const code = value.charCodeAt(endPosition);
30686
31113
  if (!match) {
30687
31114
  buffer = value.slice(startPosition);
30688
31115
  break;
@@ -30706,10 +31133,11 @@ function preprocess() {
30706
31133
  break;
30707
31134
  }
30708
31135
  case codes.ht: {
30709
- next = Math.ceil(column / constants.tabSize) * constants.tabSize;
31136
+ const next = Math.ceil(column / constants.tabSize) * constants.tabSize;
30710
31137
  chunks.push(codes.horizontalTab);
30711
- while (column++ < next)
31138
+ while (column++ < next) {
30712
31139
  chunks.push(codes.virtualSpace);
31140
+ }
30713
31141
  break;
30714
31142
  }
30715
31143
  case codes.lf: {
@@ -30726,10 +31154,12 @@ function preprocess() {
30726
31154
  startPosition = endPosition + 1;
30727
31155
  }
30728
31156
  if (end) {
30729
- if (atCarriageReturn)
31157
+ if (atCarriageReturn) {
30730
31158
  chunks.push(codes.carriageReturn);
30731
- if (buffer)
31159
+ }
31160
+ if (buffer) {
30732
31161
  chunks.push(buffer);
31162
+ }
30733
31163
  chunks.push(codes.eof);
30734
31164
  }
30735
31165
  return chunks;
@@ -30758,6 +31188,8 @@ function fromMarkdown(value, encoding, options) {
30758
31188
  }
30759
31189
  function compiler(options) {
30760
31190
  const config = {
31191
+ afterExit: [],
31192
+ beforeEnter: [],
30761
31193
  transforms: [],
30762
31194
  canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
30763
31195
  enter: {
@@ -30859,7 +31291,7 @@ function compiler(options) {
30859
31291
  const data = {};
30860
31292
  return compile;
30861
31293
  function compile(events) {
30862
- let tree = { type: "root", children: [] };
31294
+ let tree = { type: "root", children: [], position: undefined };
30863
31295
  const context = {
30864
31296
  stack: [tree],
30865
31297
  tokenStack: [],
@@ -30871,23 +31303,32 @@ function compiler(options) {
30871
31303
  data
30872
31304
  };
30873
31305
  const listStack = [];
31306
+ const prepared = [];
30874
31307
  let index = -1;
30875
31308
  while (++index < events.length) {
31309
+ prepared.push(events[index]);
30876
31310
  if (events[index][1].type === types.listOrdered || events[index][1].type === types.listUnordered) {
30877
31311
  if (events[index][0] === "enter") {
30878
- listStack.push(index);
31312
+ listStack.push(prepared.length - 1);
30879
31313
  } else {
30880
31314
  const tail = listStack.pop();
30881
31315
  ok(typeof tail === "number", "expected list to be open");
30882
- index = prepareList(events, tail, index);
31316
+ prepareList(prepared, tail);
30883
31317
  }
30884
31318
  }
30885
31319
  }
31320
+ events = prepared;
30886
31321
  index = -1;
30887
31322
  while (++index < events.length) {
30888
31323
  const handler = config[events[index][0]];
30889
- if (own8.call(handler, events[index][1].type)) {
30890
- handler[events[index][1].type].call(Object.assign({ sliceSerialize: events[index][2].sliceSerialize }, context), events[index][1]);
31324
+ if (events[index][0] === "enter" && config.beforeEnter.length > 0) {
31325
+ callListeners(config.beforeEnter, { ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
31326
+ }
31327
+ if (own9.call(handler, events[index][1].type)) {
31328
+ handler[events[index][1].type].call({ ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
31329
+ }
31330
+ if (events[index][0] === "exit" && config.afterExit.length > 0) {
31331
+ callListeners(config.afterExit, { ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
30891
31332
  }
30892
31333
  }
30893
31334
  if (context.tokenStack.length > 0) {
@@ -30905,7 +31346,14 @@ function compiler(options) {
30905
31346
  }
30906
31347
  return tree;
30907
31348
  }
30908
- function prepareList(events, start, length) {
31349
+ function callListeners(listeners, context, token) {
31350
+ let index = -1;
31351
+ while (++index < listeners.length) {
31352
+ listeners[index].call(context, token);
31353
+ }
31354
+ }
31355
+ function prepareList(events, start) {
31356
+ const end = events.length - 1;
30909
31357
  let index = start - 1;
30910
31358
  let containerBalance = -1;
30911
31359
  let listSpread = false;
@@ -30913,7 +31361,8 @@ function compiler(options) {
30913
31361
  let lineIndex;
30914
31362
  let firstBlankLineIndex;
30915
31363
  let atMarker;
30916
- while (++index <= length) {
31364
+ const insertions = [];
31365
+ while (++index <= end) {
30917
31366
  const event = events[index];
30918
31367
  switch (event[1].type) {
30919
31368
  case types.listUnordered:
@@ -30970,9 +31419,10 @@ function compiler(options) {
30970
31419
  listItem._spread = true;
30971
31420
  }
30972
31421
  listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);
30973
- events.splice(lineIndex || index, 0, ["exit", listItem, event[2]]);
30974
- index++;
30975
- length++;
31422
+ insertions.push({
31423
+ at: lineIndex || index,
31424
+ event: ["exit", listItem, event[2]]
31425
+ });
30976
31426
  }
30977
31427
  if (event[1].type === types.listItemPrefix) {
30978
31428
  const item = {
@@ -30982,16 +31432,23 @@ function compiler(options) {
30982
31432
  end: undefined
30983
31433
  };
30984
31434
  listItem = item;
30985
- events.splice(index, 0, ["enter", item, event[2]]);
30986
- index++;
30987
- length++;
31435
+ insertions.push({ at: index, event: ["enter", item, event[2]] });
30988
31436
  firstBlankLineIndex = undefined;
30989
31437
  atMarker = true;
30990
31438
  }
30991
31439
  }
30992
31440
  }
31441
+ const listEvents = events.splice(start);
31442
+ let insertion = 0;
31443
+ index = -1;
31444
+ while (++index < listEvents.length) {
31445
+ while (insertion < insertions.length && insertions[insertion].at === start + index) {
31446
+ events.push(insertions[insertion++].event);
31447
+ }
31448
+ events.push(listEvents[index]);
31449
+ }
31450
+ ok(insertion === insertions.length, "expected insertions to be merged");
30993
31451
  events[start][1]._spread = listSpread;
30994
- return length;
30995
31452
  }
30996
31453
  function opener(create, and) {
30997
31454
  return open;
@@ -31031,7 +31488,8 @@ function compiler(options) {
31031
31488
  const open = this.tokenStack.pop();
31032
31489
  if (!open) {
31033
31490
  throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): it’s not open");
31034
- } else if (open[0].type !== token.type) {
31491
+ }
31492
+ if (open[0].type !== token.type) {
31035
31493
  if (onExitError) {
31036
31494
  onExitError.call(this, token, open[0]);
31037
31495
  } else {
@@ -31328,13 +31786,19 @@ function compiler(options) {
31328
31786
  node.url = "mailto:" + this.sliceSerialize(token);
31329
31787
  }
31330
31788
  function blockQuote() {
31331
- return { type: "blockquote", children: [] };
31789
+ return { type: "blockquote", children: [], position: undefined };
31332
31790
  }
31333
31791
  function codeFlow() {
31334
- return { type: "code", lang: null, meta: null, value: "" };
31792
+ return {
31793
+ type: "code",
31794
+ lang: null,
31795
+ meta: null,
31796
+ value: "",
31797
+ position: undefined
31798
+ };
31335
31799
  }
31336
31800
  function codeText() {
31337
- return { type: "inlineCode", value: "" };
31801
+ return { type: "inlineCode", value: "", position: undefined };
31338
31802
  }
31339
31803
  function definition() {
31340
31804
  return {
@@ -31342,30 +31806,44 @@ function compiler(options) {
31342
31806
  identifier: "",
31343
31807
  label: null,
31344
31808
  title: null,
31345
- url: ""
31809
+ url: "",
31810
+ position: undefined
31346
31811
  };
31347
31812
  }
31348
31813
  function emphasis() {
31349
- return { type: "emphasis", children: [] };
31814
+ return { type: "emphasis", children: [], position: undefined };
31350
31815
  }
31351
31816
  function heading() {
31352
31817
  return {
31353
31818
  type: "heading",
31354
31819
  depth: 0,
31355
- children: []
31820
+ children: [],
31821
+ position: undefined
31356
31822
  };
31357
31823
  }
31358
31824
  function hardBreak() {
31359
- return { type: "break" };
31825
+ return { type: "break", position: undefined };
31360
31826
  }
31361
31827
  function html() {
31362
- return { type: "html", value: "" };
31828
+ return { type: "html", value: "", position: undefined };
31363
31829
  }
31364
31830
  function image() {
31365
- return { type: "image", title: null, url: "", alt: null };
31831
+ return {
31832
+ type: "image",
31833
+ title: null,
31834
+ url: "",
31835
+ alt: null,
31836
+ position: undefined
31837
+ };
31366
31838
  }
31367
31839
  function link() {
31368
- return { type: "link", title: null, url: "", children: [] };
31840
+ return {
31841
+ type: "link",
31842
+ title: null,
31843
+ url: "",
31844
+ children: [],
31845
+ position: undefined
31846
+ };
31369
31847
  }
31370
31848
  function list(token) {
31371
31849
  return {
@@ -31373,7 +31851,8 @@ function compiler(options) {
31373
31851
  ordered: token.type === "listOrdered",
31374
31852
  start: null,
31375
31853
  spread: token._spread,
31376
- children: []
31854
+ children: [],
31855
+ position: undefined
31377
31856
  };
31378
31857
  }
31379
31858
  function listItem(token) {
@@ -31381,20 +31860,21 @@ function compiler(options) {
31381
31860
  type: "listItem",
31382
31861
  spread: token._spread,
31383
31862
  checked: null,
31384
- children: []
31863
+ children: [],
31864
+ position: undefined
31385
31865
  };
31386
31866
  }
31387
31867
  function paragraph() {
31388
- return { type: "paragraph", children: [] };
31868
+ return { type: "paragraph", children: [], position: undefined };
31389
31869
  }
31390
31870
  function strong() {
31391
- return { type: "strong", children: [] };
31871
+ return { type: "strong", children: [], position: undefined };
31392
31872
  }
31393
31873
  function text() {
31394
- return { type: "text", value: "" };
31874
+ return { type: "text", value: "", position: undefined };
31395
31875
  }
31396
31876
  function thematicBreak() {
31397
- return { type: "thematicBreak" };
31877
+ return { type: "thematicBreak", position: undefined };
31398
31878
  }
31399
31879
  }
31400
31880
  function point3(d) {
@@ -31414,7 +31894,7 @@ function configure2(combined, extensions) {
31414
31894
  function extension(combined, extension) {
31415
31895
  let key;
31416
31896
  for (key in extension) {
31417
- if (own8.call(extension, key)) {
31897
+ if (own9.call(extension, key)) {
31418
31898
  switch (key) {
31419
31899
  case "canContainEols": {
31420
31900
  const right = extension[key];
@@ -31430,6 +31910,14 @@ function extension(combined, extension) {
31430
31910
  }
31431
31911
  break;
31432
31912
  }
31913
+ case "afterExit":
31914
+ case "beforeEnter": {
31915
+ const right = extension[key];
31916
+ if (right) {
31917
+ combined[key].push(right);
31918
+ }
31919
+ break;
31920
+ }
31433
31921
  case "enter":
31434
31922
  case "exit": {
31435
31923
  const right = extension[key];
@@ -31445,22 +31933,21 @@ function extension(combined, extension) {
31445
31933
  function defaultOnError(left, right) {
31446
31934
  if (left) {
31447
31935
  throw new Error("Cannot close `" + left.type + "` (" + stringifyPosition({ start: left.start, end: left.end }) + "): a different token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is open");
31448
- } else {
31449
- throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is still open");
31450
31936
  }
31937
+ throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is still open");
31451
31938
  }
31452
- var own8;
31939
+ var own9;
31453
31940
  var init_lib29 = __esm(() => {
31454
31941
  init_development();
31455
31942
  init_mdast_util_to_string();
31456
31943
  init_dev20();
31944
+ init_dev2();
31457
31945
  init_dev3();
31458
- init_dev4();
31459
31946
  init_dev8();
31460
31947
  init_default();
31461
31948
  init_decode_named_character_reference();
31462
31949
  init_unist_util_stringify_position();
31463
- own8 = {}.hasOwnProperty;
31950
+ own9 = {}.hasOwnProperty;
31464
31951
  });
31465
31952
 
31466
31953
  // ../../node_modules/mdast-util-from-markdown/dev/index.js
@@ -31621,25 +32108,25 @@ function toMatters(options) {
31621
32108
  function matter(option) {
31622
32109
  let result = option;
31623
32110
  if (typeof result === "string") {
31624
- if (!own9.call(markers, result)) {
32111
+ if (!own10.call(markers, result)) {
31625
32112
  throw fault("Missing matter definition for `%s`", result);
31626
32113
  }
31627
32114
  result = { type: result, marker: markers[result] };
31628
32115
  } else if (typeof result !== "object") {
31629
32116
  throw fault("Expected matter to be an object, not `%j`", result);
31630
32117
  }
31631
- if (!own9.call(result, "type")) {
32118
+ if (!own10.call(result, "type")) {
31632
32119
  throw fault("Missing `type` in matter `%j`", result);
31633
32120
  }
31634
- if (!own9.call(result, "fence") && !own9.call(result, "marker")) {
32121
+ if (!own10.call(result, "fence") && !own10.call(result, "marker")) {
31635
32122
  throw fault("Missing `marker` or `fence` in matter `%j`", result);
31636
32123
  }
31637
32124
  return result;
31638
32125
  }
31639
- var own9, markers;
32126
+ var own10, markers;
31640
32127
  var init_to_matters = __esm(() => {
31641
32128
  init_fault();
31642
- own9 = {}.hasOwnProperty;
32129
+ own10 = {}.hasOwnProperty;
31643
32130
  markers = { yaml: "-", toml: "+" };
31644
32131
  });
31645
32132
 
@@ -39288,6 +39775,148 @@ var require_dist2 = __commonJS(function(exports, module) {
39288
39775
  module.exports = plugin;
39289
39776
  });
39290
39777
 
39778
+ // src/alerts.ts
39779
+ function normalizeAlerts(config, where = "alerts") {
39780
+ if (config === false) {
39781
+ return null;
39782
+ }
39783
+ const types = new Map(Object.keys(DEFAULT_ALERT_TITLES).map((type) => [type, null]));
39784
+ const disabled = new Set;
39785
+ if (config === undefined || config === true) {
39786
+ return { disabled, types };
39787
+ }
39788
+ if (typeof config !== "object" || config === null || Array.isArray(config)) {
39789
+ throw new TypeError(`${where}: expected an object mapping alert types to element names, or false`);
39790
+ }
39791
+ for (const [type, element] of Object.entries(config)) {
39792
+ const key = type.toLowerCase();
39793
+ if (!/^[a-z][\w-]*$/.test(key)) {
39794
+ throw new TypeError(`${where}: "${type}" is not a valid alert type name`);
39795
+ }
39796
+ if (element === false || element === null) {
39797
+ types.delete(key);
39798
+ disabled.add(key);
39799
+ } else if (element === true) {
39800
+ types.set(key, null);
39801
+ } else if (typeof element === "string" && TAG_NAME.test(element)) {
39802
+ types.set(key, element);
39803
+ } else {
39804
+ throw new TypeError(`${where}.${type}: expected an element name such as "doc-note", true or false, got ${JSON.stringify(element)}`);
39805
+ }
39806
+ }
39807
+ return { disabled, types };
39808
+ }
39809
+ function inlineText(nodes) {
39810
+ let out = "";
39811
+ for (const node of nodes) {
39812
+ if (typeof node.value === "string") {
39813
+ out += node.value;
39814
+ } else if (node.children) {
39815
+ out += inlineText(node.children);
39816
+ }
39817
+ }
39818
+ return out;
39819
+ }
39820
+ function textNode(value) {
39821
+ return { type: "text", value };
39822
+ }
39823
+ function markerOf(paragraph) {
39824
+ const [first] = paragraph.children ?? [];
39825
+ if (first?.type !== "text" || typeof first.value !== "string") {
39826
+ return null;
39827
+ }
39828
+ const match = MARKER2.exec(first.value);
39829
+ if (!match) {
39830
+ return null;
39831
+ }
39832
+ const rest = first.value.slice(match[0].length);
39833
+ if (rest !== "" && !/^[ \t\r\n]/.test(rest)) {
39834
+ return null;
39835
+ }
39836
+ return { rest, type: match[1].toLowerCase() };
39837
+ }
39838
+ function splitMarker(paragraph, settings) {
39839
+ const marker = markerOf(paragraph);
39840
+ if (!marker || !settings.types.has(marker.type)) {
39841
+ return null;
39842
+ }
39843
+ const { type, rest } = marker;
39844
+ const [, ...siblings] = paragraph.children ?? [];
39845
+ const title = [];
39846
+ const body = [];
39847
+ let inTitle = true;
39848
+ const take = (node) => {
39849
+ if (inTitle && node.type === "break") {
39850
+ inTitle = false;
39851
+ } else if (inTitle && node.type === "text" && typeof node.value === "string") {
39852
+ const lineEnd = LINE_END.exec(node.value);
39853
+ if (lineEnd === null) {
39854
+ title.push(node);
39855
+ } else {
39856
+ title.push(textNode(node.value.slice(0, lineEnd.index)));
39857
+ inTitle = false;
39858
+ body.push(textNode(node.value.slice(lineEnd.index + lineEnd[0].length)));
39859
+ }
39860
+ } else {
39861
+ (inTitle ? title : body).push(node);
39862
+ }
39863
+ };
39864
+ take(textNode(rest.replace(/^[ \t]+/, "")));
39865
+ for (const node of siblings) {
39866
+ take(node);
39867
+ }
39868
+ const trimmed = title.filter((node) => !(node.type === "text" && node.value === ""));
39869
+ const text = inlineText(trimmed);
39870
+ return {
39871
+ body: body.filter((node) => !(node.type === "text" && node.value === "")),
39872
+ title: text.trim() === "" ? [] : trimmed,
39873
+ type
39874
+ };
39875
+ }
39876
+ function transformAlerts(tree, settings, onUnknown) {
39877
+ const { children } = tree;
39878
+ if (!children) {
39879
+ return;
39880
+ }
39881
+ for (const [i, child] of children.entries()) {
39882
+ if (child.type === "blockquote") {
39883
+ const [paragraph, ...rest] = child.children ?? [];
39884
+ const split = paragraph?.type === "paragraph" ? splitMarker(paragraph, settings) : null;
39885
+ if (split) {
39886
+ const bodyParagraph = split.body.length > 0 && inlineText(split.body).trim() !== "" ? [{ children: split.body, type: "paragraph" }] : [];
39887
+ const alert = {
39888
+ alert: split.type,
39889
+ children: [...bodyParagraph, ...rest],
39890
+ element: settings.types.get(split.type) ?? null,
39891
+ titleNodes: split.title.length > 0 ? split.title : null,
39892
+ type: ALERT_NODE
39893
+ };
39894
+ children[i] = alert;
39895
+ transformAlerts(alert, settings, onUnknown);
39896
+ continue;
39897
+ }
39898
+ const unknown = paragraph?.type === "paragraph" ? markerOf(paragraph) : null;
39899
+ if (unknown && !settings.disabled.has(unknown.type)) {
39900
+ onUnknown?.(unknown.type);
39901
+ }
39902
+ }
39903
+ transformAlerts(child, settings, onUnknown);
39904
+ }
39905
+ }
39906
+ var DEFAULT_ALERT_TITLES, ALERT_NODE = "jxAlert", TAG_NAME, MARKER2, LINE_END;
39907
+ var init_alerts = __esm(() => {
39908
+ DEFAULT_ALERT_TITLES = {
39909
+ caution: "Caution",
39910
+ important: "Important",
39911
+ note: "Note",
39912
+ tip: "Tip",
39913
+ warning: "Warning"
39914
+ };
39915
+ TAG_NAME = /^[A-Za-z][\w.-]*$/;
39916
+ MARKER2 = /^\[!([A-Za-z][\w-]*)\][+-]?/;
39917
+ LINE_END = /\r?\n/;
39918
+ });
39919
+
39291
39920
  // src/transpile.ts
39292
39921
  function jxKey(key) {
39293
39922
  if (JX_DOLLAR_KEYS.has(key)) {
@@ -39360,6 +39989,9 @@ function mdastNodeToJx(node) {
39360
39989
  if (node.type === "containerDirective" || node.type === "leafDirective" || node.type === "textDirective") {
39361
39990
  return directiveToJx(node);
39362
39991
  }
39992
+ if (node.type === ALERT_NODE) {
39993
+ return alertToJx(node);
39994
+ }
39363
39995
  if (node.type === "text") {
39364
39996
  return node.value ?? null;
39365
39997
  }
@@ -39472,6 +40104,37 @@ function mdastNodeToJx(node) {
39472
40104
  }
39473
40105
  return el;
39474
40106
  }
40107
+ function alertToJx(node) {
40108
+ const body = convertChildren(node.children ?? []);
40109
+ if (node.element) {
40110
+ const attributes = { "data-alert": node.alert };
40111
+ if (node.titleNodes) {
40112
+ attributes["data-title"] = inlineText(node.titleNodes).trim();
40113
+ }
40114
+ const el = { attributes, tagName: node.element };
40115
+ if (body.length > 0) {
40116
+ el.children = body;
40117
+ }
40118
+ return el;
40119
+ }
40120
+ const title = { className: "jx-alert-title", tagName: "p" };
40121
+ if (node.titleNodes) {
40122
+ const inline = convertChildren(node.titleNodes);
40123
+ if (inline.length === 1 && typeof inline[0] === "string") {
40124
+ [title.textContent] = inline;
40125
+ } else {
40126
+ title.children = inline;
40127
+ }
40128
+ } else {
40129
+ title.textContent = DEFAULT_ALERT_TITLES[node.alert] ?? `${node.alert.charAt(0).toUpperCase()}${node.alert.slice(1)}`;
40130
+ }
40131
+ return {
40132
+ attributes: { "data-alert": node.alert, role: "note" },
40133
+ children: [title, ...body],
40134
+ className: `jx-alert jx-alert-${node.alert}`,
40135
+ tagName: "div"
40136
+ };
40137
+ }
39475
40138
  function directiveToJx(node) {
39476
40139
  if (PROTOTYPE_DIRECTIVE_NAMES.has(node.name)) {
39477
40140
  return prototypeDirectiveToJx(node);
@@ -39665,6 +40328,7 @@ var init_transpile = __esm(() => {
39665
40328
  init_remark_gfm();
39666
40329
  init_remark_directive();
39667
40330
  init_html_to_jx();
40331
+ init_alerts();
39668
40332
  init_html_to_jx();
39669
40333
  import_remark_parse_frontmatter = __toESM(require_dist2(), 1);
39670
40334
  JX_DOLLAR_KEYS = new Set(["prototype", "ref", "component", "props", "switch", "elements"]);