securemark 0.250.0 → 0.253.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/design.md +17 -11
  3. package/dist/index.js +120 -139
  4. package/index.d.ts +1 -1
  5. package/markdown.d.ts +8 -18
  6. package/package.json +1 -1
  7. package/src/combinator/control/manipulation/indent.ts +15 -12
  8. package/src/combinator/control/manipulation/match.ts +2 -3
  9. package/src/combinator/data/parser.ts +1 -1
  10. package/src/parser/api/bind.test.ts +6 -6
  11. package/src/parser/api/parse.test.ts +8 -1
  12. package/src/parser/api/parse.ts +1 -1
  13. package/src/parser/block/blockquote.test.ts +31 -31
  14. package/src/parser/block/blockquote.ts +1 -3
  15. package/src/parser/block/extension/aside.test.ts +3 -3
  16. package/src/parser/block/extension/aside.ts +0 -3
  17. package/src/parser/block/extension/example.test.ts +11 -11
  18. package/src/parser/block/extension/example.ts +1 -3
  19. package/src/parser/block/extension/fig.test.ts +5 -5
  20. package/src/parser/block/extension/figure.test.ts +2 -2
  21. package/src/parser/block/extension/figure.ts +2 -4
  22. package/src/parser/block/extension/message.ts +0 -2
  23. package/src/parser/block/ilist.ts +4 -5
  24. package/src/parser/block/olist.ts +26 -22
  25. package/src/parser/block/paragraph.test.ts +3 -3
  26. package/src/parser/block/ulist.ts +3 -13
  27. package/src/parser/block.ts +0 -3
  28. package/src/parser/inline/annotation.test.ts +18 -18
  29. package/src/parser/inline/annotation.ts +1 -1
  30. package/src/parser/inline/autolink/hashnum.ts +1 -1
  31. package/src/parser/inline/autolink/hashtag.ts +5 -5
  32. package/src/parser/inline/autolink.ts +2 -2
  33. package/src/parser/inline/code.ts +1 -1
  34. package/src/parser/inline/comment.ts +1 -1
  35. package/src/parser/inline/extension/index.ts +4 -5
  36. package/src/parser/inline/html.ts +3 -3
  37. package/src/parser/inline/reference.test.ts +58 -58
  38. package/src/parser/inline/reference.ts +4 -4
  39. package/src/parser/inline.test.ts +20 -20
  40. package/src/parser/locale.test.ts +1 -1
  41. package/src/parser/processor/figure.test.ts +3 -3
  42. package/src/parser/processor/figure.ts +2 -2
  43. package/src/parser/processor/footnote.test.ts +60 -2
  44. package/src/parser/processor/footnote.ts +53 -24
  45. package/src/parser/source/str.ts +2 -2
  46. package/src/parser/util.ts +14 -10
  47. package/src/util/info.ts +4 -4
  48. package/src/util/toc.ts +12 -16
  49. package/src/parser/block/indentblock.test.ts +0 -30
  50. package/src/parser/block/indentblock.ts +0 -13
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.250.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.253.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("DOMPurify"), require("Prism"));
@@ -2337,17 +2337,18 @@ const surround_1 = __webpack_require__(7130);
2337
2337
 
2338
2338
  const memoize_1 = __webpack_require__(1808);
2339
2339
 
2340
- function indent(parser, separation = false) {
2341
- return (0, bind_1.bind)((0, block_1.block)((0, match_1.match)(/^(?=(([ \t])\2*))/, (0, memoize_1.memoize)(([, indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, source => [[unline(source)], '']))), ([, indent]) => indent.length * 2 + +(indent[0] === ' '), [])), separation), (nodes, rest, context) => {
2342
- const result = parser(nodes.join('\n'), context);
2340
+ function indent(opener, parser, separation = false) {
2341
+ if (typeof opener === 'function') return indent(/^([ \t])\1*/, opener, parser);
2342
+ return (0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, source => [[source], '']))), ([indent]) => indent.length * 2 + +(indent[0] === ' '), [])), separation), (lines, rest, context) => {
2343
+ const result = parser(trimBlockEnd(lines.join('')), context);
2343
2344
  return result && (0, parser_1.exec)(result) === '' ? [(0, parser_1.eval)(result), rest] : global_1.undefined;
2344
2345
  });
2345
2346
  }
2346
2347
 
2347
2348
  exports.indent = indent;
2348
2349
 
2349
- function unline(line) {
2350
- return line === '' || line[line.length - 1] !== '\n' ? line : line.slice(0, -1);
2350
+ function trimBlockEnd(block) {
2351
+ return block === '' || block[block.length - 1] !== '\n' ? block : block.slice(0, -1);
2351
2352
  }
2352
2353
 
2353
2354
  /***/ }),
@@ -2392,10 +2393,9 @@ function match(pattern, f) {
2392
2393
  if (source === '') return;
2393
2394
  const param = source.match(pattern);
2394
2395
  if (!param) return;
2395
- const rest = source.slice(param[0].length);
2396
- const result = f(param)(rest, context);
2396
+ const result = f(param)(source, context);
2397
2397
  if (!result) return;
2398
- return (0, parser_1.exec)(result).length < source.length && (0, parser_1.exec)(result).length <= rest.length ? result : global_1.undefined;
2398
+ return (0, parser_1.exec)(result).length < source.length && (0, parser_1.exec)(result).length <= source.length ? result : global_1.undefined;
2399
2399
  };
2400
2400
  }
2401
2401
 
@@ -3632,8 +3632,6 @@ const dlist_1 = __webpack_require__(9373);
3632
3632
 
3633
3633
  const table_1 = __webpack_require__(8717);
3634
3634
 
3635
- const indentblock_1 = __webpack_require__(3565);
3636
-
3637
3635
  const codeblock_1 = __webpack_require__(1849);
3638
3636
 
3639
3637
  const mathblock_1 = __webpack_require__(3754);
@@ -3657,7 +3655,7 @@ exports.block = (0, combinator_1.creator)(error((0, combinator_1.reset)({
3657
3655
  budget: 100 * 1000,
3658
3656
  recursion: 200
3659
3657
  }
3660
- }, (0, combinator_1.union)([source_1.emptyline, horizontalrule_1.horizontalrule, heading_1.heading, ulist_1.ulist, olist_1.olist, ilist_1.ilist, dlist_1.dlist, table_1.table, indentblock_1.indentblock, codeblock_1.codeblock, mathblock_1.mathblock, extension_1.extension, sidefence_1.sidefence, blockquote_1.blockquote, reply_1.reply, paragraph_1.paragraph]))));
3658
+ }, (0, combinator_1.union)([source_1.emptyline, horizontalrule_1.horizontalrule, heading_1.heading, ulist_1.ulist, olist_1.olist, ilist_1.ilist, dlist_1.dlist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, extension_1.extension, sidefence_1.sidefence, blockquote_1.blockquote, reply_1.reply, paragraph_1.paragraph]))));
3661
3659
 
3662
3660
  function error(parser) {
3663
3661
  return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)('\x07', source => {
@@ -3705,20 +3703,16 @@ const unindent = source => source.replace(/(^|\n)>(?:[^\S\n]|(?=>*(?:$|\s)))|\n$
3705
3703
 
3706
3704
  const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)((0, combinator_1.some)(autolink_1.autolink), ns => [(0, dom_1.html)('pre', (0, dom_1.defrag)(ns))])))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
3707
3705
  const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown)), (0, combinator_1.creator)(99, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (source, context) => {
3708
- const annotations = (0, dom_1.html)('ol', {
3709
- class: 'annotations'
3710
- });
3711
3706
  const references = (0, dom_1.html)('ol', {
3712
3707
  class: 'references'
3713
3708
  });
3714
3709
  const document = (0, parse_1.parse)(source, {
3715
3710
  id: '',
3716
3711
  footnotes: {
3717
- annotations,
3718
3712
  references
3719
3713
  }
3720
3714
  }, context);
3721
- return [[(0, dom_1.html)('section', [document, annotations, references])], ''];
3715
+ return [[(0, dom_1.html)('section', [document, references])], ''];
3722
3716
  })))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
3723
3717
 
3724
3718
  /***/ }),
@@ -3903,16 +3897,12 @@ exports.aside = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combi
3903
3897
  'data-invalid-type': !closer || overflow ? 'fence' : 'argument',
3904
3898
  'data-invalid-message': !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument'
3905
3899
  }, `${opener}${body}${overflow || closer}`)];
3906
- const annotations = (0, dom_1.html)('ol', {
3907
- class: 'annotations'
3908
- });
3909
3900
  const references = (0, dom_1.html)('ol', {
3910
3901
  class: 'references'
3911
3902
  });
3912
3903
  const document = (0, parse_1.parse)(body.slice(0, -1), {
3913
3904
  id: '',
3914
3905
  footnotes: {
3915
- annotations,
3916
3906
  references
3917
3907
  }
3918
3908
  }, context);
@@ -3929,7 +3919,7 @@ exports.aside = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combi
3929
3919
  return [(0, dom_1.html)('aside', {
3930
3920
  id: (0, indexee_1.identity)((0, indexee_1.text)(heading)),
3931
3921
  class: 'aside'
3932
- }, [document, annotations, references])];
3922
+ }, [document, references])];
3933
3923
  }))));
3934
3924
 
3935
3925
  /***/ }),
@@ -3969,16 +3959,12 @@ exports.example = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, com
3969
3959
  switch (type) {
3970
3960
  case 'markdown':
3971
3961
  {
3972
- const annotations = (0, dom_1.html)('ol', {
3973
- class: 'annotations'
3974
- });
3975
3962
  const references = (0, dom_1.html)('ol', {
3976
3963
  class: 'references'
3977
3964
  });
3978
3965
  const document = (0, parse_1.parse)(body.slice(0, -1), {
3979
3966
  id: '',
3980
3967
  footnotes: {
3981
- annotations,
3982
3968
  references
3983
3969
  }
3984
3970
  }, context);
@@ -3987,7 +3973,7 @@ exports.example = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, com
3987
3973
  'data-type': 'markdown'
3988
3974
  }, [(0, dom_1.html)('pre', {
3989
3975
  translate: 'no'
3990
- }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, annotations, references])])];
3976
+ }, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, references])])];
3991
3977
  }
3992
3978
 
3993
3979
  case 'math':
@@ -4102,8 +4088,6 @@ const olist_1 = __webpack_require__(7471);
4102
4088
 
4103
4089
  const table_1 = __webpack_require__(8717);
4104
4090
 
4105
- const indentblock_1 = __webpack_require__(3565);
4106
-
4107
4091
  const codeblock_1 = __webpack_require__(1849);
4108
4092
 
4109
4093
  const mathblock_1 = __webpack_require__(3754);
@@ -4128,9 +4112,9 @@ const memoize_1 = __webpack_require__(1808);
4128
4112
 
4129
4113
  const array_1 = __webpack_require__(8112);
4130
4114
 
4131
- exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n]|(?=\[?\$))/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${fence}[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([// All parsers which can include closing terms.
4115
+ exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n])?(?=\[?\$)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${fence}[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([// All parsers which can include closing terms.
4132
4116
  (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length, [])));
4133
- exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:figure[^\S\n]+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, indentblock_1.indentblock, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.context)({
4117
+ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.context)({
4134
4118
  syntax: {
4135
4119
  inline: {
4136
4120
  media: false
@@ -4265,8 +4249,6 @@ const ilist_1 = __webpack_require__(238);
4265
4249
 
4266
4250
  const table_1 = __webpack_require__(8717);
4267
4251
 
4268
- const indentblock_1 = __webpack_require__(3565);
4269
-
4270
4252
  const codeblock_1 = __webpack_require__(1849);
4271
4253
 
4272
4254
  const mathblock_1 = __webpack_require__(3754);
@@ -4327,7 +4309,7 @@ function title(type) {
4327
4309
  } // Must not have indexed blocks.
4328
4310
 
4329
4311
 
4330
- const content = (0, combinator_1.union)([source_1.emptyline, ulist_1.ulist, olist_1.olist, ilist_1.ilist, table_1.table, indentblock_1.indentblock, codeblock_1.codeblock, mathblock_1.mathblock, sidefence_1.sidefence, blockquote_1.blockquote, paragraph_1.paragraph]);
4312
+ const content = (0, combinator_1.union)([source_1.emptyline, ulist_1.ulist, olist_1.olist, ilist_1.ilist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, sidefence_1.sidefence, blockquote_1.blockquote, paragraph_1.paragraph]);
4331
4313
 
4332
4314
  /***/ }),
4333
4315
 
@@ -4723,8 +4705,6 @@ const olist_1 = __webpack_require__(7471);
4723
4705
 
4724
4706
  const inline_1 = __webpack_require__(1160);
4725
4707
 
4726
- const source_1 = __webpack_require__(6743);
4727
-
4728
4708
  const dom_1 = __webpack_require__(3252);
4729
4709
 
4730
4710
  exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^[-+*](?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.context)({
@@ -4734,7 +4714,7 @@ exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
4734
4714
  }
4735
4715
  }
4736
4716
  }, exports.ilist_))));
4737
- exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^[-+*](?:$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^[-+*](?:$|\s)/, (0, combinator_1.trim)((0, combinator_1.some)(inline_1.inline)), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), (0, combinator_1.rewrite)(source_1.contentline, source => [[(0, dom_1.html)('span', source.replace('\n', ''))], ''])), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))])])))), es => [(0, dom_1.html)('ul', {
4717
+ exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^[-+*](?:$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^[-+*](?:$|\s)/, (0, combinator_1.some)(inline_1.inline), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), olist_1.invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))])])))), es => [(0, dom_1.html)('ul', {
4738
4718
  class: 'invalid',
4739
4719
  'data-invalid-syntax': 'list',
4740
4720
  'data-invalid-type': 'syntax',
@@ -4743,29 +4723,6 @@ exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combin
4743
4723
 
4744
4724
  /***/ }),
4745
4725
 
4746
- /***/ 3565:
4747
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4748
-
4749
- "use strict";
4750
-
4751
-
4752
- Object.defineProperty(exports, "__esModule", ({
4753
- value: true
4754
- }));
4755
- exports.indentblock = void 0;
4756
-
4757
- const combinator_1 = __webpack_require__(2087);
4758
-
4759
- const codeblock_1 = __webpack_require__(1849); // 空行を含むインデントブロックはインデントの違いによるセグメント分割の境界が視認不能となるため採用しない
4760
-
4761
-
4762
- exports.indentblock = (0, combinator_1.block)((0, combinator_1.validate)(/^(?: |\t)/, (0, combinator_1.indent)((0, combinator_1.convert)(source => {
4763
- const fence = (source.match(/^`{3,}(?=[^\S\n]*$)/mg) ?? []).reduce((max, fence) => fence > max ? fence : max, '``') + '`';
4764
- return `${fence}\n${source}\n${fence}`;
4765
- }, (0, combinator_1.union)([codeblock_1.codeblock])), true)));
4766
-
4767
- /***/ }),
4768
-
4769
4726
  /***/ 3754:
4770
4727
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4771
4728
 
@@ -4813,7 +4770,7 @@ exports.mathblock = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0,
4813
4770
  Object.defineProperty(exports, "__esModule", ({
4814
4771
  value: true
4815
4772
  }));
4816
- exports.olist_ = exports.olist = void 0;
4773
+ exports.invalid = exports.olist_ = exports.olist = void 0;
4817
4774
 
4818
4775
  const global_1 = __webpack_require__(4128);
4819
4776
 
@@ -4835,28 +4792,30 @@ const memoize_1 = __webpack_require__(1808);
4835
4792
 
4836
4793
  const array_1 = __webpack_require__(8112);
4837
4794
 
4795
+ const tuple_1 = __webpack_require__(5341);
4796
+
4838
4797
  const openers = {
4839
- '.': /^(?:[0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?=$|\s)/,
4840
- '(': /^\((?:[0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?=$|\s)/
4798
+ '.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?:$|\s)/,
4799
+ '(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?:$|\s)/
4841
4800
  };
4842
- exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)([/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/, /^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/], (0, combinator_1.context)({
4801
+ exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/.source, /^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/.source].join('|')), (0, combinator_1.context)({
4843
4802
  syntax: {
4844
4803
  inline: {
4845
4804
  media: false
4846
4805
  }
4847
4806
  }
4848
4807
  }, exports.olist_))));
4849
- exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(new RegExp(`^(?=${openers['.'].source.replace('?:', '')})`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]).charCodeAt(0) || 0, [])), (0, combinator_1.match)(new RegExp(`^(?=${openers['('].source.replace('?:', '')})`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1]).charCodeAt(0) || 0, []))])));
4808
+ exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]).charCodeAt(0) || 0, [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1]).charCodeAt(0) || 0, []))])));
4850
4809
 
4851
- const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((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)(heads[form], (0, combinator_1.trim)((0, combinator_1.subsequence)([ulist_1.checkbox, (0, util_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)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), invalid), ns => [(0, dom_1.html)('li', {
4852
- 'data-marker': ns[0]
4810
+ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((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)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, util_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)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), exports.invalid), ns => [(0, dom_1.html)('li', {
4811
+ 'data-marker': ns[0] || global_1.undefined
4853
4812
  }, (0, dom_1.defrag)((0, ulist_1.fillFirstLine)((0, array_1.shift)(ns)[1])))]), true)]))), es => [format((0, dom_1.html)('ol', es), type, form)]);
4854
4813
 
4855
4814
  const heads = {
4856
- '.': (0, combinator_1.focus)(openers['.'], source => [[`${source.split('.', 1)[0]}.`], '']),
4857
- '(': (0, combinator_1.focus)(openers['('], source => [[source.replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')], ''])
4815
+ '.': (0, combinator_1.focus)(openers['.'], source => [[source.trimEnd().split('.', 1)[0] + '.'], '']),
4816
+ '(': (0, combinator_1.focus)(openers['('], source => [[source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')], ''])
4858
4817
  };
4859
- const invalid = (0, combinator_1.rewrite)(source_1.contentline, source => [['', (0, dom_1.html)('span', {
4818
+ exports.invalid = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(s => [(0, tuple_1.tuple)(s), ''])]), source => [['', (0, dom_1.html)('span', {
4860
4819
  class: 'invalid',
4861
4820
  'data-invalid-syntax': 'listitem',
4862
4821
  'data-invalid-type': 'syntax',
@@ -5228,8 +5187,6 @@ const ilist_1 = __webpack_require__(238);
5228
5187
 
5229
5188
  const inline_1 = __webpack_require__(1160);
5230
5189
 
5231
- const source_1 = __webpack_require__(6743);
5232
-
5233
5190
  const util_1 = __webpack_require__(9437);
5234
5191
 
5235
5192
  const dom_1 = __webpack_require__(3252);
@@ -5243,16 +5200,10 @@ exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
5243
5200
  }
5244
5201
  }
5245
5202
  }, exports.ulist_))));
5246
- exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^-(?=$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.trim)((0, combinator_1.subsequence)([exports.checkbox, (0, util_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_]))]), invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)(fillFirstLine(ns)))]), true)])))), es => [format((0, dom_1.html)('ul', es))])));
5203
+ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^-(?=$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.subsequence)([exports.checkbox, (0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), olist_1.invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)(fillFirstLine(ns)))]), true)])))), es => [format((0, dom_1.html)('ul', es))])));
5247
5204
  exports.checkbox = (0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [[(0, dom_1.html)('span', {
5248
5205
  class: 'checkbox'
5249
5206
  }, source[1].trimStart() ? '☑' : '☐')], '']);
5250
- const invalid = (0, combinator_1.rewrite)(source_1.contentline, source => [[(0, dom_1.html)('span', {
5251
- class: 'invalid',
5252
- 'data-invalid-syntax': 'listitem',
5253
- 'data-invalid-type': 'syntax',
5254
- 'data-invalid-message': 'Fix the indent or the head of the list item'
5255
- }, source.replace('\n', ''))], '']);
5256
5207
 
5257
5208
  function fillFirstLine(ns) {
5258
5209
  return ns.length === 1 && typeof ns[0] === 'object' && ['UL', 'OL'].includes(ns[0].tagName) ? (0, array_1.unshift)([(0, dom_1.html)('br')], ns) : ns;
@@ -5455,7 +5406,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0,
5455
5406
  delimiters: global_1.undefined
5456
5407
  }, (0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', /^\\?\n/)))), '))'), ns => [(0, dom_1.html)('sup', {
5457
5408
  class: 'annotation'
5458
- }, (0, dom_1.defrag)(ns))]))));
5409
+ }, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])]))));
5459
5410
 
5460
5411
  /***/ }),
5461
5412
 
@@ -5493,8 +5444,8 @@ const util_1 = __webpack_require__(9437);
5493
5444
  exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]|\S#)/, (0, combinator_1.guard)(context => context.syntax?.inline?.autolink ?? true, (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
5494
5445
  (0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*(?:@(?:[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)+/), channel_1.channel, account_1.account, // Escape unmatched account-like strings.
5495
5446
  (0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), // Escape invalid leading characters.
5496
- (0, source_1.str)(new RegExp(String.raw`^(?:[^\p{C}\p{S}\p{P}\s]|${hashtag_1.emoji}|['_])(?=#)`, 'u')), hashtag_1.hashtag, hashnum_1.hashnum, // Escape unmatched hashtag-like strings.
5497
- (0, source_1.str)(new RegExp(String.raw`^#+(?:[^\p{C}\p{S}\p{P}\s]|${hashtag_1.emoji}|['_])*`, 'u')), anchor_1.anchor])))), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)]);
5447
+ (0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])(?=#)/u.source.replace('emoji', hashtag_1.emoji), 'u')), hashtag_1.hashtag, hashnum_1.hashnum, // Escape unmatched hashtag-like strings.
5448
+ (0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])*/u.source.replace('emoji', hashtag_1.emoji), 'u')), anchor_1.anchor])))), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)]);
5498
5449
 
5499
5450
  /***/ }),
5500
5451
 
@@ -5648,7 +5599,7 @@ const source_1 = __webpack_require__(6743);
5648
5599
 
5649
5600
  const dom_1 = __webpack_require__(3252);
5650
5601
 
5651
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(String.raw`^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|${hashtag_1.emoji}|['_])`, 'u'))), (0, combinator_1.context)({
5602
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.context)({
5652
5603
  syntax: {
5653
5604
  inline: {
5654
5605
  link: true,
@@ -5684,7 +5635,7 @@ const dom_1 = __webpack_require__(3252); // https://example/hashtags/a must be a
5684
5635
 
5685
5636
 
5686
5637
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
5687
- exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp(['^', String.raw`(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|${exports.emoji}))`, String.raw`(?:[^\p{C}\p{S}\p{P}\s]|${exports.emoji}|_(?=[^\p{C}\p{S}\p{P}\s]|${exports.emoji})){1,128}`, String.raw`(?!_?(?:[^\p{C}\p{S}\p{P}\s]|${exports.emoji})|')`].join(''), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.context)({
5638
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.context)({
5688
5639
  syntax: {
5689
5640
  inline: {
5690
5641
  link: true,
@@ -5776,7 +5727,7 @@ const dom_1 = __webpack_require__(3252);
5776
5727
 
5777
5728
  exports.code = (0, combinator_1.creator)((0, combinator_1.validate)('`', (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?[^`\n])\1(?!`)/, ([whole,, body]) => rest => [[(0, dom_1.html)('code', {
5778
5729
  'data-src': whole
5779
- }, format(body))], rest])));
5730
+ }, format(body))], rest.slice(whole.length)])));
5780
5731
 
5781
5732
  function format(text) {
5782
5733
  return `${text[0]}${text[text.length - 1]}` === ' ' && text.trimStart() ? text.slice(1, -1) : text;
@@ -5807,7 +5758,7 @@ const memoize_1 = __webpack_require__(1808);
5807
5758
 
5808
5759
  const array_1 = __webpack_require__(8112);
5809
5760
 
5810
- exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[%', (0, combinator_1.match)(/^(?=\[(%+)\s)/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`)), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5761
+ exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[%', (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`)), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5811
5762
  class: 'comment'
5812
5763
  }, [(0, dom_1.html)('input', {
5813
5764
  type: 'checkbox'
@@ -6015,7 +5966,7 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combi
6015
5966
  autolink: false
6016
5967
  }
6017
5968
  }
6018
- }, (0, combinator_1.open)((0, source_1.stropt)('|'), (0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', /^\\?\n/), true)))), ']'), ns => [(0, dom_1.html)('a', (0, util_1.trimNodeEnd)((0, dom_1.defrag)(ns)))])), ([el]) => [(0, dom_1.define)(el, {
5969
+ }, (0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, util_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', /^\\?\n/)), true)))), ']'), ns => [(0, dom_1.html)('a', (0, dom_1.defrag)(ns))])), ([el]) => [(0, dom_1.define)(el, {
6019
5970
  id: el.id ? null : global_1.undefined,
6020
5971
  class: 'index',
6021
5972
  href: el.id ? `#${el.id}` : global_1.undefined
@@ -6266,7 +6217,7 @@ const attrspec = {
6266
6217
  };
6267
6218
  global_1.Object.setPrototypeOf(attrspec, null);
6268
6219
  global_1.Object.values(attrspec).forEach(o => global_1.Object.setPrototypeOf(o, null));
6269
- exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([(0, combinator_1.match)(/^(?=<(wbr)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)(`<${tag}`, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), /^\s*>/, true, ([, bs = []], rest) => [[(0, dom_1.html)(tag, attributes('html', [], attrspec[tag], bs))], rest]), ([, tag]) => tags.indexOf(tag), [])), (0, combinator_1.match)(/^(?=<(sup|sub|small|bdo|bdi)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true)])), `</${tag}>`), (0, source_1.str)(`</${tag}>`), false, ([as, bs, cs], rest) => [[elem(tag, as, bs, cs)], rest]), ([, tag]) => tags.indexOf(tag), [])), (0, combinator_1.match)(/^(?=<([a-z]+)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true)])), `</${tag}>`), (0, source_1.str)(`</${tag}>`), false, ([as, bs, cs], rest) => [[elem(tag, as, bs, cs)], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
6220
+ exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([(0, combinator_1.match)(/^<(wbr)(?=[^\S\n]|>)/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)(`<${tag}`, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), /^\s*>/, true, ([, bs = []], rest) => [[(0, dom_1.html)(tag, attributes('html', [], attrspec[tag], bs))], rest]), ([, tag]) => tags.indexOf(tag), [])), (0, combinator_1.match)(/^<(sup|sub|small|bdo|bdi)(?=[^\S\n]|>)/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true)])), `</${tag}>`), (0, source_1.str)(`</${tag}>`), false, ([as, bs, cs], rest) => [[elem(tag, as, bs, cs)], rest]), ([, tag]) => tags.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true)])), `</${tag}>`), (0, source_1.str)(`</${tag}>`), false, ([as, bs, cs], rest) => [[elem(tag, as, bs, cs)], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
6270
6221
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]);
6271
6222
 
6272
6223
  function elem(tag, as, bs, cs) {
@@ -6719,7 +6670,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, c
6719
6670
  }
6720
6671
  },
6721
6672
  delimiters: global_1.undefined
6722
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.focus)(/^\^[^\S\n]*/, source => [['', source], '']), (0, util_1.trimBlank)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))]))), ']]'), ns => [(0, dom_1.html)('sup', attributes(ns), (0, dom_1.defrag)(ns))]))));
6673
+ }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/)), (0, util_1.trimBlank)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))]))), ']]'), ns => [(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])]))));
6723
6674
  const abbr = (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(util_1.regBlankStart, '')]));
6724
6675
 
6725
6676
  function attributes(ns) {
@@ -7046,7 +6997,7 @@ const multimap_1 = __webpack_require__(940);
7046
6997
  const array_1 = __webpack_require__(8112);
7047
6998
 
7048
6999
  function* figure(target, footnotes, opts = {}) {
7049
- const refs = new multimap_1.MultiMap((0, array_1.push)((0, array_1.push)((0, array_1.push)([], target.querySelectorAll('a.label:not(.disabled)[data-label]')), footnotes?.annotations.querySelectorAll('a.label:not(.disabled)') ?? []), footnotes?.references.querySelectorAll('a.label:not(.disabled)') ?? []).map(el => [el.getAttribute('data-label'), el]));
7000
+ const refs = new multimap_1.MultiMap((0, array_1.push)((0, array_1.push)((0, array_1.push)([], target.querySelectorAll('a.label:not(.disabled)[data-label]')), footnotes?.annotations?.querySelectorAll('a.label:not(.disabled)') ?? []), footnotes?.references.querySelectorAll('a.label:not(.disabled)') ?? []).map(el => [el.getAttribute('data-label'), el]));
7050
7001
  const labels = new global_1.Set();
7051
7002
  const numbers = new global_1.Map();
7052
7003
  let base = '0';
@@ -7238,37 +7189,54 @@ const dom_1 = __webpack_require__(3252);
7238
7189
 
7239
7190
  const multimap_1 = __webpack_require__(940);
7240
7191
 
7241
- const memoize_1 = __webpack_require__(1808);
7192
+ const array_1 = __webpack_require__(8112);
7242
7193
 
7243
7194
  function* footnote(target, footnotes, opts = {}) {
7244
- yield* (0, exports.reference)(target, footnotes?.references, opts, footnotes?.annotations && [footnotes.annotations]);
7245
- yield* (0, exports.annotation)(target, footnotes?.annotations, opts, []);
7195
+ yield* (0, exports.reference)(target, footnotes?.references, opts);
7196
+ yield* (0, exports.annotation)(target, footnotes?.annotations, opts);
7246
7197
  return;
7247
7198
  }
7248
7199
 
7249
7200
  exports.footnote = footnote;
7250
- exports.annotation = build('annotation', n => `*${n}`);
7201
+ exports.annotation = build('annotation', n => `*${n}`, 'h1, h2, h3, h4, h5, h6, aside.aside, hr');
7251
7202
  exports.reference = build('reference', (n, abbr) => `[${abbr || n}]`);
7252
7203
 
7253
- function build(syntax, marker) {
7204
+ function build(syntax, marker, splitter) {
7254
7205
  // Referenceを含むAnnotationの重複排除は両構文が互いに処理済みであることを必要とするため
7255
7206
  // 構文ごとに各1回の処理では不可能
7256
- const identify = (0, memoize_1.memoize)(ref => `${+!ref.querySelector('.label')}:${ref.getAttribute('data-abbr') || '_' + ref.innerHTML}`, new global_1.WeakMap());
7257
- const contentify = (0, memoize_1.memoize)(ref => (0, dom_1.frag)(ref.cloneNode(true).childNodes), new global_1.WeakMap());
7258
- return function* (target, footnote, opts = {}, footnotes = []) {
7207
+ return function* (target, footnote, opts = {}) {
7208
+ //assert(syntax !== 'annotation' || !footnote);
7259
7209
  const defs = new global_1.Map();
7260
7210
  const buffer = new multimap_1.MultiMap();
7261
- const titles = new global_1.Map();
7262
- const check = footnotes.some(el => target.contains(el));
7211
+ const titles = new global_1.Map(); // Bug: Firefox
7212
+ //const splitters = push([], target.querySelectorAll(`:scope > :is(${splitter ?? '_'})`));
7213
+
7214
+ const splitters = (0, array_1.push)([], target.querySelectorAll(splitter ?? '_')).filter(el => el.parentNode === target); // Bug: Firefox
7215
+ //target.querySelectorAll(`:scope > .${syntax}s`).forEach(el => el.remove());
7216
+
7217
+ target.querySelectorAll(`.${syntax}s`).forEach(el => el.parentNode === target && el.remove());
7218
+ let offset = 0;
7263
7219
  let style;
7264
7220
 
7265
7221
  for (let refs = target.querySelectorAll(`sup.${syntax}:not(.disabled)`), i = 0, len = refs.length; i < len; ++i) {
7266
7222
  yield;
7267
7223
  const ref = refs[i];
7268
- if (check && footnotes.some(el => el.contains(ref))) continue;
7269
- const identifier = identify(ref);
7224
+
7225
+ while (+splitters[0]?.compareDocumentPosition(ref) & global_1.Node.DOCUMENT_POSITION_FOLLOWING) {
7226
+ if (defs.size > 0) {
7227
+ offset += defs.size;
7228
+ yield* proc(defs, target.insertBefore((0, dom_1.html)('ol', {
7229
+ class: `${syntax}s`
7230
+ }), splitters[0] ?? null));
7231
+ }
7232
+
7233
+ splitters.shift();
7234
+ }
7235
+
7236
+ if (syntax === 'annotation' && ref.closest('#annotations, .annotations, #references, .references')) continue;
7237
+ const identifier = `${+!ref.querySelector('.label')}:${ref.getAttribute('data-abbr') || '_' + ref.firstElementChild.innerHTML}`;
7270
7238
  const abbr = ref.getAttribute('data-abbr') || global_1.undefined;
7271
- const content = contentify(ref);
7239
+ const content = (0, dom_1.frag)(ref.firstElementChild.cloneNode(true).childNodes);
7272
7240
  style ??= abbr ? 'abbr' : 'count';
7273
7241
 
7274
7242
  if (style === 'count' ? abbr : !abbr) {
@@ -7278,12 +7246,17 @@ function build(syntax, marker) {
7278
7246
  'data-invalid-type': 'style',
7279
7247
  'data-invalid-message': `${syntax[0].toUpperCase() + syntax.slice(1)} style must be consistent`
7280
7248
  });
7249
+ } else if (ref.getAttribute('data-invalid-type') === 'style') {
7250
+ (0, dom_1.define)(ref, {
7251
+ class: void ref.classList.remove('invalid'),
7252
+ 'data-invalid-syntax': null,
7253
+ 'data-invalid-type': null,
7254
+ 'data-invalid-message': null
7255
+ });
7281
7256
  }
7282
7257
 
7283
- if (ref.firstElementChild?.getAttribute('hidden') !== '') {
7284
- ref.replaceChildren((0, dom_1.html)('span', {
7285
- hidden: ''
7286
- }, ref.childNodes));
7258
+ if (!ref.firstElementChild.hasAttribute('hidden')) {
7259
+ ref.firstElementChild.setAttribute('hidden', '');
7287
7260
  } else {
7288
7261
  ref.lastChild?.remove();
7289
7262
  }
@@ -7294,7 +7267,8 @@ function build(syntax, marker) {
7294
7267
  const refIndex = i + 1;
7295
7268
  const refId = opts.id !== '' ? ref.id || `${syntax}:${opts.id ? `${opts.id}:` : ''}ref:${refIndex}` : global_1.undefined;
7296
7269
  const def = global_1.undefined || defs.get(identifier) || defs.set(identifier, (0, dom_1.html)('li', {
7297
- id: opts.id !== '' ? `${syntax}:${opts.id ? `${opts.id}:` : ''}def:${defs.size + 1}` : global_1.undefined
7270
+ id: opts.id !== '' ? `${syntax}:${opts.id ? `${opts.id}:` : ''}def:${defs.size + offset + 1}` : global_1.undefined,
7271
+ 'data-marker': !footnote ? marker(defs.size + offset + 1, abbr) : global_1.undefined
7298
7272
  }, [content.cloneNode(true), (0, dom_1.html)('sup')])).get(identifier);
7299
7273
 
7300
7274
  if (title && !blank && def.childNodes.length === 1) {
@@ -7312,7 +7286,7 @@ function build(syntax, marker) {
7312
7286
  }
7313
7287
  }
7314
7288
 
7315
- const defIndex = +def.id.slice(def.id.lastIndexOf(':') + 1) || defs.size;
7289
+ const defIndex = +def.id.slice(def.id.lastIndexOf(':') + 1) || defs.size + offset;
7316
7290
  const defId = def.id || global_1.undefined;
7317
7291
  (0, dom_1.define)(ref, {
7318
7292
  id: refId,
@@ -7335,7 +7309,16 @@ function build(syntax, marker) {
7335
7309
  }, `^${refIndex}`));
7336
7310
  }
7337
7311
 
7338
- if (!footnote) return;
7312
+ if (defs.size > 0 || footnote) {
7313
+ yield* proc(defs, footnote ?? target.insertBefore((0, dom_1.html)('ol', {
7314
+ class: `${syntax}s`
7315
+ }), splitters[0] ?? target.querySelector(':scope > :is(#annotations, #references)')));
7316
+ }
7317
+
7318
+ return;
7319
+ };
7320
+
7321
+ function* proc(defs, footnote) {
7339
7322
  const {
7340
7323
  children
7341
7324
  } = footnote;
@@ -7343,7 +7326,8 @@ function build(syntax, marker) {
7343
7326
  let count = 0;
7344
7327
  let length = children.length;
7345
7328
 
7346
- I: for (const def of defs.values()) {
7329
+ I: for (const [key, def] of defs) {
7330
+ defs.delete(key);
7347
7331
  ++count;
7348
7332
 
7349
7333
  while (length > size) {
@@ -7365,7 +7349,7 @@ function build(syntax, marker) {
7365
7349
  }
7366
7350
 
7367
7351
  return;
7368
- };
7352
+ }
7369
7353
  }
7370
7354
 
7371
7355
  function equal(a, b) {
@@ -7618,11 +7602,11 @@ exports.str = str;
7618
7602
  function stropt(pattern) {
7619
7603
  return typeof pattern === 'string' ? (0, combinator_1.creator)(source => {
7620
7604
  if (source === '') return;
7621
- return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : [[], source];
7605
+ return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : global_1.undefined;
7622
7606
  }) : (0, combinator_1.creator)(source => {
7623
7607
  if (source === '') return;
7624
7608
  const m = source.match(pattern);
7625
- return m ? [[m[0]], source.slice(m[0].length)] : [[], source];
7609
+ return m ? [[m[0]], source.slice(m[0].length)] : global_1.undefined;
7626
7610
  });
7627
7611
  }
7628
7612
 
@@ -7779,7 +7763,7 @@ exports.unescsource = (0, combinator_1.creator)(source => {
7779
7763
  Object.defineProperty(exports, "__esModule", ({
7780
7764
  value: true
7781
7765
  }));
7782
- exports.stringify = exports.trimNodeEnd = exports.trimBlank = exports.isStartTightNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = void 0;
7766
+ exports.stringify = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = void 0;
7783
7767
 
7784
7768
  const global_1 = __webpack_require__(4128);
7785
7769
 
@@ -7797,7 +7781,7 @@ const memoize_1 = __webpack_require__(1808);
7797
7781
 
7798
7782
  const array_1 = __webpack_require__(8112);
7799
7783
 
7800
- exports.regBlankStart = new RegExp(String.raw`^(?:\\?[^\S\n]|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr>)+`);
7784
+ exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
7801
7785
 
7802
7786
  function blankWith(starting, delimiter) {
7803
7787
  if (delimiter === global_1.undefined) return blankWith('', starting);
@@ -7807,7 +7791,7 @@ function blankWith(starting, delimiter) {
7807
7791
  exports.blankWith = blankWith;
7808
7792
 
7809
7793
  function visualize(parser) {
7810
- const blankline = new RegExp(String.raw`^(?:\\$|\\?[^\S\n]|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr>)+$`, 'gm');
7794
+ const blankline = new RegExp(/^(?:\\$|\\?[^\S\n]|&IHN;|<wbr>)+$/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'gm');
7811
7795
  return (0, combinator_1.union)([(0, combinator_1.convert)(source => source.replace(blankline, line => line.replace(/[\\&<]/g, '\x1B$&')), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))), (0, combinator_1.some)((0, combinator_1.union)([source_1.linebreak, source_1.unescsource]))]);
7812
7796
  }
7813
7797
 
@@ -7926,14 +7910,22 @@ function isVisible(node, strpos) {
7926
7910
  }
7927
7911
 
7928
7912
  function trimBlank(parser) {
7929
- return (0, combinator_1.fmap)(trimBlankStart(parser), trimNodeEnd);
7913
+ return trimBlankStart(trimBlankEnd(parser));
7930
7914
  }
7931
7915
 
7932
7916
  exports.trimBlank = trimBlank;
7933
7917
 
7934
7918
  function trimBlankStart(parser) {
7935
7919
  return (0, combinator_1.convert)((0, memoize_1.reduce)(source => source.replace(exports.regBlankStart, '')), parser);
7936
- } //export function trimNode(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
7920
+ }
7921
+
7922
+ exports.trimBlankStart = trimBlankStart;
7923
+
7924
+ function trimBlankEnd(parser) {
7925
+ return (0, combinator_1.fmap)(parser, trimNodeEnd);
7926
+ }
7927
+
7928
+ exports.trimBlankEnd = trimBlankEnd; //export function trimNode(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
7937
7929
  // return trimNodeStart(trimNodeEnd(nodes));
7938
7930
  //}
7939
7931
  //function trimNodeStart(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
@@ -7951,7 +7943,6 @@ function trimBlankStart(parser) {
7951
7943
  // return nodes;
7952
7944
  //}
7953
7945
 
7954
-
7955
7946
  function trimNodeEnd(nodes) {
7956
7947
  const skip = nodes.length > 0 && typeof nodes[nodes.length - 1] === 'object' && nodes[nodes.length - 1]['className'] === 'indexer' ? [nodes.pop()] : [];
7957
7948
 
@@ -7971,8 +7962,6 @@ function trimNodeEnd(nodes) {
7971
7962
  return (0, array_1.push)(nodes, skip);
7972
7963
  }
7973
7964
 
7974
- exports.trimNodeEnd = trimNodeEnd;
7975
-
7976
7965
  function stringify(nodes) {
7977
7966
  let acc = '';
7978
7967
 
@@ -8501,13 +8490,13 @@ exports.info = void 0;
8501
8490
 
8502
8491
  const scope_1 = __webpack_require__(5202);
8503
8492
 
8504
- const query_1 = __webpack_require__(6120);
8493
+ const array_1 = __webpack_require__(8112);
8505
8494
 
8506
8495
  function info(source) {
8507
8496
  const match = (0, scope_1.scope)(source, '.invalid');
8508
8497
  return {
8509
- url: find('a:not(.email):not(.account):not(.channel):not(.hashtag):not(.hashnum):not(.anchor)').filter(el => ['http:', 'https:'].includes(el.protocol)),
8510
- tel: find('a:not(.email):not(.account):not(.channel):not(.hashtag):not(.hashnum):not(.anchor)').filter(el => ['tel:'].includes(el.protocol)),
8498
+ url: find('a:not(:is(.email, .account, .channel, .hashtag, .hashnum, .anchor))').filter(el => ['http:', 'https:'].includes(el.protocol)),
8499
+ tel: find('a:not(:is(.email, .account, .channel, .hashtag, .hashnum, .anchor))').filter(el => ['tel:'].includes(el.protocol)),
8511
8500
  email: find('a.email'),
8512
8501
  account: find('a.account'),
8513
8502
  channel: find('a.channel'),
@@ -8519,7 +8508,7 @@ function info(source) {
8519
8508
  };
8520
8509
 
8521
8510
  function find(selector) {
8522
- return (0, query_1.querySelectorAll)(source, selector).filter(match);
8511
+ return (0, array_1.push)([], source.querySelectorAll(selector)).filter(match);
8523
8512
  }
8524
8513
  }
8525
8514
 
@@ -8692,29 +8681,21 @@ const array_1 = __webpack_require__(8112); // Bug: Firefox
8692
8681
  //const selector = 'h1 h2 h3 h4 h5 h6 aside.aside'.split(' ').map(s => `:scope > ${s}[id]`).join();
8693
8682
 
8694
8683
 
8695
- const selector = 'h1 h2 h3 h4 h5 h6 aside.aside'.split(' ').map(s => `${s}[id]`).join();
8684
+ const selector = ':is(h1, h2, h3, h4, h5, h6, aside.aside)[id]';
8696
8685
 
8697
8686
  function toc(source) {
8698
- const es = source.querySelectorAll(selector);
8699
- const hs = (0, global_1.Array)(es.length);
8700
-
8701
- for (let i = 0; i < hs.length; ++i) {
8702
- const el = es[i];
8703
-
8687
+ const hs = (0, array_1.push)([], source.querySelectorAll(selector)).map(el => {
8704
8688
  switch (el.tagName) {
8705
8689
  case 'ASIDE':
8706
- hs[i] = (0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
8690
+ return (0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
8707
8691
  id: el.id,
8708
8692
  class: 'aside'
8709
8693
  }, el.firstElementChild.cloneNode(true).childNodes);
8710
- continue;
8711
8694
 
8712
8695
  default:
8713
- hs[i] = el;
8714
- continue;
8696
+ return el;
8715
8697
  }
8716
- }
8717
-
8698
+ });
8718
8699
  return parse(cons(hs));
8719
8700
  }
8720
8701