@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.
package/dist/markdown.js CHANGED
@@ -3911,7 +3911,7 @@ var init_dev4 = __esm(() => {
3911
3911
 
3912
3912
  // ../../node_modules/micromark-factory-space/dev/index.js
3913
3913
  function factorySpace(effects, ok, type, max) {
3914
- const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
3914
+ const limit = max ? max - 1 : Infinity;
3915
3915
  let size = 0;
3916
3916
  return start;
3917
3917
  function start(code) {
@@ -3930,6 +3930,29 @@ function factorySpace(effects, ok, type, max) {
3930
3930
  return ok(code);
3931
3931
  }
3932
3932
  }
3933
+ function factorySpaceMinMax(effects, ok, nok, type, min, max) {
3934
+ let size = 0;
3935
+ return start;
3936
+ function start(code) {
3937
+ if (max > 0 && markdownSpace(code)) {
3938
+ effects.enter(type);
3939
+ return prefix(code);
3940
+ }
3941
+ return after(code);
3942
+ }
3943
+ function prefix(code) {
3944
+ if (markdownSpace(code) && size < max) {
3945
+ effects.consume(code);
3946
+ size++;
3947
+ return prefix;
3948
+ }
3949
+ effects.exit(type);
3950
+ return after(code);
3951
+ }
3952
+ function after(code) {
3953
+ return size >= min ? ok(code) : nok(code);
3954
+ }
3955
+ }
3933
3956
  var init_dev5 = __esm(() => {
3934
3957
  init_dev4();
3935
3958
  });
@@ -3991,6 +4014,65 @@ var init_content = __esm(() => {
3991
4014
  content = { tokenize: initializeContent };
3992
4015
  });
3993
4016
 
4017
+ // ../../node_modules/micromark-util-edit-map/dev/index.js
4018
+ class EditMap {
4019
+ constructor() {
4020
+ this.index = new Map;
4021
+ this.map = [];
4022
+ }
4023
+ add(index, remove, add) {
4024
+ addImplementation(this, index, remove, add, false);
4025
+ }
4026
+ addBefore(index, remove, add) {
4027
+ addImplementation(this, index, remove, add, true);
4028
+ }
4029
+ consume(events) {
4030
+ this.map.sort(function(a, b) {
4031
+ return a[0] - b[0];
4032
+ });
4033
+ if (this.map.length === 0) {
4034
+ return;
4035
+ }
4036
+ let index = this.map.length;
4037
+ const vecs = [];
4038
+ while (index > 0) {
4039
+ index -= 1;
4040
+ vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);
4041
+ events.length = this.map[index][0];
4042
+ }
4043
+ vecs.push(events.slice());
4044
+ events.length = 0;
4045
+ let slice = vecs.pop();
4046
+ while (slice) {
4047
+ for (const element of slice) {
4048
+ events.push(element);
4049
+ }
4050
+ slice = vecs.pop();
4051
+ }
4052
+ this.map.length = 0;
4053
+ this.index.clear();
4054
+ }
4055
+ }
4056
+ function addImplementation(editMap, at, remove, add, before) {
4057
+ if (remove === 0 && add.length === 0) {
4058
+ return;
4059
+ }
4060
+ const existing = editMap.index.get(at);
4061
+ if (existing) {
4062
+ existing[1] += remove;
4063
+ if (before) {
4064
+ add.push(...existing[2]);
4065
+ existing[2] = add;
4066
+ } else {
4067
+ existing[2].push(...add);
4068
+ }
4069
+ return;
4070
+ }
4071
+ const change = [at, remove, add];
4072
+ editMap.map.push(change);
4073
+ editMap.index.set(at, change);
4074
+ }
4075
+
3994
4076
  // ../../node_modules/micromark/dev/lib/initialize/document.js
3995
4077
  function initializeDocument(effects) {
3996
4078
  const self2 = this;
@@ -4033,8 +4115,10 @@ function initializeDocument(effects) {
4033
4115
  self2.events[index][1].end = { ...point };
4034
4116
  index++;
4035
4117
  }
4036
- splice(self2.events, indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
4037
- self2.events.length = index;
4118
+ const editMap = new EditMap;
4119
+ editMap.add(indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
4120
+ editMap.add(indexBeforeExits, index - indexBeforeExits, []);
4121
+ editMap.consume(self2.events);
4038
4122
  return checkNewContainers(code);
4039
4123
  }
4040
4124
  return start(code);
@@ -4053,8 +4137,9 @@ function initializeDocument(effects) {
4053
4137
  return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code);
4054
4138
  }
4055
4139
  function thereIsANewContainer(code) {
4056
- if (childFlow)
4140
+ if (childFlow) {
4057
4141
  closeFlow();
4142
+ }
4058
4143
  exitContainers(continued);
4059
4144
  return documentContinued(code);
4060
4145
  }
@@ -4076,8 +4161,9 @@ function initializeDocument(effects) {
4076
4161
  }
4077
4162
  function flowStart(code) {
4078
4163
  if (code === codes.eof) {
4079
- if (childFlow)
4164
+ if (childFlow) {
4080
4165
  closeFlow();
4166
+ }
4081
4167
  exitContainers(0);
4082
4168
  effects.consume(code);
4083
4169
  return;
@@ -4110,11 +4196,13 @@ function initializeDocument(effects) {
4110
4196
  function writeToChild(token, endOfFile) {
4111
4197
  ok(childFlow, "expected `childFlow` to be defined when continuing");
4112
4198
  const stream = self2.sliceStream(token);
4113
- if (endOfFile)
4199
+ if (endOfFile) {
4114
4200
  stream.push(null);
4201
+ }
4115
4202
  token.previous = childToken;
4116
- if (childToken)
4203
+ if (childToken) {
4117
4204
  childToken.next = token;
4205
+ }
4118
4206
  childToken = token;
4119
4207
  childFlow.defineSkip(token.start);
4120
4208
  childFlow.write(stream);
@@ -4145,8 +4233,10 @@ function initializeDocument(effects) {
4145
4233
  self2.events[index][1].end = { ...point };
4146
4234
  index++;
4147
4235
  }
4148
- splice(self2.events, indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
4149
- self2.events.length = index;
4236
+ const editMap = new EditMap;
4237
+ editMap.add(indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
4238
+ editMap.add(indexBeforeExits, index - indexBeforeExits, []);
4239
+ editMap.consume(self2.events);
4150
4240
  }
4151
4241
  }
4152
4242
  function exitContainers(size) {
@@ -4177,7 +4267,6 @@ var init_document = __esm(() => {
4177
4267
  init_development();
4178
4268
  init_dev5();
4179
4269
  init_dev4();
4180
- init_dev();
4181
4270
  init_default();
4182
4271
  document2 = { tokenize: initializeDocument };
4183
4272
  containerConstruct = { tokenize: tokenizeContainer };
@@ -4214,43 +4303,36 @@ function resolveAll(constructs, events, context) {
4214
4303
  // ../../node_modules/micromark-core-commonmark/dev/lib/attention.js
4215
4304
  function resolveAllAttention(events, context) {
4216
4305
  let index = -1;
4217
- let open;
4218
- let group;
4219
- let text;
4220
- let openingSequence;
4221
- let closingSequence;
4222
- let use;
4223
4306
  let nextEvents;
4224
- let offset;
4225
4307
  while (++index < events.length) {
4226
4308
  if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
4227
- open = index;
4309
+ let open = index;
4228
4310
  while (open--) {
4229
4311
  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)) {
4230
4312
  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)) {
4231
4313
  continue;
4232
4314
  }
4233
- 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;
4315
+ 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;
4234
4316
  const start = { ...events[open][1].end };
4235
4317
  const end = { ...events[index][1].start };
4236
4318
  movePoint(start, -use);
4237
4319
  movePoint(end, use);
4238
- openingSequence = {
4320
+ const openingSequence = {
4239
4321
  type: use > 1 ? types.strongSequence : types.emphasisSequence,
4240
4322
  start,
4241
4323
  end: { ...events[open][1].end }
4242
4324
  };
4243
- closingSequence = {
4325
+ const closingSequence = {
4244
4326
  type: use > 1 ? types.strongSequence : types.emphasisSequence,
4245
4327
  start: { ...events[index][1].start },
4246
4328
  end
4247
4329
  };
4248
- text = {
4330
+ const text = {
4249
4331
  type: use > 1 ? types.strongText : types.emphasisText,
4250
4332
  start: { ...events[open][1].end },
4251
4333
  end: { ...events[index][1].start }
4252
4334
  };
4253
- group = {
4335
+ const group = {
4254
4336
  type: use > 1 ? types.strong : types.emphasis,
4255
4337
  start: { ...openingSequence.start },
4256
4338
  end: { ...closingSequence.end }
@@ -4278,14 +4360,13 @@ function resolveAllAttention(events, context) {
4278
4360
  ["exit", closingSequence, context],
4279
4361
  ["exit", group, context]
4280
4362
  ]);
4363
+ let offset = 0;
4281
4364
  if (events[index][1].end.offset - events[index][1].start.offset) {
4282
4365
  offset = 2;
4283
4366
  nextEvents = push(nextEvents, [
4284
4367
  ["enter", events[index][1], context],
4285
4368
  ["exit", events[index][1], context]
4286
4369
  ]);
4287
- } else {
4288
- offset = 0;
4289
4370
  }
4290
4371
  splice(events, open - 1, index - open + 3, nextEvents);
4291
4372
  index = open + nextEvents.length - offset - 2;
@@ -4322,8 +4403,8 @@ function tokenizeAttention(effects, ok2) {
4322
4403
  const token = effects.exit("attentionSequence");
4323
4404
  const after = classifyCharacter(code);
4324
4405
  ok(attentionMarkers, "expected `attentionMarkers` to be populated");
4325
- const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers.includes(code);
4326
- const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers.includes(previous);
4406
+ const open = !after || after === constants.characterGroupPunctuation && before || attentionMarkers.includes(code) && code !== codes.asterisk && code !== codes.underscore;
4407
+ const close = !before || before === constants.characterGroupPunctuation && after || attentionMarkers.includes(previous) && previous !== codes.asterisk && previous !== codes.underscore;
4327
4408
  token._open = Boolean(marker === codes.asterisk ? open : open && (before || !close));
4328
4409
  token._close = Boolean(marker === codes.asterisk ? close : close && (after || !open));
4329
4410
  return ok2(code);
@@ -4639,6 +4720,35 @@ var init_character_reference = __esm(() => {
4639
4720
  };
4640
4721
  });
4641
4722
 
4723
+ // ../../node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js
4724
+ function tokenizeNonLazyContinuation(effects, ok2, nok) {
4725
+ const self2 = this;
4726
+ return start;
4727
+ function start(code) {
4728
+ if (code === codes.eof) {
4729
+ return nok(code);
4730
+ }
4731
+ ok(markdownLineEnding(code), "expected eol");
4732
+ effects.enter(types.lineEnding);
4733
+ effects.consume(code);
4734
+ effects.exit(types.lineEnding);
4735
+ return after;
4736
+ }
4737
+ function after(code) {
4738
+ return self2.parser.lazy[self2.now().line] ? nok(code) : ok2(code);
4739
+ }
4740
+ }
4741
+ var nonLazyContinuation;
4742
+ var init_partial_non_lazy_continuation = __esm(() => {
4743
+ init_development();
4744
+ init_dev4();
4745
+ init_default();
4746
+ nonLazyContinuation = {
4747
+ partial: true,
4748
+ tokenize: tokenizeNonLazyContinuation
4749
+ };
4750
+ });
4751
+
4642
4752
  // ../../node_modules/micromark-core-commonmark/dev/lib/code-fenced.js
4643
4753
  function tokenizeCodeFenced(effects, ok2, nok) {
4644
4754
  const self2 = this;
@@ -4794,33 +4904,13 @@ function tokenizeCodeFenced(effects, ok2, nok) {
4794
4904
  }
4795
4905
  }
4796
4906
  }
4797
- function tokenizeNonLazyContinuation(effects, ok2, nok) {
4798
- const self2 = this;
4799
- return start;
4800
- function start(code) {
4801
- if (code === codes.eof) {
4802
- return nok(code);
4803
- }
4804
- ok(markdownLineEnding(code), "expected eol");
4805
- effects.enter(types.lineEnding);
4806
- effects.consume(code);
4807
- effects.exit(types.lineEnding);
4808
- return lineStart;
4809
- }
4810
- function lineStart(code) {
4811
- return self2.parser.lazy[self2.now().line] ? nok(code) : ok2(code);
4812
- }
4813
- }
4814
- var nonLazyContinuation, codeFenced;
4907
+ var codeFenced;
4815
4908
  var init_code_fenced = __esm(() => {
4816
4909
  init_development();
4817
4910
  init_dev5();
4818
4911
  init_dev4();
4819
4912
  init_default();
4820
- nonLazyContinuation = {
4821
- partial: true,
4822
- tokenize: tokenizeNonLazyContinuation
4823
- };
4913
+ init_partial_non_lazy_continuation();
4824
4914
  codeFenced = {
4825
4915
  concrete: true,
4826
4916
  name: "codeFenced",
@@ -4830,16 +4920,11 @@ var init_code_fenced = __esm(() => {
4830
4920
 
4831
4921
  // ../../node_modules/micromark-core-commonmark/dev/lib/code-indented.js
4832
4922
  function tokenizeCodeIndented(effects, ok2, nok) {
4833
- const self2 = this;
4834
4923
  return start;
4835
4924
  function start(code) {
4836
4925
  ok(markdownSpace(code));
4837
4926
  effects.enter(types.codeIndented);
4838
- return factorySpace(effects, afterPrefix, types.linePrefix, constants.tabSize + 1)(code);
4839
- }
4840
- function afterPrefix(code) {
4841
- const tail = self2.events[self2.events.length - 1];
4842
- return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? atBreak(code) : nok(code);
4927
+ return factorySpaceMinMax(effects, atBreak, nok, types.linePrefix, constants.tabSize, constants.tabSize)(code);
4843
4928
  }
4844
4929
  function atBreak(code) {
4845
4930
  if (code === codes.eof) {
@@ -4877,11 +4962,10 @@ function tokenizeFurtherStart(effects, ok, nok) {
4877
4962
  effects.exit(types.lineEnding);
4878
4963
  return furtherStart;
4879
4964
  }
4880
- return factorySpace(effects, afterPrefix, types.linePrefix, constants.tabSize + 1)(code);
4965
+ return factorySpaceMinMax(effects, ok, onNotEnoughPrefix, types.linePrefix, constants.tabSize, constants.tabSize)(code);
4881
4966
  }
4882
- function afterPrefix(code) {
4883
- const tail = self2.events[self2.events.length - 1];
4884
- return tail && tail[1].type === types.linePrefix && tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code);
4967
+ function onNotEnoughPrefix(code) {
4968
+ return markdownLineEnding(code) ? furtherStart(code) : nok(code);
4885
4969
  }
4886
4970
  }
4887
4971
  var codeIndented, furtherStart;
@@ -5691,8 +5775,6 @@ var init_hard_break_escape = __esm(() => {
5691
5775
  function resolveHeadingAtx(events, context) {
5692
5776
  let contentEnd = events.length - 2;
5693
5777
  let contentStart = 3;
5694
- let content;
5695
- let text;
5696
5778
  if (events[contentStart][1].type === types.whitespace) {
5697
5779
  contentStart += 2;
5698
5780
  }
@@ -5703,12 +5785,12 @@ function resolveHeadingAtx(events, context) {
5703
5785
  contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
5704
5786
  }
5705
5787
  if (contentEnd > contentStart) {
5706
- content = {
5788
+ const content = {
5707
5789
  type: types.atxHeadingText,
5708
5790
  start: events[contentStart][1].start,
5709
5791
  end: events[contentEnd][1].end
5710
5792
  };
5711
- text = {
5793
+ const text = {
5712
5794
  type: types.chunkText,
5713
5795
  start: events[contentStart][1].start,
5714
5796
  end: events[contentEnd][1].end,
@@ -6127,7 +6209,7 @@ function tokenizeHtmlFlow(effects, ok2, nok) {
6127
6209
  return continuation;
6128
6210
  }
6129
6211
  function continuationStart(code) {
6130
- return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code);
6212
+ return effects.check(nonLazyContinuation, continuationStartNonLazy, continuationAfter)(code);
6131
6213
  }
6132
6214
  function continuationStartNonLazy(code) {
6133
6215
  ok(markdownLineEnding(code));
@@ -6206,22 +6288,6 @@ function tokenizeHtmlFlow(effects, ok2, nok) {
6206
6288
  return ok2(code);
6207
6289
  }
6208
6290
  }
6209
- function tokenizeNonLazyContinuationStart(effects, ok, nok) {
6210
- const self2 = this;
6211
- return start;
6212
- function start(code) {
6213
- if (markdownLineEnding(code)) {
6214
- effects.enter(types.lineEnding);
6215
- effects.consume(code);
6216
- effects.exit(types.lineEnding);
6217
- return after;
6218
- }
6219
- return nok(code);
6220
- }
6221
- function after(code) {
6222
- return self2.parser.lazy[self2.now().line] ? nok(code) : ok(code);
6223
- }
6224
- }
6225
6291
  function tokenizeBlankLineBefore(effects, ok2, nok) {
6226
6292
  return start;
6227
6293
  function start(code) {
@@ -6232,13 +6298,14 @@ function tokenizeBlankLineBefore(effects, ok2, nok) {
6232
6298
  return effects.attempt(blankLine, ok2, nok);
6233
6299
  }
6234
6300
  }
6235
- var htmlFlow, blankLineBefore, nonLazyContinuationStart;
6301
+ var htmlFlow, blankLineBefore;
6236
6302
  var init_html_flow = __esm(() => {
6237
6303
  init_development();
6238
6304
  init_dev4();
6239
6305
  init_micromark_util_html_tag_name();
6240
6306
  init_default();
6241
6307
  init_blank_line();
6308
+ init_partial_non_lazy_continuation();
6242
6309
  htmlFlow = {
6243
6310
  concrete: true,
6244
6311
  name: "htmlFlow",
@@ -6246,10 +6313,6 @@ var init_html_flow = __esm(() => {
6246
6313
  tokenize: tokenizeHtmlFlow
6247
6314
  };
6248
6315
  blankLineBefore = { partial: true, tokenize: tokenizeBlankLineBefore };
6249
- nonLazyContinuationStart = {
6250
- partial: true,
6251
- tokenize: tokenizeNonLazyContinuationStart
6252
- };
6253
6316
  });
6254
6317
 
6255
6318
  // ../../node_modules/micromark-core-commonmark/dev/lib/html-text.js
@@ -6587,12 +6650,11 @@ function resolveAllLabelEnd(events) {
6587
6650
  function resolveToLabelEnd(events, context) {
6588
6651
  let index = events.length;
6589
6652
  let offset = 0;
6590
- let token;
6591
6653
  let open;
6592
6654
  let close;
6593
6655
  let media;
6594
6656
  while (index--) {
6595
- token = events[index][1];
6657
+ const token = events[index][1];
6596
6658
  if (open) {
6597
6659
  if (token.type === types.link || token.type === types.labelLink && token._inactive) {
6598
6660
  break;
@@ -6650,14 +6712,14 @@ function resolveToLabelEnd(events, context) {
6650
6712
  }
6651
6713
  function tokenizeLabelEnd(effects, ok2, nok) {
6652
6714
  const self2 = this;
6653
- let index = self2.events.length;
6715
+ const labelStarts = self2._labelStarts;
6654
6716
  let labelStart;
6655
6717
  let defined;
6656
- while (index--) {
6657
- if ((self2.events[index][1].type === types.labelImage || self2.events[index][1].type === types.labelLink) && !self2.events[index][1]._balanced) {
6658
- labelStart = self2.events[index][1];
6659
- break;
6718
+ if (labelStarts) {
6719
+ while (labelStarts.length > 0 && labelStarts[labelStarts.length - 1]._balanced) {
6720
+ labelStarts.pop();
6660
6721
  }
6722
+ labelStart = labelStarts[labelStarts.length - 1];
6661
6723
  }
6662
6724
  return start;
6663
6725
  function start(code) {
@@ -6689,6 +6751,8 @@ function tokenizeLabelEnd(effects, ok2, nok) {
6689
6751
  return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);
6690
6752
  }
6691
6753
  function labelEndOk(code) {
6754
+ ok(labelStarts, "expected `labelStarts` to be populated");
6755
+ labelStarts.pop();
6692
6756
  return ok2(code);
6693
6757
  }
6694
6758
  function labelEndNok(code) {
@@ -6801,6 +6865,7 @@ var init_label_end = __esm(() => {
6801
6865
  // ../../node_modules/micromark-core-commonmark/dev/lib/label-start-image.js
6802
6866
  function tokenizeLabelStartImage(effects, ok2, nok) {
6803
6867
  const self2 = this;
6868
+ let labelImage;
6804
6869
  return start;
6805
6870
  function start(code) {
6806
6871
  ok(code === codes.exclamationMark, "expected `!`");
@@ -6815,13 +6880,18 @@ function tokenizeLabelStartImage(effects, ok2, nok) {
6815
6880
  effects.enter(types.labelMarker);
6816
6881
  effects.consume(code);
6817
6882
  effects.exit(types.labelMarker);
6818
- effects.exit(types.labelImage);
6883
+ labelImage = effects.exit(types.labelImage);
6819
6884
  return after;
6820
6885
  }
6821
6886
  return nok(code);
6822
6887
  }
6823
6888
  function after(code) {
6824
- return code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code) : ok2(code);
6889
+ if (code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs) {
6890
+ return nok(code);
6891
+ }
6892
+ self2._labelStarts = self2._labelStarts || [];
6893
+ self2._labelStarts.push(labelImage);
6894
+ return ok2(code);
6825
6895
  }
6826
6896
  }
6827
6897
  var labelStartImage;
@@ -6839,6 +6909,7 @@ var init_label_start_image = __esm(() => {
6839
6909
  // ../../node_modules/micromark-core-commonmark/dev/lib/label-start-link.js
6840
6910
  function tokenizeLabelStartLink(effects, ok2, nok) {
6841
6911
  const self2 = this;
6912
+ let labelLink;
6842
6913
  return start;
6843
6914
  function start(code) {
6844
6915
  ok(code === codes.leftSquareBracket, "expected `[`");
@@ -6846,11 +6917,16 @@ function tokenizeLabelStartLink(effects, ok2, nok) {
6846
6917
  effects.enter(types.labelMarker);
6847
6918
  effects.consume(code);
6848
6919
  effects.exit(types.labelMarker);
6849
- effects.exit(types.labelLink);
6920
+ labelLink = effects.exit(types.labelLink);
6850
6921
  return after;
6851
6922
  }
6852
6923
  function after(code) {
6853
- return code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code) : ok2(code);
6924
+ if (code === codes.caret && "_hiddenFootnoteSupport" in self2.parser.constructs) {
6925
+ return nok(code);
6926
+ }
6927
+ self2._labelStarts = self2._labelStarts || [];
6928
+ self2._labelStarts.push(labelLink);
6929
+ return ok2(code);
6854
6930
  }
6855
6931
  }
6856
6932
  var labelStartLink;
@@ -7079,6 +7155,7 @@ var init_list = __esm(() => {
7079
7155
 
7080
7156
  // ../../node_modules/micromark-core-commonmark/dev/lib/setext-underline.js
7081
7157
  function resolveToSetextUnderline(events, context) {
7158
+ const editMap = new EditMap;
7082
7159
  let index = events.length;
7083
7160
  let content;
7084
7161
  let text;
@@ -7094,7 +7171,7 @@ function resolveToSetextUnderline(events, context) {
7094
7171
  }
7095
7172
  } else {
7096
7173
  if (events[index][1].type === types.content) {
7097
- events.splice(index, 1);
7174
+ editMap.add(index, 1, []);
7098
7175
  }
7099
7176
  if (!definition && events[index][1].type === types.definition) {
7100
7177
  definition = index;
@@ -7112,13 +7189,14 @@ function resolveToSetextUnderline(events, context) {
7112
7189
  };
7113
7190
  events[text][1].type = types.setextHeadingText;
7114
7191
  if (definition) {
7115
- events.splice(text, 0, ["enter", heading, context]);
7116
- events.splice(definition + 1, 0, ["exit", events[content][1], context]);
7192
+ editMap.add(text, 0, [["enter", heading, context]]);
7193
+ editMap.add(definition + 1, 0, [["exit", events[content][1], context]]);
7117
7194
  events[content][1].end = { ...events[definition][1].end };
7118
7195
  } else {
7119
7196
  events[content][1] = heading;
7120
7197
  }
7121
- events.push(["exit", heading, context]);
7198
+ editMap.add(events.length, 0, [["exit", heading, context]]);
7199
+ editMap.consume(events);
7122
7200
  return events;
7123
7201
  }
7124
7202
  function tokenizeSetextUnderline(effects, ok2, nok) {
@@ -7315,6 +7393,7 @@ function createResolver(extraResolver) {
7315
7393
  }
7316
7394
  }
7317
7395
  function resolveAllLineSuffixes(events, context) {
7396
+ const editMap = new EditMap;
7318
7397
  let eventIndex = 0;
7319
7398
  while (++eventIndex <= events.length) {
7320
7399
  if ((eventIndex === events.length || events[eventIndex][1].type === types.lineEnding) && events[eventIndex - 1][1].type === types.data) {
@@ -7332,8 +7411,9 @@ function resolveAllLineSuffixes(events, context) {
7332
7411
  size++;
7333
7412
  bufferIndex--;
7334
7413
  }
7335
- if (bufferIndex)
7414
+ if (bufferIndex) {
7336
7415
  break;
7416
+ }
7337
7417
  bufferIndex = -1;
7338
7418
  } else if (chunk === codes.horizontalTab) {
7339
7419
  tabs = true;
@@ -7362,13 +7442,16 @@ function resolveAllLineSuffixes(events, context) {
7362
7442
  if (data.start.offset === data.end.offset) {
7363
7443
  Object.assign(data, token);
7364
7444
  } else {
7365
- events.splice(eventIndex, 0, ["enter", token, context], ["exit", token, context]);
7366
- eventIndex += 2;
7445
+ editMap.add(eventIndex, 0, [
7446
+ ["enter", token, context],
7447
+ ["exit", token, context]
7448
+ ]);
7367
7449
  }
7368
7450
  }
7369
7451
  eventIndex++;
7370
7452
  }
7371
7453
  }
7454
+ editMap.consume(events);
7372
7455
  return events;
7373
7456
  }
7374
7457
  var resolver, string, text;
@@ -8255,11 +8338,10 @@ function createTokenizer(parser, initialize, from) {
8255
8338
  debug("position: define skip: `%j`", point);
8256
8339
  }
8257
8340
  function main() {
8258
- let chunkIndex;
8259
8341
  while (point._index < chunks.length) {
8260
8342
  const chunk = chunks[point._index];
8261
8343
  if (typeof chunk === "string") {
8262
- chunkIndex = point._index;
8344
+ const chunkIndex = point._index;
8263
8345
  if (point._bufferIndex < 0) {
8264
8346
  point._bufferIndex = 0;
8265
8347
  }
@@ -8468,7 +8550,7 @@ function serializeChunks(chunks, expandTabs) {
8468
8550
  let value;
8469
8551
  if (typeof chunk === "string") {
8470
8552
  value = chunk;
8471
- } else
8553
+ } else {
8472
8554
  switch (chunk) {
8473
8555
  case codes.carriageReturn: {
8474
8556
  value = values.cr;
@@ -8487,8 +8569,9 @@ function serializeChunks(chunks, expandTabs) {
8487
8569
  break;
8488
8570
  }
8489
8571
  case codes.virtualSpace: {
8490
- if (!expandTabs && atTab)
8572
+ if (!expandTabs && atTab) {
8491
8573
  continue;
8574
+ }
8492
8575
  value = values.space;
8493
8576
  break;
8494
8577
  }
@@ -8497,6 +8580,7 @@ function serializeChunks(chunks, expandTabs) {
8497
8580
  value = String.fromCharCode(chunk);
8498
8581
  }
8499
8582
  }
8583
+ }
8500
8584
  atTab = chunk === codes.horizontalTab;
8501
8585
  result.push(value);
8502
8586
  }
@@ -8561,14 +8645,9 @@ function preprocess() {
8561
8645
  let atCarriageReturn;
8562
8646
  return preprocessor;
8563
8647
  function preprocessor(value, encoding, end) {
8564
- const chunks = [];
8565
- let match;
8566
- let next;
8567
- let startPosition;
8568
- let endPosition;
8569
- let code;
8570
8648
  value = buffer + (typeof value === "string" ? value.toString() : new TextDecoder(encoding || undefined).decode(value));
8571
- startPosition = 0;
8649
+ const chunks = [];
8650
+ let startPosition = 0;
8572
8651
  buffer = "";
8573
8652
  if (start) {
8574
8653
  if (value.charCodeAt(0) === codes.byteOrderMarker) {
@@ -8578,9 +8657,9 @@ function preprocess() {
8578
8657
  }
8579
8658
  while (startPosition < value.length) {
8580
8659
  search.lastIndex = startPosition;
8581
- match = search.exec(value);
8582
- endPosition = match && match.index !== undefined ? match.index : value.length;
8583
- code = value.charCodeAt(endPosition);
8660
+ const match = search.exec(value);
8661
+ const endPosition = match && match.index !== undefined ? match.index : value.length;
8662
+ const code = value.charCodeAt(endPosition);
8584
8663
  if (!match) {
8585
8664
  buffer = value.slice(startPosition);
8586
8665
  break;
@@ -8604,10 +8683,11 @@ function preprocess() {
8604
8683
  break;
8605
8684
  }
8606
8685
  case codes.ht: {
8607
- next = Math.ceil(column / constants.tabSize) * constants.tabSize;
8686
+ const next = Math.ceil(column / constants.tabSize) * constants.tabSize;
8608
8687
  chunks.push(codes.horizontalTab);
8609
- while (column++ < next)
8688
+ while (column++ < next) {
8610
8689
  chunks.push(codes.virtualSpace);
8690
+ }
8611
8691
  break;
8612
8692
  }
8613
8693
  case codes.lf: {
@@ -8624,10 +8704,12 @@ function preprocess() {
8624
8704
  startPosition = endPosition + 1;
8625
8705
  }
8626
8706
  if (end) {
8627
- if (atCarriageReturn)
8707
+ if (atCarriageReturn) {
8628
8708
  chunks.push(codes.carriageReturn);
8629
- if (buffer)
8709
+ }
8710
+ if (buffer) {
8630
8711
  chunks.push(buffer);
8712
+ }
8631
8713
  chunks.push(codes.eof);
8632
8714
  }
8633
8715
  return chunks;
@@ -8680,6 +8762,8 @@ function fromMarkdown(value, encoding, options) {
8680
8762
  }
8681
8763
  function compiler(options) {
8682
8764
  const config = {
8765
+ afterExit: [],
8766
+ beforeEnter: [],
8683
8767
  transforms: [],
8684
8768
  canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
8685
8769
  enter: {
@@ -8781,7 +8865,7 @@ function compiler(options) {
8781
8865
  const data = {};
8782
8866
  return compile;
8783
8867
  function compile(events) {
8784
- let tree = { type: "root", children: [] };
8868
+ let tree = { type: "root", children: [], position: undefined };
8785
8869
  const context = {
8786
8870
  stack: [tree],
8787
8871
  tokenStack: [],
@@ -8793,23 +8877,32 @@ function compiler(options) {
8793
8877
  data
8794
8878
  };
8795
8879
  const listStack = [];
8880
+ const prepared = [];
8796
8881
  let index = -1;
8797
8882
  while (++index < events.length) {
8883
+ prepared.push(events[index]);
8798
8884
  if (events[index][1].type === types.listOrdered || events[index][1].type === types.listUnordered) {
8799
8885
  if (events[index][0] === "enter") {
8800
- listStack.push(index);
8886
+ listStack.push(prepared.length - 1);
8801
8887
  } else {
8802
8888
  const tail = listStack.pop();
8803
8889
  ok(typeof tail === "number", "expected list to be open");
8804
- index = prepareList(events, tail, index);
8890
+ prepareList(prepared, tail);
8805
8891
  }
8806
8892
  }
8807
8893
  }
8894
+ events = prepared;
8808
8895
  index = -1;
8809
8896
  while (++index < events.length) {
8810
8897
  const handler = config[events[index][0]];
8898
+ if (events[index][0] === "enter" && config.beforeEnter.length > 0) {
8899
+ callListeners(config.beforeEnter, { ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
8900
+ }
8811
8901
  if (own3.call(handler, events[index][1].type)) {
8812
- handler[events[index][1].type].call(Object.assign({ sliceSerialize: events[index][2].sliceSerialize }, context), events[index][1]);
8902
+ handler[events[index][1].type].call({ ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
8903
+ }
8904
+ if (events[index][0] === "exit" && config.afterExit.length > 0) {
8905
+ callListeners(config.afterExit, { ...context, sliceSerialize: events[index][2].sliceSerialize }, events[index][1]);
8813
8906
  }
8814
8907
  }
8815
8908
  if (context.tokenStack.length > 0) {
@@ -8827,7 +8920,14 @@ function compiler(options) {
8827
8920
  }
8828
8921
  return tree;
8829
8922
  }
8830
- function prepareList(events, start, length) {
8923
+ function callListeners(listeners, context, token) {
8924
+ let index = -1;
8925
+ while (++index < listeners.length) {
8926
+ listeners[index].call(context, token);
8927
+ }
8928
+ }
8929
+ function prepareList(events, start) {
8930
+ const end = events.length - 1;
8831
8931
  let index = start - 1;
8832
8932
  let containerBalance = -1;
8833
8933
  let listSpread = false;
@@ -8835,7 +8935,8 @@ function compiler(options) {
8835
8935
  let lineIndex;
8836
8936
  let firstBlankLineIndex;
8837
8937
  let atMarker;
8838
- while (++index <= length) {
8938
+ const insertions = [];
8939
+ while (++index <= end) {
8839
8940
  const event = events[index];
8840
8941
  switch (event[1].type) {
8841
8942
  case types.listUnordered:
@@ -8892,9 +8993,10 @@ function compiler(options) {
8892
8993
  listItem._spread = true;
8893
8994
  }
8894
8995
  listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);
8895
- events.splice(lineIndex || index, 0, ["exit", listItem, event[2]]);
8896
- index++;
8897
- length++;
8996
+ insertions.push({
8997
+ at: lineIndex || index,
8998
+ event: ["exit", listItem, event[2]]
8999
+ });
8898
9000
  }
8899
9001
  if (event[1].type === types.listItemPrefix) {
8900
9002
  const item = {
@@ -8904,16 +9006,23 @@ function compiler(options) {
8904
9006
  end: undefined
8905
9007
  };
8906
9008
  listItem = item;
8907
- events.splice(index, 0, ["enter", item, event[2]]);
8908
- index++;
8909
- length++;
9009
+ insertions.push({ at: index, event: ["enter", item, event[2]] });
8910
9010
  firstBlankLineIndex = undefined;
8911
9011
  atMarker = true;
8912
9012
  }
8913
9013
  }
8914
9014
  }
9015
+ const listEvents = events.splice(start);
9016
+ let insertion = 0;
9017
+ index = -1;
9018
+ while (++index < listEvents.length) {
9019
+ while (insertion < insertions.length && insertions[insertion].at === start + index) {
9020
+ events.push(insertions[insertion++].event);
9021
+ }
9022
+ events.push(listEvents[index]);
9023
+ }
9024
+ ok(insertion === insertions.length, "expected insertions to be merged");
8915
9025
  events[start][1]._spread = listSpread;
8916
- return length;
8917
9026
  }
8918
9027
  function opener(create, and) {
8919
9028
  return open;
@@ -8953,7 +9062,8 @@ function compiler(options) {
8953
9062
  const open = this.tokenStack.pop();
8954
9063
  if (!open) {
8955
9064
  throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): it’s not open");
8956
- } else if (open[0].type !== token.type) {
9065
+ }
9066
+ if (open[0].type !== token.type) {
8957
9067
  if (onExitError) {
8958
9068
  onExitError.call(this, token, open[0]);
8959
9069
  } else {
@@ -9250,13 +9360,19 @@ function compiler(options) {
9250
9360
  node.url = "mailto:" + this.sliceSerialize(token);
9251
9361
  }
9252
9362
  function blockQuote() {
9253
- return { type: "blockquote", children: [] };
9363
+ return { type: "blockquote", children: [], position: undefined };
9254
9364
  }
9255
9365
  function codeFlow() {
9256
- return { type: "code", lang: null, meta: null, value: "" };
9366
+ return {
9367
+ type: "code",
9368
+ lang: null,
9369
+ meta: null,
9370
+ value: "",
9371
+ position: undefined
9372
+ };
9257
9373
  }
9258
9374
  function codeText() {
9259
- return { type: "inlineCode", value: "" };
9375
+ return { type: "inlineCode", value: "", position: undefined };
9260
9376
  }
9261
9377
  function definition() {
9262
9378
  return {
@@ -9264,30 +9380,44 @@ function compiler(options) {
9264
9380
  identifier: "",
9265
9381
  label: null,
9266
9382
  title: null,
9267
- url: ""
9383
+ url: "",
9384
+ position: undefined
9268
9385
  };
9269
9386
  }
9270
9387
  function emphasis() {
9271
- return { type: "emphasis", children: [] };
9388
+ return { type: "emphasis", children: [], position: undefined };
9272
9389
  }
9273
9390
  function heading() {
9274
9391
  return {
9275
9392
  type: "heading",
9276
9393
  depth: 0,
9277
- children: []
9394
+ children: [],
9395
+ position: undefined
9278
9396
  };
9279
9397
  }
9280
9398
  function hardBreak() {
9281
- return { type: "break" };
9399
+ return { type: "break", position: undefined };
9282
9400
  }
9283
9401
  function html() {
9284
- return { type: "html", value: "" };
9402
+ return { type: "html", value: "", position: undefined };
9285
9403
  }
9286
9404
  function image() {
9287
- return { type: "image", title: null, url: "", alt: null };
9405
+ return {
9406
+ type: "image",
9407
+ title: null,
9408
+ url: "",
9409
+ alt: null,
9410
+ position: undefined
9411
+ };
9288
9412
  }
9289
9413
  function link() {
9290
- return { type: "link", title: null, url: "", children: [] };
9414
+ return {
9415
+ type: "link",
9416
+ title: null,
9417
+ url: "",
9418
+ children: [],
9419
+ position: undefined
9420
+ };
9291
9421
  }
9292
9422
  function list(token) {
9293
9423
  return {
@@ -9295,7 +9425,8 @@ function compiler(options) {
9295
9425
  ordered: token.type === "listOrdered",
9296
9426
  start: null,
9297
9427
  spread: token._spread,
9298
- children: []
9428
+ children: [],
9429
+ position: undefined
9299
9430
  };
9300
9431
  }
9301
9432
  function listItem(token) {
@@ -9303,20 +9434,21 @@ function compiler(options) {
9303
9434
  type: "listItem",
9304
9435
  spread: token._spread,
9305
9436
  checked: null,
9306
- children: []
9437
+ children: [],
9438
+ position: undefined
9307
9439
  };
9308
9440
  }
9309
9441
  function paragraph() {
9310
- return { type: "paragraph", children: [] };
9442
+ return { type: "paragraph", children: [], position: undefined };
9311
9443
  }
9312
9444
  function strong() {
9313
- return { type: "strong", children: [] };
9445
+ return { type: "strong", children: [], position: undefined };
9314
9446
  }
9315
9447
  function text() {
9316
- return { type: "text", value: "" };
9448
+ return { type: "text", value: "", position: undefined };
9317
9449
  }
9318
9450
  function thematicBreak() {
9319
- return { type: "thematicBreak" };
9451
+ return { type: "thematicBreak", position: undefined };
9320
9452
  }
9321
9453
  }
9322
9454
  function point2(d) {
@@ -9352,6 +9484,14 @@ function extension(combined, extension) {
9352
9484
  }
9353
9485
  break;
9354
9486
  }
9487
+ case "afterExit":
9488
+ case "beforeEnter": {
9489
+ const right = extension[key];
9490
+ if (right) {
9491
+ combined[key].push(right);
9492
+ }
9493
+ break;
9494
+ }
9355
9495
  case "enter":
9356
9496
  case "exit": {
9357
9497
  const right = extension[key];
@@ -9367,9 +9507,8 @@ function extension(combined, extension) {
9367
9507
  function defaultOnError(left, right) {
9368
9508
  if (left) {
9369
9509
  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");
9370
- } else {
9371
- throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is still open");
9372
9510
  }
9511
+ throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({ start: right.start, end: right.end }) + ") is still open");
9373
9512
  }
9374
9513
  var own3;
9375
9514
  var init_lib5 = __esm(() => {
@@ -17426,15 +17565,13 @@ function findAndReplace(tree, list, options) {
17426
17565
  find.lastIndex = position + 1;
17427
17566
  } else {
17428
17567
  if (start !== position) {
17429
- nodes.push({
17430
- type: "text",
17431
- value: node.value.slice(start, position)
17432
- });
17568
+ add({ type: "text", value: node.value.slice(start, position) });
17433
17569
  }
17434
17570
  if (Array.isArray(value)) {
17435
- nodes.push(...value);
17571
+ for (const child of value)
17572
+ add(child);
17436
17573
  } else if (value) {
17437
- nodes.push(value);
17574
+ add(value);
17438
17575
  }
17439
17576
  start = position + match[0].length;
17440
17577
  change = true;
@@ -17446,20 +17583,28 @@ function findAndReplace(tree, list, options) {
17446
17583
  }
17447
17584
  if (change) {
17448
17585
  if (start < node.value.length) {
17449
- nodes.push({ type: "text", value: node.value.slice(start) });
17586
+ add({ type: "text", value: node.value.slice(start) });
17450
17587
  }
17451
17588
  parent.children.splice(index, 1, ...nodes);
17452
17589
  } else {
17453
17590
  nodes = [node];
17454
17591
  }
17455
17592
  return index + nodes.length;
17593
+ function add(child) {
17594
+ const previous = nodes[nodes.length - 1];
17595
+ if (previous && previous.type === "text" && child.type === "text") {
17596
+ previous.value += child.value;
17597
+ } else {
17598
+ nodes.push(child);
17599
+ }
17600
+ }
17456
17601
  }
17457
17602
  }
17458
17603
  function toPairs(tupleOrList) {
17459
- const result = [];
17460
17604
  if (!Array.isArray(tupleOrList)) {
17461
17605
  throw new TypeError("Expected find and replace tuple or list of tuples");
17462
17606
  }
17607
+ const result = [];
17463
17608
  const list = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
17464
17609
  let index = -1;
17465
17610
  while (++index < list.length) {
@@ -17754,35 +17899,39 @@ function gfmStrikethroughFromMarkdown() {
17754
17899
  }
17755
17900
  function gfmStrikethroughToMarkdown() {
17756
17901
  return {
17902
+ handlers: { delete: handleDelete },
17757
17903
  unsafe: [
17758
17904
  {
17759
17905
  character: "~",
17760
17906
  inConstruct: "phrasing",
17761
17907
  notInConstruct: constructsWithoutStrikethrough
17762
17908
  }
17763
- ],
17764
- handlers: { delete: handleDelete }
17909
+ ]
17765
17910
  };
17766
17911
  }
17767
17912
  function enterStrikethrough(token) {
17768
- this.enter({ type: "delete", children: [] }, token);
17913
+ this.enter({ type: "delete", children: [], position: undefined }, token);
17769
17914
  }
17770
17915
  function exitStrikethrough(token) {
17771
17916
  this.exit(token);
17772
17917
  }
17773
17918
  function handleDelete(node, _, state, info) {
17774
17919
  const tracker = state.createTracker(info);
17920
+ const sequence = state.stack.includes("strikethrough") ? "~" : "~~";
17775
17921
  const exit = state.enter("strikethrough");
17776
- let value = tracker.move("~~");
17922
+ let value = tracker.move(sequence);
17777
17923
  value += state.containerPhrasing(node, {
17778
17924
  ...tracker.current(),
17779
17925
  before: value,
17780
17926
  after: "~"
17781
17927
  });
17782
- value += tracker.move("~~");
17928
+ value += tracker.move(sequence);
17783
17929
  exit();
17784
17930
  return value;
17785
17931
  }
17932
+ function attentionDelete() {
17933
+ return { construct: "strikethrough", markers: ["~"], sizes: [2, 1] };
17934
+ }
17786
17935
  function peekDelete() {
17787
17936
  return "~";
17788
17937
  }
@@ -17796,6 +17945,7 @@ var init_lib13 = __esm(() => {
17796
17945
  "titleQuote",
17797
17946
  "titleApostrophe"
17798
17947
  ];
17948
+ handleDelete.attention = attentionDelete;
17799
17949
  handleDelete.peek = peekDelete;
17800
17950
  });
17801
17951
 
@@ -17939,6 +18089,35 @@ function toAlignment(value) {
17939
18089
  return code === 67 || code === 99 ? 99 : code === 76 || code === 108 ? 108 : code === 82 || code === 114 ? 114 : 0;
17940
18090
  }
17941
18091
 
18092
+ // ../../node_modules/mdast-util-phrasing/lib/index.js
18093
+ var phrasing;
18094
+ var init_lib14 = __esm(() => {
18095
+ init_unist_util_is();
18096
+ phrasing = convert([
18097
+ "break",
18098
+ "delete",
18099
+ "emphasis",
18100
+ "footnote",
18101
+ "footnoteReference",
18102
+ "image",
18103
+ "imageReference",
18104
+ "inlineCode",
18105
+ "inlineMath",
18106
+ "link",
18107
+ "linkReference",
18108
+ "mdxJsxTextElement",
18109
+ "mdxTextExpression",
18110
+ "strong",
18111
+ "text",
18112
+ "textDirective"
18113
+ ]);
18114
+ });
18115
+
18116
+ // ../../node_modules/mdast-util-phrasing/index.js
18117
+ var init_mdast_util_phrasing = __esm(() => {
18118
+ init_lib14();
18119
+ });
18120
+
17942
18121
  // ../../node_modules/zwitch/index.js
17943
18122
  function zwitch(key, options) {
17944
18123
  const settings = options || {};
@@ -18051,9 +18230,10 @@ function listInScope(stack, list, none) {
18051
18230
  function hardBreak(_, _1, state, info) {
18052
18231
  let index = -1;
18053
18232
  while (++index < state.unsafe.length) {
18054
- if (state.unsafe[index].character === `
18055
- ` && patternInScope(state.stack, state.unsafe[index])) {
18056
- return /[ \t]/.test(info.before) ? "" : " ";
18233
+ const pattern = state.unsafe[index];
18234
+ if (pattern.character === `
18235
+ ` && !pattern.before && !pattern.after && patternInScope(state.stack, pattern)) {
18236
+ return /[\t ]/.test(info.before) ? "" : " ";
18057
18237
  }
18058
18238
  }
18059
18239
  return "\\\n";
@@ -18086,7 +18266,7 @@ function longestStreak(value, substring) {
18086
18266
 
18087
18267
  // ../../node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
18088
18268
  function formatCodeAsIndented(node, state) {
18089
- return Boolean(state.options.fences === false && node.value && !node.lang && /[^ \r\n]/.test(node.value) && !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value));
18269
+ return Boolean(state.options.fences === false && node.value && !node.lang && /[^\n\r ]/.test(node.value) && !/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(node.value));
18090
18270
  }
18091
18271
 
18092
18272
  // ../../node_modules/mdast-util-to-markdown/lib/util/check-fence.js
@@ -18102,7 +18282,6 @@ function checkFence(state) {
18102
18282
  function code(node, _, state, info) {
18103
18283
  const marker = checkFence(state);
18104
18284
  const raw = node.value || "";
18105
- const suffix = marker === "`" ? "GraveAccent" : "Tilde";
18106
18285
  if (formatCodeAsIndented(node, state)) {
18107
18286
  const exit = state.enter("codeIndented");
18108
18287
  const value = state.indentLines(raw, map3);
@@ -18112,6 +18291,7 @@ function code(node, _, state, info) {
18112
18291
  const tracker = state.createTracker(info);
18113
18292
  const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
18114
18293
  const exit = state.enter("codeFenced");
18294
+ const suffix = marker === "`" ? "GraveAccent" : "Tilde";
18115
18295
  let value = tracker.move(sequence);
18116
18296
  if (node.lang) {
18117
18297
  const subexit = state.enter(`codeFencedLang${suffix}`);
@@ -18214,64 +18394,34 @@ function checkEmphasis(state) {
18214
18394
  return marker;
18215
18395
  }
18216
18396
 
18217
- // ../../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
18218
- function encodeCharacterReference(code) {
18219
- return "&#x" + code.toString(16).toUpperCase() + ";";
18220
- }
18221
-
18222
- // ../../node_modules/mdast-util-to-markdown/lib/util/encode-info.js
18223
- function encodeInfo(outside, inside, marker) {
18224
- const outsideKind = classifyCharacter(outside);
18225
- const insideKind = classifyCharacter(inside);
18226
- if (outsideKind === undefined) {
18227
- return insideKind === undefined ? marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: true };
18228
- }
18229
- if (outsideKind === 1) {
18230
- return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: false };
18231
- }
18232
- return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: false } : { inside: false, outside: false };
18233
- }
18234
- var init_encode_info = __esm(() => {
18235
- init_dev6();
18236
- });
18237
-
18238
18397
  // ../../node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
18239
18398
  function emphasis(node, _, state, info) {
18240
- const marker = checkEmphasis(state);
18241
- const exit = state.enter("emphasis");
18242
- const tracker = state.createTracker(info);
18243
- const before = tracker.move(marker);
18244
- let between = tracker.move(state.containerPhrasing(node, {
18245
- after: marker,
18246
- before,
18247
- ...tracker.current()
18248
- }));
18249
- const betweenHead = between.charCodeAt(0);
18250
- const open = encodeInfo(info.before.charCodeAt(info.before.length - 1), betweenHead, marker);
18251
- if (open.inside) {
18252
- between = encodeCharacterReference(betweenHead) + between.slice(1);
18253
- }
18254
- const betweenTail = between.charCodeAt(between.length - 1);
18255
- const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
18256
- if (close.inside) {
18257
- between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
18258
- }
18259
- const after = tracker.move(marker);
18399
+ const exit = state.enter("phrasing");
18400
+ const value = state.containerPhrasing({ type: "root", children: [node] }, info);
18260
18401
  exit();
18261
- state.attentionEncodeSurroundingInfo = {
18262
- after: close.outside,
18263
- before: open.outside
18402
+ return value;
18403
+ }
18404
+ function attention2(_, state) {
18405
+ const marker = checkEmphasis(state);
18406
+ return {
18407
+ construct: "emphasis",
18408
+ markers: marker === "*" ? ["*", "_"] : ["_", "*"],
18409
+ sizes: [1]
18264
18410
  };
18265
- return before + between + after;
18266
18411
  }
18267
- function emphasisPeek(_, _1, state) {
18412
+ function peek(_, _1, state) {
18268
18413
  return state.options.emphasis || "*";
18269
18414
  }
18270
18415
  var init_emphasis = __esm(() => {
18271
- init_encode_info();
18272
- emphasis.peek = emphasisPeek;
18416
+ emphasis.attention = attention2;
18417
+ emphasis.peek = peek;
18273
18418
  });
18274
18419
 
18420
+ // ../../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
18421
+ function encodeCharacterReference(code) {
18422
+ return "&#x" + code.toString(16).toUpperCase() + ";";
18423
+ }
18424
+
18275
18425
  // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/color.node.js
18276
18426
  function color2(d) {
18277
18427
  return "\x1B[33m" + d + "\x1B[39m";
@@ -18338,14 +18488,14 @@ function toResult2(value) {
18338
18488
  return value === null || value === undefined ? empty2 : [value];
18339
18489
  }
18340
18490
  var empty2, CONTINUE2 = true, EXIT2 = false, SKIP2 = "skip";
18341
- var init_lib14 = __esm(() => {
18491
+ var init_lib15 = __esm(() => {
18342
18492
  init_unist_util_is();
18343
18493
  empty2 = [];
18344
18494
  });
18345
18495
 
18346
18496
  // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/index.js
18347
18497
  var init_unist_util_visit_parents2 = __esm(() => {
18348
- init_lib14();
18498
+ init_lib15();
18349
18499
  });
18350
18500
 
18351
18501
  // ../../node_modules/unist-util-visit/lib/index.js
@@ -18369,14 +18519,14 @@ function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
18369
18519
  return visitor(node, index, parent);
18370
18520
  }
18371
18521
  }
18372
- var init_lib15 = __esm(() => {
18522
+ var init_lib16 = __esm(() => {
18373
18523
  init_unist_util_visit_parents2();
18374
18524
  init_unist_util_visit_parents2();
18375
18525
  });
18376
18526
 
18377
18527
  // ../../node_modules/unist-util-visit/index.js
18378
18528
  var init_unist_util_visit = __esm(() => {
18379
- init_lib15();
18529
+ init_lib16();
18380
18530
  });
18381
18531
 
18382
18532
  // ../../node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
@@ -18425,8 +18575,9 @@ function heading(node, _, state, info) {
18425
18575
  `,
18426
18576
  ...tracker.current()
18427
18577
  });
18428
- if (/^[\t ]/.test(value)) {
18429
- value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);
18578
+ const head = value.charCodeAt(0);
18579
+ if (head === 9 || head === 32) {
18580
+ value = encodeCharacterReference(head) + value.slice(1);
18430
18581
  }
18431
18582
  value = value ? sequence + " " + value : sequence;
18432
18583
  if (state.options.closeAtx) {
@@ -18513,7 +18664,9 @@ function imageReference(node, _, state, info) {
18513
18664
  value += tracker.move(alt + "][");
18514
18665
  subexit();
18515
18666
  const stack = state.stack;
18516
- state.stack = [];
18667
+ state.stack = stack.filter(function(d) {
18668
+ return d !== "phrasing";
18669
+ });
18517
18670
  subexit = state.enter("reference");
18518
18671
  const reference = state.safe(state.associationId(node), {
18519
18672
  before: value,
@@ -18547,15 +18700,15 @@ function inlineCode(node, _, state) {
18547
18700
  while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
18548
18701
  sequence += "`";
18549
18702
  }
18550
- if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) {
18703
+ if (/[^\n\r ]/.test(value) && (/^[\n\r ]/.test(value) && /[\n\r ]$/.test(value) || /^`|`$/.test(value))) {
18551
18704
  value = " " + value + " ";
18552
18705
  }
18553
18706
  while (++index < state.unsafe.length) {
18554
18707
  const pattern = state.unsafe[index];
18555
18708
  const expression = state.compilePattern(pattern);
18556
- let match;
18557
18709
  if (!pattern.atBreak)
18558
18710
  continue;
18711
+ let match;
18559
18712
  while (match = expression.exec(value)) {
18560
18713
  let position = match.index;
18561
18714
  if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {
@@ -18576,7 +18729,7 @@ var init_inline_code = __esm(() => {
18576
18729
  // ../../node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
18577
18730
  function formatLinkAsAutolink(node, state) {
18578
18731
  const raw = toString(node);
18579
- 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));
18732
+ 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));
18580
18733
  }
18581
18734
  var init_format_link_as_autolink = __esm(() => {
18582
18735
  init_mdast_util_to_string();
@@ -18587,12 +18740,12 @@ function link(node, _, state, info) {
18587
18740
  const quote = checkQuote(state);
18588
18741
  const suffix = quote === '"' ? "Quote" : "Apostrophe";
18589
18742
  const tracker = state.createTracker(info);
18590
- let exit;
18591
- let subexit;
18592
18743
  if (formatLinkAsAutolink(node, state)) {
18593
18744
  const stack = state.stack;
18594
- state.stack = [];
18595
- exit = state.enter("autolink");
18745
+ state.stack = stack.filter(function(d) {
18746
+ return d !== "phrasing";
18747
+ });
18748
+ const exit = state.enter("autolink");
18596
18749
  let value = tracker.move("<");
18597
18750
  value += tracker.move(state.containerPhrasing(node, {
18598
18751
  before: value,
@@ -18604,8 +18757,8 @@ function link(node, _, state, info) {
18604
18757
  state.stack = stack;
18605
18758
  return value;
18606
18759
  }
18607
- exit = state.enter("link");
18608
- subexit = state.enter("label");
18760
+ const exit = state.enter("link");
18761
+ let subexit = state.enter("label");
18609
18762
  let value = tracker.move("[");
18610
18763
  value += tracker.move(state.containerPhrasing(node, {
18611
18764
  before: value,
@@ -18666,7 +18819,9 @@ function linkReference(node, _, state, info) {
18666
18819
  value += tracker.move(text + "][");
18667
18820
  subexit();
18668
18821
  const stack = state.stack;
18669
- state.stack = [];
18822
+ state.stack = stack.filter(function(d) {
18823
+ return d !== "phrasing";
18824
+ });
18670
18825
  subexit = state.enter("reference");
18671
18826
  const reference = state.safe(state.associationId(node), {
18672
18827
  before: value,
@@ -18819,42 +18974,17 @@ function paragraph(node, _, state, info) {
18819
18974
  return value;
18820
18975
  }
18821
18976
 
18822
- // ../../node_modules/mdast-util-phrasing/lib/index.js
18823
- var phrasing;
18824
- var init_lib16 = __esm(() => {
18825
- init_unist_util_is();
18826
- phrasing = convert([
18827
- "break",
18828
- "delete",
18829
- "emphasis",
18830
- "footnote",
18831
- "footnoteReference",
18832
- "image",
18833
- "imageReference",
18834
- "inlineCode",
18835
- "inlineMath",
18836
- "link",
18837
- "linkReference",
18838
- "mdxJsxTextElement",
18839
- "mdxTextExpression",
18840
- "strong",
18841
- "text",
18842
- "textDirective"
18843
- ]);
18844
- });
18845
-
18846
- // ../../node_modules/mdast-util-phrasing/index.js
18847
- var init_mdast_util_phrasing = __esm(() => {
18848
- init_lib16();
18849
- });
18850
-
18851
18977
  // ../../node_modules/mdast-util-to-markdown/lib/handle/root.js
18852
18978
  function root(node, _, state, info) {
18853
18979
  const hasPhrasing = node.children.some(function(d) {
18854
18980
  return phrasing(d);
18855
18981
  });
18856
- const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;
18857
- return container.call(state, node, info);
18982
+ if (!hasPhrasing)
18983
+ return state.containerFlow(node, info);
18984
+ const exit = state.enter("phrasing");
18985
+ const value = state.containerPhrasing(node, info);
18986
+ exit();
18987
+ return value;
18858
18988
  }
18859
18989
  var init_root = __esm(() => {
18860
18990
  init_mdast_util_phrasing();
@@ -18871,44 +19001,36 @@ function checkStrong(state) {
18871
19001
 
18872
19002
  // ../../node_modules/mdast-util-to-markdown/lib/handle/strong.js
18873
19003
  function strong(node, _, state, info) {
18874
- const marker = checkStrong(state);
18875
- const exit = state.enter("strong");
18876
- const tracker = state.createTracker(info);
18877
- const before = tracker.move(marker + marker);
18878
- let between = tracker.move(state.containerPhrasing(node, {
18879
- after: marker,
18880
- before,
18881
- ...tracker.current()
18882
- }));
18883
- const betweenHead = between.charCodeAt(0);
18884
- const open = encodeInfo(info.before.charCodeAt(info.before.length - 1), betweenHead, marker);
18885
- if (open.inside) {
18886
- between = encodeCharacterReference(betweenHead) + between.slice(1);
18887
- }
18888
- const betweenTail = between.charCodeAt(between.length - 1);
18889
- const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
18890
- if (close.inside) {
18891
- between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
18892
- }
18893
- const after = tracker.move(marker + marker);
19004
+ const exit = state.enter("phrasing");
19005
+ const value = state.containerPhrasing({ type: "root", children: [node] }, info);
18894
19006
  exit();
18895
- state.attentionEncodeSurroundingInfo = {
18896
- after: close.outside,
18897
- before: open.outside
19007
+ return value;
19008
+ }
19009
+ function attention3(_, state) {
19010
+ const marker = checkStrong(state);
19011
+ return {
19012
+ construct: "strong",
19013
+ markers: marker === "*" ? ["*", "_"] : ["_", "*"],
19014
+ sizes: [2]
18898
19015
  };
18899
- return before + between + after;
18900
19016
  }
18901
- function strongPeek(_, _1, state) {
19017
+ function peek2(_, _1, state) {
18902
19018
  return state.options.strong || "*";
18903
19019
  }
18904
19020
  var init_strong = __esm(() => {
18905
- init_encode_info();
18906
- strong.peek = strongPeek;
19021
+ strong.attention = attention3;
19022
+ strong.peek = peek2;
18907
19023
  });
18908
19024
 
18909
19025
  // ../../node_modules/mdast-util-to-markdown/lib/handle/text.js
18910
- function text3(node, _, state, info) {
18911
- return state.safe(node.value, info);
19026
+ function text3(node, parent, state, info) {
19027
+ const siblings = parent ? parent.children : [];
19028
+ const index = siblings.indexOf(node);
19029
+ return state.safe(node.value, {
19030
+ ...info,
19031
+ afterNode: siblings[index + 1],
19032
+ beforeNode: siblings[index - 1]
19033
+ });
18912
19034
  }
18913
19035
 
18914
19036
  // ../../node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
@@ -18970,6 +19092,43 @@ var init_handle = __esm(() => {
18970
19092
  };
18971
19093
  });
18972
19094
 
19095
+ // ../../node_modules/mdast-util-to-markdown/lib/util/html-kind.js
19096
+ function htmlKind(value) {
19097
+ if (value.charCodeAt(0) !== 60)
19098
+ return;
19099
+ const next = value.charCodeAt(1);
19100
+ if (next === 33) {
19101
+ const code = value.charCodeAt(2);
19102
+ if (code === 45)
19103
+ return 2;
19104
+ if (code === 91)
19105
+ return 5;
19106
+ if (asciiAlpha(code))
19107
+ return 4;
19108
+ return;
19109
+ }
19110
+ if (next === 63)
19111
+ return 3;
19112
+ const closing = next === 47;
19113
+ const start = closing ? 2 : 1;
19114
+ let end = start;
19115
+ let code = value.charCodeAt(end);
19116
+ if (!asciiAlpha(code))
19117
+ return;
19118
+ while (code === 45 || asciiAlphanumeric(code)) {
19119
+ code = value.charCodeAt(++end);
19120
+ }
19121
+ const name = value.slice(start, end).toLowerCase();
19122
+ if (!closing && code !== 47 && htmlRawNames.includes(name)) {
19123
+ return 1;
19124
+ }
19125
+ return htmlBlockNames.includes(name) ? 6 : 7;
19126
+ }
19127
+ var init_html_kind = __esm(() => {
19128
+ init_dev4();
19129
+ init_micromark_util_html_tag_name();
19130
+ });
19131
+
18973
19132
  // ../../node_modules/mdast-util-to-markdown/lib/join.js
18974
19133
  function joinDefaults(left, right, parent, state) {
18975
19134
  if (right.type === "code" && formatCodeAsIndented(right, state) && (left.type === "list" || left.type === right.type && formatCodeAsIndented(left, state))) {
@@ -18979,17 +19138,28 @@ function joinDefaults(left, right, parent, state) {
18979
19138
  if (left.type === "paragraph" && (left.type === right.type || right.type === "definition" || right.type === "heading" && formatHeadingAsSetext(right, state))) {
18980
19139
  return;
18981
19140
  }
19141
+ if (left.type === "html") {
19142
+ const kind = htmlKind(left.value);
19143
+ if (kind === undefined || kind === 6 || kind === 7)
19144
+ return 1;
19145
+ }
19146
+ if (left.type === "paragraph" && right.type === "html") {
19147
+ const kind = htmlKind(right.value);
19148
+ if (kind === undefined || kind === 7)
19149
+ return 1;
19150
+ }
18982
19151
  return parent.spread ? 1 : 0;
18983
19152
  }
18984
19153
  }
18985
19154
  var join;
18986
19155
  var init_join = __esm(() => {
18987
19156
  init_format_heading_as_setext();
19157
+ init_html_kind();
18988
19158
  join = [joinDefaults];
18989
19159
  });
18990
19160
 
18991
19161
  // ../../node_modules/mdast-util-to-markdown/lib/unsafe.js
18992
- var fullPhrasingSpans, unsafe;
19162
+ var fullPhrasingSpans, unsafe, code2 = -1;
18993
19163
  var init_unsafe = __esm(() => {
18994
19164
  fullPhrasingSpans = [
18995
19165
  "autolink",
@@ -19029,6 +19199,12 @@ var init_unsafe = __esm(() => {
19029
19199
  "headingAtx"
19030
19200
  ]
19031
19201
  },
19202
+ { character: "\r", before: "[\\r\\n]", inConstruct: "phrasing" },
19203
+ { character: "\r", after: "\\r", inConstruct: "phrasing" },
19204
+ { character: `
19205
+ `, before: "\\n", inConstruct: "phrasing" },
19206
+ { character: `
19207
+ `, after: "[\\r\\n]", inConstruct: "phrasing" },
19032
19208
  { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" },
19033
19209
  { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" },
19034
19210
  {
@@ -19089,8 +19265,14 @@ var init_unsafe = __esm(() => {
19089
19265
  inConstruct: ["codeFencedLangGraveAccent", "codeFencedMetaGraveAccent"]
19090
19266
  },
19091
19267
  { character: "`", inConstruct: "phrasing", notInConstruct: fullPhrasingSpans },
19092
- { atBreak: true, character: "~" }
19268
+ { atBreak: true, character: "~" },
19269
+ { character: "<", inConstruct: "autolink" },
19270
+ { character: ">", inConstruct: "autolink" },
19271
+ { character: "", inConstruct: "autolink" }
19093
19272
  ];
19273
+ while (++code2 < 33) {
19274
+ unsafe.push({ character: String.fromCharCode(code2), inConstruct: "autolink" });
19275
+ }
19094
19276
  });
19095
19277
 
19096
19278
  // ../../node_modules/mdast-util-to-markdown/lib/util/association.js
@@ -19108,19 +19290,201 @@ var init_association = __esm(() => {
19108
19290
  function compilePattern(pattern) {
19109
19291
  if (!pattern._compiled) {
19110
19292
  const before = (pattern.atBreak ? "[\\r\\n][\\t ]*" : "") + (pattern.before ? "(?:" + pattern.before + ")" : "");
19111
- pattern._compiled = new RegExp((before ? "(" + before + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.after ? "(?:" + pattern.after + ")" : ""), "g");
19293
+ pattern._compiled = new RegExp((pattern.beforeNode ? "^" : before ? "(" + before + ")" : "") + (/[$()*+.?[\\\]^{|}]/.test(pattern.character) ? "\\" : "") + pattern.character + (pattern.afterNode ? "$" : pattern.after ? "(?:" + pattern.after + ")" : ""), pattern.unicode ? "gu" : "g");
19112
19294
  }
19113
19295
  return pattern._compiled;
19114
19296
  }
19115
19297
 
19298
+ // ../../node_modules/mdast-util-to-markdown/lib/util/character.js
19299
+ function firstCharacter(value) {
19300
+ const code = value.codePointAt(0);
19301
+ return code === undefined ? "" : String.fromCodePoint(code);
19302
+ }
19303
+ function lastCharacter(value) {
19304
+ const code = value.codePointAt(value.length - 2);
19305
+ return code !== undefined && code > 65535 ? value.slice(-2) : value.slice(-1);
19306
+ }
19307
+
19308
+ // ../../node_modules/mdast-util-to-markdown/lib/util/encode-info.js
19309
+ function encodeInfo(outside, inside, marker) {
19310
+ const outsideKind = classifyCharacter(outside);
19311
+ const insideKind = classifyCharacter(inside);
19312
+ if (outsideKind === undefined) {
19313
+ return insideKind === undefined ? marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: true };
19314
+ }
19315
+ if (outsideKind === 1) {
19316
+ return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: true } : { inside: false, outside: false };
19317
+ }
19318
+ return insideKind === undefined ? { inside: false, outside: false } : insideKind === 1 ? { inside: true, outside: false } : { inside: false, outside: false };
19319
+ }
19320
+ var init_encode_info = __esm(() => {
19321
+ init_dev6();
19322
+ });
19323
+
19116
19324
  // ../../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
19325
+ function candidates(tokens, involved, runOf) {
19326
+ const related = new Set;
19327
+ for (const token of tokens) {
19328
+ const siblings = runOf.get(token);
19329
+ if (siblings && token.attention && involved.some((d) => d.attention === token.attention)) {
19330
+ for (const sibling of siblings.tokens) {
19331
+ related.add(sibling.attention);
19332
+ }
19333
+ }
19334
+ }
19335
+ const ordered = [];
19336
+ for (const token of tokens) {
19337
+ if (token.attention && related.delete(token.attention)) {
19338
+ ordered.push(token.attention);
19339
+ }
19340
+ }
19341
+ ordered.reverse();
19342
+ return ordered;
19343
+ }
19344
+ function check(tokens, before, after) {
19345
+ const runs = [];
19346
+ const wrong = new Map;
19347
+ const runOf = new Map;
19348
+ let index = 0;
19349
+ while (index < tokens.length) {
19350
+ if (!tokens[index].attention) {
19351
+ index++;
19352
+ continue;
19353
+ }
19354
+ const marker = tokens[index].value.charAt(0);
19355
+ const strict = builtins.get(marker);
19356
+ let end = index + 1;
19357
+ while (end < tokens.length && tokens[end].attention && tokens[end].value.charAt(0) === marker) {
19358
+ end++;
19359
+ }
19360
+ const head = index ? tokens[index - 1].value : before;
19361
+ const previous = classifyCharacter(head.charCodeAt(head.length - 1));
19362
+ const next = classifyCharacter((end < tokens.length ? tokens[end].value : after).charCodeAt(0));
19363
+ const open = !next || next === 2 && Boolean(previous);
19364
+ const close = !previous || previous === 2 && Boolean(next);
19365
+ const run = {
19366
+ tokens: tokens.slice(index, end),
19367
+ markers: [],
19368
+ start: 0,
19369
+ end: 0,
19370
+ open: strict ? open && (Boolean(previous) || !close) : open,
19371
+ close: strict ? close && (Boolean(next) || !open) : close,
19372
+ split: strict !== undefined
19373
+ };
19374
+ for (const token of run.tokens) {
19375
+ wrong.set(token, [...run.tokens]);
19376
+ runOf.set(token, run);
19377
+ let size = token.value.length;
19378
+ while (size--)
19379
+ run.markers.push(token);
19380
+ }
19381
+ run.end = run.markers.length;
19382
+ runs.push(run);
19383
+ index = end;
19384
+ }
19385
+ pair(runs, wrong);
19386
+ index = -1;
19387
+ while (++index < tokens.length) {
19388
+ const involved = wrong.get(tokens[index]);
19389
+ if (involved)
19390
+ return { attention: candidates(tokens, involved, runOf), index };
19391
+ }
19392
+ }
19117
19393
  function containerPhrasing(parent, state, info) {
19394
+ return serialize2(phrasing2(parent, state, info), info.before, info.after);
19395
+ }
19396
+ function encode(tokens, start) {
19397
+ const token = tokens[start ? 0 : tokens.length - 1];
19398
+ if (!token || token.attention)
19399
+ return;
19400
+ const character = start ? firstCharacter(token.value) : lastCharacter(token.value);
19401
+ const reference = encodeCharacterReference(character.codePointAt(0));
19402
+ token.value = start ? reference + token.value.slice(character.length) : token.value.slice(0, token.value.length - character.length) + reference;
19403
+ }
19404
+ function improve(items, chosen, mistake, before, after) {
19405
+ for (const attention of mistake.attention) {
19406
+ const current = chosen.get(attention) || attention.sequences[0];
19407
+ for (const sequence of attention.sequences) {
19408
+ if (sequence === current)
19409
+ continue;
19410
+ const trial = new Map(chosen);
19411
+ trial.set(attention, sequence);
19412
+ const tokens = render(items, trial, before, after);
19413
+ const next = check(tokens, before, after);
19414
+ if (!next || next.index > mistake.index) {
19415
+ return { chosen: trial, mistake: next, tokens };
19416
+ }
19417
+ }
19418
+ }
19419
+ }
19420
+ function pair(runs, wrong) {
19421
+ let index = 0;
19422
+ while (index < runs.length) {
19423
+ const closer = runs[index];
19424
+ const marker = closer.tokens[0].value.charAt(0);
19425
+ const closerSize = closer.end - closer.start;
19426
+ let open = closer.close && closerSize ? index : 0;
19427
+ while (open--) {
19428
+ const opener = runs[open];
19429
+ const openerSize = opener.end - opener.start;
19430
+ 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)) {
19431
+ const size = closer.split ? openerSize > 1 && closerSize > 1 ? 2 : 1 : closerSize;
19432
+ const opening = opener.markers.slice(opener.end - size, opener.end);
19433
+ const closing = closer.markers.slice(closer.start, closer.start + size);
19434
+ const openToken = opening[0];
19435
+ const closeToken = closing[0];
19436
+ if (openToken === opening[size - 1] && openToken.value.length === size && closeToken === closing[size - 1] && closeToken.value.length === size && openToken.attention === closeToken.attention) {
19437
+ wrong.delete(openToken);
19438
+ wrong.delete(closeToken);
19439
+ } else {
19440
+ const involved = [...new Set([...opening, ...closing])];
19441
+ for (const token of involved) {
19442
+ const list = wrong.get(token);
19443
+ if (list)
19444
+ list.push(...involved);
19445
+ }
19446
+ }
19447
+ opener.end -= size;
19448
+ closer.start += size;
19449
+ break;
19450
+ }
19451
+ }
19452
+ if (open === -1 || closer.start === closer.end)
19453
+ index++;
19454
+ }
19455
+ }
19456
+ function attentionSequences(type, markers, sizes) {
19457
+ if (markers.length === 0) {
19458
+ throw new Error("Cannot serialize `" + type + "` as attention without markers, expected one or more markers");
19459
+ }
19460
+ if (sizes.length === 0) {
19461
+ throw new Error("Cannot serialize `" + type + "` as attention without sizes, expected one or more sizes");
19462
+ }
19463
+ for (const size of sizes) {
19464
+ if (!Number.isSafeInteger(size) || size < 1) {
19465
+ throw new Error("Cannot serialize `" + type + "` as attention with `" + size + "` as size, expected positive integer");
19466
+ }
19467
+ }
19468
+ const sequences = [];
19469
+ for (const marker of markers) {
19470
+ if (marker.length !== 1) {
19471
+ throw new Error("Cannot serialize `" + type + "` as attention with `" + marker + "` as marker, expected a single ascii character");
19472
+ }
19473
+ if (!asciiPunctuation(marker.charCodeAt(0))) {
19474
+ throw new Error("Cannot serialize `" + type + "` as attention with `" + marker + "` as marker, expected ascii punctuation");
19475
+ }
19476
+ for (const size of sizes) {
19477
+ sequences.push(marker.repeat(size));
19478
+ }
19479
+ }
19480
+ return sequences;
19481
+ }
19482
+ function phrasing2(parent, state, info) {
19118
19483
  const indexStack = state.indexStack;
19119
19484
  const children = parent.children || [];
19120
19485
  const results = [];
19121
19486
  let index = -1;
19122
19487
  let before = info.before;
19123
- let encodeAfter;
19124
19488
  indexStack.push(-1);
19125
19489
  let tracker = state.createTracker(info);
19126
19490
  while (++index < children.length) {
@@ -19131,47 +19495,132 @@ function containerPhrasing(parent, state, info) {
19131
19495
  let handle = state.handle.handlers[children[index + 1].type];
19132
19496
  if (handle && handle.peek)
19133
19497
  handle = handle.peek;
19134
- after = handle ? handle(children[index + 1], parent, state, {
19498
+ after = handle ? firstCharacter(handle(children[index + 1], parent, state, {
19135
19499
  before: "",
19136
19500
  after: "",
19137
19501
  ...tracker.current()
19138
- }).charAt(0) : "";
19502
+ })) : "";
19139
19503
  } else {
19140
19504
  after = info.after;
19141
19505
  }
19142
- if (results.length > 0 && (before === "\r" || before === `
19143
- `) && child.type === "html") {
19144
- results[results.length - 1] = results[results.length - 1].replace(/(\r?\n|\r)$/, " ");
19506
+ const previous = results[results.length - 1];
19507
+ if (typeof previous === "string" && (before === "\r" || before === `
19508
+ `) && child.type === "html" && htmlKind(child.value) !== 7) {
19509
+ results[results.length - 1] = previous.replace(/(\r?\n|\r)$/, " ");
19145
19510
  before = " ";
19146
19511
  tracker = state.createTracker(info);
19147
- tracker.move(results.join(""));
19512
+ tracker.move(serialize2(results, info.before, info.after));
19513
+ }
19514
+ const handle = state.handle.handlers[child.type];
19515
+ if (handle && handle.attention) {
19516
+ const { construct, markers, sizes } = handle.attention(child, state);
19517
+ const sequences = attentionSequences(child.type, markers, sizes);
19518
+ const sequence = sequences[0];
19519
+ const exit = state.enter(construct);
19520
+ tracker.move(sequence);
19521
+ const inside = phrasing2(child, state, {
19522
+ ...tracker.current(),
19523
+ before: sequence,
19524
+ after: sequence
19525
+ });
19526
+ tracker.move(serialize2(inside, sequence, sequence));
19527
+ tracker.move(sequence);
19528
+ exit();
19529
+ results.push({ children: inside, sequences });
19530
+ before = sequence.charAt(sequence.length - 1);
19531
+ } else {
19532
+ const value = state.handle(child, parent, state, {
19533
+ ...tracker.current(),
19534
+ after,
19535
+ before
19536
+ });
19537
+ if (!value)
19538
+ continue;
19539
+ tracker.move(value);
19540
+ results.push(value);
19541
+ before = lastCharacter(value);
19148
19542
  }
19149
- let value = state.handle(child, parent, state, {
19150
- ...tracker.current(),
19151
- after,
19152
- before
19153
- });
19154
- if (encodeAfter && encodeAfter === value.slice(0, 1)) {
19155
- value = encodeCharacterReference(encodeAfter.charCodeAt(0)) + value.slice(1);
19543
+ }
19544
+ indexStack.pop();
19545
+ return results;
19546
+ }
19547
+ function render(items, chosen, before, after) {
19548
+ const tokens = [];
19549
+ let encodeAfter;
19550
+ let previous = lastCharacter(before);
19551
+ let index = -1;
19552
+ while (++index < items.length) {
19553
+ const item = items[index];
19554
+ if (typeof item === "string") {
19555
+ const token = { value: item, attention: undefined };
19556
+ if (encodeAfter && encodeAfter === firstCharacter(item)) {
19557
+ encode([token], true);
19558
+ }
19559
+ encodeAfter = undefined;
19560
+ tokens.push(token);
19561
+ if (token.value)
19562
+ previous = lastCharacter(token.value);
19563
+ continue;
19156
19564
  }
19157
- const encodingInfo = state.attentionEncodeSurroundingInfo;
19158
- state.attentionEncodeSurroundingInfo = undefined;
19159
- encodeAfter = undefined;
19160
- if (encodingInfo) {
19161
- if (results.length > 0 && encodingInfo.before && before === results[results.length - 1].slice(-1)) {
19162
- results[results.length - 1] = results[results.length - 1].slice(0, -1) + encodeCharacterReference(before.charCodeAt(0));
19163
- }
19164
- if (encodingInfo.after)
19165
- encodeAfter = after;
19565
+ const sequence = chosen.get(item) || item.sequences[0];
19566
+ const marker = sequence.charAt(0);
19567
+ const next = items[index + 1];
19568
+ const outsideBefore = previous;
19569
+ const outsideAfter = firstCharacter(next === undefined ? after : typeof next === "string" ? next : chosen.get(next) || next.sequences[0]);
19570
+ const inside = render(item.children, chosen, sequence, sequence);
19571
+ const head = inside.length > 0 ? inside[0].value : "";
19572
+ const open = encodeInfo(outsideBefore.charCodeAt(outsideBefore.length - 1), head.charCodeAt(0), marker);
19573
+ if (open.inside)
19574
+ encode(inside, true);
19575
+ const tail = inside.length > 0 ? lastCharacter(inside[inside.length - 1].value) : "";
19576
+ const close = encodeInfo(outsideAfter.charCodeAt(0), tail.charCodeAt(tail.length - 1), marker);
19577
+ if (close.inside)
19578
+ encode(inside, false);
19579
+ if (open.outside && outsideBefore !== `
19580
+ ` && outsideBefore !== "\r") {
19581
+ encode(tokens, false);
19582
+ }
19583
+ if (close.outside)
19584
+ encodeAfter = outsideAfter;
19585
+ tokens.push({ value: sequence, attention: item }, ...inside, {
19586
+ value: sequence,
19587
+ attention: item
19588
+ });
19589
+ previous = sequence.charAt(sequence.length - 1);
19590
+ }
19591
+ return tokens;
19592
+ }
19593
+ function serialize2(items, before, after) {
19594
+ let chosen = new Map;
19595
+ const initial = render(items, chosen, before, after);
19596
+ let tokens = initial;
19597
+ let mistake = check(tokens, before, after);
19598
+ while (mistake) {
19599
+ const next = improve(items, chosen, mistake, before, after);
19600
+ if (!next) {
19601
+ tokens = initial;
19602
+ break;
19166
19603
  }
19167
- tracker.move(value);
19168
- results.push(value);
19169
- before = value.slice(-1);
19604
+ chosen = next.chosen;
19605
+ tokens = next.tokens;
19606
+ mistake = next.mistake;
19170
19607
  }
19171
- indexStack.pop();
19172
- return results.join("");
19608
+ let result = "";
19609
+ for (const token of tokens)
19610
+ result += token.value;
19611
+ return result;
19173
19612
  }
19174
- var init_container_phrasing = () => {};
19613
+ var builtins;
19614
+ var init_container_phrasing = __esm(() => {
19615
+ init_dev4();
19616
+ init_dev6();
19617
+ init_encode_info();
19618
+ init_html_kind();
19619
+ builtins = new Map([
19620
+ ["*", false],
19621
+ ["_", true]
19622
+ ]);
19623
+ });
19175
19624
 
19176
19625
  // ../../node_modules/mdast-util-to-markdown/lib/util/container-flow.js
19177
19626
  function containerFlow(parent, state, info) {
@@ -19254,19 +19703,24 @@ function safe(state, input, config) {
19254
19703
  const positions = [];
19255
19704
  const result = [];
19256
19705
  const infos = {};
19706
+ const percentEncode = state.stack.includes("autolink");
19707
+ const offset = config.before ? config.before.length : 0;
19708
+ const end = value.length - (config.after ? config.after.length : 0);
19257
19709
  let index = -1;
19258
19710
  while (++index < state.unsafe.length) {
19259
19711
  const pattern = state.unsafe[index];
19260
- if (!patternInScope(state.stack, pattern)) {
19712
+ if (!patternInScope(state.stack, pattern) || !nodeInScope(pattern.beforeNode, config.beforeNode) || !nodeInScope(pattern.afterNode, config.afterNode)) {
19261
19713
  continue;
19262
19714
  }
19263
19715
  const expression = state.compilePattern(pattern);
19716
+ const from = pattern.beforeNode ? offset : 0;
19717
+ const subject = value.slice(from, pattern.afterNode ? end : undefined);
19264
19718
  let match;
19265
- while (match = expression.exec(value)) {
19719
+ while (match = expression.exec(subject)) {
19266
19720
  const before = "before" in pattern || Boolean(pattern.atBreak);
19267
19721
  const after = "after" in pattern;
19268
- const position = match.index + (before ? match[1].length : 0);
19269
- if (positions.includes(position)) {
19722
+ const position = from + match.index + (before ? match[1].length : 0);
19723
+ if (own7.call(infos, position)) {
19270
19724
  if (infos[position].before && !before) {
19271
19725
  infos[position].before = false;
19272
19726
  }
@@ -19280,31 +19734,53 @@ function safe(state, input, config) {
19280
19734
  }
19281
19735
  }
19282
19736
  positions.sort(numerical);
19283
- let start = config.before ? config.before.length : 0;
19284
- const end = value.length - (config.after ? config.after.length : 0);
19737
+ let start = offset;
19285
19738
  index = -1;
19286
19739
  while (++index < positions.length) {
19287
19740
  const position = positions[index];
19288
19741
  if (position < start || position >= end) {
19289
19742
  continue;
19290
19743
  }
19744
+ 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)))) {
19745
+ let sequenceEnd = position + 1;
19746
+ while (sequenceEnd < end && value.charAt(sequenceEnd) === "_") {
19747
+ sequenceEnd++;
19748
+ }
19749
+ const skip = sequenceEnd - position - 1;
19750
+ 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)))) {
19751
+ index += skip;
19752
+ continue;
19753
+ }
19754
+ }
19291
19755
  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) {
19292
19756
  continue;
19293
19757
  }
19294
19758
  if (start !== position) {
19295
- result.push(escapeBackslashes(value.slice(start, position), "\\"));
19759
+ const slice = value.slice(start, position);
19760
+ result.push(percentEncode ? slice : escapeBackslashes(slice, "\\"));
19296
19761
  }
19297
19762
  start = position;
19298
- if (/[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || !config.encode.includes(value.charAt(position)))) {
19763
+ if (percentEncode) {
19764
+ result.push("%" + value.charCodeAt(position).toString(16).toUpperCase().padStart(2, "0"));
19765
+ start++;
19766
+ } else if (/[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || !config.encode.includes(value.charAt(position)))) {
19299
19767
  result.push("\\");
19300
19768
  } else {
19301
19769
  result.push(encodeCharacterReference(value.charCodeAt(position)));
19302
19770
  start++;
19303
19771
  }
19304
19772
  }
19305
- result.push(escapeBackslashes(value.slice(start, end), config.after));
19773
+ const rest = value.slice(start, end);
19774
+ result.push(percentEncode ? rest : escapeBackslashes(rest, config.after));
19306
19775
  return result.join("");
19307
19776
  }
19777
+ function nodeInScope(types, node) {
19778
+ if (!types)
19779
+ return true;
19780
+ if (!node)
19781
+ return false;
19782
+ return typeof types === "string" ? types === node.type : types.includes(node.type);
19783
+ }
19308
19784
  function numerical(a, b) {
19309
19785
  return a - b;
19310
19786
  }
@@ -19329,7 +19805,11 @@ function escapeBackslashes(value, after) {
19329
19805
  results.push(value.slice(start));
19330
19806
  return results.join("");
19331
19807
  }
19332
- var init_safe = () => {};
19808
+ var own7;
19809
+ var init_safe = __esm(() => {
19810
+ init_dev6();
19811
+ own7 = {}.hasOwnProperty;
19812
+ });
19333
19813
 
19334
19814
  // ../../node_modules/mdast-util-to-markdown/lib/util/track.js
19335
19815
  function track(config) {
@@ -19360,6 +19840,8 @@ function toMarkdown(tree, options) {
19360
19840
  const settings = options || {};
19361
19841
  const state = {
19362
19842
  associationId: association,
19843
+ bulletCurrent: undefined,
19844
+ bulletLastUsed: undefined,
19363
19845
  containerPhrasing: containerPhrasingBound,
19364
19846
  containerFlow: containerFlowBound,
19365
19847
  createTracker: track,
@@ -19384,14 +19866,9 @@ function toMarkdown(tree, options) {
19384
19866
  unknown,
19385
19867
  handlers: state.handlers
19386
19868
  });
19387
- let result = state.handle(tree, undefined, state, {
19388
- before: `
19389
- `,
19390
- after: `
19391
- `,
19392
- now: { line: 1, column: 1 },
19393
- lineShift: 0
19394
- });
19869
+ let result = state.handle(phrasing(tree) ? { type: "root", children: [tree] } : tree, undefined, state, { before: `
19870
+ `, after: `
19871
+ `, now: { line: 1, column: 1 }, lineShift: 0 });
19395
19872
  if (result && result.charCodeAt(result.length - 1) !== 10 && result.charCodeAt(result.length - 1) !== 13) {
19396
19873
  result += `
19397
19874
  `;
@@ -19427,6 +19904,7 @@ function safeBound(value, config) {
19427
19904
  return safe(this, value, config);
19428
19905
  }
19429
19906
  var init_lib17 = __esm(() => {
19907
+ init_mdast_util_phrasing();
19430
19908
  init_zwitch();
19431
19909
  init_configure();
19432
19910
  init_handle();
@@ -19992,7 +20470,7 @@ function previousUnbalanced(events) {
19992
20470
  }
19993
20471
  return result;
19994
20472
  }
19995
- var wwwPrefix, domain, path, trail, emailDomainDotTrail, wwwAutolink, protocolAutolink, emailAutolink, text4, code2;
20473
+ var wwwPrefix, domain, path, trail, emailDomainDotTrail, wwwAutolink, protocolAutolink, emailAutolink, text4, code3;
19996
20474
  var init_syntax2 = __esm(() => {
19997
20475
  init_dev4();
19998
20476
  init_default();
@@ -20020,14 +20498,14 @@ var init_syntax2 = __esm(() => {
20020
20498
  previous: previousEmail
20021
20499
  };
20022
20500
  text4 = {};
20023
- code2 = codes.digit0;
20024
- while (code2 < codes.leftCurlyBrace) {
20025
- text4[code2] = emailAutolink;
20026
- code2++;
20027
- if (code2 === codes.colon)
20028
- code2 = codes.uppercaseA;
20029
- else if (code2 === codes.leftSquareBracket)
20030
- code2 = codes.lowercaseA;
20501
+ code3 = codes.digit0;
20502
+ while (code3 < codes.leftCurlyBrace) {
20503
+ text4[code3] = emailAutolink;
20504
+ code3++;
20505
+ if (code3 === codes.colon)
20506
+ code3 = codes.uppercaseA;
20507
+ else if (code3 === codes.leftSquareBracket)
20508
+ code3 = codes.lowercaseA;
20031
20509
  }
20032
20510
  text4[codes.plusSign] = emailAutolink;
20033
20511
  text4[codes.dash] = emailAutolink;
@@ -20425,12 +20903,13 @@ var init_dev19 = __esm(() => {
20425
20903
  });
20426
20904
 
20427
20905
  // ../../node_modules/micromark-extension-gfm-table/dev/lib/edit-map.js
20428
- class EditMap {
20906
+ class EditMap2 {
20429
20907
  constructor() {
20430
20908
  this.map = [];
20909
+ this.index = new Map;
20431
20910
  }
20432
20911
  add(index, remove, add) {
20433
- addImplementation(this, index, remove, add);
20912
+ addImplementation2(this, index, remove, add);
20434
20913
  }
20435
20914
  consume(events) {
20436
20915
  this.map.sort(function(a, b) {
@@ -20456,22 +20935,22 @@ class EditMap {
20456
20935
  slice = vecs.pop();
20457
20936
  }
20458
20937
  this.map.length = 0;
20938
+ this.index.clear();
20459
20939
  }
20460
20940
  }
20461
- function addImplementation(editMap, at, remove, add) {
20462
- let index = 0;
20941
+ function addImplementation2(editMap, at, remove, add) {
20463
20942
  if (remove === 0 && add.length === 0) {
20464
20943
  return;
20465
20944
  }
20466
- while (index < editMap.map.length) {
20467
- if (editMap.map[index][0] === at) {
20468
- editMap.map[index][1] += remove;
20469
- editMap.map[index][2].push(...add);
20470
- return;
20471
- }
20472
- index += 1;
20945
+ const existing = editMap.index.get(at);
20946
+ if (existing) {
20947
+ existing[1] += remove;
20948
+ existing[2].push(...add);
20949
+ return;
20473
20950
  }
20474
- editMap.map.push([at, remove, add]);
20951
+ const change = [at, remove, add];
20952
+ editMap.map.push(change);
20953
+ editMap.index.set(at, change);
20475
20954
  }
20476
20955
 
20477
20956
  // ../../node_modules/micromark-extension-gfm-table/dev/lib/infer.js
@@ -20522,11 +21001,12 @@ function tokenizeTable(effects, ok2, nok) {
20522
21001
  function start(code) {
20523
21002
  let index = self2.events.length - 1;
20524
21003
  while (index > -1) {
20525
- const type = self2.events[index][1].type;
20526
- if (type === types.lineEnding || type === types.linePrefix)
21004
+ const { type } = self2.events[index][1];
21005
+ if (type === types.lineEnding || type === types.linePrefix) {
20527
21006
  index--;
20528
- else
21007
+ } else {
20529
21008
  break;
21009
+ }
20530
21010
  }
20531
21011
  const tail = index > -1 ? self2.events[index][1].type : null;
20532
21012
  const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
@@ -20741,7 +21221,7 @@ function resolveTable(events, context) {
20741
21221
  let currentTable;
20742
21222
  let currentBody;
20743
21223
  let currentCell;
20744
- const map = new EditMap;
21224
+ const map = new EditMap2;
20745
21225
  while (++index < events.length) {
20746
21226
  const event = events[index];
20747
21227
  const token = event[1];
@@ -21752,7 +22232,7 @@ var init_dangerous = __esm(() => {
21752
22232
  // ../../node_modules/stringify-entities/lib/util/to-named.js
21753
22233
  function toNamed(code, next, omit, attribute) {
21754
22234
  const character = String.fromCharCode(code);
21755
- if (own7.call(characters, character)) {
22235
+ if (own8.call(characters, character)) {
21756
22236
  const name = characters[character];
21757
22237
  const value = "&" + name;
21758
22238
  if (omit && characterEntitiesLegacy.includes(name) && !dangerous.includes(name) && (!attribute || next && next !== 61 && notAlphanumericRegex.test(String.fromCharCode(next)))) {
@@ -21762,15 +22242,15 @@ function toNamed(code, next, omit, attribute) {
21762
22242
  }
21763
22243
  return "";
21764
22244
  }
21765
- var own7, characters, key, notAlphanumericRegex;
22245
+ var own8, characters, key, notAlphanumericRegex;
21766
22246
  var init_to_named = __esm(() => {
21767
22247
  init_character_entities_legacy();
21768
22248
  init_character_entities_html4();
21769
22249
  init_dangerous();
21770
- own7 = {}.hasOwnProperty;
22250
+ own8 = {}.hasOwnProperty;
21771
22251
  characters = {};
21772
22252
  for (key in characterEntitiesHtml4) {
21773
- if (own7.call(characterEntitiesHtml4, key)) {
22253
+ if (own8.call(characterEntitiesHtml4, key)) {
21774
22254
  characters[characterEntitiesHtml4[key]] = key;
21775
22255
  }
21776
22256
  }
@@ -21958,12 +22438,14 @@ function directiveToMarkdown(options) {
21958
22438
  inConstruct: ["leafDirectiveLabel", "containerDirectiveLabel"]
21959
22439
  },
21960
22440
  {
22441
+ after: "[^\\s\\p{P}\\p{S}]",
21961
22442
  before: "[^:]",
21962
22443
  character: ":",
21963
- after: "[A-Za-z]",
21964
- inConstruct: ["phrasing"]
22444
+ inConstruct: ["phrasing"],
22445
+ unicode: true
21965
22446
  },
21966
- { atBreak: true, character: ":", after: ":" }
22447
+ { afterNode: "textDirective", character: ":", inConstruct: ["phrasing"] },
22448
+ { atBreak: true, before: ":+", character: ":" }
21967
22449
  ]
21968
22450
  };
21969
22451
  function handleDirective(node, _, state, info) {
@@ -21971,6 +22453,8 @@ function directiveToMarkdown(options) {
21971
22453
  const sequence = fence3(node);
21972
22454
  const exit = state.enter(node.type);
21973
22455
  let value = tracker.move(sequence + (node.name || ""));
22456
+ const attributesValue = attributes(node, state);
22457
+ const after = info.after.charCodeAt(0);
21974
22458
  let label;
21975
22459
  if (node.type === "containerDirective") {
21976
22460
  const head = (node.children || [])[0];
@@ -21991,8 +22475,10 @@ function directiveToMarkdown(options) {
21991
22475
  value += tracker.move("]");
21992
22476
  subexit();
21993
22477
  exit();
22478
+ } else if (!attributesValue && (after === 45 || after === 95 || !(unicodePunctuation(after) || unicodeWhitespace(after)))) {
22479
+ value += tracker.move("[]");
21994
22480
  }
21995
- value += tracker.move(attributes(node, state));
22481
+ value += tracker.move(attributesValue || (after === 123 ? "{}" : ""));
21996
22482
  if (node.type === "containerDirective") {
21997
22483
  const head = (node.children || [])[0];
21998
22484
  let shallow = node;
@@ -22018,12 +22504,12 @@ function directiveToMarkdown(options) {
22018
22504
  let id;
22019
22505
  let key;
22020
22506
  for (key in attributes) {
22021
- if (own8.call(attributes, key) && attributes[key] !== undefined && attributes[key] !== null) {
22507
+ if (own9.call(attributes, key) && attributes[key] !== undefined && attributes[key] !== null) {
22022
22508
  const value = String(attributes[key]);
22023
22509
  if (key === "id") {
22024
22510
  id = settings.preferShortcut !== false && shortcut.test(value) ? "#" + value : quoted("id", value, node, state);
22025
22511
  } else if (key === "class") {
22026
- const list = value.split(/[\t\n\r ]+/g);
22512
+ const list = value.split(/[\t\n\r ]+/);
22027
22513
  const classesFullList = [];
22028
22514
  const classesList = [];
22029
22515
  let index = -1;
@@ -22169,13 +22655,14 @@ function fence3(node) {
22169
22655
  }
22170
22656
  return ":".repeat(size);
22171
22657
  }
22172
- var own8, emptyOptions4, shortcut, unquoted;
22658
+ var own9, emptyOptions4, shortcut, unquoted;
22173
22659
  var init_lib25 = __esm(() => {
22174
22660
  init_development();
22661
+ init_dev4();
22175
22662
  init_parse_entities();
22176
22663
  init_stringify_entities();
22177
22664
  init_unist_util_visit_parents3();
22178
- own8 = {}.hasOwnProperty;
22665
+ own9 = {}.hasOwnProperty;
22179
22666
  emptyOptions4 = {};
22180
22667
  shortcut = /^[^\t\n\r "#'.<=>`}]+$/;
22181
22668
  unquoted = /^[^\t\n\r "'<=>`}]+$/;
@@ -24433,7 +24920,7 @@ function element(state, node) {
24433
24920
  while (++index < node.attrs.length) {
24434
24921
  const attribute = node.attrs[index];
24435
24922
  const name = (attribute.prefix ? attribute.prefix + ":" : "") + attribute.name;
24436
- if (!own9.call(proto, name)) {
24923
+ if (!own10.call(proto, name)) {
24437
24924
  properties[name] = attribute.value;
24438
24925
  }
24439
24926
  }
@@ -24475,7 +24962,7 @@ function createLocation(state, node, location) {
24475
24962
  let key;
24476
24963
  if (location.attrs) {
24477
24964
  for (key in location.attrs) {
24478
- if (own9.call(location.attrs, key)) {
24965
+ if (own10.call(location.attrs, key)) {
24479
24966
  properties[find(state.schema, key).property] = position2(location.attrs[key]);
24480
24967
  }
24481
24968
  }
@@ -24508,14 +24995,14 @@ function position2(loc) {
24508
24995
  function point3(point) {
24509
24996
  return point.line && point.column ? point : undefined;
24510
24997
  }
24511
- var own9, proto;
24998
+ var own10, proto;
24512
24999
  var init_lib29 = __esm(() => {
24513
25000
  init_development();
24514
25001
  init_hastscript();
24515
25002
  init_property_information();
24516
25003
  init_vfile_location();
24517
25004
  init_web_namespaces();
24518
- own9 = {}.hasOwnProperty;
25005
+ own10 = {}.hasOwnProperty;
24519
25006
  proto = Object.prototype;
24520
25007
  });
24521
25008
 
@@ -48310,12 +48797,12 @@ var init_siblings = __esm(() => {
48310
48797
  function omission(handlers) {
48311
48798
  return omit;
48312
48799
  function omit(node, index, parent) {
48313
- return own10.call(handlers, node.tagName) && handlers[node.tagName](node, index, parent);
48800
+ return own11.call(handlers, node.tagName) && handlers[node.tagName](node, index, parent);
48314
48801
  }
48315
48802
  }
48316
- var own10;
48803
+ var own11;
48317
48804
  var init_omission = __esm(() => {
48318
- own10 = {}.hasOwnProperty;
48805
+ own11 = {}.hasOwnProperty;
48319
48806
  });
48320
48807
 
48321
48808
  // ../../node_modules/hast-util-to-html/lib/omission/closing.js