@jxsuite/parser 2.0.0 → 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.
@@ -4053,7 +4053,7 @@ var init_dev4 = __esm(() => {
4053
4053
 
4054
4054
  // ../../node_modules/micromark-factory-space/dev/index.js
4055
4055
  function factorySpace(effects, ok, type, max) {
4056
- const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
4056
+ const limit = max ? max - 1 : Infinity;
4057
4057
  let size = 0;
4058
4058
  return start;
4059
4059
  function start(code) {
@@ -4072,6 +4072,29 @@ function factorySpace(effects, ok, type, max) {
4072
4072
  return ok(code);
4073
4073
  }
4074
4074
  }
4075
+ function factorySpaceMinMax(effects, ok, nok, type, min, max) {
4076
+ let size = 0;
4077
+ return start;
4078
+ function start(code) {
4079
+ if (max > 0 && markdownSpace(code)) {
4080
+ effects.enter(type);
4081
+ return prefix(code);
4082
+ }
4083
+ return after(code);
4084
+ }
4085
+ function prefix(code) {
4086
+ if (markdownSpace(code) && size < max) {
4087
+ effects.consume(code);
4088
+ size++;
4089
+ return prefix;
4090
+ }
4091
+ effects.exit(type);
4092
+ return after(code);
4093
+ }
4094
+ function after(code) {
4095
+ return size >= min ? ok(code) : nok(code);
4096
+ }
4097
+ }
4075
4098
  var init_dev5 = __esm(() => {
4076
4099
  init_dev4();
4077
4100
  });
@@ -4133,6 +4156,65 @@ var init_content = __esm(() => {
4133
4156
  content = { tokenize: initializeContent };
4134
4157
  });
4135
4158
 
4159
+ // ../../node_modules/micromark-util-edit-map/dev/index.js
4160
+ class EditMap {
4161
+ constructor() {
4162
+ this.index = new Map;
4163
+ this.map = [];
4164
+ }
4165
+ add(index, remove, add) {
4166
+ addImplementation(this, index, remove, add, false);
4167
+ }
4168
+ addBefore(index, remove, add) {
4169
+ addImplementation(this, index, remove, add, true);
4170
+ }
4171
+ consume(events) {
4172
+ this.map.sort(function(a, b) {
4173
+ return a[0] - b[0];
4174
+ });
4175
+ if (this.map.length === 0) {
4176
+ return;
4177
+ }
4178
+ let index = this.map.length;
4179
+ const vecs = [];
4180
+ while (index > 0) {
4181
+ index -= 1;
4182
+ vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);
4183
+ events.length = this.map[index][0];
4184
+ }
4185
+ vecs.push(events.slice());
4186
+ events.length = 0;
4187
+ let slice = vecs.pop();
4188
+ while (slice) {
4189
+ for (const element of slice) {
4190
+ events.push(element);
4191
+ }
4192
+ slice = vecs.pop();
4193
+ }
4194
+ this.map.length = 0;
4195
+ this.index.clear();
4196
+ }
4197
+ }
4198
+ function addImplementation(editMap, at, remove, add, before) {
4199
+ if (remove === 0 && add.length === 0) {
4200
+ return;
4201
+ }
4202
+ const existing = editMap.index.get(at);
4203
+ if (existing) {
4204
+ existing[1] += remove;
4205
+ if (before) {
4206
+ add.push(...existing[2]);
4207
+ existing[2] = add;
4208
+ } else {
4209
+ existing[2].push(...add);
4210
+ }
4211
+ return;
4212
+ }
4213
+ const change = [at, remove, add];
4214
+ editMap.map.push(change);
4215
+ editMap.index.set(at, change);
4216
+ }
4217
+
4136
4218
  // ../../node_modules/micromark/dev/lib/initialize/document.js
4137
4219
  function initializeDocument(effects) {
4138
4220
  const self2 = this;
@@ -4175,8 +4257,10 @@ function initializeDocument(effects) {
4175
4257
  self2.events[index][1].end = { ...point };
4176
4258
  index++;
4177
4259
  }
4178
- splice(self2.events, indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
4179
- self2.events.length = index;
4260
+ const editMap = new EditMap;
4261
+ editMap.add(indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
4262
+ editMap.add(indexBeforeExits, index - indexBeforeExits, []);
4263
+ editMap.consume(self2.events);
4180
4264
  return checkNewContainers(code);
4181
4265
  }
4182
4266
  return start(code);
@@ -4195,8 +4279,9 @@ function initializeDocument(effects) {
4195
4279
  return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code);
4196
4280
  }
4197
4281
  function thereIsANewContainer(code) {
4198
- if (childFlow)
4282
+ if (childFlow) {
4199
4283
  closeFlow();
4284
+ }
4200
4285
  exitContainers(continued);
4201
4286
  return documentContinued(code);
4202
4287
  }
@@ -4218,8 +4303,9 @@ function initializeDocument(effects) {
4218
4303
  }
4219
4304
  function flowStart(code) {
4220
4305
  if (code === codes.eof) {
4221
- if (childFlow)
4306
+ if (childFlow) {
4222
4307
  closeFlow();
4308
+ }
4223
4309
  exitContainers(0);
4224
4310
  effects.consume(code);
4225
4311
  return;
@@ -4252,11 +4338,13 @@ function initializeDocument(effects) {
4252
4338
  function writeToChild(token, endOfFile) {
4253
4339
  ok(childFlow, "expected `childFlow` to be defined when continuing");
4254
4340
  const stream = self2.sliceStream(token);
4255
- if (endOfFile)
4341
+ if (endOfFile) {
4256
4342
  stream.push(null);
4343
+ }
4257
4344
  token.previous = childToken;
4258
- if (childToken)
4345
+ if (childToken) {
4259
4346
  childToken.next = token;
4347
+ }
4260
4348
  childToken = token;
4261
4349
  childFlow.defineSkip(token.start);
4262
4350
  childFlow.write(stream);
@@ -4287,8 +4375,10 @@ function initializeDocument(effects) {
4287
4375
  self2.events[index][1].end = { ...point };
4288
4376
  index++;
4289
4377
  }
4290
- splice(self2.events, indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
4291
- self2.events.length = index;
4378
+ const editMap = new EditMap;
4379
+ editMap.add(indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
4380
+ editMap.add(indexBeforeExits, index - indexBeforeExits, []);
4381
+ editMap.consume(self2.events);
4292
4382
  }
4293
4383
  }
4294
4384
  function exitContainers(size) {
@@ -4319,7 +4409,6 @@ var init_document = __esm(() => {
4319
4409
  init_development();
4320
4410
  init_dev5();
4321
4411
  init_dev4();
4322
- init_dev();
4323
4412
  init_default();
4324
4413
  document2 = { tokenize: initializeDocument };
4325
4414
  containerConstruct = { tokenize: tokenizeContainer };
@@ -4356,43 +4445,36 @@ function resolveAll(constructs, events, context) {
4356
4445
  // ../../node_modules/micromark-core-commonmark/dev/lib/attention.js
4357
4446
  function resolveAllAttention(events, context) {
4358
4447
  let index = -1;
4359
- let open;
4360
- let group;
4361
- let text;
4362
- let openingSequence;
4363
- let closingSequence;
4364
- let use;
4365
4448
  let nextEvents;
4366
- let offset;
4367
4449
  while (++index < events.length) {
4368
4450
  if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
4369
- open = index;
4451
+ let open = index;
4370
4452
  while (open--) {
4371
4453
  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)) {
4372
4454
  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)) {
4373
4455
  continue;
4374
4456
  }
4375
- 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;
4457
+ 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;
4376
4458
  const start = { ...events[open][1].end };
4377
4459
  const end = { ...events[index][1].start };
4378
4460
  movePoint(start, -use);
4379
4461
  movePoint(end, use);
4380
- openingSequence = {
4462
+ const openingSequence = {
4381
4463
  type: use > 1 ? types.strongSequence : types.emphasisSequence,
4382
4464
  start,
4383
4465
  end: { ...events[open][1].end }
4384
4466
  };
4385
- closingSequence = {
4467
+ const closingSequence = {
4386
4468
  type: use > 1 ? types.strongSequence : types.emphasisSequence,
4387
4469
  start: { ...events[index][1].start },
4388
4470
  end
4389
4471
  };
4390
- text = {
4472
+ const text = {
4391
4473
  type: use > 1 ? types.strongText : types.emphasisText,
4392
4474
  start: { ...events[open][1].end },
4393
4475
  end: { ...events[index][1].start }
4394
4476
  };
4395
- group = {
4477
+ const group = {
4396
4478
  type: use > 1 ? types.strong : types.emphasis,
4397
4479
  start: { ...openingSequence.start },
4398
4480
  end: { ...closingSequence.end }
@@ -4420,14 +4502,13 @@ function resolveAllAttention(events, context) {
4420
4502
  ["exit", closingSequence, context],
4421
4503
  ["exit", group, context]
4422
4504
  ]);
4505
+ let offset = 0;
4423
4506
  if (events[index][1].end.offset - events[index][1].start.offset) {
4424
4507
  offset = 2;
4425
4508
  nextEvents = push(nextEvents, [
4426
4509
  ["enter", events[index][1], context],
4427
4510
  ["exit", events[index][1], context]
4428
4511
  ]);
4429
- } else {
4430
- offset = 0;
4431
4512
  }
4432
4513
  splice(events, open - 1, index - open + 3, nextEvents);
4433
4514
  index = open + nextEvents.length - offset - 2;
@@ -4464,8 +4545,8 @@ function tokenizeAttention(effects, ok2) {
4464
4545
  const token = effects.exit("attentionSequence");
4465
4546
  const after = classifyCharacter(code);
4466
4547
  ok(attentionMarkers, "expected `attentionMarkers` to be populated");
4467
- const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers.includes(code);
4468
- const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers.includes(previous);
4548
+ const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers.includes(code) && code !== codes.asterisk && code !== codes.underscore;
4549
+ const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers.includes(previous) && previous !== codes.asterisk && previous !== codes.underscore;
4469
4550
  token._open = Boolean(marker === codes.asterisk ? open : open && (before || !close));
4470
4551
  token._close = Boolean(marker === codes.asterisk ? close : close && (after || !open));
4471
4552
  return ok2(code);
@@ -4781,6 +4862,35 @@ var init_character_reference = __esm(() => {
4781
4862
  };
4782
4863
  });
4783
4864
 
4865
+ // ../../node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js
4866
+ function tokenizeNonLazyContinuation(effects, ok2, nok) {
4867
+ const self2 = this;
4868
+ return start;
4869
+ function start(code) {
4870
+ if (code === codes.eof) {
4871
+ return nok(code);
4872
+ }
4873
+ ok(markdownLineEnding(code), "expected eol");
4874
+ effects.enter(types.lineEnding);
4875
+ effects.consume(code);
4876
+ effects.exit(types.lineEnding);
4877
+ return after;
4878
+ }
4879
+ function after(code) {
4880
+ return self2.parser.lazy[self2.now().line] ? nok(code) : ok2(code);
4881
+ }
4882
+ }
4883
+ var nonLazyContinuation;
4884
+ var init_partial_non_lazy_continuation = __esm(() => {
4885
+ init_development();
4886
+ init_dev4();
4887
+ init_default();
4888
+ nonLazyContinuation = {
4889
+ partial: true,
4890
+ tokenize: tokenizeNonLazyContinuation
4891
+ };
4892
+ });
4893
+
4784
4894
  // ../../node_modules/micromark-core-commonmark/dev/lib/code-fenced.js
4785
4895
  function tokenizeCodeFenced(effects, ok2, nok) {
4786
4896
  const self2 = this;
@@ -4936,33 +5046,13 @@ function tokenizeCodeFenced(effects, ok2, nok) {
4936
5046
  }
4937
5047
  }
4938
5048
  }
4939
- function tokenizeNonLazyContinuation(effects, ok2, nok) {
4940
- const self2 = this;
4941
- return start;
4942
- function start(code) {
4943
- if (code === codes.eof) {
4944
- return nok(code);
4945
- }
4946
- ok(markdownLineEnding(code), "expected eol");
4947
- effects.enter(types.lineEnding);
4948
- effects.consume(code);
4949
- effects.exit(types.lineEnding);
4950
- return lineStart;
4951
- }
4952
- function lineStart(code) {
4953
- return self2.parser.lazy[self2.now().line] ? nok(code) : ok2(code);
4954
- }
4955
- }
4956
- var nonLazyContinuation, codeFenced;
5049
+ var codeFenced;
4957
5050
  var init_code_fenced = __esm(() => {
4958
5051
  init_development();
4959
5052
  init_dev5();
4960
5053
  init_dev4();
4961
5054
  init_default();
4962
- nonLazyContinuation = {
4963
- partial: true,
4964
- tokenize: tokenizeNonLazyContinuation
4965
- };
5055
+ init_partial_non_lazy_continuation();
4966
5056
  codeFenced = {
4967
5057
  concrete: true,
4968
5058
  name: "codeFenced",
@@ -4972,16 +5062,11 @@ var init_code_fenced = __esm(() => {
4972
5062
 
4973
5063
  // ../../node_modules/micromark-core-commonmark/dev/lib/code-indented.js
4974
5064
  function tokenizeCodeIndented(effects, ok2, nok) {
4975
- const self2 = this;
4976
5065
  return start;
4977
5066
  function start(code) {
4978
5067
  ok(markdownSpace(code));
4979
5068
  effects.enter(types.codeIndented);
4980
- return factorySpace(effects, afterPrefix, types.linePrefix, constants.tabSize + 1)(code);
4981
- }
4982
- function afterPrefix(code) {
4983
- const tail = self2.events[self2.events.length - 1];
4984
- return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? atBreak(code) : nok(code);
5069
+ return factorySpaceMinMax(effects, atBreak, nok, types.linePrefix, constants.tabSize, constants.tabSize)(code);
4985
5070
  }
4986
5071
  function atBreak(code) {
4987
5072
  if (code === codes.eof) {
@@ -5019,11 +5104,10 @@ function tokenizeFurtherStart(effects, ok, nok) {
5019
5104
  effects.exit(types.lineEnding);
5020
5105
  return furtherStart;
5021
5106
  }
5022
- return factorySpace(effects, afterPrefix, types.linePrefix, constants.tabSize + 1)(code);
5107
+ return factorySpaceMinMax(effects, ok, onNotEnoughPrefix, types.linePrefix, constants.tabSize, constants.tabSize)(code);
5023
5108
  }
5024
- function afterPrefix(code) {
5025
- const tail = self2.events[self2.events.length - 1];
5026
- return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code);
5109
+ function onNotEnoughPrefix(code) {
5110
+ return markdownLineEnding(code) ? furtherStart(code) : nok(code);
5027
5111
  }
5028
5112
  }
5029
5113
  var codeIndented, furtherStart;
@@ -5833,8 +5917,6 @@ var init_hard_break_escape = __esm(() => {
5833
5917
  function resolveHeadingAtx(events, context) {
5834
5918
  let contentEnd = events.length - 2;
5835
5919
  let contentStart = 3;
5836
- let content;
5837
- let text;
5838
5920
  if (events[contentStart][1].type === types.whitespace) {
5839
5921
  contentStart += 2;
5840
5922
  }
@@ -5845,12 +5927,12 @@ function resolveHeadingAtx(events, context) {
5845
5927
  contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
5846
5928
  }
5847
5929
  if (contentEnd > contentStart) {
5848
- content = {
5930
+ const content = {
5849
5931
  type: types.atxHeadingText,
5850
5932
  start: events[contentStart][1].start,
5851
5933
  end: events[contentEnd][1].end
5852
5934
  };
5853
- text = {
5935
+ const text = {
5854
5936
  type: types.chunkText,
5855
5937
  start: events[contentStart][1].start,
5856
5938
  end: events[contentEnd][1].end,
@@ -6269,7 +6351,7 @@ function tokenizeHtmlFlow(effects, ok2, nok) {
6269
6351
  return continuation;
6270
6352
  }
6271
6353
  function continuationStart(code) {
6272
- return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
6354
+ return effects.check(nonLazyContinuation, continuationStartNonLazy, continuationAfter)(code);
6273
6355
  }
6274
6356
  function continuationStartNonLazy(code) {
6275
6357
  ok(markdownLineEnding(code));
@@ -6348,22 +6430,6 @@ function tokenizeHtmlFlow(effects, ok2, nok) {
6348
6430
  return ok2(code);
6349
6431
  }
6350
6432
  }
6351
- function tokenizeNonLazyContinuationStart(effects, ok, nok) {
6352
- const self2 = this;
6353
- return start;
6354
- function start(code) {
6355
- if (markdownLineEnding(code)) {
6356
- effects.enter(types.lineEnding);
6357
- effects.consume(code);
6358
- effects.exit(types.lineEnding);
6359
- return after;
6360
- }
6361
- return nok(code);
6362
- }
6363
- function after(code) {
6364
- return self2.parser.lazy[self2.now().line] ? nok(code) : ok(code);
6365
- }
6366
- }
6367
6433
  function tokenizeBlankLineBefore(effects, ok2, nok) {
6368
6434
  return start;
6369
6435
  function start(code) {
@@ -6374,13 +6440,14 @@ function tokenizeBlankLineBefore(effects, ok2, nok) {
6374
6440
  return effects.attempt(blankLine, ok2, nok);
6375
6441
  }
6376
6442
  }
6377
- var htmlFlow, blankLineBefore, nonLazyContinuationStart;
6443
+ var htmlFlow, blankLineBefore;
6378
6444
  var init_html_flow = __esm(() => {
6379
6445
  init_development();
6380
6446
  init_dev4();
6381
6447
  init_micromark_util_html_tag_name();
6382
6448
  init_default();
6383
6449
  init_blank_line();
6450
+ init_partial_non_lazy_continuation();
6384
6451
  htmlFlow = {
6385
6452
  concrete: true,
6386
6453
  name: "htmlFlow",
@@ -6388,10 +6455,6 @@ var init_html_flow = __esm(() => {
6388
6455
  tokenize: tokenizeHtmlFlow
6389
6456
  };
6390
6457
  blankLineBefore = { partial: true, tokenize: tokenizeBlankLineBefore };
6391
- nonLazyContinuationStart = {
6392
- partial: true,
6393
- tokenize: tokenizeNonLazyContinuationStart
6394
- };
6395
6458
  });
6396
6459
 
6397
6460
  // ../../node_modules/micromark-core-commonmark/dev/lib/html-text.js
@@ -6729,12 +6792,11 @@ function resolveAllLabelEnd(events) {
6729
6792
  function resolveToLabelEnd(events, context) {
6730
6793
  let index = events.length;
6731
6794
  let offset = 0;
6732
- let token;
6733
6795
  let open;
6734
6796
  let close;
6735
6797
  let media;
6736
6798
  while (index--) {
6737
- token = events[index][1];
6799
+ const token = events[index][1];
6738
6800
  if (open) {
6739
6801
  if (token.type === types.link || token.type === types.labelLink && token._inactive) {
6740
6802
  break;
@@ -6792,14 +6854,14 @@ function resolveToLabelEnd(events, context) {
6792
6854
  }
6793
6855
  function tokenizeLabelEnd(effects, ok2, nok) {
6794
6856
  const self2 = this;
6795
- let index = self2.events.length;
6857
+ const labelStarts = self2._labelStarts;
6796
6858
  let labelStart;
6797
6859
  let defined;
6798
- while (index--) {
6799
- if ((self2.events[index][1].type === types.labelImage || self2.events[index][1].type === types.labelLink) && !self2.events[index][1]._balanced) {
6800
- labelStart = self2.events[index][1];
6801
- break;
6860
+ if (labelStarts) {
6861
+ while (labelStarts.length > 0 && labelStarts[labelStarts.length - 1]._balanced) {
6862
+ labelStarts.pop();
6802
6863
  }
6864
+ labelStart = labelStarts[labelStarts.length - 1];
6803
6865
  }
6804
6866
  return start;
6805
6867
  function start(code) {
@@ -6831,6 +6893,8 @@ function tokenizeLabelEnd(effects, ok2, nok) {
6831
6893
  return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);
6832
6894
  }
6833
6895
  function labelEndOk(code) {
6896
+ ok(labelStarts, "expected `labelStarts` to be populated");
6897
+ labelStarts.pop();
6834
6898
  return ok2(code);
6835
6899
  }
6836
6900
  function labelEndNok(code) {
@@ -6943,6 +7007,7 @@ var init_label_end = __esm(() => {
6943
7007
  // ../../node_modules/micromark-core-commonmark/dev/lib/label-start-image.js
6944
7008
  function tokenizeLabelStartImage(effects, ok2, nok) {
6945
7009
  const self2 = this;
7010
+ let labelImage;
6946
7011
  return start;
6947
7012
  function start(code) {
6948
7013
  ok(code === codes.exclamationMark, "expected `!`");
@@ -6957,13 +7022,18 @@ function tokenizeLabelStartImage(effects, ok2, nok) {
6957
7022
  effects.enter(types.labelMarker);
6958
7023
  effects.consume(code);
6959
7024
  effects.exit(types.labelMarker);
6960
- effects.exit(types.labelImage);
7025
+ labelImage = effects.exit(types.labelImage);
6961
7026
  return after;
6962
7027
  }
6963
7028
  return nok(code);
6964
7029
  }
6965
7030
  function after(code) {
6966
- return code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code) : ok2(code);
7031
+ if (code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs) {
7032
+ return nok(code);
7033
+ }
7034
+ self2._labelStarts = self2._labelStarts || [];
7035
+ self2._labelStarts.push(labelImage);
7036
+ return ok2(code);
6967
7037
  }
6968
7038
  }
6969
7039
  var labelStartImage;
@@ -6981,6 +7051,7 @@ var init_label_start_image = __esm(() => {
6981
7051
  // ../../node_modules/micromark-core-commonmark/dev/lib/label-start-link.js
6982
7052
  function tokenizeLabelStartLink(effects, ok2, nok) {
6983
7053
  const self2 = this;
7054
+ let labelLink;
6984
7055
  return start;
6985
7056
  function start(code) {
6986
7057
  ok(code === codes.leftSquareBracket, "expected `[`");
@@ -6988,11 +7059,16 @@ function tokenizeLabelStartLink(effects, ok2, nok) {
6988
7059
  effects.enter(types.labelMarker);
6989
7060
  effects.consume(code);
6990
7061
  effects.exit(types.labelMarker);
6991
- effects.exit(types.labelLink);
7062
+ labelLink = effects.exit(types.labelLink);
6992
7063
  return after;
6993
7064
  }
6994
7065
  function after(code) {
6995
- return code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code) : ok2(code);
7066
+ if (code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs) {
7067
+ return nok(code);
7068
+ }
7069
+ self2._labelStarts = self2._labelStarts || [];
7070
+ self2._labelStarts.push(labelLink);
7071
+ return ok2(code);
6996
7072
  }
6997
7073
  }
6998
7074
  var labelStartLink;
@@ -7221,6 +7297,7 @@ var init_list = __esm(() => {
7221
7297
 
7222
7298
  // ../../node_modules/micromark-core-commonmark/dev/lib/setext-underline.js
7223
7299
  function resolveToSetextUnderline(events, context) {
7300
+ const editMap = new EditMap;
7224
7301
  let index = events.length;
7225
7302
  let content;
7226
7303
  let text;
@@ -7236,7 +7313,7 @@ function resolveToSetextUnderline(events, context) {
7236
7313
  }
7237
7314
  } else {
7238
7315
  if (events[index][1].type === types.content) {
7239
- events.splice(index, 1);
7316
+ editMap.add(index, 1, []);
7240
7317
  }
7241
7318
  if (!definition && events[index][1].type === types.definition) {
7242
7319
  definition = index;
@@ -7254,13 +7331,14 @@ function resolveToSetextUnderline(events, context) {
7254
7331
  };
7255
7332
  events[text][1].type = types.setextHeadingText;
7256
7333
  if (definition) {
7257
- events.splice(text, 0, ["enter", heading, context]);
7258
- events.splice(definition + 1, 0, ["exit", events[content][1], context]);
7334
+ editMap.add(text, 0, [["enter", heading, context]]);
7335
+ editMap.add(definition + 1, 0, [["exit", events[content][1], context]]);
7259
7336
  events[content][1].end = { ...events[definition][1].end };
7260
7337
  } else {
7261
7338
  events[content][1] = heading;
7262
7339
  }
7263
- events.push(["exit", heading, context]);
7340
+ editMap.add(events.length, 0, [["exit", heading, context]]);
7341
+ editMap.consume(events);
7264
7342
  return events;
7265
7343
  }
7266
7344
  function tokenizeSetextUnderline(effects, ok2, nok) {
@@ -7457,6 +7535,7 @@ function createResolver(extraResolver) {
7457
7535
  }
7458
7536
  }
7459
7537
  function resolveAllLineSuffixes(events, context) {
7538
+ const editMap = new EditMap;
7460
7539
  let eventIndex = 0;
7461
7540
  while (++eventIndex <= events.length) {
7462
7541
  if ((eventIndex === events.length || events[eventIndex][1].type === types.lineEnding) && events[eventIndex - 1][1].type === types.data) {
@@ -7474,8 +7553,9 @@ function resolveAllLineSuffixes(events, context) {
7474
7553
  size++;
7475
7554
  bufferIndex--;
7476
7555
  }
7477
- if (bufferIndex)
7556
+ if (bufferIndex) {
7478
7557
  break;
7558
+ }
7479
7559
  bufferIndex = -1;
7480
7560
  } else if (chunk === codes.horizontalTab) {
7481
7561
  tabs = true;
@@ -7504,13 +7584,16 @@ function resolveAllLineSuffixes(events, context) {
7504
7584
  if (data.start.offset === data.end.offset) {
7505
7585
  Object.assign(data, token);
7506
7586
  } else {
7507
- events.splice(eventIndex, 0, ["enter", token, context], ["exit", token, context]);
7508
- eventIndex += 2;
7587
+ editMap.add(eventIndex, 0, [
7588
+ ["enter", token, context],
7589
+ ["exit", token, context]
7590
+ ]);
7509
7591
  }
7510
7592
  }
7511
7593
  eventIndex++;
7512
7594
  }
7513
7595
  }
7596
+ editMap.consume(events);
7514
7597
  return events;
7515
7598
  }
7516
7599
  var resolver, string, text;
@@ -8397,11 +8480,10 @@ function createTokenizer(parser, initialize, from) {
8397
8480
  debug("position: define skip: `%j`", point);
8398
8481
  }
8399
8482
  function main() {
8400
- let chunkIndex;
8401
8483
  while (point._index < chunks.length) {
8402
8484
  const chunk = chunks[point._index];
8403
8485
  if (typeof chunk === "string") {
8404
- chunkIndex = point._index;
8486
+ const chunkIndex = point._index;
8405
8487
  if (point._bufferIndex < 0) {
8406
8488
  point._bufferIndex = 0;
8407
8489
  }
@@ -8610,7 +8692,7 @@ function serializeChunks(chunks, expandTabs) {
8610
8692
  let value;
8611
8693
  if (typeof chunk === "string") {
8612
8694
  value = chunk;
8613
- } else
8695
+ } else {
8614
8696
  switch (chunk) {
8615
8697
  case codes.carriageReturn: {
8616
8698
  value = values.cr;
@@ -8629,8 +8711,9 @@ function serializeChunks(chunks, expandTabs) {
8629
8711
  break;
8630
8712
  }
8631
8713
  case codes.virtualSpace: {
8632
- if (!expandTabs && atTab)
8714
+ if (!expandTabs && atTab) {
8633
8715
  continue;
8716
+ }
8634
8717
  value = values.space;
8635
8718
  break;
8636
8719
  }
@@ -8639,6 +8722,7 @@ function serializeChunks(chunks, expandTabs) {
8639
8722
  value = String.fromCharCode(chunk);
8640
8723
  }
8641
8724
  }
8725
+ }
8642
8726
  atTab = chunk === codes.horizontalTab;
8643
8727
  result.push(value);
8644
8728
  }
@@ -8703,14 +8787,9 @@ function preprocess() {
8703
8787
  let atCarriageReturn;
8704
8788
  return preprocessor;
8705
8789
  function preprocessor(value, encoding, end) {
8706
- const chunks = [];
8707
- let match;
8708
- let next;
8709
- let startPosition;
8710
- let endPosition;
8711
- let code;
8712
8790
  value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || undefined).decode(value));
8713
- startPosition = 0;
8791
+ const chunks = [];
8792
+ let startPosition = 0;
8714
8793
  buffer = "";
8715
8794
  if (start) {
8716
8795
  if (value.charCodeAt(0) === codes.byteOrderMarker) {
@@ -8720,9 +8799,9 @@ function preprocess() {
8720
8799
  }
8721
8800
  while (startPosition < value.length) {
8722
8801
  search.lastIndex = startPosition;
8723
- match = search.exec(value);
8724
- endPosition = match && match.index !== undefined ? match.index : value.length;
8725
- code = value.charCodeAt(endPosition);
8802
+ const match = search.exec(value);
8803
+ const endPosition = match && match.index !== undefined ? match.index : value.length;
8804
+ const code = value.charCodeAt(endPosition);
8726
8805
  if (!match) {
8727
8806
  buffer = value.slice(startPosition);
8728
8807
  break;
@@ -8746,10 +8825,11 @@ function preprocess() {
8746
8825
  break;
8747
8826
  }
8748
8827
  case codes.ht: {
8749
- next = Math.ceil(column / constants.tabSize) * constants.tabSize;
8828
+ const next = Math.ceil(column / constants.tabSize) * constants.tabSize;
8750
8829
  chunks.push(codes.horizontalTab);
8751
- while (column++ < next)
8830
+ while (column++ < next) {
8752
8831
  chunks.push(codes.virtualSpace);
8832
+ }
8753
8833
  break;
8754
8834
  }
8755
8835
  case codes.lf: {
@@ -8766,10 +8846,12 @@ function preprocess() {
8766
8846
  startPosition = endPosition + 1;
8767
8847
  }
8768
8848
  if (end) {
8769
- if (atCarriageReturn)
8849
+ if (atCarriageReturn) {
8770
8850
  chunks.push(codes.carriageReturn);
8771
- if (buffer)
8851
+ }
8852
+ if (buffer) {
8772
8853
  chunks.push(buffer);
8854
+ }
8773
8855
  chunks.push(codes.eof);
8774
8856
  }
8775
8857
  return chunks;
@@ -8822,6 +8904,8 @@ function fromMarkdown(value, encoding, options) {
8822
8904
  }
8823
8905
  function compiler(options) {
8824
8906
  const config = {
8907
+ afterExit: [],
8908
+ beforeEnter: [],
8825
8909
  transforms: [],
8826
8910
  canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
8827
8911
  enter: {
@@ -8923,7 +9007,7 @@ function compiler(options) {
8923
9007
  const data = {};
8924
9008
  return compile;
8925
9009
  function compile(events) {
8926
- let tree = { type: "root", children: [] };
9010
+ let tree = { type: "root", children: [], position: undefined };
8927
9011
  const context = {
8928
9012
  stack: [tree],
8929
9013
  tokenStack: [],
@@ -8935,23 +9019,32 @@ function compiler(options) {
8935
9019
  data
8936
9020
  };
8937
9021
  const listStack = [];
9022
+ const prepared = [];
8938
9023
  let index = -1;
8939
9024
  while (++index < events.length) {
9025
+ prepared.push(events[index]);
8940
9026
  if (events[index][1].type === types.listOrdered || events[index][1].type === types.listUnordered) {
8941
9027
  if (events[index][0] === "enter") {
8942
- listStack.push(index);
9028
+ listStack.push(prepared.length - 1);
8943
9029
  } else {
8944
9030
  const tail = listStack.pop();
8945
9031
  ok(typeof tail === "number", "expected list to be open");
8946
- index = prepareList(events, tail, index);
9032
+ prepareList(prepared, tail);
8947
9033
  }
8948
9034
  }
8949
9035
  }
9036
+ events = prepared;
8950
9037
  index = -1;
8951
9038
  while (++index < events.length) {
8952
9039
  const handler = config[events[index][0]];
9040
+ if (events[index][0] === "enter" && config.beforeEnter.length > 0) {
9041
+ callListeners(config.beforeEnter, { ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
9042
+ }
8953
9043
  if (own3.call(handler, events[index][1].type)) {
8954
- handler[events[index][1].type].call(Object.assign({ sliceSerialize: events[index][2].sliceSerialize }, context), events[index][1]);
9044
+ handler[events[index][1].type].call({ ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
9045
+ }
9046
+ if (events[index][0] === "exit" && config.afterExit.length > 0) {
9047
+ callListeners(config.afterExit, { ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
8955
9048
  }
8956
9049
  }
8957
9050
  if (context.tokenStack.length > 0) {
@@ -8969,7 +9062,14 @@ function compiler(options) {
8969
9062
  }
8970
9063
  return tree;
8971
9064
  }
8972
- function prepareList(events, start, length) {
9065
+ function callListeners(listeners, context, token) {
9066
+ let index = -1;
9067
+ while (++index < listeners.length) {
9068
+ listeners[index].call(context, token);
9069
+ }
9070
+ }
9071
+ function prepareList(events, start) {
9072
+ const end = events.length - 1;
8973
9073
  let index = start - 1;
8974
9074
  let containerBalance = -1;
8975
9075
  let listSpread = false;
@@ -8977,7 +9077,8 @@ function compiler(options) {
8977
9077
  let lineIndex;
8978
9078
  let firstBlankLineIndex;
8979
9079
  let atMarker;
8980
- while (++index <= length) {
9080
+ const insertions = [];
9081
+ while (++index <= end) {
8981
9082
  const event = events[index];
8982
9083
  switch (event[1].type) {
8983
9084
  case types.listUnordered:
@@ -9034,9 +9135,10 @@ function compiler(options) {
9034
9135
  listItem._spread = true;
9035
9136
  }
9036
9137
  listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);
9037
- events.splice(lineIndex || index, 0, ["exit", listItem, event[2]]);
9038
- index++;
9039
- length++;
9138
+ insertions.push({
9139
+ at: lineIndex || index,
9140
+ event: ["exit", listItem, event[2]]
9141
+ });
9040
9142
  }
9041
9143
  if (event[1].type === types.listItemPrefix) {
9042
9144
  const item = {
@@ -9046,16 +9148,23 @@ function compiler(options) {
9046
9148
  end: undefined
9047
9149
  };
9048
9150
  listItem = item;
9049
- events.splice(index, 0, ["enter", item, event[2]]);
9050
- index++;
9051
- length++;
9151
+ insertions.push({ at: index, event: ["enter", item, event[2]] });
9052
9152
  firstBlankLineIndex = undefined;
9053
9153
  atMarker = true;
9054
9154
  }
9055
9155
  }
9056
9156
  }
9157
+ const listEvents = events.splice(start);
9158
+ let insertion = 0;
9159
+ index = -1;
9160
+ while (++index < listEvents.length) {
9161
+ while (insertion < insertions.length && insertions[insertion].at === start + index) {
9162
+ events.push(insertions[insertion++].event);
9163
+ }
9164
+ events.push(listEvents[index]);
9165
+ }
9166
+ ok(insertion === insertions.length, "expected insertions to be merged");
9057
9167
  events[start][1]._spread = listSpread;
9058
- return length;
9059
9168
  }
9060
9169
  function opener(create, and) {
9061
9170
  return open;
@@ -9095,7 +9204,8 @@ function compiler(options) {
9095
9204
  const open = this.tokenStack.pop();
9096
9205
  if (!open) {
9097
9206
  throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): it’s not open");
9098
- } else if (open[0].type !== token.type) {
9207
+ }
9208
+ if (open[0].type !== token.type) {
9099
9209
  if (onExitError) {
9100
9210
  onExitError.call(this, token, open[0]);
9101
9211
  } else {
@@ -9392,13 +9502,19 @@ function compiler(options) {
9392
9502
  node.url = "mailto:" + this.sliceSerialize(token);
9393
9503
  }
9394
9504
  function blockQuote() {
9395
- return { type: "blockquote", children: [] };
9505
+ return { type: "blockquote", children: [], position: undefined };
9396
9506
  }
9397
9507
  function codeFlow() {
9398
- return { type: "code", lang: null, meta: null, value: "" };
9508
+ return {
9509
+ type: "code",
9510
+ lang: null,
9511
+ meta: null,
9512
+ value: "",
9513
+ position: undefined
9514
+ };
9399
9515
  }
9400
9516
  function codeText() {
9401
- return { type: "inlineCode", value: "" };
9517
+ return { type: "inlineCode", value: "", position: undefined };
9402
9518
  }
9403
9519
  function definition() {
9404
9520
  return {
@@ -9406,30 +9522,44 @@ function compiler(options) {
9406
9522
  identifier: "",
9407
9523
  label: null,
9408
9524
  title: null,
9409
- url: ""
9525
+ url: "",
9526
+ position: undefined
9410
9527
  };
9411
9528
  }
9412
9529
  function emphasis() {
9413
- return { type: "emphasis", children: [] };
9530
+ return { type: "emphasis", children: [], position: undefined };
9414
9531
  }
9415
9532
  function heading() {
9416
9533
  return {
9417
9534
  type: "heading",
9418
9535
  depth: 0,
9419
- children: []
9536
+ children: [],
9537
+ position: undefined
9420
9538
  };
9421
9539
  }
9422
9540
  function hardBreak() {
9423
- return { type: "break" };
9541
+ return { type: "break", position: undefined };
9424
9542
  }
9425
9543
  function html() {
9426
- return { type: "html", value: "" };
9544
+ return { type: "html", value: "", position: undefined };
9427
9545
  }
9428
9546
  function image() {
9429
- return { type: "image", title: null, url: "", alt: null };
9547
+ return {
9548
+ type: "image",
9549
+ title: null,
9550
+ url: "",
9551
+ alt: null,
9552
+ position: undefined
9553
+ };
9430
9554
  }
9431
9555
  function link() {
9432
- return { type: "link", title: null, url: "", children: [] };
9556
+ return {
9557
+ type: "link",
9558
+ title: null,
9559
+ url: "",
9560
+ children: [],
9561
+ position: undefined
9562
+ };
9433
9563
  }
9434
9564
  function list(token) {
9435
9565
  return {
@@ -9437,7 +9567,8 @@ function compiler(options) {
9437
9567
  ordered: token.type === "listOrdered",
9438
9568
  start: null,
9439
9569
  spread: token._spread,
9440
- children: []
9570
+ children: [],
9571
+ position: undefined
9441
9572
  };
9442
9573
  }
9443
9574
  function listItem(token) {
@@ -9445,20 +9576,21 @@ function compiler(options) {
9445
9576
  type: "listItem",
9446
9577
  spread: token._spread,
9447
9578
  checked: null,
9448
- children: []
9579
+ children: [],
9580
+ position: undefined
9449
9581
  };
9450
9582
  }
9451
9583
  function paragraph() {
9452
- return { type: "paragraph", children: [] };
9584
+ return { type: "paragraph", children: [], position: undefined };
9453
9585
  }
9454
9586
  function strong() {
9455
- return { type: "strong", children: [] };
9587
+ return { type: "strong", children: [], position: undefined };
9456
9588
  }
9457
9589
  function text() {
9458
- return { type: "text", value: "" };
9590
+ return { type: "text", value: "", position: undefined };
9459
9591
  }
9460
9592
  function thematicBreak() {
9461
- return { type: "thematicBreak" };
9593
+ return { type: "thematicBreak", position: undefined };
9462
9594
  }
9463
9595
  }
9464
9596
  function point2(d) {
@@ -9494,6 +9626,14 @@ function extension(combined, extension) {
9494
9626
  }
9495
9627
  break;
9496
9628
  }
9629
+ case "afterExit":
9630
+ case "beforeEnter": {
9631
+ const right = extension[key];
9632
+ if (right) {
9633
+ combined[key].push(right);
9634
+ }
9635
+ break;
9636
+ }
9497
9637
  case "enter":
9498
9638
  case "exit": {
9499
9639
  const right = extension[key];
@@ -9509,9 +9649,8 @@ function extension(combined, extension) {
9509
9649
  function defaultOnError(left, right) {
9510
9650
  if (left) {
9511
9651
  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");
9512
- } else {
9513
- throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is still open");
9514
9652
  }
9653
+ throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is still open");
9515
9654
  }
9516
9655
  var own3;
9517
9656
  var init_lib5 = __esm(() => {
@@ -17568,15 +17707,13 @@ function findAndReplace(tree, list, options) {
17568
17707
  find.lastIndex = position + 1;
17569
17708
  } else {
17570
17709
  if (start !== position) {
17571
- nodes.push({
17572
- type: "text",
17573
- value: node.value.slice(start, position)
17574
- });
17710
+ add({ type: "text", value: node.value.slice(start, position) });
17575
17711
  }
17576
17712
  if (Array.isArray(value)) {
17577
- nodes.push(...value);
17713
+ for (const child of value)
17714
+ add(child);
17578
17715
  } else if (value) {
17579
- nodes.push(value);
17716
+ add(value);
17580
17717
  }
17581
17718
  start = position + match[0].length;
17582
17719
  change = true;
@@ -17588,20 +17725,28 @@ function findAndReplace(tree, list, options) {
17588
17725
  }
17589
17726
  if (change) {
17590
17727
  if (start < node.value.length) {
17591
- nodes.push({ type: "text", value: node.value.slice(start) });
17728
+ add({ type: "text", value: node.value.slice(start) });
17592
17729
  }
17593
17730
  parent.children.splice(index, 1, ...nodes);
17594
17731
  } else {
17595
17732
  nodes = [node];
17596
17733
  }
17597
17734
  return index + nodes.length;
17735
+ function add(child) {
17736
+ const previous = nodes[nodes.length - 1];
17737
+ if (previous && previous.type === "text" && child.type === "text") {
17738
+ previous.value += child.value;
17739
+ } else {
17740
+ nodes.push(child);
17741
+ }
17742
+ }
17598
17743
  }
17599
17744
  }
17600
17745
  function toPairs(tupleOrList) {
17601
- const result = [];
17602
17746
  if (!Array.isArray(tupleOrList)) {
17603
17747
  throw new TypeError("Expected find and replace tuple or list of tuples");
17604
17748
  }
17749
+ const result = [];
17605
17750
  const list = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
17606
17751
  let index = -1;
17607
17752
  while (++index < list.length) {
@@ -17896,35 +18041,39 @@ function gfmStrikethroughFromMarkdown() {
17896
18041
  }
17897
18042
  function gfmStrikethroughToMarkdown() {
17898
18043
  return {
18044
+ handlers: { delete: handleDelete },
17899
18045
  unsafe: [
17900
18046
  {
17901
18047
  character: "~",
17902
18048
  inConstruct: "phrasing",
17903
18049
  notInConstruct: constructsWithoutStrikethrough
17904
18050
  }
17905
- ],
17906
- handlers: { delete: handleDelete }
18051
+ ]
17907
18052
  };
17908
18053
  }
17909
18054
  function enterStrikethrough(token) {
17910
- this.enter({ type: "delete", children: [] }, token);
18055
+ this.enter({ type: "delete", children: [], position: undefined }, token);
17911
18056
  }
17912
18057
  function exitStrikethrough(token) {
17913
18058
  this.exit(token);
17914
18059
  }
17915
18060
  function handleDelete(node, _, state, info) {
17916
18061
  const tracker = state.createTracker(info);
18062
+ const sequence = state.stack.includes("strikethrough") ? "~" : "~~";
17917
18063
  const exit = state.enter("strikethrough");
17918
- let value = tracker.move("~~");
18064
+ let value = tracker.move(sequence);
17919
18065
  value += state.containerPhrasing(node, {
17920
18066
  ...tracker.current(),
17921
18067
  before: value,
17922
18068
  after: "~"
17923
18069
  });
17924
- value += tracker.move("~~");
18070
+ value += tracker.move(sequence);
17925
18071
  exit();
17926
18072
  return value;
17927
18073
  }
18074
+ function attentionDelete() {
18075
+ return { construct: "strikethrough", markers: ["~"], sizes: [2, 1] };
18076
+ }
17928
18077
  function peekDelete() {
17929
18078
  return "~";
17930
18079
  }
@@ -17938,6 +18087,7 @@ var init_lib13 = __esm(() => {
17938
18087
  "titleQuote",
17939
18088
  "titleApostrophe"
17940
18089
  ];
18090
+ handleDelete.attention = attentionDelete;
17941
18091
  handleDelete.peek = peekDelete;
17942
18092
  });
17943
18093
 
@@ -18081,6 +18231,35 @@ function toAlignment(value) {
18081
18231
  return code === 67 || code === 99 ? 99 : code === 76 || code === 108 ? 108 : code === 82 || code === 114 ? 114 : 0;
18082
18232
  }
18083
18233
 
18234
+ // ../../node_modules/mdast-util-phrasing/lib/index.js
18235
+ var phrasing;
18236
+ var init_lib14 = __esm(() => {
18237
+ init_unist_util_is();
18238
+ phrasing = convert([
18239
+ "break",
18240
+ "delete",
18241
+ "emphasis",
18242
+ "footnote",
18243
+ "footnoteReference",
18244
+ "image",
18245
+ "imageReference",
18246
+ "inlineCode",
18247
+ "inlineMath",
18248
+ "link",
18249
+ "linkReference",
18250
+ "mdxJsxTextElement",
18251
+ "mdxTextExpression",
18252
+ "strong",
18253
+ "text",
18254
+ "textDirective"
18255
+ ]);
18256
+ });
18257
+
18258
+ // ../../node_modules/mdast-util-phrasing/index.js
18259
+ var init_mdast_util_phrasing = __esm(() => {
18260
+ init_lib14();
18261
+ });
18262
+
18084
18263
  // ../../node_modules/zwitch/index.js
18085
18264
  function zwitch(key, options) {
18086
18265
  const settings = options || {};
@@ -18193,9 +18372,10 @@ function listInScope(stack, list, none) {
18193
18372
  function hardBreak(_, _1, state, info) {
18194
18373
  let index = -1;
18195
18374
  while (++index < state.unsafe.length) {
18196
- if (state.unsafe[index].character === `
18197
- ` && patternInScope(state.stack, state.unsafe[index])) {
18198
- return /[ \t]/.test(info.before) ? "" : " ";
18375
+ const pattern = state.unsafe[index];
18376
+ if (pattern.character === `
18377
+ ` && !pattern.before && !pattern.after && patternInScope(state.stack, pattern)) {
18378
+ return /[\t ]/.test(info.before) ? "" : " ";
18199
18379
  }
18200
18380
  }
18201
18381
  return "\\\n";
@@ -18228,7 +18408,7 @@ function longestStreak(value, substring) {
18228
18408
 
18229
18409
  // ../../node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
18230
18410
  function formatCodeAsIndented(node, state) {
18231
- return Boolean(state.options.fences === false && node.value && !node.lang && /[^ \r\n]/.test(node.value) && !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value));
18411
+ return Boolean(state.options.fences === false && node.value && !node.lang && /[^\n\r ]/.test(node.value) && !/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(node.value));
18232
18412
  }
18233
18413
 
18234
18414
  // ../../node_modules/mdast-util-to-markdown/lib/util/check-fence.js
@@ -18244,7 +18424,6 @@ function checkFence(state) {
18244
18424
  function code(node, _, state, info) {
18245
18425
  const marker = checkFence(state);
18246
18426
  const raw = node.value || "";
18247
- const suffix = marker === "`" ? "GraveAccent" : "Tilde";
18248
18427
  if (formatCodeAsIndented(node, state)) {
18249
18428
  const exit = state.enter("codeIndented");
18250
18429
  const value = state.indentLines(raw, map3);
@@ -18254,6 +18433,7 @@ function code(node, _, state, info) {
18254
18433
  const tracker = state.createTracker(info);
18255
18434
  const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
18256
18435
  const exit = state.enter("codeFenced");
18436
+ const suffix = marker === "`" ? "GraveAccent" : "Tilde";
18257
18437
  let value = tracker.move(sequence);
18258
18438
  if (node.lang) {
18259
18439
  const subexit = state.enter(`codeFencedLang${suffix}`);
@@ -18356,64 +18536,34 @@ function checkEmphasis(state) {
18356
18536
  return marker;
18357
18537
  }
18358
18538
 
18359
- // ../../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
18360
- function encodeCharacterReference(code) {
18361
- return "&#x" + code.toString(16).toUpperCase() + ";";
18362
- }
18363
-
18364
- // ../../node_modules/mdast-util-to-markdown/lib/util/encode-info.js
18365
- function encodeInfo(outside, inside, marker) {
18366
- const outsideKind = classifyCharacter(outside);
18367
- const insideKind = classifyCharacter(inside);
18368
- if (outsideKind === undefined) {
18369
- return insideKind === undefined ? marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: true };
18370
- }
18371
- if (outsideKind === 1) {
18372
- return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: false };
18373
- }
18374
- return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: false } : { inside: false, outside: false };
18375
- }
18376
- var init_encode_info = __esm(() => {
18377
- init_dev6();
18378
- });
18379
-
18380
18539
  // ../../node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
18381
18540
  function emphasis(node, _, state, info) {
18382
- const marker = checkEmphasis(state);
18383
- const exit = state.enter("emphasis");
18384
- const tracker = state.createTracker(info);
18385
- const before = tracker.move(marker);
18386
- let between = tracker.move(state.containerPhrasing(node, {
18387
- after: marker,
18388
- before,
18389
- ...tracker.current()
18390
- }));
18391
- const betweenHead = between.charCodeAt(0);
18392
- const open = encodeInfo(info.before.charCodeAt(info.before.length - 1), betweenHead, marker);
18393
- if (open.inside) {
18394
- between = encodeCharacterReference(betweenHead) + between.slice(1);
18395
- }
18396
- const betweenTail = between.charCodeAt(between.length - 1);
18397
- const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
18398
- if (close.inside) {
18399
- between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
18400
- }
18401
- const after = tracker.move(marker);
18541
+ const exit = state.enter("phrasing");
18542
+ const value = state.containerPhrasing({ type: "root", children: [node] }, info);
18402
18543
  exit();
18403
- state.attentionEncodeSurroundingInfo = {
18404
- after: close.outside,
18405
- before: open.outside
18544
+ return value;
18545
+ }
18546
+ function attention2(_, state) {
18547
+ const marker = checkEmphasis(state);
18548
+ return {
18549
+ construct: "emphasis",
18550
+ markers: marker === "*" ? ["*", "_"] : ["_", "*"],
18551
+ sizes: [1]
18406
18552
  };
18407
- return before + between + after;
18408
18553
  }
18409
- function emphasisPeek(_, _1, state) {
18554
+ function peek(_, _1, state) {
18410
18555
  return state.options.emphasis || "*";
18411
18556
  }
18412
18557
  var init_emphasis = __esm(() => {
18413
- init_encode_info();
18414
- emphasis.peek = emphasisPeek;
18558
+ emphasis.attention = attention2;
18559
+ emphasis.peek = peek;
18415
18560
  });
18416
18561
 
18562
+ // ../../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
18563
+ function encodeCharacterReference(code) {
18564
+ return "&#x" + code.toString(16).toUpperCase() + ";";
18565
+ }
18566
+
18417
18567
  // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/color.node.js
18418
18568
  function color2(d) {
18419
18569
  return "\x1B[33m" + d + "\x1B[39m";
@@ -18480,14 +18630,14 @@ function toResult2(value) {
18480
18630
  return value === null || value === undefined ? empty2 : [value];
18481
18631
  }
18482
18632
  var empty2, CONTINUE2 = true, EXIT2 = false, SKIP2 = "skip";
18483
- var init_lib14 = __esm(() => {
18633
+ var init_lib15 = __esm(() => {
18484
18634
  init_unist_util_is();
18485
18635
  empty2 = [];
18486
18636
  });
18487
18637
 
18488
18638
  // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
18489
18639
  var init_unist_util_visit_parents2 = __esm(() => {
18490
- init_lib14();
18640
+ init_lib15();
18491
18641
  });
18492
18642
 
18493
18643
  // ../../node_modules/unist-util-visit/lib/index.js
@@ -18511,14 +18661,14 @@ function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
18511
18661
  return visitor(node, index, parent);
18512
18662
  }
18513
18663
  }
18514
- var init_lib15 = __esm(() => {
18664
+ var init_lib16 = __esm(() => {
18515
18665
  init_unist_util_visit_parents2();
18516
18666
  init_unist_util_visit_parents2();
18517
18667
  });
18518
18668
 
18519
18669
  // ../../node_modules/unist-util-visit/index.js
18520
18670
  var init_unist_util_visit = __esm(() => {
18521
- init_lib15();
18671
+ init_lib16();
18522
18672
  });
18523
18673
 
18524
18674
  // ../../node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
@@ -18567,8 +18717,9 @@ function heading(node, _, state, info) {
18567
18717
  `,
18568
18718
  ...tracker.current()
18569
18719
  });
18570
- if (/^[\t ]/.test(value)) {
18571
- value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);
18720
+ const head = value.charCodeAt(0);
18721
+ if (head === 9 || head === 32) {
18722
+ value = encodeCharacterReference(head) + value.slice(1);
18572
18723
  }
18573
18724
  value = value ? sequence + " " + value : sequence;
18574
18725
  if (state.options.closeAtx) {
@@ -18655,7 +18806,9 @@ function imageReference(node, _, state, info) {
18655
18806
  value += tracker.move(alt + "][");
18656
18807
  subexit();
18657
18808
  const stack = state.stack;
18658
- state.stack = [];
18809
+ state.stack = stack.filter(function(d) {
18810
+ return d !== "phrasing";
18811
+ });
18659
18812
  subexit = state.enter("reference");
18660
18813
  const reference = state.safe(state.associationId(node), {
18661
18814
  before: value,
@@ -18689,15 +18842,15 @@ function inlineCode(node, _, state) {
18689
18842
  while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
18690
18843
  sequence += "`";
18691
18844
  }
18692
- if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) {
18845
+ if (/[^\n\r ]/.test(value) && (/^[\n\r ]/.test(value) && /[\n\r ]$/.test(value) || /^`|`$/.test(value))) {
18693
18846
  value = " " + value + " ";
18694
18847
  }
18695
18848
  while (++index < state.unsafe.length) {
18696
18849
  const pattern = state.unsafe[index];
18697
18850
  const expression = state.compilePattern(pattern);
18698
- let match;
18699
18851
  if (!pattern.atBreak)
18700
18852
  continue;
18853
+ let match;
18701
18854
  while (match = expression.exec(value)) {
18702
18855
  let position = match.index;
18703
18856
  if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {
@@ -18718,7 +18871,7 @@ var init_inline_code = __esm(() => {
18718
18871
  // ../../node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
18719
18872
  function formatLinkAsAutolink(node, state) {
18720
18873
  const raw = toString(node);
18721
- 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));
18874
+ 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));
18722
18875
  }
18723
18876
  var init_format_link_as_autolink = __esm(() => {
18724
18877
  init_mdast_util_to_string();
@@ -18729,12 +18882,12 @@ function link(node, _, state, info) {
18729
18882
  const quote = checkQuote(state);
18730
18883
  const suffix = quote === '"' ? "Quote" : "Apostrophe";
18731
18884
  const tracker = state.createTracker(info);
18732
- let exit;
18733
- let subexit;
18734
18885
  if (formatLinkAsAutolink(node, state)) {
18735
18886
  const stack = state.stack;
18736
- state.stack = [];
18737
- exit = state.enter("autolink");
18887
+ state.stack = stack.filter(function(d) {
18888
+ return d !== "phrasing";
18889
+ });
18890
+ const exit = state.enter("autolink");
18738
18891
  let value = tracker.move("<");
18739
18892
  value += tracker.move(state.containerPhrasing(node, {
18740
18893
  before: value,
@@ -18746,8 +18899,8 @@ function link(node, _, state, info) {
18746
18899
  state.stack = stack;
18747
18900
  return value;
18748
18901
  }
18749
- exit = state.enter("link");
18750
- subexit = state.enter("label");
18902
+ const exit = state.enter("link");
18903
+ let subexit = state.enter("label");
18751
18904
  let value = tracker.move("[");
18752
18905
  value += tracker.move(state.containerPhrasing(node, {
18753
18906
  before: value,
@@ -18808,7 +18961,9 @@ function linkReference(node, _, state, info) {
18808
18961
  value += tracker.move(text + "][");
18809
18962
  subexit();
18810
18963
  const stack = state.stack;
18811
- state.stack = [];
18964
+ state.stack = stack.filter(function(d) {
18965
+ return d !== "phrasing";
18966
+ });
18812
18967
  subexit = state.enter("reference");
18813
18968
  const reference = state.safe(state.associationId(node), {
18814
18969
  before: value,
@@ -18961,42 +19116,17 @@ function paragraph(node, _, state, info) {
18961
19116
  return value;
18962
19117
  }
18963
19118
 
18964
- // ../../node_modules/mdast-util-phrasing/lib/index.js
18965
- var phrasing;
18966
- var init_lib16 = __esm(() => {
18967
- init_unist_util_is();
18968
- phrasing = convert([
18969
- "break",
18970
- "delete",
18971
- "emphasis",
18972
- "footnote",
18973
- "footnoteReference",
18974
- "image",
18975
- "imageReference",
18976
- "inlineCode",
18977
- "inlineMath",
18978
- "link",
18979
- "linkReference",
18980
- "mdxJsxTextElement",
18981
- "mdxTextExpression",
18982
- "strong",
18983
- "text",
18984
- "textDirective"
18985
- ]);
18986
- });
18987
-
18988
- // ../../node_modules/mdast-util-phrasing/index.js
18989
- var init_mdast_util_phrasing = __esm(() => {
18990
- init_lib16();
18991
- });
18992
-
18993
19119
  // ../../node_modules/mdast-util-to-markdown/lib/handle/root.js
18994
19120
  function root(node, _, state, info) {
18995
19121
  const hasPhrasing = node.children.some(function(d) {
18996
19122
  return phrasing(d);
18997
19123
  });
18998
- const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;
18999
- return container.call(state, node, info);
19124
+ if (!hasPhrasing)
19125
+ return state.containerFlow(node, info);
19126
+ const exit = state.enter("phrasing");
19127
+ const value = state.containerPhrasing(node, info);
19128
+ exit();
19129
+ return value;
19000
19130
  }
19001
19131
  var init_root = __esm(() => {
19002
19132
  init_mdast_util_phrasing();
@@ -19013,44 +19143,36 @@ function checkStrong(state) {
19013
19143
 
19014
19144
  // ../../node_modules/mdast-util-to-markdown/lib/handle/strong.js
19015
19145
  function strong(node, _, state, info) {
19016
- const marker = checkStrong(state);
19017
- const exit = state.enter("strong");
19018
- const tracker = state.createTracker(info);
19019
- const before = tracker.move(marker + marker);
19020
- let between = tracker.move(state.containerPhrasing(node, {
19021
- after: marker,
19022
- before,
19023
- ...tracker.current()
19024
- }));
19025
- const betweenHead = between.charCodeAt(0);
19026
- const open = encodeInfo(info.before.charCodeAt(info.before.length - 1), betweenHead, marker);
19027
- if (open.inside) {
19028
- between = encodeCharacterReference(betweenHead) + between.slice(1);
19029
- }
19030
- const betweenTail = between.charCodeAt(between.length - 1);
19031
- const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
19032
- if (close.inside) {
19033
- between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
19034
- }
19035
- const after = tracker.move(marker + marker);
19146
+ const exit = state.enter("phrasing");
19147
+ const value = state.containerPhrasing({ type: "root", children: [node] }, info);
19036
19148
  exit();
19037
- state.attentionEncodeSurroundingInfo = {
19038
- after: close.outside,
19039
- before: open.outside
19149
+ return value;
19150
+ }
19151
+ function attention3(_, state) {
19152
+ const marker = checkStrong(state);
19153
+ return {
19154
+ construct: "strong",
19155
+ markers: marker === "*" ? ["*", "_"] : ["_", "*"],
19156
+ sizes: [2]
19040
19157
  };
19041
- return before + between + after;
19042
19158
  }
19043
- function strongPeek(_, _1, state) {
19159
+ function peek2(_, _1, state) {
19044
19160
  return state.options.strong || "*";
19045
19161
  }
19046
19162
  var init_strong = __esm(() => {
19047
- init_encode_info();
19048
- strong.peek = strongPeek;
19163
+ strong.attention = attention3;
19164
+ strong.peek = peek2;
19049
19165
  });
19050
19166
 
19051
19167
  // ../../node_modules/mdast-util-to-markdown/lib/handle/text.js
19052
- function text3(node, _, state, info) {
19053
- return state.safe(node.value, info);
19168
+ function text3(node, parent, state, info) {
19169
+ const siblings = parent ? parent.children : [];
19170
+ const index = siblings.indexOf(node);
19171
+ return state.safe(node.value, {
19172
+ ...info,
19173
+ afterNode: siblings[index + 1],
19174
+ beforeNode: siblings[index - 1]
19175
+ });
19054
19176
  }
19055
19177
 
19056
19178
  // ../../node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
@@ -19112,6 +19234,43 @@ var init_handle = __esm(() => {
19112
19234
  };
19113
19235
  });
19114
19236
 
19237
+ // ../../node_modules/mdast-util-to-markdown/lib/util/html-kind.js
19238
+ function htmlKind(value) {
19239
+ if (value.charCodeAt(0) !== 60)
19240
+ return;
19241
+ const next = value.charCodeAt(1);
19242
+ if (next === 33) {
19243
+ const code = value.charCodeAt(2);
19244
+ if (code === 45)
19245
+ return 2;
19246
+ if (code === 91)
19247
+ return 5;
19248
+ if (asciiAlpha(code))
19249
+ return 4;
19250
+ return;
19251
+ }
19252
+ if (next === 63)
19253
+ return 3;
19254
+ const closing = next === 47;
19255
+ const start = closing ? 2 : 1;
19256
+ let end = start;
19257
+ let code = value.charCodeAt(end);
19258
+ if (!asciiAlpha(code))
19259
+ return;
19260
+ while (code === 45 || asciiAlphanumeric(code)) {
19261
+ code = value.charCodeAt(++end);
19262
+ }
19263
+ const name = value.slice(start, end).toLowerCase();
19264
+ if (!closing && code !== 47 && htmlRawNames.includes(name)) {
19265
+ return 1;
19266
+ }
19267
+ return htmlBlockNames.includes(name) ? 6 : 7;
19268
+ }
19269
+ var init_html_kind = __esm(() => {
19270
+ init_dev4();
19271
+ init_micromark_util_html_tag_name();
19272
+ });
19273
+
19115
19274
  // ../../node_modules/mdast-util-to-markdown/lib/join.js
19116
19275
  function joinDefaults(left, right, parent, state) {
19117
19276
  if (right.type === "code" && formatCodeAsIndented(right, state) && (left.type === "list" || left.type === right.type && formatCodeAsIndented(left, state))) {
@@ -19121,17 +19280,28 @@ function joinDefaults(left, right, parent, state) {
19121
19280
  if (left.type === "paragraph" && (left.type === right.type || right.type === "definition" || right.type === "heading" && formatHeadingAsSetext(right, state))) {
19122
19281
  return;
19123
19282
  }
19283
+ if (left.type === "html") {
19284
+ const kind = htmlKind(left.value);
19285
+ if (kind === undefined || kind === 6 || kind === 7)
19286
+ return 1;
19287
+ }
19288
+ if (left.type === "paragraph" && right.type === "html") {
19289
+ const kind = htmlKind(right.value);
19290
+ if (kind === undefined || kind === 7)
19291
+ return 1;
19292
+ }
19124
19293
  return parent.spread ? 1 : 0;
19125
19294
  }
19126
19295
  }
19127
19296
  var join;
19128
19297
  var init_join = __esm(() => {
19129
19298
  init_format_heading_as_setext();
19299
+ init_html_kind();
19130
19300
  join = [joinDefaults];
19131
19301
  });
19132
19302
 
19133
19303
  // ../../node_modules/mdast-util-to-markdown/lib/unsafe.js
19134
- var fullPhrasingSpans, unsafe;
19304
+ var fullPhrasingSpans, unsafe, code2 = -1;
19135
19305
  var init_unsafe = __esm(() => {
19136
19306
  fullPhrasingSpans = [
19137
19307
  "autolink",
@@ -19171,6 +19341,12 @@ var init_unsafe = __esm(() => {
19171
19341
  "headingAtx"
19172
19342
  ]
19173
19343
  },
19344
+ { character: "\r", before: "[\\r\\n]", inConstruct: "phrasing" },
19345
+ { character: "\r", after: "\\r", inConstruct: "phrasing" },
19346
+ { character: `
19347
+ `, before: "\\n", inConstruct: "phrasing" },
19348
+ { character: `
19349
+ `, after: "[\\r\\n]", inConstruct: "phrasing" },
19174
19350
  { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" },
19175
19351
  { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" },
19176
19352
  {
@@ -19231,8 +19407,14 @@ var init_unsafe = __esm(() => {
19231
19407
  inConstruct: ["codeFencedLangGraveAccent", "codeFencedMetaGraveAccent"]
19232
19408
  },
19233
19409
  { character: "`", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans },
19234
- { atBreak: true, character: "~" }
19410
+ { atBreak: true, character: "~" },
19411
+ { character: "<", inConstruct: "autolink" },
19412
+ { character: ">", inConstruct: "autolink" },
19413
+ { character: "", inConstruct: "autolink" }
19235
19414
  ];
19415
+ while (++code2 < 33) {
19416
+ unsafe.push({ character: String.fromCharCode(code2), inConstruct: "autolink" });
19417
+ }
19236
19418
  });
19237
19419
 
19238
19420
  // ../../node_modules/mdast-util-to-markdown/lib/util/association.js
@@ -19250,19 +19432,201 @@ var init_association = __esm(() => {
19250
19432
  function compilePattern(pattern) {
19251
19433
  if (!pattern._compiled) {
19252
19434
  const before = (pattern.atBreak ? "[\\r\\n][\\t ]*" : "") + (pattern.before ? "(?:" + pattern.before + ")" : "");
19253
- pattern._compiled = new RegExp((before ? "(" + before + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.after ? "(?:" + pattern.after + ")" : ""), "g");
19435
+ pattern._compiled = new RegExp((pattern.beforeNode ? "^" : before ? "(" + before + ")" : "") + (/[$()*+.?[\\\]^{|}]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.afterNode ? "$" : pattern.after ? "(?:" + pattern.after + ")" : ""), pattern.unicode ? "gu" : "g");
19254
19436
  }
19255
19437
  return pattern._compiled;
19256
19438
  }
19257
19439
 
19440
+ // ../../node_modules/mdast-util-to-markdown/lib/util/character.js
19441
+ function firstCharacter(value) {
19442
+ const code = value.codePointAt(0);
19443
+ return code === undefined ? "" : String.fromCodePoint(code);
19444
+ }
19445
+ function lastCharacter(value) {
19446
+ const code = value.codePointAt(value.length - 2);
19447
+ return code !== undefined && code > 65535 ? value.slice(-2) : value.slice(-1);
19448
+ }
19449
+
19450
+ // ../../node_modules/mdast-util-to-markdown/lib/util/encode-info.js
19451
+ function encodeInfo(outside, inside, marker) {
19452
+ const outsideKind = classifyCharacter(outside);
19453
+ const insideKind = classifyCharacter(inside);
19454
+ if (outsideKind === undefined) {
19455
+ return insideKind === undefined ? marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: true };
19456
+ }
19457
+ if (outsideKind === 1) {
19458
+ return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: false };
19459
+ }
19460
+ return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: false } : { inside: false, outside: false };
19461
+ }
19462
+ var init_encode_info = __esm(() => {
19463
+ init_dev6();
19464
+ });
19465
+
19258
19466
  // ../../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
19467
+ function candidates(tokens, involved, runOf) {
19468
+ const related = new Set;
19469
+ for (const token of tokens) {
19470
+ const siblings = runOf.get(token);
19471
+ if (siblings && token.attention && involved.some((d) => d.attention === token.attention)) {
19472
+ for (const sibling of siblings.tokens) {
19473
+ related.add(sibling.attention);
19474
+ }
19475
+ }
19476
+ }
19477
+ const ordered = [];
19478
+ for (const token of tokens) {
19479
+ if (token.attention && related.delete(token.attention)) {
19480
+ ordered.push(token.attention);
19481
+ }
19482
+ }
19483
+ ordered.reverse();
19484
+ return ordered;
19485
+ }
19486
+ function check(tokens, before, after) {
19487
+ const runs = [];
19488
+ const wrong = new Map;
19489
+ const runOf = new Map;
19490
+ let index = 0;
19491
+ while (index < tokens.length) {
19492
+ if (!tokens[index].attention) {
19493
+ index++;
19494
+ continue;
19495
+ }
19496
+ const marker = tokens[index].value.charAt(0);
19497
+ const strict = builtins.get(marker);
19498
+ let end = index + 1;
19499
+ while (end < tokens.length && tokens[end].attention && tokens[end].value.charAt(0) === marker) {
19500
+ end++;
19501
+ }
19502
+ const head = index ? tokens[index - 1].value : before;
19503
+ const previous = classifyCharacter(head.charCodeAt(head.length - 1));
19504
+ const next = classifyCharacter((end < tokens.length ? tokens[end].value : after).charCodeAt(0));
19505
+ const open = !next || next === 2 && Boolean(previous);
19506
+ const close = !previous || previous === 2 && Boolean(next);
19507
+ const run = {
19508
+ tokens: tokens.slice(index, end),
19509
+ markers: [],
19510
+ start: 0,
19511
+ end: 0,
19512
+ open: strict ? open && (Boolean(previous) || !close) : open,
19513
+ close: strict ? close && (Boolean(next) || !open) : close,
19514
+ split: strict !== undefined
19515
+ };
19516
+ for (const token of run.tokens) {
19517
+ wrong.set(token, [...run.tokens]);
19518
+ runOf.set(token, run);
19519
+ let size = token.value.length;
19520
+ while (size--)
19521
+ run.markers.push(token);
19522
+ }
19523
+ run.end = run.markers.length;
19524
+ runs.push(run);
19525
+ index = end;
19526
+ }
19527
+ pair(runs, wrong);
19528
+ index = -1;
19529
+ while (++index < tokens.length) {
19530
+ const involved = wrong.get(tokens[index]);
19531
+ if (involved)
19532
+ return { attention: candidates(tokens, involved, runOf), index };
19533
+ }
19534
+ }
19259
19535
  function containerPhrasing(parent, state, info) {
19536
+ return serialize2(phrasing2(parent, state, info), info.before, info.after);
19537
+ }
19538
+ function encode(tokens, start) {
19539
+ const token = tokens[start ? 0 : tokens.length - 1];
19540
+ if (!token || token.attention)
19541
+ return;
19542
+ const character = start ? firstCharacter(token.value) : lastCharacter(token.value);
19543
+ const reference = encodeCharacterReference(character.codePointAt(0));
19544
+ token.value = start ? reference + token.value.slice(character.length) : token.value.slice(0, token.value.length - character.length) + reference;
19545
+ }
19546
+ function improve(items, chosen, mistake, before, after) {
19547
+ for (const attention of mistake.attention) {
19548
+ const current = chosen.get(attention) || attention.sequences[0];
19549
+ for (const sequence of attention.sequences) {
19550
+ if (sequence === current)
19551
+ continue;
19552
+ const trial = new Map(chosen);
19553
+ trial.set(attention, sequence);
19554
+ const tokens = render(items, trial, before, after);
19555
+ const next = check(tokens, before, after);
19556
+ if (!next || next.index > mistake.index) {
19557
+ return { chosen: trial, mistake: next, tokens };
19558
+ }
19559
+ }
19560
+ }
19561
+ }
19562
+ function pair(runs, wrong) {
19563
+ let index = 0;
19564
+ while (index < runs.length) {
19565
+ const closer = runs[index];
19566
+ const marker = closer.tokens[0].value.charAt(0);
19567
+ const closerSize = closer.end - closer.start;
19568
+ let open = closer.close && closerSize ? index : 0;
19569
+ while (open--) {
19570
+ const opener = runs[open];
19571
+ const openerSize = opener.end - opener.start;
19572
+ 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)) {
19573
+ const size = closer.split ? openerSize > 1 && closerSize > 1 ? 2 : 1 : closerSize;
19574
+ const opening = opener.markers.slice(opener.end - size, opener.end);
19575
+ const closing = closer.markers.slice(closer.start, closer.start + size);
19576
+ const openToken = opening[0];
19577
+ const closeToken = closing[0];
19578
+ if (openToken === opening[size - 1] && openToken.value.length === size && closeToken === closing[size - 1] && closeToken.value.length === size && openToken.attention === closeToken.attention) {
19579
+ wrong.delete(openToken);
19580
+ wrong.delete(closeToken);
19581
+ } else {
19582
+ const involved = [...new Set([...opening, ...closing])];
19583
+ for (const token of involved) {
19584
+ const list = wrong.get(token);
19585
+ if (list)
19586
+ list.push(...involved);
19587
+ }
19588
+ }
19589
+ opener.end -= size;
19590
+ closer.start += size;
19591
+ break;
19592
+ }
19593
+ }
19594
+ if (open === -1 || closer.start === closer.end)
19595
+ index++;
19596
+ }
19597
+ }
19598
+ function attentionSequences(type, markers, sizes) {
19599
+ if (markers.length === 0) {
19600
+ throw new Error("Cannot serialize `" + type + "` as attention without markers, expected one or more markers");
19601
+ }
19602
+ if (sizes.length === 0) {
19603
+ throw new Error("Cannot serialize `" + type + "` as attention without sizes, expected one or more sizes");
19604
+ }
19605
+ for (const size of sizes) {
19606
+ if (!Number.isSafeInteger(size) || size < 1) {
19607
+ throw new Error("Cannot serialize `" + type + "` as attention with `" + size + "` as size, expected positive integer");
19608
+ }
19609
+ }
19610
+ const sequences = [];
19611
+ for (const marker of markers) {
19612
+ if (marker.length !== 1) {
19613
+ throw new Error("Cannot serialize `" + type + "` as attention with `" + marker + "` as marker, expected a single ascii character");
19614
+ }
19615
+ if (!asciiPunctuation(marker.charCodeAt(0))) {
19616
+ throw new Error("Cannot serialize `" + type + "` as attention with `" + marker + "` as marker, expected ascii punctuation");
19617
+ }
19618
+ for (const size of sizes) {
19619
+ sequences.push(marker.repeat(size));
19620
+ }
19621
+ }
19622
+ return sequences;
19623
+ }
19624
+ function phrasing2(parent, state, info) {
19260
19625
  const indexStack = state.indexStack;
19261
19626
  const children = parent.children || [];
19262
19627
  const results = [];
19263
19628
  let index = -1;
19264
19629
  let before = info.before;
19265
- let encodeAfter;
19266
19630
  indexStack.push(-1);
19267
19631
  let tracker = state.createTracker(info);
19268
19632
  while (++index < children.length) {
@@ -19273,47 +19637,132 @@ function containerPhrasing(parent, state, info) {
19273
19637
  let handle = state.handle.handlers[children[index + 1].type];
19274
19638
  if (handle && handle.peek)
19275
19639
  handle = handle.peek;
19276
- after = handle ? handle(children[index + 1], parent, state, {
19640
+ after = handle ? firstCharacter(handle(children[index + 1], parent, state, {
19277
19641
  before: "",
19278
19642
  after: "",
19279
19643
  ...tracker.current()
19280
- }).charAt(0) : "";
19644
+ })) : "";
19281
19645
  } else {
19282
19646
  after = info.after;
19283
19647
  }
19284
- if (results.length > 0 && (before === "\r" || before === `
19285
- `) && child.type === "html") {
19286
- results[results.length - 1] = results[results.length - 1].replace(/(\r?\n|\r)$/, " ");
19648
+ const previous = results[results.length - 1];
19649
+ if (typeof previous === "string" && (before === "\r" || before === `
19650
+ `) && child.type === "html" && htmlKind(child.value) !== 7) {
19651
+ results[results.length - 1] = previous.replace(/(\r?\n|\r)$/, " ");
19287
19652
  before = " ";
19288
19653
  tracker = state.createTracker(info);
19289
- tracker.move(results.join(""));
19654
+ tracker.move(serialize2(results, info.before, info.after));
19655
+ }
19656
+ const handle = state.handle.handlers[child.type];
19657
+ if (handle && handle.attention) {
19658
+ const { construct, markers, sizes } = handle.attention(child, state);
19659
+ const sequences = attentionSequences(child.type, markers, sizes);
19660
+ const sequence = sequences[0];
19661
+ const exit = state.enter(construct);
19662
+ tracker.move(sequence);
19663
+ const inside = phrasing2(child, state, {
19664
+ ...tracker.current(),
19665
+ before: sequence,
19666
+ after: sequence
19667
+ });
19668
+ tracker.move(serialize2(inside, sequence, sequence));
19669
+ tracker.move(sequence);
19670
+ exit();
19671
+ results.push({ children: inside, sequences });
19672
+ before = sequence.charAt(sequence.length - 1);
19673
+ } else {
19674
+ const value = state.handle(child, parent, state, {
19675
+ ...tracker.current(),
19676
+ after,
19677
+ before
19678
+ });
19679
+ if (!value)
19680
+ continue;
19681
+ tracker.move(value);
19682
+ results.push(value);
19683
+ before = lastCharacter(value);
19290
19684
  }
19291
- let value = state.handle(child, parent, state, {
19292
- ...tracker.current(),
19293
- after,
19294
- before
19295
- });
19296
- if (encodeAfter && encodeAfter === value.slice(0, 1)) {
19297
- value = encodeCharacterReference(encodeAfter.charCodeAt(0)) + value.slice(1);
19685
+ }
19686
+ indexStack.pop();
19687
+ return results;
19688
+ }
19689
+ function render(items, chosen, before, after) {
19690
+ const tokens = [];
19691
+ let encodeAfter;
19692
+ let previous = lastCharacter(before);
19693
+ let index = -1;
19694
+ while (++index < items.length) {
19695
+ const item = items[index];
19696
+ if (typeof item === "string") {
19697
+ const token = { value: item, attention: undefined };
19698
+ if (encodeAfter && encodeAfter === firstCharacter(item)) {
19699
+ encode([token], true);
19700
+ }
19701
+ encodeAfter = undefined;
19702
+ tokens.push(token);
19703
+ if (token.value)
19704
+ previous = lastCharacter(token.value);
19705
+ continue;
19298
19706
  }
19299
- const encodingInfo = state.attentionEncodeSurroundingInfo;
19300
- state.attentionEncodeSurroundingInfo = undefined;
19301
- encodeAfter = undefined;
19302
- if (encodingInfo) {
19303
- if (results.length > 0 && encodingInfo.before && before === results[results.length - 1].slice(-1)) {
19304
- results[results.length - 1] = results[results.length - 1].slice(0, -1) + encodeCharacterReference(before.charCodeAt(0));
19305
- }
19306
- if (encodingInfo.after)
19307
- encodeAfter = after;
19707
+ const sequence = chosen.get(item) || item.sequences[0];
19708
+ const marker = sequence.charAt(0);
19709
+ const next = items[index + 1];
19710
+ const outsideBefore = previous;
19711
+ const outsideAfter = firstCharacter(next === undefined ? after : typeof next === "string" ? next : chosen.get(next) || next.sequences[0]);
19712
+ const inside = render(item.children, chosen, sequence, sequence);
19713
+ const head = inside.length > 0 ? inside[0].value : "";
19714
+ const open = encodeInfo(outsideBefore.charCodeAt(outsideBefore.length - 1), head.charCodeAt(0), marker);
19715
+ if (open.inside)
19716
+ encode(inside, true);
19717
+ const tail = inside.length > 0 ? lastCharacter(inside[inside.length - 1].value) : "";
19718
+ const close = encodeInfo(outsideAfter.charCodeAt(0), tail.charCodeAt(tail.length - 1), marker);
19719
+ if (close.inside)
19720
+ encode(inside, false);
19721
+ if (open.outside && outsideBefore !== `
19722
+ ` && outsideBefore !== "\r") {
19723
+ encode(tokens, false);
19724
+ }
19725
+ if (close.outside)
19726
+ encodeAfter = outsideAfter;
19727
+ tokens.push({ value: sequence, attention: item }, ...inside, {
19728
+ value: sequence,
19729
+ attention: item
19730
+ });
19731
+ previous = sequence.charAt(sequence.length - 1);
19732
+ }
19733
+ return tokens;
19734
+ }
19735
+ function serialize2(items, before, after) {
19736
+ let chosen = new Map;
19737
+ const initial = render(items, chosen, before, after);
19738
+ let tokens = initial;
19739
+ let mistake = check(tokens, before, after);
19740
+ while (mistake) {
19741
+ const next = improve(items, chosen, mistake, before, after);
19742
+ if (!next) {
19743
+ tokens = initial;
19744
+ break;
19308
19745
  }
19309
- tracker.move(value);
19310
- results.push(value);
19311
- before = value.slice(-1);
19746
+ chosen = next.chosen;
19747
+ tokens = next.tokens;
19748
+ mistake = next.mistake;
19312
19749
  }
19313
- indexStack.pop();
19314
- return results.join("");
19750
+ let result = "";
19751
+ for (const token of tokens)
19752
+ result += token.value;
19753
+ return result;
19315
19754
  }
19316
- var init_container_phrasing = () => {};
19755
+ var builtins;
19756
+ var init_container_phrasing = __esm(() => {
19757
+ init_dev4();
19758
+ init_dev6();
19759
+ init_encode_info();
19760
+ init_html_kind();
19761
+ builtins = new Map([
19762
+ ["*", false],
19763
+ ["_", true]
19764
+ ]);
19765
+ });
19317
19766
 
19318
19767
  // ../../node_modules/mdast-util-to-markdown/lib/util/container-flow.js
19319
19768
  function containerFlow(parent, state, info) {
@@ -19396,19 +19845,24 @@ function safe(state, input, config) {
19396
19845
  const positions = [];
19397
19846
  const result = [];
19398
19847
  const infos = {};
19848
+ const percentEncode = state.stack.includes("autolink");
19849
+ const offset = config.before ? config.before.length : 0;
19850
+ const end = value.length - (config.after ? config.after.length : 0);
19399
19851
  let index = -1;
19400
19852
  while (++index < state.unsafe.length) {
19401
19853
  const pattern = state.unsafe[index];
19402
- if (!patternInScope(state.stack, pattern)) {
19854
+ if (!patternInScope(state.stack, pattern) || !nodeInScope(pattern.beforeNode, config.beforeNode) || !nodeInScope(pattern.afterNode, config.afterNode)) {
19403
19855
  continue;
19404
19856
  }
19405
19857
  const expression = state.compilePattern(pattern);
19858
+ const from = pattern.beforeNode ? offset : 0;
19859
+ const subject = value.slice(from, pattern.afterNode ? end : undefined);
19406
19860
  let match;
19407
- while (match = expression.exec(value)) {
19861
+ while (match = expression.exec(subject)) {
19408
19862
  const before = "before" in pattern || Boolean(pattern.atBreak);
19409
19863
  const after = "after" in pattern;
19410
- const position = match.index + (before ? match[1].length : 0);
19411
- if (positions.includes(position)) {
19864
+ const position = from + match.index + (before ? match[1].length : 0);
19865
+ if (own7.call(infos, position)) {
19412
19866
  if (infos[position].before && !before) {
19413
19867
  infos[position].before = false;
19414
19868
  }
@@ -19422,31 +19876,53 @@ function safe(state, input, config) {
19422
19876
  }
19423
19877
  }
19424
19878
  positions.sort(numerical);
19425
- let start = config.before ? config.before.length : 0;
19426
- const end = value.length - (config.after ? config.after.length : 0);
19879
+ let start = offset;
19427
19880
  index = -1;
19428
19881
  while (++index < positions.length) {
19429
19882
  const position = positions[index];
19430
19883
  if (position < start || position >= end) {
19431
19884
  continue;
19432
19885
  }
19886
+ if (value.charAt(position) === "_" && position > 0 && classifyCharacter(value.charCodeAt(position - 1)) === undefined && !own7.call(infos, position - 1) && !(position - 1 === offset && /[*_]/.test(value.charAt(offset - 1)))) {
19887
+ let sequenceEnd = position + 1;
19888
+ while (sequenceEnd < end && value.charAt(sequenceEnd) === "_") {
19889
+ sequenceEnd++;
19890
+ }
19891
+ const skip = sequenceEnd - position - 1;
19892
+ if (positions[index + skip] === sequenceEnd - 1 && sequenceEnd < value.length && classifyCharacter(value.charCodeAt(sequenceEnd)) === undefined && !own7.call(infos, sequenceEnd) && !(sequenceEnd === end - 1 && /[*_]/.test(value.charAt(end)))) {
19893
+ index += skip;
19894
+ continue;
19895
+ }
19896
+ }
19433
19897
  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) {
19434
19898
  continue;
19435
19899
  }
19436
19900
  if (start !== position) {
19437
- result.push(escapeBackslashes(value.slice(start, position), "\\"));
19901
+ const slice = value.slice(start, position);
19902
+ result.push(percentEncode ? slice : escapeBackslashes(slice, "\\"));
19438
19903
  }
19439
19904
  start = position;
19440
- if (/[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || !config.encode.includes(value.charAt(position)))) {
19905
+ if (percentEncode) {
19906
+ result.push("%" + value.charCodeAt(position).toString(16).toUpperCase().padStart(2, "0"));
19907
+ start++;
19908
+ } else if (/[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || !config.encode.includes(value.charAt(position)))) {
19441
19909
  result.push("\\");
19442
19910
  } else {
19443
19911
  result.push(encodeCharacterReference(value.charCodeAt(position)));
19444
19912
  start++;
19445
19913
  }
19446
19914
  }
19447
- result.push(escapeBackslashes(value.slice(start, end), config.after));
19915
+ const rest = value.slice(start, end);
19916
+ result.push(percentEncode ? rest : escapeBackslashes(rest, config.after));
19448
19917
  return result.join("");
19449
19918
  }
19919
+ function nodeInScope(types, node) {
19920
+ if (!types)
19921
+ return true;
19922
+ if (!node)
19923
+ return false;
19924
+ return typeof types === "string" ? types === node.type : types.includes(node.type);
19925
+ }
19450
19926
  function numerical(a, b) {
19451
19927
  return a - b;
19452
19928
  }
@@ -19471,7 +19947,11 @@ function escapeBackslashes(value, after) {
19471
19947
  results.push(value.slice(start));
19472
19948
  return results.join("");
19473
19949
  }
19474
- var init_safe = () => {};
19950
+ var own7;
19951
+ var init_safe = __esm(() => {
19952
+ init_dev6();
19953
+ own7 = {}.hasOwnProperty;
19954
+ });
19475
19955
 
19476
19956
  // ../../node_modules/mdast-util-to-markdown/lib/util/track.js
19477
19957
  function track(config) {
@@ -19502,6 +19982,8 @@ function toMarkdown(tree, options) {
19502
19982
  const settings = options || {};
19503
19983
  const state = {
19504
19984
  associationId: association,
19985
+ bulletCurrent: undefined,
19986
+ bulletLastUsed: undefined,
19505
19987
  containerPhrasing: containerPhrasingBound,
19506
19988
  containerFlow: containerFlowBound,
19507
19989
  createTracker: track,
@@ -19526,14 +20008,9 @@ function toMarkdown(tree, options) {
19526
20008
  unknown,
19527
20009
  handlers: state.handlers
19528
20010
  });
19529
- let result = state.handle(tree, undefined, state, {
19530
- before: `
19531
- `,
19532
- after: `
19533
- `,
19534
- now: { line: 1, column: 1 },
19535
- lineShift: 0
19536
- });
20011
+ let result = state.handle(phrasing(tree) ? { type: "root", children: [tree] } : tree, undefined, state, { before: `
20012
+ `, after: `
20013
+ `, now: { line: 1, column: 1 }, lineShift: 0 });
19537
20014
  if (result && result.charCodeAt(result.length - 1) !== 10 && result.charCodeAt(result.length - 1) !== 13) {
19538
20015
  result += `
19539
20016
  `;
@@ -19569,6 +20046,7 @@ function safeBound(value, config) {
19569
20046
  return safe(this, value, config);
19570
20047
  }
19571
20048
  var init_lib17 = __esm(() => {
20049
+ init_mdast_util_phrasing();
19572
20050
  init_zwitch();
19573
20051
  init_configure();
19574
20052
  init_handle();
@@ -20134,7 +20612,7 @@ function previousUnbalanced(events) {
20134
20612
  }
20135
20613
  return result;
20136
20614
  }
20137
- var wwwPrefix, domain, path, trail, emailDomainDotTrail, wwwAutolink, protocolAutolink, emailAutolink, text4, code2;
20615
+ var wwwPrefix, domain, path, trail, emailDomainDotTrail, wwwAutolink, protocolAutolink, emailAutolink, text4, code3;
20138
20616
  var init_syntax2 = __esm(() => {
20139
20617
  init_dev4();
20140
20618
  init_default();
@@ -20162,14 +20640,14 @@ var init_syntax2 = __esm(() => {
20162
20640
  previous: previousEmail
20163
20641
  };
20164
20642
  text4 = {};
20165
- code2 = codes.digit0;
20166
- while (code2 < codes.leftCurlyBrace) {
20167
- text4[code2] = emailAutolink;
20168
- code2++;
20169
- if (code2 === codes.colon)
20170
- code2 = codes.uppercaseA;
20171
- else if (code2 === codes.leftSquareBracket)
20172
- code2 = codes.lowercaseA;
20643
+ code3 = codes.digit0;
20644
+ while (code3 < codes.leftCurlyBrace) {
20645
+ text4[code3] = emailAutolink;
20646
+ code3++;
20647
+ if (code3 === codes.colon)
20648
+ code3 = codes.uppercaseA;
20649
+ else if (code3 === codes.leftSquareBracket)
20650
+ code3 = codes.lowercaseA;
20173
20651
  }
20174
20652
  text4[codes.plusSign] = emailAutolink;
20175
20653
  text4[codes.dash] = emailAutolink;
@@ -20567,12 +21045,13 @@ var init_dev19 = __esm(() => {
20567
21045
  });
20568
21046
 
20569
21047
  // ../../node_modules/micromark-extension-gfm-table/dev/lib/edit-map.js
20570
- class EditMap {
21048
+ class EditMap2 {
20571
21049
  constructor() {
20572
21050
  this.map = [];
21051
+ this.index = new Map;
20573
21052
  }
20574
21053
  add(index, remove, add) {
20575
- addImplementation(this, index, remove, add);
21054
+ addImplementation2(this, index, remove, add);
20576
21055
  }
20577
21056
  consume(events) {
20578
21057
  this.map.sort(function(a, b) {
@@ -20598,22 +21077,22 @@ class EditMap {
20598
21077
  slice = vecs.pop();
20599
21078
  }
20600
21079
  this.map.length = 0;
21080
+ this.index.clear();
20601
21081
  }
20602
21082
  }
20603
- function addImplementation(editMap, at, remove, add) {
20604
- let index = 0;
21083
+ function addImplementation2(editMap, at, remove, add) {
20605
21084
  if (remove === 0 && add.length === 0) {
20606
21085
  return;
20607
21086
  }
20608
- while (index < editMap.map.length) {
20609
- if (editMap.map[index][0] === at) {
20610
- editMap.map[index][1] += remove;
20611
- editMap.map[index][2].push(...add);
20612
- return;
20613
- }
20614
- index += 1;
21087
+ const existing = editMap.index.get(at);
21088
+ if (existing) {
21089
+ existing[1] += remove;
21090
+ existing[2].push(...add);
21091
+ return;
20615
21092
  }
20616
- editMap.map.push([at, remove, add]);
21093
+ const change = [at, remove, add];
21094
+ editMap.map.push(change);
21095
+ editMap.index.set(at, change);
20617
21096
  }
20618
21097
 
20619
21098
  // ../../node_modules/micromark-extension-gfm-table/dev/lib/infer.js
@@ -20664,11 +21143,12 @@ function tokenizeTable(effects, ok2, nok) {
20664
21143
  function start(code) {
20665
21144
  let index = self2.events.length - 1;
20666
21145
  while (index > -1) {
20667
- const type = self2.events[index][1].type;
20668
- if (type === types.lineEnding || type === types.linePrefix)
21146
+ const { type } = self2.events[index][1];
21147
+ if (type === types.lineEnding || type === types.linePrefix) {
20669
21148
  index--;
20670
- else
21149
+ } else {
20671
21150
  break;
21151
+ }
20672
21152
  }
20673
21153
  const tail = index > -1 ? self2.events[index][1].type : null;
20674
21154
  const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
@@ -20883,7 +21363,7 @@ function resolveTable(events, context) {
20883
21363
  let currentTable;
20884
21364
  let currentBody;
20885
21365
  let currentCell;
20886
- const map = new EditMap;
21366
+ const map = new EditMap2;
20887
21367
  while (++index < events.length) {
20888
21368
  const event = events[index];
20889
21369
  const token = event[1];
@@ -21894,7 +22374,7 @@ var init_dangerous = __esm(() => {
21894
22374
  // ../../node_modules/stringify-entities/lib/util/to-named.js
21895
22375
  function toNamed(code, next, omit, attribute) {
21896
22376
  const character = String.fromCharCode(code);
21897
- if (own7.call(characters, character)) {
22377
+ if (own8.call(characters, character)) {
21898
22378
  const name = characters[character];
21899
22379
  const value = "&" + name;
21900
22380
  if (omit && characterEntitiesLegacy.includes(name) && !dangerous.includes(name) && (!attribute || next && next !== 61 && notAlphanumericRegex.test(String.fromCharCode(next)))) {
@@ -21904,15 +22384,15 @@ function toNamed(code, next, omit, attribute) {
21904
22384
  }
21905
22385
  return "";
21906
22386
  }
21907
- var own7, characters, key, notAlphanumericRegex;
22387
+ var own8, characters, key, notAlphanumericRegex;
21908
22388
  var init_to_named = __esm(() => {
21909
22389
  init_character_entities_legacy();
21910
22390
  init_character_entities_html4();
21911
22391
  init_dangerous();
21912
- own7 = {}.hasOwnProperty;
22392
+ own8 = {}.hasOwnProperty;
21913
22393
  characters = {};
21914
22394
  for (key in characterEntitiesHtml4) {
21915
- if (own7.call(characterEntitiesHtml4, key)) {
22395
+ if (own8.call(characterEntitiesHtml4, key)) {
21916
22396
  characters[characterEntitiesHtml4[key]] = key;
21917
22397
  }
21918
22398
  }
@@ -22100,12 +22580,14 @@ function directiveToMarkdown(options) {
22100
22580
  inConstruct: ["leafDirectiveLabel", "containerDirectiveLabel"]
22101
22581
  },
22102
22582
  {
22583
+ after: "[^\\s\\p{P}\\p{S}]",
22103
22584
  before: "[^:]",
22104
22585
  character: ":",
22105
- after: "[A-Za-z]",
22106
- inConstruct: ["phrasing"]
22586
+ inConstruct: ["phrasing"],
22587
+ unicode: true
22107
22588
  },
22108
- { atBreak: true, character: ":", after: ":" }
22589
+ { afterNode: "textDirective", character: ":", inConstruct: ["phrasing"] },
22590
+ { atBreak: true, before: ":+", character: ":" }
22109
22591
  ]
22110
22592
  };
22111
22593
  function handleDirective(node, _, state, info) {
@@ -22113,6 +22595,8 @@ function directiveToMarkdown(options) {
22113
22595
  const sequence = fence3(node);
22114
22596
  const exit = state.enter(node.type);
22115
22597
  let value = tracker.move(sequence + (node.name || ""));
22598
+ const attributesValue = attributes(node, state);
22599
+ const after = info.after.charCodeAt(0);
22116
22600
  let label;
22117
22601
  if (node.type === "containerDirective") {
22118
22602
  const head = (node.children || [])[0];
@@ -22133,8 +22617,10 @@ function directiveToMarkdown(options) {
22133
22617
  value += tracker.move("]");
22134
22618
  subexit();
22135
22619
  exit();
22620
+ } else if (!attributesValue && (after === 45 || after === 95 || !(unicodePunctuation(after) || unicodeWhitespace(after)))) {
22621
+ value += tracker.move("[]");
22136
22622
  }
22137
- value += tracker.move(attributes(node, state));
22623
+ value += tracker.move(attributesValue || (after === 123 ? "{}" : ""));
22138
22624
  if (node.type === "containerDirective") {
22139
22625
  const head = (node.children || [])[0];
22140
22626
  let shallow = node;
@@ -22160,12 +22646,12 @@ function directiveToMarkdown(options) {
22160
22646
  let id;
22161
22647
  let key;
22162
22648
  for (key in attributes) {
22163
- if (own8.call(attributes, key) && attributes[key] !== undefined && attributes[key] !== null) {
22649
+ if (own9.call(attributes, key) && attributes[key] !== undefined && attributes[key] !== null) {
22164
22650
  const value = String(attributes[key]);
22165
22651
  if (key === "id") {
22166
22652
  id = settings.preferShortcut !== false && shortcut.test(value) ? "#" + value : quoted("id", value, node, state);
22167
22653
  } else if (key === "class") {
22168
- const list = value.split(/[\t\n\r ]+/g);
22654
+ const list = value.split(/[\t\n\r ]+/);
22169
22655
  const classesFullList = [];
22170
22656
  const classesList = [];
22171
22657
  let index = -1;
@@ -22311,13 +22797,14 @@ function fence3(node) {
22311
22797
  }
22312
22798
  return ":".repeat(size);
22313
22799
  }
22314
- var own8, emptyOptions4, shortcut, unquoted;
22800
+ var own9, emptyOptions4, shortcut, unquoted;
22315
22801
  var init_lib25 = __esm(() => {
22316
22802
  init_development();
22803
+ init_dev4();
22317
22804
  init_parse_entities();
22318
22805
  init_stringify_entities();
22319
22806
  init_unist_util_visit_parents3();
22320
- own8 = {}.hasOwnProperty;
22807
+ own9 = {}.hasOwnProperty;
22321
22808
  emptyOptions4 = {};
22322
22809
  shortcut = /^[^\t\n\r "#'.<=>`}]+$/;
22323
22810
  unquoted = /^[^\t\n\r "'<=>`}]+$/;
@@ -24575,7 +25062,7 @@ function element(state, node) {
24575
25062
  while (++index < node.attrs.length) {
24576
25063
  const attribute = node.attrs[index];
24577
25064
  const name = (attribute.prefix ? attribute.prefix + ":" : "") + attribute.name;
24578
- if (!own9.call(proto, name)) {
25065
+ if (!own10.call(proto, name)) {
24579
25066
  properties[name] = attribute.value;
24580
25067
  }
24581
25068
  }
@@ -24617,7 +25104,7 @@ function createLocation(state, node, location) {
24617
25104
  let key;
24618
25105
  if (location.attrs) {
24619
25106
  for (key in location.attrs) {
24620
- if (own9.call(location.attrs, key)) {
25107
+ if (own10.call(location.attrs, key)) {
24621
25108
  properties[find(state.schema, key).property] = position2(location.attrs[key]);
24622
25109
  }
24623
25110
  }
@@ -24650,14 +25137,14 @@ function position2(loc) {
24650
25137
  function point3(point) {
24651
25138
  return point.line && point.column ? point : undefined;
24652
25139
  }
24653
- var own9, proto;
25140
+ var own10, proto;
24654
25141
  var init_lib29 = __esm(() => {
24655
25142
  init_development();
24656
25143
  init_hastscript();
24657
25144
  init_property_information();
24658
25145
  init_vfile_location();
24659
25146
  init_web_namespaces();
24660
- own9 = {}.hasOwnProperty;
25147
+ own10 = {}.hasOwnProperty;
24661
25148
  proto = Object.prototype;
24662
25149
  });
24663
25150