securemark 0.259.0 → 0.260.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 (152) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/design.md +16 -5
  3. package/dist/index.js +625 -318
  4. package/package.json +1 -1
  5. package/src/combinator/control/constraint/block.test.ts +5 -5
  6. package/src/combinator/control/constraint/block.ts +2 -2
  7. package/src/combinator/control/constraint/contract.ts +4 -4
  8. package/src/combinator/control/constraint/line.test.ts +6 -6
  9. package/src/combinator/control/constraint/line.ts +5 -5
  10. package/src/combinator/control/manipulation/convert.ts +5 -5
  11. package/src/combinator/control/manipulation/fence.ts +1 -1
  12. package/src/combinator/control/manipulation/indent.test.ts +14 -14
  13. package/src/combinator/control/manipulation/indent.ts +5 -5
  14. package/src/combinator/control/manipulation/lazy.ts +2 -2
  15. package/src/combinator/control/manipulation/match.ts +2 -2
  16. package/src/combinator/control/manipulation/recovery.ts +6 -6
  17. package/src/combinator/control/manipulation/scope.ts +11 -10
  18. package/src/combinator/control/manipulation/surround.ts +9 -8
  19. package/src/combinator/control/manipulation/trim.test.ts +9 -9
  20. package/src/combinator/control/monad/bind.ts +2 -2
  21. package/src/combinator/data/parser/context/memo.ts +3 -4
  22. package/src/combinator/data/parser/context.test.ts +9 -9
  23. package/src/combinator/data/parser/context.ts +33 -33
  24. package/src/combinator/data/parser/inits.ts +2 -2
  25. package/src/combinator/data/parser/sequence.test.ts +10 -10
  26. package/src/combinator/data/parser/sequence.ts +2 -2
  27. package/src/combinator/data/parser/some.test.ts +13 -13
  28. package/src/combinator/data/parser/some.ts +2 -2
  29. package/src/combinator/data/parser/subsequence.test.ts +14 -14
  30. package/src/combinator/data/parser/union.test.ts +10 -10
  31. package/src/combinator/data/parser/union.ts +2 -2
  32. package/src/combinator/data/parser.ts +6 -1
  33. package/src/parser/api/bind.ts +3 -3
  34. package/src/parser/api/header.ts +1 -1
  35. package/src/parser/api/normalize.ts +1 -1
  36. package/src/parser/api/parse.test.ts +19 -19
  37. package/src/parser/api/parse.ts +3 -3
  38. package/src/parser/autolink.test.ts +7 -7
  39. package/src/parser/autolink.ts +2 -2
  40. package/src/parser/block/blockquote.test.ts +9 -9
  41. package/src/parser/block/blockquote.ts +1 -1
  42. package/src/parser/block/codeblock.test.ts +5 -5
  43. package/src/parser/block/codeblock.ts +1 -1
  44. package/src/parser/block/dlist.test.ts +2 -2
  45. package/src/parser/block/extension/aside.test.ts +1 -1
  46. package/src/parser/block/extension/example.test.ts +1 -1
  47. package/src/parser/block/extension/example.ts +1 -1
  48. package/src/parser/block/extension/fig.test.ts +1 -1
  49. package/src/parser/block/extension/figbase.test.ts +1 -1
  50. package/src/parser/block/extension/figure.test.ts +2 -2
  51. package/src/parser/block/extension/figure.ts +1 -1
  52. package/src/parser/block/extension/message.test.ts +1 -1
  53. package/src/parser/block/extension/message.ts +1 -1
  54. package/src/parser/block/extension/placeholder.test.ts +1 -1
  55. package/src/parser/block/extension/table.test.ts +1 -1
  56. package/src/parser/block/extension/table.ts +1 -1
  57. package/src/parser/block/extension.test.ts +1 -1
  58. package/src/parser/block/heading.test.ts +8 -8
  59. package/src/parser/block/heading.ts +1 -1
  60. package/src/parser/block/horizontalrule.test.ts +1 -1
  61. package/src/parser/block/ilist.test.ts +1 -1
  62. package/src/parser/block/mathblock.test.ts +1 -1
  63. package/src/parser/block/olist.test.ts +2 -2
  64. package/src/parser/block/olist.ts +5 -5
  65. package/src/parser/block/paragraph.test.ts +15 -15
  66. package/src/parser/block/reply/cite.test.ts +12 -12
  67. package/src/parser/block/reply/cite.ts +2 -2
  68. package/src/parser/block/reply/quote.test.ts +4 -4
  69. package/src/parser/block/reply/quote.ts +2 -2
  70. package/src/parser/block/reply.test.ts +9 -9
  71. package/src/parser/block/sidefence.test.ts +7 -7
  72. package/src/parser/block/table.test.ts +1 -1
  73. package/src/parser/block/table.ts +1 -1
  74. package/src/parser/block/ulist.test.ts +2 -2
  75. package/src/parser/block/ulist.ts +1 -1
  76. package/src/parser/block.ts +2 -2
  77. package/src/parser/context.ts +23 -13
  78. package/src/parser/header.test.ts +1 -1
  79. package/src/parser/header.ts +3 -3
  80. package/src/parser/inline/annotation.test.ts +4 -4
  81. package/src/parser/inline/annotation.ts +3 -4
  82. package/src/parser/inline/autolink/account.test.ts +12 -12
  83. package/src/parser/inline/autolink/account.ts +4 -2
  84. package/src/parser/inline/autolink/anchor.test.ts +10 -10
  85. package/src/parser/inline/autolink/anchor.ts +14 -11
  86. package/src/parser/inline/autolink/channel.test.ts +4 -4
  87. package/src/parser/inline/autolink/email.test.ts +1 -1
  88. package/src/parser/inline/autolink/email.ts +1 -1
  89. package/src/parser/inline/autolink/hashnum.test.ts +1 -1
  90. package/src/parser/inline/autolink/hashnum.ts +4 -2
  91. package/src/parser/inline/autolink/hashtag.test.ts +21 -21
  92. package/src/parser/inline/autolink/hashtag.ts +4 -2
  93. package/src/parser/inline/autolink/url.test.ts +56 -56
  94. package/src/parser/inline/autolink/url.ts +5 -3
  95. package/src/parser/inline/autolink.ts +1 -1
  96. package/src/parser/inline/bracket.test.ts +1 -1
  97. package/src/parser/inline/bracket.ts +8 -8
  98. package/src/parser/inline/code.test.ts +1 -1
  99. package/src/parser/inline/code.ts +2 -2
  100. package/src/parser/inline/comment.test.ts +1 -1
  101. package/src/parser/inline/comment.ts +2 -2
  102. package/src/parser/inline/deletion.test.ts +1 -1
  103. package/src/parser/inline/deletion.ts +2 -2
  104. package/src/parser/inline/emphasis.test.ts +1 -1
  105. package/src/parser/inline/emphasis.ts +2 -2
  106. package/src/parser/inline/emstrong.ts +4 -4
  107. package/src/parser/inline/escape.ts +3 -3
  108. package/src/parser/inline/extension/index.test.ts +1 -1
  109. package/src/parser/inline/extension/index.ts +3 -4
  110. package/src/parser/inline/extension/indexer.test.ts +1 -1
  111. package/src/parser/inline/extension/label.test.ts +1 -1
  112. package/src/parser/inline/extension/placeholder.test.ts +1 -1
  113. package/src/parser/inline/extension/placeholder.ts +2 -2
  114. package/src/parser/inline/html.test.ts +1 -3
  115. package/src/parser/inline/html.ts +3 -3
  116. package/src/parser/inline/htmlentity.test.ts +1 -1
  117. package/src/parser/inline/htmlentity.ts +1 -1
  118. package/src/parser/inline/insertion.test.ts +1 -1
  119. package/src/parser/inline/insertion.ts +2 -2
  120. package/src/parser/inline/link.test.ts +111 -111
  121. package/src/parser/inline/link.ts +12 -12
  122. package/src/parser/inline/mark.test.ts +1 -1
  123. package/src/parser/inline/mark.ts +2 -2
  124. package/src/parser/inline/math.test.ts +1 -1
  125. package/src/parser/inline/math.ts +1 -1
  126. package/src/parser/inline/media.test.ts +2 -1
  127. package/src/parser/inline/media.ts +4 -4
  128. package/src/parser/inline/reference.test.ts +4 -4
  129. package/src/parser/inline/reference.ts +3 -4
  130. package/src/parser/inline/ruby.test.ts +1 -1
  131. package/src/parser/inline/ruby.ts +5 -5
  132. package/src/parser/inline/shortmedia.test.ts +1 -1
  133. package/src/parser/inline/strong.test.ts +1 -1
  134. package/src/parser/inline/strong.ts +2 -2
  135. package/src/parser/inline/template.test.ts +1 -1
  136. package/src/parser/inline/template.ts +2 -2
  137. package/src/parser/inline.test.ts +52 -52
  138. package/src/parser/locale.test.ts +1 -1
  139. package/src/parser/segment.ts +1 -1
  140. package/src/parser/source/escapable.test.ts +1 -1
  141. package/src/parser/source/escapable.ts +1 -1
  142. package/src/parser/source/line.test.ts +1 -1
  143. package/src/parser/source/line.ts +2 -2
  144. package/src/parser/source/str.ts +4 -4
  145. package/src/parser/source/text.test.ts +1 -1
  146. package/src/parser/source/text.ts +4 -4
  147. package/src/parser/source/unescapable.test.ts +1 -1
  148. package/src/parser/source/unescapable.ts +1 -1
  149. package/src/parser/visibility.ts +13 -13
  150. package/src/renderer/render/media/pdf.ts +1 -0
  151. package/src/util/info.ts +2 -4
  152. package/src/util/quote.ts +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.259.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.260.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"));
@@ -2129,10 +2129,16 @@ const memo_1 = __webpack_require__(1090);
2129
2129
  const line_1 = __webpack_require__(9315);
2130
2130
 
2131
2131
  function block(parser, separation = true) {
2132
- return (source, context = {}) => {
2132
+ return ({
2133
+ source,
2134
+ context
2135
+ }) => {
2133
2136
  if (source === '') return;
2134
2137
  context.memo ??= new memo_1.Memo();
2135
- const result = parser(source, context);
2138
+ const result = parser({
2139
+ source,
2140
+ context
2141
+ });
2136
2142
  if (!result) return;
2137
2143
  const rest = (0, parser_1.exec)(result);
2138
2144
  if (separation && !(0, line_1.isEmpty)((0, line_1.firstline)(rest))) return;
@@ -2165,10 +2171,16 @@ function validate(patterns, has, parser) {
2165
2171
  if (typeof has === 'function') return validate(patterns, '', has);
2166
2172
  if (!(0, alias_1.isArray)(patterns)) return validate([patterns], has, parser);
2167
2173
  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(''))();
2168
- return (source, context) => {
2174
+ return ({
2175
+ source,
2176
+ context
2177
+ }) => {
2169
2178
  if (source === '') return;
2170
2179
  if (!match(source)) return;
2171
- const result = parser(source, context);
2180
+ const result = parser({
2181
+ source,
2182
+ context
2183
+ });
2172
2184
  if (!result) return;
2173
2185
  return (0, parser_1.exec)(result).length < source.length ? result : global_1.undefined;
2174
2186
  };
@@ -2177,9 +2189,15 @@ function validate(patterns, has, parser) {
2177
2189
  exports.validate = validate;
2178
2190
 
2179
2191
  function verify(parser, cond) {
2180
- return (source, context) => {
2192
+ return ({
2193
+ source,
2194
+ context
2195
+ }) => {
2181
2196
  if (source === '') return;
2182
- const result = parser(source, context);
2197
+ const result = parser({
2198
+ source,
2199
+ context
2200
+ });
2183
2201
  if (!result) return;
2184
2202
  if (!cond((0, parser_1.eval)(result), (0, parser_1.exec)(result), context)) return;
2185
2203
  return (0, parser_1.exec)(result).length < source.length ? result : global_1.undefined;
@@ -2208,14 +2226,20 @@ const parser_1 = __webpack_require__(6728);
2208
2226
  const memo_1 = __webpack_require__(1090);
2209
2227
 
2210
2228
  function line(parser) {
2211
- return (source, context = {}) => {
2229
+ return ({
2230
+ source,
2231
+ context
2232
+ }) => {
2212
2233
  if (source === '') return;
2213
2234
  context.memo ??= new memo_1.Memo();
2214
2235
  const line = firstline(source);
2215
- const memo = context.memo;
2216
- memo.offset += source.length - line.length;
2217
- const result = parser(line, context);
2218
- memo.offset -= source.length - line.length;
2236
+ context.offset ??= 0;
2237
+ context.offset += source.length - line.length;
2238
+ const result = parser({
2239
+ source: line,
2240
+ context
2241
+ });
2242
+ context.offset -= source.length - line.length;
2219
2243
  if (!result) return;
2220
2244
  return isEmpty((0, parser_1.exec)(result)) ? [(0, parser_1.eval)(result), source.slice(line.length)] : global_1.undefined;
2221
2245
  };
@@ -2262,14 +2286,20 @@ exports.convert = void 0;
2262
2286
  const parser_1 = __webpack_require__(6728);
2263
2287
 
2264
2288
  function convert(conv, parser) {
2265
- return (source, context = {}) => {
2289
+ return ({
2290
+ source,
2291
+ context
2292
+ }) => {
2266
2293
  if (source === '') return;
2267
2294
  const src = conv(source);
2268
2295
  if (src === '') return [[], ''];
2269
- const memo = context.memo;
2270
- memo && (memo.offset += source.length - src.length);
2271
- const result = parser(src, context);
2272
- memo && (memo.offset -= source.length - src.length);
2296
+ context.offset ??= 0;
2297
+ context.offset += source.length - src.length;
2298
+ const result = parser({
2299
+ source: src,
2300
+ context
2301
+ });
2302
+ context.offset -= source.length - src.length;
2273
2303
  return result;
2274
2304
  };
2275
2305
  }
@@ -2336,7 +2366,9 @@ const line_1 = __webpack_require__(9315);
2336
2366
  const array_1 = __webpack_require__(8112);
2337
2367
 
2338
2368
  function fence(opener, limit, separation = true) {
2339
- return source => {
2369
+ return ({
2370
+ source
2371
+ }) => {
2340
2372
  if (source === '') return;
2341
2373
  const matches = source.match(opener);
2342
2374
  if (!matches) return;
@@ -2420,11 +2452,16 @@ const memoize_1 = __webpack_require__(1808);
2420
2452
 
2421
2453
  function indent(opener, parser, separation = false) {
2422
2454
  if (typeof opener === 'function') return indent(/^([ \t])\1*/, opener, parser);
2423
- return (0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, source => [[source], '']))), ([indent]) => indent.length * 2 + +(indent[0] === ' '), [])), separation), (lines, rest, context) => {
2424
- const memo = context.memo;
2425
- memo && (memo.offset += rest.length);
2426
- const result = parser(trimBlockEnd(lines.join('')), context);
2427
- memo && (memo.offset -= rest.length);
2455
+ return (0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, ({
2456
+ source
2457
+ }) => [[source], '']))), ([indent]) => indent.length * 2 + +(indent[0] === ' '), [])), separation), (lines, rest, context) => {
2458
+ context.offset ??= 0;
2459
+ context.offset += rest.length;
2460
+ const result = parser({
2461
+ source: trimBlockEnd(lines.join('')),
2462
+ context
2463
+ });
2464
+ context.offset -= rest.length;
2428
2465
  return result && (0, parser_1.exec)(result) === '' ? [(0, parser_1.eval)(result), rest] : global_1.undefined;
2429
2466
  });
2430
2467
  }
@@ -2450,7 +2487,7 @@ exports.lazy = void 0;
2450
2487
 
2451
2488
  function lazy(builder) {
2452
2489
  let parser;
2453
- return (source, context) => (parser ??= builder())(source, context);
2490
+ return input => (parser ??= builder())(input);
2454
2491
  }
2455
2492
 
2456
2493
  exports.lazy = lazy;
@@ -2473,11 +2510,17 @@ const global_1 = __webpack_require__(4128);
2473
2510
  const parser_1 = __webpack_require__(6728);
2474
2511
 
2475
2512
  function match(pattern, f) {
2476
- return (source, context) => {
2513
+ return ({
2514
+ source,
2515
+ context
2516
+ }) => {
2477
2517
  if (source === '') return;
2478
2518
  const param = source.match(pattern);
2479
2519
  if (!param) return;
2480
- const result = f(param)(source, context);
2520
+ const result = f(param)({
2521
+ source,
2522
+ context
2523
+ });
2481
2524
  if (!result) return;
2482
2525
  return (0, parser_1.exec)(result).length < source.length && (0, parser_1.exec)(result).length <= source.length ? result : global_1.undefined;
2483
2526
  };
@@ -2499,11 +2542,11 @@ Object.defineProperty(exports, "__esModule", ({
2499
2542
  exports.recover = void 0;
2500
2543
 
2501
2544
  function recover(parser, fallback) {
2502
- return (source, context) => {
2545
+ return input => {
2503
2546
  try {
2504
- return parser(source, context);
2547
+ return parser(input);
2505
2548
  } catch (reason) {
2506
- return fallback(source, context, reason);
2549
+ return fallback(input, reason);
2507
2550
  }
2508
2551
  };
2509
2552
  }
@@ -2550,14 +2593,20 @@ const parser_1 = __webpack_require__(6728);
2550
2593
 
2551
2594
  function focus(scope, parser) {
2552
2595
  const match = typeof scope === 'string' ? source => source.slice(0, scope.length) === scope ? scope : '' : source => source.match(scope)?.[0] ?? '';
2553
- return (source, context = {}) => {
2596
+ return ({
2597
+ source,
2598
+ context
2599
+ }) => {
2554
2600
  if (source === '') return;
2555
2601
  const src = match(source);
2556
2602
  if (src === '') return;
2557
- const memo = context.memo;
2558
- memo && (memo.offset += source.length - src.length);
2559
- const result = parser(src, context);
2560
- memo && (memo.offset -= source.length - src.length);
2603
+ context.offset ??= 0;
2604
+ context.offset += source.length - src.length;
2605
+ const result = parser({
2606
+ source: src,
2607
+ context
2608
+ });
2609
+ context.offset -= source.length - src.length;
2561
2610
  if (!result) return;
2562
2611
  return (0, parser_1.exec)(result).length < src.length ? [(0, parser_1.eval)(result), (0, parser_1.exec)(result) + source.slice(src.length)] : global_1.undefined;
2563
2612
  };
@@ -2566,17 +2615,27 @@ function focus(scope, parser) {
2566
2615
  exports.focus = focus;
2567
2616
 
2568
2617
  function rewrite(scope, parser) {
2569
- return (source, context = {}) => {
2618
+ return ({
2619
+ source,
2620
+ context
2621
+ }) => {
2570
2622
  if (source === '') return;
2571
2623
  const memo = context.memo;
2572
2624
  context.memo = global_1.undefined;
2573
- const res1 = scope(source, context);
2625
+ const res1 = scope({
2626
+ source,
2627
+ context
2628
+ });
2574
2629
  context.memo = memo;
2575
2630
  if (!res1 || (0, parser_1.exec)(res1).length >= source.length) return;
2576
2631
  const src = source.slice(0, source.length - (0, parser_1.exec)(res1).length);
2577
- memo && (memo.offset += source.length - src.length);
2578
- const res2 = parser(src, context);
2579
- memo && (memo.offset -= source.length - src.length);
2632
+ context.offset ??= 0;
2633
+ context.offset += source.length - src.length;
2634
+ const res2 = parser({
2635
+ source: src,
2636
+ context
2637
+ });
2638
+ context.offset -= source.length - src.length;
2580
2639
  if (!res2) return;
2581
2640
  return (0, parser_1.exec)(res2).length < src.length ? [(0, parser_1.eval)(res2), (0, parser_1.exec)(res2) + (0, parser_1.exec)(res1)] : global_1.undefined;
2582
2641
  };
@@ -2618,17 +2677,30 @@ function surround(opener, parser, closer, optional = false, f, g) {
2618
2677
  return surround(opener, parser, match(closer), optional, f, g);
2619
2678
  }
2620
2679
 
2621
- return (lmr_, context) => {
2680
+ return ({
2681
+ source,
2682
+ context
2683
+ }) => {
2684
+ const lmr_ = source;
2622
2685
  if (lmr_ === '') return;
2623
- const res1 = opener(lmr_, context);
2686
+ const res1 = opener({
2687
+ source: lmr_,
2688
+ context
2689
+ });
2624
2690
  if (!res1) return;
2625
2691
  const rl = (0, parser_1.eval)(res1);
2626
2692
  const mr_ = (0, parser_1.exec)(res1);
2627
- const res2 = mr_ !== '' ? parser(mr_, context) : global_1.undefined;
2693
+ const res2 = mr_ !== '' ? parser({
2694
+ source: mr_,
2695
+ context
2696
+ }) : global_1.undefined;
2628
2697
  const rm = (0, parser_1.eval)(res2);
2629
2698
  const r_ = (0, parser_1.exec)(res2, mr_);
2630
2699
  if (!rm && !optional) return;
2631
- const res3 = closer(r_, context);
2700
+ const res3 = closer({
2701
+ source: r_,
2702
+ context
2703
+ });
2632
2704
  const rr = (0, parser_1.eval)(res3);
2633
2705
  const rest = (0, parser_1.exec)(res3, r_);
2634
2706
  if (rest.length === lmr_.length) return;
@@ -2641,10 +2713,14 @@ exports.surround = surround;
2641
2713
  function match(pattern) {
2642
2714
  switch (typeof pattern) {
2643
2715
  case 'string':
2644
- return source => source.slice(0, pattern.length) === pattern ? [[], source.slice(pattern.length)] : global_1.undefined;
2716
+ return ({
2717
+ source
2718
+ }) => source.slice(0, pattern.length) === pattern ? [[], source.slice(pattern.length)] : global_1.undefined;
2645
2719
 
2646
2720
  case 'object':
2647
- return source => {
2721
+ return ({
2722
+ source
2723
+ }) => {
2648
2724
  const m = source.match(pattern);
2649
2725
  return m ? [[], source.slice(m[0].length)] : global_1.undefined;
2650
2726
  };
@@ -2720,9 +2796,15 @@ const global_1 = __webpack_require__(4128);
2720
2796
  const parser_1 = __webpack_require__(6728);
2721
2797
 
2722
2798
  function bind(parser, f) {
2723
- return (source, context) => {
2799
+ return ({
2800
+ source,
2801
+ context
2802
+ }) => {
2724
2803
  if (source === '') return;
2725
- const res1 = parser(source, context);
2804
+ const res1 = parser({
2805
+ source,
2806
+ context
2807
+ });
2726
2808
  if (!res1) return;
2727
2809
  const res2 = f((0, parser_1.eval)(res1), (0, parser_1.exec)(res1), context);
2728
2810
  if (!res2) return;
@@ -2808,7 +2890,10 @@ const memo_1 = __webpack_require__(1090);
2808
2890
  function reset(base, parser) {
2809
2891
  const changes = global_1.Object.entries(base);
2810
2892
  const values = (0, global_1.Array)(changes.length);
2811
- return (source, context) => apply(parser, source, (0, alias_1.ObjectCreate)(context), changes, values);
2893
+ return ({
2894
+ source,
2895
+ context
2896
+ }) => apply(parser, source, (0, alias_1.ObjectCreate)(context), changes, values);
2812
2897
  }
2813
2898
 
2814
2899
  exports.reset = reset;
@@ -2816,7 +2901,10 @@ exports.reset = reset;
2816
2901
  function context(base, parser) {
2817
2902
  const changes = global_1.Object.entries(base);
2818
2903
  const values = (0, global_1.Array)(changes.length);
2819
- return (source, context) => apply(parser, source, context, changes, values);
2904
+ return ({
2905
+ source,
2906
+ context
2907
+ }) => apply(parser, source, context, changes, values);
2820
2908
  }
2821
2909
 
2822
2910
  exports.context = context;
@@ -2838,7 +2926,10 @@ function apply(parser, source, context, changes, values) {
2838
2926
  context[prop] = change[1];
2839
2927
  }
2840
2928
  }
2841
- const result = parser(source, context);
2929
+ const result = parser({
2930
+ source,
2931
+ context
2932
+ });
2842
2933
  if (context) for (let i = 0; i < changes.length; ++i) {
2843
2934
  const change = changes[i];
2844
2935
  const prop = change[0];
@@ -2855,47 +2946,56 @@ function apply(parser, source, context, changes, values) {
2855
2946
  return result;
2856
2947
  }
2857
2948
 
2858
- function syntax(syntax, precedence, cost, parser) {
2859
- return creation(cost, (source, context) => {
2949
+ function syntax(syntax, prec, cost, state, parser) {
2950
+ return creation(cost, precedence(prec, ({
2951
+ source,
2952
+ context
2953
+ }) => {
2860
2954
  if (source === '') return;
2861
2955
  const memo = context.memo ??= new memo_1.Memo();
2862
2956
  context.memorable ??= ~0;
2863
- const p = context.precedence;
2864
- context.precedence = precedence;
2865
- const position = source.length;
2866
- const state = context.state ?? 0;
2867
- const cache = syntax && memo.get(position, syntax, state);
2868
- const result = cache ? cache.length === 0 ? global_1.undefined : [cache[0], source.slice(cache[1])] : parser(source, context);
2957
+ context.offset ??= 0;
2958
+ const position = source.length + context.offset;
2959
+ const st0 = context.state ?? 0;
2960
+ const st1 = context.state = st0 | state;
2961
+ const cache = syntax && memo.get(position, syntax, st1);
2962
+ const result = cache ? cache.length === 0 ? global_1.undefined : [cache[0], source.slice(cache[1])] : parser({
2963
+ source,
2964
+ context
2965
+ });
2869
2966
 
2870
- if (syntax && state & context.memorable) {
2871
- cache ?? memo.set(position, syntax, state, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result, '').length);
2967
+ if (syntax && st0 & context.memorable) {
2968
+ cache ?? memo.set(position, syntax, st1, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result, '').length);
2872
2969
  }
2873
2970
 
2874
- if (result && !state && memo.length >= position) {
2875
- memo.clear(position);
2971
+ if (result && !st0 && memo.length >= position + 2) {
2972
+ memo.clear(position + 2);
2876
2973
  }
2877
2974
 
2878
- context.precedence = p;
2975
+ context.state = st0;
2879
2976
  return result;
2880
- });
2977
+ }));
2881
2978
  }
2882
2979
 
2883
2980
  exports.syntax = syntax;
2884
2981
 
2885
2982
  function creation(cost, parser) {
2886
2983
  if (typeof cost === 'function') return creation(1, cost);
2887
- if (cost === 0) return parser;
2888
- return (source, context) => {
2889
- const {
2890
- resources = {
2891
- clock: 1,
2892
- recursion: 1
2893
- }
2894
- } = context;
2984
+ return ({
2985
+ source,
2986
+ context
2987
+ }) => {
2988
+ const resources = context.resources ?? {
2989
+ clock: 1,
2990
+ recursion: 1
2991
+ };
2895
2992
  if (resources.clock <= 0) throw new Error('Too many creations');
2896
2993
  if (resources.recursion <= 0) throw new Error('Too much recursion');
2897
2994
  --resources.recursion;
2898
- const result = parser(source, context);
2995
+ const result = parser({
2996
+ source,
2997
+ context
2998
+ });
2899
2999
  ++resources.recursion;
2900
3000
 
2901
3001
  if (result) {
@@ -2909,10 +3009,16 @@ function creation(cost, parser) {
2909
3009
  exports.creation = creation;
2910
3010
 
2911
3011
  function precedence(precedence, parser) {
2912
- return (source, context) => {
3012
+ return ({
3013
+ source,
3014
+ context
3015
+ }) => {
2913
3016
  const p = context.precedence;
2914
3017
  context.precedence = precedence;
2915
- const result = parser(source, context);
3018
+ const result = parser({
3019
+ source,
3020
+ context
3021
+ });
2916
3022
  context.precedence = p;
2917
3023
  return result;
2918
3024
  };
@@ -2921,7 +3027,13 @@ function precedence(precedence, parser) {
2921
3027
  exports.precedence = precedence;
2922
3028
 
2923
3029
  function guard(f, parser) {
2924
- return (source, context) => f(context) ? parser(source, context) : global_1.undefined;
3030
+ return ({
3031
+ source,
3032
+ context
3033
+ }) => f(context) ? parser({
3034
+ source,
3035
+ context
3036
+ }) : global_1.undefined;
2925
3037
  }
2926
3038
 
2927
3039
  exports.guard = guard;
@@ -2932,9 +3044,15 @@ function constraint(state, positive, parser) {
2932
3044
  positive = true;
2933
3045
  }
2934
3046
 
2935
- return (source, context) => {
3047
+ return ({
3048
+ source,
3049
+ context
3050
+ }) => {
2936
3051
  const s = positive ? state & context.state : state & ~context.state;
2937
- return s === state ? parser(source, context) : global_1.undefined;
3052
+ return s === state ? parser({
3053
+ source,
3054
+ context
3055
+ }) : global_1.undefined;
2938
3056
  };
2939
3057
  }
2940
3058
 
@@ -2946,10 +3064,16 @@ function state(state, positive, parser) {
2946
3064
  positive = true;
2947
3065
  }
2948
3066
 
2949
- return (source, context) => {
3067
+ return ({
3068
+ source,
3069
+ context
3070
+ }) => {
2950
3071
  const s = context.state ?? 0;
2951
3072
  context.state = positive ? s | state : s & ~state;
2952
- const result = parser(source, context);
3073
+ const result = parser({
3074
+ source,
3075
+ context
3076
+ });
2953
3077
  context.state = s;
2954
3078
  return result;
2955
3079
  };
@@ -3077,7 +3201,6 @@ exports.Memo = void 0;
3077
3201
  class Memo {
3078
3202
  constructor() {
3079
3203
  this.memory = [];
3080
- this.offset = 0;
3081
3204
  }
3082
3205
 
3083
3206
  get length() {
@@ -3086,19 +3209,19 @@ class Memo {
3086
3209
 
3087
3210
  get(position, syntax, state) {
3088
3211
  //console.log('get', position + this.offset, syntax, state, this.memory[position + this.offset - 1]?.[`${syntax}:${state}`]);;
3089
- const cache = this.memory[position + this.offset - 1]?.[`${syntax}:${state}`];
3212
+ const cache = this.memory[position - 1]?.[`${syntax}:${state}`];
3090
3213
  return cache?.length === 2 ? [cache[0].slice(), cache[1]] : cache;
3091
3214
  }
3092
3215
 
3093
3216
  set(position, syntax, state, nodes, offset) {
3094
- const record = this.memory[position + this.offset - 1] ??= {};
3217
+ const record = this.memory[position - 1] ??= {};
3095
3218
  record[`${syntax}:${state}`] = nodes ? [nodes.slice(), offset] : []; //console.log('set', position + this.offset, syntax, state, record[`${syntax}:${state}`]);
3096
3219
  }
3097
3220
 
3098
3221
  clear(position) {
3099
3222
  const memory = this.memory;
3100
3223
 
3101
- for (let i = position + this.offset, len = memory.length; i < len; ++i) {
3224
+ for (let i = position, len = memory.length; i < len; ++i) {
3102
3225
  memory.pop();
3103
3226
  } //console.log('clear', position + this.offset + 1);
3104
3227
 
@@ -3129,14 +3252,20 @@ const array_1 = __webpack_require__(8112);
3129
3252
 
3130
3253
  function inits(parsers, resume) {
3131
3254
  if (parsers.length === 1) return parsers[0];
3132
- return (source, context) => {
3255
+ return ({
3256
+ source,
3257
+ context
3258
+ }) => {
3133
3259
  let rest = source;
3134
3260
  let nodes;
3135
3261
 
3136
3262
  for (let i = 0, len = parsers.length; i < len; ++i) {
3137
3263
  if (rest === '') break;
3138
3264
  if (context.delimiters?.match(rest, context.precedence)) break;
3139
- const result = parsers[i](rest, context);
3265
+ const result = parsers[i]({
3266
+ source: rest,
3267
+ context
3268
+ });
3140
3269
  if (!result) break;
3141
3270
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3142
3271
  rest = (0, parser_1.exec)(result);
@@ -3170,14 +3299,20 @@ const array_1 = __webpack_require__(8112);
3170
3299
 
3171
3300
  function sequence(parsers, resume) {
3172
3301
  if (parsers.length === 1) return parsers[0];
3173
- return (source, context) => {
3302
+ return ({
3303
+ source,
3304
+ context
3305
+ }) => {
3174
3306
  let rest = source;
3175
3307
  let nodes;
3176
3308
 
3177
3309
  for (let i = 0, len = parsers.length; i < len; ++i) {
3178
3310
  if (rest === '') return;
3179
3311
  if (context.delimiters?.match(rest, context.precedence)) return;
3180
- const result = parsers[i](rest, context);
3312
+ const result = parsers[i]({
3313
+ source: rest,
3314
+ context
3315
+ });
3181
3316
  if (!result) return;
3182
3317
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3183
3318
  rest = (0, parser_1.exec)(result);
@@ -3219,7 +3354,10 @@ function some(parser, end, delimiters = [], limit = -1) {
3219
3354
  matcher: delimiter_1.Delimiters.matcher(delimiter),
3220
3355
  precedence
3221
3356
  }));
3222
- return (source, context) => {
3357
+ return ({
3358
+ source,
3359
+ context
3360
+ }) => {
3223
3361
  if (source === '') return;
3224
3362
  let rest = source;
3225
3363
  let nodes;
@@ -3233,7 +3371,10 @@ function some(parser, end, delimiters = [], limit = -1) {
3233
3371
  if (rest === '') break;
3234
3372
  if (match(rest)) break;
3235
3373
  if (context.delimiters?.match(rest, context.precedence)) break;
3236
- const result = parser(rest, context);
3374
+ const result = parser({
3375
+ source: rest,
3376
+ context
3377
+ });
3237
3378
  if (!result) break;
3238
3379
  nodes = nodes ? nodes.length < (0, parser_1.eval)(result).length ? (0, array_1.unshift)(nodes, (0, parser_1.eval)(result)) : (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3239
3380
  rest = (0, parser_1.exec)(result);
@@ -3320,7 +3461,7 @@ function union(parsers) {
3320
3461
  return parsers[0];
3321
3462
 
3322
3463
  default:
3323
- return (0, global_1.Function)('parsers', ['"use strict";', 'return (source, context) =>', '0', ...parsers.map((_, i) => `|| parsers[${i}](source, context)`)].join('\n'))(parsers);
3464
+ return (0, global_1.Function)('parsers', ['"use strict";', 'return (input, context) =>', '0', ...parsers.map((_, i) => `|| parsers[${i}](input, context)`)].join('\n'))(parsers);
3324
3465
  }
3325
3466
  }
3326
3467
 
@@ -3459,8 +3600,6 @@ const header_1 = __webpack_require__(5702);
3459
3600
 
3460
3601
  const block_1 = __webpack_require__(4032);
3461
3602
 
3462
- const context_1 = __webpack_require__(6484);
3463
-
3464
3603
  const normalize_1 = __webpack_require__(185);
3465
3604
 
3466
3605
  const header_2 = __webpack_require__(7790);
@@ -3476,7 +3615,9 @@ const array_1 = __webpack_require__(8112);
3476
3615
  function bind(target, settings) {
3477
3616
  let context = { ...settings,
3478
3617
  host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
3479
- memorable: context_1.backtrackable
3618
+ memorable: 236
3619
+ /* State.backtrackable */
3620
+
3480
3621
  };
3481
3622
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3482
3623
  const blocks = [];
@@ -3530,9 +3671,15 @@ function bind(target, settings) {
3530
3671
 
3531
3672
  for (; index < sourceSegments.length - last; ++index) {
3532
3673
  const seg = sourceSegments[index];
3533
- const es = (0, parser_1.eval)((0, header_1.header)(seg, {
3534
- header: index === 0
3535
- }) || (0, block_1.block)(seg, context), []);
3674
+ const es = (0, parser_1.eval)((0, header_1.header)({
3675
+ source: seg,
3676
+ context: {
3677
+ header: index === 0
3678
+ }
3679
+ }) || (0, block_1.block)({
3680
+ source: seg,
3681
+ context
3682
+ }), []);
3536
3683
  blocks.splice(index, 0, [seg, es, url]);
3537
3684
  if (es.length === 0) continue; // All deletion processes always run after all addition processes have done.
3538
3685
  // Therefore any `base` node will never be unavailable by deletions until all the dependent `el` nodes are added.
@@ -3717,7 +3864,10 @@ function headers(source) {
3717
3864
  exports.headers = headers;
3718
3865
 
3719
3866
  function parse(source) {
3720
- const result = (0, header_1.header)(source, {});
3867
+ const result = (0, header_1.header)({
3868
+ source,
3869
+ context: {}
3870
+ });
3721
3871
  const [el] = (0, parser_1.eval)(result, []);
3722
3872
  return el?.tagName === 'ASIDE' ? [el, (0, parser_1.exec)(result)] : [];
3723
3873
  }
@@ -3759,7 +3909,10 @@ function sanitize(source) {
3759
3909
 
3760
3910
  exports.invisibleHTMLEntityNames = ['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'shy', 'ensp', 'emsp', 'emsp13', 'emsp14', 'numsp', 'puncsp', 'ThinSpace', 'thinsp', 'VeryThinSpace', 'hairsp', 'ZeroWidthSpace', 'NegativeVeryThinSpace', 'NegativeThinSpace', 'NegativeMediumSpace', 'NegativeThickSpace', 'zwj', 'zwnj', 'lrm', 'rlm', 'MediumSpace', 'NoBreak', 'ApplyFunction', 'af', 'InvisibleTimes', 'it', 'InvisibleComma', 'ic'];
3761
3911
  const unreadableHTMLEntityNames = exports.invisibleHTMLEntityNames.slice(2);
3762
- const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(`&${name};`, {}))[0]);
3912
+ const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)({
3913
+ source: `&${name};`,
3914
+ context: {}
3915
+ }))[0]);
3763
3916
  const unreadableEscapableCharacter = new RegExp(`[${[...new Set(unreadableEscapableCharacters)].join('')}]`, 'g');
3764
3917
  // https://www.pandanoir.info/entry/2018/03/11/193000
3765
3918
  // http://anti.rosx.net/etc/memo/002_space.html
@@ -3810,8 +3963,6 @@ const header_1 = __webpack_require__(5702);
3810
3963
 
3811
3964
  const block_1 = __webpack_require__(4032);
3812
3965
 
3813
- const context_1 = __webpack_require__(6484);
3814
-
3815
3966
  const normalize_1 = __webpack_require__(185);
3816
3967
 
3817
3968
  const header_2 = __webpack_require__(7790);
@@ -3836,16 +3987,24 @@ function parse(source, opts = {}, context) {
3836
3987
  ...(context?.resources && {
3837
3988
  resources: context.resources
3838
3989
  }),
3839
- memorable: context_1.backtrackable
3990
+ memorable: 236
3991
+ /* State.backtrackable */
3992
+
3840
3993
  };
3841
3994
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3842
3995
  const node = (0, dom_1.frag)();
3843
3996
  let index = 0;
3844
3997
 
3845
3998
  for (const seg of (0, segment_1.segment)(source)) {
3846
- node.append(...(0, parser_1.eval)((0, header_1.header)(seg, {
3847
- header: index++ === 0
3848
- }) || (0, block_1.block)(seg, context), []));
3999
+ node.append(...(0, parser_1.eval)((0, header_1.header)({
4000
+ source: seg,
4001
+ context: {
4002
+ header: index++ === 0
4003
+ }
4004
+ }) || (0, block_1.block)({
4005
+ source: seg,
4006
+ context
4007
+ }), []));
3849
4008
  }
3850
4009
 
3851
4010
  if (opts.test) return node;
@@ -3880,7 +4039,10 @@ const source_1 = __webpack_require__(6743);
3880
4039
 
3881
4040
  const delimiter = /[@#>0-9A-Za-z\n]|\S[#>]/;
3882
4041
 
3883
- const autolink = (source, context) => {
4042
+ const autolink = ({
4043
+ source,
4044
+ context
4045
+ }) => {
3884
4046
  if (source === '') return;
3885
4047
  const i = source.search(delimiter);
3886
4048
 
@@ -3889,7 +4051,10 @@ const autolink = (source, context) => {
3889
4051
  return [[source], ''];
3890
4052
 
3891
4053
  case 0:
3892
- return parser(source, context);
4054
+ return parser({
4055
+ source,
4056
+ context
4057
+ });
3893
4058
 
3894
4059
  default:
3895
4060
  return [[source.slice(0, i)], source.slice(i)];
@@ -3958,10 +4123,15 @@ exports.block = (0, combinator_1.creation)(error((0, combinator_1.reset)({
3958
4123
  }, (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]))));
3959
4124
 
3960
4125
  function error(parser) {
3961
- return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)('\x07', source => {
4126
+ return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)('\x07', ({
4127
+ source
4128
+ }) => {
3962
4129
  throw new Error(source.split('\n', 1)[0]);
3963
- }), parser), (source, {
3964
- id
4130
+ }), parser), ({
4131
+ source,
4132
+ context: {
4133
+ id
4134
+ }
3965
4135
  }, reason) => [[(0, dom_1.html)('h1', {
3966
4136
  id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : global_1.undefined,
3967
4137
  class: 'error'
@@ -4002,7 +4172,10 @@ const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combin
4002
4172
  const unindent = source => source.replace(/(^|\n)>(?:[^\S\n]|(?=>*(?:$|\s)))|\n$/g, '$1');
4003
4173
 
4004
4174
  const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)((0, combinator_1.some)(autolink_1.autolink), ns => [(0, dom_1.html)('pre', (0, dom_1.defrag)(ns))])))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
4005
- const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown)), (0, combinator_1.creation)(99, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (source, context) => {
4175
+ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown)), (0, combinator_1.creation)(99, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
4176
+ source,
4177
+ context
4178
+ }) => {
4006
4179
  const references = (0, dom_1.html)('ol', {
4007
4180
  class: 'references'
4008
4181
  });
@@ -4083,7 +4256,10 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.validate)('```', (0
4083
4256
  'data-lang': params.lang || global_1.undefined,
4084
4257
  'data-line': params.line || global_1.undefined,
4085
4258
  'data-path': params.path || global_1.undefined
4086
- }, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) || global_1.undefined : (0, dom_1.defrag)((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)(body.slice(0, -1), context), [])));
4259
+ }, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) || global_1.undefined : (0, dom_1.defrag)((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)({
4260
+ source: body.slice(0, -1),
4261
+ context
4262
+ }), [])));
4087
4263
  return [el];
4088
4264
  })));
4089
4265
 
@@ -4114,17 +4290,17 @@ const dom_1 = __webpack_require__(3252);
4114
4290
 
4115
4291
  const array_1 = __webpack_require__(8112);
4116
4292
 
4117
- exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.validate)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(64
4293
+ exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.validate)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128
4118
4294
  /* State.annotation */
4119
- | 32
4295
+ | 64
4120
4296
  /* State.reference */
4121
- | 16
4297
+ | 32
4122
4298
  /* State.index */
4123
- | 8
4299
+ | 16
4124
4300
  /* State.label */
4125
- | 4
4301
+ | 8
4126
4302
  /* State.link */
4127
- | 2
4303
+ | 4
4128
4304
  /* State.media */
4129
4305
  , (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))]))));
4130
4306
  const term = (0, combinator_1.creation)((0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => [(0, dom_1.html)('dt', (0, dom_1.defrag)(ns))]))));
@@ -4283,7 +4459,10 @@ exports.example = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
4283
4459
  'data-type': 'math'
4284
4460
  }, [(0, dom_1.html)('pre', {
4285
4461
  translate: 'no'
4286
- }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)(`$$\n${body}$$`, context), [])[0]])];
4462
+ }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)({
4463
+ source: `$$\n${body}$$`,
4464
+ context
4465
+ }), [])[0]])];
4287
4466
 
4288
4467
  default:
4289
4468
  return [(0, dom_1.html)('pre', {
@@ -4413,7 +4592,7 @@ const memoize_1 = __webpack_require__(1808);
4413
4592
 
4414
4593
  exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n])?(?=\[?\$)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${fence}[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([// All parsers which can include closing terms.
4415
4594
  (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length, [])));
4416
- exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.state)(2
4595
+ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.state)(4
4417
4596
  /* State.media */
4418
4597
  , (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.trimEnd)((0, combinator_1.some)(inline_1.inline)))))))])])), ([label, param, content, ...caption]) => [(0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
4419
4598
  class: 'figindex'
@@ -4429,7 +4608,10 @@ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinat
4429
4608
  } || overflow && {
4430
4609
  'data-invalid-type': 'fence',
4431
4610
  'data-invalid-message': `Invalid trailing line after the closing delimiter "${delim}"`
4432
- } || !(0, label_1.segment)(opener.match(/^~+(?:figure[^\S\n]+)?(\[?\$\S+)/)?.[1] ?? '', context) && {
4611
+ } || !(0, label_1.segment)({
4612
+ source: opener.match(/^~+(?:figure[^\S\n]+)?(\[?\$\S+)/)?.[1] ?? '',
4613
+ context
4614
+ }) && {
4433
4615
  'data-invalid-type': 'label',
4434
4616
  'data-invalid-message': 'Invalid label'
4435
4617
  } || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && {
@@ -4589,7 +4771,10 @@ exports.message = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
4589
4771
  return [(0, dom_1.html)('section', {
4590
4772
  class: `message`,
4591
4773
  'data-type': type
4592
- }, (0, array_1.unshift)([(0, dom_1.html)('h1', title(type))], [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, parser_1.eval)(content(seg, context), [])), [])))];
4774
+ }, (0, array_1.unshift)([(0, dom_1.html)('h1', title(type))], [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, parser_1.eval)(content({
4775
+ source: seg,
4776
+ context
4777
+ }), [])), [])))];
4593
4778
  })));
4594
4779
 
4595
4780
  function title(type) {
@@ -4683,7 +4868,10 @@ exports.table = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
4683
4868
  switch (type) {
4684
4869
  case 'grid':
4685
4870
  case global_1.undefined:
4686
- return ((0, parser_1.eval)(parser(body, context)) ?? [(0, dom_1.html)('table')]).map(el => (0, dom_1.define)(el, {
4871
+ return ((0, parser_1.eval)(parser({
4872
+ source: body,
4873
+ context
4874
+ })) ?? [(0, dom_1.html)('table')]).map(el => (0, dom_1.define)(el, {
4687
4875
  'data-type': type
4688
4876
  }));
4689
4877
 
@@ -4938,20 +5126,22 @@ const visibility_1 = __webpack_require__(7618);
4938
5126
 
4939
5127
  const dom_1 = __webpack_require__(3252);
4940
5128
 
4941
- exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, combinator_1.focus)(/^#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/, (0, combinator_1.some)((0, combinator_1.line)(source => [[source], ''])))));
4942
- exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.state)(64
5129
+ exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, combinator_1.focus)(/^#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/, (0, combinator_1.some)((0, combinator_1.line)(({
5130
+ source
5131
+ }) => [[source], ''])))));
5132
+ exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.state)(128
4943
5133
  /* State.annotation */
4944
- | 32
5134
+ | 64
4945
5135
  /* State.reference */
4946
- | 16
5136
+ | 32
4947
5137
  /* State.index */
4948
- | 8
5138
+ | 16
4949
5139
  /* State.label */
4950
- | 4
5140
+ | 8
4951
5141
  /* State.link */
4952
- | 2
5142
+ | 4
4953
5143
  /* State.media */
4954
- , (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/^##+/), (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(1
5144
+ , (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/^##+/), (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(2
4955
5145
  /* State.autolink */
4956
5146
  , (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), ([h, ...ns]) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
4957
5147
  class: 'invalid',
@@ -5002,7 +5192,7 @@ const inline_1 = __webpack_require__(1160);
5002
5192
 
5003
5193
  const dom_1 = __webpack_require__(3252);
5004
5194
 
5005
- exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^[-+*](?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.state)(2
5195
+ exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^[-+*](?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.state)(4
5006
5196
  /* State.media */
5007
5197
  , exports.ilist_))));
5008
5198
  exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^[-+*](?:$|\s)/, (0, combinator_1.some)((0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^[-+*](?:$|\s)/, (0, combinator_1.some)(inline_1.inline), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), olist_1.invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))])])))), es => [(0, dom_1.html)('ul', {
@@ -5085,13 +5275,11 @@ const duff_1 = __webpack_require__(8099);
5085
5275
 
5086
5276
  const array_1 = __webpack_require__(8112);
5087
5277
 
5088
- const tuple_1 = __webpack_require__(5341);
5089
-
5090
5278
  const openers = {
5091
5279
  '.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?:$|\s)/,
5092
5280
  '(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?:$|\s)/
5093
5281
  };
5094
- exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/.source, /^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/.source].join('|')), (0, combinator_1.state)(2
5282
+ exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/.source, /^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/.source].join('|')), (0, combinator_1.state)(4
5095
5283
  /* State.media */
5096
5284
  , exports.olist_))));
5097
5285
  exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]).charCodeAt(0) || 0, [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1]).charCodeAt(0) || 0, []))])));
@@ -5101,10 +5289,18 @@ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, c
5101
5289
  }, (0, dom_1.defrag)((0, ulist_1.fillFirstLine)((0, array_1.shift)(ns)[1])))]), true)]))), es => [format((0, dom_1.html)('ol', es), type, form)]);
5102
5290
 
5103
5291
  const heads = {
5104
- '.': (0, combinator_1.focus)(openers['.'], source => [[source.trimEnd().split('.', 1)[0] + '.'], '']),
5105
- '(': (0, combinator_1.focus)(openers['('], source => [[source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')], ''])
5292
+ '.': (0, combinator_1.focus)(openers['.'], ({
5293
+ source
5294
+ }) => [[source.trimEnd().split('.', 1)[0] + '.'], '']),
5295
+ '(': (0, combinator_1.focus)(openers['('], ({
5296
+ source
5297
+ }) => [[source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')], ''])
5106
5298
  };
5107
- exports.invalid = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(s => [(0, tuple_1.tuple)(s), ''])]), source => [['', (0, dom_1.html)('span', {
5299
+ exports.invalid = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(({
5300
+ source
5301
+ }) => [[source], ''])]), ({
5302
+ source
5303
+ }) => [['', (0, dom_1.html)('span', {
5108
5304
  class: 'invalid',
5109
5305
  'data-invalid-syntax': 'listitem',
5110
5306
  'data-invalid-type': 'syntax',
@@ -5285,9 +5481,13 @@ exports.cite = (0, combinator_1.creation)((0, combinator_1.line)((0, combinator_
5285
5481
  // リンクの実装は後で検討
5286
5482
  (0, combinator_1.focus)(/^>>\.[^\S\n]*(?:$|\n)/, () => [[(0, dom_1.html)('a', {
5287
5483
  class: 'anchor'
5288
- }, '>>.')], '']), (0, combinator_1.focus)(/^>>#\S*[^\S\n]*(?:$|\n)/, source => [[(0, dom_1.html)('a', {
5484
+ }, '>>.')], '']), (0, combinator_1.focus)(/^>>#\S*[^\S\n]*(?:$|\n)/, ({
5485
+ source
5486
+ }) => [[(0, dom_1.html)('a', {
5289
5487
  class: 'anchor'
5290
- }, source)], '']), (0, combinator_1.focus)(/^>>https?:\/\/\w\S*[^\S\n]*(?:$|\n)/, source => [[(0, dom_1.html)('a', {
5488
+ }, source)], '']), (0, combinator_1.focus)(/^>>https?:\/\/\w\S*[^\S\n]*(?:$|\n)/, ({
5489
+ source
5490
+ }) => [[(0, dom_1.html)('a', {
5291
5491
  class: 'anchor',
5292
5492
  href: source.slice(2).trimEnd(),
5293
5493
  target: '_blank'
@@ -5332,12 +5532,18 @@ exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, comb
5332
5532
  'data-invalid-message': `Missing the whitespace after "${ns[0].split(/[^>]/, 1)[0]}"`
5333
5533
  }, (0, dom_1.defrag)(ns)), (0, dom_1.html)('br')]), false)));
5334
5534
 
5335
- const qblock = (source, context) => {
5535
+ const qblock = ({
5536
+ source,
5537
+ context
5538
+ }) => {
5336
5539
  source = source.replace(/\n$/, '');
5337
5540
  const lines = source.match(/^.*\n?/mg);
5338
5541
  const quotes = source.match(/^>+[^\S\n]/mg);
5339
5542
  const content = lines.reduce((acc, line, row) => acc + line.slice(quotes[row].length), '');
5340
- const nodes = (0, parser_1.eval)((0, combinator_1.some)(text)(content, context), []);
5543
+ const nodes = (0, parser_1.eval)((0, combinator_1.some)(text)({
5544
+ source: content,
5545
+ context
5546
+ }), []);
5341
5547
  nodes.unshift(quotes.shift());
5342
5548
 
5343
5549
  for (let i = 0; i < nodes.length; ++i) {
@@ -5431,7 +5637,9 @@ const array_1 = __webpack_require__(8112);
5431
5637
 
5432
5638
  exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^\|[^\n]*(?:\n\|[^\n]*){2}/, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => [(0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift()]), (0, dom_1.html)('tbody', format(rows))])])));
5433
5639
 
5434
- const row = (parser, optional) => (0, combinator_1.creation)((0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^[|\\]?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, source => [[(0, dom_1.html)('tr', {
5640
+ const row = (parser, optional) => (0, combinator_1.creation)((0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^[|\\]?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, ({
5641
+ source
5642
+ }) => [[(0, dom_1.html)('tr', {
5435
5643
  class: 'invalid',
5436
5644
  'data-invalid-syntax': 'table-row',
5437
5645
  'data-invalid-type': 'syntax',
@@ -5487,11 +5695,13 @@ const dom_1 = __webpack_require__(3252);
5487
5695
 
5488
5696
  const array_1 = __webpack_require__(8112);
5489
5697
 
5490
- exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^-(?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.state)(2
5698
+ exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^-(?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.state)(4
5491
5699
  /* State.media */
5492
5700
  , exports.ulist_))));
5493
5701
  exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^-(?=$|\s)/, (0, combinator_1.some)((0, combinator_1.creation)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), olist_1.invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)(fillFirstLine(ns)))]), true)])))), es => [format((0, dom_1.html)('ul', es))])));
5494
- exports.checkbox = (0, combinator_1.creation)((0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [[(0, dom_1.html)('span', {
5702
+ exports.checkbox = (0, combinator_1.creation)((0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, ({
5703
+ source
5704
+ }) => [[(0, dom_1.html)('span', {
5495
5705
  class: 'checkbox'
5496
5706
  }, source[1].trimStart() ? '☑' : '☐')], '']));
5497
5707
 
@@ -5511,30 +5721,6 @@ function format(el) {
5511
5721
 
5512
5722
  /***/ }),
5513
5723
 
5514
- /***/ 6484:
5515
- /***/ ((__unused_webpack_module, exports) => {
5516
-
5517
- "use strict";
5518
-
5519
-
5520
- Object.defineProperty(exports, "__esModule", ({
5521
- value: true
5522
- }));
5523
- exports.backtrackable = void 0;
5524
- exports.backtrackable = 0 | 64
5525
- /* State.annotation */
5526
- | 32
5527
- /* State.reference */
5528
- | 16
5529
- /* State.index */
5530
- | 4
5531
- /* State.link */
5532
- | 2
5533
- /* State.media */
5534
- ;
5535
-
5536
- /***/ }),
5537
-
5538
5724
  /***/ 5702:
5539
5725
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5540
5726
 
@@ -5556,18 +5742,25 @@ const normalize_1 = __webpack_require__(185);
5556
5742
 
5557
5743
  const dom_1 = __webpack_require__(3252);
5558
5744
 
5559
- exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^---+[^\S\v\f\r\n]*\r?\n[^\S\n]*(?=\S)/, (0, combinator_1.inits)([(0, combinator_1.rewrite)((source, context) => [[], context.header ?? true ? source.slice((0, segment_1.segment)(source).next().value.length) : ''], (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.guard)(context => context.header ?? true, (0, combinator_1.focus)(/^---[^\S\v\f\r\n]*\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[A-Za-z][0-9A-Za-z]*)*:[ \t]+\S[^\v\f\r\n]*\r?\n){1,100}---[^\S\v\f\r\n]*(?:$|\r?\n)/, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), es => [(0, dom_1.html)('aside', {
5745
+ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^---+[^\S\v\f\r\n]*\r?\n[^\S\n]*(?=\S)/, (0, combinator_1.inits)([(0, combinator_1.rewrite)(({
5746
+ source,
5747
+ context
5748
+ }) => [[], context.header ?? true ? source.slice((0, segment_1.segment)(source).next().value.length) : ''], (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.guard)(context => context.header ?? true, (0, combinator_1.focus)(/^---[^\S\v\f\r\n]*\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[A-Za-z][0-9A-Za-z]*)*:[ \t]+\S[^\v\f\r\n]*\r?\n){1,100}---[^\S\v\f\r\n]*(?:$|\r?\n)/, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), es => [(0, dom_1.html)('aside', {
5560
5749
  class: 'header'
5561
5750
  }, [(0, dom_1.html)('details', {
5562
5751
  open: ''
5563
- }, (0, dom_1.defrag)([(0, dom_1.html)('summary', 'Header'), ...es]))])])))), source => [[(0, dom_1.html)('pre', {
5752
+ }, (0, dom_1.defrag)([(0, dom_1.html)('summary', 'Header'), ...es]))])])))), ({
5753
+ source
5754
+ }) => [[(0, dom_1.html)('pre', {
5564
5755
  class: 'invalid',
5565
5756
  translate: 'no',
5566
5757
  'data-invalid-syntax': 'header',
5567
5758
  'data-invalid-type': 'syntax',
5568
5759
  'data-invalid-message': 'Invalid syntax'
5569
5760
  }, (0, normalize_1.normalize)(source))], '']]))), (0, combinator_1.clear)((0, source_1.str)(/^[^\S\v\f\r\n]*\r?\n/))])));
5570
- const field = (0, combinator_1.line)(source => {
5761
+ const field = (0, combinator_1.line)(({
5762
+ source
5763
+ }) => {
5571
5764
  const name = source.slice(0, source.indexOf(':'));
5572
5765
  const value = source.slice(name.length + 1).trim();
5573
5766
  return [[(0, dom_1.html)('span', {
@@ -5703,17 +5896,17 @@ const visibility_1 = __webpack_require__(7618);
5703
5896
 
5704
5897
  const dom_1 = __webpack_require__(3252);
5705
5898
 
5706
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((', (0, combinator_1.constraint)(64
5899
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((', (0, combinator_1.constraint)(128
5707
5900
  /* State.annotation */
5708
- , false, (0, combinator_1.state)(64
5901
+ , false, (0, combinator_1.syntax)(32
5902
+ /* Syntax.annotation */
5903
+ , 6, 1, 128
5709
5904
  /* State.annotation */
5710
- | 2
5905
+ | 4
5711
5906
  /* State.media */
5712
- , (0, combinator_1.syntax)(32
5713
- /* Syntax.annotation */
5714
- , 6, 1, (0, visibility_1.startLoose)((0, combinator_1.context)({
5907
+ , (0, visibility_1.startLoose)((0, combinator_1.context)({
5715
5908
  delimiters: global_1.undefined
5716
- }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')')))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5909
+ }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')'))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5717
5910
  class: 'annotation'
5718
5911
  }, [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
5719
5912
 
@@ -5750,11 +5943,13 @@ const source_1 = __webpack_require__(6743);
5750
5943
 
5751
5944
  const util_1 = __webpack_require__(9437);
5752
5945
 
5753
- exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]|\S[#>])/, (0, combinator_1.constraint)(1
5946
+ exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]|\S[#>])/, (0, combinator_1.constraint)(2
5754
5947
  /* State.autolink */
5755
5948
  , false, (0, combinator_1.syntax)(2
5756
5949
  /* Syntax.autolink */
5757
- , 1, 1, (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
5950
+ , 1, 1, 0
5951
+ /* State.none */
5952
+ , (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
5758
5953
  (0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*(?:@(?:[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)*/), channel_1.channel, account_1.account, // Escape unmatched account-like strings.
5759
5954
  (0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), // Escape invalid leading characters.
5760
5955
  (0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])(?=#)/u.source.replace('emoji', hashtag_1.emoji), 'u')), hashtag_1.hashtag, hashnum_1.hashnum, // Escape unmatched hashtag-like strings.
@@ -5782,7 +5977,9 @@ const source_1 = __webpack_require__(6743);
5782
5977
  const dom_1 = __webpack_require__(3252); // https://example/@user must be a user page or a redirect page going there.
5783
5978
 
5784
5979
 
5785
- 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.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
5980
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1
5981
+ /* State.shortcut */
5982
+ , false, (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.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
5786
5983
  class: 'account'
5787
5984
  })]));
5788
5985
 
@@ -5811,7 +6008,9 @@ const dom_1 = __webpack_require__(3252); // Timeline(pseudonym): user/tid
5811
6008
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
5812
6009
 
5813
6010
 
5814
- 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.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
6011
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.constraint)(1
6012
+ /* State.shortcut */
6013
+ , false, (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.unsafelink])))), ([el]) => [(0, dom_1.define)(el, {
5815
6014
  class: 'anchor'
5816
6015
  })])));
5817
6016
 
@@ -5870,7 +6069,9 @@ const source_1 = __webpack_require__(6743);
5870
6069
  const dom_1 = __webpack_require__(3252); // https://html.spec.whatwg.org/multipage/input.html
5871
6070
 
5872
6071
 
5873
- exports.email = (0, combinator_1.creation)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*@[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])?)*(?![0-9A-Za-z])/), ([source]) => source.indexOf('@') <= 64 && source.length <= 255), source => [[(0, dom_1.html)('a', {
6072
+ exports.email = (0, combinator_1.creation)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*@[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])?)*(?![0-9A-Za-z])/), ([source]) => source.indexOf('@') <= 64 && source.length <= 255), ({
6073
+ source
6074
+ }) => [[(0, dom_1.html)('a', {
5874
6075
  class: 'email',
5875
6076
  href: `mailto:${source}`
5876
6077
  }, source)], '']));
@@ -5898,7 +6099,9 @@ const source_1 = __webpack_require__(6743);
5898
6099
 
5899
6100
  const dom_1 = __webpack_require__(3252);
5900
6101
 
5901
- 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.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
6102
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1
6103
+ /* State.shortcut */
6104
+ , false, (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.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
5902
6105
  class: 'hashnum',
5903
6106
  href: null
5904
6107
  })]));
@@ -5927,7 +6130,9 @@ const dom_1 = __webpack_require__(3252); // https://example/hashtags/a must be a
5927
6130
 
5928
6131
 
5929
6132
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
5930
- 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.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
6133
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.constraint)(1
6134
+ /* State.shortcut */
6135
+ , false, (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.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
5931
6136
  class: 'hashtag'
5932
6137
  }, el.innerText)]));
5933
6138
 
@@ -5950,8 +6155,12 @@ const link_1 = __webpack_require__(9628);
5950
6155
 
5951
6156
  const source_1 = __webpack_require__(6743);
5952
6157
 
6158
+ const dom_1 = __webpack_require__(3252);
6159
+
5953
6160
  const closer = /^[-+*=~^,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
5954
- 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.unsafelink])))));
6161
+ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.fmap)((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.unsafelink]))), ([el]) => [(0, dom_1.define)(el, {
6162
+ class: 'url'
6163
+ })])));
5955
6164
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((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)]))));
5956
6165
 
5957
6166
  /***/ }),
@@ -5982,24 +6191,38 @@ const array_1 = __webpack_require__(8112);
5982
6191
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
5983
6192
  exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(0
5984
6193
  /* Syntax.none */
5985
- , 2, 1, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
6194
+ , 2, 1, 0
6195
+ /* State.none */
6196
+ , (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
5986
6197
  /* Syntax.bracket */
5987
- , 2, 1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
6198
+ , 2, 1, 0
6199
+ /* State.none */
6200
+ , (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5988
6201
  class: 'paren'
5989
6202
  }, (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.syntax)(0
5990
6203
  /* Syntax.none */
5991
- , 2, 1, (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.syntax)(128
6204
+ , 2, 1, 0
6205
+ /* State.none */
6206
+ , (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.syntax)(128
5992
6207
  /* Syntax.bracket */
5993
- , 2, 1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
6208
+ , 2, 1, 0
6209
+ /* State.none */
6210
+ , (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5994
6211
  class: 'paren'
5995
6212
  }, (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.syntax)(128
5996
6213
  /* Syntax.bracket */
5997
- , 2, 1, (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.syntax)(128
6214
+ , 2, 1, 0
6215
+ /* State.none */
6216
+ , (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.syntax)(128
5998
6217
  /* Syntax.bracket */
5999
- , 2, 1, (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.
6218
+ , 2, 1, 0
6219
+ /* State.none */
6220
+ , (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.
6000
6221
  (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.syntax)(1
6001
6222
  /* Syntax.quote */
6002
- , 8, 1, (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])]));
6223
+ , 8, 1, 0
6224
+ /* State.none */
6225
+ , (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])]));
6003
6226
 
6004
6227
  /***/ }),
6005
6228
 
@@ -6018,9 +6241,11 @@ const combinator_1 = __webpack_require__(2087);
6018
6241
 
6019
6242
  const dom_1 = __webpack_require__(3252);
6020
6243
 
6021
- exports.code = (0, combinator_1.creation)((0, combinator_1.validate)('`', (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?[^`\n])\1(?!`)/, ([whole,, body]) => rest => [[(0, dom_1.html)('code', {
6244
+ exports.code = (0, combinator_1.creation)((0, combinator_1.validate)('`', (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?[^`\n])\1(?!`)/, ([whole,, body]) => ({
6245
+ source
6246
+ }) => [[(0, dom_1.html)('code', {
6022
6247
  'data-src': whole
6023
- }, format(body))], rest.slice(whole.length)])));
6248
+ }, format(body))], source.slice(whole.length)])));
6024
6249
 
6025
6250
  function format(text) {
6026
6251
  return `${text[0]}${text[text.length - 1]}` === ' ' && text.trimStart() ? text.slice(1, -1) : text;
@@ -6053,7 +6278,9 @@ const array_1 = __webpack_require__(8112);
6053
6278
 
6054
6279
  exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.syntax)(0
6055
6280
  /* Syntax.none */
6056
- , 4, 1, (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', {
6281
+ , 4, 1, 0
6282
+ /* State.none */
6283
+ , (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', {
6057
6284
  class: 'comment'
6058
6285
  }, [(0, dom_1.html)('input', {
6059
6286
  type: 'checkbox'
@@ -6086,7 +6313,9 @@ const array_1 = __webpack_require__(8112);
6086
6313
 
6087
6314
  exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.syntax)(0
6088
6315
  /* Syntax.none */
6089
- , 1, 1, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), (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]));
6316
+ , 1, 1, 0
6317
+ /* State.none */
6318
+ , (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), (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]));
6090
6319
 
6091
6320
  /***/ }),
6092
6321
 
@@ -6119,7 +6348,9 @@ const array_1 = __webpack_require__(8112);
6119
6348
 
6120
6349
  exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*'), (0, combinator_1.syntax)(0
6121
6350
  /* Syntax.none */
6122
- , 1, 1, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (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]));
6351
+ , 1, 1, 0
6352
+ /* State.none */
6353
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (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]));
6123
6354
 
6124
6355
  /***/ }),
6125
6356
 
@@ -6154,16 +6385,24 @@ const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combin
6154
6385
  const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
6155
6386
  exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('***'), (0, combinator_1.syntax)(0
6156
6387
  /* Syntax.none */
6157
- , 1, 1, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
6388
+ , 1, 1, 0
6389
+ /* State.none */
6390
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
6158
6391
  switch (cs[0]) {
6159
6392
  case '***':
6160
6393
  return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
6161
6394
 
6162
6395
  case '**':
6163
- return (0, combinator_1.bind)(subemphasis, (ds, rest) => rest.slice(0, 1) === '*' ? [[(0, dom_1.html)('em', (0, array_1.unshift)([(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(1)] : [(0, array_1.unshift)(['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], ds), rest])(rest, context) ?? [['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest];
6396
+ return (0, combinator_1.bind)(subemphasis, (ds, rest) => rest.slice(0, 1) === '*' ? [[(0, dom_1.html)('em', (0, array_1.unshift)([(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(1)] : [(0, array_1.unshift)(['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], ds), rest])({
6397
+ source: rest,
6398
+ context
6399
+ }) ?? [['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest];
6164
6400
 
6165
6401
  case '*':
6166
- 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];
6402
+ 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])({
6403
+ source: rest,
6404
+ context
6405
+ }) ?? [['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest];
6167
6406
  }
6168
6407
  }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6169
6408
 
@@ -6187,18 +6426,27 @@ const combinator_1 = __webpack_require__(2087);
6187
6426
  const source_1 = __webpack_require__(6743);
6188
6427
 
6189
6428
  const repeat = (0, source_1.str)(/^(.)\1*/);
6190
- exports.escape = (0, combinator_1.union)([(source, context) => {
6429
+ exports.escape = (0, combinator_1.union)([({
6430
+ source,
6431
+ context
6432
+ }) => {
6191
6433
  if (source.length < 3) return;
6192
6434
 
6193
6435
  switch (source[0]) {
6194
6436
  case '*':
6195
6437
  if (source.length < 4) return;
6196
- return source[3] === source[0] && source[2] === source[0] && source[1] === source[0] ? repeat(source, context) : global_1.undefined;
6438
+ return source[3] === source[0] && source[2] === source[0] && source[1] === source[0] ? repeat({
6439
+ source,
6440
+ context
6441
+ }) : global_1.undefined;
6197
6442
 
6198
6443
  case '+':
6199
6444
  case '~':
6200
6445
  case '=':
6201
- return source[2] === source[0] && source[1] === source[0] ? repeat(source, context) : global_1.undefined;
6446
+ return source[2] === source[0] && source[1] === source[0] ? repeat({
6447
+ source,
6448
+ context
6449
+ }) : global_1.undefined;
6202
6450
 
6203
6451
  default:
6204
6452
  return;
@@ -6255,25 +6503,13 @@ const visibility_1 = __webpack_require__(7618);
6255
6503
 
6256
6504
  const dom_1 = __webpack_require__(3252);
6257
6505
 
6258
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.constraint)(16
6506
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.constraint)(32
6259
6507
  /* State.index */
6260
- , false, (0, combinator_1.state)(64
6261
- /* State.annotation */
6262
- | 32
6263
- /* State.reference */
6264
- | 16
6265
- /* State.index */
6266
- | 8
6267
- /* State.label */
6268
- | 4
6269
- /* State.link */
6270
- | 2
6271
- /* State.media */
6272
- | 1
6273
- /* State.autolink */
6274
- , (0, combinator_1.syntax)(1024
6508
+ , false, (0, combinator_1.syntax)(1024
6275
6509
  /* Syntax.index */
6276
- , 2, 1, (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, visibility_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, {
6510
+ , 2, 1, 254
6511
+ /* State.linkable */
6512
+ , (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, visibility_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, {
6277
6513
  id: el.id ? null : global_1.undefined,
6278
6514
  class: 'index',
6279
6515
  href: el.id ? `#${el.id}` : global_1.undefined
@@ -6383,7 +6619,7 @@ const index_1 = __webpack_require__(4479);
6383
6619
 
6384
6620
  const dom_1 = __webpack_require__(3252);
6385
6621
 
6386
- exports.indexer = (0, combinator_1.creation)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[#\S)/, (0, combinator_1.state)(16
6622
+ exports.indexer = (0, combinator_1.creation)((0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.surround)(/^\s+(?=\[#\S)/, (0, combinator_1.state)(32
6387
6623
  /* State.index */
6388
6624
  , false, (0, combinator_1.union)([(0, combinator_1.focus)('[#]', () => [[(0, dom_1.html)('a', {
6389
6625
  href: '#'
@@ -6416,7 +6652,7 @@ const dom_1 = __webpack_require__(3252);
6416
6652
 
6417
6653
  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]))/);
6418
6654
  exports.segment = (0, combinator_1.clear)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])));
6419
- exports.label = (0, combinator_1.validate)(['[$', '$'], (0, combinator_1.creation)((0, combinator_1.fmap)((0, combinator_1.constraint)(8
6655
+ exports.label = (0, combinator_1.validate)(['[$', '$'], (0, combinator_1.creation)((0, combinator_1.fmap)((0, combinator_1.constraint)(16
6420
6656
  /* State.label */
6421
6657
  , false, (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])), ([text]) => [(0, dom_1.html)('a', {
6422
6658
  class: 'label',
@@ -6476,7 +6712,9 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
6476
6712
 
6477
6713
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, combinator_1.syntax)(0
6478
6714
  /* Syntax.none */
6479
- , 2, 1, (0, visibility_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', {
6715
+ , 2, 1, 0
6716
+ /* State.none */
6717
+ , (0, visibility_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', {
6480
6718
  class: 'invalid',
6481
6719
  'data-invalid-syntax': 'extension',
6482
6720
  'data-invalid-type': 'syntax',
@@ -6524,9 +6762,11 @@ global_1.Object.setPrototypeOf(attrspecs, null);
6524
6762
  global_1.Object.values(attrspecs).forEach(o => global_1.Object.setPrototypeOf(o, null));
6525
6763
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.syntax)(0
6526
6764
  /* Syntax.none */
6527
- , 5, 1, (0, combinator_1.union)([(0, combinator_1.focus)(/^<wbr[^\S\n]*>/i, () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.surround)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6765
+ , 5, 1, 0
6766
+ /* State.none */
6767
+ , (0, combinator_1.union)([(0, combinator_1.focus)(/^<wbr[^\S\n]*>/i, () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.surround)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6528
6768
  (0, source_1.str)(/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)(/^[^\S\n]*>/), true, ([as, bs = [], cs], rest) => [[elem(as[0].slice(1), (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest]), (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, visibility_1.blankWith)('\n', `</${tag}>`), [[(0, visibility_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]|>)/i, (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)))])))));
6529
- exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/i)]); // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
6769
+ exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="[^"\n]*")?(?=[^\S\n]|>)/i)]); // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
6530
6770
  // [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
6531
6771
 
6532
6772
  const TAGS = global_1.Object.freeze(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "h1", "h2", "h3", "h4", "h5", "h6", "main", "nav", "section", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "menu", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "summary", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "param", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp"]);
@@ -6600,7 +6840,9 @@ const dom_1 = __webpack_require__(3252);
6600
6840
 
6601
6841
  const memoize_1 = __webpack_require__(1808);
6602
6842
 
6603
- exports.unsafehtmlentity = (0, combinator_1.creation)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]+;/, entity => [[parse(entity) ?? `\x1B${entity}`], ''])));
6843
+ exports.unsafehtmlentity = (0, combinator_1.creation)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]+;/, ({
6844
+ source
6845
+ }) => [[parse(source) ?? `\x1B${source}`], ''])));
6604
6846
  exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([test]) => [test[0] === '\x1B' ? (0, dom_1.html)('span', {
6605
6847
  class: 'invalid',
6606
6848
  'data-invalid-syntax': 'htmlentity',
@@ -6641,7 +6883,9 @@ const array_1 = __webpack_require__(8112);
6641
6883
 
6642
6884
  exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.syntax)(0
6643
6885
  /* Syntax.none */
6644
- , 1, 1, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)]))), (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]));
6886
+ , 1, 1, 0
6887
+ /* State.none */
6888
+ , (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)]))), (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]));
6645
6889
 
6646
6890
  /***/ }),
6647
6891
 
@@ -6683,59 +6927,45 @@ const optspec = {
6683
6927
  };
6684
6928
  Object.setPrototypeOf(optspec, null);
6685
6929
  exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.union)([medialink, textlink])));
6686
- const textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
6687
- /* State.link */
6688
- , false, (0, combinator_1.state)(4
6930
+ const textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8
6689
6931
  /* State.link */
6690
- | 2
6691
- /* State.media */
6692
- | 64
6693
- /* State.annotation */
6694
- | 32
6695
- /* State.reference */
6696
- | 16
6697
- /* State.index */
6698
- | 8
6699
- /* State.label */
6700
- | 1
6701
- /* State.autolink */
6702
- , (0, combinator_1.syntax)(256
6932
+ , false, (0, combinator_1.syntax)(256
6703
6933
  /* Syntax.link */
6704
- , 2, 10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]), ']', 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) => {
6934
+ , 2, 10, 254
6935
+ /* State.linkable */
6936
+ , (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)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]), ']', 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) => {
6705
6937
  if (content.length !== 0 && (0, visibility_1.trimNode)(content).length === 0) return;
6706
6938
 
6707
6939
  for (let source = (0, util_1.stringify)(content); source;) {
6708
- const result = (0, combinator_1.state)(1
6709
- /* State.autolink */
6710
- , false, autolink_1.autolink)(source, context);
6711
- if (typeof (0, parser_1.eval)(result)[0] === 'object') return;
6712
- source = (0, parser_1.exec)(result);
6940
+ const result = autolink({
6941
+ source,
6942
+ context
6943
+ });
6944
+ if (typeof (0, parser_1.eval)(result, [])[0] === 'object') return;
6945
+ source = (0, parser_1.exec)(result, '');
6713
6946
  }
6714
6947
 
6715
6948
  return parse(content, params, rest, context);
6716
- })))));
6717
- const medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
6949
+ }))));
6950
+ const medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8
6718
6951
  /* State.link */
6719
- | 2
6952
+ | 4
6720
6953
  /* State.media */
6721
- , false, (0, combinator_1.state)(4
6722
- /* State.link */
6723
- | 64
6724
- /* State.annotation */
6725
- | 32
6726
- /* State.reference */
6727
- | 16
6728
- /* State.index */
6729
- | 8
6730
- /* State.label */
6731
- | 1
6732
- /* State.autolink */
6733
- , (0, combinator_1.syntax)(256
6954
+ , false, (0, combinator_1.syntax)(256
6734
6955
  /* Syntax.link */
6735
- , 2, 10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => parse(content, params, rest, context))))));
6956
+ , 2, 10, 254
6957
+ /* State.linkable */
6958
+ ^ 4
6959
+ /* State.media */
6960
+ , (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => parse(content, params, rest, context)))));
6736
6961
  exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(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) => parse(content, params, rest, context)))));
6737
6962
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
6738
6963
  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)}`])]);
6964
+ const autolink = (0, combinator_1.state)(2
6965
+ /* State.autolink */
6966
+ , false, (0, combinator_1.state)(1
6967
+ /* State.shortcut */
6968
+ , autolink_1.autolink));
6739
6969
 
6740
6970
  function parse(content, params, rest, context) {
6741
6971
  const INSECURE_URI = params.shift();
@@ -6777,6 +7007,7 @@ function elem(INSECURE_URI, content, uri, origin) {
6777
7007
  }
6778
7008
 
6779
7009
  return (0, dom_1.html)('a', {
7010
+ class: 'link',
6780
7011
  href: uri.source,
6781
7012
  target: global_1.undefined || uri.origin !== origin || typeof content[0] === 'object' && content[0].classList.contains('media') ? '_blank' : global_1.undefined
6782
7013
  }, content.length === 0 ? decode(INSECURE_URI) : content);
@@ -6791,6 +7022,7 @@ function elem(INSECURE_URI, content, uri, origin) {
6791
7022
  switch (true) {
6792
7023
  case content.length === 1 && typeof content[0] === 'string' && pattern.test(INSECURE_URI) && pattern.test(content[0]) && INSECURE_URI.replace(/[^+\d]/g, '') === content[0].replace(/[^+\d]/g, ''):
6793
7024
  return (0, dom_1.html)('a', {
7025
+ class: 'tel',
6794
7026
  href: uri.source
6795
7027
  }, content);
6796
7028
  }
@@ -6845,7 +7077,9 @@ const array_1 = __webpack_require__(8112);
6845
7077
 
6846
7078
  exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('=='), (0, combinator_1.syntax)(0
6847
7079
  /* Syntax.none */
6848
- , 1, 1, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), 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]));
7080
+ , 1, 1, 0
7081
+ /* State.none */
7082
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), 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]));
6849
7083
 
6850
7084
  /***/ }),
6851
7085
 
@@ -6867,10 +7101,13 @@ const source_1 = __webpack_require__(6743);
6867
7101
  const dom_1 = __webpack_require__(3252);
6868
7102
 
6869
7103
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
6870
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creation)((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, {
6871
- caches: {
6872
- math: cache
6873
- } = {}
7104
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creation)((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])/)]), ({
7105
+ source,
7106
+ context: {
7107
+ caches: {
7108
+ math: cache
7109
+ } = {}
7110
+ }
6874
7111
  }) => [[cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
6875
7112
  class: 'math',
6876
7113
  translate: 'no',
@@ -6922,11 +7159,13 @@ const optspec = {
6922
7159
  rel: global_1.undefined
6923
7160
  };
6924
7161
  Object.setPrototypeOf(optspec, null);
6925
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.open)('!', (0, combinator_1.constraint)(2
7162
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.open)('!', (0, combinator_1.constraint)(4
6926
7163
  /* State.media */
6927
7164
  , false, (0, combinator_1.syntax)(64
6928
7165
  /* Syntax.media */
6929
- , 2, 10, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.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) => {
7166
+ , 2, 10, 0
7167
+ /* State.none */
7168
+ , (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.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) => {
6930
7169
  const INSECURE_URI = params.shift();
6931
7170
  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);
6932
7171
  let cache;
@@ -6944,13 +7183,20 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
6944
7183
  el.style.aspectRatio = el.getAttribute('aspect-ratio');
6945
7184
  }
6946
7185
 
6947
- if (context.state & 4
7186
+ if (context.state & 8
6948
7187
  /* State.link */
6949
7188
  ) return [[el], rest];
6950
- if (cache && cache.tagName !== 'IMG') return (0, combinator_1.creation)(10, (..._) => [[el], rest])('!', context);
7189
+ if (cache && cache.tagName !== 'IMG') return (0, combinator_1.creation)(10, (..._) => [[el], rest])({
7190
+ source: '!',
7191
+ context
7192
+ });
6951
7193
  return (0, combinator_1.fmap)(link_1.unsafelink, ([link]) => [(0, dom_1.define)(link, {
7194
+ class: null,
6952
7195
  target: '_blank'
6953
- }, [el])])(`{ ${INSECURE_URI}${params.join('')} }${rest}`, context);
7196
+ }, [el])])({
7197
+ source: `{ ${INSECURE_URI}${params.join('')} }${rest}`,
7198
+ context
7199
+ });
6954
7200
  }))))));
6955
7201
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((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)])));
6956
7202
  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]);
@@ -7022,19 +7268,19 @@ const util_1 = __webpack_require__(9437);
7022
7268
 
7023
7269
  const dom_1 = __webpack_require__(3252);
7024
7270
 
7025
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(32
7271
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(64
7026
7272
  /* State.reference */
7027
- , false, (0, combinator_1.state)(64
7273
+ , false, (0, combinator_1.syntax)(4096
7274
+ /* Syntax.reference */
7275
+ , 6, 1, 128
7028
7276
  /* State.annotation */
7029
- | 32
7277
+ | 64
7030
7278
  /* State.reference */
7031
- | 2
7279
+ | 4
7032
7280
  /* State.media */
7033
- , (0, combinator_1.syntax)(4096
7034
- /* Syntax.reference */
7035
- , 6, 1, (0, visibility_1.startLoose)((0, combinator_1.context)({
7281
+ , (0, visibility_1.startLoose)((0, combinator_1.context)({
7036
7282
  delimiters: global_1.undefined
7037
- }, (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, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
7283
+ }, (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, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
7038
7284
  const abbr = (0, combinator_1.creation)((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(visibility_1.regBlankStart, '')]));
7039
7285
 
7040
7286
  function attributes(ns) {
@@ -7082,7 +7328,9 @@ const array_1 = __webpack_require__(8112);
7082
7328
 
7083
7329
  exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.syntax)(0
7084
7330
  /* Syntax.none */
7085
- , 2, 1, (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, visibility_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
7331
+ , 2, 1, 0
7332
+ /* State.none */
7333
+ , (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, visibility_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
7086
7334
  texts[texts.length - 1] === '' && texts.pop();
7087
7335
 
7088
7336
  switch (true) {
@@ -7096,7 +7344,10 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0,
7096
7344
  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', ')')])))];
7097
7345
  }
7098
7346
  }))));
7099
- const text = (0, combinator_1.creation)((source, context) => {
7347
+ const text = (0, combinator_1.creation)(({
7348
+ source,
7349
+ context
7350
+ }) => {
7100
7351
  const acc = [''];
7101
7352
 
7102
7353
  while (source !== '') {
@@ -7104,7 +7355,10 @@ const text = (0, combinator_1.creation)((source, context) => {
7104
7355
  // @ts-expect-error
7105
7356
  case '&':
7106
7357
  {
7107
- const result = (0, htmlentity_1.unsafehtmlentity)(source, context);
7358
+ const result = (0, htmlentity_1.unsafehtmlentity)({
7359
+ source,
7360
+ context
7361
+ });
7108
7362
 
7109
7363
  if (result) {
7110
7364
  acc[acc.length - 1] += (0, parser_1.eval)(result)[0];
@@ -7122,7 +7376,10 @@ const text = (0, combinator_1.creation)((source, context) => {
7122
7376
  continue;
7123
7377
  }
7124
7378
 
7125
- const result = (0, source_1.text)(source, context);
7379
+ const result = (0, source_1.text)({
7380
+ source,
7381
+ context
7382
+ });
7126
7383
  acc[acc.length - 1] += (0, parser_1.eval)(result)[0] ?? source.slice(0, source.length - (0, parser_1.exec)(result).length);
7127
7384
  source = (0, parser_1.exec)(result);
7128
7385
  continue;
@@ -7171,7 +7428,7 @@ const url_1 = __webpack_require__(4318);
7171
7428
 
7172
7429
  const media_1 = __webpack_require__(1303);
7173
7430
 
7174
- exports.shortmedia = (0, combinator_1.rewrite)((0, combinator_1.constraint)(2
7431
+ exports.shortmedia = (0, combinator_1.rewrite)((0, combinator_1.constraint)(4
7175
7432
  /* State.media */
7176
7433
  , false, (0, combinator_1.open)('!', url_1.url)), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media])));
7177
7434
 
@@ -7204,7 +7461,9 @@ const array_1 = __webpack_require__(8112);
7204
7461
 
7205
7462
  exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**'), (0, combinator_1.syntax)(0
7206
7463
  /* Syntax.none */
7207
- , 1, 1, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (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]));
7464
+ , 1, 1, 0
7465
+ /* State.none */
7466
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (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]));
7208
7467
 
7209
7468
  /***/ }),
7210
7469
 
@@ -7231,7 +7490,9 @@ const array_1 = __webpack_require__(8112);
7231
7490
 
7232
7491
  exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.syntax)(0
7233
7492
  /* Syntax.none */
7234
- , 2, 1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
7493
+ , 2, 1, 0
7494
+ /* State.none */
7495
+ , (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
7235
7496
  class: 'template'
7236
7497
  }, `{{${ns.join('').replace(/\x1B/g, '')}}}`)], rest]));
7237
7498
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((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)])));
@@ -7764,7 +8025,10 @@ function* segment(source) {
7764
8025
  if (!validate(source, exports.MAX_INPUT_SIZE)) return yield `\x07Too large input over ${exports.MAX_INPUT_SIZE.toLocaleString('en')} bytes.\n${source.slice(0, 1001)}`;
7765
8026
 
7766
8027
  while (source !== '') {
7767
- const result = parser(source, {});
8028
+ const result = parser({
8029
+ source,
8030
+ context: {}
8031
+ });
7768
8032
  const rest = (0, parser_1.exec)(result);
7769
8033
  const segs = (0, parser_1.eval)(result).length ? (0, parser_1.eval)(result) : [source.slice(0, source.length - rest.length)];
7770
8034
 
@@ -7891,7 +8155,9 @@ const combinator_1 = __webpack_require__(2087);
7891
8155
  const text_1 = __webpack_require__(7763);
7892
8156
 
7893
8157
  const delimiter = /[\s\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]/;
7894
- exports.escsource = (0, combinator_1.creation)(source => {
8158
+ exports.escsource = (0, combinator_1.creation)(({
8159
+ source
8160
+ }) => {
7895
8161
  if (source === '') return;
7896
8162
  const i = source.search(delimiter);
7897
8163
 
@@ -7936,8 +8202,8 @@ const global_1 = __webpack_require__(4128);
7936
8202
  const combinator_1 = __webpack_require__(2087);
7937
8203
 
7938
8204
  exports.anyline = (0, combinator_1.line)(() => [[], '']);
7939
- exports.emptyline = (0, combinator_1.line)(s => (0, combinator_1.isEmpty)(s) ? [[], ''] : global_1.undefined);
7940
- exports.contentline = (0, combinator_1.line)(s => !(0, combinator_1.isEmpty)(s) ? [[], ''] : global_1.undefined);
8205
+ exports.emptyline = (0, combinator_1.line)(i => (0, combinator_1.isEmpty)(i.source) ? [[], ''] : global_1.undefined);
8206
+ exports.contentline = (0, combinator_1.line)(i => !(0, combinator_1.isEmpty)(i.source) ? [[], ''] : global_1.undefined);
7941
8207
 
7942
8208
  /***/ }),
7943
8209
 
@@ -7957,10 +8223,14 @@ const global_1 = __webpack_require__(4128);
7957
8223
  const combinator_1 = __webpack_require__(2087);
7958
8224
 
7959
8225
  function str(pattern) {
7960
- return typeof pattern === 'string' ? (0, combinator_1.creation)(source => {
8226
+ return typeof pattern === 'string' ? (0, combinator_1.creation)(({
8227
+ source
8228
+ }) => {
7961
8229
  if (source === '') return;
7962
8230
  return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : global_1.undefined;
7963
- }) : (0, combinator_1.creation)(source => {
8231
+ }) : (0, combinator_1.creation)(({
8232
+ source
8233
+ }) => {
7964
8234
  if (source === '') return;
7965
8235
  const m = source.match(pattern);
7966
8236
  return m && m[0].length > 0 ? [[m[0]], source.slice(m[0].length)] : global_1.undefined;
@@ -7970,10 +8240,14 @@ function str(pattern) {
7970
8240
  exports.str = str;
7971
8241
 
7972
8242
  function stropt(pattern) {
7973
- return typeof pattern === 'string' ? (0, combinator_1.creation)(source => {
8243
+ return typeof pattern === 'string' ? (0, combinator_1.creation)(({
8244
+ source
8245
+ }) => {
7974
8246
  if (source === '') return;
7975
8247
  return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : global_1.undefined;
7976
- }) : (0, combinator_1.creation)(source => {
8248
+ }) : (0, combinator_1.creation)(({
8249
+ source
8250
+ }) => {
7977
8251
  if (source === '') return;
7978
8252
  const m = source.match(pattern);
7979
8253
  return m ? [[m[0]], source.slice(m[0].length)] : global_1.undefined;
@@ -8009,7 +8283,12 @@ exports.nonAlphanumeric = /[^0-9A-Za-z]|\S[#>]|$/;
8009
8283
  const repeat = (0, str_1.str)(/^(.)\1*/);
8010
8284
  exports.text = (0, combinator_1.syntax)(0
8011
8285
  /* Syntax.none */
8012
- , 1, 1, (source, context) => {
8286
+ , 1, 1, 0
8287
+ /* State.none */
8288
+ , ({
8289
+ source,
8290
+ context
8291
+ }) => {
8013
8292
  if (source === '') return;
8014
8293
  const i = source.search(exports.delimiter);
8015
8294
 
@@ -8026,7 +8305,10 @@ exports.text = (0, combinator_1.syntax)(0
8026
8305
  case '。':
8027
8306
  case '!':
8028
8307
  case '?':
8029
- return (0, exports.text)(source.slice(1), context);
8308
+ return (0, exports.text)({
8309
+ source: source.slice(1),
8310
+ context
8311
+ });
8030
8312
  }
8031
8313
 
8032
8314
  break;
@@ -8065,7 +8347,10 @@ exports.text = (0, combinator_1.syntax)(0
8065
8347
  case '~':
8066
8348
  case '=':
8067
8349
  case '`':
8068
- return source[1] === source[0] ? repeat(source, context) : [[source[0]], source.slice(1)];
8350
+ return source[1] === source[0] ? repeat({
8351
+ source,
8352
+ context
8353
+ }) : [[source[0]], source.slice(1)];
8069
8354
 
8070
8355
  default:
8071
8356
  const b = source[0].trimStart() === '';
@@ -8104,7 +8389,9 @@ const combinator_1 = __webpack_require__(2087);
8104
8389
 
8105
8390
  const text_1 = __webpack_require__(7763);
8106
8391
 
8107
- exports.unescsource = (0, combinator_1.creation)(source => {
8392
+ exports.unescsource = (0, combinator_1.creation)(({
8393
+ source
8394
+ }) => {
8108
8395
  if (source === '') return;
8109
8396
  const i = source.search(text_1.delimiter);
8110
8397
 
@@ -8202,9 +8489,9 @@ function hasVisible(nodes, {
8202
8489
  if (node && node.trimStart()) return true;
8203
8490
  } else {
8204
8491
  if (node.innerText.trimStart()) return true;
8205
- if (state & 2
8492
+ if (state & 4
8206
8493
  /* State.media */
8207
- ^ 2
8494
+ ^ 4
8208
8495
  /* State.media */
8209
8496
  && (node.classList.contains('media') || node.getElementsByClassName('media')[0])) return true;
8210
8497
  }
@@ -8223,20 +8510,31 @@ function blankWith(starting, delimiter) {
8223
8510
  exports.blankWith = blankWith;
8224
8511
 
8225
8512
  function startLoose(parser, except) {
8226
- return (source, context) => isStartLoose(source, context, except) ? parser(source, context) : global_1.undefined;
8513
+ return input => isStartLoose(input, except) ? parser(input) : global_1.undefined;
8227
8514
  }
8228
8515
 
8229
8516
  exports.startLoose = startLoose;
8230
- const isStartLoose = (0, memoize_1.reduce)((source, context, except) => {
8231
- return isStartTight(source.replace(exports.regBlankStart, ''), context, except);
8232
- }, (source, _, except = '') => `${source}\x1E${except}`);
8517
+ const isStartLoose = (0, memoize_1.reduce)(({
8518
+ source,
8519
+ context
8520
+ }, except) => {
8521
+ return isStartTight({
8522
+ source: source.replace(exports.regBlankStart, ''),
8523
+ context
8524
+ }, except);
8525
+ }, ({
8526
+ source
8527
+ }, except = '') => `${source}\x1E${except}`);
8233
8528
 
8234
8529
  function startTight(parser, except) {
8235
- return (source, context) => isStartTight(source, context, except) ? parser(source, context) : global_1.undefined;
8530
+ return input => isStartTight(input, except) ? parser(input) : global_1.undefined;
8236
8531
  }
8237
8532
 
8238
8533
  exports.startTight = startTight;
8239
- const isStartTight = (0, memoize_1.reduce)((source, context, except) => {
8534
+ const isStartTight = (0, memoize_1.reduce)(({
8535
+ source,
8536
+ context
8537
+ }, except) => {
8240
8538
  if (source === '') return true;
8241
8539
  if (except && source.slice(0, except.length) === except) return false;
8242
8540
 
@@ -8252,7 +8550,10 @@ const isStartTight = (0, memoize_1.reduce)((source, context, except) => {
8252
8550
 
8253
8551
  case '&':
8254
8552
  switch (true) {
8255
- case source.length > 2 && source[1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(source, context))?.[0]?.trimStart() === '':
8553
+ case source.length > 2 && source[1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)({
8554
+ source,
8555
+ context
8556
+ }))?.[0]?.trimStart() === '':
8256
8557
  return false;
8257
8558
  }
8258
8559
 
@@ -8269,7 +8570,9 @@ const isStartTight = (0, memoize_1.reduce)((source, context, except) => {
8269
8570
  default:
8270
8571
  return source[0].trimStart() !== '';
8271
8572
  }
8272
- }, (source, _, except = '') => `${source}\x1E${except}`);
8573
+ }, ({
8574
+ source
8575
+ }, except = '') => `${source}\x1E${except}`);
8273
8576
 
8274
8577
  function isStartLooseNodes(nodes) {
8275
8578
  if (nodes.length === 0) return true;
@@ -8687,6 +8990,7 @@ function pdf(source, url) {
8687
8990
  type: 'application/pdf',
8688
8991
  data: source.getAttribute('data-src')
8689
8992
  }), (0, dom_1.html)('div', [(0, dom_1.define)((0, parser_1.parse)(`{ ${source.getAttribute('data-src')} }`).querySelector('a'), {
8993
+ class: null,
8690
8994
  target: '_blank'
8691
8995
  })])]);
8692
8996
  }
@@ -8910,8 +9214,8 @@ const array_1 = __webpack_require__(8112);
8910
9214
  function info(source) {
8911
9215
  const match = (0, scope_1.scope)(source, '.invalid');
8912
9216
  return {
8913
- url: find('a:not(:is(.email, .account, .channel, .hashtag, .hashnum, .anchor))').filter(el => ['http:', 'https:'].includes(el.protocol)),
8914
- tel: find('a:not(:is(.email, .account, .channel, .hashtag, .hashnum, .anchor))').filter(el => ['tel:'].includes(el.protocol)),
9217
+ url: find('a.link, a.url'),
9218
+ tel: find('a.tel'),
8915
9219
  email: find('a.email'),
8916
9220
  account: find('a.account'),
8917
9221
  channel: find('a.channel'),
@@ -8953,7 +9257,10 @@ const dom_1 = __webpack_require__(3252);
8953
9257
  const duff_1 = __webpack_require__(8099);
8954
9258
 
8955
9259
  function quote(anchor, range) {
8956
- if ((0, parser_1.exec)((0, cite_1.cite)(`>>${anchor}`, {})) !== '') throw new Error(`Invalid anchor: ${anchor}`);
9260
+ if ((0, parser_1.exec)((0, cite_1.cite)({
9261
+ source: `>>${anchor}`,
9262
+ context: {}
9263
+ })) !== '') throw new Error(`Invalid anchor: ${anchor}`);
8957
9264
  fit(range);
8958
9265
  const node = trim(range.cloneContents());
8959
9266
  if (!node.firstChild) return '';