securemark 0.259.1 → 0.260.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/design.md +16 -5
  3. package/dist/index.js +548 -226
  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 +18 -17
  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 +1 -1
  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 +1 -1
  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 +8 -7
  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/autolink/account.test.ts +12 -12
  82. package/src/parser/inline/autolink/account.ts +4 -2
  83. package/src/parser/inline/autolink/anchor.test.ts +10 -10
  84. package/src/parser/inline/autolink/anchor.ts +14 -11
  85. package/src/parser/inline/autolink/channel.test.ts +4 -4
  86. package/src/parser/inline/autolink/email.test.ts +1 -1
  87. package/src/parser/inline/autolink/email.ts +1 -1
  88. package/src/parser/inline/autolink/hashnum.test.ts +1 -1
  89. package/src/parser/inline/autolink/hashnum.ts +4 -2
  90. package/src/parser/inline/autolink/hashtag.test.ts +21 -21
  91. package/src/parser/inline/autolink/hashtag.ts +4 -2
  92. package/src/parser/inline/autolink/url.test.ts +56 -56
  93. package/src/parser/inline/bracket.test.ts +1 -1
  94. package/src/parser/inline/code.test.ts +1 -1
  95. package/src/parser/inline/code.ts +2 -2
  96. package/src/parser/inline/comment.test.ts +1 -1
  97. package/src/parser/inline/deletion.test.ts +1 -1
  98. package/src/parser/inline/emphasis.test.ts +1 -1
  99. package/src/parser/inline/emstrong.ts +2 -2
  100. package/src/parser/inline/escape.ts +3 -3
  101. package/src/parser/inline/extension/index.test.ts +1 -1
  102. package/src/parser/inline/extension/indexer.test.ts +1 -1
  103. package/src/parser/inline/extension/label.test.ts +1 -1
  104. package/src/parser/inline/extension/placeholder.test.ts +1 -1
  105. package/src/parser/inline/html.test.ts +1 -3
  106. package/src/parser/inline/html.ts +1 -1
  107. package/src/parser/inline/htmlentity.test.ts +1 -1
  108. package/src/parser/inline/htmlentity.ts +1 -1
  109. package/src/parser/inline/insertion.test.ts +1 -1
  110. package/src/parser/inline/link.test.ts +111 -111
  111. package/src/parser/inline/link.ts +30 -28
  112. package/src/parser/inline/mark.test.ts +1 -1
  113. package/src/parser/inline/math.test.ts +1 -1
  114. package/src/parser/inline/math.ts +1 -1
  115. package/src/parser/inline/media.test.ts +2 -1
  116. package/src/parser/inline/media.ts +3 -3
  117. package/src/parser/inline/reference.test.ts +4 -4
  118. package/src/parser/inline/ruby.test.ts +1 -1
  119. package/src/parser/inline/ruby.ts +3 -3
  120. package/src/parser/inline/shortmedia.test.ts +1 -1
  121. package/src/parser/inline/strong.test.ts +1 -1
  122. package/src/parser/inline/template.test.ts +1 -1
  123. package/src/parser/inline.test.ts +52 -52
  124. package/src/parser/locale.test.ts +1 -1
  125. package/src/parser/segment.ts +1 -1
  126. package/src/parser/source/escapable.test.ts +1 -1
  127. package/src/parser/source/escapable.ts +1 -1
  128. package/src/parser/source/line.test.ts +1 -1
  129. package/src/parser/source/line.ts +2 -2
  130. package/src/parser/source/str.ts +4 -4
  131. package/src/parser/source/text.test.ts +1 -1
  132. package/src/parser/source/text.ts +3 -3
  133. package/src/parser/source/unescapable.test.ts +1 -1
  134. package/src/parser/source/unescapable.ts +1 -1
  135. package/src/parser/visibility.ts +13 -13
  136. package/src/renderer/render/media/pdf.ts +1 -0
  137. package/src/renderer/render/media/twitter.ts +7 -1
  138. package/src/util/info.ts +2 -4
  139. package/src/util/quote.ts +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.259.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.260.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("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];
@@ -2856,15 +2947,22 @@ function apply(parser, source, context, changes, values) {
2856
2947
  }
2857
2948
 
2858
2949
  function syntax(syntax, prec, cost, state, parser) {
2859
- return creation(cost, precedence(prec, (source, context) => {
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 position = source.length;
2957
+ context.offset ??= 0;
2958
+ const position = source.length + context.offset;
2864
2959
  const st0 = context.state ?? 0;
2865
2960
  const st1 = context.state = st0 | state;
2866
2961
  const cache = syntax && memo.get(position, syntax, st1);
2867
- const result = cache ? cache.length === 0 ? global_1.undefined : [cache[0], source.slice(cache[1])] : parser(source, context);
2962
+ const result = cache ? cache.length === 0 ? global_1.undefined : [cache[0], source.slice(cache[1])] : parser({
2963
+ source,
2964
+ context
2965
+ });
2868
2966
 
2869
2967
  if (syntax && st0 & context.memorable) {
2870
2968
  cache ?? memo.set(position, syntax, st1, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result, '').length);
@@ -2883,17 +2981,21 @@ exports.syntax = syntax;
2883
2981
 
2884
2982
  function creation(cost, parser) {
2885
2983
  if (typeof cost === 'function') return creation(1, cost);
2886
- return (source, context) => {
2887
- const {
2888
- resources = {
2889
- clock: 1,
2890
- recursion: 1
2891
- }
2892
- } = context;
2984
+ return ({
2985
+ source,
2986
+ context
2987
+ }) => {
2988
+ const resources = context.resources ?? {
2989
+ clock: 1,
2990
+ recursion: 1
2991
+ };
2893
2992
  if (resources.clock <= 0) throw new Error('Too many creations');
2894
2993
  if (resources.recursion <= 0) throw new Error('Too much recursion');
2895
2994
  --resources.recursion;
2896
- const result = parser(source, context);
2995
+ const result = parser({
2996
+ source,
2997
+ context
2998
+ });
2897
2999
  ++resources.recursion;
2898
3000
 
2899
3001
  if (result) {
@@ -2907,10 +3009,16 @@ function creation(cost, parser) {
2907
3009
  exports.creation = creation;
2908
3010
 
2909
3011
  function precedence(precedence, parser) {
2910
- return (source, context) => {
3012
+ return ({
3013
+ source,
3014
+ context
3015
+ }) => {
2911
3016
  const p = context.precedence;
2912
3017
  context.precedence = precedence;
2913
- const result = parser(source, context);
3018
+ const result = parser({
3019
+ source,
3020
+ context
3021
+ });
2914
3022
  context.precedence = p;
2915
3023
  return result;
2916
3024
  };
@@ -2919,7 +3027,13 @@ function precedence(precedence, parser) {
2919
3027
  exports.precedence = precedence;
2920
3028
 
2921
3029
  function guard(f, parser) {
2922
- 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;
2923
3037
  }
2924
3038
 
2925
3039
  exports.guard = guard;
@@ -2930,9 +3044,15 @@ function constraint(state, positive, parser) {
2930
3044
  positive = true;
2931
3045
  }
2932
3046
 
2933
- return (source, context) => {
3047
+ return ({
3048
+ source,
3049
+ context
3050
+ }) => {
2934
3051
  const s = positive ? state & context.state : state & ~context.state;
2935
- return s === state ? parser(source, context) : global_1.undefined;
3052
+ return s === state ? parser({
3053
+ source,
3054
+ context
3055
+ }) : global_1.undefined;
2936
3056
  };
2937
3057
  }
2938
3058
 
@@ -2944,10 +3064,16 @@ function state(state, positive, parser) {
2944
3064
  positive = true;
2945
3065
  }
2946
3066
 
2947
- return (source, context) => {
3067
+ return ({
3068
+ source,
3069
+ context
3070
+ }) => {
2948
3071
  const s = context.state ?? 0;
2949
3072
  context.state = positive ? s | state : s & ~state;
2950
- const result = parser(source, context);
3073
+ const result = parser({
3074
+ source,
3075
+ context
3076
+ });
2951
3077
  context.state = s;
2952
3078
  return result;
2953
3079
  };
@@ -3075,7 +3201,6 @@ exports.Memo = void 0;
3075
3201
  class Memo {
3076
3202
  constructor() {
3077
3203
  this.memory = [];
3078
- this.offset = 0;
3079
3204
  }
3080
3205
 
3081
3206
  get length() {
@@ -3084,19 +3209,19 @@ class Memo {
3084
3209
 
3085
3210
  get(position, syntax, state) {
3086
3211
  //console.log('get', position + this.offset, syntax, state, this.memory[position + this.offset - 1]?.[`${syntax}:${state}`]);;
3087
- const cache = this.memory[position + this.offset - 1]?.[`${syntax}:${state}`];
3212
+ const cache = this.memory[position - 1]?.[`${syntax}:${state}`];
3088
3213
  return cache?.length === 2 ? [cache[0].slice(), cache[1]] : cache;
3089
3214
  }
3090
3215
 
3091
3216
  set(position, syntax, state, nodes, offset) {
3092
- const record = this.memory[position + this.offset - 1] ??= {};
3217
+ const record = this.memory[position - 1] ??= {};
3093
3218
  record[`${syntax}:${state}`] = nodes ? [nodes.slice(), offset] : []; //console.log('set', position + this.offset, syntax, state, record[`${syntax}:${state}`]);
3094
3219
  }
3095
3220
 
3096
3221
  clear(position) {
3097
3222
  const memory = this.memory;
3098
3223
 
3099
- for (let i = position + this.offset, len = memory.length; i < len; ++i) {
3224
+ for (let i = position, len = memory.length; i < len; ++i) {
3100
3225
  memory.pop();
3101
3226
  } //console.log('clear', position + this.offset + 1);
3102
3227
 
@@ -3127,14 +3252,20 @@ const array_1 = __webpack_require__(8112);
3127
3252
 
3128
3253
  function inits(parsers, resume) {
3129
3254
  if (parsers.length === 1) return parsers[0];
3130
- return (source, context) => {
3255
+ return ({
3256
+ source,
3257
+ context
3258
+ }) => {
3131
3259
  let rest = source;
3132
3260
  let nodes;
3133
3261
 
3134
3262
  for (let i = 0, len = parsers.length; i < len; ++i) {
3135
3263
  if (rest === '') break;
3136
3264
  if (context.delimiters?.match(rest, context.precedence)) break;
3137
- const result = parsers[i](rest, context);
3265
+ const result = parsers[i]({
3266
+ source: rest,
3267
+ context
3268
+ });
3138
3269
  if (!result) break;
3139
3270
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3140
3271
  rest = (0, parser_1.exec)(result);
@@ -3168,14 +3299,20 @@ const array_1 = __webpack_require__(8112);
3168
3299
 
3169
3300
  function sequence(parsers, resume) {
3170
3301
  if (parsers.length === 1) return parsers[0];
3171
- return (source, context) => {
3302
+ return ({
3303
+ source,
3304
+ context
3305
+ }) => {
3172
3306
  let rest = source;
3173
3307
  let nodes;
3174
3308
 
3175
3309
  for (let i = 0, len = parsers.length; i < len; ++i) {
3176
3310
  if (rest === '') return;
3177
3311
  if (context.delimiters?.match(rest, context.precedence)) return;
3178
- const result = parsers[i](rest, context);
3312
+ const result = parsers[i]({
3313
+ source: rest,
3314
+ context
3315
+ });
3179
3316
  if (!result) return;
3180
3317
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
3181
3318
  rest = (0, parser_1.exec)(result);
@@ -3217,7 +3354,10 @@ function some(parser, end, delimiters = [], limit = -1) {
3217
3354
  matcher: delimiter_1.Delimiters.matcher(delimiter),
3218
3355
  precedence
3219
3356
  }));
3220
- return (source, context) => {
3357
+ return ({
3358
+ source,
3359
+ context
3360
+ }) => {
3221
3361
  if (source === '') return;
3222
3362
  let rest = source;
3223
3363
  let nodes;
@@ -3231,7 +3371,10 @@ function some(parser, end, delimiters = [], limit = -1) {
3231
3371
  if (rest === '') break;
3232
3372
  if (match(rest)) break;
3233
3373
  if (context.delimiters?.match(rest, context.precedence)) break;
3234
- const result = parser(rest, context);
3374
+ const result = parser({
3375
+ source: rest,
3376
+ context
3377
+ });
3235
3378
  if (!result) break;
3236
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);
3237
3380
  rest = (0, parser_1.exec)(result);
@@ -3318,7 +3461,7 @@ function union(parsers) {
3318
3461
  return parsers[0];
3319
3462
 
3320
3463
  default:
3321
- 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);
3322
3465
  }
3323
3466
  }
3324
3467
 
@@ -3472,7 +3615,7 @@ const array_1 = __webpack_require__(8112);
3472
3615
  function bind(target, settings) {
3473
3616
  let context = { ...settings,
3474
3617
  host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
3475
- memorable: 118
3618
+ memorable: 236
3476
3619
  /* State.backtrackable */
3477
3620
 
3478
3621
  };
@@ -3528,9 +3671,15 @@ function bind(target, settings) {
3528
3671
 
3529
3672
  for (; index < sourceSegments.length - last; ++index) {
3530
3673
  const seg = sourceSegments[index];
3531
- const es = (0, parser_1.eval)((0, header_1.header)(seg, {
3532
- header: index === 0
3533
- }) || (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
+ }), []);
3534
3683
  blocks.splice(index, 0, [seg, es, url]);
3535
3684
  if (es.length === 0) continue; // All deletion processes always run after all addition processes have done.
3536
3685
  // Therefore any `base` node will never be unavailable by deletions until all the dependent `el` nodes are added.
@@ -3715,7 +3864,10 @@ function headers(source) {
3715
3864
  exports.headers = headers;
3716
3865
 
3717
3866
  function parse(source) {
3718
- const result = (0, header_1.header)(source, {});
3867
+ const result = (0, header_1.header)({
3868
+ source,
3869
+ context: {}
3870
+ });
3719
3871
  const [el] = (0, parser_1.eval)(result, []);
3720
3872
  return el?.tagName === 'ASIDE' ? [el, (0, parser_1.exec)(result)] : [];
3721
3873
  }
@@ -3757,7 +3909,10 @@ function sanitize(source) {
3757
3909
 
3758
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'];
3759
3911
  const unreadableHTMLEntityNames = exports.invisibleHTMLEntityNames.slice(2);
3760
- 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]);
3761
3916
  const unreadableEscapableCharacter = new RegExp(`[${[...new Set(unreadableEscapableCharacters)].join('')}]`, 'g');
3762
3917
  // https://www.pandanoir.info/entry/2018/03/11/193000
3763
3918
  // http://anti.rosx.net/etc/memo/002_space.html
@@ -3832,7 +3987,7 @@ function parse(source, opts = {}, context) {
3832
3987
  ...(context?.resources && {
3833
3988
  resources: context.resources
3834
3989
  }),
3835
- memorable: 118
3990
+ memorable: 236
3836
3991
  /* State.backtrackable */
3837
3992
 
3838
3993
  };
@@ -3841,9 +3996,15 @@ function parse(source, opts = {}, context) {
3841
3996
  let index = 0;
3842
3997
 
3843
3998
  for (const seg of (0, segment_1.segment)(source)) {
3844
- node.append(...(0, parser_1.eval)((0, header_1.header)(seg, {
3845
- header: index++ === 0
3846
- }) || (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
+ }), []));
3847
4008
  }
3848
4009
 
3849
4010
  if (opts.test) return node;
@@ -3878,7 +4039,10 @@ const source_1 = __webpack_require__(6743);
3878
4039
 
3879
4040
  const delimiter = /[@#>0-9A-Za-z\n]|\S[#>]/;
3880
4041
 
3881
- const autolink = (source, context) => {
4042
+ const autolink = ({
4043
+ source,
4044
+ context
4045
+ }) => {
3882
4046
  if (source === '') return;
3883
4047
  const i = source.search(delimiter);
3884
4048
 
@@ -3887,7 +4051,10 @@ const autolink = (source, context) => {
3887
4051
  return [[source], ''];
3888
4052
 
3889
4053
  case 0:
3890
- return parser(source, context);
4054
+ return parser({
4055
+ source,
4056
+ context
4057
+ });
3891
4058
 
3892
4059
  default:
3893
4060
  return [[source.slice(0, i)], source.slice(i)];
@@ -3956,10 +4123,15 @@ exports.block = (0, combinator_1.creation)(error((0, combinator_1.reset)({
3956
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]))));
3957
4124
 
3958
4125
  function error(parser) {
3959
- 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
+ }) => {
3960
4129
  throw new Error(source.split('\n', 1)[0]);
3961
- }), parser), (source, {
3962
- id
4130
+ }), parser), ({
4131
+ source,
4132
+ context: {
4133
+ id
4134
+ }
3963
4135
  }, reason) => [[(0, dom_1.html)('h1', {
3964
4136
  id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : global_1.undefined,
3965
4137
  class: 'error'
@@ -4000,7 +4172,10 @@ const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combin
4000
4172
  const unindent = source => source.replace(/(^|\n)>(?:[^\S\n]|(?=>*(?:$|\s)))|\n$/g, '$1');
4001
4173
 
4002
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)]));
4003
- 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
+ }) => {
4004
4179
  const references = (0, dom_1.html)('ol', {
4005
4180
  class: 'references'
4006
4181
  });
@@ -4081,7 +4256,10 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.validate)('```', (0
4081
4256
  'data-lang': params.lang || global_1.undefined,
4082
4257
  'data-line': params.line || global_1.undefined,
4083
4258
  'data-path': params.path || global_1.undefined
4084
- }, 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
+ }), [])));
4085
4263
  return [el];
4086
4264
  })));
4087
4265
 
@@ -4112,17 +4290,17 @@ const dom_1 = __webpack_require__(3252);
4112
4290
 
4113
4291
  const array_1 = __webpack_require__(8112);
4114
4292
 
4115
- 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
4116
4294
  /* State.annotation */
4117
- | 32
4295
+ | 64
4118
4296
  /* State.reference */
4119
- | 16
4297
+ | 32
4120
4298
  /* State.index */
4121
- | 8
4299
+ | 16
4122
4300
  /* State.label */
4123
- | 4
4301
+ | 8
4124
4302
  /* State.link */
4125
- | 2
4303
+ | 4
4126
4304
  /* State.media */
4127
4305
  , (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))]))));
4128
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))]))));
@@ -4281,7 +4459,10 @@ exports.example = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
4281
4459
  'data-type': 'math'
4282
4460
  }, [(0, dom_1.html)('pre', {
4283
4461
  translate: 'no'
4284
- }, 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]])];
4285
4466
 
4286
4467
  default:
4287
4468
  return [(0, dom_1.html)('pre', {
@@ -4411,7 +4592,7 @@ const memoize_1 = __webpack_require__(1808);
4411
4592
 
4412
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.
4413
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, [])));
4414
- 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
4415
4596
  /* State.media */
4416
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', {
4417
4598
  class: 'figindex'
@@ -4427,7 +4608,10 @@ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinat
4427
4608
  } || overflow && {
4428
4609
  'data-invalid-type': 'fence',
4429
4610
  'data-invalid-message': `Invalid trailing line after the closing delimiter "${delim}"`
4430
- } || !(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
+ }) && {
4431
4615
  'data-invalid-type': 'label',
4432
4616
  'data-invalid-message': 'Invalid label'
4433
4617
  } || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && {
@@ -4587,7 +4771,10 @@ exports.message = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
4587
4771
  return [(0, dom_1.html)('section', {
4588
4772
  class: `message`,
4589
4773
  'data-type': type
4590
- }, (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
+ }), [])), [])))];
4591
4778
  })));
4592
4779
 
4593
4780
  function title(type) {
@@ -4681,7 +4868,10 @@ exports.table = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
4681
4868
  switch (type) {
4682
4869
  case 'grid':
4683
4870
  case global_1.undefined:
4684
- 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, {
4685
4875
  'data-type': type
4686
4876
  }));
4687
4877
 
@@ -4936,20 +5126,22 @@ const visibility_1 = __webpack_require__(7618);
4936
5126
 
4937
5127
  const dom_1 = __webpack_require__(3252);
4938
5128
 
4939
- 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], ''])))));
4940
- 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
4941
5133
  /* State.annotation */
4942
- | 32
5134
+ | 64
4943
5135
  /* State.reference */
4944
- | 16
5136
+ | 32
4945
5137
  /* State.index */
4946
- | 8
5138
+ | 16
4947
5139
  /* State.label */
4948
- | 4
5140
+ | 8
4949
5141
  /* State.link */
4950
- | 2
5142
+ | 4
4951
5143
  /* State.media */
4952
- , (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
4953
5145
  /* State.autolink */
4954
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`, {
4955
5147
  class: 'invalid',
@@ -5000,7 +5192,7 @@ const inline_1 = __webpack_require__(1160);
5000
5192
 
5001
5193
  const dom_1 = __webpack_require__(3252);
5002
5194
 
5003
- 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
5004
5196
  /* State.media */
5005
5197
  , exports.ilist_))));
5006
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', {
@@ -5083,13 +5275,11 @@ const duff_1 = __webpack_require__(8099);
5083
5275
 
5084
5276
  const array_1 = __webpack_require__(8112);
5085
5277
 
5086
- const tuple_1 = __webpack_require__(5341);
5087
-
5088
5278
  const openers = {
5089
5279
  '.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?:$|\s)/,
5090
5280
  '(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?:$|\s)/
5091
5281
  };
5092
- 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
5093
5283
  /* State.media */
5094
5284
  , exports.olist_))));
5095
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, []))])));
@@ -5099,10 +5289,18 @@ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, c
5099
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)]);
5100
5290
 
5101
5291
  const heads = {
5102
- '.': (0, combinator_1.focus)(openers['.'], source => [[source.trimEnd().split('.', 1)[0] + '.'], '']),
5103
- '(': (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)')], ''])
5104
5298
  };
5105
- 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', {
5106
5304
  class: 'invalid',
5107
5305
  'data-invalid-syntax': 'listitem',
5108
5306
  'data-invalid-type': 'syntax',
@@ -5283,9 +5481,13 @@ exports.cite = (0, combinator_1.creation)((0, combinator_1.line)((0, combinator_
5283
5481
  // リンクの実装は後で検討
5284
5482
  (0, combinator_1.focus)(/^>>\.[^\S\n]*(?:$|\n)/, () => [[(0, dom_1.html)('a', {
5285
5483
  class: 'anchor'
5286
- }, '>>.')], '']), (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', {
5287
5487
  class: 'anchor'
5288
- }, 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', {
5289
5491
  class: 'anchor',
5290
5492
  href: source.slice(2).trimEnd(),
5291
5493
  target: '_blank'
@@ -5330,12 +5532,18 @@ exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, comb
5330
5532
  'data-invalid-message': `Missing the whitespace after "${ns[0].split(/[^>]/, 1)[0]}"`
5331
5533
  }, (0, dom_1.defrag)(ns)), (0, dom_1.html)('br')]), false)));
5332
5534
 
5333
- const qblock = (source, context) => {
5535
+ const qblock = ({
5536
+ source,
5537
+ context
5538
+ }) => {
5334
5539
  source = source.replace(/\n$/, '');
5335
5540
  const lines = source.match(/^.*\n?/mg);
5336
5541
  const quotes = source.match(/^>+[^\S\n]/mg);
5337
5542
  const content = lines.reduce((acc, line, row) => acc + line.slice(quotes[row].length), '');
5338
- 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
+ }), []);
5339
5547
  nodes.unshift(quotes.shift());
5340
5548
 
5341
5549
  for (let i = 0; i < nodes.length; ++i) {
@@ -5429,7 +5637,9 @@ const array_1 = __webpack_require__(8112);
5429
5637
 
5430
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))])])));
5431
5639
 
5432
- 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', {
5433
5643
  class: 'invalid',
5434
5644
  'data-invalid-syntax': 'table-row',
5435
5645
  'data-invalid-type': 'syntax',
@@ -5485,11 +5695,13 @@ const dom_1 = __webpack_require__(3252);
5485
5695
 
5486
5696
  const array_1 = __webpack_require__(8112);
5487
5697
 
5488
- 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
5489
5699
  /* State.media */
5490
5700
  , exports.ulist_))));
5491
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))])));
5492
- 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', {
5493
5705
  class: 'checkbox'
5494
5706
  }, source[1].trimStart() ? '☑' : '☐')], '']));
5495
5707
 
@@ -5530,18 +5742,25 @@ const normalize_1 = __webpack_require__(185);
5530
5742
 
5531
5743
  const dom_1 = __webpack_require__(3252);
5532
5744
 
5533
- 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', {
5534
5749
  class: 'header'
5535
5750
  }, [(0, dom_1.html)('details', {
5536
5751
  open: ''
5537
- }, (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', {
5538
5755
  class: 'invalid',
5539
5756
  translate: 'no',
5540
5757
  'data-invalid-syntax': 'header',
5541
5758
  'data-invalid-type': 'syntax',
5542
5759
  'data-invalid-message': 'Invalid syntax'
5543
5760
  }, (0, normalize_1.normalize)(source))], '']]))), (0, combinator_1.clear)((0, source_1.str)(/^[^\S\v\f\r\n]*\r?\n/))])));
5544
- const field = (0, combinator_1.line)(source => {
5761
+ const field = (0, combinator_1.line)(({
5762
+ source
5763
+ }) => {
5545
5764
  const name = source.slice(0, source.indexOf(':'));
5546
5765
  const value = source.slice(name.length + 1).trim();
5547
5766
  return [[(0, dom_1.html)('span', {
@@ -5677,13 +5896,13 @@ const visibility_1 = __webpack_require__(7618);
5677
5896
 
5678
5897
  const dom_1 = __webpack_require__(3252);
5679
5898
 
5680
- 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
5681
5900
  /* State.annotation */
5682
5901
  , false, (0, combinator_1.syntax)(32
5683
5902
  /* Syntax.annotation */
5684
- , 6, 1, 64
5903
+ , 6, 1, 128
5685
5904
  /* State.annotation */
5686
- | 2
5905
+ | 4
5687
5906
  /* State.media */
5688
5907
  , (0, visibility_1.startLoose)((0, combinator_1.context)({
5689
5908
  delimiters: global_1.undefined
@@ -5724,7 +5943,7 @@ const source_1 = __webpack_require__(6743);
5724
5943
 
5725
5944
  const util_1 = __webpack_require__(9437);
5726
5945
 
5727
- 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
5728
5947
  /* State.autolink */
5729
5948
  , false, (0, combinator_1.syntax)(2
5730
5949
  /* Syntax.autolink */
@@ -5758,7 +5977,9 @@ const source_1 = __webpack_require__(6743);
5758
5977
  const dom_1 = __webpack_require__(3252); // https://example/@user must be a user page or a redirect page going there.
5759
5978
 
5760
5979
 
5761
- 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, {
5762
5983
  class: 'account'
5763
5984
  })]));
5764
5985
 
@@ -5787,7 +6008,9 @@ const dom_1 = __webpack_require__(3252); // Timeline(pseudonym): user/tid
5787
6008
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
5788
6009
 
5789
6010
 
5790
- 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, {
5791
6014
  class: 'anchor'
5792
6015
  })])));
5793
6016
 
@@ -5846,7 +6069,9 @@ const source_1 = __webpack_require__(6743);
5846
6069
  const dom_1 = __webpack_require__(3252); // https://html.spec.whatwg.org/multipage/input.html
5847
6070
 
5848
6071
 
5849
- 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', {
5850
6075
  class: 'email',
5851
6076
  href: `mailto:${source}`
5852
6077
  }, source)], '']));
@@ -5874,7 +6099,9 @@ const source_1 = __webpack_require__(6743);
5874
6099
 
5875
6100
  const dom_1 = __webpack_require__(3252);
5876
6101
 
5877
- 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, {
5878
6105
  class: 'hashnum',
5879
6106
  href: null
5880
6107
  })]));
@@ -5903,7 +6130,9 @@ const dom_1 = __webpack_require__(3252); // https://example/hashtags/a must be a
5903
6130
 
5904
6131
 
5905
6132
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
5906
- 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, {
5907
6136
  class: 'hashtag'
5908
6137
  }, el.innerText)]));
5909
6138
 
@@ -6008,9 +6237,11 @@ const combinator_1 = __webpack_require__(2087);
6008
6237
 
6009
6238
  const dom_1 = __webpack_require__(3252);
6010
6239
 
6011
- 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', {
6240
+ exports.code = (0, combinator_1.creation)((0, combinator_1.validate)('`', (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?[^`\n])\1(?!`)/, ([whole,, body]) => ({
6241
+ source
6242
+ }) => [[(0, dom_1.html)('code', {
6012
6243
  'data-src': whole
6013
- }, format(body))], rest.slice(whole.length)])));
6244
+ }, format(body))], source.slice(whole.length)])));
6014
6245
 
6015
6246
  function format(text) {
6016
6247
  return `${text[0]}${text[text.length - 1]}` === ' ' && text.trimStart() ? text.slice(1, -1) : text;
@@ -6158,10 +6389,16 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, s
6158
6389
  return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
6159
6390
 
6160
6391
  case '**':
6161
- 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];
6392
+ 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])({
6393
+ source: rest,
6394
+ context
6395
+ }) ?? [['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest];
6162
6396
 
6163
6397
  case '*':
6164
- 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];
6398
+ 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])({
6399
+ source: rest,
6400
+ context
6401
+ }) ?? [['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest];
6165
6402
  }
6166
6403
  }, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6167
6404
 
@@ -6185,18 +6422,27 @@ const combinator_1 = __webpack_require__(2087);
6185
6422
  const source_1 = __webpack_require__(6743);
6186
6423
 
6187
6424
  const repeat = (0, source_1.str)(/^(.)\1*/);
6188
- exports.escape = (0, combinator_1.union)([(source, context) => {
6425
+ exports.escape = (0, combinator_1.union)([({
6426
+ source,
6427
+ context
6428
+ }) => {
6189
6429
  if (source.length < 3) return;
6190
6430
 
6191
6431
  switch (source[0]) {
6192
6432
  case '*':
6193
6433
  if (source.length < 4) return;
6194
- return source[3] === source[0] && source[2] === source[0] && source[1] === source[0] ? repeat(source, context) : global_1.undefined;
6434
+ return source[3] === source[0] && source[2] === source[0] && source[1] === source[0] ? repeat({
6435
+ source,
6436
+ context
6437
+ }) : global_1.undefined;
6195
6438
 
6196
6439
  case '+':
6197
6440
  case '~':
6198
6441
  case '=':
6199
- return source[2] === source[0] && source[1] === source[0] ? repeat(source, context) : global_1.undefined;
6442
+ return source[2] === source[0] && source[1] === source[0] ? repeat({
6443
+ source,
6444
+ context
6445
+ }) : global_1.undefined;
6200
6446
 
6201
6447
  default:
6202
6448
  return;
@@ -6253,11 +6499,11 @@ const visibility_1 = __webpack_require__(7618);
6253
6499
 
6254
6500
  const dom_1 = __webpack_require__(3252);
6255
6501
 
6256
- 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
6502
+ 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
6257
6503
  /* State.index */
6258
6504
  , false, (0, combinator_1.syntax)(1024
6259
6505
  /* Syntax.index */
6260
- , 2, 1, 127
6506
+ , 2, 1, 254
6261
6507
  /* State.linkable */
6262
6508
  , (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, {
6263
6509
  id: el.id ? null : global_1.undefined,
@@ -6369,7 +6615,7 @@ const index_1 = __webpack_require__(4479);
6369
6615
 
6370
6616
  const dom_1 = __webpack_require__(3252);
6371
6617
 
6372
- 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
6618
+ 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
6373
6619
  /* State.index */
6374
6620
  , false, (0, combinator_1.union)([(0, combinator_1.focus)('[#]', () => [[(0, dom_1.html)('a', {
6375
6621
  href: '#'
@@ -6402,7 +6648,7 @@ const dom_1 = __webpack_require__(3252);
6402
6648
 
6403
6649
  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]))/);
6404
6650
  exports.segment = (0, combinator_1.clear)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])));
6405
- exports.label = (0, combinator_1.validate)(['[$', '$'], (0, combinator_1.creation)((0, combinator_1.fmap)((0, combinator_1.constraint)(8
6651
+ exports.label = (0, combinator_1.validate)(['[$', '$'], (0, combinator_1.creation)((0, combinator_1.fmap)((0, combinator_1.constraint)(16
6406
6652
  /* State.label */
6407
6653
  , false, (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])), ([text]) => [(0, dom_1.html)('a', {
6408
6654
  class: 'label',
@@ -6516,7 +6762,7 @@ exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0,
6516
6762
  /* State.none */
6517
6763
  , (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
6518
6764
  (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)))])))));
6519
- 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
6765
+ 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
6520
6766
  // [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
6521
6767
 
6522
6768
  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"]);
@@ -6590,7 +6836,9 @@ const dom_1 = __webpack_require__(3252);
6590
6836
 
6591
6837
  const memoize_1 = __webpack_require__(1808);
6592
6838
 
6593
- exports.unsafehtmlentity = (0, combinator_1.creation)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]+;/, entity => [[parse(entity) ?? `\x1B${entity}`], ''])));
6839
+ exports.unsafehtmlentity = (0, combinator_1.creation)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]+;/, ({
6840
+ source
6841
+ }) => [[parse(source) ?? `\x1B${source}`], ''])));
6594
6842
  exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([test]) => [test[0] === '\x1B' ? (0, dom_1.html)('span', {
6595
6843
  class: 'invalid',
6596
6844
  'data-invalid-syntax': 'htmlentity',
@@ -6675,39 +6923,45 @@ const optspec = {
6675
6923
  };
6676
6924
  Object.setPrototypeOf(optspec, null);
6677
6925
  exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.union)([medialink, textlink])));
6678
- const textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
6926
+ const textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8
6679
6927
  /* State.link */
6680
6928
  , false, (0, combinator_1.syntax)(256
6681
6929
  /* Syntax.link */
6682
- , 2, 10, 127
6930
+ , 2, 10, 254
6683
6931
  /* State.linkable */
6684
6932
  , (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) => {
6685
6933
  if (content.length !== 0 && (0, visibility_1.trimNode)(content).length === 0) return;
6686
6934
 
6687
6935
  for (let source = (0, util_1.stringify)(content); source;) {
6688
- const result = (0, combinator_1.state)(1
6689
- /* State.autolink */
6690
- , false, autolink_1.autolink)(source, context);
6691
- if (typeof (0, parser_1.eval)(result)[0] === 'object') return;
6692
- source = (0, parser_1.exec)(result);
6936
+ const result = autolink({
6937
+ source,
6938
+ context
6939
+ });
6940
+ if (typeof (0, parser_1.eval)(result, [])[0] === 'object') return;
6941
+ source = (0, parser_1.exec)(result, '');
6693
6942
  }
6694
6943
 
6695
6944
  return parse(content, params, rest, context);
6696
6945
  }))));
6697
- const medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
6946
+ const medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8
6698
6947
  /* State.link */
6699
- | 2
6948
+ | 4
6700
6949
  /* State.media */
6701
6950
  , false, (0, combinator_1.syntax)(256
6702
6951
  /* Syntax.link */
6703
- , 2, 10, 127
6952
+ , 2, 10, 254
6704
6953
  /* State.linkable */
6705
- ^ 2
6954
+ ^ 4
6706
6955
  /* State.media */
6707
6956
  , (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)))));
6708
6957
  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)))));
6709
6958
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
6710
6959
  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)}`])]);
6960
+ const autolink = (0, combinator_1.state)(2
6961
+ /* State.autolink */
6962
+ , false, (0, combinator_1.state)(1
6963
+ /* State.shortcut */
6964
+ , autolink_1.autolink));
6711
6965
 
6712
6966
  function parse(content, params, rest, context) {
6713
6967
  const INSECURE_URI = params.shift();
@@ -6716,25 +6970,6 @@ function parse(content, params, rest, context) {
6716
6970
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6717
6971
  }
6718
6972
 
6719
- function resolve(uri, host, source) {
6720
- switch (true) {
6721
- case uri.slice(0, 2) === '^/':
6722
- const last = host.pathname.slice(host.pathname.lastIndexOf('/') + 1);
6723
- return last.includes('.') // isFile
6724
- && /^[0-9]*[A-Za-z][0-9A-Za-z]*$/.test(last.slice(last.lastIndexOf('.') + 1)) ? `${host.pathname.slice(0, -last.length)}${uri.slice(2)}` : `${host.pathname.replace(/\/?$/, '/')}${uri.slice(2)}`;
6725
-
6726
- case host.origin === source.origin && host.pathname === source.pathname:
6727
- case uri.slice(0, 2) === '//':
6728
- return uri;
6729
-
6730
- default:
6731
- const target = new url_1.ReadonlyURL(uri, source.href);
6732
- return target.origin === host.origin ? target.href.slice(target.origin.length) : target.href;
6733
- }
6734
- }
6735
-
6736
- exports.resolve = resolve;
6737
-
6738
6973
  function elem(INSECURE_URI, content, uri, origin) {
6739
6974
  let type;
6740
6975
  let message;
@@ -6749,6 +6984,7 @@ function elem(INSECURE_URI, content, uri, origin) {
6749
6984
  }
6750
6985
 
6751
6986
  return (0, dom_1.html)('a', {
6987
+ class: content.length === 0 ? 'url' : 'link',
6752
6988
  href: uri.source,
6753
6989
  target: global_1.undefined || uri.origin !== origin || typeof content[0] === 'object' && content[0].classList.contains('media') ? '_blank' : global_1.undefined
6754
6990
  }, content.length === 0 ? decode(INSECURE_URI) : content);
@@ -6763,6 +6999,7 @@ function elem(INSECURE_URI, content, uri, origin) {
6763
6999
  switch (true) {
6764
7000
  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, ''):
6765
7001
  return (0, dom_1.html)('a', {
7002
+ class: 'tel',
6766
7003
  href: uri.source
6767
7004
  }, content);
6768
7005
  }
@@ -6780,6 +7017,25 @@ function elem(INSECURE_URI, content, uri, origin) {
6780
7017
  }, content.length === 0 ? INSECURE_URI : content);
6781
7018
  }
6782
7019
 
7020
+ function resolve(uri, host, source) {
7021
+ switch (true) {
7022
+ case uri.slice(0, 2) === '^/':
7023
+ const last = host.pathname.slice(host.pathname.lastIndexOf('/') + 1);
7024
+ return last.includes('.') // isFile
7025
+ && /^[0-9]*[A-Za-z][0-9A-Za-z]*$/.test(last.slice(last.lastIndexOf('.') + 1)) ? `${host.pathname.slice(0, -last.length)}${uri.slice(2)}` : `${host.pathname.replace(/\/?$/, '/')}${uri.slice(2)}`;
7026
+
7027
+ case host.origin === source.origin && host.pathname === source.pathname:
7028
+ case uri.slice(0, 2) === '//':
7029
+ return uri;
7030
+
7031
+ default:
7032
+ const target = new url_1.ReadonlyURL(uri, source.href);
7033
+ return target.origin === host.origin ? target.href.slice(target.origin.length) : target.href;
7034
+ }
7035
+ }
7036
+
7037
+ exports.resolve = resolve;
7038
+
6783
7039
  function decode(uri) {
6784
7040
  if (!uri.includes('%')) return uri;
6785
7041
 
@@ -6841,10 +7097,13 @@ const source_1 = __webpack_require__(6743);
6841
7097
  const dom_1 = __webpack_require__(3252);
6842
7098
 
6843
7099
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
6844
- 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, {
6845
- caches: {
6846
- math: cache
6847
- } = {}
7100
+ 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])/)]), ({
7101
+ source,
7102
+ context: {
7103
+ caches: {
7104
+ math: cache
7105
+ } = {}
7106
+ }
6848
7107
  }) => [[cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
6849
7108
  class: 'math',
6850
7109
  translate: 'no',
@@ -6896,7 +7155,7 @@ const optspec = {
6896
7155
  rel: global_1.undefined
6897
7156
  };
6898
7157
  Object.setPrototypeOf(optspec, null);
6899
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.open)('!', (0, combinator_1.constraint)(2
7158
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.open)('!', (0, combinator_1.constraint)(4
6900
7159
  /* State.media */
6901
7160
  , false, (0, combinator_1.syntax)(64
6902
7161
  /* Syntax.media */
@@ -6920,13 +7179,20 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
6920
7179
  el.style.aspectRatio = el.getAttribute('aspect-ratio');
6921
7180
  }
6922
7181
 
6923
- if (context.state & 4
7182
+ if (context.state & 8
6924
7183
  /* State.link */
6925
7184
  ) return [[el], rest];
6926
- if (cache && cache.tagName !== 'IMG') return (0, combinator_1.creation)(10, (..._) => [[el], rest])('!', context);
7185
+ if (cache && cache.tagName !== 'IMG') return (0, combinator_1.creation)(10, (..._) => [[el], rest])({
7186
+ source: '!',
7187
+ context
7188
+ });
6927
7189
  return (0, combinator_1.fmap)(link_1.unsafelink, ([link]) => [(0, dom_1.define)(link, {
7190
+ class: null,
6928
7191
  target: '_blank'
6929
- }, [el])])(`{ ${INSECURE_URI}${params.join('')} }${rest}`, context);
7192
+ }, [el])])({
7193
+ source: `{ ${INSECURE_URI}${params.join('')} }${rest}`,
7194
+ context
7195
+ });
6930
7196
  }))))));
6931
7197
  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)])));
6932
7198
  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]);
@@ -6998,15 +7264,15 @@ const util_1 = __webpack_require__(9437);
6998
7264
 
6999
7265
  const dom_1 = __webpack_require__(3252);
7000
7266
 
7001
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(32
7267
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(64
7002
7268
  /* State.reference */
7003
7269
  , false, (0, combinator_1.syntax)(4096
7004
7270
  /* Syntax.reference */
7005
- , 6, 1, 64
7271
+ , 6, 1, 128
7006
7272
  /* State.annotation */
7007
- | 32
7273
+ | 64
7008
7274
  /* State.reference */
7009
- | 2
7275
+ | 4
7010
7276
  /* State.media */
7011
7277
  , (0, visibility_1.startLoose)((0, combinator_1.context)({
7012
7278
  delimiters: global_1.undefined
@@ -7074,7 +7340,10 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0,
7074
7340
  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', ')')])))];
7075
7341
  }
7076
7342
  }))));
7077
- const text = (0, combinator_1.creation)((source, context) => {
7343
+ const text = (0, combinator_1.creation)(({
7344
+ source,
7345
+ context
7346
+ }) => {
7078
7347
  const acc = [''];
7079
7348
 
7080
7349
  while (source !== '') {
@@ -7082,7 +7351,10 @@ const text = (0, combinator_1.creation)((source, context) => {
7082
7351
  // @ts-expect-error
7083
7352
  case '&':
7084
7353
  {
7085
- const result = (0, htmlentity_1.unsafehtmlentity)(source, context);
7354
+ const result = (0, htmlentity_1.unsafehtmlentity)({
7355
+ source,
7356
+ context
7357
+ });
7086
7358
 
7087
7359
  if (result) {
7088
7360
  acc[acc.length - 1] += (0, parser_1.eval)(result)[0];
@@ -7100,7 +7372,10 @@ const text = (0, combinator_1.creation)((source, context) => {
7100
7372
  continue;
7101
7373
  }
7102
7374
 
7103
- const result = (0, source_1.text)(source, context);
7375
+ const result = (0, source_1.text)({
7376
+ source,
7377
+ context
7378
+ });
7104
7379
  acc[acc.length - 1] += (0, parser_1.eval)(result)[0] ?? source.slice(0, source.length - (0, parser_1.exec)(result).length);
7105
7380
  source = (0, parser_1.exec)(result);
7106
7381
  continue;
@@ -7149,7 +7424,7 @@ const url_1 = __webpack_require__(4318);
7149
7424
 
7150
7425
  const media_1 = __webpack_require__(1303);
7151
7426
 
7152
- exports.shortmedia = (0, combinator_1.rewrite)((0, combinator_1.constraint)(2
7427
+ exports.shortmedia = (0, combinator_1.rewrite)((0, combinator_1.constraint)(4
7153
7428
  /* State.media */
7154
7429
  , false, (0, combinator_1.open)('!', url_1.url)), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media])));
7155
7430
 
@@ -7746,7 +8021,10 @@ function* segment(source) {
7746
8021
  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)}`;
7747
8022
 
7748
8023
  while (source !== '') {
7749
- const result = parser(source, {});
8024
+ const result = parser({
8025
+ source,
8026
+ context: {}
8027
+ });
7750
8028
  const rest = (0, parser_1.exec)(result);
7751
8029
  const segs = (0, parser_1.eval)(result).length ? (0, parser_1.eval)(result) : [source.slice(0, source.length - rest.length)];
7752
8030
 
@@ -7873,7 +8151,9 @@ const combinator_1 = __webpack_require__(2087);
7873
8151
  const text_1 = __webpack_require__(7763);
7874
8152
 
7875
8153
  const delimiter = /[\s\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]/;
7876
- exports.escsource = (0, combinator_1.creation)(source => {
8154
+ exports.escsource = (0, combinator_1.creation)(({
8155
+ source
8156
+ }) => {
7877
8157
  if (source === '') return;
7878
8158
  const i = source.search(delimiter);
7879
8159
 
@@ -7918,8 +8198,8 @@ const global_1 = __webpack_require__(4128);
7918
8198
  const combinator_1 = __webpack_require__(2087);
7919
8199
 
7920
8200
  exports.anyline = (0, combinator_1.line)(() => [[], '']);
7921
- exports.emptyline = (0, combinator_1.line)(s => (0, combinator_1.isEmpty)(s) ? [[], ''] : global_1.undefined);
7922
- exports.contentline = (0, combinator_1.line)(s => !(0, combinator_1.isEmpty)(s) ? [[], ''] : global_1.undefined);
8201
+ exports.emptyline = (0, combinator_1.line)(i => (0, combinator_1.isEmpty)(i.source) ? [[], ''] : global_1.undefined);
8202
+ exports.contentline = (0, combinator_1.line)(i => !(0, combinator_1.isEmpty)(i.source) ? [[], ''] : global_1.undefined);
7923
8203
 
7924
8204
  /***/ }),
7925
8205
 
@@ -7939,10 +8219,14 @@ const global_1 = __webpack_require__(4128);
7939
8219
  const combinator_1 = __webpack_require__(2087);
7940
8220
 
7941
8221
  function str(pattern) {
7942
- return typeof pattern === 'string' ? (0, combinator_1.creation)(source => {
8222
+ return typeof pattern === 'string' ? (0, combinator_1.creation)(({
8223
+ source
8224
+ }) => {
7943
8225
  if (source === '') return;
7944
8226
  return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : global_1.undefined;
7945
- }) : (0, combinator_1.creation)(source => {
8227
+ }) : (0, combinator_1.creation)(({
8228
+ source
8229
+ }) => {
7946
8230
  if (source === '') return;
7947
8231
  const m = source.match(pattern);
7948
8232
  return m && m[0].length > 0 ? [[m[0]], source.slice(m[0].length)] : global_1.undefined;
@@ -7952,10 +8236,14 @@ function str(pattern) {
7952
8236
  exports.str = str;
7953
8237
 
7954
8238
  function stropt(pattern) {
7955
- return typeof pattern === 'string' ? (0, combinator_1.creation)(source => {
8239
+ return typeof pattern === 'string' ? (0, combinator_1.creation)(({
8240
+ source
8241
+ }) => {
7956
8242
  if (source === '') return;
7957
8243
  return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : global_1.undefined;
7958
- }) : (0, combinator_1.creation)(source => {
8244
+ }) : (0, combinator_1.creation)(({
8245
+ source
8246
+ }) => {
7959
8247
  if (source === '') return;
7960
8248
  const m = source.match(pattern);
7961
8249
  return m ? [[m[0]], source.slice(m[0].length)] : global_1.undefined;
@@ -7993,7 +8281,10 @@ exports.text = (0, combinator_1.syntax)(0
7993
8281
  /* Syntax.none */
7994
8282
  , 1, 1, 0
7995
8283
  /* State.none */
7996
- , (source, context) => {
8284
+ , ({
8285
+ source,
8286
+ context
8287
+ }) => {
7997
8288
  if (source === '') return;
7998
8289
  const i = source.search(exports.delimiter);
7999
8290
 
@@ -8010,7 +8301,10 @@ exports.text = (0, combinator_1.syntax)(0
8010
8301
  case '。':
8011
8302
  case '!':
8012
8303
  case '?':
8013
- return (0, exports.text)(source.slice(1), context);
8304
+ return (0, exports.text)({
8305
+ source: source.slice(1),
8306
+ context
8307
+ });
8014
8308
  }
8015
8309
 
8016
8310
  break;
@@ -8049,7 +8343,10 @@ exports.text = (0, combinator_1.syntax)(0
8049
8343
  case '~':
8050
8344
  case '=':
8051
8345
  case '`':
8052
- return source[1] === source[0] ? repeat(source, context) : [[source[0]], source.slice(1)];
8346
+ return source[1] === source[0] ? repeat({
8347
+ source,
8348
+ context
8349
+ }) : [[source[0]], source.slice(1)];
8053
8350
 
8054
8351
  default:
8055
8352
  const b = source[0].trimStart() === '';
@@ -8088,7 +8385,9 @@ const combinator_1 = __webpack_require__(2087);
8088
8385
 
8089
8386
  const text_1 = __webpack_require__(7763);
8090
8387
 
8091
- exports.unescsource = (0, combinator_1.creation)(source => {
8388
+ exports.unescsource = (0, combinator_1.creation)(({
8389
+ source
8390
+ }) => {
8092
8391
  if (source === '') return;
8093
8392
  const i = source.search(text_1.delimiter);
8094
8393
 
@@ -8186,9 +8485,9 @@ function hasVisible(nodes, {
8186
8485
  if (node && node.trimStart()) return true;
8187
8486
  } else {
8188
8487
  if (node.innerText.trimStart()) return true;
8189
- if (state & 2
8488
+ if (state & 4
8190
8489
  /* State.media */
8191
- ^ 2
8490
+ ^ 4
8192
8491
  /* State.media */
8193
8492
  && (node.classList.contains('media') || node.getElementsByClassName('media')[0])) return true;
8194
8493
  }
@@ -8207,20 +8506,31 @@ function blankWith(starting, delimiter) {
8207
8506
  exports.blankWith = blankWith;
8208
8507
 
8209
8508
  function startLoose(parser, except) {
8210
- return (source, context) => isStartLoose(source, context, except) ? parser(source, context) : global_1.undefined;
8509
+ return input => isStartLoose(input, except) ? parser(input) : global_1.undefined;
8211
8510
  }
8212
8511
 
8213
8512
  exports.startLoose = startLoose;
8214
- const isStartLoose = (0, memoize_1.reduce)((source, context, except) => {
8215
- return isStartTight(source.replace(exports.regBlankStart, ''), context, except);
8216
- }, (source, _, except = '') => `${source}\x1E${except}`);
8513
+ const isStartLoose = (0, memoize_1.reduce)(({
8514
+ source,
8515
+ context
8516
+ }, except) => {
8517
+ return isStartTight({
8518
+ source: source.replace(exports.regBlankStart, ''),
8519
+ context
8520
+ }, except);
8521
+ }, ({
8522
+ source
8523
+ }, except = '') => `${source}\x1E${except}`);
8217
8524
 
8218
8525
  function startTight(parser, except) {
8219
- return (source, context) => isStartTight(source, context, except) ? parser(source, context) : global_1.undefined;
8526
+ return input => isStartTight(input, except) ? parser(input) : global_1.undefined;
8220
8527
  }
8221
8528
 
8222
8529
  exports.startTight = startTight;
8223
- const isStartTight = (0, memoize_1.reduce)((source, context, except) => {
8530
+ const isStartTight = (0, memoize_1.reduce)(({
8531
+ source,
8532
+ context
8533
+ }, except) => {
8224
8534
  if (source === '') return true;
8225
8535
  if (except && source.slice(0, except.length) === except) return false;
8226
8536
 
@@ -8236,7 +8546,10 @@ const isStartTight = (0, memoize_1.reduce)((source, context, except) => {
8236
8546
 
8237
8547
  case '&':
8238
8548
  switch (true) {
8239
- case source.length > 2 && source[1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(source, context))?.[0]?.trimStart() === '':
8549
+ case source.length > 2 && source[1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)({
8550
+ source,
8551
+ context
8552
+ }))?.[0]?.trimStart() === '':
8240
8553
  return false;
8241
8554
  }
8242
8555
 
@@ -8253,7 +8566,9 @@ const isStartTight = (0, memoize_1.reduce)((source, context, except) => {
8253
8566
  default:
8254
8567
  return source[0].trimStart() !== '';
8255
8568
  }
8256
- }, (source, _, except = '') => `${source}\x1E${except}`);
8569
+ }, ({
8570
+ source
8571
+ }, except = '') => `${source}\x1E${except}`);
8257
8572
 
8258
8573
  function isStartLooseNodes(nodes) {
8259
8574
  if (nodes.length === 0) return true;
@@ -8671,6 +8986,7 @@ function pdf(source, url) {
8671
8986
  type: 'application/pdf',
8672
8987
  data: source.getAttribute('data-src')
8673
8988
  }), (0, dom_1.html)('div', [(0, dom_1.define)((0, parser_1.parse)(`{ ${source.getAttribute('data-src')} }`).querySelector('a'), {
8989
+ class: null,
8674
8990
  target: '_blank'
8675
8991
  })])]);
8676
8992
  }
@@ -8736,7 +9052,10 @@ function twitter(source, url) {
8736
9052
  status,
8737
9053
  statusText
8738
9054
  }) {
8739
- (0, dom_1.define)(el, [(0, parser_1.parse)(`*{ ${source.getAttribute('data-src')} }*\n\n\`\`\`\n${status}\n${statusText}\n\`\`\``)]);
9055
+ (0, dom_1.define)(el, [(0, dom_1.define)((0, parser_1.parse)(`{ ${source.getAttribute('data-src')} }`).querySelector('a'), {
9056
+ class: null,
9057
+ target: '_blank'
9058
+ }), (0, dom_1.html)('pre', `${status}\n${statusText}`)]);
8740
9059
  }
8741
9060
 
8742
9061
  });
@@ -8894,8 +9213,8 @@ const array_1 = __webpack_require__(8112);
8894
9213
  function info(source) {
8895
9214
  const match = (0, scope_1.scope)(source, '.invalid');
8896
9215
  return {
8897
- url: find('a:not(:is(.email, .account, .channel, .hashtag, .hashnum, .anchor))').filter(el => ['http:', 'https:'].includes(el.protocol)),
8898
- tel: find('a:not(:is(.email, .account, .channel, .hashtag, .hashnum, .anchor))').filter(el => ['tel:'].includes(el.protocol)),
9216
+ url: find('a.link, a.url'),
9217
+ tel: find('a.tel'),
8899
9218
  email: find('a.email'),
8900
9219
  account: find('a.account'),
8901
9220
  channel: find('a.channel'),
@@ -8937,7 +9256,10 @@ const dom_1 = __webpack_require__(3252);
8937
9256
  const duff_1 = __webpack_require__(8099);
8938
9257
 
8939
9258
  function quote(anchor, range) {
8940
- if ((0, parser_1.exec)((0, cite_1.cite)(`>>${anchor}`, {})) !== '') throw new Error(`Invalid anchor: ${anchor}`);
9259
+ if ((0, parser_1.exec)((0, cite_1.cite)({
9260
+ source: `>>${anchor}`,
9261
+ context: {}
9262
+ })) !== '') throw new Error(`Invalid anchor: ${anchor}`);
8941
9263
  fit(range);
8942
9264
  const node = trim(range.cloneContents());
8943
9265
  if (!node.firstChild) return '';