securemark 0.294.6 → 0.294.8

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 (62) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.js +226 -216
  3. package/markdown.d.ts +13 -36
  4. package/package.json +1 -1
  5. package/src/combinator/control/constraint/block.ts +2 -2
  6. package/src/combinator/control/constraint/line.ts +7 -5
  7. package/src/combinator/control/manipulation/convert.ts +2 -1
  8. package/src/combinator/control/manipulation/fence.ts +4 -4
  9. package/src/combinator/control/manipulation/indent.ts +3 -5
  10. package/src/combinator/control/manipulation/surround.ts +47 -18
  11. package/src/combinator/data/parser/some.ts +1 -1
  12. package/src/combinator/data/parser/union.ts +6 -2
  13. package/src/parser/api/bind.test.ts +0 -1
  14. package/src/parser/api/normalize.test.ts +5 -8
  15. package/src/parser/api/normalize.ts +11 -11
  16. package/src/parser/api/parse.test.ts +3 -3
  17. package/src/parser/autolink.ts +1 -2
  18. package/src/parser/block/extension/fig.ts +4 -1
  19. package/src/parser/block/heading.ts +12 -2
  20. package/src/parser/block/reply/quote.ts +1 -2
  21. package/src/parser/block/ulist.ts +1 -1
  22. package/src/parser/block.ts +0 -4
  23. package/src/parser/header.ts +28 -40
  24. package/src/parser/inline/annotation.ts +2 -3
  25. package/src/parser/inline/autolink/account.ts +47 -17
  26. package/src/parser/inline/autolink/anchor.test.ts +0 -1
  27. package/src/parser/inline/autolink/anchor.ts +15 -15
  28. package/src/parser/inline/autolink/email.test.ts +1 -1
  29. package/src/parser/inline/autolink/email.ts +10 -11
  30. package/src/parser/inline/autolink/hashnum.ts +17 -14
  31. package/src/parser/inline/autolink/hashtag.ts +23 -19
  32. package/src/parser/inline/autolink/url.ts +24 -19
  33. package/src/parser/inline/autolink.ts +36 -25
  34. package/src/parser/inline/bracket.ts +14 -14
  35. package/src/parser/inline/deletion.ts +2 -1
  36. package/src/parser/inline/emphasis.ts +2 -1
  37. package/src/parser/inline/emstrong.ts +2 -1
  38. package/src/parser/inline/extension/index.ts +4 -4
  39. package/src/parser/inline/extension/indexer.ts +1 -1
  40. package/src/parser/inline/extension/label.ts +1 -1
  41. package/src/parser/inline/extension/placeholder.ts +4 -3
  42. package/src/parser/inline/html.ts +5 -5
  43. package/src/parser/inline/htmlentity.ts +3 -3
  44. package/src/parser/inline/insertion.ts +2 -1
  45. package/src/parser/inline/italic.ts +2 -1
  46. package/src/parser/inline/link.ts +7 -20
  47. package/src/parser/inline/mark.ts +2 -1
  48. package/src/parser/inline/math.ts +4 -2
  49. package/src/parser/inline/media.ts +24 -25
  50. package/src/parser/inline/reference.ts +4 -4
  51. package/src/parser/inline/remark.ts +2 -1
  52. package/src/parser/inline/ruby.ts +3 -4
  53. package/src/parser/inline/strong.ts +2 -1
  54. package/src/parser/inline/template.ts +10 -10
  55. package/src/parser/inline.ts +2 -1
  56. package/src/parser/segment.ts +2 -2
  57. package/src/parser/source/escapable.ts +3 -4
  58. package/src/parser/source/line.ts +3 -1
  59. package/src/parser/source/text.ts +8 -13
  60. package/src/parser/source/unescapable.ts +2 -4
  61. package/src/parser/source.ts +1 -2
  62. package/src/parser/inline/autolink/channel.ts +0 -44
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.294.6 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.294.8 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("Prism"), require("DOMPurify"));
@@ -2585,7 +2585,7 @@ function block(parser, separation = true) {
2585
2585
  if (position === source.length) return;
2586
2586
  const result = parser(input);
2587
2587
  if (result === undefined) return;
2588
- if (separation && !(0, line_1.isBlank)((0, line_1.firstline)(source, context.position))) return;
2588
+ if (separation && !(0, line_1.isBlankline)(source, context.position)) return;
2589
2589
  return context.position === source.length || source[context.position - 1] === '\n' ? result : undefined;
2590
2590
  });
2591
2591
  }
@@ -2653,7 +2653,7 @@ exports.verify = verify;
2653
2653
  Object.defineProperty(exports, "__esModule", ({
2654
2654
  value: true
2655
2655
  }));
2656
- exports.isBlank = exports.firstline = exports.line = void 0;
2656
+ exports.isBlankline = exports.firstline = exports.line = void 0;
2657
2657
  const parser_1 = __webpack_require__(605);
2658
2658
  function line(parser) {
2659
2659
  return (0, parser_1.failsafe)(({
@@ -2673,7 +2673,7 @@ function line(parser) {
2673
2673
  context.source = source;
2674
2674
  context.offset -= position;
2675
2675
  if (result === undefined) return;
2676
- if (!isBlank(source.slice(context.position, position + line.length))) return;
2676
+ if (context.position < position + line.length && !isBlankline(source, context.position)) return;
2677
2677
  context.position = position + line.length;
2678
2678
  return result;
2679
2679
  });
@@ -2684,10 +2684,12 @@ function firstline(source, position) {
2684
2684
  return i === -1 ? source.slice(position) : source.slice(position, i + 1);
2685
2685
  }
2686
2686
  exports.firstline = firstline;
2687
- function isBlank(line) {
2688
- return line === '' || line === '\n' || line.trimStart() === '';
2687
+ const blankline = /[^\S\n]*(?:$|\n)/y;
2688
+ function isBlankline(source, position) {
2689
+ blankline.lastIndex = position;
2690
+ return source.length === position || source[position] === '\n' || blankline.test(source);
2689
2691
  }
2690
- exports.isBlank = isBlank;
2692
+ exports.isBlankline = isBlankline;
2691
2693
 
2692
2694
  /***/ },
2693
2695
 
@@ -2826,20 +2828,20 @@ function fence(opener, limit, separation = true) {
2826
2828
  context.position += matches[0].length;
2827
2829
  // Prevent annoying parsing in editing.
2828
2830
  const secondline = (0, line_1.firstline)(source, context.position);
2829
- if ((0, line_1.isBlank)(secondline) && (0, line_1.firstline)(source, context.position + secondline.length).trimEnd() !== delim) return;
2831
+ if ((0, line_1.isBlankline)(secondline, 0) && (0, line_1.firstline)(source, context.position + secondline.length).trimEnd() !== delim) return;
2830
2832
  let block = '';
2831
2833
  let closer = '';
2832
2834
  let overflow = '';
2833
2835
  for (let count = 1;; ++count) {
2834
2836
  if (context.position === source.length) break;
2835
2837
  const line = (0, line_1.firstline)(source, context.position);
2836
- if ((closer || count > limit + 1) && (0, line_1.isBlank)(line)) break;
2838
+ if ((closer || count > limit + 1) && (0, line_1.isBlankline)(line, 0)) break;
2837
2839
  if (closer) {
2838
2840
  overflow += line;
2839
2841
  }
2840
2842
  if (!closer && count <= limit + 1 && line.slice(0, delim.length) === delim && line.trimEnd() === delim) {
2841
2843
  closer = line;
2842
- if ((0, line_1.isBlank)((0, line_1.firstline)(source, context.position + line.length))) {
2844
+ if ((0, line_1.isBlankline)(source, context.position + line.length)) {
2843
2845
  context.position += line.length;
2844
2846
  break;
2845
2847
  }
@@ -2894,9 +2896,7 @@ function indent(opener, parser = false, separation = false) {
2894
2896
  } = context;
2895
2897
  context.position = source.length;
2896
2898
  return new parser_1.List([new parser_1.Data(source.slice(position))]);
2897
- }))), ([indent]) => indent.length * 2 + -(indent[0] === ' '), [], 2 ** 4 - 1)), separation), (lines, context) => {
2898
- return parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context));
2899
- }));
2899
+ }))), ([indent]) => indent.length * 2 + -(indent[0] === ' '), [], 2 ** 4 - 1)), separation), (lines, context) => parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context))));
2900
2900
  }
2901
2901
  exports.indent = indent;
2902
2902
  function trimBlockEnd(block) {
@@ -3088,12 +3088,17 @@ Object.defineProperty(exports, "__esModule", ({
3088
3088
  exports.setBacktrack = exports.isBacktrack = exports.close = exports.open = exports.surround = void 0;
3089
3089
  const parser_1 = __webpack_require__(605);
3090
3090
  const combinator_1 = __webpack_require__(3484);
3091
- function surround(opener, parser, closer, optional = false, f, g, backtracks = []) {
3091
+ function surround(opener, parser, closer, optional = false, backtracks = [], f, g) {
3092
3092
  switch (typeof opener) {
3093
3093
  case 'string':
3094
3094
  case 'object':
3095
3095
  opener = (0, combinator_1.clear)((0, combinator_1.matcher)(opener, true));
3096
3096
  }
3097
+ switch (typeof parser) {
3098
+ case 'string':
3099
+ case 'object':
3100
+ parser = (0, combinator_1.clear)((0, combinator_1.matcher)(parser, true));
3101
+ }
3097
3102
  switch (typeof closer) {
3098
3103
  case 'string':
3099
3104
  case 'object':
@@ -3124,16 +3129,14 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3124
3129
  if (!nodesM && !optional) {
3125
3130
  setBacktrack(context, backtracks, position);
3126
3131
  const result = g?.([nodesO, nodesM], context);
3127
- revert(context, linebreak);
3128
- return result;
3132
+ return result || void revert(context, linebreak);
3129
3133
  }
3130
3134
  const nodesC = nodesM || optional ? closer(input) : undefined;
3131
3135
  context.range = context.position - position;
3132
3136
  if (!nodesC) {
3133
3137
  setBacktrack(context, backtracks, position);
3134
3138
  const result = g?.([nodesO, nodesM], context);
3135
- revert(context, linebreak);
3136
- return result;
3139
+ return result || void revert(context, linebreak);
3137
3140
  }
3138
3141
  if (context.position === position) {
3139
3142
  return void revert(context, linebreak);
@@ -3142,19 +3145,17 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3142
3145
  const result = f ? f([nodesO, nodesM, nodesC], context) : nodesO.import(nodesM ?? new parser_1.List()).import(nodesC);
3143
3146
  if (result) {
3144
3147
  context.linebreak ||= linebreak;
3145
- } else {
3146
- revert(context, linebreak);
3147
3148
  }
3148
- return result;
3149
+ return result || void revert(context, linebreak);
3149
3150
  });
3150
3151
  }
3151
3152
  exports.surround = surround;
3152
3153
  function open(opener, parser, optional, backtracks) {
3153
- return surround(opener, parser, '', optional, undefined, undefined, backtracks);
3154
+ return surround(opener, parser, '', optional, backtracks);
3154
3155
  }
3155
3156
  exports.open = open;
3156
3157
  function close(parser, closer, optional, backtracks) {
3157
- return surround('', parser, closer, optional, undefined, undefined, backtracks);
3158
+ return surround('', parser, closer, optional, backtracks);
3158
3159
  }
3159
3160
  exports.close = close;
3160
3161
  const statesize = 2;
@@ -3183,7 +3184,7 @@ function isBacktrack(context, backtracks, position = context.position, length =
3183
3184
  }
3184
3185
  exports.isBacktrack = isBacktrack;
3185
3186
  function setBacktrack(context, backtracks, position, length = 1) {
3186
- // 以降バックトラックの可能性がなく記録不要の場合もあるが判別が面倒なので省略
3187
+ // バックトラックの可能性がなく記録不要の場合もあるが判別が面倒なので省略
3187
3188
  const {
3188
3189
  source
3189
3190
  } = context;
@@ -3944,7 +3945,7 @@ function some(parser, end, delimiters = [], limit = -1) {
3944
3945
  context.delimiters.push(delims);
3945
3946
  }
3946
3947
  // whileは数倍遅い
3947
- for (; context.position < source.length;) {
3948
+ for (const len = source.length; context.position < len;) {
3948
3949
  if (match(input)) break;
3949
3950
  if (context.delimiters?.match(input)) break;
3950
3951
  const result = parser(input);
@@ -4017,7 +4018,7 @@ function union(parsers) {
4017
4018
  case 1:
4018
4019
  return parsers[0];
4019
4020
  default:
4020
- return eval(['input =>', parsers.map((_, i) => `|| parsers[${i}](input)`).join('').slice(2)].join(''));
4021
+ return eval(['((', parsers.map((_, i) => `parser${i},`).join(''), ') =>', 'input =>', parsers.map((_, i) => `|| parser${i}(input)`).join('').slice(2), ')'].join(''))(...parsers);
4021
4022
  }
4022
4023
  }
4023
4024
  exports.union = union;
@@ -4396,8 +4397,13 @@ exports.normalize = normalize;
4396
4397
  function format(source) {
4397
4398
  return source.replace(/\r\n?/g, '\n');
4398
4399
  }
4400
+ const invalid = new RegExp([/(?![\t\r\n])[\x00-\x1F\x7F]/g.source, /(?!\u200D)[\u2006\u200B-\u200F\u202A-\u202F\u2060\uFEFF]/g.source
4401
+ // 後読みが重い
4402
+ ///(?<![\u1820\u1821])\u180E/g.source,
4403
+ ///[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g.source,
4404
+ ].join('|'), 'g');
4399
4405
  function sanitize(source) {
4400
- return source.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]|(?!\u200D)[\u2006\u200B-\u200F\u202A-\u202F\u2060\uFEFF]|(?<![\u1820\u1821])\u180E/g, UNICODE_REPLACEMENT_CHARACTER).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[\uDC00-\uDFFF]/g, char => char.length === 1 ? UNICODE_REPLACEMENT_CHARACTER : char);
4406
+ return source.replace(invalid, UNICODE_REPLACEMENT_CHARACTER);
4401
4407
  }
4402
4408
  // https://dev.w3.org/html5/html-author/charref
4403
4409
  // https://en.wikipedia.org/wiki/Whitespace_character
@@ -4508,7 +4514,7 @@ exports.autolink = void 0;
4508
4514
  const combinator_1 = __webpack_require__(3484);
4509
4515
  const autolink_1 = __webpack_require__(8072);
4510
4516
  const source_1 = __webpack_require__(8745);
4511
- exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([autolink_1.autolink, source_1.linebreak, source_1.unescsource])));
4517
+ exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([autolink_1.autolink, source_1.unescsource])));
4512
4518
 
4513
4519
  /***/ },
4514
4520
 
@@ -4560,9 +4566,6 @@ exports.block = (0, combinator_1.reset)({
4560
4566
  if (position === source.length) return;
4561
4567
  const fst = source[position];
4562
4568
  switch (fst) {
4563
- case '\n':
4564
- input.context.position = source.length;
4565
- return new parser_1.List();
4566
4569
  case '=':
4567
4570
  if (source.startsWith('===', position)) return (0, pagebreak_1.pagebreak)(input);
4568
4571
  break;
@@ -4923,9 +4926,14 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combin
4923
4926
  exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)((source, context) => {
4924
4927
  // Bug: TypeScript
4925
4928
  const fence = (/^[^\n]*\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/mg) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
4926
- return parser({
4929
+ const {
4930
+ position
4931
+ } = context;
4932
+ const result = parser({
4927
4933
  context
4928
- }) ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
4934
+ });
4935
+ context.position = position;
4936
+ return result ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
4929
4937
  }, (0, combinator_1.union)([figure_1.figure]), false), ([{
4930
4938
  value: el
4931
4939
  }]) => el.tagName === 'FIGURE')));
@@ -5420,11 +5428,21 @@ const source_1 = __webpack_require__(8745);
5420
5428
  const visibility_1 = __webpack_require__(6364);
5421
5429
  const util_1 = __webpack_require__(4992);
5422
5430
  const dom_1 = __webpack_require__(394);
5423
- exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(?:\n#+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, (0, combinator_1.some)((0, combinator_1.line)(({
5424
- context: {
5431
+ exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(?:\n#+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, input => {
5432
+ const {
5433
+ context
5434
+ } = input;
5435
+ const {
5425
5436
  source
5437
+ } = context;
5438
+ const acc = new parser_1.List();
5439
+ for (; context.position < source.length;) {
5440
+ const line = (0, combinator_1.firstline)(source, context.position);
5441
+ acc.push(new parser_1.Data(line));
5442
+ context.position += line.length;
5426
5443
  }
5427
- }) => new parser_1.List([new parser_1.Data(source)])))));
5444
+ return acc;
5445
+ }));
5428
5446
  exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
5429
5447
  // その他の表示制御は各所のCSSで行う。
5430
5448
  (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/##+/y), (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), (nodes, context) => {
@@ -5811,7 +5829,7 @@ exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
5811
5829
  // TODO: インデント数を渡してインデント数前の行頭確認を行う実装に置き換える
5812
5830
  source => source.replace(/(?<=^>+ )/mg, '\r'), (0, combinator_1.some)((0, combinator_1.union)([
5813
5831
  // quote補助関数が残した数式をパースする。
5814
- math_1.math, autolink_1.autolink, source_1.linebreak, source_1.unescsource])), false)), (ns, {
5832
+ math_1.math, autolink_1.autolink, source_1.unescsource])), false)), (ns, {
5815
5833
  source,
5816
5834
  position
5817
5835
  }) => new parser_1.List([new parser_1.Data(source[position - 1] === '\n' ? ns.pop().value : (0, dom_1.html)('br')), new parser_1.Data((0, dom_1.html)('span', {
@@ -5924,7 +5942,7 @@ const inline_1 = __webpack_require__(7973);
5924
5942
  const visibility_1 = __webpack_require__(6364);
5925
5943
  const util_1 = __webpack_require__(4992);
5926
5944
  const dom_1 = __webpack_require__(394);
5927
- exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/- /y, exports.ulist_)));
5945
+ exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)('- ', exports.ulist_)));
5928
5946
  exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('li', {
5929
5947
  'data-index': (0, inline_1.dataindex)(ns)
5930
5948
  }, (0, dom_1.defrag)((0, util_1.unwrap)(fillFirstLine(ns)))))])))])))), ns => new parser_1.List([new parser_1.Data(format((0, dom_1.html)('ul', (0, util_1.unwrap)(ns))))]))));
@@ -5967,24 +5985,11 @@ Object.defineProperty(exports, "__esModule", ({
5967
5985
  exports.header = void 0;
5968
5986
  const parser_1 = __webpack_require__(605);
5969
5987
  const combinator_1 = __webpack_require__(3484);
5970
- const segment_1 = __webpack_require__(3967);
5971
5988
  const source_1 = __webpack_require__(8745);
5972
5989
  const util_1 = __webpack_require__(4992);
5973
5990
  const normalize_1 = __webpack_require__(4490);
5974
5991
  const dom_1 = __webpack_require__(394);
5975
- exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.rewrite)(({
5976
- context
5977
- }) => {
5978
- const {
5979
- source
5980
- } = context;
5981
- if (context.header ?? true) {
5982
- context.position += (0, segment_1.segment)(source).next().value.length;
5983
- } else {
5984
- context.position = source.length;
5985
- }
5986
- return new parser_1.List();
5987
- }, (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
5992
+ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
5988
5993
  context
5989
5994
  }) => context.header ?? true, (0, combinator_1.focus)(/(---+) *\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1 *(?:$|\r?\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
5990
5995
  class: 'header'
@@ -6003,7 +6008,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *
6003
6008
  translate: 'no',
6004
6009
  ...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
6005
6010
  }, (0, normalize_1.normalize)(source.slice(position))))]);
6006
- }]))), (0, combinator_1.clear)((0, source_1.str)(/ *\r?\n/y))])));
6011
+ }])), (0, combinator_1.clear)((0, source_1.str)(/ *\r?\n/y))])));
6007
6012
  const field = (0, combinator_1.line)(({
6008
6013
  context: {
6009
6014
  source,
@@ -6041,6 +6046,7 @@ const reference_1 = __webpack_require__(9047);
6041
6046
  const template_1 = __webpack_require__(4510);
6042
6047
  const remark_1 = __webpack_require__(8948);
6043
6048
  const extension_1 = __webpack_require__(2743);
6049
+ const label_1 = __webpack_require__(2178);
6044
6050
  const link_1 = __webpack_require__(3628);
6045
6051
  const ruby_1 = __webpack_require__(7304);
6046
6052
  const html_1 = __webpack_require__(5013);
@@ -6096,7 +6102,7 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6096
6102
  return (0, html_1.html)(input);
6097
6103
  case '$':
6098
6104
  if (source[position + 1] === '{') return (0, math_1.math)(input);
6099
- return (0, extension_1.extension)(input) || (0, math_1.math)(input);
6105
+ return (0, label_1.label)(input) || (0, math_1.math)(input);
6100
6106
  case '+':
6101
6107
  if (source[position + 1] === '+') return (0, insertion_1.insertion)(input);
6102
6108
  break;
@@ -6184,9 +6190,9 @@ const inline_1 = __webpack_require__(7973);
6184
6190
  const visibility_1 = __webpack_require__(6364);
6185
6191
  const util_1 = __webpack_require__(4992);
6186
6192
  const dom_1 = __webpack_require__(394);
6187
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
6193
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
6188
6194
  class: 'annotation'
6189
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */])));
6195
+ }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined)));
6190
6196
 
6191
6197
  /***/ },
6192
6198
 
@@ -6203,21 +6209,49 @@ exports.autolink = void 0;
6203
6209
  const combinator_1 = __webpack_require__(3484);
6204
6210
  const url_1 = __webpack_require__(2129);
6205
6211
  const email_1 = __webpack_require__(5836);
6206
- const channel_1 = __webpack_require__(4639);
6207
6212
  const account_1 = __webpack_require__(4107);
6208
6213
  const hashtag_1 = __webpack_require__(5764);
6209
6214
  const hashnum_1 = __webpack_require__(8684);
6210
6215
  const anchor_1 = __webpack_require__(8535);
6211
- exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(new RegExp([/(?<![0-9a-z])@/yi.source, /(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source, /(?<![0-9a-z])>>/yi.source, /(?<![0-9a-z][.+-]?|[@#])!?[0-9a-z]/yi.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yiu'), (0, combinator_1.state)(~1 /* State.autolink */, (0, combinator_1.union)([url_1.lineurl, url_1.url, email_1.email,
6212
- // Escape unmatched email-like strings.
6213
- //str(/[0-9a-z]+(?:[_.+-][0-9a-z]+[:@]?|:|@(?=@))*/yi),
6214
- channel_1.channel, account_1.account,
6215
- // Escape unmatched account-like strings.
6216
- //str(/@+(?:[0-9a-z]+(?:[_.+-][0-9a-z]+)*)?/yi),
6217
- hashtag_1.hashtag, hashnum_1.hashnum,
6218
- // Escape unmatched hashtag-like strings.
6219
- //str(new RegExp(/#+(?:(?:[^\p{C}\p{S}\p{P}\s]|emoji)+(?:['_.+-](?:[^\p{C}\p{S}\p{P}\s]|emoji)+)*)?/yu.source.replace(/emoji/g, emoji), 'yu')),
6220
- anchor_1.anchor]))));
6216
+ const text_1 = __webpack_require__(5655);
6217
+ exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.state)(~1 /* State.autolink */, input => {
6218
+ const {
6219
+ context: {
6220
+ source,
6221
+ position
6222
+ }
6223
+ } = input;
6224
+ if (position === source.length) return;
6225
+ const fst = source[position];
6226
+ switch (fst) {
6227
+ case '@':
6228
+ return (0, account_1.account)(input);
6229
+ case '#':
6230
+ return (0, hashtag_1.hashtag)(input) || (0, hashnum_1.hashnum)(input);
6231
+ case '>':
6232
+ return (0, anchor_1.anchor)(input);
6233
+ case '!':
6234
+ if (!source.startsWith('http', position + 1)) break;
6235
+ if (position === 0) return (0, url_1.lineurl)(input);
6236
+ switch (source[position - 1]) {
6237
+ case '\r':
6238
+ case '\n':
6239
+ return (0, url_1.lineurl)(input);
6240
+ }
6241
+ break;
6242
+ case 'h':
6243
+ if (!source.startsWith('http', position)) return;
6244
+ if (position === 0) return (0, url_1.lineurl)(input) || (0, url_1.url)(input) || (0, email_1.email)(input);
6245
+ switch (source[position - 1]) {
6246
+ case '\r':
6247
+ case '\n':
6248
+ return (0, url_1.lineurl)(input) || (0, url_1.url)(input) || (0, email_1.email)(input);
6249
+ }
6250
+ return (0, url_1.url)(input) || (0, email_1.email)(input);
6251
+ default:
6252
+ if ((0, text_1.isAlphanumeric)(fst)) return (0, email_1.email)(input);
6253
+ }
6254
+ }));
6221
6255
 
6222
6256
  /***/ },
6223
6257
 
@@ -6234,14 +6268,37 @@ exports.account = void 0;
6234
6268
  const parser_1 = __webpack_require__(605);
6235
6269
  const combinator_1 = __webpack_require__(3484);
6236
6270
  const link_1 = __webpack_require__(3628);
6271
+ const hashtag_1 = __webpack_require__(5764);
6237
6272
  const source_1 = __webpack_require__(8745);
6238
6273
  const dom_1 = __webpack_require__(394);
6239
6274
  // https://example/@user must be a user page or a redirect page going there.
6240
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@#]|>>|:\S)/yi), true, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6275
+ // https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
6276
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi)), (0, combinator_1.some)((0, combinator_1.surround)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
6241
6277
  value
6242
- }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6243
- class: 'account'
6244
- }))]))))));
6278
+ }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 0 /* Backtrack.autolink */])), '', false, [3 | 0 /* Backtrack.autolink */], ([[{
6279
+ value: host
6280
+ }, {
6281
+ value: account
6282
+ }], nodes], context) => {
6283
+ const hashes = nodes.foldl((acc, {
6284
+ value
6285
+ }) => acc + '#' + value, '');
6286
+ const param = nodes.foldl((acc, {
6287
+ value
6288
+ }) => acc ? acc + '+' + value : value, '');
6289
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`@${host}${account}${hashes}`)]), new parser_1.List([new parser_1.Data(host ? `https://${host}@${account}?ch=${param}` : `/@${account}?ch=${param}`)]), context), {
6290
+ class: 'channel'
6291
+ }))]);
6292
+ }, ([[{
6293
+ value: host
6294
+ }, {
6295
+ value: account
6296
+ }]], context) => {
6297
+ if (context.source[context.position] === '#') return;
6298
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`@${host}${account}`)]), new parser_1.List([new parser_1.Data(host ? `https://${host}@${account}` : `/@${account}`)]), context), {
6299
+ class: 'account'
6300
+ }))]);
6301
+ }))));
6245
6302
 
6246
6303
  /***/ },
6247
6304
 
@@ -6267,47 +6324,11 @@ const dom_1 = __webpack_require__(394);
6267
6324
  // cid: YYYY-MMDD-HHMM-SSmmm
6268
6325
  // 内部表現はUnixTimeに統一する(時系列順)
6269
6326
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
6270
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*\/)?[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline?at=')}` : `?at=${source.slice(2)}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6327
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi), '', false, [3 | 0 /* Backtrack.autolink */], ([, [{
6271
6328
  value
6272
- }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6329
+ }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`>>${value}`)]), new parser_1.List([new parser_1.Data(`?at=${value}`)]), context), {
6273
6330
  class: 'anchor'
6274
- }))]))))));
6275
-
6276
- /***/ },
6277
-
6278
- /***/ 4639
6279
- (__unused_webpack_module, exports, __webpack_require__) {
6280
-
6281
- "use strict";
6282
-
6283
-
6284
- Object.defineProperty(exports, "__esModule", ({
6285
- value: true
6286
- }));
6287
- exports.channel = void 0;
6288
- const parser_1 = __webpack_require__(605);
6289
- const combinator_1 = __webpack_require__(3484);
6290
- const link_1 = __webpack_require__(3628);
6291
- const hashtag_1 = __webpack_require__(5764);
6292
- const source_1 = __webpack_require__(8745);
6293
- const dom_1 = __webpack_require__(394);
6294
- // https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
6295
- exports.channel = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.sequence)([(0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi), true, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.some)((0, combinator_1.verify)((0, combinator_1.surround)('#', (0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), (0, source_1.str)(new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), false, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), ([{
6296
- value
6297
- }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)))]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1, source.indexOf('#')).replace('/', '/@')}` : `/${source.slice(0, source.indexOf('#'))}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6298
- value: el
6299
- }], {
6300
- source,
6301
- position,
6302
- range = 0
6303
- }) => {
6304
- const src = source.slice(position - range, position);
6305
- const url = `${el.getAttribute('href')}?ch=${src.slice(src.indexOf('#') + 1).replace(/#/g, '+')}`;
6306
- return new parser_1.List([new parser_1.Data((0, dom_1.define)(el, {
6307
- class: 'channel',
6308
- href: url
6309
- }, src))]);
6310
- })))));
6331
+ }))])))));
6311
6332
 
6312
6333
  /***/ },
6313
6334
 
@@ -6326,16 +6347,14 @@ const combinator_1 = __webpack_require__(3484);
6326
6347
  const source_1 = __webpack_require__(8745);
6327
6348
  const dom_1 = __webpack_require__(394);
6328
6349
  // https://html.spec.whatwg.org/multipage/input.html
6329
- exports.email = (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z][_.+-]?|[@#])(?=[0-9a-z])/yi, (0, combinator_1.verify)((0, source_1.str)(/[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,255}@[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*(?![.-]?[0-9a-z@#]|>>|:\S)/yi), ([{
6350
+ exports.email = (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z][_.+-]?|[@#])(?=[0-9a-z])/yi, (0, combinator_1.verify)((0, source_1.str)(/[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,63}@[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}(?![.-]?[0-9a-z@#]|>>|:\S)/yi), ([{
6330
6351
  value
6331
- }]) => value.length <= 255), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.union)([({
6332
- context: {
6333
- source
6334
- }
6335
- }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6352
+ }]) => value.length <= 254), '', false, [3 | 0 /* Backtrack.autolink */], ([, [{
6353
+ value
6354
+ }]]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6336
6355
  class: 'email',
6337
- href: `mailto:${source}`
6338
- }, source))])]))));
6356
+ href: `mailto:${value}`
6357
+ }, value))]))));
6339
6358
 
6340
6359
  /***/ },
6341
6360
 
@@ -6355,12 +6374,12 @@ const link_1 = __webpack_require__(3628);
6355
6374
  const hashtag_1 = __webpack_require__(5764);
6356
6375
  const source_1 = __webpack_require__(8745);
6357
6376
  const dom_1 = __webpack_require__(394);
6358
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), false, [1 | 0 /* Backtrack.autolink */]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6377
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), '', false, [1 | 0 /* Backtrack.autolink */], ([, [{
6359
6378
  value
6360
- }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6379
+ }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`#${value}`)]), new parser_1.List([new parser_1.Data(value)]), context), {
6361
6380
  class: 'hashnum',
6362
6381
  href: null
6363
- }))]))))));
6382
+ }))])))));
6364
6383
 
6365
6384
  /***/ },
6366
6385
 
@@ -6382,13 +6401,13 @@ const dom_1 = __webpack_require__(394);
6382
6401
  // https://example/hashtags/a must be a hashtag page or a redirect page going there.
6383
6402
  // https://github.com/tc39/proposal-regexp-unicode-property-escapes#matching-emoji
6384
6403
  exports.emoji = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\u200D/u;
6385
- exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.verify)((0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, exports.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('').replace(/emoji/g, exports.emoji.source), 'yu')), (0, source_1.str)(new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, exports.emoji.source), 'yu')), false, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), ([{
6404
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu')), ([{
6386
6405
  value
6387
- }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6406
+ }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), false, [3 | 0 /* Backtrack.autolink */], ([, [{
6388
6407
  value
6389
- }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6408
+ }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`#${value}`)]), new parser_1.List([new parser_1.Data(`/hashtags/${value}`)]), context), {
6390
6409
  class: 'hashtag'
6391
- }))]))))));
6410
+ }))])))));
6392
6411
 
6393
6412
  /***/ },
6394
6413
 
@@ -6407,9 +6426,21 @@ const combinator_1 = __webpack_require__(3484);
6407
6426
  const inline_1 = __webpack_require__(7973);
6408
6427
  const link_1 = __webpack_require__(3628);
6409
6428
  const source_1 = __webpack_require__(8745);
6410
- exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, (0, combinator_1.verify)(bracket, ns => ns.length > 0))]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink, false))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
6411
- exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\n]*(?=$|\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink, false))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])])));
6412
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, undefined, () => new parser_1.List(), [3 | 0 /* Backtrack.autolink */])]));
6429
+ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, (0, combinator_1.verify)(bracket, ns => ns.length > 0))]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6430
+ context
6431
+ }) => new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(context.source)]), context))]))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
6432
+ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\n]*(?=$|\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6433
+ context
6434
+ }) => {
6435
+ const {
6436
+ source,
6437
+ position
6438
+ } = context;
6439
+ context.position -= source[0] === '!' ? 1 : 0;
6440
+ context.position += source.length;
6441
+ return new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(source.slice(position))]), context))]);
6442
+ })), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])])));
6443
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List())]));
6413
6444
 
6414
6445
  /***/ },
6415
6446
 
@@ -6456,7 +6487,7 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6456
6487
  return d1(input);
6457
6488
  }
6458
6489
  }]));
6459
- const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = new parser_1.List(), cs], {
6490
+ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 64 /* Backtrack.bracket */], ([as, bs = new parser_1.List(), cs], {
6460
6491
  source,
6461
6492
  position,
6462
6493
  range = 0
@@ -6465,8 +6496,8 @@ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6465
6496
  return indexA.test(str) ? new parser_1.List([new parser_1.Data(as.head.value), new parser_1.Data(str), new parser_1.Data(cs.head.value)]) : new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6466
6497
  class: 'paren'
6467
6498
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6468
- }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6469
- const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], {
6499
+ }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6500
+ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 64 /* Backtrack.bracket */], ([as, bs = [], cs], {
6470
6501
  source,
6471
6502
  position,
6472
6503
  range = 0
@@ -6475,8 +6506,8 @@ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6475
6506
  return indexF.test(str) ? new parser_1.List([new parser_1.Data(as.head.value), new parser_1.Data(str), new parser_1.Data(cs.head.value)]) : new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6476
6507
  class: 'paren'
6477
6508
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6478
- }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6479
- const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, ([as, bs = new parser_1.List(), cs], context) => {
6509
+ }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6510
+ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 64 /* Backtrack.bracket */], ([as, bs = new parser_1.List(), cs], context) => {
6480
6511
  if (context.state & 8 /* State.link */) {
6481
6512
  const {
6482
6513
  source,
@@ -6500,13 +6531,13 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6500
6531
  }
6501
6532
  }
6502
6533
  return as.import(bs).import(cs);
6503
- }, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6504
- const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6505
- const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6506
- const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6534
+ }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6535
+ const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6536
+ const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6537
+ const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6507
6538
  const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6508
6539
  // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
6509
- (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = new parser_1.List()]) => as.import(bs), [2 | 64 /* Backtrack.bracket */]));
6540
+ (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6510
6541
 
6511
6542
  /***/ },
6512
6543
 
@@ -6552,7 +6583,7 @@ const inline_1 = __webpack_require__(7973);
6552
6583
  const visibility_1 = __webpack_require__(6364);
6553
6584
  const util_1 = __webpack_require__(4992);
6554
6585
  const dom_1 = __webpack_require__(394);
6555
- exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), '~~', false, ([, bs], {
6586
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), '~~', false, [], ([, bs], {
6556
6587
  buffer
6557
6588
  }) => buffer.import(bs), ([, bs], {
6558
6589
  buffer
@@ -6578,7 +6609,7 @@ const source_1 = __webpack_require__(8745);
6578
6609
  const visibility_1 = __webpack_require__(6364);
6579
6610
  const util_1 = __webpack_require__(4992);
6580
6611
  const dom_1 = __webpack_require__(394);
6581
- exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('*'), false, ([, bs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
6612
+ exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('*'), false, [], ([, bs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
6582
6613
 
6583
6614
  /***/ },
6584
6615
 
@@ -6606,7 +6637,7 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
6606
6637
  // 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
6607
6638
  // 可能な限り早く閉じるよう解析しなければならない。
6608
6639
  // このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
6609
- exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/\*{1,3}/y), false, ([, bs, cs], context) => {
6640
+ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/\*{1,3}/y), false, [], ([, bs, cs], context) => {
6610
6641
  const {
6611
6642
  buffer = new parser_1.List()
6612
6643
  } = context;
@@ -6762,9 +6793,9 @@ const source_1 = __webpack_require__(8745);
6762
6793
  const visibility_1 = __webpack_require__(6364);
6763
6794
  const util_1 = __webpack_require__(4992);
6764
6795
  const dom_1 = __webpack_require__(394);
6765
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6796
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 64 /* Backtrack.bracket */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6766
6797
  'data-index': dataindex(bs)
6767
- }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined, [3 | 64 /* Backtrack.bracket */])), ns => {
6798
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
6768
6799
  if (ns.length === 1) {
6769
6800
  const el = ns.head.value;
6770
6801
  return new parser_1.List([new parser_1.Data((0, dom_1.define)(el, {
@@ -6777,7 +6808,7 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /*
6777
6808
  return ns;
6778
6809
  }
6779
6810
  })));
6780
- exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}])/y)]), ']'), /(?=])/y, false, ([, ns], context) => {
6811
+ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}])/y)]), ']'), /(?=])/y, false, [3 | 64 /* Backtrack.bracket */], ([, ns], context) => {
6781
6812
  const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
6782
6813
  value
6783
6814
  }) => acc + value, ''))?.slice(7);
@@ -6785,7 +6816,7 @@ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|',
6785
6816
  class: 'indexer',
6786
6817
  'data-index': index
6787
6818
  }))]) : undefined;
6788
- }, ([as, bs]) => bs && as.import(bs), [3 | 64 /* Backtrack.bracket */])));
6819
+ }, ([as, bs]) => bs && as.import(bs))));
6789
6820
  function dataindex(nodes) {
6790
6821
  let node = nodes.last;
6791
6822
  if (typeof node?.value !== 'object') return;
@@ -6962,7 +6993,7 @@ const dom_1 = __webpack_require__(394);
6962
6993
  exports.indexer = (0, combinator_1.surround)(/ \[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6963
6994
  class: 'indexer',
6964
6995
  'data-index': ''
6965
- }))]))]), /\]\s*$/y);
6996
+ }))]))]), /\][^\S\n]*(?:$|\n)/y);
6966
6997
 
6967
6998
  /***/ },
6968
6999
 
@@ -6982,7 +7013,7 @@ const source_1 = __webpack_require__(8745);
6982
7013
  const dom_1 = __webpack_require__(394);
6983
7014
  const body = (0, source_1.str)(/\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/y);
6984
7015
  exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
6985
- exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, [1 | 64 /* Backtrack.bracket */, 1]), body]), ([{
7016
+ exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, [1 | 64 /* Backtrack.bracket */, 1]), body]), ([{
6986
7017
  value
6987
7018
  }]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6988
7019
  class: 'label',
@@ -7029,10 +7060,10 @@ const dom_1 = __webpack_require__(394);
7029
7060
  // All syntax surrounded by square brackets shouldn't contain line breaks.
7030
7061
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
7031
7062
  // ^はabbrで使用済みだが^:などのようにして分離使用可能
7032
- (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7063
+ (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 64 /* Backtrack.bracket */], (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7033
7064
  class: 'invalid',
7034
7065
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
7035
- }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs), [3 | 64 /* Backtrack.bracket */]));
7066
+ }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
7036
7067
 
7037
7068
  /***/ },
7038
7069
 
@@ -7065,14 +7096,14 @@ Object.setPrototypeOf(attrspecs, null);
7065
7096
  Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
7066
7097
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
7067
7098
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
7068
- (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[ >])`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
7099
+ (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[ >])`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
7069
7100
  // 不可視のHTML構造が可視構造を変化させるべきでない。
7070
7101
  // 可視のHTMLは優先度変更を検討する。
7071
7102
  // このため<>は将来的に共通構造を変化させる可能性があり
7072
7103
  // 共通構造を変化させない非構造文字列としては依然としてエスケープを要する。
7073
- (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, cs, context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
7104
+ (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, cs, context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
7074
7105
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
7075
- (0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))])));
7106
+ (0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))])));
7076
7107
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
7077
7108
  function elem(tag, content, as, bs, cs, context) {
7078
7109
  if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
@@ -7143,7 +7174,7 @@ const combinator_1 = __webpack_require__(3484);
7143
7174
  const source_1 = __webpack_require__(8745);
7144
7175
  const util_1 = __webpack_require__(4992);
7145
7176
  const dom_1 = __webpack_require__(394);
7146
- exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, ([as, bs, cs]) => new parser_1.List([new parser_1.Data(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Data(as.head.value + (bs?.head?.value ?? ''))]), [3 | 64 /* Backtrack.bracket */]);
7177
+ exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 64 /* Backtrack.bracket */], ([as, bs, cs]) => new parser_1.List([new parser_1.Data(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Data(as.head.value + (bs?.head?.value ?? ''))]));
7147
7178
  exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
7148
7179
  value
7149
7180
  }]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Data(value) : new parser_1.Data((0, dom_1.html)('span', {
@@ -7174,7 +7205,7 @@ const inline_1 = __webpack_require__(7973);
7174
7205
  const visibility_1 = __webpack_require__(6364);
7175
7206
  const util_1 = __webpack_require__(4992);
7176
7207
  const dom_1 = __webpack_require__(394);
7177
- exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)]))), '++', false, ([, bs], {
7208
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)]))), '++', false, [], ([, bs], {
7178
7209
  buffer
7179
7210
  }) => buffer.import(bs), ([, bs], {
7180
7211
  buffer
@@ -7201,7 +7232,7 @@ const dom_1 = __webpack_require__(394);
7201
7232
  // 可読性のため実際にはオブリーク体を指定する。
7202
7233
  // 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
7203
7234
  // ある程度の長さのある文に使うのが望ましい。
7204
- exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('///')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '/'), inline_1.inline)])))), '///', false, ([, bs], {
7235
+ exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('///')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '/'), inline_1.inline)])))), '///', false, [], ([, bs], {
7205
7236
  buffer
7206
7237
  }) => buffer.import(bs), ([, bs], {
7207
7238
  buffer
@@ -7218,7 +7249,7 @@ exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0
7218
7249
  Object.defineProperty(exports, "__esModule", ({
7219
7250
  value: true
7220
7251
  }));
7221
- exports.decode = exports.resolve = exports.option = exports.uri = exports.unsafelink = exports.medialink = exports.textlink = void 0;
7252
+ exports.decode = exports.resolve = exports.parse = exports.option = exports.uri = exports.medialink = exports.textlink = void 0;
7222
7253
  const parser_1 = __webpack_require__(605);
7223
7254
  const combinator_1 = __webpack_require__(3484);
7224
7255
  const inline_1 = __webpack_require__(7973);
@@ -7232,15 +7263,15 @@ const optspec = {
7232
7263
  rel: ['nofollow']
7233
7264
  };
7234
7265
  Object.setPrototypeOf(optspec, null);
7235
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns : undefined, undefined, [3 | 64 /* Backtrack.bracket */, 3 | 16 /* Backtrack.link */, 2 | 8 /* Backtrack.ruby */])),
7266
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, [3 | 64 /* Backtrack.bracket */, 3 | 16 /* Backtrack.link */, 2 | 8 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns : undefined)),
7236
7267
  // `{ `と`{`で個別にバックトラックが発生し+1nされる。
7237
7268
  // 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
7238
- (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, undefined, ([as, bs], context) => {
7269
+ (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, [3 | 16 /* Backtrack.link */], undefined, ([as, bs], context) => {
7239
7270
  if (!bs) return;
7240
7271
  const head = context.position - context.range;
7241
7272
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7242
7273
  return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7243
- }, [3 | 16 /* Backtrack.link */]))]), ([{
7274
+ }))]), ([{
7244
7275
  value: content
7245
7276
  }, {
7246
7277
  value: params = undefined
@@ -7270,11 +7301,6 @@ exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8
7270
7301
  }, {
7271
7302
  value: params
7272
7303
  }], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))]))))));
7273
- exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([{
7274
- value: params
7275
- }, {
7276
- value: content
7277
- } = new parser_1.Data(new parser_1.List())], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))]))));
7278
7304
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/ /y, (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
7279
7305
  exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Data(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
7280
7306
  function parse(content, params, context) {
@@ -7286,6 +7312,7 @@ function parse(content, params, context) {
7286
7312
  const el = elem(INSECURE_URI, content, uri, context.host?.origin || location.origin);
7287
7313
  return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, (0, util_1.unwrap)(params))[0]);
7288
7314
  }
7315
+ exports.parse = parse;
7289
7316
  function elem(INSECURE_URI, content, uri, origin) {
7290
7317
  let type;
7291
7318
  let message;
@@ -7383,7 +7410,7 @@ const indexee_1 = __webpack_require__(7610);
7383
7410
  const visibility_1 = __webpack_require__(6364);
7384
7411
  const util_1 = __webpack_require__(4992);
7385
7412
  const dom_1 = __webpack_require__(394);
7386
- exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, (0, combinator_1.precedence)(0, (0, combinator_1.state)(2 /* State.mark */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), inline_1.inline)])))), '==', false, ([, bs], {
7413
+ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, (0, combinator_1.precedence)(0, (0, combinator_1.state)(2 /* State.mark */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), inline_1.inline)])))), '==', false, [], ([, bs], {
7387
7414
  buffer
7388
7415
  }) => buffer.import(bs), ([, bs], {
7389
7416
  buffer
@@ -7417,7 +7444,7 @@ const source_1 = __webpack_require__(8745);
7417
7444
  const util_1 = __webpack_require__(4992);
7418
7445
  const dom_1 = __webpack_require__(394);
7419
7446
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
7420
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, undefined, undefined, [3 | 64 /* Backtrack.bracket */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, undefined, undefined, [3 | 64 /* Backtrack.bracket */])]), ({
7447
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 64 /* Backtrack.bracket */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, [3 | 64 /* Backtrack.bracket */])]), ({
7421
7448
  context: {
7422
7449
  source,
7423
7450
  caches: {
@@ -7463,12 +7490,12 @@ const optspec = {
7463
7490
  rel: undefined
7464
7491
  };
7465
7492
  Object.setPrototypeOf(optspec, null);
7466
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns : undefined, undefined, [3 | 4 /* Backtrack.escbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, undefined, ([as, bs], context) => {
7493
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, [3 | 4 /* Backtrack.escbracket */], ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns : undefined)), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [3 | 16 /* Backtrack.link */], undefined, ([as, bs], context) => {
7467
7494
  if (!bs) return;
7468
7495
  const head = context.position - context.range;
7469
7496
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7470
7497
  return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7471
- }, [3 | 16 /* Backtrack.link */]))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data(nodes.head.value.foldl((acc, {
7498
+ }))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data(nodes.head.value.foldl((acc, {
7472
7499
  value
7473
7500
  }) => acc + value, ''))])), nodes.delete(nodes.last)])), ([{
7474
7501
  value: [{
@@ -7508,23 +7535,13 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7508
7535
  }
7509
7536
  if (context.state & 8 /* State.link */) return new parser_1.List([new parser_1.Data(el)]);
7510
7537
  if (cache && cache.tagName !== 'IMG') return new parser_1.List([new parser_1.Data(el)]);
7511
- const {
7512
- source,
7513
- position
7514
- } = context;
7515
- return (0, combinator_1.fmap)(link_1.unsafelink, ([{
7516
- value
7517
- }]) => {
7518
- context.source = source;
7519
- context.position = position;
7520
- return new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
7521
- class: null,
7522
- target: '_blank'
7523
- }, [el]))]);
7524
- })((0, parser_1.subinput)(`{ ${INSECURE_URI}${linkparams.join('')} }`, context));
7538
+ return new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List(), linkparams.reduce((acc, p) => acc.push(new parser_1.Data(p)) && acc, new parser_1.List([new parser_1.Data(INSECURE_URI)])), context), {
7539
+ class: null,
7540
+ target: '_blank'
7541
+ }, [el]))]);
7525
7542
  })))));
7526
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */])])));
7527
- const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, ([[{
7543
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (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, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (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, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List())])));
7544
+ const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, [], ([[{
7528
7545
  value: a
7529
7546
  }], [{
7530
7547
  value: b
@@ -7582,7 +7599,7 @@ const source_1 = __webpack_require__(8745);
7582
7599
  const visibility_1 = __webpack_require__(6364);
7583
7600
  const util_1 = __webpack_require__(4992);
7584
7601
  const dom_1 = __webpack_require__(394);
7585
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, ([, ns], context) => {
7602
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */], ([, ns], context) => {
7586
7603
  const {
7587
7604
  position,
7588
7605
  range = 0,
@@ -7630,7 +7647,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7630
7647
  if (context.position === source.length) {
7631
7648
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7632
7649
  } else {
7633
- const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, ([, cs = new parser_1.List(), ds]) => cs.import(ds), ([, cs = new parser_1.List()]) => {
7650
+ const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, [], ([, cs = new parser_1.List(), ds]) => cs.import(ds), ([, cs = new parser_1.List()]) => {
7634
7651
  (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7635
7652
  return cs;
7636
7653
  })({
@@ -7643,9 +7660,9 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7643
7660
  context.position = position;
7644
7661
  }
7645
7662
  return state & 128 /* State.annotation */ ? as.import(bs) : undefined;
7646
- }, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */])));
7663
+ })));
7647
7664
  // Chicago-Style
7648
- const abbr = (0, combinator_1.surround)((0, source_1.str)('^'), (0, combinator_1.union)([(0, source_1.str)(/(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/y)]), /\|?(?=]])|\|/y, true, ([, ns], context) => {
7665
+ const abbr = (0, combinator_1.surround)((0, source_1.str)('^'), (0, combinator_1.union)([(0, source_1.str)(/(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/y)]), /\|?(?=]])|\|/y, true, [], ([, ns], context) => {
7649
7666
  const {
7650
7667
  source,
7651
7668
  position,
@@ -7697,7 +7714,7 @@ const inline_1 = __webpack_require__(7973);
7697
7714
  const source_1 = __webpack_require__(8745);
7698
7715
  const util_1 = __webpack_require__(4992);
7699
7716
  const dom_1 = __webpack_require__(394);
7700
- exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7717
+ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7701
7718
  class: 'remark'
7702
7719
  }, [(0, dom_1.html)('input', {
7703
7720
  type: 'checkbox'
@@ -7729,10 +7746,10 @@ const source_1 = __webpack_require__(8745);
7729
7746
  const visibility_1 = __webpack_require__(6364);
7730
7747
  const util_1 = __webpack_require__(4992);
7731
7748
  const dom_1 = __webpack_require__(394);
7732
- exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, ([, ns]) => {
7749
+ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */], ([, ns]) => {
7733
7750
  ns && ns.last?.value === '' && ns.pop();
7734
7751
  return (0, visibility_1.isTightNodeStart)(ns) ? ns : undefined;
7735
- }, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, undefined, undefined, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */]))]), ([{
7752
+ })), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */]))]), ([{
7736
7753
  value: texts
7737
7754
  }, {
7738
7755
  value: rubies = undefined
@@ -7852,7 +7869,7 @@ const source_1 = __webpack_require__(8745);
7852
7869
  const visibility_1 = __webpack_require__(6364);
7853
7870
  const util_1 = __webpack_require__(4992);
7854
7871
  const dom_1 = __webpack_require__(394);
7855
- exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('**'), false, ([, bs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
7872
+ exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))))), (0, source_1.str)('**'), false, [], ([, bs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
7856
7873
 
7857
7874
  /***/ },
7858
7875
 
@@ -7871,13 +7888,13 @@ const combinator_1 = __webpack_require__(3484);
7871
7888
  const source_1 = __webpack_require__(8745);
7872
7889
  const util_1 = __webpack_require__(4992);
7873
7890
  const dom_1 = __webpack_require__(394);
7874
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7891
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7875
7892
  class: 'template'
7876
7893
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([, bs], context) => bs && new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7877
7894
  class: 'invalid',
7878
7895
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
7879
- }, context.source.slice(context.position - context.range, context.position)))]), [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
7880
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => new parser_1.List(), [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, ([as, bs = new parser_1.List(), cs], context) => context.linebreak === 0 ? as.import(bs).import(cs) : (context.position -= 1, as.import(bs)), ([as, bs]) => bs && as.import(bs), [3 | 4 /* Backtrack.escbracket */])]));
7896
+ }, context.source.slice(context.position - context.range, context.position)))])));
7897
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [3 | 4 /* Backtrack.escbracket */], ([as, bs = new parser_1.List(), cs], context) => context.linebreak === 0 ? as.import(bs).import(cs) : (context.position -= 1, as.import(bs)), ([as, bs]) => bs && as.import(bs))]));
7881
7898
 
7882
7899
  /***/ },
7883
7900
 
@@ -8206,7 +8223,7 @@ const extension_1 = __webpack_require__(6193);
8206
8223
  const source_1 = __webpack_require__(8745);
8207
8224
  exports.MAX_SEGMENT_SIZE = 100_000; // 100,000 bytes (Max value size of FDB)
8208
8225
  exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE * 10;
8209
- const parser = (0, combinator_1.union)([input => {
8226
+ const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptyline), input => {
8210
8227
  const {
8211
8228
  context: {
8212
8229
  source,
@@ -8232,7 +8249,7 @@ const parser = (0, combinator_1.union)([input => {
8232
8249
  case '$':
8233
8250
  return (0, extension_1.segment)(input);
8234
8251
  }
8235
- }, (0, combinator_1.some)(source_1.contentline, exports.MAX_SEGMENT_SIZE + 1), (0, combinator_1.some)(source_1.emptyline, exports.MAX_SEGMENT_SIZE + 1)]);
8252
+ }, (0, combinator_1.some)(source_1.contentline)]);
8236
8253
  function* segment(source) {
8237
8254
  if (!validate(source, exports.MAX_INPUT_SIZE)) return yield `${"\u0007" /* Command.Error */}Too large input over ${exports.MAX_INPUT_SIZE.toLocaleString('en')} bytes.\n${source.slice(0, 1001)}`;
8238
8255
  for (let position = 0; position < source.length;) {
@@ -8270,7 +8287,7 @@ exports.validate = validate;
8270
8287
  Object.defineProperty(exports, "__esModule", ({
8271
8288
  value: true
8272
8289
  }));
8273
- exports.anyline = exports.emptyline = exports.contentline = exports.strs = exports.str = exports.unescsource = exports.escsource = exports.linebreak = exports.txt = exports.text = void 0;
8290
+ exports.anyline = exports.emptyline = exports.contentline = exports.strs = exports.str = exports.unescsource = exports.escsource = exports.txt = exports.text = void 0;
8274
8291
  var text_1 = __webpack_require__(5655);
8275
8292
  Object.defineProperty(exports, "text", ({
8276
8293
  enumerable: true,
@@ -8284,12 +8301,6 @@ Object.defineProperty(exports, "txt", ({
8284
8301
  return text_1.txt;
8285
8302
  }
8286
8303
  }));
8287
- Object.defineProperty(exports, "linebreak", ({
8288
- enumerable: true,
8289
- get: function () {
8290
- return text_1.linebreak;
8291
- }
8292
- }));
8293
8304
  var escapable_1 = __webpack_require__(3770);
8294
8305
  Object.defineProperty(exports, "escsource", ({
8295
8306
  enumerable: true,
@@ -8366,9 +8377,6 @@ const escsource = ({
8366
8377
  (0, combinator_1.consume)(1, context);
8367
8378
  context.position += 1;
8368
8379
  switch (char) {
8369
- case '\r':
8370
- (0, combinator_1.consume)(-1, context);
8371
- return new parser_1.List();
8372
8380
  case "\u001B" /* Command.Escape */:
8373
8381
  (0, combinator_1.consume)(1, context);
8374
8382
  context.position += 1;
@@ -8384,6 +8392,9 @@ const escsource = ({
8384
8392
  context.position += 1;
8385
8393
  return new parser_1.List([new parser_1.Data(source.slice(position, position + 2))]);
8386
8394
  }
8395
+ case '\r':
8396
+ (0, combinator_1.consume)(-1, context);
8397
+ return new parser_1.List();
8387
8398
  case '\n':
8388
8399
  context.linebreak ||= source.length - position;
8389
8400
  return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
@@ -8509,7 +8520,7 @@ exports.strs = strs;
8509
8520
  Object.defineProperty(exports, "__esModule", ({
8510
8521
  value: true
8511
8522
  }));
8512
- exports.backToEmailHead = exports.backToUrlHead = exports.backToWhitespace = exports.next = exports.canSkip = exports.linebreak = exports.txt = exports.text = exports.nonWhitespace = void 0;
8523
+ exports.isAlphanumeric = exports.backToEmailHead = exports.backToUrlHead = exports.backToWhitespace = exports.next = exports.canSkip = exports.txt = exports.text = exports.nonWhitespace = void 0;
8513
8524
  const parser_1 = __webpack_require__(605);
8514
8525
  const combinator_1 = __webpack_require__(3484);
8515
8526
  const dom_1 = __webpack_require__(394);
@@ -8528,9 +8539,6 @@ const text = input => {
8528
8539
  (0, combinator_1.consume)(1, context);
8529
8540
  context.position += 1;
8530
8541
  switch (char) {
8531
- case '\r':
8532
- (0, combinator_1.consume)(-1, context);
8533
- return new parser_1.List();
8534
8542
  case "\u001B" /* Command.Escape */:
8535
8543
  case '\\':
8536
8544
  switch (source[position + 1]) {
@@ -8543,6 +8551,9 @@ const text = input => {
8543
8551
  context.position += 1;
8544
8552
  return new parser_1.List([new parser_1.Data(source.slice(position + 1, context.position))]);
8545
8553
  }
8554
+ case '\r':
8555
+ (0, combinator_1.consume)(-1, context);
8556
+ return new parser_1.List();
8546
8557
  case '\n':
8547
8558
  context.linebreak ||= source.length - position;
8548
8559
  return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);
@@ -8562,7 +8573,6 @@ const text = input => {
8562
8573
  };
8563
8574
  exports.text = text;
8564
8575
  exports.txt = (0, combinator_1.union)([exports.text]);
8565
- exports.linebreak = (0, combinator_1.focus)(/[\r\n]/y, (0, combinator_1.union)([exports.text]));
8566
8576
  function canSkip(source, position) {
8567
8577
  if (!isWhitespace(source[position], false)) return false;
8568
8578
  if (position + 1 === source.length) return true;
@@ -8670,8 +8680,9 @@ function backToEmailHead(source, position, index) {
8670
8680
  exports.backToEmailHead = backToEmailHead;
8671
8681
  function isAlphanumeric(char) {
8672
8682
  if (char < '0' || '\x7F' < char) return false;
8673
- return '0' <= char && char <= '9' || 'a' <= char && char <= 'z' || 'A' <= char && char <= 'Z';
8683
+ return '0' <= char && char <= '9' || 'A' <= char && char <= 'Z' || 'a' <= char && char <= 'z';
8674
8684
  }
8685
+ exports.isAlphanumeric = isAlphanumeric;
8675
8686
  //const dict = new class {
8676
8687
  // constructor() {
8677
8688
  // [
@@ -8813,13 +8824,12 @@ const unescsource = ({
8813
8824
  (0, combinator_1.consume)(1, context);
8814
8825
  context.position += 1;
8815
8826
  switch (char) {
8816
- case '\r':
8817
- (0, combinator_1.consume)(-1, context);
8818
- return new parser_1.List();
8819
8827
  case "\u001B" /* Command.Escape */:
8820
8828
  (0, combinator_1.consume)(1, context);
8821
8829
  context.position += 1;
8822
8830
  return new parser_1.List([new parser_1.Data(source.slice(position + 1, position + 2))]);
8831
+ case '\r':
8832
+ return new parser_1.List();
8823
8833
  case '\n':
8824
8834
  context.linebreak ||= source.length - position;
8825
8835
  return new parser_1.List([new parser_1.Data((0, dom_1.html)('br'))]);