securemark 0.256.0 → 0.257.2

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 (55) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +21 -8
  3. package/dist/index.js +237 -197
  4. package/markdown.d.ts +23 -17
  5. package/package.json +1 -1
  6. package/src/combinator/control/manipulation/context.ts +13 -2
  7. package/src/combinator/control/manipulation/resource.ts +36 -2
  8. package/src/combinator/control/manipulation/surround.ts +6 -6
  9. package/src/combinator/data/parser/inits.ts +1 -1
  10. package/src/combinator/data/parser/sequence.ts +1 -1
  11. package/src/combinator/data/parser/some.ts +16 -38
  12. package/src/combinator/data/parser.ts +34 -18
  13. package/src/debug.test.ts +2 -2
  14. package/src/parser/api/bind.ts +9 -11
  15. package/src/parser/api/parse.test.ts +48 -11
  16. package/src/parser/block.ts +1 -1
  17. package/src/parser/inline/annotation.test.ts +7 -5
  18. package/src/parser/inline/annotation.ts +10 -6
  19. package/src/parser/inline/autolink/account.ts +3 -7
  20. package/src/parser/inline/autolink/anchor.ts +3 -7
  21. package/src/parser/inline/autolink/hashnum.ts +3 -7
  22. package/src/parser/inline/autolink/hashtag.ts +3 -7
  23. package/src/parser/inline/autolink/url.test.ts +1 -0
  24. package/src/parser/inline/autolink/url.ts +7 -8
  25. package/src/parser/inline/bracket.test.ts +13 -7
  26. package/src/parser/inline/bracket.ts +10 -10
  27. package/src/parser/inline/comment.test.ts +5 -3
  28. package/src/parser/inline/comment.ts +4 -4
  29. package/src/parser/inline/deletion.ts +3 -3
  30. package/src/parser/inline/emphasis.ts +3 -3
  31. package/src/parser/inline/emstrong.ts +4 -5
  32. package/src/parser/inline/extension/index.test.ts +1 -0
  33. package/src/parser/inline/extension/index.ts +8 -7
  34. package/src/parser/inline/extension/indexer.ts +3 -5
  35. package/src/parser/inline/extension/label.ts +1 -1
  36. package/src/parser/inline/extension/placeholder.test.ts +1 -0
  37. package/src/parser/inline/extension/placeholder.ts +4 -4
  38. package/src/parser/inline/html.test.ts +2 -0
  39. package/src/parser/inline/html.ts +5 -5
  40. package/src/parser/inline/insertion.ts +3 -3
  41. package/src/parser/inline/link.test.ts +1 -0
  42. package/src/parser/inline/link.ts +58 -17
  43. package/src/parser/inline/mark.ts +3 -3
  44. package/src/parser/inline/math.test.ts +21 -14
  45. package/src/parser/inline/math.ts +7 -19
  46. package/src/parser/inline/media.test.ts +0 -2
  47. package/src/parser/inline/media.ts +10 -10
  48. package/src/parser/inline/reference.test.ts +6 -5
  49. package/src/parser/inline/reference.ts +12 -8
  50. package/src/parser/inline/ruby.ts +29 -27
  51. package/src/parser/inline/strong.ts +3 -3
  52. package/src/parser/inline/template.ts +4 -4
  53. package/src/parser/inline.test.ts +13 -8
  54. package/src/parser/inline.ts +1 -0
  55. package/src/parser/util.ts +35 -19
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.256.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.257.2 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("DOMPurify"), require("Prism"));
@@ -2099,7 +2099,7 @@ exports.isEmpty = isEmpty;
2099
2099
  Object.defineProperty(exports, "__esModule", ({
2100
2100
  value: true
2101
2101
  }));
2102
- exports.context = exports.reset = exports.guard = void 0;
2102
+ exports.precedence = exports.context = exports.reset = exports.guard = void 0;
2103
2103
 
2104
2104
  const global_1 = __webpack_require__(4128);
2105
2105
 
@@ -2155,6 +2155,18 @@ const inherit = (0, assign_1.template)((prop, target, source) => {
2155
2155
  }
2156
2156
  });
2157
2157
 
2158
+ function precedence(precedence, parser) {
2159
+ return (source, context) => {
2160
+ const p = context.precedence;
2161
+ context.precedence = precedence;
2162
+ const result = parser(source, context);
2163
+ context.precedence = p;
2164
+ return result;
2165
+ };
2166
+ }
2167
+
2168
+ exports.precedence = precedence;
2169
+
2158
2170
  /***/ }),
2159
2171
 
2160
2172
  /***/ 7957:
@@ -2420,7 +2432,7 @@ exports.recover = recover;
2420
2432
  Object.defineProperty(exports, "__esModule", ({
2421
2433
  value: true
2422
2434
  }));
2423
- exports.creator = void 0;
2435
+ exports.recursion = exports.uncreator = exports.creator = void 0;
2424
2436
 
2425
2437
  function creator(cost, parser) {
2426
2438
  if (typeof cost === 'function') return creator(1, cost);
@@ -2431,8 +2443,8 @@ function creator(cost, parser) {
2431
2443
  recursion: 1
2432
2444
  }
2433
2445
  } = context;
2434
- if (resources.budget <= 0) throw new Error('Too many creations.');
2435
- if (resources.recursion <= 0) throw new Error('Too much recursion.');
2446
+ if (resources.budget <= 0) throw new Error('Too many creations');
2447
+ if (resources.recursion <= 0) throw new Error('Too much recursion');
2436
2448
  --resources.recursion;
2437
2449
  const result = parser(source, context);
2438
2450
  ++resources.recursion;
@@ -2447,6 +2459,49 @@ function creator(cost, parser) {
2447
2459
 
2448
2460
  exports.creator = creator;
2449
2461
 
2462
+ function uncreator(cost, parser) {
2463
+ if (typeof cost === 'function') return uncreator(1, cost);
2464
+ return (source, context) => {
2465
+ const {
2466
+ resources = {
2467
+ budget: 1,
2468
+ recursion: 1
2469
+ }
2470
+ } = context;
2471
+ if (resources.budget <= 0) throw new Error('Too many creations');
2472
+ if (resources.recursion <= 0) throw new Error('Too much recursion');
2473
+ ++resources.recursion;
2474
+ const result = parser(source, context);
2475
+ --resources.recursion;
2476
+
2477
+ if (result) {
2478
+ resources.budget += cost;
2479
+ }
2480
+
2481
+ return result;
2482
+ };
2483
+ }
2484
+
2485
+ exports.uncreator = uncreator;
2486
+
2487
+ function recursion(cost, parser) {
2488
+ if (typeof cost === 'function') return recursion(1, cost);
2489
+ return (source, context) => {
2490
+ const {
2491
+ resources = {
2492
+ recursion: 1
2493
+ }
2494
+ } = context;
2495
+ if (resources.recursion <= 0) throw new Error('Too much recursion');
2496
+ --resources.recursion;
2497
+ const result = parser(source, context);
2498
+ ++resources.recursion;
2499
+ return result;
2500
+ };
2501
+ }
2502
+
2503
+ exports.recursion = recursion;
2504
+
2450
2505
  /***/ }),
2451
2506
 
2452
2507
  /***/ 1109:
@@ -2561,7 +2616,7 @@ function surround(opener, parser, closer, optional = false, f, g) {
2561
2616
  const rr = (0, parser_1.eval)(res3);
2562
2617
  const rest = (0, parser_1.exec)(res3, r_);
2563
2618
  if (rest.length === lmr_.length) return;
2564
- return rr ? f ? f([rl, rm, rr], rest, context) : [(0, array_1.push)((0, array_1.unshift)(rl, rm ?? []), rr), rest] : g ? g([rl, rm], rest, context) : global_1.undefined;
2619
+ return rr ? f ? f([rl, rm, rr], rest, context) : [(0, array_1.push)((0, array_1.unshift)(rl, rm ?? []), rr), rest] : g ? g([rl, rm, mr_], rest, context) : global_1.undefined;
2565
2620
  };
2566
2621
  }
2567
2622
 
@@ -2685,7 +2740,7 @@ exports.fmap = fmap;
2685
2740
  /***/ }),
2686
2741
 
2687
2742
  /***/ 6728:
2688
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2743
+ /***/ ((__unused_webpack_module, exports) => {
2689
2744
 
2690
2745
  "use strict";
2691
2746
 
@@ -2695,42 +2750,49 @@ Object.defineProperty(exports, "__esModule", ({
2695
2750
  }));
2696
2751
  exports.check = exports.exec = exports.eval = exports.Delimiters = void 0;
2697
2752
 
2698
- const global_1 = __webpack_require__(4128);
2699
-
2700
2753
  class Delimiters {
2701
2754
  constructor() {
2702
2755
  this.matchers = [];
2703
- this.record = {};
2704
- }
2705
-
2706
- push(delimiter) {
2707
- const {
2708
- signature,
2709
- matcher,
2710
- escape
2711
- } = delimiter;
2756
+ this.registry = {};
2757
+ this.length = 0;
2758
+ }
2759
+
2760
+ push(...delimiters) {
2761
+ for (let i = 0; i < delimiters.length; ++i) {
2762
+ const delimiter = delimiters[i];
2763
+ const {
2764
+ signature,
2765
+ matcher,
2766
+ precedence = 1
2767
+ } = delimiter;
2768
+
2769
+ if (!this.registry[signature]) {
2770
+ this.matchers.unshift([this.length, signature, precedence, matcher]);
2771
+ this.registry[signature] = true;
2772
+ }
2712
2773
 
2713
- if (this.record[signature] === !escape) {
2714
- this.matchers.unshift(() => global_1.undefined);
2715
- } else {
2716
- this.matchers.unshift(matcher);
2717
- this.record[signature] = !escape;
2774
+ ++this.length;
2718
2775
  }
2719
2776
  }
2720
2777
 
2721
- pop() {
2722
- this.matchers.shift();
2778
+ pop(count = 1) {
2779
+ for (let i = 0; i < count; ++i) {
2780
+ if (--this.length === this.matchers[0][0]) {
2781
+ this.registry[this.matchers.shift()[1]] = false;
2782
+ }
2783
+ }
2723
2784
  }
2724
2785
 
2725
- match(source) {
2786
+ match(source, precedence = 1) {
2726
2787
  const {
2727
2788
  matchers
2728
2789
  } = this;
2729
2790
 
2730
2791
  for (let i = 0; i < matchers.length; ++i) {
2731
- switch (matchers[i](source)) {
2792
+ switch (matchers[i][3](source)) {
2732
2793
  case true:
2733
- return true;
2794
+ if (precedence < matchers[i][2]) return true;
2795
+ continue;
2734
2796
 
2735
2797
  case false:
2736
2798
  return false;
@@ -2851,7 +2913,7 @@ exports.sequence = sequence;
2851
2913
  Object.defineProperty(exports, "__esModule", ({
2852
2914
  value: true
2853
2915
  }));
2854
- exports.escape = exports.some = void 0;
2916
+ exports.some = void 0;
2855
2917
 
2856
2918
  const global_1 = __webpack_require__(4128);
2857
2919
 
@@ -2887,29 +2949,28 @@ const matcher = (0, memoize_1.memoize)(pattern => {
2887
2949
  }
2888
2950
  }, signature);
2889
2951
 
2890
- function some(parser, until, deep, limit = -1) {
2891
- if (typeof until === 'number') return some(parser, global_1.undefined, deep, until);
2952
+ function some(parser, until, deeps = [], limit = -1) {
2953
+ if (typeof until === 'number') return some(parser, global_1.undefined, deeps, until);
2892
2954
  const match = matcher(until);
2893
- const delimiter = {
2894
- signature: signature(deep),
2895
- matcher: matcher(deep)
2896
- };
2955
+ const delimiters = deeps.map(([delimiter, precedence]) => ({
2956
+ signature: signature(delimiter),
2957
+ matcher: matcher(delimiter),
2958
+ precedence
2959
+ }));
2897
2960
  return (source, context) => {
2898
2961
  if (source === '') return;
2899
2962
  let rest = source;
2900
2963
  let nodes;
2901
2964
 
2902
- if (deep && context) {
2903
- // bracket > link > media | bracket
2904
- // bracket > index > bracket
2965
+ if (delimiters.length > 0) {
2905
2966
  context.delimiters ??= new parser_1.Delimiters();
2906
- context.delimiters.push(delimiter);
2967
+ context.delimiters.push(...delimiters);
2907
2968
  }
2908
2969
 
2909
2970
  while (true) {
2910
2971
  if (rest === '') break;
2911
2972
  if (match(rest)) break;
2912
- if (context.delimiters?.match(rest)) break;
2973
+ if (context.delimiters?.match(rest, context.precedence)) break;
2913
2974
  const result = parser(rest, context);
2914
2975
  if (!result) break;
2915
2976
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
@@ -2917,8 +2978,8 @@ function some(parser, until, deep, limit = -1) {
2917
2978
  if (limit >= 0 && source.length - rest.length > limit) break;
2918
2979
  }
2919
2980
 
2920
- if (deep && context.delimiters) {
2921
- context.delimiters.pop();
2981
+ if (delimiters.length > 0) {
2982
+ context.delimiters.pop(delimiters.length);
2922
2983
  }
2923
2984
 
2924
2985
  return nodes && rest.length < source.length ? [nodes, rest] : global_1.undefined;
@@ -2927,32 +2988,6 @@ function some(parser, until, deep, limit = -1) {
2927
2988
 
2928
2989
  exports.some = some;
2929
2990
 
2930
- function escape(parser, delim) {
2931
- const delimiter = {
2932
- signature: signature(delim),
2933
- matcher: source => source.slice(0, delim.length) !== delim && global_1.undefined,
2934
- escape: true
2935
- };
2936
- return (source, context) => {
2937
- if (source === '') return;
2938
-
2939
- if (context) {
2940
- context.delimiters ??= new parser_1.Delimiters();
2941
- context.delimiters.push(delimiter);
2942
- }
2943
-
2944
- const result = parser(source, context);
2945
-
2946
- if (context.delimiters) {
2947
- context.delimiters.pop();
2948
- }
2949
-
2950
- return result;
2951
- };
2952
- }
2953
-
2954
- exports.escape = escape;
2955
-
2956
2991
  /***/ }),
2957
2992
 
2958
2993
  /***/ 7005:
@@ -3154,8 +3189,6 @@ exports.bind = void 0;
3154
3189
 
3155
3190
  const global_1 = __webpack_require__(4128);
3156
3191
 
3157
- const alias_1 = __webpack_require__(5406);
3158
-
3159
3192
  const parser_1 = __webpack_require__(6728);
3160
3193
 
3161
3194
  const header_1 = __webpack_require__(5702);
@@ -3177,11 +3210,9 @@ const url_1 = __webpack_require__(2261);
3177
3210
  const array_1 = __webpack_require__(8112);
3178
3211
 
3179
3212
  function bind(target, settings) {
3180
- const context = (0, alias_1.ObjectAssign)((0, alias_1.ObjectCreate)(settings), {
3181
- host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
3182
- footnotes: global_1.undefined,
3183
- chunk: global_1.undefined
3184
- });
3213
+ let context = { ...settings,
3214
+ host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin)
3215
+ };
3185
3216
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3186
3217
  const blocks = [];
3187
3218
  const adds = [];
@@ -3195,12 +3226,13 @@ function bind(target, settings) {
3195
3226
  };
3196
3227
 
3197
3228
  function* parse(source) {
3198
- if (settings.chunk && revision) throw new Error('Chunks cannot be updated.');
3229
+ if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
3199
3230
  const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
3200
- 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));
3201
- (0, alias_1.ObjectAssign)(context, {
3231
+ 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)); // Change the object identity.
3232
+
3233
+ context = { ...context,
3202
3234
  url: url ? new url_1.ReadonlyURL(url) : global_1.undefined
3203
- });
3235
+ };
3204
3236
  const rev = revision = Symbol();
3205
3237
  const sourceSegments = [];
3206
3238
 
@@ -3637,7 +3669,7 @@ const random_1 = __webpack_require__(7325);
3637
3669
  exports.block = (0, combinator_1.creator)(error((0, combinator_1.reset)({
3638
3670
  resources: {
3639
3671
  budget: 50 * 1000,
3640
- recursion: 200
3672
+ recursion: 20 + 1
3641
3673
  }
3642
3674
  }, (0, combinator_1.union)([source_1.emptyline, horizontalrule_1.horizontalrule, heading_1.heading, ulist_1.ulist, olist_1.olist, ilist_1.ilist, dlist_1.dlist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, extension_1.extension, sidefence_1.sidefence, blockquote_1.blockquote, reply_1.reply, paragraph_1.paragraph]))));
3643
3675
 
@@ -5370,11 +5402,13 @@ const combinator_1 = __webpack_require__(2087);
5370
5402
 
5371
5403
  const inline_1 = __webpack_require__(1160);
5372
5404
 
5405
+ const link_1 = __webpack_require__(9628);
5406
+
5373
5407
  const util_1 = __webpack_require__(9437);
5374
5408
 
5375
5409
  const dom_1 = __webpack_require__(3252);
5376
5410
 
5377
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('((', (0, combinator_1.fmap)((0, combinator_1.surround)('((', (0, combinator_1.guard)(context => context.syntax?.inline?.annotation ?? true, (0, combinator_1.context)({
5411
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.recursion)((0, combinator_1.precedence)(6, (0, combinator_1.validate)('((', (0, combinator_1.surround)('((', (0, combinator_1.guard)(context => context.syntax?.inline?.annotation ?? true, (0, util_1.startLoose)((0, combinator_1.context)({
5378
5412
  syntax: {
5379
5413
  inline: {
5380
5414
  annotation: false,
@@ -5389,9 +5423,9 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0,
5389
5423
  }
5390
5424
  },
5391
5425
  delimiters: global_1.undefined
5392
- }, (0, util_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', /^\\?\n/)))), '))'), ns => [(0, dom_1.html)('sup', {
5426
+ }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')')), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5393
5427
  class: 'annotation'
5394
- }, [(0, dom_1.html)('span', (0, util_1.trimNodeEnd)((0, dom_1.defrag)(ns)))])]))));
5428
+ }, [(0, dom_1.html)('span', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ')' ? global_1.undefined : (0, link_1.optimize)('((', ns, rest)))))));
5395
5429
 
5396
5430
  /***/ }),
5397
5431
 
@@ -5454,14 +5488,7 @@ const source_1 = __webpack_require__(6743);
5454
5488
  const dom_1 = __webpack_require__(3252); // https://example/@user must be a user page or a redirect page going there.
5455
5489
 
5456
5490
 
5457
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), ([source]) => source.length <= 64)])), (0, combinator_1.context)({
5458
- syntax: {
5459
- inline: {
5460
- link: true,
5461
- autolink: false
5462
- }
5463
- }
5464
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5491
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), ([source]) => source.length <= 64)])), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5465
5492
  class: 'account'
5466
5493
  })]));
5467
5494
 
@@ -5490,14 +5517,7 @@ const dom_1 = __webpack_require__(3252); // Timeline(pseudonym): user/tid
5490
5517
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
5491
5518
 
5492
5519
 
5493
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.focus)(/^>>(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*\/)?[0-9A-Za-z]+(?:-[0-9A-Za-z]+)*(?![0-9A-Za-z@#:])/, (0, combinator_1.context)({
5494
- syntax: {
5495
- inline: {
5496
- link: true,
5497
- autolink: false
5498
- }
5499
- }
5500
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline/')}` : `?at=${source.slice(2)}`} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5520
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.focus)(/^>>(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*\/)?[0-9A-Za-z]+(?:-[0-9A-Za-z]+)*(?![0-9A-Za-z@#:])/, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline/')}` : `?at=${source.slice(2)}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5501
5521
  class: 'anchor'
5502
5522
  })])));
5503
5523
 
@@ -5584,14 +5604,7 @@ const source_1 = __webpack_require__(6743);
5584
5604
 
5585
5605
  const dom_1 = __webpack_require__(3252);
5586
5606
 
5587
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.context)({
5588
- syntax: {
5589
- inline: {
5590
- link: true,
5591
- autolink: false
5592
- }
5593
- }
5594
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5607
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5595
5608
  class: 'hashnum',
5596
5609
  href: null
5597
5610
  })]));
@@ -5620,14 +5633,7 @@ const dom_1 = __webpack_require__(3252); // https://example/hashtags/a must be a
5620
5633
 
5621
5634
 
5622
5635
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
5623
- exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.context)({
5624
- syntax: {
5625
- inline: {
5626
- link: true,
5627
- autolink: false
5628
- }
5629
- }
5630
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/hashtags/')}` : `/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5636
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/hashtags/')}` : `/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5631
5637
  class: 'hashtag'
5632
5638
  }, el.innerText)]));
5633
5639
 
@@ -5650,15 +5656,9 @@ const link_1 = __webpack_require__(9628);
5650
5656
 
5651
5657
  const source_1 = __webpack_require__(6743);
5652
5658
 
5653
- const closer = /^[-+*=~^,.;:!?]*(?=["`|\[\](){}<>]|\\?$)/;
5654
- exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.context)({
5655
- syntax: {
5656
- inline: {
5657
- link: true
5658
- }
5659
- }
5660
- }, (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.link]))))));
5661
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.some)(source_1.unescsource, '"'), '"', true)])));
5659
+ const closer = /^[-+*=~^,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
5660
+ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.textlink])))));
5661
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.unescsource, '"')), '"', true)]))));
5662
5662
 
5663
5663
  /***/ }),
5664
5664
 
@@ -5686,12 +5686,12 @@ const dom_1 = __webpack_require__(3252);
5686
5686
  const array_1 = __webpack_require__(8112);
5687
5687
 
5688
5688
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
5689
- exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(0, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, source_1.str)(index), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)(inline_1.inline, ')'), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5689
+ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(0, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5690
5690
  class: 'paren'
5691
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('('), (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0)))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)(inline_1.inline, ')'), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5691
+ }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5692
5692
  class: 'paren'
5693
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)(inline_1.inline, ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)(inline_1.inline, '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5694
- (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.some)(inline_1.inline, '"', '"'), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])])));
5693
+ }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]])), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]])), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5694
+ (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])])));
5695
5695
 
5696
5696
  /***/ }),
5697
5697
 
@@ -5743,11 +5743,11 @@ const memoize_1 = __webpack_require__(1808);
5743
5743
 
5744
5744
  const array_1 = __webpack_require__(8112);
5745
5745
 
5746
- exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[%', (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`)), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5746
+ exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.creator)((0, combinator_1.precedence)(4, (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5747
5747
  class: 'comment'
5748
5748
  }, [(0, dom_1.html)('input', {
5749
5749
  type: 'checkbox'
5750
- }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), ([, fence]) => fence.length, [])))));
5750
+ }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))])], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), ([, fence]) => fence.length, []))))));
5751
5751
 
5752
5752
  /***/ }),
5753
5753
 
@@ -5774,7 +5774,7 @@ const dom_1 = __webpack_require__(3252);
5774
5774
 
5775
5775
  const array_1 = __webpack_require__(8112);
5776
5776
 
5777
- exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5777
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
5778
5778
 
5779
5779
  /***/ }),
5780
5780
 
@@ -5805,7 +5805,7 @@ const dom_1 = __webpack_require__(3252);
5805
5805
 
5806
5806
  const array_1 = __webpack_require__(8112);
5807
5807
 
5808
- exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('*'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*'), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5808
+ exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('*'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*'), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
5809
5809
 
5810
5810
  /***/ }),
5811
5811
 
@@ -5838,7 +5838,7 @@ const array_1 = __webpack_require__(8112);
5838
5838
 
5839
5839
  const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong]))])));
5840
5840
  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, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
5841
- exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('***'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
5841
+ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('***'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
5842
5842
  switch (cs[0]) {
5843
5843
  case '***':
5844
5844
  return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
@@ -5849,7 +5849,7 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, co
5849
5849
  case '*':
5850
5850
  return (0, combinator_1.bind)(substrong, (ds, rest) => rest.slice(0, 2) === '**' ? [[(0, dom_1.html)('strong', (0, array_1.unshift)([(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(2)] : [(0, array_1.unshift)(['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], ds), rest])(rest, context) ?? [['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest];
5851
5851
  }
5852
- }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5852
+ }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
5853
5853
 
5854
5854
  /***/ }),
5855
5855
 
@@ -5939,7 +5939,7 @@ const util_1 = __webpack_require__(9437);
5939
5939
 
5940
5940
  const dom_1 = __webpack_require__(3252);
5941
5941
 
5942
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[#', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.fmap)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => context.syntax?.inline?.index ?? true, (0, util_1.startTight)((0, combinator_1.context)({
5942
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => context.syntax?.inline?.index ?? true, (0, util_1.startTight)((0, combinator_1.context)({
5943
5943
  syntax: {
5944
5944
  inline: {
5945
5945
  annotation: false,
@@ -5951,16 +5951,16 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combi
5951
5951
  autolink: false
5952
5952
  }
5953
5953
  }
5954
- }, (0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, util_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', /^\\?\n/)), true)))), ']'), ns => [(0, dom_1.html)('a', (0, dom_1.defrag)(ns))])), ([el]) => [(0, dom_1.define)(el, {
5954
+ }, (0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, util_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
5955
5955
  id: el.id ? null : global_1.undefined,
5956
5956
  class: 'index',
5957
5957
  href: el.id ? `#${el.id}` : global_1.undefined
5958
- }, el.childNodes)]))));
5958
+ }, el.childNodes)])))));
5959
5959
  const signature = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.open)('|#', (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']'))), ns => [(0, dom_1.html)('span', {
5960
5960
  class: 'indexer',
5961
5961
  'data-index': (0, indexee_1.identity)(ns.join('')).slice(6)
5962
5962
  })])));
5963
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.some)(source_1.txt, '"'), (0, source_1.str)('"'), true)])));
5963
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.txt, '"')), (0, source_1.str)('"'), true)])));
5964
5964
 
5965
5965
  /***/ }),
5966
5966
 
@@ -6061,15 +6061,11 @@ const combinator_1 = __webpack_require__(2087);
6061
6061
 
6062
6062
  const index_1 = __webpack_require__(4479);
6063
6063
 
6064
+ const util_1 = __webpack_require__(9437);
6065
+
6064
6066
  const dom_1 = __webpack_require__(3252);
6065
6067
 
6066
- exports.indexer = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[#\S)/, (0, combinator_1.context)({
6067
- syntax: {
6068
- inline: {
6069
- index: true
6070
- }
6071
- }
6072
- }, (0, combinator_1.union)([(0, combinator_1.focus)('[#]', () => [[(0, dom_1.html)('a', {
6068
+ exports.indexer = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[#\S)/, (0, util_1.clean)((0, combinator_1.union)([(0, combinator_1.focus)('[#]', () => [[(0, dom_1.html)('a', {
6073
6069
  href: '#'
6074
6070
  })], '']), index_1.index])), /^\s*$/), // Indexer is invisible but invalids must be visible.
6075
6071
  ([el]) => el.getElementsByClassName('invalid').length === 0), ([el]) => [(0, dom_1.html)('span', {
@@ -6100,7 +6096,7 @@ const dom_1 = __webpack_require__(3252);
6100
6096
 
6101
6097
  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]))/);
6102
6098
  exports.segment = (0, combinator_1.clear)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])));
6103
- exports.label = (0, combinator_1.creator)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.fmap)((0, combinator_1.guard)(context => context.syntax?.inline?.label ?? true, (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])), ([text]) => [(0, dom_1.html)('a', {
6099
+ exports.label = (0, combinator_1.validate)(['[$', '$'], (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.guard)(context => context.syntax?.inline?.label ?? true, (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])), ([text]) => [(0, dom_1.html)('a', {
6104
6100
  class: 'label',
6105
6101
  'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
6106
6102
  }, text)])));
@@ -6156,12 +6152,12 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
6156
6152
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6157
6153
 
6158
6154
 
6159
- exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', /^\\?\n/)), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6155
+ exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6160
6156
  class: 'invalid',
6161
6157
  'data-invalid-syntax': 'extension',
6162
6158
  'data-invalid-type': 'syntax',
6163
6159
  'data-invalid-message': `Reserved start symbol "${as[0][1]}" cannot be used in "[]"`
6164
- }, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6160
+ }, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])))));
6165
6161
 
6166
6162
  /***/ }),
6167
6163
 
@@ -6202,8 +6198,8 @@ const attrspecs = {
6202
6198
  };
6203
6199
  global_1.Object.setPrototypeOf(attrspecs, null);
6204
6200
  global_1.Object.values(attrspecs).forEach(o => global_1.Object.setPrototypeOf(o, null));
6205
- exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([(0, combinator_1.focus)('<wbr>', () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.focus)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6206
- /^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/, source => [[source], '']), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (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, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true))]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => TAGS.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/, (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, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`)]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
6201
+ exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.creator)((0, combinator_1.precedence)(5, (0, combinator_1.union)([(0, combinator_1.focus)('<wbr>', () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.focus)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6202
+ /^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/, source => [[source], '']), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (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, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`), [[(0, util_1.blankWith)('\n', `</${tag}>`), 5]]), true))]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => TAGS.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/, (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, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 5]])]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))]))))));
6207
6203
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]); // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
6208
6204
  // [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
6209
6205
 
@@ -6317,7 +6313,7 @@ const dom_1 = __webpack_require__(3252);
6317
6313
 
6318
6314
  const array_1 = __webpack_require__(8112);
6319
6315
 
6320
- exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
6316
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6321
6317
 
6322
6318
  /***/ }),
6323
6319
 
@@ -6330,7 +6326,7 @@ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, c
6330
6326
  Object.defineProperty(exports, "__esModule", ({
6331
6327
  value: true
6332
6328
  }));
6333
- exports.resolve = exports.option = exports.uri = exports.link = void 0;
6329
+ exports.optimize = exports.resolve = exports.option = exports.uri = exports.textlink = exports.link = void 0;
6334
6330
 
6335
6331
  const global_1 = __webpack_require__(4128);
6336
6332
 
@@ -6356,7 +6352,7 @@ const optspec = {
6356
6352
  rel: ['nofollow']
6357
6353
  };
6358
6354
  Object.setPrototypeOf(optspec, null);
6359
- exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.validate)(['[', '{'], (0, combinator_1.bind)((0, combinator_1.guard)(context => context.syntax?.inline?.link ?? true, (0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.context)({
6355
+ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (0, combinator_1.bind)((0, combinator_1.guard)(context => context.syntax?.inline?.link ?? true, (0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.context)({
6360
6356
  syntax: {
6361
6357
  inline: {
6362
6358
  link: false
@@ -6375,15 +6371,25 @@ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, co
6375
6371
  autolink: false
6376
6372
  }
6377
6373
  }
6378
- }, (0, util_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))), ']', true)]))), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))]))), ([params, content = []], rest, context) => {
6379
- content = (0, util_1.trimNodeEnd)(content);
6374
+ }, (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2]])), ']', true, global_1.undefined, ([, ns = [], rest], next) => next[0] === ']' ? global_1.undefined : optimize('[', ns, rest))]))), // 全体の失敗が確定した時も解析し予算を浪費している
6375
+ (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))]), ([as, bs = []]) => bs[0] === '\r' && bs.shift() ? [as, bs] : as[0] === '\r' && as.shift() ? [[], as] : [as, []])), ([content, params], rest, context) => {
6376
+ if (params.length === 0) return;
6377
+ if (content[0] === '') return [content, rest];
6378
+ if (content.length !== 0 && (0, util_1.trimNode)(content).length === 0) return;
6380
6379
  if ((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context))?.some(node => typeof node === 'object')) return;
6381
6380
  const INSECURE_URI = params.shift();
6382
6381
  const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
6383
6382
  if (el.classList.contains('invalid')) return [[el], rest];
6384
6383
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6385
- }))));
6386
- exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
6384
+ })))));
6385
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (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)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => {
6386
+ params.shift();
6387
+ (0, util_1.trimNode)(content);
6388
+ const INSECURE_URI = params.shift();
6389
+ const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
6390
+ return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6391
+ })))));
6392
+ exports.uri = (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]), ([uri]) => ['\r', uri]);
6387
6393
  exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]), (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\s{}]+/), opt => [` \\${opt.slice(1)}`])]);
6388
6394
 
6389
6395
  function resolve(uri, host, source) {
@@ -6460,6 +6466,19 @@ function decode(uri) {
6460
6466
  }
6461
6467
  }
6462
6468
 
6469
+ function optimize(opener, ns, rest) {
6470
+ let count = 0;
6471
+
6472
+ for (let i = 0; i < ns.length - 1; i += 2) {
6473
+ if (ns[i] !== '' || ns[i + 1] !== opener[0]) break;
6474
+ ++count;
6475
+ }
6476
+
6477
+ return [['', opener[0].repeat(opener.length + count)], rest.slice(count)];
6478
+ }
6479
+
6480
+ exports.optimize = optimize;
6481
+
6463
6482
  /***/ }),
6464
6483
 
6465
6484
  /***/ 2480:
@@ -6485,7 +6504,7 @@ const dom_1 = __webpack_require__(3252);
6485
6504
 
6486
6505
  const array_1 = __webpack_require__(8112);
6487
6506
 
6488
- exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)]))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
6507
+ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)]))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6489
6508
 
6490
6509
  /***/ }),
6491
6510
 
@@ -6506,9 +6525,8 @@ const source_1 = __webpack_require__(6743);
6506
6525
 
6507
6526
  const dom_1 = __webpack_require__(3252);
6508
6527
 
6509
- const syntax = /^(?:[ "([](?!\$)|\\{(?!\$)|\\[\\}$]?|^`|`(?!`)|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/;
6510
6528
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
6511
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('$', (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', bracket, '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.some)((0, combinator_1.union)([bracket, quote, (0, source_1.str)(syntax)])), /^\$(?![0-9A-Za-z])/)]), (source, {
6529
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creator)((0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', (0, combinator_1.precedence)(6, bracket), '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.precedence)(3, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.focus)(/^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/, (0, combinator_1.some)(source_1.unescsource))]))), /^\$(?![0-9A-Za-z])/)]), (source, {
6512
6530
  caches: {
6513
6531
  math: cache
6514
6532
  } = {}
@@ -6524,7 +6542,6 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combin
6524
6542
  'data-invalid-message': `"${source.match(forbiddenCommand)[0]}" command is forbidden`
6525
6543
  }, source)], '']))));
6526
6544
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /^(?:[{}$]|\\?\n)/)])), '}', true)));
6527
- const quote = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)('``', (0, combinator_1.some)((0, combinator_1.union)([quote, bracket, (0, combinator_1.focus)(/^(?:\\[\\{}$]|`(?!`)|[^`{}"$\n\P{ASCII}])*/u, (0, source_1.str)(syntax))])), /^"?/, true)));
6528
6545
 
6529
6546
  /***/ }),
6530
6547
 
@@ -6564,7 +6581,7 @@ const optspec = {
6564
6581
  rel: global_1.undefined
6565
6582
  };
6566
6583
  Object.setPrototypeOf(optspec, null);
6567
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => context.syntax?.inline?.media ?? true, (0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)(/^\[(?!\s*\\\s)/, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', /^\\?\n/), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]))), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6584
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => context.syntax?.inline?.media ?? true, (0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]))), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], (0, array_1.shift)(bs)[1]] : [[''], (0, array_1.shift)(as)[1]]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6568
6585
  const INSECURE_URI = params.shift();
6569
6586
  const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href);
6570
6587
  let cache;
@@ -6583,11 +6600,11 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, c
6583
6600
  }
6584
6601
 
6585
6602
  if (context.syntax?.inline?.link === false || cache && cache.tagName !== 'IMG') return [[el], rest];
6586
- return (0, combinator_1.fmap)(link_1.link, ([link]) => [(0, dom_1.define)(link, {
6603
+ return (0, combinator_1.fmap)(link_1.textlink, ([link]) => [(0, dom_1.define)(link, {
6587
6604
  target: '_blank'
6588
6605
  }, [el])])(`{ ${INSECURE_URI}${params.join('')} }${rest}`, context);
6589
- }))));
6590
- const bracket = (0, combinator_1.lazy)(() => (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"'), (0, source_1.str)('"'), true)]));
6606
+ })))));
6607
+ const bracket = (0, combinator_1.lazy)(() => (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (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, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true)]));
6591
6608
  const option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]);
6592
6609
 
6593
6610
  function sanitize(target, uri, alt) {
@@ -6649,13 +6666,15 @@ const combinator_1 = __webpack_require__(2087);
6649
6666
 
6650
6667
  const inline_1 = __webpack_require__(1160);
6651
6668
 
6669
+ const link_1 = __webpack_require__(9628);
6670
+
6652
6671
  const source_1 = __webpack_require__(6743);
6653
6672
 
6654
6673
  const util_1 = __webpack_require__(9437);
6655
6674
 
6656
6675
  const dom_1 = __webpack_require__(3252);
6657
6676
 
6658
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[[', (0, combinator_1.fmap)((0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => context.syntax?.inline?.reference ?? true, (0, combinator_1.context)({
6677
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[[', (0, combinator_1.creator)((0, combinator_1.recursion)((0, combinator_1.precedence)(6, (0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => context.syntax?.inline?.reference ?? true, (0, util_1.startLoose)((0, combinator_1.context)({
6659
6678
  syntax: {
6660
6679
  inline: {
6661
6680
  annotation: false,
@@ -6669,7 +6688,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, c
6669
6688
  }
6670
6689
  },
6671
6690
  delimiters: global_1.undefined
6672
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/)), (0, util_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))]))), ']]'), ns => [(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, util_1.trimNodeEnd)((0, dom_1.defrag)(ns)))])]))));
6691
+ }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']')), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : (0, link_1.optimize)('[[', ns, rest)))))));
6673
6692
  const abbr = (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(util_1.regBlankStart, '')]));
6674
6693
 
6675
6694
  function attributes(ns) {
@@ -6715,19 +6734,18 @@ const dom_1 = __webpack_require__(3252);
6715
6734
 
6716
6735
  const array_1 = __webpack_require__(8112);
6717
6736
 
6718
- exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\[\]\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\(\)\n])+(?=\))/, text), ')')]), ([texts]) => (0, util_1.isStartTightNodes)(texts)), ([texts, rubies], rest) => {
6719
- const tail = typeof texts[texts.length - 1] === 'object' ? [texts.pop()] : [];
6720
- tail.length === 0 && texts[texts.length - 1] === '' && texts.pop();
6737
+ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=\))/, text), ')')]), ([texts]) => (0, util_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
6738
+ texts[texts.length - 1] === '' && texts.pop();
6721
6739
 
6722
6740
  switch (true) {
6723
6741
  case rubies.length <= texts.length:
6724
- return [[(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)((0, array_1.push)(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')])), []), tail)))], rest];
6742
+ return [(0, dom_1.html)('ruby', attributes(texts, rubies), (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')])), [])))];
6725
6743
 
6726
6744
  case texts.length === 1 && [...texts[0]].length >= rubies.length:
6727
- return [[(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)((0, array_1.push)([...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')])), []), tail)))], rest];
6745
+ return [(0, dom_1.html)('ruby', attributes(texts, rubies), (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')])), [])))];
6728
6746
 
6729
6747
  default:
6730
- return [[(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)([texts.join(' ')], [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies.join(' ').trim()), (0, dom_1.html)('rp', ')')]), tail)))], rest];
6748
+ return [(0, dom_1.html)('ruby', attributes(texts, rubies), (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', ')')])))];
6731
6749
  }
6732
6750
  }))));
6733
6751
  const text = (0, combinator_1.creator)((source, context) => {
@@ -6834,7 +6852,7 @@ const dom_1 = __webpack_require__(3252);
6834
6852
 
6835
6853
  const array_1 = __webpack_require__(8112);
6836
6854
 
6837
- exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('**'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*'), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
6855
+ exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('**'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*'), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6838
6856
 
6839
6857
  /***/ }),
6840
6858
 
@@ -6859,10 +6877,10 @@ const dom_1 = __webpack_require__(3252);
6859
6877
 
6860
6878
  const array_1 = __webpack_require__(8112);
6861
6879
 
6862
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.rewrite)((0, combinator_1.surround)('{{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), '}}', true), source => [[(0, dom_1.html)('span', {
6880
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.rewrite)((0, combinator_1.surround)('{{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), '}}', true), source => [[(0, dom_1.html)('span', {
6863
6881
  class: 'template'
6864
- }, source.replace(/\x1B/g, ''))], ''])));
6865
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/), (0, source_1.str)('"'), true)]));
6882
+ }, source.replace(/\x1B/g, ''))], '']))));
6883
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/)), (0, source_1.str)('"'), true)]));
6866
6884
 
6867
6885
  /***/ }),
6868
6886
 
@@ -7761,7 +7779,7 @@ exports.unescsource = (0, combinator_1.creator)(source => {
7761
7779
  Object.defineProperty(exports, "__esModule", ({
7762
7780
  value: true
7763
7781
  }));
7764
- exports.stringify = exports.trimNodeEnd = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = void 0;
7782
+ exports.stringify = exports.trimNode = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = exports.clean = void 0;
7765
7783
 
7766
7784
  const global_1 = __webpack_require__(4128);
7767
7785
 
@@ -7779,6 +7797,21 @@ const memoize_1 = __webpack_require__(1808);
7779
7797
 
7780
7798
  const array_1 = __webpack_require__(8112);
7781
7799
 
7800
+ function clean(parser) {
7801
+ const clean = (0, memoize_1.memoize)(context => ({
7802
+ resources: context.resources,
7803
+ precedence: context.precedence,
7804
+ delimiters: context.delimiters,
7805
+ host: context.host,
7806
+ url: context.url,
7807
+ id: context.id,
7808
+ header: context.header,
7809
+ cache: context.caches
7810
+ }), new WeakMap());
7811
+ return (source, context) => parser(source, context.syntax ? clean(context) : context);
7812
+ }
7813
+
7814
+ exports.clean = clean;
7782
7815
  exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
7783
7816
 
7784
7817
  function blankWith(starting, delimiter) {
@@ -7941,23 +7974,32 @@ function trimBlankEnd(parser) {
7941
7974
  return (0, combinator_1.fmap)(parser, trimNodeEnd);
7942
7975
  }
7943
7976
 
7944
- exports.trimBlankEnd = trimBlankEnd; //export function trimNode(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
7945
- // return trimNodeStart(trimNodeEnd(nodes));
7946
- //}
7947
- //function trimNodeStart(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
7948
- // for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
7949
- // if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer') break;
7950
- // if (typeof node === 'string') {
7951
- // const pos = node.length - node.trimStart().length;
7952
- // if (pos > 0) {
7953
- // nodes[0] = node.slice(pos);
7954
- // break;
7955
- // }
7956
- // }
7957
- // nodes.shift();
7958
- // }
7959
- // return nodes;
7960
- //}
7977
+ exports.trimBlankEnd = trimBlankEnd;
7978
+
7979
+ function trimNode(nodes) {
7980
+ return trimNodeStart(trimNodeEnd(nodes));
7981
+ }
7982
+
7983
+ exports.trimNode = trimNode;
7984
+
7985
+ function trimNodeStart(nodes) {
7986
+ for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
7987
+ if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer') break;
7988
+
7989
+ if (typeof node === 'string') {
7990
+ const pos = node.trimStart().length;
7991
+
7992
+ if (pos > 0) {
7993
+ nodes[0] = node.slice(pos);
7994
+ break;
7995
+ }
7996
+ }
7997
+
7998
+ nodes.shift();
7999
+ }
8000
+
8001
+ return nodes;
8002
+ }
7961
8003
 
7962
8004
  function trimNodeEnd(nodes) {
7963
8005
  const skip = nodes.length > 0 && typeof nodes[nodes.length - 1] === 'object' && nodes[nodes.length - 1]['className'] === 'indexer' ? [nodes.pop()] : [];
@@ -7978,8 +8020,6 @@ function trimNodeEnd(nodes) {
7978
8020
  return (0, array_1.push)(nodes, skip);
7979
8021
  }
7980
8022
 
7981
- exports.trimNodeEnd = trimNodeEnd;
7982
-
7983
8023
  function stringify(nodes) {
7984
8024
  let acc = '';
7985
8025