securemark 0.293.4 → 0.294.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.js +868 -564
  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 +3 -3
  7. package/src/combinator/control/constraint/line.test.ts +7 -7
  8. package/src/combinator/control/constraint/line.ts +1 -1
  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 -4
  15. package/src/combinator/control/manipulation/reverse.ts +2 -2
  16. package/src/combinator/control/manipulation/scope.ts +3 -4
  17. package/src/combinator/control/manipulation/surround.ts +14 -15
  18. package/src/combinator/control/monad/bind.ts +6 -6
  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 +16 -15
  22. package/src/combinator/data/parser/context.ts +5 -4
  23. package/src/combinator/data/parser/inits.ts +6 -7
  24. package/src/combinator/data/parser/sequence.test.ts +3 -3
  25. package/src/combinator/data/parser/sequence.ts +6 -7
  26. package/src/combinator/data/parser/some.test.ts +3 -3
  27. package/src/combinator/data/parser/some.ts +4 -4
  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 +16 -7
  33. package/src/debug.test.ts +6 -5
  34. package/src/parser/api/bind.ts +6 -8
  35. package/src/parser/api/header.ts +1 -1
  36. package/src/parser/api/normalize.ts +2 -4
  37. package/src/parser/api/parse.ts +3 -1
  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 +23 -19
  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 +9 -7
  59. package/src/parser/block/reply.ts +7 -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 +7 -6
  64. package/src/parser/header.test.ts +3 -1
  65. package/src/parser/header.ts +20 -20
  66. package/src/parser/inline/annotation.ts +3 -1
  67. package/src/parser/inline/autolink/account.ts +3 -2
  68. package/src/parser/inline/autolink/anchor.ts +3 -2
  69. package/src/parser/inline/autolink/channel.ts +5 -4
  70. package/src/parser/inline/autolink/email.ts +4 -3
  71. package/src/parser/inline/autolink/hashnum.ts +3 -2
  72. package/src/parser/inline/autolink/hashtag.ts +4 -3
  73. package/src/parser/inline/autolink/url.ts +7 -6
  74. package/src/parser/inline/bracket.ts +16 -15
  75. package/src/parser/inline/code.ts +5 -4
  76. package/src/parser/inline/deletion.ts +5 -5
  77. package/src/parser/inline/emphasis.ts +4 -3
  78. package/src/parser/inline/emstrong.test.ts +18 -18
  79. package/src/parser/inline/emstrong.ts +39 -30
  80. package/src/parser/inline/extension/index.ts +22 -19
  81. package/src/parser/inline/extension/indexee.ts +2 -2
  82. package/src/parser/inline/extension/indexer.ts +2 -1
  83. package/src/parser/inline/extension/label.ts +7 -3
  84. package/src/parser/inline/extension/placeholder.ts +6 -6
  85. package/src/parser/inline/html.ts +27 -28
  86. package/src/parser/inline/htmlentity.ts +9 -8
  87. package/src/parser/inline/insertion.ts +5 -5
  88. package/src/parser/inline/italic.ts +5 -5
  89. package/src/parser/inline/link.ts +36 -38
  90. package/src/parser/inline/mark.ts +7 -7
  91. package/src/parser/inline/math.ts +5 -4
  92. package/src/parser/inline/media.ts +33 -32
  93. package/src/parser/inline/reference.ts +19 -20
  94. package/src/parser/inline/remark.ts +11 -11
  95. package/src/parser/inline/ruby.ts +50 -53
  96. package/src/parser/inline/strong.ts +4 -3
  97. package/src/parser/inline/template.ts +16 -15
  98. package/src/parser/inline.test.ts +3 -3
  99. package/src/parser/segment.ts +3 -1
  100. package/src/parser/source/escapable.ts +9 -8
  101. package/src/parser/source/line.ts +4 -3
  102. package/src/parser/source/str.ts +2 -2
  103. package/src/parser/source/text.ts +19 -26
  104. package/src/parser/source/unescapable.ts +6 -5
  105. package/src/parser/util.ts +16 -30
  106. package/src/parser/visibility.ts +19 -20
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.293.4 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.294.0 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"));
@@ -1346,15 +1346,15 @@ exports.rnd32 = cons(32);
1346
1346
  exports.rnd36 = cons(36);
1347
1347
  exports.rnd62 = cons(62);
1348
1348
  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);
1349
+ exports.rnd09 = conv(exports.rnd10, table0_, 10);
1350
+ exports.rnd0f = conv(exports.rnd16, table0_, 16);
1351
+ exports.rnd0v = conv(exports.rnd32, table0_, 32);
1352
+ exports.rnd0z = conv(exports.rnd36, table0_, 36);
1353
+ exports.rnd0Z = conv(exports.rnd62, table0_, 62);
1354
+ exports.rnd0S = conv(exports.rnd64, table0S, 64);
1355
+ exports.rnd0_ = conv(exports.rnd64, table0_, 64);
1356
+ exports.rndAP = conv(exports.rnd16, tableAz, 16);
1357
+ exports.rndAf = conv(exports.rnd32, tableAz, 32);
1358
1358
  function unique(rng, len = 1, mem) {
1359
1359
  const independence = !mem;
1360
1360
  mem ??= new Set();
@@ -1398,11 +1398,13 @@ function cons(size) {
1398
1398
  return r < size ? r : rng();
1399
1399
  };
1400
1400
  }
1401
- function conv($rng, table) {
1401
+ function conv($rng, table, size) {
1402
1402
  return (len = 1, rng = $rng) => {
1403
1403
  let acc = '';
1404
1404
  while (len--) {
1405
- acc += table[rng()];
1405
+ const i = rng();
1406
+ if (i >= size) throw new Error(`Spica: Random: Invalid rng`);
1407
+ acc += table[i];
1406
1408
  }
1407
1409
  return acc;
1408
1410
  };
@@ -2564,7 +2566,7 @@ function line(parser) {
2564
2566
  if (result === undefined) return;
2565
2567
  if (!isBlank(source.slice(context.position, position + line.length))) return;
2566
2568
  context.position = position + line.length;
2567
- return [(0, parser_1.eval)(result)];
2569
+ return (0, parser_1.eval)(result);
2568
2570
  });
2569
2571
  }
2570
2572
  exports.line = line;
@@ -2581,7 +2583,7 @@ exports.isBlank = isBlank;
2581
2583
  /***/ },
2582
2584
 
2583
2585
  /***/ 8606
2584
- (__unused_webpack_module, exports) {
2586
+ (__unused_webpack_module, exports, __webpack_require__) {
2585
2587
 
2586
2588
  "use strict";
2587
2589
 
@@ -2590,8 +2592,9 @@ Object.defineProperty(exports, "__esModule", ({
2590
2592
  value: true
2591
2593
  }));
2592
2594
  exports.clear = void 0;
2595
+ const parser_1 = __webpack_require__(605);
2593
2596
  function clear(parser) {
2594
- return input => parser(input) && [[]];
2597
+ return input => parser(input) && new parser_1.List();
2595
2598
  }
2596
2599
  exports.clear = clear;
2597
2600
 
@@ -2622,7 +2625,7 @@ function convert(conv, parser, continuous, empty = false) {
2622
2625
  if (src === '') {
2623
2626
  if (!empty) return;
2624
2627
  context.position = source.length;
2625
- return [[]];
2628
+ return new parser_1.List();
2626
2629
  }
2627
2630
  if (continuous) {
2628
2631
  context.position += source.length - position - src.length;
@@ -2654,9 +2657,10 @@ Object.defineProperty(exports, "__esModule", ({
2654
2657
  value: true
2655
2658
  }));
2656
2659
  exports.dup = void 0;
2660
+ const parser_1 = __webpack_require__(605);
2657
2661
  const fmap_1 = __webpack_require__(2705);
2658
2662
  function dup(parser) {
2659
- return (0, fmap_1.fmap)(parser, nodes => [nodes]);
2663
+ return (0, fmap_1.fmap)(parser, nodes => new parser_1.List([new parser_1.Data(nodes)]));
2660
2664
  }
2661
2665
  exports.dup = dup;
2662
2666
 
@@ -2739,7 +2743,7 @@ function fence(opener, limit, separation = true) {
2739
2743
  }
2740
2744
  context.position += line.length;
2741
2745
  }
2742
- return [(0, array_1.push)([block, overflow, closer], matches)];
2746
+ return new parser_1.List((0, array_1.push)([block, overflow, closer], matches).map(str => new parser_1.Data(str)));
2743
2747
  });
2744
2748
  }
2745
2749
  exports.fence = fence;
@@ -2778,10 +2782,10 @@ function indent(opener, parser = false, separation = false) {
2778
2782
  position
2779
2783
  } = context;
2780
2784
  context.position = source.length;
2781
- return [[source.slice(position)]];
2785
+ return new parser_1.List([new parser_1.Data(source.slice(position))]);
2782
2786
  }))), ([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;
2787
+ const result = parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context));
2788
+ return result ? (0, parser_1.eval)(result) : undefined;
2785
2789
  }));
2786
2790
  }
2787
2791
  exports.indent = indent;
@@ -2886,9 +2890,10 @@ Object.defineProperty(exports, "__esModule", ({
2886
2890
  value: true
2887
2891
  }));
2888
2892
  exports.reverse = void 0;
2893
+ const parser_1 = __webpack_require__(605);
2889
2894
  const fmap_1 = __webpack_require__(2705);
2890
2895
  function reverse(parser) {
2891
- return (0, fmap_1.fmap)(parser, nodes => nodes.reverse());
2896
+ return (0, fmap_1.fmap)(parser, nodes => nodes.foldr((node, acc) => acc.push(nodes.delete(node)) && acc, new parser_1.List()));
2892
2897
  }
2893
2898
  exports.reverse = reverse;
2894
2899
 
@@ -2918,7 +2923,7 @@ function focus(scope, parser) {
2918
2923
  if (position === source.length) return;
2919
2924
  const src = (0, parser_1.eval)(match({
2920
2925
  context
2921
- }))?.[0] ?? '';
2926
+ }))?.head?.value ?? '';
2922
2927
  if (src === '') return;
2923
2928
  context.range = src.length;
2924
2929
  context.offset ??= 0;
@@ -2929,7 +2934,7 @@ function focus(scope, parser) {
2929
2934
  context.source = source;
2930
2935
  context.offset -= position;
2931
2936
  if (result === undefined) return;
2932
- return [(0, parser_1.eval)(result)];
2937
+ return (0, parser_1.eval)(result);
2933
2938
  });
2934
2939
  }
2935
2940
  exports.focus = focus;
@@ -2955,7 +2960,7 @@ function rewrite(scope, parser) {
2955
2960
  context.source = source;
2956
2961
  context.offset -= position;
2957
2962
  if (res2 === undefined) return;
2958
- return [(0, parser_1.eval)(res2)];
2963
+ return (0, parser_1.eval)(res2);
2959
2964
  });
2960
2965
  }
2961
2966
  exports.rewrite = rewrite;
@@ -2974,7 +2979,6 @@ Object.defineProperty(exports, "__esModule", ({
2974
2979
  exports.setBacktrack = exports.isBacktrack = exports.close = exports.open = exports.surround = void 0;
2975
2980
  const parser_1 = __webpack_require__(605);
2976
2981
  const combinator_1 = __webpack_require__(3484);
2977
- const array_1 = __webpack_require__(6876);
2978
2982
  function surround(opener, parser, closer, optional = false, f, g, backtracks = []) {
2979
2983
  switch (typeof opener) {
2980
2984
  case 'string':
@@ -3029,7 +3033,7 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3029
3033
  return void revert(context, linebreak);
3030
3034
  }
3031
3035
  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)];
3036
+ const result = f ? f([nodesO, nodesM, nodesC], context) : nodesO.import(nodesM ?? new parser_1.List()).import(nodesC);
3033
3037
  if (result) {
3034
3038
  context.linebreak ||= linebreak;
3035
3039
  } else {
@@ -3073,11 +3077,10 @@ function isBacktrack(context, backtracks, position = context.position, length =
3073
3077
  }
3074
3078
  exports.isBacktrack = isBacktrack;
3075
3079
  function setBacktrack(context, backtracks, position, length = 1) {
3080
+ // 以降バックトラックの可能性がなく記録不要の場合もあるが判別が面倒なので省略
3076
3081
  const {
3077
- source,
3078
- state = 0
3082
+ source
3079
3083
  } = context;
3080
- if (state === 0) return;
3081
3084
  if (position === source.length) return;
3082
3085
  if (length === 0) return;
3083
3086
  for (const backtrack of backtracks) {
@@ -3156,22 +3159,183 @@ Object.defineProperty(exports, "__esModule", ({
3156
3159
  exports.fmap = void 0;
3157
3160
  const bind_1 = __webpack_require__(994);
3158
3161
  function fmap(parser, f) {
3159
- return (0, bind_1.bind)(parser, (nodes, context) => [f(nodes, context)]);
3162
+ return (0, bind_1.bind)(parser, (nodes, context) => f(nodes, context));
3160
3163
  }
3161
3164
  exports.fmap = fmap;
3162
3165
 
3163
3166
  /***/ },
3164
3167
 
3165
- /***/ 605
3168
+ /***/ 3602
3166
3169
  (__unused_webpack_module, exports) {
3167
3170
 
3168
3171
  "use strict";
3169
3172
 
3170
3173
 
3174
+ // Memory-efficient flexible list.
3175
+ Object.defineProperty(exports, "__esModule", ({
3176
+ value: true
3177
+ }));
3178
+ exports.List = void 0;
3179
+ class List {
3180
+ constructor(nodes) {
3181
+ this.length = 0;
3182
+ this.head = undefined;
3183
+ if (nodes === undefined) return;
3184
+ for (let i = 0; i < nodes.length; ++i) {
3185
+ this.push(nodes[i]);
3186
+ }
3187
+ }
3188
+ get tail() {
3189
+ return this.head?.next;
3190
+ }
3191
+ get last() {
3192
+ return this.head?.prev;
3193
+ }
3194
+ insert(node, before) {
3195
+ if (++this.length === 1) {
3196
+ return this.head = node.next = node.prev = node;
3197
+ }
3198
+ const next = node.next = before ?? this.head;
3199
+ const prev = node.prev = next.prev;
3200
+ return next.prev = prev.next = node;
3201
+ }
3202
+ delete(node) {
3203
+ if (--this.length === 0) {
3204
+ this.head = undefined;
3205
+ } else {
3206
+ const {
3207
+ next,
3208
+ prev
3209
+ } = node;
3210
+ if (node === this.head) {
3211
+ this.head = next;
3212
+ }
3213
+ // Error if not used.
3214
+ prev.next = next;
3215
+ next.prev = prev;
3216
+ }
3217
+ node.next = node.prev = undefined;
3218
+ return node;
3219
+ }
3220
+ unshift(node) {
3221
+ return this.head = this.insert(node, this.head);
3222
+ }
3223
+ push(node) {
3224
+ return this.insert(node, this.head);
3225
+ }
3226
+ shift() {
3227
+ if (this.length === 0) return;
3228
+ return this.delete(this.head);
3229
+ }
3230
+ pop() {
3231
+ if (this.length === 0) return;
3232
+ return this.delete(this.head.prev);
3233
+ }
3234
+ import(list, before) {
3235
+ if (list.length === 0) return this;
3236
+ if (this.length === 0) {
3237
+ this.head = list.head;
3238
+ this.length += list.length;
3239
+ list.clear();
3240
+ return this;
3241
+ }
3242
+ const head = list.head;
3243
+ const last = list.last;
3244
+ const next = last.next = before ?? this.head;
3245
+ const prev = head.prev = next.prev;
3246
+ next.prev = last;
3247
+ prev.next = head;
3248
+ this.length += list.length;
3249
+ list.clear();
3250
+ return this;
3251
+ }
3252
+ clear() {
3253
+ this.length = 0;
3254
+ this.head = undefined;
3255
+ }
3256
+ *[Symbol.iterator]() {
3257
+ for (let node = this.head; node && this.head;) {
3258
+ const next = node.next;
3259
+ yield node;
3260
+ node = next;
3261
+ if (node === this.head) break;
3262
+ }
3263
+ }
3264
+ flatMap(f) {
3265
+ const acc = new List();
3266
+ for (let node = this.head; node && this.head;) {
3267
+ const next = node.next;
3268
+ acc.import(f(node));
3269
+ node = next;
3270
+ if (node === this.head) break;
3271
+ }
3272
+ return acc;
3273
+ }
3274
+ foldl(f, acc) {
3275
+ for (let node = this.head; node && this.head;) {
3276
+ const next = node.next;
3277
+ acc = f(acc, node);
3278
+ node = next;
3279
+ if (node === this.head) break;
3280
+ }
3281
+ return acc;
3282
+ }
3283
+ foldr(f, acc) {
3284
+ for (let node = this.head?.prev; node && this.head;) {
3285
+ const prev = node.prev;
3286
+ acc = f(node, acc);
3287
+ if (node === this.head) break;
3288
+ node = prev;
3289
+ }
3290
+ return acc;
3291
+ }
3292
+ find(f) {
3293
+ for (let node = this.head; node && this.head;) {
3294
+ const next = node.next;
3295
+ if (f(node)) return node;
3296
+ node = next;
3297
+ if (node === this.head) break;
3298
+ }
3299
+ }
3300
+ }
3301
+ exports.List = List;
3302
+ (function (List) {
3303
+ class Node {
3304
+ constructor() {
3305
+ this.next = undefined;
3306
+ this.prev = undefined;
3307
+ }
3308
+ }
3309
+ List.Node = Node;
3310
+ })(List || (exports.List = List = {}));
3311
+
3312
+ /***/ },
3313
+
3314
+ /***/ 605
3315
+ (__unused_webpack_module, exports, __webpack_require__) {
3316
+
3317
+ "use strict";
3318
+
3319
+
3171
3320
  Object.defineProperty(exports, "__esModule", ({
3172
3321
  value: true
3173
3322
  }));
3174
- exports.failsafe = exports.eval = exports.clean = exports.subinput = exports.input = void 0;
3323
+ exports.failsafe = exports.eval = exports.clean = exports.subinput = exports.input = exports.Data = exports.List = void 0;
3324
+ const data_1 = __webpack_require__(3602);
3325
+ Object.defineProperty(exports, "List", ({
3326
+ enumerable: true,
3327
+ get: function () {
3328
+ return data_1.List;
3329
+ }
3330
+ }));
3331
+ class Data {
3332
+ constructor(value) {
3333
+ this.value = value;
3334
+ this.next = undefined;
3335
+ this.prev = undefined;
3336
+ }
3337
+ }
3338
+ exports.Data = Data;
3175
3339
  function input(source, context) {
3176
3340
  // @ts-expect-error
3177
3341
  context.source = source;
@@ -3209,7 +3373,7 @@ function clean(context) {
3209
3373
  }
3210
3374
  exports.clean = clean;
3211
3375
  function eval_(result, default_) {
3212
- return result ? result[0] : default_;
3376
+ return result ? result : default_;
3213
3377
  }
3214
3378
  exports.eval = eval_;
3215
3379
  function failsafe(parser) {
@@ -3244,13 +3408,18 @@ Object.defineProperty(exports, "__esModule", ({
3244
3408
  }));
3245
3409
  exports.matcher = exports.constraint = exports.state = exports.precedence = exports.recursion = exports.consume = exports.creation = exports.context = exports.reset = void 0;
3246
3410
  const alias_1 = __webpack_require__(5413);
3411
+ const parser_1 = __webpack_require__(605);
3247
3412
  const assign_1 = __webpack_require__(9888);
3248
3413
  function reset(base, parser) {
3249
3414
  const changes = Object.entries(base);
3250
3415
  const values = Array(changes.length);
3251
3416
  return ({
3252
3417
  context
3253
- }) => apply(parser, context, changes, values, true);
3418
+ }) =>
3419
+ // 大域離脱時の汚染回避のため複製
3420
+ apply(parser, {
3421
+ ...context
3422
+ }, changes, values, true);
3254
3423
  }
3255
3424
  exports.reset = reset;
3256
3425
  function context(base, parser) {
@@ -3412,7 +3581,7 @@ function matcher(pattern, advance) {
3412
3581
  if (advance) {
3413
3582
  context.position += pattern.length;
3414
3583
  }
3415
- return [[pattern]];
3584
+ return new parser_1.List([new parser_1.Data(pattern)]);
3416
3585
  };
3417
3586
  case 'object':
3418
3587
  return ({
@@ -3429,7 +3598,7 @@ function matcher(pattern, advance) {
3429
3598
  if (advance) {
3430
3599
  context.position += src.length;
3431
3600
  }
3432
- return [[src]];
3601
+ return new parser_1.List([new parser_1.Data(src)]);
3433
3602
  };
3434
3603
  }
3435
3604
  }
@@ -3604,7 +3773,6 @@ Object.defineProperty(exports, "__esModule", ({
3604
3773
  }));
3605
3774
  exports.inits = void 0;
3606
3775
  const parser_1 = __webpack_require__(605);
3607
- const array_1 = __webpack_require__(6876);
3608
3776
  function inits(parsers, resume) {
3609
3777
  if (parsers.length === 1) return parsers[0];
3610
3778
  return input => {
@@ -3621,10 +3789,10 @@ function inits(parsers, resume) {
3621
3789
  if (context.delimiters?.match(input)) break;
3622
3790
  const result = parsers[i](input);
3623
3791
  if (result === undefined) break;
3624
- nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3792
+ nodes = nodes ? nodes.import((0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3625
3793
  if (resume?.((0, parser_1.eval)(result)) === false) break;
3626
3794
  }
3627
- return nodes && context.position > position ? [nodes] : undefined;
3795
+ return nodes && context.position > position ? nodes : undefined;
3628
3796
  };
3629
3797
  }
3630
3798
  exports.inits = inits;
@@ -3642,7 +3810,6 @@ Object.defineProperty(exports, "__esModule", ({
3642
3810
  }));
3643
3811
  exports.sequence = void 0;
3644
3812
  const parser_1 = __webpack_require__(605);
3645
- const array_1 = __webpack_require__(6876);
3646
3813
  function sequence(parsers, resume) {
3647
3814
  if (parsers.length === 1) return parsers[0];
3648
3815
  return input => {
@@ -3659,10 +3826,10 @@ function sequence(parsers, resume) {
3659
3826
  if (context.delimiters?.match(input)) return;
3660
3827
  const result = parsers[i](input);
3661
3828
  if (result === undefined) return;
3662
- nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3829
+ nodes = nodes ? nodes.import((0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3663
3830
  if (resume?.((0, parser_1.eval)(result)) === false) return;
3664
3831
  }
3665
- return nodes && context.position > position ? [nodes] : undefined;
3832
+ return nodes && context.position > position ? nodes : undefined;
3666
3833
  };
3667
3834
  }
3668
3835
  exports.sequence = sequence;
@@ -3709,13 +3876,13 @@ function some(parser, end, delimiters = [], limit = -1) {
3709
3876
  if (context.delimiters?.match(input)) break;
3710
3877
  const result = parser(input);
3711
3878
  if (result === undefined) break;
3712
- nodes = nodes ? (nodes.push(...(0, parser_1.eval)(result)), nodes) : (0, parser_1.eval)(result);
3879
+ nodes = nodes ? nodes.import((0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3713
3880
  if (limit >= 0 && context.position - position > limit) break;
3714
3881
  }
3715
3882
  if (delims.length > 0) {
3716
3883
  context.delimiters.pop(delims.length);
3717
3884
  }
3718
- return nodes && context.position > position ? [nodes] : undefined;
3885
+ return nodes && context.position > position ? nodes : undefined;
3719
3886
  };
3720
3887
  }
3721
3888
  exports.some = some;
@@ -3917,12 +4084,9 @@ function bind(target, settings) {
3917
4084
  function* parse(source) {
3918
4085
  if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
3919
4086
  const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
3920
- source = (0, normalize_1.normalize)((0, segment_1.validate)(source, segment_1.MAX_INPUT_SIZE) ? source : source.slice(0, segment_1.MAX_INPUT_SIZE + 1));
3921
- // Change the object identity.
3922
- context = {
3923
- ...context,
3924
- url: url ? new url_1.ReadonlyURL(url) : undefined
3925
- };
4087
+ source = (0, normalize_1.normalize)(source);
4088
+ // @ts-expect-error
4089
+ context.url = url ? new url_1.ReadonlyURL(url) : undefined;
3926
4090
  const rev = revision = Symbol();
3927
4091
  const sourceSegments = [];
3928
4092
  for (const seg of (0, segment_1.segment)(source)) {
@@ -3950,7 +4114,9 @@ function bind(target, settings) {
3950
4114
  const seg = sourceSegments[index];
3951
4115
  const es = (0, parser_1.eval)((0, header_1.header)((0, parser_1.input)(seg, {
3952
4116
  header: index === 0
3953
- })) || (0, block_1.block)((0, parser_1.input)(seg, context)), []);
4117
+ })) || (0, block_1.block)((0, parser_1.input)(seg, context)))?.foldl((acc, {
4118
+ value
4119
+ }) => void acc.push(value) || acc, []) ?? [];
3954
4120
  blocks.splice(index, 0, [seg, es, url]);
3955
4121
  if (es.length === 0) continue;
3956
4122
  // All deletion processes always run after all addition processes have done.
@@ -4131,7 +4297,7 @@ exports.headers = headers;
4131
4297
  function parse(source) {
4132
4298
  const i = (0, parser_1.input)(source, {});
4133
4299
  const result = (0, header_1.header)(i);
4134
- const [el] = (0, parser_1.eval)(result, []);
4300
+ const el = (0, parser_1.eval)(result)?.head?.value;
4135
4301
  return el?.tagName === 'ASIDE' ? [el, i.context.position] : [];
4136
4302
  }
4137
4303
 
@@ -4164,8 +4330,8 @@ function sanitize(source) {
4164
4330
  // https://en.wikipedia.org/wiki/Whitespace_character
4165
4331
  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'];
4166
4332
  const unreadableHTMLEntityNames = exports.invisibleHTMLEntityNames.slice(2);
4167
- const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, {})))[0]);
4168
- const unreadableEscapableCharacter = new RegExp(`[${[...new Set(unreadableEscapableCharacters)].join('')}]`, 'g');
4333
+ const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, {}))).head.value);
4334
+ const unreadableEscapableCharacter = new RegExp(`[${unreadableEscapableCharacters.join('')}]`, 'g');
4169
4335
  // https://www.pandanoir.info/entry/2018/03/11/193000
4170
4336
  // http://anti.rosx.net/etc/memo/002_space.html
4171
4337
  // http://nicowiki.com/%E7%A9%BA%E7%99%BD%E3%83%BB%E7%89%B9%E6%AE%8A%E8%A8%98%E5%8F%B7.html
@@ -4241,9 +4407,11 @@ function parse(source, opts = {}, context) {
4241
4407
  const node = (0, dom_1.frag)();
4242
4408
  let index = 0;
4243
4409
  for (const seg of (0, segment_1.segment)(source)) {
4244
- node.append(...(0, parser_1.eval)((0, header_1.header)((0, parser_1.input)(seg, {
4410
+ node.append(...((0, parser_1.eval)((0, header_1.header)((0, parser_1.input)(seg, {
4245
4411
  header: index++ === 0
4246
- })) || (0, block_1.block)((0, parser_1.input)(seg, context)), []));
4412
+ })) || (0, block_1.block)((0, parser_1.input)(seg, context)))?.foldl((acc, {
4413
+ value
4414
+ }) => void acc.push(value) || acc, []) ?? []));
4247
4415
  }
4248
4416
  if (opts.test) return node;
4249
4417
  for (const _ of (0, figure_1.figure)(node, opts.notes, context));
@@ -4281,6 +4449,7 @@ Object.defineProperty(exports, "__esModule", ({
4281
4449
  value: true
4282
4450
  }));
4283
4451
  exports.block = void 0;
4452
+ const parser_1 = __webpack_require__(605);
4284
4453
  const combinator_1 = __webpack_require__(3484);
4285
4454
  const segment_1 = __webpack_require__(3967);
4286
4455
  const source_1 = __webpack_require__(8745);
@@ -4377,13 +4546,13 @@ function error(parser) {
4377
4546
  position,
4378
4547
  id
4379
4548
  }
4380
- }, reason) => [[(0, dom_1.html)('h1', {
4549
+ }, reason) => new parser_1.List([new parser_1.Data((0, dom_1.html)('h1', {
4381
4550
  id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : undefined,
4382
4551
  class: 'error'
4383
- }, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`), (0, dom_1.html)('pre', {
4552
+ }, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`)), new parser_1.Data((0, dom_1.html)('pre', {
4384
4553
  class: 'error',
4385
4554
  translate: 'no'
4386
- }, source.slice(position).replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined)]]);
4555
+ }, source.slice(position).replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined))]));
4387
4556
  }
4388
4557
 
4389
4558
  /***/ },
@@ -4398,9 +4567,11 @@ Object.defineProperty(exports, "__esModule", ({
4398
4567
  value: true
4399
4568
  }));
4400
4569
  exports.blockquote = exports.segment = void 0;
4570
+ const parser_1 = __webpack_require__(605);
4401
4571
  const combinator_1 = __webpack_require__(3484);
4402
4572
  const autolink_1 = __webpack_require__(1671);
4403
4573
  const source_1 = __webpack_require__(8745);
4574
+ const util_1 = __webpack_require__(4992);
4404
4575
  const parse_1 = __webpack_require__(3662);
4405
4576
  const dom_1 = __webpack_require__(394);
4406
4577
  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))]));
@@ -4408,7 +4579,7 @@ exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, co
4408
4579
  const opener = /(?=>>+(?:$|\s))/y;
4409
4580
  const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|\s)/y)), false);
4410
4581
  const unindent = source => source.replace(/(?<=^|\n)>(?:[^\S\n]|(?=>*(?:$|\s)))|\n$/g, '');
4411
- 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)]));
4582
+ 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)))])));
4412
4583
  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, ({
4413
4584
  context
4414
4585
  }) => {
@@ -4425,8 +4596,8 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
4425
4596
  }
4426
4597
  }, context);
4427
4598
  context.position = source.length;
4428
- return [[(0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])]];
4429
- }, false, true)))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
4599
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references]))]);
4600
+ }, false, true)))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4430
4601
 
4431
4602
  /***/ },
4432
4603
 
@@ -4451,7 +4622,8 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
4451
4622
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
4452
4623
  exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
4453
4624
  // Bug: Type mismatch between outer and inner.
4454
- ([body, overflow, closer, opener, delim, param], context) => {
4625
+ (nodes, context) => {
4626
+ const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
4455
4627
  const params = param.match(/(?:\\.?|\S)+/g)?.reduce((params, value, i) => {
4456
4628
  let name;
4457
4629
  switch (true) {
@@ -4472,21 +4644,19 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinato
4472
4644
  name in params ? params.invalid = `Duplicate ${name} attribute` : params[name] = value;
4473
4645
  return params;
4474
4646
  }, {}) ?? {};
4475
- if (!closer || overflow || params.invalid) return [(0, dom_1.html)('pre', {
4647
+ if (!closer || overflow || params.invalid) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4476
4648
  class: 'invalid',
4477
4649
  translate: 'no',
4478
4650
  ...(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)
4479
- }, `${opener}${body}${overflow || closer}`)];
4651
+ }, `${opener}${body}${overflow || closer}`))]);
4480
4652
  const el = (0, dom_1.html)('pre', {
4481
4653
  class: params.lang ? `code language-${params.lang}` : 'text',
4482
4654
  translate: params.lang ? 'no' : undefined,
4483
4655
  'data-lang': params.lang || undefined,
4484
4656
  'data-line': params.line || undefined,
4485
4657
  'data-path': params.path || undefined
4486
- }, 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), {
4487
- ...context
4488
- })), [])));
4489
- return [el];
4658
+ }, 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, parser_1.eval)((0, autolink_1.autolink)((0, parser_1.subinput)(body.slice(0, -1), context)), new parser_1.List()))));
4659
+ return new parser_1.List([new parser_1.Data(el)]);
4490
4660
  }));
4491
4661
 
4492
4662
  /***/ },
@@ -4501,19 +4671,20 @@ Object.defineProperty(exports, "__esModule", ({
4501
4671
  value: true
4502
4672
  }));
4503
4673
  exports.dlist = void 0;
4674
+ const parser_1 = __webpack_require__(605);
4504
4675
  const combinator_1 = __webpack_require__(3484);
4505
4676
  const inline_1 = __webpack_require__(7973);
4506
4677
  const source_1 = __webpack_require__(8745);
4507
4678
  const visibility_1 = __webpack_require__(6364);
4508
- const array_1 = __webpack_require__(6876);
4679
+ const util_1 = __webpack_require__(4992);
4509
4680
  const dom_1 = __webpack_require__(394);
4510
- 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))])));
4511
- 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', {
4681
+ 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))))]))));
4682
+ 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', {
4512
4683
  'data-index': (0, inline_1.dataindex)(ns)
4513
- }, (0, dom_1.defrag)(ns))])));
4514
- 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);
4515
- function fillTrailingDescription(es) {
4516
- return es.length > 0 && es.at(-1).tagName === 'DT' ? (0, array_1.push)(es, [(0, dom_1.html)('dd')]) : es;
4684
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))));
4685
+ 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);
4686
+ function fillTrailingDescription(nodes) {
4687
+ return nodes.last?.value.tagName === 'DT' ? nodes.push(new parser_1.Data((0, dom_1.html)('dd'))) && nodes : nodes;
4517
4688
  }
4518
4689
 
4519
4690
  /***/ },
@@ -4552,6 +4723,7 @@ Object.defineProperty(exports, "__esModule", ({
4552
4723
  value: true
4553
4724
  }));
4554
4725
  exports.aside = void 0;
4726
+ const parser_1 = __webpack_require__(605);
4555
4727
  const combinator_1 = __webpack_require__(3484);
4556
4728
  const indexee_1 = __webpack_require__(7610);
4557
4729
  const util_1 = __webpack_require__(4992);
@@ -4559,12 +4731,13 @@ const parse_1 = __webpack_require__(3662);
4559
4731
  const dom_1 = __webpack_require__(394);
4560
4732
  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),
4561
4733
  // Bug: Type mismatch between outer and inner.
4562
- ([body, overflow, closer, opener, delim, param], context) => {
4563
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
4734
+ (nodes, context) => {
4735
+ const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
4736
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4564
4737
  class: 'invalid',
4565
4738
  translate: 'no',
4566
4739
  ...(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')
4567
- }, `${opener}${body}${overflow || closer}`)];
4740
+ }, `${opener}${body}${overflow || closer}`))]);
4568
4741
  const references = (0, dom_1.html)('ol', {
4569
4742
  class: 'references'
4570
4743
  });
@@ -4575,15 +4748,15 @@ exports.aside = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combina
4575
4748
  }
4576
4749
  }, context);
4577
4750
  const heading = 'H1 H2 H3 H4 H5 H6'.split(' ').includes(document.firstElementChild?.tagName) && document.firstElementChild;
4578
- if (!heading) return [(0, dom_1.html)('pre', {
4751
+ if (!heading) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4579
4752
  class: 'invalid',
4580
4753
  translate: 'no',
4581
4754
  ...(0, util_1.invalid)('aside', 'content', 'Missing the title at the first line')
4582
- }, `${opener}${body}${closer}`)];
4583
- return [(0, dom_1.html)('aside', {
4755
+ }, `${opener}${body}${closer}`))]);
4756
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4584
4757
  id: (0, indexee_1.identity)('index', context.id, heading),
4585
4758
  class: 'aside'
4586
- }, [document, (0, dom_1.html)('h2', 'References'), references])];
4759
+ }, [document, (0, dom_1.html)('h2', 'References'), references]))]);
4587
4760
  })));
4588
4761
 
4589
4762
  /***/ },
@@ -4607,12 +4780,13 @@ const dom_1 = __webpack_require__(394);
4607
4780
  const opener = /(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y;
4608
4781
  exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
4609
4782
  // Bug: Type mismatch between outer and inner.
4610
- ([body, overflow, closer, opener, delim, type = 'markdown', param], context) => {
4611
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
4783
+ (nodes, context) => {
4784
+ const [body, overflow, closer, opener, delim, type = 'markdown', param] = (0, util_1.unwrap)(nodes);
4785
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4612
4786
  class: 'invalid',
4613
4787
  translate: 'no',
4614
4788
  ...(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')
4615
- }, `${opener}${body}${overflow || closer}`)];
4789
+ }, `${opener}${body}${overflow || closer}`))]);
4616
4790
  switch (type) {
4617
4791
  case 'markdown':
4618
4792
  {
@@ -4625,28 +4799,26 @@ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combi
4625
4799
  references
4626
4800
  }
4627
4801
  }, context);
4628
- return [(0, dom_1.html)('aside', {
4802
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4629
4803
  class: 'example',
4630
4804
  'data-type': 'markdown'
4631
4805
  }, [(0, dom_1.html)('pre', {
4632
4806
  translate: 'no'
4633
- }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])])];
4807
+ }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references])]))]);
4634
4808
  }
4635
4809
  case 'math':
4636
- return [(0, dom_1.html)('aside', {
4810
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
4637
4811
  class: 'example',
4638
4812
  'data-type': 'math'
4639
4813
  }, [(0, dom_1.html)('pre', {
4640
4814
  translate: 'no'
4641
- }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)((0, parser_1.input)(`$$\n${body}$$`, {
4642
- ...context
4643
- })), [])[0]])];
4815
+ }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)((0, parser_1.subinput)(`$$\n${body}$$`, context))).head.value]))]);
4644
4816
  default:
4645
- return [(0, dom_1.html)('pre', {
4817
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4646
4818
  class: 'invalid',
4647
4819
  translate: 'no',
4648
4820
  ...(0, util_1.invalid)('example', 'type', 'Invalid example type')
4649
- }, `${opener}${body}${closer}`)];
4821
+ }, `${opener}${body}${closer}`))]);
4650
4822
  }
4651
4823
  })));
4652
4824
 
@@ -4679,7 +4851,9 @@ exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
4679
4851
  return parser({
4680
4852
  context
4681
4853
  }) ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
4682
- }, (0, combinator_1.union)([figure_1.figure]), false), ([el]) => el.tagName === 'FIGURE')));
4854
+ }, (0, combinator_1.union)([figure_1.figure]), false), ([{
4855
+ value: el
4856
+ }]) => el.tagName === 'FIGURE')));
4683
4857
  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)]);
4684
4858
 
4685
4859
  /***/ },
@@ -4694,17 +4868,20 @@ Object.defineProperty(exports, "__esModule", ({
4694
4868
  value: true
4695
4869
  }));
4696
4870
  exports.figbase = void 0;
4871
+ const parser_1 = __webpack_require__(605);
4697
4872
  const combinator_1 = __webpack_require__(3484);
4698
4873
  const label_1 = __webpack_require__(2178);
4699
4874
  const dom_1 = __webpack_require__(394);
4700
- 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]) => {
4875
+ 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]))), ([{
4876
+ value: el
4877
+ }]) => {
4701
4878
  const label = el.getAttribute('data-label');
4702
4879
  const group = label.split('-', 1)[0];
4703
- return [(0, dom_1.html)('figure', {
4880
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('figure', {
4704
4881
  'data-label': label,
4705
4882
  'data-group': group,
4706
4883
  hidden: ''
4707
- })];
4884
+ }))]);
4708
4885
  }));
4709
4886
 
4710
4887
  /***/ },
@@ -4740,19 +4917,21 @@ const dom_1 = __webpack_require__(394);
4740
4917
  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)([
4741
4918
  // All parsers which can include closing terms.
4742
4919
  (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, {})));
4743
- 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', {
4744
- class: 'figindex'
4745
- }), (0, dom_1.html)('span', {
4746
- class: 'figtext'
4747
- }, (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) => {
4748
- 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] ?? '', {
4749
- ...context
4750
- })) && ['label', 'Invalid label'] || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
4751
- return [(0, dom_1.html)('pre', {
4920
+ 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 => {
4921
+ const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
4922
+ 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', {
4923
+ class: 'figindex'
4924
+ }), (0, dom_1.html)('span', {
4925
+ class: 'figtext'
4926
+ }, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])]))]);
4927
+ })), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
4928
+ const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
4929
+ 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'];
4930
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4752
4931
  class: 'invalid',
4753
4932
  translate: 'no',
4754
4933
  ...(0, util_1.invalid)('figure', violation[0], violation[1])
4755
- }, `${opener}${body}${overflow || closer}`)];
4934
+ }, `${opener}${body}${overflow || closer}`))]);
4756
4935
  })));
4757
4936
  function attributes(label, param, content, caption) {
4758
4937
  const group = label.split('-', 1)[0];
@@ -4823,30 +5002,29 @@ const array_1 = __webpack_require__(6876);
4823
5002
  const dom_1 = __webpack_require__(394);
4824
5003
  exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)([^\n]*)(?:$|\n)/y, 300),
4825
5004
  // Bug: Type mismatch between outer and inner.
4826
- ([body, overflow, closer, opener, delim, type, param], context) => {
4827
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
5005
+ (nodes, context) => {
5006
+ const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
5007
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4828
5008
  class: 'invalid',
4829
5009
  translate: 'no',
4830
5010
  ...(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')
4831
- }, `${opener}${body}${overflow || closer}`)];
5011
+ }, `${opener}${body}${overflow || closer}`))]);
4832
5012
  switch (type) {
4833
5013
  case 'note':
4834
5014
  case 'caution':
4835
5015
  case 'warning':
4836
5016
  break;
4837
5017
  default:
4838
- return [(0, dom_1.html)('pre', {
5018
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4839
5019
  class: 'invalid',
4840
5020
  translate: 'no',
4841
5021
  ...(0, util_1.invalid)('message', 'type', 'Invalid message type')
4842
- }, `${opener}${body}${closer}`)];
5022
+ }, `${opener}${body}${closer}`))]);
4843
5023
  }
4844
- return [(0, dom_1.html)('section', {
5024
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('section', {
4845
5025
  class: `message`,
4846
5026
  'data-type': type
4847
- }, (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, {
4848
- ...context
4849
- })), [])), [])))];
5027
+ }, [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, util_1.unwrap)((0, parser_1.eval)(content((0, parser_1.subinput)(seg, context))))), [(0, dom_1.html)('h1', title(type))])))]);
4850
5028
  }));
4851
5029
  function title(type) {
4852
5030
  switch (type) {
@@ -4873,17 +5051,21 @@ Object.defineProperty(exports, "__esModule", ({
4873
5051
  value: true
4874
5052
  }));
4875
5053
  exports.placeholder = exports.segment_ = exports.segment = void 0;
5054
+ const parser_1 = __webpack_require__(605);
4876
5055
  const combinator_1 = __webpack_require__(3484);
4877
5056
  const util_1 = __webpack_require__(4992);
4878
5057
  const dom_1 = __webpack_require__(394);
4879
5058
  const opener = /(~{3,})(?!~)[^\n]*(?:$|\n)/y;
4880
5059
  exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300)));
4881
5060
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
4882
- 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', {
4883
- class: 'invalid',
4884
- translate: 'no',
4885
- ...(0, util_1.invalid)('extension', 'fence', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
4886
- }, `${opener}${body}${overflow || closer}`)]));
5061
+ exports.placeholder = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), nodes => {
5062
+ const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
5063
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5064
+ class: 'invalid',
5065
+ translate: 'no',
5066
+ ...(0, util_1.invalid)('extension', 'fence', !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument')
5067
+ }, `${opener}${body}${overflow || closer}`))]);
5068
+ }));
4887
5069
 
4888
5070
  /***/ },
4889
5071
 
@@ -4911,35 +5093,38 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
4911
5093
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000, false)), false);
4912
5094
  exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 10000),
4913
5095
  // Bug: Type mismatch between outer and inner.
4914
- ([body, overflow, closer, opener, delim, type, param], context) => {
4915
- if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
5096
+ (nodes, context) => {
5097
+ const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
5098
+ if (!closer || overflow || param.trimStart()) return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4916
5099
  class: 'invalid',
4917
5100
  translate: 'no',
4918
5101
  ...(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')
4919
- }, `${opener}${body}${overflow || closer}`)];
5102
+ }, `${opener}${body}${overflow || closer}`))]);
4920
5103
  switch (type) {
4921
5104
  case 'grid':
4922
5105
  case undefined:
4923
- return ((0, parser_1.eval)(parser((0, parser_1.input)(body, {
4924
- ...context
4925
- }))) ?? [(0, dom_1.html)('table')]).map(el => (0, dom_1.define)(el, {
5106
+ return ((0, parser_1.eval)(parser((0, parser_1.subinput)(body, context))) ?? new parser_1.List([new parser_1.Data((0, dom_1.html)('table'))])).foldl((acc, {
5107
+ value
5108
+ }) => acc.push(new parser_1.Data((0, dom_1.define)(value, {
4926
5109
  'data-type': type
4927
- }));
5110
+ }))) && acc, new parser_1.List());
4928
5111
  default:
4929
- return [(0, dom_1.html)('pre', {
5112
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4930
5113
  class: 'invalid',
4931
5114
  translate: 'no',
4932
5115
  ...(0, util_1.invalid)('table', 'argument', 'Invalid table type')
4933
- }, `${opener}${body}${closer}`)];
5116
+ }, `${opener}${body}${closer}`))]);
4934
5117
  }
4935
5118
  }));
4936
- 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))])));
4937
- 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)));
5119
+ 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)])))]))));
5120
+ 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)));
4938
5121
  const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/y;
4939
- 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(''))));
5122
+ const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([{
5123
+ value
5124
+ }]) => new parser_1.List([new parser_1.Data(value.split('/').map(s => s.split('')))])));
4940
5125
  const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y;
4941
- 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);
4942
- 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);
5126
+ 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);
5127
+ 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);
4943
5128
  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)])));
4944
5129
  function attributes(source) {
4945
5130
  let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
@@ -4972,9 +5157,12 @@ function format(rows) {
4972
5157
  let ranges = {};
4973
5158
  let verticalHighlightExtensions = 0n;
4974
5159
  let verticalHighlightLevels = [];
4975
- ROW: for (let i = 0; i < rows.length; ++i) {
5160
+ let cnt = 0;
5161
+ for (const list of rows) ROW: for (let i = cnt++; i < cnt; ++i) {
4976
5162
  // Copy to make them retryable.
4977
- const [[[...as], [...vs] = []], ...cells] = rows[i];
5163
+ const [{
5164
+ value: [[...as], [...vs] = []]
5165
+ }, ...cells] = list;
4978
5166
  let isBody = target === tfoot ? false : undefined;
4979
5167
  as.length === 0 && as.push('-');
4980
5168
  ALIGN_H: for (let j = 0, update = false; j < as.length || j < aligns.length; ++j) {
@@ -5037,7 +5225,7 @@ function format(rows) {
5037
5225
  for (let j = 0; j < cells.length; ++j) {
5038
5226
  const jn = BigInt(j);
5039
5227
  const isVirtual = !!ranges[i]?.[j];
5040
- const cell = isVirtual ? (0, array_1.splice)(cells, j, 0, undefined) && ranges[i][j] : cells[j];
5228
+ const cell = isVirtual ? (0, array_1.splice)(cells, j, 0, undefined) && ranges[i][j] : cells[j].value;
5041
5229
  const isHeadCell = cell.tagName === 'TH';
5042
5230
  heads |= isHeadCell ? 1n << jn : 0n;
5043
5231
  highlights |= cell.className === 'highlight' ? 1n << jn : 0n;
@@ -5111,7 +5299,7 @@ function format(rows) {
5111
5299
  const lHighlight = ~lHeadCellIndex && horizontalHighlights & 1n << lHeadCellIndex;
5112
5300
  const rHighlight = ~rHeadCellIndex && horizontalHighlights & 1n << rHeadCellIndex;
5113
5301
  for (let i = 0, m = 1n; i < cells.length; ++i, m <<= 1n) {
5114
- const cell = cells[i];
5302
+ const cell = cells[i]?.value;
5115
5303
  if (!cell) continue;
5116
5304
  if (heads & m) continue;
5117
5305
  switch (m) {
@@ -5150,6 +5338,7 @@ Object.defineProperty(exports, "__esModule", ({
5150
5338
  value: true
5151
5339
  }));
5152
5340
  exports.heading = exports.segment = void 0;
5341
+ const parser_1 = __webpack_require__(605);
5153
5342
  const combinator_1 = __webpack_require__(3484);
5154
5343
  const inline_1 = __webpack_require__(7973);
5155
5344
  const source_1 = __webpack_require__(8745);
@@ -5160,15 +5349,18 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, co
5160
5349
  context: {
5161
5350
  source
5162
5351
  }
5163
- }) => [[source]])))));
5352
+ }) => new parser_1.List([new parser_1.Data(source)]))))));
5164
5353
  exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
5165
5354
  // その他の表示制御は各所のCSSで行う。
5166
- (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}`, {
5167
- 'data-index': (0, inline_1.dataindex)(ns)
5168
- }, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
5169
- class: 'invalid',
5170
- ...(0, util_1.invalid)('heading', 'syntax', 'Heading level must be up to 6')
5171
- }, context.source.slice(context.position - context.range, context.position))]))))));
5355
+ (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) => {
5356
+ const [h, ...ns] = (0, util_1.unwrap)(nodes);
5357
+ return new parser_1.List([h.length <= 6 ? new parser_1.Data((0, dom_1.html)(`h${h.length}`, {
5358
+ 'data-index': (0, inline_1.dataindex)(nodes)
5359
+ }, (0, dom_1.defrag)(ns))) : new parser_1.Data((0, dom_1.html)(`h6`, {
5360
+ class: 'invalid',
5361
+ ...(0, util_1.invalid)('heading', 'syntax', 'Heading level must be up to 6')
5362
+ }, context.source.slice(context.position - context.range, context.position)))]);
5363
+ }))))));
5172
5364
 
5173
5365
  /***/ },
5174
5366
 
@@ -5182,6 +5374,7 @@ Object.defineProperty(exports, "__esModule", ({
5182
5374
  value: true
5183
5375
  }));
5184
5376
  exports.ilistitem = exports.ilist_ = exports.ilist = void 0;
5377
+ const parser_1 = __webpack_require__(605);
5185
5378
  const combinator_1 = __webpack_require__(3484);
5186
5379
  const ulist_1 = __webpack_require__(7595);
5187
5380
  const olist_1 = __webpack_require__(7697);
@@ -5191,22 +5384,22 @@ const visibility_1 = __webpack_require__(6364);
5191
5384
  const util_1 = __webpack_require__(4992);
5192
5385
  const dom_1 = __webpack_require__(394);
5193
5386
  exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/[-+*] /y, exports.ilist_)));
5194
- 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', {
5387
+ 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', {
5195
5388
  class: 'invalid',
5196
5389
  ...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
5197
- }, es)])));
5390
+ }, (0, util_1.unwrap)(ns)))]))));
5198
5391
  exports.ilistitem = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(({
5199
5392
  context: {
5200
5393
  source
5201
5394
  }
5202
- }) => [[source]])]), ({
5395
+ }) => new parser_1.List([new parser_1.Data(source)]))]), ({
5203
5396
  context: {
5204
5397
  source
5205
5398
  }
5206
- }) => [['', (0, dom_1.html)('span', {
5399
+ }) => new parser_1.List([new parser_1.Data(''), new parser_1.Data((0, dom_1.html)('span', {
5207
5400
  class: 'invalid',
5208
5401
  ...(0, util_1.invalid)('list', 'syntax', 'Fix the indent or the head of the list item')
5209
- }, source.replace('\n', ''))]]);
5402
+ }, source.replace('\n', '')))]));
5210
5403
 
5211
5404
  /***/ },
5212
5405
 
@@ -5220,6 +5413,7 @@ Object.defineProperty(exports, "__esModule", ({
5220
5413
  value: true
5221
5414
  }));
5222
5415
  exports.mathblock = exports.segment_ = exports.segment = void 0;
5416
+ const parser_1 = __webpack_require__(605);
5223
5417
  const combinator_1 = __webpack_require__(3484);
5224
5418
  const util_1 = __webpack_require__(4992);
5225
5419
  const dom_1 = __webpack_require__(394);
@@ -5228,18 +5422,21 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator
5228
5422
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
5229
5423
  exports.mathblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
5230
5424
  // Bug: Type mismatch between outer and inner.
5231
- ([body, overflow, closer, opener, delim, param], {
5425
+ (nodes, {
5232
5426
  caches: {
5233
5427
  math: cache = undefined
5234
5428
  } = {}
5235
- }) => [delim.length === 2 && closer && !overflow && param.trimStart() === '' ? cache?.get(`${delim}\n${body}${delim}`)?.cloneNode(true) || (0, dom_1.html)('div', {
5236
- class: 'math',
5237
- translate: 'no'
5238
- }, `${delim}\n${body}${delim}`) : (0, dom_1.html)('pre', {
5239
- class: 'invalid',
5240
- translate: 'no',
5241
- ...(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')
5242
- }, `${opener}${body}${overflow || closer}`)]));
5429
+ }) => {
5430
+ const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
5431
+ 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', {
5432
+ class: 'math',
5433
+ translate: 'no'
5434
+ }, `${delim}\n${body}${delim}`)) : new parser_1.Data((0, dom_1.html)('pre', {
5435
+ class: 'invalid',
5436
+ translate: 'no',
5437
+ ...(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')
5438
+ }, `${opener}${body}${overflow || closer}`))]);
5439
+ }));
5243
5440
 
5244
5441
  /***/ },
5245
5442
 
@@ -5253,6 +5450,7 @@ Object.defineProperty(exports, "__esModule", ({
5253
5450
  value: true
5254
5451
  }));
5255
5452
  exports.mediablock = void 0;
5453
+ const parser_1 = __webpack_require__(605);
5256
5454
  const combinator_1 = __webpack_require__(3484);
5257
5455
  const inline_1 = __webpack_require__(7973);
5258
5456
  const util_1 = __webpack_require__(4992);
@@ -5261,10 +5459,10 @@ exports.mediablock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinat
5261
5459
  context: {
5262
5460
  source
5263
5461
  }
5264
- }) => [[(0, dom_1.html)('span', {
5462
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5265
5463
  class: 'invalid',
5266
5464
  ...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
5267
- }, source.replace('\n', ''))]])))]), ns => [(0, dom_1.html)('div', ns)]));
5465
+ }, source.replace('\n', '')))]))))]), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('div', (0, util_1.unwrap)(ns)))])));
5268
5466
 
5269
5467
  /***/ },
5270
5468
 
@@ -5278,6 +5476,7 @@ Object.defineProperty(exports, "__esModule", ({
5278
5476
  value: true
5279
5477
  }));
5280
5478
  exports.olist_ = exports.olist = void 0;
5479
+ const parser_1 = __webpack_require__(605);
5281
5480
  const combinator_1 = __webpack_require__(3484);
5282
5481
  const ulist_1 = __webpack_require__(7595);
5283
5482
  const ilist_1 = __webpack_require__(4223);
@@ -5292,21 +5491,21 @@ const openers = {
5292
5491
  };
5293
5492
  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_)));
5294
5493
  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]), []))])));
5295
- 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', {
5494
+ 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', {
5296
5495
  'data-index': (0, inline_1.dataindex)(ns),
5297
- 'data-marker': ns.shift() || undefined
5298
- }, (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))]))]))), es => [format((0, dom_1.html)('ol', es), type, form)]);
5496
+ 'data-marker': ns.shift()?.value || undefined
5497
+ }, (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))]));
5299
5498
  const heads = {
5300
5499
  '.': (0, combinator_1.focus)(openers['.'], ({
5301
5500
  context: {
5302
5501
  source
5303
5502
  }
5304
- }) => [[source.trimEnd().split('.', 1)[0] + '.']]),
5503
+ }) => new parser_1.List([new parser_1.Data(source.trimEnd().split('.', 1)[0] + '.')])),
5305
5504
  '(': (0, combinator_1.focus)(openers['('], ({
5306
5505
  context: {
5307
5506
  source
5308
5507
  }
5309
- }) => [[source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')]])
5508
+ }) => new parser_1.List([new parser_1.Data(source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)'))]))
5310
5509
  };
5311
5510
  function idx(value) {
5312
5511
  switch (value) {
@@ -5408,9 +5607,10 @@ Object.defineProperty(exports, "__esModule", ({
5408
5607
  value: true
5409
5608
  }));
5410
5609
  exports.pagebreak = void 0;
5610
+ const parser_1 = __webpack_require__(605);
5411
5611
  const combinator_1 = __webpack_require__(3484);
5412
5612
  const dom_1 = __webpack_require__(394);
5413
- exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\n]*(?:$|\n)/y, () => [[(0, dom_1.html)('hr')]])));
5613
+ 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'))]))));
5414
5614
 
5415
5615
  /***/ },
5416
5616
 
@@ -5424,11 +5624,13 @@ Object.defineProperty(exports, "__esModule", ({
5424
5624
  value: true
5425
5625
  }));
5426
5626
  exports.paragraph = void 0;
5627
+ const parser_1 = __webpack_require__(605);
5427
5628
  const combinator_1 = __webpack_require__(3484);
5428
5629
  const inline_1 = __webpack_require__(7973);
5429
5630
  const visibility_1 = __webpack_require__(6364);
5631
+ const util_1 = __webpack_require__(4992);
5430
5632
  const dom_1 = __webpack_require__(394);
5431
- 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))]));
5633
+ 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))))])));
5432
5634
 
5433
5635
  /***/ },
5434
5636
 
@@ -5442,16 +5644,20 @@ Object.defineProperty(exports, "__esModule", ({
5442
5644
  value: true
5443
5645
  }));
5444
5646
  exports.reply = void 0;
5647
+ const parser_1 = __webpack_require__(605);
5445
5648
  const combinator_1 = __webpack_require__(3484);
5446
5649
  const cite_1 = __webpack_require__(1200);
5447
5650
  const quote_1 = __webpack_require__(4847);
5448
5651
  const inline_1 = __webpack_require__(7973);
5449
5652
  const source_1 = __webpack_require__(8745);
5450
- const util_1 = __webpack_require__(4992);
5451
5653
  const visibility_1 = __webpack_require__(6364);
5654
+ const util_1 = __webpack_require__(4992);
5452
5655
  const dom_1 = __webpack_require__(394);
5453
5656
  const delimiter = new RegExp(`${cite_1.syntax.source}|${quote_1.syntax.source}`, 'y');
5454
- 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, util_1.linearize)((0, combinator_1.some)(inline_1.inline), 1)))])), ns => [(0, dom_1.html)('p', (0, visibility_1.trimBlankNodeEnd)((0, dom_1.defrag)(ns)))])));
5657
+ 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, {
5658
+ source,
5659
+ position
5660
+ }) => 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)))))]))));
5455
5661
 
5456
5662
  /***/ },
5457
5663
 
@@ -5465,6 +5671,7 @@ Object.defineProperty(exports, "__esModule", ({
5465
5671
  value: true
5466
5672
  }));
5467
5673
  exports.cite = exports.syntax = void 0;
5674
+ const parser_1 = __webpack_require__(605);
5468
5675
  const combinator_1 = __webpack_require__(3484);
5469
5676
  const anchor_1 = __webpack_require__(8535);
5470
5677
  const source_1 = __webpack_require__(8745);
@@ -5478,28 +5685,32 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
5478
5685
  context: {
5479
5686
  source
5480
5687
  }
5481
- }) => [[(0, dom_1.html)('a', {
5688
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
5482
5689
  class: 'anchor'
5483
- }, source)]]), (0, combinator_1.focus)(/>>https?:\/\/\S+(?=\s*$)/y, ({
5690
+ }, source))])), (0, combinator_1.focus)(/>>https?:\/\/\S+(?=\s*$)/y, ({
5484
5691
  context: {
5485
5692
  source
5486
5693
  }
5487
- }) => [[(0, dom_1.html)('a', {
5694
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
5488
5695
  class: 'anchor',
5489
5696
  href: source.slice(2).trimEnd(),
5490
5697
  target: '_blank'
5491
- }, source)]]), (0, combinator_1.focus)(/>>.+(?=\s*$)/y, ({
5698
+ }, source))])), (0, combinator_1.focus)(/>>.+(?=\s*$)/y, ({
5492
5699
  context: {
5493
5700
  source
5494
5701
  }
5495
- }) => [[source]])])), ([quotes, node]) => [(0, dom_1.html)('span', typeof node === 'object' ? {
5496
- class: 'cite'
5497
- } : {
5498
- class: 'cite invalid',
5499
- ...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
5500
- }, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
5501
- 'data-depth': `${quotes.length + 1}`
5502
- }, node.innerText.slice(1)) : node.slice(1)])), (0, dom_1.html)('br')]));
5702
+ }) => new parser_1.List([new parser_1.Data(source)]))])), nodes => {
5703
+ const quotes = nodes.head.value;
5704
+ const node = nodes.last.value;
5705
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', typeof node === 'object' ? {
5706
+ class: 'cite'
5707
+ } : {
5708
+ class: 'cite invalid',
5709
+ ...(0, util_1.invalid)('cite', 'syntax', 'Invalid syntax')
5710
+ }, (0, dom_1.defrag)([`${quotes}>`, typeof node === 'object' ? (0, dom_1.define)(node, {
5711
+ 'data-depth': `${quotes.length + 1}`
5712
+ }, node.innerText.slice(1)) : node.slice(1)]))), new parser_1.Data((0, dom_1.html)('br'))]);
5713
+ }));
5503
5714
 
5504
5715
  /***/ },
5505
5716
 
@@ -5513,6 +5724,7 @@ Object.defineProperty(exports, "__esModule", ({
5513
5724
  value: true
5514
5725
  }));
5515
5726
  exports.quote = exports.syntax = void 0;
5727
+ const parser_1 = __webpack_require__(605);
5516
5728
  const combinator_1 = __webpack_require__(3484);
5517
5729
  const math_1 = __webpack_require__(2962);
5518
5730
  const autolink_1 = __webpack_require__(8072);
@@ -5520,11 +5732,16 @@ const source_1 = __webpack_require__(8745);
5520
5732
  const util_1 = __webpack_require__(4992);
5521
5733
  const dom_1 = __webpack_require__(394);
5522
5734
  exports.syntax = />+[^\S\n]/y;
5523
- 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, util_1.linearize)((0, combinator_1.convert)(source => source.replace(/(?<=^>+[^\S\n])/mg, '\r'), (0, combinator_1.some)((0, combinator_1.union)([
5735
+ 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)(
5736
+ // TODO: インデント数を渡してインデント数前の行頭確認を行う実装に置き換える
5737
+ source => source.replace(/(?<=^>+[^\S\n])/mg, '\r'), (0, combinator_1.some)((0, combinator_1.union)([
5524
5738
  // quote補助関数が残した数式をパースする。
5525
- math_1.math, autolink_1.autolink, source_1.linebreak, source_1.unescsource])), false), -1)), ns => [(0, dom_1.html)('span', {
5739
+ math_1.math, autolink_1.autolink, source_1.linebreak, source_1.unescsource])), false)), (ns, {
5740
+ source,
5741
+ position
5742
+ }) => 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', {
5526
5743
  class: 'quote'
5527
- }, (0, dom_1.defrag)(ns)), (0, dom_1.html)('br')]), false));
5744
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))].reverse())), false));
5528
5745
 
5529
5746
  /***/ },
5530
5747
 
@@ -5538,18 +5755,21 @@ Object.defineProperty(exports, "__esModule", ({
5538
5755
  value: true
5539
5756
  }));
5540
5757
  exports.sidefence = void 0;
5758
+ const parser_1 = __webpack_require__(605);
5541
5759
  const combinator_1 = __webpack_require__(3484);
5542
5760
  const autolink_1 = __webpack_require__(1671);
5543
5761
  const source_1 = __webpack_require__(8745);
5544
5762
  const util_1 = __webpack_require__(4992);
5545
5763
  const dom_1 = __webpack_require__(394);
5546
- 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, {
5764
+ 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])), ([{
5765
+ value
5766
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5547
5767
  class: 'invalid',
5548
5768
  ...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
5549
- })])));
5769
+ }))]))));
5550
5770
  const opener = /(?=\|\|+(?:$|\s))/y;
5551
5771
  const unindent = source => source.replace(/(?<=^|\n)\|(?:[^\S\n]|(?=\|*(?:$|\s)))|\n$/g, '');
5552
- 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)]));
5772
+ 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)))])));
5553
5773
 
5554
5774
  /***/ },
5555
5775
 
@@ -5563,6 +5783,7 @@ Object.defineProperty(exports, "__esModule", ({
5563
5783
  value: true
5564
5784
  }));
5565
5785
  exports.table = void 0;
5786
+ const parser_1 = __webpack_require__(605);
5566
5787
  const combinator_1 = __webpack_require__(3484);
5567
5788
  const inline_1 = __webpack_require__(7973);
5568
5789
  const source_1 = __webpack_require__(8745);
@@ -5571,31 +5792,33 @@ const util_1 = __webpack_require__(4992);
5571
5792
  const duff_1 = __webpack_require__(9202);
5572
5793
  const array_1 = __webpack_require__(6876);
5573
5794
  const dom_1 = __webpack_require__(394);
5574
- 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))])])));
5575
- 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, ({
5795
+ 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)))]))]))));
5796
+ 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, ({
5576
5797
  context: {
5577
5798
  source
5578
5799
  }
5579
- }) => [[(0, dom_1.html)('tr', {
5800
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('tr', {
5580
5801
  class: 'invalid',
5581
5802
  ...(0, util_1.invalid)('table-row', 'syntax', 'Missing the start symbol of the table row')
5582
- }, [(0, dom_1.html)('td', source.replace('\n', ''))])]]));
5803
+ }, [(0, dom_1.html)('td', source.replace('\n', ''))]))])));
5583
5804
  const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_1.union)([(0, combinator_1.focus)(/:-+:?/y, ({
5584
5805
  context: {
5585
5806
  source
5586
5807
  }
5587
- }) => [[source.at(-1) === ':' ? 'center' : 'start']]), (0, combinator_1.focus)(/-+:?/y, ({
5808
+ }) => new parser_1.List([new parser_1.Data(source.at(-1) === ':' ? 'center' : 'start')])), (0, combinator_1.focus)(/-+:?/y, ({
5588
5809
  context: {
5589
5810
  source
5590
5811
  }
5591
- }) => [[source.at(-1) === ':' ? 'end' : '']])])), ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
5812
+ }) => 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))))]));
5592
5813
  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);
5593
- const head = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, dom_1.defrag)(ns))]);
5594
- const data = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
5814
+ 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))))]));
5815
+ 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))))]));
5595
5816
  function format(rows) {
5596
- const aligns = rows[0].className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
5597
- for (let i = 0; i < rows.length; ++i) {
5598
- for (let cols = rows[i].children, len = cols.length, j = 0; j < len; ++j) {
5817
+ const aligns = rows.head.value.className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().value.children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
5818
+ for (const {
5819
+ value: row
5820
+ } of rows) {
5821
+ for (let cols = row.children, len = cols.length, j = 0; j < len; ++j) {
5599
5822
  if (j > 0 && !aligns[j]) {
5600
5823
  aligns[j] = aligns[j - 1];
5601
5824
  }
@@ -5618,26 +5841,34 @@ Object.defineProperty(exports, "__esModule", ({
5618
5841
  value: true
5619
5842
  }));
5620
5843
  exports.fillFirstLine = exports.checkbox = exports.ulist_ = exports.ulist = void 0;
5844
+ const parser_1 = __webpack_require__(605);
5621
5845
  const combinator_1 = __webpack_require__(3484);
5622
5846
  const olist_1 = __webpack_require__(7697);
5623
5847
  const ilist_1 = __webpack_require__(4223);
5624
5848
  const inline_1 = __webpack_require__(7973);
5625
5849
  const visibility_1 = __webpack_require__(6364);
5626
- const array_1 = __webpack_require__(6876);
5850
+ const util_1 = __webpack_require__(4992);
5627
5851
  const dom_1 = __webpack_require__(394);
5628
5852
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/- /y, exports.ulist_)));
5629
- 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', {
5853
+ 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', {
5630
5854
  'data-index': (0, inline_1.dataindex)(ns)
5631
- }, (0, dom_1.defrag)(fillFirstLine(ns)))]))])))), es => [format((0, dom_1.html)('ul', es))])));
5855
+ }, (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))))]))));
5632
5856
  exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
5633
5857
  context: {
5634
5858
  source
5635
5859
  }
5636
- }) => [[(0, dom_1.html)('span', {
5860
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5637
5861
  class: 'checkbox'
5638
- }, source[1].trimStart() ? '☑' : '☐')]]);
5639
- function fillFirstLine(ns) {
5640
- 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;
5862
+ }, source[1].trimStart() ? '☑' : '☐'))]));
5863
+ function fillFirstLine(nodes) {
5864
+ const node = nodes.head?.value;
5865
+ if (typeof node !== 'object') return nodes;
5866
+ switch (node.tagName) {
5867
+ case 'UL':
5868
+ case 'OL':
5869
+ nodes.unshift(new parser_1.Data((0, dom_1.html)('br')));
5870
+ }
5871
+ return nodes;
5641
5872
  }
5642
5873
  exports.fillFirstLine = fillFirstLine;
5643
5874
  function format(list) {
@@ -5659,13 +5890,14 @@ Object.defineProperty(exports, "__esModule", ({
5659
5890
  value: true
5660
5891
  }));
5661
5892
  exports.header = void 0;
5893
+ const parser_1 = __webpack_require__(605);
5662
5894
  const combinator_1 = __webpack_require__(3484);
5663
5895
  const segment_1 = __webpack_require__(3967);
5664
5896
  const source_1 = __webpack_require__(8745);
5665
5897
  const util_1 = __webpack_require__(4992);
5666
5898
  const normalize_1 = __webpack_require__(4490);
5667
5899
  const dom_1 = __webpack_require__(394);
5668
- exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\v\f\r\n]*\r?\n[^\S\n]*(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.rewrite)(({
5900
+ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\v\f\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.rewrite)(({
5669
5901
  context
5670
5902
  }) => {
5671
5903
  const {
@@ -5676,14 +5908,14 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
5676
5908
  } else {
5677
5909
  context.position = source.length;
5678
5910
  }
5679
- return [[]];
5911
+ return new parser_1.List();
5680
5912
  }, (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
5681
5913
  context
5682
- }) => 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}---[^\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', {
5914
+ }) => 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', {
5683
5915
  class: 'header'
5684
5916
  }, [(0, dom_1.html)('details', {
5685
5917
  open: ''
5686
- }, (0, dom_1.defrag)([(0, dom_1.html)('summary', 'Header'), ...es]))])]), false))), ({
5918
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Data((0, dom_1.html)('summary', 'Header'))) && ns)))]))])), false))), ({
5687
5919
  context
5688
5920
  }) => {
5689
5921
  const {
@@ -5691,11 +5923,11 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
5691
5923
  position
5692
5924
  } = context;
5693
5925
  context.position += source.length;
5694
- return [[(0, dom_1.html)('pre', {
5926
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
5695
5927
  class: 'invalid',
5696
5928
  translate: 'no',
5697
5929
  ...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
5698
- }, (0, normalize_1.normalize)(source.slice(position)))]];
5930
+ }, (0, normalize_1.normalize)(source.slice(position))))]);
5699
5931
  }]))), (0, combinator_1.clear)((0, source_1.str)(/[^\S\v\f\r\n]*\r?\n/y))])));
5700
5932
  const field = (0, combinator_1.line)(({
5701
5933
  context: {
@@ -5705,7 +5937,7 @@ const field = (0, combinator_1.line)(({
5705
5937
  }) => {
5706
5938
  const name = source.slice(position, source.indexOf(':', position));
5707
5939
  const value = source.slice(position + name.length + 1).trim();
5708
- return [[(0, dom_1.html)('span', {
5940
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5709
5941
  class: 'field',
5710
5942
  'data-name': name.toLowerCase(),
5711
5943
  'data-value': value
@@ -5713,7 +5945,7 @@ const field = (0, combinator_1.line)(({
5713
5945
  class: 'field-name'
5714
5946
  }, name), ': ', (0, dom_1.html)('span', {
5715
5947
  class: 'field-value'
5716
- }, value), '\n'])]];
5948
+ }, value), '\n']))]);
5717
5949
  });
5718
5950
 
5719
5951
  /***/ },
@@ -5871,13 +6103,15 @@ Object.defineProperty(exports, "__esModule", ({
5871
6103
  value: true
5872
6104
  }));
5873
6105
  exports.annotation = void 0;
6106
+ const parser_1 = __webpack_require__(605);
5874
6107
  const combinator_1 = __webpack_require__(3484);
5875
6108
  const inline_1 = __webpack_require__(7973);
5876
6109
  const visibility_1 = __webpack_require__(6364);
6110
+ const util_1 = __webpack_require__(4992);
5877
6111
  const dom_1 = __webpack_require__(394);
5878
- 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', {
6112
+ 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', {
5879
6113
  class: 'annotation'
5880
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])]] : undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */])));
6114
+ }, [(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 */])));
5881
6115
 
5882
6116
  /***/ },
5883
6117
 
@@ -5920,18 +6154,21 @@ Object.defineProperty(exports, "__esModule", ({
5920
6154
  value: true
5921
6155
  }));
5922
6156
  exports.account = void 0;
6157
+ const parser_1 = __webpack_require__(605);
5923
6158
  const combinator_1 = __webpack_require__(3484);
5924
6159
  const link_1 = __webpack_require__(3628);
5925
6160
  const source_1 = __webpack_require__(8745);
5926
6161
  const dom_1 = __webpack_require__(394);
5927
6162
  // https://example/@user must be a user page or a redirect page going there.
5928
- 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, {
6163
+ 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), ([{
6164
+ value
6165
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5929
6166
  class: 'account'
5930
- })]))), ({
6167
+ }))])))), ({
5931
6168
  context: {
5932
6169
  source
5933
6170
  }
5934
- }) => [[source]]])));
6171
+ }) => new parser_1.List([new parser_1.Data(source)])])));
5935
6172
 
5936
6173
  /***/ },
5937
6174
 
@@ -5945,6 +6182,7 @@ Object.defineProperty(exports, "__esModule", ({
5945
6182
  value: true
5946
6183
  }));
5947
6184
  exports.anchor = void 0;
6185
+ const parser_1 = __webpack_require__(605);
5948
6186
  const combinator_1 = __webpack_require__(3484);
5949
6187
  const link_1 = __webpack_require__(3628);
5950
6188
  const source_1 = __webpack_require__(8745);
@@ -5956,13 +6194,15 @@ const dom_1 = __webpack_require__(394);
5956
6194
  // cid: YYYY-MMDD-HHMM-SSmmm
5957
6195
  // 内部表現はUnixTimeに統一する(時系列順)
5958
6196
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
5959
- 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, {
6197
+ 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), ([{
6198
+ value
6199
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5960
6200
  class: 'anchor'
5961
- })]))), ({
6201
+ }))])))), ({
5962
6202
  context: {
5963
6203
  source
5964
6204
  }
5965
- }) => [[source]]])));
6205
+ }) => new parser_1.List([new parser_1.Data(source)])])));
5966
6206
 
5967
6207
  /***/ },
5968
6208
 
@@ -5976,28 +6216,33 @@ Object.defineProperty(exports, "__esModule", ({
5976
6216
  value: true
5977
6217
  }));
5978
6218
  exports.channel = void 0;
6219
+ const parser_1 = __webpack_require__(605);
5979
6220
  const combinator_1 = __webpack_require__(3484);
5980
6221
  const link_1 = __webpack_require__(3628);
5981
6222
  const hashtag_1 = __webpack_require__(5764);
5982
6223
  const source_1 = __webpack_require__(8745);
5983
6224
  const dom_1 = __webpack_require__(394);
5984
6225
  // https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
5985
- 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], {
6226
+ 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')), ([{
6227
+ value
6228
+ }]) => !/^[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), ([{
6229
+ value: el
6230
+ }], {
5986
6231
  source,
5987
6232
  position,
5988
6233
  range = 0
5989
6234
  }) => {
5990
6235
  const src = source.slice(position - range, position);
5991
6236
  const url = `${el.getAttribute('href')}?ch=${src.slice(src.indexOf('#') + 1).replace(/#/g, '+')}`;
5992
- return [(0, dom_1.define)(el, {
6237
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)(el, {
5993
6238
  class: 'channel',
5994
6239
  href: url
5995
- }, src)];
6240
+ }, src))]);
5996
6241
  }))), ({
5997
6242
  context: {
5998
6243
  source
5999
6244
  }
6000
- }) => [[source]]])));
6245
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6001
6246
 
6002
6247
  /***/ },
6003
6248
 
@@ -6011,22 +6256,25 @@ Object.defineProperty(exports, "__esModule", ({
6011
6256
  value: true
6012
6257
  }));
6013
6258
  exports.email = void 0;
6259
+ const parser_1 = __webpack_require__(605);
6014
6260
  const combinator_1 = __webpack_require__(3484);
6015
6261
  const source_1 = __webpack_require__(8745);
6016
6262
  const dom_1 = __webpack_require__(394);
6017
6263
  // https://html.spec.whatwg.org/multipage/input.html
6018
- 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 */, ({
6264
+ 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), ([{
6265
+ value
6266
+ }]) => 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 */, ({
6019
6267
  context: {
6020
6268
  source
6021
6269
  }
6022
- }) => [[(0, dom_1.html)('a', {
6270
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6023
6271
  class: 'email',
6024
6272
  href: `mailto:${source}`
6025
- }, source)]])), ({
6273
+ }, source))]))), ({
6026
6274
  context: {
6027
6275
  source
6028
6276
  }
6029
- }) => [[source]]]));
6277
+ }) => new parser_1.List([new parser_1.Data(source)])]));
6030
6278
 
6031
6279
  /***/ },
6032
6280
 
@@ -6040,19 +6288,22 @@ Object.defineProperty(exports, "__esModule", ({
6040
6288
  value: true
6041
6289
  }));
6042
6290
  exports.hashnum = void 0;
6291
+ const parser_1 = __webpack_require__(605);
6043
6292
  const combinator_1 = __webpack_require__(3484);
6044
6293
  const link_1 = __webpack_require__(3628);
6045
6294
  const hashtag_1 = __webpack_require__(5764);
6046
6295
  const source_1 = __webpack_require__(8745);
6047
6296
  const dom_1 = __webpack_require__(394);
6048
- 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, {
6297
+ 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), ([{
6298
+ value
6299
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6049
6300
  class: 'hashnum',
6050
6301
  href: null
6051
- })]))), ({
6302
+ }))])))), ({
6052
6303
  context: {
6053
6304
  source
6054
6305
  }
6055
- }) => [[source]]])));
6306
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6056
6307
 
6057
6308
  /***/ },
6058
6309
 
@@ -6066,6 +6317,7 @@ Object.defineProperty(exports, "__esModule", ({
6066
6317
  value: true
6067
6318
  }));
6068
6319
  exports.hashtag = exports.emoji = void 0;
6320
+ const parser_1 = __webpack_require__(605);
6069
6321
  const combinator_1 = __webpack_require__(3484);
6070
6322
  const link_1 = __webpack_require__(3628);
6071
6323
  const source_1 = __webpack_require__(8745);
@@ -6073,13 +6325,17 @@ const dom_1 = __webpack_require__(394);
6073
6325
  // https://example/hashtags/a must be a hashtag page or a redirect page going there.
6074
6326
  // https://github.com/tc39/proposal-regexp-unicode-property-escapes#matching-emoji
6075
6327
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
6076
- 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, {
6328
+ 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')), ([{
6329
+ value
6330
+ }]) => !/^[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), ([{
6331
+ value
6332
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6077
6333
  class: 'hashtag'
6078
- })]))), ({
6334
+ }))])))), ({
6079
6335
  context: {
6080
6336
  source
6081
6337
  }
6082
- }) => [[source]]])));
6338
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6083
6339
 
6084
6340
  /***/ },
6085
6341
 
@@ -6093,6 +6349,7 @@ Object.defineProperty(exports, "__esModule", ({
6093
6349
  value: true
6094
6350
  }));
6095
6351
  exports.lineurl = exports.url = void 0;
6352
+ const parser_1 = __webpack_require__(605);
6096
6353
  const combinator_1 = __webpack_require__(3484);
6097
6354
  const link_1 = __webpack_require__(3628);
6098
6355
  const source_1 = __webpack_require__(8745);
@@ -6100,13 +6357,13 @@ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combina
6100
6357
  context: {
6101
6358
  source
6102
6359
  }
6103
- }) => [[source]]])));
6360
+ }) => new parser_1.List([new parser_1.Data(source)])])));
6104
6361
  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))), ({
6105
6362
  context: {
6106
6363
  source
6107
6364
  }
6108
- }) => [[source]]])])));
6109
- 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 */])]));
6365
+ }) => new parser_1.List([new parser_1.Data(source)])])])));
6366
+ 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 */])]));
6110
6367
 
6111
6368
  /***/ },
6112
6369
 
@@ -6120,11 +6377,12 @@ Object.defineProperty(exports, "__esModule", ({
6120
6377
  value: true
6121
6378
  }));
6122
6379
  exports.bracket = void 0;
6380
+ const parser_1 = __webpack_require__(605);
6123
6381
  const combinator_1 = __webpack_require__(3484);
6124
6382
  const inline_1 = __webpack_require__(7973);
6125
6383
  const link_1 = __webpack_require__(3628);
6126
6384
  const source_1 = __webpack_require__(8745);
6127
- const array_1 = __webpack_require__(6876);
6385
+ const util_1 = __webpack_require__(4992);
6128
6386
  const dom_1 = __webpack_require__(394);
6129
6387
  const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
6130
6388
  const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
@@ -6152,27 +6410,27 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6152
6410
  return d1(input);
6153
6411
  }
6154
6412
  }]));
6155
- 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], {
6413
+ 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], {
6156
6414
  source,
6157
6415
  position,
6158
6416
  range = 0
6159
6417
  }) => {
6160
6418
  const str = source.slice(position - range + 1, position - 1);
6161
- return indexA.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
6419
+ 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', {
6162
6420
  class: 'paren'
6163
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
6164
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6421
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6422
+ }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6165
6423
  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], {
6166
6424
  source,
6167
6425
  position,
6168
6426
  range = 0
6169
6427
  }) => {
6170
6428
  const str = source.slice(position - range + 1, position - 1);
6171
- return indexF.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
6429
+ 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', {
6172
6430
  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 */]));
6175
- 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) => {
6431
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6432
+ }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6433
+ 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) => {
6176
6434
  if (context.state & 8 /* State.link */) {
6177
6435
  const {
6178
6436
  source,
@@ -6195,14 +6453,14 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6195
6453
  context.range = range;
6196
6454
  }
6197
6455
  }
6198
- return [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)];
6199
- }, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
6200
- 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 */]));
6201
- 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 */]));
6202
- 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 */]));
6456
+ return as.import(bs).import(cs);
6457
+ }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6458
+ 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 */]));
6459
+ 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 */]));
6460
+ 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 */]));
6203
6461
  const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6204
6462
  // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
6205
- (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 */]));
6463
+ (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 */]));
6206
6464
 
6207
6465
  /***/ },
6208
6466
 
@@ -6216,15 +6474,16 @@ Object.defineProperty(exports, "__esModule", ({
6216
6474
  value: true
6217
6475
  }));
6218
6476
  exports.code = void 0;
6477
+ const parser_1 = __webpack_require__(605);
6219
6478
  const combinator_1 = __webpack_require__(3484);
6220
6479
  const util_1 = __webpack_require__(4992);
6221
6480
  const dom_1 = __webpack_require__(394);
6222
- 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', {
6481
+ 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', {
6223
6482
  'data-src': whole
6224
- }, format(body))]] : body ? [[(0, dom_1.html)('code', {
6483
+ }, format(body)))]) : body ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
6225
6484
  class: 'invalid',
6226
6485
  ...(0, util_1.invalid)('code', 'syntax', `Missing the closing symbol "${opener}"`)
6227
- }, whole)]] : [[opener]], true), false, [3 | 64 /* Backtrack.bracket */]);
6486
+ }, whole))]) : new parser_1.List([new parser_1.Data(opener)]), true), false, [3 | 64 /* Backtrack.bracket */]);
6228
6487
  function format(text) {
6229
6488
  return text.length > 2 && text[0] === ' ' && text[1] === '`' && text.at(-1) === ' ' ? text.slice(1, -1) : text;
6230
6489
  }
@@ -6241,17 +6500,17 @@ Object.defineProperty(exports, "__esModule", ({
6241
6500
  value: true
6242
6501
  }));
6243
6502
  exports.deletion = void 0;
6503
+ const parser_1 = __webpack_require__(605);
6244
6504
  const combinator_1 = __webpack_require__(3484);
6245
6505
  const inline_1 = __webpack_require__(7973);
6246
6506
  const visibility_1 = __webpack_require__(6364);
6247
6507
  const util_1 = __webpack_require__(4992);
6248
- const array_1 = __webpack_require__(6876);
6249
6508
  const dom_1 = __webpack_require__(394);
6250
6509
  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], {
6251
6510
  buffer
6252
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
6511
+ }) => buffer.import(bs), ([, bs], {
6253
6512
  buffer
6254
- }) => 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))]))));
6513
+ }) => 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))))])))));
6255
6514
 
6256
6515
  /***/ },
6257
6516
 
@@ -6265,14 +6524,15 @@ Object.defineProperty(exports, "__esModule", ({
6265
6524
  value: true
6266
6525
  }));
6267
6526
  exports.emphasis = void 0;
6527
+ const parser_1 = __webpack_require__(605);
6268
6528
  const combinator_1 = __webpack_require__(3484);
6269
6529
  const inline_1 = __webpack_require__(7973);
6270
6530
  const strong_1 = __webpack_require__(6591);
6271
6531
  const source_1 = __webpack_require__(8745);
6272
6532
  const visibility_1 = __webpack_require__(6364);
6273
- const array_1 = __webpack_require__(6876);
6533
+ const util_1 = __webpack_require__(4992);
6274
6534
  const dom_1 = __webpack_require__(394);
6275
- 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)]));
6535
+ 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)));
6276
6536
 
6277
6537
  /***/ },
6278
6538
 
@@ -6286,6 +6546,7 @@ Object.defineProperty(exports, "__esModule", ({
6286
6546
  value: true
6287
6547
  }));
6288
6548
  exports.emstrong = void 0;
6549
+ const parser_1 = __webpack_require__(605);
6289
6550
  const combinator_1 = __webpack_require__(3484);
6290
6551
  const inline_1 = __webpack_require__(7973);
6291
6552
  const strong_1 = __webpack_require__(6591);
@@ -6293,7 +6554,6 @@ const emphasis_1 = __webpack_require__(1354);
6293
6554
  const source_1 = __webpack_require__(8745);
6294
6555
  const visibility_1 = __webpack_require__(6364);
6295
6556
  const util_1 = __webpack_require__(4992);
6296
- const array_1 = __webpack_require__(6876);
6297
6557
  const dom_1 = __webpack_require__(394);
6298
6558
  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)])));
6299
6559
  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)])));
@@ -6302,11 +6562,11 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
6302
6562
  // このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
6303
6563
  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) => {
6304
6564
  const {
6305
- buffer
6565
+ buffer = new parser_1.List()
6306
6566
  } = context;
6307
- switch (cs[0]) {
6567
+ switch (cs.head.value) {
6308
6568
  case '***':
6309
- return [bs];
6569
+ return bs;
6310
6570
  case '**':
6311
6571
  return (0, combinator_1.bind)(subemphasis, ds => {
6312
6572
  const {
@@ -6314,13 +6574,18 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***'
6314
6574
  } = context;
6315
6575
  if (source.startsWith('*', context.position)) {
6316
6576
  context.position += 1;
6317
- 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 */]];
6577
+ buffer.push(new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6578
+ buffer.import(ds);
6579
+ 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 */)]);
6318
6580
  } else {
6319
- 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 */]))];
6581
+ buffer.push(new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6582
+ buffer.import(ds);
6583
+ buffer.push(new parser_1.Data("\u001F" /* Command.Separator */));
6584
+ return prepend('*', buffer);
6320
6585
  }
6321
6586
  })({
6322
6587
  context
6323
- }) ?? [prepend('*', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))]), ["\u001F" /* Command.Separator */]))];
6588
+ }) ?? 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 */)])));
6324
6589
  case '*':
6325
6590
  return (0, combinator_1.bind)(substrong, ds => {
6326
6591
  const {
@@ -6328,29 +6593,34 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***'
6328
6593
  } = context;
6329
6594
  if (source.startsWith('**', context.position)) {
6330
6595
  context.position += 2;
6331
- 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 */]];
6596
+ buffer.push(new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6597
+ buffer.import(ds);
6598
+ 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 */)]);
6332
6599
  } else {
6333
- 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 */]))];
6600
+ buffer.push(new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs)))));
6601
+ buffer.import(ds);
6602
+ buffer.push(new parser_1.Data("\u001F" /* Command.Separator */));
6603
+ return prepend('**', buffer);
6334
6604
  }
6335
6605
  })({
6336
6606
  context
6337
- }) ?? [prepend('**', (0, array_1.push)((0, array_1.push)(buffer, [(0, dom_1.html)('em', (0, dom_1.defrag)(bs))]), ["\u001F" /* Command.Separator */]))];
6607
+ }) ?? 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 */)])));
6338
6608
  }
6339
6609
  }, ([, bs], {
6340
6610
  buffer
6341
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]),
6611
+ }) => bs && buffer.import(bs) && buffer.push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer),
6342
6612
  // 3以上の`*`に対してemの適用を保証する
6343
- nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nodes))])], (nodes, context, prefix, postfix, state) => {
6613
+ 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) => {
6344
6614
  context.position += postfix;
6345
6615
  if (state) {
6346
6616
  switch (postfix) {
6347
6617
  case 0:
6348
6618
  break;
6349
6619
  case 1:
6350
- nodes = [(0, dom_1.html)('em', (0, dom_1.defrag)(nodes))];
6620
+ nodes = new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6351
6621
  break;
6352
6622
  case 2:
6353
- nodes = [(0, dom_1.html)('strong', (0, dom_1.defrag)(nodes))];
6623
+ nodes = new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6354
6624
  break;
6355
6625
  default:
6356
6626
  }
@@ -6360,49 +6630,49 @@ nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nod
6360
6630
  case 0:
6361
6631
  break;
6362
6632
  case 1:
6363
- nodes = (0, combinator_1.bind)(subemphasis, ds => {
6633
+ nodes = (0, parser_1.eval)((0, combinator_1.bind)(subemphasis, ds => {
6364
6634
  const {
6365
6635
  source
6366
6636
  } = context;
6367
6637
  if (source.startsWith('*', context.position)) {
6368
6638
  context.position += 1;
6369
- return [[(0, dom_1.html)('em', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))]];
6639
+ 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)))))]);
6370
6640
  } else {
6371
- return [prepend('*', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))];
6641
+ return prepend('*', nodes.import(ds));
6372
6642
  }
6373
6643
  })({
6374
6644
  context
6375
- })?.[0] ?? prepend('*', nodes);
6645
+ })) ?? prepend('*', nodes);
6376
6646
  prefix -= 1;
6377
6647
  break;
6378
6648
  case 2:
6379
- nodes = (0, combinator_1.bind)(substrong, ds => {
6649
+ nodes = (0, parser_1.eval)((0, combinator_1.bind)(substrong, ds => {
6380
6650
  const {
6381
6651
  source
6382
6652
  } = context;
6383
6653
  if (source.startsWith('**', context.position)) {
6384
6654
  context.position += 2;
6385
- return [[(0, dom_1.html)('strong', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))]];
6655
+ 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)))))]);
6386
6656
  } else {
6387
- return [prepend('**', (0, array_1.push)(nodes, (0, dom_1.defrag)(ds)))];
6657
+ return prepend('**', nodes.import(ds));
6388
6658
  }
6389
6659
  })({
6390
6660
  context
6391
- })?.[0] ?? prepend('**', nodes);
6661
+ })) ?? prepend('**', nodes);
6392
6662
  prefix -= 2;
6393
6663
  break;
6394
6664
  }
6395
6665
  }
6396
6666
  if (prefix > postfix) {
6397
- nodes = (0, array_1.push)(['*'.repeat(prefix - postfix)], nodes);
6667
+ nodes = prepend('*'.repeat(prefix - postfix), nodes);
6398
6668
  }
6399
- return [nodes];
6669
+ return nodes;
6400
6670
  }))));
6401
6671
  function prepend(prefix, nodes) {
6402
- if (typeof nodes[0] === 'string') {
6403
- nodes[0] = prefix + nodes[0];
6672
+ if (typeof nodes.head?.value === 'string') {
6673
+ nodes.head.value = prefix + nodes.head.value;
6404
6674
  } else {
6405
- (0, array_1.unshift)([prefix], nodes);
6675
+ nodes.unshift(new parser_1.Data(prefix));
6406
6676
  }
6407
6677
  return nodes;
6408
6678
  }
@@ -6437,45 +6707,50 @@ Object.defineProperty(exports, "__esModule", ({
6437
6707
  value: true
6438
6708
  }));
6439
6709
  exports.dataindex = exports.signature = exports.index = void 0;
6710
+ const parser_1 = __webpack_require__(605);
6440
6711
  const combinator_1 = __webpack_require__(3484);
6441
6712
  const inline_1 = __webpack_require__(7973);
6442
6713
  const indexee_1 = __webpack_require__(7610);
6443
6714
  const htmlentity_1 = __webpack_require__(470);
6444
6715
  const source_1 = __webpack_require__(8745);
6445
6716
  const visibility_1 = __webpack_require__(6364);
6446
- const array_1 = __webpack_require__(6876);
6717
+ const util_1 = __webpack_require__(4992);
6447
6718
  const dom_1 = __webpack_require__(394);
6448
- 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', {
6719
+ 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', {
6449
6720
  'data-index': dataindex(bs)
6450
- }, (0, dom_1.defrag)(bs))]] : undefined, undefined, [3 | 64 /* Backtrack.bracket */])), ns => {
6721
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined, [3 | 64 /* Backtrack.bracket */])), ns => {
6451
6722
  if (ns.length === 1) {
6452
- const el = ns[0];
6453
- return [(0, dom_1.define)(el, {
6723
+ const el = ns.head.value;
6724
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)(el, {
6454
6725
  id: el.id ? null : undefined,
6455
6726
  class: 'index',
6456
6727
  href: el.id ? `#${el.id}` : undefined
6457
- })];
6728
+ }))]);
6458
6729
  } else {
6459
6730
  ns.pop();
6460
6731
  return ns;
6461
6732
  }
6462
6733
  })));
6463
6734
  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) => {
6464
- const index = (0, indexee_1.identity)('index', undefined, ns.join(''))?.slice(7);
6465
- return index && context.linebreak === 0 ? [[(0, dom_1.html)('span', {
6735
+ const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
6736
+ value
6737
+ }) => acc + value, ''))?.slice(7);
6738
+ return index && context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6466
6739
  class: 'indexer',
6467
6740
  'data-index': index
6468
- })]] : undefined;
6469
- }, ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 64 /* Backtrack.bracket */])));
6470
- function dataindex(ns) {
6471
- if (ns.length === 0) return;
6472
- for (let i = ns.length; i--;) {
6473
- const node = ns[i];
6474
- if (typeof node === 'string') return;
6475
- if (i === ns.length - 1 && ['UL', 'OL'].includes(node.tagName)) continue;
6476
- if (!node.classList.contains('indexer')) return;
6477
- return node.getAttribute('data-index') ?? undefined;
6741
+ }))]) : undefined;
6742
+ }, ([as, bs]) => bs && as.import(bs), [3 | 64 /* Backtrack.bracket */])));
6743
+ function dataindex(nodes) {
6744
+ let node = nodes.last;
6745
+ if (typeof node?.value !== 'object') return;
6746
+ switch (node.value.tagName) {
6747
+ case 'UL':
6748
+ case 'OL':
6749
+ node = node.prev;
6750
+ if (typeof node?.value !== 'object') return;
6478
6751
  }
6752
+ if (!node.value.classList.contains('indexer')) return;
6753
+ return node.value.getAttribute('data-index') ?? undefined;
6479
6754
  }
6480
6755
  exports.dataindex = dataindex;
6481
6756
 
@@ -6491,15 +6766,16 @@ Object.defineProperty(exports, "__esModule", ({
6491
6766
  value: true
6492
6767
  }));
6493
6768
  exports.text = exports.signature = exports.identity = exports.indexee = void 0;
6769
+ const parser_1 = __webpack_require__(605);
6494
6770
  const combinator_1 = __webpack_require__(3484);
6495
6771
  const dom_1 = __webpack_require__(394);
6496
6772
  function indexee(parser) {
6497
6773
  return (0, combinator_1.fmap)(parser, (ns, {
6498
6774
  id
6499
- }) => ns.length === 1 ? [(0, dom_1.define)(ns[0], {
6500
- id: identity('index', id, ns[0]),
6775
+ }) => ns.length === 1 ? new parser_1.List([new parser_1.Data((0, dom_1.define)(ns.head.value, {
6776
+ id: identity('index', id, ns.head.value),
6501
6777
  'data-index': null
6502
- })] : ns);
6778
+ }))]) : ns);
6503
6779
  }
6504
6780
  exports.indexee = indexee;
6505
6781
  const MAX = 60;
@@ -6628,6 +6904,7 @@ Object.defineProperty(exports, "__esModule", ({
6628
6904
  value: true
6629
6905
  }));
6630
6906
  exports.indexer = void 0;
6907
+ const parser_1 = __webpack_require__(605);
6631
6908
  const combinator_1 = __webpack_require__(3484);
6632
6909
  const index_1 = __webpack_require__(4688);
6633
6910
  const dom_1 = __webpack_require__(394);
@@ -6636,10 +6913,10 @@ const dom_1 = __webpack_require__(394);
6636
6913
  // 複合生成インデクスを手動で同期させるより最初から重複のない
6637
6914
  // テキストまたはインデクスを付けて同期が必要な機会を減らすのが
6638
6915
  // 継続的編集において最も簡便となる。
6639
- 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', {
6916
+ 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', {
6640
6917
  class: 'indexer',
6641
6918
  'data-index': ''
6642
- })]])]), /\]\s*$/y);
6919
+ }))]))]), /\]\s*$/y);
6643
6920
 
6644
6921
  /***/ },
6645
6922
 
@@ -6653,15 +6930,18 @@ Object.defineProperty(exports, "__esModule", ({
6653
6930
  value: true
6654
6931
  }));
6655
6932
  exports.isFixed = exports.number = exports.label = exports.segment = void 0;
6933
+ const parser_1 = __webpack_require__(605);
6656
6934
  const combinator_1 = __webpack_require__(3484);
6657
6935
  const source_1 = __webpack_require__(8745);
6658
6936
  const dom_1 = __webpack_require__(394);
6659
6937
  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);
6660
6938
  exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
6661
- 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', {
6939
+ 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]), ([{
6940
+ value
6941
+ }]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6662
6942
  class: 'label',
6663
- 'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
6664
- }, text)]));
6943
+ 'data-label': value.slice(value[1] === '-' ? 0 : 1).toLowerCase()
6944
+ }, value))])));
6665
6945
  function number(label, base) {
6666
6946
  return isFixed(label) ? label.slice(label.lastIndexOf('-') + 1) : increment(base, base.split('.').length);
6667
6947
  }
@@ -6692,21 +6972,21 @@ Object.defineProperty(exports, "__esModule", ({
6692
6972
  value: true
6693
6973
  }));
6694
6974
  exports.placeholder = void 0;
6975
+ const parser_1 = __webpack_require__(605);
6695
6976
  const combinator_1 = __webpack_require__(3484);
6696
6977
  const inline_1 = __webpack_require__(7973);
6697
6978
  const source_1 = __webpack_require__(8745);
6698
6979
  const visibility_1 = __webpack_require__(6364);
6699
6980
  const util_1 = __webpack_require__(4992);
6700
- const array_1 = __webpack_require__(6876);
6701
6981
  const dom_1 = __webpack_require__(394);
6702
6982
  // Don't use the symbols already used: !#$%@&*+~=|
6703
6983
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6704
6984
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
6705
6985
  // ^はabbrで使用済みだが^:などのようにして分離使用可能
6706
- (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', {
6986
+ (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', {
6707
6987
  class: 'invalid',
6708
6988
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
6709
- }, context.source.slice(context.position - context.range, context.position))]], ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 64 /* Backtrack.bracket */]));
6989
+ }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs), [3 | 64 /* Backtrack.bracket */]));
6710
6990
 
6711
6991
  /***/ },
6712
6992
 
@@ -6720,13 +7000,13 @@ Object.defineProperty(exports, "__esModule", ({
6720
7000
  value: true
6721
7001
  }));
6722
7002
  exports.attributes = exports.attribute = exports.html = void 0;
7003
+ const parser_1 = __webpack_require__(605);
6723
7004
  const combinator_1 = __webpack_require__(3484);
6724
7005
  const inline_1 = __webpack_require__(7973);
6725
7006
  const source_1 = __webpack_require__(8745);
6726
7007
  const visibility_1 = __webpack_require__(6364);
6727
7008
  const util_1 = __webpack_require__(4992);
6728
7009
  const memoize_1 = __webpack_require__(6925);
6729
- const array_1 = __webpack_require__(6876);
6730
7010
  const dom_1 = __webpack_require__(394);
6731
7011
  const tags = ['wbr', 'bdo', 'bdi'];
6732
7012
  const attrspecs = {
@@ -6739,14 +7019,14 @@ Object.setPrototypeOf(attrspecs, null);
6739
7019
  Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
6740
7020
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
6741
7021
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6742
- (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)]),
7022
+ (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)),
6743
7023
  // 不可視のHTML構造が可視構造を変化させるべきでない。
6744
7024
  // 可視のHTMLは優先度変更を検討する。
6745
7025
  // このため<>は将来的に共通構造を変化させる可能性があり
6746
7026
  // 共通構造を変化させない非構造文字列としては依然としてエスケープを要する。
6747
- (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)(
7027
+ (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)(
6748
7028
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6749
- (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)]])])));
7029
+ (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))]))])));
6750
7030
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
6751
7031
  function elem(tag, content, as, bs, cs, context) {
6752
7032
  if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
@@ -6758,7 +7038,7 @@ function elem(tag, content, as, bs, cs, context) {
6758
7038
  const [attrs] = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -1 : as.length));
6759
7039
  if (/(?<!\S)invalid(?!\S)/.test(attrs['class'] ?? '')) return ielem('attribute', 'Invalid HTML attribute', context);
6760
7040
  if (as.at(-1) !== '>') return ielem('tag', `Missing the closing symbol ">"`, context);
6761
- return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
7041
+ return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)((0, util_1.unwrap)(bs)));
6762
7042
  }
6763
7043
  function ielem(type, message, context) {
6764
7044
  return (0, dom_1.html)('span', {
@@ -6771,15 +7051,15 @@ function attributes(syntax, spec, params) {
6771
7051
  const remains = [];
6772
7052
  let invalidation = false;
6773
7053
  const attrs = {};
6774
- for (let i = 0; i < params.length; ++i) {
6775
- const param = params[i].trimStart();
6776
- if (param === '') continue;
6777
- const name = param.split('=', 1)[0];
6778
- const value = param !== name ? param.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
7054
+ for (const param of params) {
7055
+ const attr = param.trimStart();
7056
+ if (attr === '') continue;
7057
+ const name = attr.split('=', 1)[0];
7058
+ const value = attr !== name ? attr.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
6779
7059
  invalidation ||= name === '' || !spec || name in attrs;
6780
7060
  if (name === '') continue;
6781
7061
  if (spec && name in spec && !spec[name]) {
6782
- remains.push(params[i]);
7062
+ remains.push(param);
6783
7063
  continue;
6784
7064
  }
6785
7065
  if (spec?.[name]?.includes(value) || spec?.[name]?.length === 0 && value !== undefined) {
@@ -6812,6 +7092,7 @@ Object.defineProperty(exports, "__esModule", ({
6812
7092
  value: true
6813
7093
  }));
6814
7094
  exports.htmlentity = exports.unsafehtmlentity = void 0;
7095
+ const parser_1 = __webpack_require__(605);
6815
7096
  const combinator_1 = __webpack_require__(3484);
6816
7097
  const util_1 = __webpack_require__(4992);
6817
7098
  const dom_1 = __webpack_require__(394);
@@ -6824,12 +7105,14 @@ exports.unsafehtmlentity = (0, combinator_1.focus)(/&(?:[0-9A-Za-z]+;?)?/y,
6824
7105
  source
6825
7106
  } = context;
6826
7107
  context.position += source.length;
6827
- return source.length > 1 && source.at(-1) === ';' ? [[parser(source) ?? source]] : [[source]];
7108
+ 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)]);
6828
7109
  });
6829
- exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([text]) => [length === 1 || text.at(-1) !== ';' ? text : (0, dom_1.html)('span', {
7110
+ exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
7111
+ value
7112
+ }]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Data(value) : new parser_1.Data((0, dom_1.html)('span', {
6830
7113
  class: 'invalid',
6831
7114
  ...(0, util_1.invalid)('htmlentity', 'syntax', 'Invalid HTML entity')
6832
- }, text)]);
7115
+ }, value))]));
6833
7116
  const parser = (el => entity => {
6834
7117
  if (entity === '&NewLine;') return ' ';
6835
7118
  el.innerHTML = entity;
@@ -6849,17 +7132,17 @@ Object.defineProperty(exports, "__esModule", ({
6849
7132
  value: true
6850
7133
  }));
6851
7134
  exports.insertion = void 0;
7135
+ const parser_1 = __webpack_require__(605);
6852
7136
  const combinator_1 = __webpack_require__(3484);
6853
7137
  const inline_1 = __webpack_require__(7973);
6854
7138
  const visibility_1 = __webpack_require__(6364);
6855
7139
  const util_1 = __webpack_require__(4992);
6856
- const array_1 = __webpack_require__(6876);
6857
7140
  const dom_1 = __webpack_require__(394);
6858
7141
  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], {
6859
7142
  buffer
6860
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
7143
+ }) => buffer.import(bs), ([, bs], {
6861
7144
  buffer
6862
- }) => 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))]))));
7145
+ }) => 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))))])))));
6863
7146
 
6864
7147
  /***/ },
6865
7148
 
@@ -6873,20 +7156,20 @@ Object.defineProperty(exports, "__esModule", ({
6873
7156
  value: true
6874
7157
  }));
6875
7158
  exports.italic = void 0;
7159
+ const parser_1 = __webpack_require__(605);
6876
7160
  const combinator_1 = __webpack_require__(3484);
6877
7161
  const inline_1 = __webpack_require__(7973);
6878
7162
  const visibility_1 = __webpack_require__(6364);
6879
7163
  const util_1 = __webpack_require__(4992);
6880
- const array_1 = __webpack_require__(6876);
6881
7164
  const dom_1 = __webpack_require__(394);
6882
7165
  // 可読性のため実際にはオブリーク体を指定する。
6883
7166
  // 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
6884
7167
  // ある程度の長さのある文に使うのが望ましい。
6885
7168
  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], {
6886
7169
  buffer
6887
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
7170
+ }) => buffer.import(bs), ([, bs], {
6888
7171
  buffer
6889
- }) => 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))]))));
7172
+ }) => 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))))])))));
6890
7173
 
6891
7174
  /***/ },
6892
7175
 
@@ -6900,6 +7183,7 @@ Object.defineProperty(exports, "__esModule", ({
6900
7183
  value: true
6901
7184
  }));
6902
7185
  exports.decode = exports.resolve = exports.option = exports.uri = exports.unsafelink = exports.medialink = exports.textlink = void 0;
7186
+ const parser_1 = __webpack_require__(605);
6903
7187
  const combinator_1 = __webpack_require__(3484);
6904
7188
  const inline_1 = __webpack_require__(7973);
6905
7189
  const html_1 = __webpack_require__(5013);
@@ -6907,22 +7191,25 @@ const source_1 = __webpack_require__(8745);
6907
7191
  const visibility_1 = __webpack_require__(6364);
6908
7192
  const util_1 = __webpack_require__(4992);
6909
7193
  const url_1 = __webpack_require__(1904);
6910
- const array_1 = __webpack_require__(6876);
6911
7194
  const dom_1 = __webpack_require__(394);
6912
7195
  const optspec = {
6913
7196
  rel: ['nofollow']
6914
7197
  };
6915
7198
  Object.setPrototypeOf(optspec, null);
6916
- 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 */])),
7199
+ 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 */])),
6917
7200
  // `{ `と`{`で個別にバックトラックが発生し+1nされる。
6918
7201
  // 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
6919
7202
  (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) => {
6920
7203
  if (!bs) return;
6921
7204
  const head = context.position - context.range;
6922
7205
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
6923
- return [(0, array_1.push)((0, array_1.unshift)(as, bs), ["\u0018" /* Command.Cancel */])];
6924
- }, [3 | 16 /* Backtrack.link */]))]), ([content, params], context) => {
6925
- if (content.at(-1) === "\u001F" /* Command.Separator */) {
7206
+ return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7207
+ }, [3 | 16 /* Backtrack.link */]))]), ([{
7208
+ value: content
7209
+ }, {
7210
+ value: params = undefined
7211
+ } = {}], context) => {
7212
+ if (content.last.value === "\u001F" /* Command.Separator */) {
6926
7213
  content.pop();
6927
7214
  if (params === undefined) {
6928
7215
  const head = context.position - context.range;
@@ -6930,30 +7217,38 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
6930
7217
  }
6931
7218
  } else {
6932
7219
  params = content;
6933
- content = [];
7220
+ content = new parser_1.List();
6934
7221
  }
6935
- if (params.at(-1) === "\u0018" /* Command.Cancel */) {
7222
+ if (params.last.value === "\u0018" /* Command.Cancel */) {
6936
7223
  params.pop();
6937
- return [[(0, dom_1.html)('span', {
7224
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6938
7225
  class: 'invalid',
6939
7226
  ...(0, util_1.invalid)('link', 'syntax', 'Missing the closing symbol "}"')
6940
- }, context.source.slice(context.position - context.range, context.position))]];
7227
+ }, context.source.slice(context.position - context.range, context.position)))]);
6941
7228
  }
6942
7229
  if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
6943
- return [[parse((0, dom_1.defrag)(content), params, context)]];
7230
+ return new parser_1.List([new parser_1.Data(parse(content, params, context))]);
6944
7231
  }))))));
6945
- 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)]]))))));
6946
- 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)]])));
7232
+ 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))]), ([{
7233
+ value: content
7234
+ }, {
7235
+ value: params
7236
+ }], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))])))))));
7237
+ 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))])), ([{
7238
+ value: params
7239
+ }, {
7240
+ value: content
7241
+ } = new parser_1.Data(new parser_1.List())], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))]))));
6947
7242
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/ /y, (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
6948
- 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)]);
7243
+ 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)]);
6949
7244
  function parse(content, params, context) {
6950
- const INSECURE_URI = params.shift();
7245
+ const INSECURE_URI = params.shift().value;
6951
7246
  let uri;
6952
7247
  try {
6953
7248
  uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
6954
7249
  } catch {}
6955
7250
  const el = elem(INSECURE_URI, content, uri, context.host?.origin || location.origin);
6956
- return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, params)[0]);
7251
+ return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, (0, util_1.unwrap)(params))[0]);
6957
7252
  }
6958
7253
  function elem(INSECURE_URI, content, uri, origin) {
6959
7254
  let type;
@@ -6966,7 +7261,7 @@ function elem(INSECURE_URI, content, uri, origin) {
6966
7261
  case 'http:':
6967
7262
  case 'https:':
6968
7263
  switch (true) {
6969
- case /[0-9a-z]:\S/i.test((0, util_1.stringify)(content)):
7264
+ case /[0-9a-z]:\S/i.test((0, util_1.stringify)((0, util_1.unwrap)(content))):
6970
7265
  type = 'content';
6971
7266
  message = 'URI must not be contained';
6972
7267
  break;
@@ -6978,19 +7273,19 @@ function elem(INSECURE_URI, content, uri, origin) {
6978
7273
  return (0, dom_1.html)('a', {
6979
7274
  class: content.length === 0 ? 'url' : 'link',
6980
7275
  href: uri.source,
6981
- target: false || uri.origin !== origin || typeof content[0] === 'object' && content[0].classList.contains('media') ? '_blank' : undefined
6982
- }, content.length === 0 ? decode(INSECURE_URI) : content);
7276
+ target: false || uri.origin !== origin || typeof content.head?.value === 'object' && content.head.value.classList.contains('media') ? '_blank' : undefined
7277
+ }, content.length === 0 ? decode(INSECURE_URI) : (0, dom_1.defrag)((0, util_1.unwrap)(content)));
6983
7278
  }
6984
7279
  break;
6985
7280
  case 'tel:':
6986
- const tel = content.length === 0 ? INSECURE_URI : content[0];
7281
+ const tel = content.length === 0 ? INSECURE_URI : (0, util_1.stringify)((0, util_1.unwrap)(content));
6987
7282
  const pattern = /^(?:tel:)?(?:\+(?!0))?\d+(?:-\d+)*$/i;
6988
7283
  switch (true) {
6989
7284
  case content.length <= 1 && pattern.test(INSECURE_URI) && typeof tel === 'string' && pattern.test(tel) && tel.replace(/[^+\d]/g, '') === INSECURE_URI.replace(/[^+\d]/g, ''):
6990
7285
  return (0, dom_1.html)('a', {
6991
7286
  class: 'tel',
6992
7287
  href: uri.source
6993
- }, content.length === 0 ? [INSECURE_URI] : content);
7288
+ }, content.length === 0 ? INSECURE_URI : (0, dom_1.defrag)((0, util_1.unwrap)(content)));
6994
7289
  default:
6995
7290
  type = 'content';
6996
7291
  message = 'Invalid content';
@@ -7003,7 +7298,7 @@ function elem(INSECURE_URI, content, uri, origin) {
7003
7298
  return (0, dom_1.html)('a', {
7004
7299
  class: 'invalid',
7005
7300
  ...(0, util_1.invalid)('link', type, message)
7006
- }, content.length === 0 ? INSECURE_URI : content);
7301
+ }, content.length === 0 ? INSECURE_URI : (0, dom_1.defrag)((0, util_1.unwrap)(content)));
7007
7302
  }
7008
7303
  function resolve(uri, host, source) {
7009
7304
  switch (true) {
@@ -7045,27 +7340,27 @@ Object.defineProperty(exports, "__esModule", ({
7045
7340
  value: true
7046
7341
  }));
7047
7342
  exports.mark = void 0;
7343
+ const parser_1 = __webpack_require__(605);
7048
7344
  const combinator_1 = __webpack_require__(3484);
7049
7345
  const inline_1 = __webpack_require__(7973);
7050
7346
  const indexee_1 = __webpack_require__(7610);
7051
7347
  const visibility_1 = __webpack_require__(6364);
7052
7348
  const util_1 = __webpack_require__(4992);
7053
- const array_1 = __webpack_require__(6876);
7054
7349
  const dom_1 = __webpack_require__(394);
7055
7350
  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], {
7056
7351
  buffer
7057
- }) => [(0, array_1.push)(buffer, bs)], ([, bs], {
7352
+ }) => buffer.import(bs), ([, bs], {
7058
7353
  buffer
7059
- }) => bs && [(0, array_1.push)((0, array_1.push)(buffer, bs), ["\u0018" /* Command.Cancel */])]), (nodes, {
7354
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), (nodes, {
7060
7355
  id
7061
7356
  }) => {
7062
- const el = (0, dom_1.html)('mark', (0, dom_1.defrag)(nodes));
7357
+ const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
7063
7358
  (0, dom_1.define)(el, {
7064
7359
  id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
7065
7360
  });
7066
- return el.id ? [el, (0, dom_1.html)('a', {
7361
+ return el.id ? new parser_1.List([new parser_1.Data(el), new parser_1.Data((0, dom_1.html)('a', {
7067
7362
  href: `#${el.id}`
7068
- })] : [el];
7363
+ }))]) : new parser_1.List([new parser_1.Data(el)]);
7069
7364
  }))))));
7070
7365
 
7071
7366
  /***/ },
@@ -7080,6 +7375,7 @@ Object.defineProperty(exports, "__esModule", ({
7080
7375
  value: true
7081
7376
  }));
7082
7377
  exports.math = void 0;
7378
+ const parser_1 = __webpack_require__(605);
7083
7379
  const combinator_1 = __webpack_require__(3484);
7084
7380
  const source_1 = __webpack_require__(8745);
7085
7381
  const util_1 = __webpack_require__(4992);
@@ -7092,7 +7388,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
7092
7388
  math: cache
7093
7389
  } = {}
7094
7390
  }
7095
- }) => [[cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
7391
+ }) => new parser_1.List([new parser_1.Data(cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
7096
7392
  class: 'math',
7097
7393
  translate: 'no',
7098
7394
  'data-src': source
@@ -7100,7 +7396,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
7100
7396
  class: 'invalid',
7101
7397
  translate: 'no',
7102
7398
  ...(0, util_1.invalid)('math', 'content', `"${source.match(forbiddenCommand)[0]}" command is forbidden`)
7103
- }, source)]]));
7399
+ }, source))])));
7104
7400
  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));
7105
7401
 
7106
7402
  /***/ },
@@ -7123,7 +7419,6 @@ const htmlentity_1 = __webpack_require__(470);
7123
7419
  const source_1 = __webpack_require__(8745);
7124
7420
  const util_1 = __webpack_require__(4992);
7125
7421
  const url_1 = __webpack_require__(1904);
7126
- const array_1 = __webpack_require__(6876);
7127
7422
  const dom_1 = __webpack_require__(394);
7128
7423
  const optspec = {
7129
7424
  'width': [],
@@ -7132,20 +7427,30 @@ const optspec = {
7132
7427
  rel: undefined
7133
7428
  };
7134
7429
  Object.setPrototypeOf(optspec, null);
7135
- 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) => {
7430
+ 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) => {
7136
7431
  if (!bs) return;
7137
7432
  const head = context.position - context.range;
7138
7433
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7139
- return [(0, array_1.push)((0, array_1.unshift)(as, bs), ["\u0018" /* Command.Cancel */])];
7140
- }, [3 | 16 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], context) => {
7141
- if (params.at(-1) === "\u0018" /* Command.Cancel */) {
7434
+ return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7435
+ }, [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, {
7436
+ value
7437
+ }) => acc + value, ''))])), nodes.delete(nodes.last)])), ([{
7438
+ value: [{
7439
+ value: text
7440
+ }]
7441
+ }, {
7442
+ value: params
7443
+ }], context) => {
7444
+ if (text && text.trimStart() === '') return;
7445
+ text = text.trim();
7446
+ if (params.last.value === "\u0018" /* Command.Cancel */) {
7142
7447
  params.pop();
7143
- return [[(0, dom_1.html)('span', {
7448
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7144
7449
  class: 'invalid',
7145
7450
  ...(0, util_1.invalid)('media', 'syntax', 'Missing the closing symbol "}"')
7146
- }, '!' + context.source.slice(context.position - context.range, context.position))]];
7451
+ }, '!' + context.source.slice(context.position - context.range, context.position)))]);
7147
7452
  }
7148
- const INSECURE_URI = params.shift();
7453
+ const INSECURE_URI = params.shift().value;
7149
7454
  // altが空だとエラーが見えないため埋める。
7150
7455
  text ||= (0, link_1.decode)(INSECURE_URI);
7151
7456
  let uri;
@@ -7158,30 +7463,38 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7158
7463
  'data-src': uri?.source
7159
7464
  });
7160
7465
  el.setAttribute('alt', text);
7161
- if (!sanitize(el, uri)) return [[el]];
7162
- const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, params);
7466
+ if (!sanitize(el, uri)) return new parser_1.List([new parser_1.Data(el)]);
7467
+ const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, (0, util_1.unwrap)(params));
7163
7468
  (0, dom_1.define)(el, attrs);
7164
7469
  // Awaiting the generic support for attr().
7165
7470
  if (el.hasAttribute('aspect-ratio')) {
7166
7471
  el.style.aspectRatio = el.getAttribute('aspect-ratio');
7167
7472
  }
7168
- if (context.state & 8 /* State.link */) return [[el]];
7169
- if (cache && cache.tagName !== 'IMG') return [[el]];
7473
+ if (context.state & 8 /* State.link */) return new parser_1.List([new parser_1.Data(el)]);
7474
+ if (cache && cache.tagName !== 'IMG') return new parser_1.List([new parser_1.Data(el)]);
7170
7475
  const {
7171
7476
  source,
7172
7477
  position
7173
7478
  } = context;
7174
- return (0, combinator_1.fmap)(link_1.unsafelink, ([link]) => {
7479
+ return (0, combinator_1.fmap)(link_1.unsafelink, ([{
7480
+ value
7481
+ }]) => {
7175
7482
  context.source = source;
7176
7483
  context.position = position;
7177
- return [(0, dom_1.define)(link, {
7484
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
7178
7485
  class: null,
7179
7486
  target: '_blank'
7180
- }, [el])];
7487
+ }, [el]))]);
7181
7488
  })((0, parser_1.subinput)(`{ ${INSECURE_URI}${linkparams.join('')} }`, context));
7182
7489
  })))));
7183
- 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 */])])));
7184
- 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]));
7490
+ 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 */])])));
7491
+ 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, ([[{
7492
+ value: a
7493
+ }], [{
7494
+ value: b
7495
+ }], [{
7496
+ value: c
7497
+ }]]) => 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]));
7185
7498
  function sanitize(target, uri) {
7186
7499
  let type;
7187
7500
  let message;
@@ -7231,9 +7544,8 @@ const inline_1 = __webpack_require__(7973);
7231
7544
  const link_1 = __webpack_require__(3628);
7232
7545
  const source_1 = __webpack_require__(8745);
7233
7546
  const visibility_1 = __webpack_require__(6364);
7234
- const dom_1 = __webpack_require__(394);
7235
- const array_1 = __webpack_require__(6876);
7236
7547
  const util_1 = __webpack_require__(4992);
7548
+ const dom_1 = __webpack_require__(394);
7237
7549
  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) => {
7238
7550
  const {
7239
7551
  position,
@@ -7241,7 +7553,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7241
7553
  linebreak = 0
7242
7554
  } = context;
7243
7555
  if (linebreak === 0) {
7244
- return [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, visibility_1.trimBlankNodeEnd)(ns)))])]];
7556
+ 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))))]))]);
7245
7557
  } else {
7246
7558
  const head = position - range;
7247
7559
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head, 2);
@@ -7262,13 +7574,13 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7262
7574
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head, 2);
7263
7575
  } else {
7264
7576
  if (state & 128 /* State.annotation */) {
7265
- (0, array_1.push)(bs, [source[position]]);
7577
+ bs.push(new parser_1.Data(source[position]));
7266
7578
  }
7267
7579
  context.position += 1;
7268
7580
  let result;
7269
7581
  if (source[context.position] !== '{') {
7270
7582
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head + 1);
7271
- result = [[]];
7583
+ result = new parser_1.List();
7272
7584
  } else {
7273
7585
  result = !(0, combinator_1.isBacktrack)(context, [1 | 16 /* Backtrack.link */]) ? (0, link_1.textlink)({
7274
7586
  context
@@ -7276,25 +7588,25 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7276
7588
  context.range = range;
7277
7589
  if (!result) {
7278
7590
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head + 1);
7279
- result = [[]];
7591
+ result = new parser_1.List();
7280
7592
  }
7281
7593
  }
7282
7594
  if (context.position === source.length) {
7283
7595
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7284
7596
  } else {
7285
- 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 = []]) => {
7597
+ 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()]) => {
7286
7598
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7287
- return [cs];
7599
+ return cs;
7288
7600
  })({
7289
7601
  context
7290
7602
  });
7291
7603
  if (state & 128 /* State.annotation */ && next) {
7292
- 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))];
7604
+ return as.import(bs).import((0, parser_1.eval)(result)).import((0, parser_1.eval)(next));
7293
7605
  }
7294
7606
  }
7295
7607
  context.position = position;
7296
7608
  }
7297
- return state & 128 /* State.annotation */ ? [(0, array_1.unshift)(as, bs)] : undefined;
7609
+ return state & 128 /* State.annotation */ ? as.import(bs) : undefined;
7298
7610
  }, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */])));
7299
7611
  // Chicago-Style
7300
7612
  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) => {
@@ -7303,23 +7615,23 @@ const abbr = (0, combinator_1.surround)((0, source_1.str)('^'), (0, combinator_1
7303
7615
  position,
7304
7616
  range = 0
7305
7617
  } = context;
7306
- if (!ns) return [['', source.slice(position - range, source[position - 1] === '|' ? position - 1 : position)]];
7618
+ 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))]);
7307
7619
  context.position += source[position] === ' ' ? 1 : 0;
7308
- return [["\u001F" /* Command.Separator */, ns[0].trimEnd()]];
7620
+ return new parser_1.List([new parser_1.Data("\u001F" /* Command.Separator */), new parser_1.Data(ns.head.value.trimEnd())]);
7309
7621
  }, (_, context) => {
7310
7622
  context.position -= context.range;
7311
- return [['']];
7623
+ return new parser_1.List([new parser_1.Data('')]);
7312
7624
  });
7313
7625
  function attributes(ns) {
7314
- switch (ns[0]) {
7626
+ switch (ns.head.value) {
7315
7627
  case '':
7316
7628
  return {
7317
7629
  class: 'invalid',
7318
7630
  ...(0, util_1.invalid)('reference', 'syntax', 'Invalid abbreviation')
7319
7631
  };
7320
7632
  case "\u001F" /* Command.Separator */:
7321
- const abbr = ns[1];
7322
- ns[0] = ns[1] = '';
7633
+ const abbr = ns.head.next.value;
7634
+ ns.head.value = ns.head.next.value = '';
7323
7635
  return {
7324
7636
  class: 'reference',
7325
7637
  'data-abbr': abbr
@@ -7343,24 +7655,24 @@ Object.defineProperty(exports, "__esModule", ({
7343
7655
  value: true
7344
7656
  }));
7345
7657
  exports.remark = void 0;
7658
+ const parser_1 = __webpack_require__(605);
7346
7659
  const combinator_1 = __webpack_require__(3484);
7347
7660
  const inline_1 = __webpack_require__(7973);
7348
7661
  const source_1 = __webpack_require__(8745);
7349
7662
  const util_1 = __webpack_require__(4992);
7350
- const array_1 = __webpack_require__(6876);
7351
7663
  const dom_1 = __webpack_require__(394);
7352
- 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', {
7664
+ 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', {
7353
7665
  class: 'remark'
7354
7666
  }, [(0, dom_1.html)('input', {
7355
7667
  type: 'checkbox'
7356
- }), (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, ({
7668
+ }), (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, ({
7357
7669
  context: {
7358
7670
  source
7359
7671
  }
7360
- }) => [[(0, dom_1.html)('span', {
7672
+ }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7361
7673
  class: 'invalid',
7362
7674
  ...(0, util_1.invalid)('remark', 'syntax', 'Invalid start symbol')
7363
- }, source)]])));
7675
+ }, source))]))));
7364
7676
 
7365
7677
  /***/ },
7366
7678
 
@@ -7379,23 +7691,39 @@ const combinator_1 = __webpack_require__(3484);
7379
7691
  const htmlentity_1 = __webpack_require__(470);
7380
7692
  const source_1 = __webpack_require__(8745);
7381
7693
  const visibility_1 = __webpack_require__(6364);
7382
- const array_1 = __webpack_require__(6876);
7694
+ const util_1 = __webpack_require__(4992);
7383
7695
  const dom_1 = __webpack_require__(394);
7384
7696
  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]) => {
7385
- ns && ns.at(-1) === '' && ns.pop();
7386
- return (0, visibility_1.isTightNodeStart)(ns) ? [ns] : undefined;
7387
- }, 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) => {
7697
+ ns && ns.last?.value === '' && ns.pop();
7698
+ return (0, visibility_1.isTightNodeStart)(ns) ? ns : undefined;
7699
+ }, 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 */]))]), ([{
7700
+ value: texts
7701
+ }, {
7702
+ value: rubies = undefined
7703
+ } = {}], context) => {
7388
7704
  if (rubies === undefined) {
7389
7705
  const head = context.position - context.range;
7390
7706
  return void (0, combinator_1.setBacktrack)(context, [2 | 8 /* Backtrack.ruby */], head);
7391
7707
  }
7392
7708
  switch (true) {
7393
- case rubies.length <= texts.length:
7394
- 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')])), [])))]];
7395
- case texts.length === 1 && [...texts[0]].length >= rubies.length:
7396
- 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')])), [])))]];
7709
+ case texts.length >= rubies.length:
7710
+ 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, [{
7711
+ value: text = ''
7712
+ } = {}, {
7713
+ value: ruby = ''
7714
+ } = {}]) => 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())))))]);
7715
+ case texts.length === 1 && [...texts.head.value].length >= rubies.length:
7716
+ 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, [{
7717
+ value: text = ''
7718
+ } = {}, {
7719
+ value: ruby = ''
7720
+ } = {}]) => 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())))))]);
7397
7721
  default:
7398
- 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', ')')])))]];
7722
+ 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(({
7723
+ value
7724
+ }, 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(({
7725
+ value
7726
+ }, acc) => value + ' ' + acc, '').trim())), new parser_1.Data((0, dom_1.html)('rp', ')'))])))))]);
7399
7727
  }
7400
7728
  }));
7401
7729
  const text = input => {
@@ -7405,7 +7733,7 @@ const text = input => {
7405
7733
  const {
7406
7734
  source
7407
7735
  } = context;
7408
- const acc = [''];
7736
+ const acc = new parser_1.List([new parser_1.Data('')]);
7409
7737
  let state = false;
7410
7738
  context.sequential = true;
7411
7739
  for (let {
@@ -7416,41 +7744,37 @@ const text = input => {
7416
7744
  case '&':
7417
7745
  {
7418
7746
  const result = (0, htmlentity_1.unsafehtmlentity)(input) ?? (0, source_1.txt)(input);
7419
- acc[acc.length - 1] += (0, parser_1.eval)(result)[0];
7747
+ acc.last.value += (0, parser_1.eval)(result).head.value;
7420
7748
  continue;
7421
7749
  }
7422
7750
  default:
7423
7751
  {
7424
7752
  if (source[position].trimStart() === '') {
7425
- state ||= acc.at(-1).trimStart() !== '';
7426
- acc.push('');
7753
+ state ||= acc.last.value.trimStart() !== '';
7754
+ acc.push(new parser_1.Data(''));
7427
7755
  context.position += 1;
7428
7756
  continue;
7429
7757
  }
7430
7758
  const result = (0, source_1.txt)(input);
7431
- acc[acc.length - 1] += (0, parser_1.eval)(result)[0] ?? source.slice(position, context.position);
7759
+ acc.last.value += (0, parser_1.eval)(result).head?.value ?? '';
7432
7760
  continue;
7433
7761
  }
7434
7762
  }
7435
7763
  }
7436
7764
  context.sequential = false;
7437
- state ||= acc.at(-1).trimStart() !== '';
7438
- return state ? [acc] : undefined;
7765
+ state ||= acc.last.value.trimStart() !== '';
7766
+ return state ? acc : undefined;
7439
7767
  };
7440
- //function attributes(texts: string[], rubies: string[]): Record<string, string> {
7441
- // let attrs: Record<string, string> | undefined;
7442
- // for (const ss of [texts, rubies]) {
7443
- // for (let i = 0; i < ss.length; ++i) {
7444
- // if (!ss[i].includes(Command.Error)) continue;
7445
- // ss[i] = ss[i].replace(CmdRegExp.Error, '');
7446
- // attrs ??= {
7447
- // class: 'invalid',
7448
- // ...invalid('ruby', ss === texts ? 'content' : 'argument', 'Invalid HTML entity'),
7449
- // };
7450
- // }
7451
- // }
7452
- // return attrs ?? {};
7453
- //}
7768
+ function* zip(a, b) {
7769
+ const ia = a[Symbol.iterator]();
7770
+ const ib = b[Symbol.iterator]();
7771
+ while (true) {
7772
+ const ra = ia.next();
7773
+ const rb = ib.next();
7774
+ if (ra.done) break;
7775
+ yield [ra.value, rb.value];
7776
+ }
7777
+ }
7454
7778
 
7455
7779
  /***/ },
7456
7780
 
@@ -7482,14 +7806,15 @@ Object.defineProperty(exports, "__esModule", ({
7482
7806
  value: true
7483
7807
  }));
7484
7808
  exports.strong = void 0;
7809
+ const parser_1 = __webpack_require__(605);
7485
7810
  const combinator_1 = __webpack_require__(3484);
7486
7811
  const inline_1 = __webpack_require__(7973);
7487
7812
  const emphasis_1 = __webpack_require__(1354);
7488
7813
  const source_1 = __webpack_require__(8745);
7489
7814
  const visibility_1 = __webpack_require__(6364);
7490
- const array_1 = __webpack_require__(6876);
7815
+ const util_1 = __webpack_require__(4992);
7491
7816
  const dom_1 = __webpack_require__(394);
7492
- 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)]));
7817
+ 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)));
7493
7818
 
7494
7819
  /***/ },
7495
7820
 
@@ -7503,18 +7828,18 @@ Object.defineProperty(exports, "__esModule", ({
7503
7828
  value: true
7504
7829
  }));
7505
7830
  exports.template = void 0;
7831
+ const parser_1 = __webpack_require__(605);
7506
7832
  const combinator_1 = __webpack_require__(3484);
7507
7833
  const source_1 = __webpack_require__(8745);
7508
7834
  const util_1 = __webpack_require__(4992);
7509
- const array_1 = __webpack_require__(6876);
7510
7835
  const dom_1 = __webpack_require__(394);
7511
- 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', {
7836
+ 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', {
7512
7837
  class: 'template'
7513
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]], ([, bs], context) => bs && [[(0, dom_1.html)('span', {
7838
+ }, (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', {
7514
7839
  class: 'invalid',
7515
7840
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
7516
- }, context.source.slice(context.position - context.range, context.position))]], [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
7517
- 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 */])]));
7841
+ }, context.source.slice(context.position - context.range, context.position)))]), [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
7842
+ 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 */])]));
7518
7843
 
7519
7844
  /***/ },
7520
7845
 
@@ -7885,7 +8210,9 @@ function* segment(source) {
7885
8210
  position
7886
8211
  } = context;
7887
8212
  const result = parser(input);
7888
- const segs = (0, parser_1.eval)(result).length ? (0, parser_1.eval)(result) : [source.slice(position, context.position)];
8213
+ const segs = (0, parser_1.eval)(result).length > 0 ? (0, parser_1.eval)(result).foldl((acc, {
8214
+ value
8215
+ }) => void acc.push(value) || acc, []) : [source.slice(position, context.position)];
7889
8216
  for (let i = 0; i < segs.length; ++i) {
7890
8217
  const seg = segs[i];
7891
8218
  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}`;
@@ -7989,6 +8316,7 @@ Object.defineProperty(exports, "__esModule", ({
7989
8316
  value: true
7990
8317
  }));
7991
8318
  exports.escsource = void 0;
8319
+ const parser_1 = __webpack_require__(605);
7992
8320
  const combinator_1 = __webpack_require__(3484);
7993
8321
  const text_1 = __webpack_require__(5655);
7994
8322
  const dom_1 = __webpack_require__(394);
@@ -8007,32 +8335,32 @@ const escsource = ({
8007
8335
  switch (char) {
8008
8336
  case '\r':
8009
8337
  (0, combinator_1.consume)(-1, context);
8010
- return [[]];
8338
+ return new parser_1.List();
8011
8339
  case "\u001B" /* Command.Escape */:
8012
8340
  (0, combinator_1.consume)(1, context);
8013
8341
  context.position += 1;
8014
- return [[source.slice(position + 1, position + 2)]];
8342
+ return new parser_1.List([new parser_1.Data(source.slice(position + 1, position + 2))]);
8015
8343
  case '\\':
8016
8344
  switch (source[position + 1]) {
8017
8345
  case undefined:
8018
- return [[char]];
8346
+ return new parser_1.List([new parser_1.Data(char)]);
8019
8347
  case '\n':
8020
- return [[char]];
8348
+ return new parser_1.List([new parser_1.Data(char)]);
8021
8349
  default:
8022
8350
  (0, combinator_1.consume)(1, context);
8023
8351
  context.position += 1;
8024
- return [[source.slice(position, position + 2)]];
8352
+ return new parser_1.List([new parser_1.Data(source.slice(position, position + 2))]);
8025
8353
  }
8026
8354
  case '\n':
8027
8355
  context.linebreak ||= source.length - position;
8028
- return [[(0, dom_1.html)('br')]];
8356
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8029
8357
  default:
8030
- if (context.sequential) return [[char]];
8358
+ if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8031
8359
  let i = (0, text_1.next)(source, position, delimiter);
8032
8360
  i -= position;
8033
8361
  (0, combinator_1.consume)(i - 1, context);
8034
8362
  context.position += i - 1;
8035
- return [[source.slice(position, context.position)]];
8363
+ return new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8036
8364
  }
8037
8365
  };
8038
8366
  exports.escsource = escsource;
@@ -8040,7 +8368,7 @@ exports.escsource = escsource;
8040
8368
  /***/ },
8041
8369
 
8042
8370
  /***/ 702
8043
- (__unused_webpack_module, exports) {
8371
+ (__unused_webpack_module, exports, __webpack_require__) {
8044
8372
 
8045
8373
  "use strict";
8046
8374
 
@@ -8049,6 +8377,7 @@ Object.defineProperty(exports, "__esModule", ({
8049
8377
  value: true
8050
8378
  }));
8051
8379
  exports.contentline = exports.emptyline = exports.anyline = void 0;
8380
+ const parser_1 = __webpack_require__(605);
8052
8381
  const anyline = input => {
8053
8382
  const {
8054
8383
  context
@@ -8058,7 +8387,7 @@ const anyline = input => {
8058
8387
  position
8059
8388
  } = context;
8060
8389
  context.position = source.indexOf('\n', position) + 1 || source.length;
8061
- return [[]];
8390
+ return new parser_1.List();
8062
8391
  };
8063
8392
  exports.anyline = anyline;
8064
8393
  const regEmptyline = /[^\S\n]*(?:$|\n)/y;
@@ -8075,7 +8404,7 @@ const emptyline = input => {
8075
8404
  const i = regEmptyline.lastIndex;
8076
8405
  if (i === 0) return;
8077
8406
  context.position = i;
8078
- return [[]];
8407
+ return new parser_1.List();
8079
8408
  };
8080
8409
  exports.emptyline = emptyline;
8081
8410
  const regContentline = /[^\S\n]*\S[^\n]*(?:$|\n)/y;
@@ -8092,7 +8421,7 @@ const contentline = input => {
8092
8421
  const i = regContentline.lastIndex;
8093
8422
  if (i === 0) return;
8094
8423
  context.position = i;
8095
- return [[]];
8424
+ return new parser_1.List();
8096
8425
  };
8097
8426
  exports.contentline = contentline;
8098
8427
 
@@ -8108,6 +8437,7 @@ Object.defineProperty(exports, "__esModule", ({
8108
8437
  value: true
8109
8438
  }));
8110
8439
  exports.strs = exports.str = void 0;
8440
+ const parser_1 = __webpack_require__(605);
8111
8441
  const combinator_1 = __webpack_require__(3484);
8112
8442
  function str(pattern) {
8113
8443
  return (0, combinator_1.matcher)(pattern, true);
@@ -8125,7 +8455,7 @@ function strs(pattern) {
8125
8455
  acc += pattern;
8126
8456
  context.position += pattern.length;
8127
8457
  }
8128
- return [[acc]];
8458
+ return new parser_1.List([new parser_1.Data(acc)]);
8129
8459
  };
8130
8460
  }
8131
8461
  exports.strs = strs;
@@ -8142,6 +8472,7 @@ Object.defineProperty(exports, "__esModule", ({
8142
8472
  value: true
8143
8473
  }));
8144
8474
  exports.backToEmailHead = exports.backToUrlHead = exports.backToWhitespace = exports.next = exports.canSkip = exports.linebreak = exports.txt = exports.text = exports.nonWhitespace = void 0;
8475
+ const parser_1 = __webpack_require__(605);
8145
8476
  const combinator_1 = __webpack_require__(3484);
8146
8477
  const dom_1 = __webpack_require__(394);
8147
8478
  //const delimiter = /(?=[\\!@#$&"`\[\](){}<>()[]{}*%|\r\n]|([+~=])\1|\/{3}|\s(?:\\?(?:$|\s)|[$%])|:\/\/)/g;
@@ -8161,24 +8492,24 @@ const text = input => {
8161
8492
  switch (char) {
8162
8493
  case '\r':
8163
8494
  (0, combinator_1.consume)(-1, context);
8164
- return [[]];
8495
+ return new parser_1.List();
8165
8496
  case "\u001B" /* Command.Escape */:
8166
8497
  case '\\':
8167
8498
  switch (source[position + 1]) {
8168
8499
  case undefined:
8169
- return [[]];
8500
+ return new parser_1.List();
8170
8501
  case '\n':
8171
- return [[]];
8502
+ return new parser_1.List();
8172
8503
  default:
8173
8504
  (0, combinator_1.consume)(1, context);
8174
8505
  context.position += 1;
8175
- return [[source.slice(position + 1, context.position)]];
8506
+ return new parser_1.List([new parser_1.Data(source.slice(position + 1, context.position))]);
8176
8507
  }
8177
8508
  case '\n':
8178
8509
  context.linebreak ||= source.length - position;
8179
- return [[(0, dom_1.html)('br')]];
8510
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8180
8511
  default:
8181
- if (context.sequential) return [[char]];
8512
+ if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8182
8513
  exports.nonWhitespace.lastIndex = position + 1;
8183
8514
  const s = canSkip(source, position);
8184
8515
  let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position);
@@ -8188,7 +8519,7 @@ const text = input => {
8188
8519
  (0, combinator_1.consume)(i - 1, context);
8189
8520
  context.position += i - 1;
8190
8521
  const linestart = position === 0 || source[position - 1] === '\n';
8191
- return position === context.position || s && !linestart || lineend ? [[]] : [[source.slice(position, context.position)]];
8522
+ return position === context.position || s && !linestart || lineend ? new parser_1.List() : new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8192
8523
  }
8193
8524
  };
8194
8525
  exports.text = text;
@@ -8255,37 +8586,29 @@ exports.backToWhitespace = backToWhitespace;
8255
8586
  function backToUrlHead(source, position, index) {
8256
8587
  const delim = index;
8257
8588
  let state = false;
8258
- let offset = 0;
8259
- for (let i = index; --i > position;) {
8260
- index = i;
8589
+ for (let i = index - 1; i >= position; --i) {
8261
8590
  const char = source[i];
8262
8591
  if (state) switch (char) {
8263
8592
  case '.':
8264
8593
  case '+':
8265
8594
  case '-':
8266
8595
  state = false;
8267
- offset = 1;
8268
8596
  continue;
8269
8597
  }
8270
8598
  if (isAlphanumeric(char)) {
8271
8599
  state = true;
8272
- offset = 0;
8600
+ index = i;
8273
8601
  continue;
8274
8602
  }
8275
8603
  break;
8276
8604
  }
8277
- if (index === position + 1 && offset === 0 && isAlphanumeric(source[index - 1])) {
8278
- return delim;
8279
- }
8280
- return index + offset;
8605
+ return index === position ? delim : index;
8281
8606
  }
8282
8607
  exports.backToUrlHead = backToUrlHead;
8283
8608
  function backToEmailHead(source, position, index) {
8284
8609
  const delim = index;
8285
8610
  let state = false;
8286
- let offset = 0;
8287
- for (let i = index; --i > position;) {
8288
- index = i;
8611
+ for (let i = index - 1; i >= position; --i) {
8289
8612
  const char = source[i];
8290
8613
  if (state) switch (char) {
8291
8614
  case '_':
@@ -8293,20 +8616,16 @@ function backToEmailHead(source, position, index) {
8293
8616
  case '+':
8294
8617
  case '-':
8295
8618
  state = false;
8296
- offset = 1;
8297
8619
  continue;
8298
8620
  }
8299
8621
  if (isAlphanumeric(char)) {
8300
8622
  state = true;
8301
- offset = 0;
8623
+ index = i;
8302
8624
  continue;
8303
8625
  }
8304
8626
  break;
8305
8627
  }
8306
- if (index === position + 1 && offset === 0 && isAlphanumeric(source[index - 1])) {
8307
- return delim;
8308
- }
8309
- return index + offset;
8628
+ return index === position ? delim : index;
8310
8629
  }
8311
8630
  exports.backToEmailHead = backToEmailHead;
8312
8631
  function isAlphanumeric(char) {
@@ -8435,6 +8754,7 @@ Object.defineProperty(exports, "__esModule", ({
8435
8754
  value: true
8436
8755
  }));
8437
8756
  exports.unescsource = exports.delimiter = void 0;
8757
+ const parser_1 = __webpack_require__(605);
8438
8758
  const combinator_1 = __webpack_require__(3484);
8439
8759
  const text_1 = __webpack_require__(5655);
8440
8760
  const dom_1 = __webpack_require__(394);
@@ -8453,22 +8773,22 @@ const unescsource = ({
8453
8773
  switch (char) {
8454
8774
  case '\r':
8455
8775
  (0, combinator_1.consume)(-1, context);
8456
- return [[]];
8776
+ return new parser_1.List();
8457
8777
  case "\u001B" /* Command.Escape */:
8458
8778
  (0, combinator_1.consume)(1, context);
8459
8779
  context.position += 1;
8460
- return [[source.slice(position + 1, position + 2)]];
8780
+ return new parser_1.List([new parser_1.Data(source.slice(position + 1, position + 2))]);
8461
8781
  case '\n':
8462
8782
  context.linebreak ||= source.length - position;
8463
- return [[(0, dom_1.html)('br')]];
8783
+ return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
8464
8784
  default:
8465
- if (context.sequential) return [[char]];
8785
+ if (context.sequential) return new parser_1.List([new parser_1.Data(char)]);
8466
8786
  text_1.nonWhitespace.lastIndex = position + 1;
8467
8787
  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);
8468
8788
  i -= position;
8469
8789
  (0, combinator_1.consume)(i - 1, context);
8470
8790
  context.position += i - 1;
8471
- return [[source.slice(position, context.position)]];
8791
+ return new parser_1.List([new parser_1.Data(source.slice(position, context.position))]);
8472
8792
  }
8473
8793
  };
8474
8794
  exports.unescsource = unescsource;
@@ -8484,30 +8804,31 @@ exports.unescsource = unescsource;
8484
8804
  Object.defineProperty(exports, "__esModule", ({
8485
8805
  value: true
8486
8806
  }));
8487
- exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.linearize = void 0;
8807
+ exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.unwrap = void 0;
8488
8808
  const alias_1 = __webpack_require__(5413);
8489
8809
  const parser_1 = __webpack_require__(605);
8490
- const combinator_1 = __webpack_require__(3484);
8491
8810
  const dom_1 = __webpack_require__(394);
8492
- function linearize(parser, trim = 0) {
8493
- return (0, combinator_1.convert)(source => `${trim === 0 ? source : trim > 0 ? source.at(-1) === '\n' ? source : source + '\n' : source.at(-1) === '\n' ? source.slice(0, -1) : source}`, parser, trim === 0);
8811
+ function* unwrap(nodes) {
8812
+ for (const node of nodes) {
8813
+ yield node.value;
8814
+ }
8494
8815
  }
8495
- exports.linearize = linearize;
8816
+ exports.unwrap = unwrap;
8496
8817
  function repeat(symbol, parser, cons, termination = (nodes, context, prefix, postfix) => {
8497
- const acc = [];
8818
+ const acc = new parser_1.List();
8498
8819
  if (prefix > 0) {
8499
- acc.push(symbol[0].repeat(prefix));
8820
+ acc.push(new parser_1.Data(symbol[0].repeat(prefix)));
8500
8821
  }
8501
- acc.push(...nodes);
8822
+ acc.import(nodes);
8502
8823
  if (postfix > 0) {
8503
8824
  const {
8504
8825
  source,
8505
8826
  position
8506
8827
  } = context;
8507
- acc.push(source.slice(position, position + postfix));
8828
+ acc.push(new parser_1.Data(source.slice(position, position + postfix)));
8508
8829
  context.position += postfix;
8509
8830
  }
8510
- return [acc];
8831
+ return acc;
8511
8832
  }) {
8512
8833
  return (0, parser_1.failsafe)(input => {
8513
8834
  const {
@@ -8517,7 +8838,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
8517
8838
  source,
8518
8839
  position
8519
8840
  } = context;
8520
- let nodes = [];
8841
+ let nodes = new parser_1.List();
8521
8842
  let i = symbol.length;
8522
8843
  while (source[context.position + i] === source[context.position]) ++i;
8523
8844
  context.position += i;
@@ -8534,7 +8855,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
8534
8855
  context.buffer = buf;
8535
8856
  if (result === undefined) break;
8536
8857
  nodes = (0, parser_1.eval)(result);
8537
- switch (nodes.at(-1)) {
8858
+ switch (nodes.last?.value) {
8538
8859
  case "\u0018" /* Command.Cancel */:
8539
8860
  nodes.pop();
8540
8861
  state = false;
@@ -8590,8 +8911,7 @@ function unmarkInvalid(el) {
8590
8911
  exports.unmarkInvalid = unmarkInvalid;
8591
8912
  function stringify(nodes) {
8592
8913
  let acc = '';
8593
- for (let i = 0; i < nodes.length; ++i) {
8594
- const node = nodes[i];
8914
+ for (const node of nodes) {
8595
8915
  if (typeof node === 'string') {
8596
8916
  acc += node;
8597
8917
  } else {
@@ -8619,7 +8939,6 @@ const parser_1 = __webpack_require__(605);
8619
8939
  const combinator_1 = __webpack_require__(3484);
8620
8940
  const htmlentity_1 = __webpack_require__(470);
8621
8941
  const normalize_1 = __webpack_require__(4490);
8622
- const array_1 = __webpack_require__(6876);
8623
8942
  var blank;
8624
8943
  (function (blank) {
8625
8944
  blank.line = new RegExp(
@@ -8664,7 +8983,7 @@ function isTightStart(input, except) {
8664
8983
  return source[position + 1]?.trimStart() !== '';
8665
8984
  case '&':
8666
8985
  switch (true) {
8667
- case source.length - position > 2 && source[position + 1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(input))?.[0]?.trimStart() === '':
8986
+ case source.length - position > 2 && source[position + 1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(input))?.head?.value.trimStart() === '':
8668
8987
  context.position = position;
8669
8988
  return false;
8670
8989
  }
@@ -8683,8 +9002,9 @@ function isTightStart(input, except) {
8683
9002
  }
8684
9003
  function isLooseNodeStart(nodes) {
8685
9004
  if (nodes.length === 0) return true;
8686
- for (let i = 0; i < nodes.length; ++i) {
8687
- const node = nodes[i];
9005
+ for (const {
9006
+ value: node
9007
+ } of nodes) {
8688
9008
  if (isVisible(node)) return true;
8689
9009
  if (typeof node === 'object' && node.tagName === 'BR') break;
8690
9010
  }
@@ -8693,7 +9013,7 @@ function isLooseNodeStart(nodes) {
8693
9013
  exports.isLooseNodeStart = isLooseNodeStart;
8694
9014
  function isTightNodeStart(nodes) {
8695
9015
  if (nodes.length === 0) return true;
8696
- return isVisible(nodes[0], 0);
9016
+ return isVisible(nodes.head.value, 0);
8697
9017
  }
8698
9018
  exports.isTightNodeStart = isTightNodeStart;
8699
9019
  //export function isTightNodeEnd(nodes: readonly (HTMLElement | string)[]): boolean {
@@ -8741,7 +9061,7 @@ function trimBlankStart(parser) {
8741
9061
  reg.lastIndex = position;
8742
9062
  reg.test(source);
8743
9063
  context.position = reg.lastIndex || position;
8744
- return context.position === source.length ? [[]] : parser(input);
9064
+ return context.position === source.length ? new parser_1.List() : parser(input);
8745
9065
  });
8746
9066
  }
8747
9067
  exports.trimBlankStart = trimBlankStart;
@@ -8769,18 +9089,19 @@ exports.trimBlankEnd = trimBlankEnd;
8769
9089
  // return nodes;
8770
9090
  //}
8771
9091
  function trimBlankNodeEnd(nodes) {
8772
- const skip = nodes.length > 0 && typeof nodes.at(-1) === 'object' && nodes.at(-1)['className'] === 'indexer' ? [nodes.pop()] : [];
8773
- for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes.at(-1), -1);) {
8774
- if (typeof node === 'string') {
8775
- const str = node.trimEnd();
9092
+ const skip = nodes.length > 0 && typeof nodes.last?.value === 'object' && nodes.last.value.className === 'indexer' ? nodes.pop() : undefined;
9093
+ for (let node = nodes.last; nodes.length > 0 && !isVisible((node = nodes.last).value, -1);) {
9094
+ if (typeof node.value === 'string') {
9095
+ const str = node.value.trimEnd();
8776
9096
  if (str.length > 0) {
8777
- nodes[nodes.length - 1] = str;
9097
+ node.value = str;
8778
9098
  break;
8779
9099
  }
8780
9100
  }
8781
9101
  nodes.pop();
8782
9102
  }
8783
- return (0, array_1.push)(nodes, skip);
9103
+ skip && nodes.push(skip);
9104
+ return nodes;
8784
9105
  }
8785
9106
  exports.trimBlankNodeEnd = trimBlankNodeEnd;
8786
9107
 
@@ -9422,7 +9743,7 @@ function unlink(h) {
9422
9743
  /***/ 394
9423
9744
  (module) {
9424
9745
 
9425
- /*! typed-dom v0.0.349 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9746
+ /*! typed-dom v0.0.351 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9426
9747
  (function webpackUniversalModuleDefinition(root, factory) {
9427
9748
  if(true)
9428
9749
  module.exports = factory();
@@ -9433,8 +9754,8 @@ return /******/ (() => { // webpackBootstrap
9433
9754
  /******/ "use strict";
9434
9755
  /******/ var __webpack_modules__ = ({
9435
9756
 
9436
- /***/ 5413:
9437
- /***/ ((__unused_webpack_module, exports) => {
9757
+ /***/ 413
9758
+ (__unused_webpack_module, exports) {
9438
9759
 
9439
9760
 
9440
9761
 
@@ -9454,10 +9775,10 @@ exports.ObjectCreate = Object.create;
9454
9775
  exports.ObjectGetPrototypeOf = Object.getPrototypeOf;
9455
9776
  exports.ObjectSetPrototypeOf = Object.setPrototypeOf;
9456
9777
 
9457
- /***/ }),
9778
+ /***/ },
9458
9779
 
9459
- /***/ 1934:
9460
- /***/ ((__unused_webpack_module, exports) => {
9780
+ /***/ 934
9781
+ (__unused_webpack_module, exports) {
9461
9782
 
9462
9783
 
9463
9784
 
@@ -9470,10 +9791,10 @@ function equal(a, b) {
9470
9791
  }
9471
9792
  exports.equal = equal;
9472
9793
 
9473
- /***/ }),
9794
+ /***/ },
9474
9795
 
9475
- /***/ 6925:
9476
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9796
+ /***/ 925
9797
+ (__unused_webpack_module, exports, __nested_webpack_require_3115__) {
9477
9798
 
9478
9799
 
9479
9800
 
@@ -9481,8 +9802,8 @@ Object.defineProperty(exports, "__esModule", ({
9481
9802
  value: true
9482
9803
  }));
9483
9804
  exports.reduce = exports.memoize = void 0;
9484
- const alias_1 = __webpack_require__(5413);
9485
- const compare_1 = __webpack_require__(1934);
9805
+ const alias_1 = __nested_webpack_require_3115__(413);
9806
+ const compare_1 = __nested_webpack_require_3115__(934);
9486
9807
  function memoize(f, identify, memory) {
9487
9808
  if (typeof identify === 'object') {
9488
9809
  memory = identify;
@@ -9547,10 +9868,10 @@ function reduce(f, identify = (...as) => as[0]) {
9547
9868
  }
9548
9869
  exports.reduce = reduce;
9549
9870
 
9550
- /***/ }),
9871
+ /***/ },
9551
9872
 
9552
- /***/ 5761:
9553
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9873
+ /***/ 761
9874
+ (__unused_webpack_module, exports, __nested_webpack_require_4963__) {
9554
9875
 
9555
9876
 
9556
9877
 
@@ -9558,8 +9879,8 @@ Object.defineProperty(exports, "__esModule", ({
9558
9879
  value: true
9559
9880
  }));
9560
9881
  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;
9561
- const alias_1 = __webpack_require__(5413);
9562
- const memoize_1 = __webpack_require__(6925);
9882
+ const alias_1 = __nested_webpack_require_4963__(413);
9883
+ const memoize_1 = __nested_webpack_require_4963__(925);
9563
9884
  var caches;
9564
9885
  (function (caches) {
9565
9886
  // Closed only.
@@ -9681,11 +10002,6 @@ function defineChildren(node, children) {
9681
10002
  if (children === undefined) return node;
9682
10003
  if (typeof children === 'string') {
9683
10004
  node.textContent = children;
9684
- } else if (((0, alias_1.isArray)(children) || !(Symbol.iterator in children)) && !node.firstChild) {
9685
- for (let i = 0; i < children.length; ++i) {
9686
- const child = children[i];
9687
- typeof child === 'object' ? node.appendChild(child) : node.append(child);
9688
- }
9689
10005
  } else {
9690
10006
  node.replaceChildren(...children);
9691
10007
  }
@@ -9699,11 +10015,6 @@ function append(node, children) {
9699
10015
  if (children === undefined) return node;
9700
10016
  if (typeof children === 'string') {
9701
10017
  node.append(children);
9702
- } else if ((0, alias_1.isArray)(children) || !(Symbol.iterator in children)) {
9703
- for (let i = 0; i < children.length; ++i) {
9704
- const child = children[i];
9705
- typeof child === 'object' ? node.appendChild(child) : node.append(child);
9706
- }
9707
10018
  } else {
9708
10019
  for (const child of children) {
9709
10020
  typeof child === 'object' ? node.appendChild(child) : node.append(child);
@@ -9716,11 +10027,6 @@ function prepend(node, children) {
9716
10027
  if (children === undefined) return node;
9717
10028
  if (typeof children === 'string') {
9718
10029
  node.prepend(children);
9719
- } else if ((0, alias_1.isArray)(children) || !(Symbol.iterator in children)) {
9720
- for (let i = 0; i < children.length; ++i) {
9721
- const child = children[i];
9722
- typeof child === 'object' ? node.insertBefore(child, null) : node.prepend(child);
9723
- }
9724
10030
  } else {
9725
10031
  for (const child of children) {
9726
10032
  typeof child === 'object' ? node.insertBefore(child, null) : node.prepend(child);
@@ -9729,24 +10035,22 @@ function prepend(node, children) {
9729
10035
  return node;
9730
10036
  }
9731
10037
  exports.prepend = prepend;
9732
- function defrag(nodes) {
9733
- const acc = [];
9734
- let appendable = false;
9735
- for (let i = 0, len = nodes.length; i < len; ++i) {
9736
- const node = nodes[i];
9737
- if (typeof node === 'object') {
9738
- acc.push(node);
9739
- appendable = false;
9740
- } else if (node !== '') {
9741
- appendable ? acc[acc.length - 1] += node : acc.push(node);
9742
- appendable = true;
10038
+ function* defrag(nodes) {
10039
+ let acc = '';
10040
+ for (const node of nodes) {
10041
+ if (typeof node === 'string') {
10042
+ acc += node;
10043
+ } else {
10044
+ if (acc) yield acc;
10045
+ acc = '';
10046
+ yield node;
9743
10047
  }
9744
10048
  }
9745
- return acc;
10049
+ if (acc) yield acc;
9746
10050
  }
9747
10051
  exports.defrag = defrag;
9748
10052
 
9749
- /***/ })
10053
+ /***/ }
9750
10054
 
9751
10055
  /******/ });
9752
10056
  /************************************************************************/
@@ -9754,7 +10058,7 @@ exports.defrag = defrag;
9754
10058
  /******/ var __webpack_module_cache__ = {};
9755
10059
  /******/
9756
10060
  /******/ // The require function
9757
- /******/ function __nested_webpack_require_12534__(moduleId) {
10061
+ /******/ function __nested_webpack_require_11558__(moduleId) {
9758
10062
  /******/ // Check if module is in cache
9759
10063
  /******/ var cachedModule = __webpack_module_cache__[moduleId];
9760
10064
  /******/ if (cachedModule !== undefined) {
@@ -9768,7 +10072,7 @@ exports.defrag = defrag;
9768
10072
  /******/ };
9769
10073
  /******/
9770
10074
  /******/ // Execute the module function
9771
- /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_12534__);
10075
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_11558__);
9772
10076
  /******/
9773
10077
  /******/ // Return the exports of the module
9774
10078
  /******/ return module.exports;
@@ -9779,7 +10083,7 @@ exports.defrag = defrag;
9779
10083
  /******/ // startup
9780
10084
  /******/ // Load entry module and return exports
9781
10085
  /******/ // This entry module is referenced by other modules so it can't be inlined
9782
- /******/ var __nested_webpack_exports__ = __nested_webpack_require_12534__(5761);
10086
+ /******/ var __nested_webpack_exports__ = __nested_webpack_require_11558__(761);
9783
10087
  /******/
9784
10088
  /******/ return __nested_webpack_exports__;
9785
10089
  /******/ })()
@@ -9791,7 +10095,7 @@ exports.defrag = defrag;
9791
10095
  /***/ 2282
9792
10096
  (module) {
9793
10097
 
9794
- /*! typed-dom v0.0.349 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
10098
+ /*! typed-dom v0.0.351 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
9795
10099
  (function webpackUniversalModuleDefinition(root, factory) {
9796
10100
  if(true)
9797
10101
  module.exports = factory();
@@ -9801,7 +10105,7 @@ exports.defrag = defrag;
9801
10105
  return /******/ (() => { // webpackBootstrap
9802
10106
  /******/ "use strict";
9803
10107
  var __nested_webpack_exports__ = {};
9804
- // This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
10108
+ // This entry needs to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
9805
10109
  (() => {
9806
10110
  var exports = __nested_webpack_exports__;
9807
10111