securemark 0.293.5 → 0.294.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.js +973 -617
  3. package/markdown.d.ts +13 -13
  4. package/package.json +3 -3
  5. package/src/combinator/control/constraint/block.test.ts +6 -6
  6. package/src/combinator/control/constraint/contract.ts +4 -4
  7. package/src/combinator/control/constraint/line.test.ts +7 -7
  8. package/src/combinator/control/constraint/line.ts +2 -2
  9. package/src/combinator/control/manipulation/clear.ts +2 -3
  10. package/src/combinator/control/manipulation/convert.ts +2 -2
  11. package/src/combinator/control/manipulation/duplicate.ts +4 -5
  12. package/src/combinator/control/manipulation/fence.ts +2 -2
  13. package/src/combinator/control/manipulation/indent.test.ts +2 -2
  14. package/src/combinator/control/manipulation/indent.ts +4 -8
  15. package/src/combinator/control/manipulation/reverse.ts +2 -2
  16. package/src/combinator/control/manipulation/scope.ts +4 -7
  17. package/src/combinator/control/manipulation/surround.ts +16 -20
  18. package/src/combinator/control/monad/bind.ts +7 -8
  19. package/src/combinator/control/monad/fmap.ts +7 -7
  20. package/src/combinator/data/data.ts +135 -0
  21. package/src/combinator/data/parser/context.test.ts +8 -8
  22. package/src/combinator/data/parser/context.ts +3 -3
  23. package/src/combinator/data/parser/inits.ts +8 -11
  24. package/src/combinator/data/parser/sequence.test.ts +3 -3
  25. package/src/combinator/data/parser/sequence.ts +8 -11
  26. package/src/combinator/data/parser/some.test.ts +3 -3
  27. package/src/combinator/data/parser/some.ts +7 -9
  28. package/src/combinator/data/parser/subsequence.test.ts +4 -4
  29. package/src/combinator/data/parser/subsequence.ts +3 -3
  30. package/src/combinator/data/parser/tails.ts +3 -3
  31. package/src/combinator/data/parser/union.test.ts +3 -3
  32. package/src/combinator/data/parser.ts +11 -20
  33. package/src/debug.test.ts +7 -6
  34. package/src/parser/api/bind.ts +8 -10
  35. package/src/parser/api/header.ts +2 -2
  36. package/src/parser/api/normalize.ts +2 -2
  37. package/src/parser/api/parse.ts +4 -2
  38. package/src/parser/block/blockquote.ts +6 -4
  39. package/src/parser/block/codeblock.ts +8 -7
  40. package/src/parser/block/dlist.ts +9 -8
  41. package/src/parser/block/extension/aside.ts +27 -21
  42. package/src/parser/block/extension/example.ts +29 -26
  43. package/src/parser/block/extension/fig.ts +1 -1
  44. package/src/parser/block/extension/figbase.ts +6 -5
  45. package/src/parser/block/extension/figure.ts +24 -20
  46. package/src/parser/block/extension/message.ts +35 -24
  47. package/src/parser/block/extension/placeholder.ts +17 -13
  48. package/src/parser/block/extension/table.ts +47 -40
  49. package/src/parser/block/heading.test.ts +3 -12
  50. package/src/parser/block/heading.ts +12 -8
  51. package/src/parser/block/ilist.ts +13 -12
  52. package/src/parser/block/mathblock.ts +21 -17
  53. package/src/parser/block/mediablock.ts +7 -5
  54. package/src/parser/block/olist.ts +15 -5
  55. package/src/parser/block/pagebreak.ts +2 -1
  56. package/src/parser/block/paragraph.ts +3 -1
  57. package/src/parser/block/reply/cite.ts +20 -15
  58. package/src/parser/block/reply/quote.ts +6 -4
  59. package/src/parser/block/reply.ts +6 -3
  60. package/src/parser/block/sidefence.ts +8 -7
  61. package/src/parser/block/table.ts +23 -22
  62. package/src/parser/block/ulist.ts +16 -12
  63. package/src/parser/block.ts +11 -6
  64. package/src/parser/header.ts +18 -18
  65. package/src/parser/inline/annotation.ts +3 -1
  66. package/src/parser/inline/autolink/account.ts +3 -2
  67. package/src/parser/inline/autolink/anchor.ts +3 -2
  68. package/src/parser/inline/autolink/channel.ts +5 -4
  69. package/src/parser/inline/autolink/email.ts +4 -3
  70. package/src/parser/inline/autolink/hashnum.ts +3 -2
  71. package/src/parser/inline/autolink/hashtag.ts +4 -3
  72. package/src/parser/inline/autolink/url.ts +7 -6
  73. package/src/parser/inline/bracket.ts +16 -15
  74. package/src/parser/inline/code.ts +5 -4
  75. package/src/parser/inline/deletion.ts +5 -5
  76. package/src/parser/inline/emphasis.ts +4 -3
  77. package/src/parser/inline/emstrong.test.ts +18 -18
  78. package/src/parser/inline/emstrong.ts +37 -28
  79. package/src/parser/inline/extension/index.ts +22 -19
  80. package/src/parser/inline/extension/indexee.ts +2 -2
  81. package/src/parser/inline/extension/indexer.ts +2 -1
  82. package/src/parser/inline/extension/label.ts +7 -3
  83. package/src/parser/inline/extension/placeholder.ts +6 -6
  84. package/src/parser/inline/html.ts +27 -28
  85. package/src/parser/inline/htmlentity.ts +9 -8
  86. package/src/parser/inline/insertion.ts +5 -5
  87. package/src/parser/inline/italic.ts +5 -5
  88. package/src/parser/inline/link.ts +36 -38
  89. package/src/parser/inline/mark.ts +7 -7
  90. package/src/parser/inline/math.ts +5 -4
  91. package/src/parser/inline/media.ts +33 -32
  92. package/src/parser/inline/reference.ts +19 -20
  93. package/src/parser/inline/remark.ts +11 -11
  94. package/src/parser/inline/ruby.ts +50 -53
  95. package/src/parser/inline/strong.ts +4 -3
  96. package/src/parser/inline/template.ts +16 -15
  97. package/src/parser/inline.test.ts +3 -3
  98. package/src/parser/processor/note.ts +2 -2
  99. package/src/parser/segment.ts +5 -3
  100. package/src/parser/source/escapable.ts +9 -8
  101. package/src/parser/source/line.ts +9 -3
  102. package/src/parser/source/str.ts +3 -3
  103. package/src/parser/source/text.ts +9 -8
  104. package/src/parser/source/unescapable.ts +6 -5
  105. package/src/parser/util.ts +20 -15
  106. package/src/parser/visibility.ts +19 -20
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.293.5 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.294.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("Prism"), require("DOMPurify"));
@@ -840,41 +840,71 @@ class List {
840
840
  if (this.length === 0) return;
841
841
  return this.delete(this.head.prev);
842
842
  }
843
+ import(list, before) {
844
+ if (list.length === 0) return this;
845
+ if (this.length === 0) {
846
+ this.head = list.head;
847
+ this.length += list.length;
848
+ list.head = undefined;
849
+ list.length = 0;
850
+ return this;
851
+ }
852
+ const head = list.head;
853
+ const last = list.last;
854
+ const next = last.next = before ?? this.head;
855
+ const prev = head.prev = next.prev;
856
+ next.prev = last;
857
+ prev.next = head;
858
+ this.length += list.length;
859
+ list.length = 0;
860
+ list.head = undefined;
861
+ return this;
862
+ }
843
863
  clear() {
844
864
  this.length = 0;
845
865
  this.head = undefined;
846
866
  }
847
867
  *[Symbol.iterator]() {
848
- for (let node = this.head; node !== undefined;) {
868
+ for (let node = this.head; node && this.head;) {
869
+ const next = node.next;
849
870
  yield node;
850
- node = node.next;
871
+ node = next;
851
872
  if (node === this.head) break;
852
873
  }
853
874
  }
854
875
  flatMap(f) {
855
- const acc = [];
856
- for (let node = this.head; node !== undefined;) {
857
- const as = f(node);
858
- switch (as.length) {
859
- case 0:
860
- break;
861
- case 1:
862
- acc.push(as[0]);
863
- break;
864
- default:
865
- for (let len = as.length, i = 0; i < len; ++i) {
866
- acc.push(as[i]);
867
- }
868
- }
869
- node = node.next;
876
+ const acc = new List();
877
+ for (let node = this.head; node && this.head;) {
878
+ const next = node.next;
879
+ acc.import(f(node));
880
+ node = next;
881
+ if (node === this.head) break;
882
+ }
883
+ return acc;
884
+ }
885
+ foldl(f, acc) {
886
+ for (let node = this.head; node && this.head;) {
887
+ const next = node.next;
888
+ acc = f(acc, node);
889
+ node = next;
890
+ if (node === this.head) break;
891
+ }
892
+ return acc;
893
+ }
894
+ foldr(f, acc) {
895
+ for (let node = this.head?.prev; node && this.head;) {
896
+ const prev = node.prev;
897
+ acc = f(node, acc);
870
898
  if (node === this.head) break;
899
+ node = prev;
871
900
  }
872
901
  return acc;
873
902
  }
874
903
  find(f) {
875
- for (let node = this.head; node !== undefined;) {
904
+ for (let node = this.head; node && this.head;) {
905
+ const next = node.next;
876
906
  if (f(node)) return node;
877
- node = node.next;
907
+ node = next;
878
908
  if (node === this.head) break;
879
909
  }
880
910
  }
@@ -959,36 +989,67 @@ class List {
959
989
  if (this.length === 0) return;
960
990
  return this.delete(this.last);
961
991
  }
992
+ import(list, before) {
993
+ if (list.length === 0) return this;
994
+ if (this.length === 0) {
995
+ this.head = list.head;
996
+ this.length += list.length;
997
+ list.head = undefined;
998
+ list.length = 0;
999
+ return this;
1000
+ }
1001
+ const head = list.head;
1002
+ const last = list.last;
1003
+ const next = last.next = before ?? this.head;
1004
+ const prev = head.prev = next.prev;
1005
+ next.prev = last;
1006
+ prev.next = head;
1007
+ this.length += list.length;
1008
+ list.length = 0;
1009
+ list.head = undefined;
1010
+ return this;
1011
+ }
962
1012
  clear() {
963
1013
  this.length = 0;
964
1014
  this.head = this.last = undefined;
965
1015
  }
966
1016
  *[Symbol.iterator]() {
967
- for (let node = this.head; node !== undefined; node = node.next) {
1017
+ for (let node = this.head; node && this.head;) {
1018
+ const next = node.next;
968
1019
  yield node;
1020
+ node = next;
969
1021
  }
970
1022
  }
971
1023
  flatMap(f) {
972
- const acc = [];
973
- for (let node = this.head; node !== undefined; node = node.next) {
974
- const as = f(node);
975
- switch (as.length) {
976
- case 0:
977
- break;
978
- case 1:
979
- acc.push(as[0]);
980
- break;
981
- default:
982
- for (let len = as.length, i = 0; i < len; ++i) {
983
- acc.push(as[i]);
984
- }
985
- }
1024
+ const acc = new List();
1025
+ for (let node = this.head; node && this.head;) {
1026
+ const next = node.next;
1027
+ acc.import(f(node));
1028
+ node = next;
1029
+ }
1030
+ return acc;
1031
+ }
1032
+ foldl(f, acc) {
1033
+ for (let node = this.head; node && this.head;) {
1034
+ const next = node.next;
1035
+ acc = f(acc, node);
1036
+ node = next;
1037
+ }
1038
+ return acc;
1039
+ }
1040
+ foldr(f, acc) {
1041
+ for (let node = this.head?.prev; node && this.head;) {
1042
+ const prev = node.prev;
1043
+ acc = f(node, acc);
1044
+ node = prev;
986
1045
  }
987
1046
  return acc;
988
1047
  }
989
1048
  find(f) {
990
- for (let node = this.head; node !== undefined; node = node.next) {
1049
+ for (let node = this.head; node && this.head;) {
1050
+ const next = node.next;
991
1051
  if (f(node)) return node;
1052
+ node = next;
992
1053
  }
993
1054
  }
994
1055
  }
@@ -1036,6 +1097,7 @@ exports.memoize = memoize;
1036
1097
  function memoizeArray(f, identify, memory) {
1037
1098
  return (...as) => {
1038
1099
  const b = identify(...as);
1100
+ if (!(b >= 0)) return f(...as);
1039
1101
  let z = memory[b];
1040
1102
  if (z !== undefined) return z;
1041
1103
  z = f(...as);
@@ -1047,6 +1109,7 @@ function memoizeObject(f, identify, memory) {
1047
1109
  let nullable = false;
1048
1110
  return (...as) => {
1049
1111
  const b = identify(...as);
1112
+ if (!(b >= 0)) return f(...as);
1050
1113
  let z = memory[b];
1051
1114
  if (z !== undefined || nullable && b in memory) return z;
1052
1115
  z = f(...as);
@@ -1346,15 +1409,15 @@ exports.rnd32 = cons(32);
1346
1409
  exports.rnd36 = cons(36);
1347
1410
  exports.rnd62 = cons(62);
1348
1411
  exports.rnd64 = cons(64);
1349
- exports.rnd09 = conv(exports.rnd10, table0_);
1350
- exports.rnd0f = conv(exports.rnd16, table0_);
1351
- exports.rnd0v = conv(exports.rnd32, table0_);
1352
- exports.rnd0z = conv(exports.rnd36, table0_);
1353
- exports.rnd0Z = conv(exports.rnd62, table0_);
1354
- exports.rnd0S = conv(exports.rnd64, table0S);
1355
- exports.rnd0_ = conv(exports.rnd64, table0_);
1356
- exports.rndAP = conv(exports.rnd16, tableAz);
1357
- exports.rndAf = conv(exports.rnd32, tableAz);
1412
+ exports.rnd09 = conv(exports.rnd10, table0_, 10);
1413
+ exports.rnd0f = conv(exports.rnd16, table0_, 16);
1414
+ exports.rnd0v = conv(exports.rnd32, table0_, 32);
1415
+ exports.rnd0z = conv(exports.rnd36, table0_, 36);
1416
+ exports.rnd0Z = conv(exports.rnd62, table0_, 62);
1417
+ exports.rnd0S = conv(exports.rnd64, table0S, 64);
1418
+ exports.rnd0_ = conv(exports.rnd64, table0_, 64);
1419
+ exports.rndAP = conv(exports.rnd16, tableAz, 16);
1420
+ exports.rndAf = conv(exports.rnd32, tableAz, 32);
1358
1421
  function unique(rng, len = 1, mem) {
1359
1422
  const independence = !mem;
1360
1423
  mem ??= new Set();
@@ -1398,11 +1461,13 @@ function cons(size) {
1398
1461
  return r < size ? r : rng();
1399
1462
  };
1400
1463
  }
1401
- function conv($rng, table) {
1464
+ function conv($rng, table, size) {
1402
1465
  return (len = 1, rng = $rng) => {
1403
1466
  let acc = '';
1404
1467
  while (len--) {
1405
- acc += table[rng()];
1468
+ const i = rng();
1469
+ if (i >= size) throw new Error(`Spica: Random: Invalid rng`);
1470
+ acc += table[i];
1406
1471
  }
1407
1472
  return acc;
1408
1473
  };
@@ -2525,7 +2590,7 @@ function verify(parser, cond) {
2525
2590
  } = context;
2526
2591
  if (position === source.length) return;
2527
2592
  const result = parser(input);
2528
- if (result && !cond((0, parser_1.eval)(result), context)) return;
2593
+ if (result && !cond(result, context)) return;
2529
2594
  return result;
2530
2595
  });
2531
2596
  }
@@ -2564,7 +2629,7 @@ function line(parser) {
2564
2629
  if (result === undefined) return;
2565
2630
  if (!isBlank(source.slice(context.position, position + line.length))) return;
2566
2631
  context.position = position + line.length;
2567
- return [(0, parser_1.eval)(result)];
2632
+ return result;
2568
2633
  });
2569
2634
  }
2570
2635
  exports.line = line;
@@ -2581,7 +2646,7 @@ exports.isBlank = isBlank;
2581
2646
  /***/ },
2582
2647
 
2583
2648
  /***/ 8606
2584
- (__unused_webpack_module, exports) {
2649
+ (__unused_webpack_module, exports, __webpack_require__) {
2585
2650
 
2586
2651
  "use strict";
2587
2652
 
@@ -2590,8 +2655,9 @@ Object.defineProperty(exports, "__esModule", ({
2590
2655
  value: true
2591
2656
  }));
2592
2657
  exports.clear = void 0;
2658
+ const parser_1 = __webpack_require__(605);
2593
2659
  function clear(parser) {
2594
- return input => parser(input) && [[]];
2660
+ return input => parser(input) && new parser_1.List();
2595
2661
  }
2596
2662
  exports.clear = clear;
2597
2663
 
@@ -2622,7 +2688,7 @@ function convert(conv, parser, continuous, empty = false) {
2622
2688
  if (src === '') {
2623
2689
  if (!empty) return;
2624
2690
  context.position = source.length;
2625
- return [[]];
2691
+ return new parser_1.List();
2626
2692
  }
2627
2693
  if (continuous) {
2628
2694
  context.position += source.length - position - src.length;
@@ -2654,9 +2720,10 @@ Object.defineProperty(exports, "__esModule", ({
2654
2720
  value: true
2655
2721
  }));
2656
2722
  exports.dup = void 0;
2723
+ const parser_1 = __webpack_require__(605);
2657
2724
  const fmap_1 = __webpack_require__(2705);
2658
2725
  function dup(parser) {
2659
- return (0, fmap_1.fmap)(parser, nodes => [nodes]);
2726
+ return (0, fmap_1.fmap)(parser, nodes => new parser_1.List([new parser_1.Data(nodes)]));
2660
2727
  }
2661
2728
  exports.dup = dup;
2662
2729
 
@@ -2739,7 +2806,7 @@ function fence(opener, limit, separation = true) {
2739
2806
  }
2740
2807
  context.position += line.length;
2741
2808
  }
2742
- return [(0, array_1.push)([block, overflow, closer], matches)];
2809
+ return new parser_1.List((0, array_1.push)([block, overflow, closer], matches).map(str => new parser_1.Data(str)));
2743
2810
  });
2744
2811
  }
2745
2812
  exports.fence = fence;
@@ -2778,10 +2845,9 @@ function indent(opener, parser = false, separation = false) {
2778
2845
  position
2779
2846
  } = context;
2780
2847
  context.position = source.length;
2781
- return [[source.slice(position)]];
2782
- }))), ([indent]) => indent.length * 2 + +(indent[0] === ' '), {})), separation), (lines, context) => {
2783
- const result = parser((0, parser_1.subinput)(trimBlockEnd(lines.join('')), context));
2784
- return result ? [(0, parser_1.eval)(result)] : undefined;
2848
+ return new parser_1.List([new parser_1.Data(source.slice(position))]);
2849
+ }))), ([indent]) => indent.length <= 16 ? indent.length * 2 + +(indent[0] === ' ') : -1, [])), separation), (lines, context) => {
2850
+ return parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context));
2785
2851
  }));
2786
2852
  }
2787
2853
  exports.indent = indent;
@@ -2886,9 +2952,10 @@ Object.defineProperty(exports, "__esModule", ({
2886
2952
  value: true
2887
2953
  }));
2888
2954
  exports.reverse = void 0;
2955
+ const parser_1 = __webpack_require__(605);
2889
2956
  const fmap_1 = __webpack_require__(2705);
2890
2957
  function reverse(parser) {
2891
- return (0, fmap_1.fmap)(parser, nodes => nodes.reverse());
2958
+ return (0, fmap_1.fmap)(parser, nodes => nodes.foldr((node, acc) => acc.push(nodes.delete(node)) && acc, new parser_1.List()));
2892
2959
  }
2893
2960
  exports.reverse = reverse;
2894
2961
 
@@ -2916,9 +2983,9 @@ function focus(scope, parser) {
2916
2983
  position
2917
2984
  } = context;
2918
2985
  if (position === source.length) return;
2919
- const src = (0, parser_1.eval)(match({
2986
+ const src = match({
2920
2987
  context
2921
- }))?.[0] ?? '';
2988
+ })?.head?.value ?? '';
2922
2989
  if (src === '') return;
2923
2990
  context.range = src.length;
2924
2991
  context.offset ??= 0;
@@ -2928,8 +2995,7 @@ function focus(scope, parser) {
2928
2995
  context.position += result && context.position === position ? src.length : 0;
2929
2996
  context.source = source;
2930
2997
  context.offset -= position;
2931
- if (result === undefined) return;
2932
- return [(0, parser_1.eval)(result)];
2998
+ return result;
2933
2999
  });
2934
3000
  }
2935
3001
  exports.focus = focus;
@@ -2954,8 +3020,7 @@ function rewrite(scope, parser) {
2954
3020
  context.position += res2 && context.position === position ? src.length : 0;
2955
3021
  context.source = source;
2956
3022
  context.offset -= position;
2957
- if (res2 === undefined) return;
2958
- return [(0, parser_1.eval)(res2)];
3023
+ return res2;
2959
3024
  });
2960
3025
  }
2961
3026
  exports.rewrite = rewrite;
@@ -2974,7 +3039,6 @@ Object.defineProperty(exports, "__esModule", ({
2974
3039
  exports.setBacktrack = exports.isBacktrack = exports.close = exports.open = exports.surround = void 0;
2975
3040
  const parser_1 = __webpack_require__(605);
2976
3041
  const combinator_1 = __webpack_require__(3484);
2977
- const array_1 = __webpack_require__(6876);
2978
3042
  function surround(opener, parser, closer, optional = false, f, g, backtracks = []) {
2979
3043
  switch (typeof opener) {
2980
3044
  case 'string':
@@ -2999,26 +3063,23 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
2999
3063
  linebreak
3000
3064
  } = context;
3001
3065
  context.linebreak = 0;
3002
- const resultO = opener(input);
3003
- const nodesO = (0, parser_1.eval)(resultO);
3066
+ const nodesO = opener(input);
3004
3067
  if (!nodesO) {
3005
3068
  return void revert(context, linebreak);
3006
3069
  }
3007
3070
  if (isBacktrack(context, backtracks, position, context.position - position || 1)) {
3008
3071
  return void revert(context, linebreak);
3009
3072
  }
3010
- const resultM = context.position < source.length ? parser(input) : undefined;
3073
+ const nodesM = context.position < source.length ? parser(input) : undefined;
3011
3074
  context.range = context.position - position;
3012
- const nodesM = (0, parser_1.eval)(resultM);
3013
- if (!resultM && !optional) {
3075
+ if (!nodesM && !optional) {
3014
3076
  setBacktrack(context, backtracks, position);
3015
3077
  const result = g?.([nodesO, nodesM], context);
3016
3078
  revert(context, linebreak);
3017
3079
  return result;
3018
3080
  }
3019
- const resultC = resultM || optional ? closer(input) : undefined;
3081
+ const nodesC = nodesM || optional ? closer(input) : undefined;
3020
3082
  context.range = context.position - position;
3021
- const nodesC = (0, parser_1.eval)(resultC);
3022
3083
  if (!nodesC) {
3023
3084
  setBacktrack(context, backtracks, position);
3024
3085
  const result = g?.([nodesO, nodesM], context);
@@ -3029,7 +3090,7 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3029
3090
  return void revert(context, linebreak);
3030
3091
  }
3031
3092
  context.range = context.position - position;
3032
- const result = f ? f([nodesO, nodesM, nodesC], context) : [(0, array_1.push)(nodesM ? (0, array_1.unshift)(nodesO, nodesM) : nodesO, nodesC)];
3093
+ const result = f ? f([nodesO, nodesM, nodesC], context) : nodesO.import(nodesM ?? new parser_1.List()).import(nodesC);
3033
3094
  if (result) {
3034
3095
  context.linebreak ||= linebreak;
3035
3096
  } else {
@@ -3134,8 +3195,7 @@ function bind(parser, f) {
3134
3195
  const res1 = parser(input);
3135
3196
  if (res1 === undefined) return;
3136
3197
  context.range = context.position - position;
3137
- const res2 = f((0, parser_1.eval)(res1), context);
3138
- if (res2 === undefined) return;
3198
+ const res2 = f(res1, context);
3139
3199
  return context.position > position ? res2 : undefined;
3140
3200
  });
3141
3201
  }
@@ -3155,13 +3215,13 @@ Object.defineProperty(exports, "__esModule", ({
3155
3215
  exports.fmap = void 0;
3156
3216
  const bind_1 = __webpack_require__(994);
3157
3217
  function fmap(parser, f) {
3158
- return (0, bind_1.bind)(parser, (nodes, context) => [f(nodes, context)]);
3218
+ return (0, bind_1.bind)(parser, (nodes, context) => f(nodes, context));
3159
3219
  }
3160
3220
  exports.fmap = fmap;
3161
3221
 
3162
3222
  /***/ },
3163
3223
 
3164
- /***/ 605
3224
+ /***/ 3602
3165
3225
  (__unused_webpack_module, exports) {
3166
3226
 
3167
3227
  "use strict";
@@ -3170,7 +3230,167 @@ exports.fmap = fmap;
3170
3230
  Object.defineProperty(exports, "__esModule", ({
3171
3231
  value: true
3172
3232
  }));
3173
- exports.failsafe = exports.eval = exports.clean = exports.subinput = exports.input = void 0;
3233
+ exports.List = void 0;
3234
+ class List {
3235
+ constructor(nodes) {
3236
+ this.length = 0;
3237
+ this.head = undefined;
3238
+ if (nodes === undefined) return;
3239
+ for (let i = 0; i < nodes.length; ++i) {
3240
+ this.push(nodes[i]);
3241
+ }
3242
+ }
3243
+ get tail() {
3244
+ return this.head?.next;
3245
+ }
3246
+ get last() {
3247
+ return this.head?.prev;
3248
+ }
3249
+ insert(node, before) {
3250
+ if (++this.length === 1) {
3251
+ return this.head = node.next = node.prev = node;
3252
+ }
3253
+ const next = node.next = before ?? this.head;
3254
+ const prev = node.prev = next.prev;
3255
+ return next.prev = prev.next = node;
3256
+ }
3257
+ delete(node) {
3258
+ if (--this.length === 0) {
3259
+ this.head = undefined;
3260
+ } else {
3261
+ const {
3262
+ next,
3263
+ prev
3264
+ } = node;
3265
+ if (node === this.head) {
3266
+ this.head = next;
3267
+ }
3268
+ // Error if not used.
3269
+ prev.next = next;
3270
+ next.prev = prev;
3271
+ }
3272
+ node.next = node.prev = undefined;
3273
+ return node;
3274
+ }
3275
+ unshift(node) {
3276
+ return this.head = this.insert(node, this.head);
3277
+ }
3278
+ push(node) {
3279
+ return this.insert(node, this.head);
3280
+ }
3281
+ shift() {
3282
+ if (this.length === 0) return;
3283
+ return this.delete(this.head);
3284
+ }
3285
+ pop() {
3286
+ if (this.length === 0) return;
3287
+ return this.delete(this.head.prev);
3288
+ }
3289
+ import(list, before) {
3290
+ if (list.length === 0) return this;
3291
+ if (this.length === 0) {
3292
+ this.head = list.head;
3293
+ this.length += list.length;
3294
+ list.clear();
3295
+ return this;
3296
+ }
3297
+ const head = list.head;
3298
+ const last = list.last;
3299
+ const next = last.next = before ?? this.head;
3300
+ const prev = head.prev = next.prev;
3301
+ next.prev = last;
3302
+ prev.next = head;
3303
+ this.length += list.length;
3304
+ list.clear();
3305
+ return this;
3306
+ }
3307
+ clear() {
3308
+ this.length = 0;
3309
+ this.head = undefined;
3310
+ }
3311
+ *[Symbol.iterator]() {
3312
+ for (let node = this.head; node && this.head;) {
3313
+ const next = node.next;
3314
+ yield node;
3315
+ node = next;
3316
+ if (node === this.head) break;
3317
+ }
3318
+ }
3319
+ flatMap(f) {
3320
+ const acc = new List();
3321
+ for (let node = this.head; node && this.head;) {
3322
+ const next = node.next;
3323
+ acc.import(f(node));
3324
+ node = next;
3325
+ if (node === this.head) break;
3326
+ }
3327
+ return acc;
3328
+ }
3329
+ foldl(f, acc) {
3330
+ for (let node = this.head; node && this.head;) {
3331
+ const next = node.next;
3332
+ acc = f(acc, node);
3333
+ node = next;
3334
+ if (node === this.head) break;
3335
+ }
3336
+ return acc;
3337
+ }
3338
+ foldr(f, acc) {
3339
+ for (let node = this.head?.prev; node && this.head;) {
3340
+ const prev = node.prev;
3341
+ acc = f(node, acc);
3342
+ if (node === this.head) break;
3343
+ node = prev;
3344
+ }
3345
+ return acc;
3346
+ }
3347
+ find(f) {
3348
+ for (let node = this.head; node && this.head;) {
3349
+ const next = node.next;
3350
+ if (f(node)) return node;
3351
+ node = next;
3352
+ if (node === this.head) break;
3353
+ }
3354
+ }
3355
+ }
3356
+ exports.List = List;
3357
+ (function (List) {
3358
+ class Node {
3359
+ constructor() {
3360
+ this.next = undefined;
3361
+ this.prev = undefined;
3362
+ }
3363
+ }
3364
+ List.Node = Node;
3365
+ })(List || (exports.List = List = {}));
3366
+
3367
+ /***/ },
3368
+
3369
+ /***/ 605
3370
+ (__unused_webpack_module, exports, __webpack_require__) {
3371
+
3372
+ "use strict";
3373
+
3374
+
3375
+ Object.defineProperty(exports, "__esModule", ({
3376
+ value: true
3377
+ }));
3378
+ exports.failsafe = exports.clean = exports.subinput = exports.input = exports.Data = exports.List = void 0;
3379
+ const data_1 = __webpack_require__(3602);
3380
+ Object.defineProperty(exports, "List", ({
3381
+ enumerable: true,
3382
+ get: function () {
3383
+ return data_1.List;
3384
+ }
3385
+ }));
3386
+ class Data {
3387
+ constructor(value) {
3388
+ this.value = value;
3389
+ this.next = undefined;
3390
+ this.prev = undefined;
3391
+ }
3392
+ }
3393
+ exports.Data = Data;
3174
3394
  function input(source, context) {
3175
3395
  // @ts-expect-error
3176
3396
  context.source = source;
@@ -3207,25 +3427,10 @@ function clean(context) {
3207
3427
  return context;
3208
3428
  }
3209
3429
  exports.clean = clean;
3210
- function eval_(result, default_) {
3211
- return result ? result[0] : default_;
3212
- }
3213
- exports.eval = eval_;
3214
3430
  function failsafe(parser) {
3215
3431
  return input => {
3216
- const {
3217
- context
3218
- } = input;
3219
- const {
3220
- source,
3221
- position
3222
- } = context;
3223
- const result = parser(input);
3224
- if (result === undefined) {
3225
- context.source = source;
3226
- context.position = position;
3227
- }
3228
- return result;
3432
+ const position = input.context.position;
3433
+ return parser(input) ?? (input.context.position = position, undefined);
3229
3434
  };
3230
3435
  }
3231
3436
  exports.failsafe = failsafe;
@@ -3243,6 +3448,7 @@ Object.defineProperty(exports, "__esModule", ({
3243
3448
  }));
3244
3449
  exports.matcher = exports.constraint = exports.state = exports.precedence = exports.recursion = exports.consume = exports.creation = exports.context = exports.reset = void 0;
3245
3450
  const alias_1 = __webpack_require__(5413);
3451
+ const parser_1 = __webpack_require__(605);
3246
3452
  const assign_1 = __webpack_require__(9888);
3247
3453
  function reset(base, parser) {
3248
3454
  const changes = Object.entries(base);
@@ -3415,7 +3621,7 @@ function matcher(pattern, advance) {
3415
3621
  if (advance) {
3416
3622
  context.position += pattern.length;
3417
3623
  }
3418
- return [[pattern]];
3624
+ return new parser_1.List([new parser_1.Data(pattern)]);
3419
3625
  };
3420
3626
  case 'object':
3421
3627
  return ({
@@ -3432,7 +3638,7 @@ function matcher(pattern, advance) {
3432
3638
  if (advance) {
3433
3639
  context.position += src.length;
3434
3640
  }
3435
- return [[src]];
3641
+ return new parser_1.List([new parser_1.Data(src)]);
3436
3642
  };
3437
3643
  }
3438
3644
  }
@@ -3597,7 +3803,7 @@ exports.Delimiters = Delimiters;
3597
3803
  /***/ },
3598
3804
 
3599
3805
  /***/ 2861
3600
- (__unused_webpack_module, exports, __webpack_require__) {
3806
+ (__unused_webpack_module, exports) {
3601
3807
 
3602
3808
  "use strict";
3603
3809
 
@@ -3606,8 +3812,6 @@ Object.defineProperty(exports, "__esModule", ({
3606
3812
  value: true
3607
3813
  }));
3608
3814
  exports.inits = void 0;
3609
- const parser_1 = __webpack_require__(605);
3610
- const array_1 = __webpack_require__(6876);
3611
3815
  function inits(parsers, resume) {
3612
3816
  if (parsers.length === 1) return parsers[0];
3613
3817
  return input => {
@@ -3624,10 +3828,10 @@ function inits(parsers, resume) {
3624
3828
  if (context.delimiters?.match(input)) break;
3625
3829
  const result = parsers[i](input);
3626
3830
  if (result === undefined) break;
3627
- nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3628
- if (resume?.((0, parser_1.eval)(result)) === false) break;
3831
+ nodes = nodes?.import(result) ?? result;
3832
+ if (resume?.(result) === false) break;
3629
3833
  }
3630
- return nodes && context.position > position ? [nodes] : undefined;
3834
+ return context.position > position ? nodes : undefined;
3631
3835
  };
3632
3836
  }
3633
3837
  exports.inits = inits;
@@ -3635,7 +3839,7 @@ exports.inits = inits;
3635
3839
  /***/ },
3636
3840
 
3637
3841
  /***/ 3989
3638
- (__unused_webpack_module, exports, __webpack_require__) {
3842
+ (__unused_webpack_module, exports) {
3639
3843
 
3640
3844
  "use strict";
3641
3845
 
@@ -3644,8 +3848,6 @@ Object.defineProperty(exports, "__esModule", ({
3644
3848
  value: true
3645
3849
  }));
3646
3850
  exports.sequence = void 0;
3647
- const parser_1 = __webpack_require__(605);
3648
- const array_1 = __webpack_require__(6876);
3649
3851
  function sequence(parsers, resume) {
3650
3852
  if (parsers.length === 1) return parsers[0];
3651
3853
  return input => {
@@ -3662,10 +3864,10 @@ function sequence(parsers, resume) {
3662
3864
  if (context.delimiters?.match(input)) return;
3663
3865
  const result = parsers[i](input);
3664
3866
  if (result === undefined) return;
3665
- nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3666
- if (resume?.((0, parser_1.eval)(result)) === false) return;
3867
+ nodes = nodes?.import(result) ?? result;
3868
+ if (resume?.(result) === false) return;
3667
3869
  }
3668
- return nodes && context.position > position ? [nodes] : undefined;
3870
+ return context.position > position ? nodes : undefined;
3669
3871
  };
3670
3872
  }
3671
3873
  exports.sequence = sequence;
@@ -3682,7 +3884,6 @@ Object.defineProperty(exports, "__esModule", ({
3682
3884
  value: true
3683
3885
  }));
3684
3886
  exports.some = void 0;
3685
- const parser_1 = __webpack_require__(605);
3686
3887
  const delimiter_1 = __webpack_require__(5691);
3687
3888
  function some(parser, end, delimiters = [], limit = -1) {
3688
3889
  if (typeof end === 'number') return some(parser, undefined, delimiters, end);
@@ -3706,19 +3907,19 @@ function some(parser, end, delimiters = [], limit = -1) {
3706
3907
  context.delimiters ??= new delimiter_1.Delimiters();
3707
3908
  context.delimiters.push(delims);
3708
3909
  }
3709
- while (true) {
3710
- if (context.position === source.length) break;
3910
+ // whileは数倍遅い
3911
+ for (; context.position < source.length;) {
3711
3912
  if (match(input)) break;
3712
3913
  if (context.delimiters?.match(input)) break;
3713
3914
  const result = parser(input);
3714
3915
  if (result === undefined) break;
3715
- nodes = nodes ? (nodes.push(...(0, parser_1.eval)(result)), nodes) : (0, parser_1.eval)(result);
3916
+ nodes = nodes?.import(result) ?? result;
3716
3917
  if (limit >= 0 && context.position - position > limit) break;
3717
3918
  }
3718
3919
  if (delims.length > 0) {
3719
3920
  context.delimiters.pop(delims.length);
3720
3921
  }
3721
- return nodes && context.position > position ? [nodes] : undefined;
3922
+ return context.position > position ? nodes : undefined;
3722
3923
  };
3723
3924
  }
3724
3925
  exports.some = some;
@@ -3921,11 +4122,8 @@ function bind(target, settings) {
3921
4122
  if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
3922
4123
  const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
3923
4124
  source = (0, normalize_1.normalize)(source);
3924
- // Change the object identity.
3925
- context = {
3926
- ...context,
3927
- url: url ? new url_1.ReadonlyURL(url) : undefined
3928
- };
4125
+ // @ts-expect-error
4126
+ context.url = url ? new url_1.ReadonlyURL(url) : undefined;
3929
4127
  const rev = revision = Symbol();
3930
4128
  const sourceSegments = [];
3931
4129
  for (const seg of (0, segment_1.segment)(source)) {
@@ -3951,16 +4149,18 @@ function bind(target, settings) {
3951
4149
  let index = head;
3952
4150
  for (; index < sourceSegments.length - last; ++index) {
3953
4151
  const seg = sourceSegments[index];
3954
- const es = (0, parser_1.eval)((0, header_1.header)((0, parser_1.input)(seg, {
4152
+ const es = ((0, header_1.header)((0, parser_1.input)(seg, {
3955
4153
  header: index === 0
3956
- })) || (0, block_1.block)((0, parser_1.input)(seg, context)), []);
4154
+ })) || (0, block_1.block)((0, parser_1.input)(seg, context)))?.foldl((acc, {
4155
+ value
4156
+ }) => void acc.push(value) || acc, []) ?? [];
3957
4157
  blocks.splice(index, 0, [seg, es, url]);
3958
4158
  if (es.length === 0) continue;
3959
4159
  // All deletion processes always run after all addition processes have done.
3960
4160
  // Therefore any `base` node will never be unavailable by deletions until all the dependent `el` nodes are added.
3961
4161
  (0, array_1.push)(adds, es.map(el => [el, base]));
3962
4162
  adds.reverse();
3963
- while (adds.length > 0) {
4163
+ for (; adds.length > 0;) {
3964
4164
  const [el, base] = adds.pop();
3965
4165
  target.insertBefore(el, base);
3966
4166
  yield {
@@ -3978,7 +4178,7 @@ function bind(target, settings) {
3978
4178
  (0, array_1.push)(dels, es.map(el => [el]));
3979
4179
  }
3980
4180
  adds.reverse();
3981
- while (adds.length > 0) {
4181
+ for (; adds.length > 0;) {
3982
4182
  const [el, base] = adds.pop();
3983
4183
  target.insertBefore(el, base);
3984
4184
  yield {
@@ -3990,7 +4190,7 @@ function bind(target, settings) {
3990
4190
  };
3991
4191
  }
3992
4192
  dels.reverse();
3993
- while (dels.length > 0) {
4193
+ for (; dels.length > 0;) {
3994
4194
  const [el] = dels.pop();
3995
4195
  el.parentNode?.removeChild(el);
3996
4196
  yield {
@@ -4134,7 +4334,7 @@ exports.headers = headers;
4134
4334
  function parse(source) {
4135
4335
  const i = (0, parser_1.input)(source, {});
4136
4336
  const result = (0, header_1.header)(i);
4137
- const [el] = (0, parser_1.eval)(result, []);
4337
+ const el = result?.head?.value;
4138
4338
  return el?.tagName === 'ASIDE' ? [el, i.context.position] : [];
4139
4339
  }
4140
4340
 
@@ -4167,7 +4367,7 @@ function sanitize(source) {
4167
4367
  // https://en.wikipedia.org/wiki/Whitespace_character
4168
4368
  exports.invisibleHTMLEntityNames = ['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'shy', 'ensp', 'emsp', 'emsp13', 'emsp14', 'numsp', 'puncsp', 'ThinSpace', 'thinsp', 'VeryThinSpace', 'hairsp', 'ZeroWidthSpace', 'NegativeVeryThinSpace', 'NegativeThinSpace', 'NegativeMediumSpace', 'NegativeThickSpace', 'zwj', 'zwnj', 'lrm', 'rlm', 'MediumSpace', 'NoBreak', 'ApplyFunction', 'af', 'InvisibleTimes', 'it', 'InvisibleComma', 'ic'];
4169
4369
  const unreadableHTMLEntityNames = exports.invisibleHTMLEntityNames.slice(2);
4170
- const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, {})))[0]);
4370
+ const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, {})).head.value);
4171
4371
  const unreadableEscapableCharacter = new RegExp(`[${unreadableEscapableCharacters.join('')}]`, 'g');
4172
4372
  // https://www.pandanoir.info/entry/2018/03/11/193000
4173
4373
  // http://anti.rosx.net/etc/memo/002_space.html
@@ -4244,9 +4444,11 @@ function parse(source, opts = {}, context) {
4244
4444
  const node = (0, dom_1.frag)();
4245
4445
  let index = 0;
4246
4446
  for (const seg of (0, segment_1.segment)(source)) {
4247
- node.append(...(0, parser_1.eval)((0, header_1.header)((0, parser_1.input)(seg, {
4447
+ node.append(...(((0, header_1.header)((0, parser_1.input)(seg, {
4248
4448
  header: index++ === 0
4249
- })) || (0, block_1.block)((0, parser_1.input)(seg, context)), []));
4449
+ })) || (0, block_1.block)((0, parser_1.input)(seg, context)))?.foldl((acc, {
4450
+ value
4451
+ }) => void acc.push(value) || acc, []) ?? []));
4250
4452
  }
4251
4453
  if (opts.test) return node;
4252
4454
  for (const _ of (0, figure_1.figure)(node, opts.notes, context));
@@ -4284,6 +4486,7 @@ Object.defineProperty(exports, "__esModule", ({
4284
4486
  value: true
4285
4487
  }));
4286
4488
  exports.block = void 0;
4489
+ const parser_1 = __webpack_require__(605);
4287
4490
  const combinator_1 = __webpack_require__(3484);
4288
4491
  const segment_1 = __webpack_require__(3967);
4289
4492
  const source_1 = __webpack_require__(8745);
@@ -4321,6 +4524,9 @@ exports.block = (0, combinator_1.reset)({
4321
4524
  if (position === source.length) return;
4322
4525
  const fst = source[position];
4323
4526
  switch (fst) {
4527
+ case '\n':
4528
+ input.context.position = source.length;
4529
+ return new parser_1.List();
4324
4530
  case '=':
4325
4531
  if (source.startsWith('===', position)) return (0, pagebreak_1.pagebreak)(input);
4326
4532
  break;
@@ -4380,13 +4586,13 @@ function error(parser) {
4380
4586
  position,
4381
4587
  id
4382
4588
  }
4383
- }, reason) => [[(0, dom_1.html)('h1', {
4589
+ }, reason) => new parser_1.List([new parser_1.Data((0, dom_1.html)('h1', {
4384
4590
  id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : undefined,
4385
4591
  class: 'error'
4386
- }, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`), (0, dom_1.html)('pre', {
4592
+ }, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`)), new parser_1.Data((0, dom_1.html)('pre', {
4387
4593
  class: 'error',
4388
4594
  translate: 'no'
4389
- }, source.slice(position).replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined)]]);
4595
+ }, source.slice(position).replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined))]));
4390
4596
  }
4391
4597
 
4392
4598
  /***/ },
@@ -4401,9 +4607,11 @@ Object.defineProperty(exports, "__esModule", ({
4401
4607
  value: true
4402
4608
  }));
4403
4609
  exports.blockquote = exports.segment = void 0;
4610
+ const parser_1 = __webpack_require__(605);
4404
4611
  const combinator_1 = __webpack_require__(3484);
4405
4612
  const autolink_1 = __webpack_require__(1671);
4406
4613
  const source_1 = __webpack_require__(8745);
4614
+ const util_1 = __webpack_require__(4992);
4407
4615
  const parse_1 = __webpack_require__(3662);
4408
4616
  const dom_1 = __webpack_require__(394);
4409
4617
  exports.segment = (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(/!?>+(?=[^\S\n]|\n[^\S\n]*\S)/y, (0, combinator_1.some)(source_1.contentline))]));
@@ -4411,7 +4619,7 @@ exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, co
4411
4619
  const opener = /(?=>>+(?:$|\s))/y;
4412
4620
  const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|\s)/y)), false);
4413
4621
  const unindent = source => source.replace(/(?<=^|\n)>(?:[^\S\n]|(?=>*(?:$|\s)))|\n$/g, '');
4414
- const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => [(0, dom_1.html)('pre', (0, dom_1.defrag)(ns))]), false, true))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
4622
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4415
4623
  const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown, false, true)), (0, combinator_1.creation)(10, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
4416
4624
  context
4417
4625
  }) => {
@@ -4428,8 +4636,8 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
4428
4636
  }
4429
4637
  }, context);
4430
4638
  context.position = source.length;
4431
- return [[(0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])]];
4432
- }, false, true)))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
4639
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references]))]);
4640
+ }, false, true)))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4433
4641
 
4434
4642
  /***/ },
4435
4643
 
@@ -4454,7 +4662,8 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
4454
4662
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
4455
4663
  exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
4456
4664
  // Bug: Type mismatch between outer and inner.
4457
- ([body, overflow, closer, opener, delim, param], context) => {
4665
+ (nodes, context) => {
4666
+ const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
4458
4667
  const params = param.match(/(?:\\.?|\S)+/g)?.reduce((params, value, i) => {
4459
4668
  let name;
4460
4669
  switch (true) {
@@ -4475,21 +4684,19 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
4475
4684
  name in params ? params.invalid = `Duplicate ${name} attribute` : params[name] = value;
4476
4685
  return params;
4477
4686
  }, {}) ?? {};
4478
- if (!closer || overflow || params.invalid) return [(0, dom_1.html)('pre', {
4687
+ if (!closer || overflow || params.invalid) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4479
4688
  class: 'invalid',
4480
4689
  translate: 'no',
4481
4690
  ...(0, util_1.invalid)('codeblock', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : params.invalid)
4482
- }, `${opener}${body}${overflow || closer}`)];
4691
+ }, `${opener}${body}${overflow || closer}`))]);
4483
4692
  const el = (0, dom_1.html)('pre', {
4484
4693
  class: params.lang ? `code language-${params.lang}` : 'text',
4485
4694
  translate: params.lang ? 'no' : undefined,
4486
4695
  'data-lang': params.lang || undefined,
4487
4696
  'data-line': params.line || undefined,
4488
4697
  'data-path': params.path || undefined
4489
- }, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) || undefined : (0, dom_1.defrag)((0, parser_1.eval)((0, autolink_1.autolink)((0, parser_1.input)(body.slice(0, -1), {
4490
- ...context
4491
- })), [])));
4492
- return [el];
4698
+ }, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) || undefined : (0, dom_1.defrag)((0, util_1.unwrap)((0, autolink_1.autolink)((0, parser_1.subinput)(body.slice(0, -1), context)))));
4699
+ return new parser_1.List([new parser_1.Data(el)]);
4493
4700
  }));
4494
4701
 
4495
4702
  /***/ },
@@ -4504,19 +4711,20 @@ Object.defineProperty(exports, "__esModule", ({
4504
4711
  value: true
4505
4712
  }));
4506
4713
  exports.dlist = void 0;
4714
+ const parser_1 = __webpack_require__(605);
4507
4715
  const combinator_1 = __webpack_require__(3484);
4508
4716
  const inline_1 = __webpack_require__(7973);
4509
4717
  const source_1 = __webpack_require__(8745);
4510
4718
  const visibility_1 = __webpack_require__(6364);
4511
- const array_1 = __webpack_require__(6876);
4719
+ const util_1 = __webpack_require__(4992);
4512
4720
  const dom_1 = __webpack_require__(394);
4513
- exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~[^\S\n]+(?=\S)/y, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))])));
4514
- const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~[^\S\n]+(?=\S)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => [(0, dom_1.html)('dt', {
4721
+ exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~[^\S\n]+(?=\S)/y, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dl', (0, util_1.unwrap)(fillTrailingDescription(ns))))]))));
4722
+ const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~[^\S\n]+(?=\S)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dt', {
4515
4723
  'data-index': (0, inline_1.dataindex)(ns)
4516
- }, (0, dom_1.defrag)(ns))])));
4517
- const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/:[^\S\n]+(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:][^\S\n]+\S/y), (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('dd', (0, dom_1.defrag)(ns))]), false);
4518
- function fillTrailingDescription(es) {
4519
- return es.length > 0 && es.at(-1).tagName === 'DT' ? (0, array_1.push)(es, [(0, dom_1.html)('dd')]) : es;
4724
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))));
4725
+ const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/:[^\S\n]+(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:][^\S\n]+\S/y), (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dd', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
4726
+ function fillTrailingDescription(nodes) {
4727
+ return nodes.last?.value.tagName === 'DT' ? nodes.push(new parser_1.Data((0, dom_1.html)('dd'))) && nodes : nodes;
4520
4728
  }
4521
4729
 
4522
4730
  /***/ },
@@ -4555,6 +4763,7 @@ Object.defineProperty(exports, "__esModule", ({
4555
4763
  value: true
4556
4764
  }));
4557
4765
  exports.aside = void 0;
4766
+ const parser_1 = __webpack_require__(605);
4558
4767
  const combinator_1 = __webpack_require__(3484);
4559
4768
  const indexee_1 = __webpack_require__(7610);
4560
4769
  const util_1 = __webpack_require__(4992);
@@ -4562,12 +4771,13 @@ const parse_1 = __webpack_require__(3662);
4562
4771
  const dom_1 = __webpack_require__(394);
4563
4772
  exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})aside(?!\S)([^\n]*)(?:$|\n)/y, 300),
4564
4773
  // Bug: Type mismatch between outer and inner.
4565
- ([body, overflow, closer, opener, delim, param], context) => {
4566
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
4774
+ (nodes, context) => {
4775
+ const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
4776
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4567
4777
  class: 'invalid',
4568
4778
  translate: 'no',
4569
4779
  ...(0, util_1.invalid)('aside', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4570
- }, `${opener}${body}${overflow || closer}`)];
4780
+ }, `${opener}${body}${overflow || closer}`))]);
4571
4781
  const references = (0, dom_1.html)('ol', {
4572
4782
  class: 'references'
4573
4783
  });
@@ -4578,15 +4788,15 @@ exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combina
4578
4788
  }
4579
4789
  }, context);
4580
4790
  const heading = 'H1 H2 H3 H4 H5 H6'.split(' ').includes(document.firstElementChild?.tagName) && document.firstElementChild;
4581
- if (!heading) return [(0, dom_1.html)('pre', {
4791
+ if (!heading) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4582
4792
  class: 'invalid',
4583
4793
  translate: 'no',
4584
4794
  ...(0, util_1.invalid)('aside', 'content', 'Missing the title at the first line')
4585
- }, `${opener}${body}${closer}`)];
4586
- return [(0, dom_1.html)('aside', {
4795
+ }, `${opener}${body}${closer}`))]);
4796
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4587
4797
  id: (0, indexee_1.identity)('index', context.id, heading),
4588
4798
  class: 'aside'
4589
- }, [document, (0, dom_1.html)('h2', 'References'), references])];
4799
+ }, [document, (0, dom_1.html)('h2', 'References'), references]))]);
4590
4800
  })));
4591
4801
 
4592
4802
  /***/ },
@@ -4610,12 +4820,13 @@ const dom_1 = __webpack_require__(394);
4610
4820
  const opener = /(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y;
4611
4821
  exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
4612
4822
  // Bug: Type mismatch between outer and inner.
4613
- ([body, overflow, closer, opener, delim, type = 'markdown', param], context) => {
4614
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
4823
+ (nodes, context) => {
4824
+ const [body, overflow, closer, opener, delim, type = 'markdown', param] = (0, util_1.unwrap)(nodes);
4825
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4615
4826
  class: 'invalid',
4616
4827
  translate: 'no',
4617
4828
  ...(0, util_1.invalid)('example', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4618
- }, `${opener}${body}${overflow || closer}`)];
4829
+ }, `${opener}${body}${overflow || closer}`))]);
4619
4830
  switch (type) {
4620
4831
  case 'markdown':
4621
4832
  {
@@ -4628,28 +4839,26 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
4628
4839
  references
4629
4840
  }
4630
4841
  }, context);
4631
- return [(0, dom_1.html)('aside', {
4842
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4632
4843
  class: 'example',
4633
4844
  'data-type': 'markdown'
4634
4845
  }, [(0, dom_1.html)('pre', {
4635
4846
  translate: 'no'
4636
- }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])])];
4847
+ }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])]))]);
4637
4848
  }
4638
4849
  case 'math':
4639
- return [(0, dom_1.html)('aside', {
4850
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4640
4851
  class: 'example',
4641
4852
  'data-type': 'math'
4642
4853
  }, [(0, dom_1.html)('pre', {
4643
4854
  translate: 'no'
4644
- }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)((0, parser_1.input)(`$$\n${body}$$`, {
4645
- ...context
4646
- })), [])[0]])];
4855
+ }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, mathblock_1.mathblock)((0, parser_1.subinput)(`$$\n${body}$$`, context)).head.value]))]);
4647
4856
  default:
4648
- return [(0, dom_1.html)('pre', {
4857
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4649
4858
  class: 'invalid',
4650
4859
  translate: 'no',
4651
4860
  ...(0, util_1.invalid)('example', 'type', 'Invalid example type')
4652
- }, `${opener}${body}${closer}`)];
4861
+ }, `${opener}${body}${closer}`))]);
4653
4862
  }
4654
4863
  })));
4655
4864
 
@@ -4682,7 +4891,9 @@ exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
4682
4891
  return parser({
4683
4892
  context
4684
4893
  }) ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
4685
- }, (0, combinator_1.union)([figure_1.figure]), false), ([el]) => el.tagName === 'FIGURE')));
4894
+ }, (0, combinator_1.union)([figure_1.figure]), false), ([{
4895
+ value: el
4896
+ }]) => el.tagName === 'FIGURE')));
4686
4897
  const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?=\s).*\n/y)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.lineshortmedia])), (0, combinator_1.some)(source_1.contentline)]);
4687
4898
 
4688
4899
  /***/ },
@@ -4697,17 +4908,20 @@ Object.defineProperty(exports, "__esModule", ({
4697
4908
  value: true
4698
4909
  }));
4699
4910
  exports.figbase = void 0;
4911
+ const parser_1 = __webpack_require__(605);
4700
4912
  const combinator_1 = __webpack_require__(3484);
4701
4913
  const label_1 = __webpack_require__(2178);
4702
4914
  const dom_1 = __webpack_require__(394);
4703
- exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?[^\S\n]*(?!\S|\n[^\S\n]*\S)/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([el]) => {
4915
+ exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?[^\S\n]*(?!\S|\n[^\S\n]*\S)/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([{
4916
+ value: el
4917
+ }]) => {
4704
4918
  const label = el.getAttribute('data-label');
4705
4919
  const group = label.split('-', 1)[0];
4706
- return [(0, dom_1.html)('figure', {
4920
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('figure', {
4707
4921
  'data-label': label,
4708
4922
  'data-group': group,
4709
4923
  hidden: ''
4710
- })];
4924
+ }))]);
4711
4925
  }));
4712
4926
 
4713
4927
  /***/ },
@@ -4742,20 +4956,22 @@ const memoize_1 = __webpack_require__(6925);
4742
4956
  const dom_1 = __webpack_require__(394);
4743
4957
  exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure[^\S\n])?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\n]*(?:$|\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
4744
4958
  // All parsers which can include closing terms.
4745
- (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length, {})));
4746
- exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(?=\s).*\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])]), false), ([label, param, content, ...caption]) => [(0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
4747
- class: 'figindex'
4748
- }), (0, dom_1.html)('span', {
4749
- class: 'figtext'
4750
- }, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])])])), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/y, 300), ([body, overflow, closer, opener, delim], context) => {
4751
- const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.input)(opener.match(/^~+(?:figure[^\S\n]+)?(\[?\$\S+)/)?.[1] ?? '', {
4752
- ...context
4753
- })) && ['label', 'Invalid label'] || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
4754
- return [(0, dom_1.html)('pre', {
4959
+ (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length <= 16 ? fence.length : -1, [])));
4960
+ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(?=\s).*\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])]), false), nodes => {
4961
+ const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
4962
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
4963
+ class: 'figindex'
4964
+ }), (0, dom_1.html)('span', {
4965
+ class: 'figtext'
4966
+ }, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])]))]);
4967
+ })), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
4968
+ const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
4969
+ const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure[^\S\n]+)?(\[?\$\S+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
4970
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4755
4971
  class: 'invalid',
4756
4972
  translate: 'no',
4757
4973
  ...(0, util_1.invalid)('figure', violation[0], violation[1])
4758
- }, `${opener}${body}${overflow || closer}`)];
4974
+ }, `${opener}${body}${overflow || closer}`))]);
4759
4975
  })));
4760
4976
  function attributes(label, param, content, caption) {
4761
4977
  const group = label.split('-', 1)[0];
@@ -4826,30 +5042,29 @@ const array_1 = __webpack_require__(6876);
4826
5042
  const dom_1 = __webpack_require__(394);
4827
5043
  exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)([^\n]*)(?:$|\n)/y, 300),
4828
5044
  // Bug: Type mismatch between outer and inner.
4829
- ([body, overflow, closer, opener, delim, type, param], context) => {
4830
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
5045
+ (nodes, context) => {
5046
+ const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
5047
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4831
5048
  class: 'invalid',
4832
5049
  translate: 'no',
4833
5050
  ...(0, util_1.invalid)('message', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4834
- }, `${opener}${body}${overflow || closer}`)];
5051
+ }, `${opener}${body}${overflow || closer}`))]);
4835
5052
  switch (type) {
4836
5053
  case 'note':
4837
5054
  case 'caution':
4838
5055
  case 'warning':
4839
5056
  break;
4840
5057
  default:
4841
- return [(0, dom_1.html)('pre', {
5058
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4842
5059
  class: 'invalid',
4843
5060
  translate: 'no',
4844
5061
  ...(0, util_1.invalid)('message', 'type', 'Invalid message type')
4845
- }, `${opener}${body}${closer}`)];
5062
+ }, `${opener}${body}${closer}`))]);
4846
5063
  }
4847
- return [(0, dom_1.html)('section', {
5064
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('section', {
4848
5065
  class: `message`,
4849
5066
  'data-type': type
4850
- }, (0, array_1.unshift)([(0, dom_1.html)('h1', title(type))], [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, parser_1.eval)(content((0, parser_1.input)(seg, {
4851
- ...context
4852
- })), [])), [])))];
5067
+ }, [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, util_1.unwrap)(content((0, parser_1.subinput)(seg, context)))), [(0, dom_1.html)('h1', title(type))])))]);
4853
5068
  }));
4854
5069
  function title(type) {
4855
5070
  switch (type) {
@@ -4876,17 +5091,21 @@ Object.defineProperty(exports, "__esModule", ({
4876
5091
  value: true
4877
5092
  }));
4878
5093
  exports.placeholder = exports.segment_ = exports.segment = void 0;
5094
+ const parser_1 = __webpack_require__(605);
4879
5095
  const combinator_1 = __webpack_require__(3484);
4880
5096
  const util_1 = __webpack_require__(4992);
4881
5097
  const dom_1 = __webpack_require__(394);
4882
5098
  const opener = /(~{3,})(?!~)[^\n]*(?:$|\n)/y;
4883
5099
  exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300)));
4884
5100
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
4885
- exports.placeholder = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), ([body, overflow, closer, opener, delim]) => [(0, dom_1.html)('pre', {
4886
- class: 'invalid',
4887
- translate: 'no',
4888
- ...(0, util_1.invalid)('extension', 'fence', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4889
- }, `${opener}${body}${overflow || closer}`)]));
5101
+ exports.placeholder = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), nodes => {
5102
+ const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
5103
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5104
+ class: 'invalid',
5105
+ translate: 'no',
5106
+ ...(0, util_1.invalid)('extension', 'fence', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
5107
+ }, `${opener}${body}${overflow || closer}`))]);
5108
+ }));
4890
5109
 
4891
5110
  /***/ },
4892
5111
 
@@ -4914,35 +5133,38 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
4914
5133
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000, false)), false);
4915
5134
  exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 10000),
4916
5135
  // Bug: Type mismatch between outer and inner.
4917
- ([body, overflow, closer, opener, delim, type, param], context) => {
4918
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
5136
+ (nodes, context) => {
5137
+ const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
5138
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4919
5139
  class: 'invalid',
4920
5140
  translate: 'no',
4921
5141
  ...(0, util_1.invalid)('table', !closer || overflow ? 'fence' : 'argument', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4922
- }, `${opener}${body}${overflow || closer}`)];
5142
+ }, `${opener}${body}${overflow || closer}`))]);
4923
5143
  switch (type) {
4924
5144
  case 'grid':
4925
5145
  case undefined:
4926
- return ((0, parser_1.eval)(parser((0, parser_1.input)(body, {
4927
- ...context
4928
- }))) ?? [(0, dom_1.html)('table')]).map(el => (0, dom_1.define)(el, {
5146
+ return (parser((0, parser_1.subinput)(body, context)) ?? new parser_1.List([new parser_1.Data((0, dom_1.html)('table'))])).foldl((acc, {
5147
+ value
5148
+ }) => acc.push(new parser_1.Data((0, dom_1.define)(value, {
4929
5149
  'data-type': type
4930
- }));
5150
+ }))) && acc, new parser_1.List());
4931
5151
  default:
4932
- return [(0, dom_1.html)('pre', {
5152
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4933
5153
  class: 'invalid',
4934
5154
  translate: 'no',
4935
5155
  ...(0, util_1.invalid)('table', 'argument', 'Invalid table type')
4936
- }, `${opener}${body}${closer}`)];
5156
+ }, `${opener}${body}${closer}`))]);
4937
5157
  }
4938
5158
  }));
4939
- const parser = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([row])), rows => [(0, dom_1.html)('table', format(rows))])));
4940
- const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.union)([align])), (0, combinator_1.some)((0, combinator_1.union)([head, data, (0, combinator_1.some)(dataline, alignment), source_1.emptyline]))]), ns => !(0, alias_1.isArray)(ns[0]) ? (0, array_1.unshift)([[[]]], ns) : ns)));
5159
+ const parser = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([row])), rows => new parser_1.List([new parser_1.Data((0, dom_1.html)('table', format([...(0, util_1.unwrap)(rows)])))]))));
5160
+ const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.union)([align]), (0, combinator_1.some)((0, combinator_1.union)([head, data, (0, combinator_1.some)(dataline, alignment), source_1.emptyline]))]), ns => Array.isArray(ns.head?.value) ? ns : ns.unshift(new parser_1.Data([[]])) && ns)));
4941
5161
  const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/y;
4942
- const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([s]) => s.split('/').map(s => s.split(''))));
5162
+ const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([{
5163
+ value
5164
+ }]) => new parser_1.List([new parser_1.Data(value.split('/').map(s => s.split('')))])));
4943
5165
  const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y;
4944
- const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /\s*$/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => [(0, dom_1.html)('th', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false);
4945
- const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /\s*$/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => [(0, dom_1.html)('td', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false);
5166
+ const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5167
+ const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
4946
5168
  const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/!+\s/y, (0, combinator_1.convert)(source => `:${source}`, data, false)), (0, combinator_1.convert)(source => `: ${source}`, data, false)])));
4947
5169
  function attributes(source) {
4948
5170
  let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
@@ -4975,9 +5197,12 @@ function format(rows) {
4975
5197
  let ranges = {};
4976
5198
  let verticalHighlightExtensions = 0n;
4977
5199
  let verticalHighlightLevels = [];
4978
- ROW: for (let i = 0; i < rows.length; ++i) {
5200
+ let cnt = 0;
5201
+ for (const list of rows) ROW: for (let i = cnt++; i < cnt; ++i) {
4979
5202
  // Copy to make them retryable.
4980
- const [[[...as], [...vs] = []], ...cells] = rows[i];
5203
+ const [{
5204
+ value: [[...as], [...vs] = []]
5205
+ }, ...cells] = list;
4981
5206
  let isBody = target === tfoot ? false : undefined;
4982
5207
  as.length === 0 && as.push('-');
4983
5208
  ALIGN_H: for (let j = 0, update = false; j < as.length || j < aligns.length; ++j) {
@@ -5040,7 +5265,7 @@ function format(rows) {
5040
5265
  for (let j = 0; j < cells.length; ++j) {
5041
5266
  const jn = BigInt(j);
5042
5267
  const isVirtual = !!ranges[i]?.[j];
5043
- const cell = isVirtual ? (0, array_1.splice)(cells, j, 0, undefined) && ranges[i][j] : cells[j];
5268
+ const cell = isVirtual ? (0, array_1.splice)(cells, j, 0, undefined) && ranges[i][j] : cells[j].value;
5044
5269
  const isHeadCell = cell.tagName === 'TH';
5045
5270
  heads |= isHeadCell ? 1n << jn : 0n;
5046
5271
  highlights |= cell.className === 'highlight' ? 1n << jn : 0n;
@@ -5114,7 +5339,7 @@ function format(rows) {
5114
5339
  const lHighlight = ~lHeadCellIndex && horizontalHighlights & 1n << lHeadCellIndex;
5115
5340
  const rHighlight = ~rHeadCellIndex && horizontalHighlights & 1n << rHeadCellIndex;
5116
5341
  for (let i = 0, m = 1n; i < cells.length; ++i, m <<= 1n) {
5117
- const cell = cells[i];
5342
+ const cell = cells[i]?.value;
5118
5343
  if (!cell) continue;
5119
5344
  if (heads & m) continue;
5120
5345
  switch (m) {
@@ -5153,6 +5378,7 @@ Object.defineProperty(exports, "__esModule", ({
5153
5378
  value: true
5154
5379
  }));
5155
5380
  exports.heading = exports.segment = void 0;
5381
+ const parser_1 = __webpack_require__(605);
5156
5382
  const combinator_1 = __webpack_require__(3484);
5157
5383
  const inline_1 = __webpack_require__(7973);
5158
5384
  const source_1 = __webpack_require__(8745);
@@ -5163,15 +5389,18 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, co
5163
5389
  context: {
5164
5390
  source
5165
5391
  }
5166
- }) => [[source]])))));
5392
+ }) => new parser_1.List([new parser_1.Data(source)]))))));
5167
5393
  exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
5168
5394
  // その他の表示制御は各所のCSSで行う。
5169
- (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/##+/y), (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), ([h, ...ns], context) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, {
5170
- 'data-index': (0, inline_1.dataindex)(ns)
5171
- }, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
5172
- class: 'invalid',
5173
- ...(0, util_1.invalid)('heading', 'syntax', 'Heading level must be up to 6')
5174
- }, context.source.slice(context.position - context.range, context.position))]))))));
5395
+ (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/##+/y), (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), (nodes, context) => {
5396
+ const [h, ...ns] = (0, util_1.unwrap)(nodes);
5397
+ return new parser_1.List([h.length <= 6 ? new parser_1.Data((0, dom_1.html)(`h${h.length}`, {
5398
+ 'data-index': (0, inline_1.dataindex)(nodes)
5399
+ }, (0, dom_1.defrag)(ns))) : new parser_1.Data((0, dom_1.html)(`h6`, {
5400
+ class: 'invalid',
5401
+ ...(0, util_1.invalid)('heading', 'syntax', 'Heading level must be up to 6')
5402
+ }, context.source.slice(context.position - context.range, context.position)))]);
5403
+ }))))));
5175
5404
 
5176
5405
  /***/ },
5177
5406
 
@@ -5185,6 +5414,7 @@ Object.defineProperty(exports, "__esModule", ({
5185
5414
  value: true
5186
5415
  }));
5187
5416
  exports.ilistitem = exports.ilist_ = exports.ilist = void 0;
5417
+ const parser_1 = __webpack_require__(605);
5188
5418
  const combinator_1 = __webpack_require__(3484);
5189
5419
  const ulist_1 = __webpack_require__(7595);
5190
5420
  const olist_1 = __webpack_require__(7697);
@@ -5194,22 +5424,22 @@ const visibility_1 = __webpack_require__(6364);
5194
5424
  const util_1 = __webpack_require__(4992);
5195
5425
  const dom_1 = __webpack_require__(394);
5196
5426
  exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/[-+*] /y, exports.ilist_)));
5197
- exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))])])))), es => [(0, dom_1.html)('ul', {
5427
+ exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('li', (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))]))])))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('ul', {
5198
5428
  class: 'invalid',
5199
5429
  ...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
5200
- }, es)])));
5430
+ }, (0, util_1.unwrap)(ns)))]))));
5201
5431
  exports.ilistitem = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(({
5202
5432
  context: {
5203
5433
  source
5204
5434
  }
5205
- }) => [[source]])]), ({
5435
+ }) => new parser_1.List([new parser_1.Data(source)]))]), ({
5206
5436
  context: {
5207
5437
  source
5208
5438
  }
5209
- }) => [['', (0, dom_1.html)('span', {
5439
+ }) => new parser_1.List([new parser_1.Data(''), new parser_1.Data((0, dom_1.html)('span', {
5210
5440
  class: 'invalid',
5211
5441
  ...(0, util_1.invalid)('list', 'syntax', 'Fix the indent or the head of the list item')
5212
- }, source.replace('\n', ''))]]);
5442
+ }, source.replace('\n', '')))]));
5213
5443
 
5214
5444
  /***/ },
5215
5445
 
@@ -5223,6 +5453,7 @@ Object.defineProperty(exports, "__esModule", ({
5223
5453
  value: true
5224
5454
  }));
5225
5455
  exports.mathblock = exports.segment_ = exports.segment = void 0;
5456
+ const parser_1 = __webpack_require__(605);
5226
5457
  const combinator_1 = __webpack_require__(3484);
5227
5458
  const util_1 = __webpack_require__(4992);
5228
5459
  const dom_1 = __webpack_require__(394);
@@ -5231,18 +5462,21 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
5231
5462
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
5232
5463
  exports.mathblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
5233
5464
  // Bug: Type mismatch between outer and inner.
5234
- ([body, overflow, closer, opener, delim, param], {
5465
+ (nodes, {
5235
5466
  caches: {
5236
5467
  math: cache = undefined
5237
5468
  } = {}
5238
- }) => [delim.length === 2 && closer && !overflow && param.trimStart() === '' ? cache?.get(`${delim}\n${body}${delim}`)?.cloneNode(true) || (0, dom_1.html)('div', {
5239
- class: 'math',
5240
- translate: 'no'
5241
- }, `${delim}\n${body}${delim}`) : (0, dom_1.html)('pre', {
5242
- class: 'invalid',
5243
- translate: 'no',
5244
- ...(0, util_1.invalid)('mathblock', delim.length > 2 ? 'syntax' : !closer || overflow ? 'fence' : 'argument', delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
5245
- }, `${opener}${body}${overflow || closer}`)]));
5469
+ }) => {
5470
+ const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
5471
+ return new parser_1.List([delim.length === 2 && closer && !overflow && param.trimStart() === '' ? new parser_1.Data(cache?.get(`${delim}\n${body}${delim}`)?.cloneNode(true) || (0, dom_1.html)('div', {
5472
+ class: 'math',
5473
+ translate: 'no'
5474
+ }, `${delim}\n${body}${delim}`)) : new parser_1.Data((0, dom_1.html)('pre', {
5475
+ class: 'invalid',
5476
+ translate: 'no',
5477
+ ...(0, util_1.invalid)('mathblock', delim.length > 2 ? 'syntax' : !closer || overflow ? 'fence' : 'argument', delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
5478
+ }, `${opener}${body}${overflow || closer}`))]);
5479
+ }));
5246
5480
 
5247
5481
  /***/ },
5248
5482
 
@@ -5256,6 +5490,7 @@ Object.defineProperty(exports, "__esModule", ({
5256
5490
  value: true
5257
5491
  }));
5258
5492
  exports.mediablock = void 0;
5493
+ const parser_1 = __webpack_require__(605);
5259
5494
  const combinator_1 = __webpack_require__(3484);
5260
5495
  const inline_1 = __webpack_require__(7973);
5261
5496
  const util_1 = __webpack_require__(4992);
@@ -5264,10 +5499,10 @@ exports.mediablock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinat
5264
5499
  context: {
5265
5500
  source
5266
5501
  }
5267
- }) => [[(0, dom_1.html)('span', {
5502
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5268
5503
  class: 'invalid',
5269
5504
  ...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
5270
- }, source.replace('\n', ''))]])))]), ns => [(0, dom_1.html)('div', ns)]));
5505
+ }, source.replace('\n', '')))]))))]), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('div', (0, util_1.unwrap)(ns)))])));
5271
5506
 
5272
5507
  /***/ },
5273
5508
 
@@ -5281,6 +5516,7 @@ Object.defineProperty(exports, "__esModule", ({
5281
5516
  value: true
5282
5517
  }));
5283
5518
  exports.olist_ = exports.olist = void 0;
5519
+ const parser_1 = __webpack_require__(605);
5284
5520
  const combinator_1 = __webpack_require__(3484);
5285
5521
  const ulist_1 = __webpack_require__(7595);
5286
5522
  const ilist_1 = __webpack_require__(4223);
@@ -5295,21 +5531,21 @@ const openers = {
5295
5531
  };
5296
5532
  exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/(?:[0-9]+)(?:-[0-9]+)*\. /y.source, /\((?:[0-9]+)\)(?:-[0-9]+)* /y.source].join('|'), 'y'), exports.olist_)));
5297
5533
  exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => idx(ms[1]), [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => idx(ms[1]), []))])));
5298
- const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => [(0, dom_1.html)('li', {
5534
+ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('li', {
5299
5535
  'data-index': (0, inline_1.dataindex)(ns),
5300
- 'data-marker': ns.shift() || undefined
5301
- }, (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))]))]))), es => [format((0, dom_1.html)('ol', es), type, form)]);
5536
+ 'data-marker': ns.shift()?.value || undefined
5537
+ }, (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))])))]))), ns => new parser_1.List([new parser_1.Data(format((0, dom_1.html)('ol', (0, util_1.unwrap)(ns)), type, form))]));
5302
5538
  const heads = {
5303
5539
  '.': (0, combinator_1.focus)(openers['.'], ({
5304
5540
  context: {
5305
5541
  source
5306
5542
  }
5307
- }) => [[source.trimEnd().split('.', 1)[0] + '.']]),
5543
+ }) => new parser_1.List([new parser_1.Data(source.trimEnd().split('.', 1)[0] + '.')])),
5308
5544
  '(': (0, combinator_1.focus)(openers['('], ({
5309
5545
  context: {
5310
5546
  source
5311
5547
  }
5312
- }) => [[source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')]])
5548
+ }) => new parser_1.List([new parser_1.Data(source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)'))]))
5313
5549
  };
5314
5550
  function idx(value) {
5315
5551
  switch (value) {
@@ -5411,9 +5647,10 @@ Object.defineProperty(exports, "__esModule", ({
5411
5647
  value: true
5412
5648
  }));
5413
5649
  exports.pagebreak = void 0;
5650
+ const parser_1 = __webpack_require__(605);
5414
5651
  const combinator_1 = __webpack_require__(3484);
5415
5652
  const dom_1 = __webpack_require__(394);
5416
- exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\n]*(?:$|\n)/y, () => [[(0, dom_1.html)('hr')]])));
5653
+ exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\n]*(?:$|\n)/y, () => new parser_1.List([new parser_1.Data((0, dom_1.html)('hr'))]))));
5417
5654
 
5418
5655
  /***/ },
5419
5656
 
@@ -5427,11 +5664,13 @@ Object.defineProperty(exports, "__esModule", ({
5427
5664
  value: true
5428
5665
  }));
5429
5666
  exports.paragraph = void 0;
5667
+ const parser_1 = __webpack_require__(605);
5430
5668
  const combinator_1 = __webpack_require__(3484);
5431
5669
  const inline_1 = __webpack_require__(7973);
5432
5670
  const visibility_1 = __webpack_require__(6364);
5671
+ const util_1 = __webpack_require__(4992);
5433
5672
  const dom_1 = __webpack_require__(394);
5434
- exports.paragraph = (0, combinator_1.block)((0, combinator_1.fmap)((0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)(ns))]));
5673
+ exports.paragraph = (0, combinator_1.block)((0, combinator_1.fmap)((0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('p', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])));
5435
5674
 
5436
5675
  /***/ },
5437
5676
 
@@ -5445,19 +5684,20 @@ Object.defineProperty(exports, "__esModule", ({
5445
5684
  value: true
5446
5685
  }));
5447
5686
  exports.reply = void 0;
5687
+ const parser_1 = __webpack_require__(605);
5448
5688
  const combinator_1 = __webpack_require__(3484);
5449
5689
  const cite_1 = __webpack_require__(1200);
5450
5690
  const quote_1 = __webpack_require__(4847);
5451
5691
  const inline_1 = __webpack_require__(7973);
5452
5692
  const source_1 = __webpack_require__(8745);
5453
5693
  const visibility_1 = __webpack_require__(6364);
5454
- const array_1 = __webpack_require__(6876);
5694
+ const util_1 = __webpack_require__(4992);
5455
5695
  const dom_1 = __webpack_require__(394);
5456
5696
  const delimiter = new RegExp(`${cite_1.syntax.source}|${quote_1.syntax.source}`, 'y');
5457
5697
  exports.reply = (0, combinator_1.block)((0, combinator_1.validate)(cite_1.syntax, (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([cite_1.cite, quote_1.quote, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, delimiter), (0, visibility_1.visualize)((0, combinator_1.fmap)((0, combinator_1.some)(inline_1.inline), (ns, {
5458
5698
  source,
5459
5699
  position
5460
- }) => source[position - 1] === '\n' ? ns : (0, array_1.push)(ns, [(0, dom_1.html)('br')]))))])), ns => [(0, dom_1.html)('p', (0, visibility_1.trimBlankNodeEnd)((0, dom_1.defrag)(ns)))])));
5700
+ }) => source[position - 1] === '\n' ? ns : ns.push(new parser_1.Data((0, dom_1.html)('br'))) && ns)))])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('p', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns)))))]))));
5461
5701
 
5462
5702
  /***/ },
5463
5703
 
@@ -5471,6 +5711,7 @@ Object.defineProperty(exports, "__esModule", ({
5471
5711
  value: true
5472
5712
  }));
5473
5713
  exports.cite = exports.syntax = void 0;
5714
+ const parser_1 = __webpack_require__(605);
5474
5715
  const combinator_1 = __webpack_require__(3484);
5475
5716
  const anchor_1 = __webpack_require__(8535);
5476
5717
  const source_1 = __webpack_require__(8745);
@@ -5484,28 +5725,32 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
5484
5725
  context: {
5485
5726
  source
5486
5727
  }
5487
- }) => [[(0, dom_1.html)('a', {
5728
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
5488
5729
  class: 'anchor'
5489
- }, source)]]), (0, combinator_1.focus)(/>>https?:\/\/\S+(?=\s*$)/y, ({
5730
+ }, source))])), (0, combinator_1.focus)(/>>https?:\/\/\S+(?=\s*$)/y, ({
5490
5731
  context: {
5491
5732
  source
5492
5733
  }
5493
- }) => [[(0, dom_1.html)('a', {
5734
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
5494
5735
  class: 'anchor',
5495
5736
  href: source.slice(2).trimEnd(),
5496
5737
  target: '_blank'
5497
- }, source)]]), (0, combinator_1.focus)(/>>.+(?=\s*$)/y, ({
5738
+ }, source))])), (0, combinator_1.focus)(/>>.+(?=\s*$)/y, ({
5498
5739
  context: {
5499
5740
  source
5500
5741
  }
5501
- }) => [[source]])])), ([quotes, node]) => [(0, dom_1.html)('span', typeof node === 'object' ? {
5502
- class: 'cite'
5503
- } : {
5504
- class: 'cite invalid',
5505
- ...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
5506
- }, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
5507
- 'data-depth': `${quotes.length + 1}`
5508
- }, node.innerText.slice(1)) : node.slice(1)])), (0, dom_1.html)('br')]));
5742
+ }) => new parser_1.List([new parser_1.Data(source)]))])), nodes => {
5743
+ const quotes = nodes.head.value;
5744
+ const node = nodes.last.value;
5745
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', typeof node === 'object' ? {
5746
+ class: 'cite'
5747
+ } : {
5748
+ class: 'cite invalid',
5749
+ ...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
5750
+ }, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
5751
+ 'data-depth': `${quotes.length + 1}`
5752
+ }, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.Data((0, dom_1.html)('br'))]);
5753
+ }));
5509
5754
 
5510
5755
  /***/ },
5511
5756
 
@@ -5519,10 +5764,12 @@ Object.defineProperty(exports, "__esModule", ({
5519
5764
  value: true
5520
5765
  }));
5521
5766
  exports.quote = exports.syntax = void 0;
5767
+ const parser_1 = __webpack_require__(605);
5522
5768
  const combinator_1 = __webpack_require__(3484);
5523
5769
  const math_1 = __webpack_require__(2962);
5524
5770
  const autolink_1 = __webpack_require__(8072);
5525
5771
  const source_1 = __webpack_require__(8745);
5772
+ const util_1 = __webpack_require__(4992);
5526
5773
  const dom_1 = __webpack_require__(394);
5527
5774
  exports.syntax = />+[^\S\n]/y;
5528
5775
  exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)((0, combinator_1.validate)(exports.syntax, source_1.anyline)), (0, combinator_1.convert)(
@@ -5532,9 +5779,9 @@ source => source.replace(/(?<=^>+[^\S\n])/mg, '\r'), (0, combinator_1.some)((0,
5532
5779
  math_1.math, autolink_1.autolink, source_1.linebreak, source_1.unescsource])), false)), (ns, {
5533
5780
  source,
5534
5781
  position
5535
- }) => [source[position - 1] === '\n' ? ns.pop() : (0, dom_1.html)('br'), (0, dom_1.html)('span', {
5782
+ }) => new parser_1.List([new parser_1.Data(source[position - 1] === '\n' ? ns.pop().value : (0, dom_1.html)('br')), new parser_1.Data((0, dom_1.html)('span', {
5536
5783
  class: 'quote'
5537
- }, (0, dom_1.defrag)(ns))].reverse()), false));
5784
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))].reverse())), false));
5538
5785
 
5539
5786
  /***/ },
5540
5787
 
@@ -5548,18 +5795,21 @@ Object.defineProperty(exports, "__esModule", ({
5548
5795
  value: true
5549
5796
  }));
5550
5797
  exports.sidefence = void 0;
5798
+ const parser_1 = __webpack_require__(605);
5551
5799
  const combinator_1 = __webpack_require__(3484);
5552
5800
  const autolink_1 = __webpack_require__(1671);
5553
5801
  const source_1 = __webpack_require__(8745);
5554
5802
  const util_1 = __webpack_require__(4992);
5555
5803
  const dom_1 = __webpack_require__(394);
5556
- exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/(?=\|+(?:[^\S\n]|\n\|))(?:\|+(?:[^\S\n][^\n]*)?(?:$|\n))+$/y, (0, combinator_1.union)([source])), ([el]) => [(0, dom_1.define)(el, {
5804
+ exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/(?=\|+(?:[^\S\n]|\n\|))(?:\|+(?:[^\S\n][^\n]*)?(?:$|\n))+$/y, (0, combinator_1.union)([source])), ([{
5805
+ value
5806
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5557
5807
  class: 'invalid',
5558
5808
  ...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
5559
- })])));
5809
+ }))]))));
5560
5810
  const opener = /(?=\|\|+(?:$|\s))/y;
5561
5811
  const unindent = source => source.replace(/(?<=^|\n)\|(?:[^\S\n]|(?=\|*(?:$|\s)))|\n$/g, '');
5562
- const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?:[^\S\n][^\n]*)?(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => [(0, dom_1.html)('pre', (0, dom_1.defrag)(ns))]), false, true))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
5812
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?:[^\S\n][^\n]*)?(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5563
5813
 
5564
5814
  /***/ },
5565
5815
 
@@ -5573,6 +5823,7 @@ Object.defineProperty(exports, "__esModule", ({
5573
5823
  value: true
5574
5824
  }));
5575
5825
  exports.table = void 0;
5826
+ const parser_1 = __webpack_require__(605);
5576
5827
  const combinator_1 = __webpack_require__(3484);
5577
5828
  const inline_1 = __webpack_require__(7973);
5578
5829
  const source_1 = __webpack_require__(8745);
@@ -5581,31 +5832,33 @@ const util_1 = __webpack_require__(4992);
5581
5832
  const duff_1 = __webpack_require__(9202);
5582
5833
  const array_1 = __webpack_require__(6876);
5583
5834
  const dom_1 = __webpack_require__(394);
5584
- exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\n]*(?:\n\|[^\n]*){2}/y, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => [(0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift()]), (0, dom_1.html)('tbody', format(rows))])])));
5585
- const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /[|\\]?\s*$/y, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, ({
5835
+ exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\n]*(?:\n\|[^\n]*){2}/y, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => new parser_1.List([new parser_1.Data((0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift().value]), (0, dom_1.html)('tbody', (0, util_1.unwrap)(format(rows)))]))]))));
5836
+ const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /[|\\]?\s*$/y, optional)), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('tr', (0, util_1.unwrap)(ns)))])), (0, combinator_1.rewrite)(source_1.contentline, ({
5586
5837
  context: {
5587
5838
  source
5588
5839
  }
5589
- }) => [[(0, dom_1.html)('tr', {
5840
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('tr', {
5590
5841
  class: 'invalid',
5591
5842
  ...(0, util_1.invalid)('table-row', 'syntax', 'Missing the start symbol of the table row')
5592
- }, [(0, dom_1.html)('td', source.replace('\n', ''))])]]));
5843
+ }, [(0, dom_1.html)('td', source.replace('\n', ''))]))])));
5593
5844
  const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_1.union)([(0, combinator_1.focus)(/:-+:?/y, ({
5594
5845
  context: {
5595
5846
  source
5596
5847
  }
5597
- }) => [[source.at(-1) === ':' ? 'center' : 'start']]), (0, combinator_1.focus)(/-+:?/y, ({
5848
+ }) => new parser_1.List([new parser_1.Data(source.at(-1) === ':' ? 'center' : 'start')])), (0, combinator_1.focus)(/-+:?/y, ({
5598
5849
  context: {
5599
5850
  source
5600
5851
  }
5601
- }) => [[source.at(-1) === ':' ? 'end' : '']])])), ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
5852
+ }) => new parser_1.List([new parser_1.Data(source.at(-1) === ':' ? 'end' : '')]))])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5602
5853
  const cell = (0, combinator_1.surround)(/\|\s*(?=\S)/y, (0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.media, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.shortmedia, /\s*(?=\||$)/y), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /\|/y, [[/[|\\]?\s*$/y, 9]]))]), /[^|]*/y, true);
5603
- const head = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, dom_1.defrag)(ns))]);
5604
- const data = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
5854
+ const head = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('th', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5855
+ const data = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5605
5856
  function format(rows) {
5606
- const aligns = rows[0].className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
5607
- for (let i = 0; i < rows.length; ++i) {
5608
- for (let cols = rows[i].children, len = cols.length, j = 0; j < len; ++j) {
5857
+ const aligns = rows.head.value.className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().value.children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
5858
+ for (const {
5859
+ value: row
5860
+ } of rows) {
5861
+ for (let cols = row.children, len = cols.length, j = 0; j < len; ++j) {
5609
5862
  if (j > 0 && !aligns[j]) {
5610
5863
  aligns[j] = aligns[j - 1];
5611
5864
  }
@@ -5628,26 +5881,34 @@ Object.defineProperty(exports, "__esModule", ({
5628
5881
  value: true
5629
5882
  }));
5630
5883
  exports.fillFirstLine = exports.checkbox = exports.ulist_ = exports.ulist = void 0;
5884
+ const parser_1 = __webpack_require__(605);
5631
5885
  const combinator_1 = __webpack_require__(3484);
5632
5886
  const olist_1 = __webpack_require__(7697);
5633
5887
  const ilist_1 = __webpack_require__(4223);
5634
5888
  const inline_1 = __webpack_require__(7973);
5635
5889
  const visibility_1 = __webpack_require__(6364);
5636
- const array_1 = __webpack_require__(6876);
5890
+ const util_1 = __webpack_require__(4992);
5637
5891
  const dom_1 = __webpack_require__(394);
5638
5892
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/- /y, exports.ulist_)));
5639
- exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => [(0, dom_1.html)('li', {
5893
+ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('li', {
5640
5894
  'data-index': (0, inline_1.dataindex)(ns)
5641
- }, (0, dom_1.defrag)(fillFirstLine(ns)))]))])))), es => [format((0, dom_1.html)('ul', es))])));
5895
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(fillFirstLine(ns)))))])))])))), ns => new parser_1.List([new parser_1.Data(format((0, dom_1.html)('ul', (0, util_1.unwrap)(ns))))]))));
5642
5896
  exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
5643
5897
  context: {
5644
5898
  source
5645
5899
  }
5646
- }) => [[(0, dom_1.html)('span', {
5900
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5647
5901
  class: 'checkbox'
5648
- }, source[1].trimStart() ? '☑' : '☐')]]);
5649
- function fillFirstLine(ns) {
5650
- return ns.length === 1 && typeof ns[0] === 'object' && ['UL', 'OL'].includes(ns[0].tagName) ? (0, array_1.unshift)([(0, dom_1.html)('br')], ns) : ns;
5902
+ }, source[1].trimStart() ? '☑' : '☐'))]));
5903
+ function fillFirstLine(nodes) {
5904
+ const node = nodes.head?.value;
5905
+ if (typeof node !== 'object') return nodes;
5906
+ switch (node.tagName) {
5907
+ case 'UL':
5908
+ case 'OL':
5909
+ nodes.unshift(new parser_1.Data((0, dom_1.html)('br')));
5910
+ }
5911
+ return nodes;
5651
5912
  }
5652
5913
  exports.fillFirstLine = fillFirstLine;
5653
5914
  function format(list) {
@@ -5669,6 +5930,7 @@ Object.defineProperty(exports, "__esModule", ({
5669
5930
  value: true
5670
5931
  }));
5671
5932
  exports.header = void 0;
5933
+ const parser_1 = __webpack_require__(605);
5672
5934
  const combinator_1 = __webpack_require__(3484);
5673
5935
  const segment_1 = __webpack_require__(3967);
5674
5936
  const source_1 = __webpack_require__(8745);
@@ -5686,14 +5948,14 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
5686
5948
  } else {
5687
5949
  context.position = source.length;
5688
5950
  }
5689
- return [[]];
5951
+ return new parser_1.List();
5690
5952
  }, (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
5691
5953
  context
5692
- }) => context.header ?? true, (0, combinator_1.focus)(/(---+)[^\S\v\f\r\n]*\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[A-Za-z][0-9A-Za-z]*)*:[ \t]+\S[^\v\f\r\n]*\r?\n){1,100}\1[^\S\v\f\r\n]*(?:$|\r?\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), es => [(0, dom_1.html)('aside', {
5954
+ }) => context.header ?? true, (0, combinator_1.focus)(/(---+)[^\S\v\f\r\n]*\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[A-Za-z][0-9A-Za-z]*)*:[ \t]+\S[^\v\f\r\n]*\r?\n){1,100}\1[^\S\v\f\r\n]*(?:$|\r?\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
5693
5955
  class: 'header'
5694
5956
  }, [(0, dom_1.html)('details', {
5695
5957
  open: ''
5696
- }, (0, dom_1.defrag)([(0, dom_1.html)('summary', 'Header'), ...es]))])]), false))), ({
5958
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Data((0, dom_1.html)('summary', 'Header'))) && ns)))]))])), false))), ({
5697
5959
  context
5698
5960
  }) => {
5699
5961
  const {
@@ -5701,11 +5963,11 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
5701
5963
  position
5702
5964
  } = context;
5703
5965
  context.position += source.length;
5704
- return [[(0, dom_1.html)('pre', {
5966
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5705
5967
  class: 'invalid',
5706
5968
  translate: 'no',
5707
5969
  ...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
5708
- }, (0, normalize_1.normalize)(source.slice(position)))]];
5970
+ }, (0, normalize_1.normalize)(source.slice(position))))]);
5709
5971
  }]))), (0, combinator_1.clear)((0, source_1.str)(/[^\S\v\f\r\n]*\r?\n/y))])));
5710
5972
  const field = (0, combinator_1.line)(({
5711
5973
  context: {
@@ -5715,7 +5977,7 @@ const field = (0, combinator_1.line)(({
5715
5977
  }) => {
5716
5978
  const name = source.slice(position, source.indexOf(':', position));
5717
5979
  const value = source.slice(position + name.length + 1).trim();
5718
- return [[(0, dom_1.html)('span', {
5980
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5719
5981
  class: 'field',
5720
5982
  'data-name': name.toLowerCase(),
5721
5983
  'data-value': value
@@ -5723,7 +5985,7 @@ const field = (0, combinator_1.line)(({
5723
5985
  class: 'field-name'
5724
5986
  }, name), ': ', (0, dom_1.html)('span', {
5725
5987
  class: 'field-value'
5726
- }, value), '\n'])]];
5988
+ }, value), '\n']))]);
5727
5989
  });
5728
5990
 
5729
5991
  /***/ },
@@ -5881,13 +6143,15 @@ Object.defineProperty(exports, "__esModule", ({
5881
6143
  value: true
5882
6144
  }));
5883
6145
  exports.annotation = void 0;
6146
+ const parser_1 = __webpack_require__(605);
5884
6147
  const combinator_1 = __webpack_require__(3484);
5885
6148
  const inline_1 = __webpack_require__(7973);
5886
6149
  const visibility_1 = __webpack_require__(6364);
6150
+ const util_1 = __webpack_require__(4992);
5887
6151
  const dom_1 = __webpack_require__(394);
5888
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, ([, ns], context) => context.linebreak === 0 ? [[(0, dom_1.html)('sup', {
6152
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
5889
6153
  class: 'annotation'
5890
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])]] : undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */])));
6154
+ }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */])));
5891
6155
 
5892
6156
  /***/ },
5893
6157
 
@@ -5930,18 +6194,21 @@ Object.defineProperty(exports, "__esModule", ({
5930
6194
  value: true
5931
6195
  }));
5932
6196
  exports.account = void 0;
6197
+ const parser_1 = __webpack_require__(605);
5933
6198
  const combinator_1 = __webpack_require__(3484);
5934
6199
  const link_1 = __webpack_require__(3628);
5935
6200
  const source_1 = __webpack_require__(8745);
5936
6201
  const dom_1 = __webpack_require__(394);
5937
6202
  // https://example/@user must be a user page or a redirect page going there.
5938
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z])@/yi, (0, combinator_1.tails)([(0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![0-9a-z@#]|>>|:\S)/yi)]), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
6203
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z])@/yi, (0, combinator_1.tails)([(0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![0-9a-z@#]|>>|:\S)/yi)]), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, link_1.unsafelink, false), ([{
6204
+ value
6205
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5939
6206
  class: 'account'
5940
- })]))), ({
6207
+ }))])))), ({
5941
6208
  context: {
5942
6209
  source
5943
6210
  }
5944
- }) => [[source]]])));
6211
+ }) => new parser_1.List([new parser_1.Data(source)])])));
5945
6212
 
5946
6213
  /***/ },
5947
6214
 
@@ -5955,6 +6222,7 @@ Object.defineProperty(exports, "__esModule", ({
5955
6222
  value: true
5956
6223
  }));
5957
6224
  exports.anchor = void 0;
6225
+ const parser_1 = __webpack_require__(605);
5958
6226
  const combinator_1 = __webpack_require__(3484);
5959
6227
  const link_1 = __webpack_require__(3628);
5960
6228
  const source_1 = __webpack_require__(8745);
@@ -5966,13 +6234,15 @@ const dom_1 = __webpack_require__(394);
5966
6234
  // cid: YYYY-MMDD-HHMM-SSmmm
5967
6235
  // 内部表現はUnixTimeに統一する(時系列順)
5968
6236
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
5969
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*\/)?[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9a-z@#]|>>|:\S)/yi), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline?at=')}` : `?at=${source.slice(2)}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
6237
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*\/)?[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9a-z@#]|>>|:\S)/yi), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline?at=')}` : `?at=${source.slice(2)}`} }`, link_1.unsafelink, false), ([{
6238
+ value
6239
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5970
6240
  class: 'anchor'
5971
- })]))), ({
6241
+ }))])))), ({
5972
6242
  context: {
5973
6243
  source
5974
6244
  }
5975
- }) => [[source]]])));
6245
+ }) => new parser_1.List([new parser_1.Data(source)])])));
5976
6246
 
5977
6247
  /***/ },
5978
6248
 
@@ -5986,28 +6256,33 @@ Object.defineProperty(exports, "__esModule", ({
5986
6256
  value: true
5987
6257
  }));
5988
6258
  exports.channel = void 0;
6259
+ const parser_1 = __webpack_require__(605);
5989
6260
  const combinator_1 = __webpack_require__(3484);
5990
6261
  const link_1 = __webpack_require__(3628);
5991
6262
  const hashtag_1 = __webpack_require__(5764);
5992
6263
  const source_1 = __webpack_require__(8745);
5993
6264
  const dom_1 = __webpack_require__(394);
5994
6265
  // https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
5995
- exports.channel = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.sequence)([(0, combinator_1.open)(/(?<![0-9a-z])@/yi, (0, combinator_1.tails)([(0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![0-9a-z@]|>>|:\S)/yi)]), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.some)((0, combinator_1.open)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), ([source]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(source)), false, [3 | 0 /* Backtrack.autolink */]))]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1, source.indexOf('#')).replace('/', '/@')}` : `/${source.slice(0, source.indexOf('#'))}`} }`, link_1.unsafelink, false), ([el], {
6266
+ exports.channel = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.sequence)([(0, combinator_1.open)(/(?<![0-9a-z])@/yi, (0, combinator_1.tails)([(0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![0-9a-z@]|>>|:\S)/yi)]), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.some)((0, combinator_1.open)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), ([{
6267
+ value
6268
+ }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)), false, [3 | 0 /* Backtrack.autolink */]))]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1, source.indexOf('#')).replace('/', '/@')}` : `/${source.slice(0, source.indexOf('#'))}`} }`, link_1.unsafelink, false), ([{
6269
+ value: el
6270
+ }], {
5996
6271
  source,
5997
6272
  position,
5998
6273
  range = 0
5999
6274
  }) => {
6000
6275
  const src = source.slice(position - range, position);
6001
6276
  const url = `${el.getAttribute('href')}?ch=${src.slice(src.indexOf('#') + 1).replace(/#/g, '+')}`;
6002
- return [(0, dom_1.define)(el, {
6277
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)(el, {
6003
6278
  class: 'channel',
6004
6279
  href: url
6005
- }, src)];
6280
+ }, src))]);
6006
6281
  }))), ({
6007
6282
  context: {
6008
6283
  source
6009
6284
  }
6010
- }) => [[source]]])));
6285
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6011
6286
 
6012
6287
  /***/ },
6013
6288
 
@@ -6021,22 +6296,25 @@ Object.defineProperty(exports, "__esModule", ({
6021
6296
  value: true
6022
6297
  }));
6023
6298
  exports.email = void 0;
6299
+ const parser_1 = __webpack_require__(605);
6024
6300
  const combinator_1 = __webpack_require__(3484);
6025
6301
  const source_1 = __webpack_require__(8745);
6026
6302
  const dom_1 = __webpack_require__(394);
6027
6303
  // https://html.spec.whatwg.org/multipage/input.html
6028
- exports.email = (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z][_.+-]?)(?=[0-9a-z])/yi, (0, combinator_1.verify)((0, source_1.str)(/[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*(?![0-9a-z@#]|>>|:\S)/yi), ([source]) => source.length <= 255), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6304
+ exports.email = (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z][_.+-]?)(?=[0-9a-z])/yi, (0, combinator_1.verify)((0, source_1.str)(/[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*(?![0-9a-z@#]|>>|:\S)/yi), ([{
6305
+ value
6306
+ }]) => value.length <= 255), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6029
6307
  context: {
6030
6308
  source
6031
6309
  }
6032
- }) => [[(0, dom_1.html)('a', {
6310
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6033
6311
  class: 'email',
6034
6312
  href: `mailto:${source}`
6035
- }, source)]])), ({
6313
+ }, source))]))), ({
6036
6314
  context: {
6037
6315
  source
6038
6316
  }
6039
- }) => [[source]]]));
6317
+ }) => new parser_1.List([new parser_1.Data(source)])]));
6040
6318
 
6041
6319
  /***/ },
6042
6320
 
@@ -6050,19 +6328,22 @@ Object.defineProperty(exports, "__esModule", ({
6050
6328
  value: true
6051
6329
  }));
6052
6330
  exports.hashnum = void 0;
6331
+ const parser_1 = __webpack_require__(605);
6053
6332
  const combinator_1 = __webpack_require__(3484);
6054
6333
  const link_1 = __webpack_require__(3628);
6055
6334
  const hashtag_1 = __webpack_require__(5764);
6056
6335
  const source_1 = __webpack_require__(8745);
6057
6336
  const dom_1 = __webpack_require__(394);
6058
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), false, [1 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
6337
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), false, [1 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, link_1.unsafelink, false), ([{
6338
+ value
6339
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6059
6340
  class: 'hashnum',
6060
6341
  href: null
6061
- })]))), ({
6342
+ }))])))), ({
6062
6343
  context: {
6063
6344
  source
6064
6345
  }
6065
- }) => [[source]]])));
6346
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6066
6347
 
6067
6348
  /***/ },
6068
6349
 
@@ -6076,6 +6357,7 @@ Object.defineProperty(exports, "__esModule", ({
6076
6357
  value: true
6077
6358
  }));
6078
6359
  exports.hashtag = exports.emoji = void 0;
6360
+ const parser_1 = __webpack_require__(605);
6079
6361
  const combinator_1 = __webpack_require__(3484);
6080
6362
  const link_1 = __webpack_require__(3628);
6081
6363
  const source_1 = __webpack_require__(8745);
@@ -6083,13 +6365,17 @@ const dom_1 = __webpack_require__(394);
6083
6365
  // https://example/hashtags/a must be a hashtag page or a redirect page going there.
6084
6366
  // https://github.com/tc39/proposal-regexp-unicode-property-escapes#matching-emoji
6085
6367
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
6086
- exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, exports.emoji), 'yu'), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, exports.emoji), 'yu')), ([source]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(source)), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, link_1.unsafelink, false), ([el]) => [(0, dom_1.define)(el, {
6368
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, exports.emoji), 'yu'), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, exports.emoji), 'yu')), ([{
6369
+ value
6370
+ }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, link_1.unsafelink, false), ([{
6371
+ value
6372
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6087
6373
  class: 'hashtag'
6088
- })]))), ({
6374
+ }))])))), ({
6089
6375
  context: {
6090
6376
  source
6091
6377
  }
6092
- }) => [[source]]])));
6378
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6093
6379
 
6094
6380
  /***/ },
6095
6381
 
@@ -6103,6 +6389,7 @@ Object.defineProperty(exports, "__esModule", ({
6103
6389
  value: true
6104
6390
  }));
6105
6391
  exports.lineurl = exports.url = void 0;
6392
+ const parser_1 = __webpack_require__(605);
6106
6393
  const combinator_1 = __webpack_require__(3484);
6107
6394
  const link_1 = __webpack_require__(3628);
6108
6395
  const source_1 = __webpack_require__(8745);
@@ -6110,13 +6397,13 @@ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combina
6110
6397
  context: {
6111
6398
  source
6112
6399
  }
6113
- }) => [[source]]])));
6400
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6114
6401
  exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\n]*(?=$|\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink, false))), ({
6115
6402
  context: {
6116
6403
  source
6117
6404
  }
6118
- }) => [[source]]])])));
6119
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, undefined, () => [[]], [3 | 0 /* Backtrack.autolink */])]));
6405
+ }) => new parser_1.List([new parser_1.Data(source)])])])));
6406
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */])]));
6120
6407
 
6121
6408
  /***/ },
6122
6409
 
@@ -6130,11 +6417,12 @@ Object.defineProperty(exports, "__esModule", ({
6130
6417
  value: true
6131
6418
  }));
6132
6419
  exports.bracket = void 0;
6420
+ const parser_1 = __webpack_require__(605);
6133
6421
  const combinator_1 = __webpack_require__(3484);
6134
6422
  const inline_1 = __webpack_require__(7973);
6135
6423
  const link_1 = __webpack_require__(3628);
6136
6424
  const source_1 = __webpack_require__(8745);
6137
- const array_1 = __webpack_require__(6876);
6425
+ const util_1 = __webpack_require__(4992);
6138
6426
  const dom_1 = __webpack_require__(394);
6139
6427
  const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
6140
6428
  const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
@@ -6162,27 +6450,27 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6162
6450
  return d1(input);
6163
6451
  }
6164
6452
  }]));
6165
- const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], {
6453
+ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = new parser_1.List(), cs], {
6166
6454
  source,
6167
6455
  position,
6168
6456
  range = 0
6169
6457
  }) => {
6170
6458
  const str = source.slice(position - range + 1, position - 1);
6171
- return indexA.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
6459
+ return indexA.test(str) ? new parser_1.List([new parser_1.Data(as.head.value), new parser_1.Data(str), new parser_1.Data(cs.head.value)]) : new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6172
6460
  class: 'paren'
6173
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
6174
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6461
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6462
+ }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6175
6463
  const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], {
6176
6464
  source,
6177
6465
  position,
6178
6466
  range = 0
6179
6467
  }) => {
6180
6468
  const str = source.slice(position - range + 1, position - 1);
6181
- return indexF.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
6469
+ return indexF.test(str) ? new parser_1.List([new parser_1.Data(as.head.value), new parser_1.Data(str), new parser_1.Data(cs.head.value)]) : new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6182
6470
  class: 'paren'
6183
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
6184
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6185
- const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, ([as, bs = [], cs], context) => {
6471
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6472
+ }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6473
+ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, ([as, bs = new parser_1.List(), cs], context) => {
6186
6474
  if (context.state & 8 /* State.link */) {
6187
6475
  const {
6188
6476
  source,
@@ -6205,14 +6493,14 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6205
6493
  context.range = range;
6206
6494
  }
6207
6495
  }
6208
- return [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)];
6209
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6210
- const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6211
- const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6212
- const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6496
+ return as.import(bs).import(cs);
6497
+ }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6498
+ const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6499
+ const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6500
+ const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6213
6501
  const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6214
6502
  // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
6215
- (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6503
+ (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6216
6504
 
6217
6505
  /***/ },
6218
6506
 
@@ -6226,15 +6514,16 @@ Object.defineProperty(exports, "__esModule", ({
6226
6514
  value: true
6227
6515
  }));
6228
6516
  exports.code = void 0;
6517
+ const parser_1 = __webpack_require__(605);
6229
6518
  const combinator_1 = __webpack_require__(3484);
6230
6519
  const util_1 = __webpack_require__(4992);
6231
6520
  const dom_1 = __webpack_require__(394);
6232
- exports.code = (0, combinator_1.open)(/(?=`)/y, (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? [[(0, dom_1.html)('code', {
6521
+ exports.code = (0, combinator_1.open)(/(?=`)/y, (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
6233
6522
  'data-src': whole
6234
- }, format(body))]] : body ? [[(0, dom_1.html)('code', {
6523
+ }, format(body)))]) : body ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
6235
6524
  class: 'invalid',
6236
6525
  ...(0, util_1.invalid)('code', 'syntax', `Missing the closing symbol "${opener}"`)
6237
- }, whole)]] : [[opener]], true), false, [3 | 64 /* Backtrack.bracket */]);
6526
+ }, whole))]) : new parser_1.List([new parser_1.Data(opener)]), true), false, [3 | 64 /* Backtrack.bracket */]);
6238
6527
  function format(text) {
6239
6528
  return text.length > 2 && text[0] === ' ' && text[1] === '`' && text.at(-1) === ' ' ? text.slice(1, -1) : text;
6240
6529
  }
@@ -6251,17 +6540,17 @@ Object.defineProperty(exports, "__esModule", ({
6251
6540
  value: true
6252
6541
  }));
6253
6542
  exports.deletion = void 0;
6543
+ const parser_1 = __webpack_require__(605);
6254
6544
  const combinator_1 = __webpack_require__(3484);
6255
6545
  const inline_1 = __webpack_require__(7973);
6256
6546
  const visibility_1 = __webpack_require__(6364);
6257
6547
  const util_1 = __webpack_require__(4992);
6258
- const array_1 = __webpack_require__(6876);
6259
6548
  const dom_1 = __webpack_require__(394);
6260
6549
  exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('~~', (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), '~~', false, ([, bs], {
6261
6550
  buffer
6262
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
6551
+ }) => buffer.import(bs), ([, bs], {
6263
6552
  buffer
6264
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), nodes => [(0, dom_1.html)('del', (0, dom_1.defrag)(nodes))]))));
6553
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
6265
6554
 
6266
6555
  /***/ },
6267
6556
 
@@ -6275,14 +6564,15 @@ Object.defineProperty(exports, "__esModule", ({
6275
6564
  value: true
6276
6565
  }));
6277
6566
  exports.emphasis = void 0;
6567
+ const parser_1 = __webpack_require__(605);
6278
6568
  const combinator_1 = __webpack_require__(3484);
6279
6569
  const inline_1 = __webpack_require__(7973);
6280
6570
  const strong_1 = __webpack_require__(6591);
6281
6571
  const source_1 = __webpack_require__(8745);
6282
6572
  const visibility_1 = __webpack_require__(6364);
6283
- const array_1 = __webpack_require__(6876);
6573
+ const util_1 = __webpack_require__(4992);
6284
6574
  const dom_1 = __webpack_require__(394);
6285
- exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('*'), false, ([, bs]) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)]));
6575
+ exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('*'), false, ([, bs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
6286
6576
 
6287
6577
  /***/ },
6288
6578
 
@@ -6296,6 +6586,7 @@ Object.defineProperty(exports, "__esModule", ({
6296
6586
  value: true
6297
6587
  }));
6298
6588
  exports.emstrong = void 0;
6589
+ const parser_1 = __webpack_require__(605);
6299
6590
  const combinator_1 = __webpack_require__(3484);
6300
6591
  const inline_1 = __webpack_require__(7973);
6301
6592
  const strong_1 = __webpack_require__(6591);
@@ -6303,7 +6594,6 @@ const emphasis_1 = __webpack_require__(1354);
6303
6594
  const source_1 = __webpack_require__(8745);
6304
6595
  const visibility_1 = __webpack_require__(6364);
6305
6596
  const util_1 = __webpack_require__(4992);
6306
- const array_1 = __webpack_require__(6876);
6307
6597
  const dom_1 = __webpack_require__(394);
6308
6598
  const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])));
6309
6599
  const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])));
@@ -6312,11 +6602,11 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
6312
6602
  // このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
6313
6603
  exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***', (0, combinator_1.precedence)(0, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/\*{1,3}/y), false, ([, bs, cs], context) => {
6314
6604
  const {
6315
- buffer
6605
+ buffer = new parser_1.List()
6316
6606
  } = context;
6317
- switch (cs[0]) {
6607
+ switch (cs.head.value) {
6318
6608
  case '***':
6319
- return [bs];
6609
+ return bs;
6320
6610
  case '**':
6321
6611
  return (0, combinator_1.bind)(subemphasis, ds => {
6322
6612
  const {
@@ -6324,13 +6614,18 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***'
6324
6614
  } = context;
6325
6615
  if (source.startsWith('*', context.position)) {
6326
6616
  context.position += 1;
6327
- return [[(0, dom_1.html)('em', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds))), "\u001F" /* Command.Separator */]];
6617
+ buffer.push(new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6618
+ buffer.import(ds);
6619
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(buffer)))), new parser_1.Data("\u001F" /* Command.Separator */)]);
6328
6620
  } else {
6329
- return [prepend('*', (0, array_1.push)((0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds)), ["\u001F" /* Command.Separator */]))];
6621
+ buffer.push(new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6622
+ buffer.import(ds);
6623
+ buffer.push(new parser_1.Data("\u001F" /* Command.Separator */));
6624
+ return prepend('*', buffer);
6330
6625
  }
6331
6626
  })({
6332
6627
  context
6333
- }) ?? [prepend('*', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]), ["\u001F" /* Command.Separator */]))];
6628
+ }) ?? prepend('*', buffer.import(new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Data("\u001F" /* Command.Separator */)])));
6334
6629
  case '*':
6335
6630
  return (0, combinator_1.bind)(substrong, ds => {
6336
6631
  const {
@@ -6338,29 +6633,34 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***'
6338
6633
  } = context;
6339
6634
  if (source.startsWith('**', context.position)) {
6340
6635
  context.position += 2;
6341
- return [[(0, dom_1.html)('strong', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds))), "\u001F" /* Command.Separator */]];
6636
+ buffer.push(new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6637
+ buffer.import(ds);
6638
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(buffer)))), new parser_1.Data("\u001F" /* Command.Separator */)]);
6342
6639
  } else {
6343
- return [prepend('**', (0, array_1.push)((0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]), (0, dom_1.defrag)(ds)), ["\u001F" /* Command.Separator */]))];
6640
+ buffer.push(new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6641
+ buffer.import(ds);
6642
+ buffer.push(new parser_1.Data("\u001F" /* Command.Separator */));
6643
+ return prepend('**', buffer);
6344
6644
  }
6345
6645
  })({
6346
6646
  context
6347
- }) ?? [prepend('**', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]), ["\u001F" /* Command.Separator */]))];
6647
+ }) ?? prepend('**', buffer.import(new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))), new parser_1.Data("\u001F" /* Command.Separator */)])));
6348
6648
  }
6349
6649
  }, ([, bs], {
6350
6650
  buffer
6351
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]),
6651
+ }) => bs && buffer.import(bs) && buffer.push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer),
6352
6652
  // 3以上の`*`に対してemの適用を保証する
6353
- nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nodes))])], (nodes, context, prefix, postfix, state) => {
6653
+ nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)))]))]), (nodes, context, prefix, postfix, state) => {
6354
6654
  context.position += postfix;
6355
6655
  if (state) {
6356
6656
  switch (postfix) {
6357
6657
  case 0:
6358
6658
  break;
6359
6659
  case 1:
6360
- nodes = [(0, dom_1.html)('em', (0, dom_1.defrag)(nodes))];
6660
+ nodes = new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6361
6661
  break;
6362
6662
  case 2:
6363
- nodes = [(0, dom_1.html)('strong', (0, dom_1.defrag)(nodes))];
6663
+ nodes = new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6364
6664
  break;
6365
6665
  default:
6366
6666
  }
@@ -6376,13 +6676,13 @@ nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nod
6376
6676
  } = context;
6377
6677
  if (source.startsWith('*', context.position)) {
6378
6678
  context.position += 1;
6379
- return [[(0, dom_1.html)('em', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))]];
6679
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(nodes.import(ds)))))]);
6380
6680
  } else {
6381
- return [prepend('*', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))];
6681
+ return prepend('*', nodes.import(ds));
6382
6682
  }
6383
6683
  })({
6384
6684
  context
6385
- })?.[0] ?? prepend('*', nodes);
6685
+ }) ?? prepend('*', nodes);
6386
6686
  prefix -= 1;
6387
6687
  break;
6388
6688
  case 2:
@@ -6392,27 +6692,27 @@ nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nod
6392
6692
  } = context;
6393
6693
  if (source.startsWith('**', context.position)) {
6394
6694
  context.position += 2;
6395
- return [[(0, dom_1.html)('strong', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))]];
6695
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes.import(ds)))))]);
6396
6696
  } else {
6397
- return [prepend('**', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))];
6697
+ return prepend('**', nodes.import(ds));
6398
6698
  }
6399
6699
  })({
6400
6700
  context
6401
- })?.[0] ?? prepend('**', nodes);
6701
+ }) ?? prepend('**', nodes);
6402
6702
  prefix -= 2;
6403
6703
  break;
6404
6704
  }
6405
6705
  }
6406
6706
  if (prefix > postfix) {
6407
- nodes = (0, array_1.push)(['*'.repeat(prefix - postfix)], nodes);
6707
+ nodes = prepend('*'.repeat(prefix - postfix), nodes);
6408
6708
  }
6409
- return [nodes];
6709
+ return nodes;
6410
6710
  }))));
6411
6711
  function prepend(prefix, nodes) {
6412
- if (typeof nodes[0] === 'string') {
6413
- nodes[0] = prefix + nodes[0];
6712
+ if (typeof nodes.head?.value === 'string') {
6713
+ nodes.head.value = prefix + nodes.head.value;
6414
6714
  } else {
6415
- (0, array_1.unshift)([prefix], nodes);
6715
+ nodes.unshift(new parser_1.Data(prefix));
6416
6716
  }
6417
6717
  return nodes;
6418
6718
  }
@@ -6447,45 +6747,50 @@ Object.defineProperty(exports, "__esModule", ({
6447
6747
  value: true
6448
6748
  }));
6449
6749
  exports.dataindex = exports.signature = exports.index = void 0;
6750
+ const parser_1 = __webpack_require__(605);
6450
6751
  const combinator_1 = __webpack_require__(3484);
6451
6752
  const inline_1 = __webpack_require__(7973);
6452
6753
  const indexee_1 = __webpack_require__(7610);
6453
6754
  const htmlentity_1 = __webpack_require__(470);
6454
6755
  const source_1 = __webpack_require__(8745);
6455
6756
  const visibility_1 = __webpack_require__(6364);
6456
- const array_1 = __webpack_require__(6876);
6757
+ const util_1 = __webpack_require__(4992);
6457
6758
  const dom_1 = __webpack_require__(394);
6458
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? [[(0, dom_1.html)('a', {
6759
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6459
6760
  'data-index': dataindex(bs)
6460
- }, (0, dom_1.defrag)(bs))]] : undefined, undefined, [3 | 64 /* Backtrack.bracket */])), ns => {
6761
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined, [3 | 64 /* Backtrack.bracket */])), ns => {
6461
6762
  if (ns.length === 1) {
6462
- const el = ns[0];
6463
- return [(0, dom_1.define)(el, {
6763
+ const el = ns.head.value;
6764
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)(el, {
6464
6765
  id: el.id ? null : undefined,
6465
6766
  class: 'index',
6466
6767
  href: el.id ? `#${el.id}` : undefined
6467
- })];
6768
+ }))]);
6468
6769
  } else {
6469
6770
  ns.pop();
6470
6771
  return ns;
6471
6772
  }
6472
6773
  })));
6473
6774
  exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}])/y)]), ']'), /(?=])/y, false, ([, ns], context) => {
6474
- const index = (0, indexee_1.identity)('index', undefined, ns.join(''))?.slice(7);
6475
- return index && context.linebreak === 0 ? [[(0, dom_1.html)('span', {
6775
+ const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
6776
+ value
6777
+ }) => acc + value, ''))?.slice(7);
6778
+ return index && context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6476
6779
  class: 'indexer',
6477
6780
  'data-index': index
6478
- })]] : undefined;
6479
- }, ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 64 /* Backtrack.bracket */])));
6480
- function dataindex(ns) {
6481
- if (ns.length === 0) return;
6482
- for (let i = ns.length; i--;) {
6483
- const node = ns[i];
6484
- if (typeof node === 'string') return;
6485
- if (i === ns.length - 1 && ['UL', 'OL'].includes(node.tagName)) continue;
6486
- if (!node.classList.contains('indexer')) return;
6487
- return node.getAttribute('data-index') ?? undefined;
6781
+ }))]) : undefined;
6782
+ }, ([as, bs]) => bs && as.import(bs), [3 | 64 /* Backtrack.bracket */])));
6783
+ function dataindex(nodes) {
6784
+ let node = nodes.last;
6785
+ if (typeof node?.value !== 'object') return;
6786
+ switch (node.value.tagName) {
6787
+ case 'UL':
6788
+ case 'OL':
6789
+ node = node.prev;
6790
+ if (typeof node?.value !== 'object') return;
6488
6791
  }
6792
+ if (!node.value.classList.contains('indexer')) return;
6793
+ return node.value.getAttribute('data-index') ?? undefined;
6489
6794
  }
6490
6795
  exports.dataindex = dataindex;
6491
6796
 
@@ -6501,15 +6806,16 @@ Object.defineProperty(exports, "__esModule", ({
6501
6806
  value: true
6502
6807
  }));
6503
6808
  exports.text = exports.signature = exports.identity = exports.indexee = void 0;
6809
+ const parser_1 = __webpack_require__(605);
6504
6810
  const combinator_1 = __webpack_require__(3484);
6505
6811
  const dom_1 = __webpack_require__(394);
6506
6812
  function indexee(parser) {
6507
6813
  return (0, combinator_1.fmap)(parser, (ns, {
6508
6814
  id
6509
- }) => ns.length === 1 ? [(0, dom_1.define)(ns[0], {
6510
- id: identity('index', id, ns[0]),
6815
+ }) => ns.length === 1 ? new parser_1.List([new parser_1.Data((0, dom_1.define)(ns.head.value, {
6816
+ id: identity('index', id, ns.head.value),
6511
6817
  'data-index': null
6512
- })] : ns);
6818
+ }))]) : ns);
6513
6819
  }
6514
6820
  exports.indexee = indexee;
6515
6821
  const MAX = 60;
@@ -6638,6 +6944,7 @@ Object.defineProperty(exports, "__esModule", ({
6638
6944
  value: true
6639
6945
  }));
6640
6946
  exports.indexer = void 0;
6947
+ const parser_1 = __webpack_require__(605);
6641
6948
  const combinator_1 = __webpack_require__(3484);
6642
6949
  const index_1 = __webpack_require__(4688);
6643
6950
  const dom_1 = __webpack_require__(394);
@@ -6646,10 +6953,10 @@ const dom_1 = __webpack_require__(394);
6646
6953
  // 複合生成インデクスを手動で同期させるより最初から重複のない
6647
6954
  // テキストまたはインデクスを付けて同期が必要な機会を減らすのが
6648
6955
  // 継続的編集において最も簡便となる。
6649
- exports.indexer = (0, combinator_1.surround)(/\s\[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => [[(0, dom_1.html)('span', {
6956
+ exports.indexer = (0, combinator_1.surround)(/\s\[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6650
6957
  class: 'indexer',
6651
6958
  'data-index': ''
6652
- })]])]), /\]\s*$/y);
6959
+ }))]))]), /\]\s*$/y);
6653
6960
 
6654
6961
  /***/ },
6655
6962
 
@@ -6663,15 +6970,18 @@ Object.defineProperty(exports, "__esModule", ({
6663
6970
  value: true
6664
6971
  }));
6665
6972
  exports.isFixed = exports.number = exports.label = exports.segment = void 0;
6973
+ const parser_1 = __webpack_require__(605);
6666
6974
  const combinator_1 = __webpack_require__(3484);
6667
6975
  const source_1 = __webpack_require__(8745);
6668
6976
  const dom_1 = __webpack_require__(394);
6669
6977
  const body = (0, source_1.str)(/\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/y);
6670
6978
  exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
6671
- exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, [1 | 64 /* Backtrack.bracket */, 1]), body]), ([text]) => [(0, dom_1.html)('a', {
6979
+ exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, [1 | 64 /* Backtrack.bracket */, 1]), body]), ([{
6980
+ value
6981
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6672
6982
  class: 'label',
6673
- 'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
6674
- }, text)]));
6983
+ 'data-label': value.slice(value[1] === '-' ? 0 : 1).toLowerCase()
6984
+ }, value))])));
6675
6985
  function number(label, base) {
6676
6986
  return isFixed(label) ? label.slice(label.lastIndexOf('-') + 1) : increment(base, base.split('.').length);
6677
6987
  }
@@ -6702,21 +7012,21 @@ Object.defineProperty(exports, "__esModule", ({
6702
7012
  value: true
6703
7013
  }));
6704
7014
  exports.placeholder = void 0;
7015
+ const parser_1 = __webpack_require__(605);
6705
7016
  const combinator_1 = __webpack_require__(3484);
6706
7017
  const inline_1 = __webpack_require__(7973);
6707
7018
  const source_1 = __webpack_require__(8745);
6708
7019
  const visibility_1 = __webpack_require__(6364);
6709
7020
  const util_1 = __webpack_require__(4992);
6710
- const array_1 = __webpack_require__(6876);
6711
7021
  const dom_1 = __webpack_require__(394);
6712
7022
  // Don't use the symbols already used: !#$%@&*+~=|
6713
7023
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6714
7024
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
6715
7025
  // ^はabbrで使用済みだが^:などのようにして分離使用可能
6716
- (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, (_, context) => [[(0, dom_1.html)('span', {
7026
+ (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6717
7027
  class: 'invalid',
6718
7028
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
6719
- }, context.source.slice(context.position - context.range, context.position))]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 64 /* Backtrack.bracket */]));
7029
+ }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs), [3 | 64 /* Backtrack.bracket */]));
6720
7030
 
6721
7031
  /***/ },
6722
7032
 
@@ -6730,13 +7040,13 @@ Object.defineProperty(exports, "__esModule", ({
6730
7040
  value: true
6731
7041
  }));
6732
7042
  exports.attributes = exports.attribute = exports.html = void 0;
7043
+ const parser_1 = __webpack_require__(605);
6733
7044
  const combinator_1 = __webpack_require__(3484);
6734
7045
  const inline_1 = __webpack_require__(7973);
6735
7046
  const source_1 = __webpack_require__(8745);
6736
7047
  const visibility_1 = __webpack_require__(6364);
6737
7048
  const util_1 = __webpack_require__(4992);
6738
7049
  const memoize_1 = __webpack_require__(6925);
6739
- const array_1 = __webpack_require__(6876);
6740
7050
  const dom_1 = __webpack_require__(394);
6741
7051
  const tags = ['wbr', 'bdo', 'bdi'];
6742
7052
  const attrspecs = {
@@ -6749,14 +7059,14 @@ Object.setPrototypeOf(attrspecs, null);
6749
7059
  Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
6750
7060
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
6751
7061
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6752
- (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]]), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[^\S\n]|>)`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs]) => [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)], ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]),
7062
+ (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[^\S\n]|>)`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
6753
7063
  // 不可視のHTML構造が可視構造を変化させるべきでない。
6754
7064
  // 可視のHTMLは優先度変更を検討する。
6755
7065
  // このため<>は将来的に共通構造を変化させる可能性があり
6756
7066
  // 共通構造を変化させない非構造文字列としては依然としてエスケープを要する。
6757
- (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], context) => [[elem(tag, true, as, bs, cs, context)]], ([as, bs = []], context) => [[elem(tag, true, as, bs, [], context)]]), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
7067
+ (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, cs, context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
6758
7068
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6759
- (0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]])])));
7069
+ (0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))])));
6760
7070
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
6761
7071
  function elem(tag, content, as, bs, cs, context) {
6762
7072
  if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
@@ -6768,7 +7078,7 @@ function elem(tag, content, as, bs, cs, context) {
6768
7078
  const [attrs] = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -1 : as.length));
6769
7079
  if (/(?<!\S)invalid(?!\S)/.test(attrs['class'] ?? '')) return ielem('attribute', 'Invalid HTML attribute', context);
6770
7080
  if (as.at(-1) !== '>') return ielem('tag', `Missing the closing symbol ">"`, context);
6771
- return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
7081
+ return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)((0, util_1.unwrap)(bs)));
6772
7082
  }
6773
7083
  function ielem(type, message, context) {
6774
7084
  return (0, dom_1.html)('span', {
@@ -6781,15 +7091,15 @@ function attributes(syntax, spec, params) {
6781
7091
  const remains = [];
6782
7092
  let invalidation = false;
6783
7093
  const attrs = {};
6784
- for (let i = 0; i < params.length; ++i) {
6785
- const param = params[i].trimStart();
6786
- if (param === '') continue;
6787
- const name = param.split('=', 1)[0];
6788
- const value = param !== name ? param.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
7094
+ for (const param of params) {
7095
+ const attr = param.trimStart();
7096
+ if (attr === '') continue;
7097
+ const name = attr.split('=', 1)[0];
7098
+ const value = attr !== name ? attr.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
6789
7099
  invalidation ||= name === '' || !spec || name in attrs;
6790
7100
  if (name === '') continue;
6791
7101
  if (spec && name in spec && !spec[name]) {
6792
- remains.push(params[i]);
7102
+ remains.push(param);
6793
7103
  continue;
6794
7104
  }
6795
7105
  if (spec?.[name]?.includes(value) || spec?.[name]?.length === 0 && value !== undefined) {
@@ -6822,6 +7132,7 @@ Object.defineProperty(exports, "__esModule", ({
6822
7132
  value: true
6823
7133
  }));
6824
7134
  exports.htmlentity = exports.unsafehtmlentity = void 0;
7135
+ const parser_1 = __webpack_require__(605);
6825
7136
  const combinator_1 = __webpack_require__(3484);
6826
7137
  const util_1 = __webpack_require__(4992);
6827
7138
  const dom_1 = __webpack_require__(394);
@@ -6834,12 +7145,14 @@ exports.unsafehtmlentity = (0, combinator_1.focus)(/&(?:[0-9A-Za-z]+;?)?/y,
6834
7145
  source
6835
7146
  } = context;
6836
7147
  context.position += source.length;
6837
- return source.length > 1 && source.at(-1) === ';' ? [[parser(source) ?? source]] : [[source]];
7148
+ return source.length > 1 && source.at(-1) === ';' ? new parser_1.List([new parser_1.Data(parser(source) ?? source)]) : new parser_1.List([new parser_1.Data(source)]);
6838
7149
  });
6839
- exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([text]) => [length === 1 || text.at(-1) !== ';' ? text : (0, dom_1.html)('span', {
7150
+ exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
7151
+ value
7152
+ }]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Data(value) : new parser_1.Data((0, dom_1.html)('span', {
6840
7153
  class: 'invalid',
6841
7154
  ...(0, util_1.invalid)('htmlentity', 'syntax', 'Invalid HTML entity')
6842
- }, text)]);
7155
+ }, value))]));
6843
7156
  const parser = (el => entity => {
6844
7157
  if (entity === '&NewLine;') return ' ';
6845
7158
  el.innerHTML = entity;
@@ -6859,17 +7172,17 @@ Object.defineProperty(exports, "__esModule", ({
6859
7172
  value: true
6860
7173
  }));
6861
7174
  exports.insertion = void 0;
7175
+ const parser_1 = __webpack_require__(605);
6862
7176
  const combinator_1 = __webpack_require__(3484);
6863
7177
  const inline_1 = __webpack_require__(7973);
6864
7178
  const visibility_1 = __webpack_require__(6364);
6865
7179
  const util_1 = __webpack_require__(4992);
6866
- const array_1 = __webpack_require__(6876);
6867
7180
  const dom_1 = __webpack_require__(394);
6868
7181
  exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('++', (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)]))), '++', false, ([, bs], {
6869
7182
  buffer
6870
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
7183
+ }) => buffer.import(bs), ([, bs], {
6871
7184
  buffer
6872
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), nodes => [(0, dom_1.html)('ins', (0, dom_1.defrag)(nodes))]))));
7185
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
6873
7186
 
6874
7187
  /***/ },
6875
7188
 
@@ -6883,20 +7196,20 @@ Object.defineProperty(exports, "__esModule", ({
6883
7196
  value: true
6884
7197
  }));
6885
7198
  exports.italic = void 0;
7199
+ const parser_1 = __webpack_require__(605);
6886
7200
  const combinator_1 = __webpack_require__(3484);
6887
7201
  const inline_1 = __webpack_require__(7973);
6888
7202
  const visibility_1 = __webpack_require__(6364);
6889
7203
  const util_1 = __webpack_require__(4992);
6890
- const array_1 = __webpack_require__(6876);
6891
7204
  const dom_1 = __webpack_require__(394);
6892
7205
  // 可読性のため実際にはオブリーク体を指定する。
6893
7206
  // 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
6894
7207
  // ある程度の長さのある文に使うのが望ましい。
6895
7208
  exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('///', (0, combinator_1.precedence)(0, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('///')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '/'), inline_1.inline)])))), '///', false, ([, bs], {
6896
7209
  buffer
6897
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
7210
+ }) => buffer.import(bs), ([, bs], {
6898
7211
  buffer
6899
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), nodes => [(0, dom_1.html)('i', (0, dom_1.defrag)(nodes))]))));
7212
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
6900
7213
 
6901
7214
  /***/ },
6902
7215
 
@@ -6910,6 +7223,7 @@ Object.defineProperty(exports, "__esModule", ({
6910
7223
  value: true
6911
7224
  }));
6912
7225
  exports.decode = exports.resolve = exports.option = exports.uri = exports.unsafelink = exports.medialink = exports.textlink = void 0;
7226
+ const parser_1 = __webpack_require__(605);
6913
7227
  const combinator_1 = __webpack_require__(3484);
6914
7228
  const inline_1 = __webpack_require__(7973);
6915
7229
  const html_1 = __webpack_require__(5013);
@@ -6917,22 +7231,25 @@ const source_1 = __webpack_require__(8745);
6917
7231
  const visibility_1 = __webpack_require__(6364);
6918
7232
  const util_1 = __webpack_require__(4992);
6919
7233
  const url_1 = __webpack_require__(1904);
6920
- const array_1 = __webpack_require__(6876);
6921
7234
  const dom_1 = __webpack_require__(394);
6922
7235
  const optspec = {
6923
7236
  rel: ['nofollow']
6924
7237
  };
6925
7238
  Object.setPrototypeOf(optspec, null);
6926
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, ([, ns = []], context) => context.linebreak === 0 ? [(0, array_1.push)(ns, ["\u001F" /* Command.Separator */])] : undefined, undefined, [3 | 64 /* Backtrack.bracket */, 3 | 16 /* Backtrack.link */, 2 | 8 /* Backtrack.ruby */])),
7239
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns : undefined, undefined, [3 | 64 /* Backtrack.bracket */, 3 | 16 /* Backtrack.link */, 2 | 8 /* Backtrack.ruby */])),
6927
7240
  // `{ `と`{`で個別にバックトラックが発生し+1nされる。
6928
7241
  // 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
6929
7242
  (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, undefined, ([as, bs], context) => {
6930
7243
  if (!bs) return;
6931
7244
  const head = context.position - context.range;
6932
7245
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
6933
- return [(0, array_1.push)((0, array_1.unshift)(as, bs), ["\u0018" /* Command.Cancel */])];
6934
- }, [3 | 16 /* Backtrack.link */]))]), ([content, params], context) => {
6935
- if (content.at(-1) === "\u001F" /* Command.Separator */) {
7246
+ return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7247
+ }, [3 | 16 /* Backtrack.link */]))]), ([{
7248
+ value: content
7249
+ }, {
7250
+ value: params = undefined
7251
+ } = {}], context) => {
7252
+ if (content.last.value === "\u001F" /* Command.Separator */) {
6936
7253
  content.pop();
6937
7254
  if (params === undefined) {
6938
7255
  const head = context.position - context.range;
@@ -6940,30 +7257,38 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
6940
7257
  }
6941
7258
  } else {
6942
7259
  params = content;
6943
- content = [];
7260
+ content = new parser_1.List();
6944
7261
  }
6945
- if (params.at(-1) === "\u0018" /* Command.Cancel */) {
7262
+ if (params.last.value === "\u0018" /* Command.Cancel */) {
6946
7263
  params.pop();
6947
- return [[(0, dom_1.html)('span', {
7264
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6948
7265
  class: 'invalid',
6949
7266
  ...(0, util_1.invalid)('link', 'syntax', 'Missing the closing symbol "}"')
6950
- }, context.source.slice(context.position - context.range, context.position))]];
7267
+ }, context.source.slice(context.position - context.range, context.position)))]);
6951
7268
  }
6952
7269
  if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
6953
- return [[parse((0, dom_1.defrag)(content), params, context)]];
7270
+ return new parser_1.List([new parser_1.Data(parse(content, params, context))]);
6954
7271
  }))))));
6955
- exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.validate)(/[[{]/y, (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([params, content = []], context) => [[parse((0, dom_1.defrag)(content), params, context)]]))))));
6956
- exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([params, content = []], context) => [[parse((0, dom_1.defrag)(content), params, context)]])));
7272
+ exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.validate)(/[[{]/y, (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))]), ([{
7273
+ value: content
7274
+ }, {
7275
+ value: params
7276
+ }], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))])))))));
7277
+ exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([{
7278
+ value: params
7279
+ }, {
7280
+ value: content
7281
+ } = new parser_1.Data(new parser_1.List())], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))]))));
6957
7282
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/ /y, (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
6958
- exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => [` rel="nofollow"`]), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
7283
+ exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Data(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
6959
7284
  function parse(content, params, context) {
6960
- const INSECURE_URI = params.shift();
7285
+ const INSECURE_URI = params.shift().value;
6961
7286
  let uri;
6962
7287
  try {
6963
7288
  uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
6964
7289
  } catch {}
6965
7290
  const el = elem(INSECURE_URI, content, uri, context.host?.origin || location.origin);
6966
- return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, params)[0]);
7291
+ return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, (0, util_1.unwrap)(params))[0]);
6967
7292
  }
6968
7293
  function elem(INSECURE_URI, content, uri, origin) {
6969
7294
  let type;
@@ -6976,7 +7301,7 @@ function elem(INSECURE_URI, content, uri, origin) {
6976
7301
  case 'http:':
6977
7302
  case 'https:':
6978
7303
  switch (true) {
6979
- case /[0-9a-z]:\S/i.test((0, util_1.stringify)(content)):
7304
+ case /[0-9a-z]:\S/i.test((0, util_1.stringify)((0, util_1.unwrap)(content))):
6980
7305
  type = 'content';
6981
7306
  message = 'URI must not be contained';
6982
7307
  break;
@@ -6988,19 +7313,19 @@ function elem(INSECURE_URI, content, uri, origin) {
6988
7313
  return (0, dom_1.html)('a', {
6989
7314
  class: content.length === 0 ? 'url' : 'link',
6990
7315
  href: uri.source,
6991
- target: false || uri.origin !== origin || typeof content[0] === 'object' && content[0].classList.contains('media') ? '_blank' : undefined
6992
- }, content.length === 0 ? decode(INSECURE_URI) : content);
7316
+ target: false || uri.origin !== origin || typeof content.head?.value === 'object' && content.head.value.classList.contains('media') ? '_blank' : undefined
7317
+ }, content.length === 0 ? decode(INSECURE_URI) : (0, dom_1.defrag)((0, util_1.unwrap)(content)));
6993
7318
  }
6994
7319
  break;
6995
7320
  case 'tel:':
6996
- const tel = content.length === 0 ? INSECURE_URI : content[0];
7321
+ const tel = content.length === 0 ? INSECURE_URI : (0, util_1.stringify)((0, util_1.unwrap)(content));
6997
7322
  const pattern = /^(?:tel:)?(?:\+(?!0))?\d+(?:-\d+)*$/i;
6998
7323
  switch (true) {
6999
7324
  case content.length <= 1 && pattern.test(INSECURE_URI) && typeof tel === 'string' && pattern.test(tel) && tel.replace(/[^+\d]/g, '') === INSECURE_URI.replace(/[^+\d]/g, ''):
7000
7325
  return (0, dom_1.html)('a', {
7001
7326
  class: 'tel',
7002
7327
  href: uri.source
7003
- }, content.length === 0 ? [INSECURE_URI] : content);
7328
+ }, content.length === 0 ? INSECURE_URI : (0, dom_1.defrag)((0, util_1.unwrap)(content)));
7004
7329
  default:
7005
7330
  type = 'content';
7006
7331
  message = 'Invalid content';
@@ -7013,7 +7338,7 @@ function elem(INSECURE_URI, content, uri, origin) {
7013
7338
  return (0, dom_1.html)('a', {
7014
7339
  class: 'invalid',
7015
7340
  ...(0, util_1.invalid)('link', type, message)
7016
- }, content.length === 0 ? INSECURE_URI : content);
7341
+ }, content.length === 0 ? INSECURE_URI : (0, dom_1.defrag)((0, util_1.unwrap)(content)));
7017
7342
  }
7018
7343
  function resolve(uri, host, source) {
7019
7344
  switch (true) {
@@ -7055,27 +7380,27 @@ Object.defineProperty(exports, "__esModule", ({
7055
7380
  value: true
7056
7381
  }));
7057
7382
  exports.mark = void 0;
7383
+ const parser_1 = __webpack_require__(605);
7058
7384
  const combinator_1 = __webpack_require__(3484);
7059
7385
  const inline_1 = __webpack_require__(7973);
7060
7386
  const indexee_1 = __webpack_require__(7610);
7061
7387
  const visibility_1 = __webpack_require__(6364);
7062
7388
  const util_1 = __webpack_require__(4992);
7063
- const array_1 = __webpack_require__(6876);
7064
7389
  const dom_1 = __webpack_require__(394);
7065
7390
  exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, (0, combinator_1.validate)('==', (0, combinator_1.precedence)(0, (0, combinator_1.state)(2 /* State.mark */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), inline_1.inline)])))), '==', false, ([, bs], {
7066
7391
  buffer
7067
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
7392
+ }) => buffer.import(bs), ([, bs], {
7068
7393
  buffer
7069
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), (nodes, {
7394
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), (nodes, {
7070
7395
  id
7071
7396
  }) => {
7072
- const el = (0, dom_1.html)('mark', (0, dom_1.defrag)(nodes));
7397
+ const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
7073
7398
  (0, dom_1.define)(el, {
7074
7399
  id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
7075
7400
  });
7076
- return el.id ? [el, (0, dom_1.html)('a', {
7401
+ return el.id ? new parser_1.List([new parser_1.Data(el), new parser_1.Data((0, dom_1.html)('a', {
7077
7402
  href: `#${el.id}`
7078
- })] : [el];
7403
+ }))]) : new parser_1.List([new parser_1.Data(el)]);
7079
7404
  }))))));
7080
7405
 
7081
7406
  /***/ },
@@ -7090,6 +7415,7 @@ Object.defineProperty(exports, "__esModule", ({
7090
7415
  value: true
7091
7416
  }));
7092
7417
  exports.math = void 0;
7418
+ const parser_1 = __webpack_require__(605);
7093
7419
  const combinator_1 = __webpack_require__(3484);
7094
7420
  const source_1 = __webpack_require__(8745);
7095
7421
  const util_1 = __webpack_require__(4992);
@@ -7102,7 +7428,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
7102
7428
  math: cache
7103
7429
  } = {}
7104
7430
  }
7105
- }) => [[cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
7431
+ }) => new parser_1.List([new parser_1.Data(cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
7106
7432
  class: 'math',
7107
7433
  translate: 'no',
7108
7434
  'data-src': source
@@ -7110,7 +7436,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
7110
7436
  class: 'invalid',
7111
7437
  translate: 'no',
7112
7438
  ...(0, util_1.invalid)('math', 'content', `"${source.match(forbiddenCommand)[0]}" command is forbidden`)
7113
- }, source)]]));
7439
+ }, source))])));
7114
7440
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\n]/y)]))), (0, source_1.str)('}'), true));
7115
7441
 
7116
7442
  /***/ },
@@ -7133,7 +7459,6 @@ const htmlentity_1 = __webpack_require__(470);
7133
7459
  const source_1 = __webpack_require__(8745);
7134
7460
  const util_1 = __webpack_require__(4992);
7135
7461
  const url_1 = __webpack_require__(1904);
7136
- const array_1 = __webpack_require__(6876);
7137
7462
  const dom_1 = __webpack_require__(394);
7138
7463
  const optspec = {
7139
7464
  'width': [],
@@ -7142,20 +7467,30 @@ const optspec = {
7142
7467
  rel: undefined
7143
7468
  };
7144
7469
  Object.setPrototypeOf(optspec, null);
7145
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, ([, ns = []], context) => context.linebreak === 0 ? [ns] : undefined, undefined, [3 | 4 /* Backtrack.escbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, undefined, ([as, bs], context) => {
7470
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns : undefined, undefined, [3 | 4 /* Backtrack.escbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, undefined, ([as, bs], context) => {
7146
7471
  if (!bs) return;
7147
7472
  const head = context.position - context.range;
7148
7473
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7149
- return [(0, array_1.push)((0, array_1.unshift)(as, bs), ["\u0018" /* Command.Cancel */])];
7150
- }, [3 | 16 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], context) => {
7151
- if (params.at(-1) === "\u0018" /* Command.Cancel */) {
7474
+ return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7475
+ }, [3 | 16 /* Backtrack.link */]))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data(nodes.head.value.foldl((acc, {
7476
+ value
7477
+ }) => acc + value, ''))])), nodes.delete(nodes.last)])), ([{
7478
+ value: [{
7479
+ value: text
7480
+ }]
7481
+ }, {
7482
+ value: params
7483
+ }], context) => {
7484
+ if (text && text.trimStart() === '') return;
7485
+ text = text.trim();
7486
+ if (params.last.value === "\u0018" /* Command.Cancel */) {
7152
7487
  params.pop();
7153
- return [[(0, dom_1.html)('span', {
7488
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7154
7489
  class: 'invalid',
7155
7490
  ...(0, util_1.invalid)('media', 'syntax', 'Missing the closing symbol "}"')
7156
- }, '!' + context.source.slice(context.position - context.range, context.position))]];
7491
+ }, '!' + context.source.slice(context.position - context.range, context.position)))]);
7157
7492
  }
7158
- const INSECURE_URI = params.shift();
7493
+ const INSECURE_URI = params.shift().value;
7159
7494
  // altが空だとエラーが見えないため埋める。
7160
7495
  text ||= (0, link_1.decode)(INSECURE_URI);
7161
7496
  let uri;
@@ -7168,30 +7503,38 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7168
7503
  'data-src': uri?.source
7169
7504
  });
7170
7505
  el.setAttribute('alt', text);
7171
- if (!sanitize(el, uri)) return [[el]];
7172
- const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, params);
7506
+ if (!sanitize(el, uri)) return new parser_1.List([new parser_1.Data(el)]);
7507
+ const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, (0, util_1.unwrap)(params));
7173
7508
  (0, dom_1.define)(el, attrs);
7174
7509
  // Awaiting the generic support for attr().
7175
7510
  if (el.hasAttribute('aspect-ratio')) {
7176
7511
  el.style.aspectRatio = el.getAttribute('aspect-ratio');
7177
7512
  }
7178
- if (context.state & 8 /* State.link */) return [[el]];
7179
- if (cache && cache.tagName !== 'IMG') return [[el]];
7513
+ if (context.state & 8 /* State.link */) return new parser_1.List([new parser_1.Data(el)]);
7514
+ if (cache && cache.tagName !== 'IMG') return new parser_1.List([new parser_1.Data(el)]);
7180
7515
  const {
7181
7516
  source,
7182
7517
  position
7183
7518
  } = context;
7184
- return (0, combinator_1.fmap)(link_1.unsafelink, ([link]) => {
7519
+ return (0, combinator_1.fmap)(link_1.unsafelink, ([{
7520
+ value
7521
+ }]) => {
7185
7522
  context.source = source;
7186
7523
  context.position = position;
7187
- return [(0, dom_1.define)(link, {
7524
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
7188
7525
  class: null,
7189
7526
  target: '_blank'
7190
- }, [el])];
7527
+ }, [el]))]);
7191
7528
  })((0, parser_1.subinput)(`{ ${INSECURE_URI}${linkparams.join('')} }`, context));
7192
7529
  })))));
7193
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */])])));
7194
- const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, ([[a], [b], [c]]) => [b === 'x' ? [`width="${a}"`, `height="${c}"`] : [`aspect-ratio="${a}/${c}"`]]), link_1.option]));
7530
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */])])));
7531
+ const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, ([[{
7532
+ value: a
7533
+ }], [{
7534
+ value: b
7535
+ }], [{
7536
+ value: c
7537
+ }]]) => b === 'x' ? new parser_1.List([new parser_1.Data(`width="${a}"`), new parser_1.Data(`height="${c}"`)]) : new parser_1.List([new parser_1.Data(`aspect-ratio="${a}/${c}"`)])), link_1.option]));
7195
7538
  function sanitize(target, uri) {
7196
7539
  let type;
7197
7540
  let message;
@@ -7241,9 +7584,8 @@ const inline_1 = __webpack_require__(7973);
7241
7584
  const link_1 = __webpack_require__(3628);
7242
7585
  const source_1 = __webpack_require__(8745);
7243
7586
  const visibility_1 = __webpack_require__(6364);
7244
- const dom_1 = __webpack_require__(394);
7245
- const array_1 = __webpack_require__(6876);
7246
7587
  const util_1 = __webpack_require__(4992);
7588
+ const dom_1 = __webpack_require__(394);
7247
7589
  exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, ([, ns], context) => {
7248
7590
  const {
7249
7591
  position,
@@ -7251,7 +7593,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7251
7593
  linebreak = 0
7252
7594
  } = context;
7253
7595
  if (linebreak === 0) {
7254
- return [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])]];
7596
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]);
7255
7597
  } else {
7256
7598
  const head = position - range;
7257
7599
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head, 2);
@@ -7272,13 +7614,13 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7272
7614
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head, 2);
7273
7615
  } else {
7274
7616
  if (state & 128 /* State.annotation */) {
7275
- (0, array_1.push)(bs, [source[position]]);
7617
+ bs.push(new parser_1.Data(source[position]));
7276
7618
  }
7277
7619
  context.position += 1;
7278
7620
  let result;
7279
7621
  if (source[context.position] !== '{') {
7280
7622
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head + 1);
7281
- result = [[]];
7623
+ result = new parser_1.List();
7282
7624
  } else {
7283
7625
  result = !(0, combinator_1.isBacktrack)(context, [1 | 16 /* Backtrack.link */]) ? (0, link_1.textlink)({
7284
7626
  context
@@ -7286,25 +7628,25 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7286
7628
  context.range = range;
7287
7629
  if (!result) {
7288
7630
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head + 1);
7289
- result = [[]];
7631
+ result = new parser_1.List();
7290
7632
  }
7291
7633
  }
7292
7634
  if (context.position === source.length) {
7293
7635
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7294
7636
  } else {
7295
- const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, ([, cs = [], ds]) => [(0, array_1.push)(cs, ds)], ([, cs = []]) => {
7637
+ const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, ([, cs = new parser_1.List(), ds]) => cs.import(ds), ([, cs = new parser_1.List()]) => {
7296
7638
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7297
- return [cs];
7639
+ return cs;
7298
7640
  })({
7299
7641
  context
7300
7642
  });
7301
7643
  if (state & 128 /* State.annotation */ && next) {
7302
- return [(0, array_1.push)((0, array_1.push)((0, array_1.unshift)(as, bs), (0, parser_1.eval)(result)), (0, parser_1.eval)(next))];
7644
+ return as.import(bs).import(result).import(next);
7303
7645
  }
7304
7646
  }
7305
7647
  context.position = position;
7306
7648
  }
7307
- return state & 128 /* State.annotation */ ? [(0, array_1.unshift)(as, bs)] : undefined;
7649
+ return state & 128 /* State.annotation */ ? as.import(bs) : undefined;
7308
7650
  }, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */])));
7309
7651
  // Chicago-Style
7310
7652
  const abbr = (0, combinator_1.surround)((0, source_1.str)('^'), (0, combinator_1.union)([(0, source_1.str)(/(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/y)]), /\|?(?=]])|\|/y, true, ([, ns], context) => {
@@ -7313,23 +7655,23 @@ const abbr = (0, combinator_1.surround)((0, source_1.str)('^'), (0, combinator_1
7313
7655
  position,
7314
7656
  range = 0
7315
7657
  } = context;
7316
- if (!ns) return [['', source.slice(position - range, source[position - 1] === '|' ? position - 1 : position)]];
7658
+ if (!ns) return new parser_1.List([new parser_1.Data(''), new parser_1.Data(source.slice(position - range, source[position - 1] === '|' ? position - 1 : position))]);
7317
7659
  context.position += source[position] === ' ' ? 1 : 0;
7318
- return [["\u001F" /* Command.Separator */, ns[0].trimEnd()]];
7660
+ return new parser_1.List([new parser_1.Data("\u001F" /* Command.Separator */), new parser_1.Data(ns.head.value.trimEnd())]);
7319
7661
  }, (_, context) => {
7320
7662
  context.position -= context.range;
7321
- return [['']];
7663
+ return new parser_1.List([new parser_1.Data('')]);
7322
7664
  });
7323
7665
  function attributes(ns) {
7324
- switch (ns[0]) {
7666
+ switch (ns.head.value) {
7325
7667
  case '':
7326
7668
  return {
7327
7669
  class: 'invalid',
7328
7670
  ...(0, util_1.invalid)('reference', 'syntax', 'Invalid abbreviation')
7329
7671
  };
7330
7672
  case "\u001F" /* Command.Separator */:
7331
- const abbr = ns[1];
7332
- ns[0] = ns[1] = '';
7673
+ const abbr = ns.head.next.value;
7674
+ ns.head.value = ns.head.next.value = '';
7333
7675
  return {
7334
7676
  class: 'reference',
7335
7677
  'data-abbr': abbr
@@ -7353,24 +7695,24 @@ Object.defineProperty(exports, "__esModule", ({
7353
7695
  value: true
7354
7696
  }));
7355
7697
  exports.remark = void 0;
7698
+ const parser_1 = __webpack_require__(605);
7356
7699
  const combinator_1 = __webpack_require__(3484);
7357
7700
  const inline_1 = __webpack_require__(7973);
7358
7701
  const source_1 = __webpack_require__(8745);
7359
7702
  const util_1 = __webpack_require__(4992);
7360
- const array_1 = __webpack_require__(6876);
7361
7703
  const dom_1 = __webpack_require__(394);
7362
- exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /\s%\]/y, [[/\s%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = [], cs]) => [[(0, dom_1.html)('span', {
7704
+ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /\s%\]/y, [[/\s%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7363
7705
  class: 'remark'
7364
7706
  }, [(0, dom_1.html)('input', {
7365
7707
  type: 'checkbox'
7366
- }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)]), (0, combinator_1.focus)(/\[%+(?=\s)/y, ({
7708
+ }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs))))]))]), ([as, bs]) => bs && as.import(bs)), (0, combinator_1.focus)(/\[%+(?=\s)/y, ({
7367
7709
  context: {
7368
7710
  source
7369
7711
  }
7370
- }) => [[(0, dom_1.html)('span', {
7712
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7371
7713
  class: 'invalid',
7372
7714
  ...(0, util_1.invalid)('remark', 'syntax', 'Invalid start symbol')
7373
- }, source)]])));
7715
+ }, source))]))));
7374
7716
 
7375
7717
  /***/ },
7376
7718
 
@@ -7389,23 +7731,39 @@ const combinator_1 = __webpack_require__(3484);
7389
7731
  const htmlentity_1 = __webpack_require__(470);
7390
7732
  const source_1 = __webpack_require__(8745);
7391
7733
  const visibility_1 = __webpack_require__(6364);
7392
- const array_1 = __webpack_require__(6876);
7734
+ const util_1 = __webpack_require__(4992);
7393
7735
  const dom_1 = __webpack_require__(394);
7394
7736
  exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, ([, ns]) => {
7395
- ns && ns.at(-1) === '' && ns.pop();
7396
- return (0, visibility_1.isTightNodeStart)(ns) ? [ns] : undefined;
7397
- }, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */]))]), ([texts, rubies], context) => {
7737
+ ns && ns.last?.value === '' && ns.pop();
7738
+ return (0, visibility_1.isTightNodeStart)(ns) ? ns : undefined;
7739
+ }, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */]))]), ([{
7740
+ value: texts
7741
+ }, {
7742
+ value: rubies = undefined
7743
+ } = {}], context) => {
7398
7744
  if (rubies === undefined) {
7399
7745
  const head = context.position - context.range;
7400
7746
  return void (0, combinator_1.setBacktrack)(context, [2 | 8 /* Backtrack.ruby */], head);
7401
7747
  }
7402
7748
  switch (true) {
7403
- case rubies.length <= texts.length:
7404
- return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))]];
7405
- case texts.length === 1 && [...texts[0]].length >= rubies.length:
7406
- return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)([...texts[0]].reduce((acc, _, i, texts) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))]];
7749
+ case texts.length >= rubies.length:
7750
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)([...zip(texts, rubies)].reduce((acc, [{
7751
+ value: text = ''
7752
+ } = {}, {
7753
+ value: ruby = ''
7754
+ } = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.Data(text), new parser_1.Data((0, dom_1.html)('rp', '(')), new parser_1.Data((0, dom_1.html)('rt', ruby)), new parser_1.Data((0, dom_1.html)('rp', ')'))]) : new parser_1.List([new parser_1.Data(text), new parser_1.Data((0, dom_1.html)('rt'))])), new parser_1.List())))))]);
7755
+ case texts.length === 1 && [...texts.head.value].length >= rubies.length:
7756
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)([...zip(new parser_1.List([...texts.head.value].map(char => new parser_1.Data(char))), rubies)].reduce((acc, [{
7757
+ value: text = ''
7758
+ } = {}, {
7759
+ value: ruby = ''
7760
+ } = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.Data(text), new parser_1.Data((0, dom_1.html)('rp', '(')), new parser_1.Data((0, dom_1.html)('rt', ruby)), new parser_1.Data((0, dom_1.html)('rp', ')'))]) : new parser_1.List([new parser_1.Data(text), new parser_1.Data((0, dom_1.html)('rt'))])), new parser_1.List())))))]);
7407
7761
  default:
7408
- return [[(0, dom_1.html)('ruby', (0, dom_1.defrag)((0, array_1.unshift)([texts.join(' ')], [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies.join(' ').trim()), (0, dom_1.html)('rp', ')')])))]];
7762
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)(new parser_1.List([new parser_1.Data(texts.foldr(({
7763
+ value
7764
+ }, acc) => value + ' ' + acc, '').slice(0, -1)), new parser_1.Data((0, dom_1.html)('rp', '(')), new parser_1.Data((0, dom_1.html)('rt', rubies.foldr(({
7765
+ value
7766
+ }, acc) => value + ' ' + acc, '').trim())), new parser_1.Data((0, dom_1.html)('rp', ')'))])))))]);
7409
7767
  }
7410
7768
  }));
7411
7769
  const text = input => {
@@ -7415,7 +7773,7 @@ const text = input => {
7415
7773
  const {
7416
7774
  source
7417
7775
  } = context;
7418
- const acc = [''];
7776
+ const acc = new parser_1.List([new parser_1.Data('')]);
7419
7777
  let state = false;
7420
7778
  context.sequential = true;
7421
7779
  for (let {
@@ -7426,41 +7784,37 @@ const text = input => {
7426
7784
  case '&':
7427
7785
  {
7428
7786
  const result = (0, htmlentity_1.unsafehtmlentity)(input) ?? (0, source_1.txt)(input);
7429
- acc[acc.length - 1] += (0, parser_1.eval)(result)[0];
7787
+ acc.last.value += result.head.value;
7430
7788
  continue;
7431
7789
  }
7432
7790
  default:
7433
7791
  {
7434
7792
  if (source[position].trimStart() === '') {
7435
- state ||= acc.at(-1).trimStart() !== '';
7436
- acc.push('');
7793
+ state ||= acc.last.value.trimStart() !== '';
7794
+ acc.push(new parser_1.Data(''));
7437
7795
  context.position += 1;
7438
7796
  continue;
7439
7797
  }
7440
7798
  const result = (0, source_1.txt)(input);
7441
- acc[acc.length - 1] += (0, parser_1.eval)(result)[0] ?? source.slice(position, context.position);
7799
+ acc.last.value += result.head?.value ?? '';
7442
7800
  continue;
7443
7801
  }
7444
7802
  }
7445
7803
  }
7446
7804
  context.sequential = false;
7447
- state ||= acc.at(-1).trimStart() !== '';
7448
- return state ? [acc] : undefined;
7805
+ state ||= acc.last.value.trimStart() !== '';
7806
+ return state ? acc : undefined;
7449
7807
  };
7450
- //function attributes(texts: string[], rubies: string[]): Record<string, string> {
7451
- // let attrs: Record<string, string> | undefined;
7452
- // for (const ss of [texts, rubies]) {
7453
- // for (let i = 0; i < ss.length; ++i) {
7454
- // if (!ss[i].includes(Command.Error)) continue;
7455
- // ss[i] = ss[i].replace(CmdRegExp.Error, '');
7456
- // attrs ??= {
7457
- // class: 'invalid',
7458
- // ...invalid('ruby', ss === texts ? 'content' : 'argument', 'Invalid HTML entity'),
7459
- // };
7460
- // }
7461
- // }
7462
- // return attrs ?? {};
7463
- //}
7808
+ function* zip(a, b) {
7809
+ const ia = a[Symbol.iterator]();
7810
+ const ib = b[Symbol.iterator]();
7811
+ for (;;) {
7812
+ const ra = ia.next();
7813
+ const rb = ib.next();
7814
+ if (ra.done) break;
7815
+ yield [ra.value, rb.value];
7816
+ }
7817
+ }
7464
7818
 
7465
7819
  /***/ },
7466
7820
 
@@ -7492,14 +7846,15 @@ Object.defineProperty(exports, "__esModule", ({
7492
7846
  value: true
7493
7847
  }));
7494
7848
  exports.strong = void 0;
7849
+ const parser_1 = __webpack_require__(605);
7495
7850
  const combinator_1 = __webpack_require__(3484);
7496
7851
  const inline_1 = __webpack_require__(7973);
7497
7852
  const emphasis_1 = __webpack_require__(1354);
7498
7853
  const source_1 = __webpack_require__(8745);
7499
7854
  const visibility_1 = __webpack_require__(6364);
7500
- const array_1 = __webpack_require__(6876);
7855
+ const util_1 = __webpack_require__(4992);
7501
7856
  const dom_1 = __webpack_require__(394);
7502
- exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('**'), false, ([, bs]) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)]));
7857
+ exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('**'), false, ([, bs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
7503
7858
 
7504
7859
  /***/ },
7505
7860
 
@@ -7513,18 +7868,18 @@ Object.defineProperty(exports, "__esModule", ({
7513
7868
  value: true
7514
7869
  }));
7515
7870
  exports.template = void 0;
7871
+ const parser_1 = __webpack_require__(605);
7516
7872
  const combinator_1 = __webpack_require__(3484);
7517
7873
  const source_1 = __webpack_require__(8745);
7518
7874
  const util_1 = __webpack_require__(4992);
7519
- const array_1 = __webpack_require__(6876);
7520
7875
  const dom_1 = __webpack_require__(394);
7521
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, ([as, bs = [], cs]) => [[(0, dom_1.html)('span', {
7876
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7522
7877
  class: 'template'
7523
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]], ([, bs], context) => bs && [[(0, dom_1.html)('span', {
7878
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([, bs], context) => bs && new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7524
7879
  class: 'invalid',
7525
7880
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
7526
- }, context.source.slice(context.position - context.range, context.position))]], [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
7527
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], context) => context.linebreak === 0 ? [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)] : (context.position -= 1, [(0, array_1.unshift)(as, bs)]), ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 4 /* Backtrack.escbracket */])]));
7881
+ }, context.source.slice(context.position - context.range, context.position)))]), [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
7882
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, ([as, bs = new parser_1.List(), cs], context) => context.linebreak === 0 ? as.import(bs).import(cs) : (context.position -= 1, as.import(bs)), ([as, bs]) => bs && as.import(bs), [3 | 4 /* Backtrack.escbracket */])]));
7528
7883
 
7529
7884
  /***/ },
7530
7885
 
@@ -7813,7 +8168,7 @@ function* proc(defs, note) {
7813
8168
  I: for (const [key, def] of defs) {
7814
8169
  defs.delete(key);
7815
8170
  ++count;
7816
- while (length > size) {
8171
+ for (; length > size;) {
7817
8172
  const node = children[count - 1];
7818
8173
  if (equal(node, def)) continue I;
7819
8174
  yield note.removeChild(node);
@@ -7824,7 +8179,7 @@ function* proc(defs, note) {
7824
8179
  yield note.insertBefore(def, node);
7825
8180
  ++length;
7826
8181
  }
7827
- while (length > size) {
8182
+ for (; length > size;) {
7828
8183
  yield note.removeChild(children[size]);
7829
8184
  --length;
7830
8185
  }
@@ -7890,12 +8245,14 @@ function* segment(source) {
7890
8245
  const input = {
7891
8246
  context
7892
8247
  };
7893
- while (context.position < source.length) {
8248
+ for (; context.position < source.length;) {
7894
8249
  const {
7895
8250
  position
7896
8251
  } = context;
7897
8252
  const result = parser(input);
7898
- const segs = (0, parser_1.eval)(result).length ? (0, parser_1.eval)(result) : [source.slice(position, context.position)];
8253
+ const segs = result.length > 0 ? result.foldl((acc, {
8254
+ value
8255
+ }) => void acc.push(value) || acc, []) : [source.slice(position, context.position)];
7899
8256
  for (let i = 0; i < segs.length; ++i) {
7900
8257
  const seg = segs[i];
7901
8258
  validate(seg, exports.MAX_SEGMENT_SIZE) ? yield seg : yield `${"\u0007" /* Command.Error */}Too large segment over ${exports.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.\n${seg}`;
@@ -7999,6 +8356,7 @@ Object.defineProperty(exports, "__esModule", ({
7999
8356
  value: true
8000
8357
  }));
8001
8358
  exports.escsource = void 0;
8359
+ const parser_1 = __webpack_require__(605);
8002
8360
  const combinator_1 = __webpack_require__(3484);
8003
8361
  const text_1 = __webpack_require__(5655);
8004
8362
  const dom_1 = __webpack_require__(394);
@@ -8017,32 +8375,32 @@ const escsource = ({
8017
8375
  switch (char) {
8018
8376
  case '\r':
8019
8377
  (0, combinator_1.consume)(-1, context);
8020
- return [[]];
8378
+ return new parser_1.List();
8021
8379
  case "\u001B" /* Command.Escape */:
8022
8380
  (0, combinator_1.consume)(1, context);
8023
8381
  context.position += 1;
8024
- return [[source.slice(position + 1, position + 2)]];
8382
+ return new parser_1.List([new parser_1.Data(source.slice(position + 1, position + 2))]);
8025
8383
  case '\\':
8026
8384
  switch (source[position + 1]) {
8027
8385
  case undefined:
8028
- return [[char]];
8386
+ return new parser_1.List([new parser_1.Data(char)]);
8029
8387
  case '\n':
8030
- return [[char]];
8388
+ return new parser_1.List([new parser_1.Data(char)]);
8031
8389
  default:
8032
8390
  (0, combinator_1.consume)(1, context);
8033
8391
  context.position += 1;
8034
- return [[source.slice(position, position + 2)]];
8392
+ return new parser_1.List([new parser_1.Data(source.slice(position, position + 2))]);
8035
8393
  }
8036
8394
  case '\n':
8037
8395
  context.linebreak ||= source.length - position;
8038
- return [[(0, dom_1.html)('br')]];
8396
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8039
8397
  default:
8040
- if (context.sequential) return [[char]];
8398
+ if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8041
8399
  let i = (0, text_1.next)(source, position, delimiter);
8042
8400
  i -= position;
8043
8401
  (0, combinator_1.consume)(i - 1, context);
8044
8402
  context.position += i - 1;
8045
- return [[source.slice(position, context.position)]];
8403
+ return new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8046
8404
  }
8047
8405
  };
8048
8406
  exports.escsource = escsource;
@@ -8050,7 +8408,7 @@ exports.escsource = escsource;
8050
8408
  /***/ },
8051
8409
 
8052
8410
  /***/ 702
8053
- (__unused_webpack_module, exports) {
8411
+ (__unused_webpack_module, exports, __webpack_require__) {
8054
8412
 
8055
8413
  "use strict";
8056
8414
 
@@ -8059,6 +8417,7 @@ Object.defineProperty(exports, "__esModule", ({
8059
8417
  value: true
8060
8418
  }));
8061
8419
  exports.contentline = exports.emptyline = exports.anyline = void 0;
8420
+ const parser_1 = __webpack_require__(605);
8062
8421
  const anyline = input => {
8063
8422
  const {
8064
8423
  context
@@ -8067,8 +8426,9 @@ const anyline = input => {
8067
8426
  source,
8068
8427
  position
8069
8428
  } = context;
8429
+ if (position === source.length) return;
8070
8430
  context.position = source.indexOf('\n', position) + 1 || source.length;
8071
- return [[]];
8431
+ return new parser_1.List();
8072
8432
  };
8073
8433
  exports.anyline = anyline;
8074
8434
  const regEmptyline = /[^\S\n]*(?:$|\n)/y;
@@ -8080,12 +8440,14 @@ const emptyline = input => {
8080
8440
  source,
8081
8441
  position
8082
8442
  } = context;
8443
+ if (position === source.length) return;
8444
+ if (source[position] === '\n') return ++context.position, new parser_1.List();
8083
8445
  regEmptyline.lastIndex = position;
8084
8446
  regEmptyline.test(source);
8085
8447
  const i = regEmptyline.lastIndex;
8086
8448
  if (i === 0) return;
8087
8449
  context.position = i;
8088
- return [[]];
8450
+ return new parser_1.List();
8089
8451
  };
8090
8452
  exports.emptyline = emptyline;
8091
8453
  const regContentline = /[^\S\n]*\S[^\n]*(?:$|\n)/y;
@@ -8097,12 +8459,14 @@ const contentline = input => {
8097
8459
  source,
8098
8460
  position
8099
8461
  } = context;
8462
+ if (position === source.length) return;
8463
+ if (source[position] === '\n') return;
8100
8464
  regContentline.lastIndex = position;
8101
8465
  regContentline.test(source);
8102
8466
  const i = regContentline.lastIndex;
8103
8467
  if (i === 0) return;
8104
8468
  context.position = i;
8105
- return [[]];
8469
+ return new parser_1.List();
8106
8470
  };
8107
8471
  exports.contentline = contentline;
8108
8472
 
@@ -8118,6 +8482,7 @@ Object.defineProperty(exports, "__esModule", ({
8118
8482
  value: true
8119
8483
  }));
8120
8484
  exports.strs = exports.str = void 0;
8485
+ const parser_1 = __webpack_require__(605);
8121
8486
  const combinator_1 = __webpack_require__(3484);
8122
8487
  function str(pattern) {
8123
8488
  return (0, combinator_1.matcher)(pattern, true);
@@ -8131,11 +8496,11 @@ function strs(pattern) {
8131
8496
  source
8132
8497
  } = context;
8133
8498
  let acc = '';
8134
- while (context.position < source.length && source.startsWith(pattern, context.position)) {
8499
+ for (; context.position < source.length && source.startsWith(pattern, context.position);) {
8135
8500
  acc += pattern;
8136
8501
  context.position += pattern.length;
8137
8502
  }
8138
- return [[acc]];
8503
+ return new parser_1.List([new parser_1.Data(acc)]);
8139
8504
  };
8140
8505
  }
8141
8506
  exports.strs = strs;
@@ -8152,6 +8517,7 @@ Object.defineProperty(exports, "__esModule", ({
8152
8517
  value: true
8153
8518
  }));
8154
8519
  exports.backToEmailHead = exports.backToUrlHead = exports.backToWhitespace = exports.next = exports.canSkip = exports.linebreak = exports.txt = exports.text = exports.nonWhitespace = void 0;
8520
+ const parser_1 = __webpack_require__(605);
8155
8521
  const combinator_1 = __webpack_require__(3484);
8156
8522
  const dom_1 = __webpack_require__(394);
8157
8523
  //const delimiter = /(?=[\\!@#$&"`\[\](){}<>()[]{}*%|\r\n]|([+~=])\1|\/{3}|\s(?:\\?(?:$|\s)|[$%])|:\/\/)/g;
@@ -8171,24 +8537,24 @@ const text = input => {
8171
8537
  switch (char) {
8172
8538
  case '\r':
8173
8539
  (0, combinator_1.consume)(-1, context);
8174
- return [[]];
8540
+ return new parser_1.List();
8175
8541
  case "\u001B" /* Command.Escape */:
8176
8542
  case '\\':
8177
8543
  switch (source[position + 1]) {
8178
8544
  case undefined:
8179
- return [[]];
8545
+ return new parser_1.List();
8180
8546
  case '\n':
8181
- return [[]];
8547
+ return new parser_1.List();
8182
8548
  default:
8183
8549
  (0, combinator_1.consume)(1, context);
8184
8550
  context.position += 1;
8185
- return [[source.slice(position + 1, context.position)]];
8551
+ return new parser_1.List([new parser_1.Data(source.slice(position + 1, context.position))]);
8186
8552
  }
8187
8553
  case '\n':
8188
8554
  context.linebreak ||= source.length - position;
8189
- return [[(0, dom_1.html)('br')]];
8555
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8190
8556
  default:
8191
- if (context.sequential) return [[char]];
8557
+ if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8192
8558
  exports.nonWhitespace.lastIndex = position + 1;
8193
8559
  const s = canSkip(source, position);
8194
8560
  let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position);
@@ -8198,7 +8564,7 @@ const text = input => {
8198
8564
  (0, combinator_1.consume)(i - 1, context);
8199
8565
  context.position += i - 1;
8200
8566
  const linestart = position === 0 || source[position - 1] === '\n';
8201
- return position === context.position || s && !linestart || lineend ? [[]] : [[source.slice(position, context.position)]];
8567
+ return position === context.position || s && !linestart || lineend ? new parser_1.List() : new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8202
8568
  }
8203
8569
  };
8204
8570
  exports.text = text;
@@ -8433,6 +8799,7 @@ Object.defineProperty(exports, "__esModule", ({
8433
8799
  value: true
8434
8800
  }));
8435
8801
  exports.unescsource = exports.delimiter = void 0;
8802
+ const parser_1 = __webpack_require__(605);
8436
8803
  const combinator_1 = __webpack_require__(3484);
8437
8804
  const text_1 = __webpack_require__(5655);
8438
8805
  const dom_1 = __webpack_require__(394);
@@ -8451,22 +8818,22 @@ const unescsource = ({
8451
8818
  switch (char) {
8452
8819
  case '\r':
8453
8820
  (0, combinator_1.consume)(-1, context);
8454
- return [[]];
8821
+ return new parser_1.List();
8455
8822
  case "\u001B" /* Command.Escape */:
8456
8823
  (0, combinator_1.consume)(1, context);
8457
8824
  context.position += 1;
8458
- return [[source.slice(position + 1, position + 2)]];
8825
+ return new parser_1.List([new parser_1.Data(source.slice(position + 1, position + 2))]);
8459
8826
  case '\n':
8460
8827
  context.linebreak ||= source.length - position;
8461
- return [[(0, dom_1.html)('br')]];
8828
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8462
8829
  default:
8463
- if (context.sequential) return [[char]];
8830
+ if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8464
8831
  text_1.nonWhitespace.lastIndex = position + 1;
8465
8832
  let i = (0, text_1.canSkip)(source, position) ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, exports.delimiter);
8466
8833
  i -= position;
8467
8834
  (0, combinator_1.consume)(i - 1, context);
8468
8835
  context.position += i - 1;
8469
- return [[source.slice(position, context.position)]];
8836
+ return new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8470
8837
  }
8471
8838
  };
8472
8839
  exports.unescsource = unescsource;
@@ -8482,25 +8849,31 @@ exports.unescsource = unescsource;
8482
8849
  Object.defineProperty(exports, "__esModule", ({
8483
8850
  value: true
8484
8851
  }));
8485
- exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = void 0;
8852
+ exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.unwrap = void 0;
8486
8853
  const alias_1 = __webpack_require__(5413);
8487
8854
  const parser_1 = __webpack_require__(605);
8488
8855
  const dom_1 = __webpack_require__(394);
8856
+ function* unwrap(nodes) {
8857
+ for (const node of nodes ?? []) {
8858
+ yield node.value;
8859
+ }
8860
+ }
8861
+ exports.unwrap = unwrap;
8489
8862
  function repeat(symbol, parser, cons, termination = (nodes, context, prefix, postfix) => {
8490
- const acc = [];
8863
+ const acc = new parser_1.List();
8491
8864
  if (prefix > 0) {
8492
- acc.push(symbol[0].repeat(prefix));
8865
+ acc.push(new parser_1.Data(symbol[0].repeat(prefix)));
8493
8866
  }
8494
- acc.push(...nodes);
8867
+ acc.import(nodes);
8495
8868
  if (postfix > 0) {
8496
8869
  const {
8497
8870
  source,
8498
8871
  position
8499
8872
  } = context;
8500
- acc.push(source.slice(position, position + postfix));
8873
+ acc.push(new parser_1.Data(source.slice(position, position + postfix)));
8501
8874
  context.position += postfix;
8502
8875
  }
8503
- return [acc];
8876
+ return acc;
8504
8877
  }) {
8505
8878
  return (0, parser_1.failsafe)(input => {
8506
8879
  const {
@@ -8510,9 +8883,9 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
8510
8883
  source,
8511
8884
  position
8512
8885
  } = context;
8513
- let nodes = [];
8886
+ let nodes = new parser_1.List();
8514
8887
  let i = symbol.length;
8515
- while (source[context.position + i] === source[context.position]) ++i;
8888
+ for (; source[context.position + i] === source[context.position];) ++i;
8516
8889
  context.position += i;
8517
8890
  let state = false;
8518
8891
  for (; i >= symbol.length; i -= symbol.length) {
@@ -8526,8 +8899,8 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
8526
8899
  const result = parser(input);
8527
8900
  context.buffer = buf;
8528
8901
  if (result === undefined) break;
8529
- nodes = (0, parser_1.eval)(result);
8530
- switch (nodes.at(-1)) {
8902
+ nodes = result;
8903
+ switch (nodes.last?.value) {
8531
8904
  case "\u0018" /* Command.Cancel */:
8532
8905
  nodes.pop();
8533
8906
  state = false;
@@ -8583,8 +8956,7 @@ function unmarkInvalid(el) {
8583
8956
  exports.unmarkInvalid = unmarkInvalid;
8584
8957
  function stringify(nodes) {
8585
8958
  let acc = '';
8586
- for (let i = 0; i < nodes.length; ++i) {
8587
- const node = nodes[i];
8959
+ for (const node of nodes) {
8588
8960
  if (typeof node === 'string') {
8589
8961
  acc += node;
8590
8962
  } else {
@@ -8612,7 +8984,6 @@ const parser_1 = __webpack_require__(605);
8612
8984
  const combinator_1 = __webpack_require__(3484);
8613
8985
  const htmlentity_1 = __webpack_require__(470);
8614
8986
  const normalize_1 = __webpack_require__(4490);
8615
- const array_1 = __webpack_require__(6876);
8616
8987
  var blank;
8617
8988
  (function (blank) {
8618
8989
  blank.line = new RegExp(
@@ -8657,7 +9028,7 @@ function isTightStart(input, except) {
8657
9028
  return source[position + 1]?.trimStart() !== '';
8658
9029
  case '&':
8659
9030
  switch (true) {
8660
- case source.length - position > 2 && source[position + 1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(input))?.[0]?.trimStart() === '':
9031
+ case source.length - position > 2 && source[position + 1] !== ' ' && (0, htmlentity_1.unsafehtmlentity)(input)?.head?.value.trimStart() === '':
8661
9032
  context.position = position;
8662
9033
  return false;
8663
9034
  }
@@ -8676,8 +9047,9 @@ function isTightStart(input, except) {
8676
9047
  }
8677
9048
  function isLooseNodeStart(nodes) {
8678
9049
  if (nodes.length === 0) return true;
8679
- for (let i = 0; i < nodes.length; ++i) {
8680
- const node = nodes[i];
9050
+ for (const {
9051
+ value: node
9052
+ } of nodes) {
8681
9053
  if (isVisible(node)) return true;
8682
9054
  if (typeof node === 'object' && node.tagName === 'BR') break;
8683
9055
  }
@@ -8686,7 +9058,7 @@ function isLooseNodeStart(nodes) {
8686
9058
  exports.isLooseNodeStart = isLooseNodeStart;
8687
9059
  function isTightNodeStart(nodes) {
8688
9060
  if (nodes.length === 0) return true;
8689
- return isVisible(nodes[0], 0);
9061
+ return isVisible(nodes.head.value, 0);
8690
9062
  }
8691
9063
  exports.isTightNodeStart = isTightNodeStart;
8692
9064
  //export function isTightNodeEnd(nodes: readonly (HTMLElement | string)[]): boolean {
@@ -8734,7 +9106,7 @@ function trimBlankStart(parser) {
8734
9106
  reg.lastIndex = position;
8735
9107
  reg.test(source);
8736
9108
  context.position = reg.lastIndex || position;
8737
- return context.position === source.length ? [[]] : parser(input);
9109
+ return context.position === source.length ? new parser_1.List() : parser(input);
8738
9110
  });
8739
9111
  }
8740
9112
  exports.trimBlankStart = trimBlankStart;
@@ -8762,18 +9134,19 @@ exports.trimBlankEnd = trimBlankEnd;
8762
9134
  // return nodes;
8763
9135
  //}
8764
9136
  function trimBlankNodeEnd(nodes) {
8765
- const skip = nodes.length > 0 && typeof nodes.at(-1) === 'object' && nodes.at(-1)['className'] === 'indexer' ? [nodes.pop()] : [];
8766
- for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes.at(-1), -1);) {
8767
- if (typeof node === 'string') {
8768
- const str = node.trimEnd();
9137
+ const skip = nodes.length > 0 && typeof nodes.last?.value === 'object' && nodes.last.value.className === 'indexer' ? nodes.pop() : undefined;
9138
+ for (let node = nodes.last; nodes.length > 0 && !isVisible((node = nodes.last).value, -1);) {
9139
+ if (typeof node.value === 'string') {
9140
+ const str = node.value.trimEnd();
8769
9141
  if (str.length > 0) {
8770
- nodes[nodes.length - 1] = str;
9142
+ node.value = str;
8771
9143
  break;
8772
9144
  }
8773
9145
  }
8774
9146
  nodes.pop();
8775
9147
  }
8776
- return (0, array_1.push)(nodes, skip);
9148
+ skip && nodes.push(skip);
9149
+ return nodes;
8777
9150
  }
8778
9151
  exports.trimBlankNodeEnd = trimBlankNodeEnd;
8779
9152
 
@@ -9415,7 +9788,7 @@ function unlink(h) {
9415
9788
  /***/ 394
9416
9789
  (module) {
9417
9790
 
9418
- /*! typed-dom v0.0.349 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9791
+ /*! typed-dom v0.0.351 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9419
9792
  (function webpackUniversalModuleDefinition(root, factory) {
9420
9793
  if(true)
9421
9794
  module.exports = factory();
@@ -9426,8 +9799,8 @@ return /******/ (() => { // webpackBootstrap
9426
9799
  /******/ "use strict";
9427
9800
  /******/ var __webpack_modules__ = ({
9428
9801
 
9429
- /***/ 5413:
9430
- /***/ ((__unused_webpack_module, exports) => {
9802
+ /***/ 413
9803
+ (__unused_webpack_module, exports) {
9431
9804
 
9432
9805
 
9433
9806
 
@@ -9447,10 +9820,10 @@ exports.ObjectCreate = Object.create;
9447
9820
  exports.ObjectGetPrototypeOf = Object.getPrototypeOf;
9448
9821
  exports.ObjectSetPrototypeOf = Object.setPrototypeOf;
9449
9822
 
9450
- /***/ }),
9823
+ /***/ },
9451
9824
 
9452
- /***/ 1934:
9453
- /***/ ((__unused_webpack_module, exports) => {
9825
+ /***/ 934
9826
+ (__unused_webpack_module, exports) {
9454
9827
 
9455
9828
 
9456
9829
 
@@ -9463,10 +9836,10 @@ function equal(a, b) {
9463
9836
  }
9464
9837
  exports.equal = equal;
9465
9838
 
9466
- /***/ }),
9839
+ /***/ },
9467
9840
 
9468
- /***/ 6925:
9469
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9841
+ /***/ 925
9842
+ (__unused_webpack_module, exports, __nested_webpack_require_3115__) {
9470
9843
 
9471
9844
 
9472
9845
 
@@ -9474,8 +9847,8 @@ Object.defineProperty(exports, "__esModule", ({
9474
9847
  value: true
9475
9848
  }));
9476
9849
  exports.reduce = exports.memoize = void 0;
9477
- const alias_1 = __webpack_require__(5413);
9478
- const compare_1 = __webpack_require__(1934);
9850
+ const alias_1 = __nested_webpack_require_3115__(413);
9851
+ const compare_1 = __nested_webpack_require_3115__(934);
9479
9852
  function memoize(f, identify, memory) {
9480
9853
  if (typeof identify === 'object') {
9481
9854
  memory = identify;
@@ -9540,10 +9913,10 @@ function reduce(f, identify = (...as) => as[0]) {
9540
9913
  }
9541
9914
  exports.reduce = reduce;
9542
9915
 
9543
- /***/ }),
9916
+ /***/ },
9544
9917
 
9545
- /***/ 5761:
9546
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9918
+ /***/ 761
9919
+ (__unused_webpack_module, exports, __nested_webpack_require_4963__) {
9547
9920
 
9548
9921
 
9549
9922
 
@@ -9551,8 +9924,8 @@ Object.defineProperty(exports, "__esModule", ({
9551
9924
  value: true
9552
9925
  }));
9553
9926
  exports.defrag = exports.prepend = exports.append = exports.isChildren = exports.define = exports.element = exports.text = exports.math = exports.svg = exports.html = exports.frag = exports.shadow = void 0;
9554
- const alias_1 = __webpack_require__(5413);
9555
- const memoize_1 = __webpack_require__(6925);
9927
+ const alias_1 = __nested_webpack_require_4963__(413);
9928
+ const memoize_1 = __nested_webpack_require_4963__(925);
9556
9929
  var caches;
9557
9930
  (function (caches) {
9558
9931
  // Closed only.
@@ -9674,11 +10047,6 @@ function defineChildren(node, children) {
9674
10047
  if (children === undefined) return node;
9675
10048
  if (typeof children === 'string') {
9676
10049
  node.textContent = children;
9677
- } else if (((0, alias_1.isArray)(children) || !(Symbol.iterator in children)) && !node.firstChild) {
9678
- for (let i = 0; i < children.length; ++i) {
9679
- const child = children[i];
9680
- typeof child === 'object' ? node.appendChild(child) : node.append(child);
9681
- }
9682
10050
  } else {
9683
10051
  node.replaceChildren(...children);
9684
10052
  }
@@ -9692,11 +10060,6 @@ function append(node, children) {
9692
10060
  if (children === undefined) return node;
9693
10061
  if (typeof children === 'string') {
9694
10062
  node.append(children);
9695
- } else if ((0, alias_1.isArray)(children) || !(Symbol.iterator in children)) {
9696
- for (let i = 0; i < children.length; ++i) {
9697
- const child = children[i];
9698
- typeof child === 'object' ? node.appendChild(child) : node.append(child);
9699
- }
9700
10063
  } else {
9701
10064
  for (const child of children) {
9702
10065
  typeof child === 'object' ? node.appendChild(child) : node.append(child);
@@ -9709,11 +10072,6 @@ function prepend(node, children) {
9709
10072
  if (children === undefined) return node;
9710
10073
  if (typeof children === 'string') {
9711
10074
  node.prepend(children);
9712
- } else if ((0, alias_1.isArray)(children) || !(Symbol.iterator in children)) {
9713
- for (let i = 0; i < children.length; ++i) {
9714
- const child = children[i];
9715
- typeof child === 'object' ? node.insertBefore(child, null) : node.prepend(child);
9716
- }
9717
10075
  } else {
9718
10076
  for (const child of children) {
9719
10077
  typeof child === 'object' ? node.insertBefore(child, null) : node.prepend(child);
@@ -9722,24 +10080,22 @@ function prepend(node, children) {
9722
10080
  return node;
9723
10081
  }
9724
10082
  exports.prepend = prepend;
9725
- function defrag(nodes) {
9726
- const acc = [];
9727
- let appendable = false;
9728
- for (let i = 0, len = nodes.length; i < len; ++i) {
9729
- const node = nodes[i];
9730
- if (typeof node === 'object') {
9731
- acc.push(node);
9732
- appendable = false;
9733
- } else if (node !== '') {
9734
- appendable ? acc[acc.length - 1] += node : acc.push(node);
9735
- appendable = true;
10083
+ function* defrag(nodes) {
10084
+ let acc = '';
10085
+ for (const node of nodes) {
10086
+ if (typeof node === 'string') {
10087
+ acc += node;
10088
+ } else {
10089
+ if (acc) yield acc;
10090
+ acc = '';
10091
+ yield node;
9736
10092
  }
9737
10093
  }
9738
- return acc;
10094
+ if (acc) yield acc;
9739
10095
  }
9740
10096
  exports.defrag = defrag;
9741
10097
 
9742
- /***/ })
10098
+ /***/ }
9743
10099
 
9744
10100
  /******/ });
9745
10101
  /************************************************************************/
@@ -9747,7 +10103,7 @@ exports.defrag = defrag;
9747
10103
  /******/ var __webpack_module_cache__ = {};
9748
10104
  /******/
9749
10105
  /******/ // The require function
9750
- /******/ function __nested_webpack_require_12534__(moduleId) {
10106
+ /******/ function __nested_webpack_require_11558__(moduleId) {
9751
10107
  /******/ // Check if module is in cache
9752
10108
  /******/ var cachedModule = __webpack_module_cache__[moduleId];
9753
10109
  /******/ if (cachedModule !== undefined) {
@@ -9761,7 +10117,7 @@ exports.defrag = defrag;
9761
10117
  /******/ };
9762
10118
  /******/
9763
10119
  /******/ // Execute the module function
9764
- /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_12534__);
10120
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_11558__);
9765
10121
  /******/
9766
10122
  /******/ // Return the exports of the module
9767
10123
  /******/ return module.exports;
@@ -9772,7 +10128,7 @@ exports.defrag = defrag;
9772
10128
  /******/ // startup
9773
10129
  /******/ // Load entry module and return exports
9774
10130
  /******/ // This entry module is referenced by other modules so it can't be inlined
9775
- /******/ var __nested_webpack_exports__ = __nested_webpack_require_12534__(5761);
10131
+ /******/ var __nested_webpack_exports__ = __nested_webpack_require_11558__(761);
9776
10132
  /******/
9777
10133
  /******/ return __nested_webpack_exports__;
9778
10134
  /******/ })()
@@ -9784,7 +10140,7 @@ exports.defrag = defrag;
9784
10140
  /***/ 2282
9785
10141
  (module) {
9786
10142
 
9787
- /*! typed-dom v0.0.349 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
10143
+ /*! typed-dom v0.0.351 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9788
10144
  (function webpackUniversalModuleDefinition(root, factory) {
9789
10145
  if(true)
9790
10146
  module.exports = factory();
@@ -9794,7 +10150,7 @@ exports.defrag = defrag;
9794
10150
  return /******/ (() => { // webpackBootstrap
9795
10151
  /******/ "use strict";
9796
10152
  var __nested_webpack_exports__ = {};
9797
- // This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
10153
+ // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
9798
10154
  (() => {
9799
10155
  var exports = __nested_webpack_exports__;
9800
10156