securemark 0.255.0 → 0.257.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 (52) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.js +209 -170
  3. package/markdown.d.ts +18 -11
  4. package/package.json +1 -1
  5. package/src/combinator/control/constraint/contract.ts +3 -13
  6. package/src/combinator/control/manipulation/context.ts +12 -7
  7. package/src/combinator/control/manipulation/resource.ts +37 -3
  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 +51 -9
  16. package/src/parser/api/parse.ts +6 -5
  17. package/src/parser/block/extension/aside.ts +3 -3
  18. package/src/parser/block/extension/example.ts +3 -3
  19. package/src/parser/block.ts +1 -1
  20. package/src/parser/inline/annotation.test.ts +6 -5
  21. package/src/parser/inline/annotation.ts +9 -6
  22. package/src/parser/inline/autolink/url.ts +6 -6
  23. package/src/parser/inline/bracket.test.ts +11 -7
  24. package/src/parser/inline/bracket.ts +11 -11
  25. package/src/parser/inline/comment.test.ts +4 -3
  26. package/src/parser/inline/comment.ts +4 -4
  27. package/src/parser/inline/deletion.ts +3 -3
  28. package/src/parser/inline/emphasis.ts +3 -3
  29. package/src/parser/inline/emstrong.ts +4 -5
  30. package/src/parser/inline/extension/index.test.ts +1 -0
  31. package/src/parser/inline/extension/index.ts +8 -7
  32. package/src/parser/inline/extension/indexer.ts +3 -5
  33. package/src/parser/inline/extension/label.ts +1 -1
  34. package/src/parser/inline/extension/placeholder.test.ts +8 -7
  35. package/src/parser/inline/extension/placeholder.ts +4 -4
  36. package/src/parser/inline/html.test.ts +2 -0
  37. package/src/parser/inline/html.ts +5 -5
  38. package/src/parser/inline/insertion.ts +3 -3
  39. package/src/parser/inline/link.test.ts +1 -0
  40. package/src/parser/inline/link.ts +8 -7
  41. package/src/parser/inline/mark.ts +3 -3
  42. package/src/parser/inline/math.test.ts +21 -14
  43. package/src/parser/inline/math.ts +4 -15
  44. package/src/parser/inline/media.test.ts +0 -2
  45. package/src/parser/inline/media.ts +6 -6
  46. package/src/parser/inline/reference.test.ts +9 -9
  47. package/src/parser/inline/reference.ts +19 -7
  48. package/src/parser/inline/ruby.ts +29 -27
  49. package/src/parser/inline/strong.ts +3 -3
  50. package/src/parser/inline/template.ts +4 -4
  51. package/src/parser/inline.test.ts +13 -10
  52. package/src/parser/util.ts +18 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.255.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.257.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("DOMPurify"), require("Prism"));
@@ -2009,22 +2009,13 @@ const alias_1 = __webpack_require__(5406);
2009
2009
 
2010
2010
  const parser_1 = __webpack_require__(6728);
2011
2011
 
2012
- function validate(patterns, has, end, parser) {
2013
- if (typeof has === 'function') return validate(patterns, '', '', has);
2014
- if (typeof end === 'function') return validate(patterns, has, '', end);
2015
- if (!(0, alias_1.isArray)(patterns)) return validate([patterns], has, end, parser);
2012
+ function validate(patterns, has, parser) {
2013
+ if (typeof has === 'function') return validate(patterns, '', has);
2014
+ if (!(0, alias_1.isArray)(patterns)) return validate([patterns], has, parser);
2016
2015
  const match = (0, global_1.Function)(['"use strict";', 'return source =>', '0', ...patterns.map(pattern => typeof pattern === 'string' ? `|| source.slice(0, ${pattern.length}) === '${pattern}'` : `|| /${pattern.source}/${pattern.flags}.test(source)`)].join(''))();
2017
-
2018
- const match2 = source => {
2019
- if (!has) return true;
2020
- const i = end ? source.indexOf(end, 1) : -1;
2021
- return i !== -1 ? source.slice(0, i).indexOf(has, 1) !== -1 : source.indexOf(has, 1) !== -1;
2022
- };
2023
-
2024
2016
  return (source, context) => {
2025
2017
  if (source === '') return;
2026
2018
  if (!match(source)) return;
2027
- if (!match2(source)) return;
2028
2019
  const result = parser(source, context);
2029
2020
  if (!result) return;
2030
2021
  return (0, parser_1.exec)(result).length < source.length ? result : global_1.undefined;
@@ -2108,7 +2099,7 @@ exports.isEmpty = isEmpty;
2108
2099
  Object.defineProperty(exports, "__esModule", ({
2109
2100
  value: true
2110
2101
  }));
2111
- exports.context = exports.reset = exports.guard = void 0;
2102
+ exports.precedence = exports.context = exports.reset = exports.guard = void 0;
2112
2103
 
2113
2104
  const global_1 = __webpack_require__(4128);
2114
2105
 
@@ -2127,14 +2118,12 @@ function guard(f, parser) {
2127
2118
  exports.guard = guard;
2128
2119
 
2129
2120
  function reset(base, parser) {
2130
- if (isEmpty(base)) return parser;
2131
2121
  return (source, context) => parser(source, inherit((0, alias_1.ObjectCreate)(context), base));
2132
2122
  }
2133
2123
 
2134
2124
  exports.reset = reset;
2135
2125
 
2136
2126
  function context(base, parser) {
2137
- if (isEmpty(base)) return parser;
2138
2127
  const override = (0, memoize_1.memoize)(context => inherit((0, alias_1.ObjectCreate)(context), base), new global_1.WeakMap());
2139
2128
  return (source, context) => parser(source, override(context));
2140
2129
  }
@@ -2166,12 +2155,18 @@ const inherit = (0, assign_1.template)((prop, target, source) => {
2166
2155
  }
2167
2156
  });
2168
2157
 
2169
- function isEmpty(context) {
2170
- for (const _ in context) return false;
2171
-
2172
- return true;
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
+ };
2173
2166
  }
2174
2167
 
2168
+ exports.precedence = precedence;
2169
+
2175
2170
  /***/ }),
2176
2171
 
2177
2172
  /***/ 7957:
@@ -2437,7 +2432,7 @@ exports.recover = recover;
2437
2432
  Object.defineProperty(exports, "__esModule", ({
2438
2433
  value: true
2439
2434
  }));
2440
- exports.creator = void 0;
2435
+ exports.recursion = exports.uncreator = exports.creator = void 0;
2441
2436
 
2442
2437
  function creator(cost, parser) {
2443
2438
  if (typeof cost === 'function') return creator(1, cost);
@@ -2448,8 +2443,8 @@ function creator(cost, parser) {
2448
2443
  recursion: 1
2449
2444
  }
2450
2445
  } = context;
2451
- if (resources.budget <= 0) throw new Error('Too many creations.');
2452
- 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');
2453
2448
  --resources.recursion;
2454
2449
  const result = parser(source, context);
2455
2450
  ++resources.recursion;
@@ -2464,6 +2459,49 @@ function creator(cost, parser) {
2464
2459
 
2465
2460
  exports.creator = creator;
2466
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
+
2467
2505
  /***/ }),
2468
2506
 
2469
2507
  /***/ 1109:
@@ -2578,7 +2616,7 @@ function surround(opener, parser, closer, optional = false, f, g) {
2578
2616
  const rr = (0, parser_1.eval)(res3);
2579
2617
  const rest = (0, parser_1.exec)(res3, r_);
2580
2618
  if (rest.length === lmr_.length) return;
2581
- 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;
2582
2620
  };
2583
2621
  }
2584
2622
 
@@ -2702,7 +2740,7 @@ exports.fmap = fmap;
2702
2740
  /***/ }),
2703
2741
 
2704
2742
  /***/ 6728:
2705
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2743
+ /***/ ((__unused_webpack_module, exports) => {
2706
2744
 
2707
2745
  "use strict";
2708
2746
 
@@ -2712,42 +2750,49 @@ Object.defineProperty(exports, "__esModule", ({
2712
2750
  }));
2713
2751
  exports.check = exports.exec = exports.eval = exports.Delimiters = void 0;
2714
2752
 
2715
- const global_1 = __webpack_require__(4128);
2716
-
2717
2753
  class Delimiters {
2718
2754
  constructor() {
2719
2755
  this.matchers = [];
2720
- this.record = {};
2721
- }
2722
-
2723
- push(delimiter) {
2724
- const {
2725
- signature,
2726
- matcher,
2727
- escape
2728
- } = 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
+ }
2729
2773
 
2730
- if (this.record[signature] === !escape) {
2731
- this.matchers.unshift(() => global_1.undefined);
2732
- } else {
2733
- this.matchers.unshift(matcher);
2734
- this.record[signature] = !escape;
2774
+ ++this.length;
2735
2775
  }
2736
2776
  }
2737
2777
 
2738
- pop() {
2739
- 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
+ }
2740
2784
  }
2741
2785
 
2742
- match(source) {
2786
+ match(source, precedence = 1) {
2743
2787
  const {
2744
2788
  matchers
2745
2789
  } = this;
2746
2790
 
2747
2791
  for (let i = 0; i < matchers.length; ++i) {
2748
- switch (matchers[i](source)) {
2792
+ switch (matchers[i][3](source)) {
2749
2793
  case true:
2750
- return true;
2794
+ if (precedence < matchers[i][2]) return true;
2795
+ continue;
2751
2796
 
2752
2797
  case false:
2753
2798
  return false;
@@ -2868,7 +2913,7 @@ exports.sequence = sequence;
2868
2913
  Object.defineProperty(exports, "__esModule", ({
2869
2914
  value: true
2870
2915
  }));
2871
- exports.escape = exports.some = void 0;
2916
+ exports.some = void 0;
2872
2917
 
2873
2918
  const global_1 = __webpack_require__(4128);
2874
2919
 
@@ -2904,29 +2949,28 @@ const matcher = (0, memoize_1.memoize)(pattern => {
2904
2949
  }
2905
2950
  }, signature);
2906
2951
 
2907
- function some(parser, until, deep, limit = -1) {
2908
- 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);
2909
2954
  const match = matcher(until);
2910
- const delimiter = {
2911
- signature: signature(deep),
2912
- matcher: matcher(deep)
2913
- };
2955
+ const delimiters = deeps.map(([delimiter, precedence]) => ({
2956
+ signature: signature(delimiter),
2957
+ matcher: matcher(delimiter),
2958
+ precedence
2959
+ }));
2914
2960
  return (source, context) => {
2915
2961
  if (source === '') return;
2916
2962
  let rest = source;
2917
2963
  let nodes;
2918
2964
 
2919
- if (deep && context) {
2920
- // bracket > link > media | bracket
2921
- // bracket > index > bracket
2965
+ if (delimiters.length > 0) {
2922
2966
  context.delimiters ??= new parser_1.Delimiters();
2923
- context.delimiters.push(delimiter);
2967
+ context.delimiters.push(...delimiters);
2924
2968
  }
2925
2969
 
2926
2970
  while (true) {
2927
2971
  if (rest === '') break;
2928
2972
  if (match(rest)) break;
2929
- if (context.delimiters?.match(rest)) break;
2973
+ if (context.delimiters?.match(rest, context.precedence)) break;
2930
2974
  const result = parser(rest, context);
2931
2975
  if (!result) break;
2932
2976
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
@@ -2934,8 +2978,8 @@ function some(parser, until, deep, limit = -1) {
2934
2978
  if (limit >= 0 && source.length - rest.length > limit) break;
2935
2979
  }
2936
2980
 
2937
- if (deep && context.delimiters) {
2938
- context.delimiters.pop();
2981
+ if (delimiters.length > 0) {
2982
+ context.delimiters.pop(delimiters.length);
2939
2983
  }
2940
2984
 
2941
2985
  return nodes && rest.length < source.length ? [nodes, rest] : global_1.undefined;
@@ -2944,32 +2988,6 @@ function some(parser, until, deep, limit = -1) {
2944
2988
 
2945
2989
  exports.some = some;
2946
2990
 
2947
- function escape(parser, delim) {
2948
- const delimiter = {
2949
- signature: signature(delim),
2950
- matcher: source => source.slice(0, delim.length) !== delim && global_1.undefined,
2951
- escape: true
2952
- };
2953
- return (source, context) => {
2954
- if (source === '') return;
2955
-
2956
- if (context) {
2957
- context.delimiters ??= new parser_1.Delimiters();
2958
- context.delimiters.push(delimiter);
2959
- }
2960
-
2961
- const result = parser(source, context);
2962
-
2963
- if (context.delimiters) {
2964
- context.delimiters.pop();
2965
- }
2966
-
2967
- return result;
2968
- };
2969
- }
2970
-
2971
- exports.escape = escape;
2972
-
2973
2991
  /***/ }),
2974
2992
 
2975
2993
  /***/ 7005:
@@ -3171,8 +3189,6 @@ exports.bind = void 0;
3171
3189
 
3172
3190
  const global_1 = __webpack_require__(4128);
3173
3191
 
3174
- const alias_1 = __webpack_require__(5406);
3175
-
3176
3192
  const parser_1 = __webpack_require__(6728);
3177
3193
 
3178
3194
  const header_1 = __webpack_require__(5702);
@@ -3194,11 +3210,9 @@ const url_1 = __webpack_require__(2261);
3194
3210
  const array_1 = __webpack_require__(8112);
3195
3211
 
3196
3212
  function bind(target, settings) {
3197
- const context = (0, alias_1.ObjectAssign)((0, alias_1.ObjectCreate)(settings), {
3198
- host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
3199
- footnotes: global_1.undefined,
3200
- chunk: global_1.undefined
3201
- });
3213
+ let context = { ...settings,
3214
+ host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin)
3215
+ };
3202
3216
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3203
3217
  const blocks = [];
3204
3218
  const adds = [];
@@ -3212,12 +3226,13 @@ function bind(target, settings) {
3212
3226
  };
3213
3227
 
3214
3228
  function* parse(source) {
3215
- if (settings.chunk && revision) throw new Error('Chunks cannot be updated.');
3229
+ if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
3216
3230
  const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
3217
- 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));
3218
- (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,
3219
3234
  url: url ? new url_1.ReadonlyURL(url) : global_1.undefined
3220
- });
3235
+ };
3221
3236
  const rev = revision = Symbol();
3222
3237
  const sourceSegments = [];
3223
3238
 
@@ -3550,12 +3565,13 @@ function parse(source, opts = {}, context) {
3550
3565
  const url = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
3551
3566
  source = !context ? (0, normalize_1.normalize)(source) : source;
3552
3567
  context = {
3553
- url: url ? new url_1.ReadonlyURL(url) : context?.url,
3554
3568
  host: opts.host ?? context?.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
3569
+ url: url ? new url_1.ReadonlyURL(url) : context?.url,
3570
+ id: opts.id ?? context?.id,
3555
3571
  caches: context?.caches,
3556
- footnotes: global_1.undefined,
3557
- test: global_1.undefined,
3558
- ...opts
3572
+ ...(context?.resources && {
3573
+ resources: context.resources
3574
+ })
3559
3575
  };
3560
3576
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3561
3577
  const node = (0, dom_1.frag)();
@@ -3652,8 +3668,8 @@ const random_1 = __webpack_require__(7325);
3652
3668
 
3653
3669
  exports.block = (0, combinator_1.creator)(error((0, combinator_1.reset)({
3654
3670
  resources: {
3655
- budget: 100 * 1000,
3656
- recursion: 200
3671
+ budget: 50 * 1000,
3672
+ recursion: 20 + 1
3657
3673
  }
3658
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]))));
3659
3675
 
@@ -3888,7 +3904,7 @@ const parse_1 = __webpack_require__(5013);
3888
3904
 
3889
3905
  const dom_1 = __webpack_require__(3252);
3890
3906
 
3891
- exports.aside = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})aside(?!\S)([^\n]*)(?:$|\n)/, 300), // Bug: Type mismatch between outer and inner.
3907
+ exports.aside = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})aside(?!\S)([^\n]*)(?:$|\n)/, 300), // Bug: Type mismatch between outer and inner.
3892
3908
  ([body, overflow, closer, opener, delim, param], _, context) => {
3893
3909
  if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
3894
3910
  class: 'invalid',
@@ -3920,7 +3936,7 @@ exports.aside = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combi
3920
3936
  id: (0, indexee_1.identity)((0, indexee_1.text)(heading)),
3921
3937
  class: 'aside'
3922
3938
  }, [document, references])];
3923
- }))));
3939
+ })));
3924
3940
 
3925
3941
  /***/ }),
3926
3942
 
@@ -3946,7 +3962,7 @@ const mathblock_1 = __webpack_require__(3754);
3946
3962
  const dom_1 = __webpack_require__(3252);
3947
3963
 
3948
3964
  const opener = /^(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/;
3949
- exports.example = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300), // Bug: Type mismatch between outer and inner.
3965
+ exports.example = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300), // Bug: Type mismatch between outer and inner.
3950
3966
  ([body, overflow, closer, opener, delim, type = 'markdown', param], _, context) => {
3951
3967
  if (!closer || overflow || param.trimStart()) return [(0, dom_1.html)('pre', {
3952
3968
  class: 'invalid',
@@ -3993,7 +4009,7 @@ exports.example = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, com
3993
4009
  'data-invalid-message': 'Invalid example type'
3994
4010
  }, `${opener}${body}${closer}`)];
3995
4011
  }
3996
- }))));
4012
+ })));
3997
4013
 
3998
4014
  /***/ }),
3999
4015
 
@@ -5386,11 +5402,13 @@ const combinator_1 = __webpack_require__(2087);
5386
5402
 
5387
5403
  const inline_1 = __webpack_require__(1160);
5388
5404
 
5405
+ const reference_1 = __webpack_require__(3555);
5406
+
5389
5407
  const util_1 = __webpack_require__(9437);
5390
5408
 
5391
5409
  const dom_1 = __webpack_require__(3252);
5392
5410
 
5393
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('((', '))', '\n', (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, combinator_1.context)({
5394
5412
  syntax: {
5395
5413
  inline: {
5396
5414
  annotation: false,
@@ -5405,9 +5423,9 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0,
5405
5423
  }
5406
5424
  },
5407
5425
  delimiters: global_1.undefined
5408
- }, (0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', /^\\?\n/)))), '))'), ns => [(0, dom_1.html)('sup', {
5426
+ }, (0, util_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 3], ['))', 6]])))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5409
5427
  class: 'annotation'
5410
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])]))));
5428
+ }, [(0, dom_1.html)('span', (0, util_1.trimNodeEnd)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ')' ? global_1.undefined : (0, reference_1.optimize)('((', ns, rest)))))));
5411
5429
 
5412
5430
  /***/ }),
5413
5431
 
@@ -5666,15 +5684,11 @@ const link_1 = __webpack_require__(9628);
5666
5684
 
5667
5685
  const source_1 = __webpack_require__(6743);
5668
5686
 
5687
+ const util_1 = __webpack_require__(9437);
5688
+
5669
5689
  const closer = /^[-+*=~^,.;:!?]*(?=["`|\[\](){}<>]|\\?$)/;
5670
- 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)({
5671
- syntax: {
5672
- inline: {
5673
- link: true
5674
- }
5675
- }
5676
- }, (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.link]))))));
5677
- 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)])));
5690
+ 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, util_1.clean)((0, combinator_1.union)([link_1.link]))))));
5691
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(3, (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)]))));
5678
5692
 
5679
5693
  /***/ }),
5680
5694
 
@@ -5702,12 +5716,12 @@ const dom_1 = __webpack_require__(3252);
5702
5716
  const array_1 = __webpack_require__(8112);
5703
5717
 
5704
5718
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
5705
- exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((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', {
5719
+ 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)(3, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, ')', [[')', 3]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5706
5720
  class: 'paren'
5707
- }, (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', {
5721
+ }, (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)(3, (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)(3, (0, combinator_1.some)(inline_1.inline, ')', [[')', 3]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5708
5722
  class: 'paren'
5709
- }, (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.
5710
- (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])])));
5723
+ }, (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)(3, (0, combinator_1.some)(inline_1.inline, ']', [[']', 3]])), (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)(3, (0, combinator_1.some)(inline_1.inline, '}', [['}', 3]])), (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.
5724
+ (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])])));
5711
5725
 
5712
5726
  /***/ }),
5713
5727
 
@@ -5759,11 +5773,11 @@ const memoize_1 = __webpack_require__(1808);
5759
5773
 
5760
5774
  const array_1 = __webpack_require__(8112);
5761
5775
 
5762
- 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', {
5776
+ 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', {
5763
5777
  class: 'comment'
5764
5778
  }, [(0, dom_1.html)('input', {
5765
5779
  type: 'checkbox'
5766
- }), (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, [])))));
5780
+ }), (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, []))))));
5767
5781
 
5768
5782
  /***/ }),
5769
5783
 
@@ -5790,7 +5804,7 @@ const dom_1 = __webpack_require__(3252);
5790
5804
 
5791
5805
  const array_1 = __webpack_require__(8112);
5792
5806
 
5793
- 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])));
5807
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (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]))));
5794
5808
 
5795
5809
  /***/ }),
5796
5810
 
@@ -5821,7 +5835,7 @@ const dom_1 = __webpack_require__(3252);
5821
5835
 
5822
5836
  const array_1 = __webpack_require__(8112);
5823
5837
 
5824
- 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])));
5838
+ 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]))));
5825
5839
 
5826
5840
  /***/ }),
5827
5841
 
@@ -5854,7 +5868,7 @@ const array_1 = __webpack_require__(8112);
5854
5868
 
5855
5869
  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]))])));
5856
5870
  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]))])));
5857
- 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) => {
5871
+ 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) => {
5858
5872
  switch (cs[0]) {
5859
5873
  case '***':
5860
5874
  return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
@@ -5865,7 +5879,7 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, co
5865
5879
  case '*':
5866
5880
  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];
5867
5881
  }
5868
- }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
5882
+ }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
5869
5883
 
5870
5884
  /***/ }),
5871
5885
 
@@ -5955,7 +5969,7 @@ const util_1 = __webpack_require__(9437);
5955
5969
 
5956
5970
  const dom_1 = __webpack_require__(3252);
5957
5971
 
5958
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[#', ']', '\n', (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)({
5972
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creator)((0, combinator_1.precedence)(3, (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)({
5959
5973
  syntax: {
5960
5974
  inline: {
5961
5975
  annotation: false,
@@ -5967,16 +5981,16 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combi
5967
5981
  autolink: false
5968
5982
  }
5969
5983
  }
5970
- }, (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, {
5984
+ }, (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], [']', 3]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
5971
5985
  id: el.id ? null : global_1.undefined,
5972
5986
  class: 'index',
5973
5987
  href: el.id ? `#${el.id}` : global_1.undefined
5974
- }, el.childNodes)]))));
5988
+ }, el.childNodes)])))));
5975
5989
  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', {
5976
5990
  class: 'indexer',
5977
5991
  'data-index': (0, indexee_1.identity)(ns.join('')).slice(6)
5978
5992
  })])));
5979
- 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)])));
5993
+ 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)])));
5980
5994
 
5981
5995
  /***/ }),
5982
5996
 
@@ -6077,15 +6091,11 @@ const combinator_1 = __webpack_require__(2087);
6077
6091
 
6078
6092
  const index_1 = __webpack_require__(4479);
6079
6093
 
6094
+ const util_1 = __webpack_require__(9437);
6095
+
6080
6096
  const dom_1 = __webpack_require__(3252);
6081
6097
 
6082
- exports.indexer = (0, combinator_1.creator)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[#\S)/, (0, combinator_1.context)({
6083
- syntax: {
6084
- inline: {
6085
- index: true
6086
- }
6087
- }
6088
- }, (0, combinator_1.union)([(0, combinator_1.focus)('[#]', () => [[(0, dom_1.html)('a', {
6098
+ 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', {
6089
6099
  href: '#'
6090
6100
  })], '']), index_1.index])), /^\s*$/), // Indexer is invisible but invalids must be visible.
6091
6101
  ([el]) => el.getElementsByClassName('invalid').length === 0), ([el]) => [(0, dom_1.html)('span', {
@@ -6116,7 +6126,7 @@ const dom_1 = __webpack_require__(3252);
6116
6126
 
6117
6127
  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]))/);
6118
6128
  exports.segment = (0, combinator_1.clear)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])));
6119
- 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', {
6129
+ 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', {
6120
6130
  class: 'label',
6121
6131
  'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
6122
6132
  }, text)])));
@@ -6172,12 +6182,12 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
6172
6182
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6173
6183
 
6174
6184
 
6175
- exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)(['[:', '[^'], ']', '\n', (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']')), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6185
+ exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.creator)((0, combinator_1.precedence)(3, (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], [']', 3]])), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6176
6186
  class: 'invalid',
6177
6187
  'data-invalid-syntax': 'extension',
6178
6188
  'data-invalid-type': 'syntax',
6179
6189
  'data-invalid-message': `Reserved start symbol "${as[0][1]}" cannot be used in "[]"`
6180
- }, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6190
+ }, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])))));
6181
6191
 
6182
6192
  /***/ }),
6183
6193
 
@@ -6218,8 +6228,8 @@ const attrspecs = {
6218
6228
  };
6219
6229
  global_1.Object.setPrototypeOf(attrspecs, null);
6220
6230
  global_1.Object.values(attrspecs).forEach(o => global_1.Object.setPrototypeOf(o, null));
6221
- 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
6222
- /^<(?: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)))])))));
6231
+ 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
6232
+ /^<(?: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)))]))))));
6223
6233
  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
6224
6234
  // [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
6225
6235
 
@@ -6333,7 +6343,7 @@ const dom_1 = __webpack_require__(3252);
6333
6343
 
6334
6344
  const array_1 = __webpack_require__(8112);
6335
6345
 
6336
- 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])));
6346
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (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]))));
6337
6347
 
6338
6348
  /***/ }),
6339
6349
 
@@ -6372,7 +6382,7 @@ const optspec = {
6372
6382
  rel: ['nofollow']
6373
6383
  };
6374
6384
  Object.setPrototypeOf(optspec, null);
6375
- exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.validate)(['[', '{'], '}', '\n', (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)({
6385
+ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (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)({
6376
6386
  syntax: {
6377
6387
  inline: {
6378
6388
  link: false
@@ -6391,13 +6401,14 @@ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, co
6391
6401
  autolink: false
6392
6402
  }
6393
6403
  }
6394
- }, (0, util_1.trimBlank)((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) => {
6404
+ }, (0, util_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3]]))), ']', 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) => {
6405
+ content = (0, util_1.trimNodeEnd)(content);
6395
6406
  if ((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context))?.some(node => typeof node === 'object')) return;
6396
6407
  const INSECURE_URI = params.shift();
6397
6408
  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);
6398
6409
  if (el.classList.contains('invalid')) return [[el], rest];
6399
6410
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6400
- }))));
6411
+ })))));
6401
6412
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
6402
6413
  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)}`])]);
6403
6414
 
@@ -6500,7 +6511,7 @@ const dom_1 = __webpack_require__(3252);
6500
6511
 
6501
6512
  const array_1 = __webpack_require__(8112);
6502
6513
 
6503
- 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])));
6514
+ exports.mark = (0, combinator_1.lazy)(() => (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)([(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]))));
6504
6515
 
6505
6516
  /***/ }),
6506
6517
 
@@ -6521,9 +6532,9 @@ const source_1 = __webpack_require__(6743);
6521
6532
 
6522
6533
  const dom_1 = __webpack_require__(3252);
6523
6534
 
6524
- const syntax = /^(?:[ "([](?!\$)|\\{(?!\$)|\\[\\}$]?|^`|`(?!`)|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/;
6535
+ const syntax = /^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/;
6525
6536
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
6526
- 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, {
6537
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creator)((0, combinator_1.precedence)(7, (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, (0, source_1.str)(syntax)])), /^\$(?![0-9A-Za-z])/)]), (source, {
6527
6538
  caches: {
6528
6539
  math: cache
6529
6540
  } = {}
@@ -6537,9 +6548,8 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combin
6537
6548
  'data-invalid-syntax': 'math',
6538
6549
  'data-invalid-type': 'content',
6539
6550
  'data-invalid-message': `"${source.match(forbiddenCommand)[0]}" command is forbidden`
6540
- }, source)], '']))));
6551
+ }, source)], ''])))));
6541
6552
  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)));
6542
- 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)));
6543
6553
 
6544
6554
  /***/ }),
6545
6555
 
@@ -6579,7 +6589,7 @@ const optspec = {
6579
6589
  rel: global_1.undefined
6580
6590
  };
6581
6591
  Object.setPrototypeOf(optspec, null);
6582
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.validate)(['![', '!{'], '}', '\n', (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) => {
6592
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (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('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6583
6593
  const INSECURE_URI = params.shift();
6584
6594
  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);
6585
6595
  let cache;
@@ -6601,8 +6611,8 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, c
6601
6611
  return (0, combinator_1.fmap)(link_1.link, ([link]) => [(0, dom_1.define)(link, {
6602
6612
  target: '_blank'
6603
6613
  }, [el])])(`{ ${INSECURE_URI}${params.join('')} }${rest}`, context);
6604
- }))));
6605
- 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)]));
6614
+ })))));
6615
+ 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)]));
6606
6616
  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]);
6607
6617
 
6608
6618
  function sanitize(target, uri, alt) {
@@ -6656,7 +6666,7 @@ function sanitize(target, uri, alt) {
6656
6666
  Object.defineProperty(exports, "__esModule", ({
6657
6667
  value: true
6658
6668
  }));
6659
- exports.reference = void 0;
6669
+ exports.optimize = exports.reference = void 0;
6660
6670
 
6661
6671
  const global_1 = __webpack_require__(4128);
6662
6672
 
@@ -6670,7 +6680,7 @@ const util_1 = __webpack_require__(9437);
6670
6680
 
6671
6681
  const dom_1 = __webpack_require__(3252);
6672
6682
 
6673
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[[', ']]', '\n', (0, combinator_1.fmap)((0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => context.syntax?.inline?.reference ?? true, (0, combinator_1.context)({
6683
+ 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, combinator_1.context)({
6674
6684
  syntax: {
6675
6685
  inline: {
6676
6686
  annotation: false,
@@ -6684,7 +6694,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, c
6684
6694
  }
6685
6695
  },
6686
6696
  delimiters: global_1.undefined
6687
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/)), (0, util_1.trimBlank)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))]))), ']]'), ns => [(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])]))));
6697
+ }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]])), (0, util_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]]))]))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, util_1.trimNodeEnd)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : optimize('[[', ns, rest)))))));
6688
6698
  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, '')]));
6689
6699
 
6690
6700
  function attributes(ns) {
@@ -6701,6 +6711,19 @@ function attributes(ns) {
6701
6711
  };
6702
6712
  }
6703
6713
 
6714
+ function optimize(opener, ns, rest) {
6715
+ let count = 0;
6716
+
6717
+ for (let i = 0; i < ns.length - 1; i += 2) {
6718
+ if (ns[i] !== '' || ns[i + 1] !== opener[0]) break;
6719
+ ++count;
6720
+ }
6721
+
6722
+ return [[opener[0].repeat(opener.length + count)], rest.slice(count)];
6723
+ }
6724
+
6725
+ exports.optimize = optimize;
6726
+
6704
6727
  /***/ }),
6705
6728
 
6706
6729
  /***/ 6705:
@@ -6730,19 +6753,18 @@ const dom_1 = __webpack_require__(3252);
6730
6753
 
6731
6754
  const array_1 = __webpack_require__(8112);
6732
6755
 
6733
- exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[', ')', '\n', (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) => {
6734
- const tail = typeof texts[texts.length - 1] === 'object' ? [texts.pop()] : [];
6735
- tail.length === 0 && texts[texts.length - 1] === '' && texts.pop();
6756
+ 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]) => {
6757
+ texts[texts.length - 1] === '' && texts.pop();
6736
6758
 
6737
6759
  switch (true) {
6738
6760
  case rubies.length <= texts.length:
6739
- 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];
6761
+ 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')])), [])))];
6740
6762
 
6741
6763
  case texts.length === 1 && [...texts[0]].length >= rubies.length:
6742
- 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];
6764
+ 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')])), [])))];
6743
6765
 
6744
6766
  default:
6745
- 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];
6767
+ 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', ')')])))];
6746
6768
  }
6747
6769
  }))));
6748
6770
  const text = (0, combinator_1.creator)((source, context) => {
@@ -6849,7 +6871,7 @@ const dom_1 = __webpack_require__(3252);
6849
6871
 
6850
6872
  const array_1 = __webpack_require__(8112);
6851
6873
 
6852
- 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])));
6874
+ 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]))));
6853
6875
 
6854
6876
  /***/ }),
6855
6877
 
@@ -6874,10 +6896,10 @@ const dom_1 = __webpack_require__(3252);
6874
6896
 
6875
6897
  const array_1 = __webpack_require__(8112);
6876
6898
 
6877
- 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', {
6899
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(3, (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', {
6878
6900
  class: 'template'
6879
- }, source.replace(/\x1B/g, ''))], ''])));
6880
- 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)]));
6901
+ }, source.replace(/\x1B/g, ''))], '']))));
6902
+ 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)]));
6881
6903
 
6882
6904
  /***/ }),
6883
6905
 
@@ -7776,7 +7798,7 @@ exports.unescsource = (0, combinator_1.creator)(source => {
7776
7798
  Object.defineProperty(exports, "__esModule", ({
7777
7799
  value: true
7778
7800
  }));
7779
- exports.stringify = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = void 0;
7801
+ exports.stringify = exports.trimNodeEnd = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = exports.clean = void 0;
7780
7802
 
7781
7803
  const global_1 = __webpack_require__(4128);
7782
7804
 
@@ -7794,6 +7816,21 @@ const memoize_1 = __webpack_require__(1808);
7794
7816
 
7795
7817
  const array_1 = __webpack_require__(8112);
7796
7818
 
7819
+ function clean(parser) {
7820
+ const clean = (0, memoize_1.memoize)(context => ({
7821
+ resources: context.resources,
7822
+ precedence: context.precedence,
7823
+ delimiters: context.delimiters,
7824
+ host: context.host,
7825
+ url: context.url,
7826
+ id: context.id,
7827
+ header: context.header,
7828
+ cache: context.caches
7829
+ }), new WeakMap());
7830
+ return (source, context) => parser(source, context.syntax ? clean(context) : context);
7831
+ }
7832
+
7833
+ exports.clean = clean;
7797
7834
  exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
7798
7835
 
7799
7836
  function blankWith(starting, delimiter) {
@@ -7993,6 +8030,8 @@ function trimNodeEnd(nodes) {
7993
8030
  return (0, array_1.push)(nodes, skip);
7994
8031
  }
7995
8032
 
8033
+ exports.trimNodeEnd = trimNodeEnd;
8034
+
7996
8035
  function stringify(nodes) {
7997
8036
  let acc = '';
7998
8037